%~dp0 will be the directory path of the executable batch file.
Category Archives: Tips
TIPS: Python: Copying text in Clipboard using Python
following code lets you achieve that.
import win32clipboard win32clipboard.OpenClipboard() win32clipboard.EmptyClipboard() win32clipboard.SetClipboardText(text) win32clipboard.CloseClipboard()
TIPS: Issues while compiling WXWidgets
If you have msys installed & added to the path then WxWidgets failes to compile and you will get the error which starts as follows
if not exist gcc_mswd mkdir gcc_mswd
The easiest solution to resolve is in the command prompt remove all the path folders except windows & mingw paths and then try to recompile in the same command window.
Tips: Python : wxFormBuilder v3.1.67-beta (Febuary 18, 2010) Python Update
Latest version of wxFormBuilder does not support wxAdditions fully, thus I have updated few XML files to support FlatNotebook & wx.propgrid widgets.
- Download wx.propgrid and install it.
- Download the XML.Zip folder and extract it in plugins\wxAdditions\xml folder.
- Restart the wxformbuilder.
I did not tried to update these files for other widgets but it should be similar.
Tips: Video: convert mov to avi file using ffmpeg
Use the following command to convert .mov file to .avi file.
ffmpeg -i file-name.mov -g 60 -vcodec msmpeg4v2 -acodec pcm_u8 -f avi file-name.avi
Tips: Free audio books
“NetLibrary now available thru Atlanta Fulton County Public Library
Free Stories from Thriller / Brilliance Audio podcasts
Complete Podiobook (Podcast audiobook) directory
Project Gutenberg’s Audiobooks
Miette’s Bedtime Story Podcast
LearnOutLoud Free Audio/Video Directory
Convert Virtualbox vdi to VMware vmdk Files
QEMU-IMG can be used to convert virtualbox vdi file to vmware vmdk file
qemu-img.exe convert -O vmdk virtualbox.vdi vmware.vmdk
demo code for wx.TaskBarIcon
Below is the demo code for wx.TaskBarIcon,
import wx
class sysTrayDemo(wx.Frame):
def __init__(self, parent, id, title):
pass
wx.Frame.__init__(self, parent, -1, title, size = (800, 600),
style=wx.DEFAULT_FRAME_STYLE|wx.NO_FULL_REPAINT_ON_RESIZE)
# FIXME: substitute your icon file here.
icon = wx.Icon('systray.ico', wx.BITMAP_TYPE_ICO)
self.SetIcon(icon)
if wx.Platform == '__WXMSW__':
# setup a taskbar icon, and catch some events from it
self.tbicon = wx.TaskBarIcon()
self.tbicon.SetIcon(icon, "SysTray Demo")
wx.EVT_TASKBAR_LEFT_DCLICK(self.tbicon, self.OnTaskBarActivate)
wx.EVT_TASKBAR_RIGHT_UP(self.tbicon, self.OnTaskBarMenu)
wx.EVT_MENU(self.tbicon, self.TBMENU_RESTORE, self.OnTaskBarActivate)
wx.EVT_MENU(self.tbicon, self.TBMENU_CLOSE, self.OnTaskBarClose)
wx.EVT_ICONIZE(self, self.OnIconify)
return
def OnIconify(self, evt):
self.Hide()
return
def OnTaskBarActivate(self, evt):
if self.IsIconized():
self.Iconize(False)
if not self.IsShown():
self.Show(True)
self.Raise()
return
def OnCloseWindow(self, event):
if hasattr(self, "tbicon"):
del self.tbicon
self.Destroy()
TBMENU_RESTORE = 1000
TBMENU_CLOSE = 1001
def OnTaskBarMenu(self, evt):
menu = wx.Menu()
menu.Append(self.TBMENU_RESTORE, "Restore SysTray Demo")
menu.Append(self.TBMENU_CLOSE, "Close")
self.tbicon.PopupMenu(menu)
menu.Destroy()
#---------------------------------------------
def OnTaskBarClose(self, evt):
self.Close()
# because of the way wx.TaskBarIcon.PopupMenu is implemented we have to
# prod the main idle handler a bit to get the window to actually close
wx.GetApp().ProcessIdle()
class MyApp(wx.App):
def OnInit(self):
self.redirect=True
frame = sysTrayDemo(None, -1, "SysTray Demo")
frame.Show(True)
return True
def main():
app = MyApp()
app.MainLoop()
if __name__ == '__main__':
main()
TIPS: Linux : Compress a directory
The following command can be used to compress entire directory in a file :
tar cjf <FileName>.tar.bz2 <DirectoryPath>
Tips: Convert flv to mpg or avi
Following converts video.flv into video.mpg file:
ffmpeg -i video.flv -ab 56 -ar 22050 -b 500 -s 320x240 video.mpg
and following converts video.flv into video.AVI with MP3 Audio:
ffmpeg -i I_test.flv -ab 56 -ar 22050 -b 500 -s 320x240 -vcodec xvid -acodec mp3 video.aviTIPS: DELTREE in Windows XP
deltree can be simulated using the following .cmd file:
- Create an empty file deltree.cmd in %windir%\system32 folder
- Add the following content to the file, and save the file.
@echo off
del /S /F /Q %1
rd /S /Q %1
Switching back to Linux when Gnome-RDP in full screen
Ctrl+Alt+Enter will return you from full-screen mode.
You can use the same set of keystrokes to enter into the full-screen mode.
checking ext3 filesystem using fsck
use the following command for checking ext3 filesystem using fsck
fsck -c <drive>
<drive>: path of drive which you like to get scanned,
NOTE: IT Is aways advice to unmount the partition which needs to be scanned.
Disable “Use the web service to find the appropriate program”
Create the following DWORD key NoInternetOpenWith = 1 at
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\Explorer
Tips: Linux: Mount NTFS Share
mount -t cifs //<IPAddressOfRemoteMachine>/<Share> -o username=myntaccount,password=mypassword /mnt/ntfs
FAQ: App-V: How to use the custom Exclusion List while Sequencing
Steps to create the custom exclusion list.
- Launch the AppV sequencer.
- Goto Tools -> Options
- Select “Exclusion Items” tab
- Add new exclusion items using “New Button”
- When all the exclusion items are added then press “Save As Default” button
- Copy the default.sprj file from “C:\Program Files\Microsoft Application Virtualization Sequencer\” or the folder where the sequencer was installed to some network share from where it can be accessed later.
Using the custom exclusion list
- Copy the saved default.sprj file to “C:\Program Files\Microsoft Application Virtualization Sequencer\” before launching the Sequencer.
- When launched the sequencer will take the exclusion list from the default.sft file.
Imaging WinXP using Knoppix
- Boot from knoppix
- Repartition your drive
- Base Partition – This is were your winXP is installed
- Image Partition – this is were your image of windows xp will be copied
- mount the image partition: mount /dev/sda2 /media/img
- Use the command to create the img: ntfsclone -s -o /media/img/winxp.img /dev/sda1
- use the command to restore the img: ntfsclone –restore-image -O /dev/sda1 /media/img/winxp.img
- Enjoy
Note: It is a good idea to have ext3 as filesystem for your image partition so that the image file is not deleted accidentally and also it overwrites the FAT32 2GB filesize limit.
TIPS: dbus: UUID file ‘/var/lib/dbus/machine-id’ contains invalid hex data
Whenever you get the above error then it can be resolved by executing the following command
dbus-uuidgen > /var/lib/dbus/machine-id
TIPS: dpkg Error: dpkg: too many errors, stopping
apt-get and dpkg are great package management tools but there might be a time that you can face the following error:
dpkg: too many errors, stopping
also when you try `apt-get upgrade` or `apt-get dist-upgrade` you will be adviced that the previous application installation was not successful thus they should execute `dpkg –configure -a` and it returns the above error.
To resolve the issue run the following command
MAC OS Keys
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)