All of the interesting technological, artistic or just plain fun subjects I'd investigate if I had an infinite number of lifetimes. In other words, a dumping ground...

Wednesday, 29 July 2009

Pro Git Book

http://progit.org/book/

Tuesday, 28 July 2009

R statistics programming language

R programming for those coming from other languages

 

Monday, 27 July 2009

CPAN install Bundle::CPAN fails on RHEL 5

There are default build parameters that fail.

cc1: error: unrecognized command line option "-fstack-protector"
cc1: error: invalid parameter `ssp-buffer-size'
SHA.c:1: error: bad value (generic) for -mtune= switch

Find where these parameters are set:

[root@ /usr/lib/perl5]# find . -name "*" -exec grep -H ssp-buffer-size {} \;
./5.8.8/i386-linux-thread-multi/Config_heavy.pl:config_arg2='-Doptimize=-O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m32 -march=i386 -mtune=generic -fasynchronous-unwind-tables'
./5.8.8/i386-linux-thread-multi/Config_heavy.pl:config_args='-des -Doptimize=-O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m32 -march=i386 -mtune=generic -fasynchronous-unwind-tables -Dversion=5.8.8 -Dmyhostname=localhost -Dperladmin=root@localhost -Dcc=gcc -Dcf_by=Red Hat, Inc. -Dinstallprefix=/usr -Dprefix=/usr -Darchname=i386-linux -Dvendorprefix=/usr -Dsiteprefix=/usr -Duseshrplib -Dusethreads -Duseithreads -Duselargefiles -Dd_dosuid -Dd_semctl_semun -Di_db -Ui_ndbm -Di_gdbm -Di_shadow -Di_syslog -Dman3ext=3pm -Duseperlio -Dinstallusrbinperl=n -Ubincompat5005 -Uversiononly -Dpager=/usr/bin/less -isr -Dd_gethostent_r_proto -Ud_endhostent_r_proto -Ud_sethostent_r_proto -Ud_endprotoent_r_proto -Ud_setprotoent_r_proto -Ud_endservent_r_proto -Ud_setservent_r_proto -Dinc_version_list=5.8.7 5.8.6 5.8.5 -Dscriptdir=/usr/bin'
./5.8.8/i386-linux-thread-multi/Config_heavy.pl:lddlflags='-shared -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m32 -march=i386 -mtune=generic -fasynchronous-unwind-tables -L/usr/local/lib'
./5.8.8/i386-linux-thread-multi/Config_heavy.pl:optimize='-O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m32 -march=i386 -mtune=generic -fasynchronous-unwind-tables'

And delete them from these files.

Thursday, 23 July 2009

Why Software Sucks

We work at the sausage factory, so we know how this stuff is made. And it is not pretty. Most software is created by bad programmers like us (or worse!), which means that by definition, most software sucks. Let's refer to Scott Berkun's Why Software Sucks to nail down the definition:

When people say "this sucks" they mean one or more of the following:

  • This doesn't do what I need
  • I can't figure out how to do what I need
  • This is unnecessarily frustrating and complex
  • This breaks all the time
  • It's so ugly I want to vomit just so I have something prettier to look at
  • It doesn't map to my understanding of the universe
  • I'm thinking about the tool, instead of my work
From http://www.codinghorror.com/blog/archives/001289.html

Tuesday, 14 July 2009

Programming book for kids and beginners

Hello World! Computer Programming for Kids and Other Beginners
author Warren and Carter Sande
pages 430
publisher Manning
rating 9/10
reviewer JR Peck
ISBN 978-1933988498
summary Computer programming for kids and other beginners.

http://books.slashdot.org/story/09/07/13/1349203/Hello-World?art_pos=11

Easy serialization in C using structs

Normally I use C++ and this would require using Boost::serialization but I think I'll switch my data structure class back to a C structure and use basic C serialization.
Easier?Here is a test program.
The array size of 20000 creates a 625kB file.
(Build on linux with  gcc -Wall -Wextra -o serial serial.c)

#include <stdio.h>
#include <string.h>

typedef struct node_struct {
    char label[20];
    float x;
    float y;
    struct node_struct * other;
} node_t;

#define ARRSIZE 20000
int main()
{

    node_t nodearr[ARRSIZE];
    node_t readnodearr[ARRSIZE];
    int i;
    for (i=0; i < ARRSIZE; ++i) {
        strcpy(nodearr[i].label, "test label");
        nodearr[i].x = i + 2.3;
        nodearr[i].y = i + 4.3 + nodearr[i].x;
        if (i > 0)
            nodearr[i].other = &nodearr[i-1];
        else
            nodearr[i].other = NULL;
        printf("%d %f %f", i, nodearr[i].x, nodearr[i].y);
    }
    FILE* fp = fopen("nodes", "w");
    fwrite(nodearr, sizeof(node_t), ARRSIZE, fp);
    fclose(fp);
    fp = fopen("nodes", "r");
    fread(readnodearr, sizeof(node_t), ARRSIZE, fp);
    fclose(fp);
    int rtn = memcmp(nodearr, readnodearr, ARRSIZE*sizeof(node_t));
    printf("\n------------\n");
    printf("%d %f %f;", 0, nodearr[0].x, nodearr[0].y);
    for (i=1; i < ARRSIZE; ++i) {
        printf("%f %f, %d, %s %f %f;", nodearr[i].other->x, nodearr[i].other->y, i, nodearr[i].label, nodearr[i].x, nodearr[i].y);
    }
    printf("\nrtn %d\n", rtn);
    return 0;
}

Monday, 13 July 2009

Gprof graphviz/dot plotting


Gprof2Dot  
Convert profiling output to a dot graph.
About

This is a Python script to convert the output from prof, gprof, oprofile, Shark, AQtime, and python profilers into a dot graph.

Thursday, 2 July 2009

Auto indent in Vim

After pasting a lot of code or just trying to indent it correctly go to the first line that is correctly indented and type in the number of lines you want to indent, "=" and then hit down i.e. "j".
Wahla.

tim's shared items

Add to Google Reader or Homepage