Thursday 12 November 2009

Google Wave First Impression

I have blagged a Google Wave account. Yet to understand it fully.



The first impression, running it in Chrome, is that it looks more like an actual application than a web application. More like a real app than any Web App I've seen so far...

UPDATE: A week later, its like a waste land. Obviously not enough friends on the Platform to make use of it yet.

UPDATE2: People have started asking me for invites. Now some people from work have it, there may be some scope to use it properly.

UPDATE3: Trying to use it at work for some development of ideas exchanges. Will have to see how far we get.

Tuesday 3 November 2009

How to Tar and Gzip a folder via Bash

tar -cvzpf archivefile.tar.gz folder

Keyboard shortcuts in BASH on RHEL / Centos

  • Ctrl + R - Let’s you search through previously used commands
  • Ctrl + K - Clear the line after the cursor
  • Tab - Auto-complete files and folder names

Restarting Apache in CENTOS / RHEL

/sbin/service httpd restart

May work without the /sbin/ depending on the path.

Monday 2 November 2009

Automated Rails Website Clone / Mirror with WGet and FTP script.

As a bit of paid work outside of my day job I wrote a css layout for someone's business website. It was just a product presentation site. Eventually I was being asked to update it all the time so I wrote a rails app to allow stuff to be added by the customer in a 'wiki' style manner: [http://code.google.com/p/rapid-space/].

At first I had this served from my host, but it was a bit slow and occasionally my host had issues. So I've moved the rails app onto another domain, and each week I'm looking to configure a copy process to mirror the rails site, then FTP it up to my customer's own public host.
Clone locally
First step is to clone the site generated from the rails app into a static folder on my host, which is running CENTOS. I did this using wget:
  • [root@host ~]# wget --mirror -w 2 -p --convert-links -P foldertocopy2 http://rooturltomirror/
Annoyingly, the site came out unviewable: the HTML was OK, but the link to the CSS and the images were all broken. This was due to a random number appended to each CSS and Image URL such as ?323124124. These were generated using the Rails Asset Tag helper: http://api.rubyonrails.org/classes/ActionView/Helpers/AssetTagHelper.html
Given the scale of this site, there is no benefit to leaving the asset timestamps feature switched on, so I turned it off as follows ... in /config/environment.rb add:
Finally, I was missing files which were linked to via the CSS file, i.e. via @import url("importthis.css"); or images which are only referenced by the css file. Given these files are not subject to change, I'm going to overwrite them from a static folder when I upload to the public host- I can use the same mechanism to blank out the forms (which won't work on a static host).
FTP to the public domain.
I just tried to use the ftp client built into CENTOS for this, and echo the commands into it via the EOF mechanism in a shell script, per: http://www.cyberciti.biz/faq/linux-unix-autologin-cron-ftp-script/

However, using the standard ftp command you can't recurse through directories. I.e. you can copy all files in a directory, but not descend into sub directories. First I looked at a scripted option such as: http://expect.nist.gov/example/rftp . This approach made me nervous so I upgraded to lftp on my host ... [yum install lftp], and found I could upload the site as follows (with the command 'mirror -R'):
  • [root@host ~]# lftp public-host-ftp-server -u ftpusername, ftppassword -e "mirror -R /local/source /remote/destination"

Sunday 1 November 2009

Django Shopping Kart - Satchmo or Django-Kart?


Python Coding Standards & Resources

Templates Etc.:

Online Payment Systems

Online stores are public Internet web applications. They allow people to find information about a set of products, and order them for delivery. Checkout and payments is a pretty standard use case regardless of the product, and there are all kinds of nasty security issues which could be got wrong. These two points alone justify using a third party, 'hosted' checkout service rather than growing your own, especially for a smallish site.

This blog article makes another point, in relation to Amazon's experience in the early days of web shopping in the nineties:
observation at the time was that many customers repeatedly pay with same payment method and the same ship-to address. By keeping them on file, and establishing clear defaults, Amazon could shorten the purchase process

Kind of obvious, but it relies on a network effect, or economy of scale- in that you are using the same platform across many different product purchases. Again, for a small site this is another reason to use a third party payment platform.

I will take a look at the options as per today, with the following requirements, which are appropriate for the kinds of thing I am trying to do:
  • Limited in scope - i.e. I want a framework which can assist with checkout and payments, not a full stack e-commerce solution.
  • Adoption - i.e. how much can we benefit from the network effect - i.e. how many people already are subscribed to the platform.
  • Simplicity - of API and to signup.
  • Cost.
Google Checkout


Amazon Payments


Paypal


:post in progress: