Here is our function to create a simple ajax call written in vanilla javascript (not es2015):
function ajax(url, callback) {
var xhr;
if(typeof XMLHttpRequest !== 'undefined') xhr = new XMLHttpRequest();
else {
var versions = ["MSXML2.XmlHttp.5.0",
...
To make an app more cohesive, we often need to keep user's personal settings and preferences consistent across multiple devices that have been logged in with one Microsoft account. In this sample, we use roaming data to store and to load UI settings, game process and user info. But the roaming data ...
public class PlayerJoinListener implements Listener {
@EventHandler
public void onPlayerJoin(PlayerJoinEvent evt) {
Player joined = evt.getPlayer();
String joinedName = joined.getName();
//RETRIEVING THE JOIN MESSAGE ALREADY SET
String joinMessage = ev...
public ActionResult Index()
{
// Renders a view as a Web page.
return View();
}
Action methods typically return a result that is known as an action result. The ActionResult class is the base class for all action results.
The ActionInvoker decide which type of action result to return ...
public ActionResult PopulateFoods()
{
IEnumerable<Food> foodList = GetAll();
// Renders a partial view, which defines a section of a view that can be rendered inside another view.
return PartialView("_foodTable", foodVms);;
}
Action methods typically retur...
Imagine the following XML:
<root>
<element foobar="hello_world" />
<element example="this is one!" />
</root>
The following XPath expression:
/root/element[@foobar = 'hello_world']
will return the <element foobar="hello_world&quo...
If the built in attributes are not sufficient to validate your model data, then you can place your validation logic in a class derived from ValidationAttribute. In this example only odd numbers are valid values for a model member.
Custom Validation Attribute
public class OddNumberAttribute : Valid...
The following example is a very useful basis when you are trying to convert transaction data to un-pivoted data for BI/reporting reasons, where the dimensions which are to be un-pivoted can have a dynamic set of columns.
For our example, we suppose that the raw data table contains employee assessme...
When sending a notification to an iOS device, you must set priority: "high" for it to wake up. Otherwise, the notification will not be received while the phone is asleep.
Sets the priority of the message. Valid values are "normal" and "high." On iOS, these correspond...
var renderer = Platform.GetRenderer(visualElement);
if (renderer == null)
{
renderer = Platform.CreateRenderer(visualElement);
Platform.SetRenderer(visualElement, renderer);
}
DoSomeThingWithRender(render); // now you can do whatever you want with render
When you are getting started with ElasticSearch (ES) it might be good to have a graphical tool that helps you explore your data. A plugin called elasticsearch-head does just that. To install it, do the following:
Find out in which folder ES is installed: ls -l $(which elasticsearch)
cd into this...
FOR XML PATH and STUFF to concatenate the multiple rows into a single row:
select distinct t1.id,
STUFF(
(SELECT ', ' + convert(varchar(10), t2.date, 120)
FROM yourtable t2
where t1.id = t2.id
FOR XML PATH (''))
, 1,...
Navs available in Bootstrap have shared markup, starting with the base .nav class, as well as shared states. Swap modifier classes to switch between each style.
Tabs
<ul class="nav nav-tabs">
<li role="presentation" class="active"><a href="#&quo...
ML Transformers now generates org.apache.spark.ml.linalg.VectorUDT instead of org.apache.spark.mllib.linalg.VectorUDT.
They are also mapped locally to subclasses of org.apache.spark.ml.linalg.Vector. These are not compatible with old MLLib API which is moving towards deprecation in Spark 2.0.0.
//...