Daniel Guerrero Thoughts

Saturday, April 15, 2006

Last entry?

I was looking to change blogger since a year, because of the failures the system has. Now I wanted to change and I start to blog on my own hosting provider, you can check my blogging on:
http://blog.danguer.com

Friday, February 17, 2006

Why the projects fails

The last week I was fired from my job; this is my essay about what makes fails a system delivering. I will not put names, but I will put situations. I won't say where I was working except I will say it was a School.

The situation:
I start to work about two months after the system was started, a co-worker tell me about the details of the starting implementation.
When I started to work I checked the code has about 20,000 lines of code, something really big. As I wasn't used to the system I though almost all was implemented and I only had to fix certain parts of the system.
The system in fact was very small and all the code was "garbage" code written by former developers and they don't clean the code (something later I learn why). Also there was a lot of implementation of certain parts, for example get the internal ID for the semester course, this was a small query in a function of about 10 lines of code, almost on every script.
I was in charge to develop the print of notes of the students, I finish fast my assign and I though this was really easy. I develop four similar scripts which have the same base for all the sections.
After two weeks I finish the scripts started the argues.
First I had some problems with two sections because there was certain things nobody told me, and also nobody told to the IT department; so we have to write certain parts to fulfill the needs. Nothing "bad". But after each month the users want to argue another "certain" parts which some of them were not of the knowledge of the department and others were missed to tell me (and the boss pretend to say me the same: "You have to ask").

After a lot of problems I was in charge with a section where the principal ask me three weeks before a "very important" module for his section, print the certificates of the university. The module was really easy but I found two problems:
1) There was a lot of information lack, one of them the sex of the students, another things the official ID assigned by the official education secretary of the state.
I give to the principal all the student information which was missing to fulfill two weeks ago. He never see the information and at the end he pretend to say he was to make this information miss because I never ask this to he.
2) Suddenly one day they ask me to do in ten minutes a "closing course cycle", this wasn't done for the section I was in charge and the person who assign us the modules thought this was very easy. Only was done in one day and as that afternoon I don't come back to work they fall into panic and have to do this almost by hand to 600 students.

There was a lot of things which happens, they really are amateur to do IT. But let me point some of the main drawbacks both in IT and in Project Management:
1) They never ask to the users what they want or see what they were used to do (they work with a system made in VB and Access).
2) They never show to the users how to work with the new system.
3) The users was used to ask and receive modules after the coding was done; without QA control or even proper testing. The testing and bug discovering was done by the users (the most expensive model).
4) From the last point the users though programming a module was so easy as touch the proper button. So we were only as secretary writing a letter or something similar. So they never though some things have to almost rewrite certain parts of the system to fulfill their needs.
5) As there was never a control of versions our internal boss always was making changes to the DB without asking or even notice us the changes. We see those changes when the user discovered lot of bugs.
6) First there was a person which his only job was provide us feedback from the users. After the boss though it was a good idea to assign us each of us (the programmers) a user or a department. When I start to see the users I see the point 1) was fulfilled without problems, and also another thing, if the user ask four changes, one was discarded as "all is working fine", one change was done and the other two things was lost.
Also with this change the programmers have to double the work and the other person was making a long long relaxing period.

So what was the bes project handling?
Simple:

1) Mimic all the system functions in a closed way (the users will use their usual system)
2) When all the mimic was done and all the function (and a period of testing was done), the system will go online and all the data will be stored into the system
3) Teach the users about the new features and how they have to work now (this is the most conflictive way)
4) Show the users the changes are good through examples with them.
5) The new features has to be done in a proper cycle of development. The bugs has to be top priority, but can't be considered a bug something not implemented (because the users don't tell us).

So easy =).

Friday, February 10, 2006

Between Real and Surreal


Between Real and Surreal
Originally uploaded by danguer.
Starting to post old photos =)
Hope you like.

Thursday, February 02, 2006

What the world needs

Today I checked an article about making your PSP run emulators and programs, of course this was first introduced by XBox which attract to many hobbiest (and a lot of linux geeks).

The problem with PSP, and let me be general, with Sony is that the company as many other big companies try to impose their own "standard", in this case the UMD and Memory Stick, if they ask to me how to design this, I would prefer to use a mini DVD, of course is not Universal Compatible, but it will be more compatible than UMD.

The compatibility should be though as first feature when the system is created (but of course if they limit to users to their products universe, they got more money...).

So what is my whish?.

HD bluetooth or wifi enabled. Yes, why have a system with a lot of Disk Space (iPod, mp3 player, and now camcorders) and they are only limited to one system. If I have a palm, a mp3/video player and why not a PSP or a GBA I want to connect to my HD.
The flash cards are growing in capacity more faster than other medium, but if we compare a small iPod of 4 GB with the now more standard flash card of 1GB the difference is obvious, and more if you buy an iPod of 40 GB or another portable system of this capacity. So why not have a HD with this features?.
I would like to connect my palm to this HD and have programs or even go to internet and download things when I'm mobile; get games from the HD and save my advances, later I only could put near a computer to sync my files.
And we can go further and put in the HD more intelligence and have a permissions system like linux; so we could left to another user read our disk and give a new dimension to sharing.

I hope the companies see that if they make more standard (and open) systems, we get more fun. How the companies could win in this way?, easy as they have developed a system, they have advantage developing more addons more faster and eager than others (and this doesn't mean they have to create their pseudo-standard/open systems).

Tuesday, January 31, 2006

Red Javascript Diaries

I've just opened a new blog to talk about the new UI in Javascript. The title is provocative =)
Visit: Red Javascript Diaries

Tuesday, December 06, 2005

Cheap Tip #2 - Drupal modules and taxonomies

I'm working on a job, developing a module for drupal, as I didin't know anything about this CMS, I started developing a small module, all seems to go smoothly, but yesterday I had a trouble, I'm using taxonomies, and first I added "manually" (direct sql insert), but this wasn't working.
I tried to "emulate" the way other modules works (only have blogapi), but no one was working; I start debbugging the sql inserts (this is really great =) ):
Change
function _db_query($query, $debug = 0) {
for:
function _db_query($query, $debug = 1) {
In database.mysql.inc (of course I'm using mysql, you should change in your properly file).

After debug, I see there was a DELETE statement after my insert; I was searching with no luck which function was called. After a while, I get this:

function node_invoke_nodeapi(&$node, $op, $a3 = NULL, $a4 = NULL) {
$return = array();
foreach (module_list() as $name) {
$function = $name .'_nodeapi';
if (function_exists($function)) {
$result = $function($node, $op, $a3, $a4);
if (is_array($result)) {
$return = array_merge($return, $result);
}
else if (isset($result)) {
$return[] = $result;
}
}
}
return $return;
}


In the node.module; what this is doing is simple call all the modules: page, MyModule, comments, taxonomy among others.

So I check the taxonomy.module to see which is making on its nodeapi:

function taxonomy_nodeapi($node, $op, $arg = 0) {
switch ($op) {
case 'insert':
taxonomy_node_save($node->nid, $node->taxonomy);
break;
case 'update':
taxonomy_node_save($node->nid, $node->taxonomy);
break;
case 'delete':
taxonomy_node_delete($node->nid);
break;
case 'rss item':
return taxonomy_rss_item($node);
break;
}


Fine, insert and update call to taxonomy_node_save what does this function?:

function taxonomy_node_save($nid, $terms) {
taxonomy_node_delete($nid);

if (is_array($terms)) {
foreach ($terms as $term) {
if (is_array($term)) {
foreach ($term as $tid) {
if ($tid) {
db_query('INSERT INTO {term_node} (nid, tid) VALUES (%d, %d)', $nid, $tid);
}
}
}
else if ($term) {
db_query('INSERT INTO {term_node} (nid, tid) VALUES (%d, %d)', $nid, $term);
}
}
}
}


The first statement speak by itself, it delete all the nodes, and next makes again the nodes with info of the $terms, first using a rough: taxonomy_node_save($node->nid, array(0 => $taxonomy_category)); worked inserting the node, but not backuping the data when it calls taxonomy_node_save, so I was almost at the beggining; but of course, checking again taxonomy_nodeapi I saw that the "backup" is on: $node->taxonomy so I need to alter the $node on my mymodule_nodeapi =), here is a snippet:

function mymodule_nodeapi(&$node, $op, $teaser = NULL, $page = NULL)
{
if ($op == "insert" || $op == "update")
{
$node->taxonomy = array(0 => $taxonomy_category);
}
}


And all works smoothly!! =).

Hope this help you,

Monday, November 28, 2005

Amazing ffmpeg

So, there is a boom for video, you can see on youtube.com the next major on the media, flash streaming as "universal" format for web playing; I have to say that is a really, really good idea.

On the other side, there is a lot of 'funny videos' and 'jackass kind' of videos on a lot of sites, one of these sites I like too much is: ebaumsworld.com, but ok let's go the facts =).

To process info about a video, you need an api to access this; in this case there is a GPL library: ffmpeg (Mplayer use it). I have a mac, so I wanted to test on my mac instead on my linux box, so I download the ffmpeg sources (from cvs since the stable version didn't work) to compile I change it to 3.3 version:

phobos:~/Desktop/downloads/ffmpeg danguer$ sudo gcc_select 3.3
Password:
You are already using gcc version 3.3 as the default compiler.
phobos:~/Desktop/downloads/ffmpeg danguer$ ./configure --prefix=/sw --enable-shared


I use the /sw since I have fink working on my mac, then I compiled and installed: make && sudo make install

Then I downloaded the ffmpeg-php extension to use ffmpeg into my php scripts.
For me only worked if you hack a bit the configure script, follow the steps (phpize if you want as extension to load), and before you make ./configure change the configure file from:

echo "$as_me:$LINENO: checking for ffmpeg libavcodec.so" >&5
echo $ECHO_N "checking for ffmpeg libavcodec.so... $ECHO_C" >&6
for i in $PHP_FFMPEG /usr/local /usr ; do
if test -f $i/lib/libavcodec.so; then
FFMPEG_LIBDIR=$i/lib
fi
done

to:

echo "$as_me:$LINENO: checking for ffmpeg libavcodec.so" >&5
echo $ECHO_N "checking for ffmpeg libavcodec.so... $ECHO_C" >&6
for i in $PHP_FFMPEG /usr/local /usr ; do
if test -f $i/lib/libavcodec.dylib; then
FFMPEG_LIBDIR=$i/lib
fi
done


And of course, the script will only look into /usr/lib & /usr/include ; as my libraries were into /sw I put links to the lib & include dirs.

From there, the configure works fine, and also the compile; you need to create (or copy from /etc/php.ini-default to /usr/lib/php.ini and edit to add the proper extension.

Next, download a mpg & avi file, and put this code to test =):

<?php
print "<h1>Testing mpg</h1>";
$movie = new ffmpeg_movie("tmp.mpg", false);

print "Movie Duration: " . $movie->getDuration() . "<br/>\n";
print "Movie GetFrameCount: " . $movie->getFrameCount() . "<br/>\n";
print "Movie GetFrameWidth: " . $movie->getFrameWidth() . "<br/>\n";
print "Movie GetFrameHeight: " . $movie->getFrameHeight() . "<br/>\n";
$frame = $movie->getFrame(15);
$im = $frame->toGDImage();
imagejpeg($im, "im_mpg.jpg");
print '<img src="im_mpg.jpg"/><br/>';

print "<h1>Testing avi</h1>";
$movie = new ffmpeg_movie("tmp.avi", false);

print "Movie Duration: " . $movie->getDuration() . "<br/>\n";
print "Movie GetFrameCount: " . $movie->getFrameCount() . "<br/>\n";
print "Movie GetFrameWidth: " . $movie->getFrameWidth() . "<br/>\n";
print "Movie GetFrameHeight: " . $movie->getFrameHeight() . "<br/>\n";
$frame = $movie->getFrame(15);
$im = $frame->toGDImage();
imagejpeg($im, "im_avi.jpg");
print '<img src="im_avi.jpg"/><br/>';
?>


The first time I didn't get any; but from another files, I really could get the frames and info about the movie... I can't wait to test if wmv and mov files can be readed and created short clips =).

Regards,