23.10.2009IPA - Client Backup Services

Da es mir zu mühsam ist, die Arbeit in HTML zu konvertieren (werde ich vielleicht noch nachholen), hier die Arbeit als PDF: backup_services.pdf [4MB]

Viel Spass beim Lesen.

PS: Ja ich weiss sie hat viele Rechtsschreibfehler, evtl. auch mal einen inhaltlichen, aber: Nobody’s perfect!

23.10.2009Im Bus

Frau: lacht.

Ein Mann der neben ihr sitzt und sie offenbar kennt sagt: "Wie kannst du lachen? Deine Schwestern sind tot."

Stille.

23.10.2009Doom for Sysadmins

Das Projekt Doom for Sysadmins lässt Kinderträume wahr werden: Wenn man es startet findet man sich in der Doom-Welt (ja, der Shooter Doom) und kann alle Prozesse die auf dem System laufen “killen”, bzw. durch verwunden “renicen”.

Ach das Admin-Leben ist schön, den ganzen Tag schiessen und Räume voller Monster überprüfen. Sobalds zu viele sind: losballern!

23.10.2009Find old Files and their size

The first part is clear, find the old files like that:

find . -type f -mtime +365 -print

This gets all Files (-type f, -type d for directories) in the current directory (.) older than a year (-mtime +365) and prints them on stdout (-print)

to delet them, just use:

find . -type f -mtime +365 -exec rm {} \;

But if you want to use them further, a pipe will help you. For any reasons (I don’t know) this is not possible with the -print command. My Solution was the following:

find . -type f -mtime +365 -exec echo {} \;

Now, because there are possibly many many many files, it’s best to use xargs for the argument handling. I use du -ch to determine the file-size and the total:

find . -type f -mtime +365 -exec echo {} \; | xargs du -ch

This should help, Google helped me half-way out, the rest is a little command line magic.

Note: In my case there where really too many files, so that the whole command ended with a broken pipe. I used -type d to reduce the amount of arguments, the disadvantage is that directories are not necessary the same age as the files within.

21.10.2009ODBC Hell

It is so easy: I have a testing environement where an OCI8-Driver is installed. Therefore I can use the OCI-Function if PHP to Bind Variables, get return values and everything is just fine.

Then on the production I needed to switch to ODBC, and thought: Easy just write this stuff for ODBC and you’re done.

Unfortunately the driver does simply not support return values of functions. The problem is, that there are updates in my function, so I can’t solve the problem using:

select function_name(param1,param2,param3,...) from dual

After giving up my return value, I wanted to run the function like that (in TOAD this is no problem):

begin :retval := function_name(?,?,?,?); end;

Afterwards you are giving an array of parameter to the PHP function odbc_execute, and this should work alright.

I tried hundrets of possibilities to run my function. Finally I gave up, made a procdure (which has no return value and vor sure ODBC has no support for OUT or INOUT-Vars). I resigned to have a return value (which should only be the number of updated rows).

I tried: begin procedure_name(?,?,?,?); end;

There was no reaction. My last try:

call procedure_name(param1,param2,param3,..);

This woked! So I need to use “call” and not using the parameter-array of ODBC but giving it directly into the call. I’m happy to get it working, but this costs me one day.

Is there any really working ODBC-Driver for PHP?

I gave up.

PS: Yes I know, there is a solution for my return value. In my procedure I could write the value into a temporary table. But I rather want to use a good driver (like the OCI8) than using such a temporary solution. I’m open to new ways of doing this.

21.10.2009Brainfucked Logo

++++++++++[>++++++++++<-]>——-<++++++++++[»+++++++++++++«-]\ »———«+++++[»>++++++++++«<-]»>—-«<++++++++++[»»+++««-]\ »»++>+++++++++++++««<++++[»»»++++++++++«««-]»»»++++«.»\ [««<.»»>-]<.«<.«++[»»»+++++«««-]»»»[«.»-][-]«««++\ [»»»++++«««-]»»»-[««<.»»>-][-]«««++[»»»++++++++++«««-]\ »»»-[«.»-]««<….»>….«.»>.«<.»…»[-]«««++++++++++\ [»»»++++++++++«««-]»»»—.[-]«««++++++++++[»»»++++++++++++«««-]\ »»»+.«….<.>…….<.<.»….<.«—-.+++..»>……..<.>….\ <.<.»..«.»>.«<.»..»[-]«««++++++++[»»»++++++++++«««-]»»»-.\ [-]«««++++++++++[»»»++++++++++«««-]»»».+++++.«…<.«……»>.\ <.>.«.»…<.>…<.«—-.+++..»>….<.«…»>.<.>.«.»..«.»>.«<.».»\ [-]«««+++++[»»»++++++++++«««-]»»».—..++++.«..«.»…….«.»..\ «.»..«.<—-.+++..».>…<.«—-.+++»>..«.»….«.»..«.»..«.»>.«<.\ »…….«.»…«<.»>…«.»..«.»..«.».«<.»>.«<—-.+++..».>.<.>..«.\ »….«.»..«.»..«.»>.«<.»…….«.»..«.».«.»..«.»..«.»..«.».\ «<.>.»…«<—-.+++».>…«.»….«.»..«.»..«.»>.«<.»…….«.»\ …….«.»..«.»..«.»….«<..».>….«.»….«.»..«.»..«.»>.«<.»\ …….«.»…….«.».<.>…«.».«<..».>…….«.»….«.».<.>…«.»>.\ «<.»…….«.<…….>.>.>….«.>.>……….«.<….>.>.>….«.»>.«<.»»\ [-]«««++++[»»»++++++++++«««-]»»»++++[««<.»»>-]««.

Nice isn’t it?\ \ Well, but you’re asking what this is all? I will give you the related links as soon as my link-system is working. For now this little explanation should help you, otherwise google for “Brainfuck tutorial”.\ \ Brainfuck is a very small (esoteric) programming language. It was design by a Swiss guy with the aim to write the smallest possible compiler for a Turing-complete language (his size is about 240 bytes).\ \ And sure Brainfuck is Turing-complete.\ \ The context of the language is a large array with (depending on the compiler and/or interpreter) about 30’000 array cells (each cell will be initalized with 0).\ \ The 8 instructions:\ > change the pointer to the next cell\ < change the pointer to the last cell\ + increment the cell value\ - decrement the cell value\ [ begin of loop\ ] end of loop (a loop stops is the value of the actual cell is 0)\ , read a value (input) into the actual cell\ . Print out the ascii sign belonging to the cell value\ \ Depending on that I will print you my bf-code of above again, this time with comments and so on:

 ____________________________________________|          ________                   ____   ||   by    /        /|    /\__        /    /| ||  Odi   /_______ / |   /   /\__    /___ / | || 2004  |         | |  |\__/   /\  |    |  | ||       |    _    | |  | _ \__/ /  |    |  | ||       |   | |   | |  | _|   \/   |    |  | ||       |         | |  |    __/    |    |  | ||       |         | /  | __/       |    | /  ||       |________ |/   |/          |____|/   |                      |____________________________________________|                                

Brainfuck Pendant (commentent):

FIRST PLACE IS THE FILL IN COUNTER PLACE\ \ ++++++++++[>++++++++++<-]>——- = 95 in 2nd place (ASCII for “_”) (pos:2)\ <++++++++++[»+++++++++++++«-]»——— = “|” (124) in 3th place (pos:3)\ «+++++[»>++++++++++«<-]»>—- = “/” (47) in 4th place (pos:4)\ «<++++++++++[»»+++««-]»»++ = SPACE (32) in 5th place (pos:5)\ >+++++++++++++ = “New Line” (13) in 6th place (pos:6)\ ««<++++[»»»++++++++++«««-]»»»++++ = 44 in 7th place (times to repeat “_”) Use as Counter place (pos:7)\ \ \ //START Line 1\ «. = Print SPACE at the beginning of line 1 (pos:5)\  » = Change Pointer to 7 (pos:7)\ [««<.»»>-] = Print 44 times “_” (pos:7)\ <. = Change to 6th place and print NewLine (pos:6)\ //END Line 1\ \ //START Line 2\ «<. = Change to 3th place; print “|” (pos:3)\ «++[»»»+++++«««-]»»» = Fill Counter with 10 (pos:7)\ [«.»-] = print 10 SPACE (pos:7)\ [-] = Clean 7th place to 0 (pos:7)\ «««++[»»»++++«««-]»»»- = Set counter place to 7 (pos:7)\ [««<.»»>-] = Print 8 “_” (pos:7)\ [-] = Clean 7th place to 0 (pos:7)\ «««++[»»»++++++++++«««-]»»»- = Set counter place to 19 (pos:7)\ [«.»-] = Print 19 SPACE (pos:7) \ ««<…. = Change to 2nd place; print 4 “_” (pos:2)\ »>…. = Change to 5th place: print 4 SPACE (pos:5)\ «. = Change to 3rd place: print “|” (pos:3)\ »>. = Change to 6th place: print NewLine (pos:6)\ //END Line 2\ \ \ //START Line 3\ «<. = Change to 3rd place; print “|” (pos:3)\ »… = Change to 5th place; print 3 SPACE (pos:5)\  »[-] = Clean 7th place (pos:7)\ «««  = Change pointer to 1 (pos:1)\ ++++++++++[»»»++++++++++«««-]»»»—. = Set 7th position to 98 (stands for “b”) and print it (pos:7)\ [-] = Clean 7th place (pos:7)\ «««  = Change pointer to 1 (pos:1)\ ++++++++++[»»»++++++++++++«««-]»»»+. = Set 7th position to 121 (stands for “y”) and print it (pos:7)\ «…. = Change to 5th place; print 4 SPACE (pos:5)\ <. = Change to 4th place; print “/” (pos:4)\ >……. = Print 8x SPACE (pos:5)\ <. = Print “/” (pos:4)\ <. = Print “|” (pos:3)\ »…. = Print 4 SPACE (pos:5)\ <. = Print “/” (pos:4)\ «—-. = Print “" (_{95} minus 3 = \{92}) (pos:2)\ +++.. = Print 2 “_” (pos:2)\ »>…….. = Print 8x SPACE (pos:5)\ <. = Print / (pos:4)\ >…. = Print 3 times SPACE (pos:5)\ <. = Print “/” (pos:4)\ <. = Print “|” (pos:3)\  ».. = Print SPACE (pos:5)\ «. = Print “|” (pos:3)\ »>. = Print NewLine (pos:6)\ //END Line 3\ \ //START Line 4\ «<. = Change to 3rd place; print “|” (pos:3)\  ».. = Change to 5th place; print 3 SPACE (pos:5)\  »[-] = Clean 7th place (pos:7)\ «««  = Change pointer to 1 (pos:1)\ ++++++++[»»»++++++++++«««-]»»»-. = Set 7th position to 79 (stands for “O”) and print it (pos:7)\ [-] = Clean 7th place (pos:7)\ «««  = Change pointer to 1 (pos:1)\ ++++++++++[»»»++++++++++«««-]»»». = Set 7th position to 100 (stands for “d”) and print it (pos:7)\ +++++. = Set 7th place to 105 (stands for “i) (pos:7)\ «… = Print 3 SPACE (pos:5)\ <. = print “/” (pos:4)\ «…… = Print 5 “_” (pos:2)\ »>. = Print a SPACE (pos:5)\ <. = Print “/” (pos:4)\ >. = Print SPACE (pos:5)\ «. = Print “|” (pos:3)\ »… = Print 3 SPACE (pos:5)\ <. = Print “/” (pos:4)\ >… = Print 3 SPACE (pos:5)\ <. = Print “/” (pos:4)\ «—-.+++ = Print “" (decrease “_” about 3 back to the orgin) (pos:2)\ .. = Print 2 “_” (pos:2)\ »>…. = Print 4 SPACE (pos:5)\ <. = Print a “/” (pos:4)\ «… = Print 2 “_” (pos:2)\ »>. = Print a SPACE (pos:5)\ <. = Print a “/” (pos:4)\ >. = Print a SPACE (pos:5)\ «. = Print a “|” (pos:3)\  ».. = Print SPACE (pos:5)\ «. = Print “|” (pos:3)\ »>. = Print NewLine (pos:6)\ //END Line 4\ \ //START Line 5\ «<. = Change to 3rd place; print “|” (pos:3)\  ». = Change to 5th place; print 3 SPACE (pos:5)\  »[-] = Clean 7th place (pos:7)\ «««  = change position to 1 (pos:1)\ +++++[»»»++++++++++«««-]»»». = Print “2” (50) (pos:7)\ —.. = Print 2x “0” (48) (pos:7)\ ++++. = Print “4” (52) (pos:7)\ «.. = Print 2 SPACE (pos:5)\ «. = Print a “|” (pos:3)\ »……. = Print 9x SPACE (pos:5)\ «. = Print a “|” (pos:3)\  ».. = Print a SPACE (pos:5)\ «. = Print a “|” (pos:3)\  ».. = Print 2x SPACE (pos:5)\ «. = Print a “|” (pos:3)\ <—-.+++ = Print a “" (pos:2)\ .. = Print 2x “_” (pos:2)\  ». = Print a “/” (pos:4)\ >… = Print 3x SPACE (pos:5)\ <. = Print a “/” (pos:4)\ «—-.+++ = Print a “" (pos:2)\ »>.. = Print 2x SPACE (pos:5)\ «. = Print a “|” (pos:3)\ »…. = Print 4x SPACE (pos:5)\ «. = Print a “|” (pos:3)\  ».. = Print 2x SPACE (pos:5)\ «. = Print a “|” (pos:3)\  ».. = Print 2x SPACE (pos:5)\ «. = Print a “|” (pos:3)\ »>. = Print NewLine (pos:6)\ //END Line 5\ \ //START Line 6\ «<. = Change to 3rd place; print “|” (pos:3)\ »……. = Change to 5th place; print 7x SPACE (pos:5)\ «. = Print a “|” (pos:3)\ »… = Print 3x SPACE (pos:5)\ «<. = Print a “_” (pos:2)\ »>… = Print 3x SPACE (pos:5)\ «. = Print a “|” (pos:3)\  ».. = Print a SPACE (pos:5)\ «. = Print a “|” (pos:3)\  ».. = Print 2x SPACE (pos:5)\ «. = Print a “|” (pos:3)\  ». = Print a SPACE (pos:5)\ «<. = Print a “_” (pos:2)\ »>. = Print a SPACE (pos:5)\ «<—-.+++ = Print a “" (pos:2)\ .. = Print 2x “_” (pos:2)\  ». = Print a “/” (pos:4)\ >. = Print a SPACE (pos:5)\ <. = Print a “/” (pos:4)\ >.. = Print 2x SPACE (pos:5)\ «. = Print a “|” (pos:3)\ »…. = Print 4x SPACE (pos:5)\ «. = Print a “|” (pos:3)\  ».. = Print 2x SPACE (pos:5)\ «. = Print a “|” (pos:3)\  ».. = Print 2x SPACE (pos:5)\ «. = Print a “|” (pos:3)\ »>. = Print NewLine (pos:6)\ //END Line 6\ \ //START Line 7\ «<. = Change to 3rd place; print “|” (pos:3)\ »……. = Change to 5th place; print 7x SPACE (pos:5)\ «. = Print a “|” (pos:3)\  ».. = Print 2x SPACE (pos:5)\ «. = Print a “|” (pos:3)\  ». = Print a SPACE (pos:5)\ «. = Print a “|” (pos:3)\  ».. = Print 2x SPACE (pos:5)\ «. = Print a “|” (pos:3)\  ».. = Print a SPACE (pos:5)\ «. = Print a “|” (pos:3)\  ».. = Print 2x SPACE (pos:5)\ «. = Print a “|” (pos:3)\  ». = Print a SPACE (pos:5)\ «<. = Print a “_” (pos:2)\ >. = Print a “|” (pos:3)\ »… = Print 3x SPACE (pos:5)\ «<—-.+++ = Print a “" (pos:2)\  ». = Print a “/” (pos:4)\ >… = Print 3x SPACE (pos:5)\ «. = Print a “|” (pos:3)\ »…. = Print 4x SPACE (pos:5)\ «. = Print a “|” (pos:3)\  ».. = Print 2x SPACE (pos:5)\ «. = Print a “|” (pos:3)\  ».. = Print 2x SPACE (pos:5)\ «. = Print a “|” (pos:3)\ »>. = Print NewLine (pos:6)\ //END Line 7\ \ //START Line 8\ «<. = Change to 3rd place; print “|” (pos:3)\ »……. = Change to 5th place; print 7x SPACE (pos:5)\ «. = Print a “|” (pos:3)\ »……. = Print 7x SPACE (pos:5)\ «. = Print a “|” (pos:3)\  ».. = Print a SPACE (pos:5)\ «. = Print a “|” (pos:3)\  ».. = Print 2x SPACE (pos:5)\ «. = Print a “|” (pos:3)\ »…. = Print 4x SPACE (pos:5)\ «<.. = Print 2x “_” (pos2)\  ». = Print a “/” (pos:4)\ >…. = Print 4x SPACE (pos:5)\ «. = Print a “|” (pos:3)\ »…. = Print 4x SPACE (pos:5)\ «. = Print a “|” (pos:3)\  ».. = Print 2x SPACE (pos:5)\ «. = Print a “|” (pos:3)\  ».. = Print 2x SPACE (pos:5)\ «. = Print a “|” (pos:3)\ »>. = Print NewLine (pos:6)\ //END Line 8\ \ //START Line 9\ «<. = Change to 3rd place; print “|” (pos:3)\ »……. = Change to 5th place; print 7x SPACE (pos:5)\ «. = Print a “|” (pos:3)\ »……. = Print 7x SPACE (pos:5)\ «. = Print a “|” (pos:3)\  ». = Print a SPACE (pos:5)\ <. = Print a “/” (pos:4)\ >… = Print 3x SPACE (pos:5)\ «. = Print a “|” (pos:3)\  ». = Print a SPACE (pos:5)\ «<.. = Print 2x “_” (pos2)\  ». = Print a “/” (pos:4)\ >……. = Print 7x SPACE (pos:5)\ «. = Print a “|” (pos:3)\ »…. = Print 4x SPACE (pos:5)\ «. = Print a “|” (pos:3)\  ». = Print a SPACE (pos:5)\ <. = Print a “/” (pos:4)\ >… = Print 3x SPACE (pos:5)\ «. = Print a “|” (pos:3)\ »>. = Print NewLine (pos:6)\ //END Line 9\ \ //START Line 10\ «<. = Change to 3rd place; print “|” (pos:3)\ »……. = Change to 5th place; print 7x SPACE (pos:5)\ «. = Print a “|” (pos:3)\ <……. = Print 7x “_” (pos:2)\ >. = Print a “|” (pos:3)\ >. = Print a “/” (pos:4)\ >…. = Print 4x SPACE (pos:5)\ «. = Print a “|” (pos:3)\ >. = Print a “/” (pos:4)\ >………. = Print 10x SPACE (pos:5)\ «. = Print a “|” (pos:3)\ <…. = Print 4x “_” (pos:2)\ >. = Print a “|” (pos:3)\ >. = Print a “/” (pos:4)\ >…. = Print 4x SPACE (pos:5)\ «. = Print a “|” (pos:3)\ »>. = Print NewLine (pos:6)\ //END Line 10\ \ //START Line 11\ «<. = Change to 3rd place; print “|” (pos:3)\ »»[-] = Clean 7th place (pos:7)\ «««++++[»»»++++++++++«««-]»»»++++ = 44 in 7th place (times to repeat “_”) Use as Counter place (pos:7)\ [««<.»»>-] = Print 44 times “_” (pos:7)\ ««. = Change to 3rd place and print “|” (pos:3)\ //END Line 11

Brainfucked wishes

08.10.2009Ein Tisch ist ein Tisch

Nach einem Text vom Peter Bichsel, im Stile von “Kunst aufräumen” ordne ich mal Bichsels Text neu.

Orginal Text: http://www.yolanthe.de/stories/bichsel01.htm

Nomen

  Mann        Menschen
  Bild        Bett
  Wecker      Stuhl
  Teppich     Tisch
  Bett        Zeitung
  Stuhl       Spiegel
  Fotoalbum   Wecker
  Zeitung     Schrank
  Schrank     Teppich
  Spiegel     Fotoalbum
  Fuss        Mann
  Morgen      Fuss
  Mann        Morgen

Verben

  stellen    läuten
  schauen    frieren
  läuten     liegen
  frieren    stehen
  blättern   stellen

08.10.2009Papier - Zum Tragen kein Problem

Wenn ich eine Tüte für mein Brötchen bekomme finde ich es immer angenehm, dass die auch halten.

Eine normale Tüte, aber…

DAS ist wichtig!

In dem Sinne: trägt euch sorge, denn es ist gut.

24.08.2007MS Access: Let lines in Reports grow with it's content

The problem is the following: You create a report with MS Access with a text field. To display the whole text, you have to set the “CanGrow” property to “Yes” (on the section and on the text-field). When running the report that has vertical lines as column seperator you have an ungly effect: The line keeps its size, as this has been fixed in the design view.

One might think that the easy solution is to adjust this length at runtime. First of all I need to declare what “runtime” means. As this problem occures in every “Detail”-Section we must dive in the events a section provides. There are three of them “OnRetreat”, “OnFormat” and “OnPrint” (apart all the mouse events, which are defenitly not suitable).

The Retreat-Event occurs “when Microsoft Access returns to a previous report section during report formatting” (Source: VBA Help). Not exactly what we’re looking for.

The Format-Event occurs “when Microsoft Access determines which data belongs in a report section, but before Access formats the section for previewing or printing”. It sounds good, but at this point we don’t have our data in the section and are therefore unable to determine the correct height.

Finally the Print-Event “after data in a report section is formatted for printing, but before the section is printed”. Here we are, we have our data which is not yet printed. The problem is that at this point all elements are already formatted, all we can do is add new elements and that’s why we can’t just adjust the height of each line by setting it via

 Me.myLine.Height = Me.Height '''this does not work in the OnPrint event, myLine has already been formatted

The simple solution is to draw a new line and use your already placed line as a template:

Private Sub Detail_Print(Cancel As Integer, PrintCount As Integer)
    Dim EndOfLine As Double
    EndOfLine = Me.Height       ''height of section (where the line stops)

    ''becasue it's not allowed in such a late state to change lines, we draw new one's based on the old
    ''myLine
    Me.Line (Me.myLine.Left, 0)-(Me.myLine.Left, EndOfLine)

End Sub;

30.06.2007MS Access and not updatable Recordsets

The whole thing is just plain stupid: Someone in the department I work in has created an MS Access Database to track our customers. Above this application are some forms to insert the data. Now we already have much of the data in various excel sheets etc. So my task was to write a function (or method or sub or whatever you call it in your world) to get some values from an excel sheet and insert it to a form, just like a user would do it. Like that the user has the possibility to check and change the data before it gets saved in the database. Now if you bind the form elements to parts of a query, Access gets your data as a so called snapshot via MS Jet (your communication channel to the DB). Snapshot data is not updateable, so if you try to assign your own values to form elements an error message pops up and that’s it.

My first solution was to ignore that fact and simply update my data directly to the database. But then all nice features like the “undo” option (to reset a record) or the possibility to check values before they get inserted are lost. The solution I came up is simple, but you need to check your status very exact to keep a usable form.

I have a form with my data, I have a save button, I have an exit button and I have an update button. There is a special button to start the gathering of data from the excel sheet. Now If you want to change the value of a textbox on the form you need to cut the textbox off the data (ControlSource = ""), then you can freely change the value.

Now you can’t simply update the current record, because the textbox is no longer in the recordset. This means that you have to update the value directly in the database when the save button is pressed. Then reattach the ControlSource and Requery and Repaint your form.

When you want to Undo your changed, just don’t save your values in the DB and reassign the ControlSource and Refresh the form, the old value will appear.