Tutorial by Examples: add

Public Module Usage Public Sub LikeThis() Dim iCount As Integer Dim sCount As String iCount = 245 sCount = iCount.PadLeft(4, "0") Console.WriteLine(sCount) Console.ReadKey() End Sub End Module Public Module Padding <Extension> Pub...
First of all you need to create a class which extends RecyclerView.ItemDecoration : public class SimpleBlueDivider extends RecyclerView.ItemDecoration { private Drawable mDivider; public SimpleBlueDivider(Context context) { mDivider = context.getResources().getDrawable(R.drawable.divider_b...
You can create your own events and dispatch them, by extending the Event class. import flash.events.Event; class MyEvent extends Event { var data: String; static public var MY_EVENT_TYPE = "my_event_my_event_code"; public function MyEvent(type: String, data: Str...
UITextView has built in support to auto detect a variety of data. The data that is able to be auto-detected currently includes: enum { UIDataDetectorTypePhoneNumber = 1 << 0, UIDataDetectorTypeLink = 1 << 1, UIDataDetectorTypeAddress = 1 << 2, UID...
Single JAR Sometimes you have a local JAR file you need to add as a dependency to your Gradle build. Here's how you can do this: dependencies { compile files('path/local_dependency.jar') } Where path is a directory path on your filesystem and local_dependency.jar is the name of your local...
Dependencies in Gradle follow the same format as Maven. Dependencies are structured as follows: group:name:version Here's an example: 'org.springframework:spring-core:4.3.1.RELEASE' To add as a compile-time dependency, simply add this line in your dependency block in the Gradle build file: ...
In addition to a failure/success return value, some API calls also set the last error on failure (e.g. CreateWindow). The documentation usually contains the following standard wording for this case: If the function succeeds, the return value is <API-specific success value>. If the function...
Some API calls can succeed or fail in more than one way. The APIs commonly return additional information for both successful invocations as well as errors (e.g. CreateMutex). if ( CreateMutexW( NULL, TRUE, L"Global\\MyNamedMutex" ) == NULL ) { // Failure: get additional information. ...
Add the following code (known as the "JavaScript tracking snippet") to your site's templates. The code should be added before the closing tag, and the string 'UA-XXXXX-Y' should be replaced with the property ID (also called the "tracking ID") of the Google Analytics property yo...
When you create an argparse ArgumentParser() and run your program with '-h' you get an automated usage message explaining what arguments you can run your software with. By default, positional arguments and conditional arguments are separated into two categories, for example, here is a small script ...
<div tabindex="0">Some button</div> Note: Try to use a native HTML button or an a tag where appropriate.
If you created an empty project, or you still don't have mvc configured in your application, you can add dependency: "Microsoft.AspNetCore.Mvc": "1.0.1" To your project.json file under "dependencies". And register MVC middleware in your Startup class: public void ...
-> Note: make sure you set up HStoreField first before going on with this example. (above) No parameters are required for initializing a HStoreField. from django.contrib.postgres.fields import HStoreField from django.db import models class Catalog(models.model): name = models.C...
You can also turn on more tests, such as: valgrind -q --tool=memcheck --leak-check=yes ./my-program arg1 arg2 < test-input See valgrind --help for more information about the (many) options, or look at the documentation at http://valgrind.org/ for detailed information about what the output mea...
ClientContext clientContext = new ClientContext(siteUrl); SP.List oList = clientContext.Web.Lists.GetByTitle("Announcements"); SP.Field oField = oList.Fields.AddFieldAsXml("<Field DisplayName='MyField' Type='Number' />", true, AddFieldOptions.DefaultValue); ...
ClientContext clientContext = new ClientContext("http://MyServer/sites/MySiteCollection "); GroupCollection collGroup = clientContext.Web.SiteGroups; Group oGroup = collGroup.GetById(6); UserCreationInformation userCreationInfo = new UserCreationInformation(); userCreationInfo.Email ...
ClientContext oClientContext = new ClientContext("http://MyServer/sites/MySiteCollection/MyWebSite"); Web oWebsite = clientContext.Web; GroupCreationInformation groupCreationInfo = new GroupCreationInformation(); groupCreationInfo.Title = "My New Group"; groupCreationInfo.D...
ClientContext clientContext = new ClientContext(siteUrl); SP.List oList = clientContext.Web.Lists.GetByTitle("MyList"); int itemId = 3; ListItem oListItem = oList.Items.GetById(itemId); oListItem.BreakRoleInheritance(false); User oUser = clientContext.Web.SiteUsers.GetByLoginNam...
string urlWebsite = "http://MyServer/sites/MySiteCollection"; ClientContext clientContext = new ClientContext(urlWebsite); Web oWebsite = clientContext.Web; List oList = oWebsite.Lists.GetByTitle("My List"); UserCustomActionCollection collUserCustomAction = oList.UserCustom...
string urlWebsite = "http://MyServer/sites/MySiteCollection"; ClientContext clientContext = new ClientContext(urlWebsite); Web oWebsite = clientContext.Web; UserCustomActionCollection collUserCustomAction = oWebsite.UserCustomActions; UserCustomAction oUserCustomAction = collUserCu...

Page 7 of 32