Previous thread What are you working on Sup Forums?
/dpt/ - Daily Programming Thread
Other urls found in this thread:
linify.me
en.wikipedia.org
github.com
twitter.com
I don't think you understand just how bad community college programming courses are.
In my first semester of the CS track. they forced me to take CS 103, introductory programming logic, where they had us draw UML diagrams for trivial programs in MS visio and occasionally let us "implement" those UML diagrams in visual basic even though the professor never taught the syntax.
I didn't know how to do loops because he never taught them at the time and so i hardcoded all the output and got a passing grade anyway.
It was a real shitshow. Oh, and it's a prereq to all the other courses.
They also highly recommended that new students take, 101 and 102 simultaneously. I refused.
101 had a fancy name, but it was literally "how to use a computer, the class" and 102 taught the names of various computer parts and how to pass the A+ cert, or something.
Posted this right as the old one died.
REPOST:
Think of a packet as a candy, When you send it somewhere at every stop it gets wrapped in another layer of foil saying who wrapped it. Then when a packet is sent back it wraps it in the same multiple layers of foil and as devices unwrap a layer and send it to its next destination.
Going by this analogy when you send a packet saying you want to view google.com it will first say the socket on your PC that wants it (the program on your PC) Then it will say the MAC of your PC (which PC on your network). Than your public IP where you are on your ISP's network, etc.
Did I do good guys? I only took first year of CCNA three years ago and I think I remembered it right.
>implying C++ isn't fucking hideous
Sounds like your CC sucks/sucked massive dick. At mine, we learned the general ideas behind algorithms and computers for the first half of the course and Visual Basic for the traditional things in your average textbook for the second half. My professor was really nice. VB honestly ended up coming in handy much more than I'd like to admit just to know off-hand.
What's with her arms?
Fucking around with an Arduino I got yesterday. I'm making it print a pattern and letting its speed be adjustable by a potentiometer.
>print
I mean, display using LEDs.
what about them?
Well you're gonna get the dress off and discover a huge fucking mess
Building a linify.me clone, right now it's about 3x faster than linify.me.
Speed peaks at 25k-30k tested lines per second(250-300 drawn lines per second with 100 tests per line) on my crusty old Phenom II.
Pic related took 228 seconds to render(36k lines, 100 tests/line, 8 thickness). Such a render would probably take more than 15 minutes on linify.me.
I'm not working on anything now, but I lost the source code for my fan controller's firmware, so I need to get to work to rewrite that shit.
Guys, what's a really good font for editing source code and how would I go about installing it on my linux machine, I'm just about done customizing and I can't figure it out, I'll post code once I can make it look neat
Sorry for being slightly off topic
>comparing your local clone to an online service
Have you looked at the linify.me source code? It's wildly inefficient. Its method of generating lines is to randomly draw lines until it finds the best one.
linify.me
Cool.
Have you compared them side-by-side on your machine?
Have you hosted your close on a publicly accessible website with many concurrent users generating images?
anyone willing to help newb reading english book not being a native speaker? specifically C
What do you need help with?
What's your native language?
Subject: C, Lua, Entity Component System
It's been like a year since I posted here, I posted here last night but that might have been the wrong time to post; I figure one day is enough for most programmers to see it and then i'll disappear again. It all works great, but I did get busy for a few months so I may have done some code I should not have. Talking to the lua VM back and forth multiple times each frame might not be a good thing. So, I would like to know any opinions on what I can change it to.
Right now the engine has a global entity = {} table in lua, and a global g_entity_t struct array in C. The C array holds the ID numbers of active indexes in the global table, and runs functions as needed (such as think, collide, etc.), it also holds some other variables like the entities name, the x y offset, the texture index, etc..
How i've been doing this is storing the ID of the index in the lua table in the array AS WELL AS storing that index number (redundantly) in the lua table index. When the internal part calls lua, it just needs to call the index. When the lua part calls an internal function, that function goes down the list and see what internal entity holds that ID and then does it's thing.
The ladder part might be why I have a slowdown. Is there a more optimized way to pass information between C and the VM without having to rely on the ID?
pic unrelated but so that you read this
Fantasque Mono or Source Code Pro. They're perhaps not in your distro's, but in that case there are pages upon pages explaining how to do it manually for both of them anyway.
well ill sound like a total idiot but i have no idea how getchar and putchar works
polish
>polish
That's quite the coincidence, if you leave some contact, I can walk you through it.
Consolas.
great, this is what my system looks like at the moment, and everything but that terminator instance is sexy at this point
I just ironed out some bugs on a script that divides images into blocks. i'm working on some low level line detection.
from PIL import Image
im = Image.open("arrow.jpeg") #build the image object.
pix = im.load() #build the image object this has all the pixels
#Get the width and hight of the image for iterating over and make sure it's devisable by 10.
image_croped_x = (im.size[0] - (im.size[0]%10))
image_croped_y = (im.size[1] - (im.size[1]%10))
#setting some vars.
red = 0
green = 0
blue = 255
image_done = False
line_done = False
block_done = False
y_point = 0
y_count = 0
x_start = 0
x_end = 10
x_point = 0
color_count = 0
while image_done == False:
#print "Here are some stats. image_croped_x =\n image_croped_x: %d \n image_croped_y: %d\n " % (image_croped_x , image_croped_y)
if line_done == True:
if x_point >= image_croped_x - 10:
print "Image is done."
image_done == True
break
else:
x_start += 10
x_end += 10
line_done = False
y_point = 0
#print "here are some stats on the image \n x_start: %d\n x_end: %d\n line_done: %r\n y_point: %d\n" % (x_start, x_end, line_done, y_point )
else:
print "Image is not done - State: %r" % image_done
while line_done == False:
if block_done == True:
if y_point >= image_croped_y - 10:
print "line is Done"
line_done = True
break
else:
print color_count
if color_count == 0:
red = 255
green = 0
blue = 0
color_count += 1
elif color_count == 1:
green = 255
red = 0
blue = 0
color_count += 1
elif color_count == 2:
blue = 255
red = 0
green = 0
color_count = 0
y_count = 0
block_done = False
while block_done == False:
if y_count == 9:
print "block is done"
block_done = True
break
for x_point in range(x_start ,x_end):
pix[x_point,y_point] = (red, green , blue)
if block_done == False:
y_point += 1
y_count += 1
im.show()
>Consolas is a monospaced (non-proportional) typeface, designed by Luc(as) de Groot. It is a part of a suite of fonts that take advantage of Microsoft's ClearType font rendering technology.
en.wikipedia.org
Thanks, but no thanks
getchar and putchars are just shortcuts for the fread and fwrite functions to get one character from stdin or print one character to stdout.
write to [email protected] ill send you chat room invite
Anonymous Pro
30th for Go is best lang
see i dont understand even a thing. i started learning few days ago
fucking hell
Maybe you should look into the unix programming environment by kernighan and pike
reformatted
from PIL import Image
im = Image.open("a.jpg") #build the image object.
pix = im.load() #build the image object this has all the pixels
image_croped_x = (im.size[0] - (im.size[0]%10))
image_croped_y = (im.size[1] - (im.size[1]%10))
red,green,blue = 0,0,255
image_done = line_done = block_done = False
y_point y_count = x_start = x_point = color_count = 0
x_end = 10
while not image_done:
if line_done:
if x_point >= image_croped_x - 10:
print "Image is done."
image_done == True
break
else:
x_start += 10
x_end += 10
line_done = y_point = 0
else:
print "Image is not done - State: %r" % image_done
while not line_done:
if block_done:
if y_point >= image_croped_y - 10:
print "line is Done"
line_done = True
break
else:
print color_count
if color_count == 0:
red,green,blue = 255,0,0
color_count += 1
elif color_count == 1:
green,red,blue = 255,0,0
color_count += 1
elif color_count == 2:
blue,red,green,color_count = 255,0,0,0
y_count = 0
block_done = False
while not block_done:
if y_count == 9:
print "block is done"
block_done = True
break
for x_point in range(x_start ,x_end):
pix[x_point,y_point] = (red, green , blue)
if not block_done:
y_point += 1
y_count += 1
im.show()
RTFM or maybe ask a native-speaking community if English is a problem. Fuck do you speak?
No
in haskell, is there a way to select a subset of a list? like some equivalent to list(4:6) in a different language? I see all the different front/back subsetting functions and the singular index selection, but not a way to do longer filtering
Strong AI.
Can't say more...
this
*teleports behind you*
see the problem is i google it all around and i seem to not get a basic answer. everyone is just asking about errors in their code while i want to know what the fuck getchar and putchar does
polish
drop 4 . take 6, why should we use anything else?
The code on linify.me already runs client-side. It's not node.js/server-side.
Does yours run client-side on all of the major browsers?
My code isn't in JS.
>Anonymous Pro
It's perfect, thanks dude
You're building a robo-waifu aren't you?
Inconsolata.
Then why are you comparing your code to theirs?
Make it publicly accessible within a browser, or your boasts about your clone being better are just hot air.
>what getchar and putchar do
RTFM. The GNU/Linux ones are even translated in some languages, if you're lucky you'll have it in Polish. (First time I read it I took it for a shortcut for "Polish Notation". Isn't that cool, Poland?)
If you are using c++ i recommend github.com
its idiot proof
if C, why not just export object create/destroy methods to lua and handle everything there, on every iteration call from C update, draw. Kinda like love2D
thanks that looks much cleaner. What python are you using tho?
y_point y_count = x_start = x_point = color_count = 0
^
SyntaxError: invalid syntax
>thanks dude
I'm a girl.
well now i feel like an idiot. thanks
Oops, no Polandball in this one, sorry. Will you believe me if I assure you that I'm not trying to insult you? Honest.
And yes, TFM is good. It's old style to-the-point not meant for retards, which is excellent for people like you and me
np
>I'm a girl.
Whatever man
Alternatively
"Call yourself whatever you like you crazy protestant bastard"
functions not methods...
My point was, just draw in C handle everything else in lua. Your system seems awfully complicated, im doing something similiar with C++
>pretending to be someone else on anonymous board
how sad can someone be
Why the hell do I have to abide by your "rules"? I will brag about it being faster all I want and release the source when I believe it's good enough. I'll link the source here for people who might be interested and call it a day. I'm not renting a server or hosting anything because you're telling me to.
GRAYSLAKE
R
A
Y
S
L
A
K
E
Don't. Idiots can't RTM I'm afraid, and that's irritating. You're welcome Herr Poland.
t. Medkit
No.
10k neuron 'and' gate for testing....
You?
Good for you.
People like me are going to call you a faggot until you can back up your claims.
BTW, I wrote a kernel that's faster than Linux for all conceivable operations.
oops i forgot a equal sign after y_point
y_point = y_count = x_start = x_point = color_count = 0
i'm using python 2.7, but i have installed python 3.5 too
thanks for the (You)s
YOU
HAD
ONE
JOB
The spam filter ruined my fun
no (You)
>implying the Linux kernel is written in a high-level interpreted language and hosted exclusively online
suggestion: you could use openshift for free, and make a web frontend for your program
>BTW, I wrote a kernel that's faster than Linux for all conceivable operations.
you sure did, hot shot.
post the link so i can see what you got
How would you create a 2D table with variable size fields in C++? More or less like
std::vector fields;
How would you structure the class Field? As just a raw data type or a struct?
I mean, just for the sake of argument
C CAN be interpreted, it's not usually done as such but C interpreters do exist
and there's git...
So if you consider C high level as opposed to assembly, and git as online hosting...
Will watching Himegoto improve my programming skills?
>missing the point
so where's your kernel?
yes goyim! keep watching anime!
Call me a faggot all you want, I'm not going to give a single shit what you say.
Thanks user, I'll consider that.
...
>am too stupid to like anime
It's not that complicated (to me). I'm going off of how entity management for ID games was explained to me by a programmer. The game runs faster if I keep some aspects internally, and most of those internal aspects are for drawing/calculating interpolation.
I have a snapshot of about a week ago before I added in all the stuff I have, i'll hopefully figure it out at some point.
>linify.meme
literally who
>Such a render would probably take more than 15 minutes on linify.me.
who would use such a shitty website? and do it in opengl you retard
the manga is way better desu
so where's your kernel?
>retard
Excuse me?
kill yourself and fuck off to
It's not a web application you fucking retard. Also, isn't even me
but if i kill myself i can't go to
do it in opengl it would be so much faster
what is a good book to learn android programming?
Does anyone know any good opengl book or tutorial? Preferably with examples
Since my post was deleted along with the thread...
Quick! Write a program that uses a constant amount of memory to find a loop in a singly-linked list in O(n) time. You cannot modify the list in any way.
Note: "Constant memory" = the memory required for the solution cannot be a function of n.
Or this girl will hack your waifu out of existence
Why? Its such pointless excersise, have 2 pointers one lagging behind another just compare em
>pls do my homework
Who is she? Sauce.
So I know python really well.
What language do I learn now? Looking for something not as hard as C, has a ton of libraries, good GUI tools. Is c# worth learning?
I code stuff for mac, linux and windows if that helps
Consider your waifu hacked out of existence then.
Here's another.
INSTANCE: G = (V,E) is an undirected graph. R is a subset of vertices V. k is a positive integer.
QUESTION: Does there exist a subtree of G that includes all vertices of R and contains at most k edges?
Example: The graph G below, with R = { 1, 2, 3, 4, 5, 6, 10 } and k = 8, is a "yes" instance.
Prove that this problem is NP-complete.
Let x = the head of the list
Let y = some point on the loop
int findloophead(x,y)
{
pointers t, a=x, b=next(y), c=y
while (1) {
// midpoint (e,f):
// returns the pointer to the middle element
t = midpoint (a,c)
if find (b,t,c)
c=t
else
a=next(t)
t = midpoint (b,c)
// find (e,f,g): returns true if we encounter f
// in a walk from e to g, otherwise false.
if find (a,t,b)
c=t
else
b=next(t)
if (a==b)
return a;
if (a==c) || (b==c)
return c;
}
}