Skip to main content

Posts

Fixes for Common Git Mistakes

Spelled last commit message wrong git commit --amend This will open up your editor and allow you to make a change to that last commit message Spelling mistake on branch name We rename this branch in a similar way to how we rename a file with the  mv  command: by moving it to a new location with the correct name. git branch -m feature-brunch feature-branch If you have already pushed this branch, there are a couple of extra steps required. We need to delete the old branch from the remote and push up the new one: git push origin --delete feature-brunch git push origin feature-branch Accidentally committed all changes to the master branch git branch feature-branch git reset HEAD~ --hard git checkout feature-branch This creates a new branch, then rolls back the master branch to where it was before you made changes, before finally checking out your new branch with all your previous changes intact. Forgot to add a file to that last...
Recent posts

Cloning repositories using SSH

Using the Secure Shell (SSH) protocol, you can connect and authenticate to remote servers and services. With SSH keys, you can connect to Version Control Account (BitBucket/GitHub..) accounts without supplying your username or password at each visit.  We need to generate SSH key pair, Add the private key to ssh agent and public key to Version control account. 1. Generating SSH key pair Open  Terminal  and paste the text below, substituting in your email address or some unique key like employee Id. ssh-keygen -t rsa -b 4096 -C " your_email@example.com " This creates a new ssh key, using the provided email as a label. This generates public/private rsa key pair. When you're prompted to "Enter a file in which to save the key," press Enter. This accepts the default file location. 2.   Adding your SSH key to the ssh-agent Start the ssh-agent in the background. eval "$(ssh-agent -s)" If you're using macOS Sierra 10.12.2 or l...

User defined settings iOS

With User defined settings  we can set values specific to build configuration. Creating User Defined Settings Select Target > Build Settings Click Plus icon, present beside the search bar Using User Defined Settings when we need to access the values set in User defined build settings we can do it in two ways  From info.plist $(NEW_SETTING) From Code let value = Bundle.main.infoDictionary?["NEW_SETTING"] as! String

Memory Management in iOS

The two basic rules of Memory Management are Objects obtained with  -alloc ,  -new ,  -copy , or  -mutableCopy  have a retain count of one. For objects created with any other method, assume they have a retain count of one but will be autoreleased . If you need to keep them in memory, you need to explicitly retain them. Lets see in detail how the memory management works, Memory management concepts are of critical importance and every Cocoa programmer should take the time to master them. Memory management in Cocoa comes in two flavors:  classic retain counts  and  garbage-collected . The question deals with the retain count flavor, so I will focus on that one. The retain count memory management scheme in Cocoa works on the basis that an object will remain in memory as long as other objects claim to be "interested in it." The Objective-C runtime keeps track of this "interested in" relationship with a simple number: the  retain c...

Structural Design Patterns - Adapter

Structural Design Patterns in Swift Adapter : To unify the interfaces of incompatible classes that already exists Bridge : It decouples abstraction from its implementation, so that we can change them independently. It reduces the impact of changes Decorator : Used to add new responsibilities to objects without modifying the underlying classes Composite pattern : Describes how to combine objects so that each of them can be either simple or composite object. Facade : Allows us to expose functionality of entire sub system via single class Fly weight pattern : Used to effectively sharing no. of instances of a class by reducing number of object instances at runtime. Proxy pattern : Proxy objects acts as a surrogate for more complex objects that me expensive for create or use. Adapter : This pattern maps the existing interface to other interface. Eg., Two classes A and B are implementing a protocol P, so we use polymorphism to call the methods of A a...

Agile Overview

Agile Manifesto: Many processes like Scrum, Kanban, Lean, Extreme Programming(XP), Crystal Clear, Agile Unified Process, Dynamic Systems Development Method, Feature Driven Development, Agile Modeling  what they were doing is same so they came up with Agile Manifesto which is set of 4 Values and 12 principals. The 4 Values are: Individuals and Interactions Over Process and tools: As process and tools avoid direct interactions the agile manifesto values Interactions. Working Software Over  Documentation: Giving value to Woking software than the document which describes the software. Customer collaboration Over Contract: We should not stick to contract, as technology changes. Responding to change over plan We should unfollow plans and de prioritise tasks which take longer time  The 12 Principles of Agile Manifesto: Underlying Agile Concepts: Short Feedback Loops Just in Time Requirements and Design Software does not need blue prints like before b...

Advanced Debugging with Xcode and LLDB - WWDC 2018

Advanced Debugging Tips and Tricks: Injecting Code at runtime We can change values of variables at runtime while debugging (here variable_name is a Bool) expression variable_name = false  Here we are injecting value at runtime, so no need to run again to see the effect. (Other eg.,  expression animator.delegate = self) Under Xcode > Preferences > Behaviours > Running > Pauses > Check Show Tab Named, In order to show new tab while a breakpoint is hit. We can set other behaviours as well. We can add symbolic breakpoints on methods in frameworks. like This is in objective c because UIKit is in objective c. In order to find the values/parameter of a function inside framework, we can use For expression -[UILabel setText:] po $arg1 <UILabel ****> po (SEL)$arg2   "setText:" po $arg3 "0 ft" We can set symbolic breakpoints in 2 ways 1. By clicking plus in bottom left and choosing symbolic (Cons: Sets BP in all places) 2. By adding a breakpoi...