Configuring Environment for OpenCL on Ubuntu with Optimus

Leave a comment

Screenshot from 2012-12-02 20:06:05

First of All,

My machine is as follows:

Dell Inspiron notebook N5110 Core i5 with Nvidia GT 525M with optimus technology, This optimus technology is simply the device have two graphics cards, one Intel and the other is the Nvidia one.

This is used to save laptop’s battery by disabling the Nvidia card that is relying on GPUs when low graphics processing is needed and doing that on the intel one, and when high performance is needed the work is done on the Nvidia GPUs are redirected to the intel one after being done.



Adding new COM Interface version

Leave a comment

Just for my self and other people like me who forget interestingly fast, and do not wish to get E_NOINTERFACE from C++ QueryInterface method after they add new COM interface version for maintaining backward compatibility for the COM object.

4 places to add the new version info..

1-In the idl file used for the description of the interface, Add the new interface and make sure you put a new UUID for it, make sure it inherits the old interface

 helpstring("OldInterface Interface"),
 interface IOldInterface : IDispatch

//Some old functions


 uuid(9BFB8CD2-C090-4e37-A9AB-AE001B9EB4DC), //new UUID
 helpstring("INewInterface Interface"),
 interface INewInterface : IOldInterface
//Some new functions



Countable Objects [Problem NOT of the week]


Long time since the first problem..

This is a problem I’ve faced lately while developing in C# to have some statistics.

I’ve created a project that does something (of course !! :D)

and created a number of classes with some inheritance tree, where some classes inherit from others, anyway, after that i needed to count the number of instances created from each class…

pretty simple, just add a counter to the class, add increment/decrement methodology in the constructor/destructor.

but. kind of… I’m lazy to open each class, add those members and add them to the newly created, not new!

So.. let’s make use of Inheritances, Create a base class “Countable Object” where all what you need is a private static dictionary which will hold all the type as a key, count as a value, with a constructor that increments the value of the type created.


With Ubuntu [A Fresh Install]


No, the old install didn’t crash !!!

i just was very anxious about the new Ubuntu release (Karmic Koala), so i installed the RC version

and as u know i hate to install a fresh install of any OS until the currently running one crashes, hangs and cries to let it die 😀


Common OpenGL Exception

1 Comment

this is a kind of exception that happens normally when u r coding with opengl, whether using Tao framework for C# or native opengl
when u run the opengl program and u find it just crashes with no reason
then one of the main reason is the function “glutInit()
this function initializes the GLUT which should be initialized only ONCE per program run
and if this function fails to initialize -for many reasons- but with me mainly because it’s called more than a time, it crashes the program and just closes it
so just make sure u call this function only once..

Strings, JavaScript & IE

1 Comment

if u r familiar with Javascript can u tell what will be the output of these lines ?

var src="abcd";
var dest="";
for (var i=0;i<4;i++)

well, it’s obvious that this fragment will produce a message box holding the string “abcd” unless u r used to code Javascript for IE

in Firefox or Chrome it works like a charm


Troubleshooting in ACM-ICPC Contest


i’ve participated in many contests as organizer, specifically in the technical stuff which is mainly two portions

  • The IDE which is mainly “eclipse
  • The contest communication tool which can’t be except “pc2”

and in the last contest i’ve participated in it’s technical preparations i faced a number of troubles

lets take them one by one

1.Teams don’t connect to the Server which is a Linux Machine

  • Solution : before you open the server edit the “pc2server” file and edit this line
  • java $PC2CN $*
  • to be
  • java -Djava.rmi.server.hostname=”″ $PC2CN $*
  • of course change the ip according to your server ip

and make this edit in all the executables you will run {team, board, judge…..}


Older Entries