Tutorial by Examples: ast

Let's say you have this line of code: printf("Hello, world!\n"); Now say you want to change the text to "Program exiting." CommandBufferMnemonicci"printf("¦");change in the ".Program exiting.\n<esc>printf("Program exiting.\n");
While in insert mode, you can use <C-r> to paste from a register, which is specified by the next keystroke. <C-r>" for example pastes from the unnamed (") register. See :help registers.
add permission in your manifest file <uses-permission android:name="android.permission.BLUETOOTH" /> In your Fragment(or Activity) Add the receiver method private BroadcastReceiver mBluetoothStatusChangedReceiver = new BroadcastReceiver() { @Override public void o...
Multicasting is a type of Datagram Socket. Unlike regular Datagrams, Multicasting doesn't handle each client individually instead it sends it out to one IP Address and all subscribed clients will get the message. Example code for a server side: public class Server { private DatagramSo...
Reading line by line awk '/^>/ {printf("%s%s\t",(N>0?"\n":""),$0);N++;next;} {printf("%s",$0);} END {printf("\n");}' < input.fa one can read this awk script as: if the current line ($0) starts like a fasta header (^>). Then we prin...
download and linearize the 10 first FASTA sequences from UniProt: $ curl -s "ftp://ftp.uniprot.org/pub/databases/uniprot/current_release/knowledgebase/complete/uniprot_sprot.fasta.gz" |\ gunzip -c |\ awk '/^>/ {printf("%s%s\t",(N>0?"\n":""),$0);N...
To enable or disable a BroadcastReceiver, we need to get a reference to the PackageManager and we need a ComponentName object containing the class of the receiver we want to enable/disable: ComponentName componentName = new ComponentName(context, MyBroadcastReceiver.class); PackageManager packageM...
You can convert a timestamp or interval value to a string with the to_char() function: SELECT to_char('2016-08-12 16:40:32'::timestamp, 'DD Mon YYYY HH:MI:SSPM'); This statement will produce the string "12 Aug 2016 04:40:32PM". The formatting string can be modified in many different wa...
To get Array from any object, use Kernel#Array. The following is an example: Array('something') #=> ["something"] Array([2, 1, 5]) #=> [2, 1, 5] Array(1) #=> [1] Array(2..4) #=> [2, 3, 4] Array([]) #=> [] Array(nil) #=> [] For...
A stream is closed by sending a closing </stream> tag. After the closing stream tag is sent, no more data should be sent on the stream (even in response to data received from the other party). Before closing the connection, the sending entity should wait for a response </stream> tag to g...
Once a TCP connection is established, the initial stream header is sent by the initiating entity. Similarly, whenever a stream restart is required (eg. after negotiating a security layer such as TLS) a stream header must also be sent: <?xml version='1.0'?> <stream:stream from='juliet...
$ gunzip -c input.fastq.gz | paste - - - - | head @IL31_4368:1:1:996:8507/2 TCCCTTACCCCCAAGCTCCATACCCTCCTAATGCCCACACCTCTTACCTTAGGA + FFCEFFFEEFFFFFFFEFFEFFFEFCFC<EEFEFFFCEFF<;EEFF=FEE?FCE @IL31_4368:1:1:996:21421/2 CAAAAACTTTCACTTTACCTGCCGGGTTTCCCAGTTTACATTCCACTGTTTGAC + ...
Example below shows how to create a BroadcastReceiver which is able to receive BOOT_COMPLETED events. This way, you are able to start a Service or start an Activity as soon device was powered up. Also, you can use BOOT_COMPLETED events to restore your alarms since they are destroyed when device is ...
Casting: The Basics Casting is used to transform data from long to wide format. Starting with a long data set: DT = data.table(ID = rep(letters[1:3],3), Age = rep(20:22,3), Test = rep(c("OB_A","OB_B","OB_C"), each = 3), Result = 1:9) We can cast our data using the...
Using the DATEADD and DATEDIFF functions, it's possible to return the last date of a month. SELECT DATEADD(d, -1, DATEADD(m, DATEDIFF(m, 0, '2016-09-23') + 1, 0)) -- 2016-09-30 00:00:00.000 SQL Server 2012 The EOMONTH function provides a more concise way to return the last date of a month, and...
In Swift you can easily separate a String into an array by slicing it at a certain character: 3.0 let startDate = "23:51" let startDateAsArray = startDate.components(separatedBy: ":") // ["23", "51"]` 2.2 let startDate = "23:51" let sta...
in this way '0' representing the known values ​​are ranked first, '1' representing the NULL values ​​are sorted by the last: SELECT ID ,REGION ,CITY ,DEPARTMENT ,EMPLOYEES_NUMBER FROM DEPT ORDER BY CASE WHEN REGION IS NULL THEN 1 ELSE 0 END, REGION ...
It is not possible to directly use static_cast, const_cast, dynamic_cast and reinterpret_cast on std::shared_ptr to retrieve a pointer sharing ownership with the pointer being passed as argument. Instead, the functions std::static_pointer_cast, std::const_pointer_cast, std::dynamic_pointer_cast and ...
The as operator will cast to a supertype. As it cannot fail, it does not return an optional. let name = "Ringo" let value = string as Any // `value` is of type `Any` now
In Insert mode, press <C-r> and then % to insert the filename. This technique is applicable to all registers. For e.g. if in insert mode, you want to paste the current search pattern, you can type <C-r> and then /.

Page 14 of 26