/dpt/ — Daily Programming Thread

Previous: What are you working on, Jow Forums?

Attached: vlcsnap-2018-04-08-02h56m56s827.png (1512x1072, 1.4M)

Other urls found in this thread:

developer.mozilla.org/en-US/docs/Learn/HTML/Forms/Sending_forms_through_JavaScript#Dealing_with_binary_data
twitter.com/SFWRedditImages

Nice thread. Reading C# proposals.

Nothing, enjoying being in N.E.E.T. special forces.

post a snippet of what you're working on RIGHT NOW or bad things will happen.

>C#
Obsolete

Something for the mood

Attached: 1526307770426.png (1920x1080, 1.03M)

Aww. Don't be like that

Attached: 65c.jpg (738x960, 112K)

o-okay

Attached: Screen Shot 2018-05-14 at 2.55.08 PM.png (1362x1548, 345K)

C++ would be perfect but too bad that in real life she would have a disgusting gook face.

>2018
>No a single piece of good software written in c#

Why is C the most elegant one?

she looks smug too

It's fair, because C++ toolchain ugly.

She has big things on her chest. Yuck

>2018
>still speaking in English
you have 30 seconds to explain why you still use a bloated and ambiguous language full of cruft when there are better alternatives

Attached: lojban_translated.png (450x392, 18K)

Like what?

Read the filename.

Fuck you

Attached: 1504028477522.png (530x530, 242K)

Nothing good exists in this language.

oldest

>justifying illuminati language

logic languages are shit for creative endeavors.

Lisp one of oldest, no software exist by this days.

shhh not so loud, she might hear you

zostaw mnie

DFC. Lolicon.

A shame that chart has no Lisp.

Are you sure? ASP is the second most widely used after PHP. (Stackoverflow is written in asp)
You can find lots of projects on github too like nadekobot, keepass, paint.net (pinta), handbrake and visual studio (mixed)
Unity might be shit because of license but it uses C# for the API and is very respectable and works on desktop and mobile. There is also many gaymes written in XNA (now monogames).
I have worked with C# a lot and watched it get extension methods.
I used to work in a C# team to create tools to ease up work in the company and did some big winforms projects that made me loath the living fuck of pajeets that designed win32 API

Don't forget Xamarin.

emacs

Redpill me why JavaScript is bad.

Attached: 1526068240547.jpg (860x720, 120K)

Ooh good one. Single codebase for many platforms.
I hope they focus on Xamarin Forms and enhance it.

dynamically typed

Just because buttnet. It is very powrful but it is very easy to fuck up and it is hard to debug.
Almost all my problems when I started up were the wrong variable name.
Also, there is something about it that attracts proprietary bullshit and things like electron

function bullshit() {
if (true) {
var s = "JS is retarded"
}
console.log(s) // no error!
}

What is typescript

not JavaScript?

terraria
bastion
fez

three amazing games

TypeScript is a statically-typed MS language that compiles to JavaScript.

Okay

Also, .net core 3 is supposed to support ARM!
Time to dust off my Rpi

Python does this too — it's fine as long as it's a well-known feature of the language.
There's plenty of other reasons why JS is shit; most recent on my list: developer.mozilla.org/en-US/docs/Learn/HTML/Forms/Sending_forms_through_JavaScript#Dealing_with_binary_data

spotted the cs101, everyone.

Lisp sucks.

Is that you code? Why are you checking if the file name doesn't exist, but the extension exists? It's illogical, if there is no filename, then there is no file extension. Just early-return / early-throw if there is no file name, you don't need to check it over and over again if the name exists.

I would never rely on the file extension to have any meaning. Also horrible indentation. Use braces like a real man.

what is it for?

I can understand the second empty line but putting a space between your comment and the post you are replying to is unforgivable

Read it more carefully — if there is a filename it has to match the detected file type; if there isn't a filename, only detect the file type. This is to reject requests with MIME spoofing even if the file type would usually be acceptable. Because it's something I'm working on RIGHT NOW the indentation is kind of shit and it doesn't look at the MIME type from the Content-Type header.

File uploads for a thing.

>internets with sepples
I see. So you are a masochist.

>emacs
>C

10% c
90% emacs lisp

why not just use libmagic?

Could be better if written in C

var is obsolete keyword, use const instead

bot upload for Jow Forums?

Obsolete except for OSes

>except for OSes

Attached: Redox_running_Orbital[1].png (1920x1080, 1.12M)

Looks clean but someone needs to erase the marcos feels out of it.

I only have to support a handful of file types, so I'd prefer to use a 64-line function over a full library dependency (and one that requires resource files). Plus it looks like libmagic wants to open & read the entire file itself, while I'd like to be able to detect after streaming the file to disk in a single pass.

No, this is an API for another site.

redpill me on """use cases"""

Go back

explain

A use case for something is a specific case where you might use that thing.

awww too bad
i wish i had a Jow Forums bot to bump those threads in Jow Forums

some old ass professor teaching us :-DDDD
fun

Attached: 2018-05-14 21_59_47-ObjectOrientedBachelor.png (815x507, 31K)

C++ is probably not the best language for a Jow Forums bot tee bee aich

function getAllKeys(obj){
var result = [];
for(var property in obj){
result.push(property)
}
return result;
}


Anyone know how do I accomplish the same thing (iterate through key:value pairings inside an object) with a classic for loop?

Oh dope! I'm also working with images!

My project's probably a lot simpler, though. I want to be able to open a PNG image (implementing the inflate/deflate on my own)

Attached: Screen Shot 2018-05-14 at 1.02.31 PM.png (1088x814, 140K)

Specify UML next time.

yeah, i know
some simple scripting might be sufficient for this job

When is lincuck going to drop his C autism?

Is it for a project or just a learning thing?
Also I'd tend to use "not a (valid) PNG file" in this case instead of "corrupt PNG file."

never. he's invested most of his life into C

one of these will defend you with their life, the other two will stop at nothing to kill you

if key in dict:
do_work(dict[key])


try:
do_work(dict[key])
except KeyError:
pass


foo = dict.get(key)
if foo:
do_work(foo)

>python
>killing anything other than itself /smth ruby and perl/
lmao@you

>uml

Attached: 1525380573058.jpg (1826x1795, 191K)

dumb frogposter

What the fuck is going on here?
Just read char by char, compare on the go in the loop, and fail fast.
The loop and shifting kills the performance you think you will get out of comparing two longs which is bad if you want cross platform code. use long long instead and check for endianess.

Explain, I don't know Python.

Python autism states:
>There should be only one obvious way of doing things
but there isn't, ever.

God you are retarded.
Every non shit lang offers two ways to access the values in a dict which are [key] and get(key, default).

the statement is that there *ought* to be one preferred method used, not that there can only be one

And there is. So what it is the problem? Did those words harm your feefees?

Is LINQ in C# useful in practise? Is it slow or are there a bunch of downsides to it that you wouldn't understand unless you were running something in prod?

>And there is.
which one in is the preferred method?

yes

a little but most times you use it you're i/o bound anyway so it doesn't matter

[] will throw an exception if key is not found.
get with a default is preferred.
If you expect an exception from do_work or indexer, wrap up in a try catch

Which LINQ are you talking about? Linq as general or the LINQ to SQL and EF? The LINQ to SQL and EF are for database. Their performance is slower compared to plain DataReader because they have more features. If you are talking about Linq in general. Linq is used to query object collections and it's great. Unless you hate extension methods.

>[] will throw an exception if key is not found.
fucking gay, it should return an optional

What's the usual accepted criteria for when to list a new programming language on your resume?

What about a library?

Attached: 1525824568914.gif (360x240, 458K)

Don't abuse it and you'll be fine. It is supposed to be useful to focus on the main task at hand and not create boilerplate and many loops to get to the point.
LINQ queries are especially useful with SQL.

No, that is get().

>What's the usual accepted criteria for when to list a new programming language on your resume?
Would you feel confident doing a Q&A in front of senior programmers grilling you on every facet of it?

var persons = new[] { "Alice", "Bob", "Charlie" };

try
{
for (var i = 0; ;)
Console.WriteLine(persons[i++]);
}
catch { }

What do Jow Forums think?

that's different. Like you said, get will return a user-specified default value.

So more than written several programs in the language? Do I need to have the standard library memorized, or what?

mo shindeiru

Attached: nani.jpg (196x257, 9K)

try harder
void foo()
{
int i = 0;
int arr[5] = {0};
for (;;)
try
{
throw arr[i] = i * i, ++i;
}
catch (int i)
{
if (i == 5)
break;
}
}

>Do I need to have the standard library memorized
nah, not even 30 year C programmers do.

Trips
It's not C#