My MacBook Pro

Last update: 2011-12-13

Raam's MacBook Pro Specifications

Operating System
Mac OS X v10.4 Tiger

Motherboard and CPU
2.4GHz Intel Core 2 Duo processor, 4MB on-chip shared L2 cache running 1:1 with processor speed

2GB 4GB of PC2-5300 (667MHz) DDR2 memory; two SO-DIMM slots support up to 4GB

800MHz frontside bus

Battery
60-watt-hour lithium-polymer battery (with integrated charge indicator LEDs) providing up to 6 hours of battery life

Networking
Built-in 10/100/1000BASE-T Gigabit Ethernet (RJ-45 connector)

Built-in AirPort Extreme Wi-Fi wireless networking (based on an IEEE 802.11n draft specification); IEEE 802.11a/b/g compatible

Display
15.4-inch (diagonal) TFT LED backlit display with support for millions of colors; glossy widescreen version

Video
NVIDIA GeForce 8600M GT graphics processor with dual-link DVI support, 256MB of GDDR3 SDRAM

Dual display and video mirroring: Simultaneously supports full native resolution on the built-in display and up to 2560x1600 pixels on an external display, both at millions of colors

DVI output port

VGA output using included DVI to VGA adapter

Built-in iSight camera

Storage
160GB 5400-rpm Serial ATA hard drive

8x slot-loading SuperDrive (DVD±R DL/DVD±RW/CD-RW)

When work offered to buy me a new laptop, I had the option of getting a Mac or a PC. My co-worker had recently switched from a Windows-based laptop to a new MacBook Pro and although I already had a PowerBook G4, something urged me to opt for a new Mac. There were a couple of things driving my decision, namely the fact that Apple switched to Intel CPU's (instead of PowerPC) and NVidia Video controller's (instead of ATI). I'm a strong follower of Intel and NVidia, so having both packaged together with a Unix-based operating system was a hard thing to pass up.

It was arguably the best computing decision I've ever made.

I purchased an older PowerBook G4 from a friend a few years ago specifically to become more familiar with the OS X operating system. More and more people were beginning to ask me for help with OS X issues and since I had basically no experience with OS X, I wasn't very much help. The PowerBook was nice, but it still left me hanging when I really needed to use Windows. When Apple switched to Intel CPU's, everything changed.

Windows XP on Mac OS X

Now I can use VMWare Fusion to run Windows XP on my Mac while I'm running OS X. I can seamlessly switch between the two -- it's like having two computers in front of me. Files can be dragged between the OS X and Windows XP, with VMWare automatically handling the transfer between operating systems.

With BootCamp, I created a separate partition on my hard drive, inserted the Windows XP CD, rebooted the MacBook, and the Windows XP installation started as if I was installing on any other computer. Now I can hold down the 'Option' button on my keyboard during boot-up and select the Windows partition to boot my computer right into Windows -- OS X never even starts and Windows has full system resources, including full control of the NVIDIA GeForce 8600M GT video controller, which allows for GAMING!

Gaming on the MacBook is not only possible, it's better than any other solution!

The excitement that followed my discovery of how well gaming works on my Mac is what finally drove me to finish writing this post. With BootCamp, Windows is given full system resources. This means you're running a Windows machine with an Intel 2.4ghz Core 2 Duo processor, 2GB of RAM, and an NVIDIA GeForce 8600M GT video card with 256MB of GDDR3 SDRAM. And yes, any game you install won't know the difference between your Mac and your desktop PC gaming rig!

OK, so you probably think my excitement is a little overdone. I've been looking for a good balance between stability, performance, and entertainment for a long time. With a MacBook, you can setup a partition for Windows and install your games on that partition (Update 2007-11-28: Due to the large space requirements for some games (World In Conflict requires 8gb!), I've started installing games on an external USB 2.0 drive. They still run awesome!). Then for general use, including work, you'll boot into OS X and feel safe and secure about your game-free environment (and less distracted!). When you're ready for some entertainment, simply reboot into Windows XP and start your favorite game.

I believe this separation makes gaming on the MacBook better than any other solution. I have played two of Valve's new games (Portal and Team Fortress 2) and they run awesome. Here are some other games that are known to work (there are bigger lists, but I'm trying to save space):

* Age of Empires III (1440x900)
* America's Army 2.6 (1440x900) (1680x1050)
* Battlefield 2 (small artifacting)
* Battlefield 2: Euro Force (small artifacting)
* Call of Duty 2 (1440x900) (1680x1050)
* Civilization IV (1440x900)
* Counter-Strike: Source (1440x900)
* Doom 3 (Enter this into the console: r_mode -1 r_customwidth 1680 r_customheight 1050 vid_restart. This will enable 1680x1050 resolution. Replace with 1440 and 900 to enable 1440x900 resolution)
* F.E.A.R. (1440x900)
* Far Cry (1440x900)
* Flight Simulator 2000
* Flight Sim 2004 - Century of Flight
* Grand Theft Auto: San Andreas (1440x900)
* Grand Theft Auto: Vice City
* Half-Life 2 (1440x900)
* Portal
* Team Fortress 2
* Quake 3
* Quake 4 (1440x900 and 1680x1050)
* Return to Castle Wolfenstein
* Return to Castle Wolfenstein: Enemy Territory
* Splinter Cell: Chaos Theory
* UT2004
* World of Warcraft (1440x900)

For a long time, my thought-process was "Linux is good for servers, Windows is good for gaming and general use, and OS X is good for video and graphics design artists". I've been using my MacBook Pro for a couple of months now and my thought-process has changed to "Linux is good for servers, Windows is good for gaming, and OS X is good for everything else including general use".

Screenshot 2007-10-31

A list of some applications I've installed:

Firefox or Chrome (web browser)
Thunderbird or GMail (email)
Cyberduck (FTP, SFTP, etc.)
iTerm (an awesome tabbed terminal I use)
OpenOffice (Office for Mac)
GeekTool (used to add stuff to your desktop, such as the IP info and server monitoring in my screenshot, very cool!)
Quicksilver (application launcher, and more!)
XCode (from Mac OS X Install Disc 1)
Fink (Debian package management tools)
wget, rsync (using Fink)
VMWare Fusion (for Windows XP, Linux, whatever!)
Macromedia Dreamweaver 8 (Web design, *cough* BitTorrent)
Eclipse (programming IDE)
TextWrangler (I recently switched to TextMate) (nice quick code editor)
VLC (video/media player)
Skype (Chat, Phone, SMS, Video Conference)
Transmission (BitTorrent client)
Adobe Photoshop CS3 (photo editing on your Mac, *cough* BitTorrent)
Audacity (lightweight audio editor)
Witch (awesome application switcher)
InsomniaX (used to prevent MacBook from sleeping when I close the lid)
USB Overdrive (a must have if you use an external USB mouse!)

Some tips and other things I've done:

Added set term=linux to my ~/.exrc file to fix the Usage: [[ problem when using arrow keys in vim with iTerm (thanks Isaac)

Changed my OS X Hostname to eris (thanks bcrow):
sudo scutil --set HostName eris

Replaced the default OS X Command+Tab application switcher with Witch.

Changed the default Utility Lock background to this picture with this quote as my password prompt: "Linux is what you get when a bunch of PC hackers try to port UNIX to the PC. BSD is what you get when a bunch of UNIX hackers try to port UNIX to the PC."

BSD Ascii

There are lots of good post-installation tips here too.

And here is a good list of apps on LifeHacker.

Van Helsing's Curse – Oculus Infernum

If you're going to listen to even one Halloween album this year, this has to be it! I heard a song on the radio the other night while driving back to Cambridge. All I could remember the DJ (Dee Snider) saying at the end of the song was "Van Helsing". After a little Googling, I determined I had listened to a song from Van Helsing's Curse - Oculus Infernum, an album inspired by the Trans-Siberian Orchestra.

I don't normally care for "Halloween" music, but this album is definitely an exception. It's an amazing compilation of different music styles, sounds, and instruments. If you've seen a handful of well-known horror flicks, you'll recognize many of the tunes in this compilation. If you know how, get the album through the BitTorrent network.

Upgraded to WordPress 2.3 – Growing Pains

I generally like to wait awhile before upgrading things, especially since most bugs (serious or otherwise) come out after the new version has been released. A little over a month had passed, so I decided it was time to upgrade my WordPress installation to version 2.3.

How can we make upgrading as quick, painless, and safe as possible?

I found a really nice way of upgrading WordPress: The Automatic Upgrade plugin. It basically automates the process of backing up your existing WordPress installation (including the database), downloading the latest version of WordPress, and installing it. I don't like the idea of putting my entire blog in the hands of a plugin and I would never have even considered using it if there wasn't a backup feature included. I was happy to see a zip file of all my WordPress files, as well as a backup of my entire database, delivered to me through the browser before any upgrading began.

The upgrade to WordPress 2.3 went smoothly with Automatic Upgrade. In the future, it would be really nice to see something like the Automatic Upgrade plugin included directly in WordPress, since upgrading to a newer version is always going to be a necessary evil. The WordPress developers seem to have started down this path by including an Upgrade Notification feature in this version (which I discovered while writing this post):

WordPress Upgrade Notification

What happened to inline preview!?

After upgrading, I immediately noticed something very annoying with post Preview. The inline preview box at the bottom of the post editing window was gone! Instead, there was Preview link next to the Title field which opens an entirely new window to preview the post:

WordPress 2.3 Preview Link

The ability to preview your post from the edit page after clicking 'Save and Continue Editing' seems to make a lot more sense to me (at least from a work flow perspective) than saving the post, clicking preview to open a new window, previewing the post, and then closing the window.

I read somewhere on the WordPress forum that the decision to remove inline preview was based upon speed and performance concerns. However, in the 500+ posts I've created prior to WordPress 2.3 I have not once experienced a performance issue with the inline preview. If the developers wanted to remove inline preview, they should have at least created an option to enable/disable it and simply made the default disabled.

I found a really nice plugin that fixes the missing inline preview problem by adding a the inline preview back onto the edit page. It's called Preview Frame and is created by Rob Miller.

Ah, sweet familiarity! It's so nice being able to preview my post without leaving the editing window! Hopefully a future version of WordPress will bring back the option to preview inline, but until then, thanks Rob!

Drafts: My start-but-not-finish habit is finally (at least somewhat) hidden!

If you're like me, you probably have dozens of drafts saved up for a rainy day. Perhaps there was something interesting you found and wanted to blog about but simply didn't have the time to write a fully polished post, so you jotted down some stuff and saved it as a draft. Once in awhile you'll finish a draft, but otherwise the pool continues to grow.

Prior to version 2.3, when you clicked on "Write" you would be presented with a big blob of your drafts, probably about 15 - 20 of them, which would take up about 1/3 your screen. Of course, this was very unnecessary. Version 2.3 fixes this in two ways. First, the list of drafts has been shortened to three:

Secondly, clicking the "more" link brings you to the Manage Posts section where you're now able to filter posts by their status, sorted by Modified Date (see the timestamp bug below!):

Tagging and Tag Clouds: Should I follow the crowd?

Another big addition to WordPress 2.3 is the support for tags. Some people believe that tags are a better solution to categories (the Web 2.0 solution). I'm still trying to decide if I agree with that statement, since I really like the organized method of current category design.

The idea behind tagging is that you "tag" each post you write with multiple words, similar to selecting a category or multiple categories for the post. Then, using the new wp_tag_cloud() template tag available in WordPress 2.3, you can display a tag cloud:

Tag Cloud Example

A tag cloud is basically a way of visually displaying the most common tags and allowing the user to click on any tag to bring them to a list of posts containing that tag. If you tag a lot of posts 'Publication' and a few posts 'Security', then the security tag will appear smaller in the cloud (as in the example above). There is an alternate way to implement a tag cloud without using the tags feature by using the existing categories instead. This blog explains in detail how it can be done.

Until I find a good reason to start tagging my posts, I will continue using categories and leave the Tags field empty.

Everything has bugs!

I've found at least two bugs so far. I don't know if they've been fixed with 2.3.1, since I haven't installed that yet. The first is less of a bug and more of a usability issue, but both are related to the post timestamp.

When you start writing a new post, clicking Save does not save a timestamp. This means it won't show up at the top of your drafts list! If you click "Save and Continue Editing" or "Publish", the current timestamp is written and everything works as expected -- or does it?

I had another issue with timestamp. After publishing a post, I decided I wanted it to show up tomorrow instead of a few hours from now. So I modified the timestamp and re-published the post, fully expecting it wouldn't show up until tomorrow. However it still showed up when the original timestamp date passed, even though the current timestamp showed a later date!

As with any type of bug, replication is a requirement. I performed a couple of tests to see if I could duplicate the second timestamp issue, but I was unable to. Raf suggested a possible plugin conflict, but I disabled all plugins and still had the same problem. I discovered the second timestamp bug before the first and now I'm wondering if the two are related.

Obligatory Summary

WordPress is definitely morphing into a better piece of software. I like the new features, though I'm a bit surprised at the remove of inline preview and the obvious timestamp bug. I've been using WordPress since the first 2.0 version and I really like the way things are designed. In determining what to use as a CMS for the website of my web hosting company, I've decided WordPress is an ideal candidate due to the ease of customization and the power provided through the templates.

A Colorful Autumn

Perhaps it's just because I drive more between Boston and NH now that I'm living in Cambridge, or maybe it's the crazy weather we've been having (it was 83 degrees on October 22nd!), but this year seems to be an especially colorful autumn.

Web hosting is not for everyone

As you may know, I run my own web hosting business called Akmai.net Web Hosting (soon to be CORBAWeb) and I host about 45 active domains for a small but dedicated base of 15-20 clients. Running a web hosting business is not particularly difficult, especially with software like CPanel (to give the customer easy access to common domain related functions like email, subdomains, etc), WHM (to allow the administrator to control nearly all aspects of running a web server, including DNS, shell access, etc) and WHM.AutoPilot (to assist with billing, invoicing and automatic account creation).

You might be thinking, "if running a web hosting business was so easy why wouldn't everyone be doing it?". Everyone is doing it and that is the reason 90% of the email on the Internet is spam! There are so many inexperienced web host administrators who don't understand the technology behind the software they're using because wonderful applications like CPanel and WHM remove that requirement (don't get me wrong, I love CPanel and WHM). All the people who jump at the chance to run their own web hosting business need to understand there is more to it than just creating accounts and watching your Paypal balance increase -- there is great responsibility that comes with running a web hosting business and there is no room for incompetence.

Let me give you an example. Late this morning my Blackberry beeped to indicate an incoming email. No big deal -- I hear that beep dozens of times throughout the day. But the beeping didn't stop -- it kept beeping as if it was an alarm. Sure enough, I had 12 "Mail Delivery Failed" messages. Then 13. Then 14. After about 40 seconds it was up to over 100 messages. I instantly knew what this meant. Someone, or some thing, was sending a huge number of emails from my web server and the vast majority of those were bouncing back because the recipient email address was invalid. A quick check of the server showed over 20,000 emails had already been sent.

With the help of an on-site engineer, at the data center where my server is located, I was able to track down the origin of the email spamming. It was coming from a mail form installed on one of the domain on my server. The form wasn't anything harmful, and neither was the domain (nor the person who owned the domain), but the mail form wasn't secure. It didn't have any type of captcha installed to prevent a spam bot from submitting endless requests to the script. A spam bot crawling the web for insecure forms found the script hosted on my server and started using it to send a 'Paypal Account Notice' email designed to phish account details from the recipient. I quickly deleted the script from my server and had any remaining messages purged from the mail queue.

This is a perfect example of how incompetent web host server administrators are to blame for all the Internet's spam. If I didn't allow myself to be bothered on my Blackberry with all the "Mail Delivery Failed" messages for my server (including legitimate ones), I wouldn't have discovered this was happening as quickly as I did. Most people simply let those emails drop into an Inbox somewhere and forget about them. If 20,000+ messages were sent out in the 5 minutes it took me to discover and fix the problem, how many messages would have been sent out if I didn't discover the problem for a few hours? Or a few days?

You cannot blame the creator of the mail script, because while the programmer might understand that his script needs additional security before being used in the real world, a web designer will simply upload the script to a web server and expect it to work. This means that there will always be instances where a faulty script is utilized in a malicious way by someone with bad intentions. So who is responsible? The system administrator is responsible. It's his job to make sure everything runs smoothly and there is no room for incompetence. How many web host administrators regularly read their logs for suspicious activity or broken software? I read akmai.net's logs on a daily basis.

Web hosting is not for everyone because many people lack the technical understanding, the competence, and the time required to properly manage a web server. If you're running your own personal web server at home, fine. If you're running your own mail server, I hope you know what you're doing. If you're running a web server that's located in a data center with lots of bandwidth and you're hosting domains, email, and DNS for people you don't know very well, then you'd damn well better know what you're doing and understand the nasty things that exist out there on the Internet. You will be attacked. Be prepared.

SongBird: A formidable replacement for iTunes?

I've been looking for something to replace iTunes as the main library for my 20,000+ mp3s. Whatever application replaces it needs to stand up to some high expectations, including the ability to manage such a large number of mp3s without slowing down or crashing, and a rating system that allows me to rate my favorite songs (I'm always finding new songs in my huge collection, so rating them is important for when I want to come back to them). Of course, the ability to import my current iTunes library and support for my iPod would be huge pluses.

Welcome SongBird, a multi-platform media player developed by a group known as the Pioneers of the Inevitable. They're responsible for the creation of Winamp and the Yahoo! Music Engine. The current version of SongBird is 0.2.5 and although it's a bit rough around the edges (literally, the edges don't look as smooth as they should) it still shows a lot of promise:

The list of features is very impressive and includes support for importing your iTunes library, interfacing with your iPod, and of course, an iTunes-like rating system. SongBird also has a built-in web browser which automatically searches the current webpage for any available music and allows you to play the music in SongBird as if it were a local file. Check out the SongBird Screencast to get a better idea of how all this stuff works.

I've started using SongBird on my Mac and so far I love it. A couple more skins (known stylishly as feathers in SongBird) would be nice, especially an iTunes skin. 🙂 SongBird is still in the development stages and, as far as I can tell, is not an open-source project. However the website says the group does "support the Mozilla Foundation's mission to preserve innovation and choice on the Internet". This means that even if there is a cost associated with SongBird when it's finally released, I'll be happy to purchase it knowing the money will go towards a good cause.

Sunlight Stars

These tiny white sparkling dots are actually little bugs flying around the top of the tree! Since they were partially transparent, the sunlight both reflected off their bodies and filtered through them, they created what looked like dancing stars in the middle of the day. Seeing them in motion was even more impressive! It's incredible what nature creates.

You can see a few more pictures (including higher resolutions) here.

Should I Run in Polluted City Atmosphere?

I've been living in the city (Cambridge, MA) for almost a whole year now and one of the biggest things I miss about living outside the city is the cleaner air. OK, the air in Lowell is not exactly clean but I can drive 10 minutes and be in the middle of a 1,000 acre state forest where the air is much cleaner. I used to do a lot of running before I moved to Cambridge, both indoors and outdoors, but now I feel afraid to run. I can smell the pollution in the air simply walking 10 minutes between my apartment and the office -- it makes the air dry and thick. I'm not one to quit simply because something is more difficult or because it doesn't taste or feel good. But when it comes to my health, I can't help but wonder, will running in polluted city atmosphere actually be worse for me than not running at all?

Every day I see so many people, young and old, running throughout the city and I wonder if the health benefits they are experiencing are only temporary -- if by sucking down so many unnatural, unhealthy chemicals they're actually shortening their overall lifespan. I touched on this subject a few months ago in a post titled Dirty Air. I concluded the post by saying that a healthy lifestyle cannot be had while working where the crowd works. I don't like to believe things are impossible and I feel there must be some type of balance that can be reached -- perhaps a combination of indoor aerobic activity (rowing machine), indoor anaerobic activity (weight lifting), and various weekend outdoor activities when I visit Lowell on the weekends.

I also wondered if running at night, or early in the morning, would be more healthy than running during the day. I noticed the air smells much cleaner during the late evening and early morning hours. My own hypothesis is that when the sun goes down and the air begins to cool, all the warmer air (which was mixed with pollution from cars and buildings as well as heated by the sun during the day) rises up into the atmosphere allowing the cooler, cleaner air (cleaned by moisture in the air, currents, etc.) to sink down to the ground. If this is true, then running at night and early in the morning, before people start leaving for work, could be much healthier than running during the day. Are there any night runners (or early morning runners) out there that can confirm any of this?

So Tired

Only 3.5 hours of sleep -- I didn't get to sleep until 7:30am this morning because I was working on a project all night for work, which was due today.

We got it done.

We had to continue tweaking stuff throughout the day, and will need to continue doing so in the coming weeks, but that's expected.

Rejecting Limitations

Its always been difficult to set aside any great amount of time to learn a new programming language. I would tell myself there was so much more I could learn from PHP and I would further justify my lack of commitment by believing PHP was all I really needed to make great web applications.

When I started learning more and more about AJAX and the power behind JavaScript, a client-side scripting language, I began to realize just how much I was limiting myself by concentrating solely on PHP. The acceptance of my limitations hid me from the great power behind other programming languages. (Oddly enough, my sudden interest in classical music followed this recent mental rejection of several personal limitations -- I can't help but wonder if there's a connection.)

Don't accept your limitations, reject them. Treat every limitation like the rung on a ladder -- if you don't pull yourself above each one, you're never going to get anywhere!

Boycotting Comcast

This post started as a draft, sitting among 33 other drafts for a couple of months collecting dust in my WordPress dashboard (yes, I'm one of those type of bloggers). The original title of the post was "Sorry Speakeasy" and my intention was to finish writing the post after I canceled my Speakeasy Internet service at my house in Lowell and switched to Comcast. I was going to write about how awesome Comcast was because of their price, insane download speeds, and simplicity (generally no need to worry about old phone wires or paying for a separate land-line phone line, etc). I was going to write about how you can get basic cable TV plus high-speed Internet for less than the price of a single DSL line.

Well screw Comcast. Everything is different now. The title of this post has gone from "Sorry Speakeasy" to "Boycotting Comcast", and not without good reason. A few months ago I read in the news that Comcast was throttling BitTorrent traffic. Being someone who occasionally uses BitTorrent for legitimate reasons, I decided to run a few tests of my own. Sure enough, my entire cable connection crapped out for 20 minutes after downloading something over BitTorrent, sometimes to the point where a 56k dial-up connection would have been more responsive. A few weeks later I read an article about how Comcast was not only limiting BitTorrent traffic, but that it was using the same techniques communist China uses to monitor and control the Internet traffic for its 1.3 billion citizens. This was unacceptable, and from a legal standpoint, I believe entirely against the law (read HiThere's Slashdot comment here).

Speakeasy DSL has been nothing but good to me. They have awesome, educated technical service (much like LiquidWeb's technical service), and their prices are fairly decent. I had a Speakeasy OneLink DSL line at my house in Lowell, along with the $35 VOIP service, which is assigned my old cell number (the one I give out to everyone). I have it setup to forward all calls to my real cell number, so everyone can still reach me. If I ever want to stop receiving calls at that number and start using a new number, I can do it within a matter of minutes. After this ordeal with Comcast, I decided to transfer my OneLink DSL and VOIP service to my apartment in Cambridge. Sure enough, I was able to keep my 978 area code VOIP number, even though the service was in a 617 location.

I'm paying $56 a month for a 1.5/384 Speakeasy OneLink DSL line (which doesn't require a separate land-line!). I ran speed tests using both Speakeasy's speed test and SpeedTest.net and received identical results. Sure, its not nearly as fast as Comcast, but it is a consistent, never-fluctuating-just-because-I'm-using-some-suspicious-protocol speed:

Download Speed: 1312 kbps (164 KB/sec transfer rate)
Upload Speed: 326 kbps (40.8 KB/sec transfer rate)

Any time of the day (or night), regardless of how much of the bandwidth I've been using, that speed never changes. I've downloaded over 50GB of data over BitTorrent since the Speakeasy DSL line was installed and I haven't experienced any slowdowns at all. If I'm paying money for my Internet service, thats how it should be.

I'm officially boycotting Comcast, and since I don't watch TV, it's an easy thing for me to do.

Coding to Classical Music

I have gained a sudden interest in classical music! It's strange because classical music is nothing 'new' to me. Growing up, I would constantly hear classical music playing in the retail stores my parents owned. My mom would often listen to it in the car during our long commutes between the different stores (sometimes the entire day would be spent delivering product to the different stores). I eventually grew a strong distaste for classical music and found it very annoying after only a few minutes. It was always very difficult to concentrate while listening to it.

Today I randomly started listening to a classical music station after becoming frustrated about not being able to decide what kind of music I wanted to listen to (Internet radio). Although I am not entirely sure where the interest is coming from, for the first time (at least as far as I can remember), I loved what I was hearing. It was music to my ears (pardon the pun)!

Now I've been listening to classical music for the past 9 hours and it's simply amazing. It doesn't randomly cause me lose my train of thought while I'm in the middle of coding and there are so many variations that becoming repetitive and boring seems impossible. I have read programmer polls where the majority of programmers stated they listened to classical music while programming, and I've read articles about how listening to classical music while studying can help you retain information. Until now, I've never been able to understand how that was. I have tried coding to classical music in the past but quickly found it distracting.

I don't know what flipped the switch, but I think I've finally discovered the calming and concentration-enhancing effects of classical music!

slGrid: Edit Mode without Add or Delete

I've been customizing slGrid for an application I'm developing at work. One of the things I needed to do was to enable the MODE_EDIT but at the same time prevent additions or deletions.

To prevent deletions, there is an option in /classes/gridclass.php called $editmode_delete, which you can simply set to false to prevent deletions and remove the 'Delete' column. However, this creates another problem: While editing a row, the 'Delete' button and the 'Cancel' button share the same column:

So by disabling deletions, we're giving up our 'Cancel' button. This means the only way to get out of edit mode after clicking the 'Edit' button, is to refresh the page. OK, so thats not the end of the world. Lets continue.

Our next problem is insertions -- we need to prevent users from adding new rows. I saw the $editmode_add option in /classes/gridclass.php, and assumed it would be as simple as changing it to false. But to my surprise, that only removed the 'Add' button, leaving the entire (empty) insertion row at the top of the table:

Well that doesn't make any sense. If there is an option to disable insertions, why leave the unused empty row? After lots of digging I finally found the block of code that needs to be commented/removed to prevent the empty row from loading:

gridclass.php:

						if ($this->mode == MODE_EDIT)
			{
				$insert_row = array();
				$row_index = -1;

				foreach ($this->columns as $column)
					$insert_row[$column->name] = "";

				$this->CreateRow($insert_row, $row_index, $visible_row_index, $table_main);
				$row_index++;
			}

After commenting out that block of code, I finally have what I want; slGrid in Edit Mode without the ability to Add or Delete:

I'm going to be working with slGrid a lot now and I'll be tweaking/customizing it quite a bit. I will be sure to share everything I learn here on my blog for others who may wish to use it.

But I never looked at the sun…

You know how when you look at the sun, or another bright light source, and then look away, everything you look at has a big bright spot that prevents you from seeing the details of what you are looking at? Well that happened to me today while reading an article on my laptop. The strange thing was, I never looked at the sun or any other "bright light source". I looked out the office window at brightly lit buildings, trees, and a clear blue sky, but the sun is on the other side of the building and not at all visible from the office.

It was quite disorienting, this fluctuating prism point of light that prevented me from even reading the text on the screen. My peripheral vision was fine and I could see the text directly to the left and right of where I was looking, but that wasn't very helpful -- I couldn't concentrate. I tried closing my eyes, flexing them by looking all the way to the left and right, and looking in the mirror to see if there was anything odd in my eyes. Nothing helped, and besides feeling a little dizzy when I got out of my chair, nothing else was wrong physically.

After about 10 minutes, the bright spot got bigger and moved slightly to the left. Now I could see the text I was looking at but there was this huge L shaped blurry spot everywhere I looked. Another 10 minutes went by, and the blurry spot moved further to the left and increased in size, eventually moving entirely out of my vision. By this time, I realized I had a bad headache and decided to do some quick Googling to see if I could learn anything about what I just experienced.

Apparently, those symptoms point to a sinus infection or other flu/sickness. This makes sense, since I have been battling a never ending cough for about a month now. The recommendation? Lots of sleep, water, and no stress. What have I been doing for the past month? I have been getting very little sleep, drinking lots of coffee to stay awake (caffeine results in dehydration), and trying to meet deadlines at work.

But no excuses. I am healthy, I have always been healthy, and I always will be healthy. Life is Good.

Brrrr… cold!

Last night I took out the fans and closed my windows for the first time since I've moved into my new apartment. I love fresh air, but last night was just too cold! Aside from when someone lights up a smoke on the sidewalk, the fresh air has been a huge relief over the no-air-or-sunlight basement apartment I moved out of.

My hands and feet must not have good blood circulation because as soon as the temperature drops below 50, they feel as if they're encased in ice-gloves that never melt -- impossible to warm.

Installing the Eclipse SQL Explorer Plugin on Mac OS X

There is a great plugin for Eclipse called SQL Explorer, which "is a thin SQL client that allows you to query and browse any JDBC compliant database". I have a local LAMP (or in this case, MAMP) environment setup on my Mac for development purposes. Up until now I have been using phpMyAdmin through an external web browser to view/edit the MySQL database (Eclipse's built-in web browser sucks -- I cannot even copy/paste from it!). Since I do everything else from within Eclipse, moving outside the Eclipse window just to view tables/data in the database really interrupts my work-flow (not to mention the distractions that come with using a web browser 😉 ).

SQL Explorer is really nice, once you get it working. I assumed it would be as simple as downloading the plugin and creating the connection to my local MySQL database -- but that didn't work. You can download and manually install the plugin, but choose to use the built-in Eclipse Install and Update functionality to download and install the plugin. Here is how it's done:

Download and Install Eclipse SQL Explorer Plugin

  1. From within Eclipse, choose 'Help -> Software Updates -> Find and Install' from the menus
  2. Choose the 'Search for new features to install' option and click Next
  3. Click 'New Remote Site', enter 'SQL Explorer' in the Name field and 'http://eclipsesql.sourceforge.net/' in the URL field and then click OK
  4. You should now see 'SQL Explorer' in the list of 'Sites to include in search'
  5. Uncheck everything except 'SQL Explorer' and click Finish
  6. A new screen should open which allows you to select 'SQL Explorer'. After selecting it, click Next

The SQL Explorer plugin should now be installed and available as a new perspective. You can start using it by selecting it in the Open Perspective list (Window -> Open Perspective -> Other...). Once you have opened the SQL Explorer, you will need to add a new connection. In the Connections tab, click the 'New Connection Profile' icon or right click anywhere inside the empty list and choose it. This will open the 'Create New Connection Profile' window.

This is where there is no documentation explaining what is really needed to connect to a MySQL database. You would think it would be as simple as selecting the MySQL Driver from the list, entering your database connection information and saving the connection. But upon doing this, I received the following error:

I don't know about you, but I have definitely seen more informative error messages than com.mysql.jdbc.Driver. After a little research, I discovered that we actually need to install the MySQL JDBC driver before using SQL Explorer to connect to a MySQL database. I didn't see this information anywhere in the SQL Explorer documentation or on the website. The fact that the Create New Connection window shows me a huge list of database drivers to choose from is very misleading!

Before we add the new driver, we need to download the MySQL JDBC Connector. You will want to copy the mysql-connector-java-5.0.8-bin.jar file somewhere permanent, since the new driver we create will look for for this file whenever we connect to a MySQL database.

Download Connector and Create MySQL JDBC Driver

  1. Download the MySQL JDBC Connector, extract and save the mysql-connector-java-5.0.8-bin.jar file some place permanent (I stored it in my /Applications/Eclipse/ directory)
  2. Open the 'Create New Connection Profile' window in SQL Explorer, click the New Driver button
  3. On the 'Create New Driver' screen fill in the Name field with something like 'MySQL JDBC Driver'
  4. In the Example URL field fill in the following: jdbc:mysql://[<:3306>]/
  5. Click the Extra Class Path button
  6. Click Add and then select the mysql-connector-java-5.0.8-bin.jar file you downloaded
  7. Click the List Drivers button. This should automatically fill in the Driver Class Name field at the bottom with 'com.mysql.jdbc.Driver'

At this point, you should have a window that looks like this:

Click the OK button. This will bring you back to the 'Create New Connection Profile' window. Now you should be able to select your new 'MySQL JDBC Driver' from the list of drivers, fill in the URL field with something like 'jdbc:mysql://localhost:3306/test_database', and enter your MySQL Username and Password details (if you're using MAMP, the defaults are root/root). Click OK and then double click on the new connection in the Connections list. Assuming your MySQL database is running and the connection details are correct, you should see the Database Structure tab populate and allow you to view the contents of your database.

For those who might want to know exactly what versions of software I am using, here is the list:

Mac OS X 10.4.10 on a MacBook Pro
Eclipse 3.2.2
SQL Explorer plugin 3.0.0.2006
MySQL JDBC Connector 5.0.8

I've only started to explore the possibilities of what can be done with SQL Explorer, but I can already tell it will make my development process much smoother. I was surprised that there wasn't more readily available documentation explaining how to do what I have explained here, but hopefully someone will find this mini-tutorial useful.