[ 3 / biz / cgl / ck / diy / fa / g / ic / jp / lit / sci / tg / vr / vt ] [ index / top / reports / report a bug ] [ 4plebs / archived.moe / rbt ]

/vt/ is now archived.Become a Patron!

/g/ - Technology

View post   

[ Toggle deleted replies ]
File: 1.31 MB, 1000x1400, 1467387907257.png [View same] [iqdb] [saucenao] [google] [report]
56778372 No.56778372 [Reply] [Original] [archived.moe] [rbt]

Old thread: >>56769519

What are you working on, /g/?

>> No.56778404


>> No.56778448

Sketching out a rough ERP app in Elm. Got the rhythm of Elm down now, pages are flowing out now. Was refactoring earlier, was super easy & bug free thanks to the awesome compiler.

>> No.56778486

Stop fucking shilling Elm everywhere

>> No.56778550

Will having knowledge in C++ give me a decent job?

>> No.56778558
File: 603 KB, 412x273, BEAUTIFUL FLICKERY BOIDS.gif [View same] [iqdb] [saucenao] [google] [report]

BGI is truly garbage, but these are still my beautiful boids.

>> No.56778584

make the boids smaller and add attractors and obstacles

>> No.56778587
File: 1.96 MB, 640x480, cake2.webm [View same] [iqdb] [saucenao] [google] [report]

/dpt/-chan, daisuki~

Ask your much beloved programming literate anything (IAMA).


Thank your for using an anime image.

>> No.56778606

>programming literate
>responds to only two posts
Nice try, imposter

>> No.56778629


Maybe when I rewrite it to use something that's not BGI.

>> No.56778638
File: 46 KB, 623x623, racket.png [View same] [iqdb] [saucenao] [google] [report]

>tfw comfy

>> No.56778652


what is the easiest way to make a grayscale png image in C

>> No.56778690

Use system() to call a python script.

>> No.56778697

How do I get good at C++?
I'm fairly competent in Java, and have messed around in C. I tried making a Deque class in C++, and get all kinds of errors. And every time I get rid of one error, another one shows up.
Using a template seems to mess everything up for me, right now working on undefined references to all my functions.

>> No.56778700

what in the fucking hell are you doing? you don't know any math? can you not transform all of that to a few lines of code?

$ A="119373-33"; [[ "$A" =~ ([0-9]{6})-([0-9]{2}) ]] && echo ${BASH_REMATCH[1]} && echo ${BASH_REMATCH[2]}

>> No.56778728

the bash stuff was for >>56774554 ...

>> No.56778754

Nice regular expression, faggot.

>> No.56778772

why are anime faggots so gay?


>> No.56778836

t reddit

>> No.56778849
File: 24 KB, 300x392, designpatterns.png [View same] [iqdb] [saucenao] [google] [report]

I'm sorry, but you need to read more than just a book to get good at such a programming language. Read Design Patterns, pic related

Check out the following video for a summary on C++ (Derek Banas also is on envato.com, so if you install their plugin you can browse his videos easier; overall an awesome youtuber)

Finally you should watch this video on modern C++ if you want to develop on C++11

>> No.56778881
File: 183 KB, 500x502, fälla6.jpg [View same] [iqdb] [saucenao] [google] [report]

>people still fall for the C++-meme
Literally useless language unless you want to do games (even games industry are abandoning it slowly) and algorithmic trading

>> No.56778888

read accelerated c++ then effective c++ and guru of the week

>> No.56778910

Non-C languages are developed and designed in order to generate income for their creators by being so fucking complex that they require 1000 page books, conventions and vendor support packages.

>> No.56778919

Design patterns is invented to solve problems inherent to "C with classes" languages

>> No.56778960

wrong. it was made first for smalltalk, a language that never had anything to do with c.

>> No.56778965

>x is invented to solve problems

By golly, that's something!

>> No.56779014

The original book mentions both C++ and smalltalk, and smalltalk is of course an imperative OO language.

What a stupid remark.
As expected from someone trying to defend design patterns.

>> No.56779141

FYI, design patterns originated from the smalltalk programming scene at the end of the 80's.

>and smalltalk is of course an imperative OO language.
>imperative OO language = C with classes
k tard.

>> No.56779144

>What a stupid remark.

No, you.

>> No.56779165

You could just not have those problems, but no, there's gotta be some reason you're buying the snake oil, right?

>> No.56779170

the design patterns in the book have become part of development jargon, so it's useful to read regardless. my mom's dating a guy with 2 mentally handicapped children and they're being super fucking loud downstairs right now. the dad's making fart nosies and they're going apeshit laughing

>> No.56779193


We should all just use functional programming languages!

>> No.56779194


>> No.56779204

C or Rust ?

>> No.56779214

>>imperative OO language = C with classes
C with classes describes C++, Java, C# and a few other languages and parts of languages like F#, Rust, etc.

Imperative OO and C with classes overlap significantly, the latter being almost a subset of the former.

If you just didn't use these languages, you would be much better off.

Yeah, because if it's not C with classes then it must be a functional language, right?
You idiot, you don't actually know anything about programming outside of your tiny little bubble

>> No.56779227


>> No.56779238


>> No.56779242

>Yeah, because if it's not C with classes then it must be a functional language, right?

Yes, that's correct. You couldn't POSSIBLY be advocating for people to use pure imperative languages like C in this current year.

>> No.56779262

What are the downsides of Haskell?
Is it really the future of programming or just a phase?

>> No.56779275

why did you guys let a faggot hijack your general and make the new thread every time?

>> No.56779284

A modern imperative language that isn't fucking based on C would be nice, but other than that, there's a wide variety of forms of programming that aren't just "C with classes".

Logic programming, visual programming, query languages like SQL, stuff like excel, etc.

Performance, code size, memory usage, undefined :: a, built-in exceptions (although not used)

>> No.56779298


Oh, and GC

>> No.56779311

Load your PNG with a library like libpng or stb's png functions and use a formula you could tweak with the RGB channels. IIRC usually R is enough to make a decent grayscale, but if you want something a little bit fancy, here's a formula directly stolen from HDMI standard stuff :

L = 0.2126*red + 0.7152*green + 0.0722 *blue

Have fun

>> No.56779321

i think the anime girls are cute so i allow it. except the one doing the backflip with the hat. that one looks ugly

>> No.56779324

>What are the downsides of Haskell?
Having to tie both arms behind your back for some nebulous sense of purity.

>> No.56779334

That isn't remotely true

>> No.56779356

>Logic programming, visual programming, query languages like SQL, stuff like excel, etc.

Get the fuck out.

>> No.56779358

No one will employ you if you just know meme languages.

>> No.56779367


>> No.56779368

Wait, isn't the reduced code size while being just as fast main argument for Haskell?
My Haskell classes are starting in a week and FP seems really interesting but anytime someone talks about Haskell it's nonstop praising and can't get really annoying.

>> No.56779371
File: 11 KB, 1002x509, cross.png [View same] [iqdb] [saucenao] [google] [report]

well then

>> No.56779397
File: 127 KB, 1148x1149, confused-face-clipart-kAEQW6-clipart.jpg [View same] [iqdb] [saucenao] [google] [report]

Does anyone here have a real job?

Do you have linked in? Should i have one?

>> No.56779400

The source code is a lot smaller, but if you start inlining or specialising things then the executable size will get big quickly

It's a very nice language, it's just not a very performant or efficient one

>> No.56779403


So basically what I said. If you want work, you're MOST LIKELY going to be using an OOP language, followed by general imperative languages, followed by functional languages.

The remainder are not typically used for general purpose programming.

>> No.56779423

LinkedIn is annoying, you get bothered by headhunters all the time and they won't stop messaging/calling you.

>> No.56779453

Completely wrong. I literally got hired because I knew a bunch of languages (including Haskell and OCaml).

>> No.56779471

Because people like you keep fucking using this argument

>> No.56779483

Is there any purpose for OOP languages? Everything seems to use functional or C these days.

>> No.56779502

Most "OOP" languages are 80% C anyway

>take good language
>add methods
>it's now OOP

>> No.56779514


Because it works. That's why people continue voting Democrat or Republican.

(Sidebar: Don't forget to make America great again this November)

>> No.56779526

i'm confused on this, learning about regular languages in class and i'm confused on union. i know it's analogous to the logical "or". but is the language is (b u a), is ba a member of the language? or is it just b and a? is it basically an exclusive or?

>> No.56779551

Anyone can be a programmer in India

>> No.56779564
File: 8 KB, 807x159, c74219f9645ac5ab5addd719ef4d2254.png [View same] [iqdb] [saucenao] [google] [report]

Trying to get around the restrictions of a constexpr, no luck so far. Normal consts are no problem. Any tips?

>> No.56779584

>Because it works
It doesn't and that's why design patterns exist
It's like a bandage for a corpse

>> No.56779591

>Trying to get around the restrictions

>> No.56779604

You can't and if you could it would break the compiler and likely your code

You are literally saying "I want to turn this value that only exists at runtime into a compiletime value"

>> No.56779607

Why not, I guess I'm just curious to see whether it's possible or not.

>> No.56779656

I do and I do. Actually helps, I have to believe.

>> No.56779688
File: 2.98 MB, 684x385, testover.webm [View same] [iqdb] [saucenao] [google] [report]

>A modern imperative language that isn't fucking based on C would be nice

There are plenty of modern imperative languages not based on C


and many others

>> No.56779693

I suppose you mean L1 = {a} and L2 = {b}, then L3 = L1 ∪ L2 = {a, b}. Languages are just sets of words, which in turn are finite sequences. ∪ is the operation of set union.

>> No.56779719

>even games industry are abandoning it slowly
[citation needed]

>> No.56779739

I am a .NET Developer..I work for a pretty big company and they liked that I linked my linkedin on my resume. I had projects that I had done on there. YMMV

>> No.56779741

i think it's a little different in this book i'm reading. it's intro to theory of computation. they price gouged me for it too

>> No.56779756

No, they're not. Being in control of memory and performance is must when developing for things as varied as a high-end computer to wii, or cellphone.

>> No.56779760

>I am a .NET Developer..I work for a pretty big company

can you describe what a typical day looks like?

>> No.56779773

no u dumb cunt learn a modern language lik fortran or lisp

>> No.56779797


Sipser? Coincidentally, I have the book right beside me. Which page is it? I'm fairly certain the formalism is same everywhere, tho. Unless you're starting from a very different foundation, such as category theory, type theory or lambda calculus.

>> No.56779805

This is true. I use that a lot in my work with AI and machine learning.

>> No.56779810
File: 481 KB, 158x281, 1474826974739.gif [View same] [iqdb] [saucenao] [google] [report]


>> No.56779816

yeah it's sipser. and i thought you were saying ab would be a member, but no i think {a, b} is right

>> No.56779828

Yes, if you're good. And you'll make a lot of money too.
If you want job security you could always become one of those pretend-programmers, doing web code or java applications.

>> No.56779848

>Yes, if you're good. And you'll make a lot of money too.

what if there are no C++ programming jobs in your area / country?

>> No.56779856
File: 11 KB, 257x546, Capture.png [View same] [iqdb] [saucenao] [google] [report]

Trying to figure out Mathematica's TuringMachine function. This set of transition rules corresponds to the 1000th item in the canonical enumeration of all transition rules for some reason.

Also going to throw this out there. Not sure how long WolframCloud holds onto notebook files created anonymously though.

>> No.56779870
File: 30 KB, 985x599, faggot.png [View same] [iqdb] [saucenao] [google] [report]


>> No.56779877

Is there a programming language that uses 'whilst' instead of 'while', I die inside when I have to type 'while' in place of 'whilst'.

>> No.56779878

That makes more sense.

>> No.56779908

#define while whilst

>> No.56779913

there is no while loop built in to Haskell, but you could easily define it as a library function called whilst:

whilst :: Monad m => m Bool -> m a -> m ()
whilst mb act = do
b <- mb
when b $ do
whilst mb act

>> No.56779930



>> No.56779938

option 1. Move to an area where there are jobs. (just like you would with any other job)
option 2. Create the job.
option 3. Settle with something else.
option 4. Take low skill job, automation displaces you in a couple of years, an hero.

>> No.56779940
File: 786 KB, 1000x1300, haskell.png [View same] [iqdb] [saucenao] [google] [report]

>falling for the while-loop jew

>> No.56779947

If you're using monadloops

whilst = whileM

>> No.56779959
File: 10 KB, 217x197, [MFC] Pink haired Pirate - Lana Rain.mp4_snapshot_01.36.28_[2016.06.22_15.42.43].jpg [View same] [iqdb] [saucenao] [google] [report]

>tfw creating automatons that replace low-skilled people all day long

>> No.56779979

Same with the codestandard I have to follow when passing arguments.
~a prefix. It works well half the time, aPosition, aRotation ex. But damn my gears grind harshly when I type: aObject, or aElephant.

>> No.56780003

Is there a image library for C like PIL for python?

PIL - The Python Imaging Library.

is there something like this for C?

>> No.56780020
File: 29 KB, 200x200, 1474202730675.png [View same] [iqdb] [saucenao] [google] [report]

holy shit that's horrible

>> No.56780041


>> No.56780072

Why would you do that to yourself

>> No.56780097

i just want a library to read images,do cool stuff with them and write to a new image

>> No.56780098

If I have a map that stores object pointers, upon calling clear will all the objects being pointed to be destroyed? Or do I have to iterate?

>> No.56780123
File: 882 KB, 687x699, Capture.png [View same] [iqdb] [saucenao] [google] [report]

Who else /adderall/ here
Programming has never been so much fun

>> No.56780133


What language?

>> No.56780154

Cool stuff like what?

>> No.56780160

the objects (here pointers) are destroyed, the memory they point to are not.

The container can't just free everything, because it might contain invalid pointers.

>> No.56780161

waht you mean

you cant program for shit, but if you take addy suddenly you're a programming god?

>> No.56780170


>> No.56780171

i dunno, create effects, rotate, distort , etc

whatever you want to do

>> No.56780172

why do some C programmers define
do {
bla bla
bla bla
} while (0);

macros? i know it runs it once and in a ""new scope"", is that the only reason?

>> No.56780175

Fuck no
It just gives you the ability to sit down and program for like 8 hours straight and write code that follows a methodical completely logical path and it makes you feel good while you do it
It doesn't improve your ability, it just makes you make prettier code and lets you work longer at making said pretty code

>> No.56780182
File: 1.15 MB, 800x442, 9cd91c14bce7d22131ef55f9b9dae235.gif [View same] [iqdb] [saucenao] [google] [report]

Streaming 3D assets from the hard drive through a thread pool in DX11. It's working surprisingly well. (they won't pop as hard when I increase the streamInRadius)

>> No.56780195

It helps grouping multiple statements into a single one, so that a function-like macro can actually be used as a function.

>> No.56780201

If this is what I think it is (models start loading way at the back where the cubes come from), why are they taking so long to load?

>> No.56780209

you could just do, right?
bla bla
bla bla

>> No.56780214

fat anime boobies...

>> No.56780230


>> No.56780248

safest way to make macros.

having a macro like that would break when used like this.
if (...)

>> No.56780249
File: 2.09 MB, 360x360, flow.gif [View same] [iqdb] [saucenao] [google] [report]

At the risk of sounding like a shill you should check out Mathematica

>> No.56780259
File: 867 KB, 480x336, 1474603442575.gif [View same] [iqdb] [saucenao] [google] [report]

assembly today
;00401000 /$ 55 PUSH EBP
;00401001 |. 89E5 MOV EBP,ESP
;00401003 |. 81EC 00040000 SUB ESP,400
;00401009 |. 53 PUSH EBX
;0040100A |. 68 45804000 PUSH virEP.00408045 ; ASCII "APPDATA"
;0040100F |. E8 7C000000 CALL virEP.00401090 ; call GetEnv
;00401014 |. 59 POP ECX
;00401015 |. 50 PUSH EAX ; /Arg4
;00401016 |. 68 09804000 PUSH virEP.00408009 ; |Arg3 = 00408009 ASCII "%s\Microsoft\Windows\Start Menu\Programs\Startup\myfile.txt"
;0040101B |. 68 00040000 PUSH 400 ; |Arg2 = 00000400
;00401020 |. 8D85 00FCFFFF LEA EAX,DWORD PTR SS:[EBP-400] ; |
;00401026 |. 50 PUSH EAX ; |Arg1
;00401027 |. E8 F4000000 CALL virEP.00401120 ;calll snprintf ; \virEP.00401120
;0040102C |. 83C4 10 ADD ESP,10
;0040102F |. 8D85 00FCFFFF LEA EAX,DWORD PTR SS:[EBP-400]
;00401035 |. 50 PUSH EAX ; /Path
;00401036 |. FF15 08A14000 CALL DWORD PTR DS:[<&SHLWAPI.PathFileExi>; \PathFileExistsA

>> No.56780294

>Assembly on Windows
You are a brave soul

>> No.56780296

The cubes are only for reference.
I've set the spawn radius (or start stream radius) really close so I can see them popping way better.
Also, the models are stored in a flyweight pattern so I could have loads of models and still have relatively good framerate.

>> No.56780349

>No pop ebp

Rajeesh this is your last warning. Next time you're fired.

>> No.56780392
File: 119 KB, 706x834, 1474565057529.jpg [View same] [iqdb] [saucenao] [google] [report]

I'm writing a cryptolocker variant in assembly by first writing each component in C, disassembling, then re-writing in assembly.


mov eax,927C0h ; 10 mins
call Sleep
xor eax,eax
mov eax,00000002h ; EWX_REBOOT
mov ebx,00050000h ; SHTDN_REASON_MAJOR_SYSTEM
call ExitWindowsEx
add esp,4

end rebootnoreason

>> No.56780415
File: 36 KB, 473x329, how very eggy of you.png [View same] [iqdb] [saucenao] [google] [report]

Are there any guides out there for good design of text-based user interfaces?

>> No.56780420

to make it flashier (OMG HE WROTE IT IN ASSEMBLY!!!1) so you can make more money from hf goyim?

>> No.56780434

There's a certain point where going low-level flips from being laughable to respectable
good job

>> No.56780458
File: 57 KB, 650x487, 1474247390827.jpg [View same] [iqdb] [saucenao] [google] [report]

No, because I'm a loser with too much time on his hands.

>> No.56780464

while(std::cin >> n){
/* Do things with n*/
Is still viable. Though yes, there are many misuses with it.

>> No.56780493

The pointers will be destroyed. Not the objects themselves. You could map to a wrapper that has that in the destructor if needed.

>> No.56780541

Or I guess, a map class that does that for you.

>> No.56780570

Are there really people who are mentally deficient and cannot focus on one thing for several hours without being heavily medicated?

>> No.56780577
File: 25 KB, 918x386, 1b70cf52e16f9af4c687e723f31ec5a6.png [View same] [iqdb] [saucenao] [google] [report]

I recently made a super neat function that fixes that for you. Just slap it in your utilities folder or stdafx.

>> No.56780580
File: 8 KB, 323x241, 1473486843910.jpg [View same] [iqdb] [saucenao] [google] [report]

Yes, it's called ADHD and it's why I have an adderall prescription

>> No.56780614

You probably don't even have real ADHD.

>> No.56780623

Use range-based for loops.

>> No.56780643

I would find it literally impossible to focus on anything for longer than 15 minutes, and I would find myself doing something else (wasting time, browsing 4chin, etc) and I literally wouldn't even remember when I stopped doing the thing and when I flipped over.

That is, of course, unless I was doing the thing that caught my fancy at that time, the thing I was obsessing on (a project, for instance) in which case I'd work on said project for 20 hours a day and often forget to eat

I'm like the textbook definition of someone with ADHD bruv

>> No.56780676

This still doesn't convince me.
All you've told me is you don't like doing things that bore you.

>> No.56780699

adhd is an invention from the usa to legitimately give drugs to their kids to produce a army of consumer zombies.

>> No.56780706

Sure is a good thing that I don't have to convince you

If you can't see the difference between not wanting to do something and being literally incapable of focusing on that thing, I'm not sure what to tell you. It's a disorder for a reason. I assumed it was normal for years, until I mentioned my issue to my friends (Hey guys doesn't it suck when XYZ focus thing happens) and they literally didn't know what I was talking about

>> No.56780722

why would you call std::map::erase over all elements when you could just call std::map::clear once?

>> No.56780725

Same reason I'm generally against ternary operators, the syntax is weird.

>> No.56780730

you don't have ADHD you faggot

>> No.56780744

That only empties the map.
If it's filled with dynamically allocated objects they'll leak.

>> No.56780748

He uses the iterator itself in the body

>> No.56780755

You don't have ADHD, you dumb medicated kid.

>> No.56780771

I sure do love /dpt/s in-depth discussions of programming and the illigitimacy of the jewish medical system
Let's get back on topic

what is this for?

>> No.56780809

Not really seeing how this removes anything but the pointers, not what they point to.

>> No.56780827

nootropics are tools for programming, as keyboards are

>> No.56780914

drugs are not programming related
take your degenerate shit to /b/

>> No.56780928

programming is a drug

>> No.56780942

programming is a tool, not a means to an end

>> No.56780946



>> No.56780956

You're a tool

>> No.56780973

do you ever get so lost in music that you drop all productivity?

>> No.56780979

Someone really needs to make a new Haskell thread on /λ/

>> No.56780994

derp, I'll throw in a "delete itr->second;" before the "map.erase(itr);"

>> No.56781009

i can't listen to music while programming
either i listen to the music and stop typing or keep typing and completely ignore the music

>> No.56781012

or you could just be using unique_ptr's in the first place and just call clear

>> No.56781039

Quick java question
if I have an array of Objects (Let's say cars), Cars[] and there's a number of classes that inherit from Car (Ford, Bugatti, etc), and Cars[] is filled with these inherited objects, how could I extract an object from the array and typecast it correctly?

>> No.56781042

>nootropics are tools for programming

Drugs are tools for degeneracy.

>> No.56781142

Why isn't vala more popular? Easy C# compiling to native code.

>> No.56781174


- too late
- gnu
- no tools
- based on gobject
- bad perfs
- c# also compiles to native code

>> No.56781192


I think it's pretty cool, 2bh.

>> No.56781198

So you're downcasting? That's not good...

I believe you would need to check with something like instanceof

>> No.56781215

I'm not sure how else I'd do it in this case other than grouping all the different functionalities of all the objects into a single object, which is also bad.

>> No.56781224

I'm writing a program that iterates through the pixels in an image, but it takes too much time
if for example the image has 200x200 (40000 iterations) or more.
for (i = 0; i < image_width; i++)
for (j = 0; j < image_height; j++)
image[i][j] = do_stuff();

is there a fastest approach to his?

>> No.56781236

Yea, I should really get into the habit of using smart pointers. But now that I think of it, aren't they just a template class?
...in which case I'll try making my own.

>> No.56781242


>> No.56781250

>- c# also compiles to native code
Well, at runtime, but that's not what I meant.

>> No.56781266

this is an embarrassingly parallel problem
spawn some threads and give each of them a part of the image to process.

>> No.56781267

>- c# also compiles to native code
That's only for Windows 10 exclusive apps

>> No.56781270

any tutorials to do this in python?

>> No.56781273

His code might not be pure

>> No.56781274

Never reply to me again unless you're contributing to the thread.

>> No.56781289
File: 31 KB, 329x810, 1453227149400.jpg [View same] [iqdb] [saucenao] [google] [report]

What do you think, /g/? Am I making some unforgivable errors in my code or everything's okay?

>> No.56781296

why would you have an array of Cars, unless you were going to use it in situations where you would be using all the elements as Cars? If you need specific sublass functionality, then have an array of those subclasses or have a method that takes that subclass or something.

Basically, re-think your design here.

>> No.56781315

Well, I was having a function randomly generate these objects to add to an array, but I suppose I'll have to rethink my design.
Thanks anon.

>> No.56781317

Looks alright, Felipe

>> No.56781318

You might want to use CUDA or OpenCL. GPUs have hundreds of cores, they're designed to do this kind of shit.
I have no experience usign that, though. Sorry.
The only thing I can do is suggest you to make a quick search about "OpenCL Image Processing".

Good luck.

>> No.56781320

.net native is available on linux. also, http://www.mono-project.com/docs/advanced/aot/

>> No.56781344

why are you doing that? what are you designing specifically?

>> No.56781370

It's for a CS class
I'm randomly populating a "database" (Array) with Internationals, which can be students, professors, or professionals. Each has unique fields and functions.

>> No.56781444

So I've known how to program for a couple of years now.

I'm pretty good with C. Not GOAT or anything, but can get my head round to a solution with it.

So now I'm focusing on learning Object Oriented. I've read through a tutorial, implemented a few things to get my head round it.

That's all well and good, but I'm out of ideas on what to now do.

My ultimate goal is app development or games, but I think I ought to practice some OO first, right? What can I make to test my OO understanding?

>> No.56781461

haha, why wouldn't they have you guys just use an actual database?

I guess you are trying to read from the """"database""""" then, and that is when you would want to downcast? Sounds like you are using a single """"table"""" for the entire hierarchy. Which is kind of hilarious. If you were using an actual database, you would likely have a type column, which identified the specific domain object to be instantiated.

I guess maybe in this case it's okay to downcast.

I'm no expert or professional(yet) btw, only a senior swe student. Good luck.

>> No.56781480

Make a game loop with states that updates entities and perfect it.

>> No.56781490

How do we stop people from learning OO?
We could convince OO users that we're doing it for their job security

>> No.56781491

The assignment's purpose is teaching the concepts of Objects and Inheritance.

>> No.56781498

Inventory program? Maybe throw in a database too for persistence?

>> No.56781516

I'm adding some functionality to Cargo for Rust.

>> No.56781536

Should I invent my own pathfinding algorithm or should I just copy and paste one from the internet?

>> No.56781542

catch (e) {


>> No.56781555

if it makes someone a better programmer and enables them to contribute more to society, I don't see what the problem is. Let's not pretend programming is not boring as fuck anyway.

>> No.56781556

I might feel silly if I start learning C# to develop Gtk3 apps on Linux

>> No.56781568

SWE with 20 years experience. Waiting on a compile/test suite run on a shitty old mac book air. I'm happy to lend some advice.

What are your requirements?

>> No.56781593

Is C++ quickly becoming irrelevant?
It's cemented itself as the "defacto" language for writing desktop applications, and those are quickly going the way of the dodo.

This new generation of devs don't even know the first thing about writing desktop software, they never bothered with compiled languages.

People are quickly jumping ship and using literally anything else to write their web backends, just not C++ because everyone agrees C++ is horrible.

>> No.56781601

invent your own, then once you know it works, take one from the internet

>> No.56781629

If this is purely as a learning exercise, then certainly re-invent the wheel. You're learn so goddamn much.

>> No.56781630

watch this, If you don't understand it watch it again. Then once you've got an idéa of how it might work. Try to code it.

>> No.56781640

C++ was horrible but there are a lot of great features that make it pretty good to develop in. The issues are that you need a lot of experience with the language to be good with it. And it's hard to wrangle a team of many developers to work on a largeish codebase since it's such a beastly language.

But you can't really write things like scaladb or voltdb in any other language. Except maybe Rust if the primitives for Rust for asynchronous programming improve.

>> No.56781648

1) Using anything but c++ for general stuff. Stuff that requires performance will be done as c library that you call from (your language of choice that is not c++)
2) Using c++ like the sheep you are.
Which will you choose?

>> No.56781649

c++ isn't horrible if you know what you're doing.

>> No.56781659


>> No.56781667

php isn't horrible if you know what you're doing

>> No.56781669

Can I help you?

>> No.56781673

student here that has only ever used Java and C.

C++ is fucking scary.

>> No.56781676


>> No.56781682


>> No.56781692

If you work in Spain, speak Spanish. If you work with a team using php, use php. If you start your own team and project, choose whatever you like.

>> No.56781694

No, even then, PHP is pretty horrible.

>> No.56781705

Anybody know how to download gifs and keep them in their animated form in java
Tried doing it with ImageIO but that doesnt seem to work, ie they are only saved as single picture

>> No.56781706

It's dying on the embedded realm too, where C is becoming king once again. Most people use a scripting language when they can afford to, switching to a quality C FFI where they need the performance. C++ is complex, not as portable as C, and brings very little to the table for most C projects. C++ is pretty much only relevant on gamedev now, which makes sense as most games are still not I/O bottlenecked (and thus benefit from faster code), and they're also one of the few domains where OOP makes perfect sense.

>> No.56781710

the problem is most people don't know what they are doing, so they hate c++.

>> No.56781711


>> No.56781726

wtf i hate math now

>> No.56781736


>> No.56781758

C++ student here, C is scary : ^)

>> No.56781773

You're fucking stupid.
That does essentially the same thing that clear does except you do not even retrieve the iterator that's returned by the erase call even though your current iterators are invalidated. Erase does not even release the memory unto itself either. Get good faggot.

>> No.56781780

>wake up
>go to work
>do .NET programming
>go home

>> No.56781790

Literally they literally don't even literally know what even I'm literally even talking about even. Literally.

>> No.56781800

I want to make a file recovery program, I figured learning about filesystems would be a good place to start. Would FAT32 be a good place to start?

>> No.56781828


>> No.56781836

FAT32 is a shitty file system and used a lot so it probably has a lot of files that need recovering. So, yes.

>> No.56781852

how can i make money is esports

>> No.56781868
File: 14 KB, 358x358, 1473197415103.jpg [View same] [iqdb] [saucenao] [google] [report]


>> No.56781879

i gotta get in on it and make lots of money like the jews did with football

>> No.56781883

u cant

>> No.56781896

sell viewbot services to dumb kids trying to promote their channel
you don't even have to write any software, just run with the money.

>> No.56781899

i dont mean i wanna be a player i mean how do i make money off of the kids who watch it

>> No.56781902

Thanks for the answer... I learned C++ by my own... It's been a couple of years since I started and can say that I know a few things... No degree (in programming or CS, I'm industrial engineer) and no 100% related job... I want to work in IT hope they call me but they're always seeking for experience... i'm 27... hope it isn't to late for me...

>> No.56781907

I'm wiring a Haskell program like this:

import qualified Data.ByteString.Lazy as BS
import Data.Digest.Pure.MD5

getMD5Sum :: FilePath -> IO MD5Digest
getMD5Sum = (liftM md5) . BS.readFile

I'm using lazy ByteStrings because md5 needs it. If I mapM that function over a really big list of files, I get a "resource exhausted (Too many open files)" exception.

Is there a way to read the files strictly (and close all their handles after reading each one) and convert the resulting strict ByteString to a lazy ByteString? Alternatively, can I use seq somewhere?

>> No.56781910

You don't know real math. Here's a starting point:

>> No.56781922
File: 26 KB, 334x358, monad diagram.png [View same] [iqdb] [saucenao] [google] [report]


>> No.56781940


>> No.56781967

Thanks. I was looking for "toLazy" because I saw "toStrict", so I didn't see that.

>> No.56781978

odd choice of names

>> No.56781996

I'm a pre-novice, I want to pick up coding, specifically GUI programs, on Linux, and after looking at options it seems Python is a good choice for both Gtk3 and Qt. Wrong?

>> No.56782004
File: 989 KB, 580x450, 1466971534389.gif [View same] [iqdb] [saucenao] [google] [report]

here is cute anime pls help now

>> No.56782020

just download the raw file

>> No.56782028

Here come dat boids

>> No.56782049
File: 59 KB, 377x561, 1459587217234.jpg [View same] [iqdb] [saucenao] [google] [report]

and how do I do that?

>> No.56782058

That image is just pretty, if anything, but not profound or useful. It only expresses some trivial facts in a cutesy way so you can flail it around and inflate your e-peen with it.

>> No.56782060

Simply making everything lazy is shit. Give me strict data and lazy (by definition) codata.

>> No.56782075


>> No.56782081

Python is a good choice. Qt and Gtk are both good choices. Choose one and stick with it though since you could waste a lot of time trying to learn each one.

Maybe do a hello world example in each of qt and gtk3 and see which clicks best for you and then just go with it.

>> No.56782090


>> No.56782107


>> No.56782111

>not profound or useful
That's kind of the point. If you simply talk about the concept of the monad in isolation, it's utterly meaningless. When you start realizing how many real things are monads - well, that's when it gets interesting.

>> No.56782124
File: 84 KB, 721x720, 1467672038292.jpg [View same] [iqdb] [saucenao] [google] [report]

>If you simply talk about the concept of the monad in isolation, it's utterly meaningless.

>> No.56782130

>Choose one and stick with it though since you could waste a lot of time trying to learn each one.
The problem is I'm thinking ahead about things like distribution and library dependency. I think Gtk sounds the best for that? I know Qt should be a better choice for cross-platform stuff but it actually only seems best in a KDE environment (think stuff like the filepicker, obviously the KDE file picker is great, but the default Qt is not a step up from the default Gtk...)

>> No.56782131

This guy fucks

>> No.56782135

To an ordinary programmer/engineer/etc.

>> No.56782149

That said, the meaning of a monad is nothing more than its definition. There's no hidden secrets or anything. A monad just is. The concept of a monad only becomes useful when you can say "X is a monad". That's kind of the point of category theory.

>> No.56782168

Then choose gtk. I've had more success, personally, with Gtk. But there's a lot of people who swear by Qt, so I'm sure that's fine too.

It's more important that you get coding and learn some Python and a library. Once you learn one, the other one will be easy to pick up. I promise.

>> No.56782179

Is there a way in emacs to make multi-line selection only highlight the parts of the buffer where there's text, instead of highlighting everything until the last column?

>> No.56782304

Anyone got some article on nosql key-value data models that are easly queriable by value?
That is. Let's say I have k keys, with n properties. The db is such that [k] = n1,n2,...,nn. And I need this structure to easly query k and get the ns.
Now let's say I want all ks such that n3=const1 and n5=const2.

My current idea:
Make a [nxconstx] = k1,k2...kn entry and compare the entries in n3 and n5, but that seems quite wasteful and I end up with duplicated data.

In b4 "get a SQL DB"

>> No.56782307

Become friends with Seagull.

>> No.56782312

Doesn't need to be.
Each thread can manipulate some separate NxM chunk of the image.

>> No.56782416

we back?

>> No.56782520


>> No.56782604


Anybody know C++? Could you lend me a hand here:

I have to declare a dynamic memory matrix and fill it up with variables from a structure then print it.

How do I call the structure variables and store it in the pointer?


using namespace std;

struct Student
string name;
int semestre;
float grade;

int main()
//! Declare dynamic memory matrix of 5 elements Student type.
int elements = 5;

//! Filling up the matrix
for(int i = 0; i < elements; i++)


//! Print matrix
for(int i = 0; i < elementos; i++)


//! Release memory


>> No.56782615

I'm not helping you until you put that in code tags

>> No.56782737

ghow do i do it


using namespace std;

struct Student
string name;
int semestre;
float grade;

int main()
//! Declare dynamic memory matrix of 5 elements Student type.
int elements = 5;

//! Filling up the matrix
for(int i = 0; i < elements; i++)


//! Print matrix
for(int i = 0; i < elementos; i++)


//! Release memory


>> No.56782766

I was thinking of switching to KDE, so that complicates things a bit. I keep reading about how Qt will be a lot more prominent in what are now Gtk centered environments like Unity, so I’m still wondering there.

>> No.56782770

What the hell is that indentation?
Also, google "struct member access"

>> No.56783096

That's the case with pretty much all math, yet they're all more substantive than your boilerplate.

>> No.56783113


>> No.56783153


>> No.56783167


>> No.56783188

I thought we were doing all star by smash mouth, no?

>> No.56783206


>> No.56783232

I will help you Sir. You need one variable for each new Student() you create.

>> No.56783244
File: 15 KB, 284x339, IMG_3429.jpg [View same] [iqdb] [saucenao] [google] [report]

I'm sure this is probably really basic, but I'm completely new at this, and have no idea how to fix it.

I'm working on this program that translates Chess notations and prints out a 2d array representing the game, and I'm trying to figure out how to tell if there are any pieces in between a rook and it's destination.

I know where it is, and where it's coming from, but I don't know what's in between them.

any ideas?

>> No.56783260

Forgot to mention this is being done in C

>> No.56783271

iterate over the cells between start and destination

>> No.56783292

do you have the 2d array working? if you do, i don't see why it'd be hard to do the rook thing

>> No.56783300

dumb penguinposter

>> No.56783340

simple offset shape and matrix rotation

>> No.56783344

How can I be sure I'm not going through that specific section though?

Like sometimes from start to destination might be in the negative direction, and sometimes it might be in the positive direction.

Am I overthinking it?

>> No.56783399

>How can I be sure I'm not going through that specific section though?
what "specific section"?
>Like sometimes from start to destination might be in the negative direction, and sometimes it might be in the positive direction.
no idea what you're talking about my friend.

i'll give you a word of advice though is that you should probably abstract as much as you can. make helper functions for dealing with the game board

>> No.56783423

>compile a C program
>compiler crying about unused pointers
>fuck it, I'll test the program
>pointers are used, despite the fact that it told me they weren't

so this..... is the power.......... of C..........


>> No.56783439

say it's going from board[x] to board[y][x], what's a general way to make sure there's nothing but space characters between i and y?

my head keeps going towards making a for loop, but I'm not sure how to know whether i is a lower number than y or vice versa.

>> No.56783456

if (y > i) { for loop 1;}
if (y < i) { for loop 2;}

>> No.56783472


Which compiler?

>> No.56783473
File: 16 KB, 360x240, 1276569347725.jpg [View same] [iqdb] [saucenao] [google] [report]

oh my god, I'm an idiot

>> No.56783481

get some sleep lil nonja

>> No.56783482

That's the side effects of food additives. Stop being a nigger and eat raw fruits and vegetables for a month and get rid of all the chemicals in your liver, kidneys, adrenals, and lymph. Jesus fucking Christ MUH ADHD MUH MUH MUH, kys. Eat how we evolved. Shits simple kiddo.

>> No.56783484


>> No.56783505

>Someone actually believes this shit here
fucking christ, you're somehow worse than my mom
There is 0 evidence to support that claim. None.

>> No.56783508

when we were evolving, we didn't have computers. should we stop using those too?

>> No.56783518
File: 50 KB, 797x621, 1418066007417.jpg [View same] [iqdb] [saucenao] [google] [report]

Why do people hate switches?
They're useful, especially when writing command line applications with multiple options.

>> No.56783524

you mean unused variables, or parameter.

>> No.56783530


completely pointless in an FP language

>> No.56783538

unused variables

>> No.56783552

They're inferior to pattern matching.

>> No.56783569

How? They compile to pattern matching in the end in most languages

They make otherwise ugly statements more readable

>> No.56783594

pattern matching or a map or array or a function etc

>> No.56783607

Look at your nails, your teeth, your hydrochloric acid in your stomach, and the length of your small intestines. Even national geographic says we are an islander specie that ate fruit and herbal leaves for most of our initial stages.

This is a non-argument because you don't ingest computers. I lost over 100 pounds 5 years ago and kept it off, I only eat fruit and salads every once and awhile. Stop believing the pharma jew and eating HFCS, MSG, blood, starch, and all the other meme fad diets created by your corporate owners. The vagus nerve controls food cravings and guess what directly controls your vagus nerve? That's right, stomach bacterium, aka parasites. The more acidic food you eat (gmos, wheat, beef, bakery foods) the more they proliferate and create an environment where you crave foods for them to survive and own you. You're under mind control. You know not what you say. You are defending slavery. Stop.

>> No.56783613

How do you keep yourself motivated while self-learning programming? I ain't getting bored yet, but I gotta admit that sometimes I just get distracted with something else. Any fun exercises I could do while learning? I am learning C btw.

>> No.56783625


Show the section of code it says you have unused variables in.

>> No.56783643

That doesn't mean that that's why attention spans appear lower now.
Just because we're "supposed" to eat certain foods doesn't mean that that's why XYZ problem happens, you have to prove that there's a correlation to make a statement like "this is why it happens".
Also, humans are supposed to die at the age of ~40, we aren't supposed to live in civilization, we aren't supposed to process this much data every single day and we aren't supposed to do anything with our lives other than hunt, forage, and socialize. But we do, because we're not in the fucking stone age.

>> No.56783659

When the function "insertd" is executed more than once during the for loop on the main, i have to press enter twice in order to input the data1, what's going on?

void insertd(void){

char *data1;
char *data2;
int number;
char buf[256];

data1= (char*)malloc(BUFFER);
data2= (char*)malloc(BUFFER);
fprintf(stdout, "\n\nInput data 1: \n----> ");
while(getchar() != '\n');
fgets (data1, sizeof(buf), stdin);
fprintf(stdout, "\n");
fprintf(stdout, "Input number: \n----> ");
scanf("%d", &number);
fprintf(stdout, "\n");
fprintf(stdout, "\n\nInput data 2: \n----> ");
while(getchar() != '\n');
fgets (data2, sizeof(buf), stdin);
fprintf(stdout, "\n");
pm = insert_data(pm,data1,number,data2);

int main(void){
int ins;
scanf("%d", &ins);


>> No.56783660


Yeah, GCC is shit.

>> No.56783668
File: 3 KB, 537x78, pointers.png [View same] [iqdb] [saucenao] [google] [report]

I put these into a function call, so they're technically not used in the main function

Probably am doing something wrong but the output just werks

>> No.56783691

actually there is a lot of it, you just arnt looking information more in depth than the food pyramid

>> No.56783699

You aren't offering any evidence
show me proof that food additives have a strong causative relation to deterioration of attention span

You made the declarative statement, the burden of proof is on you.

>> No.56783700

two for loops doing the same is ugly and bad style, just do it like
check(int start, int end){
if (start > end)
swap(start, end);

for (int i=start; i<end; ++i)

You'd have to implement a swap function but that should be no issue.

>> No.56783746

>ridiculously dense
>casting malloc
>fprintf(stdout, ...) instead of printf
>Multiple print statements when you can use one
>buf unused
Also, why do you keep discarding lines before each fgets?

>> No.56783756
File: 1.98 MB, 303x228, primate magic.gif [View same] [iqdb] [saucenao] [google] [report]

Random /fit/izen here, just saw this on the front page, I'm not even a /pol/ retard or vegan shill but I'm just jumping in with a shitpost to say that this anon is actually right. Do a bit of research into what people ate before the 20th (& 19th to some extent) century. We ate a lot more fermented foods, which literally provide a shortcut for "good" bacteria to populate your gut which helps you digest & assimilate everything else better, as well as feel better in general. Try googling how the gut is our "second brain" and how 90% of the serotonin in your body, which is the principal catecholamine that helps you maintain a positive mood, is synthesized in the gut (by the bacteria. D'oh) and lives there most of the time.

Watch Cooked on netflix if you have the time, it's an amazing 4-part summary of a few of the major alchemical things that humans have done with their food for all of history, up until the last 150-200 years that is.

I actually tried going vegan this year after seeing anecdotal report after report of people that say when they did it it was "the best they'd felt in their entire life". Long story short, it's not quite that simple but I totally experienced it and see what they mean. I still eat meat occasionally now but the idea is to not overload your digestive system with heavy-ass foods like fatty meat, artificial flavors, synthetic chemicals. It takes energy to make energy, so to speak. Give your body periodic time off by eating moar plants, and a ~24hr fast every now and then. I seriously haven't felt better in my life.

Damn you made me reply. 10/10 b8 m8

>> No.56783757

actually, that wasnt me im just here with some popcorn.

I'm just going to say anecdotally that food is important to mental performance just as it is to physical performance. If you care about that, you'll do the research yourself.

>>>/fit/ isnt actually a bad place to find a direction if you care.

>> No.56783779

The Bro-Science is fucking painful

>> No.56783791

That's one long nipple

>> No.56783798

If you like fermented food, just binge on bratwurst and sauerkraut then. That's not fresh fruits and veggies.

>> No.56783808

looks like mine

>> No.56783840

im pretty sure barwurst isnt fermented

>> No.56783857

link a single study
It cannot possibly be this hard to provide evidence for your claim unless you're pulling it directly out of your asshole.

>> No.56783876

>It cannot possibly be this hard to provide evidence for your claim
Its not I just dont give a fuck about you

>> No.56783878

Well no but it's what people had with sauerkraut. Pork is shit meat but peasants ate it for sure.

>> No.56783883

New thread:

Free from fag degeneracy edition.

>> No.56783899

only reason to live tbqh


>> No.56783930

>Also, why do you keep discarding lines before each fgets?
If I don't do that, the fgets will be ignored.

>> No.56784084

It's not so much about studies, it's about using your own intuition to figure out wtf is going on when you eat different shit. Aka, what every animal does naturally. We, the lowly humans, are the only exception because for some reason we can't bring ourselves to tear away from our precious electronic dopamine cannons for more than a few seconds at a time.

It's one of those things that the vast majority of sheeple don't think about. Because they're stupid. Don't be stupid. Ask abstract questions of yourself, and then hop on google and try to get abstract answers that you can then synthesize into overarching, grouped common concepts, and finally support them by narrowing down to concrete science.

If you really want studies thrown in your face though, here are a couple that I got upon literally googling "fermented foods study":




I didn't read any of them, but that last one is interesting seeing as how I've read that a lot of "good" gut bacteria species tend to produce butyric acid as a byproduct of digesting polysaccharides (that you eat), which is related to GABA, the main inhibitory neurotransmitter (i.e. it chills you out).

>> No.56784111

Reply in new thread: >>56784104

>> No.56784117

I wasn't talking about the fermented foods (it should be obvious why they're good for you), I was talking about the link between processed foods and attention span deficit that the other person was expousing

>> No.56784205

wtf i love math now

>> No.56784340

Oh yeah idk. I have some opinions on ADHD too but it's less to do with food. I could imagine that eating shit all the time could conceivably give you the attention abilities of a rabbit though.

>> No.56784427
File: 5 KB, 376x121, windows.png [View same] [iqdb] [saucenao] [google] [report]

Windows... not even once.

>> No.56784497

> put these into a function call
then they are used.

>> No.56784559

you are missing some lib

>> No.56784602
File: 874 KB, 320x192, 1403483537348.gif [View same] [iqdb] [saucenao] [google] [report]

I wrote it all out, and it works for one case, but not for another.

I'm on the verge of destroying everything in my house, this shit is infuriating.

I've been working on this goddamn program non-stop for the entire week

13/20 test cases pass

Fuck you, Szumlanski, you sadistic piece of shit asshole, go fuck yourself.

>> No.56784648


Gee thanks.

>> No.56784657

show the rest.
im guessing you didnt use the pointers in the function.

>> No.56784658

yeah they are

but the compiler thinks they aren't

>> No.56784673

I explicitly said the output was correct, and the output can only be correct if the pointers are being used

>> No.56784803 [DELETED] 
File: 92 KB, 1221x789, coorperate machine.png [View same] [iqdb] [saucenao] [google] [report]

I have a DES Encryption program to write, due Monday at midnight, that I've barely progressed on. ;_;

We could use any language we want, I wanted to C but my power level is shit in C so with only a few days left for the assignment I decided to go with familiar old Java. Already regretting it. Having to cast byte arrays into int arrays and manipulate the individual bits is like performing brain surgery with twigs and leaves. Fuck me sideways.

Ah well. I have a thermo test to study for tonight so it looks like tomorrow after lifting I'm gonna pop ungodly amounts of adderall and see if I can burnout race to the finish and write everything out in time for the deadline.

>> No.56785117

I finally have my boids ported to SDL.

>> No.56785527


Name (leave empty)
Comment (leave empty)
Password [?]Password used for file deletion.