This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class Shape { | |
private int length; | |
private int width; | |
private Shape(int length, int width) { | |
// this constructs rectangle | |
this.length = length; | |
this.width = width; | |
} | |
private Shape(int length) { | |
// Constructs the square |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class SuperClass { | |
int i = 1; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class SuperClass { | |
public void display() { | |
System.out.println("Super"); | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class SuperClass { | |
public SuperClass() { | |
System.out.println("SuperClass Constr with no params"); | |
} | |
public SuperClass(int a, int b) { | |
System.out.println("SuperClass Constr with two params"); | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
fix_branch_output () { | |
# Strips first columns from the output, to remove whitespace and "current | |
# branch" marker from git-branch's output | |
cut -c 3- | |
} | |
local_branches () { | |
git branch | fix_branch_output |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This is file taken from following repo to find it easily: | |
https://github.com/mongodb/mongo/blob/master/debian/mongodb.conf | |
More details on each properties find here: | |
http://www.mongodb.org/display/DOCS/File+Based+Configuration?pageVersion=13 | |
# mongodb.conf | |
# Where to store the data. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package test; | |
import java.util.ArrayList; | |
import java.util.Collections; | |
import java.util.List; | |
public class HarshadNumber { | |
public static void main(String[] args) { | |
for (int i = 0; i < 250; i++) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
prompt = function() { | |
// set version | |
version = db.version(); | |
dbName = db.getName() | |
// case mongos | |
if (rs.status().info == 'mongos') { | |
return rs.status().info + ':[' + version + '] > '; | |
} | |
// config or replica |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
toJson --- | |
Original Java object : ModelObject [name=myname, val=12, status=true, f=2.3] | |
Converted JSON string is : {"name":"myname","val":12,"status":true,"f":2.3} | |
fromJson---- | |
Original JSON string is : {"name":"myname","val":12,"status":true,"f":2.3} | |
Converted Java object : ModelObject [name=myname, val=12, status=true, f=2.3] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
final Gson gson = new Gson(); | |
// original object instantiation | |
ModelObject modelObject = new ModelObject("myname", 12, true, 2.3); | |
System.out.println("toJson ---"); | |
System.out.println("Original Java object : " + modelObject); | |
// converting an object to json object | |
String json = gson.toJson(modelObject); | |
System.out.println("Converted JSON string is : " + json); | |
System.out.println("fromJson----"); |