Search

Coding and stuff

Just another WordPress.com site

Month

October 2010

Blogging tips

I had a session this morning with one of my colleagues about blogging. He has years of experience of blogging behind him, and I was after a few tips. We we’re looking at specific posts. There were a few things that I took away from the sessions:

  • Aim for around 400 words. If its going to be much longer, then think about splitting into several smaller posts.
  • Tweet about each post. You should not only tweet about your blog, but should form part of your twitter strategy.
  • Find a rhythm. It doesn’t matter if you post once a week or once a month. Try and reach a regular posting schedule.
  • Get active with commenting on other users blogs. Write intelligent comments, and do not just refer back to your blog.
  • Think about an editorial calendar. Can you create a calendar of interesting subjects, and aim to post several posts on each subject. For example if you know there is a mashery conference coming up, the aim to post on that subject LEADING UP to the event. Once the event has happened, then a summary may be suitable.
  • Try to keep your blog relevant to a defined set of subjects. (you’ll note that this one is off subject)
  • Try to format code (code on this blog is not yet formatted correctly).
  • You need to build up a library of posts.

Downloading data from appengine

The first python/appengine site was a reasonable success. There were around 6,000 votes in the week. The (google) pie charts worked fine to start with, but as the numbers got bigger there was an issue which was resolved by changing from absolute numbers to percentages.

The admin page which allowed data to be downloaded was working fine until the number of votes caused the page to time out. AppEngine does not currently allow you to increase the page timeout, as it was developed for quick pages. The seems reasonable but does make this sort of admin task somewhat more difficult.

There are a few ways round this. Use of a cursor would help. Creating a cron job would be a possible solution. However I decided that I just wanted to download the raw data.

It looks like there are two options for this:

Bulkloader.py –dump….

or

appcfg.py:

C:\Projects\microsites\sites>appcfg.py download_data –application=<site-name> –kind=<object> –url=http://<site-name>.appspot.com/remote_api –filename=dataexport10.csv –config_file=trunk/bulkloader.yaml

There are a couple of things to notice here: You need to create the loader yaml file, and reference it here.  You need to add the routing path to the app.yaml file for the remote_api. More info:

http://code.google.com/appengine/docs/python/tools/uploadingdata.html

I managed to get the appcfg working finally, but it did take it some time to be persuaded that I really did want a csv file, and not a sqllite file.

Finally, there does appear to be an authentication feature. The account that I used to create the site, and which I use to run the appcfg.py update command would not authenticate for the download. I ended up adding an additional user (which is my personal gmail account), and that worked fine. I notice that there are a number of posts out there from people who have struggled with this authentication issue.

Powershell to rename

Another great little feature of powershell is the ability to easily rename a set of files.  For example, to rename all files in a [tmpfiles] folder, and replace all spaces with a dash…

gci -Path c:\tmpfiles | rename-item -newname {$_.name -replace ” “, “-“}

could also be written

gci | %{rni $_ $_.name.Replace(” “, “-“)}

The shortcuts here are:

gci = Get-Childitem

% = ForEach-Object

rni = Rename-item

 

Blog at WordPress.com.

Up ↑