Posts

Showing posts from 2013

Hibernate - specifying multiple packageToScan in configuration

After placing my hibernate entity in a different jar file, i notice that some of my tables are not created. Finally i figureout that it has to do with my hibernate configuration, specifically packageToScan attribute.

With this i can specify multiple jar files that host my hibernate entities (table).

Dynamic Jasper Report Maven

If you want to find out maven repository for Dynamic Jasper and the home page info sounds confusing, try here. In short, what you need to define on your pom.xml is as follows

Copied from Dynamic Jasper link for easy reference only.


fdvsolution.publichttp://archiva.fdvs.com.ar/repository/public1/
And the dependency is shown below :


Compiling Plaid for Window

I don't know why am i even compiling Plaid for, maybe it can be a cool language to try out. Anyway, the site documentation works, just that there are a few glitches that i need to handle when compiling for Windows.

As stated in the documentation, go

1. Grab TortoiseSVN

2. Check out the source https://code.google.com/p/plaid-lang/, into a directory of your likings, let's say c:\java\plaid

3. Include the followings in your path : C:\java\plaid\fastbuilder;C:\java\plaid;

4. Goto C:\java\plaid\tests and run ant build.


You should be able to compile successfully.

Building spark is easy

I was amazed how easy it is to build Spark on Windows. Just have to

1. Download and install Scala 2.9.2. Ensure your SCALA_HOME is accurately setup.
2. Also make sure you have javac available in your environment path.
3. Download spark (0.7.0). Spark uses sbt (simple build tool and it is shipped together with the code.

After you extracted spark source code, goto the root folder and run

sbt/sbt package
And you're done! Awesome.

Jquery UI Tab causes Ajax Options null exception

When you are loading your jquery UI tab in your browser and at the same time you enable your firebug, you might run into this problem - ajax options is null.

No immediate fixes, just gotta turn off your firebug during jquery ui tab loading process. :(

Spring MVC ExceptionHandler gets easier.

Spring MVC exception handling gets easier with @ControllerAdvice with the release of Spring 3.2.1.

You can annotate your class as shown below and add a method to handle exception


@ControllerAdvice
public class AppCoreController
{
@ExceptionHandler(Exception.class)
public @ResponseBody RequestStatus handleException(Exception exception)
{
RequestStatus errorStatus = new RequestStatus();
errorStatus.setMessageCode(-999);
errorStatus.setMessageDescription(exception.getMessage());
return errorStatus;
}
}


Please note that RequestStatus is a custom controller and yeap we are returning an class / object type as oppose to just String data type. 
These add exception handling capabilities to all your existing controller. 

Error FAKEROOTKEY set to 818929733

When i was trying to compile linux kernel, i bump into the following issue, 

fakeroot: FAKEROOTKEY set to 818929733 
fakeroot: nested operation not yet supported

Turn out that i was actually running root on top of my username. :D 
To fix this, just type "exit" to get out of the root mode and execute fakeroot command again. 

Knockoutjs markup evaluation is javascript like

Lets say you have an observable called "totalRecordCount" and using the following code to evaluate if a markup should be visible.

data-bind="visible : $index < $root.totalRecordCount"

All these will be evaluated to false, until .........

data-bind="visible : $index() < $root.totalRecordCount()"

Seems like evaluation falls back pretty much to traditional javascript evaluation.




Navigating around jstree

Here are some methods that you probably need to know to work with jstree.


1. Get the currently selected node

var treeDivControlName = "myJsTree";

var selectedNode = $('#'+ treeDivControlName).jstree('get_selected');

2. Get the path from root to the currently selected node 

var parents = $("#" + treeDivControlName).jstree("get_path", selectedNode);

3. Creating a  new node in your tree 

$("#" + treeDivControlName).jstree("create", selectedNode, "inside", newNode.node);

4. Removing the currently selected node 

$("#" + treeDivControlName).jstree("remove", null);  // null will remove the currently selected node

Working with JsTree : Create a tree

jstree is one of the most popular javascript tree user control around.  However, using it is not so straight forward. Let's go ahead and create your first jsTree. There are several ways to create a jstree either through HTML or via JSON. This is really just a matter of loading the proper plugin. Think of plugin as feature for your jstree.


Please include jquery and jquery.jstree.js in your page. The code sample below show how to create a simple jsTree, JSON way.


$("#" + treeDivControlName).jstree({
"json_data" : {
"data" : [
c1.node, c2.node, companyNode.node
]
},
"plugins" : [ "themes", "json_data", "ui", "checkbox", "crrm", "contextmenu" ]
}).bind("select_node.jstree", function (e, data)
{
 alert(data.rslt.obj.data("id") +  ":" + data.rslt.obj.data("nodeType"));
});



`
Check out the plugin section - you can see we have checkbox, contextmenu. These are …