You need to get out on your whale, into the big scary ocean, and start learning and creating again.
Thursday, January 24, 2013
An Unfortunate Conversation
Me: "How do I get persistence to work properly?" (I start googling and get some pointers...)
Me: "Oh, this is easy.." (sounds of typing)
KahaPersistenceAdaptor adapter = new KahaPersistenceAdaptor();
Me: "Hmmm... ah, just dump the database in my home directory for now..."
adaptor.setDirectory("~");
...
Me: "Ok, now I just need to set it up... cool."
(Some more typing and thoughts of leaving early...)
Me: "Okay, let's see what happens..." (clicks run).
Me: "Cool! Yes! It works... let's see how the database looks."
$ cd ~
$ ls -la
<Home directory listing here, without the database file(s) I expected...>
Me: "That's funny... what does the project directory look like?"
$ cd ~/workspace/activemq-test
$ ls -la
total 12
drw-r--r-- 1 jaco 4096 Jan 24 06:58 ~
-rw-r--r-- 1 jaco 1924 Jan 24 06:58 pom.xml
<some other files>
Me: "Hmmm... What the hell? What is that ~ doing there..."
$ rm ~
rm: cannot remove `~': It is a directory
Me: "Ag... dammit... just delete the damn thing!"
(At this point reason and intellect was replaced by the primordial aggressive hunter/gatherer)
$ rm -rf ~
(Reason and intellect reasserts itself in my recently installed cerebral cortex...albeit, just briefly.)
Me: "...."
$ cd ~
$ ls -la
total 0
(I felt the hair in my neck stand on-end, that eery sensation and that metal taste... At this point I experienced a complete take-over of the medulla & cerebellum part of the brain, rendering me completely and utterly speechless...)
Me: "..."
Me: "..."
(sounds of soft crying...)
After a few hours of trying to get my system in a semi-working state (and realising that the program was never checked in anywhere), I vow never to use rm again.
Tuesday, January 22, 2013
Juniper Network Connect VPN client
In addition to using the Cisco VPN client at work we also need to make use of the Juniper Network Connect (JNC) VPN client at times. After struggling to get it working and reading a lot of blog posts, including this one which is important for getting hold of JNC via a browser, I discovered the MadScientist's blog post. Fortunately I discovered that I don't really need his msjnc perl script even though it has helped me a lot. It is however required for proper initialisation/setup of JNC. This post will explain what I have learnt and hopefully it will also help someone else (if not, then I have at least documented it for myself).
After following the blog post I was still unable to get it working, because:
- My computer is behind a proxy through which I am supposed to access the VPN. Unfortunately the blog post does not go into any details regarding proxies.
- When setting up a profile using the msjnc front-end it tries to download an X.509 certificate using the
~/.juniper_networks/getx509certificate.sh
script which tries to execute
openssl s_client -connect $1:443 < /dev/null 1>out.txt 2>err.txt
This failed for me, because I am behind a proxy and openssl does not support proxies. The workaround for this was to connect directly to the Internet (using a different network) and then configure a new profile from scratch. Once the certificate is downloaded it can be reused - even when behind a proxy as will be seen later. The certificate is downloaded to~/.juniper_networks/.cert.<vpn.host>
- I believe there are a few bugs in the msjnc front-end when configuring the VPN proxy server
hostname:port
pair. Whenever I entered something like10.0.0.10:8080
it complained that it was not valid. This results in incorrect settings in the~/.msjnc-profiles.cfg
file. I should probably fork the GibHub project and send a patch instead of just complaining :-)
After fidgeting a lot I noticed the command that msjnc tries to execute in the ~/.msjnc.log
file. I copied+pasted this into a terminal and voila!
When connected directly to the Internet the following command works for me:
~/.juniper_networks/network_connect/ncsvc -h <vpn.host> -u <vpn.username> -r <realm> -P 443 -U https://<vpn.host> -f ~/.juniper_networks/.cert.<vpn.host>
where:
vpn.host
is the hostname or IP of the VPN servervpn.username
is your username as provided by your "network administrator"realm
is the realm of the VPN you are connecting to (see the introductory comments of the msjnc script on how to determine your realm)
When behind a proxy the following command works for me:
~/.juniper_networks/network_connect/ncsvc -h <vpn.host> -u <vpn.username> -r <realm> -P 443 -U https://<vpn.host> -y <proxy.host> -z <proxy.port> -d <proxy.domain> -s <proxy.username> -a <proxy.password> -f ~/.juniper_networks/.cert.<vpn.host>
where:
- the above arguments are still valid; and
proxy.host
is your proxy hostname or IPproxy.port
is your proxy portproxy.domain
is the Active Directory DOMAIN (I think), such as WORKGROUPproxy.username
is your proxy usernameproxy.password
is your proxy password
What I like about this solution is that once it is setup you do not need to jump through all the Java hoops or even visit your VPN's web site. You can just run the command, type in your password when prompted and then you are connected to the Juniper VPN. You also don't need the msjnc script any more, but I'll keep it around just in case.
Tuesday, January 15, 2013
Celebrating our Machines
I want us to think outside computers for a while, and think of the incredible machines that are all around us, but that we don't always appreciate. Machines are awesome, and they should all be celebrated.
Let's ponder our motor vehicles for a while.
And specifically, my old car. The Golf IV that was around for 12+ years, and 310,000 km.
This post is sort of a tribute to that machine. A machine that was close to my heart, even though I couldn't chop and change it, or modify it, like I can with computers. I just drove it. And that's probably better - because I know almost nothing about the mechanical workings of a motor vehicle, and if I were to tinker it probably wouldn't have lasted :)
Lets look at a couple of stats:
- Drove for 12 years
- +- 310,000 km
- Was driven basically every day in its lifetime, except for 4 or 5 holidays here and there
- Comfortably reached 120km/h
Let's dig into those numbers:
310,000 km- This is about 7.75 times around the equator.
- This is 80% of the distance to the moon (my biggest regret is that the car didn't make it to the moon. It probably could have.)
- This is about 15 times from Cape Town to Cairo, and back
- It's about 30 times around the moon at the moon's equator
- It's about 15 times around Mars' equator
- It's 3 times from one side of Jupiter's Red Spot, and back
- Assuming 6 two-way trips for every week in the 12 years, this means the driver door was opened and closed around 15,000 times. (12 * 52 * 6 * 2 * 2)
- Assuming a lifetime average speed of 40km/h, the engine was on and the car running for around 7,800 hours (325 days). An average of 30km/h is 10,300 hours (430 days) (310,000 / 40)
- Assuming an average RPM of around 2,500 for the 7,800 hours, the total revolutions of the engine come to 1,170,000,000 (2,500 * 60 * 7,800)
- How many sparks does it take to get a 4-stroke engine to do the above # of revs? I think it'll be really interesting to work this out
- Assuming a lifetime average fuel consumption of 8l/100km, this gives around 25,000l of fuel. You work out how much that would cost at current fuel prices.
- Ignoring walking, for the majority of mankind's existence, our main transportation were horses. Which walk at an average of 7km/h. Humans being able to travel at 120km/h in their own personal vehicle would seem like magic to people from those days
I sometimes feel as though I am too electronics-orientated. Which is understandable considering my career and life-long interest in computers - but I reckon it's important not to forget all the amazing machines around us that we sometimes take for granted in our electronics-focused lives. Like our cars.
What are some other incredible machines in our daily lives that we may not always recognise? What statistics can we think of for these machines to put what they do into perspective?