Jim's Depository

this code is not yet written
 

Certain corrupt JPEG files will explode Quicktime Player if it encounters them in an “Import Image Sequence…” operation. This bug has been present for many years and shows no sign of going away.

If you are archiving images from cheap webcams you will encounter these.

I am not aware of anything included with Mac OS X Leopard that validates a JPEG file, so I built jpeginfo for Leopard. 

With that, you can do things like… for v in *.jpg ;do jpeginfo -c \$v || rm \$v ;done … to delete all the corrupted JPEGs.

You can find the sources at http://www.iki.fi/tjko/projects.html You will also need to build libjpeg, from ftp://ftp.uu.net/graphics/jpeg/jpegsrc.v6b.tar.gz

Build libjpeg first (./configure ; make ), then build jpeginfo (./configure –with-libjpeg=THE-RIGHT_DIRECTORY ; make )

But you don’t need to do that… I’ve attached the copy I built.

Attachments

jpeginfo 103388 bytes
I might mention that there are still some jpegs that will crash the quicktime encoder that are valid according to jpeginfo, but it gets most of them.
I found a much simpler solution, there is a tool 'Corrupt JPEG Checker' for Mac OSX.
It can be found here: http://www.failedinsider.com/corruptjpegcheckermacosx/ or in the mac app store.

Saved me a lot of time.

http://www.failedinsider.com/corruptjpegcheckermacosx/
unfortunately JPEGInfo will not catch all.

the tool above catches the rest

Safari is odd with contentEditable divs. It doesn’t assume you will have a pre-formatted div as a container so it puts each line into its own div… sometimes marked with code class, sometimes not.

That makes a mess but is tolerable, until my HTML sanitizer burps out the clean version with newlines between the divs and causes accidental double spacing.

I could rewrite the ->saveHTML() method of the PHP DOMDocument to not put newlines in between divs, but that would give awful looking HTML.

For now I added a function to the sanitizer to remove extra divs from inside code formated divs. It tries to be smart about inserting newline characters, but it may not be smart enough.

Someone should revisit the whole contentEditable thing and specify precisely what is to meant by all of the operations.

If you run your own bind server for your domain you can easily support dynamic updates from your machines that have transient IP addresses. bind is capable of many things, but I’ll just show the bits you need…

First, use bind 9.3 or better.

On the server, go edit the file that contains your zone… perhaps it looks like this… zone “studt.net” { type master;         file “/etc/bind/studt.net”; };

… you are going to need to generate a key for each host that has a transient address, add it to this file, and then tell the zone that machines are allowed to update their own addresses.

dnssec-keygen -a HMAC-MD5 -b 512 -n HOST jimshouse.studt.net

… will generate two files with long names. Keep them, you will need them on the client machines. But look inside the K*.private file and copy out the value of the “Key: “ line. You are about to paste it into your zone file.

Add a key for each host that will update its name, and an update-policy to the zone, you may end up looking like this…

key jimshouse.studt.net {         algorithm HMAC-MD5;         secret “eQGH–lots-of-more-key-i-left-out==”; };
zone “studt.net” {         type master;         notify yes;         forwarders { };         file “/etc/bind/studt.net”;         update-policy {                 grant * self * A TXT;         }; };

Restart your bind server and your server is ready to go. (Yes, you could reload but there was a bug in 1999 or so and I have never gotten over it.)

Possible Bug: Your bind process has to be able to write “.jnl” files. Debian etch is configured to put them in /etc/bind but the bind user can’t write there. I chmodded /etc/bind to 775 to deal with that. You’ll know you have this problem when your client update fails with a SERVFAIL and you tail your syslog on the server and read the error messages.

Dangerous Note: Before you edit the zone file you have to first stop the dynamic updates so the .jnl file gets merged with the zone file… rndc freeze studt.net edit the studt.net zone file rndc unfreeze studt.net
Now for the client side. You could set dhclient.conf to do this automatically, but for primitive cave programmers like me you can just execute a command. First… copy your K*.private key file for the client to the client machine, you’re going to need it. Second… use the nsupdate command to set the name’s value. I do it in a script sort of like this…

#!/bin/sh TTL=600
SERVER=ns.studt.net. ZONE=studt.net HOSTNAME=jimshouse.studt.net. KEYFILE=/path/to/where/you/keep/**Kjimshouse.studt.net.+157+26806.private IP=99.153.198.165
nsupdate -v -k \$KEYFILE > /dev/null << EOF server \$SERVER zone \$ZONE update delete \$HOSTNAME A update add \$HOSTNAME \$TTL A \$IP send EOF See that TTL? That says 10 minutes, so a computer on the internet might keep using your old address for up to 10 minutes after your address changes. You can adjust that number for your situation. Clients won’t like you if you get too short.

I’d just like to mention that I would feel better if Tyrannosaurus Rex had lived in Europe. 1,000 miles and 65 million years is too close. I want there to be an ocean between them and me as well.

I generally forget some nice packages when I toss up a new debian machine and then spend too much time trying to remember which ones they are. Now I keep them listed here. Maybe you will like them too.

  • dpkg-dev-el  (for debian/changelog files, stupid picky date syntax)
  • dfu-programmer (to reflash Atmel microcontrollers)
  • iproute (aways forget it)
  • psmisc (killall)
  • sysstat (iostat)
  • strace (sometimes you have to know)
  • tcpdump
  • mtr-tiny (mtr, but without all the X dependencies)
  • ifstat
  • iftop
  • iotop
  • htop,atop (not comitted to these yet, but they seem useful)
  • attr (see and set file’s extended attributes)
  • emacs-goodies-el (markdown mode)

That attachment is an etch build of dfu-programmer, I can’t test it, but it probably works on Etch.

Attachments

hello

can you tell me how to install dfu-programmer on debian etch?
i can not find the package with apt.

greetings remo
I just built dfu-programmer for etch with these steps, and attached it to the parent article (I guess I should implement attachments for comments.)
  1. Go to the Debian packages page for the Lenny package.
  2. Download the original source and debian diffs.
  3. Unpack the original sources
    tar -zxvf dfu-programmer_0.4.3.orig.tar.gz
  4. Apply debian patches... 
    zcat dfu-programmer_0.4.3-1.diff.gz | patch -p0
  5. Hop in
    cd dfu-programmer-0.4.3
  6. Build packages
    fakeroot ./debian/rules binary-arch
  7. Fail... fix x flags on rules
    chmod +x debian/rules
  8. Fail... install libusb-dev
  9. Success! I now have a dfu-programmer_0.4.3-1_i386.deb in the parent directory.
  10. I can't test it, my only Etch machines are remote servers, but it installs ok and I expect it works.
I probably should have modified the version number to mark it as an Etch build, but this works for private use.

macvlan is used to give a second MAC address to a network adapter and see it as a new device at the higher levels. It is useful to pretend you are multiple machines, as the container people do, or in my case, to implement your own TCP stack without interference from the kernel IP code.

My ugly scars thus far:

  • There is nearly no documentation.
  • What there is, is inaccurate.
  • Just because your iproute ip command doesn’t have any help or documentation for “link add”, doesn’t mean it won’t work. Lenny’s will.
  • You create a new interface thusly (note eth0, missing in most docs):  ip link add link eth0 address 00:19:d1:29:d2:58 macvlan0 type macvlan
  • You can leave out the macvlan0 and it will allocate one.
  • The Debian Lenny kernels do not have macvlan turned on.
  • make-kpkg is broken in Lenny. Badly broken. But if you specify the architecture and revision on the command line and turn off Xen support in your config you can get it to work.

Not macvlan’s fault, but if you are working on a user space TCP stack and you are wondering why it seems to be sending RST packets… make sure you aren’t accidentally sharing the link with the kernel.

The Road to Bankruptcy is a short blog of Darren’s house rebuilding woes. I highly recommend it for anyone that has every owned a house.

Background: Family with four nine-year old children in a small house with a fatally flawed foundation decides that somehow tearing down the house and constructing a new one is a good idea.

I’ve been working on a musical instrument tuner for the iPhone. Sadly, I was not one of the lucky 500 first round of developers accepted by Apple, and have been excluded from the market.

At some point when Apple decides my \$100 bill is good enough to let me into the market my application would be starting far back in the pack, behind whichever one of these first, blessed three gains the title as “the tuner you use on an iPhone”.

Given that handicap, I’ll probably not release the application, but it was interesting writing it. Among the things I discovered:

  • Pitch is subjective for some sounds. There are notes on the concertina I was using for some of the testing for which the human testers disagreed about the octave of the note. (And my algorithms were also having trouble making a decision.)
  • For many instruments, the fundamental is not strongly present in the spectrum. Going in, I had assumed it would be large, if not the largest component.
Oh cruel Apple. 12 hours after releasing the Apple Store they processed my application and sent me a key to test on my iPhone.

Decisions.

femtoblogger has reached that odd state for software. It works well enough that I am happy using it. There are rough edges, but not rough enough that I will fix them.

The only thing I have changed recently is to add a meta robots tag to suggest the aggregate pages, like the front page and archive months, not be indexed. That should help keep the clicks on target. I already had robot tags to deter indexing of all the non-content pages.

There remain two rough points:

  1. The WYSIWYG editing: This is still a bit awkward. Sometimes I get stuck in bold and have to pop into HTML mode to get out. Pasting in code ends up double spaced. I could make lots of elaborate workarounds, but I consider these to be browser bugs and hope they will shake themselves out over time. I could also switch to one of the giant WYSIWYG javascript editors, but then I wouldn’t be very femto, would I.
  2. I keep having a nagging desire to have images. I could do it now by attaching the image and making my own IMG tag, but I’m too lazy for that. I’ve been holding off coding proper image support (with resizing for display and full resolution click through) on the grounds that if I’m too lazy to type my own image tag then surely I shouldn’t spend a couple hours making full image support.

I suppose since femtoblogger has become stable it is time to move it into a public subversion repository.

A Debian administrator might want to install…

  • debsums  - check installed files for tampering, not complete, but a good start.
  • rkhunter - look for root kits.
  • chkrootkit - look for root kits.

Think about running these regularly to catch your basic root kitter.

You could cron them, but I prefer to run them manually, since I know I’d pull the cron entry if I rooted you.

I suppose you could do a forced reinstall before running for a little extra comfort.

I think a better tool would be one that used a central repository with a copy of each package and called on the observed machine to generate on the fly signatures of files with a random seed.

A truly nasty rooter could still thwart that by faking things in either the C runtime library or the appropriate system calls.
more articles