Go/Revel views - using short class names from google closure-stylesheets.jar

post by Nikola on 2015-10-19 12:30:09
I really like google/facebook style short class names. 1 byte is better then 8 :) I know that closure library have that, but only for their .soy templates and bunch of javascript files and it is all messed up and as far as i concern complicated to use. For last couple of hours I was trying to implement that in Revel. I end up with this solution with revel custom view functions.

1. You have to create renaming_map.json with
    java -jar closure-stylesheets.jar...

Murphy feature: Docker container with 20 ports and ssh daemon for each user

post by Nikola on 2015-10-09 19:09:23

I just finish adding docker container feature. Every user have now docker container where all repositories are mounted.

You can use this container as any other virtual machine. You can install what ever you want and you can test your app. Since this feature is still in test mode please not use it for production.

This feature is only for staging.


You can ssh into container with user/pass/port. This info is available...

Murphy features: Github like urls, couple of invitation codes and code import feature

post by Nikola on 2015-09-04 20:57:26

It took us a long time for github like urls. Let me say that was not easy to do in apache or nginx. Platform is much faster now with nginx config.

We added one big security feature that makes a system more flexible to change and update. We will go and blasting that in some future blog posts.

Till then here are couple of invitation codes that you can use twice:


Also we finished adding new feature - ...

Murphy feature: Git diff feature

post by Nikola on 2015-08-29 00:15:12

Just added new feature to Murphy, split diff view. I will blast source code for this next week since I see lot of people are looking for this git diff. Only thing that is missing are line numbers. That will be added in future release and source code shown as well. Screenshot is attached.


Murphy - Code Management for Developers

post by Nikola on 2015-08-27 20:30:38

Great things are happening. We just released first version of Murphy where you can manage your git repositories. We have a lot of features and this is just short list:

  • Add repositories
    • Private
    • Public
  • Delete repositories
  • Download
  • Commits view
  • File browser view
  • Git diff
  • Git diff view
  • File view
  • Syntax highlight
  • Releases view
  • Releas...

Stripe API - How to pay with with some other card then default?

post by Nikola on 2015-08-01 19:17:10

I got stacked with using multiple credit cards for one customer. I want my customers to be able to choose with which card to pay. Since you need token in charge, only way that you can generate that token (as far as I know) is to use full credit card info. I do not need that on my servers, since Stripe is already doing that.

So long story short (after two hours) I was able to figure this one out.

All you have to do is pass customer id to CardParams and then set CardParams s...

Golang and Revel oAuth2 for facebook, google and github

post by Nikola on 2015-07-30 14:59:16

Currently I am working on my project that is including oAuth2 registration. I wanted my users to be able to login/register via Google, Github and Facebook oAuth2. Since I switched all my development from Python to Go (since Go speed is light speed) I used "golang.org/x/oauth2".

Assuming you already setup your Golang revel project get oauth2 for go with:

go get "golang.org/x/oauth2"

Those are my routes:

GET   ...

Golang - how iterate over string array?

post by Nikola on 2015-07-13 13:35:32

I got some ids in my session with Revel framework and since I can not put []string into session, I needed to convert that into json without keys (so not struct data type was needed). This is result http://goo.rs/87r9n

package main

import  (

func main() {
	var str []string
	for i := 1; i <= 10; i++ {
		str = append(str,  strconv.Itoa(i))
	d, err := json.Marshal(str)
	if e...

Golang and gorp, how to humanize time?

post by Nikola on 2015-06-24 16:39:05

I started some project in Go and Revel framework month ago. Since then I learned lot of about Go. It is great and fast language. The main reason I like it is speed and of course everything you define you must use. It is not like php or python where data type is not important. Anyway I was struggle with revel ORM called Gorp. So many things are not clear from their manual. One of them is how to parse date time in your database (mysql or any other)? It turns out that you have to specify in conn...

How to access post params with same name in Go Revel web framework?

post by Nikola on 2015-06-10 19:11:07

I wanted to ask this question on Stackoverflow but I did a little bit of reading on main Revel website.

Well the body of question is same as title. I need to access markers[] in controller.

var markers = a.Params.Get("markers[]")

This only get me one and not all of them.

markers are strings

markers[0] = (`1433957020771,42.49032731830467,19.067459106445312,test,test`)
markers[1] = (`1433957020771,42.49032731830467,19.06745910644...

Mysql proxy - prepared statements NOT WORKING

post by Nikola on 2015-05-21 22:40:34

If you came across problems with Mysql proxy prepared statements that are not working and there is not way to solve (unless you are lua and mysql proxy developer) this (especially if you are using rw-splitting.lua). I read all internet on this matter and without deeper understanding there is just no copy and paste solution.

If you got error like:

"Unknown prepared statement handler (1) given to mysqld_stmt_execute"
and if you use rw-splitting.lua this erro...

How split mysql queries so select goes to slave servers and update/insert/delete goes to master?

post by Nikola on 2015-04-03 15:30:31

Reason for choosing mysql-proxy is that i want to split sql traffic so selects goes to slaves. Everybody was telling me that this is just not possible and I need some third api that will accept selects and route them to slaves and everything else goes to master. Then i discovered mysql-proxy.

This is few thing you need to know:

1) Never use mysql proxy from official repository for your linux distro. That is just outdated and will not work in most cases. In time that I am wr...

Installing Docker on Gentoo - kernel problems

post by Nikola on 2015-03-27 14:32:16

Since I like Gentoo linux al my dedicated servers are running on Gentoo. However everyone knows that Gentoo is a little bit more complicated then apt-get install or similar. All packages are compiled just for your architecture.

This were my errors:

ERROR: setup
  CONFIG_DEVPTS_MULTIPLE_INSTANCES:	 is not set when it should be.
  CONFIG_CGROUP_DEVICE:	 is not set when it should be.
  CONFIG_CGROUP_FREEZER:	 is not set when it should be.
  CONFIG_CGROUP_SCHED:	 is not set...

How to get next message UID with Dovecot PreAuth and python?

post by Nikola on 2015-01-09 19:13:01

This is update to my Blog post about Procmail and Python pipe script. I need in my app next message UID for some user. Problem with this is I do not know user password (since it is encrpyted) and I can not use python imaplib to get that next UID.

First I tried to parse dovecot-uidlist file and get next UID but that was bad solution since dovecot-uidlist is updat...

Procmail pipe python script

post by Nikola on 2015-01-09 19:10:35

I am doing some project for my self just for fun (simple webmail). Few years back I was doing the same thing but with PHP and it turns out that doing that in PHP was just nightmare. Every next page in webmail took about 3 secs to load and that is not so good as far as I am concern. Last year I started learning Python. Imaplib methods are just simple in Python and you have Python intrepreter so you can test everything without opening IDE.

In my mind in order to have fast webmail I dec...

Flask and Jinja comments recursion

post by Nikola on 2015-01-09 19:06:50

I was always having problems with recursions. It is not that they are hard but how to display them. In Flask and Jinja recursion is easy as long as you have good model defined since Jinja has a great recursion method implemented. You can download latest release of this blog in file that is attache dot this post.

This is simple recursion for this blog comments. In my Comment model I have something like this:

from models import db
from models.Post import Post
import time

Flask and SqlAlchemy - how to delete and how to insert into many to many relation

post by Nikola on 2015-01-09 19:05:06

While coding this blog I used ManyToMany relation in between Post and Tag entity. Since I am coming from Doctrine background this was no news to me. But I was stuck for two hours finding answers to this questions:

1) How to delete from that third table where actual values of Post and Tag are stored?

2) How to insert to that third table without defining entity (PostTag)?

I am not using plural in Table names or Entities because we are talking about Single object.


Flask microblog

post by Nikola on 2015-01-09 19:02:03

For a long time I was trying to do some blogging. Since other people blogs were so helpful to me in my development (Python, PHP, Mysql, Cocoa, Objective C) I decided to share this blog source on git hub and from now on when I come to a problem I will also do posting.

Address is https://github.com/goors/flask-microblog. You can find there Mysql Eer model along with code.


Writing custom functions for Jinja (Flask)

post by Nikola on 2015-01-09 18:59:57

I always have a need to do some last minute changes to my vars on front end (FE).

Since I am using Phalcon for php development Phalcon and twig template engine has a simple way of define custom function in view Phalocn Di which can then be accessed on FE. I was trying to do something similar on this blog.

In this blog I am using that cutom Jinja functio...

Docker containers running as daemon and few more things

post by Nikola on 2015-01-09 18:58:10

I got some answers regarding daemons, processes, connecting containers together.

First of all I switched to Supervisor (apt-get install supervisor) in order to maintain container processes.
Supervisor is great and you do not have to do some dirty hacks in order to run processes.

This is just example how to have apache in one docker container and mysql in other container.
In apache container I have virtual host that use mod_wsgi (it is a python flask app).

1) I start...