/dpt/ - Daily Programming Thread

What are you working on, Sup Forums?

Old thread:

Other urls found in this thread:

mathcentral.uregina.ca/qq/database/qq.02.06/jo1.html
stackoverflow.com/a/1860269/3105260
postgresql.org/docs/9.2/static/sql-copy.html
greasyfork.org/en/scripts/10096-general-url-cleaner
visualstudio.com/vs/cplusplus/
msdn.microsoft.com/en-us/commandline/wsl/install_guide
gcc.gnu.org/install/specific.html
tdm-gcc.tdragon.net/
twitter.com/NSFWRedditImage

Learning 6502.
Thank you for posting an anime image.

Made instructions smaller using new Jump Tables™ technology.

am I hacking yet

want a job?

Is it me or is lisp not scary.
I read C or C++ code and I feel scared by it, but lisp makes it feel childish in a way and is not scary.

I'm doing this:
|
|
V

sign me the fuck up my mom says I'm the next steve jobs

Is this a good place to find an open source project to help with? I'm having a hard time getting a job because I didn't take an internship while in college, and internships only seem to want current college students. I'm thinking I'll work on a portfolio but I don't have any striking ideas for a project.

Sorry if this is a stupid question.

Import the data to a db as it is right now first, then worry about moving it around. It'll be much easier than doing it mid-transition.

write a text editor
write a graphical user interface for a command line tool you use often
write a window manager
write a terminal emulator

there you go you have a strong starting portfolio

I've only been learning Java for 4 days now, but I came across an exercise I had some real trouble with.

>Create a program that calculates the sum 1+2+3+…+n where n is a number entered by the user.

System.out.print("Until what? ");
int userInput = Integer.parseInt(reader.nextLine());
int iteration = 0;
int sum = 0;

while (userInput > iteration) {
sum += iteration + 1;
iteration++;
System.out.println(sum);
}

This is how I solved it, but I'm not even sure why it works. I wrote out the mathematical operations it performs and it does what it's supposed to, but I don't know why. Why does that + 1 work when it's absent from the official solution?

I'm not sure how I can do what I want to do in SQL. I'd have to make the table in the format I want, then what? I guess I could insert into the table each column at a time for each tree id#, but I need to study up on some sql-fu

>not using recursion

Your iteration is always equal to 0. You never change it to anything. Substitute iteration in your code with 0 and you'll see why.

Read up on gauss. you don't need loops at all:

mathcentral.uregina.ca/qq/database/qq.02.06/jo1.html

ps if you can fix a few bugs in the linux kernel, HMs will be slobbing all over your nob in literally 14 seconds

m8...

I'm following a course guide, I'm sure it'll touch on that later.

But isn't iteration++ adding +1 on each iteration of the loop? 0+1 -> 1+1, 2+1, etc

This is wrong. He wrote iteration++

Do it on strings now if you don't know what's in the data.

Create a table with n string fields.

Export the data as csv. There's a script on stackoverflow.com/a/1860269/3105260 that you can use to help you with that.

Use COPY postgresql.org/docs/9.2/static/sql-copy.html to import it.

The +1 works because you have:
while (userInput > iteration)

and the official answer has

while(number

Fuck it, I'm going to sleep.

Thanks, thats good advice. But I still need to make their database look good. I need to make it... RELATIONAL

I hope you mean forever

every minute you're not practicing is another minute a pajeet takes another potential job from you

does php count?

That's the next step, yes. But it'll be easier to do inside your db, once you figure out what the data actually means.

Thanks for the advice.

These ideas all sound boring as fuck but I guess that's what I get for not getting an internship in college. At some point you just have to man up and do some stuff that is boring as fuck.

I'm offering my minimal java, c++, and python experience to anybody who wants it, though.

println(userInput * (userInput + 1) / 2 )

...

well what kind of ideas aren't boring in your opinion?

Lads I know C, C++, Java, Scala, Haskell, and JavaScript. What should I learn next?

Those are boring?
Man, once you learn how terminal emulators work you'll change that opinion.

Yeah I played around with that after reading:
I didn't know how involved math was with programming before starting to learn it. The purpose of the exercise was to make sure the reader understood += and counting iterations,

>Hint: Create the program using the while statement. Use a helper variable in your program to remember how many times the block has been executed. Use also another helper variable to store the sum. During each execution add the value of the helper variable that counts the executions to the variable in which you should collect the sum.

>lads
try again

Attack helicopters, I know C, C++, Java, Scala, Haskell, and JavaScript. What should I learn next?

Now something esoteric
Factor

brainfuck
6502 assembly

I suppose that's the problem with my viewpoint. If I had any ideas which weren't boring, I would be doing them, wouldn't I?

I imagine I'll have more fun in an actual job because I'll be working with a team and I'll be making money. It's hard to self-motivate, though. I'm sure I sound like a baby.

If you think that text editors are boring, you haven't used Vim.
If you think that window managers are boring, you haven't used a tiling one.
If you think that terminal emulators are boring, you don't know what these two words stand for.

Also there's

I wrote this userscript:
greasyfork.org/en/scripts/10096-general-url-cleaner

That many files visible.
Is your memory that bad?

Read from stdin, not argv.

Know what, I fucking give up on C++.

Its a dying language nobody fucking cares enough about to learn how to maintain it.

Tell me a new programming language that seems to have a bright future that I should learn.

Rust

Why is the c++ one wrong?

mate if you can't pick up the simplest programming language you won't be able to program with anything else

...

Idris

istream& operator>> (istream& is, signed char* s); gets called on int8_t a; std::cin >> a; which reads into a char. It doesn't parse the input as a number, just reads a char. Why? Because typedef signed char int8_t; in . int8_t is really a character type that just looks like an integer.

Im not dropping it because its hard, Im dropping it because the only way to develop on it is if you have Linux, and its use is pretty specific and inflexible.

If people can't fucking make developing for it work on Windows, why the fuck should I care about it?

A scripting language.

C++

Rust

visualstudio.com/vs/cplusplus/

???
C++ is one of the few languages that you can actually use on Windows.

google cygwin

>If people can't fucking make developing for it work on Windows, why the fuck should I care about it?

Lolno, it's the other way around. C/C++ are languages Windows is written in, they are system programming languages. It depends on the platform how a they behave. It's just that Microsoft and your operating systems are both terrible, and you should feel bad that you are paying so much for an OS that isn't even conformant to the first C standard.

poorfag here looking for a copy of extreme programming explained 2nd edition by Kent Beck. no luck so far :(

If you can't even do the simple task of setting up a C or C++ dev environment on Windows you're never gonna be able to learn to program.

wow

What you say doesn't mean shit unless you have clang working perfectly on windows.

If not, fuck off.
I want to learn a language not set up 2000 fucking libraries.

your check_prime() function isn't very comprehensive

sudo apt install build-essential

Wasn't mine

I have msvc, gcc and clang setup and working just fine.

What do you learn 6502 for?

Why not use this microsoft creation? msdn.microsoft.com/en-us/commandline/wsl/install_guide

GCC does not support windows.

Java, Python

>GCC does not support windows.
Yes it does.
gcc.gnu.org/install/specific.html

Why does every programming language apparently have a multitasking OS embedded in them?

Instead of making 1 program do everything well, people reinvent Linux in their languages and try to do threading inside them

I still remember when HTTP servers were actually a program that accepted connections and started ANOTHER program, feeding people's requests into it and serving its output as HTTP response

Today faggots do a bullshit HTTP.listen(port) oneliner "servers" in node and go as if that was even close to being as robust as a real server

>Why does every programming language apparently have a multitasking OS embedded in them?
They don't.
>I still remember when HTTP servers were actually a program that accepted connections and started ANOTHER program, feeding people's requests into it and serving its output as HTTP response
Too much overhead.
When you're serving millions of connections even a few bytes or a few extra cycles adds up.

>1 program do everything
How do you want to do everything without reimplementing Linux?

Looks interesting? Is it on GitHub™?

>Why does every programming language apparently have a multitasking OS embedded in them?

I wish. No OS is truly programmable in the same way a programming language is.

What I really want is a way to execute functions as if they were processes. No binaries or commands or any such bullshit. Just function calls. I'd write up a function that'd scrape some website for example, and it'd bring the information to me on a nice little window.

Why can't things be good dpt

Sift the Two's and Sift the Three's,
The Sieve of Eratosthenes.
When the multiples sublime,
The numbers that remain are Prime.

Not yet, though I'll give you a copy of the source if you want.

how do i choose pivot?

>What I really want is a way to execute functions as if they were processes.
>No binaries or commands or any such bullshit. Just function calls.
You'd have no persistent state and you'd have to reimplement everything from scratch every time (essentially write your own program-as-OS)

So you've made your way through the fodder, maybe you should get stuck into a decent language.

C#.

>You'd have no persistent state and you'd have to reimplement everything from scratch every time

... Why? Pretty sure functions can save files

Racket

C++.

Are you fucking retarded or something? Have you not heard of Visual C++ or something?

Who's in the wrong here?

Now this is autism

So these are the people bashing C and C++.

...

Download this:
tdm-gcc.tdragon.net/

This is why C++ needs a fucking byte datatype already.

>when people are more concerned with following "principles" and "practices" and doubling down on their OOPthink than writing good code

Literally all of that is possible. You're just retarded.

>byte datatype
unsigned char

You mean Lisp machines?

yeah that's some pathetic shit

especially if you are a hobbyist. you shouldn't give a flying fuck. the whole point is to do things differently/orignally

What would that fix in this situation? For uint8_t instead istream& operator>> (istream& is, unsigned char* s); would have been called.

It's not even about trying something new, it's about not writing worse code because it aligns more with what your Java professor or design pattern book told you.

why my front panel gets so dusty

$ cat main.cxx
#include

int main()
{
uint8_t x = 97;
std::cout