Tutorial by Examples: f

View jsFiddle: https://jsfiddle.net/HimmatChahal/jb5trg67/ Copy + Pasteable code below: <html> <body> <h1>This will fade in at 60 frames per second (or as close to possible as your hardware allows)</h1> <script> // Fad...
An enum is a set of logically related constants. Enum Size Small Medium Large End Enum Public Sub Order(shirtSize As Size) Select Case shirtSize Case Size.Small ' ... Case Size.Medium ' ... Case Size.Large ' ....
With the <Flags> attribute, the enum becomes a set of flags. This attribute enables assigning multiple values to an enum variable. The members of a flags enum should be initialized with powers of 2 (1, 2, 4, 8...). Module Module1 <Flags> Enum Material Wood = 1 ...
public class Email { public string To { get; set; } public string From { get; set; } public string Subject { get; set; } public string Body { get; set; } } public class EmailBuilder { private readonly Email _email; public EmailBuilder() { _email = ...
git commit -m 'Fix UI bug' --date 2016-07-01 The --date parameter sets the author date. This date will appear in the standard output of git log, for example. To force the commit date too: GIT_COMMITTER_DATE=2016-07-01 git commit -m 'Fix UI bug' --date 2016-07-01 The date parameter accepts t...
To set up a controller with user authentication using devise, add this before_action: (assuming your devise model is 'User'): before_action :authenticate_user! To verify if a user is signed in, use the following helper: user_signed_in? For the current signed-in user, use this helper: current_us...
Omitting the return statement in a function which is has a return type that is not void is undefined behavior. int function() { // Missing return statement } int main() { function(); //Undefined Behavior } Most modern day compilers emit a warning at compile time for this kind o...
C++11 char *str = "hello world"; str[0] = 'H'; "hello world" is a string literal, so modifying it gives undefined behaviour. The initialisation of str in the above example was formally deprecated (scheduled for removal from a future version of the standard) in C++03. A num...
Events that work with most form elements (e.g., change, keydown, keyup, keypress) do not work with contenteditable. Instead, you can listen to changes of contenteditable contents with the input event. Assuming contenteditableHtmlElement is a JS DOM object that is contenteditable: contenteditableH...
It is best practice in any programming language to avoid premature optimization. However, if testing reveals that your code is running too slowly, you may gain some speed by switching off some of the application’s properties while it runs. Add this code to a standard module: Public Sub SpeedUp( _ ...
with pd.ExcelFile('path_to_file.xls) as xl: d = {sheet_name: xl.parse(sheet_name) for sheet_name in xl.sheet_names}
pd.read_excel('path_to_file.xls', sheetname='Sheet1') There are many parsing options for read_excel (similar to the options in read_csv. pd.read_excel('path_to_file.xls', sheetname='Sheet1', header=[0, 1, 2], skiprows=3, index_col=0) # etc.
To rename a folder from oldName to newName git mv directoryToFolder/oldName directoryToFolder/newName Followed by git commit and/or git push If this error occurs: fatal: renaming 'directoryToFolder/oldName' failed: Invalid argument Use the following command: git mv directoryToFolder/oldN...
Returning lambdas (or closures) from functions can be tricky because they implement traits and thus their exact size is rarely known. // Box in the return type moves the function from the stack to the heap fn curried_adder(a: i32) -> Box<Fn(i32) -> i32> { // 'move' applies move se...
// Include sequence containers #include <vector> #include <deque> #include <list> // Insert sorting algorithm #include <algorithm> class Base { public: // Constructor that set variable to the value of v Base(int v): variable(v) { } i...
Model with ForeignKey We will work with these models : from django.db import models class Book(models.Model): name= models.CharField(max_length=50) author = models.ForeignKey(Author) class Author(models.Model): name = models.CharField(max_length=50) Suppose we often (always) access ...
It is undefined behavior to access an index that is out of bounds for an array (or standard library container for that matter, as they are all implemented using a raw array): int array[] = {1, 2, 3, 4, 5}; array[5] = 0; // Undefined behavior It is allowed to have a pointer pointing to the en...
public string Remove() { string input = "Hello./!"; return Regex.Replace(input, "[^a-zA-Z0-9]", ""); }
This is a runtime error that happens when you request a large amount of memory on the heap. This is common when loading a Bitmap into an ImageView. You have some options: Use a large application heap Add the "largeHeap" option to the application tag in your AndroidManifest.xml. This...
In Swift, structures use a simple “dot syntax” to access their members. For example: struct DeliveryRange { var range: Double let center: Location } let storeLocation = Location(latitude: 44.9871, longitude: -93.2758) var pizzaRange = DeliveryRange(range: 200...

Page 71 of 457