顯示具有 學習誌 標籤的文章。 顯示所有文章
顯示具有 學習誌 標籤的文章。 顯示所有文章

2019年7月22日 星期一

Setting Java JMX password in WebLogic (Windows)


Step:
1.    找到weblogicsetDomainEvn.cmd

2.    使用最高管理權限打開該檔案貼上下列jmx的設定(最好貼在檔案中間,貼在檔案最下面可能不會被執行到)
set JAVA_OPTIONS=%JAVA_OPTIONS% -Dcom.sun.management.jmxremote.port=1099  
set JAVA_OPTIONS=%JAVA_OPTIONS% -Dcom.sun.management.jmxremote.ssl=false 
set JAVA_OPTIONS=%JAVA_OPTIONS% -Dcom.sun.management.jmxremote.authenticate=true 
set JAVA_OPTIONS=%JAVA_OPTIONS% -Dcom.sun.management.jmxremote.access.file=jmxremote.access 
set JAVA_OPTIONS=%JAVA_OPTIONS% -Dcom.sun.management.jmxremote.password.file=jmxremote.password
3.   使用指令設定這兩個檔案的存取權限(否則啟動時會出現錯誤訊息:必須限制密碼檔案讀取存取)
>cacls jmxremote.password /P Administrators:R 
>cacls jmxremote.access /P Administrators:R

4.   登入weblogic後台,找到[環境]>[伺服器]>[控制項]->手動啟動Project專案

5.   Windows Console輸入Jconsole,在第二個選項輸入「localhost:1099」且不輸入帳號和密碼,並按下[Connect]

6.    Jconsole會跳出連線不成功的訊息

7.   使用正確的帳號和密碼登入後,查看JVM的參數會有JMX的相關設定。

2019年7月18日 星期四

用指令安裝Windows Patch


1.      將安裝檔放置暫存的Folder

2.      開啟windows 命令提示字元輸入下列指令解壓縮到 C:\Patch底下
expand –F:* C:\Temp\Windows8.1-KB2992611-x64.msu C:\Patch

3.使用最高權限開啟windows 命令提示字元輸入下列指令進行安裝(需保留空白鍵)

Dism.exe /online /Add-Package /PackagePath:C:/Patch/Windows8.1-KB2992611-x64.cab

安裝完成去控制台檢查Windows更新列表



2019年7月15日 星期一

使用Java keytool匯入和匯出憑證

1. 使用KeyTool產生金鑰和憑證請求檔
>keytool -genkey -alias test -keyalg RSA -keysize 2048 -keystore D:\.keystore
>keytool -certreq -alias test -file D:\certreq.txt -keystore D:\.keystore

2.匯入從發證中心發回的4張憑證到JavakeyStore
   匯入憑證的順序: root-> uca_1->uca_2->server (順序不可以亂掉)
>keytool -import -trustcacerts -alias root -file D:\root.cer -keystore D:\.keystore
......
>keytool -import -trustcacerts -alias test -file D:\server.cer -keystore D:\.keystore

3.KeyStroe轉成個人憑證檔(.p12.pfx)
>keytool -importkeystore -srckeystore D:\.keystore -destkeystore D:\test.p12 -srcalias test-srcstoretype jks -deststoretype pkcs12

4.可使用openssl產生pem
>openssl pkcs12 -in D:\test.p12 -out D:\test.pem

Refer:



2019年3月22日 星期五

JAVA經典程式題目-費氏級數(遞迴)

import java.util.Scanner;

public class Fibonacci {

public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
        System.out.println("Please fill in :");
        System.out.print("value = ");
        int m =  scanner.nextInt();
        System.out.println("Fibonacci Number: " + fib(m));
}

private static int fib(int m) {
if(m==1 || m==2 )
return 1;
else if(m==0) return 0;
else return fib(m-1)+fib(m-2);
}

}

2019年3月19日 星期二

JAVA經典程式題目-求最大公因數(遞迴 和 迴圈)

import java.util.Scanner;

public class GcdUseRecursion {

public static int gcd(int m, int n) {
if(n==0) {
return m;
}else {
return gcd(n,m%n);
}

}

public static int gcd2(int m, int n) {
int value=0;
while(n!=0) {
value = m%n;
m= n;
n= value;
}

return m;
}

public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
        System.out.println("Please fill in :");
        System.out.print("m = ");
        int m =  scanner.nextInt();
        System.out.print("n = ");
        int n = scanner.nextInt();
        System.out.println("GCD: " + gcd(m, n));
        System.out.println("GCD2: " + gcd2(m, n));
}

}

2019年2月23日 星期六

Youtube影片無法直接內嵌於iframe

這應該已經不是什麼問題了,只是在此做個紀錄....

若你想要直接將youtube的影片內嵌到iframe,就會看到拒絕連線畫面(GG....)
此時你需要參考下列Google的精美說明文件:
https://developers.google.com/youtube/player_parameters?hl=zh-cn

將影片url修正一下,就可以播囉!!範例影片為目前最紅的Machine Learning 就順便看一下吧!
修正範例如下:
1.內嵌playlist:
https://www.youtube.com/embed?listType=playlist&list=PLJV_el3uVTsOK_ZK5L0Iv_EQoL1JefRL4
2.內嵌一部影片
https://www.youtube.com/embed/XnyM3-xtxHs



2015年8月28日 星期五

[Oracle]修復記憶體不足 NOTE

1.使用指令修改
SGA=db_cache+shared_pool+java_pool+large_pool

處理方法:
手動調整SGA的大小,然後重新分配四大記憶體區域的大小。主要增加共用記憶體和緩衝快取記憶體。
sql> show sga; //查看SGA的具體大小資訊。
sql>show parameter sga_max_size //查看SGA最大值
sql> show parameter shared_pool //查看共用記憶體
sql>show parameter db_cache //查看資料緩存

sql> alter system set sga_max_size = 500M scope=spfile;//修改SGA最大值
sql> alter system set shared_pool_size =200M scope=spfile; //修改共用記憶體
sql> alter system set db_cache_size =250M scope=spfile; //修改資料緩存

2.改完後要重新啟動Oracle,不過我遇到了下列問題--Oracle起不來
 ORA-12514 ,解法如下:
 http://blog.sina.com.cn/s/blog_44d19b500101o9ow.html

3.解完上一個ERROR出現權限不足
ORA-01031 :權限不足
http://blog.itpub.net/24558279/viewspace-704017

4.再解完上一個,又出現下列錯誤
ORA-00821: sga_target is too small ....
http://oraclequirks.blogspot.tw/2008/04/ora-00821-specified-value-of-sgatarget.html

5.最後終於好了...

總之...改個Oracle記憶體風險還蠻大的


2012年11月15日 星期四

OAuth & OpenID 介紹

1.What is OpenID?
是一個Open standard, User可以在 提供數位身份(Identity Provider,IdP)網站註冊一個OpenID,User就可以使用OpenID在任何網站進行登入,不必再另外記住每個網站的帳號密碼。
IdP網站有:Yahoo!,Google,Windows Live,AOL,PayPal...等。

OpenID 基本術語:
(1)End User:想要對網站表明身份的User
(2)Identifier: 使用URL or XRI 可以辨別End-User的識別(OpenId)。
(3)Identity Provider,IdP:提供數位身份註冊及驗證的提供者(ex:Google,Windows Live)。
(4)Replying Party,RP:想要驗證End-User的網站或應用程式(ex:第三方)。

驗證方式:
(1)checkid_immediat:兩個server間所有訊息交換都在後台進行,不會提示End-User.
(2)checkid_setup:End-User 藉由存取第三方網站相同的瀏覽器端與OpenId提供者(ex.Google)進行訊息交換。(此種比較常用)

OpenID用戶大全:http://www.comsharp.com/GetKnowledge/zh-CN/CMS_K309.aspx
-------------------------------------------
-------------------------------------------
2.What is OAuth?

OAuth (Open Authorization) ,透過第三方Web應用程式去讀取User在另一個網站存放的個人資源,User不需透露帳密給第三方Web應用程式。

(1)Service Provider:
(2)User:
(3)Client:

1.User login
OAuth workflow

------------------------------------
------------------------------------
3.What is OAuth 2.0?
因為OAuth1.0有Securtity issue(session fixation attacks),所以後續發展了OAuth 2.0 且不相容 OAuth 1.0 和 1.0a。

Support OAuth 2.0 : Facebook, Google, Windows Live

4.What is different?

----------------------------------------
----------------------------------------
5.How to use?
Node.js
(1)EveryAuth:
Positive:support many types of openId, easy to learn.
Negative:heavy depend on express,too much more module to maintain

(2)MongooseAuth(base on Everyauth)
Positive:support 常用的OpenId,與MongoDB結合
Negative:depend on everyauth,程式也需跟著變動

(3)Passport
Positive:Idiomatic Node.js,Modular,Flexible,API Authentication,Reliable,
Negative:許多額外function功能需要自己維護


Java
(1)scribe-java

Ruby
(1)OmniAuth

----------------------------------------
----------------------------------------
6.Security?
notice Web Security top 10.

2012年10月4日 星期四

Install MongoDB and Node.js on CentOS 6.2

Mongo DB:
Note: must create folder /data/db (it's Mongo DB default folder)
1. background job:
Please read link on below:
http://docs.mongodb.org/manual/tutorial/install-mongodb-on-redhat-centos-or-fedora-linux/

2. foreground job:
 (1)download Mongo DB .tar files on your local computer.
 (2)create folder and set permissons
      "$ mkdir -p /data/db"
      "$chown -R $USER:$USER /data/db"
(3)extract .tar file
     "$tar zxf mongodb-linux-XXXXX.tar.gz"
     "$cd mongodb-linux-XXXXX"
(4)start Mongo DB now
     "$ bin/mongod"
 
Node.js:
1.use yum
wget http://nodejs.tchol.org/repocfg/el/nodejs-stable-release.noarch.rpm
yum localinstall --nogpgcheck nodejs-stable-release.noarch.rpm
yum install nodejs-compat-symlinks npm
rm nodejs-stable-release.noarch.rpm


2011年11月18日 星期五

alter Oracle 10g character


sqlplus /nolog
conn SYS/1234 as sysdba;
shutdown immediate;
startup mount;
ALTER SESSION SET SQL_TRACE=TRUE;
ALTER SYSTEM ENABLE RESTRICTED SESSION;
ALTER SYSTEM SET JOB_QUEUE_PROCESSES=0;
ALTER SYSTEM SET AQ_TM_PROCESSES=0;
ALTER DATABASE OPEN;

alter database character set AL32UTF8;
(****have Error like ORA-12712,please read note below )

ALTER SESSION SET SQL_TRACE=FALSE;

shutdown immediate;

STARTUP;

select NLS_CHARACTERSET from nls_database_parameters;

-------------------------------------------
****Note:
ERROR at line 1:
ORA-12712: new character set must be a superset of old character set

ALTER DATABASE character set INTERNAL_USE AL32UTF8;

2011年5月11日 星期三

在Eclipse Ganymede上設置Apache Axis2

1.從http://axis.apache.org/axis2/java/core/download.cgi 
download 1.4.1的版本解壓縮至 c:\

2.在環境變數設定AXIS2_HOME


3.在在環境變數設定Path

4.開啟Eclipse->[Windows]->[Preferences]

5.設定[Web Services]項目->[Axis2 Preferences]

6.設定[Web Services]項目->[Server and Runtime]

7.將程式轉成 Web Services


8.啟動Tomcat 6.0 Server

9.開啟Web Services Explorer




10.開始使用SOAP進行測試

11.點選要測試的Function Name

12.輸入測試資料


13.頁面回傳測試完成的資料



2011年3月3日 星期四

XMPP

http://mina.apache.org/vysper/extending-the-server.html
http://xmpp.org/rfcs/rfc3920.html
http://xmpp.org/about-xmpp/technology-overview/core/
http://www.igniterealtime.org/projects/index.jsp

XMPP Core(RFC3920)

大綱:
XMPP是一個XML(Extensible Markup Language)元素的串流協定,為了在任何兩端提供更接近即時的結構化資訊交換.
而XMPP為XML資料交換提供了一個普遍化且可擴充的framework.
通常主要被用來建立IM(instant messaging)和在場應用(presence application),請參考所需條件RFC2779.
1. 簡介
The extensions required to provide the instant messaging and presence functionality defined in RFC 2779 [IMP‑REQS] are specified in Extensible Messaging and Presence Protocol (XMPP): Instant Messaging and Presence [XMPP‑IM].

2. 普遍性的架構
2.1 概觀:
C1----S1---S2---C3
|
C2----+--G1===FN1===FC1
The symbols are as follows:

C1, C2, C3 = XMPP clients
S1, S2 = XMPP servers
G1 = A gateway that translates between XMPP and the protocol(s) used on a foreign (non-XMPP) messaging network
FN1 = A foreign messaging network
FC1 = A client on a foreign messaging network
- : 使用XMPP
= : 非XMPP的其他通訊協定

2.2 Server:
整合抽象層的XMPP通訊,主要責任:
- to manage connections from or sessions for other entities, in the form of XML streams to and from authorized clients, servers, and other entities
- to route appropriately-addressed XML stanzas among such entities over XML streams

2.3 Client:
多數client透過TCP直接連結到server,並充分利用server所提供的功能和相關服務.

2.4 Gateway:
一個特殊目的得server端服務,主要功能用來將XMPP翻譯成其他non-XMPP的訊息系統.
例如gateways到email(SMTP),SIMPLE,Short Message Service (SMS),其他IM.
gateways與servers之間,gateways與其他外部訊息系統間的溝通,並未定義於RFC3920.

2.5 Network:


3. 位址格式
3.1 概觀
一個entity是網路上被承認的端點並且可使用XMPP溝通. entities都有獨一無二的位址格式(RFC2396).
因歷史理由,XMPP entity的位址被稱為Jabber Identifier或JID.
合法的JID包含了一組有順序的元素格式
jid = [ node "@" ] domain [ "/" resource ]

3.2 Domain Identifier
3.3 Node Identifier
3.4 Resource Identifier
3.5 Determination of Addresses

4. XML串流
4.1 概觀
XML streams and XML stanzas這兩個基本概念產生相對較小且快速,非同步的結構化資訊payload.

- Definition of XML Stream:
XML Stream 是一種XML Elements容器,用於網路上兩個個體之間的交換.
一個XML Stream的
起始tag明確的由來表示與適當得attribute和namespace來定義,
結束tag明確的由
來表示
在stream的生命周期間,被初始化的個體可以透過Stream發送無數個XML element.

- Definition of XML Stanza:
An XML stanza is a discrete semantic unit of structured information that is sent from one entity to another over an XML stream.
一個XML stanza直接存在於 element中,
任何XML stanza的
起始tag明確的表示在depth=1的XML stream中,
結束tag明確的表示在depth=1的XML stream中.
XML stanza也可以在child element中包含相關想表達的資訊.
XML stanza預設namespace均屬於,,

思考client與server的會話,為了連結到一個server,一個client必須初始一個XML stream並傳送一個開放的tag到server.
並可選擇,文字的處理上是否要聲明指定XML version和字元encoding的支援.

4.2 結合TCP

2011年2月16日 星期三

關於程式"重構"

        最近公司裡面的架構師,希望我們能夠對現行的系統進行程式「重構」....,光是想到那些一個doPost寫到底的code,心裡面便是頭皮發麻,如果遇到像是歸檔相關系列那種大程式,我應該可以寫上三天三夜了,公司的程式太可怕了!以至於需求變更來了,會顧不得啥"re-use",以至於後來的code難以維護。

在網路上找到簡單的重構方法:
1.成員變數封裝(Encapsulate Field)
2.方法提取 (Extract Method) — 意思是轉換大型方法的部分變成新方法。透過拆分代碼成比較小點的區塊而促進方法可讀性。這也對函式通用。(作者註:將寫成一大塊的垃圾程式從中抽出一些code,且另外組成一個個小Method)
3.一般化型別 (Generalize Type)
4.函數歸父 (Pull Up) — 或譯函數上移,指的是方法從子類移動到父類。
5.函數歸子 (Push Down) — 或譯函數下移,指的是方法從父類移動到子類。
6.方法更名 (Rename Method) — 對方法變更其名以更好的表達它的用途,好讓後續接手的人好維護。


--後續要去找找有啥書可以研讀~

2010年10月21日 星期四

2010年10月16日 星期六

Hello world in Python


#!/usr/bin/python
# -*- coding: utf-8 -*-
'''
第1行是為了給 Linux 相關的OS當Script所執行用的
第2行是為了告知Python要使用UTF-8的 encoding,
這樣才可以用中文的注解,並記得檔案存成UTF-8
'''

if __name__ == "__main__":
string1 = u"測試"
type1 = type(string1)
length1 = len(string1)
print "(%d-%s)%s"%(length1, type1, string1)

string2 = "測試"
type2 = type(string2)
length2 = len(string2)
print "(%d-%s)%s"%(length2, type2, string2)

2010年10月10日 星期日

安裝Python + Eclipse

1. Download Python for windows:

2. Python language for Eclipse plug-in :

2010年9月15日 星期三

[IBM WebSphere 6.1]SSO+SSL 的疑難問題

1.enable SSL on WebSphere 6.1


http://cdalong.spaces.live.com/?_c11_BlogPart_BlogPart=blogview&_c=BlogPart&partqs=cat%3DIHS
下列是如何設定https:
http://eichelgartenweg2.blogspot.com/2008/11/enable-ssl-https-for-ibm-http-server.html


2.
不過在裝完之後,使用https連結去進行SSO的動作,回傳的畫面竟是一片空白,當場我就傻了!!
看了Log出現下列訊息:



org.ietf.jgss.GSSException, major code: 1, minor code: 0
major string: Channel binding mismatch
minor string: ChannelBinding checksum failed verification



後來查了一個晚上,在SAP系統的討論串有查到解決方案,原來是因為windows更新(KB974455)的關係,

只要在每台client端子機碼(regedit)上設定

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\LSA\SuppressExtendedProtection

設定0x02 or  0x03  就可以解決...

個人覺得蠻麻煩的,但這也是目前唯一可以找到的方法,也許在其他的platform根本不會有這樣的問題!!?


2010年6月9日 星期三

Oracle PL/SQL Note-No.1

1.查看目前有以登入的USER
   SQL>conn /as sysdba
   SQL>show user

2.修改USER密碼
   SQL>alter user ctxsys identified by CTXSYS

3.可查詢有哪些USER
   SQL>select username from dba_users;

4.將USER鎖定/解除鎖定
  SQL>alter user ctxsys account lock;
  SQL>alter user ctxsys account unlock;

5.Oracle的全文檢索同步

(1)先以CTXSYS登入DB
    sqlplus /nolog
    conn ctxsys/ctxsys
    執行 SQL>exec ctx_shedule.sql

(2)在以test登入DB
     SQL>conn test/test
     查 testuser索引名稱
     SQL>select index_name from user_indexes 
                where table_name='testuser' and index_type='DOMAIN'
(3)啟動同步(every 5 mins)
     SQL>exec ctx_schedule.startup('步驟2查到的索引名稱','SYNC','5');
(4)執行優化(every 120 mins)  
      SQL>exec ctx_schedule.startup('步驟2查到的索引名稱','OPTIMIZE FAST','120');

6.執行計畫
    SQL>set autotrace off--->default
    SQL>set autotrace on explain -->shows only optimizer execution path
    SQL>set autotrace on statistics
    SQL>set autotrace on
    SQL>set autotrace traceonly







2009年10月9日 星期五

English Conversation(Basic)

Week1-Conversation Booster
Giving opinions:
As I see it...
From my point of view,....
It seems to me that v.p.....
My position is that v.p......
My own view is that v.p.........

Asking for opinions:
Can you tell me what you think?
Do you have any ideas about this?
What's your position on this?
Where do you stand on this?

Both:
....don't you think?

Agreeing:
Right.
You're absolutely right.

Disagreeing:
Do you think so?
I agree this principle,but...
I agree up to a point,but...
I can see your point,but surely...
I really can't agree with you on that.
I'm afraid I don't see it like that.
Yes, but don't you think that...?
Yes, possibly, but what about...?

Week2-Conversation Booster
Likes:
I'm mad about n.p...
I love n.p...
My favorite kind of art is n.p...
...n.p is my favorite.
I nuts about n.p....
I just love n.p...
I'm crazy about n.p...

Dislikes:
...n.p is not really me.
...n.p is not really my kind of thing.
...n.p doesn't really do anything for me.
I'm not that keen on n.p...
...n.p is not really my cup of tea.
...n.p is not as good as n.p...
...n.p is too (adj) for my taste.

Week3-Conversation Booster
I don't know:
Your guess is as good as mine.
No idea.
It's hard to say.

I'm guessing:
Chances are it's...
I would even go so far as to say that v.p...
If I had to take a guess I'd say that v.p...
It's probably....
Just off the top of my head,...
I'd say that v.p
Maybe.
My guess is that v.p...
We're talking maybe v.p...
Well,knowing n.p,my guess is it's..