/dpt/ - Daily Programming Thread

old thread: What are you working on, Sup Forums?

Other urls found in this thread:

ossu.firebaseapp.com/#/
en.wikipedia.org/wiki/L-system
regex101.com/
docs.oracle.com/javase/tutorial/
twitter.com/SFWRedditGifs

Still working with NixOS, it is still so enchanting. I pity maintainers in non-nix based distributions SO INTENSELY!

That's weird at first: to build a package, you have to evaluate an expression in the Nix language - hence it's programming -. This gives you a derivation, the self-contained instructions for performing a build. Then everything moves to a sealed build environment, compilation occurs there, and you get a symlink back. Results that aren't linked can be garbage-collected, just like in every decent programming language. Also it's non-strict.

Just for fun, I let many revisions of a derivation compile in parallel (their results can coexist, which is such an essential need), and I noticed something weird and cool: when two processes have a common dependency, the first one to get to building it puts a lock to signal that fact, and the other simply waits on it! That's just such a proof of good design, such a shining example of how using good theory leads to good programs...

No really: TRY NIXOS ANONS.

I've been sucking a lot of cock lately.

t. web developer

>static typing means good type safety
haha

Still working with NixOS, it is still so enchanting. I pity maintainers in non-nix based distributions SO INTENSELY!

That's weird at first: to build a package, you have to evaluate an expression in the Nix language - hence it's programming -. This gives you a derivation, the self-contained instructions for performing a build. Then everything moves to a sealed build environment, compilation occurs there, and you get a symlink back. Results that aren't linked can be garbage-collected, just like in every decent programming language. Also it's non-strict.

Just for fun, I let many revisions of a derivation compile in parallel (their results can coexist, which is such an essential need), and I noticed something weird and cool: when two processes have a common dependency, the first one to get to building it puts a lock to signal that fact, and the other simply waits on it! That's just such a proof of good design, such a shining example of how using good theory leads to good programs...

No really: TRY NIXOS ANONS.

putting it in green text and mocking it doesn't make it any less true, faggot

>What are you working on, Sup Forums?
Being a noob and working my way through the first chapters of C++ for Everyone (2nd Edition).

This programming stuff is quite engrossing.
I've heard that it's customary to wear pretty socks though (such as how it's custom to start off with "Hello World"), unfortunately I don't have any ;_;

Static typing is not a sufficient condition for good type safety.

It's sufficient enough.

Did I triforce right guys?

import turtle

def L_system(rules, prev_str):
next_str = ""

for i in range(len(prev_str)):

for rule in rules:
if (prev_str[i] == rule[0]):
next_str += rule[1]

return next_str

def L_system_run(n):

turtle.speed(0)

rules = ([
#variables:
['A', "+B-A-B+"],
['B', "-A+B+A-"],

#constants:
['+', "+"],
['-', "-"]
])

s = "A" #axiom
for i in range(n):
s = L_system(rules, s)
print(s)

return s

def L_system_draw(string):

dist = 2
angle = 60

for character in string:
if (character == "A" or character == "B"):
turtle.forward(dist)
elif (character == "+"):
turtle.left(angle)
elif (character == "-"):
turtle.right(angle)

L_system_draw(L_system_run(7))

One guy who works for Nordeus said to me that Java is bad and not worth learning and that C++ is a lot faster and better than Java. He said that Java is basically stupid man's C++.

When I tried it before it lacked decoupling between packages and optional runtime dependencies. You could disable optional dependencies, but this would lead to a different package hash negating the use of prebuilt binaries.

Therefore, the culture seems to have all default package builds with all optional dependencies on. This leads to situations such as installing mutt and getting python too! (mutt -> gpgme -> glib -> python)

Last time I checked, if you installed git, you'd also get subversion, etc. Did they change this ?

>C has good type safety
>Java has good type safety

>mocking people for their sex
Why do you have to be sexist?
There's literally nothing wrong with women in tech.

heteronormative scum

Sounds accurate.
Why would you move to a platform that's less portable (Java) while gaining nothing but a garbage collector?
Because you can't deal with memory. Which isn't hard at all. Which would make you stupid.

Java or C++/C#, which is more used in businesses or larger companies?

Java, but C++ is used for more important things.

>while gaining nothing but a garbage collector?

You could always use Boehm's GC and stay with C. :^)

Working on implementing a trie dictionary for this class I'm in.

Got it to work but I'm having a logical error with node creation or node access. I've pretty much resigned to rewriting it using the old code as a reference to see if i can root out the error.

#include

int main(){

int e = 5, f;
f = ++e + ++e + ++e + ++e + ++e + ++e + ++e + ++e + ++e + ++e + ++e + ++e;

printf("%d\n", f);

return 0;

}


How much is f?

My only programming experience is with ti84 BASIC. How do I learn C++ or what should I learn?

US dollar or pound sterling?

it's 139 faggot

very nice dude

If you think memory is the only thing Java solves in terms of C++ then frankly you're retarded.

Iranian Rial.

$ valgrind /usr/bin/java


JUST

int i = 1;
++i++;
fprintf(stdout, "%d", *(int *)&i);
// -> ???

99% of programmers will get this wrong!

What else, then? Keep in mind that C++ has gained tons of useful features in the last few updates, whereas Java has gotten barely anything.

Is C# even used at all? They're teaching it us in school.

I enjoy C quite a bit. What do C programmers get hired for now a days?

yeah, by microsoft slaves

Not as much as Java, but if you know one you basically know the other.

error: lvalue required as increment operand

CAN WE LITERALLY FUCKING BAN THEM ALL

>tfw your android application has 3 installs including yourself

Yes in industry. It will replace Java soon.

C programmers don't get hired.
Nobody writes new projects in C anymore.

What is it?

My purely type-based termination scheme works painlessly for recursion, corecursion, a mix of the two, as well as (co)inductive-(co)recursive definitions. As far as I can tell, it's also sound, as it's fundamentally based on the technique described in "Type-Based Termination, Inflationary Fixed-Points, and Mixed Inductive-Coinductive Types", just with a sexier presentation.
www2.tcs.ifi.lmu.de/~abel/talkFICS2012.pdf

Now, to implement it.

shit

how does java not have good type safety?

Forever a Linux developer?

>Java is basically stupid man's C++.
but that's why you learn java first, and then C++ will be a piece of cake.

feature creep is one of the things that java solves

Yes, git still does unfortunately depend on subversion rn. (Nix over ArchLinux here). Sucks. We'll see how it evolves. In the worst case scenario I'll end up using Nix over some other distro for fresh software maybe...

Because almost fucking everything can be null.

Yeah, there's Optional, but that has runtime overhead and is a pain in the ass to use because >no ADTs.

More features =/= feature creep. Not that C++ doesn't have feature creep, but that's being dealt with through the Core Guidelines. Whereas Java just doesn't have many features at all.

Most of the companies here are hiring for C languages though. Or web development, but fuck that.

So only the syntax is slightly different, or what are the major differences, since I can't imagine it's the same as c++ and c#.

Okay.

Which database programs should I use? They started us with MSaccess, and now we're at MySQL, are these two used or should I drop them in favour of different?

Mostly the syntax that's different, yeah.

What's the best resource to learn C# in my case ?

I have experience in Python but it's only pure scientific knowledge (I've designed mathematical and physical models for college, that's all), and all C# books I've come across seem to be either intended for experienced programmers or total shit.

>MSaccess
Forget about it.

>MySQL
Yes. It's OK.

Is Visual Basic 6.0 worth learning. I never programmed before and I've heard VB 6 is pretty easy and you can program games using DirectX. I'm interested in writing pong, tetris, arkanoid, pac man clones etc just for the lulz.

Which is better

Extensive pseudo code modeling or
write rewrite until it works?

Instead of using an obsolete language just learn Python, it's as simple and yet useful and you can use PyGame, PySDL or Python SFML for such games just fine.

How are you gonna know your pseudocode is correct without turning it into real code and running it? Or, if you're fine with desk checking, why does it have to be in pseudocode?

Trial and error all the way

my high melanin friend

Terrible choice in friends

See , sorry

git vs svn

which is the best?

Is 21 too late to get into programming? It seems like everyone started in their mid teens

way too late

;_;
Does a little knowledge of BASIC help?

I'm 28 just started a few months ago. Some concepts don't click as fast but as you get older you become more tenacious.

ossu.firebaseapp.com/#/

A good free trail of courses. I'm still in the first class though.

Just do it faggot.

thank you!
Wikipedia has a good starting article on L-systems.
en.wikipedia.org/wiki/L-system

if you do
from turtle import *

you only need to
for character in string:
if (character == "A" or character == "B"):
fd(dist)
elif (character == "+"):
lt(angle)
elif (character == "-"):
rt(angle)


without all those verbose stuff (turlte.forward, turtle.right...)

Bullshit

Depends how adept you are. If you can pick it up quickly you can sail past more experienced programmers in no time.

How long would it take to transition from C# to Java?
Any better program for databases than MySQL?

what's a good language to learn for a beginner. I don't have any ambitions of being the next great indy game dev or stuff like that, but I just want to learn how to make my computer do... stuff.

Maybe MariaDB which is the successor of MySQL. You have Oracle too which is free and faster than MySQL, but Oracle doc sucks.

Start with C, a simple text editor and the gcc.

So I'm learning a little about regular expressions...

And I'm having trouble making a regex that matches everything after "foo" (minus the space) for all of the following:
foo baz 42
foo baz42
foo 42

something like this works for the last two, but not the first one
(baz)?[\d]

I would expect something like this to work, but it doesn't work on any of them.
(baz)?^( )?[\d]

any suggestions?

regex101.com/

it's not too late at all but ideally you should have at least above-average intelligence

>what's a good language to learn for a beginner

>inb4 C

It's not an easy question to answer, because everyone is different. This is my take on the question

Python: easy on beginners, batteries included
C: will teach you low level hackery, but the community is full of pompous assholes and freetards.
Scheme/Lisp: changes the way you think about programming. Scheme it's basically the most pure language out there, and has a minimalistic syntax which could help a beginner.

x86 assembly

docs.oracle.com/javase/tutorial/

seriously... check it out. don't listen to the memers

foo\s+(.*)

ah, yes. That would solve it.
Sorry though, I had meant for 'foo' to be absolutely anything. And that I was specifically trying to match that last portion.

Jesus christ you cunts stop recommending your shitty fucking languages you autists

^\S+\s+(.*)$

shut the fuck up faggot

>Jesus christ you cunts stop recommending your shitty fucking languages you autists

Let's hear your proposal.

C or C++

Are you the Java indian or the Python teenager?

unsigned int i;
unsigned int j;

j & (i != 0U)

vs

j & !!i

vs

j & (bool) i

Retards will oppose this

Starting an internship with a company that builds Ember apps, so I'm practicing with my own little Ember project.

C++ is ok but i recommend the java -> C++ route, see

>Are you the Java indian or the Python teenager?

No. i'm the guy making 86K a year writing 3 hours of java code 3 times a week.

C, retarded language with retarded semantics, cripples your mind.

C++, basically a political kitchen sink of a language made to fix C shortcomings while mantaining backwards compatibility.

I'd say Python is best for a beginner. It's easy and has ton of libraries.

There are absolutely no good reasons to start with Java and then go into C++.

If you want someone to do Java for the shitty bigwig software industry, might as well start with a language that won't ruin you for life

Python ruins you for life

>Python ruins you for life
>pseudo-code ruins your life
why

Permanent bad habits

The fact you've recommended Python as a beginner language is evidence of permanent scarring

How do gaymen engines like the CryEngine, and Unreal engine render 3D models at such a large scope with proper optimization? Like for a cityscape?

>Python ruins you for life

Well I started with C and I could say the same thing.
You always try to think in your first language. Sometimes I just couldn't see an obvious solution because it didn't fit in my mental model of computing based on C.

>Permanent bad habits
i write algorithms in python much faster than in C or C++.

i like python to prototype things

C doesn't ruin you for life and you don't always think in terms of your first language

You want a language that covers many of the bases without it being one that recommends it holds your hand, and also one that encourages good style & code

>I write algorithms much faster
Literal evidence of bad habits

instancing