Tutorial by Examples: c

Identify the local scanner By using lsusb, identify the productId (1909 here) : pi:# lsusb pi:# Bus 001 Device 005: ID 04a9:1909 Canon, Inc. CanoScan LiDE 110 With that productId, grep the correct configuration file (it depends of your scanner model, for me it is genesys.conf) : pi:# grep 190...
The print elements of Bootstrap allow you to designate which items should be visible when printed and which should be hidden. To make something visible use either of the following depending on the element and how it should appear when printed: .visible-print-block .visible-print-inline .visible-...
As mentioned in the other example, you should use rebase instead of merge. But if you're working on a feature branch with your team then you'll run into the problem of pulling rewritten history. So the best way to work on a feature branch foo is to locally create tracking branch foo that you use onl...
Some times application must have panes that docked not to the main frame, but to the child frame. Usually it's MDI application. In MFC Feature pack such child frame is inherited from CMDIChildWndEx class and as main frame (inherited from CMDIFrameWndEx) have all required code for such docking. But ...
One of the features that we can use with Threadpools is the submit() method which allow us to know when the thread as finish his work. We can do this thanks to the Future object, which return us an object from the Callable that we can use to our own objetives. Here is an example about how to use th...
Another good practice to check when our threads have finished without block the thread waiting to recover the Future object from our Callable is to create our own implemetation for Runnables, using it together with the execute() method. In the next example, I show a custom class which implements Ru...
We use ExecutorService to assign threads from the internal thread pool or create them on-demand to perform tasks. Each ExecutorService has an ThreadFactory, but The ExecutorService will use always a default one if we don't set a custom one. Why we should do this? To set a more descriptive thread...
@Test annotation can be applied to any class or method. This annotation marks a class or a method as part of the test. @Test at method level - mark annotated method as test method @Test at class level The effect of a class level @Test annotation is to make all the public methods of the class ...
It is possible to change the opacity of a color with fade() function. fade() takes 2 parameters: a color opacity (in %) Example: @elegant: #eeffgg; .light-elegant { background-color: fade(@elegant, 20%); } <div class="light-elegant"> I have a 20% elegant...
Clustered column store index can be rebuilt if you have a lot of deleted rows: ALTER INDEX cci ON Products REBUILD PARTITION = ALL Rebuilding CLUSTERED COLUMNSTORE will "reload" data from the current table into new one and apply compression again, remove deleted rows, etc. You can re...
Is good practice to resist the temptation of doing the delete action in the get request. It would be a huge security error, it has to be done always in the post method. // GET: Student/Delete/5 public ActionResult Delete(int? id) { // it good practice to consider that things...
Sometimes, it can be useful to import functions and structs relatively without having to use something with its absolute path in your project. To achieve this, you can use the module super, like so: fn x() -> u8 { 5 } mod example { use super::x; fn foo() { println!(...
Kubernetes was originally developed by Google to power their Container Engine. As such, Kubernetes clusters are a first class citizen at Google. Creating a Kubernetes cluster in the container engine requires gcloud command from the Google Cloud SDK. To install this command locally, use one of the f...
A Kubernetes cluster is controlled using the kubectl command. The method of configuring kubectl depends on where Kubernetes is installed. Google Cloud (Container Engine) To install kubectl using the Google Cloud SDK: gcloud components install kubectl To configure kubectl to control an existing...
The following is the default code snippet for the BundleConfig.cs file. using System.Web.Optimization; public class BundleConfig { // For more information on Bundling, visit http://go.microsoft.com/fwlink/?LinkId=254725 public static void RegisterBundles(BundleCollection bundles...
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...
autodie allows you to work with files without having to explicitly check for open/close failures. Since Perl 5.10.1, the autodie pragma has been available in core Perl. When used, Perl will automatically check for errors when opening and closing files. Here is an example in which all of the lines ...
VI snippets are like Screenshots of a Block Diagram, with one important difference. They can be opened in LabVIEW to reconstruct the orginal program. They are saved in the common .PNG format so they can be used like normal pictures e.g. in forums and on StackOverflow. To create a VI snippet mark th...
Let's say that you have exam scores for several exams and you want to divide them into quartiles per exam. -- Setup data: declare @values table(Id int identity(1,1) primary key, [Value] float, ExamId int) insert into @values ([Value], ExamId) values (65, 1), (40, 1), (99, 1), (100, 1), (90, 1), ...
Extract all file contents of a zip file import zipfile with zipfile.ZipFile('zipfile.zip','r') as zfile: zfile.extractall('path') If you want extract single files use extract method, it takes name list and path as input parameter import zipfile f=open('zipfile.zip','rb') zfile=zipfile.Z...

Page 568 of 826