Remove Element from IdentityHashMap in Java

Chandu yadav
Updated on 30-Jul-2019 22:30:24

168 Views

Use the remove() method to remove an element from IdentityHashMap.Let us create IdentityHashMap and add some elementsMap m = new IdentityHashMap(); m.put("1", 100); m.put("2", 200); m.put("3", 300); m.put("4", 150); m.put("5", 110); m.put("6", 50); m.put("7", 90); m.put("8", 250); m.put("9", 350); m.put("10", 450);Let’s say you need to remove 2 from the Map. For that, use the remove() methodm.remove("2");The following is an example to remove an element from Java IdentityHashMapExample Live Demoimport java.util.*; public class Demo {    public static void main(String[] args) {       Map m = new IdentityHashMap(); m.put("1", 100); ... Read More

Performing MySQL-like Comparison on an INT Field

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

723 Views

You need to use cast() method to perform comparison on an INT field. The syntax is as follows −SELECT yourColumnName1, yourColumnName2, ......N yourTableName WHERE CAST(yourColumnName as CHAR) LIKE ‘%yourIntegerValue%’;To understand the above syntax, let us create a table. The following is the query to create a table for performing a LIKE comparison on INT field −mysql> create table ComparisonOnIntField    -> (    -> StudentId int NOT NULL,    -> StudentName varchar(20),    -> StudentAge int    -> ); Query OK, 0 rows affected (1.00 sec)Insert some records in the table to perform a MySQL LIKE comparison on an INT ... Read More

Maximize Learning in Boring or Difficult Classes

Ridhi Arora
Updated on 30-Jul-2019 22:30:24

110 Views

Students often run away from the subjects or classes they find boring or difficult. While the subject that they dislike differs from student to student. It becomes very difficult to be mentally present in a class where a boring subject is taught or when the way of teaching the teacher is either boring or complex. Here are some tips to make learning an enjoyable experience even if the subject lacks interest or the teacher does not know how to add interest.Know that It Is Still A Part Of SyllabusNo matter how boring the subject is, it is still going to ... Read More

Implementation of Dynamic Array in Python

karthikeya Boyini
Updated on 30-Jul-2019 22:30:24

14K+ Views

Dynamic ArrayIn python, a list, set and dictionary are mutable objects. While number, string, and tuple are immutable objects. Mutable objects mean that we add/delete items from the list, set or dictionary however, that is not true in case of immutable objects like tuple or strings.In python, a list is a dynamic array. Let's try to create a dynamic list −>>> #Create an empty list, named list1 >>> list1 = [] >>> type (list1) Add some items onto our empty list, list1 −>>> # Add items >>> list1 =[2, 4, 6] >>> list1 [2, 4, 6] >>> # Another way ... Read More

Extract Day, Month, Year from Timestamp in PHP MySQL

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

893 Views

To extract the Day/Month/Year from a timestamp, you need to use the date_parse() function. The syntax as follows −print_r(date_parse(“anyTimeStampValue”));The PHP code is as follows −$yourTimeStampValue="2019-02-04 12:56:50"; print_r(date_parse($yourTimeStampValue));The snapshot of PHP code is as follows −The following is the output −Array ( [year] => 2019 [month] => 2 [day] => 4 [hour] => 12 [minute] => 56 [second] => 50 [fraction] => 0 [warning_count] => 0 [warnings] => Array ( ) [error_count] => 0 [errors] => Array ( ) [is_localtime] => )The snapshot of the sample output −

Display Timezone in Z Format in Java

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

277 Views

The z format means General Time Zone. We will use it like this.SimpleDateFormat("z");Let us see an example −// displaying timezone in z format SimpleDateFormat simpleformat = new SimpleDateFormat("z"); String strTimeZone = simpleformat.format(new Date()); System.out.println("TimeZone in z format = "+strTimeZone);Above, we have used the SimpleDateFormat class, therefore the following package is imported −import java.text.SimpleDateFormat;The following is an example −Example Live Demoimport java.text.Format; import java.text.SimpleDateFormat; import java.util.Date; import java.util.Calendar; public class Demo { public static void main(String[] args) throws Exception { // displaying current date and time Calendar ... Read More

Use COUNT to Get All Records in MySQL

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

161 Views

Whenever you want all the values like not null for a column then use count(*). This is faster than using count() method.The syntax to use count(*) is as follows −select count(*) as anyVariableName from yourTableName;To understand the above concept, let us first create a table. The query to create a table is as follows −mysql> create table CountingDemo    -> (    -> BookId int    -> ); Query OK, 0 rows affected (0.60 sec)Insert some records in the table using insert command. The query is as follows −mysql> insert into CountingDemo values(100); Query OK, 1 row affected (0.13 sec) ... Read More

Find Largest Number in an Array Using 8085 Microprocessor

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

25K+ Views

In this program we will see how to find the largest number from a block of bytes using 8085.Problem StatementWrite 8085 Assembly language program to find the largest number from a block of bytes.DiscussionIn this program the data are stored at location 8001H onwards. The 8000H is containing the size of the block. After executing this program, it will return the largest number and store it at location 9000H.Logic is simple, we are taking the first number at register B to start the job. In each iteration we are getting the number from memory and storing it into register A. ... Read More

Display Timezone in ZZZZ Format in Java

karthikeya Boyini
Updated on 30-Jul-2019 22:30:24

358 Views

Use the zzzz format like this for TimeZone.SimpleDateFormat("zzzz");Let us see an example −// displaying timezone in zzzz format simpleformat = new SimpleDateFormat("zzzz"); String strTimeZone = simpleformat.format(new Date()); System.out.println("TimeZone in zzzz format = "+strTimeZone);Above, we have used the SimpleDateFormat class, therefore the following package is imported −import java.text.SimpleDateFormat;The following is an example −Example Live Demoimport java.text.Format; import java.text.SimpleDateFormat; import java.util.Date; import java.util.Calendar; public class Demo { public static void main(String[] args) throws Exception { // displaying current date and time Calendar cal = Calendar.getInstance(); ... Read More

Simulate an Array Variable in MySQL

Ankith Reddy
Updated on 30-Jul-2019 22:30:24

2K+ Views

Instead of simulating an array variable, use temporary table in MySQL. The syntax is as follows −create temporary table if not exists yourTemporaryTableName select yourColumnName1, yourColumnName2, ......N from yourTableName where conditionTo understand the above syntax, let us first create a table. The query to create a table is as follows −mysql> create table SimulateArrayDemo -> ( -> Id int, -> FirstName varchar(100), -> LastName varchar(100 -> ) -> ); Query OK, 0 rows affected (1.25 sec)Insert some records in the table using ... Read More

Advertisements