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
import java.util.ArrayList; | |
import java.util.List; | |
import java.util.Scanner; | |
import java.util.StringTokenizer; | |
public class JollyJumper { | |
public static String JOLLY = "Jolly"; | |
public static String NOT_JOLLY = "Not jolly"; | |
public static void main(String[] args) { |
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
//~--- non-JDK imports -------------------------------------------------------- | |
import org.apache.http.Header; | |
import org.apache.http.HttpEntity; | |
import org.apache.http.HttpHost; | |
import org.apache.http.HttpResponse; | |
import org.apache.http.HttpStatus; | |
import org.apache.http.HttpVersion; | |
import org.apache.http.client.HttpClient; | |
import org.apache.http.client.methods.HttpGet; |
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
import java.sql.Connection; | |
import java.sql.DriverManager; | |
import java.sql.ResultSet; | |
import java.sql.SQLException; | |
import java.sql.Statement; | |
import java.util.TreeMap; | |
import java.util.Iterator; | |
public class InterviewQ1 { | |
private TreeMap courseMarksMap = new TreeMap(); |
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
/** | |
Desired Output | |
--------------- | |
Country - India | |
State - Gujarat | |
City - Ahmedabad | |
City - Vadodara | |
State - MP | |
City - Bhopal |
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 InfiniteSeries { | |
public static void main(String[] args) { | |
int i = 100; | |
while (true) { | |
if (i > 0) { | |
System.out.println((100 - i) + " " + i); | |
i--; | |
} else if (i == -100) { | |
System.out.println((100 + i) + " " + 0); | |
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
import java.util.regex.Matcher; | |
import java.util.regex.Pattern; | |
public class EmailValidator { | |
public boolean isValidEmailAddress(String emailAddress) { | |
String expression = "^[_A-Za-z0-9-]+(\\.[_A-Za-z0-9-]+)*@[A-Za-z0-9]+(\\.[A-Za-z0-9]+)*(\\.[A-Za-z]{2,})$"; | |
CharSequence inputStr = emailAddress; | |
Pattern pattern = Pattern.compile(expression, Pattern.CASE_INSENSITIVE); | |
Matcher matcher = pattern.matcher(inputStr); |
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
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"> | |
<xsl:template match="*"> | |
<xsl:element name="{local-name()}"> | |
<xsl:apply-templates select="@* | node()" /> | |
</xsl:element> | |
</xsl:template> | |
<xsl:template match="@*"> | |
<xsl:attribute name="{local-name()}"> | |
<xsl:value-of select="." /> | |
</xsl:attribute> |
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
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:vbs="http://www.w3.org/1999/XSL/Transform" xmlns:msxml="urn:schemas-microsoft-com:xslt"> | |
<xsl:output omit-xml-declaration="yes" /> | |
<xsl:template match="node()|@*"> | |
<xsl:copy> | |
<xsl:apply-templates select="node()|@*" /> | |
</xsl:copy> | |
</xsl:template> | |
<!-- Just change the match="/*" to match="*" ; if you want to add namespace in all elements --> |
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
import com.foo.Bar; | |
// Import log4j classes. | |
import org.apache.log4j.Logger; | |
import org.apache.log4j.BasicConfigurator; | |
public class MyApp { | |
// Define a static logger variable so that it references the | |
// Logger instance named "MyApp". |
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
declare | |
-- Local variables here | |
queue_options DBMS_AQ.ENQUEUE_OPTIONS_T; | |
message_properties DBMS_AQ.MESSAGE_PROPERTIES_T; | |
message_id RAW(16); | |
agent SYS.AQ$_AGENT := SYS.AQ$_AGENT(' ', null, 0); | |
my_message SYS.AQ$_JMS_TEXT_MESSAGE; | |
begin | |
my_message := SYS.AQ$_JMS_TEXT_MESSAGE.construct; | |
my_message.set_text('<< sample message >>'); |
OlderNewer