Install pandoc 1.9 on ubuntu lucid/oneric
Don't install pandoc with apt-get. Follow those instructions to get the latest version,
You need haskell-platform. Don't install haskell with apt-get, too.
Use this guide how to install haskell on ubuntu.
As soon as you are done, you can install pandoc with this:
2
$ cabal install pandoc
Remember to do this NOT with sudo, because you want to have cabal locally available with the current user.
But if it fails with:
2
3
cabal: dependencies conflict: base-3.0.3.2 requires syb ==0.1.0.2 however
syb-0.1.0.2 was excluded because json-0.5 requires syb >=0.3.3
you did accidently installed haskell-platform with apt-get. Do
and follow the link from the beginning of this post!
Assertions and No-Test-Framework in PHP
When I was writing the tests for Craur, I wanted to try a new way (no phpunit this time) to write tests in php.
Since php already has a assert($assertion) method, I imagined that it might be a good start to test without an extra test framework.
A simple
raised a warning. Nice! So I made the following approach:
2
3
my_test_file.php
another_test.php
Whenever I want to launch the tests, I just go into the tests folder and launch php $file_name for all of them. If the exit code is different to 0 -> the test failed.
It's a pitty, bit assert($assertion) does not raise an exception or something like this. Great for other use cases, but in mine this was really an issue. So I wrote this small wrapper script bootstrap_for_test.php. It registers a new AssertionException class for all kind of errors and as ASSERT_CALLBACK! Now even a notice or a warning make the test fail. Great!
Now a simple test looks like this:
2
3
include('./../bootstrap_for_test.php');
assert(2 == 3);
To have the tests run at once, I wrote a little run_test.sh script. It runs every test and returns the script with an exit code different to 0, if one of the tests fails.
All integrated with Travis CI and Craur is tested!
How I built a social game in one week: SwarmFight
It has been an interesting past month, so I want to share how I build a social game for desktop and mobile devices by using Javascript and HTML/CSS.
Since it took me 7 days to make it, I entitled the blog post: "How to create a social game in one week"! I will post all 7 days of my development diary now, so you can see what progress I made at which time and which issues evolved and got fixed :).
The game is an online realtime multiplayer puzzle game called **SwarmFight** and freely available to join at swarmfight.com.
JSB 1.3.0 released - Good bye Inline-Javascript
Today I finally finished JSB 1.3.0. The JsBehavourToolkit is a little toolkit to avoid any inline javascript, allow copy-and-paste of behaviour on html elements.
There is a native version, which works without any framework from (Firefox 3+, Safari 5+, Opera, Chrome and IE9+). The jQuery and Mootools Version works with any browser (even IE6).
New in 1.3.0 is a simple (by design!) event system. It is framework independent and works with simple channel identifier and a json-object as value.
This should be fired by a Js-Behaviour which needs to say something, instead of global variables and direct call. This enables you to use dependency injection if you keep the channel identifier the same.
You can listen to that event, too:
2
3
4
5
6
'HoneyPot::CLICKED', // identifier
function(values) { // callback
alert('The user ' + values.name + ' clicked it already ' + values.times);
}
);
It's even possible to filter for a filter-object when listening:
2
3
4
5
6
7
'HoneyPot::CLICKED', // identifier
{"name": "Bob"}, // filter everything with name = Bob
function(values) { // callback
alert('The user ' + values.name + ' clicked it already ' + values.times);
}
);
You may also use RegExp as channel identifier when calling jsb.on:
2
3
4
5
6
/^HoneyPot.*$, // identifier which starts with HoneyPot*
function(values) { // callback
alert('The user ' + values.name + ' clicked it already ' + values.times);
}
);
Have fun with this release. Sourcecode is of course MIT-Licensed and available on github. Tests for jquery, mootols and native version are shipped in the tests-folder.
Spludo 1.1.0 released
Finally a new spludo 1.1.0 release is available. This is also the start of 1.2-dev development.
The 1.1-branch will stay to support node version 0.4, 1.2 will (soon) support only 0.6 and later.
Changes from 1.0.3 to 1.1.0:
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
* generator for monit+upstart configuration
* code generation for migrations extended with shortcut fields definition
* added support for application/json paylod
* generate *ByIds method for services
* added ApiServiceController to register a service as REST service
* context.request now holds the current req instance
* added inflection.js
* added node_modules for own vendor libraries
* replaced own testing system with vows (if you want to run the tests, please install vows!)
* spludo_directory variable is now set always when calling spludo-gen
* added bootstrap_manager.whenLoaded(callback) to get notified as
soon as the app is ready.
* replaced self with that
* fixed core_dev_change_build_version on MACOSX
* added jshint instead of jslint
* added support for node_modules folder in project directory
* added Criteria for DatabaseDrivers
* added code generation for Migrations
* added SqliteDatabaseDriver
* added a Database Migration system
* added MysqlDatabaseDriver
* added code generation for Services
* added DatabaseManager and ServiceManager
* added Logging#addTracing (makes the this.trace(function_name) obsolete)
* Codegeneration loads the spludo application now (this enables the developer
to generate code against the base of the application)
* Codegeneration #validateParameter receives the validated parameters now
* TestCases are now able to call .debug+.log and so on, because the execute
method is applied to the TestSuite.
I have been using this development version for plenty small projects and the code generation, migrations and database driver stuff should really help
you get your app developed way faster!
Loads of documentation and examples can be found in the spludo user guide.
Have fun!
Remote logging with rsyslog, php and agavi
When I tried to get rsyslog running with php I didn't face much problems. Anyways I want to share some things I noticed while getting it to work.
First of all ubuntu uses rsyslog already. Just a simple
and all syslog messages went directly into the database "syslog". Configure /etc/rsyslog.d/mysql.conf to insert this information into a remote machine.
Now let's get to php. You have the option to set:
This however does log all messages with
If you want to replace "php" with a custom message, you have to call
before any error happens. Because LOG_ODELAY is given, it won't connect to syslog unless any error happens, so one should be save to put this call at the top of your dispatcher file.
The final log message will look like that (254 is the process id):
Finally I wanted to log all messages created by agavi's logging system. Since I didn't found an existing AgaviSyslogLoggerAppender, I wrote one and put it up on a github-gist.
Have fun logging!