designation agitator
jrails link_to_function hackaway
<%= link_to_function( "insert it", :id => 'foo') do |page|
partial = escape_javascript(render :partial => "my_partial", :object => Object.new)
page << "$('#my_div').append('#{partial}')"
end %>
Sweetness.
happens not adderall in the business of
fuckin' fuck, man.
module RestfulAclController
module ClassMethods
def has_permission?
alias current_user current_account
end
end
end
Then I required the file in the application controller:
require 'restful_acl_controller_hacks'
Now has_permission? works and my specs pass and all is right with the world. For about 2 minutes until I smash into another coding wall due to my lack of experience and inability to remember most things of importance related to OOP.stupid arguments
## controller code
def find_my_fucking_shit
@my_class = MyClass.special_method_in_model(params[:shit], params[:not])
end
## controller spec
# This will fail and you will want to punch a bitch in the nose because you spent two fucking days
# figuring you were just really goddamn stupid (which may be true) because it should work but it doesn't
it "should find shit" do
MyClass.should_receive(:special_method_in_model).with({:shit => 'will', :not => 'work'}).and_return(mock_my_shit)
get 'find_my_fucking_shit', :shit => 'will', :not => 'work'
end
# This will pass
it "should find shit" do
MyClass.should_receive(:special_method_in_model).with('will', 'work').and_return(mock_my_shit)
get 'find_my_fucking_shit', :shit => 'will', :not => 'work'
end
Yes, I know about hash_including(). For some reason it failed because ":action => '_controller_action_', :only_path => true" was being included in the with() arguments hash and it made the should_receive fail - even though hash_including is supposed to deal with this. It may be a rspec_rails thing. I have not dug into the rspec code very deep to see what I was doing wrong or if it's a bug or if the universe just hates me.
probable knot
Programming wasn't something that I thought I could learn a few years ago. I was a web designer. I struggled to xhtml/css as I tried to cut up the psd of a site design and make it into a web page. Even though it was what I did exclusively at that time as my profession, I found the end of every project a narrow escape from total annihilation. Rarely did the conclusion of a project leave me with a sense of accomplishment. The problem was (and still is) that design is so subjective. A clients taste, mood, corporate politics, over developed sense of competence, favorite color, or what ever can lead them to totally rip apart a well reasoned, professional interface design. Design is too subjective. Don't get me wrong on this, I understand that the client is always right and I was being paid to make them happy and not satisfy my aesthetic sense and motivations. It was the random and non-sensical ways they would destroy something I had spent many hours crafting. All that thought, research, and experimentation swiped aside on a whim by someone who thinks they know more about how to design a website than I do, and yet are paying me to make one for them.
What attracted me to the development side of things is the absolutes. A function returns the right value or it doesn't. It is all about consistent and repeatable results. A finite set of rules govern all aspects. You can always find a solution, and when you have it there is a verifiable outcome to confirm it. Not so much with the wild ass world of colors, images, tones, and narratives. I can learn the rules of the language and build outward in my knowledge and understanding. With design the rules are different in how you understand them and their application. Most importantly clients don't know a damn thing about programming, mostly convinced its dangerous magic that will burn them if they touch it.
Programming has the same potential for creative exploration. I know this, and I really want to get to a place where I have the familarty and experience with the tools to do some of this exploration, but I am constantly set back due to my lack of the personality and natural abilities of a traditional programmer. I really love logic and elegance, but I don't naturally think in numbers and equations. I do not have a mathmatical brain. I've always struggled with language and symbols, I was even diagnosed in my school years with a learning disability in english. I find it very hard to draw the lines between ideas and concepts and where I should practically apply them, more so how to go about even starting to. I do have breakthroughs though. I can hammer my head against an idea or programming concept for 12 hours straight and after I've broke it every way possible and read dozens of tutorials, blog posts, and book pages I'll suddenly have an intuitive insight into how to apply the idea to my problem and then I will rapidly sprint to a complete solution.
And I will only retain 20% of my understanding so the next time its almost like starting over. That is the most frustrating part. How little of the knowledge I retain that I've worked so hard to find. I write notes, comment my code, play with mnemonic devices to remember argument orders or function names but I still struggle and have to spend nearly as much time looking things up as being productive. And that's for the easy stuff. I have no idea if this is a normal experience or not. If other people find it as difficult to learn and retain the myriad of syntax, patterns, methodologies, and rules that are designed to make it easier to write things a computer can turn into machine code.
I really wish I knew how to ask questions. Most times it feels like if I knew what question I was asking I wouldn't need to ask it. That is, if I could articulate with words the difficulty I'm experiencing with something - the part I don't understand - just the act of coming up with those words would make apparent the answer. I also fear that my questions are probably one level or more below where I'm trying to work - such as I'm struggling with object type handling (like how to think about what an object is) while this knowledge is assumed and the stuff I'm trying to accomplish requires concrete understanding of enumerations, module mixins, closures, proc/lamda, or class inheritance.
So why do I do it? Partly because of the stimulation. I possess intense amounts of curiosity. Programming at times is so much outside my intellectual capabilities that I feel crushing demoralization, but those times I gleam some intuitive understanding of the inner workings of a complex system of events I become electrified. I beat the motherfucker! Ha ha universe! Fuck you and your abject indifference! I made this bitch work! Suck it!
What follows is a dark period of inactivity that lasts until the next struggle to learn, breakthrough, and crash. The cycle repeats and I learn and retain just a little more so that the next time I find out how to make the problems harder. It's not nearly as stimulating to solve something over again as it is to make what I want to achieve more complex.
rspec/cucumber/webrat - remember this shit
In a feature file you CANNOT comment out text on the end of a line - it will say your shit isn't implemented.
'test.local' is the URL rspec uses when running specs for controllers - so 'test.local' is the URL webrat/cucumber uses. Making possible testing of subdomain handling.
Single quotes are treated differently than double quotes - have no fucking idea why
Sometimes running features works - sometimes not. Putting the following in features/support/env.rb helped when some steps would pass when others wouldn't:
#Seed the DB
Fixtures.reset_cache
fixtures_folder = File.join(RAILS_ROOT, 'spec', 'fixtures')
fixtures = Dir[File.join(fixtures_folder, '*.yml')].map {|f| File.basename(f, '.yml') }
Fixtures.create_fixtures(fixtures_folder, fixtures)
This will ONLY work if I have fixtures defined for my models. I need to get with the automated fixture hipsters.
things i had to do to make mephisto 0.8.1 (kinda) work with rails 2.2.2
replace in config/environment.rb:
config.gem 'will_paginate', :version => '>= 2.2.2'
with this:
config.gem 'mislav-will_paginate', :version => '>= 2.3.2', :lib => 'will_paginate', :source => 'http://gems.github.com'
comment out in config/environment.rb:
config.gem 'tzinfo', :version => '>= 0.3.12'
I had to add:
require 'liquid'
require 'will_paginate'
to config/initializers/mephisto_init.rb
change line 17 in the index action in app/controllers/admin/articles_controller.rb to this:
@articles = Article.paginate :page => params[:page], :per_page => params[:per_page], :conditions => ['site_id = ?', site.id], :order => 'contents.published_at DESC', :select => 'contents.*'
remove tzinfo from vendor/gems/
commented out erb tags on line 32 and 37 of app/views/admin/settings/index.html.erb.
32 <dd><%#= time_zone_select 'site', 'timezone_name', TZInfo::Timezone.all.sort, :model => TZInfo::Timezone %></dd>
33 <dt>
34 <label for="site_lang">Site language</label>
35 <span class="hint">Used to specify language in your site feeds</span>
36 </dt>
37 <dd><%#= f.text_field :lang %></dd>
Now I can't set the timezone or language of my rss feed until I figure out how to get the rails version of TZInfo::Timezone to not give me a NoMethodError
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!)
dumb cluck bluster
WHat the fUck att? Pricing plans that are thought up by cock sucking zombie demons? I swear to god you are the corporate equivalent to a kiddie diddling uncle. I wanted an iphone. Now, not so much. Such a beautiful device. But - if I want one - I have to promise not to tell my parents that you touched my doodoo hole with your cabbage club. Fucking jackasses.
With straight faces they take a beautifully simple piece of revolutionary mobile technology and fuck it all up with their greedy antiquated pricing structures and predatory contract practices. If you motherfuckers can't compete in a way that doesn't harm customers get small or die. Bundled services are going to destroy us all. Is a phone a consumer commodity or a utility? Yes, punish me for taking my phone with on the way out.
That ice tea your drinking? I put my dick in it before I left. cocksucker.
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.
all time is show time
So much cool art and music. So many things to see and photograph, to program or design. Defeat mists as if everyday were november. Just cold and dreary - a world without edges and star patterned light even after I close my eyes... I hear the fading spots of light behind my eyelids as noise. Tastes like regret and trench mouth.
I consume all waking hours with the next in an endless series of code block comprehension - roots and procs and closures - user permissions, ports, boot order, type class member public access attributes domain language logic and does active directory like me, I mean like LIKE me?
I know better than going nuclear but did that bitch process id 5320 ask my fucking permission to go 98% on the dual cores? So I kill a bitch and the RPC server asphyxiates on satan's forked cock and I know the next 60 hours of my life will include little sleep or food or spaces outside of the six inches in all directions immediate to my current sorry ass. Not that I sleep much now as I am either chasing a misguided notion or failed logic into incompetence's ridiculously complicated evil genius death plan disguised as word filled meaningless documentation written as if you obviously know what the fuck it is if you're reading this so I'll make it past tense and inside jokey and all you not in the know bitches can suck a muthafuc...
Yeah. It's like that. Ain't no desperation in re-factoring - just shame.
I spend a lot of my time angry at the universe. Out of focus pissed in all directions. And alone in my house. I've become an unattractive blight. I did always aspire to be a cancerous spot of disruption in the collective consciousness - some nothing coulda has-been - not like that but worse and full of ambitious hopelessness and vile words and love of puppies.
this was supposed to be about how I have no time to listen to all the music i've [sarcasm]bought legally[/sracasm] or any of the other media consumption products and methods I desire as experiences while chasing the american dollar and avoiding bosses and reviews and vacation requests and office politics and compromise - the shit that makes me think streaming hot red from majors into the drain is on a short list of options for a way out that doesn't involve waking up tomorrow. because fuck that. because i said.
extended toil
pander dander
There is a little spark of shallow enjoyment to be found in spending far more time writing code than reading about writing code. But fuck me if the problems don't get more complicated as I gain more understanding. Despair clusters blot out my will as I slouch in my seat at the certainty of my spending the next week 16 hours a day writing code I'm going to be dissatisfied with. Because if i was smarter or better at paying attention or could formulate and retain the complex abstractions in my head and see how all the different platforms/languages/workflows/processes/types would most elegantly tie together if I could just muster up a little more understanding of the complex meta programming design patterns or transparent type conversions using format bridgeing with json/soap/xml-rpc/REST/clr interconnections over web services using a distributed grid network. But since I can't my code is shit. I am that which those who know mock. This is why I rarely leave the house.
Just because I get it doesn't mean I got it. After all, you can drive a car quite well without knowing how to rebuild the carburetor.
