
Og en undskyldning for at prøve photo app Vigrette til Android
Location : Vesterenden 7, 8762 Flemming,

'''
Created on Sep 10, 2009
@author: nikolaj
'''
class Vehicle(object):
'''
classdocs
'''
number_of_vehicles = 0
def __init__(self, color, number, weight):
self.number = number
self.weight = weight
self.color = color
Vehicle.number_of_vehicles += 1
print '(Initializing Vehicle %s which is of type %s)' % (self.number, type(self))
def __del__(self):
Vehicle.number_of_vehicles -= 1
if Vehicle.number_of_vehicles == 0:
print 'Vehicle: I am the last one on the streets now ...'
else:
print 'Vehicle: There are still %d of us left.' % Vehicle.number_of_vehicles
class Car (Vehicle):
'''
classdocs
'''
number_of_cars = 0
def __init__(self, color, number, passengers, weight):
Vehicle.__init__(self, color, number, weight)
self.passengers = passengers
Car.number_of_cars += 1
def __del__(self):
print 'Car: %s says bye. I am off to the scrap heap' % self.number
Car.number_of_cars -= 1
if Car.number_of_cars == 0:
print 'Car: I am the last Car on the streets now ...'
else:
print 'Car: There are still %d Cars left.' % Car.number_of_cars
def howmany (self):
print "Car: %d cars and %d vehicles in total" % (Car.number_of_cars, Car.number_of_vehicles)
class Truck (Vehicle):
'''
classdocs
'''
number_of_trucks = 0
def __init__(self, color, number, tonnage, weight):
Vehicle.__init__(self, color, number, weight)
self.tonnage = tonnage
Truck.number_of_trucks += 1
def __del__(self):
print 'Truck: %s says bye. I am off to the scrap heap' % self.number
Truck.number_of_trucks -= 1
if Truck.number_of_trucks == 0:
print 'Truck: I am the last Truck on the streets now ...'
else:
print 'Truck: There are still %d Trucks left.' % Truck.number_of_trucks
def howmany (self):
print "Truck: %d trucks and %d vehicles in total" % (Truck.number_of_trucks, Truck.number_of_vehicles)
from dk.hsys.model.vehicle import Car
from dk.hsys.model.vehicle import Truck
'''
Created on Sep 10, 2009
@author: nikolaj
'''
def main():
car = Car('Blue', 'RH20358', 4, 725)
car2 = Car('Yellow', 'DC79929', 2, 800)
car2.howmany()
truck = Truck('Red', 'CV34254', 22, 32)
truck2 = Truck('Green', 'BD7638', 2, 4)
truck3 = Truck('Black', 'HG76543', 30, 40)
truck.howmany()
if __name__ == '__main__':
main()
(Initializing Vehicle RH20358 which is of type )
(Initializing Vehicle DC79929 which is of type )
Car: 2 cars and 2 vehicles in total
(Initializing Vehicle CV34254 which is of type )
(Initializing Vehicle BD7638 which is of type )
(Initializing Vehicle HG76543 which is of type )
Truck: 3 trucks and 5 vehicles in total
Car: RH20358 says bye. I am off to the scrap heap
Car: There are still 1 Cars left.
Car: DC79929 says bye. I am off to the scrap heap
Car: I am the last Car on the streets now ...
Truck: CV34254 says bye. I am off to the scrap heap
Truck: There are still 2 Trucks left.
Truck: BD7638 says bye. I am off to the scrap heap
Truck: There are still 1 Trucks left.
Truck: HG76543 says bye. I am off to the scrap heap
Truck: I am the last Truck on the streets now ...
#!/bin/sh
# check to see if this host has a working internet connection and a IP address
MYIP=`ifconfig | grep 'inet addr:'| grep -v '127.0.0.1' | cut -d: -f2 | awk '{ print $1}'`
ping -c 1 ${MYIP} >> /dev/null 2>&1
if [ "$?" -ne "0" ]
then
exit 1;
fi
# check to see if HOSTNAME can be pinged directly - if yes echo the mount lines for nfs
ping -c 1 HOSTNAME >> /dev/null 2>&1
if [ "$?" -eq "0" ]
then
echo "root -fstype=nfs,rw,sync,soft,intr,rsize=8012,wsize=8129 HOSTNAME:/foo/bar/&"
echo "data2 -fstype=nfs,rw,sync,soft,intr,rsize=8012,wsize=8129 HOSTNAME:/foo/bar/&"
echo "download -fstype=nfs,rw,sync,soft,intr,rsize=8012,wsize=8129 HOSTNAME:/foo/bar/&"
exit 0;
fi
# check to see if SSHHOST can be contacted - if yes use the ssh/nfs to mount using fuse
nc -z SSHHOSTNAME 22 > /dev/null 2>&1
if [ "$?" -eq "0" ]
then
echo "-fstype=fuse,rw,nodev,nonempty,noatime,allow_other,max_read=65536 :sshfs\#USER\@SSHHOST:/foo/bar/&"
exit 0;
exit 0;
fi
sudo apt-get install cryptsetupThis will add the needed executables and system libraries to your system. However this will not quite cut it. Remember I mentioned the idea of injecting a layer of security between the partition and the file system?