Category Archives: Uncategorized

Changing the remote repository in git

I needed to move a project from Bitbucket to Github.

I was expecting a little dance to be made there, but it was pretty straightforward:

In a terminal, at the directory where I have my project, just did a

 

Facebooktwittergoogle_plusredditpinterestlinkedinmailby feather

USB tethering with the Mac

I am in the train to Cork today, and being two and a half hours trip I am using the time to work a bit in my Fabric scripts.

Something I usually do is to get updates and packages form the Internet, and while the wifi connection in the train is good for browsing, getting updates is slowing it to a crawl.

I realised that the USB tethering connection with my phone was not recognised by the Mac, and have to download a driver for it, which worked very well after a reset.

The code is in github, together with a compiled package too.

Facebooktwittergoogle_plusredditpinterestlinkedinmailby feather

Changing hosting

For a good number of years I was using Hosting365/Register365 as my hosting service. I was with another crowd before, but around 2005 I wanted to make some experiments with web applications in .NET 2.0 and they were the only company I found in Ireland offering it.

Later I added a Unix hosting (which was cheaper and gave me the chance to learn a bit about Linux in real life), dropped a few sites there and basically forgot all about it. Now and then I logged in to do some small thing, but I never really interacted with the site or its tools.

Time passed, and they merged with another company, put a fresh site and hosting plans, and since then I really tried to avoid doing anything around. It was too confusing and gave me little satisfaction. Lucky enough the sites were more or less on autopilot, and I liked that situation.

But, two years ago my friend Rob started working in wripl, and when I tried to deploy their plugin in WordPress, it asked for updates that I wasn’t able to apply with my existing hosting.

I messed around, not really wanting to deal with all of that, and soon realized that I needed to change my hosting plan. But then, it would just make sense to unify Windows and Unix into one account (I am not using ASP.NET anymore for web hosting), and then I had to do a lot of migration work that I didn’t want to do, and then I would need to pay just a bit more, and then… I quitted.

Some of my friends (including wripl) recommended Blacknight, and I know one of the founders from my involvement in MTUG years ago, then it looked like a good candidate.

I went to their site, bought the hosting and I was sorted, sort of. I had to move the sites from one hosting to the other, then I realized that all the backups that I was doing from mySQL were useless, then I couldn’t figure out where to put my files. The documentation in Blacknight is less than spectacular, and at least for me fairly confusing. After an afternoon messing around I started getting frustrated, and my friends didn’t remember how did they do anything there either.

The next day I started from fresh, created a trouble ticket and then tried the support chat. Both were very good, nearly the same response time (from two different contacts, on a Sunday afternoon), and things were resolved quickly. Both the tools and files location are different than in Register365, but once you get the idea of how things work they are good for my needs. Creating an SQL script to import the database was a bit more tricky, because one of them was around 50 MB and the import process didn’t like that, but splitting the text file was the solution.

In the end I am very happy with the move, and hopefully will stay the same.

Facebooktwittergoogle_plusredditpinterestlinkedinmailby feather

An interesting presentation from Netflix

During my work at emuse I got somehow familiar with some of the technologies in Netflix. They have an interesting recommender, and make contests to enhance it too, then I try to follow their adventures.

Some time ago I found a presentation about the culture in Netflix done by one of their executives as a stack in SlideShare, and I would like to keep the reference around.

In my case I am probably lacking many of the conditions they like (I remember a story about Bill Gates saying that if he had to apply to work in Microsoft they would probably not hire him), but it is an interesting goal trying to achieve them even though I am not interested in working there.

And if I ever manage to have my own company again, for sure I will try to have a similar culture in place.

Facebooktwittergoogle_plusredditpinterestlinkedinmailby feather

Installing MongoDB in Ubuntu

This morning I was deploying MongoDB in a few machines under Virtual Box, and had to look for the same commands a few times. Just as another note to myself, I wil have them here.

Add the key to the repository:

  • sudo apt-key adv –keyserver keyserver.ubuntu.com –recv 7F0CEB10

Edit the sources to include Mongo:

  • sudo gedit /etc/apt/sources.list.d/10gen.list

and add the following line:

  • deb http://downloads-distro.mongodb.org/repo/ubuntu-upstart dist 10gen

And then get it installed:

  • sudo apt-get update
  • sudo apt-get install mongodb-10gen
Facebooktwittergoogle_plusredditpinterestlinkedinmailby feather

Ask git to remember your credentials

I searched for the tenth time how to tell git to remember my credentials in github, then it is time to make a little note to myself.

I am running a few instances of Ubuntu, and each time I want to make a pull from Github I need to enter my username and password.

To tell git to remember them, just do

git config credential.helper store

and then

git pull

After entering name and password one last time, those details will be remembered later. The credentials are stored in the disk, with the disk permissions. In my case, that is good enough.

Facebooktwittergoogle_plusredditpinterestlinkedinmailby feather

The Hexagonal Architecture and the pot of gold

As part of my research, I was trying to see how the big traffic sites are implemented. A lot of things are going around, a few diagrams are popular, but the main point seems to be able to distribute your code in as many machines as practical, as cheaply as possible.

That is good and reasonable, but in the end, my question was still ‘how do you do your code?’. Going specifically to it, the spectrum is broader, and you can find from massive spaghetti code, to massive structures done under industrial ideas and everything in between.

From all those approaches I liked most the DDDD approach, it being a distributed domain driven design. I knew DDD already, and the distribution part just made sense.

There are again a few different approaches to it, but being in .NET NServiceBus is the one I choose to follow, so I spent some time around it, and again, it makes sense when you look at the problems it is trying to solve.

But even than it makes sense, something was missing in the picture, at least the picture from the web site and mailing list. It looks more than a bunch of libraries (with very good reasons behind), but still suspiciously close to ‘use this technology and everything will be great’. I know that each one making that statement probably mean it, but I heard it too many times to believe in ‘technology’ solutions.

And then, I found CQRS, and from some video got the magical words ‘hexagonal architecture‘. It is a pattern, and as usual with them is deceptively simple. Instead of being concerned about a long line of code blocks calling one to the other, make it a single, tightly coupled core dealing with the outside using adapters. In particular, take the data layer outside of your model, and make it an external service.

I just loved the idea even before reaching the end of the article, but found it difficult to explain it to others. ‘What is the new thing about it, compared with any other data access layer?’, I was asked, and heard me babbling as I usually do when too many ideas jump in my head, obvious for me and nobody else around.

Now, the important thing for me is (and I just realized it a couple of hours ago) that instead of the situation from the last ten years with an object model and a relational model living in the same chunk of code (being it a single library or an arbitrary number of them but all related and interdependent), you can have only one model on each application. One for the domain, one for data storage, one for the external API, one for UI, one for Santa Claus if required. That is brilliant!

Do you have a business operation that you want to model? Do it disregarding anything about data storage or user interfaces. Make your model, make it the best you can, as simple or complicated as you need, and then request services from others (the main suspect the database) and provide services for something else (a UI or an external consumer).

The magic is, in your domain model now you really, but really really, don’t care about relational data. It does not matter if you have SQL or not, if you use an ORM or directly call ODBC. Data providing will have its own application, and the model in it will be only relational (or whatever you want). No business logic there, you don’t care in data storage about validating, or cascading activities, or logging or anything else. Your data storage application will only be concerned about storing and retrieving data. Just data. Genius!

There is nothing new in there. That should have been the role of the data layer. but the thing is, I never saw it so clearly separated until now. The theory was right, the implementation always ended as a mess and a bigger or smaller monolithic application.

The philosophy is even older, I still remember talking with people inĀ FidoNetĀ about the theory of Unix, and being thinking ‘what is a theory of an operating system? It is just a big program!’ without realizing that probably a very important concept was the fact that each operation is auto contained. You have twenty small applications and you pipe the results from one to the other. There is no need to solve the big problem (taking months or years of development), just do an application as small as possible, involving one activity to model, and off you go. It is a different implementation, but the concept is the same, and I love it.

How do this translate to my daily practice? Well, now I can focus in one thing at a time. I can do the model for something I need, finish it, and forget it. Then I can do the data storage. Or the UI, or some other atomic model. I can keep the external references outside, and prepare a bit of code to emulate the real thing until I have time to do it properly. Basically, I can advance a step at a time, and not be concerned about a landslide sending me back to the starting point. And I even get an extra bonus, because now application distribution is trivial, everything is distributed from the start!

NB: I am talking again to you, monkeys, it looks like we stroke gold here. Instead of being concerned about how long we will need to work until having something useful, we can make it as small as needed to be done in the available time, and still get something of value. Solid, commercial value, not just learning something new or doing something interesting. Are we going to stay sleeping or can we take the opportunity to eat an elephant a bit at a time? It is soft, it is golden, can we check if it is real gold with code?

Facebooktwittergoogle_plusredditpinterestlinkedinmailby feather

A tip using Launchy

As part of my current toolbox, every day as soon as the PC boots I start TrueCrypt, Evernote, Remember The Milk, Total Commander, Dropbox and Everything.

Going through each was taking a couple of minutes every morning, even using Launchy. After a while I did some research about how to automate the task, with the result of a small batch file called ‘all.bat’ having the following code:

@echo off
if not "%1"=="" "c:\Program Files\Truecrypt\truecrypt.exe" /auto favorites /password %1 /quit
if "%1"=="" "c:\Program Files\Truecrypt\truecrypt.exe" /auto favorites /quit
echo TrueCrypt ready
start /d "c:\Program Files\Evernote\Evernote3.5\" Evernote.exe
echo Evernote ready
start /d "c:\Program Files\Total Commander\" totalcmd.exe
echo Total Commander ready
start /d "c:\Program Files\Everything\" Everything.exe
echo Search Everything ready
start C:\Users\shanahane\AppData\Local\Google\Chrome\Application\chrome.exe --app="http://www.rememberthemilk.com/offline"
echo Remember the milk ready
if not "%1"=="" start C:\Users\shanahane\AppData\Roaming\Dropbox\bin\Dropbox.exe /home
cls
exit

When I am ready, I just call Launchy with an Alt-Space and write all, press Tab and then write the password for my TrueCrypt disk. A few seconds later I am ready to go.

Facebooktwittergoogle_plusredditpinterestlinkedinmailby feather

WordPress user/password problem

I was having problems with my login in WordPress. The first time everything worked fine, I went in and created a new user with my name (instead of the admin user), loged out as admin and in again as the new user (Eduardo), did my first post and shut down the computer.

Next day I tried to log and get kicked out, tried to regenerate the password and the validation failed. In the end I followed the instructions in the WordPress phpMyAdmin guide and changed the password again. Doing that I realized that the email address of admin and my new account were the same, so I changed them as well.

Facebooktwittergoogle_plusredditpinterestlinkedinmailby feather