terça-feira, maio 28, 2013

ADF Selecionar a primeira linha de uma tabela programaticamente

Para selecionar a primeira linha de uma tabela (rich table) use o código abaixo:

Object rowKey = resultTable.getAttributes().get("scrollTopRowKey");
RowKeySet rks = resultTable.getSelectedRowKeys();
rks.clear();
rks.add(rowKey);


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