Get all directories in PHP

I think this may be the fastest way to get a list of all the directories in a given folder/directory using PHP. 1 $directories = array_filter(glob('*'), 'is_dir'); ..and of course, you can also add a path to it if you need to: 1 $directories = array_filter(glob($myPath.'*'), 'is_dir');

Security error: securitySandboxError with Flash

You have a flash uploader and you get this error: security error: securitySandboxError This means that the flash is not trusted by the domain and you have to place an xml file in the root of the domain. The file is called “crossdomain.xml” and this is what should be inside it: Solved! 😉

Component Inspector in Flash has ISSUES!

I discovered a very annoying bug in the Flash IDE a little while ago, and it has happened to me quite a few times. Today it happened again and so I write this post.. While in the Flash IDE you select a component on the stage, then you click “Component Inspector”. This opens up into a modal window which is nice and everything BUT…. …..if you then give focus to another program and then try click back into flash, it hides the “Component Inspector” modal window but still keeps focus on it, so basically, you can’t use the program(Flash IDE) / save your file / or even close the program!

Close/Delete Google Checkout Account

I have used Google Checkout to receive payments in the past and have had problems with some clients not paying and blaming it on Google Checkout that the money did not go through (like the guys over at Peartree DMS). I decided that this account was not worth the trouble anymore and wanted to close my account. I looked online everywhere and couldn’t find where to close the account – after quite a while I found how to do it, so here is how to close/delete/remove your Google Checkout account:

Warning: mysql_affected_rows(): supplied argument is not a valid MySQL-Link resource

Warning: mysql_affected_rows(): supplied argument is not a valid MySQL-Link resource You have just gotten a warning when trying to check if an inserted row was successful but when calling mysql_affected_rows(mysql_query(“INSERT INTO……”)) you get a warning telling you that the supplied argument is not a valid MySQL-Link resource. This is because mysql_query INSERT actually returns true or false and not a resource id. So rather do this: if (mysql_query(“INSERT INTO…”))

Capitalize First Letter in Word – Actionscript 2

You have a string and you want to capitalize the first character but have the rest of the word in lowercase. DO THIS! 1 myStringVar = myStringVar.substring(0, 1).toUpperCase()+myStringVar.substring(1);

HP Pavilion Laptop Madness

I have got an HP laptop and have started experiencing problems with it starting up for the past few months, it is only about 1.5years old and is supposed to be a decent one. It is an HP Pavilion dv9700 by the way.. Today the damn thing just didnt want to startup and eventually after trying every trick in the book I got it to boot into Degugging Mode in Windows Vista.

Why you should use OpenGL and not DirectX

Below is a very interesting article I found that proves all the myths about DirectX being better than OpenGL, a very well written paper describing it best. Thanks for that guys at Wolfire.com! http://blog.wolfire.com/2010/01/Why-you-should-use-OpenGL-and-not-DirectX

What does __FILE__ in php mean?

In php there are a few magic constants and I find FILE to be a very useful one. It returns the full path and filename of the file in question. Take a look at the PHP Manual – Magic Constants for more information on the others.

Woopra Failed to Connect?

I have used Woopra for a few months now and have started seeing this warning/error almost everyday now: Could not enable live functionality at this time. Click to reconnect. If you click the text/warning/error it seems to go away… Anybody konw what’s really going on under the cover? What happened: It turns out Woopra have upgraded their desktop application and will get to the web based application once they are done with everything else.

Change PHP Session Time

The default time for a php session is 1440 seconds. You can change it by doing the following: 1 ini_set("session.gc_maxlifetime",1440); You can obviously adjust the second parameter (1440) to anything you like to change the timeout limit.

Stop mouse click in browsers

There have been multiple ways to stop your user/s from right clicking on your site, but many of them now fail due to the way firefox’s contextual menu loads. Below is an example of how to do it: 1 function _c(e) {if (document.all) {if (event.button==2||event.button==3) {return false;}} else {if (e.button==2||e.button==3) {e.preventDefault();e.stopPropagation();return false;}}if (e.which) {}}if (document.all){document.onmousedown=_c;}else{document.onclick=_c;document.ondblclick=_c;} ..and here is the full working example in a webpage: 1 2 3 4 5 <script><br /> function _c(e) {if (document.

Microsoft apps never care!

I often seem to have this issue when dealing with Microsoft software. You click “Cancel” and it just carrys on going, so you click it again a few more times and instead of it just stopping in it’s tracks, decides to rather tell you it’s cancelling and then shows a cancelling dialog box for the next 10 minutes! Cummon guys, that’s not very professional!

Place HTML Div on top of Flash

If you have ever tried to place a div or similar HTML element on top of a swf flash object you will know that it always tries to take precedence. You will need to do the following: In the code for the flash in the embed area add: 1 wmode="transparent" If you are using SWFObject to insert swf files you can do the following: 1 2 3 4 5 <script type="text/javascript"> var so = new SWFObject("movie.

Stage align and Stage scale in actionscript 3

If you want to position the flash top/left and not have it scale when you resize it’s bounding box window, you can set the following code. 1 2 stage.align = StageAlign.TOP_LEFT; stage.scaleMode = StageScaleMode.NO_SCALE; For full documentation from Adobe take a look here.

Error 406?

So you received an error 406 while trying to upload a file and you have no idea to fix it! Create an .htaccess file in the root of your local website and add the following into it: 1 2 3 4 <IfModule mod_security.c> SecFilterEngine Off SecFilterScanPOST Off </IfModule>

Firefox error in FeedProcessor.js

[Exception… “Component returned failure code: 0x80040111 (NS_ERROR_NOT_AVAILABLE) [nsIChannel.contentType]” nsresult: “0x80040111 (NS_ERROR_NOT_AVAILABLE)” location: “JS frame :: file:///C:/Program%20Files/Mozilla%20Firefox/components/FeedProcessor.js :: FP_onStartRequest :: line 1440” data: no] file:///C:/Program%20Files/Mozilla%20Firefox/components/FeedProcessor.js Line 1440 So what the heck does that all mean? Basically, there is an exception error on like 1440 of the local Firefox javascript file “FeedProcessor.js”. The line in question is as follows: channel.contentType = “application/vnd.mozilla.maybe.feed”; The whole section of code reads as follows: // nsIStreamListener

mySQL select multiple ids

1 SELECT * FROM tablename WHERE `active`='1' AND `id` IN ('107' , '125' ) ORDER BY `id` DESC LIMIT 12`

Force Download in PHP

This script works in all browsers, including Internet Explorer! 🙂 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 if (strstr($_SERVER['HTTP_USER_AGENT'],"MSIE")) { header("Pragma: public"); header("Expires: 0"); header("Cache-Control: must-revalidate, post-check=0, pre-check=0"); header("Cache-Control: private",false); header("Content-Type: application-download"); header("Content-Disposition: attachment; filename=\"".basename($filename)."\";"); header("Content-Transfer-Encoding: binary"); header("Content-Length: ".@filesize($ab_file)); set_time_limit(0); } else { header("Content-type: application-download"); header("Content-Length: ".filesize($ab_file)); header("Content-Disposition attachment; filename=".$filename); } readfile($ab_file);