Sep 25

Mongodb meets the PythonVM

A week or 2 ago I pushed on github a new project I'm working on (as usual in my free time).

It is a PythonVM implementation for mongodb which allow users to run python code inside mongodb. I wouldn't suggest to use it as main scripting engine (this would also require a big change inside mongodb so just forget it) but It would be nice to be able to use it for map/reduce operations and better language integration (at least for the python lovers out there).

Even if it might not be THAT useful it is still fun and it is mongodb so...

Feel free tu clone / hack and pull request

https://github.com/FlaPer87/mongodb-pythonvm

Mar 22

Asterisk and 0MQ

Hey ho!!!

Here's a little project I started last weekend. It aims to replicate asterisk's manager's actions using zmq and json. Right now it just handles the originate command which makes possible the execution of MANY calls (asynchronously). This might be useful for prediction algorithms that need to execute as many calls as possible in a short time. It also has a simple thread pool to handle concurrency, it makes possible to start as many workers as needed.

As I said, I just started it which means it needs a lot of work. Does any of you want to fork/help?

Some things that It should have:

  • Bulk Originate.
  • Call Status/Result Inf. (Maybe using a push socket)
  • Callback when a originate ends (successfully or not) ?

Any other Idea?

Heres the github link: https://github.com/FlaPer87/asterisk-zmq-manager

Nov 11

What's so good about nosql? - Part 3 - Fearless against schema-less dbs

See also:

People use to think about schema-less dbs as a mess which they're not; People use to talk about schema-less dbs as non structured dbs without order - which is half true. Schema-less dbs do have a structure and usually it is a JSON-like one dynamically ordered and not typed. Even if that looks as a list of features you wouldn't like your db to have, I'll try to show you why and when they're great and can make developers work easier so, let's do a small list of great uses cases before taking a deeper look to schema-less dbs,

Use Cases:

  • Dynamic data storage
  • Logging (Asterisk, Syslogs...)
  • Web Apps (Blogs, Web Sites, CMS...)
  • Almost anything you want.

I'm not going to say why nosql databases are great for each of the cases listed above but I'd like to talk a little bit more about the third case, Web Apps.

Web Apps and NoSql

It might be difficult to accept that a non-typed and non-related db system could be good for web applications. Everybody knows that web apps success is not just based on those fancy views and the things they do, their success is also based on how well they perform and fast they can complete requestes and operations.

How should data be modeled

First of all, data will always be data, no matter what you do what changes is the way you access it and how easy it could be to find the information you need. When changing form sql dbs to nosql ones it is common that people keeps thinking about how they can relate the model A with the model B. This is good, I'm not complaining but it's true that this is as good as embedding and/or storing information of model B in model A.

A friend of mine came to visit me and we were talking about diferences between RDBMS and nosql dbs (Specifically mongodb) and he asked me: How would you store the information of a group of people that are related to a group fo cities and at the same time are related to some churches the are related to some of the those cities? I honestly think that this could be a good example, lets figure it out:

In a RDBMS it would useful and easier to do something like this:

  • 5 tables (people, cities, churches, people_cities, churches_cities)

In a nosql db (mongodb for example) I would suggest something like this:

  • 1 collection cities with 2 attributes (people and churches) which should be a list of dictionaries? strings? that's up to you.
What about queries?

Querying for cities that are related to a person (lets say Mario) in a RDMS would require doing a query over the relations table and joining it to the cities table to get the city information, in the other hand, the same query in a nosql db would require doing a query over the cities containing Mario in the people attribute. The important thing here is that we are reducing the number of queries, iterations and processes that should be done to get the information we need.

What about modifying our models?

During the web applications evolving process it is common that the original models have to be changed to satisfice the app needs and normally new attributes are added/removed to/from the model. When working with RDBMS it would require you to modify your tables and add/remove the needed columns so they respect the model structure and this usually is a long process that needs to be done carefully so you don't mess your tables but, if we're using a nosql database this process would be as easy/simple as modifying your models adding/removing the attributes and in some cases (when needed) add som data normalization methods (or backward compatibility) to preserve the data that was already in the db and save it using the new model structure.

As I always say. Models were created to model data but models can be modeled too so, there's no reason to be afraid about schema-less databases and if we are going to use one of them it is important to know that our application performance/speed/dynamism will be improved as much as we adapt our models to the database features.

Aug 12

MongoBerlin on October 4th


HEY HOOOOOOOOO!!!!

Just wanted to share with you that I'll be giving two talks at MongoBerlin on October 4th. It would be great to see you all there to share many thoughts and knowledge about MongoDB and nosql.

Here's the agenda:

MongoBerlin Agenda

Jun 24

What's so good about nosql? - Part 2 - Talking about APIs

See also:

Disclaimer: This post is mainly oriented to Web Development. All the comments, opinions and features listed bellow exist for NoSQL databases and also for some SQL ones.

As I mentioned in the part 1 (above link) working with databases is not just about having a good place to store data, without a good and simple API to access the stored data we would have a sealed box full of information that we just can't use. Nowadays, there are many tools that make data-access process easier, for example, there are frameworks (like Django) that have ORMs that, as Wikipedia article says, "create virtual object databases that can be used from within the programming language". Ok, all this is great but:

How do we know that a database has a good API?

This might sound like personal opinion but, I'm sure we all agree with most of the things listed bellow:

  • The less methods the better: It's a waste of code and time when APIs need to instantiate N objects (excluding connections objects) before being able to execute a simple query, come on, that process could be simplified with a single call.

  • The fastest the better: If the above point is a waste of time, this one is even worse. There are queries that may take some seconds before returning the results, we can accept that, obviously, It depends on the query but, if the 40% / 50% of that delay is caused by the driver you should definitely find a better one.

  • Comunication Methods matter: There are many communication protocols and methods so I'm not going to list them here but, you have to be aware that some of them may be faster than others so before saying that the communication method exposed by the API is good take a look to the next point and be sure that it fits your needs.

  • Speed Tests: Benchmarking is always great and there are thousands of benchmarks around the net so, go to your favourite search engine and start looking for benchmarks related to the database that you're interested in.

Now what?

We now know that API is important and that it must be simple and fast, even though, that's not enough. A good API is also versatile and not app oriented, for example, If my database API is oriented to Web Applications then I'm doing something wrong because any kind of application has to be able to use that API to access my database unless the database itself is oriented to web applications (which would be really weird). That said, we should take a deeper look to what web applications need to be developed in short time and without affecting their performance. Most people use to think that ORMs are the solution to everyone trying to create a web application in short time without learning SQL or any other database syntax/driver, they're wrong, there're many tools around internet ready to be used that would make web development faster and easier too but we're not going to talk about that, what I'd like to point is what are the common features that frameworks oriented to web development MUST have.

  • Laziness: "Yes, because we're lazy people so we do lazy things." It is important for web apps to keep things lazy which means that every single module/object/data should be imported/loaded/instantiated when it is needed to process the request, in any other situation that specific module shouldn't be touched by any part of the application.

  • Explicitness: Just like Python's "import this" says, "Explicit is better than Implicit". Nothing, and I really mean NOTHING should be written or considered as easy to understand. This (even being a boring process) will save lot of time to developers and people giving support to others.

  • Simplicity: Explicit implicitly means that frameworks should be simple and understandable; "FOR DUMMIES!". Let's let frameworks off complexity.

  • Documentation: If it is not well documented it just doesn't worth your effort/time.

Jun 19

MongoUk 2 days full of mongodb

Hi Everyone,

Well, MongoUK has ended and I'm now in my room with nothing to do and remembering all those great things I've lived in the las 2 days. I'd like to thank 10gen guys and all the mongodb team, I'd also like to give a special thank to Meghan Gill for her great work organizing MongoUK and contacting us as speakers.

So, What did we do in mongouk??

  • We talked about sharding
  • We talked about indexing and querying optimization
  • We talked about Schema Design
  • We talked about Replica sets
  • We talked about Administrative tools
  • We talked about Replicas Administration
  • We talked about Django and Mongodb implementations
  • We did python tools demos
  • We talked about soccer
  • We talked about life
  • We talked about *
  • We had a great time together
  • And last but not least, We had Dinner and Drinks together too =)

So, It was a pretty intense day full of good talks and great people too!!!

Thanks again to everyone and I hope to see you in the conferences to come.

May 13

MongoUK

Hey Everyone!!!

I just wanted to announce that Markus Gattol and I will be presenting "Building web applications with PyMongo and Django" in June 18th at MongoUK[0] so, if you'll be around please come by and be part of this awesome MongoDB conference. I'd lalso like to thank 10gen and the mongodb team for letting us be part of MongoUK and for the awesome support they've been giving us on this.

See you there!!!!

[0] http://www.10gen.com/conferences/event_mongouk_18june10

May 09

What's so good about nosql? - Part 1 - What does nosql stand for?

Hey Ho,

This is the first in a series of posts that aim to explain why nosql databases are so great (in some areas) over relational ones. In this post I'll explain what nosql is and list some of the main nosql families and databases.

I'll start quoting the nosql-database definition about NoSQL databases:

"Next Generation Databases mostly addressing some of the points: being non-relational, distributed, open-source and horizontal scalable. The original intention has been modern web-scale databases. The movement began early 2009 and is growing rapidly. Often more characteristics apply as: schema-free, easy replication support, simple API, eventually consistent / BASE (not ACID), and more. So the misleading term "nosql" (the community now translates it mostly with "not only sql") should be seen as an alias to something like the definition above."

Let me explain some of the main nosql databases characteristics.

  • schema-less: This means that it can store anything in any order, no matter what type it is or how it is structured. Think of it as a toys box that can be used to store anything you want, yeah, just like that, there's not going to be a box for G-I Joes and another one for cars, you just put anything you want to store in there and that's it, there are no moms saying "You told me this box was for cars and that one for G-I Joes, you can't put your cars in the G-I Joes box, there're not of the same type"... Who cares? At the end, they're all toys, Racist!

  • horizontal scalable: Didn't you ever had to carry many books at the same time when you were at school? Well, I didn't, but, this is a good example to explain horizontal scalable systems. If I would had to do something like that I'm sure I would had called my friends and asked them for help, woudn't you? Well, that's what horizontal scalable systems do, they share operations/data horizontally between the many nodes running and release single nodes from back pains.

  • Simple API Last but not Least. A database is not just about how data is managed, indexed or processed, it also has to guarantee an easy way to access data from outside (the so called drivers). When we talk about simple API we're not talking about well defined methods with understandable names that can be learnt easily, this part is important too but, it is also important how data gets exposed by databases. Most of the nosql databases use simple json encoded messages and simple protocols like REST, Simple HTTP, TCP Sockets and so on. What else can we need?

Now that we know what a nosql database is we should also know how they're grouped, let me list some of the families and some of the well known databases:

Wide Column Store

  • Cassandra: I'm sure you know this one, no? hmm, lets see, have you ever used Facebook? Well, They started this project.

  • Hadoop: Another apache project, I've never used it before but it really looks awesome. Take a look to PIG and you'll know what I mean.

Document Store

  • Mongo: I love it and I use it all the time so stop reading this blog post and start reading about mongodb if you haven't done yet.

  • CouchDB: Another apache project. God, this guys have many projects. This one is written in erlang.

Key Value / Tuple Store

  • MemcacheDB: Well known and used by many people. We, for example, use it as Django cache back-end.

  • Redis: Well known and used by many people as well.

Graph Databases

  • Neo4j: Wow, you have to see it running...

References:

Update:

For further reading take a look at:

Apr 29

Il mio cuore ricordai

I

Fu in quel momento che io capii che il nostro amore non era perfetto,
ed ingannai il mio cuore con altre bugie
e adirittura lo spezzai in migliaia di ricordi
che non potranno mai ricomporsi.

II

Ricordo che accettai con rammarico la mia sconfitta
e che lasciai all'abitudine l'amara vittoria,
che distrusse spietatamente il nostro mondo
ed invidiai con rancore ogni nostro rapporto..

III

Da quel giorno imparai a conoscere me stesso
ed iniziai ad amare quello che avevo ignorato,
mi buttai con fiducia in un mare di emozioni
e capii che l'amore non è amore se dev'essere ricordato

IV

E adesso, davanti al nero del mio inchiostro oggi io confesso
che pur essendo il mio cuore distrutto e depresso
feci l'impossibile per riparare,
quel che due cuori innocenti impararono ad amare

V

E se aggiungere altro anche mi è concesso
vorrei dirti oh mia cara principessa
Amarti non fu una mia scelta razionale
ma del mio cuore una saggezza d'ammirare.

VI

Nell’amore non esistono modelli da seguire ne regole da rispettare,
ma mondi da scoprire e cammini da esplorare
assieme a chi si ama e con chi si vuol morire
ricordando che non è amore se non c'è niente da sentire.

Apr 28

A useful MongoDB FAQ

If you're a mongodb user and you have some questions about RAM, memory, CPU and anything else that might be asked frequently, please, take a look here[0] first. This is a link with really useful and well explained information about MongoDB.

Bye

[0] http://www.markus-gattol.name/ws/mongodb.html

Apr 14

Meclipse: Eclipse + MongoDB

Hey Everybody,

I've uploaded Meclipse to github.


What is Meclipse?

Well, Meclipse is an eclipse plugin for mongodb.


What does Meclipse do???

  • It has a MongoDB View that contains a list of servers (connections). It is possible to add/remove connections. They are saved in a settings file.
  • It loads (as TreeView) the list of databases and collections.
  • It loads the data found in the collection. To do this, Meclipse opens a new Editor and shows the data loaded (This part needs a lot of work).


Is it really needed?

I started it because I use MongoDB, I use eclipse and I don't want to have 100000x10^10 applications opened to do what I need to do so.......


What's next?

  • Meclipse already shows the connections, databases, collections and data stored in MongoDB so I think that the critical point (where I/you/we should focus ) is how data is shown in the editor.
  • Many other things.

I hope you like it and find it useful, and please, feel free to fork, do pull request and everything needed to improve Meclipse.

Apr 12

MongoDB CDR backend for Asterisk

Hi,

Last night I created a new cdr backend for asterisk based on my favorite non-sql database MongoDB and I hosted it on github. The master version needs some tweaks but it works already so, feel free to download it and let me know what you think.

Github link: http://github.com/FlaPer87/cdr_mongodb

Cheers

Mar 29

CSUN+GNOME Hackfest: Que experiencia maravillosa

Para todos aquellos que no conocen CSUN explico en 2 lineas lo que es: CSUN es una conferencia orientada a las tecnologías de asistencia en la cual miles de personas de todas partes del mundo se congregan para dar a conocer o conocer las nuevas tecnologías que se han desarrollado y que dan soporte a las personas con cualquier tipo de discapacidad.

Gracias al soporte de la GNOME Foundation me fue posible estar presente en dicha conferencia y compartir con un grupo de personas excepcionales experiencias a su vez magnificas. Las personas a las que hago referencia son: Willie Walker, Joanmarie Diggs, Ben Konrath, Mike Gorse, Brad Taylor, Bryen Yunashko, Steve Lee, Li Yuan, Ke Wang, Alejandro Piñeiro, Peter Korn y Eitan Isaacson (al cual felicito por el excelente trabajo que hizo organizando el Hackfest A11y).

A continuación intentare resumir todo lo que se llevó a cabo durante esta semana:

  • EL día Lunes nos encontramos en el Lobby del hotel para poder vernos las caras por primera vez (Honestamente debo admitir que fue emocionante poder darle una cara a los nicks/nombres con los cuales suelo trabajar on-line). Luego de conocernos y de un almuerzo todos juntos llevamos a cabo (BryenY y mi persona) un pequeño e improvisado hackfest para planet-a11y y que decir, ya tenemos un nuevo engine para el planeta el cual será instalado en los días por venir.

  • El día martes se llevó a cabo el Hackfest de GNOME-A11Y. Nos reunimos en el salón Ford A y B del Hotel Manchester Grand Hyatt y dimos inicio a lo que puedo describir como una reunión llena de ideas y de productividad. En este Hackfest tomó la palabra Willie Walker y dio introducción a lo que serian los planes para las futuras versiones de gnome y de como se debería afrontar el tema de la accesibilidad. Como todos sabemos Willie (después de 20 años de fiel servicio a la accesibilidad) no puede seguir siendo el líder del proyecto Orca y es por ello que el proyecto queda en manos de una persona (Joanmarie) igualmente excepcional y que ha colaborado en dicho proyecto desde hace años. En este mismo día se le entrego un reconocimiento a Willie Walker por sus 20 años de servicio a la accesibilidad, este detalle fue pensado y organizado por Peter Korn (Bien Hecho Peter).

  • Los días Miércoles, Jueves, Viernes y Sábado estuvimos en el Stand de GNOME ofreciendo información a todas las personas que pasaban acerca de lo que es gnome, y de como este desktop environment afronta el tema de la accesibilidad. En dicho Stand teníamos a disposición una computadora con todas las herramientas de accesibilidad instaladas (Orca, Caribou, MouseTrap) con la cual pudimos dar una demostración en vivo de como funcionan dichas aplicaciones. Lo mejor de todo esto fue ver como las personas que pasaban se iban contentas al saber que muchas de las cosas que necesitan las pueden encontrar libres y gratuitas en internet.

Bueno, que decir, este es un resumen super resumido (XD) de una semana espectacular llena de experiencias inolvidables con personas excepcionales. No me queda más que agradecer inmensamente a la fundación GNOME por la oportunidad y que YA ESTAMOS PREPARANDONOS PARA EL PRÓXIMO CSUN!!!!!!! WOOOOOT

Acá les dejo un link con algunas fotos del stand http://www.flickr.com/photos/mostlypictures/sets/72157623693089040/

P.D: por cierto, entre otras cosas, conocí al desarrollador de Caribou con el cual iniciaré a trabajar fuertemente para la integración de MouseTrap y Caribou.

Mar 26

CSUN+GNOME Hackfest: What a wonderful experience!!!

Hey Everyone,

Just wanted to make a post explaining how wonderful the last week was. Thanks to the GNOME Foundation it was possible for me to be present at the 25th CSUN Conference and share with a group of amazing guys awesome experiences, ideas and dinners =)

One of the things that made the last week that awesome is that I finally met some of the other gnome-a11y guys: Willie Walker, Joanmarie Diggs, Ben Konrath, Mike Gorse, Brad Taylor, Bryen Yunashko, Steve Lee, Li Yuan, Ke Wang, Alejandro Piñeiro, Peter Korn y Eitan Isaacson (good job organizing the Hackfest).

I'll try to shortly describe what we did:

  • On Monday wew met at the lobby and saw our faces for the first time, after that we had lunch and then Bryen and I started our little planet-a11y hackfest. Good Job Bryen!!!

  • On Tuesday we had a hackfest at the Ford A and B room. What a wonderful meeting, We talked about what we should do from now on and how things are going to be. We discussed about GNOME3 a11y and we also reviewed each of the topics found here. After dinner (or before, I don't remember anymore XD) We gave to Will a present for his 20th years of hard work on a11y this was planned by (Peter Korn), it was nice and really exciting.

  • On Wednesday, Thursday, Friday and Saturday we all did booth duties =D Many people came by and many of them were really exited about how GNOME-A11Y works. We had demos of Orca, Caribou, MouseTrap and people really liked GNOME-a11y apps.

Well that's it. As I said, I shortly described what we did the last week but it doesn't mean that it was that short XD It was a loooong and exciting week. And guess what, We are already thinking about next CSUN, WOOOOOOOTTTT!!!!!

Here's a link where you can find some pictures. LINK

Thanks everyone and Thanks GNOME. It was really awesome to meet you all.

P.S: btw, I met Caribou maintainer and we're going to work together on Caribou and MouseTrap integration. Way to go Ben!!!!!

Feb 17

Server Change

I'm migrating the blog to a new server, old posts will be back soon.

Jan 28

Assistive Technology Hackfest

Hi Everyone!!!!

Just wanted to announce that I'LL BE AT THE ASSISTIVE TECHNOLOGY HACKFEST that will have place during the CSUN Conference on March 22-27 and that's not everything, I'll also be sponsored by the GNOME Foundation....

So, Many many thanks to the GNOME Foundation for this opportunity......

Jan 01

Multiple Exchange accounts on IPhone

I did it like this:

(You'll need ssh on the IPhone)

1-) Configure one of the exchange accounts on the iphone

2-) SSH you're IPhone and cd the /private/var/mobile/Library/Preferences folder

3-) Execute "plutil -convert xml1 com.apple.accountsettings.plist" (This will convert the plist file to xml)

4-) Copy the converted file to your local machine

5-) Remove the configured Exchange account from the IPhone and configure the new one.

6-) Repeat steps 3, 4 and 5 for each Exchange account.

7-) Merge all the files you copied locally.

8-) Copy the new file (The merged one) to the IPhone (Same folder and same name)

9-) Go to the IPhone mail settings and try disabling and enabling one of the accounts (This will refresh the mail/contacts/calendar settings)

10-) Enjoy

Nov 27

Rabbitmq and iptables

FYI:

If you anytime want to install rabbitmq in a machine running iptables, please, remember to ACCEPT everything comming from localhost (at least the ports needed by rabbitmq and erlang).

To add to the iptables.rules file

-I INPUT -s 127.0.0.1 -p tcp -j ACCEPT -I INPUT -s 127.0.0.1 -p udp -j ACCEPT

Bye