아이오닉 프로젝트의 ionic.config.json을 열어보면
'아이오닉' 카테고리의 다른 글
플랫폼 추가 및 빌드 (0) | 2017.09.14 |
---|---|
xml parser (0) | 2017.08.01 |
http (0) | 2017.08.01 |
nativieStorage (0) | 2017.08.01 |
아이오닉 프로젝트의 ionic.config.json을 열어보면
플랫폼 추가 및 빌드 (0) | 2017.09.14 |
---|---|
xml parser (0) | 2017.08.01 |
http (0) | 2017.08.01 |
nativieStorage (0) | 2017.08.01 |
플랫폼 추가 및 빌드 (0) | 2017.09.14 |
---|---|
proxy 설정 (0) | 2017.08.01 |
http (0) | 2017.08.01 |
nativieStorage (0) | 2017.08.01 |
app.module.ts에 import { HttpModule } from '@angular/http'; 임포트 후
imports: [
BrowserModule,
HttpModule,
],
추가
요청할 소스에
import { Http, Headers, RequestOptions, URLSearchParams } from '@angular/http';
constructor(public http:Http) {
}
connect() {
var url = "http://url";
var headers = new Headers();
headers.append('Access-Control-Allow-Headers', 'Content-Type');
headers.append('Access-Control-Allow-Methods', 'POST');
headers.append('Access-Control-Allow-Origin', '*');
let options = new RequestOptions({ headers: headers });
//포스트로 전달할 값을 담는다
let data = new URLSearchParams();
data.append("key", "value");
data.append("key", "value");
//url과 포스트로 넘길 값
this.http.post(url, data)
.subscribe(data => {
console.log("data.text == > " + data.text());
}, error => {
console.log("error == > " + error.text());// Error getting the data
});
}
플랫폼 추가 및 빌드 (0) | 2017.09.14 |
---|---|
proxy 설정 (0) | 2017.08.01 |
xml parser (0) | 2017.08.01 |
nativieStorage (0) | 2017.08.01 |
ionic cordova plugin add cordova-plugin-nativestorage
npm install --save @ionic-native/native-storage
app.module.ts 에 import { NativeStorage } from '@ionic-native/native-storage'; 임포트를 한 후에
providers에 NativeStorage 등록
nativeStorage.setItem("key", "value");
nativeStorage.get("key").then(
data => console.log(data),
error => console.error(error)
)
플랫폼 추가 및 빌드 (0) | 2017.09.14 |
---|---|
proxy 설정 (0) | 2017.08.01 |
xml parser (0) | 2017.08.01 |
http (0) | 2017.08.01 |
// 실제 경로 찾기
private String getPath(Uri uri)
{
String[] projection = { MediaStore.Images.Media.DATA };
Cursor cursor = managedQuery(uri, projection, null, null, null);
int column_index = cursor.getColumnIndexOrThrow(MediaStore.Images.Media.DATA);
cursor.moveToFirst();
return cursor.getString(column_index);
}
// 파일명 찾기
private String getName(Uri uri)
{
String[] projection = { MediaStore.Images.ImageColumns.DISPLAY_NAME };
Cursor cursor = managedQuery(uri, projection, null, null, null);
int column_index = cursor
.getColumnIndexOrThrow(MediaStore.Images.ImageColumns.DISPLAY_NAME);
cursor.moveToFirst();
return cursor.getString(column_index);
}
// uri 아이디 찾기
private String getUriId(Uri uri)
{
String[] projection = { MediaStore.Images.ImageColumns._ID };
Cursor cursor = managedQuery(uri, projection, null, null, null);
int column_index = cursor.getColumnIndexOrThrow(MediaStore.Images.ImageColumns._ID);
cursor.moveToFirst();
return cursor.getString(column_index);
}
출처: http://susemi99.tistory.com/890 [쎄미 - 우물쭈물하다가 내 이럴 줄 알았지]
actionbar 공통으로 사용하기 (0) | 2017.10.10 |
---|---|
화면 가로, 세로 고정 (0) | 2017.10.10 |
AsyncTask httpConnection (0) | 2016.12.27 |
안드로이드 웹뷰 자동회전 리로드 방지 (0) | 2016.11.04 |
ArrayList 정렬 (0) | 2016.10.07 |
HashMap<String, String> hashMap = new HashMap<>();
hashMap.put("key", "value"); // post로 넘길 값을 맵에 담아 넘김
HttpCon httpCon = new HttpCon(url, hashMap);
try {
String result = httpCon.execute().get();
Log.e(TAG, "result -- > " + result);
} catch (InterruptedException e) {
e.printStackTrace();
} catch (ExecutionException e) {
e.printStackTrace();
}
public class HttpCon extends AsyncTask<Void, Void, String> {
private static final String TAG = "HttpCon";
String url = "";
HashMap<String, String> hash = new HashMap<>();
public HttpCon(String _url, HashMap<String, String> _hash){
url = _url;
hash = _hash;
}
@Override
protected String doInBackground(Void... voids) {
URL Url;
String result = "";
try {
Url = new URL(url); // URL화 한다.
HttpURLConnection conn = (HttpURLConnection) Url.openConnection(); // URL을 연결한 객체 생성.
conn.setRequestMethod("POST"); // get방식 통신
conn.setDoOutput(true); // 쓰기모드 지정
conn.setDoInput(true); // 읽기모드 지정
conn.setUseCaches(false); // 캐싱데이터를 받을지 안받을지
conn.setDefaultUseCaches(false); // 캐싱데이터 디폴트 값 설정
OutputStream os = conn.getOutputStream(); // 서버로 보내기 위한 출력 스트림
BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(os, "UTF-8")); // UTF-8로 전송
bw.write(getPostString(hash)); // 매개변수 전송
bw.flush();
bw.close();
os.close();
InputStream is = conn.getInputStream(); //데이타를 받기위 구멍을 열어준다
StringBuilder builder = new StringBuilder(); //문자열을 담기 위한 객체
BufferedReader reader = new BufferedReader(new InputStreamReader(is,"UTF-8")); //문자열 셋 세팅
String line;
while ((line = reader.readLine()) != null) {
builder.append(line+ "\n");
}
result = builder.toString();
// Log.e(TAG, "result -- > " + result);
conn.disconnect();
} catch (ProtocolException e) {
e.printStackTrace();
} catch (MalformedURLException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
return result;
}
@Override
protected void onPreExecute(){
super.onPreExecute();
}
private String getPostString(HashMap<String, String> map) {
StringBuilder result = new StringBuilder();
boolean first = true; // 첫 번째 매개변수 여부
for (Map.Entry<String, String> entry : map.entrySet()) {
if (first)
first = false;
else // 첫 번째 매개변수가 아닌 경우엔 앞에 &를 붙임
result.append("&");
try { // UTF-8로 주소에 키와 값을 붙임
result.append(URLEncoder.encode(entry.getKey(), "UTF-8"));
result.append("=");
result.append(URLEncoder.encode(entry.getValue(), "UTF-8"));
} catch (UnsupportedEncodingException ue) {
ue.printStackTrace();
} catch (Exception e) {
e.printStackTrace();
}
}
return result.toString();
}
}
화면 가로, 세로 고정 (0) | 2017.10.10 |
---|---|
안드로이드 파일경로, 파일명, uri 아이디 찾기 (0) | 2017.06.02 |
안드로이드 웹뷰 자동회전 리로드 방지 (0) | 2016.11.04 |
ArrayList 정렬 (0) | 2016.10.07 |
recyclerView 스크롤 끝으로 보내기 (0) | 2016.10.05 |
자동회전시 재접속 또는 새로고침 현상은 메인엑티비티 재접속 현상
이를 해결해주기위해
MainActivity.java 파일에
@Override
public void onConfigurationChanged(Configuration newConfig){
super.onConfigurationChanged(newConfig);
}
AndroidMainfest.xml 파일에
android:configChanges="keyboard|keyboardHidden|orientation|orientation|screenSize"
위 소스를 <activity 아래에 적으시면 됨니다.
이상 자동회전시 재접속 또는 새로고침 현상 (메인엑티비티 재접속 현상) 해결
화면 가로, 세로 고정 (0) | 2017.10.10 |
---|---|
안드로이드 파일경로, 파일명, uri 아이디 찾기 (0) | 2017.06.02 |
AsyncTask httpConnection (0) | 2016.12.27 |
ArrayList 정렬 (0) | 2016.10.07 |
recyclerView 스크롤 끝으로 보내기 (0) | 2016.10.05 |
1. tar로 압축하기
> tar -cvf [파일명.tar] [폴더명]
ex) abc라는 폴더를 aaa.tar로 압축하고자 한다면
> tar -cvf aaa.tar abc
2. tar 압축 풀기
> tar -xvf [파일명.tar]
ex) aaa.tar라는 tar파일 압축을 풀고자 한다면
> tar -xvf aaa.tar
3. tar.gz로 압축하기
> tar -zcvf [파일명.tar.gz] [폴더명]
ex) abc라는 폴더를 aaa.tar.gz로 압축하고자 한다면
> tar -zcvf aaa.tar.gz abc
4. tar.gz 압축 풀기
> tar -zxvf [파일명.tar.gz]
ex) aaa.tar.gz라는 tar.gz파일 압축을 풀고자 한다면
> tar -zxvf aaa.tar.gz
MySQL 테이블 구조만 백업받아두기
mysqldump 의 –d 옵션을 이용하면 mysql 데이터 베이스의 테이블 구조만 백업이 가능합니다.
사용법:
# mysqldump –d –u디비사용자명 –p패스워드 데이터베이스명 > 백업할파일명.sql
예) localhost 에 설치된 mysql 의 hostway 디비의 테이블 구조를 백업
hostway 디비에 접근 가능한 사용자의 아이디와 패스워드는 hostway
DB_Server> # mysqldump –d –uhostway –phostway hostway > hostway_table_structure.sql
processlist 모니터링 (0) | 2016.09.29 |
---|
ArrayList 날짜 비교 정렬
숫자 정렬도 가능
Collections.sort(Database.arrayList, new Comparator<DataModel>() {
@Override
public int compare(DataModel date1, DataModel date2) {
return date1.getDateTime().compareTo(date2.getDateTime);
}
});
화면 가로, 세로 고정 (0) | 2017.10.10 |
---|---|
안드로이드 파일경로, 파일명, uri 아이디 찾기 (0) | 2017.06.02 |
AsyncTask httpConnection (0) | 2016.12.27 |
안드로이드 웹뷰 자동회전 리로드 방지 (0) | 2016.11.04 |
recyclerView 스크롤 끝으로 보내기 (0) | 2016.10.05 |