Archive for the ‘Software’ Category

Firebug – The best tool any web developer can have

Posted on July 5th, 2007 in Open Source, Programming, Software | View Comments

During these past months, as I’ve been learning Rails and getting my feet more and more wet with all the integrated AJAX goodness that’s inside Rails, I’ve found it increasingly frustrating to debug erroneous AJAX code. With regular web development, most of the times you can plainly see if you have an error in your code. Sometimes the results are incorrect, or some aspect of the page is displayed wrong, and other times there’s a big, fat error page letting you know something is seriously wrong. However, with AJAX, whenever erroneous code is executed, most of the times you get nothing. The page stays the same, nothing changes, except that feeling of doom inside the pit of your stomach. Then it’s time to hit the code again, trying to see if something’s wrong.

Luckily for us, there’s a very awesome tool made to debug these types of errors quickly and efficiently. Firebug is simply a godsend for anyone who works with web development of any kind. It can help you debug your web apps so easily, this is certainly one tool that I don’t know how I lived without these past couple of years. It’s a Firefox extension, so you need the Firebox browser installed to use it, no matter if it’s on Windows, Linux or Mac. But I wonder, why the hell wouldn’t you not have Firefox installed in your computer already? That’s a no-brainer.

Firebug helps you debug HTML, CSS and JavaScript. Since it’s a browser extension, it does all the debugging right in the browser, while you’re executing your page. You don’t need to load any other tool, it’s all at the touch of your fingertips. It can be used with any programming language. I’ve used it while developing in PHP, Python with Django and, of course, Ruby on Rails. Not only can you debug the code, you can even make Firebug do some neat things, like edit the HTML, CSS or Javascript code directly in the browser to see the changes immediately, and it even has a profiler that can tell you where your site is slow.

Oh, I forgot to mention the best part of Firebug: It’s 100% free. You just have to love Open Source projects. It’s still difficult to believe that people out there can put out such a quality and life-saving tool for everyone’s use without asking for a single cent in return. That’s the beauty of Open Source. I don’t know if there are any commercial tools that do what Firebug does, but I wouldn’t trade this tool for anything.

If you’re a web developer, and haven’t heard of this awesome tool, I suggest you click the link I set above for Firebug and get it as soon as possible. Unless you like torturing yourself with debugging the old-fashioned way.

Going to the “Dark Side”

Posted on June 17th, 2007 in Open Source, Programming, Software | View Comments

It’s been ages since I last updated this blog. I’ve been pretty busy for the past month or so, ut it’s due to something that I didn’t want to do in the first place. Let me tell you a quick story about it.

Earlier this year, I convinced my boss to rewrite our current (and, admittedly, buggy) software from PHP to Ruby on Rails, which would be better suited for the job at hand. Since the boss wants everything to be done fast, good and cheap, obliterating the Project Triangle, then I thought that Rails would do well. I could complete the rewriting task fast (thanks to Rails and its plugins doing almost anything with ease), good (thanks to me starting to love Test-Driven Development) and cheap (less time coding and fixing bugs = more time to implement new features). It seemed like a good fit, and he agreed.

However, a few months later, he hired someone to help me with the programming and database tasks. I desperately needed help, so I agreed to this. The person he hired, a young woman with a Masters Degree in Computer Science who teaches at a local community college, then proceeded to evaluate the current system. After proposing various changes, the boss decided that since so much work needed to be done, he might as well profit out of it, so he wanted to have the program rewritten not only for our internal use, but for commercializing the program as well. His language of choice, due to recommendations from the new employee? Visual Basic.NET. Ugh.

I pleaded with him to reconsider, but his mind was set. He wanted to transfer a PHP web application into a Windows-only desktop app. And his understanding was that since Visual Basic.NET has a nice little form designer, it would be much faster to rewrite the program. I countered these points, but he didn’t want to listen to it. He wanted a Windows application he could sell, and the only programming language the other employee knew enough was Visual Basic.NET (yep, even with a Masters Degree in Computer Science, that was her strong point). I was, simply put, screwed.

I have absolutely nothing against Microsoft tools. In fact, I think they’re great. I even suggested using C# instead, as it would be a more robust platform to do this type of project. It’s simply that I think Visual Basic is something that I used in college to learn the ropes of programming, and nothing more. I ditched Visual Basic the first chance I got, immediately after I graduated from college. I hadn’t used Visual Basic for anything since late 2004. I was surely going to need some time to get up to speed in mid-2007. It’s been a while, but I’ve gotten to a point where I can program once more using this language, even if I don’t want to.

However, from my last conversations with my boss, it seems that he doesn’t want me to program much, since I had told him I was way too rusty with Visual Basic. He seems to want me to manage the entire project. I accepted, as it’s more of a challenge than to sit down and develop an application with a programming language I simply wouldn’t use if it were my project.

So, for the past couple of weeks, I’ve been getting my head into .NET programming. While I still am against choosing Visual Basic.NET as the programming language of a rather large software development project, I’ve been entertained with some things that I hadn’t used in a large-scale project with PHP. I’ve learned a lot about Continuous Integration for the automatic build and testing process. I’ve learned how to use NAnt enough to build and test my projects automatically. I’ve even learned the finer points of creating installers that will work on all systems, no matter the dependencies needed. It’s been a change of pace for me, but I’m making the best of it.

Still, I’m very disappointed in my job and this decision that was taken. My heart is with open-source and web-development projects. Sadly, I need to do that on my own time now, but most of my spare time is used learning these new tools I need for .NET development. I’m still looking for work outside of Puerto Rico (I’m 0 for 2 with companies that have contacted me after sending in my resume), so hopefully this changes soon. In any case, I’m making the best out of this situation, and at least I’m learning new things once again. But one day, I can achieve my dream and be part of a team where I know my heart is.

I wish we all could be “Dreaming In Code”

Posted on May 12th, 2007 in Computer Science, Software | View Comments

Dreaming In Code Book Cover

A couple of weeks ago, I purchased the book “Dreaming In Code” by Scott Rosenberg, after spotting it in my nearest Borders bookstore. I had read a bit about this book from Joel Spolsky’s site, and I was very interested in the process of building software that would be “revolutionary”. I was also interested in how the group of developers would work.

I finished reading the book this weekend, and I have to say that it was extremely interesting from the beginning. From the initial idea of the software to the formation of the group, to the many setbacks and would be inevitably encountered, it offered me a great inside look at the group effort in producing software. As I’m already accustomed of working on my own, I wanted to see how larger groups of talented people could (and should) work. And surprisingly enough, the same things that happen to me at work happened to the Chandler developers as well.

What surprised me about this book is the fact that it goes back in time, and mentioned many breakthrough moments of software engineering history, like the 1968 NATO Software Engineering Conference, and Douglas Engelbart’s legendary demonstration in San Francisco (called by some as “The Mother Of All Demos”).

These moments, and many others, were non-existant to me before reading this book. Anyone who has a Computer Science or Software Engineering degree should be required to read this. It’s a very important part of the history of what we do. Like any History major who needs to know about Ancient Rome and Greece, people in the software development field need to know about what happened during the infancy of computers and programming.

While the story of Chandler’s development is a great read and what attracted me to this book, it was refreshing to read about the current problems in software development today. I know that this industry is far from perfect. But the constant changes that occur on a frequent basis simply show that we’re trying to make things better. We need to remember that compared to other scientific and engineering professions, computer science / software engineering is still a baby, an extremely-young 60 year old baby.

I hope that someday things will change for the better in our industry, and the software development process can be a painless, quick one. However, I’m afraid that the way the future generation are being taught the profession, most likely the same mistakes will be repeated over and over again. Like I said, the industry – or better yet, we – are not perfect at all. But we need to learn from our past mistakes. Certainly, those who cannot remember the past are condemned to repeat it.

Digg API with Ruby (and Rails too!)

Posted on April 25th, 2007 in Programming, Ruby, Ruby On Rails, Software, Web Development | View Comments

Note: This site has changed a lot over the last year. I’m not using Rails anymore on the site, so there’s no place where I’m currently using the Digg API. However, I’ll leave this post intact, as it might help others with something similar.

If any of you readers have come in through my main site lately, you should notice that I added a little something on the sidebar. One of my favorite time-wasting activities of the day is browsing Digg. I tell you, there should be some sort of “Diggers Anonymous” for us simple-minded folk who can’t stop from visiting the site for stories many times a day!

Anyway, they recently announced the release of the Digg API, to allow any user to access the stories on the site in any way, shape or form we desire. Now, I must say that I have no real use for this. Of course, being the geek I am, I just wanted to try it out and see how I could use a simple API using Ruby, for use on my Rails site (this one). This is also made in case anyone else wants to do the same. One note, however: I’m only a Ruby / Rails beginner. I’m sure there are much better and efficient ways to do this. Since I haven’t dabbled in this too much, and “it works on my machine“, I’ll leave it as it is for now.

Just for the record, the testing and development for this code was made on my computer running Ubuntu 7.04, along with Ruby 1.8.6 (compiled by myself, not downloaded from the Ubuntu repos), RubyGems 0.9.2 and Rails 1.2.3. It should work correctly with any fairly recent version of the software mentioned above.

The Digg API is rather simplistic right now. All you need is a simple request using a URL like this:

http://services.digg.com/stories?appkey=http%3A%2F%2Fdennmart.com&type=xml&count=5

In the example above, the API is called to the ‘http://services.digg.com’ server. The parameters afterwards (in this case, ‘/stories‘) is the request. You can add more parameters for a finer-grained search.

Once the request URL is complete, you need some additional actions to add as well. The ‘appkey‘ is required, but can be anything for now. Digg isn’t generating application keys (a la eBay or other external API’s), but an appkey is required for ‘statistical purposes’, according to the documentation. The ‘type‘ is how the data is going to be returned to the app, and it can be either XML, Javascript, JSON or PHP. I use good ol’ XML for now, until I can actually play around further with the other response types. Finally, the ‘count’ action is to limit how many stories are returned. I’m only going over these options quickly, as the API documentation has much more information.

Once you figure out which request you want to make (using Mozilla Firefox can help greatly, as the XML response is nicely formatted), it’s a matter of getting that data into your Ruby or Rails app. Going back to the ol’ trusty Pickaxe book, I found a nice little module integrated in Ruby called open-uri. This module allows the Ruby application to open a URL (either http, https or ftp) and get the returned contents. To use this module, a simple line of code is needed:

require 'open-uri'

That should load your module correctly. Now it’s just a matter of having Ruby open the API connection and store its XML response in a variable:

response = open('http://services.digg.com/stories/popular?appkey=http%3A%2F%2Fdennmart.com&type=xml&count=5').read

The ‘open‘ function, well, opens the connection to the API, while the ‘read‘ method gets the data that’s returned from the URL. Like I said, rather simple.

However, I was getting timeout errors when calling the ‘open’ function. Strangely enough, the function worked fine when using any other URL. Upon further reading of the API documentation, I found this little tidbit:

“All API requests must include a User-Agent HTTP Header. A request without this header will receive no response.”

So, after that small mistake, I edited the request like so:

response = open('http://services.digg.com/stories/popular?appkey=http%3A%2F%2Fdennmart.com&type=xml&count=5', 'User-Agent' => 'Ruby/1.8.6').read

The ‘User-Agent‘ parameter can be anything. I just decided to use the Ruby version I have. Once I added that, I had my nice XML with the five most recent Digg stories that have been promoted to the front page.

After that, I needed to parse that XML. I searched around the Internet, and found a great little module called ‘XmlSimple‘. This module reads and writes XML, and formats it according to whatever’s needed. In my case, I needed to read the XML response. Just like the ‘open-url’ module previously, you need to load the ‘XmlSimple’ module as well, once installed (“gem install xml-simple“):

require 'xmlsimple'

I did run into some minor problems when loading this module. The Ruby interpreter cried out loud, saying it couldn’t load the module. How come? I verified that the gem was installed correctly, and it was. Then I realized that since this is a gem, I need to have ‘RubyGems‘ loaded before loading ‘xmlsimple’:

require 'rubygems'

I believe that Rails already loads the module for you. But if you’re testing this out on Ruby and not on Rails, you’ll need it.

Okay, once I did that, I was able to load the ‘xmlsimple’ module. Now I need it to parse the XML response that I stored in the aptly-named ‘response‘ variable. A simple line of code can convert the XML into a hash:

XmlSimple.xml_in(response)

That takes the entire XML string and puts it into a neatly organized hash. I really don’t need everything in the hash, just the story title, link and how many diggs the story has. So I just access those particular keys:

digg_hash = XmlSimple.xml_in(response)
story_title = digg_hash['story'][0]['title']
story_link = digg_hash['story'][0]['link']
story_diggs = digg_hash['story'][0]['diggs']

In the example above, the ‘story_title‘ variable has the most recent story title, the ‘story_link‘ is the link that takes you directly to the story, and the ‘story_diggs‘ has the current amount of diggs that story has. The number zero used in the array is the story number. If you want to get more than one, you’ll need to loop through the array and get the other stories.

The code I’m using on the main site right now is the following:

<%
  require 'open-uri'
  require 'rubygems'
  require 'xmlsimple'

  response = open('http://services.digg.com/stories/popular?appkey=http%3A%2F%2Fdennmart.com&type=xml&count=5', 'User-Agent' => 'Ruby/1.8.6').read
  articles = 0
  while articles < 5
%>

(Dugg <%= XmlSimple.xml_in(response)['story'][articles]['diggs'] %> times)
<% articles += 1 end %>

In all, this was rather simple, and I’m sure there will be a much more creative use for the Digg API soon. But for those who want to learn how to use it, or those who need a very simple approach, this works just fine. I’m interested in listening on how other people have put this to use. Hope this helps someone!

All the porn you want! (Not really)

Posted on March 2nd, 2007 in Software | View Comments

Note: I noticed that this is the most-viewed in all my blog, thanks to this appearing in Google search results when people search for “Puerto Rican Porn”. Sadly to say, there is absolutely no porn on this site, so if that was your reason of coming here, you’ll be disappointed. However, if you do enjoy reading about technology, feel free to browse any of my recent posts.

Wow, I really can’t believe that this past week, my little ol’ blog has been bombarded with tons of spam comments. And this is a blog that barely has any readers at all. I can only imagine the amount of spam the more popular blogs on the Internet. Really, I don’t want to know where I can get she-male porn videos, or female ejaculation pictures. I’m not an avid pornographer, and rarely scour the Web for that stuff (note that I said ‘rarely‘ – at least I’m honest). But if I’m feeling a bit freaky, I’ll know where to go. It’s not like that stuff is totally hidden.

Anyway, I wanted to mention the Akismet Plugin that’s currently included in all WordPress installations by default. After I got the first couple of spam messages, I decided it was time to activate the plugin to see how it works. After a couple of days, the plugin has captured more than 30 spam comments, and none have gone through. Pretty good job, if you ask me.

So, if you have a WordPress blog, I really advise on activing the plugin. It only takes a few minutes, and you’ll be grateful once you stop getting offers for bestiality flicks. If you don’t use WordPress, Akismet makes plugins for more than 20 different platforms, so you can check if your application is supported. It’s really a great plugin that should be activated by default on any blog or CMS app.

Too bad it can’t all be Rails

Posted on February 22nd, 2007 in Ruby On Rails, Software | View Comments

I finally finished the minor remodeling of my personal page, as I transferred the old, plain HTML files to Ruby on Rails. It didn’t take too long, since the site is all static (for the time being). Just in case you’re wondering, I moved everything to Rails mostly because I was tired of having to make a change to a menu, and I had to change every single HTML file. Not anymore. Although this apparently is the only benefit I’ve gained, I’m planning on adding many more things in the future (using Rails, of course).

Anyway, I was explaining what I was doing to the website to a co-worker. Although he doesn’t understand much about programming, he did seem to understand the whole Rails thing. So he asked me if the blog was also made with Rails. I told him no, it was using WordPress, which runs on PHP. SO his next question was a natural one: Why don’t you use a Rails blog?

I’m sure some people who visit this site will ask the same thing. I have a couple of answers to this. I had tried to use Typo previously on this site, but rapidly removed it and started using WordPress. First off, the web hosting company I’m using isn’t the fastest or most reliable host around for Rails applications. So Typo felt damn slow, probably due to the amount of memory it needs to run. I know there’s other blogging software built on Rails, but I haven’t had time to review them thouroughly yet, and I don’t seem to think they’re good for what I want.

Besides the slow speed, Typo hasn’t been updated in quite a while. The last update was in August of last year. Now that normally wouldn’t be a problem. But I think that at the very rapid pace Rails is evolving, most Rails developers need to keep up with this pace. Granted, that’s not always possible. But with all the new additions Rails gets with each release, I’m sure Typo and other Rails software could greatly benefit from those changes.

So for the time being, I’ll stick with WordPress. It’s relatively fast and stable, and very easy to manage. Can’t ask for more. Maybe in the future Typo will be updated, or I’ll switch hosting companies and find Typo to be great, or maybe there’s some blogging software out there built on Rails that can solve this minor dilemma for me. For now, it’s too bad all my site can’t be built on Rails.

Brand-Spankin’ New WordPress!

Posted on February 21st, 2007 in Software | View Comments

A new version of WordPress, the awesome blogging software used to power this very blog (and millions more out there, as well) is out!. It’s actually just a bug-fix release, but it’s still news, isn’t it? This will be a quickie post, just to let you people know how things have gone with this upgrade.

To tell you the truth, I didn’t think it would be so easy upgrading this software. But it’s basically all in one step, if you don’t count backing up your data. This is very important whenever you do a software upgrade. All I did was back up my original WordPress installation folder on the hosting server, and backed up the MySQL database as well. I won’t go into specifics, as I don’t want to make this post too technical. Also, as a precaution, please de-activate all of your currently activated plugins. This is not necessary, but it’s nice to do this, just in case one of your plugins is incompatible with the current version of WordPress, possibly breaking your installation.

Afterwards, I downloaded the new WordPress release, decompressed it, and copied over my old installation directory. Then, all you need to do it go to a special upgrade page in your site (http://your.domain.com/wordpress/wp-admin/upgrade.php, where http://your.domain.com is your domain name (obviously) and http://your.domain.com/wordpress is the main page of your blog. A screen will appear, asking you if you want to go into the upgrade process. Click on the ‘Upgrade’ link, and that’s it! I thought it would be a long, drawn-out process, but it wasn’t. You canj then visit your shiny-new blog! Actually, it’s not that shiny, since it’ll be basically the same. But I’m sure you’ll feel comfortable knowing your blog is running the latest software,, with (hopefully) less bugs and insecurities as before, right?

All of these instructions can be found at the WordPress website. So why did I bother to post this? I guess I wanted to let you all know that this is an easy upgrade, and that I’m up-to-date!

Edit: Seems like a hacker got into the previous WordPress release, and modified some files to allow remote code execution. Just in case, if you have WordPress 2.1.1 installed in your site, there are chances that you have one of these “infected” releases, and should seriously upgrade to WordPress 2.1.2 now.

Be ready for Intype

Posted on February 16th, 2007 in Programming, Ruby On Rails, Software, Web Development | View Comments

Last year, after a friend of mine lent me here Macbook for a week (I want one for myself so bad!), I discovered the most amazing programming software I had ever found, called TextMate. I’m sure many of you have heard about this program. In fact, if you have watched any of the Ruby On Rails screencasts, you know what software I’m talking about. I think it strikes a balance between simplicity and power that’s rarely seen, and that I never even thought was possible. I tell you, once you get used to their snippets function, you’ll never want to try another IDE again.

So I went off, searching for a nice alternative for Windows that would work similarly. Shockingly enough, there wasn’t any program out there that was even similar to TextMate. I thought that was pretty weird. But after doing enough searching, I found a place where some people were making a program for Windows that would basically be a TextMate-like clone for Windows. Unfortunately, the program was only in its initial phase, with no alpha released yet. Sadly, I thought this program would just die out like many other software projects I’ve seen before, never to see the light of day.

But early this year, I received an E-Mail, stating that the very first Alpha release was available for download! Giddy, I went to their site, and lo-and-behold, there it was. I would finally get to use the program known as Intype. I rarely get excited for a software release, but this was an exception.

So I tried out the program, and it worked fine. Of course, as all alpha software, it had its fair share of bugs, and most of the functionality found in other text editors was missing (more noticeably, an Undo / Redo function). Still, it showed lots of promise, and many other people in their forums shared the same excitement as I did.

After a couple of more releases, there is finally a very usable Alpha version – one with an Undo function – available right now. I’ve been using it while I’m learning Rails, and it’s helped greatly, in terms of writing code much faster. I won’t dive into specifics, as there are already a couple of reviews out there in the wild. Even though it’s an Alpha release, it’s coming along really nicely. If the project continues forward, and all the proposed features are added, this will truly be a blessing for the developers – like myself – that are stuck at work with a Windows environment.

Intype

If you have a chance, download the most recent version and give it a spin. Besides helping with bug reports, you’ll probably be pleasantly surprised at the current state of the project, and you’ll certainly be excited as to where it’s headed. Be ready.