Colorful Ruby code for your blog

Found out about this nice gem that does syntax highlighting of Ruby code (and C, Delphi, HML, RHML and Nitro-HTML for now) and outputs it as a stand-alone HTML. Perfect for blogging. I had found some other one some time ago that needed javascript, and it’s not every blogging service that lets you add that kinda stuff to your posts.

There are many configurable options, other types of output and stuff, you can find all that (very well documented) at CodeRay’s website.

So as a try-out, here’s the output of a little script to color ruby code, run on itself:

 1 #!/usr/bin/env ruby
 2 require 'rubygems'
 3 require 'coderay'
 4
 5 if ARGV.length != 1
 6   puts "Wrong number of arguments. Use: color_html <source_file>"
 7   exit
 8 end
 9
10 rb_file = File.expand_path(ARGV[0])
11 if rb_file.split('.')[-1] != 'rb'
12   puts "Not a .rb file"
13   exit
14 end
15
16 html_file = rb_file.split('.')[0..-2].join('.') << '.html'
17 if File.exists? html_file
18   puts "File #{html_file} exists. nOverwrite it? (y/N)"
19   # need to make STDIN explicit because there's a filename in the 
20   # command-line argument (gets defaults to reading from it)
21   if STDIN.gets.strip == 'y'
22     File.delete(html_file)
23   else
24     exit(true)
25   end
26 end
27
28 File.open(html_file,'w') do |f|
29   f << CodeRay.encode(
30          File.read(rb_file),
31          :ruby,
32          :html,
33          :line_numbers => :inline,
34          :hint => :info,
35          :css => :style,
36          :wrap => :div
37        )
38 end
39
40 puts "Done! Thanks for coming! =)"
Posted in Uncategorized. Tags: , , , . 4 Comments »

Global or local?

Lately I’ve been thinking ’bout wether I should write in Portuguese or in English. I mean, my “tech contacts” right now are all either abroad (with English as the only common language) or right in my backyard.

The latter group I go to college with and we talk and I tell them about stuff over a beer anytime. So there’s no need to write in Portuguese for them.

The few people I talk to ever since I’ve started out on this “let’s start coding for real” thing are the ones who in fact need me to write in English and since they’re the only audience this blog has I’m set, right? Just gotta write in English.

But then I ask myself if I shouldn’t start, along with trying to be more prolific in coding, also start being more verbose about code and about community issues and stuff, as a way to motivate more people to do the same.

Caio recently told me that he is resurrecting his blog so that he “would have to post something every once in a while and that’d push him into actually doing something he could then write about.”

And I think that does not only serve to motivate himself but to motivate others as well. At least for me, watching people do cool stuff makes me wanna do cool stuff. And the more contact I get with what people are doing the better. That’s why I want so much the idea of our little geek talks adventure to go on and on and to frutify into bunches of little free software hackers.

But that brings me back to the initial point. The hacker scene here in Brazil is still small and we need to get more people to “code for real” and build the kind of critical mass to establish a hacker ecosystem with high throughput and cooperation and exchange. I can’t even call myself part of that “scene” yet, but that’s where I wanna be and, when I’m there, I wanna see more people by my side.

I feel a bit disconnected with the people in here since I read mostly about what’s going on out there (which is where the heat is, unfortunately) , but I’ve watched the efforts of at least one guy who’s trying to motivate people in Brazil into building a tight community of hackers — more specifically, in the context of Ruby and Rails. He writes in Portuguese to be accessible, and interviews important people from out there and publishes the interviews in Portuguese and all. I feel like I have to take a part in that too.

What do you think?

Nifty new blogging tool by 17-year-old

Logahead is a new install-on-your-own-server blogging tool I’ve come across. The last one was WordPress, and out of my desire to learn more about it and the good first impression it had on me, this blog was born. Of course I’m not going to switch now, but I’m sure going to give Logahead a go.

Logahead seems to go more in the way of simplicity, probably being not as configurable as WordPress, but still full of nice features, “fully buzzword compatible (AJAX, RSS, Web 2.0 – it’s all there)” and really easy to use.

Most impressive: all done by one 17-year-old.

(through eHub)

Posted in Uncategorized. Tags: , , , , , , , . Leave a Comment »

coComment one click too annoying

Stowe Boyd has it right about coComment:

“They should roll out a plug-in for the major blog services so that CoCommenting is natively supported. I, as a blogger, would install the plugin, and then CoComment could look the user up based on the email address they leave behind in the comment fields.”

Out of the 10 last times I left a comment somewhere, in about 12 I forgot to push the friggin’ button.

Thankfully, they said they’re working on it.

Posted in Uncategorized. Tags: , , , , , . 1 Comment »

Why partial-text feeds suck

I’ve always had this gut feeling that partial-text RSS feeds were dumb. Never liked them, never subscribed to them (except for friends’ blogs). I just couldn’t figure out why they were bad, though. To me, it was just the nuissance of having to read just a piece, then having to go to the original blog to get the rest (v on Google Reader). It is certainly annoying.

I could understand, though, why some people would want to use that, especially those who make a living out of their content. How’s anyone going to see their advertisement? Who could blame them?

But Robert Scoble did a great piece on why it does indeed suck, even for those who want to make a buck (or quite a few) with blogging. Main idea:

“So, how does anyone make any money?

Well, let’s stay in TODAY’S world. In today’s world you get journalists, geeks, bloggers, connectors, to read your content and link to it. That’ll bring a larger audience to visit your Web page. How do you do that? Serve out full-text RSS. Why? Cause by doing that you treat the connector with the most possible respect and give him/her the easiest way to consume your content and link to it.” (my bold)

Everything’s about linking after all, isn’t it?

——

Update:

By the way, BlogBurst exclusively takes in blogs with full-text feeds for big print media publishing.

Posted in Uncategorized. Tags: , , . 1 Comment »

Paul Graham on paid content

It’s been quite some time I forgot a bit about Paul Graham, after having eagerly gone through a boatload of his essays when I first found out about him reading his excellent Ansi Common Lisp. Now, thanks to a newbie friend of mine, I got back to him again. And, on a great essay about Web 2.0, he drops this pearl:

“On the web, articles you have to pay for might as well not exist. Even if you were willing to pay to read them yourself, you can’t link to them. They’re not part of the conversation.”

Mind closely that last part: “you can’t link to them. They’re not part of the conversation.”

That pretty much sums it up. How long is the mainstream media going to keep this unidirectional approach to the web? You pay for it, you read it, and that’s that.

What’s the sollution? Bring down newspapers and put everyone to blogging? I don’t think so. Should they live unaltered side by side? Probably not. Should they meet in between? Perhaps.

There’s been some activity in that area, as with BlogBurst helping bloggers get published on big newspapers and magazines (or maybe helping those with great blogger freelancers) and with Press Releases having BackTracks.

It’s incredible how far-reaching these new social-web developments are getting.

Excessive tagging

In this new WordPress experience of mine I’ve allowed myself to be pretty loose on the tagging thing. I even read in someone’s blog something like “tag away!”; that the more you tagged, the best, because it’d make clearer what your posts were about in a few short words, and that it’d be easier for crawlers to index your blog.

I can see the advantage of this on a per-post basis (the tags showing in the bottom of a post must indeed tell something about it – although if it’s long enough people will read it before getting to them).

But look at this plentitude of tags on the sidebar. There are just too many of them. And they take too much space, pushing other stuff down below the “cut” (the place where the reader has to begin scrolling to go on). Wouldn’t it be better to use them tags just for the main subject, like one or two at most?

Or maybe find a way to rank them based on importance, so that you would show only the top important ones, which would be the ones you used for the main post subject. I don’t know.

I’m open to suggestions. Anyone? :-)

Posted in Uncategorized. Tags: , , . 2 Comments »

Web2.0 Startup Name Frenzy

Since I first began reading stuff on Web2.0 a few weeks ago (it all started with John Battelle’s Searchblog), I have been so flooded by so many names of ever-popping startups or “already” beta web applications pointed to by the handful of TechCrunches, Web 2.0 Blogs and other big shot bloggers out there that it’s been really hard to keep up with all of them.

I find myself frequently going back to a site a good five or six times before I finally stop asking myself at each post I read “what the heck was that just-mentioned site all about again??”

This constant re-checking of links takes a considerable amount of time off my feed reading, which has, by the way, become increasingly difficult to do with Google Reader. But that’s another topic.

First post

I’ve created this blog primarily as a simple way for getting to know WordPress better. I’ve seen some pretty nifty and popular weblogs around the web2.0 circle using it, so I came to check out what’s so good about it.

One thing I just saw now is that you can actually import your whole Blogger blog into a WordPress one. If this works out nice and I really enjoy using it instead of Blogger, I may move my personal blog to this service.

Also, the reason I figured I could use a new blog (it probably won’t last much though) is that as I’ve been reading a bit more on tech stuff lately – especially web2.0-related – I’ve also been thinking more about it and, as it’s in the top of my mind, it has poured more often onto my supposed-to-be personal weblog. I think that kind of mixing up isn’t that healthy, so I’ll just try and keep Elucubrações Vertiginosas what its name says: a blog for vertiginous elucubrations.

Posted in Uncategorized. Tags: , . 2 Comments »