Often times it is useful to construct a string visible to the pre-compiler and assemble it from one more more other values, defined by means of a #define dierctive. Here’s some example code (this is some custom environemnt config for U-Boot for a STM-based device I work with): #if defined( DEVELOPER_ALAN ) #define CONFIG_ETHADDR 00:23:b0:00:00:00 […]
Programming
Pages related to coding, computer programming, software development. You know… geek stuff.
What files to add to my version control (git,svn,etc..) from my Visual Studio project?
I guess ultimately the question is what NOT to take into your code versioning system… This is the contents of my .gitignore file… there may be other things which need to be ignored but that’s what I use: Backup/ Debug/ Release/ bin/ obj/ _UpgradeReport_Files/ CodeAnalyst/ *.csproj* *.user *.suo *.ncb *.dll *.exe *.pdb ipch/ *.sdf *.opensdf […]
How to install drupal in a sub-directory
I tried to install a drupal site in a sub-directory of a domain and I ran into some problems. I will explain here how I solved them. Many forum topics and issues on drupal.org and elsewhere on the web discuss how to install drupal in a sub-directory of your domain and to have it appear […]
WordPress Quick Tips: background color, special chars
To set special attributes of a paragraph e.g. the background, font typeface, color and size, etc enclose your paragraph in a <div> tag, e.g.: <div style=”background-color:black;color:red;font-size:0.75em;font-family:Courier”> Your paragraph goes here. It will use a Courier font, 75% of the normal size, and the text will be red on a black background…</div> Using the above settings […]
GDB – how to step into uClibc if you have .debug files
1. Make sure your debuginfo files are part of LD_LIBRARY_PATH. To do this, either a) add the path where you stored the .debug files to your LD_LIBRARY_PATH environment variable, e.g.: $ export LD_LIBRARY_PATH=/opt/STM/STLinux-2.3/devkit/sh4_uclibc/target/usr/lib/debug:/opt/STM/STLinux-2.3/devkit/sh4_uclibc/bin/../lib:/opt/STM/STMCR1.5.0/lib:/opt/STM/STLinux-2.3/devkit/sh4_uclibc/bin/../../../host/stmc/lib Then restart gdb. OR b) start gdb and set the LD_LIBRARY_PATH from within gdb: (gdb) set env LD_LIBRARY_PATH /opt/STM/STLinux-2.3/devkit/sh4_uclibc/target/usr/lib/debug:/opt/STM/STLinux-2.3/devkit/sh4_uclibc/bin/../lib:/opt/STM/STMCR1.5.0/lib:/opt/STM/STLinux-2.3/devkit/sh4_uclibc/bin/../../../host/stmc/lib In my case […]
Creating an Android app which uses a provider library
1. Get the library jar from your phone, using the ADB (Android Debugger Bridge). It will be in /system/framework somewhere. In my case it was the file fmreceiverif.jar. 2. Unpack the jar and get the classes.dex file. 3. Use dex2jar to convert this file to a jar file, i.e. convert the Dalvik VM code into […]
WordPress <code> does not keep code indent’s – use <pre>
Yup. Silly as it may sound the <code> tags in WordPress are pretty much useless when you want to paste a code snippet and not have it look like a poem written by crazy robot… 🙂 Use the <pre> .. </pre> tags instead. Here’s an example. Code formatted with ‘<code>’: while( 1 ) { tmeasure_t0( […]
Convert UNIX time_t into a date/time text string
Often times, when working with the standard Linux/UNIX time format (time_t) one needs to quickly find out what is the “human readable” date and time text string a particular time_t value corresponds to. NOTE: The ‘C’ time_t type is the number of seconds elapsed since the “epoch”, the epoch being January 1st 1970 at 00:00:00. […]
HowTo: Listing (changed/untracked) files in git
When working with git it may often be convenient to get a (pure) list of files to give to some other command (e.g. astyle). This may be implemented as a trigger on the server but that has its pros and cons. Listing the modified files and processing them locally is the safest way as this […]
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)? […]