Supposedly you should be able to select select options by their text values like this
$(‘#myselect’).val(‘aval’);
This doesn’t seem to work if your options have value attributes however.
So, to select options by their text value, when you have values set (like this)
<select id=”myselect”><option value=”1″>alpha</option><option value=”2″>beta</option></select>
You can use a filter like this
$("#single option").filter(function() { return this.text == 'sometext'; }).attr('selected', 'selected');
Here is a whole example... The html was borrowed from some other place where they were explaining this, but they forgot the fact it doesn't work if you add values.
<select id="single">
<option value="1" >Single</option>
<option value="2" >Single2</option>
<option value="3" >Single3</option>
<option value="4" >Single4</option>
<option value="5" >Single5</option>
<option value="6" >Single6</option>
<option value="7" >Single7</option>
<option value="8" >Single8</option>
<option value="9" >Single9</option>
</select>
<script>
$("#single option")
.filter(function() { return this.text == 'Single7'; })
.attr('selected', 'selected');
</script>
Suppose that you need to transfer a file from hostA to hostC. Between these hosts is a hostB that you use to hop through. Maybe between hostA and hostB is a firewall or maybe you are traversing networks or something. Here are some ways that you can transfer that file.
cat myfile.txt | ssh hostB "( ssh hostC '( cat > /tmp/myfile.txt )' )"
This basically copies myfile.txt from hostA to hostC, but you would need to have the ability to ssh from hostB to hostC
Here is another way to do it using a tunnel. This is useful if you cannot ssh from hostB to hostC due to key restrictions.
Make a script like this…
#!/bin/bash ssh -nNT -L 2222:hostC:22 hostB & tunnel_id=$! sleep 2 cat myfile.txt | ssh localhost -p 2222 '(cat > /tmp/myfile.txt)' kill $tunnel_id
Note that you can also use scp in the 2nd example to transfer the file.
Here is a simple vim shortcut for adding a piece of code that will log a debug message.
iab _log container.libBLExternal.log(“”)<left><left>
now, if you type _log<space or tab> in a file, you will get container.libBLExternal.log(” “) and your cursor will be placed between the quotes, all ready to go ahead with your log entry! Yay!
Oh, and here is a great vim cheatsheet site.
Eric

