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:
extension=php_ldap.dll
Next you need to copy the file php\libsasl.dll to apache\bin\libsasl.dll
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:
extension=php_ldap.dll
Next you need to copy the file php\libsasl.dll to apache\bin\libsasl.dll
SELECT
date_sub(CURDATE(), INTERVAL DAYOFMONTH(CURDATE()) -1 day) FIRST_DAY_OF_MONTH,
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
Javascript has a rather unusual aproach to inheritance. It relies on prototypes. Each object has a prototype that defines it’s blueprint – very much like a class. Lets start with the parent object
function Parent() {
this.someVal = ‘some value of the parent’;
this.getVal = function () {
return this.someVal;
}
this.doStuff = function () {
return ‘runnig Parent.doStuff()’;
}
}
So far for the basics. Lets add a child to this Parent
function Child() {
this.someVal = ‘some value of the child’;
this.getParentVal = function() {
return Child.prototype.someVal;
}
this.doChildishStuff = function() {
return this.doStuff() + ‘ plus doing my own stuff’;
}
}
Child.prototype = new Parent();
Child.prototype = new Parent(); tells the child Class that it should go look into the Parent class if you call some function on it that it does not have itself. If Parent does not have it, maybe there is a .prototype of Gradparent that has it.
Now lets try it out
var par = new Parent();
alert(‘par.someVar: ‘ + par.someVal);
alert(‘par.getVal(): ‘ + par.getVal() );
alert(‘par.doStuff(): ‘ + par.doStuff() )
var kid = new Child();
alert(‘kid.someVal: ‘ + kid.someVal);
alert(‘kid.doStuff(): ‘ + kid.doStuff())
alert(‘kid.doChildishStuff(): ‘ + kid.doChildishStuff())
alert(‘kid.getParentVal(): ‘ + kid.getParentVal())
Works neatly. You can go along and access the prototypes properties if you need it, you simply overwrite a method that does not behave like you would like it. This should help you if you need to do inheritance in Javascript.
But you can do other tricks to avoid doublicate coding. There is a trick i like to call parasitic inheritance. As functions are variables and accessable you can borrow them from other objects. Without the hassle of inheritance you can reuse code. Let’s see
function Other () {}
Other.prototype.someFunction = function() {
return ‘parasiticFunction original from Unrelated’;
}
Child.prototype.doTrick = Other.prototype.someFunction;
alert(‘Kid does a neat trick :’ + kid.doTrick())
Other is a different Object with a method someFunction. By assigning Child.prototype.doTrick to that variable you get the function.
But maybe you do not want to change the behaviour of all Child objects, just that of one instance. Well, there is a way to do that
function onTheFly() {
return ‘adding functions to an instance at runtime ‘;
}
kid.otherTrick = onTheFly;
alert(‘kid got a new trick: ‘ + kid.otherTrick() );
Instead of messing with Child.prototype that changes all running Childs you can just create a new variable in kid (or overwrite another) with a new function
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.
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.
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.
function Car(name) {
// a public property. you can access it from outside
this.name = “noname”;
// nasty hack for accessing private vars out of public context
var self = this;
// contructor code here – init the cars name
if (name) {
this.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 ” + this.name + ” <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 ” + self.name + ” emptied (using correct self.name )<br />”;
};
// public function calling private functions
this.clean = function () {
var retVal = “”;
retVal += emptyAshTray();
isCleaned = true;
retVal += “basic car ” + this.name + ” is now clean<br />”;
return retVal;
};
}
// alternative version for writing public methods
Car.prototype.goFast = function() {
return “car ” + this.name + ” goes fast<br />”;
};
var focus = new Car(“Focus”);
alert(“Car name: ” + focus.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.
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 {}
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%”
See http://dev.mysql.com/doc/refman/5.1/en/query-cache.html
Now this is cool:
svnadmin dump /var/oforge/svn/speedTest/ | ssh tinifax@collab.kuplen.at “cat > /tinifax/tmp/speedtest.oforge.dmp”
Streams a big file (in fact any standard out) trough an ssh tunnel to another server
It’s good not everything is done as admin in the newer windows versions, but some things are just a pain to do if you do not have a admin shell. But there is a way
Hit the Windows button and type cmd (nothing new here). But now enter CTL + SHIFT + ENTER confirm to run it as admin and you have your root shell
It’s possible to send data from the reverse proxy to the server doing the work using HTTP Headers. This includes information if HTTPS is used (only the front server knows that) or geoIP information.
Example Apache conf
<Location /eParcel>
# tells if we are running http or https s
RequestHeader set X-Forwarded-HTTPS “%{HTTPS}s”
<Location>
ProxyPass /tintifax http://example.com/tintifax/
ProxyPassReverse /tintifax http://example.com/tintifax/
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/
Do not work – I ran into a problem trying to make the upload size for one of my application bigger. Firefox, Internet Exporer and Safari all failed. The reason: they mess up the headers – Content-Length does an overflow
POST /uploadtest.php HTTP/1.1
User-Agent Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.1; WOW64; )
Content-Type multipart/form-data; boundary=---------------------------7da301630063a
Accept-Encoding gzip, deflate
Content-Length -156552375
Pragma no-cache