Archive for the ‘Programming’ Category

Ping Fire Gets a New Home

Ping Fire, a Firefox extension for Ping.fm, can now be found at http://www.pingfire.us. All new versions and announcements will be posted there.

If you’ve downloaded Ping Fire from this site in the past seven days you will want to check http://www.pingfire.us to ensure that you’re running the most recent version. 

Sunday, August 10th, 2008

Ping Fire (Beta)

Well that was quick!  The people at Ping have approved Ping Fire.  I’m going to consider the extension in beta mode as only two people have looked at it.

If you have any comments or suggestions feel free to email me or post a comment.

Installation Instructions

  1. Download and Install PingFire.
  2. Add the “Ping” button to a menu.  You can do this by going to View >> Toolbars >> Customize.
  3. Provide the extension with your Application Key.  (You can find your key by going to: http://ping.fm/key.) From within Firefox, go to Tools >> Add-Ons.  Find “Ping Fire” in the list then click the “Preferences” button. Enter your User Name and your Application Key into the fields provided then click “Ok.”

Friday, August 1st, 2008

Ping Fire Release - Almost

Ping Fire is ready for open testing.  I’ve been using it these past few days with no problems.  The download link is below.  Unfortunately, I still need to get Ping’s blessing before the application will work for anyone but me.

Installation Instructions

  1. Download and Install PingFire.
  2. Add the “Ping” button to a menu.  You can do this by going to View >> Toolbars >> Customize.
  3. Provide the extension with your Application Key.  (You can find your key by going to: http://ping.fm/key.) From within Firefox, go to Tools >> Add-Ons.  Find “Ping Fire” in the list then click the “Preferences” button. Enter your User Name and your Application Key into the fields provided then click “Ok.”

Editor’s Note: About an hour after this post the people at Ping let me know that PingFire was approved! So now everyone can use it.  Just remember that the plug-in is still in beta.

Friday, August 1st, 2008

Ping Fire Updates

What a busy few days!  I started development on Ping Fire, my first FF Extension, on Saturday afternoon. It’s late Tuesday night and I think it’s a good time to provide some updates.

PingFire is working.  You can now post using all of the different “Ping My” types (Default, Blog, MicroBlog and Status) as well as any custom triggers you have created.

You can also quote something you’re reading on the web with Ping Fire.  Simply select the text you want to quote and hit the “Ping” button.  Ping Fire will automatically copy the text you’ve selected, append the URL and add it to the message box.  All you have to do is hit the “Ok” button.

I figure this puts PingFire in an un-official Beta status.  The status is still un-official since I haven’t gotten PingFire approved yet.  I submitted the stripped down version on Monday night so I’m hoping that it’ll get approved soon.  I’m also hoping that I don’t have to go through another submission round to get all of the new features I approved.

In the grand scheme of Firefox Extensions, PingFire is relatively simple but I’m still proud of how far I’ve come since Saturday.  When I started this project I knew some Javascript, knew some XML and I had never heard of XUL. Now it’s three days later and I’m still by no means a pro but I think that I’ve come a long way. I hope everyone enjoys the extension as much as I enjoyed developing it.

Tuesday, July 29th, 2008

Ping Fire - A Firefox Extension for Ping.fm

Often times I will be reading Twitter, Pownce, etc and will want to post something. So I have to navigate to Ping and write my post. This is tiresome for me because that means I have to open another tab when I already some many open. Enter Ping Fire.

Ping Fire will a Firefox extension that allows a user to post a Ping without having to be on their Ping.fm Dashboard.

Initially, the only thing the extension will allow you to do is post to Ping. I will add new features as I find a new or when someone requests a feature that I feel will be useful.

The extension is still in the beginning phase.  I have the extension running in Firefox along with most of the necessary windows and Javascript.  I’m still waiting on my API key from Ping.fm before I can work on the rest of it.

If you’d like to make a feature request add a comment here.

Sunday, July 27th, 2008

A Reflective toString Method for Java

Often times I find the debugger to onerous for viewing DAOs. They usually contain lots, and lots of attributes and viewing those attributes is tedious, at least in my opinion. I prefer looking at them as text output. With text I can quickly scan through them or copy them or do any number of other things. With the debugger, their values reside strictly in the debugger.

My first reaction has been to create a toString method. This works rather well but it too is tedious. So I’ve created a toString method that uses reflection to create the output. The code for this method is located at the bottom of this post.

Some things to note:

  • This code has been created for my own use. Therefore you won’t have some of the objects I reference.
  • This code is free for all uses. If you’d like to use it commercially or for your own pet projects feel free to do so. Although I wouldn’t mind a mention (or a link) in the Javadoc or on the application’s web page if you see fit to do so.
  • This code is by no means feature complete. For example, I imagine it could be recursive so that when an object is encountered, this method is called instead of the Object’s toString method.
  • I also notice that my escape characters are no longer escaped. This means that you’ll have to add your own backslashes.
  • This code uses StringBuffer when StringBuilder would be more appropriate.  I used StringBuffer because of constraints that were put on me when I originally developed it. (If you’re interested in the differences between these two check out: http://forum.java.sun.com/thread.jspa?threadID=652378)

The Code

    public static String toString(Object a_oToConvert)
    {

         if(a_oToConvert == null)
         {
              return "Object is null";
         }

         StringBuffer sb = new StringBuffer();

         sb.append("n");

         sb.append("t" + Util.DASHES + "n");
         sb.append("t" + a_oToConvert.getClass().getName() + "n");
         sb.append("t" + Util.DASHES + "n");

         Class cls = a_oToConvert.getClass();

         Field[] arrFields = cls.getDeclaredFields();

         for(int idxField = 0; idxField < arrFields.length; idxField++)
         {

              Field fldCurrent = arrFields[idxField];

              String sName = fldCurrent.getName();

              Object oVal = new String("---");

              char[] arrChars = sName.toCharArray();
              char[] arrMod = new char[arrChars.length];

              for(int x = 3; x < arrChars.length; x++)
              {
            	  arrMod[x - 3] = arrChars[x];
              }

              String sFirstChar = new String("" + arrMod[0]);
              arrMod[0] = sFirstChar.toUpperCase().toCharArray()[0];

              String sGetMethod = "get" + new String(arrMod).trim();

              try
              {
                   Method methGet = cls.getMethod(sGetMethod, null);

                   if(methGet != null)
                   {
                        oVal = methGet.invoke(a_oToConvert, null);
                   }

                   if(oVal == null)
                   {
                        oVal = new String("Value is null");
                   }
                   else
                   {
                        if(oVal instanceof List)
                        {
                             oVal = "List Size: " + ((List)oVal).size();
                        }
                   }

              }
              catch(NoSuchMethodException nme)
              {
                   oVal = "No such getter - " + sGetMethod + "()";
              }
              catch(IllegalAccessException iae)
              {
                   oVal = "Not public - " + sGetMethod + "()";
              }
              catch(InvocationTargetException ite)
              {
                   oVal = "ITE" + ite.getLocalizedMessage();
              }

              sb.append("t" + Util.beautify(sName, oVal.toString()) + "n");

         }

         sb.append("t" + Util.DASHES);

         return sb.toString();

    }

Monday, February 18th, 2008

A Struts Compatible OpenID Authenticator for OpenId4Java

While working on a side project of mine, I decided that I wanted to allow users to authenticate themselves using OpenId. Being a Java programmer, who is reluctant to re-invent the wheel, I immediately searched Google in hopes that someone had already created a Java library I could use. After a few moments I came across OpenId4Java. These guys created a wonderful product which made implementation a breeze. It’s also worth noting that the support is pretty amazing as well.

After playing around with the code a little bit, I noticed that the sample code didn’t play too well with my Struts application. So I wrapped their code into my own class OpenIdAuthenticator. This class simply wraps the logic from the sample code to make it compatible with Struts.

Feel free to use the class for any purpose - commercial, private, etc. If you so desire, please give me some credit somewhere in the Javadoc.

Sunday, January 27th, 2008

Stay Hungry

My friend Colin and I are often asked to speak at the Computer Science Career Day that our alma mater holds every year. The night before, after we’ve had a few beers and have caught up, the conversation turns to what we should talk about the next day. Every year we include the same idea: Stay Hungry.

Some students get into computer science because they think it’s a great gig, others have a passion for computers. The passionate ones are often labeled “geeks” or “nerds.” These are the people that I’m writing for. Those with passion, those who love computers, those who love to learn.

Computer Science exposes you to a broad range of topics. I was exposed to compiler design, database design, language design, AI, application programming and internet programming, just to name a few. Within each of these topics there are countless languages and perspectives and theories. One can literally spend their entire life researching computer science and still never know everything there is.

This is the beauty and the pain of computer science - computer science encompasses a vast world of topics and college skims the surface of most and delves deeply into a few. You are forced to know a limited number of things, just enough to grasp the important points of the subject matter and then you’re given a diploma and sent into the world.

You’re a graduate now and go out into the world and find a job. Often times your first job allows you work on one system, with one language, solving one particular problem. This is great for a first job. It teaches you the business world, which we all must interact with. It teaches you problem solving skills, which you probably haven’t been taught well enough in college. It gives you real world experience.

The problem is that life comes at you fast - climbing the corporate ladder, relationships, children, mortgages and so on. Soon you realize that your skill set is stagnant. The passion you had as an undergrad is gone and now you’re simply a cog in the corporate machine. Going to work, coming home, sometimes making love and plucking at gray hairs.

What happened? You forgot to stay hungry.

Remember those nights that you stayed up late trying to work out the one last bug in some application you were working on? Remember when your thirst for something new and interesting kept you reading and experimenting?

Innovation has not stopped. Computer Science is a living, breathing, mutating, evolving subject. A quick look at the world around you will prove this. Look at operating systems, mobile devices, the internet, or even the appliances in your kitchen! There is no reason to starve.

The important thing is to find something that piques your curiosity. Does AI sound interesting to you? Research it. Try to write a simple application. Are you sick of Java? Learn Ruby-On-Rails. Maybe you always loved electronics class, learn more about electronics.

Life comes at you fast. Do not go to bed 25 and wake up when you’re 50 and wonder where the hell it all went. Stay hungry.

Monday, October 15th, 2007

Wiki Tip - Aggregate Pages

Lately Wiki’s have taken over my life - my team at work uses one, I’ve started one to share content from Ars Technica’s Boardroom and I’m even tempted to install TiddlyWiki on my USB drive!

For work, I’ve been using the wiki to store my meeting notes. I take my tagged notes and then transfer the most important ones over to the wiki. Great for sharing and for the if-I-get-hit-by-a-bus scenario! The problem is that the same subject matter can span multiple meetings and I like to break up my notes by meeting. So I began searching for a way to aggregate a bunch of single pages into one gigantic one. After a lot of searching I found a way to do it, unfortunately I lost the link but I do remember the instructions.

Below you’ll find the steps needed to create an aggregate page. The examples use the Boardroom Wiki.

  1. Create a new page. This page will become the aggregate page.
  2. Find the title of the pages you wish to aggregate. To do this I normally just copy the link and take the portion of the URL after the title=. For example the title of the following link http://www.theboardroomwiki.com/index.php?title=Business_Cards is “Business_Cards.”
  3. Edit the aggregate page. Insert the following tag: {{:PAGETITLE}}. Be sure to replace “PAGETITLE” with the title of the page you’ve selected. Example: {{:Business_Cards}}.
  4. Click the save button and voila!

My main issue is that there seems to be no way to group the individual pages on the aggregate page. I would expect the aggregate page to use the title from each individual page. Unfortunately this doesn’t seem to be case. Sure I could create my own group by adding a header before each instance of the aggregate tag, but this is a pain.

Another problem I have is the manual nature of this tag. Each time I want to add a page to the aggregate page, I have to do it manually. I’m not sure what an elegant solution to this problem would look like but I’m sure there’s one out there.

Please let me know if you found this post helpful - post a comment, Digg it, or share the link with your friends.

Monday, September 10th, 2007

Ars Technica Open Forum Firefox Search Add-On

I’ve been a member of Ars Technica for over 7 years now and I’ve never been a fan of its search functionality. Tonight was the last straw so I whipped up a quick-and-dirty Firefox add-on to search the Open Forum.

Please remember this is quick-and-dirty so its features are a little limited. That being said, below is its meager feature list.

  • Automatically sets the “Site” parameter to “episteme.arstechnica.com”
  • Automatically sets the “All Words” parameter to whatever you type into the search box.

I feel the add-on lacks the following.

  • A pretty Ars Technica icon. Anyone care to donate one?
  • Advanced search features such as “Exact Phrase,” “At Least One,” and “Without.”

You can install the add-on or view its source.

If you have any comments or suggestions, please post a comment or email me.

Monday, July 23rd, 2007