Mehran Maghoumi

Author's posts

Compilation Error when Invoking “CudafyTranslator.Cudafy()”

When using CUDAfy.NET, if you encounter the “Compilation Error” when running examples, simply add “cl.exe” to your PATH! It will resolve the translator exceptions. It’s funny how I didn’t find much about it online…

Carve Error : “didn’t manage to link up hole!”

Carve is a fast and robust library for performing Constructive Solid Geometry (CSG) operations (boolean operations) on meshes. In case the mesh is corrupted or has self-intersections, Carve will refuse to perform operations on it and will terminate with this error: “didn’t manage to link up hole!”. To solve that, simply open the mesh in …

Continue reading

C# Deserialization of a List<> Returns a List with “null” objects

In .NET, the List<> class is serializable. However, you should note that during a call to the deserialization constructor of the objects the list contains, the list will be empty. All operations on the newly deserialized objects (such as value checking and so on) need to be performed in another function marked by the [OnDeserializedAttribute] attribute. …

Continue reading

CMake Unable to Find AMD’s ACML Files Under Windows

One popular BLAS implementation under Windows is AMD’s ACML. CMake has some modules that can find certain required dependency libraries. As far as I know, under Windows the “FindBLAS” and “FindLapack” modules are unable to locate AMD’s ACML libraries. This is because ACML > v4.0 does not include the “mv” related packages anymore. I looked …

Continue reading

Cannot Find “getopt.h” File When Compiling Under Windows

Often times, issues arise when compiling C/C++ code developed for Linux under Windows. One annoying problem is when the code requires some header which is only available in the POSIX API. A header commonly used for parsing the command line arguments is getopt.h. Unfortunately, this header is only available under Linux. After some digging around, …

Continue reading

Rotate a 3D object around its center and own axes in WPF 3D

In WPF 3D, various transformations could be applied to an object. One particular problem that I occasionally run into is when I want to apply a rotation transformation to an object and rotate it around its own center and axes. The way I do it is as follows. First I apply 3 identity RotateTransform3D‘s to the object …

Continue reading

Orient a Transform to a Specific Direction in Unity 3D

If you are too lazy to do the math to orient an object to a specific direction, this tip is useful for your. The Transform objects in unity have the Forward, Up and Right properties. You probably don’t know that they are not only accessors but also mutators! You can simply assign a direction vector to an …

Continue reading

C/C++: Code Not Working under a Certain Build Configuration

If your C/C++ code works fine under a certain build configuration (eg. Release) but not under another (eg. Debug) or simply works fine when built with a certain compiler, it is a sign that the code is not robust and some small detail which depends on compiler optimization is producing undefined behavior. For instance, my …

Continue reading

Fix MATLAB Error: “dlopen: cannot load any more object with static TLS”

On Linux, you may occasionally encounter the error “dlopen: cannot load any more object with static TLS” in MATLAB. This is a known bug since way back! To fix, create a file “startup.m” in the directory that you start MATLAB from with the following content: ones(10)*ones(10); I know! It’s ugly… But it works!! EDIT: Since it …

Continue reading

Apache Always Redirect to HTTPS for SSL Websites

After getting an SSL certificate, it is usually good idea to redirect all http (port 80) connections on your website to https (port 443). This can be simply done in Apache. To do this, just go to your public_html folder and either create a .htaccess file and add these lines, or add them to the already existing .htaccess file: …

Continue reading