PreUpgrade For Fedora

| No Comments | No TrackBacks
This is merely a big thank you to those behind the PreUpgrade package for Fedora. Two machines upgrade from Fedora 12 to 13 without issues.

Thank you!

Restarting QEMU Network

| No Comments | No TrackBacks
It seems that VMs powered by QEMU lose their network connectivity when my computer enters sleep mode. The guest's eth0 interface loses its IP address and even if statically assigned it is still unable to ping the host machine (and vice-versa). The host system's ifconfig results do not appear to show any changes.

Here is how I was able to restore the network without having to reboot the host:
[ ~]$ sudo virsh
virsh # net-list
Name                 State      Autostart
-----------------------------------------
default              active     yes      

virsh # net-destroy default
Network default destroyed

virsh # net-list
Name                 State      Autostart
-----------------------------------------

virsh # net-start default
Network default started

virsh # net-list
Name                 State      Autostart
-----------------------------------------
default              active     yes      

I should mention that the guest was shutdown during this process.

Everything in Python is an object.
>>> a=1
Now a is an object.

First, a quick run through of how to determine the type:
>>> type('hi')
<type 'str'>
>>> type(1)
<type 'int'>
>>> type(True)
<type 'bool'>
As with most things, there is another way to get the same data:
>>> 'hi'.__class__
<type 'str'>
>>> True.__class__
<type 'bool'>
>>> i = 1
>>> i.__class__
<type 'int'>
How is this useful? How about comparing an object to a type:
>>> isinstance('hi',str)
True
>>> isinstance(1,str)
False
>>> isinstance(1,int)
True
>>> isinstance('str',int)
False
>>> isinstance(1.2,int)
False
It is also possible to get the type name as a string:
>>> 'hi'.__class__.__name__
'str'
>>> True.__class__.__name__
'bool'
>>> i=1
>>> i.__class__.__name__
'int'
On to user created objects:
>>> class hh(object):
...     pass
...
>>> k = hh()
>>> type(k)
<class '__main__.hh'>
>>> type(k).__name__
'hh'
>>> isinstance(k,hh)
True
>>> isinstance(k,object)
True
>>> isinstance(k,type)
False
>>> isinstance(k,str)
False
And now a subclass of hh():
>>> class ii(hh):
...     pass
...
>>> l = ii()
>>> type(l)
<class '__main__.ii'
>>>> isinstance(l,ii)
True
>>> isinstance(l,hh)
True
>>> isinstance(l,object)
True
>>> isinstance(l,type)
False
Determining the parent using '__bases__':
>>> object.__bases__
()
>>> str.__bases__
(<type 'basestring'>,)
>>> str.__bases__[0].__bases__
(<type 'object'>,)
>>> str.__bases__[0].__bases__[0].__bases__
()
>>> k = hh()
>>> type(k).__bases__
(<type 'object'>,)
>>> l = ii()
>>> type(l).__bases__
(<class '__main__.hh'>,)
>>> issubclass(type(l),hh)
True
>>> issubclass(type(l),object)
True
>>> issubclass(type(l),str)
False
>>> class jj(hh):
...     pass
...
>>> m = jj()
>>> isinstance(m,jj)
True
>>> isinstance(m,hh)
True
>>> isinstance(m,ii)
False
>>> issubclass(type(m),hh)
True
>>> issubclass(type(m),ii)
False
>>> type(l).__bases__[0] == type(m).__bases__[0]
True
>>> type(l).__bases__[0] == type(m).__bases__[0] and type(l).__bases__[0] == hh
True
More documentation on Python objects can be found on the page "Python Types and Objects".

More testing

| No Comments | No TrackBacks
Here is another test entry.

Another Test

| No Comments | No TrackBacks
Here is another test.

Test Blog Entry

This is a test blog entry.