Toshiba Stratagy phone system new voicemail button calls other extension

One thing I run into occasionally on our Toshiba Stratagy phone system is new voicemail indicators directly calling another users desk extension. Usually this happens without either parties really understanding what is causing the issue. On the phone display it self it shows something like:

Daniel K ext.112
Call 112-111

The normal screen when a new voicemail is available may show:

Daniel K ext.112
Call 112-333V

What the first screen shows is that the owner of the phone is extension 112 and that extension 111 wants to talk with the person at 112. When the user of extension 112 pushes their blinking Msg button it will call 111 and should clear the indicator once the person at 111 picks up the phone. Sometimes this is not the case and we must dial a special sequence of numbers on extension 111 to clear the light on 112. So from the Ext 111 phone dial #64 plus the extension (in this case it would be #64112) and then hang up.

Now here is the cool thing with this “issue”. If you wanted to notify a user to call you without interrupting a meeting you can dial #63 plus the extension to enable this light. An example of this would be if I was still at Ext 112 and I wanted the person sitting at Ext 111 to call me I could dial #63111 from my Ext 112 and it would show the following on Ext 111:

Josh ext.111
Call 111-112

Once the conversation was done I would then dial #64111 on my phone to clear the new Msg blinking light on Ext 111. Enjoy!

Linux uptime

If you want to show the uptime of your linux server on your website, you can do so very easily.

<?php
function linuxUptime() {
  $ut = strtok( exec( "cat /proc/uptime" ), "." );
  $days = sprintf( "%2d", ($ut/(3600*24)) );
  $hours = sprintf( "%2d", ( ($ut % (3600*24)) / 3600) );
  $min = sprintf( "%2d", ($ut % (3600*24) % 3600)/60  );
  $sec = sprintf( "%2d", ($ut % (3600*24) % 3600)%60  );
  return array( $days, $hours, $min, $sec );
}

$ut = linuxUptime();
// If you would like to show the seconds as well just add [ , $ut[3] seconds ] after minutes.
echo "Time since last reboot: $ut[0] days, $ut[1] hours, $ut[2] minutes";
?>

Just call the $ut = linuxUptime() function and then you can use the variables to show the time.

**NOTE: Your server must allow you to run the exec() PHP command. Some hosts disable the execution of this and several other PHP functions.

Now if you were wanting to gather the uptime of multiple servers all at the same time this can be accomplished with CURL. What we would end up doing is using the above code and place it in a PHP file on each of the target servers. In the example below you will see I am referencing a file called linuxUptime.php which holds the code listed above. We could then use a MySQL database or just an array full of domain names that we would loop through to gather the stats. Below I am posting a simple script which uses an array as an example. (This file does not currently exist on my site to show uptime of my site)

<?php
$sites = array('danielkassner.com'); // Create a list of sites to check
foreach($sites as $site) { // Loop through each site and get uptime

$ch = curl_init(); // Initiate curl session
curl_setopt($ch, CURLOPT_URL, 'http://'.$site.'/linuxUptime.php'); // Set the URL of the uptime script
curl_setopt($ch, CURLOPT_HEADER, 0); // Disable header output
curl_setopt($ch, CURLOPT_RETURNTRANSFER,1); // Return data as a string instead of output directly
$data=curl_exec($ch); // Execute curl commands
curl_close ($ch); // Close the curl session

echo $site.': '.$data.'<br />'; // Output value returned from the linuxUptime.php file
} // End server loop
?>

When we gather stats like this we could easily store the uptime values in a database table so that we could track the history.

Enjoy!

Notepad++ Ctrl+Tab tip

If you are like me and prefer to use the keyboard as much as possible instead of a mouse you will like this tip. When in Notepad++ if on your keyboard you press Ctrl+Tab it brings up a Windows style Alt+Tab menu to cycle through your open documents. When you let up on the keys it switches to the file you selected. Check out the screenshot below of it in action.

Notepad++Trick

Use Curl and PHP to check if website is up or moved

Using the below code you can check to see if a website is up or not. There is an array of various HTTP codes that it can check for. The code will also determine if the website has something like a 301 redirect and then produce the redirected URL. This could be useful for link directories that want to check for URL’s that are no longer active or update their links if the URL has changed. With this code we are just showing the status code and then parsing out all status codes to show later on in the script. The script then compares the URL you are checking vs what the URL that the CURL script ended up on to determine if it was moved. The very last bit of this code is showing you the HTTP headers from the CURL request for viewing purposes only and can be deleted.

<?php
$toCheckURL = "http://www.wlscripting.com/tutorial/67"; // The domain name of the site you want to check
// This all sets up the CURL actions to check the page
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $toCheckURL);
curl_setopt($ch, CURLOPT_HEADER, true);
curl_setopt($ch, CURLOPT_NOBODY, true);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($ch, CURLOPT_MAXREDIRS, 10); //follow up to 10 redirections - avoids loops
$data = curl_exec($ch);
$http_code = curl_getinfo($ch, CURLINFO_HTTP_CODE); // Get the HTTP Code
// Get final redirected URL, will be the same if URL is not redirected
$new_url = curl_getinfo($ch, CURLINFO_EFFECTIVE_URL); 
curl_close($ch);

// Array of HTTP status codes. Trim down if you would like to.
$codes = array(0=>'Domain Not Found',
			   100=>'Continue',
			   101=>'Switching Protocols',
			   200=>'OK',
			   201=>'Created',
			   202=>'Accepted',
			   203=>'Non-Authoritative Information',
			   204=>'No Content',
			   205=>'Reset Content',
			   206=>'Partial Content',
			   300=>'Multiple Choices',
			   301=>'Moved Permanently',
			   302=>'Found',
			   303=>'See Other',
			   304=>'Not Modified',
			   305=>'Use Proxy',
			   307=>'Temporary Redirect',
			   400=>'Bad Request',
			   401=>'Unauthorized',
			   402=>'Payment Required',
			   403=>'Forbidden',
			   404=>'Not Found',
			   405=>'Method Not Allowed',
			   406=>'Not Acceptable',
			   407=>'Proxy Authentication Required',
			   408=>'Request Timeout',
			   409=>'Conflict',
			   410=>'Gone',
			   411=>'Length Required',
			   412=>'Precondition Failed',
			   413=>'Request Entity Too Large',
			   414=>'Request-URI Too Long',
			   415=>'Unsupported Media Type',
			   416=>'Requested Range Not Satisfiable',
			   417=>'Expectation Failed',
			   500=>'Internal Server Error',
			   501=>'Not Implemented',
			   502=>'Bad Gateway',
			   503=>'Service Unavailable',
			   504=>'Gateway Timeout',
			   505=>'HTTP Version Not Supported');

// Check if we have a valid HTTP code from the above list
if (isset($codes[$http_code])) {
	echo 'Website returned status code: '.$http_code.' - '.$codes[$http_code].'<br />';
	// Get the headers from the $data to the $matches variable
	preg_match_all("/HTTP\/1\.[1|0]\s(\d{3})/",$data,$matches);
	array_pop($matches[1]); // Remove the last status that we just displayed above which should be 200
	if (count($matches[1]) > 0) {
		// Loop through all other matches to see what other status codes we got
		foreach ($matches[1] as $c) {
			echo $c.' - '.$codes[$c].'<br />';
		}
	}
	// Can use this to check if the URL is still the same as you checked
	// Or if the server has moved
	if ($toCheckURL != $new_url) {
	echo 'URL has now changed to: '.$new_url;
	}
}
// This is just to show you the headers of the website you are checking
echo '<hr /><pre>';
var_dump($data);
echo '</pre>';
?>

I have commented the code a lot so you should have no trouble modifying the code.

Printers and Faxes will not open, no printers available

Recently I had an issue with a laptop where any time you attempted to open up Printers and Faxes in Windows XP no printers would be listed. You could not select any printers from File > Print when in an application. After a bit of searching I found that it seems to be some corrupted files. To clear the issue follow the following instructions:

  • Click Start and select Run. (Windows Key + R shortcut)
  • Type services.msc in the Open field then hit Enter
  • Stop/Disable the Print Spooler
  • Navigate to c:\Windows\system32\spool\printers in Windows Explorer and delete all files in this folder
  • Re-enable / Start Print Spooler, Make sure it is set back to Automatic startup
  • Pull up Printers and Faxes and see what happens

This seems to take care of the issue. Once I deleted those files I was able to open Printers and Faxes and see all of my printers. Just for kicks I printed a test page and everything worked like it should.

Uninstall Sophos Anti-Virus get Internal Error 2738

Recently I was attempting to uninstall Sophos Anti-Virus from my computer to change which server I get the anti-virus updates from as we are switching which server anti-virus server is run on. I decided that I would uninstall the old version and re-install as this would be the easiest way for me to change settings that were all grayed out not allowing me to change. I was able to un-install everything except for the Sophos AutoUpdate service as it would error out with an Internal Error 2738. Doing a quick 10 minute Google search found that I should attempt to register the vbscript.dll file. To do this follow the instructions below. Please note I am running Windows 7 32 bit.

  • Click the Start button/pearl
  • In the Search programs and files box just above Start button do a search for Command. This will bring up the Command Prompt in the search. Right click this and Run as Administrator.
  • This should open a command prompt window with the default file path of c:\Windows\system32. Type the following in the command prompt then hit enter:

    regsvr32 vbscript.dll

  • If success you will see a message that says: “DllRegisterServer in vbscript.dll succeeded.”

Now that we have done that you can minimize the command prompt and attempt to uninstall the Sophos AutoUpdate client that we could not previously. If you are still getting the error above you will need to continue process below to delete a registry key. I would highly suggest backing up the registry before doing any changes to the registry in case something goes wrong which it shouldn’t.

  • Bring back up your Administrator Command Prompt
  • Paste the following into the command prompt and then press enter:

    reg delete “HKCU\SOFTWARE\Classes\CLSID\{B54F3741-5B07-11CF-A4B0-00AA004A55E8}” /f

  • Once you have deleted the registry key run the regsvr32 vbscript.dll command that we did above

Now that we have deleted the registry key and re-registered the vbscript.dll file we should now have success in un-installing Sophos. If you are still having problems with this I highly recommend contacting Sophos support.

Feature request for Notepad++ Function List plugin

As the number of visitors continues to increase to my Notepad++ Function List for PHP development post I have frequently been asked if this plugin can do a certain task. This task would be to add multiple rules to one main category. So for instance you have a file that has multiple classes located in it and each class has its own set of variables and functions. The Function List plugin allows us to parse these out and find them. However, in its current state we can only link one parsing rule to another.

Example:
Current State:
-Classes
–Training model extends Model
—Functions
—-__construct
—-EventListing
-Class Variables
–$Month
–$Day
–$Year

What we would like:
-Classes
–Training model extends Model
—Class Variables
—-$Month
—-$Day
—-$Year
—Functions
—-__construct
—-EventListing

I have sent an email to the creator of the plugin(Jens Lorenz) about asking the possibility of changing the plugin and that correspondence is listed below:

Sent from Me on March 17, 2010 7:57 AM

I have used the Function List plugin for Notepad++ for some time now and really enjoy it. My question to you is if it would be possible to add multiple subgroups under one group? For instance I am a PHP developer; I have parsing rules for Classes, Class Variables and Functions. I would love to be able to put Class Variables along with the Functions rules under the classes tree. So instead of having:
-Classes
–printer extends resources
—Functions
—-__construct
—-sqlInsert
-Class Variables
–$security
–$db

I would have:
-Classes
–printer extends resources
—Class Variables
—-$security
—-$db
—Functions
—-__construct
—-sqlInsert

I have put up a blog posting of what my current FunctionListRules.xml section looks like at: http://www.danielkassner.com/2010/01/22/using-notepads-function-list-plugin-for-php-development

If you have any ideas that would be great. Thanks!

Sent by Jens Lorenz on March 18, 2010 at 3:27 AM

Hello Daniel,

currently it isn’t possible. Only one level of subgrouping is possible at the moment.

Best Regards
Jens

Sent by me on March 18, 2010 at 7:41 AM

Do you think that this desired functionality will or could be added to a future release? I am sure that it will take some time to accomplish but it would be nice.

Thank you for the quick response.

I did not get a response back from that last email. I wish that I knew more about C++ to modify and send the changes I would make to him for everyone else to enjoy. I am sure he is a busy man just like me which is why I probably did not get a response back.

If you would like to see this feature potentially get added please contact him via email and or post comment here on this posting. You can find his email by opening Notepad++, selecting the Plugins > Function List > Help menu item.

Disable web browser tab previews in Windows 7

Recently I upgraded my work machine from Windows Vista to Windows 7. While learning the new features of 7 I found that Aero likes to show tab previews of each tab I have open in Firefox, Internet Explorer and Opera. I am the kind of guy that keeps multiple tabs open almost all day long looking up items, coding, … the list could go on so I found this “feature” a pain. As you can see in the below image that I have multiple websites open but you cannot tell if it is multiple windows or multiple tabs.

Firefox1

Now with the picture below you can easily see I have only one window open but four tabs.

Firefox2

To disable tab previews in Firefox you need to do the following:

  • Open the about:config page in a new tab or window
  • Filter for: browser.taskbar.previews.enable
  • By default this is set to true so double click on the true to swap the value to false
  • Your done!

Now for Internet Explorer you have to open the the Internet Options. You will do this by opening Internet Explorer and in the toolbar look for the Tools icon which looks like a gear and then select Internet Options at the very bottom.

IE0

Once in the Internet Options click on the Settings button in the Tabs section.

IE1

Once in the Tabbed Browsing Settings un-check the option that says: Show previews for individual tabs in the taskbar*, then click OK on all the open windows and close out of Internet Explorer.

IE2

Now for Opera we have to open the opera:config page in a new tab or window.

Opera1

Scroll down to a section titled User Prefs and expand this section.

Opera2

Scroll down towards the bottom of the User Prefs section and un-check the check box: “Use Windows 7 Taskbar Thumbnails”

Opera3

Once you have unchecked this box scroll down to the bottom of the User Prefs section and click the save button. You will eventually be presented with the following dialog box once complete.

Opera4

That is how you disable tab previews in Windows 7 for popular browsers.

Get user operating system with PHP

Ever wanted to find out what operating system your visitors are using? The following function will allow you to get the user operating system so you can use in a statistics application or show certain content on your website. This will allow server side decisions on what stylesheets to show or any other operating system specific content to be shown/hide.

<?php
/*
Author: Daniel Kassner
Website: http://www.danielkassner.com
*/
function getOS($userAgent) {
  // Create list of operating systems with operating system name as array key 
	$oses = array (
		'iPhone' => '(iPhone)',
		'Windows 3.11' => 'Win16',
		'Windows 95' => '(Windows 95)|(Win95)|(Windows_95)', // Use regular expressions as value to identify operating system
		'Windows 98' => '(Windows 98)|(Win98)',
		'Windows 2000' => '(Windows NT 5.0)|(Windows 2000)',
		'Windows XP' => '(Windows NT 5.1)|(Windows XP)',
		'Windows 2003' => '(Windows NT 5.2)',
		'Windows Vista' => '(Windows NT 6.0)|(Windows Vista)',
		'Windows 7' => '(Windows NT 6.1)|(Windows 7)',
		'Windows NT 4.0' => '(Windows NT 4.0)|(WinNT4.0)|(WinNT)|(Windows NT)',
		'Windows ME' => 'Windows ME',
		'Open BSD'=>'OpenBSD',
		'Sun OS'=>'SunOS',
		'Linux'=>'(Linux)|(X11)',
		'Safari' => '(Safari)',
		'Macintosh'=>'(Mac_PowerPC)|(Macintosh)',
		'QNX'=>'QNX',
		'BeOS'=>'BeOS',
		'OS/2'=>'OS/2',
		'Search Bot'=>'(nuhk)|(Googlebot)|(Yammybot)|(Openbot)|(Slurp/cat)|(msnbot)|(ia_archiver)'
	);

	foreach($oses as $os=>$pattern){ // Loop through $oses array
    // Use regular expressions to check operating system type
		if(eregi($pattern, $userAgent)) { // Check if a value in $oses array matches current user agent.
			return $os; // Operating system was matched so return $oses key
		}
	}
	return 'Unknown'; // Cannot find operating system so return Unknown
}
?>

An example of how this would be used:

<?php
echo getOS($_SERVER['HTTP_USER_AGENT']);
?>

This script can be used with the Get Browser Type, which also has the same structure as this script.

Change outgoing BlackBerry PIN message sender email address

At the organization I work for we have a BlackBerry server setup with around 30 users. Works great for those employees that don’t get computer access but still need access to get emails to stay up to date on daily schedules and patient care. However when there is a problem that affects email on the devices it is best to notify those staff there is an issue or that the issue has been resolved. This is where using PIN messaging comes in very handy. This last time I had a device in my hand and I noticed that the email address on the PIN message was from admin@yourcompanydomain.com instead of something related to our organization. Below I will show you how to change this so that your outgoing PIN messages have an email address that actually correlates with your own business.

* I am doing these processes on BlackBerry Server 5 and not 4. The process for 4 will be different as it is not a browser based management.

  • Open your BlackBerry Administration Service page and log in.
  • Navigate to the Devices > Wireless activations > Device activation settings
    BlackBerry Device Activation Settings
  • You will notice at the top of this page there is a Email initialization message section with the Sender address by default as: admin@yourcompanydomain.com. Select the Edit activation settings button to change this
  • Change the Sender address field to an actual email of your company and then select Save all
    BlackBerry Email Initialization Message Settings

Once you have changed this all of your outgoing PIN messages will have the new email address as the sender name.

Switch to our mobile site