Weil Jimmer's BlogWeil Jimmer's Blog


Category:Functions

Found 36 records. At Page 5 / 8.

JavaScript XML Dom 標籤名稱有冒號的情況 getElementsByTagName

No Comments
-
更新於 2017-05-19 19:42:34

如下:< > 標籤名稱裡面有冒號的情況,要如何getElementsByTagName,查了不少資料都沒有說…感覺是我不懂XML才會這樣。

只知道JQ搜尋的時候冒號前面要加兩條斜槓,但JavaScript不是。

JavaScript 是

xmlDoc.getElementsByTagName("encoded")[0].childNodes[0].nodeValue;

也就是找尋:xml標籤「冒號」,後方的名稱,而不是搜尋冒號前面的名稱,更不是兩個一塊打上去中間加冒號。

錯誤很多次的心得,這次寫個小筆記。


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

解決 Android Studio Adb 無法啟動的問題

No Comments
-
更新於 2017-02-18 23:32:33

如上,情況。

通常都是 Port 5037 被佔用,或是已有的adb程序已經被啟動了,只要找到目標程序,並終結掉就正常了。

解決方法可以用 TCPview之類的工具查看,或是超級工作管理員等,找尋其他可能的adb程序。

比如:快快遊戲、QQ、還有啥麼root工具、手機管理工具之類的。殺掉就可以正常運作。


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

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.

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

Visitor Count

pop
nonenonenone

Note

台灣假新聞橫行,沒一家霉體能信的,網軍側翼到處洗風向,堪憂。

政府根本不怕你拿法律當武器,只怕你放下法律拿起武器

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

飽暖思淫欲,
饑寒起盜心。

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

歡迎前來本站。

Words Quiz


Search

Music

Blogging Journey

4501days

since our first blog post.

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

Facebook is EATING the Internet

Facebook

Categories

Android (7)

Announcement (4)

Arduino (2)

Bash (2)

C (3)

C# (5)

C++ (1)

Experience (52)

Flash (2)

Free (13)

Functions (36)

Games (13)

General (61)

Git (2)

HTML (7)

Java (13)

JS (7)

Mood (24)

NAS (2)

Note (33)

Office (1)

OpenWrt (6)

PHP (9)

Privacy (4)

Product (12)

Python (4)

Software (11)

The Internet (26)

Tools (16)

VB.NET (8)

WebHosting (7)

Wi-Fi (5)

XML (4)