Weil Jimmer's BlogWeil Jimmer's Blog


Category:Experience

Found 54 records. At Page 10 / 11.

int 和 Integer 的比較 Java 程式設計

No Comments
-
更新於 2017-05-19 19:47:56

int test_int_1 = 1;
int test_int_2 = 1;
System.out.println(test_int_1==test_int_2);//true
int test_int_3 = new Integer(1);
int test_int_4 = new Integer(1);
System.out.println(test_int_3==test_int_4);//true
int test_int_5 = new Integer("1");
int test_int_6 = new Integer("1");
System.out.println(test_int_5==test_int_6);//true
int test_int_7 = Integer.valueOf(1);
int test_int_8 = Integer.valueOf(1);
System.out.println(test_int_7==test_int_8);//true
int test_int_9 = Integer.valueOf("1");
int test_int_10 = Integer.valueOf("1");
System.out.println(test_int_9==test_int_10);//true
Integer test_integer_1 = 1;
Integer test_integer_2 = 1;
System.out.println(test_integer_1==test_integer_2);//true
System.out.println(test_integer_1.equals(test_integer_2));//true
Integer test_integer_3 = new Integer("1");
Integer test_integer_4 = new Integer("1");
System.out.println(test_integer_3==test_integer_4);//false
System.out.println(test_integer_3.equals(test_integer_4));//true
Integer test_integer_5 = Integer.valueOf("1");
Integer test_integer_6 = Integer.valueOf("1");
System.out.println(test_integer_5==test_integer_6);//true
System.out.println(test_integer_5.equals(test_integer_6));//true

據我實驗觀察,所得 只要是 int==int 的比較,一定是比較值,若為Integer==int,也一定是比較其值。

唯一為False的情況是當有new出現時:

new Integer("1")==new Integer("1");//false

用 valveOf 得出來的 Integer 類別,進行比較(==),也是 valueOf括號內的值(不管類別是String還是int…)(都小於等於127大於等於負128的情況)是否相等。

test_integer_6 = Integer.valueOf("1");
Integer test_integer_7 = Integer.valueOf(1);
System.out.println(test_integer_6==test_integer_7);//true
System.out.println(test_integer_6.equals(test_integer_7));//true

System.out.println(test_integer_1==test_integer_3);//false
System.out.println(test_integer_1.equals(test_integer_3));//true
System.out.println(test_integer_5==test_integer_3);//false
System.out.println(test_integer_5.equals(test_integer_3));//true
System.out.println(test_integer_7==test_integer_3);//false
System.out.println(test_integer_7.equals(test_integer_3));//true

若 Integer 比較 Integer ,其中之一關鍵字有 new ,== 比較子出來的結果可能就為 False 。

以下為特殊例子!數值小於等於127大於等於負128時不會new,但若不在此區間時,就會以new宣告。

以new宣告的時候==通常都是false,

進行 比較 int 時若其值相同會轉發True。

Integer test_special_1 = Integer.valueOf(127);//等於Integer test_special_1 = 127;
Integer test_special_2 = Integer.valueOf(127);
System.out.println(test_special_1==test_special_2);//true
System.out.println(test_special_1.equals(test_special_2));//true
Integer test_special_3 = Integer.valueOf(128);//等於Integer test_special_1 = 128;
Integer test_special_4 = Integer.valueOf(128);
System.out.println(test_special_3==test_special_4);//false
System.out.println(test_special_3.equals(test_special_4));//true

若本人有誤,歡迎更正。


This entry was posted in Experience, Functions, Java By Weil Jimmer.

Java 型別 List 當使用Arrays.asList時無法 add()、remove()

No Comments
-
發布於 2015-05-17 20:23:46

因為Arrays.asList會強制固定長度。

只能用以下方法把Array宣告成List,可以正常使用。

List<String> list = new LinkedList<String>(Arrays.asList(split));

僅此作為筆記。


This entry was posted in Experience, Functions, Java By Weil Jimmer.

Android Java Activity 事件

No Comments
-
發布於 2015-05-17 16:50:36

image

引用自:

https://www.thenewboston.com/forum/topic.php?id=3234


This entry was posted in Android, Experience, Functions, Java, Note By Weil Jimmer.

Android Java 程式設計「設定/保存數據」

No Comments
-
發布於 2015-05-17 14:14:56

使用 getSharedPreferences 函數儲存數據。

APP_NAME 改成 想設計的名稱,如:org.twgogo.wbf.Code_.web_browser

    public boolean set_config(String str,String name_){
        SharedPreferences sharedPref = getSharedPreferences("APP_NAME", MODE_PRIVATE);
        SharedPreferences.Editor editor = sharedPref.edit();
        editor.putString(name_, str);
        editor.apply();
        return true;
    }
   public String read_config(String name_){
        SharedPreferences sharedPref = getSharedPreferences("APP_NAME", MODE_PRIVATE);
        return sharedPref.getString(name_,"NULL");
    }

 


This entry was posted in Experience, Functions, Java By Weil Jimmer.

最近在學SFM(Source Filmmaker)的心得

2 Comments
-
更新於 2016-02-27 16:54:41

-2014/8/27更新-

這段就是真的有感而發了!一天到晚就在英文教學網站閒晃。然後做出短短幾秒鐘的影片就要花費一堆時間。

我的願望是可以來做L4D2感人影片。

但是以現在我的能力,很有限的情況下,幾乎是不可能辦得到的。但我相信日後學習也許可以做得到。

網路上幾乎沒有中文教學,應該說「完全沒有」!至少我沒有查到,我想應該很少人查到。

只能仰賴英文網站,Youtube的官方英文視頻。(只有第「零」集 Basic 有簡體中文字幕)

沒有同好!關於這一切我只能說很難,很麻煩。

一個人物的動作,即使只有幾秒,也要設定好幾分鐘,甚至要開好幾個鏡頭細看,因為你不知道有沒有設定錯誤!尤其是 IK控件 沒有套用的時候!就算套用了,沒有選好的話,還是可以把人物拉長的,也就是動畫會顯得很奇怪!因且通常都是沒有循環的,得自己用!

即使有內建的,要修改其中一個部分也很難!這不是想像中的好修改,應該要說麻煩吧,我建議是最好什麼都不要用拉的,選好關節用旋轉的!比較不會出現怪異的情況。

SFM不是想像中的簡單,但是卻很強大。我現在已經大概了解裡面的運作了,創建人物模組,移到適當的地點,建立動畫關鍵影格,做好3D配置,鏡頭的調整,最後播放。

只是建立人物動作的關鍵影格最麻煩!

調整好之後,官方也有教學「匯入內建的動作」,因此某些動作(如:行走,攻擊……等)不用那麼麻煩,自己去調整,只要匯入,就搞定了,切換到rootTransform轉一下角度移動位置,動畫就播放的很順利。

在於"非官方模組",並沒有所謂的內建動作!那麼,有個辦法是:載入官方模組,匯入動作之後,再把模組動作"匯出",到時候導入那個匯出去的模組,比對好之後就可以套用了。

簡單來說就是把內建的拿出來外面,再放回去裡面,因為沒辦法直接從非官方模組套用動作。

最令我困惑,以前研究很久的還是在於其他模組/地圖,因為預設只有TF2,要下載額外的內容也是免費的,但是並沒有所謂的L4D2,也沒有CSGO,需要透過GCFScape這套工具!

解壓縮文件目錄下的 副檔名為VPK檔案,主檔名後驟是 "_dir" 的 檔案,接著再提取出來,貌似還要 Run BAT檔案修復模組,不過根據我的實作後的經驗,根本不需要修復!

也就是,不能運行那個BAT檔案,運行了才會出錯。SFM討論區裡面已經有英文文章再講解這個了。

得到模組後,丟進SourceFilmmaker/game/資料夾裡面,修改usermod資料夾裡面的gameinfo.txt,下方有很多配置,反正就是找到SearchPaths類別的大括號,在裡面插入新的一行,照同樣的格式打入文件資料夾的名稱。

這樣就可以在SFM裡面匯入了,貌似只有地圖檔最麻煩,除了反編譯就別無他法了。

我一開始以為官方視頻會教這些,但是,什麼都沒有!

只有講解要怎麼操作罷了。非常令人厭惡。

By Weil Jimmer


This entry was posted in Experience, Mood By Weil Jimmer.

最前頁 上一頁  1 2 3 4 5 6 7 8 9 10 11 /11 頁)下一頁

Visitor Count

pop
nonenonenone

Note

不要和愚蠢的人發生爭執。

支持網路中立性.
Support Net Neutrality.

支持臺灣實施
無條件基本收入

歡迎前來本站。

Quotes

我一定會老。

我一定會病。

我一定會死。

人生終須一別。

我們是業的主人。

Search

Music

Life Counter

23069days



Breaths between now and when I die.

Blogging Journey

4688days

since our first blog post.

Words Quiz


Quotes

The strong do what they can and the weak suffer what they must.

Privacy is your right and ability to be yourself and express yourself without the fear that someone is looking over your shoulder and that you might be punished for being yourself, whatever that may be.

It is quality rather than quantity that matters.

I WANT Internet Freedom.

Reality made most of people lost their childishness.

Justice,Freedom,Knowledge.

Without music life would be a mistake.

Support/Donate

This site also need a little money to maintain operations, not entirely without any cost in the Internet. Your donations will be the best support and power of the site.
MethodBitcoin Address
bitcoin1gtuwCjjVVrNUHPGvW6nsuWGxSwygUv4x
buymeacoffee
Register in linode via invitation link and stay active for three months.Linode

Support The Zeitgeist Movement

The Zeitgeist Movement

The Lie We Live

The Lie We Live

The Questions We Never Ask

The Questions We Never Ask

Man

Man

THE EMPLOYMENT

Man

In The Fall

In The Fall

Categories

Android (8)

Announcement (4)

Arduino (2)

Bash (2)

C (3)

C# (5)

C++ (1)

Experience (54)

Flash (2)

Free (13)

Functions (36)

Games (13)

General (63)

Git (3)

HTML (7)

Java (13)

JS (7)

Mood (24)

NAS (2)

Note (34)

Office (1)

OpenWrt (6)

PHP (9)

Privacy (4)

Product (12)

Python (4)

Software (11)

The Internet (26)

Tools (16)

VB.NET (8)

VR (1)

WebHosting (7)

Wi-Fi (5)

XML (4)