Saturday, September 10, 2011

How to debug XSLT with Visual Studio

Evaluating and debugging XSLT with visual studio is a very simple task and very useful in developing XSLT.

Evaluating xslt with VS.

Open the xslt file using visual studio and then select show xslt output option from XML menu.

image

It will show a browse option to select the input xml for the processing. Next will will show the output xml in another tab.

image

Debugging XSLT with VS

For debugging xslt, all you have to do is to set a break point on the xslt and select bebug xslt option from the XML Menu.

image

Saturday, August 13, 2011

NLP Eye Accessing cues

NLP (Neuro-Linguistic Programming)  was developed by Richard Bandler and linguist John Grinder, and they believed that NLP will be useful in "finding ways to help people have better, fuller and richer lives"

There are usual meanings to the eye moment. By observing the eye movement, it is possible to tell “which sensory systems” are accessed.

1. Up and to the left usually means that a person is remembering something visually

eye_acc_vrec

2. Up and to the right usually means that a person is imagining something visually

eye_acc_vcon

3. Left side usually means a remembered sound

eye_acc_Arec

4. Right side  usually means an imagined sound

eye_acc_Acon

5.  Down right (which is down right obvious!) usually means that a person is accessing a bodily feeling or emotion.

eye_acc_K

6. Down left usually means that a person is accessing internal dialogue

eye_acc_loop

Lying

Note that venerable proverb: Children and fools _always_ speak the truth. The deduction is plain --adults and wise persons _never_ speak it. Parkman, the historian, says, "The principle of truth may itself be carried into an absurdity." In another place in the same chapters he says, "The saying is old that truth should not be spoken at all times; and those whom a sick conscience worries into habitual violation of the maxim are imbeciles and nuisances." It is strong language, but true. None of us could _live_ with an habitual truth-teller; but thank goodness none of us has to. An habitual truth-teller is simply an impossible creature; he does not exist;he never has existed. Of course there are people who _think_ they never lie, but it is not so--and this ignorance is one of the very things that shame our so-called civilization. Everybody lies--every day;every hour; awake; asleep; in his dreams; in his joy; in his mourning; if he keeps his tongue still, his hands, his feet, his eyes, his attitude, will convey deception--and purposely.

- Mark Twain

http://grammar.about.com/od/60essays/a/lyingessay.htm

Wednesday, August 3, 2011

Dealing with MySql passwords

1. If the current root password needs to be changed

mysqladmin -u root -pcurrentpassword password newpassword

2. To Setup a root password, if a password was not setup

mysqladmin -u root password NEWPASSWORD

3. Changing the old password by using sql commands

In mysql, user data is kept in the user table of mysql database. Hence it is  possible to directly update or change passwords for users.

Step1. Login to db.

mysql –u root –p

Step2. Use mysql db

mysql> use mysql;

Step3. Change password.

mysql> update user set password=PASSWORD("newpass") where User='root';

Step4. Reload privileges

mysql> flush privileges;

Tuesday, August 2, 2011

Pride

Here lies Jan Smith,
Wife of Thomas Smith, Marble Cutter.
This monument was erected by her
husband as a tribute to her memory
and a specimen of his work.
Monuments of this same style are
two hundred and fifty dollars.

          epitaph composed by a marble cutter

Sunday, July 31, 2011

How to write a custom registry handler to handle associations

WSO2 Registry is a content repository which provides set of abstractions over a raw relational db. Registry provides a rich set of features for storing, managing and finding resources/content. However, sometimes, one have to go beyond existing default functionality to implement custom behavior to suite specific requirements. Handlers and Filters are such an extension point of registry which allows users to implement customizations by write small about of code.

A handler is written by extending the Handler class and overriding its necessary methods. Custom handler is registered with the registry by putting an entry in the registry.xml

public class CustomHandler extends Handler {
public void addAssociation(RequestContext requestContext) throws RegistryException {}
public void removeAssociation(RequestContext requestContext) throws RegistryException{}
}

<handler  class="org.wso2.carbon.regisry.samples.handler.CustomHandler">
<filter class="org.wso2.carbon.registry.samples.handler.CustomMediaTypeMatcher">
<property name="mediaType">mytype</property>
</filter>
</handler>

In order to invoke our CustomHandler, we have defined a custom media type and a CustomMediaTypeMatcher class. CustomMediaTypeMatcher class should extend the MediaTypeMatcher class. 

When a resource with media type mytype is added to the registry, associated registry filter classes will be called to perform an evaluation and based on its result, associated handlers will be invoked.

In our scenario, we want to invoke the methods addAssociation, and removeAssocation when a resource is associated with a resource which has the media type “mytype”. The code sample for the CustomMediaTypeMatcher class to handle it is shown below.

public class CustomMediaTypeMatcher extends MediaTypeMatcher{
public boolean handleAddAssociation(RequestContext requestContext)
            throws RegistryException {
        Resource resource = requestContext.getRepository().get(requestContext.getSourcePath());
        if (resource != null) {
            String mType = resource.getMediaType();
            return mType != null && (invert != mType.equals(getMediaType()));
        }
        return false;
    }

    public boolean handleRemoveAssociation(RequestContext requestContext)
            throws RegistryException {
        Resource resource = requestContext.getRepository().get(requestContext.getSourcePath());
        if (resource != null) {
            String mType = resource.getMediaType();
            return mType != null && (invert != mType.equals(getMediaType()));
        }       return false;
    }
}

Happiness and Sadness

Types of Happiness: Emotion and Sentiment

It is not easy to find happiness in ourselves, and impossible to find it elsewhere.
—Agnes Repplier

What do you take me for, an idiot?
—General Charles de Gaulle, when a journalist asked him if he was happy.

A distinction can be made between two major types of happiness. A long term sentiment of happiness (flourishing, well-being) and a short term emotion of happiness ( Joy, satisfaction).

As an emotion, happiness is a short-term state of pleasure or satisfaction occurring as a result of ( real or imaginary ) positive changes.

A steady diet of simple pleasures will keep you above your set point. Find the small things that you know give you a little high—a good meal, working in the garden, time with friends—and sprinkle your life with them. In the long run, that will leave you happier than some grand achievement that gives you a big lift for a while. - David Lykken

It was found that those people who are relatively the happiest now will be the happiest ten years from now, despite day to-day fluctuations.

Determinants of Happiness

It is pretty hard to tell what does bring happiness; poverty and wealth have both failed.
—Kin Hubbard
We are no longer happy as soon as we wish to be happier.
—Walter Savage Landor

Happiness can be experienced as a result of being focus on an activity and not the result. Happiness is then to be found in activities we value in themselves.

"It's the hunt—not the money—that makes my blood race; after all, you can only sleep in one bed at a time, and drive one car at a time”

- Chris Verbiski

Happiness depends on the way we act than the specific result of our activities.

Happiness “arises more from the pursuit than from the attainment of any end
whatever”. It "depends more on the degree in which our minds are properly
employed, than it does on the circumstances in which we are destined to act, on the materials which are placed in our hands, or the tools with which we are furnished."

Linking happiness to an attainment of goal results in unhappiness than happiness and in the end when the goal is achieved, we may not actually enjoy it as much as expected. It may be due to the fact that original circumstances may have changed by the time achievement is obtained or the expectation and reality gap. 

“There are two tragedies in life. One is not to get your heart's desire. The other is to get it” - George Bernard Shaw

Post coitum omne animal triste est —"After sexual intercourse every animal is sad"

Maintaining Long-Term Happiness

Happiness is not a state to arrive at, but a manner of traveling.
—Margaret Lee Runbeck

The happiness of most people we know is not ruined by great catastrophes or fatal errors, but by the repetition of slowly destructive little things.
—Ernest Dimnet

Dealing with the baseline (expectation)  and reality (current situation) gap can be done by (a)  eliminating the gap by changing the baseline or reality (b) coping with the gap by changing our attitude toward it.

Sadness
One can endure sorrow alone, but it takes two to be glad.
—Elbert Hubbard
It is our job to make women unhappy with what they have.
—B. Earl Puckett, an advertiser

Sadness confirms our appraisal of things as valuable; hence it may happen that we take pride in our ability to feel sadness.

When it gets dark enough you can see the stars

Grief
Let us so live that when we come to die, even the undertaker will be sorry.
—Mark Twain

Grief is the most profound type of sadness. It is concerned with death, the most substantial misfortune we encounter: it expresses the irrevocable loss of someone very close and of great value to us.

Moral Value

Happiness, it is said, is seldom found by those who seek it, and never by those
who seek it for themselves.
—F. Emerson Andrews

Thousands of candles can be lighted from a single candle, and the life of the candle will not be shortened. Happiness never decreases by being shared.
—Buddha

Sorrow makes men sincere.
—Henry Ward Beecher
If a way to the better there be, it lies in taking a full look at the worst.
—Thomas Hardy

Happiness is often achieved through positive illusions; in sadness, reality is better known. Sadness is unpleasant, but it is morally valuable for committing ourselves to the more profound moral obligations. Happiness is also morally valuable but for different reasons: its main value is in helping us to perform the "small" everyday moral deeds.

Source: The Subtlety of Emotions.

Thursday, July 21, 2011

Delivering Happiness

Art_P229

Most common belief is that “When I get ___, I will be happy, or When I achieve ___, I will be happy.”. But the reality is that, happiness gained in such manner tend do disappear very quickly.

Happiness Framework.

Happiness is really just about four things: perceived control, perceived progress, connectedness (number and depth of your relationships), and vision/meaning (being part of something bigger than yourself). 

Art_P233

Maslow’s Hierarchy.

Art_P236

Self actualization is the ultimate form of happiness according to Maslow’s hierarchy.

Art_P237

Pleasure

The pleasure type of happiness is about always chasing the next high.As soon as the source of stimuli goes away, people’s happiness levels drop immediately.

Passion

The passion type of happiness is also known as flow, where peak performance meets peak engagement, and time flies by.

Higher Purpose

The higher-purpose type of happiness is about being part of something bigger than yourself that has meaning to you. Research has shown that of the three types of happiness, this is the longest lasting. What I find interesting is that many people go through life chasing after the pleasure type of happiness, thinking that once they are able to sustain that, then they will worry about the passion and, if they get around to it, look for their higher purpose.

Start asking yourself the right questions.

  • Are you working toward maximizing your happiness each day?
  • What is the net effect of your existence on the total amount of happiness in the world each day?
  • What are your values?
  • What are you passionate about?
  • What inspires you?
  • What is your goal in life?
  • What are your company’s values?
  • What is your company’s higher purpose?
  • What is your higher purpose?

When you walk with purpose, you collide with destiny.

—BERTICE BERRY

Source:http://en.wikipedia.org/wiki/Delivering_Happiness

And read how to be happy.

Tuesday, July 19, 2011

PERSUASION PRINCIPLES

LIKING:
People like those like them, who like them.

To influence people, win friends, through: Similarity:Create early bonds with new peers, bosses, and direct reports by informally discovering common interests—you’ll establish goodwill and trustworthiness.Praise:Charm and disarm.Make positive remarks about others—you’ll generate more willing compliance.

RECIPROCITY:
People repay in kind.

Give what you want to receive. Lend a staff member to a colleague who needs help; you’ll get his help later.

SOCIAL PROOF:
People follow the lead of similar others.

Use peer power to influence horizontally, not vertically; e.g., ask an esteemed “old timer” to support your new initiative if other veterans resist.

CONSISTENCY:
People fulfill written, public, and voluntary commitments.

Make others’ commitments active, public, and
voluntary. If you supervise an employee who should submit reports on time, get that understanding in writing (a memo); make the commitment public (note colleagues’ agreement with the memo); and link the commitment to the employee’s values (the
impact of timely reports on team spirit).

AUTHORITY:
People defer to experts who provide shortcuts to decisions requiring specialized information.

Don’t assume your expertise is self-evident. Instead, establish your expertise before doing business with new colleagues or partners; e.g., in conversations
before an important meeting, describe how you solved a problem similar to the one on the agenda.

SCARCITY:
People value what’s scarce.

Use exclusive information to persuade. Influence and rivet key players’ attention by saying, for example:“…Just got this information today.It won’t be distributed until next week.”

Source : Harnessing the Science of Persuasion by Robert B. Cialdini

Thursday, July 7, 2011

Lessons learned from Bill Gates

http://sourcesofinsight.com/2011/01/19/lessons-learned-from-bill-gates/

What i really liked is Bill Gate’s 11 Rules of life.

  • Rule 1: Life is not fair
  • Rule 2: The world won’t care about your self-esteem.
  • Rule 3: You will NOT make $60,000 a year right out of high school.
  • Rule 4: If you think your teacher is tough, wait till you get a boss.
  • Rule 5: Flipping burgers is not beneath your dignity.
  • Rule 6: If you mess up, it’s not your parents’ fault, so don’t whine about your mistakes, learn from them.
  • Rule 7: Before you were born, your parents weren’t as boring as they are now.
  • Rule 8: Your school may have done away with winners and losers, but life HAS NOT.
  • Rule 9: Life is not divided into semesters.
  • Rule 10: Television is NOT real life.
  • Rule 11: Be nice to nerds.

Friday, July 1, 2011

Saturday, June 18, 2011

Great site with quality content

businessballs-poster

You’re a Good Little Slave!

If you knew with certainty that you would be dead exactly one year from today, would you continue to do the same things each day that you are doing right now?

http://www.lifestyleignition.com/2010/05/you%E2%80%99re-a-good-little-slave/

Friday, June 17, 2011

Servant Leadership

Extract from Wikipedia.

10 characteristics that are central to the development of a servant leader

  • Listening: Traditionally, and also in servant leadership, managers are required to have communication skills as well as the competence to make decisions. A servant leader has the motivation to listen actively to his fellow men and supports them in decision identification. This applies particularly to pay attention to unspoken. This means relying on his inner voice and find out what the body, mind and spirit are communicating.[4]
  • Empathy: A servant leader attempts to understand and empathize with others. Workers may be considered not only as employees, but also as people who need respect and appreciation for their personal development. As a result, leadership is seen as a special type of human work, which ultimately generates a competitive advantage..[5]
  • Healing: A great strength of a Servant Leader is the ability for healing one’s self and others. A servant leader tries to help people solving their problems and conflicts in relationships, because he wants to develop the skills of each individual.[6] This leads to the formation of a business culture, in which the working environment is characterized by dynamic, fun and no fear from failure.[7]
  • Awareness: A servant leader needs to gain general awareness and especially self-awareness. He has the ability to view situations from a more integrated, holistic position. As a result, he gets a better understanding about ethics and values.
  • Persuasion: A Servant Leader does not take advantage of his power and his status by coercing compliance; he rather tries to convince them. This element distinguishes servant leadership most clearly from traditional, authoritarian models and can be traced back to the religious views of the inventor Robert Greenleaf.
  • Conceptualization: A servant leader thinks beyond day-to-day realities. That means he has the ability to see beyond the limits of the operating business and also focuses on long term operating goals.[8] A Leader constructs a personal vision that only he can develop by reflecting on the meaning of life. As a result, he derives specific goals and implementation strategies.[9]
  • Foresight: Foresight is the ability to foresee the likely outcome of a situation. It enables the servant leader to learn about the past and to achieve a better understanding about the current reality. It also enables to identify consequences about the future. This characteristic is closely related to conceptualization. In contrast to the other characteristics, which can be consciously developed, foresight is a characteristic which one may be born.
  • Stewardship: CEOs, staffs and trustees have the task to hold their institution in trust for the greater good of society. In conclusion, servant leadership is seen as an obligation to help and serve others. Openness and persuasion are more important than control.
  • Commitment to the growth of people: A servant leader is convinced that people have an intrinsic value beyond their contributions as workers. Therefore, he should nurture the personal, professional and spiritual growth of employees. For example he spends money for the personal and professional development of the people as well as having a personal interest in the ideas form everyone and involving workers in decisions. making.
  • Building community: A servant leader identifies means to build a strong community within his organization and wants to develop a true community among businesses and institutions.[10]

http://en.wikipedia.org/wiki/Servant_leadership#Concept_of_Servant_Leadership

How to correct connection refused exception with port 1433 on MSSQL server

On the SQL Server network configuration manager, select protocols for SQL…. On the TCP/IP option, click and enable it if it is disabled. Note that Listen ALL option is disabled.

image

On the IP Address tab,

image

select the ip where you want to listen to port 1433 and make sure its enabled, with the TCP port configured to 1433 as shown in the image. That’s it.

How to migrate an MSSQL Server Database from one location to another

A database in MSSQL server is stored in two files, namely .ldf file and a .mdf file. In case of MSSQL Server 2008 , these files are by default located at C:\Program Files\Microsoft SQL Server\MSSQL10_50.SQLEXPRESS\MSSQL\DATA directory.

In order to move these files from one MSSQL server instance to another MSSQL instance, we need to copy these file from one location and paste at another location. For that, first we should detach the db. It can be done from the management studio using the following commands.

Assuming that the database name is mydb following sql query will detach the db from the server. 

use master
go
alter database mydb set single_user with rollback immediate
alter database mydb set restricted_user with rollback immediate
go
exec sp_detach_db mydb
go

Now the data file and log file can be copied without issue to the destination. Now in order to re attach the database, use the following command.

EXEC sp_attach_db @dbname = N'mydb',     @filename1 = N'C:\Program Files\Microsoft SQL Server\MSSQL10_50.MSSQLSERVER\MSSQL\Data\mydb.mdf',     @filename2 = N'C:\Program Files\Microsoft SQL Server\MSSQL10_50.MSSQLSERVER\MSSQL\Data\mydb_log.ldf'

Tuesday, March 22, 2011

How to setup MSSQL Server Express 2008

I happened to install MSSQL server express and thought of writing down some useful tips.

If you have Visual Studio 2008 installed on the system, you will need to install Visual Studio Service Pack1 before installing MSSQL Server Express. Once installed, next step is to login to the server using the SQL Server Management Studio.

Connecting to SQL Server using Management Studio.

Here are the steps to follow to connect to the server using management studio.

1. Enable TCP/IP, Named Pipes  options for sql server using SQL Server configuration Manager.

image

image

2. Step 2

Using the management studio, connect to the server.

image

For the server type, select Database Engine. For server name, you will need to specify the Computer Name(Host computer Name)\(Server Name) Or .\(Server Name). Otherwise you will get a nasty error message. For the authentication option, select Windows Authentication. Now, all is set to connect to the server.  If you forget to specify the Host name or use .\ in the Server name option, this is the error message you will get.

image

Configuring SQL Server for Username/Password authentication ( Mixed mode )

In order to access the SQL Server programmatically, it should be configured for Mixed mode authentication. When configured for Mixed mode, SQL server allows login in to the server using SQL Server authentication ( Using a username, password ).

First, we need to create a new user login, which will be granted with the SQL Server Authentication. For that, go to logins tab under security as shown below.

image

Right click on the logins and select new login. Select SQL Server authentication option and specify the Login name and password.

image

Under User Mapping option, you can select the databases, this login has access to. Under status option check whether login option is enabled.

image

Now you are ready to login to the SQL Server using SQL Server Authentication.

Configuring a listening port for SQL Server remote access.

In order to access SQL server programmatically, the server has to be listening on a port. Usually this port is 1433. however, when installing the SQL server, if you gave the server instance a name, it wont be listening on this port by default. Hence you need to configure it.

Go to SQL Server configuration manager and select SQL server network configurations. Select the named SQL server instance which need to be configured for remote access.

image

Under Protocols, select TCP/IP and select the IP Addresses Tab. Now you can configure a given IP address and port for server to listen. Here, I am configuring the 127.0.0.1 for listening. On the enabled option, select yes. On the TCP Port option, specify the port. In this case, 1433. On the TCP Dynamic Ports option, if the value is 0 remove it and click ok. SQL server service should be restarted before you can access it though 1433 port.

Now get a command line and check whether server is listening on port 1433 with command netstat –a. Alternatively you can use to telent as well.

Sunday, February 13, 2011

How to do a demo

The key to a demo is to tell a story. 

You need to put yourself into the “role” of a person using the product who has a problem that he or she is trying to solve.

http://www.bothsidesofthetable.com/2009/06/10/doing-a-demo-vc-pitch-or-otherwise-part-5-in-vc-series/

Saturday, February 12, 2011

Wednesday, February 9, 2011

7 Sources of Innovation

Peter Drucker, one of the greatest management thinkers from the last century, defined in his book “Innovation and Entrepreneurship” (1986) 7 classes of “OPPORTUNITIES”. He named these the "SOURCES OF INNOVATION", namely:

  1. THE UNEXPECTED: An example of the unexpected is the development of Nutrasweet. A chemist developed a new chemical. Accidentally he got some of it in his mouth. To his surprise it tasted very sweet. This was the start of a development trajectory, that took many years before Nutrasweet was introduced by Searle into the market.
  2. INCONGRUITIES: Incongruities or conflicts between opposing functions, requirements or values may be the start of an innovation. For example the request for a small car with still enough space on the inside seems to be incongruent. This however was solved in a new design as the Smart.
  3. PROCESS NEEDS: An old proverb says that “necessity is the mother of invention”. In the old days of the US many unskilled immigrants from Europe arrived. They were peasants that lacked in skills for the manufacturing of sophisticated artifacts such as guns. In those days one made every component of these guns by hand. To let them fit to each other and work properly required high skills in manufacturing. By making machines more precise and introducing standardization of the artifacts one could produce thousands of components individually. The machine or gun could be assembled using arbitrarily with ever component from the stores. The individual tasks could easily be learned by the immigrants, without years of training to become an overall master. In this way they could profit maximally from the existing economies of scale and learning curve.
  4. INDUSTRY AND MARKET STRUCTURE: Industry markets and market structure may offer opportunity’s for new types of services. Outsourcing of activities such as maintenance of the IT infrastructure is an example. Other examples are the merging of industry’s such as for example the merging of the computer industry with consumer electronics or IT with business consulting services. The X box of Microsoft is just one example from many.
  5. DEMOGRAPHICS: Demographics have long been a major source of innovation creating opportunities for new types of products and services. Life style drugs such as Viagra are just examples where the growing group of elderly people who feel themselves still very healthy and who would like to enjoy life longer can conquer the effects of biological aging.
  6. CHANGES IN PERCEPTION: An example of changes in perception as source of innovation is the following. In older days health was seen as related to body mass, meaning fatter people were perceived as more healthy. In the last century this perception changed as a result of medical study’s that revealed that overweight was a risk factor. Since that time many light products have come to the market. Many substitutes of sugar have been developed such as Nutrasweet. Also substitutes of fat have been developed although these have not been successfully introduced into the market yet.
  7. NEW KNOWLEDGE: Last but not least new knowledge has produced many opportunities for new products. The emergence of micro-electronics and new programming methods and tools, biotechnology, nano-technology etc have been the main motors of innovation and progress over the last decades . This will probably continue for the coming decades”.

http://www.innovationmanagement.org/Wiki/index.php?title=7_Sources_of_Innovation_(Peter_Drucker)