<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	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:series="http://unfoldingneurons.com/"
	>

<channel>
	<title>Brock Angelo &#187; Code</title>
	<atom:link href="http://brockangelo.com/category/code/feed/" rel="self" type="application/rss+xml" />
	<link>http://brockangelo.com</link>
	<description>cool little projects</description>
	<lastBuildDate>Wed, 03 Feb 2010 16:25:34 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.5</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>April Fool&#8217;s Batch File</title>
		<link>http://brockangelo.com/2010/02/03/april-fools-batch-file/</link>
		<comments>http://brockangelo.com/2010/02/03/april-fools-batch-file/#comments</comments>
		<pubDate>Wed, 03 Feb 2010 16:25:18 +0000</pubDate>
		<dc:creator>brockangelo</dc:creator>
				<category><![CDATA[Batch]]></category>
		<category><![CDATA[april fools day]]></category>
		<category><![CDATA[batch files]]></category>
		<category><![CDATA[fake format]]></category>
		<category><![CDATA[format hard drive]]></category>
		<category><![CDATA[gags]]></category>
		<category><![CDATA[jokes]]></category>

		<guid isPermaLink="false">http://brockangelo.com/?p=1328</guid>
		<description><![CDATA[The ultimate April Fool's Day joke for any geek: a tool that appears to format the hard drive.


Related posts:<ol><li><a href='http://brockangelo.com/2009/07/14/run-a-batch-file-invisibly/' rel='bookmark' title='Permanent Link: Run a Batch File Invisibly'>Run a Batch File Invisibly</a></li><li><a href='http://brockangelo.com/2009/06/07/display-the-contents-of-a-file-using-php/' rel='bookmark' title='Permanent Link: Display the Contents of a File Using PHP'>Display the Contents of a File Using PHP</a></li><li><a href='http://brockangelo.com/2009/12/15/how-to-start-a-virtual-machine-at-startup-using-virtualbox/' rel='bookmark' title='Permanent Link: How to Start a Virtual Machine at Startup Using VirtualBox'>How to Start a Virtual Machine at Startup Using VirtualBox</a></li></ol>]]></description>
			<content:encoded><![CDATA[<p>It is early February, which means time to start planning for April Fool&#8217;s Day. Here is one I&#8217;ve had up my sleeve for some time. A simple batch file that gives the appearance of formatting the Windows hard drive. Rough enough to make even a seasoned administrator do a double take.</p>
<p>Here is the breakdown of what it does.</p>
<ol>
<li>Show a pleasant, matter of fact message: Windows will now format your hard drive</li>
<li>Wait for three seconds</li>
<li>Enlarge the DOS window</li>
<li>Display the contents of the entire drive.</li>
</ol>
<p>It simply lists the name of every file on the entire hard drive, but it happens so fast and moves so quickly that it is sure to get a couple of knee jerks here and there.</p>
<p>If you want to be really devious, place this on someone&#8217;s hard drive, then create a shortcut to the batch file and change the default icon to something that isn&#8217;t as obvious as the batch icon. To be reeeeally devious, rename the shortcut to something like &#8220;Internet Explorer&#8221;. <img src='http://brockangelo.com/wp-includes/images/smilies/icon_surprised.gif' alt=':-o' class='wp-smiley' /> </p>
<p>Here is the batch file in plain text. To use this, copy the text below and save it to your computer as &#8220;format.bat&#8221;.</p>
<pre class="brush: text;">@echo off
REM Fake Format - A perfect April Fool's Day gift
REM Rename to your liking (something like &quot;Free.bat&quot; is suitably devious)
REM Then make sure you are there to watch their response
REM http://brockangelo.com/2010/02/03/april-fools-batch-file/

@echo off
echo.
echo.
echo.
echo            Windows will now format your hard drive
echo.
echo.
echo.
echo.
ping -n 3 127.0.0.1 &gt; nul
cd c:\
mode con: cols=140 lines=60
dir /w /s
</pre>


<p>Related posts:<ol><li><a href='http://brockangelo.com/2009/07/14/run-a-batch-file-invisibly/' rel='bookmark' title='Permanent Link: Run a Batch File Invisibly'>Run a Batch File Invisibly</a></li><li><a href='http://brockangelo.com/2009/06/07/display-the-contents-of-a-file-using-php/' rel='bookmark' title='Permanent Link: Display the Contents of a File Using PHP'>Display the Contents of a File Using PHP</a></li><li><a href='http://brockangelo.com/2009/12/15/how-to-start-a-virtual-machine-at-startup-using-virtualbox/' rel='bookmark' title='Permanent Link: How to Start a Virtual Machine at Startup Using VirtualBox'>How to Start a Virtual Machine at Startup Using VirtualBox</a></li></ol></p>]]></content:encoded>
			<wfw:commentRss>http://brockangelo.com/2010/02/03/april-fools-batch-file/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Redirect Users Back to Page They Were On</title>
		<link>http://brockangelo.com/2009/12/17/redirect-users-back-to-page-they-were-on/</link>
		<comments>http://brockangelo.com/2009/12/17/redirect-users-back-to-page-they-were-on/#comments</comments>
		<pubDate>Thu, 17 Dec 2009 14:09:59 +0000</pubDate>
		<dc:creator>brockangelo</dc:creator>
				<category><![CDATA[HTML]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[WordPress]]></category>
		<category><![CDATA[back]]></category>
		<category><![CDATA[cms]]></category>
		<category><![CDATA[intranet]]></category>
		<category><![CDATA[login]]></category>
		<category><![CDATA[redirect]]></category>

		<guid isPermaLink="false">http://brockangelo.com/?p=1312</guid>
		<description><![CDATA[How to redirect users back to the page they were on when they clicked "login".


Related posts:<ol><li><a href='http://brockangelo.com/2008/09/06/using-php-code-in-posts-pages/' rel='bookmark' title='Permanent Link: Using PHP code in Posts &#038; Pages'>Using PHP code in Posts &#038; Pages</a></li><li><a href='http://brockangelo.com/2008/09/21/removing-categories-from-your-rss-feed/' rel='bookmark' title='Permanent Link: Removing Categories from your RSS feed'>Removing Categories from your RSS feed</a></li><li><a href='http://brockangelo.com/2008/09/10/aligning-navbar-to-both-left-and-right/' rel='bookmark' title='Permanent Link: Aligning Navbar to both Left and Right'>Aligning Navbar to both Left and Right</a></li></ol>]]></description>
			<content:encoded><![CDATA[<p>I am a fan of most things WordPress, but one thing I am not a fan of is the way that everyone gets sent to the Dashboard whenever they log in. Not everyone who logs into your site will write posts or administer the site. And for an intranet, this is a drag.</p>
<p>What I&#8217;ve always wanted was a way to reload the current page after I have logged in. So if I&#8217;m on the &#8220;Search&#8221; page, I just want to go to the login page, then go back to the page I was on when I clicked the &#8220;Login&#8221; link. Finally &#8211; a solution!</p>
<p>Thanks to <a href="http://davidchambersdesign.com/wordpress-login-redirect/">David Chambers</a> &#8211; it is as easy as changing the url that the &#8220;login&#8221; link points to. </p>
<pre class="brush: php;">&lt;a href=&quot;&lt;?php echo get_option('siteurl'); ?&gt;/wp-login.php?redirect_to=&lt;?php echo urlencode($_SERVER['REQUEST_URI']); ?&gt;&quot;&gt;log in&lt;/a&gt;</pre>
<p>He calls it WordPress Login Redirect. I would imagine that this would be a handy plugin for a lot of people. On an intranet, you may want to provide a link to the dashboard if they are an admin, or a link to logout if they are not. I have been using a very simple conditional statement that determines what to put in place of the login link after you are logged in.</p>
<pre class="brush: php;">&lt;?php
	global $current_user;
	get_currentuserinfo();

	if (!(is_user_logged_in())) { ?&gt;
		&lt;a href=&quot;&lt;?php echo get_option('siteurl'); ?&gt;/wp-login.php?redirect_to=&lt;?php echo urlencode($_SERVER['REQUEST_URI']); ?&gt;&quot;&gt;Log in&lt;/a&gt;
	&lt;?php } elseif
		(
		(($current_user-&gt;user_login) == &quot;brock&quot;) 	||
		(($current_user-&gt;user_login) == &quot;admin&quot;)
		)
		{
			echo &quot;&lt;a href=\&quot;&quot;;
			echo get_option('siteurl');
			echo &quot;/wp-admin/\&quot;&gt;Dashboard&lt;/a&gt;&quot;;
			} else { ?&gt;
			&lt;a href=&quot;&lt;?php echo wp_logout_url( get_permalink() ); ?&gt;&quot; title=&quot;Logout&quot;&gt;Logout&lt;/a&gt;
			&lt;?php
		}
?&gt;
</pre>


<p>Related posts:<ol><li><a href='http://brockangelo.com/2008/09/06/using-php-code-in-posts-pages/' rel='bookmark' title='Permanent Link: Using PHP code in Posts &#038; Pages'>Using PHP code in Posts &#038; Pages</a></li><li><a href='http://brockangelo.com/2008/09/21/removing-categories-from-your-rss-feed/' rel='bookmark' title='Permanent Link: Removing Categories from your RSS feed'>Removing Categories from your RSS feed</a></li><li><a href='http://brockangelo.com/2008/09/10/aligning-navbar-to-both-left-and-right/' rel='bookmark' title='Permanent Link: Aligning Navbar to both Left and Right'>Aligning Navbar to both Left and Right</a></li></ol></p>]]></content:encoded>
			<wfw:commentRss>http://brockangelo.com/2009/12/17/redirect-users-back-to-page-they-were-on/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>How to Start a Virtual Machine at Startup Using VirtualBox</title>
		<link>http://brockangelo.com/2009/12/15/how-to-start-a-virtual-machine-at-startup-using-virtualbox/</link>
		<comments>http://brockangelo.com/2009/12/15/how-to-start-a-virtual-machine-at-startup-using-virtualbox/#comments</comments>
		<pubDate>Tue, 15 Dec 2009 22:25:22 +0000</pubDate>
		<dc:creator>brockangelo</dc:creator>
				<category><![CDATA[Batch]]></category>
		<category><![CDATA[boot]]></category>
		<category><![CDATA[startup]]></category>
		<category><![CDATA[tweakui]]></category>
		<category><![CDATA[virtualbox]]></category>
		<category><![CDATA[vm]]></category>

		<guid isPermaLink="false">http://brockangelo.com/?p=1309</guid>
		<description><![CDATA[How to start a Virtual Machine at startup, (aka: start at VM at boot) if you are using VirtualBox.


Related posts:<ol><li><a href='http://brockangelo.com/2009/07/14/run-a-batch-file-invisibly/' rel='bookmark' title='Permanent Link: Run a Batch File Invisibly'>Run a Batch File Invisibly</a></li><li><a href='http://brockangelo.com/2010/02/03/april-fools-batch-file/' rel='bookmark' title='Permanent Link: April Fool&#8217;s Batch File'>April Fool&#8217;s Batch File</a></li><li><a href='http://brockangelo.com/2009/12/17/redirect-users-back-to-page-they-were-on/' rel='bookmark' title='Permanent Link: Redirect Users Back to Page They Were On'>Redirect Users Back to Page They Were On</a></li></ol>]]></description>
			<content:encoded><![CDATA[<p>This did not seem obvious to me, so I hope it is valuable to someone else. If you are using VirtualBox to host your newly created Virtual Servers, one of the questions you will find yourself asking is: &#8220;What if my machine reboots?&#8221; VirtualBox does not (yet) have a built in way to indicate that you want to start a VM when your Host machine boots, so you need to add this to your startup.</p>
<p>If you are on Windows, create a batch file with the following content:</p>
<p><code lang="batch"><br />
@echo off<br />
cls<br />
"C:\Program Files\Sun\VirtualBox\VBoxManage.exe" startvm vm-name<br />
@exit<br />
</code></p>
<p>You should replace &#8220;vm-name&#8221; with the name of the Virtual Machine you want to start. If you are on XP, make sure you are using TweakUI to auto-login to XP.</p>
<p>Enjoy!</p>


<p>Related posts:<ol><li><a href='http://brockangelo.com/2009/07/14/run-a-batch-file-invisibly/' rel='bookmark' title='Permanent Link: Run a Batch File Invisibly'>Run a Batch File Invisibly</a></li><li><a href='http://brockangelo.com/2010/02/03/april-fools-batch-file/' rel='bookmark' title='Permanent Link: April Fool&#8217;s Batch File'>April Fool&#8217;s Batch File</a></li><li><a href='http://brockangelo.com/2009/12/17/redirect-users-back-to-page-they-were-on/' rel='bookmark' title='Permanent Link: Redirect Users Back to Page They Were On'>Redirect Users Back to Page They Were On</a></li></ol></p>]]></content:encoded>
			<wfw:commentRss>http://brockangelo.com/2009/12/15/how-to-start-a-virtual-machine-at-startup-using-virtualbox/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Run a Batch File Invisibly</title>
		<link>http://brockangelo.com/2009/07/14/run-a-batch-file-invisibly/</link>
		<comments>http://brockangelo.com/2009/07/14/run-a-batch-file-invisibly/#comments</comments>
		<pubDate>Tue, 14 Jul 2009 13:55:40 +0000</pubDate>
		<dc:creator>brockangelo</dc:creator>
				<category><![CDATA[Batch]]></category>
		<category><![CDATA[Windows]]></category>
		<category><![CDATA[batch]]></category>
		<category><![CDATA[invisible]]></category>
		<category><![CDATA[visual basic]]></category>

		<guid isPermaLink="false">http://brockangelo.com/?p=1279</guid>
		<description><![CDATA[Run a Batch File invisibly. Users won't know a thing.


Related posts:<ol><li><a href='http://brockangelo.com/2010/02/03/april-fools-batch-file/' rel='bookmark' title='Permanent Link: April Fool&#8217;s Batch File'>April Fool&#8217;s Batch File</a></li><li><a href='http://brockangelo.com/2008/10/19/how-to-batch-resize-photos-in-photoshop/' rel='bookmark' title='Permanent Link: How to Batch Resize Photos in Photoshop'>How to Batch Resize Photos in Photoshop</a></li><li><a href='http://brockangelo.com/2009/07/08/automatically-upload-photos-to-flickr/' rel='bookmark' title='Permanent Link: Automatically Upload Photos to Flickr'>Automatically Upload Photos to Flickr</a></li></ol>]]></description>
			<content:encoded><![CDATA[<p>Running a batch file invisibly can come in handy, especially if you manage computers for other users. It allows you to perform a task without the user knowing anything about it.</p>
<p>Its very simple. Instead of telling the batch file to run, you tell a Visual Basic script to launch the batch file; and Visual Basic has the ability to launch things invisibly.</p>
<blockquote><p>Follow this demo and you’ll be up and running in just a few seconds</p>
<p>You’ll create two files: the vbs script and a sample batch file</p>
<p>&#160;</p>
</blockquote>
<p>Open Notepad, and paste this content, then save the file as <strong>invisible.vbs </strong>to the Desktop</p>
<blockquote><p>Set WshShell = CreateObject(&quot;WScript.Shell&quot;)     <br />WshShell.Run chr(34) &amp; &quot;C:\Documents and Settings\%username%\Desktop\1.bat&quot; &amp; Chr(34), 0      <br />Set WshShell = Nothing</p>
</blockquote>
<p><a href="http://media.brockangelo.com/all_files_txt.jpg" alt="click to enlarge"><img style="display: block; float: none; margin-left: auto; margin-right: auto" height="284" src="http://media.brockangelo.com/all_files_txt.jpg" width="413" /></a></p>
<p>&#160;</p>
<p>Open Notepad again, and paste this content, then save the file as <strong>1.bat </strong>to the Desktop:</p>
<blockquote><p>echo hello &gt; &quot;C:\Documents and Settings\%username%\Desktop\1.txt&quot;</p>
</blockquote>
<p>&#160;</p>
<p>Now double click on <strong>invisible.vbs</strong>. You should see a <strong>1.txt</strong> file get magically (<em>invisibly</em>) created on the Desktop.</p>
<p>That’s it! Modify to your liking!</p>


<p>Related posts:<ol><li><a href='http://brockangelo.com/2010/02/03/april-fools-batch-file/' rel='bookmark' title='Permanent Link: April Fool&#8217;s Batch File'>April Fool&#8217;s Batch File</a></li><li><a href='http://brockangelo.com/2008/10/19/how-to-batch-resize-photos-in-photoshop/' rel='bookmark' title='Permanent Link: How to Batch Resize Photos in Photoshop'>How to Batch Resize Photos in Photoshop</a></li><li><a href='http://brockangelo.com/2009/07/08/automatically-upload-photos-to-flickr/' rel='bookmark' title='Permanent Link: Automatically Upload Photos to Flickr'>Automatically Upload Photos to Flickr</a></li></ol></p>]]></content:encoded>
			<wfw:commentRss>http://brockangelo.com/2009/07/14/run-a-batch-file-invisibly/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Automatically Upload Photos to Flickr</title>
		<link>http://brockangelo.com/2009/07/08/automatically-upload-photos-to-flickr/</link>
		<comments>http://brockangelo.com/2009/07/08/automatically-upload-photos-to-flickr/#comments</comments>
		<pubDate>Thu, 09 Jul 2009 02:06:07 +0000</pubDate>
		<dc:creator>brockangelo</dc:creator>
				<category><![CDATA[Batch]]></category>
		<category><![CDATA[Photography]]></category>
		<category><![CDATA[Python]]></category>
		<category><![CDATA[Windows]]></category>
		<category><![CDATA[automatically upload to flickr]]></category>
		<category><![CDATA[backup]]></category>
		<category><![CDATA[batch]]></category>
		<category><![CDATA[Digital Photography]]></category>
		<category><![CDATA[flickr]]></category>
		<category><![CDATA[lifehacker]]></category>
		<category><![CDATA[photos]]></category>
		<category><![CDATA[uploadr]]></category>
		<category><![CDATA[xmltramp]]></category>
		<category><![CDATA[xp]]></category>

		<guid isPermaLink="false">http://brockangelo.com/?p=1158</guid>
		<description><![CDATA[Automatically upload photos &#038; videos to Flickr - you plug in your camera, and in just 10 seconds you are walking away with your camera in hand.


Related posts:<ol><li><a href='http://brockangelo.com/2008/09/16/upload-download-your-flickr-photos/' rel='bookmark' title='Permanent Link: Upload &#038; Download Your Flickr Photos'>Upload &#038; Download Your Flickr Photos</a></li><li><a href='http://brockangelo.com/2008/10/21/how-to-batch-resize-photos-in-picasa/' rel='bookmark' title='Permanent Link: How to Batch Resize Photos in Picasa'>How to Batch Resize Photos in Picasa</a></li><li><a href='http://brockangelo.com/2008/10/11/how-to-change-which-program-opens-your-jpg-files/' rel='bookmark' title='Permanent Link: How to Change Which Program Opens Your JPG Files'>How to Change Which Program Opens Your JPG Files</a></li></ol>]]></description>
			<content:encoded><![CDATA[<p>Here&#8217;s how this will work: you&#8217;ll plug in your card reader or digital camera and all your photos &#038; videos are automatically copied to the folders of your choice in about 3 to 5 seconds. Once the photos are copied to the PC, they are automatically removed from the card (this is optional, but recommended). After they have been deleted from the card, they are automatically uploaded to your <a href="http://flickr.com/photos/brockangelo">Flickr</a> account (as private, public, tagged, not tagged, whatever). All in the background without you having to do a thing.</p>
<p>I set this up because my photography workflow had turned into something horrid: I have two digital cameras that we use. One of the two has video, but I don&#8217;t use Flickr for my videos, I use <a href="http://motionbox.com" target="_blank">Motionbox</a>. So to get photos or videos off the cameras involved the following:</p>
<ol>
<li>Plug in each card</li>
<li>Copy the pics from the card to the PC, name the folders, etc</li>
<li>Copy the videos to the My Videos folder</li>
<li>Delete the photos &#038; videos from the card</li>
<li>Use the Flickr Uploadr and hope it successfully uploads all the pics</li>
<li>Upload videos to <a href="http://motionbox.com" target="_blank">Motionbox</a>.</li>
<li>Come back later and delete the photos &#038; videos off the PC after they got uploaded</li>
</ol>
<p>I decided to put a little thought into it and get a better setup. I now do the following:</p>
<ol>
<li>Insert flash card into card reader right after taking pictures &#8211; <strong>pictures &#038; videos download automatically in less than 10 seconds</strong> &#8211; card automatically formats (<i>optional, but recommended</i>)</li>
<li>(<i>photos are now uploading to Flickr in the background &#8211; so I leave <img src='http://brockangelo.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />  </i>)</li>
</ol>
<p>I&#8217;ve completely eliminated my involvement with the computer. I simply plug in the card reader (or camera) and the computer takes care of the entire process of copying the photos over to the computer, then deleting them from the card. It then automatically uploads the photos to Flickr as private. All in the background without any of my involvement. </p>
<blockquote><p>You can modify the batch file to upload all photos and videos to Flickr.</p></blockquote>
<p>There are several steps you&#8217;ll need to take in order for the process to be completely automatic. Here is an outline of what all is involved. Start to finish the process takes about 15 minutes.</p>
<ol>
<li>Give Digital Cameras persistent drive letters (E:, F:, G:)</li>
<li>Download Python</li>
<li>Download the &#8220;Uploadr&#8221; python scripts</li>
<li>Download the batch file for your camera</li>
<li>Install TweakUI and add Batch file to the AutoPlay menus</li>
<li>Configure AutoPlay for your digital camera</li>
<li>Test it out</li>
</ol>
<h2>First Step</h2>
<h3>Give Memory Cards and Digital Cameras persistent drive letters (E:, F:, G:)</h3>
<p>In order for you to be able to reliably copy images from a particular card or device, you should set it up so that every time you plug in the device it uses the same drive letter. With your memory card or device plugged in, right click <strong>My Computer</strong> and select <strong>Manage</strong>: </p>
<blockquote><p> <center><img src="http://media.brockangelo.com/wp-content/uploads/2009/07/my_computer_manage.jpg" alt="my_computer_manage" title="my_computer_manage" width="203" height="132" class="aligncenter size-full wp-image-1162" /></center></p></blockquote>
<p>Select <strong>Storage &#8658; Disk Management</strong> (<a href="http://brockangelo.com/2009/07/08/automatically-upload-photos-to-flickr/disk_management/" rel="attachment wp-att-1163">see picture</a>)</p>
<p>In the right panel, your devices will be listed, probably with letters like E, F or G. Do not change the drive letter of the C: drive, and you probably shouldn&#8217;t change a D: drive if you have one either. Right click on the flash drive that you need to change and select <strong>Change Drive Letter and Paths</strong>: (<a href="http://brockangelo.com/2009/07/08/automatically-upload-photos-to-flickr/change_drive_letter/" rel="attachment wp-att-1164">see picture</a>)</p>
<p>The next box shows you the letter that is already assigned. Just click <strong>Change</strong>:<br />
<img src="http://media.brockangelo.com/wp-content/uploads/2009/07/change_drive_letter_box-300x194.jpg" alt="change_drive_letter_box" title="change_drive_letter_box" width="300" height="194" class="aligncenter size-medium wp-image-1165" /></p>
<p>This box will ask you what letter you want to assign to it. I start from the bottom, in this case, Z: (<a href="http://brockangelo.com/2009/07/08/automatically-upload-photos-to-flickr/select_drive_letter/" rel="attachment wp-att-1166">see picture</a>)</p>
<p>It will ask you to confirm this. Click <strong>Yes</strong>. (<a href="http://brockangelo.com/2009/07/08/automatically-upload-photos-to-flickr/are_you_sure/" rel="attachment wp-att-1167">see picture</a>)</p>
<p>Repeat this for each card or camera that you would like to setup for this.</p>
<p>Now if you go to My Computer, your drive letters should be updated to the new letters.</p>
<h2>Next Step</h2>
<h3>Download Python</h3>


<p>Related posts:<ol><li><a href='http://brockangelo.com/2008/09/16/upload-download-your-flickr-photos/' rel='bookmark' title='Permanent Link: Upload &#038; Download Your Flickr Photos'>Upload &#038; Download Your Flickr Photos</a></li><li><a href='http://brockangelo.com/2008/10/21/how-to-batch-resize-photos-in-picasa/' rel='bookmark' title='Permanent Link: How to Batch Resize Photos in Picasa'>How to Batch Resize Photos in Picasa</a></li><li><a href='http://brockangelo.com/2008/10/11/how-to-change-which-program-opens-your-jpg-files/' rel='bookmark' title='Permanent Link: How to Change Which Program Opens Your JPG Files'>How to Change Which Program Opens Your JPG Files</a></li></ol></p>]]></content:encoded>
			<wfw:commentRss>http://brockangelo.com/2009/07/08/automatically-upload-photos-to-flickr/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Replace Text on Click Using JavaScript</title>
		<link>http://brockangelo.com/2009/06/19/replace-text-on-click-using-javascript/</link>
		<comments>http://brockangelo.com/2009/06/19/replace-text-on-click-using-javascript/#comments</comments>
		<pubDate>Fri, 19 Jun 2009 18:12:19 +0000</pubDate>
		<dc:creator>brockangelo</dc:creator>
				<category><![CDATA[Javascript]]></category>
		<category><![CDATA[WordPress]]></category>
		<category><![CDATA[div]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[replace]]></category>
		<category><![CDATA[text]]></category>

		<guid isPermaLink="false">http://brockangelo.com/?p=955</guid>
		<description><![CDATA[Did you know that you can replace text using Javascript? I wrote this script for our company intranet. In our staff phone directory I show the internal 5-digit phone number by default. Clicking the number reveals a 7-digit external phone number. Try the demo.


Related posts:<ol><li><a href='http://brockangelo.com/2009/06/04/show-forms-when-radio-button-is-clicked/' rel='bookmark' title='Permanent Link: Show Forms When Radio Button is Clicked'>Show Forms When Radio Button is Clicked</a></li><li><a href='http://brockangelo.com/2009/06/04/how-to-reset-a-form-using-javascript/' rel='bookmark' title='Permanent Link: How to Reset a Form Using Javascript'>How to Reset a Form Using Javascript</a></li><li><a href='http://brockangelo.com/2009/03/18/search-and-replace-a-custom-field-in-wordpress-using-phpmyadmin/' rel='bookmark' title='Permanent Link: Search and Replace a Custom Field in WordPress using PHPMyAdmin'>Search and Replace a Custom Field in WordPress using PHPMyAdmin</a></li></ol>]]></description>
			<content:encoded><![CDATA[<p><script type="text/javascript" src="/wp-content/themes/downtown-java-3column.js"></script><br />
<script type="text/javascript">
function toggle_text(shown, hidden) {
       var e = document.getElementById(shown);
       var f = document.getElementById(hidden);
    if(e.style.display == 'inline') {
			e.style.display = 'none';
			f.style.display = 'inline';
	}
	else {
			e.style.display = 'inline';
			f.style.display = 'none';
	}
}
</script><br />
This tutorial will show you how to replace text with text by using JavaScript. The text that you click will be replaced with new text. Specifically, we will use JavaScript to hide one div and show another in it&#8217;s place. Here is a demo:</p>
<blockquote><p><center><br />
<h2>
<div id="shown_first" style="display:inline"><a style="cursor:pointer" onclick="toggle_text('shown_first', 'hidden_first')">Click me	</a></div>
<div id="hidden_first" style="display:none"><a style="cursor:pointer" onclick="toggle_text('shown_first', 'hidden_first')">I used to be hidden!</a></div>
</h2>
<p></center></p></blockquote>
<p>JavaScript does the magic behind the scenes. The way you accomplish this is by putting your two text fields into divs. I&#8217;ll set the first one to be visible, then when you click on it, I will hide the first and show the second in its place. I use the <code>style.display</code> feature of JavaScript to change whether or not it is visible or shown. Let&#8217;s take a look at the JavaScript:</p>
<pre class="brush: javascript;">
&lt;script type=&quot;text/javascript&quot;&gt;

function toggle_text(shown, hidden) {
       var e = document.getElementById(shown);
       var f = document.getElementById(hidden);
    if(e.style.display == 'inline') {
			e.style.display = 'none';
			f.style.display = 'inline';
	}
	else {
			e.style.display = 'inline';
			f.style.display = 'none';
	}
}
&lt;/script&gt;
</pre>
<p>I&#8217;m simply passing in the two divs to the JavaScript function, then JavaScript checks whether or not the first div (the <code>shown</code> div) is visible or not. If it is visible, it hides it and shows the hidden one. The opposite happens if it isn&#8217;t visible. Note that using <code>inline</code> will display your text on the same line. If we wanted it to be on its own line, we could just use <code>block</code> instead.</p>
<p>Now you just need to insert the divs into the body of the page. Here is the code used from the sample above:</p>
<pre class="brush: html;">
&lt;div id=&quot;shown_first&quot; style=&quot;display:inline&quot;&gt;
	&lt;a style=&quot;cursor:pointer&quot; onclick=&quot;toggle_text('shown_first', 'hidden_first')&quot;&gt;
	Click me
	&lt;/a&gt;
&lt;/div&gt;
&lt;div id=&quot;hidden_first&quot; style=&quot;display:none&quot;&gt;
	&lt;a style=&quot;cursor:pointer&quot; onclick=&quot;toggle_text('shown_first', 'hidden_first')&quot;&gt;
	I used to be hidden!
	&lt;/a&gt;
&lt;/div&gt;
</pre>


<p>Related posts:<ol><li><a href='http://brockangelo.com/2009/06/04/show-forms-when-radio-button-is-clicked/' rel='bookmark' title='Permanent Link: Show Forms When Radio Button is Clicked'>Show Forms When Radio Button is Clicked</a></li><li><a href='http://brockangelo.com/2009/06/04/how-to-reset-a-form-using-javascript/' rel='bookmark' title='Permanent Link: How to Reset a Form Using Javascript'>How to Reset a Form Using Javascript</a></li><li><a href='http://brockangelo.com/2009/03/18/search-and-replace-a-custom-field-in-wordpress-using-phpmyadmin/' rel='bookmark' title='Permanent Link: Search and Replace a Custom Field in WordPress using PHPMyAdmin'>Search and Replace a Custom Field in WordPress using PHPMyAdmin</a></li></ol></p>]]></content:encoded>
			<wfw:commentRss>http://brockangelo.com/2009/06/19/replace-text-on-click-using-javascript/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Display the Contents of a File Using PHP</title>
		<link>http://brockangelo.com/2009/06/07/display-the-contents-of-a-file-using-php/</link>
		<comments>http://brockangelo.com/2009/06/07/display-the-contents-of-a-file-using-php/#comments</comments>
		<pubDate>Sun, 07 Jun 2009 12:00:00 +0000</pubDate>
		<dc:creator>brockangelo</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[echo]]></category>
		<category><![CDATA[file contents]]></category>
		<category><![CDATA[file_get_contents]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[server]]></category>
		<category><![CDATA[text file]]></category>

		<guid isPermaLink="false">http://brockangelo.com/?p=873</guid>
		<description><![CDATA[How to Display the Contents of a File Using PHP
PHP has a built in function to display the contents of a file. This is helpful if you want to update a webpage to reflect some data that is regularly updated or output to a file. It is also helpful if you have access to the [...]


Related posts:<ol><li><a href='http://brockangelo.com/2009/06/05/how-to-display-your-uptime-using-bash/' rel='bookmark' title='Permanent Link: How to Display Your &#8220;Uptime&#8221; using Bash'>How to Display Your &#8220;Uptime&#8221; using Bash</a></li><li><a href='http://brockangelo.com/2010/02/03/april-fools-batch-file/' rel='bookmark' title='Permanent Link: April Fool&#8217;s Batch File'>April Fool&#8217;s Batch File</a></li><li><a href='http://brockangelo.com/2009/07/14/run-a-batch-file-invisibly/' rel='bookmark' title='Permanent Link: Run a Batch File Invisibly'>Run a Batch File Invisibly</a></li></ol>]]></description>
			<content:encoded><![CDATA[<p><strong>How to Display the Contents of a File Using PHP</strong></p>
<p>PHP has a built in function to display the <em>contents</em> of a file. This is helpful if you want to update a webpage to reflect some data that is regularly updated or output to a file. It is also helpful if you have access to the web server and it is easier for you to update a text file than it is to edit html. Simply point your webpage to the text file and the contents of the webpage get updated automatically.</p>
<p>Here&#8217;s how it works:</p>
<pre class="brush: php;">&lt;?php
echo file_get_contents('http://brockangelo.com/uptime.txt');
?&gt;</pre>
<p>Easy enough. I used to have a message in the footer of this webpage that said &#8220;This server has been up for 14 days, 7 hours, 22 minutes.&#8221; All that was doing was reading the contents of the text file that got updated every hour.</p>


<p>Related posts:<ol><li><a href='http://brockangelo.com/2009/06/05/how-to-display-your-uptime-using-bash/' rel='bookmark' title='Permanent Link: How to Display Your &#8220;Uptime&#8221; using Bash'>How to Display Your &#8220;Uptime&#8221; using Bash</a></li><li><a href='http://brockangelo.com/2010/02/03/april-fools-batch-file/' rel='bookmark' title='Permanent Link: April Fool&#8217;s Batch File'>April Fool&#8217;s Batch File</a></li><li><a href='http://brockangelo.com/2009/07/14/run-a-batch-file-invisibly/' rel='bookmark' title='Permanent Link: Run a Batch File Invisibly'>Run a Batch File Invisibly</a></li></ol></p>]]></content:encoded>
			<wfw:commentRss>http://brockangelo.com/2009/06/07/display-the-contents-of-a-file-using-php/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to Display Your &#8220;Uptime&#8221; using Bash</title>
		<link>http://brockangelo.com/2009/06/05/how-to-display-your-uptime-using-bash/</link>
		<comments>http://brockangelo.com/2009/06/05/how-to-display-your-uptime-using-bash/#comments</comments>
		<pubDate>Fri, 05 Jun 2009 11:30:39 +0000</pubDate>
		<dc:creator>brockangelo</dc:creator>
				<category><![CDATA[Bash]]></category>
		<category><![CDATA[Ubuntu]]></category>
		<category><![CDATA[bash]]></category>
		<category><![CDATA[scripts]]></category>
		<category><![CDATA[uptime]]></category>

		<guid isPermaLink="false">http://brockangelo.com/?p=879</guid>
		<description><![CDATA[Bash is a powerful scripting tool and comes in handy on more than one occasion. Here is a fun one: Write your server uptime to a text file so that you can display it on a webpage.


Related posts:<ol><li><a href='http://brockangelo.com/2009/06/07/display-the-contents-of-a-file-using-php/' rel='bookmark' title='Permanent Link: Display the Contents of a File Using PHP'>Display the Contents of a File Using PHP</a></li><li><a href='http://brockangelo.com/2010/02/03/april-fools-batch-file/' rel='bookmark' title='Permanent Link: April Fool&#8217;s Batch File'>April Fool&#8217;s Batch File</a></li><li><a href='http://brockangelo.com/2008/09/13/display-novell-servers-connected-to-your-server/' rel='bookmark' title='Permanent Link: Display Novell Servers Connected to Your Server'>Display Novell Servers Connected to Your Server</a></li></ol>]]></description>
			<content:encoded><![CDATA[<p>Bash is a powerful scripting tool and comes in handy on more than one occasion. Here is a fun one: Write your server uptime to a text file so that you can display it on a webpage.</p>
<pre class="brush: bash;">
#!/bin/sh

# get the uptime data
days=$(uptime | awk '{print $3}' | sed 's/,//g')
hours=$(uptime | awk '{print $5}' | sed 's/,//g')
label=$(uptime | awk '{print $4}')

if [ &quot;$days&quot; = 1 ]; then
day_label='day'
else
day_label='days'
fi

#format labels
if [ $hours = 1 ]; then
hour_label='hour'
else
hour_label='hours'
fi

#format output
if [ &quot;$label&quot; = 'mins,' ]; then
echo 'This server has been on for '$days minutes'' &gt; /var/www/uptime.txt
elif [[ &quot;$label&quot; = 'day,' || &quot;$label&quot; = 'days,' ]]; then
echo 'This server has been on for '$days $day_label, $hours $hour_label'' &gt; /var/www/uptime.txt
elif [ &quot;$label&quot; = '2' ]; then
echo 'This server has been on for '$days hours'' &gt; /var/www/uptime.txt
fi
</pre>


<p>Related posts:<ol><li><a href='http://brockangelo.com/2009/06/07/display-the-contents-of-a-file-using-php/' rel='bookmark' title='Permanent Link: Display the Contents of a File Using PHP'>Display the Contents of a File Using PHP</a></li><li><a href='http://brockangelo.com/2010/02/03/april-fools-batch-file/' rel='bookmark' title='Permanent Link: April Fool&#8217;s Batch File'>April Fool&#8217;s Batch File</a></li><li><a href='http://brockangelo.com/2008/09/13/display-novell-servers-connected-to-your-server/' rel='bookmark' title='Permanent Link: Display Novell Servers Connected to Your Server'>Display Novell Servers Connected to Your Server</a></li></ol></p>]]></content:encoded>
			<wfw:commentRss>http://brockangelo.com/2009/06/05/how-to-display-your-uptime-using-bash/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Show Forms When Radio Button is Clicked</title>
		<link>http://brockangelo.com/2009/06/04/show-forms-when-radio-button-is-clicked/</link>
		<comments>http://brockangelo.com/2009/06/04/show-forms-when-radio-button-is-clicked/#comments</comments>
		<pubDate>Thu, 04 Jun 2009 16:18:51 +0000</pubDate>
		<dc:creator>brockangelo</dc:creator>
				<category><![CDATA[Javascript]]></category>
		<category><![CDATA[checkbox]]></category>
		<category><![CDATA[forms]]></category>
		<category><![CDATA[function]]></category>
		<category><![CDATA[hide]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[radio]]></category>
		<category><![CDATA[show]]></category>

		<guid isPermaLink="false">http://brockangelo.com/?p=862</guid>
		<description><![CDATA[Have you been on a website, clicked a radio button, and a form appears with text boxes that weren't there before? Here's free code to make that happen with Javascript.


Related posts:<ol><li><a href='http://brockangelo.com/2009/06/04/how-to-reset-a-form-using-javascript/' rel='bookmark' title='Permanent Link: How to Reset a Form Using Javascript'>How to Reset a Form Using Javascript</a></li><li><a href='http://brockangelo.com/2009/06/19/replace-text-on-click-using-javascript/' rel='bookmark' title='Permanent Link: Replace Text on Click Using JavaScript'>Replace Text on Click Using JavaScript</a></li><li><a href='http://brockangelo.com/2009/06/07/display-the-contents-of-a-file-using-php/' rel='bookmark' title='Permanent Link: Display the Contents of a File Using PHP'>Display the Contents of a File Using PHP</a></li></ol>]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve been using my Javascript a bit more than usual as I&#8217;ve been writing the <a href="http://brockangelo.com/wordpress/plugins/google-chart-generator/">Google Chart Generator</a> plugin for WordPress. Here is one that I think gives an awesome effect. You click a radio button or a checkbox and a form element shows up that wasn&#8217;t there before. This is helpful for Google Charts because datasets are only available for some types of charts. So it is easier for the user if they don&#8217;t show up unless they are needed. Here&#8217;s how it&#8217;s done:</p>
<p>Create a function inside your javascript tags in the head of your page. This checks to see which radio button was checked. If it is a pie chart, it shows the pie chart entry form and hides the line chart entry form. (and vice-versa) The &#8220;chart_type&#8221; gets passed in by the form (see below):</p>
<pre class="brush: javascript;">	function gcg_radio_check(chart_type) {

	if (chart_type == &quot;p3&quot;) {
	document.getElementById(&quot;pie_chart_data&quot;).style.display = &quot;block&quot;;
	document.getElementById(&quot;line_chart_data&quot;).style.display = &quot;none&quot;;
	}
	if (chart_type == &quot;lc&quot;) {
	document.getElementById(&quot;line_chart_data&quot;).style.display = &quot;block&quot;;
	document.getElementById(&quot;pie_chart_data&quot;).style.display = &quot;none&quot;;
	}
     }
</pre>
<p>Now we need to create our form element, and pass the chart_type value to javascript so it can decide what to do. We do this by passing &#8220;value&#8221; in the function parameter.</p>
<pre class="brush: html;">
&lt;form&gt;
&lt;input type=&quot;radio&quot; name=&quot;gcg_charttype&quot; onClick=&quot;gcg_radio_check(value);&quot; value=&quot;bhs&quot;&gt;Bar Chart&lt;br /&gt;
&lt;input type=&quot;radio&quot; name=&quot;gcg_charttype&quot; onClick=&quot;gcg_radio_check(value);&quot; value=&quot;lc&quot;&gt;Line Chart&lt;br /&gt;
&lt;/form&gt;
</pre>
<p>So if I clicked the radio button for &#8220;Bar Chart&#8221;, it passes this to javascript: <code>gcg_radio_check(bhs)</code></p>
<p>Lastly, we need to create the form that will be displayed once we click the radio box. I set it to <code>display:none</code> so that it is hidden by default:</p>
<pre class="brush: html;">
&lt;div id=&quot;pie_chart_data&quot; style=&quot;display:none&quot;&gt;
	&lt;h3&gt;Data Points&lt;/h3&gt;
	&lt;table&gt;
		&lt;tr&gt;
		&lt;input type=&quot;text&quot; size=&quot;4&quot; name=&quot;gcg_chartdata&quot; value=&quot;&quot;&gt; Data1
		&lt;input type=&quot;text&quot; size=&quot;6&quot; name=&quot;gcg_data_color&quot; value=&quot;&quot;&gt; Color
		&lt;input type=&quot;text&quot; size=&quot;10&quot; name=&quot;gcg_labels&quot; value=&quot;&quot;&gt; Label&lt;br /&gt;
		&lt;/tr&gt;
	&lt;/table&gt;
&lt;/div&gt;
</pre>
<p>Then repeat this for the line chart and any other forms you want to hide or show.</p>


<p>Related posts:<ol><li><a href='http://brockangelo.com/2009/06/04/how-to-reset-a-form-using-javascript/' rel='bookmark' title='Permanent Link: How to Reset a Form Using Javascript'>How to Reset a Form Using Javascript</a></li><li><a href='http://brockangelo.com/2009/06/19/replace-text-on-click-using-javascript/' rel='bookmark' title='Permanent Link: Replace Text on Click Using JavaScript'>Replace Text on Click Using JavaScript</a></li><li><a href='http://brockangelo.com/2009/06/07/display-the-contents-of-a-file-using-php/' rel='bookmark' title='Permanent Link: Display the Contents of a File Using PHP'>Display the Contents of a File Using PHP</a></li></ol></p>]]></content:encoded>
			<wfw:commentRss>http://brockangelo.com/2009/06/04/show-forms-when-radio-button-is-clicked/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to Reset a Form Using Javascript</title>
		<link>http://brockangelo.com/2009/06/04/how-to-reset-a-form-using-javascript/</link>
		<comments>http://brockangelo.com/2009/06/04/how-to-reset-a-form-using-javascript/#comments</comments>
		<pubDate>Thu, 04 Jun 2009 15:53:39 +0000</pubDate>
		<dc:creator>brockangelo</dc:creator>
				<category><![CDATA[Javascript]]></category>
		<category><![CDATA[form]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[reset]]></category>

		<guid isPermaLink="false">http://brockangelo.com/?p=854</guid>
		<description><![CDATA[How to Reset a Form Using Javascript

&#60;form&#62;
&#60;input type=&#34;button&#34; onclick=&#34;document.forms[0].reset()&#34; value=&#34;Reset This Form&#34;&#62;
&#60;/form&#62;

It doesn&#8217;t clear the data, it just resets all form values to their original value. Here&#8217;s a demo:







Related posts:Show Forms When Radio Button is ClickedReplace Text on Click Using JavaScriptHow to Add Uploaded Media to WP-DownloadManager


Related posts:<ol><li><a href='http://brockangelo.com/2009/06/04/show-forms-when-radio-button-is-clicked/' rel='bookmark' title='Permanent Link: Show Forms When Radio Button is Clicked'>Show Forms When Radio Button is Clicked</a></li><li><a href='http://brockangelo.com/2009/06/19/replace-text-on-click-using-javascript/' rel='bookmark' title='Permanent Link: Replace Text on Click Using JavaScript'>Replace Text on Click Using JavaScript</a></li><li><a href='http://brockangelo.com/2009/05/12/how-to-add-uploaded-media-to-wp-downloadmanager/' rel='bookmark' title='Permanent Link: How to Add Uploaded Media to WP-DownloadManager'>How to Add Uploaded Media to WP-DownloadManager</a></li></ol>]]></description>
			<content:encoded><![CDATA[<p><strong>How to Reset a Form Using Javascript</strong></p>
<pre class="brush: javascript;">
&lt;form&gt;
&lt;input type=&quot;button&quot; onclick=&quot;document.forms[0].reset()&quot; value=&quot;Reset This Form&quot;&gt;
&lt;/form&gt;
</pre>
<p>It doesn&#8217;t clear the data, it just resets all form values to their original value. Here&#8217;s a demo:</p>
<form>
<input type="text" size="20" value="this comes back"></p>
<input type="text" size="20"></p>
<input type="button" class="button" onclick="document.forms[0].reset()" value="Reset This Form">
</form>


<p>Related posts:<ol><li><a href='http://brockangelo.com/2009/06/04/show-forms-when-radio-button-is-clicked/' rel='bookmark' title='Permanent Link: Show Forms When Radio Button is Clicked'>Show Forms When Radio Button is Clicked</a></li><li><a href='http://brockangelo.com/2009/06/19/replace-text-on-click-using-javascript/' rel='bookmark' title='Permanent Link: Replace Text on Click Using JavaScript'>Replace Text on Click Using JavaScript</a></li><li><a href='http://brockangelo.com/2009/05/12/how-to-add-uploaded-media-to-wp-downloadmanager/' rel='bookmark' title='Permanent Link: How to Add Uploaded Media to WP-DownloadManager'>How to Add Uploaded Media to WP-DownloadManager</a></li></ol></p>]]></content:encoded>
			<wfw:commentRss>http://brockangelo.com/2009/06/04/how-to-reset-a-form-using-javascript/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
