Skip to main content

Posts

Showing posts from March, 2007

SWIG.... Never throw your old code away.

Alsalam alikom wa ra7mat Allah wa barakatoh Today, I found a program that cought my attention, I didn't try it yet but I read a tutorial and now downloading the package... What is it anyway? SWIG stands for Software Interface Generator, it's a program that takes your unmanaged code (C/C++ for example) and automatically builds a wrapper library for it in a lot of other languages (C#, Perl, PHP, ...etc). Just that simple... Example : // Example: file.h class SimpleSample { public: void DoSomething(); } This header file can be converted to SimpleSample.cs which uses pInvoke to call the underlying C++ Code... SWIG is a fully function C++ Compiler. It can also build up a proxy class for a collection of your C++ Functions/Classes. It's just nice and powerful (I hope it functions like how it sounds) Moreover, it's Open Source, works with a GNU CSharp Compiler (in case you want to output a .NET Library) it can also work with many other CSharp Compilers (if you wish to

Refresh your day...

Alsalam alikom wa ra7mat Allah wa barakatoh What to do when you feel pressure? pain? stress? Stress, pressure, projects, delivery dates... etc. Make you stop doing a lot of things you used to do in the past. When was your last time to practice in the morning? if you sat down and wrote a list of things you used to do in the past and you no longer do because of such things, you will find out what I'm trying to say.... these things changed you!!! never give them the chance! I'm not speaking about big things, but believe it or not, those little things do miracles. Try to do those small things again.. they were not costing you time/money etc... why you stopped them? When was your last time to start your day with reading a little in your Holy Book? For Computer-Addict guys, when was your last time to have breakfast away from your PC table (most likely checking your email with one hand, and holding a sandwich with the other)? A few days ago, I noticed that I stopped putting the black-

Reversable Drawing... Redraw to remove your drawings...

Alsalam alikom wa ra7mat Allah wa barakatoh Today I've found a very nice function (actually a class) in .NET, the class is called ControlPaint, the function is called DrawReversibleFrame... It's not a big deal but I enjoyed the idea of how this function operates. DrawReversibleFrame ( Rectangle rectangle, Color backColor, FrameStyle style); Your first call to the function will just draw a rectangle with the color you specified.... the nice trick is that if you called this function again (with the same rectangle dimensions), it'll erase what you've just drawn (without any need to Refresh)... As I liked it, I wanted to use it in anything, so I thought about the snapping thing... What is it? When you have a graphics area and the user drew some random points... if he moves the mouse near any point, a small rectangle would appear, suggesting a place (aliened with the nearest point)... like in the following figure: Mouse near the black point.. the green rectangle is drawn us