Ozzie.eu

Love to code, although it bugs me.

Showing posts with label Tools. Show all posts
Showing posts with label Tools. Show all posts

Yahoo's MySQL Partition Manager is Open Source

The guys at Yahoo released their partition management script on github:
At Yahoo, we manage a massive number of MySQL databases spread across multiple data centers.
We have thousands of databases and each database has many partitioned tables. In order to efficiently create and maintain partitions we developed a partition manager which automatically manages these for you with minimal pre configuration.
You can check out the original anoucement at the MySQL@Yahoo blog and the code at its github repo.

Developing a MySQL Workbench plugin

The MySQL Workbench tool is great for development and administration tasks. Also it's available on Windows, Linux and Mac OS X which, according to information from third party sources, is more than you can say for most of the other equivalent tools. And Workbench is free.
Having said that, most of the provided functionalities are intuitive and of daily use for developer and DBA staff alike. Moving beyond this rich out-of-the-box features set, Workbench empowers it's users to extend and develop their own custom features. For this purpose, we use both of the following:

  • GRT: Generic RunTime is the internal system used by Workbench to hold model document data. It is also the mechanism by which Workbench can interact with Modules and Plugins.
  • MForms: MForms is a small GUI toolkit library written for use in the MySQL Workbench project. 
MySQL Workbench is implemented with a C++ core back-end, and a native front-end for each supported platform. The custom plugins or extensions can be developed in python, using a general module structure, saved on a file named "*_grt.py".
I've developed a small proof of concept to learn how to code a custom plugin. The purpose is to provide a simple refactoring feature for the script on the SQL editor (basically it's a find and replace):
To briefly explain the code, first we import all of the workbench (wb) modules, grt and mforms:
# import the wb module
from wb import *
# import the grt module
import grt
# import the mforms module for GUI stuff
import mforms
Then we declare the module information, its name, author and version:
# define this Python module as a GRT module
ModuleInfo = DefineModule(name="Refactor", author="mjlmo", version="0.1")
Next we specify plugin internal name, tha caption to use on the workbench menu, what input we'll need to work on and which menu we want the feature to be available in:
@ModuleInfo.plugin("wb.text.refactor", caption = "Refactor Selection", input=[wbinputs.currentQueryBuffer()],  pluginMenu= "SQL/Utilities")
@ModuleInfo.export(grt.INT, grt.classes.db_query_QueryBuffer)
Finally, we insert the code to perform tha task in hand, in this case replace a selected text on the SQL editor with a given one on an input box. If there is no text selected, a message box will appear on screen stating that. Otherwise, we proceed with the refactoring operation.
To install this plugin, simply open MySQL Workbench, choose the "Scripting > Install Plugin/Module ..." option, browse to the "refactor_grt.py" file location and open it. Close and re-open the tool. There should be a new option on the "Tools > Utilities" menu called "Refactor Selection". Also, the plugin appear on the plugin manager:

You can read another full example regarding MySQL Workbench on how to define a module and define a plugin in Python here:
http://mysqlworkbench.org/workbench/doc/


Print tab separated values as table using MySQL

Using mysql command line utility to get recordsets, the data rows alignment and line breaks are often  a mess. You can use the command line tool on a mysql database server to get a set of rows into an output TSV file like so:
shell>  mysql -u your_user -p < your_statement.sql > data.csv
I came up with the following python script to grab the output file and pretty print:
You can put your own filename instead of 'data.csv'. And of course, this script also works for other TSV files that don't come from mysql. To run the script you should install the python tabulate package:
https://pypi.python.org/pypi/tabulate

mysqlpump — A Database Backup Program

The MySQL 5.7 Release Notes  for version 5.7.8 are out. Besides the new JSON data type, there is also a new tool, called mysqlpump, which offers the following features:

  • Parallel processing of databases, and of objects within databases, to speed up the dump process
  • Better control over which databases and database objects (tables, views, stored programs, user accounts) to dump
  • Dumping of user accounts as account-management statements (CREATE USER, GRANT) rather than as inserts into the mysql system database
  • Capability of creating compressed output
  • Progress indicator
  • For dump file reloading, faster secondary index creation for InnoDB tables by adding indexes after rows are inserted
This is great stuff, however it's still a release candidate so let me point out a caution warning left by Morgan Tocker on his blog:
... mysqlpump is not currently consistent. That is to say that currently each of the dump threads lack a synchronization point before they start backing up the data. This makes it currently unsafe as a general purpose backup replacement.
Happy testing!

Securing your MySQL server

After installing a MySQL database server, like the one I posted earlier, if it's going to be a production environment than you should consider securing the instance by eliminating some of the basic vulnerabilities that come with a generic install.
Fortunately MySQL and MariaDB already come with a tool for that purpose, called mysql_secure_installation. This program enables to perform the following improvements to the security of your installation:

  • set a password for root accounts.
  • remove root accounts that are accessible from outside the local host.
  • remove anonymous-user accounts.
  • remove the test database (if exists), which by default can be accessed by anonymous users.

Be advised that as of MySQL 5.7.2, this tool is an executable binary available on all platforms. Before version 5.7.2, it was a script available only for Unix and Unix-like systems.
Invoking the tool without any arguments:
shell> mysql_secure_installation
The script will prompt you to determine which actions to perform:
NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MySQL
SERVERS IN PRODUCTION USE! PLEASE READ EACH STEP CAREFULLY!

In order to log into MySQL to secure it, we'll need the current
password for the root user. If you've just installed MySQL, and
you haven't set the root password yet, the password will be blank,
so you should just press enter here.

Enter current password for root (enter for none):
OK, successfully used password, moving on...

Setting the root password ensures that nobody can log into the MySQL
root user without the proper authorisation.

You already have a root password set, so you can safely answer 'n'.

Change the root password? [Y/n] n
... skipping.

By default, a MySQL installation has an anonymous user, allowing anyone
to log into MySQL without having to have a user account created for
them. This is intended only for testing, and to make the installation
go a bit smoother. You should remove them before moving into a
production environment.

Remove anonymous users? [Y/n] y
... Success!

Normally, root should only be allowed to connect from 'localhost'. This
ensures that someone cannot guess at the root password from the network.

Disallow root login remotely? [Y/n] y
... Success!

By default, MySQL comes with a database named 'test' that anyone can
access. This is also intended only for testing, and should be removed
before moving into a production environment.

Remove test database and access to it? [Y/n] y
- Dropping test database...
ERROR 1008 (HY000) at line 1: Can't drop database 'test'; database doesn't exist
... Failed! Not critical, keep moving...
- Removing privileges on test database...
... Success!

Reloading the privilege tables will ensure that all changes made so far
will take effect immediately.

Reload privilege tables now? [Y/n] y
... Success!

Cleaning up...

All done! If you've completed all of the above steps, your MySQL
installation should now be secure.

Thanks for using MySQL!
You can find what there is to know in terms of options from the official documentation:




BrowserSwarm - A tool that automates JavaScript testing across browsers

BrowserSwarm is a partnership by Microsoft, Sauce Labs and the open source team of appendTo that helps developers automate how they test frameworks & libraries across browsers. It’s powered through the cloud, allowing developers to save time setting-up multiple browser or device testing environments and precious server resources.

topframeworks_1DE2F2E4

BrowserSwarm connects directly to your GitHub code repo. When your team makes updates, BrowserSwarm automatically runs your project's Unit Test Suite and supports Frameworks, like QUnit, in the cloud using SauceLabs browser automation.

BrowserSwarm is meant to help the framework authors that build stuff for developers by reducing the time spent testing.
 
Check the original post by Microsoft here.
 
Site: BrowserSwarm

Rapidly test your website for cross browser compatibility

Earlier this year I posted about modern.IE, a tool meant to make it easier to test sites for Internet Explorer.
With the release of Internet Explorer 11 Developer Preview for Windows 7, Microsoft has also updated modern.IE. The three new enhancements are:

  1. Limited offer: 25% off Parallels Desktop 8 virtualization for Mac.
  2. New virtual machines for testing IE11 on Windows 8.1 and Windows 7.
  3. A new, free screenshot tool that lets you see how a site looks across browsers and devices.
About this last one, it comes from BrowserStack and it’s a really easy and useful tool to quickly assess the look of your site. Running it on this site gives the following output:
image
You can check out the live output here: http://www.browserstack.com/screenshots/5a6283df1308512082589290b4add4dcd6b9b35f
To run the tool on any site of your liking, visit BrowserStack.

TFS: pending checkin from missing computer

On a daily basis, developers use versioning control software like Microsoft's Team Foundation Server. A problem that arises from time to time is a pending checkin from a user that has left the company, or worse yet, a computer that is missing either because it was damaged or taken away.
On TFS, to solve these issues, you can use the TF.EXE command line tool. To use it you should open a command prompt window:

After opening the command prompt, you need to have identified the following information:

  • Name of the computer where the workspace used to be hosted;
  • Windows username used to logon to Team Foundation Server;
  • The TFS Web URL
The TFS URL should be something like: http://yourhost:8080/tfs/web/
In the example I called the server "yourhost" and assumed it to be listening on port 8080.

With these key pieces of information, you should be able to run the command:

tf workspace /delete {computername};{username} /server:{TFS URL}

You should replace the contents in braces with your own. Executing the statement should get a warning like the following:

A deleted workspace cannot be recovered.
Workspace 'computername;username' on server 'TFS URL' has X pending change(s).
Are you sure you want to delete the workspace? (Yes/No) 

If you answer "Yes" the workspace will be erased, along with all pending locks. The checked in changesets, done before this workspace deletion will not be affected.

HTH.

Microsoft Security Tools and Guidance

Binary matrix with glowing security lockAdvanced Persistent threats are a hot security topic lately. According to Wikipedia, APT usually refers to a group, with both the capability and the intent to persistently and effectively target a specific entity. The term is commonly used to refer to cyber threats, in particular that of Internet-enabled espionage using a variety of intelligence gathering techniques to access sensitive information.
A modern attack performed by APT is the “Pass the Hash”. According to a whitepaper from Microsoft, while performing a PtH attack, an attacker obtains elevated read/write permission to privileged areas of volatile memory and file systems, which are normally only accessible by system-level processes on at least one computer. Second, the attacker attempts to increase access to other computers on the network by:
  1. Stealing one or more authentication credentials (user name and password or password hash belonging to other accounts) from the compromised computer.
  2. Reusing the stolen credentials to access other computer systems and services.
    This sequence is often repeated multiple times during an actual attack to progressively increase the level of access that an attacker has to an environment.
Returning to the subject of this post, while going through Microsoft’s community information, I gathered quite interesting resources regarding security tools and guidance.
Regarding free assessment tools from Microsoft, as well as protection software, there’s a really nice compilation on the “Irish IT Professional” technet blog. You get to know tools like Microsoft Security Compliance Manager, Microsoft Baseline Security Analyzer and Microsoft Security Assessment Tool.
Regarding security tools for footprinting, internal auditing anf guidance, you should check out the Security Tools Community Edition page, on Microsoft’s Technet Wiki.
Finally, you might want to follow the Microsoft Security Blog.
Photo Credit: JustEvents via Compfight cc

Testing sites for Internet Explorer made easier

Today Microsoft announced a new set of tools to help you support modern and older versions of Internet Explorer.

The site makes available a scanning tool that, provided a URL, detects common coding practices that may cause compatibility problems or prevent your users from getting the best possible experience on a webpage rendered on IE. For instance, I ran the scanner on this blog and the report was as follows:

image

A common problem from supporting old versions of IE was detected. The scanner found that the blog webpage was currently rendering in a Compatibility Mode on Internet Explorer 9 and 10, due to the following tag:

<meta http-equiv="x-ua-compatible"
content="ie=emulateie7">


Other “nice to have” issues were detected like a lack of responsive design and no Windows 8 features like a touch browsing interface or a live tile for the start screen.



After removing the compatibility tag, the common problems were all fixed.



Another interesting part of this site is that virtual machines are made available for both Mac and Linux developers to download and be able to test their Web applications on Internet Explorer, using various versions of the windows operating system and the browser:



image



Finally I leave you with the insights from two IT professionals about how challenging it is to develop web application given the number of browser and client devices that exist:




Modern IE Homepage: http://www.modern.ie/

Microsoft Office 2013 Proofing Tools

If you’re beginning to use the new Microsoft Office 2013 and your native language isn’t English, you’ll surely want the new proofing tools.

image

You can download them from this page at Office Online. Afterwards, install it and restart any open applications from the Office suite.

You’re all set to go.

Kanban Software Development


Kanban literally meaning "signboard" or "billboard", is a concept related to lean and just-in-time (JIT) production. According to its creator, Taiichi Ohno, Kanban is one means through which JIT is achieved.
Kanban is not an inventory control system. It is a scheduling system that helps determine what to produce, when to produce it, and how much to produce.
In Agile software development, it has become a common practice to visualize and share project status by posting cards on a wall of the project room.
On the board, project tasks are represented by Post-It notes, and the status of each one is indicated by posting to separate areas on the board labeled "To Do", "In Progress" and "Done". This Kanban Board helps visually signal tasks and limit the volume of tasks actively being worked on, optimizing the teams focus.
KanbanFlow is a Lean project management tool allowing real-time collaboration between team members. Supports the Pomodoro technique for time tracking and best of all, it's absolutely free.
If you are engaged on a software project as a team leader, you can use this tool to coordinate the group's effort. If you're a developer you can use this individually to break down your tasks or propose it to the project manager for adoption.

Compress PDF file with embedded images

Having business related documents on a Enterprise Content Management (ECM) platform, for the sake of governance a set of usage policies has to be in place. Basic examples of these are:

  • File size constraint: a submitted file cannot be larger than an admissible threshold.
  • file type unification: a single file type, or a reduced set of types, should be enforced.
However, scanned files converted into PDF without OCR turn into files with huge images embedded into them. This can turn a simple document unfit to submit into the ECM.
Fortunately I found a solution on this post here. I  tried the Irfanview solution and it worked fine.
HTH.

Free resources for media standout



Making an appealing presentation or sales pitch is not that hard anymore, as long as you have good communication skills and use the right resources.
On this post, I share with you three nice suggestions from the people at Slides that Rock:
  • Compfight: Compfight is a Flickr image search engine.
  • Font Squirrel: Quality freeware fonts that are licensed for commercial work
  • COLOURlovers: COLOURlovers is a creative community where people from around the world create and share colors, palettes and patterns, discuss the latest trends and explore colorful articles.
With the above, I made the above image with little trouble. Nice?

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.

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.

LibreOffice spellcheck not working - try this

After installing LibreOffice 3.4.3, I gave a test run and scribbled something on the word processor. Immediately I noticed that the spellcheck was not working. My native language is not English, so I checked to see if the Language settings were correct. Open the "Options" window from the "Tools" menu. Selected "Language Settings > Languages". Everything was correct:



I couldn't find anything on the options manager that put spellcheck to work. Finally, inside the word processor, I selected "Tools > Languages > More Dictionaries Online":



It opened a browser window on a OpenOffice Wiki page. After searching a while, I landed on the following URL: http://extensions.services.openoffice.org/en/dictionaries

I downloaded the extension corresponding to my desired language, a .OXT file, opened with the LibreOffice extension manager and installed it.

I restarted the Word processor and it just worked. HTH!

Tomboy sync using Windows and Ubuntu

For the eclectic folks like myself, that use multiple operating systems, synchronization tasks are always a challenge. The data to be synchronized has to be supported by a multi-platform client.

If we're talking about utilities like Dropbox, it already supports synchronization clients for windows, Mac and Linux.

On this specific case, I wanted a decent note taking application that allowed me to sync between my Windows desktop at work and my Ubuntu laptop at home. A suggestion I found on the Web worked on file based software and Dropbox synchronizing those folders. That might work, but

I found the solution with Gnome's desktop notes application, Tomboy. It's simple, supports sticky notes, search contents and linking between notes. Good enough for some personal stuff.

The first step, if you don't have such an account, is to register on Canonical's Ubuntu One service. It gives you 5GB free storage to sync files, contacts and notes on all your Ubuntu machines. It's meant to support Windows OS soon enough.

The second step is to install Tomboy on the Windows machine. To install Tomboy on Windows, you need .NET framework and gtk-sharp installed before you can install Tomboy:

After installing Tomboy, start the application. It automatically sets up an icon on the system tray. Press the right mouse button on it and choose "Preferences".

Go to the "Synchronization" tab and select the "Tomboy Web" service. Ont the server insert the following address: https://one.ubuntu.com/notes/

Choose the interval between synchronizations. press "Save" and you're all done on the Windows box. For the Ubuntu machine, there is this detailed tutorial on notes configuration on the Ubuntu One wiki pages.

Free alternative to XML Spy

Professionally I'm sometimes faced with the challenge of being assigned a task, without having the adequate tools to perform it. An example of that is working with XML files.

Not having acquired a commercial software like XML Spy, I had to find a free alternative. To open XML files, pretty-print them and check for issues, I adopted XML Copy Editor:



XML Copy Editor is a free editor that enables you to:

  • open XML files
  • edit your own XML
  • check if the XML is well formed
  • check the XML for compliance with a given schema
Additionally it also performs advanced user operations like syntax highlighting and XPath evaluations. Overall, XML Copy Editor performs all the tasks necessary for XML analysis.