Categories
computer personal

Rails Presentation: attachment_fu, Kropper and Mugr.com face-based services preview.

I’m giving a brief talk at tonight’s Rails meeting in Chandler at 7:00pm on what we’re doing with attachment_fu and Kropper for upcoming face-based search service mugr.com. I’ll post the slides afterwards for those who can’t make it, but you won’t get to see the Über-secret developer build unless you come 🙂

Slides: Keynote PDF

Categories
computer

Rails attachment_fu/Kropper Scaling Fix: attachment_fu_skip_resize

I recently integrated Kropper into a custom RoR application for OpenRain affiliate img surf. A fundamental flaw in the upload-save-crop-save process used by Kropper is that attachment_fu automatically scales down the image on first save to :resize_to dimensions. After the subsequent crop–which may result in a significant drop in resolution–the image is scaled back up to :resize_to dimensions: an ugly lossy operation.

The attachment_fu_skip_resize plugin gives attachment_fu the ability to temporarily bypass resizing of the full-size original image, thus allowing your final cropped photos to be of the highest quality as possible.

  1. Install the plugin.
  2. In your attachment_fu image class, add..
    attr_accessor :skip_resize
  3. Any time you want to save an image without invoking resizing on the original image..
    image.skip_resize = true
    image.save

    Thumbnails will be generated at their defined resolutions regardless of the skip_resize flag.

Categories
computer

Dynamically Generating SSL Certificates with Ruby on Rails

OpenRain had a couple projects recently need to programmatically generate private keys and SSL certificates in Ruby. To contribute back to the community, we’re releasing several small things today.

  • SSLsicle.com A simple form which does the OpenSSL grunt work and pop outs an SSL certificate ready to use with Apache (or whatever). SSLsicle uses..
  • eassl_fix A Rails plugin which patches a small but critical bug in the eassl v0.1.1643 gem which makes OpenSSL object manipulation a bit less dense. I’ve submitted a patch (included) to the author, but as of today he hasn’t applied it. (Also, props to the JumpBox guys.)

If you need to write your own code to generate SSL certificates in Rails..

  1. sudo gem install eassl
  2. Install the eassl_fix plugin
  3. Bust out a view for the user to enter the information that gets baked into the cert and then write a few lines in your controller…
    require 'eassl'
    key = Key.new
    options = {
    :country      => params[:csr][:country],
    :state        => params[:csr][:state],
    :city         => params[:csr][:city],
    :organization => params[:csr][:organization],
    :department   => params[:csr][:department],
    :common_name  => params[:csr][:common_name],
    :email        => params[:csr][:email]
    }
    name = CertificateName.new(options)
    csr = SigningRequest.new(:name => name, :key => key)
    ca = CertificateAuthority.new(:password => nil)
    cert = ca.create_certificate csr
    @pem = key.private_key.to_s
    @pem += cert.to_pem
  4. @pem.to_s will contain an unencrypted private key as well as a signed certificate suitable for deployment.
Categories
computer

Facial Search Service Coming Soon

My company recently entered into a partnership with img surf to develop Mugr.com: a facial identification/search service initially targeted at the mobile market. I’m pleased to announce that we already have the base functionality working, and are planning to deploy Mugr.com for experimentation in an invite-only beta starting in October. We’re also planning on providing a developer API and releasing some of the libraries behind the magic of our face search process later this year, which are largely implemented in Ruby.

Exciting times.

Let me know if you’re interested in playing with facial search technology as either a user or developer, and I’ll hook you up with an invite code when the time comes.

Categories
computer

Subversion For SCM Slides

I gave a presentation to Arizona’s ASULUG/PLUG yesterday on using subversion for software configuration management. Raw slides: Keynote PDF

Categories
computer

Sun Introduces Non-Native (Linux) Zone Support

The “What’s New” document for Solaris 10 8/07 states the update “..includes the tools necessary to install a CentOS 3.5 to 3.8 or Red Hat Enterprise Linux 3.5 to 3.8 inside a non-global zone. Machines running the Solaris OS in either 32-bit or 64-bit mode can execute 32-bit Linux applications.” Additionally, “DTrace can now be used in a non-global zone..” and ZFS gets even cooler. w00t.

Categories
computer music

Solaris 10 x64: Get Your Sound Card Working

When I built the $1000, 2TB file server, the on-board nVidia HD audio support of the Asus M2NPV-VM motherboard didn’t work out of the box. It’s a trivial fix using the recently open sourced OSS drivers from 4Front Technologies. (I also tested a Creative Audigy 2 PCI sound card using these drivers under Solaris 10 11/06, and the playback worked just as well.)

  1. Download the Solaris x64 .pkg.
  2. `pkgadd -d oss-solaris-v4.0-1004-i386.pkg`
  3. `osstest`. You should here the sweet sweet sound of.. umm.. sound, and the following printed on the console..

bash-3.00$ osstest
Sound subsystem and version: OSS 4.0 (build 1004/200707062145) (0x00040002)
Platform: SunOS/i86pc 5.10 Generic_118855-33

*** Scanning sound adapter #-1 ***
/dev/oss/hdaudio0/pcm0 (audio engine 0): nVidia HD Audio play-front output
Note! Device is in use (by PID 0/VMIX) but will try anyway
– Performing audio playback test…
OK OK OK
/dev/oss/hdaudio0/pcm1 (audio engine 1): nVidia HD Audio play-side output
– Performing audio playback test…
OK OK OK
/dev/oss/hdaudio0/pcm2 (audio engine 2): nVidia HD Audio play-center/LFE output
– Performing audio playback test…
OK OK OK
/dev/oss/hdaudio0/spdout0 (audio engine 3): nVidia HD Audio spdif output
– Performing audio playback test…
OK OK OK
/dev/oss/hdaudio0/pcmin0 (audio engine 4): nVidia HD Audio record input
– Skipping input only device

*** All tests completed OK ***

Categories
computer

OpenSolaris ZFS vs. Linux ext3 RAID5

Preston Says: I asked Dan McClary for a big favor recently: use his general UNIX knowledge and graduate-level statistics voodoo to produce a report highlighting performance characteristic differencess between OpenSolaris ZFS and Linux RAID5 on a common, COTS hardware platform. The following analysis is his work, reformatted to fit your screen. You may download the PDF, HTML, graphs and original TeX source here.

A Brief Comparison of I/O Performance for RAIDZ1 and RAID-5 Filesystems
Dan McClary
June 28, 2007

Introduction

The following is a description of results obtained benchmarking I/O performance for two OS/filesystem combinations running identical hardware. The hardware used in the tests is as follows:

  • Motherboard: Asus M2NPV-VM.
  • CPU: AMD Athlon 64 X2 4800+ Dual Core Processor. 2.5GHz, 2?512KB, 1GHz Bus
  • Memory: 4 x 1GB via OCZ OCZ2G8002GK DDR2-800 PC2-6400
  • Drives: 4 x 500GB Western Digital Caviar SE 16 WD5000AAKS 7200RPM 16MB Cache SATA 3.0Gb/s

The Linux/RAID-5 combination uses a stock Ubuntu Server Edition installation, running kernel 2.6.19-generic, with RAID-5 configured via mdadm and formatted ext3. The Solaris/RAID-Z1 configuration is a stock installation of Solaris Developer Express Edition with zpool managing the zfs-formatted RAID-Z1 drives. Block size for all relevant tests is 4096 bytes.

Basic I/O testing is conducted using bonnie++ (version 1.03a), tiobench (version 0.3.3-5), and a series of BASH-scripted operations. Tests focus on I/O throughput and CPU usage for operations either much larger than available memory, and very large numbers of operations on small files. All figures, unless otherwise noted, chart mean performance with 2% deviation for large-file operations and 5% for small-file operations. These bounds well-exceed the 95% confidence interval, implying a range of high significance.

Large-File Operations

In dealing sequential reads and writes, particularly of large files, the Solaris/RAID-Z1 configuration displays much higher throughput than the Ubuntu/RAID-5 combination. Latency and CPU usage, however, appear to be higher than in the Ubuntu configuration. The reasons for these disparities are not determinable from the tests concluded, though one might venture that the management algorithm used by ZFS and each systems caching policies may play a part.

picture-2.png

Figures 1, 2, and 3 summarize large-file writing performance in the bonnie++ suite. In large writes, Solaris-ZFS displays marginally higher throughput and occasionally lower CPU usage. However, the disparities are not great enough to make a strict recommendation based solely on large-file writing performance.

picture-4.png

picture-5.png

picture-6.png

picture-7.png

picture-8.png

picture-9.png

Figures 4 and 5 illustrate throughput and CPU usage while reading large files in the bonnie++ suite. Generally, results are consistent between platforms, with the Ubuntu configuration showing a slight edge when reading 15,680MB files (though with an associated drop in CPU efficiency).

tiobench results for random reads and writes given in Tables 3 and 4 show the Ubuntu/RAID-5 configuration displaying both higher throughput and greater CPU efficiency. However, these results seem somewhat questionable given the results in section §3.

picture-10.png

picture-11.png

Small-File Operations

In examining the performance of both configurations on small files, both in the bonnie++ suite and from shell-executed commands, the most obvious statement that can be made is that the Solaris configuration displays greater CPU usage. This, though, may not be indicative of poor performance. Instead, it may be the result of an aggressive caching or other kernel-level policies. A more detailed study would be required to determine both the causes and effects of this result. In each test, 102,400 files of either 8 or 4KB were created.

picture-12.png

picture-13.png

Figures 6(a)-6(c) and 7(a)-7(c) illustrate bonnie++ performance for both configurations. In contrast to the tiobench results, the Solaris configuration generally displays slightly higher throughput (on the order of 1-2MB/s) than its counterpart. However, as previously noted, CPU usage is much higher.

Finally, Tables 5-6 lists measured times as given by the standard Unix command time when measuring command execution. In these results, there are some surprises. The Ubuntu configuration performs somewhat faster when executing a large write (using the command dd). However, the Solaris configuration is much faster when dealing with 100,000 sequential 8KB files. For reference, all file creation is done via dd, copying by cp and deletion by rm.

picture-14.png

picture-15.png

Conclusions

Few overarching conclusions can be drawn from the limited results of this study. Certainly, there are situations in which the Solaris/RAID-Z1 configuration appears to outperform the Ubuntu/RAID-5 configuration. Many questions remain regarding the large discrepancy in CPU usage for small-file operations. Likewise, the Ubuntu/RAID-5 configuration appears to perform slightly better in certain situations, though not overwhelmingly so. At best, under these default configurations, one can say that overall the Solaris configuration performs no worse, and indicates that it might perform better under live operating conditions. The latter, though, is largely speculation.

Indeed, from the analyst’s point of view, both configurations show reasonable performance. The desire to deploy either configuration in an enterprise setting suggests that significant-factor studies and robust parameter designs be conducted on, if not both candidates, whichever is most likely to be deployed. These studies would provide insight into why the discrepancies in current study exist, and more importantly, achieve optimized performance in the presences of significant uncontrollable factors (e.g. variable request-load).

Preston Says: Thanks for the outstanding work, Dan!

Categories
computer

Programming Erlang Now Shipping, v1.1 PDF Released

erlang.gif

The Pragmattic Programmers are now shipping print copies of Programming Erlang: an outstanding introduction to the interesting new Erlang language for concurrent programming. Peeps who bought the PDF can download v1.1 here.

Categories
computer music personal

Lala.com Review: Legal Web 2.0 Music Trading

lala.gifLala.com is an online service for trading physical discs. After entering information on your current CD collection, what CDs you want, and receiving a free shipping kit of envelops and plastic disc carriers via postal mail, you simply start sending discs out as they are requested. Other users do the same, and the system handles the logistics and billing. You may start sending out CDs as soon as you receive the shipping kit to build trading credits, even if you do not yet have discs in your want list. Your credit card is automatically charged a total of $1.75 per CD you receive on a monthly basis.

I’ve been using it for months now and over 20 trades, and am pleased to report near complete success. On one occasion I did not receive a disc, but this was easy to report. I was never billed for the missing disc and never had to deal with the supposed sender personally. Overall I’ve had a pleasant experience and would recommend it to anyone looking to trade CDs with a minimum of hassle.

Props to lala for a great, legal idea!