Camilo III

This user hasn't shared any biographical information

Homepage: http://camilord.kagayan.com

Yahoo Messenger: camilo3rd


Posts by Camilo III

Manny Villar with MBMYC Staff

No hay palabra de honor

When I watched TV last December 2009 (which I watch TV rarely), I saw the advertisement of the promised politician, Manny Villar. (which also I got irritated with his ads) And I said, *puff!* He really got a guts running for President after his controversial C5. Not to mention what he promised to me and my colleagues way back year 2005, under Mindanao Business and Management Youth Congress program. (see picture below) And until now his ads still air on ABS-CBN. And thinking that every ads in ABS-CBN cost hundreds of thousands. Yet he can afford to air his ads. Then I realized the C5 controversial, and said to myself… Now I get it why he got enough funds for his campaign.

Manny Villar with MBMYC Staff

Manny Villar with MBMYC Staff

The picture was a meeting with Manny Villar and the MBMYC Staff. Villar promised that he will finance a livelihood program and helping the poor in the remote areas in Cagayan de Oro City. He made a lot of promises that day. Yet he accomplished nothing. After the meeting, no funds has been sent to us.

After that, I concluded that this politicians will do nothing for our country!

Election 2010, I won’t vote any president! They are all the same! Dick, Binay, Noynoy and Villar… Same feathers! And they flock together!

Filipinos will always be hopeless with these kind of people!

In addition, I was tagged in the facebook and laugh hard about it… And I think its true! Bwuahahahaha!

:)

Screenshot

Visual C#: Detect Conflict Schedule

Screenshot

Screenshot

It seems a lot of people are searching about solving conflict schedule. So I decided to create a sample. Below is the core code of checking conflict schedule…

// sample conflict detection (defined) [start]
DateTime d = new DateTime(2010, 1, 13);
richTextBox1.Text = DateTime.Now.ToLongDateString() + ” = ” + d.ToLongDateString() + “\n”;
if (DateTime.Now.CompareTo(d) > 0)
{
richTextBox1.Text += “true\n” + DateTime.Now.CompareTo(d).ToString();
}
else
{
richTextBox1.Text += “false\n” + DateTime.Now.CompareTo(d).ToString();
}
richTextBox1.Text += “\n\n”;
DateTime dx = DateTime.Now;
//MessageBox.Show(dx.Hour.ToString());
DateTime[] dt = new DateTime[4];
// enrolled schedule
dt[0] = new DateTime(int.Parse(dx.Year.ToString()), int.Parse(dx.Month.ToString()), int.Parse(dx.Day.ToString()), 8, 0, 0);
dt[1] = new DateTime(int.Parse(dx.Year.ToString()), int.Parse(dx.Month.ToString()), int.Parse(dx.Day.ToString()), 9, 0, 0);
// adding new schedule
dt[2] = new DateTime(int.Parse(dx.Year.ToString()), int.Parse(dx.Month.ToString()), int.Parse(dx.Day.ToString()), 9, 0, 0);
dt[3] = new DateTime(int.Parse(dx.Year.ToString()), int.Parse(dx.Month.ToString()), int.Parse(dx.Day.ToString()), 10, 0, 0);
// checking schedule conflict
if (((dt[0].CompareTo(dt[2]) < 0) && (dt[1].CompareTo(dt[2]) > 0)) || (dt[0].ToShortTimeString() == dt[2].ToShortTimeString()))
{
richTextBox1.Text += dt[0].ToShortTimeString() + ” – ” + dt[1].ToShortTimeString() + ” against ” + dt[2].ToShortTimeString() + ” – ” + dt[3].ToShortTimeString() + “\nResult: CONFLICT”;
}
else
{
richTextBox1.Text += dt[0].ToShortTimeString() + ” – ” + dt[1].ToShortTimeString() + ” against ” + dt[2].ToShortTimeString() + ” – ” + dt[3].ToShortTimeString() + “\nResult: NO CONFLICT”;
}
// sample conflict detection (defined) [end]

If you want to download the whole code, link below and enjoy… Do not practice the copy and paste! :)

Download: Detect Conflict Schedule (14)

Ubuntu

Ubuntu Professional Certification

Ubuntu Girl

Ubuntu Girl

Today, I tried to answer the pre-test of UPC or the Ubuntu Professional Certification… and the result was…

Dear Camilo III,

Thank you very much for taking part in the pre-training assessment.

Your score is 9, which means that you are probably over-qualified for this course.

As a next step we suggest that you read through the Deploying Ubuntu Server Edition course overview found here: http://www.ubuntu.com/training/certificationcourses/server and then complete the corresponding online assessment.

Ubuntu Training courses are taught by Canonical-trained Ubuntu Certified Instructors. The Deploying Ubuntu Server Edition course is available through online training and classroom training, so you can can learn in the environment that suits you best.

Visit: www.ubuntu.com/training for more information.

Best regards and good luck
The Ubuntu Training Team

How flattering!! I admit it, I’m not that good… but anyway, the test is so easy.. hahahaha.. :) And one thing, I don’t have a dollars to pay the $1,600 for the Deploying Ubuntu Server Edition Certification. Its like PhP 76,800.00 in my country, that is 9 months to save my whole salary. hahahaha.. Damn! I will starved to death if I will take the exam… :P

Visual C# 2005 Express

Visual C#: Retrieving Image (BLOB) from MySQL database

I’ve been searching an article about storing and retrieving an image (BLOB data type) from MySQL database. Somehow, I only found the retrieving process but I created the storing process using PHP… :)

You may download my works, link provided below…

  • idsystem_database.sql.zip – the dump file of MySQL database; import this SQL file before running the project
  • the rest of the files are the project sample files

-> retrieveImg_public.zip (39) or http://camilord.kagayan.com/my.files/retrieveImg_public.zip

For the credits, Thanks to Markusek Peter…

MySqlConnection myConnection = new MySqlConnection(myConnString);

string testQuery = “SELECT sp.studePhoto, s.firstName, s.lastName

FROM students AS s, student_photos AS sp WHERE s.id = sp.studentID”;
MySqlCommand myCommand = new MySqlCommand(testQuery, myConnection);

myConnection.Open();
MySqlDataReader myReader = myCommand.ExecuteReader();

FileStream fs; // Writes the BLOB to a file (*.jpg).

BinaryWriter bw; // Streams the BLOB to the FileStream object.

int bufferSize = 100; // Size of the BLOB buffer.

// The BLOB byte[] buffer to be filled by GetBytes.

byte[] outbyte = new byte[bufferSize];
long retval; // The bytes returned from GetBytes.
long startIndex = 0; // The starting position in the BLOB output.

while (myReader.Read())
{
DateTime tmp = new DateTime();
tmp = DateTime.Now;
// Create a file to hold the output.
string filename = camilordMD5(tmp.ToLongDateString().ToString() + tmp.ToLongTimeString().ToString()) + “.jpg”;

string dest = Directory.GetCurrentDirectory() + “/” + filename;
fs = new FileStream(dest, FileMode.OpenOrCreate, FileAccess.Write);
bw = new BinaryWriter(fs);

// Reset the starting byte for the new BLOB.
startIndex = 0;
// Read the bytes into outbyte[] and retain the number of bytes returned.

//myReader.GetBytes(0, startIndex, outbyte, 0, bufferSize);
retval =(long) myReader.GetBytes(0, startIndex, outbyte, 0, bufferSize);
lblName.Text = myReader.GetString(1) + ” ” + myReader.GetString(2);

// Continue reading and writing while there are bytes beyond the size of the buffer.
while (retval == bufferSize)
{
bw.Write(outbyte);
bw.Flush();

// Reposition the start index to the end of the last buffer and fill thebuffer.
startIndex += bufferSize;
retval = myReader.GetBytes(0, startIndex, outbyte, 0, bufferSize);

}

pictureBox1.ImageLocation = Directory.GetCurrentDirectory() + “/test.jpg”;
//pictureBox1.Image = retval;

// Write the remaining buffer.

bw.Write(outbyte, 0, (int)retval – 1);
bw.Flush();

// Close the output file.
bw.Close();
fs.Close();
}

xbutton

Visual C#: Handling X button (top-right)

xbuttonDisabling the X button

private const int CP_NOCLOSE_BUTTON = 0x200;

protected override CreateParams CreateParams
{
     get
     {
        CreateParams myCp = base.CreateParams;
        myCp.ClassStyle = myCp.ClassStyle | CP_NOCLOSE_BUTTON;
        return myCp;
     }
}

Add confirmation if window closing or closed…

Insert this code to Main form or the Form1.cs


private void Form1_Closing(object sender,
                   System.ComponentModel.CancelEventArgs e)
{
     if (MessageBox.Show("Are you sure you want to exit?", "Confirm exit",
         MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No)
     {
        e.Cancel = true;
     }
}

Insert this to Form1.Designer.cs…

this.Closing += new System.ComponentModel.CancelEventHandler(
                             this.frmCCS_Closing);
php_code

[PHP] Converting a value to MAC address format

php_codeI just want to post this since someone ask about it. It might help if someone in this world is searching for an answer with the same problem my friend does. This is about converting a value of 0014:f8c4:9e32 or 0014f8c49e32 to 00:14:f8:c4:9e:32

Now here’s some answers for that…

function convertMACAddress($input)
{
    // clean up unwanted characters
    $input = preg_replace( '/[^a-zA-Z0-9]/', '', $input);

    // initiate character positioning
    $pos = 0;

    // declare output container
    $output = '';

     // if given MAC is invalid, terminate process and return an error
     if (strlen($input) < 12)
     {
           return '[Unrecognized MAC address]';
     }

    // initiate convertion...
    for ($i = 0; $i < 6; $i++)
    {
           if ($i == 0)
           {
                  $output .= substr($input, $pos, 2);
           }
           else
           {
                   $output .= ':'.substr($input, $pos, 2);
            }
            $pos += 2;
     }

      return $output;
}

That’s it… Problem solved. :) If need a sample code, please download the source -> Mac Convert (28) — Have fun coding..

Facebook: Cafe World Tips and Tricks (Cheats)

Lately, I was addicted playing the Cafe World by Zynga. There are some tricks that my fellow office mates how to earn coins so fast and its cafe popularity. I would like to share this to you all…

Deepfreeze Popularity

Deep freeze Popularity

Here’s the Tips and Tricks…

  • Barricade your chef and waiter(s) with tables (shown in the images)
  • Remove your doors if you have nothing to serve, this is to preserve your popularity rate
  • Serve at least 2 or more varieties of food to boost the growth of popularity rate
  • Having below 15 popularity rate, If you notice that few customers are coming in, click the Expand Cafe or Functional then click the check or OK. This will make the customer appear in your restaurant automatically
  • Having 30 popularity rate, put many doors as possible

Speedy Food Distribution

Speedy Food Distribution

yahoo-vs-google-300x289

Gmail v.s. Ymail

yahoo-vs-google-300x289Since my first plug into the internet, I use yahoo. When I search, I also use Yahoo search and that was year 1998. But now, Yahoo change a lot with sophisticated functionality. For google, I only use for search as alternative for Yahoo. But now, Google has the best functionalities and all.

Gmail and Google Search

  • Simple
  • User-friendly
  • Less Ads (if there’s an ads, it’s just a line)
  • Powerful spam filter
  • Lots of labs modules

Ymail and Yahoo Search

  • Sophisticated Functionalities
  • Lots of spam
  • Copied the chat functionality of Google
  • Lots of Ads (like really big ads)
  • Stupid Seals

As a conclusion, Yahoo sucks! Google Rocks!!!