Custom Search

Monday, February 28, 2011

Eucalyptus Instance goes from pending to shutting down to terminated

Eucalyptus Instance goes from pending to shutting down to terminated

vim /etc/eucalyptus/eucalyptus.conf

Change "eth0" to "br0" or "br0" to "eth0" based on your network configuration

---------------------------

# Affects: CC, NC
# See: **NOTE** below
ENABLE_WS_SECURITY="Y"
LOGLEVEL="DEBUG"
VNET_PUBINTERFACE="eth0" <---
VNET_PRIVINTERFACE="eth0" <---
VNET_MODE="MANAGED-NOVLAN"

--------------------------- change to

# Affects: CC, NC
# See: **NOTE** below
ENABLE_WS_SECURITY="Y"
LOGLEVEL="DEBUG"
VNET_PUBINTERFACE="br0" <---
VNET_PRIVINTERFACE="br0" <---
VNET_MODE="MANAGED-NOVLAN"

Saturday, February 19, 2011

How to Disable Easy Install in VMware

  1. First start VMware Player (VMware Workstation).
  2. Create A New Virtual Machine
  3. Select the option “I will install the operating system later”.
  4. Once done, your new virtual machine will be added to your virtual library.
  5. Simply click on Edit Virtual Machine settings, select your media then Restart VM!

Wednesday, February 16, 2011

python django how to remove last element from a list or string

python django how to remove last element from a list or string.
python django how to get all elements except last one.

>>> a = range(6)
>>> a
[0, 1, 2, 3, 4, 5]

>>> a[0:-1] <----- get all elements, except 5
[0, 1, 2, 3, 4]

---------------------------

>>> name = "python&"
>>> name
'python&'

>>> name[:-1] <----- get all elements, except &
'python'


===============================

python django Reverse list or string different methods

python django Reverse list or string different methods

>>> a = range(11)
>>> a
[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]

>>> a[::-1] <-------
[10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0]

>>> a[len(a)::-1] <-------
[10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0]

>>> a[len(a):0:-1]
[10, 9, 8, 7, 6, 5, 4, 3, 2, 1]

>>> a[len(a):1:-1]
[10, 9, 8, 7, 6, 5, 4, 3, 2]

------------------

>>> a
[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]

>>> a.reverse()
>>> a
[10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0]

------------------

>>> name = "python django"
>>> name[::1]
'python django'

>>> name[::2]
'pto jno'

>>> name[::-1] <------
'ognajd nohtyp'

>>> name[::-1]

--------------------------------

Tuesday, February 15, 2011

Python django Passing a List or Dictionary as Arguments

Python django Passing a List or Dictionary as Arguments

================
>>> a={"s":1,"t":2}

>>> def k(a):
... print a
... a['u']=3
... print a
...
>>> a
{'s': 1, 't': 2}
>>>
>>>
>>> k(a)
{'s': 1, 't': 2}
{'s': 1, 'u': 3, 't': 2}
>>>
>>>
>>> a
{'s': 1, 'u': 3, 't': 2}
>>>


list
================
>>> a=[2,4]
>>>
>>>
>>> def k(a):
... print a
... a.append(6)
... print a
...
>>>
>>> a
[2, 4]
>>>
>>> k(a)
[2, 4]
[2, 4, 6]
>>>
>>> a
[2, 4, 6]
>>>



================

>>> a = ['2','4','6','8','10']
>>>
>>>
>>> "/".join(a)
'2/4/6/8/10'
>>>

================


More.....

Sunday, February 13, 2011

python boolean Operations and or not

python boolean Operations and or not

============ or =================

>>>
>>> a = 0
>>> b = 10
>>> c = a or b
>>> c
10

>>> ----------------------

>>> a = 5
>>> b = 10
>>> c = a or b
>>> c
5

>>> ---------------------

>>> a = None
>>> b = 10
>>> c = a or b
>>> c
10

>>> ---------------------

>>> a = ""
>>> b = 10
>>> c = a or b
>>> c
10


************************** Equal To

>>> a = None
>>> b = 10
>>> if not a:
... c = b
... else:
... c = a
...
>>>
>>> c
10

>>> ---------------------

>>> a = 5
>>> b = 10
>>> if not a:
... c = b
... else:
... c = a
...
>>>
>>> c
5




=============== and =================

>>>
>>> a = 5
>>> b = 10
>>> c = a and b
>>> c
10

>>> ------------------------

>>> a = 0
>>> b = 10
>>> c = a and b
>>> c
0

>>> ------------------------

>>> a = None
>>> b = 10
>>> c = a and b
>>> c

>>> ------------------------

>>> a = ""
>>> b = 10
>>> c = a and b
>>> c
''
>>>


==================================

More.....