Tutorial by Examples: ear

This example uses a search controller to filter the data inside a table view controller. The search bar is placed inside the navigation bar that the table view is embedded into. Embed a UITableViewController into a UINavigationController to get the UINavigationItem (which contains the navigation ...
This example uses a search controller to filter the cells in a table view controller. The search bar is placed inside the header view of the table view. The table view content is offset with the same height as the search bar so that the search bar is hidden at first. Upon scrolling up past the top e...
It is also possible to create archives of other items than HEAD, such as branches, commits, tags, and directories. To create an archive of a local branch dev: git archive --output=archive-dev.zip --prefix=src-directory-name dev To create an archive of a remote branch origin/dev: git archive --...
If you need to search an ActiveRecord model for similar values, you might be tempted to use LIKE or ILIKE but this isn't portable between database engines. Similarly, resorting to always downcasing or upcasing can create performance issues. You can use ActiveRecord's underlying Arel matches method...
To add/subtract time, use POSIXct, since it stores times in seconds ## adding/subtracting times - 60 seconds as.POSIXct("2016-01-01") + 60 # [1] "2016-01-01 00:01:00 AEDT" ## adding 3 hours, 14 minutes, 15 seconds as.POSIXct("2016-01-01") + ( (3 * 60 * 60) + (14 ...
You can remove all the elements in a set using the .clear() method: mySet.clear();
public static class ArrayHelpers { public static bool Contains<T>(this T[] array, T[] candidate) { if (IsEmptyLocate(array, candidate)) return false; if (candidate.Length > array.Length) return false; for (int a = 0; a <...
You can search Docker Hub for images by using the search command: docker search <term> For example: $ docker search nginx NAME DESCRIPTION STARS OFFICIAL AUTOMATED nginx Official build of Nginx. ...
One can clear the user data of a specific app using adb: adb shell pm clear <package> This is the same as to browse the settings on the phone, select the app and press on the clear data button. pm invokes the package manager on the device clear deletes all data associated with a packag...
Create SharedPreferences BuyyaPref SharedPreferences pref = getApplicationContext().getSharedPreferences("BuyyaPref", MODE_PRIVATE); Editor editor = pref.edit(); Storing data as KEY/VALUE pair editor.putBoolean("key_name1", true); // Saving boolean - true/false ...
Let's say you have a User model class User < ActiveRecord::Base end Now to update the first_name and last_name of a user with id = 1, you can write the following code. user = User.find(1) user.update(first_name: 'Kashif', last_name: 'Liaqat') Calling update will attempt to update the gi...
C-style bit-manipulation A bit can be cleared using the bitwise AND operator (&). // Bit x will be cleared number &= ~(1LL << x); Using std::bitset reset(x) or set(x,false) - clears the bit at position x. std::bitset<5> num(std::string("01100")); num.reset(2); ...
// Example of std::vector as an expanding dynamic size array. #include <algorithm> // std::sort #include <iostream> #include <vector> // std::vector using namespace std; int int_from( std::istream& in ) { int x = 0; in >> x; return x; } ...
Avoid Ambiguity The name of classes, structures, functions and variables should avoid ambiguity. Example: extension List { public mutating func remove(at position: Index) -> Element { // implementation } } The function call to this function will then look like this: li...
C++11 It's possible to write a generic function (for example min) which accepts various numerical types and arbitrary argument count by template meta-programming. This function declares a min for two arguments and recursively for more. template <typename T1, typename T2> auto min(const T1 &...
Search everywhere Double Shift Find Windows / Linux: Ctrl + F OS X / macOS: Cmd + F Find next F3 Find previous Shift + F3 Replace Windows / Linux: Ctrl + R OS X / macOS: Cmd + R Find in path Windows / Linux: Ctrl + Shift + F OS X / macOS: Cmd + Shift + F Replace in path Windows / Lin...
XML <Galaxy> <Light>sun</Light> <Device>satellite</Device> <Sensor>human</Sensor> <Name>Milky Way</Name> </Galaxy> XPATH /Galaxy/*[local-name()='Light' or local-name()='Device' or local-name()='Sensor'] or //*[...
XML <Data> <BioLight> <name>Firefly</name> <model>Insect</model> </BioLight> <ArtificialLight> <name>Fire</name> <model>Natural element</model> <source>flint<...
XML <College> <FootBall> <Members>20</Members> <Coach>Archie Theron</Coach> <Name>Wild cats</Name> <StarFootballer>David Perry</StarFootballer> </FootBall> <Academics> ...
XML <College> <FootBall> <Members>20</Members> <Coach>Archie Theron</Coach> <Name>Wild cats</Name> <StarPlayer>David Perry</StarPlayer> </FootBall> <VolleyBall> <Me...

Page 6 of 21