/dpt/ - Daily Programming Thread

Old thread: What are you working on Sup Forums?

Other urls found in this thread:

pages.cs.wisc.edu/~beechung/ref/gcc-intro.html
lmgtfy.com/?q=gnu ld
en.cppreference.com/w/cpp/language/lambda
twitter.com/NSFWRedditVideo

Reminder

Stop using C#

It's comfy and feature rich. it also has a very large library of extensions.

Memory is disposable now so it doesn't matter. Even then, it doesn't really take much more than emacs.

...

Why the hell did you copy the java logo onto a picture of some random person?
Is that supposed to prove something?
Is that somehow supposed to make Java not shit?

>comfy and feature rich. it also has a very large library of extensions
emacs and vim even more so

>Memory is disposable now so it doesn't matter
Well shit, I guess "advanced" editors all slowing to a crawl on some of my projects is just my fucking imagination eh?

I'm working on a runtime editable RPG engine that translates its map's events to native code.
Guess the language.

>inb4 go to

Sup Forums shitposters think we're attracted to 3D.

Java is the best language. Wouldn't expect a lightweight like you to understand.

stop using POO

>Guess the language.
You're just trying to get (You)s.
It's probably Haskell or something.

I use emacs for python, C++, Lua and other stuff.

Atom is handy for Electron for which emacs has poor/patchy support.

>Needing different text editors for different languages
Are you stupid?
Why the hell do people do this?

It's because I tried different editors and found that emacs is best for my workflow in certain languages, but lacks correct syntax highlighting and autocompletion for javascript, it also can't display directory trees as handily as Atom. It's really that simple.

Knowing emacs users there sure is a plugin for better javascript autocompletion and highlighting.

There is, but it can't handle jsx and its html-like elements, it also fucks up indents.

What is the most reliable way of getting a global IP address? I tried checkip.dyndns.com, but it isn't reliable

>getting a global IP address
What do you even mean by this?
Whose IP address are you talking about?

He's probably talking about his external IP address rather than local.

My global IP address

I just got this job and everyone here thinks I'm that stupid guy who gets shit done fast

How long do you think I've got before I'm fired

Why does your program need to know this?
Though, I can't really think of anything better than checkip.dyndns.com or something similar.

I'm writing a peer to peer protocol (decentralized tv system)

How are the peers going to discover each other?

>I'm that stupid guy who gets shit done fast
what's wrong with this?

I look like I'm retarded and/or not paying attention to shit. I don't want to look unqualified

but you get shit done, fast at that. your job is secure, my friend.

My information (IP, port) is created and signed with my private key, and is served on request (probably requesting it in bulk, but request it individually if we don't have it).

I got shit done at my last job and they still fired me, and when I was there I looked smart

So, similar to a bittorrent tracker, which is just going to return a list of peers?
Then that means that the clients don't even need to know their global IP addresses. The tracker will get it when the clients register with it.

The peer information should be signed by the owner of the key for security reasons (Bitcoin wallet is tied to peer information, public key is used for encryption to the client, etc.)

Working on a text-based adventure game.

Really cool and interesting project thanks for sharing it you totally didn't waste my fucking time fuck off and kill yourself you stupid worthless codemonkey

Lewd!

source code?

Post source code. Not going to give you any comments/criticism if you keep it proprietary!

>C
>not Ruby
ya dun goofed m8

keep up the good work m8

Where are you going to get the public key, though?

I avidly code python, But by no means would I call it "high tier"...

its good for rapid development, but ungodly slow on computationally intensive operations

>C
>not Ruby
>ya dun goofed m8
Your stupid. shut up.
>What do you do?
Expose boipussy

nice

Public keys are sent in the same way, except they aren't encrypted. Sockets can be created without encryption or with SSL and work like normal

How does that even add security, then?

b-but Ruby is more girlish

Close, but no. It's Common Lisp. Haskell can't handle writing map's text files that are actually the code that builds it, nor editing its functions JIT. A dynamic scripting language could, but they're not compiled to native-code (which makes them slow).

I tried writing it in a functional style but it exploded in my face.

SSL is for privacy concerns for encryption public keys

Encrypting the information with the node's public key, not only adds privacy, but validates the Bitcoin address associated with the network peer (if the key used to sign the peer is false, it would receive gibberish and not respond).

SSL doesn't allow the Bitcoin address validation (unless keys are derived from the peer keys)

Thanks!

In due time.

I'll post it when I'm done.

What's lewd about programming?

Hey, hey! We're all having fun here!

After running through a lot of hoops, I can finally compile for old Mac OS under Linux. But of course, Linux doesn't give a shit about resource forks so I've got data fork and resource fork separated. What the fuck should I do about this? I've got an HFS floppy to copy it to, is there a Linux util I can use to add the resource fork I have separated to the data fork or am I fucked?

This seems rather empty.

currently working on a small Go program to essentially "watch" my home network's public IP and if it changes (modem reboot or something) it will update the associated AWS route53 DNS record I have for it
not that this is too much of an issue with residential networks anymore, but it's a semi-interesting small project I can do in a week or two

How do I stop codeblocks from crashing every three minutes?
It's becoming a pretty big entry barrier for me as I've just started learning c++

Use something else.

vim + make + gdb

Just try a different IDE, they're all the same for beginners. Try Eclipse. It's not great, but it works. Or if you're on Windows just use Visual Studio Express or whatever the hell it's called now.

gcc + nano + valgrind + make + git

you don't need anything else

I've got both GVim and vim and I know i've got GCC in Xterm, but how do I compile and execute what I've made

pages.cs.wisc.edu/~beechung/ref/gcc-intro.html

But don't listen to them, use a real IDE. There's no reason to mess with tedious shit just for street cred. I mean the IDE is just performing the gcc commands in the background for you.

For the simplest stuff:
$ vim do_stuff.c
# edit file...
$ make do_stuff
$ ./do_stuff

????????

>comfy
>feature rich
>very large library
>disposable memory

Holy shit shills out in full force with their buzzwords, normal people don't talk like jewish salesmen

Ok I've got it sorted, and I've gone some ways to doing some simple 2 integer calculation program but when i go to enter a number to select the next portion it must be calling all the different function menus because it returns
addition menu
subtraction menu
multiplication menu
division menu

is this because I didnt put the right rules in?
int selection1()
{
cout a;
return a;
}
int additionmenu1()
{
cout

gcc -o myexecutable testfile.c

the '-o' stands for 'output'. Immediately after output, you put what you want the output to be.

If you have multiple .c files, you'll need to compile them first, like so:

gcc -c -o test1.o test1.c
gcc -c -o test2.o test2.c

the '-c' compiler flag allows the compiler to compile your file without needing a 'main' function.

after you compile, link like this:

gcc -o myexecutable test1.o test2.o main.c

clang++ -o program program.cpp

you'll pick up the rest of the flags as you learn

You're calling selection1() and not doing anything with the value.

Your if statements are not doing what you want them to be doing.

>after you compile, link like this:
>
>gcc -o myexecutable test1.o test2.o main.c
No, link explicitly using ld, fucking pajeet.

>tfw too dumb for Rust

Bill Gates is the best programmer of all time. Windows Operating System cannot be beat

China #1, America sux!

...

It's a bait image don't fall for it

Never heard of ld before. Tried it out, didn't work.

Everything is exactly backward, except POO tier is accurate, and idk about Go.

Good Christ dude.

lmgtfy.com/?q=gnu ld

Currently working through Jonesforth with the intention to bind to OpenGL and friends as C is a pain to work in.

The current implementation uses threaded code but will implement a non-interactive compile mode where threading is discarded and code formatted to procedures/inlined to improve speed since code size isn't really an issue on modern platforms (plus I already have a threaded base for the compiler).

Thanks bro, I tried it out on a project of mine and keep getting errors. I've known about it for 5 minutes and I'm fucking tired, go fuck yourself.

just use clang/gcc -o program program.? for now and deal with ld if you need to deal with asm

Get some sleep and read about it in the morning. Do just ask why it doesn't work just like GCC.

When you call gcc it calls ld, ld is the linker. Just like gcc doesn't immediately generate binaries, it generates assembly and then calls 'as' to assemble the program.

also what is man ld? Use the man pages... they exist for a reason

>gcc requires you to specify all your files in one command
>Ada just needs the main file, because you obviously just want to compile everything
Bravo?

Just got back from an intro to cs practice exam

pretty irritated, all of the exams (about 55% of the grade) are on paper and are just composed of exercises from the book that you have to do ON PAPER. Like it says "write a program on this sheet of paper that does x".

Why the fuck is this a thing? It's not supposed to be pseudocode, you're supposed to meticulously write out all the brackets, semicolons etc. and it needs to compile and act flawlessly on your first try of just writing out a program linearly, which is now how you develop programs. Fuck I mad

Until codebase and build times get fuck huge, then C's compilation method with a makefile system is superior.

no, make can handle projects of arbitrary size

99% of projects that use automake and similar don't need it at all

[spoiler] it's a make system but it's hidden from the user, until you use a gprbuild [/spoiler]

Cry more

>99% of projects that use automake and similar don't need it at all
Of course. Autotools is shit. Cmake is better, but people tend to overuse it in the same way.

That's how it was at my school. Sounds pretty standard, friendo.

Why is that too much for you? Writing correct programs is easy when it comes to paper and I'm guessing it's not over 500 loc so shouldn't be a problem.

I usually write out my programs on paper before typing them up anyway as it forces careful design rather than programming in the interpreter/text editor and checking if it compiles.

i saw that shit too, don't know why they do it.

alright, ld is on my TODO

Good now go learn forth and you'll be set to do anything

Interesting point is that gprbuild uses Ada syntax, whereas make uses weirdo scripting syntax.

They do it because they're a school and they're teaching you concepts.

They're not going to coddle you with expensive tools and they're not going to make their job harder just to make you happy. You're not in high school anymore and you're not a customer, you're a student. Yes, it's awkward. Deal with it.

this is how you learn problem solving and logic properly

also git gud

Learning C++ from Python.
Can you assign a function to a variable in C++?

C (and thus C++) has function pointers, but if you're using C++ I recommend taking advantage of Object Oriented design and using abstract classes.

en.cppreference.com/w/cpp/language/lambda

What the fuck does that even mean?

For example if you wanted to create a sort algorithm that allows for custom comparisons. You'd pass it the list of objects to sort as well as a function for it to call that defines how to compare two objects.

>Can you assign a function to a variable
I am not sure how else can I explain this

Will do thanks

what programming language do nekos like?