Archive

Software Development

db-9I just finished an experiment with COM-to-COM communication via RS-232. I installed Debian on old box with 1G RAM. There is a COM port. The idea is to try to connect my regular dual boot Linux/Window system to it via null-modem cable. I bought 2 DB-9 connectors and soldered that cable. There 3 wires: TX-RX, RX-TX and GND-GND. This is minimal null-modem cable. Both systems are linux boxes. I installed minicom tool by sudo apt-get install minicom. I have no /dev/modem, which is used in minicom by default, so, I configured /dev/ttyS0. Look, it needs to have the same serial settings on both ends, and turn off hardware flow control. For better UX, turn on echo by ^ae short-cut and line feed by ^aa. After that, typing of one minicom is duplicated in another. If it needs to transfer files, then lrzsz should be installed as well by sudo apt-get install lrzsz. That tool provides {x,y,z}modem protocols for files transferring via serial.

Advertisements

Not so long time ago, I was very useful as Full-Stack Rails developer for 27faces project. It is like AI as a Service platform that can be pretty helpful as solution of a bunch of marketing problems. The main idea is to recognize the faces of the people staying or walking in front of regular camera connected to PC. The system can classify viewers by age, gender, their attention and mark the time visitors spent near the camera. It’s possible to collect such statistics from a set of configured camera-points on the server side and represent the data in the form of charts, that all business analysts love. I was working on back-end, UI, data collection, charts and devops. The implementation is standard rails application + set of usual gems, so, solution is robust. Besides, there are Bootstrap for UI and amazing Capistrano for deployment. In despite of node.js hype, rails is still sexy and widely used.

27faces

Several weeks ago young girl (not too young) asked me to implement simple solution to manage statistics on how much a person has read. Well, she has an idea to make the world better in the way of gamification of the reading process. So, people would be motivated to read more.

Ji-Shi-Sha-Scha

Let’s focus on the technical part of the problem. I used Angular.js framework to implement HTML5 solution integrated into VK social network as an application. I used CoffeeScript, mozilla’s pdf.js, LocalStorage, twitter bootstrap and VK API. As it’s pure client side solution, I hosted it on github pages.

I’ve done one more MOOC class by Coursera. This one was on pretty hot topic — Data Analysis/Statistics. Well, it was not related to theoretical issues, but rather fit to pure technical aspect. It was an introduction to the R system and programming. R is a well-done alternative to MathLab, or to its data processing part, at least. Actually, I’ve been using R on both Windows and OSX. As MathLab, R is also useful for modelling and working with relatively small amounts of data. On the other hand, there are BigData volumes in real world. So, R or Mathlab is not enougn for today. Generally, you need some BigData technology like Hadoop to implement your model in production.

r_programming

Today I’ve migrated the database of Ruby on Rails project from Sqlite to MySQL. It’s not first time I’ve done it. So, I decided to note it as a post.
First of all, it needs to add special yaml_db gem to the project:
gem ‘yaml_db’
It allows us to dump all data from the storage by command like:
RAILS_ENV=production rake db:dump
then switch the storage (production inour case) from Sqlite to MySQL in config/database.yml file and load the data back to the storage:
RAILS_ENV=production rake db:load
in this case into MySQL backend.

It’s a preferred way of such migration because of its pure abstract yaml representation of the data. It doesn’t depend on specific SQL.

Git is used broadly for now. Let’s look at interesting use case. Assume, we have the development machine and the live server. I’m going to hold the project in local git repo on development machine. From time to time it needs to deploy stable version to the live server as a release.

Just for demostration, I use 2 local directories /tmp/dev and /tmp/server:

mkdir /tmp/dev
mkdir /tmp/server

Then I init new repo and add some test file in the release branch on the dev side:

cd /tmp/dev
git init
git checkout -b release
vim test.txt
git add test.txt
git commit -m “initial commit”

Now I create empty repo on the server side and checkout for server branch:

cd /tmp/server
git init
git checkout -b server

Next step is to configure and pushing prepared release to the server:

cd /tmp/dev
git remote add server file:////tmp/server
git push server release

Here we use local file URL. In real situation it needs SSH one, like ssh://login@host:port/path/to/project.
Last stage is to merge just pushed version from release branch to current one (server) on the server:

cd /tmp/server
git merge release

At this point the new version is on the server side.

Usually, we host the repo of the project on github or bitbucket. Last one even allows to create private repo’s if you are not ready to share your code with the world yet. So, described above example should be treated rather as an exception then standard use case.