I Want My IDE Update
Posted by Ryan Baxter Tue, 21 Aug 2007 04:14:00 GMT
I started writing some Ruby code this past weekend for a new project that I’m involved in. Rather than download an IDE mentioned in my previous article, I Want My IDE, I decided to use the gedit text editor that comes bundled with Ubuntu Linux.
Attempting to capture the experience Mac users get from using TextMate, I installed the Class Browser, File Browser Pane, Project Manager, Snap open, and Snippets plugins from live.gnome.org. I also enabled line numbers, current line highlighting, and bracket matching. It’s not quite TextMate, but it’s not a bad choice either.
I had initially stated that my top two needs of an IDE were Subversion (SVN) integration and code completion. I didn’t have either of these with gedit, but I didn’t find myself missing them either. I’ve grown accustomed to using SVN from the command-line and ruby-doc.org didn’t slow me down too much while looking up class definitions.
Overall I’m quite pleased, but I have to admit that installing gedit plugins was a bit tricky and I never did get my fonts to look like those found in the TextMate-like Gedit tutorial.
- Meta 2 comments, permalink, rss, atom
Subversion on Windows in Five Steps
Posted by Ryan Baxter Thu, 16 Aug 2007 03:39:00 GMT
Subversion (SVN) is a version control system that allows software developers to track the changes of source code and other documents. Since the release of Microsoft’s .NET Framework, Subversion has become a popular choice for developers of open source projects on the Microsoft Windows platform. The latest release of Subversion can be installed on Windows XP Professional by following these five simple steps.
-
Download and install Subversion.
-
Download and install TortoiseSVN.
-
Create a repository for your project.
- Create folder “D:\Subversion\TestProject”.
- Right-click TestProject | TortoiseSVN | Create Repository here.
-
Set up repository permissions.
-
Uncomment the following lines in “D:\Subversion\TestProject\conf\svnserve.conf” (remove #):
#anon-access = read #auth-access = write #password-db = passwd - Add users to the passwd file in the format of username = password.
-
Uncomment the following lines in “D:\Subversion\TestProject\conf\svnserve.conf” (remove #):
-
Set up the Subversion Service. Pay attention to the binpath argument. You can always issue the “sc delete svn” command to remove the service and start again.
sc create svn binpath= "\"C:\Program Files\Subversion\bin\svnserve.exe\" --service -rD:\Subversion" displayname= "Subversion Server" depend= Tcpip start= auto sc start svn -
Import repository layout.
- Create folder “C:\tmp”.
- Create folders branches, tags, and trunk in “C:\tmp”.
- Right-click tmp | TortoiseSVN | Import…
- URL of repository: svn://[IP address of server]/TestProject.
- Import message: Initial repository load.
- Click ‘OK’.
- Enter your username and password from step 3.
This is all it takes to set up and install Subversion on Windows XP Professional. For more information, check out the HTML edition of, Version Control with Subversion.
- Meta no comments, permalink, rss, atom
Code Snippet: Ruby Image Scraper
Posted by Ryan Baxter Tue, 14 Aug 2007 03:46:00 GMT
I stumbled upon a screen scraping library for Ruby last week called scrAPI. It’s extremely flexible and can be seen in action on the co.mments blog post scraper. The scrAPI library can be installed by issuing the following command from your console:
gem install scrapiTesting scrAPI was fairly easy once I figured out how to define a scraper. With that aside, I wrote a small script that saves images from a URL provided by the user. The scrAPI library could be used for good or evil, but only you can decide.
#!/usr/bin/ruby
require 'fileutils'
require 'open-uri'
require 'pathname'
require 'rubygems'
require 'scrapi'
# Get the URL input.
puts 'Enter a URL:'
url = gets.chomp
# Get the HTML source.
html = nil
open(url) {|source| html = source.read()}
# Define the scraper.
scraper = Scraper.define do
array :images
process "img", :images => "@src"
result :images
end
# Scrape the HTML for images.
images = scraper.scrape(html)
# Create a directory to save the images in.
directory = url.gsub(/http:\/\//, '')
FileUtils.mkdir directory
images.each do |image_path|
# Determine if image_path is absolute or relative.
path = Pathname.new(image_path)
if not path.relative? then image_path = url + image_path end
# Write the image to disk.
open(image_path) do |source|
file_name = image_path.split('/').last
open(directory + '/' + file_name, 'wb') {|file| file.write(source.read())}
end
end
puts 'Finished...'- Posted in Code Snippets
- Meta 4 comments, permalink, rss, atom

