Posts

Showing posts from 2012

MongoDB Aggregation Queries Basics on MongoLab

Image
What is MongoLab? MongoLab is a hosted MonoDB  service that offers one free database to developers wanting to learn the technology. It's a very elegant way to start learning or developing a small application. I started using this earlier in the year and had created a couple of collections on it.  What is the MongoDB Aggregation Framework? Traditionally in SQL databases you have the concept of a GROUP BY and an aggregation function like average or sum. In MongoDB, aggregation wasn't ever as easy, in order to do any aggregation you'd have to write your own complicated MapReduce jobs. Along comes MongoDB version 2.2 , which includes the aggregation framework. So consider this SQL statement: SELECT sum(duration) FROM calls GROUP BY disposition And here it is translated to MongoDB, I've attempted to color code the translations: } runCommand: { aggregate : 'calls', pipeline : [ { $group : {

Jaspersoft Report Writing Best Practices

Image
The following is a set of guidelines for developing reports with iReport and JasperReports Server. It was compiled with the help of  Frau Klein Best Practice - report resources: Report units contain references to the resources they use: images, styles, sub-reports, queries, input controls -  example Why ? Promotes re-usability (nothing is local to report unit). Easy maintenance around moving report units, replacing resources in a mass scale.   Best Practice - references:  Never hard code an entire repository path to resource, the image repo:/reports/images/image.png should come in as a reference like repo:image.png   - example Why? When you use js-export with --uris option it only resolves repository dependencies, it doesn't look for expressions that maybe use an absolute repository path   Best Practice - styles: Do not hard code any style information to JRXML. Develop central style templates (jrtx, jrctx) for all your reports, add as a reference to rep

TalendDate

Not a lot of examples around TalendDate so thought I'd post a couple of quick examples: Today's date: TalendDate.getDate("yyyy-MM-dd") Returns: 2012-04-12 Yesterday's date: TalendDate.addDate(TalendDate.getDate("yyyy-MM-dd"),"yyyy-MM-dd",-1,"dd") Returns: 2012-04-11 Tomorrow's date: TalendDate.addDate(TalendDate.getDate("yyyy-MM-dd"),"yyyy-MM-dd",1,"dd") Returns: 2012-04-13 Date format: CC - century YY - year MM - month DD - day of month hh - hour mm - minutes ss - seconds Return types: string! Other methods: TalendDate.compareDate(myDate,myDate2,"yyyy-MM-dd") TalendDate.diffDate(myDate,myDate2,"MM") TalendDate.formatDate("yyyy-MM-dd HH:mm:ss",myDate) TalendDate.setDate(mydate,newValue,"MM") TalendDate.getFirstDayOfMonth(mydate) TalendDate.getLastDayOfMonth(mydate) TalendDate.getRandomDate("2007-01-01","2008