about img
blogger img

UnderPaidLoveMonkis posts img

scotts posts image

Technology's Archive

Free Windows PowerShell Ebook

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

Read more

Opensolaris on OS X

Scott Rippee @ 11:17 pm Sunday, July 22nd, 2007

Due to influence from the love moneky I got up and running with Opensolaris on OS X (in parallels) this weekend. I was originally going to install it with VMServer on Gentoo, but realized that it would be much more accessible on my primary unit de computation.

opensolarisinstall.jpgI simply downloaded the 3 Opensolaris files (Nevada release), used cat to concatenate them into a single file, selected Solaris 10 in parallels, selected the image, and it installed without any hang-ups. Ahh yes, and I had to go back and change the memory allocated as it has a 768mb minimum requirement.

My motivation, hack around with zfs (screencasts) and the much talked about DTrace (Video: interview with developers).

Here are some videos with Sun talking about Solaris, zfs, dtrace, and OpenSource: video 1, video 2. I completely agree with the part about the roll of “urban planning” in complex software systems. This seems to hold true for Apple also and is evident in the high quality and user centric software/systems they produce.

DTrace will also be available on OS X Leopard and with a fancy GUI, Xray.

iPhone 1st published hack

Scott Rippee @ 9:54 pm Sunday, July 22nd, 2007

eyes1.png

A team of computer security consultants say they have found a flaw in Apple’s wildly popular iPhone that allows them to take control of the device.

The researchers, working for Independent Security Evaluators, a company that tests its clients’ computer security by hacking it, said that they could take control of iPhones through a WiFi connection or by tricking users into going to a Web site that contains malicious code. The hack, the first reported, allowed them to tap the wealth of personal information the phones contain.

article link
video link

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

The Tune Glue Graph

Scott Rippee @ 7:20 pm Wednesday, July 11th, 2007

tuneglue-screen.jpg

TuneGlue is a visual mashup of info via last.fm and amazon and is quite entertaining. Now they just need to add audio clips and figure out how to use the UI to teach csci students about graphs. =]

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.

Let there be web divisions

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

There's a excellent post by Jeff Zeldman why there should be a web division rather than having the web team fall under the IT or Marketing department.

...almost no one who makes websites works in their company or organization’s web division. That’s because almost no company or organization has a web division. And that void on the org chart is one reason we have so many bloated, unusable failures where we should be producing great user experiences.

Been there, done that. Nonetheless, excellent post, Jeff! :)

Another company into DVR market

UnderpaidLoveMonki @ 10:40 pm Monday, July 2nd, 2007

Another company making DVRs popped up, hailing from the Philippines. This company not only makes DVRs, but is even quite high tech - video analytics! Here's a sample info on this product:

Neugent Technologies said its LX8000 SmartDetect DVRs have "built-in object detection video analytics," enabling them to watch for left, abandoned, missing, or stolen objects.

Neugent's LX8000-series DVR line appears to be built from standard PC components. The LX8000-series DVRs run a Linux-based OS of an unspecified nature.

Here's more information about this product.

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.

Wireless Security with Scapy

UnderpaidLoveMonki @ 9:42 pm Tuesday, June 12th, 2007

If you're into wireless security, you should check out this tool called Scapy (written in Python) and also read this informative article.

Scaling with RAID?

UnderpaidLoveMonki @ 7:06 pm Tuesday, June 12th, 2007

If you're into enterprise systems that involve RAID, here's a blog entry you should read on the advantages and disadvantages of using RAID when scaling. Take it for what it's worth. :)

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!