Posted about 5 hours back at A Fresh Cup
Lots going on in the Rails repository lately; I smell another release soon. (And no, I don’t have insider information at this point).
- Serna Free Open Source XML Editor – Available for Windows, Linux, and OS X.
- Getting Started with ActiveScaffold – A basic introduction.
- Testing Practices Interview 7: Mike Gunderloy – Noel Rappin invited me to opine, so I did.
- by_star – ActiveRecord extension to find objects given date objects or pieces of dates. Supports searching by year, month, week, between, and more.
- Modernizr – Tool to detect support for HTML 5 and CSS 3 features so you can use them conditionally.
- Accessible Rails Apps – Rails Links, REST and JavaScript Hidden Forms – Brian Hogan suggests that the Rails team got some things wrong, and shows how to fix them.
- Rescuing Your Ruby on Rails Projects – Another interview with me, this one in InfoQ.
- sitemap_generator-plugin – Tool for building Google sitemaps in Rails applications via rake.
Posted about 7 hours back at mir.aculo.us - Home
Here are the slides from the presentation Amy and I gave at Kings of Code ‘09 in Amsterdam. Probably not too helpful without the audio, it’s mostly for those of you that attended and asked for the slides, so please enjoy Rich and Snappy Apps (No Scaling Required).
<object style="margin:0px" width="425" height="355"><param name="movie" value="http://static.slidesharecdn.com/swf/ssplayer2.swf?doc=javascriptperformancekingsofcode-090703023546-phpapp02&rel=0&stripped_title=rich-and-snappy-apps-no-scaling-required"/><param name="allowFullScreen" value="true"/><param name="allowScriptAccess" value="always"/><embed src="http://static.slidesharecdn.com/swf/ssplayer2.swf?doc=javascriptperformancekingsofcode-090703023546-phpapp02&rel=0&stripped_title=rich-and-snappy-apps-no-scaling-required" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="425" height="355"></embed></object>
You can also grab a PDF (3.4 MB).
Posted about 9 hours back at The Life Of A Radar
When you encounter the above error, it means you’re missing the ruby-openid gem. I couldn’t find anything on google that clearly stated this, so I’m posting it here as a reminder for myself and others.
Posted about 18 hours back at Ruby Inside
Anemone is a free, multi-threaded Ruby web spider framework from Chris Kite, which is useful for collecting information about websites. With Anemone you can write tasks to generate some interesting statistics on a site just by giving it the URL.
Its only dependency is Nokogiri (an HTML and XML parser). Other than that, you just need to install the gem to get started using Anemone's simple syntax which, among other things, allows you to tell it which pages to include (based on regular expressions) or define callbacks.
This example taken from Anemone's homepage prints out the URL of every page on a site:
require 'anemone'
Anemone.crawl("http://www.example.com/") do |anemone|
anemone.on_every_page do |page|
puts page.url
end
end
The bin folder in the project contains some more in-depth examples, including tasks for counting the number of unique pages on a site, the number of pages at a certain depth in a site, or a list of urls encountered. There's also a combined-task which wraps up a few of these, intended to be run as a daily cron job.
You can install Anemone as a gem or get the source from Github of course, and there's some fairly comprehensive RDoc documentation available in the source or online.
Posted about 20 hours back at Pelargir
Ignite Raleigh looks quite interesting. It’s essentilly a conference made up entirely of lightning talks. Voting is now taking place on submitted talks. The top 10 will be given on August 5th.
I submitted a talk titled 3 Secrets to Effective Nomading. Check out the description and, if you feel it’s compelling and would want to hear it, consider voting for it.
And by all means, if you have an idea for a talk, submit it!
Posted about 22 hours back at Jake Scruggs
This summer I'm revisiting my short apprenticeship at Object Mentor. I'll be posting commentary on all my posts from the summer of 2004 exactly 5 years later to the day.
Friday 7-2-04
We did use my code in the wiki conversion program. And while it was good to finish up that project, this meant we had to start working on the State Map Compiler. A program first written in 1993 in C++, then later re-written in Java in '98. No tests, very long methods, and the documentation gives lots of examples in C++ (which I don't know much about -- it seems like Java, but it most definitely is not.) The point of the program is to take in a simple statement of a 'state machine' and output source code that implements the state machine in either Java or C++. We are going to be adding a C# output option to this program.
Now, at this point, you might be wondering: 'What is a state machine?' Well, let me attempt to regurgitate the turnstile example. A turnstile has two states: Locked and Unlocked. If you try to pass through a turnstile when it's locked, you'll get quite a different response than when it is unlocked. A coin will cause a locked turnstile to become unlocked, but won't do much to an unlocked turnstile. A lot of software engineering problems can be thought of a nothing more than a dressed up turnstile with a few more states. So it's handy to have a program that takes in some information about a finite state machine and then outputs the basic code that you can build your implementation around.
Also, it's pretty interesting to be working on a compiler. Software that writes other software (that, ultimately, will be translated into byte code, and then the byte code will be translated by the virtual machine so that the real machine will know what to do -- quite a process).
Not a bad explanation of a state machine for guy who just learned about them that day: Good job distant-past-jake. I think ended up using a state machine pattern in my code submission to ThoughtWorks later that year.
I later worked on a huge java project that would generate something like 15 classes for every one written class. I soon got very tired of generated code ("Hey, why did my changes go away? Oh, it's a generated class... (next line said forlornly) Guess I better go dig through the xml pit for what to change.")
Posted about 22 hours back at Rails Envy - Home
If you want to know if your application can scale before it actually gets the traffic spike, then you need to learn how to do Load Testing. Thankfully I just released Load Testing – Part 2 of the Scaling Rails screencast series. If you haven’t seen the first video on Load Testing, you should probably start there.
Summary
In this second Load Testing Screencast we pickup where we left off with the first load testing screencast and learn how to use httperf load testing with sessions, how to automate our httperf testing using autobench, how to graph the results from autobench, and lastly we talk briefly about a few other load testing tools you might want to be aware of.
Don’t forget to subscribe to the screencast RSS feed or grab it on ITunes to avoid missing any of these episodes. FYI, These videos look great on an iPhone / iPod if you want something to watch on the go.
Posted about 24 hours back at InfoQ Personalized Feed for unregistered user - Register to upgrade!
Ruby on Rails has been around for about 5 years and in those years developers have created a lot of applications. Many of those applications were created while learning Ruby and Ruby on Rails and may not have used the best practices but yet made it into production web sites. These web applications can be problematical but a new book focused on the solution is available.
By Robert Bazinet
Posted 1 day back at InfoQ Personalized Feed for unregistered user - Register to upgrade!
Bob Frankston offers a vision of the Internet that focuses on communication and connection uninhibited by artificial barriers like carrier exclusivity, arbitrary differences in protocols, and vendor constraints. He uses stories as his organizing and presentational metaphor to share a vision of what could be, if we had free reign to follow our imagination. By Bob Frankston
Posted 1 day back at danwebb.net - Home
Just a quick note for those googling for a solution to this. Older versions of Low Pro for Protoype will be experiencing problems with behaviors in Firefox 3.5. This issue has been fixed so pick up the latest version from GitHub
An interesting upshot of this is that I found out something pretty nice which is kind of obvious but had never occurred to me before. If you create a function in a closure then that function can refer to itself because it has access to that closure’s variables. I normally use arguments.callee to get a reference to a function from within its body but there’s never really any need to do that:
(function() {
var aFunction = function() {
aFunction.thing = 47;
};
aFunction();
alert(aFunction.thing); //=> 47;
})();
Posted 1 day back at Git Ready
Stashing is a great way to pause what you’re currently working on and come back to it later. For example, if you working on that awesome, brand new feature but someone just found a bug that you need to fix. Add your changes to the index using
git add .
Or add individual files to the index, your pick. Stash your changes away with:
git stash
And boom! You’re back to your original working state. Got that bug fixed? Bring your work back with:
git stash apply
You can also do multiple layers of stashes, so make sure to use
git stash list
To check out all of your current ones. If you need to apply a stash from deeper in the stack, that’s easy too. Here’s how to apply the second stash you’ve got:
git stash apply stash@{1}
You can also easily apply the top stash on the stack by using (Thanks jamesgolick!):
git stash pop
A note with this command, it deletes that stash for good, while apply does not. You can manually delete stashes with:
git stash drop <id>
Or delete all of the stored stashes with:
git stash clear
Posted 1 day back at Git Ready
I frequently need to do this when setting up or syncing my various machines, and I seem to forget the command all the time. So let’s say you’ve got more than one branch on your remote, and you want to bring it down into your local repository as well:

Viewing information on the remote should look something like this:
$ git remote show origin
* remote origin
URL: *************
Remote branch merged with 'git pull'
while on branch master
master
Tracked remote branches
haml master
Luckily, the command syntax for this is quite simple:
git checkout --track -b
<local branch> <remote>/<tracked branch>
So in my case, I used this command:
git checkout --track -b haml origin/haml
You can also use a simpler version:
git checkout -t origin/haml
Posted 1 day back at Git Ready
This is a topic that is a constant source of confusion for many git users, basically because there’s more than one way to skin the proverbial cat. Let’s go over some of the basic commands that you’ll need to undo your work.
So, you just want to revert one file back to its original state:
git checkout <file>
One problem with this is that you may have is that a file and branch named the same. Since the checkout command is used for both reverting files and swapping out to a different branch, you’ll need to use this syntax (thanks, Norbauer)
git checkout -- <file>
If you want to throw out all of the changes you’ve been working on, there’s two ways to do that.
git checkout -f or git reset --HARD
Once these commands are run you’ll lose all of the work that isn’t committed in your directory, so make sure to take caution when using them.
Also, be aware that ‘git revert’ is not equivalent to ‘svn revert’! git-revert is used to reverse commits, something another tip will cover in the future.
Posted 1 day back at Git Ready
You just committed that awesome feature/test/bug, but something just isn’t right. Either some information isn’t filled out, the commit message is wrong, or something else is just messed up. Let’s go over what can be done to fix the associated data after the fact.
Fixing the previous commit is very simple. Just use
git commit --amend
And that will fire up the commit patch in $EDITOR for you to mess with. Simply edit the message right on the top line of the file, save, quit and you’re done.
Now let’s say you’ve got a few commits to fix, or the commit that is broken is a few commits back. This process is a little more complex, but isn’t too bad. (Thanks to Evan Phoenix for this one.)
Here’s the scenario: the last 3 commits don’t have the right username, email, or perhaps commit message. Let’s start by generating patch files for the commits:
git format-patch HEAD^^^
That will generate files in the form of 0001-commit-message that contains the commit diff and metadata. One note with the 3 caret symbols: just add one for each commit you need to go back, and be consistent! EDIT: You can also refer to past commits with the syntax HEAD~n, so for this example we’d use HEAD~3. Go ahead and edit these files so they have the proper information. Once that’s done, we’ll need to reset our repository back a few commits:
git reset --hard HEAD^^^
Now we can apply each commit to fix the information. Make sure you do it in the right order! (Usually it’s ascending)
git am < 0001...
git am < 0002...
git am < 0003...
Now if you check git log you should see the right information. If for some reason stuff got messed up, doing a
git reset --hard origin/master
will bring you back to your original changes. Once you’ve got the information fixed, you’ll need to do a force push on the repo:
git push -f
If you don’t add the -f, git will complain. WARNING! Just be aware that modifying commit messages may muck up other’s repositories and should be used with caution. In fact, other developers may flat out hate you for doing this. If it’s far back enough it’s probably a bad idea to rewrite history anyway.
If you know of any unexpected or uncovered consequences please let us know in the comments. Another tip in the future will cover fixing the actual committed files and making sure that all repos are up to date.
1 2 3 ... 364