<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:copyright="http://blogs.law.harvard.edu/tech/rss" xmlns:image="http://purl.org/rss/1.0/modules/image/">
    <channel>
        <title>Setting up Applications</title>
        <link>http://alexkuo.info/category/13.aspx</link>
        <description>Entries that are about setting up different applications</description>
        <language>en-US</language>
        <copyright>Alex Kuo</copyright>
        <generator>Subtext Version 1.9.4.0</generator>
        <item>
            <title>IIS 6 Optimizations: Connection Timeout, Application Pools, Threads, Connection Strings, and File Compression.</title>
            <link>http://alexkuo.info/archive/2009/10/28/55.aspx</link>
            <description>&lt;p style="margin-bottom: 0in;"&gt;One of the sites I maintain was unable to serve pages due to the server timing out. At first, I suspected it was a bandwidth issue, since traffic was significantly elevated due to a recent ad campaign that was initiated. On close examination, I noticed the system's resources were barely taxed at all. Hard disk I/0, CPU usage, bandwidth, and memory were either normal or barely used. &lt;br /&gt;
&lt;/p&gt;
&lt;p style="margin-bottom: 0in;"&gt;&lt;br /&gt;
&lt;/p&gt;
&lt;p style="margin-bottom: 0in;"&gt;I then remembered a similar incident with another site that showed the same symptoms, except the site was hosted on an Apache server. The problem was that Apache was consuming too much memory and was unable to fulfill requests fast enough due to having a high connection timeout setting. The fix was to limit the amount of processes spawned and reduce the connection timeout setting.&lt;/p&gt;
&lt;p style="margin-bottom: 0in;"&gt;&lt;br /&gt;
&lt;/p&gt;
&lt;p style="margin-bottom: 0in;"&gt;Since memory and CPU usage was not an issue, the only other suspect was to check the connection timeout setting. The Connection Timeout setting is located under:&lt;/p&gt;
&lt;ol&gt;
    &lt;li&gt;
    &lt;p style="margin-bottom: 0in;"&gt;Open IIS Manager  	&lt;/p&gt;
    &lt;/li&gt;
    &lt;li&gt;
    &lt;p style="margin-bottom: 0in;"&gt;Expand websites  	&lt;/p&gt;
    &lt;/li&gt;
    &lt;li&gt;
    &lt;p style="margin-bottom: 0in;"&gt;Select target website's 	properties.  	&lt;/p&gt;
    &lt;/li&gt;
    &lt;li&gt;
    &lt;p style="margin-bottom: 0in;"&gt;Select Website tab  	&lt;/p&gt;
    &lt;/li&gt;
&lt;/ol&gt;
&lt;p style="margin-bottom: 0in;"&gt;On default, it is set to 120 or 900 seconds – a very long time, especially if a web server has a queue of 1000+ objects to serve. My recommendation is to set the Connection Timeout setting to 2-5 seconds. This will free up the amount of connections available to users immensely. In addition, there are other optimizations to threading and compression that aren't enabled by default. &lt;br /&gt;
&lt;/p&gt;
&lt;p style="margin-bottom: 0in;"&gt;&lt;br /&gt;
&lt;/p&gt;
&lt;p style="margin-bottom: 0in;"&gt;The following tweaks will help manage processes and threads for serving pages. In the %WINDIR%\Microsoft.NET\Framework\v1.1.4322\CONFIG\machine.config, set the following:&lt;/p&gt;
&lt;br /&gt;
&lt;table width="565"&gt;
    &lt;tbody&gt;
        &lt;tr&gt;
            &lt;td width="38%" class="data"&gt;&lt;strong&gt;Setting&lt;br /&gt;
            &lt;/strong&gt;&lt;/td&gt;
            &lt;td width="29%" class="data"&gt;Default&lt;/td&gt;
            &lt;td width="33%" class="data"&gt;"Optimized"&lt;br /&gt;
            &lt;/td&gt;
        &lt;/tr&gt;
        &lt;tr&gt;
            &lt;td width="38%" class="data"&gt;&lt;strong&gt;maxconnection &lt;/strong&gt;&lt;/td&gt;
            &lt;td width="29%" class="data"&gt;2&lt;/td&gt;
            &lt;td width="33%" class="data"&gt;12 * #CPUs &lt;/td&gt;
        &lt;/tr&gt;
        &lt;tr&gt;
            &lt;td width="38%" class="data"&gt;&lt;strong&gt;maxIoThreads &lt;/strong&gt;&lt;/td&gt;
            &lt;td width="29%" class="data"&gt;20 &lt;/td&gt;
            &lt;td width="33%" class="data"&gt;100 &lt;/td&gt;
        &lt;/tr&gt;
        &lt;tr&gt;
            &lt;td width="38%" class="data"&gt;&lt;strong&gt;maxWorkerThreads &lt;/strong&gt;&lt;/td&gt;
            &lt;td width="29%" class="data"&gt;20 &lt;/td&gt;
            &lt;td width="33%" class="data"&gt;100 &lt;/td&gt;
        &lt;/tr&gt;
        &lt;tr&gt;
            &lt;td width="38%" class="data"&gt;&lt;strong&gt;minFreeThreads &lt;/strong&gt;&lt;/td&gt;
            &lt;td width="29%" class="data"&gt;8 &lt;/td&gt;
            &lt;td width="33%" class="data"&gt;88 * #CPUs &lt;/td&gt;
        &lt;/tr&gt;
        &lt;tr&gt;
            &lt;td width="38%" class="data"&gt;&lt;strong&gt;minLocalRequestFreeThreads &lt;/strong&gt;&lt;/td&gt;
            &lt;td width="29%" class="data"&gt;4 &lt;/td&gt;
            &lt;td width="33%" class="data"&gt;76 * #CPUs &lt;/td&gt;
        &lt;/tr&gt;
    &lt;/tbody&gt;
&lt;/table&gt;
&lt;br /&gt;
&lt;style type="text/css"&gt;&lt;!--
		@page { size: 8.5in 11in; margin: 0.79in }
		P { margin-bottom: 0.08in }
	--&gt;&lt;/style&gt;Enabling file compression can free up a significant amount of bandwidth and increase the number of objects served at a time. First, give the folder where the compressed files will be stored write permissions to the IIS User. By default, this is “%windir%\IIS Temporary Compressed Files”. The IUSR_{machinename} will need the write permission to the folder.
&lt;p style="margin-bottom: 0in;"&gt;Next, you need to enable Compression in IIS.&lt;/p&gt;
&lt;ol&gt;
    &lt;li value="1"&gt;
    &lt;p style="margin-bottom: 0in;"&gt;Open IIS Manager  	&lt;/p&gt;
    &lt;/li&gt;
    &lt;li&gt;
    &lt;p style="margin-bottom: 0in;"&gt;Select the websites folder&lt;br /&gt;
    &lt;/p&gt;
    &lt;/li&gt;
    &lt;li&gt;
    &lt;p style="margin-bottom: 0in;"&gt;Right click and select properties.  	&lt;/p&gt;
    &lt;/li&gt;
    &lt;li&gt;
    &lt;p style="margin-bottom: 0in;"&gt;Select the Service's tab&lt;/p&gt;
    &lt;/li&gt;
    &lt;li&gt;
    &lt;p style="margin-bottom: 0in;"&gt;Enable &lt;em&gt;Compress application 	files&lt;/em&gt;  	&lt;/p&gt;
    &lt;/li&gt;
    &lt;li&gt;
    &lt;p style="margin-bottom: 0in;"&gt;Enable &lt;em&gt;Compress static files&lt;/em&gt; 		&lt;/p&gt;
    &lt;/li&gt;
    &lt;li&gt;
    &lt;p style="margin-bottom: 0in;"&gt;Set max size to something 	sensible.&lt;/p&gt;
    &lt;/li&gt;
&lt;/ol&gt;
&lt;p style="margin-bottom: 0in;"&gt;Then enable the direct Metabase editing. This allows you to  edit the metabase while IIS is running. &lt;br /&gt;
&lt;/p&gt;
&lt;ol&gt;
    &lt;li value="1"&gt;
    &lt;p style="margin-bottom: 0in;"&gt;Open IIS Manager  	&lt;/p&gt;
    &lt;/li&gt;
    &lt;li&gt;
    &lt;p style="margin-bottom: 0in;"&gt;Right click the computer icon  	&lt;/p&gt;
    &lt;/li&gt;
    &lt;li&gt;
    &lt;p style="margin-bottom: 0in;"&gt;select properties&lt;/p&gt;
    &lt;/li&gt;
    &lt;li&gt;
    &lt;p style="margin-bottom: 0in;"&gt;Check the checkbox 'Enable Direct 	Metabase Edit'&lt;/p&gt;
    &lt;/li&gt;
&lt;/ol&gt;
&lt;p style="margin-bottom: 0in;"&gt;Afterwards, you will need to open the IIS metabase by editing the file, %WINDIR%\system32\inetsrv\metabase.xml. Then find the attribute HcDynamicCompressionLevel and change the setting from 0 to 9, zero is the default setting. This will compress the pages as much possible without straining the CPU too much. There will two HcDynamicCompressionLevel attributes, each one under IIsCompressionScheme element that set deflate and gzip behaviors. Save the file.&lt;/p&gt;
&lt;p style="margin-bottom: 0in;"&gt;Next entails adding the file extensions for static and dynamic pages that will be compressed. To do this, open the command prompt and open the directory C:\InetPub\AdminScripts\. Then execute the following to enable compression for the most commonly served files.&lt;/p&gt;
&lt;br /&gt;
&lt;pre style="border: 1px inset ; margin: 0px; padding: 6px; overflow: auto; width: 800px; height: 175px; text-align: left;" dir="ltr" class="alt2"&gt;cscript.exe adsutil.vbs set W3Svc/Filters/Compression/GZIP/HcFileExtensions "htm" "html" "txt" "ppt" "xls" "xml" "pdf" "xslt" "doc" "xsl" "htc" "js" "css"&lt;br /&gt;&lt;br /&gt;cscript.exe adsutil.vbs set W3Svc/Filters/Compression/DEFLATE/HcFileExtensions "htm" "html" "txt" "ppt" "xls" "xml" "pdf" "xslt" "doc" "xsl" "htc" "js" "css"&lt;br /&gt;&lt;br /&gt;cscript.exe adsutil.vbs set W3Svc/Filters/Compression/GZIP/HcScriptFileExtensions "asp" "dll" "exe" "aspx" "asmx" "ashx"&lt;br /&gt;&lt;br /&gt;cscript.exe adsutil.vbs set W3Svc/Filters/Compression/DEFLATE/HcScriptFileExtensions "asp" "dll" "exe" "aspx" "asmx"&lt;br /&gt;&lt;br /&gt;IISreset.exe /restart&lt;br /&gt;&lt;/pre&gt;
&lt;p style="margin-bottom: 0in;"&gt;&lt;br /&gt;
&lt;/p&gt;
&lt;p style="margin-bottom: 0in;"&gt;Do not compress images, as they are already compressed [jpg, gif, tiff, etc.]&lt;/p&gt;
&lt;p style="margin-bottom: 0in;"&gt;&lt;br /&gt;
&lt;/p&gt;
&lt;p style="margin-bottom: 0in;"&gt;Adjusting the IIS Application Pool can help resource utilization. The settings I changed were: &lt;br /&gt;
&lt;/p&gt;
&lt;ul&gt;
    &lt;li&gt;'Limit Request Queues' setting under the Performance tab. Depending on how many CPUs, Worker Processes, and memory available, this setting can increase performance. The machine I was tweaking this setting on had 4 CPUs and 8 GB of RAM. I increased the limit from 4000 to 10,000 with only 1 worker process enabled. &lt;br /&gt;
    &lt;/li&gt;
    &lt;li&gt;Another setting I disabled in the tab was the 'Shutdown worker processes after being idle for..'. I noticed that starting worker processes was extremely expensive in terms of CPU usage.&lt;/li&gt;
&lt;/ul&gt;
&lt;p style="margin-bottom: 0in;"&gt;&lt;br /&gt;
&lt;/p&gt;
&lt;p style="margin-bottom: 0in;"&gt;If your site is database driven, you may want to turn off Connection Pooling and set a low connection timeout if you're confident that your server will not have resources issues when a large number of database connections are opened. In ASP.NET, add the Connect Timeout and Pooling settings to the connection string:&lt;/p&gt;
&lt;p style="margin-bottom: 0in;"&gt;&lt;br /&gt;
&lt;/p&gt;
&lt;pre class="alt2" dir="ltr" style="border: 1px inset ; margin: 0px; padding: 6px; overflow: auto; width: 640px; height: 80px; text-align: left;"&gt;Data Source=SERVERNAME;Database=DATABASENAME;Integrated Security=SSPI;Pooling=false;Connect Timeout=5;&lt;br /&gt;&lt;/pre&gt;
&lt;p style="margin-bottom: 0in;"&gt;&lt;br /&gt;
&lt;/p&gt;
&lt;p style="margin-bottom: 0in;"&gt;For references, please consult the following Links&lt;br /&gt;
&lt;/p&gt;
&lt;ul&gt;
    &lt;li&gt;&lt;a href="http://forums.asp.net/t/623323.aspx" target="_blank"&gt;Working with IIS 6.0 Application Pools – The Performance Tab&lt;/a&gt;&lt;/li&gt;
    &lt;li&gt;&lt;a href="http://www.eggheadcafe.com/articles/20050613.asp" target="_blank"&gt;IIS 6.0 Tuning for Performance&lt;/a&gt;&lt;/li&gt;
    &lt;li&gt;&lt;a href="http://weblogs.asp.net/owscott/archive/2004/01/12/57916.aspx" target="_blank"&gt;IIS Compression in IIS 6.0&lt;/a&gt;&lt;/li&gt;
    &lt;li&gt;&lt;a href="http://www.codeproject.com/KB/aspnet/ASPNET_and_IIS_60.aspx" target="_blank"&gt;Planning, Testing, and Tuning for ASP.NET and IIS&lt;/a&gt;&lt;/li&gt;
    &lt;li&gt;&lt;a target="_blank" href="http://www.connectionstrings.com/Articles/Show/all-sql-server-connection-string-keywords"&gt;SQL Server SqlConnection properties&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p style="margin-bottom: 0in;"&gt;&lt;br /&gt;
&lt;/p&gt;&lt;img src="http://alexkuo.info/aggbug/55.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>Alex Kuo</dc:creator>
            <guid>http://alexkuo.info/archive/2009/10/28/55.aspx</guid>
            <pubDate>Wed, 28 Oct 2009 21:00:57 GMT</pubDate>
            <comments>http://alexkuo.info/archive/2009/10/28/55.aspx#feedback</comments>
            <wfw:commentRss>http://alexkuo.info/comments/commentRss/55.aspx</wfw:commentRss>
            <trackback:ping>http://alexkuo.info/services/trackbacks/55.aspx</trackback:ping>
        </item>
        <item>
            <title>Ubuntu Server 7.10: Installing Proftpd and 'warning: unable to determine IP address of'</title>
            <link>http://alexkuo.info/archive/2008/03/06/50.aspx</link>
            <description>I had some trouble installing proftpd today on a Linode.com VPS server. For anyone that hasn't used linode, it's a colo service that lets people lease different grades of Linux VPS servers at reasonable prices. I've been using them for 4 months with few problems.&lt;br /&gt;
&lt;br /&gt;
Installing proftpd in Ubuntu is easy. All you have to do is open a Terminal window or SSH into your server and type:&lt;br /&gt;
&lt;br /&gt;
&lt;pre style="border: 1px inset ; margin: 0px; padding: 6px; overflow: auto; width: 640px; height: 34px; text-align: left;" dir="ltr" class="alt2"&gt;sudo apt-get install proftpd&lt;/pre&gt;
&lt;br /&gt;
However for some reason, the Ubuntu distros mounted on Linode's servers have a quirk or two that require a few tweaks to get the server working. The first thing is whether to run the server in standalone or xinetd mode. The server won't be able access port 21 unless it's operating in standalone mode. So, set it to standalone mode.&lt;br /&gt;
&lt;br /&gt;
The second quirk, which is not unique to Linode VPS servers, regards resolving the host's address. You must add the server's static address to the hosts file. For example, if your machine's name is 'johnny' and the static IP address is 79.221.23.12.&lt;br /&gt;
&lt;br /&gt;
To edit your hosts file type&lt;br /&gt;
&lt;br /&gt;
&lt;pre style="border: 1px inset ; margin: 0px; padding: 6px; overflow: auto; width: 640px; height: 34px; text-align: left;" dir="ltr" class="alt2"&gt;sudo vi /etc/hosts&lt;/pre&gt;
&lt;br /&gt;
Your hosts file  should look like this:&lt;br /&gt;
&lt;br /&gt;
&lt;pre style="border: 1px inset ; margin: 0px; padding: 6px; overflow: auto; width: 640px; height: 175px; text-align: left;" dir="ltr" class="alt2"&gt;127.0.0.1       localhost&lt;br /&gt;79.221.23.12	johnny&lt;br /&gt;&lt;br /&gt;# The following lines are desirable for IPv6 capable hosts&lt;br /&gt;::1     ip6-localhost ip6-loopback&lt;br /&gt;fe00::0 ip6-localnet&lt;br /&gt;ff00::0 ip6-mcastprefix&lt;br /&gt;ff02::1 ip6-allnodes&lt;br /&gt;ff02::2 ip6-allrouters&lt;br /&gt;ff02::3 ip6-allhosts&lt;/pre&gt;
&lt;br /&gt;
You can determine your machine's host name by opening the file,  '/etc/hostname'.&lt;br /&gt;
&lt;br /&gt;
Aftewards, check your proftpd configuration. To do this, type: &lt;br /&gt;
&lt;pre style="border: 1px inset ; margin: 0px; padding: 6px; overflow: auto; width: 640px; height: 34px; text-align: left;" dir="ltr" class="alt2"&gt;sudo proftpd -td5&lt;/pre&gt;
&lt;br /&gt;
If you would like more information on setting up Proftpd or Ubuntu's network configuration. Please consult the following:&lt;br /&gt;
&lt;br /&gt;
&lt;ul&gt;
    &lt;li&gt;&lt;a href="http://ubuntuforums.org/showthread.php?t=79588"&gt;Ubuntu Forms: Setting up Proftpd&lt;/a&gt;&lt;/li&gt;
    &lt;li&gt;&lt;a href="http://alexkuo.info/archive/2007/06/26/34.aspx"&gt;Alexkuo.info: Ubuntu Server 7.04 Fiesty: Installation Problems and Changing Network Settings from DHCP to Static IP (Still valid for Ubuntu 7.10&lt;/a&gt;)&lt;/li&gt;
    &lt;li&gt;&lt;a href="http://www.castaglia.org/proftpd/doc/contrib/ProFTPD-mini-HOWTO-DNS.html"&gt;Proftpd and DNS&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;&lt;img src="http://alexkuo.info/aggbug/50.aspx" width="1" height="1" /&gt;</description>
            <guid>http://alexkuo.info/archive/2008/03/06/50.aspx</guid>
            <pubDate>Thu, 06 Mar 2008 23:54:24 GMT</pubDate>
            <comments>http://alexkuo.info/archive/2008/03/06/50.aspx#feedback</comments>
            <slash:comments>2</slash:comments>
            <wfw:commentRss>http://alexkuo.info/comments/commentRss/50.aspx</wfw:commentRss>
            <trackback:ping>http://alexkuo.info/services/trackbacks/50.aspx</trackback:ping>
        </item>
        <item>
            <title>PostgreSQL 8.2: Recovering from a Corrupted Database</title>
            <link>http://alexkuo.info/archive/2007/11/26/48.aspx</link>
            <description>Today I encountered my second database corruption or crash on my development machine. The problem is that my IDE drive sucks, an old IBM 75GXP. For those of you who don't remember, these drives were notorious for having all sorts of problems when they were released. Most of the problems revolved around dying after six months. Regardless, I'm still using this thing for another month. &lt;br /&gt;
&lt;br /&gt;
You can tell if your database became corrupted by restarting the postmaster or typing:&lt;br /&gt;
&lt;br /&gt;
&lt;pre class="alt2" dir="ltr" style="border: 1px inset ; margin: 0px; padding: 6px; overflow: auto; width: 800px; height: 50px; text-align: left;"&gt;sudo /etc/init.d/posrgresql-8.2 restart&lt;br /&gt;&lt;/pre&gt;
&lt;br /&gt;
The result of the command will look similar to the following:&lt;br /&gt;
&lt;br /&gt;
&lt;pre class="alt2" dir="ltr" style="border: 1px inset ; margin: 0px; padding: 6px; overflow: auto; width: 800px; height: 150px; text-align: left;"&gt;2007-11-26 13:14:48 CST LOG:  server process (PID 16312) was terminated by signal 11&lt;br /&gt;2007-11-26 13:14:48 CST LOG:  terminating any other active server processes&lt;br /&gt;2007-11-26 13:14:48 CST LOG:  all server processes terminated; reinitializing&lt;br /&gt;2007-11-26 13:14:48 CST LOG:  database system was interrupted at 2007-11-26 13:14:47 CST&lt;br /&gt;2007-11-26 13:14:48 CST LOG:  checkpoint record is at 0/965E4130&lt;br /&gt;2007-11-26 13:14:48 CST LOG:  redo record is at 0/965E4130; undo record is at 0/0; shutdown TRUE&lt;br /&gt;2007-11-26 13:14:48 CST LOG:  next transaction ID: 0/73629; next OID: 10952256&lt;br /&gt;2007-11-26 13:14:48 CST LOG:  next MultiXactId: 1; next MultiXactOffset: 0&lt;br /&gt;2007-11-26 13:14:48 CST LOG:  database system was not properly shut down; automatic recovery in progress&lt;br /&gt;2007-11-26 13:14:48 CST LOG:  record with zero length at 0/965E4178&lt;/pre&gt;
&lt;br /&gt;
Before initiating any recovery options, I recommend backing up your $PGDATA directory. The following directions will attempt to reset the transaction log, and you may loose the latest changes to your databases. The first option for recovering from a crash is to open your '/etc/postgresql/8.2/main/postgresql.conf' file and turn on the following option:&lt;br /&gt;
&lt;br /&gt;
&lt;pre class="alt2" dir="ltr" style="border: 1px inset ; margin: 0px; padding: 6px; overflow: auto; width: 800px; height: 50px; text-align: left;"&gt;...&lt;br /&gt;zero_damaged_pages = true&lt;br /&gt;&lt;/pre&gt;
&lt;br /&gt;
After saving the changes, type the following to restart postgresql:&lt;br /&gt;
&lt;br /&gt;
&lt;pre class="alt2" dir="ltr" style="border: 1px inset ; margin: 0px; padding: 6px; overflow: auto; width: 800px; height: 50px; text-align: left;"&gt;sudo /etc/init.d/postgresql-8.2 restart&lt;br /&gt;&lt;/pre&gt;
&lt;br /&gt;
If you still see error messages, you may need to restart the entire computer in order to get postgresql to start.&lt;br /&gt;
&lt;br /&gt;
After restarting postgresql, reopen the '/etc/postgresql/8.2/main/postgresql.conf' file and comment out the zero_damaged_pages option. The line should look similar to the following:&lt;br /&gt;
&lt;br /&gt;
&lt;pre class="alt2" dir="ltr" style="border: 1px inset ; margin: 0px; padding: 6px; overflow: auto; width: 800px; height: 50px; text-align: left;"&gt;#zero_damaged_pages = true&lt;/pre&gt;
&lt;br /&gt;
After reading a few posts, it seems that IDE drives in general should not be used when working with databases because of corruption issues. If you are using an IDE drive, I recommend adding the following options to the '/etc/postgresql/8.2/main/postgresql.conf' file.&lt;br /&gt;
&lt;br /&gt;
&lt;pre class="alt2" dir="ltr" style="border: 1px inset ; margin: 0px; padding: 6px; overflow: auto; width: 800px; height: 50px; text-align: left;"&gt;fsync = on				# turns forced synchronization on or off&lt;br /&gt;wal_sync_method = fsync	&lt;/pre&gt;
&lt;br /&gt;
The problem with turning on fsync is that it slows down the performance of Postgresql, however, it should prevent further corruption issues with your database.&lt;br /&gt;
&lt;br /&gt;
You can find more information about these configuration options in the &lt;a href="http://www.postgresql.org/docs/8.2/static/runtime-config-wal.html" target="_blank"&gt;Postgresql 8.2 documentation&lt;/a&gt;.&lt;br /&gt;
&lt;br /&gt;
Reference:&lt;br /&gt;
&lt;ul&gt;
    &lt;li&gt;&lt;a href="http://www.postgresql.org/docs/8.2/static/app-pgresetxlog.html" target="_blank"&gt;pg_resetxlog - Tool used as a last resort for resetting the transaction log&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;&lt;img src="http://alexkuo.info/aggbug/48.aspx" width="1" height="1" /&gt;</description>
            <guid>http://alexkuo.info/archive/2007/11/26/48.aspx</guid>
            <pubDate>Tue, 27 Nov 2007 01:50:31 GMT</pubDate>
            <comments>http://alexkuo.info/archive/2007/11/26/48.aspx#feedback</comments>
            <wfw:commentRss>http://alexkuo.info/comments/commentRss/48.aspx</wfw:commentRss>
            <trackback:ping>http://alexkuo.info/services/trackbacks/48.aspx</trackback:ping>
        </item>
        <item>
            <title>Ubuntu Desktop 7.10: Setup HP 1200 Printer</title>
            <link>http://alexkuo.info/archive/2007/10/24/45.aspx</link>
            <description>After a short search through the Ubuntu forums, I ran into this &lt;a target="_blank" href="http://ubuntuforums.org/showthread.php?t=184838&amp;amp;highlight=setup+hp+printer"&gt;post&lt;/a&gt; that went into details about setting up a HP printing device. After briefly reading through the instructions, I ran a utility called 'HPLIP'. 'HPLIP' is a program that will automatically download and compile all the necessary files to activate your printer.  The program will ask you a few questions about your computer and request you replug-in your printer at the end of the installation. After doing this, I printed a test page and golly... it actually worked. &lt;img src="http://alexkuo.info/images/alexkuo_info/omg_smile.gif" alt="" /&gt;&lt;img src="http://alexkuo.info/aggbug/45.aspx" width="1" height="1" /&gt;</description>
            <guid>http://alexkuo.info/archive/2007/10/24/45.aspx</guid>
            <pubDate>Wed, 24 Oct 2007 10:09:03 GMT</pubDate>
            <comments>http://alexkuo.info/archive/2007/10/24/45.aspx#feedback</comments>
            <slash:comments>5</slash:comments>
            <wfw:commentRss>http://alexkuo.info/comments/commentRss/45.aspx</wfw:commentRss>
            <trackback:ping>http://alexkuo.info/services/trackbacks/45.aspx</trackback:ping>
        </item>
        <item>
            <title>Ubuntu Linux: Syncing Documents between Different Computers Using NFS and Unison</title>
            <link>http://alexkuo.info/archive/2007/10/18/44.aspx</link>
            <description>The other day I successfully made a full transition from my laptop to my desktop as my primary development environment. The biggest hurdle before completing this transition was transferring and syncing documents between my two laptop and desktop. For quick file transfers, I created a network file share, or NFS, on my desktop, while mounting the drive on my laptop. For a quick overview on how to setup and mount NFS, consult this &lt;a href="http://ubuntuforums.org/showthread.php?t=249889" target="_blank"&gt;thread&lt;/a&gt; on Ubuntu forums.&lt;br /&gt;
&lt;br /&gt;
I also wanted to sync and compare documents from a centralized server and have the ability to compare differences between a client and a centralized 'master' copy. (think Subversion - but without all the permissions and change logging) After a quick Google search, I found a wonderful program called 'Unison'. This program will allow a user to define a master directory on a server and slave directory on a client. Master being the label for the directory where all clients compare their files and slave as clients that send new files or receive files copied from other clients to the master directory. For directions on installing unison, consult this &lt;a href="http://www.howtoforge.com/linux_unison" target="_blank"&gt;article&lt;/a&gt; on howtoforge.com.&lt;img src="http://alexkuo.info/aggbug/44.aspx" width="1" height="1" /&gt;</description>
            <guid>http://alexkuo.info/archive/2007/10/18/44.aspx</guid>
            <pubDate>Thu, 18 Oct 2007 07:22:50 GMT</pubDate>
            <comments>http://alexkuo.info/archive/2007/10/18/44.aspx#feedback</comments>
            <slash:comments>1</slash:comments>
            <wfw:commentRss>http://alexkuo.info/comments/commentRss/44.aspx</wfw:commentRss>
            <trackback:ping>http://alexkuo.info/services/trackbacks/44.aspx</trackback:ping>
        </item>
        <item>
            <title>Ubuntu Desktop: Unplugging/Replugging your Network Cable on your Laptop and Requesting a New Address from DHCP.</title>
            <link>http://alexkuo.info/archive/2007/08/09/41.aspx</link>
            <description>Sometimes when working on my laptop, which has Ubuntu Desktop installed on it, I have to move it around and therefore unplug the network cable and switch to wireless or vice versa. Unplugging and replugging your laptop into a network sometimes results in the laptop's inability to renew its IP address or re-establish a connection with the internet. After a quick Google search, I found this &lt;a target="_blank" href="http://ubuntuforums.org/archive/index.php/t-11885.html"&gt;post &lt;/a&gt;about the problem. &lt;br /&gt;
&lt;br /&gt;
In order to issue a command similar to 'ipconfig -renew' in Windows, open your shell and type the following:&lt;br /&gt;
&lt;br /&gt;
&lt;pre class="alt2" dir="ltr" style="border: 1px inset ; margin: 0px; padding: 6px; overflow: auto; width: 640px; height: 50px; text-align: left;"&gt;sudo ifdown eth0&lt;br /&gt;sudo ifup eth0&lt;/pre&gt;
&lt;br /&gt;
These two commands will renew your IP address and should fix the connection problem. However, there's a program called &lt;a target="_blank" href="http://0pointer.de/lennart/projects/ifplugd/"&gt;'ifplugd'&lt;/a&gt; that monitors your network connection and automatically renews your address if this problem occurs. To install this program, open your shell and type:&lt;br /&gt;
&lt;br /&gt;
&lt;pre class="alt2" dir="ltr" style="border: 1px inset ; margin: 0px; padding: 6px; overflow: auto; width: 640px; height: 50px; text-align: left;"&gt;sudo apt-get install ifplugd&lt;/pre&gt;&lt;img src="http://alexkuo.info/aggbug/41.aspx" width="1" height="1" /&gt;</description>
            <guid>http://alexkuo.info/archive/2007/08/09/41.aspx</guid>
            <pubDate>Fri, 10 Aug 2007 03:05:53 GMT</pubDate>
            <comments>http://alexkuo.info/archive/2007/08/09/41.aspx#feedback</comments>
            <slash:comments>3</slash:comments>
            <wfw:commentRss>http://alexkuo.info/comments/commentRss/41.aspx</wfw:commentRss>
            <trackback:ping>http://alexkuo.info/services/trackbacks/41.aspx</trackback:ping>
        </item>
        <item>
            <title>Mirroring an FTP site in Ubuntu Server</title>
            <link>http://alexkuo.info/archive/2007/07/09/37.aspx</link>
            <description>The other day I was tasked with mirroring a FTP site, about 5+ gigs of files, on our local server. Mirroring directories is a fairly common task when administering servers, however, the main differences when tasked with this job are the protocols available, whether the job is bi-directional or one way, and the how fast the mirroring needs to occur. &lt;br /&gt;
&lt;br /&gt;
Lucky for me, this job did not demand instantaneous sync and the job was only one way - meaning changes from a server were reflected only from one server. The biggest problem was this job was limited to using only the FTP protocol for mirroring the site. This immediately removed rsync, a popular server/client for syncing directories remotely, as an option. After a quick search through the Ubuntu forums, I stumbled upon a post that detailed several programs on mirroring an FTP site using FTP protocol only. I chose a program called 'ftpmirror'. &lt;br /&gt;
&lt;br /&gt;
Ftpmirror is a program that lets a user define 'packages', which are configuration details for mirroring an FTP site, and scheduling these 'packages' to be run daily, monthly, or weekly. To install this program, I typed&lt;br /&gt;
&lt;br /&gt;
&lt;pre class="alt2" dir="ltr" style="border: 1px inset ; margin: 0px; padding: 6px; overflow: auto; width: 640px; height: 50px; text-align: left;"&gt;sudo apt-get install ftpmirror&lt;/pre&gt;
&lt;br /&gt;
If you're using Ubuntu Server, the configuration files should reside in the '/etc/ftpmirror/' directory. Upon browsing through the directory, you will find a file called 'ftpmirror.cf-sample'. This file contains a few example 'packages' that can be used as a template. The user puts any active 'packages' in the 'ftpmirror.cf' file. My 'ftpmirror.cf' file looks like this:&lt;br /&gt;
&lt;br /&gt;
&lt;pre class="alt2" dir="ltr" style="border: 1px inset ; margin: 0px; padding: 6px; overflow: auto; width: 640px; height: 100px; text-align: left;"&gt;package = alexkuo_media&lt;br /&gt; ftp-server = master.alexkuo.info&lt;br /&gt; ftp-user = mirror&lt;br /&gt; ftp-pass = password&lt;br /&gt; remote-directory = /media/pics/&lt;br /&gt; local-directory = /home/deploy/media/pics&lt;br /&gt;&lt;/pre&gt;
&lt;br /&gt;
This package uses the directory '/media/pics/' as the root directory on the ftp server 'master.alexkuo.info' and uses the login/password, mirror/password, to login into the remote server. All files, directories, and subdirectories found in the '/media/pics' directory are then downloaded into the '/home/deploy/media/pics' directory on the local machine once the package is activated.&lt;br /&gt;
&lt;br /&gt;
I decided to run this job once a week, so I added the package to the '/etc/ftpmirror/list.weekly' file. To do this, open the 'list.weekly' file with a text editor. Mine looks like this:&lt;br /&gt;
&lt;br /&gt;
&lt;pre class="alt2" dir="ltr" style="border: 1px inset ; margin: 0px; padding: 6px; overflow: auto; width: 640px; height: 50px; text-align: left;"&gt;alexkuo_media&lt;/pre&gt;
&lt;br /&gt;
Pretty plain huh? I removed the comments that originally came with the file, so it looks pretty bare. Adding another package involves defining another package in the ftpmirror.cf file and appending the package name on a new line in one of the *.list files.&lt;img src="http://alexkuo.info/aggbug/37.aspx" width="1" height="1" /&gt;</description>
            <guid>http://alexkuo.info/archive/2007/07/09/37.aspx</guid>
            <pubDate>Mon, 09 Jul 2007 12:11:27 GMT</pubDate>
            <comments>http://alexkuo.info/archive/2007/07/09/37.aspx#feedback</comments>
            <wfw:commentRss>http://alexkuo.info/comments/commentRss/37.aspx</wfw:commentRss>
            <trackback:ping>http://alexkuo.info/services/trackbacks/37.aspx</trackback:ping>
        </item>
        <item>
            <title>Ubuntu Server 7.04 Fiesty: Mounting or Accessing a USB Drive in Bash Shell</title>
            <link>http://alexkuo.info/archive/2007/06/28/36.aspx</link>
            <description>I ran into a problem today accessing a USB Drive in Ubuntu Server. In Windows and in Ubuntu Standard, plug and play works fine. My laptop, which has Ubuntu installed, immediately recognized the USB drive once it was plugged in. I accessed its contents in the Bash shell by typing:&lt;br /&gt;
&lt;br /&gt;
&lt;pre style="border: 1px inset ; margin: 0px; padding: 6px; overflow: auto; width: 640px; height: 50px; text-align: left;" dir="ltr" class="alt2"&gt;ls -l /media&lt;br /&gt;ls -l /media/ExternalHDD&lt;br /&gt;&lt;/pre&gt;
&lt;br /&gt;
Typing the same thing in Ubuntu Server will not yield the same results. Ubuntu 7.04 server does not come with automatic mounting. After plugging in your drive, you need to run a few commands before access to the drive will be allowed. The first command is to install a program called 'pmount'. Type:&lt;br /&gt;
&lt;br /&gt;
&lt;pre style="border: 1px inset ; margin: 0px; padding: 6px; overflow: auto; width: 640px; height: 50px; text-align: left;" dir="ltr" class="alt2"&gt;sudo apt-get install pmount&lt;br /&gt;&lt;/pre&gt;
&lt;br /&gt;
After installing the pmount, you need to figure out what the drive is called on your system. Type:&lt;br /&gt;
&lt;br /&gt;
&lt;pre style="border: 1px inset ; margin: 0px; padding: 6px; overflow: auto; width: 640px; height: 50px; text-align: left;" dir="ltr" class="alt2"&gt;fdisk -l&lt;/pre&gt;
&lt;br /&gt;
You should see output that looks like this:&lt;br /&gt;
&lt;br /&gt;
&lt;pre style="border: 1px inset ; margin: 0px; padding: 6px; overflow: auto; width: 640px; height: 100px; text-align: left;" dir="ltr" class="alt2"&gt;Disk /dev/sdf: 300.0 GB, 300069052416 bytes&lt;br /&gt;255 heads, 63 sectors/track, 36481 cylinders&lt;br /&gt;Units = cylinders of 16065 * 512 = 8225280 bytes&lt;br /&gt;&lt;br /&gt;   Device Boot      Start         End      Blocks   Id  System&lt;br /&gt;/dev/sdf4   *           1       36481   293033601    7  HPFS/NTFS&lt;br /&gt;&lt;/pre&gt;
&lt;br /&gt;
The USB drive I am using is called '/dev/sdf4'. To mount the drive, you're need to create a directory to alias the drive and use pmount to reference the alias. To do this I type:&lt;br /&gt;
&lt;span style="font-family: monospace;"&gt;&lt;/span&gt;&lt;br /&gt;
&lt;pre style="border: 1px inset ; margin: 0px; padding: 6px; overflow: auto; width: 640px; height: 50px; text-align: left;" dir="ltr" class="alt2"&gt;sudo mkdir /media/usbdrive&lt;br /&gt;pmount /dev/sdf4 /media/usbdrive&lt;/pre&gt;
&lt;br /&gt;
Afterwards, I copied a bunch of files on the USB drive and set the ownership of the files from root to myself. I typed:&lt;br /&gt;
&lt;br /&gt;
&lt;pre style="border: 1px inset ; margin: 0px; padding: 6px; overflow: auto; width: 640px; height: 50px; text-align: left;" dir="ltr" class="alt2"&gt;sudo cp -R /media/usbdrive/filesToCopy /home/alex/&lt;br /&gt;cd /home/alex&lt;br /&gt;sudo chown -R alex:alex filesToCopy  &lt;/pre&gt;
&lt;h3&gt;New Article&lt;/h3&gt;
&lt;ul&gt;
    &lt;li&gt;&lt;a href="http://alexkuo.info/archive/2007/06/28/35.aspx"&gt;CruiseControl Server and Django: How to Setup CruiseControl to Automatically Deploy Django Applications&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;&lt;img src="http://alexkuo.info/aggbug/36.aspx" width="1" height="1" /&gt;</description>
            <guid>http://alexkuo.info/archive/2007/06/28/36.aspx</guid>
            <pubDate>Fri, 29 Jun 2007 02:32:15 GMT</pubDate>
            <comments>http://alexkuo.info/archive/2007/06/28/36.aspx#feedback</comments>
            <slash:comments>1</slash:comments>
            <wfw:commentRss>http://alexkuo.info/comments/commentRss/36.aspx</wfw:commentRss>
            <trackback:ping>http://alexkuo.info/services/trackbacks/36.aspx</trackback:ping>
        </item>
        <item>
            <title>Ubuntu Server 7.04 Fiesty: Installation Problems and Changing Network Settings from DHCP to Static IP</title>
            <link>http://alexkuo.info/archive/2007/06/26/34.aspx</link>
            <description>Tonight I deployed another installation of Ubuntu Server 7.04 Fiesty. The biggest problem I ran into was setting up the network card. Apparently, the Ubuntu setup wizard tries to contact the network in at least two points during the installation wizard. In one of the points of the installation, failure to contact a server on the internet results in the installation hanging. I got around this by running the installation while connected to my residential DHCP network and then redeploying the server to the DMZ, which requires defining a static IP.&lt;br /&gt;
&lt;br /&gt;
This created another problem - How do you change the network settings from DHCP to static IP address? In order to solve this problem, you need to update your interfaces file to use an assigned static IP address and configure the server to use your network's DNS servers.&lt;br /&gt;
&lt;br /&gt;
To change your network settings from DHCP to static IP, type:&lt;br /&gt;
&lt;br /&gt;
&lt;pre class="alt2" dir="ltr" style="border: 1px inset ; margin: 0px; padding: 6px; overflow: auto; width: 640px; height: 50px; text-align: left;"&gt;sudo vi /etc/network/interfaces&lt;/pre&gt;
&lt;br /&gt;
The file displayed should have a line that says ' iface eth0 inet dhcp' or something similar. Change the file to look like the following:&lt;br /&gt;
&lt;br /&gt;
&lt;pre class="alt2" dir="ltr" style="border: 1px inset ; margin: 0px; padding: 6px; overflow: auto; width: 640px; height: 200px; text-align: left;"&gt;....&lt;br /&gt;....&lt;br /&gt;....&lt;br /&gt;auto eth0&lt;br /&gt;iface eth0 inet static&lt;br /&gt;	address 71.164.212.40&lt;br /&gt;	netmask 255.255.255.0&lt;br /&gt;	network 71.164.212.0&lt;br /&gt;	broadcast 71.164.0.255&lt;br /&gt;	gateway 71.164.212.1&lt;/pre&gt;
&lt;br /&gt;
Afterwards, restart your network interface by typing:&lt;br /&gt;
&lt;br /&gt;
&lt;pre class="alt2" dir="ltr" style="border: 1px inset ; margin: 0px; padding: 6px; overflow: auto; width: 640px; height: 50px; text-align: left;"&gt;sudo /etc/init.d/networking restart&lt;br /&gt;&lt;/pre&gt;
&lt;br /&gt;
Next, you need to configure your DNS servers. You need at least two entries. To edit your DNS entries type:&lt;br /&gt;
&lt;br /&gt;
&lt;pre class="alt2" dir="ltr" style="border: 1px inset ; margin: 0px; padding: 6px; overflow: auto; width: 640px; height: 50px; text-align: left;"&gt;sudo vi /etc/resolv.conf&lt;/pre&gt;
&lt;br /&gt;
My file looked like this:&lt;br /&gt;
&lt;br /&gt;
&lt;pre class="alt2" dir="ltr" style="border: 1px inset ; margin: 0px; padding: 6px; overflow: auto; width: 640px; height: 50px; text-align: left;"&gt;nameserver 4.2.2.1&lt;br /&gt;nameserver 4.2.2.2&lt;/pre&gt;
&lt;br /&gt;
After saving the file, you should be able to connect to the network.&lt;br /&gt;
&lt;br /&gt;
If you would like to edit your hosts file, type the following in your shell.&lt;br /&gt;
&lt;br /&gt;
&lt;pre class="alt2" dir="ltr" style="border: 1px inset ; margin: 0px; padding: 6px; overflow: auto; width: 640px; height: 50px; text-align: left;"&gt;sudo vi /etc/hosts&lt;br /&gt;&lt;/pre&gt;
&lt;br /&gt;
You can add more references to your localhost in here. Mine looks like this:&lt;br /&gt;
&lt;br /&gt;
&lt;pre class="alt2" dir="ltr" style="border: 1px inset ; margin: 0px; padding: 6px; overflow: auto; width: 640px; height: 175px; text-align: left;"&gt;127.0.0.1       localhost&lt;br /&gt;127.0.0.1	alex-server&lt;br /&gt;127.0.0.1	sandbox-server&lt;br /&gt;&lt;br /&gt;# The following lines are desirable for IPv6 capable hosts&lt;br /&gt;::1     ip6-localhost ip6-loopback&lt;br /&gt;fe00::0 ip6-localnet&lt;br /&gt;ff00::0 ip6-mcastprefix&lt;br /&gt;ff02::1 ip6-allnodes&lt;br /&gt;ff02::2 ip6-allrouters&lt;br /&gt;ff02::3 ip6-allhosts&lt;/pre&gt;
&lt;p&gt;If you would like to change the hostname of your server, type the following:&lt;/p&gt;
&lt;br /&gt;
&lt;pre class="alt2" dir="ltr" style="border: 1px inset ; margin: 0px; padding: 6px; overflow: auto; width: 640px; height: 50px; text-align: left;"&gt;sudo vi /etc/hostname&lt;/pre&gt;
&lt;br /&gt;
After typing in your new hostname, you need to run a script to implement the change. Type:&lt;br /&gt;
&lt;br /&gt;
&lt;pre class="alt2" dir="ltr" style="border: 1px inset ; margin: 0px; padding: 6px; overflow: auto; width: 640px; height: 50px; text-align: left;"&gt;sudo &lt;code&gt;/etc/init.d/hostname.sh start&lt;/code&gt;&lt;/pre&gt;
&lt;h3&gt;References&lt;/h3&gt;
&lt;ul&gt;
    &lt;li&gt;&lt;a href="http://www.ubuntugeek.com/ubuntu-704-feisty-fawn-lamp-server-setup.html" target="_blank"&gt;Ubuntugeek.com - Ubuntu 7.04 Fiesty Fawn LAMP Server Setup&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;&lt;img src="http://alexkuo.info/aggbug/34.aspx" width="1" height="1" /&gt;</description>
            <guid>http://alexkuo.info/archive/2007/06/26/34.aspx</guid>
            <pubDate>Tue, 26 Jun 2007 13:12:31 GMT</pubDate>
            <comments>http://alexkuo.info/archive/2007/06/26/34.aspx#feedback</comments>
            <slash:comments>1</slash:comments>
            <wfw:commentRss>http://alexkuo.info/comments/commentRss/34.aspx</wfw:commentRss>
            <trackback:ping>http://alexkuo.info/services/trackbacks/34.aspx</trackback:ping>
        </item>
        <item>
            <title>Getting Around Linux: Compiling Python Extensions and Ubuntu's Missing Packages</title>
            <link>http://alexkuo.info/archive/2007/05/18/10.aspx</link>
            <description>Last night I spent an awful lot of time trying to figure out how to compile an extension for Python. My struggles were quickly solved &lt;a href="http://ubuntuforums.org/showthread.php?t=447195" target="_blank"&gt;with the help of a charitable poster on Ubuntuforums.org&lt;/a&gt;. On default installations of Ubuntu 7.04 Fiesty, no development packages for the C compiler (aka gcc) and Python are included. In the end, the remedy was to install the C compiler and the Python development packages.&lt;br /&gt;
&lt;br /&gt;
In order to accomplish this, type the following in the Bash prompt.&lt;br /&gt;
&lt;br /&gt;
&lt;pre style="border: 1px inset ; margin: 0px; padding: 6px; overflow: auto; width: 640px; height: 34px; text-align: left;" dir="ltr" class="alt2"&gt;sudo apt-get install python-dev&lt;/pre&gt;
&lt;br /&gt;
This installs the Python development packages. You also need to type:&lt;br /&gt;
&lt;br /&gt;
&lt;pre style="border: 1px inset ; margin: 0px; padding: 6px; overflow: auto; width: 640px; height: 34px; text-align: left;" dir="ltr" class="alt2"&gt;sudo apt-get install build-essential&lt;/pre&gt;
&lt;br /&gt;
This installs the C compiler. &lt;br /&gt;
&lt;br /&gt;
After adding these magical packages, the extension I was trying to add compiled and was 'successfully' working. I put 'successfully' in quotes because I later found out that their were errors in the extension regarding a function call to localization, which was fixed about an hour later after some debugging.&lt;br /&gt;
&lt;br /&gt;
Just in case you were wondering, the extension I was adding is called &lt;a href="http://jamwt.com/pgasync/" target="_blank"&gt;pgasync&lt;/a&gt;. It's a asynchronous data adapter for PostgreSQL. If this works reliably, it may be able to scale better than using psycopg2, which is synchronous.&lt;br /&gt;&lt;img src="http://alexkuo.info/aggbug/10.aspx" width="1" height="1" /&gt;</description>
            <guid>http://alexkuo.info/archive/2007/05/18/10.aspx</guid>
            <pubDate>Fri, 18 May 2007 21:40:12 GMT</pubDate>
            <comments>http://alexkuo.info/archive/2007/05/18/10.aspx#feedback</comments>
            <slash:comments>2</slash:comments>
            <wfw:commentRss>http://alexkuo.info/comments/commentRss/10.aspx</wfw:commentRss>
            <trackback:ping>http://alexkuo.info/services/trackbacks/10.aspx</trackback:ping>
        </item>
    </channel>
</rss>