Monthly Archives: July 2016

Using For Each Loop Arrays in Java

/** * @author ashishsharda * */ public class Arrays { public static void main(String[] args) { int [] numbers={10,20,30,40,50}; for (int x:numbers) System.out.println(“Numbers seen are”+x); } }

Posted in Java, Uncategorized | Tagged | Leave a comment

Dir function in python

import math content=dir(math) print “Content seen is”,content

Posted in Uncategorized | Leave a comment

JSONParser in Python

”’ Created on Jul 17, 2016 @author: ashishsharda ”’ input_string = ‘{“first_name”: “Ashish“, “last_name”:”Sharda“}’ import json parsed_json = json.loads(input_string) print(parsed_json[‘first_name’]) print(parsed_json[‘last_name’])

Posted in Python, Uncategorized | Tagged | Leave a comment

Difference Between SAX and DOM Parser

SAX: Use it for large files when you don’t want to store the entireUse file in memory. Useful when you have memory limitations,parses the file as it reads from disk. DOM: Entire file is read into memory and stored in … Continue reading

Posted in Uncategorized | Leave a comment

Regular Expressions-Python

”’ Created on Jul 17, 2016 @author: ashishsharda ”’ import re line = “Lions are stronger than Tigers”; matchObj = re.match( r'(.*) are (.*?) .*’, line, re.M|re.I) if matchObj:    print “match –> matchObj.group() : “, matchObj.group() else:    print … Continue reading

Posted in Uncategorized | Leave a comment