Feeds:
Posts
Comments

Groovy…

  • is an agile and dynamic language for the Java Virtual Machine
  • builds upon the strengths of Java but has additional power features inspired by languages like Python, Ruby and Smalltalk
  • makes modern programming features available to Java developers with almost-zero learning curve
  • supports Domain-Specific Languages and other compact syntax so your code becomes easy to read and maintain
  • makes writing shell and build scripts easy with its powerful processing primitives, OO abilities and an Ant DSL
  • increases developer productivity by reducing scaffolding code when developing web, GUI, database or console applications
  • simplifies testing by supporting unit testing and mocking out-of-the-box
  • seamlessly integrates with all existing Java objects and libraries
  • compiles straight to Java bytecode so you can use it anywhere you can use Java

Grails is an open source web application framework which leverages the Groovy programming language (which is in turn based on the Java platform). It is intended to be a high-productivity framework by following the “coding by convention” paradigm, providing a stand-alone development environment and hiding much of the configuration detail from the developer.

Grails has been developed with a number of goals in mind:

  • Provide a high-productivity web framework for the Java platform.
  • Re-use proven Java technologies such as Hibernate and Spring under a simple, consistent interface
  • Offer a consistent framework which reduces confusion and is easy to learn.
  • Offer documentation for those parts of the framework which matter for its users.
  • Provide what users expect in areas which are often complex and inconsistent:
    • Powerful and consistent persistence framework.
    • Powerful and easy to use view templates using GSP (Groovy Server Pages).
    • Dynamic tag libraries to easily create web page components.
    • Good Ajax support which is easy to extend and customize.
  • Provide sample applications which demonstrate the power of the framework.
  • Provide a complete development mode, including web server and automatic reload of resources.

Grails has been designed to be easy to learn, easy to develop applications and extensible. It attempts to offer the right balance between consistency and powerful features.

WATIR

WATIR, pronounced “Water”, is an acronym standing for “Web Application Testing in Ruby”. Watir is a toolkit used to automate browser-based tests during web application development. This automated test tool uses the Ruby scripting language to drive the Internet Explorer web browser, and is available as a Ruby Gem.

Examples

The google example

# Here we see a very simple WATIR script to drive to google and validate a page

require ‘watir’                                                    # use watir gem

test_site = ‘http://www.google.com’             # set a variable

ie = Watir::IE.new                                           # open the IE browser

ie.goto(test_site)                                             # load url, go to site

ie.text_field(:name, “q”).set(”pickaxe”)          # load text “pickaxe” into search field named “q”

ie.button(:name, “btnG”).click                         # “btnG” is the name of the

# Search button, click it

if ie.text.include?(”Programming Ruby”)

puts “Test Passed. Found the test string: ‘Programming Ruby’.”

else

puts “Test Failed! Could not find: ‘Programming Ruby’”

end

The previous commands can be executed in the Interactive Ruby Shell (irb), or in a Ruby IDE such as FreeRIDE that is installed when Ruby is installed with the once click installer.

1> Controller Contains

public class testController extends MultiActionController {
public ModelAndView action_name1(HttpServletRequest httpServletRequest,HttpServletResponse httpServletResponse) {
System.out.println(”In Action1″);
return new ModelAndView(”view1″, “date”,”date”);
}

public ModelAndView action_name2(HttpServletRequest httpServletRequest,HttpServletResponse httpServletResponse) {
System.out.println(”In Action 2″);
return new ModelAndView(”view2″, “date”,”date”);
}
}
2> View contains

<a href=”test.htm?action=action_name1″ >Go to Action1 </a> |
<a href=”test.htm?action=action_name2″ >Go to Action2 </a>

3> Change in Application-servlet.xml

<bean name=”/test.htm” class=”testController”>
<property name=”methodNameResolver”>
<ref bean=”paramResolver”/>
</property>
</bean>

<bean id=”paramResolver” class=”org.springframework.web.servlet.mvc.multiaction.ParameterMethodNameResolver”>
<property name=”paramName”><value>action</value></property>
</bean>

Simple Way:

1> Controller Contains

same as above

2> View contains

<a href=”test.htm/action_name1″ >Go to Action1 </a> |
<a href=”test.htm/action_name2″ >Go to Action2 </a>

3> Change in Application-servlet.xml

No need to add anything

I have users table in  my database and If you want to take all user rows data into file, then execute below query..

SELECT id,user_name, address into OUTFILE  ‘d://userdbdump.txt’ FIELDS TERMINATED BY ‘,’ FROM users

Ultimate Truth

Whenever I find the key to success, someone changes the lock.


To Err is human, to forgive is not a COMPANY policy.


The road to success??.. Is always under construction.


Alcohol doesn’t solve any problems, but if you think again, neither does Milk.


In order to get a Loan, you first need to prove that you don’t need it.


All the desirable things in life are either illegal, expensive or fattening or married to someone else.


Since Light travels faster than Sound, people appear brighter before you hear them speak.


Everyone has a scheme of getting rich?.. Which never works.


If at first you don’t succeed?. Destroy all evidence that you ever tried.


You can never determine which side of the bread to butter. If it falls down, it will always land on the buttered side.


Anything dropped on the floor will roll over to the most inaccessible corner.


As soon as you mention something?? if it is good, it is taken?. If it is bad, it happens.


He who has the gold, makes the rules —- Murphy’s golden rule.


If you come early, the bus is late. If you come late?? the bus is still late.


Once you have bought something, you will find the same item being sold somewhere else at a cheaper rate.


When in a queue, the other line always moves faster and the person in front of you will always have the most complex of transactions.


If you have paper, you don’t have a pen??. If you have a pen, you don’t have paper?? if you have both, no one calls.


Especially for engg. Students—-
If you have bunked the class, the professor has taken attendance.


You will pick up maximum wrong numbers when on roaming.


The door bell or your mobile will always ring when you are in the bathroom.


After a long wait for bus no.20, two 20 number buses will always pull in together and the bus which you get in will be more crowded than the other.


If your exam is tomorrow, there will be a power cut tonight.


Irrespective of the direction of the wind, the smoke from the cigarette will always tend to go to the non-smoker

Older Posts »