免責聲明

Disclaimer (免責聲明)
繼續閱覽代表您接受以上的免責聲明.
To continue reading means you accept the above disclaimer.

2012年12月30日 星期日

Customized ROM for Rooted Kindle Fire

Android 平板 : 安裝了Android 作業系統(Operating System, OS)的
平板電腦(tablet, pad).
大部分新的平板都具備觸控螢幕(touchscreen) ,
所以 mouse click 變成 finger tap ...

原始的android os 由 google 釋出
針對不同的硬體/廠商 (Samsung, Asus, Acer, Amazon, Google...)
及不同的應用(軟體)需求
就有人打包不同的驅動程式(driver) 與 應用程式集(Apps)
稱為客製化的(customized) ROM.

之所以稱ROM 是因為平板的內建磁碟
大部分都是 flash memory, (也就是SSD? solid-state disk)
即使沒有電 資料不會消失 就跟傳統的EEPROM一樣 ...
[其實比較正式的說法是 內部儲存體/裝置(internal storage/ internal storage device)]

所謂的刷機就是把整個 os image file ,  寫到平板的內建磁碟裡?

[Q] ROM, Flash Memory, SSD 的不同?


//=== 
針對 KindleFire,
之前裝了 CyanogenMod 的CM9 ,
CM9是奠基於  android 4.0 ICS (Ice Cream Sandwich).

Android 4.1 JB (Jelly Bean) 出來後就跟著有了 CM10 ,
網路上搜尋之後 莫名其妙 [1] 導到 Hashcode ROM
就試試看吧 ...
下載customROM.zip [2] 之後
另外下載gApps.zip [3] 

之前已經安裝了TWRP Recovery

長按電源鈕讓KFire關機 
重新開機, 畫面出現後 
再按一次電源鈕, 選擇Twrp

Wipe -> Factory Reset
Install -> browse to select the downloaded  customROM.zip and gApps.zip
Wipe Cache/Dalvik

Reboot


[Q] AOSP 是啥?
--> Android Open Source Project [5]

[ref]
0. 
http://blog.the-ebook-reader.com/2012/02/21/kindle-fire-hacking-using-twrp-recovery-to-install-roms-and-backup/

1. http://forum.xda-developers.com/showthread.php?t=1765288
2. http://goo.im/devs/hashcode/otter/aosp/
3. http://goo.im/gapps

4. http://source.android.com/faqs.html 
5. http://source.android.com/faqs.html#what-is-the-android-open-source-project


2012年12月16日 星期日

Ubuntu 12 tips, 如何輸入繁體中文, 如何檢查Ubuntu版本

Ubuntu 12.04.1 LTS

//===
本來不習慣 Unity 界面
發現start button的用處後 還滿好用的
按下鍵盤上winlogo 鍵 就相當於按螢幕左方直條選單最上方的
UbuntuLogo ;
想找應用程式 只要打幾個英文字母下去搜尋即可
e.g Term, Text, lang, ...



//===
System settings(像齒輪的那個icon) -->  language support -->
* install/remove languages ...
* keyboard input method system --> iBus

登出再登入, 螢幕右上方有個小鍵盤/酷音/拼音的圖示

iBus preferences --> select an input method --> chinese -->
預設安裝有 Pinyin, Bopomo, Chewing, ...

[ 安裝ibus-m17n 後會看到許多其他的
sudo apt-get install ibus-m17n
不過似乎簡體字繁體字並存 同音字的選擇頗煩 ... ]

預設的Pinyin 並未支援四聲的輸入 用不習慣 
Bopomo 沒去試 自從聽老有的建議改用漢語拼音後 
bo, po, mo 真的忘了大半...
Chewing 預設的鍵盤似乎是標準的注音鍵盤排列

在 iBus preferences 的選單中無法改變 Chewing的鍵盤排列
必須將 iBus preferences 的 "show language panel " 設為 Always
如此 當切換到Chewing(酷音?) 中文輸入時就會在桌面右下方出現酷音專屬的工具列 --> 按下"設定"的按鈕 --> "鍵盤" --> 鍵盤排列  --> 漢語


ps.
[Q]  如何列出目前所在的Ubuntu  版本?
> lsb_release -a
Distributor ID:    Ubuntu
Description:    Ubuntu 12.04.1 LTS
Release:    12.04
Codename:    precise



或者
System Settings (像齒輪的那個icon) ---> Details(也是像齒輪的那個icon) - -->



[ref]
http://pinyinjoe.com/linux/ubuntu-12-chinese-setup.htm
https://help.ubuntu.com/community/CheckingYourUbuntuVersion

2012年12月11日 星期二

Win8 tip, 從MBR磁碟開機, boot from mbr disk

[Q] 新出的筆電內附的硬碟通常是GPT分割, 所安裝的BIOS 通常也是新的UEFI bios, 這時若從usb插入傳統MBR分割的硬碟, 要如何開機呢?

[try]
0. 啟動UEFI 的bios 相容模式 ...
1. 在boot的選項中加入 usb-hd or usb-zip
2. reboot, 看到開機logo時 隨即按下ESC
此時將出現boot 選單, 切記不要選UEFI 開頭的

ps.
看到開機logo時 按下F2 或 DEL 鍵 是進入bios 設定
與按下ESC 效果不同


//=== Win8 本身也有一些開機的選項
以前的Windows是透過在reboot 適當的時候按下F8 來進入
但在Win8 似乎不靈光 可試試以下的方法

0. 在命令列視窗下
 shutdown /r /o

1. 在登入畫面 shutdown 的選單內
按下 shift+restart

2. "Change PC settings" -->  General-> Advanced startup ...


[ref]
http://blogs.msdn.com/b/b8/archive/2012/05/22/designing-for-pcs-that-boot-faster-than-ever-before.aspx

http://3hitek.blogspot.tw/2012/12/win8-tips-kindlefire.html

USB的接頭

USB 一堆接頭 搞不清楚 試著釐清

接頭 == connector
插頭  == 公頭 == plug == male connector
插座  == 母頭 == socket == receptacle == jack == female connector

USB2.0以下的 接頭至少有八類/累
Standard-A, Standard-B, (4pins : VBus, Ground,  differential pair)
Mini-A, Mini-B, Mini-AB, Micro-A, Micro-B, Micro-AB
(5pins : Standard 4pins + 1 ID pin)


其中 Mini-A, Mini-AB 從2007五月就 deprecated ?

Micro-AB , Mini-AB 都只有母頭
其他的則分別有公頭與母頭的型式 

Micro 是比較新的規範, 尺寸也較小, 新出的平板/手機/數位相機都採用?
Mini-B 則是早期的數位相機/數位相框 
Standard-A : PC
Standard-B : Hub, Printer, Scanner

[Q]  USB OTG cable 與 一般的 USB cable 的不同?
[A] 至少有一邊的接頭是Micro-B 或 Micro-A的公頭? 有五條線?

USB OTG 的特色在於不需要透過電腦 就可以讓2個USB裝置得以直接互連
例如手機或平板的USB port 原本是當作 B-device(peripheral, client)連到PC,
讓PC可以存取平板的'磁碟'資料; 如果手機或平板的USB port 支援OTG,
通常是 Micro-AB receptacle, ...

[ref]
http://en.wikipedia.org/wiki/Universal_Serial_Bus
http://en.wikipedia.org/wiki/Gender_of_connectors_and_fasteners
http://en.wikipedia.org/wiki/Universal_Serial_Bus#Mini_and_Micro_connectors

http://www.2cm.com.tw/technologyshow_content.asp?sn=0701010213

http://en.wikipedia.org/wiki/USB_3.0
http://pinoutsguide.com/Slots/usb_3_0_connector_pinout.shtml


ps.
//===
USB1.0/1.1  --> USB2.0 --> USB3.0
Low speed 1.5Mbps , Full speed 12Mbps --> Hi-Speed 480Mbps --> Super Speed 5Gbps

//=== USB3.0 特色摘要
5Gbps
Full duplex (dual simplex, 收發各一對線)
Power management
No need of polling (NRDY, ERDY)
Stream protocol

//=== USB3.0 connector
為了提升傳輸速率 又要考慮與USB2.0的相容性
也就有了對應的接頭
USB3.0 Standard-A, Standard-B 
(9pins == 4pins for USB2.0 + 4pins for Tx/Rx differential pair + 1pin for signal ground)

USB3.0 Powered-B (11pins == USB3.0 standard 9 pins + 2pins for device power)

USB3.0 Micro-B ?



2012年12月10日 星期一

win8 tips, 導火於kindlefire 的發現

[Q] where is the "old start menu"  for programs?
C:\ProgramData\Microsoft\Windows\Start Menu\Programs

[Q] where is PC settings?
0. C:\ProgramData\Microsoft\Windows\Start Menu\Programs  -> "PC settings" short cut
 -> 傳統的控制台

1. right-side menu -> Gear icon -> bottom "Change PC settings" ->  傳統的控制台 + 其他的選項


//=== 試著在win8  enterprise 上安裝 google usb driver for KindleFire
http://3hitek.blogspot.tw/2012/08/kindle-fire-root-try.html ]
卻出現問題

"Android adb interface ...
the hash for the file is not present on the specified catalog file ... "

google 搜尋發現 問題與 "windows driver signing enforcement" 有關 ...

[Q] How to disable "driver signing" check ?

[try 1]
"Change PC settings"-->  General-> Advanced startup  --> Restart now
[ On the blue screen select Troubleshoot --> Advanced options -->
Startup Settings. Click Restart button ]
After rebooting,  the blue screen with Startup settings will  appear agian.
Choose "Disable driver signature enforcement" by press F7

[try 2] 

run cmd prompt with admin privilege

bcdedit  /set  loadoptions DISABLE_INTEGRITY_CHECKS
bcdedit  /set   testsigning OFF
reboot


[ref]
http://tivadj-tech.blogspot.tw/2012/09/certificate-check-error-when-installing.html

2012年11月27日 星期二

UTF16 code points

UTF-16 , 0x00-0000 -- 0x10-FFFF,  21 bits, 1,112,064 code points
UCS-2,  0x0000 -- 0xFFFF, 比較早的標準,  16 bits


the leading 5 bits(0x00 -- 0x10)  separate UTF-16 into 17 planes


//=== Code points U+0000 to U+D7FF  and  U+E000 to U+FFFF
此範圍又稱為 BMP ( Basic Multi-lingual Plane )
大部分的常用字 均位於此.


//===  Code points U+010000 to U+10FFFF
位於此範圍的 code point 將被編碼成兩個16bit的數字
lead / leading surrogate 與 trail / trailing surrogate

令 cp= code point
lead surrogate= ((cp-0x010000) >>10 )& 0x03FF   + 0xD800 ; //the top 10 bits
trail surrogate= (cp-0x010000)  & 0x03FF  + 0xDC00;  //the lower 10 bits

lead surrogate 範圍 [ 0xD800 , 0xDBFF ]
trail surrogate 範圍 [ 0xDC00, 0xDFFF ]

//=== Code points U+D800 to U+DFFF

not assigned in UTF-16 code space


所以UTF-16 是一種轉換(transform)
將 [ 0x00-0000 ,  0x10-FFFF ] - [ 0xD800 , 0xDFFF ]
對應到
1個16bit 數字(2-byte char, identity transform) 或 兩個 16bit 數字 (4-byte char, surrogate pair transform)

the inverse transform  for UTF-16 encoding
pseudo code snippet

int c= read2bytes();
if(c < 0xD800 || c > 0xDFFF)
 return c;
else {
   int c2= read2bytes();
   //assume c2 is correctly read out
  return  0x010000 +  (c-0xD800) <<10  + (c2- 0xDC00);
}





[ref]
http://en.wikipedia.org/wiki/UTF-16


2012年9月26日 星期三

C 與 PI

PI , π, 3.141592..., 
山巔一寺一壺酒, 爾... 

在C語言裡 如何得到 PI的值? 
如果是用微軟的Visaul Studio (VC) 

  • #include <math.h>
  • 在compiler 的preproecessor 定義中加入  _USE_MATH_DEFINES

//=== adhoc approaches
#ifndef M_PI
#define M_PI 3.14159265358979323846
#endif


const double pi = 22.0 / 7 ;  (不夠準)
const double pi = 355.0 / 113;  (比22/7 好些)
const double pi = acos(-1);
const double pi = 4.0 * atan(1.0);


3.1415926535897932384626433832795028841971693993751058209749445923078164062862089986280348253421170679821480865132823066470938446095505822317253594081284811174502841027019385211055596446229489549303819644288109756659334461284756482337867831652712019091456485669234603486104543266482133936072602491412737245870066063155881748815209209628292540917153643678925903600113305305488204665213841469519415116094330572703657595919530921861173819326117931051185480744623799627495673518857527248912279381830119491...

//=== linux
grep -i pi /usr/include/math.h 

# define M_PI 3.14159265358979323846 /* pi */
# define M_2_SQRTPI 1.12837916709551257390 /* 2/sqrt(pi) */
# define M_PIl 3.1415926535897932384626433832795029L  /* pi */


//=== 精準度(有效位數?)
#include <stdio.h>
#include <float.h>
double 的精準度 DBL_DIG
float 的精準度 FLT_DIG

long double ?



[ref] 




2012年9月11日 星期二

FlashDevelop debug needs jre/bin and msvcr71.dll

//=== 安裝,  http://www.flashdevelop.org/wikidocs/index.php?title=Installation

預備動作
0. 32bit Java JRE1.6  , 必要!
1. Flash Player debug 版, Flash ActiveX Control debug 版 
   http://www.adobe.com/support/flashplayer/downloads.html

2. TortoiseSVN

[note]  
* FD (FlashDevelop)的可攜性頗佳, 其實裝完 FD (FlashDevelop) 之後
再裝以上三者也可以,   不過事後要設定路徑較麻煩 ...

**  必須將 jre/bin 加到使用者的環境 Path 中, FD 才能正常啟動除錯功能


//=== 組態設定,    http://www.flashdevelop.org/wikidocs/index.php?title=Configuration

相關組態檔案存放位置
Win XP:  C:\Document and Settings\<username>\Local Settings\Application Data\FlashDevelop
Win 7/Win8: C:\Users\<username>\AppData\Local\FlashDevelop

per-user 的組態目錄 可以殺掉沒關係 FD重開時會再自動產生 不過客製的(customized) 修改
就不見了


//=== FAQ , http://www.flashdevelop.org/wikidocs/index.php?title=F.A.Q
[Q]  FlashDevelop 能否在  64-bit Windows 執行?

[A] 是的,  但需要32bit Java JRE.



[Q]  cannot load  jvm.dll?
[try]
32bit-os:
copy JRE_BIN\msvcr71.dll to Windows\System32

64bit-os:
copy JRE_BIN\msvcr71.dll to Windows\SysWOW64

[ref] http://www.flashdevelop.org/community/viewtopic.php?f=6&t=8374


//=== Source Code, http://code.google.com/p/flashdevelop/

Compile/Build
* .NET 2.0 framework
*  Visual Studio 2008 or C# Express 2008 
*  "x86" target (Scintilla DLL isn't 64bit compatible)
*  build PluginCore project first, then build solution.

2012年8月12日 星期日

Kindle Fire 的限制

KindleFire
沒有
  • 視訊輸出接頭
  • 藍牙
  • 攝影鏡頭 
  • 麥克風?


KindleFire 的規格上列出
"3.5 mm stereo audio jack, top-mounted stereo speakers"
是否意味著只有audio output(stereo headphone), 沒有 audio input (沒mic輸入) ?
 
網路上有些文章 提到刷機後 可使用iPad 的
4-conductor(TRRS, 3環4段)接頭的耳麥 [ headset == (headphone+mic combo) ]
但並非所有的apps 都可成功
據說Skype 還是無法透過此法傳送語音 ...
 
 
[ref] 
http://liliputing.com/2011/11/add-a-mic-to-the-amazon-kindle-fire-for-just-a-few-dollars.html
http://www.ipadforums.net/ipad-general-discussions/74555-ipad2-audio-jack.html

USB Y cable, USB OTG cable

USB Y cable (Y-cable) : 有三個USB公頭, R ===== C -- P ,
C 透過一粗一細兩條線分別連到另外兩個頭(R, P),  
粗線較長連到R,   細線較短連到P,

R用來連接外部的USB硬碟/光碟
C用來連接電腦 傳送資料及電源
P則用來連接額外輔助的電源  可以插電腦的另一個USB port
或者插在powered USB hub 上 ...



//=== USB OTG (on-the-go)
master/slave [ host/client, host/peripheral ] architecture
dual-role USB controller (host/peripheral switch in case)
A-device : power supplyer
B-device : power consumer
mini plug
micro plug
OTG cable A-end : ID pin grounded
OTG cable B-end : ID pin floating

把OTG cable 的 A端 插入支援OTG的平板電腦或手機
他們就變成USB host , 可以連接外部的USB裝置 如鍵盤/滑鼠/...

把OTG cable 的 B端 插入支援OTG的平板電腦或手機
他們就變成USB client 可以連接電腦 當成儲存裝置/磁碟來用






[ref]
http://answers.yahoo.com/question/index?qid=20100310191304AA0h6vp

http://in.answers.yahoo.com/question/index?qid=20101022134743AAPH2Hi

http://www.youtube.com/watch?v=p10LgZFIawo

http://en.wikipedia.org/wiki/USB_On-The-Go

2012年8月2日 星期四

Kindle Fire Root try

最近拿到一台KindleFire, 不可免俗的要學習刷機(flash ROM),
想要flash ROM 之前 必須先對Kindle Fire 的韌體做修改
讓KindleFire 不受Amazon限制,  能夠連上 Andoid Market/Google Play,
網搜後發現 首先要做的就是
Root - Rooting Kindle Fire, 拿回superUser/admin/root 的權力 ...
[" ... to attain privileged control (known as "root access") within Android's subsystem ..."]

0. 安裝 JDK 32bit 版本, Android SDK, Android NDK

1. 安裝 KFU(Kindle Fire Utility) 0.9.6 或更新的版本
   [可從 xda-developers.com 下載] (有KFU 就無須Android SDK?)

2. 手動安裝 google USB driver for adb [讓電腦的adb 程式能透過 USB 控制 Android device ]
或者直接用KFU的install_drivers.bat

3. 在command prompt 下 adb devices  命令
確認 adb 已經認得 KindleFire

4. KFU -> run.bat

...
twrp.img is missing.
 So we will download it for you!
...


fff.bin is missing.
 So we will download it for you!

...

Installing FFF...
...
Installing TWRP...
...
Setting Recovery Bootmode.





***********************************************
 *               Root Installed                *
 ***********************************************

 Permanent root has been installed.
 With great power, comes great responsibility.

 Please be careful with how you use root.

Press any key to continue . . .





//===

[手動安裝 google adb usb driver]
a. 用KindleFire附的 micro-USB線 連接電腦
Device Manger -> 找到對應的device
right-click -> Properties -> Details -> Property ->  Hardware Ids

Kindle Fire USB hardware Id 應該長的類似
USB\VID_1949&PID_0006&REV_0216&MI_01
USB\VID_1949&PID_0006&MI_01

b. [android-sdk]\extras\google\usb_driver\
編輯 android_winusb.inf 檔案
在 [Google.NTx86] 與 [Google.NTamd64] 兩個區塊下
插入以下3 行
;Kindle Fire
%SingleAdbInterface% = USB_Install, USB\VID_1949&PID_0006
%CompositeAdbInterface% = USB_Install, USB\VID_1949&PID_0006&MI_01


c. 到 C:\Users\UserName\.android\
或者 [androidSdk] 所在磁碟, 譬如說 D:\.android
編輯 adb_usb.ini  檔案
輸入 0x1949

D:\> mklink /D .android C:\Users\Username\.android
或者 
C:\Users\Username>  mklink /D .android D:\.android


d.  更新對應的device  driver (選擇目錄 [android-sdk]\extras\google\usb_driver\ ) ,
就會出現Android Phone -   Adb Composite Interface



[ref]
http://en.wikipedia.org/wiki/Rooting_(Android_OS)

http://blog.the-ebook-reader.com/2012/02/21/kindle-fire-hacking-using-twrp-recovery-to-install-roms-and-backup/

http://liliputing.com/2012/05/how-to-root-a-kindle-fire-with-software-version-6-3-1.html


http://www.jayceooi.com/2011/12/13/how-to-install-kindle-fire-adb-usb-driver/

http://forum.xda-developers.com/showthread.php?t=1568340

http://forum.xda-developers.com/showthread.php?p=26733134

http://stackoverflow.com/questions/8347561/adb-cannot-detect-my-kindle-fire-on-windows-7-but-device-manager-can

2012年7月22日 星期日

如何讓 winXP 接受 rdp connection?

0. computer properties -> Remote settings -> Remote desktop -> Allow remote connections to this compter.

1. terminal service has to be started


//=== 如何加入中文輸入
Control Panel -> Region and Language -> Keyboards and Languages -> Change keyboards ...
-->
General -> Add/Remove Chinese ...
Advanced Key settings -> Change Key Sequence -> Switch Input Language/Switch Keyboard Layout


2012年7月15日 星期日

Remote assistance for Windows 8

在win8 release preview , maintenance\remote-assistance  似乎不見了
要發出assistance/help invitation 可嘗試以下方法:

0. winlogo +r  -> msra
1. cmd prompt -> msra
2. control panel -> view by category -> system and security -> System -> .../Allow remote connection/Launch remote assistance  /...  (按下Launch remote assistance 的連結)

//=== Frequent "commands" following winlogo + r
cmd
notepad
wordpad
control
recent

taskmgr
compmgmt.msc
diskmgmt.msc
services.msc
virtmgmt.msc
msra



bcdedit usage example

//=== bcdedit needs admin privilege (elevated command prompt )
[Q] how to show os GUID ?

bcdedit /enum /v



[Q] how to change display order?

bcdedit /displayorder {ID1} {ID2} ...
bcdedit /displayorder {1d6487bd-bd89-xxxx-xxxx-xxxxxxxxcf5}  {1d6487c3-bd89-xxxx-xxxx-xxxxc9b23cf5} {9fb33f5f-c8c5-xxxx-xxxx-xxxxc5bb53c5}


[Q] how to an entry  to Windows Boot Manager Screen?

bcdedit /copy {1d6487c3-bd89-xxxx-xxxx-94dbc9b23cf5} /d "Win8 Without HyperV"

use "bcdedit /enum /v " to check the just created bcd entry's GUID

bcdedit /set {9fb33f5f-c8c5-xxxx-xxxx-d162c5bb53c5} hypervisorlaunchtype  off




[Q] how to set the default os?

bcdedit /default {1d6487c3-bd89-xxxx-xxxx-94dbc9b23cf5}
bcdedit /default {current}
bcdedit /set {default} hypervisorlaunchtype  off



2012年7月12日 星期四

Windows 8 試用

Windows8 Release Preview == win8

0. 新的 Start Menu , 又稱  Start Screen  個人覺得可以叫 Start Mosaic .
1. PC settings  等同 Control Panel

2. turn on Client Hyper-V feature (win8 rp 內建了非server版的HyperV, 稱為 Client HyperV)
  a. Control Panel -> Programs -> Programs and Features.
  b. Click Turn Windows features on or off.
  c. Click Hyper-V -> OK
  d. virtmgmt.msc
  e. virtual switch (虛擬網卡binding 實體網卡)
3. 以admin 權限開啟cmd prompt ,取消hibernate
c:\> powercfg /hibernate off

4. 取消 發生錯誤時自動重開機 的設定
Computer-> System Properties -> Advanced -> Startup and Recovery
-> settings -> system failure -> unchk Automatically restart

5.  win8 開機失敗時, 重開機 -> F8 -> Enable low-resolution video(F3)

6. 學習使用基本的bcdedit

7. add dangerous sites to IE's restricted sites

8. shortcuts to  Windows Update / Windows defender



2012年7月5日 星期四

rdp 無法使用winlogo flag key

以 rdp 連接 win8 時, winlogo 快捷鍵 無法作用 ,
想存取舊的Start Menu 或者開啟 cmd console/notepad/wordpad/ ...
就只好拉捷徑(dragging/send to desktop   to create shortcut)


C:\Users\username\AppData\Roaming\Microsoft\Windows\Start Menu\Programs
C:\Users\username\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\System Tools
C:\ProgramData\Microsoft\Windows\Start Menu\Programs
C:\ProgramData\Microsoft\Windows\Start Menu\Programs\System Tools
C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Accessories

System Tools 目錄下有cmd console, control panel, run, ...
Accessories 目錄下有 rdp, notepad, ...

產生shortcut 後 , right-click on shortcut (在shortcut 上 按滑鼠右鍵)
-> pin to start , 在新的start screen 右側就會加入對應的icon
-> pin to taskbar, ...



聯想到 shortcut/.lnk file/shell link, symbolic link 有何差異?
.lnk 檔案格式乃Windows 自己訂的 ...


[ref]
http://msdn.microsoft.com/en-us/library/windows/desktop/bb776891(v=vs.85).aspx#Shellink_Link_Files

2012年7月1日 星期日

Windows logo 快捷鍵 for Windows-8

最近趕流行 試用Windows 8 Release Preview
[developer preview -> consumer preview -> release preview ?]

因為metro style 移除了舊的Start Button/Start Menu
被迫重新發現了 Windows logo 快捷鍵
[大部分的鍵盤上有個微軟Windows Logo 的按鍵, 又稱Windows key, flag key, start key ...]
在此簡稱 winlogo;

winlogo  + r : run [執行/搜尋應用程式]
winlogo + e : explorer  [開啟 file explorer]


winlogo  + r ,  notepad
winlogo  + r ,  cmd
winlogo  + r ,  taskmgr
winlogo  + r ,  control   [開啟 control panel]
winlogo  + r , diskmgmt
...

有網路文章說
winlogo  + r ,  cmd , 按下ctl+shift+enter 可用 admin 權限開啟
命令列視窗(command line console) , 但我沒試成功 ...


win8 release preview
Product Key:TK8TP-9JN6P-7X7WW-RFFTV-B7QPF

[ref]
http://windows.microsoft.com/en-us/windows-8/faq
http://windows.microsoft.com/en-US/windows-8/iso
http://en.wikipedia.org/wiki/Windows_key

2012年6月21日 星期四

Javascript console for Chrome

[Q]  如何在 chrome 下 顯示 window.console.log 的 debug除錯資訊?
[Q]  How to show the debug info written out by window.console.log() ?
[Q]  Where to see the output of jeash.Lib.trace() when using haxenme/flashdevelop targeting html5?


[try]
* Chrome
Tools icon -> Tools -> JavaScript console

* Firefox

* IE


//===
[Q]  How to change the invoked browser to Chrome  instead of IE when using FlashDevelop to debug projects?


[try]

2012年5月29日 星期二

Neko/nme trial

//=== start the haxeserver.bat file that is in the Haxe installation directory.
nekotools server -p 2000 -h localhost -d  C:\WebRoot/
nekotools server -p 2000 -h localhost -d  C:\WebRoot/ -rewrite

//=== Index.hx --> index.n
haxe neko.hxml
move index.n to C:\WebRoot\

//=== try to connect the following url
http://localhost:2000/server:config
http://localhost:2000/?x=33;v=hello
http://localhost:2000/user

//=== dispatch
http://localhost:2000/user 
need doUser() function
need -rewrite when starting neko web server
(i.e. nekotools server -p 2000 -h localhost -d  C:\WebRoot/ -rewrite )
In case the corresponding method doXXXX is not found on the api object, or if the URL is /, the action doDefault is used instead. An exception DispatchError.DENotFound("XXXX") is thrown if there is no default action (XXXX here being the placeholder for the URL part name).




//===
haxelib install nme
2012.05.29 --> nme 3.3.2
partially solved the problem for http://localhost:2000/?x=33;v=hello

[Q] relation between neko and nme?


[ref]
http://haxe.org/doc/start/neko
http://www.haxenme.org/documentation/setup/
http://www.haxenme.org/download
http://haxe.org/manual/dispatch
http://nekovm.org/doc/begin



//=== neko webserver error : Invalid_char
Called from tools/Tools.nml line 40
Called from core/Args.nml line 43
Called from core/Args.nml line 50
Called from tools/Tools.nml line 31
Called from core/Net.nml line 96
Called from core/Array.nml line 100
Called from core/Net.nml line 102
Called from tools/WebServer.nml line 58
Called from tools/WebServer.nml line 58
Called from tools/WebServer.nml line 53
Called from tools/WebServer.nml line 17
Called from core/Lexer.nml line 219
Called from tools/WebServer.nml line 10
Called from core/Core.nml line 197
Exception : Invalid_char

2012年5月23日 星期三

如何讓 chrome 可以從本機網頁 連載 internet的網頁?

[Q] 如何讓 chrome 可以從本機網頁 連載 internet的網頁?
[Q] How to allow chrome to load internet url from local html files?

[try]
0.  chrome.exe --disable-web-security
--disable-web-security 參數將讓chrome 允許所有的 cross-domain requests?
似乎相當危險 ;
1.  為了網頁測試方便 有時還是需要 --disable-web-security ,
建議side-by-side安裝另一個版本的chrome : Chrome Canary ;

2. 然後在桌面上產生一個指到 "chromeCanary  --disable-web-security"的捷徑,
固定用此捷徑來開啟測試網頁, 就不會影響到原來chrome的安全設定了.

[ref]
http://stackoverflow.com/questions/4819060/allow-google-chrome-to-use-xmlhttprequest-to-load-a-url-from-a-local-file

http://groups.google.com/a/chromium.org/group/chromium-dev/browse_thread/thread/bf71d02dae94eb88

http://www.ehow.com/how_7208987_add-line-parameter-windows-shortcut.html

2012年4月19日 星期四

如何避免chrome 自動重導向到當地的google?

[Q]  如何避免chrome 自動重導向到當地的google?
在chrome 網址列輸入 http://www.google.com/ 會 自動重導向到 http://www.google.com.tw/
chrome根據 IP  判斷所在地區 ...
[try]  在chrome 網址列輸入 www.google.com/ncr


[ref]
http://support.google.com/websearch/bin/answer.py?hl=en&answer=873

2012年3月11日 星期日

html Form , text image alignment

[Q] How to place an image submit button for html form?
[Q] How to place a text label in html form?
[Q] How to make text vertically align with image at a proper position by CSS style?

[Q] 如何讓html form 的submit button 是一個圖形?
[Q] 如何在html form 裡放入label 描述的文字?
[Q] 如何用CSS 讓文字與圖形在垂直方向適當對齊?


[example]

http://pdfnote.blogspot.com/2012/03/demopdfviewer-download.html


<form action="url address" method="get" >
   <label for="pdf">Download demoPdfViewer for .NET</label>
  <input type="image" src="imag url address" height="60" width="60" border="0" alt="submit"    style="vertical-align: middle" />
</form>




[ref]
http://www.webdevelopersnotes.com/tips/html/using_an_image_as_a_submit_button.php3
http://www.w3schools.com/tags/tag_label.asp
http://www.loriswebs.com/html-tips/verticallyalignimages.html


2012年2月23日 星期四

Chrome cookie/javascript settings

Tools(像板手/spanner/wrench 的那個圖案) -> Options
-> Under the hood -> Privacy -> Content settings
-> Cookies/Javascript -> Manage exceptions -> ...

先設定
 Block sites from setting any data
 Do not allow any site to run JavaScript

再允許例外
如果要讓網域 google.com 的網頁都可以用cookie/javascript
要輸入 [*.]google.com
而非 google.com

[ref]
http://support.google.com/chrome/bin/answer.py?...

CSS negative margin magic


過去在閱讀 CSS 檔案時 遇到 margin 為負值的情況
不求甚解 一直沒弄清箇中奧妙 ...
最近想自己湊個版型(theme template)
發覺負的margin 扮演關鍵角色!

尤其在 table-less CSS 的限制下
想把區塊擺置到適當的位置
似乎非 '負的margin' (negative margin) 不可

主要參考 css negative margins algebra
寫了以下簡化的 3-column layout css
不過我是先擺 left div , 而非先放 center div
"left_col"
Content for id "center_col" deliberately longer text
"right_col"

#container {
    width: 480px;
    background: #00cc00;
    margin: 0 auto;
    padding: 0px;
    overflow: hidden;
    border: 2px solid #00ff00;
    position: relative;

}

#left_col {
    width: 30%;
    background: #cc0000;
    margin-left: 0px;
   border: 2px solid #f00;
   float: left;  
}

#center_col {
    width: 35%;
    background: #00c100;
    margin-right:-66%;
       margin-left: 1%;    
   border: 2px solid #0f0;
   float: left;

}

#right_col {
    width: 30%;
    background: #0000cc;  
    padding-left: 10px;
   border: 2px solid #00f;
float:right;
}
//======



//=== 參考文章中 共同提到的關鍵詞
position: relative; ( for IE )
faux column (for unequal column heights)
...


[ref]
http://www.severnsolutions.co.uk/twblog/archive/2004/07/01/cssnegativemarginsalgebra
(用數學式子表達 個人覺得比較清楚)


http://www.alistapart.com/articles/negativemargins
http://coding.smashingmagazine.com/2009/07/27/the-definitive-guide-to-using-negative-margins/
http://www.communitymx.com/content/article.cfm?cid=b0029




2012年2月7日 星期二

如何離線安裝java?

[Q] How to offline install java (jre, java runtime environment)?

[ref] http://www.java.com/en/download/help/windows_offline_download.xml

在下載的頁面中, 選擇離線(Offline)的版本 
通常比online版本大, Java6 (jre-6u30-windows-i586-s.exe) 約 17MBytes



Notes:
[ref] http://www.java.com/en/download/help/index.xml

名稱及版本的混淆:

jre1.6 -> jre6.0 -> Java 6
jre1.5 -> Java2SE5 -> Java 5


[ref] http://www.java.com/en/download/faq/java_win64bit.xml
"... Note that because some web content may not work properly in a 64-bit browser, we recommend using the default 32-bit browser and downloading 32-bit Java. ..."

i.e.
* 最好用 32-bit java
* 64-bit 瀏覽器需要 64-bit java ?


p.s.
java.com 與 oracle.com 的關係 : java 本為 Sun 開發出來的語言/軟體 ,  Oracle 買下了 Sun

2012年1月29日 星期日

How to remove expired domains from Godaddy.com

[Q]  如何移除godaddy.com中 到期/過期的網域(expired domains )?

[sol] 登入後 點選 'My Account'
選擇到期/過期的domains
按下delete(就是像'禁止進入'的那個圖案)

//===
[Q] 如何取消網域自動續租(auto-renew)?

[sol]
仔細尋找 account summary 中的 'Manage auto-renew'
讓auto-renew 變成 off



//===
[建議]
取消網域的 自動續租功能.
(特別是那些頭一年2塊美金 特價買來學習試用的網域)
確定不會再用到的網域 最好刪除.

免得像某家雲端服務的'免費'試用帳戶
超過試用quota時 沒有事先通知
就直接從信用卡扣錢 ...

2012年1月21日 星期六

Linux-like 檔案權限

在安裝 drupal 的過程中
需要將 sites/default/目錄下的
預設組態檔 default.settings.php
複製成 settings.php
在隨後的安裝過程中 將新增/更改的設定值寫入 settings.php

因為一般drupal的安裝是透過瀏覽器連入http伺服器
執行php script , 此時執行者的身分一般並非
sites/default的使用者帳戶 , 而是www 或 apache ...
所以就有權限上的問題

此時須先放寬sites/default, sites/default/settings.php的權限,
等到安裝完成再改回來 :

//=== 安裝前
chmod a+w sites/default
chmod a+w sites/default/settings.php

//=== 安裝後
chmod go-w sites/default/settings.php
chmod go-w sites/default


//=== linux-like 的檔案權限
rwx 對應 3-bit
rwx=100 = 3 -> read only
rwx=110 = 6 -> read + write
rwx=111 = 7 -> read + write+ execute

那 ago, +, - 又表示什麼呢?
u: user (owner) 檔案或目錄的使用者(擁有者)
g: group
o: other
a: all = ugo

+ : 增加某些權限
- : 移除某些權限

[ref]
http://en.wikipedia.org/wiki/Chmod
http://en.wikipedia.org/wiki/Filesystem_permissions
http://www.drupal.org/