old thread What are you working on, Sup Forums?
/dpt/ - Daily Programming Thread
Other urls found in this thread:
en.wikipedia.org
en.wikipedia.org
en.wikipedia.org
collinoswalt.com
news.ycombinator.com
csapp.cs.cmu.edu
youtube.com
korbo.ga
korbo.ga
idris-lang.org
youtube.com
twitter.com
First for C++
>Trap OP
kys
Please stop posting anime in a tech discussion forum.
This is a family friendly site.
The first one obvs
Nice meme of fucking up the code tag
reposting because I'm a faggot who can't into formatting
Scenario: Users have IDs. I have a webservice with an endpoint that retrieves a user name by their ID.
>example.org\user\123\
response: {"name":"john doe"}
I want to add another endpoint, that adds a comment to the user profile with the specified id.
Which of the following would you prefer:
>example.org\user\123\comment\
body: {"comment":"hi"}
response: {"name":"john doe", "comments":{"0":"hi"}}
vs.
>example.org\user\comment\123
body: {"comment":"hi"}
response: {"name":"john doe", "comments":{"0":"hi"}}
Finishing my first android app. Very sloppy but I'm proud nonetheless. It's a simple cumulative GPA calculator. Wondering if it's okay to list it as a project for a summer internship.
m
y
p
o
s
t
i
s
n
'
t
spam
y
o
u
n
i
g
g
e
r
Stop posting this.
You have 5.69 seconds to tell me why you're not using Java right this moment.
Ask your much beloved programming literate anything (r/IAMA)
if it's so fast then why the java Vm runs like shit?
I have a best practices question: I have a function that takes parameters from previous runs of the function for efficiency. If it's being run for the first time, it will compute the parameters. How should this be formatted?
def function(arg=None):
if (!arg): //compute arg, rather costly
else: //save some time if arg is given
...
return Something
The question boils down to: can I save arg somehow for future runs of the function without returning it along with 'Something' or using pointers?
alright I'm not a programmer but I've been here for years and I've seen this picture thousands of times
somebody explain to me what this anime picture has to do with programming
(I know the book itself is a meme but why is there an upside-down anime girl)
her name is eva and she is spinning like how eval/apply is pictured in the sicp book
Can someone help me with this regular expression?
I want to find a all commas that exist somewhere in between quotation marks
I have something like this
(?
garbage collecting, they can use all the tricks in the world but garbage collecting will always make them chug doing anything real-time sensitive.
The book isn't really a meme user, its a pretty enjoyable read and useful for people just dipping their toes in the water with CS.
now allocate some objects inside the loop and only reference the previous iteration's object.
>eva
that's yuki nagato.
the fez on her head is a reference to en.wikipedia.org
the parenthesis surrounding her is both a reference to lisp and to eval/apply.
can you even edit text in cmd.exe?
can you even edit text in bash?
on 32-bit windows you can type edit and it opens an old super shitty cmdline editor.
On 64-bit they removed it because they couldn't figure out how to port it.
$quality$
Go to libgen.io and pirate the book 'The Unix Programming Environment' by Kernighan/Pike and check the chapter on filters it has all the regex you will ever need.
Well i'm trying to learn C++ (muh 210X courses) after C ( i'm still gonna call myself a beginner with an ok-ish understanding of pointers) and i still can't understand why i dislike C++ more and more.
Is it because OOP is cancer?
windows 32 bits has WoW to emulate 16 bits apps
windows 64 bits has WoW64 to emulate 32 bits apps
Porting the 16 bits emulator to win64 wasn't worth it.
en.wikipedia.org
en.wikipedia.org
>Is it because OOP is cancer?
yes
C++ is garbage.
C11 is what they should teach in university.
No. It's because you listened to memes that said one of the leading programming paradigms in existence is bad.
Sup Forums is literally the hipster of tech. Don't listen to the memes
If WoW64 was complete then it could run WoW and thus 16 bit apps.
windows is so shit
Well i've been trying to find any C11 book/documentation for learning for a while and can't find shit , not even on amazon.
Also, i know C++ is garbage, i just gave it a shot ( again) because it seems like most libraries out there are either in a shitty scripting language like python or other garbage or C++.In my opinion, i just took the least worst one.
no, the emulator is not just a simple user application but a whole environment involving the kernel like the new linux environment.
Rate my blog post Sup Forums
libgen.io has tons of modern C books.
This pdf book "Modern C" posted yesterday to HN, is exclusively in C11 news.ycombinator.com
please don't say that, it's actually a great os that had the same core interface since the beginning of the 80's. the source code of the kernel is a lot much better documented than linux or bsd, and doing multithreading on windows is not painful contrary to linux. dave cutler > torvalds.
Have a function that computes arg, and a function (or member of arg) that consumes arg. The caller should deal with that shit.
>Java
1/10 because the design is ok.
it's shit
> no scripts running on website
10/10 website
aren't you the 58000 (or something like that) bauds oldfag guy?
C11 is what they taught me in college.
>satan gave me good help
thanks
make rss feed pls desu
C primer plus is great
If it's an all encompassing 32bit environment then it should be able to host the 16bit WoW environment.
>click link
>instant loading
>no animation/whatever bullshit
11/10
>No spaces between parenthesis and braces
Maximum REEEE
In fact, this is how you learn C
>K&R
Is the best introduction.
>CS:APP
A book on amd64 so shows you how C is modelled in asm for pointers/structs ect. Also teaches you floating point, VMs, everything you need to know about systems programming (tip, go on Abe Books, get the cheap "international version") csapp.cs.cmu.edu
>21st Century C
Small book to show you how modern C programming is done, goes well with that 'Modern C' PDF I posted above.
>The Art of Software Security Assessment
Another vital book that teaches you the gotcha's of C and is worth it alone just for the information on building your own tests/assessment strategy.
Now go find an open source project used by millions of people, look up the features requested and ask the maintainers if you can implement one (ask because you don't want to write a program only for them to say 'we are dropping support for this in X). Submit your feature and accept the feedback, fix your program, then own that feature and debug any problems that arise. Congrats, you are now a C programmer.
Now go forth and look up "WebAssembly". Congrats, you're a web programmer too now.
C is truly still the most useful language you can ever learn even in (current year).
I lost my job in september.
the calls have stopped coming, the applications have stopped responding, and my last real prospect has been silent for almost a week.
I want to die
you need to read more about loaders, system calls, cpu mode, ...
You should be publishing apps with >100k download potential in the meantime to prove to future employers that you can stay employable.
Apply to toptal and be a simple wordpress developer or salesforce dev, pays $40/hr, good enough for in between jobs.
Or google 'weworkremotely' or 'jobspress' or look at hnhiring.me for a list of latest direct job offers, no bullshit recruiters.
>21st Century C
Terrible book. Must be avoided at any cost.
K&R: I've tried it several times, besides the fact that most compilers don't even work with the code in there ( yes you can tell me you can find workarounds but i don't wanna waste my time on stackoverflow)
21st century C & K&C: 21 century C is good for setting up an environment and eventually for using it as reference, since i'm still a noobie they don't have many exercises, same for K&R.They're good for references and i use them for that.
For what i know i'm still using C a modern approach (C99) just because it has many exercises which help me.
Not Java, but a pseudo-javascript because Java, C, and C++ can't into easy lambdas
600 baud modem:
github.com/collinoswalt/modem
Working on creating an actual physical modem using an arduino and Piezo element
rarely do i see a room messier than mine
>minecraft
huh, so that's why
good to see that you are still around, you actually did some stuffs contrary to 99% of the newfags here.
Maze generator in Go.
Gonna turn it into a little web app.
>youtube.com
would it be possible to hide the file into a playable song?
I've been doing a bit of web dev lately, but I'm making my way back to C. The blog post uses a pseudo-javascript because it's easier than writing all that extra stuff for function pointers or inline C functions, but I actually would implement this in C if I were to do something like this (I've had to write my own shell in my systems programming class and I used a similar method to map commands to functions in C)
Still getting the same error.
any other ideas?
I have no ideas
Perhaps a stereo song file with the hidden channel's amplitude turned way down? Your receiver would have to be able to differentiate between the two channels, which means you wouldn't be able to play it over analog channels (air), only through other digital channels. My algorithm makes no reference to the amplitude of the sample except for its sign.
Or, every nth sample is part of the hidden message, so that with a large enough n, the distortion would be inaudible to a human (but, once again, the noise could destroy the message, depending on the quality of the receiver. Digital channels are always best for something like this).
About to implement a LZW compression algorithm.
Quick question, it seems a central part of the algorithm is the ability to store numbers of 9-12 bits in size (256 - 2048), but I have no idea how to make integers of that size without going to the next-largest type (short or char_16), which would lead to some inefficiency. Any help?
Use a [spoiler] better language[/spoiler]
So I improved the physics further, now it's almost not completely useless
korbo.ga
korbo.ga
Do you think I should make a native imageboard viewer with a similar concept?
This. If a language doesn't support creating types of a certain sizes and packing them in arrays accordingly, it's honestly not very good.
I think you should optimize it a little. There's nothing worse than a website that makes your PC spin up its fans to the max.
Writing your own library that does this would be pretty easy in C. You have to write your own malloc using the linux system calls brk and sbrk, and then create a struct header which will keep track of where each bit/byte starts and ends. At worst, you'll have 7 unused bits in the heap
If you want any sort of speed you will want to use a uint16 or better yet a uint_fast16_t
I know but I'm planning to remove physics completely and precompute the graph with something like the Floyd–Warshall algorithm
Man, reading code from GNU is making my eyes bleed.
wtf stallman? Why write such shitty code?
How long did it take you to learn how to program? I've been trying off and on for a few years never really serious but I really want to learn how. I've been trying with C++, but always end up getting confused and frustrated.
He writes in K&R standard. Looks like:
char *
strtok (s, delim)
char *s;
const char *delim;
{
/*...*/
}
Which is how they wrote C in K&R, which is okay I guess since they invented the language, but nobody should program like that past 1989 when they codified C in ANSI
Also, strtok is a terrible function. gobbles up the original char * that you pass to it, so you have to pass it a buffer otherwise you'll lose your data. Then, it has a static char * inside the function, so calls to it go like:
char *k = "1,2,3,4,5";
char *p = malloc(9 * sizeof(char));
strcpy(p, k)
char *s = strtok(p, ",");
s = strtok(NULL, ",");
Wtf
You can write a library to do it in any system language, doesn't mean it's not a pain.
>C++
>confused and frustrated
Is this a reverse bait?
Of course it's not, but I'm saying that this is not a limitation of the language, but a limitation of the standard library. What you're not saying is "pick a language which can do this", you're saying "pick a language whose devs added this feature to the standard library". But this feature is language agnostic.
What is easy for you, is not so for me; nor anyone I know.
Has anyone done native windows programming using clang on windows?
What's the best way to deal with all the headers?
I don't seem to find anything that really helps me.
Since the definition of "knowing how to program" is so broad, all I can say is that at some point it should just click in your head. It's like blondes, brunettes, and redheads in The Matrix, at some point you'll get the basic stuff and at that point your achievements and success will only depend on your ambition and persistence.
Also, C++ is a bad starting language. Try Python. I started out with it, it paved a great path without much frustration in the beginning.
Learn Java, C#, or Python. C++ is a bitch to work with all its specifics, and even people here hate it because its syntax is a bit wonky due to having all these neat features piled on top of it over the years.
is that cirno, kek
I barely recognized her
The reason you're getting confused is probably because you're heading in too deep too fast.
Also the language doesn't have a nice consistency to it like many other languages. Templates and initializer lists being major offenders.
That's not even it. I actually kind of like that style honestly.
The issue is that the simpliest programs are split up into 50 different files. And those 50 different files link to 80 different header files each.
And then they do dumb shit like
#ifdef OPERATION_add
#define FUNCTION mpz_add
#define VARIATION
#endif
#ifdef OPERATION_sub
#define FUNCTION mpz_sub
#define VARIATION -
#endif
#ifndef FUNCTION
Error, need OPERATION_add or OPERATION_sub
#endif
void
FUNCTION (mpz_ptr w, mpz_srcptr u, mpz_srcptr v)
{
//code
That's a header file that gets linked by two (and only two) functions. They could have just copied and pasted the function. But noooo. They had to use preprocessor statements.
Also as far as I can tell, they don't undefine the variables.
Thank you for the advice, I'll try Python then.
Every feature is language agnostic by that logic. It's not a "feature" if you have to literally write it yourself.
printf is not a language feature by that logic. C can hardly do anything without a standard library.
If it's in the standard library, for the c standard language, then it's part of c.
So.. When do you use std::allocator?
Doesn't really seem to do anything.
Standard vs external library is different.
You can do tons of stuff in C regardless. It's just a lot of work to manually generate system calls.
You're looking into the mind of autism. It's not a pretty sight.
>started with python and it paved a great path
Where are you now?
>Why write such shitty code?
youtube.com
I'm going to start trying to build a bit torrent client.
i think i know how it works enough to start creating it piece by piece so basically a magnet link has different uris -
one that is the files hash
one that points to a tracker
one that tells the size ofthe file
the tracker will the supply the client wit hteh seeders/addresses of that particular file hash and teh client will begin requesting bits of the file from the seeders?
Do you know how dht works? Seems like magic to me.
Someone needs to create a C compiler with an oss non-gnu license like MIT or BSD so that we can dump this autist. GNU is using its position in the Linux community to deliberately sabotage progress