January 31, 2006
Simple MySQL Magic with ODBC
A colleague and I were talking recently about a website that used a batch-type program to upload an Access file to the webserver each night. It allowed the organization to provide the latest, most accurate information in near real-time. This discussion got me thinking about more effective ways and what to do with MySQL and the LAMP (Linux Apache MySql PHP) platform.
My colleague's website was developed on the Microsoft ASP platform. This made it super simple for a little batch script to FTP a new Access .MDB file each night. With the ASP scripts already in place, the new DB file just replaced the old one. Nothing really changed. Extremely simple move and effective.
All of this got me thinking about how I could do this type of thing with my LAMP platform. Since I utilize MySQL as the DB engine and not Access, doing this type of task is more cumbersome. There is no way to interface with Access's JETDB engrine with LAMP (that I know of). To manage this process, what I had been doing was relying on this little Acess-to-MYSQL tool. The tool creates an SQL dump file that I had been subsequently loading into MySQL via PHPMYAdmin. This process took a couple of extra steps, but worked.
But a client recently needed a more streamlined solution. I thought of writing the application to be completely web-based. That created some issues relative to reports. I was resigned to hack together some solution with the tool I had been using, even if it wasn't that pretty.
Then I began to play with ODBC. Suddenly, batch scripts and SQL dumps became a thing of the past. ODBC stands for 'Open Data Base Connectivity' and is a standard that lets most databases talk to each other. Somehow, MS Word files and Excell spreadsheets can also use it.
Here's what I discovered:
Enter MySql ODBC - Installing the Driver
I went to mysql.org and downloaded their Win ODBC Driver 3.51 and installed on my Win XP Pro box. On my box, I went to Control Panel/Administrative Tools/Datasources and added a User Data Source that pointed to my MySQL database on the webserver. There are a couple configuration pararemeters within the driver that I picked-up on from my readings at: http://dev.mysql.com/doc/refman/5.1/en/msaccess.html. I implemented those. Very simple.
Control Panel Access Hosts
One of the things that stumped me in setting this up was logging into the MySQL server remotely. This was addressed with a simple adjustment made through the control panel. Within the MySQL Databases page, simply added an Access Host (%) solved the problem. Now you can log into MySql from anywhere.
Using MS Access
With the driver now in place, any MS Access table can be directly (and tranparently) exported into MySQL (File/Export) by selecting ODBC. It'll automatically upload the complete table to the server. (Of course there are a couple to things to keep in mind about this; see previous link).
But the real power is now Access has the ability to use the tables that reside on the webserver just like they were its own. You simply use 'Link Tables' within Access, choose your ODBC driver and a list of tables appears. Select your desired table. It's then added to Access's table list. Opening it shows the data as it stands on the webserver. Any updates you do to it (add/update/delete) are updated on the server in real-time. Keep in mind, too, that the tables can also be imported as well, but then they become localized only.
In theory, ODBC can be used to create a nice MS Access front-end to a web-enabled database. No more '2 databases' - only one. Instantaneous updating. Instanteous maintenance. Sophisticated reporting from web data.
Certainly there are a number of tweaks and performance concerns related to this methodology that will need to be addressed. The databases I maintain a super simple, so hopefully issues will be at a minimum. However, Microsoft has published a comprehensive paper on working with Jet via ODBC that I'll probably review (http://support.microsoft.com/kb/128385/EN-US/)
Freakin' cool....
Posted by pgraber at January 31, 2006 02:12 PM
January 28, 2006
Ensuring AOL Email Delivery with -F
AOL recently made an adjustment to their email delivery system with new policies that are resulting in email from PHP scripts being blocked. This effects Apache virtual servers that use generic users when sending mail (nobody@, username@, root@, apache@, etc.) and thankfully, only requires a simple fix : the use of -F.
AOL can do whatever they want, its their network. Recently, however, they made an adjustment to what email they accept from outside sources that utilize PHP. What is even more interesting is that they haven't made the adjustment public - it was only through analysis of the logs and subsequent calls with the tech center that the new policy was uncovered. It is assumed it is an effort to combat spam from entering their network.
This has implications for PHP scripts that send the user communication. All scripts will need to be adjusted to add a valid email address to the 'Return-To' header. To do so, the '-F' modifier is used in the format: '-F valid@emailaddress.xxx'
PHP's mail function allows the addition of 'additional paramaters' (http://us3.php.net/manual/en/function.mail.php) that make it super easy.
So, if AOl users aren't getting email from your PHP scripts, add the -F flag (with a valid email address) and consider your problem solved..
Posted by pgraber at January 28, 2006 11:24 AM
January 25, 2006
Instant Car Sale w/Craigs List
I was selling my car recently. So I decided to post it on Craig's List to generate some interest. I had near instantaneous success.
Basically I ran a free ad in the Raleigh auto section of the site. I no soon clicked 'publish', that about 7-10 minutes later my phone rang. It was an interested buyer who wanted to take a look.
We arranged to meet a half-hour later in the parking lot of a shopping center close to my house. I arrived and took him for a spin.
He liked the opportunity and the price. We agreed and made a deal. Case closed. Done.
He picked it up the next day - cashier's check in hand.
I don't know if I could have possibly streamlined this any faster. I guess you get lucky sometimes. I paid nothing to run the ad and didn't even include a picture.
Posted by pgraber at January 25, 2006 01:15 PM
January 11, 2006
Lessons from the (M) $$ Homepage
I had been following the marketing concept known as 'The Million Dollar Homepage'. Basically a kid in the UK created a page in which he sold pixels for a $1 apiece and made $1M in four months.
While I'm very envious - as you are - the point that I wanted to highlight was that of process. According to a story I recently read about it, he started off by selling pixels to friends and family. When he was able to obtain enough money he issued a press release, that according to CNN 'was picked up by the news media, spread around the Internet, and soon advertisers for everything from dating sites to casinos to real estate agents to The Times of London were putting up real cash for pixels, with links to their own sites'
The point is that the idea was simple and original, and used an extremely basic process. There's still hope for us normal folks after all...
In my own little world, I had somewhat of a similar experience at work. No, not with the money, but with creating media buzz. See my entry about Advocacy Through Public Relations to see what happened.
My point is that there seems to be a process. It builds on itself. Kinda like a domino effect. It was a blast.
Now if I can only come up with something to profit with....
Posted by pgraber at January 11, 2006 09:54 PM
January 01, 2006
Home in Buffalo for The Holidays
In what's becoming an annual ritual, I spent a nearly a week with family in Buffalo. I arrived on the 26th and stayed to the New Year.
Monday - Travel Day
I took the first flight out of Raleigh at about 7:20 am. Getting through security was actually very easy as I checked out at a kiosk at Southwest. The kiosk was surprisely easy. User friendly.
My layover in Baltimore wasn't bad. Why do you have to walk over a terminal? Baltimore to Buffalo has this. Many times is lower A's. Two minute walk.
I snoozed on the way over. Tried to configure MySql on this Apache server. No luck.
Anyways, I got to Buffalo, called Lynn to pick me up. The only snag I ran into was with my baggage. My one bag arrived, but the ones with my clothes didn't. I was told to come back by 1:00o pm - the time the next flight came in from Baltimore. It turned out fine. I suspect that my bag got scanned. It wasn't lost; just getting scanned. Just a hunch...
Wireless Router Needed
Getting to think that I needed to do so much work, I wasn't going to sit up in that office...I decided to take a chance on buying one and hooking it up. So I called Mark Hummel and went over. We relaxed a bit and decided to kill two birds with one stone...so we drove to the airport, picked up my luggage and went to Circuit City and picked up one. It worked out great....
Along the way to doing these errands, we went to our annual visit to see John Morganti. Mark and I have made a tradition on it..
After I got home, I hooked up the router. The only thing I couldn't get to work was the encryption...So I have it running bareback..... it's nice, I'll be doing most of my work at the kitchen table...
Tuesday
Today started off just how I lik it: coffee and code at the kitchen table. I laid the groundwork of a small web application. Unfortunately, the Mac was a bit flaky with the router, but I did the best I could. After I worked for awhile, I caught up with my old bookeeper and we discussed things about the new corp. We sat around the kitchen table for awhile and chatted before we went to the party at Judy's. I got to see my youngest niece and nephew - Jimmy's children. Little Jimmy is a freshman at UB, Merideth a Freshman at Mount Mercy.
Anyways, we left for Judy's around 6:00 ish I think. The party was a great time. I split the first round of Poker w/Chris and won a few bucks. (Didn't do so good on the the next go-round). Tommy and I played our annual Christmas Chess match. I smoked him handily in about ten moves. (Unfotunately, he's beat me in four in the past). After the party, I had a few in me and we decided to hit downtown for a little bit.
We stopped by the Old Pink Flamingo on Allen St. It was me, Tommy, Denise, Chris, Sarah, Amy Graber and her boyfriend Chuck. We played a few games of pool, I got to see a couple of old friends (that always happens in the Pink) and we took off about 3:15 am. I think I got to bed about 3:45 am - that was the latest I had been out in a long time.
Wednesday
I dragged myself out of bed about 9:30 and I was already late. I had told Keith from Audax that I would meet him for coffee and was supposed to be there at 9:00. Anyways, I got it together and took a drive over to his place. I got to see Johnston - who looked about 15 years younger and spent awhile with KK. They have their offices on Millersport.
Since I was out that way anyway, I decided to stop in and see Steve at Latko. Spent some time there with him and Annette. Karl Malazzo even stopped by. Of course I got a Maybeck's sub just for old time sake. The bottom line though, was that I was hung-over. It wasn't too bad, but it sucked either way.
After that, nothing extremely eventful. I worked on the web app off-and-on throughout the day. Spent a bunch of time at the kitchen table with sis - what else is new? We took Tommy to the airport.
Thursday
Got up early, wrote code and picked up Erin at the airport. While picking her up, I bumped into a fellow I used to work with at the Peace Bridge. That was pretty easy, I also like how short term parking (30 minutes or less) is free. Good deal.
Erin and I just went back to Lynn's and hung out for awhile. I had spoken with Edwards earlier in the week about a trip to the casino. We were supposed to rendevous with him about 2:00, but it got pushed backed to like 3:30 pm. Something with his doctor. Anyways, instead of going to the casino, we ended up at this sports bar on Sheridan. His friend Greg from the NiteCappe owns it. Mark and I played a little bit, ate some wings and Erin and his wife just shot the breeze. Interesting all around. Since we had to get back for dinner at Lynns's we cut our visit a bit short. We were back in West Seneca by 6:15 pm.
After dinner, Judy stopped by and just like old times they talked, and talked, and talked.
Friday
Erin was pumped to do some shopping, so after a lazy morning, we went over to the Galleria and she hit Kauffmans. We only stayed a short time and she didn't see anything she wanted. The next stop - of course - was Wegman's. Erin has fallen in love with that store. So while we were in there, we ran into Dad of all people. He was with Bill. It was nice to see both of them. We shot the breeze for awhile. I really got a kick out of that.....so did Erin....
Lynn made this great dinner. We were supposed to go visit Maryann, but she had come under the weather, so we improvised. After dinner Judy/Charlie stopped over. We exchanged gifts. Yada, yada, yada.
Saturday
The thing about this trip that has been the most enjoyable was the fact that we haven't been rushed. It was been a great pace. Just like the other days, the morning was lazy. I did what I normally do in the morning, Erin slept in and did her thing. We had arranged to meet Dad at Judy's at 2:00 pm. We got there about 2:25. It was a nice visit. He gave Erin and I the wedding band we talked about. I took some photos of him with Tiffany's cell phone camera. After an hour-and-a-half or so, we all left.
Since it was New Year's Eve, we all had dinner plans at Ilio DiPaulo's in Blasedell. I had never been there before. The food was excellent. It was myself, Erin, Judy, Charlie, Lynn and Nig. It was a nice dinner. We got out of there about 11:15 or so, and headed over to the McKinley Park Inn. (Never been there either). Anyways, we ended up never even going in and ended up at the Nite Capp on Abbot of all places. (Again, never been there either). Ringing in the new year was alright. The bar was not crowded at all. There was this old drunk that they threw out just as we were getting there. It's that kind of bar. Erin and I played some pool.
The vacation ended on Sunday, with Erin and I flying out at about 6:30 pm. We got home in about 11:30 and crashed. I had to work in the morning...or so I thought....
Posted by pgraber at January 1, 2006 05:42 PM
