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
// 1. create a sub class inherent to Thread class | |
static class MyThread extends Thread { | |
@Override | |
public void run() { | |
System.out.println("Hello : "+Thread.currentThread().getName()); | |
} | |
} | |
MyThread myThread = new MyThread(); | |
myThread.start(); |
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.function.BinaryOperator; | |
public class MethodReferencesExamples { | |
public static <T> T mergeThings(T a, T b, BinaryOperator<T> merger) { | |
return merger.apply(a, b); | |
} | |
public static String appendStrings(String a, String b) {return a+b;} | |
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 dataStructure; | |
public class CustomLinkedList<E> { | |
// Linked List Node | |
private CustomNode<E> head; // head node | |
private CustomNode<E> tail; // tail node | |
private int size; | |
public int size() { | |
return size; |
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 OS_Critical_Section_Solution { | |
public static void main(String[] args) { | |
boolean[] flag = new boolean[2]; // flag[0] -> Process A, flag[1] -> Process B | |
// Strict Alternation | |
int cnt = 0; | |
while(true) { | |
flag[0] = true; | |
while (flag[1]==true); | |
System.out.println("V"); |
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
python manage.py runserver |
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
python manage.py startapp blog |
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
django-admin startproject first_project |
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
pip install django |
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
# install spotipy in your command line | |
pip install spotipy --upgrade | |
# import spotipy to set up your client account | |
from spotipy.oauth2 import SpotifyClientCredentials | |
import spotipy | |
# copy your client id and secret key on your spotify dashboard | |
# set them up using spotipy client credentials object to let spotipy retrive data by your query | |
client_id="your_id" |
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 UserBean { | |
// fields to construct a bean. Recommended to make all private in singleton design pattern. | |
private String name; | |
private int age; | |
private boolean male; | |
// bean must have its default constructor. | |
public UserBean() {} | |
public UserBean(String name, int age, boolean male) { |