android 自動版本更新

http://blog.csdn.net/xjanker2/article/details/6303937 有非常重要的重點: *****請先下載Config.java和NetworkTool.java兩個程式,放到對應的java目錄下。 https://code.google.com/p/androidex/source/browse/trunk/jtapp-12-updateapksamples/#jtapp-12-updateapksamples%2Fsrc%2Fjtapp%2Fupdateapksamples *****UpdateActivity.java 是主程式,把對應的程式碼改到你的程式,其中要注意的是,程式碼中的UpdateActivity請記得要換成你自己的名稱….我也是被搞了一下~~哈 *****為什麼在模擬器中,更新會不能安裝,找到的文章解釋 http://stackoverflow.com/questions/19959890/android-app-not-install-an-existing-package-by-the-same-name-with-a-conflicting the APK installed in the Emulator is signed with your debug-key(usually installed in ~/.android/debug.keystore) 因為key不同,但實際上,如果建置完畢的話,更新是不會有這問題。目前確實成功。 發生錯誤: NetworkTool.java 中 HttpResponse response = client.execute(new HttpGet(url)); 會發生 ERROR : android.os.NetworkOnMainThreadException 解決方式: 方法一:/設定可以讓Thread運行在Android主要Thread/ http://stackoverflow.com/questions/16439587/android-os-networkonmainthreadexception-with-android-4-2 在 HttpResponse response = client.execute(new HttpGet(url)); 之前放上 if (android.os.Build.VERSION.SDK_INT > 9) { StrictMode.ThreadPolicy policy = new StrictMode.ThreadPolicy.Builder().permitAll().build(); StrictMode.setThreadPolicy(policy); } 並 import android.os.StrictMode; 方法二: etwork problem的問題我試了,是HTTPClient的部份不能在UI Thread做,寫一個extend AsyncTask的class讓HTTPClient的部份在background做就可以了 http://givemepass.blogspot.com/2011/12/http-server.html =========================== 第二個問題:寫檔在sd上 在AVD建的時候要加上SD卡的容量 在 AndroidManifest.xml 補上 於 9月 26, 2014

2014-09-26 · 1 min · 76 words · Me

android studio

http://save-coco.blogspot.com/2014/07/maven-eclipseandroid-app.html Maven 據說很難用…功能強大,很難用 http://blog.csdn.net/wangwei_cq/article/details/17070307 Gradle 現在用這個 http://www.codedata.com.tw/java/understanding-gradle-3-getting-started/ http://ithelp.ithome.com.tw/question/10129873 http://jdev.tw/blog/3513/learning-android-studio ===================== setup 1: onclick http://www.youtube.com/watch?v=RCyuqMVGl4g TextView mytv = (TextView)findViewById(R.id.textView); mytv.setText(“change textView!”); ===================== setup 2: export a

2014-09-25 · 1 min · 25 words · Me

ruby sinatra admin login rack--two way

http://www.sinatrarb.com/faq.html require 'sinatra' helpers do def protected! return if authorized? headers['WWW-Authenticate'] = 'Basic realm="Restricted Area"' halt 401, "Not authorized\n" end def authorized? @auth ||= Rack::Auth::Basic::Request.new(request.env) @auth.provided? and @auth.basic? and @auth.credentials and @auth.credentials == ['admin', 'admin'] end end get '/' do "Everybody can see this page" end get '/protected' do protected! "Welcome, authenticated client" end http://www.highdots.com/forums/ruby-rails-talk/logging-out-rake-auth-basic-284054.html LOGIN FORM (GET LOGIN METHOD) <form method="post" action="/login"> <p><label>Username</label><input name="post[username]" /></p> <p><label>Password</label><input name="post[password]" type="password"/></p> <p><button type="submit">Login</button></p> </form> POST LOGIN METHOD post '/login' do if authenticate(params["post"]["username"], Digest::MD5.hexdigest(params["post"]["password"])) session[:user] = params["post"]["username"] flash[:notice] = "Login succeeded!" redirect '/admin' else flash[:error] = "Login failed!" redirect '/login' end end HELPER METHODS # Authentication is hard-coded as there will only 1-3 users def authenticate(username, password) if username == 'admin' and password == '[admin_password_in_MD5]' return true else return false end end # Protect pages def login_required if session[:user] return true else redirect '/login' return false end end # Get the username of the logged in user def current_user if session[:user] session[:user] end end # Verify if a user is logged in def logged_in? !!session[:user] end

2014-09-25 · 1 min · 173 words · Me

jQuery Mobile and AngularJS Working Together

http://simonguest.com/2013/04/08/jquery-mobile-and-angularjs-working-together/ http://0not.net/index.php/using-angularjs-and-jquery-mobile/ At the bottom of body, load AngularJS and then jQM Use jQM for routing (which is the default, as long as you don’t include ngRoute)

2014-09-21 · 1 min · 27 words · Me

StrongLoop begin

http://docs.strongloop.com/display/LB/LoopBack+2.0+release+notes http://docs.strongloop.com/display/LB/Project+layout+reference http://docs.strongloop.com/pages/viewpage.action?pageId=3836281 https://github.com/strongloop/loopback-example-app this is new loopback example, need to look at this example, can understand how to work loopback. if see “slc lb”, the mean is old loopback 1.0, so don’t need to see. https://github.com/strongloop/loopback-example-passport http://passportjs.org/guide/oauth/ I try many, so now I think loopback 2.0….is too new, many docs is not correct. Maybe furture is good or ok, but now for develpoer is no good….

2014-09-15 · 1 min · 67 words · Me