10/27/2010

How to Increase Screen Resolution for Ubuntu in Virtual Box

By Cric, eHow Member

Instructions

  1. Start Virtual box and log into Ubuntu.
  2. Hit the right ctrl key so you can get your mouse pointer outside the virtual machine.
  3. Go to top of virtual window, click on devices then select "Install Guest Additions". You will see a window pop up inside Ubuntu showing you that there are some new files mounted in a virtual CDROM drive. One of those files should be VBoxLinuxAdditions.run
  4. Click inside the Ubuntu screen again then go to Applications - Accessories then Terminal. The terminal window is where you will run the file from, but first we must navigate to the correct directory.
  5. Type this... cd /media/cdrom0 (then hit enter, there is a space after cd!)
  6. Next type... dir (You should see amongst the files displayed VBoxLinuxAdditions.run)
  7. Now type... sudo sh ./VBoxLinuxAdditions.run (yes, that is a full stop before the slash!) after you hit enter and it has done its stuff, the files are now accessable from Ubuntu.
  8. You now need to reboot the virtual machine or press Ctrl+Alt+backspace.
  9. Log onto the Ubuntu desktop and this time go to System - Preferences then Screen Resolution. You should now have more options

10/03/2010

Trigger in SQL Server 2005

This trigger check if a Player id is exist or not in another table, if exist this trigger will roll back the transaction and inform an error message. 
IF EXISTS (SELECT name FROM sysobjects
      WHERE name = 'AmaInsert' AND type = 'TR')
   DROP TRIGGER AmaInsert
GO
CREATE TRIGGER AmaInsert
ON Amateur
FOR INSERT
AS
 DECLARE @id int
 SET @id = (SELECT PlayerID from inserted)
IF EXISTS(SELECT * FROM Professional A WHERE A.PlayerID = @id)
BEGIN
 RAISERROR ('This PlayerID %d aldredy exist in table Professional',16,1,@id)
    ROLLBACK TRANSACTION
END

SELECT column_name from inserted mean get the recently inserted value when the trigger fired.

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...