Beware of using "downcasting" - Downcasting is casting down the inheritance hierarchy from a base class to a subclass (i.e. opposite of polymorphism). In general, use polymorphism & overriding instead of instanceof & downcasting.
C++ Example
// explicit type case required
Child ...
Add a new file to Xcode (File > New > File), then select “Source” and click
“Header File“.
Name your file “YourProjectName-Bridging-Header.h”. Example: In my app Station, the file is named “Station-Bridging-Header”.
Create the file.
Navigate to your project build settings ...
To find the word foo in the file bar :
grep foo ~/Desktop/bar
To find all lines that do not contain foo in the file bar :
grep –v foo ~/Desktop/bar
To use find all words containing foo in the end (WIldcard Expansion):
grep "*foo" ~/Desktop/bar
For an executable file or command exec, running this will list all system calls:
$ ptrace exec
To display specific system calls use -e option:
$ strace -e open exec
To save the output to a file use the -o option:
$ strace -o output exec
To find the system calls an active program uses, us...
This is continuation of previous example.
Cascading DropDown for country's city name. This method will be called by Jquery when user is done with country selection in parent dropdown. I have followed MVC concept and provided the basic approach for cascading dropdown.
Ajax will call GetCityName met...
import csv
#------ We will write to CSV in this function ------------
def csv_writer(data, path):
#Open CSV file whose path we passed.
with open(path, "wb") as csv_file:
writer = csv.writer(csv_file, delimiter=',')
for line in data:
...
Step 1: Make a design of GridView for displaying your data (HTML Code):
<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="false">
<Columns>
<asp:TemplateField HeaderText="ID">
<ItemTemplate>
...
You can look at example in Fastjson library
Encode
import com.alibaba.fastjson.JSON;
Group group = new Group();
group.setId(0L);
group.setName("admin");
User guestUser = new User();
guestUser.setId(2L);
guestUser.setName("guest");
User rootUser = new User();
rootU...
After installing perforce and setup your workspace through p4v, you could set up your workspace in Windows cmd.
The command you need is:
p4 set
Set your server
p4 set P4PORT= xx.xxx.xx.xxx:xxxxx
Set your user name
p4 set P4USER=username
Set your password
In terms of setting your passwo...
public class BaseViewModel extends ViewModel {
private static final int TAG_SEGMENT_INDEX = 2;
private static final int VIDEOS_LIMIT = 100;
// We save input params here
private final MutableLiveData<Pair<String, String>> urlWithReferrerLiveData = new MutableLiveData...
Each UI component lifecycle changed as shown at image.
You may create component, that will be notified on lifecycle state change:
public class MyLocationListener implements LifecycleObserver {
private boolean enabled = false;
private Lifecycle lifecycle;
public MyLocationListener(...
This example requires MdDialogRef and MD_DIALOG_DATA. Please import them in the component module.
import {MdDialog, MdDialogRef, MD_DIALOG_DATA} from '@angular/material';
input-overview-example.html:
<md-input-container>
<input mdInput
[(ngModel)]="id"
...
There are benefits to switching the root view controller, although the transition options are limited to those supported by UIViewAnimationOptions, so depending on how you wish to transition between flows might mean you have to implement a custom transition - which can be cumbersome.
You can show t...
In the most straightforward implementation, the Onboarding flow can simply be presented in a modal context, since semantically the User is on a single journey.
[Apple Human Interface Guidelines – Modality][1]:
Consider creating a modal context only when it’s critical to get someone’s attention, ...
First, you will need to install Push.js module.
$ npm install push.js --save
Or import it to your front-end app through CDN
<script src="./push.min.js"></script> <!-- CDN link -->
After you are done with that, you should be good to go. This is how it should look l...