/dpt/ - Daily Programming Thread

What are you working on, Jow Forums?

Previous thread:

Attached: Maguire.jpg (1427x1800, 188K)

Other urls found in this thread:

yegor256.com/
github.com/renancaraujo/trex-flame/blob/master/lib/game/t_rex/t_rex.dart
contest.cs.cmu.edu/295/f18/
cses.fi/book/book.pdf
youtube.com/playlist?list=PLpIxOj-HnDsPZIJYO4U9f-xRI8bBadaso
wiki.sei.cmu.edu/confluence/display/c/SEI CERT C Coding Standard
vst.cs.princeton.edu/veric/
datasciencecourse.org/lectures/
functionalcs.github.io/curriculum/
stevelosh.com/blog/2018/08/a-road-to-common-lisp/#lisp-as-a-system
wordaligned.org/articles/two-star-programming
stackoverflow.com/questions/5580761/why-use-double-pointer-or-why-use-pointers-to-pointers
twitter.com/SFWRedditGifs

Lisp is the most powerful programming language.

Javascript is C syntax form of Lisp.

I officially got an assignment in Java (after being a Python dev for the last year), and have never used it.

Any good tips or resources to share? Declaring types will be nice, though.

nth for nim!

I've got a live online technical interview coming up for a graduate role and I'm shitting it, I've never done one before.
What should I expect and brush up on?

Data Structures & Algorithms

last one for tonight, time to sleep.
good night /dpt/

Attached: 1536767933882.jpg (780x1000, 259K)

yegor256.com/

Have to learn F# as first programming language how fucked I'm I ? Jow Forums

Attached: Fsharp,_Logomark,_October_2014.svg.png (1200x1200, 29K)

good night, user.

It's hard to say without knowing what kind of interviews they do. They could be cool, or they could be dickheads that insist you answer their riddles on concepts you'll never use for your entire employment there. Or, in short,
>Data Structures & Algorithms

>Have to learn F# as first programming language
For what reason?

Why in the fuck?

Attached: 1520891537469.jpg (456x366, 100K)

good language choice.

only bad thing as a first programming language with F# is the msft cage.
It's easy to fix and it doesn't damage your brain.

Assembly x86 is the best fuck you

CISC is SHIT

First year at Uni they let down ADA for Ocaml but we had to write code imperative style most retarded choice possible I think and now we're starting F#.
At least we have access to all .net libs

I write LLVM IL directly without a front-end. Get on my level.

Is there some special name for C data structures that use memory offsets/indexes referring to elements in some contiguously allocated data where you'd normally just use pointers instead? I guess the primary use case is making it simpler to save/load them to/from files (or just mmap them with minimal parsing). I've seen those crop up in places, e.g. in the implementations hash table indexes in some database engines.

I guess in an object oriented language I would call those serializable objects, but there it usually implies that there's some special method to convert them to/from a serializable form, not that they are themselves implemented in a way that makes serialization trivial.

I'm not aware of any special terminology for that.

>Microsoft
>Bug-free code
Is that book a meme?

>Is there some special name for C data structures that use memory offsets/indexes referring to elements in some contiguously allocated data where you'd normally just use pointers instead?
...like an array?

>offsets/indexes vs pointers
What's the difference? If you have a pointer to the start of the contiguously allocated block, and an address to some element somewhere else in the block, then you can simply subtract the start pointer the data pointer to get the offset or index. Likewise, you could add the index to the start pointer to get the address of that element.

I'm not sure if I am understanding your question. Are you dealing with non-homogeneous data allocated in a single block where pointer arithmetic with respect to a single type wouldn't work?

how long it would take to be fluent in python

Couple days

I mean stuff like trees or linked lists where the child nodes / next elements are indexes of some object pool rather than pointers to objects in that pool. I guess it's to facilitate (de)serialization and/or the object pool moving around. I'm not that adept at C sorcery so I don't really know what to call this and how to google for it.

Indices are more robust than pointers since they survive reallocation and may take less space. Pointers are more straightforward though, so stick to them unless either of those are vital concerns.

*are indexes of an array in some object pool

What would you call that though?

Some languages have a notion of a trivial data type, which is similar to what you're talking about, but it's not exactly the same.

...

I'm trying to teach myself C. Give me a task to automate and I'll put my mind to it. It might help if you bully me a bit about it too.

by the way i'm gay if that matters at all

Trying to write a game using flutter. I'm looking at this source code as example material:
GitHub.com/renencaraujo/trex-flame
The asset he uses for all the images is a large sprite.png file.

But I don't understand how he is getting the individual sections of that out to use?

without looking at the source code, you generally draw specific areas of an image by using UV coordinates that are uploaded to the shader

It sounds like something I heard a bit about when an instructor I had a while back briefly talked about designing a file layout for a (possibly user defined) chunk of data that would be compatible with different versions of the same program. Part of the issue was changing offsets into addresses when loading, but making a table for that and a lookup function didn't seem too hard.

It also reminds me of manual memory management where you have a pool of memory chunks that you hand out or recover on demand. In the few times I've played with that, there was (again) a lookup table where you fed it a key, and it spit out the address. The idea is that if something got moved in memory, the key would still spit out the right data.

Both examples are technically linked data structures, but I wish I had a better term since searching for that turns up basic linked list stuff.

I have to learn COBOL as my first work related language.

I "think" I get that.

github.com/renancaraujo/trex-flame/blob/master/lib/game/t_rex/t_rex.dart

At the bottom of this file, right? The different segments?

I'm struggling a lot to try and make my own game. It's difficult to follow this as it makes done leaps with no comments at all

>At the bottom of this file, right? The different segments?
I can only assume so, but I have no clue seeing I don't know what engine you're working with. Honestly having different animations as different classes seems like a bad idea in the first place, if you're having trouble you could try finding different examples to learn with

The "engine" is Flame, but it's all just Flutter.

Kill yourself

I'm currently writing a Keyboard-only Desktop Web Browser in Haskell

It's actually easier to learn a functional language, all the concepts of elementary math apply like how functionals and variables work. You don't have to keep state in your head or step through any algorithms to see what they're doing, since you know exactly what they're doing as the state doesn't change. Things get hard when you have to keep track of shit changing on you

topcoder and the like has materials for this, or any 'competitive programming' book
contest.cs.cmu.edu/295/f18/ has some algorithm notes or there's this handbook cses.fi/book/book.pdf

based

what is the best way to learn c by myself? online? books?

I learned C++ by reading the entirety of cppreference. I'm sure you could do it for C

What is a good text editor/IDE that is lightweight and not in CLI? I have nano and intend to use it but I'm just starting to learn to code on my own in my free time and I'd rather not spend it wrestling with plugins or command line interfaces or hotkeys, I've been using Atom but I think it's fucking horrible and am hoping there are better options out there.

Windows or Linux?

Visual Studio Code is like Atom if Atom had been made by slightly competent coders.

I think a file with fixed-sized records is indexed with "record numbers", but that isn't C specific.

Of course your index numbers need to be native endian or converted or parsed, whichever case applies. Using indices by either record number and/or file offset is common in file processing.

Use a hybrid approach, both online and traditional books if you like. One of the more important things you could do is read the code of others and understand it.

A word about K & R and what
said about cppreference:
Both are excellent REFERENCES. If you already have familiarity with programming, you can go far with them. If you've never done any programming before, they are not at all good introductory texts for a total newcomer.

I'm on debian, wanting to learn Haskell. I also have vim which I also plan on using, but again I'd like to learn the code before before I also learn a text editor, I don't want to do both at once.

I use emacs for everything. It has pretty sane default for programming languages. I would just stick with the defaults until you cannot stand them anymore

Read K&R and do the exercises (realize modern C declarations are not done this way)
Now read CS:App or just watch the lectures: youtube.com/playlist?list=PLpIxOj-HnDsPZIJYO4U9f-xRI8bBadaso to learn compilers and assembly representation of C programs
Read through the SEI Cert C Standard, and everytime you write C, refer to it first wiki.sei.cmu.edu/confluence/display/c/SEI CERT C Coding Standard this is pretty much vital unless you want exploding code vuln to everything

Now you are ready for 'modern C' and can read 21st Century C which is a book (download pdf on libgen.org) on tools modern C programmers use. If you like C you might as well do verified C vst.cs.princeton.edu/veric/ as there is good money in working for NASA or whoever programming reliable code that can't fail, and must be compiled with verified compilers.

I would like to try spacemacs, I'm just not sure how resource-efficient it is. This laptop is newer but it's only got 4GB ram, and I heard emacs has a lot of shit like music players and irc clients, stuff which is honestly pretty cool but I don't really need on this machine.

You only pay for what you use my dude

I'm going to learn programming. Specifically web.

Redpill me on retarded shit to avoid

Avoid the web

>I'm just not sure how resource-efficient it is
It runs like shit. Doom emacs is better but something's always broken.

>Redpill me on retarded shit to avoid
web programming

Why?

I genuinely don't want to work with other people - I already do as a level 3 and have to deal with retarded fucks in helpdesk and other departments.

I figured web was easier to get into as a freelance instead of wanting to castrate myself daily working with others

>level 3
???

>he's only level 3

top kek

default emacs works fine, all you need is to add melpa and can incrementally add shit spacemacs has piled on as needed otherwise you have a million things eating memory. I have programmed OCaml for 4yrs F/T using only merlin mode and magit for addons.

>he's not a level 3

Basically: level 1 are the monkeys answering phones/reviewing tickets "yes sir I now reset password, me good employee!"
level 2: "oh I'm given admin password and only allowed to perform these tasks"
level 3: you fucked up six computers in the past fucking day, stop fucking around

Basically I'm the cunt being paid $60 a year to fix their shit and keep the CEO from spending retarded money on tech she thinks is "new and awesome"

I'd say I'm a sysadmin as per the title but fuck it, I don't drink

How can you expect to not work with people when it comes to software development? Even if you work on your own, there are still customers or users you'll have to communicate with.

>freelance

Do this 'practical data science' course and then whore yourself on Elance/Upwork ect ect. Most of the jobs there are for quick and dirty data cleaning/extraction and then cramming into excel format or something. datasciencecourse.org/lectures/

Start with an alarm clock that runs in the background and does some kind of alert when time is up (e.g. sends an email/text or pops a GUI toast or any other form of alerting).

This
It gets even worse when you're freelancing and dealing with even bigger morons than helpdesk.
"I want sort on this X"

"No.. I wanted sort!"

what's a good way to model a simultaneous turn based strategy game? think ff tactics but each player queues up their turns (one per unit) and the moves are resolved all at once once everyone is done.

I mean having to work with others to get the job done.
I see it in the dev teams now. Dickhead A wants dickhead b to finish their part so they can continue but dickhead b is a retard so they're slow and first dickhead A is bitching all week.

I don't mind customers/etc. Hell, I'll welcome that.

Thanks, user

I can handle this - I do it as part of the job with VARs trying to get me to do stuff.
Or with the dev team now.

I can still keep the job I have now - it's just with several hours of fucking around each day, I want to learn programming to make money. And before anyone asks why not learn stuff and get more money in a new job - a new job isn't going to give me about sixhours of free time a day

What is it like freelancing? How did you get started?

I'm working on pointing out some stack traces to retarded devs who don't understand remote debugging or why an OS has resource contention due to code that doesn't handle closing file handles.

I'm at the point where I am showing them the fucking line number and they don't get it.

Please don't be like them.

I cloned Shopify apps and then sold them in their store for 1/4 the price of competitors.
This worked for a while and then they banned me for no reason whatsoever.
But I had already built 'a network' so I just advertised myself on the various sites as 'Shopify freelancer' and then people paid me to clone the other Shopify apps as it was cheaper to have me hack together common lisp ultra pile of hacks than it was to pay some Shopify scam app $20/month

Shopify kept changing their API and I generally hate them so decided to try out toptal and freelanced there for a while, you get pretty much immediately hired to AirBnB on a contract basis. Pays shit, work is easy though.

Got tired of toptal and webdev in general so applied to my local university to write customized algorithms for post-doc researchers (no money here either) and did that for a few years on the weekend (I worked as a labourer F/T M-Fri). The last grant I was working on they wrote me a full recommendation and their work was highly cited leading me to a job in finance of which I am highly unqualified for and just bullshitted my way in. So here I am

>first programming job involves a gigantic C++ application with tons of moving parts
Wish me luck bros

>common lisp
People get what they pay for.

Rewrite it from scratch.

Sounds like quite the journey. Thank you, your post gives me hope. I'm also currently a laborer, shitposting on lunch right now in fact.

it still is a secret weapon tho I blasted out full MVPs in a weekend that implemented exact same functionality of thousand per year programs just don't ask me to maintain them with every breaking api change or claim its bug free

Explain this to me please since all I know is powershell.
I'm assuming you cloned the apps directly so how the fuck did you not get sued?

I feel like I'm missing it. Was it the same stuff but just a knockoff like how tetris has a billion ideas, so you cloned it, put a different skin on it or what?

i maintain this if you're interested
functionalcs.github.io/curriculum/

it's just shit I found that helped along the way there's no reason to do everything there whatsoever only what you are interested in doing. I lurk this thread weekly since some random user taught me boolean functional analysis here a long time ago

Yes I carefully reworded and redesigned things, so if the app implemented a desktop type thing I made sure to change it so it didn't look the same. I also added 10x more features. Most of the patents are for actual design, like say an exchange site. There's a reason you never see a site where both the bids and the ask converge into the middle because that design has been patented by some troll who sues people (they tried to sue me, I have nothing and used a shell corp named after infamous Stephen Glass scam company 'junketronics'.

Like, for example, Zapier. Anybody can reimplement exactly what Zapier is doing using basic common lisp, tomorrow afternoon in their spare time. It won't be nearly as tested or reliable of course but then again, it will cost 1/4 the price. On top of that you throw in some new features, like say, Zapier that interacts with MailChimp or maybe shits out Quickbooks format, btw everybody wants Quickbooks format and nobody provides it for any reasonable cost. You then call your app 'Quickbooks Extractor' or something but secretly you've also cloned Zapier, and list those features without highlighting them and they go undetected for a couple of months.

Apparently now they implement mailchimp, maybe it was due to my terrible hacky shopify clone stealing their income. My DSL I rolled is laughable as I look back since I had no idea what I was doing at the time yet somehow it still worked without ever needing support. This is what I love about common lisp you can get away with being completely out of your league and somehow hack your way to a spot at the table bluffing as you go since you can hand test everything on the fly. stevelosh.com/blog/2018/08/a-road-to-common-lisp/#lisp-as-a-system

Today I would never do this but anybody here if you want to just hack on cruise control and have no clue what you're doing, but somehow it just works anyway, Common Lisp is your go to language.

Attached: HolyC_prophet.png (700x700, 767K)

>Shopify
fuck this pile of crap. a company I used to do some work for replaced their highly customized SAP hybris system with this crap because of all the shilling and as far as I know they had to give up most of the features they wanted and it looks like shit now

they probably pay more too, you can weasel favorable contracts out of stripe and other payment processors if you avoid shopify

>want to get the metafield values out of my products on shopify
>the only way to get them is one product at a time via /product/id/metafields.json
>200,000 products -> 200,000 api calls
>2 api calls per second
rip

For Haskell, I would say just learn to use Vim. Or start with Atom and gradually move to Vim.

Go back to your containment thread.
Webdev garbage is uninteresting as fuck.

Attached: 1527056827122.png (641x490, 306K)

I got around this by putting all my meta data in the note_attributes field of an order. No way could my services have to ping the endpoint each and every time.

i still haven't found a use case for function pointers and pointers to pointers.

at least i figured out pointers.

>function pointers
Classic example from the standard library: qsort and bsearch.
Otherwise they can be useful for dynamically loading a "backend" of some sort.
>pointers to pointers
They're useful for the exact same reasons pointers are. However, the classic example is deleting elements from a singly linked list in a very elegant way.
wordaligned.org/articles/two-star-programming

anytime you have a large if chain or switch statement deciding what to do
you could just replace it all with mapfunction[x]

You can write webAsm in C/C++ using the released prototype so we're all webdevs now

read Pointers on C by Kenneth Reek. the best C book by far and with emphasis on pointers (in depth understanding and use cases like you just described)

thanks, i guess i need to read and practice more

>working with react native
Just fuck my shit up

Attached: just-fuck-my-shit-up.jpg (908x703, 52K)

>why use double pointers
This is what stackexchange is for
stackoverflow.com/questions/5580761/why-use-double-pointer-or-why-use-pointers-to-pointers

Kusuo Saiki for the fuckin win