기본 콘텐츠로 건너뛰기

2018의 게시물 표시

Android, HttpURLConnection, file parameter

-- Not confirmed -- confirmed just 1 file parameter. public static void sendMultipart(HttpURLConnection connection, String[] filefield, File[] filepath, Map<String, String> textdata) throws IOException {         final String twoHyphens = "--";         final String boundary =  "*****"+ UUID.randomUUID().toString()+"*****";         final String lineEnd = "\r\n";         final int maxBufferSize = 1024*1024*3;         DataOutputStream outputStream;         connection.setDoInput(true);         connection.setDoOutput(true);         connection.setUseCaches(false);         connection.setRequestMethod("POST"); //        connection.setRequestProperty("Connection", "Keep-Alive");         connection.setRequestProperty("Content-Type", "multipart/form-data; boundary="+boundary);         outputStream = new DataOutputStream(connection.getOutputStream());         if(filefield != null) {

Android, iOS style radio button

***** flatdesign_radiobutton_left.xml <?xml version="1.0" encoding="utf-8"?> <selector xmlns:android="http://schemas.android.com/apk/res/android"> <item android:state_checked= "false"> <shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle"> <solid android:color="@color/white"/> <stroke android:width="1dp" android:color="#7F7F7F"/> <padding android:bottom="5dp" android:left="5dp" android:right="1dp" android:top="5dp"/> <corners android:bottomLeftRadius="7dp" android:bottomRightRadius="0dp" android:topLeftRadius="7dp"

Android, HttpURLConnection

*** implementation new Thread(new Runnable() { public void run() {     HashMap params = new HashMap();           params.put("param1", "1");     HttpURLConnection connection = null;           try {         URL url = new URL("http://xxxxx.com/api/xxxx");                    connection = (HttpURLConnection)url.openConnection();         connection.setRequestMethod("POST");         connection.setRequestProperty("Accept", "application/json");         connection = ConnectionManager.setParams(connection, params);             connection.connect();             Integer responseCode  = connection.getResponseCode();             if (responseCode == HttpURLConnection.HTTP_OK) {             activity.runOnUiThread(new Runnable(){                 @Override                 public void run() {                     //refresh GUI                 }                     });             }         }catch(Exception e){         e.printStackTrace();       }f

Android, InputStream to JSON

public static JSONObject getInputStreamToJSON (InputStream inputStream) throws Exception { BufferedReader streamReader = new BufferedReader( new InputStreamReader(inputStream , "UTF-8" )) ; StringBuilder responseStrBuilder = new StringBuilder() ; String inputStr ; while ((inputStr = streamReader.readLine()) != null ) responseStrBuilder.append(inputStr) ; JSONObject jsonObject = new JSONObject(responseStrBuilder.toString()) ; //returns the json object return jsonObject ; }

iOS, NSURLSession, NSURLConnection depracated

*** NSURLConnection -> NSURLSession https://qiita.com/akitaika_/items/2f4fca20a82cb6895329 *** NSURLResponse.expectedContentLength == -1 [ request setValue :@ "identity" forHTTPHeaderField :@ "Accept-Encoding" ]; https://stackoverflow.com/questions/23834151/nsurlconnection-expectedcontentlength-returns-1 *** NSURLConnection sendSynchronousRequest NSURLSession * session = [ NSURLSession sharedSession ]; [[ session dataTaskWithURL :[ NSURL URLWithString : londonWeatherUrl ] completionHandler :^( NSData * data , NSURLResponse * response , NSError * error ) { // handle response }] resume ]; https://stackoverflow.com/questions/32643207/ios9-sendsynchronousrequest-deprecated *** NSURLConnection(procedure method) -> NSURLSession (Blocked method)   https://tennmemo.blogspot.com/2018/11/objc-method-wait-block-finish.html

Android, SDK 26 upgrade

org.apache.http is deprecated. > HttpUrlConnection - 301 error } else if ( responseCode == HttpURLConnection . HTTP_MOVED_PERM || responseCode == HttpURLConnection . HTTP_MOVED_TEMP ){ // redirectionのため String redirectedUrl = connection . getHeaderField ( "Location" ); // do connect one more with redirectedUrl } http://love4rh.blogspot.com/2013/05/httpurlconnection-301-302.html

Git remote

*** make git Remote directory > pwd /Users/usr1/remoteRepository > git init --bare project1.git *** add Remote > git remote add origin /Users/usr1/remoteRepository/project1.git *** remove Remote > git remote rm origin https://www.iexplain.org/using-git-with-google-drive-a-tutorial/

iOS, release, check before [Upload to App Store...]

***  Missing App Store Icon - iOS Apps must include a 1024x1024px App Store Icon in PNG format. Images.xcassets > AppIcon -> add [1024pt App Store iOS] icon ***  Missing Info.plist key - This app attempts to access privacy-sensitive data without a usage description. Info.plist add [Privacy - Bluetooth Peripheral Usage Description][This app requires bluetooth access to function properly.]

kotlin, Spinner

val spinner = Spinner( this ) var list_of_items = arrayOf ("item1", "item2", "item3" ) val array_adapter = ArrayAdapter( this , android.R.layout. simple_spinner_item , list_of_items) array_adapter.setDropDownViewResource(android.R.layout. simple_spinner_dropdown_item ) spinner. adapter = array_adapter spinner. onItemSelectedListener = object : AdapterView.OnItemSelectedListener { override fun onItemSelected(parent: AdapterView<*>, view: View, pos: Int, id: Long) { //todo : do something } override fun onNothingSelected(parent: AdapterView< out Adapter>?) {} }

XCode, 複数の開発環境

親PC 1. ビルド(Archive)できるXCodeのPC 2. Key Chain Access > 証明証 + 証明証のキー(▶︎を押下し表示)を一緒に選ぶ > 書き出し(p12証明証) 新しいPC 1. p12証明証開く (書き出す時、パスワードを設定してたら、入力) 2. provisioning開く 3. Build(Archive) http://stpsysdev.blogspot.jp/2015/09/macios.html

Android, ImageView, Animated GIF

build.gradle dependencies { compile 'com.github.bumptech.glide:glide:3.6.1' } val fireView = findViewById<ImageView>(R.id. fireView_display ) val target = GlideDrawableImageViewTarget(fireView) Glide.with( this ).load(R.raw. giphy ).into(target) ref :  https://qiita.com/maehara08/items/eef63804c52b2e0bb404

Android, GPUImage, get image filtered

- set Uri, get bitmapWithFilterApplied --> NG : NPE var imageUri : Uri? = data?. data val gpuImage = GPUImage( this ) gpuImage.setImage( imageUri ) gpuImage.setFilter(GPUImageColorInvertFilter()) mainImageView ?.setImageBitmap(gpuImage. bitmapWithFilterApplied ) - set Bitmap, get bitmapWithFilterApplied --> OK val gpuImage = GPUImage( this ) val editedImage : BitmapDrawable = mainImageView ?. drawable as BitmapDrawable gpuImage.setImage(editedImage. bitmap ) gpuImage.setFilter(GPUImageColorInvertFilter()) mainImageView ?.setImageBitmap(gpuImage. bitmapWithFilterApplied )

iOS, Swift, back button

- prev ViewController -- add @IBAction func myExit(sender : UIStoryboardSegue ){ } - storyboard -- add button --- drag button to Exit(3rd icon upper menu) ref :  https://m.blog.naver.com/PostView.nhn?blogId=jdub7138&logNo=220393890771&proxyReferer=https%3A%2F%2Fwww.google.co.jp%2F

iOS, Swift, AVPlayerViewController, test

- add framework -- AVKit.framework -- AVFoundation.framework - Bulid Phases -- Copy Bundle Resources --- add movie clip (a.mp4) - storyboard -- add ViewController (AVPlayerViewController) --- create new AVPlayerViewController and link - add code override func viewDidLoad(){         super . viewDidLoad ()         if let bundlePath = Bundle . main . path (forResource: "a" , ofType: "mp4" ) {                           print ( "bundlePath \ ( bundlePath )" )                          let videoPlayer = AVPlayer (url: URL (fileURLWithPath: bundlePath))             self . player = videoPlayer                           videoPlayer. play ()           }          /*         // streaming                  let bundlePath = URL(string: videoClipUrlStr )         print("bundlePath \(bundlePath)")                  let videoPlayer = AVPlayer(url: bundlePath!)         self.player = videoPlayer