recode implementation (was: recode, get sample, and get columns)

Jakson Aquino jaksonaquino at yahoo.com.br
Sat Aug 13 00:52:59 CEST 2005


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi Bernhard,

Em Sexta 12 Agosto 2005 10:30, Bernhard Reiter escreveu:
> I would say that we should in any case use the long format
> for the new long options.
> We could add "--" versions for the old long options, too
> and have the warning that at some unknown point in the future
> the "-" versions will be deprecated.

It seems that we have only to add the options inside the optrec[MOPT] (in 
statist.c). For "help", for example, we have:

{"-h", &help}, {"-help", &help}, {"-?", &help}

In this case, it's just a matter of adding one more "help": {"--help", &help}, 
and doing the same with the other variables. And, then, update the value of 
MOPT. We have only to choose the abbreviation letters. Suggestions:

- -s --silent
- -l --log
- -p --noplot
- -f --nofile
- -t --thist
- -B --bernhard
- -x --xsample
- -c --xcols
- -b --nobell


> I did not now that you did not know.
> There is a book called
> 	Brian W. Kernighan & Rob Pike,
> 	The Unix Programming Environment, 1984, Prentice-Hall.

Thanks for the reference. On Monday I'll look for it or for something similar 
(if it's not there) in the library.

> > I even thought about removing recode.c from statist,
> > but I think that the syntax of a "recode_config_file" is still simpler
> > than the syntax of awk, at least for people who don't
> > know how to program in C.
>
> The question to consider is: Does the additional effort of learning
> statist's syntax and maintaining the code help more then
> learing recepies in a standard language?
> If yes, you can keep the code.
> Otherwise removing it, will keep statist cleaner.
> Usually standard languages have knowledge that is useful in other
> circumstances as well. This is why I prefer python in many cases now,
> though smaller operations tend to be longer than in awk.

Your reasons are strong. I only regret that I lost my time developing recode.c 
and you lost yours translating its verbose messages. I agree with your two 
arguments: awk is useful for tasks other than manipulating statist data 
files, and recode.c is potentially a source of bugs. One of them you already 
found. I'm going to made the necessary changes in the source, and in the 
manual. Regarding Python, I would have to learn it. I'll try it latter, when 
I have the need of a big script. For now, I'm very impressed with awk speed.

> Can you describe what you want to do?
> As far as I can see "join" will need a matching keyword in both tables.
> Maybe you want "paste"?

The problem is (actually, was) that my database had three key variables. The 
solution was to use awk for creating a variable that is a string 
concatenation of the three variables. Then, the three variables became one, 
and I used join to merge the files. I'll add to the manual tips on how to use 
join, and then, everything that I once knew how to do with a slow dinosaur 
now I know how to do with the (much faster and free) statist and friends, 
sort, awk, join, etc...

Best,

Jakson


-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (GNU/Linux)

iD8DBQFC/ShRg2jPD2DL3GURAgDhAJoCkuMu8Fw/nJK6MSWdsLJ4NThKJwCgrM9J
ypneGIPOZDsNO/xv2B2XvJ8=
=4BxO
-----END PGP SIGNATURE-----




_______________________________________________________
Yahoo! Acesso Grátis - Internet rápida e grátis.
Instale o discador agora! http://br.acesso.yahoo.com/




More information about the Statist-list mailing list

This site is hosted by Intevation GmbH (Datenschutzerklärung und Impressum | Privacy Policy and Imprint)