How to select multiple elements dynamically using jQuery
&& [ Programming ] && 0 comments
I’m a bit of a jQuery noob, but I love it. Recently I came into a situation where I wanted to be able to select a bunch of input elements on a page that shared the same first part of their ID’s. Not only that but it had to be dynamic - that first part of the Id had to be stored as a variable rather than be hardcoded. jQuery’s selectors, like input[] do not allow you to use variables. However, it is possible to use the filter() method to select what you want from something more general.
So lets say I have something like this:
<input type="text" id="qac1_59"> <input type="text" id="qac1_60"> <input type="text" id="qac1_61"> <input type="text" id="qac2_65"> <input type="text" id="qac2_66"> <input type="text" id="qac2_67">
But I only want the first group (qac1), and the 1 is an attribute of the clicked element(can also be from anywhere, passed into the fucntion for example). I can do this:
$(".radio-box").click(
function(event) {
var mainId=$(this).attr("mainId");
var comment = $('input[type="text"]').filter(function(){
return this.id.match("qac" + mainId + ".*");
});
});
This will return all the elements that start with qac1 and you can now perform actions on them, such as comment.val(). The filter() method takes regex expressions so you can do all sorts of interesting stuff with it. Hope this helps. Cheers.
Your Bike Frame And You
&& [ Cycling ] && 1 comments
It seems every ride I go on lately isn’t complete until someone gets into an argument about which material makes the best bike frames. Face it, we’re kinda religious about that stuff. Its almost like defending your major in college or something else equally as meaningless. In any case, I know where my allegiances lie, but I thought I’d make some insulting generalizations at everyone’s expense anyways.
[caption id=”attachment_448” align=”alignright” width=”358” caption=”Its made of a bunch of straws . er… strands.”]
[/caption]
PLASTIC
Its actually considered glass, ok. Besides, I like to call it carbon. If you want to get really technical, it’s actually Carbon fibre-reinforced polymer or CFRP for short. My bike is at the forefront of technology with it’s amazing strength to weight ratio and fancy shaped aerodynamic tubing. All us pros are on it, and for good reason. Its the lightest, stiffest most expensive frame material out there. Oh crap, I accidentally laid my bike down on some moss covered rock during a beat-per-minute break. Whats that? the whole frame is now unrideable? Lame. Good thing I only spent a few grand on it, and this guy can manufacture some more materials to make me another one. (Actually a worker from a carbon plant).
Steel is real, man. I couldn’t imagine riding anything else. Probably because I haven’t for the last 50 years… nevermind. Those carbon guys have it all wrong. Steel is the heaviest, mushiest, cheapest frame material on the planet. It has the best ride quality, because in my head I can imagine that the nearly indistinguishable flex of the frame helps absorb bumps in the road or trail. Also, its kinda ironic to buy an expensive new frame made from the oldest bike frame material ever made - which is exactly why mustache toting, kale munching, rayban loving militant recyclers often choose steel as their frame material of choice.
ALUMINIUM AL-ew-MIN-ee-əm
Hi. My name is Steve. Steve Johnson. I ride aluminum because it is strong, light and relatively inexpensive. Also, they carry it at my local bike store. What can I say about my bike? There are thousands others just like it. I like it. It’s got some cool decals on it. Once I was riding and nobody told me that they liked my bike. Actually, thats every ride. Oh well. My good personality makes up for it.
I’ve always wanted a wood bike. 100% renewable, clean energy, pedaling machine. Its so green. Good thing my multiple investments in Amazon Lumber, Inc have gotten me to the point where I can finally afford one! Plus it looks hot on top of my Audi! My only complaint is that once I rode it to my local coffee shop to get my daily macchiato and when I came back outside, some punk had burned the thing down to the ground.
TITANIUM.
I know whats up.
Seriously who cares! Just ride the damn thing!
Best Bash Prompt Ever
&& [ Linux, Technology ] && 3 comments
Ever wish your command line was a little more friendly? Maybe you’d like to add some emotion to your static computing environment? I give you the smiley face bash prompt!
[caption id=”attachment_441” align=”alignnone” width=”495” caption=”Font is terminus, btw.”]
[/caption]
This bash prompt displays a green smiley face or a red frowny face depending on the return status of the last command executed. To use it, insert the following code to the end of your ~/.bashrc file:
PS1=”[\e[01;32m]\u@\h [\e[01;34m]\W `if [ \$? = 0 ]; then echo -e ‘[\e[01;32m]:)’; else echo -e ‘[\e[01;31m]:(‘; fi` [\e[01;34m]$[\e[00m]“
Happy (or sad) computing!
There is no Job Quite Like This
MyTime Time Keeper
&& [ Technology ] && 2 comments
I created a time keeper program for my final in Databases class. Its actually pretty useful if you have several jobs and you want to be able to keep track of your time and earnings. Its written in php/mysql so you will have to have webspace to host it. You can read more about it here:
http://www.austinriba.com/projects/mytime-time-keeper/
Typical Blog Post
&& [ Bizzare, Cool, Entertainment, Music ] && 3 comments
Just lounging around, thinking I’m gunna throw some stuff down right here.
[caption id=”attachment_410” align=”aligncenter” width=”432” caption=”Anyone that can explain this picture to me gets $2”]
[/caption]
First, let me share with you some music that others have shared with me. I have not posted music for a very long time and this is just completely different.
Gotta thank Fitch for this one. Some good real music with a little bit of synth to make it nice and cracky. Self titled album is really good.
Heres from Andrea (as usual) Black River Killer by Blitzen Trapper, natives of this here fine state. I’m a sucker for music with a good story.
Blitzen Trapper - Black River Killer
Here is a really cool art installation:
Check it out. That was 3 media types in one blog post, all having absolutely nothing to do with eachother. I love the internet.
Getting a Dell 1555, 1557, 1558 to Suspend in Linux
&& [ Technology ] && 0 comments
EDIT: The suspend/resume patch has been included in 2.6.33.4 However brightness control with a dell 1558 is still broken without patches. I have uploaded precompiled kernel packages for Arch linux here which solve the problem. You can find patches for other distros here.
Dell Laptops with model numbers 1555, 1557 and 1558 have issues with suspend and resume on linux, there is a patch, but it has not been included in the latest kernel version yet.
I have sucessfully gotten my new Dell 1558 to sleep and wake using a patch I found here. The patch is for the linx kernel, specifically drivers/acpi/sleep.c It adds just a few lines.
For those of you using Arch Linux, I’ve uploaded the patched kernel packages here:
http://www.austinriba.com/misc/kernel-patched/
If you are using Ubuntu, you can find packages here.
If you are using another distribution, you must apply the patch to your kernel’s source and recompile. Follow the instrucions for whichever distro you use on how to do this. You can find the patch here:
http://www.austinriba.com/misc/kernel-patched/dell.patch
Enjoy your functional laptop!
Selling The Norco!
&& [ ] && 0 comments
Thanks for all the rides…
http://medford.craigslist.org/bik/1723439401.html
[nggallery id=2]
Drive I-5 Like a Pro
&& [ Howtos ] && 1 comments
(From Ashland to San Francisco, anyway)
This post is similar to this one except that its less about staying alive while you are going insane and more about how to make the trip fast so your risk of going insane is only about 1 in 5.
I am a professional I-5 from Ashland to San Francisco driver. I make this drive more than is healthy. I know the road like the veins on the back of my, ahem, hand. I make the other drivers on the road feel like they are lost even if they are going the right way. When you are on this particular I-5 corridor, you are IN MY TERRITORY. I pass fools like they are
driving Barbie Big wheels. Cops don’t even pull me over anymore! Anyways… have I mentioned that I’m pretty good at this drive? Well I am. And I am about to pass on my infinite wisdom to you. Listen up.
From Ashland to San Francisco
First thing you gotta do is, pack your stuff. This is not fun. I have found that the only things you really need for any trip less than a month long are clothes, music, books, bikes and a toothbrush. Thats it. If you are packing for a trip longer than a month, also pack tampons.
This is very important: Get cash. You will need $4 for the bridge toll later, and if you get it now, you wont need to pay a ridiculous ATM fee somewhere. Worse yet you could completely forget and pay a fat fine to the CDOT.
Next step, get gas. This is your last chance to fill up on glorious cheap, non self serve Oregon gas. So, on your way out of Ashland, take Siskyou Blvd all the way PAST the exit to I-5 and go to the Chevron station down there on the right. Its usually the cheapest gas in town, there is never a wait, and the attendant will take your card so you don’t have to go inside yourself (like they make you do at the Texaco) Then drive back and get on the I-5 south and start your trip.
You’re going to go over some high mountain passes. These might be intimidating if you’re a wimp. Just hang in there and in about 2 hours you’ll be dropping off into Redding. If you drive a gas guzzling hunk of awesomeness like I do, you’re gunna want to fill up here again. Redding has the cheapest gas you will find until you hit the Bay Area. I usually fill up at the Arco off Oasis Road (exit 682 next to the CHP headquarters) If for some reason you forgot to eat before leaving, there is an In N Out off Hilltop Drive. This will be your last chance for decent food until Granzella’s which is in Williams, quite a few miles down the road.
After 2 hours or a little more past Redding, you may find yourself getting bored, really bored. The scenery is repetitive, to say the least. So you’d expect that when the exit for I-505 just past Dunnigan comes up, you’d be on it. Nope. You’ll be so lost in your head thinking about sunshine and lollipops or whatever that you’re going to almost miss it. It happens, so don’t let it. THE EXIT FOR I-505 Vacaville/San Francisco IS JUST PAST DUNNIGAN. There you go.
505 is pretty short. And when it spits you out on I-80 in Vacaville, you’ll be awake if you weren’t before. This is where the craziest motherfuckers on 4 wheels make their daily commute. Not to mention the road is gnarly. So sit up straight, shut up, and put both hands on the damn wheel. Keep your eyes on the mirrors for BMWs weaving in and out of traffic, motorcycles splitting traffic at 85mph and other batshit-crazy drivers. And remember to use your blinker, PLEASE?! You know you have almost survived when you get your first glimpse of the bay.
Shortly after driving over the Carquinez bridge, I-80 merges with I-580 at Berkeley. Depending on the time of day, traffic here can get REALLY BAD. You are going to San Francisco, not San Jose like most of the poor fools, so stay as FAR RIGHT as possible. These lanes usually move faster and the farthest 2 or 3 lanes split away from I-580 and become I-80 again to go over the bay bridge. Once you get to the toll both, pay your $4 that you didn’t forget. Congratulations! Welcome to the City on the Bay.
From San Francisco to Ashland
These directions are pretty straightforward so I wont repeat a lot of stuff. Take I-80 out of town and remember to get your 4$ dollars! When you approach the Carquinez bridge, stay in the right lane. Left lane is for FastTrack only! The farthest right lane is usually the fastest, so just stay as far right as possibly until you are past the toll booth.
I usually get gas/eat in Fairfield. Take the exit for Travis Blvd, and when the road splits, take Travis Blvd WEST. There is a shopping center with an In N Out, and a Vallero across the Street (also next to the CHP). Eat a burger and poop if necessary. After you fill up at the Vallero, DO NOT exit back onto Travis Blvd. Take the rear exit and turn right onto Holiday Lane, which intersects again with Travis blvd, but you have a sweet left turn only lane that will spit you back onto Travis Blvd going east, and that takes you back to I-5. I told you I was a pro, right?
Don’t miss our favorite exit in the next town! THE EXIT FOR I-505 WINTERS/REDDING IS IN VACAVILLE! From there, I-505 turns into I-5 and that takes you to Redding. If you think you wont run out of gas before Ashland, fill up in Redding anyways. The following 2 hours will be full of accelerating and decelerating which eats your gas away.
Check out Mt. Shasta off to your right! Isn’t that awesome? You are almost there. Take care on the road around Weed, CA. The winds here can be vicious and they blow around semis like sailboats.
When you pass the Welcome to Oregon sign, you are on the Cali Side of Siskyou Pass, the steepest grade on I-5. Ashland sits right on the bottom of the Oregon side. When you come down, take the first exit for Ashland. Its a little further than the next from town, but you get to avoid the horrendous perfect-example-of-bad-city-planning offramp that the second exit provides.
Welcome to the coolest town north of Half Moon Bay!
Vulpes Vulpes
&& [ Bizzare, Cool ] && 1 comments
Dedicated to Andrea WayteThe Fantastic Mr. Fox, a movie based on the Roald Dahl book of the same name, is a terrific movie starring some clever animals. In particular, the red fox is portrayed as a sly and ingenious thief. A thieving fox is a pretty common theme in literature and this movie made me curious if the red fox really does have a case of kleptomania as big as we give it credit for.
In many cultures, the fox has become a symbol of trickery and slyness. In traditional Japanese culture, the fox is a sacred animal.
In the west, attitudes towards the animal tend to be less enthusiastic. Fox hunting was still a sport in the UK until just a few years ago, when it became illegal but obviously not stopped. Farmers in particular hate the animal. Most of this reputation probably comes from poultry farmers who’s livestock are particularly attractive meals for a fox. I found a great site with tips on how to keep foxes out of your chicken coop. Here are a few:
Make the entrance to a shed with sharp zig zags which only a chicken can manouver around. Bare in mind the length of a fox and fix angles of 180 degrees that a fox can't contort his body to. Hang human hair around the pen at six feet intervals. They don't like the smell apparently. Use ladies tight's or fine netting. Urinate at regular intervals around the pen. This is you marking your territory. (Watch the stinging nettles - I found this out to my cost !!!) THINK FOX. How can I get in ?, how can I get out ?, Look for all possiblities.
Chickens are not the only things that foxes love to steal. It seems like the fox loves to take whatever it can get its mouth around. Foxes in urban environments have been known to steal everything from purses and cell phones to cameras and golf balls. I don’t think this strange behavior has any explanation but it makes for some extremely amusing youtube videos.
Instant classic: a fox that loves to steal golf balls off the course.
Here is a totally fearless fox:
Saved the best for last! You are not human if this video does not make you smile.
The fox is likeable because it has such an innate personality. They are just so cool, and this fox knows it:


