In this example you will learn how to generate RSA-OAEP key pair and how to convert private key from this key pair to base64 so you can use it with OpenSSL etc. Please note that this process can also be used for public key you just have to use prefix and suffix below:
-----BEGIN PUBLIC KEY-----
--...
So, have you ever wondered how to use your PEM RSA key pair that was generated by OpenSSL in Web Cryptography API? If the answers is yes. Great! You are going to find out.
NOTE: This process can also be used for public key, you only need to change prefix and suffix to:
-----BEGIN PUBLIC KEY-----
...
In the light of the latest httpoxy vulnerabilities, there is another variable, that is widely misused.
HTTP_X_FORWARDED_FOR is often used to detect the client IP address, but without any additional checks, this can lead to security issues, especially when this IP is later used for authentication or...
Suppose you want to prevent unauthorized users to access the page then you have to put barrier to them by authorizing access. We can do this by using spring-security which provides basic authentication by securing all HTTP end points. For that you need to add spring-security dependency to your proje...
C99
Since C99, C has variable length arrays, VLA, that model arrays with bounds that are only known at initialization time. While you have to be careful not to allocate too large VLA (they might smash your stack), using pointers to VLA and using them in sizeof expressions is fine.
double sumAll(si...
There is a limit to the depth of possible recursion, which depends on the Python implementation. When the limit is reached, a RuntimeError exception is raised:
RuntimeError: Maximum Recursion Depth Exceeded
Here's a sample of a program that would cause this error:
def cursing(depth):
try:
...
When the only thing returned from a function is a recursive call, it is refered to as tail recursion.
Here's an example countdown written using tail recursion:
def countdown(n):
if n == 0:
print "Blastoff!"
else:
print n
countdown(n-1)
Any computat...
By default Python's recursion stack cannot exceed 1000 frames. This can be changed by setting the sys.setrecursionlimit(15000) which is faster however, this method consumes more memory. Instead, we can also solve the Tail Recursion problem using stack introspection.
#!/usr/bin/env python2.4
# This...
Dependencies can be added for specific configuration like test/androidTest
androidTestCompile 'com.android.support.test.espresso:espresso-core:2.2.1'
testCompile 'junit:junit:3.8.1'
Alternatively create your own configuration
configurations {
myconfig
}
And then download dependency fo...
Suppose we have an array of integers and we want to figure out the maximum value without holding the whole array in memory all at once. This approach can be adapted to handle a variety of other situations in which data needs to be processed while being deserialized instead of after.
extern crate se...
Selecting only the attribute value of a link:href will return the relative URL.
String bodyFragment =
"<div><a href=\"/documentation\">Stack Overflow Documentation</a></div>";
Document doc = Jsoup.parseBodyFragment(bodyFragment);
...
Placeholders can be used in strings to automatically substitute the values in the final string.
container = "cup"
liquid = "coffee"
string = "Filling the #{container} with #{liquid}..."
The above String - when printed - will say: Filling the cup with coffee...
Yo...
GHCi supports imperative-style breakpoints out of the box with interpreted code (code that's been :loaded).
With the following program:
-- mySum.hs
doSum n = do
putStrLn ("Counting to " ++ (show n))
let v = sum [1..n]
putStrLn ("sum to " ++ (show n) ++ " = "...
Sometimes we need to change words position from one place to another or reduce size of the words and change the color of words automatically to improve the attraction of our website or web apps. JQuery helps a lot with this concept using fadeIn(), hide(), slideDown() but its functionality are limite...
A singleton is a pattern that restricts the instantiation of a class to one instance/object. For more info on python singleton design patterns, see here.
class Singleton:
def __new__(cls):
try:
it = cls.__it__
except AttributeError:
it = cls.__it__ =...
The TinkerPop "toy graphs" make it possible to quickly try out some basic features of Gremlin. These graphs are pre-built and packaged with the Gremlin Console. The most commonly used "toy graphs" are "Modern" and "The Crew". When asking questions on StackOver...
Many bugs in knockout data binds are caused by undefined properties in a viewmodel. Knockout has two handy methods to retrieve the binding context of an HTML element:
// Returns the binding context to which an HTMLElement is bound
ko.contextFor(element);
// Returns the viewmodel to which ...
CREATE TABLE all_floating_numeric_types(
c_float float,
c_double double
);
Minimum and maximum data values:
insert into all_floating_numeric_types values (-3.4028235E38,-1.7976931348623157E308);
insert into all_floating_numeric_types values (-1.4E-45,-4.9E-324);
insert into all_floatin...