/dpt/ Daily Programming Thread

What are you working on, Sup Forums?

Previous thread:

Other urls found in this thread:

strawpoll.me/12732251
poal.me/
github.com/gabrielgio/FChan.Library
blogs.msdn.microsoft.com/dotnet/2016/08/24/whats-new-in-csharp-7-0/
45.55.254.243/
twitter.com/NSFWRedditVideo

First for OCaml.

@59861122
>O

What did OP mean by this?

Not suprised coming from one of the stupidest boards

Im bored and currently on wangblows so i need idea for some useful utility program. I already wrote service thats stops damn update... Maybe service that runs shit defined in some file? Linuxy like?

...

A GUI that shows old files that haven't been accessed in a long time by size, so you can clean out shit you don't need.

Please post the code as text.
You're right, I'm overthinking the problem. I was afraid it would go into the gigabytes after a month of running.

Programming language poll continues
strawpoll.me/12732251

::
You've been called out as an alien and no longer have a voice. Stop using the internet.

As fake as I assume this is I wouldn't place Sup Forums in the upper half of boards honestly.

>op pic
why not

Fortran

Could I start programming GUIs with QT if I only know C and a bit of C++.

var boardId = "g";
var pageCount = Chan.GetBoard().Boards.First(x => x.BoardName == boardId).Pages;

var smallestPostNumber = Chan.GetThreadPage(boardId, pageCount).Threads.Last().Posts.First().PostNumber;
var largestPostNumber = Chan.GetThreadPage(boardId, 1).Threads
.Where(x => !x.Posts.First().IsStickied).First().Posts.Last().PostNumber;

WriteLine($"The oldest post on /{boardId}/ is {smallestPostNumber}.");
WriteLine($"The newest post on /{boardId}/ is {largestPostNumber}.");

// outputs:
// The oldest post on Sup Forums is 59857827.
// The newest post on / g / is 59861227.

I'll be implementing the catalog endpoint for this Chan library soon, which would make this even easier.

Why do people insist on using this inferior service?
You even acknowledge it by explicitly having an 'other' category yet you don't use poal.me/ that allows for user added choices.

To be expected from a brainless C# fag though.

But that could take lot of CPU or time or both(to run), also there could be loads of stuff in some windows directory that could just add noise so i should limit search to user directory only hmm.

Well i suppose it shouldnt matter if program takes an hour to complete at 1% cpu usage if I make it like some indexer service...

You could.
It's uncomfortable either way because QT isn't C++ as a C++ programmer would use it.

allowing user added choices usually ends with 'OP is a faggot' as winning option

thanks senpai

Excuses user. Stop being a faggot.
And here it'd certainly not be op is a fag, get Sup Forums out of your mind. It's going to be 'anime' or something like that.

>suprised
>stupidest
>Not Zoopriest Coming from One of The most stupidestest Boords

>wallpaper general
>139

top kek

What would you say are the most essentials skills that someone looking to get job in software development needs to learn?
I already have some basic of C# and OOP but I still feel that I'm lacking the knowledge to really be useful on a project if I were to get a job.

social skill

>but I still feel that I'm lacking the knowledge to really be useful on a project if I were to get a job.
You will feel that way until you get a job.
I've written my own game engine as a hobby at this point and I still feel this way. Realistically I know I could be of some use.

>Java #1

To all Haskell programmers: If Haskell isn't a meme, what can you actually write in Haskell that a company would profit from? What would you do in a job as a Haskell programmer
Because all I always saw was "playing around"

we have a winner.

>until you get a job.
wrong
i have job as a programmer for about 3 years and i still feel that way

>double-blind cross reference test over a 6 month period
>Sup Forums
also
>If you hall from a board under the weighted average, please refrain from making posts about the above topics entirely.
go back to Sup Forums faghat

what level would you want to reach before you start freelancing?

Yes, hello, I have a push-button. When the button is pressed, an int happens to increase by 1. When int is odd, script #1 is being run. When int is even, script #2 is being run.
If I add script #3 however, it would look like this (Python 3):
i = 0
#button pressed
i += 1
if (i%3 == 0):
#script 1
elif (i%2 == 0 and not i%3 ==0):
#script 2
else:
#script 3

My problem with this is that it switches in the following manor: 1-2-3-2-1-3 1-2-3-2-1-3. My desired would be 1-2-3-1-2-3 1-2-3-1-2-3.
What is this problematic called? I've tried google and others but if I can't name the problem I'm having then I can't find the solution. I've asked in as well.

Numbers look about right.

I could have formatted it better, I guess.

level 15 at least

No clue user. I say you should just try things. It's a more healthy alternative to worrying.

>no F#
;_;
the comfiest functional language

>special snowflake

>int nearly 1500/h
good lord, you should find out how fast /brit/ is.

Interesting numbers...
Holy fuck Sup Forums

Here it is with some formatting and sorting.

var boards = Chan.GetBoard().Boards;

var boardStats = boards.Select(x => x.BoardName).Select(boardId =>
{
var pageCount = boards.First(x => x.BoardName == boardId).Pages;

var oldestPost = Chan.GetThreadPage(boardId, pageCount).Threads.Last().Posts.First();
var newestPost = Chan.GetThreadPage(boardId, 1).Threads
.Where(x => !x.Posts.First().IsStickied).First().Posts.Last();

var appxPostCount = newestPost.PostNumber - oldestPost.PostNumber;
var timeDiff = newestPost.UnixTimestamp.UnixTimeStampToDateTime().Subtract(oldestPost.UnixTimestamp.UnixTimeStampToDateTime());
var postsPerHour = appxPostCount / timeDiff.TotalHours;

return new { BoardName = boardId, OldestPost = oldestPost, NewestPost = newestPost, PostCount = appxPostCount, PostsPerHour = postsPerHour };
})
.OrderByDescending(x => x.PostsPerHour)
.Select(x => $"/{x.BoardName}/ has approximately {x.PostCount} posts.".PadRight(60) + $"Post rate: ~{x.PostsPerHour.ToString("0.##").PadRight(7)} posts per hour.");

boardStats.ForEach(WriteLine);

Haskell is a Turing complete, general purpose language.

>Sup Forums 7162 posts per hour

fucking shills

>7200 BTFO of Sup Forums by over 2k
Thats really impressive, the election really brought in a lot of people

I'm working on a Sup Forums frontend as well. I'm actually making a frontend for every website I like, some kind of custom client for the web.

For now it's just javascript that either scrapes websites or uses their API endpoints. Once the data is downloaded, the code fills the blank web page with it. This way, all websites look the same. Faggy web designer bloat isn't even downloaded and the information is presented to me uniformly and bullshit-free. I get a soft ad-blocker for free, too.

I'm not sure if I should turn this thing into a chrome/firefox extension. At first I wanted to make it one of those "chrome app" things... But Google killed that shit. Oh well. It seems to be working as a regular stand-alone page, and I can download it straight off of bitbucket repo if I want

>Sup Forums has more post/h than Sup Forums

holy fuck

nothing suprising, Sup Forums is complete shite since about ten years

That's pretty much how AppChan X works, IIRC.

Is your chan lib on nuget?

Those numbers are fucking insane compared to CrippleChan. I guess they're nothing compared to plebbit though.

Didn't hinder its popularity in the past.
Yeah, not sure why but I think it may be the recent political events.

@59861416
>a language can be a "meme"

>calculating all these stats

I wonder how much load you're placing on the Sup Forums API endpoint.

political and HWNDU misadventures

Not sure how anyone can find this surprising.

That being said, I've spent a bit of time in Sup Forums. Not that I'd recommend it. That shit rots your brain.

>Turing complete
Meaning it's utter garbage.

The version I'm using is not, but it's shamelessly ripped off of FChan, which you can get here:
github.com/gabrielgio/FChan.Library
Install-Package FChan.Library

As far as I can tell, the owner of FChan isn't doing anything more with it, and it's missing a few crucial components that I wanted out of the library, so I'm going to put mine up on GitHub when it's more fleshed out.

>This man actually makes good use of new C# features
using static My.Nigger

One call for a list of boards.

Four calls per board: two for the first/last page, two for the first/last threads on those pages.

71 boards in all, so 284 API calls.

>doesnt support .netcore
goddamn it. If you host yours on github I'll contribute.

Yes, go back to your safe space and stop wasting valuable space on the Sup Forums servers.

using static was available in C# 6, though.

Oh yeah, that's the kicker: mine is going to be .NET Core compatible, so there's that.

I'll post ITT when I'm comfortable sharing it and getting it on NuGet.

Yeah I read a lot of the Sup Forums extensions source code.

It's just like that extension, but:

1. Instead of editing the Sup Forums web pages, it has its own blank webpage to fill with data.
2. I make a program that scrapes websites and returns data according to the frontend's schema. The frontend displays that data in a "boring" but efficient manner that's uniform across all websites.
3. It doesn't really look like Sup Forums at all. Imagine a file system tree like this: Sup Forums.org / g / 59861075. This opens a data view with all posts in this thread.
4. It's modular. It can serve as a frontend for any website.

scrots, source anything?

C# 6 is new when nearly everyone in your workplace refuses change. They still use .NET 3 5 for most things for gods sake.
I haven't looked much at C# 7 yet. Any good stuff? I've been getting a rabid kick out of VS17 and the new nuget / .csproj. And Visual Code is finally getting usable.

Also this.

M$ has produce nothing ov value since 3.5

>I haven't looked much at C# 7 yet. Any good stuff?
A few really nice things that I'm actually regularly using are:
>actual tuples
>out var
>ternaries that can throw exceptions
>pattern matching

The pattern matching is limited, but it fills a very nice gap in doing conditional logic with conditions based on types.

More information:
blogs.msdn.microsoft.com/dotnet/2016/08/24/whats-new-in-csharp-7-0/

Thank you for your valued contribution to the topic.

>If you host yours on github I'll contribute.
Same. I recognize that filename and the help that I got from the posts with it, I'll definitely chip in if I can.

You're welcome.

Anyone has done anything usable with .Net Core yet? I still find it a lot more troublesome than standard .Net unfortunetly

You are obviously trying to count to 3, and here is how you do it:
0%3 = 0
1%3 = 1
2%3 = 2
3%3 = 0
4%3 = 1
...

Figure it out? Just take the remainder with 3, not 2.

>/fit/
>131

k

I use it to make simple webapps on asp.net core.
I made this, which you can use to browse Sup Forums during the election
45.55.254.243/

.NET Core is still finicky in my opinion, but it does work.

I have a bunch of microservices hosted on an Ubuntu instance in Azure running on .NET Core that do various automations at my company.

I'm waiting for .NET Standard 2.0 to be finished before I try anything big again in .NET Core.

That was a fucking great read, thanks.
I'm actually going to be using out vars a lot. A good chunk of my work has me doing content parsing for data and this should allow for some more powerful LINQ expressions.
Pattern matching is going to take me a good sit down before I properly learn to abuse it.

>Forgetting our Lord and Savior async Tasks

>async Tasks
So shit.

Oh, so;
if (i%3 == 0):
#script 1
elif (i%3 == 1):
#script 2
else:
#script 3

And if it were for example 5, then it would be i%5 == (0 through 4).
Got it, thanks.

If you're doing things like that, try combining TryParse with a ternary throw:
var muhInputDoubled = int.TryParse(ReadLine(), out var muhInt) ? muhInt * 2 : throw new FormatException("Input should be a whole number!");

I hadn't considered that persuasive argument before.
I'll go back to blocking threads and race conditions now thank you for the input.

You really think that task protect you from race conditions or things like that? Really? I understand why you think it worth.

neat

why would you have Ubuntu in Azure?

I fucking creamed myself you sick bastard.
Throw that on a select when parsing a reference type and then sort and select by pattern matching.

Learning how to use Vim.

If you're using async Tasks, then yes.

>why would you have Ubuntu in Azure?
Because Azure Service Fabric supports Ubuntu, and I don't have to manage hardware.

Yeah, if I'm parsing a delimited file, it's easy to do this for each property on an object assignment and handle the fact that some of the data is invalid on that line. ReadAllLines + Select + Split + Anonymous types.

Idiot.

>not le argument

I like that argument. Do you know what the async await compiler syntax even does? Please educate me on why I'm wrong.

>Sup Forums is listed as 125 along the top
>Sup Forums is listed as 91 along the bottom

how much do you pay for that instance if i may ask? im wondering if its better deal than scaleway

So M$ solve a problem that no researchers in the world can solve. Only idiots would believe such a thing. I don't have to argue with idiots. I am not paid for that.

This is a dumb question, but let's say your destructor gets called (like through raii), is there anyway to "cancel" it?
Say the class is another process, the destructor gets called but doesn''t destroy anything. Is the process still active?

This is bait, do not reply to this post

Stop coding right now.

Is this you admitting you finally don't know what you're talking about?
Lucky for you, I'm not a brash asshole like you so I'll cue you in for next time.
Async / Await is single threaded. It's just a syntax for a compiler state machine over the Task for things that shouldn't block, but don't need to be multithreaded like file loading, networking, or preserving UI.
Or you can do the responsible thing, make your data immutable, and run the task on a separate thread too.
I'm sorry. I genuinely worry for people.

>he believes "async" is the only way to write concurrent, nonblocking code
laughing_girls.webp

>Async / Await is single threaded. It's just a syntax for a compiler state machine over the Task for things that shouldn't block, but don't need to be multithreaded like file loading, networking, or preserving UI.
OK you want the proof that you're an idiot.
race condition and dead lock happen on single core too.
Case closed.

What are alternatives to async/await/promises though? I don't like them either.