csv2array

Wir hatten die Aufgabe, einen Monatskalender für die chirurgische Abteilung in einem Krankenhaus zu schreiben. Der Kalender sollte jeden Tag anzeigen, also auch Tage welche keine ambulanten Untersuchungen, Aufnahmen oder OP Termine beinhalten. Weiters sollte die aktuelle Kalenderwoche dargestellt werden, ebenso allgemeine Termine wie z.B. Schulbeginn, sowie alle Feiertage.

Feiertage und allgemeine Termine sollten als solche gekennzeichnet werden.

Zuerst trugen wir die Termine und Feiertage in ein PHP-Array ein. Aber es zeigte sich bald, dass diese Datei ‘not human readable’ war, Fehler sind nicht leicht erkennbar und mussten mühsam gesucht und korrigiert werden.

$feiertage =  array (
"2011-07-02" => array("text" => "Beginn Sommerferien f. Bgld, NÖ, Wien", "type" =>"t"),
"2011-07-09" => array("text" => "Beginn Sommerferien f. Ktn, OÖ, Sbg, Stmk, Tirol, Vbg", "type" =>"t"),
"2011-08-15" => array("text" => "Mariä Himmelfahrt", "type" =>"f"),
"2011-09-03" => array("text" => "Ende Sommerferien für Bgld, NÖ, Wien", "type" =>"t"),
"2011-09-10" => array("text" => "Ende Sommerferien f. Ktn, OÖ, Sbg, Stmk, Tirol, Vbg", "type" =>"t"),
"2011-09-24" => array("text" => "Hl. Rupert", "type" =>"t"),
);

Das ist nur ein Auszug, die originale Liste beinhaltet alle Termine und Feiertage von 2011 bis 2013.

Eine klare Formatierung hilft zwar bei der Lesbarkeit, aber immer noch nicht beim Schreiben bzw. Copy/Paste aus einer verfügbaren Quelle.

$feiertage =  array (
	"2013-01-01"    => array (
	"text"        => "Neujahr",
	"type"        => "f"
),
	"2013-01-06"    => array (
	"text"        => "Hl. Drei Könige. Ende Weihnachtsferien",
	"type"        => "f"
),
	"2013-02-12"    => array (
	"text"        => "Faschingsdienstag",
	"type"        => "t"
),
	"2013-02-13"    => array (
	"text"        => "Aschermittwoch",
	"type"        => "t"
),
	"2013-02-14"    => array (
	"text"        => "Valentinstag",
	"type"        => "t"
),
);

Einen Ausweg und eine Lösung bietet die PHP Funktion fgetcsv . Wir legten eine CSV-Datei an, und trennten die einzelnen Spalten mit einem Tabulator.

2011-07-02    t    Beginn Sommerferien f. Bgld, NÖ, Wien
2011-07-09    t    Beginn Sommerferien f. Ktn, OÖ, Sbg, Stmk, Tirol, Vbg
2011-08-15    f    Mariä Himmelfahrt
2011-09-03    t    Ende Sommerferien für Bgld, NÖ, Wien
2011-09-10    t    Ende Sommerferien f. Ktn, OÖ, Sbg, Stmk, Tirol, Vbg
2011-09-24    t    Hl. Rupert

Mit einem Script wird dann das File ausgelesen und in ein Array umgewandelt.

$file = $_SERVER['DOCUMENT_ROOT'].'/calendar/feiertage.csv' ;
$handle = fopen ( $file, 'r' ) ;
$DATA = array();
while ( ($data = fgetcsv ( $handle, 1000, "\t" )) != FALSE ) {
	$DATA[$data[0]]['type'] = $data[1];
	$DATA[$data[0]]['text'] = $data[2];
}
print_r ( $DATA ) ;

Das Array hat nun die gewünschte Form, die Quelle ist überschaubar, leicht zu lesen und zu ergänzen.

Pdftk – The PDF Toolkit

Pdftk – The PDF Toolkit

If PDF is electronic paper, then pdftk is an electronic staple-remover, hole-punch, binder, secret-decoder-ring, and X-Ray-glasses. Pdftk is a simple tool for doing everyday things with PDF documents.

Keep one in the top drawer of your desktop and use it to:

  • Merge PDF Documents
  • Split PDF Pages into a New Document
  • Rotate PDF Pages or Documents
  • Decrypt Input as Necessary (Password Required)
  • Encrypt Output as Desired
  • Fill PDF Forms with FDF Data or XFDF Data and/or Flatten Forms
  • Apply a Background Watermark or a Foreground Stamp
  • Report on PDF Metrics such as Metadata, Bookmarks, and Page Labels
  • Update PDF Metadata
  • Attach Files to PDF Pages or the PDF Document
  • Unpack PDF Attachments
  • Burst a PDF Document into Single Pages
  • Uncompress and Re-Compress Page Streams
  • Repair Corrupted PDF (Where Possible)

Pdftk allows you to manipulate PDF easily and freely. It does not require Acrobat, and it runs on Windows, Linux, Mac OS X, FreeBSD and Solaris.

Pdftk Home

Unetbootin – create bootable Live USB drives for Linux distributions

Introduction

UNetbootin allows you to create bootable Live USB drives for Ubuntu, Fedora, and other Linux distributions without burning a CD. It runs on Windows, Linux, and Mac OS X. You can either let UNetbootin download one of the many distributions supported out-of-the-box for you, or supply your own Linux .iso file if you’ve already downloaded one or your preferred distribution isn’t on the list.

Features

UNetbootin can create a bootable Live USB drive, or it can make a “frugal install” on your local hard disk if you don’t have a USB drive. It loads distributions either by downloading a ISO (CD image) files for you, or by using an ISO file you’ve already downloaded.

more

Veröffentlicht unter Linux

ffmpeg

FFmpeg is a complete, cross-platform solution to record, convert and stream audio and video.

ffmpeg home
ffmpeg documentation

19 ffmpeg commands for all needs

ffmpeg is a multiplatform, open-source library for video and audio files. These 19 useful commands cover almost all needs: video conversion, sound extraction, encoding file for iPod or PSP, and more. Weiterlesen

Veröffentlicht unter Coding

JW Player for Flash and HTML5

Flash & HTML5. Together.
Why choose? Do both.

There has been a great deal of debate about Flash versus HTML5. We think it’s pointless. The revolutionary aspect of the JW Player is that Flash and HTML5 work together as part of a single player. Skins, JavaScript, and soon a library of plugins are supported regardless of which rendering mode you choose.

Want Flash for a uniform desktop experience but need to support the iPad? No problem. Standards junkie and only want HTML5? That’s cool too. Either way. One player does it all.

Why Choose the JW Player?
Because you just need it to work.

There are host of niche video players on the Internet today. HTML5 has enabled people to create simple JavaScript players with ease. But video is hard. In fact, HTML5 makes it even harder. It’s not enough to have a player, but you need a player that works in every browser and on every device, old and new.

The JW Player has evolved through the history of online video since the time Jeroen wrote the first version in 2005. The experience we have developed over those years are built into the JW Player. This is evident in our support for all the major CDNs, YouTube, Adobe’s Flash Media Server, Wowza, RTMP streaming, HTTP streaming, major advertising networks, analytics providers, and more. We have worked with these companies for years. By choosing the JW Player you can rest easy that we will offer the same support for HTML5, as we have for Flash, as the market continues to evolve.

more

Veröffentlicht unter Coding

Meld and Curlftpfs

If you have to compare many files or whole directories on your local inhouse development webserver with those on the webserver hosted by your provider, you can do this with Meld and curlFTPS.

Meld

Meld is a visual diff and merge tool. You can compare two or three files and edit them in place (diffs update dynamically). You can compare two or three folders and launch file comparisons. You can browse and view a working copy from popular version control systems such such as CVS, Subversion, Bazaar-ng and Mercurial. Look at the screenshots page for more detailed features.

more : http://meld.sourceforge.net/

CurlFtpFS lets you mount a directory on your filesystem to an external FTP server. You have then access to the remote files with Meld.

CurlFtpFS – A FTP filesystem based on cURL and FUSE

Description

CurlFtpFS is a filesystem for accessing FTP hosts based on FUSE and libcurl.

Features

SSLv3 and TLSv1 support
connecting through tunneling HTTP proxies
automatically reconnection if the server times out
transform absolute symlinks to point back into the ftp file system

more: http://curlftpfs.sourceforge.net/

Veröffentlicht unter Linux

Dot Pro Domains

Enhance your professional images on the internet with .PRO – the internet for professionals

Why .pro ?

Domain names are the most recognized and important part of any Internet endeavor. RegistryPro provides domain names that are uniquely valuable and distinct.

.PRO’s fundamental purpose is simple: to offer a secure, trusted platform that professionals can leverage for their Internet presence, starting with a domain name.

 Who Can Register a .PRO Domain Name?

.PRO is an exclusive top-level domain reserved for use exclusively by licensed business and service professionals and entities internationally. All applicants meeting the following qualifications may register a .PRO domain name:

  •     Provides professional services
  •      Admitted to or licensed by a government certification body or jurisdictional licensing entity recognized by a governmental body that regularly verifies the accuracy of its data
  •     In good standing with the licensing authority

In addition, registrants will be asked to provide the following information related to their professional eligibility:

  •     Identification
  •     Contact information
  •     Profession-specific information such as license number

If you want to register your .PRO domain name today, feel free to contact us.

Web Design Resources and Tools

When developers share, we all win. Thanks to Ethan from Elementiks for making public his amazing list of tools and resources for web development.

Web Design Resources and Tools I Use

A fairly exhaustive list of free tools and resources for web designers and developers focusing on Javascript, PHP, Flash, MySQL, CSS, graphics and general design techniques.

http://elementiks.com/web_resources.php

Thanks also to Jorge Morales who shared this info on google+

BASH Programming

Bash (Unix shell)

From Wikipedia, the free encyclopedia

Bash is a Unix shell written by Brian Fox for the GNU Project as a free software replacement for the Bourne shell (sh). Released in 1989, it has been distributed widely as the shell for the GNU operating system and as the default shell on Linux, Mac OS X and Darwin. It has been ported to Microsoft Windows and distributed with Cygwin and MinGW, to DOS by the DJGPP project and to Novell NetWare.

Bash is a command processor, typically run in a text window, allowing the user to type commands which cause actions. Bash can also read commands from a file, called a script. Like all Unix shells, it supports filename wildcarding, piping, here documents, command substitution, variables and control structures for condition-testing and iteration. The keywords, syntax and other basic features of the language were all copied from sh. Other features, e.g., history, were copied from csh and ksh. Bash is a POSIX shell but with a number of extensions.

The name itself is an acronym, a pun and descriptive. As an acronym, it stands for Bourne-again shell, referring to its objective as a free replacement for the Bourne shell. As a pun, it expressed that objective in a phrase that sounds the same as born again, a term for spiritual rebirth. The name is also descriptive of what it did, bashing together the features of sh, csh and ksh.

Ressources for BASH programming

BASH Programming – Introduction HOW-TO
Advanced Bash Scripting Guide

Veröffentlicht unter Coding