Posts

Use readline library to built command line tools

Image
Use readline library to built command line tools Table of Contents 1 Why readline library? 2 How to use it? 1 Why readline library? As a Linux programmer, I always need to write some command line tools, with the help of GNU Readline library , this mission can be a snap. So what's the readline library gives for us, according to its official document? It provides a set of functions which allow users to edit command lines as they typed in. What's more, it also supports history recording and auto-completion. It is GNU software and is distributed under the terms of GPL license. 2 How to use it? I upload my source code, using the readline library, which implemented a silly command line tools with only two command inside – help and quit, but I can add another command easily in its framework. It support history recoding, which means you can browser the your command history by up/down keys, but it still cann't support command auto-completion(I will ad...

How Bluetooth LE works? -- Link Layer

Image
How Bluetooth LE works? - Link layer Table of Contents 1 Bluetooth LE system architecture 2 Bluetooth LE Physical layer 3 Bluetooth LE Link Layer states 4 Bluetooth LE Link Layer packets 1 Bluetooth LE system architecture This is the first post and hopefully a series of upcoming postings about Bluetooth Low Energy. Above figure is the protocol stack of a whole Bluetooth LE system. The Bluetooth LE is one part of Bluetooth v4.0 specification, it was designed not to pursue high transmission speed but for lower energy consumption. So the Bluetooth LE products can be powered by a button-cell battery for years. How did it do that? This article is a review of Robin Heydon's excellent book – Bluetooth Low Energy, the developer's handbook. Bluetooth LE is completely redesigned of classic Bluetooth protocol, It seems that both the Bluetooth LE and classic Bluetooth has the same architecture from above figure, but actually they are so different inside, an...

tts-mode for emacs update - support Mac OS X's tts engine

Image
tts-mode for emacs update - support Mac OS X's tts engine Table of Contents 1 Support Mac OS X's default tts engine 2 Configure and Install tts-mode 1 Support Mac OS X's default tts engine After I owned an Macbook air, I tried to port tts-mode into OS X system. I installed espeak command line tool into OS X, it works well just like in linux system. Thanks to the excellent portability of elisp source code, I need not to change any source code. I still have not installed festival tts engine into Mac OS, but it seems have many tutorials to do it. After that I found OS X's default tts engine, which provide an command line interface, has much clearer and greater fluency than both espeak and festival. So I wonder if I can support OS X's default tts engine. Then here it is, the new tts-mode . 2 Configure and Install tts-mode Reference the following codes: (add-to-list 'load-path "path/to/tts-mode" ) ;; configure tts engine...

Which storage cloud to choose?

Image
Dropbox, Box, Google driver, Ubuntu one or icloud ? Table of Contents 1 Storage in cloud products 2 My working environment 3 How Storage cloud improved my life? 4 Which product I like the most? 1 Storage in cloud products Now I wanna too share some good storage cloud products that I used in my daily work. A good storage cloud tool can offer you so much convenient in daily life and increase your productivity and efficiency at work. Here is my own experience with some cloud products. So, What is the storage cloud products? It is a services that can store your data into cloud and can share it everywhere. Here is the storage cloud services that I already used. free size OS compatibility GFW compatibility Dropbox 5G Linux, Mac, Windows OK Box 50G Mac, Windows OK Google Driver 15G Mac, Windows Need to fuck GFW ubuntu one 5G Linux(ubuntu), Mac, Windows OK icloud 5G Mac, Windows OK 2 My working environment Before to illustrate this question, I ...

Install Bluez host stack from source code for linux

Image
Install Bluez host stack from source code for Linux Table of Contents 1 Why install Bluez5.8+? 2 Install Bluez5.8 into Linux distribution 3 How to start the newest Bluez stack daemon? 1 Why install Bluez5.8+? Bluez is the host part stack running in Linux. Install the Bluetooth LE feature supported Bluez was really important during develop the Bluetooth le apps, it can run your test case on your Linux PC at least. But Why Bluez 5.8 and later version? The Bluez stack was developed so quickly during the past one years from 4.100 to 5.9, its source code's quality was really promoted a lot after those frequent releases. What's more, Bluetooth LE was officially supported after Bluez 5.0 release not just experimental features in the older version.  The mainly Linux distribution's Bluez version, like Ubuntu13.2 or Fedora 19, still remained in 4.101, which means Bluetooth LE still in the experimental stage at the latest Linux distribution system . 2 Inst...

Bluetooth Introduction

Image
Bluetooth Introduction Table of Contents 1 What's Bluetooth? 2 Bluetooth stacks 3 Bluetooth profiles 1 What's Bluetooth? Bluetooth is a wireless communication technology. Its name comes from an ancient Denmark king, Harald Blatand, in the tenth century, who united the dissonant Danish tribes into a single kingdom. Because he likes to eat blueberry, his tooth was always colored to blue, people gave him a nickname Harald Bluetooth instead. And also, the Bluetooth's logo comes from this king's first two names and the band of the ancient North Europe characters.  How many parts did a Bluetooth system consisted of? The following figures illustrate the basic parts of a Bluetooth system. +----------+ +----------+ | | | Host | | host | | | +----+-----+ +----+-----+ +----+-----+ +----+-----+ | LE | | BR/EDR | |Controller| |Controller| +----------+ +----------+ ...

Ways to reverse one-directional list

Image
Ways to reverse one directional list Table of Contents 1 How I get this question? 2 So the answer is? 3 What did I learn from this question? 1 How I get this question? I attended a job interview again yesterday, the interviewer asked me some many questions including object-oriented software design, data structure, and algorithms. The written examination which is android SDK related should be my strong points one years ago, but Now I forgot most of the terms. So sucks huh! I list the following topics from my memory after the lasting 3 hours job interview. Plugin design patterns: Cons and Pros, How eclipse project leading this tide. Dynamic Programming language and OOP Lisp language, Functional programming, and Recursion Algorithms Most of the questions enlightening me so much, this interviewer is obviously a good engineer.  wow… Great job. Now, come back the topic. How to reverse a one-directional list? This question was given when we discuss the fu...