Thursday, October 28, 2010

Multi headed dragon


The multinationals with a dash in name (especially the ones that gained the dash through a merger) are like a multiheaded dragon. They look fierce, impressive and aggressive from the outside but they are schizophrenic and divided on the inside.Each head has its own mind and feels that he has its own stomach...

Monday, October 25, 2010

My greatest project so far



Mara-Elena, born Monday the 25th of October 2010

Monday, October 18, 2010

In memoriam Benoit Mandelbrot


Benoit Mandelbrot (1924 -2010) revealed some fascinating domains of the mathematics - the fractals.
Although mathematically challenging the fractals are also eye-candy generators.Their delicate structure makes them a place to explore. 

Thursday, October 14, 2010

eSNACC ASN.1 Compiler

I have found the eSNACC v1.7 compiler.
I thought it was lost as I couldn't find it anywhere on the net and the original site was gone.
I found it in my archives (luckily).

Use it at will (I guess the license permits it)

Wednesday, October 13, 2010

Simple dependency graphing for Linux/Solaris

I needed a simple tool that would determine the dependencies between some libraries.
Because I haven't found one (I tried to compile nmdepend but I gave up quickly) I wrote this simple and rudimentary dependency walker that is generating a PDF output.
It takes one argument in the command line and then draws a graph f dependencies for this argument by parsing the output of ldd command. The graph is creating by pushing the list of dependencies to graphviz.


#!/usr/bin/env python
import sys
import popen2
import re
deps = {}
def solve(f):
        if f in deps:
                return deps[f]
        r, w, e = popen2.popen3('ldd '+f)
        e.readlines()
        __deps = []
        for l in r.readlines():
                dep=""
                t=l.split("=>")
                try:
                        left=t[0].strip()
                        right=t[1].strip()
                        if right=="not found":
                                key="./"+left
                        else:
                                key=right              
                except IndexError:
                        key=t[0].strip()
                key=key.split(r" ")[0].strip()
                __deps.append(key)
        deps[f]=__deps
        r.close()
        e.close()
        w.close()
        for dep in __deps: solve(dep)

def export(name):
        r, w, e = popen2.popen3('dot -Tpdf -o/tmp/'+name+".pdf")
        #graphviz output
        w.write('digraph "' + sys.argv[1] + '"{'+"\n")
        w.write('ratio="auto";' + "\n")
        for dep in sorted(deps.keys()):
                for dd in deps[dep]:
                        w.write('"' + dep + '"->"' + dd + '";' + "\n")
        w.write('}' + "\n")
        r.close()
        e.close()
        w.close()
if __name__=="__main__":
        solve(sys.argv[1])
        del deps["statically"]
        export(sys.argv[1])
        #print deps

Tuesday, October 12, 2010

CMake

I have recently worked with CMake in order to improve our build system a little.
The old system, based on GNU Make on Linux ans SCCS Make on Solaris had some flaws and it became extremely hard to maintain.CMake seemed a good solution at a first sight as the syntax was clear and most of the things worked out of the box (hierarchical builds, custom build commands).
However CMake misses a very important feature - the variant builds. I am not speaking of the Debug/Release builds but feature bounded builds as in my care custom builds for C7/A7/CH7/J7 ISUP variants. For this kind of builds I need:
1. Different defines
2. Different include paths
3. Different link libraries.

Point 3 can be easily solved with CMake (via TARGET_LINK_LIBRARIES), but point 1&2 cannot. I have tried several variants and workarounds and finally I have found one that
worked 
SET_PROPERTY(TARGET MainNed_itu APPEND PROPERTY COMPILE_DEFINITIONS  "C7_Q")

Another way was to use SCons for build. It provides some nice features (hierarchical/variant builds) and is easily extensible in Python. It also has a better Java support than CMake.
It was quite easy to migrate the CMakeLists to SConstruct files using a simple script.

Saturday, October 9, 2010

Do they have a retarded copywriter?

I have no idea who is behind the new commercials  for Vodafone prepaid.

He/She must be somehow retarded. I really do not get who is really targeted by those stupid commercials.
Maybe I am obtuse but the "Marea Ieseala/Maximia" series are among the most unfunny ideas.

Contrasting those commercials with the ones Orange has now the really suck. Orange's are witty with nice music and really have a story. Even Cosmote  have better commercials - funnier and more elaborate.

As for postpaid the situation is even worse. Cerebel is nor funny. Howg!
The internet everywhere prepaid campaign might have been a good but they finally fucked it big time...

Please guys -  change the commercials. They really sucks...

In the same idea of bad publicity - the replacement of Romanian flag with the American on the Rom chocolate is also moronic.

I am wondering why do they even organize publicity contests lately (Ad'or or something) as most of the commercials are importer and the others (considering the big accounts behind) are dumb.

Sergey Yesenin

I Do Not Regret, And I Do Not Shed Tears...


I do not regret, and I do not shed tears,
All, like haze off apple-trees, must pass.
Turning gold, I"m fading, it appears,
I will not be young again, alas.
 
Having got to know the touch of coolness
I will not feel, as before, so good.
And the land of birch trees, - oh my goodness!-
Cannot make me wander barefoot.
 
Vagrant"s spirit! You do not so often
Stir the fire of my lips these days.
Oh my freshness, that begins to soften!
Oh my lost emotions, vehement gaze!
 
Presently I do not feel a yearning,
Oh, my life! Have I been sleeping fast?
Well, it feels like early in the morning
On a rosy horse I"ve galloped past.
 
We are all to perish, hoping for some favour,
Copper leaves flow slowly down and sway...
May you be redeemed and blessed for ever,
You who came to bloom and pass away...




Saturday, October 2, 2010

Multiple file tail

This is my first attempt to post ode with some syntax highlighting.
I have chose GeSH for convenience and for the fact that I do not really enjoy much Javascript in my pages.
The tool does a "tail -f" on multiple files - like the output of a RollingFileAppender.

UPDATE: In the meanwhile I have found that Alex Gorbatchev's SyntaxHighlighter offers a hosting for it's brushes. In spite of my JS phobia I have chosen it over GeSH as the output looks way better.


#!/usr/bin/env python
import glob
import optparse
import os
import signal
import stat
import sys
import time
files = {}
def info(*text):
        if options.verbose==True:
                for token in text:
                        print token,
                print
       
def handler(sig, frame):
        if sig==signal.SIGUSR1:
                print "*** Caught USR1 ***"
                print "Watched files are: "
                for f in files.keys():
                        print f, " ",
                print
        if sig==signal.SIGINT:
                sys.exit(0)
       
class GenericLogFile:
        def __init__(self, name, label = False):
                self.name = name
                self.label = ""
                if label:
                        self.label=self.name+":"
                self.open()
       
        def close(self):
                self.file.close()
       
        def open(self):
                self.file = open(self.name, "r")
                self.file.seek(0, 2)
                self.lastpos = self.file.tell()
                self.mtime = os.stat(self.name)[stat.ST_MTIME]
                self.inode = os.stat(self.name)[stat.ST_INO]
       
        def reopen(self):
                self.open()
                self.file.seek(0, 0)
       
        def tell(self):
                return self.file.tell()
        def size(self):
                return os.stat(self.name)[stat.ST_SIZE]
               
        def changed(self):
                return os.stat(self.name)[stat.ST_INO]!=self.inode
        def tail(self):
                #Inode changed
                if self.changed():
                        info("***File ", self.name, " was changed")
                        self.close()
                        self.reopen()
               
                size = self.size()
                pos = self.tell()
               
                #File truncated
                if size<pos:
                        info("***File ", self.name, " was truncated(size=",size," pos=",pos,")")
                        self.close()
                        self.open()
                       
                #Data written since we have last checked
                if pos!=size:
                        if self.label=="":
                                info("***File ", self.name)
                        #Display all remaining lines
                        while True:
                                line = self.file.readline()
                                if line!="":
                                        print self.label+line,
                                else:
                                        break
       
               
help="""
DESCRIPTION
        This program works as tail -f for multiple files.
        files   -       any kind of file. They can be specified using shell patterns (*/?)
       
        -v              -       verbose output
        -l              -       label each line with the file ith has been read from
        -h              -       prints this help
       
WARNING
        Please enclose the filename patterns between single/double quotes in order to prevent
        shell globbing.
       
SIGNALS
        USR1    -       dumps a list of the open files
       
"""
def init():
        global options, args, parser, config
        #Initialization
        parser = optparse.OptionParser(help)
        parser.add_option("-l", "--label",  action="store_true", dest="label", help="label each line with the name of the file from that it was read")
        parser.add_option("-v", "--verbose",  action="store_true", dest="verbose", help="print more verbose diagnostics")
        (options, args) = parser.parse_args()
        signal.signal(signal.SIGUSR1, handler)
        signal.signal(signal.SIGINT, handler)
       
if __name__=='__main__':
        init()
        if len(args)!=0:
                lst = glob.glob(sys.argv[1])
                if len(lst)==0:
                        print "WARNING: No file matched the input yet!"
        else:
                parser.error("Incorrect number of arguments")
                parser.print_help()
               

#Initial situation
        #Get all the files already present
        for f in lst:
                if not f in files:
                        print "Added ", f
                        files[f] = GenericLogFile(f, options.label)
       
        #Main loop
        while True:
                lst = glob.glob(pattern)
               
                for f in files.keys():
                        if f not in lst:
                                #We no longer need this file...
                                info("Deleted ", f)
                                del files[f]
                                continue
                        else:
                                files[f].tail()
                       
                for f in lst:
                        if not f in files:
                                info("Added ", f)
                                #This is a file that appeared during program run.
                                #We have to print it all
                                files[f] = GenericLogFile(f, options.label)
                                files[f].reopen()
                                files[f].tail()
                time.sleep(1)

Friday, October 1, 2010

Non Agile Company



At least in my group AGILE is not understood at all.
I am continuously doing detailed specs that nobody respects in the end.
I do not say that specs are bad, contrary they are good but the detail level has to be adjusted as to make them useful.
How agility works in our case is as this funny site describes: http://www.halfarsedagilemanifesto.org/
They are evaluating AGILE tools and methodologies just to stick harder on their V cycle development system and enormous paperwork.

IMHO we are less agile than three years before as today the project steering has at least three layers of management. The hierarchy is extremely complicated... Let's see:

A project has a Technical Project Manager (TPM) and a Technical Project Responsible (TPR) - generally not the same person. The TPM manages a version of the product generic or a customized for a specific client.
The TPR is a hybrid between architect and team leader. A TPR can be a be both a developer/tester and/or a TPM for another product/project. Everybody reports to a Development Team Leader or Validation Team Leader. The VTL/DTL reports to Group Leader and Group Leader reports to Development Manager. DM reports to VP of Development who reports to the CTO who reports to the President who reports to the CEO. On the other hand there is also a Product Manager who basically delegates its work to TPR and Tendering Support. He/She reports to ProductLine Manager. The ProductLine Manager reports to the Program Management Office... Complicated isn't it? And there is Quality also and his boss - they create paperwork and processes. Oh, and local management line - they decide on the IT, pencils, realestate.... That' s not all, there is also procurement... And Operations - they take the product and install it to the client. And the TAC and TEC guys. Their role is to forward emails from clients directly to developers - hierarchy short circuits.
For product lifecycle you have to gather TPR, PM, PLM, DM, operations, quality. They can discuss almost everything but real technical problems and opportunities.
The technical aspects are discussed by TPR, procurement, tendering and operations.
The specs are written by developers and edited by Group Leaders. Who are ex-engineers. And omniscient.
When is to budget something of hire somebody then all those - up to VP have to discuss in order to disagree.
In case of incidents everybody from CTO is involved. They are all looking for the developer who did not tested for NULL a pointer (as per CTO's angry email). But the developer who was in the meantime a TPL for another project had no time to look further in the code 'cause he/she was overloaded by another client who has a long trade history with the president and the president pushed that the developments for this clients to be put in front of other task - including the bugfixing.
In the meantime the organization becomes leaner and agiler by creating a super PMO that can decide on the projects - they have no connection with all the others but they manage budgets for product lines. The developers are asked to evaluate Jira and Mercurial along with writing Word documents kept in fourversion control/document management systems...
The ratio is about 1.37 Managers/Developer...

I stop here... It is too much for me to describe this chaos in words and my drawing skills are extremely poor.
I am wondering sometimes is my recent neurosis has something with this incredible mess.
Personally I have stopped fighting for order and clear roles... I am not even advocating agile anymore... It's no use. Every one has to live from developer to CEO. I cannot oppose to this. I have to earn something too.