Thursday, November 19, 2009

The essence of Python




That's brilliant and a picture of why Python's so cool!
Image by XKCD
Follow the XKCD webcomic for more comics about romance, sarcasm, math and language.
XKCD updates every Monday, Wednesday and Friday

Tuesday, November 10, 2009

How to recover from adobe-flashplugin crash in Ubuntu

It’s been a while since I wrote my last post. Some times it seems I’m gonna dissapear but that’s not the case, I’m over busy lately and it’s just too hard to find the time to write a decent article.
Anyway, the joint effort of Ubuntu 9.10 Karmic Koala and the official Adobe Flash plugin provided me with some inspiration.
After installing the Koala I spent some time to install the various software and plugins I usually run on my Linux distro. To my greatest surprise the official Adobe Flash 10 plugin crashed during the installation and by doing so it caused an interesting, albeit annoying, fault in the system. Following the package crash I basically experienced all the package management frozen at Kernel level (at least in graphical mode). I couldn’t run Synaptic, I couldn’t run the update management interface and all this was quite scaring.
At first I timidly try to run ~$ apt-get upgrade and got apt snort something like “impossible to find a file for the package adobe-flashplugin. It could be necessary to fix this package manually” or something like that. At this point I was genuinely worried and began to surf the web in search of answers.
To my surprise I found a discussion within an Italian forum and someone proposing a “dirty” way to fix this problem. I took the same steps and solved the problem, thus I propose the same solution to you, in case this package should play the same mean trick to you.
Before just a quick disclaimer. This is a dirty solution and, by no means, certified by anybody. I think it’s fairly safe and, in the end, even healthy. Anyway it worked for me and caused no perceptible problem so far. Proceed at your own risk!
If at this point you’re still stuck and I failed to scare you, it’s time to get some work done.
open the terminal and ~$ cd /var/lib/dpkg/
backup a file called status (you can do it in graphical mode if you’re more confortable)
Now ~$ sudo gedit status
In gedit look for the item “Package: adobe-flashplugin”. There should be several lines of references and options. Delete everything in this group as it was never meant to exist.
Save and exit.
Now a good ~$ apt-get update
And a refreshing ~$ apt-get upgrade
And you should good to go.
Have fun and beware the Ouch! Got SIGABRT, dying..

Friday, October 23, 2009

My Praise to Amazon.com

This could seem a fan boy post but it's something different actually.
Here's why-  Without delving deeply into what's my "view", generally speaking I tend to see the market as a tool. A system of tools and procedures which emerged in human history as the most efficient way to regulate exchanges among humans. By exchanging goods and services humans can -theoretically- acquire advantages, something they need, the resources to reach a scope and so on. You can go on generalizing until reaching the concept of markets like a system to propel progress to the human race. Passing from theory to practice -very down to earth- and narrowing the scope of our lens, markets can be used by the agents to generate resources either by exploitation (of other agents) or by creating a wealth spyral sticking toPareto efficiency as much as they can.
If you're wondering what has all this to do with Amazon, then you should try to suppress your yawns and go on reading.
I'm an Amazon customer since several years and I have always kept a not-so-casual look to their evolution as a company. The technological advancement of their store is really interesting because while sticking to a simple layout (even if not so gorgeous or clean) in the years they introduced some functions which are now considered a must for mass market oriented web stores. Just think of the whish list, the product rate, the reviews, the recommendations, the goods tracking, the customer generated reviews and so on. If you take a closer look you will also realize that all these improvements aren't just decoys to lure consumers to buy products but are tools created to serve the users (here's a fundamental change of terms), as much as a good shop assistant (so rare a resource these days) could do.
Keeping on the same direction we find the Amazon Kindle, which represented if not the first, the most successful e-book reader device. They marketed 3 version of the Kindle in the U.S. so far and recently they introduced the last generation of the Kindle to several countries worldwide. Even if the device is not deprived of conception defects, it’s generally a well designed, solid and sleek device well integrated in an outstanding bookselling platform.
And now we come at the very reason which pushed me to write this brief post to express my praise to Amazon as an example of a company which is able to produce wealth and benefits either for its shareholder or for its stakeholder and customers.
Yesterday I received this e-mail from the Kindle Support Team.
Hello,
Good news! Due to strong customer demand for our newest Kindle with U.S. and international wireless, we are consolidating our family of 6" Kindles. As part of this consolidation, we are lowering the price of the Kindle you just purchased from $279 down to $259. You don't need to do anything to get the lower price--we are automatically issuing you a $20 refund. This refund should be processed in the next few days and will appear as a credit on your next billing statement.
We'll also send you a follow-up e-mail to confirm the refund once it has been completed.
We hope you enjoy your new Kindle. Please send us your feedback at: Kindle-feedback -at- amazon -dot- com

Sincerely,
The Kindle Team
I think there’s no need to comment it. It summarize why I’m still an Amazon customer after something 10 years or so.

Sunday, October 18, 2009

I got Wave!!


I got Google Wave!
I'll write about this wonderful new social and communication tool from Google later, but for now I must thank my friend Mirthis so much for providing me with an invitation to the Wave.




Saturday, October 10, 2009

My birthday gift


Happy birthday to me!
Here's what I bought for my birthday (finally shipped to EU)
Kindle Wireless Reading Device (6" Display, U.S. & International Wireless, Latest Generation) - can't wait to get my hands on it!!!




Image's copyright of Amazon.com, Inc.

Thursday, October 8, 2009

The beginning of Linux


This is the beginning.

torvalds@klaava.Helsinki.FI

Thanks to Linus. For all

Tuesday, October 6, 2009

The Best Beer in America


If you're a statistics and infographics lover as I am, then you should check Cool Infographics blog to have your regular treat. If you're also a beer maniac then this cool poster will make you happy.
Mike Wirth calls himself a designer, educator and artist and with good reasons! He does his art starting from statistics to create a good looking and striking way to present data concerning different domains.
In this case it's beer.
It happens that he collected data from Great American Beer Festival medal winners (1987-2008) and used them to update the original 2008 map with new helpful charts to show the best and worst breweries divided for each state of the Union based upon the number of medals won. So you discover that if you plan a beer cultural trip, then Colorado, California and Wisconsin are the 3 top states you wanna visit. Always according to the map you should spare time by avoiding Oklahoma, Lousiana, Missisipi and the Dakotas unless you want to discover some hidden treasure overlooked by the festival jury. Another interesting graphics are the histograms showing the best American breweries with each bar as the composition of the amounts of bronze, silver and gold medals won.
Great work Mike!

Monday, October 5, 2009

Noisebridge hacker space

I stumbled upon this awesome geek community called Noisebridge. It's a hacking den and a work space spawning lots of interesting projects belonging to various fields of technology and science.
NoisebridgeNoisebridge takes inspiration from famous European hacking spaces like Metalab, CBase, MAMA and ASCII and shares its DNA with many of the other hack clubs around the world pin pointed by Hackerspaces.
Noisebridge is an educational non-profit corporation, 501(c)3 public charity status. We provide infrastructure and collaboration opportunities for people interested in programming, hardware hacking, physics, chemistry, mathematics, photography, security, robotics, all kinds of art, and, of course, technology. Through talks, workshops, and projects we encourage knowledge exchange, learning, and mentoring.
At Noisebridge they have someting for every geek's taste. You like playing video games, you want to learn a programming in Python, the chinese language,how to hack locks and to speak to deaf people, and so on...
One thing that struck me was Sensebridge which is the group dedicated to cyborg group. Their motto is "If you can't beat the robot armies, join them." and they work on projects to enhance human senses or feeding sensitive information which shouldn't be accessibly to human biology. Among their projects there's a compass vibro-anklet, a Ultrasonic Hearing / Echolocation, a Technicolor Dreamcoat and more.
Here's the list of  senses humans don't possess and could be implement in cybernetics projects.
* Magnetism, magnetic north
* Electric Fields, voltage & amperage (of which we are not a part)
* Echolocation/Radar
* Accurate absolute range finding
* Ultraviolet/Infrared
* Spectroscopy
* Inaudible Sounds
* Radiation Level
* "Tremorsense" (or telling the location of movement through vibrations in the ground)
* GPS location
* Non-accelerating motion
* Accurate angle detection
Enlist today for the Cylon converter project! :P

Sunday, October 4, 2009

The Treat of the Week #008


You think Planet of the Apes came from nothing? Everything in the world is based on something. That's why Open Source is so vital. People continuously grab inspiration from works of other people to fed their imagination and create more work of art, science, technology, etc...
I don't really know if this sculptures by Emmanuel Frémiet gave inspiration to the creators of Planet of the Apes or King Kong, but the fact is that the creations of this XIX century artist are both beatiful and disturbing.
The images, taken from Dinosaurs and Robots, are in order:
Orangutan Strangling a Borneo Savage [1895]
Gorilla Carrying off a Woman [1887]



Thursday, October 1, 2009

The Road by Cormac McCarthy


It's been a while since I planned to write about this book but today I've seen on the Boing Boing newsletter a link to the upcoming movie and I finally decided it was time.
The Road is a novel by the American writer Cormac McCarthy which takes place in a post-apocalyptic United States. It's the story of a father and his children struggling to survive on their journey towards the sea, a mirage of salvation in a world stripped of almost every glimpse of life.
The Road was awarded in 2006 with the Pulitzer Prize for Fiction.
the-road-cormac-mccarthy1I consider myself a sort of an avid reader and this is the second book I ever read in my whole life that was able to convey me such emotions to represent, literally, a mystic experience. I'm not joking here, I can hardly call The Road a book. It's more likeo an artifact capable to communicate with the most inner part of your self. As soon as you begin to read it you get caught in a way that has something of violent in it, you feel sometimes mentally raped; you are hit by such an emotional shock wave that you feel as if you're your world is spinning and you're losing contact with the reality beyond the book. This The Road made me feel desperation, grief, desolation and fear in such a way I can hardly say having ever felt in my life. Call me lame but at a certain point the image conveyed was so strong (perhaps because I'm a father also) that I had to shut the book in the middle of the night. I felt so disturbed that I had to move The Road away from my bed side and I felt stupid and prehistoric to act as if I had to exorcize the evil. Call me lame but I had nightmares for a whole week and I awaited three more before I felt enough comfortable to resume the reading.
As a book -a storytelling artifact- The Road is basically perfect. I don't feel comfortable to call it a work of art as because its very nature is so solid it appears as something that was never conceived, that was just there just like a rock fallen from the sky. The writing style is as barren and bleak as the world where father and son walks. The literary choices are engineered in way they are more than mere style operands, they're like code classes and functions which make the magic unravel.
The world is blasted. It's unclear what happened, it could have been a ecosystem collapse or a nuclear holocaust on a massive scale. The biosphere has gone, animals and plants have long since dead, dust has covered everything and it's whirling so thick that the sun is always covered. It's a cold bleak world. Humanity has barely managed to survive and most of the few human beings are wrecked bands of cannibals.
Realizing that they can't survive the upcoming winter, father and son decides to head towards the sea hoping to find some sort of comfort and unconsciously identifying it as the goal that makes the struggle, day after day, against the extinction constantly at their heels. The Road is full of symbolism. The father is the one which fights to protect the child and keep a walled defense of coherence against the waves of madness which repeatedly threats to overwhelm them. The child basically represents life. It's frail yet strong and so love radiating to represent even a risk to the couple own survival. They carry a gun with only two bullets which represents their last hope of salvation by committing suicide. They call themselves "the good guys" which are somehow saving the world from the "bad guys" by "carrying the fire" and they look for others of their species while they travel.
It's strange but the reader point of view is so intimate that you feel somehow like a ghost (maybe the one of the suicidal mother of the boy) which walk with them day after day, be with them as they scavenge waste and derelicted buildings in search of something to eat to prevent them from starvation. You feel you're cold sweating and panting as you're with them, crouching in the weeds trying to hide from cannibals.
You must buy The Road right now. Ask someone who owns a copy to lend it to you. Do what you can to grab this artifact then read it in the dead of the night and shiver and sob and cry. I assure you will never forget this experience.
I leave you with the trailer of the upcoming movie. At the moment I am unable to create an opinion on the base of what it shows. My sensation is that it could be a good movie but never something comparable to the book. I know everybody says that of movies based on books but if I was able to convey you even a glimpse of what is The Road or -better- you have read it, then you know what I mean. You can't recreate The Road, it'd be something like travelling through a star -physically- and then watch a movie depicting it.

Tuesday, September 29, 2009

Obama becomes Zobama.. arghh..!

Halloween is coming so I'm thinking of posting some stuff to appreciate our most loved night of the year.


Here's the first one. By surfing TeeFury website I came across this wonderful project by a designer called Jared Moraitis of Pop-Monkey. As I'm both a zombie and Obama fan, I find myself in the position of appreciating this work of art as an appraisal to one of the most influential and beloved statesman of the world modern history. If you think the tee's just offensive please read the following excertp from the designer interview at this page.

There are many possible meanings and interpretations of this design, but if you're assigning some sort of racist, hate-filled vibe to it, then I suggest you take a long walk off a short pier. This is a commentary about rabid Obama fan-mania coupled with his missteps as a new leader, as well as a commentary about appropriation art. I'll leave the details up to your imagination. This is not a photo-manipulation of that other Obama piece, though it's obviously based on it -- it's completely hand-drawn from scratch, then rendered in Illustrator

Enjoy!

Monday, September 28, 2009

The Photo of the Week #000 - bison standing aside a a road in Antelope Island, Utah

I know I look terribly lazy lately, the fact is that I'm attending a hard work course in safety of the working environments that will go up to the end of December 2009. This is absorbing a huge amount of my time, not to mention mental resources, and forcibly keeping me away from my blog :).

Anyway, given that I still have some little time to check the websites on my bookmark collector, I thougth it'd be worth publishing some stunning images I come across while I surf.

Here's the very first one whichI know I look terribly lazy lately, the fact is that I'm attending a hard work course in safety of the working environments that will go up to the end of December 2009. This is absorbing a huge amount of my time, not to mention mental resources, and forcibly keeping me away from my blog :).

Anyway, given that I still have some little time to check the websites on my bookmark collector, I thougth it'd be worth publishing some stunning images I come across while I surf.

Here's the very first one which struck me because, apart from being beautiful, the image shows an interesting combination of poetry, nostalgia, and power. It's a bison standing aside a a road in Antelope Island, Utah.

The picture's called Antelope Island and credits goes to Brian Switek of the Laelaps science blog which I advise you to read.

struck me because, apart from being beautiful, the image shows an interesting combination of poetry, nostalgia, and power. It's a bison standing aside a a road in Antelope Island, Utah.

The picture's called Antelope Island and credits goes to Brian Switek of the Laelaps science blog which I advise you to read.

Monday, September 14, 2009

Big Blue does science and does it well.
Late last August scientists of IBM's labs in Zurich succeeded in taking a shot of the anatomy of a single molecule. One belonging to a pentacene molecule to be more precise.
The wonder happened by means of an Atomic Force Microscope which works measuring the different forces between a metal tip and the target to generate an image. I used one of these microscope myself during my last job but that was for an industry application and by no means as much as sophisticate like this.
The result is simply stunning, glorious!
Just compare the two pictures below, one is a textbook model of pentacene and the other one is the molecule itself as seen by the AFM. You can count the carbon rings and spot the position on the hydrogen!
Check the images and the video below and be sure to read the full article here
3839799374_3543e7bde1_b
3839010045_b344616b05_b





Images and the video are property of IBM Research Zurich and are here published respecting their license which can be found here.
Courtesy of IBM Research - Zurich. Unauthorized use not permitted.

Sunday, September 13, 2009

The Treat of the Week #007

Here it comes.. Mega Shark vs Giant Octopus.. You can't miss this.

Friday, September 11, 2009

My PyQt Scribbles (Python and Qt) #6: Scroll widget and nested widgets

Welcome to this new episode of “My PyQt scribbles”

It’s been a while since my last post on this subject and this was because of several causes. The biggest among these it’is me; yeah because not being a professional programmer
I find difficult to find the time to delve into python programming lately. We can say that my math is x=1/y with x being my python hacking time and y my duties. And that’s self explanatory.
Anyway there’s a important reason why I think this will be the last article of the “season”. If you read one of my past article you know that Nokia decided to release the Qt library under
LGPL license enabling developers to use the library for free but in the scope of a commercial project (as far as they comply with LGPL of course). Soon after Nokia got in contact with
Riverbank Computing to work out an agreement (Riverbank business model on PyQt of selling the commercial use license for PyQt found in conflict with Nokia’s new license program).
As far as I read the agreement wasn’t reached and so Nokia asked OpenBossa to develop PySide, an alternative and official Python
implementation of Qt. As much as I am thankful to Riverbank for having ported Qt to Python thus making non commercial developers able to use Nokia’s powerful library, I think it will be more
more sensitive for the future to look at the upcoming official implementation as it will probably be more solid and better supported and stickier to the future official releases of Qt.
Coming back to our scribbles, this installment will delve a bit more in widgets arrangement, widget nesting and scrolling areas.
I must thank Christian Brugger for helping me out with a trick to nest dynamically generated widgets to a scroll widget (later you will see).
As usual I’ll post the whole code below and after that the parts with comments and explanation.


import sys
from PyQt4.QtCore import *
from PyQt4.QtGui import *

class WizAndChipsCal(QWidget):
def __init__(self, parent = None):
QWidget.__init__(self)
self.setWindowTitle("Wiz and Chips Calendar")
self.setWindowIcon(QIcon("C:/Python26/PyQt/Icon/date.png"))
self.setToolTip("Hello to this Wiz and Chips fancy calendar!")
self.title = (""
"Wiz and Chips Pushable Calendar!"
"
")
self.Label = QLabel(self.title)
self.Label.setAlignment(Qt.AlignCenter | Qt.AlignJustify)

self._labels = []
self._edits = []
self.CurrDate = QDate.currentDate()
self.calendar = QCalendarWidget()
self.calendar.setGridVisible(1)
self.calendar.setMaximumHeight(200)
self.calendar.setMaximumWidth(250)
self.connect(self.calendar,
SIGNAL('selectionChanged()'),
self.SelDate)

self.AddButton = QPushButton("&AddProject")
self.AddButton.setMaximumSize(70, 25)
self.AddButton.setToolTip("Press here to add a new job")
self.connect(self.AddButton,
SIGNAL('pressed()'),
self.AddProj)

self.summaryBox = QGroupBox("Project Management Layout")
self.summaryBox.setMinimumHeight(300)
self.summaryBox.setMinimumWidth(800)
self.summaryBoxScroll = QScrollArea()
self.summaryBoxScroll.setFrameStyle(QFrame.NoFrame)

self.summaryBoxTopLayout = QVBoxLayout(self.summaryBox)
self.summaryBoxTopLayout.setContentsMargins(1,1,1,1)
self.summaryBoxTopLayout.addWidget(self.summaryBoxScroll)

self.summaryBoxTopWidget = QWidget()
self.summaryBoxScroll.setWidget(self.summaryBoxTopWidget)

self.summaryBoxLayout = QFormLayout()
self.summaryBoxLayout.setSpacing(1)
self.summaryBoxLayout.setSizeConstraint(QLayout.SetFixedSize)

self.summaryBoxLayout = QFormLayout(self.summaryBoxTopWidget)
self.summaryBoxLayout.setSpacing(1)
self.summaryBoxLayout.setSizeConstraint(QLayout.SetMinAndMaxSize)

self.CloseButton = QPushButton("&Quit")
self.CloseButton.setToolTip(""
"Press here to Quit
")
self.CloseButton.setMaximumSize(50, 25)

GeneralLayout = QGridLayout()
GeneralLayout.setSizeConstraint(QLayout.SetMinAndMaxSize)
GeneralLayout.addWidget(self.Label, 0, 0)
GeneralLayout.addWidget(self.AddButton, 1,0)
GeneralLayout.setAlignment(self.AddButton, Qt.AlignTop)
GeneralLayout.addWidget(self.calendar, 1, 1)
GeneralLayout.addWidget(self.CloseButton, 4, 0)
GeneralLayout.addWidget(self.summaryBox, 3, 0)
self.setLayout(GeneralLayout)

self.connect(self.CloseButton, SIGNAL("pressed()"),
self.close)

def moveEvent(self, event):
self.setWindowOpacity(0.7)
QTimer.singleShot(50, self.opac)

def opac(self):
self.setWindowOpacity(1)

def closeEvent(self, event):
self.CloseDialog = QMessageBox.question(self,
"The application is being closed",
"Do you really want to quit?",
QMessageBox.Save|QMessageBox.Yes|QMessageBox.Discard,
QMessageBox.Discard)

if self.CloseDialog == QMessageBox.Yes:
event.accept()
elif self.CloseDialog == QMessageBox.Save or QMessageBox.Discard:
event.ignore()

def SelDate(self):
self.SelectedDate = self.calendar.selectedDate()
print(self.SelectedDate)

def AddProj(self):
projLabelLayout = QHBoxLayout()
projLabelLayout.setSpacing(3)
label_list = []
projTextBoxesLayout = QHBoxLayout()
projTextBoxesLayout.setSpacing(3)
edit_list = []

for name, width in [('Job No.', 80), ('Cust.Job', 80),
('Cust.Ords.', 80), ('Product', 80), ('Q.ty', 80),
('Serial No', 80), ('Quality', 80), ('Packing', 80)]:
label = QLabel(name)
label.setMinimumWidth(width)
projLabelLayout.addWidget(label)
label_list.append(label)
TextEdit = QTextEdit()
TextEdit.setMaximumHeight(20)
TextEdit.setMinimumWidth(width)
TextEdit.setTabChangesFocus(1)
projTextBoxesLayout.addWidget(TextEdit)
edit_list.append(TextEdit)

for name1, width1 in [('delivery', 80), ('drawings', 80), ('approval', 80),
('cust. mat. deliv.',80), ('mat. delivery', 80), ('end prod.', 80),
('test date', 80), ('ship date', 80)]:
label1 = QLabel(name1)
label1.setMinimumWidth(width1)
projLabelLayout.addWidget(label1)
label_list.append(label1)

DateEdit = QDateEdit(self.CurrDate)
DateEdit.setCalendarPopup(True)
DateEdit.setMaximumHeight(20)
DateEdit.setMinimumWidth(width)
projTextBoxesLayout.addWidget(DateEdit)
edit_list.append(DateEdit)

self._labels.append(tuple(label_list))
self._edits.append(tuple(edit_list))

self.summaryBoxLayout.addRow(projLabelLayout)
self.summaryBoxLayout.addRow(projTextBoxesLayout)

app = QApplication(sys.argv)
main_window = WizAndChipsCal()
main_window.show()
app.exec_()
[/sourcecode]
[sourcecode language="python"]
self._labels = []
self._edits = []
self.CurrDate = QDate.currentDate()


We create two empty lists to store the information about the rows added to the job management application. This will become clear afterwards.
We retrive the current date from the system clock to use it in our application


self.AddButton = QPushButton("&AddProject")
self.AddButton.setMaximumSize(70, 25)
self.AddButton.setToolTip("Press here to add a new job")
self.connect(self.AddButton,
SIGNAL('pressed()'),
self.AddProj)


We create a button and then set it to add new rows in our job management overview project.
To do this we must connect its signal "pressed()" to our custom slot which in this case is a function conveniently called "AddProj"

Now we create the layouts and widgets which will become the core of our job management overview. This part is tricky and involves several widgets and layout being created.
The summary is:

- We create a QGroupBox widget as base container of the other widgets
- We create a QScrollArea widget
- We create a top layout (in the form of a QVBoxLayout) for our QGroupBox widget and assign the QScrollArea widget to it
- We create a top bare QWidget to link it later to the QScrollArea
- We create a top layout for the QGroupBox and the top widget

Now in detail:


self.summaryBox = QGroupBox("Project Management Layout")
self.summaryBox.setMinimumHeight(300)
self.summaryBox.setMinimumWidth(800)


This is the space containing the dynamic list of our jobs. So we create the main QGroupBox widget and we set the minimum dimensions to control the appearance of the whole area.


self.summaryBoxScroll = QScrollArea()
self.summaryBoxScroll.setFrameStyle(QFrame.NoFrame)


Now we create the scoller itself. To do this we use the QScrollArea() class which provides a scrolling view onto another widget.
Normally the QScrollArea() just needs to take care of the widget as explained in the API, that is to say:
label = QLabel("image.png")
scroller = QScrollArea()
scroller.setWidget(label)
This is very straightforward but in our case it doesn't work because we have several widgets which are dynamically created and get nested inside another widget.
So we need a trick: we create a top widget and that's the one we want to scroll. We assign this widget to the scroller.
Imagine a cupcake. We have the cake composed of many ingredients, and this represents our job widgets.
Then we have the cup which contains the cake, and this is our top widgets.
Finally we have the kid's hand moving the cupcake to eat it, and that's our scroller.


self.summaryBoxTopLayout = QVBoxLayout(self.summaryBox)
self.summaryBoxTopLayout.setContentsMargins(1,1,1,1)


This is the top layout which will contain the scroll widget to take care of the scroll area.


self.summaryBoxTopLayout.addWidget(self.summaryBoxScroll)


now we add the QScrollArea() to the top layout.


self.summaryBoxTopWidget = QWidget()
self.summaryBoxScroll.setWidget(self.summaryBoxTopWidget)


To scroll the area flawlessly we need to create a top widget which must then be assigned to the QScrollArea.
In this way the QScrollArea will take care of scrolling the top widget which contains all the other dynamically changed sub widgets


self.summaryBoxLayout = QFormLayout()
self.summaryBoxLayout.setSpacing(1)
self.summaryBoxLayout.setSizeConstraint(QLayout.SetFixedSize)


This is the layout relevant to the summaryBox widget.
We assign our QGroupBox() to the layout, we set the internal spacing between the elements to be '1' and finally we set the size constraint policy to be sure that the widget can't
be resized at all with respect to its sizes defined at sizeHint()


self.summaryBoxLayout = QFormLayout(self.summaryBoxTopWidget)
self.summaryBoxLayout.setSpacing(1)
self.summaryBoxLayout.setSizeConstraint(QLayout.SetMinAndMaxSize)


To the same general layout we assign also the top widget and specify the size constraints


GeneralLayout.addWidget(self.summaryBox, 3, 0)


The QGroupBox widget which represents our job management overview (and contains all the other widgets and layouts)is laid out.

Now it’s the time to discuss the function that we called AddProj and that will take care of the widgets generation inside the QGroupBox.


def AddProj(self):
projLabelLayout = QHBoxLayout()
projLabelLayout.setSpacing(3)


This function is called every time the user presses the AddButton.
The job management overview is composed of rows and columns. Each row represents a job and each column represents an element related to that job.
This is clearly a very simple way to provide an overview of a series of jobs within a company.


label_list = []
projTextBoxesLayout = QHBoxLayout()
projTextBoxesLayout.setSpacing(3)
edit_list = []


We create empty lists that will contain each additional label for every job element we decide to add.


for name, width in [('Job No.', 80), ('Cust.Job', 80),
('Cust.Ords.', 80), ('Product', 80), ('Q.ty', 80),
('Serial No', 80), ('Quality', 80), ('Packing', 80)]:
label = QLabel(name)
label.setMinimumWidth(width)
projLabelLayout.addWidget(label)
label_list.append(label)
TextEdit = QTextEdit()
TextEdit.setMaximumHeight(20)
TextEdit.setMinimumWidth(width)
TextEdit.setTabChangesFocus(1)
projTextBoxesLayout.addWidget(TextEdit)
edit_list.append(TextEdit)


Here we populate the label list that we have previously created. We use the 'for' statement so that we can easily add/remove future elements to our system without the need -at least in theory- to review our design.
Each label widget will get the name and the with in sequence from the list.
Then we add each label to the label layout and we append every label to the list which is hence populated.
We make the same process for the text boxes with only two additional staps. First of all we set a maximum height for the cell.
Secondly, we use the setTabChangesFocus() property so that we can switch from one cell to the next one using the tab key.

The 'for' statement used to populate the list of elements which are used to generates the widgets for the job management part, is convenient because it helps us to write a code more elegant and concise, but it has a major drawback. Using this systme we can generate only one type of widgets because this is closed inside a loop which will simply iterate through the list and create a specific
widget for each element of the list. As a matter of fact in order to include calendar edit widgets to our job management structure we must create a second list whose elements are sistematically used to create pop up calendars.


for name1, width1 in [('delivery', 80), ('drawings', 80), ('approval', 80),
('cust. mat. deliv.',80), ('mat. delivery', 80), ('end prod.', 80),
('test date', 80), ('ship date', 80)]:
label1 = QLabel(name1)
label1.setMinimumWidth(width1)
projLabelLayout.addWidget(label1)
label_list.append(label1)
DateEdit = QDateEdit(self.CurrDate)
DateEdit.setCalendarPopup(True)
DateEdit.setMaximumHeight(20)
DateEdit.setMinimumWidth(width)
projTextBoxesLayout.addWidget(DateEdit)
edit_list.append(DateEdit)


Given that this part of the job management application concerns dates, it's more confortable for our user to input the dates by means of a pop up calendar than simply type them (with the correct format) inside text boxes. QDateEdit is the class which does the trick.
By setting .setCalendarPopup(True) we makes the calendar popping up from the widgets only when the user clicks on the specific box.


self._labels.append(tuple(label_list))
self._edits.append(tuple(edit_list))


We append the label list and the edit list to two other lists but we convert them to tuple before.

Here below you can see screenshots of the Ubuntu and Windows XP version of the application






Wednesday, September 9, 2009

Who are the white knights contributing to the Linux Kernel?


That the Linux kernel devlopment gets contributes (in terms of lines of codes) from private companies is not a secret, nor are the names of these companies.
Anyway, given that The Linux Foundation has recently released a report (here from linux.com) containing several statistics about the state of the kernel development, I think it is worth mentioning here those companies that, for whatever reason they have, are contributing, side to side by the independent developers community,  to maintain and develop the kernel which is behind our favourite operating system.
The report spans from kernel version 2.6.11 of 2005 to the latest stable 2.6.30 released inJune (the very last version is 2.6.30.5 released 2009-08-16 but that was after the report release).
One thing to notice is that the most part of the modifications are made from a small number of entities among which are independent people and many unknown entities which could be anything (maybe MS disguised people? :D)



There are many more interesting numbers to be read on the documents, like the how the company involvement has progressed since the first kernel release and so on.

Friday, September 4, 2009

The Treat of the Week #006

Cute public toilet brand. I shot this picture somewhere in this town on the Garda Lake in Italy this The words say 'hygenic services.. everywhere!' and for everyone I'd add!

Tuesday, September 1, 2009

The Ubuntu Software Store revealed

Phoronix has recently published an article previewing The Ubuntu Software Store: a rather dull name for a project which is really triggering my hype.
If you read some of my past articles on Ubuntu and Linux in general, you probably know that I consider application distribution and handling (installation/remove) one of the major drawback and “keep out sign” of the desktop oriented Linux distributions.
It’s not that the Ubuntu installation environment isn’t good, on the contrary both synaptic and gdebi are fantastic and full of potentiality. The fact is that as it happens with most community driven things sometimes the spur of productivity has a counterproductive side effect. Diversification isn’t a drawback per se but there are times when concentration can serve better when the target is an important application or system part. This is surely the case of the software installation on Ubuntu. As far as it is right now I’ve no problem to say that the user experience is awful. Installing an application on Ubuntu (and I doesn’t consider the whole Linux based distros on purpose) means dealing with multiple processes plus other random perceived factors. And that’s frustrating at the least.
Just to make some examples each time I install a Ubuntu release I always and immediately install five applications which require five different installation processes:
  • Miro player --> add repository to Synaptic packet manager then browse for Miro and install it via Synaptic
  • Truecrypt cryptography software --> download the bin, open and execute, follow the instruction of the graphic installation application
  • GoogleEarth geography app --> download the bin, open a terminal and mess with bash then follow the instructions provided by the graphic installation interface
  • Ubuntuzilla Updater for Mozilla apps --> download the .deb file, install it with gdebi, open a terminal and mess with bash then follow the instructions provided by the graphic installation interface
  • Flash player --> download the .deb file and install it with gdebi (painless double click -Windows reminder- operation)
These are just a sample because there are  several other cases where for example you must compile the software following obscure tutorials,  retrieving and install a bunch of other applications (each having its own peculiar process) to satisfy dependencies, etc…
In my opinion this is completely unacceptable.
You can imagine the smile on my face when I read that Canonical is working on a project to unify various graphical install applications in a single graphical interface.
The Ubuntu Software Store is being built on the basics of the Add/Remove Applications (which is another way, not mentioned before, to install and remove software). Surprisingly we will see the first “installment” of TUSS with limited functions shipped with the Karmic Koala October release. According to the TUSS wiki page the 1.0 version of TUSS will hit four goals:
  • a graphically pleasing interface
  • an improved use of apt: links to replace bash commands and standalone packages
  • fine-tune the interface presented when software updates are available.
  • involve Launchpad with the goal of acquiring better and up to date information about the applications
With the Ubuntu 10.04 release the TUSS team hope for their app to substitute Synaptic, gdebi, add/remove softwares, Software Sources and hopefully even the Update Manager,conveying all these systems in a common interface. Another very exciting feature which could be included in the early 2010 release is the possibility to manage non-graphical software (programming utilities, fonts, database software, etc) within the Store.
The roadmap goes until 2011 when, according to the plans, TUSS will be mature enough to include rich functions like "sharing and tracking of software, overviews of installed software by license, cost, or maintenance timetable, discovering software by what your friends have installed, visible history of past installations/removals/purchases, including the ability to undo specific changes, specialized interfaces for browsing and installing particular classes of package like fonts, screensavers, Windows applications, etc".
By reading the dedicated wiki page it’s clear that Canonical is fully aware that the way applications are handled right now it’s one of their greatest Achill’s talons. The way they are facing it it’s something that make me proud of running Ubuntu as my first and main operating system.
Despite all the smaller and bigger problems user constantly face (nearly all of them are caused by the scandalous and evil lack of support from hardware manufacturers) Ubuntu (as many other Linux distros) is capable of beam the user with a sense of pleasure in using it which is generated by the stability and safety you clearly perceive in everyday usage. More than that, the continuous improvements are introduced in each six month release and make you feel on the edge of technology and part of project that, because of its scope and vision, is good and brings welfare to the people who use it and mankind as a whole.
Having said that I'm really impatient to see the first release of The Ubuntu Software Store and review it. So stay tuned.

Images are from The Ubuntu Software Store wiki. One is an interface sketch and the other is one of the proposed logos. This one is by SebastianPorta

Monday, August 17, 2009

How to enable directX9 or 10 in VirtualBox with Ubuntu host

From version 3.0.2 VirtualBox included an experimental support for DirectX.

Although many believe that running complex 3D applications (i.e. games) inside a virtual machine is pure heresy, this goal could not be so far away. Virtual Machines are getting more and more popular mostly because they express the latent desire of every user to be allowed to choose the desired operating system without being forced by the software which too often is designed to run on one OS only. Should you have a fast and capable computer it could be possible in the near future to run a brand new 3D video game inside your virtual machine.
I recently discovered the new feature of VirtualBox which once selected allow the guest system to access the 3D graphics capabilities available on the host.
I created a guest system on my Ubuntu 9.04 host system by installing my old copy of Windows XP. The 3D graphics implementation in MS Windows is called DirectX which includes a whole set of APIs to manage several multimedia tasks. As you can imagine enabling the 3D acceleration on VirtualBox isn't sufficient to access the Direct3D functions as the direct interlocutor on the host side is OpenGL.

In order to reach my goal I had to find a way to translate the Direct3D calls of my guest machine to OpenGL. By googling I found WineD3D, a WineHQ project which works as a wrapper for MS Direct3D calls. You can find a brief description of the project plus the instruction to compile the DLL on a Ubuntu system here. To use WineD3D on a native Windows system -which is what I wanted given that I was interested in replacing the Direct3D DLLs on my Windows XP guest machine- you can find precompiled binaries here.
After having downloaded the package run the Windows XP guest machine in safe mode. Then launch the WineD3D setup, select the Direct3D version you want to replace (notably 8, 9 and 10 -experimental-) and that's it, the trick is done.
Now you can run dxdiag in your guest Windows XP machine (Start --> Run..--> dxdiag) and check the DirectX components which are implemented and available. You will see that the d3d8.dll and d3d9.dll are marked like files that can cause problems and need to be reinstalled. Just ignore the warning because those are the DLL which have been replaced by WineD3D.


Have fun.

Friday, August 14, 2009

Microwaved disk to safely destroy data

This guy seems a little crazy. He microwaved (for 5 seconds) a dvd to ensure data can't be retrieved anymore from them. I used to work for a big company which manufactured optical media and I'm inclined to believe that the system can work. As long as the dye, the substance filling the cd/dvd/BD track which is supposed to be figuratively "burnt" by the recorder, is really burnt the information contained in the disk should be similar to the memories of a brain splattered against a wall (ah gore!). I'm no computer forensics but I can't think of any way information can be extracted from such a mush.
Anyway, given that I've never done something like that I don't recommend you to do it because this method surely isn't much healthy neither for the microwave nor for the meal you're going to cook inside it after having burnt a few disks. The dye is meant to evaporate as the compound was originally a liquid made of powder mixed with solvents. Most of the solvents evaporated during the manufacturing process called drying but who knows how much solvent is due to evaporate when you bake the disk inside the microwave?


If you're interested in the process the guy posted a video here.
Image from NightRPStar published under this Creative Commons license

Thursday, August 13, 2009

Bash script to Mount/Unmount .ISO from Nautilus

I was googling to find a software for Ubuntu which helped me to mount and unmount .ISO files, you know the same job DaemonTools does so flawlessly on Windows.
Well I found a four years old post in the Tutorials&Tips section of Ubuntu Forums where Sonny explains how to create a script which will enable you to to the job directly from Nautilus.
I know that you can already do it on the newer version of Ubuntu but I find sometimes nice to hack here and around obtaining the same effect with some home brewed script.
I tried it and it perfectly worked on my Jaunty version so I thought it would have done good to spread the word around.
Here's the recipe.
First thing to do is create the folder where the files are going to be mounted.  Open a terminal and type:
sudo mkdir /media/iso
You can create whichever folder you like but the Sonny's way will place the folder next to the cdrom and other media in the system
Now we must create the script itself so always in the terminal type:
gedit ~/.gnome2/nautilus-scripts/Mount\ Iso
When the editor opens up paste the following code inside, save and exit
#!/bin/bash
for uri in $NAUTILUS_SCRIPT_SELECTED_URIS; do
gnome-terminal -x sudo mount -o loop -t iso9660 "$1" /media/iso
done
Now get back to the terminal because we need to make the script executable, so type:
chmod +x ~/.gnome2/nautilus-scripts/Mount\ Iso
That's all folks! Now, next time you encounter a .ISO file just right click on it and from the context menu select script and then Mount Iso. Type the user password and you will find the .ISO mounted and ready to be used directly on your desktop.
The next part is to create the script to unmount the .ISO. It doesn't really work for me this but I suppose it's worth give it a try and let me know if it works for you.
open a terminal and type:
gedit ~/.gnome2/nautilus-scripts/Unmount\ Iso
When the text editor showup put this code:
#!/bin/bash
for uri in $NAUTILUS_SCRIPT_SELECTED_URIS; do
gnome-terminal -x sudo umount "$1"
done
Make executable by typing in the terminal:
chmod +x ~/.gnome2/nautilus-scripts/Unmount\ Iso
And now you can simply mount and unmount the .ISO images directly from Nautilus and with just two clicks. According to Sonny it's possible to mount also .cue and .nrg images by just changing the parameter in the script. You could then have one script for each type of image you need to mount/unmount. Again, if you try to do so drop me a line to let me know if it worked or not.

Wednesday, August 12, 2009

Homebrewed Diamond Grease to dissipate your Processor

Every computer tuner or even a PC hard core gamer knows that cooling down the processor means not only the promise of fast performances but also avoid crashes and, ultimately, damages to the CPU, fans, and other components subjected to stress in high temperature conditions.
Jared Bouck at Inventgeek.com developed his own homebrew compound to cool down the processor and it happens that his product works better than the most high end cooling compound in the market!

Jared's article is so concise, simple and precise in the the description to compete with a recipe worth of the best chef cookbook. However, instead of preparing whatsoever delicacy for our taste, it explain how to bake your own diamond grease and apply it to the processor so that the heat is effectively conducted to the heat sink.
Regular compounds are currently made of silver suspended in silicon grease. Silver has a thermal conductivity of 429W/m K while diamond has 900-2320 W/m K. Obviously some production reasons, like acquiring large amounts of pure diamond powders, are retaining products based on diamond from the consumer market. However, given that you're own homebrewed production such problems shouldn't concern you.
Just check the interesting article for detailed instruction. however, in order to entice you in trying out this DIY product I'll post here below the performance comparison between the diamond grease and a high end commercially available compound. Again, see the article for test details.
System Idling
System Max load
Arctic Silver with a fresh application
42c
57c
Arctic Silver with 2 week cure
39c
54c
Diamond Grease with a fresh application
29c
38c

Monday, August 10, 2009

Did you know that... #001


Did you know that in 1973 Chuck Thacker, Alan Kay and other engineers at Xerox PARC used an image of Cookie Monster, the popular character from the wonderful educational entertainment for kids Sesame Street, as the first program of one of the earliest personal computers ever that was called Alto. The computer was small enough to fit under a common desk. Two years later they released a mail-order computer kit called Altair 8800one which did inspire a geek to be named Bill Gates, and the rest is history...
PARC (Palo Alto Research Center) history is worth to be read as this top level institute is well known for being at the same time one of the biggest success and failure of the private company which founded and paid the bills for several years. From PARC developed several milestones in the history of the computer which have a fundamental impact on the information technology we know today. Some of them are:
* Computer generated bitmap graphics
* Graphical user interface featuring windows and icons
* WYSIWYG text editor
* InterPress (a resolution-independent graphical page description language and the precursor to PostScript)
* Ethernet local area computer network
* Fully formed object-oriented programming in the Smalltalk programming language and integrated development environment
Several of the developments the likes of the above listed where included in the Alto computer.


Unfortunately Xerox was at the time a very conservative company and wasn't interested in exploiting the wonders its own research center produced. Apart from printer innovations, like the development of the laser printer, all other PARC develops became prey of others who were much more keen to them. It's maybe worth remembering Apple visited the PARC and got enticed by the PARC GUI onto which the first commercially successful Macintosh GUI was based (at least as a conceptual idea).
If you're a super geek you may want to check Altogether, is a microcode-level simulator for the Xerox Alto personal workstation (by Eric Smith).






The Cookie Monster image of Sesame Workshop and it's here reproduced under the terms of the Fair UseI will comply with remove the image if requested by the owner. I don't currently know the owner of the Alto picture and I will comply with naming the owner or remove the image if requested by the owner.

Sunday, August 9, 2009

The Treat of the Week #005

Cédric Delsaux isn't just an excellent photographer and a fine artist, he's also a Star Wars nerd!!
Check his website, he's totally awesome (the website is appalling though..)

Thursday, August 6, 2009

Astronaut Foods: The Treat for the Trekker in us

Who never wanted to become an astronaut when he/she was a child?
Most of us, member of the geek and nerd tribe, still crave for the day when we’ll have the chance to cruise outside Earth rather than around the Mediterranean.
Maybe we will see our children or grandchildren fulfil what was once our dream but in the meantime we can make space come into our diet!

Astronaut Foods offers a wide range of tasty freeze-dried authentic astronaut’s food.
You can chose among desserts like Astronaut Ice Cream Sandwich, candies like Astronaut Mars Fireball and Moon Brakers, and dinners like Astronaut Beef Stew Space Dinner plus some other science related gourmandise like Tyrannosaurus Eggs and Dinosaur Fossilized Bananas.
Astronaut foods brand was created in 1975 by American Outdoor Products together with the National Air and Space Museum to offer their museums visitors authentic space food.
Their food products are consumed by real astronauts on NASA missions today.

Wednesday, August 5, 2009

Star Wars: The Old Republic Teaser better than the movies?

The upcoming Star Wars The Old Republic, the online deployment, or MMORPG, of the Star Wars world is a project about which I’m not particularly fond of, not because of quality or ideological issues but simply because online games just don’t turn me on.

Anyway, speaking of quality, the game web site has a video teaser, more a short film, which is worth of be watched by all the Star Wars legions or science fiction fans. You can see the clip from you tube here below but I strongly advise you to download and watch the high definition version.

Then tell me: is it or not somewhat better than the last three theater episodes combined?

Tuesday, August 4, 2009

KDE 4.3.0 Caizen Released

Today the KDE community announced the released of their 4.3.0 desktop environment, codenamed Caizen.
If you don't know KDE you should give it a peek because, either you like the philosophy behind or not, the project is important and daring.
As I mentioned before KDE is a desktop environment. It's commonly related to the Kubuntu official derivation of Ubuntu Linux and other Linux distributions in general, but the environment can be installed also on Windows and Mac.

The main purpose of the KDE community is that of providing a strongly integrated, easy to use and stunningly stylish desktop. This is pursued not just by a pure aesthetic work but by a strong effort to propose and follow a their own concept of human-machine interface. The stress is always on the integration of the applications with the desktop composed of a stylish layout and sleek objects seen as track leading to simplicity and tidiness. The desktop is completely composed by widgets which float over the surface like objects on a table. Unlike a table however you can't just drop a file onto the surface, the way you would with any other desktop environment, but you must place them inside a dedicated desktop widget. This can be frustrating at the beginning but after a while you will likely find the desktop widget easy to use, intuitive and helpful in driving you to keep your monitor free from the mess.
A strong asset of KDE is that it's built on Qt libraries which is an extremely powerful and modern UI and application framework (probably the best). For this reason all a series of features, like graphics, graphical effects, etc.. are comparable to those found on Mac OSX and far better than those implemented in Vista, with the surplus of working smoothly even on my 4 years old average end laptop.
Unfortunately but physiological given the youth and ambition of the project, KDE suffered of many bugs during its life. However the community behind KDE is strong and the bug solving process did not lag behind. With the 4.3.0 version they claim the "community fixed over 10,000 bugs and implemented almost 2,000 feature requests in the last 6 months".
Check all the freshly implemented features of KDE 4.3.0 Caizen here.

Monday, August 3, 2009

District 9 - A story of alien rights


The aliens came 28 years ago and landed in Cape Town. Humanity kept waiting either for their wrath or for them to bring a new order of technological and social advance. Neither of these came.

The aliens, refugees from another world, were initially welcomed and began to mix up with the locals. Then problem arose. Hospitality did worn out over crime and culture shock. Multi-National United (MNU), a private entity, became the main contractor for handling the alien situation. MNU main purpose is to exploit the aliens’ technology and especially that related to their advanced weaponry. Unfortunately all attempts are unsuccessful. The alien wonders are out of human reach simply because they need alien DNA in order to function. Because of MNU real interest, aliens' welfare is completely obliterated. They are treated as a racial inferiority and segregated from the earth population mostly inside Distric 9, the township which gives the name to the movie.
District 9 is a reminiscence of the real District 6 in Cape Town, a symbol of the south-african apartheid politics of the ‘70s. This is also the key to reading the movie. Aliens are called non-humanslike the black people were once called non-white. A lot of the town areas as well as services are prohibited to the aliens who are kept living in poor conditions.
The promotion of the film heavily relies on viral marketing. The producers made up several web sites. The official web site is maintained by MNU and the visitor sees different content depending on whether they enter as human or non-human. Human content has a relaxing and reassuring tone, the visitor can check the town map which depicts mostly accessible areas and consult career opportunities.
The non-human web sites has a harsh tone, the town map shows nearly all restricted areas and what is offered is labor. The non-human web content is also primarily written (and spoken) in alien language with the English translation always available. Apartheid-like posters are spread all around the world, sometimes restricting restrooms or pubs to humans-only visitors, some other times warning that a bus or a cab stops only for human customers. In all the advertisement campaign a toll free number (1-866-666-6001) is always present and connects the caller to MNU automated speaker which provides some options including report non-human activity.

There’s also a blog called MNU spreads lies, run by an alien named Christopher. He’s a resistance type and basically reports on how’s living under inhuman (inalien ;) conditions inside the Distric 9 slums and crushed by MNU appalling regulations. Christopher reports that all the members of their species are forced to be assigned with an English name, that they have no basic work rights, that their spawn are registered and tracked and so on. He also provides a counter part of the highly censored MNU video in which he shows his face that was pixelated and pronounces the words “we only want to go home”.
This strong viral campaign is comparable and maybe superior to those notorious of The Blair Witch Project and, lately, Cloverfild. I just hope this effort is not done to reach the same aim of the former two: to arise a storming buzz and then deceive the audience (or most of it). You can call those two movies a huge marketing and economic success, an blazing experiment, but the reality is that their content was in no way worth the expectations generated by the viral advertisement and, shortly, of those of any blockbuster which they pretended to be.
My expectations about this film are big so I hope it will maintain the promises and be a damn stunning blockbuster, full of tons of special effect and with a soul!
District 9 is produced by Peter Jackson and directed by Neill Blomkamp. It originates from an independent short film, also from the same director, called “Alive in Joburg” which investigates the apartheid theme introducing the alien factor.
The film is due to release on August 28 in the United States and later on worldwide.
Should you be interested in take a deeper look in the subjects related to this movie you can check this article by JK Flower
Below some images related to the movie and the viral sites plus a trailer of District 9.




Wanted Christopher Notice (Printable PDF)
Alien Target Poster (Printable PDF)






All the above pictures and the video are copyright of either QED International or Sony Pictures under TriStar Pictures (not completely sure) and here reproduced under the terms of the Fair Use.