/dpt/ - Daily Programming Thread

What are you working on, Jow Forums?
Old thread:

Attached: 1508729159918.png (1000x1071, 102K)

Other urls found in this thread:

github.com/CosmosOS/Cosmos
csharpindepth.com
amazon.com/gp/product/1617294535
poi.apache.org/
amazon.com/gp/aw/d/B01JCOH82M/ref=mp_s_a_1_4?ie=UTF8&qid=1526622697&sr=8-4&pi=AC_SX236_SY340_FMwebp_QL65&keywords=c# .net
amazon.com/gp/aw/d/1484230175/ref=mp_s_a_1_3?ie=UTF8&qid=1526622697&sr=8-3&pi=AC_SX236_SY340_FMwebp_QL65&keywords=c# .net
wrox.com/WileyCDA/WroxTitle/Beginning-Visual-C-2010.productCd-0470502266.html
sourceforge.net/projects/win-agui
twitter.com/SFWRedditVideos

First for C#

Second for learn Swift

3rd for Java

Testing out
>github.com/CosmosOS/Cosmos

>unified under one standard
as a sepplesfag I really wish this was true

What's the best books for picking up c#?

C# in Depth 3rd Edition is good but not for beginners. Jon Skeet wrote it. He's the Chuck Norris of StackOverflow.

csharpindepth.com

I'm working on python tutorials. One day I'll edit final fantasy games uwu

C# in Depth 4th Edition is being written.

amazon.com/gp/product/1617294535

>interning this summer
> first project is a seemingly minor modification to project
>source code is literally 30 Year’s old
>ported from fortran to c++ by a fortran coder so it does a bunch of dumb shit (there are tons of goto statements)
>millions of lines of this garbage code
>modify one thing slightly everything shits the bed
It’s going to be a long summer

Is there any reason for a class to be friends with itself? I am looking at some old code for work and noticed multiple classes doing that

Ideally a class should be as friendly as possible, you never know when you'll need help with your hw or a study buddy, not to mention the ladies ;)

I've got a program that has two massive hashtables it's going to use (java). The problem is that the data isn't currently in the hashtables. Instead it's inconveniently in a word document hundreds of pages long with two columns, one for each hashtable. How the everliving fuck do I get those thousands of thousands of words into my program without fucking it up. Do I find a program that can read word documents?

export the content of the doc into a db. then use select statement to get the value.

me is brainlet, don't take my suggestion seriously

poi.apache.org/

cont. use poi to read the document and then populate the hashtables

you guys rock

>spend a week to add feature XYZ to the project because it will make the software more intuitive/faster for the user
>team: we don't like feature XYZ. it might confuse the customer
>remove feature XYZ from project
>present the software to the customer
>customer: we need something like feature XYZ. this interface is just too complicated and confusing and feature XYZ would make it more intuitive
>mfw

Attached: 911.jpg (400x505, 50K)

I'm trying to learn more about software architecture and I found out about message queues, but I am having trouble when it comes to understand the concept itself.

When is it advisable to use message queueing? I am still reading about it and most of the examples were presented in a microservices context, which led me to think that it would not have so much impact in a monolithic system, which were the kind of systems in my previous jobs.

Attached: 1461800939409.jpg (255x232, 11K)

Some PHP developers believe that PHP is faster than compiled languages like Java and C#.

Attached: 1525997168443.jpg (224x225, 11K)

Hi, im still doing some bourne shell scripting. How can I get an if statement to pick up a range of characters?

if [ $1 = -[letters between a-e && leters between a g-z]

so, if the first cmd line argument is -d, it would enter the if statement, thanks

I'm a dumb C# developer and I was really demotivated with my career to the point I lost the will to learn anything new at all few years ago and started to dislike working with development. The last thing I picked up to study for real was Domain Driven Design concepts like six years ago while I was still in my very first programming job.

I went on a job hunt in the past weeks and most of job listings had requirements like RabbitMQ, MongoDB, Kafka, Microservices, NodeJS, .Net Core. I felt really sad and depressive for missing out on new things to learn (or better said, not having the will power to learn anything). All I did these years after work was rushing off to some kind of escapism like video games or playing instruments because I simply did not like to code anymore.

Today I found out about Jow Forums (only browsed Jow Forums and /v/ until then) and its programming threads. Seeing people talking about programming, concepts and ideas made me remember the time where I liked programming and actually had any kind of enjoyment while doing it instead of making me want to kms.

Just wanted to get it off my chest. Also I hope someday somehow I get to enjoy programming again, because until then, it's just something I do to pay the bills and nothing else.

Attached: 1444592546147.jpg (563x364, 95K)

Just watched my USG commit suicide, AMA.

That's what happens when you fall for the IT meme. Dealing with computers is an absolute nightmare nowadays. It's expected that you know how to use every single technology out there, even though they are all shitty and confusing. You're held accountable for stuff completely out of your control, simply because everything is unreliable as fuck. Doing IT in the 201x's is being part of an army of retards trying to juggle every critical thing in the world at once.

I'm writing in Forth. Anyone heard of it? It's my favorite language. I'm using Mecrisp-Stellaris.

Currently working on Conway's Game of Life in Java.

I decided to store the grid as a series of numbers because using a 2d array to store each cell seemed retarded. For instance if I were to use bytes it would look like this.
00000000
01000100
00000010
00001110
00000000
00110000
00110000
00000000

The rest is just bit manipulation to determine the next state of a cell. Though I have not figured out how to get it to wrap around yet.

Attached: conway game of life.gif (500x666, 42K)

I downloaded a free copy of this book the other day
amazon.com/gp/aw/d/B01JCOH82M/ref=mp_s_a_1_4?ie=UTF8&qid=1526622697&sr=8-4&pi=AC_SX236_SY340_FMwebp_QL65&keywords=c# .net
It's the only thing that seems even slightly like a beginner book. It's pretty massive and looking over the contents it seems to go in depth with .net, but I dunno.

Message queues are useful in so many circumstances, even monolithic systems. I use message queues in embedded systems all the time. I guess in a way when you implement a messaging queue you *sort* of are making something microservicey in that you are decoupling certain sections of the program from each other.

It is one of those things that is so generally useful so sometimes an example is better.

Handling hardware interrupts: You can use a message queue to quickly register some event happening and then let the main loop of the program take care of handling it. You want as little time to be spent in the interrupt as possible for many reasons. Example: button gets pushed, instead of the interrupt service routine calling whatever function the user pressing the button should prompt you just pass a message that says "hey the button got pressed, do something about it" and another part of your program checks it at regular intervals. This keeps the flow of your program from getting too complicated and makes everything simpler.

Actually posted the wrong one, I have the newest version here
amazon.com/gp/aw/d/1484230175/ref=mp_s_a_1_3?ie=UTF8&qid=1526622697&sr=8-3&pi=AC_SX236_SY340_FMwebp_QL65&keywords=c# .net

Does anyone know anything about this book? It seems pretty interesting and it kinda makes me excited to learn c# and the .net framework. I'm not a total beginner, I know some stuff based off c++ like pointers and arrays and structures

Daily reminder that programming is fucking braindead easy and you all are doing the short bus version of electrical engineering.

POI is insanely powerful, would recommend learning the excel tools. If I'm making a big application I don't use log files, I make spreadsheets.

I just want to make final fantasy 7 mods (._$. )

Attached: NPC-ffvii-HoneyBee (1).png (126x233, 15K)

*keks in i2c*

> the year of our lord 2018
> still using 400kHz I2C

Learn Kotlin, programming has become fun for me again. It does so much cool shit but it does it in an interesting way, and it has operator overloads

I'm learning C!

Attached: 1526625524.png (841x531, 46K)

how did you get a free copy of that book?
i don't know about this book. the one i read when i was learning c# was Beginning Visual C# 2010. then i read c# in depth.

wrox.com/WileyCDA/WroxTitle/Beginning-Visual-C-2010.productCd-0470502266.html

The entirety of C/C++ has been deprecated. Please migrate all of your code before upgrading to the next release.

Attached: popuko_die.png (517x480, 164K)

>i2c
EAT MY ENTIRE COCK

>scanf
>do...while
>factorial = factorial * i

LOOOOOOOOOOOOOOOOOOOOOOOOOOL

Attached: laughing lemon4.png (600x580, 792K)

tell me what to do better!

Would you have preferred SMBus papa

> not overclocking your i2c builds with threadripper

[spoiler]no[/spoiler]

Attached: supa hot pepe.jpg (1000x847, 110K)

well okay, have a nice night then! thanks for laughing at me!

not sure about scanf & do while
but you can shorten it like this:
factorial *= i;

Its mostly a meme but there are certain things to look out for.

1) Google "problems with scanf", not mostly a problem for learning purposes but not safe to use in real situations

2) Do..While is unnatural and you shouldn't use it unless for very specific cases.

3) Factorial *= i;

thanks for guilt tripping me

Attached: angrypepe1.png (369x361, 252K)

RESPOND TO ME I CANT TAKE THE GUILT AM I FORGIVEN????????????

Attached: pink wojack rage.png (400x416, 41K)

Read about how windows deals with gui, you'll get it in an instant
At least thats where I first found out about msg ques and in that context it made a lot of sense

thanks!

you'd better forgive pepe before he becomes an hero

I am trying to!
that stops from a negative number being used, right?

Attached: 1526627021.png (841x526, 50K)

Does Go compile faster than C?

dumb frogposter

>he mad that the halting problem is undecidable
>literally just implement a real life oracle machine
>bam halting problem solved

Attached: lamb the calculus.png (1561x1195, 743K)

header files essentially

based guiltposter
same happens to me too

i hate having a low IQ, since low IQs correlate with high empathy

enhance sunglasses

Attached: download (7).jpg (275x183, 9K)

how's your into class, user?

sourceforge.net/projects/win-agui

>2007 + 11
>Sourceforge

there are a lot of C compiler flags

one of my first jobs ever i htought was going to be super easy. changing seimens cobol code. i ended up disabling a 70 story building.

nice

what sort of diciplinary action did you get for that ?

just working unpaid through a weekend to fix it. i think my supervisor knew it was going to happen.

>seimens cobol code
what does that code do?

#define coroutine(name, body)\
static void name() {\
static int DANK = 0;
switch (DANK) {\
case 0: body\
}\
++DANK;\
}
#define yield(MEME) break; case MEME:

coroutine(example, {
puts("hello");
yield(1)
puts("world");
})

int main() {
example();
example();
return 0;
}

Attached: flat.png (400x250, 45K)

Honestly appreciate this job. It will teach you a lot. It will be an experience you may never have again

Basically no.
Someone might think it's necessary so that members of a class can access each other's private members while still restricting access to them from outside the class altogether.
However, a little known feature of C++ is that this is already possible without declaring a class a friend of itself.
I guess one possible use would be to explicitly document that you intend to make use of that feature.

>Google "problems with scanf",
There is literally nothing wrong with scanf faggot

Jesus christ, what the fuck are you doing

scanf is fucking awful at recovering from errors, because it leaves in the stream in basically an unspecified state.
It's almost always a better idea to use fgets (or getline) and use sscanf on that.

well just roll back feature in XYZ into the code base and quit yapping ya cuck, whats the big deal here?

Why C doesn't make a differentiation between implementation dependent behavior and total undefined behavior?
For example:
implementation dependent behavior
signed char foo = 0x7f;
foo++;

foo could be -128 if the machine uses 2's complement, and signed char == 8 bits, or other value depends on the machine, while
char foo = malloc(sizeof(char) * 2);
char bar;
int i = 0;
while(i < 2){
foo[i] = 0;
i++;
}
bar = foo[2];

the value of bar will be depends on the state of the machine, not the implementation of the code.

signed integer overflow is undefined behavior. It should be implementation defined but the standard says it isn't.

Reminder that C is literally more portable than most scripting languages.

>how javascript works depends on the browser
>python and lua keep deprecating themselves
>ruby's package manager is a recipe for dependency hell

C has compilers for just about every platform, and they pretty much all work the same in every way that actually matters, because C actually has a standard as opposed to just being an arbitrary collection of nifty newfangled conveniences. Furthermore, you can easily embed all of your dependencies in your binary via static linking, in order to minimize expectations of the target machine's setup, and because C is so lightweight and doesn't have a runtime, this doesn't even tend to make the binary cumbersome to lug around.

>because C actually has a standard as opposed to just being an arbitrary collection of nifty newfangled conveniences.
what is ECMAscript

the big deal is i feel validated.
>cuck
please die.

>what is ECMAscript
javascript's "strict" mode that no one uses because "like omg u guise javascript is so much more hip and trendy look at my webpage sparkle while i sip this fucking starbucks latte"

struct gl_buffer
{
unsigned int id;
unsigned int target;

template
void upload(std::vector& data)
{
printf("target: 0x%x\n", target);
glGenBuffers(1, &id);
bind();
glBufferData(target, data.size() * sizeof(T), data.data(), GL_STATIC_DRAW);
unbind();
}

void bind() { glBindBuffer(target, id); }
void unbind() { glBindBuffer(target, 0); }
};

struct vertex_buffer : gl_buffer
{
unsigned int target = GL_ARRAY_BUFFER;
};


why come target isn't automatically getting set to GL_ARRAY_BUFFER when I declare a vertex_buffer

>It should be implementation defined
no

Yeah, it would be impossible to write a program would could sanely handle that condition in a portable way, since the results are potentially so different.
Also, being undefined allows for compilers to optimise it more aggressively. I would actually prefer that unsigned overflow was undefined too, but there was a way to 'opt in' to overflow semantics.
It'll never happen for C, though.

Anyone know off the top of their head a small project in C for a beginner to play with and study?

Are you compiling with at least -std=c++11 (or preferably 14)? Because that won't work with earlier standards.

Also you're printing out the target of gl_buffer not vertex_buffer.

I'm using c++17

So you mean when I call upload() in an instance of vertex_buffer it won't use vertex_buffer's target?

any ideas of things i should add? so far it sends whatever is typed into these three texts boxes to an email address

Attached: Untitled.png (589x385, 176K)

so you are the one who made this?

Attached: C44A44jVUAEnSnV.jpg (740x354, 47K)

i took inspiration from it

what language do you code it with?

I'm working on a secured email function for my internship with email piping to a php script. My script is fine since I tested it locally but on the server txt files created by php are saved as ascii and I need it to be binary.
The server runs on directadmin.
Anyone know where to change that?

C#

noice. i love c#

0x428a2f98, 0x71374491, 0xb5c0fbcf,

How do I learn to read this shit? I mean, how do I convert it to a symbol or an integer in my mind?
I do okay with something like
10100101
but what is this 0x____ shit ?

yuck

hexadecimal

every hex digit corresponds to four bits

Does anyone have a computer architecture book they would recommend?

use calculator
preferably the programmer style

Attached: calc.png (409x382, 18K)