(by @andrestaltz)
If you prefer to watch video tutorials with live-coding, then check out this series I recorded with the same contents as in this article: Egghead.io - Introduction to Reactive Programming.
| String[] tasks = ddata.getList(); | |
| Log.d("The Array", Arrays.toString(tasks)); | |
| lv.setAdapter(new ArrayAdapter<String>(this, android.R.layout.simple_selectable_list_item, tasks)); | |
| TextView selection = (TextView) findViewById(R.id.singleTask); | |
| lv.setOnItemLongClickListener(new AdapterView.OnItemLongClickListener() { | |
| @Override | |
| public boolean onItemLongClick(AdapterView<?> arg0, View arg1, | |
| int pos, long id) { |
| private AlertDialog showCustomDialog(final Activity act, | |
| CharSequence title, | |
| CharSequence message, | |
| CharSequence buttonYes, | |
| CharSequence buttonNo, | |
| final int selectedIndex) { | |
| AlertDialog.Builder customDialog = new AlertDialog.Builder(act); | |
| customDialog.setTitle(title); | |
| customDialog.setMessage(message); | |
| userAgents=[ | |
| /* 0 */"Mozilla/5.0 (X11; Linux i686) AppleWebKit/534.30 (KHTML, like Gecko) Ubuntu/10.10 Chromium/12.0.742.112 Chrome/12.0.742.112 Safari/534.30", | |
| /* 1 */"Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Ubuntu Chromium/31.0.1650.63 Chrome/31.0.1650.63 Safari/537.36", | |
| /* 2 */"Mozilla/5.0 (Windows NT 6.1; WOW64; rv:35.0) Gecko/20100101 Firefox/35.0", | |
| /* 3 */"Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/40.0.2214.111 Safari/537.36", | |
| /* 4 */"Mozilla/5.0 (Windows NT 5.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/40.0.2214.111 Safari/537.36", | |
| /* 5 */"Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/40.0.2214.111 Safari/537.36", | |
| /* 6 */"Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/40.0.2214.93 Safari/537.36", | |
| /* 7 */"Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/40.0.2214.115 Safari/537.36", | |
| /* 8 */"Mozilla/5.0 (Windows NT 6.1; WOW64) |
(by @andrestaltz)
If you prefer to watch video tutorials with live-coding, then check out this series I recorded with the same contents as in this article: Egghead.io - Introduction to Reactive Programming.
| #!/usr/bin/env bash | |
| # https://developers.supportbee.com/blog/setting-up-cucumber-to-run-with-Chrome-on-Linux/ | |
| # https://gist.github.com/curtismcmullan/7be1a8c1c841a9d8db2c | |
| # http://stackoverflow.com/questions/10792403/how-do-i-get-chrome-working-with-selenium-using-php-webdriver | |
| # http://stackoverflow.com/questions/26133486/how-to-specify-binary-path-for-remote-chromedriver-in-codeception | |
| # http://stackoverflow.com/questions/40262682/how-to-run-selenium-3-x-with-chrome-driver-through-terminal | |
| # http://askubuntu.com/questions/760085/how-do-you-install-google-chrome-on-ubuntu-16-04 | |
| # Versions | |
| CHROME_DRIVER_VERSION=`curl -sS chromedriver.storage.googleapis.com/LATEST_RELEASE` |
#Intro
Kotlin is a new programming language for the JVM. It produces Java bytecode, supports Android and generates JavaScript. The latest version of the language is Kotlin M5.3
Kotlin project website is at kotlin.jetbrains.org.
All the codes here can be copied and run on Kotlin online editor.
Let's get started.
"The trick is to catch exceptions at the proper layer, where your program can either meaningfully recover from the exception and continue without causing further errors, or provide the user with specific information, including instructions on how to recover from the error. When it is not practical for a method to do either of these, simply let the exception go so it can be caught later on and handled at the appropriate level."
Advantages of Exceptions
Excellent example of separating error-handling code from program logic
Three Rules for Effective Exception Handling
Longer explanation and case study of exception use, including the basic principles of "throw early" and "catch late". Clear and thorough.
| import java.io.File; | |
| import java.io.FileNotFoundException; | |
| import java.io.IOException; | |
| import java.util.InputMismatchException; | |
| import java.util.Random; | |
| import java.util.Scanner; | |
| public class Exceptions { | |
| // An exception is an event that occurs during the execution of a program |
| import java.time.*; | |
| import java.time.format.DateTimeFormatter; | |
| import java.time.format.FormatStyle; | |
| import java.time.temporal.ChronoUnit; | |
| import java.time.temporal.TemporalAdjusters; | |
| import java.util.*; | |
| import static java.time.temporal.TemporalAdjusters.*; | |
| public class Java8DateTimeExamples { |
| import com.petebevin.markdown.MarkdownProcessor | |
| import org.xhtmlrenderer.pdf.ITextRenderer | |
| import org.ccil.cowan.tagsoup.Parser | |
| import org.apache.xalan.xsltc.trax.SAX2DOM | |
| import org.xml.sax.InputSource | |
| buildscript{ | |
| repositories { | |
| mavenCentral() | |
| maven { |