/dpt/ daily programming thread

Old thread:

Attached: redmonk.png (1050x744, 123K)

Other urls found in this thread:

zguide.zeromq.org/page:all
gist.github.com/N-B-Kelly/0e98786be431ffb4a18417b09a121814
en.cppreference.com/w/cpp/algorithm
Jow
twitter.com/SFWRedditImages

>What are you working on, Jow Forums?

First for Julia!

Attached: Julialogo.png (320x216, 11K)

making
lstMemberList.Items.Add(strMembersList(intRow, intCol))
into
lstMemberList.Items.Add(strMembersList(intRow + 1, intCol + 1)) (or intRow/Col -1)
generates an out of bounds error, so it doesn't seem to be an index out of bounds issue

Deterministic Reactive Constraint Memory

VBScript. I shit you not. Need to support absolutely ancient and minimal Windows. Even if we didn't, I can't be bothered learning PowerShell.

Attached: untitled2.png (299x180, 33K)

>Scala's the top non-shitlang
lawdy

Attached: 71L4azgt%2BAL._SY450_.jpg (450x450, 36K)

>Scala
>non-shitlang

Attached: 1503032944955.jpg (1500x1153, 127K)

Corporate work?

t. I wish I were getting paid to write HasLisp

>mfw JS #1

Attached: d0b.png (600x600, 159K)

Working on my crypto trading bot and needed to communicate from the scanner to the process that does the actual buying. Also, have parts of the scanner running on vps close to the exchanges. Message queue needed to be as fast and streamlined as possible. Discovered ZeroMQ. Fellas. This shit is badass. If you have an afternoon, read the guide[0]. Funny as hell. Also possibly the best introduction to this style of ipc ever written.

[0]zguide.zeromq.org/page:all

dumb frogposter

You fuckin' know it, bud.

Attached: 1521255950327.jpg (225x225, 14K)

I had to work on a rescue project for two years.
>VB.Net
>WinForms
>Still used DataSets
I wanted to neck myself about half way through. I feel your pain.

>tfw people can tell I'm not smart from conversations
How do I sound smart guys

Attached: download (1).jpg (173x163, 5K)

just throw in lots of buzzwords you don't really understand into conversations

Learn the topics they frequent, and a few extras you think they'd be interested in, so when they ask "and what about you?", you have something to bridge off of.
Or, y'know, stop caring what people think. Opinions are like anuses, everybody has one.

>OMQ
Yup, is good shit.
Even used it in a couple of trivial projects, shit works like a charm.

Don't worry, even if they don't think ur dum, your subclinical social anxiety will still make you think they do.

dumb frogposter

They don't really care how smart you are, but they think that they are smart. So if you can say things which reaffirm their own beliefs and then make vague notions towards things they don't really understand, you'll appear really smart.

>stroke their egos
this user speks te truth
it's all about the circle-stroke

Huh. Not even meme'ing, Haskell is gaining in popularity year by year

>gaining in popularity
>Haskell tax still a thing
oh well

>thinks java and C# are shitlangs but hipster java is not
(You)

t. EnterpriseFactoryFactoryBean

Circle of one, preferably.

that makes you sound even more stupid.

ask them questions instead about what they're doing

who else is actually falling for this meme and liking it?

Attached: reactive-manifesto[1].png (774x308, 42K)

no .sol fags here?

Resilience doesn't really come to mind when I see a Pokeball.

learn haskell

dumb frogposters don't deserve haskell

>hasklel
>good

pick 1

I prefer netty, but it's good that more people get into asynch parallel computing

1

>buzzword | ^
> v |
>buzzword --> buzzword

Attached: Untitled.png (774x308, 52K)

Attached: 1517773225863.jpg (292x257, 34K)

dumb wojak poster

based wojack poster

I'm building end to end reactive applications. It's the best. I shit out performance.

Popularity = Brainlets trying to learn the language

For the parallelism/alternative solution talk at the previous thread:
I still think that you can save time with parallelism for the problem.

I'm writing an implementation in java to try and test my theory. It could very well turn out I am wrong; if I am, then oh well.

What i'm testing:
>Print every line in sequence as processed
>Concat all lines as processed, and print in one statement
>Do a top-down merge to a certain granularity (100 line sequences), calculate those in series, the concat, and print in one statement
>top down merge but parallel

The output is being dumped in a text file to avoid the visual representation distorting the print time, and I'm measuring with the time utility in bash.

results are: real/user/sys (seconds)
>1: 3.988/3.028/1.748
>2: DNF
>3: 1.775/2.576/0.104
>4: 5.579/7.888/2.876

I terminated 2 after four minutes. I think I ran out of RAM or something. I'm using a stock lenovo x230, so I don't have the most powerful specs.

Findings:
On this hardware, and setting the minimum chunk size to 100 numbers, top down merge and single buffer print performed a good deal better than printing everything in sequence with no buffering.
Threads were bad, but it might have been the chunk size: I think I create somewhere between 500-5000 threads, which had lots of overhead. Going to try some more experiments and see if I can optimize it a little more.

Should I post my code?

>Java
>I think I ran out of RAM
Why am I not surprised?

use StringBuilder, don't concatenate immutable strings

>Threads were bad, but it might have been the chunk size: I think I create somewhere between 500-5000 threads, which had lots of overhead
This leads me to believe that you haven't done too much perf-oriented workload parallelization.
I'd have started with a thread a core (trying both virtual vs real cores if HT).
Also, the results are about what I'd expect.
Have you done a sanity-check w.r.t. Amdahl's law before starting to parallelize - more specifically, measure the time spent in generation vs the time spent in printing?
Absolutely.

C# is better for parallel tasks. Try converting your code or posting it here.

Speak as little as possible

Yeah, I was doing the moron version of threading. Doing second test now, which is exactly eight threads.

Also what I should have been doing. Code soon!

Smart guy :O

english is not my main language so sorry for confusion:

In python I have a list of words, and each word has a value (like "color" "animal" etc)

I want to make dictionary that uses values as the keys, but there is one extra thing I need! If there is a repeat word with that value, I somehow need to tally that this word occurs more than once

Is this possible?? Well, i know it is, but best way to do so?

fizzBuzz :: Int -> IO ()
fizzBuzz 101 = putStrLn ""
fizzBuzz x
|mod x 15 == 0 = do {putStrLn "FizzBuzz"; fizzBuzz (x+1)}
|mod x 3 == 0 = do {putStrLn "Fizz"; fizzBuzz (x+1)}
|mod x 5 == 0 = do {putStrLn "Buzz"; fizzBuzz (x+1)}
|otherwise = do {putStrLn (show x); fizzBuzz (x+1)}


did i do good?

>fizzBuzz 101 = putStrLn ""
why

how else do i end the recursion? 101 is just cause fizzbuzz is usually 1 to 100

Why not have the dictionary go from values to list of words instead of just single words.

1 map for key -> object
object contains count of occurence
if key already in map, get object and increase its count
this babby tier

think about how you could abstract over this

I know this to be true. Parallelism on c# is a breeze. I might do this later.

I converted everything to stringbuilder except for the base and now all examples run better.

The classic calling card.

The current metrics I have now:
>1: print all in sequence as calculated
>2: print all in sequence in bulk
>3: top down merge
>4: create a billion threads
>5: create the exact amount of threads optimal for my cpu (4)

Here are my results:

>*: REAL/USER/SYS
>1: 3.889/3.136/1.680
>2: 1.411/2.104/1.680
>3: 1.405/2.168/0.092
>4: 5.005/6.812/2.936
>5: 0.971/3.144/0.096

I want to say 5 worked better, but I don't actually know what weight to put on the categories, but it seems linear and top-down are roughly equal when chunk size is 100, so long as all text is printed at once, and that threaded version performs significantly better (under real category), but I'm not sure what the categories actually mean.

Here's what I produced. The method of test selection is lazy, but it wasn't the objective here.

Do you think I speed up the int to trinary to answer conversion more?

gist.github.com/N-B-Kelly/0e98786be431ffb4a18417b09a121814

ooff i am brain dead right now... worked for 15 hours today... need to sleep to think clear lol

Bet that guy was Team PB.

check em

delet this

can you partially fill an array in c++?

What programming books do you guys suggest? I want to learn and master C++ before moving on to any other languages. I've dabbled with C, Java, and Python but I really feel like I'm not that great of a programmer.

How do you guys learn? What books do you guys read?

Also, is Clean Code really that great of a book?

Attached: 71QQhJuMlPL.jpg (1103x1360, 141K)

Do you need to implement this (for homework, an assignment)? If not, the standard library has the thing you need.

en.cppreference.com/w/cpp/algorithm

Jow Forums-science.wikia.com/wiki/Computer_Science_and_Engineering

make it all a list of strings?
a single string that you just keep adding too?

>Pajeet filter: Write a function that calculates the roots of a quadratic equation in a numerically stable manner.

Not homework, just self taught. trying to organize a lot of data and there are so many ways to do so, one thing i like about python is tasks can be accomplished in such concise methods, i have a lot to learn

fizzbuzz :: Int -> String
fizzbuzz 101 = []
fizzbuzz x
|mod x 15 == 0 = "FizzBuzz/n " ++ fizzbuzz(x+1)
|mod x 3 == 0 = "Fizz/n" ++ fizzbuzz(x+1)
|mod x 5 == 0 = "Buzz/n" ++ fizzbuzz(x+1)
|otherwise = (show x)++"/n "++ fizzbuzz(x+1)

try writing a function that turns a single int into a string

vb.net guy back again
that exception was from me forgetting to initialize the array

now I'm having another problem with the same method.

Even though the logic seems sound (to me), it loops forever and never finishes the for loop.

Do you guys see anything wrong with the subroutine?

Public Sub UpdateMembersList()
Dim intRow As Integer
Dim intCol As Integer
Form1.lstMemberList.Items.Clear()
For intRow = 0 To 2
If intRow = Form1.cboClubList.SelectedIndex Then
For intCol = 0 To 10
If strMembersList(intRow, intCol) "" Then
Form1.lstMemberList.Items.Add(strMembersList(intRow, intCol))
End If
Next
End If
Next
End Sub

I did this but apparently haskell doesnt like newline charecter

I mean a single one like 15 -> "FizzBuzz"
also if you're using a repl, the string will be displayed as a literal and not like it's been printed, so use putStrLn if you do that

why is each day of /dpt/ full of fizzbuzz or babys first project euler program. Is no one here building something more interesting?

FizzBuzz is the only important problem. FizzBuzz is the maximum level of total project complexity before you get to just putting different lego pieces together. There is nothing beyond fizzbuzz.

I like Crystal's union type.

>Rust has Option
>C++ has std::optional
>D has Nullable!T
Nice

What's a decent project idea that I could do in a week or so that would look good on a resume for an entry level job? I stupidly graduated in CS without an internship or personal projects.

Just be yourself

Attached: Scruffy_Kitten.jpg (700x604, 33K)

is there a way to be constantly listening for a certain interrupt keyword in python?

can't seem to get things to run in parallel, also a noob, not sure if that's the right terminology

how do you make SQL interesting? My AIS teacher is boring me to death

not everyone is a cute scruffy kitten who can coast through life

Don't worry man, I'm just as retarded. About to graduate with no real projects and no internships. Feels ok.

Attached: download (2).jpg (253x199, 9K)

this is what FPtards actually believe

How do I determine how long a key is being pressed in ncurses? From that time I want to calculate say velocity of an object. The key accelerates the object

Then you could use a dict of collections.Counter. Check out the methods it supports; it's a nice class.

thanks Jow Forumsent

You clearly don't come in here every day.

You use PostgreSQL and do stupid shit in it.

Attached: Screen Shot 2018-04-01 at 2.09.55 PM.png (2880x1702, 898K)

databases are fun pleb. you lack the autism to post here.

Row@Pick[{Fizz,Buzz},#~Mod~{3,5},0]/._@{}->#&~Array~100

What's fun about them

you are enforcing your will to put order to
unruly chaos. you can create a system to make whatever you want and deploy your results to whatever setting you need.

Does anyone here use sublime text? Do you guys use a plugin to compile your code or do you just use it as a text editor and compile from a terminal?

Declarative data semantic restrictions

As far as I'm concerned, Sublime's build system is too simple to be useful, so not sure why they bothered including it. On the other hand this impression has caused me never to use it, so I may be completely wrong about how useful it is.
I just use Sublime as my editor, then compile from a dedicated terminal emulator.