I love stackoverlow.com. Easy to find a solution for my problem. Uncluttered user interface. I like their vote up button.
Saturday, July 28, 2012
Saturday, July 7, 2012
Sencha's GPL3 licensing too restrictive
After reviewing Sencha's Open Source FAQ, I feel their interpretation of GPL3 licensing is too restrictive. Let us say, I am using Sencha ExtJs to build a public website, then my website source code will become a derived work. If I use the GPL3 license, then I have to distribute the entire source code of my website, including the back-end code. Another common scenario is using ExtJS in an intranet application. Here too, GPL3 license can not be used, as it excludes contractors from accessing the application. It seems like Sencha's GPL licensing will only work for open source projects. All others have go with their commercial license.
Reference
Fiddler Web Debugging Proxy
Today, I came to know about Fiddler. It is a great tool to inspect http requests and responses. I wanted to verify if a REST call is returning the json header correctly or not. Fiddler came in handy.
http://www.fiddler2.com/fiddler2/
http://www.fiddler2.com/fiddler2/
Friday, July 6, 2012
Install Guice Module
- If using,
play 2.0.2, add
"com.typesafe" % "play-plugins-guice" % "2.0.3"
to your build.scala file. For play 2.0.1, add"com.typesafe" % "play-plugins-guice" % "2.0.2"
to your build.scala file. - Create a file called
play.plugins
in yourapp/conf
directory - Add
1500:com.typesafe.plugin.inject.GuicePlugin
- Re-run eclipsify command from the play prompt. Initially, I didn't know that I have to do this, and I was struggling for several hours.
- Then define Dependency class in module package and inject the service. That's it
Dependencies.java
package module;
import com.google.inject.*;
import service.*;
public class Dependencies implements Module {
public void configure(Binder binder) {
binder.bind(Service.class).to(SomethingService.class);
}
}
Application.java
import javax.inject.*;
import service.*;
public class Application extends Controller {
@Inject static Service s;
public static Result index() {
return ok(index.render(s.demonstrate()));
}
return ok(index.render(s.demonstrate()));
}
}
Evaluating Logical Expressions
Today, I used Java 6 Scripting API to evaluate logical expressions. Here is an example:
}
}
//result will be trueimport javax.script.*; public class EvalScript { public static void main(String[] args) throws Exception { // create a script engine manager ScriptEngineManager factory = new ScriptEngineManager(); // create a JavaScript engine ScriptEngine engine = factory.getEngineByName("JavaScript"); // evaluate JavaScript code from String Boolean result=(Boolean)engine.eval("'sometext'=='sometext'");
}
}
Reference
Labels:
Java
Getting Started with Play
Create a java project
- Download the latest play 2.0 zip from http://playframework.org
- Extract the zip file to a convenient location. Usually, I extract and put it in my c:\, so that it is easily accessible from the command prompt.
- Add the play framework path in your PATH environment variable.
- Open command prompt and 'cd' to your project folder.
- Enter 'play new learn-play' from your project folder (where learn-play is the name of your first project).
- This will prompt for what language template. Pick option 2, which is 'simple java application'
- This will create a simple java application template. Look for 'OK, application learn-play is created. Have Fun!' message.
Run your application
- Open command prompt and 'cd' to your project folder. Then 'cd' to learn-play folder.
- Run 'play' from the command prompt.
- This will show the '[learn-play]$' command prompt.
- Enter 'run'
- This will run the play application in development mode.
- From the browser enter 'http://localhost:9000' will run the application.
Create Eclipse Project
- From the play '$' prompt, enter command 'eclipsify'
- This will create an eclipse project.
- From eclipse, right click and choose Import->Existing Projects into Workspace and browse to your lean-play folder.
- This will open your learn-play project.
- Whenever you install a new module, you have to re-run the 'eclipsify' command
Reference
Subscribe to:
Posts (Atom)