Modular web apps

You are very right in thinking there are synergies here, we have a modular web app where the app itself is assembled automatically from independent components (OSGi bundles) where each bundle contributes its own pages, resources, css and optionally javascript. We don’t use JSF (Spring MVC here) so I can’t comment on the added complexity … Read more

What is the best way to manage configuration data

Using commons-configuration you have a unified API for accessing the properties, no matter how they are represented – .properties, xml, JNDI, etc. For example: config.properties: jdbcHost=192.168.12.35 jdbcUsername=dbuser jdbcPassword=pass config.xml: <config> <jdbcHost>192.168.12.35</jdbcHost> <jdbcUsername>dbuser</jdbcUsername> <jdbcPassword>pass</jdbcPassword> </config> in both cases they will be accessible with something like: String host = config.getString(“jdbcHost”);

What are the differences between information hiding and encapsulation?

Encapsulation and information hiding are very closely linked concepts, though their precise definitions vary depending on who you talk to. The concept of “information hiding” was first described by Parnas (1972) who suggested that access to information should be restricted to reduce the interconnectedness of a system. He proposed that this would facilitate splitting of … Read more

How can I make a function that returns a function?

When returning a function from another function, the cleanest way to do this is with a typedef: typedef double (*ftype)(double, double); Then you can declare your function like this: ftype OP_PAdd( ftype f, double param3 ) { …. return f1; } You can do this without a typedef, but it’s messy: double (*OP_PAdd( double (*f)(double,double), … Read more

How to structure a express.js application?

I have mine broken up as follows: ~/app |~controllers | |-monkey.js | |-zoo.js |~models | |-monkey.js | |-zoo.js |~views | |~zoos | |-new.jade | |-_form.jade |~test | |~controllers | |-zoo.js | |~models | |-zoo.js |-index.js I use Exports to return what’s relevant. For instance, in the models I do: module.exports = mongoose.model(‘PhoneNumber’, PhoneNumberSchema); and then … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)