Ozzie.eu

Love to code, although it bugs me.

Free ebook: Introducing Microsoft SQL Server 2012

Here is a very nice freebie from Microsoft Press. The final and complete version of Introducing Microsoft SQL Server 2012, by Ross Mistry (@RossMistry) and Stacia Misner (@StaciaMisner), is available as a free download. Introducing Microsoft SQL Server 2012 includes 10 chapters:

PART I   DATABASE ADMINISTRATION (by Ross Mistry)

1.   SQL Server 2012 Editions and Engine Enhancements

2.   High-Availability and Disaster-Recovery Enhancements

3.   Performance and Scalability

4.   Security Enhancements

5.   Programmability and Beyond-Relational Enhancements

PART II   BUSINESS INTELLIGENCE DEVELOPMENT (by Stacia Misner)

6.   Integration Services

7.   Data Quality Services

8.   Master Data Services

9.   Analysis Services and PowerPivot

10.   Reporting Services

 You can download the PDF version of this title here (288 pages; 10.8 MB).

Happy learning.

Microsoft Team Foundation Server - Antivirus folder rule out

Using corporate servers on a security aware organization implies that the IT governance policies enforce a network distributed and update antivirus software.
The bad news are that if a fine tuning and folder rule out policy is not in place, the database servers and application server will have their performance seriously compromised. The On-access scan feature will perform its own DoS attack on the hosts.
According to the server role, the adequate folder need to be ruled out from the malware scanning engine.On this specific post, you can find a lead on what folders should be ruled out on a Microsoft Team Foundation Server.
On the database server (MS-SQL) you should obviously rule out the path to the data volumes (.mdf and .ldf files) supporting the TFS.
On the actual TFS server, the following folder should be ruled out:
  • C:\Program Files\Microsoft Team Foundation Server 2010
Mind that if you opted to setup the Team System Web Access on a different folder than the default, than that folder should also be ruled out from the On-access scan engine.

HTH.

Test open network ports using Powershell

Most frequently when deploying new scenarios, the task of network connectivity validation has to be performed.
Commonly this is performed using a command line and issuing a “telnet” connection to the desired host on a given port. This is nice when you have a single machine with a couple of connections to be tested.
When the scenario involves tens of machines with different network connection requisites between each other, the telnet procedure is a very slow process, being the typical test cycle:
  1. Open command prompt.
  2. Issue telnet to a given host and port.
  3. On success, close window and return to step 1.
  4. On failure, wait for timeout.
  5. Authorize the network port that failed
  6. Repeat step 2.
  7. On success go to step 1.
This isn’t a time effective test cycle. The ideal test cycle would be:
  1. Open command prompt.
  2. Issue command or script to test all destination hosts on desired ports.
  3. Check status and authorize failed network traffic.
  4. Repeat step 2 and check for success.
The two most annoying things about telnet are that you need to close and open a new window on success and you have to wait for timeout on failure.
To surpass these annoyances, one can use this Powershell function “Test-Port”, available from the Microsoft Technet Script Center Repository.
The syntax of the base usage is really simple. To test conecctivity to this site:
Test-port -computer blog.ozzie.eu -port 80

To address the fact of the ever growing shared network resources to be tested, an Excel spreadsheet can be used to generate the test battery script. Here’s an example you can view and download:





Afterwards, you just copy/paste the powershell column to a .ps1 file. I’ve also included a regular command prompt test column.


HTH.

Python, Oracle and LOB objects

The Python programming language is my preferred tool to develop quick and (sometimes) dirty scripts to perform single shot data processing tasks.
Recently, one of these tasks  involved querying a table with a LOB column that stores XML strings. So the challenge was to read the LOB column and parse as string to dump the records to file.
My setup is Python 2.7 with the CxOracle 5.0.4 library. The first try I ran into the “LOB variable no longer valid after subsequent fetch” exception. According to the documentation this is because internally, Oracle uses LOB locators which are allocated based on the cursor array size. Thus, it is important that the data in the LOB object be manipulated before another internal fetch takes place. It also states that the safest way to do this is to use the cursor as an iterator.
Well, that’s all very nice, but I wouldn’t hang a cursor on a whole table, fetching the records one-by-one and processing the whole XML before going for another fetch. That’s not advisable on an OLTP database.
My solution and suggestion to other python users is to perform a two step fetch process:
  1. Fetch all relevant primary keys from the table;
  2. Fetch the LOB column one-by-one using the PK list from the previous step.
To whom it may interest, I also make available the ode snippet from the LOB reader function:
def executaQueryLOB(txtQuery):
    import cx_Oracle
 
    orcl = cx_Oracle.connect('yourConnectioString')
    curs = orcl.cursor()
    curs.execute(txtQuery)
    result=curs.fetchall()
    strLOB=result[0][0].read()
 
    orcl.close()
    
    return strLOB
HTH.

Cartão de Cidadão – APIs de Desenvolvimento

De acordo com as notícias da actualidade, nomeadamente esta do Jornal de Negócios e esta da Semana Informática, as aplicações relacionados com os serviços da Administração Pública vão apostar fortemente na integração com o Cartão de Cidadão.
Esta aposta confirma-se com a publicação no Diário da República da Resolução do Conselho de Ministros nº.12/2012, de 7 de Fevereiro de 2012 que aprova o plano global estratégico de racionalização e redução de custos com as TIC na Administração Pública, apresentado pelo Grupo de Projeto para as Tecnologias de Informação e Comunicação (GPTIC).
Posto isto, é relevante fazer um levantamento do que existe actualmente que posa servir de base e acelerar o desenvolvimento da integrações do Cartão de Cidadão nas aplicações.
Numa pesquisa pouco exausta na Internet, aparecem os seguintes projectos:
O middlware do cartão é sempre necessário, de modo que na realidade apenas enumerei um projecto de terceiros que age com um wrapper .NET que expõe a API de interacção com o smart card.
Fica aqui o desafio de colocarem nos comentário a a esta mensagem algum projecto que conheçam ou usem e não esteja entre os referidos.

Windows Monitoring – Codeplex

CP_banner_111x111_gen.jpgAfter three and a half years, time came to update a personal project hosted on Codeplex. It’s called Windows Monitoring.
This project is meant to provide programmers with a set of reusable classes, gathered into one assembly, to develop custom system monitoring consoles for windows server systems.
The base set provides classes with methods to check:
  • Network ping
  • HTTP server running
  • FTP server running
  • Disk space on system hard drive
  • Database availability
Open for evolution is the adittion of methods related to Mail Servers, such as Exchange, or Domain controllers.
I took the dust off the Codeplex account, logged in using Visual Studio 2010 together with Team Explorer and migrated the code from .NET 2.0 onto 4.0.
The update projects and source code can be browsed and downloaded. If you don’t have Visual Studio, but some other IDE, you can download the assembly on the recommended release and use the tester source code as a usage example.
Happy coding!

Manually placing pending OneNote updates to SkyDrive

I use Microsoft’s Office OneNote from Office 2010 for the all-purpose note taking that goes on a daily basis. Some time ago, changes on the workplace corporate network blocked the Skydrive sync feature.
On a careless fashion, I kept taking notes from tasks and e-mails and the pending updates stacked up. Final picture: ended up with a really stuffed set of notes missing from the online service.
No matter how I tried to start the process, the merge between the notes always failed on the Windows Live ID login step.
The web browser view on Skydrive presents the notebook as a single item, but OneNote stores the different sections of a notebook on separate “.one” files.  For the whole notebook there is a table of contents “.onetoc2” file. So the potential solution was to replace the Skydrive files with the local backup files that had all the recent updates.
The solution wasn’t feasible on the Web browser Skydrive functionality, as it presents the notebook as a single item. It was a four step process:
  1. Get Skydrive to open on Windows Explorer.
  2. Backup your online notebook to a local folder and open it.
  3. Open the files from the local OneNote backup folder.
  4. Copy the local files over the old ones.
To get skydrive as a local shortcut that opens on Windows explorer, you can follow the instructions here.
Backup your online copy to a local folder. Open the notebook on OneNote.
To get the local backup of your skydrive files, it should be on a folder path like “C:\Users\[Your user name]\AppData\Local\Microsoft\OneNote\14.0\Backup”. Replace [your user name] with the real deal. Open the notebook on OneNote.
With both versions of the notebook open, check if there are missing notes and copy/paste them into the copy with the least updates missing.
Finally, copy the whole “.one” files from the updated version, replacing the ones on Skydrive, using Windows Explorer.
HTH.