....

顯示具有 長知識 標籤的文章。 顯示所有文章
顯示具有 長知識 標籤的文章。 顯示所有文章

2015年1月6日 星期二

[長知識] Oracle SQL Manipulating Data (控制資料)

把如何控制資料的語法分做幾類

1. 新增 insert into

insert into departments(id, name, t_id, t_name) values (007, Ken, 100, King);

2. 修改 update
update employees set id=008 where t_name=100;

2014年12月9日 星期二

2014年11月20日 星期四

[長知識] C++ 物件導向 II


關於物件導向,簡單的來說明,
繼承,就像是父親和兒子的關係

以下面範例~

2014年11月18日 星期二

[長知識] C++ x this this this

這裡是說明this怎麼使用

以下面這個範例來說

[長知識] C++ 物件來導導導導向 物件導向

像是每一種汽車有一種輪胎,那麼汽車公司會很麻煩,
不如就先有一個輪胎類別,小台車要生產就用小輪胎
大台車要大輪胎就生產大的。

範例分為兩部分:

[長知識] C++ 利用記憶體位置去作運算範例

前面文章有提過 利用變數傳值運算
這篇文章說明 利用記憶體位址的值去運算。

來說明吧:

2014年11月15日 星期六

[長知識] C++ 的 Reference & Pointer (參考和指標)

Reference (參考) 和 Pointer (指標) 在C++內很重要,很重要,很重要,
因為很重要,所以我打了3次。

言歸正傳:

[長知識] c++ 在字串 string 的初學玩法

要開始介紹C++的String字串之前,
一定要先 include <string> 否則不能使用字串的方法。

程式說明:

[長知識] C++ Overload 多載、多載、多載

這邊要解釋的是C++的Overload (多載)
多個方法的名字可以一樣,
只要程式給不同的值,他也可以區分。

以下面這個範例說明:

[長知識] C++裡面的template,Java裡面的generic

對於一個寫過Java而還不熟C++的人來說
有著一個共通的地方
Java說這是泛型Generic
C++說這是樣板template

以下範例在說明:

[長知識] c++ 要怎麼開始玩最快?

從c++開始,
我們要include的東西就不一樣了
原本C include <stdio.h> 和 <stdlib.h>
C++則是 include <iostream>和<cstlib>
再來是重要的命名空間使用 using namespace std;
來說說有using和沒有using的差別好了
有using namespace std ,就直接可以使用cout和endl
例如:  cout<<"hello world!<<endl;
沒有使用using namespace std,就不能直接使用cout和endl
例如: std::cout<<"hello world!<<std::endl;
差別就是每次要使用時,都必須要再寫一次 std::

下面這個範例是在說明:

2014年11月12日 星期三

[長知識] C語言 - 陣列mixed指標

陣列即指標!
陣列名稱:指向陣列起始位址的指標



#include 
#include 

int main(){
  int a[5] = P{1, 2, 3, 4, 5};
  int i, n;
  
  printf("sizeof(a)%d\n",sizeof(a));
  printf("sizeof(a[0])%d\n",sizeof(a[0])); 
 

[長知識] C語言 - malloc()

p = (int*)malloc(sizeof(int));
malloc: 動態取得記憶體傳回指標。



#include 
#include 

int main(){
 int *p;
 p = (int*)malloc(sizeof(int));
 *p = 10;
 

[長知識] C語言 - 玩玩 參數傳值和傳址


#include 
#include 
 
 //傳址,希望函數幫我改值的狀況就用傳址! 
int dayBetweenByAddress(int *in, int *out){
 int temp;
 if(in >out){
  temp = *in;
  *in = *out;
  *out = temp; 
 } 
 return *out-*in;
}

[長知識] C語言 - 就是要玩玩指標


變數
指標
宣告 ()
a
*ptra
取址 ()
&a
ptra





2014年11月10日 星期一

[長知識] C語言 - 新手篇章 - 命名常數(pi)

#define 是在編譯時被執行!!
最常用的就是定義數學Pi = 3.1415926了

#include 
#include 
#define pi 3.1415926

[長知識] C語言 - 新手篇章 - 自訂函數


#include 
#include 

//Topic : 自訂函數 function
//printf(), scanf() :內建函數,等待呼叫
//if, for, while :敘述 statement 
 

2014年9月21日 星期日

[長知識] Android Service 在背景偷偷下載資料不是問題~

在這裡跟大家分享 Android Service的做法,其實非常非常的簡單~

事先準備
1. 你要在哪裡啟動Service
2. 你要在哪裡關閉Service
3. 準備一個class來繼承Service

Let's gooooooooooooooooooo...


[長知識] Android getApplicationContext() VS getBasecontext() 的差異

最常見到選擇這四種選擇的情況是在Toast吧~
Toast.makeText( getApplicationContext() , "Hi~", Toast.LENGTH_SHORT).show();
所以就上網搜尋了一些資料,大概是以下~~~
1. getApplicationContext():
基本上,他會永遠跟著Android Activity的生命週期~

2. getBasecontext():
在Activity跑到 onDestory()的時候,就會被殺掉~