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).

Advertisements

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. 🙂

Ext.extend and Conquer

Today it was a very productive day.

I’ve redesigned several problematic screens of an application into more functional versions, working much faster, providing more information to the end user and – the best thing – with a very consistent appearance on their layout.

ExtJS provides some nice features to standardize its components by extending its standard classes.

The simplest way to do that is like what I show on the code snippet below. It simply provides some default values – that can be easily overriden when the custom component is instantiated – that help with the implementation of sets of components.

var myCustomCombo = new Ext.extend(
    Ext.form.ComboBox,
    {
        width: 180,
        mode: "local", // I load the data manually from the store.
        triggerAction: "all",
        emptyText: 'Choose an option...',
        autoSelect: false,
      editable: false
    }
);
Ext.reg('mycustomcombo', myCustomCombo);

I did custom implementations of panels, forms, combo boxes and grids. With that, I make only slightly variations from one case to the other – imagine addresses, where you have several different components from the country up to the zip code for a street, avenue, square, etc.

The new layout also made it possible to eliminate different pages and consolidate all the information on a single page where all records could be browsed, edited, removed or new records could be added to the database.

On the backend – my TurboGears application – my code also shrunk considerably as I didn’t have to make some convoluted queries to get the information. All modules were better decoupled and obtaining the information using AJAX – or better AJAJ since I don’t use XML but use JSON – much easier through a cleaner interface.

Summing up: it was a complete redesign of a whole module in a day. Some hundreds of lines of code eliminated and functionality added to the system.

I hope that tomorrow the day becomes as productive as today.

Visualizing your LinkedIn network

It is interesting how visual we might become. It is not uncommon to be able to abstract some information and create a visual image on our minds, but it is always easier to have some tool to autogenerate that image for us.

Our brains have a huge abstraction capability, but sometimes there are so many relations and details that we need some help.

Here’s how my network turned out today.

https://crazythinking.files.wordpress.com/2011/01/wpid-linkedin-inmaps.gif

Create yours here.

An AJAX option to remember

I always forget how useful is the “$(<selector>).load(‘url’, {para: meter});” function on jQuery.

It is really a problem solver when loading HTML structures.  I am converting some old code where I got HTML fragments to replace some existing content on the page and using the usual process, I’d have to do the AJAX query, call a callback procedure and then there I’d replace the contents of the section / div / whatever I wanted.

With jQuery.load I can do that on a single call and in a more effective way.

Silly thing and so simple that I always keep forgetting about it.

On what to do prior to contact another company’s tech support

I work for a company that does off shore for other companies from the same group.  There are two types of activities that are done worldwide (100+ countries): internal support and support to external business partners (mostly clients, some suppliers, etc.).

As I work with networks and data transmission, and I lead a team that interfaces with external business partners almost 100% of the time, it is common to get some support requests for problems that really aren’t our problems.

It is something that is annoying because when there is a problem — specially in production environment — we need to stop working on everything else and solve that.  Out of those, 99.999% of the times the problem isn’t on our end: we work with thousands of business partners and have the structure in place to work with them: servers, network, firewalls, etc.  Everything is working fine, debugged and stable — there are some destabilizing changes from time to time, of course, but those are rare and very well tested.  Then, there comes the question from the external business partner: “We can’t connect to your server.  What did you change?  We need to submit that data today!”

Last time this happened, I had a meeting with an Indian company from 1:30 AM to 3 AM here…  And what was the issue?  They could manually submit data, but their automation couldn’t.

Anyone that can solve a hard problem — such as adding 2+2 — can see that there is something wrong with that and that something is probably at their end…  But no, this didn’t happen.  So, we scheduled a meeting and after one hour asking questions and asking about changes, they said that they changed the server: manual process (working) was from one host, automated process from another.  When asked to manually test from the new host, it didn’t work as well.  The problem?  They changed from one server to another and didn’t update their own firewall policies…  And then, it is our fault… 🙂

Second time there even was a paging sent to our team: data corrupted.  Oh well, the customer had to fix it and not us as we don’t change data in any way.  Even within our own company, business first assumes it is our fault and then we have to insist to have them go to the customer.

Now, back to the subject:

  1. Make a change procedure, schedule times, analyze impact, etc.
  2. Keep a backup of all of your changes.  Never demise the server after the change, you might need something from it back or reverting back to the old server in case something goes wrong
  3. Check everything that has to be changed (servers, configurations, user profiles, firewalls, IP addresses, etc.)
  4. Have a “recent changes” log and don’t assume that one change is irrelevant, specially when talking to other companies trying to solve a problem
  5. Check your company first: go to your IT team or contractor, ask what has been changed, why it worked before and what is exactly the problem you’re having
  6. If it is a connectivity problem, check that you can connect to other sites that provide a similar service / interface, check that you can get out of your network to the Internet from the same host that will be used and that is presenting the failure
  7. Supply the support team a traceroute / tracert output from the failing host to their server

Give the support team from both companies enough information to solve your problem.  Guessing is too time consuming, error prone and isn’t something specialists like doing without enough information to discard the most obvious problems first.

“Help us to help you”, I always say (no, I didn’t create this expression, but I really enjoyed it!).

Changes @ Work

Lots of things happening lately.

Several big projects that required a lot of attention, a new team has been assigned to me — so now I’m leading my old team and the new one — and I have a third team to put together…

Besides all that, there’s the marriage that is closer: April 18th, 2009.  🙂

I hope to be able to post more, though…