Tuesday, February 06, 2007

Ruby on Rails- Random Errors

If you EVER, EVER scratch your head and can't figure out why all of the sudden all your shiznit is broken. CHECK that you have not implemented an "intialized" method for the action class. If you have, you have overridden all the default variables that are created on startup!

Sunday, January 21, 2007

12 hours later fuming at Rails

This is for my fellow coders out there using Rails. I spent the better part of 4 hours trying to decipher what was wrong with a very,very simple model. I had tweaked the model some by adding some other methods and a few variables. Then I added a simple test method to exercise the creation/verification of models.

Model:
###########
class Artist < ActiveRecord::Base
require 'pp'
def initialize
end
def print
pp self.attributes { |col| col.value}
end
end

Test Case:
###########
require File.dirname(__FILE__) + '/../test_helper'

class ArtistTest < Test::Unit::TestCase
fixtures :artists
def test_create
new_artist = Artist.new
p "created artist"
new_artist.name = "name for artist"
p new_artist.print
end
end

Here's the output:
###########
test_create(ArtistTest):
NoMethodError: You have a nil object when you didn't expect it!
You might have expected an instance of Array.
The error occured while evaluating nil.include?
/usr/local/lib/ruby/gems/1.8/gems/activerecord-1.14.4/lib/active_record/base.rb:1772:in `method_missing'
./artist_test.rb:16:in `test_create'

I went in circles for hours on this. Until I removed the empty initialize method. I'm a Java and C guy by trade. So it appears this overrides some sort of class method or constructor. But removing that fixed the problem.

Labels:

Friday, November 10, 2006

200 ways to represent words or a message...

1. Show cut out of classified ad.
2. Grocery List
3. Test, quiz
4. Computer terminal
5. Poem
6. Haiku
7. Song
8. Paragraph
9. Interview
10. Close captioning
11. Balloon, cartoon
12. Pie charts
13. Flow charts
14. Map
15. Bar graph
16. Venn diagram
17. On a napkin
18. On a coaster
19. On a bathroom wall
20. CV/resume
21. Email
22. SAT/ word association
23. Script/dialog
24. Random quotes
25. Balloon over TV show scene
26. Fiction/narrative
27. Biography
28. Billboard
29. Graffiti
30. Car plate
31. Clothing tag
32. Tattoo
33. Sticker
34. Cereal box
35. Year book
36. Blueprint
37. CAD diagram
38. 3d max drawing
39. Video game- classic i.e. pacman
40. love letter
41. classic do you like me, do you love me, maybe note.
42. New car sticker
43. Error message
44. Blue screen of death- BSOD
45. Shot of PC keyboard over head with actual sentence on keys
46. Cell phone screen
47. Syllabus
48. Menu
49. Stain on clothing
50. Tshirt
51. Beer label (product label)
52. Bible
53. Text book
54. White board
55. Chalkboard
56. Side of police car
57. Taxi
58. Bus carrel
59. Rapid transit
60. jumbotron – AKA bill screen at major sports game
61. words in plants, i.e. corn field or crop circle
62. objects like: pencils spelling words
63. note cards/recipe cards
64. library/shot of books with titles as sentences
65. composition book
66. water or liquid spilled that says word
67. car dashboard
68. car radio
69. ipod
70. building lights
71. record/album covers/45s
72. wires next to engine
73. electric circuit board
74. engine
75. building/marquee
76. theatre marquee
77. cheap arrow sign
78. a church sign
79. handwritten handbill
80. flyer on pole
81. street signs
82. street markings
83. chemistry compound
84. math equation
85. food?
86. Karaoke screen
87. Class schedule
88. Electrical box/panel
89. Computer/server panels/hardware
90. Bathroom wall
91. Bumper sticker
92. Tread of shoe
93. Condom wrapper
94. Tampon wrapper
95. Prescription bottle
96. Band poster
97. Pencil marking
98. Wall wart marking
99. Elementary class picture with the little sign held up
100. Mimeograph
101. Dot matrix printout / greenbar print
102. Plotter
103. LED screen on a device
104. Christmas lights
105. Etching (on glass, etc.)
106. Engraving
107. Embosss/deboss
108. Lettraset
109. Shaved into a head
110. Carved into skin
111. Embroidery
112. Burned (into leather, into skin)
113. Watch face
114. 80’s-style name-necklace
115. grill (car or teeth)
116. touchscreen
117. written on hand in sharpie or ink
118. carved into wood
119. facial hair
120. pinstriped/detailed onto a shiny vehicle
121. rust
122. algae
123. vines
124. flowers (contrast color in a field)
125. ink
126. calligraphy
127. pencil
128. eyeliner
129. crayon
130. pastel
131. pain (oil or acrylic)
132. wide roller/paintbrush strokes
133. lite brite
134. etcha sketch playdo
135. reflection in water?
136. Ice image?
137. Smoke
138. Oil in water
139. Façade of typical advertisements, i.e. Malrboro man
140. Semaphore
141. Braille
142. Fast food menu/sign
143. Morse code
144. Spider web
145. Hair
146. Calendar
147. Toilet water,etc
148. Spills: salt, ketchup, oil, liquids, solids
149. Side of box
150. Fingerprints
151. UPC bar
152. Binary
153. Hex
154. Octal
155. DORK
156. Side or star trek enterprise
157. Klingon looking words
158. Board game
159. Scrabble
160. On a bass/kick drum
161. Stamp
162. Graffiti stencil/template
163. Veins
164. Medical equipment/ IV/syringe
165. Old medical text – old medical text
166. Dictionary entry
167. Pig Latin
168. Jive
169. In a programming language: C syntax
170. Taxi cab driver badge
171. Driver license
172. Passport
173. AARP card
174. Mugshot
175. Car emblem/make/model logo
176. In frost on window/i.e. car
177. Face painting
178. Pattern on an animal i.e. cow
179. Pattern in fabric
180. Embossed/cheap when you were a kid sticker/label thingies
181. Airbrushing
182. Cords
183. Tracks in snow
184. Side of a NASCAR
185. In grain of wood
186. Welds
187. Side of maintenance truck
188. Jeans logo on pocket
189. Side of ketchup/condiment bottle
190. Cheap car flyer on windshield
191. Written in lipstick on mirror
192. People in crowd/stadium/ spelling words
193. Ala television snow
194. Written in dirt
195. XRAY
196. Electron scanning microscope
197. MRI
198. Petri dish
199. Sign language
200. Stars/astronomy map

Time to think about security, again.

We'll ignore Wintendo. Let's talk about the best consumer personal OS: OS X. Truly a beautiful marriage of technical substinance and elegance. But aside from asthetics, we also should not be idle waiting for vunerabilites to hit us. They will. I promise you. Do be complacent. All OS X users should do the following:

1. Run ClamAV OS X or another virus program with updates. For now you can clean the Windows virus off the stupid Word doc your boss sends you. But don't fet your time will come OS X users.
2. Install (and buy) Little Snitch to tell you when software wants to connect and leave your system. AND be mindful of when you grant software a cart blanc to connect.
3. Enable the root account with a strong password. I mean STRONG.
4. Lock down your bluetooth to only accept know devices.
5. The same for your personal Wifi. Lock down your SSID fool!
6. And last for tonight. Lock your workstation when you go pee at Starbucks. How do I do that? I'm glad you asked. I spend 15 minutes trying to remember how I did it. Open Utilities->Keychain Access.app. ->Preferences->'Show Status in Menu Bar'. Now you have a padlock to lock your screen. Enjoy.

Another Firefox plugin idea.

I love Internet Security. I love reading about it and thinking about it. There's a technology that's been on the horizon for a couple of years that hasn't picked up steam called, "Port Knocking"http://www.portknocking.org/.

I like to be able to connect to my systems at home via SSH, but opening firewall ports can create a headache. Like the time I got 30,000 emails to my mindspring email account b/c I was getting ping attacks from China. Yes, that's correct, 30,000. I couldn't login to my webmail nor send/receive. So I had to hurriedly connect via POP and download/delete the whole batch of messages saying "ALERT: Connection Attempt Failed..."

Back for port knocking...

So having a firewall with SSH open to the public makes me uneasy. What can be done to mitigate this? Well beyond closing all SSH to public is an option, but then that means I can't grab a file or do something I want from anywhere.

A solution idea: blend port-knocking and SSL to make a dynamic firewall that appears like a blackhole to requests unless a special and specific request is made. Then the firewall opens the desired ports to that IP Address alone for a short period. Initially I thought a port knocking Firefox plugin would be cool. Install and it remembers port-knock sequences for you and just bring up the target servers and it will negotiate and get you in. But now I think combining a port knock sequence with a client certificate or some sort of PKI messagfe would offer very good security and make it hard to watch port knocks and copy them. I'll keep thinking.

Wednesday, November 08, 2006

Security, Shields up and Man in the Middle SSL...

So I was listening to TWIT and Steve Gibson of Shields Up fame riding a plane back from San Jose on Monday evening, yeah a red eyeSteve talked about a quasi man-in-the-middle SSL tactic that corporations employ (http://www.twit.tv/sn64). I started thinking, there is no reason a Firefox plugin couldn't alert a user this was happening to their SSL connection. I've never written a Firefox plugin (yet). But the premise is pretty simple:

1)User requests https://somehost.com
2) Widget corporation creates a false cert for https://somehost.com and SSL session is started.
3) Firefox looks at said cert and requested URL. Inspect the cert, the issuer url, and the requested url and compare.
4) alert if the cert signing chain doesn't resolve to Verisign or an external party.

So that would be a cool tool for all the paranoid corporate users. I'll leave the idea here for now.