8/30/2010

Fixing XAMPP localhost in Windows 7

While working with reCaptcha on localhost in Windows 7 64 bit, I faced a problem that I couldn't get the correct localhost IP. It came with ::1: and reCaptcha couldn't check whether entered value was valid or not. Here is the solution:
  1. Open C:\Windows\System32\drivers\etc\host in a text editor such as Notepad.
  2. Remove # before 127.0.0.1 localhost
  3. Remove line: # ::1: localhost
  4. Save and you're done.
Source: Haqqi

8/28/2010

Re-install GRUB on Fedora 13

Fedora, likes other Linux distros, comes with GRUB to manage booting process. If you have multi-OS on your computer, GRUB will help you choose which OS will run when your system starts. When I install Fedora 13 on my lap, GRUB worked fine. But it chose Fedora as the default OS and that's not what I want. I have Windows 7 installed on my lappy and I want it become the first OS. After playing with EasyBCD, I was unable to boot to Windows. To fix this, I used Repair my computer function in Windows installation disc. It made everything went back to normal, except that GRUB was gone. How to fix this problem? It's easy as a piece of cake, just follow these steps:
  1. Use your Fedora installation CD to boot to live session.
  2. Open Terminal and enter these command.

su
// This command will give you root privilege

grub>find /boot/grub/stage1
// Find where your GRUB was installed. It will give a result such as (hd0,5)

grub>root (hd0,5)
grub>setup (hd0)


You're done.
Useful article: Solving Boot Problems with Grub - 2nd Edition

The 0/1 Knapsack Problem - Dynamic Programming

 References: https://www.youtube.com/watch?v=EH6h7WA7sDw  Class Item class Item { private $_weight; private $_value; public functi...