What you will find here:
C/C++, Erlang, Elixir, PHP, FreeBSD, Linux, Miscelaneous programming stuff and articles, Design Patterns, etc

Get in Touch


ABNF Grammars in Elixir

ABNF grammars are widely used in the Internet today. They serve as the basic building blocks for a lot of highly used protocols, like HTTP, SIP, SMTP, FTP, etc. And they are also very useful to design DSLs (Domain Specific Language). In this article we'll learn how to use a tool called ex_abnf to quickly create grammar parsers using the Elixir language.  Read More »

Persisting your entities in Erlang

In this article, I'll describe epers, which is a small project I've been working on. It's currently a "small" project, but quite ambitious, and the idea is to try some "new" ideas and concepts in the erlang we do every day. epers stands for "erlang persistence". As the name suggests, it tries to make it easy to use databases in erlang programs, to make it a little more agile, and (humbly) offer a nice adapter for several databases, hiding their implementation details  Read More »

Erlang Websocket Server using Cowboy

Out of curiosity, and because some of my own projects needed it, I decided to go ahead and try writing a websocket server in erlang. After evaluating some of the available options (so I dont have to implement the whole websocket RFC -and their different drafts/versions- myself), I chose the Cowboy  Read More »

Sniffing in PHP using libpcap: Thank you SWIG!

I've been wanting to try SWIG for a long time, but never got the chance, for one thing or the other. So this weekend I've finally decided to give it a try by trying to create a php extension that access a small C++ wrapper for libpcap, so I can sniff packets directly from PHP. Just for fun (and actually because I couldn't find any active pecl extension to use libpcap, so it might as well be something useful). I've named it "SimplePcap".  Read More »

PHP Continuous integration, with Jenkins and Phing

This article is about how to use Phing in your projects, so a continuous integration server (in this case Jenkins -ex Hudson-) can generate the necessary artifacts for your php application (deployment artifacts, documentation, code metrics, etc). I'll try to show why this will make your life easier when developing or auditing code, generating releases and deploying new versions, trace bugs, etc.  Read More »

How to make a cross compiler (gcc) for freebsd under linux. A small tutorial.

I manage a Hudson CI Server that runs on a linux system where I work, and one of our projects is written in plain C code that should be able to run on linux and also freebsd 7. Up to now we were using a freebsd (hudson) slave node in order to build the freebsd binaries.  Read More »

Erlang Special Processes without behaviours

OTP has (in its design principles), things like behaviours, applications, releases, and supervision trees. If we zoom into the latter, we'll find supervisors, which supervise processes, that can also be supervisors themselves.  Read More »

Making an Asterisk Manager Interface monitor using PHP, PAMI, and Ding (Inversion of control and dependency injection in your php telephony applications)

Here, I'll write about AsterTrace (https://github.com/marcelog/AsterTrace), a simple project that will help you get started using the asterisk manager interface.  Read More »

Mocking global php functions for unit testing

Let´s say you´d like to achieve a 100% coverage of your code in your php application (you obsessive geek..). It´s almost certain you´ll need to start mock´ing things around. So far so good.. but sooner or later you will need to deal with the test cases for the code that use global php functions. How can you mock them?  Read More »

Bami: A Proof of concept asterisk manager interface (AMI) client written in bash

In this article I explained the inners of the AMI protocol, and talked about actions, events, and responses. As a complement of that article I wrote (just for fun) a little shell script  Read More »



PHP DI (Dependency Injection), AOP (Aspect Oriented Programming), JSR 250/330 annotations, xml and YAML for bean definitions, lightweight, MVC (Model View Controller), syslog, tcp client and server, with non blocking sockets, and custom error, signal, and exception handling. Similar to Spring (java)


An AGI (Asterisk Gateway Interface) client implementation in Erlang, suitable to make telephony applications using erlang.


A small C++ wrapper for libpcap, shipped with a SWIG interface file for PHP. Allows packet capture and injection directly from PHP code. Comes with a sample PHP sniffer as an example.


An AMI (Asterisk Manager Interface) client implementation in Erlang.


PHP Asterisk Manager Interface (AMI) supports synchronous command (action)/ responses and asynchronous events using the pattern observer-listener. Supports commands with responses with multiple events. Also supports SMS via VGMS boards. Very suitable for development of operator consoles and / or asterisk / channels / peers monitoring through SOA, etc


PHP AGI (Asterisk Gateway Interface) facade, with CDR (Call Detail Record), Call spool and schedule auto dial, Send and Receive Fax, Channel Variables, and Caller ID management


Node Asterisk Manager Interface (AMI) A port of PAMI in JavaScript to run with node.


Multithreaded daemon and libraries written in plain ansi C, for linux and freebsd, used to communicate with DSLAM Alcatel, ZTE, HUAWEI


Patch for ZendEngine/PHP (5.3.5) to allow native annotations in the language by using the token "@@" (the @ was already taken). It allows 0 or more annotations in classes, methods, properties, and arguments for methods with 0 or more arguments per annotation


Hello there.

I hope you enjoy whatever thing you can find here.

Please contact me if you have any kind of comments or feedback that can contribute anything at all.

PEAR Channel
CI (Jenkins) Server
Resumé at careers 2.0
User at StackOverflow
LinkedIn Profile
Freshmeat Profile
Ohloh Profile
Twitter: @mgornstein

If you feel generous, you can make a donation and help me dedicate more time to write useful articles and software:

Click here to lend your support to: General and make a donation at pledgie.com !