b4r7 blocco note 2.0

29gen/100

Windows’ God Mode

A vostro rischio e pericolo, provate.

Create un nuovo collegamento (click dx -> Nuovo -> Collegamento) con il seguente percorso:
explorer.exe shell:::{ED7BA470-8E54-465E-825C-99712043E01C}
Chiamatelo come volete, doppio click

Oppure

Create una nuova cartella (click dx -> Nuovo -> Cartella) con il seguente nome:
Modalità Dio.{ED7BA470-8E54-465E-825C-99712043E01C}
Entrate nella cartella

Non resta altro che godervi la modalità dio.

Testati su Windows Vista Home Premium SP2 x86.
Funzionano anche su Vista x64, 7 x32, 7 x64 - si mormora.

18set/090

convert for windows

Convert is a free and easy to use unit conversion program that will convert the most popular units of distance, temperature, volume, time, speed, mass, power, density, pressure, energy and many others, including the ability to create custom conversions!

Screenshot

convertAni

System Requirements

Convert will run on the following supported operating systems:

  • Windows 95
  • Windows NT 4
  • Windows 98
  • Windows 98SE
  • Windows ME
  • Windows 2000
  • Windows XP
  • Windows 2003
  • Windows Vista
  • Windows 7
  • Anything that runs Wine (not officially supported) [Convert runs quite well on Linux and UNIX using Wine. If you do this, you may need to change the tab layout to use a single row by going into Options > Preferences > Tabs, and clear the Multiple Lines option]

If your operating system is not listed above, Convert will not run on it.

Download Types

There are two ways to download Convert.

  • ConvertSetup.exe (780kb) is a full InstallShield installation which sets up directories, icons, and supports uninstallation. This download is recommended for most users.
  • convert.zip (153kb) is a ZIP file of just the executable. You can unZIP it with your favorite ZIP tool and just run the executable. This download is recommended for experienced users.

Other Information

10ago/090

camel case con PHP

<?php
$testo = "qualCOSA che vuOI mettere in Camel CASE";
echo ucwords(strtolower($testo)); //Qualcosa Che Vuoi Mettere In Camel Case
?>

strtolower: http://it.php.net/manual/en/function.strtolower.php
ucwords: http://it.php.net/manual/en/function.ucwords.php

Inserito in: piccì, siti, tips Nessun commento
3mag/090

eliminare .svn

Windows:

for /f "tokens=* delims=" %%i in ('dir /s /b /a:d *svn') do (
rd /s /q "%%i"
)

Linux:

find ./ -name .svn -exec rm -rf {} +

Mac (OS 10.5):

find . -name .svn -exec rm -rf {} \;

presi dalla rete e collezionati, non si sa mai. per chi come me è su winzozz, il primo codice basta salvarlo con estensione bat e lanciarlo nella cartella a cui vogliamo togliere le .svn .. con vizta ho dovuto spostarlo in alcune sotto-cartelle. non ho provato su linuz. non ho mc.

26apr/090

The perfect PHP clean url generator

via: http://cubiq.org/the-perfect-php-clean-url-generator/12

In my hunt for the perfect clean url (smart url, slug, permalink, whatever) generator I've always slipped in some exception or bug that made the function a piece of junk. But I recently found an easy solution I hope I could call "definitive".

Clean url generators are crucial for search engine optimization or just to tidy up the site navigation. They are even more important if you work with international characters, accented vowels /à, è, ì, .../, cedilla /ç/, dieresis /ë/, tilde /ñ/ and so on.

First of all we need to strip all special characters and punctuation away. This is easily accomplished with something like:

function toAscii($str) {
	$clean = preg_replace("/[^a-zA-Z0-9\/_|+ -]/", '', $str);
	$clean = strtolower(trim($clean, '-'));
	$clean = preg_replace("/[\/_|+ -]+/", '-', $clean);

	return $clean;
}

With our toAscii function we can convert a string like “Hi! I’m the title of your page!” to hi-im-the-title-of-your-page. This is nice, but what happens with a title like “A piñata is a paper container filled with candy”?
The result will be a-piata-is-a-paper-container-filled-with-candy, which is not cool. We need to convert all special characters to the closest ascii character equivalent.

There are many ways to do this, maybe the easiest is by using iconv.

setlocale(LC_ALL, 'en_US.UTF8');
function toAscii($str) {
	$clean = iconv('UTF-8', 'ASCII//TRANSLIT', $str);
	$clean = preg_replace("/[^a-zA-Z0-9\/_| -]/", '', $clean);
	$clean = strtolower(trim($clean, '-'));
	$clean = preg_replace("/[\/_| -]+/", '-', $clean);

	return $clean;
}

I always work with UTF-8 but you can obviously use any character encoding recognized by your system. The piñata text is now transliterated into a-pinata-is-a-paper-container-filled-with-candy. Lovable.
If they are not Spanish, users will hardly search your site for the word piñata, they will most likely search for pinata. So you may want to store both versions in your database. You may have a title field with the actual displayed text and a slug field containing its ascii version counterpart.

We can add a delimiter parameter to our function so we can use it to generate both clean urls and slugs (in newspaper editing, a slug is a short name given to an article that is in production, source).

setlocale(LC_ALL, 'en_US.UTF8');
function toAscii($str, $delimiter='-') {
	$clean = iconv('UTF-8', 'ASCII//TRANSLIT', $str);
	$clean = preg_replace("/[^a-zA-Z0-9\/_|+ -]/", '', $clean);
	$clean = strtolower(trim($clean, '-'));
	$clean = preg_replace("/[\/_|+ -]+/", $delimiter, $clean);

	return $clean;
}

// echo toAscii("A piñata is a paper container filled with candy.", ' ');
// returns: a pinata is a paper container filled with candy

There’s one more thing. The string “I’ll be back!” is converted to ill-be-back. This may or may not be an issue depending on your application. If you use the function to generate a searchable slug for example, looking for “ill” would return the famous Terminator quote that probably isn’t what you wanted.

setlocale(LC_ALL, 'en_US.UTF8');
function toAscii($str, $replace=array(), $delimiter='-') {
	if( !empty($replace) ) {
		$str = str_replace((array)$replace, ' ', $str);
	}

	$clean = iconv('UTF-8', 'ASCII//TRANSLIT', $str);
	$clean = preg_replace("/[^a-zA-Z0-9\/_|+ -]/", '', $clean);
	$clean = strtolower(trim($clean, '-'));
	$clean = preg_replace("/[\/_|+ -]+/", $delimiter, $clean);

	return $clean;
}

You can now pass custom delimiters to the function. Calling toAscii("I'll be back!", "'") you’ll get i-ll-be-back. Also note that the apostrophe is replaced before the string is converted to ascii as character encoding conversion may lead to weird results, for example é is converted to 'e, so the apostrophe needs to be parsed before the string is mangled by iconv.

The function seems now complete. Lets stress test it.

echo toAscii("Mess'd up --text-- just (to) stress /test/ ?our! `little` \\clean\\ url fun.ction!?-->");
returns: messd-up-text-just-to-stress-test-our-little-clean-url-function

echo toAscii("Perché l'erba è verde?", "'"); // Italian
returns: perche-l-erba-e-verde

echo toAscii("Peux-tu m'aider s'il te plaît?", "'"); // French
returns: peux-tu-m-aider-s-il-te-plait

echo toAscii("Tänk efter nu – förr'n vi föser dig bort"); // Swedish
returns: tank-efter-nu-forrn-vi-foser-dig-bort

echo toAscii("ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖÙÚÛÜÝßàáâãäåæçèéêëìíîïðñòóôõöùúûüýÿ");
returns: aaaaaaaeceeeeiiiidnooooouuuuyssaaaaaaaeceeeeiiiidnooooouuuuyy

echo toAscii("Custom`delimiter*example", array('*', '`'));
returns: custom-delimiter-example

echo toAscii("My+Last_Crazy|delimiter/example", '', ' ');
returns: my last crazy delimiter example

I’m sure we are far from perfection and probably some php/regex guru will soon bury me under my ignorance suggesting an über-simple alternative to my function. What do you thing?