Tutorial by Examples: c

Redis provides seven different operations for working with scripts: Eval operations (EVAL, EVALSHA) SCRIPT operations (DEBUG, EXISTS, FLUSH, KILL, LOAD) The EVAL command evaluates a script provided as a string argument to the server. Scripts can access the specified Redis keys named as argum...
/** * Resizes an image using a Graphics2D object backed by a BufferedImage. * @param srcImg - source image to scale * @param w - desired width * @param h - desired height * @return - the new resized image */ private BufferedImage getScaledImage(Image srcImg, int w, int h){ //Cre...
Be aware that the WebBrowser control is not sympathetic to your XAML definition, and renders itself over the top of other things. For example, if you put it inside a BusyIndicator that has been marked as being busy, it will still render itself over the top of that control. The solution is to bind th...
Selection sort is noted for its simplicity. It starts with the first element in the array, saving it's value as a minimum value (or maximum, depending on sorting order). It then itterates through the array, and replaces the min value with any other value lesser then min it finds on the way. That min...
Since we have many different algorithms to choose from, when we want to sort an array, we need to know which one will do it's job. So we need some method of measuring algoritm's speed and reliability. That's where Asymptotic analysis kicks in. Asymptotic analysis is the process of describing the ef...
Quicksort is one of the advanced algorithms. It features a time complexity of O(n log n) and applies a divide & conquer strategy. This combination results in advanced algorithmic performance. Quicksort first divides a large array into two smaller sub-arrays: the low elements and the high element...
g + geom_bar(aes(x = cut, fill = color), position = "fill") + guides(fill = guide_legend(title = NULL))
g + geom_bar(mapping = aes(x = cut, fill = clarity), position = "dodge") + theme(axis.text = element_text(colour = "red", size = 12))
g + geom_histogram(aes(price, fill = cut), binwidth = 500) + labs(x = "Price", y = "Number of diamonds", title = "Distribution of prices \n across Cuts") + theme(plot.title = element_text(colour = "red", face = "italic"), ...
We show a plot similar to the showed at Linear regression on the mtcars dataset. First with defaults and the with some customization of the parameters. #help("mtcars") fit <- lm(mpg ~ wt, data = mtcars) bs <- round(coef(fit), 3) lmlab <- paste0("mpg = ", bs[1], ...
This is the typical approach for novice developers building SQL action queries. They are vulnerable to the Bobby Tables type SQL Injection attacks. Dim strSQL As String strSQL = "INSERT INTO Employees chrFirstName, chrLastName, chrPhone " _ & "VALUES ('" & M...
This approach will prevent a user from embedding a second SQL statement in their input for execution. Dim strSQL As String Dim db As DAO.Database Dim qdf As DAO.QueryDef strSQL = "PARAMETERS [FirstName] Text(255), [LastName] Text(255), [Phone] Text(255); " _ & "INS...
// create the dictionary that will be sent to the blocks var myDictionary:Dictionary<String, Any> = Dictionary<String, Any>() myDictionary["InitialKey"] = "InitialValue" // create block queue let myBlockQueue:MKBlockQueue = MKBlockQueue() // block 1 let b1...
First we need a table to hold our data class CreateUsers < ActiveRecord::Migration def change create_table :users do |t| t.string :name t.string :password t.string :type # <- This makes it an STI t.timestamps end end end Then lets create some ...
Let's apply the State Machine pattern for parsing lines with the specific pattern using S4 Class feature from R. PROBLEM ENUNCIATION We need to parse a file where each line provides information about a person, using a delimiter (";"), but some information provided is optional, and instea...
UILabel, UITextField, & UITextView classes have a new property starting from iOS 10 for automatically resizing their font when a user changes their preferred reading size named adjustsFontForContentSizeCategory. Swift @IBOutlet var label:UILabel! if #available(iOS 10.0, *) { label.adju...
(clj-time/date-time 2017 1 20) Gives you a Joda time of 20th Jan 2017 at 00:00:00. Hours, minutes and seconds can also be specified as (clj-time/date-time year month date hour minute second millisecond)
In the directory if the xcodeproj, create a new file called Podfile. The following is an example of a Podfile that installs the pod 'AFNetworking' version 1.0 to the app MyApp. target 'MyApp' pod 'AFNetworking', '~> 1.0'
Graph In computer science, a graph is an abstract data type that is meant to implement the undirected graph and directed graph concepts from mathematics. A graph data structure consists of a finite (and possibly mutable) set of vertices or nodes or points, together with a set of unordered pairs of...

Page 712 of 826