[ 3 / biz / cgl / ck / diy / fa / g / ic / jp / lit / sci / tg / vr / vt ] [ index / top / reports / report a bug ] [ 4plebs / archived.moe / rbt ]

/vt/ is now archived.Become a Patron!

/g/ - Technology

View post   

[ Toggle deleted replies ]
File: 2.49 MB, 1165x1740, idolmaster_sicp.png [View same] [iqdb] [saucenao] [google] [report]
67047780 No.67047780 [Reply] [Original] [archived.moe] [rbt]

Productivity edition.

Previous thread: >>67040628

What are you workin' on /g/?

>> No.67047803

First for anime.

>> No.67047854

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"
"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.

>> No.67047891

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

what is "parent"?

>> No.67047923
File: 1.22 MB, 300x300, 1528419407000.gif [View same] [iqdb] [saucenao] [google] [report]

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

>> No.67047925

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).

>> No.67047939

and why is this hard exactly?

>> No.67047954

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

>> No.67047985

>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

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

>> No.67047995

Hi /g/

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#.

>> No.67048005

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?

>> No.67048009
File: 363 KB, 1228x768, TurboPascalV7.png [View same] [iqdb] [saucenao] [google] [report]

did you like pascal?

>> No.67048040

no I like Nim

>> No.67048049

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 ##

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

>> No.67048050

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];



>> No.67048065

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

>> No.67048071

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

>> No.67048073

Do it, 2 years experience are vital

>> No.67048077

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

>> No.67048086

thats just there in case i want to filter by position

>> No.67048089

have fun!

>> No.67048095


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

>if (parent)

>> No.67048103

Hey man, if it works it works.

>> No.67048108

Use Async sockets.

>> No.67048109

erotic role play?

>> No.67048155

are you new?

>> No.67048156

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"

>> No.67048184

For your print statements learn the "new" way

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.

>> No.67048222

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

>> No.67048240

tkinter, qt, or wxwidgets lol

>> No.67048255

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

>> No.67048266

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

>> No.67048306

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.67048379

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

>> No.67048405
File: 40 KB, 970x793, lispweenie.png [View same] [iqdb] [saucenao] [google] [report]

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

>> No.67048433
File: 233 KB, 340x556, kizunadots.png [View same] [iqdb] [saucenao] [google] [report]

>lisp is the best language in the world
>can't make a text editor

>> No.67049288

>tfw dead thread
Not like this

>> No.67049303

wagies are off to work.

>> No.67049315

jesus christ what is this abomination
just write a python script

>> No.67049384

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.

>> No.67049411

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

>> No.67049611
File: 843 KB, 704x746, extra.png [View same] [iqdb] [saucenao] [google] [report]

Did you commit something today anon?

>> No.67049738

i wan to have sex with kizuna ai

>> No.67049783

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

>> No.67049864

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

>> No.67050198

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

>> No.67050224

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

>> No.67050247

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

>> No.67050258

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

>> No.67050266

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

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

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

>> No.67050272

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

>> No.67050297

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

>> No.67050307

alright bjarne, get back to work.

>> No.67050345

I want Bjarne to sit on my face.

>> No.67050361


>> No.67050480

C allows it and so do I.

>> No.67050596

no it doesn't

>> No.67050604

it does sweetie.

go back to codecademy

>> No.67050623

since when are pointers objects?

>> No.67050641

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 ?

>> No.67050643

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 https://github.com/schemacrawler/SchemaCrawler but this is too much bloat for what I need.

>> No.67050693

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

>> No.67050694

Since JavaScript objects were reference types.

>> No.67050710

if (my_ptr)

>> No.67050721

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

>> No.67050724

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

>> No.67050729

>getting flustered over implicit bools

>> No.67050730

What definition of object are you using here?

>> No.67050738

>life without types

>> No.67050742

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

>> No.67050766

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?

>> No.67050778

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

>> No.67050797

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

>> No.67050801


>> No.67050831

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

>> No.67050853

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?

>> No.67050884

have you tried vcpkg

>> No.67050889

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

>> No.67050900

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

>> No.67050912

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

>> No.67050913

>dependency management





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.

>> No.67050934

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

>> No.67050949

>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.

>> No.67050963

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

>> No.67050976

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

>> No.67050985

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

>> No.67051004

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?

>> No.67051021

because im being paid to duh

>> No.67051026

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.

>> No.67051034

wolfram mathematica

>> No.67051039

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

>> No.67051040

tell your boss you failed

>> No.67051057

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

>> No.67051062

What is your paper on anon?

>> No.67051076


>> No.67051095

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

>> No.67051097

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?

>> No.67051104

>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...

>> No.67051163

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

>> No.67051192

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

>> No.67051213

The actual bad idea was believing in meme disorders.

>> No.67051217

A pointer doesn't have to point to a valid memory region.

>> No.67051234

Ok that's exactly what I said?

>> No.67051240

You act like that's a problem?

>> No.67051247

you'll never make it in school - but you don't need school to be a good programmer

>> No.67051269

They've written software to cure dyslexia (FMRI scans, etc ahoq ir). Write some to cure dyscalculia. You'll get all over memebook.

>> No.67051291

You are wrong. Programming is one of the most difficult branches of applied mathematics; the poorer mathematicians had better remain pure mathematicians.

>> No.67051313

Yes it is a problem.

>> No.67051338

>if I used a function or value incorrectly it is a problem


You ever heard of side effects?

>> No.67051430

I'm not wrong. It's dependent on what you're coding. For scientific purposes or applied sciences or any number of very specific jobs you might use higher level math. But for stuff like web devs (the weebs of programming) it's rare you'll use anything past basic arithmetic

>> No.67051438

the absolute state of /g/

>> No.67051535

Using CMake is FAR from simple.

>> No.67051624

>if you're bad at maths you should do more pure maths

>> No.67051778

mysqlworkbench has this feature and every other feature you could imagine, if you can survive the godawful ui

>> No.67051791
File: 15 KB, 306x235, augustus.jpg [View same] [iqdb] [saucenao] [google] [report]

>documentation for new version of Thing that describes how Thing works in terms of differences from how the old version of Thing worked instead of actually describing how Thing works now, requiring you to know how old Thing worked to understand new Thing docs

why do people do this?

>> No.67051808

You're looking at the version notes. Look at the documentation.

>> No.67052645
File: 2.60 MB, 852x1403, 1488200638499.png [View same] [iqdb] [saucenao] [google] [report]

>rejection after rejection after rejection

I am giving up. It's infuriating how people get things so easily, especially here. How to move forward when I bleak compared to peers? It is basically killing my remaining pieces of motivation.
If going through interview, should I answer flawlessly on every question in order to be accepted?

>> No.67052723
File: 46 KB, 480x480, 1533171477522.jpg [View same] [iqdb] [saucenao] [google] [report]

>interview for senior dev position tomorrow
>still don't know how to use git
send help

>> No.67052747

pull, commit and push

>> No.67052754

lmao what. codemonkeying uses literal kindergarten-tier math

>> No.67052795

>previous thread
>a noob needed to associate names to mapped values in a way that preserved the names and was confused as to why bare variables weren't working
>someone suggested a horrifically hackish OOP approach
>an FPfag got mad and suggested the much cleaner but still pants on head retarded approach of two arrays
>FUCKING NO ONE suggested using a dictionary, hash table, or key-value BST
holy shit how is /dpt/ this fucking stupid
I'm surprised at the FPfag in this equation, you fuckwits are supposed to be all about the fucking type sophism and yet the one time it actually matters you get the type shit wrong
what the fuck is wrong with you idiots

>> No.67052816

How have you never used git but you're applying for a senior position?
Software is such a fucked industry because of you shitters.

>> No.67052863
File: 981 KB, 901x631, dpt1.png [View same] [iqdb] [saucenao] [google] [report]

This is the whole thread summed up in one picture.

>> No.67052878


>> No.67052932

I hope I get this job, looking for one sucks. Shit's been bumming me out and I can't focus long enough to work on anything other than small programming challenges. Done so many at this point every programming or algorithms question I got in the interview process was a variation of something I've seen in the past and I finished in like 1/3 of the time.

My main project right now is a 3d engine but I kinda want to take a break from that once I start working on them again. I was thinking about doing something with embedded programming or even FPGAs since I was originally studied EE in school, don't know what I would make though.

>> No.67052999


No it isn't.

>> No.67053253

What IDE do you use for Rust? So far VS Code looks like a decent option

>> No.67053266

Pretty much. I heard intellij also works, no idea though

>> No.67053323

Honestly CMake is actually really simple, if you only use the safe functionality, much like C++.
Problems arise when people use unsafe CMake functionality.

>> No.67053336
File: 26 KB, 713x611, 1518197759996.png [View same] [iqdb] [saucenao] [google] [report]

that pun was my daily dose of autism

>> No.67053350
File: 4 KB, 225x225, images.jpg [View same] [iqdb] [saucenao] [google] [report]

These threads are always so overwhelming, jesus christ.

I don't even know where to start. What are the closest tools and languages to the industry standard? I'm terrified of learning something only to find out it's not widely used or not even remotely good for what it's usually used for.

>> No.67053353
File: 16 KB, 174x231, 1517451954285.png [View same] [iqdb] [saucenao] [google] [report]

Oh shit, I didn't even intend to

>> No.67053371

what industry? what do you want to program?

>> No.67053384

Haha. Did you just get ass fucked? How did it feel, faggot?

>> No.67053410

give me ideas for an impressive github

>> No.67053478

This is a bit of a long shot but i'll ask anyway. I have a kubernetes pod with two containers inside. unfortunately both containers expose port 80, one of them being nginx. the nginx image inherits 'EXPOSE 80' from its parent image, and as far as I'm aware there is no way to unexpose a port on a child image when the parent image exposes it.

How do I get nginx to stop listening to 80 so my other container can function correctly?

>> No.67053654
File: 1.68 MB, 332x332, 1517789072718.gif [View same] [iqdb] [saucenao] [google] [report]

How can I average two angles?
Like the average between 1° and 359° should be 0° and not 180°

>> No.67053698

make unit vectors for both angles and average them then get the angle of the resulting vector

>> No.67053707
File: 238 KB, 623x735, 1493696226397.jpg [View same] [iqdb] [saucenao] [google] [report]

I don't get it

>> No.67053708

(a_1 + a_2) / 2 % 180

>> No.67053725

incorrect result for 0° and 270°

>> No.67053735

That's pretty smart. But I'd have to use arctangent I guess

>> No.67053775

Im desperately looking for an idea for some project... Really cant get anything, I really want to code hard but have nothing to do.

>> No.67053790
File: 103 KB, 270x320, 1517265981080.png [View same] [iqdb] [saucenao] [google] [report]

A Rust interpreter

>> No.67053798


>> No.67053813

not him but how ?
0 + 270 = 270
270 / 2 = 135
135 % 180 = 180

>> No.67053817

poobrains -> intelij IDEA

>> No.67053881

the correct result would be 315

>> No.67053911

why are you replying to obvious bait, anon?

>> No.67053915

I'm honestly not sure. What's a versatile language to test the waters so to speak in a couple different ares?

>> No.67053933

ok got it
func mid_angle(float a_1, float a_2){
float a = min(a_1,a_2);
float b = max(a_1,a_2);
return ( a + (b-a)/2 ) % 180

>> No.67054038
File: 155 KB, 1440x810, 1520598460890.jpg [View same] [iqdb] [saucenao] [google] [report]

the best thing to do is just get started honestly. in school i was waiting to learn enough shit to actually make things, but by middle of junior year i just realized they never actually teach you shit. just think of an idea and then find pieces of it that already exist and look at how they do it.

>> No.67054056

also that didn't really answer your question, but it depends on what you're making. in general probably python unless you're doing something that has to be really fast.

>> No.67054089

Thanks for the advice, man.

>> No.67054295

Good analogy.

>> No.67054353

Are you me?
Anyway, true, the best way to learn a language is to write programs in it.

>> No.67054429

I'm developing a website using PHP and have a question about database queries.

Are there any disadvantages when you use mysqli::query() instead of prepared statements? Assuming every input is escaped using mysqli::real_escape_string()?

>> No.67054435

People who don't understand why this is the case don't understand math well enough to know what qualifies as math. They're thinking "durrrrr, programming math is never higher level than base-2 simple arithmetic, I knows me some calculies, how can u be bedurr @ mafs den mee." They ignore the issues of set theory, category theory, number theory, matrix arithmetic, and big-O analysis.

>> No.67054484

Well, no, it's also C++.
Using C is like having a cute anime girl sit on your face.
Although, to be fair, C++ is a lighter and less ugly girl than langs like Java. She doesn't need makeup, because unlike them she's already pretty. Just also fat at the same time.
I prefer C because I feel it's more elegant. I think with my brain. However, if I thought with my dick, I would definitely prefer C++.
I mean don't fucking tell me you'd rather be facesat by a skinny twig than a gorgeous-with-an-emphasis-on-gorge queen of thicc.

>> No.67054499

C doesn't have objects

>> No.67054524

Yeah it does. Records are objects.
I think what you mean to say is that C doesn't have OOP.

>> No.67054533

Are you retarded? Is this bait?
There are so many situations where you want to know if a value is initialized or not. Every sane language lets you do this.

>> No.67054611

Not him but it's stupid because it makes the behavior of conditionals unpredictable.
In languages in which object references are both nullable and address-exposing -- e.g. C -- it makes sense, because a value is uninitialized IFF its reference is null, its reference is null IFF the address exposed by that reference is zero, and a value is falsey, as opposed to truthy, IFF that value is zero. In JS, NONE of these axioms hold.

>> No.67054633

I guess that's JS's problem, then. I just think if(object) is much cleaner than the incessant (if object != null) you get with Pajeet Java/C# code

>> No.67054635

Hopefully I can start working on my RSS/Atom to email program tomorrow so I can finally ditch Reddit.

>> No.67054698

why not radians?

>> No.67054720

Uhhh... fampai, other people have already solved all those problems... you just drop in their solutions using templates

>> No.67054735

Hi, OOP anon here. I think this is bait but in case it's not, what do you think makes it hackish? At the very least, organizing the name and score together is pretty clearly the cleanest solution here. I don't know anything about python so if I was supposed to use some tuple, or pass a lambdas to sort instead of declaring __lt__ on the class, I can accept that. But the reason to have the two values we care about together rather than have a mapping of name to score is simple. For one, what OP wanted on the conceptual level is in fact a list, not a dict. For another, we can more easily add more data to the structure this way. And, of xourse, conceptually what we are dealing with here ARE objects. This is the thing about OOP. Trying to categorize abstract shit like BeanFactoryManagerFactory into a world of objects is pain. You know what's not pain? Organizing concrete objects like football players into a world of objects.

Remember kids. OOP: there's a time and a place, and taking a hard stance categorically just makes you an edgelord.

>> No.67054766


This is the most virgin post I ever read

>> No.67054777

I do too. It's very convenient. But I just prefer for features like that to be grounded in the rest of the language design, and actually make sense in the context of the rest of the language's rules, as opposed to just being thrown in for convenience's sake.

>> No.67054795

What did you expect? You're on 4chan after all. That said, xer post was a bit too autistic.

>> No.67054807

what is the definition of OOP?

>> No.67054857

Or message passing if you're an autist like Alan Key

>> No.67054889

I'm thinking of making a game for my undergrad dissertation, but I'm afraid it'll be too much to handle, on top of the regular modules and exams I'll have for the year.
Has anyone here done something like that for their dissertation? What's it like? My fall-back is an Android app with a focus on backend stuff.

>> No.67054916

Make some struct type Foo. Foo contains a vptr. Every struct type which contains a Foo as its first element is a subtype of Foo and a pointer to Foo can refer to any of these subtypes.

There's your polymorphism.

>> No.67054992

>Every subtype contains Foo

Jesus Christ anon. This is basic composition, it doesn't reflect a hierarchy. This is not an "is a" relationship, so it's not polymorphism it's just another C hack masturbation

>> No.67055017

>what do you think makes it hackish?
The involvement of an ad hoc class, mostly.

I don't know anything about Python, but I do know that if all you need is to group data together, there's simply no place in that system for information hiding. You don't need a record with a public and private scope, in which the private scope stores the data ("instance variables"), the public scope stores references to functions that each take an implicit receiver parameter and have access to that receiver's private scope ("methods"), both scopes are allowed to feature data or function references shared across all instances rather than on a per-instance basis ("static"), and it's possible to construct more datatypes of the same datakind I'm now describing -- namely, OOP classes -- that are considered subtypes and share the function references but have their own unique private data as well as their own further function references ("inheritance").

You don't need that kind of record here. All you need here is just a record. The barest, simplest sort of record will do. At its core, such a bare record is simply a single scope -- associating symbols to data, as any scope does -- with the key difference that said scope is reified as data, can be referenced like any other data, and allows, via that reference, entry to the scope.

Now, I agree with you, that a record type should be used here to group name and value together, even if I don't agree it should be a class. However, we might even disagree on the necessity of uniqueness for that record type. You suggest a record type should be created for the purpose, but I suggest a more generic / algebraic approach might be more effective, especially in the context of a larger program in which similar tasks on other data might be necessary.

>> No.67055027

The behavior is that of subtype polymorphism. The fact that you don't like it doesn't change that the same effect is achieved.

>> No.67055034
File: 130 KB, 270x314, 1491498723216.png [View same] [iqdb] [saucenao] [google] [report]


>> No.67055057

Which header only general utility library do you use for C?
Should implement at least commonly used containers, cross platform directory handling, cross platform threading, cross platform networking.

>> No.67055072

>Header only

>> No.67055091

The fact that you like it doesn't mean composition is equivalent to subtyping.

>> No.67055098


>> No.67055100

Fuck off Bjarne.

>> No.67055108

It can behave in either way. Subtyping is invariably implemented using composition.

>> No.67055144

C++ is the only language where a header only library makes sense.

>> No.67055203

C compiles in milliseconds. If you use incremental compilation in C you're literally retarded. Header only files are better in every possible way.

>> No.67055210

>tfw finding out about boost spirit after trying to write my own parsers for massive datasets and just giving up
this is amazing
also how into metaprogramming

>> No.67055217

Only in the world of C hacks

>> No.67055235

The semantics of the inline keyword in C are botched and also necessary to the writing of header only libraries. Using header only libraries in C means tons of redundant code in your binary..

>> No.67055239


Namely, I think you're onto something with this:
>so if I was supposed to use some tuple,
Why come up with several new record types to group specific data together, when you have a general way of grouping data together available?
footballPlayers :: Num a => [([Char], a)]

But, wait, what does this type remind you of? We're essentially dealing here with data that has names, in which the names themselves are important as data. This is exactly how one might describe key/value pairs.
footballPlayers :: Num a => Map [Char] a

We have discarded some information here though. The obvious problem with this, as you've already pointed out, is that it doesn't satisfy the OP's requirement that the key/value or rather "name/data" pairs are organized in a list structure.

Well guess what?
footballPlayers :: Num a => OMap [Char] a

Associative containers are just inherently the most natural way to store named data where the names are important. I mean even if we did just go back to
footballPlayers :: Num a => [([Char], a)]
Then we're still TECHNICALLY talking about dictionaries. Lists of non-nullary, non-unary tuples are pretty much inherently dictionaries. If there's one specific element of the tuple that serves more naturally than any other element as an identifying feature of the tuple in the collection -- for example, a NAME -- then it just makes sense to make it official.

>> No.67055288

again, your C code should only be a single translation unit (unless you're retarded). Every competent single-header lib is static-inline and designed for this use-case.

>> No.67055319

It must be nice working on nothing but 5k loc personal projects where single translation unit builds are feasible. In the real world incremental compilation is mandatory and header only libs are harmful.

>> No.67055406

I'm thinking of refactoring my project into something more functional. Right now, it's OOP. This is what it does:

1. It takes configuration info and user input and plays sounds over time. The configuration info is static; it will not change in this context (a whole separate module does that).
2. Subsequent user input can change the sounds.
3. Certain configurations can cause it to change sounds totally absent any new user input.
4. Eventually, the sounds will end based on a specific user input, but also a factor of configuration (can be delayed).

Right now, I take user input and config data and create an object that starts playing sounds. Changes to user input result call a method on that object that changes the sounds. The object has an internal timer that handles configuration based changes to the sounds. A final user input calls a method on the object that starts the end of sounds. Since how they end is based on the config data, that is also handled using the internal timer.

I could make that object into some kind of state monad where user input method calls return a new object with the new state, but what to do with the old object? It still has the original state, but that state isn't valid anymore as the actual sound producing stuff (in DirectX) was changed.

Does this make any fucking sense?

>> No.67055418

I don't even want to know what kind of cancerous projects you're building. I compile 172,000 lines of C code in 3.5 seconds, and this is on my home machine. No incremental compilation.

I don't pull in any of the standard library though.

>> No.67055428

Forgot to mention this is with Clang. GCC takes 12 seconds for some reason. MSVC takes 5.

>> No.67055558

I, too, like to larp.

>> No.67055571

>new effective modern c++

>> No.67055592

Piggybacking on this, how do I get RLS to actually work in vscode? I have the extension installed but it doesn't seem to do anything.

>> No.67055602

Can i pass a class to an entire list? I have a working script for a fantasy league im in but id like to make it a little easier to edit
## League Scoring Rules ##

class TE:
def __init__(self, name, rtd_count, ryd_count):
self.name = name
self.points = (RTD_WORTH * rtd_count) + (RYD_WORTH * ryd_count)

def __lt__(self, other):
return self.points < other.points

## Tight End List ##
tes = [
TE("Gronk", 11, 800),
TE("Aaron Hernandez", 0, 0),
TE("Evan Ingram", 8, 700)

ideally id like to have all my lists in seperate files since they can be very long. id like to import those lists with their arguments and then pass the class to them in the main file. Im stumped. Any pointers? Script works now but i feel it could be better

>> No.67055630
File: 33 KB, 629x505, 1468178300030.jpg [View same] [iqdb] [saucenao] [google] [report]

>validation loss remains the same
>validation accuracy slowly creeping up
Another 5 hours wasted

>> No.67055645

Emacs unless you're a brainlet.

>> No.67055654

You can store the list as JSON in a separate file, then open() + json.loads() and build the list of objects if you want. Or you can just store the list in a separate file as a list of dicts and just import it, then map() it to a list of objects

>> No.67055663 [DELETED] 

dumb frogposter

>> No.67055666

thank you i was importing it but didnt know about the mapping step

>> No.67055683

You can design a csv to store your data and then read the csv into your program logic. This gives you the added bonus of being able to use your data for the program along with being able to pump out excel/librecalc analysis and charts based on the original csv file.

Not sure of your goals but in the future you might want to look at matplotlib https://matplotlib.org/tutorials/index.html

>> No.67055706

awesome thanks for the link

>> No.67055717

Interned at Google, AMA

>> No.67055819
File: 55 KB, 778x512, 1518664512583.jpg [View same] [iqdb] [saucenao] [google] [report]

>how into metaprogramming
bumpity bump

>> No.67055848
File: 528 KB, 1920x1080, easier to read.png [View same] [iqdb] [saucenao] [google] [report]

come to dailyprog... let it consume you

>> No.67055852

C++ metaprogramming is shit and most of the absurd shit necessary in older versions of C++ is obsolete now.

You want to do metaprogramming in C++ anyway? Learn about templates, template specialization, constexpr, SNIFAE and the type_traits library.

>> No.67055866

dumb frogposter

>> No.67055872

thanks fren
i will say that in hour since I posted that i've been reading through boost's bundled documentation (not the one on their website, it's crap) and it's actually somewhat helpful

>> No.67055883

If you use boost you're worse than a pajeet. absolute cancer

>> No.67055887
File: 84 KB, 533x700, 1402255283186.jpg [View same] [iqdb] [saucenao] [google] [report]


>> No.67055906

what langs are good for it then?

why is it cancer?

>> No.67055909

kill yourself

>> No.67055925

Care to explain why?
Because while I can tell that a lot of it is unnecessary bloat, I've been searching for something that allows me to create both a parser and emitter without a shitload of boiletplate and Spirit seems perfect.

>> No.67055931

Lisps are the goto languages for metaprogramming due to minimal syntax and homoiconicity (read: Lisp syntax tree is also its fundamental datatype).

>> No.67055935

Prolog,ML(metalanguages),Lisp begin metalanguages theory several type checker or prototype language begin build on it.

Macro book about Lisp

>> No.67055939

so i just tried that and it gave me a similar error of
TypeError: '<' not supported between instances of 'tuple' and 'TE'

>> No.67055963

Literally just write your own using standard string functions. It's like an hour of braindead grunt work and then you don't have to touch it again, and it'll save you many headaches in the future. And your compile times won't bloat.

>> No.67055965

commit self-kill

>> No.67055967

Look up hemlock, climacs, and zmacs.

>> No.67055991

That doesn't work when the data you're working with is like an average of 150,000 lines of malformed xml per file with syntax that's often only used once.

>> No.67056008

ignore lisp shills
install nim
>AST manipulation
>User defined operators

>> No.67056039

Yes, Nim is good.

>> No.67056072

eh, the official docs are great too.

>> No.67056084
File: 65 KB, 400x565, trannygranny.jpg [View same] [iqdb] [saucenao] [google] [report]


>> No.67056094

I do like it though

>> No.67056104

as disgusting as sepples
absolutely trash

>> No.67056115

You can actually make stuff with Sepples however.

>> No.67056127

It should just work once you have RLS (rustup component add rls-preview) and the extension installed.

>> No.67056129 [DELETED] 

fs nobody wants juicy google drama?

>> No.67056135

Is it as SJW as everyone says? Are there dilating stations?

>> No.67056147

fuck off you absolute attention whore no one cares.

>> No.67056152

So basically for a missile system you can just make the direction vector and interpolate the position with it over time but what if I wanted the missiles to, say, swing around as they go towards the target? I could use sin/cos from the time on that but wouldn't it fuck up reaching the target?

>> No.67056165

80 work hours per week?

>> No.67056171

I made a sexbot that does backflips on the dick in forth bro..... you watch THAT DIRTY MOUTH

>> No.67056176 [DELETED] 


Not everyone is an SJW, but there are a lot. You just learn to nod and listen to them spout their BS because otherwise you'll end up with a visit from HR and Yes At Google(anonymous report forum shit).

The SJWs flock at anyone going against them on internal forums like pack of hyenas

>> No.67056185

I too worked in advertisement in the past, but I don't make AMAs on programming threads.

>> No.67056197

45, but I waste around 10 of those hours browsing internet. Some people work crazy hours however.

sry bro

>> No.67056204

Stepwise refinement is based and redpilled.

>> No.67056222

Real salary before beneficies?

>> No.67056226

Still have problems? What OS?

>> No.67056234 [DELETED] 

Depends on where you are.

8000 euro in Zurich / month for an intern

>> No.67056241

I followed http://matthewjberger.xyz/rust/Getting-Started-With-Rust/ and whenever i code myproject it never initialized RLS no matter what sequence of opening an .rs file I tried. This was on Mac, after I restart my computer I'm going to install Rust on my windows machine.

>> No.67056257

Is Visual Studio Code currently the best programming text editor?
Does emacs stand a chance against it?

>> No.67056270

>built in Git UI
>extensions for every single language
>built in debugging
Only downside is the electron bloat is a RAM killer.

>> No.67056284

VSCode is fucking cancer. The debugger isn't shit but I'd never do any dev with it. It isn't even close to the same level as Emacs.

>> No.67056285
File: 818 KB, 1280x719, 1492873957522.png [View same] [iqdb] [saucenao] [google] [report]

How do i get out of a rut of constantly hopping languages and never actually making anything of substance in them?
The only languages i know well enough to say i'm good at are C and C++, but i've not built any large projects in them.

>> No.67056297

>It isn't even close to the same level as Emacs.
why's that?

>> No.67056320

Different anon to who you responded to but nonetheless.
Emacs is trash by default. Everyone that uses emacs will tell you that.
The thing that sets it apart from every other text editor and IDE is that is so insanely customizable and configurable.
If emacs doesn't do something that you want, someone has made a package that does it.

>> No.67056342

Universal system for text edition and metaprogramable.

>> No.67056344

How painful would be learning 'serious' languages like java or c++, after python?
I mean, python is so easy and convenient that I feel it'll be really difficult to jump into languages that require more "manual" thinking and more code to achieve the same results after learning python.

>> No.67056348

Maybe I'm not autistic but I found it harder to program "real" things in Python but writing things in Java/C/C++ is very easy, the code practically writes itself once you figure out how you need to do something.

>> No.67056351

Long time (neo)vim user here, will i get any advantage going from tmux+vim to emacs?

>> No.67056365

seems like a bunch of gimmicks disguised as "productivity" tools.

>> No.67056366

Yes, all the fantastic emacs extensions. You can use your vim keybindings with Evil mode too.

>> No.67056387

I was the same, and i'd argue yes.
Things like Magit, Org mode (especially being able to write your equivalent of a .vimrc as an org mode file), irony and projectile make the choice rather obvious for me.
Personally, i use a tweaked version of doom-emacs, as it provides a very sane ground to tweak from, as well as a very vim keybind set.
I've not looked back since switching a year or so ago.

>> No.67056409

Won't deny that elisp>vimscript, but it's really a matter of comparing the cost of transferring all of my configuration from vim to emacs vs the benefit of emacs extensions being better than vim plugins. It's worth trying at least I suppose.

>> No.67056496

Tbh as the language server project continues to pick up speed almost any editor will be a usable ide.

>> No.67056521

Such a stupid fucking concept. Great, let's make everything a bloated server so we can add in more frames of latency for every basic operation.
Everything else is cancerous.

>> No.67056526

ffuuuuck less than 1ms of delay

>> No.67056531

>Such a stupid fucking concept. Great, let's make everything a bloated server
this desu, mines currently sitting at 1.7GB.

>> No.67056572

>using autocomplete

>> No.67056588

I just use language server for linting on write

>> No.67056594

>having to switch windows when you want to remember which function is where
>inb4 i memorized the std
>inb4 i make everything myself

>> No.67056627

LSP is good for semantic highlighting and interactive methods.

>> No.67056645


>> No.67056665

>The only languages i know well enough to say i'm good at are C and C++, but i've not built any large projects in them.
Build one then.
IMHO an excellent "ice breaker" could be a Chip-8 emulator. It's a relatively easy project, but not trivial, and you'll end up creating a real, working program that an actually DO something.
If you're gonna use C++, I suggest using the SFML library for the graphical part.

>> No.67056674

the point
your baka head

>> No.67056728
File: 167 KB, 1280x720, 1533480994533.jpg [View same] [iqdb] [saucenao] [google] [report]

Lads I have a confession to make.

I can't do tech stuff. I try really really hard and I cry all the time about it. I play with terminal and go through books but learning tech is honestly like a war for me. It's driven me to alcoholism and I drink Everytime I mess with terminal or try to code. I have no clue wtf I am doing and it kills my brain. I'm drunk and crying now but I won't give up ok?

>> No.67056740 [DELETED] 
File: 42 KB, 952x672, efe.png [View same] [iqdb] [saucenao] [google] [report]

>>inb4 i memorized the std
>>inb4 i make everything myself

>> No.67056768

That seems to be somewhat outdated, e.g. rustfmt can be installed via rustup now and racer basically got superseded by rls.
Do you use the rust extension from the rust-lang team?
I don't have a Mac, but on windows and linux it was basically:
1. Install Rust and needed components via rustup
2. Install the VSCode extension

>> No.67056789

You can still use those arguments, but it just proves that you're beyond autistic.

>> No.67056813

When a language "compiles to C/C++" for example, what does that actually mean? Does it just mean it's parsed into those languages and compiled with that compiler?

I.e. Nim compiles to C/C++, but why is that useful if you don't use the features that make those languages so good/fast in the first place?

>> No.67056831

I guess it helps for portability. Any decent platform will have a C++ compiler and even the shitty ones have a C compiler.
But modern compilers like those based on
LLVM have their own intermediary representations which can be used in this manner anyway so I don't see much advantage. There's probably another reason.

>> No.67056851

languages compile to C because it's ubiquitous and fast. And bootstrapping can be arduous so language people would rather develop the language than get it self-hosted. Nim actually suffers a bit from depending on C because it has no TCO right now.

>> No.67056854

Most programming work is pointless bullshit

>> No.67056884

What's TCO?

>> No.67056894

tail call optimization

>> No.67056899


>> No.67056911

Tail-call optimization. It prevents singly recursive functions from overflowing the stack by allowing them to reuse the same stack frame on the recursive call.

>> No.67056926

Thanks for the help. I read some other things and found out RLS never started because of the order I opened up files? I opened Cargo.toml then opened the project folder in vscode. Then vsc sorta reopened but RLS started and built when I selected the main.rs. I appreciate a lot of the documentation but so much stuff has changed in only a short period of time it's hard to keep up on any of this tooling.

>> No.67056981

What's the difference between installing those packages with rustup or cargo?

>> No.67057011

It takes MSVC more than an hour on a quad-core i5 to compile some of the code I had to use. Half of that time is Windows Defender shitting itself over the amount of files processing going on.

GCC was faster, but we'd still be talking 20 minutes for an application who's exec and DLL would be like 5-15 MB

C, not C++.

>> No.67057023

do it minus alcohol and you'll remember what you did
only drink and do shit after you've figured it out

>> No.67057052


>> No.67057063

plus you're going into things with the notion that they are hard, look up a "starting "prog lang here"" book and you'll get the idea of like printing strings and doing math and what not, then look up "practical "same prog lang here"" and you'll learn how to make use of all that nonsense and syntax study you did in the first book... just think, this is ez, I got it.

>> No.67057065

Come to the channel:
> http://dailyprog.org/chat/

>> No.67057068

With rustup they will be automatically updated whenever you run "rustup update", with cargo you need to remember to manually check for updates and install them every once in a while.
You also don't need to compile them yourself when installing via rustup.

>> No.67057080

If Rust is so safe, why doesn't NASA use it? Checkmate atheists

>> No.67057092

If NASA is so safe, why doesn't it use Rust? Checkmate theists

>> No.67057094

or fuckin come to our irc if you get stuck man

>> No.67057096

NASA doesn't need Rust, they use extreme contractual programming by committee.

>> No.67057192

Best way to get into pure FP?

>> No.67057196

get out

>> No.67057212

learn idris or Elm, or any other language with totality checking.

>> No.67057222

Literally how the fuck. How many lines of code? There's no way a unity build wouldn't be faster

>> No.67057245

they use forth plebs

>> No.67057249

It's usually a state machine oriented application, though it was actively compiled for 50+ different versions/features/os/compiler/etc

>> No.67057254


>> No.67057328
File: 302 KB, 1200x910, D_Programming_Language_logo.svg.png [View same] [iqdb] [saucenao] [google] [report]

Thoughts on this language? Is it good or does the GC make it shit? I've been thinking of learning it.

>> No.67057359

Literally useless. Learn Golang for the true successor to C, or Rust if you want to meme about muh safety.

>> No.67057384

Idris is a schizophrenic piece of shit that can't decide whether it wants to be a programming language or an automated theorem prover, and also calls itself a systems language yet is basically Haskell + dependent types.

Also Edwin Brady is a Scottish, lefty remoaner twat.

>> No.67057441

Nice language overall. But lacks IDE support.

>> No.67057446

>dependent types
programming language or an automated theorem prover.

Dependent type begin one way get both, but ... still need decades research for full dependent types.

>> No.67057462
File: 127 KB, 1119x838, 1503288644828.jpg [View same] [iqdb] [saucenao] [google] [report]

Hello guys. I'm trying to solve a weird glitch I'm having in my C code. I have these two simple structures, and a function to create the atlas structure:

typedef struct {
int loaded;
SDL_Rect clip;
int x_off, y_off;
int advance;
} GlyphData;

typedef struct {
FT_Face font;
SDL_Rect next_slot;
unsigned line_height;
SDL_Surface *gmap;
SDL_Texture *gmap_tex;
GlyphData glyphs[256];
} GlyphAtlas;

GlyphAtlas *create_gatlas(FT_Face ft)
GlyphAtlas *ga = malloc(sizeof(GlyphAtlas));
ga->font = ft;
ga->next_slot.x = 0;
ga->next_slot.y = 0;
ga->gmap = SDL_CreateRGBSurface(0, ATLAS_DIM, ATLAS_DIM, 32, 0xFF000000, 0xFF0000, 0xFF00, 0xFF);
ga->gmap_tex = NULL;
unsigned gi = 0;
while (gi < 256)
ga->glyphs[gi++].loaded = 0;

For some reason, that loop inside the function which is meant to set all glyphs to unloaded, makes my font member unusable (it probably is overriding it, since it works if I set the font member after the loop), but I don't get why or how, since the range is within the array size; in fact, even if I manually do something like ga->glyphs[1].loaded = 0, the same problem occurs. What am I doing wrong here? Do I have to do some funky malloc stuff because of the 'glyphs' array, or is it something else?

Thank you in advance, have some 3dpd for your time.

>> No.67057530

not a c guy but isn't glyps[256] only allocating 256 pointers to glyphs and not space for 256 glyphs

>> No.67057554

I've learnt all of Python on code academy am I a programmer yet

>> No.67057570

loop is alright but you don't initialize all members. use calloc/memset. use valgrind

>> No.67057610

It's pointless to initialize all members, and I really want to know why I'm having problems here, because it really feels like I'm not missing anything.


>> No.67057616

>a language isn't allowed to have both
It's not schizo, it literally just does the job of two languages in one.
go to bed you dumb bong.

>> No.67057670

Guess you have to singlestep it then

>> No.67057688

Seems fine on my end. You return ga from create_gatlas, right?

>> No.67057721 [DELETED] 

What do you think about testing with print statements?

>> No.67057724

New thread:


>> No.67057752





Also, thanks.

>> No.67057757


Any language with generics or interfaces can do polymorphism.

Hell, you can use polymorphism by manually tagging values with their type, which is how C does the same thing.

Encapsulation is not unique either. Any language with modules, closures, or even plain lexical scope can do encapsulation.

The thing unique to OOP is inheritance, and almost no one defends inheritance anymore.

>> No.67057765

(fwiw I forgot it too when I was testing, but it core dumped the moment I tried to print)

>> No.67057799

-Werror -Wall -pedantic

>> No.67057868

hi again fantasy football anon, i agree with the other anon who replied to your earlier that having your data in some non-python file is the ideal solution here.

BUT, to answer your question, what you want to do is also quite simple. in your main file, you'd just write
from tight_ends_file_name import tes

then you can use the "tes" variable in your giant concatenation of all the lists

Name (leave empty)
Comment (leave empty)
Password [?]Password used for file deletion.