Skip to content

Content classified under "Software"

Page 10 of 21

Stream from a String Instead of CIN in C++

January 11, 2016Category: Software
TL;DR : You can stream from a string instead of STDIN . Code is simple and is listed below. A project I did recently had a requirement to overload the >> operator use and STDIN to load data. The problem was not the overload itself, but the fact that testing would introduce a manual side. To get…

Load Glyphs with LibGDX

January 3, 2016Category: Software
TL;DR : Remember to give the font loader the list of characters to render from the font! I'm trying to get a more resolution-independent mechanism to load simple shapes in place. After investigating SVG loading for several days I got nowhere. Then, I found out that libGDX actually supports vector…

Don't Use Assert() If You Don't Mean It (C++)

December 26, 2015Category: Software
I found the hard way that assert() in C/C++ exists hard. This post explains that you get a SIGABRT . So, if you want your code to be testable, you better throw an exception instead. I defined a macro: So, in a code like this: You'll get an exception with the message "1 > 2" . Useful. You can…

Trick C++ on Unused Variables

December 24, 2015Category: Software
If you enable warning on unused method parameters ( -Wextra or -Wunused) and you get warnings in method parameters, you're supposed to change the signature. Sometimes this is not OK and you still need the build to pass cleanly. Java has the glorious @SuppressWarnings, so my best and most portable…

Simple Floating Point Equality Check in C++

December 21, 2015Category: Software
TL;DR : Here you can see a handmade comparison function for floating point values. While working on a C++ project using templates, I had to perform an equality to see if two values are identical. While the == is OK for integer values, it is not really OK for floating point values. At that point, you…

Build a Simple Makefile

December 20, 2015Category: Software
TL;DR : If you don't have anything better to do, create Makefiles by hand :) Gist here . The other day I went back to origins with building a small C++ project. With modern tools, all went OK. However, deployment was a bit of a problem, in the sense the host had an obsolete toolchain: So, I had to…

Generate Amazon Underground Launcher Icons

November 26, 2015Category: Software
TL;DR : Use (adapt) the script below to automatically generate the Amazon Underground application launcher icons. I was toying with the idea to build an Amazon Underground version of one of my applications. According to their rules, you need to: Repackage your app Name custom permissions (Lollipop…

RGB to HSV to RGB - for Shaders

November 15, 2015Category: Software
TL;DR : Go here to get the RGB->HSV and HSV->RGB conversion functions for shaders. The other day I tried to tint a colour in a texture (or rather all texture) with a different colour. It's quite easy to rotate things around, but, if you want to do it parametrically, you'll need something a bit…

About Java Exceptions in SE 7

November 7, 2015Category: Software
TL;DR : JDK 7 improves on exception handling (less code, base exception class...). Base exception class Reflective operations exceptions now have a base class ReflectiveOperationException. This allows you to to a global catch rather than one for each exception. Now you can write: Note : Reflective…

Picking Colours for Your Application

November 5, 2015Category: Software
While working to get a theme for my new app Epso View (Play and Amazon ), I've identified two types of websites: Inspiration (like dribbble or materialup ) Combinations (like colourlovers or materialui ) You can use the inspiration sites to get inspired; what colours work together, would…

All categories