When ADB works but FastBoot does not…
I faced a very embarassing situation: trying to root my Nexus S, I had to unlock the device. My Android SDK was succesfully installed, the drivers too. The device was succesfully recognized by ADB… But fastboot devices
failed to detect the device. From this point, it was impossible to unlock the device by launching fastboot oem unlock
. I tried many basic solutions, but none worked.
At last, I found this post:
http://forum.xda-developers.com/showthread.php?t=875580
When ADB works but not FastBoot, the solution is to… install PdaNet. Amazing ; but efficient.
Many thanks to BigRick10 from XDA forums!
Useful XSD
Following the post on widely used DTDs, here is a list of some XSD (aka XML Schemas):
File | XSD |
---|---|
Maven pom.xml |
[xml]<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">[/xml] |
weblogic.xml |
[xml]<weblogic-web-app xmlns="http://www.bea.com/ns/weblogic/weblogic-web-app" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.bea.com/ns/weblogic/weblogic-web-app http://www.bea.com/ns/weblogic/weblogic-web-app/1.0/weblogic-web-app.xsd">[/xml] |
Maven assembly.xml |
[xml]<assembly xmlns="http://maven.apache.org/xsd/1.1.0/assembly" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/xsd/assembly-1.1.2.xsd http://maven.apache.org/xsd/1.1.2/assembly">[/xml] |
web.xml |
[xml]<web-app version="2.4" xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">[/xml] |
EhCache |
[xml]<web-app version="2.4" xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">[/xml] |
Scrum Methodology Training – English/Hindi
One month ago, I trained an Indian team, located in Mumbai, on Scrum methology.
Here are the slides of the presentation. It is mainly in English, but with a bit of Hindi in order to please the Indian attendees 😉
The presentation is hosted by Google Docs, under Creative Commons CC-by-cc licence.
Useful DTD
DTDs are useful when your XML editor take them in account: detecting errors, suggestions, complete statements… For instance, I save much time with IntelliJ IDEA automatic completion ; unlike, Eclipse amazingly does not implement this feature.
Here is a list of some widely used DTDs:
File | DTD |
---|---|
weblogic-application.xml |
[xml]<!DOCTYPE weblogic-application PUBLIC "-//BEA Systems, Inc.//DTD WebLogic Application 7.0.0//EN" "http://www.oracle.com/technology/weblogic/weblogic-application/1.1/weblogic-application.xsd">[/xml] |
weblogic-application.xml |
[xml]<!DOCTYPE weblogic-application PUBLIC "-//BEA Systems, Inc.//DTD WebLogic Application 7.0.0//EN" "http://www.oracle.com/technology/weblogic/weblogic-application/1.1/weblogic-application.xsd">[/xml] |
web.xml |
[xml]<!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN" "http://java.sun.com/dtd/web-app_2_3.dtd" >[/xml] |
*.hbm.xml |
[xml]<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">[/xml] |
GWT modules |
[xml]<!DOCTYPE module SYSTEM "http://google-web-toolkit.googlecode.com/svn/trunk/distro-source/core/src/gwt-module.dtd">[/xml] |
GWT UI |
[xml]<!DOCTYPE ui:UiBinder SYSTEM "http://dl.google.com/gwt/DTD/xhtml.ent">[/xml] |
Tangosol / Oracle Coherence |
[xml]<!DOCTYPE coherence SYSTEM "coherence.dtd">[/xml] |
Log4J |
[xml]<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">[/xml] |
Tangosol and Log4J DTDs are included within their distribution JARs: you have to extract them or to give their path to IntelliJ IDEA.
How to emulate Android GingerBread on your PC?
This post describes how to install and play with a emulator of GingerBread (Android 2.3) device on your desktop (or laptop) computer:
- go to this page, download Android SDK related to your system.
- unzip / install it, let’s say in
$android-sdk-home
- launch Android SDK Manager (with
$android-sdk-home\SDK Manager.exe
under Windows,$android-sdk-home/android
on other systems) - on the left panel, select
Available Packages
, and selectAndroid Repository
packages you would like to install, and possibly other third party add-ons. - go to Virtual Devices >
- New >
- give a name, for instance “GingerBread” >
- Target “Android 2.3.3…” >
- SD Car Size: 2MiB >
- leave other options >
- Create AVD
- wait a little…
- still in Virtual Devices panel, select the AVD you have just created (called hereGingerBread) > Start
- wait… a lot
- enjoy!
EDIT: I could not resist and I have installed HoneyComb, too 😉
How to enable JMX in WebLogic?
Case
You have to enable JMX in an application deployed within WebLogic, so that to access MBeans from Java Visual VM for instance
Solution
On launching WebLogic server instance, add the following properties:
[java]-Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.port=8888 -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.authenticate=false[/java]
How to include a dependency to tools.jar in Maven?
Case
You need include tools.jar
as a dependency in a pom.xml, for instance in order to use Java 5’s annotations and APT. From a “Maven’s view point”, tools.jar
is not a regular JAR defined by a groupId
and artefactId
.
Solution
Add this block in your pom.xml
:
[xml]<dependency>
<groupId>com.sun</groupId>
<artifactId>tools</artifactId>
<version>1.6.0_24</version>
<scope>system</scope>
<systemPath>${java.home}/../lib/tools.jar</systemPath>
</dependency>[/xml]
(You can also add it in your settings.xml
)
You can do the same for any other “non-regular” JAR, available in your file system.
java.sql.SQLException: Wrong data type: NUMBER in statement [CREATE TABLE … (… NUMBER]
Case
In a JDBC DAO, I execute a query to retrieve an object. I get this error:
[java]java.sql.SQLException: Wrong data type: NUMBER in statement [CREATE TABLE Jonathan_Table (TableColumn NUMBER][/java]
Stacktrace
[java]java.sql.SQLException: Wrong data type: NUMBER in statement [CREATE TABLE Jonathan_Table (TableColumn NUMBER]
at org.hsqldb.jdbc.Util.throwError(Unknown Source)
at org.hsqldb.jdbc.jdbcPreparedStatement.executeUpdate(Unknown Source)
at com.bnpp.pb.risklayer.services.dao.jdbc.JdbcPrimeRiskServerDaoUnitTest.getDataSet(JdbcPrimeRiskServerDaoUnitTest.java:57)
at org.dbunit.DatabaseTestCase.setUp(DatabaseTestCase.java:154)[/java]
Explanation and fix
My original DB is under Oracle, but my DBUnit tests works on HSQL. Yet, types NUMBER
and VARCHAR2
are not available under HSQL, this is why the exception is raised.
To fixe the issue, rewrite your scripts, replacing NUMBER
and VARCHAR2
with NUMERIC
and VARCHAR
.
Table … not found in tableMap=org.dbunit.dataset.OrderedTableNameMap[_tableNames=[], _tableMap={}, _caseSensitiveTableNames=false]
Case
On a unit test with JDBC / DBUnit, extending org.dbunit.DBTestCase
, I get this error:
[java]Table ‘Jonathan_Lalou_Table’ not found in tableMap=org.dbunit.dataset.OrderedTableNameMap[_tableNames=[], _tableMap={}, _caseSensitiveTableNames=false][/java]
Explanation and fix
Indeed, even when you provide a dataset through a flat XML file, DBUnit does not create the tables, but only fills them in. I know, this is paradoxal and most developpers would like to create implicitly the tables prior to filling them…
To fix the issue, add a block like this one, for instance when overriding the method getDataSet()
:
[java]final PreparedStatement preparedStatement;
preparedStatement = getDatabaseTester().getConnection().getConnection().prepareStatement("CREATE TABLE Jonathan_Lalou_Table … ");
preparedStatement.executeUpdate();[/java]
GWT / Sonar / Cannot invoke clone() on the array type… / The user-supplied array … is stored directly
I have to fix all critical “Violations” owing to Sonar.
Let’s consider a basic block:
[java] public void setSushis(float[] sushis) {
this.sushis = sushis;
}[/java]
This piece of code raises this error in Sonar:
[java] Security – Array is stored directly : The user-supplied array ‘sushis’ is stored directly.[/java]
In a naive step, I modified the code as this:
[java] public void setSushis(float[] sushis) {
this.sushis = sushis.clone();
}[/java]
This may have been OK… but, now, I get the following error within GWT compilation:
[java]Cannot invoke clone() on the array type float[][/java]
To fix the issue, I amended the code as follows:
[java] public void setSushis(float[] theSushis) {
this.sushis= new float[theSushis.length];
System.arraycopy(theSushis, 0, this.sushis, 0, theSushis.length);
}[/java]
Disclaimer: even though I followed Sonar’s advice and requirements, I am a little skeptic about this kind of “violation”. 😐