#dev-general
1 messages ยท Page 95 of 1
Java loses here ,-,
any rules for shortest mode?
Ill join in later
Nah, just do what you want
"non-decreasing"
have to finish a project
Isnt non-decreasing increasing lol
this is kinda like the one i failed last night as well lol
yes
I'll join soon
In the car rn
@topaz bay there's some ambiguity there. What would happen if Object had 2 methods that returned String?
I thought of that too, but I'm speaking purely theoretical
Theoretically it sounds cool
It would still be possible to use reference syntax
But could also be a gimmick
Well everything high level is gimmicky
True
I think you could take some elements of that and it would be nice, but at the moment there's way too much ambiguity to be practical
It's like type coercion on steroids
I would say its more like type inference on steroids
Somewhat
Its technically the same logic as any 0 param, void function being compatible with being passed as Runnable
That's fine though because it's more explicit what you're doing
Damn I beat python
Function<Object, String> is very vague as to what the function actually entails
I've just been beaten by Kotlin
oh god
Ha
Does util not contain Collectors lmao?
i know ive done this a really weird waty
probably because I can't code for the life of me
I think I have an unhealthy obsession with lists
Collectors are java.util.stream I thought
@prisma wave well its a function that takes in an object, and returns a string
Well yes
oof
But there's no saying what the function actually is
The notation would technically be Function<T, String>
@jovial warren smh we said no py for shortest -.-
idm
lol compare mine to matts tho
Well thats the same without this system no?
Well not exactly
Aj wtf is this e.forEach a@{
It doesnt really matter what it entails, the contract is that it takes some type, and outputs a string
Object::toString is clearer than pulling a Function out of nowhere
Java loses like half solely on the imports
:))
Burn
It's fast and the type system actually works really well on the shortest ones
yup
Also why yall using contains("+")?
does java like when you ask it to split on a char that doesn't exist?
If the character is not present it only adds the string to the first index of the list/array
hmm
||print("+".join(sorted(input().split("+"))))|| that might actually work idk ๐ค
yeah that should work
;c
that's what I should've done
show code
and it's 43 characters
brb
oh and that code works as well
Join Bardy
I have
no clue how to do this lol
Imma lose
This one is pretty hard to make small
yeah
i dont even know how to make it big lol
What?
imma fail
Y'all good?
trying to compact this
trying to make this work lol
This one is awful
- 1
dont i just need to completely ingnore that first int?
actually dont worry lol
this works
2:30 left
i feel ive done mine a weird way again lol
bruh
i messed my thing up
it worked for the tests lol
then i changed something and didnt double check
72 chars will have to do
rip
I swear if I get beaten by Kotlin again
lol
Matt, you could've gotten way more if you made a 1 liner :p
I took 100 chars of with cramming it into 1 lin e
nah 1-liners don't matter
line*
Can't do that
brb
it counts chars not lines
Plus \n doesn't count
and \n doesn't count yeah
I had a shorter version but didn't manage to get it to accept it
readLine()
val c = readLine()!!.toCharArray()
val p = readLine()!!.split(" ").map { it.toInt() }.forEach { print(c[it]) }
forEach returns null doesn't it?
It was incomplete
It returns Unit
It'd return unit
it's void sorry my bad
void, not null
but better
Void means it returns nothing
Null is a lack of value
Unit is Void but with a value
Which has some benefits
And don't get me started on Nothing
That's black magic
elucidate
uses for Unit are: being able to set it as the value of an expression body for a method you don't want to implement
for methods that you actually don't need but need to be implemented anyway
lol what the fuck
@onyx loom you wish to learn the black magic of Nothing?
Gladly
Nothing represents a function that will never return
So for example ```kotlin
fun nothing() {
throw Exception()
}
This function returns Nothing
And Nothing can be any value
lol ive got no clue on this one btw
for example ```kotlin
val x: Int = nothing()
This compiles fine, as Nothing is a sub type of every type
you mean supertype?
look its safe to say i wont be able to do this lol
in python you literally just substring it and convert it to hex
||t = input()[2:] followed by print(hex(int(t, 2)))||
Is it not this? Integer.toHexString
might work
It don't tho
its not an int in the first place tho
you can convert a base 2 int to base 10 with ||Integer.parseInt(binarystring, base)||
then you might be able to print that to hex using that method you mentioned frosty
||System.out.println(Integer.parseInt(Scanner.next(), 2).toHexString())|| might work?
idk
actually no because you need to prefix it with 0x, though you would've thought it would do that itself
You'll need to remove the 0b from the binary as well
yeah that's easy, just substring it
basically convert 0b1101 to 0xwhateverthefuckitisinhex
Binary to hex bm
Mine
||```Kotlin
fun main(args : Array<String>) {
val input = Scanner(System.in)
val T = input.nextLine().replace("0b", "")
println("0x"+Integer.toHexString(Integer.parseInt(T, 2)))
}
in python that's just:
t = input()[2:]
print(hex(int(t, 2)))
Iirc my solution was just a substring, parse in binary, "0x"+toString(16)
Seems fairly simple
yeah python has some really simple methods, like being able to parse strings to integers and specify the base
and the built-in hex() method
yeah but no where nearly as compact as python does it
python is useful for things like this
Like what?
because it's easy to write, super compact and kinda lightweight, and runs quite fast
you need to prefix it with 0x @hot hull
||"0x" + Integer.parseInt(Scanner.next(), 2).toHexString()||?
hmm...
Ahem?
"0x" + Integer.toHexString(Integer.parseInt(Scanner.next(), 2)) looks about right
no idea how it parses things
you did remove the 0b at the beginning right?
Jesus this was dumb, and ye I did
it was a bit annoying yeah
t = input()[2:]
print(hex(int(t, 2)))
that was it in Python @hot hull lol
I'll pass on this one, will play again later
gotta do smthn quickly
ew regex
show code then
nuh, mine is ugly af
is it the one that the output have to be (###) ### ####?
(###) ###-####
I just used substring :))
should've probably used a regex
Could've, but ah
or substring I guess, that works too
guess substring also work
Regex101 allows you to create, debug, test and have your expressions explained for PHP, PCRE, Python, Golang and JavaScript. The website also features a community where you can share useful expressions.
go there to test regexes
yeah
when you find out https://github.com/SourceBin/SourceBin is open-source, but you realise that it uses npm and nginx :/
oh and it uses mongodb
and docker
npm+nginx+mongodb+docker sounds like my worst nightmare
should probably just write my own
:))
Docker is good
hey km
docker is annoying as fuck
nah
I gotta work on writing my own pastebin software
Alrighty
Yay
i gotta reinstall my OS at some point
turns out it's been on my hard drive this whole time
so my SSD has been useless
@prisma wave perfect time to switch to arch
wait what
does this do what I think it does
yes
if you wanna reinstall try a linux distro
no
why not?
windows for life im sorry bardy
wtf is going on in this oneIts simpler than it looks tbh dont overanalyze it
||check output for odd/even||
xD
@jovial warren regarding arch, what is the sitation regarding things like KDE? I am considering switching but I find things like KDE Connect useful. Are these usable on Arch (without a desktop environment)?
idfk anymore
where did everyone go lol
yo
yo
oy
looks just like him
Yes. Don't mind about doors and windows, paint them all!
@prisma wave you can fully install KDE on arch if you want, but most tools like what (idk what it does) are usually available through another third-party program
bad
what did I fuck up this time? oof
50 :))
@jovial warren hm alright. I quite like the KDE software so ideally will still use it. I guess i'll try i3 and if I really dislike it I'll install a proper DE
(Q*5/totalVol > 0)That should be the same as Q*5 >=totalVal
I did smh
I did all the tests
Sorry I had to submit lmao
oh lol
it passed all
2 of them failed xd
im confused
bad website
Just to get that 100 75 50 25
nah
:))
aha
cmon b1tch3s
let's gooo
nah fuck shortest mode
Python not allowed right?
no ๐ฆ
nope
alrighty
oof 285
ye gtg
ok cya
maybe Iโll join later tonight
So will I in order to distract myself from learning UML
I't snot
@frail glade you got access to papi github?
dadi
Never heard of it
lol
https://img.bristermitten.me/18-03-58-2020.jpg @errant geyser progress report: I've made a little node app that can deep fry images. next it's time to make a client for it
I didn't expect this level of dedication
You're*
Shut up Frosty
:))
I'm very dedicated to procrastinating
Fros tea*
Just cos you aren't as cool as KM ๐
nobody is as cool as KM ๐
dun*
hmmm
I'm coolerYou're frozen
good point ^
BM when you get around to selecting the, cough, entertainment ima need some samples
The entertainment?
plays the loudest earrape possible
I'm willing to sacrifice my ears to the cause
statistics:
- 'stat.playOneMinute'
- 'stat.playerKills'
- 'stat.deaths'
- 'stat.useItem.minecraft.reeds'
- 'stat.killEntity.Blaze'
@old wyvern I need a better system for this ,-,
Just got the ones I'm actually displaying rn
someone find me a stupid autocomplete that just works
looping through the above, which is the stats' paths
Kite
Niall, autocomplete for?
@hot hull
Check out Statistic#getType()
It returns one of these
UNTYPED
ITEM
BLOCK
ENTITY```
Everything other than ``UNTYPED`` takes in an argument.
course it didnt work
Is this what you are looking for @heady birch ? https://github.com/brhndursun/Bootstrap-Autocomplete-for-Notepad
WHAT
?
oh I misunderstood you
How do I make a GUI command, like /shop?
nice
The annotation parameter is a String[] of required classes
Which the hooks manager just checks with Class.forName
still waiting for kotlin meme to get pinned ๐
What meme
Yes I do not agree
I cant agree either
ur lying
https://www.youtube.com/watch?v=c4BLVznuWnU
The comments ๐
๐
Tickets for the Divide tour here - http://www.edsheeran.com/tour
Official music video for Ed Sheeran's 'Lego House', featuring Rupert Grint from Harry Potter (Ron Weasley). Go behind the scenes of the video shoot here: http://youtu.be/Px6nTLFD6do
Subscribe to Ed's channel: h...
LOL
lol
yuck
it is not readable and it is ugly and thats a fact
That second one is fucking godly lmao
which?
@lunar cypress did you make that yourself lol
yeah
Ah yeah
It seemed very specific
@topaz bay
Your point about infix being natural is now invalid
what?
Where are you hosting it?
hetzner @old wyvern
I also set the max key length to 4 as you can see to keep the URL short
though I probably need to increase it
Has anyone ever made a music bot with discord.py?
https://bin.bardy.me/XUv6.js โฅ๏ธ
A simple music bot written using discord.py rewrite and youtube_dl. - music_bot_example.py
Thx
@prisma wave get out xD
you dare
yeah i will too
?js-factionname
Send a different message if the player is factionless
function factionName() {
var name = "%factions_faction%"; // Replace with the placeholder of your factions plugin
return name == "" ? "" : name + " ";
}
factionName();```
i believe ur bin service could be filled up with this too
ooh
some lovely PAPI
also, it's rate limited to like 500 connections every 60 seconds or so I think
time to up that
won't take long to fill them all up
hehe
what characters are allowed for a key?
a-z 0-9
You can remove saved ones right?
afaik
yes I think
well, I definitely can since they're stored on my redis database
yeah gl with that
okay
rate limit increased to 500 connections every 6000 seconds
owo
...
to prevent BM from filling it up
Imagine being so hurt about prefix notation that you make that
I could increase it to say 5000 connections ๐ค
1000 connections every 6000 seconds
I will brute force it at some point
lmao
And get a vps
it'll take you ages but sure
I mean we can keep it to not work
I can increase the key length you know that right
Even so
It will be a remarkable achievement
lets test that
I'll dig it up
// Rate limit all requests
if (config.rateLimits) {
config.rateLimits.end = true;
app.use(connect_rate_limit(config.rateLimits));
}
that's the code for it if that helps anyone bypass it lol
what if we just keep it at ratelimit always?
what?
500 connections every 6000 seconds
it's 1000 connections now
also, looks like it uses connect-ratelimit for rate limiting
not sure if this will work tbh
@jovial warren its down?
shouldn't be?
ik why
we crashed the site
caddy failed to start because I forgot to generate an SSL cert for a new CNAME record I didn't add
lets gooooo
please don't get rate limited by let's encrypt
why?
I've been rate limited for requesting too many certs
this is what happens when you don't gen your cert and add your cname before starting your web server
Rip
it's fine
I can still start it
just without the config for i.bardy.me, which is gonna be for my image server, though I should probably just use img.bardy.me now
it's back up now
its still dead
what works?
the image thingy
it's just serving images over HTTPS
and I'm using rsync to upload them via SFTP
Image servers ez
yeah no idea
lemme look at that lol
that should be %used / %total but it obviously isn't
%used / %available that might explain it
Some witchcraft
frosty just mad cus ur using more ram than hes allowed 
lol

time to refer to our very advanced documentation: https://i3wm.org/i3status/manpage.html

wew
now, I should probably get to work on colouring my terminal with zsh lol
https://bin.bardy.me/v3SXkkhm
https://bin.bardy.me/RKJYpaGz
https://bin.bardy.me/PWtuNUGj
https://bin.bardy.me/ukzxIuZE
https://bin.bardy.me/GjD1h815
https://bin.bardy.me/WznRK5bC
https://bin.bardy.me/2xrBTC7q
https://bin.bardy.me/CRpV8nBJ
https://bin.bardy.me/FBBzoyKZ```
and watch some more children's programs
@jovial warren whats the limit atm?
1000 connections per 6000 seconds
positive
you really spamming it?
fixed
https://bin.bardy.me/W9dmuyF6
https://bin.bardy.me/85jFBwbv
https://bin.bardy.me/u67v8RK1```
yea I was testing what would happen when you reach the rate limit
fixedSo 1k more = rate limit?
no I fixed my message lol
ciao
back
rate limit test?
still not limiting
just finished 2 sets of 2k within less than 5 mins
just why
@old wyvern you are doing god's work
try those links again maybe
I may or may not have just ran redis-cli FLUSHDB followed by redis-cli FLUSHALL
and I can run that every time you try to fill it up ๐
Wait it's all in redis?
yep
Huh
hastebin supports redis for storage
I mean im more interested in the rate limit not functioning
If I wanted to fill it up I could leave it running over night / when you are asleep
before I just cleared the entire keyspace, there was 213 keys in db0 and 3467 keys in db2 (the paste database)
ยฏ_(ใ)_/ยฏ
huh
Also why does the connection limit NOT WORK?????
xD
Are you sure its 1k per 10 mins?
its not working then
you gotta remember though that it's also fully proxied through cloudflare as well
still shouldn't make a difference
unless the receiving ips change since they're from cloudflare
Its supposed to limit all connections
not from 1 ip
fix the rate limiter now!!!!! ๐
"connect-ratelimit is connect middleware for limiting the number of requests per client ip/hostname to your node server."
ah per ip
welp thats useless then
I imagined it limited the service to that
requires further testing
:)))
3,458 TLSv1.2 requests in the last 24 hours
95% of requests in the last 24 hours have been from TLSv1.2
TLSv1.3 requests are probably the normal people
@prisma wave I got one of those lol
whats the stat at rn?
@old wyvern I took that screenshot about a minute before I uploaded it
if that
still the same
doesn't update instantly
ah be ready
Not bad
I forgot i+1 so its 2k more than shown btw
welp imma stop procrastinating and go back to work now
ciao
do I need to flush again
xD
and it's all clear again
for now
if I turn off cloudflare proxying you'll get rate limited properly lol
if I turn off cloudflare proxying I'll also probably get a slow loris from like BM or something
lol
loris?
you never heard of a slow loris attack?
basically you send incomplete requests, which open up threads, then send keepalive headers when it's just about to timeout to keep the connection open
hmm
and also, if any mods or admins see this, disclaimer: this is only for testing purposes, I do not in any way condone the use of any form of Denial of Service attack on a real website
just covering my arse
if I turn off cloudflare proxying I'll also probably get a slow loris from like BM or something
Turn cloudflare off
It will be funny
I promise :)
This is... Interesting
indeed
This implicit default value is used when the original map doesn't contain a value for the key specified and a value is obtained with Map.getValue function, for example when properties are delegated to the map.
getValue has diff behaviour from the [] shorthand
Anyway gonna go have dinner and sleep
its almost 4 am oof
Yeah I think it's quite confusingWhats confusing?
Ugh, I already changed all settings and still getting this, why do you hate me sql
Exception in thread "DefaultDispatcher-worker-2" java.sql.SQLException: Incorrect string value: '\xF0\x9F\x98\x82 _' for column 'message' at row 1
the documentation specifies it only works with getValue
Also the []'s behaviour is to always return null if key doesnt exist
https://kotlinlang.org/docs/reference/map-operations.html
true
They could've made a DefaultedMap interface that overrides the nullability of get as well
Idk
welp
Ugh, I already changed all settings and still getting this, why do you hate me sqlI just had an issue with mariadb having db name case issues for some reason
sql hates everyone ๐
It's something to do with UTF 4 bit character or something like that, can't figure what it is though
I mean i know sql as well, this error is just bothering me
Exception in thread "DefaultDispatcher-worker-2" java.sql.SQLException: Incorrect string value: '\xF0\x9F\x98\x82 _' for column 'message' at row 1
The best thing about documenting your code is that you have an excuse to having 5000 lines of code in 1 class
uh wat
javadocs on your code
๐ซ
I swear this class has 100 lines of code and 500 in total
Because I'm documenting e v e r y t h i n g
I don't understand where those interfaces would be used but ok
Like let's create an interface with a uuid and stuff
what do you mean
but then to load the crap
i dont get what you mean
Like just use a class directly
you mean how those methods in the interfaces gets executed?
I see the uses for interface just not in that case
mhm, i'm using them correctly tho?
would you get this?
cOmmeNT
I've spent 50 hours in my project and I have like 9 classes
whats a warp rate
Most of the time I'm just commenting or thinking of what I should write on the comment
Cause I should do that
warps allowed per second? or like cost per warp?
It's better to have more classes though
warps allowed per second? or like cost per warp?
@old wyvern people rating warps for example 1/5
SRP
I like having classes and overcomplicating
oh
It's just that I'm commenting so much
Small classes, srp > big over complicated classes
I have a medium project with like 94 classes
ok there is so much to show, cant be bothered lol
I recorded a 30 second gif of me going through them
Interfaces good
^
I don't use them much
ooo
they work wonders for encapsulation
i always forget them
For me they are very situational
I guess
I would say interfaces are just as important as classes
Because most classes I make have a single purpose
If not more
unless it's a template
Then yes use interface
Maybe in the future I'll learn to interface
But for my most classes have a really specific purpose that no other class will mess with
Nice
Quality not quantity
I know
those review replies are quality
Also why tf do you have a line between each variable
I'd make them in groups
i do to
thatโs nothing olzie
i wonder how many classes my framework has
Yeah why?
May someone review my plugin code? https://github.com/MCPueblo/PortalCalc/tree/master/src/main/java/net/mcpueblo/portalcalc
Wonder whenever my code falls into the "decent" or "spaghetti" quality
I'm on mobile but I'll do my best
Initial thoughts:
For a first plugin this isn't bad. You're not doing everything in your main class which is good, you are using dependency injection rather than static everywhere, and you seem to be following naming conventions
Some suggestions/nitpicks:
Your onDisable method is doing nothing, could be removed
PortalCalcCommand#plugin should be private and final
You should restructure your onCommand logic to avoid nested if statements (ideally none at all) as this reduces "arrow code" and makes your code more readable
You could also look into caching the config values (such as getCoordColor and the messages). While this usually doesn't speed things up, you should always try to avoid recalculating values you already have
On the topic of getCoordColor, should it be returning null if the string is empty? WHITE seems like a more logical decision
A lot of these are common things to see in a new plugin, so overall I'd say this is pretty good
Definitely better than a lot of new plugins
wew
you are using dependency injection rather than static everywhere
I struggled withcannot be referenced from a static contextissues trying to getgetConfig()to work, until I added thePortalCalc plugin;stuff
Your onDisable method is doing nothing, could be removed
Hmm, I'll probably simply stuff a message there, want to use it as a future example for plugins
PortalCalcCommand#plugin should be private and final
Which part of the code is that located? Is itPortalCalc plugin?
You should restructure your onCommand logic to avoid nested if statements (ideally none at all) as this
reduces "arrow code" and makes your code more readable
Still a noob to code, should I use theswitch casething instead?
You could also look into caching the config values (such as getCoordColor and the messages). While this usually doesn't speed things up, you should always try to avoid recalculating values you already have
Alright, this I definitely have no clue how to do, should perhaps google it
On the topic of getCoordColor, should it be returning null if the string is empty? WHITE seems like a more logical decision
I stole that portion of code from thegetOperatorColormethod from EssentialsX :p
Will definitely change
A lot of these are common things to see in a new plugin, so overall I'd say this is pretty good
Definitely better than a lot of new plugins
Glad to hear at least, it's not quite spaghetti code after all
๐ code ๐ review
I struggled with
cannot be referenced from a static contextissues trying to getgetConfig()to work, until I added thePortalCalc plugin;stuff
Dw, using Dependency Injection (passing PortalCalc into the constructor) is the correct way of doing it. Static bad
Hmm, I'll probably simply stuff a message there, want to use it as a future example for plugins
Fair enough, again this was just a little nitpick
Which part of the code is that located? Is it
PortalCalc plugin?
Yep, it should be private and final (as should every field unless you have a specific reason for it not to be)
Still a noob to code, should I use theswitch casething instead?
Not exactly. I'll explain more in another message
Alright, this I definitely have no clue how to do, should perhaps google it
It's easier than you think. Basically you load the values from getConfig() once into fields, and just use those fields.
I stole that portion of code from thegetOperatorColormethod from EssentialsX :p
Will definitely change ๐
Glad to hear at least, it's not quite spaghetti code after all
It's definitely not spaghetti
As I said, pretty good considering
Anyway reducing arrow code
This is another fairly simple concept. The simplest way of saying it is
"Use if-not-return rather than if-so-continue"
So for example, rather than java if(sender instanceof Player) { blah else { you're not a player blah }
You would do something like java if(!(sender instanceof Player) { you're not a player blah return true } blah
This helps to avoid nested if statements and brackets (which can make your code look like an arrow, making it hard to read)
Yours isn't bad but there's always room for improvement
?plsnoarrowcode
This is also useful
Hmm, I will definitely consider that article
Next on my to-do for this plugin is implement permissions, switch config.yml to locale.yml, implement a /reload command, allow calculating from an argument instead of just location, and give a message if running from console
So class and package names should be UpperCamelCase, methods lowerCamelCase and constants just FUCKYOUIMIMPORTANT right?
package names should be all lowercase
constants are UPPER_SNAKE_CASE
๐_๐_๐
โซ ๐ ๐ผ
โฌ ๐ ๐ผ
๐ซ ๐ผ
okay these are pretty good
just need one for pascal case lol
๐ โ๏ธ ๐ผ "pass call case" lol
Lol
guess that works
๐ โ๏ธ ๐ผ
"pass call case"
about as close as we're gonna get
โซ ๐ช ๐ผ
wow
๐ซ that camel is for upper case
apparently
๐ช that camel is for lower case
๐ซ ๐ผ
๐
๐ผ
i just made it up
Anyone up for some clash?
We can take turns to avoid the kick, tell me who to tag next
They share.
@obtuse gale
how is that kickable 


Bro wtf how is this censored content
lol
https://img.bardy.me/testbg.png testing if images work while proxied by cloudflare
answer to that is yes they do
@old wyvern why do I have 13,505 TLS v1.2 requests within the last 24 hours
seems legit
wdym?
wdym wdym?
seems legit?
@lunar cypress @old wyvern I'll be on in 5 minutes
Lemme hop on pc @old wyvern
Alrighty
hm
knew what?
knew that I could make it a single calculation
lol
but I didn't have any more time
(apply + (take n (map #(+ (* d %) m) (range))))
```yup
ah xD
Imagine having a case-sensative API.
lol
imagine having an API at all
obviously that's what half of these so-called "developers" out there think
I got in just in time
rip
lol
I'm in for the next round
I think we should mix it up next round
everyone has to use a language they've never used before or something
idk
could be fun
Oh god
oh lmao
that... will probably make all of us fail
PeRl
Johny, worth it
Ima try out Haskell
Literally reading docs for 10 min is not fun but whatever you say
Imma roll a dice for next one
aha ok
oh good luck with haskell
it doesn't look too hard
ok
and respect if you actually manage to get a result
We are not allowed to tag here Nial shhh
how do I changed language?
Ok
over here