Oracle Sproc Tip

Posted by craig

A colleague of mine, Guillermo Castro, showed me how to print the results of a stored procedure call that returns a ref cursor in Oracle.

In SqlDeveloper you would make a script like so:

var results ref cursor;
var o_status number;
var o_err_msg varchar2;
exec :results := myschema.MY_SPROC(773490, 'TEST', :o_status, :o_err_msg);
print results;
print o_status;
print o_err_msg;

This will output the values of the refcursor (a result set generated by MY_SPROC) as well as two “normal” out parameters :o_status and :o_err_msg.


Episode 4: iPhones and Androids

Posted by alex

Recorded June 10, 2008

In this episode we discuss Apple’s just announced (and soon to go on sale) iPhone 3G, 2.0 system software and the iTunes app store. We compare and contrast this device again Google upcoming Android platforms. Is the iPhone the sign of a new revolution or is it the next evolution of cell phones?

Links


Listen now:
or Download the mp3






Death of the disconnected LAN party

Posted by craig

Say what you will, but LAN parties are way better than just getting on some pub server and talking with your buddies over VOIP. In a LAN party setting, I can literally walk up behind a guy and start tea-bagging him (4 r33lz!).

A friend of mine holds a quarterly gaming weekend out at his cottage, it’s not a remote cottage, it’s in a small hamlet about 45mins from the city. Up until a few years ago high-speed internet wasn’t available to the region, that didn’t really matter though, all of our games played nicely over the LAN. Then games like BF2 started to emerge, and anything Steam related where they “insist” on doing a little online check. In earlier patches of BF2, you literally couldn’t start the game without being online! Even though the game has a fully supported single player campaign as well as LAN multiplayer. Now-a-days it’s a bit better, but it can take up to 3-5mins staring at a blank screen when starting BF2 before it is satisfied that it can’t connect to the internet before it starts up. You can get around this by unplugging your ethernet cable when you start the game, then plugging it back in once it starts, but what a pain in the ass.

And then there is Steam, basically if you want to play Half-life or Team Fortress 2, good luck trying to do that without an internet connection, even if you intend to only play locally. What a joke. Luckily John now has access to high-speed through his neighbour’s connection. When we go out there to play, they setup a wireless N bridge between the cabins. However the last time we were up there the bridge failed (for unknown reasons) around midnight, and we were left there wanting to play TF2 but unable to.

Sounds like there needs to be a petition sent to the game companies which implores them not rely on an internet connection in order to play their game. People still have LAN parties, and yes, sometimes they do this without access to the internet!

</rant>


Next episode taping tomorrow

Posted by craig

FYI we're taping our next episode tomorrow night. Alex has grand notions of actually making the cast sound better, so it might be a few days before we post it.

Episode 3: IDEs vs Editors

Posted by craig

Recorded Nov 2007 (yes that long ago)

Our third episode is about a topic near and dear to every developer: what editor to develop with and why it’s far superior than the piece of crap someone else uses. Alex, Craig and Marc chat about everything from Eclipse/Textmate to vim/emacs. It’s a sensitive topic for most, and we went into this podcast knowing we wouldn’t convince each other to stray from our weapon of choice, but we managed to fill about 45 minutes discussing some of the finer points of editing and being productive.

I think this podcast – more so than the others – represents most accurately three developers sitting around drinking beer and talking shop. When we go out to the pub (sadly) this is exactly the type of conversation we (and if you’ve made it to the third episode, probably you too) have.

Links


Listen now:
or Download the mp3


I've.... changed....

Posted by craig

Much like with Mac, I’ve never been impressed with Sushi. I’ve gone for sushi before and usually it was because someone said “you don’t like sushi? Oh, dude, you just haven’t had the good stuff” but ultimately I end up disappointed.

This has all changed, last time I was in San Fran Eugene Ciurana took us all to a Sushi place called Takara . Now, Eugene is the author of the Sushi Eating HOWTO so if there is anyone who knows good sushi, it should be him! And he didn’t disappoint. We had only sushi which was comprised of raw fish, on top of rice with a layer of wasabi. Then moved on to a few cooked items like eel and octopus. Everything was fantastic, absolutely no gag reflex triggered at any point.

I think the problem I’ve always had with sushi is a) I’m not a huge fan of fish, I mean I don’t hate it, i just don’t go out of my way to eat it b) I’ve always had “rolls” in my limited sushi experience, and these rolls always have seaweed and some sort of mayonnaise type stuff in them. I’m really not a fan of cold creamy sauces, so right away I was turned off. And the seaweed has such a fishy flavour that it didn’t agree with my gentle palate.

The raw fish didn’t taste fishy at all, I was taken aback, the only thing that tasted mildly fishy was the eel.

I think I must be getting cultured, I find Winnipeg lends itself to being cheap and not really trying things. Or, maybe that’s just me.

EDIT: The same thing happened to me with Scotch a few years ago, shout out to Fred Martin from Morgan Stanley for opening my eyes to the smoky flavour of Laphroaig


Apple Store...

Posted by craig

My story of how I was almost a Mac fanboi…

I’ve been needing a new laptop capable of doing development on for a few months now. Typically I’m developing on my nice quad-core desktop, however now that my classes are over I’ve been traveling to San Fran on a regular basis. I have my severely under powered Gateway MX6421 laptop I picked up as a cheap refurb. 1.8Ghz single core just doesn’t cut it now a days I’m afraid, the Core Duo is a must for developers on the road.

Mac Fag

If you’ve listened to the podcasts you know I like to bug Mac Fan Boi #1 (marc) about his Mac. “Is that thing powered off your own sense of self esteem?” “How did you pay for that thing? With your penis and testicles? Cause surely you won’t be needing those any more”, and the list goes on…. Now, I need a dual core laptop for travel, so I don’t have to wait 5 mins a build. No problem, just grab a $1000 dell and throw Ubuntu on it (Dell Canada doesn’t sell them pre-configured with Ubuntu) you might say. Yeah, I could, but that kind of limits my selection, you see, cause it’s been my experience that Ubuntu doesn’t always work nicely on laptops. For instance, on my current laptop sometimes the thing will hibernate and every time it goes into “sleep” mode, I loose the ability to use my touch pad. I can’t tolerate that kind of shit any more, I just need the laptop to work so I can develop on it. Enter the Mac.

My history with Macs

Almost every single person on my team owns a Mac, and swears by them. When you ask them “why do you love it so much”, they’ll respond “you just have to use one to find out, it’s hard to explain otherwise”. Now the last time I used a Mac was in University, we had to write our Pascal in the craptastic Mac II lab. One of the greatest days of my university career was when my prof agreed to let me submit a PC formatted disk containing my assignment written in Turbo Pascal. I could work from home! And I didn’t have to use a Mac! yay! So needless to say, I wasn’t a Mac fan. I was a gamer, for one, and I loved being able to swap out video cards, ram, cpus, I didn’t like the fact that when you bought a Mac you were pretty much stuck with what you bought until the day you decided to fork over another $3K for a new one. You could upgrade slowly with a PC, perfect tool for a starving student.

They switched to Intel

It wasn’t until Macs went Intel based that I thought about Mac, up until that point in time I saw them as tools only for beardos and people that hang in the local Starbucks. But even though they were intel based I compared hardware specs and thought to myself “I can build the same computer for a fraction of the price”, however, i don’t think the same holds true for the laptops. To me it seems like if you were to go get a Lenovo that was speced the same as a MacBook Pro, the price difference would be negligible.

Mac OSX

Mac OS X is linux like. That really appeals to me now that I code exclusively on Linux.

Rationalization

I started finding myself rationalizing an excuse to go get a Mac. “it just works”, “Marc was a linux guy, now he owns (and loves) his Mac”, “a lot of the elite coders in Java have them”, etc… The latter rationalization is a bit like the crappy golf player that goes out and blows a tonne of cash on a set of clubs. Sure it might help marginally, hell it might even give him a shot of confidence, but at the end of the day it’s not the car, it’s the guy driving.

The nail in the coffin

So I’m here at my client’s site, slogging away on my underpowered Gateway when it dawns on me “MacBooks are $1K (not the pro version), and they just work, no having to worry about whether a certain feature is going to work, no, it just works. So why don’t I just catch the train to the Apple Store and get it over with?” The MacBook is more than adequate for what I need, that is, a laptop I’ll use on the road. At home I can hop back on the quad-core Ubuntu desktop. I also like the fact the MacBook is small, perfect for the plane ride.

So the nail in the coffin was when my Tech lead caught wind of my interest in a MacBook. At first he was saying “no no no, Craig, buy the MacBook Pro. You are a professional developer, you need professional tools, if you buy bottom of the barrel, you’ll get a bad taste in your mouth.”. Ok, but I really don’t have $2K+ to blow on something I only really need when I travel (perhaps once a month). Then it dawns on him: “Craig, I’ve been wanting to upgrade to a new MBP for a long time. Why don’t you buy mine for $1K and I’ll go buy the new one.” It really didn’t take me long to reply “why not? $1K is my price point, and I would be getting a 17 inch MBP!” The funny thing is I wasn’t even considering buying a 17” beast I could replace my desktop with, but for $1K, what the hell.

How it went down (in flames)

My tech lead has a corporate discount at the Mac Store, so our plan was to go down there after work, I would use my credit card to put $1K down on his new MBP, and he would pay the rest. So after partaking in one too many free wines (the hotel has a thing every Weds, free wine and cheese) we took our alcohol fueled impulse buying attitude into a situation I can only describe as possibly one of the biggest cock-blocks I’ve experienced at a retail store.

So we walk into the Apple store and find a salesperson (or whatever they are called in an Apple Store) to help us. My co-worker lists off the specs for the MBP he wants. They pretty much got what he needs, except he was interested in getting the glossy screen instead of the matte, but he said it wasn’t a deal breaker. He gives her the “I’ll take it” and then gets into a weird argument with her over AppleCare. That was the first weird vibe that got thrown into the experience, also she fed us some bullshit about why he should take the matte screen instead of the glossy screen because “colour is represented better in the matte version”, which, from my reading, is the exact opposite of the truth.

The second bad vibe came when I pulled out my credit card and my co-worker explains that I will be picking up $1K of the purchase price as I am buying his old MBP. Immediately we are confronted with the words “I’m sorry, I can’t do that”. She claims because we are using a corporate discount, she can’t split the bill. My coworker immediately asks “you don’t work on commission do you?” “I’m hourly sir”, yeah, no shit lady.

The topper to our experience is when the “manager” comes out to read us the riot act. “Sir, the agreement we have with your company doesn’t allow a third part to purchase, even if in part, products under your the corporate rate”. We argued for a for a bit, but in the end they took the nicely boxed MBP off the counter and with a parting shot the sales person quipped “Now sir, you can go to the website and pick the model you really want and pay for it however you choose”.

The bottom line is, my coworker is going to “use the website” and buy a new Mac. He then in turn will sell me his old one. But I have to wonder what the hell I’m getting into here, I’m getting into bed with a company that doesn’t really care if they have my business. I mean, that store could have been $3,500 richer yesterday. But maybe it all goes into the central coffers anyway, so they truly don’t give a shit how you get your Mac, because they know you want one ;)


A few git-svn Tips

Posted by craig

  1. clone a remote svn repo and it’s branches and tags
    git-svn clone -T trunk -b branches -t tags -r 1124:HEAD https://mysvnserver/myproj
    this will bring down all history from revision 1124 onward intoa local git repository and will create remote branches that track the projects inside your myproj/branches and myproj/tags folders

  2. find out what remote svn branch your local git branch is tracking:
    git log --no-color --first-parent | grep git-svn-id | head -n1

  3. given you did the clone from step 1, you could create a local branch which tracks a remote branch (so that your git-svn rebase/decommit commands execute against the right remote branch)
    git checkout -b trunk-local trunk
    this will create a new local branch called “trunk-local” that tracks the remote “trunk” branch in svn. Any git-svn rebase or dcommit commands issued while trunk-local is your current branch will be executed against the remote trunk branch.

  4. after executing the code from step 2, you find that your local master branch is setup against a remote branch other than “trunk” (I like having my local master branch tracking trunk) you can reset it to track trunk by issuing this command:
    git reset --hard trunk

  5. want to merge changes from one local branch to the current branch, but don’t want the history of commits? That is, if after the merge you do a git-svn dcommit you don’t want a separate commit for each “git commit” that took place in the “branch to merge to current”, you just want one uber commit.
    git merge --squash <branch to merge to current>

  6. refer back to the last local commit message (useful if you forgot to include a file in the last commit and would like to re-use the message)
    git log HEAD^..HEAD --pretty=format:%s


Episode 2: UUIDs

Posted by craig

Recorded Nov 2007 (yes that long ago)

In our second episode, Alex, Craig and Marc had a chat about UUIDs, specifically their function in terms of a database. Are they overkill? When would you need them?.

As always, we also drank some beer.

Links


Listen now:
or Download the mp3


Yeah, so git is good.

Posted by craig

Late Adopter

I’m a late adopter of almost everything. Being a long time “windows guy” I typically wait at least 2 years after a new version of windows is released before upgrading. I am on Vista currently only because it came with my new PC, if not for that fact I’d be still slinging XP. The only reason I’m on Windows at all is because of gaming and my inherent laziness to create a dual boot system. Things have changed recently though, when I got the new PC it did not come with video card, it was onboard, and not anything I could play a modern game with. So this means I haven’t played a PC game since approx. Dec 27th (not that I’m keeping track or anything :P).

Because of my previous contracts, I’ve been developing on Windows exclusively. My choices were usually limited by corporate standards, lack of Linux vpn client, etc… But with my current contract I have a choice, so what I’ve done is I’ve been running Ubuntu within a VMWare session on Vista. I really like this option for two reasons:
  1. I can backup my entire development environment, OS and all, by simply copying the VMWare image file
  2. If I need to work from my laptop, I copy the image over and I am up in running in a matter of minutes in the exact same environment (no saying “oh crap, tool XYZ isn’t installed”)

git, a different animal

So…. getting back to the subject, I don’t typically change unless I need to. I’ve been coding Java for roughly 8 years, prior to that it was VB. I tried RoR, but never really got farther than admireing Ruby’s closures. That’s the trouble, when you are developing professionally in a language and wish to “switch” it’s not like you can just go out onto the market and say “I’m a Java developer looking for a contract that teaches me RoR”. It just doesn’t work that way, people want you to come in on a contract hitting the ground running, not crawling. Same goes for version control systems, you use what the corporation paying your salary uses. Sure you might oggle the features of some other VCS, but unless you have a set of personal projects you can use it on, you aren’t going to get to know that other system.

Sure you can learn things “on your own”, in your “spare time” (does such a thing exist for some people?) but unless you do something like contribute to an OSS project, or create a publically facing app, you won’t have the experience to go along with your self teaching. I have found experience is what sells you out in the market.

git is different though, git allows you to use it without anyone else knowing you are using it. That’s a great feature, it’s almost like if you were able to write your code in Ruby/Rails and just prior to commiting you run the magic program which converts it to Java. You get to learn the ins and outs of a new framework and someone else pays you to do it. What I’ve been able to do with git is clone my client’s svn repository into a local git repository using git-svn and commit/branch against the local version. This is great because I can work on several features at the same time, and when one is ready to be promoted up to the svn repo, I can commit only those changes I made to my local “feature branch”! When I’m done committing the feature I was working, I switch out of it’s branch, execute a an git-svn rebase in my other feature’s branch, and continue my work.

The above reasons contribute to why I’m a relatively early adopter of git (at the insistence of Marc and Alex mind you), for the simple reason that it’s unobtrusive.

The Changeset Shuffle

> svn stat
? com/mycompany/feature/new/SomeNewFeature.java
M com/mycompany/feature/old/SomeOldFeatureThatNeededFixing.java
M com/mycompany/common/SomeCommonClassModifiedByBothFeatures.java   <--- Ah crap!
> cp com/mycompany/common/SomeCommonClassModifiedByBothFeatures.java SomeCommonClassModifiedByBothFeatures.java.new
> vim com/mycompany/common/SomeCommonClassModifiedByBothFeatures.java <--- remove the new features
> svn ci -m "qa fix 10032" 
> mv SomeCommonClassModifiedByBothFeatures.java.new com/mycompany/common/SomeCommonClassModifiedByBothFeatures.java

git really helps you in those times where you are working on some new/experimental feature and then are hit with a critical bug fix found during a QA cycle. Instead of doing the “change-set shuffle” ; you know, when you are frantically trying to figure out which files should be commited that were part of the fix and which were part of the experimental stuff ; you instead just “stash” away the experimental stuff, or branch your master and fix from there. I know you SVN’ites are going to tell me “but I can branch just as well as you can!”. This is true to some extent, however with git I can do it without cluttering up the remote svn repo with a separate branch for the change. Using git I can easily and safely from the comfort of my own machine, branch, fix, commit a change and reconcile it to the remote svn repo. All of my git commits, all of the comments I made for those commits (you do comment your commits right!) all get pushed up to the svn repo. Beautiful.

How to learn

Marc put me on to PeepCode specifically their excellent git intro screen cast. I’m very much a visual learner, so the screen cast format was an excellent choice for me. You can keep track of some of the other resources I find helpful with git, by taking a look at my del.icio.us links.

In conclusion…

I find git really rocks because:
  • I can use it in a corporate environment that doesn’t support it
    • I can’t do that easily with other VCS
  • It promotes “playing”
    • I can branch, be merry, experiment without the changeset-shuffle
  • git promotes branching!
    • yeah, people are shit scared of branching in svn, mostly from a lack of understanding, but a fair bit of it stems from the fact you are branching in the remote repository, you just don’t want to mess things up!
  • It’s fast, like really fast.
  • It’s distributed, so you can have people clone your repo to their local systems and then they can push their changes to you or visa versa

I guess the one gripe I might have is that instead of revision numbers, git uses “hashes” to mark an atomic checkin. I don’t know about you, but I am constantly asked at work “What revision was that changed checked into?” It’s a lot easier to answer “rev.381” than to say “rev.9a02133e6f288864bc6bc9b18ec01732649892h3”

I think Marc said it best, you have to try it in order to have that “a hah” moment, so go out and try it! Need help? Let us know on freenode in #basementcoders, or leave a comment right here.


Episode 1: Source Control!

Posted by marc

Recorded Nov 2007 (yes that long ago)

In our first episode, Alex, Craig and Marc had a chat about source control systems. A little version control history, a centralized vs distributed comparison, and a few horror stories.

We also drank some beer.

Links

Listen now:
or Download the mp3


The Basement Coders Podcast

Posted by marc

Welcome to The Basement Coders Podcast!

The Basement Coders are 3 developers of various talents who thought they would try this whole podcast thing out. Episode 1 will be released soon!