Friday, January 2, 2009

My First Android App

I wrote my first application, a Tetris clone, for my new T-Mobile G1 phone. The phone runs Google's new Android operating system. A few years ago, I wrote a version of Tetris in Java, which can be found here. Android apps are also written in Java, so it didn't require significant change to adapt my game to the phone. Writing applications for Android was surprisingly easy after everything was configured. Google provides a wealth of information for getting started on writing your own Android applications.

Once you have Eclipse configured, you can easily compile and run your applications with the click of a button. When you run your application, you can choose to run it in the Android Emulator or if you have your phone plugged in via USB, you can run it directly on your phone. For the latter option, you do not need a special developer phone, you simply enable USB Debugging on your phone. Very easy!

The Android documentation is similar to the Java API reference and very easy to use. Google has also provided a number of sample programs and source code. Additionally, quite a few of the Android apps are open source. With so many free apps on the Market already, it'll be interesting to see what companies can come up with once apps are sold on the Market. However, there is still a huge market for games. With the exception of a few, most of the free games are fairly simple, and none of them take advantage of the 3D capabilities of the phone.

Feel free to download my Tetris APK. Roll the ball up to rotate blocks, then roll left and right to move blocks as they fall.

Friday, August 8, 2008

Facebook Advertising

I recently decided to try out Facebook Ads. Many people typically think of Facebook just as a social networking site and not as an advertising platform. Facebook's Ads Manager is an incredible tool that easily allows you to reach target audiences. For those interested, I am advertising my energy drink website, EnergyDrinkSource.com. I've always liked Facebook ads. (the text+graphic ads, not the skyscraper graphic ads) They blend in well with the site, but still catch your attention. Each Ad has a small image, plus a short blurb of text describing the Ad. The Ads are inviting and relevant enough that I have actually clicked on a few.

Signing up for the service was very simple. I didn't need to enter an email address or create a new username / password. I simply logged into my Facebook account and clicked the link for Advertisers. The first step was to create my advertisement. The user interface was very easy to use. It is consistent with Facebook's look and feel, which is simple yet powerful. Their liberal yet appropriate use of AJAX makes it a very painless process.

In my opinion, the best part about Facebook ads is the ability to target your users very specifically. Facebook's large user base makes it easy to narrow down your target audience. You can select from a wide variety of criteria to filter your ads:
  • Location
  • Sex
  • Age
  • Keywords
  • Education Status
  • College, Major, Degree
Keywords are very powerful. Keywords includes a user's interests, favorite music, movies, job titles, and other information on their Facebook profile. Facebook doesn't need advertising preferences from users, because they already have everything from their profile. Facebook Ads are not very expensive either. I found that the cost-per-click is similar, maybe slightly more, to running the same Ad running on Google Adwords. Since you are bidding on advertisement slots, this will vary greatly depending on how many other advertisers are trying to reach the same audience.

One minor annoyance is Facebook minimum daily cap of $5 on advertising. This means that you could be charged up to $5 per day while your ad is running and you cannot lower this amount. For small businesses, this could add up to $1,825 per year, which is a lot to spend on Facebook Ads. Google Adwords and other platforms are very flexible in this respect and give you options to decide how quickly you wish to spend your budget. (immediately vs. evenly) Fortunately, Facebook Ads allows you to narrow down your audience to receive less clicks. You can choose CPC (cost per click) or CPM (cost per 1000 impressions). Compared to other platforms, Facebook doesn't offer many features beyond targeting your audience. Still, I highly recommend trying out Facebook Ads if you currently advertise online. It can result in high conversion rates since you are able to choose exactly who can see your ad.

Friday, August 1, 2008

Windows Server 2003

Windows Server 2003 is an expensive operating system, about $500 depending on the version. Being a college student, I found that I was able to obtain a free copy of Windows Server 2003 through Microsoft's DreamSpark program. They also offer Visual Studio 2008 and other Microsoft development software to students at no cost.

The operating system came on a single DVD that I was able to download and burn. The default installation runs very nicely. The OS starts up and shuts down surprisingly fast. Overall, I am pleased with the operating system. If you prefer a Windows operating system, then Windows Server 2003 is a great option even as a desktop OS. It runs very stable. It is still a Microsoft OS, but it's not XP or Vista. It is similar to Vista, but without all the problems and a cleaner user interface. It reminds me of Windows 2000 vs. XP. If you are a student, then grab a free copy through the Microsoft DreamSpark program. I am not sure that I purchase the software for my desktop computer, but it shows that Microsoft can actually create a lean, stripped down, stable operating system for servers. I did not run into any issues installing drivers or software on my custom built computer. Some software needs to be run in compatibility mode. To do this, right click on the executable you wish to run and goto Properties. Then under the Compatibility tab, select Windows XP and press OK. You should now be able to run most software that works under Windows XP.

Friday, July 25, 2008

PHP 5 Certification

I recently decided to pursue a PHP 5 Certification. I purchased the Zend PHP 5 Certification Bundle, which includes the study guide (hardcopy and downloadable PDF), 10 online practice exams, and an exam voucher. I just finished reading over the 250 page study guide. It covers a variety of PHP concepts:
  • PHP Basics
  • Functions
  • Arrays
  • Strings and Patterns (including regular expressions)
  • Web Programming
  • Object-oriented Programming
  • Object-oriented Design
  • Database Programming
  • XML and Web Services
  • Security
  • Streams and Network Programming
  • Differences Between PHP 4 and 5
After reading the guide, I took my first practice exam and scored Excellent overall. Scores are displayed as Fail, Pass, or Excellent. The website says that the practice exams are more difficult than the real exam. If you have a good working knowledge of PHP, the exam should not be too difficult. Here are some topics that you should be familiar with:
  • PHP Operators (instanceof, ===, @, etc)
  • Parsing XML documents and using SOAP services
  • Regular expressions
  • Commonly used string functions (php.net/strings)
  • Using prepared SQL statements
  • Basic design patterns
  • Classes and object oriented programming
  • Array functions (php.net/ref.array)
  • Standard PHP Library (php.net/book.spl)
    • Know Array interfaces and Autoload

In addition to these, you should know how to write secure PHP code. If you are not aware of how to do this, please stop writing PHP code. You can download the Security chapter of the PHP 5 Study Guide for free from http://www.zceguide.com. I recommend purchasing the study guide to help study for the exam. The exam expects that you use PHP often enough to recall basic functions, but it does not expect you to memorize the entire PHP manual. You should know some of the differences between PHP 4 and PHP 5. This includes different class access levels (public, private, protected and final), interfaces, and references. Overall, I feel that the certification is a good way to help determine whether or not an employee has the skills necessary to develop solid PHP applications. You can read more about it on the Zend certification website.

Friday, July 18, 2008

Coding on two computers? Get Synergy

Synergy is an open source program that enables you to use a single mouse and keyboard across multiple computers acting like a virtual KVM. This is very helpful if you have two (or more) computers next to each other. You can copy / paste between the different computers, which is very helpful for coding. One of my favorite features is that Synergy can be run on Windows, Mac, and linux operating systems. I have a computer running Slackware linux next to my Windows Server 2003 computer and Synergy makes software development much easier since I am able to use both computers as if they were one.

I can quickly test web applications on multiple web browsers with multiple operating systems. If you use Network Attached Storage or simply configure a network share between the computers, it is similar to running a dual monitor setup. If you are using dual monitors, check out my blog post about coding with dual monitors. You could even setup an audio server to integrate the computers more closely. Pretty much the only thing you cannot do is drag windows from one computer to another.

Synergy labels your different computers as screens. You need to set Screen1 to be left of Screen2 and Screen2 to be right of Screen1. If you do not do both of these, your cursor could be stuck on one monitor. You can set it so that moving your cursor to the upper right corner does not cause it to switch to the other monitor. If you want to, you could even place a screen on top of another screen. Your keyboard types on whichever monitor that your cursor is currently on. You can configure shortcut keys to switch focus or lock your cursor onto a certain screen. (useful if you play video games) Check it out at http://synergy2.sourceforge.net.

Friday, July 11, 2008

WampServer for Web Development

WampServer 2 is an open source package that includes Apache, PHP, and MySQL all in a simple, easy to setup installer for Microsoft Windows. It is ideal for web development on a Windows platform. The term WAMP is an acronym describing a common software configuration running Windows with Apache, PHP, and MySQL. You can get your Apache server up and running with PHP and MySQL within minutes. This can take hours to download, install and configure these applications individually, especially if you do not have experience with them.

WampServer installs a task tray icons that allows you to easily manage your server. You can enable and disable PHP extensions with the click of a button. It provides instant access to update your php.ini configuration file. When you are ready to restart the server, simply use the WampServer menu to restart it. For PHP developers, this saves a great deal of time.

By default, your WampServer is only available from the computer that it is installed on, but you can place your WampServer on the Internet through the WampServer menu. However, I would not recommend using WampServer in a production environment. You should have an IT manager that is responsible for managing your production server with Apache, PHP, and MySQL installations. When running a publicly accessible server, you need to ensure that you have the latest security updates on all software as well as a firewall. Even this does not make your server foolproof. You need to learn to write secure PHP code. I personally recommend running a LAMP configuration for production use. This involves running Linux with Apache, PHP, and MySQL.

WampServer is perfect for developing applications on Windows platforms and greatly reduces the hassle of configuration.

Friday, July 4, 2008

Virtual Private Servers

I just tried out a virtual private server from VPSLink. Their most basic plan gives users a server with 64 MBs ram, 2.5 GBs hard drive space and 100 GBs bandwidth per month for only $7.95 a month. This is a great deal compared to many other VPS hosting plans and there is no setup fee. A virtual private server gives you root access to your server and a unique IP address for hosting a wide array of services. This is perfect for developers or rather any linux users. It's extremely convenient to have a reliable server online that you can SSH to from anywhere. They have a nice shell applet that you can use to SSH from a web browser. There are no port restrictions so you can host anything including a web server, file server, game server or your own custom application. I was able to easily run Apache with PHP. You may wish to optimize it for your server by adjusting the number of threads in the apache.conf file.

VPSLink gives you the option to choose from a variety of different operating systems. You can reboot your virtual server almost instantly or reinstall the operating system at no additional cost if you want to try out something new. This is a great alternative to purchasing a costly dedicated server. It is also nice because you can test out your applications before upgrading to a dedicated server. The downside is that you can't run too many applications at a single time due to the memory and processing constraints, but you can upgrade at the click of a button. It is not intended as a replacement solution for a dedicated server or a high traffic service. Before spending hundreds on the best plan, consider looking into dedicated servers. Overall, they offer a cost effective VPS solution. The biggest benefit is that you essentially have root access to your virtual machine so your options are limitless. You can view their website at vpslink.com.