Archive for category code

Sharepoint Designer öffnet keine ASPX Seite

Posted by on Friday, 13 June, 2014
Eine mögliche Lösung:
In der Datei
   C:\Program Files\Common Files\microsoft shared\Web Server Extensions\15\TEMPLATE\SiteTemplates\PWA\XML\ONET.XML
ist der Eintrag DisableWebDesignFeatures=”wdfeditpages” .
Den Eintrag entfernen, iisreset und es geht!


File downloads with special Characters

Posted by on Thursday, 4 April, 2013

It is possible to download files with special characters in it, it just looks very strange.

The Header looks like this:

Content-Disposition attachment; filename*=UTF-8”specialChar_%C3%A4%C3%BC%C3%B6%C3%9F.doc;

that is (in php)

header(“Content-Disposition: attachment; filename*=UTF-8””.  urlencode( $filename ) . “;” );

Xampp 1.7 / Xampp 1.8 activate Ldap

Posted by on Tuesday, 21 August, 2012

Those xampp bulids need a little tweaking:

to get php with ldap to run you need to remove the comment in the file php\php.ini:


Next you need to copy the file  php\libsasl.dll to apache\bin\libsasl.dll


Sharepoint: how to deploy a wsp

Posted by on Thursday, 16 August, 2012

Assuming your wsp is in c:\tmp and is called DemoWebService.wsp

cd C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\BIN>

stsadm.exe -o addsolution -filename c:\tmp\DemoWebService.wsp
stsadm -o deploysolution -name DemoWebService.wsp -immediate -allowGacDeployment

-allowGacDeployment deploys it in the Global Assembly Cache - that is Full Controll

mysql: first and last days of months

Posted by on Tuesday, 3 April, 2012

  last_day( CURDATE() ) LAST_DAY_OF_MONTH ,
  date_add(date_sub(CURDATE(), INTERVAL DAYOFMONTH(CURDATE()) -1 day), interval 1 month) FIRST_DAY_OF_NEXT_MONTH

Oracle: add an autoID

Posted by on Wednesday, 7 March, 2012

create sequence PAGE_PROPERTIES_ID;

create or replace trigger PAGE_PROPERTIES_ID
before insert on PAGE_PROPERTIES
for each row
if is null then
select PAGE_PROPERTIES_ID.nextval into from dual;
end if;

javascript, object orientation, inheritance Part 1

Posted by on Sunday, 19 June, 2011

The documentation about the more advanced features of javascript are rather poor. So instead of complaining I’ll put something together myself.

The basic function-based approch to javascript coding is basic and well documented. Let’s skip this part. I’ll assume you have some knowlange of obect orientated programing and understand the difference between object and class. The class beeing the blueprint, the object a concreate instance to work with.

Object orientation in JS is proberbly different to what most coders are familiar with. And there are several ways to do it.

About Javascipt variables

JS is a loosly typed language. A variable may either be primitive (eg an integer) an object (eg String) or a function. You can assign any of those types to variables. Objects have properties. So you can go along setting properties to functions. Further you can go along on a object assign a property of type function to it – just so, on the fly. As it is a loosley typed language you can even assign a function with a different signature to an objects property. Now show me how to do that in your language.


Lets start with a object literal.

I like to think of it as kind of inline singelton. You can go ahead and write the object directly. No class required, just rolling it as you go along. Perfect for a fire-and-forget object to pass to another function – much like jquery and extjs expect it as a function parameter. Or a singelton – that is an object that can only have one and only one instance. Like a Validator. Write one, call anywhere. I admit the syntax looks a bit strange :

var Validator = {
  isNumeric: function(val) {
    return !isNaN(val);
  isInt: function(val) {
    var res = false;
    var tested = val.toString();
    if ( val.match(/^\d+$/) ) {
      return true;
    return res;

if (! Validator.isNumeric(“tintifax”)) {
  alert(“not an Number”)


So between the {} of  Validator you write the property followed by a “:” and then the value – in this case the function. After each variable definition you enter a “,” with the exception of the last entry. As soon as the code is parsed you have an object literal. Thats the quickest and easiest way to write objects.


Now for classes

function Car(name) {

  // a public property. you can access it from outside = “noname”;
  // nasty hack for accessing private vars out of public context
  var self = this;
  // contructor code here – init the cars name
  if (name) { = name;

  // a private property, No way of accessing it from outside
  var isCleaned = false;
  // a public function
  this.honk = function() {
    return “basic car honk from ” + + ” <br />”; // accessing public property

  // public function getting a private property
  this.getCleaned = function() {
    return isCleaned;

  // public function for setting a private property
  this.setCleaned = function(isCleaned) {
    this.cleaned = isCleaned;
    return this.cleaned;

  // private function
  var emptyAshTray = function() {
    ashtrayFull = false;
    return “Ashtray of ” + + ” emptied (using correct )<br />”;

  // public function calling private functions
  this.clean = function () {
    var retVal = “”;
    retVal += emptyAshTray();
    isCleaned = true;
    retVal += “basic car ” + + ” is now clean<br />”;
    return retVal;


// alternative version for writing public methods
Car.prototype.goFast = function() {
  return “car ” + + ” goes fast<br />”;

var focus = new Car(“Focus”);
alert(“Car name: ” +;
alert(“car goes fast: ” + focus.goFast());
alert(“clean the car: ” + focus.clean())

The source code should speak for itself. Defining a Function creates the Class. Anything prefixed with “this” is public. Anything declared with “var” is private. There is a pitfall for accessing public variables from private scope (look for the hack with the self variable). There is second way of adding public variables (that can refer to functions or methods, remember) using the Cars prototype.

Explaining the Prototype

Javascript uses something called prototype-based inheritance. Every Class has a prototype shared by all its instances. You can modify the prototype to extend or alter all running instances. Read that again – modify the prototype to modify all running instances. As soon as you type String.prototype.shorten = fuction() {} all Strings have a shorten method. This is powerfull. You can not do this with object literals as they have no class, but you can alter the Validator object literal by saying Validator.isPink = function {}

Next: The Javascript way of doing Inheritance

MySQL Query Cache

Posted by on Monday, 24 January, 2011

MySQL features a query cache that keeps Select Statements in memory. My first tests look very promising.

To turn it on and allow 100 MB of RAM to be used edit your my.conf:

query_cache_type = 1
query_cache_size = 104857600

to check how its doing:
SHOW STATUS where variable_name like “%cache%”


Curl and NTLM

Posted by on Wednesday, 13 October, 2010

Yes, we can use CURL to talk to a Sharepoint server and retrieve a document:

curl –ntlm -u username:password http://server/my/personal/tintifax/Shared%20Documents/10MBrandom.doc > example.log/

A simple PDO example

Posted by on Monday, 27 September, 2010

// create PDO Database connection
try {
$dbh = new PDO("mysql:host=$dbhost;dbname=$dbname", $dbuser, $dbpass);
} catch(PDOException $e) {
echo $e->getMessage();
// prepare the statemant
$sql = $dbh->prepare("
city, count(city), sum(counter) cnt
from geoip
country_name = :countryname
group by city;
// replace the bind parameters with variables
$sql->bindParam(':countryname', $countryname, PDO::PARAM_STR);
// execute the statemant
// check for errors - PDO catches them silently
if ($sql->errorCode() != '0000' ) {
$msg = $sql->errorInfo();
throw new Exception($msg[2]);
// iterate over the results
foreach ($sql as $row) {
echo "access via index: " . $row[0] . "\n";
echo "access via associative array: " . $row["cnt"] . "\n";