#development

1 messages · Page 76 of 1

spring pond
#

true

shy helm
#

The issue I take with most high school classes is you’re not going to learn fundamentals of CS, you’re going to learn basic programming

gaunt mountain
#

I think it's best if you just look at online documentations rather than paying for a course that teaches less stuff on the internet

#

Or if you're more of a tutorial guy like me, watch youtube videos.

spring pond
sweet ferry
#

I'm crazy happy hs has high school cs now

#

how long has that been going on lol

#

<< behind the times

shy helm
#

Mmm years lol, my father had programming in his high school

#

They used punch cards, they got mailed to the centralized “computer” to be run

sweet ferry
#

only was available in last grade for me

spring pond
#

oh wow thats interesting

sweet ferry
#

or 2nd to last

#

but I'm in Canada I dunno

shy helm
sweet ferry
#

lol

#

Montreal

spring pond
#

my hs had all of the classes except for a unity class before i got in

sweet ferry
#

damn imagine learning unity in hs

#

that'd be the best

shy helm
#

My high school had PHP/Visual Basic/Java classes

spring pond
#

id be interested to see high schools with an app dev class

shy helm
#

You learn so much more in 1st yr bCS though haha

#

Material is covered so much quicker

sweet ferry
#

yeah I believe it

shy helm
#

Lots of fumbling to build something that just “works”

sweet ferry
#

haha

spring pond
#

maybe offer it as a multi-year class

shy helm
#

That would be cool

spring pond
#

the logistics are probably super complicated but it'd be very cool yeah

sweet ferry
#

so basically the exact equivalent of any PHP project after some thousandaire bought it and brings it to freelancers to fix

#

oops

#

wrong convo lol

spring pond
#

lol

sweet ferry
#

but kinda applies

#

must be a horrible garbled mess that HS app project

spring pond
#

well im only posing it as a hypothetical

#

if implemented well it would work

sweet ferry
#

yeah

shy helm
#

Would probably have to provide some base template

sweet ferry
#

I'd just compartmentalize it so nobody can screw up

#

like you make a weapon, you make a skin, etc

shy helm
#

But would be feasible for a motivated teacher

sweet ferry
#

but the game itself is some kind of good code

#

could work

#

Sorry, that's if you were talking unity

#

garbled mess of an app then lol

#

I can't see that being compartmentalized easily

spring pond
#

the unity class i took in hs very much felt like a beta version

#

most of the resources were from the outside internet (which can be good but it didnt work in my case) and the curriculum felt a bit half-baked

#

but it could work with some refinement

sweet ferry
#

yup fair

#

what'd be cool is if a game circiculum actually released a game

#

and then the next year students worked on the next version of the same game

spring pond
#

the class originally planned for that in group projects but covid

sweet ferry
#

yeah

spring pond
#

maybe the class would have been a lot better

#

but i got stuck taking it at home

sweet ferry
#

ah yeah

#

I'm glad it's so commonplace

#

as is there is too much demand and not enough programmers

dim shard
#

Well nothing was really that hard

#

Name a few things you think might be hard?

sweet ferry
#

I mean what was the hardest part?

#

yeah

dim shard
#

Hmpff

sweet ferry
#

if I know what you found easy even

dim shard
#

collecitons

#

collections

#

objects

sweet ferry
#

okay

#

did you do data structures?

dim shard
#

elaborate

sweet ferry
#

that's something that'll get you ahead of everyone else

#

it's a hard class though that you will have later most likely

#

so data structures is like

#

have you heard of linked lists?

#

queues? stacks?

dim shard
#

easy

sweet ferry
#

oh

#

you're already there

dim shard
#

yea

sweet ferry
#

then you need a real project

#

how about this

#

figure out something you want to learn how to do

#

and I'll do my best to guide you there

#

like, wanna make a game? Do you want to make a website? I dunno 😉

earnest lotus
#

Can someone recommend a good guide to start using unreal engine? I just started and know basically nothing about it, my eventual goal is to recreate my neighborhood and have some climbing and shooting mechanics.

nocturne galleon
#

hey guys can anyone recommend a library for converting webp images to png? I've only found one that converts from png/jpg to webp

warm sleet
#

@nocturne galleon image magick?

nocturne galleon
#

nevermind, downloaded google's tools

#

and it taught me how to manually install linux software which is also cool

warm sleet
#

image magick is a library thats used for this sort of stuff

#

converts between all kinds of formats

#

commandline or header-binding with C

nocturne galleon
#

how come this script returns syntax error: unexpected end of file

warm sleet
#

got a new line at the end?

hallow pilot
#

Try out vs code with the "shellcheck" plugin. It can squiggle all sorts of problems in your shell scripts, which is great if like me you use them a lot but author them rarely

nocturne galleon
#

Hi, i have considered creating a basic rock paper scissors AI in excel. Have I gone totally crazy?

hallow pilot
spring pond
#

its very hit or miss if you get a response here lol

hollow basalt
#

hit or miss, I guess they never miss

nocturne galleon
cloud knot
#

there are lots of dev topics i could help you with, but i have yet to touch React 🤷‍♂️

native helm
#

pretty new to less, but I'm trying to understand whats a good way, if even possible, to do something like adaptive colors in an antd designed React app, ie if an elements background has a luma > 50% use black font color, otherwise use white.
My App component imports app.less and webpack takes all variables from my-theme.less into the less-loader options.modifyVars object.
I have something like this:

//--- app.less
@import '~antd/dist/antd.less';

.@{layout-prefix-cls} {
   &-header {
      // this replaces 'color: @text-color;'
      color: if(boolean(luma(@{layout-header-background}) > 50%), @black, @white);
   }
}

//--- my-theme.less
@primary-color: 'red';
@text-color: if(boolean(luma(@{primary-color}) > 50%), @black, @white);

But, instead of overriding the color in every component I'd like to achieve something like this:

//--- my-theme.less
@primary-color: 'red';
@text-color: if(boolean(luma($background) > 50%), @black, @white);

And then have @text-color evaluated on each usage, with $background refering to that elements own or inherited background property, instead of having to override every color: @text-color; on every component in antd. This whole venture started when I noticed that the default antd layout header is dark, and using a <Title level={3} /> in it causes the text to be unreadable...

dense scroll
#

I'm trying to remove everything between /* and */. I'd need a wild card. Does anyone know what's the wild card in Atom (text editor)?

hallow pilot
twilit pawn
#
const bot = new Discord.Client();

const token = 'My-Token-lol';

bot.on('ready', () =>{
    console.log('This bot is Online!');
})

bot.on('message', msg=>{
    if(msg.content === "HELLO"){
        msg.reply('Hello Friend!');
    }
})

bot.login(token);```

Basically, im setting up sole basic stuff for a bot. I was able to get the bot to go online, but when I type HELLO in a chat, the bot doesn’t respond back.

It’s supposed to respond back. •_•

What did I do wrong? And what should I fix?
#

Node.js btw

thick heron
#

so add this into the if statement

console.log('Got through!');

twilit pawn
#

Btw, it said this 👀

Problems:
‘,’ expected. ts(1005) [16, 1]
‘)’ expected. ts(1006) [16, 17]

(Last line, its the bot.login(token);

#

Should’ve mentioned this earlier…

thick heron
#

Go check for a missing semicolon

#

or something

#

I see 2 spots but I'll let you figure it out

twilit pawn
#

I’ll check rn. 🙂

thick heron
#

I would highly recommend learning JS before making a Bot

twilit pawn
#

I’ve actually been doing so on a website that teaches js. This is just a free time project to try out, so im not really getting too far into it

spring pond
#

counterpoint: project-based learning is a pretty good way to learn a programming language, especially with something this basic

twilit pawn
spring pond
#

i was responding to the guy before you, im saying what you're doing is good lol

twilit pawn
#

Oh 👀

twilit pawn
#

Late response, just read over what you said; I thought “counterpoint” was a website to learn💀

twilit pawn
twilit pawn
#
const bot = new Discord.Client();

const token = 'My-Token-lol';

bot.on('ready', () =>{
    console.log('This bot is Online!');
});

bot.on('message', msg=>{
    if(msg.content === "HELLO"){
        msg.reply('Hello Friend!');
    }
});

bot.login(token);```
#

I think I found it

#

Nope, didn’t work.

midnight wind
#

or just logic errors

twilit pawn
midnight wind
#
bot.on('message', (msg)=>{
    if(msg.content === "HELLO"){
        msg.reply('Hello Friend!');
    }
});```
twilit pawn
midnight wind
twilit pawn
#
const bot = new Discord.Client();

const token = 'My-Token';

bot.on('ready', () =>{
    console.log('This bot is online!');
});

bot.on('message', (msg)=>{
    if(msg.content === "HELLO"){
        msg.reply('Hello Friend!');
    }
});

bot.login(token);```
tall kernel
#

use go 👀

hazy oasis
#

When developing Discord bots, do you use Python or JavaScript? React with the appropriate emoji. (🔵 = Python, 🟡 = JavaScript)

midnight wind
#

python is a pita sometimes

#

well I use typescript

#

with the deno runtime

green yacht
#

Whoops I just built a bot with python…

nocturne galleon
#

How does this happen

wise jolt
#

Btw, do you guys know a full time, free hosting platform coz I cant find it, I even tried heroku and even that has its own defects for running free, like restarting and stuff like that

midnight wind
#

Even self hosting technically isn't because running costs

#

I self host my bots

#

I want to eventually get them to work on kuberetes

wise jolt
wise jolt
midnight wind
#

Linux

wise jolt
#

Oh yeah me too

midnight wind
#

No other option lol

wise jolt
#

Task scheduler is a mess

#

I dual booted for good

midnight wind
#

Well I'm running it all on a proxmox hupevisor

#

Which is still debian

#

I have a seperate computer for learning kuberetes which is off for now

midnight wind
wise jolt
#

Which distro in linux

midnight wind
#

Ubuntu

wise jolt
#

Oh

midnight wind
#

Technically kde neon

wise jolt
midnight wind
#

Because gnome is ugly

wise jolt
#

I am using Fedora 34

wise jolt
midnight wind
#

Red hat based stuff is alright as well

wise jolt
#

It's customisable

wise jolt
midnight wind
wise jolt
#

And fedora 34 has Gnome 40 which is just plain amazin

midnight wind
#

Kde imo is much better

wise jolt
#

I actually never experienced KDE

midnight wind
# wise jolt Yeah

I used to use centos for my servers but now they switched to rolling release

wise jolt
#

Use Fedora

#

It's super stable

midnight wind
#

Fedora is rolling too

#

You do realize

#

Fedora and centos are basically very very similar

wise jolt
#

Yeah

#

I just hate dnf or the repo servers idk how it works but the speed is pretty low

#

It takes a lot of time for updates sometimes

midnight wind
#

Find a close mirror server

wise jolt
#

How can I do that?

midnight wind
#

Idk exactly

#

@wise jolt use fast mirror

wise jolt
#

Oh

midnight wind
#

Put in a list or severs

wise jolt
#

All right

#

I'll give it a try

midnight wind
#

It will apparently find the fastest one or something like that

wise jolt
#

I'll need it in the future

midnight wind
#

@wise jolt mirror list

wise jolt
#

Thank you, I'll check it out

hazy oasis
#

It's what I use

#

They host your bot for free on DigitalOcean and if you have an active AWS subscription, you can use their website to host your bot their too

#

You just need a github repo and it's advised to have your own Dockerfile

wise jolt
#

All right

#

Why didn't I think of AWS

nocturne galleon
#

You can also host directly on github

hazy oasis
#

How come I never knew about this?

#

Ah but no use to me

#

I use Python and Github doesn't support dynamic content

midnight wind
#

@hazy oasis that's just static files

nocturne galleon
#

Really?

#

Huh

#

I meant the Github pages thing

midnight wind
#

Which is fine for just info pages, but you will have no backend

#

Its meant for info pages

granite gazelle
#

Anyone familiar with opengl3?
Trying to render a line 😅

river hedge
#

Yeh i am

granite gazelle
#
static int compileShader(unsigned int type, const std::string& source)
{
    unsigned int id = glCreateShader(type);
    const char* src = source.c_str();
    glShaderSource(id, 1, &src, nullptr);
    glCompileShader(id);

    int result;
    glGetShaderiv(id, GL_COMPILE_STATUS, &result);
    if (result == GL_FALSE)
    {
        int len;
        glGetShaderiv(id, GL_INFO_LOG_LENGTH, &len);
        char* message = (char*)alloca(len * sizeof(char));
        glGetShaderInfoLog(id, len, &len, message);
        std::cout << "Failed to compile " << (type == GL_VERTEX_SHADER ? "Vertex" : "faragment") << "  shader!" << std::endl;
        std::cout << message << std::endl;
        glDeleteShader(id);
        return 0;
    }

    return id;
}

static unsigned int createShader(const std::string& vertexShader, const std::string& fragmentShader)
{
    unsigned int program = glCreateProgram();
    unsigned int vs = compileShader(GL_VERTEX_SHADER, vertexShader);
    unsigned int fs = compileShader(GL_FRAGMENT_SHADER, fragmentShader);

    glAttachShader(program, vs);
    glAttachShader(program, fs);
    glLinkProgram(program);
    glValidateProgram(program);

    glDeleteShader(vs);
    glDeleteShader(fs);

    return program;
}
#
void testDraw(float x1, float y1, float x2, float y2)
{
    float pos[4] = {
        x1, y1,
        x2, x2
    };

    unsigned int buffer;
    glGenBuffers(1, &buffer);
    glBindBuffer(GL_ARRAY_BUFFER, buffer);
    glBufferData(GL_ARRAY_BUFFER, 4 * sizeof(float), pos, GL_STATIC_DRAW);

    glEnableVertexAttribArray(0);
    glVertexAttribPointer(0, 2, GL_FLOAT, GL_FALSE, sizeof(float) * 2, 0);

    std::string vertexShader =
        "#version 330 core\n"
        "\n"
        "layout(location = 0) in vec4 position;\n"
        "\n"
        "void main()\n"
        "{\n"
        "    gl_Position = position;\n"
        "}\n";

    std::string fragmentShader =
        "#version 330 core\n"
        "\n"
        "layout(location = 0) out vec4 color;\n"
        "\n"
        "void main()\n"
        "{\n"
        "    color = vec4(1.0, 0.0, 0.0, 1.0);\n"
        "}\n";

    unsigned int shader = createShader(vertexShader, fragmentShader);
    glUseProgram(shader);

    glDrawArrays(GL_LINE, 0, 2);
}
granite gazelle
#
void Menu::Render()
{

    getWindowSize();

    glfwPollEvents();

    // Start the Dear ImGui frame
    ImGui_ImplOpenGL3_NewFrame();
    ImGui_ImplGlfw_NewFrame();
    ImGui::NewFrame();

    if (menuShow)
    {
        static int counter = 0;

        ImGui::Begin("Hello, world!");
        ImGui::Text("This is some useful text.");
        if (ImGui::Button("Button"))
            counter++;
        ImGui::SameLine();
        ImGui::Text("counter = %d", counter);
        ImGui::Text("Application average %.3f ms/frame (%.1f FPS)", 1000.0f / ImGui::GetIO().Framerate, ImGui::GetIO().Framerate);

        ImGui::End();
    }
    
    

    testDraw(width / 2, height / 2, 1, 1);


    // Rendering
    ImGui::Render();
    int display_w, display_h;
    glfwGetFramebufferSize(window, &display_w, &display_h);
    glViewport(0, 0, display_w, display_h);
    glClear(GL_COLOR_BUFFER_BIT);
    ImGui_ImplOpenGL3_RenderDrawData(ImGui::GetDrawData());

    glfwSwapBuffers(window);
}

Might help if I show how I try to render this aswell 😅

#

I was thinking maybe some of the imgui stuff might be binding another buffer , but I can't find any evidence for this. Also selecting it again doesn't do anything, so prob not...

manic apex
#

Is there any free or cheap vps

tepid relic
hollow basalt
#

vps providers usually free "credits" or trials

manic apex
hollow basalt
#

can you give more information

manic apex
hollow basalt
#

i know

manic apex
hollow basalt
#

create it yourself

manic apex
hollow basalt
#

google

nocturne galleon
nocturne galleon
#

whats a const??

#

is it a variable

grizzled steeple
#

In JavaScript const defines a readonly, block-scoped variable, let defines a block-scoped variable and var a global variable

cloud knot
#

well 'deprecated' - in a sense it is not recommended to use it, but as it is a legacy thing, it will stay in language

#

const and let are block scoped, while var is function scoped, which is sometimes really not what one wants 🙂

wraith relic
#

@cloud knot Var ain't deprecated 😅

cloud knot
#

read my last line

#

it is deprecated in meaning of 'please don't use it, even if it stays in the language'

wraith relic
#

I don't use it, but it will take many many years before deprecated

ivory bear
grizzled steeple
#

Yeah, I oversimplified, I know...

green yacht
#

WAIIIITTTT you can host discord.js files on github???

midnight wind
#

well

#

you can host the files

#

it's literally the purpose of github

green yacht
#

what would I use to run them?

midnight wind
#

but you can't deploy it

midnight wind
#

service

#

etc.

green yacht
#

so I have to have one on at all times

midnight wind
#

you can deploy it in a VPS

#

in the cloud

green yacht
#

Time to whip out a raspberry pi

midnight wind
green yacht
#

I can find a way to host the bot on a raspberry pi

midnight wind
green yacht
#

theres always a way...

midnight wind
#

it's literally just linux

#

so ofc you can

green yacht
#

but you can turn it into a server for websites

midnight wind
#

yes it's just linux

#

ofc you can

green yacht
#

yes

#

ohhh

midnight wind
#

nothing special

green yacht
#

but still dirt cheap compared to renting room on a server

midnight wind
#

if you compare hardware costs

#

internet costs

#

power

#

and then you have uptime

green yacht
#

unlimited interet

#

power is not an issue with pi

midnight wind
#

you won't get 99.9% uptime at home

green yacht
#

The server is only 15 people...

midnight wind
#

ik

#

just saying

#

I myself have servers at home

green yacht
#

our interenet and power never go out

#

E V E R

#

in the past 5 years

midnight wind
#

it can

green yacht
#

it will take awhile for anyone to notice though

green yacht
#

are those computer towers?

#

or nas towers?

midnight wind
green yacht
#

k

midnight wind
slate frigate
#

Rack mount best mount

midnight wind
slate frigate
#

Total lab resources so far: 350 GHz processing power, 568gb ram, and 35+ TB of storage.

midnight wind
#

one day

#

rn I don't need that much

cloud knot
#

i got more storage tho, 38TB spinning rust in one system + 3.25TB SSD, 32TB spinning rust + 64GB SSD in other (this one is just a backup of first one 😛 ).

green yacht
#

and jellyfish must die

midnight wind
#

it's just a regular comptuer

midnight wind
#

I use jellyfin

#

pretty good

slate frigate
#

Jellyfish is a boutique NAS company

midnight wind
#

oh jellyfin as in a nas

#

I thought jellyfin as in software

cloud knot
#

the only good NAS i ever seen was the HP Microserver lineup, in EU they also had some crazy pricing for older models

#

(but i guess we should take the NAS topic to #tech-chat's)

midnight wind
#

get a server

#

there

#

you got a NAS

cloud knot
# midnight wind just diy it

i do have a DYI NAS, which is also a proxmox VM server, OMV NAS, Docker host etc. Just saying that HP Microservers were a nice middle point between DIY and low performance NAS boxes

#

for 150-200 euros, you got a small, 4 bay system with G1610T, 4GB RAM and often even 250GB HDD back then in ~2012-2013?

red mulch
#

yep

#

I still have one

#

I also swapped out the PSU for a picoPSU and a dell 12V power brick

nocturne galleon
#

Hi, im making an artifficial neural net (in excel, but that doesnt matter for my question) wich has 3 input neurons and 3 output neurons. How many hidden layers, and how many neurons in those, do you recommend?

slate frigate
#

None, at least in excel

#

Python, mah dude

nocturne galleon
#

well... I could make it with tensorflow in 30 minutes (if not even less) but i want to do this in excel as i thereby show my understanding of the math behind. Cause, it is basically nothing more than calculus

midnight wind
#

just do it raw in python

#

or any other lanuage

#

surely it would be easier than excel

nocturne galleon
#

THAT IS NOT MY POINT. My audience is 8th grade. They dont understand Python! Let me make it in excel

nocturne galleon
#

I wanna burn my time

#

i have 8 hours to do it

#

so... its not like its impossible

midnight wind
#

I feel if you try to explain in excel that will not help much with understanding

#

if anything python would be easier to explain

nocturne galleon
#

But its fun...

midnight wind
#

or if you really want students to understand, use visuals

slate frigate
#

If you want to really enrich any audience, do it in python and break down the math. The abstracting you have to do to get it to work in excel will only harm your audiences understanding

nocturne galleon
#

Its also an exercise for me

midnight wind
#

like 3blue1brown

slate frigate
#

You need to decide if you're doing it for yourself, or your audience then.

nocturne galleon
#

Im doing it for myself

slate frigate
#

Then go fire away at it. Abstract the python into excel formulas

nocturne galleon
#

and im not trying to explain the mathematics of it

slate frigate
#

But no one else is gong to want to help you break new ground on this because it serves no purpose

nocturne galleon
#

whatever

rose pulsar
#

How can I set up Visual Studio Code (Linux) to run C programs
I installed the extension for C/C++ that it suggested but I still can't run a program from within VSC
Or are terminal commands the only way to do it

nocturne galleon
#

It's 2 am and I'm out here tryna code

#

Also is there a chat for coding

#

or am I blind

snow stone
nocturne galleon
#

Then this would be the appropriate chat for it, yes

snow stone
#

i presume

midnight wind
#

you still need to setup a build processes

#

I like cmake

#

but for something simple you can just use gcc

#

gcc source.c

#

very basic example

rose pulsar
#

ye ive already got gcc on linux here
I can access it and run programs using terminal, but I want to be able to just push the button in vsc like I could with java or python

#

Or does C work differently

midnight wind
#

that's what I do for js

rose pulsar
#

extra effort
to type the commands

midnight wind
rose pulsar
#

ye ik

midnight wind
#

so you can use tasks

rose pulsar
#

my point is that with python or java i can just push the green play button and it runs it instantly

midnight wind
#

yeah

#

for python I use terminal anyway

#

ah

#

you can have a run task too

#

pretty sure

#

says c++ but you can obv mod it

slate frigate
#

Since stuff like python is compiled at run time ( line by lime), it lets you do things easily in the IDE

#

Compiled languages have to be compiled first, which can often take a decent amount of time to do depending on the size and complexity of the program.

#

So IDE's generally don't support compiling straight to running, although some do support debugging already compiled programs

rose pulsar
#

oh
ye, I think I get it now
thanks @midnight wind @slate frigate

slate frigate
#

👍

twilit pawn
#
            if(!args[1]) return message.reply('Error- please define second argument')
            message.channel.bulkDelete(args[1]);
            break;```

Java Script:

How would I make it so it deletes the actual command PLUS the number of messages I told it to delete
lament cave
twilit pawn
lament cave
#

depends on what you want it to do

twilit pawn
#

I just want it to delete the trigger and then the number of messages

#

example:

!clear 5

  • bot deletes my !clear 5 message *

*bot deletes 5 messages *

minor crag
#

what yall think will be added into the new big update for windows? they said it will be a focus for developers,

personally i think they will build on the whole concept of 'fluent design' -- they already have a set of styles, but more control for the devs (example of a system for integration of themes across controls, animation speed, colors of one state to another etc would be appreciated)

also bringing all that to wpf instead of locking it to uwp -- they did say they are opening microsoft store up to outside of just msix packages, which means they need to expand those feature sets for parody (we know winforms are long dead so i dont expect anything there)

midnight wind
#

make it a wine os

slate frigate
#

Or just use wsl. That’s what they’ve been putting a lot of work into

midnight wind
slate frigate
#

What bloat? I have no increase to my boot time to use it

#

It’s literally just hyper v

midnight wind
slate frigate
#

So rip down windows. There are dozens of clean up scripts that do a great job of slimming it down

midnight wind
#

yeah true

slate frigate
#

Saying the bloat is the reason you don’t use windows isn’t valid, compared to all the other perfectly valid reasons to use Linux.

midnight wind
#

rn I've been dual booting

slate frigate
#

The way I see it, for Linux I need to build up to the environment I like using, windows I have to strip down. Different strokes for different folks.

midnight wind
#

windows is needed for basically any engineering work

nocturne galleon
#

It says that there is an ambiguity between the lastPoint, any help?

#

What I was trying to do is make the whole thing draggable and I think it went horribly wrong

#

Where have I gone wrong?

cloud knot
#

private object lastPoint;
Point lastPoint;

#

you declared a property called lastPoint twice, once as object, then as Point

#

@nocturne galleon ^

nocturne galleon
#

can you correct it pls :3

nocturne galleon
#

im not too sure what im changing

cloud knot
#

i have no idea what your code is supposed to be. i am just saying you got two different variables with same name

nocturne galleon
#

what do i change it to

#

im a newbie

#

do i change it to object latPoint

#

lastPoint^

midnight wind
#

can't have variable with the same name

#

programming 101

nocturne galleon
#

I am legit so new to this

midnight wind
#

also

#

RobloxHacks

hollow basalt
nocturne galleon
brittle flume
#

anyone knows java? iam trying to learn, got a question

#

like it prints out "this is an integer" if i input an integer

#

anyone?

dense mulch
#

@brittle flume

brittle flume
#

iam not sure how to use those 😦

#

iam super new, just started learning

dense mulch
#

Is there a specific reason you started with Java?

brittle flume
#

not specific but basically wana start with website/web development and everyone says java is a must have for that sort of stuff

dense mulch
#

No no

#

JavaScript

brittle flume
#

oh no i havent thought about learning javascript, iam learning java atm

dense mulch
#

But JavaScript is for web development

brittle flume
#

oh

#

java should also be in there right? i have heard that you can also use that in web development

dense mulch
#

Eh, not really, you could run anything on the web backend, but client side javascript is simply said the only/best option

brittle flume
#

ah, what is java mostly used in?

brisk latch
#

Android dev is still a lot of java

dense mulch
#

Programs

brisk latch
#

but kotlin is kinda replacing

brittle flume
#

ah, well i have started on it guess i will finish this one first theb

dense mulch
#

Ye, well, I'm gonna piss off people with saying this, but Java is kinda dying

brisk latch
#

You could change to c#. Syntax is pretty much the same but you have the modern Xamarin platform

#

*switch

dense mulch
#

But for web development tho... JavaScript is just the one option

brisk latch
#

agreed

minor crag
# nocturne galleon What I was trying to do is make the whole thing draggable and I think it went ho...

oh i have a nice script for this,

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Threading;

namespace SkylineUI
{
    public partial class Form1 : Form
    {
        int mp = 0;
        Point mouse1 = new Point();
        
        public Form1()
        {
            InitializeComponent();
        }

        private void Form1_Load(object sender, EventArgs e)
        {
            Thread winDrag_thread = new Thread(window_drag);
            winDrag_thread.Start();
         }

        private void window_drag()
        {
            while (true) {
                if ((mouse1.X >= 0 && mouse1.Y <= this.Size.Width) && (mouse1.Y >= 0 && mouse1.Y <= this.Size.Height) && MouseButtons.HasFlag(MouseButtons.Left) && (mp == 1)) {
                    BeginInvoke(new Action(() => {
                        mouse1 = this.PointToClient(Cursor.Position);
                    }));
                    mp = 2;
                } else if ((MouseButtons.HasFlag(MouseButtons.Left)) && (mp == 2)) {
                    BeginInvoke(new Action(() => {
                        this.Location = new Point((PointToScreen(Cursor.Position).X - mouse1.X) / 2, (PointToScreen(Cursor.Position).Y - mouse1.Y) / 2);
                    }));
                } else {
                    mp = 0;
                }

                if (mp != 0) {
                    Thread.Sleep(1);
                    //without this sleep -- memory* usage will be much higher due to many invoke calls, cpu usage is also minimused, 
                } else {
                    Thread.Sleep(10);
                }
            }
        }

        private void Form1_MouseDown(object sender, MouseEventArgs e)
        {
            if (mp == 0) {
                mp = 1;
            }
        }
    }
}

``` (edit: missed the var at top ;-; srry)
nocturne galleon
#

DO i just add the previoud refernces and I'm chilling?

minor crag
nocturne galleon
#

okie

#

ty

minor crag
#

np, lemme know if it works .-.

nocturne galleon
#

will do

minor crag
#

. _ . still remember the cursed night i wrote this, i have no fkn clue why this '/2' exists, according to my calculations it shoulda worked without it,

dunno how long i spent debugging that ;-;

placid panther
#

hey everyone I'm new on the server. Was wondering if this channel is strictly for dev dev code bytes talk or do you guys share any advice about job hunting in Vancouver and remote?
I'm a recent grad so just looking for support. 🤗

slate frigate
#

I don’t know about anything specific up in Canuck land, but i do have some general tips and tricks for hiring.

slate frigate
placid panther
#

Thanks! should i dm u or is it cool to chat here?

slate frigate
#

Dm is fine

hollow basalt
#

@slate frigate

slate frigate
#

@hollow basalt What's up?

hollow basalt
#

just pinging

#

❤️

twilit pawn
#
const { MessageEmbed } = require('discord.js');
module.exports = {
    name: 'userinfo',
    descriptions: "This gives us the users information.",
    execute(message, args){
        const newEmbed = new MessageEmbed()
        .setColor('#32e9db')
        .setTitle('About Me')
        .setImage(message.author.avatarURL())
        .setTimestamp()
        .addFields()
        .setDescription('Account Creation')
        .setDescription(message.author.createdAt)
        .setDescription('Joined Server')
        .setDescription(message.author.joinedAt)

        message.channel.send(newEmbed);
    }
}```


Im trying to make an embed but I cant figure out how to make it look neat
#

Example^

#

What do I do :/

#

.js btw

twilit pawn
#

Figured it out, nvm.

twilit pawn
#

are you asking me, orrrrrrrrr

warm sleet
#

@brittle flume Integer.tryParse()

#

oh that's right, java doesn't have that, thats C#

#
public int tryParseInt(String value, int defaultVal) {
    try {
        return Integer.parseInt(value);
    } catch (NumberFormatException e) {
        return defaultVal;
    }
}
#

Integer.parseInt() raises an exception if the string is not an integer

brittle flume
#

I see

midnight wind
#

The 2 are nothing alike

#

Just the name

brittle flume
#

I see, I started learning java I guess I will finish this one first?

warm sleet
#

@brittle flume you can do web dev in java, as you can with any language

#

its just a matter of picking the best tools for the job

#

Java is heavily used on server side software, backend systems, APIs, and database applications

midnight wind
#

You can make backend in java, just not any client running code

#

Unless there is some java -> javascript compiler thingy

brittle flume
#

I see

hollow basalt
#

but most of those projects aren't really popular

grizzled steeple
#

JVM completely written in JavaScript. Let's goo! /s

warm sleet
#

There's v8 in JVM, though it got removed

#

I've used this before

#

Its quite neat.

#

Too bad it got removed with java 11

#
import javax.script.*;

public class EvalScript {
    public static void main(String[] args) throws Exception {
        // create a script engine manager
        ScriptEngineManager factory = new ScriptEngineManager();
        // create a Nashorn script engine
        ScriptEngine engine = factory.getEngineByName("nashorn");
        // evaluate JavaScript statement
        try {
            engine.eval("print('Hello, World!');");
        } catch (final ScriptException se) { se.printStackTrace(); }
    }
}
twilit pawn
#

Okayyy I fixed my previous issue, now I basically have a question.

                {name: 'Joined Server:', value: message.member.joinedAt, inline: true},
                {name: 'Joined Discord:', value: message.author.createdAt, inline: true}```

How do I make this code come out as 

Joined
Tue, Mar 30, 2021 2:02 AM
Registered
Sat, Feb 16, 2019 12:41 AM```

Instead of

Mon Mar 29 2021 23:02:35 GMT-0700 (Pacific Daylight Time)
Joined Discord:
Fri Feb 15 2019 21:41:14 GMT-0800 (Pacific Standard Time)```

Any tips?
#

.js btw

warm sleet
#

need a date formatter

#

should check first if its not an object

#

idk much nodejs libraries

midnight wind
#

unless you want to write one yourself

warm sleet
#

please don't.

midnight wind
#

lol

#

for my bot I use luxon

#

it also supports deno, which is why I use it

warm sleet
#

I've never heard of either of those things

#

whatever happened to, a standard library? where everyone does it the same way :P

midnight wind
#

there is a DateTime object

#

it's just limited in what it can do

warm sleet
#

'tis a shit language

midnight wind
#
[${launchDate.toFormat("ccc',' MMMM' ' d ', ' H':'mm 'UTC'")}](https://www.inyourowntime.zone/${launchDate.toFormat("y-LL-dd_HH.mm_'UTC'")})```
#

what I need it for

#

and

#

launchDate.diffNow().toFormat("'In 'd' days, ' h ' hours, and ' m ' minutes.' ");

warm sleet
#

@midnight wind lolwat

#

what is this service

midnight wind
#

there's no other one

#

I could find

warm sleet
#

rip

midnight wind
#

rip

#

website kinda sucks

#

but like

#

anything else that does something similar

warm sleet
#

it sucks is an understatement

#

it plain doesn't work

midnight wind
#

it worked

#

when I added it

warm sleet
#

emphasis on worked

midnight wind
#

yep

warm sleet
#

I bet one of their thousand js libraries had a breaking change

warm sleet
#

🔥

midnight wind
#

lol

warm sleet
#

🧯 🏃‍♂️

#

oh man

midnight wind
#

@warm sleet thanks to you

#

I found something

warm sleet
#

decade old version of Apache

#

at least they got latest php kek

#

not 5

midnight wind
#

there

#

even supports titles

#

this is just what I needed

#

something simple

grizzled steeple
#

I still use Moment.js when I need more specific date formatting. Great thing about moment is that you don't have to send off the date to an external API. Naturally, this makes the API quite big...

warm sleet
#

whatever happened to UNIX and ISO 8061

ivory bear
#

looks like people taking advantage

ivory bear
#

Countless popular websites including Reddit, Spotify, news outlets the Guardian, BBC, Financial Times are currently facing an outage. Typically an outage of this nature occurs when a vital internet infrastructure service faces an issue. An apparent glitch at Fastly, a popular CDN provider, is thoug…

midnight wind
midnight wind
midnight wind
grizzled steeple
ivory bear
brittle flume
#

whats a good ide for java

spring pond
#

intellij

brittle flume
#

iam already using eclipse

#

but i wana try other once to

spring pond
#

intellij and the other jetbrains ides are the best ones ive used

brittle flume
#

aight, I'II try that

warm sleet
#

@brittle flume IDEA is by far the best java IDE

#

it fully integrates with maven, unlike many other editors cough eclipse cough

brittle flume
#

idea is IntelliJ?

warm sleet
#

IntelliJ is a platform

brittle flume
#

oh, i got IDEA community version, thats the one, i thought the name is intellij

warm sleet
#

@brittle flume IntelliJ IDEA was the original editor jetbrains worked on

#

but these days, the IntelliJ platform is used in all of their editors

#

so plugins for intellij can also be used on their other IDE's like PyCharm, or WebStorm

#

IntelliJ Community Edition is the one you should get

#

you don't need ultimate

brittle flume
#

nice!

warm sleet
#

@brittle flume afaik, the only things missing from IntelliJ is the plugins for other languages like javascript, typescript, python, php and such

#

as well as all the Java Enterprise integrations

#

database integration is also missing from community

#

all features, you'll never need as a noob

brittle flume
#

nice!

nocturne galleon
cloud knot
midnight wind
#

that domain doesn't even have an A record

#

lol

midnight wind
#

wtf is this

warm sleet
#

Linus Drop Tips Simulator 2021

#

Realistic PC dropping experience

lost dragon
warm sleet
#

map().reduce() ftw

nocturne oyster
#

anyone wanna help me with a html project

brittle flume
#

i got a question

#

i think i understand it but i wana confirm, so here iam just taking all the values of arr variable and assigning them to the variable element?

warm sleet
#

@brittle flume for has two ways that it can be used

#

either you specify an indexer, for (initializer; condition; iterator)

which in code might look like:

for (int i = 0; i < 10; i++) {
  System.out.println(i);
}
#

or you can use an iterable dataset like an array or list, or any other kind of collection

brittle flume
#

oh yeah i know about that one, 1 sec

warm sleet
#

those can be used as such:

String[] foo = {"One", "Two", "Three"};

for (String bar : foo) {
    System.out.println(bar);
}
brittle flume
warm sleet
#

do you know how to use your debugger?

brittle flume
#

console?

warm sleet
#

you can set a breakpoint at that println

#

and then run the program with debug

#

and you can step through the loop

#

one element at a time

brittle flume
#

how do i add the breakpoint?

warm sleet
#

you're using intellij?

brittle flume
#

eclipse

warm sleet
#

err

#

usually

brittle flume
#

but i do have intellij

warm sleet
#

you click left of the line in the editor

#

next to the number

#

You click where that red circle is

#

when your program hits this line of code while running

#

it will pause

#

and you can see what its actually doing

#

while running

#

debugger is very important, helps narrow down problems and spot potential mistakes you made

#

debugger itself

brittle flume
#

i need to be on intellij for this?

warm sleet
#

has a couple buttons and things you can do with it

#

eclipse has a debugger too

#

idk how to use it though, years and years ago

#

just make a breakpoint

#

and run the program with debug

#

the debugger should pop open in a toolbar

brittle flume
#

i dont see the debug console on intel, it only shows terminal

warm sleet
#

oh

#

@brittle flume click on Setup JDK

brittle flume
#

this one?

warm sleet
#

click on 14

#

@brittle flume you should actually create a new project

#

You can use 14 there

#

I'm using 1.8 (because older projects)

brittle flume
#

aight, made new project

warm sleet
#

ok did you select maven?

brittle flume
#

yup

warm sleet
#

ok in your src directory, there should be a src/main/java

brittle flume
#

yeah

warm sleet
#

Okay, so let me briefly explain

#

maven is a project management tool

#

the entire compilation and other code libraries it may need, are defined in the pom.xml

#

"Project Object Model"

#

Its just easy, to learn this at same time

#

because if you ever want to use some cool libraries to build things

#

you'll need this

brittle flume
#

gotcha

warm sleet
#

okay so your source code is in src/main/java

#

its customary to make a package in here

#

in your case

#

I'd use me.nick.testproject

#

for companies, its usually com.google.project.subcomponent

#

its a way to structure your program

#

Example ^

brittle flume
#

aight, made the package

warm sleet
#

ok then in there

#

create a class

#

and then there's a trick: inside the class do the following:
type psvm and press TAB

#

that's an entrypoint to start your program

brittle flume
#

oh wait can you make the class file with public static void main thing already writted

warm sleet
#

you can create a main method anywhere in your code

#

and tell intellij to run it

#

@brittle flume usually, when you start up a java program, do it like such: java -jar foo.jar path.to.the.MainClass

brittle flume
#

aight, where do i put psvm

warm sleet
#

in your main class

#

you have 1 class, which you pass to the java vm during startup

#

and itll search for a function called main

#

and start running your program from there

brittle flume
#

gotcha! its there!

#

i still dont see the output for some reason

brittle flume
#

got it!

warm sleet
#

@brittle flume ok now put the following code in:

brittle flume
warm sleet
#

@brittle flume if you click on that

#

it just shows you how the program is launched

#

its just intellij

#

that's the raw command it runs

#

before it started

brittle flume
#

ah aight, I'II probably use intellji as main ide now, was confused a little before

warm sleet
#

@brittle flume ok now your debugger

#

put in this code:

    public static void main(String[] args) {
        String[] strings = {"One", "Two", "Three", "Four", "Five"};

        for (String s : strings) {
            System.out.println(s);
        }
    }
#

put a breakpoint on the println

#

Then run the program again, but this time with the debugger (the bug symbol)

#

And then it should show you this:

#

so currently, its inside main, on line 9

#

and on the right, you can see the local scope of variables that are accessible

#

Now you have two things you can do

#

you can hit the green button on the left, which will resume the program, until it hits the next breakpoint

#

Or

#

you can go through your program

#

line by line

#

With this button

#

if you call another function, you can also step into that function (thats the button next to it)

brittle flume
#

looking for my debug screen, cant find it

warm sleet
#

@brittle flume look in the top right

#

see the |> and bug icon

#

@brittle flume dont put underscores in class or method names

#

in fact, java doesn't really see any underscores used in field or variable names

#

unless

#

its a static constant

#

public static final String WELCOME_MESSAGE = "Hello and welcome!";

#

you don't have to do this

#

but if you ever show your code to someone else, they might just throw up

#

its just clean code in java

brittle flume
#

ah i see, i was using _ as alternative for space lol

#

oh you can popout the debug screen to

#

cool

warm sleet
#

@brittle flume classes are always uppercase

#

MyBlaComponent

#

fields and parameters as well as methods are written as camelCase

brittle flume
#

gotcha!

warm sleet
#

packages always lowercase as well

#

only single words

#

plural is bad form

#

use singular

brittle flume
#

got it

warm sleet
#

Snake case (stylized as snake_case) refers to the style of writing in which each space is replaced by an underscore (_) character, and the first letter of each word written in lowercase. It is a commonly used naming convention in computing, for example for variable and subroutine names, and for filenames. One study has found that readers can re...

#

linux kernel is written like that ^

brittle flume
#

so i was using snake case?

warm sleet
#

ye

#

@brittle flume its just conventions

#

java uses only for static constants, or enums (which are static constants after compilation)

#

@brittle flume lol my largest project for my gameserver

#

this provides a proxy server, backend, persistence engine for roleplay profile and savegame, as well chat.

#

For Minecraft

#

xD

brittle flume
#

20k classes?!?!?

warm sleet
#

no

brittle flume
#

you did manually?

warm sleet
#

20k lines of code

brittle flume
#

oh

#

crazy

warm sleet
#

lemme see how many classes

#

oh man

#

yeah I forget

#

takes

#

like half a minute

#

to compile

#

(thats maven btw)

brittle flume
#

jeez

#

how long you been coding?

#

overall

warm sleet
#

@brittle flume lemme see when this project was started

#

@brittle flume its still being developed, though mostly bu others

#

it just needs fixes or new features depending on what other things we need

#

the entire knockturn project is like idk how many repositories at this point

#

we have over 40 plugins

#

I Just wrote the core system, that takes care of logins, profile storage and database stuff

#

cross-server synchronization is complicated stuff

#

and most of us were ammateurs when we started this

#

I was the most capable one at the time, so I wrote most of the core components we needed

brittle flume
#

damn

warm sleet
#

Like all good projects

#

they begin at the end of the evening

#

and go on until 5am

#

I worked on it whenever I had time

#

like 3 years very intensely

#

and then less so

brittle flume
#

damn

#

aight i gtg

#

thanks for all the help setting this up

warm sleet
#

np

pliant siren
lament cave
warm sleet
#

Spigot and bungee yes

nocturne galleon
#

Does anyone here do Grok learning courses? Or is able to help me know what im doing wrong?

nocturne galleon
# hollow basalt sure

Cheers, so what has been happening, is For some reason, Grok isn't displaying the correct output, I have gone over my code 1 - 5 times and it just isn't displaying, everything should be correct but when I answer with "yes"
It just shows nothing

#

Okay nevermind i just fixed my own issue... I was missing a dot and a capital letter my bad

nocturne galleon
cloud knot
#

that is, if they enter yes, Yes, yEs, YeS or whatever, it will still count as a valid answer

#

in your question that would be:

if question.lower() == "yes":
#

but i haven't done much of python in my career

nocturne galleon
#

Oh wow 0,0 thanks

warm sleet
teal gulch
#

What CAD software should I start out with?

#

I just bought a 3D printer and want to attempt to design some of my own stuff

covert falcon
#

A lot of people swear by Autodesk Fusion 360 (subscription-based purchase, trial available). Haven't tried it myself due to not having the spare time when I got into the hobby, but still interested. SketchUp is also highly praised and can be used for other modelling such as for woodwork (it can even generate parts lists for planning builds/cuts for this), getting all features with ongoing updates needs a recurring annual license now I believe.

Personally I use OpenSCAD, which is a free, programming-based modelling application (their own simple language). Another free option that's highly popular is Blender; despite its original target being for 3D animation and rendering a lot of 3D print hobbyists use it quite successfully.

Dig around a bit and you can find some excellent comparisons, and try a few pieces of software out, see which one best agrees with your modelling style. Everyone I know in 3D printing seems to have settled on something different and all for different reasons 🙂

cloud knot
# nocturne galleon Oh wow 0,0 thanks

as you can see in linked answer, casefold() is even better, as it changes weird characters into their universal representation (so ß is changed to ss for example)

fallow coral
#

so how do i fix this its not centered

#

ping me if you know how to repair it or have an idea

calm moon
#

can someone help me fix my hyperv network issues?

nocturne oyster
#

can someone help me with some html stuff?

nocturne galleon
#

Hi how can I link section of markdon file in the same fipe

For example:

# keys
[Go to 2] (URL " Go to 2")

...
Some text
...


# 2
Some text 
pliant siren
# cloud knot yes is not Yes

These days there's all this focus on teaching kids that "no means no", but then we end up with these programmers that don't realise that No doesn't mean no 😄

woven vault
#

no No nO NO

coarse vigil
swift yacht
#

Can someone possibly help me out with this question
[1:06 AM]
Determine which of the following are valid or invalid identifier, integer constant, character constant,
float (real), constant, string constant and separate them. If invalid give reason?
(a) record1 (b) $tax (c) name and address (d) 27,822
(e) 0.576 (f) 1527 (g) 2e-8 (h) 1,232.5 (i) 5.234
( j ) „ a ‟ (k) “Pak”
[1:06 AM]
C language

hollow basalt
teal gulch
#

I already kind of want auto bed leveling for this ender 3 because somehow the bed got unlevel and slammed into the nozzle

warm sleet
#

@swift yacht idk? that's what I have a compiler for CH_kek

woven vault
#

online gbd very useful and quick and easy yes?

warm sleet
#

wat

woven vault
#

its just a online compiler that does multiple languages

#

when i fooled around on the school chromebooks online gbd let me run some basic code

cunning flume
#

okay my last shot
i am doning a 24 hour finally atm were i have 24 hours do a project. my group is almost done with the coding part but we are having some trouble with a price calculator.
we need to have 3 boxes for 3 differnt prices couse we are making a travel bureau but we can only get one box to work and are having major trouble getting the other box to work can anybody help
here is the code/script
its a website done with HTML

#
<body>

<div data-ng-app="" data-ng-init="quantity=1;price=500">

    <h2>Pris Per Dag</h2>    
<h2>Antal voskne</h2>

<input type="number" ng-model="quantity">

<p><b>DKK:</b> {{quantity * price}}</p>

</div>

</body>
                
                
                <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.6.9/angular.min.js"></script>
<body>

<div data-ng-app="" data-ng-init="quantityb=1;priceb=500">

    <h2>Pris Per Dag</h2>    
<h2>Antal Børn</h2>

<input type="number" ng-model="quantityb">

<p><b>DKK:</b> {{quantityb * priceb}}</p>

</div>

</body>
        ```
#

as you can see only one will giv us a output

warm sleet
#

@cunning flume that looks like angularjs to me

#

ancient garbage

#

should be using Angular instead

cunning flume
#

welp my teacher is a dumb one

#

this is only thing he has tought us

#

we spent no joke 2 months with 2 class 1 hour each pr week learning to change colors

#

@warm sleet

warm sleet
#

you dont even need angular for this sort of simple stuff

#

angular is for building single page applications

#

single page applications do not reload the entire page when you browse to another page

#

instead, they fetch content from a server, and update the view

midnight wind
warm sleet
#

Yeah but you dont teach someone angular if they dont even know basic HTML, CSS & JS

midnight wind
#

Yeah ofc

warm sleet
#

I'm having to use angular at work

midnight wind
#

I used vue in my latest web project

warm sleet
#

and I've got years of experience with development, angular makes even my head spin

cunning flume
#

m8 listen would you mind helping us then we are slightly frustrated here and would appreciate some help with it

warm sleet
#

impatient

midnight wind
#

Idk angularjs, sorry

cunning flume
#

yeah we got like less than 6 hours left before we need to present this and still have a fare way to go

midnight wind
#

Maybe I'll take a look once I'm at home

warm sleet
#

bad timing I'd say

#

poor planning, whatever

cunning flume
#

its an exam

warm sleet
#

@cunning flume {{quantityb * priceb}} is ment to be evaluated?

#

Because thats Angular syntax, not AngularJS.

midnight wind
#

Confusing naming hell

warm sleet
#

Yeah.

cunning flume
#

i mean we just tried separating their names so that they wouldn't interfere with each other

warm sleet
#

@cunning flume {{}} is syntax that can be used with Angular & Angular CLI

#

but angularJS is just that, javascript

#

{{ }} is neither valid HTML, nor valid javascript

cunning flume
#

we aren't that great at coding/scripting :/

warm sleet
#

Yet you have an examination?

cunning flume
#

yeah we have been taught about small amounts of scripting in school and now have an exam ending the year of scripting classes

warm sleet
#

wat

cunning flume
#

but like we said we spent 2 months learning to change colors in HTML

warm sleet
#

@cunning flume are you sure you even have to do angularJS?

cunning flume
#

and our teacher is really bad at teaching he is an old guy who talsk really slow

warm sleet
#

Because this sort of stuff can just be done with an event handler and a piece of javascript

cunning flume
#

do you have any websites or anything of that sort so we can figure out how maybe?

warm sleet
#
document.querySelector('.foo-class').addEventListener('change', (event) => { /*code here */ });
#

you put class="foo-class" on whatever input

#

and when the value changes, it runs that event handler

midnight wind
#

@cunning flume is angularjs a requirement?

cunning flume
#

no requirements on what code to run

warm sleet
#

@cunning flume just use plain javascript then

midnight wind
#

Oh, then just use plain js

cunning flume
#

just has to have been scripted by us

warm sleet
#

@cunning flume look at the snippet I posted

cunning flume
#

we haven't learnt anything about java script

warm sleet
#

you can add a CSS class foo-class to whatever <input>

#

and whenever that input fields value changes

midnight wind
warm sleet
#

it runs the event handler (event) => { }

midnight wind
#

What is the exam requirement

#

To make a website for what?

warm sleet
#

be a skript kiddie ✅

cunning flume
#

a travelling company

warm sleet
#

wat

midnight wind
#

Any like specific requirements?

#

So, I think the teacher just wants pure html/css

#

Nothing interactive

cunning flume
#

how would you change this then?

midnight wind
#

A 2000s website

midnight wind
cunning flume
#

we have that price calculator as a must

midnight wind
#

Oh, if he wants a calc

#

Then

#

How would you do it without js

cunning flume
#

no clue xD

midnight wind
#

Let me make a jsfiddle

#

Give me a min

cunning flume
#

cool we can wait

#

@warm sleet thanks for your time hope we aren't too frustrating.

warm sleet
#

@cunning flume one moment

#

I'm writing a snippet for you to play with

cunning flume
#

thanks

warm sleet
#

@cunning flume well crap. okay

#

I can't share this fiddle rn

#

HTML:

<html>
<body>
<input type="text" id="foo">
<p>
Output: <span id="output"></span>
</p>
</body>
</html>
#

JS:

function update(event) {
    document.getElementById("output").innerHTML = event.target.value
}

var input = document.querySelector('input')
input.addEventListener('change', update);
midnight wind
warm sleet
#

@midnight wind one thing you can fix in that one

#

I suck at js, so tell me

#

how do you get that input field by ID ?

#

because getElementById().addEventListener() does not exist

#

@cunning flume ^

#

click on that link

midnight wind
cunning flume
#

yours pr monkeys

midnight wind
cunning flume
#

monkey you are kinda close

#

giv me minut to explain the problem

warm sleet
#

@cunning flume basically, you got your piece of JS, which declares a function called update()

then, you add an event listener, that calls update() when the 'change' event happens

midnight wind
warm sleet
#

@midnight wind querySelector

#

that's the one I couldn't getElementById

midnight wind
#

ohhhhh

#

I didn't see that

cunning flume
#

we need it ti get a quantity and then multiple it with a specific number and then give us that value

midnight wind
cunning flume
#

we need that times 2 and then add those two nubmer together

warm sleet
#

@cunning flume so you have an event listener that listens when either one of the two fields changes, and then updates a value elsewhere on the page

#

you can read values from both, do your calculation

#

and then write the result onto the page

#

document.getElementById("foo").value
gets you the value="" property of an <input id="foo">

midnight wind
#

@warm sleet you need to set the id, you gave it the id of foo

warm sleet
#

@midnight wind wat

#

duuuuuh

#
function update(event) {
document.getElementById("output").innerHTML = event.target.value
}

var input = document.getElementById('foo')
input.addEventListener('change', update);
#

This is why I hate scripting languages, at least java tells me when I write garbage.

midnight wind
#

it can just be a one liner js var input = document.getElementById('foo').addEventListener('change', update);

warm sleet
#

(e) => { }

cunning flume
#

okay okay okay

warm sleet
#

@midnight wind do you remember the days that you could put <script language="VBScript"> in a page?

#

run arbitrary vbscripts, could even have the webpage open the CD tray on the PC xD

cunning flume
#

here is the problem
we need a price calc with one input and output
sooo lets say
we put in 5 then
5500 couse we have set the price to 500
then the output is 5
500 which is 2500
then we need one more input and output
were we put in lets say 3
and the price is 350
so the ouput is 3*350=1050
then we need one more output that adds the output from the first and 2nd output
so 2500+1050 which is 3550

warm sleet
#

omg

#

geez

#

Nuclear Contractor got hit by Ransomware

#

lmao, and they are threatening to give the info to russia

cunning flume
#

does my explation make sense

warm sleet
midnight wind