Mostrando postagens com marcador tools. Mostrar todas as postagens
Mostrando postagens com marcador tools. Mostrar todas as postagens

quarta-feira, 23 de junho de 2010

Let's calculate

Everyone knows that float point numbers are far from been precise. In fact they are as precise as any other number, the problem is that they work in a different base (2 instead of 10).

Let's take an example to illustrate that: the number 0.01, it is a quite simple and clear number in base 10 notation. Now let's add to it 0.09, which is the expected result? 0.1 right? Well doing it using floating point numbers we will get: 0.09999999999999999.

But why? We it is because altough 0.01 and 0.09 can be easily represented in a base 10 notation it doesn't have a real representation in the base 2 notation. It is something like 1/3 it is 0.3333334, the same with those number. What we have at the end is a periodic number, which is rounded to provided the expected number, but when we do a calculation this number cannot be rounded anymore.

Basic stuff, and I guess everyone faced it before, expecting the right result is the same of someone (yes it is a true story) that wants to divide the 100% by 3 and sum it back and expect to have 100%. Well it is not going to happen, 100% by 3 is 33,333333% and it sum back is 99,99999999%.

Sure that there is nice ways to work around this problem, in most of the languages. But all this introduction is to say about this ways, it is just to present a really nice calculation component/program that you can use in your Java programs: Frink.

"Frink is a practical calculating tool and programming language designed to make physical calculations simple, to help ensure that answers come out right, and to make a tool that's really useful in the real world. It tracks units of measure (feet, meters, kilograms, watts, etc.) through all calculations, allowing you to mix units of measure transparently, and helps you easily verify that your answers make sense. It also contains a large data file of physical quantities, freeing you from having to look them up, and freeing you to make effortless calculations without getting bogged down in the mechanics."
You can use it to calculation with the right precision your nice mathematical stuffs (no more error in 0.01 + 0.09), but you can do even more with that. You can virtually convert any unit to any unit.
The possible calculations goes from the normal phisical stuffs like, energy to temperature to crazy examples like how much time Superman should recharge his energies at the Sun to save Lois Lane and some kids, or even further how much weight Lois should loose to help Superman saving some kids (check the examples here).

Take a look at the main website, it worths and can be really helpfull for you, when you need to do some nice calculation in your application.

And finally for those that want to go further in floating point theory: What Every Computer Scientist Should Know About Floating-Point Arithmetic.


A good sidekick for this post is The Magic Numbers - Forever Lost.

Enjoy it ;-)

terça-feira, 30 de março de 2010

For those that like to post videos and presentations

Hi all! There is a new portal (at least for me) that you can post your presentations with the presentation itself.

Let's suppose that you participated of an event with a speech and want to put it online, so in the same time that you say you can sincronize your "wonderful" power point!

Check it out: Parleys.com

I will be waiting for your content there!

segunda-feira, 29 de março de 2010

New IDE concept. Finally something new!

Last Saturday I was having breakfast with IT posts and I found this really interesting post Code bubbles. Ide Revolution.

The post is an interview with the guy that is working on this IDE concept as a thesis. The interview is a little bit long so if you want to go directly to the point and see what it is about take a look in the video available in the project overview page, or for those unable to see the video here is the details page with some images and explanation.

Hope you enjoy it. New ideas for the new week!

sexta-feira, 26 de março de 2010

Jazz

Today I am going to move from the usual coding subjects to something more related to process. I guess that the Rational suite is well know for most of us, together with the Rational suite there is the Unified Process concept (in a creational point of view: first the man created the Unified Process, he looked and it was not that good, then he created the RUP and it was ok, but the desire for more make him create the Rational suite – and now he is ashamed for the rest of his life).

I am not here to discuss the quality of the Rational Suite (which I am not a fan) or the Unified Process (which I am sure is misunderstand process), but I want to bring to you a new initiative from IBM the Jazz.

According to the IBM Jazz website, this initiative could be define as: "…Jazz is an initiative to transform software delivery by making it more collaborative, productive and transparent, through integration of information and tasks across the phases of the software lifecycle".

Jazz is a set of concepts and, of course, a group of IBM products; you can think about those products as an evolution of some Rational products. But in this case I guess with some major differences (in the direction of the Sun): it has an open source architecture, which means that you can plug any external software to work with it (open ground to open source software) and it has a community portal. The portal has a lot of information, so you do not get stuck with some guru-guys saying what should be done and what not, no more high cost guys or information blockage. I am not saying that everything is for free, but the community can grow by itself.

A nice set of products, the community process is not new, but is always good to see people getting into it, mainly in the area of process where the community idea is not really easy to accept. But the most important part, in my humble point of view, is the move to some agile process. You absolutely do not see anything in the Jazz.net saying about Scrum, Agile, and so on, that is absolutely true – what is ok because it is just products and you can use it with the process that you like most.

If you watch the videos in the portal you will notice what I am talking about. For example this video: the Collaborative ALM Demo – The Jazz Revolution tells a nice story that has a happy end because of the Jazz. But is it true? I don't think so; I have counted 2 times the agile word, 2 times continuum integration and 14 times the Iteration word, plus N points in this iteration and so on. If it is not something similar to Scrum I don't know what it is.

The point here is: nice tools help but do not solve our problems and the same time that short iterations, real scope review, communication, real information that serves as input for the work, test cases and other stuffs that makes the big wheel turn helps much more.

In a more philosophical way of thinking: a beautiful ring (the tool) is still just a ring without a gentle hand (the process) to have it, and I can imagine much more uses for a gentle hand than to a ring.

terça-feira, 16 de fevereiro de 2010

Patterns of Deployment

Today I was looking at a Javalobby post, that highlight some deployment tools. Between those tools there is a interesting one called SmartFrog (java based and developt by HP, yes it is true, these guys still have some projects).

SmartFrog is a powerful and flexible Java-based software framework for configuring, deploying and managing distributed software systems.

Take a look if you want, but the main idea of this post is to invite you to see one of the SmartFrog wikipage: Patterns of Deployment.

In that page you will find nice patterns to deploy application, some address by SmartFrog, some not. But the main idea of this page is to show you the possible patterns and tools for that.

I am sure that you need to deploy your application and maybe creating the .WAR is not enough or that easy ;-)

sexta-feira, 5 de fevereiro de 2010

Graph Database

Graph database are not about images or graphs and things like that :-). They are simply a database organized as a Graph, you don't have tables, you just have nodes and relations.
Interesting concept that can be applied in some kind of structure that we could need to have work with.

Too conceptual? Well I suggest you to take a look at the project Neo4j project. It is a java project that implements a graph database.
Take a look, investigate the examples, I am sure that you will find where to apply it easily (at least you will know that there is another option to your good friend Relational Database).

sexta-feira, 28 de novembro de 2008

Dealing with record files

Have you ever worked with COBOL? Do you remember the DATA DIVISION?

Well in fact it doesn’t matter, probably if you work with Legacy code you will need to read or generate fixed size file, those files that the record is specified by the length, and probably you know how boring is to look at them and discover if the data is right or not.

Actually I am working with that kind of file and after some search in the internet I have found a interesting project: RecordEdit. There you can import a Cobol descriptor of the file and the program will be able to understand the file and split it to you.

Take a look, it is quite good and it saves a lot of time.

Just a advice: it is good to remember something from Cobol if you want to import some copycook, things like start at column 8 and end up at column 72 are still alive.