#development

1 messages · Page 51 of 1

tall kernel
#

only pure code matters

#

i mean

#

readable

#

code

old chasm
#

wdym ??

tall kernel
#

i dont want some unreadable obfuscated shit

little knoll
#

Do a if/else on each seconds in a day to print the actual hour, then you should be good to go for your 10k lines of code project

#

Like hard coded time

#

Yandere sim dev would be proud of a fine piece of code like this linusKappa

tall kernel
#

oh yeah if else every second so the clock will be a bit late but nah

elder ivy
#

You need to use a web worker and a service worker to get the time

#

And store the time in redux

#

might as well assume the system time is off too. so sync it

late plank
#

Try coding swift..

#

on xcode 11, creating your own iphone app.

#

Im glad i was able to download a template to connect to a bluetooth module.

#

But then still a lot of work had to be done

cloud knot
#

@late plank Swift is childs play. Try Objective C 😄

late plank
#

....

#

🤣🤣

#

Im soo happy i was able to talk to my arduino via bluetooth😂

cloud knot
#

let's just say implementing stuff like Apple Wallet card provisioning is hell

late plank
#

Ive only done arduino and skript

cloud knot
#

Apple likes to overcomplicate their API

late plank
#

Was my first time looking at swift

#

Oh i believe you with apple and their own things

cloud knot
#

(anyway, leaving, bed time for me)

late plank
#

Gn

jolly relic
#

Normally the go-to approach is backpropagation but there's other more esoteric (and biology-inspired) methods that interested me.

#

I built a nice framework to easily insert other training methods and I hope to add more over time.

nocturne galleon
#

if I wanted to build a forum as a learning project/hobby, how does it work exactly? would I write a thing in javascript for the frontend that will ping the web-server for all the topics/replies to a topic when loading a certain page and it replies with a serialised copy of the forum topic and replies for the client to then display? I read somewhere that it could also be the server will generate and send over a full html page with everything displayed instead. would anyone be willing to help me out?
I know it might sound stupid but im not interested in using any frameworks for it, I'm interested in the logic behind it all and dont care if it wont be a quick thing or that I'll end up with a real basic thing at the end.

elder ivy
#

you can write it in any way you want...

nocturne galleon
#

would you recommend I learn about web-backend to be able to come up with something? the only experience I have with any web stuff atm is the responsive web design course on freecodecamp.org

elder ivy
#

hmm web backend? like just doing more of a client side implementation?

#

fwiw a lot of the forums I use are probably written using server-side implementations that are essentially templated pages (a lot of them a probably php)

nocturne galleon
#

cause you say I can write it however I want, but my only experience with any web stuff is clientside, HTML and a tiny bit of CSS. I'm learning those + JS in the freecodecamp course but i dont know any server-side stuff, should I learn some of that and then I'll know what is needed to make a forum? is that what you mean?

jolly relic
#

@nocturne galleon you're going to need to interface somehow with a DBMS like SQL, Firebase, etc. I'd look into PHP or Ruby. PHP gets a lot of flak but it has some beginner friendly features like type agnosticism.

#

I think you can backend with Python? I've never done it.

#

This isn't super specific to one task but for a forum you'd need to have some backend stuff.

#

Definitely things you can do with just straight HTML and CSS, especially HTML5, but a forum ain't it.

nocturne galleon
#

yeah I knew there would be server side, but I'm just trying to understand if blue was recommending I learn a bit of backend before trying to implement a forum so that I can answer the question of how to go about it myself? but im not too sure if that's what he meant

jolly relic
#

Right and I'm saying a forum isn't possible without backend knowledge.

#

I wouldn't even begin a forum without being fairly competent with backend and databases.

#

I guess a single comment chain might work but any kind of more complex forum is going to need a fair bit of backend know-how.

nocturne galleon
#

yeah, I wasnt planning on trying without backend knowledge, but I think what blue was suggesting was that if I learnt backend then I would be able to answer the question of how to implement a forum myself

jolly relic
#

Yeah I think so too.

#

A forum isn't really super complex conceptually.

#

Just lots of database stuff tbh

#

I use PHP and PDO to interface to MySQL. I don't have a lot of experience outside that scheme.

nocturne galleon
#

yeah I just lack the conceptual knowledge of backendingness

#

I'll put that project on hold until I've finished learning basics of frontend but thanks for the help!

elder ivy
#

I mean you could write the backend using nodejs and sql

#

but at the same time... might be rough too lol

jolly relic
#

I forget the term for "bad decisions early are hard to fix later".

#

Decision debt?

elder ivy
#

php is that

jolly relic
#

Like if you mess up early in designing a forum (eg. database structure) and don't work to fix it until late in the project, it's a lot harder to resolve.

#

Refactor debt? It's something debt.

elder ivy
#

technical debt?

jolly relic
#

Changing a database structure after the fact is so unbelievably laborious. Good idea to look up good relational database practices.

#

Yes, technical debt!

elder ivy
#

I mean it's a project for fun so it won't matter too much in the end

#

but I'm not disagreeing that some decisions are borderline impossible to fix at a certain point

jolly relic
#

but tbh, if its personal use, throw convention to the wind

#

i dont design well or comment well for personal stuff, thats the point lol

elder ivy
#

I mean you could use mongo if you really wanted

jolly relic
#

I had an ecommerce database that didn't follow normal form for orders. It's meant to have shared order_id key per tuple but different SKU per tuple. I concatenated SKU so each order was 1 tuple.

#

Took me a week to refactor to fix this.

#

In production.

elder ivy
#

yikes

nocturne galleon
#

yeah technical debt

#

I've heard of that

#

I have a lot of technical debt in my program lol

nocturne galleon
#

anyone do the language agnostic Enso IDE thing?

#

makes coding rust and integrated haskell platform simpler for the masses

#

i mean who wants to know basic code optimizations between different platforms

serene turret
#

yoo

#

can someone help me with that?

#

here is the code

#

also that issue started after uploading the bot on heroku

vestal ledge
#

Hello, im getting this errorr

#

when im making a website

#

im following a tutorial on vue and i did exactly the same

elder ivy
#

google it but you need to edit your head tags most likely

vestal ledge
#

@elder ivy i have googled nothing works

elder ivy
#

I mean you need to look at the CSP settings for your page. it's probably blocked

vestal ledge
#

yeah but i tried to change nothing happends

#

@elder ivy

nocturne galleon
#

is the best way to run a multi-client server, to just hand each new connection off to its own thread? like should I make it that on the main thread of my python script, it will listen for connections, and when it finds one, pass the details off to a seperate thread?

cinder kraken
#

Wait, how will I run my 20-years-old corporate ActiveX websites?

jolly relic
#

@nocturne galleon you making a python socket chat?

#

multiple threads is needed for multiple concurrent users

#

not needed but convention dictates its the proper way

#

at least 1 main server thread + 1 client thread per user

#

What I said "not needed", it actually is, oops. Server only needs one thread, however; polling for new connections and messages. Could split that into two I guess.

#

Absolutely you need n+1 threads, where n is the number of clients.

neon quiver
#

well, that's debatable, Apache famously creates a new thread per connection while nginx uses an event loop model similar to nodejs: turns out nginx can handle a lot more concurrent connexions and has much better tail latencies than Apache

#

with a good load balancer in front of the webserver, there's no need for threading, I'd say just use what is more natural in <your language here> and just worry about scaling out more instances behind that LB

jolly relic
#

I don't quite understand.

#

A client would need a thread separate from server.

#

The actual application needs only 1 for the server.

nocturne galleon
#

yeah I was thinking thats the way, thanks for posting your github, that looks like a really helpful resource

jolly relic
#

It's just a simple socket chat but should be a good springboard off to more complex stuff.

nocturne crypt
#

@neon quiver the new versions of httpd (The Apache proxy) mimick nginx behavior

#

@jolly relic If you're worried about performance use C++, if you're worried about usability from a developer's point of view than keeping using python.

#

Python is very poorly designed for stuff like SIMD, MIMD, SIMT, and Multithreaded applications. I would argue that once you decide you need to use even a threadpool, Python becomes a non-starter. This could all be controversial, but it'll take that leap.

pale onyx
#

So I am working on redesigning https://www.blakemining.com/ as well as optimizing the code
I originally loaded each API individually but I want to clean up the code and use a function to load it instead, I set it up and function works however the variables come out as undefined when I try to use them outside of the function

Do I need to return the data or something? I haven't done this sort of function in a while so I don't remember if I am missing something
Here is my code:

function loadAPI(URL, apiDataVar, apiLoadVar, volumeVar, apiErrorMSG, priceVar) {
    fetch(URL)
        .then(function (response) {
            if (response.ok == true) {
                return response.json();
            } else {
                apiLoadVar = false
                APIError(apiErrorMSG)
            }
        })
        .then(function (myJson) {
            apiDataVar = myJson
            apiLoadVar = true
            APILoaded += 1

            if (priceVar !=false) {
                priceVar = apiDataVar.prices[apiDataVar.prices.length - 1][1]
            }

            if (volumeVar != false) {
                var volume = (Math.round((apiDataVar.total_volumes[apiDataVar.total_volumes.length - 1][1]) * 100) / 100).toString()
                volumeVar.innerHTML = "$" + volume.replace(/\B(?=(\d{3})+(?!\d))/g, ",")
                if (volume < 500) {
                    volumeVar.style.color = redColor
                } else if (volume < 10000) {
                    volumeVar.style.color = yellowColor
                }
            }

            apiLoadVerify()
            
        }).catch(function (err) {
            console.log('Failed to load ' + apiErrorMSG + 'API: ', err);
            APINeeded -= 1
            APIError(apiErrorMSG)
            APILoaded -= 1
            apiLoadVerify()
        })
}
#

@ me if you are able to help

elder ivy
#

@pale onyx what do you mean outside of the function

#

also it's an async function you need to wait for it to finish

#

well it isn't async since you're not returning anything but it should be async

#

the other part is really you shouldn't pass in variables like that. it's kinda awful since that's your return value you want

#

change it to ES5 async/await function if that's supported then return a structured object with the values you're looking for. then wait for the function/promise in the calling function

neon quiver
#

you need to return the promise itself, like return fetch(...).then(...) in addition to the returns you already have, or return the resolved value by awaiting the promise like return await fetch(...).then(...)

#

there's a pretty good article on mdn about fetch specifically : https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API/Using_Fetch

pale onyx
#

@elder ivy @neon quiver So as an example, I call the function like this
loadAPI(btcPriceAPI, btcPriceAPIData, btcPriceAPILoad, false, "BTC Price", bitcoinUSDPrice)
My idea was that when it runs the function, it will pass through those variables and set the values but I guess it doesn't work that way
When I console.log lets say apiDataVar in the function, it will show the data that's loaded from the API but it doesn't actually save it to the variable

I tried adding return and await to the fetch as well as setting the function to Async
That didn't fix my issue so I need to do the way @elder ivy mentioned with returning an object then I guess I can set the variables outside of the function

#

I really need to redo a lot of my JS... Its messy... I worked on that website like 2 years ago

elder ivy
#

you can't just convert the function to async. you need to wait on the promise that's returned too

#

async/await is just syntactic sugar on it

pale onyx
#

Oh, this was what I did

async function loadAPI(URL, apiDataVar, apiLoadVar, volumeVar, apiErrorMSG, priceVar) {
    await fetch(URL)
neon quiver
#

yeah almost, the await on the fetch is good but you'll need to also return

async function loadAPI(...) {
  return await fetch(URL).then(res => res.json())
}
#

and then you can call it like so

const result = await loadAPI(URL)

that's assuming you're also in an async function to use the await keyword

pale onyx
#

I'll try it like that

pale onyx
#

So I did var btcPriceAPIData = loadAPI(btcPriceAPI)

#

I am just having trouble accessing the object....

#

If I try console.log(btcPriceAPIData.prices), I get undefined

#

This is the functions code

async function loadAPI(URL) {
    return await fetch(URL).then(res => res.json())
}
neon quiver
#

how did you call it?

pale onyx
#

@neon quiver Like this
var btcPriceAPIData = loadAPI(btcPriceAPI)

neon quiver
#

try let btcPriceAPIDate = await loadAPI(btcPriceAPI)

pale onyx
#

I'm not calling it in an async function so I cant call it with await

neon quiver
#

ok

#

then

loadAPI(btcPriceAPI).then(data => console.log(data))
#

btw you really should be using let and const to declare variables

#

var is super old and considered bad practice by now

pale onyx
#

Oh okay

#

Didn't know that

#

Yep, I am able to access the object now

#

Thanks!

neon quiver
#

np!

elder ivy
#

you don't need to return await btw

#

really want you want is something like:

return res.json();```
vestal ledge
#

Hello! I want to create a login form on my website. email and password.

#

do i need any GDPR stuff for that

foggy ginkgo
#

You need an explicit and informed user consent for actions that require personal information collection. A signup page is considered a valid form of explicit consent.
Beware: this explicit consent also applies to third party tools such as analytics, IP collection, etc. Hence the GDPR banners.

vestal ledge
#

@foggy ginkgo so i should just say that i save the email and password?

#

i have a url shortening website

#

and i want users to be able to create an account so they can see their urls

foggy ginkgo
#

The only element that remains in the gray zone for me is Cloudflare, which is GDPR compliant if we trust their GDPR page: https://www.cloudflare.com/gdpr/introduction/
You will only need a consent about the signup since the session cookie -if you were to use one- may be a necessity for your service.

vestal ledge
#

man gdpr is hard

#

idk what to write

#

im only collecting email and password

#

thats encrypted

empty sentinel
#

You can blame the information industry for GDPR.

ashen sky
#

Actually GDPR is not really hard/evil/whatever. It's essentially a requirement to ask before you exploit users personal information, and a requirement to protect that information. Sure, the possible sanctions can feel a bit harsh, however, the requirements are pretty easy to comply with, when building something new, but if you have had bad practices in the past, it can be hard to implement. 😉

upbeat nymph
#

But IICR it also says you need someone whose job it is to ensure constant compliance and specifying the requirements of their role. IICR from a few years ago, it was really difficult to implement to the fullest extent. I mean on a basic level...have a detail privacy policy and allow people to download their data but again IICR that isn't enough to satisfy the full requirements.

#

It's been a few years though since I actually looked or cared about it tbh.

#

I don't have any services that would be heavily used enough to require that level of GDPR compliance.

#

And like, my Discord bot for example stores commands and error information and I can remove or provide that on request but GDPR just seemed so weird and convoluted.

zenith pollen
#

Does it matter if I install anaconda before vscode? On ubuntu and I just remember a long time ago when it bugged out (think because anaconda had vscode bundled at the time?)

ashen sky
#

But IICR it also says you need someone whose job it is to ensure constant compliance and specifying the requirements of their role. IICR from a few years ago, it was really difficult to implement to the fullest extent. I mean on a basic level...have a detail privacy policy and allow people to download their data but again IICR that isn't enough to satisfy the full requirements.
@upbeat nymph Some businesses will need that, those having a large amount of sensitive data, however, it's not a role where you do nothing else. You can have a regular job, and have the DPO (Data protection officer) role on the side, or you can hire an outside company to do it for you. Lots of companies would NOT need to have a DPO at all.

#

Other parts require informed consent to usage of data, unless it's required by law, or obviously required to deliver the service. (Eg. use phone call details for billing purpose)

#

And the ability to download your own data, is not a requirement, but you need to provide ALL data you have on a user, upon their request.. In my opinion it's more or less a law requiring you to actually act nice, and not just use my data for anything you want, and sell them left and right, without my consent. You CAN use my data anyway you want even publish them for everyone to see, provided I consent to the usage you want.

mellow steeple
#

For Deep learning and convolutional neural networks, which is the best os?

vernal marsh
#

mmm any linux would be fine actually 🤷‍♂️ os really doesn't matter in this case.. other developers say windows is bad for Deep learning implementations but I wouldn't agree on that @mellow steeple

#

Damn Rust is fun.. specially the pattern matching

lavish minnow
#

In general, yeah, you should be using Linux

#

a lot of the data science stuff is heavily optimized for Linux, and while thankfully most libraries are fully open source and thus usable on all Linux distributions, some are not and only work properly on RHEL/CentOS or (open)SUSE

#

the main reason for some data science (AI/ML/DL/etc.) stuff being only available for RHEL/CentOS is usually that they make some kind of accelerator kernel module only for the Red Hat Enterprise Linux variant of the Linux kernel (because it has a stable interface guaranteed by Red Hat for the life of a particular release of RHEL), so people write code specifically for it instead of targeting the Linux kernel and submitting the code for inclusion as an open source driver

#

this usually comes up in combination with using NVIDIA GPUs with it, since NVIDIA has some kernel modules for using their GPUs in special ways only for RHEL/CentOS users

#

(yet another reason to dislike NVIDIA)

#

so @mellow steeple if you want to be "best equipped" to use any software for AI/ML/DL, then you should probably use CentOS

#

I recall that there were some talks about this topic at Red Hat (Virtual) Summit

#

data science stuff isn't really my thing though, so ehh

peak acorn
#

lol I think I have chosen the wrong university, for OOP Design and Programming 2 the teacher sent out an email and told us to download BlueJ lmao

#

even my highschool has us use eclipse for java

elder ivy
#

looks less confusing for beginners

peak acorn
#

u like only gotta know where the project explorer is doe

#

last time i installed blueJ for a school thing it actually doesnt work on big files it just breaks

vital blaze
#

At my uni all of first year was with bluej, then in second year we used intellij. And in third year they recommended bluej for the OOP course for the UML like diagrams.

#

For first year it was useful since it forced us to learn the syntax more si ce we had to type it all out.

pale onyx
#

So I am trying to use element.animate in JS to make a section slowly disappear then have a display of none so that it does not interfere with other sections
For some reason, I can't change anything with the display property
This is my code right now

resultCoins[resultNum].animate([
            {
                opacity: 1
            },
            {
                opacity: 0
            },
            {
                opacity: 0,
                display: "none"
            }
        ], {
            duration: 500,
            fill: "forwards"
        })
#

I did get the opacity part to work though

pale onyx
#

So I kinda figured out a solution, but if there is a better one, let me know
I used position absolute and visibility instead

resultCoins[resultNum].animate([
            {
                opacity: 1
            },
            {
                opacity: 0
            },
            {
                opacity: 0,
                position: "absolute",
                visibility: "hidden"
            }
        ], {
            duration: 500,
            fill: "forwards"
        })
pale onyx
#

Ah yeah, that's what I thought

#

Oh well, at least my solution works

elder ivy
#

I mean you can maybe manually just set display: none after the animation is done

pale onyx
#

I could but I want to make my code as optimized as possible, so I'll keep this for now

elder ivy
#

oh there's a .finished

#

so just do a .then and do it lol

pale onyx
#

Ohhh

#

Okay

#

Didn't know that lol

#

Yeah it works

#

Thanks!

elder ivy
#

👍 I didn't know it either, just gotta pilfer through the APIs lol

pale onyx
#

Yeah lol
I was trying to do it quickly so I didn't take a good look at everything

obtuse night
#

what messaging queues do you lot use? trying to decide on an on premise with clustering

nocturne galleon
#

Hey guys, do any of you have or know a Node js project in search of contributors?
Not looking for a job. Just wanna code for fun in my spare time

frozen pulsar
#

is this active if I send a question or am I just gonna waste my time

night girder
#

Sure

#

If I can help I will

foggy ginkgo
molten meadow
#

use v1.4.1 if you're testing

night girder
#

Okay, first of all @molten meadow, git exists to version your files by itself (well sort of). In any case, you should avoid having multiple files of the same thing.

#

and every single change you make is a sort of a version

#

You can then create Tags to mark specific versions if you want

molten meadow
#

Alright, thanks man 🙂

stiff karma
#

anyone know anything about fastled?

#

im having alot of issues

stiff karma
#

nevermind, my arduino 101 doesnt support fastled

nocturne galleon
#

Is it better to use references instead of pointers because you won't have to delete them
?

nocturne crypt
#

in what context?

peak acorn
#

Hmmm, for the very first assignment for my java 2 course I'm NOT allowed to use any built-in classes in the Java API except for the provided java.util.Random object RND and your own print statements using the built-in System.outobject So am I allowed to use String.format or printf?

#

The code uses strings, so I must be allowed to do that right?

elder ivy
#

why don't you ask the instructor

peak acorn
#

ill ask once we actually have a class heh

worn halo
#

Is there a way i can write a scirpt to send messages on discord?

#

i dont mean a bot

#

I wanna send messages from my account to a server, through a scirpt

limpid reef
#

That's against the Discord Terms of Service, as far as I'm aware, as you're effectively asking if a regular account can act as a bot.

worn halo
#

oh huh

#

even if its my own server?

#

That's against the Discord Terms of Service, as far as I'm aware, as you're effectively asking if a regular account can act as a bot.
@limpid reef righty

#

sounds fair

nocturne galleon
#

Should I use a struct for a node in a binary search tree or a class for a node

mellow steeple
#

I have a i5 dual core macbook pro with 16gb ram. Is this bad for programming (python and a bit of deep learning)? I've heard people say you need a quad core, but I'm not sure if this is true.

granite river
#

@mellow steeple That machine is more than fine. Maybe it means you wait just a bit longer than a more powerful CPU, but it's like.... 1 second vs 1.5 seconds. Not important. Just get started, then when you can measurably observe your computer holding you back, that's when it's time for a new one.

mellow steeple
#

Well I built a pc with a quad core i7 cpu, but I'm more used to mac os than pretty much any other os (windows, linux) @granite river

#

I've been using the macbook pro for python and ml development for the past 2 years and there is some stuff that hold me back: the fan is running at high speed even though I am not doing anything, the computer lags when I'm running some code or some neural networks.

granite river
#

Then use macOS, it's pretty good at Python stuff. If you will be running really long processes, then sure, run them on your faster i7 system. But most programming work happens when your CPU is almost idle, waiting for you to type, so the speed difference isn't significant. Especially with Python, which doesn't have a compilation process that you have to complete before running your program

#

If your fan is spinning up when you're not doing anything, have a look at Activity Monitor and see what the culprit is

mellow steeple
#

Alright, so if I use my macbook for everything, what should I use my pc for?

#

Also, which OS/laptop do you use? Do you do similar type of development to me?

granite river
#

My Windows system is faster than my Mac, too. If I'm working on the Mac on a particular day, I'll copy heavy-duty/time-consuming tasks to Windows and run it there. That way I can keep the Mac freed up for typing.

mellow steeple
#

I was also thinking of using Linux, but since I'm in school, it might be a bit hard to get used to it.

granite river
#

I have a 2018 MBP with the i7 chip, 16GB RAM, and a brand new 10700K-based desktop with 64GB. I use the Mac when I want to sit on the patio or otherwise get out of the home office.

#

Linux is a great skill to have. Definitely put time into that someday. The better you understand the macOS terminal, the easier it is to pick up on Linux.

mellow steeple
#

I would want to use my desktop pc when I'm at home (specs: i7 4 core cpu, 16gb ram, nvidia 980 gpu) since ease of use. I feel like windows isnt the best for development even though most people use it (and maybe because i come from a macos background).

#

Also do you run windows or linux on your desktop pc @granite river

shy helm
#

I wanna send messages from my account to a server, through a scirpt
@worn halo self botting will get your account removed by discord for TOS violation

worn halo
#

Ohh ye i didn't know that before

#

Kirashi told me so i ended up not doing it

true briar
#

Is it better to use references instead of pointers because you won't have to delete them
?
@nocturne galleon, presuming you're talking about C++, then the question itself is wrong: memory model is orthogonal to how your objects are aliased/named.

    SuperClass& ref = *(new SuperClass{});
}// scope end```
Even tho the instance is aliased by reference, the memory leaks anyway
mellow steeple
#

Is the nvidia 980 gpu not supported for cuda?

fickle crypt
#

anyone here speak github?

elder ivy
#

sure what about it @fickle crypt

fickle crypt
#

How when I clone a repo from GitHub how do I get it to save to my D drive intead of my boot ssd

round dome
#

git isn't github btw

vital blaze
#

Are you using cli or GUi?

fickle crypt
#

the desktop client

#

For some reason it wants to put everything in the documents folder (on the boot)

hollow basalt
errant raptor
#

how do i put a gif as background for a website?

nocturne galleon
#

what is everyones opinion on ASP.NET?

#

I'm thinking of learning how to use it cause it looks promising but if anyone has experience with it I'd love to hear what you think, and one question, it likes to talk a lot about using azure, how does it go self-hosting web-apps made with it? or is it sorta not supported/difficult to do because microsoft

vital blaze
verbal otter
#
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
import java.util.Arrays;
import java.util.Base64;
 
import javax.crypto.Cipher;
import javax.crypto.spec.SecretKeySpec;
 
public class AES {

public static void main(String[] args) 
{
    final String secretKey = "AB CD EF AB CD EF AB CD AB CD EF AB CD EF AB CD";
     
    String originalString = "I am John";
    String encryptedString = AES.encrypt(originalString, secretKey) ;
    String decryptedString = AES.decrypt(encryptedString, secretKey) ;
     
    System.out.println(originalString);
    System.out.println(encryptedString);
    System.out.println(decryptedString);
}
 
    private static SecretKeySpec secretKey;
    private static byte[] key;
 
    public static void setKey(String myKey) 
    {
        MessageDigest sha1 = null;
        try {
            key = myKey.getBytes("UTF-8");
            sha1 = MessageDigest.getInstance("SHA-1");
            key = sha1.digest(key);
            key = Arrays.copyOf(key, 16); 
            secretKey = new SecretKeySpec(key, "AES");
        } 
        catch (NoSuchAlgorithmException e) {
            e.printStackTrace();
        } 
        catch (UnsupportedEncodingException e) {
            e.printStackTrace();
        }
    }
 
    public static String encrypt(String strToEncrypt, String secret) 
    {
        try
        {
            setKey(secret);
            Cipher cipher = Cipher.getInstance("AES/CBC/PKCS5Padding");
            cipher.init(Cipher.ENCRYPT_MODE, secretKey);
            return Base64.getEncoder().encodeToString(cipher.doFinal(strToEncrypt.getBytes("UTF-8")));
        } 
        catch (Exception e) 
        {
            System.out.println("Error while encrypting: " + e.toString());
        }
        return null;
    }
#
    public static String decrypt(String strToDecrypt, String secret) 
    {
        try
        {
            setKey(secret);
            Cipher cipher = Cipher.getInstance("AES/CBC/PKCS5PADDING");
            cipher.init(Cipher.DECRYPT_MODE, secretKey);
            return new String(cipher.doFinal(Base64.getDecoder().decode(strToDecrypt)));
        } 
        catch (Exception e) 
        {
            System.out.println("Error while decrypting: " + e.toString());
        }
        return null;
    }
} ```
#

trying to figure out why when i switched to CBC it returns null when it didnt when it was ECB

obtuse night
#

what is everyones opinion on ASP.NET?
@nocturne galleon It's the only thing I use at work and in my opinion, it's great. Only drawback is I've found it's quite resource heavy at times

#

I'm thinking of learning how to use it cause it looks promising but if anyone has experience with it I'd love to hear what you think, and one question, it likes to talk a lot about using azure, how does it go self-hosting web-apps made with it? or is it sorta not supported/difficult to do because microsoft
@nocturne galleon regarding your question, you can self host it on IIS or Docker easily

#

I've not tried it, but it looks like you can host ASP.NET Core applications on NGINX too
EDIT: This is not possible...

nocturne galleon
#

thanks!

uncut peak
#

Can anyone help me with C++, I'm getting the classic "undefined reference to x" error, but I don't see a problem. I'm new to C++, so I might be doing something wrong in the header file. ```#pragma once
#include <stdlib.h>

class LinkedList{
public:
struct Link{
int number;
Link* next;
};

struct List{
    Link* begin;
    Link* end;
};

List* list;

List* makeList();

List* addLink(int number); 

};```

#

The declarations are definitely the same as my function names

#

The error is
main.o:main.cpp:(.text+0x15): undefined reference to `LinkedList::makeList()' main.o:main.cpp:(.text+0x15): relocation truncated to fit: R_X86_64_PC32 against undefined symbol `LinkedList::makeList()'

#

And for the other function too

#
    LinkedList list1;
    list1.makeList();
    list1.addLink(2);
    list1.addLink(3);

is the relevant code

#

(of course that's only part of the main, it has been properly closed and everything)

round dome
#

you haven't made the makeList func

uncut peak
#

Oh that's in a separate file

#
class LinkedList{
    struct Link{
        int number;
        Link* next;
    };

    struct List{
        Link* begin;
        Link* end;
    };

    List* list;

    List* makeList(){
        list = (List*) malloc(sizeof(List));
        return list;
    }

    List* addLink(int number){
        Link* tmp = (Link*) malloc(sizeof(Link));
        tmp->number = number;
        list->end->next = tmp;
        return list;
    }   
};
round dome
#

so you have two definitions for the same class?

#

or is the second one you posted the most recent

#

also you don't C cast or use malloc/free in c++

uncut peak
#

The second one I sent is the .cpp file, the first one is the .h file

#

the .h file is imported in the main.cpp of course

warm sleet
#

wew

#

that is weird indeed

round dome
#

what's the purpose of the one in the cpp file???

warm sleet
#

I assume the header is just the class definition, implementation in their CPP

uncut peak
#

I am learning to use c++, I've used C before and want to get into oop, so I tried to do it in two separate files to learn how to do that

#

the cpp file is to place the actual functions into, the header file is only for declaring it

#

Just how wrong am I XD

warm sleet
#

@uncut peak you should add a constructor

#

instead of allocating memory yourself

round dome
#

ret_type class_name::class_func(params)

#

in main

warm sleet
#

^ thats a static call to a function, or a constructor

round dome
#

what are you talking about

#

it's the pattern to define class functions outsite their header file

warm sleet
#

Yeah, but their class implementation has a makeList()

#

instead of using an actual constructor

round dome
#

so?

uncut peak
#

I clearly need to learn more lmao

warm sleet
#

List::List() { //construct your object here }

round dome
#

that's irrelevant to the compilation problem though

uncut peak
#

This is basically my standard C implementation of this, and I made it into some crappy object

#

I don't care for the malloc thing right now, when I learn how to use constructors, that's what I'll use

#

My question was about why it didn't compile

warm sleet
#

From what i am seeing, you are doing an instance call on an object that doesnt exist

round dome
#

I already gave you an idea of why it wasn't compiling, if you expect me to guess your sources it's not going to happen

uncut peak
#

ret_type class_name::class_func(params)
@round dome What does this do exactly?

round dome
#
class fuck{
  void  hello();
};

header.h

#include "header.h"

void fuck::hello()
{
  return;
}```
file.c
warm sleet
#

Thats only to define methods out of scope of the class

round dome
#

and the problem here is that the compiler can't find the makeList definition

#

do you think you're helping?

warm sleet
#

fine

#

go solve your own problems

#

prick.

round dome
#

you're just saying random shit that's not going to help solve the issue, and now you're name calling

#

😅

uncut peak
#

Do I include linkedlist.h in the linkedlist.cpp file?

#

I thought you didn't need to do that

round dome
#

so you define a function in a file, don't include it and expect the compiler to know what the function is?

uncut peak
#

I have linkedlist.cpp, main.cpp and linkedlist.h. I have imported linkedlist.h in main.cpp

#

I thought that's all you needed to do

round dome
#

you don't have to define class functions in the class definition, in fact, doing so inlines the class function, you can define class functions outside the header file like I showed and it won't inline the functions

#

define the class in the header file and define the class functions in the source file, include the header file in both sources

warm sleet
#

@round dome pardon for my outburst

#

but I was merely trying to help with OO concepts, and my java rotten brain has troubles with C++

uncut peak
#

I am still kind of lost.
Should my headerfile look like this?

#pragma once


class LinkedList{
    struct Link;
    struct List;
    
    List* list;

    List* makeList();
    List* addLink(int number); 
};
round dome
#

that's probably not what you want

#

since class members are private by default you won't be able to call makeList and addLink in your main

uncut peak
#

Oh right, forgot to add back the public part

round dome
#

ok

#

but it's kinda shit doing so, since classes are used when you want to hide some api details from the users

#

why not use structs instead if your aim is to have everything public?

uncut peak
#

As I said, I kind of wanted to tool around with oop, make a simple class and perform some stuff on some object

round dome
#

my point is that 99% of the time, structs and classes are the same, with the only difference that stuff in structs are public by default

uncut peak
#

You can't define functions in a struct right?

round dome
#

yes u can

uncut peak
#

wait

#

oh

#

can you?

#

Why have I never seen this before?

round dome
#

because you've probably only touched c before

uncut peak
#

I have touched C and Go mainly

#

C was for school, and Go for fun.

#

Anyway, do I now also type class LinkedList{}; in the source file?

#

with everything in between?

round dome
#

just re-read what I wrote

#

I feel like I explained this already

#

even gave an example

uncut peak
round dome
#

can't you send all 3 files

#

in total

#

not portions

#

🔮

uncut peak
#

main.cpp:

#include "linkedlist.h"


int main(){
    LinkedList list1;
    list1.makeList();
    list1.addLink(2);
    list1.addLink(3);
    LinkedList::Link* ptr = list1.list->begin;

    while(ptr->next != NULL){
        std::cout << ptr->number << std::endl;
        ptr = ptr->next;
    }
    std::cout << ptr->number << std::endl;

}

linkedlist.cpp:

#include "linkedlist.h"



struct Link{
    int number;
    Link* next;
};

struct List{
    Link* begin;
    Link* end;
};

List* list;

List* makeList(){
    list = (List*) malloc(sizeof(List));
    return list;
}

List* addLink(int number){
    Link* tmp = (Link*) malloc(sizeof(Link));
    tmp->number = number;
    list->end->next = tmp;
    return list;
}

linkedlist.h:



class LinkedList{
    public:
    struct Link;
    struct List;
    
    List* list;

    List* makeList();
    List* addLink(int number); 
};
#

Now in main.cpp it won't find list1 because "pointer to incomplete class type is not allowed"

#

same with ptr

#

It still gives the undefined reference to `LinkedList::makeList()' error

round dome
#

why are your struct definitions not in the header file?

warm sleet
#
List* makeList(){
    list = (List*) malloc(sizeof(List));
    return list;
}
//surely like this?:
List* LinkedList::makeList(){
    list = (List*) malloc(sizeof(List));
    return list;
}
#

because in your linkedlist.cpp you never reference the type you defined in your header

uncut peak
#

why are your struct definitions not in the header file?
@round dome uh... I don't know. I have added them in and now the pointer to incomplete class type is not allowed error is gone

#

Sorry for that

round dome
#

why is there a global variable in your source file?

warm sleet
#
List* list;
round dome
#

also why haven't you looked at the example I took the time to write out?

uncut peak
#

I showed you

#

When I did that

warm sleet
#

what is that :: operator called?

round dome
#

scope operator (the official name is scope resolution operator but who fucken cares)

warm sleet
#

right

#

makes sense

#

in java its all { { {{ { { {

round dome
#

linkedlist.cpp:

#include <stdlib.h>
#include "linkedlist.h"

List* LinkedList::makeList(){
    list = (List*) malloc(sizeof(List));
    return list;
}

List* LinkedList::addLink(int number){
    Link* tmp = (Link*) malloc(sizeof(Link));
    tmp->number = number;
    list->end->next = tmp;
    return list;
}
#

@uncut peak

uncut peak
#

So I don't have the global variable in the class?

#

That works btw

warm sleet
#

The fields are configured in your header

uncut peak
#

linkedlist.cpp:

#include <stdlib.h>
#include "linkedlist.h"

List* LinkedList::makeList(){
    list = (List*) malloc(sizeof(List));
    return list;
}

List* LinkedList::addLink(int number){
    Link* tmp = (Link*) malloc(sizeof(Link));
    tmp->number = number;
    list->end->next = tmp;
    return list;
}

@round dome This works, thanks

warm sleet
#

you can have public fields and private fields

#

private fields can only be accessed by blocks that have the same scope as your class

uncut peak
#

I have picked up a bit of oop when we did a tiny bit of java in school too

warm sleet
#

so your method implementations like:

List* LinkedList::addLink(int number){
    Link* tmp = (Link*) malloc(sizeof(Link));
    tmp->number = number;
    list->end->next = tmp;
    return list;
}
#

I am running on poor C++ knowledge

#

from an 8 week project

#

developing accelerometer sensor hardware for use in a car xD

uncut peak
#

It does look like this now LinkedList::List* LinkedList::addLink(int number){ LinkedList::Link* tmp = (LinkedList::Link*) malloc(sizeof(LinkedList::Link)); tmp->number = number; list->end->next = tmp; return list; }

warm sleet
#

on a microcontroller

uncut peak
warm sleet
#

not entirely conviced with the internal logic of that thing

uncut peak
#

Because I removed the global variable from the class in the header

warm sleet
#

you should only access the object via its public fields, or through its public methods

round dome
#

omg

#

it's not global if it's in a class definition

#

it's just some memory space that's contained in your class object

#

unless you put static infront or some shit

#

(it still wouldn't be a global, it would just have the same properties)

#

we told you to remove the List* list from the source file because it looked like you just copy pasted the class into the source file

warm sleet
#

this makes java constructors feel so weird, C++ its literally just a static method that returns the type of the class it represents

#

how do you destruct your object?

#

or dispose

round dome
#

in cpp? u call the destructor that u defined

#

i don't fuck with that java crap

burnt cobalt
#

anyone need help with discord.py I got my dev badge

vague narwhal
#

Would someone be able to help me with my broken code?

#

Here is the code:


import pafy
import vlc

url = "https://www.youtube.com/watch?v=dQw4w9WgXcQ"
video = pafy.new(url)
best = video.getbest()
playurl = best.url
Instance = vlc.Instance()
player = Instance.media_player_new()
Media = Instance.media_new(playurl)
Media.get_mrl()
player.set_media(Media)
player.set_fullscreen(True)
player.play()

the programme works fine in the python idle but when i compiled the file with pyinstaller it no longer worked as an exe

#

I just got a blank terminal window and then that closed aswell 😦

#

also if you hadn't already guessed i coded it in python

warm sleet
#

@vague narwhal can't you just run the program with the interpreter as is?

#

$ python file.py

vague narwhal
#

lemme try

#

i am on windows btw

warm sleet
#

you still need the interpreter

vague narwhal
#

it worked in the idle

#

but not the interpreter i don't think

warm sleet
#

the IDE calls the interpreter

vague narwhal
#

ok

warm sleet
#

I am not very familair with how python packages are installed on windows

#

on linux they come as OS packages..

#

are you using venv?

vague narwhal
#

no

warm sleet
#

or what are you using to manage your dependencies?

vague narwhal
#

nothing

warm sleet
#

pafy and vlc?

vague narwhal
#

i am just opening the exe file that i created

#

yes

warm sleet
#

those are dependencies

vague narwhal
#

ok

warm sleet
#

do you have pip?

vague narwhal
#

yes

#

that is how i installed the modules

warm sleet
#

yeah

#

it installs them into your local project

#

I am pretty sure you have to be in that same working directory when you call the interpreter

#

or

vague narwhal
#

no into the python install dir

warm sleet
#

install the pip modules globally

vague narwhal
#

yes

#

that is what it does

warm sleet
#

what error do you get if you run $ python file.py

vague narwhal
#

it jsut does nothing

warm sleet
#

from a commandline

#

;)

vague narwhal
#

it waits about a second then it just goes back to normal again

#

yes from command line

warm sleet
#

odd

vague narwhal
warm sleet
#

Im at a loss

vague narwhal
#

ok

#

have i messed up my code somewhere

warm sleet
#

can you see the command the IDE runs when you go to debug the program?

vague narwhal
#

wdum?

warm sleet
#

my python editor shows in the console output, the line of shell that was used to launch the session

vague narwhal
#

yes

warm sleet
#

see if that works for your file

vague narwhal
#

oh crap i just rickrolled myself

warm sleet
#

lol

#

I just looked at your script

vague narwhal
#

haha

warm sleet
#

it downloads rickroll and then plays it?

vague narwhal
#

Yes and you can't close it if you are computer iliterate

warm sleet
#

you can just use the open file command to do playback

#

it will open the default mediaplayer

#

you dont need the vlc library

#

oof. I feel you

vague narwhal
#

oo i can type here again

round dome
#

honestly fuck off

limpid reef
#

Um.... I don't know of many servers that allow referral links, so no?

nocturne galleon
#

what happened lol

round dome
#

some guy posted a gofundme link for his pc

vague narwhal
#

Who?

round dome
#

why does it matter?

frozen pulsar
nocturne galleon
#

hey guys im messing with making a multi-threaded sockets server in python, and when I try to spawn a new thread to handle the connection, the client gets Error 10054 an existing connection was forcibly closed by the remote host but if I name the thread, it works, however other clients cannot connect as if it is still handling the connection on the main thread, any tips?
like the server wont even pick them up despite the current connection being on a different thread

nocturne galleon
#

ok so i put some print statements in and put either [MAIN] or [New Thread] to better tell the difference between which one is saying stuff, it seems that the connection is immediately dropped as soon as it is passed to the other thread, any idea why?

naive terrace
#
import socket
from threading import Thread


class SocketThread(Thread):

    def __init__(self, connection, address):
        self.connection = connection
        self.address = address
        Thread.__init__(self)

    def run(self):
        print("Received connection from {}".format(str(self.address)))
        self.connection.sendall(b"Connection!")
        self.connection.close()


if __name__ == "__main__":
    s = socket.socket()
    print("Socket successfully created")
    s.bind(('0.0.0.0', 6500))
    s.listen(5)
    while True:
        c, addr = s.accept()
        t = SocketThread(c, addr)
        t.start()
#

try this

#

any function inside of SocketThread is part of the thread, run() gets executed when t.start() is ran

nocturne galleon
#

I'm trying to learn to script, but I'm stuck on a step. I've been able to run "cd" in the past, but now I'm getting the error message that says "The filename, directory name, or volume label syntax is incorrect."

#

I gotta go do something. If anyone responds, ping me. Thanks

graceful silo
#

yes, the error means what it says.

nocturne galleon
#

Yeah...but

#

look:

graceful silo
#

Capitalization has to be exact, and if it has spaces, the entire path should be surrounded by quotes

#

cd "fake folder/notactuallyarealfolder"

nocturne galleon
#

I'm not gonna dox myself by sending a directory, or will i...

graceful silo
nocturne galleon
#

wait yes

#

nvmd

#

I'm using Node, and it's saying that the Unexpected Identifier is this: cd C:\

#

They say the C is incorrect

graceful silo
#

hmm

astral bobcat
#

are u running in some sort of mode without permissions

nocturne galleon
#

Which it should be correct because its drive name is

#

ermmm

#

Wait

#

So the directory should be in quotes starting at the "C:\

#

._.

#

And then its unknown string when I use quotes ://

graceful silo
#

"C:" would likely be trying to escape the ending quote

#

try "C:\\"

nocturne galleon
#

Would it be more helpful if I just changed the file name to one without spaces to avoid the quotes

graceful silo
nocturne galleon
#

Every time I use the quotes, it says unexpected string

#

Without quotes, it only points to C:

astral bobcat
#

i remember when my tutor told me to avoid using spaces in file names

nocturne galleon
#

So I shouldn't use quotes if there isn't a space in the file name

nocturne galleon
#

?

nocturne galleon
#

@naive terrace that doesn’t make sense, I’ve got a copy of someone’s code they lended to me to learn from and they take the same approach as me, just pass the connection to a target function in an unnamed thread and it works fine, mine doesn’t for some reason

naive terrace
#

parts of your code don't line up, e.g. (conn, addr, ) you seem to have an extra comma

#

if theirs works and yours doesn't, maybe check python versions

jagged kayak
tall kernel
glad bone
#

@nocturne galleon Next time, use cd /d C:\Your\Folder

nocturne galleon
#

@naive terrace I found it!

#

I had a with statement that the thread was created in, so as soon as it did it it must have ended it or something

late plank
#

im stuck on some html rn, i need to evenly distribute buttons within the middle 75% of the screen. any idea on how i can do that?

#
.image {
    height: 150px;
    width: 300px;
    padding-top: 10px;
}

.body{
    top:10vw;
}


.buttonWrapper {
    display: inline-block;
    background-color: lightgray;
    text-align: center;
    border: 2px solid black;
    margin-top:20px;
    top:18vw;
    width: 320px;
    height: 180px;
    position: relative;
    z-index:10
    margin-left:12.5%;
    margin-right:12.5%;
    left:auto;

}

.buttonWrapper:hover {
  background-color: rgba(255, 255, 255, 0.7);
  color: gray;

}

.title {
    color: black;
}






<a href="#">
        <div class="buttonWrapper" >
            <img class="image"
                src="IMG_7389.jpg">
            <div class="title">
                title
            </div>
        </div>
    </a>

<a href="#">
        <div class="buttonWrapper">
            <img class="image"
                src="IMG_7389.jpg">
            <div class="title">
                title2
            </div>
        </div>
    </a>

#

the top part is my css part and the bottom 2 a href's are the lines of code generating the buttons

unkempt lotus
#

@late plank

.btn-container {
    width: 75%;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
}

Should do what you're looking for.
Set the width of the container to the maximum size, and with flex, aligning elements is pretty simple.

tall widget
#

Any apache gurus here?

round dome
#

do yourself a favour and switch to nginx

midnight wind
#

caddy is also nice

velvet bear
#

has anyone here integrated nasm into visual studio 2019? ive been at this all day, each time when i tell it to build it somehow dosent and gives me an error that it cant find the file to execute

vernal marsh
#

no.. actually @velvet bear unfortunately I spent a long time finding that too but nope... I just reverted back to good old form

#

I have a python question if anyone's interested to tell me about it

decoder_embedded = layers.Embedding(input_dim=decoder_vocab, output_dim=64)(
    decoder_input
)
#

don't mind the code of what its doing.... but how is layers.Embedding returning a pointer to a function which can be called wiht arugment_(decoder_input)_? how do you do that python...

velvet bear
#

reeeeee

#

i need vs debugging tools to views registers

#

there should be a way to pass commands on build to nasm

vernal marsh
#

🤷‍♂️ man.. if someone has done it... I would be glad to know

velvet bear
#

if i figure it out ill ping you

vernal marsh
#

yeah I just messaged person who is probably like 10x experienced than me maybe he has done it.... I will let you know too if I find something

velvet bear
#

thanks

vernal marsh
#

@velvet bear naah he got nothing either 🤷‍♂️

velvet bear
#

sad

#

ill have to try to do it myself

#

try to execute a shell command during build

vernal marsh
#

yeah... well I didn't find any good way for doing it ... but well I was tiny little tiny 16yo brain last year lol

velvet bear
#

lol well hopefully i can figure it out

vernal marsh
#

I have a python question if anyone's interested to tell me about it

decoder_embedded = layers.Embedding(input_dim=decoder_vocab, output_dim=64)(
    decoder_input
)

don't mind this 🙂 I forgot python variables are pointers anyways

quiet nymph
#

Hey LMG staff, I have a suggestion, I have been watching you guys grow into who you are now since 2012... And for my suggestion, I suggestion you guys put that LMG gaming lounge into good use. Please... create a gaming channel and play GAMES

round dome
#

noted, thanks for your suggestion, you can go now

trail anvil
#

hey guys I wanna make an android app that is compatible with old phone like android 2.1. How would i go around to do that?

#

as android studio only has the latest sdk/api level availible to code in

#

I am compitent (i think) but where would i find documentation for that old version

jagged kayak
#

can i ask why

trail anvil
#

Not really an original idea but here it goes.
I want to make an app that you can sideload on almost any hunk of junk phone that will act as a gps tracker (ie tracking a possibly stolen car) and it being an old phone probably uses little battery and it should run for a long time

#

sends info via sms or internet whatever you set it as

#

Mainly for personal use as im planning on buying a car and it being one of my biggest purchases I want it protected

#

but also if stable and good i might put it up on github and make it open source

velvet bear
#

@vernal marsh so three been an update, it does assemble but just throws a ton of errors, if you can help me figure out whats wrong thatd be great

#

@trail anvil satnav comes with gps tracking and comes on every car im p sure just download the satnav app

round dome
#

these errors look pretty clear to me?

velvet bear
#

ok then what should i fix

round dome
#

why isn't there a space between the section keyword?

velvet bear
#

what

#

this is nasm x86 assembly

trail anvil
#

@velvet bear m8 find sat nav in a fiat punto from 2000 or yugo

velvet bear
#

look if your car dosent have satnav i dont think you hsould be concerned with ppl steailng it@trail anvil

#

putting a space after section did fix like 3 but why

trail anvil
#

Well i am concerned as it's still worht something. And I'd be devastated if I lost it@velvet bear

velvet bear
#

you should probably look around on the place where you download the official sdk and just go back in time

trail anvil
#

I got the official sdk

#

I need documentation on how to program for it

velvet bear
#

there should be a readme somehwere

trail anvil
#

On how to install yeah

velvet bear
#

like in the readme there should be a link to the docs

trail anvil
#

I'll look more into it

vernal marsh
#

@velvet bear well mornin to you..... I just woke up

velvet bear
#

im still awake lol

vernal marsh
#

huh.... I will try it in a few hours

velvet bear
#

i tried a couple things but i havent done one thing i still want to do

vernal marsh
#

didi it work though?

velvet bear
#

sort of

vernal marsh
#

still errors I guess

velvet bear
#

another thing i want to try is to compile the file completly independant of vs using nasm

#

then just convert it form an object to an exe using vs

vernal marsh
#

yeah, i thought you wanted that in the first place lol

velvet bear
#

yeah but i got side tracked because its hard to trace down exaclty what i need to execute

vernal marsh
#

_ I just woke up_ ... I wouldn't say so, I am half asleep atm... I will be back when I really wake up lol

velvet bear
#

lol

vernal marsh
#

I am hungry

velvet bear
#

well its almost midnight here

#

but hopefully i can do the thing tommorow

vernal marsh
#

wellp you are probably in US ?

#

east

velvet bear
#

canada actually

#

toronto

vernal marsh
#

nice... I was kinda right I usually forget the exact GTC conversion

velvet bear
#

well its 11:36 pm

vernal marsh
#

when do you sleep?

#

I mean usually

velvet bear
#

idk

#

wake up aorund 7-9

vernal marsh
#

nice same here... although I sleep around 2-3 🤦‍♂️ I really should sleep more than 5-6 hours but ...

#

that never happens...

velvet bear
#

yeah lol

vernal marsh
#

alright.. be right back.... my stomach is roaring

velvet bear
#

aight cya

velvet bear
#

good news: i sucesfully got vs to assemble the code into an obj file

#

next step is to figure out how do i force it to turn the obj file into an exe

#

yeah literally just get the it to do that and ittl work

#

@vernal marsh

#

nasm theoretically has support for this but i havent gotten it to work yet

#

basically the thing i thought would work most likely will

vernal marsh
#

oooh I am so sorry I didn't follow up on this... my gf was mad at me ... and now she is not... and then I found a method to make my ML model work... I was so freakinn happy

#

@velvet bear any progress? I think you might be sleeping though

#

yeah.. its 3 pm there lol so I guess..

slender lark
#

help my Hello world isn't working lmao

#

print("Hello, world!")

#

whats wrong with it 😂 😂

hollow basalt
clear flax
#

Do you code at all?

velvet bear
#

@vernal marsh idk i havent used nasm much how to go from the .o file to exe

warm sleet
#

wat

#

don't you need a linker ?

#

object file format is just an assembly with machine code

#

I have no clue how this is done on windows xD

#

You can use ld

#

that should consume you .obj file

#

something along the lines of

#

$ ld foo.obj C:\Windows\System32\user32.dll -o foo.exe

velvet bear
#

yeah i tried but it just throws at me that ld isnt valid

#

ive reinstalled nasm but it still dosent add to path

#

what does ld call@warm sleet

warm sleet
#

ld is the gnu linker

#

it links function references that are unresolved in your object file, to addresses of your kernel memory space

#

in the example I gave you, the user libs from windows 32

#

if you need syscalls, I believe kernel32.dll is the one you need

velvet bear
#

look when i try to run ld it just says that ld isnt a defined command, do you know what file the command ld is calling so i can call it manually

warm sleet
#

ld is a program

#

part of the GCC

velvet bear
#

yes, where is it

#

nasm didnt add to path for some reason

warm sleet
velvet bear
#

ill install gcc and ill get back to you

warm sleet
#

@velvet bear I'm sure this is possible with the windows SDK

#

but idk how 2 lol

#

I only ever did native stuff on linux

velvet bear
#

lol

warm sleet
#

for reasons

#

you are currently experiencing

#
crystal@watomat:~$ which ld
/usr/bin/ld
crystal@watomat:~$ file /usr/bin/ld
/usr/bin/ld: symbolic link to x86_64-linux-gnu-ld
crystal@watomat:~$ 
#

@velvet bear though, using ld, you may as well just use all of gcc

#

its a big toolchain

velvet bear
#

nasm is supposed to be cross platform but really its just for linux

warm sleet
#

compiles for any and all hardware

#

if its just C

#

you don't need nasm

velvet bear
#

no i need nasm for assembly

warm sleet
#

right

#

typically

#

without an assembler

#
 crystal@watomat  ~/CLionProjects/untitled2  cat main.c 
#include <stdio.h>
#include <time.h>
#include <stdbool.h>

void bar(int *wat) {
    (*wat)++;
}

int main() {
    int foo = 10;

    bar(&foo);

    printf("%d", foo);
}%                                                                                                                                                                                                                    crystal@watomat  ~/CLionProjects/untitled2  gcc main.c
 crystal@watomat  ~/CLionProjects/untitled2  ./a.out 
11%                                                                                                                                                                                                                   crystal@watomat  ~/CLionProjects/untitled2  
#

You'd do something like this ^

#

gcc generates .out files

velvet bear
#

right

warm sleet
#

.out files are assembler output

#

machine code

#

I can run it right away

velvet bear
#

what

warm sleet
#

see above?

velvet bear
#

how do you run .out files

warm sleet
#

by executing them?

velvet bear
#

is thatthe lnux executable format

warm sleet
#
    .file    "main.c"
    .text
    .globl    bar
    .type    bar, @function
bar:
.LFB0:
    .cfi_startproc
    pushq    %rbp
    .cfi_def_cfa_offset 16
    .cfi_offset 6, -16
    movq    %rsp, %rbp
    .cfi_def_cfa_register 6
    movq    %rdi, -8(%rbp)
    movq    -8(%rbp), %rax
    movl    (%rax), %eax
    leal    1(%rax), %edx
    movq    -8(%rbp), %rax
    movl    %edx, (%rax)
    nop
    popq    %rbp
    .cfi_def_cfa 7, 8
    ret
    .cfi_endproc
.LFE0:
    .size    bar, .-bar
    .section    .rodata
.LC0:
    .string    "%d"
    .text
    .globl    main
    .type    main, @function
main:
.LFB1:
    .cfi_startproc
    pushq    %rbp
    .cfi_def_cfa_offset 16
    .cfi_offset 6, -16
    movq    %rsp, %rbp
    .cfi_def_cfa_register 6
    subq    $16, %rsp
    movq    %fs:40, %rax
    movq    %rax, -8(%rbp)
    xorl    %eax, %eax
    movl    $10, -12(%rbp)
    leaq    -12(%rbp), %rax
    movq    %rax, %rdi
    call    bar
    movl    -12(%rbp), %eax
    movl    %eax, %esi
    movl    $.LC0, %edi
    movl    $0, %eax
    call    printf
    movl    $0, %eax
    movq    -8(%rbp), %rdx
    xorq    %fs:40, %rdx
    je    .L4
    call    __stack_chk_fail
.L4:
    leave
    .cfi_def_cfa 7, 8
    ret
    .cfi_endproc
.LFE1:
    .size    main, .-main
    .ident    "GCC: (Ubuntu 5.4.0-6ubuntu1~16.04.12) 5.4.0 20160609"
    .section    .note.GNU-stack,"",@progbits
#

this is what it generated

#

that's the assembly itself

velvet bear
#

yeah

#

well for windows you need a specific file type

#

with a header

warm sleet
#

pretty sure its all ELF

#

Executable and linkable format

velvet bear
#

right

warm sleet
#

brainfart

#

I typed 'electrical' xD

#

@velvet bear as a meme, try renaming the .out to .exe

#

and then run it

velvet bear
#

ive tried it says that this program cant run on your pc

#

check with the publisher

warm sleet
#

cool

velvet bear
#

im the publisher

warm sleet
#

thats about as useless

#

as

#

"Contact your system admin"

velvet bear
#

yeah

#

lol

#

gotta love user friendly error messages

warm sleet
#

oh my god

#

yeah

#

PE

#

or ELF

#

those are the two main ones

velvet bear
warm sleet
#

Cool windows

#

care to share

#

why

velvet bear
#

it cant

warm sleet
#

so stupid

#

windows doesn't ever show useful debug info

velvet bear
#

its so that people dont get scared

warm sleet
#

humans are shit

#

computers inherently superior

#

except not when programmed by M$

velvet bear
#

yeah if you ever have to deal with clients in programming you will wonder if they have ever used a computer before touching your program

warm sleet
#

I stay sane by using .NET for windows desktop software

#

low level API stuff on windows is hell

#

ever seen the win32 api? xD

velvet bear
#

yeah lol

cursive plume
#

Hello

warm sleet
#

suh

#

You in luck

#

I am java pro

cursive plume
#

good 😃

warm sleet
#

But yeah, snippet of code

#

terminal output

#

would be useful

#

I cant smell problems

cursive plume
#

hold on making you a snippet

warm sleet
#

if you put ``` around it

#

it makes it look like code

cursive plume
#

hastebin

velvet bear
#

also what language is the about section in this channel

warm sleet
#
int wat = 1;
velvet bear
#

like its the functon print()

warm sleet
#

@velvet bear could be anything

velvet bear
#

python

warm sleet
#

python, lua

velvet bear
#

but it has a semicloon

warm sleet
#

there's a lot of em

#

semicolons are valid, but not required in lua

velvet bear
#

yeah

warm sleet
#

print() might also work in php

#

lol

#

though.. hold on

#

its a single '

#

that limits languages, because typically ' ' is char literal

velvet bear
#

shoutout to that one girl in my cs class that said she knew html when we were asked what programming languages we knew

warm sleet
#

I came home from vacation in 2nd week of new semester on php

#

teacher wanted me to plug in my laptop to beamer

#

and then show us my homework

#

ofc, I had nothing prepared

cursive plume
#

@warm sleet ```URL url = new URL(uri);
connection = (HttpURLConnection)url.openConnection();
connection.setRequestMethod("GET");

connection.connect();
System.out.println(connection.getHeaderFields());
System.out.println(connection.getResponseCode());```

warm sleet
#

so he made a fool out of me, for trying foo.bar()

#

next day, he tried it again,but that time I did some light reading

#

screw->this(syntax);

velvet bear
#

lol

warm sleet
#

@cursive plume one sec, lol. been a while since I did something with HttpUrlConnection

#

I have a bunch of libraries that abstract this awa

#

@cursive plume what are you trying to archieve?

#

get the content body?

velvet bear
#

thank you mingw for not setting path i wasen't planning on using the software i just installed anyway

cursive plume
#

@warm sleet No, im trying to find out what the header name of this header is: null=[HTTP/1.1 200 OK]

warm sleet
#

That's not a header

hollow basalt
warm sleet
#

but the first response from the server

#

-.-

#

lmao

#

how did I miss this

cursive plume
#

well why is it null

warm sleet
#

because

#

its not a header

#

This is what a typical HTTP conversation looks like:

cursive plume
#

i cant do connection.getHeaderField("null"));

#

because null is you know.. null

hollow basalt
warm sleet
#

See the first line ^ ?

#

That's what your HttpUrlClient, mistakes for a header

#

the first line is the response code from the server

#

THEN

#

all your headers

#

followed by \r\n twice

cursive plume
#

HttpUrlConnection

warm sleet
#

then your body

hollow basalt
#

^

warm sleet
#

tomato tomato

cursive plume
#

yeah

hollow basalt
#

yea

cursive plume
#

But if i want todo connection.getHeaderField(header))

#

On the http/1.1 200 ok

warm sleet
#
    protected HttpURLConnection getConnection(String path, String method) throws IOException {
        URL url = new URL(path);
        HttpURLConnection connection = (HttpURLConnection) url.openConnection();
        connection.setDoOutput(method.equals("POST"));
        connection.setRequestMethod(method);
        connection.setRequestProperty("Accept", contentType);
        return connection;
    }
hollow basalt
#

but why

cursive plume
#

Why not?

hollow basalt
#

it's the HTTP status

cursive plume
#

But the HTTP 1.1

#

I know i can do connection.getStatusCode() but it retrives 200 OK only

hollow basalt
#

I honestly don't know why you would want HTTP1.1

warm sleet
#

is that 'Null' line, the first item in getHeaderFields() ?

hollow basalt
#

^

cursive plume
#

all the headers

#

@warm sleet Correct

hollow basalt
#

hit or miss? i guess they never miss

cursive plume
#

huhhh

warm sleet
#

cache miss? just means it didnt hit db

#

but that is irrelevant

hollow basalt
warm sleet
#

@cursive plume I said this before, that first item

#

is the response from the webserver

cursive plume
#

Yes.

warm sleet
#

not a header

cursive plume
#

But its included in it and there is no other way i know of to retrive it, so there it stays

#

and i need to retrive it alone, without the other headers

warm sleet
#

All you need is the status code

#

"OK" is just the text version of 200

#

thats what that first line does

cursive plume
#

Also exuse me for being completly incompetent at this im trying to learn

#

But what about the HTTP version?

warm sleet
#

You should maybe learn how HTTP works

#

its not that difficult, but very important to know how

cursive plume
#

I know most of the statuscodes

hollow basalt
#

Do you have a specific reason to get the HTTP version

warm sleet
#

You ask an HTTP server, GET me /somefile using HTTP version 1.1

#

the server responds, 200 OK, Also using HTTP1.1

#

gives you some headers with meta information about the response

#

and then the content

#

HTTP is dead simple.

hollow basalt
#

the S in HTTPS means simple

warm sleet
#

oof

cursive plume
#

it means secure but ight

#

i think atleast?

hollow basalt
#

Usually you don't need [to know] the HTTP 1.1

warm sleet
#

@hollow basalt well, if you specify a Host: header in your request, then you do

#

oh

#

nvm

#

vhosting is HTTP/1.1

cursive plume
#

Well, im using github pages so it might be vhosting idk

warm sleet
#

@cursive plume what are you attempting to do

#

like

#

why this HTTP request

#

what are you fetching

#

trust me, the 200 OK HTTP/1.1 is the least interesting line of a response

#

all you care about is that its 200

#

and the java http client will throw an exception if it isnt 200

cursive plume
#

Im fetching the headers of 'w1ll1am04.github.io' and trying to get the webserver version like = null=[HTTP/1.1 200 OK]

warm sleet
#

300 is redirect

#

webserver version is nonstandard in HTTP

#

X-Powered-By is the header

#

that most webservers use

#

@cursive plume ignore that first one

#

xD

#

You don't need it

cursive plume
#

Im confused

hollow basalt
#

If you are still learning HTTP then I suggest ignoring most of the headers for now lol

#

status code is important

#

the rest wing it

cursive plume
#

Well im making a program to retrive those headers

hollow basalt
#

for?

cursive plume
#

my github

#

for exercise

warm sleet
#

OMG

#

I just

#

realized my shell

#

has a built in http client

hollow basalt
#

curl?

cursive plume
#

wget?

warm sleet
#

soz have to deleted

#

wget is a program to make http requests

hollow basalt
#

should've screenshot that

warm sleet
#

so is curl

cursive plume
#

@hollow basalt the command was 'HEAD'

warm sleet
#

haha, yeah but

#

good luck

cursive plume
#

😆

warm sleet
#

this is my work IP

cursive plume
#

doxx your work

hollow basalt
#

@warm sleet sir you have a virus, give me your credit card now

warm sleet
#

I dont have that

cursive plume
#

And your mothers maiden name.

warm sleet
#

do you accept bitcoin?

hollow basalt
#

@warm sleet 1bitcoin is enough to remove the virus

warm sleet
#

lol

cursive plume
#

or pc will explode in 4 minutes

warm sleet
#

I shouldv kept my bitcoins

hollow basalt
#

i'd be buying me a new pc

warm sleet
#

I had like 20 btc in early 2010

#

worth like 3 bucks each

hollow basalt
#

now look at you

#

in here in LTT

warm sleet
#

I sold them for 72

#

that was the highest it got at the time

#

before mtgox died

cursive plume
#

Its worse for the guy who bought coffe with like 10k bitcoin

warm sleet
#

@cursive plume if you want to get the body of the response

#
    protected String getResponse(HttpURLConnection connection) throws IOException {
        BufferedReader reader = new BufferedReader(new InputStreamReader(connection.getInputStream()));

        String output;
        StringBuilder sb = new StringBuilder();

        while ((output = reader.readLine()) != null) {
            sb.append(output);
        }
        return sb.toString();
    }

use this bit of code ^

hollow basalt
#

I [Can't] ?

warm sleet
#

yes

#

❤️

#

oki, its past 5

#

I gotta go home

cursive plume
#

slowly.. backs out of room

warm sleet
#

@cursive plume look up a small tutorial lol

#

"How to make http request with java"

hollow basalt
#

i bet tutorial point is the first result

warm sleet
#

or stackoverflow

hollow basalt
#

or an ad

cursive plume
#

Wrong both

warm sleet
#

I wrote myself a lib for this, long time ago

cursive plume
#

wrong

#

stackoverflow secound tho

hollow basalt
#

"oracle"

warm sleet
#

yes

#

they actually

hollow basalt
#

have

warm sleet
#

have good tutorials

#

wat

#

cya laters

#

im off

upbeat nymph
warm sleet
#

@upbeat nymph I skipped that one, but it was my first one too

#

first one is either an ad, or featured article

hollow basalt
nocturne galleon
#

https://stackoverflow.com/questions/63870253/how-to-control-the-elevation-of-the-material-toolbar-according-to-my-own-prefere

can someone please answer this question? its been a few days and the only dude that responded didn't even fully read the question

grizzled panther
#

Would appreciate some feedback on this bit of Java code. Good, bad, or meh?

  // Build out some arrays to hold the values that playGuitar() will use
  private final String[] musicalNotes = { "A", "B", "C", "D", "E", "F", "G" };
  private final String[] noteDuration = { "(0.25)", "(0.5)", "(1)", "(2)", "(4)" };

  // Method to build out the 16 cords from the base 
  // musicalNotes & noteDuration arrays
  public String playGuitar() {
    String[] cords = new String[16];
    String randValue1;
    String randValue2;
    for (int i = 0; i < 16; i++) {
      randValue1 = musicalNotes[new Random().nextInt(musicalNotes.length)];
      randValue2 = noteDuration[new Random().nextInt(noteDuration.length)];
      cords[i] = randValue1 + randValue2;
    }
    return Arrays.toString(cords);
  } // End playGuitar method

Output looks like this:
[B(4), E(0.25), A(1), B(0.5), B(0.5), A(4), D(0.5), E(0.5), G(1), F(4), G(2), G(0.25), C(1), E(1), G(0.25), F(2)]

shell socket
late snow
#

I need to find a free plugin for WordPress so I can put 360 panoramas on my website

ruby pewter
#

@grizzled panther From a musician's POV please, for the love of god, start with the C ahaha and not A and B

clear flax
#

Hi, I am using Bootstrap and trying to get a dropdown to align to the left rather than the right. Right now it displays on the right and clips through the HTML body because the button is spanned all the way to the right of the screen.

#

Is there a way to change the alignment of the dropdown?

#
                <button type="button" class="btn btn-secondary">
                    Split dropdown
                </button> <div class="btn-group dropdown" role="group">
                    <button type="button" class="btn btn-secondary dropdown-toggle dropdown-toggle-split" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
                        <span class="sr-only">Toggle Dropdown</span>
                    </button>
                    <div class="dropdown-menu">
                        <a class="dropdown-item" href="#">Aaaaaaaaa</a>
                    </div>
                </div>

            </div>```
#
    background-color: white;
    padding: 10px;
    display: flex;
    justify-content: space-between;
}```
warm sleet
#

css 👀

unkempt lotus
clear flax
#

Ah yes, missed it

#

I moved it to the other side of the screen anyway.

unkempt lotus
#

that works as well lol

clear flax
#

The annoying thing was it was a splitbutton

errant raptor
gray gull
#

We're about to tackle bootstrap like next week in my college

#

Hype?

#

Maybe.

#

If anything, I prefer software/game development over Web development

#

Backend, not frontend

#

Cause im terrible with design/art or any of that sort

nocturne galleon
vernal marsh
#

alright there might be very easy explanation but I can't figure out one thing

#
routes = [
    ["DSM" ,"ORD"],
    ["ORD", "BGI"],
    ["BGI", "LGA"],
    ["SIN", "CDG"],
    ["CDG", "SIN"],
    ["CDG", "BUD"],
    ["DEL", "CDG"],
    ["DEL", "DOH"],
    ["TLV", "DEL"],
    ["EWR", "HND"],
    ["HND", "ICN"],
    ["HND", "JFK"],
    ["ICN", "JFK"],
    ["JFK", "LGA"],
    ["EYW", "LHR"],
    ["LHR", "SFO"],
    ["SFO", "SAN"],
    ["SFO", "DSM"],
    ["SAN", "EYW"],
]
#

I have this list... I want to merge the lists which have the same 1st element

#

so like

#

["CDG", "SIN"] would become ["CDG", "SIN", "BUD"]

#

pretty simple stuff... for this I have a function


def process_routes(r):
    last = ""
    temp = []
    counter = 0
    for i in range(len(r)):
        if i:
            last : str = r[i-1][0]
        if r[i][0] == last:
            counter +=1
            temp[i-counter].append(r[i][1])
        else:
            temp.append(r[i])
    print(temp)
#

as expected... but then when it enters if r[i][0] == last: when "CDG" is same

#

both r and temp gets changed when I had done nothing with r🤷‍♂️ .. I just appended one thing to temp[i-counter]

#

is there an explanation for this are they pointing to save value and changing one changes other or something??

clear flax
#

@vernal marsh I am confused

#

@errant raptor Stick the picture inside a div with 100% width (or an element similar to the thing below it), change the picture to an inline block, then change the parent's text-align to center.

#

is what I do

clear flax
#

No wait, here the padding centres the whole thing and the text-align centres the navigation so that it doesn't just appear on the left of the image, but close enough.

#

Yeah

errant raptor
#

@errant raptor Stick the picture inside a div with 100% width (or an element similar to the thing below it), change the picture to an inline block, then change the parent's text-align to center.
@clear flax i fixed it with using margin

limpid plaza
#

Can someone explain why:

        String s1 = "JavaProgramming";
        String s2 = "Java";

        System.out.println(s1.compareTo(s2));
        System.out.println(s2.compareTo(s1));

returns a
11
-11

foggy ginkgo
clear flax
#

@errant raptor In my example I used margins to centre the picture but text align to centre the navigation in the same margin.

clear flax
#

Hmm, and?

#

Hmm

#

Weird you are returning an enumerator which looks like a task

fathom prawn
#

can anyone help me with this charAt(X,B[A[4]]) and A= [5,7,2,9,1,3] and B = [ 5, 8, 3, 5, 9, 5, 4, 7, 1, 0 ] and X = “PQRSTUVW”

glad bone
#

First, you get the 5th (because 4 + 1) item from the A array.
Then you get 1 and get the 2nd (1 + 1) item from the B array.
You'll get 5.
Get the 6th (5 + 1) char in X and you'll get 'U'

fathom prawn
#

AHHH thx