plsql fun

Here’s a fun little question for those of you who aren’t experts at plsql…

Given this plsql code

procedure helper_method(
   iChange IN boolean,
   oValue OUT number
) IS
BEGIN
    IF iChange THEN
        oValue := 2;
    END IF;
END helper_method;

procedure do_test(
    oValue OUT number
) IS
BEGIN
    oValue := 1;
    --Checkpoint 0
    helper_method(true, oValue);
    --Checkpoint 1
    helper_method(false, oValue);
    --Checkpoint 2
END do_test;

and this java code (assuming the right frameworks for calling into plsql)

public void doTest() {
    IntOutParam out = new IntOutParam();
    sqlCall("do_test", out);
    System.out.println(out.getInt());
}

what is printed out when you replace the checkpoint comments with a RETURN; statement?
The answer surprised me… I actually stumbled across this at work today and it took me a while to figure out.

Replacing checkpoint 0 with RETURN; prints out 1, as expected.
Replacing checkpoint 1 with RETURN; prints out 2, as expected.
Replacing checkpoint 2 with RETURN; prints out 0. Huh?

Can you spot why and what the fix should be?
Hint: Swapping the order of the true/false calls would result in outputs of 1, 0, and 2 respectively.
Huge Hint: At checkpoint 2, the value of oValue is actually null.
See comments for the solution.

So yeah, now you know something to watch out for when programming in plsql :)

Freebies!

I’ve been following consumerist lately, and have gotten quite a few free coupons. Today, I got a free 8×10 print at Walgreens, free 2-piece grilled chicken meal at KFC, and a free Kashi frozen meal at Safeway. Safeway also has a few good deals this week, including $1.77 milano cookies and $1 blackberries. Yay for cheap-or-free food-or-things. :D

Work has been exciting lately. I’ve been working on reskinning the login page for the past few days… it’s made me realize how behind I am on new webdesign paradigms. Apparently, everything nowadays is done with CSS and the HTML itself is very minimal (sometimes to the extent that the page without CSS looks like a plain text file–unformatted black text on a white background). This is all fine and good except it often involves hardcoding pixel values in the CSS. Unlike tables, which will grow to fit larger text, CSS-styled divs will do strange (and often undesirable) things. This led to a few hacks that I ended up doing to get stuff looking right after localization. Meh. I really need to do webdesign again.

Life has been good. I’ve been working a bit on a redesign of Student Wars v2 to make the cards cleaner (AKA less text). Eventually, I’m going to release the game freely (instead of behind a password) so more people can play. Whee.

Photo Firsts (Zach)

Life has gotten an update that finishes it up until yesterday (May 1, 2009). Now I’ll need to go back and tag high school photos to keep updating. Bleh.

My first photo of Zach:

July 8, 2007 in front of Purnell/Warner.

Also, I’ve gone through and updated stats for everyone who has photo firsts so far and switched over to the new 4-month block format.
Edit: Those stats can be found here

Life and reflection

Life has another update. It’s now complete up through May 2008, so we’re less than a year from present day. Kinda scary. At some point I need to start tagging high school photos so I can work backward in life.

The events in the photos are becoming more and more familiar as I browse through them, picking out the one to choose for a particular day. It’s making me miss the college experience, especially after going through graduation photos again and realizing that it was likely the last time that all of my closest college friends were (or will be) be together in the same place, since not everyone returns for Carnival.
In some ways, that’s what college is really about… the classes are good, sure… but it’s really about the people you meet and the relationships you form. The majority of people I spend time with now are people I knew (no matter how casually) from college. I miss that sense of constantly being around people and being able to easily meet new people. I miss being able to walk up a couple flights of stairs and have spontaneous games, or being able to quickly assemble a group for food on an hour’s notice.
Meh.

Work has seemed largely stagnant lately. I’ve been working almost entirely on bug fixes and test automation, and I’m getting rather bored of it. Unfortunately, I also seem to be in a sort of mental rut where I haven’t been able to come up with interesting projects or initiatives for myself to take on to change this.
This will hopefully pass but, in the meantime, I can’t help but feel like I don’t accomplish anything of value in the time at my desk.
The last time I coded for fun was the framework for life.alanv.org. I haven’t touched the rewrite of the main alanv.org code for a year, and haven’t worked on CMU Adventures in about that time. This really should change, but I just haven’t been having any bouts of inspiration.
It’s not even that I dislike my job (I love my job, and love my coworkers, and enjoy going in every day), just more that I feel uninterested in my current tasks, and don’t have any particular ideas on how to change that or on what I could be doing instead.

I’m glad there’s at least one thing in my life that is going (mostly) the way I want it to. As we close in on 25 months this Saturday, I hope I never lose sight of the things that truly matter in life.

Life and foods

As promised, life has received another update that finishes off my college years. Ah memories.

I accomplished nothing today other than running, working on life, eating, and sleeping. I feel so lazy.

I’ve been making lazy pasta lately…
Buy ground meat on sale: lean ground beef or ground turkey. Get the large packs and you can save a lot of money. Mix it with spices to taste (I like various herbs and a generous helping of chili flakes) and make into meatballs (about an inch in diameter). Bake at 375 for 20 minutes or so. Immediately freeze.
Now, when you make pasta, just throw the meatballs in while the pasta boils. Put pasta sauce in a bowl (even if it’s cold from the fridge) and pour the hot pasta and meatballs over it. Let sit a bit to warm the sauce, then mix and eat.
It’s no more work than making pasta normally (less if you’re used to heating the pasta sauce beforehand), and I find that the meatballs make it much more interesting (and tasty) than plain pasta with sauce.
(This is what Ian used to do with sausage back in college.)

I also like making spinach pasta:
Sautee spinach, onion, and mushroom in a medium pot with olive oil until well cooked. Boil pasta (penne for this, probably) simultaneously. Add cooked pasta to vegetable mixture with some premade spaghetti sauce (Classico Carmelized Onion and Roasted Garlic works well with this). Stir, cook briefly to heat sauce, eat. It’s really simple and tasty.

Mmmm food.