#A little example of how manipulate matrix with threads in C
- compile:
$ gcc -pthread squareMatrixItemsWithThreads.c -o squareMatrixItemsWithThreads
- run
$ ./squareMatrixItemsWithThreads
| // Using Class Fields on Kotlin | |
| public class Foo(var variable: String, val value: String, val withDefault: String = "o") { | |
| } | |
| // And use it on Kotlin | |
| Foo("f", "o", "o") | |
| Foo("f", "o") | |
| //------------------------------------------------------------------------------ |
| // Using Nullables on Kotlin | |
| var nothing = null | |
| var stringNullable: String? = null | |
| //------------------------------------------------------------------------------ | |
| // Using Nullables in Java 7 | |
| String alwaysCanBeNull = null |
| // Using Lambdas on Kotlin | |
| val items = ArrayList<String>() | |
| items.sortBy { item -> | |
| item.length() | |
| } | |
| //or more implicity | |
| items.sortBy { it.length() } | |
| //------------------------------------------------------------------------------ |
| // TODO test if works | |
| if (android.os.Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { | |
| int[][] states = new int[][] { new int[] { android.R.attr.state_pressed } }; | |
| int[] colors = new int[] { color }; | |
| ColorStateList colorStateList = new ColorStateList(states, colors); | |
| RippleDrawable rippleDrawable = new RippleDrawable(colorStateList, null, null); | |
| view.setBackground(rippleDrawable); | |
| } |
#A little example of how manipulate matrix with threads in C
$ gcc -pthread squareMatrixItemsWithThreads.c -o squareMatrixItemsWithThreads
$ ./squareMatrixItemsWithThreads
| [user] | |
| email = [email protected] | |
| name = Ademar Alves de Oliveira | |
| [push] | |
| default = simple | |
| [alias] | |
| a = add | |
| b = branch | |
| c = commit | |
| d = diff |
#Dynamic Programming
Just a study of biological sequence and how Dynamic Programming Alignment works
#How to
./dynamicProgramming.py -a ATA -b GATC > result.json
the result is a json that contains contains:
| import android.support.v7.widget.RecyclerView; | |
| import android.view.GestureDetector; | |
| import android.view.MotionEvent; | |
| public class RecyclerItemClickListener implements RecyclerView.OnItemTouchListener { | |
| private GestureDetector mGestureDetector; | |
| public RecyclerItemClickListener(Context context) { | |
| mGestureDetector = new GestureDetector(context, new GestureDetector.SimpleOnGestureListener() { |
| import kotlin.math.min | |
| fun levenshtein(lhs : CharSequence, rhs : CharSequence) : Int { | |
| if(lhs == rhs) { return 0 } | |
| if(lhs.isEmpty()) { return rhs.length } | |
| if(rhs.isEmpty()) { return lhs.length } | |
| val lhsLength = lhs.length + 1 | |
| val rhsLength = rhs.length + 1 |
| out/ |