DevNotes

Concise, Handy and Elegant Notes for Developers

0%

This is a small lab I have done to see how easy to use python to transfer file over TCP and UDP. File formats including plain text, MS word, pdf, image and vedio.

Read more »

GitHub supports hosting static websites for free. Here we go through the essential steps.

Configure your own website

Firstly, create a new repository from GitHub website, name it username.github.io, the username must match your GitHub account name exactly. Then, clone the repo and add a file index.html, add some texts into it, commit and push back. (This also applies to GitHub organization account.)

1
2
3
4
5
6
git clone https://github.com/username/username.github.io
cd username.github.io
echo "Hello World" > index.html
git add --all
git commit -m "Init"
git push -u origin master
Read more »

Since version 1.4, mosquitto MQTT broker starts to support websockets natively. Now it is a try out for this great new feature.

The websocket support is not enabled by default, so we have to fetch the source code firstly and update one line in file config.mk

Read more »

Software development and deployment work flow is quite important for a development team when the product has rapid iterations and code base getting more and more large. There are three concepts/terms around development & deployment: Continuous Integration, Continuous Delivery and Continuous Deployment.

Read more »

We need to prepare to scale up our web apps and do the time consuming jobs asynchronously in a stable way. Queue is a good tool to fulfill this requirement.

RabbitMQ fits our needs after investigation, so we try to add it into our apps.

Some terms need to mention:

producer: A program that sends messages

consumer: A program that mostly waits to receive messages.

queue: A buffer that stores messages. It is like a mailbox. Although messages flow through RabbitMQ and your applications, they can be stored only inside a queue. A queue can store as many messages as you like ‒ it’s essentially an infinite buffer. Many producers can send messages that go to one queue, many consumers can try to receive data from one queue.
In RabbitMQ a message can never be sent directly to the queue, it always needs to go through an exchange.

exchange: It receives messages from producers and it pushes them to queues.

exchange types: direct, topic, headers and fanout.

Read more »

XCode

Install XCode from Apple App store, and you might need XCode Command Line Developer Tools, which is needed to build e.g. Ruby gem native extensions and install other system packages.

1
xcode-select --install

To check it after installation

1
gcc --version

HomeBrew

We need packages manager on Mac

1
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

iTerm2

iTerm2 is a replacement for the native Terminal app that ships with Mac OS X.
Download and install it. And go to iTerm 2 => Preferences => Profiles => General, check “Copy to clipboard on selection”, check themes for fancy colors, “Solarized Dark Higher Contrast” is the one I am using.

Read more »

MQTT

MQTT (MQ Telemetry Transport) is a machine-to-machine (M2M) / “Internet of Things” connectivity protocol. It was designed as an extremely lightweight publish/subscribe messaging transport. It is useful for connections with remote locations where a small code footprint is required and/or network bandwidth is at a premium.

[http://mqtt.org]

MQTT is explicitly built for devices with limited resources and is therefore very light on battery. It is designed for unreliable TCP networks or low bandwidth and ideal to run on an embedded device with limited processor or memory resources.

The idea is that, every client could behave like a subscriber, a publisher or both. Clients do not communicate directly, all the messages should go through the broker, which is the central server. A client subscribes a topic to the broker, just like listening to a channel, whenever there is new data published from any publisher to the topic, the broker will push it to the interested subscribers, the subscriber has no idea who is the publisher of the message, they only care about the message and topic.

Read more »

I have been checking out different open source licenses recently. I made a few notes for future reference for myself.

MIT & BSD 2-Clause

The most permissive license. It allows people do anything they want with your code as long as

  • they include a copy of the license and copyright notice with the code
  • do not hold you liable.
Read more »