Archive for April, 2008

Sorting a query in MySQL ignoring the word “The”

When you have a database of books or movies, some of the titles begin with “The.” If you do a regular ORDER BY on the table, all the titles that start with “the” get clumped together. One option is running an unsorted query and sorting in PHP, but it would be better to sort at the database level. Here is a query I came up with to do that, using an IF function in MySQL!

SELECT * FROM movies
ORDER BY IF(SUBSTRING(title,1,4)="The ",SUBSTRING(title,5),name)

Now create a custom function for that, and it’s even easier to use!

CREATE FUNCTION SORTNAME (name VARCHAR(255)) RETURNS VARCHAR(255)
	RETURN IF( (LCASE(SUBSTRING(name,1,4)) = 'the '), SUBSTRING(name,5), name );

Now you can use it in a query like this:

SELECT * FROM movies
ORDER BY SORTNAME(title)

, , ,

No Comments

Phone as a Wifi access point!

This is pretty much the coolest thing in the world! I am posting from my laptop which is connected to my cell phone’s wifi connection, using Sprint’s EVDO connection to the internet. The software that enables me to do this is called wmwifirouter. Earlier this month they released their first final version of the software, and started charging for it. It’s not outrageously priced, but you can still find the earlier free versions on the internet if you search for versions 0.90 or 0.89.

Sprint’s EVDO connection is actually pretty speedy. Of course it’s not like having a cable connection, but it’s definitely faster than dialup. I downloaded a 2mb file at a solid 85kb/s. Also see below for a traceroute to this server.

Continue reading “Phone as a Wifi access point!”

, , , ,

No Comments

Syncing Windows Mobile with OS X and Google Calendar

Sprint MogulImage by nino63004 via Flickr

Well I did it! I got the HTC Mogul on Sprint’s SERO plan. Everything has been pretty painless so far. Activation was easy, text messaging works, and Internet browsing is pretty fast! Now comes the hard part: getting my data to sync between Windows Mobile and OS X.

There is an excellent program out there that is made exactly for this: Missing Sync. While not free, I do think it’s a good deal, so I went ahead and bought it. Everything transferred over flawlessly, and it’s pretty neat being able to see my call and SMS log on my computer.

However, my syncing ship has only begun to sail. I use Google Calendar as my primary calendar for everything. It has been a huge help in keeping things organized, since I can open it from any computer. My friends and I also subscribe to each others’ calendars so that we can better schedule things together. It can send text message reminders of events, which was a huge help for when I was out and about with no access to a computer. I moved to Google Calendar from iCal a while ago for these reasons.

Missing Sync can sync the Mogul’s calendar with iCal, but not with Google Calendar. I tried subscribing iCal to Google Calendar’s public url, but Missing Sync didn’t like that because it was a read-only calendar. I decided going the other way, publishing iCal to a URL, then subscribing Google Calendar to that, was a better option. I enabled WebDAV on a virtual host on my server.

DAVLockDB /www/sub.mydomain.com/dav/davlockdb
DAVMinTimeout 600
DAV On
<location /ical>
    Options None
    SSLRequireSSL
    SSLOptions +StdEnvVars
    AuthType Basic
    AuthName "Calendar Access"
    AuthUserFile "/www/sub.mydomain.com/ssl/.htpasswd"
    <limitexcept GET HEAD OPTIONS>
        require user aaron
    </limitexcept>
</location>

Publishing iCal to a WebDAV server is super easy, just choose “Publish on a Private Server” and enter the URL you have created.

Note: You don’t need to run your own WebDAV server to do this, you can use box.net to publish your iCal!

The one downside to this is that it isn’t possible to add events using Google Calendar. But I figure I’ll have my Mogul on my all the time anyway, and I can just add through there. Publishing my calendar to Google Calendar lets my friends still see my schedule.

, ,

No Comments

Cell phones hurt my brain

But not in the radiation kind of way… in the omg-too-many-things-to-think-about kind of way.

I’m in the market for a new cell phone and provider. I’ve been on a Verizon family plan for the last 5 years, always with the free phone that comes with the plan. I’m switching to my own plan when the family contract is up. I’ve been pretty happy with the quality of calls on Verizon, and coverage seems to be great wherever I need it. But I’m definitely open to switching to another provider.

One of the hardest parts is figuring out how to start looking for a phone and plan. I think I’m going about this the wrong way. I have vague idea of what I want in a phone, but mostly I’ve just been reading lots and looking at lots of different options.

I’ve been hearing a lot of talk about Sprint’s SERO plan. For $50/month I can get 1250 minutes, and unlimited text and data. That’s hard to pass up. On the other hand, there are some features I want that none of the SERO phones seem to have.

It’s time to take a different approach to this, since I seem to continuously waste hours on end reading about phones. I’m going to use the MoSCoW Method to figuring out what cell phone I should get! The MoSCoW Method is used in software development to help prioritize features the client wants.

Must Without this, the project is a failure
Should Should have this if at all possible
Could Could have this if it does not delay Shoulds or Musts
Won’t Won’t have this in this version, but Would like in the future

While this method was not exactly intended for this, I am going to prioritize my wishlist of cell phone (and service plan) features into these categories. However, the “W” doesn’t really seem to apply here, so I’ll leave out that category.

Must

Should

Could

  • > 1000 Minutes
  • Text messaging
  • Must NOT have ONLY a touchscreen
  • Integration with Google Calendar, or at least iCal, either in the form of a calendar app on the phone, or web access to Google Calendar
  • A real GPS receiver so that I could run something like the Google Map Cell Phone Tracker
  • An Internet browser

Some things I’ve been reading:

So far it looks like either the HTC Mogul or Palm Treo 755p are at the top of my list.

, ,

No Comments