Posts

android - how to create oauth client for your app

Image
How to create oauth 2.0 client for signing into google. You have to login to https://console.cloud.google.com/ and the go under API & Services . Then you will need to click on " Create credentials " as shown here.  And the next steps are pretty straight forward. Please download and copy your google-service.json file to your android app folder. Using the Android studio to paste this in to ensure Android studio is able to recognized your new file. 

using kotlin by keyword

The by keyword, however, is a native feature built directly into core Kotlin . It is called Property Delegation , and its main job is to let you hand over the responsibility of reading and writing a variable to a helper class. Here is a simple, real-world example of how by can be used to automatically format a string (like capitalizing a user's name) every time you save a value to it. import kotlin.reflect. KProperty // 1. Create the Delegate class that handles the background work class CapitalizeDelegate { private var actualValue : String = "" // Intercepts whenever someone reads the variable: "println(name)" operator fun getValue ( thisRef : Any ?, property : KProperty <*>): String { return actualValue } // Intercepts whenever someone updates the variable: "name = 'alex'" operator fun setValue ( thisRef : Any ?, property : KProperty <*>, newValue : String ) { // Automatically capitalize th...

Azure AKS how to test local dns enabled

After turning on localdns on your specific nodepool, we can use the following method to test if it is turned on.  Let's use the yaml here to place our pod into the nodepool.  apiVersion: v1 kind: Pod metadata:   name: dnstest-specific-node spec:   nodeName: <your-node-name> # Forces the pod onto this specific node   containers:   - name: test     image: busybox:1.28     command: ["sleep", "3600"] And then run kubectl apply -f <file-above>  kubectl apply -f dns-test-node.yaml kubectl exec -it dnstest-specific-node -- nslookup kubernetes.default Check the Server field in the output: 169.254.10.10 or 169.254.10.11 : The native AKS LocalDNS feature is enabled and actively working. 169.254.20.10 : The open-source NodeLocal DNSCache (DaemonSet) is enabled and working. 10.0.0.10 (or similar 10.x.x.10 ): Local DNS is not enabled . The pod is talking directly to the cluster's centralized CoreDNS service over the networ

android understanding the differences between Stateflow, mutableStateOf, rememberSavable

 In Jetpack Compose, both mutableStateOf and rememberSaveable are used to manage state, but they operate on completely different levels of the Android lifecycle. The Problem: Recomposition Wipes the Slate Clean In traditional Android (XML), a UI element like an EditText stays on the screen forever, holding onto its own text. In Jetpack Compose, UI elements are just functions . When data changes, Compose runs those functions all over again from the top to draw the updated screen. This process is called Recomposition . The intention is to trigger an update to the UI if anything changes.  mutableStateOf makes your data reactive (updates the UI), while rememberSaveable protects that data from being wiped out when the user rotates the screen or switches apps. 1. remember In Jetpack Compose, remember is a built-in memory guard. Its sole job is to protect a variable from being destroyed and reset when your UI redraws itself. To understand why it is absolutely necessary, you fir...