Wednesday, December 16, 2009

eclipse + maven + EC2 = nirvana

Ok, it has been a while between posts, but that is not to say that the monkeys haven't been busy. This next little experiment went very well, almost flawless. The idea was 'rapid development' by where a J2EE website could be built & deployed. Eclipse, Maven and Amazon EC2 to the rescue. I'll quickly walk through the steps, although I might not be able to add a lot of detail:
  • Prerequisites: Eclipse + AWS toolkit + M2Eclipse plugin are installed & configured.
  • Create a new Maven project in Eclipse using: maven-archetype-webapp


    You should now have a webapp project with a single "Hello World" jsp file and the necessary webapp manifest files.

  • Start up an Amazon EC2 instance using a Tomcat AMI. I used ami-2eb05347 (aws-console-quickstart-amis/tomcat/1.2/tomcatquickstart.manifest.xml). Make sure that your Security Group includes the Tomcat ports (I've got mine configured with 80, 8080, 443, 22, and 3306)


  • Once started, copy your "Public DNS Name" from EC2 (mine was ec2-72-44-33-110.compute-1.amazonaws.com) and deploy the application using Eclipse Run (the settings I use are below, most are default):


  • Navigate in your browser to your Public DNS Name + Eclipse project/webapp name (ie: http://ec2-72-44-33-110.compute-1.amazonaws.com/EC2Webapp/) and you should have a nice "Hello World!".... ta da!
  • Remember to shut down your EC2 instances when you are done playing (or it might get expensive...)


Thursday, December 10, 2009

Joomla! + free.fr

Among the recent little projects was to install and configure a Joomla CMS portal using a local free hosting provider ("Free.fr"), which also provides php and mysql for their hosted sites.

The idea was to provide a portal for a local ski club with a couple of add-ons that would allow people to not only get the latest news on the slopes, but to also reserve places for ski trips (notably using Seminar for Joomla). All and all, the portal seems to be a pretty good success to its users with over 50 community accounts and a half-dozen events being signed up. For myself, it has been a good learning tool to get into Joomla.

A-page-admiring-Joomla-goes-here: essentially it has a lot of features and is very easy to use (I've trained a non-geek admin to use it) + quite professional for an open source tool... personally I consider it a good choice that I would make again without hesitation.

Signing up for a new Free account takes about a week to process and the details are sent via the post office (ie: you need to provide a real physical address) and activating a new website and database account takes about 2 days to process (although they claim something like 24 hours), so expect at least a week just to get to the point where you can actually start the installation. A little painful and some slightly better cheap-but-not-free alternatives are out there, but for free (and Free), it's ok.

As for the installation itself, it is pretty much straightforward. The two "WARNING"s at the bottom are the only additional steps unique to this particular configuration, but they should not be too difficult to get around.
  • create a new.account and new.account.password on free.fr
    http://subscribe.free.fr/accesgratuit/
    you should get the codes for your new account through the post in a week...
  • create a new e-mail account
    (example: "new.account")
  • activate the website w/mysql
    http://aide.creer.site.free.fr/
    the site says that it takes about 24-48 hours... expect at least 48....
  • download Joomla 1.5
  • unzip it & ftp contents to new account
    ftp: ftpperso.free.fr
    user: new.account
    pass: new.account.password
  • via ftp, create a new directory "sessions" (ie: /sessions)
    WARNING: skipping creation of "/sessions" will result in installation failing w/php errors on first page.
  • create a text file called "htaccess.txt" which contains "php 1" (no quotes)
  • via ftp, send "htaccess.txt" to the root and change the name to ".htaccess" on server
    WARNING: skipping creation of ".htaccess" will result in installation failing on Joomla installation step #4 (blank screen).
  • begin Joomla installation:
    http://new.account.free.fr/installation/
  • Start ...
  • on step 4:
    database type: mysql
    host name: sql.free.fr
    user name: new.account
    pass: new.account.password
    database: new_account
  • ... continue to end
  • via ftp, remove/rename directory "/installation" on server
  • in Joomla, go to http://new.account.free.fr/administrator/
  • Set in Global Configuration, under "Server", "Mail Settings":
    Mailer: PHP Mail Function
    Mail from: new.account@free.fr
    From name: your name here
    Sendmail Path: /usr/sbin/sendmail
    SMTP Authentication: No
    ...
    SMTP Host: smtp.free.fr
    (note, I'm not sure if it is all correct, but on mine it works...)
  • Navigate to your new joomla site: http://new.account.free.fr/
    Done ;-)
You should now have a Joomla site that you can customize and play with. For newbies such as myself, there are some good documentation here: http://docs.joomla.org/Beginners as well as here: http://docs.joomla.org/Understanding_sections%2C_categories_and_articles. Since "menus" are the key to display new pages/content, this is worthwhile reading as well: http://docs.joomla.org/Screen.menus.edit.15.

References:


Sunday, August 23, 2009

Amazon Web Services

I'm not sure what it was that brought me to their website, but recently I stumbled across Amazon Web Services. That is not "Web Service" as in WSDL and SOAP transactions (although this could be a use of it). Instead, Amazon has essentially opened it's own hosting and networking infrastructure used by Amazon.com to the public (for a fee of course). That's a lot of infrastructure. The biggest advantages of AWS is the customizable hosting and the scalability: once you build your application/appliance/storage, it is a piece of cake to run it across a dozen different servers.

Amazon also provided a ton of documentation and tools (including a browser-based management console and my favorites in Eclipse & Firefox), which makes it easy to get it up and running.

First let's talk about signing up (and the fee). This is a paid service, so besides the routine information Amazon will need a credit card. Look carefully at the terms of payment: EC2, for instance, is on a per-hour basis. While the charge is only a few cents per hour, if you forget to turn it off (ie: you were testing scalability across 100 virtual machines), the meter will still be running and can end up in a nasty bill at the end of the month. There is also an incoming & outgoing data charge. Same thing, if you post your popular family photos for everyone to see, expect to see it on your bill. So far I've only been playing with it so I haven't had more than a few cents, but I've tried to be careful.

So let's now get into the services:
  • Elastic Compute Cloud (EC2)
    Essentially a virtual machine host in either Linux or Windows flavors where you can either upload your own images or use some of Amazon's existing stacks (ex: Linux + Tomcat).
    It is ridiculously easy to use, especially when using one of Amazon's Eclipse or Firefox plug-ins: you pick an image, set some firewall rules (ex: open port 80 and/or 8080 for Tomcat), then start it up. You can then copy & paste the dynamic URL into your browser and get a Tomcat startup screen as if you had installed it on your own machine. But I repeat, turn it off when you are not using it.
  • SimpleDB
    A basic scalable database. This one comes again with its own Eclipse plug-in.
  • Simple Storage Service (S3)
    A virtual storage platform. Has a decent Firefox plugin that makes it easy to add and manage uploaded data.
  • CloudFront
    Works with S3 to optimize content distribution (seems kind of like Akami).
  • Simple Queue Service (SQS)
    A Queue Service that allows you to smoothly coordinate messages across the other services. Per Amazon: "Components of applications using Amazon SQS can run independently, and do not need to be on the same network, developed with the same technologies, or running at the same time."
    (Haven't played with this one yet...)
  • Elastic MapReduce
    An auto-scaling, distributed computing platform based on Apache's Hadoop (basically, all of the above stuff, but pre-configured to run as a one-button cluster).
Although the performance has been scrutinized & criticized (see: Slashdot), it is still an alternative for those of us that do not have a mega-datacenter at our fingertips. Note that there are others (ex: Google App Engine).

For the weekend developer, I would consider it an interesting tool to experiment with scalable applications and virtual machines. For those of us tired of spending time installing servers and such on our local machines to prototype things, this can also provide an alternative (ex: pre-installed images with a full LAMP stack). I think the next thing to try is Eclipse + Maven + Andromda + AWS to build a lightning-fast prototyping stack.

One last time though, another friendly reminder, it is a paid service, don't forget to shut it off when you're done ;-) .

Saturday, August 22, 2009

Google Analytics, bis.

I thought I would give a quick update on how things are going with Google Analytics & Webmaster Tools. I've been checking it semi-regularly and have had some pleasant surprises. Please remember that this is a side project... so don't laugh at the actual numbers ;-)

First thing is as you can see, I seem to have a small, but steady flow of readers. The peaks are during the work week and the valleys are on the weekends. What I find interesting is that the effort has so far been passive: I've posted content & let Google find the readers. Starts to make me wonder what would happen if I added more content.


This is the bottom half of the page. It seems that the appfuse-eclipse-maven page is the most popular. And in the Map Overlay, apparently most people come from the US.
Which gets to my favorite page... as you can see, there have been people from India, Argentina, Serbia, Bangladesh... kind of cool to think that my crap insight is being read so far away. And here are the stats.

Now here is the depressing part... you know those AdSense links on the side? We'll, to put it bluntly, I'll be waiting a while for my millions to start rolling in.


And this is from Google Webmaster Tools. This is actually kind of handy to see what links point to your content; Tasktop has linked to a couple of my pages. Interesting enough though, despite being the only externally referenced content, it is not the most visited (thanks anyway though ;-) ).Conclusion: don't quit my day job, but an occasional article or two is worth the effort (ie: someone besides myself is reading them... ).

Breaking radio silence...

Well, time to get back into this. I must apologize to those of you who read this for the recent neglect: summer vacation + a new job has a tendancy to reprioritize things. Nevertheless, I haven't been idle. Hopefully the upcoming articles will compensate for my absence ;-)

Thursday, May 14, 2009

Windows context menu tools

If you haven't guessed it yet, like any good programmer/hacker/software engineer, I'm proactively lazy. I'll spend all day trying to find a tool to ultimately save me 5 minutes here and there.

One of them consists of fiddling with the Windows Explorer context menu -- you right-click on a file somewhere and it gives you all kinds of options ("open", "Send to...", etc.). This always carries a little risk.. when you mess with the Windows registry there is always the chance that you break something important. Backup beforehand, use at your own risk, don't drive with a hot cup of coffee on your dashboard... you've been warned.

Anyway, for those who are brave enough to try, here's a few that have racked up enough of saved 5 minutes to make them worth sharing...
  • setRecursiveReadWrite.reg
    For those that deal often with source code repositories and such that like to set all of a directories files to write-only... this allows recursively setting the selected directory/files to read-write after which you can corrrupt edit them to your hearts content.

    Windows Registry Editor Version 5.00

    [HKEY_CLASSES_ROOT\*\shell\readwrite]
    @="Set to read/write"

    [HKEY_CLASSES_ROOT\*\shell\readwrite\command]
    @="cmd.exe /C attrib -r \"%1\""

    [HKEY_CLASSES_ROOT\Directory\shell\readwrite]
    @="Recursively set to read/write"

    [HKEY_CLASSES_ROOT\Directory\shell\readwrite\command]
    @="cmd.exe /c attrib -r /s "

  • copyPath.reg
    (requires clip.exe in: Windows NT 4.0 Resource Kit Support Tools - see also KB 172596)
    Ever need to copy the full file or directory name so that you can paste it in another program (ie: quick open or avoid drilling down in a small "Open File" pop-up)? This program does that. Note that clip.exe has to be in the execution path (usually the case with the default installation).

    Windows Registry Editor Version 5.00

    [HKEY_CLASSES_ROOT\*\shell\copypath]
    @="Copy path to clipboard"

    [HKEY_CLASSES_ROOT\*\shell\copypath\command]
    @="cmd.exe /C echo %1 | clip"

    [HKEY_CLASSES_ROOT\Directory\shell\copypath]
    @="Copy path to clipboard"

    [HKEY_CLASSES_ROOT\Directory\shell\copypath\command]
    @="cmd.exe /C echo %1 | clip"

  • tailThis.reg
    (requires tail.exe in: Windows Server 2003 Resource Kit Tools)
    The daily life of a programmer consists of compiling and running programs. Usually while the mysterous command line window is silent, a log or trace file is being filled up with all kinds of interesting information. This tool allows selecting the log file and running the "tail" command against it. The screen will refresh regularly with the new entries when the file is written to.

    Windows Registry Editor Version 5.00

    [HKEY_CLASSES_ROOT\*\shell\tailthis]
    @="Tail this"

    [HKEY_CLASSES_ROOT\*\shell\tailthis\command]
    @="\"C:\\Program Files\\Windows Resource Kits\\Tools\\tail.exe\" -f \"%1\""


  • tidyXML.reg
    (requires: Tidy - tidy.exe)
    For those of us who deal with XML frequently, nothing is more annoying than having to read it on one big long line (spaces and carriage returns are often removed to save bandwidth). This little tool lets you "tidy" or pretty-print it so that you can open it with your favorite editor in a readable format.

    Windows Registry Editor Version 5.00

    [HKEY_CLASSES_ROOT\xmlfile\shell\Tidy_XML]
    @="Tidy XML"

    [HKEY_CLASSES_ROOT\xmlfile\shell\Tidy_XML\command]
    @="
    C:\\Program Files\\Tidy\\tidy.exe -xml --indent-spaces 4 --indent-cdata yes --wrap-sections no --output-xml yes -wrap 0 -quiet -i -m \"%1\""
  • openTChere.reg
    (requires: TotalCommander -TOTALCMD.exe)
    For those that know and use TotalCommander to browse files and directories, it is hard to go back to Explorer, but it does happen. This little tool adds a menu item to open a directory in TC instead of Explorer. It works best if TC is configured to open up in only one instance (ie: the new folder opens up in a new tab...). Nice if you find yourself browsing with Explorer for one reason or another but want to pick it back up in TC...

    Windows Registry Editor Version 5.00

    [HKEY_CLASSES_ROOT\Directory\shell\tc]
    @="Explore with TotalCommander"

    [HKEY_CLASSES_ROOT\Directory\shell\tc\command]
    @="
    C:\\Program Files\\TotalCommander\\TOTALCMD.EXE /T \"%1\""

Thursday, May 7, 2009

New maven-generated "site" documentation

I recently worked on regenerating and updating the Maven "site" documentation. It still isn't perfect, but a little bit better than before.

Problems that I am having are:
  • For nested maven components, either I use the index.apt for each project, or I don't use anything and it defaults to the POM description. If index.apt is missing, sub-components won't generate the index.html page (missing links). It would have been better that it fell back to the POM description if there was no APT alternative.
  • The site-deploy still creates a flat hierarchy, but the links expect the modules to be nested (ie: I have to manually move the sub-component directories into their proper hierarchy). Site stage is flat as well, but at least the links work.
  • Something is up with the SourceForge web host. The new index files seem to be found as a default (ex: http://www.metasimian.net/), but it seems to still be serving the old index files if they are explicitly targeted (http://www.metasimian.net/index.html). This causes problems with links between the the sub-components (they target "index.html" instead of "/"). For info, this seemed to be a cache problem... gone today.
Hopefully fixes/workarounds/explanations to follow soon...