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 BubbleSort { | |
/** Bubble sort method */ | |
public static void bubbleSort(int[] list) { | |
boolean needNextPass = true; | |
for (int k = 1; k < list.length && needNextPass; k++) { | |
// Array may be sorted and next pass not needed | |
needNextPass = false; | |
for (int i = 0; i < list.length - k; i++) { | |
if (list[i] > list[i + 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
add | |
<button id="aboutBtn">About</button> |
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
download or clone https://github.com/johnwargo/apache-cordova-api-cookbook-code | |
cordova create ... | |
cordova platform add android | |
graft content from | |
~/Downloads/apache-cordova-api-cookbook-code-master/chapter14-media/Ex14.1 (your downloads, of course) | |
cordova plugin add cordova-plugin-media | |
cordova plugin add cordova-plugin-device |
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
Homebrew build logs for udacity/carnd-mpc-project/mumps on macOS 10.13.3 | |
Build date: 2018-03-06 00:14:37 |
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
add drawables | |
add to strings (can use translations or copy/paste) | |
create a new TableLayout underlayouts called photos.xml | |
add rows (can be found below) | |
create a new LinearLayout underlayouts called tours.xml | |
add stuff (can be found below) |
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
private String decToBase(int d, int base) { | |
// credit to and adapted from: | |
// https://stackoverflow.com/questions/13465098/decimal-to-hexadecimal-converter-in-java | |
// Note that there are several one-liners that can be used too | |
String digits = "0123456789ABCDEF"; | |
String hex = ""; | |
if (d <= 0) hex = "0"; | |
while (d > 0) { | |
int digit = d % base; // rightmost digit | |
hex = digits.charAt(digit) + hex; // string concatenation |
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
// refer to the Java code here: | |
// https://gist.github.com/rjlutz/3c26a1be877529de8dd28049d12415d0 | |
// complete the dart implementation below to have the same functionality | |
class Palindrome { | |
// TODO implement check | |
static check(String s) { | |
return true; | |
} | |
} |
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
package package <<YOUR PACKAGE HERE>>; | |
import java.util.HashMap; | |
public class Categories extends HashMap<String, String> { | |
public Categories() { | |
put("Home","home"); | |
put("Opinion", "opinion"); | |
put("World", "world"); |
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
1 - Use existing Android Studio project or create a new project. If new, start with a Basic Activity so that the Settings pulldown is available under the Options menu. | |
2 - It might be good to test deploy to make sure everyting is working ok. | |
3 - Create a new SettingsActivity. File -> New -> Activity -> SettingsActivity | |
4 - Link the new Activity to the Options menu. Navigate to app -> java -> <<your package>> -> MainActivity.java and add the following to onOptionsItemSelected(): | |
@Override | |
public boolean onOptionsItemSelected(MenuItem item) { |
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
// thanks - https://flutter.io/docs/cookbook/persistence/reading-writing-files | |
import 'dart:async'; | |
import 'dart:io'; | |
import 'package:path_provider/path_provider.dart'; | |
import 'student.dart'; | |
class Storage { | |
Future<String> get _localPath async { | |
final directory = await getApplicationDocumentsDirectory(); |