Cleaning Up
What to do if your script needs to kill all processes that it started? Just kill everything that has same parent as your current shell ($$
):
#!/bin/bash
…
kill `ps -ef | awk '$3 == '$$' {print $2}'`
Those fortunate enough to be MSDN subscribers can download Visual Studio 2010 Service Pack 1 today (8th March). Mere mortals will wait for two more days, until 10th March.
I already wrote about some improvements but there are few more things to come. Those include TFS-Project Server Integration Feature Pack, Visual Studio Load Test Feature Pack and Visual Studio LightSwitch Beta 2. Check sparse details about those at Soma Segar’s blog.
What to do if your script needs to kill all processes that it started? Just kill everything that has same parent as your current shell ($$
):
#!/bin/bash
…
kill `ps -ef | awk '$3 == '$$' {print $2}'`
Microsoft always took pride in maintaining compatibility. One guy decided to test just how upgradeable Windows were going from Windows 1.01 to Windows 7.
P.S. Do notice that there is no Windows ME. Repressed memory perhaps?
I like using Google Analytics for tracking statistics. Those statistics read like porn to guy who loves numbers. There is only one problem with them - they count every visitor. That would also mean that my administrative tasks are skewing numbers. We cannot have that!
In order to disable logging own visits we need to check what exactly Analytics’ code does:
<script type="text/javascript">
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-4401313-2']);
_gaq.push(['_trackPageview']);
(function() {
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();
</script>
Code is pretty simple and only place where any action can possibly happen is in line 7 where we see ga.js script. Depending on whether our page is http or https those URL’s are http://www.google-analytics.com/ga.js and https://ssl.google-analytics.com/ga.js respectively. As soon as we disable those two servers our own visits will not be logged.
Since we cannot disable servers as such we need to do next best thing and disable them in our part of universe. There is nice file called “hosts” situated in “C:\Windows\System32\drivers\etc” (or in “/etc” for *nix systems). In this file we can override any DNS resolution and assign any IP address to any host name.
File format is quite simple and I will not explain it here. It is enough to say that we just need to append two lines (after adding write permissions, by default this file is not writable by normal user):
···
127.0.0.1 www.google-analytics.com
127.0.0.1 ssl.google-analytics.com
These lines are just forwarding any call to Analytics servers to our own computer. Since we do not have Google’s infrastructure it is pretty safe to assume that all requests will go nowhere. And that also means that computer with this “fix” will not be recorded by Google Analytics.
P.S. Modifications to “hosts” file are great way to annoy somebody in office who left computer unlocked.
My laptop died again so I am currently using my wife’s laptop. I got my account there but it is annoying how much effort must go into setting up environment. As soon as I install something, I notice something else missing.
What I didn’t expect is effect it has on my productivity. I just can’t be bothered to do anything new. And it is not that I miss my particular laptop, I just miss a place to call home.
What is most annoying is fact that, as soon as I set up whole environment, my old laptop will be repaired and, in worst case scenario, I will need to repeat everything once more. Nitpicker’s work is never done…