Tuesday, February 19, 2013

Stephanie Jillian Benito


Here are some pictures of my little one.

At birth

1st Month
2nd Month


3rd Month


4th Month

5th Month


6th Month

7th Month

8th Month

9th Month

10th Month
It's less than 2 months and she will be turning one year old.








Iterating over List elements

The common way to iterate over List elements:

List list;
for (int i = 0; i < list.size(); i++) {
    doSomething(list.get(i));
}

The correct way to iterate polymorphic List is via Iterator or for-each loop:

List list;
for (Iterator it = list.iterator(); it.hasNext(); ) {
    doSomething(it.next());
}

// for each
for (E elem : list) {
    doSomething(elem);

Tuesday, November 27, 2012

See you when I see you...


I'll see you in a bit, Mountains....





Top priorities for the future...
Building shelter for the little ones...
B12 L04 coming soon...
Positive vibes ahead...

Sunday, April 1, 2012

Finally, after 41 weeks and 2 days of long waiting our baby has been delivered via emergency cesarean section. Welcome to the outside world baby Stephanie Jillian Benito. We love you. - Mommy and Daddy




Friday, March 16, 2012

JAVA: File and Directory Creator

This article will teach you on how to create and delete file(s) and directory(ies).
Below are the following code:

FileCreator.java

import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.OutputStream;
import org.apache.log4j.Logger;
/**
 * Utility for creating new files and directories
 * @author Froilan Cardosa Benito
 * @since August 25, 2007
 */
public class FileCreator {
   /**
     * This method is used to create file. 
     * @param path 
     * @param fileName
     */
   public void createFile(String path, String fileName){
      try {
  OutputStream fileWriter = new FileOutputStream(path + fileName);
 fileWriter.close();
  } catch (FileNotFoundException e) {
         System.out.println(e.getMessage());
  } catch (IOException e) {
   System.out.println(e.getMessage());
  }
  }
  /**
  * This method is used to create directory.
  * @param directoryName
  * @return boolean
  */
  public boolean createDirectory(String directoryName){
  boolean isSuccessful = false;
  try{
  File directory = new File(directoryName);
if(!directory.exists()){
isSuccessful = (new File(directoryName)).mkdir();
  if (isSuccessful) {
System.out.println("\n~ Created directory " + directoryName + " successfully!");
  }
}else{
// Remove the previously created directory.
deleteDir(directory);
// Create a new directory.
isSuccessful = (new File(directoryName)).mkdir();
if (isSuccessful) {
               System.out.println("\n~ Created directory " + directoryName + " successfully!");
            }
         }
      } catch(Exception e){
  System.out.println(e.getMessage(), e);
isSuccessful = false;
  }
      return isSuccessful;
   }
   /** 
     * This method is used to delete a specific directory.
  * @param dir
  * @return boolean
  */
  private boolean deleteDir(File dir) {
      if (dir.isDirectory()) {
         String[] children = dir.list();
         for (int i=0; i
boolean success = deleteDir(new File(dir, children[i]));                
if (!success) {                
               System.out.println("Unable to delete directory " + dir.getName());
               return false;    
            }else{ 
               System.out.println("\n~ Deleted directory " + dir.getName() + " successfully!");
            }
         }
      }
      // The directory is now empty so delete it
      return dir.delete();
   }
   /** 
     * this method is used to create directory without existing delete. 
     * @param directoryName
  * @return boolean
     */
   public boolean createDirectoryWithoutExistingDelete(String directoryName){
  boolean isSuccessful = false;
  try{
         File directory = new File(directoryName);
         if(!directory.exists()){
  isSuccessful = (new File(directoryName)).mkdir();
  if (isSuccessful) { 
               System.out.println("\n~ Created directory " + directoryName + " successfully!");
  }
  }else{
 System.out.println("\n~ Directory " + directoryName + " exists!");
  }
      } catch(Exception e){
          System.out.println(e.getMessage(), e);
          isSuccessful = false;
      }
      return isSuccessful;
   }
   /**
     * This method is used to create multiple directories.
     * @param directoryNames
     * @return boolean
     */
   public boolean createDirectories(String directoryNames){
      boolean isSuccessful = false;
      try{
         isSuccessful = (new File(directoryNames)).mkdirs();
         if (isSuccessful) {
              System.out.println("\n~ Directories: " + directoryNames + " created!");
         }
      } catch(Exception e){ 
         System.out.println(e.getMessage(), e);
         isSuccessful = false;
      }
      return isSuccessful;
   }
}
Related Posts Plugin for WordPress, Blogger...

Blog List