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 ConvertTreeToLinkedList | |
{ | |
public static Node prev = null; | |
public static Node head = null; | |
public static void main(String[] args) | |
{ | |
Node n1 = new Node(5); |
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
//second attempt, using HashSet and detecting collision | |
import java.util.Arrays; | |
import java.util.HashSet; | |
public class HasAnagrams | |
{ | |
public static void main(String[] args) | |
{ | |
String[] arr = {"bag", "bat", "tab"}; |
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 Main | |
{ | |
public static void main(String[] args) | |
{ | |
BinaryTree tree = new BinaryTree(); | |
tree.add(20); | |
tree.add(10); | |
tree.add(30); | |
tree.add(15); |
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 CondenseString | |
{ | |
public static void main(String[] args) | |
{ | |
StringBuilder sb = new StringBuilder(); | |
String test = "aaaabbbcccccccdeee"; | |
char ch = test.charAt(0); | |
int count = 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
<?php | |
// array for JSON response | |
$response = array(); | |
// check for required fields | |
if (isset($_GET['name']) && isset($_GET['password'])) { | |
$name = $_GET['name']; | |
$message = $_GET['message']; |
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
<?php | |
// array for JSON response | |
$response = array(); | |
// check for required fields | |
if (isset($_POST['name']) && isset($_POST['password'])) { | |
$name = $_POST['name']; | |
$message = $_POST['message']; |
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 JSONParser { | |
static InputStream is = null; | |
static JSONObject jObj = null; | |
static String json = ""; | |
// constructor | |
public JSONParser() { | |
} | |
// function get json from url | |
// by making HTTP POST or GET method | |
public JSONObject makeHttpRequest(String url, String method, |
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 android.util.Log; | |
import org.json.JSONException; | |
import org.json.JSONObject; | |
import java.io.BufferedInputStream; | |
import java.io.BufferedReader; | |
import java.io.DataOutputStream; | |
import java.io.IOException; | |
import java.io.InputStream; | |
import java.io.InputStreamReader; | |
import java.io.UnsupportedEncodingException; |
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
class PostAsync extends AsyncTask<String, String, JSONObject> { | |
JSONParser jsonParser = new JSONParser(); | |
private ProgressDialog pDialog; | |
private static final String LOGIN_URL = "http://dnugent.nicewebsite.info/DevTest/json_php/testPost.php"; | |
private static final String TAG_SUCCESS = "success"; | |
private static final String TAG_MESSAGE = "message"; |
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
# Skip this section below if this device is not connected by USB | |
SUBSYSTEM!="usb", GOTO="android_usb_rules_end" | |
LABEL="android_usb_rules_begin" | |
# Devices listed here in android_usb_rules_{begin...end} are connected by USB | |
# Acer | |
ATTR{idVendor}=="0502", ENV{adb_user}="yes" | |
# Iconia Tab A500 | |
ATTR{idVendor}=="0502", ATTR{idProduct}=="3325", SYMLINK+="android_adb" |