Archive for 2007

Put some use to the remote that shipped with your MacBook!

Tuesday, July 24th, 2007

Do you really use the remote that came with your MacBook?

(more…)

See how other people see your website - Screen Capture Services

Monday, July 23rd, 2007

Do you care how other people see your website? You should!

(more…)

8 Firefox Add-ons every Web Developer should know about!

Sunday, July 22nd, 2007

Here are my top 8 favorite Firefox Add-ons for web-development, everybody in our company uses these Add-ons to help them be as productive as possible.

  (more…)

Free Glossy Button Photoshop layer-style

Friday, July 20th, 2007

Here is a little Photoshop layer-style that i made for a website I’m currently working on. I think it’s pretty neat, so i’ll share it with you :)

You can use it on pretty much every shape, if you have a very small shape you might have to adjust is the stroke->size in the layer-style.

Preview:

glossy button layer-style preview
click to enlarge

You can easily change the color by adjusting the Color Overlay of the layer-style.

Download

To load the layer-style simply extract the archive you downloaded, copy the file glossyButtons.asl to Your_Photoshop_Directory\Presets\Styles and load it in Photoshop (”Styles” window -> load…)

I hope you like it.

Test whether or not your webserver can be used as spam relay

Friday, July 20th, 2007

I just want to share a link with you that is found earlier today.

On the website http://www.abuse.net/relay.html you can test whether or not your server can be used as spam-relay.

The website states that the application is “experimental” at the moment, but it is sure worth checking out.

Pretty handy if you don’t want to end up in anti-spam blacklists like spamhouse.org.

PHP: backtracing function names - useful for logging and debugging

Thursday, July 19th, 2007

Today i want to show you a little trick that allows you to backtrace function calls (finding out which function called the function you are currently in)

Lets start with an example script, i will explain the details below.

function getThisName($arg1, $arg2)
{
  logIt('Log Message...');
  return;
}

function logIt($msg)
{
  // this is where the magic happens:
  $backtrace = debug_backtrace();

  //demo: output log to browser
  echo '<b>Log Message:</b> "' . $msg . '" - in file <b>' . $backtrace[1]['file'] . '</b> Line: <b>' . $backtrace[1]['line'] . '</b> - Function: <b>' . $backtrace[1]['function'] . '()</b><br /><br />';

  //it is a good idea to also output/log the arguments given to that function - very nice for debugging
 echo '<b>Arguments:</b><br />';

  // parse all arguments
  foreach($backtrace[1]['args'] as $argument)
  {
    echo '* ' . $argument . '<br />';
  }
}
getThisName('This is argument 1', 'This is argument 2');

This will output:

<strong>Log Message:</strong> "Log Message..." - in file <strong>/var/www/site/tracing.php</strong> Line: <strong>26</strong> - Function: <strong>getThisName()</strong>

<strong>Arguments:</strong>
* This is argument 1
* This is argument 2

So, what the above script does is:

  1. function getThisName() is called
  2. getThisName() calls function logIt()
  3. logIt() loads the result of debug_backtrace in an array
  4. logIt() outputs the result

How it works
debug_backtrace() will return an array that looks like this:

Array
(
  [0] =&gt; Array
  (
    [file] =&gt; /var/www/site/tracing.php
    [line] =&gt; 4
    [function] =&gt; logIt
    [args] =&gt; Array
    (
        [0] =&gt; Log Message...
    )
  )
  [1] =&gt; Array
  (
    [file] =&gt; E:roottracing.php
    [line] =&gt; 27
    [function] =&gt; getThisName
    [args] =&gt; Array
    (
        [0] =&gt; This is argument 1
        [1] =&gt; This is argument 2
    )
  )
)

So as you can see you have one array with multiple arrays in it, every array represents one level.

The array with the key [0] is always the function that calls debug_backtrace() - in our case logIt(), the lowest level.
Key [1] is one level above the one that is calling debug_backtrace() - in our case getThisName(). If there a more levels, there will be more arrays, one for every level.

So you could say $backtrace[2] to get the details of th function that called getThisName.

This means you can backtrace very complex function calls, wich will help you to debug your php scripts.

I hope this information was useful for you, i use it pretty often since i found out about this great php feature.