the ineffabe serialhex

software gardens and occasional rants

What Could Possibly Go Wrong?

after reading this slashdot article, i got mad. very very mad. my job, what i want to do with the rest of my life, is design non-organic sentience (not robots, as it’s too close to another derogatory term) and this is just wrong. automated killing is simply wrong! there must be a cost to war, or we shall always be at war. and not just a monetary cost, if you are going to kill people, there should be a risk of people killing you! otherwise whatever government / fanatical group / corporation makes or uses these devices first will have a way to indiscriminately kill people whenever, wherever and however they feel.

if there is no cost associated with war, then what is to stop us - or anyone for that matter - from dominating and enslaving other people? Quis custodiet ipsos custodes? to the extreme also. would you like it if the current president, or any president for that matter? what if china got their hands on this technology? would you like to have a totally automated robot indiscriminately fly down and kamikaze down on your kids while they play in a playground?

now, i do want to create non-organic sentience, i do think we should continue to do research in this direction. i simply feel that we - and everyone else - needs to become responsible, lest we enter into the second renaissance (which, by the way, i think is much more likely scenario than the ones in R.U.R. or the Terminator series…)

so be careful, and don’t trust people who promise to make war simpler or easier to wage because we don’t have to send out sons and daughters out to kill for us. sending our soldiers out to kill should be our last option, and keeping our soldiers flesh-and-blood will help us keep it that way.

Windows Is Fucking Stupid - Part 1 of Many

so i hate windows. yes, hate is a very strong word, so i’ll say it again, i HATE windows! yes that is exactly how i feel. and i am not ashamed to say it. right now i am griping because of its stupidly slow update process. it is stupid how slow it is. and usually i don’t have to worry about it, i don’t have to worry at all. but yesterday i booted into windows (after about 3 months of not being in windows) and there were (of course) a whole lot of updates to do. and that’s fine, and to be expected. what annoys me is how long it took to do the updates! and then how long it took to shut down after doing the updates, and ZOMG! how long it took to get BACK INTO WINDOWS AFTER DOING THE UPDATES BECAUSE IT HAD TO FINISH DOING THE UPDATES!!!! and whats worse? it had to restart my computer and THEN AND ONLY THEN after finishing MORE updates when it was starting up, did i get let into windows…

that is just sad. on my archlinux computer at work, i didn’t do any updates for over a month. one day i decide to update and sudo pacman -Syu in a terminal and forgot about it. i had 500M of downloads, and it was going to take ~1G of space on my hard drive (apparently KDE just updated a bunch of stuff). i forgot about the fact that my computer was updating, and didn’t even know when it finished updates, or was even reminded that i had updated the next time i got on the computer. my computer simply did what i asked and got the hell out of my way. THAT is what a computer i supposed to do, that is what any decient helper would do. they do what the master/guru/whatever says, and gets out of his way so he can do his work easily. do you think painters and architects and other skilled workers want flies buzzing around them all the time while they are trying to work? THAT is what windows is to me, a hoard of flies that constantly buzz around me while i am using my computer.

which is why i am proud to use linux, it lets me get shit done.

…and laugh at a cat jumping in a box and falling over

File Transfer

after reading this: xkcd: file transfer i realized, that there is no cross-platform, easily accessable file-transfer program. or even a decient method to transfer files from one person to another. this is just sad. the intarwebz has been around for what? ~50 years now??? (1973 so sayeth wikipedia so 38 years) and yes, for he tech-savvy people there are a number of different ways one can go about sharing files. setting up ftp servers or having it hosted on a website of some sort… i know i can (and have) shared files with people via my github account. though sending an e-mail to my mom in the next room so i don’t have to deal with flaky windows networking & file sharing is, IMO, fscking retarted!! i mean, really? and if i want to share something with my brother in NY one or the other has to have an ftp or some such set up… and that is just a pain!!

what to do? what to do? maybe make something cool??

Problem Solving

so i am really really bad at doing homework. or really any work that i am not forced to do. though when i am doing any kind of work, it is pretty much a prerequisite for me to have some kind of music playing in the background. which - as far as i can tell - is normal for most people.

just recently college started back up, meaning i have LOTS of work to do. i have work at my job, i have class work to do, i have my various programming projects i am working on (most of which i am HORRIBLY slacking on, look at my blogophone for evidence of that). and, as i said, i like to listen to music while doing those various projects. what is kind of nice is i was recently given a laptop. it’s nothing sporty, a simple 1.8 ghz celeron m processor w/ 1 gig of ram. it’s almost as slow as my ‘server’. (yes, my ‘server’ is slower than that, and it is a laptop too, with a broken screen).

so what does this have to do with problem solving? well, my laptops sound card is flaky. when i plug in headphones, sometimes it works and sometimes it does not (required if i’m not going to bother people, and i have better sound through headphones anyway). and i spent >2 hrs trying to fix the problem. unfortunately, i suspect that it is a hardware problem, and thus i am left with 2 options: have no sound, or get an external sound card. i don’t like either solution, especially since i have little money to spend on a sound card (if i had $$$ i’d have bought a spiffy laptop myself). also, i have lots of work i need to do for my classes and thus can’t futz with the sound problem for hours and hours on end making sure it is a hardware problem. and without sound… i am lost.

BUT THERE IS HOPE!!!

my main computer has sound. and all my music is stored on it. and it’s always on anyway, so, i’m tethered to my main computer though my headphones, and doing my homework on my laptop, with its bigger screen (and occasional freezes). so i have traded portability for sound & a bigger screen (and slower performance).

now all i have to do is figure out how to get me to actually do work, instead of just being lazy and update my blog all day long :P

Productivity Matters

so i finished watching this video on productivity and i realized, i’m much more productive when i don’t have a job than when i do. that’s not to say that i don’t do my work well, or even enjoy my work. but i’m more ‘i just did the laundry’ kind of productive than ‘i made my or somebody elses life better’. though in a sense fixing peoples computers makes other peoples lives better (usually they can get some work done, or look at more porn) but it definitely dosn’t make the lives of people immediately surrounding me better… except now i have more money & can take them out to lunch or whatever, though that’s beside the point. really i have’t done any self-study, i havn’t learned anything new since i got my new job. and while i love being able to work and ‘do something productive’ i feel like i’m slacking on other parts of my life & education. and while i’m not about to quit my job, it’s something to think about. i do my best learning when i don’t have any requirements of me. when i can just be and relax and learn on my own. something i must ponder on further…

Tools I Am Totally in Love With…

ok, so here are a few tools i am totally and completely in love with:

Sublime Text 2

currently in public alpha (i’m using the latest build #2065) sublime text 2 is a stupid awesome text editor it does everything one could want a text editor to do. and it does it simply and elegantly. and it has BUNCHES of highlighting schemas… which has always been a pain for me. if you’re going to do syntax highlighting, i want it to highlight every type of syntax i work with!! (most FOSS dosn’t cut it in this respect… read on!) i imagine that this is kind of like textmate on OS X but i don’t know because textmate is only on OS X (which is really freaking annoying!!!). so if you are looking for a really good text editor, with really nice controls & really spiffy & really easy to use ui, get it! when i have the $$$ i’m buying myself a license!!! no it’s not open source, but it’s so cool it doesn’t have to be!!! so go out and get it… NOW!!!

Yakuake

so WTF is Yakuake?? from the wikipedia article it stands for “Yet Another Kuake” apparently after a terminal named Kuake that wanted to emulate Quake’s terminal… IDK if it succeeds or not, but i do know it’s freaking sporty!!! from what i understand it has some features that gnu screen and tmux are good for, which is screen multiplexing. and with some simple keyboard commands (ex: ctrl-shift-t splits the current console top to bottom, ctrl-shift-l splits it left to right, shift-tab switches to the next terminal on your screen, ctrl-shift-n brings up a new window tab, shift-left_arrow goes to the tab to the left, and i hope you can figure out what shift-right_arrow does…) what’s really nice is that most of these keyboard commands are common between lots of pre-exsisting applications, so i don’t ahve to invest much (if any) time in learning them. truth to tell… i’ve only had Yakuake for a few hours and i found out about the screen splitting stuff on accident (ctrl-shift-t in konsole gets a new tab… which led me to see my console window split in half)…

one of the nicer aspects of it though, is that it is a drop-down terminal. hit F12 and it drops down. do what you need to in the console. hit F12 again, and it’s gone!! i LOVE tools that get the hell out of my way when i’m working!!! i shouldn’t have to beg the tool to do what i want it to do, or get out of my way. (one of the big reasons why i’m not on windows, the whole OS seems to get im my way!!!)

will add more as i find more

Awsum Downloader of Awsumness

I HAVE DONE IT!!!

done what exactly? i have made a spiffy program to automagically do BUNCHES of work for me. see, i wanted to a bunch of images from a website, and downloading, renaming and saving all (103) files was going to be a pain in the ass. so what did i do? i did what any self-respecting programmer would do: i wrote a program!

ok, so it may not be the coolest program ever, or even nicely commented, or even error corrected, or hell, even error checking. in fact it’s more of a kludge than a truly effective and versatile program. and so i am here now (at almost 2am) to describe how i did it!

it’s a complete hack, but it works

yeah, so i hacked this thing together in ~1.5 hrs maybe more, but whatever. so here is the code (with names changed to protect the innocent):

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#!/usr/bin/env ruby
require 'nokogiri'
require 'open-uri'
require 'pry'
# gets webpages of links and such
puts "getting the main pages..."
docs = [] # i hate doing that
(1..6).each do |n|
page = "http://sumwebsite.com/thing/stuff/moar/#{n}/"
puts "-- getting page: #{page}"
docs << Nokogiri::HTML(open(page))
end
# gets the objects 'm interested in'
puts "selecting stuff from the pages..."
stuff = [] # to keep this beotch in skope
docs.each do |doc|
doc.search('div').each do |div|
next unless (div['class'] == "product_grid_display")
div.search('a').each do |a_tag|
next unless (stuff << a_tag['href'])
end
end
end
# moar blokz!!
puts "getting the images..."
stuff.each do |page|
puts "-- retreving from page: #{page}"
file = '' # makin things sure to stay in skope
title = ''
doc = Nokogiri::HTML(open(page)) # the previous one isn't in skope n e moar!!
doc.search('div').each do |div|
next unless (div['class'] == "imagecol")
obj = div.css('img') # searches fo krap
title = obj[0].attributes['title'].text + ".jpg" # huzzah for chaining methods!!!
img = obj[0].attributes['src'].value
open(img) do |info|
File.open(title, "w") do |file|
puts "-- saving: #{title}"
file.write info.read
end
end
# yeah, so far thi isn't very DRY at all.. in fact it's fucking WET!!!
end
end

note: i am going to fix the coloring… eventually. for now read the gist

so one of the first things you’ll notice are my requires @ lines 3-6. i used nokogiri for all the parsing stuff i had to do, and since i’ve never used nokogiri before, i had a LOT of debugging & learning to do, so i used pry all. over. the. place. like where?? like EVERY-FREAKING-WHERE when i was first writing this. being able to binding.pry in my source & then cd & ls -a around and play with objects allowed me to figure out what methods, say doc had in line 20 (yeah, i stuck binding.pry right after the block there to figure out the right set of doc.search('foo') strings would work.)

now, most of the code is kind of self explanatory, if you like reading a kludge and you’re not doing that at 2:15am :P so essentially it works like this:


  1. get each of the webpages that have links to the stuff i’m interested in (that’s the first block)

  2. from those pages, go into the div class thing that is equal to "product_grid_display"

  3. while in "product_grid_display" search for all links, and thow them in an array we’ll use later

  4. then, finally get the images. have a file name and title i’m going to store this stuff in (i could have probably taken them out of their initial scope, and left them in the inner block, but i’m lazy)

  5. search for the div class tag "imagecol" and then search for img tags, grab the title from the mouse-over text (origionally it was going to be the header text, but when i realized that the same text was here, i decided to grab it from here as it’s one less block of code i’d have to write) and the actual image.

  6. then, open the image, and save it to a new File in the same dir as the script (yes, i am very lazy).


initially there was a lot of me going back and forth between sublime text and my binding.pry instances, but eventually i got it working enough that i felt comfortable running it. i did have one hiccup while running it for real: apparently my connection faltered and i couldn’t grab a file, so it died (horribly) on me. i simply ran it again and it went ahead and re-downloaded everything and i had no problems!

so now i feel all sorts of spiffy!!! maybe this kludge will help someone else a bit.

OH!!! AND I ALMOST FORGOT THE MOST IMPORTANT THING!!! none of this would have been possible without google chrome and it’s spiffy inspect element thing in the right-click menu!!! it allowed me to figure out which freaking <div class="foo-fucking-bar"> thing that i had to go into in order to get the info i needed! yes, chrome rocks, and if your not using it (or the open-source version chromium which is what i’m actually using as theres no package for chrome on archlinux) then u r LAME!!!! unless you’re on a mac, then you’re maybe excused, but definitely not if you’re on a mac using internet explorer… then you should be burned at the stake, alive, while on extacy to make it that much more excrutiating and long-lasting!!! (yes, i have no pity for M$)

p.s. i need to re-up my markdown skillz or something… or maybe my css/sass skillz… yeah, probably the latter, and a little bit of the former, but what’s even more important is sleep… so i shall do that now!!

p.p.s i kind of like the black background on the code… i might change my whole wite to be like that… i dunno yet, we’ll see………