This is a quick guide to Kotlin programming language. The previous part of this guide is here
#Object Oriented
fun main(args : Array<String>) {
class local (val x : Int)
val y = local(10)
println("${y.x}")| import android.text.TextUtils; | |
| import io.realm.Case; | |
| import io.realm.Realm; | |
| import io.realm.RealmObject; | |
| import io.realm.RealmResults; | |
| public class RealmFullTextSearch { | |
| public static <T extends RealmObject> RealmResults<T> search(Realm realm, Class<T> modelClass, String query, String fieldName, boolean partialSearch){ |
| class Person private constructor(val name: String, val surname: String, val age: Int) { | |
| private constructor(builder: Builder) : this(builder.name, builder.surname, builder.age) | |
| companion object { | |
| fun create(init: Builder.() -> Unit) = Builder(init).build() | |
| } | |
| class Builder private constructor() { |
This is a quick guide to Kotlin programming language. The previous part of this guide is here
#Object Oriented
fun main(args : Array<String>) {
class local (val x : Int)
val y = local(10)
println("${y.x}")| /* | |
| * Copyright 2015 Laurens Muller. | |
| * | |
| * Licensed under the Apache License, Version 2.0 (the "License"); | |
| * you may not use this file except in compliance with the License. | |
| * You may obtain a copy of the License at | |
| * | |
| * http://www.apache.org/licenses/LICENSE-2.0 | |
| * | |
| * Unless required by applicable law or agreed to in writing, software |
| package team2200.smartdashboard.extension.rectangletracker; | |
| import edu.wpi.first.smartdashboard.camera.LaptopExtension; | |
| import edu.wpi.first.smartdashboard.properties.BooleanProperty; | |
| import edu.wpi.first.smartdashboard.properties.NumberProperty; | |
| import edu.wpi.first.smartdashboard.types.DataType; | |
| import edu.wpi.first.wpijavacv.WPIBinaryImage; | |
| import edu.wpi.first.wpijavacv.WPIColor; | |
| import edu.wpi.first.wpijavacv.WPIColorImage; | |
| import edu.wpi.first.wpijavacv.WPIContour; |
Reactive Programming has been getting a lot of attention in the Android community lately. While it has uses throughout the application stack, we're going to focus here on using it to validate forms (exciting!). This approach cuts down on ugly nested if statements and transforms all of the validation logic to just a few simple lines using the RxJava framework. More, its robust and testable.
This post assumes some knowledge of how RxJava and lambdas work. If you need more of a refresher RxJava Retrolambda
| #!/usr/bin/env bash | |
| # | |
| # Converts Windows batch script to Linux shell script | |
| # | |
| # Invocation: | |
| # ./bat2sh script.bat | |
| # | |
| OUTFILE=${2:-${1%%.bat}.sh} |
| package com.company; | |
| import retrofit.RestAdapter; | |
| import retrofit.http.GET; | |
| import retrofit.http.Path; | |
| import rx.Observable; | |
| import rx.Subscriber; | |
| import rx.functions.Action1; | |
| import rx.functions.Func1; | |
| import rx.functions.Func2; |