Tutorial by Examples: am

git shortlog summarizes git log and groups by author If no parameters are given, a list of all commits made per committer will be shown in chronological order. $ git shortlog Committer 1 (<number_of_commits>): Commit Message 1 Commit Message 2 ... Committer 2 (<number_of_...
When assigning named methods to delegates, they will refer to the same underlying object if: They are the same instance method, on the same instance of a class They are the same static method on a class public class Greeter { public void WriteInstance() { Console.Write...
Named methods can be assigned to delegates with matching signatures: public static class Example { public static int AddOne(int input) { return input + 1; } } Func<int,int> addOne = Example.AddOne Example.AddOne takes an int and returns an int, its signature ...
Lambdas can be used to create anonymous methods to assign to a delegate: Func<int,int> addOne = x => x+1; Note that the explicit declaration of type is required when creating a variable this way: var addOne = x => x+1; // Does not work
/** * Enables output buffer streaming. Calling this function * immediately flushes the buffer to the client, and any * subsequent output will be sent directly to the client. */ function _stream() { ob_implicit_flush(true); ob_end_flush(); }
def my_mix(name,valid=true, *opt) puts name puts valid puts opt end Call as follows: my_mix('me') # 'me' # true # [] my_mix('me', false) # 'me' # false # [] my_mix('me', true, 5, 7) # 'me' # true # [5,7]
Create a ModelForm from an existing Model class, by subclassing ModelForm: from django import forms class OrderForm(forms.ModelForm): class Meta: model = Order fields = ['item', 'order_date', 'customer', 'status']
The special variable __name__ is not set by the user. It is mostly used to check whether or not the module is being run by itself or run because an import was performed. To avoid your module to run certain parts of its code when it gets imported, check if __name__ == '__main__'. Let module_1.py be ...
The jQuery UI framework helps to extend and increase the User Interface controls for jQuery JavaScript library. When you wish to use jQuery UI, you will need to add these libraries to your HTML. A quick way to start is using the Content Delivery Network available code sources: jQuery Libraries ht...
Many-to-One Relationship from django.db import models class Author(models.Model): name = models.CharField(max_length=50) #Book has a foreignkey (many to one) relationship with author class Book(models.Model): author = models.ForeignKey(Author, on_delete=models.CASCADE) publish_...
To access entities declared in a module from another program unit (module, procedure or program), the module must be used with the use statement. module shared_data implicit none integer :: iarray(4) = [1, 2, 3, 4] real :: rarray(4) = [1., 2., 3., 4.] end module program test !...
This assumes that you have read the documentation about starting a new Django project. Let us assume that the main app in your project is named td (short for test driven). To create your first test, create a file named test_view.py and copy paste the following content into it. from django.test impo...
This type of tests make sure that your code compiles properly and will appear in the generated documentation for your project. In addition to that, the example tests can assert that your test produces proper output. sum.go: package sum // Sum calculates the sum of two integers func Sum(a, b in...
public IEnumerable<int> F1() { for (int i = 0; i < 3; i++) yield return i; //return F2(); // Compile Error!! foreach (var element in F2()) yield return element; } public int[] F2() { return new[] { 3, 4, 5 }; }
Tensorflow is more than just a deep learning framework. It is a general computation framework to perform general mathematical operations in a parallel and distributed manner. An example of such is described below. Linear Regression A basic statistical example that is commonly utilized and is r...
function sayHello(name) print("Hello, " .. name .. "!") end That function is a simple function, and it works well. But what would happen if we just called sayHello()? stdin:2: attempt to concatenate local 'name' (a nil value) stack traceback: stdin:2: in function ...
The expansion of a macro often needs to use symbols that weren't passed as arguments by the user (as names for local variables, for example). One must make sure that such symbols cannot conflict with a symbol that the user is using in the surrounding code. This is usually achieved by using GENSYM, ...
It's a very common extension that allows type classes with multiple type parameters. You can think of MPTC as a relation between types. {-# LANGUAGE MultiParamTypeClasses #-} class Convertable a b where convert :: a -> b instance Convertable Int Float where convert i = fromIntegr...
Lambda functions are anonymous functions which are usually created during a function call to act as a function parameter. They are declared by surrounding expressions with {braces} - if arguments are needed, these are put before an arrow ->. { name: String -> "Your name is $name&q...
Ajax Get: Solution 1: $.get('url.html', function(data){ $('#update-box').html(data); }); Solution 2: $.ajax({ type: 'GET', url: 'url.php', }).done(function(data){ $('#update-box').html(data); }).fail(function(jqXHR, textStatus){ alert('Error occured: ' + te...

Page 13 of 129