Tutorial by Examples: asp

To select an element by an HTML attribute that contains a specified value use the css locator pattern [attribute*=value] //selects the first element with href value that contains'cont' element(by.css('[href*="cont"]')); //selects the first element with tag h1 and class attribute that...
Authentication can be set for an specific APIView endpoint, by using the authentication_classes variable: from rest_framework.authentication import SessionAuthentication, BasicAuthentication from rest_framework.permissions import IsAuthenticated from rest_framework.response import Response ...
using System.Diagnostics.Contracts; public int DivideNumbers(int numerator, int denominator) { Contract.Requires<ArgumentOutOfRangeException>(denominator != 0); return numerator / denominator; }
<div> <form id="form1" runat="server"> <% for (int i = 1; i <= 10; j++) { Response.Write(i) + " "; } %> </form> <div>
Add the following to Web.config (in Views folder), within <appSettings>: <add key="ClientValidationEnabled" value="true"/> <add key="UnobtrusiveJavaScriptEnabled" value="true"/> Add the jqueryval bundle to BundleConfig.cs: bundles.Add(n...
For the layout above your customrow.axml file is as shown below <?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_heigh...
Authentication filters Are a new kind of filter added in ASP.NET MVC 5.0 .That run prior to authorization filters in the ASP.NET MVC pipeline and allow you to specify authentication logic per-action, per-controller, or globally for all controllers. Authentication filters process credentials in th...
What and Why ? Asp.Net’s Web API2 is the latest version of Web API. It is an easy way to implement a RESTful web service using all of the goodness that the Asp.Net framework provides. Once you understand the basic principles of REST, then a Asp.net Web API2 will be very easy to implement. Web API2...
// resize the image to be contained within a maximum width and height, keeping aspect ratio public static UIImage MaxResizeImage(this UIImage sourceImage, float maxWidth, float maxHeight) { var sourceSize = sourceImage.Size; var maxResizeFactor = Math.Min(maxWidth / sourceSize.Width, max...
// resize the image (without trying to maintain aspect ratio) public static UIImage ResizeImage(this UIImage sourceImage, float width, float height) { UIGraphics.BeginImageContext(new SizeF(width, height)); sourceImage.Draw(new RectangleF(0, 0, width, height)); var resultImage = UIG...
Pretext: These are detailed instructions on how to set up a Raspberry Pi with the Raspbian operating system. These instructions are somewhat Windows specific. Some installation steps may apply to other operating systems as well, but keep the former in mind. Contents Requirements Choosing an ...
A specific figure can be closed by keeping its handle import matplotlib.pyplot as plt fig1 = plt.figure() # create first figure plt.plot([0, 1], [0, 1]) fig2 = plt.figure() # create second figure plt.plot([0, 1], [0, 1]) plt.close(fig1) # close first figure although second one is active ...
Pretext This is an introduction to the Hello World program example on the Raspberry Pi written in C. The following example makes use of the command line interface and is set up as a step-by-step guide. Along with creating a Hello World program, the reader will be introduced to simple linux comman...
First why we should use depedency injection in our code ? We want to decouple other components from other classes in our program. For example we have class AnimalController which have code like this : public class AnimalController() { private SantaAndHisReindeer _SantaAndHisReindeer = new San...
TextBox txt = (TextBox)FindControl(yourtxt_Id);
Normally, we opt this approach if we want complete encapsulation and don't want to make our methods public. Ascx <div style="width: 100%;"> <asp:Button ID="btnAdd" runat="server" Text="Add" OnClick="btnAdd_Click"></asp:butto...
preserveAspectRatio is an attribute that indicates whether the image should be scaled uniformly. This attribute only works if the <svg> element also has a viewBox. The default value is xMidYMid, which maintains the aspect ratio and centers the path inside the SVG container: <!-- when not ...
Aspx <asp:DataList runat="server" CssClass="sample" RepeatLayout="Flow" ID="dlsamplecontent" RepeatDirection="Vertical" OnItemCommand="dlsamplecontent_ItemCommand"> <ItemStyle CssClass="tdContainer" /> ...
The preserveAspectRatio attribute has an optional parameter: meet | slice. The default behavior is meet which stretches the content in both the x and y dimension until it fills either the width or height of the viewBox. The alternative - slice preserves the aspect ratio of the content but scales up ...
All instances of an entity class with one of the class attributes matching a specified value can be retrieved as follows: public interface FooRepository extends CrudRepository<Foo, Long> { List<Foo> findAllByName(String name); } Invoking the findAllByName method results in the JP...

Page 5 of 8