Jukka Siivonen
04/29/2020, 7:43 AMError:Kotlin: [Internal Error] java.lang.IllegalStateException: Backend Internal error: Exception during file facade code generation
what to do? Other similar module works fine so I'm not sure what is wrong with this specific module which worked fine not so long agoPypdeveloper
04/29/2020, 7:50 AMAnaniya
04/29/2020, 9:37 AMval client = OkHttpClient()
val request = Request.Builder()
.url("<https://covid-193.p.rapidapi.com/countries>").get()
.addHeader("x-rapidapi-host", "<http://covid-193.p.rapidapi.com|covid-193.p.rapidapi.com>")
.addHeader("x-rapidapi-key", "e9a2bc7b8amshcb0d6ea32047c46p129305jsnf42297251e7d")
.build()
val response = client.newCall(request).execute()
then i run this code and give me this Response{protocol=http/1.1, code=200, message=OK, url=<https://covid-193.p.rapidapi.com/countries>}
but all i want was to show me the countries and affected person number i download retrofit and gson but it look little bit harder how do i use itChilli
04/29/2020, 9:50 AM> Task :compileKotlinMetadata
Could not connect to Kotlin compile daemon
Could not connect to kotlin daemon. Using fallback strategy.
I have no idea why this happensmelatonina
04/29/2020, 2:43 PMMySealedClass::method
. I have to write explicitly MySealedClass.Companion::method
. Is this normal?bjonnh
04/29/2020, 3:43 PMChilli
04/29/2020, 4:00 PMmanueldidonna
04/29/2020, 5:27 PMphldavies
04/29/2020, 6:11 PMdata class Person(val name: String?, val age: Int?)
is there any way to have inline val Person.isValid get() = name != null && age != null
allow for smart-casting when accessing `name`/`age`?bjonnh
04/29/2020, 6:53 PMsannysanoff
04/29/2020, 7:09 PMPaul N
04/30/2020, 9:22 AMGopal S Akshintala
04/30/2020, 11:03 AMcolintheshots
04/30/2020, 2:27 PMChilli
04/30/2020, 3:50 PMAnaniya
04/30/2020, 3:56 PMEllen Spertus
04/30/2020, 7:08 PMe: /Users/espertus/src/firefox-voice/android-app/app/src/main/java/mozilla/voice/assistant/intents/communication/ui/contact/ContactCursorAdapter.kt: (49, 30): Overload resolution ambiguity:
public final val itemView: View defined in mozilla.voice.assistant.intents.communication.ui.contact.MyAdapter.MyViewHolder
public final val itemView: View defined in mozilla.voice.assistant.intents.communication.ui.contact.MyAdapter.MyViewHolder
Lines 2 and 3 of the error are identical, so I don’t see the ambiguity.
Here is the relevant code:
class MyAdapter(
private val cursor: Cursor
) : RecyclerView.Adapter<MyAdapter.MyViewHolder>() {
class MyViewHolder(val itemView: View) : RecyclerView.ViewHolder(itemView) {
private val ivContactPhoto: ImageView
init {
ivContactPhoto = itemView.findViewById(R.id.ivContactPhoto) as ImageView
}
}
Jakub
05/01/2020, 11:22 AMList
. How would you name that class?LastExceed
05/01/2020, 3:51 PM.replace(" ", " ")
until the string doesnt change?mathew murphy
05/01/2020, 3:57 PMmathew murphy
05/01/2020, 7:56 PMSebastien Leclerc Lavallee
05/01/2020, 9:18 PMval listOfItems: List<Item> = listOf<Item>
fun getItemWithId(id: String): Item {
return listOfItems.filter { it.id == id }.first()
}
A map of Item per String
val mapOfItems: Map<String,Item>
Or any other solution I didn’t think of?
Thanks 🙂viralshah
05/02/2020, 12:42 AMMay 1 2020 5:35:00 PM PST
I want to programatically get April 30 2020 11:59:59 PM PST
I tried
val currentTimeInTimeZone = ZonedDateTime.now(ZoneId.of(someTimeZone))
val yesterday = ZonedDateTime.of(
LocalDate.now().minusDays(1).atTime(LocalTime.MAX).truncatedTo(ChronoUnit.SECONDS),
ZoneId.of(someTimeZone)
)
But it seems to work on my machine and when I push the code to production it does not return the correct value, any ideas / help would be appreciatedJiri Bruchanov
05/02/2020, 10:26 AMiex
05/02/2020, 5:24 PMT
here to not having to pass clazz
? With reified parameter or something?
fun <T> getObject(key: PreferencesKey, clazz: Class<T>): T? =
getString(key)?.let {
gson.fromJson(it, clazz)
}
iex
05/02/2020, 5:56 PMfun foo(start: Foo): Result<List<MyRes>> {
val list: MutableList<MyRes> = mutableListOf()
var bar = start
while (bar < condition) {
when (val result = retrieveSomething(bar)) {
is Success -> list.addAll(result.success)
is Failure -> return Failure(Throwable("Error: ${result.error}"))
}
bar = bar.next()
}
return Success(list)
}
miha-x64
05/02/2020, 7:47 PMObject
or Object[]
, and extensions with hyphen and hash, absolutely unusable from Java.Tmpod
05/02/2020, 8:19 PMjeggy
05/02/2020, 10:13 PM.get
here?silvio
05/03/2020, 8:19 AMsilvio
05/03/2020, 8:19 AMLastExceed
05/03/2020, 8:48 AM.forEach { println(it) }
) and avoid it in nested situations (since name shadowing is almost never a good thing). otherwise decide case by case.
one could argue that for consistency you should just specify a name everywhere, but sometimes (especially in single-line scenarios) this will feel unnecessarily verbosesilvio
05/03/2020, 9:33 AMLastExceed
05/03/2020, 9:35 AMit
silvio
05/03/2020, 9:37 AMdto.map { ResponseEntity.ok(it) }
LastExceed
05/03/2020, 9:38 AMit
keyword exists forDavid Eriksson
05/03/2020, 9:38 AMdto.map(ResponseEntity::ok)
it
needed if the signature is compatible 🙂silvio
05/03/2020, 9:40 AMDavid Eriksson
05/03/2020, 9:42 AMit
is fine then.silvio
05/03/2020, 9:42 AMDavid Eriksson
05/03/2020, 9:43 AM