Wednesday, August 26, 2009

Linux, PHP, and MSSQL Server

I don't know if this will work for everyone, but it took me 2 days to figure this out so maybe it will help you.

Problem
I wanted to connect to an external SQL Server 2000 database from a hosted Linux database. From the Linux box I was able to ping, telnet, and tsql the database server, but PHP would always throw a "unable to connect to database error".

Solution
PHP, in my case, uses FreeTDS to interface with MSSQL. My hosting provider has the default version of FreeTDS set to 5.0. After many hours of research I figured out that I needed to use version 7.0. So to get it to work I just set the version to 7.0 in my PHP script with the following line of code:

putenv('TDSVER=70');

And that was all folks. (Remember that when you use mssql_connect with Linux that you want to probably add the port number to the host. e.g. mssql_connect( 192.168.1.1:1433, $user, $pwd ) ).

Tuesday, August 18, 2009

How to Scrobble Internet Radio (Windows)

This is a step-by-step guide on how to scrobble internet radio using free apps:
  1. Download and install SqueezeCenter from Logitech
  2. Start SqueezeCenter (this automatically started for me)
  3. Open Winamp or iTunes and connect to http://localhost:9000/stream.mp3
    • In iTunes go to Advanced > Open Audio Stream...
    • In Winamp to go File > Play URL...
  4. Once you are connected, open SqueezeCenter (right click on the icon in the system tray and select "Open SqueezeCenter" (this will open in your browser)
  5. Press the settings button down in the bottom right corner
  6. Click on the "Advanced" tab
  7. Select "Last.fm Audioscrobbler" from the drop-down menu
  8. Enter your credentials and make sure that both drop-downs are set to "Yes..."
  9. Click the "Apply" button at the bottom right
  10. Select the "Player" tab
  11. Select either Winamp or iTunes from the drop-down
  12. Select "Last.fm Audioscrobbler" from the drop-down next to the player selection
  13. Enable scrobbling
  14. Click the "Apply" button at the bottom right
  15. Now you are set up to route internet radio through SqueezeCenter to your media player and have it scrobble...
  16. Close the "Settings..." portion of SqueezeCenter
  17. Leave iTunes/Winamp alone, go to the home page of SqueezeCenter
  18. Expand Internet Radio at the left
  19. Choose the station of your choice (I chose to search for a Boston station I like a lot)
  20. Push the play button on the station you choose
  21. Audio should start playing through iTunes/Winamp
  22. Booyeah you're done.
NOTE: If you get "chipmunk" sounding audio (I did), just press the stop button on iTunes/Winamp and then press play again. This fixed it for me.

Happy scrobbling.