Rubénerd Blog :)

Thursday 17th December 2009

Can’t work Qt4-QtRuby on Snow Leopard

Yesterday I wrote a longwinded post about choosing Ruby/Tk or Java Swing to create a silly Monopoly clone for the family. Alex reminded me of Qt which is still just as easy as ever to install on Mac, but I still haven’t got the Qt4-QtRuby bindings working because of a problem with Smoke.

Read this post >

Wednesday 16th December 2009

Choosing between Ruby/Tk or Java Swing

Java Swing code

UPDATE: Alex has suggested I try Ruby with Qt. Genius!

My family has always had an obsession with the Monopoly board game, and since my mum died the remaining Schade clan has clung onto it even more as a family tradition. Because I have some spare time over the holidays I thought I’d create a computer version of Monopoly but with the place names and chance cards to do with places and experiences we’ve been to and had. Trouble is, I’m not sure what graphical toolkit and language to use!

Read this post >

Monday 14th December 2009

Prevent [Ruby/]Tk window resizing

I had some trouble finding how to prevent Tk windows from being resized by users at runtime, so now that I’ve found out how I’m putting it here and passing it off as a legitimate post. Clever, right? :). Entirely pointless introductory paragraphs aside, simply set the resizable attribute of the TkRoot to (0, 0). Looks like a guy with a crooked nose.

Read this post >

Sunday 13th December 2009

Messing around with YAML and Ruby

The Ruby Programming Language

Having studied Java almost exclusively at uni for a while, I decided while I had a holiday break I’d mess around with some Ruby goodness. Today was all about messing with YAML for a potential project thingy, to use technical terms.

Read this post >

Saturday 12th December 2009

Ruby.conspriracy?

Perhaps my internet connection has been a bit spotty, but building the latest version of Ruby 1.9 from MacPorts has been failing on me with a checksum error all afternoon.

Read this post >

Friday 21st August 2009

#SongsInCode

Rick James Super Freak

As if I needed one, but another reason why I love Twitter is the spontaneous memes with a half life shorter than the time it takes for the fizz in soft drink to dissipate when the bottle is opened. I prefer Solo. Well this paragraph rapidly degenerated into nonsense more quickly than most.

Today’s fun was coming up with expressing famous songs as code with the surprisingly descriptive #SongsInCode hashtag. @NickHodge by far had the best ones, but I tried my hand at a few too. I spaced them out to make them easier to read, but all these fitted into the 140 character Twitter limit when written on the one line!

if (destination == "San Francisco") {
   hair.wear(flowers);
}
4.times do
   puts "My"
end
puts "Sharona"
if ( headlight >= 1 ) {
   [driveTo : home];
}
%signs = ( "Wild", "Can't Take Home to Mum", "Kinky" );
if ( exists $signs{$girl} ) {
   print "That girl's a super freak!\n"
}
int Mambo = 5;
if ( yourself.takenLookAt() ) {
   me.accuse(allow);
}
for ( my $i = 1; $i < 13; $i++ ) {
   if ($i % 4 == 0) {
      print "$i o'clock rock!";
   } else {
      print "$i o'clock";
   }
}
try {
   makeMeGo("rehab");
} catch(WinehouseRefusalException e) {
   System.out.println("no no no!");
}
Word thing = "Bird";
System.out.println ("The " + thing + " is the "
   + thing.getClass().getName() );

While all those were fun, I think the last was my crowning achievement :).

Monday 27th July 2009

Grilled cheese object reference diagrams

Here’s an interesting thought for those of you interested in interesting thoughts. Well okay it would only be interesting for those doing object oriented programming if you want to be pedantic. Pedantic sounds like a cheap brand of paracetamol.

We’re often told the advantage of using pseudocode and diagrams like ORDs is beneficial because they’re programming language agnostic, but that’s not entirely true. Take the above example of a grilled cheese sandwich class; it’s all fair and good if we were using Java because only the String here is an object not a primitive data type. But what about something like Ruby in which everything is an object? Huh? Would it be something like this?

That’s a lot of duplicated boxes. Clearly the ORD was envisioned when what I call "hyper dynamic" programming/scripting languages didn’t exist! I can’t think they’d be terribly practical to draw all the time as a Ruby developer unless you wanted to bend the rules a bit for it.

The diagram looks like my bedroom in Singapore, if my bedroom in Singapore contained boxes with attributes regarding instances of grilled cheese sandwich objects. I’d go for a nice Colby or Extra Tasty Cheddar. Makes sense to me.

I need a stiff cup of coffee.

Wednesday 24th December 2008

Using env in shebang scripting language lines

Directly referencing your interpreter? Crazy...
Directly referencing your interpreter? Crazy…

I haven’t written any geeky programming technical posts for a long time. Christmas Eve seems like just as good a time as any. Funny how Perl programming specifically always reminds me of Christmas because I got my first proper job after high school in 2004 writing Perl/MySQL code around Christmas time so I could buy people presents. Happiest time of my life then because I had purpose, direction and optimism.

This morning I’m talking about using env in the shebang line of scripting language source files (FreeBSD man reference). Quite frankly I’m surprised that as of 2008 the majoraty of files I download and look through still reference hard links to the interpreters such as the examples below:

#!/usr/bin/perl -w
#!/usr/local/bin/ruby

The problem with hard/specific referencing is that you can’t assume your system will have a filesystem configured in the same way as another. While us users of Unix-like systems are fortunate that our said systems have so much in common, there are still enough subtle differences between Unix-like OSs and even distributions of the same OS to cause problems.

For example, most GNU/Linux systems place all non system critical files in the /usr/bin directory. As a FreeBSD user I shivver in terror at the mere thought of this; on the BSDs we’re even more specific and seperate non system critical files that come as part of the core system in /usr/bin, and files we later install ourselves in /usr/local/bin or /usr/local/pkg depending on our package manager. Much stricter, cleaner and easier to maintain… but that’s for another post.

The solution to this is to call our scripting language using env which checks your system for the desired interpreter and executes. This means Linux users can share with BSD users can share with Mac OS X users etc without worrying about how said systems are configured. You can even pass regular options, very nice.

#!/usr/bin/env ruby -w

Using env to reference basic sh shell scripts would be overkill, but for languages such as bash, Ruby, Python, Perl etc it just makes sense. Sure you could just assume all your clients and servers will be GNU/Linux folk, and perhaps you’d be right… for now. I’m all for future proofing.

Saturday 01st November 2008

Rubenerd Blog October 2008 rambling summary

A Swindon based 63 service
"A Swindon based 63 service" by The Oxford Bus Page

It’s official, October 2008 has been the best month for the Rubenerd Blog since August 2006. In total 63 posts have been submitted compared to 23 posts last month and 37 the month before last. Realistically many of these have been long and involved but many more have been silly posts with less than three lines. Still, that’s 63 random thoughts and ideas which isn’t as high as the ridiculous 110 I made back in August 2006 but it’s close.

In a kind of ironic twist, it seems that the more work and studying I need to do, the more material appears here. I think connecting my mind to a keyboard and letting all the ideas flow is a fantastic coping mechanism. It also allows me to keep my mind alert when I take breaks instead of being a passive consumer like I would be if I just watched TV.

ASIDE: For some reason I think this post will be getting the "pointless milestone" tag. The question is, how can I pull off putting a picture from an anime series on here too so I can use the "pointlessly fun anime reference" tag as well. These are the thoughts that keep me up at night. That and coffee. That made no sense.

Given I’m posting so many entries from my iPhone now as well, I think the next logical step in the evolution of this long winded and overly verbose trail of consciousness is to include some form of location metadata into each post. In this way I could see just how many words I have typed while I was sitting at the Boatdeck Cafe in Mawson Lakes or the huge Starbucks with lots of comfortable lounge chairs in Millennia Walk in Singapore. I have a sneaking suspicion they might be where most of this stuff gets done!

ASIDE: Millennia Walk was just across from where the Singapore Formula 1 night race was held. It’s a really bizzare building with gigantic pyramid like skylights that stretch above the main shopping area by several whole floors. I did work for people around Suntec City and Millennia Walk after I finished high school in 2004.

Millennia Walk, Singapore
Millennia Walk, Singapore by williamcho

The place of the Rubenerd Show I think is also starting to evolve again. Previously I would speak everything I was thinking into that show, now it’s much more of a spur of the moment type of project which I hope will improve the quality. I wish I had the self confidence that Frank Nora has by being able to speak into a voice recorder as I walk down the street with people staring at me the whole time… perhaps at some point I’ll get to that stage.

At some point I would also like… ney LOVE, to be able to finally move all this material onto the content management system I wrote myself in Ruby (without Rails… it bothers me how people assume it must use it if it’s a Ruby web app) earlier this year too. Perhaps after the exams and this latest project I’m doing for a client I’ll take a solid week off to do that.

Yukikiro Matsumoto I’m fed up with all these constant WordPress updates; it is a great blogging system if you want millions of bells and whistles but don’t want to do any programming yourself, but it’s incredibly top heavy for what I want to do here. Not only that, but it’s written in PHP. As a guy who also loves Perl, I have nothing against PHP, it’s just Ruby is so much more Smalltalk like and is so elegant. Ruby code can be syntax-highlighted and printed onto posters it looks so nice. Yukihiro Matsumoto knew what he was doing!

ASIDE: My beautiful late mum thought that Yukihiro Matsumoto was cute.

I’d love to learn though how to better integrate MediaWiki with Ruby applications though, I love MediaWiki and I’d love to start using it again for my own projects. For a while I was a maintainer of an intranet wiki system and I wrote a lot of Ruby scripts that PHP would call using system calls, but it wasn’t very elegant. If I could figure out how to better integrate them, I could write so many scripts for Whole Wheat Radio to do trippy things Jim would have to start blocking my IP address because I’d be using all WWR’s idle CPU power. Wouldn’t that be fantastic?

BRAINWAVE: Wouldn’t it be great to be able to use the same user database for my Ruby CMS and MediaWiki? Then I could leave my CMS for the blogging portion, and use MediaWiki for the Wiki side, but the users would be consistant. I’m so smart it’s scary sometimes. Okay, I’m more scary than smart.

Well that post started constructively and quickly deteriorated into rambling quickly… sorry about that. 63 posts though. Like the way I got back on topic again by referencing what I was supposed to be discussing? That’s called "skill" and it’s not something you can learn at any fancy tertiary educational institution.

Sunday 01st June 2008

Ruby 1.8.7 released

Ruby

Akinori MUSHA announced today that Ruby 1.8.7 has been released.

The new version of Ruby includes many bug fixes, lots of feature enhancements backported from 1.9 and some performance improvements since 1.8.6 while maintaining stability and backward compatibility with the previous release to a high degree. See the bundled documentation for details about compatibility issues.

~ Ruby 1.8.7 released

< Older posts
Dedicated to my groovy late mum Debra Schade.