Saturday, October 17, 2009

Creating text with images

This tutorial details the steps to create a wording with parts of an image in the foreground of the text. Like this:


First open up the image which needs to be in the foreground of the text.

Next, select the text tool from the tool box. I used the following settings:


Now type the desired text. I typed "Happy Diwali". Note that this new text creates a new layer.

The image now looks like this:

Next, select "Path from text" in the toolbox (without changing the tool selection)


Now make a selection of the text by clicking Select -> From Path


Now the image looks like this:

Now Select Edit -> Clear.


Now the image looks like this:


Now, select the text layer and click on "Layer to image size"


Then, select Select -> invert. This will select everything other than the text selected previously.


Select the bucket fill tool. This is what I used:


The final result looks like this:



Enjoy :-)

Tip: To make a selection from scissors select tool, click inside the selection

After making the selection with the scissors selection tool, click inside the selection to turn it into a selected area.

The Tools menu has the same options as the toolbox window. But the tools are categorized by type.

Thursday, October 15, 2009

Creating callouts or speech bubbles in GIMP

First open the basic image to which you would like to add the callouts to. This was my base image:



Add a new layer to the image by selecting Layer -> New Layer:



Give the new layer a new name (optional)


The new layer can now be found in the layers window:



Now select the Ellipse Select Tool from the Toolbox window



Draw an ellipse on the image where the callout is required:



In my case, I wanted the border line of the call out to have the same color as the cat's face. So I had to set my foreground colour to the cat's face color. To do so, select the Color picker tool in the toolbox. In the layer's window, select the Background layer.



With the Color picker tool click on the cat's face to set that color as the foreground color.



Select the new layer that was created in the first few steps:


Now select the fill tool and make sure "FG color fill" is selected.


Now click inside the ellipse. The image looks like this now:



Now click select -> Shrink.



In the next dialog, enter the size of the callout's border. In my case I wanted a 3 pixel border.



The selection now reduces by the number of pixels entered in the previous step:



Now click edit -> clear.


Now the border of the call out is nicely formed.



Now get rid of the selection (Select -> None)



Now to extend the call out, use the Path tool. Select click on points indicated:



After clicking on the 3rd point, hold the control key, hover over the 1st point and when the mouse pointer changes a little bit, click. This will make the selection a closed one.

Now draw lines over the selection by selecting Stroke selection:



In my case the size of the call out line is 3 pixels (entered previously in the shrink selection step). The same size is entered here too:



Now the image looks like this:



Using the same steps, make another call out for the mouse:



Now the lines within the call out arrows have to be removed. To do so, zoom in:



Select the Paths tool and go about clicking on the line segment that needs to be erased. Now select "Stock path" and select "Stock path from paint tool" and select "Erase" in the drop down (before doing this select the eraser tool in the tool bar and make sure the brush size [in the eraser tool properties] is correct) and stroke. This will erase the un-necessary parts and look like this:



Use, the Text tool and enter the desired text into the call out. Have Fun/ :-)

This tutorial is based on this article with more details and certain improvements.

Nice AOP articles

Spring Terminology: Weaving

Weaving is the process of applying Aspects to Targets to create Proxies. The aspects are woven into the target at the specified joinpoints. This process can happen at different stages of the Target's life
1. Compile Time: Aspects woven into targets when target class is compiled. This requires a special compiler though. Aspectj's weaving compiler weaves aspect this way.
2. Classload time: Aspects woven into targets when target class is loaded into the JVM. This requires a special class loader that enhances the target class's byte code before it is introduced to the application. Aspectj 5's load time weaving (LTW) support is based on this approach.
3. Runtime: Aspects woven into targets when target class is invoked. Typically an AOP container will generate a proxy object that will deliver the aspect functionality before or after delegating to the target object. This is how Spring AOP aspects are woven.

Source: My understanding from reading "Spring In Action"

Spring Terminology: Proxy

When an advice is applied to a Target, it becomes a Proxy. To the clients of the Target, the Target (Pre-AOP) and the Proxy (Post-AOP) are the same. There are no differences in the public APIs exposed by both of the objects. The Delta between the proxy and the target is the implementation to address cross-cutting concerns that are hosted in the Advice.

Source: My understanding from reading "Spring In Action"

Spring Terminology: Target

A target is the object that is being advised. This could be a third party object and a self-written home-grown object. If there was no AOP then then object would handle both its primary logic and cross cutting concern. With AOP this object's responsibility is restored to its code logic and it does not know that it is being advised.

Source: My understanding from reading "Spring In Action"

Spring Terminology: Introductiion

Introduction gives new behavior and state to existing classes without having to change the existing classes. This is achieved by adding new methods and properties to existing classes.


Source: My understanding from reading "Spring In Action"

Wednesday, October 14, 2009

Spring terminology: Aspect revisited

See previous post titled “What is Cross Cutting Concern? Why AOP? What is Aspect?” before reading this.

 

An Aspect is an amalgam/merger of advice (what and when) and pointcuts (where) [see previous posts on advice and pointcuts].

 

 

Spring Terminology: PointCut

An Aspect (see previous post on what an Aspect is) need not handle all Join points of an application. A specific Aspect can be made responsible for a subset of Join points. PointCuts are used to define the subset of join points that a given Aspect is responsible for handling. In other words PointCuts defines the join points where the aspect logic is to be applied. This “where” can be defined on specific, explicit class and method names or through regular expressions that apply to classes and method names that match the pattern.  

Spring Terminology: Join Point

Points in application logic where the aspect’s (see previous posts on what an Aspect is) functionality is to be applied or plugged in. This point could be a method invocation, field write/modification or exception thrown. There are points where the aspect’s logic can be pluged in to add new behaviour.

Spring Terminology: Advice

Defines the responsibility of the Aspect (see previous posts on what an Aspect is) in terms of what (will be performed) and when (it will be performed – before/after/before and after/only on exception).

Brittle means Fragile

 

What is Cross Cutting Concern? Why AOP? What is Aspect?

There are certain aspects of the application that has to be addressed at every layer of the application and cannot be categorized to be a responsibility of any one single layer. Examples are logging, transaction management, security, Caching, Validation etc…

These aspects that span across the several layers of the application are cross cutting concerns. AOP helps decouple cross cutting concerns from the application logic that they impact.

If there was no AOP, one would have to implement common functionality in a base class and have all classes make use it. But this will make the object hierarchy brittle. Other common approach is to delegate common functionality is to utility class. But this will require calls to the utility method spread all across application logic code.



In AOP, the common functionality is implemented in a single class. But this class is invoked by declaratively defining how and where the functionality needs to be applied without having to modify the class to which the functionality is applied to.


These classes that hold common functionality are called Aspects.


Now, the application logic code or service modules contain code pertaining only to their primary responsibility or primary concern and secondary concerns move to aspects. The second advantage is that all common functionality is nicely held in a single place.


Why Dependency Injections

Dependency Injections helps decouple the various components of the application by

  1. Having the components reference each other through abstract interfaces and
  2. Delegate instantiation of concrete implementation classes to a dependency injection framework like Spring

Tuesday, October 13, 2009

Gimp Controls

Navigating over big images or high zoom levels:

 

 

Clicking on that helps to navigate over the image like this:

 

 

To view image details

 

Brings up this:

 


React the same way to winning and losing

If you can react the same way to winning and losing, that… quality is important because it stays with you the rest of your life.

 

- Chris Evert

Monday, October 12, 2009

jQuery(this) example

An example of using jQuery(this).

My browser favourites






work wholeheartedly

When you’re working, focus. I’ve found that concentrating on work is actually less exhausting than allowing yourself to be wishy-washy about it. When you decide that it’s time to work, buckle down, eliminate distractions, and do it wholeheartedly. There’s something amazingly refreshing about pure, sharp focus.

 

Zen Habits

Gimp Book

Nice Article on CSS Styling

Friday, October 09, 2009

Collapsing HTML table using jQuery

<html>

<head>

<script src="http://code.jquery.com/jquery-latest.js"></script>

<script type="text/javascript">

$(document).ready(

  function()

  {

    jQuery("[id*=testTable] tr:gt(1)").hide();

  }

);

 

function collapseDetails()

{

  jQuery("#testTable tr:gt(1)").toggle() ;

}

</script>

</head>

<body>

  <div id="wholeBody">

    <table id="testTable">

      <tbody>

        <tr>

          <td>

            col1

          </td>

          <td>

            col2

          </td>

        </tr>

       

        <tr>

          <td>

            col1

          </td>

          <td>

            col2

          </td>

        </tr>

       

        <tr>

          <td>

            col1

          </td>

          <td>

            col2

          </td>

        </tr>

       

      </tbody>

    </table>

    <div id="showAll" onclick="collapseDetails();">Show/Hide</div>

  </div>

</body>

</html>

Collapsing table using jQuery
























col1

col2

col1

col2

col1

col2

Show/Hide

Thursday, October 08, 2009

"We learn more by looking for the answer to a question and not finding it, than we do from learning the answer itself."

“We learn more by looking for the answer to a question and not finding it, than we do from learning the answer itself.”

- Lloyd Alexander through Julie911

Tuesday, October 06, 2009

No bitterness

“Bitterness imprisons life; love releases it. Bitterness paralyzes life; love empowers it. Bitterness sours life; love sweetens it. Bitterness sickens life; love heals it. Bitterness blinds life; love anoints its eyes.”

- 
Harry Emerson Fosdick through Julie911

Monday, October 05, 2009

"Time you enjoy wasting, was not wasted."

“Time you enjoy wasting, was not wasted.”

- 
John Lennon through Julie911

"My formula for living is quite simple. I get up in the morning and I go to bed at night. In between, I occupy myself as best I can."

“My formula for living is quite simple. I get up in the morning and I go to bed at night. In between, I occupy myself as best I can.”

- 
Cary Grant through Julie911

Friday, October 02, 2009

The cheapest, fastest, and most reliable components of a computer system

“The cheapest, fastest, and most reliable components of a computer system are those that aren’t there.” - Graham Bell through Leo

In the context of don’t bring in stuff that are not needed

Forgiveness is the only way to dissolve .... resentment

“When you hold resentment toward another, you are bound to that person or condition by an emotional link that is stronger than steel. Forgiveness is the only way to dissolve that link and get free.”

- 
Angela Belcher through Julie911

don't play sad songs

“Whatever you do, don’t play sad songs if you’re blue, ‘cause they’ll just bring you down.”

- Cheyenne

 

Wednesday, September 30, 2009

My car at the access lake on Sept 14th 2009

Gratitude

“Gratitude unlocks the fullness of life. It turns what we have into enough, and more. It turns denial into acceptance, chaos into order, confusion into clarity… It turns problems into gifts, failures into success, the unexpected into perfect timing, and mistakes into important events. Gratitude makes sense of our past, brings peace for today and creates a vision for tomorrow.”

- Melody Beattie through Julie911

Sunday, September 27, 2009

"All summer, I'd looked at these mountains as goals totally focused on the biggest one, K2. I had thought about their elevation and the technical challenges they presented to me as a climber. But that morning,...for the first time, I simply saw them. It was overwhelming."...
"despite his weakened state, his lack of food and warm clothing, his poor odds of surviving if he didn't find some of both sometime soon, Mortenson felt strangely content." - Three Cups of Tea by Greg Mortenson & David Oliver Relin

Friday, September 25, 2009

Good Java programming idioms

http://c2.com/ppr/wiki/JavaIdioms/ReturnNewObjectsFromAccessorMethods.html

Tuesday, September 22, 2009

Better Lighting for your computer

To adjust monitor lighting based on lighting:

 

http://www.stereopsis.com/flux/

Monday, September 21, 2009

inconvenience ...wrongly considered

“An adventure is only an inconvenience rightly considered. An inconvenience is only an adventure wrongly considered.”

- G.K. Chesterton, “On Running After One’s Hat,” All Things Considered, 1908 through Julie911

Whatever you do, make it mean something to you.

“Whatever you do, make it mean something to you.”

- Jazsmin Lewis, Barbershop through Julie911

Friday, September 18, 2009

Read the error, fix the error - Eric

To mean read the error patiently over and over again until you get a working clue of what is wrong.

Interesting article on selenium

http://roneiv.wordpress.com/2008/10/17/using-selenium-to-test-jsf-application/

Thursday, September 17, 2009

And if my God is with me Whom then shall I fear?

Even though I walk through the valley of the shadow of death
Your perfect love is casting out fear
And even when I'm caught in the middle of the storms of this life
I won't turn back I know You are near

And I will fear no evil
For my God is with me
And if my God is with me
Whom then shall I fear?
Whom then shall I fear?

Oh no, You never let go
Through the calm and through the storm
Oh no, You never let go
In every high and every low
Oh no, You never let go
Lord, You never let go of me

And I can see a light that is coming for the heart that holds on
A glorious light beyond all compare
And there will be an end to these troubles but until that day comes
We'll live to know You here on the earth

And I will fear no evil
For my God is with me
And if my God is with me
Whom then shall I fear?
Whom then shall I fear?

Oh no, You never let go
Through the calm and through the storm
Oh no, You never let go
In every high and every low
Oh no, You never let go
Lord, You never let go of me

Yes, I can see a light that is coming for the heart that holds on
And there will be an end to these troubles but until that day comes
Still I will praise You, still I will praise You

- Matt Redman

glorious world as we've been provided, with birds, sunshine, beautiful trees and flowers, and the radio

“I don’t know why, with such a glorious world as we’ve been provided, with birds, sunshine, beautiful trees and flowers, and the radio, why people don’t get on better than they do.”

- Florence Stanley, The Fortune, 1975 through Julie911

On Luke's bike yesterday :-)

Tuesday, September 15, 2009

The absolute worst situation is too much to do in too little time

The absolute worst situation is too much to do in too little time. When presented with unrealistic expectations at your workplace, STOP to breathe. Start a supply of oxygen flowing into your brain to help your clarity. Do a few stretches and then put your full attention on the task. You have likely performed a similar task before. Your brain just clouded and taking a few moments to breathe will help lighten ….. Don’t try to absorb the whole picture; instead break the big task into small, manageable parts. Finally, if you are unable to finish by the imposed deadline, calmly explain your need for extended time to your supervisor.

 

- Julie911

people who are so much afraid of pain ... shrink until life is a mere living death

“It takes courage to love, but pain through love is the purifying fire which those who love generously know. We all know people who are so much afraid of pain that they shut themselves up like clams in a shell and, giving out nothing, receive nothing and therefore shrink until life is a mere living death.”

- Eleanor Roosevelt through Julie911

"I like it when a flower or a little tuft of grass grows through a crack in the concrete. It's so fuckin' heroic."

“I like it when a flower or a little tuft of grass grows through a crack in the concrete. It’s so fuckin’ heroic.”

- George Carlin through Julie911

Being present is real work.

“Being present is real work.”

- Laura van Dernoot Lipsky through Julie911

I've met more than my share of public figures who didn't measure up to their own press - Three Cups of Tea

 

Saturday, September 12, 2009

Not lost anymore - Lost

"You don't feel frustrated anymore? I am not lost anymore.
Anything lost gets found...So I stopped looking."

Wednesday, September 09, 2009

Hibernate Schema tools

The hbm2ddl.auto column indicates the values for the hbm2ddl.auto property in the hibernate configuration file

The Purpose column indicates what is the impact of using the specified hbm2ddl.auto value

The Class Name column indicates how to achieve the “purpose” programmatically.

 

hbm2ddl.auto option

Purpose

Class name

create or create-drop or

create – to drop the schema and create it whenever SessionFactory is built

create-drop – to drop the schema when SessionFactory is closed.

 

SchemaExport

e.g.

SchemaExport ex = new SchemaExport( new Configuration().configure() );

Ex.create(false, true);

// false – don’t print sql to stdout

// true – Execute ddl immediately on database

Update

Update – Read the schema through JDBC driver (not reliable) and make schema changes to fit the schema to mappings

SchemaUpdate

e.g.

SchemaUpdate su =

New SchemaUpdate(new Configuration().configure() );

Su.execute(false); // don’t print ddl on stdout

Validate

Validator – compare mapping with metadata and throw exception if they do not match.

SchemaValidator

e.g.

new SchemaValidator(new Configuration().configure()).validate()