<?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/"
	>

<channel>
	<title>Clint Fountain &#187; Programming</title>
	<atom:link href="http://clintfountain.com/?cat=6&#038;feed=rss2" rel="self" type="application/rss+xml" />
	<link>https://clintfountain.com</link>
	<description></description>
	<lastBuildDate>Wed, 12 Dec 2007 22:44:43 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>How to Kill GRUB?</title>
		<link>https://clintfountain.com/?p=12</link>
		<comments>https://clintfountain.com/?p=12#comments</comments>
		<pubDate>Wed, 12 Dec 2007 22:37:51 +0000</pubDate>
		<dc:creator>Clint</dc:creator>
				<category><![CDATA[Programming]]></category>

		<guid isPermaLink="false">http://clintfountain.com/?p=12</guid>
		<description><![CDATA[No, I&#8217;m not talking about those worms in the yard &#8211; this is a computer problem! While experimenting with different Linux OS versions to install on my old laptop, the GRUB bootloader was installed. Actually it was installed by DSL (Damn Small Linux). I loved DSL by the way, but it would not recognize my [...]]]></description>
			<content:encoded><![CDATA[<p>No, I&#8217;m not talking about those worms in the yard &#8211; this is a computer problem! </p>
<p>While experimenting with different Linux OS versions to install on my old laptop, the GRUB bootloader was installed. Actually it was installed by DSL (Damn Small Linux). I loved DSL by the way, but it would not recognize my wireless network card.</p>
<p>Slackware 12 did work well with my card. I had tried it out before DSL, but it ran slowly do to the limited RAM on the laptop. </p>
<p>After I got over the disappointment of discovering that DSL would not work with my wireless network card, I decided to reload Slackware again and use Blackbox or Fluxbox as my GUI. At the very end of the Slackware install is the LILO installation. It failed. I am sure because GRUB was already installed there.</p>
<p>No problem, I&#8217;ll just uninstall GRUB &#8211; simple enough &#8211; or so I thought&#8230;</p>
<p>After hours and hours or failure, I decided to research this online. There was no straight forward way to do this. I saw tons of others with the same problem, but only a few solutions. I tried every recommendation I could find (short of using a Win98 boot disk &#8211; who still has one of those any way?)</p>
<p>24 hours later, I finally removed that nasty GRUB. Here&#8217;s how:</p>
<p>1. Downloaded the <a href="http://ubcd.sourceforge.net/">Ultimate Boot CD 4.1.1</a><br />
2. Burned the CD from an ISO file using NTI CD Maker Gold on my Windows computer.<br />
3. Used the MBRTool found in the Partition Tools menu option.</p>
<p>I don&#8217;t remember the exact options I used but I run several commands using the MBRTool. I just ran every command that had Wipe in the name or description. I wanted that sucker clean &#8211; no fooling around this time! I would advise to use more caution if you are determined to save any of the data on the drive.</p>
<p>When I rebooted, it could not find a bootable drive. Perfect, no GRUB left over. Finally a clean fresh drive to start from. </p>
<p>Now, back to the Slackware install&#8230;</p>
<p>The moral of the story: Linux is not for those who lack temperment control or determination. Best just to leave it to the geeks!</p>
]]></content:encoded>
			<wfw:commentRss>https://clintfountain.com/?feed=rss2&#038;p=12</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Adventures in Linux</title>
		<link>https://clintfountain.com/?p=11</link>
		<comments>https://clintfountain.com/?p=11#comments</comments>
		<pubDate>Wed, 12 Dec 2007 22:11:17 +0000</pubDate>
		<dc:creator>Clint</dc:creator>
				<category><![CDATA[Programming]]></category>

		<guid isPermaLink="false">http://clintfountain.com/?p=11</guid>
		<description><![CDATA[I have this old laptop sitting around collecting dust. I paid good money for this thing 5 or 6 years ago, but now it can&#8217;t run the latest Windows software. Otherwise, it works just fine. So what should I do with it? Problem 1: My old laptop works fine and still has some life in [...]]]></description>
			<content:encoded><![CDATA[<p>I have this old laptop sitting around collecting dust. I paid good money for this thing 5 or 6 years ago, but now it can&#8217;t run the latest Windows software. Otherwise, it works just fine. So what should I do with it?</p>
<p>Problem 1: My old laptop works fine and still has some life in it, but technology has passed it by.<br />
Problem 2: My garage needs to be cleaned and organized in a major way, but I am not that motivated to spend a lot of time out there.<br />
Solution: Maybe I can load Linux on the laptop and use it to play music and videos (and work on my much negleted Myspace page) while I work on the garage.</p>
<p>Next step, see if I can cram a version of Linux onto my Compaq Presario 1700 (P3, 64MB Ram, 6GB HDD)!</p>
]]></content:encoded>
			<wfw:commentRss>https://clintfountain.com/?feed=rss2&#038;p=11</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>IE6 Object Impotent</title>
		<link>https://clintfountain.com/?p=10</link>
		<comments>https://clintfountain.com/?p=10#comments</comments>
		<pubDate>Mon, 09 Jul 2007 19:50:04 +0000</pubDate>
		<dc:creator>Clint</dc:creator>
				<category><![CDATA[Programming]]></category>

		<guid isPermaLink="false">http://clintfountain.com/?p=10</guid>
		<description><![CDATA[Internet Explorer is object impotent. Recently I have started using more advanced Javascript objects structures in my web applications. This beautifies and simplifies the code. Its the right thing to do &#8212; except that IE just can&#8217;t their objects to propagate, if you know what I mean It took me a while to figure this [...]]]></description>
			<content:encoded><![CDATA[<p>Internet Explorer is object impotent. Recently I have started using more advanced Javascript objects structures in my web applications. This beautifies and simplifies the code. Its the right thing to do &#8212; except that IE just can&#8217;t their objects to propagate, if you know what I mean <img src='https://clintfountain.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />  It took me a while to figure this out, so maybe I can save someone else some valuable time. </p>
<p>IE can import objects into a child window, but it cannot pass an object back to the parent/opener window. When this happens, you will run into the following error:</p>
<blockquote><p>The callee (server[not server application]) is not available and disappeared; all connections are invalid. The call did not execute. </p></blockquote>
<p>To fix the problem, create functions in the opener.window or parent.window to build/rebuild/set the objects there. Then call the functions from the child window.</p>
<p>My Scenario:<br />
Main application window trackes times of different events. These times are stored as date objects in a single object called TIMESTAMPS.</p>
<p>When user clicks a button, a new window to verify the times pops up. The window will modify the value of the Date objects in the TIMESTAMPS object in the opener.window.</p>
<p>When the dates are verified, the child window with create new date objects to replace the existing opener.window.TIMESTAMPS objects.</p>
<p>You don&#8217;t notice the problem right away, but the next time you try to access these new date objects, you will recieve the error above.</p>
<p>This only happens in IE, all other browsers operate correctly.</p>
<p>Solution:<br />
Instead of passing the new date objects created in the child window, I created a function in the opener.window to build the objects there. I call the opener function from  the child window. This works well. </p>
<p>Here is the JavaScript function in the opener window:<br />
<code><br />
function setTimestampObject(objName, jsEpoch)<br />
{<br />
	TIMESTAMPS[objName] = new Date(jsEpoch);<br />
}<br />
</code></p>
<p>To set the new date objects I create the date object locally in the child window, but pass the Javascript Epoch timestamp to the opener.setTimestampObject() function like this:<br />
<code><br />
  opener.window.setTimestampObject('starttime', newStart.getTime());<br />
  opener.window.setTimestampObject('endtime', newEnd.getTime());<br />
</code></p>
<p>This will create new starttime and endtime date objects in opener.TIMESTAMPS. So now we can successfully change the values of opener.TIMESTAMPS.starttime and opener.TIMESTAMPS.endtime from the child popup window.</p>
<p>Summary:<br />
IE is impotent. This is just another way that IE is far behind the pack. Urge your friends and colleagues to switch to a standands compliant browser like Firefox. Until Microsoft really makes an effort to fully implement standards, remove security flaws, and fix their existing functionality quirks, their browser should be rightly considered an inferior product.</p>
]]></content:encoded>
			<wfw:commentRss>https://clintfountain.com/?feed=rss2&#038;p=10</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>IE6 Must Die</title>
		<link>https://clintfountain.com/?p=9</link>
		<comments>https://clintfountain.com/?p=9#comments</comments>
		<pubDate>Mon, 09 Jul 2007 19:43:13 +0000</pubDate>
		<dc:creator>Clint</dc:creator>
				<category><![CDATA[Programming]]></category>

		<guid isPermaLink="false">http://clintfountain.com/?p=9</guid>
		<description><![CDATA[It is very unfortunate that the most handicapped browser is the most ubiquitous. It is a situation that I am usually acquiesent about. But I am now fed up. I am ready to move on to the future of web. All of the other browsers are on board, but Microsoft is in no hurry. So [...]]]></description>
			<content:encoded><![CDATA[<p>It is very unfortunate that the most handicapped browser is the most ubiquitous. It is a situation that I am usually acquiesent about. But I am now fed up. I am ready to move on to the future of web.  All of the other browsers are on board, but Microsoft is in no hurry. So we all must suffer.</p>
<p>Us web programmers are forced to turn beautiful code  that works in all real browsers (standards compliant) into bastardized frankenstein-like code to work in Internet Explorer.  They are increasingly the only browser that has to have special code to work. </p>
<p>It is time for a revolt! I am calling on all good web users to not use their Microsoft Internet Explorer browser. Please, for the sake of my fellow programmers&#8217; sanity and your personal security, always use a different browser. Choose a standards compliant browser like Firefox, or my personal favority Opera.</p>
<p>While I hold Microsoft responsible, it is really up to us to fix the problem. Because their browser is installed on all of their Windows machines, many users just use it instead of make a better choice. Since the majority of Internet surfers use their Internet Explorer browser, Microsoft is in no hurry to correct its security problems or standards compliance. When they start lossing market share, they will finally do something about it.</p>
<p>Lets all send a clear message to Microsoft that we want a secure browser that implements the accepted web standards. If they refuse to provide it, we&#8217;ll use their competitors &#8211; like <a href="http://www.mozilla.com/en-US/firefox/">Firefox</a> (or my personal favorite <a href="http://www.opera.com">Opera</a>!)</p>
<p>If your bank or favorite web sites don&#8217;t (or won&#8217;t) work with Firefox, call them an request that they fix their site!</p>
]]></content:encoded>
			<wfw:commentRss>https://clintfountain.com/?feed=rss2&#038;p=9</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Calculate Business Hours</title>
		<link>https://clintfountain.com/?p=7</link>
		<comments>https://clintfountain.com/?p=7#comments</comments>
		<pubDate>Sun, 16 Apr 2006 23:08:42 +0000</pubDate>
		<dc:creator>Clint</dc:creator>
				<category><![CDATA[Programming]]></category>

		<guid isPermaLink="false">http://clintfountain.com/?p=7</guid>
		<description><![CDATA[Don&#8217;t you hate it when customers ask for one thing; then a week after they get it they want something else &#8211; and you knew it all along? Yeah me too. Just like when working on a data management application the customers said they wanted reporting. They agreed that the reporting would be based on [...]]]></description>
			<content:encoded><![CDATA[<p>Don&#8217;t you hate it when customers ask for one thing; then a week after they get it they want something else &#8211; and you knew it all along?</p>
<p>Yeah me too. Just like when working on a data management application the customers said they wanted reporting. They agreed that the reporting would be based on normal calendar days. That was fine. </p>
<p>About a week after implementation they decided that since they didn&#8217;t operate 24&#215;7, their reports should be by business hours. [Oh, that's just great...]</p>
<p>The application was written in Perl. So I figured there was something is CPAN just for the occasion. Sure enough there was. </p>
<p>First I tried the Date::Calc module. I liked the idea that it would work with Date::Manip to automatically handle company holidays.</p>
<p>It worked, but ran waaay too slow. It was fine for a single calculation, but this had to be performed for hundreds or thousands of records. It took several minutes to complete on the old server we had to use.</p>
<p>So instead of wasting more time testing other modules, I just jumped in and wrote one myself. </p>
<p>To my surprise, my homemade version worked extremely fast  &#8211; at least compared to the Date::Calc version.</p>
<p>To be fair I did not test the Business::Hours module. After looking at the source code, it takes a similar approach to my version &#8211; but does not currently exclude holidays.</p>
<p>Here is my solution. One of these days I might make it Object Oriented and turn it into an official module. If I ever get time&#8230;</p>
<p>Note: It assumes workday is 08:00 &#8211; 17:00 (8am &#8211; 5pm).  It does not currently have a way to set this dynamically. [If I ever get time... blah blah blah - you know]<br />
<span id="more-7"></span><br />
Perl source:<br />
<code><br />
sub calcBusinessDays<br />
{<br />
   # calculates business day time difference between two epoch times<br />
   # takes to input parameters, example: calcBusinessDays($epoch1, $epoch2)</p>
<p>   use Date::Manip;<br />
   use Time::Local;<br />
   die print('Program Error: Invalid call to calcBusinessDays().') unless (scalar(@_) == 2);</p>
<p>   my ($endepoch, $startepoch, $businesstime, $thistime, @START, @END);</p>
<p>   # determine start and end<br />
   if ( $_[1] > $_[0] )<br />
   {<br />
      $endepoch = $_[1];<br />
      $startepoch = $_[0];<br />
   }<br />
   else<br />
   {<br />
      $endepoch = $_[0];<br />
      $startepoch = $_[1];<br />
   }</p>
<p>   #load holidays from Date::Manip<br />
   Date_Init('GlobalCnf=/path/to/holiday-config-file',<br />
      'WorkWeekBeg=1',<br />
      'WorkWeekEnd=5',<br />
      'WorkDayBeg=08:00',<br />
      'WorkDayEnd=17:00'); </p>
<p>   $businesstime = 0; #initialize time duration to zero</p>
<p>   # get date/time details<br />
   @END = localtime($endepoch);<br />
   @START = localtime($startepoch);</p>
<p>   # if same day / shortcut<br />
   if ( $END[7] == $START[7] )<br />
   {<br />
      # same day calculation<br />
      my @checkdate = @START;</p>
<p>      $checkdate[4]++; # increase month val to normal val<br />
      $checkdate[4] = sprintf('%02d', $checkdate[4]);<br />
      $checkdate[3] = sprintf('%02d', $checkdate[3]);<br />
      $checkdate[5] += 1900; # increase year to normal val</p>
<p>      # only do if it is a valid workday according to Date::Manip<br />
      if (Date_IsWorkDay(ParseDate($checkdate[5].$checkdate[4].$checkdate[3])))<br />
      {<br />
         # if start time before 8AM set it to 8<br />
         if ( $START[2] < 8 )<br />
         {<br />
            # set start to 8<br />
            $startepoch = timelocal( 0,0,8,$START[3],$START[4],$START[5] );<br />
         }<br />
         elsif ( $START[2] >= 17 )<br />
         {<br />
            # if time is 5PM or after set it to 4:59PM, Used 4:59PM because using<br />
            #    5:00 will get 1 extra second since we include 8:00.<br />
            $startepoch = timelocal(0,59,16,$START[3],$START[4],$START[5]);<br />
         }</p>
<p>         if ( $END[2] < 8 )<br />
         {<br />
            # set start to 8<br />
            $endepoch = timelocal(0,0,8,$END[3],$END[4],$END[5]);<br />
         }<br />
         elsif ( $END[2] >= 17 )<br />
         {<br />
            # if  time is 5PM or after set it to 4:59PM, Used 4:59PM because using<br />
            #   5:00 will get 1 extra second since we include 8:00;<br />
            $endepoch = timelocal(0,59,16,$END[3],$END[4],$END[5]);<br />
         }<br />
         $businesstime = $endepoch - $startepoch;<br />
      }</p>
<p>   }<br />
   else<br />
   {<br />
      # different day calculation</p>
<p>      # Begin with epoch of start day. Used 1:00am instead of 00:00am because<br />
      #    some days have more 86400 seconds due to catch-up times.</p>
<p>      my $thisepoch = timelocal(0,0,1,$START[3],$START[4],$START[5]);</p>
<p>      my $continue = 1;<br />
      while ( $continue ==1 )<br />
      {<br />
         my @THISTIME = localtime($thisepoch);<br />
         my @checkdate = @THISTIME;<br />
         my $isworkday = 0;<br />
         my $thisbusinesstime = 0;</p>
<p>         $checkdate[4]++; # increase month val to normal val<br />
         $checkdate[4] = sprintf('%02d', $checkdate[4]);<br />
         $checkdate[3] = sprintf('%02d', $checkdate[3]);<br />
         $checkdate[5] += 1900; # increase year to normal val</p>
<p>         # check for holiday using date in 'YYYYMMDD' format;<br />
         if (Date_IsWorkDay(ParseDate($checkdate[5].$checkdate[4].$checkdate[3])))<br />
         {<br />
            $isworkday = 1;<br />
         }         </p>
<p>         if ( $THISTIME[7] == $START[7] )<br />
         {<br />
            # first day</p>
<p>            # if stated before 8 on first day add a full day<br />
            if ( $START[2] < = 8 )<br />
            {<br />
               $thisbusinesstime += 8 * 3600;<br />
            }<br />
            elsif ( $START[2] < 17 )<br />
            {<br />
               # if start time is before 5, then add difference in start time and 5<br />
               my $eepoch = timelocal(0,59,16,$START[3],$START[4],$START[5]);<br />
               $thisbusinesstime += $eepoch - $startepoch;<br />
            }</p>
<p>         }<br />
         elsif ( $THISTIME[7] == $END[7] )<br />
         {<br />
            # last day</p>
<p>            # if ended after 5 on last day, add full day<br />
            if ( $END[2] >= 17 )<br />
            {<br />
               $thisbusinesstime += 8 * 3600;<br />
            }<br />
            elsif ( $END[2] >= 8 )<br />
            {<br />
               # if end time is 8 or later, add difference in endepoch and 8am<br />
               my $sepoch = timelocal(0,0,8,$END[3],$END[4],$END[5]);<br />
               $thisbusinesstime += $endepoch - $sepoch;<br />
            }<br />
            $continue = 0; # stop on last day<br />
         }<br />
         else<br />
         {<br />
            # if not first day or last day add a full business day;<br />
            $thisbusinesstime += 8 * 3600;<br />
         }</p>
<p>         # if valid workday, add to total<br />
         if ( $isworkday == 1 )<br />
         {<br />
            $businesstime += $thisbusinesstime;<br />
         }<br />
         $thisepoch += 86400; # go to next day;<br />
      }   </p>
<p>   }<br />
   return $businesstime;<br />
}</p>
<p></code></p>
]]></content:encoded>
			<wfw:commentRss>https://clintfountain.com/?feed=rss2&#038;p=7</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>
