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
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
give the ownership of <folde> to the Administrators Group - you need an elevated cmd
takeown /A /R /F <folder>
reset a folder
ICACLS <folder> /reset /T /C /Q
Having inserts with text fragments tends to be painfull because oracle sees many metacharacters (eg & < >).
But it is easy turned off:
set scan off;
create sequence PAGE_PROPERTIES_ID;
create or replace trigger PAGE_PROPERTIES_ID
before insert on PAGE_PROPERTIES
for each row
begin
if :new.id is null then
select PAGE_PROPERTIES_ID.nextval into :new.id from dual;
end if;
end;
/
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 {}
Seit über einer Dekade arbeite ich im Web-Bereich. Immer wieder hatte ich mit Grafiker zu tun die gut für den Print-Bereich ausgebildet und erfahren waren. Aber leider sind nicht alle Grafiker auch erfahren im Web-Bereich und nicht alles Wissen aus dem Print ist direkt anwendbar. In einem größeren Projekt ist dieser Guideline entstanden das recht viele Web-Fragen beantwortet.
@todo: translate to english
Farbraum | RGB |
Auflösung | 72 DPI |
Hintergrund | Transparent bei allen Grafiken |
Farbprofile | schaden nicht, aber die wenigsten Monitore sind kalibriert, jeder Monitor wird Farbabweichungen haben |
Maße | Für Schriften, Abstände, Höhen Breiten: Pixel sind der kleinste gemeinsame Nenner, im Web ist die Größenangabe EM üblich, die in Relation zur Standard-Schriftgröße des Browsers steht, dh abweichen kann (Schätzung: 1 EM = 16 Pixel im IE, andere Broser können sich anders verhalten).
|
Bildschirmauflösungen | 1024 * 768: Bildschirmauflösung, nicht verfügbare Pixel (verfügbare Pixel im GUTFALL ca 995 * 580, bei eingeblendenten Toolbars weniger als 580)
1280 * 1024 und 1920 * 1080 ebenso. Best Practice: Beim Start des Design einen Screenshot mit einer Bildschirmauflösung 1024 bzw 1280 machen (am eigenen Bildschirm umstellen) und in diesem Framework designen. Darin festlegen ob Content breiter wird, wo Weißräume auftauchen, was Mindest- und Maximalbreiten sind. Diese dokumentieren.
|
Wiederkehrende Elemente | Menues, Banner, Icons: müssen immer die gleiche Breite haben. Diese werden im CMS einmal gemacht und wiederholt auf die Seiten „kopiert“. Genauso Bilder für einen „Slot“ (zb rechter Bereich mit Bild) immer exakt die gleichen Maße. Wiederkehrende Elemente idealerweise nur 1 mal designen und dann so importieren das sie von mehreren Seitenlayouts verwendet werden. Faustregel: Es wird Änderungen geben.
|
Icons | In Pixeln, Vektorgrafiken sind unbrauchbar. Alle Icons einer Familie müssen die gleichen Größen und Ausrichtung haben. Transparenz um Icons ist gut. Verläufe auf Transparenz (zB um Buchstaben) müssen auf einzelne Pixel genau gearbeitet werden. Da im Web kein Alpha-Kanal verfügbar ist (Ausnahme PNG 24, da ist aber die Unterstützung schlecht) bleiben nur Halbtöne die in Richtung Hintergrundfarbe gehen.
|
Schriften | Es gibt kein Antialiasing im Web. Schriftgrößen und Abstände in Pixeln. Am Client sind nur Standard-Schriften verfügbar, bei Spezialschriften gibt es noch keine brauchbare Lösung die überall funktioniert
Demo-Page mit Schriften: Alle Überschriften und Textblöcke auf einer Seite zusammenstellen und Formatierungen dort festlegen und dokumentieren
|
Texte | Mindest- und Maximallängen für Text festlegen – dabei muss man sehr flexibel sein da der Content über Jahre von unterschiedlich geschulten Autoren eingegeben wird.
Andere Sprachen haben bei gleichem Text andere Textlängen. Oft sind das bedeutende Unterschiede. Russisch zB ist bei gleichem Content mindestens 20 % länger. Nicht alle Sprachen werden von links nach rechts geschrieben. Arabisch oder chinesisch wird von Rechts nach Links geschrieben.
|
PSDs |
|
Grafiken fürs Web |
Es kommt unvermeidlich zu Farbabweichungen zwischen unterschiedlichen Clients. Nur die allerwenigsten Monitore sind kalibriert. Kontraste und Farbtemperatur sind ebenfalls abweichend.
|
If you rather drive your html guy screaming mad follow this article: 20 things to drive web developers crazy
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