In this week I continued reading and studying witty. So after covering the Graphical User Interface (GUI) part of witty last week I started directly exploring its non-GUI part.When we deal with non-GUI part we need to be familiarized with some terms such as “resource”. A resource is any document or file other than the main page (the html page) that can be rendered to the users. Witty provides a class named “WRESOURCE” which can be used to create resources in the server.

The lack of witty examples and illustration in the INTERNET was really annoying specially in this stage. Wt main website  provides only one example of how to use the WRESOURCE, and since I found the example insufficient I started to play here and there and try to do some modification on it for better understanding.
What I noticed in the example was that it used the “handleRequest” function which received both the http Response and Request object to write the file using the “Response.out()” function. So I started thinking what if we want to use a local file that was already written .. so after doing some research I found out that there was a child class of “WRESOURCE” called “WFILERESOURCE” which is used for this purpose.

Honestly, Exploring the non-GUI part of witty was not easy as I thought . :\

So after two days of non-GUI exploration I moved to read about the http protocol and how witty uses this protocol. (As I’ll need these information later on ) . Actually the picture is still not so clear .. I’m not sure yet how I should use this knowledge when it comes to the project. Hmmm …

Any way, after 4 days I just felt that was enough and although Dr.Shawn asked us to be patient and not to rush to the project directly .. I couldn’t hold my self back specially when Islam turned to work in his part .., So I began exploring the part I should carry out ..

The project needs a code editor and Dr.Shawn decided to use Codemirror. So my first task was to integrate the codemirror with witty.

The integration of the codemirror with Witty was pretty simple and easy . I won’t go in details since Dr.Shawn has already explained it .
You can refer to his blog entry (Witty with Ace and Codemirror) for more details.
I played with the code and I manged to send the content of the editor  to the server whenever the user enters something , and make that content written again in the user’s screen as well .
I was really happy although I knew that was just the beginning , but seeing some progress after 2 weeks of reading was really worth it.

Cheers!  😀 😀