How to loop through Collection
To loop through a collection in java we have 2 options:1. loop using iterator: Iterator<string> iterator = myCollection.iterator(); while (iterator.hasNext()) { …
To loop through a collection in java we have 2 options:1. loop using iterator: Iterator<string> iterator = myCollection.iterator(); while (iterator.hasNext()) { …
In this example I demonstrate the implementation of cookie extraction and interception in Angular (5, 6, 7).The application server (tomcat) implements Spring Security with CSRF token response with the following…
This program simulates a year of euromillions-alike game of luck. Each year it is assumed that it has 121 lotteries and it is assumed that the number of players per…
The birthday paradox claims that if there are 23 people in the same room, then the chance 2 of them to have birthday on the same day is 50%.The following…
An easy piece of code to write to a file: BufferedWriter out = new BufferedWriter (new OutputStreamWriter(new FileOutputStream("c:\\LOGS\\MyParameter.txt"),"UTF-8")); out.write("parameter: " + parameter); …
To set encoding to unicode in Tomcat, just add URIEncoding="UTF-8" in the server.xml file at the section "Connector", like the following example: <Connector port="8080" protocol="HTTP/1.1" connectionTimeout="20000" redirectPort="8443" URIEncoding="UTF-8"/>
The procedure below receives a SYS_RefCursor as a parameter and constructs a simple JSON in Oracle 11g: procedure get_json_fnc(P_RS_i Sys_Refcursor) is P_RS SYS_REFCURSOR; L_COLS NUMBER; L_DESC DBMS_SQL.DESC_TAB; L_CURS INTEGER; …
Sometimes in PL/SQL programming we need to switch the logic between different SQL queries, but fetching from cursors into predefined variables is painful.In the following example we define 2 cursors…
The following piece of code shows how you can load data from a comma separated values file directly into a MySQL table:LOAD DATA LOCAL INFILE 'C:/documents/agenda.txt' IGNORE INTO TABLE agenda…
The following examples illustrate the functionality of NUMBER data type precision and scale: