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
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:
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"
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:
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…
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.
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.
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).
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…
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.
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.
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.
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.
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.
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.
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.
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.
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…
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.…
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 ;-)
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…
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.
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".
The wikipedia has a short entry on "Soft body dynamics" but it cites this interesting framework called SOFA. "SOFA 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."  It is also multi-platform. As soon as I have some test written, I will put some shots here.
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" ;-)
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" . 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.
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.
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
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:
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…
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.