undefined

How to deep check for “null” or “undefined” with JS?

半城伤御伤魂 提交于 2019-12-10 21:46:29
问题 In a Node.JS project, let's say I have a response from an API or any other object with a structure like { data: { info: { user: { name: "Hercules", password: "Iamthegreatest!" email: "hercules@olymp.gr" } } } } Accessing the members of the object is pretty easy. However, checking the existence before accessing any value gets PITA. I can assume that data is always present. Info, user, name, password and email may be present or may not. There can be a valid info object without an user and there

Simple jQuery callbacks break in IE

左心房为你撑大大i 提交于 2019-12-10 20:14:50
问题 I have a few functions like this: $(this).find('.subnav').fadeIn(200, buttonHide ); Now, buttonHide , in this case, is a function I've declared elsewhere. Once the 200ms fadeIn is complete, I want to call that function. Great. Works in FF and Safari. In IE, though, it returns an error as undefined. In fact, I experienced the SAME problem using the onAfter function in Ariel Flesler's scrollTo ... what gives? What do I have to do for IE to be able to run these callbacks? EDIT: here's the code

nodejs express req.session undefined

最后都变了- 提交于 2019-12-10 19:33:21
问题 Just can't figure this one out. Everything I find about express session says pretty much it just works, that, however, is not the case for me. My whole app configuration app.configure -> app.set 'port', process.env.PORT || 3000 app.set 'views', path.join(__dirname, 'views') app.set 'view engine', 'jade' app.use express.favicon() app.use express.logger('dev') app.use express.json() app.use express.urlencoded() app.use express.methodOverride() app.use app.router app.use express.static(path.join

Python: NameError name '[input]' is not defined [duplicate]

柔情痞子 提交于 2019-12-10 19:04:11
问题 This question already has answers here : input(): “NameError: name 'n' is not defined” [duplicate] (2 answers) Closed 6 years ago . I'm trying to make a simple little tool for converting inches to centimeters and am stuck at trying to take a user input ('y' or 'n') for deciding whether to do another conversion or terminate. Here's what I've done: import time def intro(): print "Welcome! This program will convert inches to centimeters for you.\n" convert() def convert(): input_cm = input((

Behavior of uninitialized local char?

Deadly 提交于 2019-12-10 18:26:12
问题 If you have lets say a local int that is uninitialized, then its gets an undefined value but if you have a local char variable should that not have an undefined value as well? Of course 0 could be that undefined value, but i was wondering if char is any different, since all related info i find is about int and the program below just outputs 0 when the char variable is cast to an int. Im using GCC 4.7 with no flags. int main() { char test1; int test2; std::cout<<test2; //garbage std::cout<<std

SDL in XCode 4.3.2 SDLMain.o undefined symbols

て烟熏妆下的殇ゞ 提交于 2019-12-10 17:31:29
问题 I have started trying to use SDL in Xcode 4.3.2 so I started up a Cocoa application for Mac OS X and connected all my frameworks : OpenGL, SDL etc. I don't have SDL_Image, SDL_Mixer etc. (Do I need these?) When I try to compile the project that just has SDLmain.h and SDLmain.m I get this error: Undefined symbols for architecture x86_64: "_SDL_main", referenced from: -[SDLMain applicationDidFinishLaunching:] in SDLMain.o ld: symbol(s) not found for architecture x86_64 clang: error: linker

Should I declare and check if variables exist in PHP?

大憨熊 提交于 2019-12-10 16:45:28
问题 I've noticed on XAMPP that strict error reporting is on and I get undefined index errors now. I just have two small questions (I'm still learning here): I know you don't have to declare variables in PHP but is there any advantage to declaring them anyway? If not, why do I get errors when strict error reporting is on when I don't define them? When I use get variables for example, I check for their value before I run a function like if($_GET['todo'] == 'adduser') runFunctionAddUser(); This

Javascript: TypeError variable is undefined

感情迁移 提交于 2019-12-10 14:40:47
问题 I am currently building a small web application with similar functionality across all modules. I want to code small generic functions so that all programmers next to me, call these functions and these functions return necessary but important data for them to implement their functionality. In this example, I am trying to deal with the typical "choose true or false" exercise. So from the template.php they call this function: function checkAnswers(){ var radiobuttons = document.form1.exer1; var

How to compile PHP 5.5.19 with OpenSSL 1.0.1 on OS X

心已入冬 提交于 2019-12-10 14:36:54
问题 I've installed OpenSSL 1.0.1j to /usr/local/ssl and now I'm trying to compile PHP 5.5.19 using this version of OpenSSL. Here is my procedure to configure... export CFLAGS="-arch x86_64" export CXXFLAGS="-arch x86_64" export LDFLAGS="-L/usr/local/ssl/lib" export CPPFLAGS="-I/usr/local/ssl/include" ./configure \ --prefix=/usr/local/php5 \ --mandir=/usr/share/man \ --infodir=/usr/share/info \ --sysconfdir=/etc \ --with-config-file-path=/etc \ --with-zlib \ --with-zlib-dir=/usr \ --with-apxs2=

How can I return a value from GM_xmlhttprequest?

↘锁芯ラ 提交于 2019-12-10 14:18:08
问题 I have this code here: var infiltrationResult; while(thisOption) { var trNode = document.createElement('tr'); var tdNode = document.createElement('td'); var hrefNode = document.createElement('a'); infPlanetID = thisOption.getAttribute('value'); var myURL = "http://www.hyperiums.com/servlet/Planetinf?securitylevel=90&newinfiltr=New+infiltration&planetid=" + PlanetID + "&infplanetid=" + infPlanetID; GM_xmlhttpRequest({ method: 'GET', url: myURL, headers: { 'User-agent': 'Mozilla/4.0 (compatible