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
class SimpleMap<in K, V> { | |
private var keys = ArrayList<K>() | |
private var values = ArrayList<V>() | |
operator fun get(key: K): V { | |
return values[keys.indexOf(key)] | |
} | |
operator fun set(key: K, value: V) { |
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
registerReceiver(object : BroadcastReceiver() { | |
override fun onReceive(context: Context, intent: Intent) { | |
if ((intent.extras["networkInfo"] as NetworkInfo).state != NetworkInfo.State.CONNECTED) { | |
Toast.makeText(context, R.string.networkErr, Toast.LENGTH_LONG).show() | |
unregisterReceiver(this) | |
finish() | |
return | |
} | |
} | |
}, IntentFilter(ConnectivityManager.CONNECTIVITY_ACTION)) |
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 pro.eugw.lessoncountdown.dialog | |
import android.content.Context | |
import android.os.Bundle | |
import android.support.v4.app.DialogFragment | |
import android.view.LayoutInflater | |
import android.view.View | |
import android.view.ViewGroup | |
import com.android.volley.RequestQueue | |
import com.android.volley.Response |
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 pro.eugw.lessoncountdown.dialog | |
import android.content.Context | |
import android.os.Bundle | |
import android.support.v4.app.DialogFragment | |
import android.view.LayoutInflater | |
import android.view.View | |
import android.view.ViewGroup | |
import com.android.volley.RequestQueue | |
import com.android.volley.Response |
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
val langData = mapOf( | |
Pair("English", "eng.traineddata"), | |
Pair("Spanish", "spa.traineddata"), | |
Pair("Italian", "ita.traineddata"), | |
Pair("Russian", "rus.traineddata"), | |
Pair("Polish", "pol.traineddata"), | |
Pair("French", "fra.traineddata"), | |
Pair("German", "deu.traineddata"), | |
Pair("Portuguese", "por.traineddata"), | |
Pair("Japanese", "jpn.traineddata"), |
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
val array = theme.obtainStyledAttributes(intArrayOf(android.R.attr.colorAccent)) | |
val backgroundcolor = array.getColor(0, 0xFF00FF) | |
println(String.format("#%06X", (0xFFFFFF and backgroundcolor))) |
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
echo "$1 vs $2" | |
mkdir temp/ | |
unzip -q $1 -d temp/$1.d/ | |
unzip -q $2 -d temp/$2.d/ | |
cd temp | |
cd $1.d | |
find -type f > ../$1.txt | |
cd .. | |
cd $2.d | |
find -type f > ../$2.txt |
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
#include <stdio.h> | |
#include <stdlib.h> | |
#include <string.h> | |
// d) | |
char* getAlphabet() { | |
char* pAlp = malloc(26); //Выделение памяти | |
if (pAlp == NULL) { | |
printf("Cannot allocate memory"); | |
return NULL; |
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
---------------------------------------------- | |
Address of int = 000000419718FAC4 | |
Value of pointer to int = 1 | |
Address of pointer to int = 000000419718FB28 | |
Value of int = 1 | |
Size of int = 4 | |
Size of pointer to int = 8 | |
---------------------------------------------- | |
Address of char = 000000419718FAE4 | |
Value of pointer to char = z |
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
#include <stdio.h> // Стандартный ввод/вывод | |
#include <stdlib.h> // Стандартная библиотека | |
#ifdef _WIN32 | |
#define CLEAR_COMM "cls" | |
#else | |
#define CLEAR_COMM "clear" | |
#endif | |
typedef enum { // Перечисление типов ламп |
OlderNewer