Tutorial by Examples: am

Creating a self-closing shortcode with parameters <?php function button_shortcode( $type ) { extract( shortcode_atts( array( 'type' => 'value' ), $type ) ); // check what type user entered switch ($type) { case 'twitter': ...
The Gson library provides Gson.class which handles all conversion between Java and JSON objects. An instance of this class can be created by invoking default constructor. You usually would like to have one Gson instance for the most part of operations in your program. Gson gson = new Gson(); Fir...
When using instances of QML files by directly declaring them, every property creates a binding. This is explained in the above examples. This is how you dynamically create components: var component = Qt.createComponent("Popup.qml"); var popup = component.createObject(parent, {"widt...
Q_OBJECT macro appears in private section of a class. Q_OBJECT requires the class to be subclass of QObject. This macro is necessary for the class to declare its signals/slots and to use Qt meta-object system. If Meta Object Compiler (MOC) finds class with Q_OBJECT, it processes it and generates C+...
When mapping many-to-many relationships in JPA, configuration for the table used for the joining foreign-keys can be provided using the @JoinTable annotation: @Entity public class EntityA { @Id @Column(name="id") private long id; [...] @ManyToMany @JoinTable(name=...
Create a new controller foreg ControllerName: "Home", ActionresultName :"Index" open AreaRegistraion.cs and add the controller name and action name to be rerouted to context.MapRoute( "nameofarea_default", "nameofarea/{controller}/...
Using Android Studio 2.2 and higher Native Development Kit (NDK) you can use to compile C and C++ code. You can use NDK by manually downloading NDK and build it or through CMake . Here I will give process flow for manually install NDK and an example code, Based on your System OS you can download ...
In case when NavigateToString can't handle some content, use NavigateToLocalStreamUri method. It will force every locally-referenced URI inside the HTML page to call to the special resolver class, which can provide right content on the fly. Assets/Html/html-sample.html file: <!DOCTYPE html> ...
By default, the full indexed document is returned as part of all searches. This is referred to as the source (_source field in the search hits). If we don’t want the entire source document returned, we have the ability to request only a few fields from within source to be returned, or we can set _so...
Docs file (Input File) Mary had a little lamb its fleece was white as snow and everywhere that Mary went the lamb was sure to go. Hive Query CREATE TABLE FILES (line STRING); LOAD DATA INPATH 'docs' OVERWRITE INTO TABLE FILES; CREATE TABLE word_counts AS SELECT word, count(1) AS count F...
Amazon Linux is a RHEL variant, so the Red Hat instructions should work for the most part. There is, however, at least one discrepancy. There was an instance where the python27-devel package, as opposed to python-devel, was explicitly necessary. Here, we will install from source. sudo yum -y upd...
AWK is string manipulation language, used largely in UNIX systems. The idea behind AWK was to create a versatile language to use when working on files, which wasn't too complex to understand. AWK has some other variants, but the main concept is the same, just with additional features. These other v...
import tkinter as tk root = tk.Tk() rbvar = StringVar() rbvar.set(" ") rb1 = tk.Radiobutton(root, text="Option 1", variable=rbvar, value='a', indicatoron=0) rb1.pack() rb2 = tk.Radiobutton(root, text="Option 2", variable=rbvar, value='b', indicatoron=0) rb2...
<UserControl x:Class="Example.View" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"...
<ul class="list-group"> <li class="list-group-item">Cras justo odio</li> <li class="list-group-item">Dapibus ac facilisis in</li> <li class="list-group-item">Morbi leo risus</li> <li class="list-gro...
$incfile = sanitize_file_name($_REQUEST["file"]); include($incfile . ".php"); Without sanitizing the file name an attacker could simple pass http://attacker_site/malicous_page as input and execute whatever code in your server.
$user = sanitize_user("attacker username<script>console.log(document.cookie)</script>"); $user value after sanitize is "attacker username"
AdfELContext adfELContext = AdfmfJavaUtilities.getAdfELContext(); MethodExpression me; me = AdfmfJavaUtilities.getMethodExpression(<binding>, Object.class, new Class[] { }); me.invoke(adfELContext, new Object[] { }); "binding" indicates the EL expression from wh...
import pandas as pd data = [ {'name': 'Daniel', 'country': 'Uganda'}, {'name': 'Yao', 'country': 'China'}, {'name': 'James', 'country': 'Colombia'}, ] df = pd.DataFrame(data) filename = 'people.csv' df.to_csv(filename, index=False, encoding='utf-8')
The Python function import_csv_to_dynamodb(table_name, csv_file_name, colunm_names, column_types) below imports a CSV file into a DynamoDB table. Column names and column must be specified. It uses boto. Below is the function as well as a demo (main()) and the CSV file used. import boto MY_ACCESS...

Page 75 of 129