Thejesh GN

A Blog, A Website and A container for all my views with excerpts from technology, travel, films, india, photography, kannada, friends and other interests. I am Thejesh GN. Friends call me Thej

HappyTuesday Week 5 – Learning Lua

Posted by Thejesh GN On October - 15 - 2014ADD COMMENTS

Its been a while I learnt a new programming language. I have been very happy with Python. All most all the work that I do involves Python. But there has been an itch to learn something new. So I made up my mind to learn a new programming language this week. But again which one? There were quite a few eligible languages to choose from

  • Rust is a systems programming language that runs blazingly fast, prevents almost all crashes, and eliminates data races.
  • Go is an open source programming language that makes it easy to build simple, reliable, and efficient software.
  • Haskell is an advanced purely-functional programming language. An open-source product of more than twenty years of cutting-edge research, it allows rapid development of robust, concise, correct software.
  • Lua is a powerful, fast, lightweight, embeddable scripting language.

lua I choose Lua because it suited my present toolkit very well. I am a duct tape programmer. I follow simple logic of first make it work, then make it fast and at last make it beautiful. All my tools have to fit this logic. I think Lua was a much better fit than others.

Lua is probably the best ducttape programmer’s language. Its has simple and limited procedural syntax which is easy to learn. It has small foot print and runs on all platforms including some micro controllers. It can run independently and also inside other programming languages. Its actually this embedding feature that attracted me.

Also the fact that its extremely fast when LuaJIT is used. Lua by itself is simple and limited but there are enough libraries to launch your projects quickly. Bonus points for the fact that both Redis and Nmap the tools that I use often use Lua as their scripting language. So everything I wanted. The second best was Haskell. One day I will go back and learn a fully functional programming language like Haskell.

Learning resources:

Lua today is mostly used in gaming world as a script customize games or as an embedded language in other softwares like Redis or Nmap. Even though the community of Lua programmers is small, they are very passionate. I found enough help online to learn and become productive. Some of the resources that I used are

Learning by doing:

For a long time I wanted a programming scratchpad. The idea is you go a website, login, edit/create a page with code, save and get an url for that page so you can run. Somewhat like JSfiddle but much simpler and stronger. Most of my use-cases were that of web-hooks. For example, receive a push from web-hook, process it and post it to some other service. The only service that came close to satisfying my requirements was WebScript. I used their paid account for a while but was not completely happy with the services I was getting for the money.

While learning Lua, I figured I could do that myself. I would use Python as the host language and Lua as the embedded scripting language. Idea included using Django as the framework to give me hosting environment, use lupa to run Lua inside Python. Like always I searched if someone else has done it. It may not be exact but I found AirScript which almost does the same thing. Well its easy to improve than start from the scratch right? After some effort I got it running. Here is my helloworld scratch pad. I will write about it in detail in the next post.

Its been good two weeks after a good vacation and before next one :)

1 Star2 Stars3 Stars4 Stars5 Stars (No Ratings Yet)
Loading...Loading...

Archive any blog/website onto Web using archive-it

Posted by Thejesh GN On October - 2 - 2014Comments Off

They say Internet doesn’t forget anything. But link decay is very common on the web. The things that are visible today on web vanish tomorrow. Links become inaccessible and hence linkrot. But there are services like internet way back machine or archive.today which backup the web pages to find the content for rotten links later. So I thought I would create a service which would backup (not in the traditional sense of backing up for recovery) the whole blog onto one of these services so future users could read the content even though the blog itself is dead. Bonus feature is you can see how your pages changed over time.

The service very simple. It’s a python code which accepts a url which supports sitemap protocol. Then it goes through every link in the sitemap, submits it to the archival service of your choice. As of now it supports archive.org and archive.today. Gives you a report at the end. You can also go to the archival service provider and see if all the pages have been archived. For example you can check all the pages of thejeshgn.com archived on archive.today.

archive_today

It’s very simple to run

git clone https://github.com/thejeshgn/archive-it
$python archive.py -u http://thejeshgn.com/sitemap.xml -o output.txt -s archiveis

Go ahead backup your blog to web.

, , , Comments Off
1 Star2 Stars3 Stars4 Stars5 Stars (No Ratings Yet)
Loading...Loading...

Religious Freedom In India – No Religion is Valid

Posted by Thejesh GN On September - 30 - 2014Comments Off

For last few weeks I have been debating about the religious freedom in India. Even-though its one of fundamental rights. I had my own questions about it. One also doesn’t know about the rights until it gets challenged in the court of law. This week a set of people asked themselves to be free of religious association. They wanted to be part of “No Religion”. A government gazette refused carry out this notification saying “No Religion” is invalid and hence they sought Bombay High court’s help.

The whole case was based upon “Right to Freedom of Religion“. I didn’t know the word ‘conscience’ would play a major role in the judgement. Court favored citizen and said “No Religion” is valid and went onto say none can compel you choose/quote a religion. I think its one of the best judgements that I have read in recent times. I have quote a paragraph below. It gives you the gist.

India is a secular democratic republic. The State has no religion. There is a complete freedom for every individual to decide whether he wants to adopt or profess any religion or not. He may not believe in any religion. If he is professing a particular religion, he can give up the religion and claim that he does not belong to any religion. There is no law which compels a citizen or any individual to have a religion. The freedom of conscience conferred by the Constitution includes a right not to profess, practice or propagate any religion.

The right of freedom of conscience conferred on a citizen includes a right to openly say that he does not believe in any religion and, therefore, he does not want to practice, profess or propagate any religion. If the parents of a citizen practice any particular religion, he has a freedom of conscience to say that he will not practice any religion. There is a freedom to act as per his conscience in such matters.

Bombay High Court

So next time when you are filling up a form you can either enter a religion or leave it blank or enter “No Religion”. Its left to you and none can force you to choose.

Comments Off
1 Star2 Stars3 Stars4 Stars5 Stars (No Ratings Yet)
Loading...Loading...

Notes from first Data BootCamp India

Posted by Thejesh GN On September - 11 - 20142 COMMENTS

First ever DataBootCamp in India was organized by ICFJ in collabaration with Data{Meet}, HT, Hacks/Hackers – New Delhi, 9.9 School of Journalism in Delhi. It was a three-day event hosted by Bridge School of Management. It was an interesting gathering as more than 50% were from journalistic background. I have never seen such a big group of journalists in one place for three days, working in groups with people of different backgrounds.

Major part of the camp was to propose projects/stories and work on them. Group selected ten projects out of all the proposed projects. I have listed the projects below, hyperlinking to end results. If you like to see all the proposed projects then go to HackDash.

dbootcamp

  1. Narendra Modi On Twitter Vs Other Global Leaders – Word Play vs Ground Reality
  2. Crime Agaisnt Women In India
  3. Class Calculator – Think you’re in the middle class? Use the class calculator. Scroll down to find out. You may be surprised. Or Not.
  4. Cashless In India – Is India becoming a #cashlesseconomy?
  5. Terror Statistics
  6. Money poured into Ganga vs pollution levels
  7. India’s Supreme Court Ruling on Under-Trial Prisoners
  8. Media Ownership
  9. Advertising For Online Video To Rise By 30%
  10. Build Hospitals To Kill Cancer

Ofcourse we had hands-on workshops on scraping, data cleaning, data visualization and mapping. I will probably need a series of posts to cover them all here. I have put the relevant links at the bottom for you to explore. Best part was some of the participants used the tools they learnt during the camp for their project work.

This slideshow requires JavaScript.

Other Interesting facts/links/tools that i came across during the event:

Overall I was surprised at the quality of the projects. At least half of them were executed very well. Two days are actually very small amount of time, so hats off to all the participants. As a participant and duct-tape programmer/trainer I had lots of fun. I hope there will be more collaborations between tech and journalism community in future.

1 Star2 Stars3 Stars4 Stars5 Stars (No Ratings Yet)
Loading...Loading...

Bureau of Indian Standards and Open Access

Posted by Thejesh GN On August - 6 - 20142 COMMENTS

Lets say you want to buy a bicycle tube. How do you know which one is the best? how do you know which cycle tube is made as per specification prescribed by Govt for safety? You go by ISI mark right? How do you know what that standard means? How do you know what you get when some says it’s an ISI marked tube? The obvious answer for most of us is to validate it against the checklist provided by ISI. But where do I get that checklist? Well you need to buy it. Soft copy costs Rs.180 for Indians and more for foreigners.

is2415

Now I wouldn’t be very surprised if this standard’s body was a private company whose main goal was profit-making. Nothing wrong with it. But this standard’s body is BSI. Bureau of Indian Standards which mostly known for ISI marking the products in India, is the national standards body which comes under GoI. Its established by Bureau of Indian Standards Act, 1986. Its public funded organization. Its main purpose is [CHAPTER IV, 10. (1) a. ]

(a) establish, publish and promote in such manner as may be prescribed the Indian Standard in relation to any article to process;

Now that sounds very illogical right? Why would you pay for something which is funded with public money. More than that why would someone put the checklists meant for public safety behind pay-wall? I could understand if they charged for hard-copy of the documents. But there is no excuse for charging for a soft copy of document. In fact it should be available freely, in readable, accessible format. Its time they do it.

But for some reason BSI wouldn’t do it. In the mean-time public.resource.org bought all those documents and made them public. All 19,200 standards documents are available in both pdf and text formats on their website for free. Public.resource.org not only makes the documents available, but also makes them accessible. They have converted about 192 documents into clean HTML and SVG, the open formats required to improve those documents. One such example is Indian Standard CYCLES—RUBBER TUBES—SPECIFICATION IS 2415 : 2004. The effort which is not just commendable but needs supports from all of us including BIS.

At least that’s what they expected when they wrote a letter letting them know about the work and thanking them. But they got this letter as response.
notice
It’s just sad and completely wrong. I am really happy that Carl Malamud replied to this notice explaining the purpose and reasons behind making the standards document open. It’s a must read for everyone interested in Open Access.

As someone who supports open access and open data, I am very thankful to public.resource.org for making these documents openly available to all. I hope BIS becomes collaborator in this effort than antagonist. If not we have to fight this battle for open access, public safety and innovation.

Disclosure: I was one of the kick-starter backer of resources.org’s campaign called Public Safety Codes of the World: Stand Up For Safety! which wasn’t successful :(

1 Star2 Stars3 Stars4 Stars5 Stars (3 votes, average: 5.00 out of 5)
Loading...Loading...

Get in touch