Archive > April 2007

My laptop now runs Ubuntu 7.04

Daniel K. Theemann » 20 April 2007 » In Computers » 1 Comment

Today I finished my Linux upgrade from Ubuntu 6.10 to the new 7.04 (Feisty Fawn). I upgraded from within my previously installed Ubuntu and finished without any complains.

It took me about 2.5 hours with 1Mbit ADSL that is okay. I am looking forward to discover and use the new features.

Here is a screenshot from my Ubuntu dekstop.

If you have discovered any exiting new features, please let me know.

Possibly Related Posts:


Tags: ,

Continue reading...

Tags: ,

<variable> = <expression> ? <value> : <value>

Daniel K. Theemann » 15 April 2007 » In PHP » 1 Comment

We all know that you as a programmer often is in a situation, where you proberly use an if-else construction. But you don’t always have to, often it is more sophisticated to use the sentence from the title and assign the right value, when the variable is instantiated.

<variable> = <expression> ? <value> : <value>

Let me give an example “when the sky is dark, then daytime is night, otherwise daytime is day”.

[source:php]
< ?php

$sky = “Dark”;

if(strcmp($sky, “Dark”) == 0) {
$day_time = “Night”;
}
else {
$day_time = “Day”;
}

?>
[/source]

The piece of code where you assign a value to “day_time” could you easily write on line:

[source:php]
< ?php

$sky = “Dark”;

$day_time = strcmp($sky, “Dark”) == 0 ? “Night” : “Day”;

?>
[/source]

So keep this little trick in mind, whenever a variable can be assigned one of two possible values.

Possibly Related Posts:


Tags:

Continue reading...

Tags: