Thursday, October 22, 2009

"jQuery for Absolute Beginners" Video Series

just recently, i've been studying how to use jQuery. a million thanks to my friends tags and botski for the help. ^_^

you can find a video series on jQuery by following this link:
http://blog.themeforest.net/screencasts/jquery-for-absolute-beginners-video-series/

i've just started and working on day 3 video tutorial. ^_^
knowledge on html, css and javascript are needed.

Wednesday, October 14, 2009

KeyPress Event and KeyStrokes

the following code segment demonstrate how to detect keystroke, specifically ENTER key in a textbox keypress event.

private void textBox1_KeyPress(object sender, KeyPressEventArgs e)
{
   if (e.KeyChar == (char)13)
   {
   MessageBox.Show("You pressed the ENTER key.");
   }
}

--------------------------------------------------
to identify decimal equivalent of each keys, try this code:

private void textBox1_KeyPress(object sender, KeyPressEventArgs e)
{
   int x= (int)e.KeyChar;
   MessageBox.Show(x.ToString());
}

--------------------------------------------------
***happy coding***
for more decimal representation of each character visit http://www.asciitable.com/

Tuesday, October 13, 2009

How to Dispose a Form in C# Without Closing the Application

in program.cs file replace the following code

      Application.Run(new Form1());

with, an instance of your start-up form, such as

   Form1 frm1 = new Form1();
   frm1.Show();
   Application.Run();
*** now you can dispose the form without closing the application
-------------------------------------

from time to time, you will be needing these codes:

   Application.Exit(); <- to close the whole application

   frm1.Close(); <- to close your current form window
   frm1.Dispose(); <- to free memory resources, when form is shown modally. ^_^
-------------------------------------
***good luck***

Friday, October 9, 2009

Passing Dynamic Values From One Form to Another in C#

---------------------------------------
//write this code in form1
private void btnPassValue_Click(object sender, EventArgs e)
{
   frmSecondForm myForm2 = new frmSecondForm();
   myForm2.form1TextBoxValue = this.txtPassValue.Text;
   myForm2.Show();
}
------------------------------------------
//write this code in form 2

//form level
private string tempvalue;
public string form1TextBoxValue
{
    get
    {
       return tempvalue;
    }
    set
    {
       tempvalue = value;
    }
}
private void frmSecondForm_Load(object sender, EventArgs e)
{
    this.txtReceiveValue.Text = tempvalue;
}
------------------------------------------
***end of program***

Generating Random Number in C#


//form level declaration
Random random = new Random();
-----------------------------------------------------------------

private void btnRandom1_Click(object sender, EventArgs e)
{    //returns a random number
   int num1 = random.Next();
   this.txtRandom1.Text = num1.ToString();
}
-----------------------------------------------------------------
private void btnRandom2_Click(object sender, EventArgs e)
{   //returns a number less than 1000
   int num2 = random.Next(1000);
   this.txtRandom2.Text = num2.ToString();
}
-----------------------------------------------------------------
private void btnRandom3_Click(object sender, EventArgs e)
{   //returns a number between 1 to 10
   int num3 = random.Next(1,10);
   this.txtRandom3.Text = num3.ToString();
}
-----------------------------------------------------------------
*** end of program ***

Wednesday, October 7, 2009

Light Writing Photography

in a recent episode of talentadong pinoy, light writing photography was featured and i have found it very interesting. here are some facts:

B
y sequencing stills taken with 4-30 second exposure as lights are moved in and through the frame this effect creates the optical illusion that the light is moving. Zooms, pans, tilts, and most other motion camera techniques can be applied with standard stop motion approaches. The most common technique is to capture multiple second exposures of light moving from one point to another in the frame. As the sequence is built the beginning and ending points of the lights motion can be moved along a given path. When the pictures are put in sequence the light seems to move with classic stop motion jitter. Most commonly, all of the work is done in camera at practical (real world, not a studio) locations. (read more on wikipedia)

I have found these photos & video after googling light writing. check them out! ^_^








sprint commercial also seen at david airey's blog

Tuesday, September 29, 2009

Create Controls At Runtime in C#

//form level declaration
private Button btnClickableButton;
private PictureBox picBox;
private TextBox txtRunningText;
-------------------------------------------------------------

private void btnAddPictureBox_Click(object sender, EventArgs e)
{
   picBox = new PictureBox();
   picBox.Image = Image.FromFile(@"C:\Documents and Settings\All Users\Documents\My Pictures\Sample Pictures\Sunset.jpg");
   picBox.Top = 5;
   picBox.Left = 5;
   picBox.Width = 100;
   picBox.Height = 100;
   picBox.SizeMode = PictureBoxSizeMode.StretchImage;
   Controls.Add(picBox);
}
-------------------------------------------------------------
private void btnAddText_Click(object sender, EventArgs e)
{
   txtRunningText = new TextBox();
   txtRunningText.Text = "I am running around!";
   txtRunningText.Top = 5;
   txtRunningText.Left = 110;
   Controls.Add(txtRunningText);

}
-------------------------------------------------------------
private void btnClearForm_Click(object sender, EventArgs e)
{
   Controls.Clear();
}
-------------------------------------------------------------
private void btnAddCLickableButton_Click(object sender, EventArgs e)
{
   EventHandler handler = new EventHandler(btnClickableButton_Click);
   btnClickableButton = new Button();
   btnClickableButton.Click += handler;
   btnClickableButton.Text = "Click Me Please!";
   btnClickableButton.Top = 5;
   btnClickableButton.Left = 215;
   Controls.Add(btnClickableButton);
}
-------------------------------------------------------------
private void btnClickableButton_Click(object sender, EventArgs e)
{
   MessageBox.Show("Yippee! You clicked me!");
}
-------------------------------------------------------------
*** end of program ***

Monday, September 21, 2009

The Magic in the Square

for an odd-n magic square, use de la loubere's algorithm which can be expressed as :
(1)begin by placing a 1 in the middle location of the top row:
(2)now put successive integers in an upward-right diagonal path
**(3)if the upward-right movement results in a location outside the boundaries of the square, place the new number at the opposite end of the row or column that would contain the new number, if the rows and columns were not bounded
**(4)if the upward-right square is already occupied, place the new number directly below the current one




convert that to pseudo code first then translate it into any desired programming language.

the following is created using c#.

//form level declaration
    int[,] magicSquare = new int[15, 15];
---------------------------------------------
private void btnGenerate_Click(object sender, EventArgs e)
{
   int dimension = Convert.ToInt32(this.cboSize.Text);
   this.populateMagicSquare(dimension);
   this.generateMagicSquare(dimension);
   this.setDataGrid(dimension);
}
---------------------------------------------
private void populateMagicSquare(int size)
{// populate magicSquare array with zeroes
   for (int row= 0; row < size; row++)
       for (int col = 0; col < size; col++)
         magicSquare[row, col] = 0;
}
---------------------------------------------
private void generateMagicSquare(int size)
{
   int curr_row = 0;
   int curr_col = size / 2;
   int temp_row = curr_row;
   int temp_col = curr_col;

   magicSquare[curr_row, curr_col] = 1; // (1)

   for (int ctr = 2; ctr <= size * size; ctr++)
{
      if (curr_row - 1 >= 0)
          temp_row = curr_row - 1; // (2)
      else
          temp_row = size - 1; // (3)

       if (curr_col + 1 < size)
          temp_col = curr_col + 1;
       else
          temp_col = 0;

       if (magicSquare[temp_row, temp_col] != 0)
          curr_row++; // (4)
       else
       {
          curr_row = temp_row;
          curr_col = temp_col;
       }
       magicSquare[curr_row, curr_col] = ctr;
   }
}
---------------------------------------------
private void setDataGrid(int size)
{
   this.dgvMagicSquare.Rows.Clear();
   this.dgvMagicSquare.ColumnCount = size;
   this.dgvMagicSquare.Rows.Add(size-1);

   for( int row=0; row < size; row++)
       for (int col=0; col < size; col++)
          this.dgvMagicSquare[col, row].Value = magicSquare[row,col].ToString();
}
---------------------------------------------
***end of program***

Extreme Car Make-Over @ Gaisano Mall during Kadayawan

BC Intrams 2009



photos courtesy of sir joel! :) aja BSIT! over-all 3rd placer @ BC Intrams 2009 yey!

Saturday, August 22, 2009

Ninoy’s alleged ‘Undelivered speech’

a repost from Thea Alberto Yahoo! Philippines

(This is the entire statement as it appears (all-caps, italicized quote, and all) in “A Testimony by Ninoy,” a pamphlet published on September 1, 1983 by the Human Development Research and Documentation office of the La Ignaciana Apostolic Center as Human Society No. 21)

I have returned on my free will to join the ranks of those struggling to restore our rights and freedoms through nonviolence.

I seek no confrontation. I only pray and will strive for a genuine national reconciliation founded on justice.

I am prepared for the worst, and have decided against the advice of my mother, my spiritual adviser, many of my tested friends and a few of my most valued political mentors.

A death sentence awaits me. Two more subversion charges, both calling for death penalties, have been filed since I left three years ago and are now pending with the courts.

I could have opted to seek political asylum in America, but I feel it is my duty, as it is the duty of every Filipino, to suffer with his people especially in time of crisis.

I never sought nor have I been given assurances or promise of leniency by the regime. I return voluntarily armed only with a clear conscience and fortified in the faith that in the end justice will emerge triumphant.

According to Gandhi, the WILLING sacrifice of the innocent is the most powerful answer to insolent tyranny that has yet been conceived by God and man.

Three years ago when I left for an emergency heart bypass operation, I hoped and prayed that the rights and freedoms of our people would soon be restored, that living conditions would improve and that blood-letting would stop.

Rather than move forward, we have moved backward. The killings have increased, the economy has taken a turn for the worse and the human rights situation has deteriorated.

During the martial law period, the Supreme Court heard petitions for Habeas Corpus. It is most ironic, after martial law has allegedly been lifted, that the Supreme Court last April ruled it can no longer entertain petitions for Habeas Corpus for persons detained under a Presidential Commitment Order, which covers all so-called national security cases and which under present circumstances can cover almost anything.

The country is far advanced in her times of trouble. Economic, social and political problems bedevil the Filipino. These problems may be surmounted if we are united. But we can be united only if all the rights and freedoms enjoyed before September 21, 1972 are fully restored.

The Filipino asks for nothing more, but will surely accept nothing less, than all the rights and freedoms guaranteed by the 1935 Constitution — the most sacred legacies from the Founding Fathers.

Yes, the Filipino is patient, but there is a limit to his patience. Must we wait until that patience snaps?

The nation-wide rebellion is escalating and threatens to explode into a bloody revolution. There is a growing cadre of young Filipinos who have finally come to realize that freedom is never granted, it is taken. Must we relive the agonies and the blood-letting of the past that brought forth our Republic or can we sit down as brothers and sisters and discuss our differences with reason and goodwill?

I have often wondered how many disputes could have been settled easily had the disputants only dared to define their terms.

So as to leave no room for misunderstanding, I shall define my terms:

1. Six years ago, I was sentenced to die before a firing squad by a Military Tribunal whose jurisdiction I steadfastly refused to recognize. It is now time for the regime to decide. Order my IMMEDIATE EXECUTION OR SET ME FREE.

I was sentenced to die for allegedly being the leading communist leader. I am not a communist, never was and never will be.

2. National reconciliation and unity can be achieved but only with justice, including justice for our Muslim and Ifugao brothers. There can be no deal with a Dictator. No compromise with Dictatorship.

3. In a revolution there can really be no victors, only victims. We do not have to destroy in order to build.

4. Subversion stems from economic, social and political causes and will not be solved by purely military solutions; it can be curbed not with ever increasing repression but with a more equitable distribution of wealth, more democracy and more freedom, and

5. For the economy to get going once again, the workingman must be given his just and rightful share of his labor, and to the owners and managers must be restored the hope where there is so much uncertainty if not despair.

On one of the long corridors of Harvard University are carved in granite the words of Archibald Macleish:

“How shall freedom be defended? By arms when it is attacked by arms; by truth when it is attacked by lies; by democratic faith when it is attacked by authoritarian dogma. Always, and in the final act, by determination and faith.”

I return from exile and to an uncertain future with only determination and faith to offer — faith in our people and faith in God.

Sir Joel <3 Dimple



best wishes to sir joel and dimple!! ^_^ (august 8, 2009 @ sta. ana church, reception @ grand regal hotel)

Wednesday, August 5, 2009

Save Tamugan River

The Tamugan River in Baguio Disrtict is currently under serious environmental threat. Being Davao City’s last remaining source of drinking water, Tamugan should be spared from industrial uses that may compromise its capacity to provide Davawenos with clean water supply in the near future.

With plans of Hedcor, Inc. to set up a P6 billion hydropower plant within the Tipolog-Tamugan watershed, the mighty river’s reliability as our future’s drinking water source is put at risk.

This site aims to provide helpful information on our SAVE TAMUGAN RIVER CAMPAIGN. You may download our primer, slides, Citizens Manifesto, and other materials for your reference.




To join the campaign, download the manifesto, print and sign it, circulate to as many people as you can, and fax/mail to:

The General Manager
Davao City Water District
J.P. Laurel Ave., Bajada, Davao City 8000
Email: savetamugan@yahoo.com
Tel No. (82) 221-9400 loc. 268, 276, 227
Fax (82) 226-4885

Spare Tamugan!
A Primer on DCWD’s Opposition to
Hedcor’s Hydropower Project

What is the DCWD Tamugan Surface Water Development Project?

The TSWD is a proactive initiative of the Davao City Water District (DCWD) aimed at addressing the long-term water requirements of Davao City. Its expected daily production of 200,000 cubic meters will increase the number of barangays that can be served by the water district since the proposed project will cover several areas that are not presently served by DCWD.

DCWD will draw water from Tamugan River in Baguio District 400 meters above mean sea level. With an infiltration gallery positioned at this exact elevation, water will flow through 60 kilometers of transmission pipelines to the water treatment plant at Barangay Gumalang at Elevation 325, and the DCWD reservoir at Mayahayay, Tugbok, all of District 3, to Lasang in District 2.

What was the basis of conceiving the TSWD project?

The anticipation of increasing demands in the future, considering population growth and urbanization trends, necessitates the DCWD to look for alternative water sources that will supplement the current sources and help curtail the rate of groundwater depletion. The use of alternative water sources will also save on energy usage since groundwater extraction is a power-intensive operation. In 2007 alone, DCWD spent PhP211 million in electricity for this purpose, or about 24 percent of its total operating revenue. Granting there are no power rate increases in the future, this figure could go as high as PhP314 million in five years.

Why Tamugan River?

Based on several independent studies of all other rivers in the city, Tamugan River is the only remaining source that has the required quality, quantity and viability for the city’s long-term water supply. The confluence of Panigan and Tamugan rivers discharges sufficient quantity of water at an acceptable water quality.

Moreover, the precise location of the TSWD intake is favorable to a gravity fall of water at sufficient pressure, thus, considerably reducing the amount of electricity needed for its operation. Consequently, its long term effect will enable DCWD to be less dependent on energy. The other surface water sources considered either lack in flow rate necessary to supply the projected demands of the city, or fall short of the national standards for the quality of drinking water.

But why insist on developing surface water? Don’t we have enough groundwater resources?

Not anymore. Davao City, reputed to have one of the best potable waters in the world, currently derives more than 99 percent of its water from groundwater sources to provide potable water to over 165,000 homes and businesses all over the city. A total of 212,000 cubic meters are being extracted daily. Total volume of groundwater extracted reached 78 million cubic meters in 2007, increasing annually by 5.06 percent over the past two decades. By 2012, total extractions are expected to reach over 115 million cubic meters, or 314,000 cubic meters daily. In addition, large industrial users and private well owners have been withdrawing from groundwater sources for their own use.

Groundwater, contrary to popular belief, is finite and must be utilized wisely and managed carefully to be able to sustain it for future generations.

Does the DCWD have a permit for this purpose?

Yes. As early as May 1997, a water permit was already issued by NWRB to DCWD to use water from Tamugan River. In fact, it has already been conducting community development activities in the said area, such as watershed rehabilitation and river bank protection efforts, in preparation for the TSWD.

What is Hedcor Tamugan, Inc.?

Hedcor Tamugan Inc. (HTI) is a power generation company planning on establishing a PhP6 billion, 20 megawatt hydropower plant in Tamugan, Baguio District. HTI is a wholly owned subsidiary of Aboitiz Power Corporation, the publicly listed holding company of all Aboitiz assets in the power generation and distribution industries.

Why is DCWD opposing HEDCOR’s proposed hydropower project in Tamugan?

The DCWD is strongly opposing Hedcor’s project because it compromises the city’s future source of safe drinking water.

This assessment is contained in a study conducted by NJS Consultants Co., Ltd., which concluded that water from Tamugan River is the “best in terms of quality, quantity, and viability for Davao City’s long term water supply requirements.”

Davao City is one of the nine water-critical urbanized areas in the Philippines where water is consumed intensively. The National Water Resources Board (NWRB) confirmed that the underground water supply in many densely populated areas in the country is already on a critical level due to unabated extraction of groundwater. This fate could well be Davao City’s if no drastic measures are undertaken within the immediate future. –Master Plan Study on Water Resources Management in the Republic of the Philippines


*** SAVE TAMUGAN RIVER CAMPAIGN @ Brokenshire College ***


Monday, July 27, 2009

What's taking your breath away?

yesterday night at around 10.45pm, i was about to sleep when my phone rang. joel reyes...calling.

usually, sir joel calls late at night to ask on an urgent matter.
"cha, may pasok ba bukas?".yes of course! there was no memo being circulated at brokenshire college on class suspension due to GMA's SONA or with INC's 95th~ founding anniversary.

"cha, wag kang mabigla ha. wala na si avorque. andito ako ngayon sa angel. sabihan mo si mam anna na totoo talaga ito. hindi ito joke". ha?? unsa daw??

"sir pagtarong ba. ayaw pag atik-atik dra!!" these were the words that i could utter at that time.

"naa man uban students diri", sir joel answered back and mentioned that chinky was there. i asked him to give her the phone so that i could talk to her.

"mam tinuod jud. wala na si avorque....". i was really speechless.

words will never be enough to express what we felt right now with the lost that we are experiencing. as soon as i woke up this morning, i checked my facebook account...wall comments have been posted about francis' death and friend's well wishes. i checked on his wall comments and some other stuffs. i browsed my acquaintance party photos taken just this friday, thinking whether i have taken pictures of him during the party. i got a picture of him with his classmates...smiling. :) as well as a video on my phone on their boys over flower spoof!

talking with his classmates brought memories of him as my student and as their friend. my last encounter with him was at the waterworld (during the acquaintance party): nasa duyan ako with ronalyn. when ronalyn left me, he asked me kung pwede siya ang mupuli..makiduyan. "sure, dali!", i said.

life is too short...really short. every now and then, death is a reality check for me.
got to live more. love more. share more. bring out the best out of someone. be the best of me.

i will surely miss you vorkz!

now is the time. :)

live like there's no tomorrow. carpe diem...seize the day!

"life is not measured by the breaths we take but by the moments that take our breath away."
~~author unknown

by the way, what's taking your breath away?

Saturday, July 18, 2009

aH1N1 Update

51 positive case ng a h1n1 virus naitala sa davao region
7/18/2009 4:25:08 pm

davao city - mokabat na sa 51 ang kinatibuk-ang ihap sa mga kompirmadong kaso sa ah1n1 virus sa tibuok rehiyon unsi, apil na niini ang mga pasyente gikan sa surigao ug kidapawan.

sa nahisgutang ihap, 42 niini ang ang gikatala sa dakbayan sa dabaw diin napulo niini ang nagmaayo na.

pipila sa mga nahimong biktima mao kadtong mga tinun-an nga una nang nakasinati ug mga simtomas sama na lamang sa mga pag-ubo, sip-on, ug kalintura.

samtang, mokabat na usab sa upat ka mga eskwelahan dinhi sa syudad ang mipatuman ug suspension sa ilang mga klase sulod sa napulo ka adlaw human gikatala ang positibong mga kaso sa ah1n1.

ang nahisgutang mga eskwelahan ang gilangkuban sa ateneo de davao university, st. paul college, university of immaculate conception- grade school ug high school level, ug san pedro college.

samtang, subay sa pinaka-ulahing impormasyon nga nadawat sa bombo radyo-davao mipatuman na usab sa pag-suspende sa ilang klase ang holy cross of davao college nga nahimutang sa kasikbit lamang nga bahin sa san pedro college nga na-una nang nagbaton ug positive case sa a h1n1 virus.

*** holy child school of davao has suspended their classes too since friday.
*** uhmm. sa brok, naa na kaya pud? buzzzzz....
*** don't panic. let us keep ourselves healthy. :)