Continuing the work of last week on user objects tracking, this week I started the implementation. The task for this week was to :

  • Extract the object IDs from the user Code.
  • Check if all  IDs are unique or not.
  • Form a list of IDs and object class name.
  • Notify the user if any ID is repeated.

As I mentioned last week , it was quite hard to come up with something unique that distinguishes each user’s declared object, so I have decided to make the user provide the ID himself . Meaning that when he declares new object of certain classes he should pass a unique ID in the class template as an argument.

To extract the object ID from the class template this was pretty straight forward. I used the information found in the object file under the relocation section using readelf command.  “readelf -rW <file-name>.o |c++filt”. This command will list all the user’s object constructor functions . From this output then it will be easy to extract the ID using the regular expression.

Then after extracting every ID a checking is made in order to assure if it’s unique or not. A list that contains all the classes names and IDs will be sent upon success to the schematic editor (jointJS ) so for it to be updated with the specific component that corresponds to each object.

Kindly refer to Islam’s blog entry for this week for more information about this.

Then,the user will be updated if any object ID is repeated as follows :

Editor

Beside working on that , so far our code was created for one session , meaning that it can’t handle more than one user at a time. So to solve this problem, when the user starts a new session a temporary directory will be created. This directory will store all the files the user will need at the session.The name of the directory will be created randomly and passed in a cookie. So on my back engine all I needed to do was to use Witty getCookie()  function to obtain the name of the directory that corresponds to that session. All the temporary directories are created inside the approot.

So after finishing the above tasks.  I had to do some changes in the code based on Dr.Shawn recommendation .Some changes were also made  to upgrade the functionality of the editor (CodeMirror ) and to enhance the the user coding experience. For example ,previously the code editor used to send the code to server when the editor is unfocused (blurred) but now by adding JavaScript function setTimeout() the user will be updated with errors at every portion of time (3 seconds) without the need of the user to un-focus the editor which is definitely more user-friendly.

That’s all for this week. Thanks for reading.


0 Comments

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.