Background Our application needs to play mp3 files served by our server. What we used to do is just using MediaPlayer to play that URL. However, there are more and more customers complaint about Music playing being cut off quite frequently. So I had to dig into legacy codes to find out the reason. Reproduce From existing codebase, I could tell our app respects MediaPlayer's OnErrorListener and if MediaPlay throw out any Error, app will try to catch them and recover. Unfortunately, we did not receive any exceptions for this part according to our Fabric crashlytics report. Besides that, this bug is not really easy to reproduce. I knew it must be caused by user's network issue. So I tried Charles proxy and using its throttling feature. However it seems like MediaPlayer would have a special connection after connecting and Charles' throttling can not control that connection. Then I also tried Android Emulator's build-in network status simulation feature. Sti...
Recently we decided to move our git repo to local git server so we chose GitLab. During weeks use GitLab it was really convenient. Until one day we have a thought about checking code style before push. Basically Git support 2 kinds of hooks. One is Client side and the other is from Server side http://git-scm.com/book/en/Customizing-Git-Git-Hooks In terms of checking code style we can do both on Client and Server side. However we want this rules be more STRICT :D, so we decided to make it from Server side . So here is problem! After investigation we found GitLab actually changed quite a lot from Gitorious. Especially Gitlab uses Gitlab-Shell to wrapper the Git commands. So when we found "Hooks" folder what we can get is like this: ONLY ONE "UPDATE" . If you open it you will found quite simple codes: So check GitlabUpdate in ../lib/ And if you change the codes to exit with "1", all the push request will be rejecte...
I really like to use Jackson library to parse json string. Just now met a problem org.codehaus.jackson.JsonParseException: Illegal unquoted character ((CTRL-CHAR, code 10)): has to be escaped using backslash to be included in string value The reason is my string contains some newline symbols. Then actually the string is not "valid" or "formatted" Json . Finally I found one quick solution . try { JSONObject b = new JSONObject ( decodedPayload ); decodedPayload = b . toString (); } catch ( JSONException e ) { e . printStackTrace (); } That JSONObject can formatted that unformatted json string . Might be there are some other better solution.
Comments
Post a Comment