gms.StatusHelper Status from wire: INVALID_AUDIENCE status: null

This weekend I decided to resume work on an Android project I had left behind. Once I had my environment set up I kept getting this error:

1
W GLSActivity: gms.StatusHelper Status from wire: INVALID_AUDIENCE status: null

After some googling I found the problem was that I was trying to call a google service from an app using a signature not registered in my project. I fixed it by going to the developer console for my project:

Read More

Socket Statistics with ss

ss is a replacement for netstat; a program that allows you to analyze the sockets running on a Linux system. In practice, it is useful to investigate if a port is being used and by whom or to investigate which services are running.

In its simplest form, the ss command will list all non-listening sockets:

1
2
3
4
5
6
7
8
[adrian@localhost ~]$ ss
Netid  State   Recv-Q Send-Q       Local Address:Port                          Peer Address:Port
u_str  ESTAB   0      0            /run/systemd/journal/stdout 8313                    * 29127
u_str  ESTAB   0      0            /run/systemd/journal/stdout 9946                    * 30837
u_str  ESTAB   0      0            /var/run/dbus/system_bus_socket 7415                * 25359
u_str  ESTAB   0      0            /var/run/dbus/system_bus_socket  8795               * 18724
u_str  ESTAB   0      0                * 30484                                         * 28442
...
Read More

UI components library with React and Webpack

I’m looking for the best way to create a UI components library. A few weeks ago I explored React with Radium and I have also considered Polymer. This time I want to explore React with Webpack. I already wrote a guide to using Webpack with React. In this article I’m going to focus on creating a component that bundles not only it’s JS and markup, but also it’s styles.

CSS loader

To be able to declare CSS dependencies for our components, we need to use css-loader and style-loader. Installing them is easy:

1
npm install css-loader style-loader
Read More

Using Webpack with React

Webpack is a module bundler similar to Browserify but with a different philosophy. Browserify was born with the goal of making it possible for developers to write CommonJS(node code) in the browser. Webpack allows you to write CommonJS but it also allows you to use other formats that might not be supported by node. One thing that makes it interesting is that since it doesn’t try to comply with CommonJS, it allows developers to declare dependencies on files that are not necessarily JS, which can be helpful to create self contained components.

Getting started with Webpack

Lets create a simple React app using Webpack. We can start by creating our HTML entry point:

1
2
3
mkdir ~/webpack
cd ~/webpack
touch index.html
Read More

Temporarily disable Syntastic on Vim

Every now and then I have to dig into other people’s code that doesn’t comply to my coding standards. When I make a change on these files, Syntastic lights up like a Christmas tree. Since this is not my code and I can’t really fix it, I prefer to temporarily disable Syntastic:

1
:set SyntasticToggleMode
Read More

Quick Vim setup

Once again I changed computers and had to install and configure Vim so it works the way I like it. This time I was a little smarter and created a script that I can use in the future to install it and configure it with one command.

It will install the latest version of vim(from github), download and install the most useful plugins and create a .vimrc file. Just clone the get-vim github project and run:

1
./do.sh

And you are set. Hope it is useful.

Read More

Introduction to Reworkcss

Reworkcss is an easy to extend CSS processor that has some cool features I want to explore. Lets start by installing it:

1
2
3
mkdir ~/rework
cd ~/rework
npm install rework

Rework has a very simple API. It receives a string of CSS code and it outputs a rework object. You can then run plugins on this instance and finally output the result:

1
2
3
4
5
6
var rework = require('rework');
var plugin = require('plugin');

rework({source: 'style.css'})
  .use(plugin)
  .toString();

The interesting part happens on the plugins so lets look at some of the most interesting ones.

Read More

UI components library with React and Radium

Creating a UI component library is a common practice nowadays. There are many good examples out there, being bootstrap and foundation some of the most popular as of this writing. Although those are good options for prototyping, there are some reasons while they might not work for big companies.

They need customization to match your company image; If you want to use them for your company you might end up tweaking it so much that it no longer look like the original library.

They are bloated; They are made to meet multiple needs so they include many components that you might not need. Even when you can create your custom build, the components themselves are made for flexibility so they will most likely include stuff you don’t need too.

They are not components; These libraries call themselves UI frameworks, so they are not really component libraries. They usually provide a plethora of useful classes that you can incorporate into your HTML, but there is no really way to say “I want this thing in my page”. You have to do it yourself. Some components they offer also need JavaScript, which means that to use the framework you need to include the CSS and JS and then add the correct classes to your HTML. In a lot of scenarios this is acceptable, but probably hard to scale.

Read More

Python virtual environments

Python allows you to install packages using PIP. This works fine for small projects, but when you want to create a portable application you might run into problems if your application depends on a version of a package that is different to the version that another application depends on. Because by default PIP will install packages in a folder similar to:

1
/usr/lib/python2.7/site-packages/
Read More

Introduction to PIP

PIP(PIP Installs Packages) is Python’s recommended tool for package managing. Most modern operating systems come with Python and PIP installed. You can check if Python and PIP are installed using the which command:

1
2
which pip
which python

If PIP is not installed you can follow the documentation to install it.

Read More