Ruby Project Update

Tuesday, October 31, 2006 - 2:06 PM
No Comment - Post a comment

As I've mentioned in the past, I'm working on a project using ruby. Here are the line count stats as of this afternoon:

Line count for src......     305
Line count for proc..... 9
Line count for util..... 176
Line count for unit..... 235
Line count for web...... 9
Line count for misc..... 147
--------------------------------
Total................... 881


Here are the unit test stats:

Started
.............
Finished in 0.192702 seconds.

13 tests, 56 assertions, 0 failures, 0 errors

So far, so good.

 

Bookmarklet

Thursday, October 26, 2006 - 10:01 AM
No Comment - Post a comment

For the curious, here is the bookmarklet I wrote thanks largely to Google:

click here

Note: This only works right now in Firefox, but the concept would be similar for other browsers, also be sure to select some text on your page before clicking on the link. I have no error checking in place, just a prototype.

 

Learning from the web

- 9:53 AM
No Comment - Post a comment

Today I was toying with the concept of how to create a bookmarklet that would scrape a page pulling text, formatting, and photos to make a copy of the selected information on an active page. Basically a script that could be used with a web clippings type application. I have no immediate use for this, but wanted to explore the strength of bookmarklets. As I sat trying to figure out how to get this information from a page, I realized that Google Notebook does this with their Firefox extension. I was able to look at the code for their extension which is written in javascript and come up with the functionality to do this.

Learning from the web doesn't just entail doing Google searches and finding someone who tells you what to do, but it also provides wonderful examples of implemented technology on every page. What a great resource.

 

Gruff graphs

Tuesday, October 24, 2006 - 1:01 PM
No Comment - Post a comment

Gruff is a very simple graphing library for Ruby. It creates very simple, clean graphs with very little coding. I've been searching for something like this for quite sometime now.

Here is a sample graph of the hours per week logged on a project I'm working on along with 2 other employees:


Check out the Gruff sample gallery (link)


Note: Gruff is easy to install, but the required dependancies were quite tricky. I was warned on the dependancies websites that it wasn't easy, but being cocky as I am, I went ahead and ignored them and tried to figure it out myself. Many hours later, I found myself reading the instructsions found at http://rmagick.rubyforge.org/install-osx.html which then worked. One problem I ran into however was that I had to uninstall what I had already tried by running "make uninstall" from the various libraries I already tried to install :)

 

Scrybe

- 8:06 AM
No Comment - Post a comment

I read an article on Ajaxian yesterday about an online organizer. It seemed very promising. There was a nice little video of the service they will supposedly provide which looked great. The just of the service provided by Scrybe would be to have a centralized place one could hold their calendar, todos, and notes/scraps from websites. I hope they can pull it off.

Source: http://ajaxian.com/archives/scrybe-online-organiser-with-true-offline-support

 

Ruby project update

Friday, October 20, 2006 - 3:22 PM
No Comment - Post a comment

It has been a while since I've written about the Ruby project we are undertaking here. Reporting its progress has been lost in the shuffle of writing about bugs and other things.

The project is going well. We're adapting to some of the smaller things about Ruby such as adopting naming conventions (http://wiki.rubygarden.org/Ruby/page/show/RubyStyleGuide), RDoc, and most importantly unit testing. I feel we are writing very clean code right now. It seems that with Ruby you can focus more on the task at hand and proper algorithms rather than language semantics.

I'm very pleased.

 

Then again, maybe not...

Wednesday, October 18, 2006 - 4:22 PM
No Comment - Post a comment

Yesterday's post spoke about an error that I could create in the Tomcat web server. Today I was getting ready to put in a bug report to Tomcat. Now I can't recreate the error! So, perhaps it isn't a bug in Tomcat, or perhaps (and definitely more likely) it is a combination of certain environmental factors that causes Tomcat to behave as such. I'll keep an eye on it and try to discover it again.

 

Bugs, bugs, bugs

Tuesday, October 17, 2006 - 3:46 PM
No Comment - Post a comment

I've been rather silent the last few days. With good reason, I've been dealing with a crazy bug in a piece of software our group wrote. The application is 400,000 lines of code long.

Many times as I've searched for bugs in code I get to the point where I think it is 3rd party software only to be proven wrong -- that it is my software. It's always embarrassing when I make the statement that it isn't my problem, but someone else's only to be wrong. Once again, I believe the problem is elsewhere.

Here is the scenario. We have an application which makes many requests to a REST styled web service. We have many clients who run this application. We have noticed that randomly one client will get another client's response. It doesn't happen often, it isn't hardly noticeable, but it is wrong. We are using Tomcat as our web server, our web service is powered by a servlet which I believe isn't handling concurrent requests. To test this, I created a simplified version of our servlet. I pass two parameters to this service, a client id and a random string. The servlet then does a MD5 hash of that string and passes it back along with the client id and the original random string. I'm basically just doing some processing to take up a cpu cycle or two. I have a client with creates 8 different threads, each with their own client id. I then begin make a huge number of requests to the servlet and check to make sure the response's client id matches the requester's client id. It fails after about 1000 requests.

I'll keep looking through this problem and see if I can find a solution.

As a side note, I have the same "servlet" running as a ruby cgi script, it does the same thing, being ran from my same client. I'm at my 16000 request without an error...

 

RAA - Ruby Application Archive

Thursday, October 12, 2006 - 3:26 PM
No Comment - Post a comment

Once again, I feel rather sheepish about my lack of knowledge regarding a new language. I just don't know the available resources as well as I should. I spent a good bit of time this morning looking for a Ruby email parsing class. The usual search methods weren't turning up any good results and I was left contemplating writing my own. Then I stumbled onto the website RAA - Ruby Application Archive. What a wonderful site, it is a repository of ruby classes for every imaginable use. It has a great navigational system of possible libraries with sub category names -- in no time flat I was looking at a list of 14 relevant libraries. I chose to go with rubymail by Matt Armstrong.

I guess what I've learned from this is that different languages have a core set of essential resource websites that it is worth finding, bookmarking, and utilizing. This is obviously one for Ruby.

 

Writely and Google Spreadsheets -- It has been coming

Wednesday, October 11, 2006 - 8:01 AM
No Comment - Post a comment

Great idea, not too original, but extremely convenient and great implementation. They've combined two things which logically go together, but added a few things that make it nice such as the currently popular tagging notation. I like it and I'm using it.

Source: Better together: Docs & Spreadsheets

 

Yikes!!!

Monday, October 09, 2006 - 3:42 PM
No Comment - Post a comment

I've spent the better part of the day recovering from my backups. I lost my hard-drive on my work computer over the weekend. Fortunately, I'm rather meticulous about backing up my data. I'm restoring from a backup that was successfully ran at 2am Saturday morning.

Although I'm rather picky about what I backup and how often, I've ran into a few scenarios that have me rethinking my backup process. I'll blog about those issues and possible solutions once I figure out my ideal situation.

 

Ruby Application Update

Friday, October 06, 2006 - 11:40 AM
No Comment - Post a comment

We're beginning our official coding for our Ruby web app. Here is our setup:


Myself and one other employee will be working about 1 hour per day on this project and we're both quite excited.

Total lines of code so far: 76

*We chose Mod Ruby over FastCGI and Mongrel due to the fact that although this is a popular application we are running, the number of users are limited and we were curious as to how well it would work. We do have FastCGI installed in case we need to revert.

 

Krugle vs Google

Thursday, October 05, 2006 - 8:02 AM
No Comment - Post a comment

Google recently released a source code search engine (article here, search engine here.) Krugle released a source code search engine earlier this year and has an amazing product. By available features and ease of use, Krugle currently has nothing to worry about at all. However, if I were Krugle, I'd be a bit antsy. I love Google, but they have a way of dominating things. Worse yet, because of their fame they could dominate with an inferior product but a more widely recognized name.

Good luck Krugle, you're product is wonderful.

 

I want a pony

Wednesday, October 04, 2006 - 8:33 AM
No Comment - Post a comment

Today Google announced that they will be providing support for allowing their Gadgets to be added to any website. This is pretty cool really. Originally, these Gadgets were only available on Google's Personalize Homepage. Gadgets available for porting to ones own site are available here.

Interestingly enough, Google who owns Blogger won't allow you to include one in your blogging posts.

Source: Yes, you can have a pony

 

Beware the quick update

Tuesday, October 03, 2006 - 4:09 PM
No Comment - Post a comment

It is inevitable, sometime during the software development life-cycle, programmers are required to make a quick update just to get something to work that it time sensitive. The problem with these quick updates lie in the fact that due to their time sensitive nature, programmers aren't able to think up all of the possible consequences of such an update or adequately write test cases or sometimes even test.

Today I did a quick update and I'm anxiously holding my breath for the results to be in.

 

Ruby Learning Test #1: Are You There, World?

Monday, October 02, 2006 - 3:52 PM
No Comment - Post a comment

I was doing some research on unit testing with Ruby when I stumbled onto a great article. It impressed me not for the information presenting on unit testing, but rather the approach to learning a new language.

Quote:

But it was at that very moment when I asked Ruby a question and it responded with the answer that I learned more than Ruby. I knew right then that I didn't want to run the example just once. No, I wanted to preserve the example and ultimately build a Ruby knowledge base that I could draw from later. That meant the examples had to be executable and check their own results. That sounded familiar. I needed to write tests.

This is potentially quite useful. Often times, I search and search for a way to do something, do it, and forget about it until I find myself searching for it again. If when I found something I put it into a central repository, I could find it much easier in theory.

Source: Ruby Learning Test #1: Are You There, World?

 

In hindsight, it is rather humorous the time one may spend trying to learn how to do the simplest of things programmatically. While it is happening, it can be the most frustrating experience you've had.

As noted earlier, we are working on a web app here at work using Ruby. This project is going to not be using the Ruby on Rails framework. It is going to be a series of web services developed with Ruby and a few Ajax enabled web pages that call and use these services.

Prior to starting this project I worked with the Ruby MySQL module found here and determined that it was impossible to call stored procedures using it. Yesterday, I stumbled across an article from Planet MySQL showing how wrong I was, it is possible. They displayed the following code:

dbh=Mysql.init
dbh.real_connect("127.0.0.1", "root", "secret", "prod",3306,nil,Mysql::CLIENT_MULTI_RESULTS)

which fixed the problem completely. They explained:

If you try to call a stored procedure that returns a result set, you'll at first get a "procedure foo() can't return a result set in the given context error". This is because the CLIENT_MULTI_RESULTS flag is not set by default when the connection is created

Such is the frustration of learning a new language, you aren't aware of all of the little nuances that are used to make it work well.

That being said, I'm still very excited about using the Ruby language. It is going well!

 

I use the blogger template Minima. It is a very nice layout in my opinion. I have however noticed a problem with this template. Whenever I use the blockquote tag, the remainder of my blog has formatting problems. It appears as if the spacing between lines is compressed. I have a quick hack to this problem, after using a blockquote I then wrap the remainder of my post in paragraph tags. Upon doing this, the problem is fixed.

I'm sure there is a much more graceful way of fixing this problem by modifying the html of the actual template, but this is quick and easy for me, plus I don't have to remember it and do it again if I ever change templates.