Tutorial by Examples: c

The sum of the geometric series r0 + r1 + r2 + ... + rn-1 In the case where r ≠ 1, simplifies to (rn - 1) / (r - 1). If r < 1, this sum is bounded from above by 1 / (1 - r). If r = 1, this sum is rn.
In /res/values/strings.xml: <string-array name="spinner_options"> <item>Option 1</item> <item>Option 2</item> <item>Option 3</item> </string-array> In layout XML: <Spinner android:id="@+id/spinnerName" ...
How do you go about using an instance of a (possibly further) inherited generic type within a method declaration in the generic type itself being declared? This is one of the problems you will face when you dig a bit deeper into generics, but still a fairly common one. Assume we have a DataSeries&l...
apologies: since I don't know of a channel for discussing/providing feedback on requests for improvement, I'm going to put my question here. Please feel free to point out a better place for this! @DataTx states that this is "completely unclear, incomplete, or has severe formatting problems&quot...
A texture is a form of data storage that allows convenient access not just to particular data entries, but also to sample points mixing (interpolating) multiple entries together. In OpenGL textures can be used for many things, but most commonly it's mapping an image to a polygon (for example a tria...
To enable Second Level Caching for Hibernate in WildFly, add this property to your persistence.xml file: <property name="hibernate.cache.use_second_level_cache" value="true"/> You may also enable Query Caching with this property: <property name="hibernate.cache...
By default, Eloquent models expect for the primary key to be named 'id'. If that is not your case, you can change the name of your primary key by specifying the $primaryKey property. class Citizen extends Model { protected $primaryKey = 'socialSecurityNo'; // ... } Now, any Eloqu...
DataObjects in SilverStripe represent a database table row. The fields in the model have magic methods that handle getting and setting data via their property names. Given we have a simple DataObject as an example: class Fruit extends DataObject { private static $db = ['Name' => 'Varchar'...
initialize is called by Backbone right after a View is constructed. Optional parameters The initialize function receives any arguments passed to the view's constructor. Commonly, the options hash that is used to pass the view's default options: ['model', 'collection', 'el', 'id', 'attributes', 'c...
Most streams must be closed when you are done with them, otherwise you could introduce a memory leak or leave a file open. It is important that streams are closed even if an exception is thrown. Java SE 7 try(FileWriter fw = new FileWriter("outfilename"); BufferedWriter bw = new Buf...
A Clojure function can be defined to take an arbitrary number of arguments, using the symbol & in its argument list. All remaining arguments are collected as a sequence. (defn sum [& args] (apply + args)) (defn sum-and-multiply [x & args] (* x (apply + args))) Calling: =&gt...
Comments are programmer-readable annotations that are ignored at runtime. Their purpose is to make source code easier to understand. Single line comments The # character is used to add single line comments. #!/usr/bin/ruby -w # This is a single line comment. puts "Hello World!" Whe...
Note: I am assuming that debugfs is mounted under /sys/kernel/debug If not, try: mount -t debugfs none /sys/kernel/debug Change into the tracing directory: cd /sys/kernel/debug/tracing/ Make sure the function tracer is disabled: echo nop > current_tracer Enable all I2C events: echo ...
Const zipCode As Long = 10012 Dim zipCodeText As String 'Convert the zipCode number to a string of digit characters zipCodeText = CStr(zipCode) 'zipCodeText = "10012"
Const zipCode As long = 10012 Dim zeroPaddedNumber As String zeroPaddedZipCode = Format(zipCode, "00000000") 'zeroPaddedNumber = "00010012"
'Declare an array of bytes, assign single-byte character codes, and convert to a string Dim singleByteChars(4) As Byte singleByteChars(0) = 72 singleByteChars(1) = 101 singleByteChars(2) = 108 singleByteChars(3) = 108 singleByteChars(4) = 111 Dim stringFromSingleByteChars As String stringFro...
'Declare an array of bytes, assign multi-byte character codes, and convert to a string Dim multiByteChars(9) As Byte multiByteChars(0) = 87 multiByteChars(1) = 0 multiByteChars(2) = 111 multiByteChars(3) = 0 multiByteChars(4) = 114 multiByteChars(5) = 0 multiByteChars(6) = 108 multiByteChar...
As a root user: sudo nginx -s reload Ubuntu 14.04 example sudo service nginx reload Ubuntu 16.04 example sudo systemctl reload nginx Before reloading, it is a good idea to check config for syntax errors: sudo nginx -t Or sudo service nginx configtest
This is the first phase of referencing. Essentially when you assign by reference, you're allowing two variables to share the same value as such. $foo = &$bar; $foo and $bar are equal here. They do not point to one another. They point to the same place (the "value"). You can also...
Occasionally there comes time for you to implicitly return-by-reference. Returning by reference is useful when you want to use a function to find to which variable a reference should be bound. Do not use return-by-reference to increase performance. The engine will automatically optimize this o...

Page 284 of 826