Weblogs for simonw

Posted by simonw on Mon 26 Mar 2012 at 14:54
Tags: none.
I didn't expect:

apt-get -t "squeeze-backports" install linux-image-2.6-amd64

to install a 3.2 kernel (at least not until I saw the output).

Some new convoluted forms of DWIM, since the outcome is probably what I wanted, but I think it fails on the concept of least surprise.

 

Posted by simonw on Fri 9 Mar 2012 at 03:26
Tags: none.
Looking at this box because we wrote a small bit of the software on it, and the current provider said "we can reinstall Windows" (which is a classic Windows Admin thing, if in doubt reinstall).

Server runs Microsoft Web Server 2003, PHP 5.3.9 MySQL 5.1

Symptom was it got slower, quickly becoming unusable over the period of a few days. Initially rebooting or restarting services seemed to help, but later on that was less clear. Performance tools didn't show bottle-necking on IO, or Memory, or CPU, and I found a similar report claiming IIS6 might need its worker threads tuned - but no.

No change could be identified as causing the problem.

Still troubleshooting, but looks like the most probable cause was PHP (and other apps) not removing temporary files from C:\WINDOWS\TEMP

How many files in c:\WINDOWS\TEMP? Well I gave up waiting for the command counting them to complete. Been deleting (del ses_*)_ them for 5 hours, my best estimate is it deleted the first fifth in about 2 hours of deleting.

So reinstalling would probably have fixed the problem for a couple of months ;)

I note also deleting a large number of files from a folder in Microsoft Windows with NTFS is not terribly fast. Suddenly all those benchmarks comparing file-systems whilst they compile kernels or move ISOs suddenly seems so much more sensible. Anyone happen to know if NTFS is likely to be irreparably damaged by having a folder with a million files in (I mean I know it SHOULD cope, but clearly it doesn't).

 

Posted by simonw on Sun 4 Mar 2012 at 02:24
Tags: none.
Okay I had a video clip I wanted to rotate 90 degrees counter clockwise, and ideally liberate from patent encumbered formats, but mostly I just wanted to rotate it 90 degrees without hassle or loss of quality.

I searched and found lots of suggestions to use ffmpeg, but it claims on Debian that avconv is preferred claiming ffmpeg development is dead (which seems to be a bit strong).

Whilst ffmpeg and avconv both exist, and use -vf "transpose=2" the command line is pretty much unusable unless you are some sort of video codec guru.

Some places suggest mencoder which just adds an additional layer of complexity to little benefit as far as I can see.

Transmageddon does the task nicely. I've used it before to encode for mobile devices (into various formats needed to make HTML5 video work across platforms), but didn't notice it will rotate video as well. Transmageddon simply transcodes, and rotates, with presets for common mobile devices, it doesn't do anything else, but that is precisely what I wanted.

Oggconvert is interesting in this regard, it doesn't do rotation, and seems to have bugs. The "nice to have" feature though is that it has sliding scales for quality of video and audio, which would have been handy as I actually didn't want "no loss of quality", just not the loss of quality ffmpeg seems to default to, and be hard to change when converting mpeg to ogv.

 

Posted by simonw on Wed 29 Feb 2012 at 17:13
Tags: none.
A subquery with an "order by" was taking a long time, where as similar subqueries were adding no noticeable time. Explain said "filesort", which apparently simply means it can't use an index or other method so it does a quicksort (it only reverts to using files is a filesort is too large).

tablea is a simple lookup table from a text NAME (in fact a role title and the search finds the more important role title for a person) to and ID.

SELECT (
SELECT a.NAME FROM tablea a JOIN tableb b ON a.ID = b.ID WHERE tableb.OtherID = main.OtherID AND {.. other conditions } ORDER BY b.ID LIMIT 1)
FROM OtherID {....}
WHERE {...}

So basically lookup the role title from the assigned roles ordered by the ID.

a.ID and b.ID are both indexed, but because of the conditions on b.ID MySQL chooses not to use the index for b.ID. Replacing "ORDER BY b.ID" with the equivalent "ORDER BY a.ID" results in query time going from from 44s to 1.6s.

 

Posted by simonw on Wed 29 Feb 2012 at 12:50
Tags: none.
Got a bounced email today from an automated system. The email said that one of the recipient's email servers was refused by another of the recipient's email servers because it was on the spamhaus XBL.

I helpfully emailed it to the postmaster address, since no other obvious contact details to hand to discover the domain has been RFC ignorant for 7 years as regards Postmaster addresses. Clearly since they were listed they have done something, as email is now redirected to a different non-existent mailbox.

I suspect the main thing killing email now is email administrators not spam.

 

Posted by simonw on Tue 28 Feb 2012 at 18:00
Tags: none.
Okay so the company use http://www.facebook.com/350pages.

Creating an AddThis follow button their Javascript does "isNAN(parseInt(d)))" and concludes "350pages" is a facebook profile number.

After some pondering, decided that AddThis is otherwise a big time saver on these things, and hacked around it with userid="%3350pages" (URL encoding) which seems to work.

Adding to my big pile of things that go wrong when 'type' is left to programmers to sort out. Javascript docs claim isNAN is the right test for a string being a number, so that and a check if d and pasrseInt(d) are similar, I dare say a simple regular expression might also do the trick.

 

Posted by simonw on Mon 30 Jan 2012 at 03:12
Tags: none.
I use logrotate postrotate trigger to produce weekly stats from websites in Apache2.

Occasionally the postrotate script appears to run on days when no log rotation has taken place. Is it just me? (I removed an unneeded apache.dpkg-dist file from logrotate.d (but assume this is handled sensibly). I guess I should check in the script to see if the date on the logfile is sensible before doing the report, but it just seems "wrong" to me that it seems to trigger apparently randomly and I'm sure there is some sort of reason.

 

Posted by simonw on Tue 17 Jan 2012 at 16:20
Tags: none.
Seems the expected MYSQL 5 upgrade didn't materialize on the Windows box yet.

I'd mistyped a query clause as "NOT emailaddress IS NULL" when I meant "emailaddress IS NOT NULL" - MySQL5 does what I wanted inspite of the typo, MySQL4 does something else.

Amazing how hard it is to spot a clause like that even in a query of only ~200 characters.

 

Posted by simonw on Fri 13 Jan 2012 at 06:49
Tags: none.
I wanted to use a joystick with online games for my little boy as he struggles with the keyboard (occasional right click with the mouse in Flash is not so clever either).

After a lot of experimenting I built QJoyPad from source (there is a wnpp already). It expects to use the system tray, and defaults with "--notray" to displaying its icon (which is missing so you get junk). However it does work, and when I created a GNOME menu item for "qjoypad --notray" it even displayed a sensible picture, I'm guessing it works better under KDE.

I'm sure there must be a better/simpler way to get a Joystick to emulate arrow keys and space bar?

PS: Failed to pull the C64 games out of the EXE file that came with the Joystick for use under VICE, dare say if I setup wine, but I'm not really into the retro gaming scene, mostly it just reminds me how bad things were (even if it was what passed for fun at the time).

 

Posted by simonw on Wed 4 Jan 2012 at 14:45
Tags: none.
This takes the biscuit, opening a help file fails unless you tell it to not ask before opening. I can guess why this works but really....

http://helpmetocode.blogspot.com/2011/05/navigation-to-webpage-was-canceled-chm.html