<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Jacky Tsang on Medium]]></title>
        <description><![CDATA[Stories by Jacky Tsang on Medium]]></description>
        <link>https://medium.com/@jacky-ttt?source=rss-bca04de4d039------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*-uFfNG1KdF7MN6ZV.jpg</url>
            <title>Stories by Jacky Tsang on Medium</title>
            <link>https://medium.com/@jacky-ttt?source=rss-bca04de4d039------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 28 Nov 2026 06:54:25 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@jacky-ttt/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Day165 — setup KMM environment]]></title>
            <link>https://jacky-ttt.medium.com/day165-setup-kmm-environment-5e98dd067c0a?source=rss-bca04de4d039------2</link>
            <guid isPermaLink="false">https://medium.com/p/5e98dd067c0a</guid>
            <category><![CDATA[ios]]></category>
            <category><![CDATA[kmm]]></category>
            <category><![CDATA[codingeveryday]]></category>
            <category><![CDATA[android]]></category>
            <dc:creator><![CDATA[Jacky Tsang]]></dc:creator>
            <pubDate>Wed, 07 Jun 2023 15:04:42 GMT</pubDate>
            <atom:updated>2023-06-07T15:04:42.281Z</atom:updated>
            <content:encoded><![CDATA[<h3>Day165 — setup KMM environment</h3><p>It records the steps I took to set up KMM environment on my M2 Pro Mac Mini.</p><ol><li>run kdoctor to verify your environment</li></ol><p>run below command to install kdoctor</p><pre>brew install kdoctor</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/569/1*peAURY-xL0kN2xCF2AeR5g.png" /><figcaption>above is not the original error message</figcaption></figure><p>It told me my CocoaPods is not installed correctly.</p><p><a href="https://github.com/JetBrains/compose-multiplatform-ios-android-template#set-up-the-environment">GitHub - JetBrains/compose-multiplatform-ios-android-template: Compose Multiplatform iOS+Android Application project template</a></p><p>2. install CocoaPods via RVM</p><p>I recommend installing CocoaPods via RVM instead of Homebrew.</p><pre>brew install gnupg</pre><pre>gpg --keyserver keyserver.ubuntu.com --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3 7D2BAF1CF37B13E2069D6956105BD0E739499BDB</pre><pre>\curl -sSL https://get.rvm.io | bash</pre><pre>rvm install ruby 3.0.0</pre><pre>sudo gem install -n /usr/local/bin cocoapods</pre><p>after that, you can verify your installation using kdoctor.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/570/1*vfZX0g_hjp45p2REf4Grng.png" /></figure><p>reference:</p><ul><li><a href="https://kotlinlang.org/docs/native-cocoapods.html#set-up-an-environment-to-work-with-cocoapods">CocoaPods overview and setup | Kotlin</a></li><li><a href="https://rvm.io/rvm/install">RVM: Ruby Version Manager - Installing RVM</a></li><li><a href="https://nrogap.medium.com/install-rvm-in-macos-step-by-step-d3b3c236953b">Install RVM in macOS (step by step)</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=5e98dd067c0a" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Day164 — Splash Screen API]]></title>
            <link>https://jacky-ttt.medium.com/day164-splash-screen-api-67a0bb3691a6?source=rss-bca04de4d039------2</link>
            <guid isPermaLink="false">https://medium.com/p/67a0bb3691a6</guid>
            <category><![CDATA[splash-screen]]></category>
            <category><![CDATA[android]]></category>
            <category><![CDATA[codingeveryday]]></category>
            <dc:creator><![CDATA[Jacky Tsang]]></dc:creator>
            <pubDate>Sat, 14 Jan 2023 10:43:36 GMT</pubDate>
            <atom:updated>2023-01-14T10:46:14.278Z</atom:updated>
            <content:encoded><![CDATA[<h3>Day164 — Splash Screen API</h3><p>I tried out the new Splash Screen API.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2Fabthd7DOfdw%3Ffeature%3Doembed&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3Dabthd7DOfdw&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2Fabthd7DOfdw%2Fhqdefault.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/09c7cc37fb69bba8eb2232afc9a84ae0/href">https://medium.com/media/09c7cc37fb69bba8eb2232afc9a84ae0/href</a></iframe><p><a href="https://developer.android.com/develop/ui/views/launch/splash-screen">Splash screens | Views | Android Developers</a></p><p>The splash screen icon uses the same specifications as Adaptive icons</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/979/1*ujl87hoHQRBFYxKCqcD8XA.png" /></figure><p>Enter and Exit animation can be customized.</p><p>An animated icon can be used in the format of “Animated Vector Drawable XML”</p><h4>How to add libarary</h4><p><a href="https://developer.android.com/develop/ui/views/launch/splash-screen/migrate">Migrate your splash screen implementation to Android 12 and later | Android Developers</a></p><pre>build.gradle<br><br>android {<br>   compileSdkVersion 31<br>   ...<br>}<br>dependencies {<br>   ...<br>   implementation &#39;androidx.core:core-splashscreen:1.0.0&#39;<br>}</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*knhDXQMcB-GH7BHdi21K1A.png" /><figcaption>Splash Screen</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*VhiOTdx2GW01ivaJSEpztg.png" /><figcaption>MainActivity</figcaption></figure><p>You can check out the whole project on my github repository.</p><p><a href="https://github.com/jacky-ttt/CodingEveryday/tree/master/Day164-SplashScreenApi">https://github.com/jacky-ttt/CodingEveryday/tree/master/Day164-SplashScreenApi</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=67a0bb3691a6" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Day163 — ViewModels, LiveData and Lifecycles]]></title>
            <link>https://jacky-ttt.medium.com/day163-viewmodels-livedata-and-lifecycles-c957851dc8e9?source=rss-bca04de4d039------2</link>
            <guid isPermaLink="false">https://medium.com/p/c957851dc8e9</guid>
            <category><![CDATA[android-lifecycle]]></category>
            <category><![CDATA[livedata]]></category>
            <category><![CDATA[lifecycle]]></category>
            <category><![CDATA[viewmodel]]></category>
            <category><![CDATA[codingeveryday]]></category>
            <dc:creator><![CDATA[Jacky Tsang]]></dc:creator>
            <pubDate>Fri, 13 Jan 2023 15:14:14 GMT</pubDate>
            <atom:updated>2023-01-13T15:57:45.638Z</atom:updated>
            <content:encoded><![CDATA[<h3>Day163 — ViewModels, LiveData and Lifecycles</h3><p>Here records the notes I took when watching “droidcon NYC 2017 — ViewModels, LiveData and Lifecycles, oh my!”. The talk is fairly old. Some of the mentioned methods are outdated and the code here is translated into Kotlin.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2FSlZVYkhoSq8%3Ffeature%3Doembed&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DSlZVYkhoSq8&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2FSlZVYkhoSq8%2Fhqdefault.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/22a6447913a47596a08f67fbf951ad16/href">https://medium.com/media/22a6447913a47596a08f67fbf951ad16/href</a></iframe><h4>Problems to be solved:</h4><ul><li>interruptions at any time</li><li>rotation</li><li>asynchronous tasks + destroyed UI = Memory Leaks</li><li>OS killing apps</li></ul><h4>Reactive UI</h4><p>ViewModels are objects that provide data for UI components and survive configuration changes.</p><p>LiveData is a data holder class that is lifecycle aware. It keeps a value and allows this value to be observed.</p><pre>class MainActivityViewModel : ViewModel() {<br>    private val _scoreTeamA = MutableLiveData&lt;Int&gt;()<br><br>    init {<br>        _scoreTeamA.setValue(0)<br>    }<br><br>    fun addToTeamA(amount: Int) {<br>        _scoreTeamA.setValue(_scoreTeamA.value?.plus(amount))<br>    }<br><br>    fun getScoreTeamA(): LiveData&lt;Int&gt; {<br>        return _scoreTeamA<br>    }<br>}</pre><pre>class MainActivity : ComponentActivity() {<br><br>    private var mViewModel: MainActivityViewModel? = null<br>    override fun onCreate(savedInstanceState: Bundle?) {<br>        super.onCreate(savedInstanceState)<br>        mViewModel = ViewModelProvider(this).get(MainActivityViewModel::class.java)<br>        mViewModel?.getScoreTeamA()?.observe(this) { newScore -&gt;<br>            displayForTeamA(newScore)<br>        }<br>    }<br><br>    private fun displayForTeamA(score: Int) {<br>        // display score<br>    }<br>}</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/556/1*g7mQivbvEdEVgX3HEorINg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/684/1*Hy290jtIphYWm9xEiQNh5A.png" /></figure><ul><li>Reactive because of data observation</li><li>UI data survives configuration changes</li><li>Clearer class responsibility</li></ul><h4>ViewModel Lifecycle</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/522/0*T806ON9Tu4yg6fDE.png" /></figure><p>Be note that if the process is killed due to memory restrictions, the ViewModel is destroyed.</p><p>Create a factory to pass values for instantiating ViewModel. It is by design to be hard to pass value to ViewModel.</p><p>ViewModels should not store Context / Activity / Fragment.</p><h4><strong>Lifecycle</strong></h4><p><strong>Lifecycle </strong>— An object that defines an Android Lifecycle.</p><p><strong>LifecycleOwner </strong>— LifecycleOwner is an interface: Objects with Lifecycles e.g. Activities and Fragments</p><p><strong>LifecycleObserver </strong>— Observes LifecycleOwner</p><ol><li>Can check state</li><li>automatically clean-up</li></ol><pre>class MyLocationListener : LifecycleObserver {<br><br>    var lifecycle: Lifecycle<br><br>    constructor(context: Context, lifecycle: Lifecycle, callback: Callback) {<br>        this.lifecycle = lifecycle<br>        this.lifecycle.addObserver(this)<br>    }<br><br>    var enabled = false<br><br>    fun enable() {<br>        enabled = true<br>        if (lifecycle.currentState.isAtLeast(Lifecycle.State.STARTED)) {<br>            // connect if not connected<br>        }<br>    }<br><br>    @OnLifecycleEvent(Lifecycle.Event.ON_STOP)<br>    fun stop() {<br>        enabled = false<br>        // disconnect if connected<br>    }<br><br>}</pre><h4>Observer</h4><pre>mViewModel?.getScoreTeamA()?.observe(this) { newScore -&gt;<br>    displayForTeamA(newScore)<br>}</pre><p>Observer only forwards events if Lifecycle is STARTED or RESUMED.</p><p>Observer cleans itself up when activity is finished. If Observer connects or becomes active again, intelligently sends the most recent data.</p><h4>Transformation</h4><p><strong>Transformation.map()</strong> — applies function to each value emitted by source LiveData and returns a LiveData that emits the resulting values.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/444/1*gm_HkuHIEwxR3HzbjUhesg.png" /></figure><pre>class MainActivityViewModel(startingScore: Int) : ViewModel() {<br>    private val _scoreTeamA: MutableLiveData&lt;Int&gt; = MutableLiveData&lt;Int&gt;()<br>    val scoreStringTeamA: LiveData&lt;String&gt;<br><br>    init {<br>        scoreStringTeamA = Transformations.map(_scoreTeamA) { it.toString() }<br>        _scoreTeamA.setValue(0)<br>    }<br>}</pre><p>MutableLiveData exposes setValue() (main thread) and postValue() (background thread)</p><p>LiveData is “ready only”</p><p>Therefore, we should only expose LiveData to outside, while MutableLiveData is used inside the ViewModel.</p><p>LiveData is synchronous, which ensures destroyed observer will not get updates. It is not a <strong>stream</strong> so it does not have a history, only the current state. (Don’t use it for chat history stream)</p><h4>Summary</h4><ul><li>All Activity does is update UI</li><li>ViewModel holds and processes data for UI. 1. use map to help 2. proper encapsulation</li><li>LiveData makes data observable, also lifecycle-aware.</li></ul><h4>Outdated codes</h4><p>replace</p><pre>private var mViewModel: MainActivityViewModel? = null<br>mViewModel = ViewModelProvider(this).get(MainActivityViewModel::class.java)</pre><p>with</p><pre>private val mViewModel: MainActivityViewModel by viewModels()</pre><p>replace</p><pre>class MainActivityViewModel : ViewModel() {<br>    private val _scoreTeamA = MutableLiveData&lt;Int&gt;()<br><br>    init {<br>        _scoreTeamA.setValue(0)<br>    }<br><br>    fun addToTeamA(amount: Int) {<br>        _scoreTeamA.setValue(_scoreTeamA.value?.plus(amount))<br>    }<br><br>    fun getScoreTeamA(): LiveData&lt;Int&gt; {<br>        return _scoreTeamA<br>    }<br>}<br></pre><p>with</p><pre>class MainActivityViewModel : ViewModel() {<br>    private val _scoreTeamA = MutableLiveData&lt;Int&gt;()<br>    val scoreTeamA: LiveData&lt;Int&gt;<br>        get() = _scoreTeamA<br><br>    init {<br>        _scoreTeamA.setValue(0)<br>    }<br><br>    fun addToTeamA(amount: Int) {<br>        _scoreTeamA.setValue(_scoreTeamA.value?.plus(amount))<br>    }<br><br>}</pre><p>@OnLifecycleEvent is deprecated</p><pre>class MyLocationListener : LifecycleObserver {<br><br>    var lifecycle: Lifecycle<br><br>    constructor(context: Context, lifecycle: Lifecycle, callback: Callback) {<br>        this.lifecycle = lifecycle<br>        this.lifecycle.addObserver(this)<br>    }<br><br>    var enabled = false<br><br>    fun enable() {<br>        enabled = true<br>        if (lifecycle.currentState.isAtLeast(Lifecycle.State.STARTED)) {<br>            // connect if not connected<br>        }<br>    }<br><br>    @OnLifecycleEvent(Lifecycle.Event.ON_STOP)<br>    fun stop() {<br>        enabled = false<br>        // disconnect if connected<br>    }<br><br>}</pre><p>replace with DefaultLifecycleObserver</p><pre>class MyLocationListener2 : DefaultLifecycleObserver {<br><br>    var lifecycle: Lifecycle<br><br>    constructor(context: Context, lifecycle: Lifecycle, callback: Callback) {<br>        this.lifecycle = lifecycle<br>        this.lifecycle.addObserver(this)<br>    }<br><br>    var enabled = false<br><br>    fun enable() {<br>        enabled = true<br>        if (lifecycle.currentState.isAtLeast(Lifecycle.State.STARTED)) {<br>            // connect if not connected<br>        }<br>    }<br><br>    override fun onStop(owner: LifecycleOwner) {<br>        enabled = false<br>        // disconnect if connected<br>    }<br><br>}</pre><p>OR LifecycleEventObserver</p><pre>private val lifecycleEventObserver = LifecycleEventObserver { source, event -&gt;<br>    when (event) {<br>        Lifecycle.Event.ON_RESUME -&gt;  onAppInForeground()<br>        Lifecycle.Event.ON_PAUSE -&gt; onAppInBackground()<br>        Lifecycle.Event.ON_DESTROY-&gt; onAppDestroyed()<br>        Lifecycle.Event.ON_CREATE -&gt; {}<br>        Lifecycle.Event.ON_START -&gt; {}<br>        Lifecycle.Event.ON_STOP -&gt; {}<br>        Lifecycle.Event.ON_ANY -&gt; {}<br>    }<br>}</pre><p><a href="https://stackoverflow.com/questions/70384129/lifecycle-onlifecycleevent-is-deprecated">Lifecycle OnLifecycleEvent is deprecated</a></p><h4>Common error</h4><p>Don’t do this</p><pre>class MainViewModel : ViewModel() {<br>    fun search(searchTerm: String): LiveData&lt;List&lt;Song&gt;&gt; {<br>        return songRepository.search(searchTerm)<br>    }<br>}</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/382/1*3pCDWWsdl42V7GuqLJpCZA.png" /></figure><p>A new LiveData is created when another keyword “Shake” is searched, which is redundant.</p><p>The solution is to use Transformations.switchMap(). It switches the observed LiveData based off of another LiveData’s value</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/598/1*hcPi3tV3cDghDZqJardwgg.png" /></figure><pre>class MainViewModel : ViewModel() {<br>    val mSongs: LiveData&lt;List&lt;Song&gt;&gt;<br>    private val mSearchTerm: MutableLiveData&lt;String&gt; = MutableLiveData()<br><br>    init {<br>        mSongs = Transformations.switchMap(mSearchTerm) { newTerm -&gt;<br>            songRepository.search(newTerm)<br>        }<br>    }<br><br>    fun search(searchTerm: String) {<br>        if (searchTerm.isNotBlank()) mSearchTerm.setValue(searchTerm)<br>    }<br>}</pre><p>map() and siwtchMap() run on the main thread.</p><p>Don’t use map() to perform a database lookup or network sync.</p><p>You can create LiveData for switchMap on the <strong>main thread</strong> and then <strong>post</strong> updates to them on a <strong>background thread</strong>.</p><h4>Memory related process death</h4><p>use onSaveInstanceState() to recover. “Plan B”.</p><p>The smallest amount of data to restore state.</p><p>Bundle too big = TransactionTooLargeException</p><p>we have SavedStateHandle now.</p><p><a href="https://developer.android.com/topic/libraries/architecture/viewmodel/viewmodel-savedstate">Saved State module for ViewModel | App architecture | Android Developers</a></p><h4>Activity death</h4><ul><li>finish()</li><li>Swipe off recents</li><li>Navigate back</li><li>Configuration change</li><li>Process death in case of low memory, if app is in background</li></ul><p><strong>Come back to a new state</strong></p><ul><li>finish()</li><li>Swipe off recents</li><li>Navigate back</li></ul><p><strong>Come back to the same state</strong></p><ul><li>Configuration change</li><li>Process death in case of low memory, if app is in background</li></ul><p>In the comment section,</p><p>LiveData should be replaced with MutableStateFlow from Kotlin coroutines. To not update the UI when the lifecycle is not started you do, flowWithLifecycle().</p><p>I do not verify above statement.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c957851dc8e9" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Day162— Convert callback to Coroutine]]></title>
            <link>https://jacky-ttt.medium.com/day161-convert-callback-to-coroutine-d124698bf52?source=rss-bca04de4d039------2</link>
            <guid isPermaLink="false">https://medium.com/p/d124698bf52</guid>
            <category><![CDATA[coroutine]]></category>
            <category><![CDATA[android]]></category>
            <category><![CDATA[kotlin]]></category>
            <category><![CDATA[kotlin-coroutines]]></category>
            <category><![CDATA[codingeveryday]]></category>
            <dc:creator><![CDATA[Jacky Tsang]]></dc:creator>
            <pubDate>Tue, 10 Jan 2023 16:57:53 GMT</pubDate>
            <atom:updated>2023-01-12T14:17:11.098Z</atom:updated>
            <content:encoded><![CDATA[<h3>Day162 — Convert callback to Coroutine</h3><p>Here record the notes I took when I am reading “Avoid Callback Hell With Kotlin Coroutines”.</p><p><a href="https://levelup.gitconnected.com/avoid-callback-hell-with-kotlin-coroutines-7a72a2a8a701">Avoid Callback Hell With Kotlin Coroutines</a></p><h4>One-shot callbacks</h4><p>use suspendCoroutine</p><pre>suspend fun DatabaseReference.read(): DataSnapshot = suspendCoroutine { continuation -&gt;<br>    val valueEventListener = object : ValueEventListener {<br>        override fun onCancelled(error: DatabaseError) {<br>            continuation.resumeWithException(error.toException())<br>        }<br><br>        override fun onDataChange(snapshot: DataSnapshot) {<br>            continuation.resume(snapshot)<br>        }<br>    }<br>    addListenerForSingleValueEvent(valueEventListener)<br>}<br><br>suspend fun getGroups(): List&lt;Group&gt; {<br>    return groupRef.read().mapToGroups()<br>}<br><br>class MyViewModel : ViewModel() {<br>    fun getGroups() {<br>        // call it inside a coroutine scope<br>        viewModelScope.launch {<br>            val result = getGroups()<br>            ...<br>        }<br>    }<br>}</pre><p>wrap callback with suspendCoroutine and make the method, then use resume or resumeWithException at the place where the callback occurs.</p><h4>Subscription based callbacks</h4><p>use callbackFlow</p><pre>suspend fun DatabaseReference.subscribe(): Flow&lt;Player&gt; = callbackFlow {<br>    val childEventListener = object : ChildEventListener {<br>        override fun onChildAdded(snapshot: DataSnapshot, previousChildName: String?) {<br>            trySend(<br>                Player(<br>                    snapshot.key<br>                )<br>            )<br>        }<br>        override fun onChildChanged(snapshot: DataSnapshot, previousChildName: String?) {}<br>        override fun onChildRemoved(snapshot: DataSnapshot) {}<br>        override fun onChildMoved(snapshot: DataSnapshot, previousChildName: String?) {}<br>        override fun onCancelled(error: DatabaseError) {}<br>    }<br>    addChildEventListener(childEventListener)<br>    awaitClose {<br>        removeEventListener(childEventListener)<br>    }<br>}<br><br>// subscribe to the data<br>val flow = DatabaseReference().subscribe()<br>flow.collect { player -&gt;<br>    ...<br>}</pre><p>wrap callback listener with callbackFlow, use trySend to send the data, and use awaitClose to close the subscription when needed.</p><h4>Function vs method</h4><blockquote><strong><em>Method</em></strong><em> is a </em><strong><em>function</em></strong><em> associated to an </em><a href="https://blog.kotlin-academy.com/programmer-dictionary-class-vs-type-vs-object-e6d1f74d1e2e"><em>object</em></a><em>.</em></blockquote><p>Function is a more general term, and all methods are also functions.</p><pre>class A {<br>   fun someMethod() {}<br>}</pre><p><a href="https://blog.kotlin-academy.com/kotlin-programmer-dictionary-function-vs-method-vs-procedure-c0216642ee87">Kotlin programmer dictionary: Function vs Method vs Procedure</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d124698bf52" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Day161 — mutableStateOf() in android compose]]></title>
            <link>https://jacky-ttt.medium.com/day161-mutablestateof-in-android-compose-67273b64873f?source=rss-bca04de4d039------2</link>
            <guid isPermaLink="false">https://medium.com/p/67273b64873f</guid>
            <category><![CDATA[compose]]></category>
            <category><![CDATA[codingeveryday]]></category>
            <category><![CDATA[android]]></category>
            <category><![CDATA[android-compose]]></category>
            <dc:creator><![CDATA[Jacky Tsang]]></dc:creator>
            <pubDate>Sun, 08 Jan 2023 08:20:02 GMT</pubDate>
            <atom:updated>2023-01-08T08:20:02.364Z</atom:updated>
            <content:encoded><![CDATA[<h3>Day161 — mutableStateOf() in android compose</h3><p>Here records the note I took when reading this article.</p><p><a href="https://stefma.medium.com/jetpack-compose-remember-mutablestateof-derivedstateof-and-remembersaveable-explained-270dbaa61b8">Jetpack Compose: remember, mutableStateOf, derivedStateOf and rememberSaveable explained</a></p><pre>val stringState = remember { mutableStateOf(&quot;&quot;) }</pre><p>It “remember” the value so it won’t be lost after recomposition.</p><p><a href="https://developer.android.com/jetpack/compose/state#state-in-composables">State and Jetpack Compose | Android Developers</a></p><blockquote>Composable functions can use the <a href="https://developer.android.com/reference/kotlin/androidx/compose/runtime/package-summary#remember(kotlin.Function0)">remember</a> API to store an object in memory. A value computed by remember is stored in the Composition during initial composition, and the stored value is returned during recomposition.</blockquote><h4>similar to &quot;lazy&quot;</h4><p>lazy is bound to a class scope, remember is bound to a composable function.</p><blockquote>The first call to get() executes the lambda passed to lazy() and remembers the result. Subsequent calls to get() simply return the remembered result.</blockquote><h4>not always recompose</h4><p>If the value is the same, nothing happens.<br>If the value isn’t read by anyone, nothing happens.<br>If the value changes, <em>all composables</em> that read this value will be <em>recomposed</em>.</p><h4>derivedStateOf</h4><blockquote>derivedStateOf {} should be used when your state or key is changing more than you want to update your UI.</blockquote><p><a href="https://medium.com/androiddevelopers/jetpack-compose-when-should-i-use-derivedstateof-63ce7954c11b">Jetpack Compose — When should I use derivedStateOf?</a></p><p>before:</p><pre>@Composable<br>private fun Counter() {<br>    val counterState = remember { mutableStateOf(0) }<br><br>    Button(<br>        onClick = { counterState.value = counterState.value + 1 }<br>    ) {<br>        Text(counterState.value.toString())<br>    }<br><br>    if (counterState.value &gt;= 10) Text(&quot;Hurray!&quot;)<br>}</pre><p>after:</p><pre>@Composable<br>private fun CounterWithDerivedState() {<br>    val counterState = remember { mutableStateOf(0) }<br><br>    val showHurrayState = remember {<br>        derivedStateOf { counterState.value &gt; 10 }<br>    }<br><br>    Button(<br>        onClick = { counterState.value = counterState.value + 1 }<br>    ) {<br>        Text(counterState.value.toString())<br>    }<br><br>    if (showHurrayState.value) Text(&quot;Hurray!&quot;)<br>}</pre><h4>without derivedStateOf</h4><p>Introducing another MutableState also works, but it is not recommended.</p><pre>@Composable<br>private fun CounterWithSecondMutableState() {<br>    val counterState = remember { mutableStateOf(0) }<br>    val showHurrayState = remember { mutableStateOf(false) }<br><br>    Button(<br>        onClick = {<br>            counterState.value = counterState.value + 1<br>            showHurrayState.value = counterState.value &gt;= 10<br>        }<br>    ) {<br>        Text(counterState.value.toString())<br>    }<br><br>    if (showHurrayState.value) Text(&quot;Hurray!&quot;)<br>}</pre><h4>rememberSaveable</h4><p>similar to SavedInstanceState.</p><blockquote>rememberSaveable saves the calculated value into a Bundle (if it’s possible) on configuration change and can therefore restore it when the Activity or Fragment got recreated. For example on orientation change, split screen, or process death.</blockquote><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=67273b64873f" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Day160 — Return a value from a kotlin coroutine scope]]></title>
            <link>https://jacky-ttt.medium.com/day160-return-a-value-from-a-kotlin-coroutine-scope-c75cd587f5ba?source=rss-bca04de4d039------2</link>
            <guid isPermaLink="false">https://medium.com/p/c75cd587f5ba</guid>
            <category><![CDATA[codingeveryday]]></category>
            <category><![CDATA[kotlin-coroutines]]></category>
            <category><![CDATA[coroutinescope]]></category>
            <category><![CDATA[coroutine]]></category>
            <category><![CDATA[kotlin]]></category>
            <dc:creator><![CDATA[Jacky Tsang]]></dc:creator>
            <pubDate>Sat, 07 Jan 2023 07:12:35 GMT</pubDate>
            <atom:updated>2023-01-07T07:47:29.116Z</atom:updated>
            <content:encoded><![CDATA[<h3>Day160 — Return a value from a kotlin coroutine scope</h3><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2FpqQkl9BInAw%3Ffeature%3Doembed&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DpqQkl9BInAw&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2FpqQkl9BInAw%2Fhqdefault.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/2845ced407cd746d94b46db2afc79cd6/href">https://medium.com/media/2845ced407cd746d94b46db2afc79cd6/href</a></iframe><p>Return value within a coroutine scope</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/3082a2f4e3c10712d55a9a055122227d/href">https://medium.com/media/3082a2f4e3c10712d55a9a055122227d/href</a></iframe><p>Return value outside a coroutine scope</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/70cafc1e494ea8aa718b60fe54143be2/href">https://medium.com/media/70cafc1e494ea8aa718b60fe54143be2/href</a></iframe><p><a href="https://kotlinlang.org/api/kotlinx.coroutines/kotlinx-coroutines-core/kotlinx.coroutines/-job/invoke-on-completion.html">invokeOnCompletion</a></p><p>Use invokeOnCompletion when it is really necessary because it has no difference from “Return value within a coroutine scope” with a CoroutineExceptionHandler to me. And it disrupts the coroutine pattern by introducing a callback.</p><p>They do the same thing. I prefer the first one, handling everything within a coroutine scope.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/55f614f0527ce76eda5da19f26875374/href">https://medium.com/media/55f614f0527ce76eda5da19f26875374/href</a></iframe><p>These two are the same.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/903367bdfb6f3b779a88b96602bc7dc9/href">https://medium.com/media/903367bdfb6f3b779a88b96602bc7dc9/href</a></iframe><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c75cd587f5ba" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Day159 — Kotlin tips]]></title>
            <link>https://jacky-ttt.medium.com/day159-kotlin-tips-c0cb015127fa?source=rss-bca04de4d039------2</link>
            <guid isPermaLink="false">https://medium.com/p/c0cb015127fa</guid>
            <category><![CDATA[kotlin]]></category>
            <category><![CDATA[codingeveryday]]></category>
            <category><![CDATA[coroutine]]></category>
            <category><![CDATA[kotlin-coroutines]]></category>
            <dc:creator><![CDATA[Jacky Tsang]]></dc:creator>
            <pubDate>Wed, 04 Jan 2023 16:05:18 GMT</pubDate>
            <atom:updated>2023-01-04T16:06:43.656Z</atom:updated>
            <content:encoded><![CDATA[<h3>Day159 — Kotlin tips</h3><ol><li>convert callback to coroutine to avoid callback hell using suspendCoroutine</li></ol><p><a href="https://youtube.com/shorts/5PHToTG7YyY?feature=share">Make Any Callback a Suspend Function in Kotlin 🤯 #Shorts</a></p><p>callback:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/3e02f74955abeaf53f60a2d38fec2b95/href">https://medium.com/media/3e02f74955abeaf53f60a2d38fec2b95/href</a></iframe><p>suspendCoroutine:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/1da7036ed590b10fa4efcc3518206381/href">https://medium.com/media/1da7036ed590b10fa4efcc3518206381/href</a></iframe><p>note that suspendCoroutine does not change the CoroutineContext. It simply converts callback to suspend function which is more manageable.</p><p>2. out</p><p><a href="https://youtube.com/shorts/RLWY4dVLFiI?feature=share">THIS Is What the Out Keyword Is All About In Kotlin</a></p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/0837d8c55585e7fe0143649e0333c492/href">https://medium.com/media/0837d8c55585e7fe0143649e0333c492/href</a></iframe><blockquote><em>declaration-site variance</em>: you can annotate the <em>type parameter</em> T of Source to make sure that it is only <em>returned</em> (produced) from members of Source&lt;T&gt;, and never consumed.</blockquote><p><a href="https://kotlinlang.org/docs/generics.html#declaration-site-variance">https://kotlinlang.org/docs/generics.html#declaration-site-variance</a></p><ul><li><a href="https://stackoverflow.com/questions/44298702/what-is-out-keyword-in-kotlin">What is out keyword in kotlin</a></li><li><a href="https://medium.com/mobile-app-development-publication/in-and-out-type-variant-of-kotlin-587e4fa2944c">In and out type variant of Kotlin</a></li></ul><p>3. inline function</p><p><a href="https://youtube.com/shorts/qvQTMx0uB84?feature=share">THIS Keyword Boosts the Performance of Your Kotlin Code🤯</a></p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/2875e1cdb0a25bada5524a2510fb2bd4/href">https://medium.com/media/2875e1cdb0a25bada5524a2510fb2bd4/href</a></iframe><p><a href="https://www.baeldung.com/kotlin/inline-functions#inline-functions">https://www.baeldung.com/kotlin/inline-functions#inline-functions</a></p><blockquote>When using inline functions, there is no extra object allocation and no extra virtual method calls.</blockquote><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c0cb015127fa" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Day158 — draw an overlay on an image using CSS]]></title>
            <link>https://jacky-ttt.medium.com/day158-draw-an-overlay-on-an-image-using-css-75bb1d207472?source=rss-bca04de4d039------2</link>
            <guid isPermaLink="false">https://medium.com/p/75bb1d207472</guid>
            <category><![CDATA[css]]></category>
            <category><![CDATA[html]]></category>
            <category><![CDATA[codingeveryday]]></category>
            <dc:creator><![CDATA[Jacky Tsang]]></dc:creator>
            <pubDate>Tue, 27 Dec 2022 14:45:35 GMT</pubDate>
            <atom:updated>2022-12-27T14:45:35.186Z</atom:updated>
            <content:encoded><![CDATA[<h3>Day158 — draw an overlay on an image using CSS</h3><pre>.home {}<br><br>img {<br>  width: 100%;<br>  padding: 0;<br>  margin: 0;<br>  display: block;<br>}<br><br>.wrap {<br>  position: relative;<br>}<br><br>.wrap:before {<br>  content: &quot;&quot;;<br>  position: absolute;<br>  top: 0;<br>  left: 0;<br>  height: 100%;<br>  width: 100%;<br>  background: rgba(0, 0, 0, 0.5);<br>  z-index: 999;<br>}</pre><pre>&lt;div class=&quot;home&quot;&gt;<br>  &lt;div class=&quot;wrap&quot;&gt;<br>    &lt;img src=&quot;http://via.placeholder.com/350x150&quot; /&gt;<br>  &lt;/div&gt;<br>&lt;/div&gt;</pre><p>Reference:</p><p><a href="https://stackoverflow.com/questions/44673676/how-to-add-color-overlay-on-an-image">How to add color overlay on an image</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=75bb1d207472" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Day157 — get images from json in Gatsby]]></title>
            <link>https://jacky-ttt.medium.com/day157-get-images-from-json-in-gatsby-e23872e84018?source=rss-bca04de4d039------2</link>
            <guid isPermaLink="false">https://medium.com/p/e23872e84018</guid>
            <category><![CDATA[gatsbyjs]]></category>
            <category><![CDATA[codingeveryday]]></category>
            <category><![CDATA[gatsby]]></category>
            <category><![CDATA[react]]></category>
            <category><![CDATA[typescript]]></category>
            <dc:creator><![CDATA[Jacky Tsang]]></dc:creator>
            <pubDate>Tue, 27 Dec 2022 14:42:34 GMT</pubDate>
            <atom:updated>2022-12-27T14:42:34.475Z</atom:updated>
            <content:encoded><![CDATA[<h3>Day157 — get images from json in Gatsby</h3><p>Here records the method I used to import images from a json file in Gatsby.js v5.</p><p>By the nature of the Gatsby.js framework, anything dynamic relies on graphql query. Therefore, graphal query plus GatsbyImage are used. Graphql query is used to query the data from the json file, while the GatsbyImage is used to interpret the queried image object for display.</p><p>Versions used:</p><pre>&quot;gatsby&quot;: &quot;^5.3.3&quot;,<br>&quot;gatsby-plugin-image&quot;: &quot;^3.3.2&quot;,<br>&quot;gatsby-plugin-sharp&quot;: &quot;^5.3.2&quot;,<br>&quot;gatsby-source-filesystem&quot;: &quot;^5.3.1&quot;,<br>&quot;gatsby-transformer-json&quot;: &quot;^5.3.0&quot;,<br>&quot;gatsby-transformer-sharp&quot;: &quot;^5.3.1&quot;,</pre><p>folder structure:</p><ul><li>src/pages/index.html</li><li>src/images/icon.png</li><li>src/data/source.json</li></ul><pre>-src<br>  ┕-pages<br>      ┕-index.html<br>  ┕-images<br>      ┕-icon.png<br>  ┕-data<br>      ┕-source.json</pre><p>In gatsby-config.ts,</p><pre>const config: GatsbyConfig = {<br>  // ...<br>  plugins: [<br>    `gatsby-plugin-image`,<br>    `gatsby-plugin-sharp`,<br>    `gatsby-transformer-sharp`, // Needed for dynamic images<br>    {<br>      resolve: `gatsby-source-filesystem`,<br>      options: {<br>        name: `images`,<br>        path: path.join(__dirname, `src`, `images`),<br>      },<br>    },<br>    `gatsby-transformer-json`,<br>    {<br>      resolve: `gatsby-source-filesystem`,<br>      options: {<br>        path: path.join(__dirname, `src`, `data`),<br>      },<br>    },<br>  ]<br>}</pre><p>In src/data/source.json,</p><pre>[<br>  {<br>    &quot;name&quot;: &quot;data1&quot;,<br>    &quot;image&quot;: &quot;../images/icon.png&quot;<br>  },<br>  {<br>    &quot;name&quot;: &quot;data2&quot;,<br>    &quot;image&quot;: &quot;../images/icon.png&quot;<br>  }<br>]</pre><p>Image paths must be written in relative. Otherwise, the gatsby plugin would not recognize them by default.<br>In src/pages/index.html,</p><pre>const dataQuery = graphql`<br>  query Projects {<br>    allSourceJson {<br>      nodes {<br>        name<br>        image {<br>          childImageSharp {<br>            gatsbyImageData(<br>              placeholder: BLURRED<br>              formats: [AUTO, WEBP, AVIF]<br>              layout: FULL_WIDTH<br>              aspectRatio: 2<br>              transformOptions: {cropFocus: ATTENTION}<br>            )<br>          }<br>        }<br>      }<br>    }<br>  }<br>`</pre><p>If the json file is written correctly, the image would be recognized as a File object in graphql. Then, it will have the childImageSharp property to select for query.</p><p>It would be best to verify the graphql query in “<a href="http://localhost:8000/___graphql">http://localhost:8000/___graphql</a>”.</p><p>To use the query, you can write</p><pre>import { GatsbyImage, getImage, ImageDataLike } from &quot;gatsby-plugin-image&quot;<br><br>const Image = ({ image, name }: ImageProps) =&gt;<br>  &lt;GatsbyImage image={getImage(image)} alt={name} /&gt;<br><br>const IndexPage = () =&gt; {<br>  const sourceData = useStaticQuery(dataQuery)<br>  const sources = sourceData.allProjectsJson.nodes<br><br>  return (<br>    &lt;main&gt;<br>      &lt;Image image={sources[0].image} name={sources[0].name} /&gt;<br>    &lt;/main&gt;<br>  )<br>}</pre><p>Bonus:</p><p>querying the same image in a different format using graphql alias</p><pre>const dataQuery = graphql`<br>  query Projects {<br>    allSourceJson {<br>      nodes {<br>        name<br>        image {<br>          childImageSharp {<br>            gatsbyImageData(<br>              placeholder: BLURRED<br>              formats: [AUTO, WEBP, AVIF]<br>              layout: FULL_WIDTH<br>              aspectRatio: 2<br>              transformOptions: {cropFocus: ATTENTION}<br>            )<br>          }<br>        }<br>        fullImage: image {<br>          childImageSharp {<br>            gatsbyImageData(<br>              placeholder: BLURRED<br>              formats: [AUTO, WEBP, AVIF]<br>              layout: FULL_WIDTH<br>            )<br>          }<br>        }<br>      }<br>    }<br>  }<br>`</pre><p>References:</p><ul><li><a href="https://github.com/gatsbyjs/gatsby/issues/8312#issuecomment-422926519">How to transform absolute image paths in json to gatsby-images? · Issue #8312 · gatsbyjs/gatsby</a></li><li><a href="https://stackoverflow.com/questions/52574783/gatsby-image-path-from-json">Gatsby image path from json</a></li><li><a href="https://stackoverflow.com/questions/71188605/forestry-gatsby-image-reference-image-from-json-files">Forestry + Gatsby Image - reference image from JSON files</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e23872e84018" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Day156 — CSS card flip]]></title>
            <link>https://jacky-ttt.medium.com/day156-css-card-flip-d25f102547bd?source=rss-bca04de4d039------2</link>
            <guid isPermaLink="false">https://medium.com/p/d25f102547bd</guid>
            <category><![CDATA[html]]></category>
            <category><![CDATA[codingeveryday]]></category>
            <category><![CDATA[css]]></category>
            <category><![CDATA[tailwind-css]]></category>
            <dc:creator><![CDATA[Jacky Tsang]]></dc:creator>
            <pubDate>Wed, 14 Dec 2022 15:06:36 GMT</pubDate>
            <atom:updated>2022-12-14T15:06:36.638Z</atom:updated>
            <content:encoded><![CDATA[<h3>Day156 — CSS card flip</h3><p>Here records the thing I learned when I did a card flip in my project.</p><h4>vanilla CSS</h4><p><a href="https://www.w3schools.com/howto/howto_css_flip_card.asp">How To Create a Flip Card with CSS</a></p><h4>Tailwind CSS</h4><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2FCC78NrgZkY8%3Ffeature%3Doembed&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DCC78NrgZkY8&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2FCC78NrgZkY8%2Fhqdefault.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/1868bdc86b8fa717b0bec7a1ce8fee41/href">https://medium.com/media/1868bdc86b8fa717b0bec7a1ce8fee41/href</a></iframe><p><a href="https://github.com/Sridhar-C-25/animated3dflipcard_tailwind">GitHub - Sridhar-C-25/animated3dflipcard_tailwind: animated 3D Flip Card Using Tailwind CSS</a></p><p>The main</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/729b5e5bf275643112d502291a701e10/href">https://medium.com/media/729b5e5bf275643112d502291a701e10/href</a></iframe><p>Add custom plugin</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/458c07574ca2e8446f1d0ab368dc53d8/href">https://medium.com/media/458c07574ca2e8446f1d0ab368dc53d8/href</a></iframe><p><a href="https://github.com/tailwindlabs/tailwindcss/discussions/1686">Adding backface-visibility? · Discussion #1686 · tailwindlabs/tailwindcss</a></p><h4>Problem encountered</h4><p>The absolute layout is one pixel off from the relative layout because the column is calculated dynamically.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/279/1*ILnh5Epxv9Bw74h-a9nBYg.png" /></figure><p>I have to set inset to -1 px to cover it up. It is less noticeable.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/458/1*xjbSWGFI2_hMQ4l5m7RaTw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/279/1*Qj-15k0VjYi_LrXyzs8g8A.png" /></figure><h4>Another Tailwind CSS</h4><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2FSJnRnQdjR0w%3Ffeature%3Doembed&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DSJnRnQdjR0w&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2FSJnRnQdjR0w%2Fhqdefault.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="640" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/959017c5146cb038e4a3c3c6c99e4d82/href">https://medium.com/media/959017c5146cb038e4a3c3c6c99e4d82/href</a></iframe><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d25f102547bd" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>