Wednesday, April 28, 2010

interesting note

nota bene: trying to access your local django admin site with localhost:[port]/admin fails (probably) because localhost is not a FQDN, so writing out a cookie fails.

Use 127.0.0.1 and rejoice.

Wednesday, April 21, 2010

git push origin master # kick punch it's all in the mind

Just created my github repo, think I'll add a few more things I've done lately in ruby and possibly Obj-C.

Here's a ruby commandline tool that will correct some spelling mistakes.

There's an rspec file and another that will generate mistakes and then fix them. The only outstanding but I never fixed was that String.squeeze() is too general - you can't tell it to only squeeze down strings one at a time, so I'll need to write some more to handle cases like 'sheap' -> 'sheep'.

ruby fail

Don't do this:

#/usr/bin/ruby
arr = Array.new
something = "hello world"
arr.push(something)
something = "whoops"
puts arr #sends 'whoops' to stdout

Found this out while working on a commandline utility that corrects spelling errors. I was looping through the characters in a string, potentially altering the word we were given and then pushing the result into an array that held the values we might want to return (I was going to post-process them as well).

Implementing a deep copy in ruby didn't strike me as a good use of time, so I returned the first 'correct' value instead of returning an array of possible corrections. I will probably post this to my github later, for posterity.

Friday, April 2, 2010

musing on views and view controllers

Anyone have any idea how to manage a view controller that may have an arbitrary number of views? I'm thinking to have a base view that the other views are descendents in a hierarchy of [thisView addSubView:anotherView] which should be easy to do since I'm storing them in a mutable array.

Next iphone app : something that doesn't involve an arbitrary number of UIImageViews.

edit: since the arbitrary number of views do not necessarily need to know about each other, this is best accomplished by having a ViewController subview one master view that has all of the subviews in its hierarchy. This is probably the best approach unless you need to worry about layers and or clipping.
[thx brian]