/dpt/ - Daily Programming Thread

Old thread: What are you working on Sup Forums?

Other urls found in this thread:

youtube.com/watch?v=gTBCHu0btn8
paste.debian.net/plainh/c4558076
finn.no/job/fulltime/search.html?industry=8&occupation=0.23
showit.today/
twitter.com/SFWRedditGifs

1st for ruby
youtube.com/watch?v=gTBCHu0btn8

Threadly reminder that dlang-chan is not dead, and she's super duper cute! Say something nice about her, /dpt/!

>there are retards who need such lame analogies to understand MVC
It's no surprise the modern web is shit.

A few months ago, I started working at a small company as their fourth web developer. For the first few months I didn't even look at the code base in production, because the plan with hiring me was to move away from the old framework and code, and rewrite the whole system from scratch.

But, for the last few weeks, there has been a lot of extra stuff going on, just a few new features that is needed in the old system before we start working hard on the new one. So now I'm suddenly a developer for the system currently in production.This is a website, written in PHP, that has been in active development by a handful of different people for about 10 years, where I'm encountering all kinds of weird shit. Views doing controller stuff, controllers defining models, models doing tasks that really should be delegated to the views, SQL-queries that span over 1000 lines with ifs and elses looking for everything from session variables to results from other queries, just to make *this* query able to handle every edge case that could ever exist . Every function that fetches something from the databse returns false if there is there is no data, unless they return an error message, or straight out fail with a fatal PHP error, or returns nothing at all, or maybe it returns an empty array. Functions follows the very convenient incremental naming scheme of getModelList, getModelList2, getModelListNew, getModelListNew2, etc, where each of the four variations of the exact same function are in use *somewhere* in the code base, but nobody knows why or how to fix it, and at this point nobody even bothers.

It's a real mess, but I had forgotten how relaxing it is to work on something that is a mess from the get-go. No consideration at all. Just write code. No style guidelines, no best-practices, no sanity. Just write and make sure it works before it goes into production. It feels like I'm the king of the code, not another slave to a framework.

Just wanted to share. Ty.

repost

does anyone know how the image hash for the archives is generated?

for example this image has archive image hash ttnnYRUwvjgbvnwvkx3a2g

but when I look at its MD5 it says b6d9e7611530be381bbe7c2f931ddada

What archive are you talking about?

7th for Nagato!

Rate my ffmpeg screen recording script!

paste.debian.net/plainh/c4558076

Any decent net programming learning resources senpaitachi? Literally never touched the stuff. I want to write a desktop multiplayer tic tac toe or a chat from scratch to get basic knowledge how things work. Mostly use C++ at work atm

building my search engine wibr.me. It will only have personal/hobbiest type pages like the old internet. if you can submit pages to it i'd appreciate it.

>Also remember to reset the variable back to false when the encounter has finished
Would this be in the mainform because putting bool escaped = false; after

if (escaped == true)
{
lblFight.Text = "Hero has fled...";
this.Hide();

}
errors escaped as already defined

When you reset the variable back to false are you doing bool escaped = false; or escaped = false;?
Once you declare a variable with its typename you don't need to declare it again. You can just redefine it.

Are there many programming jobs for English speakers in Norway?

International programming jobs are often in English.

The first time you write bool escaped = false, you're actually doing two things at the same time. First, you're telling that escaped is a boolean, and that escaped is false. When you have said that escaped is a boolean, you don't have to say it again. When If you put escaped = false (without bool first) after the block, it will work.

How do i make an app that runs from the windows command line?

Like dotnet, npm, node or telnet?

You write it. One character at a time.

>app
>command line
Pick one

Ah that cleared it up, thank you. I'm still getting the same result of instant pop in out so maybe my order is wrong
public partial class formEnemyFight : Form
{
public formEnemyFight()
{
InitializeComponent();
lblFight.Text = "An Enemy Approaches! COMMAND?";
bool escaped = false;
}


private void formEnemyFight_Load(object sender, EventArgs e)
{
lblFight.Text = "An Enemy Approaches! COMMAND?";
}

private void buttonFight_Click(object sender, EventArgs e)
{
lblFight.Text = "An Enemy Approaches! FIGHT?";
}

private void buttonEscape_Click(object sender, EventArgs e)
{

bool escaped = true;

if (escaped == true)
{
lblFight.Text = "Hero has fled...";
this.Hide();
escaped = false;
}

}

There is probably some, as most Norwegians understand English pretty good and most tech companies will have English as their main working language. However, most Norwegians prefer to talk in Norwegian, so in case you're competing with other equally skilled applicants who do speak Norwegian, they will probably be selected over you, based solely on language capabilities. There is no harm in applying for programming jobs in Norway, though. finn.no/job/fulltime/search.html?industry=8&occupation=0.23 Good luck!

Move the definition of `escaped` to just inside the class (line 3), and then you can use it in your functions with this.escaped (if (this.escaped), this.escaped = false, etc). Right now, escaped is deleted as soon as the function is done running.

When you're working with boolean values, you don't have to check if they equal true or false, you can just use them in your ifs. if (escaped == true) is the exact same thing as if (escaped).

Sup Forums archives

Thanks anons

public partial class formEnemyFight : Form
{
public formEnemyFight(bool escaped)
{
InitializeComponent();
lblFight.Text = "An Enemy Approaches! COMMAND?";

This errors all the escaped here
private void buttonEscape_Click(object sender, EventArgs e)
{

escaped = true;

if (escaped == true)
{
lblFight.Text = "Hero has fled...";
this.Hide();
escaped = false;
}

}


Are you saying that I can replace all the escaped with this.escaped?

No problem!

Put bool escaped = true] here
public partial class formEnemyFight : Form
{
bool escaped = true; // Here
public formEnemyFight()

And from there on out instead of saying escaped use this.escaped.

That makes escaped a class variable instead of a local variable. As a local variable it was getting deleted and re-set to true every time you ran the escape function. If you put it in the class it'll start off as true, but stay false once you set it that way. IE its state/value will persist between function calls/button clicks.

public partial class formEnemyFight : Form
{
private bool escaped = false;

public formEnemyFight()
{
InitializeComponent();
lblFight.Text = "An Enemy Approaches! COMMAND?";
this.escaped = false;
}


private void formEnemyFight_Load(object sender, EventArgs e)
{
lblFight.Text = "An Enemy Approaches! COMMAND?";
}

private void buttonFight_Click(object sender, EventArgs e)
{
lblFight.Text = "An Enemy Approaches! FIGHT?";
}

private void buttonEscape_Click(object sender, EventArgs e)
{

if (this.escaped)
{
lblFight.Text = "Hero has fled...";
this.Hide();
this.escaped = false;
}

}


I was a little unclear when I said that you can move it to line 3. I meant introducing a *new* line 3, not inserting it into line 3.

It's about scopes. Basically, who can access what, and when. If a variable should only be accessed and used in a function, you should put the definition of that variable inside that function. If several functions should be able to access a variable, you should put the variable definition in the class. Do you see how I have made escaped part of the class?

Well I fucked up the formatting. Just follow >60135920

Working on my experimental social media platform. Only one post at a time, which every user sees.

Currently set up so changing the post cost $1.

What do you think Sup Forums?

showit.today/

Why would anyone join this?

you got a couple of ransomware sites on your ip bud, your site is even blacklisted in .ru

Bretty cool shit user.

Thanks but this window still isn't staying up, I even copied the code directly maybe there's something with my winform.

Even turning this.hide into a comment is causing the window to not open

is this "sum of primes below 2 million" an actual interview question?

No. nor is fizz buzz. Some retard saw it on a even more retarded reddit post and brought it here.

Debug it bruh, see what's happening and conclude whats wrong.

Because you can broadcast anything you want to every visitor anonymously (for now) and with 0 censorship.

Also, I'm serious about donating the profits to charity, so there's there's muh virtue signalling.

This project is really just a proof of concept, in the future I'd like to set up something similar as a marketplace for buying ad time on electronic billboards, etc.

Yes and so is the question "who's your favorite 2hu" and if you answer anything other thank Yukari-sama then you'll be fired.

this.escaped is never true. You need to set it to true when your hero has escaped. Maybe the check in buttonEscape_click() should check if this.escaped is *not* true?

Right now, in plain words, the code says this: When we click the escape button, check if our hero has already escaped. If he has already escaped, set the text to "Hero has fled...", hide this, and tell everybody else that the hero has not escaped any more.

What I think we want to do is the following: Check if our hero has escaped, if he has not escaped, set the text to "Hero has fled...", wait a little, hide this and tell everybody else that our hero has escaped.

What do you think?

Any tips to program when the anti psychotics are not working so well and you feel insects crawling out of your head and walking through your body?

>pls respond and help me cope

why is webdev so garbage

Suicide seems like a pretty good option.

It's more usual to give a bigger task with a few days to solve, rather than giving a tiny task with half an hour to solve it. Probably depends on the workplace, how many applicants they get, in what environment the development is, etc.

I frequently consider it. It's has been worse thou.

>>C++
void connect(TreeLinkNode *p) {
TreeLinkNode *pp = NULL, *q = NULL, *r;
while (p) {
q = NULL;
for (; p; p = p->next) {
r = NULL;
if (p->left) {
if (p->right)
p->left->next = p->right;
r = p->left;
} else if (p->right)
r = p->right;
if (r) {
if (q)
q->next = r;
else
pp = q = r;
if (q->next)
q = q->next;
if (q->next)
q = q->next;
}
}
p = pp;
pp = NULL;
}
}

No idea, I'm sorry. I hope you'll get through it.

I just found battleSculpture.hide in my main if else statement for showing the windows
Thanks for telling me to debug
And thank you for reminding me to make it true in the button click
Now I can move on to passing health values between fights and doing this again for all the other fights

ty

Good luck on your game! I hope I was of some help.

sorry I like Tewi

>Yukari-sama
>Not Yuyuko-chama

No, I mean why would anyone visit this place to look at ads?

Working on a neural network to detect bot matches in dota based on the hero composition and items bought in the game and other relevant match data.

Also writing a simple backend in golang for my upcoming data science blog (which will feature the above work). It will be very simple, but I want to learn some hobbyist webdev.

if (q->next)
q = q->next;
if (q->next)
q = q->next;

Really fucked with my eyes. I keep seeing the q fish, and can't see at the code.

I hope you feel better. Seriously.

No her. I think it has potential as long as it has a social network aspect.
Like a craiglist with rating and global rank?
You can find the best gay hook ups in your area.

You hope I feel better if I commit suicide or you hope the schizo gets better?
The first is very likely, the second not so much.

life is suffering

>you feel insects crawling out of your head and walking through your body
You know it's not real, so ignore it.

You were, I was stuck on this all day. Now I need to remove the bounds on the invisible picturebox after the fight is over.

I want to contribute to open source!
inspiring_anime_face.png

>forms
>different forms
Please no. Go with WPF and use a single window + pages in a frame or something.

That's not quite how it works but thanks.
There are some "coming" out of my thigh now btw.

...

i hope you all live fulfilling lives

I recommend you contribute to free software instead of open source.
What areas interest you?

>you all
The insects and me?
They are not real you know...

And what languages do you know?

>That's not quite how it works
Okay, so you're an attention-whore who
is going to continue insisting he has a disease nobody else can see a sign of and that can't be fixed no matter what. Got it.

I'm completely unfamiliar with that, does that condense all of these into one winform or something?

I like Sup Forums content quality.

Take a break. Go do something different for a little while. Put the insects down outside, and tell them that they are not allowed inside.

I laughed, thanks.
I took some(a lot) of xanax and hopefully I will fall asleep soon(hopefully forever).

Oh my fuck. Put a picturebox in the center and change the picture to the sprite that you get into combat with. Why is there a new winform for each one?

I can't sit still and read a fucking ebook!! help

I think you should just keep using the forms for this project. Have fun with it and learn why you probably don't want to use them in your next project.

Why? What happens when you try?

t. person with insects inside his head

I read a few pages then i can't help but go on youtube or daydream. If i get off the internet i get severe anxiety.

Insects are really annoying when they are inside, and it doesn't help to just throw them outside. They just come straight back inside again! But! If you put them down nicely and set the rules for where they are allowed to be and where they are not allowed to be, they usually listen. Only the occasional rebel will break the rules.

Just because you know it's not real doesn't make it not feel real

I was overthinking how I would handle having stats set for every fight and thought the only solution was to make every fight a different instance.
I'm a little confused on how to handle multiple fights since my last project was just
Console.WriteLine(heroName + ": {0} King Slime: {1}", good.hitPoints, bad.hitPoints);
//displays current health every attack turn
int damage = (int)(good.GenerateAttack() * Weapons[weaponChoice - 1].damageModifier);
bad.hitPoints -= damage;
Console.WriteLine(heroName + " dealt {0} DMG", damage);
//displays hero damage every attack turn
if (bad.hitPoints

Change all your passwords to really long complex ones. Save all of them on a password manager(keepassx for example) with a super long master password. Set you browser to delete cookies on exit.

Try daydreaming while reading and paying attention, it's a good mental exercise.

Or

Put some noise music on so your. The extra effort required to concentrate will make daydreaming impossible.

Read those few pages and try your best go read some few more. It gets easier after you get into it.

Realize everyone on the internet is retarded and not worth your time.

Try to pose questions to yourself about what you are reading and try to explain it to a retarded imaginary friend(like they were a 4channer).

hahaha, actually this somewhat works for short periods of time but the mental effort required is absurd.

I didn't say he should make it not feel real, I said he should ignore it.

I would do something like creating a class called monsters or entities and set each monster an id, name, hp, skills, etc. then if this monster id equals to the one you touched instance that monster into the combat form.

Going to sleep bois. Hope your insects stay outside and you manage to concentrate on your readings.

>Console.WriteLine(heroName + ": {0} King Slime: {1}", good.hitPoints, bad.hitPoints);
You'll probably want to pass in a monster object or something to the form's constructor or whatever the fuck you do in C hashtag. Or make a public method in the form to set up the enemies. Then switch it to
Console.WriteLine(heroName + ": {0} {2}: {1}", good.hitPoints, bad.hitPoints, Enemy.Name);

or something. Put an Image into the Enemy class and you can make the picturebox and set that image to it and get rid of the extra forms.

FUCK MY LIFE, ALL PROGRAMMING LANGUAGES ARE SHIT, ALL OPERATING SYSTEMS ARE SHIT, THE INTERNET AND EVERYTHING ON IT IS HOT STEAMY SHIT.

i swear to god i'm gonna burn all the technology i own, sleep the rest of my life away and see how long it takes my fat ass to starve

make your own

>"make" your "own"
kill*
self*
ftfy

that's not what i meant at all

to be slightly more coherent in my rage:
don't you fucking hate it when you accidentally uninstall your GUI and you don't know what packages to reinstall to get it back and you also can't check because your network manager went down with it and of course you could just use ethernet except your computer doesn't have an ethernet port and you have another working computer but the fucking worst part is your connection is taking fUCKIGN ages to download the shit what all you have to install on your thing and you know when it's done you'll just have to fucking reconigure and reinstally everythinfg

Can you stop typing in this retarded fashion if you aren't quoting anyone?

Why do people keep insisting on propagating this unfunny meme?

Not him but I'm actually I am in the process of doing this. Writing my own OS and everything.

Using a z80 processor because I've made z80 emulators before. I basically have 2mb of "ram" and it's so comfy. More than I'll ever use in the foreseeable future. Use an SSD for permanent storage (don't even have a file system). Using just serial from my PC to communicate with it instead of writing my own usb drivers (and I'd probably have to get a dedicated chip for processing USB). I'll probably have to snag a PS/2 keyboard.

Trying to figure out what I should do for a "video card." It'd be nice to have some fancy graphics.

>"people"
It's just one person dude.

Can you stop forcing this trash meme?

are you making an fp language

>meme
I don't see your sentence making any sense. What is this "meme" thing you keep talking about?

Will I find happiness as software engineer?

>mfw newfag 1chan user doesn't know what meme arrows are
Brah.
>not knowing how to green text
>2017