#💻︱programming

1 messages · Page 35 of 1

sullen jacinth
#

okay, thank ya

#

I'll try this solution

plush walrus
#

is it possible to somehow import import_this.py from script.py ike this in py?

project/
  folder1/
    script.py
  folder2/
    import_this.py
tawdry radish
#

../dir

#

idk if that works in peethon but it works in everyother language

#

so ya

verbal violet
#

idk if there are any bukkit devs here, but if so, can someone tryna help me figure this one out?
Does anyone know how to update the xrot (head going up and down) of an entity properly? I'm trying for an iron golem to look from 0 to 45 in 20 ticks, but it just looks at 0 the whole time and doesn't update, even though the value does change...
I tried doing just #setXRot(...) too, but same effect.

torpid crypt
verbal violet
#

it's for a custom runnable, overriding the tick method

#

rest is tickCount % 1300 running when tickCount % 1300 < 100. So rest is between 0 and 100

#

but the equation works fine, and the xrot does update when I print it in the console after each assignment, but the entity's head pos just doesn't update besides to 0

torpid crypt
verbal violet
#

doesn't that have the same effect as teleport

torpid crypt
#

In your case just #setLocation(copy)

#

It should do the same

verbal violet
#

alright i'll try it

#

still confused why #setxrot wouldn't just work tho

verbal violet
#
getBukkitEntity().setRotation(getBukkitYaw(), (20 - (40 - rest)) * 2.25f);
getBukkitEntity().teleport(location);
setXRot(...);
torpid crypt
#

I was just about to suggest setRotation, lol

verbal violet
#

the thing is that the values do update, but the physics don't

torpid crypt
#

Where are you checking your values? Same place where you're setting your entity's rotation?

verbal violet
#

yup a bit after

#

unless it's being changed again in the super idk

#

wait actually..

#

lmaooo i wanna cry that works

#

the super was overriding the look dir

torpid crypt
#

._.

verbal violet
#

alright onto the next issue

#

swinging does nothing

minor roost
#

happy birthday @sly mist

tawdry radish
ruby flower
#

+emoji CCender

gentle patio
#

what

#

lol

#

"comming out"

warm falcon
#

Dk if this has anything to do with programming but this seems like a good place to ask, for the bedrock version, how do you connect from one world to another

gentle patio
#

Omg I look smart rn

#

When I actually jsut looked at mitgoblas answer to the question in staff help that you just asked 2mins ago

warm falcon
#

lol, sorry about that I thought this was a bad place to respond

#

so i asked there

tawdry radish
tawdry radish
sweet barn
#

BungeeCord won’t work for bedrock - if you want to connect multiple bedrock servers I’d suggest WaterdogPE

tawdry radish
#

i would just use the normal way of connecting servers just transfer them

sweet barn
#

The only issue with the transfer packet is it’s very slow

subtle matrix
#

Is anyone here familiar with MIME?

#

The email thingy

sweet barn
tawdry radish
#

tbh waiting for a game is better then laging overall

sweet barn
vale cosmos
#

Ñ

untold grail
#

Hello people who talk in here, if we were to theoretically have some form of public API, what sort of data or endpoints would you like to have accessible?

dense zinc
#
  1. Stats
  2. Online players
  3. Last online
  4. If a player has played before
  5. Stats per version (aka players on 1.12.2 Java or 1.17 Bedrock)
  6. Total stats of gamemodes, like total kills, total deaths
  7. LEADERBOARDS
spring tiger
#

player count per gamemode

gentle patio
ocean sparrow
#

like in settings^

gentle patio
#

Confusion

dense zinc
untold grail
plush walrus
minor roost
#

but for statistics like play time appeals/bans im not sure its to personal

plush walrus
minor roost
plush walrus
#

Yes and that's not what I meant, also you can see if the person has appealed or their appeals bas been denied rn too

dense zinc
ocean sparrow
untold grail
hard tapir
#

hey, i have a question. i use Whatsapp quite regularly, and i want to make a bot for Whatsapp the same way i have a bot for discord. there are apps in the play store for this, however i want to make it myself. any idea on how i can do this?

ocean sparrow
#

@kind brook

#

^

#

I don't think whatsapp has a public api, if it would it'd be the first result in google

hard tapir
ocean sparrow
#

it's the business api intended for- well businesses

gentle patio
#

I still don't understand tho-

#

Would this be on a website?

spring tiger
#

@gentle patio No, an api allows you to request data to use on your application

#

Basically a connection

wheat relic
#

Only if connected by passport^

gaunt berry
#

plancke io/hypixel/boosters/ and this

#

plancke io/hypixel/leaderboards/ and this

#

and maybe this but i dont think anyone would every use this: plancke io/hypixel/punishments/

#

basically everything the hypixel api has

gentle patio
spring tiger
gaunt berry
#

ben pro dev

gentle patio
#

isnt that what the leaking rule is for xd

gentle patio
sweet barn
#

Yes but that’s for existing java servers, not bedrock servers

wheat relic
dense zinc
#

Wat

wheat relic
#

Just do a cubecraft

sweet barn
wheat relic
#

Do a cubecraft

sweet barn
#

Well.. our version of bungee/waterfall we use on cc has deviated very far from upstream - we wouldn’t be able to support bedrock players otherwise 🙂

wheat relic
#

Make java server bedrock

gaunt berry
#

and tbh there is like no reason to use something like pmmp or nukkit anymore because of it

sweet barn
#

I mean if you used a bedrock proxy like waterdogpe I’m sure it would work with geyser

gaunt berry
#

bungee works with geyser too

sweet barn
#

yes

#

The flow would be geyser -> bungee -> java server in that case tho

#

vs waterdogpe -> geyser -> java server

gaunt berry
#

dont see a problem there?

sweet barn
#

I’m not saying there is 🙂

wheat relic
#

Make geyser a actual server software for bedrock and java

#

So you don’t have an extra connection????

#

And each player connection is matched by UUID or xbox ID

#

So a BootyBooty on Java can be on the server the same time a BootyBooty on bedrock is

plush walrus
wheat relic
#

Crater

#

Cause

#

That comes after the geyser

plush walrus
#

but that would lose it's point?

wheat relic
#

No

plush walrus
#

geyser is a proxy, not a server software

#

making it server software, would make it lose its purpose

sweet barn
#

Basically, and it would be a massive pain to continuously maintain with new Minecraft versions ^^

#

It’s a proxy for the sake of allowing you to join any java edition server

sweet barn
dense zinc
wheat relic
#

But if you did do it like that it could make it look better

#

For bedrock players

sweet barn
#

It’s a nice performance boost from not utilizing the same channel

#

The packet translation time is negligible

wheat relic
#

Well yea but like

#

I’ll randomly sit there connecting to a server for 10minutes cause why not

#

And I can’t use commands without crashing

sweet barn
#

that has absolutely nothing to do with how packets are translated btw

plush walrus
#

anyone here who has experience with g cloud, specifically cloud functions?
I need help deploying a function, everything is fine I just do not know how to set up the entry point caller correctly since none of my files is main.py

wheat relic
#

Cause /fill crashes me

sweet barn
#

That sounds more like your client acting up

tawdry radish
torpid crypt
#

Took me this many attempts on trying to figure out how to rotate an entity's head to my liking using NMS packets ._.

#

Reason why it took me that many attempts is cause I had no idea how MC calculated the yaw until I stumbled upon this

wheat relic
#

In eggwars

#

Can you make the nametag a 3x3 hitpox instead of a 0.001x0.001 hotbox?

sweet barn
#

nametags dont have a hitbox

wheat relic
#

So like it’s physically impossible to place blocks on villager

wheat relic
sweet barn
#

they're just tags that are above the entity itself

#

no?

#

there is an entity hitbox

wheat relic
#

One sec

#

On Onix it shows one?

#

Same above players

#

I guess lagbox exist hothot

torpid crypt
#

There does seem to be a hitbox, but it's not the villager's name, as Redned said, nametags don't have a hitbox. He most likely means the invisible armor stand that holds onto the custom text which does have a hitbox (In Java edition, if you spectate an EggWars game I believe you can see this armor stand)

#

As for players, there's nothing there that would prevent you from hitting a player behind it

sweet barn
#

yeah, iirc we have those set as markers so they shouldn't have a hitbox

#

yeah we do

wheat relic
sweet barn
#

basically what hackers just described ^^

torpid crypt
#

Weird. Iirc, if you try to shoot with a bow through the armor stand the arrow will just bounce off

wheat relic
#

SO isn't it still possible to make it a 3x3 tho?

torpid crypt
#

There does seem to be a bigger-than-usual hit box around the EggWars villager, but it's honestly fine as it is right now

sweet barn
#

I'm not sure what you mean by a 3x3

wheat relic
#

why not make a custom entity likew with deathboxes?

sweet barn
#

however on bedrock you can use newlines on nameplates

#

if that is what you are asking?

wheat relic
#

or a 3x2

#

so you can't place here caus eghost bridging abusers

sweet barn
#

yeah well that's just due to the fact that we cancel block placements right next to the shop 😄

wheat relic
#

yEA

#

But

#

your hitboxes with deathboxes work well

#

you can hit through them

#

but not place in them

#

and since they are stagnant you can't ghost block on or through it

#

you can also place through

#

And you can set it up like Dropped entities. where it only loads in within 16blocks over render distance. so it shouldn't affect gameplay

wheat relic
#

it shouldn't ruin anything

tawdry radish
#

hello

wheat relic
#

With a Steve with an arm for a hand and hand for an arm

gaunt berry
#

not a cracked account

#

still authenticates with xbox

void scarab
#

maybe also leaderboards but that's bad for CaloriMod so maybe not

ocean sparrow
#

Like seeing someone's win ratio and quitting if there are good players

gaunt berry
#

you could make that a bannable offense, like hypixel did

ocean sparrow
#

it's not like you can easily track something like that

gaunt berry
#

its a message to mod developers tho

untold grail
#

Nothing is set in stone then - I'm not guaranteeing or confirming that we will have one anytime soon, just asking that if we did, what people would like to see in it :D

wheat relic
wheat relic
#

Like SlinkyGnu who will just leave the game if someone he lost against(who is LB) is in the game

tawdry radish
gaunt berry
#

will test later

tawdry radish
#

what is afaik

#

no one ever told me ;-;

gaunt berry
#

as far as i know

tawdry radish
#

i thought it was a arabic word ngl

gaunt berry
#

@wheat relic just tested it, skins work

gentle patio
#

does anyone know if there's a site that shows player count of minecraft overtime?

wheat relic
tawdry radish
#

google™️ always works

tawdry radish
green matrix
tawdry radish
gaunt berry
#

but its possible to implement that

wheat relic
#

Or so only bedrock players see it or just remove custom geometry with a flat one

gaunt berry
tawdry radish
mild shore
#

ñ

tawdry radish
copper ice
tawdry radish
tawdry radish
#

but if it does when?

gaunt berry
#

prob in like a year?

#

i dont see cube seeing a public api as high priority

tawdry radish
#

but ben is dev

#

on api

#

so it abot him

sharp crystal
tawdry radish
gaunt berry
minor roost
#

Hi im trying to screen scrape a web page in java

#

but i get 403 error

#

anyone knows how to fix this ¯_(ツ)_/¯

tawdry radish
minor roost
tawdry radish
#

or it might be due to something else

#

@minor roost i think it is the headers

minor roost
tawdry radish
# minor roost hmm wdym

it might be that the scrape lib you using uses headers which makes the website think you are a bot

#

tbh idk

#

does it send 403 when you request page, or soemthing else?

minor roost
tawdry radish
#

did it send you when you requested the page, or when you requested content

minor roost
tawdry radish
minor roost
tawdry radish
#

np

untold grail
tawdry radish
untold grail
#

we do!

gaunt berry
tawdry radish
# untold grail we do!

:0 now finaly people gonna be happy to see who is og and stuff if api comes out

let me just make a website template thing for when api comes out

gaunt berry
tawdry radish
gaunt berry
#

yes

#

i am js pro now

tawdry radish
#

:D

gaunt berry
#

i can do it

tawdry radish
#

well
wana learn new stuff while making it?

tawdry radish
plush walrus
#

But u don't even know much about the endpoints

gaunt berry
#

yes

#

only frontend

tawdry radish
plush walrus
#

Ohh then alr

gaunt berry
#

backend later

tawdry radish
#

i can make a sketch up of how it would look if you want .-.

#

lmao that 50$ mango db credit gonna be used now

gaunt berry
#

we dont need a db do we

#

nvm

#

yeah a db is probably helpful

tawdry radish
#

not right now, but we would need to cache the data to reduse stress on cc api once it comes out

gaunt berry
#

yes

tawdry radish
gaunt berry
#

json still superior

tawdry radish
#

mongo db is json

#

ngl i am hyped

#

so, what framework we gonna use we gonna 100% use tailwind for css no quesions asked

tawdry radish
#

still hyped though happylime

#

tbh api endpoint about when player first joined would bring people who left cause of the birthday event thing

tawdry radish
ocean sparrow
#

@untold grail if you do release an API make sure you also release a wrapper for it, at least in Java <3

tawdry radish
gaunt berry
#

ill make a c# wrapper

#

and a js wrapper maybe too

#

but idk abt js

tawdry radish
#

i will make a deno and rust wrapper .-.

ocean sparrow
gaunt berry
#

deno is js

tawdry radish
ocean sparrow
#

that's not how you work

gaunt berry
#

in java and c# u need classes

tawdry radish
#

sadge

#

i remembered that it is in json

ocean sparrow
#

JSON is a data format

tawdry radish
#

it would be cool if ben used graphql too 😳
we would not have these issues
but rest better in my eyes

#

i am gonna make a design brb

tawdry radish
#

@gaunt berry not color scheme but the stats thing would look lik ethis :)

#

also gn

wheat relic
tawdry radish
gaunt berry
tawdry radish
#

😳

tawdry sorrel
#

True

lusty pagoda
#

i need help rq

#

how to get an image's coordinates in html

#

?

#

i mean
i can't really just count pixels

#

w3schools didn't give me a tutorial or a site to calculate/get pixels

ocean sparrow
#

Send the tutorial you've used :}

lusty pagoda
#

I used w3schools
And there's no tutorial for it
And tho... Uh.. There is one but it's so hard
Just go to w3schools, learn html, images, image map, and scroll down a bit

ocean sparrow
#

Wow, honestly I didn't even know HTML had sth like this

#

Which basically means I know nothing about these so I can't help, sorry :/

lusty pagoda
#

It's HTML5 👀

spring tiger
#

That's likely something you will not be able to do with HTML5 alone, you'll need to use Javascript

minor roost
#

HTML5?

#

Smh

#

Casuals

#

I use HTML9

tawdry radish
#

chad birbs use html 100

tawdry radish
#

imagine width and height?

tawdry radish
#

@untold grail so who needs to give you go ahead to make the api?

untold dagger
#

idk if this fits here, my own cpu design running a simple calculator app!

#

I've been working on it for a few weeks

tawdry radish
#

that cool ngl

fast lynx
#

Hello,how do i do successful website?

#

I want to be helper

#

But

#

I dont know how to make a sucessful sebsite

#

🥺

wheat relic
#

In a resource pack error it tells me

#
[ITEM][ERROR]-Missing Icon for data-driven item 'egg:special_egg'.```
#

how to fix?

rapid crane
# fast lynx I dont know how to make a sucessful sebsite

If you want to become a helper you need at least 5 website reports. That means you must have at least 5 successful reports of rule breakers on the forums (You can report them here: https://cbecrft.net/bedrockreports)

gentle patio
#

Or /sr

untold dagger
tawdry radish
tawdry radish
fast lynx
#

Tyty

wheat bough
#

im learning python, my head hurts after a few lessons

minor roost
#

python oop sucks

#

it should be called poop

spring tiger
#

I'd be interested to know your thoughts on why that is 🙂

plush walrus
gaunt berry
#

ikr uwu++ oop is way better

minor roost
#

the class structure gives makes me loose braincells whenever I

see it

#

like wth is init
``

#

it looks alot more clean in languages such as java or c#

plush walrus
minor roost
#

so thats pythons cunstroctur?

spring tiger
#

__init__ = initialise method

minor roost
#

ok

wheat relic
#
[ITEM][ERROR]-Missing Icon for data-driven item 'egg:special_egg'.```
#

How to fix? Owo custom items hot

#

I want a texture for boomboom egg

minor roost
#

python is meant to be a simple language and its oop destroys the purpose of it

#

its better to write python code without using classes

spring tiger
#

I disagree with you there, OOP is incredibly important with Python to having structured code

wheat relic
spring tiger
tawdry radish
#

like every 10 secs .-.

minor roost
plush walrus
#

so I think you can

tawdry radish
minor roost
#

so u dont really need to use its classes in most cases

tawdry radish
#

not realy that hard too tbh

plush walrus
tawdry radish
#

and bam you got player online count

spring tiger
# minor roost python is not a fully oop language tho

The only reason it is not fully OOP is because you don't need to write classes to run some code, unlike languages such as Java that require a main. That doesn't discredit its OOP features however, it's still massively useful and important to learn to use

wheat relic
#

You know

#

For python being a “simple language” I do see it a lot. Even if it’s not the greatest I see it used for some complicated things

#

If you want a simple coding language thats something like css or HTML

spring tiger
#

I think you're putting yourself at a disadvantage not using classes, because they allow you to do all sorts of things such as bundling data and functionality together.

I couldn't imagine trying to write much of the code I do without classes, there would be an incredible amount of hardcoded things..

tawdry radish
spring tiger
tawdry radish
#

yes

spring tiger
#

there are also more efficient storage methods than dicts

tawdry radish
#

oop was made for better readability + better way to store data so it gud 👍

spring tiger
#

put it this way, if I use a dict to represent a student:

student_one = dict(name="Student One", age=16, modules=['Maths', 'Science', 'IT'])

There is nothing stopping me from putting in garbage values.

def create_student(name: str, age: int, modules: list):
  return dict(name=name, age=age, modules=modules)

student_one = create_student("Student One", 16, ['Maths', 'Science', 'IT'])
student_two = create_student("Student One", 63457, ['Chocolate', 'Coffee', 'Oranges'])
student_three = ...

So by using classes, you can make your code far more readable, but also use functionality to prevent garbage inputs/outputs!

class Student(object):
  def __init__(self, name: str, age: int, modules: list):
    self.name = name
    self.age = self.check_age(age)
    self.modules = self.check_modules(modules)
    
  @staticmethod
  def check_age(age: int):
    if age >= 12 and age <= 18:
      return age
    raise ValueError('Age must be between 12 and 18')

  @staticmethod
  def check_modules(modules: list):
    # Could add a check to another object that stores all the modules in the school!
    if len(modules) < 1:
      raise Exception('Student requires at least 1 module!')
    elif len(modules) > 5:
      raise Exception('Student is on too many modules!')
    self.modules = modules

  # lots of other methods for manipulating Student
  def set_name(self, name: str):
    self.name = name

  def set_age(self, age: int):
    ...
tawdry radish
#

'???

gentle patio
lusty pagoda
#

@tawdry radish no... Not that-

tawdry radish
pale anvil
#

I like python

tawdry radish
#

learn rust it better then peethong

pale anvil
#

nah

tawdry radish
pale anvil
#

can it run on windows?

#

nvm googled it, it can

#

i'll give it a try

tawdry radish
pale anvil
#

umm i have installed it, now what?

tawdry radish
lusty pagoda
#

@spring tiger you are my only way

spring tiger
#

🤔

lusty pagoda
#

this

#

how to get coordinates inside an image

#

like it's impossible to count them

spring tiger
#

As in, the coordinates the user clicked on inside the image?

lusty pagoda
#

yes

spring tiger
#

You could use paint software like paint.net to see the coordinates of the picture, then put those in that element

lusty pagoda
#

yayyy

#

tysmmm

#

how to get that

#

google?

spring tiger
lusty pagoda
#

yup

#

exactly what i need

#

ty

#

sm

#

I've been trying to figure this out for a day

small hare
#

Could anyone help me with a quick SQL question?

#

I have a test tomorrow and one of the assignments for practice is "Show all information of all employees whose DEPARTMENT_ID is between 90 and 20 NOT INCLUDING those two values"

So I tried:
SELECT * FROM employees WHERE department_id BETWEEN 20 AND 90;

But that INCLUDES the two values. I'd use 21 and 89 but that's not what my teacher wants i think hahaha

#

We HAVE to use BETWEEN AND btw, cause i looked it up online and it's all suggesting to use a different method

#

@hearty bloom @plush walrus oi

hearty bloom
#

hallo

small hare
#

hello help

small hare
hearty bloom
small hare
#

and oh Python too

hearty bloom
#

because SQL isnt a coding language

small hare
#

wtf u cant do HTML kid?

#

noob

hearty bloom
#

not a coding language either

#

I can do both

small hare
#

Of course u can

hearty bloom
#

but I dont consider them coding languages

small hare
#

If u cant do HTML then how could you code at all

tawdry sorrel
small hare
#

OK NOT THE POINT

#

i need help

hearty bloom
#

I would just do WHERE department_id > 20 AND department_id < 90

small hare
#

bro

#

i did say we have to use the BETWEEN ... AND ... method

hearty bloom
#

ik

#

and it's not possible (at least in an easy way)

small hare
#

right

#

i'll tell my teacher he's dumb

hearty bloom
#

you could do: WHERE department_id BETWEEN 20 AND 90 AND department_id NOT IN (20, 90)

#

but that kinda ugly xd

plush walrus
#

I'm late

hearty bloom
#

as always

#

:)

plush walrus
#

Wow :(

#

I'm noob with sql anyways

small hare
#

yeah no thank you

#

i'll use your first suggestion

#

figured that would be best

#

ty

hearty bloom
#

np

crimson thorn
tawdry radish
#

anyone used svelte kit?

minor roost
#

Anyone knows how to screen scrape with htmlUnit?

empty sky
#

hihihihi

tawdry radish
minor roost
tawdry radish
#

@gaunt berry btw we need a logo for CubeStats

#

is Cube in blue and Stats red gud??

dense zinc
#

I wouldn’t use the Cube logo

#

As you don’t have the rights to it

tawdry radish
#

we just using text

#

CubeStats

dense zinc
tawdry radish
ocean sparrow
#

But it's great you respect the copyright laws 👍

gaunt berry
#

my own original creation

dense zinc
mighty helm
hard roost
woeful sphinx
#

Hi gameing gods

lusty pagoda
#

am I broken or w3schools won't let me set up my space name?

#

Space name "name" is not available, please choose another.

#

the "name"

#

why..

#

WOW

#

random letters actually worked

tawdry radish
#

maybe i should change stats to orange

tawdry radish
#

@gaunt berry how does this look?

gaunt berry
tawdry radish
tawdry radish
tawdry radish
hard roost
gaunt berry
#

also got it just today

tawdry radish
#

should i try to get in 😳

marble ridge
#

Im the best controller player (;

wooden aspen
minor roost
tawdry radish
#

@plush walrus hi

plush walrus
#
// keys.js
    connect(this) {
        return mysql.createConnection({
            host: this.host,
            user: this.user,
            password: this.password,
            database: this.database
        });
    }```
```js
// index.js
const api_keys = require("./mysql/keys")
const keys = new api_keys.Keys();
keys.connect()
SyntaxError: Unexpected token 'this'
#

have issues importing class in js

tawdry radish
#

just put the function in the class brackets thing and done

tawdry radish
# plush walrus oH

also use import api_keys from "./mysql/keys"
If you are on 1.14+ of node .-.

plush walrus
#

ye I am on node 16

tawdry radish
#

it better syntax happylime

tawdry radish
plush walrus
tawdry radish
#

hmm

#

send full code

plush walrus
#
const mysql = require("mysql");

class Keys {
    constructor(host, user, password, database) {
        this.host = host;
        this.user = user;
        this.password = password;
        this.database = database;
    }

    connect() {
        return mysql.createConnection({
            host: this.host,
            user: this.user,
            password: this.password,
            database: this.database
        });
    }

    disconnect(connection){
        connection.disconnect()
    }

    test(){
        console.log("func")

        connection = this.connect()
        console.log("connected")

        this.disconnect(this, connection)
        console.log("disconnected")
    }
}

module.exports = Keys;```
tawdry radish
#

other file?

#

wait

#

you need to do


const mysql = require("mysql");

export class Keys {
    constructor(host, user, password, database) {
        this.host = host;
        this.user = user;
        this.password = password;
        this.database = database;
    }

    connect() {
        return mysql.createConnection({
            host: this.host,
            user: this.user,
            password: this.password,
            database: this.database
        });
    }

    disconnect(connection){
        connection.disconnect()
    }

    test(){
        console.log("func")

        connection = this.connect()
        console.log("connected")

        this.disconnect(this, connection)
        console.log("disconnected")
    }
}

rather then using module.exports

plush walrus
#

but I am using CommonJS

tawdry radish
#

does not matter

#

node 14+ has es module su pport

plush walrus
tawdry radish
plush walrus
#

nvm fixed

tawdry radish
#

oh ok

plush walrus
#

module.exports = Keys; --> module.exports.Keys = Keys;

tawdry radish
#

also use deno, why you using node sadcat

sharp crystal
plush walrus
#

o

#

makes sense

sharp crystal
#

:)

tawdry radish
#

:0

#

but module.exports = Keys should work if he did
import api_key from "./mysql/keys" thonk

tawdry radish
minor roost
wild shadow
#

cursed_python

tawdry radish
#

that more cursed than my life

minor roost
ebon temple
#

And devs/ mods etc by chance can yiu add the snowman tag gamemode from last yesr again for this christmas? It was incredibly fun!

ebon temple
#

Tysm! <3

tawdry radish
ebon temple
#

Sorry, I just joined by chance can I be informed which channel is?

minor roost
#

how to code🙂

wild shadow
spring tiger
#

@tawdry radish not the kind of welcoming attitude I want to see here 😄

tawdry radish
#

;/
i mean asking how to code is a vague quesion

#

too vague

spring tiger
#

sure, but telling someone to not ask and just go on youtube is not really a nice way to start off 😛

tawdry radish
spring tiger
#

for a start, asking what anderson just asked and find out what they're interested in

tawdry radish
#

i see

spring tiger
#

then as you've probably seen me already do, introduce them to easy-to-learn sites
youtube is not always a good option, because its hard to tell from a thumbnail if its easy or not. I especially do not like the "learn this language in 1 video of 6 hours long" because programming can't be taught in such a crammed time

tawdry radish
#

but before that
i read this, that why i gave vague answer

spring tiger
#

everyone is welcome here to talk about code regardless of experience, don't want to scare them off and make this channel feel like an exclusion zone only for experienced programmers to talk in

tawdry radish
#

oke

#

let me just make a message listing some stuff then since everyone be asking vague questions :/

#

since everyone has been asking vague quesions like "how to code"
Pick one language from the list below and ask "how do i get started coding in <language>"
that would be much better since we know what you want to do :)

game development: c#, python
web development: html, css, js (learn all 3 of them cause yes)
app development (win, android, ios, etc): dart / flutter, swift, java
ml: python

all the categories are like general stuff which most beginners want to learn so I put them in, if you want to do stuff in an category that is not in the list then you can ask about how to get started in that category :)

tawdry radish
wheat relic
wheat relic
spring tiger
#

the bot blocks any link other than the ones we have whitelisted
this is far easier than us just blacklisting links, because so many new discord scam links are being posted everyday
feel free to message me the link so I can add it, or post the link in a format that it wont get automatically deleted i.e python dot org

dawn parcel
#

yo hows this invention i made using python

#

how it works if you wanted to know

plush walrus
dawn parcel
#

Yeah correct

plush walrus
#

the amount of xp needed for each level is known

dawn parcel
#

Yea

#

basically maths but automated with python

spring tiger
#

thats pretty neat

dawn parcel
#

Yeahh

plush walrus
#

may I ask which bot is it

dawn parcel
#

my bot

plush walrus
#

Oh, interesting

dawn parcel
#

not a public bot if you are wondering

#

xD

plush walrus
#

Just asking because I've already seen bots that do that too

dawn parcel
#

Oh interesting

plush walrus
#

but looks really cool!

dawn parcel
#

Thanks :D

plush walrus
#

Hey, could someone explain to me why does the last return not being returned if keys.check() is true?

function api_key_is_valid(req, res) {
    const api_key = req.get("Authentication");

    if (keys.check(api_key, function(err, result) {
        if (result == false) {
            res.status(403).send({"message": "403: Forbidden"});
            return false
        }

    }))

    return true;
}```
dawn parcel
#

Not much i can understand but is it because you forgot to put an else statement?

plush walrus
#

but the return is at the bottom

#

so it should be ran if nothing has be returned before

dawn parcel
#

Oof i have no idea- if it was python, the code would have stopped running if it ran into an error unless the error was handled using something

plush walrus
#

well there is no error, the code is just running not the way I'd want 😃

wheat relic
spring tiger
#

There's not really a way to do that consistently, and seems a bit of an excessive approach to the problem xd

tawdry radish
plush walrus
#

Or smth like that

tawdry radish
spring tiger
#

Yeah, it will mute you for that, hence I said you can message me/a staff member privately or format them differently @tawdry radish

tawdry radish
tawdry radish
dense zinc
#

That’s happened before

#

We usually ban them pretty fast

spring tiger
#

We can't stop the DMs being sent, because it's in a private conversation

tawdry radish
#

It different now

dense zinc
#

Unfortunately we’ve had that happen for server advertisements

#

Lots of banning

tawdry radish
#

Na this one is a virus now

#

It on different level

#

Every day a partnered server gets hit with this

#

Or big server

wheat relic
#

Over engineering best engineering

#

Doing bare minimum bad always do the best

tawdry radish
#

can you guys reduse mute time for links
since every discord steam scam is gonna only send a link once
in every channel

tawdry radish
#

i suggest you just console.log() in every block of code so you know where code breaks happylime

plush walrus
tawdry radish
#

i see, have you tried console.log() in every block?

plush walrus
#

I'll try

tawdry radish
#

@plush walrus i think you should put brackets around return true

#

not the issue but better to work with that

plush walrus
# tawdry radish <@!289411795423199232> i think you should put brackets around `return true`

So I changed my code a little and now the issue is, the statement is returned before defined, hence this console output:

sql res - true```

```js
function api_key_is_valid(req, res) {
    const api_key = req.get("Authentication");
    var key_presence = check_key_presence(req, res);

    if (key_presence) {
        var _res = keys.check(api_key, function(err, result) {
            console.log("sql res - " + result);
            return result;
        });

        console.log("returned _res - " + _res);

        if (_res == false) {
            res.status(403).send({"message": "403: Forbidden"});
            return false
        } else {
            return true;
        }
    }
}```
tawdry radish
#

@plush walrus alr simple fix would be

function api_key_is_valid(req, res) {
    const api_key = req.get("Authentication");
    var key_presence = check_key_presence(req, res);

    if (key_presence) {
        let _res;
        keys.check(api_key, function(err, result) {
            console.log("sql res - " + result);
            _res = result;
        });

        console.log("returned _res - " + _res);

        if (_res == false) {
            res.status(403).send({"message": "403: Forbidden"});
            return false
        } else {
            return true;
        }
    }
}

since keys.check does not return anything and the function passed in's parms are result and err
you could just throw an error (or do something with the err)
if it returns a result
Just making _res = result would fix it

plush walrus
# tawdry radish well can you send keys.check code the issue is there
    check(key, callback){
        const hashed_key = createHash("sha256").update(key).digest("hex");

        var connection = this.connect()

        connection.query(`SELECT user_id from api_keys where api_key = '${hashed_key}';`, function(err, result){
            if(err) throw err;
            
            if(result.length == 0){
                callback(null, false);
            }
            else{
                callback(null, true);
            }
        });

    this.disconnect(connection);```
plush walrus
#

aka same result

tawdry radish
#

hmmm

tawdry radish
#

since err is not used

plush walrus
#

but it's async right?

#

so I have to use callback

tawdry radish
#

no

#

well first of all what is the issue you are geting

tawdry radish
# plush walrus Hey, could someone explain to me why does the last return not being returned if ...

so
first of all you don't need callback function (even if it is async or await)
you could just return true or false

    function check (key) {
        //..

        let res;
        connection.query(`SELECT user_id from api_keys where api_key = '${hashed_key}';`, function(err, result){
            if(err) throw err;
            
            if(result.length == 0){
                res = false;
            }
            else{
                res = true;
            }
        });
      //.. 
      return res;
     }
function api_key_is_valid(req, res) {
    const api_key = req.get("Authentication");

    if (keys.check(api_key))
    {
      return true;
    } else {
      res.status(403).send({"message": "403: Forbidden"});
      return false
    }
}

^^ this should fix everything (unless connection.query function is async)

#

@plush walrus check again i forgot something

plush walrus
#

alright

tawdry radish
#

so did it fix everything?

plush walrus
#

hm not really

#

I get 403 even if sql query returns true

#
       console.log("key check - " + keys.check(api_key))
        if (keys.check(api_key)) {
          return true;
        } else {
          res.status(403).send({"message": "403: Forbidden"});
          return false
        }
    }```
`key check - undefined`
#

I am afraid that connection.query() is async

#

that's why I was using callback

tawdry radish
#

@plush walrus can i get docs?

plush walrus
tawdry radish
#

my brain stoped working

#

@plush walrus why do you need to return true or false after sending response?

plush walrus
#

if it is, other code executed

tawdry radish
#

i see

plush walrus
#

Although the code is pretty crappy rn, it works woa

tawdry radish
plush walrus
#

The code if anyone is interested:

    check(key) {
        const connection = this.connect();
        const api_key = createHash('sha256').update(key).digest('hex');

        return new Promise(function(resolve, reject) {
            connection.query("SELECT user_id FROM api_keys WHERE api_key = ?", [api_key], function(err, rows) {

                if (err) throw err;
                if (rows.length > 0) {
                    resolve(true);
                }
                else {
                    resolve(false);
                }

            });

            connection.end();
        });
    }``` ```js
function api_key_is_valid(req, res) {
    const api_key = req.get("Authentication");

    if (check_key_presence(req, res)) {
        return new Promise(function(resolve, reject) {
            keys.check(api_key).then(result => {
                if (result) {
                    resolve(result);
                } else {
                    res.status(403).send({"message": "403: Forbidden"});
                    resolve(result);
                }
            });
        }
    )} else {
        return new Promise(function(resolve, reject) {
            resolve(false);
        }); 
    }
}```
tawdry radish
#

also use let rather then var since var will add the variable to global object and let will only add it to scope

tawdry radish
#

you can declare a function with no name using an arrow

plush walrus
tawdry radish
#

you could use this syntax on normal functions too

// arrow syntax
let func = () => {}
// normal syntax
function func() => {}
tawdry radish
plush walrus
#

alright, thanks!

tawdry radish
#

@dawn parcel send forumula here

dawn parcel
#

huh

#

ill give you some hints of it!!

  • Cubecraft levels start at requiring 1000 xp to complete level 1
  • Each level you advance, 200 xp is added to gain to advance to the next level, example: level 1: 1000 xp, level 2: 1200 xp....
tawdry radish
#

hmm

dawn parcel
#

@tawdry radish apply the arithmetic progression formula, basically divide the required xp by the winning xp

#

Also this if statement should give an input error if required < 0 or xp < 0:

tawdry radish
#

so
f(x) = 800 + (x * 200)

dawn parcel
#

What is x

#

xp?

tawdry radish
#

x is level

dawn parcel
#

Oh

dawn parcel
#

Does it give the required xp

tawdry radish
#

ya

dawn parcel
#

And what is 800

tawdry radish
#

800 for first level

dawn parcel
#

no

gaunt berry
#

yes

dawn parcel
#

800 isnt for the first level

tawdry radish
#

yes

dawn parcel
#

it is 1000

gaunt berry
#

its right

tawdry radish
#

let me walk you through it

gaunt berry
#

there are multiple ways

dawn parcel
#

1000xp is required for the first levle-

#

Not 800

#

Im 99% sure

gaunt berry
#

put 1 in the function

#

f(1) = 1000

tawdry radish
#

f(x) = 800 + (x*200)
lets say x = 1
800 + 1 * 200 = 1000
lets say x = 2
800 + 2 * 200 = 1200
lets say x = 3
800 + 3 * 200 = 1400

#

proof

dawn parcel
#

i am officially getting confusedd

#

oh wait

#

your using another formula

gaunt berry
#

there are multiple ways

#

yes

tawdry radish
#

what you used?

dawn parcel
#

i think i am understanding that one

tawdry radish
#

i just do it like that

#

since it takes less computation

dawn parcel
#

This formula

tawdry radish
#

what is An?

dawn parcel
#

An = Number of terms or a specific term

tawdry radish
#

i see

dawn parcel
#

an could be replaced with Term number basically

#

So like Term5 = The First Term of the sequence + (Term4)*Difference

dawn parcel
tawdry radish
#

so
lets say x = 1

1000 + (1-1)200?

dawn parcel
#

That one for which term

#

like what level

gaunt berry
#

x = level

dawn parcel
#

oh

gaunt berry
#

level 1

tawdry radish
#

eh my formula better since one addition and multiplication

dawn parcel
#

Yes

gaunt berry
#

both are fine

tawdry radish
#

first one faster .-.

dawn parcel
#

your formula is more straight forward than mine

tawdry radish
#

anyways

#

you know js?

dawn parcel
#

i used more variables in mine which could give more info

#

noope :c

#

only python

tawdry radish
dawn parcel
#

i mean i can do a little bit of js

tawdry radish
#

mm

dawn parcel
#

the only thing i have done in js is a bot with a ping command and a purge command

#

thats it!

tawdry radish
#

you know about css and html then?

dawn parcel
#

yeah little bit

#

Not that much though

tawdry radish
dawn parcel
#

i will learn every programming language soon™️ blobcat

#

:trol;

gaunt berry
#

learn uwu++

#

its fun

#

trust me

dawn parcel
#

uwu++??

tawdry radish
#

uwu ++

dawn parcel
#

whaa which programming language is that loll

#

Never heard it

gaunt berry
dawn parcel
#

Really-

gaunt berry
#

its really good

dawn parcel
#

Smh

#

is that a real language or a fake funny language

gaunt berry
#

its a real language

dawn parcel
gaunt berry
#

you cant really do much with it but it works

dawn parcel
#

lol

gaunt berry
#

omg

#

im making the cube level calculator in uwu++

tawdry radish
#

:0

tawdry radish
gaunt berry
tawdry radish
#

may god have mercy on us

gaunt berry
#

this is great, the example doesnt work

#

this doesnt help either

tawdry radish
#

you need to pass in a html file?

gaunt berry
#

no

#

but i dont think i can get user input via <input>

#

sucks

rancid trail
wild shadow
tawdry radish
rich stump
#

@leaden cypress

#

@leaden cypress

#

this guy has spammed this link in 20% of chats

tawdry radish
rich stump
#

sorry lol

minor roost
#

hey

rich stump
#

hi

tawdry radish
#

elo

tawdry radish
#

@dense zinc i am your first github star happylime

dense zinc
#

I don’t do open source much

tawdry radish
#

i stared your about me page

dense zinc
tawdry radish
tawdry radish
#

@gaunt berry press ctrl + k on github weebsite

#

i liek new feature happylime

#

i can finaly look through my repos without going to my profile

gaunt berry
#

what does it do

dense zinc
#

^

gaunt berry
#

im in school rn i cant really test it

tawdry radish
#

np

#

test it when you come back

minor roost
#

Hi

gaunt berry
#

omg github copilot is so cool

#

i love it

gaunt berry
#

bro what is this

#

it predicts exactly what i want

#

with the correct variable name

#

with the correct everything

spring tiger
#

yes

#

it has its hiccups but its pretty good

gaunt berry
#

im in love

spring tiger
#

have you pressed ctrl+space, it will show you multiple solutions

#

i think thats the shortcut on vscode

gaunt berry
#

it isnt

spring tiger
#

ctrl+enter?

gaunt berry
#

alt + ]

#

according to the docs

#

but ctrl enter works too

#

dont really need it tho when it gets the right one every time

spring tiger
#

yeah alt + ] and alt + [ is to cycle them there and then
sometimes ctrl+enter can have a better solution when you read them than the one that it immediately suggests you in the code

ocean sparrow
#

I still can't figure out the shortcut in intellij

#

for >2 years that i'm using it

#

im just spamming my keyboard with stuff and hoping it pops up xd

gaunt berry
#

oh no

#

ive been trying to fix this bug for like 2 hours

#

only to then realize i forgot a promise

#

THANK U JAVASCRIPT VERY COOL

plush walrus
#

oof

gaunt berry
#

and then people ask me why i dont like js

#

this is why

tawdry radish
tawdry radish
#

@dawn parcel oi can you send me invite to your bot in dms not here

#

_the lvl calc thing happylime _

minor roost
#

js > ts

dawn parcel
#

It only works for whitelisted servers :O

tawdry radish
dawn parcel
#

There isn't really a testing server either

#

Only a public server

tawdry radish
#

sadcat send me link to public server then

tawdry radish
#

@gaunt berry https://www.youtube.com/watch?v=U3aXWizDbQ4 les go we got c in 100 seconds

The C Programming Language is quite possibly the most influential language of all time. It powers OS kernels like Linux, Windows, and Mac and many other low-level systems. Its syntax has inspired many other languages, including Cpp, Csharp, Java, JavaScript, Go, Perl, and more.

#programming #compsci #100SecondsOfCode

🔗 Resources

C Manuel h...

▶ Play video
#

haha print f be like

minor roost
#

int c = 0;
c++;

tawdry radish
gentle patio
#

Why do programmers have to wear glasses?

#

because they don't c#

subtle matrix
#

why does python live on land?
because it is above c level

dense zinc
wheat relic
#

I spent like 3hours working on code and it turns out I just forget one ,

#

Ew that reminds me I use to make android apps

#

And I was spending so much time on trying to open the calculator in the notes app

#

And I forgot 1 thing

#

But I made a hot browser app too

tawdry radish
#

linter op

tawdry radish
wheat relic
#

Some times I’ll use Intelliji or whatever it’s called

#

Or I’ll use a notes app

tawdry radish
#

use vscode mike

wheat relic
#

My guy

#

I like me wae better cause it was the way I was doing it in skool

#

In a notes app that has a preview screen

tawdry radish
#

you shall suffer cause of that blobcorn

wheat relic
#

nO

#

Suck egg

subtle matrix
#

Its not funny if I explain it though xD

subtle matrix
livid igloo
#

Idk I never used them XD

tawdry radish
spring tiger
#

Entirely depends on your use case 🙂

tawdry radish
#

no {} = bald blobcorn

tawdry radish
#

reee this took me 4 hours to find out what the error was

#

gonna start making client soon tho happylime

tawdry radish
#

how is this related to programing 💀

plush walrus
tawdry radish
#

lmfao

gaunt berry
#

git vomit

tawdry radish
#

me and the bois

minor roost
#

9223372036854775807

gentle patio
#

Created: Wed, 06 Sep 2084 15:47:35 UTC

#

2084

minor roost
#

january 1st, 1970

minor roost
#

Ooo very spoopy

plush walrus
#

Anyone has an idea why flask.request.remote_addr always returns 127.0.0.1 even when running on a server (gcloud app engine) and using waitress for running

from waitress import serve
serve(app, host="0.0.0.0", port=5000)```

https://flask.palletsprojects.com/en/2.0.x/api/?highlight=request%20remote_addr#flask.Request.remote_addr
spring tiger
plush walrus
tawdry radish
#

guys does anyone know how cc connects players to difference proxys?

tawdry radish
gentle patio
#

Cubecraft code

tawdry radish
#

what cubecraft code thonk

tawdry radish
# spring tiger .

i mean like
how you guys connect players to as proxy, us proxy and eu proxy? with one ip

#

and we even get different ping in different regions so i assume something happens thonk

spring tiger
tawdry radish
#

i did not mean match making
I ment like when players join the server

#

how do they get connected to different regions proxy with just one ip when you just join one ip

jade meteor
#

Hello

tawdry radish
tawdry radish
plush walrus
# distant pasture

I'm gonna pretend like it has NEVER happened to me and like I haveve NO IDEA what that site is about

tawdry radish
#

i don't have to pretend since i never typed github _its pined 😉 _

tawdry sorrel
#

Imagine

minor roost
#
printnbr = (n Number::Integer) {?n<0{print('-');printnbr(-n)}??n>9{printnbr(n/10);printnbr(n%10)}?!{print('0'+n)}}
hollow glade
#
console.log('hello world');

I guess I'm a programmer now...

hollow glade
minor roost
hollow glade
hollow glade
tawdry sorrel
#

Depends on the server

minor roost
#

Yes you can

gentle patio
gaunt berry
minor roost
gaunt berry
#

in reality youd use papermc anyway which is java

tawdry sorrel
#

Depends on the software like I'm not sure which this runs off but a good amount of stuff is done in pmmp which is PHP

hollow glade
tawdry sorrel
#

Yep

#

Just one that I know

hollow glade
gaunt berry
#

literally every other software is java

tawdry sorrel
#

Cap

gaunt berry
#

nah

minor roost
tawdry sorrel
#

How bout all bedrock things?

gentle patio
minor roost
#

even scratch if you can somehow add some io

gaunt berry
#

bds and pmmp are like the only softwares that arent java

tawdry sorrel
#

Fair enough

tawdry sorrel
hollow glade
minor roost
#

guys try C

gaunt berry
minor roost
#

it's simple and efficient

tawdry sorrel
#

Never really seen a language of c# but I imagine that it would be pretty good

hollow glade
#
console.log("yo look what I've learned right now")```

```JS
let aa = "aa"
console.log(aa + ">:)")```
gaunt berry
#

use ``

hollow glade
#

gtg applying to join the dev team for cubecraft

gaunt berry
#

pls

minor roost
#

quit javascript

tawdry sorrel
#

Yep

#

Skip to java c++ c or c#

minor roost
#

C by default

hollow glade
#

I'm learning java rn, but on Spigot API

tawdry sorrel
gaunt berry
#

js best

tawdry sorrel
#

Cap

minor roost
#

it's decent, better than the kids js