Category: Programming

Assembler encoding test : 16-Bit Addressing Forms with the ModR/M Byte

Code to test “16-Bit Addressing Forms with the ModR/M Byte” // String instruction = “adc byte [ si+0x12], 0x1+0x20x3″; // String instruction = “adc byte [bx+si], 0x1+0x20x3″; // String instruction = “adc byte [bx+di], 0x1+0x20x3″; // String instruction = “adc byte [bp+di], 0x1+0x20x3″; // String instruction = “adc byte [si], 0x1+0x20x3″; // String instruction =…
Read more

2019/01/05 0

Same instruction, two opcode encodings

IA32 instruction “adc al,0x7” has two different opcode encodings. /Users/peter>ndisasm a00000000  80D007            adc al,0x7 /Users/peter>cat a.asmbits 16adc al,0x7 /Users/peter>ndisasm a00000000  1407              adc al,0x7

2019/01/05 0

A workable IIS module to log session to file

2019/01/03 0

Solved – The root cause why Netbeans can’t print colored text using latest Maven

Netbeans has bundled an old Maven, version 3.3.9, it can’t print out colored text to the output window. But when we switch to latest Maven 3.6.0, all color gone. I asked Netbeans guys, maven guys and jansi guys for help, but can’t get a solution. So i try to hack the maven code, i found…
Read more

2018/12/30 0

Netbeans manually change color to green

Even the jansi library that built-in to maven 3.5.0 or above doesn’t work with netbeans, so we can’t output colored-text in Netbeans output window. But the “BUILD SUCCESS” word still in green. The reason is netbeans manually change the color to green.

2018/12/29 0

Re-think query language – Linq

Think to develop a new query language for SharePoint to increase my dev speed, studying Linq.

2018/12/24 0

SVG學習 – Viewport會自動有offset-x

如果SVG的大小比例和viewport不同,就會自動有一個offset x

2018/12/24 0

終於publish左第一個reactjs+typescript的UI component上npmjs

Publish當中最唔明就係點解要自己寫tsconfig同gulp人手張typescript同scss去transpile,呢一點同java好唔同,jar就係jar,唔會理你係邊到行,但nodejs個世界唔同,production同dev版本分別好大。你自己用npx create-react-app去創建新project,的確可以係local行,但就publish唔到上npmjs成功俾人用(可能係typescript同scss太煩)。而家個我個package可以同時俾reactjs同sharepoint spfx去用,可以build UI component library了。

2018/12/24 0

Easy easy to extend c# class

Love this book, a very easy way call “extension methods” can let you easily inject new method to existing classes (even you don’t have its source code). I tested it in windows with .net framework and mac .net core, both work correctly.

2018/12/16 0

Proved can call class in GAC

Nothing special, it works. SharePoint Master page doesn’t have a code behind, we can use this skill to add it in GAC.

2018/12/02 0


SharePoint 2016爆到連啲default column type都死埋,SharePoint真係少啲經驗都必炒無疑

2018/12/01 0

[Real] Typescript has no type

If i pass an integer to the function’s parameter “from”, it will become integer and say it doesn’t has “includes” function, since it is belong to class string. This code is tested in SharePoint online with reactjs and typescript.   Below is my tsconfig.json  

2018/11/23 0

Office 365 outlook有webhook

Office 365 outlook有webhook,以後要sync email去SharePoint又唔想用Microsoft Flow嘅話可以唔洗寫Polling了

2018/11/15 0

Microsoft嘅SharePoint Online係會disable上左production嘅feature

Microsoft嘅SharePoint Online原來個feature就算上左production都會因為有問題而中途被disable返

2018/11/10 0

Unexplainable : Typescript compiler has bug

Unexplainable : Typescript compiler has bug, if i add anything above {this.toDoList}, a html tag or just a string, the variable become nothing, nothing is shown on the screen. I am not sure it is reactjs bug or typescript bug, or may be chrome bug. I am using latest spfx 1.7.0 with SharePoint Online for…
Read more

2018/11/09 0

Solved : central admin new web application button is disabled

When you login to central admin and found out your “new web application” button is disabled. Just run SharePoint configuration Wizard, logout and login admin your windows. Everything will be fine. !!! If still failed, try to login to windows via non-administrator account. Then start central admin by “run as administrator”

2018/11/01 0

Simplest c# sample to call azure storage api

Finally called the azure storage api, stucked for one hour in library. There is a / in + “/{0}/\ncomp:list”, Account); Remember two things:1. If you are calling to azure management api, you need a cert. Read and If you are calling azure storage api, you just need a key, no cert if needed.

2018/10/27 1

Excel Addins行得比Outlook前

Excel Addins行得比Outlook前, 雖然而家大家都係NodeJS+React, 但係Outlook到而家連Attach debugger都, 要告靠print段估

2018/10/23 0

dotnet core will produce two exe

dotnet core will produce two exe if you make it self contained. One in win-x64\ and one in win-x64\publish\ . The different between it is referencing two different coreclr.dll. See the arrow in the below image.

2018/09/22 0

Command to tail SharePoint Log

If in SharePoint 2013, change your path to C:\Program files\Common Files\Microsoft Shared\Web Server Extensions\13\logs\

2018/09/20 0


咪記唔將成套.net搞到portable其中一個原因可能係CLR係用com server寫,com一引用DLL根本係好難移值

2018/09/19 0

Useful AD command about AD user

get user properties get-aduser -filter {name -eq ‘administrator’} -property * get-aduser -filter {name -eq ‘administrator’} -property *|select mobile,city

2018/09/15 0

Cityu AppsLab – Assembly programming course lesson 2

Powerpoint : Lesson 1 : assembly-programming Lesson 2 : assembly-programming Lesson 2

2018/09/01 0

Free Assembly programming training in Cityu AppsLab

Thanks for Professor Ray from AppsLab holding this meaningful training for public about assembly language programming training, bringing system level programming experience to all joiners. Register links are and If you are interest to build a toolchain from the ground up, join us at or contact me at Course Materials: asm_example nasm hello.asm -l…
Read more

2018/08/18 0

.net core CLR ELF analyst in Ubuntu 16.04

Analyst the ELF files build from .net core CLR in Ubuntu 16.04 by

2018/08/12 0

Manually create sharepoint configuration database

1. you have to run sharepoint shell using administrator 2. when credential dialog popup, you have to input the user name as machine_name\administrator 3. when hitting error, you must close the shell and restart it, otherwise whatever you do, last error message still happen Tips: 1. if you hit “Requested registry access is not allowed”,…
Read more

2018/08/03 0

Powershell學習之旅 – Object Type

Powershell是一種typed的語言,和其它同種的語言比,它有一個我認為比較特別的地方,就是它支援不同的Object typ。Windows世界裏幾個大的Object家族它都支持: Common Object Model (COM) .Net Windows Management Instrumentation (WMI), 它是Management Object Format格式 ActiveX Data Objects Active Directory Services Interface (ADSI) XML Powershell是用adaptor的方式去和不同格式的object聯絡,此Topic沒有太多人有興趣所以書中並沒有提及。  

2018/08/01 0

Misleading information from Microsoft Docs

I just deployed my outlook addin to office 365 admin center, information from the below page is misleading.  

2018/07/06 0

[solved] WordPress excerpt function can’t break chinese text vi ./wp-content/themes/one-page-express/functions.php

2018/07/04 0


「打水程式」的電腦簽賭程式,利用兩個網站間對同一場比賽的不同賠率,自動找出同時押注兩隊均可獲利的比賽,從中賺取差價,獲利率幾乎百分之百。利用不同簽賭網站對同一場比賽訂定的賠率不同,從中賺取差價,早在國外及大陸地區風行多年,並有簽賭集團專門藉此牟利。早期均是靠人力坐在電腦前分析各個簽賭網站的賠率,稱之為「打水」,負責分析者稱為「打水員」,後來則演進為以電腦程式自動在簽賭網站之間找出可獲利的比賽,稱為「打水程式」。 舉例來說,一場A隊對上B隊的比賽,甲站對A隊開出賠率1:1,對B隊開出賠率1:0.9;乙站對A隊開出賠率1:0.8,對B隊賠率1:1.1。如同時下注甲站A隊10000元,乙站B隊9500元,比賽結束後,如A隊獲勝,甲站可贏10000元,乙站輸9500元,可獲利500元;若B隊獲勝,則甲站輸10000元,乙站可贏10450元,仍獲利450元。 弱盤打水:高勝率、高風險、高報酬 打弱盤才是近年打水的主流,目前台灣的球公司普遍都是這種打法,一般沒接觸打水的玩家很難將打弱盤和打水畫上等號,其實許多人在說的「假球理論」、「十賭九輸理論」、「明燈理論」,都是指向「弱盤理論」。打弱盤並不是打雙邊,而是只打單邊,就是永遠站在人少的那一邊;就單一場比賽來看打弱盤是打單邊,然而將整個投注模式放大後,打弱盤即是囊括了所有不公平盤底下得利的那一邊,「假球理論」指的是熱門投注球隊故意放水坑殺散戶,「十賭九輸理論」指的是注碼多的一方會輸球,「明燈理論」指的是賭桌上投注最多的那個賭客通常是其他賭客的明燈,跟他反向投注就會贏錢。 用比較科學點的角度來看,A隊在初始的平衡盤口讓B隊1分,但因為A隊是投注熱門,經過大量投注後變成讓B隊1.5分,此時買B隊等於比平衡盤多了0.5分的受讓,那勝率自然會拉高,所以打弱盤在理論基礎上並沒有什麼太大的缺陷,若能做到場場投注弱盤,也就是永遠站在55%以上勝率的那一方,那將時間軸拉長後確實是穩賺不賠的生意。 當然就短時間內來看,打弱盤的風險一定是所有水單中最大的,單邊投注就會佔到輸贏,而不是真的只賺水錢或分洞,但時間拉長後和別的水單並無二致,只是打弱盤會有更高的勝率,和折損更少的賠率損失,只要資金夠充裕可以承受一時的勝負擺盪,打弱盤無疑是報酬最好的打水方式。 什麼是足球打水?對於初次接觸的朋友可能會感到很陌生,足球打水本質上是利用了平台與平台之間的對賭,自己從中賺取利潤。比如意甲比賽我們在A平台上下注AC米蘭獲勝,在B平台上下注尤文圖斯獲勝,這樣不管最終是尤文圖斯贏,還是AC米蘭贏,我都能買中。因為賠率的關係,除去下注的金額,我們還能有盈利,這個過程我們就稱為足球打水。足球打水為什麼能夠獲利呢?這裡面有一個很關鍵的因素——賠率,上一段中也有提到。賠率是菠菜平台經過嚴密計算綜合得出的,這就跟保險公司確定保險範圍和收費一個道理。一般情況下,一場比賽,根據兩隊交戰歷史紀錄,兩隊最近狀態,主客場勝率等,會確立3個賠率。我們先來簡單了解下賠率,後面我們在說打水套利的公式是怎樣的。 賠率計算公式:a÷b=c cc×10%=d 這裡面d就是最終計算出來的賠率 a是基數,值為100 b是莊家分析師分析出來的百分比概率 c是a / b的結果 舉個例子: 世界杯中巴西與阿根廷的比賽,莊家通過分析得出巴西勝出的概率為40%左右。那麼就用這個公式來計算如下: 第一步100÷40=2.5 第二步2.5-2.5×10%=2.25 那麼,莊家開出巴西的賠率會在2.25左右。 如莊家通過分析得出打平的概率為31%左右,那麼就用這個公式來計算如下: 第一步100÷31=3.22 第二步3.22-3.22×10%=3 那麼,莊家就會開出平局的賠率會在2.89左右。阿根廷獲勝的賠率也可以按照相同的方法計算出。 上面就是賠率的簡單計算過程中,不過賠率並不是固定不變的,Bet公司會根據球隊的狀態已經下注的情況,動態調整比賽賠率,因為賠率有了動態的變動,我們才有足球打水的機會。那麼足球打水套路公式是怎樣的呢? 計算方法:上盤,假設回水1%,下注2000,水位1.00,輸贏都是2000。下盤,假設回水1%,下注2020,水位0.98,如果下盤贏就賺2020*0.98,2020*0.98 + (2000+2020)*1% – 2000=19.8,賺19.8塊;如果下盤輸,2000+ (2000+2010)*1% -2020=19.8,一樣賺19.8塊。 足球打水之所以能夠盈利,就是因為不同Bet平台有賠率變動的時間差,抓住這些時間差,我們足球打水就能夠獲利。

2018/06/18 0


發現左一個可以玩殘你嘅咪記大bug,如果你寫sharepoint兼用typescript但係又想用jquery, 你好可能會用: import * as $ from ‘jquery’; 如果嗰畫面得一個webpart,甘你會無事,如果有多個webpart(見下圖),你reload幾次就會撞到有一次某幾個webpart無哂野,因為jquery撞左,網上有啲友話係config.json個externals加返jquery呢一招我試過唔得。但我撞到有一招係work嘅:

2018/06/18 0

Simplest websocket with nodejs example

1. express –view=ejs myspp 2. var server = http.createServer(app); 3. Source : myapp

2018/06/14 0


插一百萬行record, Redis比H2慢太多,H2只需要七秒,redis用了40秒,為什麼用c++寫出來的redis會比用java寫出來的h2慢這麼多的? NoSQL不是比傳統database爽快的嗎?

2018/06/12 0

Solved: vscode [tslint] ‘ should be ” (quotemark)

To solve “[tslint] ‘ should be ” (quotemark)” when developing spfx webpart using visual studio code, do these: open config/tslint.json add {     “$schema”: “”,     // Display errors as warnings     “displayAsWarning”: false,     // The TSLint task may have been configured with several custom lint rules     // before this config file is read (for example lint rules…
Read more

2018/06/10 0