/dpt/ - Daily Programming Thread

Old thread: What are you working on Cred Forums?

Other urls found in this thread:

openbookproject.net/thinkcs/python/english3e/
0x0.st/Swq.c
wiki.haskell.org/Monad_tutorials_timeline
developer.mozilla.org/en-US/docs/Web/CSS/CSS_Flexible_Box_Layout/Using_CSS_flexible_boxes
css-tricks.com/snippets/css/a-guide-to-flexbox/
linguee.com/english-portuguese/search?source=auto&query=holy cow')
wiki.osdev.org
eudyptula-challenge.org/
npmjs.com/package/minimux
opengl.org/wiki/Load_OpenGL_Functions
github.com/KitFreddura/Kinder
eclipse.org/downloads/packages/eclipse-ide-cc-developers/neonr
go.microsoft.com/fwlink/?LinkId=733434
blogs.msdn.microsoft.com/visualstudio/2016/08/22/visual-studio-15-preview-4/
dotnetperls.com/
vimcasts.org/episodes/archive/
twitter.com/AnonBabble

Learning python as my first programming language using this website:
openbookproject.net/thinkcs/python/english3e/
So far Ive finished chapter 5 and doing fine with excercises.
I have no formal education though, anyone have any tips on things I should avoid? So that I dont end up with bad habits.

yeah, learn scheme instead

Not even MIT bothers with Scheme anymore.

implementing a meme language in C for a uni course

Is it a good meme?

where x is the row?

Doing a login system for muh LOB app, never done something similar.

Where x is the number of columns in a row

Yeah it''s an alright meme, it's PL/0, so it's not complicated. I might add monads to it as a hidden feature.

not an argument

or was it [i*y+j]?
i always get confused. you can figure it out.

also, then you don't need to maket it a pointer to a pointer.

than other user is correct. after a little experimentation with array i am now convinced that double indexing a one dimensional array is the cause of your problem. i can't believe i didn't spot that myself.

Do it. Everything can be solved with monads.

If MIT got its students to jump off a bridge would you do it?

Sometimes you need monad sans return.

Their argument.

>Costanza asked Sussman why MIT had switched away from Scheme for their introductory programming course, 6.001. This was a gem. He said that the reason that happened was because engineering in 1980 was not what it was in the mid-90s or in 2000. In 1980, good programmers spent a lot of time thinking, and then produced spare code that they thought should work. Code ran close to the metal, even Scheme — it was understandable all the way down. Like a resistor, where you could read the bands and know the power rating and the tolerance and the resistance and V=IR and that’s all there was to know. 6.001 had been conceived to teach engineers how to take small parts that they understood entirely and use simple techniques to compose them into larger things that do what you want.

>But programming now isn’t so much like that, said Sussman. Nowadays you muck around with incomprehensible or nonexistent man pages for software you don’t know who wrote. You have to do basic science on your libraries to see how they work, trying out different inputs and seeing how the code reacts. This is a fundamentally different job, and it needed a different course.

>So the good thing about the new 6.001 was that it was robot-centered — you had to program a little robot to move around. And robots are not like resistors, behaving according to ideal functions. Wheels slip, the environment changes, etc — you have to build in robustness to the system, in a different way than the one SICP discusses.

>And why Python, then? Well, said Sussman, it probably just had a library already implemented for the robotics interface, that was all.

What the fuck is a monad in programming?
All i remember is Leibniz's monads from philosophy class.

why is it called /dpt/ if the thread is made more than once a day?
scheme is fun

>it probably just had a library already implemented for the robotics interface, that was all

...

>why is it called /dpt/ if the thread is made more than once a day?
Probably because they actually were daily when it first started and changing the name now would be a hassle.
Also, "dpt" has a nice ring to it.

It's called daily, not once daily.

It's something entirely different, and even then within programming, it's different. When people talk about monads here, they're talking about Haskell's monads.

As we all know, it's pronounced 'dippy tea'

any set that contains more than one element contains one element

I knew you were a chav

Nah, mate. Dunno what you're talking about.

wtf

Only chavs watch Top Gear

>csc 101 (meme course, i know, but i have to take it because i have no credits otherwise)
>professor couldn't even compile a "Hello, World" program
>we spent a solid 15 minutes of watching the prof fiddle around with things
>all he had to do was go into command line and set path -> javac helloworld.java -> java helloworld
>instead takes the time to install jgrasp and do it that way
>we have to sit there and watch while he does this

>painfully obvious there's no lesson plans at all - we spent an entire lecture after this browsing the java documentation and the prof basically just explaining random String methods to us

kill me. i'm trying to make the best of it. I'm paying attention, taking notes, trying to distinguish semantics in terminology to make sure i get muh 4.0 gpa, but this is just awful

the thing is i could learn faster on my own, but i want to get credit for it in case i want to do postgrad work

then what differentiates it from a general?

>required attendance

The name.

I disagree with your premise.

Disagree all you want mate you're a chav mate your mum told me when I bought some fags off of her. Your dad's a right batty boy he was after me arse the hole time. I dunno how you put up with him he's always going on about stuff.

Now nobody watch Top Gear.

Mummy what should I learn after C#?

>electron :^)
FML, I'll have to give up and use the JS meme. FML a thousand times.

The list is a common monad.

It's parameterized over a type.
You can "map" a function from As to Bs over a list of As and get back a list of Bs. This makes the list a functor (endofunctor, because you don't typically leave the Set category, but that's teetering over the edge of the rabbit hole - let's say functor).
You can take a single A and turn it into a singleton list of As (well, that one A). This is the monad operation called "unit" and sometimes "return" or "pure".
You can take a list of lists and make one big list. This is the monad operation called "join".
Monads are also often talked about in terms of the operation "bind", which combines the functionality of both "map" and "join".
These operations all respect the "monad laws". Presto, a monad.

Other examples of monads that you might recognize:
- most collections
- optional (nullable) types
- exceptions, in a sense
- futures

Whatever you please.

optionals are a collection, a range where you can have at most 1 element

I suppose that's true.

They were daily once.
Now they're trap mem festivals.
Some of the people posting the Himegoto OP probably don't even know it was a forced mem.

get this meta outta here. traps or no, Cred Forumshomeworkhelp is technology

what the fuck did you just say to me

Traps are gay.

no u

Why is this thred ded?

Some of the people posting the Himegoto OP don't even program.

Cause people are actually busy programming?

All generals must die.

I know for SURE that is not the case.

The thread is not what's daily, it's the programming that's daily.
It's a thread about daily programming, not a daily thread about programming.

anyone know how i can transform something like [[1,1],[1,2],[1,3],[2,1],[2,2],[2,3],[3,1],[4,1],[4,2]]
to [AA, AB, AC, BA, BB, BC, CA, DA, DB] in prolog?

>geforce experience

>LOG IN TO YOUR FACEBOOK/GOOGLE/NVIDIA ACCOUNT

Guess I'm never updating my drivers again
Thanks NVIDIA!

not sure
but just map [1..] to ['A'..]

How do I center an absolute position div?

I don't want to ask /wdg/ anymore because they'll tell me to use jquery and/or set up some event listeners or whatever.

heh, so you were the user who said it was implementing C string functions to js.
Regarding your question, I can't help sry.

>center
>absolute position

Sorry, those two things are completely opposite of each other. You need to choose one and stick with it.

If you want to center the div provided you don't want it to be absolutely positioned, just set the width to some size like 700 px and then put auto on the left and right margins which will center your div because the CSS standard is set to have te left and right margins provide the same amount of width when both margins are auto.

JUST

reminder that palming leftctrl only makes sense if you have manlet hands

instead you should swap capslock and leftctrl

>not using spaces in compound operators

Oh wait, never mind, you mean the positional attribute, not some absolute position div. Just do what I said above.

Here's some CSS to illustrate.

div#thing
{
position: absolute;
width:400px; //You need to set a value for this to work
right: 0;
left: 0;
margin-right: auto;
margin-left: auto;
}

what

you mean binary operators?

Fuck, user, it's been over 3 years since I last remembered Prolog existed.

map(1, 'A').
map(2, 'B').
map(3, 'C').
map(4, 'D').

cat([X, Y], Z) :- map(X, A), map(Y, B), atom_concat(A, B, Z).
iter([], []).
iter([H|T], Z) :- cat(H, A), iter(T, B), append([A], B, Z).

?- iter([[1, 2], [1, 3], [4, 2]], F).
F = ['AB', 'AC', 'DB'].

Yes, binary, my brain is melting I guess.

who else /jquery/

After a little more research into Prolog built-ins, I've manged to get all 26 letters in only 2 clauses. This might actually end up being your extra credit solution, so I won't post it. It was fun.

Currently allowing Andrei to deliver the D to me

stdout
[/code]
cc life.c -lncurses
life.c: In function 'next':
life.c:41:31: error: lvalue required as left operand of assignment
: nst[i][j] = (adj == 3);
[/code]
????

don't use ternary like that, use an if statement instead

but it would probably work if you put parentheses around the assignments

If you're going to use a ternary operator, use it like an expression:

nst[i][j] = (st[r+j] ? (adj == 2 || adj == 3) : (adj == 3));

ALMOST WORKS

you're a living meme, friendo

My Android IDE throws this every time it tries to sync with Gradle to initialize a project. IDE is IntelliJ IDEA

Any idea how to fix? I can't proceed without this step.

at least he's not haskell posting any more

shut the fuck up
I started c a week ago

anywyas, can you debug my prog
0x0.st/Swq.c

fuck, I knew somebody would recognize me
I should never post my screenshots

You're the only person on earth with that disgusting theme, and you went out of your way to embarrass yourself by presenting poorly written C as a feeble argument for why haskell is good.

that was a trollpost

y r u so mean

let me see your theme

Explain to me like I'm an idiot what a monad is and why I would find them useful.
Do not just reply with "monoids in the category of endofunctors"

monads are something you learn by doing, not by reading on some blog
better start that haskell

it's just a meme and they are not useful

wiki.haskell.org/Monad_tutorials_timeline

>the fact that this even exists
not sure if funny or sad

t. c89 programmer

>le abstraction makes everything better man

If you use that many ternarys you should just end it now

C is about data manipulation, not writing easy code

>What the fuck is a monad in programming?

First you should understand Monoids (they are the "little brothers" of Monads):

So what's a Monoid?
A bunch of objects with an operator, so that..

1. If you use two objects with this operator, you get another of those object.

2. There's a special object. If you apply the operator with this object on one side, the other object stays the same.


Example:
1. The number of all texts.

2. "Concat" is our operator, because ("OP" + " is a faggot.") = "OP is a faggot."
--> Each two texts create a new text.

3. Do we have a "special object"? Yes, the empty string:
"Hello. I'm a text." + "" = "Hello. I'm a text."


We just created our own Monoid!
So what's the differnce to Monads?

>"A monad is just a monoid in the category of endofunctors"
--> WTF?!

1. "Endofunctors" are "functors" that map a category to itself.
2. "Functors" are certain mappings, basically an abstraction of functions. For example turning "x*x" into "exp(x)".
3. "Categories" are objects than are somehow "linked" to each other (and can get linked to themselfes).


So "what's a Monad"? (..abridged..)

1. We have a bunch of objects.
2. Those objects can get mapped to each other and also mapped to themselfes.
3. Those objects have an operator: x ["operator"] y --> z
4. There's a certain object which leaves each object itself: x ["operator"] [SPECIAL OBJECT] --> x


Wow, seems like our previous text example is even a Monad !!!


On a sidenote, there are - of course - serveral mathematical details about this. For example you have to stay within the same "order".

So to """really""" understand monads, you have to be more nitpicking.. what is "text appending" anyway?

Bascially we take a bunch of letters in a certain order, "unpack" those letters and put them together again..
Think about text like a "linked list of letter". Concat takes that last letter (of the first text) and links it to the first letter (of the second text).

Cool, eh?

>0x0.st/Swq.c
a) fix your indentation
b) use descriptive variable names
c) youre using way more ternaries than you need to

>uni wants C not C++

Deal with it, user.

Should I put my answers to r/dailyprogrammer challenges on my github?

Your uni is god-like.

yes

Can someone point me to a good example of C++ Abstract Data Types, particularly array list implementation? I literally cannot comprehend my teacher's accent and I'm scared it's cause me to fail this class.

Can someone help me explain the mobile part with css?

I'm using @media currently and I can place the divs correctly depending on the display width, however their sizes along with the elements within are too small

Is customizing height and width of every element/div the right way to go for mobile or is there a more plausible way

>>/wdg/

what does this have to do with programming?

he knows there's a thread and its inappropiate here, he's just trying to get a response anyway

You basically never want to write CSS so complicated that you're specifying every single div's parameters. I can't think of a single time that could ever be efficient or even useful.

Do this if you want to learn CSS properly in the year 2016:

1. Just start with Sass. Google it if you don't know what that is. If you're on Mac, buy Codekit. If you're on Windows, buy Prepos. They are tools for beginners which clearly you are. I still use Codekit for short term freelance bullshit. It's a fine investment at $30.

2. Pick a library or framework. I do not recommend Bootstrap. Go with Foundation or Susy. Let the framework simplify your layout so you can focus on other things like vertical alignment and typography.

3. Pick a project. Start with a mobile layout. Then gradually design a tablet / desktop version of that layout. Use CSS breakpoints to divide your code up into partials for each device. Larger devices should overwrite specific lines of code from the smaller devices, but still utilize as much as they can.

4. Just keep fucking with it until it makes sense. Google anything you don't understand, including anything in this comment. Learning it this way will save you months of time if you're at least somewhat bright.

Take any questions to /wdg/ - web development general - because most people here are easily rustled by web developers.

how else can I do it without the ternaries

>Do this if you want to learn CSS properly in the year 2016:
>recommends literally who libraries and frameworks
kill yourself

Also learning here, except Java.

Using a free course by a University in Finland, online.

I learned BASIC and Pascal as a kid. Then C in high school. Then some Ruby and JS in University (I studied Philosophy, not CS, mind you).

So I have a weird history... never really created a program worth mentioning though...

I decided to go for Java for several reasons:

1) it hides less than Python from you... maybe Python is better if you're a complete beginner for programming, but otherwise I'd say Java is a better idea

2) easier to transition to C++ or C# later on if you choose to

3) Android apps

4) relatively easy compared to C++

5) run on virtual machine so not dependent on OS

6) most job opportunities

7) most resources online (#1 most popular language)


So far I'm loving it. For some reason I hated JS and scripting languages like Ruby. Maybe it's just not how my mind works. Especially JS I hated I thought of giving up programming in general because of it.

So if you ever get tired of that course don't give up programming! Just try with something else, maybe Java.

Now I'm learning 8 hours a day and it's fun! I love Java.

>he needs libraries to manage / create his code
lmao

What would you recommend a beginner? I use neither anymore, but Susy helped me learn very quickly. It's simple as fuck and doesn't do anything you're not aware of, unlike all the shit I found myself overriding constantly on Bootstrap.

Also, Foundation is not literally who. Probably second most popular for beginners under Boostrap. I'm not going to tell this guy to start with a JS framework like Angular or React for learning CSS, which is basically what I exclusively program in right now.

i honestly can't tell if you're memeing or if you're actually being serious

cluttered as fuck.

Also you're using ncurses, you can just create a second WINDOW and use double buffering instead of doing it yorself and re-allocating an x by y array every fucking step.

what's wrong with learning "plain" actual CSS with flexbox or someshit?

developer.mozilla.org/en-US/docs/Web/CSS/CSS_Flexible_Box_Layout/Using_CSS_flexible_boxes
css-tricks.com/snippets/css/a-guide-to-flexbox/

>I'm not going to tell this guy to start with a JS framework like Angular or React for learning CSS, which is basically what I exclusively program in right now.
This doesn't make any sense. Why would you recommend anything other than CSS to someone who wants to learn CSS?

>cluttered

I honestly can't tell if you're just jerking me around because I responded to this guy's web question in the /dpt/. I told him to start with Sass because I cannot name a single competent team in my city that does not use it, minus one that's still using less for some reason. I told him to use an incredibly simplistic and flexible grid framework (susy) that has no unintended side-effects on your CSS, and to avoid Bootstrap because it coddles you. I told him to use Google because HTML / CSS are well documented online.

Explain to me what's wrong with that advice instead of trying to backpedal out of this.

That's just what I assumed me meant with "literally who" frameworks. React might be the most popular library outside of JQuery right now.

And I recommended Sass because it's just CSS with better practices.

you can start by using proper formatting with spaces and such, this isn't haskell ffs

...

where is it cluttered

fucking everywhere you're not putting spaces after commas etc and you're even putting multiple statements on the same line follow some basic style guidelines jeez just auto format it in your IDE and it will fix itself

read a styleguide, no matter if linux kernel, nasa or gnu but what your doing now is not debugable.
srand(time(0) + clock());
int y, x; initscr();
noecho(); cbreak();

Why don't you guys like Rust?

Here's the actual Option definition from the stdlib:

pub enum Option {
None,
Some(T)
}

it's not C++

Absolutely nothing is wrong with that, but a lot of frameworks are compatible with stuff like Flexbox and help beginners understand layouts and build better, more functional sites at a far more rapid pace. You can pick up all of CSS's weird quirks as you go along. This isn't C++. Nobody needs to read a 500 page book to get it.

Also, he was asking about mobile web design, specifically. Clearly, he's already done some introductory CSS. Are you guys just slow?

Yes, that's its biggest strength

it's a worse and less widely adopted C++ with a bunch of meme shit tacked on to it. there is no compelling reason to use rust.

fuck off and die

why would you do
thing();
shit();

when you can save a line?

fuck off and die

haskell seems to have given you permanent brain damage

>it's a worse and less widely adopted C++ with a bunch of meme shit tacked on to it. there is no compelling reason to use rust.

this is how i know you're too stupid to use it

happy segfaults!

nah, you're baiting

stay delusional

>happy segfaults!
lmao what a moron
if you did CS101 with C++ it doesn't mean you know what you're talking about

ok, so how would you guys write my main()

int main(void)
{
int y;
int x;

srand(time(0) + clock());
initscr();
noecho();
cbreak();
halfdelay(3);

while (1) {
getmaxyx(stdscr, y, x);
cpst(y, x);
clutter(50);
refresh();
next();

for (int i = 0; i < y; ++i) {
for (int j = 0; j < x; ++j) {
mvaddch(i, j, st[i * x + j] ? '*' : ' ');
}
}

if (getch() == 'q') {
break;
}
else {
clear();
}
}

endwin();

return 0;
}

so, one per line, and group things together
>int y;\n int x;
come on, at least make it inx y, x;

and I assume for the clutter function
you'd do

void clutter(int n) {
static int thousand = 0;

if (!thousand)
thousand = n = 1000;

for (; n-- ;) {
st[rand()%y * x + rand()%x] = 1;
}
}


but im not sure about the for loop

require 'mechanize'


mecano = Mechanize.new
loaded_page = mecano.get('linguee.com/english-portuguese/search?source=auto&query=holy cow')

puts loaded_page.title
foreign = " #{ loaded_page.at('.tag_trans').text.strip}"
foreign.chomp('/f$/')
puts foreign

I'm trying to remove the "f" at the end of the string (foreign), why isn't this regex working?!?!?!

you're not initializing the y and x in main

>getmaxyx(stdscr, y, x);

void clutter(int n) {
static int thousand = 0;

if (!thousand) {
thousand = 1000;
n = 1000;
}

for (int i = 0; i < n; ++i) {
st[(rand() % y) * x + rand() % x] = 1;
}
}

void clutter(int n) {
static int thousand = 0;
if (!thousand)
thousand = n = 1000;
for (; n-- ;) {
st[rand()%y * x + rand()%x] = 1;
}
}
Be consistent! don't leave out optional curly braces in one statement but add them in another statement.

unless getmaxyx is a macro (in which case it should be in uppercase) then it should be getmaxyx(stdscr, &y, &x) depending on what getmaxyx is supposed to do (it's not included in the source so i can't see it)

>thousand = 1000; \n
>n = 1000;

why

>come on, at least make it inx y, x;
having them on separate lines makes it much easier to see at a glance how many variables there are, it's more readable

it's more readable

am I a faggot if I like my code to pretty
and by pretty I mean
>has a nice looking structure
>is as concise as can be

meme code related that I find very pretty
import Data.List
import System.Random
import Data.Bifunctor
import UI.HSCurses.Curses

data Cond a = a :> a
infix 4 :>

b ? (u:>j) = if b then u else j
infix 3 ?

main = do
initCurses; cBreak True
(l,m) (y,x-1)
r (l,m)(y,x) = x==m ? (y,0) :> (y,x+1)

fym f y m = f m . y m

ul = fym u l ; ur = fym u r
dl = fym d l ; dr = fym d r

>haskell
>pretty

or whatever shitlang that is

Make is shit.
CMake is shit.
GNU autotools are pure cancer

Are there any decent build systems out there that aren't pure garbage?
I'm so sick of make, it's pure fucking shit, declarative build system are fucking garbage.
I don't care if it's not cross platform, I just want a build system that doesn't make me want to kill myself.

nobody else (and you in a month) has any idea what your code does at first glance

CMake.

i updated to eclipse neon and just having make with no gradle cancer is heaven by comparison

Shit.

Some shits smell worse than other.
CMake is what we have.

is the only goal readability

Just use VS :^)

pretty much

why would you need to save lines? you don't get any more good points just because you write """"concise"""" code

>Are there any decent build systems out there that aren't pure garbage?
SCons

Make and CMake is shit and autotools / autoconf makes me want to kill myself everytime I use it.

it's definitely not how many functions with 1 letter parameters you can fit on 1 line

>good points
good boy points

Any one knows how to remove the last character of a string in ruby?

what do you mean everytime you use it? you set it up like once for a project and tweak a few lines once in a while and that's basically it, it's fucking nothing

I'll take your advice.
I just hope I can decipher code more quickly if I adopt this style.

>what do you mean everytime you use it?
Everytime something breaks or someone has added something new that doesn't work on all configurations or anything. It is pain to use.

>you set it up like once for a project and tweak a few lines once in a while and that's basically it, it's fucking nothing
I have to work with 15 other developers and test and debug on 10 different architectures, and this shit has to work on Windows, Linux, FreeBSD and on fucking VxWorks (we don't build on VxWorks, but it needs to compile for it).

It's fucking hell I tell you.

...

No contrast. Shit/10.

ruby made one

Completely wrong.
If there was no contrast you wouldn't be able to see any text or the side bar.

i don't see how my theme is worse than yourse
I'd say they're in the same level

also, I use redshift, so that means my theme looks better under it

Poor contrast. Shit/10.

this

Completely wrong.
Colors can't have a financial status.

Jesus christ that's a horrible scheme
Do you actually program with that?

Completely wrong.
t bernie

chop if you want a copy of the string with the last character removed
chop! if you want to remove the last character in place.

Is currently making one*

Have been sidetracked.

I can't believe you actually use ruby ruby, ruby is a disgusting OOP language.

stay jelly fags :^)

>Colors can't have a financial status.
In my experience coloreds are usually pretty poor in comparison to whites.

Shake

Completely wrong.
Jelly can't have a sexual preference.

Get on my level.

static const auto sz = (size_t) sizeof(char);

static_assert(sizeof char == 1, "weak b8");

r u writing an OS

Ruby is the most comfy scripting language, and it does OOP better than everything else -- the Smalltalk way.

constexpr size_t sz = 1;

you get on my level

How deep can you take your dildo in?
that code horrifies me

>Ruby is the most comfy scripting language, and it does OOP better than everything else -- the Smalltalk way.
chigau

>implying you can get any better than this

the entire fucking point of pure fp is improved readability through lack of state
yet you fucks bastardized it so much by prematurely abstracting every single duplication that your code is worse than most stateful imperative code

you need colors on let, if else etc etc

NO U

...

where do i learn how to write kernel programs like that

>Less than one comment per line
Poorly 'documented'

never go full fp

wiki.osdev.org
eudyptula-challenge.org/

it's self documenting, but only if you're not retarded :^)

Your attempt to mimic C's ? syntax is retarded
Don't do that

It may be better to assume scrSize is a num, and use (-2) rather than (pred . pred)
don't put multiple statements on the same line in large blocks
you repeat the bimap pred pred thing, consider just writing something like

adjustedScreenSize = bimap (-1) (-2) scrSize

>++
don't do this

this entire bit might be nicer as a comprehension anyway

your nextgen bit needs refactoring, it's hideous
same for co-ordinate functions, your adj function is horrifying

so much for shooting yourself in the foot

I do not own a dildo, user.

違わない。 ルビはとても快適、名無し。

prove to me theres a single valid reason why c++ is still being used today
>protip you literally can't

ruby is as comfortable as a bed of knives

performance

>tried HTML, PHP, Java and Pascal (albeit when a kid)
>always extremely frustrating as one error leads to another

I just can't seem to program Cred Forums or I don't have the mindset for it. What can I do to solve this? I wouldn't mind trying to be something like a freelance web developer just to do on the side but I don't think I'd actually manage an IT desk job (moved to another industry) I just want to learn something to feel a bit more productive.

Because it's the best language for writing high performance feature rich software with reasonable productivity.

>it's self documenting, but only if you're not retarded

Not commenting on your code, but it's amazing how often I see this mentality.

Obviously, it doesn't matter on something as trivial as a fizzbuzz, but people will leave 8 lines of very unique code uncommented, and when they come back to it 3 months later, they won't be able to immediately tell you what it does or why it exists.

Technically, comments are not required at all if there are no "magic numbers", because anyone sufficiently versed in the language could sit down and take the time to follow all of the pathways throughout the code base. However, the main point of commenting code is to explain oddities and give the viewer a brief summary of the 'Why' and 'What'.

>they won't be able to immediately tell you what it does or why it exists.
That's often the case when you comment unique blocks of code too. Often i come across comments and find it's easier just to read what the code does because the comments don't explain the thing that I find hard to understand, or they are outdated because the code was changed 5 times since the comment was written.

If your biggest issue is errors, then C#+Visual Studio would be a great language for you.

Errors are generally very easy to understand, or at the very least easy to google, and the debugger is extremely easy to work with so you can figure out exactly what's happening in your code.

Obviously, many other languages have great documentation and IDE/debugging support, but C#+VS is really easy to plug-and-play and learn.

you don't write haskell though

im in my first programming class, and my first assignment is to

"write a program that stores the integers 62 and 99 in variables, and stores the sum of these two in a variable named total."

i wrote this, but there's an error, and im not quite sure what I did wrong. any assistance would be appreciated, thanks!

oh, im using dev c++.

#include
using namespace std;

int main()
{
//input define vars
sauce = 62,bread = 99,pizza = total;

//processing
//Calculate number
pizza = sauce + bread;

//output
cout

>pizza = total

You need to declare what types of variables they are. C++ doesn't automatically assume the data type.

Do this:

int sauce = 62;
int bread = 99;

int pizzaTotal = sauce + bread;

cout

this

Look at the colors.

You tell me, user.

1. Variables need to be declared with their type.
2. You assign pizza to the variable total, but total has not been declared previously.
3. You don't actually terminate your strings. You needed an extra quote after "is" in the cout statement.
4. Get rid of the system("pause"). It's useless, non-portable, and it actually introduces a security vulnerability to your program.

Does anyone here have experience with Elm? Can you compare it to React/Angular?

thanks you!

If your APIs don't have a WSDL, you're probably a cock-sucking faglord.

What's the fastest option for getting started on a c++ application, meaning an ide + compiler that doesn't take ages to download like visual studio?

I don't need a lot of features, just wanted to test some things in c++.

How easy is it to crack a 25mb programm with a 7 day trial? I can't program, but am willing to pay 200$, is there any place where I could go?

(Someone from the stupid question thread told me to come here)

WSDL is dead. Long live GraphQL!

Who are you quoting?

It's just one standalone .EXE or what?

Just use ILSpy or one of those disassemblers.

He wasn't quoting anyone. That was a "green text story", which has been a common way to share anecdotes on Cred Forums in a succinct manner.

>query taking 4 minutes
>add index to table
>query takes less than 2 seconds now

I'm starting to into database, and this is actually pretty neat.

>query taking 4 minutes

How much of a mess is the table for you to get that?

The query used 12 tables, and one particular table was extremely large with a foreign key to the base table's primary, so adding a nonclustered index on that key made the join faster by orders of magnitude.

It's amazing what proper indices and statistics can do...

I just wrote an minimalist state manager for use with ReactJS (eventually I hope to abstract away the dependency on ReactJS) and put it on NPM

I'm interested in anyone willing to take a look at it and make suggestions.

npmjs.com/package/minimux

...

Thank you. First time in Cred Forums and saw this thread at the top. Didn't realize there was a more appropriate one.

>It's just one standalone .EXE or what?
Yes

>Just use ILSpy or one of those disassemblers.
Like I said, I never coded anything, is it complicated?

Free kiss for anyone who tells me how to access OpenGL in a program without using GLAD
promise legit awoo and not austistic neckbeard

Something like ILSpy will show you a representation of the code in the program.

If you don't know the language, it's not going to help you much.

What exactly are you trying to do? Why are you trying to "crack" this program?

Even if you did see the code, whatever the authentication method may be could rely on server communication, which would be very difficult to work around unless they wrote it very poorly.

>Free kiss for anyone who tells me how to access OpenGL in a program without using GLAD
GLEW
But yeah, there's a wiki entry on it.
opengl.org/wiki/Load_OpenGL_Functions

Is GLEW better than GLAD?
My definition of "better" is "not python scripting with no installation instructions anywhere on the internet".
Also, is the reason why I'd use GLEW rather than that example code because GLEW covers multiple platforms?

Actually, that makes me wonder if GLFL + GLEW means I already have something that works on the three major operating systems.

>free kiss
loli kiss?

>Is GLEW better than GLAD?
You shouldn't use either considering how simple it is to load the functions.
Yes it is better.

So I should just program it in per-platform?
Not that I'd mind including GLEW if it's really lightweight.

>My definition of "better" is "not python scripting with no installation instructions anywhere on the internet".

>include a header
>link a library
>5 lines of initialization and basic error handling
You now have access to OpenGL in its entirety.

should i learn c before c++ or just jump in

github.com/KitFreddura/Kinder

Rust is getting monads.
We are you going full meme.

Why not just move the box with the balls around the big stupid contraption? It's the same on both sides, innit?

just jump in, they're two different languages, learning C first would be a waste of time and could cause problems with getting stuck in the wrong mindset if you want to learn C++

thank you, sir

>KitFreddura
>Freddura
>Fedora

That's for a single platform though; and without testing (which would be hard), I can't be sure it works because I always fuck up my code.

Check the color of the box on the right, it's slightly different.
A monadic bind just replace the box you don't like.

I would start off with C then move to C++ so you get an understanding of what stands under the surface of some C++ constructs.
Learn to appreciate that C is clean, than move to C++ to get more tools and a more complex environment with them.

Want to try c++, but visual studio is to big for me to download with my third world connection. Any suggestions?

eclipse.org/downloads/packages/eclipse-ide-cc-developers/neonr

Thank you, fellow Reddittor. I'm new here and still getting comfortable in my bearings. I did not intend to offend anybody.

...

Emacs, Vim, Sublime, Atom, VS Code, or any of the other bazillion editors out there, and a couple of plugins.
Literally just take your pick and google "whatever editor c++"

download size?

well under a gig

what sorcery?

Vim or die.

Vi Vi Vi is the editor of the beast.

QUICK!

I have a C# interview in 3 hours.

I'm mostly a web guy but I started out doing vb and c# when I was in high school.

Summarize all the important concepts of C#/.NET.

I'll get started
Async programming: threads, background workers, makes your apps run without freezing up. semaphores, locks, mutex.

go.microsoft.com/fwlink/?LinkId=733434

It's a recent thing they did that allows you to just install specific to your needs.

blogs.msdn.microsoft.com/visualstudio/2016/08/22/visual-studio-15-preview-4/

LINQ, LINQ, and LINQ

I see, thanks.

buzzwords, buzzwords and buzzwords

LINQ, NUGET, aspnetcore and maybe stuff like mono if it needs porting over to non-windows environment.

...

LINQ? OK.

what else?

tell them you have used c11 futures because they are better

...

LINQ

thanks, its all coming back to me now

Yes, what?
These are baby-tier features that every self-respecting editor has.

...

MinGW-w64 as your compiler toolchain.

For your text editor... really, whatever you are comfortable with. Many beginners start with Notepad++ on Windows.

LINQ? OK.
what else?

Having to worry less about runtime errors and memory leaks.
Easy package management for external dependencies via NuGet.

The language is explicit and verbose, but allows you to be implicit and succinct if you want to. It's statically typed, but you can do dynamic typing if you want to. It has a GC and code is "safe", but you can write unsafe code if you want to.

Like Java and other object-oriented languages, has many features to encapsulate, abstract, and manage visibility of methods and data throughout your program.

Yes, those are basics.
But you gotta start somewhere..

WPF (MVVM), ASP, dependency injection, ect...

These are baby-tier features that every self-respecting editor has.

anything here dotnetperls.com/

Thanks Cred Forums your a cool guy.

C#.NET has a massive standard library that means you have access to a buttload of things without having to bring any 3rd party libraries with you.

That being said, libraries are easy to get with NuGet, and easily embeddable into a standalone executable with Costura.Fody.

Where can i find tutorials that explain this kind of things? The vim wiki is too vertical.

...

Also, what C# tech is deprecated ? I dont want to mention old stuff and look like a retard.

Completely wrong.
Editors can't have self-respect.

>what C# tech is deprecated
anything that intellisense doesn't autocomplete

Emacs has achieved Self-consciousness

stop trying to force your shitty meme

Linq-To-Sql has been widely replaced by Entity Framework.

WinForms is old and dusty, but is still needed for maintenance and based cross-platform applications. WPF is the most recent non-Store Windows-GUI framework. Now there's UWP (Universal Windows Platform) that will run on 10, XBone, windows tablets and phones.

I can't think of any C# or .NET-specific tech that's really just not used, because there's plenty of applications to be maintained.

You might also want to be familiar with .NET, C#, and ASP versions.

Ah, messed up the title..

It's "visual mode block selection", you start it by pressing [ctrl]+v

Anyway, real cool commands are:

:14,$!sort
(sort lines 14 until end of file)

:% g/del/m$
(move all all lines that contain "del" at the end of the file)

]p
(insert buffer, but align with the line where you insert)

5>>..
(Indent 5 lines three times)


5 [ctrl]+a
7 [ctrl]+x
(increment number under cursor by 5, decrement by 7)


But the power are not the single commands, the power is that once you can chain those pieces together.

Once you have an intermediate powerlevel on Vim, you don't even have any competitors anymore (in terms of speed and productivity).

:qa!

How would I go about just using a straight text editor and compile with gcc?
I used to use visual studio or codeblocks or something but I kind of wanna go down this route. I'm on linux right now but I don't have any experience with this kind of stuff.
I know theres makefiles and stuff but surely I wouldn't have to write one for every project I make right? They seem really tedious to make. I don't know what's standard. I don't know really. What should I do?

First do the vimtutor a few times until you are fluently.

(--> just go to linux command line and type "vimtutor")


Then learn Macros - you can record your actions and replay them, like here:
Then learn some cool "Visual Mode" commands to immediately select the part you want, like here:
When your powerlevel is over 9000, you won't even use visual mode or macros anymore. They are the "intermediate tools". But they are already pretty powerfull.

Basically you learn Vim like C:
1. Get the basics
2. Apply what you have learnt until you can use it fluently.
3. Investigate some fancy new ideas/functions, choose what works for YOU.
4. Goto "2."

why are you making you're life harder?

if its for educational purposes i guess you would learn how the code compiles but other than that, why wouldn't you just use an IDE ?

are you trying to be edgy?

No I just really like things like sublime text. What should I use for linux then?

Vim, just map 'make' or 'gcc -Wall ...etc %' to a key like F5 and you should be fine.

>muh linux
you're trying too hard

Notepad++

Oh, well where would I find someone to do that?

>What exactly are you trying to do? Why are you trying to "crack" this program?
The price is a rip off, I paid for it for a few months and then got scammed by the owner, there is not really an alternative and I got used to using it

>Even if you did see the code, whatever the authentication method may be could rely on server communication, which would be very difficult to work around unless they wrote it very poorly.
I would be willing to pay more if it was that difficult obv.

how is this better than mapping 'run' to a key like F6 in an IDE?

It's not. What's your point?

Here:

>vimcasts.org/episodes/archive/

dont get caught up with this nonsense.
I suggest you first learn how to get shit done and then worry about this trivial ricing edgy shit.

this is not me.

>straight editor+terminal is now edgy

has /dpt/ gone downhill or is this guy an outliar?

new thread when ? :3

If you have to ask like OP, then yeah its considered edgy cuz youre trying too hard

Trying too hard at what?

OP + linux + makefiles
yet he has to ask how do i ....

gcc --help
Or
man gcc

Seriously, it's not that hard to learn a command line tool.

Have you ever met someone having the know how about that stuff just after being born?
Are you retarded?
Why are linux and makefils tryhard?
Are you some kind of refugee from the web dev general?

I guarantee there is a higher percentage of linux users in /wdg/.

Web servers are literally where linux shines.

Just use QT creator, it's a pretty decent ide with a way to enable vim-like keybindings. It also creates qmake files.

> Why are linux and makefils tryhard?
I just told you why, are you fucking autistic?
In OPs context, YES its considered EDGY.

shit man I know most of us have aspergers in this profession but holy shit try not to reinforce the stereotype.

>Are you some kind of refugee from the web dev general?

You don't make any fucking sense, ill go back to whatever i was doing.

you tried.

linux with straight text editors in the terminal is for super leet haxorz, if you have to ask to get spoonfed instead of figuring things out by yourself and with google you're obviously not leet enough

I just realised something I really should have asked because you're probably asleep.
The OpenGL tutorial I'm using tells me to do this to access OpenGL, and this function contains glfwGetProcAddress.

Does it replace any of the code in that link?

Also, I don't understand all the address fetchings in that code. They all require a name, which I do not know.

I also don't know if loading the library opengl32.dll is something I should have to alter for 32 bit and 64 bit machines.

Actually I'll just go with GLEW I guess because I'm a newb.
Unfortunately, I'm so much of a newb that I don't know why CodeBlocks can't see glew.h.

glfw.h, which can be seen, is in CodeBlocks/GLFW/include/GL/glfw.h
GLEW cannot, and it is in CodeBlocks/GLEW/include/GL/glew.h

I guess I could just put it in the same folder as glfw.h but that seems like bad management.

i dont java very often

is there a better way to take in 2 user inputs without using 2 buffered readers? in c++ i would just use fputs or something which i think looks a lot cleaner

BufferedReader IPFromUser = new BufferedReader(new InputStreamReader(System.in));
System.out.println("Enter an IP: ");
String IP = IPFromUser.readLine();

BufferedReader PortFromUser = new BufferedReader(new InputStreamReader(System.in));
System.out.println("Enter an port: ");
int Port = Integer.parseInt(PortFromUser.readLine());

NEW THREAD:

can you read from the same one twice?

buffered readers are reusable

A functor is a type constructor f which takes a type a and returns a type f(a), and has a higher-order-function fmap which allows you to translate a function from a to b to a function of type f(a) to f(b).

Lists are a great example. For any concrete type such as int or float, you can also define a list of ints or floats. In that case, fmap takes a function (say, foo) from ints to floats and returns a function fmap(foo) from lists of ints to lists of floats. What fmap(foo) does in that case is just to apply foo to every element of the list you feed it.

A monad is a functor f, along with two extra functions called pure and join, which allow you to convert a variable of type a to a variable of type f(a), and of type f(f(a)) to f(a), respectively.

Now, properly grokking monads can take a few days since it is usually a new concept that has to sink in, but if say, you were able to learn what objects, classes, and inheritance are, you should easily be able to grok what a monad is in a similar or smaller amount of time.