« first day (3891 days earlier)      last day (1042 days later) » 

6:57 AM
\o
 
o/
 
how is it going
 
meh
i wanna have a coffee
 
Ah alright
then have some
 
im in a meeting :(
 
7:02 AM
alwyas get your coffee before the meeting starts
 
no time :D
 
that's a rue Mehdi smile
 
hehe
i m not a morning person
most of the times
 
7:56 AM
any full screen image view with zoom library?
 
 
2 hours later…
Tim
9:32 AM
@grrigore if you need a comment for a function call then the function name is not clear
 
the comment can define the process in more detail
 
Tim
Then the comment should be on the function
 
ok
 
@Tim yea something like that
I just wanted to float his boat
or whatever that saying is
that's why I call him timmy-G
G from great programmer that also plays great fifa and hots
 
Tim
oi that's me
 
9:45 AM
but it's ok he added comments tho
I mean it's something
 
Tim
comments that add nothing make the code harder to read though
 
well in this case I guess they add something
but whatever
any artist to listen to today?
 
Tim
let's check the first one
//Create criteria hashmap of <CriteriaBucket, CriteriaModel>
criteria = getCriteria()
 
haha
yea dude you're right be we aren't all that smart xD
clean code stuff
 
Tim
it says it creates, but the function says it gets? Either the comment is wrong or the function name is wrong
 
9:50 AM
yes I agree with this one
 
Tim
name the function create, and that part of the comment can be removed
and then specifying the return type of the function in this comment means that if you have to change the function return type for whatever reason, you now also have to update this comment, and you will forget to do that guaranteed
 
bb man what did you do?
 
10:04 AM
SO mobile doesn't allow posting questions?
 
This was the most starred message last year on this day:
Jun 11 '20 at 10:45, by R15-Zucc
Jun 12 '19 at 9:43, by MwBakker
user image
 
3 days in a row
highway to the danger zone
 
Tim
hide yo daughters
hide yo self too
 
😂😂
 
10:48 AM
@R15-Zucc what a great time that was
@Jordy you will never leave.
 
@MwBakker why did i read that as a threat? XD
 
it's not a thread, it's a promise
@grrigore audioslave
 
lemme check
 
"show me how to live" is a good one
I invited my crush over for a bbq this saturday and she agreed
except she doesn't know quite yet that this bbq is not at my place and with some friends
 
well
xD
 
10:55 AM
hope she won't mind that
 
i d cancel all my friends
of
not at your place
 
she knows some of these people from highschool so it could be nice
but then again, I should spend alone time with her
gonna pull an all nighter to finish as much as possible from my app
 
good luck with that man
 
in the morning I need to help my friends to brick a driveway :(
 
oh
well i guess it could be fun
 
11:05 AM
im exhausted
and starting to feel less connection with the company I work for
 
11:43 AM
@MwBakker ye i like it kinda
 
12:16 PM
kinda ??
Are you from Mars?
that song is amazing
 
kindaa
 
12:37 PM
Word
@MwBakker You had a connection with the company you work for ?
 
sup man
can I ask you something I'm kinda stuck
 
Me? Of course
10 inches
3
 
@Graeme duh
@Graeme x'D
 
Heh, what's the question?
 
@Graeme what? haha
I have to send a file as bytes to the API
Retrofit version of this
does this require multipart?
val image = bytes.toRequestBody("application/octet-stream".toMediaTypeOrNull())
9
A: Upload binary file with retrofit 2 in Android

Hamed GhadirianAfter hours of searching I found that there was an @Multipart annotation remains in API interface of my code from last example! which prevent to send binary data to the server and the solution in retrofit repository was OK!

ugh might be this
 
12:50 PM
r15 chat, the search engine people use before using google
 
that was it
wait no
I've been using google for 3hrs
:(
but I've been using it wrong
 
google: "upload byte array retrofit" -> stackoverflow.com/questions/31325723/…
 
yes man but that multipart fucked me up
 
Don't listen to Mehdi, he didn't even star my hilarious joke. You did good Grr.
And yes, Multipart for large files
 
yea I know that
but looks like multipart and bytes won't work together
 
1:08 PM
have you tried @Streaming
 
nope
 
Let me copy paste you an example of what we're doing to upload a bitmap - one sec
 
I did it
 
Oh, I won't bother then XD
 
yes thank you
 
1:17 PM
hey
 
\o\
/o/
 
guys look at this
sharedPreferences.edit { preferences ->
preferences[longPreferencesKey(name = "logged_user_id")] = user_id
}
it throws error with this message: too many arguments for public abstract fun edit(): SharedPreferences.Editor
 
@SecretKeeper yeah you are already in the SharedPreferences.Editor scope
so you dont get preferences ->
:52395457
 sharedPreferences.edit {
            putLong("logged_user_id") = user_id
        }
 
what's @Streaming for Ivan?
 
sorry @Streaming is for downloading a file
downloads the file in smaller chunks
 
1:25 PM
automatically?
like all I have to do is use that?
 
@IvanMilisavljevic That's right? did you mean "sharedPreferences.edit().apply {" ?
 
if your BE server has support for streaming i believe
 
I'd use sharedPrefs.apply { putETC apply() }
 
@Graeme not really .edit is actually kotlins extension function which takes the lambda and runs .apply automatically
 
oh
nice
 
1:26 PM
my spanish ex gf called me during break time, which was odd
 
@SuppressLint("ApplySharedPref")
inline fun SharedPreferences.edit(
    commit: Boolean = false,
    action: SharedPreferences.Editor.() -> Unit
) {
    val editor = edit()
    action(editor)
    if (commit) {
        editor.commit()
    } else {
        editor.apply()
    }
}
 
sharedPreferences already has an edit() function :) Which will take precedence over extension no?
 
Tim
no
 
@Graeme no if you have a trailing lambda
 
if you select it
I guess
 
1:27 PM
Oh, difference name space
 
Tim
edit() has no parameters but edit {} has 2
 
Noticed that now :P
Did you import Edit() ?
I've found AS is not quite fluent with extension functions yet
 
yeah
heres the full import
import androidx.core.content.edit
 
@IvanMilisavljevic what is putLong here?
i have also tried this

fun saveLoggedInUserDat(user_id: Long) {
sharedPreferences.edit().apply { sharedPreferences ->
sharedPreferences[longPreferencesKey(name = "logged_user_id")] = user_id
}
}
 
@SecretKeeper type of the object you want to write
 sharedPreferences.edit {
            when (value) {
                is String -> putString(key, value)
                is Boolean -> putBoolean(key, value)
                is Int -> putInt(key, value)
                is Float -> putFloat(key, value)
                is Long -> putLong(key, value)
                is Set<*> -> putStringSet(key, value.map { it.toString() }.toSet())
            }
        }
 
Tim
1:31 PM
inside the edit {} block, this refers to the Editor, so you call putLong without the preferences. prefix
 
here is the KeyValueStore we use in the my app
this is just a utility class we use across our app
 
Can you try putting in "true" for the default variable ?
Or false :P
I'm wondering if it's having a problem with filling a default value and using a ... sam method? Is that what they're called?
 
@Graeme sam is related to constructors
Classes with a single abstract method actually
 
Which is what you're feeding into Edit
 
its not a SAM its a higher order function (function that takes other function as a parameter)
 
1:36 PM
sharedPreferences.edit { putLong("logged_user_id") = user_id } is
sharedPreferences.edit ({ putLong("logged_user_id") = user_id }) is
sharedPreferences.edit (object : SharedPreferences.Editor.() {{ putLong("logged_user_id") = user_id }} ?
Taking another function would be sharedPreferences.edit(Blah::function)
That's not what you're doing...
(I started Kotlin 3 months ago, I would take what I'm saying with a critical eye)
 
ah
i see your point, but there is this thing called trailing lambdas
 
you can skip () if is lambda
 
so writing something like sp.edit({}) and sp.edit() {} is a same thing
 
also edit { } right?
edit({}) = edit {}
 
1:42 PM
Yeah, that's what I'm saying. Lambdas are SAM constructors ... r... right?
 
close but no :D
 
Lambda being an anonymous creation of an object instance ?
 
who's SAM?
 
so yeah the syntax is same
SAM is mechanism that lets you use the lambda when you want to create an instance of anonymous class
since you have only one function/method to override, you can use a lambda instead of a full function signature
so if you have something like
interface Something {
  fun doSomething()
}

you can create an anonymous instance by

object : Something {

}
 
Right
 
1:45 PM
so yeah syntax is the same true
 
So when you have

fun aMethod(anInstance : Something) { anInstance.doSomething }

You can call:

aMethod { println "Do Something Called }
 
well the appointment for tomorrow just got cancelled
 
@Graeme idk but i don t think so
 
When you're calling aMethod are you using a SAM constructor to create Something or are you passing a function reference to an anonymous function implementation ?
 
man i don t get it xD
what is something?
 
1:52 PM
@Graeme ah not really you cant do this
 
u need something to be a lambda or smth
fun isThisRightIvan(block: () -> Unit)
 
Ohh or actually you can
 
can be called isThisRightIvan { print "sure" }
 
@Graeme you can do it like this
see how can you set a click listener in android for example
its doing automatic SAM conversion
 
@grrigore Yup
 
1:55 PM
you got it
 
Anyway
Put a false in there and see if it works XD
 
haha
 
Tim
sorry guys that code doesn't work
 
which one?
 
Tim
graemes
 
1:59 PM
@Graeme this?
 
Tim
yes
 

« first day (3891 days earlier)      last day (1042 days later) »