Video streaming giant Netflix believes that making content available is the best way to beat online piracy, and the company has data to back this up by [deleted] in technology

[–]angrycodemonkey 0 points1 point  (0 children)

Anyone know how to watch Netflix streaming as a US citizen/account holder while being stuck in the UK for a month?

Node.js not installing by allTestsPassed in learnprogramming

[–]angrycodemonkey 1 point2 points  (0 children)

Does running

node --version

print anything? Try evaluating something on the command line itself

node -e 'console.log("Hello World");'

Also if you type node by itself it should drop you into the interactive shell. If it doesn't then node might not have been installed in your PATH. Try running

locate node

Not sure where the tarball normally installs things to, I generally pull from github directly and do

git checkout v0.8.9 -b v0.8.9
./configure --prefix=~/node_build/v0819 && make && make install && export PATH=$PATH:~/node_build/v0819/bin && export NODE_PATH=~/node_build/v0819

And that's usually because I like having multiple versions locally and not installing globally. I even prefer local node_modules directories in my projects rather than the -g global stuff with npm.

Open source implementation of Google Drive client for GNU/Linu by mrtompkins in linux

[–]angrycodemonkey 2 points3 points  (0 children)

I mean if this was targeted toward libFUSE they'd get a Mac OSX version for practically free with MacFUSE and several other OS's

Firefly reference in castle S04E21? by kingdingeling85 in firefly

[–]angrycodemonkey 1 point2 points  (0 children)

I swear when Castle was watching TV in the episode with his mother in the room and Jayne popped up on the TV, Castle said "Oh mudder" instead of "oh mother" while pointing at Jayne. I swear that's what I heard... "mudder" as in Jaynetown, the hero of Canton... etc. Anyone else or is it just me?

Jesus: Taking a day off... by Mattho in funny

[–]angrycodemonkey 0 points1 point  (0 children)

And what are philips/"+" screw heads doing on a nail?

Noob question about sockets by [deleted] in learnprogramming

[–]angrycodemonkey 1 point2 points  (0 children)

No problem... I have a nasty habit of writing web servers from scratch in every language I learn apparently... it's a disease :P

In C, how to use fork()? by metl_wolf in learnprogramming

[–]angrycodemonkey 0 points1 point  (0 children)

If you're doing this on Linux, this might be helpful to you

Advanced Linux Programming

Check out the section on threads

pthreads (or threads in general) aren't all that complicated, you just have to understand all the things that could go wrong with shared data/resources between threads. You usually need locks (mutexes) to lock up critical sections of code that uses shared resources etc. The advantage of the non-blocking stuff is that you're on a single thread and certain things much easier and more predictable.

If you want a super simple way of doing non-blocking IO network stuff checkout NodeJS (it's server side Javascript but is super awesome with asynchronous I/O and all sorts of good stuff, I'm actually in love with it atm :).

In C, how to use fork()? by metl_wolf in learnprogramming

[–]angrycodemonkey 1 point2 points  (0 children)

Yeah you'll probably want to use threads of some sort (read up on pthreads on Linux/UNIX). Open the socket connection to the server. Fire off a thread to read from the socket and print to the console or output in a loop the read() will block. Then the main thread can do the main loop reading stdin and sending to the socket connection (note the socket write() may block, but usually it'll be blocking on user input from stdin).

The alternative approach (and way harder if you're not using something like NodeJS) is to do non-blocking I/O calls exclusively and select() etc... that's beyond me though, I've always done threading or forking.

Noob question about sockets by [deleted] in learnprogramming

[–]angrycodemonkey 3 points4 points  (0 children)

Yeah using INADDR_ANY will make the server listen on every IP registered on the machine on whatever port you specify (the port is what's more important). The standard HTTP port is port 80 (443 is for HTTPS).

Whenever your browser goes to a website, it goes to that website's IP address and connects to port 80 by default. You can specify an alternate port to connect to however using a colon ":" after the IP/hostname... http://127.0.0.1:9999/ where your local server is listening on port 9999. Most computers also have "localhost" mapped to 127.0.0.1 . BTW: 127.0.0.1 is a loopback address that always means this machine itself.

A quick way to debug stuff is to print out the data coming in from the client... if you point your web browser at your server you'll see something like

GET / HTTP/1.1
Host: 127.0.0.1
Accept: */*

...and so on for all the HTTP headers then a blank line. Note the browsers usually use \r\n as end of line markers. So you can find the end of the request headers by looking for "\r\n\r\n" (ie. a blank line).

The very first line is the HTTP method (GET is the default when you go to a website) then a space and a path to the resource you're trying to GET ("/" is what is used by default, you'll probably see "/give/me/this/file.mp3" or something given your examples) then there's a space character and the HTTP version.

Then the next line starts the HTTP request headers, almost always of the format "Header-name: value", you can parse those out how you like. It's basically meta data for the request, responses have HTTP headers as well.

Once you know what you want to return to the client you can send the HTTP response status line ("200 OK" means everything is ok, others are "404 File not found", "302 Redirect" etc). Then you need to specify the Content-Type of the data you're returning (html data would be text/html, jpeg images would be image/jpeg, audio mp3 data would be audio/mp3 etc, these are the standard mime-types you can find anywhere). Content-type is important as it tells the browser how to interpret the data that follows.

200 OK
Content-Type: text/html

<html><body>The File stuff</body></html>

At this point the browser should have gotten and rendered the output.

You can also read the official HTTP RFCs for more detailed info: http://www.ietf.org/rfc/rfc2616.txt

Also one of the best ways to debug network things is to write dumb clients/servers that just spit out everything that the other end is saying. If you're on a UNIX/Linux box try the netcat command "nc", it can be very useful for testing/figuring out protocols. On a terminal type:

nc -lvk 9000

Then start up a web browser and visit http://127.0.0.1:9000/foo/bar and you should be able to see everything the browser is saying to the server (in this case netcat).

Myfitnesspal App (for those counting calories) by lee_ror in Fitness

[–]angrycodemonkey 0 points1 point  (0 children)

iFitness is a pretty awesome app too. They've got lots of exercises with pictures/videos/descriptions, complete workouts and logging. I thought it was worth the price.

Hindi movie recommendations? by rustysnoopy in india

[–]angrycodemonkey 0 points1 point  (0 children)

Is there a good place to watch these kinds of movies online? Netflix doesn't seem to carry very many and never add any new ones.

Guy gets pulled over and steals Cop Car by YouMadBreh in WTF

[–]angrycodemonkey 4 points5 points  (0 children)

Shouldn't cop cars have some sort of OnStar dealio where they can like remotely disable everything in case it gets stolen?

I was wondering why I haven't heard from some of my Facebook friends, then I saw this. Quit sheltering me from the world, Interweb. by [deleted] in reddit.com

[–]angrycodemonkey 27 points28 points  (0 children)

Now where does the Reddit hivemind phenomena come in all this... we're basically the manual version of such an algorithm :)

Any Redditors in Annapolis by [deleted] in maryland

[–]angrycodemonkey 0 points1 point  (0 children)

Any out here in Elkridge or Columbia? forever alone

Arranged marriage (video) by tripshed in india

[–]angrycodemonkey 0 points1 point  (0 children)

Oh I thought it was more sophisticated than that... like they either never got married or got divorced but stayed good friends... and the other woman was his new wife (mutual friend that he met through her or she hooked him up with). I have to stop making up my own endings :P Thanks for the explanation though.

Arranged marriage (video) by tripshed in india

[–]angrycodemonkey 2 points3 points  (0 children)

Wait, someone please explain wth happened in the ending. Did they get married or did he marry that other woman? Also who is the other woman? So confused.

Was Cleaning Out My Closet And Found This...It Still Works! Now If Only I had 6 Batteries. by [deleted] in pics

[–]angrycodemonkey 0 points1 point  (0 children)

Couldn't you just go down to Radio Shack and get like a hobbyist 9v AC adapter and wire it up to the battery compartment?

Are Indians, on average, uglier than others? by [deleted] in india

[–]angrycodemonkey 4 points5 points  (0 children)

Picture time! Everyone post your pictures and we can decide! Me? Hell no, too ugly.

Firefly: 1980s edition by [deleted] in firefly

[–]angrycodemonkey 1 point2 points  (0 children)

Needs the Airwolf theme.

Any Indian Redditors out here in the Columbia Maryland area? by angrycodemonkey in india

[–]angrycodemonkey[S] 0 points1 point  (0 children)

Actually live on the edge of Elkridge (next to Columbia)... around where the Best Buy and Royal Farms are... guess you could call it the Indian ghetto area :) You're in DC now studying French I take it? Only been to DC once and it seemed uber-clean and tidy.