EVENT HANDLING IN EQUATION EDITOR

2 04 2009

It refers to the process of handling user actions when he goes through the process of creating equations . It also involves guiding the user through the process of creating mathematical expressions. To generate MathML when the user is done with equation creation, the list of user actions needs to be tracked for dynamic MathML generation.

Equation elements

Operators , operands, superscripts, subscripts, special math symbols(Square root,integral,limits),underover,matrix,fence(brackets.)

Pre-requisites

· Current Container

Refers to the current display object which has focus.(i.e. The user has clicked on a particular display object to which the equation is going to be added).The current container acts as a pre parent to the math equation that the user might type. Before equation creation the current container holds the super parent container which is the parent to all math expressions.

· Counter Id

As and when the user adds math elements into the drawing board, an ID is assigned to the particular math element .Global data keeps a counter of the entire Id’s assigned at any point in the equation creation.

· Math Table

An array of user defined objects called math node.

· Math Node

An object which uniquely defines a math object in the equation.

Attributes of Math Node

Nodeid : The globally assigned identifier

ParentId : The identifier of the parent math node which holds this node.

Node Name : The name which specifies what type of math node it is. The

name corresponds to the MathML tag which describes .

For e.g.: mo for operators ,

mi for operands,

mn for constants,

msup for superscripts

Node Text : The text of the node. Applicable only for mn, mo,mi.

Attributes : Properties of math elements like fontsize, style, thickness etc.

EVENT HANDLING FOR SUPERSCRIPTS AND SUBSCRIPTS

Description :

Superscript in MathML takes two mathnodes as their children. The base and the exponent. The global data assigns identifier to the superscript node which is an imaginary node, which exists just to hold the two children but has no physical rendering.

MathNode :

<msup><Id><ParentID of Current Container><null>

Implementation in Flex:

A mathematical component is drawn on the Canvas Container

that Flex offers.here are two alternatives to this.

1) Draw using a UIComponent and its graphics method.

<shape>.<uicomponent>.<graphics>.drawline(//)

How ever this method is tedious when it involves the calculation of appropriate coordinates(For Eg.In superscript,The x cood is increment by the width of the base ..and the Y coor is incremented by the height of base.and then decremented again to lie on the axis of the equation line.

Usage of lex components like HBox and VBox takes care of all these.(Esp Layout).






Tech Episode 3: Flex makes MathML possible

29 11 2008

Mathamatics mark up language is an XML standard that describes mathematics and has been proposed by th e W3C with an aim to put mathematics on the web.

Well The above should give an idea of my main project @ Heymath.

It was as simple as this…Develop an intuitive and predictive math equation editor basede on mathml in flex.

Three months into the development phase an wht we see is a prototype of an editor (first of its kind.)FLEX & MathML.

The first month started with developing a mathml parser….Like…basically an XML parser which takes the mathml code and parses for math elements and renders them graphically.

Then came the equation renderer ,,A WYSIWYG editor which gives the user a math palette of over 300 math symbols and generates amth ml at de end….

The renderer was coupled with an editor….

Well am sure…Not many(y many??Only sum or very few read this blog) of u… would have got an idea about the editor….

So I better write detailed episodes of each./…in the coming posts





Tech Episode 2: Priority Queues

26 09 2008

Hi,

Recently we had a discussion @ Heymath on Priority Queues…

Like,,,

What is a Priority queue?

How does a Priority Queue differ froma normal queue?

Utility of Priority Queues in Real life?

Implementation of Priority Queues?

Then we also talked about the representation of binary trees as arrays,,,,

The discussion went fine.

There was also a Problem solving session where there were some three problems centred on Priority Queues and binary trees,

Two outta them were short and simple…Am posting them for interested ppl who have a knack for such probs…

# 1 Given the indices of two nodes ‘p’ and ‘q’ in a binary tree, devise an algorithm which returns the Index of their nearest common ancestor.

# 2 You are given n events where each takes one unit of time. Event i will provide a profit of Gi dollars (Gi > 0) if started at or before time Ti where Ti is an arbitrary real number.

(Note: If an event is not started by Ti then there is no benefit in scheduling it at all. All events can start as early as time 0.)

Give an algorithm to find a schedule that maximizes the profit.
I hope to post the solutions(If at all I find one) in the next post…





Tech Episode 1

17 09 2008

Tree Listing of Hierarchical Data….

Gettin any Clue?,…

This was a mini project given to us which approximately took around 2 weeks to the final App.

The Project Scenario :

Give a visual representation of hierarchical data..(All those which carry Parent-child relationships….) in the form of  a Tree.,..

A Typical example of hierarchical data would be the windows explorer Toolbar in Windows(:)

Blink???? (Click MyComputer->View->ExplorerBar->Folders)..

Now we just had to imitate the same thing except that your tree shud carry drag drop

options,add,delete,rename nodes…And All these changes have to be reflected in the database….

Ah Ha…Here comes the database….An Along comes trouble….

Googleeeee………

How to store Hierarchical data in the Database..?

Joe celko’s book top lists the searches…(Take my word …Do not cross check..)…An there are lotta

results which give you a wide plethora of info on this…..Simple Search.,…I ‘d say..

Two main DB structure for storing hierarchical data….

1) Adjacency List Model

2) Nested Set Model….

There comes another problem….More than one…?What to choose??

I can write one whole week’s episode just on discussing the pros an cons of the two Models….Least of all

two episodes to explain Wht they are????But Too many episodes spoil the read….Rite???

Short Gist:

Adjacency model:(One variation of it…)

There are five columns nodename,nodeid,parentid,Depth,Lineage.

  • Depth gives the level of the node in the tree.
  • Lineage is a field of nodeid’s demarcated by ‘/’ which actually indicates the path need to be travelled to reach tht node.

Nested Set model:

  • nodeid: Uniquely defines the node.
  • right Pointer:
  • Left pointer.

The right and left denote the position of tht node when you traverse the tree by the

preorder tree traversal algorithm.

I might give a teaser here…..

One of the model….Is sooo convenient..,,,The other very tedious in terms of DB operations….

Three of us Chose the convenient one an started workin on them..(We don wanna spend futile nights on the

the tedious one…Coz it looks simple but takes lotta things to be taken care….like…recursive queries nned

be fired off to just to get a node’s children….

But Five of us ended up doing the Convenient one….

Which One???

The oNE>>???

Ciaoooooooooo…..Later…With The One………





My First Attempt

15 06 2008

First Attempt at WrITING a Tech Blog…Hoping to do jus the wRITE thin…I have in my mind to post all those tech stuff whick had me amazed,transfixed…and dumbed tooo while at work here at HeyMath…

An Here It startss………..My Blog ….TechhhhhSAVVYYYYYYY