The “IE7 setAttribute class” problem!

Martin ZellerJavascript Leave a Comment

This does not work with IE7: [js]elem.setAttribute(‘class’,  cssClass);[/js] Use this instead: [js]elem.setAttribute((document.all ? ‘className’ : ‘class’), cssClass);[/js] Problem: document.all exists in IE8 too, but IE8 does not work with ‘className’! My solution in one of my projects was prototype: [js]Prototype.Browser.IE6 = Prototype.Browser.IE && parseInt(navigator.userAgent.substring(navigator.userAgent.indexOf("MSIE")+5)) == 6; Prototype.Browser.IE7 = Prototype.Browser.IE && parseInt(navigator.userAgent.substring(navigator.userAgent.indexOf("MSIE")+5)) == 7; Prototype.Browser.IE8 = Prototype.Browser.IE && !Prototype.Browser.IE6 && !Prototype.Browser.IE7; …

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 *.*

PDF: direct printing with .NET

Martin Zeller.net 47 Comments

  In this article I will show you the results of my search to find a way to print a pdf with .NET. My task was to find a simple solution for an intranet web application where the user gets pdf reports (ActiveReports). Depending on configuration settings these pdf files should be displayed in the browser and be printed immediately …

Client localisation with zend framework

Martin Zellerphp Leave a Comment

If you want to find out the language or country of the clients browser, do it this way: [php]<?php require_once ‘Zend/Locale.php’; $locale = new Zend_Locale(); echo $locale->toString(); ?>[/php] But be aware! This way you only get the localisation of the clients browser. And this is configurable by the user. The code above will give you output like this: [text]de_AT[/text] or …

Passwort setzen für das Gastkonto unter Windows 7

Martin Zellerwindows 7 2 Comments

Das Passwort für den Gast-Account unter Windows 7 zu setzen ist eigentlich gar nicht schwer, wenn man einmal weiß, wie’s geht 😉 “windows”-Taste + “r” Eingabe von “control userpasswords2? Im sich öffnenden Fenster findet man dann die notwendigen Möglichkeiten Viel Erfolg