How to view documents using Visual Studio

View documents in Visual Studio with an amazing tool

Xpath Axes

A very useful trick for automation

Review: Spire.DataExport for .NET

A great tool for exporting data in .NET

How to install Arch Linux, step by step, for VMware Workstation (Part I)

First part of a installation tutorial for this beloved OS

How to setup a local repository in Ubuntu

The steps to have a local repo in Ubuntu

Thursday, May 29, 2014

Do you want to learn Python? Check this

I could say this is a classic. I know that a lot of people already know this, but I think that beginners will find it very, very useful.

When learning any programming language it's vital to have good code as example for our own creations. Also, Python is a great way to learn programming, I think better than Java, without messing your brain up with anti-patterns in your code.

Having that in mind, one of the best challenges for beginners is to create a program that solves a Sudoku game. For those who don't know the game, you can read about it here.  It's basically a mathematical game that consists on sorting numbers. I'm sure you've seen some Sudokus in the news papers. Now, for programming, the different solutions for this problem lead to some interesting mental exercises, and it looks like Peter Norvig thought the same.
Norvig is a computer scientist now working for Google. he has a lot of articles, presentations, speeches, etc., available online. You should check his webpage, it has some interesting material.

However, what really got my attention was this article. It's a comprehensive manual on how to beat any Sudoku puzzle with a simple application in Python. What is interesting about this article is that he explains how he did it with full details. It begins with the algorithm, and goes on to finish with the complete code. 

My advise:

a) Read the whole article very carefully.
b) Download the code and modify it. For example, you could add a graphical interface with Jython.

Of course, you should have some basic programming skills, but I'm sure that you'll learn a lot from this great article.

Monday, May 26, 2014

Share internet connection from PC to Android device

There are some situations on which you'll need to share internet from PC to your Android. For example, there are some security policies in certain offices that restrict WiFi connections severely. So, if you need to perform any operation in your phone and don't want to spend money with the cellular connection, you can use this trick.

Note: I used a Samsung Galaxy Note 3 as example for this article.


  • A rooted Android device.
  • The USB drivers for your phone installed.
  • The Reverse Tethering tool. Download it here.


1. In your phone, go to Settings>Developer options
2. Select USB debugging
3. Open SuperSU>Settings>Uncheck "Show Notifications"
4. In your PC, extract the Reverse Tethering tool.
5. Connect your phone to your PC.
6. Open AndroidTool.exe
You'll see panel like this:
7. Click "Connect". You'll be prompted to gran some permissions in your phone. Just accept them. If everything's fine, you should see something like this:
Notice the data statistics. Now, if you go to any browser in your phone, it should have access to internet. Job's done!


The first time I used this tool I couldn't reach any site from my phone. I tried to use the tools from the tool to kill the ADB service, but it didn't work.
I also tried to kill the process with the Task Manager, but it doesn't work. At least the first time, I think it's better to reboot your PC. For some reason, killing the service manually worked on later tests. Remember that this is a unstable process.

Sunday, May 25, 2014

How to execute test cases in Java in a specific order

Some time ago I wrote about TDD, and you may have realized that writing test cases is a big part of it. Playing a little bit with Java I realized that there are some practical problems with JUnit, which is the library used to run test cases. For example, you cannot choose the order of the test cases. I know that the test cases should be independent between each other, but this is not always applicable in the real world, especially when there are really big test cases.

A simple solution for this particular problem is using TestNG. It's just another library with its own functionality, that allows specify the order of the test cases in Java. Here's how to use it.


Get the TestNG plugin

1. Open Eclipse
2. Go to Help>Install New Software

3. Click Add.
4. In Name, enter "TestNG". In Location, enter Then click OK.
5. Select the "TestNG" checkbox and click Next.
6. Click Next again.
7. Accept the terms of licence and click Finish.
8. Press OK in the Security Warning.
9. Press Yes to restart Eclipse.

Write a script to test

1. Reproduce this structure:
2. Right click in the Project folder>Build path>Add Libraries...
3. Select TestNG and click Next>Finish.
4. Open the file and enter the following code:

Here comes some explanation about this:

a) In this part:

public class Testools {

You may have noticed that the class does not extend TestCase. That's because we are not using JUnit anymore.

b) There are annotations on the methods:

@Test (priority = 3)
public void first_test() {

These annotations are part of TestNG. They tell the methods what to do. If you remember, in JUnit you have to put the "test" word before the method name to indicate that this is a test, but this has obvious disadvantages (e.g. you can't add more tags for different frameworks). Annotations provide advantages such as flexibility, naming the methods without restrictions, additional parameters in the annotations, etc.

In this case, an additional parameter sets the order in which the test cases will be executed:

priority = 1 --> This is the first to be executed.
priority = 2 --> The second to be executed
priority = 3 --> The third.

5. Run the test cases. Open the menu in the "Play" button>Run As>TestNG Test
6. This simple test cases shouldn't take too much to finish. After that, check the console in the lower part of the Eclipse dashboard. It should look like this:
Notice that the execution order for the test cases is the same than the order in the script. Well, this is just a glimpse of what TestNG can do. You can check the official website here. It's worth giving it a try!

Monday, May 19, 2014

VMware slows Linux down: Here's the solution

As I'm using elementary OS more and more, I installed VMware Workstation 10 to start my regular work, but I noticed that the whole machine was getting slower. I tried to limit the memory for the VMs, but that didn't work. I even installed a new Lubuntu machine, which is supposed to be very light. However, that didn't solve the overall slow down, so I had to finish my work in Windows.

This is actually a big issue that I think deserves more attention from the eOS developers, sin VMware is (let's say it) the best virtualization platform available. And there's no too much information about it in Internet. However, here's an approach to solve this problem.



1. Open a terminal.
2. Enter the following command:

sudo gedit /etc/default/grub

3. A text editor will be opened. Change this line:


Into this:

GRUB_CMDLINE_LINUX_DEFAULT="quiet splash processor.max_cstate=1"
Save the file.

4. Enter: sudo update-grub. This will update the grub file.
5. Restart the machine.

If you are wondering why this works, the "max_cstate" value represents a level of "energy saving" for the processor. So, if the value is slower, the processor will be faster and consume more energy resources. As far as I tested it, there is not much difference, so I think it's a safe workaround for the problem with VMware. I hope this helps all the newbie Linux enthusiasts!!

Saturday, May 10, 2014

Brands vs. quality

I know the title for this article is even offensive to some people. I know some friends that identify quality with brads directly. Just like that: Brand = Quality. I know this can be true for a lot of buyers, but when you studied just a little bit about the subject, or if you stop and think about it once in a while, you realize that brands are just an strategy for marketers to sell their products.

I mean, sometimes you buy the brand just to show off. That's good sometimes, but it can get ridiculous when you buy a piece of junk with a "jewel" label. It makes me think that buyers (I'm included) are very likely to be brainwashed maybe too easily.  And that gives the prize not to the best in the market, but to the brightest brand. Sometimes we're just eager for some fool's gold.
I recently heard about the last acquisition of Apple: Beats Electronics, the creators of the famous Beats By Dre headphones. It drove me nuts. I could understand that from any other company, but Apple? The Steve Jobs' company buying some overpriced headphones just for the brand? Where is the quality they always claimed as the basis? (just in case, you can read this article to check some other opinion on this subject)

It got even worse. It makes me think that I myself was brainwashed for a while too. Who knows if the iPhone is really the best phone in the market? How much does it take to make a single iPhone? Does it have all the features you can find in other devices? This also apply for the iPad, the Macbook Air and all the other iProducts. Who knows if Apple is more brand than quality at the end of the day?

Marketers at Apple are superb...that is a tradition since Jobs' great presentations some years ago. But remember this: When the iPhone got into trouble with the antenna, Steve Jobs manipulated everyone (again, including me) into thinking that this was a universal problem. It's like justifying my writing mistakes showing some statistics of bad orthography in internet. It is all part of a marketing plan. 
I'll wait until I see what happens with new acquisition by Apple. For now, I don't like.

Wednesday, May 7, 2014

Manage a machine from Jenkins without adding it as a node

Jenkins has proven to be a great and useful tool. You can do virtually anything with Jenkins, as long as you are familiar with it details and some other tools, like Ant. I've written a couple of articles about Jenkins (you can read them here), and as the time went on, I realized that you can improve the performance of Jenkins as well, just making some changes in the structure.

For example, when you need to perform silent operations in a computer, theoretically you don't need to add it as a node. It is enough with a ssh connection and some ant files. I'll show you how I do it in this article.


  • A computer where the actions of Jenkins will take place with Cygwin+ssh installed (you can install it offline if you need it) and Ant (ANT_HOME must me added to the path). I'll assume you are using a Windows machine, but if you are using a Linux one the steps are identical.
  • A computer with Jenkins installed.


First, I'll try to have things automatized as much as I can. So, I'll try to avoid installing things in the "client" computer every time I can.

1. From the Jenkins main dashboard, got to: Manage Jenkins>Manage Plugins.
2. Open the "Available" tab and enter: publish over ssh
3. Select it and press Install without restart. Wait until the plugin is installed and you'll see something like this:
Click on "Go back to the top page". If you have to install any other plugin, just follow these steps again.

4. From the Jenkins main dashboard, go to: Manage Jenkins>Configure System. There, look for the "Publish over SSH" section. There click on "Add".
5. You have to register a SSH Server for every machine you want to manage with this method. Fill the field as follows:

  • Name: A name for you to use. This can be anything, but I suggest to put something descriptive, like "DB Server".
  • Hostname: the name or the IP number of the machine you will manage.
  • Username: The username registered in Cygwin.
  • Remote Directory: This is the directory that will be used as base by Jenkins. You have to use the Cygwin format for this. For example: /cygdrive/c/ for C:\.
Now, click "Advanced".

Select "Use password authentication, or use a different key" and enter the password you use for Cygwin in the corresponding field. Finally, test the connection pressing "Test Configuration".
Then press "Save".

6. You need to create a build.xml file in the "client" machine to perform the actions you want. You can use this example and place it in C:\.

<project name="CreateFolder" basedir="." default="main">
    <target name="create_folder">
        <mkdir dir="testools_folder"/>
    <target name="main" depends="create_folder"/>

This will create a folder. It's not much, but it's just an example of what you can do with this method. The Ant files can do almost everything.
7. Create a job in Jenkins to use the Ant file in the Client. To do this, go to the main Dashboard in Jenkins and click "New Job".

8. Write a name for the job and select Build a free-style software project. Then press OK.
9. In the "Build" section open "Add build step" and select "Send files or execute commands over SSH"
10. In Exec Command just enter this:

cd /cygdrive/c

You just need this command to execute the build.xml file you placed in the Client machine. However, your commands here can be as complicated as you want. Then click Save.

11. Click "Build Now" to execute the job.
12. Once the job is executed, check if the folder was created in the Client machine.
And that's it! Jenkins can be tricky at first, but once you get used to it, it's very, very useful. Enjoy it!