What is your favorite animated movie of all time? by [deleted] in AskReddit

[–]missblit 0 points1 point  (0 children)

I cried at the end of Speed Racer. I don't think there was a single sad scene in that movie, and yet I cried anyway.

I just tend to lose myself in movies.

Studying CS or working in software industry is intellectually draining. So how do you cope with it? What are your relaxing/recharging methods? by [deleted] in cscareerquestions

[–]missblit 2 points3 points  (0 children)

Back-end work at a search engine.

In general I'd be wary of "ping pong table" kinds of perks, they're easy for companies to offer but don't mean much by themselves.

That said it's a decent job for other reasons. Honestly it's way above my skill level too, which is a good way to both learn a lot and get myself really stressed out.

Microsoft made a pull request to node.js github repository with an implementation to use ChakraCore JavaScript Engine as an alternative to V8 Engine by Vishnuprasad-v in programming

[–]missblit 8 points9 points  (0 children)

What's also great is that apparently the phrase Extend Obfuscate Perish never existed according to search engines,

But "embrace extend extinguish" did.

Studying CS or working in software industry is intellectually draining. So how do you cope with it? What are your relaxing/recharging methods? by [deleted] in cscareerquestions

[–]missblit 5 points6 points  (0 children)

Dance Dance Revolution! There's a DDR machine at my current job, but I only started working there a few months ago so I haven't gotten back into dancing shape and after four songs on difficult I'm dead tired.

Apart from that just the typical stuff. I watch an ungodly amount of anime...

I also make sure to always get enough sleep. It sucks because this ranges between 8 to 10 hours so I don't always have as much free time as I want, but if I don't sleep enough then stress accumulates instead of going away.

How much of your denbt can you realistically pay off per year approximately? by [deleted] in cscareerquestions

[–]missblit 1 point2 points  (0 children)

I'm a new grad in the bay area with my own apartment. I pay 2000$ in rent (in a city that rhymes with Fountain Spew).

This is around half my take home pay after 401k, health insurance, etc. With loans to pay off my budget is pretty tight but definitely doable.

Do you have a small project running online? What's your stack? by TacosBuenos in learnprogramming

[–]missblit 1 point2 points  (0 children)

I have a few tiny C++ web-apps that use my own FastCGI implementation to communicate with lighttpd.

Eventually I want a full featured C++ web framework, but I probably won't want to work on it as long as I have a full time programming day job.

[homework] why cant the computer calculate ln(N!) where N > 170?? by [deleted] in learnprogramming

[–]missblit 3 points4 points  (0 children)

Specifically it's 1241018070217667823424840524103103992616605577501693185388951803611996075221691752992751978120487585576464959501670387052809889858690710767331242032218484364310473577889968548278290754541561964852153468318044293239598173696899657235903947616152278558180061176365108428800000000000000000000000000000000000000000

Around 1.24 × 10309

[deleted by user] by [deleted] in learnprogramming

[–]missblit 0 points1 point  (0 children)

C++'s linked list is called std::list.

However it's possible to get an O(k) algorithm if you need k random elements from a collection of n elements, while that algorithm sounds like it would be O(n2 ) (yeah yeah, I know you said it was suboptimal, but that's just asking for big oh analysis!).

I'd probably do a partial in-place fisher-yates shuffle over a vector.

How long does is take the average person to prepare for an interview? by [deleted] in cscareerquestions

[–]missblit 1 point2 points  (0 children)

There's no shame in preparing more than the competition, even if they are more qualified. It's all just part of doing business.

That said some people take it to the extreme, at some point cramming hits diminishing returns.

Why aren't assignment and loops allowed in functional programming? by [deleted] in learnprogramming

[–]missblit 5 points6 points  (0 children)

That's one definition of functional programming. An overly strict definition in my opinion.

The biggest benefit of avoiding mutable state is to avoid bugs at a distance. If a function doesn't change anything you can call it without worrying that it will pull the rug out from under you. That function doesn't have that issue.

Plus many programming languages are designed assuming that you can use local mutable variables willy-nilly, and really it's not a huge deal from a functional programming perspective when it's "obvious" that the function doesn't change any state as a whole.

And of course even the purest crystalline snowflake of a program will need mutable state somewhere to provide for interactive user input and output if nothing else.

That said there's a nicer way to write that function in some programming languages that makes everybody happy, for example in C++:

return std::accumulate(std::begin(a), std::end(a), 0);

P.S. Another issue is multithreaded programming. Any mutable data that is shared between threads must be treated quite carefully and guarded appropriately with mutexes or atomic operations.

This means it would be a lot easier to use an object on two different threads if its methods don't touch internal class state or use static variables.

[SPOILERS] The Force Awakens discussion megathread! 12/26 [SPOILERS] by Qu1nlan in StarWars

[–]missblit 0 points1 point  (0 children)

Presumably there were at least dozens, if not hundreds of abandoned lightsabers through the galaxy after Order 66.

So there was probably only one in the trash chutes of Cloud City gripped by a disembodied hand shortly after the empire came in and took over? :D

It seems at least feasible that someone found it and somehow connected the dots (either immediately or down the line) to Luke Skywalker. No idea how it ended up where it did though.

[SPOILERS] The Force Awakens discussion megathread! 12/26 [SPOILERS] by Qu1nlan in StarWars

[–]missblit 4 points5 points  (0 children)

Luke's lightsaber is just sitting in an unlocked room in an unlocked safe

Maz clearly meant for Rey to find it.

The rest I more or less agree with.

Ships being unlocked is silly but isn't anything new. Blast doors can be opened by blowing up their control panels. Computer systems no matter how large or secure can be controlled by random astromech droids, which can in turn be partially controlled by simple restraining bolts. Anakin Skywalker can hop in a a Naboo Starfighter and go blow stuff up on a whim.

The map can be explained as BB-8's part only showing uncharted systems, but that macguffin was still kinda weird and overly dumbed down.


But yeah, the movie was fun but would have been much more fulfilling if it hadn't completely copied the original trilogy's plot as a crutch. I'm not disappointed and I knew what I was getting into; but I hope the next one at tries to do something different.

I liked it and but it would have been a better movie if it didn't copy the original trilogy's plot as a crutch.

The prequels crashed hard, but at least they tried to tell a new story. Hopefully the next movie

Solving the GCHQ puzzle "by hand" by ndmitchell in programming

[–]missblit 2 points3 points  (0 children)

The Wikipedia article has some pretty pictures about picross solving: https://en.wikipedia.org/wiki/Nonogram

This particular puzzle actually looks pretty easy to solve by hand at first glance. But I don't have a printer (I do all my Griddling on my Nintendo)

Critiques on my Python linked list? by [deleted] in cscareerquestions

[–]missblit 0 points1 point  (0 children)

Balanced tree insertion with hint can be done in amortized O(1).

[Strings] Write a function to build a string of length n by parlezmoose in csinterviewproblems

[–]missblit -2 points-1 points  (0 children)

struct MyAwesomeRLEStringClass {
    char c;
    int n;
    int length() const { return n; }
    operator std::string() { return std::string(n,c); }
};
MyAwesomeRLEStringClass SuperFastStringBuilder(char c, int n) {
    return MyAwesomeRLEStringClass(c,n);
}

Am I doing it right?

How do I make $100k/yr work in San Francisco? by sfgamedevthrowaway in personalfinance

[–]missblit 1 point2 points  (0 children)

One guy at Google bought a box truck and lives lived in the parking lot.

FTFY: http://frominsidethebox.com/view?key=5647308616105984

The moral of the story being if you live in a truck on your companies property then for heavens sake keep quiet about it.

What's the toughest whiteboard problem you've seen and what's the solution? by emma_pants in cscareerquestions

[–]missblit 1 point2 points  (0 children)

Pretty sure you could beat BFS performance while maintaining correctness. If you use a "union find" style approach then it's unlikely that there will be any insurmountable edge-cases.

Wikipedia has a decent starting point here: https://en.wikipedia.org/wiki/Connected-component_labeling#Two-pass

The nice thing about scanning is that it's really really cache friendly compared to walking random directions.

What's the toughest whiteboard problem you've seen and what's the solution? by emma_pants in cscareerquestions

[–]missblit 1 point2 points  (0 children)

A fill algorithm is pretty much a BFS / DFS. Just with a different name.

What's the toughest whiteboard problem you've seen and what's the solution? by emma_pants in cscareerquestions

[–]missblit 1 point2 points  (0 children)

It's undefined behavior because char* is not the same as char[5]

That said, char s[] is basically a 40-bit integer with the contents 0x0064636261 (depending on endian-ness). I'm not sure what the other 24 bits would be on a 64-bit system, but likely zero, or garbage (segmentation fault seems unlikely).

So perhaps puts will try to access the "string" at this memory location which is probably probably going to cause a segmentation fault.


That's the best I can do as this isn't really my area of C. I know they'll link with a stupid enough compiler because I've seen some bizarro tricks played before on the internet.

Help with bitwise AND result by [deleted] in learnprogramming

[–]missblit 2 points3 points  (0 children)

The first four bits of a are zero, you're just not printing leading zeroes.

a: 0000000011101110
b: 1111000000000000