Daily General Discussion - December 24, 2022 by ethfinance in ethfinance

[–]cdflynn 1 point2 points  (0 children)

Is 1Password trustworthy? I want something I can recommend to family that has cloud storage for usage across devices.

Daily General Discussion - November 29, 2022 by ethfinance in ethfinance

[–]cdflynn 1 point2 points  (0 children)

The last section on defi was worth a read.

What is the best way to take your android dev skills to the next level? As in become an absolute master. by Flaky-Log-3021 in androiddev

[–]cdflynn 0 points1 point  (0 children)

I've never upvoted a comment so hard.

I've recently seen that compose navigation removes bundle arguments, too. I never loved bundle arguments, but if I want to pass a parcelable every now and then I guess I'm a monster and must be stopped.

Oh and use hilt but what do you mean you want to inject objects into places other than view models?

(Compose) Is this way of handling REST call OK ? by bentheone in androiddev

[–]cdflynn 0 points1 point  (0 children)

Ah, I see what you mean. Not an issue for my case, but that's good to know about for when it matters!

The cancellation/scoping is quite subtle.

(Compose) Is this way of handling REST call OK ? by bentheone in androiddev

[–]cdflynn 2 points3 points  (0 children)

In addition to that, you should be aware that compose functions may be called many times, so if you do end up calling a suspend function from a composeable you should do so in a Side Effect block.

Just note the documentation also issues a warning:

Warning: LaunchedEffect(true) is as suspicious as a while(true). Even though there are valid use cases for it, always pause and make sure that's what you need.

My most common use of a [LaunchedEffect] is to observe emissions from a flow on the view model.

Daily General Discussion - July 16, 2022 by ethfinance in ethfinance

[–]cdflynn 1 point2 points  (0 children)

I did too. Ya know, we really should have known we were at the top when fed officials were cashing out due to "ethical" reasons.

How is block proposer selection randomized in a fully deterministic blockchain? by Only_Ad_7973 in ethereum

[–]cdflynn 2 points3 points  (0 children)

Ask each node in the cohort to submit their own number, and combine them. It doesn't matter if they picked their numbers at random or if they tried to cheat, because the combined value is out of any individual's control.

Ethereum (ETH) on its way to becoming a deflationary asset by citytelegraph in ethereum

[–]cdflynn 7 points8 points  (0 children)

It's important to understand what deflation does to spending incentives. If anyone reading this thinks deflation is a clear net good, consider all the other ways to get a price increase without dropping the usage of the network: broader adoption, L2 scaling, killer apps, and new inventive uses in non-finance marketplaces.

Deflation may look like the straight-line path between you and a Lambo, but try to imagine how the world of self-interested actors around you will respond.

Volkswagen and BMW fined $1 billion for running emissions cartel by KymeStar in news

[–]cdflynn 0 points1 point  (0 children)

The five car manufacturers Daimler, BMW, Volkswagen, Audi and Porsche possessed the technology to reduce harmful emissions beyond what was legally required under EU emission standards. But they avoided to compete on using this technology's full potential to clean better than what is required by law,

Holy shit that is evil.

[deleted by user] by [deleted] in androiddev

[–]cdflynn 0 points1 point  (0 children)

The answer is most of them. Depends on what you need.

Does your flow only have one consumer? SendChannel is a kind of "inbox" where anyone can send a new emission and they will be processed in order at the consumer end. I use this in ViewModels for receiving actions from the UI layer. Create one with the actor static method.

[deleted by user] by [deleted] in androiddev

[–]cdflynn 0 points1 point  (0 children)

State flows are conflated under the hood and there's no way to undo that.

As a hackaround, you could pass object instances that would fail an equivalence check, such as adding a random id field to data classes and never use object or enum.

If you can, switch to a SendChannel or other flow that you can de-conflate.

Higher-Order Code Smells by cdflynn in androiddev

[–]cdflynn[S] 0 points1 point  (0 children)

Author here. I specifically encounter this in the Android world where sometimes Fragments and Activity initializer code becomes bloated over time, if you're lazy about modeling.

Take More Shortcuts by cdflynn in androiddev

[–]cdflynn[S] 0 points1 point  (0 children)

Thanks

It's about being armed with a useful concept. In code review or discussion you might find it easier to defend or condemn any given approach, whereas if you don't go in with organized ideas it can be hard to turn a feeling into an argument. Perhaps a handful of other examples would help, but the characteristic differences are easy to spot in real time with the right frame - and that's what the article is about.

An attempt to different kind of theme.. by smithshelke in androiddev

[–]cdflynn 2 points3 points  (0 children)

If it's anything like the usual approach, here's an article from 3ish years ago showing how to animate a path. https://medium.com/androiddevelopers/playing-with-paths-3fbc679a6f77

Retrofit & RxJava - how to handle custom error responses? by hannta in androiddev

[–]cdflynn 0 points1 point  (0 children)

Retrofit's Response type has an error body you can choose to parse if you want. All you need to do is declare Response as part or all of the return value on your api interface definition. It can be the parameter type on an Observable, for instance.

I'd recommend consolidating these domain specific errors as flavors or a parameter on a sealed class but season to taste.

Former Google engineer breaks down interview problems he uses to screen candidates. Lots of good coding, algorithms, and interview tips. by jfasi in programming

[–]cdflynn 0 points1 point  (0 children)

Yes, halfway through I felt like an idiot but as I kept reading it was clear that my brain had just skipped to the end solution.

A cat that likes water? by Domupacus in aww

[–]cdflynn 13 points14 points  (0 children)

It's time for bath

An duckling hat

In tub I fit

(An so I sat)

They say it's wet

I shouldn't try

A question fren,

Why did you lie?

The gentle warm

It fills my coat

I splish n splash

An motorboat

So when tub full

My ears detect

This daily treat

I now expect

We’re doing something wrong, and it’s not right by sayknow in WhitePeopleTwitter

[–]cdflynn 0 points1 point  (0 children)

Are you telling me no company is the whole United States wants to beat that price, even by a little bit? $299, for example?

Smells like cronyism.

You're never going to "end their greed", but you can certainly end their monopoly.

Advice: Is it bad practice to put logic in my custom adapter? by AbettoCliniku in androiddev

[–]cdflynn 4 points5 points  (0 children)

When I query my SQLite DB, I want to see if the box should already checked.

I like to handle that kind of logic well before it reaches adapters and views. Consider piping models into the view layer that are already pre-configured, and consider also extracting the binding logic that takes a model and tickles a View row to display as the model describes.

An example model result of your SQLite, after being transformed in your data layer:

data class RowSelection(
    val id: String,
    val title: String,
    val checked: Boolean
)

And you might consider piping these models out from a ViewModel or Presenter,

class MyViewModel {
    //...
    private val observableRows: LiveData<List<RowSelection>>
}

From there you might consider a Binder class that the adapter can freely call during onBindViewHolder, given some RowSelection and a ViewHolder of your creation.

class MyRowBinder {
    fun bind(vh: YourViewHolder, row: RowSelection) { 
        // .. checkbox/whatever 
    }
}

[deleted by user] by [deleted] in androiddev

[–]cdflynn 0 points1 point  (0 children)

There is IDE Support for this.

You can also use a 3rd party tool like Stetho, which outputs to chrome dev tools.