/dpt/ - Daily Programming Thread

What are you working on, Jow Forums?

Previous thread:

Attached: DkQEwYbX0AogdaN.jpg large.jpg (639x600, 95K)

Other urls found in this thread:

chrisstucchio.com/pubs/slides/loans_for_ladies.pdf?utm_medium=rss&utm_source=chris_blog&utm_campaign=merged_rss
paste.ofcode.org/75Spr4Tede44mQ9UuDVH44
github.com/02sh/mkdir-sort):
queue.acm.org/detail.cfm?id=3212479
twitter.com/AnonBabble

Attached: 1533189188905.png (1294x3510, 866K)

Attached: He's_right_you_know.jpg (800x598, 72K)

Export worksheets into SQL (SQL Server, Oracle, MySQL, etc).
Delete all rows without specific acronym.
Import back from SQL into worksheets.

chrisstucchio.com/pubs/slides/loans_for_ladies.pdf?utm_medium=rss&utm_source=chris_blog&utm_campaign=merged_rss

It’s mathematically impossible for the deepest neural network built by the most diverse team of data scientists to satisfy all definitions of fairness.

People at Google/Microsoft writing papers on this topic have made one choice, which I’m calling San Francisco Ethics. Is their choice right for India?

Too bad his language died

this is not a problem that can be fixed with new changes.
c is just stuck with this issue forever.

Just man up and pass the array size as a distinct parameter

what happens if I want to return an array from a function

C tards don't return arrays. kek

>Stack frame unallocated
>return auto array

cniles can only dream of safely returning an actual array like a normal person.

Just return a struct containing:
* your array (pointer)
* the size of your array

>safely returning an actual array
In reality world, pointers are used for this purpose. In your langauge (java or C#), this is what you compiler is doing for you. Look up garbage collection, or you know, just give a shit enough to learn.

You return a pointer + size.

>reinventing fat arrays
classic C tard

pointers are not safe, and i don't want to do cast bullshit when using UFCS.

>expecting a low-level language to do your homework for you
I bet your CoC lacks a paragraph about "not being an idiot"

>what is malloc

>dude just create a new struct for every datatype lmao
I have no idea how cniles think they're better than gotards. Even go has typed slices.

>C
>Low level language
What did the autist try to mean by this?

Attached: 834cda80110b43161de14cdc831a7dba.jpg (619x800, 48K)

>pointers aren't safe to use, because I'm a brainlet
FTFY.

>what is answering a question

>I'm a perfect programmer and never make mistakes ever!
whatever you say m8, returning actual arrays are nice.
Fucking with pointer coercing is shit.

C doesn't have multiple return.

>returning actual arrays are nice.
Practice makes perfect. Again, in reality world, we use pointers for that.

have fun using niceties like UFCS, then again few languages actually have it.

File A contains over 5 million lines.
File B contains 500k lines.

I need to check if any File B lines exist in File A lines. What's the fastest way to do this via Python?

UFCS is trash

>using turtle

t. fox

anyone have some resources for learning c#? im going through a book but it doesnt have examples or exercises. please help guys

put all file B lines in a dictionary then iterate over all file A lines to see if they match? idk

Use a hash map.

It's barely even an issue when you use pointers for everything anyway.

Also an array of function pointers.

thanks will try

It's more convenient at the moment

But was that software free as in freedom?

Is there ever a reason to use getopt over getopt_long?

>returning anything other an a return/error code

Pathetic.

>never doing more than fizzbuzz
Pathetic.

Don't mind me, just posting the best license
Copyright (c) 2015-present Lerna Contributors

The following license shall not be granted to the following entities or any
subsidiary thereof due to their collaboration with US Immigration and Customs
Enforcement ("ICE"):

- "Microsoft Corporation"
- "Palantir Technologies"
- "Amazon.com, Inc."
- "Northeastern University"
- "Ernst & Young"
- "Thomson Reuters"
- "Motorola Solutions"
- "Deloitte Consulting LLP"
- "Johns Hopkins University"
- "Dell Inc"
- "Xerox Corporation"
- "Canon Inc"
- "Vermont State Colleges"
- "Charter Communications"
- "LinkedIn Corporation"
- "United Parcel Service Co"

MIT License

Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:

The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

help a brother out guys

>not using monadic error handling

>error codes
what fucking century are we in?
Error codes are fucking horrendous.

Add jews to the list and we're golden

so, long $MSFT ?

fastest would probably be loading entire file A into memory as a set then looping through file B's lines and checking them against that set, but I'm assuming you don't have that amount of memory availiable

>prison
>dominiation and degradation

I don't get it, you are set for your live, never have to work again and get free food. People who think prisons are punishment have never really paid attention to the life they are living.

That's terribly inefficient.

enjoy your gay rape

posix or c11 threads?

memory-wise sure, but user asked for the fastest way, and I can't think of anything faster in python than matching against a set

You'll get used to it.

does this even actually matter

seems extremely stupid

Your only three sensible options for error handling when writing a C library are: lugging around a pointer to some thread-safe errno equivalent, lugging around an error callback function, or returning error code; the latter is the most universal and clearest of the three.

Attached: error.png (1268x708, 127K)

Call center is probably the worst job out there. I don't get how it's supposed to apply to every other workplace.

>writing a C library
stop using C

paste.ofcode.org/75Spr4Tede44mQ9UuDVH44

How's my python? I don't use it often and when I do it's mostly write-and-forget. Anyway I'm now starting to work on a large prototype and actually need to care about code quality.

>What are you working
this sorting algorithm (github.com/02sh/mkdir-sort):
#!/bin/bash
function f() {
echo $(eval printf 'g/%.0s' {1.."$1"})"$1" | xargs mkdir -p
}
while [ -n "$1" ]
do
f "$1"
shift
done

find . -type d | sed 's#.*/##' | grep -v g

exemple usage (in a new empty folder):
./mkdirsort.sh 9 2 7 4 6

Attached: 1533354471579.png (245x261, 103K)

Yeah, it's probably better to write libraries in java.

Uh, ever heard of a hash map? Have you ever tried loading an entire file into memory? It takes a while, even in C.

Jamie King on youtube

So I'm doing Bjarne's C++ tutorial and I'm currently dealing with the graphical interface. Is it common practice to create your own constructs based on a library (in this case FLTK) or is it more accepted to access the library's functions directly?

>hash map
Uh, how do you think the python set is implemented?

Autism license.

Uh, how does that relate to loading 5 million line file into memory instead of just using hashs of a 500k line file?

really depends, I've done both in C++. In SDL I tend to want to wrap them but with glfw + OpenGL I've never bothered

pass around a pointer to a struct containing a struct jump_buf and make your own exceptions lmao

You were talking about using a hash map, and the python's set is exactly that; a hash map. You gotta accomodate for hash collisions in some way, so the keys are getting stored in memory anyways, not just the hashes, unless you have some special implementation that does this some other way.

>do fizzbuzz with modulo
Pathetic.

>You gotta accomodate for hash collisions in some way
Linked list, with an extra int index.

>so the keys are getting stored in memory anyways
Yes, which is much less than storing 5 million lines in memory.

Stop digging yourself further down your retarded trench

I don't understand your point.

>Yes, which is much less than storing 5 million lines in memory.
The keys are the lines, retard.

Not if you use the position in the map as the keys, retard.

Your indention in Line 7 is strange. There are a bunch of "import as" 3rd-party libraries with a default name.
import numpy as np
import matplotlib pyplot as plt
...
import xml.etree.ElementTree as ET
Use them

So I suppose it's fine since I haven't gotten brutally flamed yet (or its case of "fuck you I'm not clicking any of your goddamn link". Sorry code tags gave me a connect error).
To reiterate I never read other people's python code and I'm unfamiliar with the idiomatic style. I feel there are few bits there I feel are suspect, primarily using list indices like some kind of an ad hoc struct.

Yeah, and in that position all the keys that map to that position are stored. Have you ever implemented a hash map?

>it works in the kernel and it's not considered a low level language.

Jesus Christ what language is low level if that isn't? A ton of languages operate at the application level for god sakes.

Thanks will do. And yeah the formatting is non-standard since I've been lazy updating my vim config.. Idk whats fucky with the first comment though.

>creators specifically said they needed a HIGH LEVEL language
>NO C IS LOW LEVEL THAT WAS JUST THE 80s
????

post a screenshot of code you wrote

here's mine

Attached: scrot.png (1920x1080, 186K)

hi
for python gui dev try appjar
it's very nice
that is all

I'm a novice programmer trying to write a CHIP8 interpreter in C.
The interpreter part appears to be working fine fine, but I don't really know how to display the graphics and read the key inputs. All I'd like is to create a window, use it to display the output of the game (which is currently just a 2D array of boolean values), and read keyboard inputs.
What library do I need to be able to do this?

SDL. or learn raw X11.

I have an interview at Microsoft in three weeks. What do I do in that time to make sure I ace the interview?

Attached: 1535350288943.gif (320x236, 2.93M)

queue.acm.org/detail.cfm?id=3212479

If you want to be so basic read up on gui's and api's.

Basically you have no direct access to your hardware. All goes trough the OS.

travel to India and learn a few words to use in your interview. You'll 100% get the job.

>Jesus Christ what language is low level if that isn't?
a low level programming language is a programming language specific to a computer architecture.

not same poster. c isn't oop and is closer to the processor than interpreted languages.

C is deliberately architecture-agnostic.

C was the first high-level langauge to be, pratically, ubiquitously portable. Is this what is meant by high-level.

>what is endianness?

>C was the first high-level langauge to be, pratically, ubiquitously portable. Is this what is meant by high-level.

lisp, fortran, algol, ml, pascal, clu, cpl, ... they all predates C.

Attached: sure anon.png (390x379, 249K)

>pratically, ubiquitously portable
And none were as portable as C. kys.

An example of one of the ways in which C is not particularly tied to any particular platform. Unless you're doing pointer casting and bit fiddling (which would probably be UB any way), C programs will continue to work regardless of your platform's endianness.

irrelevant if you are programming in conforming C

C libraries make the best "portable" libraries because you can easily write a wrapper around them for any other language.

C is low level in that it can be used to write platform-dependent code.
C is high level in that it can be used to write platform-dependent code on any platform.

>any language with version() is low level
amazing

the language remains the same whatever the platform while you can't write a program in x86 assembly for ARM.