<?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>Europheus</title>
	<atom:link href="http://www.europheus.com/?feed=rss2" rel="self" type="application/rss+xml" />
	<link>http://www.europheus.com</link>
	<description>A complete waste of a fine weblog.</description>
	<lastBuildDate>Mon, 21 Dec 2009 04:14:46 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Windows 7 Review &#8211; 2nd day after install</title>
		<link>http://www.europheus.com/?p=109</link>
		<comments>http://www.europheus.com/?p=109#comments</comments>
		<pubDate>Mon, 21 Dec 2009 04:04:32 +0000</pubDate>
		<dc:creator>europheus</dc:creator>
				<category><![CDATA[Windows]]></category>

		<guid isPermaLink="false">http://www.europheus.com/?p=109</guid>
		<description><![CDATA[Well this is not a professional review, just some thoughts based on my recent upgrade from Windows Vista 64 on to Windows 7 Professional 64.  Now for the background, I&#8217;ve been running Vista on my main workstation (Core 2 Duo / 8gb ram) since early 2009.  I only had a few issues until [...]]]></description>
			<content:encoded><![CDATA[<p>Well this is not a professional review, just some thoughts based on my recent upgrade from Windows Vista 64 on to Windows 7 Professional 64.  Now for the background, I&#8217;ve been running Vista on my main workstation (Core 2 Duo / 8gb ram) since early 2009.  I only had a few issues until the end of 2009 when the windows start menu stopped working.  I followed so many forums and &#8216;finally got it working&#8217; posts that didn&#8217;t work for me. I realized that I needed to re-install Vista to fix the problem, but why do that?  Why not throw more money to M$ and pray for the best.  </p>
<p>So I ordered Windows 7 and gave up the cash. Having just installed Ubuntu 9.10 (for free) on my laptop, and installing Snow Lepoard (for $30) on my mac mini, dropping some coin for M$ is a bit difficult. Once it got to my house, I started making backups of all things on my C: drive. I copied the entire C:\Users folder to my D: drive and I did this with all applications closed, and not using the computer until the copy was complete.  I also copied various other folders that I keep on my C: drive because its fast (a WD raptor).</p>
<p>The Windows 7 install is quite fast.  It makes me think they trimmed things down.  I always choose to do a fresh install rather than an upgrade, and this is why I copied data from the C drive on to my D drive.  If you only have one drive in your computer, stop what you are doing right now and buy a second drive, thank me later.  When the install completed, I noticed that my D drive was not available, and that is because it is a RAID setup and the driver was not installed on Windows.  So first things first, let Windows update itself.</p>
<p>After the update, the RAID D drive was visible, and now I can start installing applications that I saved to this backup drive.  There were several applications that I was concerned about in terms of compatibility issues, such as VMWare Server 2.0, Cubase 5, and the MOTO 828mk3 drivers. To my surprise these apps initially worked.  VMWare Server crapped out on me after additional Windows updates and software installs but I will get into this later. Next I installed Java 6, Eclipse, Office 2007,  and did at least 5 reboots, then my system was back to where I was with Vista &#8211; except now the start menu worked.  The startup time is about the same, and the overall feel is about the same (as Vista) so no dramatic changes </p>
<p>Obviously there are some differences between Windows 7 and Vista, and furthermore, Windows XP.  The taskbar is the most significant change, where application icons on the bar are compacted as related items with a nice popup to pick the window you want to bring to the front. So for example if Firefox opens up 3 windows, they all appear as one item on the taskbar.  When you move the mouse pointer to the FireFox taskbar item, a popoup appears with three mini windows representing each of the three FireFox windows. Click on the window you want to bring to the top focus.  This is a nice improvement, however if you want to see something cool, the expose feature in Linux / Mac is the shit. Come on Microsoft, you steal things, why not this?</p>
<p>The next item I noticed was the change of the control panel where items are organized in different order.  It took me a while to locate a number of standard familiar items that I normally would interact with. For example, the services manager was not quick to find, and same with the system properties where you enter environment variables.   But then I realized VMware server 2.0 had stopped working. This led me to become more familiar with the control panel changes (unfortunately). VMWare Server 2.0 suddenly broke while I was opening up a management client window for a VM.  I was no longer able to connect to virtual machines, and so I restarted to see if the &#8216;windows fix all&#8217; would help. Nope, same problem, and in the Windows Event Log, there were errors for attempting to connect to the VMs that I installed.  Next step was to uninstall VMWare, and after doing so, re-install the application.  Once this was complete, I had a different problem. Now the VMware Web Access service failed to start.  This basically runs Tomcat server which allows access to manage the VMWare server API.  After google research and trial and failure, I decided to copy EVERY .bat file from another tomcat installation that I had on my computer to the C:\Program Files (x86)\VMware\VMware Server\tomcat\bin folder.  I opened a command line and ran startup.bat.  Viola! Tomcat started, and I was able to update from the web console, but this is a shitty hack!~</p>
<p>Fortunalty, this was the only software issue I encountered so far. Cubase 5 and the MOTU driver worked very well and just as it did under Windows Vista.  Same with Office 2007, and various other software apps.</p>
<p>The media library is another new concept where under the Windows Media Player, you add folders to the program for Audio, Video and image files.  Once this is done in the media player, it remembers these paths in the windows file explorer as the quick links on the right.  Initially I noticed that the folder I added to the video library did nothing, and that was because it had no media files, just folders that contained media files. Why can&#8217;t the program crawl the folders and subfolders to find media files?  Why do I have to add each folder individually?  I&#8217;m also realizing that it does not follow shortcuts. WTF?</p>
<p>That&#8217;s all I can spew for a day two review, check back later for more details.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.europheus.com/?feed=rss2&amp;p=109</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Returning a method parameter in JMock</title>
		<link>http://www.europheus.com/?p=92</link>
		<comments>http://www.europheus.com/?p=92#comments</comments>
		<pubDate>Tue, 28 Jul 2009 19:24:24 +0000</pubDate>
		<dc:creator>europheus</dc:creator>
				<category><![CDATA[Java]]></category>
		<category><![CDATA[JMock]]></category>
		<category><![CDATA[PayPal]]></category>
		<category><![CDATA[Unit test]]></category>

		<guid isPermaLink="false">http://www.europheus.com/?p=92</guid>
		<description><![CDATA[I recently ran into a problem where I needed to test a Java method that dynamically created objects inside.  These objects needed to be passed to and returned by a mock service class, but I did not know how to inject this class since it was created inside the method being tested.
Here is a [...]]]></description>
			<content:encoded><![CDATA[<p>I recently ran into a problem where I needed to test a Java method that dynamically created objects inside.  These objects needed to be passed to and returned by a mock service class, but I did not know how to inject this class since it was created inside the method being tested.</p>
<p>Here is a code snippet of the method I was trying to test.  As you can see, the Subscription object is created inside the method, then passed and returned from the subscription service.  The service returns the Subscription object because it calls a JPA DAO object to persist the Subscription.</p>
<pre class="brush:java">
public void subscribe(ShoppingCart cart) throws PaymentGatewayException {

... 

// create subscription object
Subscription subscription = new Subscription();
subscription.setProfile(invoice.getProfile());
subscription.setProductSubscription(productSubscription);
subscription.setSubscriberID(responseDetails.getProfileID());
subscription.setStatus(SubscriptionStatus.PENDING_PAYMENT);
subscription.setSource(SubscriptionSource.PAYPAL);
subscription = subscriptionService.set(subscription);

...
</pre>
<p>To test the method, I created a mock object for the subscription service (and other needed services) and called the subscribe method.  The problem I ran into was that I could not find a way to tell the mock context exactly which Subscription object was being passed and returned from subscriptionService.set().  And to make things more difficult, I needed to perform assert checks on the Subscription object.</p>
<p>The following code shows my original test plan.  What happens here is that the subscriptionService.set() receives the Subscribe object that is intended, but it also needs to return the same object. Returning a new instance of Subscription makes the asserts fail.  I could do some kind of clone of the Subscription object, but that wouldn&#8217;t be as fun as extending JMock.</p>
<pre class="brush:java">

final Invoice invoice = new Invoice();

context.checking(new Expectations() {{
	one(shoppingCartService).createInvoiceFromCart(cart);
	will(returnValue(invoice));
	one(subscriptionService).set(with(any(Subscription.class)));
	will(returnValue(new Subscription()));
}});

// call the test method
service.subscribe(cart);

subscription = invoice.getSubscription();
assertEquals(SubscriptionStatus.PENDING_PAYMENT, subscription.getStatus());
assertEquals(SubscriptionSource.PAYPAL, subscription.getSource());
assertNotNull(subscription.getCreationDate());
assertNotNull(subscription.getProductSubscription());
assertNotNull(subscription.getSubscriberID());
</pre>
<p>So after some research on creating custom JMock action classes, I found a simple generic way to have a test return one of the method parameters.  I changed the context expectations to the following:</p>
<pre class="brush:java">
context.checking(new Expectations() {{
	one(shoppingCartService).createInvoiceFromCart(cart);
	will(returnValue(invoice));
	// using custom action class to return the parameter of set
	one(subscriptionService).set(with(any(Subscription.class)));
	will(ReturnParameterAction.returnParameter(0));
}});
</pre>
<p>and now the dynamically created Subscription class is passed in to the subscription service as parameter index 0.  Using the ReturnParameterAction custom class, I can now return the parameter at index 0 for the set method. I included the following ReturnParameterAction class in my codebase in a nice package for later re-use.</p>
<pre class="brush:java">
import org.hamcrest.Description;
import org.jmock.api.Action;
import org.jmock.api.Invocation;

/**
 * The Class ReturnParameterAction returns a parameter of
 * the method invoked.
 */
public class ReturnParameterAction<T> implements Action {

    /** The index of the parameter to return. */
    private int index;

    /**
     * Instantiates a new return parameter action.
     *
     * @param index the index
     */
    public ReturnParameterAction(int index) {
        this.index = index;
    }

    /* (non-Javadoc)
     * @see org.hamcrest.SelfDescribing#describeTo(org.hamcrest.Description)
     */
    public void describeTo(Description description) {
        description.appendText("returns parameter");
    }

    /* (non-Javadoc)
     * @see org.jmock.api.Invokable#invoke(org.jmock.api.Invocation)
     */
    public Object invoke(Invocation invocation) throws Throwable {
        return invocation.getParameter(index);
    }

    /**
     * Static method used to instantiate this action.
     *
     * @param index the index
     *
     * @return the action
     */
    public static <T> Action returnParameter(int index) {
        return new ReturnParameterAction<T>(index);
    }
}</pre>
<p>Enjoy!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.europheus.com/?feed=rss2&amp;p=92</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>CVS bulk conversion to binary</title>
		<link>http://www.europheus.com/?p=70</link>
		<comments>http://www.europheus.com/?p=70#comments</comments>
		<pubDate>Fri, 15 May 2009 02:38:37 +0000</pubDate>
		<dc:creator>europheus</dc:creator>
				<category><![CDATA[Technology]]></category>
		<category><![CDATA[CVS]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Shell script]]></category>

		<guid isPermaLink="false">http://www.europheus.com/?p=70</guid>
		<description><![CDATA[I try not to use CVS anymore since I&#8217;ve become used to Subversion, but recently I needed to restore an old project from CVS.  I made a tar of the CVS backup and uploaded to the server and placed it in the CVSROOT folder.  When I checked out the project I realized the [...]]]></description>
			<content:encoded><![CDATA[<p>I try not to use CVS anymore since I&#8217;ve become used to Subversion, but recently I needed to restore an old project from CVS.  I made a tar of the CVS backup and uploaded to the server and placed it in the CVSROOT folder.  When I checked out the project I realized the binary files were not binary at all, but rather ascii text.  This happened even though I have a cvswrappers file in the CVSROOT folder with a line entry for each of the binary file types.  Maybe something with the cvswrappers file was incorrect, I&#8217;m not sure but I came up with this shell script which fixes the problem. Did I mention that Subversion doesn&#8217;t have these issues?</p>
<p>Here is a shell script that will convert the list of file extensions into binary types. To use it, first check out the project to repair. Next run the script and pass the path to the project as a parameter.</p>
<pre class="brush:c#">
#!/bin/sh
#
# This script modifies existing files in cvs and converts to binary
#
# www.europheus.com
#

extensions=( *.jpg *.gif *.png *.psd *.ico *.icns *.zip *.jar *.exe )

for ext in ${extensions[@]}
do
	find $1 -name $ext -exec cvs admin -kb {} \;
	find $1 -name $ext -exec cvs update -A {} \;
done
</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.europheus.com/?feed=rss2&amp;p=70</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>javax.el.ELException: Function &#8216;:empty&#8217; not found</title>
		<link>http://www.europheus.com/?p=68</link>
		<comments>http://www.europheus.com/?p=68#comments</comments>
		<pubDate>Mon, 18 Aug 2008 16:19:12 +0000</pubDate>
		<dc:creator>europheus</dc:creator>
				<category><![CDATA[Java]]></category>
		<category><![CDATA[Tomcat]]></category>

		<guid isPermaLink="false">http://www.europheus.com/?p=68</guid>
		<description><![CDATA[After installing Continuum 1.1 and Archiva 1.1.1 a number of web pages failed to load throwing exceptions such as javax.el.ELException: Function &#8216;:empty&#8217; not found.  As it turns out, this has to do with Tomcat version 6.0.18 and the EL library that it comes with.
As always, when on Linux, a script can fix things and [...]]]></description>
			<content:encoded><![CDATA[<p>After installing Continuum 1.1 and Archiva 1.1.1 a number of web pages failed to load throwing exceptions such as javax.el.ELException: Function &#8216;:empty&#8217; not found.  As it turns out, this has to do with <a href="http://jira.codehaus.org/browse/MRM-905">Tomcat version 6.0.18 and the EL library that it comes with.</a></p>
<p>As always, when on Linux, a script can fix things and save a lot of time.  So here is my attempt at &#8220;fixing&#8221; java webapps (such as Continuum and Archiva) which encounter this error.  </p>
<pre class="brush:c#">
#!/bin/sh
#
# This script modifies EL expressions to run on Tomcat 6.0.18
#
# www.europheus.com
#

find $1 -name *.jsp -print | xargs sed -i -e "s/empty(/empty (/g"
find $1 -name *.jspf -print | xargs sed -i -e "s/empty(/empty (/g"
find $1 -name *.tag -print | xargs sudo sed -i -e "s/empty(/empty (/g"

find $1 -name *.jsp -print | xargs sed -i -e "s/not(/not (/g"
find $1 -name *.jspf -print | xargs sed -i -e "s/not(/not (/g"
find $1 -name *.tag -print | xargs sudo sed -i -e "s/not(/not (/g"
</pre>
<p>All you need to do is create a script file with this contents then run the script file with the root directory of the java web application.  For example, try the following:</p>
<pre class="brush:c#">
vi fix_el.sh
 (copy and paste the script contents)
 save fix_el.sh
chmod +x fix_el.sh
./fix_el.sh /var/www/vhosts/mydomain.com/webapps/ROOT/
</pre>
<p>Enjoy!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.europheus.com/?feed=rss2&amp;p=68</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Plesk 8.3 AWStats on Linux &#8211; Rebuilding Previous Month Statistics</title>
		<link>http://www.europheus.com/?p=67</link>
		<comments>http://www.europheus.com/?p=67#comments</comments>
		<pubDate>Mon, 07 Jan 2008 00:38:57 +0000</pubDate>
		<dc:creator>europheus</dc:creator>
				<category><![CDATA[Plesk]]></category>
		<category><![CDATA[Technology]]></category>

		<guid isPermaLink="false">http://www.europheus.com/?p=67</guid>
		<description><![CDATA[Well it&#8217;s Jan 2008 and I decided to run the Plesk 8.3 update and try out the new patch for AWStats previous month history.  To my surprise, (well not really) none of the previous month statistics were available, only the current month. So I set out to find a way to generate the history [...]]]></description>
			<content:encoded><![CDATA[<p>Well it&#8217;s Jan 2008 and I decided to run the Plesk 8.3 update and try out the new patch for AWStats previous month history.  To my surprise, (well not really) none of the previous month statistics were available, only the current month. So I set out to find a way to generate the history of statistics for each domain that was using AWStats.  </p>
<p>The following steps are also useful if you change your AWStats configuration for one or more domains and you want to rebuild the statisitcs pages using the new settings.  For example, if you enable the GeoIP plugin, you can rebuild your past statistics pages and now see them with the client country of origin.</p>
<p>Each domain will have a set of AWStats config files in the directory <strong>/usr/local/psa/etc/awstats</strong>  These configuration files have a parameter that tells AWStats where to store it&#8217;s monthly data statistics database.  For example, the http stats will go in <strong>DirData=&#8221;/var/www/vhosts/mydomain.com/statistics/webstat/current</strong>  This folder turns out to be a symlink to the current year / month folder.</p>
<blockquote><p>
drwxr-xr-x  3 root root    2048 Jan  5 14:05 .<br />
dr-xr-x&#8212;  7 root psaserv 1024 Jul 25 15:15 ..<br />
drwxr-xr-x  2 root root    2048 Jan  6 03:49 2008-01<br />
lrwxrwxrwx  1 root root       7 Jan  5 12:45 current -> 2008-01<br />
-rwxr-xr-x  1 root root     457 Jan  6 03:49 index.html<br />
-rwxr-xr-x  1 root root     955 Jan  6 03:49 nav.html
</p></blockquote>
<p>AWStats appears to &#8216;remember&#8217; the last data parsed based on existing data files which are in the &#8216;current&#8217; folder.  Most likely you will only have one .txt file in this folder which represents the current month&#8217;s statistics data.  The following rebuild script will remove any of these data files before rebuilding the full statistics history. After rebuilding this statistics data, you will notice a .txt file for each month inside of the &#8216;current&#8217; folder.  It is not quite clear yet if this is a good place to keep these files, however if needed the DirData parameter can be changed in  each domain&#8217;s awstats config file.</p>
<p>Run this script with the domain name as the parameter<br />
<strong>./awstats_rebuild.sh domain.com</strong></p>
<p>Listing of awstats_rebuild.sh</p>
<pre class="brush:c#">
#!/bin/sh
#
# Script to rebuild a domain's statistic data
#
# www.europheus.com
#

DOMAIN=$1
CONFIGDIR=/usr/local/psa/etc/awstats
AWSTATS=/var/www/cgi-bin/awstats/awstats.pl

# remove any current statistics data
rm -f /var/www/vhosts/${DOMAIN}/statistics/webstat/current/*.txt
rm -f /var/www/vhosts/${DOMAIN}/statistics/webstat-ssl/current/*.txt
rm -f /var/www/vhosts/${DOMAIN}/statistics/ftpstat/current/*.txt
rm -f /var/www/vhosts/${DOMAIN}/statistics/anon_ftpstat/current/*.txt

${AWSTATS} -update -config=${DOMAIN}-http -configdir=${CONFIGDIR} -LogFile=/var/www/vhosts/${DOMAIN}/statistics/logs/access_log.processed
${AWSTATS} -update -config=${DOMAIN}-https -configdir=${CONFIGDIR} -LogFile=/var/www/vhosts/${DOMAIN}/statistics/logs/access_ssl_log.processed
</pre>
<p>Now you should see a text file for each month in the DirData location. At this point, you can now generate the statistics HTML pages on a monthly basis for each domain.  Here is a script that will help out somewhat, but it only pays attention to the HTTP stats, not the FTP stats.  To produce the FTP stats, you should be able to clone the HTTP section, and change the -config parameter to the FTP conf file and update the outputdir.</p>
<p>Run this script with the month, year, and domain name as the parameters<br />
<strong>./awstats_makemonth.sh 12 2007 domain.com</strong></p>
<p>Listing of awstats_makemonth.sh</p>
<pre class="brush:c#">
#!/bin/sh
#
# Script to create a domain's month statistics
#
# www.europheus.com
#

MONTH=$1
YEAR=$2
DOMAIN=$3
CONFIGDIR=/usr/local/psa/etc/awstats
OUTPUTDIR=/var/www/vhosts/${DOMAIN}/statistics/webstat/${YEAR}-${MONTH}
OUTPUTDIRSSL=/var/www/vhosts/${DOMAIN}/statistics/webstat-ssl/${YEAR}-${MONTH}
AWSTATS=/var/www/cgi-bin/awstats/awstats.pl

# create output dir if missing
if [ -d $OUTPUTDIR ] ; then
 echo "Updating existing http statistics "${DOMAIN} ${YEAR}-${MONTH}
else
 echo "Creating http statistics "${DOMAIN} ${YEAR}-${MONTH}
 mkdir ${OUTPUTDIR}
fi

# Create each http stats web page

${AWSTATS} -month=${MONTH} -year=${YEAR} -config=${DOMAIN}-http -staticlinks -configdir=${CONFIGDIR} -output > ${OUTPUTDIR}/awstats.${DOMAIN}-http.html
${AWSTATS} -config=${DOMAIN}-http -staticlinks -configdir=${CONFIGDIR} -output=alldomains > ${OUTPUTDIR}/awstats.${DOMAIN}-http.alldomains.html
${AWSTATS} -config=${DOMAIN}-http -staticlinks -configdir=${CONFIGDIR} -output=allhosts > ${OUTPUTDIR}/awstats.${DOMAIN}-http.allhosts.html
${AWSTATS} -config=${DOMAIN}-http -staticlinks -configdir=${CONFIGDIR} -output=lasthosts > ${OUTPUTDIR}/awstats.${DOMAIN}-http.lasthosts.html
${AWSTATS} -config=${DOMAIN}-http -staticlinks -configdir=${CONFIGDIR} -output=unknownip > ${OUTPUTDIR}/awstats.${DOMAIN}-http.unknownip.html
${AWSTATS} -config=${DOMAIN}-http -staticlinks -configdir=${CONFIGDIR} -output=allrobots > ${OUTPUTDIR}/awstats.${DOMAIN}-http.allrobots.html
${AWSTATS} -config=${DOMAIN}-http -staticlinks -configdir=${CONFIGDIR} -output=lastrobots > ${OUTPUTDIR}/awstats.${DOMAIN}-http.lastrobots.html
${AWSTATS} -config=${DOMAIN}-http -staticlinks -configdir=${CONFIGDIR} -output=session > ${OUTPUTDIR}/awstats.${DOMAIN}-http.session.html
${AWSTATS} -config=${DOMAIN}-http -staticlinks -configdir=${CONFIGDIR} -output=urldetail > ${OUTPUTDIR}/awstats.${DOMAIN}-http.urldetail.html
${AWSTATS} -config=${DOMAIN}-http -staticlinks -configdir=${CONFIGDIR} -output=urlentry > ${OUTPUTDIR}/awstats.${DOMAIN}-http.urlentry.html
${AWSTATS} -config=${DOMAIN}-http -staticlinks -configdir=${CONFIGDIR} -output=urlexit > ${OUTPUTDIR}/awstats.${DOMAIN}-http.urlexit.html
${AWSTATS} -config=${DOMAIN}-http -staticlinks -configdir=${CONFIGDIR} -output=osdetail > ${OUTPUTDIR}/awstats.${DOMAIN}-http.osdetail.html
${AWSTATS} -config=${DOMAIN}-http -staticlinks -configdir=${CONFIGDIR} -output=unknownos > ${OUTPUTDIR}/awstats.${DOMAIN}-http.unknownos.html
${AWSTATS} -config=${DOMAIN}-http -staticlinks -configdir=${CONFIGDIR} -output=browserdetail > ${OUTPUTDIR}/awstats.${DOMAIN}-http.browserdetail.html
${AWSTATS} -config=${DOMAIN}-http -staticlinks -configdir=${CONFIGDIR} -output=unknownbrowser > ${OUTPUTDIR}/awstats.${DOMAIN}-http.unknownbrowser.html
${AWSTATS} -config=${DOMAIN}-http -staticlinks -configdir=${CONFIGDIR} -output=refererse > ${OUTPUTDIR}/awstats.${DOMAIN}-http.refererse.html
${AWSTATS} -config=${DOMAIN}-http -staticlinks -configdir=${CONFIGDIR} -output=refererpages > ${OUTPUTDIR}/awstats.${DOMAIN}-http.refererpages.html
${AWSTATS} -config=${DOMAIN}-http -staticlinks -configdir=${CONFIGDIR} -output=keyphrases > ${OUTPUTDIR}/awstats.${DOMAIN}-http.keyphrases.html
${AWSTATS} -config=${DOMAIN}-http -staticlinks -configdir=${CONFIGDIR} -output=keywords > ${OUTPUTDIR}/awstats.${DOMAIN}-http.keywords.html
${AWSTATS} -config=${DOMAIN}-http -staticlinks -configdir=${CONFIGDIR} -output=errors404 > ${OUTPUTDIR}/awstats.${DOMAIN}-http.errors404.html

# Create http index symlink
ln -s awstats.${DOMAIN}-http.html ${OUTPUTDIR}/index.html

# create output dir if missing
if [ -d $OUTPUTDIRSSL ] ; then
 echo "Updating existing https statistics "${DOMAIN} ${YEAR}-${MONTH}
else
 echo "Creating https statistics "${DOMAIN} ${YEAR}-${MONTH}
 mkdir ${OUTPUTDIRSSL}
fi

# Create each https stats web page

${AWSTATS} -month=${MONTH} -year=${YEAR} -config=${DOMAIN}-http -staticlinks -configdir=${CONFIGDIR} -output > ${OUTPUTDIRSSL}/awstats.${DOMAIN}-http.html
${AWSTATS} -config=${DOMAIN}-https -staticlinks -configdir=${CONFIGDIR} -output=alldomains > ${OUTPUTDIRSSL}/awstats.${DOMAIN}-http.alldomains.html
${AWSTATS} -config=${DOMAIN}-https -staticlinks -configdir=${CONFIGDIR} -output=allhosts > ${OUTPUTDIRSSL}/awstats.${DOMAIN}-http.allhosts.html
${AWSTATS} -config=${DOMAIN}-https -staticlinks -configdir=${CONFIGDIR} -output=lasthosts > ${OUTPUTDIRSSL}/awstats.${DOMAIN}-http.lasthosts.html
${AWSTATS} -config=${DOMAIN}-https -staticlinks -configdir=${CONFIGDIR} -output=unknownip > ${OUTPUTDIRSSL}/awstats.${DOMAIN}-http.unknownip.html
${AWSTATS} -config=${DOMAIN}-https -staticlinks -configdir=${CONFIGDIR} -output=allrobots > ${OUTPUTDIRSSL}/awstats.${DOMAIN}-http.allrobots.html
${AWSTATS} -config=${DOMAIN}-https -staticlinks -configdir=${CONFIGDIR} -output=lastrobots > ${OUTPUTDIRSSL}/awstats.${DOMAIN}-http.lastrobots.html
${AWSTATS} -config=${DOMAIN}-https -staticlinks -configdir=${CONFIGDIR} -output=session > ${OUTPUTDIRSSL}/awstats.${DOMAIN}-http.session.html
${AWSTATS} -config=${DOMAIN}-https -staticlinks -configdir=${CONFIGDIR} -output=urldetail > ${OUTPUTDIRSSL}/awstats.${DOMAIN}-http.urldetail.html
${AWSTATS} -config=${DOMAIN}-https -staticlinks -configdir=${CONFIGDIR} -output=urlentry > ${OUTPUTDIRSSL}/awstats.${DOMAIN}-http.urlentry.html
${AWSTATS} -config=${DOMAIN}-https -staticlinks -configdir=${CONFIGDIR} -output=urlexit > ${OUTPUTDIRSSL}/awstats.${DOMAIN}-http.urlexit.html
${AWSTATS} -config=${DOMAIN}-https -staticlinks -configdir=${CONFIGDIR} -output=osdetail > ${OUTPUTDIRSSL}/awstats.${DOMAIN}-http.osdetail.html
${AWSTATS} -config=${DOMAIN}-https -staticlinks -configdir=${CONFIGDIR} -output=unknownos > ${OUTPUTDIRSSL}/awstats.${DOMAIN}-http.unknownos.html
${AWSTATS} -config=${DOMAIN}-https -staticlinks -configdir=${CONFIGDIR} -output=browserdetail > ${OUTPUTDIRSSL}/awstats.${DOMAIN}-http.browserdetail.html
${AWSTATS} -config=${DOMAIN}-https -staticlinks -configdir=${CONFIGDIR} -output=unknownbrowser > ${OUTPUTDIRSSL}/awstats.${DOMAIN}-http.unknownbrowser.html
${AWSTATS} -config=${DOMAIN}-https -staticlinks -configdir=${CONFIGDIR} -output=refererse > ${OUTPUTDIRSSL}/awstats.${DOMAIN}-http.refererse.html
${AWSTATS} -config=${DOMAIN}-https -staticlinks -configdir=${CONFIGDIR} -output=refererpages > ${OUTPUTDIRSSL}/awstats.${DOMAIN}-http.refererpages.html
${AWSTATS} -config=${DOMAIN}-https -staticlinks -configdir=${CONFIGDIR} -output=keyphrases > ${OUTPUTDIRSSL}/awstats.${DOMAIN}-http.keyphrases.html
${AWSTATS} -config=${DOMAIN}-https -staticlinks -configdir=${CONFIGDIR} -output=keywords > ${OUTPUTDIRSSL}/awstats.${DOMAIN}-http.keywords.html
${AWSTATS} -config=${DOMAIN}-https -staticlinks -configdir=${CONFIGDIR} -output=errors404 > ${OUTPUTDIRSSL}/awstats.${DOMAIN}-http.errors404.html

# Create https index symlink
ln -s awstats.${DOMAIN}-https.html ${OUTPUTDIRSSL}/index.html
</pre>
<p>Finally run the Plesk statistics command to update the current statistics and to update the dropdown list in the HTML statistics page.</p>
<p><strong>/usr/local/psa/admin/sbin/statistics &#8211;calculate-one &#8211;domain-name=mydomain.com</strong></p>
<p>Or to run against all domains at once:</p>
<p><strong>/usr/local/psa/admin/sbin/statistics</strong></p>
<p>Finally to wrap these scripts up and update all of your AWStats enabled domains, try using the following script.  You will need to modify the year loop and month loop to fit your needs.  Also, take care and watch your CPU usage when running this script, AWStats can be a killer.</p>
<p>Run this script without any parameters<br />
<strong>./awstats_updateall.sh</strong></p>
<p>Listing of awstats_updateall.sh</p>
<pre class="brush:c#">
#!/bin/sh
#
# Script to rebuild all awstat domains statistic data
#
# www.europheus.com
#

CONFIGDIR=/usr/local/psa/etc/awstats
VHOSTDIR=/var/www/vhosts

for domain in $( ls -1 $VHOSTDIR)
do
 # check if there is awstats config for this domain
 if [ -f "$CONFIGDIR/awstats.$domain-http.conf" ] ; then
         echo "Rebuilding statistics data for "$domain
         ./awstats_rebuild.sh $domain
         echo "Rebuilding HTML pages for "$domain
         for year in 2007
         do
           for month in 01 02 03 04 05 06 07 08 09 10 11 12
           do
                ./awstats_makemonth.sh $month $year $domain
           done
        done
        #update stats
        /usr/local/psa/admin/sbin/statistics --calculate-one --domain-name=$domain
  fi
done
</pre>
<p>Enjoy, and please post any corrections or enhancements in the comments section.</p>
<p><strong>Script Download Link</strong><br />
<a href="http://www.europheus.com/downloads/awstats.zip">Download .zip file containing scripts in this article</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.europheus.com/?feed=rss2&amp;p=67</wfw:commentRss>
		<slash:comments>17</slash:comments>
		</item>
		<item>
		<title>Plesk Default Settings Script for qmail and procmail</title>
		<link>http://www.europheus.com/?p=66</link>
		<comments>http://www.europheus.com/?p=66#comments</comments>
		<pubDate>Fri, 04 Jan 2008 19:54:05 +0000</pubDate>
		<dc:creator>europheus</dc:creator>
				<category><![CDATA[Plesk]]></category>
		<category><![CDATA[Technology]]></category>

		<guid isPermaLink="false">http://www.europheus.com/?p=66</guid>
		<description><![CDATA[As you may or may not know, Plesk likes to overwrite the .qmail file in each mail folder whenever you make changes.  And as of this writing, Plesk 8.2 does not offer any .qmail template files in order for you to control it&#8217;s behavior.
Here&#8217;s a handy script that will generate a .qmail and a [...]]]></description>
			<content:encoded><![CDATA[<p>As you may or may not know, Plesk likes to overwrite the .qmail file in each mail folder whenever you make changes.  And as of this writing, Plesk 8.2 does not offer any <a href="http://forum.swsoft.com/showthread.php?t=49658&#038;highlight=.qmail">.qmail template files in order for you to control it&#8217;s behavior.</a></p>
<p>Here&#8217;s a handy script that will generate a .qmail and a .procmailrc file for each mailbox on the entire server.  You can place this script anywhere you want and run this as a higher authority such as root.</p>
<p>The .qmail file that is produced will send all mail to procmail in order to move spam mail into junk folders.  Another interesting line in the .qmail file is the following:</p>
<pre class="brush:c#">
#delete spam mail older than 15 days
|find ./Maildir/.Junk/cur -mtime +15 -exec rm {} \;
</pre>
<p>This line will delete all spam mail that is older than 15 days from the .Junk folder.  </p>
<pre class="brush:c#">
#!/bin/sh

IFS="
"

create_qmail()
{
file=$1/.qmail
cat > $file << EOF
|/usr/local/psa/bin/psa-spamc accept
#run procmail to move spam
|preline /usr/bin/procmail -m .procmailrc
#delete spam mail older than 15 days
|find ./Maildir/.Junk/cur -mtime +15 -exec rm {} \;
EOF
chmod 600 $file
chown popuser:popuser $file
echo created $file
}

create_procmail()
{
file=$1/.procmailrc
cat > $file << EOF
# Move spam to the .Junk folder
:0:
* ^X-Spam-Status: Yes.*
./Maildir/.Junk/

# Let other mail go through
:0:
*
./Maildir/
EOF

chmod 600 $file
chown popuser:popuser $file
echo created $file
}

dir=/var/qmail/mailnames

        for i in $( ls -1 $dir); do
                for x in $( ls -1 $dir/$i); do
                        cd $dir/$i/$x
                        create_qmail $dir/$i/$x
                        create_procmail $dir/$i/$x
                done
        done
</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.europheus.com/?feed=rss2&amp;p=66</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Quicken 2008 and PayPal &#8211; A marriage made in hell!</title>
		<link>http://www.europheus.com/?p=65</link>
		<comments>http://www.europheus.com/?p=65#comments</comments>
		<pubDate>Sun, 07 Oct 2007 16:18:03 +0000</pubDate>
		<dc:creator>europheus</dc:creator>
				<category><![CDATA[Technology]]></category>

		<guid isPermaLink="false">http://www.europheus.com/?p=65</guid>
		<description><![CDATA[One of the great new features of Intuit Quicken 2008 is the ability to add and synchronize a PayPal account within Quicken.  This is a long awaited feature and truly a selling point for this new version.  But don&#8217;t be fooled into thinking that it actually works, no no no!  There are [...]]]></description>
			<content:encoded><![CDATA[<p>One of the great new features of Intuit Quicken 2008 is the ability to add and synchronize a PayPal account within Quicken.  This is a long awaited feature and truly a selling point for this new version.  But don&#8217;t be fooled into thinking that it actually works, no no no!  There are two major flaws with this feature and makes this item completely useless.  First if you happen to have more than one PayPal account, forget about trying to synchronize them with PayPal&#8217;s web site.  Quicken cannot handle more than one PayPal account and when you attempt to add the second account, you will receive an error.  Of course Intuit does not point out this shortcoming in any of their documentation and <a href="http://www.quickencommunity.com/webx/Forums/Quicken%20Personal%20Finance%20Software%20Forum%20for%20Windows/Community%20Discussions/298/0?5">they are unable to suggest how to fix the problem.</a></p>
<p>The fact that you cannot add more than one PayPal account becomes a non issue when you discover the next major flaw.  Synchronizing Quicken 2008 with your PayPal account will cause a security violation and PayPal will disable your account.  When Quicken downloads PayPal data into your Quicken account, it connects to PayPal from its Quicken server; not your home computer.  Because of this, PayPal sees an unknown IP address attempting to access your account and they quickly limit your PayPal account access.  </p>
<p>So, not only does the Quicken 2008 PayPal feature <strong>not work</strong>, but it will also <strong>disable your PayPal account!</strong></p>
<p>Yet again, Intuit does not have a solution to this problem, and <a href="http://www.quickencommunity.com/webx/.efecc4f/5?13">the list of angry customers is growing.</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.europheus.com/?feed=rss2&amp;p=65</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Configuring Linux Plesk to drop external MySQL connections</title>
		<link>http://www.europheus.com/?p=64</link>
		<comments>http://www.europheus.com/?p=64#comments</comments>
		<pubDate>Mon, 20 Aug 2007 15:56:49 +0000</pubDate>
		<dc:creator>europheus</dc:creator>
				<category><![CDATA[Plesk]]></category>
		<category><![CDATA[Technology]]></category>

		<guid isPermaLink="false">http://www.europheus.com/?p=64</guid>
		<description><![CDATA[By default, your MySQL server can be wide open to the internet accepting connections from everyone.  With some brute force and bad passwords on your part, there will be a hack party in your database.  The best thing to do is to block all external connections to your MySQL port (3306) and allow [...]]]></description>
			<content:encoded><![CDATA[<p>By default, your MySQL server can be wide open to the internet accepting connections from everyone.  With some brute force and bad passwords on your part, there will be a hack party in your database.  The best thing to do is to block all external connections to your MySQL port (3306) and allow only internal (localhost) connections.  This will allow your web applications to continue to run while rejecting all outsiders. And if needed, you can allow one or more external static IPs to connection, however this is not addressed here.</p>
<p>Using the Plesk firewall module is one way to block external connections, however it is simply a lame web interface to the iptables command.  The best way to block external connections is to run the following commands as root.</p>
<pre class="brush:c#">
# this command makes sure everything on localhost works
 iptables -A INPUT -p all -s localhost -d localhost -j ACCEPT
# block all external connection attempts to MySQL
 iptables -A INPUT -p tcp --destination-port 3306 -j REJECT
 /etc/init.d/iptables save
 /etc/init.d/iptables restart

#check the new definitions
 iptables --list

Chain INPUT (policy ACCEPT)
target     prot opt source               destination
ACCEPT     all  --  localhost.localdomain  localhost.localdomain
REJECT     tcp  --  anywhere             anywhere            tcp dpt:mysql reject-with icmp-port-unreachable 

Chain FORWARD (policy ACCEPT)
target     prot opt source               destination         

Chain OUTPUT (policy ACCEPT)
target     prot opt source               destination
</pre>
<p>You can test your work from another server by running: nmap <serverip></p>
]]></content:encoded>
			<wfw:commentRss>http://www.europheus.com/?feed=rss2&amp;p=64</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Running Java 6 on a Linux VPS</title>
		<link>http://www.europheus.com/?p=63</link>
		<comments>http://www.europheus.com/?p=63#comments</comments>
		<pubDate>Thu, 16 Aug 2007 17:03:20 +0000</pubDate>
		<dc:creator>europheus</dc:creator>
				<category><![CDATA[Java]]></category>
		<category><![CDATA[Technology]]></category>

		<guid isPermaLink="false">http://www.europheus.com/?p=63</guid>
		<description><![CDATA[Could not reserve enough space for object heap
Could not create the Java virtual machine
What? Not enough RAM to run Java?  
Having a VPS (virtual private server) means that you are sharing RAM with other VPS owners on the server.  The actual hardware of the server may have 4GB RAM for example, however your [...]]]></description>
			<content:encoded><![CDATA[<p><strong>Could not reserve enough space for object heap</strong><br />
<strong>Could not create the Java virtual machine</strong></p>
<p>What? Not enough RAM to run Java?  </p>
<p>Having a VPS (virtual private server) means that you are sharing RAM with other VPS owners on the server.  The actual hardware of the server may have 4GB RAM for example, however your VPS is only allocated a small portion of that RAM.  The problem with running Java on a VPS lies within the VPS software and how it reports the available RAM to the software running inside of it.  When you start Java on a VPS such as OpenVZ or Virtuozzo, Java sees the full available hardware RAM, not the small portion allocated to your VPS. It attempts to lock more RAM than it can and runs out of memory.</p>
<p>One solution to the problem is to ask your hosting company to increase the <strong>privvmpages</strong> amount in your VPS, however this request will <strong>most likely be rejected</strong>. Most hosting companies are not in business to give RAM away for free and they will suggest that you upgrade your VPS account.</p>
<p>How much RAM do you need to use Java?  Well this of course depends on what your are running in Java. On a VPS, you are most likely running application servers such as Tomcat or JBoss.  For Tomcat, you should allocate at least 128mb of RAM to the Java process. If you have a 256mb VPS, it just might work, however a 512mb VPS would be better.  For JBoss, most people recommend at least 512mb of RAM.  This of course leads you to need a 1gb RAM VPS.</p>
<p>If you are not sure how much RAM is currently in use, try this little script (that works on Virtuozzo and maybe others?)  This will help you <a href="http://forum.swsoft.com/showthread.php?s=eeb6694cabe2f3b525275bdd58320851&#038;threadid=32471&#038;highlight=privvmpages">find out if your hosting company gave you what you are paying for.</a></p>
<blockquote><p>
cat /proc/user_beancounters<br />
echo &#8220;physpages = RAM in use (amount * 4096 = mb)&#8221;<br />
echo &#8220;vmguarpages = RAM guarantee (allocated to VPS)&#8221;<br />
echo &#8220;privvmpages = burst RAM&#8221;
</p></blockquote>
<p>Now back to the original problem, how to constrain Java to see the VPS RAM and not the entire server&#8217;s hardware.  This is done using an export in the <strong>/etc/profile</strong> file.  </p>
<blockquote><p>
#vi /etc/profile as root<br />
#force java to limit self in this VPS<br />
export _JAVA_OPTIONS=&#8221;-Xms20m -Xmx64m&#8221;
</p></blockquote>
<p>This export will give a default of 64mb to each Java process.  You can override this default by using command line parameters to Java and also in your Tomcat or JBoss startup scripts.</p>
<p>There is another advantage to using the _JAVA_OPTIONS environment variable.  Some files such as <strong>keytool</strong> and <strong>jar</strong> do not take memory settings at the command line.  If you run keytool at the command line, it will most likely give you the Could not reserve enough space for object heap error.  This can be automatically avoided by using the environment variable _JAVA_OPTIONS.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.europheus.com/?feed=rss2&amp;p=63</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Cheney &#8211; A Rouge Nation</title>
		<link>http://www.europheus.com/?p=62</link>
		<comments>http://www.europheus.com/?p=62#comments</comments>
		<pubDate>Fri, 22 Jun 2007 16:40:14 +0000</pubDate>
		<dc:creator>europheus</dc:creator>
				<category><![CDATA[Politics]]></category>
		<category><![CDATA[War]]></category>

		<guid isPermaLink="false">http://www.europheus.com/?p=62</guid>
		<description><![CDATA[The worlds most powerful man, Veep Dick Cheney, has exempted himself from the rules of oversight of the executive branch.  With his legal staff&#8217;s interpretation of the constitution, Cheney has passed the President in terms of power.  

]]></description>
			<content:encoded><![CDATA[<p>The worlds most powerful man, Veep Dick Cheney, has exempted himself from the rules of oversight of the executive branch.  With his legal staff&#8217;s interpretation of the constitution, Cheney has passed the President in terms of power.  </p>
<p><object width="425" height="350"><param name="movie" value="http://www.youtube.com/v/qwFLaI-DdcY"></param><param name="wmode" value="transparent"></param><embed src="http://www.youtube.com/v/qwFLaI-DdcY" type="application/x-shockwave-flash" wmode="transparent" width="325" height="250"></embed></object></p>
]]></content:encoded>
			<wfw:commentRss>http://www.europheus.com/?feed=rss2&amp;p=62</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
