How to Unpause Applications in Mac OS X

I asked this question on after experiencing this problem. Now it’s accessible to everyone.

When something goes wrong and you run out of memory on Mac OS X, the system puts your existing applications to pause to prevent the system from becoming unstable. After taking care of the problem and freeing more memory, you might notice that the applications you had are still frozen. To unpause them, find their PID using ps and use the kill command to revive it (irony)

kill -CONT 111

Of course, 111 here is replaced with the PID you found with ps

Quake Style Drop Down Terminal for Windows

I was used to the convenience of drop-down terminals like Visor in Mac or Yakuake in Linux and needed something similar in Windows.

It turns out, it is possible to achieve almost the same effects in Windows with the use of 2 tools.

  • AutoHotkey –¬†¬†lets you run scripts triggered by hotkeys anywhere in Windows
  • Console – is a terminal app that lets you run a custom shell with no title bar, no borders, transparency etc.

Read More…

Deploy PyQt Applications on Mac OS X with PyInstaller!

The interweb seem to incline on py2app when it come to deploying applications on mac. I’ve tried to make a single deployable .app file for my application for a long time trying to follow these instructions from ars technica. I’m not a hacker and just want to produce a deployable usable application for others to use. And it seems py2app from MacPorts wasn’t able to surmount the Snow Leopard’s 64-bit compatibility issue.

And then, I was slacking off while studying for my final and out of nowhere I found PyInstaller‘s explicit support for PyQt and its recent support for the mac. And after trying, almost everything works out without much of a kink. Credit goes to ChrisWayg who produced an amazingly complete and up-to-date set of instructions to follow. I’m merely telling how my application did using his instructions (April 2010) and hopefully doing my part to draw more attention to the excellent PyInstaller. Read More…

Python’s Function Static Variable

So you want a variable that stays between different calls of a function. Not the sexiest thing ever but always handy in small programs.

There’s tons of ways of doing this. You can embark on a quest to find the meaning of Pythonic or take this method that’s relatively simple:

def a():
    if not hasattr(a, "b"): a.b = 0
    a.b += 1
    print a.b

Calling a(), you’ll get 1, 2, 3, …

Note attribute ‘b’ of ‘a’ does not exist until you declare it for a first time. My main preference here is that ‘static’ variables used this way does not spill onto the rest of your code. Also, it’s clean, no classes, no data structures.

Suppress Scapy IPv6 Warning

When you run Scapy without a default IPv6 routing gateway, Scapy will display this annoying warning:

WARNING: No route found for IPv6 destination :: (no default route?)

You definitely don’t want to see it every time you run the script you built with Scapy. To get rid of it, simply add

import logging

before importing Scapy to suppress all messages below error messages

Determining Run-Time/DesignMode in .NET

Suppose you fill your table with data from a database, you wouldn’t want it to do so while in Visual Studio’s Designer. Control.DesignMode ought to be the perfect property to check for in your form initialisations but unfortunately, it’s so buggy that it hardly does what you need. It doesn’t work in the constructors and have problems with user controls.

Then people tend to use

If (Process.GetCurrentProcess().ProcessName == "devenv")

which works fine if you call it once but inside a key user control’s initialiser, it may be called hundreds of time and cause a massive memory leak. Currently, the ProcessName string never gets freed and fills up memory very fast. Instead, save the process name in your own global variable when the program starts and check against

If (MyProcessName == "devenv")


Moving Bootcamp Partition to New Drive

I bought a new hard drive. My Windows setup already had extensive amount of software and configurations on it that I didn’t want to remake. It worked well, which was rare, so I wanted to keep it.

Winclone is an excellent free tool that lets you do just that! Unfortunately there wasn’t much confirmation on the inter-web that it has been done with Snow Leopard and Windows 7 64-bit. So I tried just that and it worked flawlessly! Read More…

DataGridView Change Cell Data Type After Binding

I don’t know actually since most of the relevant stuff becomes read-only after filling with data. But my approach is solve this as early on in the process as possible to the entirety of the data and save processing time on a custom loop after.

In other words, your DataGridView is typically bound to a DataTable. That is typically filled with stuff from the database. Make sure your AutoGenerateColumns property is set to true in the DataGridView and select your data to match the type you want to display in the DataGridView. For instance, to get checkboxes,

SELECT ..., CAST(column1 AS bit), ... FROM ...

and change the data type right out of the DataAdapter and DataGridView will figure out the rest automatically

BackTrack 4 Pre-Release Apache, PostgreSQL Autostart

BackTrack 4 is in pre-release and it’s a beautiful system. However, there seems to be a problem where after your first apt-get upgrade, the system will try to load Apache, PostgreSQL and other daemons on startup. Not exactly what you want when you want a clean system. To turn it off and prevent autostart:

sudo update-rc.d -f apache2 remove
sudo update-rc.d -f postgresql-8.3 remove
sudo update-rd.d -f dhcp3-server remove

This way, you can go on doing your thing without anything that leaves you open

1 2 3 4 5 6  Scroll to top