3/22/2006

Baaack in the saddle again...

About dang time! ... geez, didn't know it would take so long to get all my crap installed and life in order again with a new computer. Loving the new computer, its very fast. 2ghz centrino processor, 1 gig of ram .. wide screen. Built in bluetooth (phone and PDA are also blue) and network card.

I dual booted Windoze XP Pro and Ubuntu Dapper Drake. Have problems with getting X Windows to run, I posted at Ubuntu Forums -- got any ideas? I tried installing linux drivers for my card ATI X700 ... I had to convert from rpm to deb... still doesn't work... very sad about that.

Wrote an article about VIM over at CodeSnipers, still loving it.

Working with Drupal ... love that also. Took me awhile to get the hang of it, but its coming. It makes me happy. Anything to make my life easier. Its Nifty. I also found some Drupal Podcasts which are very cool.

Also been having a little stress in the family side of life. My dad had prostate cancer sugery, all is well and they were able to remove all the cancer. Praise God.. then less than a week later, my youngest sister, 17, got into a car accident, rolled the car the long ways and landing on 4 wheels was able to get out unharmed except for some bruses. Poor thing was scared to death. Needless to say, the car is totalled. It used to be my car. I went to go see the old Loyal Blue 93 Saturn and paid my respects last night. If she hadn't of been wearing her seatbelt, she would of been killed. Hopefully thats all the action going on in my family for awhile...

3/10/2006

Not that anybody cares...

I'm getting a new laptop on tuesday.. selling my old one on Sunday and handing over possession of it at noon.

That leaves me practically 3 days with no computer. Sunday afternoon/evening.. monday... tuesday.. since I won't actually have my computer till I get home tuesday, and thats assuming it ships on schedule.

Boo hoo.

SO I have these two old crap machines. I thought they had Windows NT on them. BUt noooooo.. boot them up "unable to find operating system" ... and I sure as heck don't want to install Win98 .. gosh... no.. I had enough of the every 6 month install back in the day.

So I'm trying to make a copy of Ubuntu LIVE and Install. I wanted the Live to try it out.. and install for when I decided I liked it. Coudn't get the LIVE to copy properly to the CD for nothing and I verified the MD5 and it was ok! ... was about ready to give up in dispair.. so I tried the Install. It seemed to work. I put it in my crap machine, told it to boot from CD and now its working. So far...

My husband is being an ASS and won't let me run a cable accross the hallway to the router. Like he only crosses it when he goes to the bathroom. He said I could use his USB network thing. Well the piece of crap is so fat it won't fit in the USB with the monitor plug and PS2 (yes its an old pc).

Oh well.. guess you won't see me online or posting the next few days. I saw python flash by on the install. Guess I could tinker around with Python if nothing else.

My last post with this laptop, so long old friend. I must type my name alot, the N on the keyboard is half worn off!

3/04/2006

Ruby can do that . . .

Peter Harkins at Push.cx wrote a bit of code in python. I've noticed Python and Ruby being very similar, so I wanted to rewrite his example code in Ruby and see how it compares. His motivation was to basically find a way to compare two objects for equality (containing the same values for its members) since the == operator doesn't function as expected.

Here's my code:

values = ['2', '3', '4', '5', '6', '7', '8', '9', '10', 'J', 'Q', 'K', 'A']
suits = ['h', 'c', 'd', 's']

class Card

attr_reader :value, :suit
protected :value, :suit

def initialize(value, suit)
@value, @suit = value, suit
end

def to_str
sprintf "<card: %s, %s>", @value, @suit
end

def equal( other )
(@value == other.value) && (@suit == other.suit)
end

end

This may not be the best implementation, I'm new to Ruby so there is probably a better way to do it! I created attribute readers and then set them as protected so only other instances of class "Card" can call it (don't need public access right now, so why open that door?). Constructor takes the two parameters and sets the class variables. The method to_str . . . It was my impression that if I defined a to_str method and did "puts card" it would automagically call the to_str object.. but no, it didn't work. Ok then what is the advantage over defining to_s?


When I run it

card1 = Card.new("3", "s")
puts card1.to_str
# prints
<card: 3,s>

card2 = Card.new("3", "s")
puts card2.to_str
# prints
<card: 3,s>
puts "is card 1 the same as card 2?"
puts card1 == card2

# result would be:
# is card 1 the same as card 2?
# false


puts "now using equal method"
puts card1.equal(card2)

# result would be:
# now using equal method
# true

BTW - printing the instance var itself renders something goofy like:
#<card:0x2815b38>

It's the object id, which is why you can't use the == operator, since each id is different

3/03/2006

View Rendered Source -- for IE

IE was being a bad boy and I wasn't sure it was rendering my ajax correctly. I was wishing for a View Rendered Source like I have for FF. I searched, found but it didn't install right..and found 2 commercial ones. Ugh. I don't know if work would go for that.

The I thought.. hmm I could make a link "view source" (for when I need to debug) and have it grab the text of html, format... and make it display? hmm.. I was working on that then left for lunch.

Then I get to Panera bread for lunch and realize.. hmm wonder if I can make this a bookmarklet so I don't need to put tag in my page... then I thought.. hmm maybe there already exists one... so I search.. and found one! and it works... its not color coded like FF but it works:

http://javascript.about.com/library/blsource.htm

Yeah.

3/02/2006

Javascript Debugger extension out.. for FF 1.5

Found out last night from the DotProject IRC room that the newest Venkman, the Javascript debugger is out. I had to uninstall the old version manually then install this new one. Sweet. I was missing this...

In case you don't haven't used it, its an excellent tool for stepping through your Javascript and watching variables. Even tests ajax type things too! Another of my favorite extentions is FireBug which I use when I just want to see what XML requests are being called (ie. is this DERNED THING WORKING?!?!).

If you are really hard up for entertainment ... check out this person who installed 100 firefox extentions..

Am I missing out on any cool FF developer extentions??

3/01/2006

Feeling l33t today

I had lunch the other day with Peter Harkins, a fellow PHP and Python programmer. I showed him my ruby app and I mad the comment that on my new host Rails Playround the code in vi is syntax highlighted and it wasn't on my OLD host. I don't understand this terminal stuff. He said oh, just do ":syn on" and whoa, I was in color! Sweet. I don't know how all that works, but it did. I use putty for my ssh client. Then later in email, I don't remember how this came up, but I said I really get mad when I'm in vi and I (out of habbit) hit ctrl-s and my terminal seems to "lock up" and I have to shut down and go back in. It REALLY makes me mad when I do that!! He said this:


It's a relic from the "terminals are a printer or dumb hunk of glass" days. CTRL-s stops flow-control (so you can read stuff before it scrolls away), CTRL-q restarts it. If you never ever want this (most don't), do 'stty -ixon -xioff' to kill those keys (you can put this in your .bashrc).


Ahhhh... so I turned it off and then set about to figure out how to remap my ^S to :w .. here's what I did

map! ^S ^[:w^M

in your .exrc file:

here's how, type
map!
space
ctrl-v
ctrl-s
space
ctrl-v
press esc
:w
ctrl-v
ctrl-m

you have to use map! so it will work when you are in insert mode.

It works.

I'm l33t today :)

BTW, Peter started a new blog on a wickedly cool domain name push.cx ... if the name is not familiar to you, read his first blog post!