Kategoriarkiv: Programmering

Creating PDF Files from PHP on debian

apt-get install php-fpdf look for tutorials and documentation at: http://www.fpdf.org/ add fpdf to the include path, and save yourself the hazzle to edit it every time: include_path = “.:/usr/share/php:/usr/share/php/fpdf” (in php.ini (DUH!))

Udgivet i Knowledge Base, Old Base, Programmering | Skriv en kommentar

Generating java code from JavaDoc HTML

Cut’n’paste the method summary to the created class. Use this search and replace in VS.NET: Search: ^{[^\)]*}\) \n:b*{[^\n]*}$ Replace: \n/**\n * \2\n */\npublic \1) { } For interfaces use this replace: \n/**\n * \2\n */\n\1); Strip blank comment blocks with: … Læs resten

Udgivet i Knowledge Base, Old Base, Programmering | Skriv en kommentar

Get enums fra mysql in php

PRIVATE function GetEnums($table,$field) { $dat=mysql_fetch_array(mysql_query(“show columns from `$table` like ‘$field’;”,$this->MysqlResource)); return(preg_split(“/’|,|enum|\(|\)/”,$dat[‘Type’],null,PREG_SPLIT_NO_EMPTY)); }

Udgivet i Knowledge Base, Old Base, Programmering | Skriv en kommentar

SOURCE: Generic PHP Autoloader

<? // COPYRIGHT (c) 2007 MC Solutions /** * Class to handle autoloading of Php class files */ Class AutoLoader { private $files; private $error; private $use_session_cache = “true”; /** * Tells the AutoLoader what to do when duplicate class … Læs resten

Udgivet i Knowledge Base, Old Base, Programmering | Skriv en kommentar

Creating trusted certificate for Java JSSE

First, take the unencrypted file certificate.pfx (used on the server), and chop it up into key and PEM encoded certificate: # openssl pkcs12 -in certificate.pfx -nodes -out certificate.key -nocerts # openssl pkcs12 -in certificate.pfx -nodes -out certificate.pem -nokeys Edit the … Læs resten

Udgivet i Knowledge Base, Old Base, Programmering | Skriv en kommentar

Tooltip javascript function

tooltip.js: // position of the tooltip relative to the mouse in pixel // var offsetx = 12; var offsety = 8; function newelement(newid) { if(document.createElement) { var el = document.createElement(‘div’); el.id = newid; with(el.style) { display = ‘none’; position = … Læs resten

Udgivet i Knowledge Base, Old Base, Programmering | Skriv en kommentar

create a list of java source files from a recursive directory

I use this to produce a list of all java source files I need to build. (Need GnuWin32 grep and coreutils packages) dir *.java /s /B | grep -i java | cut -d\ -f7- > srcfiles.txt

Udgivet i Knowledge Base, Old Base, Programmering | Skriv en kommentar

ASN.1 to Java conversion

Extract the keys you need from details in JMibBrowser, only Name, Parent and Number. Use the following Find and replace in Visual Studio: Find: (.*Name:b*\::b*){:i}\n(.*Parent:b*\::b*){:i}\n(.*Number:b*\::b*){:z} Replace: public static final String \1 = \2 + “.\3”; more to come…

Udgivet i Knowledge Base, Old Base, Programmering | Skriv en kommentar

Adding inline images to HTML Files

<? print “<img src=’data:image/gif;base64,”.base64_encode(file_get_contents(“file.gif”)).”‘>”; ?> Works in Firefox

Udgivet i Knowledge Base, Old Base, PHP, Programmering | Skriv en kommentar

arraystore.php

<? # arraystore.php – Copyright(c) 2005 by Mikkel C.M.Christensen # # Stores and retrieves arrays of the following format from plaintextfiles: # $array = array( array (“”,””), # array (“”,””), # array (“”,””)); # # The char “|” are used … Læs resten

Udgivet i Knowledge Base, Linux, Old Base, Programmering | Skriv en kommentar