Archive for the ‘Programmierung’ Category.
2012-09-03, 20:19
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 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
2012-09-03, 20:15
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} |
$jahre = gci | Where-Object {$_.name -match '^[0-9]{4}$'} | ? {$_.PSisContainer -eq $true}
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
Category:
Powershell |
Kommentare deaktiviert für Regexp Matching mit Powershell
2012-08-31, 20:00
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):
- Download von http://smarty.php.net
- Entpacken des Smarty Ordners nach C:/xampp/libs/
- Anlage des Ordners „Smarty“ in htdocs, mit zwei Unterordnern „configs“ und „templates“
- Anlage des Ordners „Smarty“ in c:/xampp, mit zwei Unterordnern „cache“ und „templates_c“
- Anlage der Datei index.tpl in templates, mit folgendem Inhalt:
<html>
<body>
Hello, {$name}!
</body>
</html> |
<html>
<body>
Hello, {$name}!
</body>
</html>
- 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');
?> |
<?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');
?>
- 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.
- 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/> |
\documentclass[12pt,ngerman]{scrartcl}<br/>
<br/>
\author{<@$author@>}<br/>
\title{<@$title@>}<br/>
<br/>
\begin{document}<br/>
\maketitle<br/>
<br/>
\end{document}<br/>
- 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');
?> |
<?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');
?>
![smarty](http://uweziegenhagen.de/wp-content/uploads/2012/08/smarty.png)
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
2012-08-26, 13:26
Hier die Folien vom Arduino Vortrag Arduino-Slides.
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
Category:
Arduino |
Kommentare deaktiviert für Folien vom Arduino Vortrag auf der Froscon 2012
2012-08-25, 13:04
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
} |
$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 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
Category:
Powershell |
Kommentare deaktiviert für Dateien suchen per Powershell
2012-08-24, 21:57
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:
- Install Visual Studio C# Express
- Install the Amazon AWS SDK for .Net
- Get both keys, the access key and the secret access key from the AWS console.
- 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.
- 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.
- After a short time you will be presented with the archive id
- 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 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
2012-08-14, 21:18
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 |
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
![csvRange](http://uweziegenhagen.de/wp-content/uploads/2012/08/csvRange.png)
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
Schlagwörter:
Excel Category:
MS Office & VBA |
Kommentare deaktiviert für Mit Excel Zellbereiche per Semikolon zusammenfassen
2012-08-12, 06:53
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()
} |
#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 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
Schlagwörter:
Powershell Category:
Powershell |
Kommentare deaktiviert für Mit Powershell alle Word-Dateien eines Verzeichnisses drucken
2012-07-25, 22:41
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 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
Category:
Arduino |
Kommentare deaktiviert für Arduino hackt Hotel-Türen
2012-06-24, 21:21
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")
} |
$files = Import-Csv -Delimiter ";" D:\files.csv
cd M:\
foreach ($i in $files){
Rename-Item ("Testdokument-" + $i.number + ".pdf") ($i.filename +".pdf")
}
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
Category:
Powershell |
Kommentare deaktiviert für Dateien umbenennen per Powershell