The Facebook Dislike Button is a Fake

Beware of the rapidly spreading "Activate Dislike Button" on Facebook. An article in GMA news website has a detailed explanation about the technical aspects of this link.

It has few variations and it appears to have hacked a friend's account, allowing it to tag you in a post. Observe however how the post was made. You can see that successive posts are made about this but notice that it came from different media sources (pictures and names removed to keep privacy):

  • Facebook just released the dislike button! Click On 'Activate Dislike Button' below to enable it on your account!

  • Facebook just added the dislike button! Click on 'Activate Dislike Button' below to enable it on your profile!

  • Facebook just released the dislike button! Click on 'Activate Dislike Button' below to enable it on your account!

  • Facebook just launched dislike button! Click On 'Activate Dislike Button' below to enable it on your account!

  • Facebook just launched dislike button! Click on 'Activate Dislike Button' below to enable it on your account!
    about an hour ago via iPhone ·  ·  · See Friendship · Activate Dislike Button

    You can see that the posts have indicated that it came from iPhone, HTC Sense, Windows Phone, and WebOS. Other sources include BlackBerry, Android, and many more. It is quite unbelievable that your friend can do all these successively using different phones. Even if he/she does have all these phones, it will take long to be able to go from one phone to another. The posts will not appear to have been posted successively because there will be other posts from other friends in between them.

    Once again, prevention is better than cure. You already know that this is suspicious so don't bother clicking on the link. Spam can be tolerable, but what if the link is really a cross-site script? You can end up giving some confidential information.

Pacquiao vs. Mosley Live Stream

I was looking for some live stream for Pacquiao vs. Mosley because we have no cable and I can't leave the house right now for the pay per view because of a simultaneous celebration of the birthday of my nephew. I found one:

Difference between a Database and DBMS

Just finished my training and certification exam for an IBM academic evangelist. The training covered database fundamentals and DB2. There were other topics covered relating to databases and database management systems like SQL and XML, but I'd like to put more emphasis on database and DBMS or Database Management Systems. Although I have been practicing as a software developer and IT instructor, I have never taken any particular detail to the theories and concepts of databases, much more handle such subjects. The training refreshed me with what I learned in college as well as given me more information about databases and DBMSs. Here are a few things that I've re-learned (because apparently, I forgot or I did not learn at all):

  1. Database in a general point of view refers to any data repository. It can be a software. It provides an interface to access DATA. 
  2. DBMS or Database Management System is a software system. Whereas database provides a way to access data, DBMS provides a way to manage databases. I have been too accustomed to using the terms database and DBMS interchangeably which is widely accepted but not necessarily correct.
  3. SQL was originally invented by IBM. I have been using SQL in different DBMSs and I did not know that it was invented by IBM which made me think that IBM is no where in the competition for software. 
  4. DB2 is from IBM
  5. DB2 is the second in the market for DBMS. I have been working on software projects that use only free databases such as Firebird and MySQL. I have also worked on an Oracle database as well as MS SQL Server. I never researched about market share for these DBMSs and I thought that Oracle was first in line (which is still true) and followed by Microsoft's SQL Server (it turns out that this is the third in the line), then followed by others. 
  6. DB2 now has a free version for academic use. I always thought that DB2 was unpopular (at least in our place) because only a few can afford it and if anyone can afford it, they would opt to use Oracle or MS SQL instead.
There are a lot more misconceptions that I had which are now corrected, and I am very thankful that I went under this training.

Sample CRUD application in C# and MS SQL Server

For this example, we'll be creating a simple sales management for a ticketing office named ACheapSeat. The application allows buying of tickets for a particular event in a given venue. For this example, let's have tickets for three (3) venues: Cowboy Stadium Tickets, Ringling Brothers Circus Tickets, and Kyle Field Tickets.

First, create the database named acheapseat in MS SQL Server. (I'm using MS SQL Server 2005 Express edition).
Create the following tables:
1. Venues
    Id: int, PK, Auto-increment, not null
    Name: varchar(50), not null
2. Events
    Id:int, PK, Auto-increment, not null
    Description: varchar(50), not null
    DateTime: timestamp, not null
    VenueId: FK, int, not null
    Price: numeric
3. TicketSales
    Id: int, PK, Auto-increment, not null
    DateBought: timestamp, not null
    EventId: FK, int, not null
    QuantityBought: int

Now, we can start with our C# application. I'm using C# express 2008.
1. Create a new Windows Forms Application. Let's name the project: ACheapSeat

2. We'll be using just one form. The name of the initial form is Form1. Let's rename it to ACheapSeatForm. Change the text to "A Cheap Seat Ticket Sales Management"

3. Add a TabControl to the form. It should have 3 tabs: Sales, Venues, and Events (rename the tab into "tabMain"). Change the tab's anchor property to Top, Bottom, Left, Right.

4. Add a button to the lower right of the form. Name this button as btnClose and change its text to "Close". Change its anchor property to Bottom, Right

5. Go to the Venues tab and add a label, a textbox, a datagridview, and 3 buttons.
    label: name: lblVenueName, text: Venue Name
    textbox: name: txtVenueName
    datagridview: name: grdVenue
    button 1: name: btnAddVenue, text: Add
    button 2: name: btnSaveVenue, text: Save, Enabled: false
    button 3: name: btnDeleteVenue, text: Delete, Enabled: false

  • Add the following columns to the grid: Id, Name


    Change the DataPropertyName to the corresponding field in the database.

     Change the AllowUserToAddRows and AllowUserToDeleteRows properties of the grid to false

Also, set ReadOnly to True

6. Go to the code view of the form and add the following:
    using System.Data.SqlClient;

7. Add the following code to the constructor (the function that has the same name as its class):

            cn = new SqlConnection("Data Source=RIXX\\SQLExpress;Initial Catalog=acheapseat;Integrated Security=SSPI;");

     //Change the RIXX\\SQLExpress to the name of your server instance. Some may have just "localhost"

8. Let's add more codes:

  • Create a void function that will establish the connection to the database
        void OpenConnection()
            if (cn.State == ConnectionState.Closed)
  • Create a void function that will refresh the contents of the venue grid. 
        void RefreshVenue()
            SqlCommand cmd = new SqlCommand("Select Id, Name from Venues", cn);
            SqlDataAdapter adp = new SqlDataAdapter(cmd);
            DataTable dt = new DataTable();
            grdVenue.DataSource = dt;


9. Go to form view and select the tab control. Look for the SelectedIndexChanged event and doubleclick on it..

10. Add the following switch statement:

            switch (tabMain.SelectedTab.Name)
                case "tabSales": break;
                case "tabVenues":
                case "tabEvents": break;

      //This will re-populate the grid with the database values, every time the user clicks on a particular tab.

11. Go back to form view and double-click on the Add button, and add the following code:

            SqlCommand cmd = new SqlCommand(
                "Insert into Venues(Name) values ('" + txtVenueName.Text + "')", cn);

      //This will add whatever text you type on the textbox to the database

12. Go back to form view and click on the grid. Look for the CellClick event and double-click on it.

13. Add the following code:
      txtVenueName.Text = grdVenue.CurrentRow.Cells["colVenueName"].Value.ToString();
      // this will put whatever text is selected from the grid, to the textbox.
14. Add the following codes also:
            btnAddVenue.Enabled = false;
            btnDeleteVenue.Enabled = true;
            btnSaveVenue.Enabled = true;

15. Go back to form view and double-click on Save and add the following codes:
            SqlCommand cmd = new SqlCommand(
                "Update Venues set Name='" + txtVenueName.Text + "' where Id=" +
                grdVenue.CurrentRow.Cells["colVenueId"].Value.ToString(), cn);

            btnAddVenue.Enabled = true;
            btnDeleteVenue.Enabled = true;
            btnSaveVenue.Enabled = false;
            txtVenueName.Text = string.Empty;

16. You can also do the same with the Delete button:
            SqlCommand cmd = new SqlCommand(
                "Delete Venues where Id=" +
                grdVenue.CurrentRow.Cells["colVenueId"].Value.ToString(), cn);

            btnAddVenue.Enabled = true;
            btnDeleteVenue.Enabled = true;
            btnSaveVenue.Enabled = false;
            txtVenueName.Text = string.Empty;

Repeat the steps with the other tabs and make sure that all fields are well represented.

How to create a Login form in C#

  1. Create a "Windows Forms Application" project
  2. Add a new form. By default, it will have a name of "Form2"
  3. Add 2 labels, 2 textboxes, and 2 buttons like the one shown below:
  4. open the first form (Form1) and double click on the empty space. This should show the Form1_Load event. Declare an instance of Form2 and display it. (Use ShowDialog instead of Show).
  5. Open the second form (Form2) and view the properties of the second textfield (password text box). Specify * in the PasswordChar attribute. 
  6. Double click on the Login button. This will show the button1_click event. Put all necessary checking here like the one shown.

    **You can change the checking part to comparing the values with your database. For example:
    OleDbConnection cn = new OleDbConnection("YourConnectionString");
    DataTable dt = new DataTable();
    OleDbCommand cmd = new OleDbCommand("select * from usertable where username='"+textBox1.Text+"' and password='" + textBox2.Text+"'",cn);
    OleDbDataAdapter da = new OleDbDataAdapter(cmd);
         MessageBox.Show("Incorrect Username or Password");

  7. Go back to the form view of Form2 and double click on the Cancel button. The cancel button should close the application.
  8. Open Form2 again and view its properties and change the Startup Position attribute