SqlHelper und benutzerdefinierte Tabellentypen mit SQL Server 2008

Martin Zeller.net, sql server Leave a Comment

Arbeitest du mit SQL Server 2008, SqlHelper und benutzerdefinierten Tabellentypen und erhältst folgende Fehlermeldung? [text]Der eingehende Tabular Data Stream (TDS) für das RPC-Protokoll (Remote Procedure Call) ist nicht richtig. Tabellenwertparameter (‘@xxx’), Zeile n, Spalte n: Für den Datentyp xxx (benutzerdefinierter Tabellentyp) wurde ein Datenbankname mit einer Nicht-Null-Länge angegeben. Der Datenbankname ist mit einem Tabellenwertparameter nicht zulässig. Es sind nur ein …

Pdf thumbnails / Pdf to jpg

Martin Zellerphp 2 Comments

Do you want to create thumbnails for pdf files with PHP (or C#)? You can simply do this with ghostscript. Here’s the php way (it is very easy to convert this code to C#): First install ghostscript on your server. Download: http://ghostscript.com/releases/ Then write your code: [php]$pathToPdf = "C:\….\PdfFile.pdf"; $pathToJpg = "C:\….\generatedThumbnail.jpg"; $gsCall = "\"C:\….\gs\gs8.70\bin\gswin32.exe\" -q -dBATCH -dMaxBitmap=300000000 -dNOPAUSE -dSAFER …

Zend_Captcha, an example without Zend_Form

Martin Zellerphp 2 Comments

Here is your example how to implement Zend_Captcha_Image without using Zend_Form. In your action method: [php]public function indexAction() { //… $captcha = new Zend_Captcha_Image(); $captcha->setImgDir(APPLICATION_PATH . ‘/../public/tmp/captcha/’); $captcha->setImgUrl($this->view->baseUrl(‘/tmp/captcha/’)); $captcha->setFont(APPLICATION_PATH . ‘/fonts/elephant.ttf’); $captcha->setWidth(350); $captcha->setHeight(150); $captcha->setWordlen(5); $captcha->setFontSize(70); $captcha->setLineNoiseLevel(3); $captcha->generate(); $this->view->captcha = $captcha;   // giving captcha object to the view //… }[/php] In the corresponding view render the captcha and add a hidden …

PHP – Delete files by pattern

Martin Zellerphp 1 Comment

If you want to delete files by pattern (e.g. “*.txt”) in a directory, you can do this with the php function glob! [php]$files = glob(‘/path/to/files/*.txt’); // finds all txt files in the directory /path/to/files/ foreach($files as $file) unlink($file);[/php] With this method you can also delete all files of a directory – with pattern *.*