Author Archive

Google Visualisation API mit R nutzen

Mit googleVis gibt es ein interessantes Paket für R, mit dem man aus R heraus die Visualisierungs-API von Google nutzen kann.

http://code.google.com/p/google-motion-charts-with-r/

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

E-Mails mit personalisierten Attachments versenden

Vor kurzem hatte ich die dankbare Aufgabe, mehrere hundert E-Mails mit personalisierten Anhängen (im PDF-Format) zu versenden. Da auf die Schnelle kein Tool bereitstand, das bei dieser Aufgabe helfen konnte, musste etwas Selbstentwickeltes her.

Teil 1 der Aufgabe bestand darin, aus der PDF-Gesamtdatei jeweils zwei Seiten zu extrahieren und abzuspeichern. In einer Excel standen glücklicherweise die Namen der Kunden sowie die Kunden-ID. Die Exceldatei habe ich dann als CSV exportiert (man hätte die Excel-Datei sicher auch direkt lesen können) und ein Powershellskript für PDFTK geschrieben.

# Uwe Ziegenhagen, 20101207
 
# read addresses, tab-delimited
$entries = Import-Csv -Delimiter "`t" c:\adresses.txt
# change to directory of PDF pages
cd c:\Email_Sende_Aktion\
# user counter variable ($i contains an object)
$j = 0
foreach ($i in $entries){
$j = $j +1 
# take filename of new PDF from CSV
$filename = $i.addressid + ".pdf"
# calculate pages to be extracted
$pagestoextract = "A" + $j + "-" + ($j+1)
# call pdftk
pdftk A= bigserialletter.pdf cat $pagestoextract output $filename 
$j = $j +1 
}

Teil 2 der Aufgabe bestand dann darin, jedem Kunden eine E-Mail mit seinem Attachment zu schicken, kein Kunde sollte ein PDF erhalten, das nicht für ihn bestimmt war. Dank Powershells „send-mailmessage“ ließ sich das auch recht einfach umsetzen.

# generate Encoding object for UTF8 (no äüö otherwise)
$encoding = [System.Text.Encoding]::UTF8
 
# Import email addresses and fund ids
$files = Import-Csv -Delimiter "`t" c:\Email_Sende_Aktion\adresses.txt
 
# read mail body, preserve line breaks
# http://www.eggheadcafe.com/software/aspnet/33110753/passing-a-string-with-linebreaks-to-a-com-object.aspx
$body  = [io.file]::ReadAllText("c:\Email_Sende_Aktion\mailbody.txt")
 
# just a counter for checking
$t = 0;
foreach ($i in $files){
	# inc counter
	$t = $t +1
	# cat body from the different parts
	$usedbody = "Sehr geehrte/r " + $i.Anrede.Trim() + ". " + $i.Nachname.Trim() + "," + $body 
	# find the individual attachment based on addressid
	$file = "c:\Email_Sende_Aktion\" + $i.addressid + ".pdf"
	# send message
	 send-mailmessage -Encoding $encoding -From me@me.com -BCC notme@me.com -To $i.RealMail -Subject "Kundeninformation Foobar"  -Body $usedbody -Smtpserver nameofexchangeserver -Attachments  $file
	$t
}

English summary: If you have no dedicated tool to send personalized PDF-attachments via e-mail, you can easily use Powershell to generate theses e-mails. Part 1 of the task consisted of splitting a big PDF file with all serial letters into 2-page pieces, task 2 of sending the e-mails to the recipients.

Keywords: Powershell, Outlook, Attachment, 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

Hallo Welt mit iTextSharp

Heute habe ich mir mal die iTextsharp.dll von Sourceforge geladen, um aus C# heraus mal eine PDF Datei zu erzeugen. Im Visual Studio Projekt muss dann nur ein Verweis auf diese DLL erstellt werden, dann sollte das folgende Beispiel problemlos laufen. Ausgehend von diesem Beispiel werde ich mal schauen, ob man das nicht für was Sinnvolles einsetzen kann.
Ist sicher kein Ersatz für LaTeX, ein paar Dinge könnte ich mir jedoch vorstellen… 🙂

using System.IO;
using System.Text;
using iTextSharp.text;
using iTextSharp.text.pdf;
 
namespace ConsoleApplication1
{
    class Program
    {
        static void Main(string[] args)
        {
            Document pdfDocument = new Document();
            PdfWriter.GetInstance(pdfDocument, new FileStream("C:\\hallo.PDF", FileMode.Create));
            pdfDocument.Open();
            pdfDocument.Add(new Paragraph("Ich bin ein Absatz"));
            pdfDocument.Close();
        }
    }
}

Auch aus Powershell heraus lässt sich iTextsharp nutzen: http://www.powershell.nu/2009/09/08/scripting-pdf-documents-through-powershell/

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 @Dingfabrik

Hier die Unterlagen zum Vortrag in der Dingfabrik vom 08.11.2010:

Für den im Januar stattfindenden zweitägigen Workshop stelle ich alle Informationen und Materialien auf die folgende Seite http://uweziegenhagen.de/?page_id=1151. Dort findet sich auch das Doodle für die Anmeldung. Bitte nutzt es, damit ich einen Überblick bekomme, wieviele Leute kommen.

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

Rainbowduino vom Arduino aus steuern

Ein weiteres Ergebnis des Bastelabends in der Dingfabrik waren die ersten Gehversuche mit dem Rainbowduino.

In der jetzigen Version steuert der Arduino über die serielle Schnittstelle den Rainbowduino, Details folgen.

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

RFID mit dem Arduino

Letzten Freitag beim Bastelabend in der Dingfabrik, haben wir mit dem RFID ID-12 von Watterott rumgespielt, die Konfiguration war recht einfach.

Informationen gab es hier:

Die Software konnte ich 1:1 auf den Arduino übernehmen, hier noch ein paar Bilder:

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

PWM mit dem Arduino

Schon lang auf der TODO-Liste habe ich heute mal per PWM meine RGB-LED dimmen lassen. PWM steht für Pulsweitenmodulation, ein Verfahren, das es ermöglicht, analoge Signale mit digitalem Output zu erhalten. Gut beschrieben ist es in http://www.arduino.cc/en/Tutorial/PWM.

Als Codebasis habe ich das Beispiel von http://www.arduino.cc/en/Tutorial/DimmingLEDs genommen.

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

Beleuchtung für das DOGM Display

Heute kam meine bei Reichelt bestellte Hintergrundbeleuchtung für das DOGM Display an. Einfach hinter das Display setzen und noch einen Widerstand vorsetzen. Da ich einen passenden Widerstand nicht zur Hand hatte, habe ich erstmal ein Potentiometer genommen.

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 Dangershield

Beim zweiten Anlauf hat auch das Zusammenlöten meines Arduino Shields geklappt, keine Ahnung, woran ich beim ersten Mal gescheitert bin. Das Dangershield ist eine tolle Möglichkeit, verschiedene Ein- und Ausgabemöglichkeiten mit dem Arduino durchzuspielen. Das Board enthält diverse Sensoren (Klopfsensor, Temperaturfühler, Lichtsensor), diverse Buttons und Schieberegler sowie LEDs und Piezo-Lautsprecher.

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

Vorlage für Gesprächsprotokolle

Hier eine kleine LaTeX-Vorlage für Gesprächsprotokolle

\documentclass{scrartcl}
\usepackage{palatino,url}
\usepackage[latin1]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[ngerman]{babel}
\usepackage{booktabs,paralist}
\usepackage{scrpage2,lastpage}
\clearscrheadfoot
 
% nur bei gesetztem twoside 
%\lehead{lehead} \cehead{cehead}
%\rehead{rehead} \lefoot{lefoot}
%\cefoot{cefoot} \refoot{refoot}
 
%\lohead{lohead} %\cohead{cohead}
%\rohead{rohead} %\lofoot{lofoot}
%\cofoot{cofoot}
\rofoot{Seite \thepage~ von \pageref{LastPage}}
\pagestyle{scrheadings}
 
\begin{document}
\begin{flushleft}
{\LARGE \textbf{Protokoll vom \today}}
\end{flushleft}
 
\begin{tabular}{rp{10cm}} \toprule
Datum & \today \\
Protokollant &  \\
Anwesend & \\ \bottomrule
\end{tabular}
 
\section*{Tagesordnung}
 
\vspace*{1em}\hrule
\renewcommand{\contentsname}{}
\tableofcontents
 
\vspace*{1em}\hrule
 
\section{Termine}
 
\begin{compactitem}
\item 
\item 
\end{compactitem}
 
\section{Punkt 1}
 
\begin{compactitem}
\item 
\item 
\end{compactitem}
 
\section{Punkt 2}
 
\begin{compactitem}
\item 
\item 
\end{compactitem}
\end{document}

protokoll_vorlage (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