aniol 神話四核 與 kindle app 運行不良的問題

現時最新版的 kindle app 4.1.1.1, 在神話四核上不能運行, crash 退出.

可以在 N多市場(網上)下載舊版, 3.8.2.4, 放在 SD card 內 . . . → Read More: aniol 神話四核 與 kindle app 運行不良的問題

Android add wifi profile for static programmatically

First of all, the Full Android project for download.

WifiSetting

Simply desc the code.  MainActivity.saveWepConfig(String ssid, String password) adding the Wifi Profile

This version is for WPA, and setting the password to wc.preSharedKey, for WEP, password will store at wc.wepKeys[0], and setting the wc.wepTxKeyIndex=0.

The allowXXX.set, can accept multiply set, just set all the choice is OK.

WifiManager wifi = (WifiManager) getSystemService(Context.WIFI_SERVICE);
WifiConfiguration . . . → Read More: Android add wifi profile for static programmatically

Debug a Android program when it running (ie, for service debugging)

First of all, compile you APK in debug mode true, you can done by

change the AndroidManifest.xml, add “android:debug=’true’”, at (somewhere ^.^) application.
[I use this] Use ant build, compile your APK use “ant debug”

Connect your device to PC, and try “adb devices” to find if your device connect normally.

Install your APK to device, and start the program.

Start . . . → Read More: Debug a Android program when it running (ie, for service debugging)

解决: org.springframework.beans.factory.BeanNotOfRequiredTypeException办法

错误信息:

org.springframework.beans.factory.BeanNotOfRequiredTypeException: Bean named ‘aisleService’ must be of type [com.gdie.whlocation.service.impl.AisleService], but was actually of type [$Proxy38]

这个问题出现的原因:一般在使用annotation的方式注入spring的bean 出现的,具体是由于spring采用代理的机制导致的,看使用的代码:

1. 使用类注入:
@Resource(name = “aisleService”)
private AisleService aisleService;
2. 使用接口注入:
@Resource(name = “aisleService”)
private IAisleService aisleService;

代码1不能使用JDK的动态代理注入,原因是jdk的动态代理不支持类注入,只支持接口方式注入;

代码2可以使用jdk动态代理注入;

. . . → Read More: 解决: org.springframework.beans.factory.BeanNotOfRequiredTypeException办法

strange character add at jsp <%@include %>

Just do the very simple thing at a JRun server, and there are something like,

<%@ include file=”top.inc” %>

for including the header and footer.

But find that there are some strange “white space” add before the the included code, and broken the layout.

At last, find that there are the BOM of the UTF-8 file, and use Notepad++, change . . . → Read More: strange character add at jsp <%@include %>

Eclipse 中文亂碼的問題

問題
1/ 在 Eclipse 的 properties file 不能 save 有中文的 file.
2/ 顯示不正確 (亂碼).

一、设置代码的编码格式:
1/ Eclipse-->Window-->Preferences-->General-->Content Types然后在选择
右边的Text下边的Java Properties File,修改其编码(推荐UTF-8)。
之後restart Eclipse.

2/
有时候大家也许会看到这个错误:Save could not be completed. Reason: some characters cannot be mapped using “ISO-8859-1“ character encoding
这个错误是因为你的文件格式是ISO-8859-1,右键点击报错文件->选择Properties->Text
file enconding->把ISO-8859-1改为UTF-8或者GBK就解决这个问题了。
这是因为Eclipse默认的文件格式都是ISO-8859-1,那如果大量文件该怎么办呢?我们不会一个一个手动改吧?答案是NO。
方法如下:

(選用, 不是必要)
二、编辑器字体(全体,包括PyDev、cdt、jdt的编辑器)
Eclipse-->Window-->Preferences-->General-->Appearance--> Colors and Fonts -->Basic --> Text Font-->Change 喜欢哪个就选哪个字体。

3. 在 eclipse 的 directory, 修改 . . . → Read More: Eclipse 中文亂碼的問題

Grails to use individual ivy cache location

Since developing Grails and other Java use the same Ivy Cache location, sometime will cause problem, ie, the exception of Class loading for SAXParseException, other class loading problem.

To give the Grails another location for Ivy cache some is need.

For using command line, edit the file <GRAIL_HOME>\bin\startGrails.bat

add

set JAVA_OPTS=%JAVA_OPTS% -Divy.default.ivy.user.dir=”c:\grails\.ivy2″

to the same location for adding JAVA_OPTS.

Continue reading Grails to use individual ivy cache location

Putty + AppLocale to connect a server of LANG=zh_CN.GB18030 at win7

In one word, Applocale is still work at win7

(In another word, AppLocale is still need at win7)

But when install the AppLocale, first Right click the installer and at the “Compatibly”, change to Preview Version, then install as normal.

Use AppLocale to start the putty, connect with following setting,

Change setting -> Window -> Appearance -> Font: 細明體

Change setting . . . → Read More: Putty + AppLocale to connect a server of LANG=zh_CN.GB18030 at win7

spring mvc list all error without

<spring:bind path=”cc.*”>
    <div>
    <table>
  <c:forEach items=”${status.errors.allErrors}” var=”error”>
    <tr>
     <td>${error.field }</td>
     <td style=”color: #888;”>${error.code}</td>
    </tr>
  </c:forEach>
  </table>      
    </div>
</spring:bind>

where “cc” is the model attribute name.

Inside the <spring:bind> tag,

status – object of org.springframework.web.servlet.support.BindStatus
status.errors – object . . . → Read More: spring mvc list all error without

Merge icon into sprites by ImageMagick

montage 001*.png -alpha on -background “#ffffff00″ -tile 10x -
geometry 16×16+4+4 ../sprites16.png

Where
001*.png, icons image file
10x, 10 columns for each row (ie, x1 mean 1 row)
16×16+4+4, resize icon to 16×16, and the margin 4 pixel between each other
sprites16.png, the . . . → Read More: Merge icon into sprites by ImageMagick