Tutorial by Examples: df

For getting the next 10 rows just run this query: SELECT * FROM TableName ORDER BY id OFFSET 10 ROWS FETCH NEXT 10 ROWS ONLY; Key points to consider when using it: ORDER BY is mandatory to use OFFSET and FETCH clause. OFFSET clause is mandatory with FETCH. You can never use, ORDER BY … FETC...
The first to thing to have: a model that contains a has_many relation with another model. class Project < ApplicationRecord has_many :todos end class Todo < ApplicationRecord belongs_to :project end In ProjectsController: class ProjectsController < ApplicationController d...
//set the total value of cells in range A1 - A25 into A27 worksheet.Cells["A27"].Formula = "=SUM(A1:A25)"; //set the number of cells with content in range C1 - C25 into C27 worksheet.Cells["C27"].Formula = "=COUNT(C1:C25)"; //fill column K with the s...
Main layout : activity_main.xml <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/activity_main" android:layout_width="match_parent" android:layo...
import org.apache.spark.sql.functions._ // Create a function that uses the content of the column inside the dataframe val code = (param: String) => if (param == "myCode") 1 else 0 // With that function, create the udf function val myUDF = udf(code) // Apply the udf to a column in...
iOS 10 Now Requires User Permission to Access Media Library, Photos, Camera and other Hardware like these. The solution for this is to add their keys into info.plist with description for user that how we are using their data , iOS already required permissions to access microphone, camera, and m...
The package clause is not directly binded with the file where it is found. It is possible to find common elements of the package clause in diferent files. For example, the package clauses bellow can be found in the file math1.scala and in the file math2.scala. File math1.scala package org { ...
One common pitfall is to try and use this in a nested function or an object, where the context has been lost. document.getElementById('myAJAXButton').onclick = function(){ makeAJAXRequest(function(result){ if (result) { // success this.className = 'success'; } }) }...
from subprocess import check_call ok = check_call(['ffmpeg','-i','input.mp3','output.wav']) if ok: with open('output.wav', 'rb') as f: wav_file = f.read() note: http://superuser.com/questions/507386/why-would-i-choose-libav-over-ffmpeg-or-is-there-even-a-difference What are ...
bcadd vs float+float var_dump('10' + '-9.99'); // float(0.0099999999999998) var_dump(10 + -9.99); // float(0.0099999999999998) var_dump(10.00 + -9.99); // float(0.0099999999999998) var_dump(bcadd('10', '-9.99', 20)); // string(22) "0.01000000000000000000&q...
You can pass parameters to the functions in tf.cond() using lambda and the code is as bellow. x = tf.placeholder(tf.float32) y = tf.placeholder(tf.float32) z = tf.placeholder(tf.float32) def fn1(a, b): return tf.mul(a, b) def fn2(a, b): return tf.add(a, b) pred = tf.placeholder(tf....
Flask also allows access to a CombinedMultiDict that gives access to both the request.form and request.args attributes under one variable. This example pulls data from a form field name submitted along with the echo field in the query string. Flask Example: from flask import Flask, request app...
$username = "[email protected]" $pwdTxt = Get-Content "C:\temp\Stored_Password.txt" $securePwd = $pwdTxt | ConvertTo-SecureString $credObject = New-Object System.Management.Automation.PSCredential -ArgumentList $username, $securePwd # Now, $credObject is having the credential...
public String getHighlightedText(final QueryResponse queryResponse, final String fieldName, final String docId) { String highlightedText = ""; Map<String, Map<String, List<String>>> highlights = queryResponse.getHighlighting(); if (highlights!=null &&am...
The Java Native Interface (JNI) allows you to call Java functions from native code. Here is a simple example of how to do it: Java code: package com.example.jniexample; public class JNITest { public static int getAnswer(bool) { return 42; } } Native code: int getTheAnswer(...
package MyHiveUDFs; import org.apache.commons.lang.StringUtils; import org.apache.hadoop.hive.ql.exec.UDF; import org.apache.hadoop.io.Text; public class Strip extends UDF { private Text result = new Text(); public Text evaluate(Text str) { if(str == null) { return null; } resul...
//Using statement for ExcelTable and TableStyles using OfficeOpenXml.Table; //Defining the tables parameters int firstRow =1; int lastRow = worksheet.Dimension.End.Row; int firstColumn = 1; int lastColumn = worksheet.Dimension.End.Column; ExcelRange rg = worksheet.Cells[firstRow, firstCol...
Typically, some files from the Web Application should not be overwritten when performing the deployment (e.g. web.config). This can be accomplished by: 1) Excluding from output - which means setting Build action to None. This is the easiest way, but it might not work for some particular files or fo...
First, you need to prepare the environment by creating the SQL Server table and the CSV file. Run the script below in SQL Server to create the SQL table either on a new database or an existing one. For this example, I used my ‘TrainingDB’ database. /* Creates table for Students.csv */ CREATE TABL...
Hadoop is an open-source software framework for storage and large-scale processing of data-sets in a distributed computing environment. It is sponsored by Apache Software Foundation. It is designed to scale up from single servers to thousands of machines, each offering local comput...

Page 17 of 21