Spring Web Flow 2.0: Hello World!

Description:

A very simple example of Spring Web Flow 2.x. This small program will show you how a simple page flow works.

Project Structure:

projstructture

 

Dependencies:

  • org.springframework.js-2.0.5.RELEASE.jar
  • spring-beans-3.2.8.RELEASE.jar
  • spring-binding-2.3.3.RELEASE.jar
  • spring-context-3.2.8.RELEASE.jar
  • spring-core-3.2.8.RELEASE.jar
  • spring-expression-3.2.8.RELEASE.jar
  • spring-web-3.2.8.RELEASE.jar
  • spring-webflow-2.3.2.RELEASE.jar
  • spring-webmvc-3.2.8.RELEASE.jar

Server:

  • JBoss V4.2

 

Source Code:

web.xml
<?xml version=”1.0″ encoding=”UTF-8″?>
<web-app xmlns:xsi=”http://www.w3.org/2001/XMLSchema-instance&#8221;
xmlns=”http://java.sun.com/xml/ns/javaee&#8221;
xsi:schemaLocation=”http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd&#8221;
id=”WebApp_ID” version=”2.5″>
<display-name>Hello World</display-name>
<servlet>
<servlet-name>mvc-dispatcher</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
<init-param>
<param-name>contextConfigLocation</param-name>
<param-value>/WEB-INF/spring/mvc-dispatcher-servlet.xml</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
     <servlet-mapping>
<servlet-name>mvc-dispatcher</servlet-name>
<url-pattern>/</url-pattern>
</servlet-mapping>
</web-app>
 
mvc-dispatcher-servlet.xml

<beans xmlns=”http://www.springframework.org/schema/beans&#8221;
xmlns:mvc=”http://www.springframework.org/schema/mvc&#8221; xmlns:context=”http://www.springframework.org/schema/context&#8221;
xmlns:flow=”http://www.springframework.org/schema/webflow-config&#8221;
xmlns:xsi=”http://www.w3.org/2001/XMLSchema-instance&#8221;
xsi:schemaLocation=”
http://www.springframework.org/schema/webflow-config
http://www.springframework.org/schema/webflow-config/spring-webflow-config-2.0.xsd
http://www.springframework.org/schema/mvc
http://www.springframework.org/schema/mvc/spring-mvc-3.2.xsd
http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.2.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-3.2.xsd
“><!– Maps flow requests from DispatcherServlet to flowController –>
<bean class=”org.springframework.web.servlet.handler.SimpleUrlHandlerMapping”>
<property name=”mappings”>
<value>
/helloworld/hello.do=flowController
</value>
</property>
<property name=”alwaysUseFullPath” value=”true” />
</bean><!– Maps a logical view name to a physical resource –>
<bean id=”viewResolver”
class=”org.springframework.web.servlet.view.InternalResourceViewResolver”>
<property name=”prefix”>
<value>/WEB-INF/jsp/</value>
</property>
<property name=”suffix”>
<value>.jsp</value>
</property>
</bean>
<!– SPRING WEB FLOW SETTING –><bean id=”flowController” class=”org.springframework.webflow.mvc.servlet.FlowController”>
<property name=”flowExecutor” ref=”flowExecutor” />
</bean><flow:flow-executor id=”flowExecutor” flow-registry=”flowRegistry” /><!– This creates an XmlFlowRegistryFactory bean –>
<flow:flow-registry id=”flowRegistry”
flow-builder-services=”flowBuilderServices”>
<flow:flow-location path=”/WEB-INF/flows/hello.xml” />
</flow:flow-registry><flow:flow-builder-services id=”flowBuilderServices”
view-factory-creator=”viewFactoryCreator” /><bean id=”viewFactoryCreator”
class=”org.springframework.webflow.mvc.builder.MvcViewFactoryCreator”>
<property name=”viewResolvers”>
<list>
<ref bean=”viewResolver” />
</list>
</property>
</bean>
</beans>
hello.xml

<?xml version=”1.0″ encoding=”UTF-8″?>
<flow xmlns=”http://www.springframework.org/schema/webflow&#8221;
xmlns:xsi=”http://www.w3.org/2001/XMLSchema-instance&#8221;
xsi:schemaLocation=”http://www.springframework.org/schema/webflow
http://www.springframework.org/schema/webflow/spring-webflow-2.0.xsd”&gt;
<view-state id=”firstStepId” view=”hello/firstStep”>
<transition on=”secondStep” to=”secondStepId” />
</view-state><view-state id=”secondStepId” view=”hello/secondStep”>
<transition on=”firstStep” to=”firstStepId” />
<transition on=”lastStep” to=”lastStepId” />
</view-state>
<end-state id=”lastStepId” view=”hello/lastStep” />
</flow>
firstStep.jsp

<%@ page language=”java” contentType=”text/html; charset=UTF-8″
pageEncoding=”UTF-8″%>
<!DOCTYPE html PUBLIC “-//W3C//DTD HTML 4.01 Transitional//EN” “http://www.w3.org/TR/html4/loose.dtd”&gt;
<html>
<head>
<meta http-equiv=”Content-Type” content=”text/html; charset=UTF-8″>
<title>This is the first step</title>
</head>
<body>
<h3>First</h3>
<hr />
Using Link:
<br />
<a href=”${flowExecutionUrl}&_eventId=secondStep”>second step</a>
<hr />
Using button:
<br />
<form method=”post”>
<input name=”_eventId_secondStep” type=”submit”
value=”second step” />
</form>
</body>
</html>
secondStep.jsp

<%@ page language=”java” contentType=”text/html; charset=UTF-8″
pageEncoding=”UTF-8″%>
<!DOCTYPE html PUBLIC “-//W3C//DTD HTML 4.01 Transitional//EN” “http://www.w3.org/TR/html4/loose.dtd”&gt;
<html>
<head>
<meta http-equiv=”Content-Type” content=”text/html; charset=UTF-8″>
<title>This is the second step</title>
</head>
<body>
<h3>Second</h3>
<hr />
Using Link:
<br />
<a href=”${flowExecutionUrl}&_eventId=firstStep”>first step</a>
<a href=”${flowExecutionUrl}&_eventId=lastStep”>last step</a>
<hr />
Using button:
<br />
<form method=”post”>
<input name=”_eventId_firstStep” type=”submit” value=”first step” />
<input name=”_eventId_lastStep” type=”submit” value=”last step” />
</form>
</body>
</html> 
lastStep.jsp

<%@ page language=”java” contentType=”text/html; charset=UTF-8″
pageEncoding=”UTF-8″%>
<!DOCTYPE html PUBLIC “-//W3C//DTD HTML 4.01 Transitional//EN” “http://www.w3.org/TR/html4/loose.dtd”&gt;
<html>
<head>
<meta http-equiv=”Content-Type” content=”text/html; charset=UTF-8″>
<title>This is the last step</title>
</head>
<body>
<h3>Last</h3>
<h2>Hello Spring WebFlow</h2>
</body>
</html> 

 

Screen Shot:

Access http://localhost:8080/SwingWebFlowHelloWorld/helloworld/hello.do on your browser:

sc1sc2
sc3

Advertisements

Shin Megami Tensei IV (SMTIV) – How to Defeat Beelzebub

Beelzebub is one of the most challenging demon/monster I encounter in SMTIV. You will meet this demon during the Rebirth of the Great Overlord Challenge Quest. Read http://megamitensei.wikia.com/wiki/Beelzebub for more information.

You need to accept the quest and go to the southeast of Tennozu. You need to defeat (again) the Red Knight before you can face Beelzebub. Defeating the knight is fairly easy, he will attack twice a turn with PHYSICAL and FORCE. It can repel ELECTRIC and FORCE attack. To defeat this guy just use Tetrakarn to repel his attacks and use any magic (he is neutral) attack.

Here is the stat of Beelzebub from http://megamitensei.wikia.com/wiki/Beelzebub.

1000px-KazumaKaneko-Beelzebub

Beelzebub

During the first round of battle Beelzebub will usually do Normal Attack and Maziodyne. As the battle progress, Beelzebub will attack Mamudoon three (3) or two (2) times in a row that can wipe out you team. Mamudoon is a dark instant kill attack and cannot be repel. In short your team must deal (damage) with it.

You can deal with the damage using the following skills:

1. Luster Candy – Increases attack/defense/hit/evade rate. Target: All allies
2. Debilitate – Decreases attack/defense/hit/evade rate. Target: All enemies
3. Salvation – Fully heals HP and removes ailments. Target: All allies

You can hit Beelzebub with any skills except for GUN (can repel), LIGHT, and DARK. Make sure to constantly do the Salvation and Debilitate each turn.

I defeated Beelzebub with the following level and demon:

Samurai

LVL: 75 HP: 710 MP: 332
WEAK: GUN
NULL: LIGHT
RESIST: DARK
SKILLS: Concentrate, Luster Candy, Grand Tack, Cold World, Maziodyne, Trisagion, Energy Drain, Salvation

RangdaSMT2

Femme: Rangda

LVL: 68 HP: 550 MP: 247
REPEL: PHYSICAL, GUN
NULL: FIRE, ELECTRIC
SKILLS: Debilitate, Null Fire, Null Gun, Null Elec, Energy Drain, Sabbatma, Salvation, Sea of Chaos

sraosha

Herald: Sraosha

LVL: 68 HP: 368 MP: 358
RESIST: PHYSICAL, ICE
DRAIN: ELECTRIC
WEAK: FORCE
NULL: LIGHT, DARK
SKILLS: Holy Wrath, Drain Elec, Luster Candy, Null Dark, Grand Tack, Gun Pleroma, Energy Drain, Resist Phys

anubis

Avatar: Anubis

LVL: 66 HP: 527 MP: 238
NULL: LIGHT, DARK
SKILLS: Salvation, Mediarahan, Fog Breath, Tetrakarn, Makarakarn, Sabbatma, Enery Drain, Samarecarm

For more information about the skills and demon stat, you can use the online SMTIV tool: http://erikku.github.io/smt4tool/.

Etrian Odyssey IV: Legends of the Titan – Cramped Nest Map

The Cramped Nest is a cave located on the 3rd land – Sacred Mountains. The cave can be found on the eastern part of the Sacred Mountains on square C-1. The cave is primarily full of crevice to pass through the wall. Unfortunately not all the crevice can be use, all of them are covered with icicles and most of them can do a lot of damage when you try to pass through.

In order to know all the passable crevice, you must follow the movement of F.O.E.s. If the F.O.E. passed through a crevice it means that crevice is passable.

Cramped Nest Map

passsage

foe_movement

event

other

 

F.O.E. reference

Demon Hopper

Skill: Crushing Kick
HP: 302
AT: 29
DF:23

Resistance: –
Weakness: Fire

Drop:
-Hopper Wing
-Tough Leg

Cave bat

Skill: Annoying Waves
HP: 352
AT: 29
DF: 23

Resistance: –
Weakness: Volt, Pierce

Drop:
-Soft Patagium
-Bat Fang

Claw Beetle

Skill: Shell Wall
HP: 372
AT: 30
DF: 30

Resistance: Slash, Pierce, Bash
Weakness: Fire

Drop:
-Hard Shell
-Beetle Sickle
-Broken Horn

Patrol Bat

Skill: Claw Dance
HP: 1984
AT: 38
DF: 32

Resistance: –
Weakness: Volt, Pierce

Drop
-Giant Wing

 

Part 1: Code Snippet

0000
What makes a person mature? In my opinion, maturity should not be based on seriousness of the person. Maturity is about how you make a firmed decision and take responsibility for any outcome of that decision. Maturity is not about acting right because right and wrong is superficial and relative. There is only black or white, a mature person always have rational action for every situation.
0001
Then I say: “Sorry, I am still new…”

Being ‘new’ for a job is not an excuse for inability to answer question.
0010
Umuulan hindi umaambon
Umaambon hindi umuulan
Umuulan kasi malakas ang patak
Umaambon kasi mahina ang patak
Malakas na ulan ay umuulan
Mahina na ulan ay umaambon
Malakas na ambon ay umuulan
Mahina na ambon ay hindi umuulan

WTF!

0011
I still remember her.

I can still remember the face, but not the voice when she sings during our class in World Literature.

That voice, that thought me to love and be love.

That voice, that once ask if love or just desire.

The voice just drifted away far far away.

0100
The over price ice-cream and the cool AI application

It started from an advertisement in one of the popular social network.

It is the classic ice-cream on stick.

Then people start to get hook.

People post their pictures with the mysterious ice-cream on stick.

I got curious.

I tried it. Licked, licked then bite.

I waited for seconds, nothing happens. I continue, lick lick then bite.

I stare at my mysterious ice-cream and still nothing happens.

I tried it and nothing special.

It is just an over priced overrated ice-cream.

I ask someone about it, but then he just answers randomly.

It happens to be funny when a person answers you randomly.

I ask, ask, then he answers.

I stare at him then ask, ask, then he answers.

Then it gets boring and stop ask, ask, then he answers.

I stare again then stare stare then sleep.

0101

Brand is only for product not for a person.

0110

Pag-umuwi ng on-time ibig sabihin hindi busy.

Pag-umuwi ng late ibig sabihin busy.

Pag-umuwi ng maaga tamad ka.

Pag-umuwi ng on-time means maaga ka.

Pag-maaga ka ibig sabihin tamad ka.

WTF!

0111

While scrolling on news feed this morning, I observed that there were a lot of post about ‘feeling good’ when someone appreciated or recognized them.

Suddenly, I stopped reading and think.

When I was young, I always wanted to impress my mom and be proud of me. I wanted to hear her say those words. Those words that will make me feel good, happy, and satisfied.

But I can’t remember any situation that mom would say such precious words, but still I don’t feel bad I actually felt better. I learned that we don’t have to impress other people just to feel good, we should do things the way it should. Most of the time people believe that in order for a person to be in a state of ‘feeling good’, one must impress another in return for appreciation or recognition. In my opinion, feelings are personal and it is not given by others. You decide what you feel.

1010
The question is: “Is it valid and logical?”

The answer is …

1011
Some lifeforms are designed to have sex.

You were born, you learn, you intercourse, then we die.

1100
Teaching will always be part of my life, it is a hobby.

1110
Me?..

It is either you hate or you love me.

1111

I met so many wonderful person this year.

Some of them not so wonderful not so awful.

 
to be continue…

 

 

Pornography: The Good The Bad and The Ugly

Pornography is any direct portrayal of sexual act in any medium. I personally believe that anything that shows nudity and simulate sexual intercourse can be considered a pornography. But if we look at the history, pornography has different forms and meaning depending on culture and belief.

As of today pornography is not only available in magazines and films it can be seen in video games, animation and the Internet. During this information technology era people are become more open and expose on sexual topics. One of the most influential/used medium for pornography as of today is the Internet.

The Internet is the most accessible medium in viewing pornographic materials. People mostly choose the Internet because they can anonymously access and view pornographic materials privately. As the most accessible medium, minors usually can access or view (accident or not) pornographic materials easily.

Internet provides commercial and free pornographic materials. There also sites that allows users to upload and download pornographic materials which they call amateur content. It also offers a large content of media formats, ranging from images, video files, streaming, web cams, text, and even audio files.

Pornography is part of booming sex industry around the world. Online pornography is a money generating form of pornography which can earn billion annually. Pornographic actors or porn stars cannot be considered prostitutes because they are not paid by the person who engage with them during sexual act on the film. They are actually same as Hollywood actors that are paid through talent agency or studio.

Any medium that is produced and distribute is somehow affects the economic activity of a certain region or state. Thus, pornography is legal, but should be under restrictions and monitoring. As the pornography generates billions, some expert says that banning them can have a major economic impact.

The rules that are governs pornography is different from region to region. I compile some of the important principles of legality of pornography:

1. The material is available for purchase to 18 years old and above.
2. The materials should be sold only in adult stores/web sites.
3. The actors should be 18 years old and above.
4. Pornography should only include human to human sexual interaction, bestiality is prohibited.
5. The pornography should not be obscene based on the legal context of the country/region/state.
6. Pornographic materials should not involve minors.
7. Pornographic materials should not be displayed to minors.

There are also some controversial principles:

1. In Azerbaijan pornographic materials are defined as work of art.
2. Bulgaria some authorities tolerate illegal selling of pornographic material and TV shows after 11 pm.
3. People can buy or rent pornographic materials in convenience stores in Denmark.
4. Finland allows to sell pornographic materials in any store.
5. There is a special VAT for pornographic materials in France.
6. In Greece materials can be seen in magazines, kiosk, convenience store, and even deck of cards.
7. You can watch pornographic film on adult cinema in Portugal.
8. Pornographic magazines in Romania must be placed on enclosed bags with small red printed square.
9. Japan is the largest producer of pornography in Asia.

There are mixed result on the effect of pornography to crime. According to some studies viewing pornographic materials may increase a person a tendency to do sexual crimes, but on other hand several studies shows no effect at all.

There are a lot of people and organizations that against pornography. Feminist argued that pornography humiliate women, very degrading and exploitation of women’s body. They believe that pornography promotes violence against women. Religious organization considered pornography as lust, sinful and grave offense. They believe that it removes the intimacy of sexual act between partners. They also say that sex is only for married couples and indulging or use pornography is an immoral behavior.

In my personal view, pornography can be legal, but should have restrictions. Possession of pornographic materials should always be private and personal use and should not be shared to minors or even other people. Pornographic materials should only include human to human (not bestiality), no minors and should not show any sexual violence against women or men. We should start to educate and guide our children, we should tell both sides of story and should not be biased. We should not influence them on our beliefs, but rather let them see and learned how to decide about moral and immoral. Don’t get me wrong when I say ‘let them’, they are still minor and needs strict guidance.

In our country, production and distribution of pornographic materials is illegal. Despite this, we are lacking of laws regarding online pornography. These materials can also be seen on markets and even malls. If our government is serious about prohibiting online pornography, we should start from cleaning up our markets and malls then continue to improve laws regarding online pornography. Other countries somehow successfully banned most of the site the explicitly shows any sexual act content, but still people who want to view online pornography still have many ways to bypass the web filter and software site blocker.

Making an act as illegal on laws does not mean we can prevent such act, it must be strictly implemented. As the all-or-none law principle states ‘the law applies to all or none at all’.

It always boils down on ourselves. Even though pornographic materials explicitly shows sexual act, we should not view it as a bad influence, but as an entertainment like other artistic medium. I still remember one general rule states that “what you do, what you hear, what you see, when you leave, leave it here’. Pornography is like that, after entertainment, then perhaps you forget about it and move on.

Lastly, I don’t agree that freedom of expression should be favored over censorship.

Tabloid Writer: A Sensational Situation

The Ethical Dilemma:

You are a budding writer for a tabloid magazine. You want to get some headline-grabbing news about the stars of a popular TV show. You do some video research and you find that these stars actually made racy and sexy videos (not pornographic) many years before they became popular. Although they were privately taken from each others cellphones, they nevertheless uploaded it in their hard-to-find group blog over the Internet. Now, can you and will you as an aspiring tabloid reporter use these materials to write and refer to these stars? Why or why not?

My Opinion:

Yes, I will use these materials to write.

My duty as a tabloid writer is to hunt and deliver sensational and juicy stories anything under the sun. Celebrities are no exception, gossip and personal stories about them is one of the reason makes the tabloid very entertaining to read. This is an opportunity for me to get a head-turning news that can be featured as the headline of the tabloid magazine, and being the one who writes the headline is a big accomplishment as a writer.

Even though tabloid is known for its sensational stories about personal lives of stars, I am still a journalist and should maintain and practice journalism ethics code and standards.

Personally, I will follow the most common codes of journalistic standards and ethics[1]:

Accuracy and standards for factual reporting

– I will make sure that those stars are really featured on the video. I will ask someone who belongs to the group to verify the video.
– I will observe if they truly (or can be considered) made a racy and sexy act on the video
– Read the terms and condition of the group blog if it is legal to download the video for evidence.
– I will ask another colleague to review my article and the issue. I will also take an opportunity to seek some advice on how to handle the above issue.

Slander and libel considerations

– Once the video is uploaded in any websites the default privacy setting is public unless user set to private option. In case of this issue the video is uploaded to a group blog which automatically means that this video is for public viewing. Even though the site is hard-to-find it can be discovered by users specially if the person is a popular celebrity. Search engine today is so powerful that can find almost anything on the internet.

– The article should limit to the content of the video and there are no additional false information.

Harm limitation principle

– The article should sound as a controversial news and should have constructive effect on the celebrities on the video. I will still consider the fact that the reputation is one of the important things for a celebrity. The article should filter that might create a negative effect on the person, compassion and sensitivity is the key.

Presentation

– Most Tabloids, especially in the Philippines used ‘salitang kalye’ for their article. In the above situation, article should write in a plain and formal Tagalog/English. Most of the time, readers find it very offensive when the article is written in ‘salitang kalye’ which I agree.

– To make more exciting, the content of the article should not include any screen shots from the video nor the URL of the website. The group blog can be found by searching over the internet and a curious reader will find it easily. I will not also drop a name and make it as a blind item.

Conclusion

Most people now link the tabloid newspaper as source of controversial/sensational stories, gossip, crime, and scandal. The worsts is, they treat tabloid as a source of entertainment/fun and believe that it is not a reliable source of facts. We cannot blame these people because there are a lot of slander and libel issues in tabloid newspaper. Luckily, there are still well-respected tabloid around the world that follows code of ethics and standards.

Controversial/sensational stories about celebrity (or even politician or common people) can be presented in non-offensive manner. There are many ways to make the story be exciting and interesting without hurting the reputation of the person involved in the article. Lastly, an excellent journalist does not only write facts, but also do research and follow code of ethics and standards.

 

Reference:

[1] Journalism ethics and standards. (2012, July 19). In Wikipedia, The Free Encyclopedia. Retrieved 15:40, July 25, 2012, from http://en.wikipedia.org/w/index.php?title=Journalism_ethics_and_standards&oldid=503103591

IT Certification: An Advantage but Not Necessary

I agree with IT certifications because:

1. For a fresh graduate, a certification can improve employment opportunities.
2. Certification can improve position and salary of a beginner to novice experienced IT professional, but for an expert there is little to no use at all.
3. It is one way to prove that you are knowledgeable on that particular technology.
4. Certifying authority gives an opportunity for career shifters that are seeking IT position.

But:

1. The exam should be a combination of written and hands-on laboratory exercises. It should be real world scenario type of exam.
2. There should be a governing body that validates the quality of training and exams of certifying authority. This governing body also make sure that there will be no exam leaking, cheating and follows the code of ethics.
3. Most of the certifying authority requires/force a person to train on their site before taking the exam, which I believe is not correct. A person should have an option to look for another training site.
4. The human resource division should not require their employee to take certification, it should not be mandatory. The human resource should see the certifications as an advantage and not requirements in looking for potential candidate.
5. A person should not think that a certification makes their college/university degree useless. Currently, there is a big gap between IT industry and Academe. One solution to this is to have partnership between IT vendors and Academe, but it should not be tied up to only one vendor. There are several schools that currently incorporated vendor-based training on their curriculum. The students should have an option on what training and certification they want to take.
6. IT certifications is limited only on the particular technology skill set. IT certification does not make a person an expert, but makes him knowledgeable to a particular technology skill set.
7. There are too many certifications that overlap, there is no way on determining its value in the industry. For example, Cisco has its own Cisco Career Certifications program for networking and the same time Network Professional Association (NPA) offers the Certified Network Professional program. Then, how we will evaluate that Cisco certification is better than the NPA certification or vice versa.
8. IT certifications does not guarantee any job, but it only guarantees more opportunities.
9. Some of the IT certifications are very expensive that is not justify on their value, and some are cheap, but not recognized by many.
10. Certifications need to be renewed occasionally and some are valid for a specific period of time. It is OK to renew the certification, but the cost should be minimal and exams should cover only the enhancement and not the entire module.
11. Certifying authority should give a certification without exam to IT professional who spent decent amount of experience in the industry. This kind of certification must undergo strict process to ensure the good reputation of the certifying authority.

Lastly:

I believe that the IT certification is a money generating vehicle for ALL IT certifying authority, and there is nothing wrong with it. Let us accept the fact that IT industry offers products and services that needs money to operate. If we look at the broader side, it is a win-win situation because after being certified you can get industry recognition, it can improve employment opportunities, and most important it can increase salary.

IT certification alone is not sufficient to be an expert on the particular field/technology. It needs continuous learning, hands on experience, and intensive coaching from other IT professional expert. I believe it is an advantage, but not necessary to become an expert IT professional.

Moral Dilemmas and My Ethical Criteria

In order for me to trace the basis of what I believe to be morally right, I compile and answer several situations that represent moral dilemma.

Please take note that my actions in each situation is solely based on my own opinion that might offend or contradict other opinion.

Situation 1:

You have just completed interviewing three candidates for an entry-level position in your organization.One candidate is the friend of a coworker who has implored you to give his friend a chance.The candidate is the weakest of the three but has sufficient skills and knowledge to adequately fill the position. Would you hire this candidate?[1]

What would I do?

I will not hire the candidate.

The purpose of process of employment of a company is to select the best candidate for the position. In fact, posting the job vacancy and an invitation for interview automatically gives everyone a chance. In line with the purpose of process of employment, I am the one who is responsible to make sure that every candidate is given an equal treatment/chance. It is my duty to hire a candidate that could help the company to reach its vision/goal, thus requiring people who are motivated and have excellent skills, knowledge, and abilities on their respective area of expertise.

Situation 2:

A pregnant woman leading a group of people out of a cave on a coast is stuck in the mouth of that cave. In a short time high tide will be upon them, and unless she is unstuck, they will all be drowned except the woman, whose head is out of the cave. Fortunately, (or unfortunately,) someone has with him a stick of dynamite. There seems no way to get the pregnant woman loose without using the dynamite which will inevitably kill her; but if they do not use it everyone will drown. What should they do?[2]

What would I do?

I will use the dynamite in order to save many lives.

I believe that it is morally right to use the dynamite that will kill the pregnant women rather than to be stuck with a group of people inside mouth of the cave and drowned. I am very aware that if I use a dynamite it would kill the pregnant women, but it does not mean that I intend to kill them, their death is a just the result of my action to save more lives.

Situation 3:

You have witnessed a man rob a bank, but then, he did something completely unusual and unexpected with the money. He donated it to an orphanage that was poor, run-down and lacking in proper food, care, water and amenities. The sum of money would be a great benefit to the orphanage, and the children’s lives would turn from poor to prosperous.[2]

What would I do?

I will call the police and report the robber.

Even though he donated the money to orphanage it is still an act of stealing and theft. I believe that stealing/theft is immoral even though you do it for a good reason. In above situation, the money from banks might own by a person who is working hard to save for the future or a struggling person who starting a small business, it would be unfair.

Situation 4:

A coworker calls you at 9:00 a.m. at work and asks for a favor. He is having a car trouble and will be an hour late for work. He explains that he has already been late for work twice this month and that the third time will cost him four hours pay. He asks you to stop by his cubicle, turn his computer on, and place some papers on the desk so that it appears that he is in. You have workes on some small projects with this coworker and have gone to lunch together. He seems nice enough and does his share of the work, but you are not sure what to tell him. [1]

What would I do?

I will not do it for him.

In this case, my coworker has been late several times in a month meaning that he has a punctuality problem. Even though the reason is acceptable, there are still corporate rules that we need to follow. I believe that we should be responsible for all the things that we do and learn to accept the result of our action (even though good or bad).

Ethical Criteria

My ethical criteria evolved throughout the years because of maturity and influence of society. I was raised in a religious family, and grow up believing that an action is morally right if it is acceptable by the roman catholic church. It suddenly changes when I attended college, I was exposed to different cultures, opinions, beliefs, and become more open to new possibilities. I served as a member of the student body for a long time, and making decisions is part of our daily routine. During my term, I always based my actions on intellectual and emotional growth of student.

As of today my ethical criteria has been always based on my duty/obligations, I don’t really care about how people feel/react on my decisions on what is right or wrong. I also considered the happiness and interest of majority of people rather than minority. Depending on the situation I also considered self-interest and my own happiness when it comes to judging morality of actions.

Philosopher/Philosophy

Based on my answer on the situation above and experiences, I observed that my ethical criteria is leaning towards the following principles and theories:

1. “…the rightness or wrongness of actions does not depend on their consequences but on whether they fulfill our duty.” – Kantianism, Immanuel Kant [3]

2. “…one may harm in order to save more if and only if the harm is an effect or an aspect of the greater good itself.” – Principle of Permissible Harm, Frances Kamm[4]

3. “…state that an action is right if God has decreed that it is right.” – The Divine Command Theory[4]

4. “…holding that the proper course of action is the one that maximizes overall “happiness”.” – Utilitarianism[5]

 

References

[1] Principles Of Ethics in Information Technology. G W Reynolds.

[2] Top 10 Moral Dilemmas. (2007, October 21). In Listverse. Retrieved 12:25, July 22, 2012, from http://listverse.com/2007/10/21/top-10-moral-dilemmas/

[3] Kantian Ethics. (2007, April 1). In CSUS Ethics. Retrieved 16:05, July 23, 2012, from http://www.csus.edu/indiv/g/gaskilld/ethics/Kantian%20Ethics.htm

[4] Deontological ethics. (2012, June 28). In Wikipedia, The Free Encyclopedia. Retrieved 16:26, July 23, 2012, from http://en.wikipedia.org/w/index.php?title=Deontological_ethics&oldid=499714249 [5] Utilitarianism. (2012, July 14). In Wikipedia, The Free Encyclopedia. Retrieved 16:23, July 23, 2012, from http://en.wikipedia.org/w/index.php?title=Utilitarianism&oldid=502228136

Programming Languages: Random Thougths I

Programming Languages: Why so many?

Apparently, programming language was born in order for us (human) be able to communicate with computers, control their behavior and to instruct computers to do specific simple/complex task, thus maximizing its full advantage (advanced computing power).

Here are some reason why there are so many programming languages:

a. There are several aspects of computing problem we want to solve. For example, FORTRAN is used for scientific and engineering applications. Other areas of computing such as pattern matching and string manipulation uses SNOBOL, artificial intelligence and natural language processing uses LISP and Prolog and businesses uses COBOL because it can handle data processing safely. Programming language aims to answer different computing problems, and these problems are constantly changing thus programming languages are created and enhanced.

b. There is no such thing as ‘perfect’ programming language. If one programming language cannot satisfy task or it is hard to implement on that language, programmers always attempt to improve and redesign the language or even create/design their own language.

c. They wanted to make it more friendly. Early programming language are hard to understand because it is too technical for other programmers. Because of this, programmers attempt to create a programming language that is more readable and writable.

Programing Languages: Readability vs Writability

Readability simply means that the programming language is easy read and understand by the programmers (sometimes non-programmers, beginners, etc.) because the language construct is nearly same as natural human language (example English).

On the other hand, writability means that it is easy and fast to create programs in that language because the language construct has minimal symbols which does not require many statements and focuses on simplification of code (concise).

Readability and writability contradicts each other, a readable programming language does not always mean it is writable (vice versa). Being a readable language means that you need to write extra or sometimes unnecessary code to make it more understandable, but on the other hand if the language omit these codes (to make writable easy and fast) programs will be obscure and the reader needs an additional documentation to understand the code.

In my opinion, readability and writability should not be bias on the level of skills of the person who reads and writes the code. Non-programmers and beginners might find it hard to read and write on that particular programming language, but experienced programmers on that language will find it easy. Readability and writability should be based on syntax (language constructs) and semantics (meaning and how it is understood).

Programming Languages: Both Compiled and Interpreted

Below is the language implementation diagram of Java from Oracle website : http://docs.oracle.com/javase/tutorial/getStarted/intro/definition.html

Java has two phase of implementation process. First, Java source file are compiled in particular platform to produce a class file which contains a machine language called bytecodes. Bytecodes is the machine language used and understood by the JVM (Java Virtual Machine) and platform independent (does not contain native code of your machine).

Second, JVM is available in almost all platforms (every platform has different JVM), thus you can run your bytecodes in different platforms. During runtime the JVM serves as an interpreter that converts the bytecodes into native code and execute directly. The ability of JVM to interpret the bytecodes (from any platform) makes Java programs portable.

Programming Languages: Semantically Incorrect but Syntactically Correct

Here are several examples in Java:

 a. Initialization of variables:

int number1;
int number2 = 0;<
int sum;
sum = number1 + number2;

b. Possible loss of precision:

 int number1 = 2;
float number2 = 2.5F;
int sum;
sum = number1 + number2;

c. Incompatible method call and declaration:

public static void main (String args[])
{
. . .
int answer = sum(“hello”, “world”);
}

public int sum(int number1, int number2)
{
return number1 + number2;
}

d. Incorvetible type:

String name = “hello”;
int number2 = (int)name;

e. Incompatible type:

String name = “hello”;
int number2 = name;

f. Invalid use of operator:

int number1 = 2;
String name = “hello”;
int number2 = number2 – name;

g. Array index out of bounce:

int [] numbers = new int [100];
numbers[101] = 101;

Programming Languages: Lexical Analysis and Syntax Analysis

Lexical analysis is responsible for converting the stream of characters into meaningful symbols called tokens. These tokens are then categorized (symbol type) according to the set of rules (lexer rules or regular expressions). Lexical analysis only checks for sequence of characters that are existing in lexer rule and does not care about the validity of combinations of each tokens. On the other hand, the syntax analysis is a parsing method which ensures that the sequence of tokens are correctly structured (including valid combinations of token) based on the PL’s syntax rule.

Programming Languages: Register Allocation Problem

Register allocation is the process of assigning a large number variables into CPU registers. These variables can categorize into two; a live and dead variable. A live variables is said to be variable that holds a value that may be used in the future on the other hand the variable is dead when its value is not needed in the future. The compiler allocates these variables to a limited number of CPU registers, but assigning of more than one variables in the register might occur, thus corrupting the value of the variables. Variables that cannot be assigned to register is loaded from register to memory (RAM) which is called register spilling. CPU register provides the fastest way to access data as compared to RAM, which is slower thus register spilling cause the slowness of execution of compiled programs.

 Research on register allocation problem aims to optimize/maximize the allocation of large number of variables to the limited available CPU registers without affecting/sacrificing the speed of execution of the compiled programs.

Programming Languages: Symbol Table

The symbol table is used during semantic analysis, which is called type checking. It is important because it stores/remember the meaning of variables and other codes. It is basically works like a dictionary that defines it’s meaning and how to use. The compiler checks if the definition of each code is consistent based on their definition/declaration, if the compiler detects any inconsistency or misuse it will throw an error/exception like invalid use of operator, inconvertible type, incompatible type, and other semantic error.

Basically without the symbol table, its like a sentence without meaning. For example, a Filipino is trying to have a conversation with a Malay. A Filipino will not be able to understand the Malay if he don’t know Bahasa (language of Malay). The Filipino should learn the vocabulary and grammar rules of Bahasa (its like creating a symbol table on your brain) in order to understand each other.

References:

IS 214 – Principles of Programming Languages (2002). University of the Philippines Open University. E Albacea

Lexical analysis. (2012, May 26). In Wikipedia, The Free Encyclopedia. Retrieved 03:08, July 1, 2012, from http://en.wikipedia.org/w/index.php?title=Lexical_analysis&oldid=494492591

Parsing. (2012, June 5). In Wikipedia, The Free Encyclopedia. Retrieved 03:10, July 1, 2012, from http://en.wikipedia.org/w/index.php?title=Parsing&oldid=496028068

Register allocation. (2012, January 7). In Wikipedia, The Free Encyclopedia. Retrieved 03:01, July 1, 2012, from http://en.wikipedia.org/w/index.php?title=Register_allocation&oldid=470040938

Register Allocation Problem: Study On Its NP-Hard Nature And Implementation Of Known Heuristics in C. Institute of Computer Science, University of the Philippines Los Banos. R A Pugoy, J Samaniego

http://lambda.uta.edu/cse5317/notes/node29.html