Friday, May 30, 2008
Searching for word or phrase in a file using Windows XP Search tool
I'm working on a Plone product and wanted to reference some existing product wherein I needed to search for a particular word in a file because I cannot remenber where it is. Im using Windows XP and it has a search tool wherein I can search for files that contains word by using the "A word or phrase in the file" search criteria, when I look for a word inside a .py file it doesn't show any results and I've noticed that it only works for .txt files only, googling around I've discovered that Windows XP search tool is using a filter component and a valid filter component must be registered for the .py file type in order for my to search word in a .py file, this behavior is to enhance the performance of searching and avoid irrelevant results, but where can I find the appropriate filter component for my python files? Is there a way I can set Windows XP search tool to search all files just like Windows 2000 wherein all files are searched for the content type I specify? Luckily there is a way, I've found it on Microsoft support website http://support.microsoft.com/kb/309173, method #2 works for me.
Tuesday, May 27, 2008
Enabling MySQL log_warnings variable
I'm encountering a MySQL connection error [host "ip-address" is blocked because of too many connection errors. Unblock with 'mysqladmin flush-host"] whenever I use my MySQL Tools to connect to our MySQL server, what the error means is that I'm having too many connection error and MySQL is now blocking any incoming connection. I had in my MySQL server configuration set the "max_connect_error" variable set to 10 and don't want to increase it but I would want to know what account is trying to connect and failed, by default the "log_warnings" variable is set to "OFF" in order to turn it "ON" you have to login to mysql and invoke the "set global" command like so:
Tuesday, May 20, 2008
My Laptop Broke
My laptop broke last friday, when I came into office and open it up it just went on blue screen and when I restarted it, it won't boot and gives me the "Operating System not found" error, I tried to restart it several times but to no avail. I've asked our Help Desk to check and hopefully fixed my laptop, weekends passed then tuesday came and they informed me that the problem was the harddisk and they can't fixed it, which means that all my files and codes are lost. I feel disappointed because the Plone upgrade that I'm working on is in that harddisk. I was about to make a backup of it on that day, have not the blue screen. Now I'm just waiting for the spare laptop so that I can continue my work but before that have to start installing/copying all the necessary files again.
Friday, May 16, 2008
Plone 2.0.5 to Plone 3.1.1 upgrade
I'd been working on upgrading our corporate website which is currently using Plone 2.0.5 to the latest version Plone 3.1.1, been googling around and reading stuffs on how to properly upgrade to the latest one. We've decided to do the upgrade because we've already missed several upgrades and wanted to avail new features and feature polishes but it turned out that upgrading from 2.0.5 to 3.1.1 is not an easy task most of the products and templates are already deprecated, new implementation of portlets, the use of viewlets in replacement to the default plone templates, acl user is upgraded, tabless skin is removed although you can use NUPlone tableless skin as an alternative, products that I am using in Plone 2.0.5 have no equivalent in Plone 3.1.1 and much more. I'll try to document as much as I can while doing the upgrade and hopefully I can post it here.
Tuesday, May 6, 2008
Python to Windows executable
I'm working on freelance project which is a python application using PyQT as a GUI, during the testing phase the application needs to be installed on clients workstation and in order to do that I have to install Python and PyQT before I can run my application. This is fine If I'm the one who will install the application but the problem will arise if the end user will be the one installing it, they might run into problems such as installing the wrong version of Python and PyQt. I also need to include Python and PyQT installer to make sure that they have the right version but this will make my distribution package large. It would be great if i can redistribute my application that the end user can install on his machine minus the worries of incompatible Python version and the exclusion of Python and PyQT installer. So I googled around and found this site http://www.py2exe.org this can convert my Python script into packages and executable Windows program without installing Python, py2exe is not an installer builder what it does is convert and assemble the files needed in order to run Python program without installing Python.
py2exe requires the creation of setup.py and we just need to import py2exe package and setup script from disutils package like so:
setup.py
-------------------------------------------------------------
the next step is to run the setup script on the command prompt like this:
c:\testing > python setup.py py2exe
We will see lots of output printed on the console and at the end two directories will be created -- "build" and "dist" folder, we can delete build directory while dist directory contains the package and windows executables. As I have mentioned a while ago py2exe is not an installer builder if we need one we can use Inno Setup to build one.
Here's my setup script
-------------------------------------------------------------
from distutils.core import setup
import py2exe, os
class build_DIRIncludes(py2exe):
def run(self):
# First, let py2exe do it's work.
py2exe.run(self)
print "--- moving conf ---"
print os.popen('move conf').read()
print "--- moving inputs ---"
print os.popen('move inputs').read()
print "--- moving output ---"
print os.popen('move output').read()
print "done"
setup(
options = {"py2exe": {"optimize": 2,
"packages": ["PyQt4","sip"],
"dist_dir": "my_application",
}
},
windows=['my_application.py'],
cmdclass = {"py2exe": build_DIRIncludes},
)
-------------------------------------------------------------
py2exe requires the creation of setup.py and we just need to import py2exe package and setup script from disutils package like so:
setup.py
-------------------------------------------------------------
from distutils.core import setup
import py2exe
setup(console=['testing.py'])
-------------------------------------------------------------import py2exe
setup(console=['testing.py'])
the next step is to run the setup script on the command prompt like this:
c:\testing > python setup.py py2exe
We will see lots of output printed on the console and at the end two directories will be created -- "build" and "dist" folder, we can delete build directory while dist directory contains the package and windows executables. As I have mentioned a while ago py2exe is not an installer builder if we need one we can use Inno Setup to build one.
Here's my setup script
-------------------------------------------------------------
from distutils.core import setup
import py2exe, os
class build_DIRIncludes(py2exe):
def run(self):
# First, let py2exe do it's work.
py2exe.run(self)
print "--- moving conf ---"
print os.popen('move conf').read()
print "--- moving inputs ---"
print os.popen('move inputs').read()
print "--- moving output ---"
print os.popen('move output').read()
print "done"
setup(
options = {"py2exe": {"optimize": 2,
"packages": ["PyQt4","sip"],
"dist_dir": "my_application",
}
},
windows=['my_application.py'],
cmdclass = {"py2exe": build_DIRIncludes},
)
-------------------------------------------------------------
Posted by
Exile
at
1:46 AM
Labels:
PyQT,
Python,
Python to Windows Executable,
Windows Executable
Subscribe to:
Posts (Atom)