A diary of a newbie's wild adventure through the world of low-level scripting and computer programming. Flash Actionscript, VBScript, Windows Commandline Scripting, Data Visualization - JOY!
Saturday, July 21, 2012
JavaScript : Simple document load check
I usually use jquery's $(document).load(), but in a particular case, i wanted to trim loadtimes, and used this altered version of something i found on stackoverflow.
Wednesday, May 16, 2012
Adobe destroyed Flash
Adobe destroyed flash. End of story
They might put alot of fancy stuff, but mostly it just breaks, and i've had enough now.. i'm DONE promoting flash IDE, it sucks!
Etiketter:
actionscript,
adobe,
apple,
as2,
as3,
flash,
html5,
steve jobs
Monday, April 2, 2012
Windows 8 using Ribbon
Windows 8 will be using the Ribbon library..(office 2010 menu style) - I really don't like this.
First off, i'm a big fan of the old win2000 taskbar / start menu interface.. and until now i've been able to modify even windows 7 to act and look the way i want. Again, simple is better! ..functionality uber alles. I generally dont like wallpapers, no widgets.. no fancy stuff.
I really respect truly innovative ideas.. the explorer address bar that came in vista.. i didnt see that one coming, and that is really an enhancement!
On the other hand, one of my favorite features the "SendTo" menu, got crippled since Vista because it now lacks the abilty to contain nested folders.
Implementing Ribbon seems like a desperate choice, just the fact they thought of it.. pheee.. shame! - I'd really like to work for MS and tell them how to make the best UI for real computer users..(now they got Metro for complete idiots)
Microsoft, Please let me know.. i got a couple or 20 good ideas.. here's some
1. Make the SendTo menu able to contain nested folders (like <=XP)
2. Better support for video and graphic thumbnails in general.
3. Prioritize functionality and readability over fancy glossy buttons and animations. (this is here windows should win over osx)
4. Customizeable UI / Workflows is everything.
5. Make a better search functionality, since Vista search has been crippled.
...
First off, i'm a big fan of the old win2000 taskbar / start menu interface.. and until now i've been able to modify even windows 7 to act and look the way i want. Again, simple is better! ..functionality uber alles. I generally dont like wallpapers, no widgets.. no fancy stuff.
I really respect truly innovative ideas.. the explorer address bar that came in vista.. i didnt see that one coming, and that is really an enhancement!
On the other hand, one of my favorite features the "SendTo" menu, got crippled since Vista because it now lacks the abilty to contain nested folders.
Implementing Ribbon seems like a desperate choice, just the fact they thought of it.. pheee.. shame! - I'd really like to work for MS and tell them how to make the best UI for real computer users..(now they got Metro for complete idiots)
Microsoft, Please let me know.. i got a couple or 20 good ideas.. here's some
1. Make the SendTo menu able to contain nested folders (like <=XP)
2. Better support for video and graphic thumbnails in general.
3. Prioritize functionality and readability over fancy glossy buttons and animations. (this is here windows should win over osx)
4. Customizeable UI / Workflows is everything.
5. Make a better search functionality, since Vista search has been crippled.
...
Saturday, March 31, 2012
WordPress : Find image sizes from filname/URL
This function is a small hack to scan the upload directory for an image matching certain sizes. The search based on the image names and wordpress nameconvention (xxxxxx-300x200.jpg)
The whole point of this, is you can use this outside the wordpress "loop".
The function uses 3 arguments, third one is optional.
1. $fpath - complete filepath to "original image"
2. $minSizes - array of minimum width/height
3. $maxSizes [optional] - array of maximum width/height
Put following in your themes functions.php
The whole point of this, is you can use this outside the wordpress "loop".
The function uses 3 arguments, third one is optional.
1. $fpath - complete filepath to "original image"
2. $minSizes - array of minimum width/height
3. $maxSizes [optional] - array of maximum width/height
Put following in your themes functions.php
function findImageSize($fpath, $minSizes = array(1,1), $maxSizes = array(9999,9999) ){
$res = false;
$bs = basename($fpath, ".jpg");
$uploadDir = "wp-content/uploads/";
$siteUrl = site_url('/');
$results = glob("{".$uploadDir.$bs."-*x*.jpg"."}",GLOB_BRACE);
$smallest = array(9999,9999);
foreach ($results as $v) {
$bst = basename($v, ".jpg");
$ldi = strrpos($bst,"-");
if($ldi === false){
}else {
$tmp = substr($bst,$ldi+1); $wihe = split("x",$tmp); $iw = intval($wihe[0]); $ih = intval($wihe[1]);
if($iw < $minSizes[0]){;} else if ($iw > $maxSizes[0]){;} else if($ih < $minSizes[1]){;} else if($ih > $maxSizes[1]){;} else {
if( ($iw*$ih) < ($smallest[0]*$smallest[1]) ){
$smallest[0] = $iw;
$smallest[1] = $ih;
$res = array ('url' => ($siteUrl.$v), 'width' => $iw,'height' => $ih);
}
}
}
}
return $res;
}
// Example
$res = findImageSize("http://myblog.com/wp-content/uploads/my-poster-image.jpg", array(300,600) ,array(1024,1024) );
echo $res[url];
echo $res[width];
echo $res[height];
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
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!
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:
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
Subscribe to:
Posts (Atom)
