quinta-feira, dezembro 13, 2012

Versões do Eclipse

O IDE Eclipse possui as seguintes versões:

  • 3.2/Callisto
  • 3.3/Europa
  • 3.4/Ganymede
  • 3.5/Galileo
  • 3.6/Helios
  • 3.7/Indigo
  • 3.8/4.2/Juno +

domingo, março 18, 2012

Configuring for Dual Boot (BCDEDIT)

Now that we have our disk partitioned and Fedora or Ubuntu installed, let’s set up our system to boot Windows 7 or the Linux distribution. This will involve copying the Master Boot Record of our Linux boot partition to Windows 7, and using BCDEdit to create a new entry in the BCD store that will point to that file. This way Windows 7 will display a menu at boot time that will give you a choice between Windows 7 and Linux.

Boot the system again using either the GParted disk or the Ubuntu or Fedora install disk you downloaded and let’s make a mount point for the FAT32 share partition we created (I prefer using the GParted disk because it boots to a usuable state much faster than the Fedora or Ubuntu Live disk). Open a terminal and enter the following:

mkdir /mnt/share

Next, let’s mount the correct device to this directory. Recall from the GParted partitioning steps above that the FAT32 partition is located at device /dev/sda6. Note: using the FAT32 partition in this step is optional. You may chose to use another device such as a USB drive. Just make sure to mount the appropriate device. Enter the following:

mount /dev/sda6 /mnt/share

Write the first 512 bytes of our Linux boot partition to a file and copy that file to our FAT32 partition:

dd if=/dev/sda3 of=/mnt/share/linux.bin bs=512 count=1

Exit GParted now and reboot to Windows 7. Open the FAT32 partition and you should see the linux.bin file. Copy that file to the root of the Windows boot (active) partition (e.g., C:\). Next, let’s use BCDEdit to add an entry to Windows 7’s BCD store. Administrative privileges are required to use BCDEdit, so navigate to Start->All Programs->Accessories, Right-click on Command Prompt and select “Run as administrator.” Okay, now let’s start by creating an entry for our Linux distribution. Note here that you are free to choose another entry name if desired:

bcdedit /create /d “Linux” /application BOOTSECTOR

BCDEdit will return an alphanumeric identifier for this entry that I will refer to as {ID} in the remaining steps. You’ll need to replace {ID} by the actual returned identifier. An example of {ID} is {d7294d4e-9837-11de-99ac-f3f3a79e3e93}. Next, let’s specify which partition hosts a copy of the linux.bin file:

bcdedit /set {ID} device partition=c:

The path to our linux.bin file:

bcdedit /set {ID} path \linux.bin

An entry to the displayed menu at boot time:

bcdedit /displayorder {ID} /addlast

and finally, let’s specify how long the menu choices will be displayed:

bcdedit /timeout 30

That’s it! Now reboot and you will be presented with menu where you can choose to boot to Windows 7 or Linux. When you choose Linux, you’ll be taken to the GRUB menu where you can choose to continue booting your Linux distribution or return to the previous menu.

Note: Fedora users will notice that GRUB uses the hiddenmenu option by default. This requires users to hit “Esc” within 5 seconds (another Fedora GRUB default) in order to see the full GRUB menu. Not selecting Esc results in GRUB booting to the OS selected as the default in the boot loader operating system list during installation, which, in our case, should be Fedora, if the steps above were followed. If you would like to defeat the hiddenmenu option and/or change the default timeout, boot Fedora and open a terminal. Change to root and make a back up copy of /boot/grub/grub.conf Now open the original file in your favorite editor and comment out the line hiddenmenu. You can also change the timeout value to something greater than 5 (seconds). Now you when you select the Linux option from the Windows boot loader you should see the full GRUB menu with the option of selecting Fedora or Windows 7 within the timeout value you selected.

On a final note, if at any time you want to eliminate the Linux menu option simply delete the BCD store entry you created using the following command:
bcdedit /delete {ID}

Windows XP?

If you plan to dual boot using Windows XP then you will still partition and install Ubuntu or Fedora as described above (Note, however, that XP does not use a small primary partition for boot configuration data like Windows 7 does), but you won’t be needing BCDEdit. Instead, you can simply open the boot.ini file located at C:\ and add the following entry:

c:\linux.bin="Linux"

Conclusion

With a minimal amount time, the free and open source disk partitioning tool GParted, and a little command line foo, you can easily set up a system that can dual boot Windows 7 and your choice of Linux distributions.

quarta-feira, abril 14, 2010

Cache e PHP

Colaboração: André Milani

Data de Publicação: 11 de abril de 2010

Olá pessoal! Meu nome é André Milani, sou autor de livros de bancos de dados e programação e também instrutor da Softblue. Este é o meu blog pessoal onde pretendo abordar temas de tecnologia na área de programação e desenvolvimento de softwares, em especial o PHP, SQL e assuntos referentes a bancos de dados.

Neste primeiro post eu gostaria de compartilhar uma situação que aconteceu com um leitor do meu livro de PHP e MySQL sobre cache. Levamos um bom tempo para conseguir detectar que o problema não estava no código PHP, mas sim no cache do navegador. Então, para prevenir este problema, vão aí algumas dicas bem interessantes:

Forçando um refresh

Muitos sabem que a tecla F5 dos navegadores, pelo menos na maioria deles, serve para atualizar a página. Este procedimento é chamado de refresh (nome em inglês). O que nem todos sabem é que o comando F5 realiza um refresh com base em algumas configurações de data de expiração dos arquivos em questão, e que dependendo da data, somente a tela é atualizada, mas não os conteúdos dos arquivos cujas datas ainda não expiraram.

Para resolver esta situação, utilize o comando CTRL + F5. Este comando força o refresh dos arquivos, independente da data de expiração. Ele apaga do cache de seu navegador todos os arquivos da página em questão, e solicita todos os arquivos novamente ao servidor.

Evitando o cache em PHP

Mesmo conhecendo o comando CTRL + F5, pode ser que nem todos os visitantes de nossos sites conheçam este recurso, ou ainda, saibam que a página está em cache. Por este motivo, é interessante prevenir que as páginas utilizem cache, fazendo com que seus visitantes sempre acessem as páginas com as últimas atualizações realizadas.

Para prevenir o uso do cache em PHP, utilize o comando header setando duas propriedades específicas:

   // HTTP/1.1   
header("Cache-Control: no-cache, must-revalidate");
// Date in the past
header("Expires: Sat, 26 Jul 1997 05:00:00 GMT");

A primeira propriedade é a Cache-Control, que informa ao navegador, ou qualquer proxy que possa estar no caminho do arquivo, para não armazená-lo em cache.

A segunda propriedade é a Expires, que define a data de expiração do arquivo. É possível definir uma data já passada, para que o cache já seja entendido como expirado, ou então é possível definir a sua data de expiração. Esta propriedade deve ser informada para arquivos que possuem alto volume de acesso, mas baixa taxa de atualização, o que otimiza recursos do servidor.

Vale a pena mencionar que, ao utilizar o comando header, nenhuma informação pode ser impressa antes pelo PHP, nem por meio de comando echo, print ou outro. Esta é uma particularidade do comando header, e maiores informações podem ser encontradas no manual do PHP, clicando aqui.

segunda-feira, agosto 10, 2009

Como remover mensagem de cópia de avaliação do Windows 7 [X86 & X64]

Many users are asking how to remove evaluation copy (Or testing purpose only) watermark that appears on the bottom right of Windows 7 desktop. Generally, we need to edit system file to make it happen. But thankfully, we have a simple, clean and working patch that does the job perfectly.

windows7logo1

Before getting into the innards of the guide, it’s better to backup your system files since you are going edit user32.dll.mui system file using a small patch. Follow the steps given below to remove watermark from the Windows 7 desktop.

Procedure:

1. Download the patch from here (Thanks to deepxw for creating the patch).

2. Right-click on Removewatermark (.exe) file and select Run as administrator. Make sure that you have chosen RemovewatermarkX86.exe file, if you are using 32-bit Windows. Likewise choose RemovewatermarkX64.exe for 64-bit Windows.

3. Next, a command prompt will be opened asking your permission to continue. Press/type “Y” to continue patching process.

Command Prompt Asking Permission

4. Within few seconds, a successful message will be shown. Close Command Prompt window & reboot your system.

Water Mark Command Prompt

5. Enjoy!

If the watermark appears even after rebooting the machine, then follow the procedure below.

1. Type CMD in Start menu search field and hit enter Ctrl + Shift + Enter to open Command Prompt with admin rights. Alternatively, go to Start > All programs > Accessories. Right-click on Command Prompt entry, and select Run as administrator.

2. In the Command Prompt, type in mcbuilder.exe and hit enter. It may take a minute to finish the process. Now, close the Command Prompt window and reboot Windows 7.

Windows 7 watermark

3. You should see no watermark on your desktop now.

Note that this patch should work fine on all builds of Windows 7 including build 7057.

quarta-feira, julho 29, 2009

Como Mudar a Sequencia de Boot no Vista/XP Dualboot

Note: In case you want to dual boot your system with Windows XP and Windows Vista, install Windows XP first.

The primary tool to edit Windows Vista boot configuration is BCDEdit.exe, a tool which is included in Windows Vista distribution in the C:\windows\system32 folder (C: being the windows vista system drive). BCDEdit.exe allows you to change and configure boot application data (files) in the BCD (Boot Configuration Data) stores which replace the settings in the boot.ini file in earlier versions of Windows.

BCDEdit basically replaces the BootCfg.exe tool that was used with earlier versions of Windows. BCDEdit provides much better and wider command line options and can do much more tasks than BCDCfg.

Here’s how you can use BCDedit to change the boot sequence and display order in the boot menu.

1. Start > Cmd > Right Click cmd> Run as Administrator

2. At the command prompt :

a. C:\> cd windows/system32

b. C:\windows\system32> bcdedit /?

c. C:\windows\system32> bcdedit /enum all

d. The output displays the boot configuration data of all the operating systems on the computer:

Windows Boot Loader

-------------------

identifier {current}

device partition=C:

path \Windows\system32\winload.exe

description Microsoft Windows Vista

locale en-US

inherit {bootloadersettings}

recoverysequence {572bcd56-ffa7-11d9-aae0-007e994107d}

recoveryenabled Yes

osdevice partition=C:

systemroot \Windows

resumeobject {89b97029-9609-11db-bbfe-cfc7153012f0}

nx OptIn

e. Note the 128-bit GUID of the Windows XP system. You will have a similar entry for that.

f. C:\Windows\system32> bcdedit /default

E.g bcdedit /default {cbd971bf-b7b8-4885-951a-fa03044f5d71}

Where {cbd971bf-b7b8-4885-951a-fa03044f5d71} is the GUID of the Windows XP system.

In case you wish to delete the Windows XP entry from the boot menu:

g. c:\windows\system32> bcdedit /delete

You can also change the description of an entry using the following command:

h. bcdedit /set ID description "The new description"


For example:

bcdedit /set {802d5e32-0784-11da-bd33-000476eba25f} description "My Favorite OS"

You can change the display order of the boot options using the following command:


i. bcdedit /displayorder ID1 [ID2] [ID3] [...]


For example :

bcdedit /displayorder {802d5e32-0784-11da-bd33-000476eba25f}

{cbd971bf-b7b8-4885-951a-fa03044f5d71}

This will change the diplay order of the entries the next time the system is turned on only.

In order to make permanant changes to the boot order you can use the following command:

j. bcdedit /bootsequence ID1 [ID2] [ID3] ...


For example:

bcdedit /bootsequence {802d5e32-0784-11da-bd33-000476eba25f}

{cbd971bf-b7b8-4885-951a-fa03044f5d71}

The following command sets the boot manager’s timeout to 30 seconds:

k. Bcdedit /timeout 30

Refrences: You can download a complete guide on BCD edit at:

http://download.microsoft.com/download/9/c/5/9c5b2167-8017-4bae-9fde-d599bac8184a/BCDedit_reff.docx

sexta-feira, julho 17, 2009

Como Usar Boot Manager do Windows Vista para Carregar o Linux

The Web is full of explanations on how to dual boot Windows and Linux using a Linux boot manager like GRUB or LILO. If you want to dual boot Windows Vista and Linux using Windows Vista’s Boot Manager, please read on. I will assume that you already have installed Linux on your machine using GRUB as your boot loader.


Step 1 – Install GRUB on the Linux partition (outside of MBR)


As Windows Vista will replace the Master Boot Record (MBR) with its own, we need to relocate GRUB elsewhere by running grub-install with the Linux partition as a parameter.

• On Linux, launch a Terminal with root privileges

• Find the name of the partition Linux is installed on by running fdisk –l (the partition you’re looking for is the one whose system is Linux, can be something like /dev/sda1 or /dev/hda1. For the rest of this post, I’ll use /dev/sda1)

• Install GRUB on the Linux partition by running : grub-install /dev/sda1


Step 2 – Get a copy of Linux boot sector


We will need to instruct Windows Boot Manager how to boot correctly Linux using Linux boot sector, which we will extract using dd.

• On Linux, launch a Terminal with root privileges

• Take a copy of Linux boot sector : dd if=/dev/sda1 of=/tmp/linux.bin bs=512 count=1

• Copy linux.bin on a FAT formatted USB key or any storage accessible from Windows Vista


Step 3 – Install Windows Vista


Step 4 – Configure dual booting in Windows Vista


We will create an entry for GRUB in Windows Vista boot configuration data store using bcdedit.

• On Windows Vista, launch a command prompt with administrative privileges (by right clicking on cmd and choosing Run as Administrator)

• Copy Linux boot sector on the root of the Windows boot (active) partition, namely the one containing bootmgr. If you don’t know for sure you can use diskpart or diskmgmt.msc to find out which one it is.

• Create an entry for GRUB :

o bcdedit /create /d “GRUB” /application BOOTSECTOR

o Note: bcdedit will return an ID for this entry that we will call {LinuxID} below. You will need to replace {LinuxID} by the returned identifier in this step. An example of {LinuxID} is {81ed7925-47ee-11db-bd26-cbb4e160eb27}

• Specify which device hosts a copy of the Linux boot sector

o bcdedit /set {LinuxID} device boot

• Specify the path to a copy of the Linux boot sector

o bcdedit /set {LinuxID} PATH \linux.bin

• Add Linux entry to the displayed menu at boot time

o bcdedit /displayorder {LinuxID} /addlast

• Let the menu be displayed 10 seconds to allow for OS selection

o bcdedit /timeout 10

quarta-feira, abril 22, 2009

Adicionando funções no carregamento da página HTML

Para adicionar uma funções javascript no carregamento da página HTML (load) use a função abaixo:

function addLoadEvent(func) {
var oldonload = window.onload;

if (typeof window.addEventListener != "undefined" ) {
window.addEventListener("load", func, false);
}
else if (typeof window.attachEvent != "undefined" ) {
window.attachEvent("onload", func);
}
else if (typeof window.onload != 'function') {
window.onload = func;
} else {
window.onload = function() {
if (oldonload) {
oldonload();
}
func();
}
}
}

E depois chame a função como no exemplo abaixo:


function marcaObrigatorios() {

}

addLoadEvent(marcaObrigatorios);

sexta-feira, setembro 19, 2008

Failed to allocate page for guest RAM error in Linux VMware Workstation

I've been spending increasingly more time running Ubuntu on one of my desktops. It has replaced the Windows Vista I had and so far I quite like the experiment. Out of the box, all of the hardware was properly supported and even the NTFS partitions left from Vsita install are easily available.One of the first things I've decided to install was the trial version of the latest VMware Workstation: 6.0.3 build-80004. And although it installed without a problem, when I tried to run one of the previously created virtual machines, I got the following error:

VMware Workstation unrecoverable error: (vcpu-0)
Failed to allocate page for guest RAM!

As it turned out after a quick investigation, that was a result of running a VM from a NTFS partition, because its default mounting settings don't have the exec option.

Since you shouldn't be running anything critical through an NTFS driver anyway, I simply moved the VM onto one of the ext3 partitions and, sure enough, it fixed the guest RAM allocation error.

Update: if your scenario prevents you from moving a VM to a native partition, use the following option:

mainmem.UseNamedFile = "FALSE"

You should add it to the vmx file of your VM. Thanks for the tip, benito!

quarta-feira, julho 30, 2008

Definindo XP como Padrão em um Dual-Boot com Vista

When you install Windows Vista as a dual-boot with your regular Windows XP partition, Vista is always set as the default OS. If you want to set XP as the default OS instead, there's a quick command you can run to change it back.

First you'll have to open an administrator command prompt. Type cmd into the search box, and then hit Ctrl+Shift + Enter to open it in administrator mode. You should be prompted for the UAC dialog.

Enter in the following command:

bcdedit /default {ntldr}

Example:

C:\Windows\system32>bcdedit /default {ntldr}
The operation completed successfully.

Now when you reboot, it will set XP as the default.

quinta-feira, julho 24, 2008

Acessando VMware Virtual Machine(NAT) Por Um Outro Computador

Se você está executando uma máquina virtual no seu computador, você pode querer acessar esta máquina virtual através de um outro computador. Por exemplo: Digamos que você tenha uma máquina virtual Ubuntu com Apache executando na porta 80, e você quer mostrar para outra pessoa em sua rede o acesso para o website que você está hospedando.

Nós estamos assumindo que a máquina virtual está usando NAT, e tem sido associado um endereço IP de 192.168.23.128.

Primeiro abra o Manage Virtual Networks pelo item do menu iniciar:

Clique na aba NAT, e então clique em Edit. Você verá o diálogo NAT Settings:

Clique no botão Port Forwarding, e você irá ver o diálogo:

Agora estamos finalmente na tela que podemos usar. Nós queremos usar a porta 8080 na máquina host. Entramos o endereço ip da máquina virtual ubuntu, e porta 80. Estas portas poderão ser qualquer uma.

Nós poderemos testar ela indo em http://localhost:8080 no computador hospedeiro. Também podemos trocar a url da máquina hospedeira pelo endereço IP da mesma.

quinta-feira, setembro 21, 2006

Delphi Update for Delphi 2006

1. There is a new DbCommonTypes unit, hosting some of the internal data structures that in the past were duplicated in multiple units. Their direct usage is not very common, so you'll seldom have to add this unit to your uses statements.

2. The ClientDataSet component has a new Boolean property, Ranged, indicating whether a range is active or not.

3. The TDataSet class has a new CopyFields method that takes another dataset as parameter and clones its field definition structure.

4. The data type had been changed from TButtonSet to TNavButtonSet

quinta-feira, setembro 30, 2004

My presentation

Hello I am Leandro, knowed by Java-lee man. This is my first text. So I starting by publishing my photo below.



Do you like?

I live in Brazil, on city of Brasília-DF. I have 30 old age. I working with computation, and have more than 10 year of experience.