/dpt/ - Daily Programming Thread

What are you working on, Jow Forums?

Last thread:

Attached: 1549384055047.png (1700x1374, 1.12M)

Other urls found in this thread:

hackage.haskell.org/package/base-4.12.0.0/docs/Prelude.html#t:Semigroup
twitter.com/SFWRedditImages

Nah i meant like you don't have to actually pay for it and it still works but i'm still interested if you have better free options

Is using a complicated regex like
(?:(?

to escape all double quotes which are not at the end or beginning of a string an inferior solution to an algorithm of
1. remove enclosing double quotes if present
2. escape all unescaped double quotes
3. put back enclosing double quotes if present in step 1


The purely regex solution results in a couple hundred steps in the engine for the input it'll typically receive (according to regex101.com).
This is mostly a philosophical question and I'm interested in any opinion. I also feel like I can't really assess the resource intensiveness of the regex operation. Keep in mind option 2 would also likely require regex to check if the preceding character is a backslash. This function would likely be called tens of thousands of times during an unit of execution.
(I posted this in /sqt/ but I'm also impatient for answers.)

getting to grips with various compression libraries
so far zlib is my favorite as despite being C it's actually well designed

>What are you working on, Jow Forums?
Taking tiny screenshots of things my program needs to be able to recognize. I thought I was almost done, but then it turns out the elements that I take screenshots of sometimes swap between being win10 themed and win7 themed, so now I have to do everything again.

What is the K&R, or SICP of machine language?

Employed Haskell programmer reporting in

Attached: 1437497521042.jpg (1280x720, 66K)

>but i'm still interested if you have better free options
emacs and 7-Zip

give me your job

Attached: 1548129005862.jpg (640x480, 45K)

No

Attached: 1468882928057.png (439x392, 180K)

Attached: 1469212755-9902693176a322d00d0e93e503da8809.jpg (700x393, 60K)

Attached: 1463363949111.jpg (511x509, 36K)

nobody cares
nobody cares
nobody cares

...

Who hurt you?

It would probably be faster without the regex, also more readable. It's not very difficult to do.
>escape all unescaped double quotes
>option 2 would also likely require regex to check if the preceding character is a backslash
You don't need regex for that, just iterate through the chars keeping track of the last one. but why are you dealing with input that may or may not be escaped though, shouldn't you have some idea of how it's formatted?

my pet rock cares

Attached: haske employee.jpg (1280x720, 110K)

has anyone made a program that can distinguish drawings from real life photos yet? how difficult and time consuming would it be to train a neural net to do this?

Trying to create a hack from the chromium project.. it's just a huge project and the people who work on it and might be able to help just aren't willing.. it's frustrating because I think my idea is pretty cool

thank you for using anime pic

Attached: ballin.png (333x360, 88K)

just train it yourself lmao, nigga its easy

I failed to see a meaning in your post
is that your purpose to make me feel empty? fuck you

if its so easy why isnt there any open source projects related to it on github?

if getting a sex partner is easy why are you still alone?

realizing my C professor may be retarded.

what? anyway I need this because I want to only keep artwork from artists I follow on twitter, not their food/pet/random images. I'd rather not manually go through thousands of images to delete it

Because it isn't easy. I'm not sure what point you wanted to get across there.

who's using Godot here? and give me some story about your experience as a gamedev (any engine), professional or not.

Attached: unityvsgodot.png (7871x3420, 2.88M)

>he fell for uni meme

>unironically watching capeshit

The fact you have this problem tells me you aren't manually going through each and every image and evaluating whether they're worthy of saving or not.
Which means you're doing things wrong, and I'm not sure why you even fucking give a shit what gets saved when you clearly don't even give enough of a shit about the quality of images that get saved anyway. You probably don't even go through them, fucking nigger.
Enjoy your massive trash/quality ratio, nigger.

Why does class Semigroup not seem to exist? Isn't it supposed to be a part of Prelude?
hackage.haskell.org/package/base-4.12.0.0/docs/Prelude.html#t:Semigroup

How do I check wich version of Prelude I have?

>2.88MB, 7871x3420 PNG
please make your meme images smaller

story time or gtfo

100% did. But luckily I have my finances in such a way where I will have no debt so honestly besides time, it will only make me look better I guess (i hope). I'm not going for the meme degree of CS, but going for Computer Engineering (probably still a meme but oh well). Anyways, this fuck keeps forcing us to use his custom library he made for random numbers, which was compiled for i686 and seems to do whatever the fuck it wants and pulls compiler errors.
TL;DR I'm a college fag who won't get screwed financially and my professor shoves his chink cock down our throats weekly.

Fuck off and go to /toy/

>Thread start asks what people are working on
>People say what they're working on
>LMAO NOBODY CARES

I had a 'C professor' who went on to teach us C++.
He gave terrible advice, much stemming from OOP ideas.
But some of that stuff was just plain bad and anyone should see it. Like the advice to _always_ have any class contain a virtual destructor. I'm not sure if this was sabotage or just him being an idiot.
That kind of thing just kills your enthusiasm for classroom work and adds all that burden of critical thinking to learning the basics. I didn't want that at university.

Anyone has more of this pictures? I'm looking for some projects to make. I've been doing some Rosetta code tasks but now I want to do something more useful but I'm an idealet.

Attached: 1537807468961.png (3840x2160, 1.61M)

Why did you give her a (You)?

It's a twitter script that routinely downloads everything from everyone I follow. You don't pick and choose which art works are the best if you're a collector you dumbass. If someone in the future wanted an entire archive of that artists work, they'll be pissed if it had missing pieces because your dumbass didn't deem it as worthy. Fuck you and everyone that does stupid nitpicky shit like that.

please halp with
what the heck is wrong?

>her

You see, the mistake you're making is trying to be a collector for everyone else instead of just collecting the things you like for your own sake.
But no, instead you have to fill your life with trash because some other imaginary person might appreciate it. What a retarded life you lead.

why you bully man
because you ask me nicely, here.

Attached: small.png (1421x618, 252K)

>You don't pick and choose which art works are the best if you're a collector
Then what's the point? If you're not being discriminatory in your collection you're not a collector, you're just a hoarder.

>tfw using J for project euler
3++:i.&1:@(4&*)@>:@i.@#)+/\+/"1]1&p:(+:@

Attached: 441.jpg (1154x1500, 1.16M)

I'm not surprised a retard memer would give me that kind of response.

Fun fact, it's only 90KB as lossless WebP.
Hiroshimoot should add WebP support already.

>shouldn't you have some idea of how it's formatted?
To cut the story short, no. It's partially the client's, partially my own retardation, but at this point strings can come into this method either (i) enclosed in quotes with internal quotes escaped, or (ii) not enclosed in quotes with the internal quotes unescaped. I'm handing the string off to a JSON parser by formatting the input into a JSON stub. The parser either treats the input as a string field (i) or any valid json object (ii). The latter case allows me to take numbers, objects and arrays and generate a valid JSON from the stub. I'm basically trying to protect against quotes in string valued fields which shouldn't be there in the first place. It's a mess, I know. ;_;

>instead of just collecting the things you like for your own sake.
To an extent I am, considering I only collect works from artists I like. However if I am collecting for an artist, I'm going to make sure I have ALL their works.

>because some other imaginary person might appreciate it
I see nothing wrong with that. It's the respectful thing to do. I know I'd be angry if I downloaded a collection and it only had 5 images out of 1000 because that's all some retard found to be good.

Hoarding implies it is never being shared, which be definition goes against what I just said.

How do I lean how to structure AI Min Max?

Attached: 3.jpg (610x813, 63K)

>Hoarding implies it is never being shared
The fuck it does.

Why would you even share your collection? Why care?

Are you sure Statistics.txt is in the root directory of the project? Perhaps use a fullpath

Solved it, but thanks!

you just need a text editor and a compiler/interpreter for your language of choice

You create a new project in your IDE

that's literally what hoarding means. you're keeping the shit for yourself, hoarding it.

Because sharing is caring you degenerate

Attached: screenshot.45.png (626x544, 25K)

That font is actual cancer. Please, for the love of all great things, use a NORMAL fucking font.

>proportional font

Attached: viewing with suspicion.jpg (320x218, 17K)

>Python
Color me surprised a retard like you would be using such a shitlang.

html5 is not a programming language, but you would edit it in a text editor like notepad++ or maybe an IDE like "Visual Studio Code"

Just in an IDE or appropriate text editor.
An appropriate text editor for beginners could be something like Atom or Visual Studio Code. You'll get shit on by dpt for using them but they're fine if you're just starting out.

An IDE is like a text editor with many extra features, things like IntelliJ if you're doing Java development and such.

>Is there a website I create my project in?
No, but what you do depends on the language and your preferences.
Your first projects will probably just be a single file, and so there isn't much.. project going on.
If you're doing java you can start this stuff in your IDE, if you're doing a good language just create a file with the correct file extension and away you go, compile it using the terminal.
There should youtube tutorials for this, but ask if you need more help.

Windows Notepad is the most popular IDE (editor)

Type

Hello
World


in it and save it as HelloWorld.txt. Then click "open with" and open it with your browser. Congrats, next stop Silicon Valley

>tfw I've a Markov chain shit poster for Jow Forums
I never used it tho so the data set is non existent. It works over a cli, you can either download a whole board or a specific thread. Initially I wanted it to use it for Jow Forums shit posting by getting the words from Linux and Mac threads. Was surprisingly easy, 90% of the afternoon code stuff was mostly cli related.

how long will it take to master
>1) Unix network programming by Richard Stevens Volume 1
>2) Unix network programming by Richard Stevens Interprocess communication
>3) The linux programming interface by Michael Kerrisk
?? I am thinking 3 months.

I copied that post from rlearnprogramming but when everyone replied so sincerely i felt incredibly guilt, thanks for being great guys

Hello, Jow Forumsents

I am in first year of Uni and would like to have an internship over the summer. I want to make emplyable and would need to do some projects. Could you give some tips for a c++ fag whose knowledge only got to the level of algorithmic problems and no real applications done ? My maths is solid and I also had experience with ASM.

Download python and start writing stuff in Notepad++. Why Notepad++? It has syntax highlighting for most popular languages.

Download the PyNPP plugin for Notepad++ so you can run scripts inside Notepad.

naaww

Attached: dumb frogposter 18.png (604x516, 88K)

internship application cycle for most big companies is like september to december, you're a little late bud

gsoc hasn't even opened for students yet

I have a Uni internship fair in 2 weeks, it`s ok

The terminal in real life is an actual terminal, like cmd or the terminal in macOS or linux-based systems. You don't typically code in a terminal.

If you are coding something in HTML5, you would use a text editor. On Windows, one would typically use Notepad++ as it is lean and contains only useful features. Other people would opt to use what is called Visual Studio Code (which is available for all desktop operating systems).

If you wanted to get into anything other than scripting/markup languages*, you would be better off with an IDE and ignoring what all the skids say here on Jow Forums.

An IDE is a bunch of things: a project manager, compilers, a text editor, syntax checker, etc. You would typically use an IDE for a compiled language, such as Java, C++, C, C#, Visual Basic .NET, etc.

IDEs essentially speed up the process of development by having the related tools integrate into one another as one single unit.

godspeed Jnon, you're an inspiration

>that's literally what hoarding means. you're keeping the shit for yourself, hoarding it.
Doesn't apply to digital or otherwise easily reproducable content.

IDE != editor

>Nonogramm generator and solver
good shit, there's some nice theory involved. Tried once during a 24h marathon (wanted to only attempt generation and a timed game), but me and my teammates were way too inexperienced for the task. Barely managed to get to square 1 of setting up the board.

notepad ++ and a compiler based on your programming language user

user@host:$ echo '#include
> void main() { printf("Hello world!\n"); }' > program.c
user@host:$ gcc program.c
user@host:$ ./a.out
Hello world!

I've been thinking about changing style to go from this
int sample()
{
if (!first()) {
fprintf(stderr, "...");
return 0;
}

if (!second()) {
fprintf(stderr, "...");
return 0;
}

if (!third() {
fprintf(stderr, "...");
return 0;
}

return 1;
}

To this
int sample()
{
return first()
&& second()
&& third()
? 1
: 0;
}

The idea is to move all error handling into the functions, such that the code can look as clean as as a shell script where you don't care about errors, while still actually handling them.
Thoughts?

Global vs local error handling depends on what the error handling will be.
If you're just gonna abort and print a message you'd probably want more global error handling as you suggest here.

I don't write code that deals with that kind of error that often though.

Sharing your code for (free) is literally the most cucked thing you can do.

Attached: think.jpg (720x888, 334K)

Letting your wife fuck another man is literally the most cucked thing you can do.

i would never say no to my wife

You had to use your neurons to write that post, and you still gave it way for others to read for free.
What a cuck.

C sucks in this regard in the way that if anything fails you won't have any stacktrace (using the 2nd option).
That's why error handling tends to be rather localized. C++ exceptions attempt (poorly) to fix that.

Also, that tetriary in 2nd snippet seems unnecessary, why not just return the result directly?

Asking money for simple programs is more of a hassle than it is to write those programs in the first place. And nobody would pay for them anyway.

What about letting another man let another man fuck your wife

in python, to write a one-line if statement sometimes you wouldn't need to put the "else" clause.
why?

generate odd numbers without writing "else"
[i for i in range(100) if i&1]

meanwhile this doesn't work
a = 3 if 2 > 1


have to add the "else" clause
a = 3 if 2 > 1 else 8

Is it even possible to program an fsm in C using a single linked list?

That's just fucking your wife.

I don't know why you would want to do that. But yeah, I guess.

McDonalds?

>Second degree cucking
The question remains: more or less cucked than first degree?
I'd argue the more people it involves, the more cucked it is.

why is McDonald's referred to as Mickey d's?

>The "shortened" version of McDonald's, even though you're not saving any syllables.

>I'd argue the more people it involves, the more cucked it is.
But what if nobody is interested in your project.

The tl;dr is that those are two different types of expressions.

list comprehensions syntax is
statement for variable in iterable [if condition [else statement]]

if/then/else syntax is
statement if condition else statement

If the syntax for the latter didn't contain an else, then python wouldn't know what "a" in your example should be equal to, where with list comprehensions, it can just skip that item, and it's just fine.