Friday, June 22, 2007

It is easy to use templates, but it is hard to make them

Yes this is the template nightmare when you use it and link it to your code. Just take a look at some template libraries that we use in our everyday programming, like STL, ATL, WTL, some libraries from Boost, and you will see what I mean by this. Those libraries are great example of the principle "simple interface - complex implementation".

After hours and days finding the errors without result, I found the interesting topic here http://support.microsoft.com/kb/168958 and here http://www.unknownroad.com/rtfm/VisualStudio/warningC4251.html.

This what was happened to me. I've created a DLL from a class of mine where i use std::vector<> members to store something. My problem is that when i call a library function that insert an element on the vector, the first operation after that one on the vector (clear it, read the first element,etc) cause an error on the heap:

Expression: _CrtIsValidHeapPointer(pUserData)
HEAP[Print.exe]: Invalid Address specified to RtlValidateHeap( 28d0000, 28e3bd0 )

Gosh, it took me days to find what the cause. Trying this trying that, use this best practice that best practice closure but none worked. Very wasting time.

Thursday, June 21, 2007

What a terrible week or not?

First because of my bluetooth are not working in my laptop, I almost lost my important data. Yes, you can imagine how if you are in my position. It really suck, you lost the data that you have been working on for almost years.
But thanks to the application from runtime.org I can get my data back . I have to thanks to them but hehe... I used their product without licence, I cracked it. What a shame of me :D.
I think their product is such a good and very useful product. This made me to an idea, how if I make a tool like them. How if i sell it just a half of their price. Hmmm, it's a good idea. I can earn more money from it, hehe....
The idea behind is very simple. What you have to do is searching the lost file system. In my thought you just searches the lost file system by their signature. For FAT and NTFS, almost of their entities have a signature. Just find the entities and construct the file system and sim salabim you'll get your lost file system. :D

Friday, June 15, 2007

CSPX will be born soon.

I am just wondering why there is no such application that use the power of C to build a web application. I know that perl, php and another interpreter are made by C, but they are just an intepreter. They are not exposing how powerful C is.

The idea is taken from ASP.Net from microsoft.It's a nice idea where you seperate the User Interface and the code. I just wonder why we don't have it and apply it to C.

From the big view it's very easy to implement, what you have to do is to map the UI and the code. So every controls or tags in document, I'll call it cspx document (with cspx extention), are mapped to one control variable in the code. Any changes that have been applied in the code (control variables) should be mapped again to the document.

I'll give you the big picture from my example below :
Let say your document is here

< cspx:textbox id="textbox1">

and the code is here
textbox1.value = "test"

So the doument that you have to send to browser is just like this.

< input id="textbox1" value="test">


Simple? Yes it's simple.

Now I have made the framework but it has limited features right now. CSPX has few features e.q cookies, session, query string, POST methods, retrieving file and multipart/form-data. I know it cannot be released know but soon it will. Now I am focusing on the parser itself. I need a powerful xml parser. I think apache xml api is powerful, so I decided to use it. Let see then.