/dpt/ - Daily Programming Thread

Productivity edition.

Previous thread: What are you workin' on Jow Forums?

Attached: idolmaster_sicp.png (1165x1740, 2.49M)

Other urls found in this thread:

docs.microsoft.com/en-us/dotnet/framework/network-programming/socket-performance-enhancements-in-version-3-5
pyformat.info/
archive.is/mnbNo
youtube.com/watch?v=SlCRfTmBSGs
github.com/schemacrawler/SchemaCrawler
twitter.com/NSFWRedditImage

First for anime.

I have a .json like this:
{
"name-short": "",
"code": "10000",
"name": "1. Natural Sciences",
"child": [
{
"name-short": "",
"subchild": [
{
"name-short": "",
"code": "10101",
"name": "Pure mathematics"
},
{
"name-short": "",
"code": "10102",
"name": "Applied mathematics"
},
{
"name-short": "",
"code: "10103",
"name": "Statistics and probability"
}
],
"code",
"name": "1.1 Mathematics"
},
...


How do I map it to a table that only has fields like "name-short", "code", "name", "parent" (FK) in Django/Python/anything?

Thank you very much.

you're going to have to be more specific as to what you are asking for exactly

what is "parent"?

>get emailed for a follow-up
>they correct an typo in my resume that i've already sent to 60 companies
FUCK MY LIFE FUCK MY LIFE FUCK MY LIFE FUCK MY LIFE AAAAAAAAAHHHHHHH

Attached: 1528419407000.gif (300x300, 1.22M)

Foreign key of the code of the parent, e.g. null for the first one, 10000 for the child. 10100 for the subchild (made an error there, its empty in the original post).

and why is this hard exactly?

I am a newbie and I can not get it to work.

>sent work I was forced to quit, an email that I'd like to know if I could re-use/share some code I worked on
>literally the guy should be there, pretty straight forward answer because I mention specific files
>asked around 4PM, 99% of the days the guy was there later
>nothing
...

>got a referral for a VHDL position like 90 miles over
We'll see I guess.

Hi Jow Forums

I'm currently developing a service that calls the API of an ERP system. I'd like to implement socket pooling so I can safely. dispose u used connections. it will be with a configurable amount of socket that are kept open until there is an x amount of minutes of non-activity.

my question is what is the best way to implement socket pooling? I'm thinking of giving the base class all the connections functionality, and building a decorator to extend this class with pooling functionality, keeping them in a generic list. urrently writing this is c#.

To back this up

>Position he offered me has an average salary of 76k, minimum of 50k
>This would be my first ever job, but I'd have to move five hours away from home
Should I take it lads?

did you like pascal?

Attached: TurboPascalV7.png (1228x768, 363K)

no I like Nim

its the football guy from the old thread. ive just about got this thing nailed but i have one last syntax question. How do i make a list that contains all lists?
## All Players ##
all = [wrs, qbs]

## Sort By Projections ##
wrs.sort(reverse=True)
qbs.sort(reverse=True)
all.sort(reverse=True)

## Print List ##
for i in all:
print(i.name + " " + str(i.points))

const KNOWN_CHILD_NAMES = [ "child", "children", "subchild", "subchildren", "childs", "subchilds", "idontfuckingknowjesuschrist", "who created this stupid json format anyway'" ];

const output = [];

for (const item of input) {
process(null, item);
}

function process(parent, item) {
const ret = {};

if (parent) {
ret.parent = item.code;
}

for (const key of Object.keys(item)) {
if (!item.hasOwnProperty(key)) continue;

if (KNOWN_CHILD_NAMES.includes(key)) {
for (const child of item[key]) {
process(item, child);
}
} else {
ret[key] = item[key];
}
}

output.push(ret);
}

console.log(output);

all is a list that contains two lists, which means that when you do "for i in all" what is set to i is a list rather than a player. you'll want to instead do "all = wrs + qbs" or however you concatenate lists in python, which is a different syntax to indicate that you want to moosh the two lists together

also you don't have to sort wrs and qbs anymore, you will only need to sort all once you do it this way

Do it, 2 years experience are vital

thanks man. im having a blast and you guys have been incredibly helpful. Now that I know this thing works i can go to bed. Ill plug in the projections in the mornimg

thats just there in case i want to filter by position

have fun!

the absolute state of javascript jesus CHRIST that's fucking ugly

>if (parent)
HOW CAN ANY SANE LANGUAGE
LET YOU DO AN IF
ON A FUCKING OBJECT
??????????????????????????????????????????????????????????????

Hey man, if it works it works.

Use Async sockets.
docs.microsoft.com/en-us/dotnet/framework/network-programming/socket-performance-enhancements-in-version-3-5

erotic role play?

are you new?

You just need a little jq magic.
jq 'def f($parent): .code as $code | [{"name-short", $code, name, $parent}] + [.child[]? | f($code)[]] + [.subchild[]? | f($code)[]]; f(null)' your_file.json
[
{
"name-short": "",
"code": "10000",
"name": "1. Natural Sciences",
"parent": null
},
{
"name-short": "",
"code": "10100",
"name": "1.1 Mathematics",
"parent": "10000"
},
{
"name-short": "",
"code": "10101",
"name": "Pure mathematics",
"parent": "10100"
},
{
"name-short": "",
"code": "10102",
"name": "Applied mathematics",
"parent": "10100"
},
{
"name-short": "",
"code": "10103",
"name": "Statistics and probability",
"parent": "10100"
}
]

For your print statements learn the "new" way
pyformat.info/

There's a lot of weird and buggy behavior that I've run into with the C style print statements when you start doing crazier things.

How can i display it in a window? fuck that power shell shit

tkinter, qt, or wxwidgets lol

forgot to mention, there's also idle where you can write code and run the interpreter. might be closer to what you want but still ass

Because the scanner needs to stop reading ints until the scanner has any next int

Made it even shorter.
jq '["child","subchild"] as $p|def f($parent):.code as $c|del(.[$p[]])+{$parent},(.[$p[]][]?|values|f($c));[f(null)]' your_file.json

no when i run the script i want the info to pop up on a screen i can print out easily

>finish sicp
>last exercise is literally "lmao just use c, we were joking the whole book"

Attached: lispweenie.png (970x793, 40K)

>lisp is the best language in the world
>can't make a text editor
archive.is/mnbNo

Attached: kizunadots.png (340x556, 233K)

>tfw dead thread
Not like this

wagies are off to work.

jesus christ what is this abomination
just write a python script

jq is a command line tool for manipulation JSON, not unlike things such as sed or awk.
Why would I bother with all of the bullshit associated with writing in a "proper" language when I can use a more specific tool?
Also, the second one was deliberately made to be hard to read.

Why are you so obsessed with a language you don't like?

Did you commit something today user?
youtube.com/watch?v=SlCRfTmBSGs

Attached: extra.png (704x746, 843K)

i wan to have sex with kizuna ai

is it normal to forget simple syntax if you keep switching between languages?

yes
you'll get used to feeling out how exactly to do something in a given language
concept mater more anyway

I've been coding for over 10 years. I still have to reference docs for simple function calls occasionally. Especially after using a framework for a while

Using C++ is like having a cute anime girl sit on your face.

more like a fat uggo that's in tight clothing and 70lbs of makeup to look semi-passable.

No that's Java, C#, and other interpreted/GCd languages.

what up faggots
I'm working on a websocket server and python API

server:
> libwebsockets (C) (client requests)
> google protocol buffer
> tcp socket to circuit packs

client
> python API
> custom module
> google protocol buffer
> limited to local network

>bloated
>ugly
>tacked on new features
literally a fatty in too much makeup and tight clothes.

>bloated
lightweight codegen*
>ugly
Beautiful if you have good taste
>tacked on new features
Just her growing boobs

alright bjarne, get back to work.

I want Bjarne to sit on my face.

faggot

C allows it and so do I.

no it doesn't

it does sweetie.

go back to codecademy

since when are pointers objects?

I'm struggling to understand the interpolation part in perlin noise; I can't understand the function that's being used to convert the 4 dot products into one number. Any resources that can help me ?

Anyone know where I can find a script that takes as input a sql dump (or sqlite file) and outputs the database diagram (ideally in .eps or .svg but .png or .pdf is also OK)?
So far I have found github.com/schemacrawler/SchemaCrawler but this is too much bloat for what I need.

isn't there something like this built in to PHPmyadmin?

Since JavaScript objects were reference types.

if (my_ptr)

Don't confuse me with this retard: pointers are not objects

this doesn't even guarantee that it points to a valid memory region let alone an "object"

>getting flustered over implicit bools

What definition of object are you using here?

>life without types

I'm in the process of learning sql so I try to keep dependencies to a minimum.

There are various tools to generate an ERD from a DDL. Your db of choice should have some functionality to export a DDL.
But generally you would do it the other way around, create a diagram FIRST then use that to generate the schema.

Why do you need to export a diagram?

Not the guy from before, but you're a retard. Pointers to structs are not objects. Bait

Just booked a flight to a conferrence in Germany where I will present my AI paper.

Suicide

>He doesn't know about the forward declaration and first struct elements hacks

The only thing that keeps me away from C++ is the lack of dependency management. How can CMake's new FetchContent help me set up gtkmm?

have you tried vcpkg

in order to reference an object, the language you're using passes the pointer to the whole thing ...

No, nor do I want to. I tend to avoid patent trolls, even for pet projects.

You realize it does exactly what you want, is free and open source, and just manages the dependencies for you?

>dependency management

L

M

A

O

Just keep a template makefile around somewhere and adapt it to your project and link in any libraries you need. If the libraries don't exist you'll get a link error. Simple.

yes and I also believe it comes from the biggest patent troll in the history.

>Why do you need to export a diagram?
In order to get familiar with random examples I take from the internet (e.g. I like airplanes so I'm looking for some random toy-database about airports to get practice.)
I might also use the diagram to quickly get a numeric version of my database for my project when I want to ask questions online.

ok and why does it matter? some randos that happen to work for microsoft made a tool that does precisely what you need with no hidden bullshit and then you're like
>the only thing that keeps me away from c++ is the thing that I refuse to use

Why are there almost no successful commercial programs written in Haskell?

Is there a relevant (as in worth learning) programming language that doesn't require math? I'm very bad at math.

vcpkg isn't de-facto build system, not by a long shot. I, along with millions of others, do not care about it. On the other hand, the new CMake's FetchContent, which I mentioned earlier, does solve my issue but I don't know if anyone has used it yet. Why do you keep shilling vcpkg?

because im being paid to duh

How do i start writing sql on notepad++?
I need to do some sort of connection but I can't find how and where my username and password is. Im using xampp.

wolfram mathematica

that sounds like a job for some sort of LISt Processing language

tell your boss you failed

programming requires logic. not mathematics. there are functions within the programming language to take care of the math for you. You simply need to learn order of operation

What is your paper on user?

postgres
postgrespass

fetchcontent actually works ok
but it's basically one step away from just downloading the git repo and add_subdirectory-ing it in a top level CMakeLists.txt
Honestly C++ dep management is really easy IF you only use projects with well written CMakeLists.txt
You only get problems when trying to interface with libs with poorly written (or no) CMakeLists.txt

How do you run Turbo Pascal in 2018? Do you install it on DOSBox? How does that work now that it doesn't support floppy swapping anymore?

>Just keep a template makefile around somewhere and adapt it to your project and link in any libraries you need. If the libraries don't exist you'll get a link error. Simple.
Or just use CMake...

So not even considering the possibility of becoming a programmer due to my dyscalculia was a bad idea?

or just use a language with modules and package manager
>he unironically has to meta-program his compilation