[Boards: 3 / a / aco / adv / an / asp / b / biz / c / cgl / ck / cm / co / d / diy / e / fa / fit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mu / n / news / o / out / p / po / pol / qa / r / r9k / s / s4s / sci / soc / sp / t / tg / toy / trash / trv / tv / u / v / vg / vp / vr / w / wg / wsg / wsr / x / y ] [Home]
4chanarchives logo
/dpt/ Daily Programming Thread, REPL Edition
Images are sometimes not shown due to bandwidth/network limitations. Refreshing the page usually helps.

You are currently reading a thread in /g/ - Technology

Thread replies: 255
Thread images: 42
File: mccarthy_portrait_news.jpg (279 KB, 434x600) Image search: [Google]
mccarthy_portrait_news.jpg
279 KB, 434x600
old thread: >>53748407

What are you working on, /g/? Are you using the REPL at least?
>>
>>53757374
why did the other one get deleted?
>>
I want to write a hello world for NES. Later on I want to display a static image.
>>
File: téléchargement (1).jpg (9 KB, 239x211) Image search: [Google]
téléchargement (1).jpg
9 KB, 239x211
>>53757468
I've got no idea. Maybe the thai-cartoon trap programmer cancer has been finally recognised as such by mods?
>>
File: opengl.png (278 KB, 800x600) Image search: [Google]
opengl.png
278 KB, 800x600
>>53757468

>you are blocked for violating /g/ 1 - Off-Topic
Does this mean /dpt/ isn't allowed on /g/ anymore?
I made the new thread at 312 posts, btw.
>>
>>53757374
if I'm doing a presentation on LISP and it's development, applications, and unique qualities;
would the best starting place be this dude's papers?
>>
>>53757560
Cartoons are off-topic, take them to >>>/co/

t. mod
>>
>>53757374
FizzBuzz on C, C# and tried with Visual Basic, but the language is truly cancer.
    Sub Main()

Dim x = 0

For i = 1 To 100
x = x + 1
If x Mod 3 = 0 Then
Console.WriteLine("Fizz")
ElseIf x Mod 5 = 0
Console.WriteLine("Buzz")
ElseIf (x Mod 3 = 0) And (x Mod 5 = 0)
Console.WriteLine("FizzBuzz")
Else
Console.WriteLine(x)
End If

Next i
Console.ReadLine()

End Sub
End Module

Only the FizzBuzz part doesn't work.
I also tried
 ElseIf (x Mod 3 = 0 & x Mod 5 = 0) 
>>
File: arug anime.jpg (330 KB, 800x680) Image search: [Google]
arug anime.jpg
330 KB, 800x680
Who came up with the lie that you don't need math for programming?

Every non-trivial discipline of programming requires some form of math.
3D graphics is literally applied linear algebra.
>>
>>53757701
Same here. With Javascript, whether I do modulo 15 or modulo 3 AND modulo 5, I never get "FizzBuzz" where 15 should be.
>>
>>53757631
I haven't read them, but if he ever leaves neutrally elaborating and describing the facilities of early lisp, he will probably compare it to languages that were popular back in the Golden Era Of Artificial Intelligence, so you won't get up-to-date information anyway IMHO. Amongst the things I've actually read, there is this: https://panicz.github.io/pamphlet/
>>
>>53757770
You need like, middle school math though if we're talking straight from the dome.
>>
>>53757631
no he was only a relatively unknown minor figure
>>
File: ss.jpg (9 KB, 217x232) Image search: [Google]
ss.jpg
9 KB, 217x232
>>53757701
>>53757798
>>
>>53757701
How about checking for the FizzBuzz case first, fucko.
>>
>>53757770
i did to see fools fail and laugh at them
>>
>>53757770
depends what you consider "non-trivial"

even in kernel programming you're rarely ever using any advanced math
>>
>>53757798
Yeah, C# and C just werk, maybe I just need better knowledge of VB, but I just learned it as a quick fun thing to do so I can't be bothered.
   int x = 0;
for (int i = 1; i <= 100; i++)
{
x++;
if (x % 3 == 0 && x % 5 == 0)
{ Console.WriteLine("FizzBuzz"); }
else if (x % 3 == 0)
{ Console.WriteLine("Fizz"); }
else if (x % 5 == 0)
{ Console.WriteLine("Buzz"); }
else
{ Console.WriteLine(x); }
}
Console.ReadLine();

Basic ass C# that I wrote
>>
>>53757701
>>53757870
Take a good hard look at both of these and maybe you'll see why the first one doesn't fucking work.
>>
File: 1455993022108.jpg (48 KB, 600x600) Image search: [Google]
1455993022108.jpg
48 KB, 600x600
>>53757839
Let them google it themselves you fucktard
>>
File: codemonkey gets BTFO.png (157 KB, 642x834) Image search: [Google]
codemonkey gets BTFO.png
157 KB, 642x834
I'd love to work as an HR interviewer for a software company just to see the quality of CS graduates being shit out by the university system.

>ok, now do fizzbuzz, only you have to return a string containing the output of the fizzbuzz function
>>
File: 1347223383393.gif (403 KB, 200x157) Image search: [Google]
1347223383393.gif
403 KB, 200x157
>>53757870
>>
>>53757770
Here is the good news Math isn't hard to learn at all anyone can do it even a retard like me who has failed math multiple times in his life has ended up studying it religiously and I finally understand it now. If you put in the effort and are patient you will get math even linear algebra
>>
>>53757939
Both of you have code that doesn't do what's intended: at 15, it prints Fizz and not Fizzbuzz, right? Ask yourselves WHY this concrete implementation, not the perfect abstract thing you had in mind, took that branch and produced that result.

Hint:
If 1 == 1 {
println("indeed")
} else if 2 == 2 {
println("obviously")
}

What does this print and why?
>>
File: modulous.png (92 KB, 646x459) Image search: [Google]
modulous.png
92 KB, 646x459
Reminder FizzBuzz is useless
>>
File: 1453266720237.jpg (20 KB, 194x200) Image search: [Google]
1453266720237.jpg
20 KB, 194x200
>>53757997
>cocky white man
>>
>>53758012
No capital at "if" if you want this to be valid Go code
>>
>>53757997
I should probably learn how to reverse a binary tree
Hell, I should learn more data structures and algorithms
>>
File: heh.png (37 KB, 599x206) Image search: [Google]
heh.png
37 KB, 599x206
>>53757997
/g/ BTFO
>>
File: 1404500492838.png (152 KB, 311x311) Image search: [Google]
1404500492838.png
152 KB, 311x311
Ask your beloved programming literate anything!

Daily reminder that all programming languages besides Lisps are merely inferior domain-specific languages.
>>
>>53758121
Java is much better than Lisp. Lisp is outdated while Java has stood the test of time and has still become more relevant than ever. You cannot stop us
>>
>>53758079
I love career grievance mongers as much as the next anon, but don't think this deserves it's own thread?
>>
>>53757997
>I'd love to work as an HR interviewer for a software company just to see the quality of CS graduates being shit out by the university system.
this desu

I'm working at an embedded job atm, and my supervisor and I talk a lot about how terrible some CS curricula are.
He's run into people who don't understand binary or hex, can't describe what a linked list is, and don't know what the stack or heap are.
>>
File: 7601661.jpg (109 KB, 1100x617) Image search: [Google]
7601661.jpg
109 KB, 1100x617
>>53758139
You've never heard about Clojure? Well, what I don't know can't hurt me, right?

pic related: Javafags in the wild at a convention
>>
Anyone here experienced with nodejs, socket.io, and spawning child processes in nodejs?

I've just started using require('child_process').fork to spawn new node processes, cause JavaScript's single threaded nature will mean my program will scale like shit otherwise. Problem is, I want to use socket.io inside these child processes. Should I pass the entire socket.io object to the child processes or what? I feel like I'm missing something obvious. I'm pretty new to nodejs.
>>
>>53758176
Cross-thread links are allowed ffs: >>53758166
>>
>>53758201
child processes aren't web scale
>>
>>53758172
Clojure Swift Go F D all these meme languages. No they do not matter only the strongest will survive Java,C++,C
>>
>>53757560
See: >>53758166
>>
>>53758226
Dunno what you're trying to say here - that child processed aren't needed to scale a web app? They really are for me especially as I want to run loads of instances of the same game code. If I didn't use child processes, one game crashing would crash every game. Even if child processes weren't necessary for speed they would still be useful for reliability.
>>
>>53758273
wow, you probably don't even use mongodb
>>
>>53757770
Most educated people don't think of arithmetic and basic trigonometry when you say "math".

You're running along the lines of:
>Who came up with the lie I don't need basic English skills to write a CV?

Nobody, they just said you didn't need an English degree, but you took that to mean even a trained monkey could do it.
>>
>>53757770
>>53757817
>>53757862

Much more than just 3D graphics. The real kicker is that you don't even really need to know much more than the basics. It can all be made pretty high-level and the machine is doing all of the work for you. You can get by on much less than what you'd learn in a college linear algebra course. It applies to enough that it does genuinely surprise me how many programmers don't seem to know the first thing about it. No matter what you do, it can't hurt to learn the basics in order to be better-equipped should it come up.
>>
File: wut.gif (854 KB, 350x197) Image search: [Google]
wut.gif
854 KB, 350x197
>>53758079
>>
>>53758079
>>
>>53758172
they look more like clojurefags
>>
>>53758205
I copied the post number and forgot the >>
Calm your tits.
>>
File: 1458263930376.png (63 KB, 209x201) Image search: [Google]
1458263930376.png
63 KB, 209x201
>>53758079
>>
>>53758356
most shitters who say you don't need math for programming are talking about basic trigonometry, calculus, elementary algebra
>>
>>53758631
>Most people who only write hello worlds and fezbucks don't realise advanced programming requires higher-level understand of mathematics

No shit.
I wouldn't ask for driving tips from someone who has just totalled their car in front of me, or doesn't have a fucking license.
>>
>>53758121
>not pronouncing it gee en you
>>
File: 04187.jpg (40 KB, 403x330) Image search: [Google]
04187.jpg
40 KB, 403x330
>>53758079
>avid hello world programmer
>>
>>53758768
>The name “GNU” is a recursive acronym for “GNU's Not Unix!”; it is pronounced as one syllable with a hard g, like “grew” but with the letter “n” instead of “r”.
>>
>>53758793
Yeah well fuck you. GUHNEW sounds fucking retarded.
>>
>>53758816
>official pronouncing
>fuck you
typical /g/
>>
idk, I've been messing around with Rust. It's kinda nice.

fn slow_print(str: String, t: u64) {
for c in str.chars() {
print!("{}", c);
std::thread::sleep(Duration::from_millis(t));
std::io::stdout().flush()
.expect("ok lol");
}
}

it's pretty much a simplified C.
>>
>>53757374
what's the best place to learn x86?
I want to git gud at it, preferably using intel syntax
>>
>>53758916
sorry, let me fix that.
fn slow_print(str: String, t: u64) {
for c in str.chars() {
print!("{}", c);
std::thread::sleep(Duration::from_millis(t));
std::io::stdout().flush()
.expect("ok lol");
}
}
>>
>>53757374
Please use an anime trap image next time, it is the easiest way to find these threads.
>>
>>53758969
this looks absolutely nothing like C

it resembles python more than C
>>
>>53758866
>official = good

typical pajeet
>>
>>53758925
>>
>>53759050
>go against the system xD

typical skiddo
>>
>>53759037
I never claimed it looked like C, I said it's pretty much a simplified C.
>>
>>53759071
Seriously who thinks guhnew is a good pronunciation?
>>
>>53759072
how does it feel like a simplified C?
it looks much more complex than C

for starters, member functions aren't an idiomatic C construct
>>
>>53759068
I have that book! I'm actually going through it (again) right now.
>>
>>53758969
now implement sleepsort
>>
File: 1451432409961.png (2 MB, 2210x1436) Image search: [Google]
1451432409961.png
2 MB, 2210x1436
What the fuck just happened with Burger-Chan?
>>
>>53759096
It might just be me and my mindset, but I hated C.
Started messing with Rust, and I've been enjoying it. So, I guess I'm a bit biased.
>>
>>53758916
>>53758969
>Rust
>Simplified C
What? Not at all.
>>
>>53759218
How would you explain it then?
It's like in-between C and Python.
>>
Let's say I'm writing a raytracer targeting a specific computer model with an NVIDIA gpu, should I go with CUDA or OpenCL?
>>
>>53759232
it looks like python with semicolons
>>
>>53759246
I guess that sums it up pretty well.
It functions like C though, you can do most of what you could with C using Rust.
>>
>>53759243
use HTML5 cloud webscale frameworks
>>
>>53759232
A less retarded C++ with a dash of haskell
>>
>>53759246
>>53759313
pretty much this
>>
>>53759301
But I don't want it to be portable.
>>
>>53759313
more like a dash of ruby imo, with that lambda syntax
>>
File: vlc crashes windows.jpg (185 KB, 500x359) Image search: [Google]
vlc crashes windows.jpg
185 KB, 500x359
I got a .go file filled with functions inside variables...is this bad?

why would you ever put a function in a variable unless you wish to pass said variable?
>>
File: hur.jpg (67 KB, 540x960) Image search: [Google]
hur.jpg
67 KB, 540x960
>>53759068
For half a second I thought the author was Jeff Dunham.
>>
>>53759476
yes
>>
>>53757701
>Visual Basic anywhere
>>
File: Pinky.png (176 KB, 1027x841) Image search: [Google]
Pinky.png
176 KB, 1027x841
Trying to rip sprites from an old PC game. It's the weirdest thing. Every character has a charactername.out file which looks like this when you shrink the text down. My plan was to convert it all to pure ascii numbers and then find out which colour they correspond to. But then there's also what looks like interlacing going on.

Does anybody know anything about this?
>>
Fuuck
So I have a derived class implementing pure virtual functions from a base class. I have another derived class, that uses the first derived class as a base class, but I want to implement the virtual functions from the basest class in the latest class. Shitty explaination to show what I'm talking about:

base class {
virtual fancyFunction() = 0
}

firstDerived Class : public base class {
virtual fancyFunction()
}

secondDerivedClass : public firstDerived class {
fancyFunction()
}

I thought doing this would be pretty easy; I just make the functions in the first derived class virtual, then reimplement these functions in the second derived class. However, Visual Studio won't let me to this. Anybody know why?
>>
File: 9As1jLO.jpg (37 KB, 1200x675) Image search: [Google]
9As1jLO.jpg
37 KB, 1200x675
>>53758079

This has to be some sort of troll
>>
>>53759092
GEE-ENN-YEW isn't exactly better
>>
File: 1458522320432.jpg (32 KB, 530x349) Image search: [Google]
1458522320432.jpg
32 KB, 530x349
trying to learn programming just makes me depressed.
>>
>>53759639
or a typical coddled bitch
>>
>>53758079
Lol I am fucking shitty at math but that statement is just ridiculous
>>
File: 1435786038429.png (330 KB, 636x858) Image search: [Google]
1435786038429.png
330 KB, 636x858
>>53759728
keep at it anon I believe in you
>>
I can't believe people actually program in C in the 21st Century
>>
File: 14514281.jpg (22 KB, 318x417) Image search: [Google]
14514281.jpg
22 KB, 318x417
>>53759867
fight me
>>
File: rain.gif (2 MB, 350x190) Image search: [Google]
rain.gif
2 MB, 350x190
>>53759839
That's the saddest thing I've seen all week.
>>
>>53759867
>tfw working at a C job now, have an offer for another C job, and an interview for another C job in a couple days
I can't believe people don't program in C in the 21st century.
>>
>>53759867
Imagine if git was implemented in python.
>>
>>53759943
>everything that's not C is as shit as python
>>
>>53759867
>he doesn't want to know the joys of pointers
>>
>>53759943
Git has already been rewritten in the ultimate programming language, behold:

https://github.com/creationix/js-git
>>
>>53759867
>what is embedded programming
>>
>>53759970
>only C has pointers
>>
>>53759728

Learning through repition. The first few times you're exposed to a concept are the hardest; then as you are continuously reintroduced to it, more neural connections to it/about it are made, and the thought/concept becomes stronger. Then you learn related concepts, and the core concepts become even more memorable through association with the newer ones. As time progresses, the knowledge base grows, and problems become easier and easier to solve. Thoughts and ideas related to the topic become more complex, as the intricacy of internalized information becomes more and more detailed. You find yourself capable of doing more in less time, and can explain concepts or ask questions more descriptively and with better detail.

So yah, just keep at it.
>>
>>53759839
it get to the point where I just dont want to anymore and just want to read something that relates to programming but not directly,make myself feel better then try again.
>>
>>53760036
Start creating shit instead of reading about it
>>
I am learning python.
I guess because I don't have programming experience. I'm past the spam and eggs shit. I just don't know what I should get into though. All I know is I want to write code.
>>
>>53760029
This is the worst fucking advice I've ever seen. I hope you're trolling
>>
>>53760169
Make a chat client/server system utilizing either TCP or UDP.
>>
>>53759728
>>53760197
In my experience, I learned more in a class than I did outside of class.

>OF COURSE
That is not to say you cannot learn without a class. Everyone learns differently. I should note that there are some things you simply cannot learn in a class either.
>>
>>53759867

> he doesn't program in object oriented drag 'n' drop double-abstracted visual basic
>>
how do I into a website?

I just want a simple site, can be ran off my own pc, and all its gonna do is run a python script. Do I need some apache tomcat service? How do I get it to run my python script?
>>
>>53760228
I learned more in a 2 weeks of self-teaching than I ever did in 2 semesters of my pre-requisite C++ class.
>>
File: [ELECTRONIC MUSIC].gif (498 KB, 320x240) Image search: [Google]
[ELECTRONIC MUSIC].gif
498 KB, 320x240
>>53760230
>tfw vb6 was my first language
>>
What's a good beginner's site for learning algorithms?
>>
>>53760259
visualgo.net
>>
>>53760197

>>53760197

Worst how...? Most people learn through repition, that's the whole reason people get exercises with their math homework, etc. If a person doesn't get a concept the first time through they shouldn't necessarilly give up, is all I'm saying.
>>
File: korwin_mikke_socialism_kills.webm (3 MB, 800x450) Image search: [Google]
korwin_mikke_socialism_kills.webm
3 MB, 800x450
>>53758925
Get intel manual (smaller ver).
Get C compiler (VS C++ is great)
Get ida & olly

You are writing simple programs step by step (k&r is fine) and then compile it with ASM listing.

The analyze your hello world in C and how it looks like in ASM.

Then check your program in olly and ida. Debugging in asm is basic skill.
>>
>>53760373
What programming language does that Korwin mate use?
>>
>>53760254
they are making me learn this shit at college, it is absolute shit
>>
>>53760402
Wait, you're learning visual basic in university?
Drop out and go somewhere that isn't shit
>>
File: kuce1.jpg (71 KB, 641x428) Image search: [Google]
kuce1.jpg
71 KB, 641x428
>>53760393
Language of free market
>>
>>53760393
the truth
>>
>>53760416
not university, doing some crappy course that gets me the ucas points i need for university
>>
>>53759143
What 4chan browser is that?
>>
>>53760433
A-level computing? They're still teaching VB huh?

On the one hand, most of the ideas you cover in the syllabus are the absolute bedrock of CS, and learning them now puts you ahead of the curve.
On the other hand, VB is nothing but a shitty learning tool and a meme. I have no idea why they don't just use C# instead.
>>
>>53760574
yeah a-level computing

it is vb6 as well. i asked why we were not being a newer version and they said "it doesn't fit the syllabus"

c# would be MUCH better!

the whole course is putting me off doing CS at uni
>>
>>53760421
Sooo...

Pseudocode?
>>
>>53760640
I took a programming course at a local vocational center that taught me C#.
>>
what is the future of java?
>>
>>53760640
It's literally the exam board's fault.
Until they drop VB6 in the exam papers, the staff that have created all their teaching material around it are not going to update shit.

Anyway, I don't know any universities that actually use visual-anything for CS courses. Shit, here they give first years a babbies intro to LaTeX in the first term's project week.
That said, if the databases and general "programming methodology" shit bores you, maybe consider CE or EE instead and head more into embedded development.

I'm finishing my EE this year, they don't teach programming very well but it's still much easier to pick it up when you have practical use cases rather than the non-stop theory train you get on a pure CS course.

Also go to bed m80, you've got classes in less than 6 hours.
>>
>>53760747
>>
Want to learn C.

Should I just go with The C programming Language? Or are there other good books? I've had experience programming in Python and Javascript.
>>
>>53760770
Why not learn c++ or c# instead?
>>
>>53760747
>what is the future of java?
>future
>java

D E R E L I C T

http://www.smashcompany.com/technology/object-oriented-programming-is-an-expensive-disaster-which-must-end
>>
>>53760782
Well it's not like I can't learn C and then C++ or C#
>>
>>53760782
>C++
stands for clusterfuck++

>C#
It's literally Java + Microsoft, two diseases at the same time.

Just stick with C.
>>
>>53760753
it's the easter holidays

i love programming though! it is just the way it is taught and the slow as fuck pace they teach it that annoys me. in our 3rd 2 hour lesson everyone in the class was making a login page with no real purpose (hard coded username and password, eww), i decided to make a flappy birds clone haha
>>
>>53760814
>>53760814
I never said you couldn't.
>>
Anyone want to collaborate on something? Any big ideas in mind?
>>
>>53760847
hhmmmm.... programming themed hentai game... mmmm... hehehe
>>
>>53760847
anonymous decentralized twitter like imageboard
>>
>>53760847
Im up for it, what language?
>>
>>53760847
How about a video game that force-feeds you the contents of K&R?

K&R the video game.
We can make it a terminal game and use libcaca for the artwork. Who's going to sue us if we just use anime screencaps?
>>
Need help /g/, been working on this one for a little while. I need to take text that is formatted like below
Doe, John K. 
93.2
Andrews, Susan S.
84.7
Monroe, Marylin
75.1
Gaston, Arthur C.
62.8


and make it like this
Doe, John K. 93.2 A
Andrews, Susan S. 84.7 B
Monroe, Marylin 75.1 C
Gaston, Arthur C. 62.8 D


So far i've gotten the formatting down but the last thing I am just absolutely stuck on is how the bloody hell I make the number in this file to relate to anything or have it as it's own standalone variable. My code is currently

using namespace std;

enum letter_grade { A, B, C, D, F };

int main()
{
string lastName, firstName, middleName, fullName, line;
int i = 0, line_number = 0;
string total;
int dicks = 0;

ifstream input("student_status.txt");

while (getline(input, line))
{
if (dicks > 0)
{
total.append(" ");
}

total.append(line);

if (dicks > 0)
{
total.append(" ");
if (dicks % 2 == 0)
//{
//total.append("test");
//}
total.append(" ");
total.append("\n");
dicks = 0;
}
else
{
dicks++;
}
}

cout << total;

input.close();
return 0;
}
>>
>>53760866
>decentralized
what do you mean by this? like ipfs or some crazy shit?
>>
>>53760883

vim file.text
them spam JjJjJjJ...
>>
>>53760832
For some reason the AS year is a lot easier than A2 for computing, but the coursework will bend you over and fuck you in the ass before you've noticed it's got a hard-on for you.
That said, there still isn't a lot of content to cover for the last exam so consider than an easy A*.

But it will help a lot for CS first year, you probably wont need to turn up to much at all, which sounds bad but first year doesn't count for shit so it's always easy anyway.
Soon as 2nd year rolls around you'll be back to the usual workload again though, and who knows, the content may even get interesting.
>>
>>53760903
then add letter grades manually :^)
>>
>>53760879
I lol'd
>>
>>53760883
You've made spaghetti out of a potato here
>read two lines
>parse and produce output
>repeat

Unless you need all the data at once, then
>read two lines
>parse into useful types
>save into collection
>repeat
>process collection after reading stage
>>
>>53760903
>>53760922
yeah no that's not gonna work

>>53760953
then what would you suggest? I am honestly god awful at c++ and don't have any resources besides the textbook and emailing the teacher (which he takes 3 days to fuckin reply)
>>
>>53760919
my course finishes in 4ish months and we have literally covered variables, if statements and things like switching between forms

shit is torture

>the content may even get interesting
:D

although it should be for the price of the fucker
>>
>>53760883
here's what you want:
while file has lines to be read {
read line -> store in name
read line -> parse into float
print out name
print out float
print out float grade value
print newline
}

it's literally that simple.
>>
>>53760029
and then you just memorized something without understanding it
congrats, you are a useful dumb ass

>>53760402
wtf?
>>
Here's a black person name generator I made. If anyone wants to amuse themselves go right ahead.

http://pastie.org/10778689#
>>
my flatmate is learning JS on codecademy.
He is struggling the most basic tasks without an ide and his 'debugging' is complaining to me about how codecademy is 'broken'
>>
>>53761020
Ha, ha

Jamsus Harris
Quintarterious Brown
Jertarkwon Robinson
Perilquel Johnson
Quensharshon Jackson
>>
>>53761021
codecademy is shit
>>
>>53757770
all you need to know to write mathy code is how to use google- http://lmgtfy.com/?q=c%2B%2B+jump+in+parabola+source+code
>>
>>53761005
I said LEARN, not memorize. You seem to have misinterpreted when I was saying.

I'm not sure how you or other people go about it, but personally, whenever I learn a new programming concept I need to practise it a few times before I get it down. This has nothing to do about route memorization and everything about getting a better understanding of the concept through practical experience.
>>
>>53757374
my latest fizzbuzz in groovy:

(1..100).collect{((it%3==0?'fizz':'')+(it%5==0?'buzz':''))?:it}.each{println it}
>>
>>53760997
it literally seems so simple yet when I write something similar nothing that seems to be happening is actually happening. this is what I wrote up

using namespace std;

enum letter_grade { A, B, C, D, F };

int main()
{
string lastName, firstName, middleName, fullName, line;
int i = 0, line_number = 0;
string total;
float dicks = 0;

ifstream input("student_status.txt");

while (getline(input, line))
{
getline(input, fullName);
input >> dicks;
input.ignore();
cout << fullName;
cout << dicks;
cout << "\n";

}

cout << total;

input.close();
return 0;
}
>>
>>53757770

Trying to read Introduction to Algorithms. Passing interesting in cryptography (hola NSA, willing to sell out) and file compression.
the meme is real. The entire field was applied mathematics all along. Kill me.
>>
>>53761197

> he thinks using fancy operators and cramming it into one line makes it better
>>
>>53761223
also, to add to that, the only thing output was 93.2
>>
File: meesee.png (105 KB, 638x360) Image search: [Google]
meesee.png
105 KB, 638x360
>>53761197

It's important the made code readable if you plan on working with other people.
>>
>>53760029
these are the people who call others pajeets
>>
/wdg/ is dead so i'll just ask here -- how can you make it so double quotes aren't escaped?

                $('#siteTable > tbody:last').append("<tr><td>" + data['results'][index]['url'] + "</td><td><img src="https://logo.clearbit.com/"+data['results'][index]['tags']+"?size=60"></td></tr>");


the double quotes just fuck my shit up at the " preceding the https
>>
>>53761351
$('#siteTable > tbody:last').append("<tr><td>" + data['results'][index]['url'] + "</td><td><img src=\"https://logo.clearbit.com/"+data['results'][index]['tags']+"?size=60\"></td></tr>");
>>
>>53761021
Even Khan academy and w3schools are better for learning JS.
You don't need an ide if you have a browser and a brain.
>>
>>53761351
just use a single quote for the src
src='https://logo.clearbit.com/'

or this >>53761388
>>
>>53761329

what the fuck does this even mean
>>
>>53761388
>>53761395
thanks
>>
>>53761223
Jesus fuck mate, the getline in the while body gets discarded. Put that shit in a variable, that's your name!
>>
>>53761351
>wdg
>>
>>53761072
this

even if you have no idea about programming you should just get a general sense that's it's made for retards, by retards
>>
>>53761351
>how can you make it so double quotes aren't escaped?
>how can you make it so double quotes are escaped?

look up how to escape characters
>>
>>53761411
yeah i'll come back here after work when i'm doing my uni assignment -- and not at work doing web developing
>>
>>53761396
curryniggers learn by memorizing things and repetition without actually understanding things, and idiots like >>53760029 like to insult 'pajeets' and falsely gain a sense of superiority when it's they themselves who are the real 'pajeets'
>>
>>53761454

I wasn't saying anything about route memorization though. God fucking dammit
>>
>>53761259
So it's not an exercise in one liners with fancy operators?
>>
Anyone good with Node js and want to explain what's happening here?

 function incorrectCredentials(e, p) {
console.log('inside function');
requestS(url)
.post('/userLogin')
.send({email: e, password: p})
.end(function(err, res, body) {
console.log('end function');
var $ = cheerio.load(res.text);
var text = $('a[class=headerlogo]').text().trim();
text.should.equal('Incorrect credentials.');
res.status.should.equal(200);
});
}



When I run, it only prints 'inside',
why is it not going inside the end function?
>>
>>53761531

why should it be?

forcing yourself to cram shit into one line is only useful for flexing in /dpt/ threads
>>
>>53761454
>learn by memorizing things and repetition without actually understanding things

You know that understanding a thing is a matter of memorizing the sub-things which constitute that greater thing, right?
>>
>>53761554
only prints 'inside function' ***
>>
Anyone know the current computer architecture model? I want to say it's Von Neumann for general computing.
>>
There are people who still believe that the JVM and CLR are interpreters.
>>
File: output2.webm (1 MB, 640x480) Image search: [Google]
output2.webm
1 MB, 640x480
Rate my torus!
It's made entirely of spheres!
>>
>>53761672

I doubt that.
>>
Just came up with an algorithm that can convert 24-bit colors from any color depth from 3-23 bit
>>
>>53761672
Who thinks that?
>>
im using processing for a project of mine; im extremely new to code.
im working on having text randomize its letters.

im getting a NullPointerException error once i translated my String l into an array. pls help.

PFont f;
String l0;
String l1;
String l2;
String l3;

String[] l={l0, l1, l2, l3};

void setup () {
size (800, 400);
noStroke();
f = createFont("OCR A Std", 150, true);

l0 = "B";
l1 = "O";
l2 = "A";
l3 = "T";
}

void draw () {
background (0);
textFont (f);
fill (255);


text (l[0], 200, 250);
text (l[1], 300, 250);
text (l[2], 400, 250);
text (l[3], 500, 250);
}
>>
>>53761684

Nah, my compilers professor made the mistake of categorizing them as interpreters. I pointed out that they interpret nothing and JIT the bytecode into native code at runtime. Although he did point out (correctly) that there are SOME implementations of the JVM that are interpreters of bytecode, and do not use JIT. Albeit, those are rather old.
>>
>>53761672
They are though.

Java gets "compiled" into bytecode, which then gets interpreted by the virtual machine
>>
>>53761772
>I pointed out that they interpret nothing and JIT the bytecode into native code at runtime.

I appreciate that you're paying attention in class, but don't be that guy.
>>
>>53761751
You're initializing an array to null values. Generally you do not want global variables because you end up with issues like this. Make the array in the draw function to avoid the issue. What does your main look like?
>>
>>53761827
Oh I understand now, thanks anon. I'm trying to figure this out as I go. I heard it's a good software to introduce myself to code so I'm using it for a couple art projects of mine and hopefully I'll find the boundaries of this and get excited to broaden into Java or whatever else fits my needs.
>>
>>53761778

This might be true if we were talking about the JVM about 15-20 years ago.

Java bytecode isn't interpreted anymore though. It's compiled at runtime into native code. This is an important distinction, because with interpreting, you pay for the cost of parsing the meaning of the bytecode at every iteration. With JIT, once it's been compiled into native code, you're not touching the bytecode again until the process ends (or more bytecode is loaded and JIT'd).

>>53761820

Hey, it's important knowledge. I've met other people before who think Java is interpreted, and think that's the reason why it's slow. JIT is a one time cost. The JVM has other reasons why it's slow.
>>
>>53761772
>>53761684
i had someone argue with me for like an hour trying to say that there's no difference between interpreters and executing bytecode/VMs
>>
File: 1454648670029.png (90 KB, 320x239) Image search: [Google]
1454648670029.png
90 KB, 320x239
What's the best online c++ tutorial?
>>
>>53761886
>The JVM has other reasons why it's slow.

Sure, but the JVM is pretty god damned tasty as far as VMs go.

Really not all that bad performance wise.
>>
>>53761020
a bit random, but does anyone know what this kind of generator is called? I want to write a generic one and I want to know what to call the function
>>
>>53761991
string namegen(string[][] parts...)
{
string output;

foreach (string[] part; parts)
output ~= part[uniform(0, $)];

return output;
}


that was easier than I thought desu

does it have a technical name? Like a markov chain generator does (obviously this isn't a markov generator)
>>
>>53761991
>>53762051
maybe like "segment generator" or something?
>>
Just came across id's fast inverse square root algo. Is there anything like this for cube roots?
>>
>>53762051
wait a fucking minute
return reduce!((a, b) => a ~= b[uniform(0, $)])("", parts);

jesus christ higher order functions are basically cheating
>>
>>53757870
for(var i = 1; i<=100; i++){
var jew = "";
if(i % 3 == 0)
jew="Fizz";
if(i % 5 == 0)
jew+="Buzz";
console.log(jew == ""?i:jew)
}
>>
>>53762061
http://www.sciencedirect.com/science/article/pii/0898122182900414 ?
if you bother reading some of the papers on why fast inverse square root works, you might be able to kinda generalize the method. maybe try reading http://h14s.p5r.org/2012/09/0x5f3759df.html or http://betterexplained.com/articles/understanding-quakes-fast-inverse-square-root/
>>
>>53761555
have you ever heard of code golf?
>>
File: DOM-M-2-03-1280.jpg (495 KB, 960x1280) Image search: [Google]
DOM-M-2-03-1280.jpg
495 KB, 960x1280
Complete newbie here. I took a VB course and did okay but my heart wasn't in it at the time. I tried learning C++ awhile ago and played around in Code::Blocks IDE without a lot of success and sort of gave up again. I'm trying to pick it back up but before I do I wondered what you guys recommend for a good IDE to work C++ with.
>>
>>53762124
Honestly, code::blocks is probably the best. Their site should have tutorials on how to navigate it and all that
>>
>>53762124
doesn't matter, a certain IDE isn't going to make you magically better
>>
>>53761751
>>53761827
How do I set a time for in between loops?
>>
>>53762060
hmm

I was kind of hoping for a widely accepted way of referring to it rather than just coming up with one, but there doesn't seem to be anything online

if I were to just make up a name, maybe syllable splice generator? Array splice generator?
>>
>>53762152
Your sentence makes absolutely no sense. What are you trying to do?
>>
>>53762167
what are those children's books called where they have a bunch of pictures of people split into heads, torsoes and legs, and you can swap them around?
>>
>>53762144

That's cool, thanks. I'll keep with the code::blocks then.

>>53762151
Yeah I wasn't asking what would make me better so I'm sorry if it sounded that way. I just didn't know if there was something that ran better/less buggy.
>>
>>53762176
void setup () {
size (800, 400);
noStroke();
loop();
f = createFont("OCR A Std", 150, true);

l0 = "B";
l1 = "O";
l2 = "A";
l3 = "T";
}

void draw () {
background (0);
textFont (f);
fill (255);
String[] l={l0, l1, l2, l3};
int i1 = int(random(l.length));
int i2 = int(random(l.length));
int i3 = int(random(l.length));
int i4 = int(random(l.length));
text (l[i1], 200, 250);
text (l[i2], 300, 250);
text (l[i3], 400, 250);
text (l[i4], 500, 250);
}



It's currently looping too fast, I would like to slow it down
>>
>>53762079
If you really care, concatenating Strings like that is considered bad practice because Strings are immutable in Java (not sure about C#) so you are creating a bunch of objects by doing it. It's not a big deal in this case but just an fyi, try using String Builders/Buffers if you feel you need to concatenate a lot
>>
>>53762203
sleep the thread || lower the frame rate so it calls draw less times per second.
>>
>>53762232
also, i feel like it is really unnecessary typing each action for my integers.
how do i shorten this?

int i1 = int(random(l.length));
int i2 = int(random(l.length));
int i3 = int(random(l.length));
int i4 = int(random(l.length));
>>
>>53761413
I'm coming from R and using it to learn Python. It's an agonizingly slow drip-feed of information but I do feel like I'm learning. I'm doing it mainly to get used to the syntax and whatnot. It seems to be made as an all-ages thing. Like a middle school teacher could use it to get a class to write fizzbuzz or something.
>>
Intel >>>>>>>>>>>>>> AT&T
This is objective fact
>>
I have to learn Prolog for a research project and I don't know where to start. Does Prolog suck? Am I fucked?
>>
>>53761574
says the "math is gay" murritard who cannot into calculus

take the sine and cosine functions for example. if you can UNDERSTAND a concise description of them, you DON'T need to grind simple problems for countless hours before you "understand" them. and the pajeet/murritard, after all that repetition, will still lack the understanding to do "more difficult" "word problems". all they learned is to be a monkey that knows how to work a calculator for a very narrow set of problems, completely missing the bigger picture.
>>
>>53761574
>You know that understanding a thing is a matter of memorizing
not only that, you also memorize the RELATIONSHIPS (cause, origin, whatever) that exists between those things
>>
File: Screenshot_20160330_142929.png (15 KB, 561x155) Image search: [Google]
Screenshot_20160330_142929.png
15 KB, 561x155
// null state is the beginning of a name
// a space is the end of a name
string markov_gen(int length = 2)(string corpus)
{
char[length] state;
state[] = '\0'; // initialise state to null
char[][char[length]] dict;

char next()
{
if (state in dict)
// return a random character that followed
return dict[state][uniform(0, $)];
else
// return a random character from a random dict entry
return dict[dict.keys[uniform(0, $)]][uniform(0, $)];
}

void push_state(char c)
{
state[0 .. $ - 1] = state[1 .. $];
state[$ - 1] = c;
}

// generate dictionary
foreach (char c; corpus)
{
// change to space if tab or newline
if (c == '\t' || c == '\n') c = ' ';
// add char to dictionary
dict[state] ~= c;
// clear if space
if (c == ' ') { state[] = '\0'; continue; }

push_state(c);
}

// clear state
state[] = '\0';

string output;
char current;

while ((current = next()) != ' ')
{
output ~= current;
push_state(current);
}

return output;
}

Tamprontius
Allectus
Augus
Lucius
Sextus
Caeus
Bruttius
Statidius
Calbinus
Burius
Nigrius
Bavius
Messius
Belius
Aiusonius
Afranlius
Publius
Albius
Titidius
Autticius


The more I use markov chains, the more interesting they get
anyone know any other random string generation algorithms?
>>
>>53762541
>says the "math is gay" murritard who cannot into calculus

What in god's name are you even talking about?
>>
>>53762342
you're not wrong.

By the way how hard is it to make the transition from 8086 to a 32 bit x86 instruction set?
>>
>>53757997
Wait a second. How do you even reverse a tree? Does she mean mirror it? Is it even sorted? Does it have an iterator?
>>
>>53762577
i'm pretty sure you've said something along the lines of "math is gay" and that you don't know calculus
>>
>>53762519
>Does Prolog suck?
no
>Am I fucked?
probably not
>>53757997
this shit was funny the first 12 times, but can we please try to keep /dpt/ to some original content? i swear we fucking need that /r9k/ filter in this shithole sometimes
>>
>>53762573
>Fureolaciusonius
>>
>>53762519
It's not a language you would use very often but it's interesting to learn.
>>
>>53762573
I put the state length down to one and they got a bit ridiculous
Alviturbigniccilbalaetieonus
Flius
Nius
Lus
Anuricinusiberus
Bustonidius
Aus
Pus
Sevarus
Sesorius
Sanurius
Debius
Tinomus
Pus
Fus
Aleruss
Afecius
Flfrntiugucus
Ahius
Pus
>>
File: haha-time-for-repl.png (167 KB, 1920x1080) Image search: [Google]
haha-time-for-repl.png
167 KB, 1920x1080
It's all about the repl baby

DrRacket makes you reload everything though, it's not like sbcl/slime where you can update stuff on the fly
>>
>>53762592

I've taken Calc I, II, and III. The whole 'math is gay' bit is satire (or, more specifically, shitposting)
>>
>>53759879
this book is so bad desu
>>
>>53762254
int i1 = i2 = i3 = i4 = int(random(l.length)); 
>>
>>53762707
in this sketch, the each int value is a randomized letter within the array "l". if i equate all of them the output will be always the same series of letters.
>>
>>53762254
>>53762203
draw() should be a loop
>>
http://i.4cdn.org/wsg/1458610410109.webm
>>
>>53762746
fixed, thanks.
>>
man, HaXe is really awesome... when it works. when it doesn't, makes you want to kill yourself
>>
>>53761223
The issue is you're using the wrong language

def Grade (score):
score = round(float(score))
if score >= 90: return 'A'
elif score >= 80: return 'B'
elif score >= 70: return 'C'
elif score >= 60: return 'D'
else: return 'F'
with open("test.txt")as f:
lines = [line.strip() for line in f.readlines()]
for students in zip(lines[0::2],lines[1::2]):
print(students[0],students[1],Grade(students[1]))
>>
>>53762579
You mean going from 16 bits to 32 bits?
Yeah, it ain't difficult.
Just use the full extended registers. If you're using intel syntax nothing else really changes. (eax rather than ax)

If you're using AT&T syntax....well...everything changes.
>>
is there an alternative to sublime text that isnt shit?

i like the look of it but its really starting to annoy me
>>
>>53762878
vim/emacs
>>
>>53762824
there is a more elegant way to write this using modulus and char addition. your if elif else could be an if else with two lines.
>>
>>53761294
read in his voice
>>
>>53762878
Atom is Sublime in slow.
Everyfucker here keeps saying vim is the shit..
>>
>>53762878
>alternative to sublime
why?
>>
>>53762910
Show me
>>
>>53757374
i would use erlang's """ repl """ if it supported function declaration that isn't named funs.
i made a fib/lucas number calculator a minute ago, and it made me seriously wonder what kind of storage erlang uses for numbers because the accuracy was perfect for every number i tested, and it wasn't slow either.
speaking of, does anyone here write erlang?
>>
>>53762940
working on it in c++ with an online compiler. I meant integer division, not modulus.
>>
>>53762945
Why are you using Erlang still? It's 2016, use Elixir
Thread replies: 255
Thread images: 42

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

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.
If a post contains personal/copyrighted/illegal content you can contact me at [email protected] with that post and thread number and it will be removed as soon as possible.
DMCA Content Takedown via dmca.com
All images are hosted on imgur.com, send takedown notices to them.
This is a 4chan archive - all of the content originated from them. If you need IP information for a Poster - you need to contact them. This website shows only archived content.