Today

Today it was a lazy day.

As usual I attended some meetings, worked on reports and negotiated dates for one of the projects I manage.

I have also checked some expenses from the department using a new report which I still don’t know if it is an improved version or a worsened version of the previous report. Mixed feelings…

I have also played for a while with my new toy: a Galaxy Note. Expensive in Brazil, but incredibly useful.

image

And here it was the sky I had all day long while working from home.

Creating an application for checking lottery numbers – Design, Modelling and Code creation

In Brazil we have a lottery that pays millions of reais / dollars twice a week.  This value is paid for the winner that got all 6 numbers (out of 60) correctly.  We can buy a ticket with the numbers we choose (or random numbers) for up to 8 draws, what means that we can win at any draw within the next 30 days or so.

But they also pay money if you got 4 or 5 numbers drawn.  It can be a tedious process to check if you got any number right, since there are 15 combinations for 4 numbers, 6 combinations for 5 numbers and a single combination for all the 6 numbers, with a total of 22 paying combinations.

In the first version of my code, I am checking all those 22 combinations automatically for a user that plays only 6 numbers (yes, we can play more numbers, up to 15, with increasing costs).  But how to be sure that this is done in an efficient manner?

I started with the process that I usually start any application:

  • What I want to be done?
  • What interfaces will I have to work with the user?  (e.g. command line, graphical interface, web interface, etc.)
  • What interfaces will I have to work with the data? (e.g. one single app accessing the data, more than one app, web app, external access, just internal access, etc.)
  • Where do I want things done? (e.g. and the frontend code, at backend code, at database, in the server, etc.)
  • etc.

This makes me think and define some simple rules that will be the foundations of my API and that will guide my code.

Most of the time, I do not have answers to all those questions and need to play on the safe side.  The usual answers — and something I have to be very careful with since it is already a bias — are:

  • <something>
  • Web Interface
  • A web app that might have external parties consuming the informaiton from it
  • Database, browser, backend — in that order.

With that in mind, I started the development of the database based on the data that the lottery provides and that I thought would be useful for some statistical analysis.

This would be analyzing the customer’s requirements (myself, in this case) and modelling the database to be able to represent that information in a manner that will be able to answer the basic questions from the customer.

The second step would be analyzing indices and other database specific questions that will allow me to deal with the volume of data, the type of queries that will be performed, the number of concurrent accesses, the type of concurrent queries, etc.  It is the work of a DBA to plan that.

The third step is creating the code.  The first question is: where?

As I wanted to try it out fast, and the situation is not all that complicated, I could code it inside the database itself (PostgreSQL allows me to code very complex things inside of it, in many different programming languages, so this is one of the reasons why I must be careful to not have everything inside the database itself).  The next question becomes: in which language?

The fastest language is plain SQL, then plpgsql, and then plpython (that is Python embedded on the database). My first thought, out of convenience was Python.  Then, I do not needed a full set of it to justify requiring plpython to run a simple query, so I moved to plpgsql.  But, this meant that I was not generating the combinations dynamically, so why not trying to go to plain SQL?  And that is what I ended up doing.

The following code helped me to get all possible combinations for 4 and 5 numbers out of 6 possible numbers:

>>> a=itertools.combinations([1, 2, 3, 4, 5, 6], 4)
>>> for x in a:
...    print x
...

and

>>> a=itertools.combinations([1, 2, 3, 4, 5, 6], 5)
>>> for x in a:
...    print x
...

This I copied onto my SQL code, applied some magic text replacement commands and ended up with my SQL function in PostgreSQL:

CREATE OR REPLACE FUNCTION f_v_is_possible_result(
       i_dezena1 INTEGER,
       i_dezena2 INTEGER,
       i_dezena3 INTEGER,
       i_dezena4 INTEGER,
       i_dezena5 INTEGER,
       i_dezena6 INTEGER)
       RETURNS SETOF INTEGER
AS $_$
SELECT contest_number
       FROM megasena
       WHERE
-- Checking four numbers
        ARRAY[$1, $2, $3, $4] <@ ARRAY[dezena1, dezena2, dezena3, dezena4, dezena5, dezena6] OR
        ARRAY[$1, $2, $3, $5] <@ ARRAY[dezena1, dezena2, dezena3, dezena4, dezena5, dezena6] OR
        ARRAY[$1, $2, $3, $6] <@ ARRAY[dezena1, dezena2, dezena3, dezena4, dezena5, dezena6] OR
        ARRAY[$1, $2, $4, $5] <@ ARRAY[dezena1, dezena2, dezena3, dezena4, dezena5, dezena6] OR
        ARRAY[$1, $2, $4, $6] <@ ARRAY[dezena1, dezena2, dezena3, dezena4, dezena5, dezena6] OR
        ARRAY[$1, $2, $5, $6] <@ ARRAY[dezena1, dezena2, dezena3, dezena4, dezena5, dezena6] OR
        ARRAY[$1, $3, $4, $5] <@ ARRAY[dezena1, dezena2, dezena3, dezena4, dezena5, dezena6] OR
        ARRAY[$1, $3, $4, $6] <@ ARRAY[dezena1, dezena2, dezena3, dezena4, dezena5, dezena6] OR
        ARRAY[$1, $3, $5, $6] <@ ARRAY[dezena1, dezena2, dezena3, dezena4, dezena5, dezena6] OR
        ARRAY[$1, $4, $5, $6] <@ ARRAY[dezena1, dezena2, dezena3, dezena4, dezena5, dezena6] OR
        ARRAY[$2, $3, $4, $5] <@ ARRAY[dezena1, dezena2, dezena3, dezena4, dezena5, dezena6] OR
        ARRAY[$2, $3, $4, $6] <@ ARRAY[dezena1, dezena2, dezena3, dezena4, dezena5, dezena6] OR
        ARRAY[$2, $3, $5, $6] <@ ARRAY[dezena1, dezena2, dezena3, dezena4, dezena5, dezena6] OR
        ARRAY[$2, $4, $5, $6] <@ ARRAY[dezena1, dezena2, dezena3, dezena4, dezena5, dezena6] OR
        ARRAY[$3, $4, $5, $6] <@ ARRAY[dezena1, dezena2, dezena3, dezena4, dezena5, dezena6] OR
-- Checking five numbers
        ARRAY[$1, $2, $3, $4, $5] <@ ARRAY[dezena1, dezena2, dezena3, dezena4, dezena5, dezena6] OR
        ARRAY[$1, $2, $3, $4, $6] <@ ARRAY[dezena1, dezena2, dezena3, dezena4, dezena5, dezena6] OR
        ARRAY[$1, $2, $3, $5, $6] <@ ARRAY[dezena1, dezena2, dezena3, dezena4, dezena5, dezena6] OR
        ARRAY[$1, $2, $4, $5, $6] <@ ARRAY[dezena1, dezena2, dezena3, dezena4, dezena5, dezena6] OR
        ARRAY[$1, $3, $4, $5, $6] <@ ARRAY[dezena1, dezena2, dezena3, dezena4, dezena5, dezena6] OR
        ARRAY[$2, $3, $4, $5, $6] <@ ARRAY[dezena1, dezena2, dezena3, dezena4, dezena5, dezena6] OR
-- Checking six numbers
        ARRAY[$1, $2, $3, $4, $5, $6] <@ ARRAY[dezena1, dezena2, dezena3, dezena4, dezena5, dezena6]
       ORDER BY contest_number;
$_$ LANGUAGE SQL;

In this particular case, I exploited some advantages from PostgreSQL and worked with array comparisons to check any of the possible combinations, since the number of conditions was small.  If I had been working with all 15 numbers that one can play, then I would have to dynamically generate that in the code.

The “<@” operator working with arrays means “is contained in”, so I check that the combinations from the left side are contained in the array of drawn numbers.  “dezena1” to “dezena6” are the drawn numbers — their column names, actually –, already ordered in ascending order (even though with arrays on PostgreSQL this ordering does not matter, the only requirement is that all elements from the left side are available on the right side to be a successful match).

This approach, as I mentioned before, would not work with all the 15 numbers since there are 1365 combinations for 4 numbers out of 15, 3003 combinations for 5 numbers out of 15 and 5005 combinations for 6 numbers out of 15, adding up to 9373 possible combinations.  Even with magic text replacement, this would mean a lot of work and a huge code for a SQL function.  Not the best idea at all…  In this case, I would go with a Python function.

With that being done, now I can move on to the next step: the web interface building.

As with the latest applications, I will be using ExtJS and grids.  The numbers from my bet will be the filters and this function above will help me limiting the number of lines I will be showing on the grid.

Around version 2 or 3, I will be changing it to allow up to 15 numbers to be played, with a minimum of 6 numbers.  But, then, it is another project, with another design phase, decision making, etc.  I will try remembering to post about it here when that time comes (and if I get there, since I never play more than 6 numbers anyway…).

Why this post?  Because the process is the same for every application and because this is a somewhat common problem.  Using arrays and their special operators shows up as an elegant solution to a problem.

Happy hacking and wish me luck with my bets. 🙂

 

UPDATE1:. I won a lesser prize.  Found out with the above code. About US$ 300, last week.

UPDATE2:. After a series of interactions with a colleague, I changed the above code to the one below:

CREATE OR REPLACE FUNCTION f_v_is_possible_result(
       i_dezena1 INTEGER,
       i_dezena2 INTEGER,
       i_dezena3 INTEGER,
       i_dezena4 INTEGER,
       i_dezena5 INTEGER,
       i_dezena6 INTEGER,
       i_matches INTEGER = 4,
       OUT contest_number INTEGER,
       OUT numbers INTEGER[],
       OUT quantity INTEGER)
       RETURNS SETOF RECORD
AS $_$
WITH numbers AS (SELECT contest_number, ARRAY_INTERSECT (ARRAY[$1, $2, $3, $4, $5, $6],
                                                   ARRAY[dezena1, dezena2, dezena3, dezena4, dezena5, dezena6]) AS intersect
                 FROM megasena 
                 ORDER BY contest_number)
     SELECT numbers.contest_number,
            numbers.intersect AS numbers,
            ARRAY_LENGTH(numbers.intersect, 1) AS quantity
     FROM numbers
     WHERE ARRAY_LENGTH(numbers.intersect, 1) >= $7;
$_$ STABLE LANGUAGE SQL;

The “WITH” clause will allow me to process the information more than once while preventing the query from being repeated at every time I use it.

The “i_matches” parameter allow me to show cases where there was no prize won or filter out specific types of prizes (4, 5 or 6 numbers matching).

The new code also shows me which numbers matched.  Here’s the new output:

megasena=# select * FROM f_v_is_possible_result(03, 11, 20, 49, 51, 59);
 contest_number |   numbers    | quantity 
----------------+--------------+------------
           1335 | {3,20,51,49} |          4
(1 row)

megasena=# select * FROM f_v_is_possible_result(03, 11, 20, 49, 51, 59, 3);
 contest_number |   numbers    | quantity 
----------------+--------------+------------
             56 | {20,51,59}   |          3
            217 | {3,51,49}    |          3
            296 | {3,20,51}    |          3
            548 | {51,49,59}   |          3
            658 | {11,3,20}    |          3
            857 | {3,49,59}    |          3
           1034 | {3,20,49}    |          3
           1035 | {11,51,59}   |          3
           1057 | {3,49,59}    |          3
           1192 | {20,49,59}   |          3
           1247 | {11,3,51}    |          3
           1335 | {3,20,51,49} |          4
(12 rows)

megasena=#

My prize was on contest number 1335.

Stakeholders Influence

When categorizing the stakeholders one thing that we have to do is write down the type of influence they have on the project: positive or negative.

But what to do when we don’t know what is it? What if we are tempted to say it is “neutral”, in the sense of “this stakeholder doesn’t care if the project is successful as well as if it is unsuccessful”?

Discussing this today, with a fellow PMP at work, I got to some conclusions / decisions.

The first one, and the most obvious one, is that there is no rule on what types of classifications we can have. As with most things, the Project Manager is free to customize the project as needed. So, adding a “neutral” influence is perfectly possible.

The second conclusion is that there is no “neutral” stakeholder. There is always a small tendency on being pro or against the project. What can be done, then, is adding the “neutral” influence type and using it as a marker for reviewing this classification as soon as a better judgment of the stakeholder’s influence type is known.

The third thing is that not knowing the correct classification is a project risk. That stakeholder can be working against the project and a misclassification of him / her can lead to ignoring key factors as well as loosing opportunities to neutralize / mitigate the bad influence from the stakeholder.

The correct classification and identification of stakeholders is one of the factors that can help with project management and lead to the success of the project.

Project Management Certification

It is being a tough week since I have started studying to get my PMP – Project Management Professional – certification.

A lot of reading, studying, training, etc. going on. I am thankful that the company I work for has access to all the resources I need to study and also has many certified professionals that I can refer to and that have reviewed some documents and training courses I am using.

I have laid out a plan with some colleagues and we are doing weekly meetings that take from 1h to 1h30 to discuss what we have learned from the week’s targets.

Since we’re on the first week, our target was taking two training courses and reading the first two chapters of the PMBOK (Project Management Body of Knowledge).

I am taking notes and using a mindmapper software to map my learnings. So, I expect to have a lot of things written here in the next months all related to my studies.

And, of course, since these are a personal effort, I still have all my usual activities going on at work.

There are some changes and I will move from full responsibility on Communications Systems and Services to Enterprise Technologies, on the platforms area, assuming the global leadership for IBM’s System I (former iSeries) platform.

It will be an interesting challenge since I don’t know anything about this technology and it will then become my first managerial experience where I don’t fully understand the technology I am managing.

I will have to rely a lot on our technical specialists, self study and documentation on the technology and processes related to it.

I also have to work on globalizing this service and keep the globalization of one of my former projects going on. I was – and I still am – responsible for laying out the foundations for it to happen and now it will be my responsibility to keep it moving, even if I am not managing the teams that work with that technology anymore.

VERY interesting challenges coming up and, of course, I will keep some news about how I am dealing with them here.

Stay tuned and enjoy 🙂

And, if you want to share some information on any of the topics I am writing about, feel free to do so.

Updates, News and New Implementations

Even though I have been quiet for a while, things are a lot busy.

I have been spending a lot of time on preparing myself to get a PMI certication and become a PMP. I had classes with the PMBOK while at College, I participated on several training courses after that, I have read many books… and even then, I don’t feel ready to apply for the certification.

It is part of my daily tasks, but what makes me believe I am not ready are the subtleties of things and some of the questions I remember from College, when studying that and thinking about applying for the certification.

On the IT field, I have been playing more with org-mode and I am almost ready with making it “talk” to my Google Calendar. Here are some hints for that:

http://emacsworld.blogspot.com/2011/05/integrating-emacs-org-mode-and-google.html

http://thread.gmane.org/gmane.emacs.help/80824

http://code.google.com/p/googlecl/

And, I am also happy with finally being able to enable the transparent background on Emacs. I have added this code to my .emacs (actually, I use org-mode to manage it as well, so the process was a bit different, but the idea is the same):

(defun djcb-opacity-modify (&optional dec)
  "modify the transparency of the emacs frame; if DEC is t, decrease the transparency, otherwise increase it in 1%-steps"
  (let* ((alpha-or-nil (frame-parameter nil 'alpha)) ; nil before setting           (oldalpha (if alpha-or-nil alpha-or-nil 100))
          (newalpha (if dec (- oldalpha 1) (+ oldalpha 1))))
    (when (and (>= newalpha frame-alpha-lower-limit) (<= newalpha 100))
      (modify-frame-parameters nil (list (cons 'alpha newalpha))))))

 ;; C-8 will increase opacity (== decrease transparency)  ;; C-9 will decrease opacity (== increase transparency  ;; C-0 will returns the state to normal (global-set-key (kbd "C-8") '(lambda()(interactive)(djcb-opacity-modify)))
(global-set-key (kbd "C-9") '(lambda()(interactive)(djcb-opacity-modify t)))
(global-set-key (kbd "C-0") '(lambda()(interactive)
                               (modify-frame-parameters nil `((alpha . 100)))))

The source for that is available at http://emacs-fu.blogspot.com/2009/02/transparent-emacs.html

The original code had the steps move in steps of 10%. I have changed the code a little to make it move in 1% steps.

And, finally, this weekend it was Valentine’s Day here in Brazil. It was really cold – with some ice on the glass ceiling from my neighbor – what contributed a lot to the romance and for my wife and I spending the time together.

Every time I am able to spend some time like this, I stop and think about how many times I am doing that and if it is not something that I need to improve. It is hard to manage all the work tasks, studies, and still get some free time to spend without worrying, but I am sure that my Number One priority should be my family.

I think that these updates were not enough for the time I didn’t post, but I am trying. This blog already has more – relevant – posts than anything I was able to keep before (maybe Multiply had more posts, but it was a different time in my life).

Using matplotlib / pylab without a DISPLAY

I’ve been having issues with a web system I coded for a while now and couldn’t find a solution that worked to my satisfaction to eliminate the need of a Xvnc running to provide a virtual DISPLAY to run some commands to plot data using pylab.

Finally, today, I found the solution here and I want to share it.

import matplotlib
matplotlib.use('Agg') # Must be before importing matplotlib.pyplot or pylab!
import matplotlib.pyplot as plt

fig = plt.figure()
plt.plot(range(10))
fig.savefig('temp.png')

The solution, here, is the Agg option as the “device” to be used to plot files.

Solution in place, and I can now eliminate the requirement for Xvnc from my code and all the issues that came with it are also automatically gone.

So, here’s the code for Pylab:

import matplotlib
matplotlib.use('Agg') # Must be before importing matplotlib.pyplot or pylab!
import pylab

pylab.plot(range(10))
pylab.savefig('temp.png')

Enjoy!

Customizing your Emacs Colors

The best thing besides using the best text editor – that is really the one you adapts better, in my case it is Emacs – is being able to make it look like how you want it to look.

The first step is always customizing colors in a manner that doesn’t get you tired after some hours of work as well as in a manner that integrates it with your desktop environment.

Here are two suggestions of websites where you can take a look at different profiles and customize colors in Emacs:

GNU Emacs Color Theme Test – Perl

Emacs color-theme creator

The second link – color-theme creator – is the best one to create unique themes.

Implementing and Monitoring

Most of us, people from IT, forget about the post-implementation process.

It isn’t just supporting the application, but providing means to monitor the system health.

Lets say you deploy a web system and for that you have to install the webserver, the database server and your own code. You guarantee that your system will work based on several tests you have coded and perharps some techniques to restart the application in case it fails or reach some limits. But what about when your application stops because of the web server? Or the database server?

If the customer has a team to support them, it is understandable that it is this team’s responsibility to install, monitor and keep the infrastructure needed by your software. If they don’t, a failure on any of those components is a failure on the functionality you provided them.

You can make agreements, draw the component structure, etc. but when things fail, it is your software that has become unusable to them.

Other than that, as time passes, disks fill up, hardware starts showing issues (some of them are SMART – hint! – enough to provide you with alerts) and that dedicated server to a single task is not “so dedicated” anymore (again, if you manage the infrastructure you can have some control over it, otherwise their IT will have to take care of what goes where for them).

One great thing that can be done – and should be done – is documenting certain thresholds on your system and providing alerting and monitoring tools to the customer. Put that in written form and say that when certain threshold is reached they should take some corrective or preventative actions (automate it if you can!) and for other components you can show them that new hardware is needed.

We are so focused and worried with delivering things that we forget about keeping it running.

Putting things on the cloud helps reducing some of your concerns, but shouldn’t be an excuse for not monitoring and reporting things.

A last reason to monitor: know your system requirements. Do you know how much memory your system requires with 10 simultaneous users? With 50? What about 1000? What is the required hardware to recommend your customer to upgrade to?

Monitor. Report. Follow on.

Getting back to exercises

Yesterday I weighted myself again. I lost 2 kg since I went to the doctor, almost 3 weeks ago.

I thought I still had the same weight and that the plateau effect was still in place.

Seeing that I was wrong, I felt motivated to resume exercising every day, so today I gave goodbye to candies and white bread and went back to my 40 minutes exercise on the elliptical machine.

I simply feel great!

Target is loosing 12 kg in the next 5 months. Not that hard, not easy as well (in the past I had a second plateau effect close to 105 kg). I like to think of it as a SMART goal.

S pecific

M easurable

A chievable

R elevant

T imely

I will blog more about it here in the future.

In the kitchen

Today it was day to make some salmon for dinner.

https://i0.wp.com/boaforma.abril.com.br/imagens/mt/papillote-salmao.jpg

It is extremely easy to make and delicious to eat.

Of course, as a coffee lover, I couldn’t end without making some espresso. 🙂

I still think it is one of the best acquisitions I made here at home… My next step with regards to coffee is buying a grinder. 🙂

The recipe

Ingredients

  • 2 x 300g of Salmon
  • Garlic (the original recipe had it mashed, but I prefer it sliced)
  • Half an onion (a medium onion)
  • Juice of 1/2 a lemon
  • Salt
  • Olive oil
  • 1 tea spoon of Light Shoyu
  • Tomato (again, the original recipe had 8 of those small cherry tomatoes, since I had much more salmon to make – about 1.5 kg — and I had none of those small tomatoes, I used two standard tomatoes here)
  • Parsley

Cooking it

I marinated the salmon with the lemon juice, the shoyu sauce, some salt and the garlic slices for about 15 minutes (now, I would let it rest a bit longer, maybe about 30 minutes…).

After that, I used some aluminum foil and put the salmon filets side by side, covered them with onions, tomatoes, parsley and some olive oil.

Then, I put everything in the oven for about 40 minutes at 200°C.

After that comes the hardest part: eating it all 🙂

Enjoy!

Barbecue and Birthday Party

Yesterday we had my wife’s birthday party. It was really funny!

At the beginning she wanted a party… Then last week she started saying that she didn’t want a party. And then I told her that I had already invited a lot of people. 🙂

In the end, she was eager for the party. Loved it. And the house was full for several hours.

We got really tired after the preparation, party and clean up of the house, but it was really worth it. We’d do it all over again. 🙂

Her birthday will be next week, but since another colleague of hours will have his birthday on the next weekend, we decided to push her party forward and do it yesterday.

I can barely wait for mine. 😉 (And I didn’t use to like those kind of things…)

Some small home fixes today

Today I took some time – about two hours – to finish some things I had started – read: promessed to do to my wife.

I put some supports on the wall to hang flowers. With that, we’re putting our small garden on the wall. There will be some more spice to put there.

It was not hard to do, but not so simple either. The hardest part was making sure everything was leveled off. Since the ground can’t be used as a reference, I had to find flat and hard surfaces to put over the supports and then use the bubble level over it to align both supports.

When everything was OK, I started with the drill. After some work, we have three planters available, two of them with spices in it and a third bigger one available for some more spices we’ve been wanting to have at home.

I’ve also moved a flower hanger from one wall to another, where the flower will suffer less with the wind and the rain.

So, it was a busy morning. And I still have the whole afternoon for other improvements.

All this, of course, because there’s not much we can do while the people are still here installing the handrail. It is the third day of work to them and they are finishing up the painting where they connected the handrail parts together.

Serendipity

Just a quick note on something I found out by accident (see Serendipity at Wikipedia):

  • if I don’t change the date of the draft that I started writing with org2blog, then the publishing date becomes that of the draft

It is interesting that I can change the date of the publication by simply changing something on my own copy of the post. And it is more interesting that this change reflects on the archives and publishing dates that are visible on the main page of the website.

Numbers, precision and PostgreSQL

It is interesting how numbers can create problems while developing systems.

While we can’t write one third (1/3) in decimal without resorting to infinite representation of the number through periodic repetitions (I don’t know if the term “periodic number” is correct in English) there is the same issue with other base systems, for example, it is impossible to write one tenth (0.1 or 1/10) in binary without periodic numbers.

A second issue is not the numeric conversion itself, but the manner in which this number will be stored at the database server. There are different standards that try to solve the conversion issue (BCD representation, for example) but even then, people (mainly developers and DBAs) need to be aware of them and what are the implications on their usage.

Other problems happen when making comparisons. Due to the innacuracy of the float type and the hardware where the software is run, assuming that you can get x = 0.05 to work all the time is something problematic (specially when 0.05 becomes 0.0500000001…). The recommended approach, then, is using intervals, so instead of x = 0.05 we would write the equivalent to 0.4999 < x < 0.5001 (or any other variant that takes into account the precision you can get on your numeric system and platform(s)).

Do you want a whole new beast to fight with? Name it rounding. Yes. It might appear to be a simple operation, but then ask for someone on the Maths field to round some numbers and ask the same for someone in the Physics field. You will get different results. And different explanation for the processes. (And if you start including error coefficients, error propagation, etc. then this beast will really become a nightmare…)

Back to my small tiny world (with not so many beasts to fight…), the reason that led me to write about this was some discussion on numbers, their representation on screen and their storage on database systems. It is amazing how a lot of developers lack some formality on their understanding of what they do. It is like they are only code replicators or writers. There is, of course, a vast number of them that understand what they do, but I feel that the majority don’t know what they are doing. Specially with more high level languages.

On the database side, PostgreSQL’s numeric types is a manual page that is largely ignored (forgotten?) by its users. It is nice that it also brings up attention and some awareness about the numeric issues and their representation /storage on systems.

I have submitted a comment on that page asking for more clarification on how to calculate NUMERIC and DECIMAL storage requirements… The current information is just:

The actual storage requirement is two bytes for each group of four
decimal digits, plus five to eight bytes overhead.

Which is helpful, but could be improved. Maybe some examples could make it a lot clearer.

Changing Linux Distribution

I am not sure – yet – if it will be a permanent change or if it will be a temporary one.

From one site there is the corporate look of OpenSuSE and KDE. From the other side there is the more modern desktop that I can get with Ubuntu and (argh – yet 😉 ) Gnome.

I am always trying to find better ways to have information available on my desktop, to improve my workflow, to get more from my tools without having the system cluttering my view.

With that, I have always been a fan of the summary information available on Macs on the top bar, while keeping more intrusive information on the bottom bar.

But, at the same time, I have always been concerned with the waste of space that two bars led to in KDE.

So, this week, I downloaded Ubuntu and yesterday I spent the day installing it.

The installation itself was very very easy. Finding the new work method is what is taking me some more time, but I have already restablished my environment. (Of course, most of it remained intact since I kept my home directory from the previous install and I just replaced the system mount points.)

As with every unplanned change I forgot to backup some things – but this will lead to another post in the future, since it relates to software development and the move from development to production as well as the build up of a migration path for that to happen – and had to review my notes on how to rebuild that.

After a few hours with setting up everything and working on customization, I found that it was like I wanted. Then, it was time to pay attention to the gadgets and other – ahem – productivity tools.

So, after all, the hugest difference to me has been the package management system. All the rest is almost the same – and I have a new look on my desktop.

Changing a small thing

In the past, I used to use “just” plain CSS to build the layout and design of some web pages.

Then, I changed my process to use plain CSS but make it go through a process of minimization, to reduce the file size and speed up the loading times.

After some time, I changed again to use SASS (SCSS, actually) on my projects, but I kept the old change / process (compile) / minimize / publish process.

As the time passed – and I got bored with so many steps –, I started using the --watch option from the sass command line. Change and compile now became a single step, but I still had to go through the minimization and publishing phases.

The other day, I found a new option – was it there all the time? I don’t remember and I’m too lazy to go and check changelogs… – that allowed me to ditch another step (the minimization step) as SASS itself could do it for me, with results comparable to what I was getting with my own minimization process.

Now, the command I’m using is:

sass --scss -t compressed --watch .

Running this at the base directory of my CSS stylesheets makes SASS watch for changed files (SCSS files), process them into CSS files but also making those CSS files be in compressed format.

The resulting file isn’t human legible – not easily, I mean, it is text after all – but why working on a derived process when you can work on the original SCSS file?

Also, in case I need to check SASS’ output, I can remove the -t compressed option and have the default output that is very clear and easy to read.

If you are still writing CSS files by hand, please stop for some minutes, download and install SASS and play with it. You will see how much freedom you will get in the future, specially when you need to change one or two parameters through the whole file (I make all of those variables).

After some time, updates!

I’ve been doing a lot of things lately.

After my annual leave was over, I got back to work and had to deal with the huge backlog. It doesn’t matter if another person works on keeping your things up to date, you still have to go there and review items that need some follow up, take notes of processes that changed, etc.

I have also been working on developing some global strategies for my projects. This takes a huge effort and a lot of time.

At home, I have been playing with Emacs, Python, ExtJS and of course reading email and news.

I have found a very interesting article on Emacs keybinds. It is worth reading it. If not for the knowledge, at least for the templates.

I still have to “play” with Protovis. It looks like a great library for charts on the web.

I also had issues – again – with some magazine subscription that I wanted cancelled after they billed my credit card on an automatic renewal. I got reimbursed and they lost a customer that is now telling everybody how they didn’t stick to our agreement of not having the subscription automatically renewed.

I had my performance evaluation last week. Lots of things to think about, other things to keep tracking. Overall, a good thing.

Looking for new challenges as well…

As you can see, there are too many things going on.

And I still want to find some time to go back playing with electronics and microcontrollers, after all, I’m an engineer. 🙂