Skip to content

Instantly share code, notes, and snippets.

//
package rectangle;
import javax.swing.JFrame;
import javax.swing.JPanel;
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.GridLayout;
import java.awt.FlowLayout;
<?php
$conn = mysql_connect('localhost:3036', 'root', 'password');//use your password that you set up for database
mysql_select_db('hr'); /*use the database in mysql*/
$sql = 'SELECT * FROM employee'; //write your query.
$retval = mysql_query( $sql, $conn );
package stringChallenge;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
//This programming challenge will take a word and decompose it such way that there are no two char side by side
//Rearrange characters in a string so that no character repeats twice.
//
//Input: aaabc
package dataStructure;
public class MergeTwoSortedArray {
public static void main(String[] args) {
int[] arrayOne = { 1, 2, 4, 6, 10, 11, 13, 25 };
int[] arrayTwo = { 1, 3, 5, 7, 9 };
merge(arrayOne, arrayTwo);
package stringChallenge;
public class PalindromeString {
public static void main(String[] args) {
System.out.println(isPalindrome("aAaa aaaa"));
// checking if the sentence is semiPalindromic
semiPalindromic("abbccddeeccbba");
semiPalindromic("bbbccddddccbba");
import java.io.FileWriter;
import java.io.IOException;
public class GenerateCsv {
public static void main(String[] args) {
System.out.println("this is test");
try {
FileWriter writer = new FileWriter("test.csv");
import java.io.IOException;
import java.util.Arrays;
import java.util.Collection;
import java.util.List;
class A {
public static void arrayList() {
List<Integer> ls = Arrays.asList();
for (Integer i : ls) {
import java.io.IOException;
import java.util.Arrays;
import java.util.Collection;
import java.util.List;
class A{
public static void m(){
List<Integer> ls = Arrays.asList();
for(Integer i : ls){
public PreconditionsChecker(Tree forLoop, CompilationInfo workingCopy) {
if (forLoop.getKind() == Tree.Kind.ENHANCED_FOR_LOOP) {
this.isForLoop = true;
this.workingCopy = workingCopy;
this.hasUncaughtException = !workingCopy.getTreeUtilities()
.getUncaughtExceptions(TreePath.getPath(workingCopy.getCompilationUnit(), forLoop)).isEmpty();
this.innerVariables = this.getInnerVariables(forLoop, workingCopy.getTrees());
this.visitor = new ForLoopTreeVisitor(this.innerVariables, workingCopy, new TreePath(workingCopy.getCompilationUnit()), (EnhancedForLoopTree) forLoop);
this.isIterable = this.isIterbale(((EnhancedForLoopTree) forLoop).getExpression());
//this class will find prime numbers in diffrernt ways, innerloop, enternal method and using recursive
public class FindPrime {
public static void main(String[] args) {
// forLoop to find prime numbers using external boolean method
for (int i = 2; i < 10000; i++) {
if (isPrimeNumber(i)) {
// System.out.println(i);
}