Help with SQL commands to interact with a MySQL database
- Mac /usr/local/mysql/bin
- Windows /Program Files/MySQL/MySQL version/bin
- Xampp /xampp/mysql/bin
Magic words:
psql -U postgres
Some interesting flags (to see all, use -h
or --help
depending on your psql version):
-E
: will describe the underlaying queries of the \
commands (cool for learning!)-l
: psql will list all databases and then exit (useful if the user you connect with doesn't has a default database, like at AWS RDS)/** | |
* Coroutine-based solution for delayed and periodic work. May fire once (if [interval] omitted) | |
* or periodically ([startDelay] defaults to [interval] in this case), replacing both | |
* `Observable.timer()` & `Observable.interval()` from RxJava. | |
* | |
* In contrast to RxJava, intervals are calculated since previous run completion; this is more | |
* convenient for potentially long work (prevents overlapping) and does not suffer from queueing | |
* multiple invocations in Doze mode on Android. | |
* | |
* Dispatcher is inherited from scope, may be overridden via [context] parameter. |
#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.
This is a collection of the most common commands I run while administering Postgres databases. The variables shown between the open and closed tags, "<" and ">", should be replaced with a name you choose. Postgres has multiple shortcut functions, starting with a forward slash, "". Any SQL command that is not a shortcut, must end with a semicolon, ";". You can use the keyboard UP and DOWN keys to scroll the history of previous commands you've run.
http://www.postgresql.org/download/linux/ubuntu/ https://help.ubuntu.com/community/PostgreSQL
# | |
# Recommended minimum configuration: | |
# | |
# Example rule allowing access from your local networks. | |
# Adapt to list your (internal) IP networks from where browsing | |
# should be allowed | |
# Auth | |
auth_param basic program /usr/lib64/squid/basic_ncsa_auth /etc/squid/squid_passwd |
Notes:
.main.kts
and kotlin-main-kts.jar
has to be on classpath. See https://youtrack.jetbrains.com/issue/KT-27853kotlinc
: https://kotlinlang.org/docs/tutorials/command-line.html
To edit this in IntelliJ IDEA:
idea
folder next to the .kts
filebuild.gradle
to that folderidea/build.gradle
.1. HiltViewModel (hiltvm) - it assumes you are using State and Event classes for ViewModel, as well as UiEvent class for handling one time UI events: | |
import androidx.lifecycle.ViewModel | |
import androidx.lifecycle.viewModelScope | |
import com.mssmk.cleanarchitecturetemplate.ui.utils.UiEvent | |
import kotlinx.coroutines.channels.Channel | |
import dagger.hilt.android.lifecycle.HiltViewModel | |
import kotlinx.coroutines.flow.MutableStateFlow | |
import kotlinx.coroutines.flow.receiveAsFlow | |
import kotlinx.coroutines.launch | |
import javax.inject.Inject |
@Database(entities = arrayOf(Note::class, User::class), version = 1) | |
@TypeConverters(Converters::class) | |
abstract class AppDatabse : RoomDatabase() { | |
abstract fun userDAO(): UserDAO | |
abstract fun noteDAO(): NoteDAO | |
} |