# QT Segfault When Accessing Ui Objects

I’m starting with QT for a hobby project. My design called for a public method inside of my QMainWindow main window. the method will update the text in the display. When calling anything using the ‘’ui->’‘ pointer, the app would segfault. The QT Creator debugger showed the ui pointer as ’‘. That was a clue. To confirm, I wanted to see gdb’s output.

To enable debug symbols for GDB, I had to edit the ‘.pro’ file and add the line ‘’#CONFIG += debug’‘. After the edit is made, change directories to the project folder, run qmake, make clean, and make. Once the build is completed, ‘gdb ./terminal’ (terminal is the name of my program).

I ordered without much of a problem and my Debian server was provisioned within a few minutes. I was a happy camper. $2.99/month is a great deal for root access to a server, even one with such meager specs. I’ve had a decent year of hosting with QuickWeb, but I decided to take my business elsewhere when my plan came up for renewal. To help explain why, I want to share the three support tickets I had to open with them. This will give you the clearest idea of what you get for the money. I Would have included the full text of these exchanges, but they insert a privacy notice in the signature of their support emails, so i’m worried that I may have agreed to something in their TOS. 1. The server that QuickWeb provisioned for me was fully loaded. For me, that wasn’t such a good thing. The server already had web, DNS, and mail server software installed and running (apache, named, and postfix IIRC). I wasn’t comfortable with that because I prefer to start from scratch, planned on using nginx and didn’t need to run a DNS and public mail server. I opened a ticket asking if i could get a server provisioned that only includes the base Debian install. The response from QuickWeb was that they don’t have a minimal template ‘yet’, but that I could uninstall packages that i don’t need using apt-get. Thanks. 2. In July of last year, there was a service interruption. This site was down. Not just me, I checked stuff like connecting from a few other servers that I have access too and, of course, http://www.downforeveryoneorjustme.com/. I opened a ticket. An hour and a half later, a response told me that I had sent the ticket to sales instead of the helpdesk and next time, to use the helpdesk for faster response. Another hour and a half later, they replied and told me that the VPS was actually up the whole time, but there was a brief network interruption in their management network, so I wan’t able to connect to check the status of my VPS. I had to reiterrate that whether or not the server was UP, It was unreachable over the network for an hour and a half. The last reply from them came 8 hours in. They asked me to do stuff like turn off IPtables and give them a traceroute. I gave them a ticket without a lot of information, somehow sent it into their sales queue, but it took them 8 hours to get me a semi-intelligent response. They never acknowleged a problem with public connectivity to my server. 3. The isue that sealed the deal for me happened this December when QuickWeb changed the IP of my server. Despite their claims to have notified me, I never got an email from them. I used a gmail account to handle all their communication with me. Yes, even checked the spam folder. No notice. I submitted a ticket for this one too and all they did was tell me that they sent me emails about it while I told them that they didn’t. The server this site is runing on now is a KVM VPS from bitcable. So far the support there is night and day compared with QuickWeb. Preetam helped me set up the virtIO drivers on FreeBSD. More on that later. # Create a Custom Application Launcher in GNOME3 | Comments On Arch, the system-wide shortcuts are stored in /usr/share/applications. Each one is a .desktop file with a few parameters. user-specific icons are stored in ~/.local/share/applications. I downloaded eclipse and extracted it in my home directory, so I’ll use eclipse as the example application. 1. Create the .desktop file  nano ~/.local/share/applications/Eclipse.desktop  Paste this in:  [Desktop Entry] Encoding=UTF-8 Version=1.0 Type=Application NoDisplay=false Exec=/path/to/eclipse/eclipse Name=Eclipse Comment=Launcher for Eclipse  Each line is pretty self-explanatory. Edit to suit your needs. As soon as you save the file, you will be able to see your new shortcut in the list. 2. (Optional) Give the shortcut a nice-looking icon: You probably noticed that your icon is an ugly diamond. To pretty it up, you simply have to add one more line to the desktop file.  Icon=/path/to/eclipse/eclipse.svg  Your application may have included a png icon, but to make it really look nice, you should grab an SVG file of the logo from somewhere. Arch has a very simple packaging process which lets you examine all of the package building elements through their webpage at http://www.archlinux.org/packages/. I was able to grab the SVG which the package uses like this:  wget -O eclipse.svg http://projects.archlinux.org/svntogit/packages.git/plain/trunk/eclipse.svg\?h\=packages/eclipse  # Wordpress HTTPS Secure Login | Comments Back when I started with Wordpress, I had to create server rewrites to force my browser to use HTTPS. That changed back in 2008, but this is the first i’ve heard of it. Wordpress 2.6 (released in July, 2008) and newer include the tools do do this out of the box! Using this documentation, you can get rid of some old .htaccess or nginx rewrite rules: http://codex.wordpress.org/Administration_Over_SSL. All you have to do is add the declaration in wp-config.php: define('FORCE_SSL_ADMIN', true);  This forces logins and administrative sessions to use SSL. Now, you can remove the old nginx rewrites. They aren’t needed anymore: rewrite ^/wp-login.php(.*) https://www.surlyjake.com/wp-login.php$1 permanent;


# WordPress Redirection Plugin

This blog is undergoing some changes.There is some content (like the zabbix pages) that I can no longer maintain since I no longer use them in my day-job. To keep everything working seamlessly, I wanted to create some 302 (permanently moved) redirectors for the content that I was taking down. In the past, I used a plugin called “smart 404” to intelligently redirect visitors to a good page instead of the dummy standard 404 page. Unfortunately, It looks like smart 404 is having some trouble in newer WordPress versions and wouldn’t create a smart suggestions on my 404 page.

Enter Redirection. Redirection gives you a menu in the admin interface which allows you to easily create and maintain 301 and 302 redirections (among other features). Here is a screenshot of what it looks like once activated:

From the screenshot, you can see that I was able to create a simple 301 redirect from a page on my WordPress instance to an external website where the content will live from now on.  The second rule allowed me to match the URL using a regular expression and redirect it to another page on my site. This is a great piece of software.

One issue I ran into when testing the plugin was that edits I made did not seem to be taking effect. This turned out to simply be my browser caching the 301 response. I recommend that you either manually clear the cache or download the web developer toolbar and disable cache.  I should also note that my server runs nginx and not the Apache web server. I simply deleted the redirection ‘module’ for Apache which attempts to create .htaccess rules to perform the redirections. Without the Apache module, WordPress handles the redirections.

Redirection Plugin documentation: http://urbangiraffe.com/plugins/redirection/

# Prevent Samba From Creating Home Directory for Machine Accounts.

Since this setup automatically creates a home directory for a user as soon as they access the machine (via samba, ssh, console), I noticed some directories being created for computer accounts.  To prevent this,  I have added a line that only “Domain Users” are allowed to authenticate.  To add this:

wbinfo -n "Domain Users"


It will spit out the SID for the Domain Users group. Something like this:

S-1-5-21-((some number))-((some number))-((some number)) Domain Group (2)


Take that number and change the Pam_winbind.so line in /etc/pam.d/common-session to look like this:

session sufficient pam_winbind.so require_membership_of=S-1-5-21-((some number))-((some number))-((some number)


# Create a Single Standalone .exe From a Python Program

I have been working on a small windows command line tool that I wanted to distribute it as a single executable file on windows. I tried cx_freeze and py2exe. Both of these tools worked well, but I couldn’t find an easy way to compress make the whole program into a .exe file. py2exe and cx_freeze both create working programs, but there are always some dependent .zip archive or .dll’s somewhere that need to be distributed with it. Pyinstaller, I found, actually compresses everything into a single .exe. This makes a pretty big executable (my small command line utility created a 5MB .exe file), but it’s simple and it works.

To use pyinstaller:

1. grab pyinstaller 1.5rc (1.4 doesn’t work with python 2.7). extract the zip file anywhere.

2. change directories to the pyinstaller folder you just created.

3. Before you create your first executable, you will have to run this once.

python configure.py

4. Now, pyinstall needs to scan through your program and create what they call a spec file.

python makespec.py --onefile path\to\program\program.py

5. Now, run this command to generate the executable.

python build.py program\program.spec


Once the command has finished, the standalone executable will be available in the program\dist folder inside of pyinstaller. Instructions for how to do this for a linux executable on ubuntu linux can be found here: http://excid3.com/blog/2009/12/pyinstaller-a-simple-tutorial/. You can find more info on pyinstaller at their website: http://www.pyinstaller.org/.

# Install Open-VM-tools on Debian 6 Squeeze

Installing Open Virtual Machine Tools is a nice alternative to managing and installing the vmware tools package that comes with Vmware’s hypervisor products.  It allows you to use APT to manage all the dependencies and updates. Module assistant will recompile the kernel modules for you automatically when you update kernels too.

I have verified that this configuration works under ESXi 4.1.0, 260247 and a new Squeeze install. All of the essential functions like being able to see guest OS information on the Vsphere summary page and performing “Shut Down Guest” and “Restart Guest” all work as expected. If your experiences vary, please leave a comment

This should all be performed by the root user (otherwise prepend ‘sudo’ to the commands if you must use sudo). _ The first thing you need to do is add the ‘contrib’ archive to your apt sources config:

nano /etc/apt/sources.list


Add the ‘contrib’ to the end of these source lines. I use the debian.uchicago.edu repository, so mine look like this on a new install:

deb http://debian.uchicago.edu/debian/ squeeze main contrib
deb-src http://debian.uchicago.edu/debian/ squeeze main contrib


After you save changes to the file, simply update your package list and perform the install:

apt-get update
apt-get install open-vm-tools open-vm-source


You might see an error that looks like this:

Loading open-vm-tools modules: vmhgfsFATAL: Module vmhgfs not found.

module-assistant auto-install open-vm -i

apt-get install open-vm-toolbox