Monthly Archives: May 2017

Using LookingAt and Matcher Java

import java.util.regex.Matcher; import java.util.regex.Pattern; import org.testng.annotations.Test; public class RegExTest { @Test public void testRegEx() { String REGEX=”foo”; String input=”foo”; Pattern pattern; pattern=Pattern.compile(REGEX); Matcher matcher=pattern.matcher(input); System.out.println(“Looking at”+ ” ” + matcher.lookingAt()); System.out.println(“Matches”+ ” ” +matcher.matches()); } }

Posted in Java, Uncategorized | Leave a comment

Singleton Design Pattern

/** * Singleton Design Pattern Demo * @author asharda * */ class Singleton { private static Singleton instance = new Singleton(); public static Singleton getInstance() { return instance; } public String getMessage() { return “Singleton Demo”; } } public class … Continue reading

Posted in Uncategorized | Leave a comment

Sort in Descending Order using Comparator and Comparable

import java.util.ArrayList; import java.util.Collections; import java.util.Comparator; import java.util.List; /** * Sort in Descending Order using Comparator and Comparable * * @author asharda * */ class Student implements Comparator<Student>, Comparable<Student> { int marks; String name; public Student() { } public Student(String … Continue reading

Posted in Java, Uncategorized | Leave a comment

Using ng-bind for Multiplication

<!DOCTYPE html> <html> https://ajax.googleapis.com/ajax/libs/angularjs/1.6.4/angular.min.js <head> <meta charset=”ISO-8859-1″> <title>Multiplication Using Angular JS</title> </head> <body> Multiplication Using Angular JS </body> </html>

Posted in Angular, Uncategorized | Leave a comment

Sort Arrays and Collections Java

import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; import org.testng.annotations.Test; /** * @author asharda * */ public class TestArray { /** * Sort Array */ @Test public void testArray() { String[] colors={“red”,”green”,”black”,”yellow”}; Arrays.sort(colors); for(String color:colors) System.out.println(color); } /** * Sort Collections. */ … Continue reading

Posted in Java, Uncategorized | Leave a comment

Getting Started with Angular JS

Print 5*10 <!DOCTYPE html> <html> https://ajax.googleapis.com/ajax/libs/angularjs/1.4.8/angular.min.js <body> My first expression is {{5*10}} </body> </html>

Posted in Angular, Uncategorized | Leave a comment

Arrays in Python

”’ Created on May 28, 2017 @author: asharda ”’ langs=[“C”,”C++”,”Java”] for x in langs: if(x==”C”): print(“In If Loop”) break else: print(“In else Loop”)

Posted in Uncategorized | Leave a comment