I’m interested in trying React native instead of Ionic for Dogwalk. And when doing this i’ll be writing the steps I take if someone else is interested in learning this as well. Now we’ll take a look on how to install React Native.
For React Native we need node, Watchman, React Native CLI and Xcode. Watchman is a service for watching changes in files and trigger actions when that happens. Reactive CLI is the command interface for React Native. Xcode is Apples IDE.
When running git rebase you reapply commits on top of another base tip. Ok, nice what does that mean? The official git docs provides a good explanation of this.
If we have a feature branch called topic created from master at commit E. And if master has new commits before our branches can look like this:
To rebase this branch with master we would use this command:
Our branches would then look like this:
Git rebase interactive
We can also use rebase to, for example, squash or fixup commits that that fits better into an already made commit. This would come in handy after a code review is done and there are changes that fit in other commits.
Say i have this line added to my new feature branch:
And this line was commited with the message First commit of this new feature
After a code review a new line was added to that file, and a new commit was created
This commit got the message Fixing a code review.
To keep the branch nice and tidy you can squash or fixup these two commits into one.
I would get the following view in my terminal:
When typing fixup before the code review commit and saving, the commit will meld into the previous commit.
Do git rebase, sqash and fixups with a GUI
You do not need to do this in the terminal if you do not want to. You can use for example GitUp
GitUp Squash and fixups
If you right-click on a commit you get a lot of options for example Fixup with Parent and Squash with parent. But you also have the oiption to Swap with parent (Move down) and Swap with Child (Move up) which you can use before squashing or fixuping if there are other commits between the ones you want to combine.
To complement GitUp you can use the GitHub desktop app to see what your commits contains and which ones should be melded together.
push and pull after rebase
I work with github as an origin to this repo. To push the repo now when you have done a rebase you need to force the push:
For other users that now want to continue to work on this branch they now need to do a:
However I ran into an issue today in which I updated Node.JS outside of Visual Studio, but since VS uses its own install that is separate from any outside installation, you can potentially run into a node_modules package dependency issue where one version of npm installs a package (which makes it rely on that version of Node/npm), and then you can’t run commands in the other version (they break).
Running npm install or npm rebuild node-sass –force, as the error message says, did not help.
How to solve it
Open Visual Studio 2017
Go to Tools -> Options…
Go to Projects and Solutions -> Web Package Management
move $(PATH) to the top of that list and close that window.
What is Redis and what is it used for? I’ve come across it in two of the projects I’ve been working on, but never had to do anything else than start it. It seems to be used along side a persistence database.
This is the first post in the What is series where I’m aiming to answer questions I’m thinking about but never take the time to answer. I got this idea from another Swedish developer, who I cant remember the name of right now. Inez or Ines maybe? If you know who i’m looking for, please let me know in the comments :)
How does redis explain itself
Redis is an open source (BSD licensed), in-memory data structure store, used as a database, cache and message broker. It supports data structures such as strings, hashes, lists, sets, sorted sets with range queries, bitmaps, hyperloglogs and geospatial indexes with radius queries. Redis has built-in replication, Lua scripting, LRU eviction, transactions and different levels of on-disk persistence, and provides high availability via Redis Sentinel and automatic partitioning with Redis Cluster. -Redis.io
Ok, so I guess it can be used as a database itself, and i do not need to have another one in my application, such as postgres, mysql or any other database.
It seems to be some kind of cache as well. Have to look into that.
Is it a cache, database or both?
After going through the FAQ I learned that using Redis together with an on-disk database is a good idea and a common design pattern that is used. Use Redis for write heavy small data and store big blobs of data into an sql on disk database.
But you can use redis as a stand alone database that keeps data in memory and eventually saves it to disk.
But what do they mean by using it as a cache? Well, since Redis keeps data in memory you can load data into it that is used and displayed often without getting the data from disk everytime, for example loading product data from an sql-database, making it very quick.