Static Vs. Dynamic Binding in Java

From Javarevisited blog post: Here are a few important differences between static and dynamic binding: Static binding in Java occurs during compile time while dynamic binding occurs during runtime. private, final and static methods and variables use static binding and are bonded by compiler while virtual methods are bonded during runtime based upon runtime object. … Read more

Node.js: Difference between req.query[] and req.params

Given this route app.get(‘/hi/:param1’, function(req,res){} ); // regex version app.get(/^\/hi\/(.*)$/, function(req,res){} ); // unnamed wild card app.get(‘/hi/*’, function(req,res){} ); and given this URL http://www.google.com/hi/there?qs1=you&qs2=tube You will have: req.query { qs1: ‘you’, qs2: ‘tube’ } req.params { param1: ‘there’ } When you use a regular expression for the route definition, capture groups are provided in the … Read more

Error: ‘node-sass’ version 5.0.0 is incompatible with ^4.0.0

TL;DR npm uninstall node-sass npm install sass Or, if using Yarn yarn remove node-sass yarn add sass Edit3: yes, another edit. Moving to sass (dart-sass) is the best solution. Previous one included locking node-sass to version 4.x.x, which is 2 years old and lacks newer SCSS features. Edit2: sass-loader v10.0.5 fixes it. The problem is … Read more

How do android screen coordinates work?

This image presents both orientation(Landscape/Portrait) To get MaxX and MaxY, read on. For Android device screen coordinates, below concept will work. Display mdisp = getWindowManager().getDefaultDisplay(); Point mdispSize = new Point(); mdisp.getSize(mdispSize); int maxX = mdispSize.x; int maxY = mdispSize.y; EDIT:- ** **for devices supporting android api level older than 13. Can use below code. Display … Read more

How to embed small icon in UILabel

You can do this with iOS 7’s text attachments, which are part of TextKit. Some sample code: NSTextAttachment *attachment = [[NSTextAttachment alloc] init]; attachment.image = [UIImage imageNamed:@”MyIcon.png”]; NSAttributedString *attachmentString = [NSAttributedString attributedStringWithAttachment:attachment]; NSMutableAttributedString *myString= [[NSMutableAttributedString alloc] initWithString:@”My label text”]; [myString appendAttributedString:attachmentString]; myLabel.attributedText = myString;