Using instanceof is a code smell. I think we may agree on that. Whenever I see a construction like that I’m sure that something went awry. Maybe someone just didn’t notice a prob… Read More
In this section we will understand what is instanceof operator and how to use instanceof operator in our java programming language. In previous post, i had shared when to use abstract class… Read More
In Java, instanceof operator is used to check the type of an object at runtime. It is the means by which your program can obtain run-time type information about an object. ins… Read More
In Java, instanceof operator is used to check the type of an object at runtime. It is the means by which your program can obtain run-time type information about an object. ins… Read More
As always I was looking through JDK 8 sources and found very interesting code: @Override default void forEachRemaining(Consumer super Integer> action) { if (action instanceof IntConsumer)… Read More
Odepax: In a Swing application, I'm drawing elements on a JPanel overriding the paintComponent method.I have to draw cats, dogs, camels, and more... I guess that polluting paintComponent wit… Read More
Igor Revenko: We just upgraded our site from Magento 1.9.1.1 to Magento 1.9.3.3.Unfortunately, our site is broken, so I have investigated the issue. The error notification are as follow.Fata… Read More
Text on Circle borderimport java.awt.*;import java.awt.event.*;import java.awt.geom.*; public class CircleTextDemo extends Canvas { Frame myframe; Text… Read More
With the release of Java SE 7 the Server Name Indication (SNI) extension was introduced as a default in the JSSE client. This enables TLS clients to connect to virtual servers (SNI is e… Read More
We’re all witnessing a rise in the popularity of microservice architectures. In a microservice architecture, Dropwizard commands a very important place. It is a framework for building… Read More
Below Examples shows how to write and read XLSX and XLS files using Java . package com.sun;import java.io.File;import java.io.FileInputStream;import java.io.FileOutputStream;import java.io… Read More
Unit testing and integration testing are critical phases in a software development lifecycle. However, certain limitations can prevent achieving the full potential of these two testing appro… Read More
Recently, the team Laravel has announced the new series of Laravel 5.5 on its official page. Though, Laravel 5.5 is not yet out, but the documentations are live now.
So here we update you w… Read More
How To Get and Log an error in Angular 4?Two types of errors -1. If the backend returns an unsuccessful response like - 404, 500 and so on2. &nb… Read More
In Angular 4, simply retry the request using RxJS operator called .retry (). It is automatically presubscribed to an Observable, thus reissuing the request when an error occurred!Import RxJS… Read More
We can use Http interceptors to implement [email protected]()export class CachingInterceptor implements HttpInterceptor { constructor(private cache: HttpCache) {} intercept(req: HttpRequ… Read More
What Happens If the Request fails on the Server Due to Poor Network Connection?HttpClient will return an error instead of a successful response.Example - Add an error handler to handle the e… Read More
melston: I have a treeview of hierarchical data that represents elements retrieved from a database. I would like to be able to move child (leaf) nodes from one parent to another and rearrang… Read More
When a programming language is all about objects, the first thing we need to learn is how to create objects. Creating objects in JavaScript is fairly easy: a pair of curly braces will do th… Read More
Hi,
Let us have our second set of PHP Interview questions here.
PHP INTERVIEW QUESTIONS 2
1) What is the latest version of PHP?
2) What is the default extension of PHP?
3) PHP should start a… Read More
What is hashMap in Java?HashMap is mostly used collection in java, Its is working on priciple of hashing techenique. It is data structure which allow to store object and retrive those… Read More
Node.js Best Practice Exception Handling
Problem
I just started trying out node.js a few days ago. I've realized that the Node is terminated whenever I have an unhandled exception in my pro… Read More
Java vs C① Java has similarities to both C and C++,but it is neither upwardly nor downwardly compatible with both.② C is a structured language, Java is purely object-oriented. … Read More
In my latest blog post I explained how to create a Custom Control from 0 to hero.
In all of these examples I always needed to wrap an external library inside a custom control. At first… Read More
Cloud foundry marketplace is one stop shop to explore all cloud foundry service offering. This blog discusses the procedure to make your own service available in Cloud foundry marketpla… Read More
Iterate over object keys in node.js
Problem
Since Javascript 1.7 there is an Iterator object, which allows this:
var a={a:1,b:2,c:3};
var it=Iterator(a);
function iterate(){
try {… Read More
Implement a map that satisfies below conditions.a. It should treat keys case insensitively. For example, the key "India", "INDIA", "inDIA" are treated as equal and there is only… Read More
Node.js script should wait before service is running
Problem
I have a node.js script which starts at boot. It uses node-redis to create a client for Redis, but at boot Redis is not ready wh… Read More
Node.js / Expess.js is not recognizing static routes
Problem
I have the following settings (it's called by app.js) but i can't seem to get Node.js / Express.js to recognize the static route… Read More
Check each node.js request for authentication credentials
Problem
I'm using node.js with Express and connect-auth to authenticate users.
This is the verification when requesting /index:
i… Read More
Security Principles For Angular's Regular Web Applications -1. You should avoid direct use of the DOM APIs.2. You should enable Content Securi… Read More
Saving in mongoDb with Mongoose, unexpected elements saved
Problem
When I write in my mongoDB with mongoose the operation is treated with success, my document is saved, but there is also al… Read More
Anuj: Don't mark this Duplicate as i have tried the solution given in this questionI want to fatch data from restcountries apiMainActivity public class MainActivity extends AppCompatActivi… Read More
Check if every element in one array is in a second array
Problem
I have two arrays and I want to check if every element in arr2 is in arr1. If the value of an element is repeated in arr2, i… Read More
In my previous blog, I wrote about the basics of Espresso and how we can set it up and use it.
In this blog, we will look at how we can test other components using Espresso. We will be cover… Read More
Muhammad Imanudin: I will encode user input into a single URL, I use Uri.encode but error response remains 400. how to make the encode work?the result is that "space" is replaced with "%20"… Read More
BlueTile: I am getting weird output from the Mapreduce code:Input:aa bb aa cc bb aa cc dd dd bb xx aa ss rrOutput:aa [email protected] aa org.mapredu… Read More
Mahdi.Pishguy: in laravel5 my code as :$data = Contents::whereSlug($content)->orWhere('id', '=', $content)->first();maybe return null. i want to manage that with custom message and sho… Read More
user630209: Auth Service is not logging out on refresh token 401 error occurred. Instead it goes to catchError.ts. How can the application handle this.Scenarios 1. Initially get access token… Read More
How do I overwride "getTime()" in node.js?
Problem
In my app.js (my main file), I want to override getTime();
So now, when I call created_at.getTime() in all of my node.js failes that stem… Read More
KarthikKPN: I am working in an Contact app where i have to list all the contacts from Contacts Database, but it contains duplicates.For example, Contact number (98*******33, +9198********33)… Read More
geoip-lite formatting of charecters
Problem
I have this code, which basically looks up an IP address when a user hits the http://domain.tld/stats/1.gif and uses the geoip-lite library to re… Read More
Today we're publishing the Release Candidate of TypeScript 2.7. To get started with the RC, you can access it through NuGet, or use npm with the following command:
npm install -g typescrip… Read More
Hasnain Ali Bohra: My Employee Class :-class Employee { String name; int age; public Employee(String name, int age) { this.name = name; this.age = age; } public… Read More
Today we're proud to announce the release of TypeScript 2.7!
If you're not familiar with TypeScript, it's a language that brings optional static types to JavaScript by building on JavaScrip… Read More
Node.js SlowBuffer detection
Problem
I added an xor method to the buffer class that make sure that argument instanceof Buffer. The require('crypto') has a method of randomBytes that gives a… Read More
Possible binding loss in Expressjs?
Problem
so I am running into what I think is a binding issue, caused by connect-mongo or expressjs Here is the code:
//Error
app.use(function(err, r… Read More