JavaScript Function.prototype.bind() Example

JavaScript
JavaScript Function.prototype.bind() Method description The bind() method creates a new function that, when called, has its this keyword set to the provided value, with a given sequence of arguments preceding any provided when the new function is called. Show full syntax. Syntax [crayon-5a37803ab0674745217396/] Parameters thisArg The value to be passed as the this parameter to the target function when the bound function is called. The value is ignored if the bound function is constructed using the new operator. arg1, arg2, ... Arguments to prepend to arguments provided to the bound function when invoking the target function. Return value A copy of the given function with the specified this value and initial arguments. In depth description You can find the full definition of Function.prototype.bind() on developer.mozilla.org. Examples [crayon-5a37803ab0687342044390/] You can find…
Read More
Creating a TypeScript “non-enumerable” property decorator

Creating a TypeScript “non-enumerable” property decorator

TypeScript
Creating a TypeScript "non-enumerable" property decorator This post explains how to create a TypeScript property decorator that allows hiding a class property in enumerators. If you are new to TypeScript or it's decorators, you might start here first. Why should I be able to exclude a class property from being enumerated Well, one good reason is to exclude the property from being included in the JSON representation of the class instance. For example, let's look at a simple class: [crayon-5a37803ab1482683506401/] Now let's look at the JSON representation of a class instance: [crayon-5a37803ab148d188109857/] This will print [crayon-5a37803ab1493880169094/] OK, so we do not want our password to be serialized in our JSON. Let's create a decorator to prevent this. Creating the decorator Put the following code into a TypeScript file. [crayon-5a37803ab1498279154917/] Make…
Read More
How to delete a file with a path too long to be deleted in 3 easy steps

How to delete a file with a path too long to be deleted in 3 easy steps

Windows
How to delete a file with a path too long to be deleted in 3 easy steps: Did you ever try to delete a folder and got that annoying message that one or more files could not be deleted because their path was too long? This tutorial will show you how to delete these files in 3 easy steps: Step 1: make an empty folder Just make an empty folder, for example in the parent folder of the folder that needs to be deleted. We will remove this empty folder again in the last step. mkdir empty_dir Step 2: move all files to the newly created empty folder We will use "robocopy" to move all files to the root of the new folder. This will remove the long paths of…
Read More
Raspberry PI 3: How to install NodeJS in 4 easy steps

Raspberry PI 3: How to install NodeJS in 4 easy steps

IOT, Raspberry PI
Raspberry PI 3: How to install NodeJS in 4 easy steps When you unbox a Raspberry PI 3, it comes with a rather old NodeJS version pre-installed. This tutorial will help you installing the latest version of NodeJS on your Raspberry PI 3, which is currently 5.0. Step 1: download newest version of NodeJS The first thing to do is to download the latest version of NodeJS. This is at time of writing version 5.0. U can lookup the latest version at https://nodejs.org/dist, but be sure to take the node-vX.Y.Z-linux-armv7l.tar.gz version. wget https://nodejs.org/dist/v5.0.0/node-v5.0.0-linux-armv7l.tar.gz Step 2: unpack the downloaded file Now that we've got the latest distribution, we need to unpack this file: tar -xvf node-v5.0.0-linux-armv7l.tar.gz Step 3: copy the files to /usr/local Now we need to copy all the unpacked…
Read More

How to compare two Dates in Java.

Java
This code snippet shows you how to compare a Date to another in Java. In order to do this check, we use the compareTo operator of the java.util.Date class. The java.util.Date.compareTo(Date anotherDate) compares a Date Object with the specified Date value. The default usage is [crayon-5a37803ab1cb5658301888/] where is one of these six comparison operators: [ , >=, !=,
Read More

How to compare two BigDecimals in Java.

Java
This code snippet shows you how to compare a BigDecimal to another in Java. In order to do this check, we use the compareTo operator of the java.math.BigDecimal class. The java.math.BigDecimal.compareTo(BigDecimal val) compares a BigDecimal Object with the specified BigDecimal value. The default usage is [crayon-5a37803ab2277850682293/] where is one of these six comparison operators: [ , >=, !=,
Read More

How to get all images from a word document

Windows
This article shows how to get all images from a word document Sometimes you just want to save all images that are inside a Word document. Saving the all manually can be a tedious task. So here is how you can drastically speed up this task: Open the Word document in any recent version of Microsoft Word. Once opened, select "Save As" [caption id="attachment_898" align="alignnone" width="805"] Word - Save as[/caption] Next, select "Browse" and select Save as type: "Web Page, Filtered (*.htm; *.html)" [caption id="attachment_901" align="alignnone" width="948"] Word - Save as Web Page[/caption] Select save and navigate in Explorer to the folder where you saved the file. [caption id="attachment_904" align="alignnone" width="799"] Exported images folder[/caption] There are the exported images: [caption id="attachment_905" align="alignnone" width="717"] Exported images[/caption] Conclusion This article shows you…
Read More

How to create a symbolic link on windows

Windows
This article shows you how to create a symbolic link on Windows. If you want to easily access folders and files from different folders without maintaining duplicate copies, then it's a good idea to use Symbolic Links. One handy trick you can pull with Symbolic links is synchronizing any folder with Dropbox without moving it actually into your dropbox folder. Read on to see how this can be done. Creating a symbolic link You can create a symbolic link with the mklink command, which stands for... "make link". Open a command box and type mklink to see the options: [crayon-5a37803ab28b1232623865/] [caption id="attachment_879" align="alignnone" width="677"] mklink command[/caption] You have some different options: [crayon-5a37803ab28bc647019373/] In this example we will create a hard link between two folders. Soft-links are very easily created in…
Read More

How to set the default browser on your Android device

Android
This article explains how to set the default browser on your Android device. Now it has become clear that Google will no longer fix the security bugs in Webview on Android versions before KitKat (4.4), it is a good idea to switch your browser to a more secure browser. This article will show you how you can change the default browser on your Android device. Step 1: Clear the current browser that opens links Open the Settings application and tap on Apps. (On some versions of Android this button is labelled "Applications" and you may have to tap on Manage applications before the next step.) Tap on the All tab. Tap on the current browser that opens links. This is usually the default browser which is called "Browser" or "Internet". Tap on Clear…
Read More