This are my notes in the fields of computer science and technology. Everything is written with ABSOLUTE NO WARRANTY of fitness for any purpose. Of course, feel free to comment anything.

Wednesday, August 13, 2008

A color picker

Looking for a color picker for a website I am preparing, I found many commercial tools and other open source (unobfuscated js) but not free-licensed.

An open source free licensed ('it’s dual licenced under Creative Commons & GPL') color picker is the Colorjack color picker: I like more the version 1.0.4 than 2.0. .

I saw that the code in Colorjack incorporates a function $() which I would have to rename to avoid conflicts with the Prototype framework... (although I didn't actually test it) so I just looked further and found Scripteka, which is a collection of Prototype extensions. Currently there are links to 119 projects.

At least two of them are color picking related, John Dyer's Colorpicker, released in 2007 under a MIT-style license and Jeremy Jongsma's GPL-licensed Control.ColorPicker, released in April 2008.

Not all the projects linked by Scripteka are free licensed: for example Cooltips is not.

Through a comment in John Dyer's blog I came to nogray color picker which is based on another javascript framework (mooTools) and I didn't find the licensing terms.

It's a pity none of them is available as Rails plugin, maybe with some nice helper methods...

Sunday, July 13, 2008

Online lectures

An Italian University (Consorzio Nettuno) is based on recorded lectures in several languages, unfortunately not online (or only for their students) but broadcasted by two channels on an european satellite. I have currently no satellite dish... that's a pity...

On the web there are anyway some resources with lectures and other videotaped matherial better than music videos and jokes. Here are some examples I found, grouped by language:

Thursday, October 11, 2007

bash startup

In interactive mode bash executes some startup scripts. First thing to know is if it is a login shell or not a login shell: 

* login shell: (executes more things)
(1) general settings for all users are in: /etc/profile
(2) personal settins may be in: (first one readable)
~/.bash_profile
~/.bash_login
~/.profile
(3) before logout: ~/.bash_logout

* non-login: 
>bash => ~/.bashrc
>bash --norc => nothing
>bash --rcfile filename => specify another rc file

Wednesday, April 11, 2007

Learning C: params from the command line


I want to read two parameters from the command line: a string and a number. The number should be a positive integer smaller than 100.
int main (int argc, char *argv[])
{
char * string;
long int number;
/* are there really 2 parameters? */
if (argc != 3) exit(EXIT_FAILURE);
/* catch them */
string = argv[1];
number = atoi(argv[2]);
/* use them */
printf("String parameter: %s\n",string);
printf("Number parameter+1: %d\n",number+1);
}

The number of parameters (as int) and the parameters itself (as char*) are passed to "main".
Everybody writes main as int main (int argc, char *argv), I guess it's possible to use more descriptive names to the arguments of main, like int main (int argument_counter, char *arguments) but it's probably out of fashion - if you write C you should look serious after all.

The classical beginner's note: It must be considered that argv[0] is the program name (what is useful for example for syntax error messages), so the counter is always actually one more than you intuitively expected and you find the first real parameter as argv[1].

Parameter type: as the parameters are actually always strings, you must convert them using some conversion functions like atoi or strtol (I guess).

About Me

My photo
Hamburg, Hamburg, Germany
Former molecular biologist and web developer (Rails) and currently research scientist in bioinformatics.