/dpt/ - Daily Programming Thread

What are you working on?
previous thread

Other urls found in this thread:

youtube.com/watch?v=JfmTagWcqoE#t=1h2m
quora.com/What-is-the-algorithmic-approach-to-invert-a-given-binary-tree
leetcode.com/problems/invert-binary-tree/
google.github.io/liquidfun/API-Ref/html/classb2_particle_system.html#a62a222d2e2d55b00fbba7b31d1a70cee
gist.github.com/tmplinshi/a97d9a99b9aa5a65fd20
github.com/dlang/DIPs/blob/master/DIPs/DIP1000.md
twitter.com/AnonBabble

First for C++ raw strings.

>C++
>GC

youtube.com/watch?v=JfmTagWcqoE#t=1h2m

Third for python is the best

Figuring out what language would be good for a Cred Forums post interpreter.

optimize me with asm

What do you mean by Cred Forums post interpreter?

It's an interpreter for code in code tags of a Cred Forums post.

wew

Why are you using the old opengl?

Virtual Box is being a FUCKING BITCH!

I'm trying to set up a goddamn environment to do kernel debugging in Virtual Box. I have it set to use the Host-Only network adapter with Promiscuous Mode set to allow all. I have completely disabled the firewall on both the host and the virtual machine. I STILL cannot get any network connections going on between the two machines. Even a simple TCP server will give me a fucking connection refused every time, whether it's run on the host or the virtual machine. I've tried using other networking modes (namely bridged networking), but the result is that the machine does not boot at all.

I just want to get around to writing a fucking driver, not spend hours troubleshooting a virtual machine.

mac bros what is your opinion of homebrew

I use it.

muh backwards compatibility

Because my timing in the last thread was so bleeding perfect
Do you think Firefox would have been better for non-webdev users if the primary language for addons would have been LISP instead of JavaScript?

then there would have been no addons

...

>emacs has no addons

are you kidding? If it were lisp I'd write my own "addons" all the time. Heck, it would render the nauseating mess that is about:config unimportant.

it's already #version 130, there is no reason to use cancerous deprecated shit

>He can't invert a binary tree.

I have an idea for a deceptively simple application

4span
>anonymous realtime chat overlay for cspan

So a Nico Nico

was this a fucking surprise to him?

i am kidding, sorry

Ha, what a loser. Should have paid 15000 ameribux for a """university""" to learn how to do it, then never actually put it into practice.

Whups

@Override
public boolean equals(Object otherObject){
if(this == otherObject) return true;
if(otherObject == null) return false;
if(!(otherObject instanceof ThisType )) return false;
ThisType otherType = (ThisType)otherObject;
return this.hashCode() == otherType.hashCode() && super.equals(otherObject);
}

@Override
public int hashCode() {
int hash = 3;
hash = 23 * hash + Objects.hashCode(this.Foo);
hash = 23 * hash + Objects.hashCode(this.Bar);
hash = 23 * hash + Objects.hashCode(this.otherFoo);
return hash;
}

That doesn't sound deceptively easy, it just sounds easy. There are frameworks out there that are open source that contain entire chat implementations already..... Or even better, just have it plink down an IRC window.

yes, was looking for that name thnx

all is good man.

I added support for SVG's to Ivy, my taggable image viewer, that relies on librsvg. This is fine and dandy, but if I want to make a distributable package for NSA+Windows, I'd need the librsvg.dll and all its dependencies to be packaged as well. This started my three-week adventure on cross-compiling a shitload of libraries and dependencies - all for nothing because shit didn't compile and the Racket mailing list found a 32-bit zip full of all the dependencies I needed. I ended up installing 32-bit Racket and using those instead. I feel like I wasted so much time and effort for a solution that ended up taking 5 minutes to do instead.

P.S. Fuck Windows.

And by comparison, VMware just works.

>it just sounds easy.
typical green horn programmer reply.
nothing is "easy" there are always gotchas.

>Host-Only
Did you set the IP address on the host and guest, you stupid idiot?

sorry, that's not my working field, but... does inverting a binary tree mean just mirroring the damn thing along it's symmetry axis? Because if so, how the fuck can you NOT solve that?

What does invert a binary tree mean?

>P.S. Fuck Windows.

Very rude to be honest

swap left and right nodes in a binary tree

EZPZ
BinaryTree tree = someBinaryTree
tree.invert()

No.

wait seriously? even I can do that.

def flip(tree):
if tree:
tree.r, tree.l = tree.l, tree.r
flip(tree.r)
flip(tree.l)

you're embarrassing yourself harder than he is

Hey /dpt/, senior in college here. I have become disillusioned with my college's current curriculum and have just realized I've pretty much wasted the past 3 years.

So far I've taken 2 java courses, 2 C# courses, a SQL course, and a Data Structures course. I've learned the basics of OOP (abstraction, encapsulation, inheritance, polymorphism, etc.) Right now I am taking my capstone course in which we are developing a basic piece of software for another school department.

Given this, I feel like I am completely unprepared for the real world. I have never really programmed outside of school projects, but I want to delve far deeper into programming. Are there any good resources or projects to work on for someone in my position? Should I be focusing on learning different languages or should I start over from scratch. I just am completely directionless right now.

def flip(tree):
if tree:
tree.r, tree.l = tree.l, tree.r
flip(tree.r)
flip(tree.l)


>tfw can't into code tags

i think the point is that everyone knows this is how google interviews. i have friends there who never had formal computer science training -- you study hard for a month to prove that you really want to work there and it's fine

There are always gotchas, that means that even an "easy" program has gotchas.
It's not deceptively easy, though. It's just... simple. Import IRC framework, do a simple implementation of said framework, done.

Alternatively if you're feeling incredibly lazy
>Install addon
>addon injects iframe with an IRC client website right next to the video
>done

it's pretty simple, iirc you just go level by level and change the pointers (and initialize the nodes if they were previously null)
I actually have no idea why he wasn't even able to attempt it. It's an extremely simple algo unless I'm missing something.

you're supposed to suggest that you should use the tree as if it has been inverted, without having to actually invert it. that's the clever, "lazy" solution.

and when you can't even do it the straightforward way (actually inverting it) it shows that you suck, that you're not good at problem solving and programming in general.

dude my field is physics, why would I be embarrassing myself by not knowing some cryptic piece of information completely irrelevant to me.

Apparently that's not what the interviewers meant. It has something to do with having multiple roots. Not sure how any of that is useful, but that's the explanation that came along last time I looked up the problem.

Why would you ever need to do that to a binary tree? Seems retarded.

right, their m.o. is to keep changing the requirements
some people really can't stand this

it's to weed out non programmers like the fagbasket that made homebrew

Anyone else tried CLion? Seems bretty gud so far

Come up with some relatively easy software (can be something that was made before) like a calculator, or simple file manager if into gui, or simple blogging platform if into web etc., choose good language for the job, and write it.
That's honestly the best thing you can do to learn. Just write software with real application (i.e. not bazillion different algorithms like inverting binary tree, see above).

(struct node (val left right) #:transparent)

(define (invert tree)
(if (null? tree)
null
(node (node-val tree)
(invert (node-right tree))
(invert (node-left tree)))))

> I've learned the basics of OOP (abstraction, encapsulation, inheritance, polymorphism, etc.)
I'm a first year and I learned that in a single course

You need to work on your own projects. You've seen the power of programming, now use it. Think of something you want to be able to do, or something that could theoretically sell/be useful/be used by other people- Have you ever wanted to implement something in one of your projects that a framework didn't exist for? If so, make that.

Make a webcrawler that's capable of datamining, and make all the sub-steps involved (Efficiently cataloguing, identification of important information, parsing of HTML, output, simple database implementation) and use all taht you've learned from data structures etc to make it as efficient as possible- if you run into something that you don't know how to do properly, try to figure it out and ask others questions.

You need to be working on personal projects from NOW until you get out of college, then keep doing it. Build dat portfilio.

>Multiple roots
not a binary tree

You wouldn't, but the fact of the matter is that it's an extremely basic recursive algorithm that anybody should be able to figure out, especially a pro-level software engineer. The fact that he couldn't do it (if it was a binary tree) means that he doesn't even have the knowledge of a student who took a single data structures course.

That he couldn't do that makes me question the quality of homebrew.

most software is simple as shit, doesn't take a genius to write it

i've only ever heard two complaints:
* no versioning
* opt-out google analytics

when asked this sort of basic interview question, to shout back "WHY?". What does inverting a binary tree have to do with software engineering, at all?

Google (and other interviewers) might as well be asking me to name the last 1000 digits of PI. The Kafkaesquen ability to recite how to do the task correctly reflects nothing about the candidate, except the strength of their memory.

It boggles the mind that the field of computer science does not have any standard way to detect the competency of a person. It is extremely discongruous for a company with as many smart people as Google to have such an absurd hiring policy.

>not a binary tree

I know, but them's the breaks. It's a fucking stupid question, and as much as I hate to agree with the nerd homebrew developer, he's right.

don't call us, we'll call you

There is no option to "set" the IP address, user. Running ipconfig on the host I see that the host only adapter has an IP address of 192.168.56.1. If I run a TCP server in the guest and connect to that, I get a connection refused. Similarly, I run ipconfig inside the guest to see that the IP from its end is 192.168.56.101. Trying to connect to that IP while running a server in the host also gives a connection refused. Swapping around the IPs gives a timeout as expected.

VMware doesn't boot the image at all!

because if it were really that easy how would he even have a problem with it, use your head for a second

Where do I start learning C?

Big thanks guys. I figured that is what I should be doing anyway, but the affirmation is good to have.

>cringeOS

Are you guys sure it was not about this:
quora.com/What-is-the-algorithmic-approach-to-invert-a-given-binary-tree

>VMware doesn't boot the image at all!

User error?

>Google (and other interviewers) might as well be asking me to name the last 1000 digits of PI.
Getting you to calculate the second thousand digits of pi given a formula would be a pretty good interview question.

Yes, we know that you'll never have to invert a binary tree during real work. But we can't give you any 'real world' problems during an interview because none of them fit into the 50 minutes each of us can give you. If we try to strip them down, remove unnecessary context, then they turn into: surprise, abstract, disconnected problems that you think don't have anything to do with software engineering.

Get off your high horse.

The thing is, Google tracks the long term performance of everyone they hire. The interviews might not be perfect, but they work, and they work much better than other common metrics (like the school you graduated from, or the grades you got).

Do you enjoy sucking google's dick?

Building the DNS and routing automation panel for the network lab

You can't even speak English language are you sure you can write in a programming language?

Even for people who went to top schools?

>brew
>no versioning
why are they calling this a package manager if it doesn't actually manage packages?
by the way, it also has no signatures verification and executes curlpipes.

Dunno. But more or less, when you try to get it to boot WIndows 10, it'll just sit there with a black screen and the Windows logo and no spinning dots for fucking ever.

No. Personally I'd never work for them because they sound like a dogshit company from an engineering perspective.

They came up with go, for crying out loud.

I replaced part of what I wrote and posted without checking my post. Sue me.

Install Gentoo

You're embarrassing yourself because that guy who you replies to was right.

leetcode.com/problems/invert-binary-tree/

Plus, the post is clear enough.

Just because java has a library that does it for you doesn't mean it's easy to do on a whiteboard in the right order

No it's not, still have no idea what you mean by interpreter. Only logical conclusion would be a live interpreter (for interpreted languages) and compiler (for compiled languages) that automatically runs code on Cred Forums but that would make no sense beccause 99% of shit posted here is either just snippets that don't work on their own or just shit.

wut

Honestly you can't expect that giving enough shits to mock his twitter shitpost is on the same level of interest as trying to figure out whether he is complaining about failing a (as he describes it) trivial problem or reducing a tricky problem to it's most trivial core for rhetorical purposes.

This has nothing to do with Java kek, inverting a binary tree is just as the guy said, and you said he was wrong.

Type:
while true; do NOTIFY_SOCKET=/run/systemd/notify systemd-notify ""; done
It's a new forkbomb fuckup courtesy of Poettering that doesn't require root access.

Er, yes it is.

It is known and acknowledged by many inside and outside of Google, that the Google hiring process is broken.

One Google Engineering Director I know shared with me, “I got hired here. I hire people here. And I don’t know how people get hired here!”

I have a good friend who would be a killer senior technical hire for any company. He is the inventor or co-inventor on 8 patents, has written software that pretty much everyone in the world has touched, and is a flat out genius.

Having gone through the Google hiring process multiple times in frustration, he for a number of years had the following at the top of his LinkedIn profile: “Google Recruiters Go Away!”

I have been through the Google hiring process three times, twice in 2006 and once again in 2008. Two of these times it went all the way to the end and was not successful for seemingly arbitrary reasons. During one of them, it went off the tracks in the middle.

In 2006, during the interview loop that went off the tracks in the middle, I was asked to describe a 3-tier application architecture for a small startup. When I got to the topic of load balancing, I said:

“You will want to load balance among your front-end web servers. Now, you could go out and purchase an F5 for load balancing, but since this is a small startup, I want to go on the cheap. I would start-off using Round Robin DNS for load balancing.”

My statement was met with immediate scorn, with the person with whom I was interviewing, who by the way showed up 20 minutes late, saying:

“What?!? Do you even know what DNS is?”

I attempted to make clear I knew what DNS was and how it worked and to explain what Round Robin DNS is, but he had flipped the “bozo bit” and nothing I said would change his position.

He left the interview early and a few minutes later, someone came into the room and told me that they had decided to cut the process short.

We actually have a way to rank developers and to evaluate fitness. It's called money.
Paying = voting

Homebrew is very good actually
It wouldn't surprise me if 99% of it is made with open source libraries if he couldn't do that, though.

Just don't forget to always view problems you're faced with as sub-problems, then ask yourself how you can fit those sub-problems into data structures you've learned about, and then think about which algorithms you can execute on those structures for ~maximum efficiency~
Obviously not EVERYTHING has to be viewed this way but computationally expensive stuff should. (analyzing text, images, or anything really).

No, I LITERALLY don't believe that they asked him to invert a binary tree with two roots because
A. A binary tree with two roots doesn't exist
B. A tree with two roots isn't even a tree
C. Inverting such a tree is not possible

The only way it would be possible is adding nodes above the root nodes until there's only one root and then executing a typical inversion.

A tree with two roots doesn't exist.

>shout back "WHY?".
Don't shout, but yes. A very good question would be:

"What's the purpose of this? Does it actually need to be reversed, or can you just reverse your comparator or vistor? That would take you from a cache hostile linear time operation to a simple operator switch. "

>ability to recite how to do the task
Interviews are designed to discourage memorization. Questions are banned when they're found online.

If you're not able to solve problems, only copy answers from textbooks or stackoverflow, then you should work somewhere else.

>Do you enjoy sucking google's dick?
Yes. My day job is parsing which deals heavily with trees, and I wouldn't want coworkers who can't handle trees programmatically.

that's what I said at B brube

>kek you don't know DNS

What if it's a mutant tree?

Yes, that was the actual implication. I skipped some details. I'm wondering what language to support, maybe something like Scheme. It would probably only accept posts that begin with code tags, and the code starts with something to show it's supposed to be executable. Maybe something like:
#! runthis

Plus, regular interpreters and compilers deal with code that doesn't run all the time, how is it a problem?

That's called an oriented graph, and this is exactly the same as what you would expect from a "tree with two roots"

the common excuse (for this and go) is that they're worried about diamonds of dependencies; and that google couldn't decide upon a way to do this for their internal stuff so it must be hard

>"What's the purpose of this? Does it actually need to be reversed, or can you just reverse your comparator or vistor? That would take you from a cache hostile linear time operation to a simple operator switch. "
They gave you a question, answer it, don't try to evade it. Stop wasting interviewers' time.

I hate it when candidates waste time, the purpose of the question isn't the solution itself, it's to see whether you can program for shit.

so you run your program and pass the board and post and it doesn't loads and runs it? just copy and paste
you're not solving any problem, unless it's a browser extension that runs code in place

Do you mean DAG?

Yes, it's a browser extension, I forgot to mention that. I was also thinking of adding support for linking code from other posts. That way you could actually have a complete program.

end my life

>A. A binary tree with two roots doesn't exist
>B. A tree with two roots isn't even a tree

I'm aware of that.

>answer question without clarifying purpose
>lol it was trick you were supposed to realize you could do it this other way even though we didn't ask that

that's how you'd do it in a real non-shit program pajeet

y-yeah... right..

>arguements
My professor does something like this, but it checks if the answer matches about 80%.

In SQL encrypting the input string before parsing is a good way of prevent sql injection?

>Current year

That's a completely different situation. The binary tree one is different.

>write a function
>that takes a binary tree
>and inverts it

It's not complicated beyond the interviewer saying 'invert it' instead of 'reverse it'. There's no trick.

Can you write the code or not? If not, just tell me and we can try something else, because right now you're sitting at zero points on my 'can the candidate write code?'-ometer.

I don't even know SQL but that sounds retarded.
How would you parse an encrypted input?
How would encryption make input safe?

Why don't you just sanitize it properly.

That sounds terrible. It is definitely acknowledged that there are flaws in the process, but I've never heard a horror story that bad about it.

I've been through the interview process once, and was hired. I solved a bunch of dynamic programming & algorithms problems, talked through some scalability / architecture questions, and had to whiteboard a working implementation of Conway's Game of Life in any language, without any syntax or library reference. There was also an informal chat over lunch. That was all pretty much what I expected.

The worst part for me was that you don't know what job you'll be doing until you walk through the door on your first day, essentially. After the interview they called me to ask if I'd like to do SRE or SWE, and had an SRE give me a brief rundown of the differences. I didn't realize it at the time, but I was actually choosing which team I'd ultimately be on, after they'd circulated my application and had both SRE and SWE teams accept me.

I'm also surprised about interviewer being so wrong about DNS. Most of the interview questions come from an internal database, and are well-audited for correctness and alternate answers.

hahahaha

>he's paying tens of thousands of burger bucks for this

You're a bad interviewer. I don't like your attitude.

yes, can I have the address of your server?
i would like to see if you run mysql as root.

What the fuck.

Use prepared statements, you dunce.

Anyway it depends on the output format of the encryption. If it's base64 you're fine. If it's binary you're fucked.

actually it's free lmao

pell grant

eat shit asshole i wouldn't want to work for you anyway

>Don't shout, but yes. A very good question would be
a very good answer would be

//Assuming that nodes are stored in .l and .r of the nodes
{
invertTreeAtNode(TreeNode n){
TreeNode temp = n.l;
n.l = n.r;
n.r = temp;
if(p.left!=null)
invertTreeAtNode(n.l);
if(p.right!=null)
invertTreeAtNode(n.ri);
}


Why would you waste time questioning your interviewer when
A. what they want is obvious and
B. what they want is simple

Questions would be good if they asked a question like "How would you arrange a database of clients for quick retrieval by name" or some other question with lots of variables.

time is money

And I don't like interviewing people.

I have no idea whether someone will sink or swim if they're hired based on a 50 minute chat. I just don't want to be having to help them out with basic things like loops and conditionals and recursion.

The problem is that there are interviewers like you, and other interviewers that want you to asl stuff like "why is it needed" to see if you can "think out of the box" or some shit like that

It's still your money.

Recursion is obsolete, anyway.

What the fuck is p?

k cool

I need to insert, and retrieve usernames from database. I was thinking if I could just encrypt the username before inserting, then decrypt after retrieving from the database.

I'll take that as 'no, I can't write the code, and I've been found out no matter how hard I try to avoid answering by being a smartass about it'.

Incidentally, you're now sitting at negative points on my 'would I want to work with this person?'-ometer.

how do you guys get into coding 12 hours a day?
Anyone?

kill yourself you insufferable sperg

n
typo

adderall
just make sure not to start fapping

Am I the only dev here who hate shortened names?

I would rather have "node.left" and "node.right". Typing isn't too much time consuming and you gain it back when reading

That's a lot more work than just sanitizing your inputs. Plus, it's going to make the code harder to manage because you have to think about the encryption key too.

these:
the sperglord who opposes this doesn't work for google and he's only looking for codemonkeys

With the rise of FP? Hardly.

Sorry, I don't really think you're the right fit for our company. Thanks for your time.

If you can't implement a gomory-hu tree in

I've tried adderrall. I'm on armodafinil right now. I already fapped, what do now?

Enjoy your RSI

I think I touched a nerve.

Listen to Drum 'n Bass
.

>he unironically thinks recursion is relevant
lmfao you're not even an interviewer you're a fucking joke dude

You do your thing, Pajeet. When you sell code at $0.10 per line, your needs are different.

Mein negers.

>What does inverting a binary tree have to do with software engineering, at all?
Inverting binary trees, fizzbuzz, or just asking someone to count down from 700 to 200 in decrements of 13, are all simple programming tasks. The purpose is to filter out people who do not know the basics of programming, because they are sadly common. It is safe to say that if someone cannot do a basic task, that you can discontinue the interview entirely, because you are dealing with someone who is a moron.

>The Kafkaesquen ability to recite how to do the task correctly reflects nothing about the candidate, except the strength of their memory.
But this is not a memory task at all. EVERYONE who has taken a data structures class or even read up about data structures knows what a binary tree is, and it does not take much imagination to figure out what "invert" means with regards to a binary tree. But regardless, you can always ask what they mean by invert (i.e. show an example input and output).

Being a good computer scientist requires being able to solve a problem, usually by writing a program. If you cannot solve problems, you should not be hired.

>It boggles the mind that the field of computer science does not have any standard way to detect the competency of a person.
If there WERE a standard problem for testing for competency/incompetency, people could simply memorize it instead of be forced to figure out how to solve it.

>It is extremely discongruous for a company with as many smart people as Google to have such an absurd hiring policy.
There is nothing wrong with a policy of not hiring people who cannot so much as analyze a simple problem and come up with a solution.

Me too brother.
But there are a lot of C fags here on Cred Forums and it seems to be a standard in c to name your variables with a the least charaters possible.
Probably from the time before code completion was a thing.

>Enjoy your RSI
nice projecting

>I think I touched a nerve.
nice projecting

Nope. You actually spend more time reading your code than writing it.

Vyvanse

fapping on adderall is the worst trap of all time
>it feels good
>so good
>you can't get fully hard
>You'll never cum

I write out full names when I'm not writing pseudocode examples of algorithms
That being said, I always use one-character variables for iteration. I.E.

for(int i = 0; i < 10, i++)

while(f);

foreach (Apple a in Apples)

Recurse(node n)
{
Recurse(n)
}


Do what I'm about to do and close Cred Forums so you can get to work

If you can't implement Judy Arrays in less than a half hour, you just aren't going to be working at the velocity we expect on this extreme programming team.

>kek shitposting all day on Cred Forums is better

I imagine user just wrote it that way because Cred Forums has no code completion and he didn't open an editor.

Serious question. 21 y/o NEET here. I've worked a bit with Visual Studio (.NET) and I'd like to do something with my life and start programming. I'd mainly like to develop solutions for companies, anything really. What's a good language to start with?

No web development stuff, the creative side of my brain is dead.

he's just an FP tard, they unironically write their haskell like that because it's """"concise"""" and apparently because """"muh RSI""""

What languages have you worked with. Cold you be more specific about your experience?

In LiquidFun and Java, how do I get the particles positions?

There's got to be a way, but I cannot find one, despite searching dozens of google links.

Find some task you want to complete and turn on music.

Just keep going with .Net, its comfy and you can make stuffs fast

just give up dude

you're too far behind. try pottery instead maybe?

Come with me and I'll take you to a place where there are no loops or conditionals.

You couldn't do the inversion, could you?

That's okay. I'm sure you'll be able to get a job somewhere. You could try Mumbai, I hear the weather there is lovely this time of year.

learn based java

>inb4 (You)

>Implying webdevs are creative
Learn C. Everything else is bloated bullshit.

idiot

Don't call us, we'll call you!

I've never used that library before, and this only took 30 seconds of searching to find: google.github.io/liquidfun/API-Ref/html/classb2_particle_system.html#a62a222d2e2d55b00fbba7b31d1a70cee

You amuse me.

Such primitive concepts as for-loops, while-loops, and if-statements are for the programming underclass.

Only .NET and a little bit of C#. Practically no experience at all.

I don't know. People don't seem to take .NET seriously, definitely around here.

Yeah, made lots of fucked up choices. I'm afraid it will take too long to get decent with any language at this point.

I captured some post data of a file upload, pic related
Is this a specific format?
I want to generate the same in AHK out of an image, but since those aren't really unicode characters, it's kind of troublesome.

For example, I can use FileRead to read an image and get the same start (PNG something), but it just stops after 4 characters or so. Does it require different encoding?

trips confirm.
Aphex Twin got pretty boring after the 10th listen of each album. Anyone you'd like to recommend? Besides the typical Tycho, Boards of Canada, etc.

you're right about the closing Cred Forums thing. blocking it in my hosts file just leads to more faps and more googling of pointless shit.
Is Vyvanse easily obtainable on deepweb? (ideally clearnet). modafinil has been pretty good for me so far but it's not even close to the effectiveness of adderall. But I find I get really in a weird ineffective routine on adderall and I'm very sensitive to it.

>I'd mainly like to develop solutions for companies
you'd like to what

everyone just slaps the same stuff together it's true
telling startup websites apart, in particular, is very challenging

You used to be cool, very briefly.

>People don't seem to take .NET seriously, definitely around here.
Cred Forums will always hate what's popular. That's the rule.

Nah... The real answer is:
Assuming average human lifespan of 80 years and and brain time perception is logarithmic.
log(21) / log(80) = 0.69

Basically user still has 31% of his life left which is more than enough.

Just get a script
don't fuck with illegal vendors for a drug that has the potential to be so dangerous.

I don't recall that ever having been the case. You're going to have to be more specific about the time period in which I was, allegedly, 'cool.'

>brain time perception is logarithmic
[citation needed]

This morning.

I'm still not seeing it. What is this in reference to?

According to the data saved in my brain, most humans have an IQ inferior to the average of this board. Thus popularity is linked to crapiness. Also, it's hard to counter the inertia of sheeps going to a cliff.

...

>implying correlation entails causation

>Do you even remember being a kid?
Let say you're reborn, each seconds of memory stack thus:
t+1s=>100% of everything you know
t+2s=>+50% of everything
t+3s=>+25%
...

Okay, this might be totally flawed but you got the idea

>Assuming

IQ is used for cataloguing the intelligence of children. Literally, that's why it was made and that's what it's designed to measure.

Just because you have a high IQ doesn't mean that you know more, or that you know better, than someone with a lower IQ. Shit, your IQ could probably be easily outclassed by that of a 10 year old.

so I have a question about if statements in python
I want to do something like
if nameone="x" + nametwo="y"
print("name x and y")

how do I do it?

What are you trying to do?

if (nameone=="x" && nametwo =="y")

If I hang around in these threads, how much programming knowledge will I absorb?

If nameone=="x" and nametwo == "y":
Print("name x and y")

I understand the idea, I just don't think it's correct. A second feels the same length as it always did for me.

It's python..

if var1 == 1 and var2 == 5:

None. It's a waste of time. You'll learn better actually programming

a fair bit if you just focus on one language, though you'll have to actually do some programming to learn a language

if you actually practice a language you learn a lot about how to scrutinize shitty code

This is why it's even harder for the normal human beings to question the "knowledge" pissed in their head. Knowing and understanding are two separated things. Also, I'm shitposting so don't take me too seriously

he probably saw the same episode of vsauce I did.
You'll find it on yt.

How old are you? When I was a kid, clearly summer seemed to be everlasting.

I'm 29.

Can confirm, but I just want to make sure everyone here acknowledge the fact that I used to think this way before watching the Vsauce video.

Thank you for reading my post instead of doing something useful with your times anons. :)

Also, why is there something rather than nothing?

what is vsauce

I'm 20 so I can remember my youth more clearly, you see..

Le pop science youtube mane

wow putting it in a code box was a terrible idea.
>Also, why is there something rather than nothing?
here's a cryptic reference for you

"1/0" is a paradox; in a way that "0/1" is not. Nothing can be divided by zero. If one approaches the formula from the positive side, it would appear that the answer is an infinite positive value. If one approaches the formula from the negative side, the opposite is true. Thus, anything divided by zero is simultaneously positive and negative infinity. "One over Zero" is a paradox in another way too, in a way that transcends mere arithmetic. One is something, and Zero is nothing. The fact that the universe holds something over nothing, that it prefers to exist, rather than not exist, is fundamentally absurd. No being can ever come to deserve its own birth. 1/0 is a cry out against mere logic and efficiency. Stuff exists. All existence, all truth, cannot be ultimately justified: it can only be described, explained, and enjoyed.

1/0 is illogical. 1/0 is irrational. 1/0 is impossible. 1/0 is transcendentally unfair.

1/0 is true. Deal with it.

I don't remember much of my early 20s. Too much drinking.

Are you vsauce Michael?

How do I make an extern enum without putting the whole enum declaration in the header file?

I have the enum declaration in one.c, and in one.h I have
extern enum my_enum;

But it says "warning: useless storage class specifier in empty declaration"

I read it through the code box. It reminds me the painful times I used to code without line warping...

Is this the proof we will never actually fully understand everything? Should I delete my life?

nah. just a guy who used to spend too much time on tvtropes.
it's from an exactly 1000 strip webcomic called 1/0 (one over zero). Feel free to look it up, it's... surely something.

>enum my_enum
That is just an enum declaration.
If you want an extern variable of type 'enum my_enum', you need to give it a name.
extern enum my_enum my_variable

This is retarded.

No, I'm just making an enum so I can have some globally available ENUM_VALUES;

I'm not using it as a variable.

You need to stick the whole declaration in the header then.
There are no "extern definitions" of types in C.

can I ask /dpt/ opinion on something, for the past few months I've been making a text based game where you explore a castle and fight monsters to fight and save my gf, would it be autistic to show her this?

Does anybody understand O(nlogn) algorithm for matrix chain multiplication?

i'd never heard of this. this is really cute

If she's actually your girlfriend, then it is fine, unless you tell her in an incredibly autistic way.

Otherwise, creepy.

The algorithm or the anime?

>30GB of psytrance without placebo (flac)
>adderall
>full screen emacs

the key is full screening emacs IMO

I haven't formally asked her out but we talk a lot and we got lunch once. I'm also her TA for cs class.

So you're using emacs as your OS?

void
invert (struct tree * restrict node)
{
struct tree **l, **r;
if (node) {
l = &(node -> left);
r = &(node -> right);

invert(node -> left = *r);
invert(node -> right = *l);
}
}


I can do this in haskell, but am not sure here. Did I do it right?

not quite, the key is to make the entirety of your focus to be code.
NO DISTRACTIONS ALLOWED.
I don't live in emacs like some of the hermits I just like to skidpaste other people's elisp.

yeah she's my gf senpai, will show her next time she's around my flat, ignore the memer

Have you at least kissed?

I would show.

the algorithm; i'm not really into anime
i'll try to read the papers later. what seems weird about it? i'm a mathematician so the combinatorics is appealing

Then no, absolutely do not show her, and don't refer to her as your girlfriend. That's an "after you've fucked" kinda thing, or at least after a month or two of dating if you're religious or something.

remember those stories in the old vidya magazines where the programmer makes a custom version of zelda that asks the player to marry him at the end then gives it to his gf? do that

Just chilling making a game in C after five years of Scala. I'm decompressing. Six month noncompete period. Feels nice doing things at so low a level.

>Six month noncompete period
What does this mean?

It means he worked at a gaming company, signed a noncompete, and lives in a state where such agreements are enforceable.

depends on if she likes you at the moment.
women are retarded.
she could be all "that's so sweet, you rock my world!"
or "eww what a creep! hey everyone let's mock user for his weird fetish shit"
their moods change 100x more than their clothes.
good luck!

Pretty much every normie does this today.

I spend all day trying to get modular multiplication and exponentiation to work. No go...

vim ou emacs?

Implementing RSA?

How can I download an old version of something on github?
I see this was last updated 2015, but I want the 2013 version for compatibility reasons: gist.github.com/tmplinshi/a97d9a99b9aa5a65fd20

flame war

there are two versions, both from 2015
what am i missing

nevermind I'm retarded
I misread the join date for the post date

Clone it then checkout the commit hash

No, RPN for some python math expressions.

anyone using firebase?
what are you doing with it?
i am about to attempt to use it as my online db for my dating app i'm working on in android studio. i barely know anything about it, starting from scratch, teaching myself AS/Java/Eclipse/XML/programming in general

I don't know paper just seems long.
Looking again I can't tell if it returns the optimal order or is just a good approximation of opt.

Hey senseis I'm learning C and I was working through this problem in my book:
Write a program that prompts the user for the two legs of a right triangle and
makes use of the pow and sqrt functions and the Pythagorean theorem to
compute the length of the hypotenuse.

First I wanted to solve the problem just using the pow function and then revisit the program to improve it and add the sqrt function (I was thinking of making the program check the sqrt of c and if it equaled the sum of a + b then it would print to the console.) But first I wanted to solve the problem just using the pow function and the rest of the operation included in the math.h library. This is what I came up with
#include
#include


int main()
{
float a;
float b;
float c;

printf("Please enter the first side of your triangle: ");
scanf("%f", &a);

pow(a, 2);

printf("Please enter the second side of your traingle: ");
scanf("%f", &b);

pow(b, 2);

c = (a * b);

printf("The hypoteneuse of your triangle is %f ", c);

}


Can anyone tell me how I messed up and how to fix it? it wont compile. Any help is appreciated. I'm serious about learning this language

Also should add that once I'm done, I was planning on improving the program even more by creating a function that squares a side of a triangle and then just calling the function in main to reduce the size of the program and make it more efficient.If someone could show me how to fix what I just did and also improve it, I'd appreciate it

>pow(a, 2);
>pow(b, 2);
You're not assigning the result to anything.
>it wont compile
You're probably not linking the math library to your program.
Add -lm to your command line arguments.

they are definitely claiming optimal
keep in mind that a lot of the space is graphs and tables
probably no time for it tonight :( need to get this finished

nah, these old neckbeards are afraid of anything new - prolly just using SQL

Do you know the Pythagorean theorem?

>Add -lm to your command line arguments.
I should probably clarify that I meant the compiler's command line arguments.
ie.
gcc your_prog.c -o your_prog -lm

I'm building a fullstack app that will render info from the database in chart form via chart.js. The chart library will be loaded in the front-end, so the front-end will need to load the data passed to it by the backend.

What's the most convenient way to get that data? An AJAX call for JSON from the backend on page load? Or is there some way to send that data to the frontend along with the initial template render?

GB of psytrance without placebo (flac)
>psytrance
Some links to that music?

Why don't more languages have Perl and Golang style multi-variable assignments?
Like in perl if I need to swap two variables I can just do
($a,$b) = ($b,$a);
And if I want multiple things returned in golang it's just
a, b := funcReturnsThings(params)

>fullstack
>chart.js
Am I missing something?

what?

>so the front-end will need to load the data passed to it by the backend.
No, the front-end (view) should receive data from the middle layer (controller) which should interact with the back-end (model) to actually pull the raw data.
MVC is important, moreso in web applications, doubly-so in web applications using a database.

when kat was still online i pointed flexget at the rss feed for music and filtered for "psytrance"

>being pedantic and wrong at the same time
my fav brand of shitposting

Just because a tool is useful doesn't mean its well designed internally. Homebrew definitely is not.

>Or is there some way to send that data to the frontend along with the initial template render?
it's just a js array. you can build the expression and send it along with the page. how easy or advisable this is depends on the rest of your setup

Front end should never connect directly to back end. Period.

didn't realize this shit was written in ruby lmao
it could still be good i guess

>you can build the expression and send it along with the page
This is the crux of the issue. I don't know of a way to do this using Express.js. I can render a pug/jade template and send that along, I don't know of a way to send some JSON along with with that template render, so that I can access that with a client-side script.

>Front end should never connect directly to back end.

wew lad

So it's random music, thanks. I'll try something similar to acquire some.

there may be shortcuts that would improve performance but if you've got an array of numbers [1,2] sitting in a variable x then JSON.stringify(x) will give you "[1,2]" and you can pass that along to the template

>I'm retarded
Learn to abstract layers you sad excuse of a developer

cat+sed+awk

If by abstract you mean unnecessary layers of bloat, no.

>abstract layers
>not just using programming

Ektoplasm.

The interview question would be in Pesueocode anyway so anything even remotely resembling that would be correct

I have no issue with the interpolation of javascript within the template. That's easy peasy. I want to send JSON to the page rendered by this template, so that a client-side script associated with that html page can access it. I'm trying to find out the most convenient or efficient way of doing this, outside of just manually hitting the server-side API with an AJAX request on page load.

you can't change the client-side js? sorry, i don't understand

Go back to sucking dildos, Max.

Homebrew is a buggy piece of shit.

I like how webdevs basically create their own problems.

>wanted to spend the night fixing up leaks in my program
>run valgrind
>no leaks

what do now

*tips fedora*

if you can think of a way to replace a client-side library in some fashion, then do it, you'll make yourself good money

>needing safety
lmao you fucking noobs can't even know how correct ur program is so you have to safety to baby your way in, huh?

D is getting a lifetime system. Rust is OFFICIALLY obsolete.

github.com/dlang/DIPs/blob/master/DIPs/DIP1000.md

yup

>Implying I use any library at all
For templates, simply use the tag. But of course, you can't do since your shitty website is too bloated. Too bad you're going to waste the rest of your life on useless artificial nonsense.

Finally got around to implementing fast images in C#.

still shit

lel, that's not the issue i have

step up your reading comprehension skills scrublord :^)

Faggot

How are you doing this? Unmanaged code? This is relevant to a project I'm working on, so if you'd be down with releasing it as MIT I'd be very interested.

because I need to learn how internet tubes work

Just converting an image to 2D array of POD "Colors" (int R, G, B) and then converting back to writable Image type when you're done processing.

The effect is fairly remarkable for a large number of iterations over an image.

My nigga racket

Ah, gotcha. I have an application where speed is critical (image processing, parallel kernel convolution), but I feel like loading the image as a Bitmap and then reading out the values is an inordinate instantiation expense. I'm assuming your just reading it in as a Bitmap? Or did you write your own file parser?

>I'm assuming your just reading it in as a Bitmap? Or did you write your own file parser?

Reading it in as a Bitmap, so there is a fairly substantial instantiation penalty, but you could theoretically combine it with your own BMP parser.

>your own BMP parser
That's what I was trying to avoid, unfortunately. Reading arbitrary image files from disk (tiff, png, jpeg, bmp, etc) is far more complex than the actual image object.

In fact, since you can call SetPixel on a FastImage, it'd be as simple as your parser reading in a byte, then setting it.

>Reading arbitrary image files from disk (tiff, png, jpeg, bmp, etc) is far more complex than the actual image object.

Yes, that's the rub. What's the purpose of your project, anyway? Just curious.

>doing C
>an assignment involving raw memory handling

>get offset of pointer, cast to another pointer
>for some fucking reason it comes out with a totally different memory address than expected
What the fuck?

How the hell is the address 0x14FF45C the same as 0x01500F98?
It's always a difference of 0x1F20 for some reason.

I've checked my code and the integer output by my pointer arithmetic outputs the correct expected memory address. It's just the conversion that fucks everything up.

Using Visual Studio 2015, MSVC. C calls only.

Indexing images using perceptual hashes for replacing duplicates in an arbitrary folder structure with symlinks, and building a database of the hashes for associating with tags. Calculating the hashes is extremely expensive (edge detect, feature detect, etc) so I've been looking into using OpenCL and a faster way of interacting with images.

if you know everything but the conversion's correct, then you're doing the conversion wrong

>cast to another pointer
Yeah, you can't do that (except to char and void pointers).

Can it not be as simple as
SomeStruct *newStruct = oldStruct + SomeStuff;

>a faster way of interacting with images.

You could always use that Image wrapper that uses pointers to speed things up.

It's unsafe, but if you feel the need for speed and loading images and transferring is a huge cost (which in your case, it would be), it might be worth looking into.

codefights [.] com
beat the bots, get the jobs
>is this a meme?

Be careful because when you do pointer arithmetic, it might automatically multiply the offset.
e.g.
int* ptr = (int*) 1000; // dummy pointer
int* ptr2 = ptr + 5; // ptr2 = (int*) 1020 = (int*) (1000 + 5 * 4) assuming 32-bit ints

Rust has been obsolete since it's conception

Assuming they're the structs are the same type.

Basically this is one of those rare assignments where you don't have to worry about flying into illegal memory locations, because we malloc a large enough region to handle our operations at the beginning of the program.

So I made a random image generator that takes in the height and width and randomly assigns rgb values to all the pixels of a ppm.

It works except that when the height and width are less than 210 (or any combination that's less than or equal to 44100 pixels) it segfaults.

It also segfaults when the picture is big too.

That's what I was hoping you had implemented; I'd like to avoid Marshaling if possible, so part of me was hoping you had a well-tested unmanage code version completed.

Ah shit, that's exactly it. Fuckin' arrays. Forgot about those.
I need to convert the pointer to an int before adding to it.

Less than 211*

Ya fucked up, son.
When magical segfaults happen, it's probably because your code only works correctly by chance

NOPE!
I played with it a month ago. The a week later I had 3 job offers. 2 were start-ups, 1 was big name.
Meet with HR this coming Monday.

I usually just define a macro like
#define ptr_add(p1,p2) (void*)((intptr_t)p1 + (intptr_t)p2)
Or something like that

I get that when the picture is too big it's probably trying allocate more memory than I have, but I can't figure out why it doesn't work when the picture is too small

Thanks, will look.

You probably have an error in your code. Look more closely

anyone used vert.x?

how hard is it to pull in, or use api wrappers or service drivers from other languages?

Yeah I'll comb over it tomorrow, it's been killing me since yesterday and I want to forget about it right now

>well-tested

Most of my code has 0% coverage, my guy. I could start working on a high speed low drag FastImage that comes with an equally fast and dangerous BMP reader.

The Bitmap class is so unbelievably slow, it actually blows my mind.

I thought BMP was literally the dumbest image format possible

New thread:

It's not "dumb", it's just not compressed, so it's fuckhuge.

This looks... incredibly awkward. You are using more indirection than you actually need. You also actually copy the value of either of the left or right pointers, but instead, the address. When you set the value of the node->left pointer, you actually caused that subtree to become inaccessible. Also, you don't need to use a restrict pointer when there is only one argument to the function.

Try it like this:

void
invert (struct tree *node)
{
struct tree *tmp;
if (node) {
/* Swapping in C is not actually a complicated task.
* You use a single temporary variable, and that's it.
* Don't use double indirection or xor swap. That's retarded.
*/
tmp = node->left;
node->left = node->right;
node->right = tmp;

/* Do recursive calls after swap.
* Don't try to abuse assignment expressions if you are new.
* In fact, for general readability, just don't do it at all.
*/
invert(node->left);
invert(node->right);
}
}

what was the big name?
and are you sure it was from codefights?

i don't understand your initial comment
can you reword it
I understand the sample code though

This is bait, right?

Point is that there is a right way and a wrong way to swap variables in C. The right way is to create a temporary variable and assign it to one of the variables being swapped. The wrong way is to do it any other way. I am not sure why you were using double indirection (pointer to pointer) for your swap, but it does not work. Another common method of swapping is using xor three times between the elements being swapped. But that actually results in worse performance compared to just this:

To swap elements A and B of type T, create variable C of type T and do the following:

C = A
A = B
B = C

I feel like this problem went away when I stopped using floppies.

>haskell is there, yet there's nothing available
>no c
lel

I've heard that going from C# to C or C++ isn't that difficult, can anyone confirm and are there any good tutorials to check out for C/C++?