Also nice to know: If you want to see country specific Google search results, navigate to
https://adwords.google.com/select/AdTargetingPreviewTool
You can choose a country, a specific area or even geo coordinates!
Freitag, 24. April 2009
Donnerstag, 23. April 2009
Direct Google Link
Nice to know: Who wants to go directly to Google's international homepage from a non-US conuntry, can just enter www.google.com/ncr. "ncr" stands for "no country redirect". Voila!
Freitag, 13. März 2009
Display calendar weeks in google calendar
I like to use google calendar to organize my schedules. Its is easy to use, always available and has a lot of functions under the surface if you need something more advanced.
The following is a small tip how to show calendar weeks (german: Kalenderwochen oder KW) in Google. Just add the following publich calendar to your account:
http://www.google.com/calendar/feeds/g0k1sv1gsdief8q28kvek83ps4%40group.calendar.google.com/public/basic
Thats it.
The following is a small tip how to show calendar weeks (german: Kalenderwochen oder KW) in Google. Just add the following publich calendar to your account:
http://www.google.com/calendar/feeds/g0k1sv1gsdief8q28kvek83ps4%40group.calendar.google.com/public/basic
Thats it.
Dienstag, 3. März 2009
Deleting a lot of files
In Linux, if you want to delete the content of a directory with many files, you might try
and get the response
This is the way to quickly delete a lot of files which I prefer:
or if you want to print the names of the files during deletion:
rm *and get the response
/bin/rm: Argument list too long.This is the way to quickly delete a lot of files which I prefer:
find . -type f -deleteor if you want to print the names of the files during deletion:
find . -type d -print -delete
Freitag, 20. Februar 2009
Please don't use "my" Variables
Please, dear Programmer, please don't use Variables with a "my" Prefix. It seems to be kind of a well established custom to prefix a class name with a "my" to name a variable. "mySprite", "myTimer", "myTwenn".. What sense does it make? Can't you think of a more significant name like "ballonSprite" or just "balloon"? "animationTimer", "rotationTween".. You even should not make the class name part of the variable's name every time.
If it has to be myTween, do you also write myNumber, myString. Why dont you write yourTween, that would at least more polite - "my" seems so selfish. Honestly, if you buy a car, do you refer to it as myCar? Is the banana you are eating "myBanana". And you dont just have diarrhea but myDiarrhea?
Think about that for a while and please be more creative with your variable names.
If it has to be myTween, do you also write myNumber, myString. Why dont you write yourTween, that would at least more polite - "my" seems so selfish. Honestly, if you buy a car, do you refer to it as myCar? Is the banana you are eating "myBanana". And you dont just have diarrhea but myDiarrhea?
Think about that for a while and please be more creative with your variable names.
Tweens and Adobe Flash's nasty garbage collection
These days I started with my first bigger Flash application using Actionscript 3 and so far everything worked fine. Actionscript 3 has many advantages over Actionscript 2 that makes me far more productive. I dont want to dig into that further but a very good introductory comparison of AS2 and AS3 was created by Colin Moock.
As I said, everything worked fine so far and I was happy working with a rather mature scripting language that gives me much less headache than actionscript 2. But then I came across a strange problem. My application uses tweens to animate some Sprites in parallel. Using the Tween Class, everything was smooth on the local flash player, but once I viewed it in my browser, strange things started to happen. Some of the tweens just stopped in the middle, some didn't start at all, my sprites very stuck in varios states of unfinished animations. And all this happened very unpredictable. I took me a while to find the origin of these problems: Flash's garbage collection!
In Flash, all objects that have no active reference within the running program, become candidates for garbage collection. When this garbage collection will happen is unpredictable, it is managed internally by the flash player and can not be started programmatically.
Thats what happened to my tweens, which I created as local variables in a function. Suddenly, while they were running, Flash decided that its time to clean up a bit and removed them. This somehow contradicts my intuition - I would have expected that Flash wouldn't delete a running tween. But it makes sense and when you know it, you just have to take care that your tweens stay reachable during they are executed.
Solution: don't use local variables for tweens but class instance variables.
Instead of
use a class instance variable
Problem solved.
As I said, everything worked fine so far and I was happy working with a rather mature scripting language that gives me much less headache than actionscript 2. But then I came across a strange problem. My application uses tweens to animate some Sprites in parallel. Using the Tween Class, everything was smooth on the local flash player, but once I viewed it in my browser, strange things started to happen. Some of the tweens just stopped in the middle, some didn't start at all, my sprites very stuck in varios states of unfinished animations. And all this happened very unpredictable. I took me a while to find the origin of these problems: Flash's garbage collection!
In Flash, all objects that have no active reference within the running program, become candidates for garbage collection. When this garbage collection will happen is unpredictable, it is managed internally by the flash player and can not be started programmatically.
Thats what happened to my tweens, which I created as local variables in a function. Suddenly, while they were running, Flash decided that its time to clean up a bit and removed them. This somehow contradicts my intuition - I would have expected that Flash wouldn't delete a running tween. But it makes sense and when you know it, you just have to take care that your tweens stay reachable during they are executed.
Solution: don't use local variables for tweens but class instance variables.
Instead of
public class ExampleTweenClass extends Sprite {
public function ExampleTweenClass () {
var tween:Tween = new Tween(this, "x", Strong.easeOut, 0, 100, 3, true);
}
}
use a class instance variable
public class ExampleTweenClass extends Sprite {
private var tween:Tween;
public function ExampleTweenClass () {
tween = new Tween(this, "x", Strong.easeOut, 0, 100, 3, true);
}
}
Problem solved.
Sonntag, 11. Januar 2009
Clear text input field on focus
On many sites we see a feature where a text input field, mostly a search field, is pre-filled with a text like "Enter your search term here". On focus, this text field is emptied and sometimes also changes the style. Here is my simple solution to this, using the Prototype Javascript library:
After the document has loaded, the desired functionality is added to each text input field with the CSS class 'clearonfocus'. In your CSS file, you can define any style you want to that pre-filled state of the text field, like gray color etc.
On click, the text field is emptied and the class is removed.
This seems to work pretty well!
<script src="prototype.js" type="text/javascript"></script><script src="clearonfocus.js" type="text/javascript"></script>
....clearonfocus.js :
init = function (){
if ($$('.clearonfocus')){
$$('.clearonfocus').map( function(element){
element.observe('click', function(event){
var element = Event.element(event);
element.removeClassName('clearonfocus');
element.writeAttribute('value', '');
});
});
}
}
Event.observe(window, 'load', init, false);
After the document has loaded, the desired functionality is added to each text input field with the CSS class 'clearonfocus'. In your CSS file, you can define any style you want to that pre-filled state of the text field, like gray color etc.
On click, the text field is emptied and the class is removed.
This seems to work pretty well!
Abonnieren
Posts (Atom)