標籤
二元樹
(1)
字串常數池
(1)
投資
(3)
每月損益
(37)
例外處理
(1)
泛型
(2)
股票
(15)
指標
(5)
英文
(8)
基本資料型別
(1)
期貨
(1)
程式交易
(10)
量化投資
(5)
亂亂寫
(3)
概念
(3)
資料結構
(3)
演算法
(3)
數學
(3)
轉型
(1)
AMA
(1)
ArrayList
(1)
assert
(1)
BeautifulSoup
(1)
C/C++
(8)
casting
(1)
ClassCastException
(1)
classpath
(1)
Collection
(4)
Comparable
(1)
comparTo()
(1)
constructor
(1)
database
(3)
Debian
(1)
Dropbox
(2)
EA
(2)
enum
(1)
equals()
(2)
exception
(3)
extends
(1)
ffmpeg
(1)
final
(1)
Git
(1)
HashMap
(1)
HashSet
(1)
hasNext()
(1)
HTS
(3)
instanceof
(1)
IS-A
(1)
Iterator
(1)
JAVA
(43)
length
(1)
Linux
(31)
List
(1)
Mac
(6)
Map
(1)
ML
(2)
MT4
(6)
MySQL
(2)
next()
(1)
NullPointerException
(1)
Number
(1)
Numpy
(2)
OpenCart
(1)
OpenCV
(3)
OSX
(1)
overloading
(1)
overriding
(3)
pandas
(2)
PHP
(8)
PriorityQueue
(1)
Python
(11)
Queue
(1)
random()
(1)
reverse()
(1)
Samba
(1)
SCJP
(21)
sqrt()
(1)
synchronized
(1)
talib
(1)
ufw
(1)
uTorrent
(1)
var-args
(2)
VHF
(1)
vim
(2)
Yhoo知識+
(4)
2013年6月2日 星期日
too much, too many, a lot of
too much, too many 跟 a lot of 都是很多的意思,但要如何使用?
首先來討論 too much 跟 too many,
much用在不可數的名詞,many用在可數名詞。
例如:I have too much homework. 我功課好多。
I have too many dogs. 我養太多的狗了。
你會發現這兩句話都不是很正面,因為都”太多”了,多到會有一些不好的感覺。
所以 too much 和 too many 都是用在非正面的話語。
再舉幾個例子:
I have too many movies on my iPad. 我的iPad放太多電影了。
(電影很好啊,但你放那麼多在ipad裡面就變不好了)
改成正面的說法則是:I have a lot of movies on my iPad. 我的iPad有很多電影
a lot of 可用在可數及不可數名詞
2013年3月14日 星期四
2012年12月8日 星期六
linux重灌後無法ssh
linux重灌後發現ssh產生錯誤:
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@ WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED! @
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
IT IS POSSIBLE THAT SOMEONE IS DOING SOMETHING NASTY!
Someone could be eavesdropping on you right now (man-in-the-middle attack)!
It is also possible that the RSA host key has just been changed.
The fingerprint for the RSA key sent by the remote host is
76:bd:e0:e9:c2:13:6d:ca:d8:eb:b2:a8:58:9b:4b:b6.
Please contact your system administrator.
Add correct host key in /Users/superppp/.ssh/known_hosts to get rid of this message.
Offending key in /Users/superppp/.ssh/known_hosts:1
RSA host key for 192.168.1.101 has changed and you have requested strict checking.
Host key verification failed.
解決方式:
$ ssh-keygen -R 192.168.1.101
/Users/superppp/.ssh/known_hosts updated.
Original contents retained as /Users/superppp/.ssh/known_hosts.old
參考自這裡
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@ WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED! @
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
IT IS POSSIBLE THAT SOMEONE IS DOING SOMETHING NASTY!
Someone could be eavesdropping on you right now (man-in-the-middle attack)!
It is also possible that the RSA host key has just been changed.
The fingerprint for the RSA key sent by the remote host is
76:bd:e0:e9:c2:13:6d:ca:d8:eb:b2:a8:58:9b:4b:b6.
Please contact your system administrator.
Add correct host key in /Users/superppp/.ssh/known_hosts to get rid of this message.
Offending key in /Users/superppp/.ssh/known_hosts:1
RSA host key for 192.168.1.101 has changed and you have requested strict checking.
Host key verification failed.
解決方式:
$ ssh-keygen -R 192.168.1.101
/Users/superppp/.ssh/known_hosts updated.
Original contents retained as /Users/superppp/.ssh/known_hosts.old
參考自這裡
2012年12月7日 星期五
三維陣列走訪
試撰寫一程式,請利用三維列陣A完成下列題目的要求。列陣A的值如下
int A[][][]={{{15,50,65},{38,94,25},
{79,44,19},{89,54,73}},
{{14,90,46},{43,23,67},
{32,56,78},{94,78,40}}};
(a)請印出陣列內容。
(b)在陣列A裡找出所有大於等於50的元素,將該元素重新設值為99。
(c)印出完成(b)之後的陣列內容。
--------------------------------------
public class Array99{
public static void main(String[] args){
int[][][] A={{{15,50,65},{38,94,25},{79,44,19},{89,54,73}},
{{14,90,46},{43,23,67},{32,56,78},{94,78,40}}};
showArray(A);
showArray(A);
}
public static void showArray(int[][][] a){
for(int i=0; i<a.length; i++){
for(int j=0; j<a[0].length; j++){
for(int k=0; k<a[0][0].length; k++){
System.out.print(a[i][j][k]+ " ");
if(a[i][j][k]>=50) a[i][j][k] = 99;
}
System.out.println();
}
}
System.out.println();
}
}
補充:其實for迴圈那裡用for-each會比較好理解,如for(int[][] b: a)...for(int[] c: b)...for(int d: c),不過這樣就不能指派值了。
好啦,還是補一下for-each的版本:
public class Array99{
public static void main(String[] args){
int[][][] A={{{15,50,65},{38,94,25},{79,44,19},{89,54,73}},
{{14,90,46},{43,23,67},{32,56,78},{94,78,40}}};
showArray(A);
showArray(A);
}
public static void showArray(int[][][] a){
for(int[][] i: a){
for(int[] j: i){
for(int k=0; k<j.length; k++){ //這裡如果用for(int k: j)會無法指派值
System.out.print(j[k]+ " ");
if(j[k]>=50) j[k] = 99;
}
System.out.println();
}
}
System.out.println();
}
}
int A[][][]={{{15,50,65},{38,94,25},
{79,44,19},{89,54,73}},
{{14,90,46},{43,23,67},
{32,56,78},{94,78,40}}};
(a)請印出陣列內容。
(b)在陣列A裡找出所有大於等於50的元素,將該元素重新設值為99。
(c)印出完成(b)之後的陣列內容。
--------------------------------------
public class Array99{
public static void main(String[] args){
int[][][] A={{{15,50,65},{38,94,25},{79,44,19},{89,54,73}},
{{14,90,46},{43,23,67},{32,56,78},{94,78,40}}};
showArray(A);
showArray(A);
}
public static void showArray(int[][][] a){
for(int i=0; i<a.length; i++){
for(int j=0; j<a[0].length; j++){
for(int k=0; k<a[0][0].length; k++){
System.out.print(a[i][j][k]+ " ");
if(a[i][j][k]>=50) a[i][j][k] = 99;
}
System.out.println();
}
}
System.out.println();
}
}
補充:其實for迴圈那裡用for-each會比較好理解,如for(int[][] b: a)...for(int[] c: b)...for(int d: c),不過這樣就不能指派值了。
好啦,還是補一下for-each的版本:
public class Array99{
public static void main(String[] args){
int[][][] A={{{15,50,65},{38,94,25},{79,44,19},{89,54,73}},
{{14,90,46},{43,23,67},{32,56,78},{94,78,40}}};
showArray(A);
showArray(A);
}
public static void showArray(int[][][] a){
for(int[][] i: a){
for(int[] j: i){
for(int k=0; k<j.length; k++){ //這裡如果用for(int k: j)會無法指派值
System.out.print(j[k]+ " ");
if(j[k]>=50) j[k] = 99;
}
System.out.println();
}
}
System.out.println();
}
}
Euler的圓周率
public class Pi{
public static void main(String[] args){
System.out.println("Euler(10)=" +Euler(10));
System.out.println("Euler(100)=" +Euler(100));
System.out.println("Euler(1000)=" +Euler(1000));
}
public static double Euler(int n){
boolean isPrime;
double sum = 1.0;
int count = 0;
int i = 3;
while(count < n){
isPrime = true;
for(int j=3; j<=Math.sqrt(i); j+=2){
if(i%j == 0){
isPrime = false; break;
}
}
if(isPrime){
if((i-1)%4 == 0) sum *= i / (double)(i+1);
else sum *= i / (double)(i-1);
count++;
}
i += 2;
}
return sum * 2;
}
}
數字反轉
請利用eclipse打一支程式
題目如下:
實作一個public static int reverse(int n)方法, 將一個5位數的數字逆轉. EX: 呼叫 reverse(12345) 會得到一個 54321 的結果. (提示: 可利用求餘數的方法將五個數字分別切割出來, 然後再逆轉組合. 12345 % 10 = 5)
PS:用method做
-----------------------------------
public class ReverseNum{
public static int reverse(int n){
String wn = "";
wn += n;
StringBuilder sbd = new StringBuilder(wn);
sbd.reverse();
return Integer.parseInt(sbd.toString());
}
public static void main(String[] args){
System.out.println(reverse(12345));
}
}
訂閱:
文章 (Atom)