about img
blogger img

scotts posts image

UnderPaidLoveMonkis posts img

Programming's Archive

The Spread Toolkit

Scott Rippee @ 11:11 pm Friday, October 12th, 2007

Spread Overview

Spread is a toolkit that provides a high performance messaging service that is resilient to faults across external or internal networks. Spread functions as a unified message bus for distributed applications, and provides highly tuned application-level multicast and group communication support. Spread services range from reliable message passing to fully ordered messages with delivery guarantees, even in case of computer failures and network partitions.

Spread is designed to encapsulate the challenging aspects of asynchronous networks and enable the construction of scalable distributed applications, allowing application builders to focus on the differentiating components of their application.

Powerful, but simple API. Only six basic calls are required to utilize Spread.

After reading the documentation this sounds really impressive. I’m going to need to play around with it to feel it out and find out if it has potential for any future projects.

Check out the platform and language support:

BSDI 4
Linux
Solaris
Irix 6.5.3 (MIPS)
AIX (powerpc)
FreeBSD (x86)
NetBSD (x86, ppc)
OpenBSD (x86)
Mac OS X (ppc)
Windows 95, 98
Windows NT, 2000, XP

C/C++ libraries with and without thread support.
Java Class to be used by applets or applications.
Perl interface.
Python interface.
Ruby interface.

Google Test Automation Conference 2007 Videos

Scott Rippee @ 9:46 pm Tuesday, August 28th, 2007

Holy Cow! 27 Videos from the Google test automation conference 2007 with so much important information that my head is spinning (and I only watched a small portion =). Automation, testing strategies, mocking, continuous integration, UI automation, complex distributed system, and many different levels and types of testing explained. These really drive the importance of quality automated testing in many different forms that really push software and systems from many different angles.

The keynote gives a good overview of overall stratagies and the importance of processes like quick build / test turnarounds and developer testing.

Linux + Java + Traffic Light Controller

UnderpaidLoveMonki @ 9:40 pm Tuesday, August 28th, 2007

What do you get when you cross Linux, Java and a traffic light controller?

Here’s the answer:

Here’s a conceptual overview of architecture:

Technical overview:

The new design’s control processor will run Sysgo’s ELinos 4.1 embedded Linux implementation, including PikeOS, Sysgo’s real-time, POSIX-compatible execution environment add-on. The Linux component will provide a browser-based management interface accessible over the network or to on-site technicians. The real-time PikeOS environment, meanwhile, will host Aonix’s PERC real-time Java component.

More information is located here.

Free Windows PowerShell Ebook

UnderpaidLoveMonki @ 6:30 pm Thursday, July 26th, 2007

Read more

git git gitti up

Scott Rippee @ 10:51 pm Tuesday, July 17th, 2007

What does git do right?

The important part of a merge is not how it handles conflicts (which need to be verified by a human anyway if they are at all interesting), but that it should meld the history together right so that you have a new solid base for future merges.

Git breaks the mould because it thinks about content, not files. It doesn’t track renames, it tracks content. And it does so at a whole-tree level. This is a radical departure from most version control systems. It doesn’t bother trying to store per-file histories; it instead stores the history at the tree level. When you perform a diff you are comparing two trees, not two files.

Time for me to take the plunge and give it a spin for my self. Darcs is also on my list to try, but I just need to see git in action first.

BTW Linus Torvalds knows your stupid and hates you.

Also see the video linked to in this post for more info on git

Accessors in Object Orientated Design

Scott Rippee @ 2:30 pm Sunday, July 8th, 2007

Don’t ask for the information you need to do the work; ask the object that has the information to do the work for you.

This article does a good job of verbalizing some of my realizations regarding data flow in OO design. link

Pick Your RoR HTML Parsing Poison

Scott Rippee @ 4:07 pm Thursday, July 5th, 2007

Ruby HTML parsing has been keeping me quite entertained frustrated lately, so I thought I'd share some thoughts. There are a couple of instance in your rails app when you'll want to parse HTML

  1. Automated functional/controller testing
  2. Screen scraping

Functional Testing

The standard method of verifying aspects of resulting HTML in your functional test is HTML::Selector. It's simple, powerful, and baked in. Agile Rails 2nd does a great job of explaining how it's used in functional tests.

RUBY:
  1. def test_add_no_name
  2.   post :add, :color => { :name => '', :hex => '#123456' }
  3.   assert_template 'add'
  4.   assert_select "div[id=errorExplanation]" do
  5.     assert_select "ul" do
  6.       assert_select "li", 'Name is not present'
  7.     end
  8.   end
  9. end

 

Scraping

Several options are available, but oh so popular is why's Hpricot. It's fast and enjoyable (although I experienced no joy while learning how to use it =) It also happens to be used in some of the other scraping/navigating libraries (WWW::Mechanize [rdoc] and scRUBYt!).

 

Some Thoughts...

So if your just concerned with testing use HTML::Selector and the built in asserts. If you have to do very basic screen scraping I would also suggest going with HTML::Selector (as long as speed is not an issue and the scraping is basic) with open-uri or curb for fetching the pages.

For more serious screen scraping bust out Hpricot and if you need to navigate pages via automation use WWW::Mechanize (Mechanize also uses Hpricot so all of that Hpricot knowledge you've absorbed is directly applicable. Mechanize is Hpricot with the ability to click). Don't worry about scRUBYt!. It's more of a pain to figure out than it's worth (but maybe I'm wrong about it. Any good examples/write-ups?).

Hpricot with CSS selector

RUBY:
  1. divs = (doc/"div[@style*='font-weight:'][text()*='$'").inner_html
  2. divs.each do |div|
  3.   if div =~ /\$[0-9]?[0-9]\.[0-9][0-9]/
  4.     self.price = div.to_s.sub('$', '')
  5.   end
  6. end

Hpricot search with XPath

RUBY:
  1. require 'hpricot'
  2. require 'open-uri'
  3. doc = Hpricot(URI.parse("http://google.com/").read)
  4.  
  5. doc.search("/html/body//p")
  6. doc.search("//p")
  7. doc.search("//p/a")
  8. doc.search("//a[@src]")
  9. doc.search("//a[@src='google.com']")

Using Mechanize to do a search on google

RUBY:
  1. require 'rubygems'
  2. require 'mechanize'
  3.  
  4. agent = WWW::Mechanize.new
  5. agent.user_agent_alias = 'Mac Safari'
  6. page = agent.get("http://www.google.com/")
  7. search_form = page.forms.with.name("f").first
  8. search_form.q = "Hello"
  9. search_results = agent.submit(search_form)
  10. puts search_results.body

Note that Hpricot lets you use a CSS method of selecting and an XPATH method. Use XPATH if you already have experience otherwise the CSS method is more intuitive.

If you go with XPATH grab the XPather firefox plugin and use it with the DOM Inspector. Also, it works with the firebug firefox plugin. I'm still in awe that it worked when I tried. :) To do this, use firebug to "inspect", choose an element, right click on the page and select "Show in XPather". XPather will open with the selected element locked and loaded.

Finally, if your a Hpricot wiz forget about HTML::Selector and put Hpricot to work for view validation in your functional tests. See this great write up, Testing your Rails views with Hpricot, which demonstrates this elegant solution.

RUBY:
  1. assert_equal "My Funky Website", tag('title')
  2. assert_equal 20, tags('div.boxout').size
  3. assert_equal 'visible', element('div#site_container').attributes['class']

 

Rails Caching

UnderpaidLoveMonki @ 2:43 pm Thursday, July 5th, 2007

If you have to deal with Rails caching, you might want to read this for some cool tricks & tips.

By doing this you get the bandwidth savings of HTTP caching, the performance boost of action caching, but without the difficult expiry code. You can avoid all the NFS related headaches of page caching, but still get most of the performance boost.

Software Engineering 101…is in session

UnderpaidLoveMonki @ 9:31 pm Wednesday, June 27th, 2007

If you write code for enterprise applications, you should view this presentation, "Code Organization Guidelines for Large Code Bases." It is presented by Juergen Hoeller, the chief architect of the Spring Framework. Though the context of the presentation is based on Spring and Java, the concepts do apply to other languages. Good stuff!

Juergen Hoeller shares his experiences working on large projects (including his role as chief architect of the Spring Framework) to provide general guidelines on Packaging and package interdependencies, Layering and module decomposition, Evolving a large code base. Juergen will also discuss how tools can play a role in enforcing architectural soundness.

Quality Fast Cheap VPS Hosting

Scott Rippee @ 10:19 pm Sunday, June 10th, 2007

I've been using for ruby on rails hosting/development and subversion hosting for over 6 months now (before they had a waiting list).

Quad processor machines, RAID1 drives, Tier-1 bandwidth and root access. Managed with a customized Xen VPS backend to ensure that your resources are protected and guaranteed.

What makes them so popular they have this wait that they continue to battle with?

Obviously the speed, but also:

  • Scalability - bring up as many new slices as needed instantly (well a few minutes for the drive to be imaged) or add more storage space to an existing slice
  • Distro choice (gentoo, ubuntu, debian, centos, fedora)
  • Full root access
  • Live backups on a daily and weekly schedule of the running instance of your slice
  • Take snapshots at any time of a running instance (very nice for after you get a slice configured)
  • Uhhh speed again (they do not and will not overbook their resources)
  • Price (you can't beat 20 bucks a month for VPS)

If your not up to par with Linux administration I wouldn't recommend this as you'll need to get your box up and running from scratch.

They've also just added DNS management to their custom rails admin section, so I can cancel my EveryDNS account. Which provided excellent DNS service by the way and for free!

Ruby on Rails commercial!

UnderpaidLoveMonki @ 9:48 pm Friday, June 8th, 2007

Quite hilarious... :)

You go, Ruby on Rails!

Pair Programming

UnderpaidLoveMonki @ 9:37 pm Tuesday, June 5th, 2007

Pair programming is an interesting concept in software development. I hear from others that it's useful; some say it's wasting company money and/or it'll decrease people's productivity. Well, here's a good read on Naresh Jain's experience with pair programming.

RoR Reserved Words

Scott Rippee @ 9:13 pm Wednesday, May 30th, 2007

The errors that occur when you use a reserved word tend to be very confusing. Things that you think are happening in your code, are actually happening somewhere in the framework. Sometimes you can look at the stack trace and see that its not going through your class, but through some framework class. If you have an error that makes no sense at all, I would check to make sure you don’t have a name that conflicts with the above list.

It would be nice to go back in time and tell myself to read this a few days pre now.

Rails app in a single executalbe??

Scott Rippee @ 7:45 pm Monday, May 28th, 2007

moab Petroglyph src wikipedia
This is quite impressive. It documents how to wrap up a whole rails app into one executalbe.

Driving this magic is RubyScript2Exe, which packages ruby scripts into executables for linux, mac, or windows. I'm sure I'll have a use for this one.

 

ruby-debug - =]

Scott Rippee @ 5:49 pm Monday, May 28th, 2007

cc by Designerdruby-debug = cool + very useful. Many have said it before and I have blissfully ignored until in a sticky situation that helped me realize I need to be able to poke and prod a little more than spitting out to the log in rails. After all poke and prod is my favorite way to learn.

It's has a simple feel, yet is powerful letting you drop into a debug shell where you can set breakpoint, move through the stack, step around, and examine variables. I was pretty hesitant about learning ruby-debug as I had thoughts of gdb in my head. I have a dislike/fright of gdb and continue to gimp around with it despite a lot of use. ruby-degub, however, is no foe.

No need to cover installing or usage here, as these fine people have created useful docs and even a screencast...

Install and use with RAILS

Common usage

Watch

Data Noise - Developers blog