[Boards: 3 / a / aco / adv / an / asp / b / bant / biz / c / can / cgl / ck / cm / co / cock / d / diy / e / fa / fap / fit / fitlit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mlpol / mo / mtv / mu / n / news / o / out / outsoc / p / po / pol / qa / qst / r / r9k / s / s4s / sci / soc / sp / spa / t / tg / toy / trash / trv / tv / u / v / vg / vint / vip / vp / vr / w / wg / wsg / wsr / x / y ] [Search | Free Show | Home]

Basic Programming Tasks

This is a blue board which means that it's for everybody (Safe For Work content only). If you see any adult content, please report it.

Thread replies: 148
Thread images: 16

File: Programming for Fags.jpg (311KB, 1261x1000px) Image search: [Google]
Programming for Fags.jpg
311KB, 1261x1000px
Time to do something productive faggots.

>Bonus points for using a programming language you're not already good at
>>
Rollin' that joint
>>
>>43292725
>being productive
>>
>>43292725
Yeah, call it how I see ya
I wish I never met ya, I wouldn't wanna be ya
Pussy ass nigga, I don't want your gonorrhea
Pussy ass nigga, I don't want your gonorrhea
>>
rollan

capsha:spooken blysisl
>>
>>43292797
More productive than jacking off to Chinese cartoons
>>
let's roll
>>
>>43292725

> Be looking for this chart for some time.
> Finally someone posted it
> Proceed to save it
> The chart already existed where I was about to save it

Is it dementia or am I just that stupid...

Anyway, rolling...
>>
rolling [...]
>>
>>43292778
>Chip-8 Emulator
Maybe I should actually know C well enough before I post in these threads like a jackass...
>>
File: linkedlist.png (4KB, 632x103px) Image search: [Google]
linkedlist.png
4KB, 632x103px
>>43292861
>pointerless linked list
ohwel then
function LinkedList(){
this.nodes = [];
this.firstNode = false;

this.insertAfter = function(pointer,node){
node.next = this.nodes[pointer].next;
this.nodes.push(node);
this.nodes[pointer].next = this.nodes.length-1;
};
this.insertFirst = function(node){
node.next = this.firstNode;
this.nodes.push(node);
this.firstNode = this.nodes.length-1;
};
this.removeAfter = function(pointer){
var markedNode = this.nodes[pointer].next;
if(markedNode == null)
return false;
this.nodes[pointer].next = this.nodes[markedNode].next;
this.nodes[markedNode] = null;
};
this.removeFirst = function(pointer){
var markedNode = this.firstNode;
this.firstNode = this.nodes[markedNode].next;
this.nodes[markedNode] = null;
};
}
function Node(data){
this.data = data;
this.next = null;
}

var list = new LinkedList();
list.insertFirst(new Node(0));
for(var i=1;i<4;i++){
list.insertAfter(list.firstNode,new Node(i));
}
>>
>>43293200
name generator sounds mad boring, reroll
>>
>>43292725
rolan
>>
>>43292725
rollan
>>
>>43292725
rell
>>
>>43293056
It's relatively easy, except for the graphical part. But a week or two learning SDL should suffice, I think.
>>
>>43293639
Yeah, I don't know any C at all. Doing the "Learn c in Y Minutes" lesson right now, gonna make this a personal project while I'm off from school for a few weeks.
>>
>>43293233
area calculator for some irregular polygon
function areaOf(pl){
var area = 0;
var p = 0, q = 1;
while(p < pl.length){
var width = pl[q].x - pl[p].x;
var height = (pl[q].y + pl[p].y) / 2;
area += width * height;
p++;
q++;
if(q == pl.length) q = 0;
}
return area;
}
function Point2D(x,y){
this.x = x;
this.y = y;
}
var points = [
new Point2D(-10,0),
new Point2D(0,10),
new Point2D(10,0),
new Point2D(0,-10)
]
areaOf(points);


roll once more
>>
Im gonna do it with C#
>>
File: lknsa.jpg (1MB, 2048x1536px) Image search: [Google]
lknsa.jpg
1MB, 2048x1536px
>>43292725
Hey guys, can you help me? I'm trying to create a table on CSS for a HTTP web page. I'm really new at web coding and it's for a stupid project that I need to deliver in less then 3 hours haha.
>>
>>43293825
<table></table> ?

on css? what
>>
>>43293825
You don't create tables in CSS, you create them in HTML and apply visual styling with CSS. I would suggest a lot more reading, friend.
>>
>>43293849
Yeah, like a class on CSS that I can call multiple times to put pictures on a web page, like 3 colums of 3, you know? I tried what you said and might word too.

>>43293872
I know man, but I really don't have the time right now, I'm on this shitty web developer curse and I really don't want to delay the project. I'm going to find a better one asap though.
>>
>>43293894
Again, CSS is for styling. You can define a CSS class that will format the look of a table the same way every time, but not one that will just make the table appear there out of thin air.

A CSS class, btw:

.someclass {
text-color: black;
width: 50%; //etc....
}

Once a table is created, you would assign it the class you created by doing this:

<table class="someclass">
//table data goes here
</table>
>>
>>43292725
roll that shit
>>
rollin' rollin' rollin' what
>>
>>43292725
who made this shitty list, some of these you can do in less than a minute and some of these are mini projects
>>
>>43293960
>details validator
I don't know what the fuck that is but I'll give it a shot.
>>
>>43293939
Thanks for taking the time man, you helped me a lot.
>>
>>43293996
Glad I could help.
>>
>>43293980
User puts details into form, before it's processed and stored in the database numbers have to be the right length, emails the right format, dates converted to utc, things like that
>>
>>43294042
What a coincidence, one of my semester projects for WebDev (which ends this week) was implementing Hibernate to validate data entered into a form on a JSP page.

It was a traumatizing experience.
>>
>>43292725
fuck it
>roll
>>
>>43292725
rollin
>>
Rolling.
>>
roll
(I won't do it if I don't feel like tho)
>>
rollin' m8's
>>
But I'm at work
>I was browsing /g/ anyway so whatever
>>
>>43294228
What do you do?
>>
>>43294228
Same here, but I was up til 3 studying for my Info Retrieval (read: SQL databases) final today, and I've already realized I'm not gonna get any work done today. Might as well do something fun.
>>
>make a virtual machine for C in Assembly that converts instructions into python for readability
what the fuck
>>
>>43294228
I give support to a nigger control application its the first moth of the quarter so absolutely nothing to do
>>
>>43294366
meant for >>43294246
>>
This is actually a smart idea.
>>
rolling for something i don't even know how to start
>>
Rollin'
>>
ayy laughing my ass off
>>
whats a wumpus

also rollin
>>
rell
>>
>>43297644
too easy
>>
>rolling

http://www.youtube.com/watch?v=CtwJvgPJ9xw

something tells me it will be a long night
>>
>>43292725
JK Rollin
>>
>>43297685

fucking knew it
>>
roll
wonder if whatever I roll can be done in the script language I once wrote
>>
>>43297724
top lel
:mkint &num

:write ssGibe number plox: s
:read &num

:writeln $num ss(dec) = s (:mkbin &num) sx(bin)x
>>
lets see :D
>>
I probably won't do this but maybe.
>>
File: Screenshot-fuck shit.png (98KB, 831x547px) Image search: [Google]
Screenshot-fuck shit.png
98KB, 831x547px
I'm messing around with tkinter in python and I can't seem to get the grid method right. I've got enough space in my window, but I can't seem to make vertical space between the only two widgets I have. See image.
>>
420 rolling
>>
>>43292725
Probably won't do it anyway.
>>
>>43298003
Works with OpenBSD. GNU's date utility is different.

#!/bin/sh

now="$(date +"%s")"

printf "enter your birth date in the format YYYYMMDD: "

read then

then="$(date -j +"%s" "$then"0000)"

printf "you are %d seconds old\n" "$((now - then))"
>>
aaaaa
>>
>>43292725
I just did the ninth Project Euler problem in Matlab:

V = zeros(1,3);

while sum(V) ~= 1000
V(1:2) = randi(1000,1,2);
V(3) = sqrt(V(1)^2+V(2)^2);
end

Answer = prod(V);


N-no bully pls
>>
hm
>>
last one was 85 i cnt find anything about it :( ill try another
>>
Yeah alright
>>
>>43292725
Roll I guess?
>>
>>43292725
Well I'll bite
Rewl
>>
>>43292725
fuk it y not
>>
Could every one of these tasks be done in Scheme?
>>
>>43301524
Scheme is Turing complete. So yes.
>>
>>43301524
It would be extremely painful
>>
Im gonna roll!
>>
File: are you serial.png (66KB, 297x281px) Image search: [Google]
are you serial.png
66KB, 297x281px
>>43293825
You should've started sooner, scrub.
>>
>>43292725
Those tasks aren't done in order of difficulty are they?
>>
Rallin
>>
rolling for when I get home
>>
Am I missing something about 28? Or is it just a freebie?
>>
>>43302089
They aren't done in order of difficulty. However I think that the result is bigger than any primitives can hold (other that floating point, which wouldn't give the exact result).
>>
>>43293968
That's the point, that's why you're rolling to see which one you can do, there are a wide variety of problems. A lot of textbooks mix stupidly easy problems with insanely difficult ones. The Art of Computer Programming assigns unsolved problems.
>>
In what language would it have an average difficulty?
>>
>>43302345
ASM
>>
>>43302355
Got it, thanks.
>>
what
>>
>>43302453

never used rss in my life rerolling
>>
Working on an algorithm that, given triangular matrix of circles (all the same radius and separated so they don't touch and whose midpoints are set so that they form an equilateral triangle) and a point, will check if the point is contained within one of the circles. The algorithm I currently have in mind starts at a corner and checks the distance from the point to the midpoint of that circle. Then given that distance we know which other circles could possibly contain the point
>>
Are these threads daily or I was lucky to stumble upon one?
>>
>>43292725
ok
>>
Rollin.
>>
I'm working on making a PHP email form. Mostly use Python, need to learn PHP for work though. Any help on this?

HTML
<form method='post' action='contact.php'>

<input name='name' placeholder='Name'><br>
<input name='phone' placeholder='Phone number' ><br>
<input name='date' placeholder='Date of Birth'><br>
<input name='zip' placeholder='Zip Code'><br>
<input type='submit' value='Submit'>

</form>


PHP

<?php

$to = "[email protected]";
$subject = "Submission Form";
$name = $_POST['name'];
$phone = $_POST['phone'];
$dob = $_POST['date'];
$zip = $_POST['zip'];

$message .= "Name: ".($name). "\n";
$message .= "Phone: ".($phone). "\n";
$message .= "DOB: ".($date). "\n";
$message .= "Zip: ".($zip). "\n";

$headers = "[email protected]";

@mail($to, $subject, $message, $headers);

?>
>>
>>43303093
I accidently both code tags
PHP
<?php

$to = "[email protected]";
$subject = "Submission Form";
$name = $_POST['name'];
$phone = $_POST['phone'];
$dob = $_POST['date'];
$zip = $_POST['zip'];

$message .= "Name: ".($name). "\n";
$message .= "Phone: ".($phone). "\n";
$message .= "DOB: ".($date). "\n";
$message .= "Zip: ".($zip). "\n";

$headers = "[email protected]";

@mail($to, $subject, $message, $headers);

?>
>>
File: 1383510028724.jpg (64KB, 640x905px) Image search: [Google]
1383510028724.jpg
64KB, 640x905px
>>43292725
Rolling

but I might not do it if it's too hard~
>>
File: aw-yiss-best-korea.jpg (13KB, 286x258px) Image search: [Google]
aw-yiss-best-korea.jpg
13KB, 286x258px
>>43292725
Rollin
>>
>>43292725
duckroll
>>
I'd like to try something random so here we go.
>>
roll
ill probably not do it anyways, unless it funs
>>
>>43303134
re-rolling since I have no idea what it could mean by "Benfords Law" that takes longer than 5 seconds
>>
>>43303397
Researching into it now.
I've just made the memory mailboxes.
>>
>>43292725
roll
>>
Rollin for later, took a semester off of CS courses so I should probably try my hand at some Java again.
>>
>>43303416
<code>
#!/usr/bin/env python3.4

vowels = ['a', 'e', 'i', 'o', 'u']

def vowelcount():
string = input("Input: ").lower()
count = 0
for i in string:
if i in vowels:
count += 1
print(count)

vowelcount()
</code>
Is this good? Or could I do something better? I haven't been doing python for that long so any feed back would be appreciated.
>>
>>43303976
Hopefully this formats it correctly...
#!/usr/bin/env python3.4

vowels = ['a', 'e', 'i', 'o', 'u']

def vowelcount():
string = input("Input: ").lower()
count = 0
for i in string:
if i in vowels:
count += 1
print(count)

vowelcount()
>>
rrroooooooollllllllllllllllllllllllllllllll another one

jus' laik tha uther un'

don't bo-gart that joint
mah friend

paiyus it ovar tuh mee
>>
rolan
>>
>>43304056
Oh shit math

I will do what I can I swear it

How the fuck to I generate ASCII graphics anyway?

I was just thinking earlier, how do people make, let's say, a grid in a terminal and plot points on it? Or graph a sine wave just through text? I saw a C program that did that with some weird printf trick that I don't understand.
>>
>>43292725
rolling going
>>
>>43292725
r-r-r-roooolll
>>
rollingg
>>
what's all this then
>>
Rollin' Rollin' Rollin'
>>
>>43304109
import random as pseudorandom

subjects = [
("is",['A car','Technology','A woman','A person','A dog','A cat','My neighbor','My fiancee','4chan','Obama']),
("am",['I']),
("are",['People','My friends','Teachers','Policemen','Politicians','Things'])
]

adjectives = ['dumb','gay','intelligent','evil','religious','sick','unhealthy','wrong','right','idiotic','lazy','green','black','whiny']

people = ['4chan','/g/','Anonymous','Random Citizen','That guy at school','My mother','My uncle']

def generate_quote():
verb,subjectlist = pseudorandom.choice(subjects)
subject = pseudorandom.choice(subjectlist)
adjective = pseudorandom.choice(adjectives)
person = pseudorandom.choice(people)

return "%s %s %s - %s" % (subject, verb, adjective, person)

for i in range(10):
print(generate_quote())


People are dumb - 4chan
I am dumb - 4chan
I am gay - That guy at school
I am lazy - /g/
My friends are religious - Random Citizen
Policemen are unhealthy - That guy at school
Obama is idiotic - Random Citizen
Technology is religious - 4chan
I am right - /g/
I am right - /g/


went better than expected.
>>
>>43304099
You join three lists of three underscores with a '|' character.
Congrats, you got a tic-tac-toe grid.

.4
.3
.2
.1
.0_____________________
.-1
.-2
.-3
.-4

That's ya graph for ya sign wave.
>>
>>43304366
>I am right - /g/
>I am right - /g/
Top jej.
Now make it enclose the quote in quotation marks.
>>
>>43304366
change the 'for i in range(10): print (generate_quote())' part of your code to this -
stop = 'Go'
while stop != 'stop':
for i in range(10):
print(generate_quote())
stop = raw_input('Type \'stop\' to stop.)

and it would be shippable as a professional application. :^)
>>
File: laughing.gif (417KB, 267x199px) Image search: [Google]
laughing.gif
417KB, 267x199px
>>43304406
I laughed about that too

new code and new randoms
import random as pseudorandom

subjects = [
("is",['A car','Technology','A woman','A person','A dog','A cat','My neighbor','My fiancee','4chan','Obama']),
("am",['I']),
("are",['People','My friends','Teachers','Policemen','Politicians','Things'])
]

adjectives = ['dumb','gay','intelligent','evil','religious','sick','unhealthy','wrong','right','idiotic','lazy','green','black','whiny']

people = ['4chan','/g/','Anonymous','Random Citizen','That guy at school','My mother','My uncle']

def generate_quote():
verb,subjectlist = pseudorandom.choice(subjects)
subject = pseudorandom.choice(subjectlist)
adjective = pseudorandom.choice(adjectives)
person = pseudorandom.choice(people)

return '"%s %s %s" - %s' % (subject, verb, adjective, person)

for i in range(10):
print(generate_quote())


"My neighbor is sick" - My mother
"I am evil" - /g/
"Teachers are gay" - /g/
"Obama is sick" - My uncle
"Technology is evil" - Random Citizen
"Obama is gay" - /g/
"Things are whiny" - /g/
"Teachers are green" - My uncle
"My friends are black" - My mother
"Policemen are whiny" - 4chan
>>
File: beepbopdog.jpg (70KB, 460x433px)
beepbopdog.jpg
70KB, 460x433px
>>43304479
meh. do it yourself. lazy :)
>>
>>43292725
rolling
>>
File: ohfuckimgreat.png (1KB, 250x36px) Image search: [Google]
ohfuckimgreat.png
1KB, 250x36px
>>43304200
well fuck.

My thing makes names of the length provided, fuck you and your pre-made names list.
>>
>>43304545
Time to roll!
>>
>>43304518
looks like I'm doing Minesweeper. Nice.
>>
>>43304602
Fuck, I've already done a temp converter. Reroll.
Also, didn't mean to reply to >43304545
>>
Using this thread instead of creating a new one for this question:

I want to learn Python; should I learn 2.7.x or 3.x?
>>
File: fromthepast.jpg (16KB, 480x360px) Image search: [Google]
fromthepast.jpg
16KB, 480x360px
>>43304545
was bored

import random as pseudorandom

consonants = ['b','c','d','f','g','h','k','l','m','n','p','r','s','t','v','w','x','z']
vocals = ['a','e','i','o','u','y']

both = [consonants,vocals]

def generate_name(length=3):
gid = pseudorandom.randint(0,1)
name = ""
for i in range(length):
ch = pseudorandom.choice(both[gid])
name += ch
gid = (gid + 111) % 2
return name

for i in range(10):
print(generate_name(pseudorandom.randint(3,10)))


olali
iri
adepuh
hefux
napi
asisozi
zahukec
ivuryduga
domu
avihu
>>
rolling again
>>
>>43304647
I would start with python 2.7 and then learn the differences between 2.7 and 3 as there aren't many.
>>
>>43304366
rolling again. bored...
>>
>>43304677
reroll. can't motivate myself to do some visualization shit.
>>
>>43292725
roll roll ROLLLL
>>
i'll bite
>>
rollan
>>
>>43304769
already done, sorry /g/
>>
oh
>>
File: 1405600469205.gif (80KB, 256x256px) Image search: [Google]
1405600469205.gif
80KB, 256x256px
>>43292725
Rolling for dubs
>>
File: scratch.gif (1MB, 960x540px) Image search: [Google]
scratch.gif
1MB, 960x540px
>>43304687
Here you are

#python 3

def pascaltriangle(length):
l = [1]
yield l
for i in range(length-1):
nl = [1]
for j in range(len(l)-1):
nl.append(l[j]+l[j+1])
nl.append(1)
yield nl
l = nl

def prettyprint(l,w):
s = " ".join(map(str,l))
indent = int((w - len(s))/2)
s = (indent * " ") + s
print(s)

length = int(input('Length of pascal triangle: '))

for n in pascaltriangle(length):
prettyprint(n,length*3)


Example:
Length of pascal triangle: 10
1
1 1
1 2 1
1 3 3 1
1 4 6 4 1
1 5 10 10 5 1
1 6 15 20 15 6 1
1 7 21 35 35 21 7 1
1 8 28 56 70 56 28 8 1
1 9 36 84 126 126 84 36 9 1
>>
>>43304669
Just installed both 2.7.8 and 3.4.1 and renamed python.exe to python3.exe in the 3.4.1 installation folder and added both to path. I'll just first write for python 2 and then create a new version of the same code for python 3, should easily learn to use both that way.
>>
hellllllllllllo
>>
>>43304889
pac man clone with ai fuckkkkkkk i don't know about that one
>>
>>43292725
Rolololololololo
>>
File: bender_neat.jpg (16KB, 352x365px) Image search: [Google]
bender_neat.jpg
16KB, 352x365px
>>43304879
good job. have fun learning :)
>>
File: minesweeper.gif (78KB, 165x165px) Image search: [Google]
minesweeper.gif
78KB, 165x165px
Did minesweeper, /g/ edition
>>
>>43304984
ayyy lmao
>>
File: oh-the-huge-manatee.jpg (24KB, 400x315px) Image search: [Google]
oh-the-huge-manatee.jpg
24KB, 400x315px
>>43304984
>pol
top lel

nice one
>>
>>43304984
>/g/ these days
>>
>>43304984
10/10
>>
>>43304851
that's cool

>>43304984
jesus christ
i lol'd
>>
>>43305057
t-t-thanks.
>>
>>43292725
roll
>>
thanks guys, rerolling

here's the game if anyone wants to try it out and play

filedropper com / minesweper-g-edition
Thread posts: 148
Thread images: 16


[Boards: 3 / a / aco / adv / an / asp / b / bant / biz / c / can / cgl / ck / cm / co / cock / d / diy / e / fa / fap / fit / fitlit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mlpol / mo / mtv / mu / n / news / o / out / outsoc / p / po / pol / qa / qst / r / r9k / s / s4s / sci / soc / sp / spa / t / tg / toy / trash / trv / tv / u / v / vg / vint / vip / vp / vr / w / wg / wsg / wsr / x / y] [Search | Top | Home]

I'm aware that Imgur.com will stop allowing adult images since 15th of May. I'm taking actions to backup as much data as possible.
Read more on this topic here - https://archived.moe/talk/thread/1694/


If you need a post removed click on it's [Report] button and follow the instruction.
DMCA Content Takedown via dmca.com
All images are hosted on imgur.com.
If you like this website please support us by donating with Bitcoins at 16mKtbZiwW52BLkibtCr8jUg2KVUMTxVQ5
All trademarks and copyrights on this page are owned by their respective parties.
Images uploaded are the responsibility of the Poster. Comments are owned by the Poster.
This is a 4chan archive - all of the content originated from that site.
This means that RandomArchive shows their content, archived.
If you need information for a Poster - contact them.