Articles Tagged 'trick'


Very short trick: proxy RSS with SimplePie

If you use Flash or Ajax to read RSS feeds from other domains, you need to equip yourself with a proxy (tunneling) because of the protections imposed by both technologies (see tunneling and proxy servers for Ajax and beyond ). If your site or blog is already SimplePie , you can write a simple proxy like this:

More ...

Very short trick: how to center elements on the page, even on IE5

It's not that I always take it with Internet Explorer, it's just that damn thing every Web development (HTML and CSS) seems not work with the browser - still - the most common (one day someone will explain why). ; ad esempio ecco come posizionare un div al centro dello schermo: A very convenient method to place an item in the middle of the browser window is to the property sfrutture auto style margin , for example, here is how to position a div in the center of the screen:

More ...

Very short trick: 3 output function in PHP

Within a PHP function can be printed in three different ways:

1
2
3
4
5
6
7
8
9
10
<? Php
$valore = 'Ciao' ) { miaFunction function ($ value = 'Hello') {
?>
<ul>
$valore ; ?> --> <! - <li> <? Php echo $ value;?> ->
?> </li> <li> <? = $ value?> </ li>
</ Ul>
<? Php
}
?>

Or:

1
2
3
4
$valore = 'Ciao' ) { miaFunction function ($ value = 'Hello') {
'<ul><li>' . $valore . '</li></ul>' ; $ O = '<li>'. $ Value. '</ Li> </ ul>';
; echo $ o;
}

Or:

1
2
3
4
$valore = 'Ciao' ) { miaFunction function ($ value = 'Hello') {
"<ul><li> $valore </li></ul>" ; $ O = "<li> $ value </ li> </ ul>";
; echo $ o;
}

More ...

Very short trick: versatility of CSS classes

nei fogli di stile CSS. Most experts will know already, but I am often asked what is the difference between class and id in the CSS. , è la possibilità di usare classi multiple. An overview of some differences and warnings can be found on the Classes and ID in CSS , however, a useful feature that distinguishes class from id , is the ability to use multiple classes.

More ...

Very short trick: undefined values ​​in Javascript

Is there a shortcut to assign "on the fly" a value to a variable if one is not defined (undefined), using the logical OR operator (| |) - double pipe:

1
2
3
4
5
/ / Foo is undefined
var bar;
pluto || '5' ; var foo = bar | | '5 ';
pippo ) ; alert (foo);
/ / Result: 5

More ...

Very short trick: faster loops in Actionscript

In Actionscript cycles for it is good to use them with care. For example, it is good to use variables uint when you can:

1
2
3
var i : uint = 0 ; i ++; i < 100 ) { for (var i: uint = 0; i + +; i <100) {
/ / ...
}

You can also use the - not always known - the form:

1
2
3
4
5
uint = 0 ; var i: uint = 0;
/ / ...
; i ++; i < 100 ) { for (; i + +; i <100) {
/ / ...
}

More ...

Very short trick: export with data from PHPMyAdmin

When performing an export from phpMyAdmin , you can preset the field "File name template" in the "Save As ...", so that automatically adds the current date. Normally this field is preset to __DB__ , which represents the database name. By placing such __DB__-%Y%m%d otteremo the name of our database, followed by the year, month and day currents: miodb-20081010

More ...

Very short trick: PHP echo car

In PHP you can use an abbreviated form, or contracted, to display variables or returns of functions:

1
2
3
4
5
6
7
8
/ / In place of
$miavar ?> <? Php echo $ miavar?>
/ / You can write
?> <? = $ Miavar?>
/ / In place of
miaFunc ( ) ?> <? Php echo miaFunc ()?>
/ / You can write
?> <? MiaFunc = ()?>

More ...



Stop SOPA