[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: 360
Thread images: 35

File: 1480590811928.png (389KB, 934x1000px) Image search: [Google]
1480590811928.png
389KB, 934x1000px
What are you working on, /g/?
Old thread: >>58405128
>>
Rewriting the Linux kernel in Haskell.
>>
More a question then anything else:
Trying to write a bot for an android game because I like to learn to write bots.

How am I supposed to decode the traffic?
I got an emultor installed the app, opend wireshark and filterd all the traffic.
That's seemed logic to me but what about now.
I got a lot of encrypted stuff.

Any idea and sugesstions?
Currently trying to write a bot for Dragon and Knights but I really don't care which game desu
>>
>>58410286
a unionfind algorithm to find the connected component with the input of a .txt filled with all existent edges and printing all unions out.

the code is absolutely ridiculous, and programming felt like i'm experiencing a car crash i can't avoid, it kept getting worse and worse. not to mention it doesn't work. well

http://www.codesend.com/view/5b47ef46add8349bc909f8b201e0a862/
>>
>>58412619
Have you taken the brown pill yet, mateys?

it's a tough pill to swallow!
>>
>>58410413
Why
>>
I dont know where to start.

0 CS and Coding experiencd
>>
>>58413522
write a HolyC interpreter
>>
File: Descartes.jpg (74KB, 476x484px) Image search: [Google]
Descartes.jpg
74KB, 476x484px
>>58410286
I'm working on you're mom if you catch my drift.
>>
>taking a class on C
>have to download a program
>have to compile helloworld
>gcc helloworld.c
>gcc not found

10/10 I fucking quit
>>
>>58414014
goodbye
>>
>>58414025
i dont understand what im doing wrong here
>>
>>58414014
Set PATH
>>
>>58413522
Try PHP
>>
>>58414208
what
>>
>>58414255
Add gcc to PATH system environment.
>>
>>58414332
yeah i dont...
>>
>>58414014
Maybe you should listen in class.
>>
>>58414370
How about you Google it?
>>
>>58414530
>Not a very useful one.
How do you know? What's something you think is useful that couldn't be done safely?

>These's only safe or unsafe, no in-between. And it only takes a single unsafe (or FFI call) block anywhere to invalidate the guarantees of the entire program.
Of course, but because you are developing the program you don't have to think of the program as just one indivisible thing. Like I said, any code outside of an escape hatch cannot be the source of a bug and can be aggressively optimized. Either it's the code inside the escape hatch itself that is wrong, or the assumptions and promises made at the boundaries of the escape hatch that are wrong or not kept. Of course, it is possible to empirically check that the boundary conditions are maintained using assertions that may be taken out in a release build.
>>
File: maddog.jpg (133KB, 800x1200px) Image search: [Google]
maddog.jpg
133KB, 800x1200px
what eclectic programming language combo would a man like this have? I don't know anything about programming but I figure it wouldn't be something popular like python or java, obviously it would be exotic and awe-inspiring like a haskell/perl guru
>>
File: 2017_ComputerScience_Core.jpg (1MB, 1134x2268px) Image search: [Google]
2017_ComputerScience_Core.jpg
1MB, 1134x2268px
>>58410413
Linux is the past not the future, look into libOS or rumpkernel.org or how the Mach microkernel works (Hurd). You want to build userspace libraries that act like a full kernel but have no privs so can be distributed which is the point of rumpkernel ect.
>>
>>58414635
>Linux
C
>>
Check it out guys, totally aced my job interview, they offered me the position, plus 20% more than what they were originally offering.

#include <stdio.h>
#include <stdbool.h>

int main(int whatever, char **fuck_you) {
for (int i = 1; i <= 100; ++i) {
bool printed = false;

if (i % 3 == 0) {
printf("Fuck");
printed = true;
}

if (i % 5 == 0) {
printf("Butt");
printed = true;
}

if (!printed) {
printf("%d", i);
}

printf("\n");
}

return 0;
}
>>
>>58414530
>>58414610
Also, logically, if a piece of code has no unsafe block, even if it calls a function that itself has an unsafe block, that function is an assumption. If you form a deduction from an assumption to a conclusion, the deduction itself is correct independent of the validity of the assumption.
>>
>>58410413
Do it in x86
>>
>>58414690
Really excellent stuff anon.
>>
Why is there hardly any documentation on using the gpio pens in C++ for the orange pi
>>
>>58414610
>How do you know? What's something you think is useful that couldn't be done safely?
Anything implementing fundamental memory management structures and functionality, demand paging for example.
>>
>>58414808
Why do you think that can't be done safely?
>>
How similar is C and Python?
>>
>>58414875
Not at all similar.
>>
>>58414835
They are driven by interrupts and shared global states.
>>
Should I tell potential employers whether I live in New Jersey?
>>
>>58414889
Only because the OS is designed that way. If we're talking about using the OS, then you just have to give the API an appropriate type, and if we're talking about writing an OS, then you don't implement something that stupidly in the first place.
>>
>>58414692
The corollary of course being that the soundness of your proofs says nothing about whether the program does what you actually wanted it to do.
>>
>>58414926
How many times do I have to repeat the same thing?
>>
File: dudduruu.jpg (8KB, 218x217px) Image search: [Google]
dudduruu.jpg
8KB, 218x217px
Anyone have advice for a final year CS student? Should I just be focused on doing the course work and then get really pay attention to a specific language + field in CS and learn things on the job or should I do that out of school?

School's kinda mentally draining and I find the lack of motivation to do anything outside of school, since it occupies me fully, obviously.
>>
>>58414915
It's the way the CPU works.
The point is that you can't model it safely in any language, the only way you can guarantee correctness is by careful manual state management.
>>
>>58414968
Okay, so the way the CPU is designed. Not something you implement yourself nevertheless, just something you have to provide a suitable API for.
>>
>>58414957
Take electives you're interested in
Forget about learning specific languages and industry bullshit, that's all on the job training for the most part.

The vast majority of CS grads are recruited during grad year to be parachuted directly into some Silicon Valley corp
>>
File: tldr life.jpg (171KB, 1280x720px) Image search: [Google]
tldr life.jpg
171KB, 1280x720px
>>58415005
>Take electives you're interested in
Currently taking an introduction to statistics and chemistry course, I guess its fine but pretty indifferent about it

>The vast majority of CS grads are recruited during grad year to be parachuted directly into some Silicon Valley corp
Firstly I'm in NewZealand so I don't know if its any different but could you teach me how to life? I seriously don't have the faintest idea of what im supposed to do in my final year in school, do I just like send out my CV to random companies saying im a soon-to-be-graduate and in hopes that they ask me to work for them after an interview or something?

Idk anything about life
>>
>>58414991
The point of low level systems languages is to implement those APIs.
>>
>>58414014
Um.
Do you have gcc?
What distro are you using?
>inb4 windows
>>
>>58410286
How do I into web dev?
I always did systems stuff, but it's hard to find work for systems people, and when you do get some work they always have you doing something that's not systems related.
So I need to do gay web shit, maybe I can even be one of those legendary "full-stack" developers.
>>
File: 1477836894134.png (194KB, 498x430px) Image search: [Google]
1477836894134.png
194KB, 498x430px
>>58414957
>School's kinda mentally draining and I find the lack of motivation to do anything outside of school, since it occupies me fully, obviously.
It's that way for most people.
Now let me ask you motherfucker.
ARE YOU MOST PEOPLE?
>>
>>58415132
>>/wdg/
>>
File: Christmas Okarin.png (181KB, 952x808px) Image search: [Google]
Christmas Okarin.png
181KB, 952x808px
>>58415158
>ARE YOU MOST PEOPLE?
N-no :(
but I get tired like most people...
>>
>>58415052
I've educated myself a bit on the subject and now see how this works. The CPU triggers a page fault interrupt and the OS traps it. The OS trap needs to mutate some state, but it can only get this state through a global.

You can model that pretty easily by using linear capabilities. They have no run time representation (so you can say that a trap borrows the capability even though in reality a trap is just a side effect) but allow you to treat mutation of a static piece of state as transformations of immutables.
>>
>>58414014

You either do not have GCC installed, or you do not have the path to the executable within the system path. When you run a program from the command line, it searches a list of folders specified by the system path for executables. If it can't find they program, it will report a command not found. It doesn't search the entire hard drive, because that would take forever, and could easily lead to finding multiple programs with the same name.

If you're in Windows, you're going to need to do two things:

1. Install GCC. This is usually distributed under the names MinGW-w64 or MSYS2. I would recommend MinGW-w64 for simplicity.

2. Find the path to the folder where gcc.exe is located, copy this at the end of the PATH environmental variable in your control panel. Note that your command line does not reload your PATH upon a change, so you'll have to start another instance of whatever command line program you are using.
>>
>>58415237
You also shitpost like most people. Go to bed.
>>
>>58415308
Or, you know. You could just do it the simple and sane way with a proper programming language like C or C++.
>>
>>58415347
Not him, but it's 4:30pm in New Zealand.
>>
>>58415050
Can I get an answer for this? mainly the second greentext
>>
>>58410286
noob here learning python and i'm not liking it very much, pip can't install shit (so far i've only tried to install pygame and kivy and both gave me errors) and generally everything seems like.. wrong, maybe i'm just superficial but.. indenting instead of braces feels stupid, "self" in every method is silly, etc... should i continue to learn this language? only to expand my knowledge at least
>>
>>58415404
Have you used any other languages before?
>>
>>58415416
yep, c/c++, java, javascript and a little bit of ruby
>>
>>58415447
It's understandable that you don't like Python then, I think.

There are lots of languages that are (in my opinion) more interesting than Python, especially given that you already know JS and Ruby.

Have you considered a Lisp, or a statically typed functional language?
>>
File: 1483008927232.png (2MB, 3840x2160px) Image search: [Google]
1483008927232.png
2MB, 3840x2160px
I have a few of these
>>
File: 1483008807152.png (3MB, 5288x2158px) Image search: [Google]
1483008807152.png
3MB, 5288x2158px
>>58415513
>>
>>58415350
>you shouldn't bother with proving anything since you can't prove independently that the CPU does what it's supposed to do
>>
>>58415473
i once wrote a little program in lisp for a school homework and i kinda liked it, maybe i should look deeper into it, what big apps have been made in lisp?
>>
>>58415565
http://lisp-lang.org/success/
>>
>>58415561

Mate, when you are working with low level crap like page tables, you need to be thinking low level, and not thinking high level. Leave your functional nonsense to userland applications.
>>
>>58415592
There's nothing high level about proving something correct.
>>
File: 1483038374549.png (1010KB, 2000x2210px) Image search: [Google]
1483038374549.png
1010KB, 2000x2210px
>>
>>58415353
Then you go to bed.
>>
>>58415596

You can enjoy your self-proving programs with 8MB executable size.
>>
>>58415697
You can prove that C programs are correct.
>>
>>58415726

Sure, but the C program itself isn't a proof.
>>
>>58415770
So? It's called static verification for a reason. A language that combines programming with proving doesn't retain any of the latter after it is compiled.
>>
>>58415786

How is that relevant?
>>
>>58415789
Because the proving part doesn't affect executable size (or run time, or memory used) like you claim.
>>
>>58415800
Not negatively, anyways. Proving can make optimization more effective if anything.
>>
>>58415596

My problem is not with you wanting to prove correctness.
My problem is with your use of a high level thought process to approach an innately low level task. You should be thinking more concrete, less abstract.
>>
>>58415819
What's high level about reasoning about access to resources?
>>
>>58415158
Literally the opposite for me, I lack motivation to do anything inside of school.

Why won't death welcome me.
>>
>>58415830

>You can model that pretty easily by using linear capabilities. They have no run time representation (so you can say that a trap borrows the capability even though in reality a trap is just a side effect) but allow you to treat mutation of a static piece of state as transformations of immutables.

Doesn't sound very low level to me.
>>
Designing a processor now as a part of a larger project. The processor should be as simple as possible (low resource use is the largest goal), while retaining good throughput, and have completely deterministic operation.

Currently going for pipelined operation, no reordering, just bubbles. Opcodes that unpack into control line sets and a minimal number of instruction formats, so the decoder can be small as possible. ALU only has one adder, one logic unit (uses opcode to specify bitwise truthtable), one shifter, and one bit merge/bit select.

I have a few issues though... Multiplication and division is one. I know there are O (log(n)) algorithms that use only one adder, but the additional logic might blow up my LUT usage. I can't find a good way using the theory of its operation described in H&P.
The other issue is memory... there are ways to improve memory throughput or latency, but I'm not certain if that still applies to FPGAs and I'm not certain if I can make their operation deterministic.

Any ideas?
>>
>>58415849
Why? If you're not thinking about a similar thing when you're programming with C then you're not going to do a very good job. This just codifies it in the language which means the compiler can check it and use it to optimize.
>>
>>58415800
>Because the proving part doesn't affect executable size (or run time, or memory used) like you claim.

I never claimed that the proving part contributed to the executable size, it's just that all of the languages which combine programming and proving are complete garbage and have a tendency to produce billion MB executables for Hello World.
>>
>>58415960
Not ATS. Well, the syntax is complete autistic garbage but the compiled programs are quite good.
>>
>>58415882

A lot of kernel level shit tends to involve DMA and volatile variables, which don't really optimize well. The things to be thinking about are primarily going to be along the lines of "what memory address to I write to and when?"
>>
>>58415404
damn im still unable to install libraries, it seems that with every new release something breaks... this is ridiculous
>>
>>58410413
Me too thanks.
>>
File: Untitled.png (120KB, 387x392px) Image search: [Google]
Untitled.png
120KB, 387x392px
>>58410286
I'm not sure if such a program exists, but it's
a cute girl that will sit in the bottom right and broadcast what music you're currently playing in the frame between her hands. I'm still a noob, and the handle.exe provided by microsoft can't process japanese characters which was my whole purpose for it.
>>
>>58416507
>java
Neat project though, have it be able to hook into foobar and I'll use it.
>>
What is the essential list of GUI widgets?
>>
>>58416554
That was the point I had been looking for so long, it should work with any program that plays music.
>>
>>58415647
So basically just learn java
>>
>>58416580
>it should work with any program that plays music

If you use C#, you can use the selected process' .MainWindowTitle. You can even have it so that the song title is selected by a user-provided regex. Then it'll work with any application.
>>
>>58416648
Oh that is so cool, thank you for that information, I'll look into it.
>>
>>58414370
kys nigger
>>
File: song.png (23KB, 672x324px) Image search: [Google]
song.png
23KB, 672x324px
>>58416660

It really is quite straightforward.
>>
File: gluttest3.webm (2MB, 640x480px) Image search: [Google]
gluttest3.webm
2MB, 640x480px
Glut tutorials are fun.
>>
>>58415647
Outdated and Python shilling.
>>
>>58417424
Whether you like it or not, whether it's good or not, everyone fucking uses it so what you think doesn't really matter desu.
>>
>>58417398
careful you might give somebody a seizure
please exercise Seizure-Safe Graphics Programming (SSGP)
>>
File: 2017-01-10-010506_752x882_scrot.png (85KB, 752x882px) Image search: [Google]
2017-01-10-010506_752x882_scrot.png
85KB, 752x882px
Writing an infix to postfix converter and a postfix evaluator in golang, linked lists and stacks are my new god.
>>
File: 1438522230320.png (2MB, 1862x521px) Image search: [Google]
1438522230320.png
2MB, 1862x521px
Someone tell me what C++ project i can do that will look good on a CV/repository
>>
>>58413522
Download Racket and then pick up The Little Schemer.
>>
>>58417494
That's like saying everyone uses mercury to cure their stomach ulcers, so what's the point of saying it's shit
>>
>>58417601
No it's not, you don't have to collaborate with them and use mercury to help cure their stomach ulcers.
>>
>>58415647
> C++ rated harder than C
???

This whole image is cancer, please don't propagate this harmful misinformation
>>
>>58415960
Really, the only time the size of the binary should matter is if it's in an embedded environment.
>>
>>58417562
Syntax highlighting is not endorsed by golang dictator please disable
>>
>>58417639

t. user of a language that creates 8MB hello world
>>
>>58415050
look on job search sites for jobs in whatever field you're interested in. apply to them with the intention to start now parttime and hopefully evolve into a fulltime role when you graduate. not necessarily for the actual advertised job but they might have something else. if they say bullshit like 3+ years required apply anyway, the worst they'll do is ignore the application.
>>
>>58417647
gross no
>>
>>58417653
With
#lang racket/base
it comes out to 984K, you were so close! Let's see what happens when I use
#lang typed/racket/base
... 15M! Damn, you really are bad at this guessing game.
>>
>>58417626
Make a better one faggot.

But first list changes.
>>
>>58417524
Lol
>>
>>58417682

That is terrible.
>>
>>58417653
can someone explain this "t. anon" bullshit that's been going on for a while now. wtf is it. i dont keep up with the meme sprouters but after over a year of this shit im curious.
>>
>>58417494
Many of the claims are outright false though.
>Facebook
>not PHP/Hack/JS
>Google
>not overly concerned with power efficiency
>not C++/Go
>outright stating "Python is the best"
>>
>>58417727
Doesn't even say what C is for baka.
>>
>>58417703

It's a Finnish meme. "t." is short for "terveiset" which means regards.
>>
recently started using go to write a websocket server

as a hobbyist this is justwerks the language. where were you when google saved programming
>>
>>58417565
Simple in-memory key-value/hash table database. Bonus points for multithreading.
>>
>>58417762
It is, until you have to do many small allocations. GC is GC.
>>
>>58417653
I was thinking about formalizing this into a static web resource in the hopes of creating a new metric about which to shitpost. The metric being the size of hello world binary under that language's default compilation. Wouldn't that be nice? x
>>
Anyone want to communicate over IRC and share progress and knowledge on coding and math and perhaps work together on some codebase? I think having two people induces a good sense of teamwork and fun. I am currently learning opengl, and if someone is also doing the same or wants to pursue it, it would be awesome to work together.
>>
Spend some hours programming a shitty game.

After fixing many bugs and hiting my head against the desk get it done perfectly but feel empty inside....

start staring at me code

30 minutes has passed I haven't done anything else just idling look at pc screen

it hurts to live
>>
>>58417832

I love the idea.
>>
>>58417855
do some exercise (not a lift fag here, just enough to work up a good sweat does the body and mind a lot of good to overcome mental anguish)
clean the house
and most importantly
get a good night's sleep
>>
>>58417874
I can't work out, I sprained my shoulder.
Until last week I was going to gym 5 times a week for about 1 hour and a half. Now I have to wait a few weeks until I fix my shoulder.
>>
>>58417682
Hahaha, you sure showed him.
>>
>>58417696
There's more tricks you can do with Scheme (racket) to further squeeze that down. For example GrammaTech has CodeSurfer
https://www.grammatech.com/products/codesurfer

It can instrument the build process, and obtain disassembly that is high quality enough to support rewriting. Using it's scheme API you can modify the CFG of each procedure directly, serialize the rewritten parts out as nasm, and even re-link with the object files you don't have source for. The result is tiny footprint and highly obfuscated and hard to reverse binary which is what we used to use to ship reverse resistant binaries compiled with a type safe lang (or own inhouse CodeSurfer clone for Typed Racket obfuscation).
>>
>>58415565
The entire US Army logistics is run by a Lisp AI.
>>
>>58418025
What runs the Marines logistics?
>>
>>58418038
Haskell
>>
File: fpcomplete.png (414KB, 594x716px) Image search: [Google]
fpcomplete.png
414KB, 594x716px
> i only use functional programming languages
>>
>>58418038
Why do you think the US Army has batteries for their flashlights, but the USMC doesn't?
>>
which functional programming language should i learn lads
>>
>>58418082
Clojure.
>>
>>58418072
Why are we so eager to bully these types? What is it about them that makes them so disgusting?
>>
>>58418072
> He doesn't learn multiple paradigms
>>
>>58418107
Not a full face beard.
>>
>>58418105
but the java bloat
>>
>>58418119
The JVM is a pretty magical platform, anon. Just gloss over the face that Java exists and you're sitting comfy.
>>
>>58418134
JVM is soooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo 90s
>>
>>58418038
COBOL
>>
>>58418119
Programmer comfort, happiness, and productivity outweigh absolute speed of execution.
>>
>>58418157
>programmer happiness
sisyphusian
>>
>>58417832
this would assist in shitposting about compilers and OS as well
>>
Anyone have those "graduation" with shitty code images?
>>
>>58418107
Animals have a way of recognising weak behaviour in members of the herd and naturally bully them to correct it. You see it frequently with dogs.
>>
>>58418183
i have a few from /agdg/.
>>
File: Hardcoding.png (137KB, 1266x1091px) Image search: [Google]
Hardcoding.png
137KB, 1266x1091px
>>58418198
>>
>>58418198
what's /agdg/
>>
>>58418218
amateur game dev general
>>
>>58418210
What should he have done here? Only thing I would have done differently is switch case and just returning directly from the conditional.
>>
Any Haskell gurus up? I have data structure that looks like this and I'd really like to be able to fmap over the stack.
data TokenInput = TokenInput {stack :: [Bool], inputs :: [Bool]}


Is there a better way of doing this than
data TokenInput a= TokenInput {stack :: a, inputs :: [Bool]}

and manually changing a to [Bool] every time I use it?
>>58418301
Used a case statement or even better, a map!
>>
>>58418301
At the least with the way the code is set up, he can make a map of strings to function pointers, but imo, just speculating at the surrounding code, he probably just needs to refactor
>>
>>58414478
Pun not intended
>>
>>58415876
You can ditch multiplication and division out and claim that your processor is RISC.
>>
>>58417626
>implying C++ isn't harder than C
>>
>>58418376
Data.Bifunctor

or
instance Functor TokenInput a where
fmap f (TokenInput ax bx) = TokenInput (fmap f ax) bx
>>
>>58418483

Being RISC isn't an excuse to not support MUL and DIV operations. MIPS supports them, ARM supports them, PowerPC supports them, RISC-V supports them when used with all of the common extensions (RV32/64G)
>>
What's the most common and simplest way to implement a lock file? I'm a notch below hobby-programmer and this is what I have for my simple program:

if not os.path.exists("/tmp/utility.lock"):
open("/tmp/utility.lock", "w")
utility.Run(args)
os.remove("/tmp/utility.lock")
else:
print("utility is already running. Exiting.")
>>
>>58418513
Thanks my dude.
>>
>>58410286
float* foo = new float[5];
foo = new float[4];


is there a need for

delete[] foo;
[\code]

between the lines? Or does the last index gets freed automatically
>>
>>58418566
I know C has "x" (for eXclusive) for opening files.
I don't know if memesnek has that as well.
>>
File: userInput.jpg (53KB, 1366x768px) Image search: [Google]
userInput.jpg
53KB, 1366x768px
Using nvim and python, How do i get user input to work when use the command !python in nvim i get the error msg in pic related -_- Thanks
>>
>>58418729
In C it would be allocated on the stack, so no freeing needed. Not sure about C++ and what the `new` keyword changes.
>>
The error is not shown in the pic it says 'EOF' when reading a line (line 3). New to python --_-
>>
File: o8ZUXi8.png (223KB, 1112x847px) Image search: [Google]
o8ZUXi8.png
223KB, 1112x847px
I'm adding a sidebar with options, it will let users go into settings etc.

If you haven't seen this before it's a streaming music player, basically mps-youtube but with a gui and more music sources.

Also, does anyone know how to find urls to audio on bandcamp?
>>
File: TheAmerican.jpg (101KB, 936x768px) Image search: [Google]
TheAmerican.jpg
101KB, 936x768px
>>58418809
>>58418840

forgot to link these
>>
>>58418740
>>58418566

Oh, I probably used the wrong term. I don't need exclusive write read/write access. I meant a mechanism for determining if the program is already open and preventing another instance from opening.
>>
>>58418729
you have to call delete[]. if you are not doing high performance stuff, use smart pointers instead of calling new and delete directly.
>>
>>58418825
new is like calling malloc.
>>
>>58418840
What python are you using?
>>
>>58418884
>I meant a mechanism for determining if the program is already open and preventing another instance from opening.
That's one use for exclusive files. You just open a file in exclusive mode, and close it when you're done.
You don't need to write to it or anything.
>>
gcc or clang?

clang is a bit faster at compiling so i'll use it during development but which one is better for release?
>>
>>58418729

Yes. You absolutely have to delete the pointer every time it goes out of scope, or you reassign it. C++ will NEVER automatically call delete on a naked pointer. RAII works on constructors and destructors, but there are none defined for base types, such as pointers.

And for the record, use a vector rather than a flat dynamic array, if you can.
>>
Python 3.6
>>
>>58418970

GCC currently produces the best optimizations. This may change in the future. Keep your eyes on benchmarks.
>>
>>58418301
Use an enum and a lookup table because string comparision is costly?
>>
>>58419015
Oh yeah, I always forget enums exist lmao (no hate I don't pretend to be good).
>>
File: all_normal.jpg (96KB, 840x700px) Image search: [Google]
all_normal.jpg
96KB, 840x700px
>>58418825
Thanks

>>58418889
Smart pointers is new to me. I'll read up more on it. Thanks.

>>58418889
Thanks. As for using std::vectors, I'm trying to learn ML and is trying to make a simple ML library to familiarize myself with the algorithms. Since I have no idea how many features will be pushed into std::vector I'm trying to make my own vector class that accepts many features at once.
>>
>>58418376
>Used a case statement
Can't you not use those with strings in C++ since they're not a primitive type?
>>
>>58418301
>What should he have done here?
See the filename. That shit should be defined in the game data, has nothing to do with game logic.
>>
>>58419072
I don't do C++, but is the distinction really on whether the type is primitive or not? That sounds like terrible design.

It would make much more sense if case actually compares the references, like (IIRC) C does.
>>
File: 2017-01-10-054823_756x465_scrot.png (111KB, 756x465px) Image search: [Google]
2017-01-10-054823_756x465_scrot.png
111KB, 756x465px
>>
>>58419096
LOL
It's translated to assembly, and there are no assembly instructions for comparing any type you can come up with

This is what happens when you "teach how to code" people who have no business learning that
>>
>>58415308
>You can model that pretty easily by using linear capabilities.
No you cannot because it's inherently non-linear, interrupts can preempt you at any time so there's no way to carry any kind of propositions through.
All you can do is setup a callback for the interrupt and when you get called you need to check some global state (special purpose registers), and update another piece of global state (your page tables).
>>
>>58419096

C and C++ switch statements only properly work on integral types. They translate into jump statements. Also, comparing references is not a proper way to compare strings.
>>
I really love Artificial Intelligence, does anybody know a good book or two about writing AI's?
>>
C++ Magic Square homework here. Kinda werks.
http://pastebin.com/63Tma9GZ

Or am I terribly wrong somewhere?
>>
>>58419254
>/// Create a program which checks whether a given n x n array is a Magic Square. Use functions.
>Use functions.
>>
>>58419292
Nevermind my lousy translation pls. The assignment says that I should be, umm, how do I put it, using functions, which do this or that.
>>
so I'm learning very basic c# stuff, and this guy says == is an evaluation symbol. I'm learning If statements.
I thought == was just equal sign though? and only actually evaluates in the context of an if statement?
Wouldn't I simply equate the value of seven to a variables if I said

int variableName
variableName = 6
variableName == 7

?
Sorry for being so stupid, but as you can see my knowledge is incredibly basic
>>
>>58419378

= is the assignment operator. The expression a = b means "assign a to b."

== is the equality operator. The expression a == b means "evaluate to true if a and b are equal, otherwise evaluate to false."
>>
>>58419378
int variableName
variableName = 6 //set that value of variableName, making it *equal to* 6
variableName == 7 //evaluates if variableName is *equal to* 7 (in this case it evaluates to false)
>>
>>58419337
you aren't using functions though.

>>58419378
= is the assignment operator

== is a Boolean operator which returns true or false by evaluating if the two statements contain the exact same data("equal")

In your code snippet, you declare the integer variableName
Then you assign variableName the integer value of 6
Finally, you use == which is "if variableName is equal to 7, return true. Otherwise, return false."

the program returns false as variableName is not equal to 7.
>>
>>58419410
>>58419431
Oh okay, basic misunderstanding then.Good to get that out of the way, thanks
>>
How do I go about learning regular expressions? This shit looks like straight up hieroglyphics
>>
>>58419465
> How do I go about learning regular expressions? This shit looks like straight up hieroglyphics

Just learn them
>>
>>58419471
Are you a lecturer? you seem to have a real talent. don't waste it
>>
>>58419471
>the English alphabet looks like hieroglyphics

I guess it would if you a chink
>>
>>58419471
Nobully please

I'm just looking for ways I can learn to read and write them. The trouble I'm running into is having useful data such that I can run the regex on and get meaningful and tested results
>>
File: dank-chokolate.jpg (229KB, 900x900px) Image search: [Google]
dank-chokolate.jpg
229KB, 900x900px
>>58419482
>>
>>58419465
>>58419508
Get a computer science degree.
>>
>>58419508
Do this:

https://regexone.com/

There you now know regexes
>>
>>58419471

Syntax for regular expressions varies a little between programming languages, so you'd need to read documentation, but concept is the same. You are using some sort of string to describe a class of strings. For instance, the class of strings that start with 5 a's, then 2 or more b's, then a c, then another a or b.
>>
Why aren't people using fortran and cobol?
>>
>>58419555
Because it's 2017, not 1950 grandpa.
>>
>>58419436
oh, fcuk. thx. brb
>>
>>58419563
but what's wrong with them?
>>
>>58419508
Disregard what everyone else is saying, regular expressions are just finite automata so start by learning them.

I recommend "Introduction to Automata Theory, Languages, and Computation"

https://www.amazon.com/dp/0321462254/?tag=stackoverfl08-20
>>
>>58419530
don't do this
>>
what happens when a programmer comes back from a 2 week vacation and doesnt understand his own code anymore?
>>
File: THANKS PERL.png (24KB, 780x431px) Image search: [Google]
THANKS PERL.png
24KB, 780x431px
>>58419585
>regular expressions are just finite automata so start by learning them
Too bad most modern regex implementations are fucking garbage and actually accept a language more powerful than a regular language.
People might think that more powerful is a good thing, but it's really not.
>>
is getting a computer science degree a meme? currently enrolled in business information systems degree and I start my first in a month. I don't learn basic OOP till the second year, and I feel like if I can't get a job as a business IT consultant when I graduate, I won't be able to get a job as a programmer because the course doesn't delve into programming.
>>
>>58419626
you need to write better code if you can't even read it yourself
>>
What language has the highest average pay? not the most jobs, but best paid jobs.
>>
>>58419656
Ancient Latin
>>
>>58419684
latin professors get paid fuck all
>>
>>58419656
java, not counting webfag languages
>>
How can I surrender myself to Pythonism?
>>
>>58419702
but isn't java the language of the underpaid pajeet?
>>
>>58419633

To improve the performance on that regex with Ruby, instead of doing a?{n}a{n}, do a{0,n}a{n}, or a{n, 2*n}. I don't think it optimizes "one or zero of a, times n" as well as it does "between 0 and n of a."
>>
>>58417849
Same person here. Just drawing attention to my proposition in case someone is interested but missed it.
>>
>>58419729
That's besides the point.
There is a worst case that causes the algorithm to blow up exponentially. So basically, it's garbage.
If Larry Wall and all those who followed him weren't retards, they could have used an O(nm) (regex length and input length) solution that doesn't have this sort of worst case.
It's all because they needed their shitty backreferences and arbitrary lookahead.
>>
>>58419722
No, everybody is just telling that because they are jobless Haskell faggots who are just jealous.
>>
>>58419722
there are a lot of white java programmers

only shit-tier companies hire unqualified pajeets

even in india, java programmers are probably well-paid (by indian standards), otherwise it probably wouldn't be so popular
>>
>>58415513
>>58415524
Thanks for posting these.
I recently made a hangman.
>>
>>58418107
Pretence.
>>
File: memzz.png (113KB, 801x480px) Image search: [Google]
memzz.png
113KB, 801x480px
Little project
>>
If I wanted to type an object as maybe Int in haskell, I would write
type MaybeInt = Maybe Int

Is there an equivalent for classes. If I created a list of only Ints, how could I create an instance of a Functor
data ListOfInts = End | ListElem Int ListOfInts
instance Functor ListOfInts where --wont compile
...

(assuming that my new type is not just [Int])
>>
File: anim.webm (183KB, 1122x810px) Image search: [Google]
anim.webm
183KB, 1122x810px
professional searching experience
>>
>>58419983
this is not a /wdg/ thread
>>
>>58420010
type ListOfInts = [Int]


Functor is a higher kinded polymorphic type
It only exists for type constructors - i.e. list, set, etc - not specific list instances.
>>
>>58420010
data ListOf a = End | ListElem a (ListOf a)
instance Functor (ListOf a) where
...


To be an instance of Functor, you need something with a kind of * -> *.
>>
>>58420030
It's a C# WinForm not WPF
>>
>>58420044
So you say there is no way around it? I was thinking of some thing conceptually along the lines of
 data ListOfInts a = (Int a) => End | ListElem a ListOfInts 
>>
>>58420078
WPF isn't /wdg/ either
>>
>>58420082
data ListOfInts a where
End :: ListOfInts Int
ListElem :: Int -> ListOfInts Int -> ListOfInts Int



but that isn't what you really wanted anyway
create your own monomorphic functor class, e.g.

class MFunctor f a | f -> a where
mmap :: (a -> a) -> f -> f
instance Functor f => MFunctor (f a) a where
mmap = fmap
>>
>>58420109
My Memzz isn't /wdg/ either
>>
>>58419766
>It's all because they needed their shitty backreferences and arbitrary lookahead.

But.. it's powerful!
>>
>>58418146
Ma nigga

Trying to get into COBOL. What was you source you learned from and which compiler do you use?

And what are you working on?
>>
File: C10 022 err.png (6KB, 741x169px) Image search: [Google]
C10 022 err.png
6KB, 741x169px
>>58419583
>>58419436
>>58419292
>>58419254
Tried to remake that thing with functions,
http://pastebin.com/BmmQXFYU
and now I get picrelated.
Sorry for being that stupid, but what exactly have I wrong here?
>>
if I have a for loop nested inside a for loop should the initializers be different. i.e.

for (int i = 0; i < 10; i++)
{
for( int j = 0; j < 10; j++)

>>
>>58420644
>if (isMagic(n, **eachRowIsAnArray, *thereBeSumsOfRowElements, *thereBeSumsOfColumnElements, &sumOfTopLeftToBtmRightDiagonalElements, &sumOfTopRightToBtmLeftDiagonalElements) == true) cout << "is a Magic Square :^)" << endl;
Wew wew wew, simplify your function signature, encode your problem into a struct as much as you can.
Also, you are dereferencing your arrays pointers in arguments: if matrix is of type "int **" or "int [][]", "**matrix" is equivalent to "matrix[0][0]", which is of type "int", hence the various errors.

Also, refrain from defining functions inside functions. Functions belong to the global scope (nested functions are not standard), so they should be declared outside your main. This is the cause of your problem at line 64: isMagic() is defined in the global scope, but its declaration is nowhere to be found before in the same scope.
>>
>>58420644
Don't pass pointers to isMagic, the variables you are passing are already arrays. You end up passing a pointer to a pointer, which in this situation is invalid.
>>
Can I get rec for C# learning resource?
>>
>>58420858
>Also, refrain from defining functions inside functions. Functions belong to the global scope (nested functions are not standard),

technically speaking nested functions are ok if they're lambdas
>>
alright, I want to learn C as quick as possible(so I can get out of exercises and start making stuff) but i don't want to just do learnxinyminutes, I still want to learn it somewhat in depth. Is the ANSI C book still recommended? I have basic Java knowledge from AP comp sci in high school, as well as some ruby, so I am not completely new but I am still a plebeian and want to know how to deal with real world programs before I start uni for CE in the fall.

tldr
is the ansi C book still recommended by /g/ for quick C learning?
>>
>>58420869
If you know nothing:
http://www.robmiles.com/s/CSharp-Book-2016-Rob-Miles-82.pdf

If you know something but not a whole lot:
https://www.amazon.com/dp/0985580127

If you are THE FUCKING STRONG:
https://www.amazon.com/dp/161729134X
http://msdn.microsoft.com/
>>
>>58420950
Thank you.
>>
>>58420891
>technically speaking nested functions are ok if they're lambdas
But then they're not first-order functions but callable objects. And by nested functions I meant C-style functions, in the global namespace.
>>
>>58420901
Have you read your SICP today?

https://www.youtube.com/watch?v=2Op3QLzMgSY

http://deptinfo.unice.fr/~roy/sicp.pdf

http://www.call-cc.org/
>>
File: unconditional jumps.png (229KB, 1920x1004px) Image search: [Google]
unconditional jumps.png
229KB, 1920x1004px
I just implementing unconditional jumps in my virtual machine for an architecture I came up with.
>>
>>58421026
>all of them white except 1 asian or so
hmmm
>>
>>58421031
>0xe0
Magic numbers should not be strewn about
>>
>>58421026
I was reading it but everyone here kept telling me it was a meme book and I would be better off with a shorter read then gaining real world experience.
>>
>>58421103
also lisp is a great language of old but is becoming exponentially more useless by the day.
>>
>>58421068
It's a bit pattern.
>>
In C/C++, is there a difference between the values NULL, 0 and '\0'?
>>
>>58421131
I would guess NULL is an unsigned long, 0 is a long, and '\0' is a char.
>>
I need my butthole teared open by some legitimate criticism. /g/ents.

It's a project for that meme class CS50x (I've found it pretty good so far, anyway). The objective was to take in a name and output the initials in all caps.

It works great, I need to know if the implementation is total crap: http://pastebin.com/nDAFdKa2

I tried to post on leddit and all I got was WOW REALLY GOOD. I'm a total beginner and I want to know if I'm walking in the right steps or not.
>>
this is gonna sound dumb but I need to implement a simple unit conversion library. don't want to pull an additional dependency for that.

are there any pitfalls I should be aware of? any standard for precision? (eg 5 decimals) shit needs to be accurate
>>
>>58421145
NULL is a void pointer, 0 is a long and '\0' is int.
>>
>>58421236
Also, in C++ '\0' is a char.
>>
>>58421245
And NULL is either an int or nullptr_t.
>>
>>58421117
No shit nigger, why is that your bit pattern and not something else?
>>
>>58421200
If it works, it's gud, but nevertheless, some remarks.

>char initials[] = "AAAAA";
you assume that initials could never retain more than 5 characters, yet, as the loop is programmed, initials could overflow, especially when user input is involved. Either stop the loop at 5 initials or if you want completeness, you'd rather dynamically allocate the initials buffer and reallocate it if there are more characters than it can take.
>string type
My pic is related. I'm pretty sure it's just a cast to char *, but where is the typedef? Whatever, it's a bad name for a type anyway.
>if (fullName[i] == SPACE)
You include <ctype.h> and you don't use the very useful isspace(), which doesn't only catch spaces, but also tabs. What a waste.
>>
>>58421200
 if (space_before) {
initials[cur_initial] = fullName[i];
space_before = false;
cur_initial++;
}

Does that code ever get ran? I don't see how space_before gets set to true, because it looks like space_before only gets set to true in a mutually exclusive if
>>
>>58421514
Nevermind, I think I got it. You're not checking for a space and proceeding letter so it's throwing me off.
>>
>>58421454
If you had docs on the arch(something i haven't made yet), you would know that's andng the argument part of the instruction with 11100000, which maskes all but the first register argument, then using it bit shifted as an index for an array.
>>
>>58421468
Thanks a ton.

>dynamically allocate the initials buffer and reallocate if there are more characters than it can take

Yes, I would. But I have no idea how. I will do more reading on this.

The 'string' type is included in the cs50.h (some pre-made definition for the class because we haven't learned how to make them yet, or whatever).

I didn't realize isspace was a thing. Whoops. Again, thanks for that.
>>
>>58421514
Yeah, I was. This is where I was especially curious--if that was a good idea or total garbage. The idea was to check to see if it was the first letter of a "word" passed by the user. You're supposed to take into account possible leading spaces, so I thought a switch would make sense.
>>
https://blog.flameeyes.eu/2008/06/debunking-ccache-myths/

is ccache really this retarded? it's useless even if i change just 1 character in a source file?
>>
>>58420858 >>58420860 thanks guys, it's slowly dawning on me

>>58420858
>Also, you are dereferencing your arrays pointers in arguments: if matrix is of type "int **" or "int [][]", "**matrix" is equivalent to "matrix[0][0]", which is of type "int", hence the various errors.
>which is of type "int"
still, I don't quite get what you mean by this

>>58420860
>Don't pass pointers to isMagic, the variables you are passing are already arrays. You end up passing a pointer to a pointer, which in this situation is invalid.
and also this

so what would be the correct syntax to pass my arrays?

as for
>problem at line 64
I wouldn't agree it was because I had isMagic defined inside main, it disappeared, along with line 109 error, when I fixed the missing closing bracket after line 19, and also thanks for noting my silly variable and function names, which are not the core problem here, but good style never hurts, thanks for reminding
>>
>>58421731
>Note: If you're instead conducting incremental builds (such as an individual developer rather than a build server), ccache may slow your builds down by making you pay for cache misses.
>>
I'm working on a chess game in C++. What would you say is he best approach.

32 pieces with coordinates assigned to them.
64 positions with pieces assigned to them.

The second option is less efficient in terms of memory management, but the first option runs into quite some difficties with implementing the rules of the game in terms of calculating possible moves.
>>
>>58421200
#include <stdio.h>
#include <string.h>
#include <ctype.h>

int main(void) {
char name[] = "james bond";
char *c = strtok(name, " ");

while (c) {
putchar(toupper(*c));
c = strtok(NULL, " ");
}

puts("");

return 0;
}

:3
>>
>>58421864
64 positions with pieces assigned to them is just so much easier

are you going to write an AI too, you should
i made an antichess AI in C
>>
>>58421200
fuck off, plebbitor
>>
>>58421864
>The second option is less efficient in terms of memory management,
oh no 2KB extra
>>
why cant 99,5% of programming job applicants program their way out of a wet paper bag?
>>
File: 1444437391539.gif (2MB, 250x200px) Image search: [Google]
1444437391539.gif
2MB, 250x200px
It shouldn't work, but it does.
>>
>>58421911
Its supposed to be an exercise, so I'm trying to consider all options and their implications.
>>
>>58421200
kok
#include <stdio.h>
#include <string.h>

int main(int argc, char **argv)
{
if (argc == 2)
{
printf("%c.", argv[1][0]);
for (int i = 0; i < strlen(argv[1]) && argv[1][i] != '\0'; ++i)
if (argv[1][i] == ' ')
printf("%c.", argv[1][i + 1]);
}

if (argc > 2)
for (int i = 1; i < argc; ++i)
printf("%c.", argv[i][0]);
printf("\n");

return 0;
}
>>
>>58421846
You might not know but [] is the same thing as *. In other words, arrays are pointers and vice versa.

Your function isMagic needs the following argument types: int, int **, int*, int*, int &, int&.

In line 43, you're trying to give it the following: int, int **** (eachRowIsAnArray is already a int **, and you're adding two dereferences here, making it into a int ****), int **, int ** (same deal as before), int &, int&. Just get rid of the extra asterisks.
>>
>>58421914
because most people are retarded normies
>>
>>58421939
>arrays are pointers and vice versa
Don't do this
>>
>>58421960

but normies have an iq of 100 by definition
>>
>>58421989
a 100 IQ is pretty stupid in my book, you'd have to get a lot of questions wrong on an IQ test
>>
>>58421914
>,
Because they're european.
>>
>>58421977
Don't do what? They functionally are. You can even take advantage of this and address elements of an array by array[index] or index[array].
>>
>>58422009

you got me
>>
>>58421200
>I tried to post on leddit
So you are a literal redditor? You really should fuck off back to your shithole.
>>
>>58422013
>They functionally are
not with strict aliasing
>>
>>58422020
no god damn it was the suggested forum for the class and I was reminded how bad it was when I posted
>>
>>58421936
oh shit you are on to something here
this little snippet is more educational than anything
thanks familia
>>
I am learning c# and i wonder if it's possible in Visual Studio to put all small, shitty programs into one project (for example, array example and for loop example are in one project, even though they are 2 different programs)

That way i could have one project with countless small programs instead of shitting my my Recent projects list with shitload of 3-line programs
>>
>>58422113
But you just admitted to posting there which means you are a literal plebbitor. Post some anime images if you really aren't one and posted there in some kind of altered state of mind.
>>
there is literally nothing wrong with using reddit
>>
>>58422171
Create a solution and add projects to it, that's all you need to do.
>>
>>58421846
>>which is of type "int"
>still, I don't quite get what you mean by this
"int a[10]" is an array of 10 ints.
"a" is actually a pointer to "a[0]", "a" is of type "int *".
Then "*a" is actually "a[0]", so what is the type of both "*a" and "a[0]"?

>so what would be the correct syntax to pass my arrays?
Don't dereference your arrays, they will be automatically converted (aka decay) to pointers when passed to functions.
>>
>>58421939
I'm aware that roughly speaking pointers are arrays, strictly speaking they're not, but this kinda doesn't help much here. And I don't get what you meany by dereferences.

Just tell what my line 43 should look like

if (isMagic(n, eachRowIsAnArray, thereBeSumsOfRowElements, thereBeSumsOfColumnElements, &sumOfTopLeftToBtmRightDiagonalElements, &sumOfTopRightToBtmLeftDiagonalElements) == true) cout << "is a Magic Square :^)" << endl;

if (isMagic(n, *eachRowIsAnArray, *thereBeSumsOfRowElements, *thereBeSumsOfColumnElements, &sumOfTopLeftToBtmRightDiagonalElements, &sumOfTopRightToBtmLeftDiagonalElements) == true) cout << "is a Magic Square :^)" << endl;

if (isMagic(n, *eachRowIsAnArray, thereBeSumsOfRowElements, thereBeSumsOfColumnElements, &sumOfTopLeftToBtmRightDiagonalElements, &sumOfTopRightToBtmLeftDiagonalElements) == true) cout << "is a Magic Square :^)" << endl;

Neither of this would compile or seem anywhere legit to me
>>
>>58422215
I see, i add 2 projects to 1 solution and there i can choose which one to start, ok

Are those 2 projects connected in any way?
>>
>>58422171
Just throw all the cs files into a singular project and throw an interface on top
I did that with Eulers Project. Every problem is its own class file and I have a cli interface that I just type the problem number into to run.

That uses reflection so I don't have to hardcode anything into it but the idea is the same
>>
File: 1484055280120.jpg (49KB, 736x691px) Image search: [Google]
1484055280120.jpg
49KB, 736x691px
>>58422176
UH UH UH
???
>>
>>58422232
>Don't dereference your arrays

ah, so like this, rly?
if (isMagic(n, &eachRowIsAnArray, &thereBeSumsOfRowElements, &thereBeSumsOfColumnElements, &sumOfTopLeftToBtmRightDiagonalElements, &sumOfTopRightToBtmLeftDiagonalElements) == true) cout << "is a Magic Square :^)" << endl;
>>
>>58422249
No. It's just a way to store multiple project files in one solution, quite handy when you have unit tests or are using class libraries.
>>
>>58422260
Isn't it easier to just make a Solution and then just do "Add project" to it? Those projects are not shown in Recent list as i can see
>>
Do you think programming will look a lot different in 50 years?
>>
>>58422306
It depends on what you're after. If you just want all the files available then yes. If you want to only deal with a single entry point and choose what to run, then no.
>>
>>58422306
That depends how many you have. If you would have like 100+ projects then Visual Studio will be slow as hell.
>>
>>58422301
Ok thanks. So you can call Methods and make bjects in classes only in the same Project, you can call anything from other project even if it's in the same solution?
>>
>>58422328
depends on if science and researc get funding in the future
>>
>>58422171
If you're really just stacking single-method program, you could do what I do:

Create a "ScratchPad" project or whatever you want to call it, and just keep adding static methods in your Program.cs file. Just change which one you call in Main whenever you want to run something.

If you get a stack of methods that are all related, just break out another .cs file and class for those methods and just make them all public/static and you can access them from your Main method with ClassName.MethodName(); whenever you want to test them.
>>
Where do I start to learn how to be the guy in Mr. Robot?
>>
I made this program for emulating a 7-segment display. Sample output:
Enter numbers (max. 10): 3,14159265
10 characters read.
____________________________________________
| _ _ _ _ _ _ |
| _| | |_| | |_ |_| _| |_ |_ |
| _| , | | | _| _| |_ |_| _| |
|__________________________________________|

Stop (y/n)?: y
Stopping.

------------------
(program exited with code: 0)


How should I improve the code to be more polished? I have been thinking to create a GitHub account and upload the code there.
Current code: http://pastebin.com/Svq3kcQA
>>
>>58422368
Make working clock out of it?
>>
>>58422264
>that filename
Yup, plebbitor confirmed. Remove yourself from the premises.
>>
File: anal beads.png (56KB, 437x1481px) Image search: [Google]
anal beads.png
56KB, 437x1481px
>>58422347
Pic related
>>58422171
>>
>>58422328
Recalling a Google talk about programming in the 60's and debugging by putting in commands that would sound a bell every so often so you knew what step your code had reached, I would say probably not.
>>
>>58422377
i've been posting on 4chan for 10 years and I don't have a single anime picture on my pc
>>
>>58421939
>>58422232
>>58422235
>>58422281

or this?
if (isMagic(n, &**eachRowIsAnArray, &*thereBeSumsOfRowElements, &*thereBeSumsOfColumnElements, &sumOfTopLeftToBtmRightDiagonalElements, &sumOfTopRightToBtmLeftDiagonalElements) == true) cout << "is a Magic Square :^)" << endl;[/code]
well this gives me "cannot declare pointer to 'int&' "
>>
>>58422368
You should be able to display the decimal point in the same 'seven-segment' display as a digit. Now you have eight 'segments'.
Now you should cram all the segment on/off bools into one byte. Premature optimisation is the best: join the pre-op community.
>>
>>58422389
But what if i work on all numerical problems for example and i often get to name variables int number = 0; for example, maybe it would be better to make new class with method in it for every new problem
>>
>>58421898
Link?

I want to make a chess AI, where do I start?
>>
>>58422409
then you simply can't post an anime picture with a new filename? What's the deal here?
>>
>>58422427
You're declaring that at class-level and then using it in multiple methods?

Generally speaking, you shouldn't have to do this too much, but if you need constants that are only relevant to a subset of methods, then yeah, you'll have to organize that into classes.

Keep in mind that something simple that can change really ought to be passed to the method as a parameter; you don't have to split 10 lines of something simple out into three 4-line methods all using a class-level constant.

I'd have to see some examples of what you're writing, I guess.
>>
>>58422377
>literally saved the image from /a/
wot
>>
Kind of a very stupid and unrelated question but are course names like CMPE150 universal or college specific?
>>
>>58422456
come on, are you like 12? is posting an anime picture some kind of an ultimate plebbitor test? why are you hazing that guy and making him jump through some retarded hoops?

i don't see what's so wrong with an occasional post on reddit. the place is very legit for certain kinds of questions, and for marketing purposes. similar to 4chan, really
>>
>>58422471
>didn't change the filename to something meaningful to you in relation to why you downloaded that particular image
>>
>>58422452
alpha-beta search algorithm
>>
>>58422480
College-specific, but many colleges will post a list of equivalents from likely sister and transfer universities.

You'll need to talk to your advisor/dean about the class and whether it counts for a transfer credit.

"CMPE150" is completely different at different schools.

Also, >>>/g/sqt
>>
I need to come up with a good idea for my capstone, I'm not very creative.

two ideas I kinda like so far
1. ANN to play checkers or something? maybe? or read words?
2. - Instant messaging with full public key crypto and groups, such that the content of messages cannot be discovered by anybody other than the participants

any other cool ideas would be appreciated thank you, it's my last semester so i really want to go all out on this project?
>>
>>58422486
No hoops jumping, I thought he was kidding, I did it as a joke.
What am I going to do, stop posting because an anon said I couldn't post here?
I don't think he's serious
>>
n = 10
for i in range(n):
if i % 2 == 0:
print(i, end = ' ' )


why doesn't it print 2 4 6 8 10?
10 is dividable by 2 too.
>>
>>58422530
a kernel or an OS
>>
>>58422553
I don't know what language this is, but I assume it is up to 10, so 0 through 9, yeah?
>>
>>58422553
for i in range(10) means
0123456789 up to but not including 10
>>
>>58422553
Because it iterates from 0 through 9, 10 is not inclusive.
>>
>>58422576
oh okay thanks, I thought it meant everything dividable by 2 including 10

>>58422568
python
>>
>>58422471
yeah, which means you are a literal redditor who just got off the boat.
>>58422486
>a plebbior trying this hard to justify his mental illness
fuck off, matey
>>
Reminder that Reddit respects your freedom whereas 4chan does not so there's nothing wrong with Reddit.
>>
>>58421200
>>58422486
>real plebbitors not even trying to deny their true nature
Has this thread really become this much of a subreddit?
>>
>>58422604
>building an identity based on what websites you visit
>calling others mentally ill
>>
why cant we ban those two autists arguing about things noone cares about?
>>
>>58422624
Why can't we make a new thread?
>>
>>58422604
holy shit, you are serious? or are you just under several layers of irony son?
>>
>>58422617
I don't want reddit stink nearby. Fuck off.
>>58422636
Why do you keep denying being a redditor?
>>
New thread:

>>58422652
>>58422652
>>58422652
>>
>>58422650
i see two guys are already fucking you
as they should
>>
>>58422650
>juvenile tribalism
>>
>>58422667
I don't think this helps, just ignore the babby crying for attention and proceed?
>>
>>58422671
Stop trying to justify your mental illness
>>58422672
Please don't reproduce
>>
>>58421200
original 'redditor' here,
didn't realize this guy was going to get so crazy, sorry for causing the thread derailment
thanks for the help to the folks who helped me out, anyway. it was the constructive criticism I was looking for
>>
>>58422693
>spergs out because somebody visits a website he doesn't like
>literal meltdown
>calls others mentally ill
>>
>>58422714
>''
why do you deny being a redditor? You literally said you post on that website
>>58422717
woww! amazing! upvoted!!!
>>
>>58422688
We're 350 posts in on page 6, you dumb faggot.
>>
Working on an android app that tracks your location constantly.
What would be the best way to store location data? I thought about using an SQLite database with columns for time, latitude and longitude, but after a while it sounds like it would slow down due to the massive number of entries. Alternatively I could just save to a binary file format of my own creation, but that sounds like it would be more error-prone. What do you think /g/?
>>
>>58423363
>after a while it sounds like it would slow down due to the massive number of entries
Why do you think this? That's literally what OLTP databases are for.

Consider something like Kafka between your application and database.

Also, migrate to the new thread, dingus.
Thread posts: 360
Thread images: 35


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