Browsed by
Category: Programming

The value of ESP was not properly saved across a function call…

The value of ESP was not properly saved across a function call…

Windows can trigger this error, but sometimes it’s not easy to figure out what’s going on.

I recently got this error when trying to use the OpenGL ES ANGLE library on Windows 10. When compiling against the ANGLE library, the error came when trying to call into the ANGLE and used eglGetProcAddress().

eglGetProcAddress() returns function pointers for important GL extensions, so I couldn’t just ignore it or work around it.

In looking around, the obvious first step is to make sure you’re defining the function pointers correctly, but that turns out not to be my problem.

In looking at this article, I realized I probably had a mismatch of compiler and linker settings. The Visual Studio projects (VS2008) that came with ANGLE required a certain set of compiler and linker flags that were not standard. I had migrated the Visual Studio projects to VS2015, so that also added an element of uncertainty. I simply opened both project settings up next to each other and compared the settings for the ANGLE library build and the final project and found a few mismatches. I change a number of them to be the same, and things worked great.

Summary:
Check the linking AND compiling flags for not only your project, but the project files that generate the libraries you’re linking against. Differences in compiler settings can cause this error.

Practice your coding skills

Practice your coding skills

For those of us that work in the industry, one of the difficult parts about working in high tech is constantly keeping on top of all the new developments and technology.

One of the things I’ve noticed after you get a lot of years of work under your belt is that you naturally start specializing into certain areas. These specializations are good in themselves, but often they utilize only slivers of the original breadth of computer science, algorithms, and data structures. If one is not careful, you can lose that breadth that is essential to your adaptability.

LeetCode is a great website with literally hundreds of coding problems that can help you brush up on your algorithms, data structures, and coding skills.  Give it a whirl!

‘Audibilization’ of sorting algorithms

‘Audibilization’ of sorting algorithms

Visualization and “audibilization” of 15 Sorting Algorithms in 6 Minutes.
Sorts random shuffles of integers, with both speed and the number of items adapted to each algorithm’s complexity.
The algorithms are: selection sort, insertion sort, quick sort, merge sort, heap sort, radix sort (LSD), radix sort (MSD), std::sort (intro sort), std::stable_sort (adaptive merge sort), shell sort, bubble sort, cocktail shaker sort, gnome sort, bitonic sort and bogo sort (30 seconds of it).

Google more information via the “Sound of Sorting”.

CMake with compilers that need custom parameters

CMake with compilers that need custom parameters

When using CMake on non-GCC/non-Microsoft compilers – you often run into interesting problems. Especially true for embedded devices/cross-compilers.

One thing that can bite you is the fact that CMake requires the compiler to pass a ‘smoke’ test. Unfortunately, if there are required parameters for your compiler, the smoke test part will fail.

There are a few ways to solve this, the ‘recommended’ way seems to be via the CMAKE_FORCE_C_COMPILER/CMAKE_FORCE_CXX_COMPILER flags. This allows you to tell CMake what the compiler is and pass the smoke test.

CMAKE_FORCE_C_COMPILER(/usr/mycc/cxint86 GNU)
CMAKE_FORCE_CXX_COMPILER(/usr/mycc/cxxint86 GNU)

Here are the docs for more information
https://cmake.org/Wiki/CMake_Cross_Compiling#The_toolchain_file

Siggraph 2015 paper – Dynamic Skin Microgeometry

Siggraph 2015 paper – Dynamic Skin Microgeometry

Generating photo-realistic faces has long been a holy grail for rendering. It’s the combination of a number of difficult problems – eyes, skin, hair, etc. These guys demonstrate a simple, innovative new technique for mimicking the complex skin structures that occur when a character makes different faces. They simulate these ‘micro-structures’ by using anisotrophic bluring/sharpening of facial textures. Good for both realtime and off-line techniques.

Machine Learning and you

Machine Learning and you

Recently I took the Coursera Machine Learning course from Stanford and got to implement a lot of these kinds of algorithms (HIGHLY recommend the course).  This guy took it a step or two further and added some clever visualizations and additional training tricks.  Very good work – especially considering it was done by a seaming amateur implementer.

It’s fascinating how we can now write small neural nets like this and very quickly train our computers to do work not only as good as us, but in growing numbers of cases, better than the BEST humans in the world could do.  The implications are staggering…and somewhat disconcerting.  What happens when we have enough compute and enough data that our racks of machine learning systems can do all the analysis and optimization of every facet of our society?  What does that leave us to do, and how does our economic system work when many of these thinking jobs go away?

While this has been argued all the way back to the industrial revolution, there is some growing work by more respected people that we are turning a tipping point (http://www.businessinsider.com/technology-is-destroying-jobs-and-it-could-spur-a-global-crisis-2015-6).  Or more interestingly, do we go through another era much like the industrial revolution in which broad swaths of the population become cogs in a bigger machine until we re-adjust.  Much food for thought and social rumination…

Google Code closes down – Taskbar Sound Switcher moves to GitHub

Google Code closes down – Taskbar Sound Switcher moves to GitHub

Well, I didn’t have my project uploaded more than a week and Google send me an email informing me that Google Code hosting is shutting down.  Here’s the email:

Hello,

Earlier today, Google announced we will be turning down Google Code Project Hosting. The service started in 2006 with the goal of providing a scalable and reliable way of hosting open source projects. Since that time, millions of people have contributed to open source projects hosted on the site.

But a lot has changed since 2006. In the past nine years, many other options for hosting open source projects have popped up, along with vibrant communities of developers. It’s time to recognize that Google Code’s mission to provide open source projects a home has been accomplished by others, such as GitHub and Bitbucket.

We will be shutting down Google Code over the coming months. Starting today, the site will no longer accept new projects, but will remain functionally unchanged until August 2015. After that, project data will be read-only. Early next year, the site will shut down, but project data will be available for download in an archive format.

The simplest option would be to use the Google Code Exporter, a new tool that will allow you to export your projects directly to GitHub. Alternatively, we have documentation on how to migrate to other services — GitHub, Bitbucket, and SourceForge — manually.

For more information, please see the Google Open Source blog or contact google-code-shutdown@google.com.

-The Google Code team

 

The good news is that the Google Code Exporter works really well.  The only extra work I needed to do was work up a readme.md file.  A handy tool for doing the markup can be found on http://dillinger.io/ which allows you to write on one side and see the results on the other.

TLDR:
So, if you want taskbar sound switcher – it’s is now hosted on GitHub:


https://github.com/mattfife/taskbar-sound-switcher

 

Quick Audio Taskbar Sound Switcher

Quick Audio Taskbar Sound Switcher

When using my computer I often use my speakers when listening to music, watching movies, or coding something up. As a first-person shooter fan, I usually want to use headphones so I can use the mic to coordinate play with the other live players and not completely bother the rest of the people in the house with gunfire, explosions, and ‘colorful language’.

Switching between audio output devices on Windows systems usually requires no less than:

  1. Right-click on speaker tray icon
  2. Left click on playback devices
  3. Right click on device you want to be the default output device in Sound selector
  4. Left click on ‘Set as Default Device’

Fun! Not. Even worse is that many times I click on the game I want to play only to realize I forgot to switch audio devices.  In many games, alt-tabbing out and switching the default audio device doesn’t actually change the in-game playback device.  You have to exit the game and restart.  Annoying.

What I want is a taskbar icon I can simply double-click to switch between headphones and speakers – or any of my many audio devices really.  So to that end, I wrote up an app that does exactly that.  You simply select which devices you want to toggle between (any number) and double-clicking the tray icon simply toggles you to the very next device.

Or, you can right-click on the icon and select the device directly with a single click.

Give it a try.

Click here to download a copy.

The MSI installer is in the source directory.  Even better is that I’ve put the code up on Google Code and it’s open-source under the BSD license.

Drop a line if you found it handy or have suggestions!