Archive for the ‘Programmierung’ Category.

FastGlacier für Amazon Glacier

Mit FastGlacier gibt es einen ersten Windows-Client, mit dem man seine Glacier Buckets befüllen kann. In der Dual-Thread Version sogar kostenlos. Ich habe FastGlacier seit einigen Tagen laufen, schaut gut aus. Die gleiche Firma hat auch S3 Browser veröffentlicht, mit dem man bequem auf seine S3 Buckets zugreifen kann.

Uwe

Uwe Ziegenhagen likes LaTeX and Python, sometimes even combined. Do you like my content and would like to thank me for it? Consider making a small donation to my local fablab, the Dingfabrik Köln. Details on how to donate can be found here Spenden für die Dingfabrik.

More Posts - Website

Regexp Matching mit Powershell

Hier ein kleines Beispiel, wie man mit Powershell reguläre Ausdrücke prüft. Gesucht werden alle Ordner, deren Name aus dem vierstelligen Jahresdatum besteht. Die Zeile, eingebettet in ein Skript hat heute in der Firma einer Kollegin stundenlange monotone Arbeit erspart.

$jahre = gci | Where-Object {$_.name -match '^[0-9]{4}$'}  | ? {$_.PSisContainer -eq $true}

Uwe

Uwe Ziegenhagen likes LaTeX and Python, sometimes even combined. Do you like my content and would like to thank me for it? Consider making a small donation to my local fablab, the Dingfabrik Köln. Details on how to donate can be found here Spenden für die Dingfabrik.

More Posts - Website

LaTeX mit PHP und Smarty erzeugen

In einem früheren Artikel habe ich beschrieben, wie man mit Python und der Template-Engine Cheetah LaTeX Dokumente erzeugt. Heute die grundlegenden Schritte, um mit PHP und der Template-Engine Smarty LaTeX Dokumente zu erzeugen. Ich folge dabei mehr oder weniger der Anleitung von http://smarty.incutio.com/?page=SmartyInstallationWindows.

Installation (unter der Windows Installation von Xampp):

  1. Download von http://smarty.php.net
  2. Entpacken des Smarty Ordners nach C:/xampp/libs/
  3. Anlage des Ordners „Smarty“ in htdocs, mit zwei Unterordnern „configs“ und „templates“
  4. Anlage des Ordners „Smarty“ in c:/xampp, mit zwei Unterordnern „cache“ und „templates_c“
  5. Anlage der Datei index.tpl in templates, mit folgendem Inhalt:
    <html>
    <body>
    Hello, {$name}!
    </body>
    </html>
  6. im htdocs Verzeichnis Anlage der Datei index.php, die folgendes enthält:
    <?php
    define('SMARTY_DIR', 'C:/xampp/libs/Smarty-3.1.11/libs/');
    require_once(SMARTY_DIR . 'Smarty.class.php');
     
    $smarty = new Smarty;
    $smarty->template_dir = 'C:/xampp/htdocs/smarty/templates';
    $smarty->config_dir = ' C:/xampp/htdocs/smarty/config';
    $smarty->cache_dir = 'C:/xampp/smarty/cache';
    $smarty->compile_dir = 'C:/xampp/smarty/templates_c';
     
    $smarty->assign('name','Uwe');
    $smarty->display('index.tpl');
    ?>
  7. jetzt die index.php im Webbrowser aufrufen

Damit ist die initiale Konfiguration von Smarty erledigt, jetzt müssen wir ihm die richtige Behandlung von LaTeX Code beibringen. Da Smarty zum Escapen geschweifte Klammern nutzt, müssen diese umdefiniert werden.

  1. Anlage der Datei tex1.tpl im templates Verzeichnis
    \documentclass[12pt,ngerman]{scrartcl}<br/>
    <br/>
    \author{<@$author@>}<br/>
    \title{<@$title@>}<br/>
    <br/>
    \begin{document}<br/>
    \maketitle<br/>
    <br/>
    \end{document}<br/>
  2. Anlage der tex1.php in htdocs:
    <?php
    define('SMARTY_DIR', 'C:/xampp/libs/Smarty-3.1.11/libs/');
    require_once(SMARTY_DIR . 'Smarty.class.php');
     
    $smarty = new Smarty;
    $smarty->template_dir = 'C:/xampp/htdocs/smarty/templates';
    $smarty->config_dir = ' C:/xampp/htdocs/smarty/config';
    $smarty->cache_dir = 'C:/xampp/smarty/cache';
    $smarty->compile_dir = 'C:/xampp/smarty/templates_c';
     
    $smarty->caching =false; //disable caching  
     
    $smarty->left_delimiter = '<@';
    $smarty->right_delimiter = '@>';
     
    $smarty->assign ('author', 'Uwe Ziegenhagen');
    $smarty->assign ('title', 'Hello Smarty!');
     
    $smarty->display ('tex1.tpl');
    ?>

Uwe

Uwe Ziegenhagen likes LaTeX and Python, sometimes even combined. Do you like my content and would like to thank me for it? Consider making a small donation to my local fablab, the Dingfabrik Köln. Details on how to donate can be found here Spenden für die Dingfabrik.

More Posts - Website

Folien vom Arduino Vortrag auf der Froscon 2012

Hier die Folien vom Arduino Vortrag Arduino-Slides.

Uwe

Uwe Ziegenhagen likes LaTeX and Python, sometimes even combined. Do you like my content and would like to thank me for it? Consider making a small donation to my local fablab, the Dingfabrik Köln. Details on how to donate can be found here Spenden für die Dingfabrik.

More Posts - Website

Dateien suchen per Powershell

Unter http://www.networknet.nl/apps/wp/published/powershell-delete-files-older-than-x-days habe ich ein Skript gefunden, das Dateien anhand des letzten Änderungsdatums findet. Ohne die Kommentare und angepasst auf meine Bedürfnisse wird das:

$Now = Get-Date
$Days = 1
$TargetFolder = "C:/Users/Uwe"
$Extension = "*.pdf"
 
$LastWrite = $Now.AddDays(-$Days)
$Files = Get-Childitem $TargetFolder -Include $Extension -Recurse | Where {$_.LastWriteTime -le "$LastWrite"}
foreach ($File in $Files)
{
$file.fullname
}

Uwe

Uwe Ziegenhagen likes LaTeX and Python, sometimes even combined. Do you like my content and would like to thank me for it? Consider making a small donation to my local fablab, the Dingfabrik Köln. Details on how to donate can be found here Spenden für die Dingfabrik.

More Posts - Website

Playing with Amazon Glacier

For a while now I have been using Amazon’s S3 to store really important data such as photos. Even my Synology NAS can theoretically upload stuff directly to S3. (Practically this doesn’nt work cause it’s buggy, at least it was when I checked it the last time). The new Amazon Glacier is however pretty exiting for me as it allows me to store my data for just a cent per Gigabyte. Well, if you have a few hundred Gigabyte of digital photos cost is quite an important factor.

Today I finally got a chance to play with the SDK, the software development kit. There are versions for Java and .Net, I used the .Net in my first try.

How to get started:

  1. Install Visual Studio C# Express
  2. Install the Amazon AWS SDK for .Net
  3. Get both keys, the access key and the secret access key from the AWS console.
  4. Create a new AWS console project: you will be asked to enter the credentials and should run the example project to see if it works.
  5. Get the example code from http://docs.amazonwebservices.com/amazonglacier/latest/dev/getting-started-upload-archive-dotnet.html, enter a valid path as archive to be uploaded and run the example.
  6. After a short time you will be presented with the archive id
  7. What is this good for? No clue, yet. I just ran the first sample

What is my goal? I’d like to write a small programm that allows me to upload my photos to Glacier. The upload probably takes weeks but better later than never. If you are interested in the progress, follow my articles in the corresponding category. It would be great if you drop me a few lines…

Uwe

Uwe Ziegenhagen likes LaTeX and Python, sometimes even combined. Do you like my content and would like to thank me for it? Consider making a small donation to my local fablab, the Dingfabrik Köln. Details on how to donate can be found here Spenden für die Dingfabrik.

More Posts - Website

Mit Excel Zellbereiche per Semikolon zusammenfassen

Auf http://superuser.com/questions/240858/convert-a-column-into-a-comma-separated-list habe ich eine hilfreiche VBA Funktion gefunden, um Zellbereiche per Semikolon in einer Zelle zusammenzufassen.

Function csvRange(myRange As Range)
Dim csvRangeOutput
    For Each entry In myRange
        If Not IsEmpty(entry.Value) Then
            csvRangeOutput = csvRangeOutput & entry.Value & "; "
        End If
    Next
    csvRange = Left(csvRangeOutput, Len(csvRangeOutput) - 1)
End Function

Uwe

Uwe Ziegenhagen likes LaTeX and Python, sometimes even combined. Do you like my content and would like to thank me for it? Consider making a small donation to my local fablab, the Dingfabrik Köln. Details on how to donate can be found here Spenden für die Dingfabrik.

More Posts - Website

Mit Powershell alle Word-Dateien eines Verzeichnisses drucken

Hier ein paar einfache Zeilen, wie man mit Powershell alle Word-Dateien eines Verzeichnisse öffnen und drucken kann.

#Source: http://www.vistax64.com/powershell/23311-words-printout-method.html 
$wd = new-object -com word.application
$wd.visible = 1
 
$files = gci f:\abc\*.docx
 
foreach($i in $files){
    $doc = $wd.documents.open($i.fullname)
    $doc.printout()
    $doc.close()
}

Uwe

Uwe Ziegenhagen likes LaTeX and Python, sometimes even combined. Do you like my content and would like to thank me for it? Consider making a small donation to my local fablab, the Dingfabrik Köln. Details on how to donate can be found here Spenden für die Dingfabrik.

More Posts - Website

Arduino hackt Hotel-Türen

Heute meldet Golem, dass ein Arduino beim Aufdecken von Sicherheitslücken in Hotels eine wesentliche Rolle gespielt hat: http://www.golem.de/news/cody-brocious-mozilla-softwareentwickler-hackt-hoteltueren-mit-arduino-1207-93427.html

Uwe

Uwe Ziegenhagen likes LaTeX and Python, sometimes even combined. Do you like my content and would like to thank me for it? Consider making a small donation to my local fablab, the Dingfabrik Köln. Details on how to donate can be found here Spenden für die Dingfabrik.

More Posts - Website

Dateien umbenennen per Powershell

Hier ein kurzes Beispiel, wie man mit Powershell Dateien umbenennen kann. Die Ausgangslage war ein Verzeichnis mit PDF Dateien, die alle das Namensmuster „Dokument-“ hatten.

number;filename
1;mueller
2;meier
3;schulze
 
$files = Import-Csv -Delimiter ";" D:\files.csv
cd M:\
 
foreach ($i in $files){
    Rename-Item ("Testdokument-" + $i.number + ".pdf") ($i.filename +".pdf")     
}

Uwe

Uwe Ziegenhagen likes LaTeX and Python, sometimes even combined. Do you like my content and would like to thank me for it? Consider making a small donation to my local fablab, the Dingfabrik Köln. Details on how to donate can be found here Spenden für die Dingfabrik.

More Posts - Website