Wednesday, December 8, 2010

Word 2010 is begining to grow on me

It happened for the first time today: I was in Word 2000 and I was trying to find how to change the text background colour and I couldn't find it. I was sure I had used it before. Then I fired up Word 2007 and there it was "Text Highlight Color". Maybe I will eventually get to like Word 2007/2010 more than the older version.

Sunday, November 21, 2010

Div Overlays

A Div overlay is being used on is page:

Eos ea eros paulo dolore. Commune recusabo ad mei, sea justo soleat scaevola ex. Te impetus scripserit theophrastus sed. At mel nostro cotidieque, cum et exerci aliquando. Eos ex nemore officiis moderatius, te quo natum nusquam reprehendunt. Duo et consul semper, probo animal has ne.

Pertinax tractatos repudiandae mei ei, et conceptam constituto nec. Veritus alienum pertinax mei cu. Assum iudico albucius eu sit. At mea fugit vulputate, vix legimus tibique corpora ut. Te usu debet expetendis, id falli consectetuer vim. Alia sonet eloquentiam sea ex, sed te illum corpora ancillae, id pro suavitate ullamcorper.

This is a div overlay
Thanks to creating overlay divs

Wednesday, November 17, 2010

Modal Windows

Modal Windows a modal window is a child window that requires users to interact with it before they can return to operating the parent application 1. Jquery provides modal windows as does ModalPopup

Sunday, November 7, 2010

Moving Columns in MySQL

Move a column after some other column

mysql> ALTER TABLE mytable MODIFY COLUMN mycolumn INT AFTER someothercolumn;

Move a column to the first position

mysql> ALTER TABLE mytable MODIFY COLUMN mycolumn INT FIRST;

Thanks to Masao Kitamura

Sunday, September 26, 2010

Get it into the hands of the people

Compare Apple's website for helping develop get started with RIM's

I would call Apple's a lot more inviting. No wonder so many apps are being written for iPhones and iPads.

Monday, September 6, 2010

User control in WinXP

Recently when I have been going in to change user information, I come up with the following user interface.

But I really want the old user interface like this:

It can be accesses by clicking Start, Run and type CONTROL USERPASSWORDS2

Sunday, August 1, 2010

Adventures in Math

Famous Math problems in History include discussion of pi and Pythagorean theorem are at this site.

Connections with MySQL

In May, I wrote a blog about trying to figure out issues that I had with my Tomcat server handling connection pooling with a MySQL database. I have been doing some digging, and thanks to some friends of mine: Jose Sandoval and Norber Mika, I was able to determine that MySQL is not set up to handle connection pooling. Connection pooling is a feature available on larger enterprise databases such as Oracle. The benefit of it is that it allows a connection to be maintained between the application and the database then multi threading is used to pass the connection parts of the application that need to communicate with the database. By sharing database connections from a pool rather than re-connecting to the database every time database activity is required, execution time is improved. However, if a connection is left open for a long period of time (ie, 8 hours), MySQL views it as a stale connection. Then that connection becomes nonfunctional and will likely generates null responses.

The best way I found to get around this problem when using MySQL is to just connect and dis-connect after each transaction with the database. It may cause a small performance hit, but it improves the stability of the application.

Saturday, June 26, 2010

MathML for Publishing Math on the Web

MathML is a web standard mathematical markup language that has been around since 2001. For more information, go to

Wednesday, June 23, 2010

Buildings and Earthquakes

This afternoon a small tremor was felt in our area. My wife was in the fifth floor of an office building at the time, while I was on the ground floor of the college. She noticed the curtains shaking and could feel the tremor in her feet. I did not notice anything. Actually, nobody in my class noticed anything.

So, my wife, 5 stories up, felt more tremors then I did at ground level. That meant that the building she was in amplified the tremor to a level that it was noticeable, while environment did not do any amplification because I was on ground level.

Does that mean that we are designing buildings that amplify the vibrations experienced by earthquakes? The higher up in a building, the more potential for damage there is due to buildings collapsing. Are we exasperating this danger by designing buildings with certain mass/stiffness characteristics that increase the changes of vibration and the subsequent damage?

Wednesday, June 9, 2010

Astronomy and the nature of God

Jennifer Wiseman, astronomer, author, and chief of the Laboratory for Exoplanets and Stellar Astrophysics at NASA Goddard Space Center, delivered the annual Pascal Lectures on Christianity and the University, a series of three, of February 8 and 9, 2010 at University of Waterloo. Here is an excerpt from the first lecture, delivered at the Center for Environmental and Information Technology on February 8.

Does the character of the heavens reflect the character of their creator? If we allow ourselves to imagine just for a moment that there might be a divine creator of the universe, what would the universe tell us, if anything, about the character of that divine creator or upholder or purpose behind it? As an astronomer, I thought about that to some length and I came up with this little list of my own. You might come with you own thoughts as well, so this is not anybody's definitive list: it's what came to my mind viewing this question.

From astronomical observations and the resulting inference, within this view of considering a divine creator a possibility - then this God, this creator, would appear to me to be very powerful: we've seen already some of the astronomical objects and forces that are powerful.

Creative: a creator and a lover of beauty.

We've seen the beauty of galaxies and nebulae and stars, and most interesting to me is the connection between that beauty and us, being creatures here within this universe, who can recognize that beauty. I'm told that our brains are hard-wired to recognize design and beauty, and I think that there's purpose in that.

Patience: there are 13.7 billion years of history of the universe, as we can best guess right now. Now, this God would have a different view of time and efficiency than we have. We would gauge things by our life spans. But if that's not the important feature for this God, then this God would appear to us to be patient, allowing things to unfold according to processes that are needed to create the conditions that eventually would lead to life.

Faithfulness: allowing these fundamental physical laws of the universe, of gravitation, and of time moving forward. These kinds of things don't jump around and change from moment to moment, so this allows for the ordered development of the universe according to these fundamental physical laws.

And yet whithin this context of faithfulness, we see a desire for freedom, because there are elements of our universe set up that allow for freedom. We have things such as chaos theory, quantum theory, and so forth, that allow a sense of freedom within this ordered context. I believe that that's related to perhaps our ability in our experiential sense to understand that there really are such things as pain, and choices, and good and evil.

And we obviously see that our universe enables life, so this God would be one who gives and enables life, and enables a fruitful universe. We're here; there may be life elsewhere, as well.

And then, I would call this love: that we are enabled to investigate, appreciate, and also understand the magnificent cosmos of which we are a part, as we are seeing more and more of what's out there.

Friday, June 4, 2010

Moral Clarity: Do Morals Make Sense?

Many different people advocates morals for different reasons. The Greek philosophers advocated that in the long run it is intrinsically more pleasant to be moral than amoral. Thus, for the Greek philosopher, as they are watching other people around them have more fun gratifying their immediate desires though unmoral activity, they are consoling themselves by telling themselves that in the long run - the moral person will be better off and also by telling themselves that deep down it is more satisfying by being moral because it is a true extension of our identity as humans. Then there are the religious people that often advocate you need to be moral because there are eternal consequences for your day to day actions - so you better shape up if you want to be happy in the long run.

Susan Neiman's Moral Clarity looks at both of these extreme. It advocates against the Greek philosophers view that in the end it always turns out best for the moral person by showing that we live in an unjust world where you can never be guaranteed that moral activity will be rewarded. It also challenges the religious viewpoint by questioning why we need to look to the after life for motivation for moral activity today.

Rather than supporting either of these views, she argues that we have an intrinsic morality in us - it is part of what makes us human. By tuning into that inner morality and living consistent with it, our human struggle can make sense. Living with high moral standards may never result in success, comfort, or pleasure, but it can enable our lives to have purpose.

I remember hearing a story of one of the worst forms of torture in German Concentration camps. There would be a pile of bricks at one end of the yard. The workers would have to cart the bricks from the one pile to a new pile on the other end of the yard. The next day, they would have to cart the brick from the second pile back to the first pile. They would back and forth like this day after day. Their tasks were utterly meaningless. After a few days of doing this, people would start to go crazy and some would commit suicide. It is not in our nature as humans to be able to continue to exist in meaningless activity. Our lives need to make sense. Our morality needs to make sense, it needs to have meaning for us to continue to struggle to do the right thing when it is so much easier to cast away moral restraint.

Susan Neiman tries to make sense out of morality by showing example after example of people that risk their lives and everything else they hold precious to help another person. The person that risks all they have does not gain anything, they only engage in an opportunity to act constant with a deep moral identity. In that moment, they sense the resonance of their whole being engaged in what it means to be human.

Ivory Towers and Applied Research

Many people in industry criticize academia for being out of touch with reality, stuck in their ivory towers. The Polytechnics Canada and it consortium of colleges including Conestoga College and SAIT Polytechnic address this issue directly. They are dedicated to "enhancing the productivity and competitiveness" of Canadian industry. By engaging in research to discover solutions to real problems being encountered in industry, the polytechnic institutions are directly fueling the growth of the Canadian economy.

Conestoga College has been involved in an applied research initiative with ComDev over the past 2 years, designing automation for one of ComDev's manufacturing lines. SAIT Polytechnic in Calgary partnered with Conematic in developing protoypes and standardized components for an innovative hot water boiler.

These examples are encouraging indications that some of the academic institutions are not stuck in ivory towers. Rather, they are engaging in the real problems of the workplace.

Tuesday, May 4, 2010

Tomcat Database Connection Pool

I have been doing some development work on Tomcat and I am told that my connection pool is getting stale after a while. We will see if the following link , or this one, or something else about JNDI will help. Other ideas are to establish a cleanup/reaper schedule that will close connections in the pool, if they are inactive beyond a certain period.

Check validationQuery.

validationQuery="SELECT 1"


Connection Pooling

Connection Reaper class:

JBCD and DBUtils

IBM Discussion on Stale Connections

Handling a Stale Connection

To view the log, go to tomcat6\logs\catalina.out It has all the system.out.println() entries in it.

Thursday, April 22, 2010

Repo 105

As the US courts have been investigating the causes behind the sub-prime morgage financial crisis, we have learned a new term: Repo 105. It is a series of transactions as follows:
1. Company AAA holds some poor quality assets (i.e., sub-prime morgages). AAA's leverage ratio also does not look attractive (it is too deep in debt). It is coming close to the end of a quarter and AAA does not want all that debt and the poor quality assets to show up on it's balance sheet when it issues it's quarterly financial statements.
2. Company BBB offers to buy the poor quality assets from AAA with one of the terms of the contract stipulating that AAA will buy the assets back at a specified date in the future at a reduced price.
3. AAA prepares its end of quarter financial statements. Since the title for the assets is transfered from AAA to BBB, then AAA does not have to record the risky assets on its financial statements. This makes the investors think the company is solid and helps maintain the stock price and rating.
4. After AAA has issued its quarterly financial statements, it buys back the risky assets.

This is what Lehman brother did as it was begining to sink in months coming up to its collapse.

The purpose of financial statements to provide an accurate account of the financial position and health of a company. Such activities clearly oppose the primary purpose of financial statements.

Why are accurate financial statements so important? Because we live in a capitalistic society. One of the tenants of a capitalistic society is that the people who own the capital should be the ones that benefit from the income earned off that capital. Another feature of capitalistic societies is that the person owning the capital is not the person who is actually putting the capital to work. For example, a capitalist my own a factory, but he has other people doing the work of running the factory and doing the labour in the factory.

We didn't alway live in a capitalistic society. Before the industrial revolution, the workers were also the owners of their own business. When the workers are also the owners, there is no motivation for the workers to decieve the owners.

However, when there is a division between ownership of the capital and management of the capital as exists in a capitalistic society, the managers of the capital will always be motivated to hide information from the owners in an attempt to maximize their benefit. In an attempt to curtail this deception, complicated accounting systems such as Sarbanes Oxley and audits are created to try to maintain honesty. It looks like the government needs to add some more complexity to their rules track down the inginuity of the managers of capital.

For more information, see

Wednesday, March 31, 2010

Industrial Fan Applications: Pickle Line

The manufacting of sheet steel uses a pickling process after they have rolled the steel. This is a heated high strength hydrocholric acid bath that the sheet steel goes through to remove any slag inclusions on the surface of the steel. If the slag inclusions are not removed, rust can start at that location.

The hydrochloric bath gives off acid fumes, so it must be contained in a sealed environment with a negative pressure to ensure acid fumes do not leak out into the environement. To maintain this negative pressure, an industrial fan is used. This fan sucks air out of the hydrocholric bath hood, and through a scrubber to remove the acid out of the air. Idealy, the scrubber removes all the acid from the airstream so that only clean air goes up the stack. Unfortunately, scrubbers are not perfect and occasionally acid is still entrained in the airstream as it enters the fans.

The acid in the airstream is very corrosive on the fan components. For this reason extra precautions must be taken in the choice of fan materials to protect against corrosion. The main areas of conern are the fan casing, fan impeller, and fan shaft.

To ensure the fan casing withstands corrosion, it can be made out of fiberglass with a c-veil to seal the airstream surface of the fibreglass. However, ,one of the concern about using fibreglass is the strength of the casing. Casing strength is considered for three primary reasons. First, the casing must withstand the static pressure differential between the inside and outside of the fan so as not to deflect excessively. Secondly, the aerodynamic turbulence within the fan casing can cause casing vibrations if the casing does not have sufficient stiffness. Thirdly, in the event of a impeller failure, it is good to have a casing that can contain the pieces of the impeller rather than allowing them to pierce through the casing and damage people and equipment. For these reasons, fibreglass casings should only be considered for lower speed fans.

For higher speed fans, the casing can be contructed out of steel and lined with a corrosive resistant barrier. The best barrier is rubber as it does not get damaged easily and during the application of the rubber, the applicator can do spark tests to ensure that a complete seal is obtained. By using a steel housing with rubber lining, the housing has all the strength of the steel with appropriate stiffeners.

The second fan component requiring special consideration is the impeller. For low speed fan applications, it is possible to use a rubber coated impeller. Note that this is only applicable for very slow fans, since the centrifugal forces generated by higher speed fans along with the aerodaynamic forces in the impeller will cause the rubber to be ripped off the impeller. The best solution for the impeller is to not coat the impeller, but rather use a material which can withstand the corrosion while demonstrating suitable mechanical properties. The two primary materials satisfying these requirements are titanium and Alloy C276. Alloy C276 tends to be lower cost then titanium and has a lower corrosion resistance, but is often sufficiently corrosion resistant as long as it is inspected regulary.

The third fan component is the shaft. By using an overhung arrangement, the only component of the shaft potentially exposed to the airstream is the part between the back of the hub and the casing opening. This can be protected by a shaft sleeve that is welded to the back side of the hub and extends through the back side of the casing.

By making special considerations for the casing, impeller, and shaft, an appropriate fan can be designed for an acidic environment.

Tuesday, March 30, 2010

Industrial Fans: Economic Environment

During the early part of the first decade of the 21st century, the fan industry was in its boom years. The economies of developing world were expanding, which in turn created demand for natural resources to fuel their growing infrastructures along with their domestic consumer industries. Most natural resources require processing before delivering to their final market. This processing often uses industrial fans to contain dust, remove harmful pollutants, and assist in the process of the natural resources. Some of the many applications for industrial fans in the natural resources include copper smelting, dust extraction from copper pulverizing, nickel refining, steel mill blast furnace emissions control.

Another area experiencing a boom in demand for industrial fans was the cement industry. In the process of converting lime(calcium carbonate) to calcium oxide, it must be heated. The kiln ID fan draws superheated gas through the kiln and then through a cyclone separator and/or electro-static precipitator. With the boom in global infrastructure development, cement manufacturers were expanding to meet the demand.

The last two years, we have experienced a cooling off in the world wide economic growth triggered by the sub-prime financial crisis. This has resulting on a sharp drop in infrastructure spending resulting in a drop in demand for natural resources.

Fortunately, the economies of the non-western world, which account for the majority of demand for natural resources, did not experiences as sharp a recession as the western countries. This means that demand for natural resources is already starting to pick up again. This can be seen by the Nickel price:
Nickel reached a peak in 2007, and went to a 5 year low in 2009, but now the prices are on the re-bound. This trend is also occurring in many other natural resource prices.

This means that demand for industrial fans should begin to improve in the next 1 to 2 years. During this time of lower demand, fan manufacturers should make use of this time to optimize the management and methods for engineering and manufacturing fans, along with put effort into establishing their market presence. This will enable them to capitalize on the upcoming boom in the fan industry.

Wednesday, March 24, 2010

Using custom domains with Blogger

I have been using the FTP capabilities of Blogger for a while to maintain a blog on my own domain that was hosted at GoDaddy. However, blogger just announced that they would stop supporting FTP capabilities, thus they would only support blogs that were actually hosted by Blogger (or Google).

Fortunately, they have a feature that still enables my blog to be posted at my domain name. Under the publishing part of settings, I am able to specify a unique domain name. In my case I use The is set up as a sub-domain of I am then able to set up a sub-domain at my domain registrar (which happens to be GoDaddy). Sample instructions for this can be found at How Do I create a cname record for my custom domain

After the subdomain is set-up, it will automatically point to which is the location where the subdomain for the blog is hosted.

Thus, the blog is hosted by Google, I get to use my own domain.

Google also provides the options of buying a domain name directly through Google. This is a more straight forward approach if you only want to do blogging on your website. Since there are a lot of other features I wanted on my website, I preferred to have my domain name registered with a conventional hosting company.

Tuesday, March 23, 2010

This blog has moved

This blog is now located at
You will be automatically redirected in 30 seconds, or you may click here.

For feed subscribers, please update your feed subscriptions to

Sunday, March 7, 2010

Ethics and Lying

I was just reading an article about Consequentialism. One of the first examples of ethical issues is a discussion about lying. I find it interesting that the authors of the article would choose to discuss lying rather than cheating or killing (ie: in the case of warfare for a justified cause), adultery, or abortion. All these other topics have significant ethical contriversies associated with them.

Over the past year I have been reading a lot of authors on ethical theories (you may notice by looking at some of my previous blogs). A lot of ethical theorist discuss lying. I guess lying is a good litmus test for an ethical theory because it challenges the major theories of Utilitarianism (judging the rightness or wrongness of an action based on the amount of utility-or benefit that action causes to the world) and rules based ethics (Deonteology: judging the morality of an action based on the action's adherence to a rule or set of rules)

A classical challenge for the ethics of lying is as follows. During the second world war, Germany was invading Holland. As the Germans soldiers would go from house to house, they would seek out any Jews and kill them. Some dutch people wanted to protect the Jews. Even if they were not Jews themselves, they did not believe it was right to allow the Jews to be killed. These people would hide Jews in their houses. When the German soldiers would come knocking on their front doors asking if there were any Jews in the house, they would lie to them and tell them there are none in the house.

Was it right or wrong for the dutch homeowner to lie about the presence of Jews in their house? Would it have been better for the dutch person to not harbour Jews in their house so they would not be forced to deal with the ethical dilemma of lying? There are certain things we do because of our basic ethical standards (ie: we do not run over elderly people as they cross the road). But there are other things we do that go beyond the basic ethical rules. Some of us go to Haiti to help with disaster relief. Other people help out at the food bank, or spend a bit of extra time with their children in a loving way. These are things that we do above and beyond our basic ethical standards - we would not be considered wrong by society if we did not do them, but because we care (are driven by an internal motivation), we do these things.

The people that harboured Jews in Holland did so because they cared - there was no law saying they had to, not even a socially established norm saying they had to. However, to complete this act of caring, they have to go against a socially accepted ethical standard.

Utilitarians would say that the final result of saving the life of the Jew justified the act of lying.

A deonteologist has a bit more complicated answer. The simple answer is that ethics is based on rules. One of those rules is "do not lie". This would be consistent with Kant's categorical imperative: "Act only according to that maxim whereby you can at the same time will that it should become a universal law." If you just look at issue about lying, then of course you would want it a universal law that people do not lie - otherwise it would be no use having a conversation with someone because you never know when they are telling the truth.

However, if you were to look at a larger maximum of "when faced with a choice between telling the truth and causing a person to die, or lying and saving their life, choose lying", then you could say a larger universal maximum still applies.

However, there is a more complicated answer. The deonteologist also say that there is a ranking system amongst rules. They would probably argue that saying something that would cause someone to die (if the dutch person told the soldier the truth, then the soldier would kill the Jew), is a worse act then lying. Therefore, it is better to do the least harmful act. Now comes the next big questions: how does the ranking system work?

The ranking system would likely go something like this: most important is to protect innocent human life, the next order of importance is upholding rules such as truthfulness etc.

So, you have just observed how lying in a certain context can be justified by the principal ethical theories.

It makes me feel uneasy justifying something I feel is wrong. I grow up learning that lying is wrong. We are trained from an early age to instinctively see it as wrong. Now we look at a situation where it seems that it is the right thing to do. In this type of situation, I would probably act to preseve life, but I wouldn't "feel" right about it. I guess it is not always that easy to do the "right" thing - the idealized perfectly right thing, in an un-ideal, imperfect world.

Wednesday, March 3, 2010

Creating Section Views of Fan Impellers using Solidworks

The parametric capabilities of Solidworks creates many capabilities to re-use parts and assemblies by just changing some dimensions in the parts or assembly sketches. One of the things that is tricky though it to create section views will properly section a scaled drawing.

When creating a section view, the user is asked to draw a line for the section. If the part or assembly is scaled larger then the original line, then the section view is not cutting through the entire section. This can cause errors in the section view meaning that the whole section view has to be re-created.

To ensure that the line defining the section view scales correctly with scaling changes of the part, the section view line has to have relationships with the geometry of the part or assembly. For fan impeller drawings, the best way I found to do this was to snap onto the quadrants of the outside diameter of the impeller when making the line.

Thus the line is defined as going from the top quadrant down to the bottom quadrant. As the impeller is scaled, the line defining the section view is scaled and the section view is maintained.

Tuesday, February 23, 2010

Reducing Windows Startup time

O'Reilly has a good link for speeding up the windows startup.

Tuesday, February 16, 2010

Simple Reflection Example

I am working on extracting various pieces of information from different classes of objects. I thought that rather than manually going through and using getters for the fields of each object, I would try using reflection. The code below is a simple use of reflection. I create a Class object of the type of class for the object, then I get the method of that class. Finally, the method of the object is invoked to get the required information out.

package utils;

import java.lang.reflect.Method;

public class ClassSpy
public static void main(String[] args) throws Exception
//Specify the class that we will do a reflection on
String className = "utils.SampleClass";
//Create a Class object associated with className
Class toRun = Class.forName(className);
//create an instance of the method which we
will later invoke
Method method = findMethod(toRun, "getId");
//create an instance of the class
SampleClass user = new SampleClass();
//invoke the method
int id = (Integer)method.invoke(user);
System.out.println("id "+id);
private static Method findMethod(Class clazz,
String functionName) throws Exception
Method[] methods = clazz.getMethods();
for (int i=0; i<methods.length; i++)
if (methods[i].getName().equals(functionName))
return methods[i];
return null;

The code for sample class is as follows:

Sunday, February 14, 2010

Reading a Class using BLOB from a MySQL Database

MySQL does not directly have the capacity to handle java classes. However, an instance of a class can be converted to a BLOB which can then be stored. The following is a sample program doing that:

public class SampleClass {

static final String DataBase_Url =
static final String Driver = "com.mysql.jdbc.Driver";

//note the Driver will always be the same when
connecting to MySQL but the URL is dependent on
your MySQl database: localhost is the Server Host,
3306 is the port and samptable is the name of the schema

public static void main(String[] args) {
String printStr = "This is your concience speaking.";

Connection con = null;
Statement stat = null;
ResultSet rSet = null;
con = DriverManager.getConnection(DataBase_Url,
"username", "secretPassword");
stat = con.createStatement();

rSet = stat.executeQuery("SELECT username from user");

while ( {
String ferrariprice = rSet.getString("username");
System.out.println(" " + ferrariprice );


catch (Exception Exc)

catch (SQLException sqlExc)
}//end finally

//Pull Blob
stat = null;
rSet = null;
con = null;

//Connection conn = DBUtil.getConnection(connectionName);

try {

con =
DriverManager.getConnection(DataBase_Url, "username", "secretPassword");
stat = con.createStatement();

rSet = stat.executeQuery("SELECT * FROM savedcasing");
System.out.println("got rSet");

while ( {
try {
vo = new com.faneng.workflow.model.SavedCasingVO();
Blob ib = rSet.getBlob("casingInputVO");
ByteArrayInputStream is = null;
ObjectInputStream ins = null;

if (ib != null) {
is = new ByteArrayInputStream(ib.getBytes(1, (int)
ins = new ObjectInputStream(is);

} catch (Exception e) {
throw new SQLException(e.getMessage());
catch (Exception Exc)

catch (SQLException sqlExc)
}//end finally



Monday, February 8, 2010

A good resource for REST web services

Jose Sandoval has written an excellent book on developing REST web servers. The whole concept of web servers is quite an abstract area. However, Jose's book clearly explains the technology so that a person with a moderate level of experience with Java and building Java based web applications should be able to make the step into building powerful REST applications.

Jose's many years of experience in a wide range of Java technologies enable him to explain clearly the required concepts to understand REST while not being excessively wordy on peripheral technologies.

Creating a simple Servlet

The following link provides a good basic tutorial for making a servlet: A Hello World Servlet

When making the servlet in MyEclipse, start a new web project (I called mine ServletExample), then create the package: test, add the HelloServlet class to this package, and change the web.xml as required. Then it should work just fine.

For reference, the HelloServlet class is as follows:

package test;


import javax.servlet.http.*;
import javax.servlet.*;

public class HelloServlet extends HttpServlet {
public void doGet (HttpServletRequest req,
HttpServletResponse res)
throws ServletException, IOException
PrintWriter out = res.getWriter();

out.println("Hello, world!");

The XML file is as follows:
<web-app xmlns="" version="2.4"



To run the servlet in MyEclipse, right click on the project and select Run-As MyEclipse Server Application.

You can then access the servlet by entering the following in the command line:

Saturday, January 30, 2010

Intelligence from outside intelligencia: Garrett Lisi

Garrett Lisi it a theoretical physicist that is not letting himself be encumbered by the security of an academic lifestyle. I hope he has success with his E8 theory about quantum physics.

Check out his deferential geometry personal wiki notebook. If you scroll down to the section called E8 theory summary, you can click on the formulas and actually edit them right on the screen.

It is always a challenge to show formulas on a web page, and he seems to have figured out how to do it elegantly.

Friday, January 29, 2010

Create a Java Program in Eclipse

I have been doing a bunch of Struts and REST development in Eclipse for which there are good wizards to get started, but it was suprizingly difficult figure out how to build just a simple hello world java project.

With the help of Nathan, I can now do the basic java project:

First, select the new button just below File and open a new Java Project

A New Java Project window will open: enter the name of the project then click Finish

You should now see your project listed in the Package Explorer. Expand the project.

Under the project you will see the project’s package (src) and the library it is referencing. You now want to add a class to the project where you can write your program. So right click the package (src), select new -> class.

The New Java Class window opens. Notice the Source Folder. Type the name of the new class and ensure “public static void main(String[] args)” is selected. Click finish to create the class.

Because we selected the option to create the main, the IDE automatically inserts its declaration into the code. Now we can begin to write our basic program right away.

Replace the comment with this text:

String printStr = "This is your conscience speaking..."; System.out.println(printStr);

In the Package Explorer, right click the class and select Run As to run the program. If a message box appears, select yes to save the project. You will see the text printed to the screen.