/dpt/ - Daily Programming Thread

Old: What are you working on, Jow Forums?

Attached: IM%40S_Minase_Iori_Holding_Chest_C_Programming_Language.png (1164x1738, 2.17M)

Other urls found in this thread:

kvraudio.com/forum/viewtopic.php?t=350246
docs.idris-lang.org/en/latest/effects/depeff.html
os.phil-opp.com/hardware-interrupts/
guide.elm-lang.org/interop/
twitter.com/NSFWRedditImage

First for C

First for Javascript

Third for Go

How does one get a job in NYC? I've got roughly 1 year of professional experience and a CS degree.
Should I just start applying for every single junior position I can find?

What are you trying to do? If you have a year of experience and a CS degree you should have plenty of opportunities available.

5th for me, it's Zig

Attached: zig.png (960x226, 16K)

I made something almost useful in haskell
module OpenAddressing where

data Slot = Value Int
| Nill
| Deleted
deriving (Show, Eq)

type Table = [Slot]

hash :: Integral a => a -> a -> a -> a
hash k i m = (k + i) `mod` m

search :: Int -> Table -> Bool
search k t = go k t 0
where l = length t
go k t i = case t !! hash k i l of
Value v -> v == k
Nill -> False
Deleted -> go k t (i+1)

main = do
let table = [Value 5, Nill, Nill, Nill, Deleted]
print $ search 4 table
print $ search 5 table

/wdg/ isn't up right now sorry if I ask here. I'm working with javascript. can I nest an array into an object into an array? say for example I want to loop into peter's sons (no homo), can I use test[0].sons[i]?
var test = [
{
name: "peter"
sons: [
"frank",
"alex"
]
}
]

Anything really. I've got full stack web dev experience, as well as devops, Java, and C knowledge. I'm needing a radical change in environment right now. I've heard damn good things about NYC.

Jesus bro first off, learn to use a search engine.
Second off, just use an object?
Third off, /wdg/ is "up", look again.

didn't refresh the index. I tried googling but I didn't found the exact case scenario. what do you mean with just using an object? I have supposedly an array full of people and I can access the info using people[n].information but what if I want to store more similar info at the same time without adding objects like son1, son2, son3? what if peter is making babies nonstop and I need to loop into his hierarchy?

where in nyc

>Value v -> v == k
should probably be
>Value v -> v == k or go k t (i +1)

christ it would be easier to test this out than to make this post

Attached: 1539036022018.png (1024x796, 214K)

I'd network with as many people as I could. I'd also start contacting recruiters to get some last resort options. I wouldn't spam applications, but don't spend more than 15 minutes writing a cv or tailoring your res.

user I'm pretty sure dev tools would blow his fucking mind right now

>running kode str8 off of Jow Forums
it's like you want to be pwned n00b

shit shit shit should I install norton?

Looks like you're right. I didn't read my pseudocode all the way through. I also did the hash wrong
hash :: Integral a => a -> a -> a -> a
hash k i m = ((k `mod` m) + i) `mod` m

search :: Int -> Table -> Bool
search k t = go k t 0
where l = length t
go k t i = case t !! hash k i l of
Nill -> False
Deleted -> go k t (i+1)
Value v -> v == k || go k t (i+1)

possibly same for Nill -> False?

oh christ oh jesus oh jesus. will closing my laptop and putting it under my bed help?

no and v8 will segfault and you will crash your user's computadoras

So, I'm getting into audio programming in c++ and need to get some more DSP info, I know it's not exactly /dpt/, but any book rec's?

i guess the real question is how deep do you want to go, what is max nesting depth in a typical ecmascript implementation

nill is a base case, it deff means false. I also forgot that if the table is full then it will result in a infinite loop. You have to check i == l
search :: Int -> Table -> Bool
search k t = go k t 0
where l = length t
go k t i = if i == l then False
else case t !! hash k i l of
Nill -> False
Deleted -> go k t (i+1)
Value v -> v == k || go k t (i+1)

This is a bit more explicit, can you tell if it works the same as before?
search :: Int -> Table -> Bool
search k t = go k t 0
where l = length t
go k t i
| i == l = False
| otherwise = case t !! hash k i l of
Nill -> False
Deleted -> go k t (i+1)
Value v -> if v == k then True
else go k t (i+1)

Practical Signal Processing by Mark Owen.

kvraudio.com/forum/viewtopic.php?t=350246

KVR is a gold mine for anything DSP, but this takes the cake.

Is there a way to ping videos on sites like Pornhub to find out if they have been removed?

i've got it in my queue, thanks.
this is pretty cool

Attached: Ashita_no_Joe05.png (640x480, 452K)

python+urllib+beautifulsoup

stop watching 3dpd

I have the solid understanding of language fundamentals (variables, functions, pointers, recursion, logic conditions, loops, file/directory IO, etc.). I have reached this same point in C/C++, Java, C#/VB.NET, and Python, and which to go beyond now. Coding at work with VB.NET w/ WinForms, using OOP to manage and create searchable electronic copies of paper documents that we currently have, and eliminate future paper waste. I want to learn how to maximize my performance after completing my first shit-tier iteration of my programs. Any suggestions for free or good-value knowledge sources to really know when what I've coded is difficult to improve any further?

Also, I'll be coding a Java app for Android to gather even more info in the lab at work. Project should kick off in about 6-12 months. Learning material and software design guidance for that as well?

Pascal compiler targetting LLVM.

Clever post...
But can you design an ambiguous grammar that doesn't have people writing "struct . { .foo }"?

Attached: 43653358.jpg (960x814, 57K)

Lisp is the most powerful programming language.

>Nill

Is it possible to spoof the value returned by wmic csproduct get uuid? According to the MSFT documentation it's read only so I'm guessing it's a partially embedded component that can only read this value for the wmic interface.

I'm banned on a vidyer game and am pretty certain my uuid has been banned, the naive approach would be to spoof the uuid by either changing my actual uuid or the uuid piped into the game after being executed.

However the game has a CRC meaning i'd first have to find out how to make a CRC bypass (I have no experience in game hacking).

What is the best approach to this solution? Figuring out how to change my actual uuid or attempting to make a CRC bypass then changing the uuid with a memory edit?

how can one lang be so based and redpilled?

stop cheating and put your energy into learning ASM. Can't RE without it.

you get better as a programmer by programming more complex projects, not optimizing the shit out of small ones

>dynamic langs
>the truth
>being so shit you implore your user to create your own syntax
>not caring about the fundamental truth of types
definition of bluepilled

>struct . { .foo }
there is a code tag you monster, you fucking shriveled dismembered penis, what the shit is wrong with you

types are gay

t. brainlet

being pedantic doesnt make you smart

please quote me on where i was being pedantic.

Honestly, what's the point of Haskell if you can't do IO flexibly?

FP can do IO just fine.
Just because you have some restrictions doesn't mean it's not flexible.

>FP can do IO just fine.
yeah by cheating and breaking purity and being not-FP

Controlled side-effects can still be pure, that's how Idris does it.
docs.idris-lang.org/en/latest/effects/depeff.html

why jump through hoops to achieve the most basic function of a computer

It's not jumping through hoops. And because I like my programs stable and predictable, without run-time errors.

What is a job where I can use either C or Python. I am mostly interested in working with Linux or something and getting better knowledge of algorithms from practice because learning it in school didn't really do it for me. I'm a third year CS major looking for an internship. My grades aren't the greatest but I go to a top school for CS

That's a Haskell problem, where the IO monad is for a hell of a lot more than just input and output. It would be easy enough (if a bit mind numbing) to create your own monad with just getChar and putChar as primitive operations, rewrite some derived operations, and then interpret it in IO at the top level.

>cheating if you do
>jumping through hoops if you don't

Is there any reason to use JavaScript over TypeScript?

Attached: 1520532590070.jpg (3000x4500, 1.59M)

install Elm.
typescript can't enforce totality.

I got bored of programming. Don't understand how people have the patience to do long projects for free.
I would put in more effort if I could actually get something out of it.

Attached: CraftyMellowIndigobunting-small.gif (500x281, 1.1M)

>It's not jumping through hoops.
it is
if a language is purely function it requires complex abstractions just to model the basic functions of a computer

os.phil-opp.com/hardware-interrupts/

why do it for free if you're not getting anything out of it
do a project you can use or have fun with

Having restrictions means it's not flexlible.

You don't have to transpile. That's about it. So I guess maybe in some cases, where using TypeScript might not buy you that much, it's slightly more convenient not to use it. Or if you're working with others on a project, and they're not using TypeScript anyway.

Personally I don't use it in general because I don't care about the type safety stuff enough to bother.

ah yes, the basic functions of logic gates are to input a string and do arbitrary functions on it.
Mutability is not a basic function of a computer, it's just a side-effect. FP is a side-effect of people having discovered we don't have to live with mutability being a standard. And just because you don't understand it, doesn't make it "complex".
arguing semantics is not productive.

>And because I like my programs stable and predictable, without run-time errors.
no static analysis will completely save you from runtime errors
runtime errors aren't even hard to deal with in languages that aren't C

>Mutability is not a basic function of a computer
I guess my RAM is just sitting there doing nothing huh

>no static analysis will completely save you from runtime errors
tell that to no red inc who's front-end has experienced 0 RTE in the 4-5(?) years since switching to elm. And tell that to the hundreds of companies who've switched to haskell because obviously they just like to look at the funny arrows.

There are valid benefits to using a functional language, "I'm terrified of runtime errors" isn't one of them

>i'm going to sacrifice the stability of my software because i'm too lazy to put in the effort
the absolute fucking state of software """developers"""

hey jude

Did you know that reversible computers without side effects (at least for most operations) are poised to be far more energy efficient than current computers? Irreversible computation increases entropy and thus dissipates lots of energy. Disregarding resistance, a perfectly reversible computer would dissipate no energy at all.

This isn't that far-fetched to imagine - say that instead of ADD and SUB instructions you had a single ADDSUB instruction that output x + y and x - y. It's reversible, and doesn't increase entropy in an ideal model. Many instructions can be designed this way.

No static analysis tool can completely prevent you from illegally accessing memory unless it's a very simple program

Program logics and theorem proving are tools.

Other than "muh VMs", how can having a lot of RAM be beneficial for a programmer? Also, can RAM speed be beneficial for compile times?

Attached: ram-780x520.jpg (780x520, 89K)

You have an over 100k line FPL code base, operating for probably half a decade now with zero errors, Yes there's always that 0.000000001% chance it will eventually happen. But tell a company this fact and i wonder which language they'll choose.
Also what exactly is your point?
That less effort on the short term for far more time wasted bug squashing later is better? Yeah nah.

RAM is good if you are using an IDE or it can speed up compile times if you setup up your compiler to store everything in memory for the compilation process.

You can build GCC/clang safely.
But you could play with ramdisks i guess.

>Yes there's always that 0.000000001% chance it will eventually happen
If you allocate memory at runtime based on the size of a resource you're loading in, and then you treat it as an array and access that memory out of bounds it'll cause a runtime error, an no static analysis can save you from it

Directly. Faster RAM = faster compile. More RAM = less swapping = much faster compile. If you're not compiling Linux or Firefox or LibreOffice, half a gig of any memory should be plenty though.

How come the output of the following Python code snippet is the empty object, instead of an object containing kfLength and timeLength?

class AnimationState:
kfLength = 1
timeLength = 1

print(AnimationState().__dict__)
# output: {}

Attached: 1350594293765.jpg (500x500, 111K)

how do i make a tinder for blind people?

Explain for a brainlet
How does doing add and sub at the same time make the operation reversible?

>he doesn't enforce memory bounds by default
Go home pajeet.

I have an great idea for uberclone that has a completely different customer paragdim and guaranteed revenue of 10k/mo in my country. However, I have only done C/python etc so what should I look up for coding app itself?

Attached: 1540163319274.gif (500x281, 124K)

i have 32gb of ram is that good

>and then you treat it as an array and access that memory out of bounds
stop treating every language that it's C.

write it in python.

pick a fullstack solution because you'll eventually need a server.

you can enforce memory bounds at runtime, but that's no different than what any other language could do, you're still making the same efficiency/stability tradeoff

Preventing OOB is as easy as requiring proof that i < n before accessing an array of length n at index i. It doesn't matter where you got i and n from, as long as you have a proof. It's very easy to prove that i < n for an arbitrary n that you can't know ahead of time.
if (i < n) {
// congratulations, here's your proof
}

The difficult part is proving that i < n when you know some stuff about n but not everything, and you want to get more efficiency (and also not having to handle the case when i >= n) than checking it just in time.

Information is not lost, using the outputs you can produce original inputs.

Does elm compile to JS and can it interop with it, so it can be used to write plugins for greasemonkey/vscode/other shit?

because AnimationState().__dict__ holds the attributes for that instance of AnimationState, AnimationState.__dict__ will have kfLength and timeLength in it.

To build a browser? I doubt.

yes to all three.
guide.elm-lang.org/interop/

x = a + b
y = a - b

a = (x + y) / 2
b = (x - y) / 2

>To build a browser? I doubt.
I wonder how much faster chromium or firefox is when compiled with march=native? Anybody tested it?

Guess Il look into it. Im not kidding when I say it would provide comfortable life either