Credits

Tuesday, August 31, 2010

Technology - Assisted Teaching

I rarely use technology during my classroom instruction but with my present school where electronics   like projector, overhead projector (OHP) and display TV  come handy and available, I spend most of my teaching hours with technology.


Somehow, it makes the writing fewer and the concepts being taught more understandable. But, of course, this can be complemented with other teaching styles like question - and  - answer technique, group activities, lecture, and laboratory works among others. 

A creative teacher can best  maximize any available teaching resources to make sure that students learn better. But, the presence of electronic equipment like TV or computer and projector is a heavenly help.

More Action Events in Java

When we make a business application, it is only typical that we get messages from certain actions like a  login event.

Below is another program with action events that allow us to have a login form which requires a password and username. A valid entry of "STI" will allow you to seen a welcome message otherwise you will see a deny form.

The program makes use of string function equals ( ) to validate the string input.

[+/-] show/hide



/*adding of components to frame without a panel*/
import java.awt.FlowLayout;
import javax.swing.*;
import java.awt.event.*;
public class GUILoginEvent extends JFrame implements ActionListener{

JLabel loginLbl= new JLabel ("Login ");
JLabel pwLbl= new JLabel ("Password");
JTextField loginField=new JTextField(15);
JTextField pwField = new JTextField(15);

JButton loginBtn = new JButton("Login");
JButton cancelBtn = new JButton("Cancel");


public GUILoginEvent(){
super("Login Form");
setSize(280,180);
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

FlowLayout flo=new FlowLayout();
loginBtn.addActionListener(this);
cancelBtn.addActionListener(this);
setLayout(flo);
add(loginLbl);

add(loginField);
add(pwLbl);

add(pwField);
add(loginBtn);
add(cancelBtn);
setVisible(true);
}

public void actionPerformed(ActionEvent evt) {
Object source = evt.getSource();
boolean flag = false;
if (source==loginBtn)
{if (loginField.getText().equals("STI") && pwField.getText().equals("STI"))
flag = true;
msgForm myMessage = new msgForm(flag);}

else if (source==cancelBtn)
System.exit(0);


}

public static void main (String args[]){
GUILoginEvent myFrame=new GUILoginEvent();
}

}

class msgForm extends JFrame {
JLabel msg = new JLabel(" ",JLabel.CENTER);


public msgForm(boolean myflag){
super("Details");
setSize(200,100);

FlowLayout xflo=new FlowLayout();
if (myflag==true)
msg.setText("Welcome!");
else
msg.setText("Invalid login/password.");
setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
add(msg);
setVisible(true);

}
}

How to Cope with Low Grades

After the long ordeal from string of exams and quarter requirements, it is now time for submitting and releasing of grades. I just encoded my midterm grades for my college students and while I am happy that  most of my students get passing marks, I still feel sorry for those who have earned failing grades due to chronic absences or  low performances from exams and other subject requirements.


But, if you are among who have just earned low or failing marks, you can still cope with your low marks by trying the following tips:

  • attend classes regularly, so, not to miss classroom activities like quizzes, seat/boardworks and others;
  • seek special projects or tasks if possible to augment points;
  • seek a mentor on subjects you have hard times;
  • study your course outline and references way earlier to better comprehend the concepts;
  • develop discipline in your learning styles and study habits; 
  • develop a positive attitude towards your schooling for better and sustaining motivation; and
  • acquire more resources for wider knowledge and better output in your academic performance. 

Sunday, August 29, 2010

When Teaching Becomes a Noble Career

I have been a teacher for over 13 years and when asked if I have wasted my prime in classrooms and in between classrecords and test papers, my answer is always "NO" for I have grown to be a better person from this career.

Teaching  is as noble as any job and when you are committed to give all your 100% efforts on anything, you can be as noble as a  king.

Anyone can be a teacher, but, only committed and passionate teachers get to enjoy the long hours of standing, checking of test papers and preparing for academic instructions. Thus, in spite of meager pay, seeing students lead a good life can be fulfilling already.

So, if young teachers really see a long fulfilling life in their chosen career, help from supportive school administration, healthy lifestyle and comfortable  footwear from Spenco  can make a big difference.

My other classmates and friends  may have pursued a different career, but, whatever path we all have chosen, the basic criterion of nobleness is that we have served with a big heart for others.

Java's Action and Window Listeners

 Java programmers prefer to use Swing components because of their ease and flexibility, however, when AWT components are rather chosen, we can still integrate codes to make sure that we get to perform what we must accomplish.

The program below makes use instead of Frame component from AWT package but when window close button is clicked, no action is rather performed. Thus, a call for window listener must be done.

The thing with event handling is we have to define all the methods of this listener even if it means, these methods may not perform anything. This is the case for ClosingFrame class where a need  to close the frame can be made.
 
[+/-] show/hide


import java.awt.*;
import java.awt.event.*;

//a sample program that uses awt objects. press ctrl c to end.
public class ButtonActionEvent extends Frame implements ActionListener
{
Button redButton = new Button("Red");
Button greenButton = new Button("Green");
Button blueButton = new Button("Blue");

public ButtonActionEvent(){
setLayout(new FlowLayout());
setTitle("Button Action Event Frame");
setSize(300,150);

ClosingFrame close=new ClosingFrame();
//ClosingFrameAdapter close = new ClosingFrameAdapter();
addWindowListener(close);//calls a listner in Closing Frame

redButton.addActionListener(this);
add(redButton);

greenButton.addActionListener(this);
add(greenButton);
blueButton.addActionListener(this);
add(blueButton);
setVisible(true);
}

public void actionPerformed(ActionEvent e){
// Object source = e.getSource();
if (e.getSource()==redButton)
this.setBackground(Color.red);
else if (e.getSource()==greenButton)
setBackground(Color.green);
else setBackground(Color.blue);

}

public static void main (String[] args){
ButtonActionEvent apps = new ButtonActionEvent();

}
}

/*the other file to close the frame*/
import java.awt.*;
import java.awt.event.*;

//a sample program that uses awt objects.
public class ClosingFrame extends Frame implements WindowListener
{


public ClosingFrame(){
addWindowListener(this);

}

public void windowClosing(WindowEvent e){
System.exit(0);
}

public void windowClosed(WindowEvent e)
{
}
public void windowDeiconified(WindowEvent e){

}public void windowIconified(WindowEvent e){

}public void windowOpened(WindowEvent e){

}public void windowActivated(WindowEvent e){

}public void windowDeactivated(WindowEvent e){

}
public static void main (String[] args){
ClosingFrame apps = new ClosingFrame();
apps.setSize(100,60);
apps.setVisible(true);

}


}

Java's Action Events

 Graphical User Interface (GUI) is highly preferred over the traditional method since it is much way easier and when you make any application,  a GUI interface using frames  and other components can make your user appreciate more your works.

But, interaction can only happen when events are applied on GUI components like buttons, windows, text fields, list and others.

However, an appropriate listener must be integrated along with these components. The program below shows the use of event on buttons with action listener to invoke the event method.
[+/-] show/hide


import java.awt.*;
import java.awt.event.*;
import javax.swing.*;

public class ButtonActionEventv2 extends JFrame implements ActionListener
{
JButton redButton = new JButton("Red");
JButton greenButton = new JButton("Green");
JButton blueButton = new JButton("Blue");
JPanel pane=new JPanel();
public ButtonActionEventv2(){

setTitle("Button Action Event Frame");
setSize(300,150);
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

redButton.addActionListener(this);
pane.add(redButton);

greenButton.addActionListener(this);
pane.add(greenButton);
blueButton.addActionListener(this);
pane.add(blueButton);
add(pane);
setVisible(true);
}

public void actionPerformed(ActionEvent e){
Object source = e.getSource();
if (source==redButton)
pane.setBackground(Color.red);
else if (source==greenButton)
pane.setBackground(Color.green);
else pane.setBackground(Color.blue);

}

public static void main (String[] args){
ButtonActionEventv2 apps = new ButtonActionEventv2();

}
}

How to Energize Your School Days

Schooling is never easy  and fun, however, this is one primal need to better life. The number of years spent in school may also vary. In the Philippines alone, we have a total of 16 years  where two (2) years are spent in nursery or preschool, six (6) years in basic education, four (4) years in high school and another four (4) years in college. Thus, if one does not know how to revive his schooling days, he can get all drained so easily.

To energize your school days, you can try the following tips:
  • find a recreational activity like biking to be psychologically and physicall fit where a  yakima roof rack  can be quite useful; 
  • join social clubs to widen your circles;
  • take a vacation if you must;
  • if you are preparing for a collegiate course, pursue a academic program where you can be personally motivated  to attend to all its academic requirements; and 
  • have a positive outlook towards your schooling; if you see it as an avenue for better life, schooling can be both enjoyed and endured. 

Passing Parameters to Java Frames

Here is another sample program which I took and revised from the other post.  The program includes the use of flow layout for the container (frame or panel), so, components can be  equally centered   across the container.

This  program also passes through a parameter to another frame.
[+/-] show/hide



/*adding of components to frame without a panel*/
import java.awt.FlowLayout;
import javax.swing.*;
import java.awt.event.*;
public class GUIQuizEvent extends JFrame implements ActionListener{
// private LayoutManager FlowLayout;
JLabel toLabel= new JLabel("To: ",SwingConstants.LEFT);
JLabel fromLabel= new JLabel ("From:",SwingConstants.LEFT);
JLabel messageLabel = new JLabel (" Message:",JLabel.LEFT);
JTextField toField=new JTextField(15);
JTextField fromField = new JTextField(15);
JTextArea msgArea= new JTextArea("Write your message here.",4,15);
JButton send = new JButton("Send");

public GUIQuizEvent(){
setSize(220,210);
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

msgArea.setLineWrap(true);
msgArea.setWrapStyleWord(true);
JScrollPane scrollpane=new JScrollPane(msgArea);
FlowLayout flo=new FlowLayout();
send.addActionListener(this);

setLayout(flo);
add(toLabel);
add(toField);
add(fromLabel);
add(fromField);
add(messageLabel);
add(scrollpane);
add(send);

setVisible(true);
}

public void actionPerformed(ActionEvent evt) {
String recipient= toField.getText();
messageFrame secFrame=new messageFrame(recipient);
secFrame.setVisible(true);
}
public static void main (String args[]){
GUIQuizEvent myFrame=new GUIQuizEvent();
}
}

class messageFrame extends JFrame{
messageFrame(String To){
super("Confirmation Message");
setSize(250,100);
setLayout(new FlowLayout());
JLabel msg1= new JLabel("Your message to "+To);
JLabel msg2= new JLabel("was successfully sent.");
add(msg1);
add(msg2);
setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
}}

Calling Java's GUI Frames

Java can call several frames and by creating an instance of these  frames, we can call and even pass parameters for a more interactive system. An action  event on the button invokes the action method to display the second frame.

The program below illustrates the use of these frames and directly adding of components to the frame.

[+/-] show/hide


/*adding of components to frame without a panel*/
import java.awt.FlowLayout;
import javax.swing.*;
import java.awt.event.*;
public class GUIEventSeatWork extends JFrame implements ActionListener{
JLabel toLabel= new JLabel("To : ",SwingConstants.LEFT);
JLabel fromLabel= new JLabel ("From:",SwingConstants.LEFT);
JLabel messageLabel = new JLabel (" Message:",JLabel.LEFT);
JTextField toField=new JTextField(15);
JTextField fromField = new JTextField(15);
JTextArea msgArea= new JTextArea(4,15);
JButton send = new JButton("Send");

public GUIEventSeatWork(){
super("Email Form");
setSize(220,280);
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
msgArea.setLineWrap(true);
msgArea.setWrapStyleWord(true);
JScrollPane scrollpane=new JScrollPane(msgArea);
FlowLayout flo=new FlowLayout();
send.addActionListener(this);
setLayout(flo);
add(toLabel);
add(toField);
add(fromLabel);
add(fromField);
add(messageLabel);
add(scrollpane);
add(send);
setVisible(true);
}

public void actionPerformed(ActionEvent evt) {
String toName=toField.getText();
String fromName=fromField.getText();
String msgText=msgArea.getText();
msgForm myMessage = new msgForm(toName,fromName,msgText);
myMessage.setVisible(true);

}
public static void main (String args[]){
GUIEventSeatWork myFrame=new GUIEventSeatWork();
}
}

class msgForm extends JFrame {
JLabel to = new JLabel();
JLabel from = new JLabel();
JTextArea msg = new JTextArea();
JPanel msgpane= new JPanel();
public msgForm(String toLbl,String fromLbl,String msgTxt){
super("Details");
setSize(150,200);
FlowLayout xflo=new FlowLayout();
msgpane.setLayout(xflo);

setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
to.setText ("\nTo : "+toLbl);
from.setText("\nFrom : "+fromLbl);
msg.setText ("\nMessage: "+msgTxt);

msgpane.add(to);
msgpane.add(from);
msgpane.add(msg);
add(msgpane);

}
}

Wednesday, August 18, 2010

Learning Different Skills

I once read an IQ - booster article from Reader's Digest that IQ can be further improved through acquiring new skills that will allow new brain nerves to form. This goes with having an excellent and smart partner, challenging job, and reading more to name a few.



As an IT teacher, my work involves doing programming, so, I can somehow be assured that my days aren't that dull and boring; however, my new venture in business requires me to do all the marketing, managerial and accounting works that my 24/7 time is not at all sufficient.


Thus, I wish to employ the services of other individuals especially to work on  accounting jobs  to make my tasks less tiring, draining and chaotic. I can seem to learn to do all the tasks related to business and programming, but, with physical drain and time constraints, I guess getting a hired help is a more viable option.


It is indeed scientifically proven that IQ can accelerate through genes and environment, and doing something about it to make wiser decisions on personal or professional matters make a significant difference.  So, while young and able, learn new skills!

Tuesday, August 17, 2010

How To Prepare for Your Exams

It is examination today until Friday and even though I kid around my students about preparing for their cheat logs, I strictly stressed that nothing beats preparing for the exams and this means studying through each subject in an ample time, so, concepts and theories can be better understood.

Having graduated with honors from basic education to graduate school proves only these tips to be fool - proof:

1. Keep complete notes and resources on your subjects. Secure a course outline that is normally given at the start of the semester. Reading through these references can give you a headstart;

2. Work on your term - end requirements ahead of deadlines to give enough time for reviewing;

3. Prepare an outline from all your reading materials. If this cant be done, you can highlight the main points on your notes or books. Provide notes or comments for easy recall.

4. Review at least few days to a week and give longer time on subjects that are difficult to master. On the week of test, simply skim over your notes and relax more. Your prior review shall be enough to get you covered for your test;

5. Be around during your professors' review time. Normally, professors or teachers are generous that they give tips and cues on what to expect from your exams.

6. On the day of your exam, RELAX! A breathing technique or/and a prayer will help clear your mind and make you more focused.

7. On the day of your test, read your exam's directions first before going through each question;

8. Sometimes, questions give for cues on what should be the best answer, single out these cues.

9. Before you submit your exams, review all your answers and check if  all questions are covered.

10. After a long exam, pamper yourself and repeat the above tips for your next scheduled exam.

All these tips apply for short or long tests. I tell you, having an A+ grade is not easy but it is never impossible. GOOD LUCK!

Java Thread's Runnable Interface

A thread can be run in two ways, using  Thread class and Runnable Interface.   Like extending a Thread class, the use of Runnable interface allows us to execute the run method through the invocation of start ( ). But, unlike Thread where we simply make an instance of the class, a runnable interface allows to create an object of Thread class and associate this with our Runnable object.

A program below creates 3 threads of S - T - I (along with the main method as another thread) using Runnable.

[+/-] show/hide


class PrintName implements Runnable{
Thread thread;

PrintName(String name)
{ thread = new Thread(this, name);
thread.start();
}
//implements run() method defined in the Runnable interface
public void run()
{
String name=thread.getName();
for(int i = 0; i<10;i++)

System.out.print(name); }
}

public class ThreadRunnable2{
public static void main (String [] args){
//since the constructor of the PrintName
//object creates a Thread object and
//starts it, there is no need to do it here

new PrintName("S");
new PrintName("T");
new PrintName("I"); } }

School Requirements Again

Our midterm exams shall start tomorrow and shall run until Friday and with term - end exams come other requirements which include laboratory works, term papers, and system projects for most students in IT programs.


As a teacher and a student before, I quite realized how difficult it is to pursue schooling especially collegiate and graduate programs where grades are heavily determined through academic performance. It is however, a fact that with all the piled works, having a help from the experts like technical mentors or for term paper service can be great relief already. Furthermore, not all students are gifted when it comes to writing skills or problem - solving and analytical skills and with mentors and resources at their disposal can make the restraints less cumbersome.


So, I often tell my students to harness their skills through regular readings of more relevant materials that will challenge their comprehension, constant practice of these skills, and wisdom from trusted mentors.


With all the endless school requirements, I can only feel sorry for my students but the hard toil is only natural for students to harness their holistic skills and development. It is indeed that time management can be well mastered, so, to get things done on time and of quality.


So, if you say, “ I have to write my term paper” or “work on my lab projects,” then, do something productive about it.

Sick But Teaching

The weather has been frantic here in the Philippines as it shifts from heat to rain in the same day for almost a month now. And, with dengue cases accelerating so are the cases of flu and colds. My family is stricken of colds too and although I have a strong stamina for illnesses, my fatigue and deprived sleeps overwhelm my physical endurance already causing me to nurture colds too.

But, in spite of the illness, I can't rest from teaching works nor from business operations. I  can only get rest and somehow manage it through the days until my colds gets better.

Friday, August 13, 2010

School Exams Soon

We are on our last week before our Midterm exam next, however, except for my System Analysis and Design subject, I am done with my  required course topics. I can use the remaining meeting next week to have a class review and complete on laboratory and paper checking.


I am only glad that I can relax and enjoy my weekend without the subject preparation. Perhaps, I can invite family or friends on BBQ session using   outdoor electric grills   and simply have fun and enjoy bonding time.


Nothing beats energy recharging through having a loving and fun time with dear ones.

Java's Syncronized Block

In  the previous post, the sample program made use of synchronized methods, but, synchronized block can be used to perform the same task.

Find below the revised program.

[+/-] show/hide


/** Based on example from Sun Thread tutorial */

class Reentrant {

public void a() {

synchronized(this){ // use of syncronization block
b();
System.out.println("here I am, in a()");
}}

public synchronized void b() { // use of syncronization method
System.out.println("here I am, in b()");
}
}

class TestReentrant {
public static void main(String[] args) {
Reentrant r = new Reentrant();
r.a();
}
}

Java's Thread Synchronization

Threads can be done in parallel, however,  a typical problem with running multiple threads is when these processes try to access the same record or variables. To resolve this conflict, synchronization is used to allow locking.

Lock of variables can be done using the synchronization method or using a synchronization block. When a thread gets into a synchronized method, it enforces locking but as soon as it leaves the block or method, unlocking is automatic allowing for other threads to get into the block or method.

Below is the sample program of thread synchronized methods.

[+/-] show/hide

/** Based on example from Sun Thread tutorial */

class Reentrant {

public synchronized void a() {
b();
System.out.println("here I am, in a()");
}
public synchronized void b() {
System.out.println("here I am, in b()");
}
}

class TestReentrant {
public static void main(String[] args) {
Reentrant r = new Reentrant();
r.a();
}
}

Tuesday, August 10, 2010

Midterm is Coming

Next week shall be a busy time for most teachers and students as they hurdle through their Midterm coverage. I, for one, am not done with all the paper works and they continue to pile up. With busy time from business and school, I can only wish that I can find recreational means or other alternatives to de - stress or de - toxify me.

Alternative medicine and psychologists say that water can have a therapeutic effect on individuals. Scientific or not, I simply love watching water from the sea, aquarium or brook because they mean life and hope.


So, if I want means, alternative or otherwise, I shall have my own place with a water pool or pond with  pond pumps   to keep it safe and clean.


I can only advice my students though that when  they prepare for their test, they must do it few days before the tests and too relax on the big days to calm down.

Java's Thread Timer

A thread timer can be used with Java; See the program below with Java utilities. 

[+/-] show/hide


import java.util.Timer;
import java.util.TimerTask;

/**
* Simple demo that uses java.util.Timer to schedule a task to execute once 5
* seconds have passed.
*/

public class ThreadReminder {
Timer timer;

public ThreadReminder(int seconds) {
timer = new Timer();
timer.schedule(new RemindTask(), seconds * 1000);
}

class RemindTask extends TimerTask {
public void run() {

int x=1;
for(int ctr=1000;ctr<=1005;ctr++)
System.out.print(" "+x++); System.out.println("Time's up!");
timer.cancel(); //Terminate the timer thread
} }


public static void main(String args[]) {
System.out.println("About to schedule task.");
new ThreadReminder(5);
System.out.println("Task scheduled."); } }

Java's Thread Priorities

 A single - processor CPU can get lost as to identify which process or thread must be done first and next. Time splicing however is commonly known in recent computer systems. According to priority or time slice, a process can be selected and run.

In Java, a priority may range from 1 to 10 where 1 is the least and 10 as the highest. You can use variables like Thread.NORM_PRIORITY, Thread.MIN_PRIORITY, and Thread.MAX_PRIORITY to indicate 5, 1 and 10 priorities respectively.

See the program below for this illustration.
[+/-] show/hide




class PriThread extends Thread {

PriThread(String name, int pri) {
super(name);
setPriority(pri);
start();
}

public void run() {
System.out.println(getName()+"="+getPriority());
}
}

public class ThreadPriority {
public static void main(String args[]) throws Exception {
PriThread mt2 = new PriThread("Low Priority", Thread.NORM_PRIORITY - 1);
PriThread mt1 = new PriThread("High Priority", Thread.NORM_PRIORITY + 1);
mt1.join();
mt2.join();

}
}

Schools in Rainy Season

It is rainy season again in the Philippines but as usual, we continue with our regular school and business works in spite of the rain fall.

We are however, happier that because of the rain, our water shortage is all filled up again and with that the problem on energy crisis is initially addressed.

At these cool days, we can only wish for  electric blanket  that can all keep us warm and secured from the angry fist of winds and rains.


We can only be hopeful that rain - related problems won't arise as the economy is still struggling and that school children are away.  For now, we can only contend to bring our raincoats and umbrellas to keep us comfy and warm.

Java Thread's Sleep Method

You can use several methods with threads including start ( ), join ( ), wait ( ) and even sleep ( ). The sleep is used to allow the thread to pause in milliseconds ( 1 second = 1000 milliseconds). Thus, if you need 60 seconds or 1 minute, simply write,

sleep(60000);

But, sleep method works with try and catch blocks to accept InterruptedException during pause. Check the program below for our sample.

[+/-] show/hide



class HelloThread2{
public static void main(String[] args){
HelloThread1 myHello=new HelloThread1();
myHello.start();
}
}

class HelloThread1 extends Thread {
private static final int TIMES =5;
public void run()
{
for(int x=1;x<=TIMES;x++) { System.out.println("Hello"); if (TIMES==4) try{ sleep(60000); } catch (InterruptedException e) { } } } }

Java's Thread Class

 A thread is a flow of execution from start to end and with multi-tasking in most computer systems, several programs can be run almost at the same time (with milliseconds interval among programs).

A process may create several threads and in Java, a singe tread from a simple program is actually done. However, we can also create several threads to maximize our processor. And, Java allows thread creation through extending the Thread class or running a Runnable interface.

When using Thread class, you can execute the overriding run method  through start( ) method. See the sample program below that displays 5 times a message Hello.

[+/-] show/hide



class HelloThread1 extends Thread {
private static final int TIMES =5;
public void run()
{
for(int x=1;x<=TIMES;x++) System.out.println("Hello"); } } class HelloThread2{ public static void main(String[] args){ HelloThread1 myHello=new HelloThread1(); HelloThread1 Hello = new HelloThread1(); Hello.start(); myHello.start(); } }

Saturday, August 7, 2010

How to Relieve of Stress

Stress is known to cause fast aging, health disorders and depression among others and with these medically proven effects of stress, it is only imperative that we find means to relieve ourselves of this inevitable condition and protect ourselves.

Experts say that finding an outlet or two to de-stress can help you re-energize your enthusiasm and energy. If I am all burned out from work, family or simply fast - pace lifestyles, I employ the following stress mechanisms:

  1. watch movies at home or in theaters with friends or loved ones;
  2. cultivate my garden with  hydroponic systems   and re-plant seedlings; 
  3. read novels and all - time classics;
  4. go to a beauty parlor for hair treatment or pedicure and spa;
  5. body or foot massages;
  6. zip my fave ice coolers;
  7. play with kid and nephews;
  8. blog my day;
  9. eat my sin food like chocolates;
  10. jog or do taebo every week;
 Whatever you do to relax means something already. The bottomline is learn how to recharge your life for  more fun days ahead.

Java Streams and Files

You can use files as source and destination of your text and with streams to act for input and output can carry through your file's contents.

Below is the is another program on streams.

[+/-] show/hide


/*reading from a file*/
import java.io.*;
public class ReadFromFile{
public static void main (String[] args) throws IOException{
InputStream istream;
OutputStream ostream;
int c;
File inFile=new File("\\Documents and Settings\\Rose\\My Documents\\NetBeansProjects\\SampleExercises\\src\\data.txt");
File outFile=new File("\\Documents and Settings\\Rose\\My Documents\\NetBeansProjects\\SampleExercises\\src\\output.txt");
istream= new FileInputStream(inFile);
ostream=new FileOutputStream(outFile);
try{

while ((c=istream.read()) != -1){
ostream.write (c);
}
}catch (IOException e)
{System.out.println("Error :"+e.getMessage());}
finally {
istream.close();
ostream.close(); }
}
}

Maximizing Java Streams

Streams in Java are used to course through data from a source like keyboard or file among others to a destination like monitor, printer or file to name a few.

A stream can either be a byte or character stream; ideally, if you wont work on images or sounds, typical inputs of text can work well with character streams.


You can associate a file class with your stream class  to work either as the source or destination. Find below the sample program.

[+/-] show/hide

/*prints from a given file to an output stream*/
import java.io.*;

public class ReadFromToStream {

public static void main (String[] args) throws IOException{
//InputStream istream;
InputStream fstream;
OutputStream ostream;
int c;
File fromFile=new File("\\Documents and Settings\\Rose\\My Documents\\NetBeansProjects\\SampleExercises\\src\\data.txt");
ostream=System.out;
fstream=new FileInputStream(fromFile);
try{

while ((c=fstream.read()) != -1){
ostream.write (c);
}
}catch (IOException e)
{System.out.println("Error :"+e.getMessage());}
finally {
fstream.close();
ostream.close(); }
}
}


Monday, August 2, 2010

How to Improve Communication Skills

Communication skill is a fundamental competency that everyone must acquire; and to have effective communication, we can only write and speak clearly what we intend to relay to our readers or listeners. Unfortunately, communication skill is not naturally acquired nor immediately mastered. With practices, reading/learning, we can however, improve our communication skill to higher extent.

To improve your communication skills, you try the following:

  1. Develop self confidence, so, not to stammer or talk fast or speak incoherently;
  2. Improve your grammar and pronunciation faculty; grammar and pronunciation books or tutorials can help you in this area and doing so, you boost more your confidence that your language is free from any technical error;
  3. Modulate your voice; learn how to incorporate enthusiasm without being too loud. Singing or shouting in different tones can help you adjust your voice;
  4. Practice with your writing skills too. School requirements can be easy start to develop your writing skills where you can write articles or essays but should this be impossible to do, you can hire  custom essay writers  for their paper writing services or you can buy essay online from which you can assess how professional writers can convey their messages intelligently and cohesively; 
  5. Have a mentor to check on your progress and work with you in improving your communication skills.

Communication is a basic process and only if we can assert and express ourselves that we make sure others perfectly understand our message. Thus, we should never stop from improving our communication limitations because help can be sought.

Attending My Kid's School Function


with my kid as the french fries man

Winning the grand prize for best in costume with the school personnel and 1st runner up - the grapes
lady

Last July 30, we joined the Nutrition Month celebration of my kid's school and as expected he joined all the rest of the studentry as  they showed off their different vege and fruit costumes. 

It was quite unusual for my kid as he put on a french fries costume, and with all the hard labor putting all his costume together with my nephew's, he coveted the grand prize. We were only happier then that  he had great time along with his gifts and prizes.

It was a long and rainy afternoon but we all went home with happy faces.