Nola Stowe's blog

Poking around in Ruby

Ruby for Windows (I'm not sure if other operating systems have similar, but I would think so) has a program called "fxri - Interactive Ruby Console and Help." This little application consists of a frameset with one panel as a documentation browser, one panel to display the help for the currently selected item and an interactive console. This can be a great aid in learning ruby and for testing out functions or code. Here I'll talk about a few things I've learned with this.

You get a prompt as you would with an operating system, looks something like this:

Simple AJAX or How I learned to start simple

I've been using the iframe data loading trick for a few years now. I first saw a use of HTTPXmlRequest about a year ago for a simple search engine which worked like Google Suggest. I thought that was cool, but was unsure if this was a feature that would remain in the browser or just a hack someone figured out which might be gone in the next release. When this methodology was finally named this year "AJAX" and everybody got all excited about it, I thought I should try some of this stuff. I followed this tutorial over at O'Reilly and saw this example over at Apple. I downloaded a few "packages" for php, javascript and ajax. I found them somewhat complex. Then thought I should make my own at least at first. I immediately started refactoring in my head how to make this a neat, packaged javascript class. I got lost because I started out too complex. I cut and pasted a bunch of code, added my own code. Tried running it, got strange errors and kinda gave up (at that point).

How to work for free and keep your sanity

If you make websites, surely you've had some friend or relative say "Hey, can you make a site for my non-profit group?" … you think, I'm a nice person and this cause is just. And here's some extra practice and something to put on my portfolio, SURE! Not a problem. I have recently had a frustrating experience with something like this and I've learned a few things…

The Saga Continues: Language tidbits in Ruby Vs. PHP

I wrote a simple math quiz game in Ruby, its one of the first things I wrote as a kid when I was learning GW-Basic (sigh, those were the days!). I found a few surprising differences in Ruby that I'm used to in PHP. Here are a few tidbits I discovered.

Increment Operators
You know these, its what you have in every for statement and quite often used in other looping structures. It PHP its used like $var++ and $var-- … which as we know, is to increase the value in the variable by one or subtract by one respectively. Well to my surprise (and failed Ruby code when I tried it) they aren't in Ruby. You have to use var += 1 and var -= 1 . weird huh? I wonder if this will change in future versions of Ruby. It's not THAT big of a deal, but I was surprised. I suppose it makes it easier later when you want to increase by 2 or 3. But, having a standard way to only increase by ONE is a good idea as a check against the programmer. What if they accidentally hit the 2 or 3 instead of a 1?

Hey, I'm an Analyst!

Up until a few weeks ago, I thought the title "_____ Analyst" (fill in the blank) was an ambiguous term that meant you had a fancy title. What's an analyst do!?! Nobody knows for sure, I thought. I didn't call myself an analyst. I scoffed at anybody who did, and said, Oh yeah. You're special. What's that really mean? What is it you analyze anyways??

Then just a few days ago, I had the thought, "man, I am getting sick of analyzing stuff!" and then I realized, hey I'm an analyst!

Attribute Accessors - Ruby VS. PHP

Typically in objects you don't set/get the attributes directly, you use a method. This allows you to do type checking when setting the data or to format it a certain way when getting the data. In php I would use something like this:

    function setAttack( $atk ) { $this->attack = $atk; }
    function getAttack() { return $this->attack; }

And used like this:

echo $testcard->getAttack();

Extending Objects - Ruby VS. PHP

Extending a base class to a more specific class is a good practice and is called "inheritance" Here's the process I go through to decide if I should make a base class and extend or not.
I make a list of the objects I will need for a game, for the VS game we have:

  • Character cards
  • Plot twist cards
  • Location cards
  • Equipment cards
  • Player
  • Board

Those items that have "card" that gives me a clue that maybe they are related and perhaps have some common attributes. Then I make a list of the attribute of each card. I'll just show two of the card types here:

Objects - Ruby vs. PHP

I was teaching my husband some programming in PHP (meanwhile, I’m learning Ruby) and wanted to find something he was interested in to use for examples. He is an avid player of the game VS; and I have resigned to a "if you can't beat 'em, join 'em" mentality and started to play too (Geez, I was tired of being ignored!). It’s a pretty complex game, but kind of fun once you learn all the rules.

I found it to be a pretty good problem area for teaching. There are plenty of if/else statements to learn about conditional statements, operators and entities that can serve as objects and interaction between card, player, opponent etc.

I’ll keep it simple, there are few more attributes I could put in this class, but this suffices for illustration of Ruby and PHP.

A basic card has a name, cost, text and id string.

Technology in the face of Disaster

I am at a standstill for any interesting php or ruby topics today. Like many people, I have been stunned by the disaster of Hurricane Katrina. So please indulge me in speaking what’s on my mind today. Lately whenever I read any blog any where, I skim quickly looking for any mention of the hurricane, somehow just desperate to see how it affects others.

I felt as I did after Sept 11, 2001. Stunned and sad. I didn’t personally know anybody killed by either. I have some family and friends near New Orleans, Louisiana, they are OK.

The biggest problem though this disaster was communication. What do you do when the power goes out? Everything comes to a standstill. Even with a generator in your home, you still have no contact with the outside world. My generator won’t power the cell phone tower that I would need…or the newspaper press, the television station, the ISP.

Software Review: UltraEdit 11 and UltraEdit Studio 5

I have used UltraEdit from IDM Computer Solutions for the past 2.5 years at my job. At first unwillingly, when Homesite 5 failed to function properly on the “customized” WinXP install of which I had little control. *sigh* OK I’ll use UE. Over the years it has really grown on me, to the point where I want to purchase it myself. Many of these are available in UltraEdit, but the really cool stuff is only in UltraEdit Studio.