Curl – HttpPost Example

Categories: Development Notes June 13th, 2015 0:34

Http Post without Parameter

$ curl -X POST -H ‘Content-Length: 0′

Set content-Lenght=0 to avoid HTTP ERROR 411 – ‘Length required’


Http Post with Parameters

curl  –data “userId=user-id”

Android: Cloud Messaging Hello world using GCM, AWS SNS and Parse

Categories: AndroidDevelopment NotesJava May 24th, 2015 23:12

Quick start using GCM

0. Create your project via “Google developers console”;

1. Prepare Client App:

  – Get device registration ID

– Receive message from GCM


2. Send Message to GCM server

– Send(Post) message to GCM server

3. Start your app(#1), then send message ( #2)


Push message via AWS SNS to Android devices

Login to AWS console

1. Create new application with your GCM API key

2. ‘Create platform endpoint’ using your device registration ID;

3. Select your device and ‘Publish to endpoint’ to publish a message

4. Check your device;


Push Message via Parse Push

Need to modify the client app and then push message from Parse console;

Jenkins: How to build bitbucket private project

Categories: Development Notes May 16th, 2015 12:10

Config your build server

0. su – jenkins  // no need for Windows

1. Generate RSA key:  ssh-keygen

2. Add public key to your bitbucket profile

for 1 and 2, You may follow this instruction:

3. [Optional] try to do a git clone, make sure you can clone your project


Config your jenkins:

1. Install git plugin for you jenkins

2. config your jenkins job to use git repo: e.g.



Failed to connect to repository : Command “git -c core.askpass=true ls-remote -h HEAD” returned status code 128:
stderr: Host key verification failed.
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

You may add to your know_host by executing:

git ls-remote
Are you sure you want to continue connecting (yes/no)? yes

PyQt ProgressBar: Update progress from other threads

Categories: Python May 14th, 2015 23:40

Issue 1: UI is no responding when the progress is running

Create new thread to perform the progress:

Issue 2: QThread: Destroyed while thread is still running

Try to keep a reference:

Issue 3: QWidget::repaint: Recursive repaint detected

Use single to update progress:


Example: UploadThread:

class UploadTaskQtThread(QtCore.QThread):
    tick = QtCore.pyqtSignal(int, name="upload_changed")

    def __init__(self, client, local_path, remote_path):
        self.client = client
        self.local_path = local_path
        self.remote_path = remote_path
    def on_progress(self, progress):
        self.tick.emit(progress * 100)
    def run(self):
        self.client.upload_file(self.local_path, self.remote_path, self.on_progress)


    def upload(self, local_file_path, remote_path):
        self.upload_thread = UploadTaskQtThread(client, local_file_path, remote_path)

MacBook: How to replace hard drive and restore OS X from internet 苹果笔记本电脑更换硬盘并从网络安装系统

Categories: 分享 March 21st, 2015 12:47

Requirement: The hard drive not working and you want to replace the hard drive and restore OS X from internet. 
需求: 替换硬盘并从网络安装系统

Replace Hard Drive 更换硬盘

What you need 需要工具:

Screwdriver #00 and T6   螺丝刀 #00  & T6

Details Steps 详细步骤:


OS X Internet Recovery 网络恢复系统

To start your computer from Recovery, restart your Mac and hold down the Command and R keys at startup.

开机时按 Command + R 以开始系统恢复。

Reinstalling OS X using Recovery requires broadband access to the Internet using a Wi-Fi or Ethernet connection.

OS X is downloaded over the Internet from Apple when OS X Recovery is used for reinstallation. You must use DHCP on your Wi-Fi or Ethernet network to reinstall OS X using OS X Recovery.

If you bought OS X from the Mac App Store, you may be prompted to enter the Apple ID and password you used to purchase OS X.

After got internet access, set up the new system following the wizards, it may take hours  to download and restore the OS.
获得网络连接后, 根据提示配置系统,整个下载及恢复过程可能会持续几个小时。 

More details:

Older Posts

Popular Tags



// Proudly powered by Apache, PHP, MySQL, WordPress, Bootstrap, etc,.