-


By Cary Dunn / 0 CommentsI recently gave typeface.js a try and I'm addicted. Compatibility (notably with the iPhone), ease of use, lightweight, completely javascript/canvas based are just some of the reasons that make it a promising project.
The flow goes something like this...import the typeface.js javascript file, convert a font you love (and is licensed appropriately!) to a typeface compatible js file using their online utility or downloadable Perl script, and use the font in your CSS definitions!
I did run into one issue, which was using .otf OpenType fonts with their converter. Since .ttf conversion works well, the straighforward solution is to convert the .otf fonts to .ttf fonts and then use them with the online typeface utility.

Solution after the jump...
January 7, 2009 / typefacejs, typeface, javascript, fonts, otf, ttf, fontforge -
Auto-solved simple_captcha while developing
By Dejan Simic / 1 CommentIf you’re developing an app with the excellent simple_captcha plugin do yourself a favor and monkey patch it in config/environments/development.rb:
ActionView::Base.module_eval do def simple_captcha_field(options={}) options[:object] ? text_field(options[:object], :captcha, :value => simple_captcha_value(simple_captcha_key)) + hidden_field(options[:object], :captcha_key, {:value => options[:field_value]}) : text_field_tag(:captcha, simple_captcha_value(simple_captcha_key)) end end
-
Convert Filesize Bytes to Readable String in Javascript
By Cary Dunn / 0 Commentsfunction readablizeBytes(bytes) { var s = ['bytes', 'kb', 'MB', 'GB', 'TB', 'PB']; var e = Math.floor(Math.log(bytes)/Math.log(1024)); return (bytes/Math.pow(1024, Math.floor(e))).toFixed(2)+" "+s[e]; }
readablizeBytes(5000); // 4.88 kb
January 6, 2009 / javascript -
Converting Rails 'created_at' DateTime's to Flot Timestamps
By Cary Dunn / 0 CommentsAs far as graphing libraries go, Flot is simple, powerful, and produces quality graphs.
Graphing straight numerical data is very straightforward but there are times where you might want to graph numerical data over arbitrary periods of time. Converting timestamps from ActiveRecord to the timestamps used in Flot is as simple as...
objekt.created_at.to_time.to_i*1000
You can now pair these UTC timestamps with your data-point and input your array of tuples directly into Flot for readable time based labels.
Here is a simple example of a method I threw in a model to get a Flot compatible data string of some stat data for the object.
def get_stats_since(timeago=1.month.ago) ps = Stat.find( :all, :conditions => ["post_id = ? AND created_at > ?", self.id, timeago], :order => "created_at asc" ) stat_str = ps.inject([]) do |result, p| result << "[#{p.created_at.to_time.to_i*1000},#{(p.hit_count.blank? ? 0 : p.hit_count)}]" end "[#{stat_str.join(",")}]" end => "[[1231027849000,102204],[1231263741000,102374],[1231263746000,102454],[1231263753000,102194]]"
Flot is a pure Javascript plotting library for jQuery. It produces graphical plots of arbitrary datasets on-the-fly client-side.
January 6, 2009 / flot, jquery, rails, ruby, graphs, graph, canvas, javascript, rubyonrails -
Running MySQL on your Amazon EBS volume with RightScale
By Danny LaBare / 0 CommentsEBS (elastic block storage) is one of Amazon's newer innovations. It essentially offers the user a virtual hard drive of 1GB up to 1TB that can be mounted to any EC2 instance. There are several benefits to such a service, including replication of data (handled by Amazon) as well as the ability to snapshot a volume at any point in time and shoot it up to S3 (handled by the user). It is the latter benefit that interested me the most, and the reason it makes a lot of sense to store your db on this mounted volume.
-
Xapian Vs Sphinx in Rails
By Yuanyi Zhang / 0 CommentsXapian and Sphinx are both great open source full text searching solutions, but I'm wonder whose performance is better, Xapian has an official comparison to solr, but no sphinx, so I do it myself.
Dataset
My dataset is about 12,000 blog records like below:
class Blog < ActiveRecord::Base # Thinking sphinx indexes define_index do indexes :title indexes :description end # Acts_as_xapian indexes acts_as_xapian :texts => [ :title, :description ] ... end
January 6, 2009 / xapian, sphinx, thinkingsphinx -
Benchmarking with AutoBench
By Max Murphy / 0 CommentsYou've got a rails app, an environment to deploy to, but how do you figure out if that environment can sustain the demand that your users create?
January 6, 2009 / benchmarking, httperf, performance, tuning -
Weekly Bookmark Recap (01/04)
By ELC Team / 0 CommentsThank you to everyone out there who maintains a personal or team blog to share their knowledge and findings! Here are a few of our teams favorite bookmarks from last week.
- ImageMagick + MySQL on Fedora - Red91.com
- dehash » AS3 Papervision3D GreatWhite Flashdevelop example code « Layers Demo
- Ruby On Rails Security Guide
- Bamboo Blog - Upload progress with Nginx
- java:j2me-on-mac-osx [EscayDocuments]
- 23 Most Incredible Photoshop Tutorials :: Elite By Design
- Into the Cloud: Our 5 Favorite Online Storage Services - ReadWriteWeb
- Lightweight Webservices with Sinatra and RestClient - SlideShare
- Increase heap size in Java to prevent java.lang.OutOfMemoryError
- $ cheat git
- 20 Websites to Help You Master User Interface Design - Six Revisions
- Stumped by multiple ssh key pair on github or unfuddle? - Rex Chung - Web Strategy, Startups and Ruby on Rails
- kaourantin.net: Pixel Bender .pbj files
- SuperCal™ by bergdesign
- RESTful Service - Ajax Patterns
You can search our favorite links, bookmarks, as well as our own ELC Core content by using our new Explore feature. Check it out!
January 4, 2009 -
Tips and Tricks From a Self Proclaimed Cybernomad
By Nicholaus / 2 CommentsLast time I wrote about why I think distributed development is a viable way to work. Now I'm going to write about why it's an amazing way to work. Leading static lives can lead to static thinking. Dynamic lives lead to dynamic thinking. Remote development can free you from the dregs of traffic and 'the office', but can enslave you to your home (office). If you have worked from home before, you will know exactly what I am talking about. Some days you won't even leave your house. Office work will blend with house work and the next thing you know you're whole day feels like work. Ok, so you have the good fortune of being on a high functioning distributed team (like team jetpack) and you want to take it to the next level, here is some advice for how to travel, live and work without skipping a beat or missing a meeting.
January 3, 2009 / remote, develeopment -
[Solved] rake gems:refresh_specs to fix this
$ rake gems:refresh_specs (in ./project) config.gem: Unpacked gem encrypted_strings-0.3.1 in vendor/gems has no specification file. Run 'rake gems:refresh_specs' to fix this. rake aborted! uninitialized constant Rails::Initializer::EncryptedStrings (See full trace by running task with --trace)
My vote for most circuitously unhelpful error recovery hint. Here's how to fix:
January 2, 2009 / ruby, rubyonrails, rake









Credit: Perforce.com






