• YouTube
  • LinkedIn
  • Google

Archives for : September2014

Converting xor, shr and shl from Delphi to PHP

I'm migrating a software made in Delphi to PHP and I came across a problem in a fucking Blessed encryption function.

I suffered a bit trying to rewrite the function does the complexity of the code and with the differences in the results.

The function makes use of operators XOR and SHR in Delphi version. The SHR was relatively easy thanks to experience with bitwise operators and how Delphi documentation says that the operator pulls off bits to the right

Continue Reading >>

How to decrease the size of VMDK virtual disks-part 3

If you want to read the part 1 This tutorial, Click here.
If you want to read the part 2 This tutorial, Click here.

In the previous item made a cloning a disk with a single partition. In the next lines I'll show you how I cloned a disk with a single partition primary and logic for two primary partitions and a logic with a mount point for the swap that originally was in a file.

NOTE: I did use information from this site, to solve problems with the new boot disk. Do as I, always cite your sources.

Using as a basis the information of part 1 This tutorial, We will add a new disk to the virtual machine.

Continue Reading >>

Como diminuir o tamanho de discos virtuais VMDK –; part 2

If you haven't read the part 1, You can access it here.

Continuing the tutorial, We will now start the cloning of disks. The first part of the cloning is a disk that does not contain the operating system. If you want to go straight to the cloning system bootable, You can skip this part and go straight to the part 3.

Time to start cloning. We start the virtual machine in terminal mode (for if you have graphical environment) and login as root or we become root with the command su –; to be able to execute the instructions of partitioning, formatting and cloning, respectively without the need for sudo all command.

In terminal type fdisk-l for list disks and partitions:

[root @ Address21 ~]# fdisk-l

Disk/dev/sda: 42.9 GB, 42949672960 bytes
255 Heads, 63 sectors/track, 5221 cylinders Units = cylinders of 16065 * 512 = 8225280 bytes Sector size (logical/physical): 512 bytes / 512 i/o size bytes (minimum/optimal): 512 bytes / 512 bytes Disk identifier: 0x0004f229

...(details of the device/dev/sda partitions)...

Disk /dev/sdb: 221.8 GB, 221807247360 bytes
255 Heads, 63 sectors/track, 26966 cylinders Units = cylinders of 16065 * 512 = 8225280 bytes Sector size (logical/physical): 512 bytes / 512 i/o size bytes (minimum/optimal): 512 bytes / 512 bytes Disk identifier: 0x00000000

Disk/dev/sdc: 214.7 GB, 214748364800 bytes
255 Heads, 63 sectors/track, 26108 cylinders Units = cylinders of 16065 * 512 = 8225280 bytes Sector size (logical/physical): 512 bytes / 512 i/o size bytes (minimum/optimal): 512 bytes / 512 bytes Disk identifier: 0x00000000

Note that our disks appear as being /dev/sda, /dev/sdb, /dev/sdc (I marked in red to make it more visible) and beside its size. That order the, b, (c) is the connection order on IDE port. As our record was included in the Secondary Slave and on Primary Slave is the CDROM (see image on the 1) He is the third system disk, IE, o /dev/sdc.
We will from now on to partition and format the drive. Type the command Fdisk/dev/sdc.

Continue Reading >>

Como diminuir o tamanho de discos virtuais VMDK –; part 1

Where I work we have a few database servers PostgreSQL in different virtual machines running on a VMWare Server. So far so good, It wasn't a detail that was bothering me. All of them using old versions as 8.1 and 8.2, While the current version is the 9.3.
I sought to know and found out that there are version 9.3 for Centos 6.5 that's what we're using for the new servers and decided then unify the three servers in one.

Se você que leu até aqui e pensou “;Unify servers?? That Buro! give zero for him!; know that it was thought and our reality is an appropriate solution.

That said, and with the dilemma resolved, I set out to create a VM using the Vagrant.

The Vagrant is an excellent tool to help us Devops. With the use of it can create machines that can be easily shared among the members of a team. I won't go into the details of its use, just to inform you that I used a Box of Centos 6.5 Basic.

Until here everything was going very well. Set up the VM and installed the software that would use, including PostgreSQL 9.3.

When I went to migrate the production base started some problems. The PGDATA directory, that's where PostgreSQL stores the data in tables, I was with more than 40 GB. Do a dumpall and a Restore on-the-fly was not an option and decided to extract the whole Bank to later restore the VM.

Continue Reading >>

Transposh Plugin Overwriting Default Language

I met the plugin Transposh for WordPress that translates Posts and pages using Google translation tools and Bing and edit translations. He is totally excellent. However, He brought me a problem with the language of the Admin. Left all of it in English rather than the language that I wanted. This is not actually a bug but a behavior due to him not having my default language set that is the Portuguese of Brazil and the Portuguese of Portugal.

To resolve this problem, vá até os ajustes do plugin em Transposh ->; Settings (in the side menu of WordPress left will be the option of Transposh) and uncheck the option in Enable override for default locale of overwrite default location and WP_LANG (see screenshot below).

Transposh Settings

How to prevent change of language in WordPress Admin

Will notice the change soon when saving.

Hugs and I hope I have contributed.

Vagrant init error [Box]

Updated the version of Vagrant em meu computador com Windows 7, and I came across the following error:

C:\Users\Marcos Regis\Projetos\XXXX>;vagrant init
Vagrant failed to initialize at a very early stage:

The plugins failed to load properly. The error message given is shown below.

undefined method '[]; is nil:NilClass

To correct this error in a simple, Navigate to the root directory of your server in my case was

C:\UsersMarcos Regis

Enter the directory .vagrant.d delete/rename the file plugins. json.

TIP: If you use the cmd to start the vagrant, simply enter the commands below

CD% HOMEPATH%/.vagrant.d
Rename plugins. json plugins.json.bak

The error has to do with the plugin vbguest with the new version.

Done that the Vagrant should already work normally.