顯示具有 errorRecords 標籤的文章。 顯示所有文章
顯示具有 errorRecords 標籤的文章。 顯示所有文章

2014年1月27日 星期一

[Javascript] trim() is not working in IE8

Error Message

Object doesn’t support this property or method


Solution

1. replace

str.replace(/^\s+|\s+$/g,"")


2. jQuery:

$.trim("str");



* Reference
. trim()

2014年1月7日 星期二

[JPA] PersistentObjectException: detached entity passed to persist: xxx.xxx

Error Message

PersistentObjectException: detached entity passed to persist: xxx.xxx


Solution

拿掉 @OneToOne 的 cascade attribute


2013年12月8日 星期日

[Android] The library 'xxxx.jar' contains native libraries that will not run on the device.

Error

[2013-11-22 15:34:58 - group] Installation failed due to invalid APK file!
[2013-11-22 15:34:58 - group] Please check logcat output for more details.
[2013-11-22 15:34:58 - group] Launch canceled!
[2013-11-22 16:02:45 - group] The library 'xxxx.jar' contains native libraries that will not run on the device.
[2013-11-22 16:02:45 - group] The following libraries were found:
[2013-11-22 16:02:45 - group] - assets/xxxx.so


Solution

jar library 中不能包含 .so 檔

可放入 project assets/


* Reference
http://www.v-key.com/solutions/v-guard/
http://www.cnblogs.com/mengshu-lbq/archive/2011/11/19/2255566.html

2013年9月2日 星期一

[SQL] ORA-00937:非單組分組函數

Error

ORA-00937:非單組分組函數


Solution

如果 select 了一個分組函數,其它也必須是分組函數,否則就出錯。這是語法規定的

ex:

select min(sal), max(sal) from emp;



* Reference
- 韓順平老師Oracle教程筆記——網摘_StackDoc

[Android] The key must be an application-specific resource id.

Error

E/AndroidRuntime(15393): java.lang.IllegalArgumentException: The key must be an application-specific resource id.


Solution

新增 id resource

使用此 resource 作為 key 以確定為 unique.


[Web] enum form value

Error

<form:radiobutton value="enum type object">

post 時發生 mistypematched exception



Solution

<form:radiobutton value="enum.toString">

因為 enum 會被 toString


http param string <-> enum name


2013年8月25日 星期日

[Android] rating bar size

Error

使用 minHeight and maxHeight 會切掉星星。


Solution

android:scaleX="0.8"
android:scaleY="0.8"

可以縮小 但效果不佳 難以控制位置

最好的方式 直接使用希望呈現的大小圖片



* Reference
- How to set the custom size of the stars in RatingBar
- android ratingbar size

[Android] tag requires a 'drawable' attribute or child tag defining a drawable

Error Message

想在 selector 中使用顏色做為 drawable

<item> tag requires a 'drawable' attribute or child tag defining a drawable


Solution

要放在 /res/color/list_item_selector.xml



   
   
   
   





[Android] Could not open Selected VM debug port (8700). Make sure you do not have another instance of DDMS or of the eclipse plugin running....

Error Message

Could not open Selected VM debug port (8700). Make sure you do not have another instance of DDMS or of the eclipse plugin running. If it's being used by something else, choose a new port number in the preferences.



Solution

Window -> Preferences -> Android -> DDMS

- Set Base local debugger port to "8601"
- Check the box that says "Use ADBHOST" and the value should be "127.0.0.1"


[Android] The connection to adb is down, and a severe error has occured....

Error Message

The connection to adb is down, and a severe error has occured.
You must restart adb and Eclipse.
Please ensure that adb is correctly located at 'D:\sdk\platform-tools\adb.exe' and can be executed.


Solution

找到工作管理員中的 adb.exe 執行中的 process
關閉 adb.exe
重啟 eclipse



* Reference
- Android故障排除_The connection to adb is down, and a severe error has occured.
- Android : The Connection To Adb Is Down, And A Severe Error Has Occurred.

[SQL] ORA-00932: 不一致的資料類型: 應該是 -, 但為 CLOB

Error Message

ORA-00932: 不一致的資料類型: 應該是 -, 但為 CLOB



Solution

當 field type is lob

可以寫

... where field like xxxx

但不能寫成

... where field = xxxx




[Android] Installation error: INSTALL_FAILED_MISSING_SHARED_LIBRARY

Error Message

Installation error: INSTALL_FAILED_MISSING_SHARED_LIBRARY


Solution

在 local 設定 external build path 使用 library xxxx

並在 AndroidManifest.xml 宣告

<uses-library android:name="xxxx">

使用系統上共用的 library.


[Spring] Neither BindingResult nor plain target object for bean name ''

Error Message

RequestContextAwareTag.java org.sprin
rk.web.servlet.tags.RequestContextAwareTag.doStartTag(RequestContextAwareTag.java:86) ERROR - Neither BindingResult nor plain target object fo
ame 'loginForm' available as request attribute
java.lang.IllegalStateException: Neither BindingResult nor plain target object for bean name 'loginForm' available as request attribute
at org.springframework.web.servlet.support.BindStatus.(BindStatus.java:141)
............
............
............



Solution

因為沒有指定 jsp form modelAttribute 所對應的物件

ex:

// Controller
public String login(Map model) {
model.put("login", new new LoginForm());
}


// JSP
<form:form method="POST" modelattribute="login">


* Reference
- Neither BindingResult nor plain target object for bean name available as request attribute
- Spring MVC – Neither BindingResult Nor Plain Target Object For Bean Name ‘Xxx’ Available As Request Attribute.

2013年1月31日 星期四

[Android] Errors when sign projecct

Failure [INSTALL_PARSE_FAILED_INCONSISTENT_CERTIFICATES]

重新 sign 前 沒有刪掉以下檔案 安裝時便會發生此錯誤。

\META-INF\CERT.RSA
\META-INF\CERT.SF


jarsigner: unable to open jar file: test.apk

沒有找到 test.apk。


jarsigner: unable to sign jar: java.util.zip.ZipException: invalid entry compressed size (expected 483 but got 480 bytes)

要 sign 的檔案已經 sign 過。

2013年1月26日 星期六

[Android] get system values when reboot

Error Message

若是 livewallpaper app

重開機時 取到的 system values 會是 0 (ex: imei, iccid...)



Solution

若已設定 livewallpaper 然後重開機

在開機中 system 便會呼叫 livewallpaper

此時所取到的 system values 便會是 0

可等接收到 BOOT_COMPLETED action 後 再去取 便能取到正確值

或是判定為 SIM_STATE_READY 才將取到的值視為有效值


飛安模式 -> SIM_STATE_UNKNOWN -> 取不到

關閉網路 -> SIM_STATE_READY -> OK


測試中(HTC One V) 轉換飛安模式和一般模式的行為 會使得物件等被清除

仍不確定是否依手機而異 與影響範圍

2013年1月21日 星期一

[Web] object from request parameters

Error Message

ERROR - [Ljava.lang.String; cannot be cast to java.lang.String
java.lang.ClassCastException: [Ljava.lang.String; cannot be cast to java.lang.String


Solution

注意使用的物件 type,Map<String, String[]> or Map<String, String>。


Map<String, String[]> requestParameters = request.getParameterMap();
Map<String, String> parameters = new Map<String, String>();
for(String key: requestParameters.keySet())  {
    parameters.put(key, requestParameters.get(key)[0]);
}

[JPA] EntityNotFoundException

Error Message

javax.persistence.EntityNotFoundException: Unable to find ObjectA with id ObjectB.


Solution

join ObjectA 時,對應不到 ObjectA 時會發生該 exception。

Using @NotFound(action = NotFoundAction.IGNORE)

optional="tru|false"
表示該屬性是否允許為 null,預設為 true。


* Reference
- Annotation Type NotFound
- @Basic(fetch=FetchType,optional=true)
- @NotFound(action=NotFoundAction.IGNORE)

2013年1月20日 星期日

[ibatis] object type in

Error Message

com.ibatis.sqlmap.client.SqlMapException: ParameterObject or property was not a Collection, Array or Iterator.

Solution

<iterator property="Object">

property 只能放入 type Collection, Array or Iterator.


2013年1月19日 星期六

[Android] Process has died

Error Message

12-28 11:25:03.191: I/ActivityManager(1614): Process com.package.name (pid 17766) has died.



Testing

  • Register BroadcastReceiver in ServiceA will not active when process is died but except register in manifest.
  • If create ServiceA in another process(android:process) and BroadcastReceiver will be create in this process, too.
    • So that even though process of activity that creates service is died service will not died immediately.


2013年1月6日 星期日

[JPA] Unable to find column with logical name COLUMNNAME in table TABLENAME

Error Message
Unable to find column with logical name COLUMNNAME in table TABLENAME


Solution
若 A join B,則 B 必須被宣告在 A 之前。


<persistence-unit>
    <class>B</class>
    <class>A</class>
</persistence-unit>