Tuesday, 12 August 2008

sshfs using ssh-agent on OSX

The FUSE based sshfs app is pretty nice - but it's even slicker if it imports your ssh-agent keys automatically (as mentioned here) - then it just connects automatically if you're logged into your agent. To do this you need to set up your ssh-agent and the setup sshfs: basically you open the sshfs package and rename the "Contents/Resources/sshfs-static" to "Contents/MacOS/sshfs-static.bin". (Doing the same for sshfs-static-10.5). Then create a new file called sshfs-static (and with sshfs-static-10.5) with the following content:
#!/bin/sh
SSH_AUTH_SOCK=/Users/your-username/.ssh/ssh-agent.pipe $0.bin $*

Now make sure you've installed and set up the ssh-agent according to my instructions then you can start sshfs. Then add a machine you've got a key installed on and it will automatically connect.

[updated] Otherwise now in Leopard ssh-agent works properly and you don't need to follow my instructions - you can use the one here - use this in your sshfs-static:
SSH_AUTH_SOCK=`launchctl getenv SSH_AUTH_SOCK` \
$0.real "$1" "$2" "$3" "$4" "$5" "$6"


Bug reporting and listing/tracking

So how do I report a bug in Windows Vista, Gmail (maybe I'll add others)??? - they don't make it that easy... So I've managed to 'em track down:
  • Gmail - You get it through the help center - but you have to navigate via an unexpected route: Through their trouble shooter and then via issues with 'Registrations & Invitations"....
  • Windows bugs (Vista etc) - You go via their connect system - you'll need a M$ ID. It seems you can only report issues about various subsystems though not the core OS...

Tuesday, 5 August 2008

Coolest Firefox plugins

Yeah there's tonnes of 'em but mostly they're a waste of time. These are the ones I like (I'll keep updating this one too...):
  • CustomiseGoogle - Allows various tweaks and additions when using Google's sites
  • CookiePie - Keeps cookies from different tabs/windows separate - E.g. So you can be logged into Gmail in one tab, whilst in another use Google search (and not be logged in) thus not having everything logged (though they could quite easily correlate one's activity by IP...).
  • Flashblock - Stops running Flash items on web pages till you click on the ones you want.
  • Cacheit - Useful to access alternate sources of a webpage - e.g. when the main is down.
  • Dictionaries - Great for spell checking any text as you type into any web form.
  • Add more search engines to the search box - Not actually a plugin but darn useful all the same (e.g. add Way Back Machine, Scroogle (anon Google search), Cuil....)
  • Locate in Bookmarks - Go Parent Folder, Show Parent Folder
More geeky ones:
  • User agent switcher - Useful for playing with your browser's 'identity'
  • ShowIP - Shows the IPv4/IPv6 address of the website you're at.
There are other sites that have some impressive lists too.

Tuesday, 22 July 2008

Debugging memory problems on Windows

There's a handy utility called gflags.exe which comes as part of Microsoft's Debugging tools package - it allows you to tweak various debugging features embedded in Windows ntdll.dll (the dll that handles memory allocation etc for all windows apps). One of the most useful features is enabling of pageheap which basically causes your app to crash (so you can catch it in a suitable debugger) when it encounters a memory allocation bug. You can use gflags on the command line or with its GUI - just enter the name of the executable (no path required) - and they start playing with those check boxes.

Friday, 18 July 2008

Problems when deleting file/folders on Vista

So you're [desperately] trying to delete a file/folder and it comes up with: "destination folder access denied" and says "You need permission to delete this file"??!
If you still can't delete the file folder then try renaming/moving it somewhere or rebooting (with above technique) and trying again.

Wednesday, 16 July 2008

Facebook app spams: "just gave you luv"

This annoying little facebook app (http://apps.facebook.com/which_programming/) automatically spams notifications to all your friends when you click on it's link - its message appears from one of your friends: "'your friend' just gave you luv Click here to accept and see what they did." It purports to be a programming quiz app but just seems to send spam.
[update]: It seems that there are other apps in the [spam] family with a similar name.

Stop Microsoft's Malicious Software Removal reporting home

Microsoft's slightly odd Malicious Software Removal (MRT) gets downloaded and run every month - they apparently produce a new one each month. Granted it does check for a handful of nasty viruses but there are hell of alot more of them out there... However "The Malicious Software Removal Tool will send basic information to Microsoft if the tool detects malicious software or finds an error". It can stopped from reporting home that "basic information", though it's a little hidden in a KB article. Basically run regedit and create a new key:
HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\MRT
Then create a new DWORD item under that key named: DontReportInfectionInformation
with a value of "1"

Tuesday, 1 July 2008

Apache tuning

The number of options for tweaking apache is pretty overwhelming. Tuning apache depends on a number of factors - depending on how much resources you have to throw at it and how you decide to run your system, and what you want out of it. There's quite a few places out there that offer some advice (apache, Scrollbag general tuning, IBM network tuning, IBM svn).

I'm mostly interested in fast low memory setup of apache 2 on Linux. One of the first things to decide is what MPM mode you decide to use for your apache installation - there's bunch. In fact Apache2 supports three MPM's prefork, worker, and event. To check which one you're running use either:
apachectl -l which will list the compiled modules - where 'prefork.c', 'worker.c', or 'event.c' indicate the version in use. You can also check by running apache2 -V. To use a different one you usually have to load the appropriate package on your system - but it will depend on which modules you have installed - e.g. using PHP will result in MPM prefork as PHP is not entirely thread safe.

I am currently running in prefork (a bit old school but simpler). In this mode the number of httpd daemons started - which is mainly controlled by ServerLimit directive (and subsequently MaxClients) - whilst there are quite a few others control how many instances are started initially and kept spare etc. You need to make sure that your machine has enough memory to for the number of servers so the machine doesn't start to swap unnecessarily; Once you have sorted out the modules (see below) and config for the server you can see how much memory a single httpd instantiation uses (check using top command). Once you know how much one httpd uses then configure things so that ServerLimit * httpd_memory is less than the total amount of memory available on the system when apache is not running. You can check to see if you got it right by running the system up (with some requests and all servers started - you can set StartServers directive equal to Serverlimit for testing) and checking there is minimum swap activity - using the vmstat command - run it vmstat 5 and check that the so/si (swap out/in) columns are close to zero - if not then tweak down the number on ServerLimit.

Apache provides a vast array of modular functionality - through its loadable modules support. Firstly you want to go through you the modules that you need loaded for your setup, then comment out all the ones you don't need. Things like unneeded language modules (php, python etc) should be off, and stuff like mod_status (particularly ExtendedStatus) should be switched off once you have got your config sorted.

[8dec08] New page on apache optimisations.
[12sept12]: Added info on checking MPM in use.