“Right click -> Upload file…” with Putty (PSCP)
August 28th, 2009
Years ago I discovered a very comfortable way of uploading PHP files after editing them, a VBScript named “vbsFTP”. Copied into the “SendTo” folder and updated with some connection information, any file inside the base location on my harddisc could be uploaded to the corresponding remote location with just two clicks whilre preserving the local directory structure (C:\MyLocalHtdocs\a\b\c.php -> /var/www/htdocs/a/b/c.php).
However, this script is using the FTP protocol and ftp.exe integrated into Windows, so that I’m very sure, security comes short.
While installing new servers the last few days, I decided to doom the FTP servers from our brand new debian boxes and came up with my own VBScript that is using PSCP.exe (file copy over SSH, capable of private key authentication) from the Putty package instead:

Installation instructions:
- Get the script (and PSCP if you do not have it yet)
- Save the script to “C:\Documents\YourWindowsLoginName\SendTo” (XP) or “C:\Users\UserWindowsLoginName\AppData\Roaming\Microsoft\Windows\SendTo” (Vista)
- Open it, edit the configuration section at the beginning and save
- Make sure the local and the remote directory exist, then switch to the local directory, create or select a file, click right and select “Upload”.
That’s it! The file will be silently uploaded in the background. For creating directories you will still need to do so in the old fashioned way or you add the “-r” parameter in front of “-i” or “-pw” - but I’d not recommend that (may take a long time when accidentally clicking on a big directory). Of course you can install several copies of the script at once.
Happy coding!
Not just a bug - a catastrophic issue
August 25th, 2009
Today I moved our main MySQL database from one server to a fresh new one and of course I had to configure the new mysql daemon for heavy load and much more memory like I always do.
Nothing exotic so far. However, MySQL (5.0, Debian Lenny) comes with a default InnoDB whatsoever with empty InnoDB data and it is now the second time for me, that the InnoDB engine was silently disabled by the MySQL daemon after changing the configuration to something usable. The only way to solve this issue is, to delete all the empty default InnoDB files from /var/lib/mysql and restart the database server. From then on, InnoDB shows up in “SHOW ENGINES” again.
But the clue is: When importing InnoDB tables, there is no error, no warning, no notice that InnoDB is disabled and all tables silently fall back to MyISAM while killing every single foreign key and not using the tweaked InnoDB settings (because there is none) at all. What an uber-bug!
As you can guess, I will have much fun for the next few days switching hundreds of tables back to InnoDB and recreating every single foreign key after tidying up the unreferenced mess. Hooray!
3qn2r9zm56
DNS Loadbalancing & Failover?
November 25th, 2008
For now I’m looking for an easy way to set up DNS loadbalancing with basic failover capabilities. The first thing you find on big G is MyDNS, an ageing DNS server that serves DNS records from a MySQL database. Setup is easily done the debian way, adding records with PHPMyAdmin takes its time but is no big problem and it is also not a big deal to set up a secondary NS when simply using MySQL replication. The only thing I don’t understand is the stupid weighting algorithm. It would have been so much better to implement something that is not unpredictable. Seems to become some fun to figure this out, hah. Anyway, I already set up a primary/secondary DNS with the most important records for a bunch of zones so that I am in need of a domain hosting company that enables me to define own NS entries. We will see and I will continue on this as soon as I have learned my lessons :-).
Update: Lesson 1: in-addr.arpa SOAs seem to require some kind of mask -> 0/7.111.133.213.in-addr.arpa. works but I have no idea what this is all about. I guess: 0-255 for fixed bits in the last byte? Or is it a real netmask? Heh? ^^
Update: Lesson 2: Ok, a big IN-ADDR.ARPA. SOA suffices and holds all the reverse records. So I don’t need to think about the mask anymore :-).
Update: Lesson 3: MyDNS comes with an administration interface written in PHP. It’s broken in conjunction with PHP 5.2.0 but changing only two lines of code fixes this (change $this to something else on line 2484 and 2485). Seems to be quite nice.
Another DNS server capable of using MySQL as a backend is PowerDNS, but this seems to be just too much for my needs. There even is commercial support available what definitely turns me off. => When MyDNS does not work out, I’ll try it.
And yeah, you are right, I implemented the DNS protocol on my own on top of Apache Mina not long ago exactly for this task but as there does not seem to be any interest in neither AsyncFCGI nor AsyncDNS, there is currently no motivation left to carry on the work. However, it has been some fun and you are still free to become interested ;-).
Happy coding!
Update: Ok, I tried out MyDNS and PowerDNS now. Both of them come with everything, a good DNS server needs. In detail: PowerDNS comes with much more advanced stuff like multiple backends, master/slave configuration etc. and has got a nice documentation about every aspect of the server. However, it is more complicated than MyDNS because of this. I like the administration interface shipped with MyDNS because it is really easy to understand, while PowerAdmin for PowerDNS will get frustrating over time. However, both servers don’t really satisfy me, so I may continue my own stuff or at least create a modern admin UI for one of them when I find the time. Stay tuned! :-)
Added Varnish, just works.
October 17th, 2008
Till today I used Lighttpd to distribute the load to multiple FastCGI backends. This worked “ok” until now but I’m really impressed about the performance gained by adding Varnish 2.0 (a high performance HTTP reverse proxy) in front of the web cluster. Additionally this is much easier than always fixing the FastCGI stuff when it is broken again.
However, Varnish 2.0 was released just 2 days ago, so there are still some issues. It seems that the random director (directors are used to distribute the load to multiple backend webservers) is broken currently but round-robin is working fine and should last for a while. As a workaround for using the random .weight option you can just add a backend more than once to the round-robin director.
There was also a problem with the varnishstat Munin plugin at Munin Exchange, so I uploaded a fixed version here and also added some installation instructions.
Do you wonder why Varnish seems not to cache anything?
For me (in fact I think for most people) the default varnish configuration is a bit too restrictive when it comes to cookies. All requests that contain a “Cookie” request header will not be cached - never. As soon as a cookie is set by the site, also all static files like images, scripts and styles will no longer be cached cause the cookie is sent along with every client request, even to static files. In most situations (for almost every site that requires a login or uses adsense or similar and sets a cookie) this will render Varnish absolutely useless. A better approach is to let the dynamic pages always set a cookie, so that a “Set-Cookie” response header is created every time. Varnish also will not cache when a “Set-Cookie” response header is present so we don’t need to care about the “Cookie” request header anymore. Knowing this, all we need to do is make Varnish ignore the cookies for static files - and this is easy:
# in vcl_recv
if (req.url ~ “\.(png|gif|jpg|swf|css|js)$”) {
unset req.http.Cookie;
}
This should work for 99% of all somewhat modern websites where users can log in. Because of this I think the documentation should mention this more clearly. Also don’t forget to set etag.use-inode = “disable” in lighttpd.conf to sync the ETags when using multiple backend servers. Anyhow, Varnish is great, so have fun! :)
Chrome - Pointless leecher?
September 3rd, 2008
I think you already read enough about the new Google Browser somewhere else. So additionally, these are just my two cents:

As you may know, I’m sometimes limited to an ISDN internet connection (64kbit/s). This is why I just cannot use chrome because it downloads (or uploads) permanently. I’ve been running it for about two hours now and there still nothing changed. It also shows network usage “Not available” for the browser component.
I somewhat expected that a google browser would transfer various (…) data in the background, but this is tough ;-). No idea what data is transfered here - currently the problem is that data is transfered so that my internet connection is unusable.
Want to read more?
