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, June 27, 2013

Managing apps via GPOs with PolicyPak (great tool)

PolicyPak is a Windows application created to work along with Active Directory. But this is not just another application. It is a smart way to enhance the possibilities of Active Directory and the Group Policy Objects.


What PolicyPak basically does is to manage almost all the configurations in Windows programs, through GPOs. This is great news for IT administrators, because it allows to configure all the Windows environments under Active Directory (AD) from a single point, keeping good practices and stable environments.

How does it work? Configurations are stored in "Paks". These Paks are configurations packages than can be customized. PolicyPak includes reconfigured Paks for many popular desktop applications, such as Mozilla Firefox, WinZip and so on.

In this article, I'll be focused on the most interesting characteristics of PolicyPak. The installation is not a big deal, and there are other features worth to mention. Anyway, I'll list the requirements for the program, and the basic structure to install it.

Requirements:

1 Administration Computer (XP, 7, 8) in an AD domain: You'll control PolicyPak from here.
  • GPMC must be installed. Get it here for Windows XP (we'll use this OS at the end of the article) or here for Windows 7/8.
  • PolicyPak Admin Console.
  • PolicyPak Creation Studio (Optional. It is used to edit our own customized Paks)
  • The "pp-WinZip.dll" file in the C:\Program Files\PolicyPak\Extensions folder. You can find the dll file in the installation package, in the following path: PreConfigured PolicyPaks - Production(556 or 557).zip\PreConfigured PolicyPaks - Production\WinZip (14 and Later).

1 Client Computer (XP, 7, 8) in an AD domain: This will be a computer controlled with PolicyPak.
  • PolicyPak CSE.
  • WinZip installed. Get an offline installer here.
1 Domain Controller: You don't need to install anything here, but I'm mentioning it since you need an AD domain. In my case, I created the test.com domain. If you want to know how to set up that, read this.

What I specifically used was:
  • Administration computer: Windows 8. To use GPMC, I had to install Remote Server Administration Tools for Windows 8. And make sure that the user assigned to this computer is in the "Domain Admins" group in the Domain Controller.
  • Client computer: Windows 7 with WinZip installed.
  • Domain Controller: Windows 2008 R2.
  • Domain: test.com
Everything with Virtual Machines. I'm assuming that PolicyPak is already installed.

Now let's see some cool features of this useful program:

Simple app management

First a simple example. Create a GPO for testing:

1. In the Domain Controller, create an OU and include the client machine on it. Also, include the user that will be using that computer in that OU. You'll get something like this:

I created an OU called testools, and included the client machine and a user in it.

2. In the Administration Computer, open GPMC and create a new GPO on the OU you just created. In my case, I created a GPO called "Pak" on the "testools" OU:

3. Let's try some basic features of PolicyPak. We are going to configure the columns of the main screen of WinZip. To do this:

3.1 Right click on "Pak">Edit
3.2 In the "Group Policy Management Editor" window, expand "User Configuration">"PolicyPak">"Applications", and select "Applications".
3.3 Right click on "Applications">New>Application>PolicyPak for WinZip 14 and Later
3.4 Double click on "WinZip 14 and Later" in the right pane. Now, a window will opened and there you can configure anything you want, just about any configuration available in the application itself (WinZip). As an example, I'll configure WinZip to have only the following columns: Name and Type.
This is just an example. The following picture shows in a clear way the capacity of PolicyPak. As you can see, you can manage all the option from an application from an Administration Computer with PolicyPak in an AD environment.

Here are a couple of amazing features I wanted to write about:

ACL Locdown

This is interesting. If you are following my actions, you may have noticed that even if you change a setting, the user can still change that setting and use the application that way until it is closed and opened again. This weakens control over apps. Nevertheless, PolicyPak includes ACL Lockdown.  This feature consists in literally locking the settings you want to lock, even if the user changes it in a session. Here's an example:

1. The user opens WinZip. It will be configured according to what was set with PolicyPak. In this case, I'm setting the minimum password length to 15.
2. Now, configure WinZip in the Administration Computer. Right click on password length box>click on "Perform ACL Lockdown"
3. The user open WinZip and finds that the value for Minimum Password Length is 15. She tries to change it to 10, since she thinks that it will stay like that until WinZip is closed. But after closing the Options dialog and open it again, the Minimum Password Length remains 15. That's ACL Lockdown working.
You can use this feature with any setting. All you have to do is a right click and enable ACL Lockdown, in the same way of the example.

Item Level Targeting

This feature may sound familiar to those who work with GPOs a lot. It basically consists in filtering the different Paks that you have with almost any criteria you may want to use. In my example, I'll use two client computers, one with Windows 7 and other with Windows XP (with WinZip, of course).  I'll use just come methods to apply the Paks, but that's enough to let you know the great possibilities of PolicyPak.

First, we'll have both computer inside the same OU, in order to apply the Paks properly:
Now, go to the Administration machine and open the WinZip Pak. I configured the Minimum Password Length to 25. Now click on Options>Enable item-level targeting
You'll see a warning about the CSE Version in the client machines. Since we have the latest version, we'll just click "Yes".
Click Options again>Edit item-level targeting filters...
Here you can find an enormous collection of ways to filter the application of Paks. I'm going to pick IP Address Range, just because it was the first thing I saw. To do that, click on New Item.
We are going to apply this Pak only to the Windows 7 machine. Its IP is: 172.20.65.20. So, I'll configure the new item as follows:
Now I'll just press OK twice. Now, use gpudate to update the GPOs in both machines and open WinZip. It looks like this:

As a conclusion, It could be said that PolicyPak equals Control. This is one of the most useful and powerful tools I ever used, and it works right how we want. I recommend it.

For more information, visit: http://www.policypak.com/

Monday, June 24, 2013

Automate your tasks with Windows Automation



I was looking for a cool tool to automate my routinary tasks. There are thousand of tools in Internet and the problem is how to choose the best.

This time I found WinAutomation.

What I need is a tool easy to program and easy to learn.

The installation was pretty straightforward.

The tool is not free, but you can test it per 30 days and notice that it's worth its price (it's 285 $us each one, but if you buy more you can have great discounts!).

The tested tool was version 4.0.4.2093. If your version is higher you may have new features by now.

The tool contais great componets like tasks to compress Files, upload Files to FTP, handle the FTP server and Send emails.

For example, for FTP you can automate the Open FTP connections, delete files, rename files, create directories, syncronize FTP Directories (one of my favorite tasks), upload files and folders. The most powerful task is to invoke FTP commands.

Another great tool is Excel. You can automate your routinary tasks like launch Excel, Close Excel, Add a Worksheet and the most importat: Read from Excel and write to Excel.

For example you could Launch your Excel automatically and add the title, current date and copy some data automatically. After making some changes you could send the excel file attached automatilly.

This tool is amazing!
 
This picture shows the Developer environment. You can see the steps numbered, you can create comments and see the icons of the actions created for the tool.


The use is straightforward. You will feel pretty conformable to automate your tasks with this tool.

Monday, June 17, 2013

How to install Group Policy Management Console in Windows XP

A quick tip. If you are testing, sometimes you have to use old Operating Systems, like Windows XP. It's almost inevitable. So, since Active Directory is one of the most popular environment to test on, I'm going to show you how to install the Group Policy Management Console (GPMC) in Windows XP.

First, you need to download GPMC here. If you try to install it, you may get this error:

Please install the Microsoft .NET Framework before installing Microsoft Group Policy Management Console with SP1.

Like this!
If you get this, DO NOT install .NET Framework 3.5 or 4. The GPMC only detects .NET Framework 1.1. So, you can download it here.

After you have installed .NET Framework 1.1, you can continue with GPMC. Then, you can install the latest version of .NET Framework. It won't affect GPMC in any way.

Have fun!

Sunday, June 16, 2013

How to install Robot Framework with Selenium

Now here's something interesting. I already wrote about automated testing before, with Visual Studio. But I know that it is always good to have open source alternatives. Robot Framework is one popular testing framework. Maybe one of the interesting things about it is that it's pretty flexible. You can use it with a lot of libraries to extend its capabilities. One of those libraries is Selenium, a useful tool to test Web applications. It works pretty well, and it's very fast.

If you don't know what I mean by automation, you can check this article I talked about at the beginning.

Now, let's begin.

Requirements: 
  • Python installed. You can get the latest version here. 
Note: If you are using Box, it will stop working after installing the latest version of Python. I know, it sucks. That's why you should switch to Dropbox.
  • Python path added to Environment Variables: Here is how to do it in Windows 7. It is almost the same for other Windows versions:
    • Right click on "My Computer">"Properties">"Advanced system settings">"Environment Variables..."
    • In System Variables, click on "Path".
    • Click on "Edit..."
    • In Variable value, enter the following: 
;C:\Python27;C:\Python27\Scripts
You should see this:
Press OK.

I also had to do this:
  • Open a Command Line Console>Enter "PATH C:\Python27;%PATH%"
You'll also need the following files:
  • Robot framework installer. Get it here. I personally prefer the windows installer.
  • Selenium library for Robot Framework. Get the Windows installer here.
  • Selenium2Library. Get it here.
  • The Internet Explorer driver. Get it here.
Steps:

1. Install Robot Framework by using the installer you downloaded.
By the way, I hope they change that robot for logo...whatever. Just click "next, next, next" and wait for the installation to finish. To check if the installation was successful, go to C:\Python27\Lib\site-packages. You should see a folder called "robot" and a file from Robot Framework:
2. Install Selenium. I know that you could install everything from the command line, but there are a lot of dependencies to install Selenium, so it is possible to miss something and realize it when using the whole thing. To avoid such scenarios, I recommend to use the Windows installers.
After the installation finishes, you may check C:\Python27\Lib\site-packages to see if everything went OK.

3. Install Selenium2Library. This is necessary for managing the web pages. Extract the "robotframework-selenium2library-master.zip" anywhere.
Now, open a Command Line and go to the path where you extracted the file. Type:

python setup.py install

Hit Enter and wait. When it finishes, you'll see something like this:

3. Create Test Cases. Ok! Now you have all you need. Let's try to do something with this environment. Create a folder, you could name it "Tests". Inside, create the following structure (exactly, with the same names):
Extract the "IEDriverServer_Win32_2.33.0.zip" file and you'll see an .exe file. Copy that file to the "drivers" folder. Open a command line and type:

PATH C:\Test Cases\Tests\drivers;%PATH%

That's my case, you should write your own path to "drivers". If you turn the machine off, you'll have to do that again.

Go to "tests" and create a text file (I called mine "example"). Just to be clear:
Open the "example" file and paste the following text:

Save the file. Now, open a command line. There, go to C:\Python27\Scripts. The folder "Scripts" holds a script that runs the test cases files (like example.txt). The script that we will use is pybot. Type:

pybot "C:\Test Cases\Tests\tests\example.txt"


Hit enter. If everything is ok, you should see that Internet Explorer is opened to go to http://www.google.com. That's it! You have run a test case with Robot Framework and Selenium. As you may imagine, you can do anything with this, once you get used to the test case structure. I'll be writing about that in posterior articles.

For more information, you can go to:

https://code.google.com/p/robotframework/
http://robotframework-seleniumlibrary.googlecode.com/hg/doc/SeleniumLibrary.html?r=2.8.1

Tuesday, June 4, 2013

Useful details for using Python (ONLY beginners)

I'm new to Python. I come from a C/Java background, and there are a lot of details to take into account when using this new (to me) programming language. In this article, I'll explain some of the details I had to manage in order to properly use Python. Some of them can be seen just as opinions, so don't take it as rules.

Note: I'm using Notepad++ for editing code, so I'll use it here as an example.

Indentation

Indentation is very important in Python. In fact, if you don’t use it in a proper way, your code will fail. 
It possible that you use Notepad ++ to write code in Python, so here are some tips to get it work correctly:

1. If you don’t have it yet, download here. You need to have it installed.
2. Open Notepad++.
3. Go to Settings>Preferences
4. Open the “Language Menu/Tab Settings” tab
5. Set Tab Size to 4. This has to be done because Python use 4 spaces as indentation. Notepad++ may have a different value, so you’ll have errors if you use tab.
6. Check “Replace by space”. If you don’t check that, the tabs won’t count as spaces, and you’ll get errors.

7. Go to View>Show Symbol
8. Check “Show White Space and TAB”. This will display small dots to show whitespaces. This is useful to detect any error of indentation, since counting dots is easier than counting white spaces.

Constructors

Constructor methods must be named “__init__”. For example:


Self keyword

This is something I don’t like about Python. This language follows certain principles, called “The Zen of Python”. One of them is: Explicit is better than implicit.

So, they use “self” everywhere, although that could be implicit, just like the “this” in java. With this in mind, there are 2 simple rules:

1. If you are in a class, you have to use “self” as first parameter of every method. Also, you call methods with the “self” first. Here’s an example:

2. However, when you are not using a class, you don’t need to use “self”:

That prints the Fibonacci sequence up to a boundary of 2000.

Private methods

Actually, there are no private methods in Python. All we have is a way to mark the methods that are supposed to be private by adding 2 underscores (__) before the name of the method. Here’s an example:


Note that these methods are still accessible outside the class. The underscores are just signals that say “I’m supposed to be private!”  . Just in case, some people use a single underscore for the same purpose, and it works exactly the same way.

These are just some notes about Python. I’ll be posting more about it.