Processlist
This will show all active & sleeping queries in that order then by how long.
SELECT * FROM information_schema.PROCESSLIST ORDER BY INFO DESC, TIME DESC;
This is a bit more detail on time-frames as it is in seconds by default
SELECT ID, USER, HOST, DB, COMMAND,
TIME as time_second...
This example just illustrates how this keyword can be used.
int a = 10;
// Assume that type of variable 'a' is not known here, or it may
// be changed by programmer (from int to long long, for example).
// Hence we declare another variable, 'b' of the same type using
// decltype keyword.
de...
Let's say we have vector:
std::vector<int> intVector;
And we want to declare an iterator for this vector. An obvious idea is to use auto. However, it may be needed just declare an iterator variable (and not to assign it to anything). We would do:
vector<int>::iterator iter;
Howev...
One problem with the PIVOT query is that you have to specify all values inside the IN selection if you want to see them as columns.
A quick way to circumvent this problem is to create a dynamic IN selection making your PIVOT dynamic.
For demonstration we will use a table Books in a Bookstore’s dat...
This example demonstrates the use of GET, POST, PUT and DELETE HTTP Methods in doing CRUD operations on a REST resource
I am using the below software, frameworks and tools:
Jersey 2.25.1
JDK 1.7.x (Java 7)
Eclipse IDE Kepler
Apache Maven 3.3.9
Apache Tomcat 7.x
Please follow the below ste...
To have a look of the different functionalities of the hybris platform, you can use the install recipes. For this, just download the HYBRISCOMMXXXX_X-XXXXXXXX.ZIP and extract it to you local device. Than go through the following steps:
The <recipe_names> you can find under the folder \hybris\...
The first standalone R script
Standalone R scripts are not executed by the program R (R.exe under Windows), but by a program called Rscript (Rscript.exe), which is included in your R installation by default.
To hint at this fact, standalone R scripts start with a special line called Shebang line, ...
For this example we will test the sum method of a simple calculator.
In this example we will test the application: ApplicationToTest. This one has a class called Calc. This class has a method Sum().
The method Sum() looks like this:
public void Sum(int a, int b)
{
return a + b;
}
The un...
Getting a single frame from a movie ( supports only AVC, H.264 in MP4, ISO BMF, Quicktime container ):
int frameNumber = 150;
BufferedImage frame = FrameGrab.getFrame(new File("filename.mp4"), frameNumber);
ImageIO.write(frame, "png", new File("frame_150.png"));
G...
Java Singleton Pattern
To implement Singleton pattern, we have different approaches but all of them have following common concepts.
Private constructor to restrict instantiation of the class from other classes.
Private static variable of the same class that is the only instance of the class.
P...
Lets assume that we have a complex api, with many generic views and some generic viewsets. We want to enable PageNumberPagination to every view, except one (either generic view or viewset, does not make a difference) for which we want a customized case of LimitOffsetPagination.
To achieve that we n...
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view, typically from a nib.
let imageView = UIImageView(frame: CGRect(x: CGFloat(0), y: CGFloat(50), width: CGFloat(320), height: CGFloat(320)))
view.addSubview(imageVi...
Q-learning is a variant of model-free reinforcement learning. In Q-learning we want the agent to estimate how good a (state, action) pair is so that it can choose good actions in each state. This is done by approximating an action-value function (Q) that fits in equation below:
Where s and a are ...
Ex1:-
let str1 = 'stackoverflow';
let str2 = 'flowerovstack';
These strings are anagrams.
// Create Hash from str1 and increase one count.
hashMap = {
s : 1,
t : 1,
a : 1,
c : 1,
k : 1,
o : 2,
v : 1,
e : 1,
r : 1,
f : 1,
l : 1,
w : 1...
(function(){
var hashMap = {};
function isAnagram (str1, str2) {
if(str1.length !== str2.length){
return false;
}
// Create hash map of str1 character and increase value one (+1).
createStr1HashMap(str1);
/...
The NamedParameterJdbcTemplate class adds support for programming
JDBC statements using named parameters, as opposed to programming JDBC
statements using only classic placeholder ( '?') arguments. The
NamedParameterJdbcTemplate class wraps a JdbcTemplate, and
delegates to the wrapped JdbcTempl...
This example shows how to create a pyramid using borders and 2D transformation methods skewY() and rotate() on pseudo elements.
HTML:
<div class="pyramid"></div>
CSS:
.pyramid {
width: 100px;
height: 200px;
position: relative;
margin: 50px;
}
.pyramid::b...
Option Explicit
Sub CheckWorksheetsDiagram()
Debug.Print Worksheets(1).Name
Debug.Print Charts(1).Name
Debug.Print Sheets(1).Name
End Sub
The result:
Sheet1
Chart1
Chart1