Sign in to follow this  
Followers 0

Programming?

60 posts in this topic

Posted

#include <pthread.h>

#include <unistd.h>

#include <stdio.h>

#include <stdlib.h>

#include <string.h>

#include "user.h"

void *worker(void *arg){

while(1){

if(((user_t*)arg)->sux){

printf("&ssux\n", ((user_t*)arg)->name);

break;

}

}

}

int main(int argc, char **argv){

pthread_t **threads=malloc(sizeof(pthread_t *)*(argc-1));

void **output=malloc(sizeof(void *)*(argc-1));

int i=1;

for(;i<(argc);i++){

pthread_create(&(threads[i-1]), NULL, worker, findUser(argv));

}

int j=0;

for(;j<(argc-1);j++){

pthread_join(threads[j], (void**)&(output[j]));

}

}

:insane: What is that? What language is it even?

Share this post


Link to post
Share on other sites

Posted

its a multithreaded joke that got out of hand

also its C

think of parallel programming as the thing that lets your computer run multiple applications at the same time, efficiently

also there was indenting but it got ruined after i posted

oh shit wait i forgot to free the memory i allocated at the end and now there is memory leaks i am a FOOL

Share this post


Link to post
Share on other sites

Posted

I know I probably should know this already, but what kind of things can Python do? I know it is more of a scripting language then a programming language, so what sort of scripts can it write?

Python's used pretty extensively for web development (Django is the most popular of its web development frameworks I think). Most notably, Google uses Python for lots of things (also Yahoo and Youtube), which is a big reason for why it started gaining popularity. BitTorrent was written in Python up to its 6.0 release. Apparently Civilization IV uses Python for its inner logic including AI, and Battlefield 2 uses it for all of its addons and things like score keeping (hi wikipedia).

So it's pretty common deal to write something up in Python, then reprogram certain parts where performance is critical in a language like C++, or to use python as an ADHESIVE for parts that need to be easy to maintain

I don't know much about Lua, but it's like the most popular scripting language in games and has a reputation for being fast

Share this post


Link to post
Share on other sites

Posted

updated it using code BBC tag to make it readable.

did not add the freeing memory part to remind me of my mistake FOREVER

Share this post


Link to post
Share on other sites

Posted

python.png

this is all I really know about python

Share this post


Link to post
Share on other sites

Posted

That's all you need to know

typing "import antigravity" in the Python interpreter brings up that page, also

Share this post


Link to post
Share on other sites

Posted

Next MP we are doing is MapReduce

Share this post


Link to post
Share on other sites

Posted

holy shit this is the best April Fools joke ever

http://goo.gl/i4onu

Share this post


Link to post
Share on other sites

Posted

PYRAMID! I'm from Egypt XD

Share this post


Link to post
Share on other sites

Posted

learn it in a college who's strongest department is computer science

elitist

can't even spell whose right

Java is a bad idea to learn as a first language. It's conventions are rather different from a lot of other languages, and its overreliance on classes can make learning other languages after Java confusing.

This is absolutely true. Watch out!

Share this post


Link to post
Share on other sites

Posted

i noticed that the more advanced programming techniques i learn

the more typos i make

soon i will make all of my posts in c format

Share this post


Link to post
Share on other sites

Posted

I don't think "who's" is valid C

BAADDA BOOOM BBABAAAAAAA

Share this post


Link to post
Share on other sites

Posted

while(1) printf("gannysux ");

Share this post


Link to post
Share on other sites

Posted

so i finished MapReduce the day after I got it so I dont have homework in that class for 2 weeks

basically, MapReduce was created due to parallelization.

So, Imagine I have a huge text file, or some other form of data. I want to Find out how much a certain piece of data occurs in the file (like a word). You could do a linear O(n) run through the whole file and count it up that way, OR you could use parallelization to divide the file up into smaller files, and have each one of those get scanned through at the same time.

MapReduce is for this situation right here:

imagine i want to count the number of each letter in "Hello World"

After parallelization, you get

H 1 E 1 L 2 O 1

W 1 O 1 R 1 L 1 D 1

but you need to combine these two lists, both of which contain L's and O's. So that its

H 1 E 1 L 3 O 2 W 1 R 1 D 1

this is a really simple explanation but a good one

Share this post


Link to post
Share on other sites

Posted

our last assignment is going to be implementing a web server

idk if I will be able to link you guys to it but I will certainly try

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  
Followers 0

  • Recently Browsing   0 members

    No registered users viewing this page.