Archive | October 2011

Never play with spirits: True-to-life tales from high school

I never believed in “sapi”, “sanib” or “being possessed by spirits” until I personally witnessed it.

When we were first year high school students, my batchmates (dormmates) and I used to gather in one of the rooms and “play” spirit of the coin. We would post “Don’t Disturb: Recording going on” on our doors so that nobody would disturb our session.

At first it was just out of boredom and we would ask silly teenager questions like “Does X has a crush on Y?” and the coin would move to “Yes” or “No”. I honestly thought my friends were just playing jokes and they were the ones who were moving the coin. About twenty of us would gather in one room and huddle around the tiny piece of paper with the coin on it. Sometimes, although I’m no longer interested, I won’t leave the room because I’m too scared to go back to my room.

We soon got tired of the easy and boring questions and started asking harder and scarier ones. Like “how did you die?”. And the coin would start spelling “r-a-p-e” and “h-e-l-p” A few of us got scared and others were just skeptical. We also got more scary question-and-answer sessions and soon decided that it was time to stop.

A few years later, when we were already juniors, the movie “The Craft” became popular and some of our batchmates even bought books on witch craft. We “practiced” levitation and chanting on each other in the dorm during the weekends. “Light as a feather, stiff as a board…” It wasn’t really serious, we were just having fun and experimenting.

While we were having our Dorm Halloween party in the canteen, I went to the open field (between the girls and boys dormitories) with three of my friends. There we started to “invoke” the spirits the way the four girls in the movie “The Craft” did. It was almost midnight.

Of course, nothing weird happened during that time and we just laughed at ourselves and went inside the canteen to dance with our friends.  However, weird things did start to happen the night after our little “joke”.

One of our friends started screaming and acting strange. Friends prayed with her until she started acting normal again. However on Monday morning, while we were having our flag ceremony,  she got “possessed” again. The teachers came to her rescue and brought her in the prayer room. But things just got weirder. Students from other year levels were getting “possessed” too.

There were lots of screaming and people passing out. One of the girls from the sophies was saying things in a different language. She was really strong, a number of people were holding her but she still managed to push them away. I got goosebumps all over my body.

Classes were suspended on that day. Those who lived in the city were asked to go home while the dormers stayed behind and were asked to gather in the hall. The teachers started to investigate about what happened. They inspected our rooms in the dorm and anything related to black magic or witch craft were confiscated – including Archie (comic books – because of Sabrina, the teenage witch) and magic cards. They were all burnt. And we were prohibited from using or buying any of them again.

The atmosphere in the whole school was eerie and scary. Others were just happy that classes were canceled, a few were nonchalant but a number of us (including me) got really, really scared.

Obviously we have all moved on since that day in our high school life. Maybe many of us already forgot about those incidents but I have never forgotten – especially the lesson I learned: “Never, ever disturb and play with spirits. Unless you want them to disturb you.”

Advertisements

Eternal Sunshine of a Spotless Mind & No Other Woman

Eternal Sunshine of a Spotless Mind

This movie caught my attention when I turned on the  TV. I forgot about my dance exercise and cooking lessons altogether. Jim Carrey and Kate Winslet were a strange couple. The movie was very intriguing and it would keep you thinking and guessing. Clementine (Kate Winslet)  brought color and excitement to Joel (Jim CarreyUntil)’s dark and boring life. Until one day, Clementine didn’t seem to recognize Joel anymore – which left Joel broken and hurt.

Apparently,  Clementine has erased Joel from her memory through a medical procedure. She requested that the procedure be done to her because she was no longer happy with her relationship with Joel and she wanted to move on. I instantly remembered the time when I so wanted for someone to invent a “memory pill” so that I could forget everything about my past, delete them all from my memory and just stop hurting. It’s like that when we experience so much pain, we could make permanent decisions based on temporary feelings.

Back to the movie.. Joel decided to have the same operation so he could also forget all about Clementine and just move on with his life. Meanwhile, an interesting twist happened in the story. The doctor’s wife caught him and his secretary making out. The younger girl asked for forgiveness and admitted that it was her mistake for having a silly crush on the doctor and told the wife that there was really nothing going on with the two of them. Surprisingly, the wife pitied the young girl and told the doctor to tell the truth to her.

The doctor’s secretary (Kirsten Dunst) discovered that the doctor performed the procedure on her because they had an affair and they both agreed that it would be best if she’d forget about the two of them because the doctor was married and had kids. Later, the secretary discovered that she was happier before the operation and now she was miserable. She wanted all the other patients who had the procedure performed on them to remember their past and she sent all the recorded tapes to them – including Clementine and Joel – who were, at the meantime, getting to know each other again (without knowing that they had a past).

Both Clementine and Joel (who were starting to get romantically involved with each other again) were shocked to receive their respective recordings with the doctor – detailing why they wanted the procedure to be done on them. They realized that they were already a couple before and they wanted to erase each other from their lives.

Did they end up together – again? Hmmm..maybe. Sometimes in our lives, we could come to a point when we just want to delete people from our lives. Deleting them from our contact list on our phones or friends list on Friendster/Facebook can be really therapeutic and can help us in our process of healing. But that doesn’t mean that we are able to completely delete them from our lives – and the reality is, we really CAN’T.

We all have our own ways of healing and moving forward. And later, when the pain is gone, we will be able to see how and why that person became a part of our lives. 🙂

No Other Woman

Why did I relate this movie with the previous one? Because the former also had an interesting story of how a married man wanted to correct his mistakes by erasing himself from the memory of his mistress.

With No Other Woman, if you are a wife, you’d feel triumphant and proud. And if you are a mistress, it makes you realize that you are fighting a losing battle – except if the married man is really in love with you and is willing to leave his family for you. Tough luck.

It’s really a nice movie – really worth my time and money. Aside from being a huge fan of Anne Curtis and Derek Ramsay is like, my super crush, the movie was well written. Thumbs up to Philippine Cinema.

Now women have an idea on how to be a cool, “palaban”, and smart wife – you have to fight for your right, for your love, and for your man! And keep them away from hot, seductive, temptations a.k.a. mistresses. Haha.

Even Streetchildren are Our Future

I had a fulfilling Saturday afternoon last Oct 15. I spent it with some of the street children in Manila. Instead of just staying at home, watching TV and wasting my time away, I went out and met these kids.

I signed up for Accenture’s volunteer program for teaching street children, partnering with ChildHope Asia Philippines and now I have a wonderful chance to reach out to these often neglected and misunderstood members of our society.

Prior to our immersion in the field, the staff of ChildHope Asia Philippines oriented us about the organization, their advocacy, and their activities.


Christian, one of CHAP’s staff, is asking the children to illustrate their "pangarap" (dreams) on a piece of paper.

One of the children shares that he wants to be a football player or a policeman someday so that he can help his family. He said that he will only be able to achieve his dreams if he can finish his studies.Kuya Christian tells them a story of a man who was able to achieve his dream because he had confidence in himself. And he shared to them inspiring stories of Henry Sy, Isko Moreno, and Manny Pacquiao. Simple, poor men who believed in their dreams, worked hard, and are now successful. He encouraged them that someday, they can also be like them.

 

We also went to another site, a park in Manila to observe another group of street children. When we arrived, kuya PeeWee, one of CHAP’s teachers, introduced as to the children and they all flocked to us para mag mano. On the picture below, the children are watching a short film on the mobile classroom of CHAP – a part of their values formation.

I really admire the people behind ChildHope Asia Philippines. Its organizers, staff, and volunteers are all working together to help make a difference in these children’s lives. Some of us may get easily irritated by these kids begging on the streets or in jeepneys and consider them as eye sores but if you really try to see beyond what your eyes could see, you’d discover that these are just children, hungry for the society’s love and acceptance. As the song goes, "I believe that the children are our future, teach them well, and let them lead the way… Show them all the beauty they possess inside, give them a sense of pride…"

Even Streetchildren are Our Future

I had a fulfilling Saturday afternoon last Oct 15. I spent it with some of the street children in Manila. Instead of just staying at home, watching TV and wasting my time away, I went out and met these kids.

I signed up for Accenture’s volunteer program for teaching street children, partnering with ChildHope Asia Philippines and now I have a wonderful chance to reach out to these often neglected and misunderstood members of our society.

Prior to our immersion in the field, the staff of ChildHope Asia Philippines oriented us about the organization, their advocacy, and their activities.


Christian, one of CHAP’s staff, is asking the children to illustrate their "pangarap" (dreams) on a piece of paper.

One of the children shares that he wants to be a football player or a policeman someday so that he can help his family. He said that he will only be able to achieve his dreams if he can finish his studies.Kuya Christian tells them a story of a man who was able to achieve his dream because he had confidence in himself. And he shared to them inspiring stories of Henry Sy, Isko Moreno, and Manny Pacquiao. Simple, poor men who believed in their dreams, worked hard, and are now successful. He encouraged them that someday, they can also be like them.

 

We also went to another site, a park in Manila to observe another group of street children. When we arrived, kuya PeeWee, one of CHAP’s teachers, introduced as to the children and they all flocked to us para mag mano. On the picture below, the children are watching a short film on the mobile classroom of CHAP – a part of their values formation.

I really admire the people behind ChildHope Asia Philippines. Its organizers, staff, and volunteers are all working together to help make a difference in these children’s lives. Some of us may get easily irritated by these kids begging on the streets or in jeepneys and consider them as eye sores but if you really try to see beyond what your eyes could see, you’d discover that these are just children, hungry for the society’s love and acceptance. As the song goes, "I believe that the children are our future, teach them well, and let them lead the way… Show them all the beauty they possess inside, give them a sense of pride…"

Answers to my Hibernate/Struts 2 Questions

1. How is session factory created from the hibernate.cfg.xml?

    Session factory creates or opens a session to the database. Usually, an application has a single SessionFactory. Its behaviours are controlled by properties supplied at configuration time, through the hibernate.cfg.xml and is instantiated through this statement:

AnnotationConfiguration().configure().buildSessionFactory(), which is usually placed in a Hibernate util/helper class. SessionFactory is immutable, meaning, it is not subject or susceptible to change and is a thread safe object intended to be shared by all application threads.

2. Why should serializable be implemented by the model classes?
 
    According to Wikipedia, serialization is the process of converting a data structure or object state into a format that can be stored (ex., in a file or memory buffer, or transmitted across a network) and "resurrected" later in the same or another computer environment. When the resulting series of bits is reread according to the serialization format, it can be used to create a semantically identical clone of the original object.
    Serializable means that the object can be converted to a byte stream and that byte stream can also be reverted back to a copy of that object (deserialization). According to the Java API, a Java object is serializable if its class or any of its superclasses implement either the java.io.Serializable interface or its subinterface, java.io.Externalizable.
    According to one of the posts on StackOverFlow, the model objects must be serializable so that Hibernate can pass it to the database layer.
 
3. What are the uses of Annotations? Why should I put annotations in the model class? @Entity and @GeneratedValue @Column?
 
    Annotations provide data about a program that is not part of the program itself. They have no direct effect on the operation of the code they annotate. They can be applied to a program’s declarations of classes, fields, methods, and other program elements (from Java API).
@GeneratedValue – provides for the specification of generation strategies for the values of primary keys. – may be applied to a primary key property or field of an entity or mapped superclass in conjunction with the Id annotation.
    In my experience with experimenting with the working Hibernate(with MySQL) sample, it is important that the correct table name is specified for the @Entity annotation, (as well as the correct column names for the @Column annotation) so that Hibernate can make the proper connections/associations with the table/column – for session.save() and session.load() to work correctly.
 
4. Why do I have to create a serialVersionUID?
 
    According to javapractices.com, the serialVersionUID is a universal version identifier for a Serializable class. Deserialization uses this number to ensure that a loaded class corresponds exactly to a serialized object. The aforementioned site also gives guidelines for using and generating serialVersionUIDs.
 
5. What does session.load(class,identifier) do?
 
    session.load is a method in Hibernate’s API that retrieves a single instance of a class, identified by its unique identifier. It is similar to session.get(class, identifier). They can both use the cache in retrieving an object, avoiding database hit if the object is already in the cache. However, their difference is that if load() can’t find the object in the cache nor in the database, an exception is thrown whereas get() returns null if the object is not found.
 
6. How does session.createQuery(String) work?

 

   According to http://www.javabeat.net/tips/106-three-ways-to-create-query-in-hibernate.html, there are actually 3 ways to create a query in Hibernate:

    a. session.createQuery() – uses HQL (Hibernate Query Language) syntax. To read more about HQL, refer to this link
        ex: Query query = session.createQuery("from Student s where s.name like ‘k%’");

    b. session.createSQLQuery() – uses the native SQL syntax
        ex: Query query = session.createQuery("Select * from Student");

    c. session.createCriteria() – creates Criteria object for setting the query parameters, useful for those who don’t want to write the query by hand. You can specify  any type of complicated syntax using the Criteria API.
       ex: Criteria criteria = session.createCriteria(Student.class);    

 

Overwhelming Learning Stream

​Finally!!! I have a Struts 2 + Hibernate working example! 🙂

Questions I have to answer:

1. How is session factory created from the hibernate.cfg.xml?

2. Why should serializable be implemented by the model classes?

3. What are the uses of Annotations? (I’ve read about this before but I still have to know more about it)
    Why should I put annotations in the model class? @Entity and @GeneratedValue @Column?

4. Why do I have to create a serialVersionUID?

5. What does session.load() do?

6. How does session.createQuery(String) work?

I came across numerous streams of exciting information about different frameworks/tools/technologies related to J2EE in the past few days. It’s been a really exciting adventure. I learned about Maven, Hibernate tools, and Icesoft. When I was already feeling really anxious to have a working sample of Struts 2 + Hibernate integration, I came across this site: http://viralpatel.net/blogs/2010/01/tutorial-struts2-hibernate-example-eclipse.html. It was just what I needed – a Struts 2 + Hibernate + MySQL tutorial. I had problems working with Maven because I am not yet very familiar with how I should run the application within Eclipse. So I decided to look for a tutorial that does not involve Maven. However, I will go back to it again in the future because I appreciate its use and how it simplifies the (automatic) downloading (collection) of jar files.
 
Right now, my priority is to learn Hibernate with MySQL so that I can start on building my mini-project.

 

Hibernate

I’ve been having a hard time following the tutorial on Struts 2 with Hibernate. I felt frustrated and disappointed a couple of times when the application just won’t run and it seems to need a number of components for Hibernate to work successfully. I really felt like giving up. Whew.

But of course, I am not a quitter so I have to look for ways to really understand these stuff. If I want to learn J2EE frameworks, well… I need to be patient with myself and just keep on trying.

I had a problem working with the vaannila tutorial since it is using HSQL. And I can’t download the installer for that. So I had to look for other tutorials on Hibernate with MySQL. Luckily, I came across this site: http://facestutorials.icefaces.org/tutorial/hibernate-tutorial.html. It’s just what I needed.

Just when I thought I’d be able to get it running, some errors were identified by Eclipse and I needed to add a new library.. I realized that I needed to install IceFaces to get it running… So I have to register at IceSoft and download the zip files.. Now, I hope this works..

I’ll try to understand the code later. I just need to get this to work. Now.

On Focus: Struts 2

​I have a lot to catch up on my self-study on Struts 2. I wasn’t able to meet my targets last week because of some higher priority tasks.

This week, I have to focus more on integrating Struts 2 with Hibernate, completing the CRUD tutorial, and building my first mini-project.

 

Even StreetChildren are Our FUTURE: ChildHope Asia Philippines

I had a fulfilling Saturday afternoon yesterday. I spent it with some of the street children in Manila. Instead of just staying at home, watching TV and wasting my time away, I went out and met these kids.

I signed up for my company’s volunteer program for teaching street children, partnering with ChildHope Asia Philippines and now I have a wonderful chance to reach out to these often neglected and misunderstood members of our society.

Prior to our immersion in the field, the staff of ChildHope Asia Philippines oriented us about the organization, their advocacy, and their activities.


Christian, one of CHAP’s staff, is asking the children to illustrate their “pangarap” (dreams) on a piece of paper.

One of the children shares that he wants to be a football player or a policeman someday so that he can help his family. He said that he will only be able to achieve his dreams if he can finish his studies.Kuya Christian tells them a story of a man who was able to achieve his dream because he had confidence in himself. And he shared to them inspiring stories of Henry Sy, Isko Moreno, and Manny Pacquiao. Simple, poor men who believed in their dreams, worked hard, and are now successful. He encouraged them that someday, they can also be like them.

We also went to another site, a park in Manila to observe another group of street children. When we arrived, kuya PeeWee, one of CHAP’s teachers, introduced as to the children and they all flocked to us para mag mano. On the picture below, the children are watching a short film on the mobile classroom of CHAP – a part of their values formation.

I really admire the people behind ChildHope Asia Philippines. Its organizers, staff, and volunteers are all working together to help make a difference in these children’s lives. Some of us may get easily irritated by these kids begging on the streets or in jeepneys and consider them as eye sores but if you really try to see beyond what your eyes could see, you’d discover that these are just children, hungry for the society’s love and acceptance. As the song goes, “I believe that the children are our future, teach them well, and let them lead the way… Show them all the beauty they possess inside, give them a sense of pride…”

Struts 2: Interceptors

I am currently following the tutorial on Struts 2 at vaannila.com​.

I went through the tutorial on Interceptors but I still don’t quite understand the concept fully yet. However, I am now more familiar with using DispatchAction functionality in Struts2. I can put methods such as add, update, delete and execute in one Action file and do the necessary action mapping in the struts.xml file. I also found out that it is much better to use generalized action mapping by using the asterisk and {1} so that I don’t have to map each method to the corresponding action. This is also called Dynamic Method Invocation  using wildcard mapping.

I have also done the tutorial on validation in Struts 2. It is quite simple and straightforward. Another way to do it is by using an XML file but I haven’t made it work just yet (saving it for tomorrow). =)

I have learned quite a bit already and I’m excited to finish all the topics in the tutorial so that I could get my hands dirty building my first mini-project.

I still have to understand more about interceptors though. Hmm. That’s for tomorrow. Time to go home.