<?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>rootelement, inc.</title>
	<atom:link href="http://www.rootelement.net/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.rootelement.net</link>
	<description>Invest in your business.</description>
	<lastBuildDate>Mon, 16 Aug 2010 20:59:11 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Android Development &#8211; XML-Based Layout Requirements</title>
		<link>http://www.rootelement.net/2010/08/android-development-xml-based-layout-requirements/</link>
		<comments>http://www.rootelement.net/2010/08/android-development-xml-based-layout-requirements/#comments</comments>
		<pubDate>Mon, 16 Aug 2010 20:59:11 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[android]]></category>
		<category><![CDATA[eclipse]]></category>
		<category><![CDATA[LinearLayout]]></category>

		<guid isPermaLink="false">http://www.rootelement.net/?p=260</guid>
		<description><![CDATA[Apparently, LinearLayout requires the layout_height and layout_width to be defined...]]></description>
			<content:encoded><![CDATA[<p>Just a quick note to anyone like me experimenting with Android development.  Take this XML snippet:</p>
<pre class="brush: xml;">&lt;LinearLayout xmlns:android=&quot;http://schemas.android.com/apk/res/android&quot;
    android:orientation=&quot;vertical&quot;
    android:layout_width=&quot;fill_parent&quot;
    android:layout_height=&quot;fill_parent&quot;
    &gt;
&lt;TextView
    android:layout_width=&quot;fill_parent&quot;
    android:layout_height=&quot;wrap_content&quot;
    android:text=&quot;@string/hello&quot;
    /&gt;
&lt;Button
	android:id=&quot;@+id/btn01&quot;
        android:text=&quot;@string/goButton&quot;
    /&gt;
&lt;/LinearLayout&gt;
</pre>
<p>I hit compile, it built fine and went to the simulator, but the app crashed right when it ran.  Apparently, LinearLayout requires the layout_height and layout_width to be defined, as such:</p>
<pre class="brush: xml;">&lt;Button
	android:id=&quot;@+id/btn01&quot;
    android:layout_width=&quot;fill_parent&quot;
    android:layout_height=&quot;wrap_content&quot;
    android:text=&quot;@string/goButton&quot;
    /&gt;</pre>
<p>I&#8217;ll continue to post these idiot moments as I find them&#8230;</p>
]]></content:encoded>
			<wfw:commentRss>http://www.rootelement.net/2010/08/android-development-xml-based-layout-requirements/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Ants in my Zend Framework (with doctrine for good measure)</title>
		<link>http://www.rootelement.net/2009/07/ants-in-my-zend-framework-with-doctrine-for-good-measure/</link>
		<comments>http://www.rootelement.net/2009/07/ants-in-my-zend-framework-with-doctrine-for-good-measure/#comments</comments>
		<pubDate>Wed, 15 Jul 2009 12:08:22 +0000</pubDate>
		<dc:creator>James</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[ant]]></category>
		<category><![CDATA[framework]]></category>
		<category><![CDATA[mysql]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[zend]]></category>

		<guid isPermaLink="false">http://sproif.com/?p=137</guid>
		<description><![CDATA[A few simple steps will free you from running your doctrine tasks from the command line.]]></description>
			<content:encoded><![CDATA[<p>I&#8217;m starting to use <a title="Zend Framework Home" href="http://zendframework.com/" target="_blank">Zend Framework 1.8.4</a> with <a title="Doctrine Object Relational Mapper Home" href="http://www.doctrine-project.org/">Doctrine Object Relational Mapper</a> (because after working on a java/<a title="Hibernate Homepage" href="https://www.hibernate.org/" target="_blank">hibernate</a> project, I can&#8217;t go back to writing SQL and building databases)  With Doctrine ORM, you can define a <a title="Example of a Doctrine data model in YAML" href="http://www.doctrine-project.org/documentation/manual/1_0/en/yaml-schema-files">data model in  YAML</a> or XML and it will build the database with foreign keys, etc, etc ,etc&#8230; learn more on that here.<br />
<span id="more-151"></span><br />
On starting my project, I looked around to see what everyone else was doing.  Since 1.8.4 is relatively new, and there were some pretty neat changes, there aren&#8217;t many good tutorials out there.</p>
<p>That being said, and because of said java/hibernate project I&#8217;ve been working on, I&#8217;ve become quite familiar with <a title="Apache Ant Home" href="http://ant.apache.org/">Apache Ant</a>.  It&#8217;s basically an easy way to do some of the mundane work and sometimes heavy lifting in day to day programming.  That, and I use <a title="Eclipse Development Environment" href="http://www.eclipse.org/">Eclipse IDE</a>, so wasn&#8217;t too fond of always running to the command prompt to rebuild my models, create a zend module, etc.</p>
<p>So here&#8217;s what I&#8217;ve come up with.</p>
<p>I started with this tutorial: <a title="Tutorial on setting up a doctrine/zend project." href="http://www.danceric.net/2009/06/06/doctrine-orm-and-zend-framework/" target="_blank">Doctrine ORM and Zend Framework</a> It shows you how to create a Zend 1.8.4 project with doctrine.  The key aspect is the doctrine-cli.php script.</p>
<p>I should let you know, while I do use Eclipse for most of my projects, a while back I bought <a title="Zend Studio Homepage" href="http://www.zend.com/products/studio/" target="_blank">Zend Studio for Eclipse</a>. I think it&#8217;s much better for writing PHP than any plugin for eclipse (<a title="PDT PHP Eclipse Plugin" href="http://www.eclipse.org/pdt/">PDT</a>, <a title="PHP Eclipse Plugin" href="http://www.phpeclipse.com/">PHPEclipse</a>).  If you write a lot of PHP, ZS4E is very very worth the money.  While it does say it is &#8220;zend studio <strong>for</strong> eclipse&#8221;, it installs its own installation of eclipse.  If you find yourself in this boat, and want to use Ant in Zend Studio for Eclipse, check out <a title="Enabling Apache Ant in Zend Studio for Eclipse" href="http://damagestudios.net/blog/2009/01/12/ant-and-zend-studio" target="_blank">this tutorial</a>.  It&#8217;s rather screwy that you can&#8217;t install ant tools easily, but this definitely does the trick.</p>
<p>But I digress&#8230; let&#8217;s get started.</p>
<p>Here is the directory structure of my project, basically defined by the above tutorial:</p>
<pre class="brush: plain;">- root
-  htdocs [zend framework project root]
    - application
        - [all application folders]
        - doctrine
    - library
    - public
    - scripts
    - test
-  .project
-  build.xml
-  env.properties</pre>
<p>The body of env.properties looks like this:</p>
<pre class="brush: plain;">zf.project.basedir=htdocs
doctrine.scripts.path=${zf.project.basedir}/scripts</pre>
<p>And the body of the build.xml looks like this:</p>
<pre class="brush: xml;">&lt;project name=&quot;zf-doctrine-project&quot;&gt;
     &lt;property file=&quot;env.properties&quot; /&gt;
     &lt;target name=&quot;doctrine.cli&quot; description=&quot;Run a doctrine task on doctrine-cli.php - default reload&quot;&gt;
          &lt;input message=&quot;Enter a task:&quot;
               addproperty=&quot;doctrine.task&quot;
               defaultvalue=&quot;build-all-reload&quot; /&gt;
          &lt;fail unless=&quot;doctrine.task&quot; message=&quot;No task selected&quot; /&gt;
          &lt;exec dir=&quot;${doctrine.scripts.path}&quot;
               command=&quot;php doctrine-cli.php ${doctrine.task} y&quot;/&gt;
     &lt;/target&gt;
&lt;/project&gt;</pre>
<p>Although it&#8217;s painfully self-explanatory, for the sake of completeness, here&#8217;s what it does, line by line:</p>
<p>2.  Loads in the env.properties file<br />
3.  Defines the target, which is like a job/task in ant<br />
4. &#8211; 6.  Prompts the user to enter a task to pass to the cli script (just like you would pass in the command line)<br />
7.  Makes sure the user enters a value<br />
8. &#8211; 9. Executes the php script, passing in the entered task as a command line option, and forces yes to &#8220;are you sure?&#8221;</p>
<p>Now, the fun part.</p>
<p>In your project in Eclipse, open the ant window by going to Window &gt; Show View &gt; Other and select Ant under the Ant folder.  When you see the Ant View, either open your ant file in that window using it&#8217;s open dialog, or just drag your build.xml to that panel.  You&#8217;ll see the little white file with the ant on it and whatever you have as the name attribute of the &lt;project&gt; tag in your build xml.  Expand that so you can see the targets, and you should see this:</p>
<div id="attachment_138" class="wp-caption aligncenter" style="width: 285px"><img class="size-full wp-image-138 " title="Eclipse Ant View" src="http://www.rootelement.net/wp-content/uploads/2009/07/eclipseantview.jpg" alt="Showing the doctrine task in the eclipse ant view" width="275" height="190" /><p class="wp-caption-text">Showing the doctrine task in the eclipse ant view</p></div>
<p>Now if you double click that target, you should see a prompt for the task you want to run.  The default value there will run your schema.yml and rebuild your db and models.</p>
<p>Crafty kids may notice that i have the &#8220;Hide internal targets button&#8221; turned on in that image&#8230; well, those targets are for another show&#8230;  (damn you crafty kids&#8230;)</p>
]]></content:encoded>
			<wfw:commentRss>http://www.rootelement.net/2009/07/ants-in-my-zend-framework-with-doctrine-for-good-measure/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Granite SecureAMFChannel &#8211; AMF over HTTPS</title>
		<link>http://www.rootelement.net/2009/03/granite-secureamfchannel-amf-over-https/</link>
		<comments>http://www.rootelement.net/2009/03/granite-secureamfchannel-amf-over-https/#comments</comments>
		<pubDate>Sun, 15 Mar 2009 15:36:52 +0000</pubDate>
		<dc:creator>James</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[Flex]]></category>
		<category><![CDATA[GraniteDS]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[JBoss]]></category>
		<category><![CDATA[Seam]]></category>
		<category><![CDATA[SecureAMFChannel]]></category>
		<category><![CDATA[Tide]]></category>

		<guid isPermaLink="false">http://sproif.com/?p=88</guid>
		<description><![CDATA[How to test a flex/seam project locally with HTTP and post to HTTPS]]></description>
			<content:encoded><![CDATA[<p>At work we&#8217;ve started to use JBoss, writing an application in Java and AS 3.0.  We&#8217;re using Seam and Tide to sandwich it all together, and we came upon a slight problem.  Everything worked out great in the test environment, but when we went live, on an HTTPS connection, firebug was reporting that the AMF request out of flex was failing.  That&#8217;s due to the services-config.xml in the application pointing to a non-secure connection.  After much digging, we found this to be the solution.<br />
<span id="more-88"></span><br />
WEB-INF/flex/services-config.xml<br />
in the channels definition at the top:</p>
<pre class="brush: xml;">
&lt;channels&gt;
    &lt;!--USED IN THE LIVE ENVIRONMENT--&gt;
    &lt;!--channel ref=&quot;my-graniteamf-secure&quot;/--&gt;
    &lt;!--USED IN THE LOCAL/DEV ENVIRONMENT--&gt;
    &lt;channel ref=&quot;my-graniteamf&quot;/&gt;
&lt;/channels&gt;
</pre>
<p>Then in the channel definition below we have both definitions:</p>
<pre class="brush: xml;">
&lt;channel-definition id=&quot;my-graniteamf&quot;
    class=&quot;mx.messaging.channels.AMFChannel&quot;&gt;
    &lt;endpoint
        uri=&quot;http://{server.name}:{server.port}/{context.root}/graniteamf/amf&quot;
        class=&quot;flex.messaging.endpoints.AMFEndpoint&quot; /&gt;
&lt;/channel-definition&gt;
&lt;channel-definition id=&quot;my-graniteamf-secure&quot;
    class=&quot;mx.messaging.channels.SecureAMFChannel&quot;&gt;
    &lt;endpoint
        uri=&quot;https://{server.name}:443/{context.root}/graniteamf/amf&quot;
        class=&quot;flex.messaging.endpoints.SecureAMFEndpoint&quot; /&gt;
&lt;/channel-definition&gt;
</pre>
<p>We couldn&#8217;t get {server.port} to work correctly, so we&#8217;re forcing the port in the address for now.</p>
<p>The only problem with this is you have to remember to switch the AMF channel before deploying.  It&#8217;s on our checklist before doing the full deploy, but we&#8217;re most likely going to add it to the ant task list to deploy dev, deploy live.  Something like that.</p>
<p>The <strong>KEY THING TO REMEMBER</strong> is this: although this file is deployed with the war/ear, it is <strong><em>ALSO COMPILED INTO THE APPLICATION SWF</em></strong> when it is built.  Make sure to change it locally and rebuild your swf before posting, or you will see no change in your app. (found this out after a significant amount of time changing the file on the server to no avail&#8230;)</p>
<pre>(Ref: <a href="http://www.mail-archive.com/discussion@affug.com/msg00605.html" target="_blank">http://www.mail-archive.com/discussion@affug.com/msg00605.html</a>)</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.rootelement.net/2009/03/granite-secureamfchannel-amf-over-https/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Intro to Grep for M$ People</title>
		<link>http://www.rootelement.net/2008/02/intro-to-grep-for-m-people/</link>
		<comments>http://www.rootelement.net/2008/02/intro-to-grep-for-m-people/#comments</comments>
		<pubDate>Sun, 10 Feb 2008 15:50:13 +0000</pubDate>
		<dc:creator>James</dc:creator>
				<category><![CDATA[Programming]]></category>

		<guid isPermaLink="false">http://sproif.com/2008/02/10/intro-to-grep-for-m-people/</guid>
		<description><![CDATA[In my &#8220;free time&#8221; I&#8217;ve been idly trying to become proficient at the *nix command line.  As told by my previous &#8220;converting to Linux&#8221; article, I&#8217;m trying to make the shift over to Ubuntu full-time, but for a Microsoft-head such as myself, the move isn&#8217;t exactly instantaneous.
So, in an attempt to log my efforts, [...]]]></description>
			<content:encoded><![CDATA[<p>In my &#8220;free time&#8221; I&#8217;ve been idly trying to become proficient at the *nix command line.  As told by my previous &#8220;converting to Linux&#8221; <a title="Converting a fanboy to Ubuntu" href="http://sproif.com/2007/09/24/converting-an-m-fanboy-to-ubuntu/">article</a>, I&#8217;m trying to make the shift over to Ubuntu full-time, but for a Microsoft-head such as myself, the move isn&#8217;t exactly instantaneous.</p>
<p>So, in an attempt to log my efforts, I&#8217;m going to start posting little pieces of information that learn/figure out.  Today we start with a light lesson in grep.<br />
<span id="more-29"></span><br />
<strong>Side-note(s)</strong><br />
While I am trying to make the switch over to Linux, I find it unfair to my clients to be uncomfortable on my laptop while working billable hours.  So this particular lesson will consist of Linux commands, but are run via Cygwin under windows.  For those who don&#8217;t know, Cygwin is an implementation of the Linux command line and tools that run under windows.  Read more about it on <a title="Cygwin Homepage" href="http://cygwin.com/" target="_blank">the Cygwin website</a> or at the <a href="http://en.wikipedia.org/wiki/Cygwin" target="_blank">wiki</a>.</p>
<p>My example is at the bash command line.  If you&#8217;re using a different command line, the methodology may change, I don&#8217;t really know <span style="color: #999999;">(insert lack of Linux knowledge here)</span>.</p>
<p>Also, grep is an unbelievably powerful tool.  Books upon books have been written on it.  This is in no way the only use of grep, nor is it a comprehensive account of using grep in this scenario.  I&#8217;m just laying the groundwork.  The internets <span style="color: #999999;">(sometimes called <a title="Interblag: XKCD" href="http://xkcd.com/181/">blagosphere</a>, tubes, whatever you may like)</span> are a wonderful place, do some more research&#8230;</p>
<p><strong>Scenario</strong><br />
I&#8217;m working on a website where we had to find all files containing the word &#8220;Leads&#8221; and change it to &#8220;Prospects&#8221; <span style="color: #999999;">(clients&#8230; they ask for such weird stuff&#8230;)</span>.  In the project directory, there are a bunch of common website files <span style="color: #999999;">(php, html, css, js, etc&#8230;)</span>.  But this particular project folder is also maintained by <a title="Subversion Homepage" href="http://subversion.tigris.org/" target="_blank">Subversion version control</a>. On windows, that means there is a hidden .svn folder in every directory to maintain the changes to that file.  This will make sense in a minute.</p>
<p><strong>Technique &#8211; Step 1 &#8211; Grep</strong><br />
The manual page for grep says to do a simple search through files is something like this:</p>
<pre class="brush: bash;">grep -R &quot;search value&quot; ./</pre>
<p>translation:  find every file within my directory and its subdirectories containing this search value.</p>
<p><strong>Technique &#8211; Step 2 &#8211; |  [pipe]</strong><br />
There is a rather handy thing called &#8220;piping.&#8221; It allows you to run more than one command at once, but also run each subsequent command on the previous commands output.  Semi-unrelated example:</p>
<pre class="brush: bash;">ls -la | grep .txt</pre>
<p>ls -la will give you a directory listing.  What this statement then does is say &#8220;ok, with the output of the directory listing, give me only lines containing .txt&#8221; giving you a list of all text files in a directory.</p>
<pre class="brush: bash;">ls -la | grep .txt | wc -l</pre>
<p>this does the same thing, but wc -l <span style="color: #999999;">(that is a lowercase L)</span> means &#8220;word count, lines only&#8221; showing you how many text files you have in your directory.</p>
<p>Back to the task at hand: find all files containing the word Leads.</p>
<pre class="brush: bash;">grep -R &quot;Leads&quot; ./</pre>
<p>Output:</p>
<pre class="brush: bash;">$ grep -R &quot;Leads&quot; ./
././.svn/text-base/Popup.php.svn-base:    case 'Leads':
./.svn/text-base/Popup.php.svn-base:            require_once(&quot;modules/$currentModule/Leads.php&quot;);
./.svn/text-base/Popup.php.svn-base:            $focus = new Leads();
./.svn/text-base/README.txt.svn-base:12. 131  - Sorting Name in Leads
./.svn/text-base/README.txt.svn-base:49. 1161406: Assigned ToUser in Leads can be Assigned to User
./.svn/text-base/README.txt.svn-base:16. FORUM:1276 - Converting Leads and assigning to user
./.svn/text-base/README.txt.svn-base:20. FORUM:1559 - Tasks not working in Leads
./.svn/text-base/README.txt.svn-base:31. SF1095038 - Import Leads - No Mapping Fields</pre>
<p>That seems pretty useless because this is all information contained in the .svn files.  Eventually, the appropriate info will be contained in there, but make the machine do the work. We want all files containing &#8220;Leads&#8221; that aren&#8217;t in a .svn directory. The -v flag is your friend&#8230; It means &#8220;find things that don&#8217;t contain this.&#8221; Code:</p>
<pre class="brush: bash;">grep -R &quot;Leads&quot; ./ | grep -v &quot;.svn&quot;</pre>
<p>Output</p>
<pre class="brush: bash;">$ grep -R &quot;Leads&quot; ./ | grep -v &quot;svn&quot;
./include/js/general.js:           if(record_id != '' &amp;&amp; module[0] == &quot;Leads&quot;)
./include/js/general.js:           if(task_recordid != '' &amp;&amp; task_module[0] == &quot;Leads&quot; )
./include/language/en_us.lang.php:'LNK_IMPORT_LEADS' =&gt; 'Import Leads',
./include/language/en_us.lang.php:'SINGLE_Leads' =&gt; 'Lead',
./include/language/en_us.lang.php:'COMBO_LEADS' =&gt; 'Leads',
./include/language/en_us.lang.php:'Leads' =&gt; 'Prospects',</pre>
<p>See the en_us files there?  That&#8217;s all I&#8217;m worried about, so I can do another pipe to only view those files:</p>
<pre class="brush: bash;">grep -R &quot;Leads&quot; ./ | grep -v &quot;.svn&quot; | grep &quot;en_us&quot;</pre>
<p>Output</p>
<pre class="brush: bash;">$ grep -R &quot;Leads&quot; ./ | grep -v &quot;svn&quot; | grep &quot;en_us&quot;
./modules/Emails/language/en_us.lang.php:'LBL_LEAD_TITLE'=&gt;'Leads',
./modules/HelpDesk/language/en_us.lang.php:'Leads'=&gt;'Lead',
./modules/Home/language/en_us.lang.php:'LBL_LEADS_BY_SOURCE'=&gt;'Leads By Source',
./modules/Home/language/en_us.lang.php:'LBL_LEADS_BY_STATUS'=&gt;'Leads By Status',
./modules/Leads/language/en_us.lang.php:'LBL_IMPORT_LEADS'=&gt;'Import Leads'</pre>
<p>My task is complete.  I&#8217;ve gotten all  the translation files that contain the word Leads, and I can either manually edit them, or use the command line to edit them, but that&#8217;s another lesson.</p>
<p><strong>Optional Step 3 &#8211; &gt;&gt;</strong></p>
<p>I want to make a checklist that I can print and have on my desk while i&#8217;m working with these files.  There&#8217;s a simple way to do this:</p>
<pre class="brush: bash;">grep -R &quot;Leads&quot; ./ | grep -v &quot;svn&quot; | grep &quot;en_us&quot; &gt; /path/to/file.txt</pre>
<p>This will take all the output and drop it in the file I specified.  If you use one &gt;, it will create the file if it doesn&#8217;t exist, and if it does exist, replace all content in that file with the output from our grep.  If you use two &gt;&gt;, it will create if it doesn&#8217;t exist and it will append the text if it does exist.</p>
<p>I know it&#8217;s a sloppy example, but that&#8217;s how I achieved my goal, and it was MUCH faster than finding all the translation files in the application and doing it by hand.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.rootelement.net/2008/02/intro-to-grep-for-m-people/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>
