Found 34486 Articles for Programming

Plotting Google Map using gmplot package in Python?

karthikeya Boyini
Updated on 30-Jun-2020 09:05:26

3K+ Views

There are numerous ways you can draw geographical coordinates on Google Maps. However, in case you want to save it in a local file, one better way to accomplish is through a python module called gmplot.Python library gmplot allows us to plot data on google maps. gmplot has a matplotlib-like interface to generate the HTML and javascript to deliver all the additional data on top of Google Maps.InstallationIt is easy to install gmplot using pip incase gmplot is not already installed −pip install gmplotOn running above command, you may see output something like −From above, we can see the latest ... Read More

Simple registration form using Python Tkinter

Samual Sam
Updated on 30-Jul-2019 22:30:24

19K+ Views

Tkinter is a python library for developing GUI (Graphical User Interfaces). We use the tkinter library for creating an application of UI (User Interface), to create windows and all other graphical user interfaces.If you’re using python 3.x(which is recommended), Tkinter will come with Python as a standard package, so we don’t need to install anything to use it.Before creating a registration form in Tkinter, let’s first create a simple GUI application in Tkinter.Creating a simple GUI applicationBelow is the program to create a window by just importing Tkinter and set its title −from tkinter import * from tkinter import ttk ... Read More

Python Vs Ruby, which one to choose?

Sai Subramanyam
Updated on 30-Jul-2019 22:30:24

81 Views

First thing comes in my mind, why to compare these two language only? This may be because both are interpreted, agile languages with an object oriented philosophy and very huge communities support. However, though both languages share some ideas, syntax elements and have almost the same features the two communities have nothing in common.Both the languages are very popular among the developer’s community (This is also one of the reasons to compare). Below are the top ten most popular languages in 2018 on GitHub based on opened pull request −Top 10 most popular languages on GitHub based on opened pull ... Read More

Basics of Discrete Event Simulation using SimPy in Python

Samual Sam
Updated on 30-Jul-2019 22:30:24

554 Views

SimPy (rhymes with “Blimpie”) is a python package for process-oriented discrete-event simulation.InstallationThe easiest way to install SimPy is via pip:pip install simpyAnd the output you may get will be something like, At the time of writing, simpy-3.0.11 is the most recent version of SimPy, and we will use it for all the below examples.In case, SimPy is already installed, use the –U option for pip to upgrade.pip install –U simpyNote: You need to have python 2.7 or above version and for Linux/Unix/MacOS you may need root privileges to install SimPy.To check if SimPy was successfully installed, open a python shell ... Read More

Name validation using Java Regular Expressions

Fendadis John
Updated on 30-Jul-2019 22:30:24

1K+ Views

The name can be validated using the java.util.regex.Pattern.matches() method. This method matches the regular expression for the name and the given input name and returns true if they match and false otherwise.A program that demonstrates this is given as follows:Example Live Demopublic class Demo {    public static void main(String args[]) {       String name = "John Harry Smith";       String regexName = "\p{Upper}(\p{Lower}+\s?)";       String patternName = "(" + regexName + "){2, 3}";       System.out.println("The name is: " + name);       System.out.println("Is the above name valid? " + name.matches(patternName));   ... Read More

Split a string around a particular match in Java

Arushi
Updated on 30-Jul-2019 22:30:24

269 Views

The specified string can be split around a particular match for a regex using the String.split() method. This method has a single parameter i.e. regex and it returns the string array obtained by splitting the input string around a particular match for the regex.A program that demonstrates splitting a string is given as follows:Example Live Demopublic class Demo {    public static void main(String args[]) {       String regex = "_";       String strInput = "The_sky_is_blue";       System.out.println("Regex: " + regex);       System.out.println("Input string: " + strInput);       String[] strArr = ... Read More

Demonstrate the usage of the Pattern.split() method in Java

Vikyath Ram
Updated on 30-Jul-2019 22:30:24

65 Views

The specified input sequence can be split around a particular match for a pattern using the java.util.regex.Pattern.split() method. This method has a single parameter i.e. the input sequence to split and it returns the string array obtained by splitting the input sequence around a particular match for a pattern.A program that demonstrates the method Pattern.split() in Java regular expressions is given as follows:Example Live Demoimport java.util.regex.Pattern; public class Demo {    public static void main(String[] args) {       String regex = "_";       String input = "Oranges_are_orange";       System.out.println("Regex: " + regex);       ... Read More

Validate Email address in Java

Arushi
Updated on 30-Jul-2019 22:30:24

3K+ Views

The Email address can be validated using the java.util.regex.Pattern.matches() method. This method matches the regular expression for the E-mail and the given input Email and returns true if they match and false otherwise.A program that demonstrates this is given as follows:Example Live Demopublic class Demo {    static boolean isValid(String email) {       String regex = "^[\w-_\.+]*[\w-_\.]\@([\w]+\.)+[\w]+[\w]$";       return email.matches(regex);    }    public static void main(String[] args) {       String email = "john123@gmail.com";       System.out.println("The E-mail ID is: " + email);       System.out.println("Is the above E-mail ID valid? " + ... Read More

Pattern.matches() method in Java Regular Expressions

Vikyath Ram
Updated on 30-Jul-2019 22:30:24

153 Views

The java.util.regex.Pattern.matches() method matches the regular expression and the given input. It has two parameters i.e. the regex and the input. It returns true if the regex and the input match and false otherwise.A program that demonstrates the method Pattern.matches() in Java regular expressions is given as follows:Example Live Demoimport java.util.regex.Pattern; public class Demo {    public static void main(String args[]) {       String regex = "a*b";       String input = "aaab";       System.out.println("Regex: " + regex);       System.out.println("Input: " + input);       boolean match = Pattern.matches(regex, input);       ... Read More

Reset the Matcher in Java Regular Expressions

Rishi Raj
Updated on 30-Jul-2019 22:30:24

69 Views

The Matcher can be reset using the java.util.regex.Matcher.reset() method. This method returns the reset Matcher.A program that demonstrates the method Matcher.reset() in Java regular expressions is given as follows:Example Live Demoimport java.util.regex.Matcher; import java.util.regex.Pattern; public class MainClass {    public static void main(String args[]) {       Pattern p = Pattern.compile("(a*b)");       Matcher m = p.matcher("caaabcccab");       System.out.println("The input string is: caaabcccab");       System.out.println("The Regex is: (a*b)");       System.out.println();       while (m.find()) {          System.out.println(m.group());       }       m.reset();       System.out.println("The ... Read More

Advertisements