Startup
Keystroke Description
Press X during startup Force Mac OS X startup
Press Option-Command-Shift-Delete
during startup Bypass primary startup volume and seek a different startup volume (such as a CD or external disk)
Press C during startup Start up from a CD that has a system folder
Press N during startup Attempt to start up from a compatible network server (NetBoot)
Press R during startup Force PowerBook screen reset
Press T during startup Start up in FireWire Target Disk mode
Press Shift during startup start up in Safe Boot mode and temporarily disable login items and non-essential kernel extension files (Mac OS X 10.2 and later)
Press Command-V during startup Start up in Verbose mode.
Press Command-S during startup Start up in Single-User mode (command line)
My 2cent tips & tricks on computer technology & Application Virtualization ...
Wednesday, July 30, 2008
Wednesday, July 9, 2008
creating windows service using pyinstaller
copied from http://www.nabble.com/windows-service-sample-using-pyInstaller-td16626208.html
# Usage:
# service.exe install
# service.exe start
# service.exe stop
# service.exe remove
# you can see output of this program running python site-packages\win32\lib\win32traceutil
import win32service
import win32serviceutil
import win32event
import win32evtlogutil
import win32traceutil
import servicemanager
import winerror
import time
import sys
class aservice(win32serviceutil.ServiceFramework):
_svc_name_ = "aservice"
_svc_display_name_ = "aservice - It Does nothing"
_svc_deps_ = ["EventLog"]
def __init__(self,args):
win32serviceutil.ServiceFramework.__init__(self,args)
self.hWaitStop=win32event.CreateEvent(None, 0, 0, None)
self.isAlive=True
def SvcStop(self):
# tell Service Manager we are trying to stop (required)
self.ReportServiceStatus(win32service.SERVICE_STOP_PENDING)
# write a message in the SM (optional)
# import servicemanager
# servicemanager.LogInfoMsg("aservice - Recieved stop signal")
# set the event to call
win32event.SetEvent(self.hWaitStop)
self.isAlive=False
def SvcDoRun(self):
import servicemanager
# Write a 'started' event to the event log... (not required)
#
win32evtlogutil.ReportEvent(self._svc_name_,servicemanager.PYS_SERVICE_STARTED,0,
servicemanager.EVENTLOG_INFORMATION_TYPE,(self._svc_name_, ''))
# methode 1: wait for beeing stopped ...
# win32event.WaitForSingleObject(self.hWaitStop, win32event.INFINITE)
# methode 2: wait for beeing stopped ...
self.timeout=1000 # In milliseconds (update every second)
while self.isAlive:
# wait for service stop signal, if timeout, loop again
rc=win32event.WaitForSingleObject(self.hWaitStop, self.timeout)
print "looping"
# and write a 'stopped' event to the event log (not required)
#
win32evtlogutil.ReportEvent(self._svc_name_,servicemanager.PYS_SERVICE_STOPPED,0,
servicemanager.EVENTLOG_INFORMATION_TYPE,(self._svc_name_, ''))
self.ReportServiceStatus(win32service.SERVICE_STOPPED)
return
if __name__ == '__main__':
# if called without argvs, let's run !
if len(sys.argv) == 1:
try:
evtsrc_dll = os.path.abspath(servicemanager.__file__)
servicemanager.PrepareToHostSingle(aservice)
servicemanager.Initialize('aservice', evtsrc_dll)
servicemanager.StartServiceCtrlDispatcher()
except win32service.error, details:
if details[0] == winerror.ERROR_FAILED_SERVICE_CONTROLLER_CONNECT:
win32serviceutil.usage()
else:
win32serviceutil.HandleCommandLine(aservice)
Sunday, July 6, 2008
Get the windows service state using Python
following code can be used to find if any service is installed and if so then return the state of the service.
import wmi
class servicePython():
def __init__(self, serviceName):
self.c = wmi.WMI ()
self.serviceName = serviceName
def setServiceName(self, serviceName):
self.serviceName = serviceName
def getStatus(self):
srv = c.Win32_Service (name=self.serviceName)
if srv != []:
return c.Status
return False
Thursday, July 3, 2008
recursive list files in a dir using Python
use the following code to list the files in a dir tree
import os
import sys
fileList = []
rootdir = sys.argv[1]
for root, subFolders, files in os.walk(rootdir):
for file in files:
fileList.append(os.path.join(root,file))
print fileList
Monday, June 30, 2008
Setting wx.TextCtrl readonly
Simply use the following code:
txtCtrl.SetEditable(False)
# Also its a good idea to change the backgroud colour so user will know that is has became readonly.
txtCtrl.SetBackgroundColour((255,23,23))
Tuesday, June 10, 2008
TIPS: WX.Python.Grid: Removing the selected Rows
lst = None
no = self.grid_ShareDetails.GetNumberRows()
lst = sorted(self.grid_ShareDetails.GetSelectedRows())
lst.reverse()
for l in lst:
self.grid_ShareDetails.DeleteRows(l,1)
Monday, June 9, 2008
PitHole: Windows : The specified service has been marked for deletion
When I try to install the install a service which i have just delete using sc command i get the following error :
"The specified service has been marked for deletion".
Just close the services.msc and try again. otherwise one might have to restart the machine :( to resolve the issue.
Wednesday, June 4, 2008
PitHole: RPM : "warning, user XXX does not exist - using root"
If while installing rpm package following error occurs
warning: user XXX does not exist - using root
Issue : I'm trying to build/install an rpm and it keeps giving me these warnings while installing the binary. Though I heard this could be safely ignored as its bcos there is no user XXX on my box, was wondering if there is a way to supress this in the rpm spec file itself. I know I could also manually build it as root. But curious if we could supress this from the spec.
Resolution:
Add the following in the spec file and recompile the spec file
%defattr(-,root,root)
TIPS: deltree in Windows
I always missed the good old deltree External DOS command. Here is how we can get it in batch file
del /s %1
rd /s %1
Thursday, May 29, 2008
Tips : wx.Python : Close button not working.
If the close button does not work then add the following entries
under the __init__ function and create a new function as
def quit(self, event):
self.Destroy()
self.Bind(wx.EVT_CLOSE, self.quit)
under the __init__ function and create a new function as
def quit(self, event):
self.Destroy()
Wednesday, May 14, 2008
PitHole: MAV: Error code: 0000C81D
Error:
Unable to import OSD file. The file specified is not a valid SoftGrid OSD file. Please ensure the file conforms to the SoftGrid OSD file schema and contains well formed XML. Error code: 0000C81D
When:
When importing the package using SPRJ or OSD file:
Cause:
OSD File is missing or NAME Tag inside OSD File is greater then 64 Char length.
Unable to import OSD file. The file specified is not a valid SoftGrid OSD file. Please ensure the file conforms to the SoftGrid OSD file schema and contains well formed XML. Error code: 0000C81D
When:
When importing the package using SPRJ or OSD file:
Cause:
OSD File is missing or NAME Tag inside OSD File is greater then 64 Char length.
Thursday, May 8, 2008
FAQ: Resolving the "ImportError: No module named decimal" Error
Error Message:
Description:
Resolution:
If you are using pymssql module in python program and creating
ImportError: No module named decimal
Description:
Error occurs when executable created using pyinstaller is executed which uses pymssql module
Resolution:
import decimal in the python program
If you are using pymssql module in python program and creating
Subscribe to:
Posts (Atom)