Tutorial by Examples

The ToString() method is present on all reference object types. This is due to all reference types being derived from Object which has the ToString() method on it. The ToString() method on the object base class returns the type name. The fragment below will print out "User" to the console....
GetHashCode has major performance effects on Dictionary<> and HashTable. Good GetHashCode Methods should have an even distribution every integer should have a roughly equal chance of returning for a random instance if your method returns the same integer (e.g. the constant '999') for e...
<svg xmlns="http://www.w3.org/2000/svg"> <switch> <text systemLanguage="en-UK" x="10" y="10">UK English</text> <text systemLanguage="fr" x="10" y="10">Français</text> <text ...
Add this line at the beginning of your view. <?php use yii\widgets\Pjax; ?> Add the following two lines around the content that needs partial updating. <?php Pjax::begin(['id'=>'id-pjax']); ?> Content that needs to be updated <?php Pjax::end(); ?> reload pjax $.pjax...
/*add this code to your function.php file now your api will include transaction_id */ add_action( 'woocommerce_api_order_response', 'my_woocommerce_api_order', 10, 2); function my_woocommerce_api_order( $data ) { //you can do anything with the $data here lets add the transaction id ...
The following are instructions to setup latest version of Varnish on various Linux distros. CentOS 7 curl -s https://packagecloud.io/install/repositories/varnishcache/varnish5/script.rpm.sh | sudo bash Ubuntu apt-get install apt-transport-https curl https://repo.varnish-cache.org/GPG-key.txt ...
Setters and Getters allow for an object to contain private variables which can be accessed and changed with restrictions. For example, public class Person { private String name; public String getName() { return name; } public void setName(String name) { i...
In this example, we'll create a simple echo server that will listen on the specified port, and being able to handle new connections: #include <stdio.h> #include <stdlib.h> #include <unistd.h> #include <sys/socket.h> #include <sys/types.h> #include <arpa/inet.h&...
Window.h #include <QWidget> class Window : public QWidget { Q_OBJECT public: Window(QWidget *parent = Q_NULLPTR) : QWidget(parent) {} } main.cpp #include <QApplication> #include "Window.h" int main() { QApplication app; Window window; wi...
The SUBDIRS ability of qmake can be used to compile a set of libraries, each of which depend on another. The example below is slightly convoluted to show variations with the SUBDIRS ability. Directory Structure Some of the following files will be omitted in the interest of brevity. They can be a...
A simple example to make a library (rather than an executable, which is the default). TEMPLATE variable specifies type of the project you are making. lib option allows makefile to build a library. library.pro HEADERS += library.h SOURCES += library.cpp TEMPLATE = lib # By default, qmake wil...
<ImageView android:id="@+id/imgExample" android:layout_width="wrap_content" android:layout_height="wrap_content" ... /> set a drawable as content of ImageView using XML attribute: android:src="@drawable/android2" set a drawable program...
"alpha" is used to specify the opacity for an image. set alpha using XML attribute: android:alpha="0.5" Note: takes float value from 0 (transparent) to 1 (fully visible) set alpha programmatically: imgExample.setAlpha(0.5f);
If you want to show local notification immediately, you should call: Swift 3 UIApplication.shared.presentLocalNotificationNow(notification) Swift 2 UIApplication.sharedApplication().presentLocalNotificationNow(notification) Objective-C [[UIApplication sharedApplication] presentLocalNotific...
CREATE TABLE foo ( ... ) ENGINE=MyISAM;
public class OnSwipeListener implements View.OnTouchListener { private final GestureDetector gestureDetector; public OnSwipeListener(Context context) { gestureDetector = new GestureDetector(context, new GestureListener()); } @Override public boolean onTouch(Vi...
public class GestureActivity extends Activity implements GestureDetector.OnDoubleTapListener, GestureDetector.OnGestureListener { private GestureDetector mGestureDetector; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedIn...
Create a new Console Application Add the NuGet package Microsoft.CodeAnalysis Import the namespaces Microsoft.CodeAnalysis.MSBuild, System.Linq and Microsoft.CodeAnalysis.CSharp.Syntax Write the following example code in the Main method: // Declaring a variable with the current project file ...
Create a new console application with one line in the Main method: Console.WriteLine("Hello World") Remember the path to the .csproj file and replace it in the example. Create a new Console Application and install the Microsoft.CodeAnalysis NuGet package and try the following code: cons...
Create a new console application with one line in the Main method: Console.WriteLine("Hello World") Remember the path to the .vbproj file and replace it in the example. Create a new Console Application and install the Microsoft.CodeAnalysis NuGet package and try the following code: Cons...

Page 641 of 1336