Tutorial by Examples: c

Query SELECT st.name, st.percentage, CASE WHEN st.percentage >= 35 THEN 'Pass' ELSE 'Fail' END AS `Remark` FROM student AS st ; Result +--------------------------------+ | name | percentage | Remark | +--------------------------------+ | Isha | 67 | Pas...
You can make your very own custom viewport. It may have black bars, and it may or may not keep it's aspect ratio, depending on how you program it. A custom viewport would look something like this: public class Tutorial extends Viewport. You would need to override update(width, height), but that's it...
<script type="text/javascript" src="URL" async></script>
Progress bars can be styled with the progress[value] selector. This example gives a progress bar a width of 250px and a height of 20px progress[value] { width: 250px; height: 20px; } Progress bars can be especially difficult to style. Chrome / Safari / Opera These browsers use the -web...
For browsers that do not support the progress element, you can use this as a workaround. <progress max="100" value="20"> <div class="progress-bar"> <span style="width: 20%;">Progress: 20%</span> </div> </pr...
In Internet Explorer 10+ and Edge, Microsoft provides the -ms-high-contrast media selector to expose the "High Contrast" setting from the browser, which allows the programmer to adjust their site's styles accordingly. The -ms-high-contrast selector has 3 states: active, black-on-white, ...
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----- ...
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...
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...
We can declare a series of expressions in the REPL like this: Prelude> let x = 5 Prelude> let y = 2 * 5 + x Prelude> let result = y * 10 Prelude> x 5 Prelude> y 15 Prelude> result 150 To declare the same values in a file we write the following: -- demo.hs module De...
The following example creates a FileSystemWatcher to watch the directory specified at run time. The component is set to watch for changes in LastWrite and LastAccess time, the creation, deletion, or renaming of text files in the directory. If a file is changed, created, or deleted, the path to the f...
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) ++ " = "...
If you want to extract a subset of an array (i.e. numbers = [1, 2, 3, 4, 5, 6, 7, 8, 9]) you can easily do this with one of the following examples: numbers[0..2] will return [1, 2, 3] numbers[3...-2] will return [3, 4, 5, 6] numbers[-2..] will return [8, 9] numbers[..] will return [1, 2, 3, 4,...

Page 430 of 826