原创 MongoDB hello world example

A quick guide to show you how to do basic operations like create, update, find, delete record and indexing in Mongo

原创 Java MongoDB : Update document

In this tutorial, we show you how to use Java MongoDB API collection.update() to update documents. Test Data Assume

原创 Java – Check if key exists in HashMap

In Java, you can use the Map.containsKey() method to check if a key exists in a Map. TestMap.java package com.mkyon

原创 Python Whois client example

In this article, we will show you how to create a simple Whois client both in Python 2 and Python 3. Tested Python

原创 Java – How to split a string

To split a string, uses String.split(regex). Review the following examples : String phone = "012-3456789";

原创 Java – Math.pow example

A simple Math.pow example, display 2 to the power of 8. In Math 2^8 = 2x2x2x2x2x2x2x2 =256 In Java Math.pow(2, 8) N

原创 Java – How to delay few seconds

In Java, you can use Thread.sleep(miliseconds) to make the current executing Java program to sleep or delay few sec

原创 Python – How to loop a dictionary

In this tutorial, we will show you how to loop a dictionary in Python. 1. for key in dict: 1.1 To loop all the keys

原创 Python – Check if key exists in dictionary

In Python, you can use the in operator to check if a key exists in a dictionary. test.py def main(): fruits = {

原创 Spring MVC password example

In Spring MVC, you can use <form:password /> tag to render a HTML password field. For example, <form:password path=

原创 Python 3 TypeError: ‘str’ does not support the buffer interface

Review a Python 2 socket example whois.py import sys import socket s = socket.socket(socket.AF_INET, socket.SOCK_S

原创 Python 3 : Convert string to bytes

Code snippets to show you how to convert string to bytes and vice versa. 1. To convert a string to bytes. data = ""

原创 Java MongoDB : Delete document

In this tutorial, we show you how to use collection.remove() to delete documents from the collection. 1. Test Data

原创 Java – Display double in 2 decimal points

This article shows you a few examples to display a double variable in 2 decimal points format. 1. DecimalFormat exa

原创 Java – Convert String to int

In Java, you can use Integer.parseInt() to convert a String to int. 1. Integer.parseInt() Examples Example to conve