Sunday, February 12, 2012

SEO: Hiding SEO content

I've read on numerous websites that google does all kind of fancy tricks to check if you are trying to hide your content. I know for a fact that you can fill a div with content, and then replace the content of that div with javascript, and still the initial content will be indexed!
the totally new an fantastic fliastioboklenki for wella shampoo


Chris Jordan captures visual landscapes of waste from todays intolerable mass consumption.

Batfile: Open directory in console

Whenever i download a small commandline tool, i need to open the program via the.. commandline =)

Before i copied the path of the explorer , then opened Commandline prompt via startmenu. Then paste the path, to finally end up in the path of the commanline tool, and then start testing..

This was then.. now i have a small batfile in my SendTo menu, this way i can select any file or folder and "send" it to the batfile, and commandline promt will open in that particular directory. SWEET!
@ECHO OFF
dir %1 | FIND "%~f1" > IS_DIR.res 
set isFolder=0
for /f "tokens=*" %%T in (IS_DIR.res) do set /a isFolder=isFolder+1
DEL /S /Q /F "IS_DIR.res"
CLS
IF %isFolder% == 1 (
 CMD /k cd /d "%~f1"
) ELSE (
 CMD /k cd /d "%~dp1"
)

Saturday, February 4, 2012

PHP : getFileExtension()

Stumbled upon this article at Cowburn. It's about the simple task of getting the extension of a filename.
It highlights this pretty nifty function:
return pathinfo($p, PATHINFO_EXTENSION);
In my case i needed it to handle filenames with queryline attached as well, simple fix:
function getFileExtension($p) {
 if( strpos($p,"?") != '' ) $p = substr($p, 0, strpos($p,"?") ); 
 return pathinfo($p, PATHINFO_EXTENSION);
 }

//==EXAMPLE==
wscript.echo getFileExtension("http://mysite/page.php?thefile=readme.txt")
// Outputs : 'php'

Read more on the pathinfo() on php.net