Tutorial by Examples: am

Controller: In the Controller you have to add the RequestHandler component. This Enables CakePHP to automatically detect Ajax requests(see: http://book.cakephp.org/2.0/en/core-libraries/components/request-handling.html for more info): class YourController extends AppController { public $compo...
Sometimes we have requirement of parsing pages, but doing so requires you to be an authorised user. Here is an example which shows you how to do in oracle sign in. import sys import requests import json from bs4 import BeautifulSoup def mprint(x): sys.stdout.write(x) print re...
When registering types to the container Castle uses the type of the class in order to resolve. In the case that there is more than one registration for a specific type the Name property must be set: public void Install(IWindsorContainer container, IConfigurationStore store) { container.Regist...
Theme.xml app/design/frontend/Magento/mytheme/theme.xml <theme xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Config/etc/theme.xsd"> <title>My theme</title> <!-- your theme's name --> ...
angular.component("SampleComponent", { bindings: { title: '@', movies: '<', reservation: "=", processReservation: "&" } }); Here we have all binding elements. @ indicates that we need a very basic binding, from the parent scope ...
CREATE TABLE [dbo].[ProcessLog]( [LogId] [int] IDENTITY(1,1) NOT NULL, [LogType] [varchar](20) NULL, [StartTime] [datetime] NULL, [EndTime] [datetime] NULL, [RunMinutes] AS (datediff(minute,coalesce([StartTime],getdate()),coalesce([EndTime],getdate()))) This gives run difference in minutes ...
The next example is intended to count the amount of flags in the specified flag combination. The example is provided as a extension method: <DebuggerStepThrough> <Extension> <EditorBrowsable(EditorBrowsableState.Always)> Public Function CountFlags(ByVal sender As [Enum]) As In...
If a singleshot timer is required, it is quiet handy to have the slot as lambda function right in the place where the timer is declared: QTimer::singleShot(1000, []() { /*Code here*/ } ); Due to this Bug (QTBUG-26406), this is way is only possible since Qt5.4. In earlier Qt5 versions it has to ...
MSBuild evaluates PropertyGroup, Choose and ItemGroup elements that are directly under the Project element before those that are in Target elements. Directly under the Project element, PropertyGroup and Choose elements are evaluated in the order in which they appear, and then ItemGroup elements a...
function my_init_function() { // do something here } add_action( 'init', 'my_init_function' ); Using the name of the function to hook a set of instructions. With the init hook, the set of instructions will be executed right after wordpress has finished loading the necessary components. ...
If different users need different datetime format then you may need to parse your incoming date string to actual date according to the format. In this case this snippet may help you. public class DateTimeBinder : DefaultModelBinder { public override object BindModel(ControllerContext control...
content-model.xml : .... <constraints> <constraint name="my:aConstraintList" type="x.y.z.project.model.constraint.AConstraintList"> </constraint> .... <property name="my:aValue"> <title>My Value</title> <typ...
An element containing a single child, with some framing options. Frame have a default Xamarin.Forms.Layout.Padding of 20. XAML <Frame> <Label Text="I've been framed!" HorizontalOptions="Center" VerticalOptions="Center" /> </Frame> Code var ...
Static initialization is suitable for most situations. When your application must delay the instantiation, use a non-default constructor or perform other tasks before the instantiation, and work in a multithreaded environment, you need a different solution. Cases do exist, however, in which you cann...
Angular 2 has two kinds of custom validators. Synchronous validators as in the first example that will run directly on the client and asynchronous validators (the second example) that you can use to call a remote service to do the validation for you. In this example the validator should call the ser...
An AWS-Lambda function can be attached to a certain bucket event. Whenever a file/folder is created or removed, an event can trigger lambda function execution. A simple Lambda function to print the name of an uploaded File This is a one class lambda project to print the name of an uploaded file. ...
using System; namespace ConsoleApplication1 { class Program { static void Main(string[] args) { var foo = new ClassWithDependency(); foo.DoSomething(); var bar = new InjectedDependency(); foo.Dependency = bar; ...
using System; namespace ConsoleApplication1 { class Program { static void Main(string[] args) { var dep = new DefaultDependency(); var foo = new ClassWithDependency(dep); foo.DoSomething(); var bar = new Injected...
To view the first or last few records of a dataframe, you can use the methods head and tail To return the first n rows use DataFrame.head([n]) df.head(n) To return the last n rows use DataFrame.tail([n]) df.tail(n) Without the argument n, these functions return 5 rows. Note that the slice ...
WordPress shortcodes were introduced in 2.5 Here is come example of shortcode [button] to use shortcode direct into theme you have to use do_shortcode() <?php echo do_shortcode('[button]'); ?> To customize the button, we could simply add something like: [button type="twitter&qu...

Page 74 of 129