samedi 8 septembre 2012

using Eigen


Today I took some time to replace my own (vector) math library by Eigen.
This library is great and fast. I could replace my own lib in my software (3d opengl and math calculation) in few hours only.
(I still use the "double" type because it provides better precision and I didn't see any speed improvement using float)

PS: if you see a linkage issue with Eigen and you are using cross or dot, then just include the geometry header: #include <Eigen/Geometry>

Hope it will be useful for you.

Happy coding.

dimanche 12 août 2012

compiling boost with clang mac os x

Here is the command to compile boost on mac os x with clang:

> ./
> ./b2 toolset=clang cxxflags="-stdlib=libc++" linkflags="-stdlib=libc++"

however boost 1.50 has issue with the signal lib,
I downloaded trunk, everything ok so far.

and to install:

> ./b2 toolset=clang cxxflags="-stdlib=libc++" linkflags="-stdlib=libc++" install

enjoy boost.

dimanche 5 août 2012

fastcgi with apache on mac os x lion


First of all, I had many issues with apache to make it running. It does not start well from the preferences. Google it to find some workarounds, but none of them really worked for me.
Even sometimes, it indicates as not running but it is :-/

just few tips about apache on max os x (lion):

> sudo apachectl stop
to stop apache

> sudo apachectl start
to start apache

> sudo apachectl -t
to check what was wrong

> cat /var/log/apache2/error_log
to check the error log

1. First we would need to get the fastcgi library:

unzip it somewhere and go the the unzipped folder.
> ./configure
> make
> sudo make install
as an alternative for clang++ with c++11 and libc++ (with c++11 support)
>  CC="clang" CXX="clang++" CFLAGS="-stdlib=libc++" CXXFLAGS="-stdlib=libc++" ./configure

... easy for now :-)

2. Now we would need the apache module

unzip it somewhere and go the the unzipped folder.
> sudo apxs -n mod_fastcgi -i -a -c mod_fastcgi.c fcgi_buf.c fcgi_config.c fcgi_pm.c fcgi_protocol.c fcgi_util.c

it will compile and install the mod_fastcgi for apache.

3. To Configure apache, let's edit the config file:
> sudo nano /private/etc/apache2/httpd.conf

add the line:
LoadModule fastcgi_module libexec/apache2/

and at the end of the file:

<IfModule mod_fastcgi.c>
FastCgiIpcDir /tmp/fcgi_ipc/
AddHandler fastcgi-script .fcgi
now CTRL+O to save the file
CTRL+X to quit

4. let's create the folder /tmp/fcgi_ipc
> sudo mkdir /tmp/fcgi_ipc
> sudo chmod 777 /tmp/fcgi_ipc
5. it should be ready now, let's test it.
so just take an example from the lib in the folder "examples"

just take "echo.c", put it on a folder then
> gcc echo.c -lfcgi -o echo.fcgi
> sudo cp echo.fcgi /Library/WebServer/CGI-Executables/
now you can access it with your browser with the url:

Hope it will be useful for you, happy coding!

lundi 30 juillet 2012

OpenCV and CLang / C++ 2011 on mac os x

OpenCV cannot be used in a project using C++11.
I am on mac os x and the new default compiler is CLang.

The issue is that the stdlib for c++11 is "libc++ with c++11 support" but this is not the default one.

solution: compiling OpenCV with CLang and libc++

so how to do it?

cmake ../  -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ -DCMAKE_CXX_FLAGS="-stdlib=libc++"

but there is one (small) issue:
OpenCV-2.4.2/modules/ts/include/opencv2/ts/ts_gtest.h uses std:tr1:tuple and it will generate an compiler error.

solution: edit this file and add on the first line:

then it will work ! you should be able to use C++2011 in your project using OpenCV on mac os x

BTW my opencv version is 2.4.2

dimanche 18 mars 2012

IE9 slow to startup


I recently installed Win7 64 bits...
and I also upgraded IE8 to IE9.

IE9 was very slow to startup, almost 7 seconds, displaying a blank page.
If you face this case, you just have to "reset" it and then it is fast again!

simple but not quite easy to think about it!

dimanche 29 janvier 2012

webkit Qt or cocoa?


I recently started the native development on mac os x, using objective-C and webkit.

I changed from using QtWebkit for the reason they have deprecated webkit1, moving to webkit2 with a totally different API, also only using QML. QML is still not mature for desktop application, and QtWidget is abandoned. QML is surely great but it is not really proven technology, which makes me reluctant to jump into it. I am then observing where they are going. I hope the best for Qt in general!

Back to Cocoa, I really enjoyed using objective-c and I was amazed how simple and how fast we can progress with webkit, making a bridge with javascript in few seconds. Just amazing!

I also initially thought that Apple missed a language like .NET but I was all wrong! they have objective-C and this is full speed native with C and C++, being also dynamic, what could we ask for more?
just amazing!

Best regards,