Posts

Showing posts with the label ruby

Using Ruby properly in Linux with RVM

Image
RVM is a virtual env manager in ruby . This kind of solution is very common currently. In Python and Go we have similar solutions for instance. This is needed because sometimes libraries have different version and conflicts and this makes the process way easier to deal with. Today as you go down to the isolation and container era you tend to have better separation between development, test and production envs  but even with that is easier to manage dependencies using this kind of systems. For this blog post i will show how to download, install and configure rvm and install a ruby version on it for Ubuntu Linux.

Setting up a Ruby env with Vagrant and RVM

Image
If you use windows and want code in Ruby you need use vagrant or docker because most of libraries does not for for windows at all - same happens for nodejs and python lots of libraries just dont work :(. I was trying to play with some static site generators like this and this one here . But unfortunately i use windows so vagrant pretty much made my day :-) This is pretty easy, once you have vagrant installed you just need do $ vagrant up with my Vagrantfile and them the rest will happen under the hood. You just need put RVM in your path because start using ruby - the command is on the Vgrantfile, you just need to source it and thats it.

Fun with Neo4J and JRuby

Image
Neo4J is a graph database built in Java with full support for Transactions. It work with nodes and relationships, you're able to put properties in both, graph structure are very simple structures but have great expressiveness and great work for some problems domains. Graph are perfect for social media, because you have friends and the friends have friends and they have twitter, email, cellphone. You do have properties on the relationship like for how long time you know that find or where did you meet him last etc. This is the classical Matrix movie relationship sample. Let's see how we structure this graph on code, I will show ruby code through JRuby. I made some changes and add new properties but the relationship didn't change that much.

Having Fun with Ruby

Image
You should try Ruby language . Ruby is a OO development language created by a Japanese called Yukihiro Matsumoto in 1993.  It's a old language BUT far to be on the mainstream. Ruby is a niche language, I don't dare tell what will happen in the future BUT I see Ruby more and more stronger in world and Brazil as well. Part because Java community is detaching(caused by ORACLE actions). There is a first strike that get you if you start coding with ruby. I called "It works :-)" If you work with Java you know what I'm talking about. Learn Java eco-system is hard and take long time, things are complex and often stuff that you get on the web just don't work. How many times did you get a tutorial or a blog post code that don't work because version of some jar that change, missing dependencies, environment setup and so on and on. You get really happy coding and learning Ruby because everything that you get on the web works, it's amazing y...

Redis at NOSQL Playground

Image
NOSQL is a movement is around for long time ago but since 2009 is getting stronger and more consistency. Relation data based have they place and they always will have BUT besides the scalability that in some scenarios is more a matter of cost in other Relations Databases is really the wrong choice not just because scalability BUT is a matter of design and complexity X simplicity. The Right structure have a huge impact on the complexity/simplicity of the code and design and have said that this maybe or may not create performance issues. Is a common sens that Relational Databases have beens overused in this last 3 decades. There a debate about the name, my take on that is that is not only SQL and you must consider different databases or data structures in your solution toolbox.

Consuming SOAP Webservices in Ruby

Consuming soap webservices in ruby is dead simple. I will show to do it with Savon a great ruby library to work with soap webservices. For testing purposes I will use this public soap webservices that give me information about the periodic table. In order to install Savon just type in your command line: $ gem install savon After installing Savon, lets try some code require 'rubygems' require 'savon' client = Savon::Client.new do wsdl.document = "http://www.webservicex.net/periodictable.asmx?WSDL" end puts client.wsdl.soap_actions response = client.request :wsdl, "get_element_symbol" do soap.body = { :ElementName => "Zinc" } end In the code showed above I'm importing savon and rubygems as well(so I can ruby without command line arguments) and I'm creating the SOAP client, when I do that I tell savon where is the wsdl through wsdl.document. The method client.wsdl.soap_actions provide me a list of all soap...