Tutorial by Examples: c

Install Apache Web Server First step is to install web server Apache. sudo yum -y install httpd Once it is installed, enable (to run on startup) and start Apache web server service. sudo systemctl enable --now httpd Point your browser to: http://localhost You will see the default Apache web s...
Step 1 : Install the node-inspector package using npm globally on you machine $ npm install -g node-inspector Step 2 : Start the node-inspector server $ node-inspector Step 3 : Start debugging your node application $ node --debug-brk your/short/node/script.js Step 4 : Open http://127.0....
If all you need is serializing mongo results into json, it is possible to use the json module, provided you define custom handlers to deal with non-serializable fields types. One advantage is that you have full power on how you encode specific fields, like the datetime representation. Here is a ha...
new Vue({ el:"#app", data:{ foo: "bar" }, methods:{ doSomethingAsynchronous(){ setTimeout(function(){ // This is wrong! Inside this function, // "this" refers to the window object. this.foo = "baz"; ...
You can capture the correct this using a closure. new Vue({ el:"#star-wars-people", data:{ people: null }, mounted: function(){ // Before executing the web service call, save this to a local variable var self = this; $.getJSON("http://swapi.co/api/peop...
new Vue({ el:"#star-wars-people", data:{ people: null }, mounted: function(){ $.getJSON("http://swapi.co/api/people/", data => this.people = data.results); } }) Caution! Arrow functions are a syntax introduced in Ecmascript 2015. It is not yet supp...
new Vue({ el:"#app", data:{ foo: "bar" }, methods:{ // This is wrong! Arrow functions capture "this" lexically // and "this" will refer to the window. doSomething: () => this.foo = "baz" } })
new Vue({ el:"#app", data:{ foo: "bar" }, methods:{ doSomething: function(){ this.foo = "baz" } } }) Alternatively, if you are using a javascript compiler or a browser that supports Ecmascript 2015 new Vue({ el:"#app&quo...
Copying files copy copies the source file in the first argument to the destination in the second argument. The resolved destination needs to be in a directory that is already created. if (copy('test.txt', 'dest.txt')) { echo 'File has been copied successfully'; } else { echo 'Failed to ...
Steps: Create Empty .Net Core Web App: Go to wwwroot, and create a normal html page called Index.html: Configure Startup.cs to accept static files (this will require to add "Microsoft.AspNetCore.StaticFiles": "1.0.0" library in the “project.json” file): ...
public class Person { private final String salutation; private final String firstName; private final String middleName; private final String lastName; private final String suffix; private final Address address; private final boolean isFemale; private final boolean isEmployed; private final ...
Another example: a Weapon that shoots out Bullets. The Weapon acts as an object pool for the Bullets it creates. public class Weapon : MonoBehaviour { // The Bullet prefab that the Weapon will create public Bullet bulletPrefab; // This List is our object pool, which starts...
Here counter is a child component accessed by demo which is a parent component using v-model. // child component Vue.component('counter', { template: `<div><button @click='add'>+1</button> <button @click='sub'>-1</button> <div>this is inside the child c...
RubyInline is a framework that lets you embed other languages inside your Ruby code. It defines the Module# inline method, which returns a builder object. You pass the builder a string containing code written in a language other than Ruby, and the builder transforms it into something that you can ca...
After spending more than 5 hours, i found this easy solution: -To verify that the system has a CUDA-capable GPU, run the following command: lspci | grep -i NVIDIA You will see output similar to the following example (showing an NVIDIA Tesla K80/M60 card): -Disabling the nouveau driver: sudo...
The most basic way to structure your code using spring boot for good automatic package scanning is using @SpringBootApplication annotation. This annotation provide in itself 3 other annotations that helps with automatic scanning: @SpringBootConfiguration, @EnableAutoConfiguration, @ComponentScan (mo...
You can use @ComponentScan in order to configure more complex package scanning. There is also @ComponentScans that act as a container annotation that aggregates several @ComponentScan annotations. Basic code examples @ComponentScan public class DemoAutoConfiguration { } @ComponentScans({@Co...
Spring boot is based on a lot of pre-made auto-configuration parent projects. You should already be familiar with spring boot starter projects. You can easily create your own starter project by doing the following easy steps: Create some @Configuration classes to define default beans. You should...
You might need a v-model on a computed property. Normally, the v-model won't update the computed property value. The template: <div id="demo"> <div class='inline-block card'> <div :class='{onlineMarker: true, online: status, offline: !status}'></div> ...
@interface NSString : NSObject (NSObject is a base class of NSString class). You can use below methods for allocation of string class: - (instancetype)init + (instancetype)new + (instancetype)alloc For Copy any object : - (id)copy; - (id)mutableCopy; For compare objects : - (BOOL...

Page 729 of 826