Aug 252011
 

What is finesse?

  • Finesse is all about getting the things fine.
  • It is about making a very discrete and canny move to do what you intend.
  • It is about making accurate decision based on little facts.
  • It is about making enough with just one step.
  • It is about getting a sharp move in a very hard situation.
  • It is about avoiding damage when hit.
  • It is about saving your own time. Your days in this world are limited.
  • It is about a lot of things.

But basically it is doing just ENOUGH to do what is needed. Not a step further, not a second later and not a watt power more than needed.

A guest in Darren Rowse’s Pro blog put a very cute explanation on what “enough” is. Do you know what boiling water is? It is boiling water. It can’t boil more. And if it is not boiling – than it is not boiling water.

So …

How to obtain finesse?

  • Sport. Cat’s grace. It is what finesse is! Sell your car and buy a bike. Exit the subway 1 station before your work and walk. WALK! Even if you are a bit overweight, soon you will start moving like a graceful big cat.
  • Try to learn something new every day. Finesse is not just moving smooth. It’s also being sharp.
  • Read an interesting book. Every morning. In the toilet. One page is enough.
  • Shower. Trim. Shave. Body smell is not finesse, neither is excess hair.
  • Sell your TV. You don’t need a pre-made stream of information. Everything you need and love in a TV is uploaded in the network. The only thing that a TV has more … is a waste of time. You don’t need to be told, when you can choose.
  • Cook your own food. Make yourself a rule, to eat no less than 300 and no more than 500 grams of food. If it is not enough – eat not 3 but 6 meals per day.
  • Abandon all sorts of beer. If you are alcohol junkie (like me) – drink wine. One-two glasses with the dinner will make you content without giving you huge belly. Bellies and finesse do not cope well together.
  • Get a dishwasher! You are NOT a house wife! It takes 20 minutes to wash your dinner plate and all utensils. Dishwasher costs around $300-$500 and will serve you for years. $18-$36 per week. Your time is more important and more expensive. (Ask your boss what do you cost him per hour if you don’t believe me.)
  • Stop being clumsy. Be aware of your surroundings. Have a look at Discovery and NatGeo films about big cats. They are aware of everything. They don’t make noise and don’t break stuff while they move. Adapt! Or you may lose something important.
  • Always use shortcuts. Why do you think they are created in the first place? They conserve time and energy. Not just pressing Ctrl+c and Ctrl+v instead of using mouse. Use all shortcuts that life provides.
  • Always bulk buy and never buy anything that you will not use at least to 70%. Mere possession is mental sickness. If you don’t need it – don’t buy it. If you know you will eat 10 steaks and drink 3 bottles of wine this week – go and get them @ weekend and put them in the fridge. Don’t go every evening. It’s pointless.

What to do with this excess 1 hour every day you just won?

  • Invest it in yourself. It’s your own time.
  • Go dance with your GF/BF.
  • Ride a bike. Feel free.
  • Walk in the park. Meet new people.
  • Embrace yourself. If you don’t like yourself, no one will.
 Posted by at 11:41 am
Aug 232011
 

It is one of the problems some network programmers meet while coding. While debugging executable files You may have noticed that, when seen in hexadecimal editor, some data in the files is ordered backwards. First you see the 1 and then several zeroes. But you know for sure, that the value you encoded for a constant is actually “1” instead of 01 00 00 00.This is what Little endian byte order actually is.Have a look in the decimal value 305,419,896 in HEX. It is 0x12345678. If your machine is Big endian, you will see this value stored in a binary file looking the same way it is. But if your machine is little endian, The value stored in the file will look like 78 56 34 12. The least significant byte will be in front, and the most significant will be in back.

The reason for this goes back in the computer’s past, when it was more important to make MATH really fast in spite of easiness. Imagine you have 1 physical address. This address has the value 01 00 00 00. If you need to read this address as byte, word or long integer. You will ALWAYS get the value 1, which is the real value. If you are using Big endian byte order, you will need to get the address + 4 if you need byte, address + 2 if you need word. The little endian byte order is still used in network equipment and serial interface dialog, so it’s good to know how to cope with it… or you will get really annoyed 😉

Also, there is the need for speed. If your processor has only 3 real registers (X, Y and Accumulator), than it’s easier to compute the values if they are little endian.

This is of course an ideal case of what is now known as 64 bit processor. One that can use 64 bit words and registers. In case you are using Big endian byte order you cannot use the multiplication but integer division, which is slower.

If you are Linux user but unsure what endianness your equipment uses, execute this:

If you want this byte order reversed and shown using simple math, use this Perl script:

This is just a rough example. There is easier way to make and explain it. Get the input value, the least significant byte can be obtained by getting the “modulo” of integer division from the input value, store this modulo in an array. After this subtract the modulo from this input value and divide the value by 256. This is the new input value. Repeat, until value is zero. Voila. You have an array of [most significant, less significant … least significant] bytes.

The script will only work on Long integers, but can easily be made to work with 64 bit words. Made It short, because it’s more easy to read. With Little endian, we will always see backward byte order:

And if you need to see how many bytes per integer and long integer is your equipment using, execute this:

I hope this explains the Little and Big endian byte order. You can check the articles I’ve used for more information.

* http://stackoverflow.com/questions/2610849/finding-if-the-system-is-little-endian-or-big-endian-with-perl

* http://docstore.mik.ua/orelly/perl/prog3/ch25_02.htm

 Posted by at 12:07 pm
Aug 172011
 

This is a small utility I wrote in the process of my work. It is a bit ugly and nonetheless non-elegant and non-reliable, because the actual CPU utilization it measures for the switch also has the CPU needed to execute the “show system cpu” command from switch side.

Will be much more elegant if the switch reports the data to SNMP trap collector, but anyway. It will help you help yourself write your own script for this. This one is made to monitor the CPU while you work on other tasks.

The utility uses Tcl:Expect, Tcl:Math and Tcl:Tk. All of them are included in TclLibs package of your chosen distribution. The code is set to use SSH to the switch, but easily can be modified to work also with Telnet. Just un-comment the corresponding lines and set the “proto” value to be “telnet”. The other important values are ip, user, pass, enable, enablepass and the actual command the switch needs to show the CPU utilization. You can also tweak values of Delay and Width. I use 1000 and  600, because those are 10 minutes in one band-graph 100 pixels high.

CPU Utilization

CPU Utilization

Few disclaimers.

  • The code is not very good and will raise exceptions if the switch does not respond in time.
  • The code assumes that the result line will end in 1 to 3 digits followed by %-sign. (e.g. the result must say “current cpu is 100%” or “CPU 33%”)
  • There is virtually no guarantee the code will show you accurate values. It is for monitoring only.
  • When 10 minutes pass, the bar graph will start to scroll from right to left. No data is kept anywhere.
  • Part of this code is copy&pasted verbatim from the Tcl forums and discussions

 Posted by at 3:25 pm