Skip to main content

Posts

Showing posts from 2009

Reducing Browser Memory Leaks with Google Maps API

Reducing Browser Memory LeaksThe Google Maps API encourages the use of function closures, and the API event handling system GEvent attaches events to DOM nodes in such a way that almost inevitably causes some browsers to leak memory, particularly Internet Explorer. Version 2 of the Maps API introduces a new method, GUnload(), that will remove most of the circular references that cause these leaks. You should call GUnload() in the onunload event of your page to reduce the potential that your application leaks memory: onunload="GUnload()">Using this function has virtually eliminated Internet Explorer memory leaks in Google Maps, though you should test for memory leaks on your own site using tools like Drip if you are noticing memory consumption problems.SOURCE: GOOGLE

Internal Projects

We can't open much about our internal projects here at IDEIA. But now that University students and and professors, our main customers are on vacation, we have more time to spend on some internal projects which were put aside during the year.
One of them, in cooperation with the IDEIA's Optics Lab, is related to digitize images captured with a regular composite video camera. The guy from the Optics Lab have a EasyCAP USB device, which I have to put to work with my linux box.
I didn't find an out of the box solution, or a few steps tutorial to put it to work during the year. Looking again, I've found a couple of forums, tutorials, and links:
http://ubuntuforums.org/showthread.php?t=662531
http://www.unicap-imaging.org/download.htm
http://sourceforge.net/projects/syntekdriver/files/syntekdriver/Release%202.1.0/stk11xx-2.1.0.tar.gz/download
http://ubuntuforums.org/showthread.php?t=451200&highlight=Syntek+Semiconductor
I hope these might be useful to others trying to make this…

Information Visualization

Since I had done the visualization class at grad school, the world wans't the same anymore. To look at informational illustrations and graphic plots is being a real cool exercise. And when I have to use some software to plot some chart, quickly come back to my mind when our professor were telling us if we went to his office, he will receive us with a box of paper tissue to wipe our tears away...
So, when I read the slashdot article about a Ronald Knief collecting charts of nuclear reactors, originally published in issues of Nuclear Engineering International, I became very curious. The Wired website brings more details.
But after reading those articles I had reached the BibliOdissey blog, which has much more digitized illustrations, from artistic illustrations, through info charts, to puzzles. It is really awesome... It has lots of illustrations. They are all hires illustrations, the BibliOdissey has a Flickr gallery with them in 5156 x 3244.
Here are some of my favorites:



Cross-compiling windows applications under linux with wine and DevC++

This post has the same title as this, from Violin Iliev because it is almost a "repost". I had an old post on compiling win32 binaries on linux, but the technique I had shown lack the windows resource file compiling. Violin had written his wrapper to the windres resource compiler, but one good "emergency option" if one couldn't, or don't want, or hasn't time to, write a wrapper or compile Violin'd wrapper, is to follow what was commented on Violin's blog by someone who signed as Andy. Andy said:

"I had the same problems with windres and mingw32-make under wine 1.0.1
I solved the problems by putting an original copy of msvcrt.dll in the bin subfolder of mingw32 and telling wine to load it first instead of its own msvcrt emulation.
hope it can be useful
Andy"

All my avatars until now

These are the avatars I use for instant messaging. They were all made with inkscape

Quadrilateral Centroid Algorithm

Oh men... This time google wasn't helping much...

I was looking for an algorithm to find the centroid from a quadrilateral polygon. It wasn't necessary to be a general, any polygon, centroid algorithm... just one which give me the centroid of a regular convex quadrilateral. It was hard to find something that simple. But finally, here is.
The following code is a C example on how to compute the area and the centroid from a regular convex quadrilateral polygon:

#include<stdio.h>

int main(void){
float verticesX[5];
float verticesY[5];
float centroidX = 0;
float centroidY = 0;

verticesX[0] = 3.58; verticesY[0] = 1.90;
verticesX[1] = 4.48; verticesY[1] = 1.88;
verticesX[2] = 4.56; verticesY[2] = 2.71;
verticesX[3] = 3.64; verticesY[3] = 2.74;
verticesX[4] = 3.58; verticesY[4] = 1.90; // Repeat the first vertex


int i, k;
float area = 0.0f;
float tmp = 0.0f;

for (i = 0; i <= 4; i++){
k = (i + 1) % (4 + 1);
tmp = verticesX[i] * verticesY[k] -
verticesX…

Experiences with OpenCV

OpenCV has really lots of useful classes and features.
The square detection for my virtual reality class work is being made with it.

Unfortunately, on my tests, I was detecting squares which I didn't want the software to detect. Like on the image below:It would be much better if I could do the image analysis only inside the laptop screen. "Googling" on "OpenCV image crop" I had reached the nashruddin.com (OpenCV Region of Interest - ROI). This blog has a good explanation on how to crop (extract the region of interest) from a image.
With those informations I got the following result for the same frame:

Now I have to check the area of the detected squares. At the web archives of the computer geometry class mailing list, from the Illinois University, google had shown me one algorithm to calculate the area of a closed polygon, as follows:
Let 'vertices' be an array of N pairs (x,y), indexed from 0
Let 'area' = 0.0
for i = 0 to N-1, do
Let j = (i+1) mod N
Let…

Becoming father...

After 4 years of marriage we will finally have our first kid.

My wife is writing a blog with more details (in Portuguese). But which is letting me more exited about this near future is the new excuse to buy toys. The chart below from graphjam illustrates well:


see more Funny Graphs

And here is one echo scan image made when we were with 12 weeks of pregnancy:

Developing PlayStation2 Games

The I finally have a PlayStation2 at home. Now it is time to start looking for tools for game developing for it.

The first place google has shown was http://ps2dev.org/. The first look has been promising. Besides the PlayStation2 related pages, it also has tutorials and articles related to the PlayStation3 and the PSP.

I hope to sooner be posting something about my experiences developing for the PlayStation2.

The results should probably be tested with some PlayStation2 emulator (http://pcsx2.net/, http://www.emulator-zone.com/doc.php/ps2/)

How many times each user has logged in

With this line, we can check how many times our users had logged in with SSH:

cat /etc/passwd | cut -d ":" -f 1 | sort | uniq | while read line ; do echo -n $line" "; zgrep "user $line" /var/log/auth.log* | grep -i ssh | grep -vi fail | grep -vi invalid | wc -l; done | sort -n -r -k 2

On my system, the only user which has logged in was my own user:
filipi 52

And for non SSH logins:
cat /etc/passwd | cut -d ":" -f 1 | sort | uniq | while read line ; do echo -n $line" "; zgrep "user $line" /var/log/auth.log* | grep -vi fail | grep -vi invalid | wc -l; done | sort -n -r -k 2

Checking auth.log for ssh brute force attacks

As I am letting my personal computer always on, as a homelinux server, I decided to check if someone is trying to breaking in with SSH brute force attacks.

First I did a grep for fail at the /var/log/auth.log. (grep -i /var/log/auth.log)

And I got lots of lines with the string "fail". With [grep -i /var/log/auth.log | wc -l] I figured out that were 1164 fail entries at auth.log

With an [grep -i fail auth.log | cut -d " " -f 6 | sort | uniq] I checked that were two kind of failed attempts:
Failed
pam_unix(sshd:auth):

So I wrote the following line to check with which users they were attempting to log:
grep Failed auth.log | cut -d " " -f 11 | sort | uniq | while read line ; do echo -n $line" "; grep $line auth.log | wc -l; done | sort -n -k 2

Here, the field position (the number 11 at the above command lines [-f 11]) may change in some systems. At my desktop at work, the username came at the position 9.

Here are the "top ten":
root 2922
user 2884

GNU Octave from PHP without temp files

Of course... How haven't I thought that? Pipes!

I was "googling" about PHP and Octave and I had found some simple approach at a mailing list archive. I had already used Octave with PHP but I had always used temporary files, but pipes are a much simpler approach.

From the mailing list post:
in php
start "octave -q script" with popen

create a string in php e.g. "input_data = [102 10 10 10 10 10];"

write this string to the pipe

in octave

recive the string with fread on stdin
let the eval function do the job
calculate

print the result with printf in php syntax "$result = array(12,10,9,12,)"

php
read the output from the pipe (with php fread)
use phps eval function


but using eval with octave and php is a security risk, to avid eval parse
the matrix wird scanf

this is also not the fastes way to use octave (the octave startup needs a
lot of time)

Plotting with AJAX + Javascript

A friend of mine had written an application which communicates with a small microcotroled board and saves data read from this board on a mysql database. He wants to plot these data on the web. He wrote a PHP script using the GD lib. He did a real good job, but he wants it to plot the data dynamically and an http refresh made things a little ugly. He is now trying to plot directly with AJAX + Javascript. He is trying to use Flot, which is a javascrit for plotting data.
Another usefull resource for realtime web graphics is the CavasDemos.

Regex within PostgreSQL

Regex (Regular expressions) are very useful. I had to make a SQL query to return only the firstname from a table where the field provides the full name.
ideia_onde=# SELECT name FROM users;
name
--------------------------------
Linus Torvalds
Randal Schwartz
Steve Wozniak
(3 rows)

ideia_onde=#
Now, with a simple substring using a regular expression:
SELECT SUBSTRING(name, '(.*?(\\s))') FROM users;
substring
-----------
Linus
Randal
Steve
(3 rows)

ideia_onde=#
What do I did?
The substring function extracts from the name field everything (.*) until (?) a space character (\\s).

Experiences with Tecgraf Libraries

My advisor is always right. So I have decided to take a look at Im lib, from Tecgraf.

As a learner by example, I first tried to compile and run the examples provided with Im lib, but most of their examples came written in lua and I need to write my code in C (or C++). Fortunately there were 6 examples written in C++:
glut_capture.cim_copy.cppim_info.cppim_view.ciupglview.cproc_fourier.cpp
But, I wans't use glut (discarted glut_capture.c and iupglview.c)
So I've choosen im_view.c to try to compile, and the torture has started. There wans't any doc, readme or anything which tells something on how to compile the examples. The only clue was the comments written on the source header:
/*
IM 3 sample that shows an image. Needs "im.lib", "iup.lib", "cd.lib" and "cdiup.lib". Usage: im_view Example: im_view test.tif Click on image to open another file.
*/
Well, I had discovered that I was needing three more libs from Tecgraf to compile this ex…

Converting a video file to lots of images

Still for that grad school work on stereo video, I want to convert the videos I made to a bunch of bitmap images.

With linux and ffmpeg it is easy. It is just type:
ffmpeg -i video.dv image%03d.bmp
There are more ffmpeg cheats at:
http://webupd8.blogspot.com/2009/08/ffmpeg-cheat-sheet-19-best-practices.html

Here is a couple of links very useful:

Video convertion cheat sheat (http://www.m3fe.com/31765/)Video editing software (http://www.tech-faq.com/Video-Editing-Software.shtml)
Specifically, the command line I was looking for is:

ffmpeg -i esquerda.dv -f image2 foo_%02d.bmp

Google Bookmarks And Google Notebook

As an advise from my grad school advisor, I am now putting all references I am reading for my master's thesis on google bookmarks. There also is a short cut to directly add a page on ones bookmarks, using a simple firefox bookmarks toolbar button. The best part, is that with google notebook, another tool, one can share the bookmarks. So my advisor can check what I am reading.

The URL of my public bookmarks is:
https://www.google.com/notebook/public/02836905453520795692/BDT3iIgoQh_GewpYj

Numerical Linear Algebra Packages on Linux

As a control engineer, I am always needing to use some numerical linear algebra software, usually Matlab or GNU Octave, but now that I have to write some C code using MPI for solving some linear algebra problems.
There are some software packages for that so.

Jochen Voss has a nice tutorial on BLAS and LAPACK at http://seehuhn.de/pages/linear

I was also googling around looking for something on sparse matrix with C. I've found this thread at a forum:
http://forums.aspfree.com/programming-help-33/c-initializing-a-sparse-matrix-236415.html

Mesh generator and Finite Element Solver

I was reading some papers at Universia, and I've found this one which references the Gmsh, a apparently simple mesh generator with an simple integrated CAD. It also has screencasts showing how to use it.
Gmsh was is developed by the professor Christophe Geuzaine for academic uses. I didn't read much, but Gmsh is apparently scriptable and the CAD tool is realy simple to use. I was planning to develop something very similar. Another cool thing at the professor's site is the project GL2PS, which the main idea, on convert OpenGL rendering in PS, PDF and SVG, I was also thinking in.
Professor Geyzaine had also written an finite element solver, the GetDP.
I am planning to use them all on some grad school works.
Another code on Finite Element Analysis is the SLFFEA, which stands for San Le's Free Finite Element Analysis, deserves note and is entierly written in Ansi C.

Warning against using pie charts

Bernhard Reiter had wrote a really nice warning against using pie charts, and he did put it on his plotting tool ;-)

Here is a peace:
"... Piecharts are generally not recommended to visualise information! Use bar- or pointchars instead if the quantities are important. Studies have shown that piecharts are hard to read if you actually have to answer questions about the numbers they represent. They look very pleasing and are used in a lot of places but they do not help to visualise information that well. Analytic thing person will read the percentages or values given on the legend or the chart itself and analyse them in their head. ... "Check the full text at his web site.

Some tricks with gnuplot

I've been using gnuplot to embed graphics on my scripts for quite some time. And I liked it much.

Last month I was asked to maintain a legacy application which generates some live graphics using the JFreeChart class. It has some transparent animated 3D pie charts. So, I was wondering if I could do the same with a couple of scripts and gnuplot, generating an animated gif.

After googling a little, I've found these links:
Simple pie chart with GnuplotAnother simple 3D pie chart with gnuplot (script included)And, with these new gnuplot features, I will try to do some cool scripts ;-)

Engineer Honoris Causa

We always think of an engineer as a guy who has a college degree. But, in the case o William Kamkwamba, who build an windmill from scrap in his village on Malawi (Africa) we just got back to what really powers engineering: Inspiration, Motivation, Information and Dedication.
He had the Information available at a library, on how a windmill works, he had the Inspiration to see the windmill would fulfill the necessity of electric power his village had and those factors gave him the Motivation and with Dedication he did accomplish his windmill.

William Kamkwamba spoke at TED

And has a blog now.

This is a good example of a talented engineer.

College degrees give us Information, but if we don't have the Inspiration, Motivation and Dedication, we will never be a real engineer. The College degree also legitimates the engineer but in William's case, his windmill legitimates his engineering skills.

Formulas

Military Projects and Second Life for Med training

I have to remember to take a look at forge.mil, etc. the military seems to be getting on board with free and open source software.
A number of OSS projects are worth to check: Delta 3D, OpenCPI, FalconView, OSSIM
(more at: http://slashdot.org/)

And on simulation, slashdot.org has a cool post on the use of Second Life for Med training:
"... medical schools like Imperial College London are starting to use virtual hospitals in Second Life so students can learn their way around an O.R. before they enter the real thing. ... SL can also expose students to situations that a standard academic program can't duplicate: 'You can take risks that aren't safe in the real world and teach more complex subjects in three dimensions,' says Colleen Lin. ... "
(full article at: http://slashdot.org/)

Healthcare systems

Last year, Google has launched the Google Health. A service to concentrate the user medical records.

There are other posts on this topic at Google Blog.

This can give us lots of ideas on uses for this, like updating medical records trough a cell phone, interaction with hospital systems, etc. This looks very promising.

The prefuse visualization toolkit

Navigating on the silk icons web site, I've found an interesting use of the Prefuse Visualization Tool Kit.
“Prefuse is a set of software tools for creating rich interactive data visualizations. The original prefuse toolkit provides a visualization framework for the Java programming language. The prefuse flare toolkit provides visualization and animation tools for ActionScript and the Adobe Flash Player.”They have some nice visualizations on their gallery. I hope to soon use this tool kit on some projects on my job.
Bellow is the screenshot of one of the projects which had used Prefuse:
This particular screenshot is from the project:Voyagers and Voyeurs: Supporting Asynchronous Collaborative Information Visualization by (Jeffrey Heer, Fernanda B. Viégas, Martin Wattenberg) . Following Fernanda B. Viégas and Martin Wattenberg web sites, I've discovered that both worked on the Many Eyes project for IBM. Perhaps, Prefuse is the ancestral of Many Eyes... ;-)

As is in Fernanda's w…

The icons I was looking for...

A friend had posted on twitter, about a cool tool for project management, called No Kahuna. As an engineer, I have a significant interest in project management, so I had created an account on that site. The system creates a sample project, which I liked, and had cool features. The overall looking of the system seams clean and efficient (I had not tested enough). But what had called my attention most was the nice small (16-by-16 pixels) icons this system has. Looking down at the site footer, It has a note telling it uses silk icons. I imediatly follow that link. They have over 700 icons on that format, which I was looking for my personal systems (web or not).

The icons had a really nice look and I will certanlly use then on my projects.

http://www.famfamfam.com/lab/icons/silk/

More on Peter Sunde, Stallman and Lula

Pablo Lorenzoni on his blog, Nardol, has two good posts on Brazilian President's visit to FISL.

The first, explaining the preparatives for the presidential visit on
FISL10 day 21
And the second telling about the visit itself, on:
FISL10 day3 - the day I met the Presidento
This one, specially, had two good parts which deserves note, the first is the picture which shows what I had told on "Stallman and Pirate meet Brazilian President":



At the front layer, you can clearly see, from left to rigth, Peter Sunde (green jacket), Richard Stallman (red shirt) and Mr. Luiz Inacio Lula da Silva, the Brazilian President.

And the second part from Nardol, is the transcription of part of the President's speech, which I do reproduce here:
“I remember the first meeting we had at Granja do Torto [which is the presidential country residence – similar to Camp David, but less aristocratic], in which I understood absolutely nothing about what these people were discussing, and there was an enormous…

EIDORS

EIDORS: Electrical Impedance Tomography and Diffuse Optical Tomography Reconstruction Softwarehttp://eidors3d.sourceforge.net/



This was found at: http://web.me.com/chibaf/math/octave/
Apparently, EIDORS works with both, matlab and octave.

I have to remember to also check https://staff.ti.bfh.ch/sha1/fem.html

Compiling win32 binaries on linux

Old habits are hard to be dropped.

As a long term linux user I fell much more comfortable using my old emacs text editor with a good old "green on black" Xterm terminal console window.

So we have some legacy code here on my current job, those which must run also on windows. I was making some improvements on it, porting to use wx-widgets, compiling and using it on linux. But some windows users started to want those improvements on their widows versions. As the only WX programmer around, I was the only person able to compile the windows version. As I think future improvements would also be wanted by the windows users, I decided to deploy a windows wxDevCPP installation on wine on my linux workstation.

Well the first steps are simple:
First get a wx-DevCPP installation executable onInstall it using wineOpen your .dev files on wxDevBuild itNow you have a Makefile.win, which can be used to directly compile win32 binaries.
A batch file could also be written to make things easy:
compile.…

Watching history

Well it actually happened, as I was foreseeing, Richard Stallman and Peter Sunde had met the Brazilian President.
Sérgio Amadeu wrote on the blog trezentos:
Mariel Zasso took a picture of Lula with Peder Sunde, one of Pirate Bay's founders. The Brazilian President defends the freedom on the internet and importance of collaboration. He said on his speach, after meet Richard Stallman, Marcelo Branco, Mad Dog, Mario Teza, Pablo, Sergio Amadeu, Marcos Mazoni, Marcelo Tossati, Peter Sunde, Bruno Souza among other: “the internet must still ”… “On my government is forbiden to forbid.”…”The fredom is source of the creativity”.

I was there, and the president's speech was really impressive.
P.S.: Lula had also met Karlison Bezerra ;-)

Stallman and Pirate meet Brazilian President

Today's afternoon Peter Sunde (from Pirate Bay) and Richard Stallman (FSF) will meet Luis Inacio, the Brazilian President on the biggest Free Software convention on Latin America, the International Free Software Forum (FISL).
Stallman and Peter Sunde, both had talks on FISL's 10th edition (#spectrial - How piracy became theatre, The Pirate Bay uncovered, The Danger of Software Patents, Copyright vs Community) and today's news on the presidential audience leads us to foresee the obvious meting.
This year's FISL is the biggest of all times, with 8157 attendees and still counting, it has talks on 6 diferent builngs trought the University Campus.
And we start getting the twitts about the presidential visit.

NeHe lesson 40 fix (at least for my setup)

I was trying to compile the Dev-Cpp example of the nehe.gamedev.net Lesson 40, and I was always ending up with:

NeHeGL.o:NeHeGL.cpp: undefined reference to `ChoosePixelFormat@8'
NeHeGL.o:NeHeGL.cpp: undefined reference to `SetPixelFormat@12'
NeHeGL.o:NeHeGL.cpp: undefined reference to `SwapBuffers@4'
collect2: ld returned 1 exit status
*** [MinGW/Lesson40.exe] Error 1

I had spend hours thinking the problem was with my Dev-Cpp setup, but after googling onChoosePixelFormat, one of the functions on with I was having troubles, I found at msdn that this function is a gdi32 function, and the .dev file was missing this on the linker entry

I have checked and my Dev-Cpp setup had the libgdi32.a in the same folder that I also had libopengl32.a and libglu32.a so, I made the assumption that this lib should also be linked during the compilation. I did some tests just adding the -lgdi32 on the command line compilation and SUCESS! So I was just needing to make Dev-Cpp also generates the approp…

Who runs more?

I've finally finished the visualization for my grad school visualization class. We had to use data sets from the UCI Machine Learning Repository. I have choose the auto-mpg data set, which has data concerns city-cycle fuel consumption. This particular data set has 398 tuples with 9 attributes.

So I've decided to show which motor model (number of cylinders) runs more with one gallon.

The visualization is just bellow. I had computed the data using simple PHP scripts with PostgreSQL sql queries. With gnuplot, I plotted the output of the script, saving the plots as SVG files, which, using inkscape, I've made the proper manipulations to get this work.

Mutexes and Conditions

I was googling around looking for some examples on mouse handling with the SDL library and I've found this interesting tutorials site:

http://lazyfoo.net/SDL_tutorials/index.php

I've found the mouse handling examples, but there were some other interesting examples.

There are three good examples on concurrent programming:
MultithreadingSemaphoresMutex and ConditionsPerhaps the one which had called my attention monst was the "Mutex and Conditions", because of the possibilities on "Discrete Event Simulation".

Here's a Nickel, Kid

Ryan Tomayko has a blog entry on an old comic strip used as the cover of the book "Advanced Programming in the UNIX® Environment".

Elegant XML parsing using the ElementTree Module

Mark Mruss, from the learningpython.com, wrote an interesting article on an "Elegant XML parsing using the ElementTree Module". I had a little project on my job on which I had to read some XML data and make some reports with them. I am using PHP to that, but after reading this Mark Mruss's article, I am regretting not have started with Python since the begging.
"XML is everywhere. It seems you can’t do much these days unless you utilize XML in one way or another. Fortunately, Python developers have a new tool in our standard arsenal: the ElementTree module. This article aims to introduce you to reading, writing, saving, and loading XML using the ElementTree module.IntroductionReading XML dataListing 1Listing 2Reading XML AttributesWriting XMLListing 3Writing XML AttributesReading XML FilesWriting XML Data to a FileReading from the WebConclusion"Read the entire article at learningpython.com

Soft body deformation

The wikipedia has a short entry on "Soft body dynamics" but it cites this interesting framework called SOFA.
"SOFA[1] is an Open Source framework primarily targeted at real-time physical simulation, with an emphasis on medical simulation. It is mostly intended for the research community to help develop newer algorithms, but can also be used as an efficient prototyping tool or as a physics engine." [1]
It is also multi-platform. As soon as I have some test written, I will put some shots here.

[1] SOFA (Simulation Open Framework Architecture). (2009, March 26). In Wikipedia, The Free Encyclopedia. Retrieved 14:01, May 7, 2009, from http://en.wikipedia.org/w/index.php?title=SOFA_(Simulation_Open_Framework_Architecture)&oldid=279736872

Investments

A friend of mine told me about this http://www.marketiva.com, a web site for trading of finantial instruments. I didn't read all the docs yet. Their client tools runs only on windows - bad start :-(

The "about" section of their home page says:
"Marketiva is a financial services corporation specialized in providing traders with high quality online trading services. With a team of dedicated financial specialists and technical support personnel, Marketiva operates globally as a market maker and principal counterparty to retail traders. ... ."
My friend told me this marketiva gives the investor 5 dollars to start, closes your position automatically if you loose more then 1%.

There are other sites for trading financial instruments, like http://forex.com, but as he says, marketiva is a good to start because it is the one who protects most the investors. The others, as he said, are "spanking cats" ;-)

As-Rigid-As-Possible Shape Manipulation

This morning on the animation class I am taking at grad school, a colleague had shown a paper review on "As-Rigid-As-Possible Shape Manipulation" [1]. I've found that is awesome... There are many applications for this new approach on shape manipulation. There must be someone to write a inkscape extension using this technique.


[1] Takeo Igarashi, Tomer Moscovich, John F. Hughes, "As-Rigid-As-Possible Shape Manipulation", ACM Transactions on Computer Graphics, Vol.24, No.3, ACM SIGGRAPH 2005, Los Angels, USA, 2005. PDF

GLGlobe - free OpenGl Globe-Earth simulation for linux

I was googling around for some code to use on my next work for the visualization class at grad school, and I found this interesting code.
http://www.geocities.com/harpin_floh/glglobe_page.htmlThe web site says it could not compile on my machine, but it did! The code is not too much complex and this could be used in a variety of ways.

Here is what I've got:

Converting charset enconding of a bunch o .tex files

A friend of mine came to me asking for a simple way to convert the charset encoding of a bunch o LaTeX files. He had all his files in the UFT-8 encoding and he wanted to convert all of them to "latin-1" (ISO-8859-1).

So, I saved all the files he sent me in the same folder, opened a terminal shell window and typed the following command line:

ls -1 *.tex | while read line ; do iconv -f utf-8 -t iso-8859-1 $line -o "latin1_"$line; done

And voilà, they were now encoded with ISO-8859-1.

Open GL Surface Deformation

Pettry rendered LaTeX equations using PHP

When I was writing a simple scientific webapp, during my undergrads studies, I needed to generate some equations to be shown by the app. I was already familiar with LaTeX equation formatting syntax, so I decided to use this nice peace of software.

So, after "googling" a little, I found the imgtex, written by Koji Nakamaru, which is a fast CGI script, written in perl. What I did, was port it to PHP.

To run it, you must have a LaTeX distribution and the dvipng software both installed on the same machine which you will run the PHP script.

Here is the PHP code:


To use this code, you just have to pass the LaTeX commands through GET to the PHP. For example,
adding the following string to your URL:

http://localhost/imgtex.php?res=300&cmd=x=\frac{-b\pm\sqrt{-4ac}}{2a}

The res variable sets the resolution for the generated image and the cmd specifies the LaTeX command. This way, the above URL will produce the following image:

Finally, something could replace my Moleskine

Engaged came with article describing a new netbook from Lenovo, with leather cover. The Pocket Yoga is been keeped in screet by Lenovo.


Perhaps, with one of this, I could drop my Moleskine.

PHP + GNU Octave to build a web based pump dimensioning system

During my undergrad studies, when I was doing the fluid dynamics class, we had to dimension pumping systems. The work involved in doing that used to be laborious, many coefficients, constants, etc, and we had to use only our scientific calculators. To check our answers when in home, everybody used to wrote their own spreadsheet. As a FLOSS enthusiast and long time PHP programmer, I decided to write a web based pump dimensioning system.


As we calculated the fluid density depending on watter temperature, and we had used small numbers (E-5) which lead to underflow errors when the calculations were did using only PHP statements. In other hand, when using GNU Octave, the precision was great and things were much easy, because I didn't really needed to care about precision, was just type the calculations, press enter and get the right answer.

So I wrote a PHP function that calls the exec command to run GNU Octave and get back the Octave output into one PHP variable. That way I got all calc…

A new google product

How about a new google product? A google which finds our personal stuff, things which we have lost inside the house, office, workshop, etc ... I never find my keys when I am in hurry.Perhaps we should suggest it to “Amigoogle” (translates from Portuguese to Googlefriend) from the Brasilian comic strip Nerdson.