This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // | |
| // ViewController.swift | |
| // Demo | |
| // | |
| // Created by mountain on 2017/01/23. | |
| // Copyright © 2017年 mountain. All rights reserved. | |
| // | |
| import UIKit | |
| import AVFoundation |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // | |
| // UIKit001ViewController.swift | |
| // | |
| import UIKit | |
| class UIKit001ViewController: UIViewController { | |
| override func viewDidLoad() { | |
| super.viewDidLoad() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| //Save | |
| SharedPreferences sharedPrefs = PreferenceManager.getDefaultSharedPreferences(context); | |
| Editor editor = sharedPrefs.edit(); | |
| Gson gson = new Gson(); | |
| String json = gson.toJson(arrayList); | |
| editor.putString(TAG, json); | |
| editor.commit(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| AWSCredentials credentials = new BasicAWSCredentials("YOUR_ACCESSKEY", "YOUR_SECRETKEY"); | |
| kinesisClient = new AmazonKinesisClient(credentials); | |
| kinesisClient.setEndpoint("ENDPOINT_URL"); | |
| final String myStreamName = "myFirstStream"; | |
| // Write 10 records to the stream | |
| for (int j = 0; j < 1; j++) { | |
| PutRecordRequest putRecordRequest = new PutRecordRequest(); | |
| putRecordRequest.setStreamName(myStreamName); | |
| putRecordRequest.setData(ByteBuffer.wrap(this.createLog().getBytes())); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| //http://help.adobe.com/ja_JP/FlashPlatform/reference/actionscript/3/flash/data/EncryptedLocalStore.html | |
| var str:String = "Bob"; | |
| var bytes:ByteArray = new ByteArray(); | |
| bytes.writeUTFBytes(str); | |
| EncryptedLocalStore.setItem("firstName", bytes); | |
| var storedValue:ByteArray = EncryptedLocalStore.getItem("firstName"); | |
| trace(storedValue.readUTFBytes(storedValue.length)); // "Bob" | |
| EncryptedLocalStore.removeItem("firstName"); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/sh | |
| DIR=$(dirname "$0") | |
| FILE=files.txt | |
| for f in `cat $DIR/$FILE`; do | |
| echo $DIR/$f; | |
| done |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // prepare parameters | |
| Map<String, String> reqParams = new HashMap<String, String>(); | |
| //... | |
| //Volley JsonObjectRequest | |
| JsonObjectRequest json = new JsonObjectRequest(Method.POST,"http://your.domain.here/",reqParams, | |
| new Listener<JSONObject>(){ | |
| public void onResponse(JSONObject result) { | |
| } | |
| }, new Response.ErrorListener() { | |
| public void onErrorResponse(VolleyError error) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public static VolleyError parseVolleyError(String TAG, VolleyError volleyError) { | |
| if (volleyError.networkResponse != null && volleyError.networkResponse.data != null) { | |
| VolleyError error = new VolleyError(new String( | |
| volleyError.networkResponse.data)); | |
| volleyError = error; | |
| } | |
| Log.e(TAG, volleyError.getMessage()); | |
| return volleyError; | |
| } |