binding a data from database to dropdownlist based on selected item of another dropdown list
I blogged about doing this with PHP / MySQL / jQuery at http://dougv.us/64 , http://dougv.us/4s and http://dougv.us/4r . If you’re looking for an ASP.NET Web Forms version, I’ll add this to my "to blog" list. Can’t say as to when I’ll get around to it, but probably not immediately, sorry.
zip codes within 1,000 mile radius of 19142
You should be able to scale my PHP / MySQL solution ( http://dougv.us/5s ) up to do this without incident. Not that it’s necessary; pretty much every US city east of the Mississippi River is within 1,000 miles of Philadelphia. If you’d like to pay me to do this for you, I’ll be happy to do so; see http://dougv.us/f0 for details.
News Of The World Wasn’t ‘Hacking’ Voicemail, It Was Blagging
This is nitpicky, and I certainly don’t mean to take lightly the seriousness of the matter. But I do want to clarify that the News of the World wasn’t technically “hacking” voicemail in its scandal. It was engaged in social engineering.
For those of you who missed the headlines (and for the benefit of posterity): News of the World was (until July 10, 2011) a Sunday tabloid; like most British tabs, it’s best known for printing racy pictures of women and sleazy stories.
News of the World hired a private investigator to help it research stories. That contractor gained access to a number of voicemail accounts, including those of a murdered 13-year-old girl, several soldiers killed in the Middle East conflicts, and royal family members.
All the shoes involved here haven’t yet dropped, but as of this writing the scandal has closed the paper after 168 years of publication; threatens to bring down Prime Minister David Cameron; has led to several arrests and may well result in additional restrictions on Great Britain’s press. (Even overwhelmingly reasonable pundits, such as The Economist, are calling for a mucking out of British journalism’s stables.)
The entire affair is loathsome, no question about that, even for the British press, nefarious for its “chew people up and spit them out” appetite. It’s also caused other world press outlets to term what News of the World did “phone hacking,” needlessly worrying people who have taken reasonable steps to secure their voicemail that they, too, might be targeted.
So I want to clear things up. If you’ve changed your voicemail password (PIN), you almost certainly can’t be violated in the way News of the World violated its victims.
Continue reading: News Of The World Wasn’t ‘Hacking’ Voicemail, It Was Blagging »
Getting Pseudo Random Records From A MySQL Database Table
Here’s a common programming problem: You have some records in a MySQL table. You want to randomly select a record, or just a few records, from that database; maybe, you want to pass some additional, specific criteria to narrow the candidate records somewhat.
For example, maybe you run a music Web site. You have a database table full of albums, and you want to randomly pick one as “album of the moment.” Perhaps you want to select from a category — rock, country, jazz, etc. Or maybe you want to get an assortment of albums from a specific artist, and display many records on a Web page.
Getting such “random” database records is easily done in MySQL (versions 3.23 and up) via a fairly standard SELECT statement, using ORDER BY, RAND and LIMIT.
(For the purpose of this tutorial, I’ll use the ZIP Code database I got for Getting All ZIP Codes In A Given Radius From A Known Point / ZIP Code Via PHP And MySQL, which I wrote some time ago.)
First, let’s simply select any old record from the table; that is, every record in the table is equally eligible for selection.
SELECT * FROM table_name ORDER BY RAND() LIMIT 1;
What this does is tell MySQL, “Toss all the records together in a pile [ORDER BY RAND()], then give me just one record from that pile [LIMIT 1].”
You can see this in action here: http://www.dougv.com/demo/mysql_random_records/index.php
Continue reading: Getting Pseudo Random Records From A MySQL Database Table »


