I bought a new camera

Photography and vlogging is my recent new hobby and the craft I am learning. Primary reason behind this new found interest is because I want to capture my hiking and outdoor travels other than my eyes. I want to share the experience with people.

Flower of a Coriander

Secondary reason is mental exercise that I recieve in a good way. I am from the field of software engineering and if you may believe or not it requires creativity to solve problems which is the most important skills required in any form of engineering. It’s an art too. No wonder why there are less good engineers among many in saturated market here. I learn new skills whether it is related to my work or if it is a new hobby. It keeps the flow of neurone active and sharp.

Remember new hobbies can be expensive in your wallet based on what hobby you choose so tread carefully and plan.

CONTINUE READING

inputAccessoryView ignores bottom Safe Area in iPhone X's

I have this neat view controller setup for my comments system. At the bottom of the screen is inputAccessoryView which will be fixed until interacted with to bring keypad up for user to post comments. When keypad is up view will be above it and if keypad is dismissed then view will stick at the bottom of screen.

To achieve this I override two methods of my UIViewController:


-(BOOL)canBecomeFirstResponder{
    return YES;
}

-(UIView *)inputAccessoryView{
    return commentInputView.contentView;
}

I am using custom xib and my custom input view is composed within the class.

It works fine except in iPhone with notch.

CONTINUE READING

Weekend hiking to Doban via Nuwakot from Butwal

nuwakot-doban trail

This weekend I decided to go doban and stretch some extra kilo metres to my daily hike. My daily trail extends upto 5 km uphill and back downhill isn’t a big stress, credits to the fresh air, smoky mountains and chirping of birds that are enough to heal my body and soul.

I decided to backpack for the weekend hike to cover small settlement called Doban beside Tinau river.

There is an official short hike trail from near Fulbari zoo in Butwal. Tourist and locals use it. I wanted to walk along the peak of hills and embrace the scenic beauty from top. Hence I took long path instead. Nuwakot village was my first destination from where Doban was 3 Km downhill. I started my journey from northwest outskirts of Butwal city, somewhere between Belbas and Jeetgadhi.

CONTINUE READING

Failed Automatic Size of UICollectionViewCell in iOS 12

The content of my UICollectionView flows in horizontal direction. Height of items are fixed but width of each are dynamic based on the length of text. For this example I am using only UILabel in my UICollectionViewCell. My UICollectionViewCell is custom xib.

These are the constraints I have applied to UILabel:
  • Leading : 0
  • Trailing : 0
  • Top : 0
  • Height : 44

CONTINUE READING

Blurry Pixel Font: SpriteKit

It's amazing how modern Pixel Art captures the true simplicity yet also expressing creative masterpieces. I find so much solace staring at the world presented by games like Stardew Valley and Kynseed.

In my spare time I am making 2d pixel art game for iOS and macOS for my hobby. I found a free pixel art font called PixelDigivolve to use it for my texts. There was this behaviour that caught my attention where font was being rendered very blurry. The edges were not sharp.

CONTINUE READING

Sorting NSArray of custom objects with more nesting

Sorting an array of custom objects is fair simple. NSSortDescriptor works awesome for this. Lets see an example:


@interface Parent : NSObject
@property(strong, nonatomic) NSString *name;
@end
NSArray *arrayOfParents = @[parent1, parent2];

If I want to sort array of parents by their name then I would use something like:

CONTINUE READING

drawViewHierarchyInRect vs renderInContext

I came across very curious problem whose cause I couldn’t have come to know about it without serious debugging because this was something that didn’t catch my attention. I had a task that required capturing snapshot of UIView with hierarchy of subviews and perform few interactive transformation animations on view immediately after - giving feeling of instant multitask. Delay should have been negligent for naked eyes or tolerant but it wasn’t.

CONTINUE READING

My first x86-64 assembly in macOS

I am reading a book Coders at work. Each chapter consists of interview with an experts in the field of computer programming, engineering and science. Most of them had started programming during 70’s-80's, the time when there wasn’t many choice of programming languages available like modern day. Most of them were programming in low-level like assembly or binary. I was thrilled and excited from reading of their journey. It motivated me to learn small things about assembly and learn more about machine closely. I am writing this blog post on my journey of learning assembly.

I have a macbook pro. It’s a 64-bit machine. Intel based. I started collecting information on resources and tips to get started. My machine is x86-64 so it is x86 assembly. I found little resources on starting assembly on mac, and among what I found was for linux. Throughout the search I have collected good blogs and resources that I’ll be sharing. This post is more about what I am discovering or learning rather than tutorial.

CONTINUE READING