Skip to main content

Posts

Showing posts from April, 2017

Understanding and implementing OAuth1.0A

OAuth stands for Open standard for Authorization . In layman terms, it means using this protocol one can interact with websites on behalf of other users. Consider an example of Twitter, where an user will have an account and now some other website wants to access user's twitter account and post on user's behalf. If we have to achieve this, without OAuth, the website that wants to access Twitter would need user's password, then that website will use that password to access user's Twitter account. There are two major problems with this approach : Security : When the website will pass the password in url, user credentials are vulnureable for theft. Giving away your details to another website. In this case, user will be sharing their twitter credentials to another website. This could also be a violation of terms and agreements of Twitter. OAuth protocol allows to deal with this situation, where the user will authorize the website to interact with Twitter on their

Embedding code snippets in your blog posts

If you are running a blog, you may want to publish a post having code snippet of a programming language. If you just copy paste the code, it looks very odd and gets mixed with the other text contents. Inserting a code snippet in formatted way makes your code readable. Most of the blogging platforms provide a way to insert code snippet for various programming languages which highlight the syntax of the particular language making your post clean. In this post, I'll cover various methods for inserting code snippets on Blogger and Wordpress blogs. SyntaxHighlighter  Syntax Highlighter is a open source code syntax highlighter written in Javascript by Alex Gorbatchev.   How to Integrate with Blogger ? To integrate the SyntaxHighlighter with Blogger, follow the below steps :- - Login into blogger and Click on Template  - Click on Edit HTML - Copy Paste the below code in the html just before the </head> tag. <link href='http://alexgorbatchev.

Python ElementTree Tutorial

XML is a markup language like HTML which is used to describe data. XML documents are basically used to share the structured data via internet. In this tutorial, we will covering the basics of Python's ElementTree library which can be used for creating/writing xml documents. There are two versions of ElementTree available in Python's Library - one version is a pure python implementation, while the other is implemented in C for performance. So, it is always advised  to use the C version of the ElementTree. In case C implementation is not available on the OS that you are working on, native python library can be used. So, our below import of the library will ensure to use the C version of the library if available, otherwise it'll fallback to Python's version. try: import xml.etree.cElementTree as ET except ImportError: import xml.etree.ElementTree as ET ElementTree Library has two main classes to represent a xml document in the memory :- ElementT