{ |one, step, back| } 10 of 24 articles Syndicate: full/short

Articles are Back!   10 Oct 08
[ print link all ]

I’ve received a lot of requests for my old articles …

The Article Section has been Restored

When I changed to my new hosting machine, I moved all my blog posts but didn’t move any of the articles. Of course I intended to move them eventually but never got around to it.

A lot of people have been asking for this article or that presentation, or pointing out that a number of old bookmarked links are no longer any good. So due to popular demand the Articles and Presentations section of onestepback.org is now restored.

Enjoy


comments

Comments Are Now Enabled   08 Oct 08
[ print link all ]

I’ve gone without comments on this blog for a long time …

Comments via Disqus

I’ve gone through several commenting systems for this blog over time. First was the really cool TagSurf application that allowed commenting on about any web page on the internet arbitrary tags. Unfortunately, TagSurf died a (in the words of its creator) “well deserved” death.

Then I tried a wiki for comments. That worked pretty good (aside from spam issues), but setting up a new page for comments for each new post was just too much hassle.

Now I’m trying Disqus for comments. It only took an hour or so to integrate Disqus with my ancient blogging engine (anyone else still using Rublog?).

Kick the tires and see how it works. If you have feedback … well, just leave a comment.

I guess this means I’ll have to start writing some real content here so there will be something worth commenting on … let’s see if there is anything I feel like ranting about …

(Oh, and a hat tip to Ryan Briones for pointing out Disqus when I was ready to go out and implement something from scratch.)


comments

Moving Blog Host   10 Aug 08
[ print link all ]

I am changing host for the One Step Back blog.

It’s Time to Move

This is just a quick little post to let you know that the One Step Back blog is moving. In fact, it has already moved. But don’t worry, we aren’t going far.

Originally this blog was hosted on a shared co-op system run by N2Net. It was dirt cheap and easy to maintain. The down side was that support was sporadic. As the hardware has aged, the Co-op has decided to let the current system run until the hardware dies, and then disolve the co-op.

Today there are tons more hosting opportunities available than there were when the co-op was first formed. I’m now leasing a Linode node and running the blog and other associated software from there. Its almost as inexpensive and the co-op and uptime should be better.

Write now the blog has been moved. As time passes I’ll move the article archive as well. Let me know if anything looks amiss.

—Jim Weirich


comments

Presenting Code ... An Update   24 Mar 08
[ print link all ]

I received some feedback on the ‘Presenting Code’ post from yesterday.

Presenting Code … An Update

I got lots of feedback on the “Presenting Code” post. In addition to Cédric Beust’s initial comments, the following people had something to say on the topic:

John Wilger asked on Twitter why I didn’t use “file:” (rather than “http:” and a local web server). Unfortunately, Keynote will not do a web view from a “file:” style URL.

Luke Kanies reports that he does something similar. He uses Vim (rather than Ruby + the Syntax gem) to generate the highlighted HTML. He also adds:

In general, this method works out great, but the one thing I would say is that you should always uncheck “automatic update”. Otherwise, you’ll find that it tries to update 10 seconds before your presentation starts and your web server isn’t available.

Ok, that’s good advice. BTW, I would be very interested in a script (AppleScript or Ruby+OSA) that would iterate over the pages in a Keynote presentation and refresh all the WebViews. Any takers?

James Edward Gray II and Mike Clark mentioned the HTML output bundle. James gives the following details:

  • Select Bundles → TextMate → Create HTML From Document (or Create HTML From Document With Line Numbers, if you prefer)
  • Preview the document in TextMate with Window ⇢ Show Web Preview
  • Highlight and Edit → Copy the content you want from the HTML window
  • Switch to Keynote and Edit → Paste

Mike (who credits Bruce Williams as his source for this tip) also provided a video.

Couple of items on the above:

  1. When creating the HTML from the document, convert the whole document. Once in Web Preview mode you can cut and paste only what you want.
  2. Choose a TextMate theme with a background that matches the background in your presenetation to get the best effect for your colors.

Dr. Nic also mentions a “Copy as RTF” TextMate bundle. (I’m not sure if this is the same as James and Mike’s hint above or something different).

Finally, Chris Nelson confirms (via Twitter): “AFAIK there is no equivalent of web views in OpenOffice :(“


comments

Presenting Code   23 Mar 08
[ print link all ]

This exchange on twitter got me thinking…

Twittering …

I noticed the following twitter conversation this evening between objo and superchris:

superchris: any good recommendations on showing code samples in OpenOffice Impress?

objo: @superchris yeah, get a mac and use Keynote

objo: otherwise, I would screenshot emacs

superchris: @objo.. ya know, i almost added “And I’ll smack anyone who says get a Mac” but ran out of space

superchris: @objo… but actually your idea of using NetBeans screenshots is pretty good

objo: @superchris you never listen …. EMACS not netbeans. Come on man.

superchris: @objo just being helpful by translating for you.. :)

superchris: planning to code with NetBeans on linux forever for no other reason but to annoy @objo

ScreenShots … Yuck!

The problem Chris is trying to solve is putting code snippets into a presentation. There just isn’t a good way to do this in modern presentation programs.

In the old days, I would generate my presentation completely in HTML from a simple text markup file. The generation process was controlled by rake. This allowed me to changed the code, run the unit tests and rebuild the presentation all with a simple rake command. Eventually, I got up to speed with CSS and could make some really nice looking presentations, all from HTML.

Although I could get nice looking slides with CSS, it was a lot of work getting it to work just so. Eventually, I abandoned that approach and swithed to a modern slide presentation program (Keynote in my case).

Although generating the slides is a bit easier in Keynote (or PowerPoint, or Open Office Impress), reproducing code for technical talks is much harder. You generally have two choices:

  1. Cut and paste the code text into Keynote losing any syntax highlighting you might have had, or
  2. Take a screen shot of the code in your fancy editor, preserving the syntax highlighting but losing the “text” nature of the code.

Neither option is pleasant. The former punishes the audience by making the code harder to read, the latter punishes you making the presentation hard to change. (I once saw Dave Thomas giving a Ruby talk and he noticed that he had a minor typo in the code. He switched to edit mode in Keynote with the intent of fixing it on the spot, then he realized that the code was in a graphic image and was uneditable).

Of the two options, I’ve been using the text cut’n’paste technique for most things. In the twitter conversation above, Chris is considering the edit snapshot technique.

Other Options?

I’ve heard rumors of someone working on a script that will insert code snippets into the Keynote data file directly. Unfortunately, as far as I know, they are still rumors at this time.

But here’s another idea. I’ve prototyped this, and think it will work. But be warned I haven’t tried this on a really presentation yet.

Presenting Code … A Proof of Concept

While perusing the options in Keynote, I noticed an insert option called “Web View”

It turns out that this option allows you to include a web page in your presentation. For example, here is my blog inserted directly into the presentation. Clicking on the “web view” object will show an “update” button that will refresh that page from the web.

So, all I have to do is get the code onto a web page, formatted nicely with syntax highlighting, and Keynote will suck it into the presentation, more or less automatically for me. Cool.

Getting it formatted is easy. That’s just a small little Rake task with a good syntax highlighting library. I used Syntax (its a gem, docs on Rubyforge), but there are other options out there.

Here’s the rakefile:

#!/usr/bin/env ruby

require "rake/clean" 

CLOBBER.include('*.html')

task :default => :extract
task :extract => "hello.html" 

file "hello.html" => "hello.rb" do
  extract "hello.html", "hello.rb" 
end

and here is the rakelib/extract.rake library:

#!/usr/bin/env ruby

require 'syntax/convertors/html'

def extract(outfile, infile)
  open(outfile, "w") do |out|
    out.puts "<html>" 
    out.puts "  <head>" 
    out.puts "    <style type=\"text/css\">" 
    out.puts %(
.ruby { font-size: 24pt; font-weight: bold; }
.ruby .normal {}
.ruby .comment { color: #888; font-style: italic; }
.ruby .keyword { color: #A00; font-weight: bold; }
.ruby .method { color: #077; }
.ruby .class { color: #074; }
.ruby .module { color: #050; }
.ruby .punct { color: #447; font-weight: bold; }
.ruby .symbol { color: #099; }
.ruby .string { color: #944; }
.ruby .char { color: #F07; }
.ruby .ident { color: #004; }
.ruby .constant { color: #07F; }
.ruby .regex { color: #B66; }
.ruby .number { color: #D55; }
.ruby .attribute { color: #377; }
.ruby .global { color: #3B7; }
.ruby .expr { color: #227; })
    out.puts "    </style>" 
    out.puts "  </head>" 
    out.puts "  <body>" 
    out.puts "    <pre class=\"ruby\">" 
    code = open(infile) { |f| f.read }
    convertor = Syntax::Convertors::HTML.for_syntax("ruby")
    html = convertor.convert(code)
    out.puts html
    out.puts "    </pre>" 
    out.puts "  </body>" 
    out.puts "</html>" 
  end
end

Edit the CSS styles above to tweek the output to exactly the colors you want. I’ve added a large font-size line to make the code big enough for teh presentation (I hate small code fonts in presentations, you can ask objo about my rants on that topic.)

Now we need to get the code on a web page. No need to get fancy here. I have a script called servefiles that will start a webrick process that serves files from the current directory. Just start it up with “servefiles 3333” (the 3333 is the port to use). Servefiles will display its URL in its startup message, like so:

$ servefiles 3333
URL: http://tardis.local:3333
[2008-03-23 00:47:37] INFO  WEBrick 1.3.1
[2008-03-23 00:47:37] INFO  ruby 1.8.6 (2008-03-03) [i686-darwin9.2.0]
[2008-03-23 00:47:37] INFO  WEBrick::HTTPServer#start: pid=874 port=3333

Here’s the code for servefiles:

#!/usr/bin/env ruby
require 'webrick'
include WEBrick

dir = Dir::pwd
port = (ARGV.first || (12000 + (dir.hash % 1000))).to_i

puts "URL: http://#{Socket.gethostname}:#{port}" 

s = HTTPServer.new(
  :Port            => port,
  :DocumentRoot    => dir
)

trap("INT"){ s.shutdown }
s.start

Now all we have to do is cut and paste the URL given by servefiles into keynote and append the HTML file name we wish to add to our presentation:

Now, to update the code in the presentation, I need to:

  1. Edit the original code base (and run unit tests against it).
  2. Run rake
  3. Press the “Update Now” button in Keynote.

Not bad.

It’s Just a Proof of Concept

Just be warned, I haven’t tried this in a real presentation yet. I’ve just spent an hour or so seeing if all the pieces would work together. There are some obvious things to explore.

  • The extraction code could be enhanced to pull snippets from files based on tags. Or even better, being able to say “Extract Method m from Class C”.
  • I’m using a fixed font size, but extract could easily take the font size as an argument or even calculate the proper font size given the amount of text found in the snippet.
  • I’ve not played with the “Update automatically” checkbox in the Keynote dialog. I’m not sure when it automatically updates, but it is possible that using it might mean you don’t even need step three above.

I will probably experiment some more with then in my next code heavy presentation. Let me know if you try this and how it work for you.

UPDATE

Cédric Beust points out that cutting and pasting from Eclipse to PowerPoint does preserve syntax highlighting. I verified the same is true for Eclipse and Keynote. However all the other IDEs and editors I tried (NetBeans, Coda, TextMate, Emacs) will paste as plain, uncolored text in Keynote. So, if you are going the cut and paste route, you might want to consider using Eclipse for the cut source.

Just for kicks I tried the presentation software in OpenOffice with the same result. Eclipse copies will preserve highlighting, none of the others will.

So, there you have it.


comments

Joining EdgeCase   14 May 07
[ print link all ]

Hello EdgeCase!

This is exciting news … well, exiting for me at least.

I have just accepted a position with EdgeCase, an agile software firm started by Joe O’Brien, Chad Humphries and Ken Barker located in Columbus Ohio. EdgeCase is focussed on agile software development and delivering Ruby on Rails solutions, a perfect match for my passions, skills and abilities.

I have known Joe for a long time, and we have a deep, mutual respect for each other. I am extremely excited to be a part of his team.

I still have a few remaining responsibilities with Compuware that will be discharged over the next few weeks before starting full time with EdgeCase. I’ve been at Compuware for nearly 12 years and I’ve had some great assignments and really wonderful learning opportunities while working for them. But this chance to work with Joe and the gang is a golden opportunity that I am not willing to pass up.


comments

Fireworks on the Fourth of July   08 Jul 06
[ print link all ]

We had some fireworks on the 4th of July … Unfortunately they weren’t the usual kind.

Fireworks on the 4th

It is a tradition in the US to fire off fireworks on the 4th of July in celebration of Independence day. Well, the Weirich household had some fireworks, but it’s not what you would expect.

What we thought at the time was a really loud firecracker from the neighbors turned out to be a close lightening strike, probably hitting the phone line. I discovered later that my DSL router (attached to the phone line) was dead (as in no lights, no power).

After a picking up a new DSL router on Wednesday from the phone company, it still didn’t connect and the phone company promised to send a technician out one Friday. Arrgh! Three days with no internect! Sigh.

The technician arrives Friday, checks out the wiring and decides to upgrade the “system”. Part of the upgrade is another new DSL router (different model from the replacement unit I picked up Wednesday). We connect up the laptop to the DSL router and everything looks great.

So once the phone guy leaves, I start hooking up the rest of the network: firewall router, network hub, wireless base station, and the other computers in the house.

And nothing works.

It looks like the lightening not only took out my DSL router, but it also got the firewall, network hub and wireless base station. Fortunately, I have another firewall and hub in my spare parts box.

Bad Cables?

I’m not certain of the total extent of the damage yet. The cables running to the other computers in the basement seem to be bad now (tested by against my working laptop). Since I don’t have long enough replacement cables, I haven’t checked out the network cards in two of the computers yet.

I am a bit surprised by the cables going bad. I understand delicate electronic equipment fried by lightening, but the cables are just wires and connectors. For them to be bad must mean the strike was strong enough to short them out somehow. And that doesn’t sound good for the network cards at the other end of the cable. Sigh.

On the good side, the my desktop computer that sits right next to the network equipment is up and running on the network. So one would that the network card in it is ok. However, it does seem to be a bit slow when browsing web pages. I mean really slow. I timed it against my laptop. What loads two seconds on my laptop takes over 20 seconds on the desktop. But that sounds more like a network configuration error than a hardware issue. Sigh, more work to do.

At any rate, it looks like there will be a run to the local computer store soon.


comments

Breedlove Tour   16 Aug 05
[ print link all ]

Extra-Curicular Activities during OSCON Week.

The Breedlove Guitar Company

During the week of OSCON, I took Monday off to drive down to Tumalo Oregon and take a tour of the Breedlove Guitar factory. I’ve owned a Breedlove guitar for 6 years and really love it. This was a fanstastic chance to see the place where it was made. I’ve posted some pictures from the tour if you would like to see them.


comments

War at the Movie Theater   20 May 05
[ print link all ]

Yes, I saw Star Wars, Episode III. But that’s not the war I’m talking about.

Episode III

My daughter and I went to the midnight showing of “Revenge of the Sith”. (Quick review: Yes, worth seeing; no, Lucas still can’t write a love scene.) But this blog is not about the movie, it’s about the event.

Imagine this picture… You are in a room full of Star Wars geeks, many of whom are dressed in elaborate costumes with expensive (as in over $200) light sabers. You have been waiting for hours for the show to start, and have suffered through the trailers. The obligatory “Please turn off all cell phones” and “Remember our concession stand” message are now playing and the movie event of the year is just seconds away from starting.

Pause now with this picture in your mind and think about how the Star Wars movies always start. I know you’ve seen them. The big STAR WARS logo flashes on screen, the brass fanfare sounds and the words “In a galaxy far, far away” start scrolling on the screen.

Also remember that if you are at the midnight showing, then you are there not only for the movie (which you will probably see several times over the next few weeks), but for the experience, the event! The final movie is showing and you just want to drink in the experience and feel the mood.

And then seconds before the movie starts… the projector skips a beat and the frame gets out of synchronization with the projector. The top half of the screen is now showing at the bottom, and the bottom of the screen is at the top. The logo was split across the screen so that it read:

   WARS
  -----
  STARS

The room was in an uproar! Chants of “FIX IT” and “RESTART” echoed throughout the theater. The crowd reacted as if the projector malfunction was ruining the whole experience. Someone in the back of the room stood up and blocked the projection beam so that the picture could not be seen … and the crowd cheered because they did not want to see a flawed first performance (why shutting one’s eyes was not sufficient was never clear to me).

The theater staff was not exactly helpful. At first someone came out and said that they would get it fixed shortly and would restart the film. And they did get it fixed within a few minutes, but didn’t restart it. It didn’t matter, the crowd was so upset that they kept chanting “RESTART” after the picture was fixed. Finally the staff came out and said that weren’t able to restart it (never sure just why), and that the problem was in all the theaters (Really? In all 20 theaters in the movieplex? In what way are the theaters linked so that the same problem happens in all them at the same time?)

Finally it was obvious that they weren’t restarting it, and the crowd settled down and we could begin to watch the show. At that point, we were in the middle of a space battle (I’m not quite sure who was fighting who), and there were little drilling droids on Obi wan’s fighter. Oh well, it was Star Wars and we settled in to enjoy it.

An aside: You got to believe that a significant portion of that midnight showing crowd was planning on multiple viewings of the movie. Lets say two-thirds were planning on seeing it more than once. With 20 sold out theaters with 200 to 300 people per theater makes (around) 5000 people there that night. Now if two-thirds of 5000 were going to pay to see the movie twice, but now have a free pass, that right around $30,000 that was lost that night. Wow. That’s an expensive mistake.

Oh, and I have one other piece of advice to those going to midnight Star Wars showings. If you are going to go in costume, go all out and do it right. If you show up with a Darth Vadar helmet that looks like it came from a K-Mart Halloween costume rack, and the Darth Vadar standing next to you looks as if he just stepped off the movie set ... well, you look pretty silly.

Just go see the movie and enjoy it.


comments

Cautiously Optimistic   23 Sep 04
[ print link all ]
I am cautiously optimistic that a minor change in UseMod wiki code that I am using for feedback may have slowed down the wiki spam bots a bit. The fix is very simple. I just require that any links on the wiki page spell the protocol portion of their link URL in upper case.

For example, if I wish to link to http://onestepback.org on a wiki page, then I must spell the link as HTTP://onestepback.org. Otherwise the updated page will be rejected.

Since the wiki spammers currently use lower case for "http", their page updates are rejected. Now this will only work until the spammer catch on and start uppercasing the HTTP. As long as the number of sites that enforce this rule is small, it should be a while before they catch on (one hopes).

Since I have implemented this patch a week ago, I have had only one instance of spamming. Yes, the spammer used an upper case HTTP. I don’t know if that particular spammer always uses upper case, or just responded intelligently to my error message. But that hasn’t been repeated. Like I say, I’m cautiosly optimistic.

You can find the patch here:

The patch was created against version 1.0 of UseMod wiki.

By posting this, I’ve (probably) increased the number of sites using this anti-spam technique and have brought the day closer to when the spammers figure it out. Oh, well. We will worry about that when it happens.



comments

 

Formatted: 19-Mar-10 08:45
Feedback: jim@weirichhouse.org