Tutorial by Examples: ad

The second value in the curly braces dictates the length of the replacement string. By adjusting the second value to be positive or negative, the alignment of the string can be changed. string.Format("LEFT: string: ->{0,-5}<- int: ->{1,-5}<-", "abc", 123); string....
Create a circle image with glide. public class CircleTransform extends BitmapTransformation { public CircleTransform(Context context) { super(context); } @Override protected Bitmap transform(BitmapPool pool, Bitmap toTransform, int outWidth, int outHeight) { ret...
The splice()method can be used to remove elements from an array. In this example, we remove the first 3 from the array. var values = [1, 2, 3, 4, 5, 3]; var i = values.indexOf(3); if (i >= 0) { values.splice(i, 1); } // [1, 2, 4, 5, 3] The splice() method can also be used to add elemen...
ALTER TABLE EMPLOYEES ADD pk_EmployeeID PRIMARY KEY (ID) This will add a Primary key to the table Employees on the field ID. Including more than one column name in the parentheses along with ID will create a Composite Primary Key. When adding more than one column, the column names must be separat...
To increment date objects in Javascript, we can usually do this: var checkoutDate = new Date(); // Thu Jul 21 2016 10:05:13 GMT-0400 (EDT) checkoutDate.setDate( checkoutDate.getDate() + 1 ); console.log(checkoutDate); // Fri Jul 22 2016 10:05:13 GMT-0400 (EDT) It is possible to use setD...
HTML <p>My shadow always follows me.</p> CSS p { -webkit-filter: drop-shadow(10px 10px 1px green); filter: drop-shadow(10px 10px 1px green); } Result
Start ADB: adb kill-server Stop ADB: adb start-server
Here is an example of a method that would live inside a SQLiteOpenHelper subclass. It uses the searchTerm String to filter the results, iterates through the Cursor's contents, and returns those contents in a List of Product Objects. First, define the Product POJO class that will be the container f...
// Calculate what day of the week is 36 days from this instant. System.DateTime today = System.DateTime.Now; System.TimeSpan duration = new System.TimeSpan(36, 0, 0, 0); System.DateTime answer = today.Add(duration); System.Console.WriteLine("{0:dddd}", answer);
Add days into a dateTime object. DateTime today = DateTime.Now; DateTime answer = today.AddDays(36); Console.WriteLine("Today: {0:dddd}", today); Console.WriteLine("36 days from today: {0:dddd}", answer); You also can subtract days passing a negative value: DateTime today...
double[] hours = {.08333, .16667, .25, .33333, .5, .66667, 1, 2, 29, 30, 31, 90, 365}; DateTime dateValue = new DateTime(2009, 3, 1, 12, 0, 0); foreach (double hour in hours) Console.WriteLine("{0} + {1} hour(s) = {2}", dateValue, hour, ...
string dateFormat = "MM/dd/yyyy hh:mm:ss.fffffff"; DateTime date1 = new DateTime(2010, 9, 8, 16, 0, 0); Console.WriteLine("Original date: {0} ({1:N0} ticks)\n", date1.ToString(dateFormat), date1.Ticks); DateTime date2 = date1.AddMilliseconds(1); Console....
Add years on the dateTime object: DateTime baseDate = new DateTime(2000, 2, 29); Console.WriteLine("Base Date: {0:d}\n", baseDate); // Show dates of previous fifteen years. for (int ctr = -1; ctr >= -15; ctr--) Console.WriteLine("{0,2} year(s) ago:{1:d}", ...
Properties can be added with categories using associated objects, a feature of the Objective-C runtime. Note that the property declaration of retain, nonatomic matches the last argument to objc_setAssociatedObject. See Attach object to another existing object for explanations. #import <objc/run...
As Handlers are used to send Messages and Runnables to a Thread's message queue it's easy to implement event based communication between multiple Threads. Every Thread that has a Looper is able to receive and process messages. A HandlerThread is a Thread that implements such a Looper, for example th...
Naming Convention Notifications are identified by global NSString objects whose names are composed in this way: Name of associated class + Did | Will + UniquePartOfName + Notification For example: NSApplicationDidBecomeActiveNotification NSWindowDidMiniaturizeNotification NSTextViewDidChange...
my $filename = '/path/to/file'; open my $fh, '<', $filename or die "Failed to open file: $filename"; # You can then either read the file one line at a time... while(chomp(my $line = <$fh>)) { print $line . "\n"; } # ...or read whole file into an arra...
You can specify a column that contains dates so pandas would automatically parse them when reading from the csv pandas.read_csv('data_file.csv', parse_dates=['date_column'])
var MyDict = new Dictionary<string,T>(StringComparison.InvariantCultureIgnoreCase)
In certain situations, data declarations can be performed inline. LOOP AT lt_sflight INTO DATA(ls_sflight). WRITE ls_sflight-carrid. ENDLOOP.

Page 16 of 114