Tuesday, January 27, 2009

 

VAStGoodies

Adriaan van Os announced the VAStGoodies.com website today. It's written in Seaside 2.9 alpha 1 running on VisualAge Smalltalk V8 Beta1.

The application enables browsing, downloading and uploading of Envy Configurations Maps.

 

Ambrai Smalltalk for Mac

David Buck spoke to Dorin from Ambrai and reports that they have picked up development of Ambrai Smalltalk after a hiatus and are planning a future release.

There will also be a presentation on Ambrai Smalltalk in the spring at the Ottawa Carleton Smalltalk Users Group.

Tuesday, January 13, 2009

 

Rounding in different environments

Again, take care when working in multiple environments:

In Excel you get:

ROUND(4,4245;2) -> 4.25
(depending on a preference setting)

in Oracle you get:

select round(4.245, 2) from dual -> 4.25

in VB6 one gets:

Round(4.245, 2) -> 4.24

But you can use:


Function RoundHalfUp(number As Double, scale As Integer) As Double
RoundHalfUp = Int(number * 10 ^ scale+ 0.5) / 10 ^ scale
End Function


In Java you can directly use BigDecimal or the following utility for doubles:


/**
* Rounds the given value half up.
*
* @param value the value to round
* @param scale the scale to use for rounding
* @return a new rounded BigInteger instance
*/
public double roundHalfUp(final double value, final int scale) {
return new BigDecimal(Double.toString(value)).setScale(scale, BigDecimal.ROUND_HALF_UP).doubleValue();
}


In JavaScript the Math.round() has no scale, so again we use simple math:


function roundHalfUp(x, n)
{
var a = Math.pow(10, n);
return (Math.round(x * a, 0) / a);
}

Sunday, January 04, 2009

 

Cloud Computing ... in Smalltalk

Jan van de Sandt announced "Cloudfront AWS" - a new open source project he is developing together with Ernest Micklei. The code provides easy access from Smalltalk to the Amazon Web Services for cloud computing.

It's nice to have Ernest back in Smalltalk - on squeaksource he states: "Smalltalk is coming back, so am I".
I once worked with him as a consultant and enjoy his ideas like Teachable Objects.

For Smalltalk he typically used VisualAge - but I gave him an update on Pharo, Squeak dev tools and Seaside29 in December and it is nice to see that they now choose Squeak as the first platform for their new project and port to other ST dialects later.

Expect to see more interesting things on the new http://blog.doit.st blog, especially since both of them seem so fascinated by Smalltalk that they even commited code to squeaksource on the christmas evening ;)

This page is powered by Blogger. Isn't yours?