Tutorial by Examples: c

> Run and Debug in Chrome To run the ionic project use below command in terminal or cmd or CLI $ ionic serve For debugging the ionic project ,Firstly you should add extension (Debugger for chrome) and then configure launch.json file like this. { "version": "0...
Some digital image processing algorithm such as edge detection, information carried by the image intensity (i.e. grayscale value) is sufficient. Using color information (R, G, B channel) may provides slightly better result, but the algorithm complexity will be increased. Thus, in this case, we need ...
The arguments passed from the console can be received in the Kotlin program and it can be used as an input. You can pass N (1 2 3 and so on) numbers of arguments from the command prompt. A simple example of a command-line argument in Kotlin. fun main(args: Array<String>) { println(&qu...
The following rules define a simple strategy for creating immutable objects. Don't provide "setter" methods - methods that modify fields or objects referred to by fields. Make all fields final and private. Don't allow subclasses to override methods. The simplest way to do this is to d...
$ provides an easy and a concise method to concatenate multiple strings. var str1 = "text1"; var str2 = " "; var str3 = "text3"; string result2 = $"{str1}{str2}{str3}"; //"text1 text3"
Suppose we have this file: test>>cat file 10.Gryffindor 4.Hogwarts 2.Harry 3.Dumbledore 1.The sorting hat To sort this file numerically, use sort with -n option: test>>sort -n file This should sort the file as below: 1.The sorting hat 2.Harry 3.Dumbledore 4.Hogwa...
Since BackAndroid is deprecated. Use BackHandler instead of BackAndroid. import { BackHandler } from 'react-native'; {...} ComponentWillMount(){ BackHandler.addEventListener('hardwareBackPress',()=>{ if (!this.onMainScreen()) { this.goBack(); return true; ...
In the following example echo on will take effect after the end of the brackets context is reached: @echo off ( echo on echo ## ) echo $$ In order to "activate" echo on in a brackets context (including FOR and IF commands) you can use FOR /f macro : @echo off setlocal ...
Anonymous functions technique uses the fact that CALL command uses internally GOTO when subroutine is called and abusing help message printing with variable double expansion: @echo off setlocal set "anonymous=/?" call :%%anonymous%% a b c 3>&1 >nul if "%0" == ...
Lets have the following file called library.cmd : @echo off echo -/-/- Batch Functions Library -/-/- :function1 echo argument1 - %1 goto :eof To execute only the :function1 without the code of the rest of the file you should put a label :function1 in the caller bat and use it lik...
import java.util.StringTokenizer; public class Simple{ public static void main(String args[]){ StringTokenizer st = new StringTokenizer("apple ball cat dog"," "); while (st.hasMoreTokens()) { System.out.println(st.nextToken()); } } ...
public static void main(String args[]) { StringTokenizer st = new StringTokenizer("apple,ball cat,dog", ","); while (st.hasMoreTokens()) { System.out.println(st.nextToken()); } } Output: apple ball cat dog
The most effective way to resolve curl to a different server is to use the --resolve option. This option will insert the address into curl's DNS cache, so it will effectively make curl believe that's the address it got when it resolved the name. Like so: curl --resolve eaxmple.com:80:1.2.3.4 http:...
The "Host:" header is a normal way an HTTP client tells the HTTP server which server it speaks to. By passing custom modified "Host:" header you can have the server respond with the content of the site, even if you didn't actually connect to the host name. For example, if you ha...
Lets have the following example.bat and call it with arguments 1 ,2 and 3: @echo off ( shift shift echo %1 ) As the variable expansion will change after the the end brackets context is reached the output will be: 1 As this might be an issue when shifting inside brackets ...
from django.contrib.auth.models import User class UserAdmin(admin.ModelAdmin): list_display = ('email', 'first_name', 'last_name') list_filter = ('is_staff', 'is_superuser') admin.site.unregister(User) admin.site.register(User, UserAdmin) We need to unregister before regis...
packed is a variable attribute that is used with structures and unions in order to minimize the memory requirements. #include <stdio.h> struct foo { int a; char c; }; struct __attribute__((__packed__))foo_packed { int a; char c; }; int main() { printf("...
I wrote a simple C code foo.c int main() { int i = 0; int j = 0; for (i = 0; i < 5; i++) { j = i + 1; } return 0; } When compiled with -O0 i.e. by disabling all compiler optimizations $ gcc -o foo.S foo.c -O0 -S I got this: .file "foo.c&...
Declaring a DLL procedure to work with different VBA versions: Option Explicit #If Win64 Then Private Declare PtrSafe Sub xLib "Kernel32" Alias "Sleep" (ByVal dwMilliseconds As Long) #ElseIf Win32 Then Private Declare Sub apiSleep Lib "Kernel32" Ali...
Option Explicit #If Win64 Then 'Win64 = True, Win32 = False, Win16 = False Private Declare PtrSafe Sub apiCopyMemory Lib "Kernel32" Alias "RtlMoveMemory" (MyDest As Any, MySource As Any, ByVal MySize As Long) Private Declare PtrSafe Sub apiExitProcess Lib "Kern...

Page 795 of 826