Search Results

Search found 18153 results on 727 pages for 'null coalescing'.

Page 1/727 | 1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >

  • null pointers vs. Null Object Pattern

    - by GlenH7
    Attribution: This grew out of a related P.SE question My background is in C / C++, but I have worked a fair amount in Java and am currently coding C#. Because of my C background, checking passed and returned pointers is second-hand, but I acknowledge it biases my point of view. I recently saw mention of the Null Object Pattern where the idea is than an object is always returned. Normal case returns the expected, populated object and the error case returns empty object instead of a null pointer. The premise being that the calling function will always have some sort of object to access and therefore avoid null access memory violations. So what are the pros / cons of a null check versus using the Null Object Pattern? I can see cleaner calling code with the NOP, but I can also see where it would create hidden failures that don't otherwise get raised. I would rather have my application fail hard (aka an exception) while I'm developing it than have a silent mistake escape into the wild. Can't the Null Object Pattern have similar problems as not performing a null check? Many of the objects I have worked with hold objects or containers of their own. It seems like I would have to have a special case to guarantee all of the main object's containers had empty objects of their own. Seems like this could get ugly with multiple layers of nesting.

    Read the article

  • How do I fix a noisy input device (Internal Mic)? snd_hda_intel - debug included

    - by hazrpg
    As the title says, I'm having trouble with a very noisy audio input device - the internal mic or any plugged in mics. So far I've narrowed it down to an problem in ALSA since my debug info is showing a lot of "null" values. Can anyone help? Debug Info: http://www.alsa-project.org/db/?f=e0c6fb7e10624bf7691aa2b405cf0d3968e56c63 Exert from the debug: model : (null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null)

    Read the article

  • Unique ways to use the Null Coalescing operator

    - by Atomiton
    I know the standard way of using the Null coalescing operator in C# is to set default values. string nobody = null; string somebody = "Bob Saget"; string anybody = ""; anybody = nobody ?? "Mr. T"; // returns Mr. T anybody = somebody ?? "Mr. T"; // returns "Bob Saget" But what else can ?? be used for? It doesn't seem as useful as the ternary operator, apart from being more concise and easier to read than: nobody = null; anybody = nobody == null ? "Bob Saget" : nobody; // returns Bob Saget So given that fewer even know about null coalescing operator... Have you used ?? for something else? Is ?? necessary, or should you just use the ternary operator (that most are familiar with)

    Read the article

  • null coalescing operator for javascript?

    - by Daniel Schaffer
    I assumed this question has already been asked here, but I couldn't find any, so here it goes: Is there a null coalescing operator in Javascript? For example, in C#, I can do this: String someString = null; var whatIWant = someString ?? "Cookies!"; The best approximation I can figure out for Javascript is using the conditional operator: var someString = null; var whatIWant = someString ? someString : 'Cookies!'; Which is sorta icky IMHO. Can I do better?

    Read the article

  • Null Or Empty Coalescing

    - by Latest Microsoft Blogs
    In my last blog post, I wrote about the proper way to check for empty enumerations and proposed an IsNullOrEmpty method for collections which sparked a lot of discussion. This post covers a similar issue, but from a different angle. A very long time ago Read More......(read more)

    Read the article

  • Unity completely broken after upgrade to 12.10?

    - by NlightNFotis
    I am facing a very frustrating issue with my computer right now. I successfully upgraded to Ubuntu 12.10 this afternoon, but after the upgrade, the graphical user interface seems completely broken. To be more specific, I can not get the Unity bar to appear on the right. I have tried many things, including (but not limited to) purging and then reinstalling the fglrx drivers, apt-get install --reinstall ubuntu-desktop, apt-get install --reinstall unity, tried to remove the Xorg and Compiz configurations, checked to see if the Ubuntu Unity wall was enabled (it was) in ccsm, all to no avail. Could someone help me troubleshoot and essentially fix this issue? NOTE: This is the output when I try to enable unity via a terminal: compiz (core) - Info: Loading plugin: core compiz (core) - Info: Starting plugin: core unity-panel-service: no process found compiz (core) - Info: Loading plugin: reset compiz (core) - Error: Failed to load plugin: reset compiz (core) - Info: Loading plugin: ccp compiz (core) - Info: Starting plugin: ccp compizconfig - Info: Backend : gsettings compizconfig - Info: Integration : true compizconfig - Info: Profile : unity compiz (core) - Info: Loading plugin: composite compiz (core) - Info: Starting plugin: composite compiz (core) - Info: Loading plugin: opengl X Error of failed request: BadRequest (invalid request code or no such operation) Major opcode of failed request: 153 (GLX) Minor opcode of failed request: 19 (X_GLXQueryServerString) Serial number of failed request: 22 Current serial number in output stream: 22 compiz (core) - Info: Unity is not supported by your hardware. Enabling software rendering instead (slow). compiz (core) - Info: Starting plugin: opengl Compiz (opengl) - Fatal: glXQueryExtensionsString is NULL for screen 0 compiz (core) - Error: Plugin initScreen failed: opengl compiz (core) - Error: Failed to start plugin: opengl compiz (core) - Info: Unloading plugin: opengl compiz (core) - Info: Loading plugin: decor compiz (core) - Info: Starting plugin: decor compiz (decor) - Warn: requested a pixmap type decoration when compositing isn't available compiz (decor) - Warn: requested a pixmap type decoration when compositing isn't available compiz (decor) - Warn: requested a pixmap type decoration when compositing isn't available compiz (decor) - Warn: requested a pixmap type decoration when compositing isn't available compiz (decor) - Warn: requested a pixmap type decoration when compositing isn't available compiz (decor) - Warn: requested a pixmap type decoration when compositing isn't available compiz (decor) - Warn: requested a pixmap type decoration when compositing isn't available compiz (decor) - Warn: requested a pixmap type decoration when compositing isn't available compiz (decor) - Warn: requested a pixmap type decoration when compositing isn't available compiz (decor) - Warn: requested a pixmap type decoration when compositing isn't available compiz (decor) - Warn: requested a pixmap type decoration when compositing isn't available Compiz (opengl) - Fatal: glXQueryExtensionsString is NULL for screen 0 Compiz (opengl) - Fatal: glXQueryExtensionsString is NULL for screen 0 Compiz (opengl) - Fatal: glXQueryExtensionsString is NULL for screen 0 Compiz (opengl) - Fatal: glXQueryExtensionsString is NULL for screen 0 Compiz (opengl) - Fatal: glXQueryExtensionsString is NULL for screen 0 Compiz (opengl) - Fatal: glXQueryExtensionsString is NULL for screen 0 Compiz (opengl) - Fatal: glXQueryExtensionsString is NULL for screen 0 Compiz (opengl) - Fatal: glXQueryExtensionsString is NULL for screen 0 Compiz (opengl) - Fatal: glXQueryExtensionsString is NULL for screen 0 Compiz (opengl) - Fatal: glXQueryExtensionsString is NULL for screen 0 Compiz (opengl) - Fatal: glXQueryExtensionsString is NULL for screen 0 Compiz (opengl) - Fatal: glXQueryExtensionsString is NULL for screen 0 Compiz (opengl) - Fatal: glXQueryExtensionsString is NULL for screen 0 Compiz (opengl) - Fatal: glXQueryExtensionsString is NULL for screen 0 Compiz (opengl) - Fatal: glXQueryExtensionsString is NULL for screen 0 Compiz (opengl) - Fatal: glXQueryExtensionsString is NULL for screen 0 Compiz (opengl) - Fatal: glXQueryExtensionsString is NULL for screen 0 Compiz (opengl) - Fatal: glXQueryExtensionsString is NULL for screen 0 Compiz (opengl) - Fatal: glXQueryExtensionsString is NULL for screen 0 Compiz (opengl) - Fatal: glXQueryExtensionsString is NULL for screen 0 Compiz (opengl) - Fatal: glXQueryExtensionsString is NULL for screen 0 Compiz (opengl) - Fatal: glXQueryExtensionsString is NULL for screen 0 Compiz (opengl) - Fatal: glXQueryExtensionsString is NULL for screen 0 Compiz (opengl) - Fatal: glXQueryExtensionsString is NULL for screen 0 Compiz (opengl) - Fatal: glXQueryExtensionsString is NULL for screen 0 Compiz (opengl) - Fatal: glXQueryExtensionsString is NULL for screen 0 Compiz (opengl) - Fatal: glXQueryExtensionsString is NULL for screen 0 Compiz (opengl) - Fatal: glXQueryExtensionsString is NULL for screen 0 Compiz (opengl) - Fatal: glXQueryExtensionsString is NULL for screen 0 Compiz (opengl) - Fatal: glXQueryExtensionsString is NULL for screen 0 Compiz (opengl) - Fatal: glXQueryExtensionsString is NULL for screen 0 Compiz (opengl) - Fatal: glXQueryExtensionsString is NULL for screen 0 Compiz (opengl) - Fatal: glXQueryExtensionsString is NULL for screen 0 Compiz (opengl) - Fatal: glXQueryExtensionsString is NULL for screen 0 Compiz (opengl) - Fatal: glXQueryExtensionsString is NULL for screen 0 Compiz (opengl) - Fatal: glXQueryExtensionsString is NULL for screen 0 Compiz (opengl) - Fatal: glXQueryExtensionsString is NULL for screen 0 Compiz (opengl) - Fatal: glXQueryExtensionsString is NULL for screen 0 Compiz (opengl) - Fatal: glXQueryExtensionsString is NULL for screen 0 Compiz (opengl) - Fatal: glXQueryExtensionsString is NULL for screen 0 Compiz (opengl) - Fatal: glXQueryExtensionsString is NULL for screen 0 Compiz (opengl) - Fatal: glXQueryExtensionsString is NULL for screen 0 Compiz (opengl) - Fatal: glXQueryExtensionsString is NULL for screen 0 Compiz (opengl) - Fatal: glXQueryExtensionsString is NULL for screen 0 Compiz (opengl) - Fatal: glXQueryExtensionsString is NULL for screen 0 Compiz (opengl) - Fatal: glXQueryExtensionsString is NULL for screen 0 Compiz (opengl) - Fatal: glXQueryExtensionsString is NULL for screen 0 Compiz (opengl) - Fatal: glXQueryExtensionsString is NULL for screen 0 Compiz (opengl) - Fatal: glXQueryExtensionsString is NULL for screen 0 Compiz (opengl) - Fatal: glXQueryExtensionsString is NULL for screen 0 Compiz (opengl) - Fatal: glXQueryExtensionsString is NULL for screen 0 Compiz (opengl) - Fatal: glXQueryExtensionsString is NULL for screen 0 Compiz (opengl) - Fatal: glXQueryExtensionsString is NULL for screen 0 Compiz (opengl) - Fatal: glXQueryExtensionsString is NULL for screen 0 Compiz (opengl) - Fatal: glXQueryExtensionsString is NULL for screen 0 Compiz (opengl) - Fatal: glXQueryExtensionsString is NULL for screen 0 Compiz (opengl) - Fatal: glXQueryExtensionsString is NULL for screen 0 Compiz (opengl) - Fatal: glXQueryExtensionsString is NULL for screen 0 Compiz (opengl) - Fatal: glXQueryExtensionsString is NULL for screen 0 Compiz (opengl) - Fatal: glXQueryExtensionsString is NULL for screen 0 Compiz (opengl) - Fatal: glXQueryExtensionsString is NULL for screen 0 Compiz (opengl) - Fatal: glXQueryExtensionsString is NULL for screen 0 Compiz (opengl) - Fatal: glXQueryExtensionsString is NULL for screen 0 Compiz (opengl) - Fatal: glXQueryExtensionsString is NULL for screen 0 Compiz (opengl) - Fatal: glXQueryExtensionsString is NULL for screen 0 Compiz (opengl) - Fatal: glXQueryExtensionsString is NULL for screen 0 Compiz (opengl) - Fatal: glXQueryExtensionsString is NULL for screen 0 Compiz (opengl) - Fatal: glXQueryExtensionsString is NULL for screen 0 Compiz (opengl) - Fatal: glXQueryExtensionsString is NULL for screen 0 Compiz (opengl) - Fatal: glXQueryExtensionsString is NULL for screen 0 Compiz (opengl) - Fatal: glXQueryExtensionsString is NULL for screen 0 Compiz (opengl) - Fatal: glXQueryExtensionsString is NULL for screen 0 Compiz (opengl) - Fatal: glXQueryExtensionsString is NULL for screen 0 Compiz (opengl) - Fatal: glXQueryExtensionsString is NULL for screen 0 Compiz (opengl) - Fatal: glXQueryExtensionsString is NULL for screen 0 Compiz (opengl) - Fatal: glXQueryExtensionsString is NULL for screen 0 compiz (core) - Info: Loading plugin: imgpng compiz (core) - Info: Starting plugin: imgpng compiz (core) - Info: Loading plugin: vpswitch compiz (core) - Info: Starting plugin: vpswitch compiz (core) - Info: Loading plugin: resize compiz (core) - Info: Starting plugin: resize Compiz (opengl) - Fatal: glXQueryExtensionsString is NULL for screen 0 compiz (core) - Info: Loading plugin: compiztoolbox compiz (core) - Info: Starting plugin: compiztoolbox compiz (core) - Error: Plugin 'opengl' not loaded. compiz (core) - Info: Loading plugin: move compiz (core) - Info: Starting plugin: move compiz (core) - Info: Loading plugin: gnomecompat compiz (core) - Info: Starting plugin: gnomecompat compiz (core) - Info: Loading plugin: mousepoll compiz (core) - Info: Starting plugin: mousepoll compiz (core) - Info: Loading plugin: wall compiz (core) - Info: Starting plugin: wall compiz (core) - Error: Plugin 'opengl' not loaded. compiz (core) - Error: Plugin init failed: wall compiz (core) - Error: Failed to start plugin: wall compiz (core) - Info: Unloading plugin: wall compiz (core) - Info: Loading plugin: regex compiz (core) - Info: Starting plugin: regex compiz (core) - Info: Loading plugin: snap compiz (core) - Info: Starting plugin: snap compiz (core) - Info: Loading plugin: unitymtgrabhandles compiz (core) - Info: Starting plugin: unitymtgrabhandles compiz (core) - Error: Plugin 'opengl' not loaded. compiz (core) - Error: Plugin init failed: unitymtgrabhandles compiz (core) - Error: Failed to start plugin: unitymtgrabhandles compiz (core) - Info: Unloading plugin: unitymtgrabhandles compiz (core) - Info: Loading plugin: place compiz (core) - Info: Starting plugin: place compiz (core) - Info: Loading plugin: grid compiz (core) - Info: Starting plugin: grid Compiz (opengl) - Fatal: glXQueryExtensionsString is NULL for screen 0 compiz (core) - Info: Loading plugin: animation compiz (core) - Info: Starting plugin: animation compiz (core) - Error: Plugin 'opengl' not loaded. compiz (core) - Error: Plugin init failed: animation compiz (core) - Error: Failed to start plugin: animation compiz (core) - Info: Unloading plugin: animation compiz (core) - Info: Loading plugin: fade compiz (core) - Info: Starting plugin: fade compiz (core) - Error: Plugin 'opengl' not loaded. compiz (core) - Error: Plugin init failed: fade compiz (core) - Error: Failed to start plugin: fade compiz (core) - Info: Unloading plugin: fade compiz (core) - Info: Loading plugin: session compiz (core) - Info: Starting plugin: session compiz (core) - Info: Loading plugin: expo compiz (core) - Info: Starting plugin: expo compiz (core) - Error: Plugin 'opengl' not loaded. compiz (core) - Error: Plugin init failed: expo compiz (core) - Error: Failed to start plugin: expo compiz (core) - Info: Unloading plugin: expo compiz (core) - Info: Loading plugin: ezoom compiz (core) - Info: Starting plugin: ezoom compiz (core) - Error: Plugin 'opengl' not loaded. compiz (core) - Error: Plugin init failed: ezoom compiz (core) - Error: Failed to start plugin: ezoom compiz (core) - Info: Unloading plugin: ezoom compiz (core) - Info: Loading plugin: workarounds compiz (core) - Info: Starting plugin: workarounds compiz (core) - Error: Plugin 'opengl' not loaded. Compiz (opengl) - Fatal: glXQueryExtensionsString is NULL for screen 0 compiz (core) - Info: Loading plugin: scale compiz (core) - Info: Starting plugin: scale compiz (core) - Error: Plugin 'opengl' not loaded. compiz (core) - Error: Plugin init failed: scale compiz (core) - Error: Failed to start plugin: scale compiz (core) - Info: Unloading plugin: scale Compiz (opengl) - Fatal: glXQueryExtensionsString is NULL for screen 0 Compiz (opengl) - Fatal: glXQueryExtensionsString is NULL for screen 0 Compiz (opengl) - Fatal: glXQueryExtensionsString is NULL for screen 0 Compiz (opengl) - Fatal: glXQueryExtensionsString is NULL for screen 0 Compiz (opengl) - Fatal: glXQueryExtensionsString is NULL for screen 0 Compiz (opengl) - Fatal: glXQueryExtensionsString is NULL for screen 0 Compiz (opengl) - Fatal: glXQueryExtensionsString is NULL for screen 0 Compiz (opengl) - Fatal: glXQueryExtensionsString is NULL for screen 0 Compiz (opengl) - Fatal: glXQueryExtensionsString is NULL for screen 0 Segmentation fault (core dumped)

    Read the article

  • Listing both null and not null in mysql query

    - by tomasz
    Let's say I have the table NAME | ID | REF foo1 | 1 | NULL foo2 | 2 | 1234 foo2 | 3 | 567 foo1 | 4 | NULL foo3 | 5 | 89 I'd like to count all instances of NULL and NOT NULL in one query so that I can say NAME | null | not null foo1 | 0 | 2 foo2 | 2 | 0 foo3 | 0 | 1 I could run these two queries select NAME,count(*) from TABLE where REF is not null select NAME,count(*) from TABLE where REF is null But I'm sure there must be a simple way to do it in one mysql query.

    Read the article

  • Null check error message as "is null" or "was null"

    - by Timo Westkämper
    When doing null checks in Java code, and you throw IllegalArgumentExceptions for null values, what kind of message template do you use? We tend to use something like this public User getUser(String username){ if (username == null){ throw new IllegalArgumentException("username is null"); } // ... } What is better : "is null" or "was null", and why? For me "is null" feels more natural.

    Read the article

  • So which null equals this null, that null? maybe this null, or is it this null?

    - by GrumpyOldDBA
    Tuning takes many routes and I get into some interesting situations and often make some exciting finds, see http://sqlblogcasts.com/blogs/grumpyolddba/archive/2010/05/17/just-when-you-thought-it-was-safe.aspx for an example. Today I encountered a multitude of Foreign Key constraints on a table, now FKs are often candidates for indexes and as none of the defined keys had an index it required a closer look. I view foreign key constraints as somewhat of a pain, excessive keys can cause excessive related...(read more)

    Read the article

  • Check parameters annotated with @Nonnull for null?

    - by David Harkness
    We've begun using FindBugs with and annotating our parameters with @Nonnull appropriately, and it works great to point out bugs early in the cycle. So far we have continued checking these arguments for null using Guava's checkNotNull, but I would prefer to check for null only at the edges--places where the value can come in without having been checked for null, e.g., a SOAP request. // service layer accessible from outside public Person createPerson(@CheckForNull String name) { return new Person(Preconditions.checkNotNull(name)); } ... // internal constructor accessed only by the service layer public Person(@Nonnull String name) { this.name = Preconditions.checkNotNull(name); // remove this check? } I understand that @Nonnull does not block null values itself. However, given that FindBugs will point out anywhere a value is transferred from an unmarked field to one marked @Nonnull, can't we depend on it to catch these cases (which it does) without having to check these values for null everywhere they get passed around in the system? Am I naive to want to trust the tool and avoid these verbose checks? Bottom line: While it seems safe to remove the second null check below, is it bad practice? This question is perhaps too similar to Should one check for null if he does not expect null, but I'm asking specifically in relation to the @Nonnull annotation.

    Read the article

  • MySql query optimization help

    - by rohitgu
    I have few queries and am not able to figure out how to optimize them, QUERY 1 select * from t_twitter_tracking where classified is null and tweetType='ENGLISH' order by id limit 500; QUERY 2 Select count(*) as cnt, DATE_FORMAT(CONVERT_TZ(wrdTrk.createdOnGMTDate,'+00:00','+05:30'),'%Y-%m-%d') as dat from t_twitter_tracking wrdTrk where wrdTrk.word like ('dell') and CONVERT_TZ(wrdTrk.createdOnGMTDate,'+00:00','+05:30') between '2010-12-12 00:00:00' and '2010-12-26 00:00:00' group by dat; Both these queries run on the same table, CREATE TABLE `t_twitter_tracking` ( `id` BIGINT(20) NOT NULL AUTO_INCREMENT, `word` VARCHAR(200) NOT NULL, `tweetId` BIGINT(100) NOT NULL, `twtText` VARCHAR(800) NULL DEFAULT NULL, `language` TEXT NULL, `links` TEXT NULL, `tweetType` VARCHAR(20) NULL DEFAULT NULL, `source` TEXT NULL, `sourceStripped` TEXT NULL, `isTruncated` VARCHAR(40) NULL DEFAULT NULL, `inReplyToStatusId` BIGINT(30) NULL DEFAULT NULL, `inReplyToUserId` INT(11) NULL DEFAULT NULL, `rtUsrProfilePicUrl` TEXT NULL, `isFavorited` VARCHAR(40) NULL DEFAULT NULL, `inReplyToScreenName` VARCHAR(40) NULL DEFAULT NULL, `latitude` BIGINT(100) NOT NULL, `longitude` BIGINT(100) NOT NULL, `retweetedStatus` VARCHAR(40) NULL DEFAULT NULL, `statusInReplyToStatusId` BIGINT(100) NOT NULL, `statusInReplyToUserId` BIGINT(100) NOT NULL, `statusFavorited` VARCHAR(40) NULL DEFAULT NULL, `statusInReplyToScreenName` TEXT NULL, `screenName` TEXT NULL, `profilePicUrl` TEXT NULL, `twitterId` BIGINT(100) NOT NULL, `name` TEXT NULL, `location` VARCHAR(100) NULL DEFAULT NULL, `bio` TEXT NULL, `url` TEXT NULL COLLATE 'latin1_swedish_ci', `utcOffset` INT(11) NULL DEFAULT NULL, `timeZone` VARCHAR(100) NULL DEFAULT NULL, `frenCnt` BIGINT(20) NULL DEFAULT '0', `createdAt` DATETIME NULL DEFAULT NULL, `createdOnGMT` VARCHAR(40) NULL DEFAULT NULL, `createdOnServerTime` DATETIME NULL DEFAULT NULL, `follCnt` BIGINT(20) NULL DEFAULT '0', `favCnt` BIGINT(20) NULL DEFAULT '0', `totStatusCnt` BIGINT(20) NULL DEFAULT NULL, `usrCrtDate` VARCHAR(200) NULL DEFAULT NULL, `humanSentiment` VARCHAR(30) NULL DEFAULT NULL, `replied` BIT(1) NULL DEFAULT NULL, `replyMsg` TEXT NULL, `classified` INT(32) NULL DEFAULT NULL, `createdOnGMTDate` DATETIME NULL DEFAULT NULL, `locationDetail` TEXT NULL, `geonameid` INT(11) NULL DEFAULT NULL, `country` VARCHAR(255) NULL DEFAULT NULL, `continent` CHAR(2) NULL DEFAULT NULL, `placeLongitude` FLOAT NULL DEFAULT NULL, `placeLatitude` FLOAT NULL DEFAULT NULL, PRIMARY KEY (`id`), INDEX `id` (`id`, `word`), INDEX `createdOnGMT_index` (`createdOnGMT`) USING BTREE, INDEX `word_index` (`word`) USING BTREE, INDEX `location_index` (`location`) USING BTREE, INDEX `classified_index` (`classified`) USING BTREE, INDEX `tweetType_index` (`tweetType`) USING BTREE, INDEX `getunclassified_index` (`classified`, `tweetType`) USING BTREE, INDEX `timeline_index` (`word`, `createdOnGMTDate`, `classified`) USING BTREE, INDEX `createdOnGMTDate_index` (`createdOnGMTDate`) USING BTREE, INDEX `locdetail_index` (`country`, `id`) USING BTREE, FULLTEXT INDEX `twtText_index` (`twtText`) ) COLLATE='utf8_general_ci' ENGINE=MyISAM ROW_FORMAT=DEFAULT AUTO_INCREMENT=12608048; The table has more than 10 million records. How can I optimize it?

    Read the article

  • PHP: why is this null different from the other null

    - by matthy
    hi i tried 2 things what should be the same however it my testing says different does anyone know why the only thing i do is put it in a variable... if ($_SESSION[$something] === null) echo("this is null"); $_SESSION[$something] does not exists so it indeed says: "this is null". now look at this $theSession = $_SESSION[$something]; if (theSession === null) echo("this is null"); now it does not say "this is null" while it should be exactly the same right?

    Read the article

  • Difference between null==object and object==null

    - by priyank.mp
    Hi I would like to know diff between the above comparisons? I am getting null pointer exception when I check object.getItems() == null. But if I change it to null == object.getItems(), it workes fine. I did look into this http://stackoverflow.com/questions/2938476/what-is-the-difference-between-null-object-and-objectnull-closed But I didnt get satisfactory answer.

    Read the article

  • "Null" is null or not an object error in IE javascript

    - by user89691
    The following code executes fine in Firefox and Chrome, but gives an error: 'null' is null or not an object when executed in Internet Explorer. if (xmlhttp.responseXML != null) { var xmlDoc = xmlhttp.responseXML.documentElement ; var ResultNodes = xmlDoc.getElementsByTagName ("Result") ; <---- error here if (ResultNodes != null) { (I would have thought the line after the one indicated would be more likely to return the error but the debugger says the run-time error is at the line indicated) Any ideas why?

    Read the article

  • "Null" is null or not an object error in IE javascript

    - by rossmcm
    The following code executes fine in Firefox and Chrome, but gives an error: 'null' is null or not an object when executed in Internet Explorer. if (xmlhttp.responseXML != null) { var xmlDoc = xmlhttp.responseXML.documentElement ; var ResultNodes = xmlDoc.getElementsByTagName ("Result") ; <---- error here if (ResultNodes != null) { (I would have thought the line after the one indicated would be more likely to return the error but the debugger says the run-time error is at the line indicated) Any ideas why?

    Read the article

  • Null object that is not null

    - by Guillaume
    Hello, I use 2 threads to act like a produce/consumer using double queue (http://www.codeproject.com/KB/threads/DoubleQueue.aspx). Sometimes in my 2nd thread, I get an object that is NULL but it should not be as I filled it in the first thread. I tried this: if(myObject.Data == null) { Console.WriteLine("Null Object") // <-- Breakpoint here } When I my break point hits, I can watch myObject.Data and indeed it's NULL, but when I hit F10 and then go to the next line (which is } ) myObject.Data is not NULL. I also added a lock on myObject before if .... to be sure that no one whould use this object. How is that possible and what can I do ?

    Read the article

  • Returning null vs Throwing exceptions

    - by Svish
    Is in a bit of disagreement with a more experienced developer on this issue, and was wondering what you guys here think about this. Environment is Java, EJB 3, services, etc. The code I wrote calls a service to get things and to create things. Problem was that I got null pointer exceptions in places that didn't make sense. For example when I asked the service to create an object, I got null back. And when I tried to look up an object with an id I knew existed, I still got null back. Was like it was ignoring me. Spent some time trying to figure out what was wrong in my code (since I'm less experienced I usually assume I have messed up). Turns out the reason was security. If the user principal using my service didn't have the right permissions to use the service I called from my service, then that service simply returned null. The services that are here already are usually not documented either, so this is just something you have to know... somehow... So here is the thing: I mean that this is rather confusing as a developer interacting with this service. To me it would make much more sense if that service thew an exception which would tell me that hey, you don't have the proper permissions to get info about this thing or to create this new thing. I would then immediately know why my service wasn't working as expected. However, he argued that asking is not wrong. Exceptions should only be thrown when there is an error and asking for a thing is not an error. Even if you don't have permission to "see" that the thing you asked for. The things are often looked up in a GUI by users and for those users not having the right permissions, these things simply "do not exist". So, in short: Asking is not wrong, hence no exception. Get methods return null because to those users those things "doesn't exist". Create methods return null because nothing was created, since the user wasn't allowed to create anything. So, what do you guys think? Is this normal and/or good practice? I prefer exceptions as I prefer throwing and catching exceptions because I find it much easier to know what's going on. So I would for example also prefer to throw a NotFoundException if you asked for an id which didn't exist, rather than returning null. Anyways, just curious to what others think about this as I'm not the most experienced developer yet.

    Read the article

  • Negate the null-coalescing operator

    - by jhunter
    I have a bunch of strings I need to use .Trim() on, but they can be null. It would be much more concise if I could do something like: string endString = startString !?? startString.Trim(); Basically return the part on the right if the part on the left is NOT null, otherwise just return the null value. I just ended up using the ternary operator, but is there anyway to use the null-coalescing operator for this purpose?

    Read the article

  • MySQL Database Query Problem

    - by moustafa
    I need your help!!!. I need to query a table in my database that has record of goods sold. I want the query to detect a particular product and also calculate the quantity sold. The product are 300 now, but it would increase in the future. Below is a sample of my DB Table #---------------------------- # Table structure for litorder #---------------------------- CREATE TABLE `litorder` ( `id` int(10) NOT NULL auto_increment, `name` varchar(50) NOT NULL default '', `address` varchar(50) NOT NULL default '', `xdate` date NOT NULL default '0000-00-00', `ref` varchar(20) NOT NULL default '', `code1` varchar(50) NOT NULL default '', `code2` varchar(50) NOT NULL default '', `code3` varchar(50) NOT NULL default '', `code4` varchar(50) NOT NULL default '', `code5` varchar(50) NOT NULL default '', `code6` varchar(50) NOT NULL default '', `code7` varchar(50) NOT NULL default '', `code8` varchar(50) NOT NULL default '', `code9` varchar(50) NOT NULL default '', `code10` varchar(50) NOT NULL default '', `code11` varchar(50) character set latin1 collate latin1_bin NOT NULL default '', `code12` varchar(50) NOT NULL default '', `code13` varchar(50) NOT NULL default '', `code14` varchar(50) NOT NULL default '', `code15` varchar(50) NOT NULL default '', `product1` varchar(100) NOT NULL default '0', `product2` varchar(100) NOT NULL default '0', `product3` varchar(100) NOT NULL default '0', `product4` varchar(100) NOT NULL default '0', `product5` varchar(100) NOT NULL default '0', `product6` varchar(100) NOT NULL default '0', `product7` varchar(100) NOT NULL default '0', `product8` varchar(100) NOT NULL default '0', `product9` varchar(100) NOT NULL default '0', `product10` varchar(100) NOT NULL default '0', `product11` varchar(100) NOT NULL default '0', `product12` varchar(100) NOT NULL default '0', `product13` varchar(100) NOT NULL default '0', `product14` varchar(100) NOT NULL default '0', `product15` varchar(100) NOT NULL default '0', `price1` int(10) NOT NULL default '0', `price2` int(10) NOT NULL default '0', `price3` int(10) NOT NULL default '0', `price4` int(10) NOT NULL default '0', `price5` int(10) NOT NULL default '0', `price6` int(10) NOT NULL default '0', `price7` int(10) NOT NULL default '0', `price8` int(10) NOT NULL default '0', `price9` int(10) NOT NULL default '0', `price10` int(10) NOT NULL default '0', `price11` int(10) NOT NULL default '0', `price12` int(10) NOT NULL default '0', `price13` int(10) NOT NULL default '0', `price14` int(10) NOT NULL default '0', `price15` int(10) NOT NULL default '0', `quantity1` int(10) NOT NULL default '0', `quantity2` int(10) NOT NULL default '0', `quantity3` int(10) NOT NULL default '0', `quantity4` int(10) NOT NULL default '0', `quantity5` int(10) NOT NULL default '0', `quantity6` int(10) NOT NULL default '0', `quantity7` int(10) NOT NULL default '0', `quantity8` int(10) NOT NULL default '0', `quantity9` int(10) NOT NULL default '0', `quantity10` int(10) NOT NULL default '0', `quantity11` int(10) NOT NULL default '0', `quantity12` int(10) NOT NULL default '0', `quantity13` int(10) NOT NULL default '0', `quantity14` int(10) NOT NULL default '0', `quantity15` int(10) NOT NULL default '0', `amount1` int(10) NOT NULL default '0', `amount2` int(10) NOT NULL default '0', `amount3` int(10) NOT NULL default '0', `amount4` int(10) NOT NULL default '0', `amount5` int(10) NOT NULL default '0', `amount6` int(10) NOT NULL default '0', `amount7` int(10) NOT NULL default '0', `amount8` int(10) NOT NULL default '0', `amount9` int(10) NOT NULL default '0', `amount10` int(10) NOT NULL default '0', `amount11` int(10) NOT NULL default '0', `amount12` int(10) NOT NULL default '0', `amount13` int(10) NOT NULL default '0', `amount14` int(10) NOT NULL default '0', `amount15` int(10) NOT NULL default '0', `totalNaira` double(20,0) NOT NULL default '0', `totalDollar` int(20) NOT NULL default '0', PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 COMMENT='InnoDB free: 4096 kB; InnoDB free: 4096 kB; InnoDB free: 409'; #---------------------------- # Records for table litorder #---------------------------- insert into litorder values (27, 'Sanyaolu Fisayo', '14 Adegboyega Street Palmgrove Lagos', '2010-05-31', '', 'DL 001', 'DL 002', 'DL 003', '', '', '', '', '', '', '', '', '', '', '', '', 'AILMENT & PREVENTION DVD- ENGLISH', 'AILMENT & PREVENTION DVD- HAUSA', 'BEAUTY CD', '', '', '', '', '', '', '', '', '', '', '', '', 800, 800, 3000, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 16, 16, 20, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 12800, 12800, 60000, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, '85600', 563), (28, 'Irenonse Esther', 'Lagos,Nigeria', '2010-06-01', '', 'DL 005', 'DL 008', 'FC 004', '', '', '', '', '', '', '', '', '', '', '', '', 'GET HEALTHY DVD', 'YOUR FUTURE DVD', 'FOREVER FACE CAP (YELLOW)', '', '', '', '', '', '', '', '', '', '', '', '', 1000, 900, 2000, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 2, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2000, 1800, 6000, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, '9800', 64), (29, 'Kalu Lekway', 'Lagos, Nigeria', '2010-06-01', '', 'DL 001', 'DL 003', '', '', '', '', '', '', '', '', '', '', '', '', '', 'AILMENT & PREVENTION DVD- ENGLISH', 'BEAUTY CD', '', '', '', '', '', '', '', '', '', '', '', '', '', 800, 3000, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2400, 18000, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, '20400', 133), (30, 'Dele', 'Ilupeju', '2010-06-02', '', 'DL 001', 'DL 003', '', '', '', '', '', '', '', '', '', '', '', '', '', 'AILMENT & PREVENTION DVD- ENGLISH', 'BEAUTY CD', '', '', '', '', '', '', '', '', '', '', '', '', '', 800, 3000, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 10, 10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8000, 30000, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, '38000', 250);

    Read the article

  • C# ?? null coalescing operator

    - by anirudha
    the null coalescing operator is used for set the value when object is null. if object have some value that nothing change and still have their default value they have.  string str = "i am string";            string message = str ?? "it is null";   the message have same value as str variable because str not null. if str is null that message have value “it is null”; as declared in statement. coalescing operator does not work on nullable operator such as int?

    Read the article

  • wcf web service in post method, object properties are null, although the object is not null

    - by Abdalhadi Kolayb
    i have this problem in post method when i send object parameter to the method, then the object is not null, but all its properties have the default values. here is data module: [DataContract] public class Products { [DataMember(Order = 1)] public int ProdID { get; set; } [DataMember(Order = 2)] public string ProdName { get; set; } [DataMember(Order = 3)] public float PrpdPrice { get; set; } } and here is the interface: [OperationContract] [WebInvoke( Method = "POST", UriTemplate = "AddProduct", ResponseFormat = WebMessageFormat.Json, BodyStyle = WebMessageBodyStyle.WrappedRequest, RequestFormat = WebMessageFormat.Json)] string AddProduct([MessageParameter(Name = "prod")]Products prod); public string AddProduct(Products prod) { ProductsList.Add(prod); return "return string"; } here is the json request: Content-type:application/json {"prod":[{"ProdID": 111,"ProdName": "P111","PrpdPrice": 111}]} but in the server the object received: {"prod":[{"ProdID": 0,"ProdName": NULL,"PrpdPrice": 0}]}

    Read the article

  • Oral Tradition Check: Two Hundred Meanings for "NULL" in SQL

    - by Thomas L Holaday
    Two decades ago, the topic of "NULL" came up in conversation with a scholarly colleague. As I remember it, he said that C.J.Date, in an essay critical of commercial implementations of SQL, had listed over two hundred meanings for NULL. To my regret, I did not persist the details; but finding that list has since been on my Bucket List. Has anyone else heard this legend? Was it perhaps not Date, but another critic of commercial implementations of SQL?

    Read the article

  • Null-coalescing operator and operator && in C#

    - by abatishchev
    Is it possible to use together any way operator ?? and operator && in next case: bool? Any { get { var any = this.ViewState["any"] as bool?; return any.HasValue ? any.Value && this.SomeBool : any; } } This means next: if any is null then this.Any.HasValue return false if any has value, then it returns value considering another boolean property, i.e. Any && SomeBool

    Read the article

1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >