Tutorial by Examples: c

MATLAB R2016b featured a generalization of its scalar expansion1,2 mechanism, to also support certain element-wise operations between arrays of different sizes, as long as their dimension are compatible. The operators that support implicit expansion are1: Element-wise arithmetic operators: +, -,...
Abstract base classes (ABCs) enforce what derived classes implement particular methods from the base class. To understand how this works and why we should use it, let's take a look at an example that Van Rossum would enjoy. Let's say we have a Base class "MontyPython" with two methods (jo...
You can set a character set both per table, as well as per individual field using the CHARACTER SET and CHARSET statements: CREATE TABLE Address ( `AddressID` INTEGER NOT NULL PRIMARY KEY, `Street` VARCHAR(80) CHARACTER SET ASCII, `City` VARCHAR(80), `Country` ...
Some data cannot be pickled. Other data should not be pickled for other reasons. What will be pickled can be defined in __getstate__ method. This method must return something that is picklable. On the oposite side is __setstate__: it will receive what __getstate__ created and has to initialize the...
Created this really bad program #include <stdio.h> #include <ctype.h> // forward declarations void bad_function() { int *test = 5; free(test); } int main(int argc, char *argv[]) { bad_function(); return 0; } gcc -g ex1.c ./a.out //or w...
In projects that feature several singleton classes (as is often the case), it can be clean and convenient to abstract the singleton behaviour to a base class: using UnityEngine; using System.Collections.Generic; using System; public abstract class MonoBehaviourSingleton<T> : MonoBehaviou...
To quickly provide a matching color for links inside any alert, we can use the .alert-link utility class. <div class="alert alert-success"> You have won! Click <a href="#" class="alert-link">here</a> to claim your prize ... </div> <d...
The .cmdtree command allows to open a .txt file with predefined commands which you can simply double click to execute. How to create command file Create the file using this template windbg ANSI Command Tree 1.0 title {"Window title"} body {"Group Heading"} {"Name...
audioManager = (AudioManager) getSystemService(Context.AUDIO_SERVICE); audioManager.requestAudioFocus(audioListener, AudioManager.STREAM_MUSIC, AudioManager.AUDIOFOCUS_GAIN_TRANSIENT); changedListener = new AudioManager.OnAudioFocusChangeListener() { @Override public void onAudioFocu...
audioManager = (AudioManager) getSystemService(Context.AUDIO_SERVICE); audioManager.requestAudioFocus(audioListener, AudioManager.STREAM_MUSIC, AudioManager.AUDIOFOCUS_GAIN); changedListener = new AudioManager.OnAudioFocusChangeListener() { @Override public void onAudioFocusChange(in...
If you've got multiple implementations of the same interface, Spring needs to know which one it should autowire into a class. I'm going to use a Validator pattern in this example.1 Foo Class: public class Foo { private String name; private String emailAddress; private String erro...
If you've got an interface with a generic type parameter, Spring can use that to only autowire implementations that implement a type parameter you specify. Interface: public interface GenericValidator<T> { public T validate(T object); } Foo Validator Class: @Component public class...
WPF apps targeting .NET Framework 4.6.2 and later With WPF apps targeting .NET Framework 4.6.2 (and later), the soft keyboard is automatically invoked and dismissed without any additional steps required. WPF apps targeting .NET Framework 4.6.1 and earlier WPF is not primarily touch enabled, whi...
Create engaging user interfaces for Windows Desktop Applications with Blend for Visual Studio, the premier professional design tool for XAML applications. Build beautiful transitions and visualizations using Blend’s full suite of vector drawing tools, powerful template editing features, real-time an...
WPF Inspector is a utility that attaches to a running WPF application to troubleshoot common problems with layouting, databinding or styling. WPF Inspector allows you to explore a live view of the logical- and visual tree, read and edit property values of elements, watch the data context, debug trig...
The Windows SDK includes a suite of performance profiling tools for Windows Presentation Foundation (WPF) applications called the WPF Performance Suite. The WPF Performance Suite enables you to analyze the run-time behavior of your WPF applications and determine performance optimizations that you ca...
Several Qt Objects and Containers use a concept calles implicit sharing, which can also be refered to as copy-on-write. Implicit sharing means that the classes who use this concept share the same data on initialization. One of these classes to use the concept is QString. QString s1("Hello Wo...
import numpy as np import cv2 #access a video from your disk #to use the GIF in this example, convert to avi! cap = cv2.VideoCapture('eg_videoRead.avi') #we are going to read 10 frames #we store the frames in a numpy structure #then we'll generate a minimum projection of those frame...
Define parameters private static IMongoClient _client; private static IMongoDatabase _database; private static IMongoCollection< -collection class name- > _collection; Assign values to parameters _client = new MongoClient("mongodb://localhost:27017"); _database = _client.GetD...
Its common for datatables to have a checkbox to select multiple rows. If the data is spread across multiple pages, it could be difficult for the user to view the records he selected. To enable the user view all the selected records in one go, we usually use a hyperlink that when clicked displays onl...

Page 576 of 826