Skip to main content

Posts

Showing posts from 2011

Resizing images and generating animated gifs

After writing my last posts (Plotting memory usage on console and More trickery with gnuplot dumb terminal), I had to put here some lines used to make the screenshot I'd put there.
To resize all screen shot frames:

ls -1 *.png | cut -d . -f 1 | while read line ; do convert $line.png -resize 60% $line.mini.png; done


In stead of resizing the image, they can be cropped: ls -1 *.png | cut -d . -f 1 | while read line ; do convert $line.png -crop 400x270+92+37 $line.mini.png; done
To make the animated gif
convert -delay 100 -loop 0 screenshot0*mini.png screenshot.gif

More trickery with gnuplot dumb terminal

In my post "Plotting memory usage on console" the chart doesn't pan the data.
Now, using a named pipe, the effect got a little bit nicer.
First, we have to run the memUsage.sh script to get a file filled with memory usage info:
./memUsage.sh > memUsage.dat &
Then we have to create a named pipe:
mkfifo pipe
Now we have to run another process to tail only the last 64 lines from the memUsage.dat
while [ 1 ]; do tail -64 memUsage.dat> pipe; done &
And now we just have to plot the data from the pipe:
watch -n 1 'gnuplot -e "set terminal dumb;p \"pipe\" with lines"'
And that is it!

Plotting memory usage on console

This is just a simple hack to play around with gnuplot set to dumb terminal (character console), doesn't meant to be serious application.
First I had written a bash scritp to log memory usage a while ago:

So, while running this script in background (./memUsage.sh > memUsage.dat &), logging the data, the memory usage information can be plotted with gnuplot and watched in real time:
watch -n 1 'gnuplot -e "set terminal dumb;p \"memUsage.dat\" with impulses"'

The chart can be plotted with lines, with impulses or any gnuplot style option.


ftdi232 permission on Ubuntu

I'am using the ftdi chip with bitbang mode to control some hardware with linux.
Every time I copy my software to a new desktop, it always take me hours to figure out why it has no permission to run the bitbang mode as a regular user.
Every website or forum I look around tells me about the udev, but I check back on the working desktops and there is no udev rule for the ftdi hardware. And after trying to force permissions with chgrp and chmod directly on /dev/bus/usb/* I figured out that I had to master at least a little about udev rules.

Checking with a little more care at a working machine I´ve found a Virtualbox instalation which created a udev rule for the virtualbox usb driver. Changing that rule to be used with the FTI chip I do the following steps, with had worked perfeclty:

Create the file /etc/udev/rules.d/10-ftdi.rules

Write on it:
SUBSYSTEM=="usb_device", GROUP="dialout", MODE="0664"
SUBSYSTEM=="usb", ENV{DEVTYPE}=="usb_device&q…

powerpoint slides to jpeg

Looking for some way to convert power point slides to JPG, I've found this site:

http://www.commandlinefu.com/commands/browse

It has tons of good linux command line tips.

And here is the tip about the pdf to jpg which brought me there:

http://www.commandlinefu.com/commands/view/719/convert-pdf-to-jpg

And to convert the powerpoint to pdf before, one can issue the unoconv command:


unoconv -f pdf slides.ppt

Books

Tonight I was home alone with my kid. Fortunately for us (the kid and me) our PC is connected to the TV set. So, he watched his favorites DVDs, while I had Google Reader in play mode with slide show enabled and side by side windows.

After playing the DVDs a dozen times, Google Reader showed this e-book post.

PostgreSQL is my database of choice, so this book will be very appreciated.

The PostgreSQL e-book is at: http://www.commandprompt.com/ppbook/

JavaScript Pie charts

Considering the "Warning against using pie charts", I'm needing to produce a couple of jquery/json ajax enabled piecharts within a simple webapp I'm designing.

There are some sort of ready to use examples:

Using various javascript libraries to create pie chart

JavaScript charts | Pie charts

Flash Calendar V2.0 to iCal

The organization where I work uses a Flash Calendar to show holidays, special day activities and other public calendar. The Flash Calendar loads its events from a XML file which, in our case, is keeped really up to date. So I was willing to view those events on my Google Calendar screen, to better plan my meatings and so on.
After that, I had written a small wrapper to parse the XML and echo iCal output. It still not fully compatible with Flash Calendar XML, but for the uses of my organization is enougth.
I did put it on github.
https://github.com/filipi/swfcalendar2iCalWrapper

Tron CSS theme

After two posts about the last Tron Legacy movie (Web Fonts, emacs, Tron Legacy and Interface design), and trying to make a Tron theme for my web apps. I decided to google for a Tron CSS theme... Wasn't a surprise Google came with Sassy Tron Theme, which includes the movie's touch keyboard entirely written with CSS.

Design Stencils

We need to develop some interface sketch at one of our labs.
So would be good to have a collection of gui stencils to draw it in inkscape.

Yahoo has a beautiful stencils collection at: http://developer.yahoo.com/ypatterns/about/stencils/

And there is also the Axure at:
http://www.axure.com/widgetlibraries#Widget_Libraries

More on cross-compiling (Codeblocks targets)

Following two old posts (Cross-compiling windows applications under linux with wine and DevC++ and Compiling win32 binaries on linux) here another post on cross-compiling windows applications on linux.
DevC++ has apparently been droped by its creators, as it has been years since its last release. After that I am willing to migrate some projetcs to Codeblocks. To not loose to much productivity, I am using a windows vitual machine (Virtual Box) to compile my windows projects, with DevC++, Codeblocks and Borland C++ Builder.
But what I want most is to do everything from my emacs window. Until I can do it so, I am using Codeblocks which is a multiplatform IDE, running on Windows, Linux and Mac.
Codeblocks has a target option to its projects. One can set diferent target platforms for the same project. The same project can be opened on diferent Codeblocks versions, linux and windows for example, and, with the propoer target configuration, be compiled for windows and for linux even folowing dif…

plaNETlab

Working in multiple labs sometimes worth new infos on different knowledge areas. As I am at LAD every Wednesday and Friday at afternoon, people there always came with news on high performance computing. Today, one former student visiting the lab told me about the PlaNETLab project, wich is s a global research network that supports the development of new network services. There are hosts spread trough many countries as shown on their map.

Interface design

I am not a designer... much worst, I am an engineer. But I was always fascinated with beautyfull interfaces designed for movies. In speciall from last movies like Tron Legacy, Iron Man 2 and Avatar and one a little dated, LCARS from Star Trek.

Googling a little on "lcars avatar tron iron man interface design", I've found some awesome links:

Interesting user interfaces from sci-fi movies & tv?
http://ux.stackexchange.com/questions/998/interesting-user-interfaces-from-sci-fi-movies-tv

Visual effects of Tron: Legacy and beyond – conversation with GMUNK
http://www.pushing-pixels.org/2011/06/01/visual-effects-of-tron-legacy-and-beyond-conversation-with-gmunk.html
TRON Board Room
http://work.gmunk.com/#1190825/TRON-Board-Room

Iron Man 2 Case Study
http://perceptionnyc.com/node/68
http://www.behance.net/jose_ortiz
http://www.behance.net/gallery/IRON-MAN-II-Molecule-Discovery/573381
http://www.behance.net/gallery/IRON-MAN-II-Hologram-Armor-Suit-Development/570107
http://motionographer.co…

Web page test

An old friend which is working for an high volume web site just pass by for a short visit. Chatting a little about simple technicalities he gave me a tip about a web site which gives statistics about site performance.
http://www.webpagetest.org
They access your web site, from a location and web browser of your choice and give back to you lots of statistics about download time of your web site.
I have tested this blog, the results are at http://www.webpagetest.org/result/110602_F6_R879/ And the IDEIA's web site restuls: http://www.webpagetest.org/result/110603_73_RDWS/

Using ffmpeg to encode a high quality video

I had acquired some high quality images and was willing to encode them into a video, but ffmpeg default settings was always outputting a ugly video which had 1280x720, but with lots of artifacts.
After googling a little, I've found:
http://stackoverflow.com/questions/3561715/using-ffmpeg-to-encode-a-high-quality-video
Digging a little more on the comments I've found: You need to specify the -vb option to increase the video bitrate, otherwise you get the default which produces smaller videos but with more artifacts.Try something like this:
ffmpeg -r 25 -i %4d.png -vb 20M myvideo.mpg
So, the key was the -vb flag!

ffmpeg -i Image-%d.jpg -s 1280x720 -aspect 16:9 -r 24 -vb 20M teste.mp4

Web Fonts, emacs, Tron Legacy

After read the jtnimoy blog, about how emacs got into Tron Legacy. I had noticed he had embedded a beautiful typeface on his site and I started to pay some attention on web fonts and the new Google service "Google Web Fonts".
They have a good collection of fonts available under an open source license.

Getting which browser access your site, from apache's logs

I am developing a small web based system to run inside my sector here where I work. I had spend some time to make it compatible with the majority of web browsers available. I'm still not using html 5 and rendering dynamic graphics to png to display on Internet Explorer browsers. Even the PNG transparency is fixed to a solid background color for better rendering on Internet Explorer 6, so I decided to check which browser my colleges are using to access this small system.
To do it so, I used the follow line on my server's console:
cat /var/log/apache2/access.log | cut -d "\"" -f 6 | sort | uniq

Which had returned:

GbPlugin
Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; InfoPath.1; InfoPath.2)
Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; InfoPath.2)
Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; .NET CLR 2.0.50727; .NET CLR 3.0.04506.30; .NET CLR 3.0.4506.2152; .NET CLR 3.5.30729; InfoPath.2)
Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; Trident/4.0; SL…

How to create stacked area graphs with Gnuplot

Marco has a nice tutorial showing how to make stacked area charts using Gnuplot.
http://freesoftware.zona-m.net/how-to-create-stacked-area-graphs-with-gnuplot/

jquery plugin for mind mapping

Looking for some jquery plugin for mind mapping, I've reached a stakoverflow conversation:
http://stackoverflow.com/questions/1374149/jquery-mind-map-think-map

And there is a cool demo here re-written with jquery:
https://github.com/kennethkufluk/js-mindmap

Last version (pure javascript)
http://kenneth.kufluk.com/google/js-mindmap/

And another tool, also interesting which worth a future review:
http://thejit.org/demos/

RRDtool, MRTG, Tobi Oetiker

Tobi Oetiker has created two good tools for visualizations, th MRTG and the RRDtool. Both realy worth attention for their performance and in special the RRDtool for its versatility.


Changing SVG with inkscape from command line

One can do more than simple convert vector to raster drawings with inkscape from the command line. In fact, there are other tools if the goal is just converting files, as rsvg and convert.

With inkscape, is also possible to change the drawing, using verbs.

From the inkscape man page, we can find the folowing example:
Duplicate the object with id="path1555", rotate the duplicate 90 degrees, save SVG, and quit:
inkscape filename.svg --select=path1555 --verb=EditDuplicate --verb=ObjectRotate90 --verb=FileSave --verb=FileCloseGoogling a little on inkscape "--verb", I did find more examples, a list with the available verbs and details from the inkscape wiki.

On Tuftefying gnuplot

Marcus Ritt has a nice tutorial on how to make gunplot graphics a little more Tufte.
http://www.inf.ufrgs.br/~mrpritt/doku.php?id=tufte

And Technolope also has some considerations on Tufte and gnuplot.

Latex following Edward Tufte

I was putting some sparklines at an web app I am designing. I am using the "Sparkline PHP Graphing Library" which is a well written PHP library for generating the famous sparklines created by Edward Tufte. So I was wondering which another advice I could pick up from Master Tufte... I went googling arround for Edward Tufte and a bunch of links came up but, the one which most called my attention was a Tufte-inspired LaTeX class for producing handouts, papers, and books. The samples provided by the web site are really well designed.

Javascript, visualization and statistics (Protovis and Jstat)

Last week I got faced with two very interesting libraries.
Protovis
Protovis uses JavaScript and SVG for web-native visualizations. Protovis composes custom views of data with simple marks such as bars and dots.



Unlike low-level graphics libraries that quickly become tedious for visualization, Protovis defines marks through dynamic properties that encode data, allowing inheritance, scales and layouts to simplify construction.

jStat jStat is a statistical library written in JavaScript that allows you to perform advanced statistical operations without the need of a dedicated statistical language (i.e. MATLAB or R).

Read Write Web has also an article about other 20 JavaScript Libraries for Data Visualization

Acer Aspire One BIOS Recovery

From (http://macles.blogspot.com/2008/08/acer-aspire-one-bios-recovery.html)
The Acer Aspire One has a built-in BIOS recovery routine, which can boot into a minimal BIOS environment via a special boot block to re-flash the BIOS, even if the system does not pass POST and does otherwise not boot anymore. This procedure is also known as Crisis Disk.

First format an USB flash drive with FAT. It does not need to be bootable.

Download the latest BIOS, and extract all files. Put both FLASHIT.EXE and the BIOS file with FD suffix in the root directory of the flash drive. The files must not be in a folder. Rename the BIOS file to ZG5IA32.FD before proceeding. It only works with this exact filename.

Turn the AA1 off, and verify both battery and AC adapter are plugged in.

Press Fn and Esc simultaneously, keep them pressed and press the power button. Release Fn+Esc after a few seconds. The power button starts blinking at this point. Press it once. The AA1 will now access the files on the flash drive an…

Open Source Your Rave with OpenLase

Open Source Your Rave with OpenLase: "
Without a doubt, Laser Projectors are a great way to project large, bright images on any surface you can imagine. With a high enough quality projector and software package, excellent images and visualizations can be displayed in real time. [marcan], of the openkinect project, decided that there were not any open source laser projection packages out there that suited his wants or needs, so logically he decided to write his own. Because home-made laser projectors often use the audio out port of a PC, building the framework on top of the JACK unix sound software to control the hardware made perfect sense. OpenLase includes plugins for audio visualizations, 2D and 3D gaming, as well as converting video streams into laser format in real time.
Be sure to check out the Chaos Communication Congress presentation [marcan] gave after the break, as well as all the extra demo videos on his website.

How to fix Emacs 23 Huge ungly font on Lucid

Since I've upgraded to Ubuntu 10.04 (Lucid) Emacs 23 now has beautiful antialiased fonts, but I like the old bitmaped X11 "fixed" font. I do use a .Xresources file to setup emacs default font.
This is my emacs section at .Xresources !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ! emacs, xemacs
!emacs*Background: DarkSlateGray emacs*Background: Black !!!emacs*Foreground: Wheat emacs*Foreground: White emacs*pointerColor: Red emacs*cursorColor: Red emacs*bitmapIcon: on emacs*font: fixed !!!emacs*font: 9x15bold !!emacs*geometry: 100x40+20+20
But for my surprise using this setup emacs launches with a ugly huge serif font.
I tried to launch emacs with -fn fixed but the ugly font did still there.
So I checked at my /etc/X11/fonts/misc/xfonts-base.alias, which is the file where fixed font is declared. And it was there: fixed -misc-fixed-medium-r-semicondensed--13-120-75-75-c-60-iso8859-1 And which had called my attention, was that 6x13 font alias had the same properties as the fixed: 6x13 -mi…

Extended desktop at the login screen in ubuntu

I have an ATI Raden dual head at my desktop here at my job. I like to use WindowMaker as my window manager of choice, but since I had upgraded to Ubuntu 10.04 Lucid, WindowMaker is showing some issues regarding the dual monitor setup. WindowMaker follows the login screen (GDM) monitor setup and when I launch a gnome-session, things get messed up.
The first solution which came to my mind is to make gdm aware of the two monitors.
"Googling" around I've found two usefull links: https://help.ubuntu.com/community/MultiseatOneCard http://ubuntuforums.org/showthread.php?t=1611704
Following the first section of the first link ("Extended desktop through both monitors") I've wrote my new xorg.conf file: Section "Monitor"
Identifier "monitor0"
EndSection

Section "Monitor"
Identifier "monitor1"
Option "RightOf" "monitor0"
EndSection

Section "Device"
Identifier "card0"
Driver …