2020年5月8日金曜日

VS code server failed to start

VS Code ssh remote is not stable,
I have connected to Debian on VirtualBox and after closed the window and shutdone the Debian.
Then Booting up Debian and I Tried to connect from VSCode, I could not successfully establish connection. SSH from terminal is working fine so it is the issue in VSCode.  

solution
running the  folowing command from VS Code from host.  (to open comand plate "ctr + shift + p" .)
Uninstall VS Code Server
and trying to connect from VSCode. I can connect and see folders/Directories on the Debian

2020年5月6日水曜日

VS Code remote SSH to Debian on VirtualBox

Short note how to setup SSH Remote connect VS Code from Windows 10 to Debian vm as user1 on VirtualBox.
Assuming Debian is already running on VM and the user name is "user1" and the ip address is 192.168.122.1.  SSH port was portforward to 3022. 

1.  install OpenSSH for windows server
open power shell terminal on Windows and run following commands
 
Get-WindowsCapability -Online | ? Name -like 'OpenSSH*'

# This should return the following output:

Name  : OpenSSH.Client~~~~0.0.1.0
State : NotPresent
Name  : OpenSSH.Server~~~~0.0.1.0
State : NotPresent

# Install the OpenSSH Client
Add-WindowsCapability -Online -Name OpenSSH.Client~~~~0.0.1.0

# Install the OpenSSH Server
Add-WindowsCapability -Online -Name OpenSSH.Server~~~~0.0.1.0

# Both of these should return the following output:

Path          :
Online        : True
RestartNeeded : False
 
  

2.  SSH KeyGen
create ssh key pair in windows local to set up ssh public key authenticate

$ssh-keygen -t rsa -b 4096

$cd .ssh

#make sure ~/.ssh directry is existing in the user home of Debian. 

$ cat id_rsa.pub | ssh -p 3022 user1@192.168.122.1  'cat >>.ssh/authorized_keys'

3.  Install VSCode SSH remote extension
The Remote - SSH extension

4.  Install VSCode SSH remote extension 

5.  Edit/Create the SSH config file
Edit .ssh/config file on your Windows. .ssh folder is located on C:User/username/.ssh   

Host 192.168.122.1
    HostName 192.168.122.1
    User user1
    Port 3022
now everything is done.
click the ssh connection button on the left bottom of VSCode and follow the prompt.

2020年4月23日木曜日

to clean MacOS Xcode CoreSimulator device folder


When macos strage usage was getting bigger and you are using Xcode, to clean the simulator folder  is going to help free up your strage space.
more info

$xcrun simctl delete unavailable

2020年4月22日水曜日

SwiftUI data visualization, ploting library

One of useful  plot library for SwiftUI

https://github.com/KanshuYokoo/SwiftUIGraphPlotLibrary
It is very nice library to plot data on SwiftUI project ad seem to work on both iOS and MacOSX



2020年4月14日火曜日

swift, useful example of keypath


extension Sequence {
    func sorted<T: Comparable>(by keyPath:KeyPath<Element, T>) -> [Element]{
        return sorted {a, b in
            return a[keyPath: keyPath] < b[keyPath:keyPath]
        }
    }
    
    func map <T> (_ keyPath: KeyPath<Element, T>) -> [T] {
        return map {$0[keyPath: keyPath]}
    }
    
    func min <T: Comparable> (_ keyPath: KeyPath<Element, T>) -> T? {
        return map(keyPath).min()
    }
    
    func max<T: Comparable> (_ keyPath: KeyPath<Element, T>) -> T? {
        return map(keyPath).max()
    }
    
}

2020年4月2日木曜日

WSL2 - npm install : pm ERR! code: 'EACCES',

Tring to install npm package by

$ npm install

There were many errors with the code
npm ERR!      code: 'EACCES'

the solution is

$npm config set unsafe-perm=true

Tring the npm install again and it succeeded.


2020年3月27日金曜日

ios app, internationalization ,i18n

How to prepare i18n for my ios app.

1. add languages to translate
go to project setting and tap info
find Localizations, press + and add any languages 


2. add string file 
This is the list of strings that should be translated in 

File menu and choose New > File, then select Strings File from the list of file types