#development
1 messages · Page 51 of 1
wdym ??
i dont want some unreadable obfuscated shit
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 
oh yeah if else every second so the clock will be a bit late but nah
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
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
@late plank Swift is childs play. Try Objective C 😄
let's just say implementing stuff like Apple Wallet card provisioning is hell
Ive only done arduino and skript
Apple likes to overcomplicate their API
(anyway, leaving, bed time for me)
Gn
Dunno if anyone here's interested, but I did some neural network stuff benchmarking varying training techniques. https://github.com/stratzilla/metaheuristic-training-networks
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.
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.
you can write it in any way you want...
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
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)
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?
@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.
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
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.
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
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.
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!
I mean you could write the backend using nodejs and sql
but at the same time... might be rough too lol
php is that
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.
technical debt?
Changing a database structure after the fact is so unbelievably laborious. Good idea to look up good relational database practices.
Yes, technical debt!
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
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
I mean you could use mongo if you really wanted
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.
yikes
yeah technical debt
I've heard of that
I have a lot of technical debt in my program lol
anyone do the language agnostic Enso IDE thing?
luna-lang.org the old web frontend
makes coding rust and integrated haskell platform simpler for the masses
i mean who wants to know basic code optimizations between different platforms
yoo
can someone help me with that?
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
here is the code
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
also that issue started after uploading the bot on heroku
Hello, im getting this errorr
when im making a website
im following a tutorial on vue and i did exactly the same
google it but you need to edit your head tags most likely
yeah but i tried to change nothing happends
@elder ivy
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
https://www.reddit.com/r/worldnews/comments/ic8f3p/internet_explorer_is_dead_as_microsoft_kills_off/
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?
Wait, how will I run my 20-years-old corporate ActiveX websites?
@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
https://github.com/stratzilla/socket-chat I wrote this a few months ago, this is generally the ideal way
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.
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
I don't quite understand.
A client would need a thread separate from server.
The actual application needs only 1 for the server.
yeah I was thinking thats the way, thanks for posting your github, that looks like a really helpful resource
It's just a simple socket chat but should be a good springboard off to more complex stuff.
@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.
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
@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
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
@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
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
Oh, this was what I did
async function loadAPI(URL, apiDataVar, apiLoadVar, volumeVar, apiErrorMSG, priceVar) {
await fetch(URL)
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
I'll try it like that
So I did var btcPriceAPIData = loadAPI(btcPriceAPI)
And when I log btcPriceAPIData, this comes out
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())
}
how did you call it?
@neon quiver Like this
var btcPriceAPIData = loadAPI(btcPriceAPI)
try let btcPriceAPIDate = await loadAPI(btcPriceAPI)
I'm not calling it in an async function so I cant call it with await
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
np!
you don't need to return await btw
really want you want is something like:
return res.json();```
Hello! I want to create a login form on my website. email and password.
do i need any GDPR stuff for that
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.
@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
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.
man gdpr is hard
idk what to write
im only collecting email and password
thats encrypted
You can blame the information industry for GDPR.
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. 😉
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.
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?)
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.
For Deep learning and convolutional neural networks, which is the best os?
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
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
which you can register to access the content for at https://redhat.com/summit
data science stuff isn't really my thing though, so ehh
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
looks less confusing for beginners
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
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.
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
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"
})
I mean you can maybe manually just set display: none after the animation is done
I could but I want to make my code as optimized as possible, so I'll keep this for now
👍 I didn't know it either, just gotta pilfer through the APIs lol
Yeah lol
I was trying to do it quickly so I didn't take a good look at everything
what messaging queues do you lot use? trying to decide on an on premise with clustering
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
is this active if I send a question or am I just gonna waste my time
This situation reminds me of "Don't ask to ask": https://dontasktoask.com/
I wrote my first semi-working program with Python a few days ago. Took me a few days to work out some bugs/add features, but I hope to get back some feedback :)
use v1.4.1 if you're testing
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.
So, in this case, you should only have inventorySystem.py
and every single change you make is a sort of a version
You can then create Tags to mark specific versions if you want
I, along with some friends, have created what we feel like was a good git workshop that you can take a look at here: https://github.com/acmfeup/git-workshop/blob/master/workshop.ipynb
Alright, thanks man 🙂
nevermind, my arduino 101 doesnt support fastled
Is it better to use references instead of pointers because you won't have to delete them
?
in what context?
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?
why don't you ask the instructor
ill ask once we actually have a class heh
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
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.
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
Should I use a struct for a node in a binary search tree or a class for a node
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.
@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.
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.
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
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?
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.
I was also thinking of using Linux, but since I'm in school, it might be a bit hard to get used to it.
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.
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
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
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
Is the nvidia 980 gpu not supported for cuda?
anyone here speak github?
sure what about it @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
git isn't github btw
Are you using cli or GUi?
the desktop client
For some reason it wants to put everything in the documents folder (on the boot)

how do i put a gif as background for a website?
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
For some reason it wants to put everything in the documents folder (on the boot)
@fickle crypt there should be a local path location option when cloning. Set that to where you want the repo. https://docs.github.com/en/desktop/contributing-and-collaborating-using-github-desktop/cloning-a-repository-from-github-to-github-desktop
You can use GitHub to clone remote repositories to GitHub Desktop.
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
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...
thanks!
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)
you haven't made the makeList func
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;
}
};
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++
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
what's the purpose of the one in the cpp file???
I assume the header is just the class definition, implementation in their CPP
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
^ thats a static call to a function, or a constructor
what are you talking about
it's the pattern to define class functions outsite their header file
Yeah, but their class implementation has a makeList()
instead of using an actual constructor
so?
I clearly need to learn more lmao
List::List() { //construct your object here }
that's irrelevant to the compilation problem though
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
From what i am seeing, you are doing an instance call on an object that doesnt exist
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
ret_type class_name::class_func(params)
@round dome What does this do exactly?
class fuck{
void hello();
};
header.h
#include "header.h"
void fuck::hello()
{
return;
}```
file.c
Thats only to define methods out of scope of the class
and the problem here is that the compiler can't find the makeList definition
do you think you're helping?
you're just saying random shit that's not going to help solve the issue, and now you're name calling
😅
Do I include linkedlist.h in the linkedlist.cpp file?
I thought you didn't need to do that
so you define a function in a file, don't include it and expect the compiler to know what the function is?
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
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
@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++
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);
};
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
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?
As I said, I kind of wanted to tool around with oop, make a simple class and perform some stuff on some object
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
You can't define functions in a struct right?
yes u can
because you've probably only touched c before
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?
just re-read what I wrote
I feel like I explained this already
even gave an example
I got this error then
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
why are your struct definitions not in the header file?
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
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
why is there a global variable in your source file?
List* list;
what is that :: operator called?
scope operator (the official name is scope resolution operator but who fucken cares)
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
The fields are configured in your header
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
you can have public fields and private fields
private fields can only be accessed by blocks that have the same scope as your class
I have picked up a bit of oop when we did a tiny bit of java in school too
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
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; }
on a microcontroller
in main.c
not entirely conviced with the internal logic of that thing
Because I removed the global variable from the class in the header
you should only access the object via its public fields, or through its public methods
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
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
anyone need help with discord.py I got my dev badge
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
@vague narwhal can't you just run the program with the interpreter as is?
$ python file.py
you still need the interpreter
the IDE calls the interpreter
ok
I am not very familair with how python packages are installed on windows
on linux they come as OS packages..
are you using venv?
no
or what are you using to manage your dependencies?
nothing
pafy and vlc?
those are dependencies
ok
do you have pip?
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
no into the python install dir
install the pip modules globally
it jsut does nothing
it waits about a second then it just goes back to normal again
yes from command line
odd
Im at a loss
can you see the command the IDE runs when you go to debug the program?
wdum?
my python editor shows in the console output, the line of shell that was used to launch the session
yes
see if that works for your file
oh crap i just rickrolled myself
haha
it downloads rickroll and then plays it?
Yes and you can't close it if you are computer iliterate
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
oo i can type here again
honestly fuck off
Um.... I don't know of many servers that allow referral links, so no?
what happened lol
some guy posted a gofundme link for his pc
Who?
why does it matter?
I have a file. It works fine. (the fetch.js file). If I put all my code into the response (https://prnt.sc/ufqibb) I can access them. Like roadster.name etc etc. But if I move (https://prnt.sc/ufqixl) into roadster.js I get Uncaught ReferenceError: roadsterResponse is not defined
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
and here is accompanying code
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?
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
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
yes, the error means what it says.
Capitalization has to be exact, and if it has spaces, the entire path should be surrounded by quotes
cd "fake folder/notactuallyarealfolder"
I'm not gonna dox myself by sending a directory, or will i...

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
hmm
are u running in some sort of mode without permissions
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 ://
Would it be more helpful if I just changed the file name to one without spaces to avoid the quotes

Every time I use the quotes, it says unexpected string
Without quotes, it only points to C:
i remember when my tutor told me to avoid using spaces in file names
So I shouldn't use quotes if there isn't a space in the file name
?
@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
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
muh speed
Nice
@nocturne galleon Next time, use cd /d C:\Your\Folder
@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
this fixed it
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
@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.
Any apache gurus here?
do yourself a favour and switch to nginx
caddy is also nice
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
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...
reeeeee
i need vs debugging tools to views registers
there should be a way to pass commands on build to nasm
🤷♂️ man.. if someone has done it... I would be glad to know
if i figure it out ill ping you
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
thanks
@velvet bear naah he got nothing either 🤷♂️
yeah... well I didn't find any good way for doing it ... but well I was tiny little tiny 16yo brain last year lol
lol well hopefully i can figure it out
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
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
noted, thanks for your suggestion, you can go now
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
can i ask why
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
@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
these errors look pretty clear to me?
ok then what should i fix
why isn't there a space between the section keyword?
@velvet bear m8 find sat nav in a fiat punto from 2000 or yugo
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
Well i am concerned as it's still worht something. And I'd be devastated if I lost it@velvet bear
you should probably look around on the place where you download the official sdk and just go back in time
there should be a readme somehwere
On how to install yeah
like in the readme there should be a link to the docs
I'll look more into it
@velvet bear well mornin to you..... I just woke up
im still awake lol
huh.... I will try it in a few hours
i tried a couple things but i havent done one thing i still want to do
didi it work though?
sort of
still errors I guess
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
yeah, i thought you wanted that in the first place lol
yeah but i got side tracked because its hard to trace down exaclty what i need to execute
_ I just woke up_ ... I wouldn't say so, I am half asleep atm... I will be back when I really wake up lol
lol
I am hungry
nice... I was kinda right I usually forget the exact GTC conversion
well its 11:36 pm
nice same here... although I sleep around 2-3 🤦♂️ I really should sleep more than 5-6 hours but ...
that never happens...
yeah lol
alright.. be right back.... my stomach is roaring
aight cya
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
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..
help my Hello world isn't working lmao
print("Hello, world!")
whats wrong with it 😂 😂

Do you code at all?
@vernal marsh idk i havent used nasm much how to go from the .o file to exe
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
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
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
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
ill install gcc and ill get back to you
@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
lol
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
nasm is supposed to be cross platform but really its just for linux
no i need nasm for assembly
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
right
what
see above?
how do you run .out files
by executing them?
is thatthe lnux executable format
.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
right
brainfart
I typed 'electrical' xD
@velvet bear as a meme, try renaming the .out to .exe
and then run it
cool
im the publisher
This is a comparison of binary executable file formats which, once loaded by a suitable executable loader, can be directly executed by the CPU rather than being interpreted by software. In addition to the binary application code, the executables may contain headers and tables ...
oh my god
yeah
PE
or ELF
those are the two main ones
it cant
its so that people dont get scared
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
I stay sane by using .NET for windows desktop software
low level API stuff on windows is hell
ever seen the win32 api? xD
yeah lol
Hello
good 😃
hold on making you a snippet
hastebin
also what language is the about section in this channel
int wat = 1;
like its the functon print()
@velvet bear could be anything
python
python, lua
but it has a semicloon
yeah
print() might also work in php
lol
though.. hold on
its a single '
that limits languages, because typically ' ' is char literal
shoutout to that one girl in my cs class that said she knew html when we were asked what programming languages we knew
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
@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());```
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);
lol
@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?
thank you mingw for not setting path i wasen't planning on using the software i just installed anyway
@warm sleet No, im trying to find out what the header name of this header is: null=[HTTP/1.1 200 OK]
That's not a header

well why is it null

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
HttpUrlConnection
then your body
^
tomato tomato
yeah
yea
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;
}
but why
Why not?
it's the HTTP status
But the HTTP 1.1
I know i can do connection.getStatusCode() but it retrives 200 OK only
I honestly don't know why you would want HTTP1.1
is that 'Null' line, the first item in getHeaderFields() ?
^
huhhh

@cursive plume I said this before, that first item
is the response from the webserver
Yes.
not a header
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
All you need is the status code
"OK" is just the text version of 200
thats what that first line does
Also exuse me for being completly incompetent at this im trying to learn
But what about the HTTP version?
You should maybe learn how HTTP works
its not that difficult, but very important to know how
I know most of the statuscodes
Do you have a specific reason to get the HTTP version
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.
oof
Usually you don't need [to know] the HTTP 1.1
@hollow basalt well, if you specify a Host: header in your request, then you do
oh
nvm
vhosting is HTTP/1.1
Well, im using github pages so it might be vhosting idk
@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
Im fetching the headers of 'w1ll1am04.github.io' and trying to get the webserver version like = null=[HTTP/1.1 200 OK]
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
Im confused
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
Well im making a program to retrive those headers
for?
curl?
wget?
should've screenshot that
so is curl
@hollow basalt the command was 'HEAD'
😆
this is my work IP
doxx your work
@warm sleet sir you have a virus, give me your credit card now
I dont have that
And your mothers maiden name.
do you accept bitcoin?
@warm sleet 1bitcoin is enough to remove the virus
lol
or pc will explode in 4 minutes
I shouldv kept my bitcoins
i'd be buying me a new pc
Its worse for the guy who bought coffe with like 10k bitcoin
@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 ^
I [Can't] ?
slowly.. backs out of room
i bet tutorial point is the first result
or stackoverflow
or an ad
Wrong both
I wrote myself a lib for this, long time ago
"oracle"
have
Twilio is mine 
@upbeat nymph I skipped that one, but it was my first one too
first one is either an ad, or featured article

can someone please answer this question? its been a few days and the only dude that responded didn't even fully read the question
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)]
I need to find a free plugin for WordPress so I can put 360 panoramas on my website
@grizzled panther From a musician's POV please, for the love of god, start with the C ahaha and not A and B
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;
}```
css 👀
@clear flax look at...
https://getbootstrap.com/docs/4.5/components/dropdowns/#menu-alignment
and
https://getbootstrap.com/docs/4.5/components/dropdowns/#dropdown-options
that works as well lol
The annoying thing was it was a splitbutton
how can i move that picture to the center in css? or html
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
Sometimes...
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)
this is the case till now where the else part was executed
sorry this one
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??
@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
For example, I made this
which is made of this
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
Here's a better view
@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
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
@limpid plaza https://docs.oracle.com/javase/7/docs/api/java/lang/String.html#compareTo(java.lang.String)
If there is no index position at which they differ, then the shorter string lexicographically precedes the longer string. In this case, compareTo returns the difference of the lengths of the strings -- that is, the value:
this.length()-anotherString.length()
@errant raptor In my example I used margins to centre the picture but text align to centre the navigation in the same margin.
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”
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'
AHHH thx
