This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class Main { | |
public static void main(String args[]) { | |
String givenString = "ABC ABCDAB ABCDABCDABDE"; | |
String searchedString = "ABCDABD"; | |
int givenStringLetterPosition = 0; | |
int searchedStringLetterPosition = 0; | |
int foundAt = -1; | |
while (givenStringLetterPosition < givenString.length()) { | |
if (givenString.charAt(givenStringLetterPosition) == searchedString.charAt(searchedStringLetterPosition)) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public interface SampleView { | |
void displayData(String data); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class SampleController { | |
private SampleView view; | |
public SampleController(SampleView view) { | |
this.view = view; | |
} | |
public void generateData() { | |
String generatedData = "Exemplary data generated by controller."; | |
view.displayData(generatedData); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class SampleActivity extends Activity implements SampleView { | |
@InjectView(R.id.sample_textview) | |
private sampleTextView; | |
private SampleController controller; | |
@Override | |
public displayData(String data) { | |
sampleTextView.setText(data); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original topic: http://stackoverflow.com/questions/7244321/how-to-update-github-forked-repository | |
In your local clone of your forked repository, you can add the original GitHub repository as a "remote". ("Remotes" are like nicknames for the URLs of repositories - origin is one, for example.) Then you can fetch all the branches from that upstream repository, and rebase your work to continue working on the upstream version. In terms of commands that might look like: | |
# Add the remote, call it "upstream": | |
git remote add upstream https://github.com/whoever/whatever.git | |
# Fetch all the branches of that remote into remote-tracking branches, | |
# such as upstream/master: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Gave up waiting for root device. Common problems: | |
- Boot args (cat /proc/cmdline) | |
- Check rootdelay= (did the system wait long enough?) | |
- Check root= (did the system wait for the right device) | |
- Missing modules (cat /proc/modules; ls /dev) | |
ALERT! /dev/disk/by-uuid/96889309-5f73-4688-8354-e64cd1bb158f does not exist. Dropping to a shell! | |
BusyBox v1.21.1 (Ubuntu 1:1.21.0-1ubuntu1) built-in shell (ash) | |
Enter 'help' for a list of build-in commands. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# /etc/fstab: static file system information. | |
# | |
# Use 'blkid' to print the universally unique identifier for a | |
# device; this may be used with UUID= as a more robust way to name devices | |
# that works even if disks are added and removed. See fstab(5). | |
# | |
# <file system> <mount point> <type> <options> <dump> <pass> | |
# / was on /dev/sda1 during installation | |
UUID=96889309-5f73-4688-8354-e64cd1bb158f / ext4 errors=remount-ro 0 1 | |
# swap was on /dev/sda5 during installation |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# /etc/fstab: static file system information. | |
# | |
# Use 'blkid' to print the universally unique identifier for a | |
# device; this may be used with UUID= as a more robust way to name devices | |
# that works even if disks are added and removed. See fstab(5). | |
# | |
# <file system> <mount point> <type> <options> <dump> <pass> | |
# / was on /dev/sda1 during installation | |
UUID=/dev/sda1 / ext4 errors=remount-ro 0 1 | |
# UUID=96889309-5f73-4688-8354-e64cd1bb158f / ext4 errors=remount-ro 0 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Override | |
protected void onResume() { | |
super.onResume(); | |
bus.register(this); | |
networkEvents.register(); | |
} | |
@Override | |
protected void onPause() { | |
super.onPause(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Bus bus = new Bus(); | |
NetworkEvents networkEvents = new NetworkEvents(this, bus); |