Archive for September, 2007
MySQL Update on Duplicate entries for Inserts
Particletree has a great article on a MySQL query that updates a record in a database when trying to insert data that has a record with a duplicate key. Check out the code below.
Old Way
-
$sql = 'SELECT TransId FROM Sales WHERE TransId = 123';
-
$rs = $db->query($sql);
-
// do an SQL UPDATE
-
}
-
else {
-
// do an SQL INSERT
-
}
New Way
-
INSERT INTO Sales(TransId, STATUS, Amount)
-
VALUES(123, 'Pending', 20)
-
ON DUPLICATE KEY UPDATE STATUS = 'Paid'
Also keep in mind that a current bug in MySQL makes this method not replication safe. I believe this has been fixed.
EchoPic - Image Hosting
I did the design and code for EchoPic in about 4 hours. I did it just for fun and so far in less than 24 hours its received over 2400 hits. I love the web. For now its a pet side project and I will add features to it as they are requested or as I see a need for them.
URL: EchoPic.com
7 reasons I switched back to PHP after 2 years on Rails
Derek Sivers, the founder, president, and sole programmer behind CD Baby, wrote a great article about why he switched back to PHP from Rails. I have nothing against Ruby or Rails, but I never found the reason why everyone was so hyped about it. Check out the article below.
“Is there anything Rails can do, that PHP CAN’T do?”
The answer is no.
I threw away 2 years of Rails code, and opened a new empty Subversion respository.
Article:
7 reasons I switched back to PHP after 2 years on Rails
iPhone Gets Huge Price Drop
At Apple's "The beat goes on" special event, Steve announced a couple of cool new products, but in my opinion the biggest news of the event was the price drop for the iPhone. Now the 8GB iPhone is only $399, down from $599! That is a $200 price drop in 2 months! Amazing.

Apple also introduced new iPod Nanos and a new iPod Touch which is basically an iPhone minus the phone capabilities. iTunes is now available on the iPod Touch and iPhone so you can purchase music directly to the devices and sync it to your desktop or laptop once the unit is docked.
I'm so glad I waited to get my iPhone because now I will save 200 bucks...booya.
Web App Lessons: Provide a Delete Account Option
I consider myself an early adopter when it comes to new web applications or online technologies. Once a new site of interest is launched I am usually quick to sign up and try it out. The majority of the time I'll lose interest in the site and I'll delete my account so I don't have unused account information lingering around the net.
Enter the problem
When it comes time that I want to delete my account because of some reason that I don't like the site or no longer find a use for it, it requires you to email them to delete your account. This is annoying. Is it really that hard to email the site? No, but its still annoying.
Why its bad for the user
Frankly I don't trust emailing some unknown person who is supposedly "handling" all incoming email to delete my account when I request it. Has it worked for me before? Yes. Has it not worked for me before? Yes. Sometimes I never hear back from the site that they deleted my account and I can still login to my account and all my information is still there. When the functionality to delete your account from the site's settings or account page it gives the user immediate gratification for their request. Even though your still losing the user, you made the ending experience for them easier and in their mind better. End it on a good note.
Why its good for the website
It requires more work for a website's operator to read and process all requests for account removal. Work = Time = Money = Less time fragging people in Halo half-way across the world and that’s just not right. Just take the few more hours of programming to provide a delete option for users to remove their accounts. It will be worth it.



My name is Noah Everett. I live in Tulsa, OK. I started 