Search Results

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

Page 13/727 | < Previous Page | 9 10 11 12 13 14 15 16 17 18 19 20  | Next Page >

  • JavaScript: why `null == 0` is false?

    - by lemonedo
    I had to write a routine that increments the value of a variable by 1 if it is a number, or assigns 0 to the variable if it is not a number. The variable can be incremented by the expression, or be assigned null. No other write access to the variable is allowed. So, the variable can be in three states: it is 0, a positive integer, or null. My first implementation was: v >= 0 ? v += 1 : v = 0 (Yes, I admit that v === null ? v = 0 : v += 1 is the exact solution, but I wanted to be concise then.) It failed since null >= 0 is true. I was confused, since if a value is not a number, an numeric expression involving it must be false always. Then I found that null is like 0, since null + 1 == 1, 1 / null == Infinity, Math.pow(2.718281828, null) == 1, ... Strangely enough, however, null == 0 is evaluated to false. I guess null is the only value that makes the following expression false: (v == 0) === (v >= 0 && v <= 0) So why null is so special in JavaScript?

    Read the article

  • SDL_BlitSurface segmentation fault (surfaces aren't null)

    - by Trollkemada
    My app is crashing on SDL_BlitSurface() and i can't figure out why. I think it has something to do with my static object. If you read the code you'll why I think so. This happens when the limits of the map are reached, i.e. (iwidth || jheight). This is the code: Map.cpp (this render) Tile const * Map::getTyle(int i, int j) const { if (i >= 0 && j >= 0 && i < width && j < height) { return data[i][j]; } else { return &Tile::ERROR_TYLE; // This makes SDL_BlitSurface (called later) crash //return new Tile(TileType::ERROR); // This works with not problem (but is memory leak, of course) } } void Map::render(int x, int y, int width, int height) const { //DEBUG("(Rendering...) x: "<<x<<", y: "<<y<<", width: "<<width<<", height: "<<height); int firstI = x / TileType::PIXEL_PER_TILE; int firstJ = y / TileType::PIXEL_PER_TILE; int lastI = (x+width) / TileType::PIXEL_PER_TILE; int lastJ = (y+height) / TileType::PIXEL_PER_TILE; // The previous integer division rounds down when dealing with positive values, but it rounds up // negative values. This is a fix for that (We need those values always rounded down) if (firstI < 0) { firstI--; } if (firstJ < 0) { firstJ--; } const int firstX = x; const int firstY = y; SDL_Rect srcRect; SDL_Rect dstRect; for (int i=firstI; i <= lastI; i++) { for (int j=firstJ; j <= lastJ; j++) { if (i*TileType::PIXEL_PER_TILE < x) { srcRect.x = x % TileType::PIXEL_PER_TILE; srcRect.w = TileType::PIXEL_PER_TILE - (x % TileType::PIXEL_PER_TILE); dstRect.x = i*TileType::PIXEL_PER_TILE + (x % TileType::PIXEL_PER_TILE) - firstX; } else if (i*TileType::PIXEL_PER_TILE >= x + width) { srcRect.x = 0; srcRect.w = x % TileType::PIXEL_PER_TILE; dstRect.x = i*TileType::PIXEL_PER_TILE - firstX; } else { srcRect.x = 0; srcRect.w = TileType::PIXEL_PER_TILE; dstRect.x = i*TileType::PIXEL_PER_TILE - firstX; } if (j*TileType::PIXEL_PER_TILE < y) { srcRect.y = 0; srcRect.h = TileType::PIXEL_PER_TILE - (y % TileType::PIXEL_PER_TILE); dstRect.y = j*TileType::PIXEL_PER_TILE + (y % TileType::PIXEL_PER_TILE) - firstY; } else if (j*TileType::PIXEL_PER_TILE >= y + height) { srcRect.y = y % TileType::PIXEL_PER_TILE; srcRect.h = y % TileType::PIXEL_PER_TILE; dstRect.y = j*TileType::PIXEL_PER_TILE - firstY; } else { srcRect.y = 0; srcRect.h = TileType::PIXEL_PER_TILE; dstRect.y = j*TileType::PIXEL_PER_TILE - firstY; } SDL::YtoSDL(dstRect.y, srcRect.h); SDL_BlitSurface(getTyle(i,j)->getType()->getSurface(), &srcRect, SDL::getScreen(), &dstRect); // <-- Crash HERE /*DEBUG("i = "<<i<<", j = "<<j); DEBUG("srcRect.x = "<<srcRect.x<<", srcRect.y = "<<srcRect.y<<", srcRect.w = "<<srcRect.w<<", srcRect.h = "<<srcRect.h); DEBUG("dstRect.x = "<<dstRect.x<<", dstRect.y = "<<dstRect.y);*/ } } } Tile.h #ifndef TILE_H #define TILE_H #include "TileType.h" class Tile { private: TileType const * type; public: static const Tile ERROR_TYLE; Tile(TileType const * t); ~Tile(); TileType const * getType() const; }; #endif Tile.cpp #include "Tile.h" const Tile Tile::ERROR_TYLE(TileType::ERROR); Tile::Tile(TileType const * t) : type(t) {} Tile::~Tile() {} TileType const * Tile::getType() const { return type; } TileType.h #ifndef TILETYPE_H #define TILETYPE_H #include "SDL.h" #include "DEBUG.h" class TileType { protected: TileType(); ~TileType(); public: static const int PIXEL_PER_TILE = 30; static const TileType * ERROR; static const TileType * AIR; static const TileType * SOLID; virtual SDL_Surface * getSurface() const = 0; virtual bool isSolid(int x, int y) const = 0; }; #endif ErrorTyle.h #ifndef ERRORTILE_H #define ERRORTILE_H #include "TileType.h" class ErrorTile : public TileType { friend class TileType; private: ErrorTile(); mutable SDL_Surface * surface; static const char * FILE_PATH; public: SDL_Surface * getSurface() const; bool isSolid(int x, int y) const ; }; #endif ErrorTyle.cpp (The surface can't be loaded when building the object, because it is a static object and SDL_Init() needs to be called first) #include "ErrorTile.h" const char * ErrorTile::FILE_PATH = ("C:\\error.bmp"); ErrorTile::ErrorTile() : TileType(), surface(NULL) {} SDL_Surface * ErrorTile::getSurface() const { if (surface == NULL) { if (SDL::isOn()) { surface = SDL::loadAndOptimice(ErrorTile::FILE_PATH); if (surface->w != TileType::PIXEL_PER_TILE || surface->h != TileType::PIXEL_PER_TILE) { WARNING("Bad tile surface size"); } } else { ERROR("Trying to load a surface, but SDL is not on"); } } if (surface == NULL) { // This if doesn't get called, so surface != NULL ERROR("WTF? Can't load surface :\\"); } return surface; } bool ErrorTile::isSolid(int x, int y) const { return true; }

    Read the article

  • Why is NULL/0 an illegal memory location for an object?

    - by aioobe
    I understand the purpose of the NULL constant in C/C++, and I understand that it needs to be represented some way internally. My question is: Is there some fundamental reason why the 0-address would be an invalid memory-location for an object in C/C++? Or are we in theory "wasting" one byte of memory due to this reservation?

    Read the article

  • how to return NULL for double function with Intel C compiler?

    - by Derek
    I have some code that I am porting from an SGI system using the MIPS compiler. It has functions that are declared to have double return type. If the function can't find the right double, those functions return "NULL" The intel C compiler does not like this, but I was trying to see if there is a compiler option to enable this "feature" so that I can compile without changing code. I checked the man page, and can't seem to find it. Thanks

    Read the article

  • OPTIONS * HTTP/1.0 APACHE

    - by Abby E
    I been noticing a lot lately in my /server-status the OPTIONS * HTTP/1.0 has been coming up lately a lot. I'm running Ubuntu 12.04 with the latest apache/php/MySQL. I'm not sure what they're for but I would like to see if it would effect performance by some how turning it off. I host some stuff that is accessed a lot that uses PHP/MySQL (600 rps). I'm not sure what it's there for but I do see the local 127.0.0.1 IP, so I assume it's something running local. What is it? How do your turn it off? If turned off how would it effect performance? The list below is a small example of it. (127.0.0.1 REMOVED.(null) hostname has been removed) 211-0 - 0/0/1035 . 24.28 240189 0 0.0 0.00 0.18 127.0.0.1 REMOVED.(null) OPTIONS * HTTP/1.0 212-0 - 0/0/51274 . 677.97 202960 0 0.0 0.00 8.99 127.0.0.1 REMOVED.(null) OPTIONS * HTTP/1.0 213-0 - 0/0/419 . 11.85 240424 0 0.0 0.00 0.07 127.0.0.1 REMOVED.(null) OPTIONS * HTTP/1.0 214-0 - 0/0/240 . 7.96 240552 0 0.0 0.00 0.04 127.0.0.1 REMOVED.(null) OPTIONS * HTTP/1.0 215-0 - 0/0/309 . 9.29 240492 0 0.0 0.00 0.05 127.0.0.1 REMOVED.(null) OPTIONS * HTTP/1.0 216-0 - 0/0/98510 . 1258.25 177391 0 0.0 0.00 17.29 127.0.0.1 REMOVED.(null) OPTIONS * HTTP/1.0 217-0 - 0/0/338 . 10.18 240464 0 0.0 0.00 0.06 127.0.0.1 REMOVED.(null) OPTIONS * HTTP/1.0 218-0 - 0/0/345 . 10.27 240469 0 0.0 0.00 0.06 127.0.0.1 REMOVED.(null) OPTIONS * HTTP/1.0 219-0 - 0/0/118538 . 1507.99 168914 0 0.0 0.00 20.80 127.0.0.1 REMOVED.(null) OPTIONS * HTTP/1.0 220-0 - 0/0/98452 . 1259.10 177412 0 0.0 0.00 17.29 127.0.0.1 REMOVED.(null) OPTIONS * HTTP/1.0 221-0 - 0/0/384 . 10.84 240453 0 0.0 0.00 0.06 127.0.0.1 REMOVED.(null) OPTIONS * HTTP/1.0 222-0 - 0/0/331 . 10.03 240477 0 0.0 0.00 0.06 127.0.0.1 REMOVED.(null) OPTIONS * HTTP/1.0 223-0 - 0/0/314 . 9.04 240493 0 0.0 0.00 0.05 127.0.0.1 REMOVED.(null) OPTIONS * HTTP/1.0 224-0 - 0/0/75193 . 975.24 188845 0 0.0 0.00 13.18 127.0.0.1 REMOVED.(null) OPTIONS * HTTP/1.0 225-0 - 0/0/362 . 10.62 240457 0 0.0 0.00 0.06 127.0.0.1 REMOVED.(null) OPTIONS * HTTP/1.0 226-0 - 0/0/125773 . 1593.26 165647 0 0.0 0.00 22.06 127.0.0.1 REMOVED.(null) OPTIONS * HTTP/1.0 227-0 - 0/0/82541 . 1063.89 185092 0 0.0 0.00 14.48 127.0.0.1 REMOVED.(null) OPTIONS * HTTP/1.0 228-0 - 0/0/409 . 11.50 240436 0 0.0 0.00 0.07 127.0.0.1 REMOVED.(null) OPTIONS * HTTP/1.0 229-0 - 0/0/219 . 7.38 240581 0 0.0 0.00 0.04 127.0.0.1 REMOVED.(null) OPTIONS * HTTP/1.0 230-0 - 0/0/357 . 10.48 240458 0 0.0 0.00 0.06 127.0.0.1 REMOVED.(null) OPTIONS * HTTP/1.0 231-0 - 0/0/469 . 12.39 240411 0 0.0 0.00 0.08 127.0.0.1 REMOVED.(null) OPTIONS * HTTP/1.0 232-0 - 0/0/394 . 11.32 240445 0 0.0 0.00 0.07 127.0.0.1 REMOVED.(null) OPTIONS * HTTP/1.0 233-0 - 0/0/276 . 9.00 240510 0 0.0 0.00 0.05 127.0.0.1 REMOVED.(null) OPTIONS * HTTP/1.0 234-0 - 0/0/245 . 8.51 240536 0 0.0 0.00 0.04 127.0.0.1 REMOVED.(null) OPTIONS * HTTP/1.0 235-0 - 0/0/215 . 7.45 240555 0 0.0 0.00 0.04 127.0.0.1 REMOVED.(null) OPTIONS * HTTP/1.0 236-0 - 0/0/370 . 11.00 240443 0 0.0 0.00 0.06 127.0.0.1 REMOVED.(null) OPTIONS * HTTP/1.0 237-0 - 0/0/400 . 10.96 240446 0 0.0 0.00 0.07 127.0.0.1 REMOVED.(null) OPTIONS * HTTP/1.0 238-0 - 0/0/266 . 8.51 240531 0 0.0 0.00 0.04 127.0.0.1 REMOVED.(null) OPTIONS * HTTP/1.0 239-0 - 0/0/304 . 9.81 240499 0 0.0 0.00 0.05 127.0.0.1 REMOVED.(null) OPTIONS * HTTP/1.0 240-0 - 0/0/446 . 12.47 240421 0 0.0 0.00 0.08 127.0.0.1 REMOVED.(null) OPTIONS * HTTP/1.0 241-0 - 0/0/19741 . 282.90 230130 0 0.0 0.00 3.45 127.0.0.1 REMOVED.(null) OPTIONS * HTTP/1.0 242-0 - 0/0/98503 . 1259.43 177404 0 0.0 0.00 17.28 127.0.0.1 REMOVED.(null) OPTIONS * HTTP/1.0 243-0 - 0/0/251 . 7.93 240551 0 0.0 0.00 0.04 127.0.0.1 REMOVED.(null) OPTIONS * HTTP/1.0 244-0 - 0/0/273 . 8.42 240534 0 0.0 0.00 0.05 127.0.0.1 REMOVED.(null) OPTIONS * HTTP/1.0 245-0 - 0/0/118485 . 1508.14 168950 0 0.0 0.00 20.79 127.0.0.1 REMOVED.(null) OPTIONS * HTTP/1.0 246-0 - 0/0/294 . 9.35 240509 0 0.0 0.00 0.05 127.0.0.1 REMOVED.(null) OPTIONS * HTTP/1.0 247-0 - 0/0/413 . 12.34 240437 0 0.0 0.00 0.07 127.0.0.1 REMOVED.(null) OPTIONS * HTTP/1.0 248-0 - 0/0/258 . 8.55 240529 0 0.0 0.00 0.04 127.0.0.1 REMOVED.(null) OPTIONS * HTTP/1.0 249-0 - 0/0/303 . 9.77 240485 0 0.0 0.00 0.05 127.0.0.1 REMOVED.(null) OPTIONS * HTTP/1.0

    Read the article

  • Problem creating a database with PHP PDO

    - by Leandro Alonso
    Hello guys, I'm having a problem with a SQL query in my PHP Application. When the user access it for the first time, the app executes this query to create all the database: CREATE TABLE `databases` ( `id` bigint(20) NOT NULL auto_increment, `driver` varchar(45) NOT NULL, `server` text NOT NULL, `user` text NOT NULL, `password` text NOT NULL, `database` varchar(200) NOT NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=2 ; -- -------------------------------------------------------- -- -- Table structure for table `modules` -- CREATE TABLE `modules` ( `id` bigint(20) unsigned NOT NULL auto_increment, `title` varchar(100) NOT NULL, `type` varchar(150) NOT NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=29 ; -- -------------------------------------------------------- -- -- Table structure for table `modules_data` -- CREATE TABLE `modules_data` ( `id` bigint(20) NOT NULL auto_increment, `module_id` bigint(20) unsigned NOT NULL, `key` varchar(150) NOT NULL, `value` tinytext, PRIMARY KEY (`id`), KEY `fk_modules_data_modules` (`module_id`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=184 ; -- -------------------------------------------------------- -- -- Table structure for table `modules_position` -- CREATE TABLE `modules_position` ( `user_id` bigint(20) unsigned NOT NULL, `tab_id` bigint(20) unsigned NOT NULL, `module_id` bigint(20) unsigned NOT NULL, `column` smallint(1) default NULL, `line` smallint(1) default NULL, PRIMARY KEY (`user_id`,`tab_id`,`module_id`), KEY `fk_modules_order_users` (`user_id`), KEY `fk_modules_order_tabs` (`tab_id`), KEY `fk_modules_order_modules` (`module_id`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -------------------------------------------------------- -- -- Table structure for table `tabs` -- CREATE TABLE `tabs` ( `id` bigint(20) unsigned NOT NULL auto_increment, `title` varchar(60) NOT NULL, `columns` smallint(1) NOT NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=12 ; -- -------------------------------------------------------- -- -- Table structure for table `tabs_has_modules` -- CREATE TABLE `tabs_has_modules` ( `tab_id` bigint(20) unsigned NOT NULL, `module_id` bigint(20) unsigned NOT NULL, PRIMARY KEY (`tab_id`,`module_id`), KEY `fk_tabs_has_modules_tabs` (`tab_id`), KEY `fk_tabs_has_modules_modules` (`module_id`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -------------------------------------------------------- -- -- Table structure for table `users` -- CREATE TABLE `users` ( `id` bigint(20) unsigned NOT NULL auto_increment, `login` varchar(60) NOT NULL, `password` varchar(64) NOT NULL, `email` varchar(100) NOT NULL, `name` varchar(250) default NULL, `user_level` bigint(20) unsigned NOT NULL, PRIMARY KEY (`id`), KEY `fk_users_user_levels` (`user_level`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=4 ; -- -------------------------------------------------------- -- -- Table structure for table `users_has_tabs` -- CREATE TABLE `users_has_tabs` ( `user_id` bigint(20) unsigned NOT NULL, `tab_id` bigint(20) unsigned NOT NULL, `order` smallint(2) NOT NULL, `columns_width` varchar(255) default NULL, PRIMARY KEY (`user_id`,`tab_id`), KEY `fk_users_has_tabs_users` (`user_id`), KEY `fk_users_has_tabs_tabs` (`tab_id`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -------------------------------------------------------- -- -- Table structure for table `user_levels` -- CREATE TABLE `user_levels` ( `id` bigint(20) unsigned NOT NULL auto_increment, `level` smallint(2) NOT NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=3 ; -- -------------------------------------------------------- -- -- Table structure for table `user_meta` -- CREATE TABLE `user_meta` ( `id` bigint(20) unsigned NOT NULL auto_increment, `user_id` bigint(20) unsigned default NULL, `key` varchar(150) NOT NULL, `value` longtext NOT NULL, PRIMARY KEY (`id`), KEY `fk_user_meta_users` (`user_id`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=4 ; -- -- Constraints for dumped tables -- -- -- Constraints for table `modules_data` -- ALTER TABLE `modules_data` ADD CONSTRAINT `fk_modules_data_modules` FOREIGN KEY (`module_id`) REFERENCES `modules` (`id`) ON DELETE CASCADE ON UPDATE NO ACTION; -- -- Constraints for table `modules_position` -- ALTER TABLE `modules_position` ADD CONSTRAINT `fk_modules_order_modules` FOREIGN KEY (`module_id`) REFERENCES `modules` (`id`) ON DELETE CASCADE ON UPDATE NO ACTION, ADD CONSTRAINT `fk_modules_order_tabs` FOREIGN KEY (`tab_id`) REFERENCES `tabs` (`id`) ON DELETE CASCADE ON UPDATE NO ACTION, ADD CONSTRAINT `fk_modules_order_users` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE ON UPDATE NO ACTION; -- -- Constraints for table `users` -- ALTER TABLE `users` ADD CONSTRAINT `fk_users_user_levels` FOREIGN KEY (`user_level`) REFERENCES `user_levels` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION; -- -- Constraints for table `user_meta` -- ALTER TABLE `user_meta` ADD CONSTRAINT `fk_user_meta_users` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE ON UPDATE NO ACTION; INSERT INTO `user_levels` VALUES(1, 10); INSERT INTO `user_levels` VALUES(2, 1); INSERT INTO `users` VALUES(1, 'admin', 'password', '[email protected]', NULL, 1); INSERT INTO `user_meta` VALUES (NULL, 1, 'last_tab', 1); In some environments i get this error: SQLSTATE[HY000]: General error: 1005 Can't create table 'dms.databases' (errno: 150) I tried everything that I could find on Google but nothing works. The strange part is that if I run this query in PhpMyAdmin he creates my database, without any error.

    Read the article

  • ASP.NET: Why is my JavaScript object set to null?

    - by Giffyguy
    I have a <script> that contains this line: var tbl = document.getElementById("<%= this.tblSelection.ClientID %>"); ... but tbl always ends up being set to null. The table is declared like this: <asp:Table ID="tblSelection" runat="server" CellPadding="2" CellSpacing="0" cols="1" style="position: absolute; top: 0%; right: 0%"> Both the script and the table are in the same master page file. What could be causing this? EDIT: I should mention that this script is executed on onload

    Read the article

  • Can I get a faster output pipe than /dev/null ?

    - by naugtur
    Hi I am running a huge task [automated translation scripted with perl + database etc.] to run for about 2 weeks non-stop. While thinking how to speed it up I saw that the translator outputs everything (all translated sentences, all info on the way) to STDOUT all the time. This makes it work visibly slower when I get the output on the console. I obviously piped the output to /dev/null, but then I thought "could there be something even faster?" It's so much output that it'd really make a difference. And that's the question I'm asking You, because as far as I know there is nothing faster... (But I'm far from being a guru having used linux on a daily basis only last 3 years)

    Read the article

  • C++: Why don't I need to check if references are invalid/null?

    - by jbu
    Hi all, Reading http://www.cprogramming.com/tutorial/references.html, it says: In general, references should always be valid because you must always initialize a reference. This means that barring some bizarre circumstances (see below), you can be certain that using a reference is just like using a plain old non-reference variable. You don't need to check to make sure that a reference isn't pointing to NULL, and you won't get bitten by an uninitialized reference that you forgot to allocate memory for. My question is how do I know that the object's memory hasn't been freed/deleted AFTER you've initialized the reference. What it comes down to is that I can't take this advice on faith and I need a better explanation. Can anyone shed some light? Thanks, jbu

    Read the article

  • Eclipse bug? Switching on a null with only default case

    - by polygenelubricants
    I was experimenting with enum, and I found that the following compiles and runs fine on Eclipse (Build id: 20090920-1017, not sure exact compiler version): public class SwitchingOnAnull { enum X { ,; } public static void main(String[] args) { X x = null; switch(x) { default: System.out.println("Hello world!"); } } } When compiled and run with Eclipse, this prints "Hello world!" and exits normally. With the javac compiler, this throws a NullPointerException as expected. So is there a bug in Eclipse Java compiler?

    Read the article

  • Is apparent NULL pointer dereference in C actually pointer arithmetic?

    - by karthik A
    hey ive got this piece of code. It dereferences a null pointer here. But then there is an and with unsigned int. I really dont understand the whole part. Can someone explain the output.?? struct hi { long a; int b; long c; }; int main() { struct hi ob={3,4,5}; struct hi *ptr=&ob; int num= (unsigned int) & (((struct hi *)0)->b); printf("%d",num); printf("%d",*(int *)((char *)ptr + (unsigned int) & (((struct hi *)0)->b))); } The output I get is 44. But how does it work?

    Read the article

  • deploying security enabled app to WLS - null Password Given Error

    - by raghu.yadav
    if you notice "null password given Error" while accessing the security enabled app deployed in wls, follow below instructions.set the property -Djps.app.credential.overwrite.allowed=true to JAVA_PROPERTIES env within setDomainEnv.sh also ensure you run server in development mode.edit setDomainEnv.sh and set -Dweblogic.ProductionModeEnabled=false and startup the servers, now you access the app and then shutdown server and revert the -Dweblogic.ProductionModeEnabled=false to -Dweblogic.ProductionModeEnabled=true that's it.

    Read the article

  • Using SET NULL and SET DEFAULT with Foreign Key Constraints

    Cascading Updates and Deletes, introduced with SQL Server 2000, were such an important, crucial feature that it is hard to imagine providing referential integrity without them. One of the new features in SQL Server 2005 that hasn't gotten a lot of press from what I've read is the new options for the ON DELETE and ON UPDATE clauses: SET NULL and SET DEFAULT. Let's take a look!

    Read the article

  • Could not connect to any LDAP server as (null) error

    - by wirelessman
    I am using a Windows 2008 Server as my LDAP server and on a Ubuntu 12.04 client I am trying to connect to it. I get the following error: nss_ldap: could not connect to any LDAP server as (null) - Can't contact LDAP server From my Ubuntu client I run the following: ldapsearch -h 10.1.1.251 -D admin -w password -s base dc=ad,dc=xxx,dc=com -p 389 and get the following success message # search result search: 2 result: 0 Success Any help would be greatly appreciated.

    Read the article

  • Extension methods on a null object instance – something you did not know

    - by nmarun
    Extension methods gave developers with a lot of bandwidth to do interesting (read ‘cool’) things. But there are a couple of things that we need to be aware of while using these extension methods. I have a StringUtil class that defines two extension methods: 1: public static class StringUtils 2: { 3: public static string Left( this string arg, int leftCharCount) 4: { 5: if (arg == null ) 6: { 7: throw new ArgumentNullException( "arg" ); 8: } 9: return arg.Substring(0, leftCharCount); 10...(read more)

    Read the article

  • Android - Force Close - Null Pointer on Canvas?

    - by user22241
    Please bear with me. I have a very odd problem. Basically, my app so far, has 3 activities (a main splash screen, an 'options/menu' screen and the main app). If I follow the very specific steps oulined below, I get a 'null pointer exception' in the 2nd activity) and the app force closes...... Here are the steps: Start the app (a game based on Surfaceview), tap through to the third activity so the game is running, then hit the home key so the game is paused and put to the background, the activity/app is ended through DDMS in the SDK then restarted on the device (all OK so far), now if I hit the back key on the device twice in quick succession, it happens. All other sequence of events is fine, even to the point of pressing the back key, waiting for the previous activity to show, then hitting back again - all OK. Only when the back key is pressed twice in quick succession following all the above steps does the problem occur. I'm assuming that the canvas isn't ready as it's showing as 'null' when this happens, but I'm not sure why this is happening as surely it's happening when I'm trying to go back to activity 1, but the logcat shows the error in activity 2. if I stop the activity running my 'doDraw' method (which referenced the canvas), then all is OK - so I can safely assume it is the canvas causing the problem. Also, if I skip my first activity (which is a very basic full-screen button which just displays a splashscreen and waits for the user to tap the screen), and make my 2nd activity the launch activity, again, it is OK. this is the part of the code that I think is probably relevant: @Override public void surfaceChanged(SurfaceHolder arg0, int arg1, int arg2, int arg3) { vheight = this.getHeight(); vwidth = this.getWidth(); } @Override public void surfaceCreated(SurfaceHolder holder) { vheight = this.getHeight(); vwidth = this.getWidth(); this.viewWidth = vwidth; this.viewHeight = vheight; if (runthread==false){ if (preThread.getState()==Thread.State.TERMINATED){ preThread = new OptionsThread(thisholder, thiscontext, thishandler); } preThread.setRunning(true); preThread.start();} } @Override public void surfaceDestroyed(SurfaceHolder holder) { preThread.setRunning(false); //Stop the loop boolean retry = true; //Stop the thread while (retry) { try { preThread.join(); retry = false; } catch (InterruptedException e) { } } Thank you all for any help you can offer

    Read the article

  • SQL WHERE clause not returning rows when field has NULL value

    - by JohnB
    Ok, so I'm aware of this issue: When SET ANSI_NULLS is ON, all comparisons against a null value evaluate to UNKNOWN SQL And NULL Values in where clause SQL Server return Rows that are not equal < to a value and NULL However, I am trying to query a DataTable. I could add to my query: OR col_1 IS NULL OR col_2 IS NULL for every column, but my table has 47 columns, and I'm building dynamic SQL (string concatenation), and it just seems like a pain to do that. Is there another solution? I was to bring back all the rows that have NULL values in the WHERE comparison. UPDATE Example of query that gave me problems: string query = col_1 not in ('Dorothy', 'Blanche') and col_2 not in ('Zborna', 'Devereaux') grid.DataContext = dataTable.Select(query).CopyToDataTable(); (didn't retrieve rows if/when col_1 = null and/or col_2 = null)

    Read the article

  • C++ std::vector problems

    - by Faur Ioan-Aurel
    For 2 days i tried to explain myself some of the things that are happening in my c++ code,and i can't get a good explanation.I must say that i'm more a java programmer.Long time i used quite a bit the C language but i guess Java erased those skills and now i'm hitting a wall trying to port a few classes from java to c++. So let's say that we have this 2 classes: class ForwardNetwork { protected: ForwardLayer* inputLayer; ForwardLayer* outputLayer; vector<ForwardLayer* > layers; public: void ForwardNetwork::getLayers(std::vector< ForwardLayer* >& result ) { for(int i= 0 ;i< layers.size(); i++){ ForwardLayer* lay = dynamic_cast<ForwardLayer*>(this->layers.at(i)); if(lay != NULL) result.push_back(lay); else cout << "Layer at#" << i << " is null" << endl; } } void ForwardNetwork::addLayer ( ForwardLayer* layer ) { if(layer != NULL) cout << "Before push layer is not null" << endl; //setup the forward and back pointer if ( this->outputLayer != NULL ) { layer->setPrevious ( this->outputLayer ); this->outputLayer->setNext ( layer ); } //update the input layer and outputLayer variables if ( this->layers.size() == 0 ) this->inputLayer = this->outputLayer = layer; else this->outputLayer = layer; //push layer in vector this->layers.push_back ( layer ); for(int i = 0; i< layers.size();i++) if(layers[i] != NULL) cout << "Check::Layer[" << i << "] is not null!" << endl; } }; Second class: class Backpropagation : public Train { public: Backpropagation::Backpropagation ( FeedForwardNetwork* network ){ this->network = network; vector<FeedforwardLayer*> vec; network->getLayers(vec); } }; Now if i add from main() some layers into network via addLayer(..) method it's all good.My vector is just as it should.But after i call Backpropagation() constructor with a network object ,when i enter getLayers(), some of my objects from vector have their address set to NULL(they are randomly chosen:for example if i run my app once with 3 layer's into vector ,the first object from vector is null.If i run it second time first 2 objects are null,third time just first object null and so on). Now i can't explain why this is happening.I must say that all the objects that should be in vector they also live inside the network and they are not NULL; This happens everywhere after i done with addLayer() so not just in the getLayers(). I cant get a good grasp to this problem.I thought first that i might modify my vector.But i can't find such thing. Also why if the reference from vector is NULL ,the reference that lives inside ForwardNetwork as a linked list (inputLayer and outputLayer) is not NULL? I must ask for your help.Please ,if you have some advices don't hesitate! PS: as compiler i use g++ part of gcc 4.6.1 under ubuntu 11.10

    Read the article

  • Updating a specific key/value inside of an array field with MongoDB

    - by Jesta
    As a preface, I've been working with MongoDB for about a week now, so this may turn out to be a pretty simple answer. I have data already stored in my collection, we will call this collection content, as it contains articles, news, etc. Each of these articles contains another array called author which has all of the author's information (Address, Phone, Title, etc). The Goal - I am trying to create a query that will update the author's address on every article that the specific author exists in, and only the specified author block (not others that exist within the array). Sort of a "Global Update" to a specific article that affects his/her information on every piece of content that exists. Here is an example of what the content with the author looks like. { "_id" : ObjectId("4c1a5a948ead0e4d09010000"), "authors" : [ { "user_id" : null, "slug" : "joe-somebody", "display_name" : "Joe Somebody", "display_title" : "Contributing Writer", "display_company_name" : null, "email" : null, "phone" : null, "fax" : null, "address" : null, "address2" : null, "city" : null, "state" : null, "zip" : null, "country" : null, "image" : null, "url" : null, "blurb" : null }, { "user_id" : null, "slug" : "jane-somebody", "display_name" : "Jane Somebody", "display_title" : "Editor", "display_company_name" : null, "email" : null, "phone" : null, "fax" : null, "address" : null, "address2" : null, "city" : null, "state" : null, "zip" : null, "country" : null, "image" : null, "url" : null, "blurb" : null }, ], "tags" : [ "tag1", "tag2", "tag3" ], "title" : "Title of the Article" } I can find every article that this author has created by running the following command: db.content.find({authors: {$elemMatch: {slug: 'joe-somebody'}}}); So theoretically I should be able to update the authors record for the slug joe-somebody but not jane-somebody (the 2nd author), I am just unsure exactly how you reach in and update every record for that author. I thought I was on the right track, and here's what I've tried. b.content.update( {authors: {$elemMatch: {slug: 'joe-somebody'} } }, {$set: {address: '1234 Avenue Rd.'} }, false, true ); I just believe there's something I am missing in the $set statement to specify the correct author and point inside of the correct array. Any ideas? **Update** I've also tried this now: b.content.update( {authors: {$elemMatch: {slug: 'joe-somebody'} } }, {$set: {'authors.$.address': '1234 Avenue Rd.'} }, false, true );

    Read the article

  • Why is my program printing out the null termination character?

    - by Tyler Pfaff
    When I run this, it will SOMETIMES print out a null termination character. Most of the time it will, and probably 1/5 times it will print just the characters. void cryptogram::Encrypt(){ cout<<"encrypt"<tempS){ len=tempS.length(); int a=0; for(int j=0;j if(j!=len){ //if the word still has more characters j++; a=0; }else{ //if the word is done being scanned cout<<" "; } } } } } } } So that's it and this is the corresponding EXPECTED output that is printed SOMETIMES xvk bkikhxlr wggbtfkj wiylekgbdhx wjjm hko wigbtubxt xvk iwhj uedjkm glctb gvrmdiwhj iebbdielmeggtbx ctb xvtmk gbtubxvk wjjdxdthgbtubodll khvxvk imkbfdik xt xvk bkudth whj gbtfdjk hko tgxdthm whj tggtbxehdxdkm ctb mxejkhxmibdzdhtltur whj pemxdik mxejdkm mxdh cok wbk wlmt gbkgctb cteb hko zdh cgvrmdikjeiwhj qdhkmdtlturzzkjdydtivkzdmxbrw zdh zdjjlkkjeiwhj w jtixtbdh kjeiwjzdhdmxbittgkbodxv mjme whj eimj This is what normally prints though xvkÈ bkikhxlrÈ wggbtfkjÈ wiylekgbdhxÈ wjjmÈ hkoÈ wigbtubxtÈ xvkÈ iwhjÈ uedjkmÈ glctbÈ gvrmdiwhjÈ iebbdielmeggtbxÈ ctbÈ xvtmkÈ gbtubxvkÈ wjjdxdthgbtubodllÈ khvxvkÈ imkbfdikÈ xtÈ xvkÈ bkudthÈ whjÈ gbtfdjkÈ hkoÈ tgxdthmÈ whjÈ tggtbxehdxdkmÈ ctbÈ mxejkhxmibdzdhtlturÈ whjÈ pemxdikÈ mxejdkmÈ mxdhÈ cokÈ wbkÈ wlmtÈ gbkgctbÈ ctebÈ hkoÈ zdhÈ cgvrmdikjeiwhjÈ qdhkmdtlturzzkjdydtivkzdmxbrwÈ zdhÈ zdjjlkkjeiwhjÈ wÈ jtixtbdhÈ kjeiwjzdhdmxbittgkbodxvÈ mjmeÈ whjÈ eimj or some variation of an odd character at the end of each word This is what the cryptogram array is filled with by the way wyijkcuvdpqlzhtgabmxefonrs

    Read the article

  • Is there a practical benefit to casting a NULL pointer to an object and calling one of its member fu

    - by zdawg
    Ok, so I know that technically this is undefined behavior, but nonetheless, I've seen this more than once in production code. And please correct me if I'm wrong, but I've also heard that some people use this "feature" as a somewhat legitimate substitute of a lacking aspect of the current C++ standard, namely, the inability to obtain the address (well, offset really) of a member function. For example, this is out of a popular implementation of a PCRE (Perl-compatible Regular Expression) library: #ifndef offsetof #define offsetof(p_type,field) ((size_t)&(((p_type *)0)->field)) #endif One can debate whether the exploitation of such a language subtlety in a case like this is valid or not, or even necessary, but I've also seen it used like this: struct Result { void stat() { if(this) // do something... else // do something else... } }; // ...somewhere else in the code... ((Result*)0)->stat(); This works just fine! It avoids a null pointer dereference by testing for the existence of this, and it does not try to access class members in the else block. So long as these guards are in place, it's legitimate code, right? So the question remains: Is there a practical use case, where one would benefit from using such a construct? I'm especially concerned about the second case, since the first case is more of a workaround for a language limitation. Or is it? PS. Sorry about the C-style casts, unfortunately people still prefer to type less if they can.

    Read the article

< Previous Page | 9 10 11 12 13 14 15 16 17 18 19 20  | Next Page >