How can you see which code a module executes when your app calls an ioctl system call? Consider this situation: You app gets to the point where it executes an ioctl syscall and returns an error, e.g. if (ioctl(fd, STVMIX_IOC_DISCONNECTLAYERS, &STVMIX_Ioctl_DisconnectLayers) != 0) { /* IOCTL failed */ ErrorCode = ST_ERROR_BAD_PARAMETER; printf (” STVMIX_DisconnectLayers():Ioctl error […]
C programming
How to map enum to strings in C
How can we map the enum values to strings in the C programing language? Often times you need to display a C enum as a string, most often when debugging or handling error conditions. Typical techiques involve usually: a) defining an array of strings (the strings being the enum names of course, and the string […]
Embedding resources in netbeans (Java JAR files)
Suppose you want to add some images to your JAR Java application. This has several advantages such as security, portability, conveninece for you and your users (don’t need to copy around several files – everything is nicely packaged and embedded into one JAR file). How can we embed the resources into the app (the .jar)? […]
Git remote branches: how to create, track, remove/delete
1. Here’s how to to create a remote branch in git:: git push origin origin:refs/heads/my_branch … or even simpler and more straightforward: git branch my_branch # create branch locally git push origin my_branch # push it to server 2. To push your changes to the remote branch: git push origin my_branch 3. To delete the […]
How can I make gcc do this…
This post will be dedicated to gcc’s command line options and various other questions related to compiling/building your code with gcc. For example… ——————– How can I get gcc to generate assembly code for my C file: gcc -O2 -S -c foo.c ——————– How can I tell gcc to generate an assembly listing? (that is […]
How to move a branch in git?
“Moving a branch” may mean two things: 1. Move the contents (the commits, the changes) associated with a branch name somewhere else in the repository. 2. Move the branch name (not the code changes!) to point to some other commit. Let’s examine the two possibilities in detail: 1. Move branch contents and name: This case […]