- Download the Java Cryptography Extension (JCE) Unlimited Strength Jurisdiction Policy Files 6. (i.e. if the link is already dead then download this instead jce_policy-6.)
- Extract the downloaded archive and follow the installation procedure found in the README.txt.
- Download the following Bouncy Castle libraries:
- bcprov-jdk15to18-166.jar
- bctls-jdk15to18-166.jar
If the preceding links doesn't work try to find them from the archive.
- Place the downloaded libraries into ${JAVA_HOME}/jre/lib/ext directory.
- Update the java.security (i.e. found in ${JAVA_HOME}/jre/lib/security directory.) file to have the following as the priority:
security.provider.1=org.bouncycastle.jce.provider.BouncyCastleProvider security.provider.2=org.bouncycastle.jsse.provider.BouncyCastleJsseProvider
Adjust the other security.provider to start from 3 like the following:
security.provider.3=sun.security.provider.Sun security.provider.4=sun.security.rsa.SunRsaSign security.provider.5=com.sun.net.ssl.internal.ssl.Provider security.provider.6=com.sun.crypto.provider.SunJCE security.provider.7=sun.security.jgss.SunProvider security.provider.8=com.sun.security.sasl.Provider security.provider.9=org.jcp.xml.dsig.internal.dom.XMLDSigRI security.provider.10=sun.security.smartcardio.SunPCSC security.provider.11=sun.security.mscapi.SunMSCAPI
- Try the following Java code:
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.net.HttpURLConnection; import java.net.ProtocolException; import java.net.URL; public class Main { public static void main(String[] args) { try { URL url = new URL("https://www.nist.gov/"); System.out.println(url); HttpURLConnection connection = (HttpURLConnection) url.openConnection(); connection.setRequestMethod("GET"); connection.setDoOutput(true); System.out.println(connection.getResponseCode()); StringBuilder response = new StringBuilder(); BufferedReader reader = new BufferedReader(new InputStreamReader(connection.getInputStream())); try { String line = reader.readLine(); while (line != null) { response.append(line); line = reader.readLine(); } } finally { reader.close(); } System.out.println(response.toString()); } catch(ProtocolException exception) { exception.printStackTrace(); } catch(IOException exception) { exception.printStackTrace(); } } }You should be able to access it without any SSL handshake error.
Alternatively, you can opt to use the official JDK 6u121 via the Java SE 6 Advanced and Java SE 6 Support if you have availed of it.
Page 19 of 34
The method that allows to add methods to existing type without creating a new derived type, recompiling, or otherwise modifying the original type.
A method signature template with a return value and an argument
public static <T_RETURN> <METHOD_NAME>(this <T_TYPE> <VAR_NAME>, <T_ARG1_TYPE> <ARG1_NAME>)
| Token | Description |
| T_RETURN | The type of the return value. |
| METHOD_NAME | The desired name of the method. |
| T_TYPE | The existing type to extend. |
| VAR_NAME | The holder of an instance of the T_TYPE |
| T_ARG1_TYPE | Type of the first argument. |
| ARG1_NAME | The name of the first argument. |
This method is actually a static method but the first argument has the keyword this and the target type to extend. Also it holds the instance of the target type.
The T_RETURN and the argument part of the template are optional. Also the argument is not limited to just one, you can have as many as required by your extension.
To stage a file and name it executable at the same time you can use the following git command:
git add --chmod=+x <FILENAME>
Description
A member of a class that provides flexibility for exposing private fields.
Sample Property Declaration
//backing private field
private string prop;
public string ReadWriteProp {
get {
return prop;
}
set {
prop = value;
}
}
public string ReadOnlyProp {
get {
return prop;
}
}
public string WriteOnlyProp {
set {
prop = value;
}
}
Sample Auto-Implemented Property Declaration
A more concise property declaration especially if theres no additional logic required for the accessors.
public string ReadWriteProp {
get; set;
}
public string ReadOnlyProp {
get; private set;
}
public string WriteOnlyProp {
private get; set;
}
Definition
Delegate is a type that references methods with a particular parameter list and return type.
Printer Custom Delegate
public delegate void Printer<T>(T data);
A Method for Printer Delegate
static void ConsoleWrite<T>(T data) {
Console.WriteLine(data);
}
Reference the ConsoleWrite method with Printer delegate
Printer<String> consoleOut = new Printer<String>(ConsoleWrite);
consoleOut("test");
Usage
The virtual keyword allows to modify a method, property, indexer or event declaration and to be overridden in a derived class.
Example
public virtual double volume() {
return len * width * height
}
Covariant
The type can vary in the direction as the subclass.
Contravariant
The reverse of covariant.
Example in Generics
| Language | Covariant | Contravariant |
| C# | IList<out T> | IList<in T> |
| Java | List<? extends Number> | List<? super Integer> |
Description
These are delegates built-in with the framework and ready for your use.
List of Generic Delegates
| Delegate Name | Arguments | Returns | Comment |
|---|---|---|---|
| Action | void | ||
| Action<T1,T2,T3,T4, T5,T6,T7,T8, T9,T10,T11,T12, T13,T14,T15,T16> | (T1,T2,T3,T4, T5,T6,T7,T8, T9,T10,T11,T12, T13,T14,T15,T16) | void | This version of Action delegate can have 1 up to 16 arguments of different types. |
| Func<TResult> | TResult | ||
| Func<T1,T2,T3,T4, T5,T6,T7,T8, T9,T10,T11,T12, T13,T14,T15,T16,TResult> | (T1,T2,T3,T4, T5,T6,T7,T8, T9,T10,T11,T12, T13,T14,T15,T16) | TResult | This version of Func delegate can have 1 up to 16 arguments of different types. |
| Predicate<T> | T | bool |
The with clause is also known as common table expression (CTE) and subquery refactory. It is a temporary named result set.
SQL:1999 added the with clause to define "statement scoped views". They are not stored in the database scheme: instead, they are only valid in the query they belong to. This makes it possible to improve the structure of a statement without polluting the global namespace.
Syntax
with <QUERY_NAME_1> (<COLUMN_1>[, <COLUMN_2>][, <COLUMN_N>]) as
(<INNER_SELECT_STATEMENT>)
[,<QUERY_NAME_2> (<COLUMN_1>[, <COLUMN_2>][, <COLUMN_N>]) as
(<INNER_SELECT_STATEMENT>)]
<SELECT_STATEMENT>
Non-Recursive Example
with sales_tbl as (
select sales.*
from (VALUES
('Spiderman',1,19750),
('Batman',1,19746),
('Superman',1,9227),
('Iron Man',1,9227),
('Wonder Woman',2,16243),
('Kikkoman',2,17233),
('Cat Woman',2,8308),
('Ant Man',3,19427),
('Aquaman',3,16369),
('Iceman',3,9309)
) sales (emp_name,dealer_id,sales)
)
select ROW_NUMBER() over (order by dealer_id) as rownumber, *
from sales_tbl
Recursive Example
WITH [counter] AS (
SELECT 1 AS n -- Executes first and only once.
UNION ALL -- UNION ALL must be used.
SELECT n + 1 -- The portion that will be executed
FROM [counter] -- repeatedly until there's no row
-- to return.
WHERE n < 50 -- Ensures that the query stops.
)
SELECT n FROM [counter]



Recent Comments