Visited esnips.com and created a playlist with MS songs
http://esnips.com
Monday, December 8, 2008
Sunday, August 17, 2008
The power of love
I heard this moving story today from Papa. One day a snake came to his third floor apartment at 11 pm in the night. He went to his friend, Friday Alva on the second floor asking for help.
Begum Akthtar ghazals
Poet William Blake
"To see a world in a grain of sand
and a heaven in a wildflower
Hold infinity in the palm of your hand
and eternity in an hour?"
I was reminded of this line which I thought Carl Sagan
had said once, in this ghazal I heard yesterday,
by Begum Akhtar.
rang-e-bahaar-e-subah-e-gulistaa.N kyaa dekhe vo diivaanaa
jis kii nazar ne ek hii gul me.n saaraa gulashan dekhaa hai
I was talking to Bhabhiji on the phone and she mentioned this line
and at the same moment, I was listening to it on the computer,
it was so surreal
mere ham_nafas mere ham_navaa mujhe dost ban ke daGaa na de
uzr aane me.n bhii hai aur bulaate bhii nahii.n
Friday, August 15, 2008
Tuesday, August 12, 2008
Lessons from the Batman movie "The Dark Knight"
I recently saw the Batman movie "The Dark Knight". It had the biggest box office opening ever. The synopsis is there is a madman who proves that all of us have evil inside us and if it is given a nudge, it will come out and make us do wrong things. He proves to Batman that one should not be righteous and feel smug that he is better than criminals just because he did not commit crimes. Under the wrong (right) circumstances, even the best of the best will become worst of the worst. Batman decides to take the fall and not reveal to the masses that the madman was right. He thinks the masses cannot "handle the truth". The sound byte is " Sometimes people do not need the truth, they want their faith rewarded".
Here I think that Batman is not the savior, in shielding the people from the truth, he is doing them the biggest disservice. He is choosing to not learn from the lesson he was just taught. In spiritual terms, life presents to you the same lessons again and again until you learn from them. By choosing to not learn from it, he will make the people of Gotham go through lot of pain again and again.
This is very poignant. This is the very reason the fight between good and evil goes on. The "good" side is self righteous and not willing to concede that the "evil" side has a point. It thinks if it concedes, it will become like one of "them". The "evil" side wants respect from the "good" side and if does not get it, it becomes more of what it is. The same hold true for the "good" side. It wants to get respect from the "evil" side.
The key to life is not being "good" or being "evil" but in balance. You have to know what you are standing for, but not forget that there are always two sides of a coin. There is another perspective which is "equally valid" and by acknowledging it, you do not negate your values.
Here I think that Batman is not the savior, in shielding the people from the truth, he is doing them the biggest disservice. He is choosing to not learn from the lesson he was just taught. In spiritual terms, life presents to you the same lessons again and again until you learn from them. By choosing to not learn from it, he will make the people of Gotham go through lot of pain again and again.
This is very poignant. This is the very reason the fight between good and evil goes on. The "good" side is self righteous and not willing to concede that the "evil" side has a point. It thinks if it concedes, it will become like one of "them". The "evil" side wants respect from the "good" side and if does not get it, it becomes more of what it is. The same hold true for the "good" side. It wants to get respect from the "evil" side.
The key to life is not being "good" or being "evil" but in balance. You have to know what you are standing for, but not forget that there are always two sides of a coin. There is another perspective which is "equally valid" and by acknowledging it, you do not negate your values.
Sunday, July 27, 2008
Eckhart Tolle
Reading the book A New Earth today.
I want to note 4 things which appealed to me.
I want to note 4 things which appealed to me.
- The most important lesson is the secret J. Krishnamurti shared in his speech " I do not mind whatever happens."
- E. T shares a story of someone who responds to everything with "Is that so?" There is non-judgement in it.
- Another story is of a wise man who responds with "Maybe yes, maybe not."
- The last 1 is of the ring on the emperor's hand with engraving of "This too shall pass" to remind of the transient nature of things.
Friday, July 25, 2008
AllTestSuite.java
/*
* Copyright 2003-2007 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package groovy.util;
import groovy.lang.GroovyClassLoader;
import groovy.lang.Script;
import junit.framework.Test;
import junit.framework.TestSuite;
import org.codehaus.groovy.control.CompilationFailedException;
import org.codehaus.groovy.runtime.ScriptTestAdapter;
import java.io.File;
import java.io.IOException;
import java.util.Collection;
import java.util.Iterator;
import java.util.logging.Logger;
/**
* AllTestSuite can be used in extension of GroovyTestSuite to execute TestCases written in Groovy
* from inside a Java IDE.
* AllTestSuite collects all files below a given directory that comply to a given pattern.
* From these files, a TestSuite is constructed that can be run via an IDE graphical Test runner.
* The files are assumed to be Groovy source files and be either a TestCase or a Script that can
* be wrapped transparently into a TestCase.
* The directory and the pattern can be set via System properties (see this classes' constants for details.)
*
* When setting the loglevel of this class to FINEST, all file loading will be logged.
*
* See also groovy.util.AllTestSuiteTest.groovy
* @author Dierk Koenig based on a prototype by Andrew Glover
* @author Paul King
* todo: dk: make FileNameFinder injectable
*/
public class AllTestSuite extends TestSuite {
/** The System Property to set as base directory for collection of Test Cases.
* The pattern will be used as an Ant fileset include basedir.
* Key is "groovy.test.dir".
* Default value is "./test/".
*/
public static final String SYSPROP_TEST_DIR = "groovy.test.dir";
/** The System Property to set as the filename pattern for collection of Test Cases.
* The pattern will be used as Regular Expression pattern applied with the find
* operator against each candidate file.path.
* Key is "groovy.test.pattern".
* Default value is "Test.groovy".
*/
public static final String SYSPROP_TEST_PATTERN = "groovy.test.pattern";
/** The System Property to set as a filename excludes pattern for collection of Test Cases.
* When non-empty, the pattern will be used as Regular Expression pattern applied with the
* find operator against each candidate file.path.
* Key is "groovy.test.excludesPattern".
* Default value is "".
*/
public static final String SYSPROP_TEST_EXCLUDES_PATTERN = "groovy.test.excludesPattern";
private static final Logger LOG = Logger.getLogger(AllTestSuite.class.getName());
private static final ClassLoader JAVA_LOADER = AllTestSuite.class.getClassLoader();
private static final GroovyClassLoader GROOVY_LOADER = new GroovyClassLoader(JAVA_LOADER);
private static final String[] EMPTY_ARGS = new String[]{};
private static IFileNameFinder finder = null;
static { // this is only needed since the Groovy Build compiles *.groovy files after *.java files
try {
Class finderClass = Class.forName("groovy.util.FileNameFinder");
finder = (IFileNameFinder) finderClass.newInstance();
} catch (Exception e) {
throw new RuntimeException("Cannot find and instantiate class FileNameFinder", e);
}
}
public static Test suite() {
String basedir = System.getProperty(SYSPROP_TEST_DIR, "./test/");
String pattern = System.getProperty(SYSPROP_TEST_PATTERN, "**/*Test.groovy");
String excludesPattern = System.getProperty(SYSPROP_TEST_EXCLUDES_PATTERN, "");
return suite(basedir, pattern);
}
public static Test suite(String basedir, String pattern) {
return suite(basedir, pattern, "");
}
public static Test suite(String basedir, String pattern, String excludesPattern) {
AllTestSuite suite = new AllTestSuite();
String fileName = "";
try {
Collection filenames = excludesPattern.length() > 0
? finder.getFileNames(basedir, pattern, excludesPattern)
: finder.getFileNames(basedir, pattern);
for (Iterator iter = filenames.iterator(); iter.hasNext();) {
fileName = (String) iter.next();
LOG.finest("trying to load "+ fileName);
suite.loadTest(fileName);
}
} catch (CompilationFailedException e1) {
e1.printStackTrace();
throw new RuntimeException("CompilationFailedException when loading "+fileName, e1);
} catch (IOException e2) {
throw new RuntimeException("IOException when loading "+fileName, e2);
}
return suite;
}
protected void loadTest(String fileName) throws CompilationFailedException, IOException {
Class type = compile(fileName);
if (!Test.class.isAssignableFrom(type) && Script.class.isAssignableFrom(type)) {
addTest(new ScriptTestAdapter(type, EMPTY_ARGS));
} else {
addTestSuite(type);
}
}
protected Class compile(String fileName) throws CompilationFailedException, IOException {
return GROOVY_LOADER.parseClass(new File(fileName));
}
}
/*
* Copyright 2003-2007 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package groovy.util;
import groovy.lang.GroovyClassLoader;
import groovy.lang.Script;
import junit.framework.Test;
import junit.framework.TestSuite;
import org.codehaus.groovy.control.CompilationFailedException;
import org.codehaus.groovy.runtime.ScriptTestAdapter;
import java.io.File;
import java.io.IOException;
import java.util.Collection;
import java.util.Iterator;
import java.util.logging.Logger;
/**
* AllTestSuite can be used in extension of GroovyTestSuite to execute TestCases written in Groovy
* from inside a Java IDE.
* AllTestSuite collects all files below a given directory that comply to a given pattern.
* From these files, a TestSuite is constructed that can be run via an IDE graphical Test runner.
* The files are assumed to be Groovy source files and be either a TestCase or a Script that can
* be wrapped transparently into a TestCase.
* The directory and the pattern can be set via System properties (see this classes' constants for details.)
*
* When setting the loglevel of this class to FINEST, all file loading will be logged.
*
* See also groovy.util.AllTestSuiteTest.groovy
* @author Dierk Koenig based on a prototype by Andrew Glover
* @author Paul King
* todo: dk: make FileNameFinder injectable
*/
public class AllTestSuite extends TestSuite {
/** The System Property to set as base directory for collection of Test Cases.
* The pattern will be used as an Ant fileset include basedir.
* Key is "groovy.test.dir".
* Default value is "./test/".
*/
public static final String SYSPROP_TEST_DIR = "groovy.test.dir";
/** The System Property to set as the filename pattern for collection of Test Cases.
* The pattern will be used as Regular Expression pattern applied with the find
* operator against each candidate file.path.
* Key is "groovy.test.pattern".
* Default value is "Test.groovy".
*/
public static final String SYSPROP_TEST_PATTERN = "groovy.test.pattern";
/** The System Property to set as a filename excludes pattern for collection of Test Cases.
* When non-empty, the pattern will be used as Regular Expression pattern applied with the
* find operator against each candidate file.path.
* Key is "groovy.test.excludesPattern".
* Default value is "".
*/
public static final String SYSPROP_TEST_EXCLUDES_PATTERN = "groovy.test.excludesPattern";
private static final Logger LOG = Logger.getLogger(AllTestSuite.class.getName());
private static final ClassLoader JAVA_LOADER = AllTestSuite.class.getClassLoader();
private static final GroovyClassLoader GROOVY_LOADER = new GroovyClassLoader(JAVA_LOADER);
private static final String[] EMPTY_ARGS = new String[]{};
private static IFileNameFinder finder = null;
static { // this is only needed since the Groovy Build compiles *.groovy files after *.java files
try {
Class finderClass = Class.forName("groovy.util.FileNameFinder");
finder = (IFileNameFinder) finderClass.newInstance();
} catch (Exception e) {
throw new RuntimeException("Cannot find and instantiate class FileNameFinder", e);
}
}
public static Test suite() {
String basedir = System.getProperty(SYSPROP_TEST_DIR, "./test/");
String pattern = System.getProperty(SYSPROP_TEST_PATTERN, "**/*Test.groovy");
String excludesPattern = System.getProperty(SYSPROP_TEST_EXCLUDES_PATTERN, "");
return suite(basedir, pattern);
}
public static Test suite(String basedir, String pattern) {
return suite(basedir, pattern, "");
}
public static Test suite(String basedir, String pattern, String excludesPattern) {
AllTestSuite suite = new AllTestSuite();
String fileName = "";
try {
Collection filenames = excludesPattern.length() > 0
? finder.getFileNames(basedir, pattern, excludesPattern)
: finder.getFileNames(basedir, pattern);
for (Iterator iter = filenames.iterator(); iter.hasNext();) {
fileName = (String) iter.next();
LOG.finest("trying to load "+ fileName);
suite.loadTest(fileName);
}
} catch (CompilationFailedException e1) {
e1.printStackTrace();
throw new RuntimeException("CompilationFailedException when loading "+fileName, e1);
} catch (IOException e2) {
throw new RuntimeException("IOException when loading "+fileName, e2);
}
return suite;
}
protected void loadTest(String fileName) throws CompilationFailedException, IOException {
Class type = compile(fileName);
if (!Test.class.isAssignableFrom(type) && Script.class.isAssignableFrom(type)) {
addTest(new ScriptTestAdapter(type, EMPTY_ARGS));
} else {
addTestSuite(type);
}
}
protected Class compile(String fileName) throws CompilationFailedException, IOException {
return GROOVY_LOADER.parseClass(new File(fileName));
}
}
Subscribe to:
Posts (Atom)