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