From 68ca4e4f862d45d0f0577e322f0717fb1f92f3b8 Mon Sep 17 00:00:00 2001 From: Marcello Lamonaca <marcello@lamonaca.eu> Date: Fri, 13 May 2022 18:33:39 +0200 Subject: [PATCH] Rename all file to kebab-case --- Android/Activity.kt.md | 438 ------------------ Android/Adapter.kt.md | 86 ---- Android/Fragment.md | 154 ------ Android/Gradle & Building.md | 35 -- Android/MapsActivity.md | 84 ---- Android/SQLite.md | 101 ---- Android/activity.xml.md | 215 --------- C++/{C++.md => cpp.md} | 0 Bash/Bash Commands.md => bash/commands.md | 0 Bash/Bash Scripting.md => bash/scripting.md | 0 CSS/CSS.md => css/css.md | 0 Database/MongoDB.md => database/mongo-db.md | 0 Database/Redis.md => database/redis.md | 0 Database/SQL.md => database/sql.md | 0 {DotNet => dotnet}/C#/C#.md | 0 .../C#/async-programming.md | 0 .../C#/collections.md | 0 DotNet/C#/LINQ.md => dotnet/C#/linq.md | 0 .../C#/reactive-extensions.md | 0 .../C#/unit-tests.md | 0 .../asp.net}/Razor Syntax.md | 0 .../asp.net/app-configuration.md | 0 .../Blazor.md => dotnet/asp.net/blazor.md | 0 .../Filters.md => dotnet/asp.net/filters.md | 0 .../asp.net/middleware.md | 0 .../asp.net/minimal-api.md | 0 .../ASP.NET/MVC.md => dotnet/asp.net/mvc.md | 0 .../asp.net/razor-pages.md | 0 .../REST API.md => dotnet/asp.net/rest-api.md | 0 .../SignalR.md => dotnet/asp.net/signal-r.md | 0 .../asp.net/web-forms.md | 0 .../ADO.NET.md => dotnet/database/ado.net.md | 0 .../database/entity-framework.md | 0 .../Scripting.md => dotnet/godot/scripting.md | 0 .../SkiaSharp.md => dotnet/lib/skia-sharp.md | 0 .../unity/collisions.md | 0 .../unity/coroutines.md | 0 .../unity/input-manager.md | 0 .../unity/prefabs-instantiation.md | 0 .../unity/raycasting.md | 0 .../Scripting.md => dotnet/unity/scripting.md | 0 .../unity/vectors-tranfrorms-space.md | 0 .../xamarin/app.xaml.cs.md | 0 .../App.xaml.md => dotnet/xamarin/app.xaml.md | 0 .../xamarin/page.xaml.cs.md | 0 .../xamarin/page.xaml.md | 0 .../xamarin/view-model.cs.md | 0 .../xamarin/xamarin-essentials.md | 0 {Git => git}/git.md | 0 GraphQL.md => graph-ql.md | 0 HTML/HTML.md => html/html.md | 0 iOS/App (XCode 12).md | 14 - iOS/AppDelegate (XCode 11) .md | 75 --- iOS/SceneDelegate (XCode 11).md | 58 --- iOS/ContentView.md => ios/content-view.md | 0 Java/DAO.md => java/dao.md | 0 .../java-collection-framework.md | 0 Java/Java.md => java/java.md | 0 .../spring}/pom.xml.md | 0 .../spring/spring-project.md | 0 .../Servlet.md => java/web/servlet.md | 0 JavaScript/AJAX.md => javascript/ajax.md | 0 JavaScript/DOM.md => javascript/dom.md | 0 .../events-animation.md | 0 .../JavaScript.md => javascript/javascript.md | 0 JavaScript/jQuery.md => javascript/jquery.md | 0 .../react/react-router.md | 0 .../react/react-tests.md | 0 .../React.md => javascript/react/react.md | 0 .../react/redux-tests.md | 0 .../Redux.md => javascript/react/redux.md | 0 .../Svelte.md => javascript/svelte/svelte.md | 0 {Kotlin => kotlin}/kotlin.md | 0 Markdown.md => markdown.md | 0 .../composer.md | 0 PHP/Database.md => php/database.md | 0 .../dependecy-injection.md | 0 PHP/PHP.md => php/php.md | 0 .../plates-templating.md | 0 PHP/PSR-7.md => php/psr-7.md | 0 .../REST API.md => php/simple-mvc/rest-api.md | 0 .../simple-mvc/simple-mvc.md | 0 PHP/Unit Testing.md => php/unit-tests.md | 0 PHP/Web.md => php/web.md | 0 .../commands.md | 0 .../scripting.md | 0 .../jupyter/jupiter-notebook.md | 0 {Python/Libs/CLI => python/libs/cli}/click.md | 0 .../Tkinter.md => python/libs/gui/tkinter.md | 0 .../Pillow.md => python/libs/image/pillow.md | 0 .../libs/image/py-cairo.md | 0 .../NumPy.md => python/libs/math/numpy.md | 0 .../Pandas.md => python/libs/math/pandas.md | 0 .../Libs/Math => python/libs/math}/seaborn.md | 0 .../libs/web/beautiful-soup.md | 0 .../libs/web/flask/flask-requests.md | 0 .../libs/web/flask/flask.md | 0 .../Libs/Web => python/libs/web}/requests.md | 0 Python/Python.md => python/python.md | 0 .../standard-library}/argparse.md | 0 .../standard-library}/collections.md | 0 .../standard-library}/csv.md | 0 .../standard-library}/ftplib.md | 0 .../standard-library}/itertools.md | 0 .../standard-library}/json.md | 0 .../standard-library}/logging.md | 0 .../standard-library}/shutil.md | 0 .../standard-library}/smtplib.md | 0 .../standard-library}/socket.md | 0 .../standard-library}/sqllite.md | 0 .../standard-library}/time_datetime.md | 0 .../standard-library}/unittest.md | 0 ...arExpressions.md => regular-expressions.md | 0 Rust/Cargo.md => rust/cargo.md | 0 Rust/Rust.md => rust/rust.md | 0 Rust/Unit Tests.md => rust/unit-tests.md | 0 Swift/Swift.md => swift/swift.md | 0 117 files changed, 1260 deletions(-) delete mode 100644 Android/Activity.kt.md delete mode 100644 Android/Adapter.kt.md delete mode 100644 Android/Fragment.md delete mode 100644 Android/Gradle & Building.md delete mode 100644 Android/MapsActivity.md delete mode 100644 Android/SQLite.md delete mode 100644 Android/activity.xml.md rename C++/{C++.md => cpp.md} (100%) rename Bash/Bash Commands.md => bash/commands.md (100%) rename Bash/Bash Scripting.md => bash/scripting.md (100%) rename CSS/CSS.md => css/css.md (100%) rename Database/MongoDB.md => database/mongo-db.md (100%) rename Database/Redis.md => database/redis.md (100%) rename Database/SQL.md => database/sql.md (100%) rename {DotNet => dotnet}/C#/C#.md (100%) rename DotNet/C#/Async Programming.md => dotnet/C#/async-programming.md (100%) rename DotNet/C#/C# Collections.md => dotnet/C#/collections.md (100%) rename DotNet/C#/LINQ.md => dotnet/C#/linq.md (100%) rename DotNet/C#/Reactive Extensions.md => dotnet/C#/reactive-extensions.md (100%) rename DotNet/C#/Unit Testing.md => dotnet/C#/unit-tests.md (100%) rename {DotNet/ASP.NET => dotnet/asp.net}/Razor Syntax.md (100%) rename DotNet/ASP.NET/App Configuration.md => dotnet/asp.net/app-configuration.md (100%) rename DotNet/ASP.NET/Blazor.md => dotnet/asp.net/blazor.md (100%) rename DotNet/ASP.NET/Filters.md => dotnet/asp.net/filters.md (100%) rename DotNet/ASP.NET/Middleware.md => dotnet/asp.net/middleware.md (100%) rename DotNet/ASP.NET/Minimal API.md => dotnet/asp.net/minimal-api.md (100%) rename DotNet/ASP.NET/MVC.md => dotnet/asp.net/mvc.md (100%) rename DotNet/ASP.NET/Razor Pages.md => dotnet/asp.net/razor-pages.md (100%) rename DotNet/ASP.NET/REST API.md => dotnet/asp.net/rest-api.md (100%) rename DotNet/ASP.NET/SignalR.md => dotnet/asp.net/signal-r.md (100%) rename DotNet/ASP.NET/WebForms.md => dotnet/asp.net/web-forms.md (100%) rename DotNet/Database/ADO.NET.md => dotnet/database/ado.net.md (100%) rename DotNet/Database/EntityFramework.md => dotnet/database/entity-framework.md (100%) rename DotNet/Godot/Scripting.md => dotnet/godot/scripting.md (100%) rename DotNet/Lib/SkiaSharp.md => dotnet/lib/skia-sharp.md (100%) rename DotNet/Unity/Collisions.md => dotnet/unity/collisions.md (100%) rename DotNet/Unity/Coroutines.md => dotnet/unity/coroutines.md (100%) rename DotNet/Unity/Input Manager.md => dotnet/unity/input-manager.md (100%) rename DotNet/Unity/Prefabs Instantiation.md => dotnet/unity/prefabs-instantiation.md (100%) rename DotNet/Unity/Raycasting.md => dotnet/unity/raycasting.md (100%) rename DotNet/Unity/Scripting.md => dotnet/unity/scripting.md (100%) rename DotNet/Unity/Vector, Tranfrorm, Space.md => dotnet/unity/vectors-tranfrorms-space.md (100%) rename DotNet/Xamarin/App.xaml.cs.md => dotnet/xamarin/app.xaml.cs.md (100%) rename DotNet/Xamarin/App.xaml.md => dotnet/xamarin/app.xaml.md (100%) rename DotNet/Xamarin/Page.xaml.cs.md => dotnet/xamarin/page.xaml.cs.md (100%) rename DotNet/Xamarin/Page.xaml.md => dotnet/xamarin/page.xaml.md (100%) rename DotNet/Xamarin/ViewModel.cs.md => dotnet/xamarin/view-model.cs.md (100%) rename DotNet/Xamarin/Xamarin.Essentials.md => dotnet/xamarin/xamarin-essentials.md (100%) rename {Git => git}/git.md (100%) rename GraphQL.md => graph-ql.md (100%) rename HTML/HTML.md => html/html.md (100%) delete mode 100644 iOS/App (XCode 12).md delete mode 100644 iOS/AppDelegate (XCode 11) .md delete mode 100644 iOS/SceneDelegate (XCode 11).md rename iOS/ContentView.md => ios/content-view.md (100%) rename Java/DAO.md => java/dao.md (100%) rename Java/Java Collection Framework.md => java/java-collection-framework.md (100%) rename Java/Java.md => java/java.md (100%) rename {Java/Spring Framework => java/spring}/pom.xml.md (100%) rename Java/Spring Framework/Spring Project Structure.md => java/spring/spring-project.md (100%) rename Java/Java Web/Servlet.md => java/web/servlet.md (100%) rename JavaScript/AJAX.md => javascript/ajax.md (100%) rename JavaScript/DOM.md => javascript/dom.md (100%) rename JavaScript/Events & Animation.md => javascript/events-animation.md (100%) rename JavaScript/JavaScript.md => javascript/javascript.md (100%) rename JavaScript/jQuery.md => javascript/jquery.md (100%) rename JavaScript/React/React Router.md => javascript/react/react-router.md (100%) rename JavaScript/React/React Tests.md => javascript/react/react-tests.md (100%) rename JavaScript/React/React.md => javascript/react/react.md (100%) rename JavaScript/React/Redux Tests.md => javascript/react/redux-tests.md (100%) rename JavaScript/React/Redux.md => javascript/react/redux.md (100%) rename JavaScript/Svelte/Svelte.md => javascript/svelte/svelte.md (100%) rename {Kotlin => kotlin}/kotlin.md (100%) rename Markdown.md => markdown.md (100%) rename PHP/Composer & Autoloading.md => php/composer.md (100%) rename PHP/Database.md => php/database.md (100%) rename PHP/Dependecy Injection.md => php/dependecy-injection.md (100%) rename PHP/PHP.md => php/php.md (100%) rename PHP/Templates with Plates.md => php/plates-templating.md (100%) rename PHP/PSR-7.md => php/psr-7.md (100%) rename PHP/Simple_MVC/REST API.md => php/simple-mvc/rest-api.md (100%) rename PHP/Simple_MVC/Simple_MVC.md => php/simple-mvc/simple-mvc.md (100%) rename PHP/Unit Testing.md => php/unit-tests.md (100%) rename PHP/Web.md => php/web.md (100%) rename PowerShell/Powershell Commands.md => powershell/commands.md (100%) rename PowerShell/Powershell Scripting.md => powershell/scripting.md (100%) rename Python/Jupyter/Jupiter Notebook.md => python/jupyter/jupiter-notebook.md (100%) rename {Python/Libs/CLI => python/libs/cli}/click.md (100%) rename Python/Libs/GUI/Tkinter.md => python/libs/gui/tkinter.md (100%) rename Python/Libs/Image/Pillow.md => python/libs/image/pillow.md (100%) rename Python/Libs/Image/PyCairo.md => python/libs/image/py-cairo.md (100%) rename Python/Libs/Math/NumPy.md => python/libs/math/numpy.md (100%) rename Python/Libs/Math/Pandas.md => python/libs/math/pandas.md (100%) rename {Python/Libs/Math => python/libs/math}/seaborn.md (100%) rename Python/Libs/Web/BeautifulSoup.md => python/libs/web/beautiful-soup.md (100%) rename Python/Libs/Web/Flask/requests.md => python/libs/web/flask/flask-requests.md (100%) rename Python/Libs/Web/Flask/Flask.md => python/libs/web/flask/flask.md (100%) rename {Python/Libs/Web => python/libs/web}/requests.md (100%) rename Python/Python.md => python/python.md (100%) rename {Python/Standard Library => python/standard-library}/argparse.md (100%) rename {Python/Standard Library => python/standard-library}/collections.md (100%) rename {Python/Standard Library => python/standard-library}/csv.md (100%) rename {Python/Standard Library => python/standard-library}/ftplib.md (100%) rename {Python/Standard Library => python/standard-library}/itertools.md (100%) rename {Python/Standard Library => python/standard-library}/json.md (100%) rename {Python/Standard Library => python/standard-library}/logging.md (100%) rename {Python/Standard Library => python/standard-library}/shutil.md (100%) rename {Python/Standard Library => python/standard-library}/smtplib.md (100%) rename {Python/Standard Library => python/standard-library}/socket.md (100%) rename {Python/Standard Library => python/standard-library}/sqllite.md (100%) rename {Python/Standard Library => python/standard-library}/time_datetime.md (100%) rename {Python/Standard Library => python/standard-library}/unittest.md (100%) rename RegularExpressions.md => regular-expressions.md (100%) rename Rust/Cargo.md => rust/cargo.md (100%) rename Rust/Rust.md => rust/rust.md (100%) rename Rust/Unit Tests.md => rust/unit-tests.md (100%) rename Swift/Swift.md => swift/swift.md (100%) diff --git a/Android/Activity.kt.md b/Android/Activity.kt.md deleted file mode 100644 index 508c903..0000000 --- a/Android/Activity.kt.md +++ /dev/null @@ -1,438 +0,0 @@ -# Android App Activity.kt - -## Logging - -```kotlin -Log.i("tag", "logValue") //info log -Log.d("tag", "logValue") //debug log -Log.w("tag", "logValue") //warning log -Log.e("tag", "logValue") //error log -Log.c("tag", "logValue") //critical log -``` - -## Activity Life Cycle - - - -```kotlin -package com.its.<appname> - -import androidx.appcompat.app.AppCompatActivity -import android.os.Bundle - -class MainActivity : AppCompatActivity() { - - //entry point of the activity - override fun onCreate(savedInstanceState: Bundle?) { - super.onCreate(savedInstanceState) - setContentView(R.layout.<activity_xml>) - } - - override fun onStart() { - } - - override fun onResume() { - } - - override fun onPause() { - } - - override fun onStop() { - } - - override fun onRestart() { - } - - override fun onDestroy() { - } -} -``` - -### Passing data between activities - -In *laughing* activity: - -```kotlin -private fun openActivity() { - - //target to open Intent(opener, opened) - val intent = Intent(this, Activity::class.java) - - //pass data to launched activity - intent.putExtra("identifier", value) - - startActivity(intent) //launch another activity - } -``` - -In *launched* activity: - -```kotlin -val identifier = intent.get<Type>Extra("identifier") -``` - -## Hooks - -### Resources Hooks - -```kotlin -R.<resourceType>.<resourceName> //access to resource - -ContextCompat.getColor(this, colorResource) //extract color from resources -getString(stringResource) //extract string from resources -``` - -### XML hooks - -Changes in xml made in kotlin are applied after the app is drawn thus overwriting instructions in xml. - -In `activity.xml`: - -```xml -<View - android:id="@+id/<id>"/> -``` - -in `Activity.kt`: - -```kotlin -var element = findViewById(R.id.<id>) //old method - -<id>.popery = value //access and modify view contents -``` - -## Activity Components - -### Snackbar - -Component derived from material design. If using old API material design dependency must be set in gradle. - -In `build.gradle (Module:app)`: - -```gradle -dependencies { - implementation 'com.google.android.material:material:<sem_ver>' -} -``` - -In `Activity.kt`: - -```kotlin -import com.google.android.material.snackbar.Snackbar - -Snackbar - .make(activityID, message, Snackbar.TIME_ALIVE) //create snackbar - .setAction("Button Name", { action }) //add button to snackbar - .show() -``` - -## Opening External Content - -### Opening URLs - -```kotlin -val url = "https://www.google.com" -val intent = Intent(Intent.ACTION_VIEW) - -intent.setData(Uri.parse(url)) -startActivity(intent) -``` - -### Sharing Content - -```kotlin -val intent = Intent(Intent.ACTION_SEND) - -intent.setType("text/plain") //specifying shared content type -intent.putExtra(Intent.EXTRA_MAIL, "mail@address") //open mail client and pre-compile field if share w/ mail -intent.putExtra(Intent.EXTRA_SUBJECT, "subject") -intent.putExtra(Intent.EXTRA_TEXT, "text") //necessary since type is text -startActivity(Intent.startChooser(intent, "chooser title")) //let user choose the share app -``` - -### App Google Maps - -[Documentation](https://developers.google.com/maps/documentation/urls/android-intents) - -```kotlin -val uri = Uri.parse("geo: <coordinates>") -val intent = Intent(Intent.ACTION_VIEW, uri) -intent.setPackage("com.google.android.apps.maps") //app to be opened -startActivity(intent) -``` - -### Make a call (wait for user) - -Preset phone number for the call, user needs to press call button to initiate dialing. - -```kotlin -fun call() { - val intent = Intent(Intent.ACTION_DIAL) - intent.setData(Uri.parse("tel: <phone number>")) - startActivity(intent) -} - -``` - -### Make a call (directly) - -In `AndroidManifest.xml`: - -```xml -<uses-permission android:name="android.permission.CALL_PHONE" /> -``` - -```kotlin -//https://developer.android.com/training/permissions/requesting - -//intercept OS response to permission popup -override fun onRequestPermissionResult(requestCode: Int, permissions: Array<out String>, grantResults: IntArray) { - super.onRequestPermissionsResult(requestCode, permissions, grantResults) -} - -fun checkCallPermission() { - //check if permission to make a call has been granted - if (ContextCompact.checkSelfPermission(context!!, android.Manifest.permission.CALL_PHONE) != PackageManager.PERMISSION_GRANTED) { - // if permission has not been granted request it (opens OS popup, no listener available) - // request code needs to be specific for the permission - ActivityCompat.requestPermissions(context!!, arrayOf(android.Manifest.permission.CALL_PHONE), requestCode) - } else { - call() //if permission has been already given - } -} - -@SuppressLint("MissingPermission") // suppress warning of unhandled permission (handled in checkCallPermission) -fun call() { - val intent = Intent(Intent.ACTION_DIAL, Uri.parse("tel: <phone number>")) - startActivity(intent) -} -``` - -## Lists (with RecyclerView) - -A [LayoutManager][1] is responsible for measuring and positioning item views within a `RecyclerView` as well as determining the policy for when to recycle item views that are no longer visible to the user. -By changing the `LayoutManager` a `RecyclerView` can be used to implement a standard vertically *scrolling list*, a *uniform grid*, *staggered grids*, *horizontally scrolling collections* and more. -Several stock layout managers are provided for general use. - -[Adapters][2] provide a binding from an app-specific data set to views that are displayed within a `RecyclerView`. - -[1]:https://developer.android.com/reference/kotlin/androidx/recyclerview/widget/RecyclerView.LayoutManager -[2]:https://developer.android.com/reference/kotlin/androidx/recyclerview/widget/RecyclerView.Adapter - -```kotlin -var array: ArrayList<T>? = null //create ArrayList of elements to be displayed -var adapter: RecyclerViewItemAdapter? = null //create adapter to draw the list in the Activity - -array.add(item) //add item to ArrayList - -// create LayoutManager for the recyclerView -val layoutManager = <ViewGroup>LayoutManager(context, <ViewGroup>LayoutManager.VERTICAL, reverseLayout: Bool) -recycleView.LayoutManager = layoutManager // assign LayoutManager for the recyclerView - -// handle adapter var containing null value -if (array != null) { - adapter = RecyclerViewItemAdapter(array!!) // valorize adapter with a adapter object - recyclerView.adapter = adapter // assign adapter to the recyclerView -} - -// add or remove item - -// tell the adapter that something is changed -adapter?.notifyDataSetChanged() -``` - -## WebView - -[WebView Docs](https://developerandroid.com/reference/android/webkit/WebView) - -```kotlin -webView.webViewClient = object : WebViewClient() { - - // avoid opening browsed by default, open webview instead - override fun shouldOverrideUrlLoading(view: WebView?, url: String?): Boolean { - view?.loadUrl(url) // handle every url - return true - } - - override fun shouldOverrideUrlLoading(view: WebView?, url: String?): Boolean { - - // stay in WebView until website changes - if (Uri.parse(url).host == "www.website.domain") { - return false - } - - Intent(Intent.ACTION_VIEW, Uri.parse(url).apply){ - startActivity(this) // open browser/app when the website changes to external URL - } - return true - } - - webView.settings.javaScriptEnabled = true // enable javascript - webView.addJavaScriptInterface(webAppInterface(this, "Android")) // create bridge between js on website an app - - // if in webView use android back butto to go to previous webpage (if possible) - override fun onKeyDown(keyCode: Int, event: KeyEvent?) :Boolean { - if (keyCode == KeyEvent.KEYCODE_BACK && webVew,canGoBack()) { // if previous url exists & back button pressed - webView.goBack() // go to previous URL - return true - } - } -} -``` - -## Web Requests (Using Volley) - -[Volley Docs](https://developer.android.com/training/volley) - -### Import & Permissions - -Import in `build.gradle`: - -```kotlin -implementation 'com.android.volley:volley:1.1.1' -``` - -Permissions in `AndroidManifest.xml`: - -```xml -<uses-permission android:name="android.permission.INTERNET" /> -``` - -### Make the request - -Subsequent requests should be delayed to avoid allowing the user to make too frequent requests. - -```kotlin -private lateinit var queue: RequestQueue - -override fun onCreate(savedInstanceState: Bundle?){ - queue = Volley.newRequestQueue(context) -} - -// response is a String -private fun simpleRequest() { - - var url = "www.website.domain" - - var stringRequest = StringRequest(Request.Method.GET, url, Response.Listener<String> { - Log.d() - }, - Response.ErrorListener{ - Log.e() - }) - - stringRequest.TAG = "TAG" // assign a tag to the request - - queue.add(stringRequest) // add request to the queue -} - -// response is JSON Object -private fun getJsonObjectRequest(){ - // GET -> jsonRequest = null - // POST -> jsonRequest = JsonObject - var stringRequest = JsonObjectRequest(Request.Method.GET, url, jsonRequest, Response.Listener<String> { - Log.d() - // read end use JSON - }, - Response.ErrorListener{ - Log.e() - }) - - queue.add(stringRequest) // add request to the queue -} - -// response is array of JSON objects -private fun getJSONArrayRequest(){ - // GET -> jsonRequest = null - // POST -> jsonRequest = JsonObject - var stringRequest = JsonArrayRequest(Request.Method.GET, url, jsonRequest, Response.Listener<String> { - Log.d() - // read end use JSON - }, - Response.ErrorListener{ - Log.e() - }) - - queue.add(stringRequest) // add request to the queue -} - - -override fun onStop() { - super.onStop() - queue?.cancelAll("TAG") // delete all request with a particular tag when the activity is closed (avoid crash) -} -``` - -### Parse JSON Request - -```kotlin -Response.Listener { response -> - var value = response.getSting("key") -} -``` - -## Data Persistance - -### Singleton - -Object instantiated during app init and is destroyed only on app closing. It can be used for data persistance since is not affected by the destruction of an activity. - -```kotlin -// Context: Interface to global information about an application environment. -class Singleton constructor(context: Context) { - - companion object { - - @Volatile - private var INSTANCE: Singleton? = null - - // synchronized makes sure that all instances of the singleton are actually the only existing one - fun getInstance(context: Context) = INSTANCE ?: synchronized(this) { - INSTANCE ?: Singleton(context).also { - INSTANCE = it - } - } - } -} -``` - -### SharedPreferences - -[SharedPreferences Docs](https://developer.android.com/training/data-storage/shared-preferences) - -**Get a handle to shared preferences**: - -- `getSharedPreferences()` — Use this if you need multiple shared preference files identified by name, which you specify with the first parameter. You can call this from any Context in your app. -- `getPreferences()` — Use this from an Activity if you need to use only one shared preference file for the activity. Because this retrieves a default shared preference file that belongs to the activity, you don't need to supply a name. - -```kotlin -val sharedPref = activity?.getSharedPreferences( getString(R.string.preference_file_key), Context.MODE_PRIVATE ) -val sharedPref = activity?.getPreferences(Context.MODE_PRIVATE) -``` - -**Write to shared preferences**: - -To write to a shared preferences file, create a `SharedPreferences.Editor` by calling `edit()` on your SharedPreferences. - -Pass the keys and values to write with methods such as `putInt()` and `putString()`. Then call `apply()` or `commit()` to save the changes. - -```kotlin -val sharedPref = activity?.getPreferences(Context.MODE_PRIVATE) ?: return -with (sharedPref.edit()) { - putInt(getString(R.string.key), value) - commit() // or apply() -} -``` - -`apply()` changes the in-memory `SharedPreferences` object immediately but writes the updates to disk *asynchronously*. -Alternatively, use `commit()` to write the data to disk *synchronously*. But because *commit()* is synchronous, avoid calling it from your main thread because it could pause the UI rendering. - -**Read from shared preferences**: - -To retrieve values from a shared preferences file, call methods such as getInt() and getString(), providing the key for the wanted value, and optionally a default value to return if the key isn't present. - -```kotlin -val sharedPref = activity?.getPreferences(Context.MODE_PRIVATE) ?: return -val defaultValue = resources.getInteger(R.integer.default_value_key) -val value = sharedPref.getInt(getString(R.string.key), defaultValue) -``` diff --git a/Android/Adapter.kt.md b/Android/Adapter.kt.md deleted file mode 100644 index 0c99941..0000000 --- a/Android/Adapter.kt.md +++ /dev/null @@ -1,86 +0,0 @@ -# RecycleView Cell Adapter - -[Adapters][1] provide a binding from an app-specific data set to views that are displayed within a `RecyclerView`. - -[1]:https://developer.android.com/reference/kotlin/androidx/recyclerview/widget/RecyclerView.Adapter - -```kotlin -package <package> - -import android.content.Context -import android.util.Log -import android.view.LayoutInflater -import android.view.ViewGroup -import android.widget.Button -import android.widget.TextView -import androidx.recyclerview.widget.RecyclerView - -class RecipeAdapter : RecyclerView.Adapter<RecipeAdapter.ViewHolder> { - - private var mDataset: ArrayList<Recipe> // RecyclerView data - - class ViewHolder : RecyclerView.ViewHolder { - var viewGroup: ViewGroup? = null - constructor(v: ViewGroup?) : super(v!!) { - viewGroup = v - } - } - - //adapter contractor, takes list of data - constructor(myDataset: ArrayList<Recipe>/*, mContext: Context?*/){ - mDataset = myDataset - //mContext = mContext - } - - - override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ViewHolder { - val v : ViewGroup = LayoutInflater.from(parent.context).inflate(R.layout.view_recipe_item, parent, false) as ViewGroup - - val vh = ViewHolder(v) - return vh - } - - override fun getItemCount(): Int { - return mDataset.size - } - - override fun onBindViewHolder(holder: ViewHolder, position: Int) { - - val mItem : Recipe = mDataset.get(position) - - val titleText = holder.viewGroup?.findViewById<TextView>(R.id.titleText) - titleText?.text = mItem.title - - Log.d("Adapter","Title: "+mItem.title) - - val deleteButton = holder.viewGroup!!.findViewById<Button>(R.id.deleteButton) - deleteButton.setOnClickListener { removeItem(position) } - - //Click - holder.viewGroup?.setOnClickListener { - mListener?.select(position) - } - } - - - - private fun removeItem(position: Int) { - mDataset.removeAt(position) - notifyItemRemoved(position) - notifyItemRangeChanged(position, mDataset.size) - } - - /* - * Callback - * */ - private var mListener: AdapterCallback? = null - - interface AdapterCallback { - fun select(position: Int) - } - - fun setOnCallback(mItemClickListener: AdapterCallback) { - this.mListener = mItemClickListener - } -} -``` diff --git a/Android/Fragment.md b/Android/Fragment.md deleted file mode 100644 index 528fbd0..0000000 --- a/Android/Fragment.md +++ /dev/null @@ -1,154 +0,0 @@ -# Fragments & FragmentActivity - -[Documentation](https://developer.android.com/guide/components/fragments) - -A **Fragment** represents a behavior or a portion of user interface in a `FragmentActivity`. It's possible to combine multiple fragments in a single activity to build a multi-pane UI and reuse a fragment in multiple activities. -Think of a fragment as a *modular section of an activity*, which has its *own* lifecycle, receives its *own* input events, and which you can add or remove while the activity is running (sort of like a "sub activity" that you can reuse in different activities). - - - -A fragment must always be hosted in an activity and the fragment's lifecycle is *directly affected* by the host activity's lifecycle. - - - -## Minimal Fragment Functions - -Usually, you should implement at least the following lifecycle methods: - -`onCreate()` -The system calls this when creating the fragment. Within your implementation, you should initialize essential components of the fragment that you want to retain when the fragment is paused or stopped, then resumed. - -`onCreateView()` -The system calls this when it's time for the fragment to draw its user interface for the first time. To draw a UI for your fragment, you must return a View from this method that is the root of your fragment's layout. You can return null if the fragment does not provide a UI. - -`onPause()` -The system calls this method as the first indication that the user is leaving the fragment (though it doesn't always mean the fragment is being destroyed). This is usually where you should commit any changes that should be persisted beyond the current user session (because the user might not come back). - -## Fragment Subclasses - -`DialogFragment` -Displays a floating dialog. Using this class to create a dialog is a good alternative to using the dialog helper methods in the Activity class, because you can incorporate a fragment dialog into the back stack of fragments managed by the activity, allowing the user to return to a dismissed fragment. - -`ListFragment` -Displays a list of items that are managed by an adapter (such as a SimpleCursorAdapter), similar to ListActivity. It provides several methods for managing a list view, such as the onListItemClick() callback to handle click events. (Note that the preferred method for displaying a list is to use RecyclerView instead of ListView. In this case you would need to create a fragment that includes a RecyclerView in its layout. See Create a List with RecyclerView to learn how.) - -`PreferenceFragmentCompat` -Displays a hierarchy of Preference objects as a list. This is used to create a settings screen for your application. - -## Fragment Insertion in Layout (Method 1) - -In `Activity.xml`: - -```xml -<!-- Activity.xml boilerplate --> - -<!-- Fragment drawn at Activity start cannot be drawn on event --> -<fragment - android:name="com.<app>.<Fragment>" - android:layout_width="match_parent" - android:layout_height="match_parent" - android:id="@+id/fragment_id" /> - -<!-- Activity.xml boilerplate --> -``` - -In `Fragment.kt`: - -```kotlin -package <package> - -import android.os.Bundle -import androidx.fragment.app.Fragment -import android.view.LayoutInflater -import android.view.View -import android.view.ViewGroup - -/** - * A simple [Fragment] subclass. - */ -class FirstFragment : Fragment() { - - override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle? ): View? { - // Inflate the layout for this fragment (draw and insert fragment in Activity) - return inflater.inflate(R.layout.<fragment_xml>, container, false) - } - - //called after fragment is drawn (ACTIONS GO HERE) - override fun onViewCreated(view: View, savedInstanceState: Bundle?) { - - } -} -``` - -## Fragment Insertion in Layout (Method 2) - -```xml -<!-- Activity.xml boilerplate --> -<layout - android:id="@+id/containerID" - android:layout_width="match_parent" - android:layout_height="match_parent" /> - -<!-- Activity.xml boilerplate --> -``` - -In `Activity.kt`: - -```kotlin -override fun onCreate(savedInstanceState: Bundle?) { - super.onCreate(savedInstanceState) - setContentView(R.layout.<activity_xml>) - - val fragmentID = FragmentClass() - - //insert fragment from kotlin (can be triggered by event) - supportFragmentManager - .beginTransaction() - .add(R.id.<containerID>, fragmentID) - .commit() - - //replace fragment from kotlin (can be triggered by event) - supportFragmentManager - .beginTransaction() - .replace(R.id.<containerID>, fragmentID) - .addToBackStack(null) // remember order of loaded fragment (keep alive previous fragments) - .commit() -} -``` - -## Passing Values from Activity to Fragment - -In `Activity.kt`: - -```kotlin -override fun onCreate(savedInstanceState: Bundle?) { - super.onCreate(savedInstanceState) - setContentView(R.layout.<activity_xml>) - - val fragmentID = FragmentClass() - - val bundle = Bundle() - bundle.putString("key", "value") //passed value - fragmentID.arguments = bundle - - //insert fragment from kotlin (can be triggered by event) - supportFragmentManager - .beginTransaction() - .add(R.id.<containerID>, fragmentID) - .commit() -} -``` - -In `Fragment.kt`: - -```kotlin -override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle? ): View? { - - value = arguments?.getString("key") //read passed value - - // Inflate the layout for this fragment (draw and insert fragment in Activity) - return inflater.inflate(R.layout.<fragment_xml>, container, false) -} -``` - -.png?width=640&name=The%20activity%20and%20fragment%20lifecycles%20(1).png) diff --git a/Android/Gradle & Building.md b/Android/Gradle & Building.md deleted file mode 100644 index 464b24e..0000000 --- a/Android/Gradle & Building.md +++ /dev/null @@ -1,35 +0,0 @@ -# Gradle & Building - -## `build.gradle` (Module) - -```gradle -android { - - defaultconfig{ - - applicationId <string> // app package name - - minSdkVersion <int> // min API version - targetSdkVersion <int> // actual API version - - versionCode <int> // unique code for each release - versionName "<string>" - } -} -``` - -## Distributing the app - -### APK vs Bundle - -- APK: android executable, contains all assets of the app (multiple versions for each device). The user downloads all the assets. -- Bundle: split the assets based on device specs. The users downloads only the assets needed for the target device. - -### APK generation & [App Signing](https://developer.android.com/studio/publish/app-signing) - -- **Key store path**: location where the keystore file will be stored. -- **Key store password**: secure password for the keystore (**to be remembered**). -- **Key alias**: identifying name for the key (**to be remembered**). -- **Key password**: secure password for the key (**to be remembered**). - -The keystore identifies the app and it's developers. It's needed for APK generation and releases distribution. diff --git a/Android/MapsActivity.md b/Android/MapsActivity.md deleted file mode 100644 index a203aae..0000000 --- a/Android/MapsActivity.md +++ /dev/null @@ -1,84 +0,0 @@ -# Maps Activity - -[Google Maps Docs](https://developers.google.com/maps/documentation/android-sdk/intro) - -Activity should be **Google Maps Activity**. - -In `google_maps_api.xml`: - -```xml -<resources> - <string name="google_maps_key" templateMergeStrategy="preserve", translatable="false">API_KEY</string> -</resources> -``` - -## Activity Layout (xml) - -```xml -<!-- a fragment to contain the map --> -<fragment xmlns:android="http://schemas.android.com/apk/res/android" - xmlns:map="http://schemas.android.com/apk/res-auto" - xmlns:tools="http://schemas.android.com/tools" - android:id="@+id/<fragment_id>" - android:name="com.google.android.gms.maps.SupportMapFragment" - android:layout_width="match_parent" - android:layout_height="match_parent" - tools:context=".<Activity>" /> -``` - -## Activity Class (kotlin) - -```kotlin -import androidx.appcompat.app.AppCompatActivity -import android.os.Bundle - -import com.google.android.gms.maps.CameraUpdateFactory -import com.google.android.gms.maps.GoogleMap -import com.google.android.gms.maps.OnMapReadyCallback -import com.google.android.gms.maps.SupportMapFragment -import com.google.android.gms.maps.model.LatLng -import com.google.android.gms.maps.model.Marker -import com.google.android.gms.maps.model.MarkerOptions - -class MapsActivity : AppCompatActivity(), OnMapReadyCallback, - GoogleMap.OnInfoWindowClickListener, - GoogleMap.OnMarkerClickListener, - GoogleMap.OnCameraIdleListener{ - - private lateinit var mMap: GoogleMap // declare but not valorize - - override fun onCreate(savedInstanceState: Bundle?) { - super.onCreate(savedInstanceState) - setContentView(R.layout.<activity_xml>) - - // add the map to a fragment - val mapFragment = supportFragmentManager.findFragmentById(R.id.<fragment_id>) as SupportMapFragment - mapFragment.getMapAsync(this) - - } - - override fun onMapReady(googleMap: GoogleMap) { - mMap = googleMap - mMap.setOnMarkerClickListener(this) - mMap.setOnInfoWindowClickListener(this) - - // Add a marker and move the camera - val location = LatLng(-34.0, 151.0) // set location with latitude and longitude - mMap.addMarker(MarkerOptions().position(location).title("Marker in ...")) // ad the marker to the map with a name and position - - mMap.moveCamera(CameraUpdateFactory.newLatLng(location)) // move camera to the marker - } - - override fun onInfoWindowClick(p0: Marker?) { - - } - - override fun onMarkerClick(p0: Marker?): Boolean { - - } - - override fun onCameraIdle() { - - } -} -``` diff --git a/Android/SQLite.md b/Android/SQLite.md deleted file mode 100644 index e827a42..0000000 --- a/Android/SQLite.md +++ /dev/null @@ -1,101 +0,0 @@ -# SQLite in Android - -[Kotlin SQLite Documentation](https://developer.android.com/training/data-storage/sqlite) -[NoSQL DB Realm Docs](https://realm.io/docs) - -## Database Helper - -Create database in memory and its tables. - -```kotlin -class DatabaseHelper( - context: Context?, - name: String?, - factory: SQLiteDatabase.CursorFactory?, - version: Int -) : SQLiteOpenHelper(context, name, factory, version) { // super constructor? - - // called on db creation if it does not exists (app installation) - override fun onCreate() { - sqLiteDatabase?.execSQL("CREATE TABLE ...") // create table - } - - override fun onUpgrade(sqLiteDatabase: SQLiteDatabase?, ...) { - // table update logic - } -} -``` - -## AppSingleton - -Make data persistent. - -```kotlin -class AppSingleton constructor(context: Context) { - - var database: SQLiteDatabase? = null // point to database file in memory - - companion object { - - @Volatile - private var INSTANCE: AppSingleton? = null - - // synchronized makes sure that all instances of the singleton are actually the only existing one - fun getInstance(context: Context) = INSTANCE ?: synchronized(this) { - INSTANCE ?: Singleton(context).also { - INSTANCE = it - } - } - } - - // called to create DB in device memory - fun openDatabase(context: Context?) { - var databaseHelper = DatabaseHelper(context, "AppDB_Name.sqlite", null, version) { - database = databaseHelper.writeDatabase //? - } - } -} -``` - -## Activity - -```kotlin -override fun onCreate() { - - // either creates or reads DB - AppSingleton.getInstance().openDatabase(this) // context is this - - val controller = ModelController() - controller.insert(model) // insert data from object -} -``` - -## ModelController - -Controller to handle data from the objects and interact with the Database - -```kotlin -sqLiteDatabase = AppISingleton.getInstance().database // reference to the database from the singleton - -contentValues = ContentValues() // dict like structure to insert data in DB -contentValues.put("DB_Column", value) // put data in the structure - -// insertion query V1 -sqLiteDatabase?.insert("table", null, contentValue) - -//insertion query V2 -sqLiteDatabase?.rawQuey("INSERT INTO ...") - -// returns a Cursor() -val cursor = sqLiteDatabase?.query("table", ArrayOf(columns_to_read), "WHERE ...", "GROUP BY ...", "HAVING ...", "ORDER BY ...") - -try { - if (cursor != null) { - while(cursor.moveToNext()) { // loop through cursor data - data = cursor.getString(cursor.getColumnIndex("DB_Column")) // read data from the cursor - } - } -} finally { - cursor?.close() -} -``` diff --git a/Android/activity.xml.md b/Android/activity.xml.md deleted file mode 100644 index ee7cb8a..0000000 --- a/Android/activity.xml.md +++ /dev/null @@ -1,215 +0,0 @@ -# Activity.xml - -## Resources - -### Colors, Style, Strings - -These resources are located in `app/src/main/res/values/<resource_type>.xml` -`@color/colorName` -> access to *color definition* in `colors.xml` -`@string/stringName` -> access to *string definition* in `strings.xml` (useful for localization) -`@style/styleName` -> access to *style definition* in `styles.xml` - -In `colors.xml`: - -```xml -<?xml version="1.0" encoding="utf-8"?> -<resources> - <!-- app bar color --> - <color name="colorPrimary">#6200EE</color> - <!-- status bar color --> - <color name="colorPrimaryDark">#3700B3</color> - - <color name="colorAccent">#03DAC5</color> - - <!-- other color definitions --> -</resources> -``` - -In `strings.xml`: - -```xml -<resources> - <string name="app_name"> AppName </string> - - <!-- other strings definitions --> -</resources> -``` - -In `styles.xml`: - -```xml -<resources> - - <!-- Base application theme. --> - <style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar"> - <!-- Customize your theme here. --> - <item name="colorPrimary">@color/colorPrimary</item> - <item name="colorPrimaryDark">@color/colorPrimaryDark</item> - <item name="colorAccent">@color/colorAccent</item> - </style> - -</resources> -``` - -## View & View Group - -A **View** contains a specific element of the layout. -A **View Group** or **Layout** is a container of Views. - -```xml -<View settings/> - -<ViewGroup settings> - ... -</ViewGroup> - -``` - -`android:layout_width`, `android:layout_height`: - -* fixed value (dp, sp) -* match_parent -* wrap_content - -## ViewGroups - -### [RelativeLayout](https://developer.android.com/reference/android/widget/RelativeLayout.LayoutParams) - -The relative layout containing the view uses the value of these layout parameters to determine where to position the view on the screen. -If the view is not contained within a relative layout, these attributes are ignored. - -```xml -<RelativeLayout - android:layout_width="match_parent" - android:layout_height="match_parent"> - -</RelativeLayout> -``` - -`android:layout_above`: Positions the bottom edge of this view above the given anchor view ID. -`android:layout_alignBaseline`: Positions the baseline of this view on the baseline of the given anchor view ID. -`android:layout_alignBottom`: Makes the bottom edge of this view match the bottom edge of the given anchor view ID. -`android:layout_alignEnd`: Makes the end edge of this view match the end edge of the given anchor view ID. -`android:layout_alignLeft`: Makes the left edge of this view match the left edge of the given anchor view ID. -`android:layout_alignParentBottom`: If true, makes the bottom edge of this view match the bottom edge of the parent. -`android:layout_alignParentEnd`: If true, makes the end edge of this view match the end edge of the parent. -`android:layout_alignParentLeft`: If true, makes the left edge of this view match the left edge of the parent. -`android:layout_alignParentRight`: If true, makes the right edge of this view match the right edge of the parent. -`android:layout_alignParentStart`: If true, makes the start edge of this view match the start edge of the parent. -`android:layout_alignParentTop`: If true, makes the top edge of this view match the top edge of the parent. -`android:layout_alignRight`: Makes the right edge of this view match the right edge of the given anchor view ID. -`android:layout_alignStart`: Makes the start edge of this view match the start edge of the given anchor view ID. -`android:layout_alignTop`: Makes the top edge of this view match the top edge of the given anchor view ID. -`android:layout_alignWithParentIfMissing`: If set to true, the parent will be used as the anchor when the anchor cannot be be found for layout_toLeftOf, layout_toRightOf, etc. -`android:layout_below`: Positions the top edge of this view below the given anchor view ID. -`android:layout_centerHorizontal`: If true, centers this child horizontally within its parent. -`android:layout_centerInParent`: If true, centers this child horizontally and vertically within its parent. -`android:layout_centerVertical`: If true, centers this child vertically within its parent. -`android:layout_toEndOf`: Positions the start edge of this view to the end of the given anchor view ID. -`android:layout_toLeftOf`: Positions the right edge of this view to the left of the given anchor view ID. -`android:layout_toRightOf`: Positions the left edge of this view to the right of the given anchor view ID. -`android:layout_toStartOf`: Positions the end edge of this view to the start of the given anchor view ID. - -### [LinearLayout](https://developer.android.com/reference/android/widget/LinearLayout.LayoutParams) - -Layout that arranges other views either horizontally in a single column or vertically in a single row. - -```xml -<LinearLayout - android:layout_width="match_parent" - android:layout_height="match_parent" - android:orientation="vertical"> <!-- or horizontal --> - -</LinearLayout> -``` - -`android:layout_weight`: Indicates how much of the extra space in the LinearLayout is allocated to the view associated with these LayoutParams. -`android:layout_margin`: Specifies extra space on the left, top, right and bottom sides of this view. -`android:layout_marginBottom`: Specifies extra space on the bottom side of this view. -`android:layout_marginEnd`: Specifies extra space on the end side of this view. -`android:layout_marginHorizontal`: Specifies extra space on the left and right sides of this view. -`android:layout_marginLeft`: Specifies extra space on the left side of this view. -`android:layout_marginRight`: Specifies extra space on the right side of this view. -`android:layout_marginStart`: Specifies extra space on the start side of this view. -`android:layout_marginTop`: Specifies extra space on the top side of this view. -`android:layout_marginVertical`: Specifies extra space on the top and bottom sides of this view. -`android:layout_height`: Specifies the basic height of the view. -`android:layout_width`: Specifies the basic width of the view. - -## Views - -```xml -<!--ID is necessary for identification --> -<View - android:id="@+id/uniqueId" - android:layout_width="value" - android:layout_height="value" -/> -``` - -### TextView - -To add `...` to truncate a string: - -```xml -<!-- maxLines + ellipsize works only in API 22+ --> -<TextView - maxLines="n" - ellipsize="end" /> -``` - -### ScrollView - -The scroll view can only have one child. If the child is a layout than the layout can contain many elements. - -```xml -<ScrollView - android:id="@+id/uniqueId" - android:layout_width="value" - android:layout_height="value"> - <!-- single child --> -</ScrollView> -``` - -### RecyclerView - -List of items - -In `build.gradle`: - -```gradle -dependencies { - implementation "androidx.recyclerview:recyclerview:<version>" - // For control over item selection of both touch and mouse driven selection - implementation "androidx.recyclerview:recyclerview-selection:<version>" -} -``` - -In `activity.xml`: - -```xml -<!-- VIewGroup for a list of items --> -<androidx.recycleview.widget.RecycleView - android:id="@+id/uniquieId" - android:layout_width="value" - android:layout_height="value"> -``` - -In `recyclerViewItem.xml`: - -```xml -<!-- list item layout --> -``` - -### WebView - -```xml -<WebView - android:id="@+id/uniquieId" - android:layout_width="value" - android:layout_height="value"> -``` - -## Constraints - -If a view is *anchored on both sides* and the width/height is set to `0dp` the view will expand to touch the elements to which is anchored. diff --git a/C++/C++.md b/C++/cpp.md similarity index 100% rename from C++/C++.md rename to C++/cpp.md diff --git a/Bash/Bash Commands.md b/bash/commands.md similarity index 100% rename from Bash/Bash Commands.md rename to bash/commands.md diff --git a/Bash/Bash Scripting.md b/bash/scripting.md similarity index 100% rename from Bash/Bash Scripting.md rename to bash/scripting.md diff --git a/CSS/CSS.md b/css/css.md similarity index 100% rename from CSS/CSS.md rename to css/css.md diff --git a/Database/MongoDB.md b/database/mongo-db.md similarity index 100% rename from Database/MongoDB.md rename to database/mongo-db.md diff --git a/Database/Redis.md b/database/redis.md similarity index 100% rename from Database/Redis.md rename to database/redis.md diff --git a/Database/SQL.md b/database/sql.md similarity index 100% rename from Database/SQL.md rename to database/sql.md diff --git a/DotNet/C#/C#.md b/dotnet/C#/C#.md similarity index 100% rename from DotNet/C#/C#.md rename to dotnet/C#/C#.md diff --git a/DotNet/C#/Async Programming.md b/dotnet/C#/async-programming.md similarity index 100% rename from DotNet/C#/Async Programming.md rename to dotnet/C#/async-programming.md diff --git a/DotNet/C#/C# Collections.md b/dotnet/C#/collections.md similarity index 100% rename from DotNet/C#/C# Collections.md rename to dotnet/C#/collections.md diff --git a/DotNet/C#/LINQ.md b/dotnet/C#/linq.md similarity index 100% rename from DotNet/C#/LINQ.md rename to dotnet/C#/linq.md diff --git a/DotNet/C#/Reactive Extensions.md b/dotnet/C#/reactive-extensions.md similarity index 100% rename from DotNet/C#/Reactive Extensions.md rename to dotnet/C#/reactive-extensions.md diff --git a/DotNet/C#/Unit Testing.md b/dotnet/C#/unit-tests.md similarity index 100% rename from DotNet/C#/Unit Testing.md rename to dotnet/C#/unit-tests.md diff --git a/DotNet/ASP.NET/Razor Syntax.md b/dotnet/asp.net/Razor Syntax.md similarity index 100% rename from DotNet/ASP.NET/Razor Syntax.md rename to dotnet/asp.net/Razor Syntax.md diff --git a/DotNet/ASP.NET/App Configuration.md b/dotnet/asp.net/app-configuration.md similarity index 100% rename from DotNet/ASP.NET/App Configuration.md rename to dotnet/asp.net/app-configuration.md diff --git a/DotNet/ASP.NET/Blazor.md b/dotnet/asp.net/blazor.md similarity index 100% rename from DotNet/ASP.NET/Blazor.md rename to dotnet/asp.net/blazor.md diff --git a/DotNet/ASP.NET/Filters.md b/dotnet/asp.net/filters.md similarity index 100% rename from DotNet/ASP.NET/Filters.md rename to dotnet/asp.net/filters.md diff --git a/DotNet/ASP.NET/Middleware.md b/dotnet/asp.net/middleware.md similarity index 100% rename from DotNet/ASP.NET/Middleware.md rename to dotnet/asp.net/middleware.md diff --git a/DotNet/ASP.NET/Minimal API.md b/dotnet/asp.net/minimal-api.md similarity index 100% rename from DotNet/ASP.NET/Minimal API.md rename to dotnet/asp.net/minimal-api.md diff --git a/DotNet/ASP.NET/MVC.md b/dotnet/asp.net/mvc.md similarity index 100% rename from DotNet/ASP.NET/MVC.md rename to dotnet/asp.net/mvc.md diff --git a/DotNet/ASP.NET/Razor Pages.md b/dotnet/asp.net/razor-pages.md similarity index 100% rename from DotNet/ASP.NET/Razor Pages.md rename to dotnet/asp.net/razor-pages.md diff --git a/DotNet/ASP.NET/REST API.md b/dotnet/asp.net/rest-api.md similarity index 100% rename from DotNet/ASP.NET/REST API.md rename to dotnet/asp.net/rest-api.md diff --git a/DotNet/ASP.NET/SignalR.md b/dotnet/asp.net/signal-r.md similarity index 100% rename from DotNet/ASP.NET/SignalR.md rename to dotnet/asp.net/signal-r.md diff --git a/DotNet/ASP.NET/WebForms.md b/dotnet/asp.net/web-forms.md similarity index 100% rename from DotNet/ASP.NET/WebForms.md rename to dotnet/asp.net/web-forms.md diff --git a/DotNet/Database/ADO.NET.md b/dotnet/database/ado.net.md similarity index 100% rename from DotNet/Database/ADO.NET.md rename to dotnet/database/ado.net.md diff --git a/DotNet/Database/EntityFramework.md b/dotnet/database/entity-framework.md similarity index 100% rename from DotNet/Database/EntityFramework.md rename to dotnet/database/entity-framework.md diff --git a/DotNet/Godot/Scripting.md b/dotnet/godot/scripting.md similarity index 100% rename from DotNet/Godot/Scripting.md rename to dotnet/godot/scripting.md diff --git a/DotNet/Lib/SkiaSharp.md b/dotnet/lib/skia-sharp.md similarity index 100% rename from DotNet/Lib/SkiaSharp.md rename to dotnet/lib/skia-sharp.md diff --git a/DotNet/Unity/Collisions.md b/dotnet/unity/collisions.md similarity index 100% rename from DotNet/Unity/Collisions.md rename to dotnet/unity/collisions.md diff --git a/DotNet/Unity/Coroutines.md b/dotnet/unity/coroutines.md similarity index 100% rename from DotNet/Unity/Coroutines.md rename to dotnet/unity/coroutines.md diff --git a/DotNet/Unity/Input Manager.md b/dotnet/unity/input-manager.md similarity index 100% rename from DotNet/Unity/Input Manager.md rename to dotnet/unity/input-manager.md diff --git a/DotNet/Unity/Prefabs Instantiation.md b/dotnet/unity/prefabs-instantiation.md similarity index 100% rename from DotNet/Unity/Prefabs Instantiation.md rename to dotnet/unity/prefabs-instantiation.md diff --git a/DotNet/Unity/Raycasting.md b/dotnet/unity/raycasting.md similarity index 100% rename from DotNet/Unity/Raycasting.md rename to dotnet/unity/raycasting.md diff --git a/DotNet/Unity/Scripting.md b/dotnet/unity/scripting.md similarity index 100% rename from DotNet/Unity/Scripting.md rename to dotnet/unity/scripting.md diff --git a/DotNet/Unity/Vector, Tranfrorm, Space.md b/dotnet/unity/vectors-tranfrorms-space.md similarity index 100% rename from DotNet/Unity/Vector, Tranfrorm, Space.md rename to dotnet/unity/vectors-tranfrorms-space.md diff --git a/DotNet/Xamarin/App.xaml.cs.md b/dotnet/xamarin/app.xaml.cs.md similarity index 100% rename from DotNet/Xamarin/App.xaml.cs.md rename to dotnet/xamarin/app.xaml.cs.md diff --git a/DotNet/Xamarin/App.xaml.md b/dotnet/xamarin/app.xaml.md similarity index 100% rename from DotNet/Xamarin/App.xaml.md rename to dotnet/xamarin/app.xaml.md diff --git a/DotNet/Xamarin/Page.xaml.cs.md b/dotnet/xamarin/page.xaml.cs.md similarity index 100% rename from DotNet/Xamarin/Page.xaml.cs.md rename to dotnet/xamarin/page.xaml.cs.md diff --git a/DotNet/Xamarin/Page.xaml.md b/dotnet/xamarin/page.xaml.md similarity index 100% rename from DotNet/Xamarin/Page.xaml.md rename to dotnet/xamarin/page.xaml.md diff --git a/DotNet/Xamarin/ViewModel.cs.md b/dotnet/xamarin/view-model.cs.md similarity index 100% rename from DotNet/Xamarin/ViewModel.cs.md rename to dotnet/xamarin/view-model.cs.md diff --git a/DotNet/Xamarin/Xamarin.Essentials.md b/dotnet/xamarin/xamarin-essentials.md similarity index 100% rename from DotNet/Xamarin/Xamarin.Essentials.md rename to dotnet/xamarin/xamarin-essentials.md diff --git a/Git/git.md b/git/git.md similarity index 100% rename from Git/git.md rename to git/git.md diff --git a/GraphQL.md b/graph-ql.md similarity index 100% rename from GraphQL.md rename to graph-ql.md diff --git a/HTML/HTML.md b/html/html.md similarity index 100% rename from HTML/HTML.md rename to html/html.md diff --git a/iOS/App (XCode 12).md b/iOS/App (XCode 12).md deleted file mode 100644 index fab0c39..0000000 --- a/iOS/App (XCode 12).md +++ /dev/null @@ -1,14 +0,0 @@ -# App.swift - -```swift -import SwiftUI - -@main -struct <Project>App: App { - var body: some Scene { - WindowGroup { - ContentView() - } - } -} -``` diff --git a/iOS/AppDelegate (XCode 11) .md b/iOS/AppDelegate (XCode 11) .md deleted file mode 100644 index 0dd10d8..0000000 --- a/iOS/AppDelegate (XCode 11) .md +++ /dev/null @@ -1,75 +0,0 @@ -# AppDelegate - -First loaded file. It prepares the app visualisation by calling the *scene* UI. - -```swift -import UIKit - -@UIApplicationMain -class AppDelegate: UIResponder, UIApplicationDelegate { - - func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool { - // Override point for customization after application launch. - return true - } - - // MARK: UISceneSession Lifecycle - - func application(_ application: UIApplication, configurationForConnecting connectingSceneSession: UISceneSession, options: UIScene.ConnectionOptions) -> UISceneConfiguration { - // Called when a new scene session is being created. - // Use this method to select a configuration to create the new scene with. - return UISceneConfiguration(name: "Default Configuration", sessionRole: connectingSceneSession.role) - } - - func application(_ application: UIApplication, didDiscardSceneSessions sceneSessions: Set<UISceneSession>) { - // Called when the user discards a scene session. - // If any sessions were discarded while the application was not running, this will be called shortly after application:didFinishLaunchingWithOptions. - // Use this method to release any resources that were specific to the discarded scenes, as they will not return. - } - - // MARK: - Core Data stack - - lazy var persistentContainer: NSPersistentContainer = { - /* - The persistent container for the application. This implementation - creates and returns a container, having loaded the store for the - application to it. This property is optional since there are legitimate - error conditions that could cause the creation of the store to fail. - */ - let container = NSPersistentContainer(name: "CoreDataExample") - container.loadPersistentStores(completionHandler: { (storeDescription, error) in - if let error = error as NSError? { - // Replace this implementation with code to handle the error appropriately. - // fatalError() causes the application to generate a crash log and terminate. You should not use this function in a shipping application, although it may be useful during development. - - /* - Typical reasons for an error here include: - * The parent directory does not exist, cannot be created, or disallows writing. - * The persistent store is not accessible, due to permissions or data protection when the device is locked. - * The device is out of space. - * The store could not be migrated to the current model version. - Check the error message to determine what the actual problem was. - */ - fatalError("Unresolved error \(error), \(error.userInfo)") - } - }) - return container - }() - - // MARK: - Core Data Saving support - - func saveContext () { - let context = persistentContainer.viewContext - if context.hasChanges { - do { - try context.save() - } catch { - // Replace this implementation with code to handle the error appropriately. - // fatalError() causes the application to generate a crash log and terminate. You should not use this function in a shipping application, although it may be useful during development. - let nserror = error as NSError - fatalError("Unresolved error \(nserror), \(nserror.userInfo)") - } - } - } -} -``` diff --git a/iOS/SceneDelegate (XCode 11).md b/iOS/SceneDelegate (XCode 11).md deleted file mode 100644 index bd8833b..0000000 --- a/iOS/SceneDelegate (XCode 11).md +++ /dev/null @@ -1,58 +0,0 @@ -# SceneDelegate - -Loads the *scene* and set the `rootController` to control the app. The `ContentView` gets called, which contains the UI elements to be visualized. - -```swift -import UIKit -import SwiftUI - -class SceneDelegate: UIResponder, UIWindowSceneDelegate { - - var window: UIWindow? - - func scene(_ scene: UIScene, willConnectTo session: UISceneSession, options connectionOptions: UIScene.ConnectionOptions) { - // Use this method to optionally configure and attach the UIWindow `window` to the provided UIWindowScene `scene`. - // If using a storyboard, the `window` property will automatically be initialized and attached to the scene. - // This delegate does not imply the connecting scene or session are new (see `application:configurationForConnectingSceneSession` instead). - - // Create the SwiftUI view that provides the window contents. - let contentView = ContentView() - - // Use a UIHostingController as window root view controller. - if let windowScene = scene as? UIWindowScene { - let window = UIWindow(windowScene: windowScene) - window.rootViewController = UIHostingController(rootView: contentView) - self.window = window - window.makeKeyAndVisible() - } - } - - func sceneDidDisconnect(_ scene: UIScene) { - // Called as the scene is being released by the system. - // This occurs shortly after the scene enters the background, or when its session is discarded. - // Release any resources associated with this scene that can be re-created the next time the scene connects. - // The scene may re-connect later, as its session was not necessarily discarded (see `application:didDiscardSceneSessions` instead). - } - - func sceneDidBecomeActive(_ scene: UIScene) { - // Called when the scene has moved from an inactive state to an active state. - // Use this method to restart any tasks that were paused (or not yet started) when the scene was inactive. - } - - func sceneWillResignActive(_ scene: UIScene) { - // Called when the scene will move from an active state to an inactive state. - // This may occur due to temporary interruptions (ex. an incoming phone call). - } - - func sceneWillEnterForeground(_ scene: UIScene) { - // Called as the scene transitions from the background to the foreground. - // Use this method to undo the changes made on entering the background. - } - - func sceneDidEnterBackground(_ scene: UIScene) { - // Called as the scene transitions from the foreground to the background. - // Use this method to save data, release shared resources, and store enough scene-specific state information - // to restore the scene back to its current state. - } -} -``` diff --git a/iOS/ContentView.md b/ios/content-view.md similarity index 100% rename from iOS/ContentView.md rename to ios/content-view.md diff --git a/Java/DAO.md b/java/dao.md similarity index 100% rename from Java/DAO.md rename to java/dao.md diff --git a/Java/Java Collection Framework.md b/java/java-collection-framework.md similarity index 100% rename from Java/Java Collection Framework.md rename to java/java-collection-framework.md diff --git a/Java/Java.md b/java/java.md similarity index 100% rename from Java/Java.md rename to java/java.md diff --git a/Java/Spring Framework/pom.xml.md b/java/spring/pom.xml.md similarity index 100% rename from Java/Spring Framework/pom.xml.md rename to java/spring/pom.xml.md diff --git a/Java/Spring Framework/Spring Project Structure.md b/java/spring/spring-project.md similarity index 100% rename from Java/Spring Framework/Spring Project Structure.md rename to java/spring/spring-project.md diff --git a/Java/Java Web/Servlet.md b/java/web/servlet.md similarity index 100% rename from Java/Java Web/Servlet.md rename to java/web/servlet.md diff --git a/JavaScript/AJAX.md b/javascript/ajax.md similarity index 100% rename from JavaScript/AJAX.md rename to javascript/ajax.md diff --git a/JavaScript/DOM.md b/javascript/dom.md similarity index 100% rename from JavaScript/DOM.md rename to javascript/dom.md diff --git a/JavaScript/Events & Animation.md b/javascript/events-animation.md similarity index 100% rename from JavaScript/Events & Animation.md rename to javascript/events-animation.md diff --git a/JavaScript/JavaScript.md b/javascript/javascript.md similarity index 100% rename from JavaScript/JavaScript.md rename to javascript/javascript.md diff --git a/JavaScript/jQuery.md b/javascript/jquery.md similarity index 100% rename from JavaScript/jQuery.md rename to javascript/jquery.md diff --git a/JavaScript/React/React Router.md b/javascript/react/react-router.md similarity index 100% rename from JavaScript/React/React Router.md rename to javascript/react/react-router.md diff --git a/JavaScript/React/React Tests.md b/javascript/react/react-tests.md similarity index 100% rename from JavaScript/React/React Tests.md rename to javascript/react/react-tests.md diff --git a/JavaScript/React/React.md b/javascript/react/react.md similarity index 100% rename from JavaScript/React/React.md rename to javascript/react/react.md diff --git a/JavaScript/React/Redux Tests.md b/javascript/react/redux-tests.md similarity index 100% rename from JavaScript/React/Redux Tests.md rename to javascript/react/redux-tests.md diff --git a/JavaScript/React/Redux.md b/javascript/react/redux.md similarity index 100% rename from JavaScript/React/Redux.md rename to javascript/react/redux.md diff --git a/JavaScript/Svelte/Svelte.md b/javascript/svelte/svelte.md similarity index 100% rename from JavaScript/Svelte/Svelte.md rename to javascript/svelte/svelte.md diff --git a/Kotlin/kotlin.md b/kotlin/kotlin.md similarity index 100% rename from Kotlin/kotlin.md rename to kotlin/kotlin.md diff --git a/Markdown.md b/markdown.md similarity index 100% rename from Markdown.md rename to markdown.md diff --git a/PHP/Composer & Autoloading.md b/php/composer.md similarity index 100% rename from PHP/Composer & Autoloading.md rename to php/composer.md diff --git a/PHP/Database.md b/php/database.md similarity index 100% rename from PHP/Database.md rename to php/database.md diff --git a/PHP/Dependecy Injection.md b/php/dependecy-injection.md similarity index 100% rename from PHP/Dependecy Injection.md rename to php/dependecy-injection.md diff --git a/PHP/PHP.md b/php/php.md similarity index 100% rename from PHP/PHP.md rename to php/php.md diff --git a/PHP/Templates with Plates.md b/php/plates-templating.md similarity index 100% rename from PHP/Templates with Plates.md rename to php/plates-templating.md diff --git a/PHP/PSR-7.md b/php/psr-7.md similarity index 100% rename from PHP/PSR-7.md rename to php/psr-7.md diff --git a/PHP/Simple_MVC/REST API.md b/php/simple-mvc/rest-api.md similarity index 100% rename from PHP/Simple_MVC/REST API.md rename to php/simple-mvc/rest-api.md diff --git a/PHP/Simple_MVC/Simple_MVC.md b/php/simple-mvc/simple-mvc.md similarity index 100% rename from PHP/Simple_MVC/Simple_MVC.md rename to php/simple-mvc/simple-mvc.md diff --git a/PHP/Unit Testing.md b/php/unit-tests.md similarity index 100% rename from PHP/Unit Testing.md rename to php/unit-tests.md diff --git a/PHP/Web.md b/php/web.md similarity index 100% rename from PHP/Web.md rename to php/web.md diff --git a/PowerShell/Powershell Commands.md b/powershell/commands.md similarity index 100% rename from PowerShell/Powershell Commands.md rename to powershell/commands.md diff --git a/PowerShell/Powershell Scripting.md b/powershell/scripting.md similarity index 100% rename from PowerShell/Powershell Scripting.md rename to powershell/scripting.md diff --git a/Python/Jupyter/Jupiter Notebook.md b/python/jupyter/jupiter-notebook.md similarity index 100% rename from Python/Jupyter/Jupiter Notebook.md rename to python/jupyter/jupiter-notebook.md diff --git a/Python/Libs/CLI/click.md b/python/libs/cli/click.md similarity index 100% rename from Python/Libs/CLI/click.md rename to python/libs/cli/click.md diff --git a/Python/Libs/GUI/Tkinter.md b/python/libs/gui/tkinter.md similarity index 100% rename from Python/Libs/GUI/Tkinter.md rename to python/libs/gui/tkinter.md diff --git a/Python/Libs/Image/Pillow.md b/python/libs/image/pillow.md similarity index 100% rename from Python/Libs/Image/Pillow.md rename to python/libs/image/pillow.md diff --git a/Python/Libs/Image/PyCairo.md b/python/libs/image/py-cairo.md similarity index 100% rename from Python/Libs/Image/PyCairo.md rename to python/libs/image/py-cairo.md diff --git a/Python/Libs/Math/NumPy.md b/python/libs/math/numpy.md similarity index 100% rename from Python/Libs/Math/NumPy.md rename to python/libs/math/numpy.md diff --git a/Python/Libs/Math/Pandas.md b/python/libs/math/pandas.md similarity index 100% rename from Python/Libs/Math/Pandas.md rename to python/libs/math/pandas.md diff --git a/Python/Libs/Math/seaborn.md b/python/libs/math/seaborn.md similarity index 100% rename from Python/Libs/Math/seaborn.md rename to python/libs/math/seaborn.md diff --git a/Python/Libs/Web/BeautifulSoup.md b/python/libs/web/beautiful-soup.md similarity index 100% rename from Python/Libs/Web/BeautifulSoup.md rename to python/libs/web/beautiful-soup.md diff --git a/Python/Libs/Web/Flask/requests.md b/python/libs/web/flask/flask-requests.md similarity index 100% rename from Python/Libs/Web/Flask/requests.md rename to python/libs/web/flask/flask-requests.md diff --git a/Python/Libs/Web/Flask/Flask.md b/python/libs/web/flask/flask.md similarity index 100% rename from Python/Libs/Web/Flask/Flask.md rename to python/libs/web/flask/flask.md diff --git a/Python/Libs/Web/requests.md b/python/libs/web/requests.md similarity index 100% rename from Python/Libs/Web/requests.md rename to python/libs/web/requests.md diff --git a/Python/Python.md b/python/python.md similarity index 100% rename from Python/Python.md rename to python/python.md diff --git a/Python/Standard Library/argparse.md b/python/standard-library/argparse.md similarity index 100% rename from Python/Standard Library/argparse.md rename to python/standard-library/argparse.md diff --git a/Python/Standard Library/collections.md b/python/standard-library/collections.md similarity index 100% rename from Python/Standard Library/collections.md rename to python/standard-library/collections.md diff --git a/Python/Standard Library/csv.md b/python/standard-library/csv.md similarity index 100% rename from Python/Standard Library/csv.md rename to python/standard-library/csv.md diff --git a/Python/Standard Library/ftplib.md b/python/standard-library/ftplib.md similarity index 100% rename from Python/Standard Library/ftplib.md rename to python/standard-library/ftplib.md diff --git a/Python/Standard Library/itertools.md b/python/standard-library/itertools.md similarity index 100% rename from Python/Standard Library/itertools.md rename to python/standard-library/itertools.md diff --git a/Python/Standard Library/json.md b/python/standard-library/json.md similarity index 100% rename from Python/Standard Library/json.md rename to python/standard-library/json.md diff --git a/Python/Standard Library/logging.md b/python/standard-library/logging.md similarity index 100% rename from Python/Standard Library/logging.md rename to python/standard-library/logging.md diff --git a/Python/Standard Library/shutil.md b/python/standard-library/shutil.md similarity index 100% rename from Python/Standard Library/shutil.md rename to python/standard-library/shutil.md diff --git a/Python/Standard Library/smtplib.md b/python/standard-library/smtplib.md similarity index 100% rename from Python/Standard Library/smtplib.md rename to python/standard-library/smtplib.md diff --git a/Python/Standard Library/socket.md b/python/standard-library/socket.md similarity index 100% rename from Python/Standard Library/socket.md rename to python/standard-library/socket.md diff --git a/Python/Standard Library/sqllite.md b/python/standard-library/sqllite.md similarity index 100% rename from Python/Standard Library/sqllite.md rename to python/standard-library/sqllite.md diff --git a/Python/Standard Library/time_datetime.md b/python/standard-library/time_datetime.md similarity index 100% rename from Python/Standard Library/time_datetime.md rename to python/standard-library/time_datetime.md diff --git a/Python/Standard Library/unittest.md b/python/standard-library/unittest.md similarity index 100% rename from Python/Standard Library/unittest.md rename to python/standard-library/unittest.md diff --git a/RegularExpressions.md b/regular-expressions.md similarity index 100% rename from RegularExpressions.md rename to regular-expressions.md diff --git a/Rust/Cargo.md b/rust/cargo.md similarity index 100% rename from Rust/Cargo.md rename to rust/cargo.md diff --git a/Rust/Rust.md b/rust/rust.md similarity index 100% rename from Rust/Rust.md rename to rust/rust.md diff --git a/Rust/Unit Tests.md b/rust/unit-tests.md similarity index 100% rename from Rust/Unit Tests.md rename to rust/unit-tests.md diff --git a/Swift/Swift.md b/swift/swift.md similarity index 100% rename from Swift/Swift.md rename to swift/swift.md