Tutorial by Examples

Lets say you have a user schema, which contains name , contactNo, address, and friends. var UserSchema = new mongoose.Schema({ name : String, contactNo : Number, address : String, friends :[{ type: mongoose.Schema.Types.ObjectId, ref : User }] }); If y...
Fully configuration of Web deployment without Internet connection (offline) is harder to make because Web platform installer (UI) operates by querying packages list and content from an Internet location. Cleanup Make sure that C:\Program Files\IIS does not contain older version of Microsoft We...
Detailed instructions on getting dicom set up or installed.
To be able to change the view location, you need to implement the IViewLocationExpander. The ExpandViewLocations method returns an IEnumerable<string> containing the different locations where to search, with public class MyViewLocationExpander : IViewLocationExpander { public IEnumerabl...
You now need to register the Expander, in order for it to be used by the Razor View Engine. Just add this in the ConfigureServices of your Startup class. public void ConfigureServices(IServiceCollection services) { services.Configure<RazorViewEngineOptions>(options => { opti...
In T4 code-generation strategy used by Entity Framework 5 and higher, data annotation attributes are not included by default. To include data annotations on top of certain property every model regeneration, open template file included with EDMX (with .tt extension) then add a using statement under U...
This method is to check data connection by ping certain IP or Domain name. public Boolean isDataConnected() { try { Process p1 = java.lang.Runtime.getRuntime().exec("ping -c 1 8.8.8.8"); int returnVal = p1.waitFor(); boolean reachable = (returnVal==0); ...
public static boolean isConnectedNetwork (Context context) { ConnectivityManager cm = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE); return cm.getActiveNetworkInfo () != null && cm.getActiveNetworkInfo ().isConnectedOrConnecting (); ...
Using Error Handling to make Struct(or class) initializer as throwable initializer: Example Error Handling enum: enum ValidationError: Error { case invalid } You can use Error Handling enum to check the parameter for the Struct(or class) meet expected requirement struct User { let ...
Toasts are generally used when we want to display an information to the user regarding some action that has successfully (or not) happened and this action does not require the user to take any other action. Like when a message has been sent, for example: Toast.makeText(this, "Message Sent!&quo...
From Apple documentation for IV, This parameter is ignored if ECB mode is used or if a stream cipher algorithm is selected. func AESEncryption(key: String) -> String? { let keyData: NSData! = (key as NSString).data(using: String.Encoding.utf8.rawValue) as NSData! ...
Without splatting it is very cumbersome to try and pass values down through the call stack. But if you combine splatting with the power of the @PSBoundParameters then you can pass the top level parameter collection down through the layers. Function Outer-Method { Param ( [string...
ArcPy is composed of a number of modules: arcpy — the basic functions and geoprocessing tools arcpy.mapping — access to mapping and map document tools arcpy.da — a data access module for working with feature classes and tables arcpy.sa — the Spatial Analyst extension module arcpy.na — the Net...
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(...
private static void saveItem(List<EventTracker> items) { List<WriteRequest> wrList = new ArrayList<>(); try { for (EventTracker item : items) { WriteRequest wreqItem; wreqItem = getWriteRequest(item); wrList.add(wreqItem);...
private static WriteRequest getWriteRequest(EventTracker event) { WriteRequest wreq = null;// = new WriteRequest(); if (event != null) { Map<String, AttributeValue> attributeMap = new HashMap<String, AttributeValue>(); addAttribute(attributeMap, "ev...
Technically, Ruby doesn't have functions, but methods. However, a Ruby method behaves almost identically to functions in other language: def double(n) n * 2 end This normal method/function takes a parameter n, doubles it and returns the value. Now let's define a higher order function (or met...
This example shows multiple producers and consumers sharing the same buffer. Protected entries in Ada implement a queue to handle waiting tasks. The default queuing policy is First In First Out. ------------------------------------------------------------------ -- Multiple producers and consumers ...
Controller (Pages.php) public function contact() { $this->load->library('email'); $this->load->library('form_validation'); //Set form validation $this->form_validation->set_rules('name', 'Name', 'trim|required|min_length[4]|max_length[16]'); $this...

Page 1089 of 1336