Entries Tagged: Ruby
Converting FLAC to MP3
I recently had a few minutes to write myself a program to convert a directory of FLAC files to MP3 format. Read the article to see how I did it.
Filed in: Team Member Blog ruby, flactomp3
Quick and Easy Ruby Script
One of my goals when checking out a programming language that is new to me is to find some kind of use for it other than what I’ve read in a book. While Ruby seems to have found a niche with the Rails web framework, I was also interested in other uses for it. Believe it or not, I’ve never really learned Perl, and I’m not the greatest with shell scripts, so it’s nice to have learned enough Ruby to perform some helpful tasks.
Ruby is an interesting language. You can use it as an Object Oriented language, or you can use it more like a functional programming language. What’s really nice is that because it’s currently an interpreted language and not compiled, you can use it as a general purpose scripting language.
I’ve created a really simple script that runs as a cron job to run the ‘emerge’ program, compile the results, and email them to me. Quite helpful. The concept can be used to gather results from running anything that has output. The script is below. Even though you specify from and to addresses in the Ruby send_message() call, I found that at least with my internet provider I still needed to specify Subject, From, To, and User-Agent mail headers otherwise the mail got bounced.
require 'net/smtp'
result = `emerge -upDv world`
msg = "Subject: Packages to Emerge\r\n"
msg += "From: FromName <from@name.com>\r\n"
msg += "To: ToName<to@name.com>\r\n"
msg += "User-Agent: Ruby Mailer\r\n"
msg += result
msg += "\r\n"
Net::SMTP.start('mail.name.com') do |smtp|
smtp.send_message(msg, 'from@name.com', ['to@name.com'])
end
Filed in: Team Member Blog ruby, handy, script
RailsConf 2007
As I stated in my first post, I attended RailsConf for the first time this year. The conference was presented with the help of O’Reilly Media and Ruby Central. I thought they did a really nice job of keeping everything running smoothly. I thought the keynotes were the best part of RailsConf. There were keynotes by David Heinemeier Hansson, Avi Bryant, Ze Frank, Tim Bray, Jamis Buck and Michael Koziarski, and Dave Thomas. I found it interesting that many of the keynotes were not on the technical aspects of Rails but more on community and the evolution of software development.
Ze Frank’s keynote wasn’t even related directly to the software development field. It was more about how technology is now allowing people to express their creativity in new ways, such as through internet websites and tools. He talked about how anyone can now be an author and how that has created a huge influx of new creative material to the internet. He said people basically have three options when it comes to the authors of this new content.
1. You can ignore them.
2. You can try to control them.
3. You can shut them down.
I probably enjoyed his keynote the most because it was very, very funny and entertaining but also because it was really deep.
David Heinemeier Hansson’s keynote summerized what has happened over the last couple of years with Rails and then discussed where Rails is going with Rails 2.0. He said Rails 2.0 would focus on RESTful principles but would not be hugely different from what we have now. He also mentioned the following items that would be in 2.0 as well.
- Breakpoints will once again be working in Rails and will have some additional features such as the ability to step up and down in the strack.
- HTTP Performance will be improved using caching techniques for static files such as Javascript and CSS files.
- Query caching will be improved behind the scenes.
- There will be a mime type render that can be used in actions to render different view formats including custom ones.
- The environment.rb file will be split up and better organized.
- Migrations will be improved so the type information is not repeated over and over again in a migration.
- HTTP Authentications will be used more for computer API interactions.
- Rails will generate projects assuming they are going to use the MIT license. If you don’t want to use the MIT license for your project you will need to manually change it.
- Some functionality of Rails will be moved out to plugins based on how well it fits in with the Rails 2.0 core. Also, currently deprecated functionality will be removed.
Many of the speakers such as Dave Thomas talked about the importance of creating a great community presence around Rails and improving the image of the Rails community in the eyes of the world. Throughout the conference people were encouraged to donate money to charity, for example. This started with the Charity Tutorial put on by Pragmatic Studio(which I attended and was a great overview of Ruby and Rails). People interaction was reenforced by the speakers and through the Bird of a Feather sessions at the end of each day. People also gathered during the provided lunches for discussions and short coding sessions.
All in all the conference was really interesting and I came away from it with more motivation to take part in the community. I also learned some interesting stuff through the sessions, although I think this is an area that could be improved upon next year. I often found myself in sessions that had content that I already new or was much simpliar than I expected. It would have been nice if the sessions were organized more by level of expertise or a similar rating next year. However, it was still incredible informative and I would highly recommend for others to attend next year. I would also highly recommend for novice Railers to take the Pragmatic Studio’s tutorial if they get the opportunity. It is a great way to quickly get up to speed with the basics of Ruby and Rails.
Filed in: Team Member Blog ruby
This is All Weekend
def isItSnowing?
true
end
def howMuchSnow?
if isItSnowing?
puts “a ton”
end
end
howMuchSnow?
Filed in: Team Member Blog ruby
Ruby Implementation Speed Shootout
Check out this write-up that has been written about how fast different implementations of Ruby run.
It points to good things for the next generation Ruby implementation, YARV. The next release of Ruby does away with the single-pass interpreter that it currently uses and adds a real virtual machine.
Filed in: Team Member Blog ruby
Presentation on January 22
On January 22, 2007, I’ll be giving a presentation at the Madison Rails meeting. The meeting is at MATC downtown and the presentation should start somewhere around 6:15ish.
The title of the presentation is Web Development Framework Comparisions. During the presentation I’ll show the development of some administration pages for a simple store application using Java/J2EE, Ruby on Rails, and Grails. Full demo applications and presentation materials will be forthcoming.
For more information check out the Madison Rails website at http://www.madisonrails.com.
Filed in: Team Member Blog ruby
First Post!
OK. I’ll admit it. I really like programming in Ruby.
I’m a Java developer by trade, but the opportunity presented itself to get to know Ruby as more than just the name of a gemstone. I’m usually skeptical when it comes to programming in a different language because Java offers so much and you can program pretty much anything with it. But… then waltzed in Ruby.
From the moment I ran “emerge ruby” and took a look at the Pickaxe book, I was hooked. It sucked me right in.
From the conciseness of the language syntax, to the built in libraries, to the flexibility of the language, to developing using Rails… what can I say?
I know plenty of people will disagree, and that’s fine.
Ruby fills a void for me. It has some interesting features that Java doesn’t (everything is really an object, closures), and it’s quite easy to program in. I’ve been looking for a language that has Java-like power with the ease of a general purpose scripting language. Ruby really fits the bill. I appreciate that you can program a really nice object-oriented application with it, and on the other side of the coin you can program a quick script with it.
I’m sure I could go on and on, but for the moment I won’t. Ruby has helped to rekindle my joy of learning different programming languages for fun.
Check out Ruby for yourself: Ruby Website
Filed in: Team Member Blog ruby