|
Aleksei Vasiliev posted:Oracle PL/SQL: What's the rationale for this behavior?
|
# ? Apr 14, 2012 02:51 |
|
|
# ? Apr 29, 2024 06:06 |
|
The empty string is stored as null, and null doesn't compare equal to anything. edit: Further Googling suggests its even worse than that, because str1 <> str2 won't be true if one is null and the other isn't. pseudorandom name fucked around with this message at 02:56 on Apr 14, 2012 |
# ? Apr 14, 2012 02:54 |
|
Mogomra posted:I'm actually really interested to hear what the issues with Node.js are.
|
# ? Apr 14, 2012 03:55 |
|
Gazpacho posted:The issues maybe aren't so much with node.js, but with its promoters' tendency to ignore the long history of the events vs. threads question, and say things like "node.js never blocks" because they don't realize that the thing node.js does actually is blocking. That paper is from 1978, and talks about OS design in terms of process and forking. It also says that the two have equivalent performance: "in general, we have observed that a message-oriented operating system kernel implemented by a dedicated team on a friendly machine architecture can be made very efficient relative to the basic cycle time of that machine." And of course, what they mean by "doesn't block" is that node.js is based around asynchronous stuff, like callbacks. I recently wrote a Deferred implementation in Mozilla JavaScript (it uses gjs and GNOME libraries for various helper things, not complete, doesn't send errbacks, etc.) to show off how asynchronous code may look in ES.next. I'll have to finish my Deferred blog post one of these days.
|
# ? Apr 14, 2012 04:56 |
|
pseudorandom name posted:edit: Further Googling suggests its even worse than that, because str1 <> str2 won't be true if one is null and the other isn't. No, that's how it's supposed to work. In SQL, a NULL value represents missing or unknown data, so it isn't equal to a null string (which is known data that just happens to not have any characters in it). It's sort of like how in C a null string is a non-null pointer to a zero-terminated array of characters that doesn't have anything before the terminator, and a null pointer doesn't point to anything at all. This is why the code snippet is broken: Oracle turned a string literal into a null value when it should not have.
|
# ? Apr 14, 2012 11:20 |
|
At a node.js talk I attended I asked 'How does error handling work' and 'Multicore'.
|
# ? Apr 14, 2012 13:38 |
|
tef posted:At a node.js talk I attended I asked 'How does error handling work' and 'Multicore'. 20,000,000 "error" event handlers and the "cluster" module
|
# ? Apr 14, 2012 15:18 |
|
Aleksei Vasiliev posted:Oracle PL/SQL: This is because an empty string is the same as null in Oracle and = always returns false if one of its operands is null. Even if both are null. If that was x is '' it would work iirc. Coding horrors: I've written a web app framework in plsql. edit: beaten to death
|
# ? Apr 15, 2012 05:17 |
|
SavageMessiah posted:This is because an empty string is the same as null in Oracle and = always returns false if one of its operands is null. Even if both are null. If that was x is '' it would work iirc. I think SQL Server is the same way. '= NULL' and 'IS NULL' behave differently.
|
# ? Apr 15, 2012 05:19 |
|
ijustam posted:I think SQL Server is the same way. '= NULL' and 'IS NULL' behave differently. They do, (NULL = NULL) is FALSE while (NULL IS NULL) is TRUE. But at least an empty string is not null: code:
|
# ? Apr 15, 2012 12:16 |
|
mobby_6kl posted:They do, (NULL = NULL) is FALSE while (NULL IS NULL) is TRUE. Also depends on the ANSI NULLS setting
|
# ? Apr 15, 2012 13:32 |
|
I think the fact that the empty string is treated as NULL is a horror in itself. MySQL had a good explanation for what NULL means and its example used a field for a phone number: "NULL means you don't know the phone number, while an empty string means that you know there is no phone number". Treating an empty string like NULL seems like a bad idea.
|
# ? Apr 16, 2012 08:15 |
|
Zamujasa posted:I think the fact that the empty string is treated as NULL is a horror in itself. MySQL had a good explanation for what NULL means and its example used a field for a phone number: "NULL means you don't know the phone number, while an empty string means that you know there is no phone number". Urgh, the empty string in your phone number field means you need better constraints. NULL means you forgot both to normalise and that some people have multiple phone numbers.
|
# ? Apr 16, 2012 18:16 |
|
Not sure exactly what is going on here...code:
|
# ? Apr 17, 2012 14:14 |
|
How else are you going to debug auto-increment?
|
# ? Apr 17, 2012 14:55 |
|
Looks more like a magic "starting point" fallback constant. As in, if there are apparently no request_ids above 200000, create one. On the looks of that alone, it is something that's introduced at some point where somebody thought: "Hey! Request ids must start at 200000!". There might be an actual reason for it, there might also not be one. We'll never know. The greatest horror in it is the lack of documentation and the use of a magic constant.
|
# ? Apr 17, 2012 15:12 |
|
There's also the bit where he's calling row() without checking num_results() first. CodeIgniter will actually throw a proper exception if you try to access a row in an empty cursor. But I wouldn't expect a PHP programmer to know what an exception is.
|
# ? Apr 17, 2012 16:16 |
|
"I'll have to create some crafty encryption [...] might be more secure than SSL!" No boss please don't do this. php:<? if ($num_rows > 0){ $row = mysql_fetch_assoc($result); $csvarray = explode(",",$row['csv']); foreach($csvarray as $k) { if ($k = $idtofind) { $goodtogo = 1; } } mysql_free_result($result); if (isset($idtofind)) { if ($goodtogo=1) { ?>
|
# ? Apr 17, 2012 19:32 |
|
Please tell me those are assignments in the conditionals, and that PHP's assignment operator doesn't turn into an equality operator.
|
# ? Apr 17, 2012 20:49 |
|
Haha no they are definitely assignment operators. PHP isn't THAT awful.
|
# ? Apr 17, 2012 20:52 |
About MineCraft:Captain Capacitor posted:Gladly. I know one of my favorite facts so far is the cubic lighting calculations (every block has to consider its neighbours and neighbours of neighbours). I'm trying to teach myself computation - can someone please explain to me a better way to do this? Is this an area where a dynamic programming algorithm would greatly reduce the amount of computation necessary?
|
|
# ? Apr 17, 2012 21:04 |
|
IAMKOREA posted:I'm trying to teach myself computation - can someone please explain to me a better way to do this? Is this an area where a dynamic programming algorithm would greatly reduce the amount of computation necessary? Global Illumination Radiosity can be done on a discrete scale, like Minecraft, in a direct manner.
|
# ? Apr 17, 2012 21:51 |
|
Suspicious Dish posted:Global Illumination Radiosity can be done on a discrete scale, like Minecraft, in a direct manner. I don't have a better answer though, other than to say that Minecraft has a ton of small surfaces that each get lit individually (each block), and that the player can change at their leisure. A lot of things can be pre-computed when you don't have a dynamic world like in Minecraft, and working with larger surfaces means you can cut down on the work as well. I don't disagree that Minecrafts lighting is awful though, I threw a hack on my netbook with lighting entirely cut out and it ran flawlessly vs. the <1fps I get with lighting enabled.
|
# ? Apr 18, 2012 16:40 |
|
The real question is why a game where everything is a giant ugly block would need radiosity.
|
# ? Apr 18, 2012 17:56 |
|
The Gripper posted:Wouldn't this be exceptionally slow, even compared to the current system? I can't imagine any implementation of GIR in Minecraft would result in playable framerates even on the best hardware. With a small number (<100) of light sources, it should be much faster than the current system. Keep in mind that this is global illumination radiocity, and that you're doing light accumulation on a block level, not on a pixel level. evensevenone posted:The real question is why a game where everything is a giant ugly block would need radiosity. Because it's a good method for doing lighting calculations.
|
# ? Apr 18, 2012 18:09 |
|
Suspicious Dish posted:With a small number (<100) of light sources, it should be much faster than the current system. Keep in mind that this is global illumination radiocity, and that you're doing light accumulation on a block level, not on a pixel level.
|
# ? Apr 18, 2012 18:23 |
Suspicious Dish posted:With a small number (<100) of light sources, it should be much faster than the current system. Keep in mind that this is global illumination radiocity, and that you're doing light accumulation on a block level, not on a pixel level. Not only that, you only need to recalculate lighting when something changes, and you can probably take a shortcut and only recalculate e.g. 15 blocks in each direction from the changed block.
|
|
# ? Apr 18, 2012 18:25 |
|
nielsm posted:Not only that, you only need to recalculate lighting when something changes, and you can probably take a shortcut and only recalculate e.g. 15 blocks in each direction from the changed block. One of the more annoying things about the system is that the lighting needs to consider blocks that aren't even visible (out of range), otherwise entering an area with a roof high enough to be out of your view distance would be bright, until you moved your way closer to that roof. I think in multiplayer the blocks are sent with the lighting value attached, so that it actually works at all. The Gripper fucked around with this message at 18:34 on Apr 18, 2012 |
# ? Apr 18, 2012 18:31 |
|
Minecraft stores sky lighting and height map data independent of the block lighting.
|
# ? Apr 18, 2012 18:49 |
|
nielsm posted:Not only that, you only need to recalculate lighting when something changes, and you can probably take a shortcut and only recalculate e.g. 15 blocks in each direction from the changed block. That's basically what Minecraft does.
|
# ? Apr 18, 2012 21:05 |
|
We're migrating to MSSQL 2008 (from 2000 ). Finally we can switch to PHP PDO with an official SQL Driver for Linux. Oh wait, what's that? It only works on 64bit RHEL? drat. At least we can use DBLIB now, right? Oh, nevermind both are ridiculously broken on PHP 5.2.4 (we're on Ubuntu 08.04 LTS) and doesn't support PDOStatement::nextRowSet(). I guess I'll update the test server to 10.04 and then to 12.04 Final Beta to get PHP 5.4. We'll be installing new servers in a few weeks anyways. What's that? Ubuntu 12.04 isn't going to ship with PHP 5.4? Surely 5.3.10 is good enough. DBLIB was patched a few months ago. Nope! nextRowset() is only available in 5.4. Awesome. But wait, there's a PPA with 5.4 on it? DBLIB works! Hurray! ... what are all these cursor errors? Oh I see, MARS isn't enabled on the connection string that's an easy fix! You know, if MARS was supported by the DBLIB driver. Scratch that idea. Oh well, back to ODBTP. *ODBTP fails to build on 5.4* I'm now in the process of building a brand new server install with Ubuntu 64bit. Finally got to the point that apache is serving our primary website with a hacked together SQL Native Client driver from RHEL. Now I just have to get tomcat working again. PHP: Always a horror.
|
# ? Apr 19, 2012 07:10 |
|
Today I stumbled across a simple set of words that describe a real thing that ought cause any coder with a sense of his industry to imediately break out into a rash. "LegacyJ : Enterprise JavaBeans and XML with COBOL" Just saying it is like committing a hate-crime against IT workers. I'm pretty sure if my boss pulled up and said "Hey we got a job writing J2EE stuff with heaps of XML configuration using COBOL on a Java stack!" I'd probably start lighting fires.
|
# ? Apr 19, 2012 08:52 |
|
duck monster posted:Today I stumbled across a simple set of words that describe a real thing that ought cause any coder with a sense of his industry to imediately break out into a rash.
|
# ? Apr 19, 2012 09:04 |
|
Why'd I have to read that right before bed?
|
# ? Apr 19, 2012 09:23 |
|
The Gripper posted:Reminds me of this: It's not as funny as it could be, because Erlang is actually pretty awesome.
|
# ? Apr 19, 2012 09:38 |
|
duck monster posted:Today I stumbled across a simple set of words that describe a real thing that ought cause any coder with a sense of his industry to imediately break out into a rash.
|
# ? Apr 19, 2012 10:08 |
|
There's a difference between thinking something is dead and wishing to see its mutilated corpse being feasted upon by pigs.
|
# ? Apr 19, 2012 10:18 |
|
duck monster posted:Today I stumbled across a simple set of words that describe a real thing that ought cause any coder with a sense of his industry to imediately break out into a rash. This springs to mind for some reason. http://publib.boulder.ibm.com/infocenter/wsdatap/v3r8m1/index.jsp?topic=%2Fxs40%2Fconvertingbetweenjsonandjsonx06.htm
|
# ? Apr 19, 2012 14:38 |
|
The Gripper posted:Reminds me of this:
|
# ? Apr 19, 2012 18:22 |
|
|
# ? Apr 29, 2024 06:06 |
|
php:<? // END CODE FROM testcreateinfo.php }}}}}} }// goodtogo = 1, infoid passed is available to the passed username/password }// end of check to see if info id is passed } // end of valid user/pass test and info return } // end of is api command 'doeverything' mysql_close($con); } // End of is api functions?> (The lack of formatting here isn't some error, there are about 4 copies of this file and this is how they are: left justified. boss doesn't believe in indentation because he does coding on a 1024x768 TV and indents are just wasted space. ) Edit: Oh, the snip from the last post is from this file, too, but run through a code reformatter. (Rest assured, it was left-justified too.) Zamujasa fucked around with this message at 18:39 on Apr 19, 2012 |
# ? Apr 19, 2012 18:36 |