Wednesday, August 5, 2020

[React Native] - Default Layout Values

If you are working with React Native, you can check this summary table with defaults values of style properties.

Layout property    |    default value    |    doc link
-----------------------------------------------------------------
alignItems                          stretch                          https://reactnative.dev/docs/layout-props#alignitems

directions                           inherit                          https://reactnative.dev/docs/layout-props#direction

flexDirection                      column                         https://reactnative.dev/docs/layout-props#flexdirection

fledWrap                            nowrap                         https://reactnative.dev/docs/layout-props#flexwrap

justifyContent                    flex-start                       https://reactnative.dev/docs/layout-props#justifycontent

overflow                             visible                           https://reactnative.dev/docs/layout-props#overflow

position                               relative                         https://reactnative.dev/docs/layout-props#position

If you are using some of this props on your stylesheet, you can remove them, unless they are being used to rewrite other previous conditions.

Tuesday, March 10, 2020

[xCode] - runtime is not available


Error message while try to run your application on simulator


If you got this error "The iOS XX.X simulator runtime is not available" (where XX.X is the version of iOS on simulator) while trying to run your application on simulator only need to kill all open CoreSimulatorService.
sudo killall -9 com.apple.CoreSimulator.CoreSimulatorService

Thursday, February 27, 2020

[React Native] - Fast refresh stop working!

If you are developer and working with React Native, you know all the advantages of fast refresh when you write your app. This feature are available from version 0.61 of react native (original post)

But if this feature stop working when you need them?

It happened to me and just changed the versions of external modules!

Start searching for solutions! https://github.com/facebook/react-native/issues?q=is%3Aissue+Fast+refresh+stop+is%3Aclosed

But the problem persist!

Resolution attempts (without success)

1. Revert all changes on external modules!


2. Clear all caches and external dependencies (npm, watchman and node_modules)


rm -rf ~/.npm
watchman watch-del-all
rm -rf node_modules

npm i
Panic mode ... Still not working!!!

My last hope, checkout the project to new folder try to see if it works... and i'm happiness, fast refresh working again.

So, just need compare the differences between this two same projects folders and find the changed files!

Differences founded...

File: git/.git/index.lock
I think this differences still related with my changes on external modules, but let me try to delete the lock file and run my project again.

Oh yes! The fast refresh working again.

Conclusion, if you have the same problem, only need delete git/.git/index.lock (on your base project folder) to get back fast refresh working.

rm -rf git/.git/index.lock

Wednesday, February 19, 2020

[TERMINAL] - How to zip files as individual zip files


If you want to zip all files inside folder as individual zip files without extension, only need to open terminal and paste command:
for i in *; do zip "${i%%.*}" "$i"; done

Change *; to *.your_extension_file; to ignore all other file types.

ex:

open terminal and navigate to the folder (where exist the files to compress)

1. cd /Download

2. compress only text files

for i in *.txt; do zip "${i%%.*}" "$i"; done


Wednesday, October 30, 2019

[Terminal] - Create file from the command line

If you need to create a file without content, just to test the write speed on USB Stick for example or SDCard, you can do it with this command:

mkfile -n 1000m no-content-1GB-file
1000m - the size of file  (value in mb)
no-content-1GB-file - the name of file  

Thursday, September 5, 2019

[SVN] - Commit files with @ character on filename

When you try to commit file on your SVN repository from command line and this file contains @ on filename and you get the error:
svn: E200009: 'your-file@2x.png': a peg revision is not allowed here
You just need to add the @ character to the end of file name you want to submit.

For example:

svn commit 'your-file@2x.png@'

Friday, August 16, 2019

[TERMIINAL] - Change character on filename to another one


Replace one character with another one on all files inside folder

for x in *"_"*; do mv -- "$x" "${x/_/-}"; done

On this example i need to change all _ to -


You can change the character to find on filename (orange color) and the replace character (red color) 

Friday, July 19, 2019

[TERMINAL] - How to go back to previous directory


If you want to return to the previous directory on terminal just one simple command you only need do:

cd -n


ex: 

Open termina, lock at the current folder and navigate to folder /usr/local. Now go back to previous directory
To do this you only need reproduce this steps:

open terminal and write:

1. pwd 
(get the current directory path)

2. cd /usr/local

3. cd -
(go back to previous directory)


Thursday, January 10, 2019

[MAC] - Read and Write NTFS drive

To write on NTFS USB disk on mac you need install third party apps. You have paid and free options. On this post will show how to install and use free application to read and write on NTFS drive on your mac.

Software needed:

xCode command line tools

If you haven’t installed them yet, you can open a Terminal and run the following command:
xcode-select --install

FUSE for macOS

Download FUSE for macOS and install it. Use the default options when installing it.

Brew

This is a package manager for Mac OS X. If you haven’t already installed it on your Mac paste this line on terminal. 

/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

ntfs-3g

This is a driver to read and write NTFS drivers. To install paste this line on terminal. 

brew install ntfs-3g

Now you are able to read and write on NTFS partitions.

To mount NTFS you this following this steps:
1. Create folder to mapping drive. On terminal paste the above line:
sudo mkdir /Volumes/ntfs-storage
2. List all disks connected on your machine
diskutil list

3. Identify the device name and partition you want mount. On the screenshot you can see my disk is disk2s5 

4. Unmount selected partition with this command
sudo umount /dev/disk2s5

5. Finally, mount driver with this command. Don't forget to replace /dev/disk2s5 with your partition name
sudo /usr/local/bin/ntfs-3g /dev/disk2s5 /Volumes/ntfs-storage -olocal -oallow_other

ERRORS

If you got the error `Failed to mount '/dev/disk2s5' : Input/output error`

replace /dev/disk2s5 to your drive name (see here why you identify your disk mount name)
You need to run the command:



sudo ntfsfix /dev/disk2s5

After this command you should expect the following output:

sudo ntfsfix /dev/disk2s5
Mounting volume... $MFTMirr does not match $MFT (record 24).
FAILED
Attempting to correct errors... 
Processing $MFT and $MFTMirr...
Reading $MFT... OK
Reading $MFTMirr... OK
Comparing $MFTMirr to $MFT... FAILED
Correcting differences in $MFTMirr record 24...OK
Correcting differences in $MFTMirr record 25...OK
Correcting differences in $MFTMirr record 26...OK
Correcting differences in $MFTMirr record 27...OK
Correcting differences in $MFTMirr record 28...OK
Correcting differences in $MFTMirr record 29...OK
Correcting differences in $MFTMirr record 30...OK
Correcting differences in $MFTMirr record 31...OK
Correcting differences in $MFTMirr record 32...OK
Correcting differences in $MFTMirr record 33...OK
Correcting differences in $MFTMirr record 34...OK
Correcting differences in $MFTMirr record 35...OK
Correcting differences in $MFTMirr record 36...OK
Correcting differences in $MFTMirr record 37...OK
Correcting differences in $MFTMirr record 38...OK
Correcting differences in $MFTMirr record 39...OK
Correcting differences in $MFTMirr record 40...OK
Correcting differences in $MFTMirr record 41...OK
Correcting differences in $MFTMirr record 42...OK
Correcting differences in $MFTMirr record 43...OK
Correcting differences in $MFTMirr record 44...OK
Correcting differences in $MFTMirr record 45...OK
Correcting differences in $MFTMirr record 46...OK
Correcting differences in $MFTMirr record 47...OK
Processing of $MFT and $MFTMirr completed successfully.
Setting required flags on partition... OK
Going to empty the journal ($LogFile)... OK
Checking the alternate boot sector... OK
NTFS volume version is 3.1.
NTFS partition /dev/disk2s5 was processed successfully.

Friday, December 21, 2018

[MAC] - How to use touchID on terminal

Add the instruction "auth sufficient pam_tid.so" on /etc/pam.d/sudo

Open terminal and write:
sudo vim /etc/pam.d/sudo
Now, add this line on bottom of file. (press i to insert and navigate with arrow down on your keyboard to the last line)
auth sufficient pam_tid.so
Save the file with command
esc + :wq!
Done, now you don't need any more add password on your terminal for sudo instructions.