Techie Notes

Lensfun lens profile for m.zuiko 17mm prime

posted Feb 21, 2011 12:35 AM by Tedman Leung   [ updated Jul 25, 2011 8:26 PM ]

I've submitted this back to lensfun so hopefully this will appear in the lens db soon. For now here it is

<lens>
    <maker>Olympus</maker>
    <model>Olympus M.Zuiko Digital 17mm F2.8 Pancake</model>
    <mount>Micro 4/3 System</mount>
    <cropfactor>2.0</cropfactor>
    <calibration>
        <distortion model="poly3" focal="17" k1="-0.110" />
<tca model="poly3" focal="17" br="-0.0002" vr="1.00045" bb="0.0003" vb="1.0002" />
    </calibration>
</lens>

Hand crafted distortion and tca because the hugin generated values were off by about a factor of 4... 4x too weak distortion correction and 4x too strong tca correction.

--- addition ---

After more investigation... It turns out that UFRaw is having problems applying the correction. My current suspicion which I've raised with them is they are not taking the crop factor of the lens/sensor into account.

As a result the above numbers work for the buggy UFRaw but will not work once fixed. This is evidenced by trying to use these numbers in other applications like DarkTable. This also explains why the hugin generated numbers appeared to not work in ufraw.

Making Fedora 14 auto mount 2nd encrpyted HD on startup

posted Jan 26, 2011 10:29 PM by Tedman Leung   [ updated Jan 26, 2011 10:36 PM ]

My setup is a laptop with 2 hard drives. The second hard drive was pulled out of my older laptop so it was also encrypted with luks.

ls -l /dev/disk/by-uuid will get you the uuid of the second hd partition you want i.e. "8492dc43-afab-4b5b-b169-b55f5b1cb87b -> ../../sdb2" for me.

edit /etc/cryptab add an extra line for the other parition, i.e. "luks-8492dc43-afab-4b5b-b169-b55f5b1cb87b UUID=8492dc43-afab-4b5b-b169-b55f5b1cb87b none" for me.

etc /etc/fstab add an extra line for the new mount partition, i.e. "/dev/mapper/vg_tedsx61s-lv_root /backup        ext3 defaults        0 0" in my case.

To create a new encrypted HD, you should be able to just follow the directions below in the posting about making an encrypted usb flash drive.

Making Fedora 14 start wireless network on bootup

posted Jan 9, 2011 5:14 PM by Tedman Leung

  1. configure your wireless device through the network manager as usual so you can start it normally once logged in. Make sure Connection automatically and Available to all users is selected.
  2. edit your /etc/init.d/network file and change the line "chkconfig: - 24 90", basically you need network to start after NetworkManager
  3. run "chkconfig --del network", then "chkconfig --add network" (to reset the start order). then
    "chkconfig network on"
Now hopefully it works... it did for me.

Making the thinkpad t410 quiet with Fedora 14

posted Dec 26, 2010 7:33 AM by Tedman Leung   [ updated Dec 31, 2010 12:29 AM ]

The two main sources of noise are
  1. Fan
  2. Hard Drive
To slowdown the fan.... create a file /etc/modprobe.d/thinkpad_acpi.conf, it needs 1 line "options thinkpad_acpi fan_control=1". Then do "echo level 1 > /proc/acpi/ibm/fan" to change the speed to the slowest speed (with out stopping it). As usual I put that in my favourite startup script... /etc/init.d/cpuspeed. The level depends on your usage, I suspect 1 is fine for most people. It is enough to decrease the temperature to about 42C. When you use the cpu it will go up, but when it's mostly idle it will come back down. If you're using the cpu a lot like for games or as a production server then this won't do. For people who's cpu is idle most of the time, this will be quiet and cool.

To slow the hard drive down... "hdparm -M 128 /dev/sda". As always I put that in /etc/init.d/cpuspeed as well.

Now it's almost dead quiet. I can still heard the HD spinning slowly but the only way to get rid of that would be to buy an SSD which is still too expensive at this current time.

Resizing encrypted root partition in Fedora 14

posted Dec 23, 2010 1:52 AM by Tedman Leung

If you're resizing a partition, you just unmount it and use the partition manager and specify the size.

If it happens to be your root partition, you need to boot off of usb stick or something as the partition should not be mounted.
  1. boot off a usb disk like the net install image on a usb stick.
  2. drop to the friendly command line
  3. "modprobe dm-crypt" to load the encryption module
  4. "cryptsetup luksOpen /dev/sda1 crypt1" to unencrypt the partition where /dev/sda1 is your encrypted luks partition
  5. "lvm vgscan --mknodes" and "lvm vgchange -ay" to activate the encrypted partition
  6. "e2fsck -f /dev/mapper/vg_tedst410-lv_root" to check the partition
  7. "resize2fs -p /dev/mapper/vg_tedst410-lv_root 200g" to resize that file-system to 200 gigs (yes that's the file system only, not the partition)
  8. "e2fsck -f /dev/mapper/vg_tedst410-lv_root" to check to make sure it's still ok
  9. "lvreduce -L 200G /dev/vg_tedst410/lv_root" to resize the partition to 200 gigs.
I wrote this after I ran all the commands so double check the parameters before running it.

Building a remote shutter release for E-P1

posted May 6, 2010 9:48 PM by Tedman Leung   [ updated Apr 24, 2011 11:24 PM ]

I needed a long remote shutter release for my E-P1. This is the details :

pins The first thing you need to know is the pins to release the shutter. The pins are pointed out in green. From some postings on the internet, they refer to the top pin as "pin 11", the bottom pins from left to right is "pin 4" and "pin 3" respectively.

pin 11 + pin 3 = half press i.e. focus.
pin 11 + pin 3 + pin 4 = full press i.e. shutter release.

You can hard wire pin 4+11 together if you never want to pre-focus. This means when pin 3 is added, it will focus then shutter.

(After further investigation, it appears pin 3 & 9 can be used interchangeably, maybe it's just the ground?)


plug So the question is, where do you get such a plug. The answer is... that video out cable you never use. Take the video out cable and cut the plastic cover off the plug.

Once you remove the cover you will be left with a plug which you can pull off the cable. There's a bunch of metal contacts sticking out. Here you have 2 choices, yank them all out, or yank them all out except pins 3/4/11. If one of those pins came out with the cable, you'll have to put one of the other pins into the spot. You now need to solder a wire to the contacts, so either solder the wire to the contacts sitting in the plug, or solder a wire to the pins and then put them into 3/4/11 of the plug.


plug This is a picture of me testing the pins... I just stuck the plug into the camera and hot wired the pins to test.


plug

For the wire, I used a telephone cable. It's cheap and has 4 wires, I only really needed 3 of the wires.

Once the plug is soldered to the wire, just blob a ton of hot melt glue over it to make it a solid piece.

On the other side, I bought 2 press button switches. One switch activates the focus, the other activates the shutter. The plan is to tape the two buttons together so pressing it will cause it to focus and shutter.

The picture is the finished result. 2 metres long and works like a charm.

write speed test on drives (flash/sdhc or otherwise)

posted Apr 17, 2010 3:12 PM by Tedman Leung   [ updated Apr 17, 2010 3:34 PM ]

I need to put this command some where so I can find it in the future... so it's going to go right here :

time (dd count=1k bs=1M if=/dev/zero of=/media/HTC_G1/out.bin ; sync)

you need the sync in there to flush the buffer, then you need to calculate the time manually, i.e.

... 1073741824 bytes (1.1 GB) copied, 293.588 s, 3.7 MB/s ...
... real    4m56.374s ...

4*60+56 = 296 seconds
1073741824 bytes = 1024 MB
1024/296=3.45 MB / second (a.k.a. in sd card terms class 3.45 :) )

KVM/QEMU slow with windows xp on fedora 12

posted Apr 15, 2010 9:16 AM by Tedman Leung   [ updated Apr 15, 2010 9:20 AM ]

I tried to install windows xp in kvm on fedora 12. The result was a very very slow windows xp virtual system. After some tinkering, I think I found my problem. My fedora 12 is x86_64 so the virtual machine defaulted to emulating x86_64. When creating the virtual machine instance, change it to i686 instead under the advanced settings. Everything ran 10 times faster once I reinstalled the virtual machine instance like that.

Fedora 12 encrypting USB / Flash Drive

posted Mar 22, 2010 8:58 PM by Tedman Leung

Task Command
Partition your media fdisk /dev/sdb
Set the raw partition as encrypted
cryptsetup luksFormat /dev/sdb1
Create a temporary mapping so you can format partition for usage. I'm calling the temp mapping "temp".
cryptsetup luksOpen /dev/sdb1 temp
Format the encrypted partition
mkfs.ext3 /dev/mapper/temp
Set the label of the partition. I'm calling my partition backup.
e2label /dev/mapper/temp backup
un-map the temporary mapping
cryptsetup luksClose /dev/mapper/temp


At this point you will have an encrypted drive. If you unplug it and plug it back in it will automatically prompt you for the password and mount it. If you use the GUI to unmount the partition everything will work fine. If you accidentally umount it from the the command line or unplug the drive with out unmounting it, you will receive an error the next time you try to mount it. To fix that, you need to run the "cryptsetup luksClose" command on /dev/mapper/xxxxx where xxxxx is the mount point it complains about when it tries to mount it.

ext4 + MySql performance issues

posted Mar 18, 2010 9:46 PM by Tedman Leung   [ updated Dec 23, 2010 9:19 PM ]

I recently attempted an upgrade of my Fedora 10 system to Fedora 12. Fedora 12 uses ext4 by default. After installing F12 I noticed some of my junit tests were running very slowly. Junit tests that use to take about 1.5 seconds were now taking 9 seconds. The entire suite of test use to take about 1 minute 30 seconds using ext3, it now took close to 5 minutes on ext4.

After some more extensive testing here are some of the results.
  • If you install F12 with ext4 the system is slow, if you do the exact same install with ext3 it is quick.
  • If you test with an external HD, you get mixed results, sometimes it was quick on external usb drives even when formatted with ext4.
  • If you make a spare partition on your main HD, you can see the results by making it ext3 / 4 and restarting your MySql.
  • It's not simply and ext4 overall performance problem though, a test of zipping a slew of small files (source code) showed ext4 was running faster than ext3.
  • Another way to notice the problem but not as severely was to import a mysql database. An imports seemed to take 33% longer than previously.
My final solution was to re-install F12 using ext3 as the file system. This resolved all my problems.

For reference, I was also using encryption on the HD but I also tested it with out encryption with similar slow down results. I also played with turning on and off selinux with no real effect.

-----

Upon further investigation it appears that it has to do with write barriers. http://kernelnewbies.org/Ext4#head-25c0a1275a571f7332fa196d4437c38e79f39f63 allegedly if you mount the FS with barrier=0 it will run a lot faster. There are integrity ramifications though.

-----

Update for Fedora 14 :
Installed Fedora 14 today and unfortuntely the problem still exists.

Here's a few snippets from my ext3 system running FC12:

Tests run: 9, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.219 sec
Running org.oscarehr.caisi_integrator.dao.FacilityTest
Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 1.794 sec
Running org.oscarehr.caisi_integrator.util.MiscUtilsTest
Tests run: 5, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.017 sec
Running org.oscarehr.caisi_integrator.dao.EventLogTest
Tests run: 3, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 1.853 sec
Running org.oscarehr.caisi_integrator.dao.DemographicLinkTest
Tests run: 2, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 2.237 sec
 
Here's the same on ext4 using defaults running FC14:

Tests run: 9, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.276 sec
Running org.oscarehr.caisi_integrator.dao.FacilityTest
Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 19.323 sec
Running org.oscarehr.caisi_integrator.util.MiscUtilsTest
Tests run: 5, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.017 sec
Running org.oscarehr.caisi_integrator.dao.EventLogTest
Tests run: 3, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 18.865 sec
Running org.oscarehr.caisi_integrator.dao.DemographicLinkTest
Tests run: 2, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 23.002 sec

As you can see it's roughly 10x slower... than ext3 on FC12.

Here's ext4 after setting barrier=0 in /etc/fstab on FC14

Tests run: 9, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.427 sec
Running org.oscarehr.caisi_integrator.dao.FacilityTest
Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 6.03 sec
Running org.oscarehr.caisi_integrator.util.MiscUtilsTest
Tests run: 5, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.019 sec
Running org.oscarehr.caisi_integrator.dao.EventLogTest
Tests run: 3, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 5.854 sec
Running org.oscarehr.caisi_integrator.dao.DemographicLinkTest
Tests run: 2, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 7.16 sec

The performance is still about 3x worst than ext3 on FC12.

Here's ext3 and defaults on FC14 :

Tests run: 9, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.269 sec
Running org.oscarehr.caisi_integrator.dao.FacilityTest
Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 3.646 sec
Running org.oscarehr.caisi_integrator.util.MiscUtilsTest
Tests run: 5, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.015 sec
Running org.oscarehr.caisi_integrator.dao.EventLogTest
Tests run: 3, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 3.745 sec
Running org.oscarehr.caisi_integrator.dao.DemographicLinkTest
Tests run: 2, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 4.51 sec

The performance is still 2x worst than ext3 on FC12.

Here's ext4 and noatime,nodiratime,barrier=0,data=journal,commit=30 on FC14 :

Tests run: 9, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.276 sec
Running org.oscarehr.caisi_integrator.dao.FacilityTest
Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 2.747 sec
Running org.oscarehr.caisi_integrator.util.MiscUtilsTest
Tests run: 5, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.017 sec
Running org.oscarehr.caisi_integrator.dao.EventLogTest
Tests run: 3, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 2.813 sec
Running org.oscarehr.caisi_integrator.dao.DemographicLinkTest
Tests run: 2, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 3.528 sec

Performance is now about 1.5x worst than FC12 & ext3.

Here's ext3 and noatime,nodiratime,data=journal,commit=30 on FC14 :

Tests run: 9, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.28 sec
Running org.oscarehr.caisi_integrator.dao.FacilityTest
Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 1.98 sec
Running org.oscarehr.caisi_integrator.util.MiscUtilsTest
Tests run: 5, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.018 sec
Running org.oscarehr.caisi_integrator.dao.EventLogTest
Tests run: 3, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 1.939 sec
Running org.oscarehr.caisi_integrator.dao.DemographicLinkTest
Tests run: 2, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 2.371 sec

YAYAYA!! kind of. It's still about 10% slower than FC12 & ext3 but that's acceptable for me - for now.

The kickers is that I had to enable data=journal which wasn't enabled on my FC12 system it was using the default writeback. For fun... I went back to the FC12 system and enabled journal. As expected it was slower... by about 20% (the unexpected result is that journalling was faster in FC14...).




1-10 of 13