JDeveloper 11g R2 hang on startup at “Restoring Editors”

Issue:

Issue before startup hang > JDeveloper hang sometime after it complaint out-of-memory for perm-size. Hence, it had been killed and restart.

Since then, it startup hang till “Restoring Editors”.

Solution:

Option1> Remove JDeveloper profile @ C:\Users\<Username>\AppData\Roaming\JDeveloper\system11.1.2.4.39.64.36.1\

and let JDeveloper init again

[drawback] all preference, svn, db connection, tpc setting will lost.

* Options2> Find out the problematic file @ C:\Users\<username>\AppData\Roaming\JDeveloper\system11.1.2.4.39.64.36.1\o.ide

– as from what I’d found out, it should be related to layout files as it hang on “restoring editors” stage.

[way tried]

1. Backup “windowinglayout” file

2. Startup JDeveloper (this should let JDeveloper startup successfully)

3. Close JDeveloper

4. Revert the backup “windowinglayout” file.

5. start again JDeveloper

– JDeveloper will start again but all project /application opened previously will need to re-open manually.

[drawback]

– Open project probably need to re-open again manually

[advantage]

– No loss in JDeveloper settings, preferences, etc.

set IP address manually in Synology NAS via command

1. “vi /etc/sysconfig/network-scripts/ifcfg-eth0”
With an example config below:
DEVICE=eth0
BOOTPROTO=static
ONBOOT=yes
IPADDR=<ip address>
NETMASK=<netmask eg.255.255.240.0>
2. After modifying IPADDR and NETMASK information, use the next command for changes to take effect.
“/etc/rc.network restart”

com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: The last packet successfully received from the server

06:47:59,966 WARN http-8880-1 spi.SqlExceptionHelper:143 – SQL Error: 0, SQLState: 08003
06:47:59,986 ERROR http-8880-1 spi.SqlExceptionHelper:144 – No operations allowed after connection closed.
SEVERE: >>org.springframework.orm.jpa.JpaSystemException: org.hibernate.exception.JDBCConnectionException: No operations allowed after connection closed.; nested exception is javax.persistence.PersistenceException: org.hibernate.exception.JDBCConnectionException: No operations allowed after connection closed.
>>javax.persistence.PersistenceException: org.hibernate.exception.JDBCConnectionException: No operations allowed after connection closed.
>>org.hibernate.exception.JDBCConnectionException: No operations allowed after connection closed.
>>com.mysql.jdbc.exceptions.jdbc4.MySQLNonTransientConnectionException: No operations allowed after connection closed.
>>com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: The last packet successfully received from the server was 127,349,486 milliseconds ago. The last packet sent successfully to the server was 127,349,487 milliseconds ago. is longer than the server configured value of ‘wait_timeout’. You should consider either expiring and/or testing connection validity before use in your application, increasing the server configured values for client timeouts, or using the Connector/J connection property ‘autoReconnect=true’ to avoid this problem.
>>java.net.SocketException: Broken pipe
>> at java.net.SocketOutputStream.socketWrite0(Native Method)
>> at java.net.SocketOutputStream.socketWrite(SocketOutputStream.java:109)

Reason:

DB default connection idle timeout = 8hrs

If Application idle with no DB transaction before the timeout, DB connection will be dropped.

Solution:

1. Create own connection pool, and keep alive checking

2. Append autoconnect option at end of DB connection string,

eg. <property name=”hibernate.connection.url” value=”jdbc:mysql://127.0.0.1/db?autoReconnect=true” /

* not recommended by MYSQL (ref: http://pages.citebite.com/p4x3a0r8pmhm)

3. use c3p0 connection provider_class

<property name=”hibernate.connection.provider_class” value=”org.hibernate.connection.C3P0ConnectionProvider”/>
<property name=”hibernate.c3p0.min_size” value=”5″/>
<property name=”hibernate.c3p0.max_size” value=”20″/>
<property name=”hibernate.c3p0.timeout” value=”1800″/>
<property name=”hibernate.c3p0.max_statements” value=”50″/>
<property name=”hibernate.c3p0.testConnectionOnCheckout” value=”true”/>

(ref: https://forum.hibernate.org/viewtopic.php?t=991039

http://blog.csdn.net/nethibernate/article/details/6658855)

* C3P0ConnectionProvider class locate in separate jar

<dependency>
			<groupId>org.hibernate</groupId>
			<artifactId>hibernate-c3p0</artifactId>
			<version>3.6.3.Final</version>
		</dependency>

Problem on installing Android usb driver in windows 8 64bit

Reason: Device not supported in usb driver provided by Android SDK

Solution: Find from Device vendor for signed driver or

find the device info and add it into usb driver file provided by Android SDK

example case for HTC Desire z:

1. open <androidSDK path>\sdk\extras\google\usb_driver\android_winusb.inf

– add lines:

;Desire Z
%SingleAdbInterface% = USB_Install, USB\VID_0BB4&PID_0C91
%CompositeAdbInterface% = USB_Install, USB\VID_0BB4&PID_0C91&MI_01

under section [Google.NTamd64] if  using 64bit or [Google.NTx86] if using 32bit

2. shutdown /r /o

– pick reboot with troubleshooting with advance option- startup setting

ref: http://www.howtogeek.com/131916/how-to-use-the-advanced-startup-options-to-fix-your-windows-8-computer/

– when boot up, choose option 7 i.e. disable signed check

– open windows explorer, browse to  <androidSDK path>\sdk\extras\google\usb_driver\ , right click on ‘android_winusb.inf’and click ‘install’

– connect android device via usb, and run “adb.exe devices” to confirm  it’s detected.

3. restart OS back to normal mode.

integrated weblogic cant create domain in Jdeveloper 11g release 2

platform: windows 8 64bit

jdk version: jdk6_34

Log:

wlst >
wlst > Failed to get environment, environ will be empty: (0, ‘Failed to execute command ([\’sh\’, \’-c\’, \’env\’]): java.io.IOException: Cannot run program “sh”: CreateProcess error=2, The system cannot find the file specified’)
wlst > Error: ADRS_DOMAIN_PASSWORD environment variable not set.

Reason: weblogic script wrongly identify OS platform, and use unix script which causing the problem.

Solution: patch jython-modules.jar in weblogic @ Middleware\wlserver_10.3\common\wlst\modules

step:

1. extract the jar

2. add new OS name at line 139 of  file:  javashell.py  inside [lib]

eg. _osTypeMap = (
( “nt”, ( ‘nt’, ‘Windows NT’, ‘Windows NT 4.0’, ‘WindowsNT’,
‘Windows 2000’, ‘Windows 2003’, ‘Windows XP’, ‘Windows CE’,
‘Windows Vista’, ‘Windows Server 2008’, ‘Windows 7’, ‘Windows 8’, ‘Windows_NT’ )),

reference :

http://www.oracle.com/technetwork/developer-tools/jdev/knownissues-097654.html#dep1

http://unversioned.blogspot.com/2012/12/jdevelopers-integrated-weblogic-on.html

javascript template engine compare

Google Closure Templates

+ Templates are compiled into JavaScript for client-side and Java for server-side.
+ Good built-in functionality: loops, conditionals, partials, i18n.
+ Documentation is enforced by the template.
– Very little usage outside of Google. No plans to push new versions or accept new contributions.
– Some functionality is missing, such as being able to loop over maps.
– Not DRY: adding new functionality requires implementing plugins in both Java and JavaScript.
Mustache

+ Very popular choice with a large, active community.
+ Server side support in many languages, including Java.
+ Logic-less templates do a great job of forcing you to separate presentation from logic.
+ Clean syntax leads to templates that are easy to build, read, and maintain.
– A little too logic-less: basic tasks (e.g. label alternate rows with different CSS classes) are difficult.
– View logic is often pushed back to the server or implemented as a “lambda” (callable function).
– For lambdas to work on client and server, you must write them in JavaScript.
Handlebars

+ Logic-less templates do a great job of forcing you to separate presentation from logic.
+ Clean syntax leads to templates that are easy to build, read, and maintain.
+ Compiled rather than interpreted templates.
+ Better support for paths than mustache (ie, reaching deep into a context object).
+ Better support for global helpers than mustache.
– Requires server-side JavaScript to render on the server.
Dust.js

+ Logic-less templates do a great job of forcing you to separate presentation from logic.
+ Clean syntax leads to templates that are easy to build, read, and maintain.
+ Compiled rather than interpreted templates.
+ Better support for paths than mustache (ie, reaching deep into a context object).
+ Better support for global helpers than mustache.
+ Inline parameters.
+ Blocks & inline partials.
+ Overriding contexts.
+ Support for asynchronous rendering and streaming.
+ Composable templates.
– Requires server-side JavaScript to render on the server.
– Maintainer of github repo is not responsive.
The Winner: Dust.js

Based on our evaluation and how we prioritized the requirements, dust.js came out as the winner. It was the option that offered the most features and flexibility while keeping the view code DRY, clean, and fast.
Despite some claims to the contrary, we found that for any non-trivial view, none of the templating options worked well across client and server unless the server could also execute JavaScript. Therefore, we’ve been experimenting with Rhino (check out the sample code) and Node.js (check out the sample code) as server-side JavaScript options.
As we roll client-side templates out to more of the site, we have been making tweaks and additions to dust that we hope to contribute back to the open source community. Expect another blog post about that in the future.

ref: http://engineering.linkedin.com/frontend/client-side-templating-throwdown-mustache-handlebars-dustjs-and-more

why return JSON object is undefine by calling function?

script :

$(document).ready(function() {

var userdata = getData();
};
function getData() {
var udata;
$.getJSON(‘../json/user.json’, function(data) {
udata = data;
});

};

Reason:  $.getJSON (   is async, which it might run later than it call getData();

Solution 1:  disable async

$(document).ready(function() {
var userdata = getData();
};

function getData() {
var udata;
$.ajax({
async: false,
url: ‘../json/user.json’,
dataType: ‘json’,
success: function(response) {
udata = response;
}
});
};
——————

Solution 2:  pass in callback
$(document).ready(function() {
getData(function(data) {
});
};

function getData() {
$.getJSON(‘../json/user.json’, callback, function(udata) {});
};

ref: http://stackoverflow.com/questions/4546339/jquery-assign-json-as-a-result-to-a-variable