<?xml version="1.0" encoding="utf-8" ?>

<rss version="2.0" 
   xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
   xmlns:admin="http://webns.net/mvcb/"
   xmlns:dc="http://purl.org/dc/elements/1.1/"
   xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
   xmlns:wfw="http://wellformedweb.org/CommentAPI/"
   xmlns:content="http://purl.org/rss/1.0/modules/content/"
   xmlns:creativeCommons="http://backend.userland.com/creativeCommonsRssModule">
<channel>
    <title>mysiteonline™ - Programming</title>
    <link>http://life.mysiteonline.org/</link>
    <description>Brendon Kozlowski's Home on the Web.</description>
    <dc:language>en</dc:language>
    <generator>Serendipity 1.4 - http://www.s9y.org/</generator>
    <pubDate>Tue, 02 Mar 2010 16:35:01 GMT</pubDate>

    <image>
        <url>http://life.mysiteonline.org/templates/default/img/s9y_banner_small.png</url>
        <title>RSS: mysiteonline™ - Programming - Brendon Kozlowski's Home on the Web.</title>
        <link>http://life.mysiteonline.org/</link>
        <width>100</width>
        <height>21</height>
    </image>

<item>
    <title>Website Render Time with PHP &gt;= 5.1</title>
    <link>http://life.mysiteonline.org/archives/190-Website-Render-Time-with-PHP-5.1.html</link>
            <category>PHP</category>
    
    <comments>http://life.mysiteonline.org/archives/190-Website-Render-Time-with-PHP-5.1.html#comments</comments>
    <wfw:comment>http://life.mysiteonline.org/wfwcomment.php?cid=190</wfw:comment>

    <slash:comments>0</slash:comments>
    <wfw:commentRss>http://life.mysiteonline.org/rss.php?version=2.0&amp;type=comments&amp;cid=190</wfw:commentRss>
    

    <author>nospam@example.com (Brendon Kozlowski)</author>
    <content:encoded>
    In CakePHP v1.3.x, there will no longer be an automatic dump of tons of information (probably because the DebugKit plugin can handle all of that information for us) when in debug mode. However, in my non-CakePHP websites, and even in my Cake websites, I have become accustomed to viewing the source to see a full render time for the page in an HTML comment.  Thanks to the help of &quot;jnay&quot; over at &lt;a href=&quot;http://cakeqs.org/eng/questions/view/what_do_i_set_in_the_controller_to_send_total_render_time_to_the_view&quot;&gt;CakeQs.org&lt;/a&gt;, I&#039;ve found out about a new (as of PHP 5.1) $_SERVER variable argument called &quot;REQUEST_TIME&quot;.  It holds the UNIX timestamp of the initiation of the call.&lt;br /&gt;
&lt;br /&gt;
By using this variable, along with the optional boolean argument for microtime (as of PHP 5.0.0), we can determine the HTML render time of our application with the following calculation in either our footer view/template, or controller (preferably in the last possible iteration of your project&#039;s render):&lt;br /&gt;
&lt;textarea name=&quot;code&quot; class=&quot;php&quot;&gt;&lt;?php
	echo microtime(true) - $_SERVER[&#039;REQUEST_TIME&#039;];
?&gt;&lt;/textarea&gt;&lt;br /&gt;
The echo is optional and used only as an example here; it simply depends on how you use the calculation in your script(s)/framework(s). This is much easier than starting the timer in the header and calculating the difference in the footer like I had to do in the PHP 4 days!&lt;br /&gt;
&lt;br /&gt;
Remember, this is only for trivial estimations and comparisons. If you need to thoroughly evaluate your script(s) for time efficiency you should be using something else, such as &lt;a href=&quot;http://xdebug.org/&quot;&gt;Xdebug&lt;/a&gt; and a form of CacheGrind for your choice of OS. 
    </content:encoded>

    <pubDate>Tue, 02 Mar 2010 08:35:01 -0800</pubDate>
    <guid isPermaLink="false">http://life.mysiteonline.org/archives/190-guid.html</guid>
    <creativeCommons:license>http://creativecommons.org/licenses/by/3.0/</creativeCommons:license>
</item>
<item>
    <title>Cassie Print Station - Automatically Close the Window</title>
    <link>http://life.mysiteonline.org/archives/188-Cassie-Print-Station-Automatically-Close-the-Window.html</link>
            <category>Programming</category>
    
    <comments>http://life.mysiteonline.org/archives/188-Cassie-Print-Station-Automatically-Close-the-Window.html#comments</comments>
    <wfw:comment>http://life.mysiteonline.org/wfwcomment.php?cid=188</wfw:comment>

    <slash:comments>0</slash:comments>
    <wfw:commentRss>http://life.mysiteonline.org/rss.php?version=2.0&amp;type=comments&amp;cid=188</wfw:commentRss>
    

    <author>nospam@example.com (Brendon Kozlowski)</author>
    <content:encoded>
    Cassie is a PC Reservation Management system software built for libraries, or other venues that wish to offer multiple PCs for the public to use. It also has a print management station.  Unfortunately, as of the current version, when a user goes to view their own print jobs, their account window stays active &quot;forever&quot; until they, or someone else clicks on the &quot;Close&quot; button.  When using with a JAMEX corporation coinbox, it also doesn&#039;t give the user their change until the window is closed (insert $1.00 for a $0.60 charge, it won&#039;t expell the $0.40 until the window is closed).&lt;br /&gt;
&lt;br /&gt;
This is a bit of a problem.&lt;br /&gt;
&lt;br /&gt;
I&#039;ve used AutoIT, an automation scripting language, to automate the process of a user clicking on the close button. The makers of Cassie didn&#039;t make it easy though, I was unable to detect the actual button, thankfully ALT+F4 worked (ESC worked until the JAMEX portion was added, for some reason it stopped working afterward).&lt;br /&gt;
&lt;br /&gt;
&lt;textarea name=&quot;code&quot; class=&quot;plain&quot;&gt;#include &lt;Timers.au3&gt;

;declare variables
$idletime = 0;
$seconds_to_wait = 45;
$action_time = 1000 * $seconds_to_wait;

while 1
	$idletime = _Timer_GetIdleTime();
	If $idletime &gt;= $action_time Then
		WinWait(&quot;[CLASS:#32770; TITLE:Show Print Jobs]&quot;);
		If Not WinActive(&quot;[CLASS:#32770; TITLE:Show Print Jobs]&quot;) Then WinActivate(&quot;[CLASS:32770; TITLE:Show Print Jobs]&quot;);
		WinWaitActive(&quot;[CLASS:#32770; TITLE:Show Print Jobs]&quot;);
		Send(&quot;!{F4}&quot;);	issues an ALT+F4 command via mimicked keyboard input
	EndIf
	Sleep(100);			wait 100 milliseconds before checking again
WEnd&lt;/textarea&gt;&lt;br /&gt;
&lt;br /&gt;
This uses the included Timers.au3 file to do most of the dirty work in detecting an idle state. If the computer is left idle for 45 seconds, it will issue ALT+F4 and close the window. ALT+F4 cannot close the application itself in this instance (and won&#039;t be issued unless that window exists and is active anyway).  Although it checks every 100 milliseconds and runs at all times that the computer is turned on, I tested the resources it takes up...it was &lt;em&gt;barely&lt;/em&gt; noticeable on an old P4 @ 2.80 GHz w/2.86 GB RAM (my work PC).  This application (once compiled with AutoIT) should be placed in the Windows&#039; Startup folder (or a respective registry key). 
    </content:encoded>

    <pubDate>Fri, 19 Feb 2010 20:05:48 -0800</pubDate>
    <guid isPermaLink="false">http://life.mysiteonline.org/archives/188-guid.html</guid>
    <creativeCommons:license>http://creativecommons.org/licenses/by/3.0/</creativeCommons:license>
</item>
<item>
    <title>Server Load, Take 2</title>
    <link>http://life.mysiteonline.org/archives/185-Server-Load,-Take-2.html</link>
            <category>PHP</category>
    
    <comments>http://life.mysiteonline.org/archives/185-Server-Load,-Take-2.html#comments</comments>
    <wfw:comment>http://life.mysiteonline.org/wfwcomment.php?cid=185</wfw:comment>

    <slash:comments>1</slash:comments>
    <wfw:commentRss>http://life.mysiteonline.org/rss.php?version=2.0&amp;type=comments&amp;cid=185</wfw:commentRss>
    

    <author>nospam@example.com (Brendon Kozlowski)</author>
    <content:encoded>
    So I worked on the CakePHP plugin for Prowl a bit more, and in doing so, I created shell-based access to the plugin.  I can now send Prowl messages from the console (i.e.: I can run PHP via cron to check on things and send myself the results, if necessary).  A shell task I created was for server load, as a followup to my &lt;a href=&quot;http://life.mysiteonline.org/archives/183-iPhone-Server-Alerting-on-High-Load.html&quot;&gt;previous post&lt;/a&gt;.  In working this out, I&#039;ve modified the output for CakePHP&#039;s Shell::out() method so that it auto-wraps and indents a bit more nicely (my ticket in the LighthouseApp is &lt;a href=&quot;http://cakephp.lighthouseapp.com/projects/42648/tickets/274-enhancement-easier-auto-formatting-for-shell-output-patch-offered-awaiting-feedback&quot;&gt;here&lt;/a&gt;).  Time for some output examples:&lt;br /&gt;
&lt;br /&gt;
Issuing the Load Alert help call: &lt;tt&gt;cake prowl load_alert help&lt;/tt&gt;&lt;br /&gt;
&lt;textarea name=&quot;code&quot; class=&quot;php&quot; &gt;---------------------------------------------------------------
CakePHP Prowl Load Alert Console Task
Usage: cake prowl load_alert &lt;params values&gt; &lt;args&gt;
Description: This task tests the current server load and issues a Prowl message (if required) to the passed parameter list of Prowl APIs indicating the server load.
---------------------------------------------------------------
Parameters:
        -silent &lt;false&gt;

Commands:
        help
                Shows this help message.

Arguments:
        apikey
                Up to 5 comma separated Prowl API keys
&lt;/textarea&gt;&lt;br /&gt;
&lt;br /&gt;
Sending a message is as simple as: &lt;tt&gt;cake prowl msg [apikey]&lt;/tt&gt; ... it can get as advanced as &lt;tt&gt;cake prowl msg [apikey] [priority] [application] [event] [description]&lt;/tt&gt;&lt;br /&gt;
&lt;br /&gt;
The output for running the load alert command?&lt;br /&gt;
&lt;textarea name=&quot;code&quot; class=&quot;php&quot; &gt;Checking for high server load...
Server load: 4.81 5.25 6.44
Server is running with an acceptable load.&lt;/textarea&gt;&lt;br /&gt;
If it&#039;s above my arbitrarily set values, it&#039;ll send a different warning depending on the level to my Prowl-enabled device.  By sending a &quot;-silent 1&quot; parameter to the command message, output is disabled (perfect for cron).&lt;br /&gt;
&lt;br /&gt;
Please note that I don&#039;t have any styling for shell output (something I&#039;ll have to fix) so the pasted character spacing and newlines won&#039;t work as expected in my example output. 
    </content:encoded>

    <pubDate>Fri, 29 Jan 2010 19:48:36 -0800</pubDate>
    <guid isPermaLink="false">http://life.mysiteonline.org/archives/185-guid.html</guid>
    <creativeCommons:license>http://creativecommons.org/licenses/by/3.0/</creativeCommons:license>
</item>
<item>
    <title>Creating an array of date time values via PHP</title>
    <link>http://life.mysiteonline.org/archives/179-Creating-an-array-of-date-time-values-via-PHP.html</link>
            <category>PHP</category>
    
    <comments>http://life.mysiteonline.org/archives/179-Creating-an-array-of-date-time-values-via-PHP.html#comments</comments>
    <wfw:comment>http://life.mysiteonline.org/wfwcomment.php?cid=179</wfw:comment>

    <slash:comments>2</slash:comments>
    <wfw:commentRss>http://life.mysiteonline.org/rss.php?version=2.0&amp;type=comments&amp;cid=179</wfw:commentRss>
    

    <author>nospam@example.com (Brendon Kozlowski)</author>
    <content:encoded>
    I was working on my &lt;a href=&quot;http://life.mysiteonline.org/comment.php?type=trackback&amp;amp;entry_id=173&quot;&gt;Reference Statistics Tracker&lt;/a&gt; for work, and ran in to a snag.&lt;br /&gt;
&lt;br /&gt;
I am using eZ Components&#039; ezGraph class to create image-based graphs on the fly.  It&#039;s fast, efficient, and it looks nice - it can even render in SVG (I&#039;ll be using JPG or PNG...thanks IE).  For my particular needs, I wanted the exported dataset to have a specific formatting to the keys, to represent the different values in my graphs.  For instance, let&#039;s say I have the following stats from 100 users in our company, and the Operating System they use.  This is purely fictitious:&lt;pre&gt;array(&#039;Windows&#039; =&gt; 90, &#039;OSX&#039; =&gt; 6, &#039;Other&#039; =&gt; 4);&lt;/pre&gt;That specific array is crafted perfectly in the format that works well with eZ Components&#039; Graphing class, for a simple bar chart, or a pie chart.&lt;br /&gt;
&lt;br /&gt;
So now I just had to pull the values from the database in the format I wanted.  Well my keys in this case were dates, or times (span of days, or hours in a day, or month in a year, etc...).  The values were still numeric values in this case.  So, we&#039;re looking at something like: &lt;pre&gt;array(&#039;HH:MM:SS&#039; =&gt; 10);&lt;/pre&gt;However, no matter how hard I tried, if there were no values inserted in to the database for a specific time, I could not return a value of null, or zero - even with an outer join.  My next thought was to use something like array_merge() on the resulting dataset to fix it.&lt;br /&gt;
&lt;br /&gt;
The PHP function of range() just didn&#039;t cut it.  Although I could have converted the datetime values to timestamp values (either via SQL or PHP), and used the 3rd parameter of the function to add the specific number of seconds needed, I was weary of doing that as I remember reading about issues that could cause (adding seconds to a timestamp value calculate future time).  Besides, I&#039;d still have to use array_walk() or array_map() to format my array&#039;s keys the way I wanted; that left yet another function, and a line of code for the call to array_walk/map.  (My host does not yet have PHP 5.3.x, which will allow for lambda functions in array_map.)  So, I decided to create my own little function, and figured I&#039;d post it here in case (1)someone could use it and it&#039;d help them out, or (2)someone thinks there&#039;s a more efficient way of doing this and wants to give feedback.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;textarea name=&quot;code&quot; class=&quot;php&quot;&gt;&lt;?php
//$datetime_start - expects a strtotime compatible value
//$datetime_end - expects a strtotime compatible value
//$interval - can take either a strtotime compatible modifier (i.e.: -1 day), or an integer,
//	which will be perceived as total seconds and converted to a strtotime compatible modifier
//$format - the format of the key for the array&#039;s key/value pair (see php.net/date for formatting options)
//$value - the default value to be set for the blank array which will be used in a followup array_merge call.
function datetime_range($datetime_start, $datetime_stop, $interval, $format, $value = 0){
	if(is_int($interval)){
		$interval = $interval . &#039; seconds&#039;;
	}
	$range = array();
	$datetime_start = strtotime($datetime_start);
	$datetime_stop  = strtotime($datetime_stop);
	for($curTime = $datetime_start; $curTime &lt;= $datetime_stop; $curTime = strtotime(date(&#039;r&#039;, $curTime) . &#039; + &#039;.$interval)){
		$range[date($format, $curTime)] = $value;
	}
	return $range;
}

//TIME FOR AN EXAMPLE OF USAGE:
$myArray = array(&#039;10/01&#039; =&gt;3, &#039;10/04&#039; =&gt; 7, &#039;10/05&#039; =&gt; 4);
$default = datetime_range(&#039;2009-10-01 00:00:00&#039;, &#039;2009-10-05 00:00:00&#039;, &#039;1 day&#039;, &#039;m/d&#039;);
$myArray = array_merge($default, $myArray);
print_r($myArray);

/************ this would have printed ************
Array(
	[10/01] =&gt; 3
	[10/02] =&gt; 0
	[10/03] =&gt; 0
	[10/04] =&gt; 7
	[10/05] =&gt; 4
)
********************************************/
?&gt;&lt;/textarea&gt;&lt;br /&gt;
This could be useful for similar graphing/charting code, I don&#039;t think it&#039;s specific to eZ Components&#039;.  Perhaps it could be useful for something else that I can&#039;t think of.  Have fun with it. 
    </content:encoded>

    <pubDate>Thu, 22 Oct 2009 15:29:13 -0700</pubDate>
    <guid isPermaLink="false">http://life.mysiteonline.org/archives/179-guid.html</guid>
    <creativeCommons:license>http://creativecommons.org/licenses/by/3.0/</creativeCommons:license>
</item>
<item>
    <title>Adobe AIR, SQLite, DATETIME, and weirdness.</title>
    <link>http://life.mysiteonline.org/archives/177-Adobe-AIR,-SQLite,-DATETIME,-and-weirdness..html</link>
            <category>Programming</category>
    
    <comments>http://life.mysiteonline.org/archives/177-Adobe-AIR,-SQLite,-DATETIME,-and-weirdness..html#comments</comments>
    <wfw:comment>http://life.mysiteonline.org/wfwcomment.php?cid=177</wfw:comment>

    <slash:comments>0</slash:comments>
    <wfw:commentRss>http://life.mysiteonline.org/rss.php?version=2.0&amp;type=comments&amp;cid=177</wfw:commentRss>
    

    <author>nospam@example.com (Brendon Kozlowski)</author>
    <content:encoded>
    Here I was, minding my own business, when I try to insert the current time in to a SQLite database via Adobe AIR.  AIR has some internal mechanisms to actually give you an error if you don&#039;t insert the proper type in to an SQLite database (unlike SQLite itself, which will let you put anything in to any type of field - it just casts the values, from what I understand).  Well, it &lt;em&gt;sort of&lt;/em&gt; inserted the current time.  SQLite has a shorthand insertion value for DATETIME fields when inserting the string value of &quot;now&quot;.  It will insert (you guessed it), the current time as it is NOW.  When you view the &quot;current&quot; time, however...let&#039;s say the current date and time is: Tuesday, September 8th 2009 at 2:46:21pm EDT (that is 4 hours behind GMT).  So when viewing the &quot;current&quot; time that you just inserted in to your SQLite database, you will see:&lt;br /&gt;
&lt;strong&gt;Tue Sep 8 2009 18:46:21 -0400 GMT&lt;/strong&gt;&lt;br /&gt;
&lt;br /&gt;
...what?&lt;br /&gt;
&lt;br /&gt;
Okay, I get the military time, but, wouldn&#039;t that be 6pm?  It&#039;s showing my timezone as EDT (-4 hours from GMT), so why is it listing 4 hours difference?!&lt;br /&gt;
&lt;br /&gt;
Well, the answer basically is: I have no idea why it lists the timezone the way it does.  If you want to insert your local time, you need to use the following:&lt;br /&gt;
&lt;textarea name=&quot;code&quot; class=&quot;sql&quot;&gt;INSERT INTO `test_table` (`any_date`) VALUES (DATETIME(&quot;now&quot;, &quot;localtime&quot;));&lt;/textarea&gt;&lt;br /&gt;
&lt;br /&gt;
The shorthand property of &quot;now&quot; can also be written as &quot;DATETIME(&#039;now&#039;)&quot;, and the DATETIME method (in SQLite) apparently takes more than one parameter, and had I known what my issue was in the first place, it would have been easier to track down.  You can find (as of September 8, 2009) SQLite&#039;s date and time methods at the following URL: &lt;a href=&quot;http://www.sqlite.org/lang_datefunc.html&quot;&gt;SQLite Date and Time Functions&lt;/a&gt;.&lt;br /&gt;
&lt;br /&gt;
Hopefully someone else doing a web search while grasping for straws might find this, and it&#039;ll help them out, rather than have them waste the better part of a day scratching their head, thinking of a workaround but knowing they must be missing something simple. 
    </content:encoded>

    <pubDate>Tue, 08 Sep 2009 18:42:20 -0700</pubDate>
    <guid isPermaLink="false">http://life.mysiteonline.org/archives/177-guid.html</guid>
    <creativeCommons:license>http://creativecommons.org/licenses/by/3.0/</creativeCommons:license>
</item>
<item>
    <title>Disable the Security Component in CakePHP only for Certain Actions</title>
    <link>http://life.mysiteonline.org/archives/175-Disable-the-Security-Component-in-CakePHP-only-for-Certain-Actions.html</link>
            <category>PHP</category>
    
    <comments>http://life.mysiteonline.org/archives/175-Disable-the-Security-Component-in-CakePHP-only-for-Certain-Actions.html#comments</comments>
    <wfw:comment>http://life.mysiteonline.org/wfwcomment.php?cid=175</wfw:comment>

    <slash:comments>0</slash:comments>
    <wfw:commentRss>http://life.mysiteonline.org/rss.php?version=2.0&amp;type=comments&amp;cid=175</wfw:commentRss>
    

    <author>nospam@example.com (Brendon Kozlowski)</author>
    <content:encoded>
    As I&#039;m working on a desktop application that needs to connect to the database backend, and CakePHP provides an awesome mechanism for REST or AJAX communication (as well as data validation), I decided to have my desktop application talk directly through the Cake interface to do its magic.&lt;br /&gt;
&lt;br /&gt;
Unfortunately, I was also using CakePHP&#039;s rather secure Security component to prevent XSS/CSRF attacks.  The problem is that because the desktop application was directly accessing the method with data and bypassing CakePHP&#039;s FormHelper automatically created (and Security Component friendly) rendered HTML, it was failing (and because it wouldn&#039;t even get to the action since the Security Component was set in the AppController, I couldn&#039;t even use $this-&gt;log($this, LOG_DEBUG) to see what was happening).&lt;br /&gt;
&lt;br /&gt;
After searching for a good 30 minutes or so, I came across &lt;a href=&quot;http://n2.nabble.com/how-to-disable-security-component-for-a-single-action-td682715.html&quot;&gt;this archived Google Group post&lt;/a&gt; by franky06l:&lt;br /&gt;
&lt;textarea name=&quot;code&quot; class=&quot;php&quot;&gt;if(isset($this-&gt;Security) &amp;&amp;amp; $this-&gt;action = &#039;myaction&#039;))
     $this-&gt;Security-&gt;enabled = false;&lt;/textarea&gt;I updated this to only be used in my specific controller&#039;s action, as so:&lt;br /&gt;
&lt;textarea name=&quot;code&quot; class=&quot;php&quot;&gt;function beforeFilter(){
	parent::beforeFilter();
	if(isset($this-&gt;Security) &amp;&amp;amp; $this-&gt;RequestHandler-&gt;isAjax() &amp;&amp;amp; $this-&gt;action = &#039;add&#039;){
 		$this-&gt;Security-&gt;enabled = false; 
	}
}&lt;/textarea&gt;Voila!  It now works as expected.&lt;br /&gt;
&lt;br /&gt;
&lt;strong&gt;Note:&lt;/strong&gt; One will need to be extra cautious when disabling the Security Component.  The Security Component takes care of a lot of issues for us automatically, by disabling it, you&#039;re opening yourself up to some possible troubles.  Extra precaution is recommended, and I relinquish myself from any use of the above code that may cause harm - use at your own peril (or absolute need)!  &lt;img src=&quot;http://life.mysiteonline.org/templates/default/img/emoticons/laugh.png&quot; alt=&quot;:-D&quot; style=&quot;display: inline; vertical-align: bottom;&quot; class=&quot;emoticon&quot; /&gt; 
    </content:encoded>

    <pubDate>Wed, 26 Aug 2009 12:58:35 -0700</pubDate>
    <guid isPermaLink="false">http://life.mysiteonline.org/archives/175-guid.html</guid>
    <creativeCommons:license>http://creativecommons.org/licenses/by/3.0/</creativeCommons:license>
</item>
<item>
    <title>Event Driven Programming</title>
    <link>http://life.mysiteonline.org/archives/170-Event-Driven-Programming.html</link>
            <category>Programming</category>
    
    <comments>http://life.mysiteonline.org/archives/170-Event-Driven-Programming.html#comments</comments>
    <wfw:comment>http://life.mysiteonline.org/wfwcomment.php?cid=170</wfw:comment>

    <slash:comments>0</slash:comments>
    <wfw:commentRss>http://life.mysiteonline.org/rss.php?version=2.0&amp;type=comments&amp;cid=170</wfw:commentRss>
    

    <author>nospam@example.com (Brendon Kozlowski)</author>
    <content:encoded>
    Event Driven Programming...  I always thought that event driven programming could still use procedural style programming, and use event-driven only when necessary.  ...and although that may be the case, I&#039;m finding that Adobe AIR is built primarily as a fully event driven model.  I&#039;ve tried to coerce it in to doing procedural things and it just scoffs at me.  I&#039;m sure there are ways to have it work procedurally, but I&#039;m not versed well-enough in it yet to know how, as it apparently expects all actions to be asynchronous.&lt;br /&gt;
&lt;br /&gt;
Here&#039;s what I&#039;m learning I need to do in order to invoke a &quot;setup&quot; window prior to invocation of my main program for the first time.&lt;br /&gt;
&lt;ol&gt;&lt;li&gt;Invoke main application, hidden.&lt;/li&gt;&lt;li&gt;Detect if the settings file exists (hey, procedural, sweet!), if not...&lt;/li&gt;&lt;li&gt;Open a new window (hidden), set an event listener for its close.&lt;/li&gt;&lt;li&gt;In the new window, retrieve optional settings choices from the server; in the &quot;success&quot; event listener, dynamically fill the window with the options/controls...in the &quot;fail&quot; listener, close the new window and application window after displaying an error message (initial setup absolutely requires communication from the server).&lt;/li&gt;&lt;li&gt;Upon submit of the setup window, close the window, revert data back to the calling/parent window.&lt;/li&gt;&lt;li&gt;The closed window event runs...we re-fetch data from the server based on the setup window&#039;s choices (or from the settings file, if it existed - but that&#039;s another path that reaches the same point).&lt;/li&gt;&lt;li&gt;On success, we build the main window&#039;s GUI from fetched data and then set the window to visible. On failure, at this point in development, we also close with an error.&lt;/li&gt;&lt;/ol&gt;&lt;br /&gt;
...and that&#039;s just to get the app to open properly.  I&#039;m not even sure if I&#039;ve thought it through well enough.  It&#039;s currently all still in procedural spaghetti code with errors abound.  I thought of this after leaving work...so who knows if this&#039;ll even work. Ha! 
    </content:encoded>

    <pubDate>Thu, 30 Jul 2009 19:55:43 -0700</pubDate>
    <guid isPermaLink="false">http://life.mysiteonline.org/archives/170-guid.html</guid>
    <creativeCommons:license>http://creativecommons.org/licenses/by/3.0/</creativeCommons:license>
</item>
<item>
    <title>Outlook Web Access (Exchange) with PHP and cURL</title>
    <link>http://life.mysiteonline.org/archives/165-Outlook-Web-Access-Exchange-with-PHP-and-cURL.html</link>
            <category>PHP</category>
    
    <comments>http://life.mysiteonline.org/archives/165-Outlook-Web-Access-Exchange-with-PHP-and-cURL.html#comments</comments>
    <wfw:comment>http://life.mysiteonline.org/wfwcomment.php?cid=165</wfw:comment>

    <slash:comments>4</slash:comments>
    <wfw:commentRss>http://life.mysiteonline.org/rss.php?version=2.0&amp;type=comments&amp;cid=165</wfw:commentRss>
    

    <author>nospam@example.com (Brendon Kozlowski)</author>
    <content:encoded>
    I needed a way to authenticate users from our library from a server &lt;em&gt;outside&lt;/em&gt; our network, and therefore also not connected to Active Directory.  At first I was thinking LDAP would be the best way...then I did my research and learned enough about LDAP to realize just how much information it gives out - WAY too much for it to be very secure.  Even if I used SSL, created an account specifically for this access, set that account to read only...all it would take would be one person to hack our server and grab that information and all our organization&#039;s data is out there.  Although it&#039;s about as much of a chance as getting hit by lightning in the middle of the desert in a sand storm, I wouldn&#039;t want to be responsible.&lt;br /&gt;
&lt;br /&gt;
The only server with any sort of external web presence that is also touching the internet is our Exchange server&#039;s web access portal.  I thought, &quot;Ah HA! I can use cURL, or streams, or fsockopen or something to fake a login to this page to verify authentication!&quot;  After searching a bit (I&#039;m terrible every time I attempt to write something using cURL to authenticate), I came across a few things.&lt;br /&gt;
&lt;br /&gt;
&lt;ol&gt;&lt;li&gt;Exchange Server 2007 uses SOAP to provide a web service...AWESOME!  We currently use 2003 though, but we will be upgrading later this year, so this may be helpful later on. &lt;a href=&quot;http://msdn.microsoft.com/en-us/library/aa579187.aspx&quot;&gt;[Link]&lt;/a&gt;&lt;ol type=&quot;a&quot;&gt;&lt;li&gt;&lt;a href=&quot;http://www.howtoforge.com/talking-soap-with-exchange&quot;&gt;HowToForge article on how to use PHP with 2007&#039;s SOAP Web Service&lt;/a&gt;&lt;/li&gt;&lt;/ol&gt;&lt;/li&gt;&lt;li&gt;I found &lt;a href=&quot;http://cadmuslabs.net/index.php?entry=entry081230-075614&quot;&gt;this PHP script&lt;/a&gt; that I tested, which successfully contacted our OWA server and authenticated.&lt;/li&gt;&lt;li&gt;I also found a PHP class on &lt;a href=&quot;http://code.google.com/p/tylerhall/source/browse/trunk/outlook-web-access/owa.php&quot;&gt;Google Code&lt;/a&gt; from Tyler Hall - it&#039;s not any particular project repository, just miscellaneous code he&#039;s hosting.  It looks like it&#039;s slightly more feature rich, allowing info from address books and a user&#039;s inbox, for example.&lt;/li&gt;&lt;/ol&gt;&lt;br /&gt;
&lt;br /&gt;
I only needed to authenticate our building, so thankfully we had our own subdomain (not sure of the proper terminology) in the AD...  If your domain was example.com (DC=example,DC=com), just getting OUR office (assume &quot;Office1&quot;) was as easy as defining office1.example.com (DC=office1,DC=example,DC=com) after the @ symbol in the user&#039;s username (typically unnecessary information with OWA, but adding it explicitly was important here).  It (seemingly) worked perfectly.&lt;br /&gt;
&lt;br /&gt;
If you plan on doing something similar, just make sure that you cache (and encrypt) username/password information locally, hitting the OWA page continuously would probably make your System (or Email) Administrators a little unhappy with you. 
    </content:encoded>

    <pubDate>Fri, 13 Mar 2009 10:43:40 -0700</pubDate>
    <guid isPermaLink="false">http://life.mysiteonline.org/archives/165-guid.html</guid>
    <creativeCommons:license>http://creativecommons.org/licenses/by/3.0/</creativeCommons:license>
</item>
<item>
    <title>Handy Little Tool: XPath Checker</title>
    <link>http://life.mysiteonline.org/archives/164-Handy-Little-Tool-XPath-Checker.html</link>
            <category>Programming</category>
    
    <comments>http://life.mysiteonline.org/archives/164-Handy-Little-Tool-XPath-Checker.html#comments</comments>
    <wfw:comment>http://life.mysiteonline.org/wfwcomment.php?cid=164</wfw:comment>

    <slash:comments>0</slash:comments>
    <wfw:commentRss>http://life.mysiteonline.org/rss.php?version=2.0&amp;type=comments&amp;cid=164</wfw:commentRss>
    

    <author>nospam@example.com (Brendon Kozlowski)</author>
    <content:encoded>
    Occasionally I&#039;m working on something that has to scrape data, either from an HTML file, XML, or something similar.  I&#039;ll often think of XPath for its sheer simplicity over REGEX.  Thankfully, while looking for a solution on how to &quot;screen scrape&quot; Outlook Web Access to verify login credentials (mimic internal authentication to AD externally), I accidentally came across a blog post discussing this Firefox plugin by Brian Slesinsky.  It allows you to simply right click on a DOM node in a page (or source file) and visually test your XPath queries to see the matches it will give back.&lt;br /&gt;
&lt;br /&gt;
&lt;a href=&quot;https://addons.mozilla.org/en-US/firefox/addon/1095&quot;&gt;Firefox Plugin: XPath Checker&lt;/a&gt; 
    </content:encoded>

    <pubDate>Fri, 13 Mar 2009 09:44:54 -0700</pubDate>
    <guid isPermaLink="false">http://life.mysiteonline.org/archives/164-guid.html</guid>
    <creativeCommons:license>http://creativecommons.org/licenses/by/3.0/</creativeCommons:license>
</item>
<item>
    <title>Automatic Post Creation with Wordpress, PHP, and XML-RPC</title>
    <link>http://life.mysiteonline.org/archives/161-Automatic-Post-Creation-with-Wordpress,-PHP,-and-XML-RPC.html</link>
            <category>PHP</category>
    
    <comments>http://life.mysiteonline.org/archives/161-Automatic-Post-Creation-with-Wordpress,-PHP,-and-XML-RPC.html#comments</comments>
    <wfw:comment>http://life.mysiteonline.org/wfwcomment.php?cid=161</wfw:comment>

    <slash:comments>34</slash:comments>
    <wfw:commentRss>http://life.mysiteonline.org/rss.php?version=2.0&amp;type=comments&amp;cid=161</wfw:commentRss>
    

    <author>nospam@example.com (Brendon Kozlowski)</author>
    <content:encoded>
    &lt;p&gt;So, for those of you who read my last blog post, you might notice that I was having issues with a script I wrote to create a new post in Wordpress when it came time to upgrade the Wordpress code.&amp;#160; The SQL internals were modified, and I was inserting directly in to the database (yes, I know, I broke a cardinal rule).&amp;#160; I needed an alternative way to insert information in to the database that would be much more future-proof.&amp;#160; I remembered about XML-RPC.&lt;/p&gt;  &lt;p&gt;It took me some time to find answers to questions I had about XML-RPC and the Wordpress’ API.&amp;#160; Wordpress comes with the ability to use XML-RPC, and AtomPub.&amp;#160; With regards to XML-RPC, it supports a few protocols:&lt;/p&gt;  &lt;ol&gt;   &lt;li&gt;MetaWeblog &lt;/li&gt;    &lt;li&gt;Movable Type &lt;/li&gt;    &lt;li&gt;Blogger &lt;/li&gt;    &lt;li&gt;Wordpress’ own methods &lt;/li&gt; &lt;/ol&gt;  &lt;p&gt;Since there was little written documentation as to how to do this, I thought I’d share my findings.&amp;#160; Also, although the Blogger API was very easy to figure out and use, I’m not going to cover it here mainly because it doesn’t support the creation of a title field – something for my purposes were required.&amp;#160; (To access the blogger API, I used &lt;a href=&quot;http://dentedreality.com.au/projects/phpbloggerapi/class/&quot;&gt;this class&lt;/a&gt;.)&amp;#160; I’m also only going to cover what’s necessary to create a new post for my own means, nothing more – hopefully it’ll get you on your way to how you’d like to use it.&lt;/p&gt;  &lt;br /&gt;&lt;a href=&quot;http://life.mysiteonline.org/archives/161-Automatic-Post-Creation-with-Wordpress,-PHP,-and-XML-RPC.html#extended&quot;&gt;Continue reading &quot;Automatic Post Creation with Wordpress, PHP, and XML-RPC&quot;&lt;/a&gt;
    </content:encoded>

    <pubDate>Wed, 11 Feb 2009 10:06:51 -0800</pubDate>
    <guid isPermaLink="false">http://life.mysiteonline.org/archives/161-guid.html</guid>
    <creativeCommons:license>http://creativecommons.org/licenses/by/3.0/</creativeCommons:license>
</item>
<item>
    <title>Be careful when using an unfamiliar coding language</title>
    <link>http://life.mysiteonline.org/archives/156-Be-careful-when-using-an-unfamiliar-coding-language.html</link>
            <category>Programming</category>
    
    <comments>http://life.mysiteonline.org/archives/156-Be-careful-when-using-an-unfamiliar-coding-language.html#comments</comments>
    <wfw:comment>http://life.mysiteonline.org/wfwcomment.php?cid=156</wfw:comment>

    <slash:comments>2</slash:comments>
    <wfw:commentRss>http://life.mysiteonline.org/rss.php?version=2.0&amp;type=comments&amp;cid=156</wfw:commentRss>
    

    <author>nospam@example.com (Brendon Kozlowski)</author>
    <content:encoded>
    So, I was learning a scripting language awhile back to help automate and secure some things with our public computers.  The scripting language is for use with an application called &quot;&lt;a href=&quot;http://www.autoitscript.com/&quot;&gt;AutoIT&lt;/a&gt;&quot;, which is, well, both a compiler and run-time for the scripts themselves.&lt;br /&gt;
&lt;br /&gt;
I needed to detect if an application window was present on the screen, and if it was, take appropriate action.  So, looking at the following code documentation:&lt;br /&gt;
&lt;blockquote&gt;WinExists&lt;br /&gt;
--------------------------------------------------------------------------------&lt;br /&gt;
Checks to see if a specified window exists.&lt;br /&gt;
&lt;strong&gt;WinExists ( &quot;title&quot; [, &quot;text&quot;] )&lt;/strong&gt;&lt;/blockquote&gt;&lt;br /&gt;
I wanted to make sure that things were working as they should, so my test for this was as follows:&lt;br /&gt;
&lt;textarea name=&quot;code&quot; class=&quot;VB&quot;&gt;If 0 == WinExists(&quot;Please login.&quot;) Then
	MsgBox(4096, &quot;Shutdown&quot;, &quot;LOGIN FOUND! WinExists 1.&quot;);
Else
	MsgBox(4096, &quot;No Login&quot;, &quot;No login found: WinExists 1.&quot;);
EndIf&lt;/textarea&gt;&lt;br /&gt;
&lt;br /&gt;
The problem, which I was unaware of, is that I apparently can&#039;t make the test (value) comparison in the manner that I did.  The proper way to use this method was as follows:&lt;br /&gt;
&lt;textarea name=&quot;code&quot; class=&quot;VB&quot;&gt;If WinExists(&quot;Please login.&quot;) Then
; ...or... 
If Not WinExists(&quot;Please login.&quot;) Then&lt;/textarea&gt;&lt;br /&gt;
&lt;br /&gt;
What a bummer. 
    </content:encoded>

    <pubDate>Wed, 03 Dec 2008 13:30:16 -0800</pubDate>
    <guid isPermaLink="false">http://life.mysiteonline.org/archives/156-guid.html</guid>
    <creativeCommons:license>http://creativecommons.org/licenses/by/3.0/</creativeCommons:license>
</item>
<item>
    <title>VBA (Excel 2007) Hide empty columns</title>
    <link>http://life.mysiteonline.org/archives/148-VBA-Excel-2007-Hide-empty-columns.html</link>
            <category>Programming</category>
    
    <comments>http://life.mysiteonline.org/archives/148-VBA-Excel-2007-Hide-empty-columns.html#comments</comments>
    <wfw:comment>http://life.mysiteonline.org/wfwcomment.php?cid=148</wfw:comment>

    <slash:comments>0</slash:comments>
    <wfw:commentRss>http://life.mysiteonline.org/rss.php?version=2.0&amp;type=comments&amp;cid=148</wfw:commentRss>
    

    <author>nospam@example.com (Brendon Kozlowski)</author>
    <content:encoded>
    An online friend asked me for some help in hiding all empty columns for every sheet within an Excel workbook.  I figured I&#039;d share the code:&lt;br /&gt;
&lt;br /&gt;
(&lt;a href=&quot;http://pastebin.com/f56f8374a&quot;&gt;also on pastebin&lt;/a&gt;)&lt;br /&gt;
&lt;textarea name=&quot;code&quot; class=&quot;vb&quot;&gt;Sub HideEmptyCols()
    &#039; Deletes all empty columns on the active worksheet
    Dim iCol As Integer
    Dim wsSheet As Worksheet
 
    For Each wsSheet In Worksheets
        wsSheet.Select
        With wsSheet.UsedRange
            For iCol = .Column + .Columns.Count - 1 To 1 Step -1
                If IsEmpty(Cells(65536, iCol)) And IsEmpty(Cells(1, iCol)) Then
                    If Cells(65536, iCol).End(xlUp).Row = 1 Then Columns(iCol).Hidden = True
                End If
            Next iCol
        End With
    Next wsSheet
End Sub&lt;/textarea&gt;&lt;br /&gt;
&lt;br /&gt;
Perhaps someone else will find it useful for some odd reason. 
    </content:encoded>

    <pubDate>Wed, 08 Oct 2008 09:42:16 -0700</pubDate>
    <guid isPermaLink="false">http://life.mysiteonline.org/archives/148-guid.html</guid>
    <creativeCommons:license>http://creativecommons.org/licenses/by/3.0/</creativeCommons:license>
</item>
<item>
    <title>I18n and L10n in PHP</title>
    <link>http://life.mysiteonline.org/archives/142-I18n-and-L10n-in-PHP.html</link>
            <category>PHP</category>
    
    <comments>http://life.mysiteonline.org/archives/142-I18n-and-L10n-in-PHP.html#comments</comments>
    <wfw:comment>http://life.mysiteonline.org/wfwcomment.php?cid=142</wfw:comment>

    <slash:comments>0</slash:comments>
    <wfw:commentRss>http://life.mysiteonline.org/rss.php?version=2.0&amp;type=comments&amp;cid=142</wfw:commentRss>
    

    <author>nospam@example.com (Brendon Kozlowski)</author>
    <content:encoded>
    There was recently a nice posting from PHPDeveloper.org linking to an article by Florian Eibeck, where on his blog he discusses some solutions to these extremely fun situations.&lt;br /&gt;
&lt;br /&gt;
&lt;a href=&quot;http://blog.thinkphp.de/archives/342-Multilingual-Websites-with-PHP.html&quot;&gt;http://blog.thinkphp.de/archives/342-Multilingual-Websites-with-PHP.html&lt;/a&gt; 
    </content:encoded>

    <pubDate>Tue, 15 Jul 2008 10:29:06 -0700</pubDate>
    <guid isPermaLink="false">http://life.mysiteonline.org/archives/142-guid.html</guid>
    <creativeCommons:license>http://creativecommons.org/licenses/by/3.0/</creativeCommons:license>
</item>
<item>
    <title>CakePHP Auth Component</title>
    <link>http://life.mysiteonline.org/archives/140-CakePHP-Auth-Component.html</link>
            <category>PHP</category>
    
    <comments>http://life.mysiteonline.org/archives/140-CakePHP-Auth-Component.html#comments</comments>
    <wfw:comment>http://life.mysiteonline.org/wfwcomment.php?cid=140</wfw:comment>

    <slash:comments>1</slash:comments>
    <wfw:commentRss>http://life.mysiteonline.org/rss.php?version=2.0&amp;type=comments&amp;cid=140</wfw:commentRss>
    

    <author>nospam@example.com (Brendon Kozlowski)</author>
    <content:encoded>
    Disclaimer: These are primarily notes for myself as I get accustomed to CakePHP&#039;s (v1.2) authentication and ACL.  I&#039;ve been building a website and wanted to finally make use of CakePHP before I start using it for the library&#039;s CMS.  A CMS is a large undertaking and I don&#039;t want to go into it &quot;cold-turkey&quot;, so I came up with some side-project to help me understand the framework a bit better.  All in all, it truly is an &lt;em&gt;extremely&lt;/em&gt; rapid development tool.&lt;br /&gt;
&lt;br /&gt;
I decided not to go with ExpressionEngine or Drupal simply because I&#039;d still have to take time to learn those systems and make modules or extensions within those languages - and there&#039;s no guarantee I&#039;d be able to do what I&#039;d need to do with them.  If I build it myself, it would take just about the same amount of time with Cake.  Anyway, to continue... &lt;br /&gt;&lt;a href=&quot;http://life.mysiteonline.org/archives/140-CakePHP-Auth-Component.html#extended&quot;&gt;Continue reading &quot;CakePHP Auth Component&quot;&lt;/a&gt;
    </content:encoded>

    <pubDate>Fri, 09 May 2008 08:21:02 -0700</pubDate>
    <guid isPermaLink="false">http://life.mysiteonline.org/archives/140-guid.html</guid>
    <creativeCommons:license>http://creativecommons.org/licenses/by/3.0/</creativeCommons:license>
</item>
<item>
    <title>Adobe AIR</title>
    <link>http://life.mysiteonline.org/archives/136-Adobe-AIR.html</link>
            <category>Programming</category>
    
    <comments>http://life.mysiteonline.org/archives/136-Adobe-AIR.html#comments</comments>
    <wfw:comment>http://life.mysiteonline.org/wfwcomment.php?cid=136</wfw:comment>

    <slash:comments>0</slash:comments>
    <wfw:commentRss>http://life.mysiteonline.org/rss.php?version=2.0&amp;type=comments&amp;cid=136</wfw:commentRss>
    

    <author>nospam@example.com (Brendon Kozlowski)</author>
    <content:encoded>
    Those of you looking towards &quot;widgets&quot; and cross-platform application development, but are primarily web developers with some background (or none) of programming with a desktop application, perhaps you should take a look at Adobe AIR (formerly known as Apollo).  It allows you to create rich, cross-platform applications using just &lt;strong&gt;HTML, CSS, and JavaScript&lt;/strong&gt;!  ...and, technically, I suppose you could leave out the CSS and JS part of that and it would still run...but what&#039;s the fun in that?  It can be integrated into a Flash application, or a Flex application - but it &lt;strong&gt;does not have to be&lt;/strong&gt;.&lt;br /&gt;
&lt;br /&gt;
If you&#039;re seemingly interested in the technology, I went through and found some interesting links on the subject (read: tutorials) that will hopefully help to get you (me) started.  Okay...so I did it because I&#039;m interested and this blog can serve as an access point for me rather than using my Bookmarks as a temporary storage medium.  Whatever.  &lt;img src=&quot;http://life.mysiteonline.org/templates/default/img/emoticons/smile.png&quot; alt=&quot;:-)&quot; style=&quot;display: inline; vertical-align: bottom;&quot; class=&quot;emoticon&quot; /&gt;  I was looking for &lt;strong&gt;simple&lt;/strong&gt; tutorials, so I ignored anything with an &quot;adobe.com&quot; or &quot;ibm.com&quot; (developer works) domain, so if you&#039;d like more when you dive head first, you might want to look to &lt;em&gt;those&lt;/em&gt; resources instead of the ones I&#039;ve provided below.&lt;br /&gt;
&lt;br /&gt;
&lt;ol&gt;
&lt;li&gt;&lt;a href=&quot;http://www.petefreitag.com/item/667.cfm&quot;&gt;Pete Freitag&lt;/a&gt; - newest one (by published date) that I could find&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://www.adobe.com/products/air/&quot;&gt;NOT A TUTORIAL - Get the AIR SDK here&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://24ways.org/2007/christmas-is-in-the-air&quot;&gt;Jonothan Snook on 2007&#039;s 24 Ways: Christmas is in the AIR&lt;/a&gt; - a simple to-do list tutorial&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://dev.aol.com/blog/bricemason/adobe-air-series-introduction&quot;&gt;AOL Developer Network - Part 1 of a Series&lt;/a&gt; - Simple &quot;Hello World&quot; type page with a self-signed certificate&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://snook.ca/archives/adobe_air/snoto_photo/&quot;&gt;Jonathan Snook (again) releases Snoto Foto source code to help you learn!&lt;/a&gt; - No tutorial, but I&#039;d imagine it&#039;s commented well&lt;/li&gt;
&lt;/ol&gt;&lt;br /&gt;
Enjoy!  I hope I will!&lt;br /&gt;
&lt;br /&gt;
&lt;strong&gt;Update: Make sure you&#039;ve updated to the latest Sun Java JRE package or you &lt;em&gt;might&lt;/em&gt; get some really, really odd and weird &lt;em&gt;undocumented&lt;/em&gt; errors when trying to compile!&lt;/strong&gt; 
    </content:encoded>

    <pubDate>Tue, 18 Mar 2008 17:03:18 -0700</pubDate>
    <guid isPermaLink="false">http://life.mysiteonline.org/archives/136-guid.html</guid>
    <creativeCommons:license>http://creativecommons.org/licenses/by/3.0/</creativeCommons:license>
</item>

</channel>
</rss>