inicio mail me! sindicaci;ón

Archive for oldbrew

cre8Buzz Criticisms

Last month, fellow bogger Ian sent me an invite for a social networking site called cre8Buzz.

Signup

Upon following the provided link, i was presented with a rather hideous looking signup form.

While looks aren’t everything, i really thought it could do with a bit of TLC. This was demonstrated very nicely when i opened up the drop-down list for “Community”.

Check out the long list

Yikes!

So to sum up my pet peeves for this form:

  • The title for the top menu doesn’t make sense to me
  • The community list is too long, and isn’t sorted (a combo box with autocomplete might have been a better choice).
  • There isn’t enough white space, especially around the “Email notifications” fieldset.
  • There is a Cancel link and a Save button next to each other – very inconsistent!
  • I am left wondering does the “Destroy This Account” button and the “Cancel” link perform the same operation.
  • Why would i want to “Destroy This Account” when i haven’t logically created it yet?
  • In general, there is no flow

In addition there is the glaring omission of any notice indicating that i am binding myself to their Terms of Use.

Terms of use

The Terms of use are themselves rather interesting. There’s mention of “subscription fees”, and only “personal use” (i.e. non-commercial) is allowed.

In addition “automated use”, “transferring your profile”, “displaying an advertisement”, “telephone numbers”, “street addresses”, “last names”, “URLs or email addresses” are all prohibited.

Lets not forget the usual indemnity section.

And of course apparently i automatically accepted the agreement when i “used” the site, and further affirmed it by “becoming a Builder” (i.e. making a user account, although technically i didn’t make one).

Granted, most of these sites have such agreements nowadays, but it would have been nice if i could have explicitly agreed to it when accepting the invite.

So remember, always read the terms of use.

The front page

After filling in the form and subsequently signing in, i decided to look at the front page. And here it is in all of its glory:

Main page

So pretty much like any other Social Networking Community whatever-you-want-to-call-it site. Although like the form before, i have a few pet peeves about it:

  • Clicking on any of the items on top of the search box merely highlights them, making them feel very disconnected from the search box.
  • In order to edit your profile you need to click on “My Stuff” and then one of the links under “Manage my Profile”. Not very obvious.
  • The “Help” is rather odd. It lists a set of categories which you must click in order to reveal a set of questions which have an expander box besides them. In order to reveal the answer you need to click on the question, not the expander box, the question! Yikes!
  • Like the invite form suggests, you can only belong to one community.

Features

From what i can tell by looking at the site, cre8Buzz supports:

  • Blogs
  • Audio, Video, Photos
  • Forums (per community)
  • Group questions
  • Comments on almost everything
  • Friends
  • Personal messaging
  • Favourites
  • Themeing your profile page (hmm, sounds familiar)
  • A widget you can put on your website (see below)

Widget

Conclusion

Rants aside, i wish the best of luck to the cre8Buzz team. I think it will be interesting to see how well their site fares in the ever competitive Social Networking market.

As for whether or not i am going to use it, I’ll have to think about that one. Still, i have 5 invites left so if anyone reading wants to try out cre8Buzz, give me a buzz by posting a comment below.

RailsCollab on Rails 2.0

Soon after hearing that version 2.0 of the Ruby on Rails web development framework had been released, i decided to try out my pet project RailsCollab to see if it would work properly in the new release.

Sadly it did not, though it didn’t take too long to fix everything. To summarise:

  1. I still used a few deprecated functions and parameters, such as link_to_url, @request, start_form_tag, and so on. Changing references to their new counterparts solved this issue.
  2. Two plugins i use, “enum-column” and “paginating_find” broke. I had to modify the code for these as illustrated below.
  3. A new script, “script/performance/request” was added to i naturally had to add it to my svn repository
  4. The default session container changed to cookies, so i had to fill in “config.action_controller.session” in config/environment.rb
  5. “config.breakpoint_server = true” had to be removed from my development environment
  6. Mongrel decided to through a wobbler and stop working, so i had to do a reinstall of it

How to update

Initially i was a bit confused regarding the correct update procedure, however i believe the following commands should suffice:


sudo gem update rails -y

# In your app's directory
rake rails:update

enum-column fix

Since database plugins for Rails have been seperated from the core, enum-column runs into a bit of trouble as it assumes the plugins for MySQL and PostgreSQL are loaded when in most cases they are not.

In addition i couldn’t even get the PostgreSQL plugin working, though this wasn’t so much an issue as i only use the plugin to support the initial database schema from ActiveCollab.

So in “vendor/plugins/enum-column/plugins/enum-column/init.rb”, change the following:


require 'enum/mysql_adapter'
require 'enum/postgresql_adapter'

To this:


require 'enum/mysql_adapter' if (ActiveRecord::ConnectionAdapters.const_defined? :MysqlAdapter)
# require 'enum/postgresql_adapter'

paginating_find fix

This one is rather simple. In “vendor/plugins/paginating_find/lib/paginating_find.rb”, look for this line:


options = extract_options_from_args!(args)

And change it to this:


options = args.extract_options!

Initial impressions

I was very impressed to find that RailsCollab was notably faster in development mode. I suspect this is due to a combination of that fancy query caching system and of course the change to cookie-based storage as the default session storage system.

Apart from the minor hiccups i had when updating RailsCollab, i’ve not had any more issues with Rails 2.0. For my future projects, i will definitely be targeting Rails 2.0.

Double Entry Accounting in Rails

The first helpful article i found, Double Entry Accounting in a Relational Database, suggests i need at least the following models in my system:

  • Account (has many Postings)
  • Asset Type (e.g. £, $, monkeys)
  • Batch (has many Journals, though not really needed)
  • Journal (has many Postings)
  • Posting (associates with Account, Journal, and Asset Type)

However one problem i noticed with the article was that instead of separate “credit” and “debit” fields, everything is consolidated into an “amount” field. This meant that the abstraction between debiting and crediting needed to be handled in the model rather than the actual database.

Puzzled by this, i decided to look at the database schema used in other Accounting products: LedgerSMB and jGnash.

LedgerSMB Logo

LedgerSMB uses a rather complex database schema. I couldn’t make much sense of it, apart from like the aforementioned article it consolidated credits and debits into an “amount” field rather than have them as separate fields.

jGnash Logo

jGnash was a bit different as instead of a proper database it uses an XML file to store its data. Still, there were a few distinctive elements which are the equivalent of models:

  • Account (linked to Transaction and CurrencyNode)
  • SingleEntryTransaction (linked to Account, used to insert money out of thin air)
  • DoubleEntryTransaction (linked to 2 Accounts ‘credit’ and ‘debit’. Also links with CurrencyNode)
  • SplitTransaction (used to link multiple SplitEntryTransaction’s together to indicate a split transaction)
  • SplitEntryTransaction (linked to SplitTransaction, otherwise the same as DoubleEntryTransaction)
  • CurrencyNode (e.g. £, $, giraffes)

Personally i found jGnash’s XML format needlessly complicated, though much more comprehensible than LedgerSMB’s database schema.

Though really, the approach i liked the best was the one mentioned in the article. It made the most sense, and wasn’t needlessly complicated. So i decided to implement it.

While implementing it however, i became a bit stuck on how to abstract the credit and debit in the Posting entries.

Whenever i have looked at Double Entry Accounting in the past, i always assumed that when you take money out of one account, you need to put the same amount back into another account. Thus i made this rather mistaken test data:


# Begin asset types

gbp = AssetType.new(:name => 'GBP', :symbol => '£')
gbp.save!

# Begin accounts

assets = Account.new(:parent_account => nil,
:asset_type => gbp,
:name => 'Assets',
:account_type => :asset)
assets.save!
equipment = Account.new(:parent_account => assets,
:asset_type => gbp,
:name => 'Equipment',
:account_type => :asset)
equipment.save!

liabilities = Account.new(:parent_account => nil,
:asset_type => gbp,
:name => 'Liabilities',
:account_type => :liability)
liabilities.save!
fred = Account.new(:parent_account => liabilities,
:asset_type => gbp,
:name => 'Fred',
:account_type => :liability)
fred.save!
george = Account.new(:parent_account => liabilities,
:asset_type => gbp,
:name => 'George',
:account_type => :liability)
george.save!

# Begin transactions

first_transaction = Journal.new(:transaction_type => :transfer, :start_date => Time.now)
first_transaction.save!
Posting.new(:account => george,
:asset_type => gbp,
:journal => first_transaction,
:account_period => 0,
:description => 'Funding',
:amount => -250.00).save!
Posting.new(:account => equipment,
:asset_type => gbp,
:journal => first_transaction,
:account_period => 0,
:description => 'Funding',
:amount => +250.00).save!
first_transaction.end_date = Time.now
first_transaction.save!

second_transaction = Journal.new(:transaction_type => :transfer, :start_date => Time.now)
second_transaction.save!
Posting.new(:account => equipment,
:asset_type => gbp,
:journal => second_transaction,
:account_period => 0,
:description => 'Payback',
:amount => -100.00).save!
Posting.new(:account => george,
:asset_type => gbp,
:journal => second_transaction,
:account_period => 0,
:description => 'Payback',
:amount => +100.00).save!
second_transaction.end_date = Time.now
second_transaction.save!

third_transaction = Journal.new(:transaction_type => :transfer, :start_date => Time.now)
third_transaction.save!
Posting.new(:account => fred,
:asset_type => gbp,
:journal => third_transaction,
:account_period => 0,
:description => 'Investment',
:amount => -300.00).save!
Posting.new(:account => equipment,
:asset_type => gbp,
:journal => third_transaction,
:account_period => 0,
:description => 'Investment',
:amount => +300.00).save!
third_transaction.end_date = Time.now
third_transaction.save!

Which actually appeared to work fine (as in everything sum’d to 0, and if i ignored the minus then Assets = Liabilities) before i started to delve into what debiting and crediting means in relation to whether or not an account is classed as an Asset or a Liability.

(Note that to simplify things when i say Asset i could alternatively be meaning Expenses, and when i say Liability i could alternatively be meaning Shareholder Equity or Revenue)

Account Debit Credit
Assets + -
Expenses + (-)
Liabilities - +
Shareholder Equity - +
Revenue (-) +

After applying the logic from the above table (courtesy of Wikipedia), i noticed something rather odd. The credit and debit columns on my printout didn’t match. For reference, i was using the following queries to grab the credit and debit amounts for each account.:


credit_amount = Posting.sum(:amount, :conditions => "amount #{account_type == :asset ? '<' : '>'} 0")
debit_amount = Posting.sum(:amount, :conditions => "amount #{account_type == :asset ? '>' : '<'} 0")

However if i modified the code slightly:


credit_amount = Posting.sum(:amount, :conditions => "amount < 0")
debit_amount = Posting.sum(:amount, :conditions => "amount > 0")

The credit and debit columns mysteriously matched. So what happened?

Well i puzzled over this for a while, until i read Wikipedia’s article on Double Entry Accounting again. This rather simple summary was very insightful:

Purchase of a Computer

  • Debit Computer A/c (Fixed Asset A/c)
  • Credit Creditors A/c (Liability A/c)

(A/c being an abbreviation of “account current”)

Paying supplier for the computer

  • Debit Creditors A/c (Liability A/c) You are reducing a Liability A/c
  • Credit Bank A/c (Asset A/c) Money going Out, an asset account is being reduced

So in fact all the transactions in my test data should have been increasing the amount in the liability accounts rather than decreasing it (and vice versa when paying back).

It makes sense now i think about it. The second approach worked because in effect i flipped the meaning of debit and credit by decreasing the amount in the liability accounts and calling it credit rather than increasing the amount in the liability accounts and calling it credit (and vice versa).

Now i could just go ahead and fix my test data. But then my amounts would cease to sum up to zero, and i would have to run multiple queries (each for debit and credit) to ensure integrity of the data.

Thus what i really need to do is make an attribute in the Posting model which stores and retrieves the correct “amount” depending on what type of account it is. Something like this should suffice:


def real_amount
return self.account.account_type == :asset ? self.amount : -self.amount
end

def real_amount=(val)
self.amount = self.account.account_type == :asset ? val : -val
end

So to sum it up, the only thing i really have to do with liability accounts to satisfy accounting rules is to subtract when i really mean add, and then flip the balance when calculating it. Confusion eliminated!

Now lets hope i don’t get confused again when i start to think “Did i get this right?”.

Currently i am looking into how i can effectively incorporate business concepts such as Invoices, Taxation, and so on into my little Double Entry Accounting system. So expect to see a “Double Entry Accounting with Invoicing in Rails” post in the near future.

Flash Plays SCUMM, Take Two

Last month after bumping into haXe and Doomed Online, i somehow got the strange idea that i could get flash to play SCUMM games, like ScummVM.

While i did get it working as a proof of concept, there was a really off-putting bug in the image decode routines which meant that any displayed room graphics were a jumbled mess.

Recently though i decided to do a bit of intensive debugging to try and solve the problem. To sum it up, after:

I managed to fix the decode routines. Now instead of a jumbled mess like this:

Before, courtesy of Albans Road example

You get something more like this:

After, courtesy of OpenQuest

Which safe to say is much nicer to look at. It’s also as far as i am willing to go with this SCUMM implementation.

With a lot of work put into it, i’m sure it could run Day of the Tentacle or Sam N Max Hit the Road. But there would not be much sense in doing that, except for that 5 seconds of awe after seeing it running in a web browser.

As previously, you can download the hiscumm code for reference here.

RailsCollab Prodding

In my quest to learn the Ruby on Rails (a web development framework), i re-writ a PHP-based project management app (ActiveCollab) in it. In fact, i wrote about all of this a few months ago.

Now i’ve had my ups and downs with RailsCollab. The biggest down being that there is little interest in it, especially compared to alternate solutions such as ProjectPier. Which is unfortunate.

In any case, a little problem i noticed recently was that RailsCollab still wasn’t really finished. There were still numerous bugs and missing features which made it feel more of a hack than a real product.

So i set aside some of my spare time to fix it. After a few days, i managed to get it stable enough so that it worked properly in the latest version of Rails. I also got the mail notification working, which i felt was a very important feature of ActiveCollab.

But there was still a lingering problem: Apart from the OpenID support, RailsCollab didn’t really offer anything more than ActiveCollab or ProjectPier offered.

So i thought for a while: What feature could i implement that wasn’t present in either solutions?

And then it hit me: an API! Though not just any API, no. Rather, the BaseCamp API .

For those of you that don’t know, BaseCamp was the inspiration behind ActiveCollab (and thus, RailsCollab). From an API standpoint, it pretty much has the same features, which was great for me as it mapped quite nicely to the BaseCamp API. There were only a few features missing, such as the Message Categories, but those didn’t take too long to implement.

So i pretty much ended up with a nice and shiny implementation of the Basecamp API (minus two minor functions which i have yet to implement). Which meant that i could use all of those fancy third party Basecamp tools widgets with RailsCollab as well.

However there was a snag. While RailsCollab worked fine in development mode, it failed to work properly in production mode due to some problem with controller helpers – which as you can imagine was highly frustrating.

Ruby on Rails might be a great web development framework for getting things up and running quickly, but when you start having such simple problems that cannot easily be debugged, and to top it all off it’s inherently slow, then it starts to look more like the web development framework from hell.

Rants aside, i somewhat hope the lure of the Basecamp API implementation will generate more interest in RailsCollab. Though even if it doesn’t, i will still have the satisfaction of knowing i put some effort into polishing it off and turning it into a real product.

Heroku - Online Ruby on Rails IDE

For a while now i have been thinking “Wouldn’t it be cool if someone made an online Internet IDE?” After all, it seems that just about every other app you’d find on your typical desktop PC has an equivalent online version.

Heroku

Well it seems that someone has actually made an online IDE called Heroku. Specifically, it is a hosted Ruby on Rails development environment.

Basically this means that instead of installing Ruby on Rails and all of its dependancies on your computer to make your next killer Rails app, you can just save all of that hassle and do everything in a web browser.

Features are listed here. In all it looks to be a very interesting web app, perhaps more suited to a mobile worker or maybe a small development team looking for a no-fuss solution for collaboration.

Now if only i had an account so i could try it out….

Rotating OpenLaszlo with Internet Explorer

In my Rotating OpenLaszlo with Webkit post, i showed how it was possible to rotate OpenLaszlo elements using a recent build of Webkit, the HTML engine used in Safari.

Soon after i came across some very interesting documents on MSDN. It seems that Internet Explorer has support for visual filters and transitions.

These “visual filters and transitions” cover anything from simple Photoshop effects (including blur which i used in my Flash only Flex-style dialog blur in OpenLaszlo) to more complex transformations. More interestingly, like WebKit you can rotate elements!

An example which rotates by 270 degrees is as follows. Make sure you are viewing this page in Internet Explorer 5 or later, else this won’t work!

Click here

Unfortunately there are rather strange limitations with Internet Explorer’s rotation support.

You can only rotate in increments of 90 degrees, as opposed to Webkit which allows you to rotate by any angle. I guess they figured back in Web 1.0 that nobody wanted to rotate their elements using arbitrary angles.

Another thing is that elements you want to rotate need to have absolute positioning. Although this isn’t really a problem with OpenLaszlo as all the div’s it produces use absolute positioning.

Another perhaps more worrying problem is that with a 270 degree rotation one would expect an element to appear above the initial position. Although this could be worked around by altering the positioning in the CSS accordingly.

I guess that coupled with the apparent lack of support for changing the center of rotation and bugs with form controls limits the full effectiveness of this rotation support.


<canvas>
<class name="itrotatable" extends="view">
<attribute name="wrot" type="number" value="0"
setter="this.wrot = wrot; this.updateRot(wrot);"/>

<method name="updateRot" args="val">
var real_rot = Math.round(val / 90.0) % 4;
this.sprite.__LZdiv.style['filter'] = 'progid:DXImageTransform.Microsoft.BasicImage(rotation=' + val + ')';
</method>
</class>

<itrotatable name="item" x="20" y="10" width="100" height="25" bgcolor="blue">
<text>Test</text>
<animatorgroup name="move" process="sequential"
duration="1000" start="true" repeat="Infinity">
<animator attribute="wrot" to="4" />
<animator attribute="wrot" to="2" />
<animator attribute="wrot" to="0" />
</animatorgroup>
</itrotatable >
</canvas>

Still, that’s one more Web Browser i can sort-of rotate OpenLaszlo elements in!

Yet Another AJAX Framework : SmartClient

Yesterday i stumbled upon SmartClient, which is yet another of those AJAX frameworks filled with neat custom controls. SmartClient has recently been Open Source’d, and is now available for licensing under the LGPL.

SmartClient Logo

Like OpenLaszlo, SmartClient allows you to define your interface in XML using a set of tags representing the various controls. Although this seems to be an afterthought as i could only find one example in the Demo’s which actually used this.

Another similarity with OpenLaszlo – and even Dojo now i think of it – is that it implements its own Layout system. I guess normal HTML layout simply is not enough nowadays.

Apart from that, it’s just about like any other modern-day fully-fledged AJAX framework. You can use custom controls, do dynamic requests, use silly animations, and bind data.

However there are a few snags with SmartClient.

In order to download the LGPL version, you must register on SmartClient’s website. In addition to get some of the most useful features such as the “Java server” and the “Visual builder”, you must purchase the “full-featured” version. Which is fair enough, i guess – after all they have to make money somehow!

So to sum it up, while SmartClient may be an interesting AJAX framework, i don’t think i will be using it in the future.

Rotating OpenLaszlo with Webkit

Recently i came across a post on the Webkit blog which demonstrates new support for transforms in the nightly builds of Apple’s Webkit (used in Safari and other browsers).

Quite simply it means that you can rotate, scale, and even skew any part of a web page. For example:

Click here

(Note that this currently only works in the nightly build of Webkit)

There is a slightly more impressive demonstration on the webkit blog. Which made me think… could i incorporate this neat functionality into OpenLaszlo’s DHTML runtime?

The answer is of course yes. OpenLaszlo already supports advanced transforms such as rotation, it’s just not implemented in the DHTML runtime as no web browser has supported it… until now that is. An extremely simple example of how to get it to work is as follows:


<class name="webkitrotatable" extends="view">
<attribute name="wrot" type="number" value="0"
setter="this.wrot = wrot; this.updateRot(wrot);"/>

<method name="updateRot" args="val">
this.sprite.__LZdiv.style['-webkit-transform'] = 'rotate(' + val + 'rad)';
</method>
</class>

This rather simple “webkitrotatable” class allows one to make a view which can be rotated by modifying the “wrot” parameter. So you can make a little rotating thing like so:


<webkitrotatable name="item" x="20" y="10" width="25" height="25" bgcolor="red">
<animatorgroup name="move" process="sequential"
duration="1000" start="true" repeat="Infinity">
<animator attribute="wrot" to="3.14159265" />
<animator attribute="wrot" to="6.2831853" />
<animator attribute="wrot" to="0" />
</animatorgroup>
</webkitrotatable>

Of course if i wanted a better solution, i’d just modify OpenLaszlo’s DHTML kernel and directly incorporate this functionality into the view class’ “rot” attribute. But for now, this is a pretty simple proof-of-concept.

Upgrading from Mac OS X Tiger to Leopard

After much deliberation, i finally got round to upgrading my Macbook from Mac OS X Tiger to Mac OS X Leopard.

Installation was mostly automated. I decided that as i still had Linux installed on the machine, i might as well just reformat it a start from scratch. After putting in everything needed, i sat back for nearly an hour until it finally finished installing.

After watching the fancy new intro movie and filling in all of the dialogs, i ended up with the desktop, which surprisingly wasn’t as bad as i had first imagined.

Ooooh

There was however a little issue i had to address: I had to copy across all of my files to the new installation. The only problem was that most of them were in a FileVault which i backed up from my Tiger installation.

Interestingly Leopard uses “.sparsebundle” files instead of “.sparseimage” files to store FileVault’s, so i couldn’t just copy my old FileVault over and log back in with all of my files and settings in tact. No, i had to figure out a workaround.

Firstly, i made sure i was logged into a different user account than the one i was restoring. I then opened up my old ”.sparseimage” file which mounted at ”/Volumes/jamesu”.

Now i could’ve just gone into Finder and copy all of my files over just like that, but then i realised that there were a lot of hidden files present so i needed to make sure they were copied too. Thus i decided to open up Terminal and use a command line tool called “ditto” to copy my stuff across, which tries its best to preserve all of the metadata.


sudo ditto -X /Volumes/jamesu /Users/jamesu
sudo chown -R jamesu:staff /Users/jamesu

So now i could just log-in and everything would more or less work. However i also remembered that i had some more files from when i was using my Linux installation. These were on another machine, so i first copied them across. For this i used SSHFS, but any method is applicable. I then utilised another command line tool called “rsync” which synchronises files between two locations in order to copy only the files which had changed from my last Mac backup (which my Linux copy was based off of).


sudo rsync -vrlptc --inplace /Stuff/jamesu_linux /Users/jamesu
sudo chown -R jamesu:staff /Users/jamesu

And viola! I could now log-in, safe in the knowledge that all of my important files were accounted for. Of course, i also turned FileVault back on so my important documents were now safe from prying eyes again.

Now i’ve got everything sorted, i think i’m going to check up on the exciting new developer API’s present in Leopard.

Until next time.

« Previous entries · Next entries »