PaNiC Random Rant (or how we used to call it: .plan)
HTML5 Hex Grid with mouse mapping
A simple hex grid map with mouse mapping just to explore what HTML5 canvas can do (and it looks to me a lot like Cairo). Maybe someone will start a panzer general clone reusing the code from lgeneral ?
http://www.linuxconsulting.ro/code-repository/repository/html5-hexgrid/hexgrid.html
Or a better example(looks like no one started a panzer general clone so I did):
Open Panzer
Labels: programming
QMake with Visual Studio: Generating debug information (pdb) files
Working with multiple libraries on different subdirs in Visual Studio using QMake tools brings a problem when you try to debug code that is contained in those libraries: the debug files (pdb) are generated with same name (vc80.pdb or similar) in libraries dirs which results in visual studio being unable to get the right debug information. To fix this problem pdb files need to be renamed and placed in the location where the executable is run for debugging.
As an example we have a main .pro file which it's a subdirs template to compile code in multiple subdirs:
TEMPLATE = subdirs
CONFIG += ordered
SUBDIRS += mbl_utils \
mbl_usb \
mbl_encoder \
mbl_renderer \
nanoGUI
For each .pro file in the libraries subdirectory we will have to add on a debug:win32 entry the following code:
debug:win32 {
# Hack to get pdb files generated with proper name
QMAKE_CXXFLAGS += -Fd$${TARGET}.pdb
# Hack to get pdb files copied in Bin folder from where the binary is run
pdbtarget.files = $${TARGET}.pdb
pdbtarget.path = $${BINDIR}
pdbtarget.command = copy /y $${TARGET}.pdb $${BINDIR}
INSTALLS += pdbtarget
}
Where TARGET is defined as the library name and BINDIR is where the executable file is copied after compilation. This should create proper debug information files where the project executable is being run.
Labels: programming, qmake, qt, visual studio
Hijacking library calls
From time to time you might want to override a function call by a binary or library with your own supplied code. This might be useful for example binding a program to a certain address considering that the program doesn't have an option for that. It can also be used for debugging or other obscure tasks. The attached example it's pretty simple, it saves the real address of connect function from libc to a function pointer named real_connect, reads the address/port information from environment and issues the new parameters after the bind call has been performed to the real_connect function.
For your "library" to be preloaded it has to be added to /etc/ld.so.preload by simply doing:
echo "/path/to/libc-highjack.so" > /etc/ld.so.preload
To use it, before starting a program, export HIGHHACK_PORT and HIGHJACK_IP to the values that you need.
The compiling instructions are in the source code.
uploads-blog/libc-highjack.c
Labels: hacks, libc, programming
Python Wrapper for picoLCD
Chris Jones has created a python wrapper for my picoLCD SDK which is available
for download here. You can read more about this at his blog and watch a nice video
of his python application and picoLCD in action here.
Labels: picolcd, programming, python