[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]

/dpt/ - Daily Programming Thread

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: 319
Thread images: 34

File: Calculus of Maki Constructions.png (312KB, 452x355px) Image search: [Google]
Calculus of Maki Constructions.png
312KB, 452x355px
Maki Edition

What are you working on, /g/?


Previous Thread: >>57753030
>>
>>57757949

first for kangz
>>
HoTT is always MLTT, not CoC, though.
>>
4th for java is as memory-piggy as notch is fat.
>>
>set breakpoint at end of function in Visual Studio
>run to breakpoint
>check return value
>modify function while program is paused
>set program counter to top of function
>run through function again and check return value
Sup gdbfags. I bet you cli losers wish you had these tools.
>>
>>57758026
We do.
>>
Can anyone tell me what indices are for in graphics programming?
https://www.tutorialspoint.com/webgl/webgl_interactive_cube.htm
>>
>>57758057
order in which the vertices are drawn
>>
File: 1.png (2KB, 404x404px) Image search: [Google]
1.png
2KB, 404x404px
i want to run Open-Gl programs written in C / C++ on Windows, but i don't want to use an IDE.

how do i run things from the terminal, like i do on linux?

long story short, the pc i bought has new drivers not yet supported in linux ,so i have to use windows
>>
File: .jpg (109KB, 592x444px) Image search: [Google]
.jpg
109KB, 592x444px
maki a slot
>>
>>57758041
>We do.
>mfw gdbfags think rerunning the program a thousand times is the same as what VS offers
>>
>>57758093
>reading comprehension
>>
what are some good irc networks/channels for programming?
>>
File: Capture.png (33KB, 655x327px) Image search: [Google]
Capture.png
33KB, 655x327px
How do I loop so that the patterns at the top also show up where I drew X's? I've tried nested loops but it won't fill the entire space. Basically it should be 3x3. Python. Please if possible explain it to me like you would explain to a retard.
>>
>>57757949
Please stop using anime in a tech discussion board
>>
>>57758079
??
you just cd into the folder and type the program name

are you retarded
>>
File: tegaki.png (4KB, 400x400px) Image search: [Google]
tegaki.png
4KB, 400x400px
>>57758057
There are only four unique vertices to this shape but you need to supply six. Indices let you do this without duplicating information.
>>
>>57758143
Why?
>>
>>57758150
Nah. This doesn't work until you put "./" in paths. Just type in ./program
>>
File: 1479605384651.png (85KB, 388x218px) Image search: [Google]
1479605384651.png
85KB, 388x218px
what are some things someone who (semi)-manages programmers but is not a programmer (rather, an engineer) know?
>>
>>57758176
Anime belongs in /a/
>>
has anyone ever created an algorithm to either

1. classify an image as anime or not anime
2. quantify the animeness of a given image
>>
>>57758191
shitty paradigms you can force onto them
>>
>>57758186
? you do exactly the same on windows except skip ./
>>
>>57758191

Things to tell every programmer without even looking at their code:

>complaint to compliment ratio of 4 to 1
>tell them to comment more
>tell them to add more unit tests
>tell them to be more descriptive with their commits
>>
Hey /dpt/, a newbie here.

I am trying to program this excercise: you are given a matrix and you have to list a submatrix of a given sum. The numbers are integers, both positive and negative.
Would the correct aproach be to make a summed area table and check all the submatrices?
Also would someone mind posting a way to give a function an array as a parameter (in C)? Still trying to wrap my head around all the pointer stuff (inb4 brainlet)
>>
>>57758191
>>57758217

Could you please not post emoji's so we can at least PRETEND this website hasn't been completely taken over by normies?
>>
>>57758079
You could use cygwin or mingw with msys. The former replicates a linux experience while the later simply supports a good chunk of it.

But yeah, you could just open a console and do the same with dos commands instead.
>>
File: 1479298232850.png (14KB, 694x580px) Image search: [Google]
1479298232850.png
14KB, 694x580px
>>57758238
Knew i'd trigger a NEET with those.
>>
>>57758228
Oh shit. Didn't see "on window"

Man fuck Windows
>>
>>57758203
Discussion of anime in general belongs in /a/, anime pictures belongs in all boards as 4chan is a website where anime fans gather to discuss a variety of topics.
>>
File: motorola_68000_pkg_1000w.png (465KB, 1000x315px) Image search: [Google]
motorola_68000_pkg_1000w.png
465KB, 1000x315px
Any oldfags able to recommend a good assembler for the Motorola 68000?
>>
>>57758246
At least keep your shitposting related to the board you're on, sjeez.
>>
File: 1469757406811.jpg (307KB, 1111x597px) Image search: [Google]
1469757406811.jpg
307KB, 1111x597px
>>57758268
4chan hasn't been about anime for over half a decade now
>>
>>57758079
Maybe look into MinGW, Cygwin, or Scoop. For just compilers & other tools: MinGW. For a more "complete" environment: Cygwin. Scoop might be able to substitute or work nicely with Cygwin for an even more complete experience---seems like a nice and convenient package manager. MinGW is also a package manager but not as "opinionated", I guess. Scoop's default package index seems to refer to a MinGW source for a lot of Unix utilities (compiled for Windows), by the way.

Anyway, I'd recommend MinGW, true & tested, or *maybe* try out Scoop but it's not as well-known.
>>
demographics check

http://www.strawpoll.me/11763548
http://www.strawpoll.me/11763548
http://www.strawpoll.me/11763548
>>
>>57758026
Visual studio is terrible but it's one of he best complete packages for debugging atm.

Which sucks ass. It's complete aids and should have so many more features. You can't even have it track frees and allocations for you. Tracking down freeing freed memory bugs is something every debugger should help with. And all they do is do the cdcd and feeefeee.
How about you just put an address to the where the code is that did that free huh? Delimited with some symbols if you want to be picky.
Jesus.
>>
>>57758234
if you need comments you have failed at writing clear code
>>
>>57758026
Ha! Real programmers only use print statements.
>>
>>57758217
It's easy. I've been running a web spider, classifying images as anime/non anime based off the text on the webpage. After I get a sufficient amount, I'll be able to implement a caffe convolutional neural network and have a javascript link to it.

Finally... No more anime
>>
>>57758217
no, there is no way for someone to tell whether an image was drawn by a japanese animation studio (except for reverse image search)
>>
>>57758380
>>57758377
no you retards

by analyzing the image itself
>>
>>57758054
Ok cool il check it out. I'd like to broaden my view of programming but if it can't run well there's no point in it for me. It's not hard to write software that runs slowly quickly. If a FP language can replace that slowly somehow that'd be cool. Even if it's just a fraction of what you get with other languages.
>>
>>57758388
That's what I ( >>57758377 ) suggested? I just don't want to spend 50 years making up rules, so I'm comparing pictures to a anime convolutional neural network
>>
>>57758362
My brother was like this. He was a gay python programmer who only used print statements.

Now he has programmed his own OS on his own hardware using his white blood, masculine sweat and blue-eyed tears.
All because he started to use pycharm so he could get done with that intro language.
>>
People who can't use proper punctuation, capitalize correctly or use acceptable grammar should not be allowed on /dpt/.
It makes us look like children.
>>
>>57758496
2bh the same with anime posters
>>
>>57758505
That's less offensive than what I mentioned.
>>
>>57758073
>>57758158
Thanks!
>>
>>57758026
>. I bet you cli losers wish you had these tools.
you stated it yourself
>>
>>57758496
I agree. People who can't do that are either the types of idiots who don't belong here or are phoneposters.
All it does it bring the quality of the whole place down, and make other idiots think they're welcome here.
It's the same with frogposters and feelfags.

>>57758505
>Complaining about Chinese food in a Chinese restaurant
I think you should leave, idiot.
>>
>>57758621
If by Chinese food, you mean actual Chinese food like insects and frogs, and Chinese restaurant by an American offshoot of a popular Chinese restaurant, then yes, you're right
>>
>>57758138
you are not changing the y co-ord (vertical). Change that (and so long as your loop is drawing more than 3) after every 3 and it should be alright
>>
Could someone post the image where it shows a person programming in C # and in the other comic shows programming in Java and a monster appears?

Thanks advance!
>>
>>57758186
Not on Windows (stupidly enough…).
>>
>>57758852
Really? . Is current path on Windows. / works on Windows
Why wouldn't ./prog.exe work on Windows?
>>
File: 1479246539659.jpg (31KB, 246x353px) Image search: [Google]
1479246539659.jpg
31KB, 246x353px
why are there so many animeNEETs on /dpt/
>>
>>57758942
Backslashes, right?
>>
>>57758955
It's an anime imageboard
>>
>>57758991
I'd have to check but I'm pretty sure I do do ../
>>
>>57759015
not for the last 7 years it isnt lmao
>>
>>57757949
>HoTT
>calculus
fag
>>
>>57759015
lol
>>
>>57759022
t. newfag
>>
>>57759038
t. man living in denial
>>
>>57759015
So, when you're on 4chan.org, and you click on "anime", it sends you to /g/?
>>
File: 1452403462016.png (79KB, 307x400px) Image search: [Google]
1452403462016.png
79KB, 307x400px
>>57759022
You should leave.
>>
>>57758942
What I mean is that the current directory is basically in the PATH on Windows---you do not need to type "./". (In fact I don't know if it'd work.)
>>
>>57759049
I think we can agree that this is the best argument newfags have that the site should change to be about them
>when you're on 4chan.org, and click on "anime" it sends you to /g/
What a fucking retard
>>
>>57758991
I've never understood why forward slashes are seemingly *sometimes* allowed to substitute backslashes in paths on Windows …
>>
File: 1477781948039.jpg (60KB, 500x495px) Image search: [Google]
1477781948039.jpg
60KB, 500x495px
>dpt isn't even about programming it's literally just triggered animeNEETs furious because this website was cucked from them by the dreaded normies
>>
>>57759107
>Talks about normies
>Posts a fucking frog
Go back to facebook, you fucking fag.
>>
>>57759083
You said this is a anime imageboard.

This board is Technology. Not anime. If you're looking for the anime board, go to /a/. You seem like you're lost
>>
>>57759123
How fucking new can you be?
4CHAN is the imageboard
>>
File: 1391219317257.png (580KB, 800x2810px) Image search: [Google]
1391219317257.png
580KB, 800x2810px
>>57759123
>>
>>57759103
I think it's amazing that paths are represented by strings in the first place.
>>
>>57759123
an anime*
>>
>>57759134
One day we'll have a typed OS, where programs are monadic actions
>>
>>57759146
No thanks, substructural types for me.
>>
>>57759160
... they don't replace monads
>>
>>57759164
Not at everything, no. They are a lower level approach to controlling side effects.
>>
>>57759130
4chan is a discussion website linking to different boards (that you could post images on) that have different discussion topics.

>>57759133
I ain't reading all of that shit nigga

>>57759142
What can I say. Trolling is a art
>>
>>57759192
Holy shit
You really ARE new
>>
holy fucking shit /g/ is completely unredeemable

salt the virtual earth
>>
>>57759134
I'm not sure if you're being sarcastic.
>>
File: 7cq9ygq.jpg (30KB, 400x240px) Image search: [Google]
7cq9ygq.jpg
30KB, 400x240px
Let's get back on topic.
What's your ideal programming environment?
btw, I mean the environment you reside in, not the one on your computer.
>>
>>57759133
This is actually very convincing.
>>
File: 1466558862820.jpg (638KB, 1429x1022px) Image search: [Google]
1466558862820.jpg
638KB, 1429x1022px
>>57759237
my shell
>>
>>57758119

Freenet
>>
>>57759237
Basement, MONSTER energy drinksâ„¢ :^)
>>
>>57759265
>not using a tiling wm
>>
>>57759237
> what's your ideal programming environment
One with no anime and a cup of coffee
>>
>>57759265
I want a bunker.
Seems cozy.
>30 years later
>remember this post and think of what a fool I was
>>
There are precisely 819,353,200 20x20px thumbnails if you do two steps for a color on each pass (1/8 the number of single step color images).

Who wants to generate it and pick out the interesting porn thumbnails?
>>
>>57759237
the one i'm in is very comfy, long L shaped desk around two corners of my room, bed on the other side and a couple windows, that's all
>>
How often are function pointers used in C, and at what scale are they faster than a long switch statement?
>>
File: bat.gif (1KB, 16x11px) Image search: [Google]
bat.gif
1KB, 16x11px
tl;dr which programming language to make retro NES style vidya?

Hey /g/, non-programmer here. I want to make my own NES / original Gameboy style game, just as a little hobby project. I have some experience in pixel art and chiptunes but don't know where to start with the programming aspect. I'd like to learn to program it for real as opposed to making it in a program like Game Maker because getting into programming is part of the point of the project. I'm sure I can find tutorials and books for myself, but I'm not sure about what programming language I should be looking into for this kind of project.
>>
>>57759494
Probably assembly like they used to be made
>>
>>57759494
Since those style of games aren't demanding at all, you could write it in practically any programming language.
>>
>>57759384
>generating 320 GB of images to find some pixelated porn

I'm down, sounds like fun!
>>
>>57759521

We could generate larger images, but it would take a lot longer.
>>
File: 1475580940102.png (20KB, 506x606px) Image search: [Google]
1475580940102.png
20KB, 506x606px
>trying to learn lamba calculus
>every guide/pdf/university lesson doesn't explain things good enough and I get confused after church numerals
>>
>>57759478
>How often are function pointers used in C
Not too often, but it depends on what you're doing.
>and at what scale are they faster than a long switch statement
There are so many different things at play here, there is no real answer to that question.
It depends on the spareness of case values, compiler optimisations and so on.
>>
>>57759237
Right now I'm programming on a big wooden desk with votive candles, a desk fan, an incense burner and some hot tea.
>>
>>57759508
I know enough to know that you are trying to ruse me.

>>57759516
I figured as much. In that case, which language is the best for new programmers / will get me a working game the fastest?
>>
>>57759555
>>trying to learn lamba calculus

But why?
>>
>>57759555
You mean you get confused by Church numerals or you get confused by some unspecified thing after them?
>>
>>57759570

You probably won't like this suggestion, but if you want to get a working 2D platformer or something without having to worry about most of the details, something like GameMaker is probably your best bet.
>>
>>57759555
what a waste of trips
Isn't lambda calculus just anonymous functoins?
>>
>>57759607
they all seem to start out with beta reduction and church numerals and then go to the successor function or addition and there's so many things that have been unexplained that I can't even reduce them
>>
>>57759570
>which language is the best for new programmers / will get me a working game the fastest
If I were going to do it myself, I would probably use Lua + Love2D.
Lua is a pretty simple language and Love2D makes it pretty simple to start drawing shit to the screen. Love2D isn't a game engine though, so you would be programming all of that shit yourself. It mainly just handles things like graphics, input, and sound.
Some people don't like Lua for some reason, and it's not the most 'conventional' programming language, but I think it's nice.

But again, there are so many other things you could use. That is just my opinion.
>>
>compiler due at end of the week
>Haven't started assembly output
Sleepless nights are ahead of me.
>>
>>57758217
A friend of mine did pretty much exactly that, only it's 2d vs 3d rather than anime vs non-anime
>>
>>57759669
Thanks, this is what I'll look into.
>>
>>57759570
>which language is the best for new programmers
Good grasp of C -> an OOP language (C#/Java/C++). For math you may want to study a functional language textbook.

>will get me a working game the fastest?
None. It's gonna be quite a long time before you get working on a game if you're starting relatively from scratch. It's a pretty big thing to take on, even for a small game.
>>
being forced to do java really gives you an appreciation for C
>>
>>57759665
The key of Church encoded data is that the values are their folds. When you have a Church numeral m, you apply a value z and a function s to it and get a result that is z with f applied to it m times. So if m = 3, mzs = sssz.

Successor is taking a numeral m and adding 1 to it, i.e. the fold of m+1 applies the function to the fold of m. The fold of 0 is simply the initial value.
Zero = λz s. z
Succ = λm z s. s (m z s)


Adding m to n is implemented by folding over n with the initial value m and the successor (or vice versa).
Add = λm n. n m Succ


I think this would all be easier to learn if you used System F instead of just the untyped lambda calculus. Then you can give a type of Church numerals:
Nat = ∀A. A => (A => A) => A
Zero = ΛA. λ(z : A) (s : A => A). z
Succ = λ(m : Nat). ΛA. λ(z : A) (s : A => A). s (m A z s)
>>
I'm coming from Java/C# to Python, as I need it for a job, and I'm hating it

Is it normal to hate Python when you first encounter it?

How can I stop hating this gay scripting toy language?
>>
>>57759833
SomeThing someThing = new SomeThing(someOtherThing);
>>
>>57759237
Why is your mayor wearing a maid outfit?
>>
File: sim1.png (736KB, 985x985px) Image search: [Google]
sim1.png
736KB, 985x985px
Creating visualizations of finite quantum walks in MATLAB:

https://www.youtube.com/watch?v=twjVFn19F3I
https://www.youtube.com/watch?v=Mmri1dDdZz8
https://www.youtube.com/watch?v=yyJhsj0ND-A
https://www.youtube.com/watch?v=hRh-Whkj83M
https://www.youtube.com/watch?v=hKL33SpQXYI
>>
>>57759869
C++ has the same syntax.
>>
>>57759869
> SomeThing someThing
REEEEEEEEEEE
>>
>>57759868
Yes, I don't think many people ENJOY python more than either don't know anything else or are "forced" to use it because it has so many libraries and objectively above par for scripts
>>
File: 3.png (85KB, 845x761px) Image search: [Google]
3.png
85KB, 845x761px
how to re-write this another way?
>>
>>57759868
I despised it when I first used it but the hate kind of disappeared after constant use. Can't tell if I like it or just don't care anymore. It can be pretty handy I'll admit.
>>
>>57759886
Water is wet.
>>
>>57759886
auto someThing = SomeThing{someOtherThing};
>>
>>57759897
Use switch statement.
>>
>>57759890
I need to learn it because a software I need to use uses it for internal scripting

The force identation, the inconsistencies... I have to use Python 2.5 btw

the gay ass way to do thing, the lack of C-like syntax

Kill me
>>
>>57759897
You have several types of movement.
Keep them seperate and have a lookup table for every button you wish to assign.
That way your entire control interpreter could be in 3 short if statements and not a literal pajeet ladder like what you're doing now.
>>
>>57759897
Start by learning English, fucktard.
>>
>>57759897
There's nothing intrinsically bad about that.
>>
>>57759868
Give it time. Python will grow on you, I guarantee it.
>>
>>57759886
object oriented stuff is just a fucking mess in general
>>
>>57759920
>pajeet ladder
my sides
>>
Complete programming newfag here. Started trying to teach myself yesterday. Got a question about Python.

Is it possible, or even advisable to create nested classes? I want to be able to do something like this:

player.hair.color = "blonde"
player.hair.length = "long"
player.height = 6


so forth and so on.

Is there a way to do this, or is there a different way I should be doing this entirely?
>>
>>57759975
That's perfectly fine. Good for if you want other things to have hair too.
>>
>>57759937
OK
I have to use Python2.5 btw
not even 2.7 :(
>>
>>57759987

how would that look? so far, here's where I'm at with respect to actually MAKING the class

 
class player(object):
hair = ""
height = 0


And further down, I know how to do:


 
playerChar = player()
playerChar.hair = "blonde"


But I'm not entirely sure how to nest it such that I can add attributes to the hair attribute.
>>
>>57759975
>Python
read sicp and learn scheme instead
>>
>>57759897

Use associative arrays, Keys are the characters and the vals are the 'functions'/methods. Associative arrays are also O(1), and most languages protect the user from collisions..
>>
>>57759997
>I have to use Python2.5
Oh.
>>
Why learn any language except C++ ?

C++ is best at everything, except for some low level system stuff when C is still needed.

C++ is literally the master race language.

The only reason I can think of why people would use other languages is that they're too stupid to learn C++ properly.
>>
>>57760034
You would make a hair class as well.
>>
>>57760055
something like this?
arr = {
'w' => tilt(10),
's' => tilt(-10),
...
}
>>
>>57760078
C isn't really any better than C++ when it comes to low level in general, the difference is C has compilers for more platforms.

Rust is better than C++ anyways.
>>
>>57760078
C++ is absolute trash. It's poorly designed, and is just a clusterfuck of mismatched features piled on mismatched features.
Why don't you try and learn a language that is actually designed well?
Also, fuck off with your reddit line-spacing.
>>
>>57760084

Thanks, that's what I thought. I just wanted to make sure there wasn't a better way to do it. Feels a little clunky.

I'm going to wind up with classes inside classes inside classes in a minute here, I guess.
>>
File: learning_c.png (2MB, 1058x1600px) Image search: [Google]
learning_c.png
2MB, 1058x1600px
What's the best intro to the C programming language, /dpt/?
>>
>>57759975
class color:
def __init__(self,r,g,b):
self.r=r
self.g=g
self.b=b
class hair:
def __init__(self, color, length):
self.color=color
self.length=length
class player:
def __init__(self, hair, height):
self.hair=hair
self.height=height

def main():
tempcolor= color(0,0,0)
temphair= hair(tempcolor,5)
myPlayer = player(temphair, 180
>>
>>57760078
>Why learn any language except Ada ?
>Ada is best at everything, except for speed since C had a simpler syntax so is better optimized through the years
>Ada is literally the master race language.
>The only reason I can think of why people would use other languages is that they're too stupid to read the RM.
ftfy
>>
>>57760146
I was going to post something useful, but you posted LE EBIN TRAP MEME XDDD, so I won't.
Kill yourself, faggot.
>>
>>57760104
Yeah C++ is so bad that's why the browser you're using, most of the OS you're using and all games you play were written in it! Such trash!
>>
>>57760162
Just because something is popular, it doesn't mean that it's good.
>most of the OS
Most of my operating system is written in C.
>all games you play
Go back to /v/, you filthy crossboarder.
>>
>>57760150

o shit nigger, thanks

thats what i was looking for
>>
>>57760162
Not an argument.
>>
>>57760146
i love these

keep doing what you're doing~
>>
>>57760078
pretty much this >>57760104
They are trying to fix it but they are just making it more of a clusterfuck. Might as well just create a new programming language.
>>
>>57760162
>most of the OS you're using

http://harmful.cat-v.org/software/c++/linus
>>
>>57760096

Yes, something like that. I feel like it would be a bit difficult to implement in an imperative language, desu. In python, it CAN be done easily.
>>
>>57760224
>all of C++'s problems are from pandering to legacy
>I know, the solution is to continue adding shit to the language and make "core guidelines" instead of starting again
>>
>>57760264
with a dictionary right?
>>
>>57760078
>use an operating system with a somewhat old version of GCC
>try C++ out
>i need to use most C libraries anyway
what is the fucking point
>>
>>57760146
This, 'nuff said.
>>
Why are there so many HTTP response codes?
Did they really think people would bother using all of them?

Is there any practical use for sending error codes other than 404?
>>
>>57760352
https://www.addedbytes.com/articles/for-beginners/http-status-codes/
>>
>>57760352
>Is there any practical use for sending error codes other than 404?
Actually giving the user a helpful error message? Some software would also be able to do different things based on the error code it gets back.
If everything was 404, that would be as useful as "Something Happened".
>>
>>57759897
keyMap =
('w', titlt(10))
('s', titlt(-10))
...

lookup key keyMap
>>
hardly a single programming post in this whole shit thread.
>>
>>57760045
>scheme
*racket
>>
File: aristophanes_quote_2.jpg (70KB, 500x300px) Image search: [Google]
aristophanes_quote_2.jpg
70KB, 500x300px
>>57760078
>>
>>57760352
There are a few useful ones like 403 and 400 and 451
>>
>>57760352
>Why are there so many HTTP response codes?

90% because they need to to clarify things, and 10% because some idiots got shit like 418: I'm a Teapot in there.
>>
>>57760295

Naturally with a dictionary. But if you're going to do it in, say, assembly, then you have your work cut out for you.
>>
>>57760408
s/poet/trap/
>>
>>57760352

Computers communicate to other computers. One needs a protocol to handle inconveniences. Computers are dumb, that's why.
>>
i made mergesort in haskell

i'm kind of amazed at how fast it is. it spits out 100,000 to 1 sorted in about 2 seconds
>>
File: tumblr_mijcpbneUm1rpyupco1_500.gif (875KB, 500x281px) Image search: [Google]
tumblr_mijcpbneUm1rpyupco1_500.gif
875KB, 500x281px
I just watched Hackers (1995) and I want to get into hacking and am buying my equipment now. What brand of roller blades is best for a hacker?
>>
so many of these cracking the coding interview questions outright don't apply in haskell. particularly the linked list section
>>
>>57760585
>interview
>job
>hasklel

doesn't not correlate
>>
>>57760526
You're learning outdated techniques. We hoodie nao.
>>
>>57760612
doing it for fun and to get better programming functionally
>>
>>57760585
explane
>>
I read a great article on writing C without the standard library today. I highly recommend everyone check it out, after following along with what the author wrote and toying around with my own functions I finally understand pointers in C and how syscalls work.

http://weeb.ddns.net/0/programming/c_without_standard_library_linux.txt
>>
based idris
>>
>>57760635
Does induction-recursion work yet?
>>
>>57760672
>i saw that on reddit
You need to go back.
>>
>>57760692
upvoted

edit: thanks for the gold, king stranger!
>>
>>57760625
given two singly linked lists, determine if the two lists intersect. intersection is based on reference, not value

that's just 1
>>
What's a good scripting engine for file and system tasks on Windows?
Is Powershell worth learning?
>>
>>57760672
I've never written C code without the standard library before, and it was interesting to get some hands-on useful experience with asm. I took a class in machine language in college but never got any real practical experience with it. Very cool to see my code compile and output without a single call to a library function or needing to include a single header. After I did what was in the article I messed around with it and implemented some more functions and really felt like I was learning a lot about how the language worked at the base level. Definitely an interesting exercise for anyone who hasn't mucked around with that sort of stuff.
>>
>>57760614
>1990s hackers
>roller blades
>cool techno music
>Get entire laws named after you

>2016 hackers
>Listen to jpop
>wear hoodies
>cry yourself to sleep
>shoot up school

Bring back the 1990s
>>
>>57760747
yes
>>
>>57760802
>you will never be in the 80s/90's countercultural/hacker scene in NYC going to raves and getting up to mischief that wasn't technically illegal yet
>>
>>57760802
Just start roller blading and listening to techno music.
The laws and the cool part might be harder to achieve.
>>
>>57760747
No. Bash is now supported on windows, making powershell useless
>>
>>57760839
u r dumb
bash r dumb
>>
>>57760839
now? isn't cygwin years old?
>>
>>57760829
>you will never roller blade to a pay phone, use a cassette tape recorder to get a free long distance phone call, and use your toshiba satellite to hack anonymously through public phone
>>
>>57760839
>Windows 10

Powershell it is, i guess.
>>
>>57760802
Sometimes I go to textfiles.com to read the hacking/anarchy stuff to pretend I'm living back in the 80s back when the Internet/computers truly had that wild west feel.
>>
>>57760855
Search GooGle for Bash on Ubuntu on Windows
>>
>>57758079
MSYS2 I've found to be better than cygwin. It even has a proper package manager.
>>
>>57760802
>>57760829
>>57760857
Dudettes, take off the nostalgia glasses. Think of something you can do now, that people will greentext about in twentyfive years, instead.
>>
>>57760893
IoT botnets!
>>
>coroutines are free monads
Really makes you think.
>>
File: Kricketune_9b2fa8_929732.jpg (30KB, 400x299px) Image search: [Google]
Kricketune_9b2fa8_929732.jpg
30KB, 400x299px
Hey guys,

I have a class that requires a database presentation. Anyway, I have done an internship as an apprentice DBA, and relational databases kind of now bore me to death, and I thought, what better time than now to learn about NoSQL?

Anyway, I was looking at making a NoSQL database, but I havent a fucking clue where to start.

Anyone ever just make a nosql database just to make one? if so, what did you do? I cant seem to find shit for project ideas on google, so yall might know more.

Probably just going to use MongoDB or CouchDB becaue of the amount of documentation online for these two.

>pic not related of course.
>>
>>57760920
>he's a monad
>in a programming language
>he does it for free
>>
>>57760866
Hi, I'm working on recreating telephone based 300 baud modems:

http://github.com/collinoswalt/modem

I'm working on developing a modem using an arduino and piezo element, as well as experimenting with the frequency range of telephones because fucking telephones have no fucking modern technical documentation. My only resources are byte magazines from the 1970s and Bell System Technical journals from the same time as well. Trying to learn to decipher DTMF tones in software rather than using hardware (not an electronics guy).

Also, trying to figure out how to make a fucking telephone system which will handle these things.

I've posted this project several times. Basically, I'm really interested in old information technology like 300 baud modems. Unfortunately, there is scarce and obscure documentation on these things. I have to scour old BSTJs and BYTE magazines. I spend a lot of time searching through archive.org trying to find manuals for old tech and then replicate in software on modern processors.

Phone-based internet will come back. Mark my words.
>>
>>57760634
Some of the stuff in this article slightly bothers me.
He's not using any of the compiler-supplied header files (i.e. header files that even freestanding C gets).
So he's digging around in glibc internal headers and creating redundant typedefs instead of just using <stdint.h>.
He's using a bash script for compilation instead of a Makefile.
He's creating his own "syscalls.h" when he could use <syscall.h>, or just copy it into his working directory.

There is a difference "not using the standard library" and "not using any of the shit provided to you for no reason".
>>
>>57760745
you know haskell uses linked lists as the standard, right?
same as with lisp

and there is an intersect function in the standard libs, so it could be implemented
>>
>>57761011
No there isn't.
>>
>>57761011
For a newbie to C internals it was fun. But I'm glad that I'm hearing what was wrong with the article after having read it. Thanks for clearing that stuff up, anon. I'll have to read into the compiler-supplied header files now and learn about those.
>>
can someone recommend me quality textbooks on programming and the science of it?
>>
>>57761066
there's no intersect function like that in the haskell standard library
>>
>>57761088
>I'll have to read into the compiler-supplied header files now and learn about those
I'll give you a quick run-down now, because there is not much to it:
They only contain macros to compiler-specific things, and contain no executable code, so linking the standard library is not necessary to use them. Some of them are completely trivial and contain 1 actual line of code.
They are:
<float.h>
<iso646.h>
<limits.h>
<stdalign.h>
<stdarg.h>
<stdbool.h>
<stddef.h>
<stdint.h>
<stdnoreturn.h>
>>
>>57761066
There's no way to test reference equality in Haskell, and even if there was there'd be no use due to immutability.
>>
>>57761111
you got 4 repeating digits.
>>
File: 2016-11-29-210400_495x149_scrot.png (18KB, 495x149px) Image search: [Google]
2016-11-29-210400_495x149_scrot.png
18KB, 495x149px
>>57761103
>>
>>57761170
>determine if the two lists intersect
>intersection is based on reference, not value
So it's wrong on both counts. Nice job.
>>
>>57761170
i was pretty sure you were just being retarded and full of shit, and you confirmed my suspicion. thanks
>>
>>57761176
define intersect
>>
>>57761102
Darekaga watashi ni kotaeru koto ga dekimasu ka?
>>
>>57761176
you need to explain yourself
>>
>>57761011
is syscall.h really portable though?
>>
File: tegaki.png (5KB, 400x400px) Image search: [Google]
tegaki.png
5KB, 400x400px
>>57761216
If the lists look like pic related.

>>57761238
See >>57761142. Also that gives the intersection of the lists rather than simply determining if one exists.
>>
>>57761258
intersectionExists xs ys = not . null $ intersect xs ys

Fine, there you go.
>>
>>57761258
are you just trying to find the list which they both reference to?

thats it?

then use unsafePtr or make some new data structure
what did you expect, haskell doesn't allow mutability

use lisps for that
>>
>>57761250
You're writing code without the standard library. Your code is inherently non-portable.
<asm/unistd.h> is supplied by Linux, and since you're specifically targeting Linux, it's going to be there.
<syscall.h> and <sys/syscall.h> reference those, although I think that is supplied by your libc.
>>
>>57761317
No, I'm not the original anon. Just backing up that at least that question does not apply to Haskell.
>>
>>57761318
yeah i guess i picked my choice of words was really poor here

i wonder how you're supposed to write C for embedded platforms in general, i mean really low level stuff
>>
>>57761238
>>57761216
you can read the original post for one. it isn't in a cypher. /dpt/ raises my blood pressure
>>
>>57761315
wrong. >>57761142
it's like you're not reading
>>
>>57761376
none of your inane posts saying how easy it is to find the intersect of two lists brought nothing to the question of determining if two lists intersect by reference
>>
File: 6502.gif (15KB, 625x943px) Image search: [Google]
6502.gif
15KB, 625x943px
I'm trying to assess the viability of making an emulator for an old CPU with my skill level. Probably either the Z80 or 6502 since both has been done before many times and I would have access to examples.

I consider myself a C / C++ beginner having programmed it as a hobby for a couple years. I'm still not completely shit and I have a feeling this is easier than I originally thought.

How hard is it really to do this?
>>
>>57761436
start writing an assembler first
>>
>>57761444

So would that just be translating assembly code in the form of "MOV,ADD...." to the corresponding op code?
>>
>>57761501
in a sense, yes

you'll also need to figure out how to handle jumps (i still don't know how)
>>
>>57761514

that sounds too easy, just change the program counter
>>
>>57761514
>need to figure out how to handle jumps
when you have a program counter and translated the jump statements into assembly like in the manual, it's self explained.
>>
just found out my easystreet university has a 9% graduation rate for the computer science undergraduate degree
>>
>>57761514
>he doesn't know how to jump

white man detected
>>
>>57758298
>Implying this thread is about anime
>>
File: help.png (21KB, 1082x823px) Image search: [Google]
help.png
21KB, 1082x823px
Newbie question: I have a program that randomly segment faults (Sometimes it compiles sometimes it doesnt), apparently im busting my heap, so I installed drmemory to try and find the problem but I have no idea how to interpret this.
>>
>>57758026
That's nice, but die(); is all the debugging I need.
>>
>>57761834
instead of installing programs to diagnose it you should look at places where the error could be in your code and finding what you did wrong
>>
File: wew2.jpg (118KB, 1100x698px) Image search: [Google]
wew2.jpg
118KB, 1100x698px
>>57761834
>windows doesn't even have valgrind
>>
>>57761834
i'm in your mainframe now, chris
>>
why the heck is Arch's GHC package so fucking big? nothing should be 1.1gb. Apparently it comes with tons and tons of shit that I don't know if I care about? Is there a more minimal installation on the repo? Do I just use stack or whatever that shit is?
>>
28-year-old-PHP-fanboy-csci-undergrad-man interrupted the prof to ask "what are you doing?" like he was really irritated when he was writing about the clique problem on the board. prof said well i'm showing that the clique problem is defined as so and so the guy interrupts again "but what are you doing though? what's the point of this?" super aggressively. oh and last week of class and he still assertively doesn't understand the concept of nondeterminism. it's like he's proud of it, he flaunts it all over the place like it's not his fault he's retarded
>>
>>57761901
https://www.haskell.org/downloads#minimal

https://www.google.co.uk/search?q=why+is+ghc+so+big
>>
>>57761928
tricked me into using google search for the first time in half a year
>>
It's 2016 and interoperability is still mostly achieved by calling into C.
>>
>>57761863
Normally I would but this is for a project that I need fixed in like 24 hours. I didn't know it segment faulted until my TA tried to compile it.
>>
>>57762018
And?
>>
Can someone explain the singleton pattern to me? I don't understand the point. It has to ensure only one object, but I don't get why they need some kind of pattern for it. Why not just have one global variable that only gets initialized once and only use that one object/variable.
>>
>>57761901
Don't worry, it's Haskell, it'll be lazily evaluated
>>
>>57762034
and it'll be there for another 3 years until your OS GCs it :)
>>
>>57762032
Because Java a shit
>>
>>57761912
>PHP
He needs go to into rehab.
>>
>Rust
>10 page tutorial needed to write a linked list
>>
>>57762032
If it's an instance of a class, there's nothing stopping you from initializing another. If not, it won't be able to implement an interface and all that junk. So the Singleton is born.

Most of the time, people just use Singleton as a glorified global variable instead of to force a single instance. You can get the latter without going full global mutable retard but I've never seen a case where it's useful.
>>
>>57762063
i overheard him talking about why he likes it so much. he loves that it doesn't give you errors and just works
>>
My homework is to make a term in prolog that returns true if when I put two lists in the first list is the same as the second list, except for every 7 there are two sevens.
So
[1,7,1] and [1,7,7,1] is true, but [1,7,1,7] and [1,7,7,1] is false.

doubleAll7([H1|T1],[H2,T2]) :-
double7([H1|T1], L),
L == [H2|T2].


seven(N) :-
N is 7.

double7([],[]).
double7([H|T], [H,H|Z]) :-
seven(H),
!,
double7(T,Z).
double7([H|T], [H|Z]) :-
double7(T,Z).


my idea is [H1|T1] has all it's 7's doubled in double7 and then I just compare is in doubleAll7, but that always returns false even though double7 works.
I run it with doubleAll7([2,7,3,7,4,5,17, -7], [2, 7, 7, 3, 7,7, 4, 5, 17, -7]).
>>
>>57762088
replace every 7 in the first list with two sevens?

in haskell this would be something like

f 7 = [7, 7]
f x = [x]

eq l1 l2 = (l1 >>= f) == l2
>>
>>57762088
>>57762198
(>>=) is called bind or selectMany or concatMap or collect
>>
>>57762198
>replace every 7 in the first list with two sevens?
double7 does that and works.

I need to know if the the second list has two 7's for every entry of 7.
>>
>>57762232
Yeah, that's what my suggestion does
Does Prolog have something like (>>=)?
It's pretty simple to make from map and join
>>
>>57762248
I don't know im pretty retarded.
>>
>>57758191
Don't force arbitrary cycles onto them
Don't tell them how to write their code. EVER.
Do tell them to write documentation for useful APIs
>>
>>57762270
Well >>= is basically this:

m >>= f
=
join (map f m)
>>
>>57762198
>>57762248
>>57762270
prolog is nothing like a normal language. programming in prolog when you aren't used to it is like programming in the realm of that demon of insanity in oblivion
>>
>>57762312
I kinda already realized that.
>>
>>57762312
A pattern matching definition in Haskell is analogous to asserting a predicate over the left and right sides in Prolog.
>>
>>57762367
you can also do something similar with []
>>
haskell is so bad, I can't even do anything low level without having to memorize an entire module for "bytestrings" or "Word8 Word64"
>>
>>57762088
OK I am trying a completely different method now, this code still doesn't work though

[code[
doubleAll7([],[]).
doubleAll7([],L) :- !.
doubleAll7(L,[]) :- !.
doubleAll7([H1|T1],[H2|T2]) :-
seven(H1),seven(H2),
firstseven(T2),
doubleAll7(T1,skip(T2));
H1 is H2,
doubleAll7(T1,T2).


firstseven([H|T]) :-
seven(H).

skip([H|T]) :-
T.


seven(N) :-
N is 7.
[/code]

So the idea here is every time doubleAll7 recurses it checks if the first elements in the list are sevens, and if the second element in the second list is a 7, if they are all 7's I recurse skipping one in the second list.
If the numbers aren't 7's but are equal it just skips.

Always returns false.
>>
>>57762451
you're using a paint brush to tighten a screw
>>
>>57761011
>He's using a bash script for compilation instead of a Makefile.
When you're on a system without header access, makefiles are sure out of the picture.
>>
Are sneks the best lil programming buds?
>>
Once I've finished my game, I want to learn a new language.

Is C# a good choice?
>I want to make 3D games
>I want to make my own version of iTunes on Windows
>I want to do stuff with neural networks

Can I do these things easily with C#?
>>
>>57762563
yea look up unity, combines C# scripting with drag n drop shit.
>>
>>57762563
>>I want to make my own version of iTunes on Windows
Why? iTunes on Windows is garbage.

>>I want to do stuff with neural networks
You'd be better off using a meme language for that.
>>
is it bad practice to declare a variable in the middle of my main method? or should I always declare it at the top?

its just a dummy variable I used quickly to do something in middle of my code.

I know its bad practice to have lots of random algorithm in your main method since it would be better to write a seperate method to do that
>>
>>57762587
Not at all.
>>
>>57762563
Yes, it's good (Unity scripts in C#)

Yes, it's good (win32 API .NET C#)

Probably not so much no
>>
>>57758143
it's a picture. the words are important
>>
>>57762563
>yea look up unity
Unity3D looks promising, thanks anon

>drag n drop shit
drag and drop sounds like the worst type of cancer, i want to be able to code everything and not have to fuck about with a premade UI that makes me drag and drop

>>57762574
>Why? iTunes on Windows is garbage.
That's why I want to make my own media player

>>57762593
Thanks anon, I'll definitely learn C# now
>>
>>57762587
No, it's absolutely fine. If your code is obvious nobody is gonna care, it's often more readable to do that.

file_thing = null;

try {
load some_directory;
} catch (somerr) { .. }

file_thing = some_directory;



Better off as just trying to load and declaring it.
>>
>>57762610
>drag and drop sounds like the worst type of cancer, i want to be able to code everything and not have to fuck about with a premade UI that makes me drag and drop
It's only drag and drop if you download other people's garbage and include it in your own garbage. To make anything at all of use you're gonna need to program heavily, it supports C# and JS and has an extremely robust API. Drag and drop in Unity is a meme, don't get put off by the "you don't need to program!" thing. That's just for people who maybe wanna make a small animation or a text-based game.
>>
>>57762587
If you have a variable you only need in one segment of your program it makes sense to declare it next to where it is used. Removes ambiguity.
>>
>>57762610
if you want to make games from scratch using C#, look up either Mono for desktop+mobile or FNA for more desktop oriented platforms.

Either one is essentially XNA.
>>
>>57762610
>drag and drop sounds like the worst type of cancer, i want to be able to code everything and not have to fuck about with a premade UI that makes me drag and drop

Well lets say you were making an FPS and you wanted to put in a room full of bad guys, each with a unique AI script.
Unity lets you drag each bad guy to where you want them to start in the scene, then you can take your script and drag and drop it into the bad guys.

Coding that kind of stuff would just be tedious.
>>
>>57760922

I've used Mongo a bit, and Dynamo a lot.

I like Mongo more. Dynamo is a bit retarded.

They're both pretty easy though. Just follow a tutorial and you'll be fine.

Anyways, since I won't have a chance to do so otherwise let me explain why Dynamo is retarded.

Let's say you want a conditional expression. That's ConditionalExpression:'expr'. But you can't just use the expression directly. Instead you have to do ConditionalExpression:':v' (where : denotes a variable), and then set the variable. Wasted an hour on that shit.
>>
>>57762610
Be wary that Unity only allows you to write code in methods of game objects.

MonoGame is a lower-level game framework for C#. It's a cross-platform reimplementation of the XNA API.
>>
so i made a program that counts the words in a text file and sorts them by how often each of them appears (trivial I know). Now I'm printing the frequency of each word and I have a very stupid question

let's say I print this

RANK FREQ WORD
1 23 a
2 14 a
3 9 the
....
10 5

how do I avoid this ugly misalignment. I know I could do a bunch of if statements like
if rank is double digits, print 1 less space etc.

but is there a more clever way of doing this?
>>
>>57762666
depends on the language
>>
>>57759897
map<char, function<void()>> do_shit_4_key{
{'w', [](){tilt(10);}},
{'s', [](){tilt(-10);}},
{'a', [](){turn(-10);}},
{'d', [](){turn(10);}},
// and so on...
};
>>
>>57762652

It's also good for placeholding. If you're trying to get the layout of the level first, or get a general idea of a concept you're trying to implement being able to create and throwaway a shitty version first is pretty helpful.
>>
>>57762666
just think about it
>>
>>57762624
This sounds good, I'll probably start learning unity next summer!

>>57762652
That sounds very untedious
for(int i = 0; i < badGuyCount; i++) {
badGuyPosition.set(badGuyPosVector[i]);
}


I'd rather do that than drag and drop to position

>>57762664
I'm not entirely sure what this means. I want to be able to create my own particle physics system, and have unity or another engine make the rendering easy if I supply it with a bunch of coordinates
>>
>>57762666

Most languages have a a function for formatting the strings you print. That way they're all spaced properly.
>>
>>57762717
>I'd rather do that than drag and drop to position
but now they are all in a row, what if you want to actually place them?
>>
File: 24157_348447133991_4093927_n.jpg (44KB, 720x478px) Image search: [Google]
24157_348447133991_4093927_n.jpg
44KB, 720x478px
how do I make my if statements fucking work for my vigenere cipher?

http://stackoverflow.com/questions/40880260/vigenere-cipher-c-langauge
>>
>>57760922
>Mongo or Couch
Do CouchDB, don't fall for the fucking Mongo meme. Any company that advertises a json document store as a replacement for a relational database is fucking insane.

SQL is lingua franca for how data is stored. The only people you see trying to completely replace relational databases are people who don't understand data.
>>
>>57762666
the easy way is to use tabular columns, aka use \t instead of a space.

This will break if the columns are too uneven ( larger than a tab, others smaller).
>>
File: 42517456.jpg (97KB, 400x400px) Image search: [Google]
42517456.jpg
97KB, 400x400px
>>57757949
so many different coordinate systems to convert between, rotations, should i make the rotation positive or negative, if the rotation is negative does that mean it's different then 360+negative rotation or in the coordinate system I'm in does it not matter

;_;

logically programming and planning is one thing but the most confusing parts to me always end up being stuff like flipping javascript canvas upside down, converting coordinates, and trying to remember what should be positive or negative and where I should put the sign. most times i just end up doing trial and error until I find the right combination of signs and coordinates
>>
What's the easiest, most newfag friendly way to build a python gui?
>>
>>57762751

I feel like you need to retool the whole thing. I remember making a vigenere cipher and I don't remember that many if statements just for the shift.
>>
>>57762777
Slow down and do everything in features. One major thing at a time. Source control, if it helps.
>>
>>57762772

He's right. By all means a simple document store has its place, but if you're consistently dealing with a large amount of data then it's just retarded to go NoSQL.
>>
I know how to program fairly well but I want to get into LUA scripting for games and to fix my mouses shitty button bindings.

Does anyone know of some good lua guides/resources that they want to share with the lazy ?
>>
>>57762804
I usually do end up figuring it out after doing trial and error but there a few time where I still have NO fucking idea how I got my code to work. I remember making a simple fractal explorer just being baked and couldn't figure out what the fuck was wrong with the zoom feature for hours so I just divided a random number by 4 and it then worked fine.

Like wtf is this shit. It doesn't work unless I modulo 360 the joint angle and normalize the angle between the bodies so it isn't negative. If I normalize the joints angle so it's positive it no longer works and the joints physics breaks. And even now it only seems to be working stable, maybe if I rotate it to some exact number the math will break down again.
>>
>>57762847
>Does anyone know of some good Lua guides

The official book is free and well written. And stop capitalizing "Lua"; it's not an acronym.

https://www.lua.org/pil/contents.html
>>
NEW THREAD!

>>57762899
>>57762899
>>
>>57758235
About the parameter thing
int sum_matrix(int r, int c, int mat[][c]);

Where r is the first dimension, c is the second dimension (columns). Note that you need to specify c in the mat[][c] parameter.
>>
>>57762937
>>57758235
You could go for the extra C99ness points and do
int sum_matrix(int r, int c, int mat[static r][static c]);

and confuse others.
>>
>>57762987
Wait, that's not valid. There isn't supposed to be a static on the second one:
int sum_matrix(int r, int c, int mat[static r][c]);
Thread posts: 319
Thread images: 34


[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.