Donnerstag, 24. April 2008

Centering verticaly

Hi,

I was searching for that stuff some years ago, but there was no option to center a div in the body verticaly in those times.
But know there is a nice solution, at least a solution, to make this formating.
I had tome hints from here.



<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="de" lang="de">
<head>
<meta http-equiv="Content-type" content="text/html; charset=utf-8" />
<title>Verticaly and horizontaly centering</title>
<style type="text/css">
html, body {
width: 100%;
height: 100%;
padding: 0;
margin: 0;
}
html {
overflow: hidden;
}
body {
text-align: center; /*horizontal center in IE*/
}
body[id] {
display: table;
}
#table {
position: absolute;
top: 50%;
left: 50%;
}
#table[id] {
position: static;
display: table-cell;
vertical-align: middle;
}
#cell {
text-align: left;
background: #9f9;
position: relative;
top: -50%;
left: -50%;
height: 300px;
width: 500px;
overflow: auto;
margin: 0 auto 0 auto;
padding: 0.5em;
}
#cell[id] {
position: static;
}
</style>
</head>
<body id="body">
<div id="table">
<div id="cell">
<p>The div box with the green background ist now centered verticaly and horizontaly in IE lte 6 and Firefox<br/>
The css definition like <b>body[id]</b> mean: every body element with an id attribute.<br/>
This will not be interpreted by the IE lte 6, so we can use this syntax to make different definition for IE, and the rest of the browsers.
<br/>
And if we put some more text in this div, we will have a scroll bar just for this one.<br/>
I also added some padding to this div, just to look a little better.
</p>
<p>
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.<br/>
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
</p>
</div>
</div>
</body>
</html>

Dienstag, 22. April 2008

Python and UTF-8 files

Hi,
gestern wollte ich eine Datei mit python schreiben. Die Datei musste aber utf-8 encoded sein. So etwas reicht nicht:


s = u'Hier ein utf-8 string'
f = file('some_file.html','w')
f.write(s)
f.close()



statt dessen muss man folgendes machen:


import codecs
u'Hier ein utf-8 string'
f = codecs.open('some_file.html','w','utf8')
f.write(s)
f.close()



fertig.
Will ich an dieser Stelle nur mal festhalten.

Alles andere zu utf-8 gibt es noch hier:
http://evanjones.ca/python-utf8.html

Sonntag, 13. April 2008

Serverinstallation Debian

Hi,
nachdem der k&m jetzt alle meine Hardwarekomponenten hatte, bin ich meine Bestellung abholen gegangen. Bestellt wurde ein komplett neues System:

Hardware:
- Asus Mainboard m2n-vm DVI (spezifikationen)
- AMD Sempron 64 Le-1150 Sprata 2000MHz
- 1024MB Infineon/Qimonda PC2-6400 CL5/CL6
- 3.5" Samsung 80GB HD080HJ/P/82GJ 7200U/m 8MB (2mal)
- Samsung (Bulk) SH-S203N/P SATA weiss LightScribe

Plus Netzteil, Kabel und was noch nötig ist. Eine Gehäuse hab ich bei mir im Schrank gefunden ;-)
Beim Zusammenbauen gab es im Prinzip keine Probleme.

Installation:
Eine Entscheidung für das Betriebssystem ist eigentlich recht einfach: Debian!
Nun gibt es aber nicht nur Debian, sondern auch Ubuntu Server, welches als Ubuntu 6.06 Server Edition bis 2011 Supportet wird.

Debian Etch:
Ist zur Zeit die Stable von Debian. Hab die Netinstall CD gebrannt und los gehts. Es bootet, aber meint, nachdem Sprache und Tastaturlayout ausgewählt sind, dass es kein CDROM gibt. Es handelt sich dabei um ein SATA DVD-ROM, und offenbar macht das Probleme. Hab dann in einem Forum gefunden, dass die Bootoption "expert generic.all_generic_ide=1" dieses Problem beheben sollte, hat es aber nicht.
... Ok, was jetzt?

Ubuntu Server 6.06 LTS:
Genau das gleiche Problem. Forumsuche waren auch erfolglos. Anscheinend kann er den SATA Controller selbst nicht erkennen. Was mir jetzt natürlich wenig bringt...

Ubuntu Server 7.10:
Kommt für mich nicht in Frage. Der alte Server lief jetzt seit 2001, oder so. Ist glaub noch Debian woody drauf. 7.10 ist nur bis 2009 supportet, was mir zu kurz ist...

Debian Lenny (test):
Erkennt ein CD-Laufwerk, aber bricht dann bei der Installation ab. Gleich am Anfang, mit irgend einer Bootstrap Fehlermeldung.
Da Lenny noch Beta ist, ist da vielleicht was faul, und deshalb werd ich dem erst mal nicht weiter nachgehen.

Zurück zu Etch:
Nun habe ich ein IDE CD-Rom angeschlossen, welches gefunden wird. Dafür wird das Onboard Ethernet Device nicht erkannt. Das ist natürlich ärgerlich.

Das Selbe übrigens für Ubuntu 6.06.

Jetzt hab ich mal die Lenny XFCE heruntergeladen und siehe da: Es geht. Vielleicht war nur die andere Lenny CD beschädigt?

Der Plan ist ein Linux Softwareraid (Raid 1 ) zu machen. Ich werde mich dabei an diese Anleitung halten.

Das mit dem Raid hat super geklappt. Ich hatte am Anfang schon befürchtet, dass man zumindest das verzeichnis /boot auf eine eigene Partition knallen muss, die nicht im Raid sein sollte. Aber es ist jetzt alles Raid1. Bzw. es sind 4 Raid1 MDs.

Es ist jetzt recht spät. Fast 4 Uhr, und ich war ab 13 Uhr unterwegs auf einem Gig mit stinky pete. Hab jetzt noch kurz das Raid1 zeugs fertig gemacht, damit ich morgen mit dem einrichten des Servers für das Büro wo er stehen soll weitermachen kann.... nachdem ich ausgeschlafen habe.
Das ist dann zunächst nur SAMBA, aber hab daran schon lange nix gemacht, und in den letzten 5 Jahren hat sich sicher was getan.
Morgen also ein nächster Bericht über das alles... vielleicht.