#dev-general

1 messages · Page 185 of 1

ocean quartz
#

Bungee support sounds ass too but i'll get there xD

distant sun
#

plugin messaging I guess

ocean quartz
#

Clipo open source DChat so i can pr this instead

old wyvern
#

Lol

distant sun
#

So, I use this type of code on multiple places and thought about creating a method, but idk what value to use to create an object on the second map()

                    Stream.of(json.getAsJsonArray("categories"))
                            .map(JsonElement::getAsJsonObject)
                            .map(Category::new)
                            .collect(Collectors.toList())```
quiet depot
#

@distant sun use a type adapter

#

then you can just gson.fromJson(json.getAsJsonArray("categories"), new TypeToken<List<Category>>>(){}.getType());

obtuse gale
#

Does something like the spigot conversation api for jda?

#

( Like an external lib or something?)

ocean quartz
#

What?

obtuse gale
#

Like spigots conversation api but for jda

#

does something like that exist?

ocean quartz
#

Is it like a bot type conversation?

#

not really familiar with the conversation api

obtuse gale
#

idk ive only used the conmversation api like once

#

I think you implement prompt or something

ocean quartz
#

If it's like you ask and a bot (in this case a plugin) responds, then idk exactly for JDA, though I use Dialogflow for something similar

obtuse gale
#

well atm I just have a shit ton fo event waiters

#

its made a thicc arrow

ocean quartz
#

Dialogflow is pretty cool, but requires some setting up which can be pretty annoying

quiet depot
#

dialogflow setup is super trivial

#

it's not annoying at all

obtuse gale
#

how does it work?

ocean quartz
#

On your pc yeah, couldn't manage to set it up on a docker though

quiet depot
#

o

ocean quartz
#

Because of environment variables
Basically AJ you create intents and entities, where you can give it some training sentences and responses, you can create all sorts of communication
I made it so i could ping my bot and order it to do things like set reminders, check news, weather, etc

hot hull
#

What would the field on this be?

 LocalDateTime.now().getLong(<field>)
quiet depot
#

@hot hull what’s the type?

hot hull
#

TemporalField

#

(Just trynna get the current time in a long, open for suggestions on a better way, which there probably is)

quiet depot
#

@hot hull System.currentTimeMillis()?

hot hull
#

smh

quiet depot
#

was there something wrong with that answer?

hot hull
#

No

#

Just annoyed I forgot that existed

onyx loom
#

lol

quiet depot
#

@hot hull oh now that I think of it

distant sun
#

Lol

quiet depot
#

xy problem!!1!1!1

distant sun
#

Nooo

quiet depot
#

u should know better

distant sun
#

@quiet depot I think the typetoken thing worked, ty

quiet depot
#

@distant sun show me ur category class

distant sun
#

I know you can create objects directly using gson#fromJson but idk how to structure the class to match the given json

quiet depot
#

remove that constructor

#

show me the json for a category

distant sun
quiet depot
#

that’s fine, just make sure to set your field naming policy in your gson builder

distant sun
#

wdym that's fine xd

quiet depot
#

the json matches the class fine

heady birch
#

What

#

what is this

#

Why arn't you using spring

distant sun
#

mhm

#

idk how this works tbh xd

quiet depot
#

how what works?

#

the object mapping?

distant sun
#

ye

quiet depot
#

gson checks if there’s a manual type adapter of your object, if there is, the json element is passed to it

#

if there’s not, an instance of your object is constructed via reflection, on a no-arg constructor

distant sun
#

FieldNamingPolicy.LOWER_CASE_WITH_UNDERSCORES this I guess?

quiet depot
#

fields are then retrieved by the field names in the json, and set to the json values

#

yea that policy looks right

distant sun
#

do I create a normal constructor? Constructor(String value) { this.value = value }

quiet depot
#

no, no constructor at all

distant sun
#

non-final fields then?

quiet depot
#

ye

distant sun
#

mhm

fleet garnet
#

damn piggy in here too

distant sun
#

do I have to follow the json names exactly or I can use the @SerializedName annotation if some keys are named weird?

prisma wave
#

Both

distant sun
#

do I have to set gson as annotationProcessor or smth?

lunar cypress
#

No

distant sun
#

it worked just fine 2m ago

#

😢

prisma wave
#

Bruh did you make the Java compiler NPE

#

How

lunar cypress
#

I had this issue too once

#

It's a gradle problem

#

Forgot how I fixed it though

hot hull
#

Seems to always be a gradle problem :kek:

prisma wave
#

Pff

#

The elara build tool would never have these problems

distant sun
#

switched to lang level 8

#
            "user": {
                "ign": "test0",
                "uuid": "45611b2c5d284dfc96f65fa77d2a4f57"
            }```
If I want to use `username` and `uuid`, do i have to set a `@SerializedName(value = "user.ign")` or smth?
quiet depot
#

no

#

you’d have to use a type adapter if you didn’t want to make a user object

jovial warren
#
@Serializable
data class User(
        val ign: String,
        val uuid: String
)
#

ez

quiet depot
#

is that a kotlin annotation?

jovial warren
#

it's kotlinx.serialization

quiet depot
#

ah

jovial warren
#

which is actually the fastest JSON serializer out there afaik

quiet depot
#

gson aint just a json serializer

old wyvern
jovial warren
#

neither is kotlinx.serialization

#

yeah according to this Android benchmark, kotlinx.serialization got 76.22 ms compared with Gson's 78.38, Moshi's 84.32 and Jackson's 615.37

distant sun
#

a whole 2ms, nice

quiet depot
#

that’s not that impressive imo, considering kotlin has more optimization headroom than gson

prisma wave
#

A lot of sources have said that Moshi is fastest

jovial warren
#

it's really idiomatic for Kotlin though

prisma wave
#

and yeah kotlinx isn't a direct equivalent since it's codegen instead of reflection

#

As such it's a lot more verbose

jovial warren
#

that's mainly why I use kotlinx.serialization in Kotlin

quiet depot
#

that makes it really unimpressive then

prisma wave
#

I suppose

quiet depot
#

codegen should be way faster than reflection

jovial warren
#

wdym it's really verbose?

prisma wave
#

you have to explicitly specify the serializer for every field for example

#

Whereas in gson you can just register a type adapter

jovial warren
#

no you don't

distant sun
#

why tf does this class name contains $ $Gson$Types

prisma wave
#

for things that don't use the default serializer

#

You do

jovial warren
#

oh yeah true

quiet depot
#

gaby those are inner classes

jovial warren
#

^

quiet depot
#

i think

lunar cypress
#

Yes

jovial warren
#

or anon classes

#

actually no anon classes are $1, $2, etc.

lunar cypress
#

Anonymous classes are just numbered

distant sun
jovial warren
#

you downloaded sources and documentation and that still exists?

quiet depot
#

oh

jovial warren
#

or whatever Gradle does instead

quiet depot
#

that’s the implementation of the MoreTypes util class gaby

prisma wave
#

iirc that class is named that way so it can't be referenced or something

jovial warren
#

yeah probably

heady birch
#

No jackson is the best

jovial warren
#

it's alright but it's kinda slow

obtuse gale
#

jackson good

jovial warren
#

and Jackson is a bit verbose

#

I mean, it does have a Kotlin module so I guess that's a bonus

#

if I was using Java I'd probably either use Gson or Jackson anyway

#

but since I use Kotlin, I use kotlinx.serialization

obtuse gale
#

ive never used that before

jovial warren
#

it's Kotlin's own first-party serialization library

obtuse gale
#

is it good?

#

Like if ive got a spring project should I still use it or

heady birch
#

No

#

Just use Jackson if your already using spring

jovial warren
#

if you're using Kotlin you should use kotlinx.serialization

obtuse gale
#

is it worth converting from jackson to kotlinx

jovial warren
#

yes

obtuse gale
#

im not serializing anything, only de-serialising as well...

jovial warren
#

still switch to kotlinx.serialization

#

don't listen to Niall, he still thinks that Java > Kotlin

obtuse gale
#

and maven > gradle

jovial warren
#

and that

heady birch
#

Lol. I just think no point converting Java to kotlin. especially when you already completed that project in java

jovial warren
#

what about writing new projects in Kotlin?

prisma wave
#

Moshi is arguably superior to kotlinx

jovial warren
#

^ what are you on

prisma wave
#

In JSON features alone

obtuse gale
#

arent moshis like those shitty things you can get at woolies now for every 20 bucks you spend??

heady birch
#

Like you have probably already setup your serialising using Jackson and spring. And now your gonna change to kotlinx and all your spring integration will probably break. Then you will spend a couple extra days trying to make kotlinx work with spring properly

prisma wave
#

Moshi has more features

jovial warren
#

no it won't

heady birch
#

Then in the end it probably wont even work anyway, you go back to Spring + Jackson. And waste 5 days in the process

jovial warren
#

^ wrong

#

it works very well because I use it in one of my projects

hot hull
#

Y'all needa stop with your weak ass arguments :kek:

jovial warren
#

who?

hot hull
#

The whole lot

#

Let the man use what he wants jesus

obtuse gale
#

serialisation is serialisation.

jovial warren
#

Like you have probably already setup your serialising using Jackson and spring. And now your gonna change to kotlinx and all your spring integration will probably break. Then you will spend a couple extra days trying to make kotlinx work with spring properly
I mean, this is quite a weak argument, especially because it's complete and utter bull shit

prisma wave
#

this is Dev general, personal preference is illegal

jovial warren
#

^

#

there is the best and then the worst

obtuse gale
#

This is the internet, personal preference is illegal

jovial warren
#

not true

heady birch
#

Actually it is a very strong argument

#

My projects have a 100% success rate with spring + jackson

#

I have never used spring + kotlinx so we could assume a 0% success rate

#

spring + gradle 100% success

#

kotlin + gradle 0% succes

jovial warren
#

I've used Spring + kotlinx.serialization and had a 110% success rate

#

kotlin + gradle 0% succes
that's even more crap

heady birch
#

I stand corrected 😮

prisma wave
#

statistics strike again

dusky drum
#

anyone recommends any good vps host?

jovial warren
#

Hetzner

dusky drum
#

cant find vps on there

heady birch
#

OVH

jovial warren
#

it's called "Cloud"

dusky drum
#

oh

#

so its that

#

ok

jovial warren
#

OVH is good but it's a little bit expensive, and requires human verification

dusky drum
#

OVH is expensive

heady birch
#

For vps's?

prisma wave
#

Contabo is the cheapest I know of

dusky drum
#

yes

heady birch
#

No

dusky drum
#

craptabo crap

jovial warren
#

OVH requires you to be 18+

prisma wave
#

Meh

heady birch
#

4/month for a VPS?

dusky drum
#

cant even run jfrog

prisma wave
#

I've never had any problems with it

dusky drum
#

quality

prisma wave
#

Runs nexus, pteroq, and nginx fine

jovial warren
#

I use Hetzner and it's fine

dusky drum
#

contabo is crap thats all im gonna say, probably gonna switch to hetzner

distant sun
#

do you guys use package-info.java?

old wyvern
#

OVH is good but it's a little bit expensive, and requires human verification
Who here is a bot?

jovial warren
#

@distant sun not really

#

@old wyvern I'm not 18

old wyvern
#

Meh

distant sun
#

Who here is a bot?
@old wyvern :))

#

@compact perch

jovial warren
#

you need to send in a photo of your driving license, passport or a bank statement within the last 3 months here in the UK

heady birch
#

Really?

#

Since when

prisma wave
#

imagine not being 16

distant sun
#

^

old wyvern
#

I assume your parents can do that for ya if you arent 18

jovial warren
#

@heady birch since like 2019 some time

dusky drum
#

ha ovh would cost me 84€ per month just for 4 cores and 15gb ram you call that cheap...

jovial warren
#

what are you buying?

heady birch
#

When, when ordering a VPS? or when creating your account?

dusky drum
#

basic general purpose vps

old wyvern
#

:))
@distant sun
Oh god

jovial warren
#

@heady birch ordering a VPS

old wyvern
#

Bot uprising

dusky drum
#

b2-15

heady birch
#

I ordered one the other day

jovial warren
#

lemme see this

dusky drum
#

its 0.1169€ per hour without VAT that is 22% for me.

heady birch
distant sun
#

I thought about using package-info for things like this - to link to tebex documentation

/**
 * @see <a href="https://docs.tebex.io/plugin/endpoints/bans">Tebex Documentation</a>
 */
package me.gabytm.util.tebexsdk.endpoints.bans;```
heady birch
#

26 pound for 8 cores

dusky drum
#

ex. VAT/month

heady birch
#

no thats including

#

or £28.70 incl. VAT/month

jovial warren
#

@dusky drum I'm looking at CX and CPX

#

those are the VPS' you want

#

or CCX

dusky drum
#

you mean at hetzner?

jovial warren
#

yes

heady birch
jovial warren
#

anything else isn't a VPS

dusky drum
#

ye i know

#

where are the cpx?

distant sun
#

I got a good deal from oneprovider 🤷

jovial warren
#

I told you

#

Cloud

#

sign up for an account and go to your cloud console

dusky drum
#

ye but i see only CX

distant sun
#
CPU: Intel Xeon E3-1230 v3 - 3.3 GHz - 4 core(s)
RAM: 32GB - DDR3
HDD: 2x 1TB (HDD SATA)```
jovial warren
#

CPX are in the same place as CX

#

why tf do you even need that Gaby

dusky drum
#

gotta love when you add our 22% VAT

#

when price goes from 15€ to 19€

jovial warren
#

we have to pay 20%

distant sun
#

mc server and was too good to miss it xd

dusky drum
#

how much do you pay monthly?

jovial warren
#

ah okay

distant sun
#

25 eur

dusky drum
#

hm

jovial warren
#

man that's a good deal

distant sun
#

ikr

jovial warren
#

server auction is the place to be on Hetzner if you're looking for a dedi

dusky drum
#

i mean if you have 0% vat you get ryzen 5 3600 64gb ram for 36€

jovial warren
#

I wouldn't buy a dedi though since I don't need one

dusky drum
#

my bad its even 34€

#

cheap

jovial warren
#

that's a really good deal

heady birch
#

How does one properly migrate an existing database to a spring + hibernate

jovial warren
#

^ wat?

heady birch
#

Especially because hibernate uses its own ID generation

jovial warren
#

does it?

heady birch
#

So you cant use the AI field unless hibernate is set to use the IDENTITY generation

jovial warren
#

I swear at the end of the day it just adapts your code to the driver

heady birch
#

Theres a hibernate_sequence table that stores next values

jovial warren
#

that's a bit crap

#

why doesn't it just use the normal generation

heady birch
#

For batch inserting

jovial warren
#

ah okay

heady birch
#

Im not really sure what the standard way of migrating data to a new spring + hibernate database would be

jovial warren
#

I moved away from JPA/Hibernate since you need a no-arg constructor, which was annoying when I have fields that I need

#

I use Exposed's Spring auto-configuration

prisma wave
#

Hibernate good

jovial warren
#

Exposed also good

prisma wave
#

Meh

jovial warren
#

and really fast

prisma wave
#

Too explicit

jovial warren
#

and really idiomatic (I find)

prisma wave
#

I like never having to write queries myself

jovial warren
#

you don't...?

#

that's the whole point of an ORM framework/library

hot hull
#

How intense would it be to have something which loops over a map and compares dates (month to be exact) ?

jovial warren
#

depends on how it's doing it

hot hull
#

(Being called everytime the placeholder get's parsed, so potentially 100times a second)

heady birch
#

😕

jovial warren
#

okay yeah that might be a little intense

hot hull
#

Can't think of a good way to store this smh

prisma wave
#

what's the Map storing

hot hull
#

objects

heady birch
#

Thanks

prisma wave
#

Specifically

hot hull
obtuse gale
#

as opposed to what

heady birch
#

Map<K, V>

prisma wave
#

What is it representing

hot hull
#

Specifically a custom object, representing a players info

heady birch
#

<Date, PlayerInfo> ?

hot hull
#

Nah Niall

jovial warren
#

surely you don't mean java.util.Date there

heady birch
#

Maybe if you told us what the map was?

#

UUID?

prisma wave
#

^

jovial warren
#

java.time.LocalDate > java.util.Date

hot hull
#

Noone cares Bardy.

heady birch
#

java.sql.Date

prisma wave
#

Just say what you're storing

jovial warren
#

ah okay

hot hull
#

Niall, Map<UUID, My Custom Object>
each custom object contains a date which determines when something happened, now I need to display all those objects which have a setting in common, and are from the current month

#

If that makes sense

heady birch
#

Cache it if it doesnt have to be instant

hot hull
#

Oh yea that could work, and then I'd have it update on an interval

prisma wave
#

a Table would give you some lookup in O(1) too

old wyvern
#

How about recreating SQL statements in kotlin with hacky infix functions fingerguns 💀

hot hull
#

Wait lemme see how Glare does it for VP

obtuse gale
jovial warren
#

no?

obtuse gale
#

all pro gamers do

jovial warren
#

all idiots do yeah

#

oof

obtuse gale
#

na

#

I just have . one of my first ever plugins main classes in there....

jovial warren
#

MainJava lol

obtuse gale
#
public class Main extends JavaPlugin {
    
    public static Main plugin;

    public static String color(String string) {
        return ChatColor.translateAlternateColorCodes('&', string);
    }
    ``` ![sad_sunglasses](https://cdn.discordapp.com/emojis/729513482910826537.webp?size=128 "sad_sunglasses")
jovial warren
#

oh my

quiet depot
#

pls

jovial warren
#

public static String color oh god that takes me back

obtuse gale
#

whyd i spell it like that as well

jovial warren
#

reminds me how bad Java is xD

prisma wave
#

jerk

obtuse gale
#

seems copy + pasted lol since thats not how i spell colour

prisma wave
#

ofc it's copy pasted

jovial warren
#
fun String.colourise() = ChatColor.translateAlternateColorCodes('&', this)
obtuse gale
#

:))

dusky drum
#

ah time to switch to hetzner yay.

steel heart
#

Imagine using ChatColor.translateAlternateColorCodes

jovial warren
#

what does one use then

obtuse gale
#

hex

steel heart
#

one?

obtuse gale
#

an individual

dusky drum
#

hex,,, 1.15 doesnt have hex

obtuse gale
#

add a version check in your colour method

steel heart
#

Just copy the method content of the translateAlternateColorCodes

jovial warren
#

how does one not know what "one" refers to in this context lol

steel heart
#

Much better

obtuse gale
steel heart
#

More lines in your code (pro) and less method calls

#

Bruh these emotes

prisma wave
#

real kotlin pros make every function inline for maximum speed

steel heart
#

Lol

obtuse gale
#

tf does inline do

prisma wave
#

inlines the function contents

#

Basically what you just said

#

Copies the contents into the call site

obtuse gale
#

wait is it kinda like a const val

prisma wave
#

yes

#

In that it gets inlined

jovial warren
#

@prisma wave inlining is useless when you don't even use a higher-order function

prisma wave
#

(that's the joke)

#

Also reified type parameters

obtuse gale
#

wait so why not make every function inline

steel heart
old wyvern
#

Theres no use except increased size Aj

prisma wave
#

^

old wyvern
#

🙃

obtuse gale
#

oh is it not better for performance?

prisma wave
#

Unless you have lambdas, it's neglible

old wyvern
#

Not at that point

jovial warren
#

you actually fell for that aj?

old wyvern
#

the call stack isnt that bad

obtuse gale
#

idk lol

prisma wave
#

The main benefits are you can use lambdas without actually instantiating a Function anonymous class, and reified parameters

steel heart
#

Is lambdas faster than anonymous stuff?

prisma wave
#

Other than that the differences is negligible

#

Lambdas are anonymous classes

jovial warren
#

Is lambdas faster than anonymous stuff?
no they're just easier to read

steel heart
#

How negligible?

prisma wave
#

Just with syntax sugar

old wyvern
#

The extra costs in kotlin come more of when it cant infer to auto box sometimes or something

prisma wave
#

Neglible negligible

obtuse gale
#

wait is reified where you do the fancy thing with the generics? I thik i used it once but ive got no clue what it did

prisma wave
#

Yes

obtuse gale
#

where you can do ::class on a generic

prisma wave
#

You can access the class of the parameter at runtime

obtuse gale
#

Oh yeah I made a jda event waiter with that

prisma wave
#

A nice side effect of the inlining process

old wyvern
#

reified means type erasure doesnt exist in the block

prisma wave
#

Well because it's not a real generic

old wyvern
#

How about we move to c# where Generics are baked into code

prisma wave
#

no

obtuse gale
prisma wave
#

Elara on the other hand

old wyvern
#

baked generics > type erasure

#

🍬

prisma wave
#

Well yes

jovial warren
#

regular anon class: ```java
myMethod(new Function<Integer, Integer>() {

@Override
public void apply(Integer number) {
    // do thingys
}

})
java lambda: java
myMethod(whatever -> {
// do thingys
})
kotlin lambda: kotlin
myFunction {
// do thingys
}

prisma wave
#

But JVM > whatever the .NET thing is called

old wyvern
#

xD

#

Not really sure about that

prisma wave
#

Does C# have Clojure? I don't think so

#

Checkmate, liberals

old wyvern
#

and its CLR for c#

jovial warren
#

anyway gtg now

old wyvern
#

.NET is a framework

prisma wave
#

Close enough

old wyvern
#

welp

#

Does C# have Clojure? I don't think so
@prisma wave
😢

prisma wave
#

Am I wrong tho

old wyvern
#

Yes

jovial warren
#

what is .NET again?

prisma wave
#

C# could never

#

.NET is a framework
@old wyvern

old wyvern
#

The real question is: Does C# have Elara? I don't think so

prisma wave
#

Lol

#

Very true

#

I suppose it could

old wyvern
#

YES

#

PLZ

prisma wave
#

But so could Java

old wyvern
#

c# is more of Java but with fancy kotlin stuff

jovial warren
#

C# has some Kotlin features like extension functions but written more like Java

old wyvern
#

xD

#

But messed up naming conventions

#

oof

heady birch
#

_ISayThatAgain

prisma wave
#

C#s naming conventions make me want to die

jovial warren
#

e.g. ```csharp
public void MyMethod(this String whatever) {
// this is an extension method in C#
}

#

or something like that

#

C#s naming conventions make me want to die
same

old wyvern
#

yea bard

heady birch
#

What's the this do?

jovial warren
#

makes it refer to a String object

old wyvern
#

That defined that its a extension

jovial warren
#

you can call that on a String

heady birch
#

Ahhh

jovial warren
#

e.g. String#MyMethod

prisma wave
#
extend String {
    let color => ChatColor.translateAlternateColorCodes('&', this)
}```
#

Best syntax

old wyvern
#

^

jovial warren
#

Kotlin has the same by doing this: ```kotlin
fun String.myFunction() {
// this is a Kotlin extension function, much less boilerplate
}

#

and that makes much more sense than C#'s way

prisma wave
#

Imagine having a fun keyword

#

Couldn't be me

jovial warren
#

oof

#

says the one who's keyword for everything is let

prisma wave
#

Kinda embarrassing ngl

#

Having to define functions differently to normal variables

#

Imagine

jovial warren
#

having to use let

#

imagine

prisma wave
#

Let good

#

All the good languages have let

lunar cypress
#

Imagine not having fn, fun, func and function as aliases

prisma wave
#

Rust, F#

quiet depot
#

oh speaking of which

#

def > let bm

prisma wave
#

maybe not JS

#

:/

jovial warren
#

that's true

#

Pig is right

prisma wave
#

I would beg to differ

quiet depot
#

I really don’t like let

jovial warren
#

fun > function > def > let

#

good heirachy

lunar cypress
#

Clojure has both def and let

old wyvern
#

nah only let shall exist

quiet depot
#

I was referring to the issue I made on elara btw

prisma wave
#

they do different things though

#

Yeah I figured

old wyvern
#

fuck fun

prisma wave
#

I replied if you saw, probably

old wyvern
#

😂

quiet depot
#

yeah, that’s where i got def from

prisma wave
#

thought so

#

I guess we could have an alias

quiet depot
#

eh

#

a complete replacement should be preferred

prisma wave
#

Although I personally think def is ugly

#

Reminds me of python or groovy

quiet depot
#

let is just bad

jovial warren
#

^

prisma wave
#

Rust has let

#

Everyone loves rust

#

so does F#

#

Good languages

jovial warren
#

fun > public Type > function > def > let

old wyvern
#

let feels more right than def

prisma wave
#

what

#

oh

jovial warren
#

actually what am I on about

#

public Type goes last

prisma wave
#

I think let reads more naturally

jovial warren
#

because it's very verbose and unnecessary

#

anyway I'm outta here

#

see ya later suckas

lunar cypress
#

Everyone loves rust
👁️ 👄 👁️

old wyvern
#

also bard, let is for all declarations

prisma wave
#

^

jovial warren
#

yeah I saw

old wyvern
#

Elara has first class functions in a sense

quiet depot
#

I just think it’s the worst of all variable declaration keywords

#

var/val/def are infinitely better

old wyvern
#

def a = 5 sounds wrong

quiet depot
#

all my reasons are in the issue

#

bm I’ll give u a high five if u change elara to not use let

old wyvern
#

🤷‍♂️

onyx loom
#

a high 5 sounds very tempting

lunar cypress
#

let has an academic feel to it

prisma wave
#

that is pretty tempting

#

Ngl

lunar cypress
#

Like the preconditions in a maths exercise

prisma wave
#

indeed

#

Most functional languages have pretty deep roots in mathematics ofc

old wyvern
#

mhm

prisma wave
#

although I won't pretend to know much of that mathematics

#

Type theory scares me

heady birch
#

Somehow I prefer bootstrap 3 over 4 for some applications. Bootstrap for just feels "Big" like the font size

prisma wave
#

Lol

#

Ok

#

Anyway I think Def would read less naturally, and Val / var would make the difference between mutable and immutable less explicit

#

When in FP it should always be explicit

#

they all have positives and negatives ofc but I think in this case let is the best option

#

what we could do is add def which has different semantics to let

#

In Scala def makes something in the class scope (I believe) rather than in a function one

steel heart
#

you will end up with having all of them lol

prisma wave
#

Well hopefully not

hot hull
quiet depot
#

it is indeed

#

@hot hull you need to increase your wait & interactive timeout on the mysql server, or lower the timeout on your connection pool to be in the bounds of the server timeout

hot hull
#

They should be all set to no timeout iirc

quiet depot
#

the connection pool?

#

because that's definitely not what you want

hot hull
#

I mean for the first two

quiet depot
#

erm

#

pretty sure you can't simply not have a timeout

hot hull
#

Well says that for default so idk GWcmeisterPeepoShrug

quiet depot
#

default timeout in mysql is like a day

#

8 hours

hot hull
#

UUIDs are 36 right?

prisma wave
#

yup

#

i think so

distant sun
#

36 with dashes, 32 without dashes

#

@quiet depot creating objects using gson it's much easier than doing it manually 🤣

quiet depot
#

yep

distant sun
#

time to contact tebex for more info about their api responses

#

should I make one class Sale and then inner classes for effective and discount or external classes?

#

actually, I might make only the Type enums as inner class

quiet depot
#

wat

distant sun
#

ofc I forgot to send the url

quiet depot
#

inner or external

#

honestly doesn't matter

distant sun
#

external looks much more cleaner than a 200 lines long class

quiet depot
#

yea

distant sun
#

and 12 spaces indent for the Type enum xd

quiet depot
#

you'll need a type adapter for your enum btw

distant sun
#

time to find out what that is

quiet depot
#

it's super simple

#

are you deserializing, or serializing and deserializing?

distant sun
#

deserialize

obtuse gale
#

jetbrains datagrip makes me want a touchscreen monitor for some reason

#

idk why

quiet depot
#

create a class, TypeDeserializer, or something like that

hot hull
#

So I've got a slight debate, let's say I'm updating DB info, should I just clear the entire table and set the new data from the map, or should I store some kind of removal data, which get's removed, and the map data updated in the DB

distant sun
#

and?

quiet depot
#
public final class TypeDeserializer implements JsonDeserializer<Type> {
    @Override
    public Type somethingICantRemember(JsonElement json, java.lang.reflect.Type typeOfT, JsonDeserializationContext context) {
        return Type.valueOf(json.getAsString().toUpperCase());
    }
}```
#

might be worth thinking of a different name for your enum

#

cuz Type conflicts with the reflection api

#

then on the field

#
@JsonAdapter(TypeDeserializer.class) private Type type;```
#

or you can register the type adapter in the gson builder

distant sun
#

Aight, XObjectType

quiet depot
#

yikes

#

no

hot hull
#

:kek:

distant sun
#

I mean, DiscountType

quiet depot
#

sure

distant sun
#

I really enjoy this random project tbh

obtuse gale
#

DeluxeMenus

#

DeluxeMenus

#

DeluxeMenus Dev?

quiet depot
#

this is a general development talk channel, if you wish to discuss an assumed development process of deluxemenus, you're more than welcome to

distant sun
#

I guess it's better to let the end user take care of caching, right?

#

Less work and I dont feel like doing it xd

prisma wave
#

DeluxeMenus

frail glade
#

What

#

Do you want

obtuse gale
#

Can I make intellij like reload all my classes or something? I removed a field from a data class and intellij hasnt like 'updated' so its not showing any errors.....

#

oh wait...

#

I can just try compiling

#

im dumb lol

prisma wave
#

hotswapping is a bit temperamental

#

lol

obtuse gale
#

can I truncate all my SQL tables except a few in a db?

frail glade
#

Oh gosh, there was actually an NMS numbers change from 1.16.1 to 1.16.2, that's definitely going to break everything again.

hot hull
#

Oh hi Aj, you getting annoyed by sql as well? fingerguns

obtuse gale
#

mhm

hot hull
#

Isn't it nice

obtuse gale
#

I left a project for a few months and now im confused af

#

using spring tho so :))

hot hull
#

Ah yes, non doccumented code I'm guessing

obtuse gale
#

na I actually did a suprisingly good job documenting it

#

I know what it does

#

its just the way it does it is questionable

prisma wave
#

👀

distant sun
#

Me neither

obtuse gale
#

Should I not touch this? I didnt make it....

prisma wave
#

yeah don't touch it

heady birch
#

yeah change the numbers in the next_val column

obtuse gale
#

excuse me

#

org.hibernate.tool.schema.spi.CommandAcceptanceException: Error executing DDL "alter table request add column desc varchar(255)" via JDBC Statement

#

wTf

heady birch
#

Probably kotlin issue

obtuse gale
#

i mean

#

at org.aj3douglas.coolbot420.MainKt.main(Main.kt:19) ~[main/:na]

#

My main class is literally 13 lines

#

idk why I have it as an open class either

#

Caused by: java.sql.SQLSyntaxErrorException: You have an error in your SQL syntax;REEEE

heady birch
#

That error will usually have more to it

obtuse gale
#

oh right

heady birch
#

DESC is a keyword

obtuse gale
#

oh

#

welp

heady birch
#

Call it description lol

hot hull
obtuse gale
#

ew

#

That themes different.....

#

Not saying its bad, just different

prisma wave
#

too different

distant sun
#

Ew frosty

hot hull
#

bruh

obtuse gale
distant sun
#

Switch to light theme

obtuse gale
#

imagine having unused variables tho

hot hull
#

Boutta yeet myself

obtuse gale
distant sun
#

Aj you dont use atom icons?

obtuse gale
#

is that the thing that changes the class icons?

distant sun
#

Ig

obtuse gale
#

those are what my classes look like

distant sun
#

Open installed plugins tab

obtuse gale
hot hull
obtuse gale
#

aalright

#

ah

distant sun
#

@ocean quartz make a plugin that does the same thing Minecraft Development Plugin does for @EventHandler

obtuse gale
hot hull
#

If I try to invoke getUniqueId() on a null player, will it throw an NPE, or just return null?

ocean quartz
#

Sounds easy enough

distant sun
#

Npe lol

prisma wave
#

NPE?

ocean quartz
#

Sin

distant sun
#

Go back under your rock Matt

ocean quartz
#

ouch
Aight

distant sun
#

@quiet depot why does everyone play MS Flight Simulator?

#

Seems boring as you just .. fly

obtuse gale
#

its kidna interesting

quiet depot
#

why does everyone breathe?

#

seems boring as you just .. breathe

obtuse gale
#

its a requirement...

distant sun
static zealot
#

xD

ocean quartz
#

Breathing is pretty boring tbh

obtuse gale
#

plus if youre ever in the case where you need to take over a passenger plane and safely land it youre all good

distant sun
#

Yea, sure

obtuse gale
#

pretty educational

distant sun
#

"What is the key bind to turn left??"

obtuse gale
#

4 on the num pad

#

🙂

distant sun
#

"Bruh this sensitivity sucks"

ocean quartz
#

Just hack the plane to control it with a keyboard ez

old wyvern
#

plus if youre ever in the case where you need to take over a passenger plane and safely land it youre all good
@obtuse gale
"Does anybody know how to fly a plane? Both the pilots have succumbed to sudden heart failure"
"Oh yes, I have 15 years worth of Flight Simulator experience"
"OMG come on in then"

obtuse gale
#

better than nothing

distant sun
#

Because you, as a normal person, carry a keyboard with you :))

ocean quartz
#

For real though flight simulator sounds fun

distant sun
#

Lmao @old wyvern

obtuse gale
#

I hate how you cant crash in the flight sim tho, it just fades to black

ocean quartz
#

It's like the truck simulator

#

People love to just drive for a while nonstop

old wyvern
#

true

hot hull
#

So I've got a slight debate, let's say I'm updating DB info, should I just clear the entire table and set the new data from the map, or should I store some kind of removal data, which get's removed, and the map data updated in the DB
@hot hull

old wyvern
#

I remember at some point I was googling for flight sim games a lot for some reason

#

but my old laptop couldnt run it

#

welp

distant sun
#

$60??

obtuse gale
#

for what

distant sun
#

Ms fs

obtuse gale
#

Just get the xbox game pass

#

$1

distant sun
#

I cant :((

static zealot
#

not in RO ...

obtuse gale
#

o

#

rip

ocean quartz
#

Discrimination

distant sun
#

Only 4 perks are available here

hot hull
#

smh ;((

obtuse gale
#

just get someone in america to do it or sometihng

distant sun
#

And they are all games

static zealot
#

xD

distant sun
#

Yes, ez pz

static zealot
#

Making a debugger for my plugin was easier than I thought.

ocean quartz
#

Is it just me or gravity is stronger when you're in bed

obtuse gale
#

Is it just me or does toast coming out of the toaster have less gravity

static zealot
#

is it just me or not?

obtuse gale
#
                            var user = userRepo.findByDiscordUserId(member.id)
                            if (user == null) {
                                user = User(discordUserId = member.id)
                                userRepo.save(user)
                            }``` is there a way I can do something fancy with the elvis operator or something so  user isnt a var?
old wyvern
#

Gravity feels the strongest when you have that weird falling feeling just at the point when you are about to fall asleep

prisma wave
#
val user = blah ?: userRepo.save(User(blah))
``` @obtuse gale
obtuse gale
#

o

prisma wave
#

you should be using the result of save rather than the user you instantiate

obtuse gale
#

ah ok

prisma wave
#

if not you could've used run in the elvis

#

or apply

obtuse gale
#

alright good to know, thanks

heady birch
#

They would be the same user

jovial warren
#

@distant sun flying is actually good fun sometimes

obtuse gale
#

They would be the same user
what?

#

If one doesnt exist I want it to make a new one

#

userRepo returns null if one doesnt exist

jovial warren
#

yeah wat

#

save will return the instance that you just created

obtuse gale
#

which si what I want

#

Can I specify multiple sql queries in one like thing?

jovial warren
#

wat?

obtuse gale
#

Can I do like

TRUNCATE TABLE one;
TRUNCATE TABLE two;``` then only press send once
#

just for conveniences sake, just wondering

distant sun
obtuse gale
#

?bins smh

#

?bins

#

?bin

old wyvern
#

=paste

obtuse gale
#

barry you there?

distant sun
#

shut up

old wyvern
#

lol

obtuse gale
#

barrys dead

static zealot
#

?bins

old wyvern
#

?paste

distant sun
#

?paste

obtuse gale
#

?help

static zealot
#

xD

old wyvern
#

...

distant sun
#

?ping

#

=ping

static zealot
#

=help

obtuse gale
#

gary got to him

distant sun
#

@quiet depot reboot?

quiet depot
#

damnit

#

was hoping I wouldn't get tagged

distant sun
#

:))

quiet depot
#

was about to go to bed, then saw this convo take place

distant sun
#

poor you, having to run =reboot -y

obtuse gale
#

barrys down will that even work tho

quiet depot
#

nah vps is ded

distant sun
#

F

prisma wave
#

They would be the same user
@heady birch won't save() sometimes return a different instance?

heady birch
#

Idk

prisma wave
#

pretty sure i heard that somewhere

#

something to do with IDs

distant sun
#

is there no prettier alternative to new TypeToken<List<Sale>>(){}.getType();?

quiet depot
#

i mean

#

there is

#

2 secs

jovial warren
#

save should always return either the instance of the existing user or the instance of the created user

#

or at least, that's the intuitive assumption

obtuse gale
#

If spring could fuck off and stop telling me something doesnt exist thatd be great.... Like.... I never asked for it to check if that existed

jovial warren
#

it's telling you it doesn't exist because some people might need that reminder

quiet depot
#

idk about gson/guava tho

jovial warren
#

Spring has one even better

obtuse gale
#

well it can fuck off with the stacktrace please

jovial warren
#

in Spring you can just dependency inject a Set<Superclass> and it'll inject all components that are a subclass of that Superclass

quiet depot
#

this is for object mapping

distant sun
#

one question @quiet depot. At first I didn't know I will have to create a custom Gson to register stuff so I made the methods for endpoints static and accept a gson parameter. Should I somehow make them private and accessible through TebexAPI class?

quiet depot
#

nothing todo with di or classpath scanning

jovial warren
#

object mapping?

quiet depot
#

ye

jovial warren
#

wat dis

quiet depot
#

like gson

jovial warren
#

ah okay

distant sun
obtuse gale
#

HAHAHAHAHAHA

2020-09-06 00:35:21.217 ERROR 13688 --- [inWS-ReadThread] net.dv8tion.jda.api.JDA                  : One of the EventListeners had an uncaught exception

java.lang.StackOverflowError: null``` :
#

😦

jovial warren
#

oof

quiet depot
#

erm yeah just store gson as a constant gaby

old wyvern
#

Recursion?

jovial warren
#

StackOverflowError usually occurs when you use recursion wrongly

obtuse gale
#

mm

hot hull
#

So I've got a slight debate, let's say I'm updating DB info, should I just clear the entire table and set the new data from the map, or should I store some kind of removal data, which get's removed, and the map data updated in the DB
GWsetmyxPeepoSad

prisma wave
#

elara would never have this problem

obtuse gale
#

I think I know what it is

#

I think springs being funky, pretty sure this has happened before

prisma wave
#

literally impossible

old wyvern
#

wdym bm?

quiet depot
#

latter option frosty

#

don't delete everything

heady birch
#

Looking for a way to sort of intercept the model resolving in spring (can probably make my own model resolver) that accesses the session to determine the theme the user has set and change the template folder location based on that when the

prisma wave
#

stackoverflow and null

#

impossible

#

we will remove stack overflow

#

make the stack infinite

#

ez

hot hull
#

Okay thank you

old wyvern
#

Isnt having stack overflow better than using linked list stack for this case?

obtuse gale
#

so

heady birch
#

@obtuse gale Probably json serialization

obtuse gale
#

spring doesnt like one to one relationships in the constructor for some reason

heady birch
#

If you have things it can end up like this

obtuse gale
#

idk why

#

but thats what caused it

#

moving it into the class body fixed it

quiet depot
#

@distant sun nothing wrong with keeping it as an internal util class imo, but ye, gson can be stored as a constant

obtuse gale
#

its fine with one to many and many to one

heady birch
#

I think all models are meant to be mutable

obtuse gale
#

just doesnt like one to oen

heady birch
#

Also it needs a zero arg constuctor

#

public Class {}

distant sun
#

thoughts about keeping the methods static?

old wyvern
#

Is it still a method if its static tho

prisma wave
#

technically not

jovial warren
#

wdym no?

quiet depot
#

java's nomenclature doesn't differentiate between methods & functions

#

but

#

mine does

old wyvern
#

mhm

distant sun
#

( ? )

quiet depot
#

idk gaby

old wyvern
#

method = function thats member of a class

#

function = well all top level + methods kinda

distant sun
#

the only issue atm is that the methods require a gson that have stuff registered

#
        this.gson = new GsonBuilder()
                .setFieldNamingPolicy(FieldNamingPolicy.LOWER_CASE_WITH_UNDERSCORES)
                .registerTypeAdapter(new TypeToken<Discount.DiscountType>(){}.getType(), new Discount.DiscountTypeDeserializer())
                .registerTypeAdapter(new TypeToken<Effective.EffectiveType>(){}.getType(), new Effective.EffectiveTypeDeserializer())
                .create();```
quiet depot
#

??

prisma wave
#

the question is, is a side effects only function still a function?

obtuse gale
#

why are the service channels locked piggy?

quiet depot
#

cuz bazza ded

obtuse gale
#

ah

old wyvern
#

Barry rip?

jovial warren
#

technically, in Computer Science, a function is a set of instructions that return a value

quiet depot
#
private static final Gson GSON = new GsonBuilder()
                .setFieldNamingPolicy(FieldNamingPolicy.LOWER_CASE_WITH_UNDERSCORES)
                .registerTypeAdapter(new TypeToken<Discount.DiscountType>(){}.getType(), new Discount.DiscountTypeDeserializer())
                .registerTypeAdapter(new TypeToken<Effective.EffectiveType>(){}.getType(), new Effective.EffectiveTypeDeserializer())
                .create();```
distant sun
#

mhm ok

prisma wave
#

afaik a function is usually classified as a transformation of input and output

jovial warren
#

^ yeah

quiet depot
#

I wouldn't expect computer science to define a function

jovial warren
#

differing from a procedure, which is supposed to return nothing

quiet depot
#

computer science would define a program, but a function is strictly programming related

old wyvern
#

technically, in Computer Science, a function is a set of instructions that return a value
Yes as I said, methods come under functions
i.e, all methods are functions but all functions are not methods

quiet depot
#

(or math but again, still not cs)

jovial warren
#

falls under computational thinking

old wyvern
#

methods are those functions which are associated with a Object

#

In Java, mostly all in that sense

quiet depot
#

@hot hull in rpf, I have a compare method that I can extend from my Table superclass, which I use for updating shit

jovial warren
#

yeah apparently a "function" is "a named section of a program that performs a specific task"
and it also mentions that "Some programming languages make distinction between a function, which returns a value, and a procedure, which performs some operation but does not return a value"

(Source: https://www.webopedia.com/TERM/F/function.html)

distant sun
#

I mean, people shouldn't have a reason to use anything else than the TebexAPI class to access endpoints so I should be good with accessing the gson instance through a static getter TebexAPI.getGson()

old wyvern
#

ok? and?

hot hull
#

Well I mean the way I have it setup right now is pretty extendable I think, could be better, but I doubt anything more could even be added

old wyvern
#

thats still the same def of a function

old wyvern
#

pls no judge
fingerguns

obtuse gale
#

its always important to stay professional and discriptive whilst debugging your code

jovial warren
#

ObjectMapper<Map<String, Object>, T> is that a Gson thing?

obtuse gale
quiet depot
#

no

prisma wave
#

ObjectMapper is Jackson no?

quiet depot
#

no it's rpf

prisma wave
#

oh

#

haven't seen code

quiet depot
#

i mean jackson might have it too

jovial warren
#

why does ObjectMapper take a Map as its first type param?

heady birch
#

Jackson has one as well

quiet depot
#

because map is a very versatile data structure

#

in this case, it suits mysql data

jovial warren
#

wait why is RowCreator.Builder used in this class?

prisma wave
#

Fun fact: in clojure you use maps for pretty much everything instead of specific types

quiet depot
#

because if cached data needs to be saved to the db, rows probably need to be created

jovial warren
#

wait why are any builders that aren't Table's Builder (if it has one) used in here?

quiet depot
#

table is an abstract class

jovial warren
#

true I guess

#

also does this framework do DI or do you leave that up to say Koin or Guice

quiet depot
#

guice

jovial warren
#

specifically Guice?

quiet depot
#

yes

jovial warren
#

like only works with Guice?

quiet depot
#

yes

prisma wave
#

guice is super versatile

old wyvern
#

Spigot has guice shaded

jovial warren
#

that's a bit eh though

quiet depot
#

no it doesn't yugi

old wyvern
#

Oh?

jovial warren
#

it has Guava shaded

prisma wave
#

It has guava shaded

old wyvern
#

Ah

#

Nvm then

quiet depot
#

sponge has guice shaded

#

just another thing sponge got right

old wyvern
#

I see

jovial warren
#

I really wanna make my own DI framework, idk why

#

but I ain't big brain enough for that yet

quiet depot
#

although they could've used guice way more in their api, their usage is wasteful imo

prisma wave
#

it's probably easier than you think

#

DI frameworks are pretty much glorified reflection

jovial warren
#

yeah

prisma wave
#

unless it's Guice which uses classgen iirc

hot hull
quiet depot
#

and in the case of guice, code generation

prisma wave
#

yup

jovial warren
#

I mean, the easiest way is probably just to do a Spring and take control of instantiation

prisma wave
#

all DI frameworks do that

jovial warren
#

do they?

quiet depot
#

@old wyvern rpf is pretty tightly coupled to the semantics of guice

prisma wave
#

it's kind of the point

quiet depot
#

guice's versatility doesn't allow it to separate from rpf in this case

prisma wave
#

if you're doing constructor injection it has to control instances

old wyvern
#

I see

#

How much would shading rpf add?

quiet depot
#

depends what platform you're on

#

and btw, I cannot in good faith, advocate using rpf

#

it's not production ready

old wyvern
#

Ah

prisma wave
#

is anything really production ready?

old wyvern
#

😂

quiet depot
#

rpf is really, really not production ready though

prisma wave
#

that's part of the fun

old wyvern
#

I might try rpf just for fun maybe

quiet depot
#

I don't even think it works atm

jovial warren
#

nothing is "production ready"

old wyvern
#

Oh rip

prisma wave
#

😦

heady birch
#

Yes spring is

quiet depot
#

rpf is in a hiatus till papi 3 is done anyway

#

or till whenever the fuck I feel like working on it again

old wyvern
#

😂

jovial warren
#

no matter how much effort and time you put in to those sorts of things, there's always bugs littered everywhere

prisma wave
#

speak for yourself

old wyvern
#

How long has rpf been in dev?

prisma wave
#

PDM is officially bug-free

quiet depot
#

idk like a year

old wyvern
#

Are you sure?

quiet depot
#

no

old wyvern
#

I remember seeing it on forums a lot earlier tho

#

Like in your signature

quiet depot
#

tbh to some degree, I'm still working on rpf in papi 3

#

like I could easily copy over all the work I've done

#

which I definitely will in the future

old wyvern
#

Nice

obtuse gale
#

PDM is officially bug-free
Doubt

quiet depot
#

I really want to work on the enterprise stuff in rpf again though

#

mc is too hard

old wyvern
#

Speaking of which I really should continue working on my ORM at some point 😂

prisma wave
#

:Doubt:
@obtuse gale it's close enough

old wyvern
#

At this point I feel like its been like 5 months since I touched it

quiet depot
#

my database api is funky

#

it's got like 3 layers

#

raw > procedural > orm

#

@prisma wave the stream api is an example of procedural coding right?

#

or am I thinking of a different paradigm

prisma wave
#

streams are functional

quiet depot
#

ah functional

#

ok

#

raw > functional > orm

heady birch
#

How many lines is RPF

jovial warren
#

ORM better

quiet depot
#

like 30k

#

no bardy I mean those are the layers

#

raw -> functional -> orm

prisma wave
#

lmao

jovial warren
#

ah okay

#

does it have support for Kotlin users yet? or is it very Java-ified

prisma wave
#

interop is a thing

#

lol

quiet depot
#

java

#

like we got this fat util class, that you can do pretty much anything in, but it's ugly, this is the raw api

#

again pls no code judge