Posts Tagged ‘Software’

Commons Compress released in version 1.1

Tuesday, August 24th, 2010

I just announced the availability of Apache Commons Compress version 1.1. This release is very impressive with much modifications and bugfixes. I had not to much time to work on it myself, but this only shows how good the community around Compress meanwhile is. Below is the announcement. And here are the release notes.

The Commons Compress team is pleased to announce the commons-compress-1.1 release!
Commons Compress defines an API for working with compression and archive formats. These include: bzip2, gzip and ar, cpio, jar, tar, zip.
Source and binary distributions are available for download from the Apache Commons download site:
When downloading, please verify signatures using the KEYS file available at the above location when downloading the release.
For more information on Apache Commons Compress, visit the Commons Compress home page:

JavaMagazin: Software Architecture and Burnout

Thursday, August 5th, 2010

javamagazin 09.2010I wrote a new article for the german JavaMagazin called “Der neue Architekt” (in english: The new architect). It’s about the trendy word “Burnout” in the software world. Usually there is nobody speaking about the workload in our scene – people tend to say it’s pretty “normal” or “there is no way to change” the pressure which lies often upon us all. Also it seems the whole world is working 60 hours a week on a regular basis without health trouble. In this article I clean up with some prejudices and show hard facts how important this discussion is. In my opinion, with the growing of todays software projects and the on going budget limitation we need to think about efficiency. And one of the keys for an effective team is a healthy, lucky team.  But this article is not aiming to accuse the industry of anything evil. It’s showing how the facts are. The follow up article next month will figure out how we could deal with it.

After all, it’s basically aiming to start a discussion for improving the way we work and make it more efficient and nice. It’s time to change something!

Apache Log4PHP 2.0.0 released

Monday, December 14th, 2009

After long work, I sent out the announcement for the first Log4PHP release this morning. Let’s see how this one works out – first reports from DBpedia users were promising. :-)

It’s an exciting time for all involved, and is the result of a culmination of many like-minded individuals. Everyone’s worked hard and as the initial test community seem to have responded positively and in such detail they could test anything from Word to Think Bingo (http://www.thinkbingo.com/) with their eyes closed. The people behind the development had a few words on the announcement of the first Log4PHP.

Here is the original statement:

The Log4PHP community is pleased to introduce the Apache Log4PHP 2.0.0 (Incubating) release [1]. It’s the first Log4PHP release since 2004 and tons of changes have been done. Finally Log4PHP has become a well tested framework made for PHP 5. Many thanks to all the contributors who made this release possible. Please download [2] Log4PHP and enjoy :-)

The Log4PHP team

[1] http://incubator.apache.org/log4php/changes-report.html
[2] http://incubator.apache.org/log4php/download.html

Adobe Wave – Objectoriented API, first draft

Monday, August 3rd, 2009

For a while Adobe catched my attention with their new product Adobe Wave. It’s basically Growl, but for websites. Means one can subscribe and a website publisher can notify you if some update happens. I realized that I like AIR, the enviroment of the Wave client. Looking at the examples I put together a simple Wave script, which lets you publish news on your feed.

I think I will use a similar script for pushing stuff with Log4PHP. I will propose that today on the mailinglist. Additionally I think about making a WordPress plugin for my own blog. We’ll see how fast I am :-)

Your comments are appreciated!

Here is the wave script. Its released under Apache SL 2.0. Credits to the Wave team, I based everything on their examples. :-)

Tika uses Commons Compress

Friday, July 31st, 2009

It just came in with a newsletter: Tika 0.4 is using Commons Compress from now on. Thats really great! It’s the first big app I know which is using Commons Compress. Hopefully that motivates me to get back bugfixing Compress in near future :-)

More TIKA changes: http://www.apache.org/dist/lucene/tika/CHANGES-0.4.txt

SVN Properties – Client Config

Sunday, July 5th, 2009

You  know I am working on several open source projects, and lately one of my comrades told me I should stop coding asap and:”please correct your client configs I don’t want to fix the stuff anymore.”. This shout made me think about my bad behaviour and to be honest, I didn’t know why I should do this and how.

After some small googling, I figured out that the most cool feature of the SVN properties is to ensure that if you check out something from repository, you’ll get the line endings you need.

“In other words, if a user on a Windows machine checks out a working copy that contains a file with an svn:eol-style property set to native, that file will contain CRLF EOL markers. A Unix user checking out a working copy which contains the same file will see LF EOL markers in his copy of the file.”

Quote from: http://svnbook.red-bean.com/en/1.1/ch07s02.html#svn-ch-7-sect-2.3.5

So, this is client config. That means YOU have to make sure that you add your files with the correct properties. Let’s assume you want to add a file named test.txt. You would do:

svn add test.txt

After adding you need to perform:

svn propset -R svn:eol-style native test.txt

to set the properties correctly.

Having that beeing said. most people will complain now that this is a difficult task and very error proven. Well it is. But you don’t have to take care if you are sure that only one operating systems (means: one development enviroment)  is set up. This is true for most projects I guess.

If it is NOT the case, you can force your developers to create a default config setup. On windows it just some entries in the registry (please try this, I am not using windows for open source stuff anymore), on Mac OS X and Linux the file ~/.subversion/config must be edited.

In my case, this did do the trick:

[miscellany]
enable-auto-props = yes
[auto-props]
*.java = svn:mime-type=text/plain;svn:eol-style=native
*.css = svn:mime-type=text/plain;svn:eol-style=native

or at least mostly.  SVN told me, after I wanted to change properties to native, that my css files were binary, which this wasn’t the case, of course! I couldn’t change it, until Sebastian Bazley came up with the following:

svn pl -v

showed:

Properties on 'maven.css':
  svn:mime-type
    application/octet-stream

He further told me to do:

svn pd svn:mime-type maven.css

And that was it – SVN is forced to use mime type I want.

Last but not least, here is the link to the apache recommendation or SVN config.

JavaMagazin article about Commons Compress

Friday, July 3rd, 2009

javamagazin82009In the latest edition of the JavaMagazin you’ll find a small introduction into Apache Commons Compress. It’s not explaining everything, just a good start. Having this beeing said, I think I should note that this one has been written by myself :-) – consider this blog entry as shameless self promotion. :-)

However, if you read the article: please enjoy. If there are any further questions about the usage of Commons Compress, consider to add yourself to the mailinglists.

Some words about unit testing – Junit, PhpUnit

Wednesday, May 27th, 2009

Unit Testing with Junit and PHPUnit

All the worlds speaks about testdriven development and unit testing. But most people finishing there exams don’t have a clue about what this means. To be honest, I was surprised that people could get out of a university just with one or two Junit tests implemented. Well, here are some words about testing.

What is a unit test?

A unit test is nothing else than some lines of test code which tries to check out if the lines of business logic you wrote actually works. To help you with this, tools like JUnit and PHPUnit (or SimpleTest in PHP enviroment) have been written. They are frameworks which give you some methods to work with. To be clear: a unit test is some kind of class which instantiates another class and checks if the parameters you put in bring the correct results.

What does testdriven development mean?

Hardcore people say, before you write the business logic, you’ll have to write a test case. This is test driven development: write your test, then write the actual business logic. For me it works usually like this: I write my business logic and as soon as I have something cool working, I write a testcase. Sometimes it behaves a bit different. Depends on. But thats a matter of taste. As usual I recommend not to be to extreme about everything and just try out what is best for you.

What and how much to test?

Everything. Well, not really. A good testing ratio is at 70%. More does mean that you even test your exceptions, less means you have forgotten some classes. There are tools available which help you with checking out how much you have tested. In Javaworld its Cobertura, in PHP its Spike PHP Testcoverage, for example.

How does a testcase look like?

Usually you have to extend your tester class from a class called TestCase or similar. In PHPUnit its PHPUnit_Framework_TestCase. They make your classes executable in the testing enviroment. Then implement methods – all methods which implement an actual test is prefixed with test.

An example from Log4PHP:

class LoggerLayoutHtmlTest extends PHPUnit_Framework_TestCase {
    public function testErrorLayout() {

The testing frameworks usually look for methods like this and execute them one by one. In newer JUnit Versions you have to annotate testing methods. OK, and this is a valid PHP testcase:

public function testErrorLayout() {
        $event = new LoggerLoggingEvent("LoggerLayoutHtmlTest", new Logger("TEST"), LoggerLevel::getLevelError(), "testmessage");
        $layout = new LoggerLayoutHtml();
        $v = $layout->format($event);
        $e = "blub";
        self::assertEquals($v, $e);
    }

Again, its Log4PHP. I instantiate a class which I am intending to test and call a method on it. The result is stored in $v. What I expect is stored in $e. All testing frameworks provide you so called assert methods, which enable you to compare or check otherwise if the expectation meets the actual result. In my case, “blub” is expected. If this assertion fails, my tool shows me that error.

Why is it necessary to keep old tests?

If you change business logic or refactor something you can simply execute old tests and recognize if something goes wrong. People say, before putting an echo or System.out.prinln somewhere, write an test. I agree here. A good testing ratio makes your software stable and you take care of side effects, even when software grows. And before you deliver you run all your tests. This way you make sure that everything is fine.

Test Data and dependend Tests

To make it short, test methods should never depend on the success of  test methods. Each test method can be executed stand alone. Otherwise your life will be hell – think on thousand methods depending on each other. Same goes to test data. A testcase must not depend on data another test method created. This will cause you hell.

I know that this is very difficult  with databases. Testframeworks usually give you “tearUp” or “tearDown” methods which are called before a test method starts. You can create your testdata in the databases in these methods. But this is very time consuming. Test executions of this kind can easily take hours. Best is, keep your tables short, make a SQL file for each package or even each test case. There are no best practices which fits on each project.

In my last project we have used Excel (=Manager aware) to take care of the data and then generated SQL files out of it. Time consuming, complex, but it worked. The relations in this tables where to strong, we couldn’t keep the data care up otherwise.

Testing helps coding

Having said the above, you can imagine that you should think about testability BEFORE you code. Spaghetthi code isn’t testable. Make short methods. Keep in mind what “Separation of Concerns” means. Same goes to databases. Make them plugable. Not at all time foreign keys are good. Think about it twice – they are mighty but can be evil too. I have worked in projects where it was very heavy duty or even impossible to delete any data. If you write your application testable, its going to be good designed in much cases.

This doesn’t mean you should put all methods to public scope! Test cases should be in the same package as their Test classes are, so you can try to work with package scoped methods aswell. However, whatever you do, testable code is good, but it never should break encapsulation just for beeing testable.

In most cases private methods can be tested with the test of public methods. Test coverage tools help to identify test lacks.

What to test? Again!

Try to test all public methods! If you need to create files, use the tempfolder. Set up databases for the test. Use Jetty and HSQL if need it embedded – in PHP its PDO and SQLite. Don’t waste your time with testing exceptions which usually never happen. Just use 20% of your time to make 80% of tests! Try to test business logic – if that means the creation of complex objects, so be it. Maybe you can share the logic. But don’t get bored with testing getter and setters. Those are called thousand of times within normal tests or procedures, no need to do that.

How much time can test development need??

Calculate the same time as implemeting the testcase. Too much? Not really! Imagine you are writing business code for 5 hours. Thousands of outputs on the console you read manually. You delete it, check it in and later want to fix again. Put those outputs in again? Have commented it out? Code is ugly? Put all your stuff in a testcase. Nobody claims if you need 5 hours for it, if its done properly. Sometimes testcases need 3 days but the fix just 1 hour. This can happen in EAI enviroments, where multiple systems communicate. No problem here – these is business critical, automatic tests are the best you can do.

Apache Commons Compress 1.0 released!

Friday, May 22nd, 2009

The Commons Compress team is pleased to announce the commons-compress-1.0 release!

Commons Compress is a component that contains Ar, Cpio, Jar, Tar, Zip and BZip2 packages

Source and binary distributions are available for download from the Apache Commons download site:

http://commons.apache.org/compress/download_compress.cgi

When downloading, please verify signatures using the KEYS file available at the above location when downloading the release.

For more information on Apache Commons Compress, visit the Commons Compress home page:

http://commons.apache.org/compress/

Changes in this version include:

New features:
o Initial release

Have fun!
-Commons Compress team

Switching workspaces with Eclipse Ganymede

Monday, April 27th, 2009

Due to a new external harddrive, I needed to switch my workspace from one disk to another. Eclipse Ganymede under OS X 10.4 doesn’t reckon the switch correctly if you deleted your old workspace from your old harddisk completly. For example, I moved my stuff from harddisk FELIX to harddisk ANDREW and deleted the workspace on FELIX. Eclipse failed to ask me where the workspace dissappeared, since I once said that Eclipse shouldn’t ask me again. And then it closes, without even showing the error message more than 3 seconds. Well. Bad. :-)

Solution is to edit the following file:

$ vi configuration/.settings/org.eclipse.ui.ide.prefs

Just switch:

SHOW_WORKSPACE_SELECTION_DIALOG=false

to:

SHOW_WORKSPACE_SELECTION_DIALOG=true

and the workspace selection dialog should appear again. This gives you the option to choose another workspace.

  • Categories

  • Recent Posts

  • Tags

  • Wave Notifications

    Download Adobe Wave now!

    This application requires Adobe® AIR™ to be installed for
    Mac OS or Windows.




Feeds