My first blog entry at FreeSoftwareMagazine.com, Why hack your game console, has been posted. It's a topical overview of why and how game consoles can be utilized and extended using home brew software and Linux. Check it out!
Jon Peck's writings about web programming, free and open source software, and other technology related topics of interest.
Thursday, November 30, 2006
Why hack your game console?
Monday, November 20, 2006
Getting Your Cell Phone Under Control Using BitPim
I had some issues with managing my cell phone. I had dozens of work contacts that I wanted to import instead of using the keypad to manually enter them. Also, I had dozens of pictures that I had taken with my phone's camera that I wanted to easily organize and transfer without being charged. After some research, I found the Mobile Action USB Data Suite - a USB cable, drivers, and syncing software for around $20. However, I felt the included software was too bloated and limiting. I installed only the drivers and turned to Google, where I found BitPim.
To quote BitPim.org...
BitPim is a program that allows you to view and manipulate data on many CDMA phones from LG, Samsung, Sanyo and other manufacturers. This includes the PhoneBook, Calendar, WallPapers, RingTones (functionality varies by phone) and the Filesystem for most Qualcomm CDMA chipset based phones.
Contacts
The ability to import contacts was what initially brought me to BitPim. I synchronized the existing contacts from the phone, converted a Excel spreadsheet of contacts into a CSV, and used BitPim's import function. After some categorizing and tweaking, I transferred the new list with my phone. I checked, and everything was there as I wanted! I saved myself from some very tedious data entry. BitPim's import also supports a variety of different sources for contacts and calendars, including Outlook, Google Calendar, iCalendar, and more.
Images
I wanted to organize the images I had taken with the phone's camera. Under Media, you can see thumbnails or a detailed list of the images. I renamed the images and even added some from my computer to use as wallpaper, which BitPim resized automatically. A quick sync, and now my images were under control.
When importing or exporting, the pictures taken with the camera were under "Wallpaper", even though they're listed under Media - images in the tree view. Also, if you rename or upload an image, make sure it has the proper file extension (eg .JPG) - my LG-VX5200 will reset when it tries to display an image without the extension.
Ring Tones and Sounds
Many people have custom ring tones... why can't I? However, I'm cheap and I like to do things myself. I edit a short sound clip, saved it as a .WAV file, and dragged it into the ringers panel. BitPim automatically converted the file to MP3 upon import. One sync later, and I now have a four bar section of "The Gonk" as my ringtone.
Other Functions
The Memo and Todo functionality worked without issue. Data entry using a computer's keyboard is much faster than using a phone's keypad, which saves time and frustration. I did not use the Calendar function because we use Meeting Maker, a proprietary format that is notoriously inflexible and nigh-impossible to export.
Conclusion
I feel that BitPim is an excellent, mature program for managing cell phones; it has the functionality and versatility that I needed without the bloat. The emphasis in this program seems to be function over form; the graphics and layout are bland and cluttered, but it works beautifully. Best of all, it's open source and free (GPL). To see if your phone is supported, check their matrix of supported phones and features.
Sunday, November 19, 2006
Waiting for the Wii
It's almost 5am, and I've been waiting in line at the Best Buy in Carousel Center in Syracuse, NY to get one of the approximately 120 Nintendo Wii's at launch. Someone who identified himself as a former Best Buy employee has been writing place numbers on people's hands in an effort to prevent line cutting. I talked to the guy who was #2; he was here at 7pm. I got there at about 11:30pm, and I'm #71.
The Circuit City downstairs has 38 units, and there's a much smaller line. I guess people just didn't think of it. I visited the Cicero Wal-Mart at 10:30pm, and they had already given out their Wii vouchers to the people who had been in line. Some people have mentioned that the Wal-Mart sales people were getting increasingly testy and rude to potential customers, and apparently all the Wal-Marts in the area were completely sold out of their Wii consoles before midnight even hit.
Most people in line in the hallway closest to the Best Buy are sleeping. The crowd is mostly 20 somethings, but there are some exceptions; a business man in his 50's, a man with his 12 year old son, and a few older women playing Scrabble.
People have laptops, consoles, TVs, and boom boxes. As the night wore on, the energy level has dropped. Smashbrothers tournaments have started, people have Nintendo DS systems playing head to head... the atmosphere is very friendly. The only rumors are about launch numbers nation wide, not about how one store really has a smaller number or anything negative like that.
Someone already has a Wii from another store and is letting people play a round or two. People queue up politely, play a round, and hand it to the next in line. Very cordial. Nobody has gotten angry, violent, or unruly the entire night.
I've been asking people if they're here for business or pleasure. Interestingly enough, most people are here to buy and play this system, and after playing a round of Wii Sports (boxing), I can see why. It's a hell of a lot of fun.
Update - 9:45am, I walked out of Best Buy with a Wii and The Legend of Zelda: Twilight Princess.
Update #2 - great xkcd comic on the subject of console lines.
Saturday, November 18, 2006
How to Configure an $80 File Server in 45 Minutes
I use a modded Xbox and Xbox Media Center for playing media files across the network on my television and sound system. I also download large files, such as Linux ISOs, via BitTorrent. However, leaving my primary computer on all the time seemed like a waste of energy. I wanted a cheap, small headless machine that I could use as a Samba server and BitTorrent client so I could leave my workstation off when I wasn't using it.
I was in luck; HCDI Trading had a great "Fall Extravaganza" deal - a Dell OptiPlex GX150 Desktop for $47.91 (around $30 s/h). The specs:
- Desktop Form Factor (it fits on a shelf in a media center)
- Intel Celeron 700 MHz
- 128MB RAM
- 10GB HD
- CD-Rom
Not cutting edge, but perfect for what I needed and priced very reasonably. Instead of using X11 and remote clients, I felt that web interfaces would be optimal out of simplicity. If I configured the server as a LAMP (Linux, Apache, MySQL, and PHP), then I could use web GUIs for configuration, administration, and file transfers.
Out of the popular Linux distributions, I'm most familiar with Gentoo and Ubuntu. Gentoo didn't seem appropriate; it would take hours and hours to get everything set up, configured and updated (even from a Stage 3 install), and any performance gain from the optimization would be negligible. Ubuntu has a history of reliability and ease of set up, so I used the Edgy Eft release as the basis my server.
The Applications
- Remote Console - OpenSSH
- The free version of the SSH connectivity tools. Use it for secure access to the console.
- Web Server - Apache
- It's free, fast, well supported and documented
- Network Fileshare - Samba
- Creates file shares that can be easily accessed from Windows. Notoriously obnoxious to configure by hand, the Samba Web Administration Tool (SWAT) simplifies the process immensely.
- Database - MySQL
- The popular free database server. While I can use a command line to administrate MySQL, I prefer using phpMyAdmin.
- P2P Client - BitTorrent
- TorrentFlux is a decent web interface for BitTornado. Useful for downloading Linux ISOs or media from places like LegalTorrents.com.
Directions
- Download and burn the Ubuntu
Server 6.10 i386 install CD.
- Install Ubuntu Server
- When asked about Software Installation, choose LAMP.
- When the installation is finished, take out the CD (I flip it over and leave it in the drive for the next time I need it) and reboot.
- Logon as the regular user that you created during setup.
- Give root a password.
sudo passwd root
- We're going to modify the file sources list to allow us
access to all the required files. Uncomment the edgy
universe, edgy-security main restricted, edgy-security universe, edgy
multiverse, edgy-backports main restricted universe multiverse, and
edgy-commercial main. In addition, Ubuntu leaves the install
CD as one of the file sources
after installation, so you'll need to remove the CD from the source
list. Comment out the CD from the list and save.
sudo nano -w /etc/apt/sources.list
- Update apt-get to use the new sources.
sudo apt-get update
- Install OpenSSH server
sudo apt-get install openssh-server
- Turn off the computer.
sudo shutdown -h now
- Disconnect the monitor, keyboard, and set the computer wherever it's going to lurk for the next couple years.
- Turn on the computer and wait about a minute for it to boot.
- Using your preferred SSH client, connect to the machine. I prefer PuTTY for Windows.
- Install Samba and SWAT.
sudo apt-get install samba smbfs swat xinetd
- Create a Samba user.
sudo smbpasswd -a username
- Add SWAT to the xinet configuration and save.
sudo nano -w /etc/xinetd.d/swat
# description: SAMBA SWAT
service swat
{
disable = no
socket_type = stream
protocol = tcp
#should use a more limited user here
user = root
wait = no
server = /usr/sbin/swat
} - Reload Xinetd with the new configuration.
sudo dpkg-reconfigure xinetd
- Verify that SWAT is up and running. If you don't
get any response, start Googling.
sudo netstat -tap | grep swat
- Make the shared directory for TorrentFlux.
sudo mkdir /share
sudo mkdir /share/incoming
sudo chmod 777 /share/incoming/ - Create the Samba share. Using a web browser, go to http://hostname:901/shares
- path /share/incoming
- valid users - username
- read only - no
- Commit Changes
- Install phpMyAdmin
sudo apt-get install phpmyadmin
- Connect to phpMyadmin using a web browser - http://hostname/phpmyadmin
- Secure MySQL / phpMyAdmin
- login: root (no pass)
- Privileges
- Add a password to both root accounts
- Create a database for TorrentFlux
- Databases - Create New - torrentflux
- Install TorrentFlux
sudo apt-get install torrentflux
- Ignore the libphp-adodb message.
- Configure database for torrentflux with dbconfig-common? - yes
- Password - blank (generates random)
- Restart Apache? - Yes
- Configure TorrentFlux using a web browser - http://hostname/torrentflux/
- Username / Password - root / root
- Configuration
- Path - /share/incoming/
- Save
- Click My Profile
- Update your password
- Create a user account
- Admin - New User
- Remove the Apache default documents from web root.
sudo rm -Rf /var/www/apache2-default/
- Create a basic web launchpad for easy access your services.
sudo nano -w /var/www/index.php
<?php $hostname = $_SERVER['HTTP_HOST']; ?>
<ul>
<li><a href="http://<?php echo $hostname; ?>/torrentflux">Torrent Flux</a></li>
<li><a href="http://<?php echo $hostname; ?>/phpmyadmin">phpMyAdmin</a></li>
<li><a href="http://<?php echo $hostname; ?>:901/">SWAT</a></li>
</ul>
Post Mortem
Overall, the installation and configuration took me about 45 minutes to go from zero to a fully functional system. The Xbox can see the share, and I've got a new playground for web development. I would suggest cleaning up and securing that home page a bit; research .htaccess files to lock it down.
I put my file server in my media center underneath my router, and it takes up about the same space as a VCR. For $80, I feel that I've made an excellent investment.
Update - 11.19.2006 - I've been Dugg! Thank you all for your comments, compliments, corrections, criticisms, and suggestions!
Friday, November 17, 2006
The Dojo Javascript Toolkit - Powerful, but Unfinished
Javascript toolkits are collections of tools that provide easy interfaces to both basic and advanced functionality that allow developers to concentrate on the business functionality of their application. However, some are more polished than others; I'll tell you about a recent experience with Dojo, an increasingly popular toolkit.
I had written a simple PHP application to graph web server statistics, such as HTTP daemons and MySQL connections. The application utilized JpGraph to generate graphs from tabular data. The first page provided documentation and the interface to select the services to graph and the date/time range, and the second parsed and displayed the requested information. For the date and time picker, I used for loops and an array to generate options for the drop-down lists. It was ugly, but due to the low volume of use, it was enough.
However, as our organization started having more web server performance related issues, we increasingly relied on the tool, and the kludgy user interface became painfully obvious. Wouldn't it be easier to select a date on a calendar rather than scrolling through an option list? Can we have all the information and options available on one page, yet have an uncluttered interface? While it was just a private utility, it needed improvement.
Enter Dojo 0.4, the modular Open Source Javascript toolkit. A number of useful Widgets in its arsenal included a date picker, time picker, tool tips, and tabbed content. It seemed like an ideal tool for overhauling the GUI without spending undue amounts of time tweaking, and I had easily utilized the collapsible TitlePane widget in another application.
However, the lack of good documentation quickly became an issue; a number of features or techniques mentioned in the incomplete API didn't work out of the box.
The date and time picker provided to be the hardest to deal with. The method of retrieving the selected date and the selected time were different and incorrectly documented (DatePicker), if at all (TimePicker). In addition, there was no documentation on how to ID the individiual widgets for retrieval.
Google searches for documentation found developer discussion threads such as, "Who broke the time picker?" but providing no working examples that worked with a form submission. I found an email exchange between a user and a developer about another widget that provided the key on how apply an ID, and a third discussion revealed how to actually retrieve the value so it could be POSTed.
Finally, I turned to the source code. According to a code comment, the published mechanism for getting the DatePicker value was deprecated, and the function for TimePicker was completely different than the DatePicker.
Armed with the information from a variety of hard-to-find sources, I finally got it to function... after wasting several hours researching, experimenting, and adjusting. Fortunately, the tool tips and tabbed content were much easier to implement than the date/time pickers.
The end result was highly polished, easy to use and beautiful. I felt drained by the experience; a released toolkit shouldn't be this hard to use. Using the beta (or alpha?) release as a justification for bad documentation is not an acceptable excuse; if you want to help others, you need to take the time to make sure they can use it.
Moroha is the Japanese word for "double-edged," and it sums up my experience with Dojo; it's powerful, but careful how you handle it.
Code:
To set up the two widgets, use the following HTML:
<div dojoType="DropDownDatePicker" widgetId="wid_from_date"></div>
<div dojoType="TimePicker" widgetId="wid_from_time"></div>
Somewhere within the form, you'll need a hidden value for POSTing.
<input type="hidden" name="from" value="">
And finally, the submit button. I used the Dojo widget.
<button dojoType="Button" onclick='submitform()'>Submit</button>
The javascript (sans validation):
function submitform(form) {
var datepicker_from = dojo.widget.byId("wid_from_date");
var timepicker_from = dojo.widget.byId("wid_from_time");
document.forms[0].elements["from"].value = datepicker_from.getValue() + " "
+ timepicker_from.selectedTime['hour'] + ":"
+ timepicker_from.selectedTime['minute'] + " "
+ timepicker_from.selectedTime['amPm'];
document.myform.submit()
}
The result can be parsed with the PHP strtotime function.
$start = strtotime($_POST['from']);
Thursday, November 9, 2006
Should I Drink the Flavor Aid?
After coming back from an expo, you're ecstatic. You saw a demonstration of a great new product; a Ruby on Rails podcasting system with a Section 508 compliant AJAX interface with built-in automatic transcription. Everyone else is doing it, it's got all the right buzzwords, and it's free! This will expand your organization's horizons and make you look like a technological genius. However, you need to take a moment to reflect on some key points before even thinking about installing your shiny new toy.
Justification
Why do you need it? Is this just to get in on what's hot, or does it serve a legitimate purpose and serve your client's best interests? Just because you can do something doesn't mean you should.
Is it really the best solution? Do some research on what other similar products are available; there may be better options that serve your needs.
Can everyone within your organization use it, or is your pet project? When you're part of a group, you need to consider the needs of others, not just yourself.
If others may be using it, how hard will it be to train them? You need to consider the lowest common denominator; it may be easy for you to use, but it may be much more difficult or impossible for others to use.
Do they even want to use it? There's nothing wrong with asking a few questions; you may find out that there's a better solution available that you hadn't considered or were even aware of. Change can be very scary and difficult for some individuals to handle; take that into account when proposing a new solution.
Maintenance and Support
How easily does it integrate with your existing system? Think of a square peg in a round hole. A hammer would get it in, but it would take a lot of work and would damage both the peg and the hole. While there may be no direct monetary cost for the software license, every minute you spend configuring, rewriting, tinkering, and fixing is a time cost.
Is it an officially released, mature product, or is it still in beta? If it's a mission critical application, then you don't want to use an incomplete or untested product.
How buggy is it? If the tool gets the job done, but only does it 3 times out of 10, then it's not not an effective tool.
Is the product the result of the work of a group, or an individual? This adds to the fragility of a product; if the sole developer is hit by a bus, then the project is also dead.
What kind of support is available? Sometimes, all you get is a 20 line text file in broken English. Other times, a complete Wiki and active forum or IRC communities can supplement the existing documentation.
Is the product still being actively developed? If there's a missing feature, who will add it? If you report a bug, who will fix it? It may have been great four years ago, but if nobody is working on it anymore, then you should seek other solutions.
Can anyone else in your organization maintain the new application, or are you the only one who knows how to keep it up to date? Once again, consider the hit-by-a-bus scenario. This isn't necessary a deal breaker if you keep good internal documentation.
Conclusion
Recently, I came back from a conference excited about Ruby on Rails, a free web application framework. I watched a manager (not a programmer!) create a feature complete forms-based front end to a database in about 20 minutes, and I was sold. I did the research, asked the questions, and it really does look like the best solution for some specific applications that we need to develop. Sometimes, the hot solution is popular for a reason. Just remember, while a great new product may excite you so much that you just about wet your knickers, take a deep breath, step back, and think it through.
Historical Note
In the 1978, approximately 913 followers of Jim Jones drank cyanide-laced grape Flavor Aid in a mass cult suicide.