Sunday, November 23, 2014

Sanskrit Test Lesson

Original text (with corrections) हास्यकणिका अध्यापिका व्याकरणं पाठयति। कर्ता कः, कर्म किम्, क्रिया का इति बोधयति। तत्परं सा कृष्णफलके इदं वाक्यं लिखति - ‘मण्टुः लड्डुकं खादितुं न इच्छति।’ अध्यापिका - सुरेश, त्वं वद। अस्मिन् वाक्ये मण्टुः कः। सुरेशः - मण्टुः मूर्खः। अध्यापिका - कथम्। सुरेशः - आर्ये, कः लड्डुकं खादितुं न इच्छेत्।
Version without sandhis
हास्य-कणिका अध्यापिका व्याकरणम् पाठयति । कर्ता कः, कर्म किम्, क्रिया का इति बोधयति। तत्परम् सा कृष्ण-फलके इदम् वाक्यम् लिखति - ‘मण्टुः लड्डुकम् खादितुम् न इच्छति।’ अध्यापिका - सुरेश, त्वम् वद। अस्मिन् वाक्ये मण्टुः कः । सुरेशः - मण्टुः मूर्खः। अध्यापिका - कथम्। सुरेशः - आर्ये, कः लड्डुकम् खादितुम् न इच्छेत्।
Inter linear, literal translation हास्य-कणिका laughter-particle अध्यापिका teacher व्याकरणम् grammar पाठयति teaches। कर्ता subject कः who, कर्म object किम् what, क्रिया verb का who इति so बोधयति explains। तत्परम् thereafter सा she कृष्ण-फलके on blackboard इदम् this वाक्यम् sentence लिखति writes - ‘मण्टुः Mantu लड्डुकम् sweetmeat खादितुम् to eat न no इच्छति desires।’ अध्यापिका teacher - सुरेश Suresh, त्वम् you वद speak। अस्मिन् in this वाक्ये in sentence मण्टुः Mantu कः who। सुरेशः Suresh - मण्टुः Mantu मूर्खः fool। अध्यापिका teacher - कथम् how। सुरेशः Suresh - आर्ये madam, कः who लड्डुकम् sweetmeat खादितुम् to eat न no इच्छेत् desires।
Natural translation Joke Teacher is teaching grammar. She explains what is subject, what is object, what is verb. Then she writes this sentence on the blackboard: Mantu does not want to eat sweetmeat. Teacher: Suresh, you answer. What is Mantu in this sentence? Suresh: Mantu is a fool. Teacher: How? Suresh: Who does not want to eat sweetmeat?

Friday, November 14, 2014

First Camel Integration home project

Sanskrit Newspaper - Sanskrit Dictionary integration using Camel
1) spin up a tomcat container running camel (AWS - EC2)
2) pull from articles in
3) event driven pull from dictionary
4) results merged with editorial content on

Normally I would have gone with a YQL (yahoo query language) solution implemented in javascript, which could be embedded into Pradyumn's blog, but I saw this as a change to architect a simple enrichment pattern in camel, and make this available to him as a webservice.

The camel ETL component also looks promising, so I worked through the example in the Camel download. Be careful that your later version may no longer set the entity manager in the header of the camel exchange -- I simply grabbed the entity manager factory from the exchange via the registry and it worked fine.

Playing around with this example (which uses JPA to consume records as files and insert/update them into a database) naturally led me to consume instead from a webpage (sudharma) -- merely substituting the file component with the http one. WSnotification might be what is under the hood for the camel http endpoint. I ended up making the following changes to get it to work:
Of course, my goal was not merely to load a database, but make the data available via a webservice for the javascript client to have access to. I could have just fronted the database with a Spring Data REST client, but wanted to remain in camel land a while longer. So I am investigating routing to another http component instead.

Final comfy solution resulted in creating a new component: webpage.