Dealing with pdf and ePub using calibre

I am currently starting with a Project, that deals with the ePub Format. I just thought, that it might be a good start to create a basic tool chain to create ePub Files from given Documents.

The de-facto Document Format is still PDF so i started with a Document in this Format. To make sure i deal with a CC Document i used a Document. created by my own: my ancient Diploma Thesis (there is only a german version :-/). The PDF is around 3.5 MBs in size.

If you work with different eBook Formats and different eBook Readers, you should definitely have a look at  calibre it is a all-in-one eBook Solution. It handles PDF and ePub Files and – more important – can convert PDF into ePub Files. The Resulting ePub File of my Diploma Thesis is available for Download here – Hope it looks better than on my iPhone using Stanza ;-).

As you can see, there is still some need to enhance the result of the conversion, but the result produced by the calibre converter is quite good and readable. There is a big problem with the headers and footers (e.g. page numbers), but for a automatically, free process, i can deal with it.

There might be some PDFs that calibre cannot process. I could solve this problem by “reprinting” the PDF with the MacOs PDF export. The calibre could also convert these PDF files.

Another cool thing i found today, is the conversation of PDFs into image files using the ImageMagick convert tool. There is a good Blog post at medicalnerds.com.

You need just a few steps.

First make sure, that you have a version of ImageMagick installed on your system:

    sudo port install ImageMagick (macports)

or

    sudo fink port install ImageMagick (fink)

After that you can use the convert command to generate image files from every page, your PDF Document contains:

    convert -density 300 file.pdf file.jpg

to get information about the progress, you can add the -monitor switch to the call.

Testpost

This is a Test Post…

with some….

formating…

and

  • bullets
  • more
  1. more
  2. and
  3. more

At last…

an image:

gui1

Okay… next… a link

Done.

Preparation for counter update

So after a long time i plan to give my counter-engine (^^) an update.
The main Problem is, that the counter itself was perfect for ~2000 counts. But now with 5000 count, the presentation of the results is just not readable anymore.
So i plan the following things to do during the next days (i hope i will finish this during tomorrow):

  • using a new drawing method: instead of drawing the whole graph, i will draw just time-slices of a particular periode. So e.g. if you want to plot the current graph with this method, it would be necessary to draw 24 slices with a month periode.
  • to get read of lots of code within the counter/presentation script, i want to use the build-in date-calculation functions of mysql.
    So e.g.
    SELECT something FROM `counts` WHERE DATE_SUB(CURDATE(),INTERVAL 30 DAY) <= date_col; Should be perfect :-).
  • To use this functions, i have to use the build-in datetime Datatype. At the moment i am storring all counts with a unix timestamp. To make the move, i have to do three steps:
    1. creating a new field: ALTER TABLE `counts` ADD `created` DATETIME NOT NULL;
    2. migrate the old dates: UPDATE `counts` SET created = from_unixtime(unixtime);
    3. finally i had to change to insert statement within the counter script:
      “INSERT INTO `counts` ( … user_string, created) VALUES … ‘”.$user_string.”‘, NOW()) “;

More next time…

what to do, if you locked yourself out from Mac OS?

Yesterday I found myself in a strange situation:

Every Shell Command I tried to use ended up with a “command not found“. This happened with sudo, nano … you name it.

After a short time, I figured out that the folder /usr/bin (where all these programs are stored) had only executable rights for the owner (so admin:wheel).

As a normal user I was not able to use them.

So how to change this if you cannot sudo ?

As always in MacOS, the best way to fix this, is to boot into Singe User Mode (restart and press the Apple/Command Key + “S”).
After you got into the Terminal view you have to scan the filesystem for errors:

/sbin/fsck -fy 

And then remount it as writable:

/sbin/mount -wu /

Now, you can alter the user rights for /usr/bin with:

chmod 755 /usr/bin

After a reboot you are again able to execute the commands.
If you still have problems you should control your PATH-settings.

echo $PATH 

It should contain /usr/bin near the beginning.

Nachlese: 25C3

Guten Tag Welt,
Hello World,

I wish you all the best for the future and a great year 2009!


Heute mal wieder was auf Deutsch.
Today again in german!


 

Zum Ende des Jahres 2008 habe ich mit einem Kollegen den Chaos Communication Congress in Berlin besucht.
Wir waren zum ersten (und definitiv nicht zum letzten) Mal dort.
Anfangs ein paar grundlegende Tipps um dort zu überleben:

Essentiell wichtig ist es, für die eigene Infrastruktur zu sorgen:

1. Mehrfachstecker (mindestens 6-fach, besser noch mehr).
2. Netzwerk-Switch – je mehr Anschlüsse man über hat, desto eher kann man sich wo anschließen.
3. Eine externe Festplatte (am besten 2,5″ mit USB-Stromversorgung, da der Strom zeitweise ausfiel und so die Festplatte vom Laptop Strom erhalten kann)
4. Laptop oder Netbook (das scheint wirklich der Trend zu sein in diesem Jahr)
5. Gute und bequeme Kopfhörer (es werden alle Vorträge im Netz übertragen, sodass man diese auch gut am Laptop verfolgen kann)

Das waren so die Dinge, die mir aufgefallen sind.
Letzendlich waren es _VIELE_ Menschen in dem kleineren BCC.

Bei den meisten Vorträgen musste man schon sehr früh innerhalb des Vortragsraumes sein.
Die Vorträge waren durchgehend sehr informativ und auch durchgehend auf hohem Niveau.
Ich habe wirklich sehr viele Anregungen mitgenommen.
Interessant war es, zeitgleich die Reaktionen der deutschen News-Portale mit zu verfolgen…

Also…. dieses Jahr fahre ich wieder hin!…. Aber deutlich besser vorbereitet :D.

Abschließend noch ein Video von dem “DDoS-Angriff” auf Dunkin’ Donuts:

Safari, Spotlight Craches after Timemachine Restore

So i almost gave up with solving some strange Software Crashes
For Example:

Spotlight wasn’t active. There was even no Spotlight icon.
Safari Crashes when i type the second word into a google search field.

After a while i browsed through my folder-tree and so i detected, that the tmp folder.
I remember that i set /tmp to be excluded during TM-Backups so save so Disk Space.
So after i restored this folder with

   cd /
   sudo ln -s /private/tmp /tmp
   sudo chmod 1777 /tmp

everything works fine again. IMHO it is a bug in the TM-System-Restore Workflow.

Blogged with the Flock Browser

Nexenta iSCSI Target Setup

root@sunny:~# zfs create tank/home
root@sunny:~# zfs create tank/home/philipp
root@sunny:~# zfs create -V 250M tank/home/philipp/TM
root@sunny:~# zfs set shareiscsi=on tank/home/philipp/TM
root@sunny:~# iscsitadm modify target -p 1 tank/home/philipp/TM
root@sunny:~# zfs list
NAME                             USED  AVAIL  REFER  MOUNTPOINT
syspool                          689M  16.6G    23K  none
syspool/rootfs-nmu-000           688M  16.6G   641M  legacy
syspool/rootfs-nmu-000@initial  47.3M      –   631M  –
tank                             250M  1.34T    21K  /tank
tank/home                        250M  1.34T  27.5K  /tank/home
tank/home/philipp                250M  1.34T    27K  /tank/home/philipp
tank/home/philipp/TM             250M  1.34T    24K  –
tank/media                        18K  1.34T    18K  /tank/media
root@sunny:~# iscsitadm list target -v
Target: tank/home/philipp/TM
    iSCSI Name: iqn.1986-03.com.sun:02:f683c44e-e774-c018-9f6f-89ef914db75b
    Alias: tank/home/philipp/TM
    Connections: 0
    ACL list:
    TPGT list:
        TPGT: 1
    LUN information:
        LUN: 0
            GUID: 0
            VID: SUN
            PID: SOLARIS
            Type: disk
            Size:  250M
            Backing store: /dev/zvol/rdsk/tank/home/philipp/TM
            Status: online

(via Solaris iSCSI Target with ESX 3.02 Server)

Blogged with the Flock Browser

Sunny-Notes

Network-Driver:

myamanet-vel (2.6.0)
Driver for VIA VT6122 GbE chipset
myamanet-vfe (2.6.2a-1)
Driver for VIA Rhine family fast ethernet chipset

iSCSI-Update [1]

To be continued….

Blogged with the Flock Browser