2020年2月15日土曜日

"command not found" when the tool was installed via pip

When using python as matlab like tool.  jupyter or voila are necessary to be installed via pip.
be reminded that if the OS is linux, the tolls which are installed via pip (or pip3) are stored in "~/.local/bin"
so you need to add the path.
for example edit .bashrc

  PATH="$HOME/.local/bin:$PATH"

I am using WSL and noticed that it's default ~/.profile has the bellow line

if [ -d "$HOME/.local/bin" ] ; then
    PATH="$HOME/.local/bin:$PATH"
fi

it means when bash is loaded, it checks if there is .local/bin, if so add the directory to the PATH, if not don't do anything.
My .local was created first time after using pip. so the Path was not set.
so without restart the terminal,

$source ~/.profile

would also  add pip toll path

2020年2月11日火曜日

add sudo user linux.

if there is a user "dev1" for example in Linux and want to add the user sudo group.

 $usermod -aG sudo dev1


2020年2月8日土曜日

Disable Darkmode programmatically on Swift . iOS 13

Darkmode was introduced on iOS13 and it add the cool appearance on the iOS
however  when you don't want to implement the darkmode because of some design conflict, ui conflict, here is how to disable dark mode.

add following code on viewDidLoad for each viewController as explained

override func viewDidLoad() {
        super.viewDidLoad()

        // Always adopt a light interface style.    
        overrideUserInterfaceStyle = .light
    }



There is the other solution to make light style as a default for all view, which is to add key on info.plist. but this solution is not recommended by apple.

you can temporarily opt out by including the UIUserInterfaceStyle key (with a value of Light) in your app’s Info.plist file. Setting this key to Light causes the system to ignore the user's preference and always apply a light appearance to your app.
Important
Supporting Dark Mode is strongly encouraged. Use the UIUserInterfaceStyle key to opt out only temporarily while you work on improvements to your app's Dark Mode support.

for more information, see the link

2020年2月7日金曜日

How to read the log from iOS devices.

Assuming running Xcode


  1.  Go Windows and Devices and then Simulators.
  2.  Choose the  device from the devices section on the left side screen.
  3.  Click Open Console

2020年2月1日土曜日

How to open picture with UiImage in Swift playgroud.

How to open picture with UiImage in Swift playgroud.


  1.  Open navigator side panel. 
  2.  See there are Sources and Resources folder.  select Resources
  3.  click + button at the bottom and choose add file to Resources
  4.  choose the image file 
  5.  use it on playground . ex 
    let uiImage = UIImage(named:  "testImage.jpg")



2020年1月31日金曜日

ios 13, how to change the text field placeholder color from storyboard

How to change  text field placeholder color from storyboard .


  1.  select the UITextfiled of which you want to change the color. if there are several text fields, you have to do the same procedure for each.
  2. open the identity inspector. see the pic.
  3. Find the User Defined Runtime Attributes  and click + button.
  4. Type a new row with Key Path  placeholderLabel.textColor. be reminded that this is for iOS13, Swift 5.0. if it is for lower version, type _placeholderLabel.textColor instead.
  5. choose Type color and select the color as your choice.

2020年1月28日火曜日

Swift on iOS13, UIView present

The change on iOS13,  UIView.present default style is card presentation

card presentation


to make it full screen is easy.

solution
to set .fullscreen or .overFullScreen to

modalPresentationStyle

for example

        let viewCon = SampleViewController2(nibName: "SampleViewController", bundle: .main)
        viewCon.modalPresentationStyle = .fullScreen
        self.present(viewCon, animated: true, completion: nil)



.fullScreen

Discussion

The views belonging to the presenting view controller are removed after the presentation completes.

.overFullScreen

Discussion

The views beneath the presented content are not removed from the view hierarchy when the presentation finishes. So if the presented view controller does not fill the screen with opaque content, the underlying content shows through.