Monthly Archives: October 2016

what’s the .nomedia file for?

A .nomedia file is a blank file placed inside a folder. When the media scanner detects the .nomedia file, the media scanner does not scan that folder so the images in that folder don’t appear in the Gallery app. It’s … Continue reading

Posted in Android | Leave a comment

enable developer options

Go to Android home screen. Pull down the notification bar. Tap “Settings” Tap “About Device” Tap on the “Build Number” button about 7 times. https://www.companionlink.com/support/kb/Enable_Android_USB_Debugging_Mode

Posted in Android | Leave a comment

basic

what is activity? single screen with a user interface just like window or frame of Java. layout <-> activity => ui logic associate with the ui presentation activity name activity layout (res->layout->activity_main.html) text field android:id=”@+id/edit_message” “+ ” -> define the … Continue reading

Posted in Android | Leave a comment

cart/product design

put obj or product id in the cart? – cw use obj – obj is big to transfer . much smaller compare with cw obj – not convenient if operate with product id, ie. need to parse them again – … Continue reading

Posted in Design | Leave a comment

use JSON in localstorage

localStorage only supports strings. Use JSON.stringify() and JSON.parse(). var names = []; names[0] = prompt(“New member name?”); localStorage.setItem(“names”, JSON.stringify(names)); //… var storedNames = JSON.parse(localStorage.getItem(“names”)); Unexpected token o in JSON at position =>Your data is already an object. No need to … Continue reading

Posted in Angularjs | Leave a comment

how to use method in another controller

http://stuff4j.blogspot.ca/2011/04/calling-controller-method-from-another.html Supposing I have a controller for books called BookController and a controller for authors called AuthorController and I want to remove a certain book when changing some author data: In AuthorController : // if some logic condition is met … Continue reading

Posted in Grails | Leave a comment

about shipping

key is to calculate the shipping fee manage address how to get all the province/city/district? web service to get price base on the from/to weight/size to submit the shipping request to retrieve the shipping status shipping company tell system that … Continue reading

Posted in Design | Leave a comment

access rest api within controller

add following as dependency in build.gradle compile ‘org.grails:grails-datastore-rest-client:5.0.0.RC2’ within controller import grails.plugins.rest.client.RestBuilder def rest = new grails.plugins.rest.client.RestBuilder() def resp =rest.get(ipUrl+ipAddr)

Posted in Grails | Leave a comment

browser to get the location

use ip to get it url sina: http://int.dpool.sina.com.cn/iplookup/iplookup.php?format=js&ip= taobao: http://ip.taobao.com/service/getIpInfo.php?ip= how to get ip of the localhost? can only get it from server side request.getRemoteAddr()

Posted in Design | Leave a comment

domain class removeFrom

to delete child instance of A, need to def a1 = A.get(1) def x1 = a1.xxx[0] a1.removeFromXxx(x1) => not removeFromYyy x1.delete() Class A{ static hasMany=[xxx:Yyy] } url http://spring.io/blog/2010/07/02/gorm-gotchas-part-2/

Posted in Grails | Leave a comment