Archive for the 'PHP' Category
Inconsistencies Between PHP On Windows (Show Me The Money_Format)
Yesterday I finished up a project I was working on that I wrote in PHP. I created it on a Linux machine and I needed to test it on Windows. On the Windows system I tested it using the latest version of WAMP. I had it all setup ready to go when I got a nasty error message Fatal error: Call to undefined function money_format(). I thought it was rather strange but I figured that I didn’t have the correct PHP extension enabled. After looking for such a extension, I started to think about it more and realized that it wasn’t apart of an extension. I took a look at the manual for money_format and found that the function doesn’t exist on Windows.
Note: The function money_format() is only defined if the system has strfmon capabilities. For example, Windows does not, so money_format() is undefined in Windows.
2 comments
PHP comparison GOTCHAS
Last week while I was programming with PHP I ran into a few bumps. I thought I understood the comparison operators in PHP and what NULL was in the language. I was sadly mistaken and it caused me a headache, which led me to write a bunch of truth tests. Yes I know…classic noob mistake. In PHP according to the manual a variable is considered to be null if, it has been assigned the constant NULL, it has not been set to any value yet, or it has been unset(). You would think that an variable with an empty string ( $var = ''; ) would be null but it is not (unless this is a bug, which I’m sure it is not). This was the cause of all the problems I was having.
No comments
Warbook Alliance Manager
Warbook is a Facebook Application focused on war. There are several different character classes to choose from when playing. Jordan (the other person that write on this site from time to time) was a mogul and he is the one who invited me to play. I must say at first glance the game wasn’t fun at very low levels. You would get chain attacked a lot and there wasn’t much you could do. Lucky for me it was easy to get money and move up. I focused on defense at first but read that it was pointless at higher levels to defend your self. BLAH BLAH BLAH LONG boring story.
3 comments
XKCD Embedding NP-Complete Problems In Restaurant Orders
There is very popular web comic called XKCD. The site seems to have been around since January of 2006 and I’m sure that anyone that reads Digg or Reddit will be familiar with them. I visit there from time to time and even have a couple of their comics taped to my desk at work.
A few weeks ago Jordan brought up one in particular because of a job listing for a “consulting and software development firm”. The comic is a bit old and is from earlier this year in July. In the job listing they had a programming exercise referring to that comic and wanted it to work on multiple data sets read from a file. The problem in the comic is np-complete. If you aren’t familiar with that term than you might want to read up. Quoting the article on nist.gov below.
Note: A trivial example of NP, but (presumably) not NP-complete is finding the bitwise AND of two strings of N boolean bits. The problem is NP, since one can quickly (in time ?(N)) verify that the answer is correct, but knowing how to AND two bit strings doesn’t help one quickly find, say, a Hamiltonian cycle or tour of a graph. So bitwise AND is not NP-complete (as far as we know).
No comments