<?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>dragffy.com &#187; Server</title>
	<atom:link href="http://dragffy.com/blog/posts/category/server/feed" rel="self" type="application/rss+xml" />
	<link>http://dragffy.com/blog</link>
	<description>The development, documentation, and blogging domain of Gabriel Dragffy.</description>
	<lastBuildDate>Wed, 27 Jan 2010 14:23:44 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.4</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Bzr over SMB/CIFS using SMBMOUNT</title>
		<link>http://dragffy.com/blog/posts/bzr-over-smbcifs-using-smbmount</link>
		<comments>http://dragffy.com/blog/posts/bzr-over-smbcifs-using-smbmount#comments</comments>
		<pubDate>Wed, 16 Sep 2009 11:55:10 +0000</pubDate>
		<dc:creator>Gabe</dc:creator>
				<category><![CDATA[Bazaar]]></category>
		<category><![CDATA[Development]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Revision Control]]></category>
		<category><![CDATA[Server]]></category>

		<guid isPermaLink="false">http://dragffy.com/blog/?p=138</guid>
		<description><![CDATA[Ensure that the remote uig and gid are set correctly!
smbmount //foo/bar /media/bar -o username=myusername, password=mypassword, dir_mode=0755, file_mode=0664, noperm, uid=501, gid=501
]]></description>
			<content:encoded><![CDATA[<p>Ensure that the remote uig and gid are set correctly!</p>
<p>smbmount //foo/bar /media/bar -o username=myusername, password=mypassword, dir_mode=0755, file_mode=0664, noperm, uid=501, gid=501</p>
]]></content:encoded>
			<wfw:commentRss>http://dragffy.com/blog/posts/bzr-over-smbcifs-using-smbmount/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Xdebug.ini</title>
		<link>http://dragffy.com/blog/posts/xdebug-ini</link>
		<comments>http://dragffy.com/blog/posts/xdebug-ini#comments</comments>
		<pubDate>Wed, 09 Sep 2009 10:58:15 +0000</pubDate>
		<dc:creator>Gabe</dc:creator>
				<category><![CDATA[HowTo]]></category>
		<category><![CDATA[Information]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Server]]></category>

		<guid isPermaLink="false">http://dragffy.com/blog/?p=136</guid>
		<description><![CDATA[Shamelessly ripped from: http://gggeek.altervista.org/2007/11/26/the-completely-unofficial-xdebugini/
There are just a couple of minor annoyances with the Xdebug PHP debugger really, the first one being the absence of a proper documentation package to be downloaded and read offline.
I find well-commented ini files, in the Apache httpd.conf style, the best complement to user manuals and technical references: when you are [...]]]></description>
			<content:encoded><![CDATA[<p>Shamelessly ripped from: http://gggeek.altervista.org/2007/11/26/the-completely-unofficial-xdebugini/</p>
<p>There are just a couple of minor annoyances with the Xdebug PHP debugger really, the first one being the absence of a proper documentation package to be downloaded and read offline.</p>
<p>I find well-commented ini files, in the Apache httpd.conf style, the best complement to user manuals and technical references: when you are editing the forgotten config of that vetust server that has no web access or even ssh whatsoever, awkwardly sitting on an unstable pile of extinguished hardware in the darkest corner of the server room, they will save you dozens of round trips to go googling for information.</p>
<p>Unfortunately the Xdebug distribution contains no such thing: no comments, no list of ini directives, no ini file at all. But since I am a nice chap, after having carved out such precious jewel, I thought it might be of interest to the community, and without further ado here it is:</p>
<p>[xdebug]</p>
<p>;;;;;;;;;;;;;;;;;;;<br />
; About this file ;<br />
;;;;;;;;;;;;;;;;;;;<br />
;<br />
; built by G. Giunta as a verbatim copy of info from xedbug website on 2007/11/08</p>
<p>; You must uncomment one (and only one) line from the following to load<br />
; the xdebug extension.<br />
zend_extension=&#8221;/usr/lib/php4/xdebug.so&#8221;<br />
;zend_extension_ts=&#8221;/usr/lib/php4/xdebug.so&#8221;<br />
;zend_extension_ts=&#8221;c:\php4\xdebug.dll&#8221;<br />
;zend_extension=&#8221;c:\php4\xdebug.dll&#8221;</p>
<p>; When this setting is set to on, the tracing of function calls will be enabled<br />
; just before the script is run. This makes it possible to trace code in the<br />
; auto_prepend_file.<br />
xdebug.auto_trace=Off</p>
<p>; This setting, defaulting to On, controls whether Xdebug should write the<br />
; filename used in include(), include_once(), require() or require_once() to<br />
; the trace files.<br />
xdebug.collect_includes=On</p>
<p>; This setting, defaulting to 0, controls whether Xdebug should collect the<br />
; parameters passed to functions when a function call is recorded in either the<br />
; function trace or the stack trace.<br />
; The setting defaults to Off because for very large scripts it may use huge<br />
; amounts of memory and therefore make it impossible for the huge script to run.<br />
; You can most safely turn this setting on, but you can expect some problems in<br />
; scripts with a lot of function calls and/or huge data structures as parameters.<br />
; Xdebug 2 will not have this problem with increased memory usage, as it will<br />
; never store this information in memory. Instead it will only be written to disk.<br />
; This means that you need to have a look at the disk usage though.<br />
; This setting can have four different values. For each of the values a different<br />
; amount of information is shown. Below you will see what information each of the<br />
; values provides. See also the introduction of the feature Stack Traces for a<br />
; few screenshots.<br />
; Value Argument Information Shown<br />
; 0 None.<br />
; 1 Type and number of elements (f.e. string(6), array(8)).<br />
; 2 Type and number of elements, with a tool tip for the full information.<br />
; 3 Full variable contents (with the limits respected as set by<br />
; xdebug.var_display_max_children, xdebug.var_display_max_data and<br />
; xdebug.var_display_max_depth.<br />
; 4 Full variable contents and variable name.<br />
xdebug.collect_params=0</p>
<p>; This setting, defaulting to Off, controls whether Xdebug should write the<br />
; return value of function calls to the trace files.<br />
xdebug.collect_return=On</p>
<p>; This setting tells Xdebug to gather information about which variables are<br />
; used in a certain scope. This analysis can be quite slow as Xdebug has to<br />
; reverse engineer PHP&#8217;s opcode arrays. This setting will not record which<br />
; values the different variables have, for that use xdebug.collect_params.<br />
; This setting needs to be enabled only if you wish to use<br />
; xdebug_get_declared_vars().<br />
xdebug.collect_vars=Off</p>
<p>; If this setting is On then stacktraces will be shown by default on an error<br />
; event. You can disable showing stacktraces from your code with xdebug_disable().<br />
; As this is one of the basic functions of Xdebug, it is advisable to leave this<br />
; setting set to &#8216;On&#8217;.<br />
xdebug.default_enable=On</p>
<p>; These seven settings control which data from the superglobals is shown when an<br />
; error situation occurs. Each php.ini setting can consist of a comma seperated<br />
; list of variables from this superglobal to dump, but make sure you do not add<br />
; spaces in this setting. In order to dump the REMOTE_ADDR and the REQUEST_METHOD<br />
; when an error occurs, add this setting: xdebug.dump.SERVER = REMOTE_ADDR,REQUEST_METHOD<br />
xdebug.dump.COOKIE=<br />
xdebug.dump.FILES=<br />
xdebug.dump.GET=<br />
xdebug.dump.POST=<br />
xdebug.dump.REQUEST=<br />
xdebug.dump.SERVER=<br />
xdebug.dump.SESSION=</p>
<p>; Controls whether the values of the superglobals as defined by the xdebug.dump.*<br />
; settings whould be shown or not.<br />
xdebug.dump_globals=On</p>
<p>; Controls whether the values of the superglobals should be dumped on all error<br />
; situations (set to Off) or only on the first (set to On).<br />
xdebug.dump_once=On</p>
<p>; If you want to dump undefined values from the superglobals you should set this<br />
; setting to On, otherwise leave it set to Off.<br />
xdebug.dump_undefined=Off</p>
<p>; Controls whether Xdebug should enforce &#8216;extended_info&#8217; mode for the PHP parser;<br />
; this allows Xdebug to do file/line breakpoints with the remote debugger. When<br />
; tracing or profiling scripts you generally want to turn off this option as PHP&#8217;s<br />
; generated oparrays will increase with about a third of the size slowing down<br />
; your scripts. This setting can not be set in your scripts with ini_set(), but<br />
; only in php.ini.<br />
xdebug.extended_info=1</p>
<p>; Introduced in Xdebug 2.1<br />
; This setting determines the format of the links that are made in the display<br />
; of stack traces where file names are used. This allows IDEs to set up a<br />
; link-protocol that makes it possible to go directly to a line and file by<br />
; clicking on the filenames that Xdebug shows in stack traces. An example format<br />
; might look like: myide://%f@%l<br />
; The possible format specifiers are:<br />
; %f the filename<br />
; %l the line number<br />
xdebug.file_link_format=</p>
<p>; Controls which IDE Key Xdebug should pass on to the DBGp debugger handler.<br />
; The default is based on environment settings. First the environment setting<br />
; DBGP_IDEKEY is consulted, then USER and as last USERNAME. The default is set<br />
; to the first environment variable that is found. If none could be found the<br />
; setting has as default &#8221;.<br />
xdebug.idekey=</p>
<p>; This is the base url for the links from the function traces and error message<br />
; to the manual pages of the function from the message. It is advisable to set<br />
; this setting to use the closest mirror.<br />
xdebug.manual_url=http://www.php.net</p>
<p>; Controls the protection mechanism for infinite recursion protection. The value<br />
; of this setting is the maximum level of nested functions that are allowed before<br />
; the script will be aborted.<br />
xdebug.max_nesting_level=100</p>
<p>; Introduced in Xdebug 2.1<br />
; By default Xdebug overloads var_dump() with its own improved version for displaying<br />
; variables when the html_errors php.ini setting is set to 1. In case you do not<br />
; want that, you can set this setting to 0, but check first if it&#8217;s not smarter<br />
; to turn off html_errors.<br />
xdebug.overload_var_dump=On</p>
<p>; When this setting is set to 1, profiler files will not be overwritten when a<br />
; new request would map to the same file (depnding on the xdebug.profiler_output_name setting.<br />
; Instead the file will be appended to with the new profile.<br />
xdebug.profiler_append=0</p>
<p>; Enables Xdebug&#8217;s profiler which creates files in the profile output directory.<br />
; Those files can be read by KCacheGrind to visualize your data. This setting<br />
; can not be set in your script with ini_set().<br />
xdebug.profiler_enable=0</p>
<p>; When this setting is set to 1, you can trigger the generation of profiler<br />
; files by using the XDEBUG_PROFILE GET/POST parameter. This will then write<br />
; the profiler data to defined directory.<br />
xdebug.profiler_enable_trigger=0</p>
<p>; The directory where the profiler output will be written to, make sure that the<br />
; user who the PHP will be running as has write permissions to that directory.<br />
; This setting can not be set in your script with ini_set().<br />
xdebug.profiler_output_dir=/tmp</p>
<p>; This setting determines the name of the file that is used to dump traces into.<br />
; The setting specifies the format with format specifiers, very similar to sprintf()<br />
; and strftime(). There are several format specifiers that can be used to format<br />
; the file name.<br />
; See the xdebug.trace_output_name documentation for the supported specifiers.<br />
xdebug.profiler_output_name=cachegrind.out.%p</p>
<p>; Normally you need to use a specific HTTP GET/POST variable to start remote debugging.<br />
; When this setting is set to &#8216;On&#8217; Xdebug will always attempt to start a remote<br />
; debugging session and try to connect to a client, even if the GET/POST/COOKIE<br />
; variable was not present.<br />
xdebug.remote_autostart=Off</p>
<p>; This switch controls whether Xdebug should try to contact a debug client which<br />
; is listening on the host and port as set with the settings xdebug.remote_host<br />
; and xdebug.remote_port. If a connection can not be established the script will<br />
; just continue as if this setting was Off.<br />
xdebug.remote_enable=Off</p>
<p>; Can be either &#8216;php3&#8242; which selects the old PHP 3 style debugger output, &#8216;gdb&#8217;<br />
; which enables the GDB like debugger interface or &#8216;dbgp&#8217; &#8211; the brand new debugger<br />
; protocol. The DBGp protocol is more widely supported by clients. See more<br />
; information in the introduction for Remote Debugging.<br />
xdebug.remote_handler=dbgp</p>
<p>; Selects the host where the debug client is running, you can either use a host<br />
; name or an IP address.<br />
xdebug.remote_host=localhost</p>
<p>; If set to a value, it is used as filename to a file to which all remote debugger<br />
; communications are logged. The file is always opened in append-mode, and will<br />
; therefore not be overwritten by default. There is no concurrency protection<br />
; available.<br />
xdebug.remote_log=</p>
<p>; Selects when a debug connection is initiated. This setting can have two different values:<br />
; req Xdebug will try to connect to the debug client as soon as the script starts.<br />
; hit Xdebug will only try to connect to the debug client as soon as an error condition occurs.<br />
xdebug.remote_mode=req</p>
<p>; The port to which Xdebug tries to connect on the remote host. Port 9000 is the<br />
; default for both the client and the bundled debugclient. As many clients use<br />
; this port number, it is best to leave this setting unchanged.<br />
xdebug.remote_port=9000</p>
<p>; When this setting is set to 1, Xdebug will show a stack trace whenever an<br />
; exception is raised &#8211; even if this exception is actually caught.<br />
xdebug.show_exception_trace=0</p>
<p>; When this setting is set to something != 0 Xdebug&#8217;s generated stack dumps in<br />
; error situations will also show all variables in the top-most scope. Beware<br />
; that this might generate a lot of information, and is therefore turned off by default.<br />
xdebug.show_local_vars=0</p>
<p>; When this setting is set to something != 0 Xdebug&#8217;s human-readable generated<br />
; trace files will show the difference in memory usage between function calls.<br />
; If Xdebug is configured to generate computer-readable trace files then they<br />
; will always show this information.<br />
xdebug.show_mem_delta=0</p>
<p>; The format of the trace file.<br />
; 0 shows a human readable indented trace file with: time index, memory usage,<br />
; memory delta (if the setting xdebug.show_mem_delta is enabled), level,<br />
; function name, function parameters (if the setting xdebug.collect_params<br />
; is enabled, filename and line number.<br />
; 1 writes a computer readable format which has two different records. There<br />
; are different records for entering a stack frame, and leaving a stack frame<br />
xdebug.trace_format=0</p>
<p>; When set to &#8216;1&#8242; the trace files will be appended to, instead of being overwritten<br />
; in subsequent requests.<br />
xdebug.trace_options=0</p>
<p>; The directory where the tracing files will be written to, make sure that the<br />
; user who the PHP will be running as has write permissions to that directory.<br />
xdebug.trace_output_dir=/tmp</p>
<p>; This setting determines the name of the file that is used to dump traces into.<br />
; The setting specifies the format with format specifiers, very similar to<br />
; sprintf() and strftime(). There are several format specifiers that can be used<br />
; to format the file name. The &#8216;.xt&#8217; extension is always added automatically.<br />
;The possible format specifiers are:<br />
; %c crc32 of the current working directory trace.%c trace.1258863198.xt<br />
; %p pid trace.%p trace.5174.xt<br />
; %r random number trace.%r trace.072db0.xt<br />
; %s script name cachegrind.out.%s cachegrind.out._home_httpd_html_test_xdebug_test_php<br />
; %t timestamp (seconds) trace.%t trace.1179434742.xt<br />
; %u timestamp (microseconds) trace.%u trace.1179434749_642382.xt<br />
; %H $_SERVER['HTTP_HOST'] trace.%H trace.kossu.xt<br />
; %R $_SERVER['REQUEST_URI'] trace.%R trace._test_xdebug_test_php_var=1_var2=2.xt<br />
; %S session_id (from $_COOKIE if set) trace.%S trace.c70c1ec2375af58f74b390bbdd2a679d.xt<br />
; %% literal % trace.%% trace.%%.xt<br />
xdebug.trace_output_name=trace.%c</p>
<p>; Controls the amount of array children and object&#8217;s properties are shown when<br />
; variables are displayed with either xdebug_var_dump(), xdebug.show_local_vars<br />
; or through Function Traces. This setting does not have any influence on the<br />
; number of children that is send to the client through the Remote Debugging feature.<br />
xdebug.var_display_max_children=128</p>
<p>; Controls the maximum string length that is shown when variables are displayed<br />
; with either xdebug_var_dump(), xdebug.show_local_vars or through Function Traces.<br />
; This setting does not have any influence on the amount of data that is send to<br />
; the client through the Remote Debugging feature.<br />
xdebug.var_display_max_data=512</p>
<p>; Controls how many nested levels of array elements and object properties are<br />
; when variables are displayed with either xdebug_var_dump(),<br />
; xdebug.show_local_vars or through Function Traces. This setting does not have<br />
; any influence on the depth of children that is send to the client through the<br />
; Remote Debugging feature.<br />
xdebug.var_display_max_depth=3</p>
<p>For installation, just copy and paste it at the end of your php.ini file (or, if you’re on Debian or similarly configured distros, you can save it as separate file in the php ini directory).</p>
<p>Note1: the zend_extension lines at the top of the file are tailored for a php4 install. Make sure to change them to fit your environment.</p>
]]></content:encoded>
			<wfw:commentRss>http://dragffy.com/blog/posts/xdebug-ini/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Using APG to generate secure, pronuncable passwords.</title>
		<link>http://dragffy.com/blog/posts/using-apg-to-generate-secure-pronuncable-passwords</link>
		<comments>http://dragffy.com/blog/posts/using-apg-to-generate-secure-pronuncable-passwords#comments</comments>
		<pubDate>Fri, 12 Jun 2009 15:28:20 +0000</pubDate>
		<dc:creator>Gabe</dc:creator>
				<category><![CDATA[Information]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Server]]></category>

		<guid isPermaLink="false">http://dragffy.com/blog/?p=130</guid>
		<description><![CDATA[The following command will generate several passwords with the following properties:

Length of 10 characters
Contain a mixture of upper and lowercase characters
Contain at least 1 number
Completely random most likely not in the dictionary (expect by random luck)
Pronounceable

This makes these passwords easier to remember but very difficult to brute force. They are ideal as passwords for logging [...]]]></description>
			<content:encoded><![CDATA[<p>The following command will generate several passwords with the following properties:</p>
<ul>
<li>Length of 10 characters</li>
<li>Contain a mixture of upper and lowercase characters</li>
<li>Contain at least 1 number</li>
<li>Completely random most likely not in the dictionary (expect by random luck)</li>
<li>Pronounceable</li>
</ul>
<p>This makes these passwords easier to remember but very difficult to brute force. They are ideal as passwords for logging in to machines, servers, routers, etc.</p>
<p><code><br />
$ apg -m 10 -x 10 -a 0 -M NCL -t<br />
</code></p>
]]></content:encoded>
			<wfw:commentRss>http://dragffy.com/blog/posts/using-apg-to-generate-secure-pronuncable-passwords/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Using SSHFS with Bazaar (Bzr) or Git</title>
		<link>http://dragffy.com/blog/posts/using-sshfs-with-bazaar-bzr-or-git</link>
		<comments>http://dragffy.com/blog/posts/using-sshfs-with-bazaar-bzr-or-git#comments</comments>
		<pubDate>Thu, 04 Jun 2009 11:00:36 +0000</pubDate>
		<dc:creator>Gabe</dc:creator>
				<category><![CDATA[Bazaar]]></category>
		<category><![CDATA[Git]]></category>
		<category><![CDATA[Information]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Operating System]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Revision Control]]></category>
		<category><![CDATA[Server]]></category>

		<guid isPermaLink="false">http://dragffy.com/blog/?p=128</guid>
		<description><![CDATA[I use SSHFS to mount remote drives locally. The remote computers don&#8217;t have Bzr installed, and it&#8217;s difficult to get them up to date enough to install the latest Bzr. Therefore, I execute Bzr on my local computer on the mounted filesystem. Using default mount options for SSHFS leads to errors in both Git and [...]]]></description>
			<content:encoded><![CDATA[<p>I use SSHFS to mount remote drives locally. The remote computers don&#8217;t have Bzr installed, and it&#8217;s difficult to get them up to date enough to install the latest Bzr. Therefore, I execute Bzr on my local computer on the mounted filesystem. Using default mount options for SSHFS leads to errors in both Git and Bzr, this is because (I believe) SSHFS doesn&#8217;t directly support file renaming. It is possible to avoid these problems by using the <code>-oworkaround=rename</code> switch with the mount command.</p>
<p>As an example my mount command looks similar to this:<br />
<code>sshfs -oworkaround=rename user@computer1:/var/www /media/computer1</code></p>
]]></content:encoded>
			<wfw:commentRss>http://dragffy.com/blog/posts/using-sshfs-with-bazaar-bzr-or-git/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Apache Virtual Hosts on OS X Leopard</title>
		<link>http://dragffy.com/blog/posts/apache-virtual-hosts-on-os-x-leopard</link>
		<comments>http://dragffy.com/blog/posts/apache-virtual-hosts-on-os-x-leopard#comments</comments>
		<pubDate>Sun, 31 May 2009 13:42:49 +0000</pubDate>
		<dc:creator>Gabe</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[Frameworks]]></category>
		<category><![CDATA[HowTo]]></category>
		<category><![CDATA[Information]]></category>
		<category><![CDATA[Leopard]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[OS X]]></category>
		<category><![CDATA[Operating System]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Server]]></category>
		<category><![CDATA[Ubuntu]]></category>

		<guid isPermaLink="false">http://dragffy.com/blog/?p=124</guid>
		<description><![CDATA[If you develop multiple sites and you need virtual hosting functionality, scroll down to the end of the /private/etc/apache2/httpd.conf file and uncomment the following:
# Include /private/etc/apache2/extra/httpd-vhosts.conf
Next, you’ll need to setup whatever virtual hosts you have in the virtual hosts file /private/etc/apache2/extra/httpd-vhosts.conf
You need to make an entry in the httpd-vhosts.conf file like so:

&#60;virtualhost *:80&#62;
   [...]]]></description>
			<content:encoded><![CDATA[<p>If you develop multiple sites and you need virtual hosting functionality, scroll down to the end of the <code>/private/etc/apache2/httpd.conf</code> file and uncomment the following:</p>
<p><code># Include /private/etc/apache2/extra/httpd-vhosts.conf</code></p>
<p>Next, you’ll need to setup whatever virtual hosts you have in the virtual hosts file <code>/private/etc/apache2/extra/httpd-vhosts.conf</code></p>
<p>You need to make an entry in the httpd-vhosts.conf file like so:</p>
<pre>
&lt;virtualhost *:80&gt;
   ServerName beta-site-1.com
   ServerAlias www.beta-site-1.com
   ServerAdmin webmaster@beta-site-1.com
   ErrorLog "/private/var/log/apache2/dummy-host2.example.com-error_log"
   CustomLog "/private/var/log/apache2/dummy-host2.example.com-access_log" common

   DocumentRoot "/Library/WebServer/beta-site-1"
   ScriptAlias /cgi-bin/ "/Library/WebServer/beta-site-1/cgi-bin"
   <directory "/Library/WebServer/beta-site-1">
     Options FollowSymLinks MultiViews Includes
     AllowOverride All
     Order allow,deny
     Allow from all
   </directory>
&lt;/virtualhost&gt;
</pre>
<p>The examples provided by Apple  in the vhosts file are slightly incorrect and if you use the CustomLog lines as is you will get errors the following errors if you run: <code>apachectl -t -D DUMP_VHOSTS</code>:<br />
<code>Syntax error on line 40 of /private/etc/apache2/extra/httpd-vhosts.conf:<br />
CustomLog takes two or three arguments, a file name, a custom log format string or format name, and an optional "env=" clause (see docs)</code></p>
<p>This is because<br />
<code>CustomLog "/private/var/log/apache2/dummy-host.example.com-access_log common</code></p>
<p>Should actually read:<br />
<code>CustomLog "/private/var/log/apache2/dummy-host.example.com-access_log" common</code></p>
]]></content:encoded>
			<wfw:commentRss>http://dragffy.com/blog/posts/apache-virtual-hosts-on-os-x-leopard/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>An alternative img() helper function for CodeIgniter</title>
		<link>http://dragffy.com/blog/posts/an-alternative-img-helper-function-for-codeigniter</link>
		<comments>http://dragffy.com/blog/posts/an-alternative-img-helper-function-for-codeigniter#comments</comments>
		<pubDate>Wed, 20 May 2009 09:59:47 +0000</pubDate>
		<dc:creator>Gabe</dc:creator>
				<category><![CDATA[CodeIgniter]]></category>
		<category><![CDATA[Development]]></category>
		<category><![CDATA[Frameworks]]></category>
		<category><![CDATA[Information]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Operating System]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Server]]></category>

		<guid isPermaLink="false">http://dragffy.com/blog/?p=103</guid>
		<description><![CDATA[It is my opinion that CodeIgniter&#8217;s default img() function that comes in the HTML Helper could have been easier to use. As it is if you want to give your image a name css class you have to define an array consisting of these attributes. 
That takes up space and makes the code less readable [...]]]></description>
			<content:encoded><![CDATA[<p>It is my opinion that CodeIgniter&#8217;s default img() function that comes in the HTML Helper could have been easier to use. As it is if you want to give your image a name css class you have to define an array consisting of these attributes. </p>
<p>That takes up space and makes the code less readable for non-PHP programmers. Since I work closely with a web designer who is good with HTML but gets lost in PHP I want to leverage the pragmatic power of PHP to automate repetitive tasks (like typing out an entire HTML image tag), but at the same time the result needs to be obvious to a non-programmer but also shorter than the HTML equivalent. I feel the img() helper in CodeIgniter falls short of both these requirements.</p>
<p>CodeIgniter&#8217;s img() helper also takes a second parameter, a boolean, this decides whether the index.php file is included in the image path, good if you are using a media controller. For 99.9% of my sites I don&#8217;t need these. Therefore I wrote my own helper.</p>
<p>The file is called <code>MY_html_helper.php</code> and lives inside the folder <code>system/application/helpers</code>. As with other extensions to the CI core the prefix <code>MY_</code> is determined in your config file, so change <code>MY_</code> to whatever it should be. Add the following code to the file:</p>
<pre>
&lt;?php if (!defined('BASEPATH')) exit('No direct script access allowed');

function img($imgName, $attrs=FALSE)
{
	$CI =&amp; get_instance();

	if (strpos($imgName, 'http') === 0) return;

	$imgPath = $CI-&gt;config-&gt;item('base_url');

	if ( ! $imgDir = $CI-&gt;config-&gt;item('image_dir')) $imgDir = 'assets/images/';

	$img = $imgPath.$imgDir.$imgName;

	$str = '&lt;img src=&quot;'.$img.'&quot; ';

	if ($attrs) $str .= $attrs.&quot; &quot;;

	$str .= &quot;/&gt;&quot;;

	return $str;
}
</pre>
<p>All you have to make sure you do is load the html helper: <code>$this->load->helper('html');</code> in your controller,<br />
or put it in the array of helpers in <code>system/application/config/autoload.php</code>.</p>
<p>The helper assumes images live in the folder <code>assets/images</code> which lives alongside the <code>system</code> folder. If this is not where you put your images then you can specify an alternative directory in your config.php file. Simply add a line that looks like this to config.php: <code>$config['image_dir'] = 'alternative/path/images/';</code>. Don&#8217;t forget the trailing slash at the end. This <code>alternative</code> folder would live at the very top level of your application, alongside <code>index.php</code>.</p>
<p>Using the helper is easy and straightforward: <code>&lt;?=img('example.gif')?&gt;</code></p>
<p>Will produce <code>&lt;img src=&quot;http://mysite.com/assets/images/example.gif&quot; /&gt;</code>.</p>
<p>Any additional attributes you want in the html tag can be written as per usual as the second parameter. For example if you want to give the image an alt attribute and class:<br />
<code>&lt;?=img('example.gif', 'class=&quot;myclass&quot; alt=&quot;Example Image&quot;')?&gt;</code></p>
<p>Will produce:</p>
<pre>&lt;img src=&quot;http://mysite.com/assets/images/example.gif&quot; class=&quot;myclass&quot; alt=&quot;Example Image&quot; /&gt;</pre>
<p>The only hard part about this is making sure you get the single and double quotes correct in the second parameter.</p>
<p>Cheers</p>
]]></content:encoded>
			<wfw:commentRss>http://dragffy.com/blog/posts/an-alternative-img-helper-function-for-codeigniter/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Inserting large blobs in MySQL</title>
		<link>http://dragffy.com/blog/posts/inserting-large-blobs-in-mysql</link>
		<comments>http://dragffy.com/blog/posts/inserting-large-blobs-in-mysql#comments</comments>
		<pubDate>Mon, 12 Jan 2009 14:05:00 +0000</pubDate>
		<dc:creator>Gabe</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[Information]]></category>
		<category><![CDATA[MySQL]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Server]]></category>

		<guid isPermaLink="false">http://dragffy.com/blog/?p=77</guid>
		<description><![CDATA[Last week I setup MySQL replication for a database with two slaves. I wanted to see how resilient it was, and one of the tests I wanted to perform was to create a record on the master and then interrupt the replication of the same record on the slave. This would allow me to see [...]]]></description>
			<content:encoded><![CDATA[<p>Last week I setup MySQL replication for a database with two slaves. I wanted to see how resilient it was, and one of the tests I wanted to perform was to create a record on the master and then interrupt the replication of the same record on the slave. This would allow me to see whether MySQL could recover from such an error.</p>
<p>So I thought the easiest way of doing this would be to to insert a large 700mb<br />
file in to MySQL &#8211; to give me enough time to interrupt a slave before<br />
replication had completed. Thus being able to test MySQL&#8217;s resilience to<br />
loss of connectivity during UPDATE/INSERT queries.</p>
<p>I have never used BLOB columns before so my quest took my on a journey during which I learned a lot about these blobs. Now, even though a MySQL long blob can hold 4GB of data I have encountered<br />
problem after problem dealing with it:</p>
<p>PHP scripts are limited to 32MB memory maximum, this can be upped, but<br />
is not scalable and not a good solution. It means that you cannot simply<br />
read the data of file and perform an INSERT since the file data is<br />
stored in PHP&#8217;s memory first. This meant the development of a PHP script<br />
that could read chunks (just a meg or so) from a file and perform UPDATE<br />
queries along with MySQL CONCAT function to effectively append each<br />
chunk.</p>
<p>CONCAT, as I eventually found out, returns NULL if any of it&#8217;s arguments<br />
are NULL. In my case when attempting to UPDATE a row with additional<br />
chunks the resulting blob size was always zero. This was because the<br />
very first time CONCAT is used the blob field is empty (NULL), therefore<br />
CONCAT always returned NULL &#8211; and so, the data in the blob column never<br />
grew. The query looked like this:<br />
<code>UPDATE `$table` SET `data` = CONCAT(data, '{mysqli_real_escape_string($buffer)}') WHERE `id`=$id";</code></p>
<p>I then combined CONCAT with COALESCE which will return an alternative<br />
value that you specify in the eventuality the first argument is NULL. By<br />
combining these two I could overcome the above problem.<br />
Resulting query structure:<br />
<code>UPDATE `$table` SET `data` = COALESCE(CONCAT(data, '{mysqli_real_escape_string($buffer)}'), '') WHERE `id`=$id";</code></p>
<p>Great, now we&#8217;re finally adding our chunks on. Then my computer ran out<br />
of disc space &#8211; the reason: 7 gigs of MySQL replication logs. Took a<br />
while to find that out. Fixed.</p>
<p>Next problem, although I was certain (via in-depth PHP debugging) that<br />
PHP was correctly reading chunks from the file in a consecutive order,<br />
of the correct size, and the SQL query was being properly executed<br />
without any sly errors the blob column would never end up growing above<br />
12MB (according the PHP MyAdmin). Through even more intensive debugging<br />
I found that after concatenating each chunk the blob would grow by the<br />
correct amount up to 16MB, then it would zero and start again. The<br />
result of pushing a 700MB ISO in to it would always be less 16MB.</p>
<p>Working from a hunch I upped the max_packet_size in my.conf from 16MB to<br />
36MB, the result was as above but this time the blob would grow to 32MB<br />
before zeroing itself.</p>
<p>I then found this MySQL bug report:<br />
<a href="http://bugs.mysql.com/bug.php?id=22853">http://bugs.mysql.com/bug.php?id=22853</a></p>
<p>It is considered a bug simply because by upping max_packet_size to<br />
something like 4GB or anything substantial leaves the MySQL server open<br />
to network DoS attacks. There is no work around. A fix is scheduled for<br />
version 6.</p>
<p>Anyway, since we don&#8217;t care about security I maxed out the packet_size,<br />
and my chunking script worked, but very quickly I noticed a huge amount of<br />
slowdown once the blob had grown to just a few tens of megs. In fact it<br />
took about 20 minutes to get to 200MB. Without supporting my theory with<br />
any evidence I reckon the CONCAT function reads all the data out of the<br />
database in to memory, does it&#8217;s stuff and then stuffs it back in to the<br />
database. The result is an increasingly slow query.</p>
<p>It would seem that although MySQL supports blobs of about 4GB that you<br />
can never get that size unless you:</p>
<p>1. Change the max_packet_size to a stupidly high number, leaving your<br />
server open to DoS attacks so then you can just do a single INSERT. Using CONCAT<br />
is out since it would take forever.</p>
<p>2. Change the memory limit of PHP scripts to be greater than 4GB.</p>
<p>3. Have absolutely bags of RAM since three copies of the file are stored<br />
in RAM (certainly two copies). Since you cannot chunk the file and<br />
perform CONCATS PHP will read the entire file in to it&#8217;s memory. This<br />
will all then be buffered by the MySQL driver. Then this is passed to<br />
the database. Therefore if you wish to insert a 4 GB file you will<br />
require >12GB of RAM.</p>
<p>One work around is to chunk the file as before but each chunk is<br />
represented by a single row. These can then be linked together by giving<br />
each row a master file ID, so that all necessary rows can be retrieved. </p>
<p>For my purposes this doesn&#8217;t help, I needed queries that took a while,<br />
inserting rows like this will take but a fraction of a second each.</p>
]]></content:encoded>
			<wfw:commentRss>http://dragffy.com/blog/posts/inserting-large-blobs-in-mysql/feed</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Setup a fileserver using RAID 1 &amp; 5 on Ubuntu Hardy Heron 8.04 LTS Server</title>
		<link>http://dragffy.com/blog/posts/setup-a-fileserver-using-raid-1-5-on-ubuntu-hardy-heron-804-lts-server</link>
		<comments>http://dragffy.com/blog/posts/setup-a-fileserver-using-raid-1-5-on-ubuntu-hardy-heron-804-lts-server#comments</comments>
		<pubDate>Tue, 13 May 2008 11:00:13 +0000</pubDate>
		<dc:creator>Gabe</dc:creator>
				<category><![CDATA[Books]]></category>
		<category><![CDATA[Development]]></category>
		<category><![CDATA[Guide]]></category>
		<category><![CDATA[Information]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Operating System]]></category>
		<category><![CDATA[Server]]></category>
		<category><![CDATA[Ubuntu]]></category>

		<guid isPermaLink="false">http://dragffy.com/blog/?p=52</guid>
		<description><![CDATA[I recently set up a new file server. It contains three 1 terabyte drives configured in a RAID 5 array but with RAID 1 for the boot partitions so in the event of drive failure the system could still boot.
Essentially you need to go through a normal installation process and make sure you choose a [...]]]></description>
			<content:encoded><![CDATA[<p>I recently set up a new file server. It contains three 1 terabyte drives configured in a RAID 5 array but with RAID 1 for the boot partitions so in the event of drive failure the system could still boot.</p>
<p>Essentially you need to go through a normal installation process and make sure you choose a couple of things during parition setup. I split each of the 3 drives in to two partitions, one 200MB, and the other partition the remaining disc space. This is what I had:<br />
sda1 = 200MB<br />
sda2 = 9800MB<br />
and the same for the other drives.</p>
<p>Set all sda1 partition to be ext3 and bootable and mounted as /boot, set sdb1 and sdc1 partitions to be Linux Software Raid, bootable, but not mounted. Configure the RAID and create a new RAID device, tell it to use three devices and add to it sda2, sdb2, and sdc2.</p>
<p>When I returned to the partition menu I configured md0 as a partition for a logical volume group. I then configured LVM and created logical volumes for /root, swap, and /home. Returning to the partitioning menu I formatted these and selected their mount points and installed the system.</p>
<p>Following system installation I went about creating a RAID 1 array for sda1, sdb1, and sdc1. First thing was to create a new array using mdadm and the two paritions we haven&#8217;t yet assigned:<br />
<code># mdadm --create /dev/md1 --level=1 --raid-disks=3 missing /dev/sdb1 /dev/sdc1</code></p>
<p>Make a filesystem on our new RAID device:<br />
<code># mkfs.ext3 -m 0 /dev/md1</code></p>
<p>Save the new configuration in to mdadm&#8217;s config file:<br />
<code># mdadm --examine --scan >> /etc/mdadm/mdadm.conf</code></p>
<p>Edit mdadm.conf and remove the duplicate entry at the bottom:<br />
<code># vim /etc/mdadm.conf</code></p>
<p>Mount the new RAID device so we can copy data to it:<br />
<code># mkdir /media/md1</code><br />
<code># mount /dev/md1 /media/md1</code></p>
<p>Copy over the boot partition to the RAID device:<br />
<code># cd /boot</code><br />
<code># cp -dpRx . /media/md1</code></p>
<p>Edit fstab and replace /dev/sda1 with /dev/md1:<br />
<code># vim /etc/fstab</code></p>
<p>Edit mtab and do the same:<br />
<code># vim /etc/mtab</code></p>
<p>Unmount /boot, change it&#8217;s system type and add it to the RAID array:<br />
<code># umount /boot</code><br />
<code># fdisk /dev/sda</code><br />
<code><strong>Command (m for help):</strong> t</code><br />
<code><strong>Partition number (1-4):</strong> 1</code><br />
<code><strong>Hex code (type L to list codes):</strong> f</code><br />
<code><strong>Changed system type of partition 1 to fd (Linux raid autodetect)</strong></code><br />
<code><strong>Command (m for help):</strong> w</code></p>
<p><code># mdadm --add /dev/md1 /dev/sda1</code></p>
<p>Configure GRUB so that it can boot from any hard drive:<br />
<code># grub</code><br />
<strong>grub></strong> device (hd0) /dev/sda<br />
<strong>grub></strong> root (hd0,0)<br />
<strong>grub></strong> setup (hd0)<br />
<strong>grub></strong> device (hd0) /dev/sdb<br />
<strong>grub></strong> root (hd0,0)<br />
<strong>grub></strong> setup (hd0)<br />
<strong>grub></strong> device (hd0) /dev/sdc<br />
<strong>grub></strong> root (hd0,0)<br />
<strong>grub></strong> setup (hd0)<br />
<strong>grub></strong> quit</p>
<p><code># update-initramfs -u</code></p>
<p>Change all occurance of (hd*) to (hd0) in the file <code>/boot/grub/devices.map</code>.</p>
<p>That should be all &#8211; good luck with the reboot!<br />
<code># reboot</code></p>
]]></content:encoded>
			<wfw:commentRss>http://dragffy.com/blog/posts/setup-a-fileserver-using-raid-1-5-on-ubuntu-hardy-heron-804-lts-server/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Installing Netatalk AFP with SSL (encrypted authentication) on Ubuntu Hardy Heron 8.04 LTS Server</title>
		<link>http://dragffy.com/blog/posts/installing-netatalk-afp-with-ssl-encrypted-authentication-on-ubuntu-hardy-heron-804-lts-server</link>
		<comments>http://dragffy.com/blog/posts/installing-netatalk-afp-with-ssl-encrypted-authentication-on-ubuntu-hardy-heron-804-lts-server#comments</comments>
		<pubDate>Mon, 12 May 2008 15:19:21 +0000</pubDate>
		<dc:creator>Gabe</dc:creator>
				<category><![CDATA[HowTo]]></category>
		<category><![CDATA[Information]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Operating System]]></category>
		<category><![CDATA[Server]]></category>
		<category><![CDATA[Ubuntu]]></category>

		<guid isPermaLink="false">http://dragffy.com/blog/?p=51</guid>
		<description><![CDATA[Installing Netatalk from the repositories means that when you connect using a Mac client you will be warned that you are going to send your password in the clear. Obviously this isn&#8217;t great for security, and being prompted every time you want to connect is annoying. This occurs because Netatalk in the Ubuntu repositories is [...]]]></description>
			<content:encoded><![CDATA[<p>Installing Netatalk from the repositories means that when you connect using a Mac client you will be warned that you are going to send your password in the clear. Obviously this isn&#8217;t great for security, and being prompted every time you want to connect is annoying. This occurs because Netatalk in the Ubuntu repositories is compiled without SSL support (SSL is what handles the encryption).</p>
<p>The key to getting this to work is to get the Netatalk source code and compile it yourself. Don&#8217;t worry, it&#8217;s been done hundreds of times before and if you follow this tutorial closely you should be fine.</p>
<p>The commands written always start with a dollar sign ($), you should not type this, it just indicates the commands should be typed at a standard user prompt in the terminal.</p>
<p>First off it&#8217;s a good idea to switch to your home directory:<br />
<code>$ cd ~</code></p>
<p>Make a new directory to hold the hundreds of small Netatalk files:<br />
<code>$ mkdir netatalk</code></p>
<p>Ensure you have essential development libraries and tools installed:<br />
<code>$ sudo aptitude install libdb4.2-dev libslp-dev autotools-dev devscripts cracklib2-dev dpkg-dev libssl-dev</code></p>
<p>Change in to the newly created directory:<br />
<code>$ cd netatalk</code></p>
<p>Install the netatalk source code:<br />
<code>$ sudo apt-get source netatalk</code></p>
<p>Install all required dependencies for netatalk:<br />
<code>$ sudo apt-get build-dep netatalk</code></p>
<p>A new directory called <code>netatalk-2.0.3</code> should have been created, change in to that directory:<br />
<code>$ cd netatalk-2.0.3</code></p>
<p>Compile Netatalk with the SSL option:<br />
<code>$ DEB_BUILD_OPTIONS=ssl sudo dpkg-buildpackage -us -uc</code></p>
<p>Install the finished product!:<br />
<code>$ sudo debi</code></p>
]]></content:encoded>
			<wfw:commentRss>http://dragffy.com/blog/posts/installing-netatalk-afp-with-ssl-encrypted-authentication-on-ubuntu-hardy-heron-804-lts-server/feed</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Bug in Plesk mailbox quota management</title>
		<link>http://dragffy.com/blog/posts/bug-in-plesk-mailbox-quota-management</link>
		<comments>http://dragffy.com/blog/posts/bug-in-plesk-mailbox-quota-management#comments</comments>
		<pubDate>Fri, 09 May 2008 10:43:38 +0000</pubDate>
		<dc:creator>Gabe</dc:creator>
				<category><![CDATA[Information]]></category>
		<category><![CDATA[Operating System]]></category>
		<category><![CDATA[Server]]></category>
		<category><![CDATA[plesk]]></category>

		<guid isPermaLink="false">http://dragffy.com/blog/?p=43</guid>
		<description><![CDATA[Initially I had set a mail account with a quota of 200000, or roughly 200MB. The user complained of a full mailbox, despite using Plesk to up the limit to 2GB, and then unlimited the account continued to bounce emails saying:
"Recipient's mailbox is full"
I found people complaining of a bug in version 7.5 of Plesk, [...]]]></description>
			<content:encoded><![CDATA[<p>Initially I had set a mail account with a quota of 200000, or roughly 200MB. The user complained of a full mailbox, despite using Plesk to up the limit to 2GB, and then unlimited the account continued to bounce emails saying:<br />
<code>"Recipient's mailbox is full"</code></p>
<p>I found people complaining of a bug in version 7.5 of Plesk, but it seems this is also present in 8.3. The problem, I discovered after nosing around the config files of the server, was that any changes I made in Plesk weren&#8217;t saved. Ultimately I found the limit in the config file remained at 200MB, despite numerous changes. The quota config file is located at:<br />
<code>/var/qmail/mailnames/example.com/username/@mbox.quota</code></p>
<p>Manually edit that file so it has the quota you want. I like to use vim:<br />
<code>vim /var/qmail/mailnames/example.com/username/\@mbox.quota</code><br />
(run this as root)</p>
<p>After editing, save the changes, and you won&#8217;t need to restart any services or the server. Changes should take effect.</p>
<p>Note, that this was performed on a CentOS 5 installation, so paths and instructions may vary slightly on other systems.</p>
]]></content:encoded>
			<wfw:commentRss>http://dragffy.com/blog/posts/bug-in-plesk-mailbox-quota-management/feed</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
	</channel>
</rss>
