comparison of Fixnum with String failed
Where the error occured
Rails 2.1.2 / bundle_fu / Javascript fileWhy the fu…?
A javascript files that ends with a line commented out. -1 is being compared to an empty string.Fix
Add a blank line at the end of the Javscript file(s) that end with commented lines.shelling out to the man
# stupid simple shell command - from irb or a script to get file listing system 'ls -al ~/jeremy '
In ruby script: Return the result of a command line operation. Without back-ticks ruby will just return true or false from the exit of the issued command. [wikipedia backticks - computer related]
# the path to ghostscript on the system without the newline character on the end gs_path = `which gs`.strip # use the path to convert a file outside of ruby - will return true or false system %(#{gs_path} -q -dSAFER -dNOPAUSE -sDEVICE#tiffg4 -sOutputFile#foo.pdf foo.tif -c quit 2>/dev/null) # if I want the output from the command suppressed so it doesn't spew oodles of info (after I'm sure it works - it will stop useful errors as well) `#{gs_path} -q -dSAFER -dNOPAUSE -sDEVICE#tiffg4 -sOutputFile#foo.pdf foo.tif -c quit 2>/dev/null`
Ruby Docs have massive amount of info about ERRNO (whatever the fuck it is - i'm guessing errors and such but haven't learned it yet). These error objects matter greatly and I think ruby has them wrapped up in a rubish way, but as I said I'm ignorant at the moment. I guess there is shorthand for error objects: $! - last exception; $@ - backtrace; There are many more of these. (whimper!)
violating the linksys rvs4000
So I google my incompetence as usual. Search for "rvs4000 ftp" and you get a whole lot of what you already know. The shits broke. No ones gonna fix the shit. You're ten kinds of fucked if you want to ftp anything, ever.
So I roll a search on the processor "star 9202" which drops me a few gems of badassery:
Hacking the WRVS4400NX Stock Firmware V1.1.03 for Full Linux Shell Access
http://openwrt.org/logs/openwrt.log.20071102
Not my model - but it appears the only difference betweenRVS4000 and the WRVS4400N is that the WRVS4400N has a wireless chipset - that is a separate processor to run the wireless services with.
So they seem to be the same except one does wireless and one does not. So I go to the diagnostics pages of the administration ui and start pasting in the different commands from the "Hacking the WRV44...." post to see what happens. No dice. The ftp no longer works - probably a good thing - so I start stumbling around the web glossing over many pages of stuff about busybox. I try pasting in all kinds of shell commands into the way not secure 'Traceroute Target:' field when I happen to get a command to try off of the busybox wikipedia page: ';/bin/ls' - I paste-a-bitch and wa-la:
ARARPTable.htm AccessRes.htm Administration.htm AppGaming.htm Backup.htm DHCPClientTable.htm DMZ.htm Diagnostics.htm EditList.htm Factorydefaults.htm FirmwareUpgrade.htm Hidden_telnet.htm IM-P2P.htm IPS-N.htm LocalNetwork.htm Log.htm Ping.htm PortRangeTriggering.htm QoS.htm Quick_vpn_setup.htm RVS4000_Admin.pem RVS4000_Client.pem Reboot.htm Report_Pic-n.jpg Routercfg.cfg Routing_Table.htm Security.htm Setup.htm Setup_MAC.htm Setup_lan.htm Setup_routing.htm Setup_summary.htm Setup_time.htm Setup_wan.htm SingleForwarding.htm Status.htm Summary.htm UI_02.gif UI_03.gif UI_04.gif UI_05.gif UI_06.gif UI_07.gif UI_10.gif UI_Cisco.gif UI_Linksys.gif VPNPassthrough.htm acl.htm cisco.css down_chart.jpg err_msg func.js fw_version.pat help index.htm info.htm ip_conntrack.htm left.gif linux.js log_data.htm log_outin.htm middle.gif mm_menu.js msg.js new_rule.htm po1_0.gif po1_1.gif po2_0.gif po2_1.gif po3_0.gif po3_1.gif po4_0.gif po4_1.gif ppp_log qos_service_managment.htm quickVpnStatus.htm raw_data.htm reboot_guage.htm report.htm restore_config.cgi rh_bg.gif rh_cisco.gif right.gif rvs4000 service.htm set_vpn.js setup.cgi switch_8021x.htm switch_diagnostic.htm switch_dscp.htm switch_mirror.htm switch_param.htm switch_port.htm switch_qos.htm switch_queue.htm switch_rstp.htm switch_status.htm switch_vlan.htm switch_vlan_mem.htm switch_vlan_port.htm table.jpg table.png tr069 tracert.htm trash.gif up_chart.jpg upgrade_flash.cgi upgrade_pem.cgi upgrade_sig.cgi upload_lang.cgi vpn_adv.htm vpn_main.htm vpn_summary.htm vpnsum.htm wan_0.gif wan_1.gif
Would you check that the fuck out!?! 'Hidden_telnet.html' I (again) paste-a-bitch and HOT DAMN if I don't get some purty radio buttons. And after i click yes in the little circle and save the settings hot damn if i don't have an insecure as all holy hell no login needed telnet accessible router spread wide open and waiting like a rufied sorority pledge coed at the frat kegger... and a quick test of my dyndns enabled domain confirms that yes, I do have world facing telnet access of my router sans any security. None, nada. Zero. Luckily I can uncheck my telnet access on my hidden telnet access page and then save settings so I longer have hidden telnet access.
speedy:~$ telnet 192.168.0.1 Trying 192.168.0.1... Connected to 192.168.0.1. Escape character is '^]'. BusyBox v1.00 (2007.09.12-05:31+0000) Built-in shell (ash) Enter 'help' for a list of built-in commands. # help Built-in commands: ------------------- . : break cd chdir continue eval exec exit export false hash help local pwd read readonly return set shift times trap true type ulimit umask unset wait # ls Active_ALG.list linuxrc sbin bin lost+found tmp dev nat-pt_packet_stats_log usr etc proc var lib root www.eng # ls bin ash df ipaddr mount radvd umount brctl dhcp6-serv iplink nat-pt rm uname busybox dmesg iproute netstat sed vi cat echo iptunnel ping sh chmod flash_tools kill ping2file sleep chown gzip ln ping6 sysinfo cp hostname ls ps tar date ip mkdir pwd touch # exit Connection closed by foreign host.
Maybe I can use this knowledge to fix my ftp problem. Or to get my whole home network compromised.
rails rjs - things i learned the hard way | xi
too many div’s and things go POOF!
When you have a styled div set with an id inside another div on safari at least. I’m going to explore this further, but it seems at this point I’m stacking my nodes too deep, MEANING if a styled div is inside another div that is replaced by an rjs template which has a visual effect to appear the styled stuff inside the div inside the one affected by the javascript response will remain hidden while all the stuff around it will pop into view. Selecting on the screen around the blank areas will reveal the content. Use span’s or class declarations to avoid the same 4 hours of frustration I just had. Of course this could all be wrong and I’m foolishly pointing west when the true way is north. In any case it wasn’t working as expected and now it is so I am of the mind that I solved my problem, be it maybe for only a moment.
remember to float the containers holding the floats
And clear your floats. Boxes are a pain. Tables are ugly. Love thy stacked attributes.
That is all.
on the process of progress
things i learned the hard way | VI
Error handling in rails is very technical. The TextMate Backtracer Plugin has been invaluable to me in my development in recent days, yet it only gets me to the file(s) when something is amiss in the code.
Building and running tests is one way of confirming the functionality of your application, and I’m learning the power of good testing, be it quite slowly and with a lot of errors.I’ll get there.
Here is a short list of things I had to consider when flopping from code to browser during development and things kept blowing up in my face:
- Ruby/Rails has RESERVED WORDS. If you have a class/table that isn’t playing nice make sure you aren’t naming it with one of these. This is tantamount to pouring sugar in your gas tank. And then driving in reverse at full speed. While wearing a blindfold. With your hair on fire.
- Column names in your tables need to change with alterations to any class/model names, as well as any has_many/belongs_to associations along with any model inclusions in your controllers. If you’re not to invested in the code it’d probably be easier to regenerate a fresh app with the correct model/controller name. Running ./script/destroy (the arch nemesis of ./script/generate) can help in crime scene clean up, but you still have all those pesky symbols/variables/methods with the poison name throughout your app patiently waiting to spurt their demonic ire. Exterminate them with aggression.
- An objects information will carry from request to request in the session but you still have to stuff it into an instance variable inside whatever controller method is being called upon. I have a tingling sensation in my unmentionables that suggests session customization and databases can smooth out this bumpy road, but this strains the withering tethers of my sanity upon contemplation. I can only learn so much each day.
- Getting compile errors means you’re trying to bake a duck with a hammer on a string in a pail of kittens. It won’t work. Ruby/Rails doesn’t know or particularly care what you are trying to do, but how you are going about doing whatever it is you are trying to do will never, ever work no matter what. Get rid of whatever you added since the last time it worked and try again. Remember when you went to grandmas house and you had to take off your shoes and you weren’t supposed to go out into the field because you’d get muddy? Yeah, Rails has grandma rules that sometimes take all the fun out of life and make your feet cold.
Throwing away code is a part of development, just as throwing away designs is a part of being a designer. Having the willingness to let go of what’s not working makes room for what will. Even if what that is is nowhere to be seen at the moment.
things i learned the hard way | V.
imagemap rollovers with area shape="poly\
holy slow sudo port install mod_ruby
There is a ghost impression of the keyboard etched into the surface of the LCD screen from the oil left on the keys by my fingers. I have dropped, sat on, stepped on, rolled over, spit on, slammed shut, forced open, poked, prodded, wedged, and pried loose this poor machine during the 6 years, 2 SXSW’s, many business trips, not as many vacations, and 6 operating system upgrades of it’s life.Every time I do something beyond surf the web on grandpa pismo and it doesn’t start smoking or tell me to hold the power button down in 5 different languages I experience a trepid euphoria not unlike that experienced by a man who only hears the metallic click of the firing pin during a game of russian roulette.
Around minute 30 of hour 2 of installing mod_ruby using darwin ports (just to see if I could) I started to get nervous. I was using a wireless connection, the elderly (original) battery was at 50% and sinking and I was having a hard time staying awake. it was 2:30 a.m. which is actually 3:30 am to my internal clock seeing as we’re only a few days in to the daylight savings time switch.
Being the dedicated, task focused person I am I… fell asleep.
I have yet to assess the outcome of this latest haphazard command line escapade.
learned the hard way | I.
- USE ‘apachectl’ NOT ‘httpd’ to stop apache1.3 and release the port. THEN ’ sudo /opt/local/apache2/bin/apachectl -f /opt/local/apache2/conf/httpd.conf -k start ’ to get apache2 running. Specifying the full paths is how you tell apache2 it’s their turn to bat.
- apache2’s http.conf default took two days of my life away. Comment out the unique ID module line and blues skies will you see.
- to use new config use the command above, but replace ‘start’ with ‘graceful’
- alias and directory settings are a bitch.
One interesting twist is that the big bad scary complex command line has been demystified. I kinda got it now. Now when something doesn’t work I have a 50% chance of knowing what question to ask and where to look to find out what I’m not doing correctly. Prior to this point in time I would’ve had a snowballs chance in hell of fixing something on the command line if I broke it. This is what an optimistic person would call progress.
I started as a graphic designer (layout monkey) and it’s been a long road of learning by necessity how to make stuff with html, css, php, mysql, javascript, and now ruby/rails. Still learning. Always have been. Always will be. It’s a bitch.