Skip to content

Instantly share code, notes, and snippets.

View yenchenlin's full-sized avatar
👋
Hi!

Yen-Chen Lin yenchenlin

👋
Hi!
View GitHub Profile

What is @property ?

@property 是 Obj-C 2.0 版開始提供的一種功能,目的是要簡化一個 instance variable 的設定過程。

為什麼需要 @property ?

instance variable (以下簡稱 ivar ) 在 Obj-C 裡預設為 protected , 代表只有這個 class or 它的 subclass 可以 access 值。 如果這個 ivar 要給外部使用的話,那就必須必須加上 public 的 method setter/getter。 然而,每宣告一個要給外部使用的 ivar 就要宣告一組 setter/getter 太麻煩,因此 Obj-C 加入了 @property 的語法 。

舉例來說,原本想讓外部的人使用 weight 要這樣寫:

@yenchenlin
yenchenlin / tmux-cheatsheet.markdown
Last active September 14, 2015 11:40 — forked from MohamedAlaa/tmux-cheatsheet.markdown
tmux shortcuts & cheatsheet

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname
@yenchenlin
yenchenlin / gist:0c6fc9a185161d469f6b
Last active March 3, 2016 05:48
CloudDB Assignment-1 Report

Assignment 1 Report

How you implement the transaction using JDBC and stored procedures briefly

JDBC [Aus]

Remote Stored Procedures [Yen]

Experiements

Schedule

2016

March-May

Read papers and determine research direction

NOTE: I have to take GRE test on 4/8

@yenchenlin
yenchenlin / ensemble_selection_demo.py
Last active November 8, 2018 14:13
Code demonstrate how to use ensemble selection
import numpy as np
from sklearn.ensemble import EnsembleSelectionClassifier
from sklearn import datasets
from sklearn.tree import DecisionTreeClassifier
from sklearn.ensemble import AdaBoostClassifier
from sklearn.linear_model import LogisticRegression
from sklearn.svm import SVC
from sklearn import cross_validation
from sklearn.metrics import accuracy_score
import sklearn.preprocessing as preprocessing
  public static class TokenizerMapper
       extends Mapper<Object, Text, NullWritable, LongWritable>{
 
    private TreeMap<Long, String> numbers = new TreeMap<Long, String>();

#Assignment 1

Final Output

3780008173
3780008179
3780008201
3780008213
3780008233
3780008251
import numpy as np
from scipy import sparse as sp
from sklearn.datasets.samples_generator import make_blobs
from csr_row_norms import csr_row_norms
import timeit

centers = np.array([
    [0.0, 5.0, 0.0, 0.0, 0.0],
 [1.0, 1.0, 4.0, 0.0, 0.0],

In case you don't know, HTTP is stateless, which means the server you are communicating will not know who you are or what you've said to it before.

Say you logged in to a website, you will notice that you don't need to type your username, password etc when you visit the site again.

It looks like the server knows who you are, how could this be possible?

That's because a "session" is handling this for you.

Remember that HTTP is stateless, which means the server has no memories about what it said or what it heard.