<?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>andreas.heigl.org</title>
	<atom:link href="http://andreas.heigl.org/feed/" rel="self" type="application/rss+xml" />
	<link>http://andreas.heigl.org</link>
	<description></description>
	<lastBuildDate>Fri, 02 Dec 2011 13:52:33 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>Babylonic Apache SetEnv</title>
		<link>http://andreas.heigl.org/2011/09/02/babylonic-apache-setenv/</link>
		<comments>http://andreas.heigl.org/2011/09/02/babylonic-apache-setenv/#comments</comments>
		<pubDate>Fri, 02 Sep 2011 05:47:20 +0000</pubDate>
		<dc:creator>Andreas Heigl</dc:creator>
				<category><![CDATA[Allgemein]]></category>
		<category><![CDATA[apache]]></category>
		<category><![CDATA[framework]]></category>
		<category><![CDATA[httpd]]></category>
		<category><![CDATA[mod_env]]></category>
		<category><![CDATA[mod_rewrite]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[rewritecond]]></category>
		<category><![CDATA[rewriterule]]></category>
		<category><![CDATA[setenv]]></category>
		<category><![CDATA[setenvif]]></category>
		<category><![CDATA[zend]]></category>
		<category><![CDATA[zf]]></category>

		<guid isPermaLink="false">http://andreas.heigl.org/?p=180</guid>
		<description><![CDATA[The Mission
The other day I had a PHP-project based on the ZendFramework where I had to display different logos whether the project was viewd on the preview or on the live system.
Until now I always exchanged the images after puling the live data from the repository. Of course this was one step that sometimes was [...]]]></description>
			<content:encoded><![CDATA[<h2>The Mission</h2>
<p>The other day I had a PHP-project based on the ZendFramework where I had to display different logos whether the project was viewd on the preview or on the live system.</p>
<p>Until now I always exchanged the images after puling the live data from the repository. Of course this was one step that sometimes was forgotten, sometimes the correct images where already in the repository so ther was no need to do it &#8211; -all in all it was rather anoying. Yes, you could say: &#8220;Automate processes that are always the same&#8221; but that is not the point today.</p>
<p>I had something different in mind.</p>
<p>For the ZendFramework I already set an environment variable &#8220;APPLICATION_ENV&#8221; that defined whether the server hosts a development or a production environment.</p>
<p>Why not use that information to display a logo according to the environment?</p>
<p>So I had either the option to call the logo via a PHP-Script that checks the environment variable and returns the correct image.</p>
<p>Or I could use the &#8211; already for ZendFramework available &#8211; mod_rewrite to do some rewriting voodoo.</p>
<p>The first option would have meant to write a complete PHP-Script and call that every time the logo is asked for. Somewhat much to do for a simple rewriting I thought.</p>
<h2>The Quest</h2>
<p>So I went for the second option. And it took me some time to get it up and running.</p>
<p>What happened: I took the documentation for mod_rewrite and went through it. I already had the following section in my VirtualHost-Config</p>
<pre class="brush: bash; title: ; notranslate">SetEnv APPLICATION_ENV development</pre>
<p>So for the directory with the logos in I created the following .htaccess-file (Yes, I could also put it into the servers config file&#8230;)</p>
<pre class="brush: bash; title: ; notranslate">RewriteEngine on
RewriteCond %{ENV:APPLICATION_ENV} development [NC]
RewriteRule ^logo(?!-preview)(.*)\.png$   logo-preview$1.png [NC]</pre>
<p>Fine I thought and tried that!</p>
<p>No Luck.</p>
<p>Didn&#8217;t work</p>
<p>Not after hours of debugging, reading blogposts and forum-entries and rewriting the code one or the other way.</p>
<p>No Luck at all</p>
<p>During these hours of searching the net I found that I wasn&#8217;t the only one having that problem, but mostly the solution was to set the environment variable in the Rewrite Engine as well as via SetEnv. But there had to be a different way.</p>
<p>And there was.</p>
<h2>The Happy End</h2>
<p>After hours I finaly found http://httpd.apache.org/docs/2.0/env.html and there was a paragraph headed &#8220;Some Caveats&#8221;.<br />Bingo! Thats It.</p>
<p>SetEnv is called <strong>after</strong> the mod_rewrite-calls. SetEnvIf <strong>before</strong>!</p>
<p>So thats the solution. Use SetEnvIf instead of SetEnv.</p>
<p>So I changed my VirtualHost-Config the following way</p>
<pre class="brush: diff; title: ; notranslate">-  SetEnv APPPLICATION_ENV development
+  SetEnfIf HTTP &quot;HTTP.*&quot; APPLICATION_ENV=development</pre>
<p>Yes It takes some performance, because APPLICATION_ENV is now set on <strong>every</strong> Request, but as long as static Environment variables are set <strong>after</strong> dynamic ones, that is an SEP to me.</p>
<p>The ZendFramework-Projects behavior does not change as the change is completely transparent to it. But reloading the log now suddenly showed the correct result!</p>
<h2>The Polish</h2>
<p>Well I thought, fine. But why not set the APPLICATION_ENV according to the called host-name? And therefore moving the SetEnfIf-call from the virtualServer to the projects htaccess-file? At least that&#8217;s where I think it belongs to, as it&#8217;s a project-specific setting.</p>
<p>So I removed the SetEnvIf-Line from the VirtualHost-Config and placed the following into the projects .htaccess-file.
<pre class="brush: bash; title: ; notranslate">&lt;IfModule setenvif_module&gt;
    SetEnvIf Host &quot;\.?(preview|stage|staging|development|dev|local)\.?&quot; APPLICATION_ENV=development
&lt;/IfModule&gt;</pre>
<p>As soon as one of <i>preview</i>, <i>stage</i>, <i>staging</i>, <i>dev</i>, <i>development</i> or <i>local</i> is a part of the hostname the APPLICATION_ENV-variable will be set to &#8220;development&#8221;.</p>
<p>One could now change that to the local environment by adding other names as well, but for me it is sufficient.</p>
]]></content:encoded>
			<wfw:commentRss>http://andreas.heigl.org/2011/09/02/babylonic-apache-setenv/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Mobile blogging</title>
		<link>http://andreas.heigl.org/2011/07/12/mobile-blogging/</link>
		<comments>http://andreas.heigl.org/2011/07/12/mobile-blogging/#comments</comments>
		<pubDate>Tue, 12 Jul 2011 05:38:27 +0000</pubDate>
		<dc:creator>Andreas Heigl</dc:creator>
				<category><![CDATA[Allgemein]]></category>
		<category><![CDATA[Wordpress]]></category>
		<category><![CDATA[Mobile xml-rpc wordpress]]></category>

		<guid isPermaLink="false">http://andreas.heigl.org/2011/07/12/mobile-blogging/</guid>
		<description><![CDATA[For a Lot of People it might Be an old Story, but I just discovered the possibilities of the XML-RPC-Connector in my wordpress-blog.
It Makes editing so much easier on the Train or at the Next Break. Just open an offline-editor (I am using the wordpress-app on my iPod) And Start happy editing. 
The only drawback [...]]]></description>
			<content:encoded><![CDATA[<p>For a Lot of People it might Be an old Story, but I just discovered the possibilities of the XML-RPC-Connector in my wordpress-blog.</p>
<p>It Makes editing so much easier on the Train or at the Next Break. Just open an offline-editor (I am using the wordpress-app on my iPod) And Start happy editing. </p>
<p>The only drawback is the Auto-Text-correction, that I have Not yet managed to Turn off and that more than once translates a Perfect english word into German garbage&#8230;. But that&#8217;s not wordpress&#8217; fault, isn&#8217;t it?</p>
]]></content:encoded>
			<wfw:commentRss>http://andreas.heigl.org/2011/07/12/mobile-blogging/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Creating invisible users in Mac OS-X (Snow)Leopard</title>
		<link>http://andreas.heigl.org/2011/06/08/creating-invisible-users-in-mac-os-x-snowleopard/</link>
		<comments>http://andreas.heigl.org/2011/06/08/creating-invisible-users-in-mac-os-x-snowleopard/#comments</comments>
		<pubDate>Wed, 08 Jun 2011 18:59:48 +0000</pubDate>
		<dc:creator>Andreas Heigl</dc:creator>
				<category><![CDATA[Allgemein]]></category>
		<category><![CDATA[Mac]]></category>
		<category><![CDATA[leopard]]></category>
		<category><![CDATA[mac]]></category>
		<category><![CDATA[snowleopard]]></category>

		<guid isPermaLink="false">http://andreas.heigl.org/?p=164</guid>
		<description><![CDATA[Recently I wanted to install a software no my Mac that required a dedicated user. So I created a user via the GUI-Interface and noted, that the user now was visible in the login-screen, which I didn&#8217;t want to happen.
So after a bit of research I came up with the following:
In MacOS-X you can hide [...]]]></description>
			<content:encoded><![CDATA[<p>Recently I wanted to install a software no my Mac that required a dedicated user. So I created a user via the GUI-Interface and noted, that the user now was visible in the login-screen, which I didn&#8217;t want to happen.</p>
<p>So after a bit of research I came up with the following:<br />
<span id="more-164"></span>In MacOS-X you can hide users with a user-id below 500, so I had to check which number below the 500 was free.</p>
<p>Using the following commands I got a list of all IDs for the users and the groups and found, that &#8211; at least on my system &#8211; everything from 300 through 399 was free, so I will settle for the 300 in this example.</p>
<pre class="brush: bash; title: ; notranslate"># List all User-IDs
dscl . list /Users UniqueID | sed -E &quot;s/ +/ /g&quot; | cut -d &quot; &quot; -f 2 \
    | sort
# List all Group-IDs
dscl . list /Groups PrimaryGroupID | sed -E &quot;s/ +/ /g&quot; \
    | cut -d &quot; &quot; -f 2 |sort</pre>
<p>That given I had to create the group and the user as well as set the user as member of the group</p>
<pre class="brush: bash; title: ; notranslate">USERNAME=&quot;MyUserName&quot;
GIDNUMBER=300
UIDNUMBER=300
PASSWORD=&quot;secretPassword&quot;
# Create the group
sudo dscl . create /Groups/$USERNAME
sudo dscl . create /Groups/$USERNAME PrimaryGroupID $GIDNUMBER
# Create the user
sudo dscl . create /Users/$USERNAME
sudo dscl . create /Users/$USERNAME PrimaryGroupID $GIDNUMBER
sudo dscl . create /Users/$USERNAME UniqueID $UIDNUMBER
sudo dscl . create /Users/$USERNAME UserShell /bin/bash
# Set the users pasword
sudo dscl . passwd /Users/$USERNAME $PASSWORD
# Add the user to the group
sudo dscl . append /Groups/$USERNAME GroupMembership $USERNAME
</pre>
<p>That&#8217;s that!</p>
<p>Group created, User created, User as Group-Member set, what&#8217;s next?</p>
<p>Oh yes, I have to set the flag to hide users with ID below 500, and some stuff like that.</p>
<pre class="brush: bash; title: ; notranslate"># Hide all users with a user-ID below 500
sudo defaults write /Library/Preferences/com.apple.loginwindow \
    Hide500Users -bool TRUE
# Add the user to the list of users to be hidden
sudo defaults write /Library/Preferences/com.apple.loginwindow \
    HiddenUsersList -array $USERNAME
# Remove the 'other...' string from the login-screen
sudo defaults write /Library/Preferences/com.apple.loginwindow \
     SHOWOTHERUSERS_MANAGED -bool FALSE
</pre>
<p>Finished. </p>
<p>The created User &#8216;MyUserName&#8217; now should not show up in the login-screen.</p>
<p>For more Information see <a href="http://hints.macworld.com/article.php?story=20080127172157404">this MacWorld-Hint</a></p>
]]></content:encoded>
			<wfw:commentRss>http://andreas.heigl.org/2011/06/08/creating-invisible-users-in-mac-os-x-snowleopard/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>gallery-script created</title>
		<link>http://andreas.heigl.org/2011/05/15/gallery-script-created/</link>
		<comments>http://andreas.heigl.org/2011/05/15/gallery-script-created/#comments</comments>
		<pubDate>Sun, 15 May 2011 20:42:53 +0000</pubDate>
		<dc:creator>Andreas Heigl</dc:creator>
				<category><![CDATA[gallery]]></category>

		<guid isPermaLink="false">http://andreas.heigl.org/?p=161</guid>
		<description><![CDATA[I store the images from my digital camera on a local machine at home. But retrieving images is a somewhat painfull thing for everyone else than myself (that is: especially my better half (-; ).
So after some research I didn&#8217;t find something that met my requirements

easy
reads from folders
runs with PHP
allows to select images for later [...]]]></description>
			<content:encoded><![CDATA[<p>I store the images from my digital camera on a local machine at home. But retrieving images is a somewhat painfull thing for everyone else than myself (that is: especially my better half (-; ).</p>
<p>So after some research I didn&#8217;t find something that met my requirements</p>
<ul>
<li>easy</li>
<li>reads from folders</li>
<li>runs with PHP</li>
<li>allows to select images for later batch-download</li>
<li>batch download for the selected stuff</li>
</ul>
<p>So I created a small application to display images from existing folders without the need to import stuff manually. </p>
<p>To use the script you need a current Zend-Framework installed in your phps include_path.</p>
<p>The script can be found at <a href="http://github.com/heiglandreas/gallery">Github</a></p>
]]></content:encoded>
			<wfw:commentRss>http://andreas.heigl.org/2011/05/15/gallery-script-created/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Create a bootable USB-Device on Mac</title>
		<link>http://andreas.heigl.org/2011/04/07/create-a-bootable-usb-device-on-mac/</link>
		<comments>http://andreas.heigl.org/2011/04/07/create-a-bootable-usb-device-on-mac/#comments</comments>
		<pubDate>Thu, 07 Apr 2011 18:45:52 +0000</pubDate>
		<dc:creator>Andreas Heigl</dc:creator>
				<category><![CDATA[Allgemein]]></category>
		<category><![CDATA[mac usb bootable device]]></category>

		<guid isPermaLink="false">http://andreas.heigl.org/?p=150</guid>
		<description><![CDATA[
diskutil list
diskutil unmountDisk /dev/diskN
sudo dd if=/path/to/downloaded.img of=/dev/diskN
diskutil eject /dev/diskN

]]></description>
			<content:encoded><![CDATA[<pre class="brush: bash; title: ; notranslate">
diskutil list
diskutil unmountDisk /dev/diskN
sudo dd if=/path/to/downloaded.img of=/dev/diskN
diskutil eject /dev/diskN
</pre>
]]></content:encoded>
			<wfw:commentRss>http://andreas.heigl.org/2011/04/07/create-a-bootable-usb-device-on-mac/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

