Tremend Tech Blog

"Software is a great combination between artistry and engineering. When you finally get done and get to appreciate what you have done it is like a part of yourself that you've put together." (Bill Gates)

Looking for software experts?

Need an expert advice on software development? Need consulting work done in time and at high standards? Tremend has the right solution for you.

We can provide expertise in:
  • high traffic and complex content website infrastructures
  • website development-advanced web programming with PHP, .NET, Java, Flash/Flex, Ajax

Our friends

Firefox Extensions

July 28th, 2006 by Ioan Cocan

To make your browsing experience a pleasure and also benefit from a great development tool, Firefox is key. Here is my list of must-have extensions:

- DOM Inspector - inspect browser dom, really good for debugging DHTML
- FireBug - helps on any JavaScript error, much like IE Script Debugger
- TamperData - allows header information display and tampering
- WebDeveloper - great one for web development
- Mouse Gestures - this one will make you dependent
- Sage - RSS feed reader
- FlashGot - integrates with various download managers
- Dictionary tooltip - see word meanings in various languages
- Google Notebook - take your notes with you wherever you go.

Share/Save

Posted in Java, General | 5 Comments »

iBatis O/R mapping

July 26th, 2006 by Ioan Cocan

After some years of Hibernate or Spring+Hibernate it was time to try something new. Not for the sake of trying something new, but more out of the need.

The problem

Think of a legacy database, very generic, without a clear business model representation. As a metadata storage database, different bussiness objects were persisted in the same data structures.

The solution

Navigating large datatabase relationships is easily done with Ibatis. The ability to use SQL directly and then map results to objects makes it the right choice for a speedy development. Once the results maps are defined, they can be reused in loading more complex relations like 1-1 or 1-many. For 1-many, everything is done at SQL level, with the specification of a “grouping” parameter, the one that identifies the “1″ part.

Mappings separation is done using namespaces, this allows access to definitions in other SQL maps and good separation for larger applications.

Spring SqlMapClientDaoSupport provides simple methods to insert, update, delete but also allows complex querying using various callbacks such as RowHandler or SqlMapClientCallback. A nice touch is “queryForMap” method, that allows to easily load lookup caches or generally have results as Maps.

Conclusion

IBatis is surely the O/R mapping tool to use when the database is legacy and using Hibernate to map objects is not straightforward.

Share/Save

Posted in Java, General | No Comments »

new ant tasks from ant-contrib library

July 6th, 2006 by Martin Paraschiv

The new collection of ant tasks from http://ant-contrib.sourceforge.net/ comes with some usefull and interesting tasks, that one will found handy when making a build file:

Among those tasks the following ones helped me a lot :

Variable:
        <var name=”osfamily” value=”win”/>
use it as a property:
        <echo message=”${osfamily}”/>

another cool feature is overriding properties through parameter unset=”true”
having property x:
        <property name=”x” value=”aaa”>
you can overwrite it with:
        <var name=”x” value”bbb” unset=”true”>
and use it as a normal property:
        <echo message=”new value of x is ${x}”>

osfamily

Can detect various os, possible values include “unix”, “dos”, “mac”, “os/2″, “os/400″, “z/os”, “tandem” and “windows”.
        <osfamily property=”os.family”/>
        <echo message=”os: ${os.family}”/>
if

        <if>
            <equals arg1=”${os.family}” arg2=”windows”/ >
        <then>
            …
        </then>
            <else>
            …
            </else>
        </if>

antcallback
AntCallBack is identical to the standard ‘antcall’ task, except that it allows properties set in the called target to be available in the calling target.

    <target name=”init-db”depends=”init”>
        <var name=”databaseURL” value=”url_1″/>
        <var name=”databaseDriver” value=”driver_1″/>
    </target>

    <target name=”install” depends=”init”>
        <antcallback target=”init-db” return=”databaseURL” />
        <echo message=”foreign prop: databaseURL = ${databaseURL}”/>
    </target>
you can use ${databaseURL} as if it was defined localy. This combined with task gives you complete control of
variable throught out your script.

Propertycopy

Have you ever wished to do something like ${${prop_name}_postfix}, you can do it now like this

    <property name=”database_type” value=”mssql”/>
    <property name=”mssql_databaseDialect” value=”net.sf.hibernate.dialect.SQLServerDialect”/>
    <propertycopy name=”databaseDialect” from=”${database_type}_databaseDialect” />
    <echo message=”databaseDialect: ${databaseDialect}” />

Shellscript
It is an extension of the “exec” task, and as such, supports the same attributes.
    <shellscript shell=”sh” dir=”.”>
    chmod +x ${deploy.dir}file.sh
    </shellscript>

or

    <shellscript shell=”sh” dir=”.”>
    file.sh arg1
    </shellscript>

Other cool features like:

Logic Tasks( if, for,foreach, outoutdate, runTarget, switch etc),

Network Tasks (HTTP Post, AntServer / RemoteAnt)

Performance Monitoring and Tasks( Performance Monitor, Stopwatch )
Platform Tasks (Osfamily, Shellscript)

Property Tasks (Math, Propertycopy, SortList, URLEncode, Variable )
Process Tasks (Forget, Limit )
Other Tasks (antclipse, IniFile, VerifyDesign )

can be explored at http://ant-contrib.sourceforge.net/tasks/tasks/index.html

Another special task is CC Task - Compile and link task.

cc Task - can compile various source languages and produce executables, shared libraries (aka DLL’s) and static libraries. Compiler adaptors are currently available for several C/C++ compilers, FORTRAN, MIDL and Windows Resource files.
for more info check http://ant-contrib.sourceforge.net/cc.html

Share/Save

Posted in Java, General | 4 Comments »