https://medium.com/innocode-stories/tutorial-how-to-simulate-location-on-the-ios-device-e2be20fbd7f4
2020년 12월 15일 화요일
2020년 12월 9일 수요일
Unsupported Architectures. The executable for [Project Name]'[i386, x86_64]'
Build Phases->Run Script
Add this script below
cd "${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/"
if [[ -d "Frameworks" ]]; then
rm -fr Frameworks
fi
2020년 10월 20일 화요일
To set gpu memory rate manually when using keras
from tensorflow.compat.v1 import ConfigProto
from tensorflow.compat.v1 import InteractiveSession
config = ConfigProto()
config.gpu_options.per_process_gpu_memory_fraction = 0.8
session = InteractiveSession(config=config)
tensorflow.python.framework.errors_impl.UnknownError: Failed to get convolution algorithm. This is probably because cuDNN failed to initialize
add this code below on the top of the source code
gpus = tf.config.experimental.list_physical_devices('GPU')
if gpus:
try:
# Currently, memory growth needs to be the same across GPUs
for gpu in gpus:
tf.config.experimental.set_memory_growth(gpu, True)
logical_gpus = tf.config.experimental.list_logical_devices('GPU')
print(len(gpus), "Physical GPUs,", len(logical_gpus), "Logical GPUs")
except RuntimeError as e:
# Memory growth must be set before GPUs have been initialized
print(e)
2020년 10월 16일 금요일
After removing storyboard, app appears black in iOS with Objective-c.
1. set iOS version over 13 and make "Main Interface" is empty
2. add a ViewController
3. nd code below in the SceneDelegate.m
- (void)scene:(UIScene *)scene willConnectToSession:(UISceneSession *)session options:(UISceneConnectionOptions *)connectionOptions {
// Use this method to optionally configure and attach the UIWindow `window` to the provided UIWindowScene `scene`.
// If using a storyboard, the `window` property will automatically be initialized and attached to the scene.
// This delegate does not imply the connecting scene or session are new (see `application:configurationForConnectingSceneSession` instead).
self.window = [[UIWindow alloc] initWithWindowScene:(UIWindowScene*)scene];
MainViewController *controller = [[MainViewController alloc] initWithNibName:@"MainViewController" bundle:nil];
self.window.backgroundColor = [UIColor redColor];
self.window.rootViewController = controller;
[self.window makeKeyAndVisible];
}
2020년 9월 8일 화요일
Print whole matrix in Numpy
import sys
import numpy as np
np.set_printoptions(threshold=sys.maxsize)
// and then print the matrix what you want
print(np.arange(1000).reshape(2,5,100))
2020년 8월 3일 월요일
[Android] Google Social Login
2020년 7월 27일 월요일
Using Swift framework in an Objective-c project
https://marcinczenko.github.io/post/using-swift-frameworks-from-objective-c-target/
===============================================
=============== Swift Framework ===============
===============================================
Make a ExampleSwiftFramework framework. not Static Library
Add ExampleSwiftFramework.swift and put the code below
@objc
public class ExampleSwiftFrameworkClass : NSObject {
let message: String
@objc(init:)
public init(withHelloMessage message: String) {
self.message = message
}
@objc(sayHello)
public func sayHello() -> String {
return self.message
}
}
TARGETS->Build Settings
Mach-O : 'Dynamic Library'
Build Options->Always Embeded Swift Standard Libraries : No
Packaging->Defines Module : Yes
Apple Clang-Language-Modules->Enable Modules(C and Objective-C) : Yes
next to the upper left 'stop' icon. click framework and edit scheme->Run->Build Configuration=> Release
Click Product->Build
and you can see the built framework on the project navigato.
Right click at the file->Show in Finder
===============================================
============= Objective-C project =============
===============================================
Make an objective-C project
TARGETS->General
1. add the swift framework into the 'Frameworks, Libraries, and Embedded Content'
2. and then you can see 'Framework' folder in the project navigator.
3. remove the framework from the 'Frameworks, Libraries, and Embedded Content'
4. drag the framework.framework folder into the 'Framework' in the project navigator
TARGETS -> Build Settings(All, Combined taps)
Build Option -> Always Embed Swift Standard Libraries : No
TARGETS -> Build Phases
Click '+' and add New Copy Files Phase category
add the swift framework what you need and keep the default option(Code Sign On Copy : checked, Copy only when installing : unchecked)
put the code below in -(void)viewDidLoad
ExampleSwiftFrameworkClass *exam = [[ExampleSwiftFrameworkClass alloc] init:@"Test"];
NSLog(@"%@", [exam sayHello]);
2020년 7월 19일 일요일
Room migrations in Kotlin
To test you need two class
//===============================================================
// AppDatabase class
Database(entities = [Song::class], version = 1, exportSchema = false)
abstract class AppDatabase : RoomDatabase() { companion object {@Volatile private var INSTANCE: AppDatabase? = null fun getInstance(context: Context): AppDatabase = INSTANCE ?: synchronized(this) {
INSTANCE ?: buildDatabase(context).also {INSTANCE = it }}private fun buildDatabase(context: Context) =
Room.databaseBuilder(context.applicationContext,
AppDatabase::class.java, "test.db").build()
fun destroyInstance() {INSTANCE = null
} }
}
//===============================================================
// Entity class
// when the version was 1
@Entitydata class Song(
@PrimaryKey val id: Long, val title: String
)
//===============================================================
When you run an app with the database version 1
after then you modified the Song class added 'tag' entity.
@Entitydata class Song( @PrimaryKey val id: Long,
val title: String,
val tag: String // Added in version 2.
)
you should change the version number of AppDatabase class like below from 1 to 2
Database(entities = [Song::class], version = 2, exportSchema = false)
you also have to edit database builder like this
private fun buildDatabase(context: Context) = Room.databaseBuilder(context.applicationContext,
AppDatabase::class.java, "terry.db") .addMigrations(MIGRATION_1_2).build()
and add migration code or edit it in the Song class
// Migration from 1 to 2, Room 2.1.0val MIGRATION_1_2 = object : Migration(1, 2) { override fun migrate(database: SupportSQLiteDatabase) { database.execSQL( "ALTER TABLE Song ADD COLUMN tag TEXT NOT NULL DEFAULT ''") } }
That's all! :)
2020년 6월 23일 화요일
2020년 6월 12일 금요일
우분투 카톡 설치
와인 버전 설치할 때 우분투 버전 18, 19 구분하는 옵션 부분 잘 확인해서 설치
카톡설치
https://lucidmaj7.tistory.com/159
와인설치
http://ubuntuhandbook.org/index.php/2020/01/install-wine-5-0-stable-ubuntu-18-04-19-10/
우분투 18.04에 윈도우 10 멀티부팅
네트웍이 무선이 아니라 유선으로 연결을 해야진행되는 걸 수도 있음.
무선으로 연결해서 한참 기다려도 윈도우화면 안나와서 몇번 설치 실패.
유선 연결 후 20 ~ 30분 정도 기다린 후 정상 설치 됨. 무선에서 더기다려서 될수도 있음.
https://goodtogreate.tistory.com/entry/%EB%A9%80%ED%8B%B0%EB%B6%80%ED%8C%85-%EC%9A%B0%EB%B6%84%ED%88%AC-%EC%84%A4%EC%B9%98-%ED%9B%84-%EC%9C%88%EB%8F%84%EC%9A%B0-Install-Windows10-alongside-Ubuntu
2020년 6월 6일 토요일
To use Room in Android, you need more dependencies
In build.gradle(Module:app)
------------------------------------------------------------------------------------------
apply plugin: 'kotlin-kapt'
dependencies {
def room_version = "2.2.3"
def lifecycle_version = "2.2.0"
implementation "androidx.room:room-runtime:$room_version"
implementation "androidx.lifecycle:lifecycle-runtime-ktx:$lifecycle_version"
implementation "android.arch.lifecycle:extensions:$lifecycle_version"
kapt "android.arch.lifecycle:compiler:$lifecycle_version"
implementation "android.arch.persistence.room:runtime:$room_version"
kapt "androidx.room:room-compiler:$room_version"
}
2020년 6월 4일 목요일
When you meet the error 'Failed to resolve: com.github.PhilJay:MPAndroidChart:v3.1.1'
buildscript { ext.kotlin_version = "1.3.72" repositories { maven { url 'https://jitpack.io'} google() jcenter() } dependencies { classpath "com.android.tools.build:gradle:4.0.0" classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" // NOTE: Do not place your application dependencies here; they belong // in the individual module build.gradle files }} allprojects { repositories { maven { url 'https://jitpack.io'} google() jcenter() }}
in build.gradle(Module: app)
dependencies {
implementation fileTree(dir: "libs", include: ["*.jar"]) implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version" implementation 'androidx.core:core-ktx:1.3.0' implementation 'androidx.appcompat:appcompat:1.1.0' implementation 'androidx.constraintlayout:constraintlayout:1.1.3' implementation 'com.github.PhilJay:MPAndroidChart:v3.1.0' testImplementation 'junit:junit:4.13' androidTestImplementation 'androidx.test.ext:junit:1.1.1' androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'}
2020년 5월 17일 일요일
no permissions (user in plugdev group; are your udev rules wrong?)
$ sudo apt-get install libmtp-common mtp-tools libmtp-dev libmtp-runtime libmtp9
$ sudo apt-get dist-upgrade
# remember the red text below
$lsusb
Bus 007 Device 002: ID 18d1:6jw2 Google Inc.
Bus 007 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 006 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 005 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 004 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 003 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 001 Device 004: ID 8087:0aa7 Intel Corp.
Bus 001 Device 003: ID 04b4:2001 Cypress Semiconductor Corp.
Bus 001 Device 002: ID 045e:0823 Microsoft Corp.
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
SUBSYSTEM=="usb", ATTR{idVendor}=="18d1", ATTR{idProduct}=="6jw2", MODE="0666", GROUP="plugdev"
$ sudo udevadm control --reload-rules
$ adb devices
# Solved. right? :)
2020년 4월 17일 금요일
Tensorboard error
Just downgrade its version all above as 3.8.0 in Anaconda.
2020년 3월 11일 수요일
[iOS 배포] TestFlight Public link
1. Join the App Store Connect
2. Click to TestFlight
3. Click New Group
4. Add Testers(email and name)
5. Click the Group that you made just before
6. Click Enable Public Link
7. copy the link and share to others
2020년 3월 2일 월요일
[ML-Agents로 배우는 강화학습] 5~6장 Drone DDPG 훈련 및 실행
1. 소코반 예제처럼 Unity3D에서 xxx.nn 학습 모델을 Agent에 추가하는게 아님.
2. python 코드에서 load_model = True, train_mode = Fasle로 변경
3. load_path의 경로가 학습된 모델의(년월일시로 생생된 디렉토리) path로 설정
4. pycharm 에서 실행하면 됨.
2020년 2월 2일 일요일
우분투에서 유니티 런처 아이콘 고정
[Desktop Entry]
Name=Unity3D
Name[ko]=유니티3D
Type=Application
Icon=/media/data1/2019.2.17f1/Editor/Data/Resources/UnityPlayerIcon.png #아이콘위치
Exec=/media/data1/Unity3D/UnityHub.AppImage # 실행 프로그램 위치
/home/계정/.local/share/applications/