//Module A typedef struct opaque_ *opaque; BOOST_PYTHON_OPAQUE_SPECIALIZED_TYPE_ID(opaque_) opaque get();
//Module B typedef struct opaque_ *opaque; BOOST_PYTHON_OPAQUE_SPECIALIZED_TYPE_ID(opaque_) void use(opaque);You'd expect to interchange opaque objects between the modules, i.e. develop in python somehow like this
ptr = A.get() B.use(ptr)The typeid specialization instantiated by BOOST_PYTHON_OPAQUE_SPECIALIZED_TYPE_ID looks like to be stored in a static map allocated by boost::python. Thus, if you link boost::python statically you'll end up having two separate maps and you won't be able to use cross-module opaque pointers because the type
opaque will look different in the two modules.
try:
#Only works on win32 with win32 modules installed
import win32console
except ImportError:
pass
else:
win32console.FreeConsole()
as simple as that!
#!/usr/bin/python
import cv
#Input image
im = cv.LoadImageM("barcodecrop.bmp")
#Work buffer
tmp = cv.CreateImage(cv.GetSize(im), cv.IPL_DEPTH_8U, 1)
#Output image
oim = cv.CreateImage(cv.GetSize(im), cv.IPL_DEPTH_8U, 1)
#R,G,B channels
r = cv.CreateImage( cv.GetSize(im), cv.IPL_DEPTH_8U, 1 )
g = cv.CreateImage( cv.GetSize(im), cv.IPL_DEPTH_8U, 1 )
b = cv.CreateImage( cv.GetSize(im), cv.IPL_DEPTH_8U, 1 )
cv.Split( im, r, g, b, None )
#Create the work buffer
cv.AddWeighted( r, 1./3., g, 1./3., 0.0, tmp )
cv.AddWeighted( tmp, 2./3., b, 1./3., 0.0, tmp )
#Threshold and save into the output buffer
cv.Threshold( tmp, oim, 43, 255, cv.CV_THRESH_BINARY )
#Alternate thresholding options
#cv.AdaptiveThreshold( tmp, oim, 255, cv.CV_ADAPTIVE_THRESH_MEAN_C, cv.CV_THRESH_BINARY, 71, 12)
#CV_ADAPTIVE_THRESH_GAUSSIAN_C
#CV_ADAPTIVE_THRESH_MEAN_C
#Save the output image
cv.SaveImage("fixed.bmp", oim)
Now you have a thresholded BW image saved in barcodeth.bmp.
ethtool -G eth0 rx 4096 tx 4096However this means the adapter has to be resetted after boot. To avoid this on an Intel 82578DM (e1000e driver) you can recompile the driver increasing the default ring buffer size.
#define E1000_DEFAULT_TXD
#define E1000_DEFAULT_TXD 4096
#define E1000_DEFAULT_RXD
#define E1000_DEFAULT_RXD 4096
| Module name | Why? | Directive |
| authn_file | To enable the htpasswd file based auth provider | LoadModule authn_file_module /usr/lib/apache2/modules/mod_authn_file.so |
| authnz_ldap | To enable the ldap based auth provider | LoadModule authnz_ldap_module /usr/lib/apache2/modules/mod_authnz_ldap.so |
| ldap | Required by authnz_ldap | LoadModule ldap_module /usr/lib/apache2/modules/mod_ldap.so |
<VirtualHost *:80>
ServerAdmin webmaster@somewhere
ServerName myserver.mydomain
DocumentRoot /var/www
WSGIScriptAlias /Copan /var/www/Trac/Trac.wsgi
<Location "/Trac">
WSGIApplicationGroup %{GLOBAL}
SVNPath /var/svn/Svn
AuthType Basic
AuthName "My Trac installation"
AuthBasicProvider ldap file
#You may be able to use anonymous queries, thus without
#using the Binding
AuthLDAPBindDN "MYDOMAIN\myusername"
AuthLDAPBindPassword "mypassword"
#This also works for me, but does not restrict to "user accounts"
#AuthLDAPURL "ldap://domain_controller:389/DC=mydomain?sAMAccountName?sub?(objectClass=*)" NONE
AuthLDAPURL "ldap://domain_controller:389/DC=mydomain?sAMAccountName?sub?(objectClass=organizationalPerson)" NONE
AuthzLDAPAuthoritative Off
#Fallback on standard htpasswd file
AuthUserFile /var/svn/passwd
AuthzSVNAccessFile /var/svn/authz
Require valid-user
</Location>
</VirtualHost>
This post addresses a feature not described in the article above. What if I want to EXTEND a QT widget and retain all its designer features? For example, what if I want to extend QStackedWidget so that I get features like the "Insert page" menu? It can be done by manipulating the XML returned by the plugin.
Head on to the example plugin code:
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import sys
from PyQt4 import QtGui, QtDesigner
from PyQt4.QtDesigner import QPyDesignerCustomWidgetPlugin
from some.other.package import CSlidingPanel
class CSlidingPanel_plugin(QPyDesignerCustomWidgetPlugin):
def __init__(self, parent=None):
QPyDesignerCustomWidgetPlugin.__init__(self)
self.initialized = False
def initialize(self, QDesignerFormEditorInterface):
if self.initialized:
return
self.initialized = True
def isInitialized(self):
return self.initialized
def createWidget(self, parent):
return CSlidingPanel(parent)
def name(self):
return "CSlidingPanel"
def toolTip(self):
return "Animated sliding panel"
def whatsThis(self):
return "Animated sliding panel"
def includeFile(self):
return "some.other.package"
def group(self):
return "Some group name"
def isContainer(self):
return True
def domXml(self):
return ("""
<ui language="c++">
<widget class="CSlidingPanel" name="SlidingPanel">
<property name="toolTip">
<string>{0}</string>
</property>
<property name="whatsThis">
<string>{1}</string>
</property>
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>500</width>
<height>200</height>
</rect>
</property>
<property name="minimumSize">
<rect>
<width>500</width>
<height>500</height>
</rect>
</property>
<property name="styleSheet">
<string>background-color: rgb(184, 184, 184);</string>
</property>
</widget>
<customwidgets>
<customwidget>
<class>CSlidingPanel</class>
<extends>QStackedWidget</extends>
</customwidget>
</customwidgets>
</ui>""".format(self.toolTip(), self.whatsThis())
)
Pay attention to:
includeFile method which should return the full module name (packages included) for the widget being exportedlanguage="c++" attribute of the ui XML element. I don't know why but it seems to be required<customwidgets> section and in particular the <extends> element which defines the inheritance as far as QT Designer is concernedconst char headerName[] = "Cookie"; const char headerValue[] = ".ASPXFORMSAUTH=6131A0......."; //Initialize the environment somewhere //Client stub to the SOAP service axis2_stub_t* stub = axis2_stub_create_SecureWCF(environmentPointer, axisHomeDir, NULL); //Get the options for the client stub axis2_options_t* options = axis2_stub_get_options (stub, environmentPointer); //Create a list of headers to be sent along with the HTTP request and add them to the stub axutil_array_list_t* headers = axutil_array_list_create (environmentPointer, 1); axis2_http_header_t* http_header = axis2_http_header_create(environmentPointer, headerName, headerValue); axutil_array_list_add (headers, environmentPointer, http_header); axis2_options_set_http_headers(options, environmentPointer, headers);Voilą, the new header will be sent with the next op() call.
std::string wso2Home("somewhere");
org_tempuri::SecureWCFStub* stub = new org_tempuri::SecureWCFStub(wso2Home);
org_datacontract_schemas__2004__07_webapplication1::GetTestObjectSVC* svc =
new org_datacontract_schemas__2004__07_webapplication1::GetTestObjectSVC();
axis2_options_t* options = stub->getOptions()->getAxis2Options();
const axutil_env_t* env = wso2wsf::Environment::getEnv();
axutil_array_list_t* headers = axutil_array_list_create (env, 1);
axis2_http_header_t* http_header = axis2_http_header_create(env, headerName, headerValue);
axutil_array_list_add(headers, env, http_header);
axis2_options_set_http_headers(options, env, headers);
Suppose you want to statically link some libraries and some others dynamically when building your executable with the GCC/G++ toolchain. For sure you can pass the static library with its full path along with the other objects, something like:
gcc -o executable anObject.o /usr/lib/someLibrary.a
But what if I don't want to search library full path? What if I want to use standard library search path? In short: how the hell do I tell the linker to manage this stuff?
Here are the relevant options:
WARNING: linking order in the static chain matters!
An example:
gcc -o executable anObject.o -Wl,-Bstatic -lstaticLib -Wl,-Bdynamic -ldl -lpthread -ldynamicLib
libstaticLib.a will be used, even if a libstaticLib.so is available.
IMAPfilter is used to select already read messages in the mailbox (additional conditions can be specified here), fetchmail does the download and maildrop performs the local delivery. The already read mail is first moved to a /backup folder, then downloaded and flushed. So the FIRST THING TO DO is create a /backup subfolder. Mail is downloaded locally to a gzip-compressed mbox, one for each month.
DATE=$(date +"%b-%Y")
TMPFILE=$(mktemp /tmp/mailbackup.XXXXXXXXXXX)
echo "----> Backup mail for myUser"
MAILBOX="/backups/mail/myUser-$DATE.gz"
gzip -qdc "$MAILBOX" > $TMPFILE
imapfilter -e "account=IMAP{server = 'imap.server',username = 'myUser',password = 'passwd'} \
msg = account.INBOX:is_seen() account.INBOX:move_messages(account.backup, msg)"
fetchmail -a -r backup -m "/usr/bin/maildrop ~/.maildroprc $TMPFILE" -f ~/.fetchmailrc-myUser
gzip -c -9 $TMPFILE > $MAILBOX
Commands should be on a single line, so join the lines split by a '\'
DATE=`date +"%b-%Y"` VERBOSE=2 #Mailbox name is the first user argument MAILBOX="$1" to $MAILBOX
poll imap.server protocol IMAP user "myUser" password "passwd"
Cannot open self ./myProg or archive ./myProg.pkgThis is all because of executable stripping. By default EPM strips executables, and frozen python exes don't work anymore. So, in your EPM list file, remember to use the nostrip() directive, like here:
f 755 user group ${prefix}/myProg ${srcdir}/myProg nostrip()
If you want to deploy stripped executables, use strip=True as arguments in your EXE and COLLECT objects in the PyInstaller spec file. |
|
May '12 | |||||
| Mo | Tu | We | Th | Fr | Sa | Su |
| 1 | 2 | 3 | 4 | 5 | 6 | |
| 7 | 8 | 9 | 10 | 11 | 12 | 13 |
| 14 | 15 | 16 | 17 | 18 | 19 | 20 |
| 21 | 22 | 23 | 24 | 25 | 26 | 27 |
| 28 | 29 | 30 | 31 | |||
2006-2011 Giuseppe 'Cowo' Corbelli | Cowo's homepage | Cowo's photo page | Contact me | Back to top
Design by Andreas Viklund | Serendipity Template by Carl