#development

1 messages · Page 39 of 1

deep scarab
native shoal
#

@last ingot appreciate the thorough response. Yeah I was trying to understand why it worked that way. I am more versed in powershell but looks like BGinfo does not accept ps1 scripts to gather info from

upbeat folio
#

Someone sell me on using an ORM. I’m having to for work, and since I already know SQL quite well, it’s killing me. Is it wrong to hate the very concept?

full berry
#

Um nosql is vague... And it includes other non sql dbs....

#

And you saying python > c# basic... In terms of what?

#

Things like document based db are also nosql...

#

Also vb arrays start at index 0...

#

Its in this case 0 is reserved already

upbeat folio
#

Document storage has its place, and when dealing with ginormous datasets with minimal relationships, its performance can’t be beat. But it starts to lose its edge when you get into smaller applications with smaller datasets, especially if the relations between those datasets have any order of complexity to them.

#

At least in my reading and experience.

#

Anyway, I’m not here to argue the merits of RDBMS over NoSQL. I’m here to complain about a really shitty ORM.

full berry
#

Document based databases can hold more complex relationshipd better than a structured one (like in sql) for instance graph databases

#

I will agree that there are places for everything

#

and in terms of speed for simple queries relational ones like the familiar sql is fast af

#

furthermore id like to state that there is a difference between the db that everyone is familiar with and the language sql

upbeat folio
#

Care to provide a link where I can see an example of that level of complexity? Not arguing, that’s just counter to what I’ve read before, and I’m eager to see things done well by people who know what they’re doing.

full berry
#

sure thing

#

lemme see if i can find that video lol

#

O.o lol

strange sphinx
#

lol

nocturne galleon
#

Hello everyone, I need your help. My friend and I have a intermediate knowledge of C# and we want to do a project to show off out knowledge.

For a project we don't want a Console Application but a Windows Forms app, and the project can include SQL Databases. Just don't give us a task of making a mobile app because making UI is hard AF for both of us(Android UI).

fresh lance
#

Just need an idea for something?

#

IRC/Twitch chat client

hidden wharf
#

anybody know a place where I could learn SNES assembly

obsidian bluff
#

No fucking way

#

What the fuck

#

How long have you been in here

#

I don't think I'm best qualified to answer that question so I'll leave that up to someone else in here.

carmine eagle
#

Does anyone know any website that can download automatically new instagram photos of people you follow to google drive? Ifttt doesn’t work anymore.

stray spruce
#

write a script

hidden wharf
#

do you have any recommendations

#

on books

cloud knot
burnt stump
#

well that's neat

burnt carbon
#

I have been looking at Graph Databases, but have not seen a good example where a properly written and indexed query in a relational database wasn't just as performant. Anyone have some good examples of scenarios where this would not be the case?

ionic hull
#

@cloud knot and people said that Microsoft would ruin github

burnt carbon
#

Normally. Net but I'm talking purely database engine for this.

nocturne galleon
#

if (message.author.bot) return;
if(message.author.type === "dn") return;
let prefix = botConfig.prefix;
let messageArray = message.content.split (" ");
let cmd = messageArray [0];
let args = messageArray.slice(1);

    if(cmd === '${prefix}hello'){
        return message.channel.send("Zdravo!");
    }
});

why aint this workin'
(Discord.JS)

vestal glen
#

what are you expecting it to do?

#

(and what is it doing instead)

nocturne galleon
#

Toss a message saying "Zdravo"

vestal glen
#

when what happens?

nocturne galleon
#

when I put "?hello" in chat

#

if(cmd === '${prefix}hello'){ {prefix{ = ?(set it up in JSON, JSON is linked to JS code

#

@vestal glen

vestal glen
#

Have you checked where the code gets to? For example if the author type check is false so it doesn't bail out?

obsidian bluff
#

I think I see the problem

#

You're using '' instead of ``

glad terrace
#

Everyone here refuses to touch jQuery. Not sure why exactly because I personally have never had the need for it.

#

Ah

#

I use frameworks so its basically useless for me lol Polymer.js and Vue.js mostly

glad terrace
#

jQuery alone is about 1/4 of our apps total minified file size.

#

Its a web app that gets deployed to well over 100k devices overnight so it does need to be as small as possible to not miss deployment deadlines. And then updated assets and 'settings' also.

ionic hull
#

A few kb won't make any difference 💁

#

And I can say that based on experience

vestal glen
#

Vue is <3 friends. It solves so many issues, thanks to being reactive. But sure, no need to do everything on the client side, agreed.

cloud knot
#

@nocturne galleon time to pull out the good old console.log to see where the code goes and what values it sees

glad terrace
#

I'm not sure that a weekday goes by without using my 'clog' template shortcut lol

cloud knot
nocturne galleon
#

anyone here experienced with Arduinos? just got 3 MKR wifi 1010 modules and want to put them to good use

nocturne galleon
#

if(cmd === ${prefix}serverinfo){
let serverIcon = message.guild.iconURL;
let serverEmbeded = new discord.RichEmbed()
.setDescription("Informacije o serveru:")
.setColor ("#15f153")
.addField ("Ime servera:", message.guild.name)
.addField ("Kreiran: ", message.guild.createdAt)
addField ("Pridruzili ste se serveru", message.member.joinedAt)
.addField("Ukupno članova", message.guild.memberCount);
return message.channel.send(serverEmbeded);
}

#

Why does this give : (node:6108) UnhandledPromiseRejectionWarning: ReferenceError: addField is not defined
at Client.bot.on (D:\DevBalkBot\index.js:26:13)
at Client.emit (events.js:182:13)
at MessageCreateHandler.handle (D:\DevBalkBot\node_modules\discord.js\src\client\websocket\packets\handlers\MessageCreate.js:9:34)
at WebSocketPacketManager.handle (D:\DevBalkBot\node_modules\discord.js\src\client\websocket\packets\WebSocketPacketManager.js:103:65)
at WebSocketConnection.onPacket (D:\DevBalkBot\node_modules\discord.js\src\client\websocket\WebSocketConnection.js:333:35)
at WebSocketConnection.onMessage (D:\DevBalkBot\node_modules\discord.js\src\client\websocket\WebSocketConnection.js:296:17)
at WebSocket.onMessage (D:\DevBalkBot\node_modules\ws\lib\event-target.js:120:16)
at WebSocket.emit (events.js:182:13)
at Receiver._receiver.onmessage (D:\DevBalkBot\node_modules\ws\lib\websocket.js:137:47)
at Receiver.dataMessage (D:\DevBalkBot\node_modules\ws\lib\receiver.js:409:14)
(node:6108) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:6108) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
in CMD

#

and nothing on my discord server

vestal glen
#

because you're missing a dot on the second to last addField?

stiff gull
#

also "serverEmbeded"
it's spelled Embedded 😛

nocturne galleon
#

@vestal glen solved it, but TY

#

@stiff gull typing error, will be fixed

brazen sluice
#

Hiya all, im back with another programming question for school

#

#include "NXCDefs.h"
task main ()
{
while(true)
{
if (Random() <= 599);
{
OnFwd(OUT_A, 75);
Wait(10000);
}
else
{
Off(OUT_AC);
}
Wait(1000);
}
}

vestal glen
#

so far I see no question?

brazen sluice
#

im typing it up 😃

#

i gotta formulate it properly

#

So, the code should make the nxt 2.0 robot drive in a circle if the number is below 600 and stop if it isnt

#

but for some reason the code doesnt work, (we use https://sourceforge.net/projects/bricxcc/ , but sadly i have no idea what the code language is)

#

we cant load the code onto a robot unless it "works" but i dont know why it doesnt work

vestal glen
#

what is "doesn't work" in this case?

brazen sluice
#

it says one of the { is in teh incorrect place

vestal glen
#

oh, right, I see

#

you have a ; after the if

#

making it an empty block

#

(always include the exact error you get...)

brazen sluice
#

im sorry, kinda new to programming 😃

vestal glen
#

describing a problem exactly isn't something limited to programming 😉

brazen sluice
#

That fixed it, thanks

nocturne galleon
#

@brazen sluice when posting code, please wrap it in 3 `

#

```
code

#

You can also put a language after the first 3 `'s and it will do syntax highlighting

brazen sluice
#

oh yeah sorry forgot @nocturne galleon

#

have no idea what language it is though

vestal glen
#

that's C/C++ ish

broken panther
#

Anyone here familiar with Docker?

glossy bluff
#

Hello everyone! Is this a good channel to find web dev help?

split condor
#

Yes to both of you (@broken panther and @glossy bluff)

broken panther
#

Hey. I have a Wordpress site built with docker-compose. What would be the best way to backup and restore it? I need to migrate it to a different server.

This was built on a version 1 .yml file and I can't find the Dockerfile. Whenever I try to docker-compose up on my other server, I keep getting an error saying it can't create a container for the Wordpress image, though it does create a container for the mysql image.

glossy bluff
#

Thanks @broken panther !

I'm having trouble my usermeta custom fields in Wordpress. I was stuck trying top get them to update using a dropdown onchange but I've worked out the problem to only needing a proper SQL command. Here is what I have so far and it currently works but it creates a new row in the table instead of update the current value. Any SQL guru's out there that can help me out? It would be greatly appreciated.

include_once $_SERVER['DOCUMENT_ROOT'].'/wp-load.php';

ini_set('display_errors',1);
error_reporting(E_ALL);

$userid = ($_POST["userid"]);
$meta_value = ($_POST["refunddd"]);
$meta_key = 'refund_status';
$user_id = $userid;
$user = get_user_meta($user_id, '', '');
$refundstatus = $user->refund_status;
$prev_value = $refundstatus;

/* Start database connection */
$servername = 'servername';
$username = 'username';
$password = 'password';
$dbname = "database-name";
// Create connection
$conn = new mysqli($servername, $username, $password, $dbname);
// Check connection
if ($conn->connect_error) {
    die("Connection failed: " . $conn->connect_error);
} 

$sql = "UPDATE `wp_usermeta`(`user_id`, `meta_key`, `meta_value`) VALUES ('$userid','refund_status', '$metavalue')"; 
 if ($conn->query($sql) === TRUE) {
    echo "Record updated successfully";
} else {
    echo "Error updating record: " . $conn->error;
}

$conn->close();
broken panther
#

I think you meant to tag Ben

split condor
#

Can you share the error Docker is throwing when attempting to create the Wordpress image?

#

@glossy bluff, the UPDATE command is something like..

UPDATE table SET column = value, column_two = value_two WHERE id = id_or_whatever;
#

Keep in mind, a quick search of something like "sql update syntax" could yield an answer quicker than us (:

broken panther
split condor
#

Can you share your docker-compose.yml and Dockerfile?

broken panther
#

Give me a sec

split condor
#

error500, something else to note about your setup: It looks like you're open to some SQL injection. Here is a bit of information on why this is an issue and mitigation for PHP: https://stackoverflow.com/a/60496

broken panther
#

I'll show you the Dockerfile in a sec. Having connection problems

glossy bluff
#

@split condor Thanks! It's easy to google something when you know what question you are looking for. This is literally pieced from other Google searches and reading as much as possible but I don't quite know SQL

broken panther
#

@split condor I think I found the problem. I pushed the image to Docker's registry and the Dockerfile wasn't there HyperBlobSweat

I tried using the official images from Docker, but they don't seem to work with my environment

#

I meant I tried using the Dockerfile from the official image*

split condor
#

Ah, gotcha

#

Glad you figured it out (:

broken panther
#

@split condor up for some help with Docker?

split condor
#

Sure, @broken panther

broken panther
#

Alright, so I went a different direction this time. I bashed into the running container from my original server and made a dump.sql, then I SCP'd the Wordpress files to my new server (the one I want to migrate to).

I mounted the backup.sql files and the Wordpress files as volumes in my docker-compose.yml file, like so:

version: '2'

services:
   db:
     image: mysql:5.7
     volumes:
       - ./backup.sql:/docker-entrypoint-initdb.d/backup.sql
     restart: always
     environment:
       MYSQL_ROOT_PASSWORD: password
       MYSQL_DATABASE: wordpress

   wordpress:
     depends_on:
       - db
     image: johnnyetz/wordpress:2
     ports:
       - "127.0.0.1:8080:80"
     restart: always
     environment:
       WORDPRESS_DB_HOST: db:3306
       WORDPRESS_DB_PASSWORD: password
     volumes:
       - /var/www/html:/var/www/html```

This is my wp-config.php file:

```php

define('DB_NAME', 'wordpress');

/** MySQL database username */
define('DB_USER', 'root');

/** MySQL database password */
define('DB_PASSWORD', 'password');

/** MySQL hostname */
define('DB_HOST', 'db:3306');

/** Database Charset to use in creating database tables. */
define('DB_CHARSET', 'utf8');

/** The Database Collate type. Don't change this if in doubt. */
define('DB_COLLATE', '');```
#

Then I have a long list of docker-compose --verbose up

#

I get some mysql errors and I can't connect to my server

#

I'll highlight some errors I noticed

#

This one repeats itself pretty often:

wordpress_1  | Warning: mysqli::__construct(): (HY000/2002): Connection refused in Standard input code on line 22
wordpress_1  |
wordpress_1  | MySQL Connection Error: (2002) Connection refused```
#

After that the containers stay running, but I can't reach the server

#

@split condor

split condor
#

On the MySQL container you'll need to expose port 3306

#
expose:
  - "3306"
#

expose allows access to connected services only, while port binds to the host machine

#

Depending on your setup defining it under ports may be a better option; though you will need to consider security a bit more in the latter

broken panther
#

Alright, let me try that

split condor
#

Yeah, that should be alright

broken panther
#

Could it be some config problems from my old database?

split condor
#

Just to verify, you are able to simply ping the other service from either container, correct?

broken panther
#

What do you mean? I usually get them up with docker-compose up

split condor
#

Yeah. If you enter them via exec are you able to simply send a ping request out to another?

#

For example, opening up a session with db are you able to ping wordpress?

broken panther
#

Let me check

#

How do I ping other services from within the session? I bashed into db, but how I do I ping wordpress from there?

split condor
#

Using the ping command

#

It should be built into the image

broken panther
#

It says ping command not found

split condor
#

That's depressing

#

What is the base image?

broken panther
#

It's wordpress php7.1. The official Docker image

#

That one

#

I have a different repository in my .yml file because I thought it'd back up anything from there, but it doesn't :p

#

Fixed that

#

Still not running, though

split condor
#

Yeah. The 0.0.0.0 is a mapping on your host machine.

#

You should be able to get ping via a apt-get install iputils-ping

broken panther
#

Installed it. ping wordpress doesn't work. Does it have a different syntax?

split condor
#

That should be correct

#

Docker compose should map wordpress to the proper container

broken panther
split condor
#

Oh, I see what you mean

#

Update the package list first via apt-get update

broken panther
split condor
#

Alright, that's good

#

I'm mildly confused, haha

#

There's gotta be something small we're missing

broken panther
#

Yeah, though, it's weird. I first tried this on my PC and it was working, only that it wanted to install Wordpress, meaning it wasn't taking my backup.sql file. I never know if I fixed that or not because I started changing the database passwords and usernames from both the .yml file and wp-config.php, but then I never got it to work

split condor
#

Does the database container startup without any issue?

#

On the database setup, you'll need a volume mount for the actual data too

broken panther
#

It's giving that error I showed you:

wordpress_1 | wordpress_1 | Warning: mysqli::__construct(): (HY000/2002): Connection refused in Standard input code on line 22 wordpress_1 | wordpress_1 | MySQL Connection Error: (2002) Connection refused

#

You mean to persist data? I plan on doing that once I can start it 😂

split condor
#

lol

#

fair enough

#

What is the log looking like on the database container?

broken panther
#

There's a lot going on there, do you want me to CP everything? :p

split condor
#

Ehh

#

Do you see anything glaring at you? Any errors, etc

broken panther
#
2019-01-15T06:59:03.673238Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2019-01-15T06:59:04.045517Z 0 [Warning] InnoDB: New log files created, LSN=45790
2019-01-15T06:59:04.101238Z 0 [Warning] InnoDB: Creating foreign key constraint system tables.
2019-01-15T06:59:04.161152Z 0 [Warning] No existing UUID has been found, so we assume that this is the first time that this server has been started. Generating a new UUID: 0b60024d-1893-11e9-be2d-0242c0a87002.
2019-01-15T06:59:04.162617Z 0 [Warning] Gtid table is not ready to be used. Table 'mysql.gtid_executed' cannot be opened.
2019-01-15T06:59:04.163305Z 1 [Warning] root@localhost is created with an empty password ! Please consider switching off the --initialize-insecure option.
2019-01-15T06:59:04.508693Z 1 [Warning] 'user' entry 'root@localhost' ignored in --skip-name-resolve mode.
2019-01-15T06:59:04.509195Z 1 [Warning] 'user' entry 'mysql.session@localhost' ignored in --skip-name-resolve mode.
2019-01-15T06:59:04.509441Z 1 [Warning] 'user' entry 'mysql.sys@localhost' ignored in --skip-name-resolve mode.
2019-01-15T06:59:04.509695Z 1 [Warning] 'db' entry 'performance_schema mysql.session@localhost' ignored in --skip-name-resolve mode.
2019-01-15T06:59:04.509934Z 1 [Warning] 'db' entry 'sys mysql.sys@localhost' ignored in --skip-name-resolve mode.
2019-01-15T06:59:04.510158Z 1 [Warning] 'proxies_priv' entry '@ root@localhost' ignored in --skip-name-resolve mode.
2019-01-15T06:59:04.510404Z 1 [Warning] 'tables_priv' entry 'user mysql.session@localhost' ignored in --skip-name-resolve mode.
2019-01-15T06:59:04.510627Z 1 [Warning] 'tables_priv' entry 'sys_config mysql.sys@localhost' ignored in --skip-name-resolve mode.```
#

It's also shutting down a bunch of plugins

#

2019-01-15T07:00:29.238845Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).

#
Warning: Unable to load '/usr/share/zoneinfo/leap-seconds.list' as time zone. Skipping it.
Warning: Unable to load '/usr/share/zoneinfo/zone.tab' as time zone. Skipping it.
Warning: Unable to load '/usr/share/zoneinfo/zone1970.tab' as time zone. Skipping it.```
#

That's pretty much all the note worthy stuff

split condor
#

Interesting

#

Those should be alright

#

At the end of the log it should say it has started successfully, correct?

broken panther
#
2019-01-15T07:00:29.479243Z 0 [Note] mysqld: ready for connections.
Version: '5.7.24'  socket: '/var/run/mysqld/mysqld.sock'  port: 3306  MySQL Community Server (GPL)```

That's the last bit of the log
split condor
#

I'm pretty confused

broken panther
#

Me, too, mate 😩

split condor
#

We have established that MySQL is running, you have network connectivity between the two containers, and have exposed the primary MySQL port

#

That should be it

broken panther
#

I'm a noob at this, but I'm usually able to find what I'm looking for after a few hours of google, but I've been on this for days, lol.

split condor
#

darn

#

Let's just go over it again

#

So listing all of your containers, for db do you see that port 3306 is exposed?

broken panther
#

I fucked over this when I mounted the backup volume. I could try not doing that and see if it works blobthinkingglare

split condor
#

excellent idea

broken panther
#

I'm still getting the error, but I'll delete the image and pull again

#

no dice

split condor
#

😠

#

Pinging db is ok from wordpress, yeah?

broken panther
#

Yep

fiery onyx
#

Hey guys, I'm curious. Is it possible to code a meltdown exploit using C++ in visual studio simply for educational purposes? Like I'd like to try inserting a value in memory and make something to try and read the value at that address... Idk if this is possible in C++ though

#

Tbh I'm new to C++

#

Not new to scripting/coding though

split condor
#

Do you have the MySQL client on the wordpress container? mysql

broken panther
#

Apparently not, but I just downloaded the official version, I'd like to think I have it on the image from my repository, given that I pushed a working image

split condor
#

haha

#

Try connecting to the db container with the mysql client

#

mysql -h db

broken panther
#

What's the package called? install mysql doesn't work

split condor
#

Try mysql-client

broken panther
#

yep, that works

split condor
#

Add the p flag to that command

#

Then enter whatever your MySQL root password is

broken panther
#

So it'd be mysql -h -p PASSWORD db

#

?

split condor
#

Something like mysql -h db -p

#

You will actually type out your password

#

or copy/paste it

broken panther
#

Yeah

#

I'm in

split condor
#

ok i'm confused again

#

We have established that you can connect

#

For some reason Wordpress is having an issue doing so

#

Can you leave the port off from WORDPRESS_DB_HOST? It shouldn't be required as you're using the default port. Maybe it is having an issue parsing that; that's just a shot in the dark though.

broken panther
#

Do I just delete the port or the entire line?

split condor
#

The port

broken panther
#

Done it. Same thing, sadly

fiery onyx
#

@split condor Thanks.
Who named Meltdown, anyways? And why does it have fancy logo? 🤔

split condor
#

The only thing I can think to do is try exposing the port on the machine as well

#

Replacing expose with

ports:
 - "3306:3306"
broken panther
#

Alright, let me try

split condor
#

I was under the impression that Docker compose linked these services together automatically

#

Maybe we actually need to define a link

broken panther
#

Getting an error:

ERROR: Encountered errors while bringing up the project.```

I have this line in wp-config, should I remove this? 🤔 

``define('DB_HOST', 'db:3306');``
split condor
#

Perhaps

#

It looks like you already have MySQL running on your host machine

#

no biggie

#

Jump back to expose then maybe we can try an actual link

broken panther
#

Alright, done it. By linking you mean using links: ?

split condor
#

Yeah

#
links:
  - "db"
broken panther
#

On the wordpress service?

split condor
#

Yeah

broken panther
#

Do I delete depends_on: ? 🤔

split condor
#

I don't believe so

broken panther
#

😩

split condor
#

Still broken?

broken panther
#

Yeah

split condor
#

of course it is lol

#

Could you try restarting the host machine? Along with making sure everything is up to date.

broken panther
#

Yeah, I'm gonna try the whole process again

broken panther
#

@split condor so I found a new error (lol).

I made a new droplet on DigitalOcean just to try out something (have free credits anyway). I followed the official guide to install Wordpress and it works, then when I do the same in the other server, I get a version error.

Version in "./docker-compose.yml" is unsupported. You might be seeing this error because you're using the wrong Compose file version. Either specify a version of "2" (or "2.0") and place your service definitions under the `services` key, or omit the `version` key and place your service definitions at the root of the file to use version 1. For more on the Compose file format versions, see https://docs.docker.com/compose/compose-file/

The funny thing is, I'm in the latest version

#

This is docker --version's output Docker version 18.06.1-ce, build e68fc7a

glad terrace
broken panther
#

The format is the exact same from the docker docs tutorial, works in one of the droplets, but not in the other one.

glad terrace
#

Double checking couldn't hurt I guess. There is an upgrading section but if that looks good IDK. Learning docker is still on my to do list lol

broken panther
#

The only difference between the 2 .yml files was that one had volumes (I added them to backup my site), but then I modified both files to make them the exact same.

#

This thing's been driving me crazy, lol

glad terrace
#

Version 2 to Version 3 It said what changed was how volumes work so probably your issue then.

broken panther
#

I fixed that issue. It didn't work without the volumes either. I don't know what I did, lol

glad terrace
#

Ah

nocturne galleon
#

guys I have the best Idea for version control

#

make a discord server

#

and put the code in messages

#

each branch is just a separate text channel

vale maple
#

But how do you gonna merge branches with that...
Well, thinking twice you could write a bot to do that.... So i think this is a perfect idea.

nocturne galleon
#

Trust me, all the big name software companies use this. Even discord themselves

prime crescent
#

Lmao yeah good idea, let's put all our code on a messaging app with semi-frequent server outages and no guarantee that the server wont be deleted

stiff gull
#

thats the best kind of security

#

"insecurity"

#

isn't that how LTT manages their servers? 😛

upbeat folio
#

Okay, so I built an endpoint for work that accepts JSON, and has a format validation component for one attribute in that JSON. A developer joining the team to help us launch complained this morning that the endpoint failed in error when passing that value as null. But in my testing, passing it as null has the desired effect and does not fail in error. That’s when I learned that the guest developer was sending everything as strings. So “thing”: “null” instead of ”thing”: null.

#

Is there any reason why he should be sending null in a string like that, or am I right in judging him hard for finding the one behavior that would cause my endpoint to fail?

#

(note, I fixed my endpoint to account for this, but I’m trying to see if I’m right to be annoyed)

vestal glen
#

"null" isn't null. If you want the null value, don't put it inside a string.

#

(though your endpoint should probably handle arbitrary json input gracefully)

wary jetty
#

A python AI I'm working on, I'll add timestamps and names later on, for now it asks questions. I answer them.

#

Maybe I'll add names now for future screenshots

#

BTW does this fit here? It is bot development.

#

I'll try for time stamps, too

#

(Using QPython, may port over to Linux and Windows when the Android version is finished)

thin cobalt
#

anybody know if I can make a usb-hid device seem connected using csharp?

#

it needs to be a specific VID and PID

nocturne galleon
#

ofcourse it was a meme

supple abyss
#

hey, does anyone know how I can tell the sequence of line execution in a C program?

#

I need to know which line of code gets executed and when

stiff gull
#

they're linear

#

it starts at the top, and it goes to the bottom

#

1 by 1

#

@supple abyss

supple abyss
#

great, thought so

#

unless you have a function which calls another function, then the program will jump to the specified place, right?

stiff gull
#

yeah but it still follows the top to down thing, per function

#
void foo()
{
   bar();//3rd
}

void bar()
{
   //4th
}

//entry
int main()
{
  int i = 0;  //1st
  foo(); //2nd
  printf("hello"); //5th
  return 0; //6th
}
#

very basically explained though

#

there's more going on

#

scopes and all that

#

but you can assume that if you write something first, it'll get executed first

supple abyss
#

great, thanks man!

#

another question I have; I need to check this piece of code if it has any errors and if it makes sense

#

my thinking is that the loop wont even be executed because 9 mod 2 is not 0

#

and i is decreased two times

#

then we have 7 mod 2, which again is not 0

#

no wait

#

it will be executed every 2 numbers

#

because thats when i mod 2 == 0

#

so the output would be 8 6 4 2

chrome mason
#

One message removed from a suspended account.

stiff gull
#

I'm sure that's an infinite loop @supple abyss 😛

#

its a subtle error

#

its not even a mistake logic wise haha

#

coincidentally I had such a mistake happen to me pretty recently

supple abyss
#

could you explain where the error is?

stiff gull
#

I mean.. I'd be doing your assignment haha

supple abyss
#

this is a question from an exam from 2016

#

i have my exam tomorrow lols

stiff gull
#

protip: ";"

supple abyss
#

line 2? but the compiler ignores whitespaces

#

ohhh

#

while loop

#

it has a ;

#

when it shouldnt?

stiff gull
#

yes

supple abyss
#

damn I wouldnt have found this error at an exam

stiff gull
#

know that {} can be used to create a local scope

#

the ; ends a command so the while(i > 9) is a seperate entity from the {}

#

so since i is never decreased since it has no code to run it'll loop infinitely

supple abyss
#

in other words; do things with {} not require ; at the end?

glossy hare
#

wouldn't it just error out tho?

#

wait is this C?

supple abyss
#

i copied it in my IDE and it didnt return no errors

#

yes C

stiff gull
#
int main()
{ //function scope

    { //local scope
        int i =0;
                printf("Hello");
    }
    //i is destructed
    int i = 10; //its fine since i isn't used yet

}
glossy hare
#

ah. i was thinking java.

#

would that still work in java?

stiff gull
#

no clue, I main in C++

glossy hare
#

gotcha

#

c++ damnn lol

obsidian bluff
#

Curly braces are not required for a while loop. If you leave out the curly braces it will treat the next statement as the full loop contents

#

since the semicolon is immediately after the while loop it's just an empty loop that runs forever

stiff gull
#

and yes,

int i = 0;
while( i < 9)
     i++;

is legit code

obsidian bluff
#

^ right like that

glossy hare
#

but it just treats the line right after

stiff gull
#

the {} aren't required, but are used to create a scope and execute blocks of code rather than a single line

glossy hare
#

not the whole list of lines for example in that code

stiff gull
#

though even that can be done by using , instead of ;

obsidian bluff
#

, does have the restriction of not being able to define new variables.

stiff gull
#
while(true)
    printf("Hi"),
    printf("This"),
    printf("repeats");
obsidian bluff
#

No \n 😡

stiff gull
#

ah right haha, I usually wrap my printf's or use std::cout/endl

obsidian bluff
#

👌

glossy hare
#

good to know

stiff gull
#

so yeah whatever comes directly after a while or for is run

#

so if thats a {} it means it runs that entire block

obsidian bluff
#

now exercise for the reader.

int i = intreturningfunction1(), intreturningfunction2(), intreturningfunction3();```
What's the value of i
stiff gull
#

whatever is the result of intreturningfunction1() iirc

glossy hare
#

not 3?

obsidian bluff
#

Wasn't it 3? Now I'm actually not sure anymore lol

stiff gull
#

yeah I'd actually have to look it up though

#

but this is just shitty code 😛

glossy hare
#

you could do that tho?

stiff gull
#

return values don't have to be stored

glossy hare
#

instead of functions could those just be 1, 2, 3?

#

the literal ints

stiff gull
#

no

glossy hare
#

okay didn't think so but now im questioning everything lol

obsidian bluff
#

In that context you could do something like
int i1 = 1, i2 = 2, i3 = 3; to define multiple variables of the same type

#

But that's not a comma operator anymore in that situation I think

stiff gull
#

that is fine yeah

glossy hare
#

yeah. i mean like the first thing you originally posted @obsidian bluff was setting the one variable

stiff gull
#

but the reason the functions work is due to the fact their return values don't have to be stored.. It's just icky and potentially UB to change a variable that is used in the other functions as well

obsidian bluff
#

it's actually like this (intreturningfunction1(), (intreturningfunction2(), intreturningfunction3()))

stiff gull
#

for example

int Foo(int x, int y)
{
   return x / y;
}

int i = 1;
Foo(i++,i++);
#

this is UB

obsidian bluff
#

the comma operator evaluates both expressions and returns the return value of the right-hand expression

#

Really? is it UB?

#

You'd think that they are avaluated from left to right

stiff gull
#

order of operations isn't strictly defined here

obsidian bluff
#

You probably know more than I do about that.

stiff gull
#

C++ has lots and LOTS of UB

#

C is generally safer in that regard

obsidian bluff
#

👻

#

Once you get in the territory of "indeterminately sequenced" things get spooky

#

This entire page is spooky

#

Reads like it's more geared towards compiler developers.

stiff gull
#

my example is in there

#

you know whats also UB, almost every bit of code that uses union

#

due to strict aliasing

#
union
{
    int i;
    float f;
}
//initialise i
i = 10;
//reading from or writing to f is now UB
#

though one would usually use this to use bitwise ops on floats

#

C++ is a place where dreams go to die

#

instead if you want to use bitwise ops on a float, you'd have to memcpy it to int, do your ops and memcpy it back

glossy hare
#

this is why we are moving our old c++ apps to c# lol

nocturne galleon
#

.Net Core works on all major platforms @last ingot

proper saddle
#

Core is already on 5? Last time i used it, it was still on 2.x

nocturne galleon
#

I thought so too. Maybe the graphic is just wrong.

#

It's on 2.2

broken panther
proper saddle
#

I think core was originally called framework 5, so that might be why. thanking

stiff gull
#

@last ingot using C++ doesnt guarantee platform support at all lol

#

it purely depends on what you have to do, but anything thats not command line and requires a window will automatically bind you to a specific OS unless you rewrite that piece of code for every platform you want to support

#

same for rendering

#

which is where libraries come into play

#

or engines

nocturne galleon
#

Why @last ingot ? lol

#

Sound logic

minor mauve
#

I haven't used C# in almost a year at work. Only when working on legacy code and most of our products are stable.
Our team has been using Go and I really enjoy it. If I ever have to get a new job, I'd probably look specifically for teams/companies that use Go.

thin cobalt
#

I have a file in the format of value1, value2 <crlf> value1, value2

#

And I want to display for every line in the file that value 1 as a <h3> and that value2 as the href of an <a>

proper gale
#

@stiff gull much of what is UB in C++ is in reality IDB, so get to know your compiler real well, and don't use a different one.

stiff gull
#

@proper gale this is very very ill-advised

#

the problem with UB is that the compiler is allowed to do whatever it wants there, even a update could break what consistent behaviour it had for it

#

UB is to be avoided, not embraced

#

It just means you have to be aware of what is and is not UB and work around it

#

@half forge before/after shots? Im not seeing the problem?

stiff gull
#

seems the grass is completely ignored from the AO pass

#

and it's being overlaid

#

resulting in the "transparant" look

#

discord channel: 35X6xw (can't post the full invite here)
it's Game Dev League, it has a lot of game dev people there, also channels dedicated to Unity, they might be able to help you

#

just put that behind .gg/

#

its quite a big channel, full of experienced people

#

get a role

#

by doing !role Coders for example

glad terrace
#

5 open projects in webstorm lol

split condor
#

Nice work @upbeat frigate

#

It looks like you are one of the lucky fellas in the quote test group

keen tapir
#

Hello!

upbeat frigate
#

@split condor me?

gray star
#

anyone knows how to datamine an android game update?

left shoal
#

no sorry

stiff gull
#

I'd assume, manage to get a hold of the apk, and the original, then diff it?

left shoal
#

but i will look into it

#

will this help

warped inlet
#

Hey, im completely new to visual studio and c++ and im following a tutorial, I tried to build a project and this error occured, anyone have any ideas on how i can fix it?

stiff gull
#

why .net if you're using C++

#

you're not doing any CLI are you?

warped inlet
#

Nope

stiff gull
#

cause that'd be a hell of a start

warped inlet
#

lol.

#

Im not sure why its using .net

#

I may have installed it, but i dont think im using it

#

i am using someone the tutoirals framework

#

not sure if that has any CLI in it

warped inlet
#

So i tried doing another really short and simple program, but that build failed with no errors...

nocturne galleon
#

What made you pick C++?

warped inlet
#

Well, to be honest, I just wanted to learn a new language. The only language in my schools curriculum is python, and i wanted to try a new language.

#

I'd be welcome to any suggestions though.

#

@nocturne galleon

nocturne galleon
#

I would have a go with C# imo @warped inlet

stiff gull
#

@warped inlet if there's errors it should say so in the output window

#

however that program should run and pretty much exit immediatly, you might see a very quick CMD pop up if anything

#

in case you might have confused that with "the build failing"

nocturne galleon
#

But ya, the above seems like it may be the case. Just put this at the bottom:

std::getchar();

It will wait for you to press a key before exiting the program.

obsidian bluff
#

And also make sure to add a newline character

proper gale
#

@warped inlet python to C++ is a bad idea, C++ is fucking hard (and about as different as you can get without going functional). As Eagle suggested, C# would be a good inbetween choice.

warped inlet
#

Alright, thanks guys.

stiff gull
#

@warped inlet Unity is a good start if you wanna get some games going and learn C# along the side

warped inlet
#

Ah, Il look into It, @stiff gull Thanks!

upbeat folio
#

I love it when the UI developer overrides the API design because he can’t keep up and feels like he ideologically shouldn’t have to try.

nocturne galleon
#

But you're there to cater to all his needs, right? Lol

proper gale
#

no, no, it is.

#

i code in it as well, consider perspective

#

to me its not particularly hard, but to someone coming from python, it is.

#

ok, doesn't mean its not a hard language

#

if you are a masochist and want to take the hard route, go right ahead,

#

C++ is a hard language, not because the language is hard, but because the libraries are confusing.

#

like, what is stoi, you know what that is, i know what that is, but it should still be called stringToInt or something similar.

#

most things are std::string or char*, no?

#

or at least have a constructor from that so you use std::string.c_str() then it makes its type from that.

#

how does this pertain to C++ (not) being hard?

#

ok, that was never my point.

#

i was saying that its a hard language to learn, and arguably hard to use.

#

ok, counter points
C++ is non garbage collected
C++ has a fuckall of buildsystems
C++ requires functions to be declared before they are used
the C preprocessor is a dick, period.
headers cause problems, and its hard for IDEs to properly show you how they will be included.
the language is not standardized across compilers.
operator overloads can sometimes be super intuitive, other times not.
libraries have a tendency to have confusing and/or overly long names.
namespaces are a necessary dick to work with.
and a big thing from python, its forced statically typed.
and this is besides the more minor syntax differences. the largest of which would probably be automatic this-> that python doesn't do.

#

Ofc, c# shares some of these, but probably best not to throw them all at someone at once.

#

nobody can be perfectly fact only.

#

and while yes python had different run times that do behave different, there is a standard one, C++ doesn't have that.

#

you could say GCC is the standard one, but its really not because of extensions, Clang isn't for the same reasons, and MSVC is horridly off.

obsidian bluff
#

Everyone look at how hardcore I am

#

I'm not making excuses and took that HARDEST route VOLUNTARILY. Because I LIKE DIFFICULTY

#

But at the same time the way I took wasn't hard at all because I am super hardcore

#

🤐

#

I would personally put time.time() on the left to make it clearer.

#

Like time.time() >= timestamplewhatever + 300

#

You would never say: this certain moment in time plus 15 minutes was after now so it hasn't been 15 minutes since the event occurred.
You would say: it is currently less late than 15 minutes after the event happened.

proper gale
#

i would do it now - then >= 5 minutes

obsidian bluff
#

Even better

proper gale
#

to me, even clearer

#

also works in reverse if you abs it.

obsidian bluff
#

That's fair

#

Tbh I didn't even read all of it 😅

#

I've done a fair share of condemning people for being "lazy" myself

#

I have the same mindset

#

But it sucks

#

You spend years and years doing nothing productive

#

Or at least a lot less than you could've done if you took the easy route here and there.

#

I had such a shitty mindset that I refused to use a library for openGL context creation or even audio playback

#

I did it all using windows only function calls

#

And it was hell

#

True I did get a better understanding of windows under the hood

#

Not only did I spend time doing useless shit it was part of the reason that I'm still technically in what americans would call high school at 20 years old

#

And I'm still not learning about what I'm really interested in in school

#

People are passing me left and right and it feels terrible

#

Computer programming duh

#

And even my knowledge of computers is not where it could have been if I had just studied for school

#

Because I would be in uni by now

#

I respectfully disagree

#

Uhhh sure

#

I don't think I can't code

#

Well I barely know CPP

#

Most of those programs were written in it

#

But they're all mostly terrible

#

Cpp, c++, potato potato

#

Like cpp is freaking complex dude

#

I don't know half the things there are to know

#

That's why I say "I know how to use C++" and not "I know C++"

#

lvalues rvalues pass by reference copy constructor move contructor virtual destructor dynamic_cast vs const_cast unique_ptr shared_ptr weak_ptr etc. etc.

#

I can't see the forest for the trees

#

I would argue that C++ is more difficult than even some assembly languages

#

I reinvented the circular buffer on accident

#

While trying to code something

#

my problem is not problem solving

#

My problem is knowing all the tiny semantics

#

Like... Every time I want to get started on a big project I get lost in a rabbithole of cppreference.com pages

#

Every time you want to know about one thing you have to read about the next and then you have to read more and more and more

#

And I don't want to just "make it work" if the code is going to be shit

proper gale
#

@obsidian bluff i have caught myself reading cppreference for well over an hour by accident.

proper gale
#

all sorts of things.

obsidian bluff
#

It sometimes seems like with C++ that you either know everything or you know nothing

#

And in the inbetween you're just fucking around like an idiot.

regal turtle
nova moth
#

I have a problem. I want to learn how to use CUDA, but my GPU doesn't support. Do you know of places on the net where I can run my code?
P.S.:Don't have money for new GPU now

obsidian bluff
#

I hear that using openCL is the better option.

stiff gull
#

@obsidian bluff cuda us superior in every way, OpenCl is what'd you use if you have a AMD gpu

#

@nova moth no since it would literally cost performance and power, and ppl would just run miners on em :P

obsidian bluff
#

I hear the performance difference is negligible if used properly.

#

And you have the added bonus of being more portable

stiff gull
#

Except OpenCL runs worse on Nvidia

obsidian bluff
#

I'd say that's NVIDIA's fault but okay.

stiff gull
#

why would nvidia invest in OpenCL performance if they have special hardware for the same compute purpose called CUDA

nova moth
#

I just want send my cpp project and be given the results from it

obsidian bluff
#

I'm not saying they would. I'm saying they should

#

And if consumers say "We want openCL compliance and performance" they will have to answer

stiff gull
#

@obsidian bluff people choose the easiest and faster thing to work with, that is CUDA on both points

#

being able to write C++ on GPU is amazing

obsidian bluff
#

Hmmm if you couldn't tell by my profile picture I'm not a huge fan of vendor lock-in

stiff gull
#

well then AMD should just implement CUDA support huh :P

obsidian bluff
#

¯_(ツ)_/¯

#

proprietary bad, big corporation bad.

stiff gull
#

CUDA had it for years and is likely more matured

#

wait unless thats the document update date, in that case ignore me

obsidian bluff
#

It says version 2 so it's probably been a thing for a while

#

nvm that's just the openCL version

#

It was released in May 2017

half tusk
#

can anyone help me install this

proper gale
#

@stiff gull the OpenCL spec is maintained by the khronos group, these are the same people that maintain Vulkan, OpenGL, OpenGL-ES, SYCL, SPIR(-V), WebGL, and more.
These standards also need to be cross vendor which has caused many issues in their design by committee process, result is that it moves slower than others. However, just because its newer doesn't mean its less mature, the people working on these specifications, besides numbering in the hundreds, are looking at current competing APIs/Libraries in an attempt to make the best API they can.
Nvidia does support most OpenCL 2.0 features, and is making an attempt to update their GPUs (they have some issues with SVM afaik), besides their OpenCL resources https://developer.nvidia.com/opencl.

stiff gull
#

@proper gale I know they do support it, but doesn't mean it can match the CUDA speed yet :P

proper gale
#

It's not that slow

stiff gull
#

never said it was slow, its just not as fast as doing it through CUDA :p

#

I mean, if you're making a bitcoin miner, would you use CUDA or OpenCL for NVIDIA?

#

the choice is pretty easy

#

same for anything else that needs performance, and thats basically when you step to GPU compute anyways.

lost creek
#

Atom or VS Code?

nocturne galleon
#

Eclipse vs Geany?

tropic grail
#

IntelliJ vs Notepad

little knoll
#

@lost creek I was using Atom for some years and I switched to VSCode because of its responsiveness and the integrated NodeJS debugger.

ember torrent
#

Eclipse vs Raptor

round dome
#

vim vs emacs

humble notch
#

Notepad

lost creek
#

@little knoll me too, also vs code has intellisense which is just extremely useful

full berry
#

anyone here familiar with filing/applying for a patent?

vestal glen
#

I'm very familiar with not doing it...

gray star
#

anyone familiar on opening .dds files ?

full berry
#

Yes. Me

#

Photoshop and nvidias dds plugin

proper saddle
#

Oh, no! Microsoft is retiring MVA. :c

full berry
#

well someone can go ahead and start a movement to download/capture all the content before it goes down and reup it somewhere else?

nocturne galleon
#

Looks like they are sending it to Microsoft Learn?

https://docs.microsoft.com/en-us/learn/

proper saddle
#

But y tho?

night girder
#

Hey! Now sure if it's the right place to ask, but I'm currently in my 4th year of my Masters program and I am looking for a summer internship, does anyone know of good companies that offers that in Canada or Europe?

glad terrace
#

@night girder Any company you can get into really. Experience is experience imo.

night girder
#

Yeah, but not all companies have summer internships, what I was asking was for was companies recommendations

nocturne galleon
#

would it be bad to move from python or lua to c++

#

i like lua cuz you can easily learn it, taking c++ as first language would be pain since you cant just start off using unreal engine easily

glad terrace
#

I'd be willing to bet there are some decent online courses labeled something like "Learn c++ with unreal engine"

proper gale
#

@nocturne galleon you already know lua, or you are considering them both as first languages to learn?

nocturne galleon
#

Hmm, i know Lua but... i hear its hard to move from Lua to C++. I don't know , i hope i can visual script over unreal engine with C++

#

i dont think random code bashing is good

#

when i write a line i want it to turn into life visually

proper gale
#

the two languages are very different

#

almost anything that is automatic in LUA, is manual in C++.

nocturne galleon
#

Well i found roblox which allowes you to easily learn Lua. I wanted to go for Python first but there arent any supported bulletproof engines like unreal engine and unity for it, pygame is long dead so i figured id go with c++ but it takes quite the time to learn the engine before you can do anything

#

Hm

proper gale
#

the engine is not really the problem, C++ is.

#

unity is C#, which would be easier.

nocturne galleon
#

i need c++ fur security , well a pen tester told me so id kill 2 flies with one hit or how you say it

#

game dev and security

#

Hmm

#

How easy is the unity engine?

#

Can i start scripting and learning there or i have to stare at a console for months before i can use it

#

Its all about making coding enjoyable for me

#

languages decision is so hard

#

i been trying to figure out this for 3 years

proper gale
#

@nocturne galleon C++ is not inherantly more secure than C#

nocturne galleon
#

C# yes

nocturne galleon
#

Hmm

#

If the engine is easier to start with i guss ill try it out

#

Godot has been mentioned to me but im not sure how long itll last

keen tapir
#

can someone help me with css

nocturne galleon
#

If you learn C# from ground up , you can create amazing games in unity. C# coding gives you a lot of control over unity, which you can use to do whatever you want in your game.

#

nice to read

#

and i assume going over to python from c# wouldnt be that hard later? @proper gale

proper gale
#

@nocturne galleon it is not

nocturne galleon
#

Oh alright c# seems t o have the win to avoid any risks

wheat dock
#

we have to use C# for web development in my class right now. its so weird

haughty owl
#

@nocturne galleon The best stuff of learning C# is that you don't limit yourself to Game Development, you can switch easily to UWP, WinForms/WPF, .NET Core and other pretty stuff

haughty owl
#

@last ingot Just saying to him, He has things to win in both sides. C# is greatly modular as it is C++

proper gale
#

@haughty owl i mean, all the languages listed dont limit you to game development. only langs like GLSL and HLSL are limited, but also specialized.

haughty owl
#

They dont limit you per-se, but what effort do you made to code a game with (for example) Ruby rather than C# or C++ is a deal breaker for most people

lapis granite
#

This channel is probably better for this, I created this small screenshot chrome plugin when Taran made that video about full page screenshots but didn't get a response, so here is it:

#

It automatically zooms in, takes the screenshot and opens a save dialog

nocturne galleon
steady jacinth
#

Seems to easy eaglebyte

tropic grail
#

Guess someone never heard of the stock market, lol.

#

Literally all of it is public

nocturne galleon
#

^^^ Plot twist O_o

glad terrace
#

It's not quite the same. The stock market is still private because you still need to pay money to use/have it.

sullen patio
nocturne galleon
#

that is not true but ok

#

its public knowledge

feral tide
#

If it isn't owned by the proletariat, it's not publicly owned. ;)

small escarp
#

eeeehm, no

#

proletariat is a very specific term ;]

left shoal
#

dec

open pond
thin cobalt
#

any body know how to convert a system.drawing.color to a hex code?

#

string color2hex = System.Drawing.ColorTranslator.ToHtml(colorDialog2.Color);

#

works sometimes but sometimes it returns a color name instead of a hex code

rigid jewel
#

@thin cobalt ^^

thin cobalt
#

@rigid jewel thank you I'll look into that!

nocturne galleon
#

Guess what im building?

thin cobalt
#

Yet another odd issue

#

I'm doing find and replace in C#, it works fine on small files but on big files it doesnt do anything

#
        {
            string color1hex = textBox1.Text;
            string color2hex = textBox2.Text;
            string color3hex = textBox3.Text;
            string color4hex = textBox4.Text;
            string str = File.ReadAllText("template.cueprofile");
            str = str.Replace("#ffaaaaaa", color1hex);
            str = str.Replace("#ffbbbbbb", color2hex);
            str = str.Replace("#ffcccccc", color3hex);
            str = str.Replace("#ffdddddd", color4hex);
            File.WriteAllText("generated.cueprofile", str);
        }```
#

if template.cueprofile is a big file, it just copies it to generated.cueprofile instead of doing the find and replace

tulip pike
#

@nocturne galleon tell us

nocturne galleon
#

@thin cobalt are you sure all the hex codes will always be all lowercase?

thin cobalt
#

Yeah, I made the template file

#

@nocturne galleon

#

The file loaded has several thousand lines though

#

That's probably the problem

nocturne galleon
#

Writing something up for you to use.

thin cobalt
#

thank you

nocturne galleon
#

@thin cobalt

public void Main()
{
    // File parameters
    string originalFilePath = "template.cueprofile";
    string newFilePath = "generated.cueprofile";

    // Fetch the colors from the text boxes
    string color1hex = textBox1.Text;
    string color2hex = textBox2.Text;
    string color3hex = textBox3.Text;
    string color4hex = textBox4.Text;

    // Read the source file
    using (StreamReader reader = new StreamReader(originalFilePath))
    {
        // To write to the destination file
        using (StreamWriter writer = new StreamWriter(newFilePath))
        {
            // Go through each line in the original file
            int lineNo = 0;
            while (!reader.EndOfStream)
            {
                // Read/Replace/Write to new file
                string line = reader.ReadLine();
                writer.WriteLine(ReplaceLine(line, lineNo++, color1hex, color2hex, color3hex, color4hex));
            }
        }
    }
}

// Handles replacement logic
private string ReplaceLine(string line, int lineNo, string hex1, string hex2, string hex3, string hex4)
{
    line = line.Replace("#ffaaaaaa", hex1);
    line = line.Replace("#ffbbbbbb", hex2);
    line = line.Replace("#ffcccccc", hex3);
    line = line.Replace("#ffdddddd", hex4);

   return line;
}
#

Will work with any file size*

#

@tulip pike im making my own distro since 1 year

#

Now im finally making my first build

tulip pike
#

feature list?

thin cobalt
#

@nocturne galleon thank you so much!!! I didnt expect someone to just legit do it for me lol

nocturne galleon
#

No worries. Bored on a Saturday haha

#

You can add anything to your linux distro

#

Even make your own mirrors

#

im going to do that

#

😉

umbral lichen
#

i need to use structs more ```public static class Launcher
{
public struct Game
{
//prefix for settings
const string Name = "";
//name of exe
const string EXEName = "";
//basic settings to get the game running
const string BaseCommandVars = "";

        public Game(string name1, string exename2, string basecommandvars3)
        {
            Name = name1;
            EXEName = exename2;
            BaseCommandVars = basecommandvars3;
        }
    }
    
    public static void LaunchGame(Game gameToLaunch)
    {
        
    }
}```
nocturne galleon
#

oh god

#

im adding a bunch of stuff to my script and im not sure it will work

#

inb4 i get 2000 run time errors

raven kernel
#

use git

#

then you could revert to before you broke everything

nocturne galleon
#

too late lol

raven kernel
#

xD

nocturne galleon
#

Landed a new job as a Software Engineer for IQVIA. 😃🎉🎊

stiff gull
#

@nocturne galleon Will work with any file size hmm I doubt that, seeing as you used an int for line number, there's a reason we usually use size_t (or uint64_t these days), 2.1 billion lines is still a lot but can be done in a 2 GB file

#

and then it'll overflow to -2.1 billion and crash 😛

nocturne galleon
#

Well, that's why I put an asterisk on the end haha

stiff gull
#

usually followed up by small print at the end 😛

nocturne galleon
#

Ya, oh well. Figured there wouldn't be a 2gb template file =/

stiff gull
#

thats a different matter haha

small escarp
#

🎉 🎉 🎊 🎊 🎈 @nocturne galleon that's great 🎈 🎊 🎊 🎉 🎉

kind portal
#

Hey, does anyone use eclipse here?

#

I just installed Eclipse to use instead of NetBeans

#

I also installed the dark theme that everyone uses

#

However while using the JFrame builder some colors blend too much, like when changing properties in the JFrame builder

#

Any way to change those specific things?

upbeat folio
#

You know, JavaScript’s async/await syntax is actually very Promising.

tropic grail
#

I moved to IntelliJ from Eclipse.

wheat dock
#

IntelliJ is really the best Java environment

#

VS Code is alright too

astral mantle
#

its aaaamazing

#

Even the community edition

tropic grail
#

I use IntelliJ for Python and it's pretty decent.

spare bison
#

Why intellij for Python?

#

They have a product called PyCharm

spring radish
#
const mockTwats = (str) => {
    const characters = str.split("");

    characters.forEach((char, index) => {
        if (Math.floor((Math.random() * 10) + 1) % 2 === 0) {
            characters[index] = char.toUpperCase();
        } else {
            characters[index] = char.toLowerCase();
        }
    });

    return characters.join("");
};

process.stdout.end(mockTwats(process.argv.slice(2).join(" ")));
#

Because we all gotta be childish every now and then

#

call with

node script.js Your message here | clip
vestal glen
#

(you heard of .map? )

spring radish
#

I have

#

This wasn't meant to be effecient or clean

#

It's literally something I wrote to mock my fiancee a bit 😛

vestal glen
#

I mean, it's a great idea... Though don't proper cool people WrItE aLtErNaTiNg CaPs?

spring radish
#

It's to live up with that spongebob meme

#
const mockTwats = (str) => {
    const characters = str.split("").map(char => Math.floor((Math.random() * 10) + 1) % 2 === 0 ? char.toUpperCase() : char.toLowerCase());

    return characters.join("");
};

process.stdout.end(mockTwats(process.argv.slice(2).join(" ")));
#

There, cleaner for you 😛

#

Well, at that kind of length, might as well change it a bit more

vestal glen
#

almost a "one liner" 😉

spring radish
#
const mockTwats = (str) => {
    return str.split("").map(char => Math.floor(Math.random()) % 2 === 0 ? char.toUpperCase() : char.toLowerCase()).join("");
};

process.stdout.end(mockTwats(process.argv.slice(2).join(" ")));
#

Just a little past the 80 character limit so I'll let it slide

vestal glen
#

hm, didn't you break your Math.random though?

spring radish
#

I did

vestal glen
#

wouldn't you have to Math.round() to have a 50/50-ish chance?

spring radish
#

Math.round or add a * 2

#

Math.round seems cleaner

#

so that's what I changed it to

#
const mockTwats = (str) => {
    return str.split("").map(char => Math.round(Math.random()) % 2 === 0 ? char.toUpperCase() : char.toLowerCase()).join("");
};

process.stdout.end(mockTwats(process.argv.slice(2).join(" ")));
#

God I need better things to do than this...

vestal glen
#

yould also make it shorter to just compare with 0, no % 😛

#

grabs food and disappears

spring radish
#

OH YEAH

spring radish
#
const isRegularCharacter = char => {
    const code = char.charCodeAt(0);

    return (code > 64 && code < 91) || (code > 96 && code < 123);
};

const mock = (str) => {
    return str.split("")
              .map((char, index) => !isRegularCharacter(char) ? char : index % 2 === 0 ? char.toUpperCase() : char.toLowerCase())
              .join("");
};

process.stdout.end(mock(process.argv.slice(2).join(" ")));
#

No longer breaks on special characters such as '

#

But doesn't really support other language characters anymore

keen tapir
#

Does anyone work with QT / C++ any maybe wanna have a look at my program and suggest possible improvements? ;-;

proper gale
#

@keen tapir i work with C++, but not QT.

supple abyss
#

hi, I am reading through a pdf about "modell languages" (in correlation to the turing machine, finite state machine etc.) and I dont know what the succ is supposed to mean (not in the meme way pls)

#

also dont understand where the Z comes from and the B is never found. I'm guessing the prof. made a mistake?

#

also translated this means WHILE-language: addition/sum

ember kiln
#

succ(x) (usually) means successor of x, which is x+1

#

looping on WHILE succ(z) <= b is equivalent to WHILE z < b, and off the top of my head I can't think why it would be easier to do the former in a Turing machine either, but if it's an intermediate language then it might fit better with the model

#

the z is initialised to 0 before the loop, and is a count of what has been added so far; the loop runs until z=b, at which point you have finished adding b to x

#

(@supple abyss )

supple abyss
#

@ember kiln thank you! Clears a lot of things now

spring radish
#

This is why Frontend developers drink

#

Can't get this stuff to center

verbal otter
#

how put the code in those blocks?

spring radish
#

If you just something like this then you just wrap it in `

#

one on each side

#

now, if you want code formatting you put ``` on the first line and the last line

#

the top line, immediately after the ``` you can put a language down like js, html, markdown, and like 90 others to get syntax highlighting

#

like so

#
const someCode = () => {
    return 'some string':
};
#

In my text field this looks like
```js

const someCode = () => {
    return 'some string':
};

```

lapis granite
#

@spring radish flexbox maybe?

vestal glen
#

(based on the text going out of the purple box this seems like images + text to me?)

spring radish
#

The purple is a image that’s repeated over and over again to create. Background

#

That’s on the body element

#

The text is a h1 inside header, inside a div

#

Now, none of those elements have any margin, width, or padding

#

They all set width to 100% of the screen

#

Now, no matter where I place text-align:center or margin-left: auto;margin-right: auto; or boy

#

Both•

#

It produces that result you see on the screen

next haven
#

Can you put the code somewhere? I could give a better answer and help point you in the right direction

tropic grail
#

@spring radish kinda very spammy there bug. Could you try to get it all in a single message in the future? I ask because the anti-raid feature of the bot tends to smack users depending on their chat behavior.

spring radish
#

It isn't that spammy actually, the messages are sent over a 6-10 min period

#

Discord just groups it together as if it was sent within a minute

tropic grail
spring radish
#

Ah

#

I mean I can try? It's more or less how I talk though >.<

deep scarab
#

rebind enter to shift enter

jade rain
#

Anyone around to take a look at my programming assignment? Unsure why its not working

#
#include <iostream>
#include <cstdlib>

int main() {
    int series, input;

    std::cout << "Which element of the series would you like? ";
    std::cin >> input;

    __asm {
    geom:
        push    ebp;
        mov     ebp, esp;
        sub     esp, 16;
        mov[ebp - 4], edi;
        cmp[ebp - 4], 1;
        jne a;
        mov     eax, 1;            // base case
        jmp done;
    a:                            // return 1 + 12 * geom(n-1)
        mov     eax, [ebp - 4];
        sub     eax, 1;
        mov     edi, eax;
        call    geom;
        mov     edx, eax;
        mov     eax, edx;
        add     eax, eax;
        add     eax, edx;
        sal     eax, 2;
        add     eax, 1;
    done:
        leave;
        ret;
    }
        

    std::cout << "f(" << input << ") = " << series << std::endl;
    return 0;
}
nocturne galleon
#

@jade rain what course is that for?

jade rain
#

Assembly Language and Reverse Engineering

#

@nocturne galleon

nocturne galleon
#

Interesting. What degree?

jade rain
#

Computer Security and Information Assurance, Im particularly focusing on Digital Forensics

nocturne galleon
#

Nice. Best of luck. Unfortunately I can't help you with assembly.

proper gale
#

@jade rain not working how?

jade rain
round dome
#

Where are the () ?

#

__asm__( "xor eax, eax" );

proper gale
#

@jade rain what compiler?

round dome
#

visual studio obviously

proper gale
#

thats the IDE

round dome
#

. . . . .

proper gale
#

that follows part of both MSVC and GCC ASM syntax, and MSVS can use GCC

#

assuming MSVC, his original code is mostly syntactically

#

cant believe i didnt spot the semicolons on each line

#

but to be fair, i dont know ASM syntax rules for inlining, as i never do it. can read the stuff though.

round dome
#

well first he uses the MSVC keyword, and then in his screenshot uses the GCC keyword...

proper gale
#

which is why i questioned what compiler

round dome
#

yes but you didn't get my joke :'(

proper gale
#

what joke?

round dome
proper gale
#

multiple people i know thought (or still do, idfk) that Visual Studio and MSVC are just different names for the same thing.

round dome
jade rain
#

Using VS as both

proper gale
#

^ see

#

@round dome

round dome
#

your assignment expects you to use GCC apparently, aren't you supposed to work on a linux kerneled environment ?

proper gale
#

oh, huh, that is GCC ASM syntax

round dome
#

just download VSCode and make sure you have GCC set up FeelsFrogMan @jade rain

edgy ferry
wheat dock
#

I get to die doing javascript today 😦

tough adder
#

Hey yall. Like my Discord bot? Added advanced previews for PCPartPicker and NewEgg.

nocturne galleon
#

@tough adder pretty cool

tough adder
#

Thank you

nocturne galleon
#

Public? @tough adder

tough adder
#

The libraries I made to fetch data from Newegg and PCPartsList are. I added those to the NPM registry. The bot is not yet public but might become public (though it's not difficult especially since the modules are open). I'm trying to see if I can grow my own discord server. Hoping a quality bot will be a unique ish feature

edgy ferry
#
import discord

token = "my token but i removed it"
client = discord.Client()

@client.event
async def on_ready():
    print('We have logged in as {0.user}'.format(client))


@client.event
async def on_message(message):
    id = client.get_guild(521695063051468800)
    channels = ["commands", "xd"]
    if str(message.channel) in channels and message.content == "!ping" and message.content == "!users":
        if message.content.find("!ping") != -1:
            await message.channel.send("@293430838618488833")
        elif message.content == "!users":
            await message.channel.send(f"""Number of users: {id.member_count}""")
    else:
        await message.channel.send("tf u nerd fgo do commands in bot cammands channel or ban")

client.run(token)
#

@keen ermine

keen ermine
#

maybe could help

#

also

edgy ferry
#

ok

craggy acorn
#

anyone know where i can learn to develop i mostly want to do games im just starting out

ionic hull
#

@craggy acorn start with any language, do not focus on games right now. As soon as you start understanding how languages works and basic programing you should start making games ( that will take you a few months to a year ). Don't rush things because that is how we get crappy devs

craggy acorn
#

ok thanks but what language should i start with?

deep scarab
#

c++/c#

wheat dock
#

@craggy acorn Get Visual studio along with the Unity plugins

nocturne galleon
#

C#

nocturne galleon
#

@craggy acorn you can go for the cs50 2018 on YouTube, then go for the language you want, cs50 is just to learn programming concepts then go use it in the language you want

rapid drift
#

Anyone unity3d programmer

#

Need assistance

ember wasp
#

Did anyone try to implement discord oAuth2 in browser ?

lapis granite
#

Yes

sick wraith
#

Anyone good with SQL who could explain more advanced SQL queries for me? Might be a long shot. Really stuck atm.

ionic hull
#

What do you need @sick wraith

sick wraith
#

@ionic hull Trying to do neste queries, but I have come to the conlclusion that I don't know howto to do it.

#

nested*

#

I need to combine "or" and "and" but I can't figure out howto do it.

#

Or if that's even how you do it properly.

ionic hull
#

Just Google it

#

We are developers after all

ember kiln
#

you can combine and and or queries just using brackets, as you would in most programming languages

SELECT * FROM table WHERE ((a=3 AND b='q') OR r LIKE '%2%') AND z=1;
tropic grail
#

Now to use Mortis to update some old SQL calls in LMGbot that need bumping... lol

opal wren
#

hey random question can someone confirm for me if i'm using this correctly because i'm unsure and cant see any good example code i am using python uu module and am i correct in thinking its used as such uu.encode(Path to file i want to encode as base64, path to where i want it to be output)

nocturne galleon
#

when you are doing programming homework due tomorrow and its got a really weird runtime error: angery noises

raven kernel
#

RIP

nocturne galleon
#

...

#

its working now

#

I dont know why what I did actually made it work but...

#

¯_(ツ)_/¯

edit: sorry I just realised a few people probs just got spammed, i wont do 5 word messages anymore

tawny fable
#

Hey, I'm really new to development and I was wondering if I wanted to have user submitted data (simple stuff like if someone rates something out of 5 stars) shared between an iOS app and an Android app, what tools and languages do I need to do that? Like I said I am very new and am just looking at what software I want to start playing around with. 😃

craggy acorn
#

can someone help me im trying to get the li a little more above but i have no idea how

#

im also new to code

gusty quail
#

does anyone here use nginx with php?

tranquil swift
oak parrot
#

Hey guys

#

quick question what is the replacement for mysql_result in PHP ?

nocturne galleon
#

@tranquil swift u windows or mac?

#

if youre mac , open terminal and type java

ionic hull
#

@oak parrot always use pdo

tranquil swift
#

@nocturne galleon windows

kind portal
#

Hey, its the guy that doesnt understand java here again.

#

How do I set the state of a Radio button from like an if statement?

#

kinda like I can set a JLabel text via java label.setText("");

#

But I want to set the state of the JRadioButton instead

deep scarab
#
btn.setSelected(true);
#

@kind portal

kind portal
#

Thank you!

waxen snow
#

@craggy acorn add padding or margin to the ul bottom nav ul { margin-bottom: 10px; }

proper gale
#

i have a feeling i should optimize my code's memory allocations,

#

for context, rest of the system is using about 5GB of ram, single application is using 45-60GB.
yes i knew it would do this, yes it is supposed to use that much, the problem is the variation, didn't really think about that

ember kiln
#

I thought my 16GB OOM errors were bad...

proper gale
#

@ember kiln i mean, its not an error, it is working properly, just, slowly

#

and i didn't calculate usage correct, so it uses a lot more than i originally thought it would.

oak parrot
#

Does anyone know of any good OOP PHP MySQL tut's I can use?

proper gale
#

^ the real answer

ionic hull
#

Stop shitting on php ffs

#

PHP 7 is really good and if you are an experienced dev you won't make any basic PHP errors

ember kiln
#

PHP is better than it used to be, but it's far too inconsistent (and far too easy to make mistakes) to be considered a good language

ionic hull
#

@last ingot I am a web developer, I do freelance and most often I use the php stack. And php isn't a bad language, you just need to be really careful when using it. PHP has a bad name because of the half assed apps that are running rn. And when you use the term "kid" you just show arrogance and most often who says that is a kid himself

nocturne galleon
#

PHP is a cool language to learn.

#

I’ve never really gotten into it though.

#

I might, who knows.

mossy ice
tropic grail
#

Think I'll try that.

radiant jacinth
#

Javascript ftw

vestal glen
#

well, either it's not an error you coded it wrong 😉

#

(also linters, typescript, strict mode etc.)

oak parrot
#

@last ingot to answer your question of what I want to make is a Log book system for my community

#

What would you suggest I build this project on then? If not PHP?

vestal glen
#

(some language/framework you're comfortable in)

proper gale
#

@last ingot that may be stupidest logic ive ever heard.

#

good amount of my own code, its a black box, i know what it does, and generally how, no idea how to fix it without re-reading everything.

#

nobody can keep an entire codebase in their head.

#

If i coded it their wouldn't be any errors :P and if their was i would know how to fix it because i would know the codebase. <- what im talking about

#

you will make errors, you are human (i think), and you wont know how to fix them any better than if someone else wrote the code if you didn't write it yesterday (figuratively)

#

yes it is If i coded it their wouldn't be any errors

#

so you are saying that its easier to work with a code base you have been working with vs something that you have never seen before, no shit

#

you used C++?

#

it will fail, and not tell you anything

#

C++ wont in debugging

#

unless you are using valgrind, and then it may

#

ok, that a debugging technique, because the language tells you jack shit.

#

you ever read a template compile error?

#

segfaults are fun, but debuggers are not complete shit at finding where that happened.
the real fun one is a memory leak.

#

i never said anything about an IDE

#

was talking about libraries i wrote, that were for a game engine, but thats not what im using them for.

#

i actually need to go over my config one, as i switched to a different object style, and it would be real nice if it used that.

#

for what?

#

what data?

#

salted hash

#

i would recommend the SHA512, SHA-3, or Blake2b algorithms.

#

yes

#

wait, no.

#

hashing is not encryption

#

you take the password, run it through the hashing algorithm with a unique salt, and compare the result.

#

you store the hashed password and salt.

#

that is exactly what i just said to do

#

and i have you one way hahsing algorithms.

#

one way hash with salt

mossy ice
grand hornet
#

@mossy ice lmao that’s so funny

zealous kayak
#

GUYS .. react or vue?

nocturne galleon
#

@zealous kayak my vote is for React

kind portal
#

hey, what is an ArrayList in java?

grand hornet
#

Java has ArrayList too

#

@zealous kayak I would use Vue

fluid pollen
#

How did “Linus” steal his OWN 🧠. With 💴 and “brand power”

#

I don’t get “triggered” “doctors” got my 🧠 “messed” up by 2 💊 the “doc” gave me.

proper gale
#

@kind portal an array that can change size, based on a normal array that it manages.

shrewd sequoia
#

So is anyone here familiar with ROS?

dark thicket
#

robot operating system

nocturne galleon
#

Something like Alexa?

thin cobalt
#

anybody here good at C# winforms?
I have a question

#

i have a ListBox, and I want to add items to the listbox from another class

#

how do I do that?

thin cobalt
#

I want to be able to do listBox1.Items.Add("some log message");

#

but from a different file

nocturne galleon
#

hey @proper gale about that video on storing passwords, when talking about the hashing and salting. how do they decrypt the password for when they need to check it against what the user enters?

ionic hull
#

@nocturne galleon when the user enters the password, the code behind the login will get the hashed password stored in a database or whatever, then hash the password that the user gave. And just simply check if the hashes are the same

nocturne galleon
#

But if the password is salted wouldn’t it be a different hash?

ionic hull
#

Example:

md5( password + "some key")

#

The hash will be the sane

#

Same

nocturne galleon
#

@thin cobalt can you just put a static method on the class that the listbox is local to and call it from the other class?

small escarp
#

probably not static

#

also, @nocturne galleon the test is hash(user_input + known_salt) == stored_hash

#

note that both stored_hash and known_salt are stored in the user row in the database

#

and will be different for each user

#

the salt is not particularly secret, since a hacker who has access to the db can read it in cleartext

#

it's only to ensure everyone has effectively a unique password

hasty portal
edgy ferry
#

im clueless in blender

proper gale
#

@hasty portal what is that, and why did you make it?

hasty portal
#

idk bored

rigid jewel
#

blender is great!

#

check out Blender Gurus getting started tutorial

solemn spade
#

Hey question I know you can cluster raspberrypi CPU together but can you also cluster the GPUs? What I would like to make is a mobile retro mobile console that can do things like psp and Nintendo ds by clustering 2-4 pi zeros together in the hopes of combining the GPU power of all of them, then running retropi. Is this possible?

rigid jewel
#

@solemn spade i highly doubt you will get the kind of performance you are looking for, Pi Clustering really kind of sucks

#

its more for learning, than for practical use cases

solemn spade
#

Welp it was just a thought....

rigid jewel
#

you would be just better of using a Pi 3 B+

solemn spade
#

It’s not powerful enough to do psp and ds really

rigid jewel
#

sure it is

solemn spade
#

I’ve tried

rigid jewel
#

i run RetroPi on mine, i was playing Ps2 games even

solemn spade
#

Ya “some” of them I want all games to work

#

I have a pi 3 b+ and it has a hard time playing psp and n64 and ps1

rigid jewel
#

you were using RetroPi ?

solemn spade
#

Yes

#

There image even

#

The new one 4.4

rigid jewel
#

well the Pi Zero is far less powerful than the 3B

#

even 2 of them would not be as fast

solemn spade
#

Well from what I’ve notice the CPU is like never the issue even on my pi zero but the GPU is the bottleneck