Tech Tips

Tech Tips, Web Development/Programming

Browsers, browsers, browsers!

Nerds of the world: rejoice! The browser wars are ablaze for the first time in over a decade. Microsoft, Mozilla, Google, Apple, and Opera are duking it out, feature-for-feature and there’s no clear winner. For the record, I don’t want anyone to win because competition makes software better since developers have to work hard to keep and maintain their market share. While the four major players volley for our affections, Netizens all over the world win! As I mentioned in a recent post, most of what we do with computers is moving to the net. Therefore, the availability of quality browsers is a big deal for techies and Luddites alike.

The First Browser Wars

The First Browser Wars ended around 1997 with the release of Internet Explorer 5. At the time, there was IE, Netscape, and (to a much lesser extent) Opera. When Microsoft decided to unload its war chest in 1995 with the intent of destroying Netscape, it was a matter of time before the boys of Redmond stomped Netscape into the ground. In the span of 2 and a half years, the battle was over.

In 1997, I was just learning how to make web pages. I couldn’t have been happier that Internet Explorer was the winner since that meant I didn’t have to work so hard trying to make my pages look the same on both browsers.  I still tested my sites in Netscape Communicator, but IE was the only browser I really worried about. Life as a budding web designer was good.

My happiness was ill-founded, though, because without competition, Microsoft stopped updating Internet Explorer after the release of IE 6 in September 2001. It would be seven and a half years before Balmer and company decided to release a new version. During IE 6, there were security threats uncovered at least every couple months. While it was nice having only one platform to worry about, it was frustrating and scary to have to worry about security every time you visited a page. Opera never went away during this time, but it never gained much traction in the U.S. at the end of the First Browser Wars

The Second Browser Wars and Beyond

A spunky upstart named Mozilla arose from the ashes of Netscape after Netscape’s Gecko source code was released in 2000. In 2004, Firefox 1.0 was officially released. I honestly never thought Firefox would gain as much traction as it did, but it turns out, FF 1.0 was the scout that signaled the beginning of the Second Browser Wars.

Fast forward 7 more years since FF 1.0 was released and Google has entered the market with Chrome, which shares common roots with Apple’s Safari (via the Webkit engine). It’s apparent that all are scrambling for more market share if you consider that the browser version numbers are increasing at an alarming rate. While some of the version incrementing is for marketing purposes (because we all know higher version numbers mean a better product…), the browsers really are getting better from all the vendors.  Here’s my quick breakdown of the strengths of each browser:

  • Internet Explorer 9 – Microsoft has gone out of its way to make IE safer to use for everyday surfing. It automatically checks for phishing attacks, warns users if it detects so much as a mouse fart on a website, and integrates with MS Security Essentials. While it’ll take awhile to shed its reputation as the insecure kid on the block, Microsoft is trying hard to prove otherwise.
  • Firefox 5 – Firefox is my favorite because of its vast library of plugins, especially plugins that make life easy for web developers. Mozilla keeps making Firefox faster and has taken an aggressive stance toward security since version 3.5.
  • Chrome 12 – Google’s brainchild is the fastest kid on the block. It’s super clean interface and seamless updating architecture has appealed to millions since its debut in late 2008. Google is showing its serious about being the one and only browser folks turn to for their Internet needs.
  • Opera 11 – The underdog of the roundup, the Scandinavian wonder invented tabbed browsing in 1996 and continues to set the bar for standards compliance, and it manages to be incredibly fast as well. The only browser found on the Wii, Opera can also be found on PCs, Macs, iPod/iPad, and mobile phones. Opera is the most hardware-agnostic of the bunch.
  • Safari  5 – Admittedly, Safari is my least favorite, however, it is by far the best mobile browser in existence, as it renders pages on the iPod Touch and iPad perfectly. Safari is what all mobile browsers should strive to be.

I hope the Second Browser Wars rage on for a long time and we, the consumers of Internet goodness, continue to reap the benefits of the battle. Unlike the First Browser Wars, the current struggle is being fought on technical merit and security. Neither Microsoft nor anyone else can crush the competition strictly with wads of money. No matter who you choose as your browser, I wish everyone happy surfing!

Microsoft Windows, Tech Tips, Web Development/Programming

Re-Register Apache and Mysql as Services After Moving Zend Server Directory to a New Computer

I recently got a new Toshiba A665-S5183X Core i7 laptop and I really love it.  The only thing about getting a new computer (especially if you’re a geek) is transferring files and settings from the old machine to the new one. I used Windows 7’s Easy Transfer to move over all the usual documents (pictures, papers, etc), and I also transferred about 15 GB of programs that are not registry dependent. One of the folders I transferred was my Zend Server CE installation. Zend Server includes the Apache Web Server as well as Mysql Server. I wanted the two installed as a service, but I didn’t want to have to reinstall, since I had customized many settings in several places in the installation and didn’t want to start over. So how hard is it to reinstall the two servers as a service? As it turns out, not hard at all.

First, open an Administrative Windows Command Prompt. The rest is as easy as follows.

Install Apache As a Service

cd into your Apache2 bin directory and type

httpd -k install -n “Zend-Apache2” -f “C:\program files (x86)\C:\Program Files (x86)\Zend\Apache2\conf\httpd.conf"

This command will install Apache 2 as a service named Zend-Apache2 in  your services.msc service control utility (where you can start/stop your Apache service). Additionally, it will tell the service to use the specified httpd.conf file (which can be anywhere you want). The service installer will even be nice enough to warn you of errors or warnings in your specified conf file.

Install Mysql As a Service

cd to your Mysql bin directory and type:

“mysqld” –install MySQL-Zend –defaults-file=”C:\Program Files (x86)\Zend\MySQL51\my.cnf”

As above, whatever the word you type after the install directive will be the name of your service in services.msc. The defaults file represents the path to your Mysql cnf file.

Happy web developing with Zend framework running as services on your new box!

Microsoft Windows, OS X, Tech Tips

Should You Buy a Mac or a PC?

In the last couple years, more and more folks have been asking me whether a Mac or a PC is the better computer. In case you don’t know, a Mac is a type of computer made by Apple, the same company that makes iPods and iPhones. A PC, on the other hand, refers to a computer that runs Microsoft Windows. When you’re standing there holding your credit card deciding which to buy, which is best?

Apple would have you believe that Macs are far superior to the old stalwart PC. You may have seen the Apple ads on TV that portray the Mac as a coolguy 30-something with all the answers. He has conversations with PC, who is a middle-aged nerd in an ill-fitting business suit that is always having problems.  According to Apple, the purchase of a new Mac will change your life forever.

Well, Apple’s claim is true in some ways, but it’s mostly marketing hype. The truth is that for 95% of computer users, all tasks they want to do can be done on either a Mac or a PC. The difference lies in how the total cost of each of the machines is spread out. Macs are great for creating audio, video, and DVDs right out of the box. It’s easy to make your own custom recordings or photo albums. Also, you don’t have to buy antivirus software for Macs. The catch to all this is that Macs cost about twice as much (or more) than a PC with the same amount of processing power, memory, and storage space.

PC owners won’t pay as much up front, but they will have to spend $400-$500 to buy software that offers features equivalent to what a Mac can do out of the box. (Some users won’t spend a dime on extra software because they will never need these capabilities.)  Then, there’s the $30-$50 per year you’ll have to spend on a good antivirus program, since Windows PCs are vulnerable to many types of viruses and other malware. PCs outshine Macs in the area of choice. For any given thing you might want to do on a PC (such as create scrapbooks), there may be 4-5 good programs to choose from for getting it done. On the other hand, a Mac might only have 1-2 programs for any given purpose. Macs and PCs can’t run the same software, so any software you want to use has to be written for one or the other.

Which Do I Think is Best?

I have used PCs for 15 years and Macs for 8 years. My personal take on it is as follows:

Buy a PC: If you favor a lot of choices, buy a PC. As for software, there still is no where near the amount of software available for Macs as PCs. Why? Apple makes up 10% of the computer market, so there aren’t as many people buying software for Macs. Therefore, more developers (the people who create computer programs) write code for PCs. I would feel guilty if I didn’t state outright that I think Windows 7 is great. It’s the best thing Microsoft has cranked out in a long time. As an example, AreoSnap and the way Libraries work allow me to get more done faster. It’s all the small touches like this that makes Windows 7 great.

On the hardware side, Apple doesn’t offer a lot of variation in hardware configuration or style. When’s the last time you saw a red or blue Macbook? Some people love the clean, white lines of a Mac. Others abhor them. Unless you buy a PC, you’re out of luck.

Buy a Mac: If you are willing to pay a little more and don’t want to worry about so many choices, a Mac is the way to go. Most of the software that’s available for the Mac is pretty high quality, as long as it always has the features you need.  Macs come with iLife, which comes with some of the best consumer-grade audio and video creation tools out there.  More and more developers are being drawn to write software for Macs, because there market share is growing very quickly (due in part to the iPod, iPad, and iPhone). Also, Macs are easier to maintain. Macs do get slower over time like PCs, however, it  takes much longer. As of now, you really don’t have to worry about viruses on a Mac, though I suspect that will change as more and more people buy Macs. The more people using a system, the more appealing it is for virus programmers to get to work.

With the Web, Who Cares?

I can’t really say a Mac or a PC is better. It all depends on what you value. Each is great in its own way. Mac vs. PC has been, is, and will be one of the biggest geek holy wars.

Most PC users I know right now are really into sharing things on sites like Facebook, Flickr, or Twitter. All this communal goodness takes place in a web browser. The sites don’t care what browser you use, and both Macs and PCs have several great browsers available. So, for most people, the choice of Mac or PC is moot. Both cost about the same in the long run, and both do a good job getting things done, howbeit in different ways. Some things are easier on a Mac and some things are easier on a PC, but you really can’t go wrong either way.

In the last couple years, more and more folks have been asking me whether a Mac or a PC is the better computer. In case you don’t know, a Mac is a type of computer made by Apple, the same company that makes iPods and iPhones. A PC, on the other hand, refers to a computer that runs Microsoft Windows. When you’re standing there holding your credit card deciding which to buy, which is best?

Apple would have you believe that Macs are far superior to the old stalwart PC. You may have seen the Apple ads on TV that portray the Mac as a coolguy 30-something with all the answers. He has conversations with PC, who is a middle-aged nerd in an ill-fitting business suit that is always having problems.  According to Apple, the purchase of a new Mac will change your life forever.

Well, Apple’s claim is true in some ways, but it’s mostly marketing hype. The truth is that for 95% of computer users, all tasks they want to do can be done on either a Mac or a PC. The difference lies in how the total cost of each of the machines is spread out. Macs are great for creating audio, video, and DVDs right out of the box. It’s easy to make your own custom recordings or photo albums. Also, you don’t have to buy antivirus software for Macs. The catch to all this is that Macs cost about twice as much (or more) than a PC with the same amount of processing power, memory, and storage space.

PC owners won’t pay as much up front, but they will have to spend $400-$500 to buy software that offers features equivalent to what a Mac can do out of the box. (Some users won’t spend a dime on extra software because they will never need these capabilities.)  Then, there’s the $30-$50 per year you’ll have to spend on a good antivirus program, since Windows PCs are vulnerable to many types of viruses and other malware. PCs outshine Macs in the area of choice. For any given thing you might want to do on a PC (such as create scrapbooks), there may be 4-5 good programs to choose from for getting it done. On the other hand, a Mac might only have 1-2 programs for any given purpose. Macs and PCs can’t run the same software, so any software you want to use has to be written for one or the other.

Which Do I Think is Best?

I have used PCs for 15 years and Macs for 8 years. My personal take on it is as follows:


Buy a PC: If you favor a lot of choices, buy a PC. As for software, there still is no where near the amount of software available for Macs as PCs. Why? Apple makes up 10% of the computer market, so there aren’t as many people buying software for Macs. Therefore, more developers (the people who create computer programs) write code for PCs. I would feel guilty if I didn’t state outright that I think Windows 7 is great. It’s the best thing Microsoft has cranked out in a long time. As an example, AreoSnap and the way Libraries work allow me to get more done faster. It’s all the small touches like this that makes Windows 7 great.

On the hardware side, Apple doesn’t offer a lot of variation in hardware configuration or style. When’s the last time you saw a red or blue Macbook? Some people love the clean, white lines of a Mac. Others abhor them. Unless you buy a PC, you’re out of luck.


Buy a Mac: If you are willing to pay a little more and don’t want to worry about so many choices, a Mac is the way to go. Most of the software that’s available for the Mac is pretty high quality, as long as it always has the features you need.  Macs come with iLife, which comes with some of the best consumer-grade audio and video creation tools out there.  More and more developers are being drawn to write software for Macs, because there market share is growing very quickly (due in part to the iPod, iPad, and iPhone). Also, Macs are easier to maintain. Macs do get slower over time like PCs, however, it  takes much longer. As of now, you really don’t have to worry about viruses on a Mac, though I suspect that will change as more and more people buy Macs. The more people using a system, the more appealing it is for virus programmers to get to work.

With the Web, Who Cares?

Most PC users I know right now are really into sharing things on sites like Facebook, Flickr, or Twitter. All this communal goodness

Microsoft Windows, Tech Tips

Right-Clicking with a Broken Right-Mouse Button

I was working on the Health Science teacher’s laptop yesterday and discovered the right mouse button on the touch pad is broken. Since the Commonwealth is broke, replacing the out-of-warranty laptop is out of the question just to enable right-clicking again. (And no, the keyboard for this laptop is devoid of a right-click button.)

I started Googling to find a utility that would simulate a right click. Come to find out, Windows 2000/XP/Vista/7 all support right-clicking using the keyboard without having to do anything special. The magic command is to simultaneously press Shift + F10 at the same time. The right-click will register wherever your mouse cursor happens to be.

Obviously, this isn’t something you’ll need to do all the time, but in a pinch with a busted mouse, this tidbit can come in very handy!

Tech Tips, Visual Basic, Web Development/Programming

Reversing a String in VB.net

The following code snippet shows how easy it is to reverse a string in Vb.net:

Dim originalString As String = "Some text here"
Dim reversedString As String = originalString.Reverse.ToArray
'reversedString now equals "ereh txet emoS"

As you can see, this is very easy to do, however, most of the examples I found online were overly complicated. So, I thought I’d post my nice easy way.  Happy coding!

Tech Tips

Free Helvetica Font Alternative

People like Paula Scher despise the classic font Helvetica, but to my untrained eyes, it is a fantastic font for clean headings. Unfortunately, the many variants of Helvetica are not free. Linotype and Adobe both have their implementations, but they cost around $25 per variant. That’s just too much to pay for a font. What to do?

Today, I was working on a project where Helvetica would have came in very handy, so I did a web search and came upon a FREE decent alternative released under the GPL by Red Had a few years ago called Liberation Sans, designed by Steve Matteson. Obviously, it’s not exactly like Helvetica, but it’s close enough to fool the average (read: non-typesetter) person. Besides, it looks a lot better than Microsoft’s ripoff Arial. Check out the sample below that shows all four variants that are available:

liberation_sans_sample

For me, this is an excellent find. Very importantly, it is released under the GPL so you can use it for anything you like, as long as you promise to allow others the rights to always use it too.

If you like Liberation Sans, click here to download it. Many thanks to Red Hat for allowing this great font to be freely used and distributed.

Tech Tips

Handbrake 0.9.4 Encoding Settings that Work with a Blackberry Curve 8310

Through a lot of trial and error, I finally figured out what video encoding settings in Handbrake 0.9.4 produce video that will play on my Blackberry Curve 8310. Here’s the settings I used to produce working video, broken down by options or the tabs in Handbrake:

  • Container
    • MP4 File
  • Picture
    • Width:320
    • Checked Keep Aspect Ratio Box will automatically set properly proportioned Height.
  • Video
    • Video Codec:MPEG-4 (FFmpeg)
    • Two-Pass Encoding box checked (to improve quality)
    • Framerate:24
    • Average Bitrate radio button checked @ 768kpbs
  • Audio
    • Audio Codec: aac (faac)
    • Mixdown: Stereo

Any options I have not listed were left to the default settings. The video produced by this is perfect quality for a screen as small as a Blackberry. I’m not a videophile, though, so your mileage may vary. As far as speed of the encoding, a 44 minute episode of  House ran through a Two-Pass encoding in about 9 minutes on this system.

Tech Tips, Web Development/Programming

Introducing Phind, a simple PHP script for finding foreign keys in MySQL tables

For years, I have wanted a way to programatically find foreign keys in MySQL tables using PHP. After a lot of thought, I have written Phind. Phind basically consists of one function getForeignKeys() whose only parameter is the table name. If that table has foreign keys, Phind returns a multidimensional array containing an index for the key as the first index, and the part of the key as the second index.

My ultimate goal is to use Phind to create a PHP CRUD generator written entirely in PHP. That’ll probably be a long way off, though. I just don’t have time to sit down and finish something like that right now.

The source code for phind is here: Simply rename the file from phind.txt to phind.php when you save it. You can also go here to see Phind in action on a table in a database on my server named ‘contacts.’ Eventually, I will add more examples to the documentation included with the phind.php file, but for now, it’s sparse. However, I’m sure there are enough PHP guys who have been looking for a way to make sense of what foreign keys are in a table and where exactly they are pointing to.

I hope this helps somebody.

Tech Tips, Web Development/Programming

How to Fix Image Resizing Problem in the Arthemia WordPress Theme

I downloaded the Free Arthemia WordPress theme the other day to use with my students’ FBLA site. I really like how the theme looks like a professional newspaper like the New York Times as wells as how easy it is to add Headline and Featured stories just by assigning a category to them.

One thing I could get working was the images that show up with the Headline and Featured stories when you add the Image custom field to an article. The images would just show up as a red x. When I tried to view them in Firefox, I got the following error:

finfo_open(): Failed to load magic database at ‘/usr/share/misc/magic’.

After poking around on the Internet for a minute, I found that there are some files that PECL finfo uses to sniff out the MIME type of files. Apparently, the files are some sort of flat file database that holds, well, MIME types.  Luckily, I extrapolated a solution after seeing a workaround on a forum. If you’re using Arthemia Free Version 2 and are having the same problem getting your images to load, here’s all you must do.

Replace lines 216-220 of the /wp-content/themes/arthemia/scripts/timthumb.php with the following code:

$file_cmd = "file -ib  \"$file\"";
exec ($file_cmd, $exec_output);
$mime_type =  $exec_output[0];

That’s it! The only other thing you have to make sure to do to get your images to resize and show up properly is to put the absolute path to the images without your domain. So, in my case, I have an image whose full path is:

http://breathittfbla.com/wp-content/uploads/2009/07/foreman.jpg

To make it work, the value for the Image custom field has to be set to:

/wp-content/uploads/2009/07/foreman.jpg

After changing those lines of code and then putting the right file path in the Custom Field, Arthemia is resizing and displaying images in Headlines and Featured Stories without issue.  I hope this helps somebody!

Tech Tips, Web Development/Programming

WordPress Meta junkies: Use Headspace2

I haven’t been a WordPress user very long, but I have found one plugin that eased a big issue with me: Good meta descriptions in WordPress posts, categories, and archives. Out of the box, WordPress isn’t really equipped o use Excerpts as the Meta Description for a post. Enter Headspace2, which allows WP authors to edit Meta Descriptions to their heart’s content.

Scroll to Top