<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/rss2full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:sy="http://purl.org/rss/1.0/modules/syndication/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" version="2.0">

<channel>
	<title>Brett's Software Development Blog</title>
	
	<link>http://brett.batie.com</link>
	<description>Thoughts of a Software Engineer.</description>
	<lastBuildDate>Fri, 03 Sep 2010 14:38:28 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/rss+xml" href="http://feeds.feedburner.com/brettbatie" /><feedburner:info uri="brettbatie" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com/" /><feedburner:emailServiceId>brettbatie</feedburner:emailServiceId><feedburner:feedburnerHostname>http://feedburner.google.com</feedburner:feedburnerHostname><feedburner:feedFlare href="http://add.my.yahoo.com/rss?url=http%3A%2F%2Ffeeds.feedburner.com%2Fbrettbatie" src="http://us.i1.yimg.com/us.yimg.com/i/us/my/addtomyyahoo4.gif">Subscribe with My Yahoo!</feedburner:feedFlare><feedburner:feedFlare href="http://www.newsgator.com/ngs/subscriber/subext.aspx?url=http%3A%2F%2Ffeeds.feedburner.com%2Fbrettbatie" src="http://www.newsgator.com/images/ngsub1.gif">Subscribe with NewsGator</feedburner:feedFlare><feedburner:feedFlare href="http://feeds.my.aol.com/add.jsp?url=http%3A%2F%2Ffeeds.feedburner.com%2Fbrettbatie" src="http://o.aolcdn.com/favorites.my.aol.com/webmaster/ffclient/webroot/locale/en-US/images/myAOLButtonSmall.gif">Subscribe with My AOL</feedburner:feedFlare><feedburner:feedFlare href="http://www.bloglines.com/sub/http://feeds.feedburner.com/brettbatie" src="http://www.bloglines.com/images/sub_modern11.gif">Subscribe with Bloglines</feedburner:feedFlare><feedburner:feedFlare href="http://www.netvibes.com/subscribe.php?url=http%3A%2F%2Ffeeds.feedburner.com%2Fbrettbatie" src="http://www.netvibes.com/img/add2netvibes.gif">Subscribe with Netvibes</feedburner:feedFlare><feedburner:feedFlare href="http://fusion.google.com/add?feedurl=http%3A%2F%2Ffeeds.feedburner.com%2Fbrettbatie" src="http://buttons.googlesyndication.com/fusion/add.gif">Subscribe with Google</feedburner:feedFlare><feedburner:feedFlare href="http://www.pageflakes.com/subscribe.aspx?url=http%3A%2F%2Ffeeds.feedburner.com%2Fbrettbatie" src="http://www.pageflakes.com/ImageFile.ashx?instanceId=Static_4&amp;fileName=ATP_blu_91x17.gif">Subscribe with Pageflakes</feedburner:feedFlare><feedburner:feedFlare href="http://www.plusmo.com/add?url=http%3A%2F%2Ffeeds.feedburner.com%2Fbrettbatie" src="http://plusmo.com/res/graphics/fbplusmo.gif">Subscribe with Plusmo</feedburner:feedFlare><feedburner:feedFlare href="http://www.thefreedictionary.com/_/hp/AddRSS.aspx?http%3A%2F%2Ffeeds.feedburner.com%2Fbrettbatie" src="http://img.tfd.com/hp/addToTheFreeDictionary.gif">Subscribe with The Free Dictionary</feedburner:feedFlare><feedburner:feedFlare href="http://www.bitty.com/manual/?contenttype=rssfeed&amp;contentvalue=http%3A%2F%2Ffeeds.feedburner.com%2Fbrettbatie" src="http://www.bitty.com/img/bittychicklet_91x17.gif">Subscribe with Bitty Browser</feedburner:feedFlare><feedburner:feedFlare href="http://www.newsalloy.com/?rss=http%3A%2F%2Ffeeds.feedburner.com%2Fbrettbatie" src="http://www.newsalloy.com/subrss3.gif">Subscribe with NewsAlloy</feedburner:feedFlare><feedburner:feedFlare href="http://www.live.com/?add=http%3A%2F%2Ffeeds.feedburner.com%2Fbrettbatie" src="http://tkfiles.storage.msn.com/x1piYkpqHC_35nIp1gLE68-wvzLZO8iXl_JMledmJQXP-XTBOLfmQv4zhj4MhcWEJh_GtoBIiAl1Mjh-ndp9k47If7hTaFno0mxW9_i3p_5qQw">Subscribe with Live.com</feedburner:feedFlare><feedburner:feedFlare href="http://mix.excite.eu/add?feedurl=http%3A%2F%2Ffeeds.feedburner.com%2Fbrettbatie" src="http://image.excite.co.uk/mix/addtomix.gif">Subscribe with Excite MIX</feedburner:feedFlare><feedburner:feedFlare href="http://www.yourminis.com/subscribe.aspx?u=http%3A%2F%2Ffeeds.feedburner.com%2Fbrettbatie" src="http://www.yourminis.com/images/addtoyourminisbadge.gif">Subscribe with Yourminis.com</feedburner:feedFlare><feedburner:feedFlare href="http://download.attensa.com/app/get_attensa.html?feedurl=http%3A%2F%2Ffeeds.feedburner.com%2Fbrettbatie" src="http://www.attensa.com/blogs/attensa/WindowsLiveWriter/BadgeredintoBadges_10C02/attensa_feed_button5.gif">Subscribe with Attensa for Outlook</feedburner:feedFlare><feedburner:feedFlare href="http://www.webwag.com/wwgthis.php?url=http%3A%2F%2Ffeeds.feedburner.com%2Fbrettbatie" src="http://www.webwag.com/images/wwgthis.gif">Subscribe with Webwag</feedburner:feedFlare><feedburner:feedFlare href="http://hub.netomat.net/account/account.autoSubscribe.jspa?urls=http%3A%2F%2Ffeeds.feedburner.com%2Fbrettbatie" src="http://www.netomat.net/blogger/images/icon_netomat_feedbutton.gif">Subscribe with netomat Hub</feedburner:feedFlare><feedburner:feedFlare href="http://www.podcastready.com/oneclick_bookmark.php?url=http%3A%2F%2Ffeeds.feedburner.com%2Fbrettbatie" src="http://www.podcastready.com/images/podcastready_button.gif">Subscribe with Podcast Ready</feedburner:feedFlare><feedburner:feedFlare href="http://www.flurry.com/pushRssFeed.do?r=fb&amp;url=http%3A%2F%2Ffeeds.feedburner.com%2Fbrettbatie" src="http://www.flurry.com/images/flurry_rss_logo2.gif">Subscribe with Flurry</feedburner:feedFlare><feedburner:feedFlare href="http://www.wikio.com/subscribe?url=http%3A%2F%2Ffeeds.feedburner.com%2Fbrettbatie" src="http://www.wikio.com/shared/img/add2wikio.gif">Subscribe with Wikio</feedburner:feedFlare><feedburner:feedFlare href="http://www.dailyrotation.com/index.php?feed=http%3A%2F%2Ffeeds.feedburner.com%2Fbrettbatie" src="http://www.dailyrotation.com/rss-dr2.gif">Subscribe with Daily Rotation</feedburner:feedFlare><item>
		<title>Java Live Messenger (MSN) Robot</title>
		<link>http://feedproxy.google.com/~r/brettbatie/~3/3gyul-kYru8/</link>
		<comments>http://brett.batie.com/software-development/java-live-messenger-msn-robot/#comments</comments>
		<pubDate>Thu, 02 Sep 2010 14:34:00 +0000</pubDate>
		<dc:creator>Brett</dc:creator>
				<category><![CDATA[Software Development]]></category>

		<guid isPermaLink="false">http://brett.batie.com/software-development/java-live-messenger-msn-robot/</guid>
		<description><![CDATA[I recently had a project to setup an Instant Messenger Robot for Windows Live Messenger. A IM robot can have many purposes such as:

Keeping track of when contacts are online/offline and when they were last seen. 
Broadcasting a message to all contacts. 
Automatically answering common questions. 
Notifying contacts about new events. A newer site http://notify.me [...]]]></description>
			<content:encoded><![CDATA[<p>I recently had a project to setup an Instant Messenger Robot for Windows Live Messenger. A IM robot can have many purposes such as:</p>
<ul>
<li>Keeping track of when contacts are online/offline and when they were last seen. </li>
<li>Broadcasting a message to all contacts. </li>
<li>Automatically answering common questions. </li>
<li>Notifying contacts about new events. A newer site http://notify.me has a nice IM Robot that notifies you when a RSS feed is updated. This works well in conjuction with sites like craigslist. </li>
<li>Keeping track of code snippets </li>
<li>Checking the weather </li>
<li>Checking server status </li>
</ul>
<p>An IM robot can be setup to automate just about any task. </p>
<h4>What IM Library to Use</h4>
<p>Setting up a IM robot can be a bit of work especially if starting from scratch. There are a lot of libraries out there that can be used to help simplify the process. The trouble is a lot of libraries are not kept up to date and fail to work as IM protocols change. </p>
<p>I did some digging and found a library that would provide a good foundation to build a IM Robot that can do just about anything. I saw implementations in PHP, C, Java, Perl and Python. After some testing I concluded the <a href="http://sourceforge.net/apps/trac/java-jml">Java MSN Library</a> would be a very good fit.</p>
<h4>How To Use It</h4>
<p>Using this library with java is pretty straight forward. First, the library must be added to the classpath. The step to take to complete this will depend on how your developing your java code. The most basic method to add a library to your classpath is to do this at run time with a command such as:</p>
<pre class="brush: java;">java -classpath MyLibrary.jar MyPackage.MyClass</pre>
<p>A better approach would be to setup the classpath in a <a title="Manifest File" href="http://download.oracle.com/javase/tutorial/deployment/jar/manifestindex.html">manifest file</a>. The manifest file is then placed inside the jar file and tells the executable jar where to look for the libraries. This manifest file should look something like the following (note the class-path on line 5):</p>
<pre class="brush: java;">Manifest-Version: 1.0
Ant-Version: Apache Ant 1.7.1
Created-By: 14.3-b01 (Sun Microsystems Inc.)
Main-Class: imstatus.Main
Class-Path: lib/jml-1.0b4-full.jar lib/httpcore-4.0.1.jar lib/mysql-co
 nnector-java-5.1.6-bin.jar
X-COMMENT: Main-Class will be added automatically by build</pre>
<p>This is setup so that the 3 required libraries are in the lib folder. These 3 libraries are needed for setting up an IM robot and can be downloaded from the following locations:</p>
<ul>
<li><a href="http://sourceforge.net/projects/java-jml/files/java-jml/jml-1.0b4/jml-1.0b4-full.jar/download">jml-1.0b4-full.jar</a> </li>
<li><a href="http://apache.imghat.com//httpcomponents/httpclient/binary/httpcomponents-client-4.0.1-bin.zip">httpcore-4.0.1.jar</a> </li>
<li><a href="http://dev.mysql.com/downloads/connector/j/">mysql-connector-java-5.1.6-bin.jar</a></li>
</ul>
<p>Now that the libraries are setup we can begin to use them.</p>
<h4>Developing the IM Robot Code</h4>
<p>There are a few examples of using the Java MSN Library on the <a href="http://sourceforge.net/apps/trac/java-jml">main page</a>. However, they are a tad confusing as it creates a new BasicMessenger class. This is confusing as the library already has a BasicMessenger class which is abstract. The library also has a SimpleMessenger class which is a subclass of BasicMessenger. This class appears to be the correct implementation that we would want to use to create a new IM Robot. However, the original authors made the constructor protected so that we cannot instantiate the class outside of the original package. Since we want a simple way to create an IM Robot I have modified the original source code to have a public constructor for the SimpleMessenger class. This new package can be downloaded from <a href="http://softwareprojects.com/files/jml-1.0b4-full.jar">our server</a>.</p>
<p>With this new package we can very easily create a new IM Robot with the following two lines of code (make sure to replace yourLogin and yourPassword):</p>
<pre class="brush: java;">SimpleMessenger messenger = new SimpleMessenger(Email.parseStr(&quot;yourLogin@msn.com&quot;), &quot;yourPassword&quot;);
messenger.login();</pre>
<p>With that code in our main funtion we can run it and test that the Robot automatically logs into Windows Live Messenger.</p>
<p>Of course, that code just logs the Robot into Windows Live Messenger. The next step is to setup the robot to do something interesting. This is one feature that is very nice about the Java MSN Library as it has listeners for many different events. For example we can detect when the robot has finished logging in with the following:</p>
<pre class="brush: java;">messenger.addListener(new MsnAdapter() {
	// Setup the login completed event

	@Override
	public void loginCompleted(MsnMessenger messenger) {
		MsnOwner owner = messenger.getOwner();
		owner.setInitStatus(MsnUserStatus.ONLINE);
		owner.setStatus(MsnUserStatus.ONLINE);

		// Setup the contact list event
		messenger.addContactListListener(new ContactListAdapter());
	}
});</pre>
<p>Then we can take this a step further and detect when a status changes for one of the robots contacts with something like the following:</p>
<pre class="brush: java;">messenger.addListener(new MsnAdapter() {
	// Setup the login completed event

	@Override
	public void loginCompleted(MsnMessenger messenger) {
		MsnOwner owner = messenger.getOwner();
		owner.setInitStatus(MsnUserStatus.ONLINE);
		owner.setStatus(MsnUserStatus.ONLINE);

		// Setup the contact list event
		messenger.addContactListListener(new ContactListAdapter());
	}
});</pre>
<p>The above code will detect when the robot has finished logging in and then setup a new listener to detect when a contacts status has changed. The new listener invokes the ContactListAdapter class when a status has changed. This contactListAdapter class is setup as followes:</p>
<pre class="brush: java;">class ContactListAdapter extends MsnContactListAdapter {
	@Override
	public void contactStatusChanged(MsnMessenger messenger, MsnContact contact) {
		System.out.println(contact.getEmail()+&quot; is currently &quot;+contact.getStatus());
		// Can add code here to store the status in a database
	}
}</pre>
<p>We can still take this a step further and setup the robot to handle automatically adding contacts when a contact requests it. This logic can be added to the ContactListAdapter class with something like the following:</p>
<pre class="brush: java;">class ContactListAdapter extends MsnContactListAdapter {
	@Override
	public void contactListSyncCompleted(MsnMessenger messenger) {
			MsnContact[] contacts = messenger.getContactList().getContactsInList(MsnList.AL);
			for (int i = 0; i &lt; contacts.length; i++) {
				contactStatusChanged(messenger,contacts[i]);
			}
	}

	@Override
	public void contactAddedMe(MsnMessenger messenger, MsnContact contact) {
		messenger.addFriend(contact.getEmail(), contact.getDisplayName());
	}

	@Override
	public void contactAddedMe(MsnMessenger messenger, MsnContactPending[] pending){
		for(int i=0; i&lt;pending.length; i++){
			messenger.addFriend(pending[i].getEmail(), pending[i].getDisplayName());
		}
	}

	@Override
	public void contactStatusChanged(MsnMessenger messenger, MsnContact contact) {
		System.out.println(contact.getEmail()+&quot; is currently &quot;+contact.getStatus());
		// Can add code here to store the status in a database
	}
}</pre>
<p>There you have it! Put all of the above code together and you will have a robot that knows how to automatically add contacts and keep track of when a contact&#8217;s status changes.</p>
<p>This article was <a href="http://www.softwareprojects.com/resources/programming/t-msn-messenger-integration-java-robot-script-1994.html">cross-posted from Software Projects</a></p>

<p><a href="http://feedads.g.doubleclick.net/~a/L-wPvTysj5Rg59ZDwAnRqd2hByM/0/da"><img src="http://feedads.g.doubleclick.net/~a/L-wPvTysj5Rg59ZDwAnRqd2hByM/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/L-wPvTysj5Rg59ZDwAnRqd2hByM/1/da"><img src="http://feedads.g.doubleclick.net/~a/L-wPvTysj5Rg59ZDwAnRqd2hByM/1/di" border="0" ismap="true"></img></a></p><img src="http://feeds.feedburner.com/~r/brettbatie/~4/3gyul-kYru8" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://brett.batie.com/software-development/java-live-messenger-msn-robot/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://brett.batie.com/software-development/java-live-messenger-msn-robot/</feedburner:origLink></item>
		<item>
		<title>UltraMon Breaks After Remote Desktop Connection (RDP)</title>
		<link>http://feedproxy.google.com/~r/brettbatie/~3/NrbmP8xlkcs/</link>
		<comments>http://brett.batie.com/software-development/ultramon-breaks-after-remote-desktop-connection-rdp/#comments</comments>
		<pubDate>Tue, 06 Apr 2010 19:42:00 +0000</pubDate>
		<dc:creator>Brett</dc:creator>
				<category><![CDATA[Software Development]]></category>

		<guid isPermaLink="false">http://brett.batie.com/software-development/ultramon-breaks-after-remote-desktop-connection-rdp/</guid>
		<description><![CDATA[I use the application UltraMon to help manage my multiple monitor setup. Overall this application is awesome as it makes moving applications between monitors a breeze and supports a separate task bar on each monitor, among other things.
However, I have had this issue for a while where UltraMon will not move applications between monitors after [...]]]></description>
			<content:encoded><![CDATA[<p>I use the application <a href="http://www.realtimesoft.com/ultramon/">UltraMon</a> to help manage my multiple monitor setup. Overall this application is awesome as it makes moving applications between monitors a breeze and supports a separate task bar on each monitor, among other things.</p>
<p>However, I have had this issue for a while where UltraMon will not move applications between monitors after a Remote Desktop Connection has been established, instead UltraMon acts as if there is only one monitor.</p>
<p>In the past the only solution I had for this issue was to restart my computer. This is not an ideal solution for me as I&#8217;m often multi-tasking and running many applications at the same time. </p>
<p>In order to reboot I have to close down each application, save my work, reboot, and then start up every application again after the reboot. This is not a major amount of time but it does add up if I have to do it on a regular basis. Plus, I am one who likes to optimize everything to achieve as much efficiency as humanly possible in a given day.</p>
<p>So, I spent a few minutes and fiddled with UltraMon and found a way to fix this RDP flaw without requiring a reboot. The steps are as follows:</p>
<ol>
<li>Close UltraMon<a href="http://brett.batie.com/wp-content/uploads/UltramonBreaksAfterRemoteDesktopConnecti_ACA5/sshot201004055.png"  rel="lightbox" rel="lightbox[roadtrip]"><img style="border-bottom: 0px; border-left: 0px; display: inline; margin-left: 0px; border-top: 0px; margin-right: 0px; border-right: 0px" title="sshot-2010-04-05-[5]" border="0" alt="sshot-2010-04-05-[5]" align="right" src="http://brett.batie.com/wp-content/uploads/UltramonBreaksAfterRemoteDesktopConnecti_ACA5/sshot201004055_thumb.png" width="121" height="130" /></a> </li>
<li>Right click on your desktop and select <strong>Screen Resolution</strong></li>
<li>Disable the monitor that the application cannot be moved to and click apply (screenshot on right). Repeat for all monitors that are suffering from this issue.</li>
<li>Start UltraMon</li>
<li>Enable all monitors that were disabled in step 3.</li>
</ol>
<p>After completing the above steps UltraMon will be as good as new. </p>
<p>I have only tested this on Windows 7 so let me know if this works on other Windows versions as well. </p>
<p>Anyone up for automating the above steps? If I get a break I might try and tackle it.</p>

<p><a href="http://feedads.g.doubleclick.net/~a/PhqhI2VuNIZS6LjQbnFPUOxOn-o/0/da"><img src="http://feedads.g.doubleclick.net/~a/PhqhI2VuNIZS6LjQbnFPUOxOn-o/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/PhqhI2VuNIZS6LjQbnFPUOxOn-o/1/da"><img src="http://feedads.g.doubleclick.net/~a/PhqhI2VuNIZS6LjQbnFPUOxOn-o/1/di" border="0" ismap="true"></img></a></p><img src="http://feeds.feedburner.com/~r/brettbatie/~4/NrbmP8xlkcs" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://brett.batie.com/software-development/ultramon-breaks-after-remote-desktop-connection-rdp/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://brett.batie.com/software-development/ultramon-breaks-after-remote-desktop-connection-rdp/</feedburner:origLink></item>
		<item>
		<title>How to Setup BlackBerry (bb) with a Different Ringtone for each Email / Contact</title>
		<link>http://feedproxy.google.com/~r/brettbatie/~3/ITy1sc3rU0Q/</link>
		<comments>http://brett.batie.com/technology/how-to-setup-blackberry-bb-with-a-different-ringtone-for-each-email-contact/#comments</comments>
		<pubDate>Sat, 03 Apr 2010 01:48:00 +0000</pubDate>
		<dc:creator>Brett</dc:creator>
				<category><![CDATA[Technology]]></category>

		<guid isPermaLink="false">http://brett.batie.com/technology/how-to-setup-blackberry-bb-with-a-different-ringtone-for-each-email-contact/</guid>
		<description><![CDATA[The BlackBerry has the ability to setup ringtones for each application and also use different ringtones for each contact / email. These features are great for giving full control over notifications for email, phone call, SMS, MMS, IM, etc. With this article I will explain how to setup both application level notifications, contact/email level notifications [...]]]></description>
			<content:encoded><![CDATA[<p>The BlackBerry has the ability to setup ringtones for each application and also use different ringtones for each contact / email. These features are great for giving full control over notifications for email, phone call, SMS, MMS, IM, etc. With this article I will explain how to setup both application level notifications, contact/email level notifications and then how to setup profile switching at a given time of day.</p>
<h4>Application Level Notifications</h4>
<p>In order to setup the sounds that an application uses to notify of new events just go to <strong>Profiles</strong> on your BlackBerry. Scroll down to the bottom of this list and click <a href="http://brett.batie.com/wp-content/uploads/HowtoSetupBlackberrybbwithDifferentRingt_985C/Capture12_35_25.jpg"  rel="lightbox" rel="lightbox[roadtrip]"><img style="border-right-width: 0px; margin: 10px 0px 5px 5px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="Capture12_35_25" border="0" alt="Capture12_35_25" align="right" src="http://brett.batie.com/wp-content/uploads/HowtoSetupBlackberrybbwithDifferentRingt_985C/Capture12_35_25_thumb.jpg" width="177" height="134" /></a><strong>Advanced</strong>. Now you will see a list of your profiles (screenshot on right). Scroll to the profile you would like to edit and click the <strong>BlackBerry button, </strong>located on the left of the trackball. A list of all of the installed applications is shown including the different email accounts. <strong>Select a specific application</strong> or email account, click the <strong>BlackBerry button </strong>and <strong>select edit</strong>. This will pull up a page that gives different options for how the application is allowed to notify when new events occur, this can be seen in the screenshot below. Modify these settings to have your preferred ringtones, vibrations, LED flashing, etc. Then repeat these steps for other applications and other profiles.</p>
<p><a href="http://brett.batie.com/wp-content/uploads/HowtoSetupBlackberrybbwithDifferentRingt_985C/Capture12_38_54.jpg"  rel="lightbox" rel="lightbox[roadtrip]"><img style="border-right-width: 0px; display: block; float: none; border-top-width: 0px; border-bottom-width: 0px; margin-left: auto; border-left-width: 0px; margin-right: auto" title="Capture12_38_54" border="0" alt="Capture12_38_54" src="http://brett.batie.com/wp-content/uploads/HowtoSetupBlackberrybbwithDifferentRingt_985C/Capture12_38_54_thumb.jpg" width="177" height="134" /></a></p>
<h4>Contact / Email Level Notifications</h4>
</p>
</p>
</p>
<p>There are a few different ways to setup notifications for contacts and emails. I have found the easiest option is to use <strong>exceptions</strong>. </p>
<p>Exceptions allow a custom ring tone to be used for a specific contact or a group of contacts. The exception will work with all profiles except the <strong>Off</strong> profile. The exception can also be muted by the currently selected profile if that is desired. </p>
<p>Using exceptions works perfect for the scenario where someone should always be able to reach you like the wife/husband or boss (which could be the same person). This also works well for specific people (or email addresses) that should be able to reach you while using a specific profile. This might be something like work related emails that are important during business hours but not in the middle of the night.</p>
<p>The following steps can be used to setup an exception: </p>
<ol>
<li>Go to <strong>Profiles</strong> and select <strong>Advanced</strong> </li>
<li>Click the <strong>BlackBerry button </strong>(left of the scroll wheel) and select <strong>New Exception</strong>. </li>
<li>Type in a name for the exception (maybe something like &quot;Urgent&quot;) </li>
<li>In the <strong>From:</strong> field click the scroll wheel and select a contact. Repeat this step to add more than one contact to the exception. </li>
<li>In the <strong>Use Profile:</strong> field select the desired profile that this contact or group of contacts will always use. For the contacts that should always be able to reach you the <strong>Loud</strong> profile is a good option. For contacts that should only be able to reach you while using a specific profile select <strong>Active Profile</strong>. With this option if the active profile is one where the application is muted the ringtone will not play. If the profile is one where the application is not muted the ringtone will play. </li>
<li>Select the custom phone tune. </li>
<li>Click the <strong>BlackBerry button</strong> and select <strong>save</strong> </li>
</ol>
<p>There is also another option that will give control over emails by setting up specific email addresses as <strong>level 1</strong> emails. Each profile has a specific ringtone,vibration and LED flashing for Level 1 emails.</p>
<p>Emails can be set as level one by applying filters at the following site:</p>
<p><a title="https://bis.na.blackberry.com/html" href="https://bis.na.blackberry.com/html">https://bis.na.blackberry.com/html</a></p>
<p>It is unfortunate that this is not a little more integrated into the blackberry but as long as you know your login/password you can do the following:</p>
<ol>
<li>Login and select the Filter Option on the right hand side of the screen for a specific email address.</li>
<li>Click <strong>Add a Filter</strong></li>
<li>Give the filter a name</li>
<li>Select when to <strong>apply the filter</strong>. This can be based on the From email address, subject, to email address, CC email address, new mail or high priority mail.</li>
<li>Fill in <strong>Contains</strong> value that applies to the filter option selected in step 4.</li>
<li>Select<strong> filter messages to device </strong>check <strong>Level 1 notification </strong>and click <strong>Add Filter</strong></li>
</ol>
<p>Now when an email message comes that meets the requirement of the newly added filter the <strong>Level 1 </strong>notification settings will be used.</p>
<p><strong></strong></p>
<h4>Automatic Profile Switching</h4>
<p>By default there is not currently a way to automatically switch profiles at a specific time of the day. Having a feature like this is very beneficial if there is any regularity to your schedule (like meetings, classes, sleeping, etc).&#160; </p>
<p><a href="http://brett.batie.com/wp-content/uploads/HowtoSetupBlackberrybbwithDifferentRingt_985C/25780.png"  rel="lightbox" rel="lightbox[roadtrip]"><img style="border-bottom: 0px; border-left: 0px; margin: 0px 0px 0px 5px; display: inline; border-top: 0px; border-right: 0px" title="25780" border="0" alt="25780" align="right" src="http://brett.batie.com/wp-content/uploads/HowtoSetupBlackberrybbwithDifferentRingt_985C/25780_thumb.png" width="177" height="134" /></a>Even though a scheduled profile option is not built into the BlackBerry by default there is a third party app that does give us this feature. The app is called <strong><a title="ProfilerPRO" href="http://appworld.blackberry.com/webstore/content/4048">ProfilerPro</a> </strong>(cost $3.99). I just installed this on my blackberry for the first time but it appears to work perfectly for profile switching.</p>
<p>&#160;</p>
<p>Hopefully all of the steps above will help gain control over the mass amount of media that is thrown at us every day. Are there any other tips or tricks that you use to keep your blackberry optimized?</p>

<p><a href="http://feedads.g.doubleclick.net/~a/E-1AbwnDuHo_zDlrZQdUF4TqI9A/0/da"><img src="http://feedads.g.doubleclick.net/~a/E-1AbwnDuHo_zDlrZQdUF4TqI9A/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/E-1AbwnDuHo_zDlrZQdUF4TqI9A/1/da"><img src="http://feedads.g.doubleclick.net/~a/E-1AbwnDuHo_zDlrZQdUF4TqI9A/1/di" border="0" ismap="true"></img></a></p><img src="http://feeds.feedburner.com/~r/brettbatie/~4/ITy1sc3rU0Q" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://brett.batie.com/technology/how-to-setup-blackberry-bb-with-a-different-ringtone-for-each-email-contact/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://brett.batie.com/technology/how-to-setup-blackberry-bb-with-a-different-ringtone-for-each-email-contact/</feedburner:origLink></item>
		<item>
		<title>Putty with Tango Look &amp; Feel (using regedit script)</title>
		<link>http://feedproxy.google.com/~r/brettbatie/~3/WC7OBRC7-_0/</link>
		<comments>http://brett.batie.com/dosshell/putty-with-tango-look-feel-using-regedit-script/#comments</comments>
		<pubDate>Tue, 23 Mar 2010 23:20:16 +0000</pubDate>
		<dc:creator>Brett</dc:creator>
				<category><![CDATA[DOS/Shell]]></category>

		<guid isPermaLink="false">http://brett.batie.com/dosshell/putty-with-tango-look-feel-using-regedit-script/</guid>
		<description><![CDATA[I ran into a powershell script that Tomas Restrepo created to set putty up with a better color scheme. The color theme he used was based on Tango.
This inspired me to make a few updates to my default configuration for putty. I used the powershell script to update my color theme and then updated the [...]]]></description>
			<content:encoded><![CDATA[<p>I ran into a <a href="http://brett.batie.com/dosshell/intro-to-windows-power-shell/">powershell</a> script that <a href="http://winterdom.com/me">Tomas Restrepo</a> created to set putty up with a better color scheme. The color theme he used was based on <a href="http://tango.freedesktop.org/Tango_Icon_Theme_Guidelines">Tango</a>.</p>
<p>This inspired me to make a few updates to my default configuration for putty. I used the powershell script to update my color theme and then updated the configuration so that my home and end keys would work correctly (I&#8217;ve been putting up with that one for too long).</p>
<p>If anyone would like to use the same settings as me they can just download the following registry file and double click. </p>
<a href=http://brett.batie.com/download/myPutty.reg><img src=http://brett.batie.com/wp-content/plugins/download-monitor/img/downloads-icon.gif style="vertical-align: middle;">DOWNLOAD: Registry Script to Update Putty Configuration</a>
<p>The source code for the above file is the following:</p>
<pre class="brush: text;">Windows Registry Editor Version 5.00

[HKEY_CURRENT_USER\Software\SimonTatham\PuTTY\Sessions\Default%20Settings]
&quot;Present&quot;=dword:00000001
&quot;HostName&quot;=&quot;&quot;
&quot;LogFileName&quot;=&quot;putty.log&quot;
&quot;LogType&quot;=dword:00000000
&quot;LogFileClash&quot;=dword:ffffffff
&quot;LogFlush&quot;=dword:00000001
&quot;SSHLogOmitPasswords&quot;=dword:00000001
&quot;SSHLogOmitData&quot;=dword:00000000
&quot;Protocol&quot;=&quot;ssh&quot;
&quot;PortNumber&quot;=dword:00000016
&quot;CloseOnExit&quot;=dword:00000001
&quot;WarnOnClose&quot;=dword:00000001
&quot;PingInterval&quot;=dword:00000000
&quot;PingIntervalSecs&quot;=dword:0000000f
&quot;TCPNoDelay&quot;=dword:00000001
&quot;TCPKeepalives&quot;=dword:00000000
&quot;TerminalType&quot;=&quot;linux&quot;
&quot;TerminalSpeed&quot;=&quot;38400,38400&quot;
&quot;TerminalModes&quot;=&quot;INTR=A,QUIT=A,ERASE=A,KILL=A,EOF=A,EOL=A,EOL2=A,START=A,STOP=A,SUSP=A,DSUSP=A,REPRINT=A,WERASE=A,LNEXT=A,FLUSH=A,SWTCH=A,STATUS=A,DISCARD=A,IGNPAR=A,PARMRK=A,INPCK=A,ISTRIP=A,INLCR=A,IGNCR=A,ICRNL=A,IUCLC=A,IXON=A,IXANY=A,IXOFF=A,IMAXBEL=A,ISIG=A,ICANON=A,XCASE=A,ECHO=A,ECHOE=A,ECHOK=A,ECHONL=A,NOFLSH=A,TOSTOP=A,IEXTEN=A,ECHOCTL=A,ECHOKE=A,PENDIN=A,OPOST=A,OLCUC=A,ONLCR=A,OCRNL=A,ONOCR=A,ONLRET=A,CS7=A,CS8=A,PARENB=A,PARODD=A,&quot;
&quot;AddressFamily&quot;=dword:00000000
&quot;ProxyExcludeList&quot;=&quot;&quot;
&quot;ProxyDNS&quot;=dword:00000001
&quot;ProxyLocalhost&quot;=dword:00000000
&quot;ProxyMethod&quot;=dword:00000000
&quot;ProxyHost&quot;=&quot;proxy&quot;
&quot;ProxyPort&quot;=dword:00000050
&quot;ProxyUsername&quot;=&quot;&quot;
&quot;ProxyPassword&quot;=&quot;&quot;
&quot;ProxyTelnetCommand&quot;=&quot;connect %host %port\\n&quot;
&quot;Environment&quot;=&quot;&quot;
&quot;UserName&quot;=&quot;&quot;
&quot;LocalUserName&quot;=&quot;&quot;
&quot;NoPTY&quot;=dword:00000000
&quot;Compression&quot;=dword:00000000
&quot;TryAgent&quot;=dword:00000001
&quot;AgentFwd&quot;=dword:00000000
&quot;ChangeUsername&quot;=dword:00000000
&quot;Cipher&quot;=&quot;aes,blowfish,3des,WARN,arcfour,des&quot;
&quot;KEX&quot;=&quot;dh-gex-sha1,dh-group14-sha1,dh-group1-sha1,WARN&quot;
&quot;RekeyTime&quot;=dword:0000003c
&quot;RekeyBytes&quot;=&quot;1G&quot;
&quot;SshNoAuth&quot;=dword:00000000
&quot;AuthTIS&quot;=dword:00000000
&quot;AuthKI&quot;=dword:00000001
&quot;SshNoShell&quot;=dword:00000000
&quot;SshProt&quot;=dword:00000002
&quot;SSH2DES&quot;=dword:00000000
&quot;PublicKeyFile&quot;=&quot;&quot;
&quot;RemoteCommand&quot;=&quot;&quot;
&quot;RFCEnviron&quot;=dword:00000000
&quot;PassiveTelnet&quot;=dword:00000000
&quot;BackspaceIsDelete&quot;=dword:00000001
&quot;RXVTHomeEnd&quot;=dword:00000000
&quot;LinuxFunctionKeys&quot;=dword:00000000
&quot;NoApplicationKeys&quot;=dword:00000000
&quot;NoApplicationCursors&quot;=dword:00000000
&quot;NoMouseReporting&quot;=dword:00000000
&quot;NoRemoteResize&quot;=dword:00000000
&quot;NoAltScreen&quot;=dword:00000000
&quot;NoRemoteWinTitle&quot;=dword:00000000
&quot;RemoteQTitleAction&quot;=dword:00000001
&quot;NoDBackspace&quot;=dword:00000000
&quot;NoRemoteCharset&quot;=dword:00000000
&quot;ApplicationCursorKeys&quot;=dword:00000000
&quot;ApplicationKeypad&quot;=dword:00000000
&quot;NetHackKeypad&quot;=dword:00000000
&quot;AltF4&quot;=dword:00000001
&quot;AltSpace&quot;=dword:00000000
&quot;AltOnly&quot;=dword:00000000
&quot;ComposeKey&quot;=dword:00000000
&quot;CtrlAltKeys&quot;=dword:00000001
&quot;TelnetKey&quot;=dword:00000000
&quot;TelnetRet&quot;=dword:00000001
&quot;LocalEcho&quot;=dword:00000002
&quot;LocalEdit&quot;=dword:00000002
&quot;Answerback&quot;=&quot;PuTTY&quot;
&quot;AlwaysOnTop&quot;=dword:00000000
&quot;FullScreenOnAltEnter&quot;=dword:00000000
&quot;HideMousePtr&quot;=dword:00000000
&quot;SunkenEdge&quot;=dword:00000000
&quot;WindowBorder&quot;=dword:00000001
&quot;CurType&quot;=dword:00000000
&quot;BlinkCur&quot;=dword:00000000
&quot;Beep&quot;=dword:00000001
&quot;BeepInd&quot;=dword:00000000
&quot;BellWaveFile&quot;=&quot;&quot;
&quot;BellOverload&quot;=dword:00000001
&quot;BellOverloadN&quot;=dword:00000005
&quot;BellOverloadT&quot;=dword:000007d0
&quot;BellOverloadS&quot;=dword:00001388
&quot;ScrollbackLines&quot;=dword:00002328
&quot;DECOriginMode&quot;=dword:00000000
&quot;AutoWrapMode&quot;=dword:00000001
&quot;LFImpliesCR&quot;=dword:00000000
&quot;DisableArabicShaping&quot;=dword:00000000
&quot;DisableBidi&quot;=dword:00000000
&quot;WinNameAlways&quot;=dword:00000001
&quot;WinTitle&quot;=&quot;&quot;
&quot;TermWidth&quot;=dword:00000050
&quot;TermHeight&quot;=dword:00000018
&quot;Font&quot;=&quot;Courier New&quot;
&quot;FontIsBold&quot;=dword:00000000
&quot;FontCharSet&quot;=dword:00000000
&quot;FontHeight&quot;=dword:0000000a
&quot;FontQuality&quot;=dword:00000000
&quot;FontVTMode&quot;=dword:00000004
&quot;UseSystemColours&quot;=dword:00000000
&quot;TryPalette&quot;=dword:00000000
&quot;ANSIColour&quot;=dword:00000001
&quot;Xterm256Colour&quot;=dword:00000001
&quot;BoldAsColour&quot;=dword:00000001
&quot;Colour0&quot;=&quot;187,187,187&quot;
&quot;Colour1&quot;=&quot;255,255,255&quot;
&quot;Colour2&quot;=&quot;8,8,8&quot;
&quot;Colour3&quot;=&quot;85,85,85&quot;
&quot;Colour4&quot;=&quot;0,0,0&quot;
&quot;Colour5&quot;=&quot;0,255,0&quot;
&quot;Colour6&quot;=&quot;46,52,54&quot;
&quot;Colour7&quot;=&quot;85,87,83&quot;
&quot;Colour8&quot;=&quot;204,0,0&quot;
&quot;Colour9&quot;=&quot;239,41,41&quot;
&quot;Colour10&quot;=&quot;78,154,6&quot;
&quot;Colour11&quot;=&quot;138,226,52&quot;
&quot;Colour12&quot;=&quot;196,160,0&quot;
&quot;Colour13&quot;=&quot;252,233,79&quot;
&quot;Colour14&quot;=&quot;52,101,164&quot;
&quot;Colour15&quot;=&quot;114,159,207&quot;
&quot;Colour16&quot;=&quot;117,80,123&quot;
&quot;Colour17&quot;=&quot;173,127,168&quot;
&quot;Colour18&quot;=&quot;6,152,154&quot;
&quot;Colour19&quot;=&quot;52,226,226&quot;
&quot;Colour20&quot;=&quot;211,215,207&quot;
&quot;Colour21&quot;=&quot;238,238,236&quot;
&quot;RawCNP&quot;=dword:00000000
&quot;PasteRTF&quot;=dword:00000000
&quot;MouseIsXterm&quot;=dword:00000000
&quot;RectSelect&quot;=dword:00000000
&quot;MouseOverride&quot;=dword:00000001
&quot;Wordness0&quot;=&quot;0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0&quot;
&quot;Wordness32&quot;=&quot;0,1,2,1,1,1,1,1,1,1,1,1,1,2,2,2,2,2,2,2,2,2,2,2,2,2,1,1,1,1,1,1&quot;
&quot;Wordness64&quot;=&quot;1,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,1,1,1,1,2&quot;
&quot;Wordness96&quot;=&quot;1,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,1,1,1,1,1&quot;
&quot;Wordness128&quot;=&quot;1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1&quot;
&quot;Wordness160&quot;=&quot;1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1&quot;
&quot;Wordness192&quot;=&quot;2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,1,2,2,2,2,2,2,2,2&quot;
&quot;Wordness224&quot;=&quot;2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,1,2,2,2,2,2,2,2,2&quot;
&quot;LineCodePage&quot;=&quot;&quot;
&quot;CJKAmbigWide&quot;=dword:00000000
&quot;UTF8Override&quot;=dword:00000001
&quot;Printer&quot;=&quot;&quot;
&quot;CapsLockCyr&quot;=dword:00000000
&quot;ScrollBar&quot;=dword:00000001
&quot;ScrollBarFullScreen&quot;=dword:00000000
&quot;ScrollOnKey&quot;=dword:00000000
&quot;ScrollOnDisp&quot;=dword:00000001
&quot;EraseToScrollback&quot;=dword:00000001
&quot;LockSize&quot;=dword:00000000
&quot;BCE&quot;=dword:00000001
&quot;BlinkText&quot;=dword:00000000
&quot;X11Forward&quot;=dword:00000000
&quot;X11Display&quot;=&quot;&quot;
&quot;X11AuthType&quot;=dword:00000001
&quot;LocalPortAcceptAll&quot;=dword:00000000
&quot;RemotePortAcceptAll&quot;=dword:00000000
&quot;PortForwardings&quot;=&quot;&quot;
&quot;BugIgnore1&quot;=dword:00000000
&quot;BugPlainPW1&quot;=dword:00000000
&quot;BugRSA1&quot;=dword:00000000
&quot;BugHMAC2&quot;=dword:00000000
&quot;BugDeriveKey2&quot;=dword:00000000
&quot;BugRSAPad2&quot;=dword:00000000
&quot;BugPKSessID2&quot;=dword:00000000
&quot;BugRekey2&quot;=dword:00000000
&quot;StampUtmp&quot;=dword:00000001
&quot;LoginShell&quot;=dword:00000001
&quot;ScrollbarOnLeft&quot;=dword:00000000
&quot;BoldFont&quot;=&quot;&quot;
&quot;BoldFontIsBold&quot;=dword:0018f8e4
&quot;BoldFontCharSet&quot;=dword:016ef0a9
&quot;BoldFontHeight&quot;=dword:7719041d
&quot;WideFont&quot;=&quot;&quot;
&quot;WideFontIsBold&quot;=dword:0018cc20
&quot;WideFontCharSet&quot;=dword:0018f8e4
&quot;WideFontHeight&quot;=dword:0018cb1c
&quot;WideBoldFont&quot;=&quot;&quot;
&quot;WideBoldFontIsBold&quot;=dword:000003f8
&quot;WideBoldFontCharSet&quot;=dword:0018cc20
&quot;WideBoldFontHeight&quot;=dword:01000032
&quot;ShadowBold&quot;=dword:00000000
&quot;ShadowBoldOffset&quot;=dword:00000001
&quot;SerialLine&quot;=&quot;COM1&quot;
&quot;SerialSpeed&quot;=dword:00002580
&quot;SerialDataBits&quot;=dword:00000008
&quot;SerialStopHalfbits&quot;=dword:00000002
&quot;SerialParity&quot;=dword:00000000
&quot;SerialFlowControl&quot;=dword:00000001</pre>

<p><a href="http://feedads.g.doubleclick.net/~a/yc8rX-5CK-2gZlk9whufJqHqG3o/0/da"><img src="http://feedads.g.doubleclick.net/~a/yc8rX-5CK-2gZlk9whufJqHqG3o/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/yc8rX-5CK-2gZlk9whufJqHqG3o/1/da"><img src="http://feedads.g.doubleclick.net/~a/yc8rX-5CK-2gZlk9whufJqHqG3o/1/di" border="0" ismap="true"></img></a></p><img src="http://feeds.feedburner.com/~r/brettbatie/~4/WC7OBRC7-_0" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://brett.batie.com/dosshell/putty-with-tango-look-feel-using-regedit-script/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		<feedburner:origLink>http://brett.batie.com/dosshell/putty-with-tango-look-feel-using-regedit-script/</feedburner:origLink></item>
		<item>
		<title>Format Credit Card with X’s and Dashes using PHP (credit card masking)</title>
		<link>http://feedproxy.google.com/~r/brettbatie/~3/KQ53eLGGo0A/</link>
		<comments>http://brett.batie.com/software-development/post-about-format-credit-card-with-xs-and-dashes-using-php/#comments</comments>
		<pubDate>Mon, 22 Mar 2010 19:16:57 +0000</pubDate>
		<dc:creator>Brett</dc:creator>
				<category><![CDATA[Software Development]]></category>
		<category><![CDATA[credit card]]></category>
		<category><![CDATA[masking]]></category>
		<category><![CDATA[php]]></category>

		<guid isPermaLink="false">http://brett.batie.com/private/spi/to-do/post-about-format-credit-card-with-xs-and-dashes-using-php/</guid>
		<description><![CDATA[I recently had a project where I needed to accomplish the following two tasks:

Replace all but the last four digits of a credit card with X&#8217;s 
Format the credit card with dashes in the appropriate places 

There are many different approaches that can be taken to accomplish the above two tasks. The simplest approach would [...]]]></description>
			<content:encoded><![CDATA[<p>I recently had a project where I needed to accomplish the following two tasks:</p>
<ol>
<li>Replace all but the last four digits of a credit card with X&#8217;s </li>
<li>Format the credit card with dashes in the appropriate places </li>
</ol>
<p>There are many different approaches that can be taken to accomplish the above two tasks. The simplest approach would be to do something like the following:</p>
<pre class="brush: php;">&lt;?php
echo 'XXXX-XXXX-XXXX-'.substr($cc,-4);
?&gt;</pre>
<p>I have often seen credit cards masked with the above approach. For the most case this solution will work fairly well. However, I am not a huge fan of this approach as it displays the credit card at a fixed length of 16 digits. This can be a bit confusing since credit cards can very in length from 13 to 16 digits.</p>
<p>To better address this issue I put together two functions. One function is to apply a mask to a credit card and the other is to format the credit card with dashes. These functions will keep the original length of each credit card.</p>
<pre class="brush: php;">&lt;?php

/**
 * Replaces all but the last for digits with x's in the given credit card number
 * @param int|string $cc The credit card number to mask
 * @return string The masked credit card number
 */
function MaskCreditCard($cc){
	// Get the cc Length
	$cc_length = strlen($cc);

	// Replace all characters of credit card except the last four and dashes
	for($i=0; $i&lt;$cc_length-4; $i++){
		if($cc[$i] == '-'){continue;}
		$cc[$i] = 'X';
	}

	// Return the masked Credit Card #
	return $cc;
}

/**
 * Add dashes to a credit card number.
 * @param int|string $cc The credit card number to format with dashes.
 * @return string The credit card with dashes.
 */
function FormatCreditCard($cc)
{
	// Clean out extra data that might be in the cc
	$cc = str_replace(array('-',' '),'',$cc);

	// Get the CC Length
	$cc_length = strlen($cc);

	// Initialize the new credit card to contian the last four digits
	$newCreditCard = substr($cc,-4);

	// Walk backwards through the credit card number and add a dash after every fourth digit
	for($i=$cc_length-5;$i&gt;=0;$i--){
		// If on the fourth character add a dash
		if((($i+1)-$cc_length)%4 == 0){
			$newCreditCard = '-'.$newCreditCard;
		}
		// Add the current character to the new credit card
		$newCreditCard = $cc[$i].$newCreditCard;
	}

	// Return the formatted credit card number
	return $newCreditCard;
}

?&gt;</pre>
<p>Below are a couple examples of how to use these functions and the results they create.</p>
<pre class="brush: php;">&lt;?php
echo maskCreditCard('5362267121053405').'&lt;br&gt;'; // Prints XXXXXXXXXXXX3405
echo formatCreditCard('5362267121053405').'&lt;br&gt;'; // Prints 5362-2671-2105-3405
echo formatCreditCard(maskCreditCard('5362267121053405')).'&lt;br&gt;'; // Prints XXXX-XXXX-XXXX-3405
?&gt;</pre>
<pre class="brush: php;">&lt;?php
$creditCard[] = '5362267121053405'; // Mastercard
$creditCard[] = '4556189015881361'; // Visa 16
$creditCard[] = '4716904617062'; // Visa 13
$creditCard[] = '372348371455844'; // American Express
$creditCard[] = '6011757892594291'; // Discover
$creditCard[] = '30329445722959'; // Diners Club
$creditCard[] = '214927124363421'; // enRoute
$creditCard[] = '180012855304868'; // JCB 15
$creditCard[] = '3528066275370961'; // JCB 16
$creditCard[] = '8699775919'; // Voyager

for($i=0;$i&lt;count($creditCard);$i++)
{
	echo FormatCreditCard(MaskCreditCard(($creditCard[$i]))).&quot;\n&quot;;
}
?&gt;</pre>
<p>Output:</p>
<pre class="brush: shell; gutter: false">XXXX-XXXX-XXXX-3405
XXXX-XXXX-XXXX-1361
X-XXXX-XXXX-7062
XXX-XXXX-XXXX-5844
XXXX-XXXX-XXXX-4291
XX-XXXX-XXXX-2959
XXX-XXXX-XXXX-3421
XXX-XXXX-XXXX-4868
XXXX-XXXX-XXXX-0961
XX-XXXX-5919</pre>
<p>Let me know if you find these functions useful or have any suggestions on how to tweak them.</p>

<p><a href="http://feedads.g.doubleclick.net/~a/PJgBHuoRvpoFIaK8bH7W0bxcb48/0/da"><img src="http://feedads.g.doubleclick.net/~a/PJgBHuoRvpoFIaK8bH7W0bxcb48/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/PJgBHuoRvpoFIaK8bH7W0bxcb48/1/da"><img src="http://feedads.g.doubleclick.net/~a/PJgBHuoRvpoFIaK8bH7W0bxcb48/1/di" border="0" ismap="true"></img></a></p><img src="http://feeds.feedburner.com/~r/brettbatie/~4/KQ53eLGGo0A" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://brett.batie.com/software-development/post-about-format-credit-card-with-xs-and-dashes-using-php/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		<feedburner:origLink>http://brett.batie.com/software-development/post-about-format-credit-card-with-xs-and-dashes-using-php/</feedburner:origLink></item>
		<item>
		<title>Update .htaccess with Dynamic DNS IP Address to Prevent Password Protection</title>
		<link>http://feedproxy.google.com/~r/brettbatie/~3/nHuFOOkjpIs/</link>
		<comments>http://brett.batie.com/software-development/update-htaccess-with-dynamic-dns-ip-address-to-prevent-password-protection/#comments</comments>
		<pubDate>Tue, 09 Mar 2010 18:37:00 +0000</pubDate>
		<dc:creator>Brett</dc:creator>
				<category><![CDATA[Software Development]]></category>

		<guid isPermaLink="false">http://brett.batie.com/software-development/update-htaccess-with-dynamic-dns-ip-address-to-prevent-password-protection/</guid>
		<description><![CDATA[I was working on a password protected site that needed to allow one specific user access without requiring a login/password to access it. The site was already using .htaccess to password protect the entire site so the quickest solution was to use the following type of setup in the htaccess file:
Order deny,allow
Deny from all
AuthGroupFile /dev/null
AuthName [...]]]></description>
			<content:encoded><![CDATA[<p>I was working on a password protected site that needed to allow one specific user access without requiring a login/password to access it. The site was already using .htaccess to password protect the entire site so the quickest solution was to use the following type of setup in the htaccess file:</p>
<pre class="brush: shell; highlight: 8">Order deny,allow
Deny from all
AuthGroupFile /dev/null
AuthName "A Blog"
AuthType Basic
AuthUserFile /home/admin/domains/domain.com/.htpasswd/public_html/.htpasswd
require valid-user
Allow from person.getmyip.com
Satisfy Any</pre>
<p>The main addition that I added to the password protection is line 8 &#8220;Allow from&#8221;. This line allows a specific IP address or host to have access without requiring password protection.</p>
<p>However, the host that needed to be used was a <a href="dyndns.com/">Dynamic DNS</a> hostname. This creates a problem as Apache takes the following steps when the user requests access.</p>
<ol>
<li>Grab IP from user requesting access</li>
<li>Do a reverse DNS lookup</li>
<li>Compare the results to the host in the Allow from line (person.getmyip.com)</li>
</ol>
<p>In this case when a reverse DNS lookup is completed on the users IP address it will not find the <a href="dyndns.com/">Dynamic DNS</a> hostname. Instead, it will find the hostname that is associated with your ISP which might look something like this 8.sub-79-231-223.myvzw.com.</p>
<p>There are a number of ways to get around this issue. In my case I wanted to use a small script to dynamically populate the .htaccess file with the correct IP address.</p>
<p>Below is the following PHP script that handles updating .htaccess with the latest IP address. The main requirement is that there is a comment &#8220;# Allow from person.getmyip.com&#8221; somewhere in the .htaccess file. This line tells the script where to insert the IP address on the very next line.</p>
<pre class="brush: php;">&lt;?php
// Rewrites the entire htaccess file. When a line starts with '# Allow from brett.getmyip.com' the
// very next line will be replaced with the actual ip associated with brett.getmyip.com
$htaccessFile = "/home/admin/domains/batie.com/public_html/.htaccess";
$handle = fopen($htaccessFile, "r");
if ($handle) {
	$previous_line = $content = '';
	while (!feof($handle)) {
		$current_line = fgets($handle);

		if(stripos($previous_line,'# Allow from person.getmyip.com') !== FALSE)
		{
			$output = shell_exec('host person.getmyip.com');
			if(preg_match('#([0-9]{1,3}\.){3}[0-9]{1,3}#',$output,$matches))
			{
				$content .= 'Allow from '.$matches[0]."\n";
			}
		}else{
			$content .= $current_line;
		}
		$previous_line = $current_line;
	}
	fclose($handle);

	$tempFile = tempnam('/tmp','allow_');
	$fp = fopen($tempFile, 'w');
	fwrite($fp, $content);
	fclose($fp);
	rename($tempFile,$htaccessFile);
	chown($htaccessFile,'admin');
	chmod($htaccessFile,'0644');
}
?&gt;</pre>
<p>I quickly wrote this script and realize that there is room for improvement. However, this meet the need and solved the problem.</p>
<p>After the script was completed adding a simple line to the crontab (crontab -e) file got it running on a regular basis to automatically update the file with the current IP.</p>
<pre class="brush: shell;"># Script to update ip access for dynamic dns host - it allows person.getmyip.com
*/5 * * * * /usr/local/bin/php /home/admin/scripts/allow_person.php &gt;/dev/null 2&gt;&amp;1</pre>

<p><a href="http://feedads.g.doubleclick.net/~a/ueqkhNYEhsgMqc4Pj67FnbnCBmA/0/da"><img src="http://feedads.g.doubleclick.net/~a/ueqkhNYEhsgMqc4Pj67FnbnCBmA/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/ueqkhNYEhsgMqc4Pj67FnbnCBmA/1/da"><img src="http://feedads.g.doubleclick.net/~a/ueqkhNYEhsgMqc4Pj67FnbnCBmA/1/di" border="0" ismap="true"></img></a></p><img src="http://feeds.feedburner.com/~r/brettbatie/~4/nHuFOOkjpIs" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://brett.batie.com/software-development/update-htaccess-with-dynamic-dns-ip-address-to-prevent-password-protection/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://brett.batie.com/software-development/update-htaccess-with-dynamic-dns-ip-address-to-prevent-password-protection/</feedburner:origLink></item>
		<item>
		<title>Paste Code – Live Writer Plugin To Paste HTML/Code</title>
		<link>http://feedproxy.google.com/~r/brettbatie/~3/KuPIuDNEMiY/</link>
		<comments>http://brett.batie.com/software-development/live-writer-plugin-to-paste-html-code/#comments</comments>
		<pubDate>Sat, 06 Mar 2010 20:34:11 +0000</pubDate>
		<dc:creator>Brett</dc:creator>
				<category><![CDATA[Software Development]]></category>
		<category><![CDATA[Paste Code]]></category>
		<category><![CDATA[Plugin]]></category>
		<category><![CDATA[Windows Live Writer]]></category>

		<guid isPermaLink="false">http://brett.batie.com/private/cwd/live-writer-plugin-to-paste-htmlcode/</guid>
		<description><![CDATA[I recently started using Windows Live Writer and I believe it is currently the best application out there for quickly posting to a blog. However, I found one issue where I could not easily paste HTML and other code and decided to develop a plugin to address it.
If your in a hurry here is the [...]]]></description>
			<content:encoded><![CDATA[<p>I recently started using Windows Live Writer and I believe it is currently the best application out there for quickly posting to a blog. However, I found one issue where I could not easily paste HTML and other code and decided to develop a plugin to address it.</p>
<p>If your in a hurry here is the download link:</p>
<a href=http://brett.batie.com/download/InstallPasteCode.msi><img src=http://brett.batie.com/wp-content/plugins/download-monitor/img/downloads-icon.gif style="vertical-align: middle;">DOWNLOAD: Paste Code For Windows Live Writer</a>
<p><strong>The Issue</strong></p>
<p>Below is an example of some code I would like to paste into Live Writer.</p>
<pre class="brush: html;">&lt;html&gt;
&lt;head&gt;
	&lt;title&gt;Hello World&lt;/title&gt;
&lt;/head&gt;
&lt;body&gt;
	Hello World
&lt;/body&gt;
&lt;/html&gt;</pre>
<p>When I try to paste the above code in the &quot;Edit&quot; window. It appears correctly on the screen but in reality Live Writer added content to my code. When I view the source I receive the following:</p>
<pre class="brush: html;">&amp;lt;html&amp;gt;
  &lt;br /&gt;&amp;lt;head&amp;gt;

  &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; &amp;lt;title&amp;gt;Hello World&amp;lt;/title&amp;gt;

  &lt;br /&gt;&amp;lt;/head&amp;gt;

  &lt;br /&gt;&amp;lt;body&amp;gt;

  &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; Hello World

  &lt;br /&gt;&amp;lt;/body&amp;gt;

  &lt;br /&gt;&amp;lt;/html&amp;gt;</pre>
<p>This is very close to how I desire to have the code formatted. However, the major problem is it inserted a bunch of &lt;br /&gt; characters. It does make sense that it inserted these &lt;br /&gt;&#8217;s since in most cases we want line returns to have breaks but this is not the case when pasting source code. </p>
<p>Next, if I paste the code in the &quot;Source&quot; window the problem is the code is taken as actual source. This means that the code will not be seen on the screen but instead will be interpreted by the browser. If I then swap back and forth between the &quot;Edit&quot; and &quot;Source&quot; windows my code gets reformatted to be the following:</p>
<pre class="brush: html;">Hello World</pre>
<p>Which is obviously not what I wanted.</p>
<p><strong>Solution: A Plugin</strong></p>
<p>To address the issues stated above I put together a plugin that will allow pasting code in either the &quot;Edit&quot; or &quot;Source&quot; windows. It will replace special characters so that the code will be viewable and will not insert extra HTML (like &lt;br /&gt;&#8217;s).</p>
<p>Below is a screenshot of the plugin in action:</p>
<p><a href="http://brett.batie.com/wp-content/uploads/LiveWriterPluginToPasteHTML_AF6F/sshot201003063.png"  rel="lightbox" rel="lightbox[roadtrip]"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="sshot-2010-03-06-[3]" border="0" alt="sshot-2010-03-06-[3]" src="http://brett.batie.com/wp-content/uploads/LiveWriterPluginToPasteHTML_AF6F/sshot201003063_thumb.png" width="296" height="320" /></a> </p>
<p>This plugin will automatically take the code that exists on the clipboard and display it in the &quot;Code Snippet&quot; section and give the ability to edit the code before pasting it.</p>
<p>It also has the &quot;Before Code Snippet&quot; and &quot;After Code Snippet&quot; text areas. These two text areas allow defining code to wrap around your code snippet. By default the two box&#8217;s will have &lt;pre&gt; and &lt;/pre&gt;. Using either a &lt;pre&gt; or a &lt;textarea&gt; is required in order to have the formatting display correctly. If the content of &quot;Before Code Snippet&quot; and &quot;After Code Snippet&quot; is changed it will be remembered the next time the plugin is used.</p>
<p>Once insert is clicked in the plugin the code will be added to your post in Windows Live Writer and will be formatted correctly.</p>
<a href=http://brett.batie.com/download/InstallPasteCode.msi><img src=http://brett.batie.com/wp-content/plugins/download-monitor/img/downloads-icon.gif style="vertical-align: middle;">DOWNLOAD: Paste Code For Windows Live Writer</a>
<p><strong>Icing On Top</strong></p>
<p>With this plugin in place we can easily paste code and not worry about the formatting. However, it is very beneficial to have the source code displayed on your blog with syntax highlighting. I do know that there are a few plugins for Windows Live Writer that will apply syntax highlighting to code. However, I do not love this for the following reasons:</p>
<ol>
<li>Will not work when writing an article from blog&#8217;s admin page. </li>
<li>Will not easily allow changing the Syntax Highlighting to a different algorithm. There are a ton of different Syntax Highlighting plugins for blogs and every once in a while I like to upgrade to the the latest and greatest. </li>
<li>Will not work if I decide I want to move away from Windows Live Writer (that will never happen, right?). </li>
</ol>
<p>For my blog I am using the <a href="http://alexgorbatchev.com/wiki/SyntaxHighlighter">syntax highlighter developed by Alex Gorbachev</a>. There is also a nice plugin that quickly installs this <a href="http://blog.burlock.org/wordpress/88-easy-google-syntax-highlighter-for-wordpress">syntax highlighting in a wordpress blog</a>. With the paste code plugin for Windows Live Writer in combination with syntax highlighting I can quickly paste code and achieve the following results:</p>
<p><a href="http://brett.batie.com/wp-content/uploads/LiveWriterPluginToPasteHTML_AF6F/sshot201003064.png"  rel="lightbox" rel="lightbox[roadtrip]"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="sshot-2010-03-06-[4]" border="0" alt="sshot-2010-03-06-[4]" src="http://brett.batie.com/wp-content/uploads/LiveWriterPluginToPasteHTML_AF6F/sshot201003064_thumb.png" width="446" height="130" /></a></p>

<p><a href="http://feedads.g.doubleclick.net/~a/wykvV-Lo8oUWUK_OhET2iQM3CzI/0/da"><img src="http://feedads.g.doubleclick.net/~a/wykvV-Lo8oUWUK_OhET2iQM3CzI/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/wykvV-Lo8oUWUK_OhET2iQM3CzI/1/da"><img src="http://feedads.g.doubleclick.net/~a/wykvV-Lo8oUWUK_OhET2iQM3CzI/1/di" border="0" ismap="true"></img></a></p><img src="http://feeds.feedburner.com/~r/brettbatie/~4/KuPIuDNEMiY" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://brett.batie.com/software-development/live-writer-plugin-to-paste-html-code/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		<feedburner:origLink>http://brett.batie.com/software-development/live-writer-plugin-to-paste-html-code/</feedburner:origLink></item>
		<item>
		<title>How to: Watch Netflix in Chrome</title>
		<link>http://feedproxy.google.com/~r/brettbatie/~3/alsV6TL0gcE/</link>
		<comments>http://brett.batie.com/htmlcss/how-to-watch-netflix-in-chrome/#comments</comments>
		<pubDate>Fri, 13 Mar 2009 19:03:25 +0000</pubDate>
		<dc:creator>Brett</dc:creator>
				<category><![CDATA[HTML/CSS]]></category>

		<guid isPermaLink="false">http://brett.batie.com/?p=197</guid>
		<description><![CDATA[I just recently started playing with Chrome and after a bit of investigation I think I am going to make the switch from my current browser Maxthon. One problem I noticed when using Chrome was I could no longer watch instant movies in Netflix. Now, I could do what they recommend and use Internet Explorer [...]]]></description>
			<content:encoded><![CDATA[<div id="attachment_198" class="wp-caption alignright" style="width: 160px"><a href="http://brett.batie.com/wp-content/uploads/sshot-2009-03-13-4.png"  rel="lightbox[roadtrip]"><img src="http://brett.batie.com/wp-content/uploads/sshot-2009-03-13-4-150x150.png" alt="Screenshot of netflix loading in Chrome" title="Netflix in Chrome" width="150" height="150" class="size-thumbnail wp-image-198" /></a><p class="wp-caption-text">Screenshot of Netflix loading in Chrome</p></div>I just recently started playing with <a href="http://www.google.com/chrome" alt="Google Chrome">Chrome</a> and after a bit of investigation I think I am going to make the switch from my current browser <a href="http://www.maxthon.com">Maxthon</a>. One problem I noticed when using Chrome was I could no longer watch instant movies in <a href="http://www.netflix.com">Netflix</a>. Now, I could do what they recommend and use Internet Explorer (or Maxthon) to view a movie but I&#8217;m stubborn and wanted to view it in Chrome so I found a way.</p>
<p>When Netflix loads a video it is using Microsoft Silverlight which is something that Chrome supports and gave me my first clue that there is no reason why Chrome shouldn&#8217;t be able to view a Netflix video. The solution was actually rather simple, tell Netflix that I&#8217;m not actually using Chrome but using Safari on the Mac. In order to do this you just have to add the following parameter when starting Chrome.</p>
<pre class="brush:text"> --user-agent="Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_5_3; en-us) AppleWebKit/525.19 (KHTML, like Gecko) Version/3.2.1 Safari/525.19"</pre>
<p><div id="attachment_201" class="wp-caption alignright" style="width: 160px"><a href="http://brett.batie.com/wp-content/uploads/sshot-2009-03-13-2.png"  rel="lightbox[roadtrip]"><img src="http://brett.batie.com/wp-content/uploads/sshot-2009-03-13-2-150x150.png" alt="Add Parameter to Google Chrome Startup" title="Google Chrome Properties" width="150" height="150" class="size-thumbnail wp-image-201" /></a><p class="wp-caption-text">Add Parameter to Google Chrome Startup</p></div>To add this parameter right click the Google Chrome shortcut and go down to <strong>Properties</strong>. Then after chrome.exe in the <strong>Target:</strong> box paste the above text (make sure you include a space after chrome.exe).</p>
<p>I also tried changing the user agent to make Chrome appear like it is Internet Explorer. After applying that change Netflix gave me a activeX not supported error (image below). Since the problem was solved with the Safari user-agent text above I wasn&#8217;t too worried about it.</p>
<p><div id="attachment_200" class="wp-caption aligncenter" style="width: 160px"><a href="http://brett.batie.com/wp-content/uploads/sshot-2009-03-13-1.png"  rel="lightbox[roadtrip]"><img src="http://brett.batie.com/wp-content/uploads/sshot-2009-03-13-1-150x150.png" alt="ActiveX is disabled" title="ActiveX is disabled" width="150" height="150" class="size-thumbnail wp-image-200" /></a><p class="wp-caption-text">ActiveX is disabled</p></div>

<p><a href="http://feedads.g.doubleclick.net/~a/gAn0iNTIaeSg9l31qekYiACALao/0/da"><img src="http://feedads.g.doubleclick.net/~a/gAn0iNTIaeSg9l31qekYiACALao/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/gAn0iNTIaeSg9l31qekYiACALao/1/da"><img src="http://feedads.g.doubleclick.net/~a/gAn0iNTIaeSg9l31qekYiACALao/1/di" border="0" ismap="true"></img></a></p><img src="http://feeds.feedburner.com/~r/brettbatie/~4/alsV6TL0gcE" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://brett.batie.com/htmlcss/how-to-watch-netflix-in-chrome/feed/</wfw:commentRss>
		<slash:comments>29</slash:comments>
		<feedburner:origLink>http://brett.batie.com/htmlcss/how-to-watch-netflix-in-chrome/</feedburner:origLink></item>
		<item>
		<title>How to Modify a Program’s Icon</title>
		<link>http://feedproxy.google.com/~r/brettbatie/~3/YrNsCaCRm4E/</link>
		<comments>http://brett.batie.com/software-development/how-to-modify-a-programs-icon/#comments</comments>
		<pubDate>Tue, 10 Mar 2009 01:29:18 +0000</pubDate>
		<dc:creator>Brett</dc:creator>
				<category><![CDATA[Software Development]]></category>

		<guid isPermaLink="false">http://brett.batie.com/?p=179</guid>
		<description><![CDATA[It is possible to change just about any icon that comes with an application.  There are a few different applications that will help make this job easy and my favorite is resource hacker.  The reason that I can think of that someone would want to change a programs icon are the following:

Two programs have icons [...]]]></description>
			<content:encoded><![CDATA[<p>It is possible to change just about any icon that comes with an application.  There are a few different applications that will help make this job easy and my favorite is resource hacker.  The reason that I can think of that someone would want to change a programs icon are the following:</p>
<ul>
<li>Two programs have icons that look too similar</li>
<li>The program comes with an icon that does not give a good representation of what the program does</li>
<li>To have the coolest icons on the block</li>
</ul>
<div id="attachment_180" class="wp-caption alignright" style="width: 160px"><a href="http://brett.batie.com/wp-content/uploads/sshot-2009-03-09-1.png"  rel="lightbox[roadtrip]"><img class="size-thumbnail wp-image-180" title="Resource Hacker" src="http://brett.batie.com/wp-content/uploads/sshot-2009-03-09-1-150x150.png" alt="Resource Hacker Replace Icon" width="150" height="150" /></a><p class="wp-caption-text">Resource Hacker <br /> Replace Icon</p></div>
<p>The steps to replace an icon for a program are fairly simple. Just follow the below steps to modify the icons for any of your applications.   </p>
<ol>
<li>Download <a href="http://delphi.icm.edu.pl/ftp/tools/ResHack.zip">Resource Hacker</a></li>
<li><strong>Unzip</strong> the file and <strong>run</strong> ResHacker.exe</li>
<li><strong>Open the program</strong> that contains an icon you would like to change (like C:\Program Files\Brett Batie\Excel on Multiple Monitors\runExcel.exe)</li>
<li>Click <strong>Actions→Replace Icon</strong> in the Menu Bar</li>
<li>Click the &#8220;<strong>Open file with new icon&#8230;</strong>&#8221; button</li>
<li>Select the new icon (like C:\Program Files\Microsoft Office\Office12\EXCEL.exe)</li>
<li>Click the &#8220;<strong>Replace</strong>&#8221; button</li>
<li>Click<strong> File→Save</strong> in the Menu Bar</li>
<li><strong>Close</strong> Resource Hacker All Done</li>
</ol>

<p><a href="http://feedads.g.doubleclick.net/~a/QJCvKsbYg99eWQstYHsU1HozgqE/0/da"><img src="http://feedads.g.doubleclick.net/~a/QJCvKsbYg99eWQstYHsU1HozgqE/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/QJCvKsbYg99eWQstYHsU1HozgqE/1/da"><img src="http://feedads.g.doubleclick.net/~a/QJCvKsbYg99eWQstYHsU1HozgqE/1/di" border="0" ismap="true"></img></a></p><img src="http://feeds.feedburner.com/~r/brettbatie/~4/YrNsCaCRm4E" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://brett.batie.com/software-development/how-to-modify-a-programs-icon/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		<feedburner:origLink>http://brett.batie.com/software-development/how-to-modify-a-programs-icon/</feedburner:origLink></item>
		<item>
		<title>Turn off resize textarea in Chrome &amp; Safari</title>
		<link>http://feedproxy.google.com/~r/brettbatie/~3/FYgpBFecfxQ/</link>
		<comments>http://brett.batie.com/htmlcss/no-resize-textarea-in-chrome-safari/#comments</comments>
		<pubDate>Mon, 23 Feb 2009 17:35:13 +0000</pubDate>
		<dc:creator>Brett</dc:creator>
				<category><![CDATA[HTML/CSS]]></category>

		<guid isPermaLink="false">http://brett.batie.com/?p=170</guid>
		<description><![CDATA[There is a new feature in both Safari and Chrome that allows a textarea to be resized by the user. In both browsers the feature is seen by a little icon that is in the bottom right corner of the textarea. This feature gives the user the ability to choose how much space they need [...]]]></description>
			<content:encoded><![CDATA[<div id="attachment_153" class="wp-caption alignright" style="width: 107px"><a href="http://None"><img src="http://brett.batie.com/wp-content/uploads/textarea-chrome.png"  alt="Chrome Textarea" title="textarea-chrome" width="97" height="90" class="size-full wp-image-153" / rel="lightbox[roadtrip]"></a><p class="wp-caption-text">Chrome Textarea</p></div>
<p>There is a new feature in both Safari and Chrome that allows a textarea to be resized by the user. In both browsers the feature is seen by a little icon that is in the bottom right corner of the textarea. This feature gives the user the ability to choose how much space they need for whatever it is they are writing.</p>
<p>For some websites this new feature may not be desired as resizing the textarea could break the layout of the website. I can think of a few ways to prevent the layout from breaking.</p>
<ol>
<li>Design the page with a liquid layout</li>
<li>Turn off the users ability to resize the textarea</li>
<li>Give the textarea a max size</li>
</ol>
<p><P>Redesigning the site with a liquid layout can be a lot of work and may not be optimal for the look &#038; feel for the site. Many designers prefer to lock the site at a certain width to guarantee that everyone will see a website that looks exactly the same.</p>
<p>It is very easy to turn off the users ability to resize the textarea. Turning this feature off may be necessary due to the design of certain sites or to make it harder for the user to write a 100 page document in a small comment box. The following CSS can be used to remove the users ability to resize the textarea:</p>

<div class="wp_syntax"><div class="code"><pre class="css" style="font-family:monospace;">textarea<span style="color: #00AA00;">&#123;</span>resize<span style="color: #00AA00;">:</span> <span style="color: #993333;">none</span><span style="color: #00AA00;">&#125;</span></pre></div></div>

<p>Place that code in your css file to remove the users ability to resize any textarea on the site. You could also remove it from 1 textarea on a page with inline css.</p>

<div class="wp_syntax"><div class="code"><pre class="html4strict" style="font-family:monospace;"><span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">textarea</span> <span style="color: #000066;">name</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;myTextarea&quot;</span> <span style="color: #000066;">rows</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;3&quot;</span> <span style="color: #000066;">cols</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;30&quot;</span> <span style="color: #000066;">style</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;resize: none;&quot;</span>&gt;&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">textarea</span>&gt;</span></pre></div></div>

<p>The third option of giving the textarea a max size has a similar solution of using css. The two properties that can be used are max-width and max-height. This will give the user the ability to resize the textarea but limit them to a certain max size. The css would look something like the following.</p>

<div class="wp_syntax"><div class="code"><pre class="css" style="font-family:monospace;">textarea<span style="color: #00AA00;">&#123;</span><span style="color: #000000; font-weight: bold;">max-width</span><span style="color: #00AA00;">:</span> <span style="color: #933;">100px</span><span style="color: #00AA00;">;</span> <span style="color: #000000; font-weight: bold;">max-height</span><span style="color: #00AA00;">:</span> <span style="color: #933;">100px</span><span style="color: #00AA00;">;</span><span style="color: #00AA00;">&#125;</span></pre></div></div>

<p>Of course you may only want to use one of the above properties to allow the user to grow the height to any size but not resize the width or vice versa.</p>
<p>An example of a site that could use one of the above steps is whitehouse.gov. There are two screen shots below that show the before and after of the user resizing the textarea.</p>
<p>Browsers giving the user the ability to resize a textarea is a great feature but it creates one more item that designers and developers need to be aware of when adding a textarea to a page.</p>
<p><div id="attachment_171" class="wp-caption alignleft" style="width: 310px"><a href="http://brett.batie.com/wp-content/uploads/sshot-2009-02-23-2.png"  rel="lightbox[roadtrip]"><img src="http://brett.batie.com/wp-content/uploads/sshot-2009-02-23-2-300x198.png" alt="Before" title="whitehouse textarea normal size" width="300" height="198" class="size-medium wp-image-171" /></a><p class="wp-caption-text">Before</p></div>[caption id="attachment_173" align="alignleft" width="300" caption="After"]<a href="http://brett.batie.com/wp-content/uploads/sshot-2009-02-23-31.png"  rel="lightbox[roadtrip]"><img src="http://brett.batie.com/wp-content/uploads/sshot-2009-02-23-31-300x200.png" alt="After" title="whitehouse textarea resized" width="300" height="200" class="size-medium wp-image-173" /></a>[/caption]

<p><a href="http://feedads.g.doubleclick.net/~a/dDQ3BUx3Btfx4CX-rC5qrRN7fAA/0/da"><img src="http://feedads.g.doubleclick.net/~a/dDQ3BUx3Btfx4CX-rC5qrRN7fAA/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/dDQ3BUx3Btfx4CX-rC5qrRN7fAA/1/da"><img src="http://feedads.g.doubleclick.net/~a/dDQ3BUx3Btfx4CX-rC5qrRN7fAA/1/di" border="0" ismap="true"></img></a></p><img src="http://feeds.feedburner.com/~r/brettbatie/~4/FYgpBFecfxQ" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://brett.batie.com/htmlcss/no-resize-textarea-in-chrome-safari/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		<feedburner:origLink>http://brett.batie.com/htmlcss/no-resize-textarea-in-chrome-safari/</feedburner:origLink></item>
	</channel>
</rss>
