kirit.com

Created 26th April, 2005 13:12 (UTC), last edited 5th July, 2007 06:59 (UTC)

Writing about C++, Programming, FOST.3™, Mahlee™, the web, Thailand and anything else that catches my attention—with some photos thrown in

Fost 4 release 4.12.03.44089 now out

Posted 25th March, 2012 04:37 (UTC), last edited 25th March, 2012 04:45 (UTC)

The latest version of Fost was tagged in our repositories a few days ago.

The latest release was tagged yesterday.

The next version is due out in June 2012. The most interesting changes are:

  • Build support for the Enterprise DB distribution of Postgres on the Mac.
  • Initial support for MSVC 10.
  • Started to add in support for clang.
  • Switched to use crypto++ for the cryptographic functions. Boost.ASIO still uses OpenSSL, so both libraries are now required.
Linux & Mac
svn co http://svn.felspar.com/public/fost-hello/tags/4.12.03.44089 fost-hello
cd fost-hello
Boost/build
hello/compile
dist/bin/hello-world-d

On the Mac you will need to set DYLD_LIBRARY_PATH before running hello-world-d

export DYLD_LIBRARY_PATH=dist/lib
dist/bin/hello-world-d
Windows
svn co http://svn.felspar.com/public/fost-hello/tags/4.12.03.44089 fost-hello
cd fost-hello
Boost\build
hello\compile
dist\bin\hello-world-gd

Download locations

Everything is available through our Subversion repository. Below are the locations for the tagged releases for Fost 4.12.03.44089 components.

Detailed change log

fost-base

  • Added coercions from fostlib::utf8_string.to std::vector<unsigned char>.
  • Fixed up the JSON and string representations of the timestamps so they are more ISO like and have an explicit UTC time zone.
  • Added coercions between fostlib::json and fostlib::jcursor.
  • Made some minor changes suggested by clang, including some dead code elimination.
  • MSVC 10 supports stdint.h so changed the configuration to use that.
  • Fixed up the fost-exe build target type so the fost-cli library is properly installed.
  • Explicitly initialise some variables that were set before being returned in order to silence a compiler warning.
  • The parser lock can now be acquired before the parse is called so that it can be used to cover the building of the parser.
  • Allow the logging functions to take up to four arguments.
  • Allow string concatenation expressions with a narrow character literal to the left.
  • Altered the internal cryptographic wrappers to use crypto++ instead of OpenSSL.
  • Changed the unit testing so that it doesn't build a library any more.
  • Refactored some build parameters to remove repetition.
  • Changed the unit test runner so that it displays the output of the test run as we need to see this in order to verify that the tests do actually run.
  • Clear out the jobs that have been taken from the queue when a major problem occurs. This should help to stop threads waiting on futures from waiting forever.
  • Added fostlib::bytes for calculating the size of a memory block in bytes.
  • Updated the readme files for later versions of Ubuntu.

fost-internet

  • Disabled a test that is unreliable on Windows due to its limited network buffer.
  • Fixed up some build errors for the new null_ptr.
  • Changed one of the networking tests to send less data on Windows as the test would hardly ever pass. It is still a bit unreliable though :(
  • Allow a few more characters in the file specification for URLs.
  • Improved some of the error handling in the HTTP server.
  • Can now convert a URL file specification directly to a string.
  • Added coercion from MIME to UTF8 strings.
  • We can now coerce from a URL file specification to a Boost filesystem wpath.
  • The host constructors now normalise to lower case any host name they are given.
  • We can now pass in a handler function to the HTTP server request for use when testing server responses.

fost-orm

  • The JSON database `remove` command now makes sure that the object being removed is the same when it runs against the actual database. This makes the remove much safer as the transaction will fail if another transaction has altered the data.

fost-postgres

  • Added support for Enterprisedb's build of Postgres 9.1 on the Mac.
  • Updated the driver to use the refactored libpqxx interface.

fost-py

  • Fixed up some build errors for the new null_ptr.
  • Made a couple of default arguments in the user agent (Python) safer.

Categories:

New web server

Posted 19th February, 2012 07:04 (UTC), last edited 19th February, 2012 07:24 (UTC)

Since that unfortunate incident last summer when the contract for the web server I'd been using was cancelled I've been running this site on an EC2 micro instance. This is great and all, but micro instances aren't all that fast and they have very limited CPU (at least, for anything other than in short bursts). Windows, SQL Express, and everything else that this has been using have a lot of overhead and the micro instance has been somewhat slow.

Actually, that's an understatement. It's been pretty much unusably slow :(

Today though I've finally managed to get the new web server up and running with (at least most of) the old content. Some things don't work — user logins, the forums/threads, the postcode pages and a couple of other minor things. The new server software also doesn't have any content authoring capability, but I can solve that by simply running a version of the old software in a virtual machine.

There are some parts that I've not brought across yet, those will give “Service Unavailable” for now. I'm sure that I've forgotten redirects and other such things. I'll get all of this stuff fixed up over the coming months (honest).

This new version is totally written in C++ using Fost 4. Most of the actual content is rendered by the old software and written as files on disk. The site chrome is wrapped around this and knowledge about the site structure is in a JSON database.

I'll write up more details about how all of this actually works, but for now I'm just going to be happy if this new software is a lot more stable and a lot faster than the old…


Categories:

Git flow cheatsheet

Posted 17th February, 2012 01:09 (UTC), last edited 18th February, 2012 06:04 (UTC)

At Proteus we're doing some experimenting with git for a few new projects. We're making use of git flow, despite an expectation of having problems with it under Windows.

For the examples I'm going to use our profab project on github, but all of our projects work the same way.

Install git flow

Make sure that you have the very latest git flow installed. This will make sure that you are properly tracking the develop branch after you set up a repository.

$ cd /tmp
$ wget —no-check-certificate -q -O - https://github.com/nvie/gitflow/raw/develop/contrib/gitflow-installer.sh | sudo bash
$ git flow version
0.4.2-pre

I do this in /tmp as the sudo execution of the install script leaves a check out of git flow in the current folder with root file permissions.

You really want to install bash completion as well. You also really want to use git cola for managing check ins (apt-get git-cola on Ubuntu).

Check out a git repository

First of all, we need to fetch the data:

$ git clone git@github.com:Proteus-tech/profab.git
Cloning into profab…
remote: Counting objects: 1276, done.
remote: Compressing objects: 100% (478/478), done.
remote: Total 1276 (delta 835), reused 1215 (delta 774)
Receiving objects: 100% (1276/1276), 139.76 KiB | 71 KiB/s, done.
Resolving deltas: 100% (835/835), done.

Then we need to initialize git flow. This has to be done every time a project is cloned.

$ cd profab
$ git flow init -d
Using default branch names.

Which branch should be used for bringing forth production releases?
   - master
Branch name for production releases: [master] 
Branch name for "next release" development: [develop] 

How to name your supporting branch prefixes?
Feature branches? [feature/] 
Release branches? [release/] 
Hotfix branches? [hotfix/] 
Support branches? [support/] 
Version tag prefix? []

This will leave you on the develop branch ready to start working.

$ git branch
* develop
  master

Work on a feature

We track individual tasks by story card, so we'll just follow that convention for now.

$ git flow feature start card-123

This will create the correct branch for you and leave you ready to work on the card.

If during the development of this you want to get changes from the develop branch then you'll need to switch back to it, pull changes and then merge them in to your feature branch.

$ git checkout develop
Switched to branch 'develop'
$ git pull —rebase
remote: Counting objects: 5, done.
remote: Compressing objects: 100% (1/1), done.
remote: Total 3 (delta 2), reused 3 (delta 2)
Unpacking objects: 100% (3/3), done.
From github.com:Proteus-tech/profab
9d414f0..4567ef5  develop    -> origin/develop
First, rewinding head to replay your work on top of it…
Fast-forwarded develop to 4567ef5040386ef545d8bfe57bb74b3f6cdb8ad3.
$ git checkout feature/card-123
Switched to branch 'feature/card-123'
$ git rebase develop
First, rewinding head to replay your work on top of it…
Fast-forwarded feature/card-123 to develop.

The use of rebase is important here as it makes sure that any changes you have made are put after the changes you get from the origin. This makes merge conflicts far easier to deal with and also makes the history easier to understand as commits don't get interleaved.

In any case, when you've finished a feature you need to get your changes back in to develop.

$ git flow feature finish card-123
Switched to branch 'develop'
Already up-to-date.
Deleted branch feature/card-123 (was 4567ef5).

Summary of actions:
- The feature branch 'feature/card-123' was merged into 'develop'
- Feature branch 'feature/card-123' has been removed
- You are now on branch 'develop'
$ git pull —rebase
Current branch develop is up to date.
$ git push
Counting objects: 5, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (3/3), done.
Writing objects: 100% (3/3), 429 bytes, done.
Total 3 (delta 2), reused 0 (delta 0)
To git@github.com:Proteus-tech/profab.git
9d414f0..4567ef5  develop -> develop

Setting up a new repository for a client project

This is pretty simple.

$ mkdir -p client/project.git
$ cd !$
cd client/project.git
$ git init —bare
Initialized empty Git repository in /home/git/client/project.git/

Categories:

Fost 4 release 4.11.12.43952 now out

Posted 28th December, 2011 08:59 (UTC), last edited 29th December, 2011 03:26 (UTC)

The latest version of Fost was tagged in our repositories a few days ago.

The latest release was tagged a few days ago, but no changes have been made this quarter.

The next version is due out in March 2012.

Linux & Mac
svn co http://svn.felspar.com/public/fost-hello/tags/4.11.12.43952 fost-hello
cd fost-hello
Boost/build
hello/compile
dist/bin/hello-world-d

On the Mac you will need to set DYLD_LIBRARY_PATH before running hello-world-d

export DYLD_LIBRARY_PATH=dist/lib
dist/bin/hello-world-d
Windows
svn co http://svn.felspar.com/public/fost-hello/tags/4.11.12.43952 fost-hello
cd fost-hello
Boost\build
hello\compile
dist\bin\hello-world-gd

Download locations

Everything is available through our Subversion repository. Below are the locations for the tagged releases for Fost 4.11.12.43952 components.


Categories:

Running Postgres for development on Oneiric

Posted 18th October, 2011 03:27 (UTC), last edited 18th October, 2011 03:31 (UTC)

These are some notes for running Oneiric on a development machine.

Upgrading from Natty

Make sure all old Postgres installations are purged:

sudo apt-get purge postgresql postgresql-8.4

Getting Postgres 9.1 up and running

Install postgres:

sudo apt-get install postgresql

Only on a development machine

Turning off the fsync option will make Postgres run faster as it won't insist that all database changes are written to disk. Clearly do not do this if you care about the data you are writing to Postgres. This shouldn't be a problem on any development machine as they're all test databases.

Edit the server configuration:

sudo nano /etc/postgres/9.1/main/postgresql.conf

Change:

fsync = off

Then:

sudo service postgresql restart

Configure your ident authentication

Making proper use of ident authentication means that you can access Postgres without needing to use a password. Many of our Postgres set up scripts for projects assume that you have ident configured as a Postgres superuser.

Run psql as the postgres user to add in your configuration:

sudo -u postgres psql

And now we need to configure ident authentication — my user name is kirit, change to whatever you log in to Ubuntu as:

create role kirit login superuser;
create database kirit with owner=kirit;

Exit psql and try again with your own account:

psql

You should now be able to see the postgres prompt again.

I have a Django user that I use across projects:

create role "Django" login superuser password 'django';

From here you can set up the databases or add other roles that you need normally.


Categories:

Felspar