smert.net

Polluting the Internet one post at a time…

Archive for the 'Programming' 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.

Read more

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.

Read more

No comments

RedOctane X-plorer on Ubuntu 7.10 (Gutsy)

In my current state of addiction I’ve been rocking out with my plastic guitar with the 5 brightly colored buttons. Guitar Hero 3 has been causing me to procrastinate a lot more over the last month than usual. It wasn’t until about a week ago that I found out about Frets on Fire. It is a guitar hero like game that you play using your keyboard (created in Python). You can create your own songs to play and even import the songs from the first three Guitar Hero games. After playing it for a while I wanted to use my GH3 guitar but I wasn’t sure if I could even do that. It turns out that yes, you can use the guitar under Linux and even Windows.

Read more

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.

Read more

3 comments

Ubuntu 7.10 (Gutsy Gibbon) Ubiquity Migration Assistant Errors

Recently I’ve bought another PC which I’ve started using in place of my laptop while I am at home. I’ve decided to switch my laptop back to a machine for testing. I like trying other Linux distributions and I don’t care for testing them out using virtualization. Once I get a feel for it on a actual machine it is a lot easier to test and revert to a previous state using VMware Server or VirtualBox. Since I’m using it for testing again I decided to put several distributions back on it. At one time many months ago I had installed Windows XP (with Microsoft Shared Computer Toolkit which is now called Windows SteadyState), Windows Vista, FreeBSD, CentOS, Fedora, Mandriva, OpenSuSE, Slackware and Ubuntu. That didn’t last long because I was actually using that computer and I didn’t want to make major changes to it when newer versions of the distributions came out.

Read more

No 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).

Read more

No comments

MASSIVE Fluff Friends List For Facebook

There are quite a few applications on Facebook one of the more popular ones is (fluff)Friends. Mike Sego is the creator and I guess he works at Google (must be nice). Fluff Friends has about 340,000 daily active users. So what is the purpose of this game? It is kind of like a virtual pet that you feed, pet and race. You can buy it different foods and backgrounds. The various foods increase the speed of your Fluff. I have a cowe (not a cow but a cowe, it is the same animal, I want to make a baseball glove out of mine) that is saying not very cleverly “I’M RICH BITCH!”. Well because in Fluff terms I’m pretty damn rich (57480 Munny). I wanted to get even more than before mentioning the fact that I had a ton of money but I’ve lost interest mainly to Warbook. It is also very pointless since all I care about is MUNNY. I liek Munny…you like Munny too? No way. We should totally hang out. Ok moving on…

Read more

10 comments

Choosing a Programming Language

For many small Windows programs I use AutoIT (I’m not much of a programmer) and in Linux I do a lot of Bash scripting (comparatively). In middle school I took a computer course where I learned some Basic programming. I really started learning programming on my TI-83 using kinda a form of Basic. I was interested in games and how they worked so I tediously copied the entire source from them onto paper to learn from it. Eventually I wrote a game for it (hah it still exists) and I was planning to port it to Z80 Assembly (since it was sloooooow, and it would run out of memory). When I started learning Z80 assembly for processor and coding it by hand since I didn’t have a PC. At one time I started to learn some assembly for the x86 because I was interested in making an OS and understanding how it works. I’ve used Perl over the years a few times to do more complicated things that I couldn’t do in Bash. I’ve wrote a packet sniffer for Diablo 2 in C++ and a few tiny Visual Basic applications (for generating large IP address lists) many years ago. I’ve created some rather large projects in mIRC scripting (AIM client). I feel that I’ve started to reach the limits of AutoIT when I have to rely on DLL calls and other executables to get the job done. I’d rather learn an actual programming language than continue to work with AutoIT. AutoIT still has a place for me when I need to make tiny program, automate a task or create a installer.

Read more

No comments

Unattended Installations In Windows With AutoIT

Last summer I started working on a project for unattended installations written in AutoIT. AutoIT is a very simple scripting language that was originally written to automate installing programs. It has been expanded to be able to do more than just simple automation. It also has its own IDE which uses SciTE. Features include syntax highlighting, code completion and a very nice help with examples for each function. I have even written a very lightweight FTP client, (not full featured) to replace using Microsoft’s FTP client and Expect for work.

Read more

No comments

Firefox 2