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

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

Thread replies: 255
Thread images: 21
old thread >>53991003

what are you working on /dpt/?
>>
First for C++ is shit.
>>
working on my weedology essay
>>
>>53995492
fuck off autist
>>
I really want to program something big (5-10k lines I guess) but I have no idea what to make.

What are you guys actually working on?
>>
How do i wrote configure script
>>
File: Untitled.png (2 MB, 1680x1050) Image search: [Google]
Untitled.png
2 MB, 1680x1050
browser #112, as always.
just added ability to show image info at the top corners of images.
>>
Where's my ATS with good syntax, FAGGOTS?
>>
[Error] could not convert '& vectorOne' from 'std::vector<std::basic_string<char> >*' to 'std::vector<std::basic_string<char> >'

How do I fix this?
>>
>>53995524
your ui is garbage
>>
first for hungry but dining hall's closed and my dad was mad at me for spending a thousand dollars on food last semester so i don't want to buy anything
>>
>>53995514

Line count isn't a badge of honor. Your program should be a short as possible (but not codegolf) and solve the problem.
>>
>>53995524
BOTNET
CLOSED SOURCE
DEPRECATED BY BUILT IN 4CHAN CAPTCHA
>>
>>53995524
Please make this open source so we can make UI themes for god sakes. It looks awesome except for that
>>
>>53995514
>>53995572
>>
>>53995566
Do people not know how to cook anymore?
>>
>tfw interning while at school
>they let me work remotely
>I'm burning out really fast

It kinda sucks. I like the job, but I'm one of two developers, and the other one has written about 20 lines of code in 3 months.
I just feel like if I have free time to program, that I should be spending it doing work. And I feel obligated to work hard since I'm basically the sole developer.

How do I not burn out?
>>
>>53995555
ikr.
quads of truth.
but at least the garbage is contained on one screen, instead of spread out over multiple pages.
>>
>>53995546
We told you the solution last thread you fucking idiot. Pass an actual vector, not a pointer.
>>
>>53995106
>>53995149
wew
    uint32_t W[64] = {0};

for(int i=0; i<16; ++i){
for(int j=0+32*i; j<32*(i+1); ++j){
W[i] = W[i] << 1;
W[i] |= msgBits[j];
}
}

was going to use a bitset but this works, I think.
btw reimplementing sha256 to learn
>>
>>53995598
You should work only hard enough to not get fired, anon.
>>
>>53995593
>cooking
>in college
Truly autistic.

>>53995598
>How do I not burn out?
Write 20 lines of code in 3 months.
>>
>>53995572
Yeah, what I meant to sort of convey how long it will take/how much thought it will take. I thought I had a good project idea but i finished it in a few days.
>>
>>53995593
i have a dorm with a minifridge and a microwave. oh and he insists i use his card to buy food, but when i bought $100 worth of groceries (microwave chicken & vegetables and couscous and shit) he got pissed off then too. i eat at the dining hall twice a day i just eat a lot
>>
>>53995492
I know it's fun and edgy to say C++ is shit but after working with both C and C++ a lot. It's got it's uses just like every language.
>>
>>53995524
release when
>>
>>53995649
Yeah template meta programming is the future right? Small programs under 20k lines of code totally need OOP right?
>>
>>53995566
I know the feel man

I wake up late and usually only have 2 meals because that dining hall closes between 9 and 10. I've nearly spent all of my money from my summer job on food and it sucks. I'm just starving at night now
>>
>>53995663
exe? very soon. maybe this week.

code? very long time. maybe never.
>>
>>53995664
you learned some big words there wew
>>
>>53995681
>releasing binaries
>expecting anyone from /g/ other than OSGTP to actually download and run them
nice
>>
>>53995681
Fine. I'll reverse it then release it back here because closing a free piece of software is beyond retarded.
>>
File: big guy eating cake.png (479 KB, 528x647) Image search: [Google]
big guy eating cake.png
479 KB, 528x647
>>53995671
>tfw big boy feels
>>
>>53995695
Name one thing C++ can offer me that C can't that isn't memerater overloading or OOP. C with classes is a thing.
>>
>>53995710
A brain.
>>
>>53995696
idk if anyone uses it, but many already have in the past 5 years, so I'll keep releasing updates just for them.
>>
>>53995722
How can you have a brain if you program in C++?
>>
>>53995710
colon cancer and const being used every other word
>>
What are some "program of the day" kind of easy things I can code, I just started, and want to try to get into a habit of doing at least one thing each day.
>>
>>53995710
Name one thing that C can offer me that ASM can't that isn't memerater "easy for humans to read".
>>
>>53995710
Standard cross platform threading support and smart pointers.
>>
>>53995746
>structs
>typedefs
>can use assembly directly in C
>__FILE__, __LINE__, preprocessor directives
>cross compatibility between architecutres
That's just off the top of my head.
>>
>>53995744
make a calculator
>>
>>53995744
A simple, but function, system shell in C without using the system() function.

If you want more ideas like this just look at various uni cs courses online
>>
>>53995744
HackerRank
CodeEval
>>
working on modifications to a game that uses 1-byte (8 bit), palettized color for its framebuffer.

i want to use a pixel-scaling algorithm to upscale the output, but the algorithms i've looked at (xbr/xbrz) all use 4-byte (32 bit) rgb color.

what's the best (fastest) way to handle this? using a lookup table to translate the single byte values for each pixel into 4 byte rgba values, then running the xbr algorithm, then using a reverse lookup table to go back to palettized single byte values is too fucking slow.
>>
>>53995615
so you had a vector of bools act like a binary value and wanted to convert it to a int?
>>
>>53995781
Exactly what I was looking for, thanks.
>>
>>53995696

I don't download non-free programs.
>>
>>53995791
precompute?
>>
>>53995546
how about you post the relevant code, you stupid fucking retard?
>>
>>53995704
>I'll reverse it then release it back here

so... you think you'll be able to extract the original source code from an exe? good luck with that.
>>
>>53995805
I don't think he's ever charged for it.
>>
>>53995759
None of those are true.
Not all C programs are cross compatible. Strucs and typedefs are still just abstracting a way. Nothing crazy. You can also still do file i/o in ASM.
>>
>>53995710

generics
>>
>>53995811
Are you inbred or did you become retarded over time?
>>
>>53995476
Homework mostly. Since it' data mining and the files take forever to load, I also made a notification beeper in python to let me know when it's done.

import winsound

# You used to debug on Ubuntu
def drake():
freq = [659, 659, 659, 698, 659, 587, 523, 659, 523]
dur = [240, 240, 240, 240, 240, 240, 240, 500, 960]

for i in range(0,len(freq)):
winsound.Beep(freq[i], dur[i])
>>
>>53995805
>>53995819
stop shitposting tripfag
>>
>>53995814
it's true. browser.exe is free. the only cost is
YOUR FREEDOM!
>>
>>53995811
Decompile? No. Disassemble and rewrite? Why not.
>>
>>53995814

I'm talking about libre, not gratis.
>>
>>53995710
leet shit with templates
>>
>>53995815
>Not all C programs are cross compatible
And no ASM programs are cross compatible between architectures, your point?
>Strucs and typedefs are still just abstracting a way.
Why don't you code directly in binary then? ASM is just "abstarcting away"
>You can also still do file i/o in ASM.
Never claimed you couldn't, though it's easier in C.

>>53995819
>Generics
I vomited a little.

>>53995853
>Templates
I vomited a lot.
>>
>>53995824
can't it be both?

>>53995839
>why not
seems like a huge headache to me, but if you're an assembly wiz, go for it.
>>
>>53995868
>I vomited a little.

ur stupid m8
>>
>>53995707
I've been looking for this guy. Sauce?
>>
>>53995889
>seems like a huge headache to me, but if you're an assembly wiz, go for it.

What language is it written in?
>>
>>53995895
https://www.youtube.com/user/JoeysWorldTour
i think he might be the same person as https://www.youtube.com/user/barnacules1 but im not 100% sure
>>53995543
stop anon, you're getting me hard :(
>>
Why is it so bloody difficult to launch a terminal from Atom? Why do the crummy built-in ones not support stdin?
>>
>>53995809
thnx m8 i fixed it
>>
>>53995744
r/dailyprogrammer
>>
>>53996025
fuck off reddit
>>
>>53995841
what the fuck

I thought you totally memed on people that support foss?
or you're being ironic
>>
File: GET MONEY.png (102 KB, 237x232) Image search: [Google]
GET MONEY.png
102 KB, 237x232
Right now, my CPU tripcode search program runs at 311 ktrips/s and this is the fastest I've been able to get it to run on my ancient C2D.

The performance of every thread is limited only by how fast it can print successful matches to stdout.
That means if your search string is too common, like a 1 letter search string, it will actually run considerably slower than if you had searched for a 6 letter phrase.
Of course, this doesn't affect the program if you redirect output to a file.

Now, I could easily make the program dump tripcode matches into a hashmap and have a separate thread deal with with printing results, but if I were to start caching results for a 2 letter search string, my ram usage would go up 15MB every second, including overhead, and I would have to start pruning results indiscriminately
stdout is nowhere near that fast and it would never be able to catch up

Should I just leave it as is?
>>
>>53996041

I actually don't have a problem with FOSS (nor free software, don't confuse the two) at all. I support it 100%.

I just use non-free software because I like muh vidja gayems. If it weren't for that (and, admittedly VS) I'd be using Lingus full time.
>>
>>53996067
>VS
which version? do you use blend?
>>
>>53995796
I wanted to convert a vector of bools, 512 bools long, into 16 unsigned 32 bit ints.
>>
>>53996076

VS "15" Preview for muh C# 7 goodies.

>do you use blend?

Nope.
>>
>>53996025
Thanks, surprised i haven't found this yet.
>>53996032
fuk u
>>
>>53995710
#include <iostream>
#include <vector>
#include <algorithm>
#include <list>

template <typename Collection, typename unop>
Collection map(Collection col, unop op) {
std::transform(col.begin(), col.end(), col.begin(), op);
return col;
}

template <typename Collection, typename unop>
void for_each(Collection col, unop op) {
std::for_each(col.begin(), col.end(), op);
}
int main() {
std::vector<int> vaaI{ 20,24,37,42,23,45,37 };
std::vector<double> vaaD{ 20.344,24.123,37.99,42.123,23.034,45.123,37.34 };
std::list<double> lel{ 0.223, 0.2111, 0334.23 };

auto mp = [](auto k) { return k * 2; };
auto printit = [](auto k) { std::cout << k << std::endl; };

auto lmao = map(vaaI, mp);
auto kek = map(vaaD, mp);
auto ayy = map(lel, mp);

for_each(lmao, printit);
for_each(kek, printit);
for_each(ayy, printit);

return 0;
}
>>
>>53995907
basic
>>
>>53996067
I will say, when you first starting shitposting on /g/ with your trip I was pretty convinced that you wanted to kill everyone who used Linux. idk if you've changed your mind or you were just shitposting really hard at the time
>>
>>53995476
Based OP with good taste.
>>
>>53996175

Mostly shitposting. I've been a linux user for a long time, even before I began shitposting on 4chan.
>>
>>53995710
Smart pointers.
>>
>>53996204
It's worth it just for that shit.
>>
>>53996185
>>53996067
Didn't realize it was shitposting, lol
Guess you're not so bad after all
>>
>>53996204
https://github.com/Snaipe/libcsptr
>>
>>53996317

Thanks, lad. I try.
>>
File: Untitled.png (3 MB, 1680x1050) Image search: [Google]
Untitled.png
3 MB, 1680x1050
>>53995555
>>53995586
is this more to your liking?
>>
>>53995710
threading built into the standard library
lambdas
namespaces
>>
>>53996339
What the fuck am I looking at
>>
Why is building for Windows without using a gui/ide such a horrible experience?
>>
>>53996352
>gui/ide
>guide
shit that's clever, intentional or not


And it's because *nix is the best way and Windows just wanted to be different
>>
File: 1460432554260.jpg (2 MB, 1680x1050) Image search: [Google]
1460432554260.jpg
2 MB, 1680x1050
>>53996339
Like this for fuck sake. Make separates between each comment and the same size text and it's perfect. fug
>>
>>53995868
name 1 thing wrong with templates
>>
File: Untitled.png (808 KB, 840x1010) Image search: [Google]
Untitled.png
808 KB, 840x1010
>>53996462
>same size text
but I really like that feature.

there's not currently a way to suppress the bg boxes for each comment. I guess that could be an option. I still think your image looks worse than mine. all that text runs together.
>>
>>53996078
Made it less readable for you, bro
uint32_t bitfield[16] = {0};
uint8_t arr[512] = {0};
time_t t;
int i;
int j;

srand(time(&t));

for (i=0; i<512; ++i) {
arr[i] = rand() & 1;
}

for (i=0, j=0; i<512; ++i) {
if (!(i & 0x1F) && i > 0) {
++j;
}
if (arr[i]) {
bitfield[j] |= (1 << (i & 0x1F));
}
}
>>
File: tre.jpg (6 KB, 160x160) Image search: [Google]
tre.jpg
6 KB, 160x160
>finally finish implementing all the Telegram API features that I left out a few months back
>literally next day 2.0 API comes out
>>
>>53995476
I hate PHP so god damn much right now
>>
>>53996588
>PHP can't into itself meme
>>
If you have a set of arrays something like:

[2 2] 
[2 3]
[17]
[2 2 5]


And you wanted to iterate over them and "combine" them to get:

[2 2 3 5 17]


what would you guys reckon the best way of doing this?
>>
>>53996774
Literally a Set. Just add them to a Set and it should take care of uniques.
>>
>>53996799
Please look closer at my final array. There can be duplicates.
>>
>>53996774
Of the three original arrays with 2's inside them, which of the 2's are the ones present in the final array?

Which "2" does the first one in the final array corresponds with in the original arrays, and what about the second one too?
>>
>>53996774
There appears to be no logical order the combination follows
>>
>>53996874
>>53996895
The resultant array needs to have the same number of a given value as the array with the highest number of occurrences of that value.
>>
Have you ever made something that is now in use by a ton of people?
>>
File: comfy.png (167 KB, 376x328) Image search: [Google]
comfy.png
167 KB, 376x328
I could enter a hashtable size_value of 1 and none of my data would disappear or be corrupted~

void hashtab_resize(hashtab_t *self, int new_size)
{
/* resizes hashtable in place, regardless of memory location */
hashtab_t tmp;
tmp.table = (linklist_t **) calloc(new_size, sizeof(linklist_t *));
tmp.table_size = new_size;
tmp.items = self->items;
int i; /* copy and re-hash all data from old to new table */
for (i = 0; i < self->table_size; i++)
{
if (self->table[i])
{
linknode_t *node = self->table[i]->head;
while (node != NULL)
{
hashtab_insert(&tmp, node->data);
node = node->next;
}
}
}
hashtab_destroy(self); /* free old one, copy pointers */
self->table = tmp.table;
self->table_size = tmp.table_size;
self->items = tmp.items;
}
>>
>>53996915

Sounds retarded.
>>
>>53996915
Make a hashmap that maps integers you find in the original arrays to their max occurrences of any single array.

After you populate this hashmap by fully going through each individual array (you might need another hashmap or similar data structure to do this correctly), just loop through the keys and put the value # of that key's number in the final list.
>>
>>53997079
This is actually what I was considering doing it just seems ridiculously inefficient. I assumed there must be some better way of approaching it that I was overlooking.
>>
>>53997098
In a very good hashmap implementation, the time complexity of this is would be pretty close to O(n).

If you already know the largest and smallest possible values that the arrays can have, then you can make a fixed-length array with a total of (maxvalue - minvalue) elements, and use that as a fake hashmap that saves some overhead.

If you want to save memory, you will possibly have to use a less time-efficient algorithm.
>>
Calling all fullstack web devs

Is it possible to update a database (mySQL and what not) with a JavaScript function? (i.e. .onclick)
>>
can anyone give me an example on how to use gawk to format data? for example

input: A B C
output C B A


i might be autistic but i cant figure this shit out and google just makes me more confused
>>
>>53997190
Yes. Send an HTML request (can use Ajax to do it asynchronously) and configure that address on your server to do what you want.
>>
>>53996690
IT WAS RETARDED SPAGHETTI BULLSHIT FROM THE ORIGINATOR OF THE SOURCE CODE I WAS REFACTORING

ARGH
>>
Is Lisp worth learning if I don't plan on becoming a mystical enlightened code guru? I think there's a pretty hard ceiling to my competence at anything cerebral because brain damage and shit, but Lisp really interests me. I just don't think I can be a master, and being a shoddy programmer in an intensely revered language seems like it might be a touch worse than mediocre at a more mundane language. I just want to try to evolve from imperative programming.
>>
>>53997278
I would suggest only learning Lisp alongside CISP. I'd suggest reading CISP as well.
>>
>>53997379
ah yes, good ol' Computer and Interpretation of Structure Languages.
>>
What is the general consensus on Codeacademy for learning of the Python language?

Is it pretty much understood to be for beginners? Or could I learn a good deal amount of information on this?

I was thinking of learning this side by side with this book called 'Think Python':
http://greenteapress.com/thinkpython/html/index.html

Although that book's examples seem to be based off of Python 2 and not 3 is that a big deal?

I know some basic Java and I just want to get to starting on a path to being a programmer.
>>
>>53997539
The general consensus on codecademy is that it's a joke (see title of thread). If you really want to get started in programming, read this https://www.nostarch.com/thinklikeaprogrammer.

There's probably a pdf online somewhere. It will help you gain intuition on how programs work. Also, programming in python is a bit of a misnomer considering Python is a scripting language. You can build programs in it, but it will ultimately teach you bad programming habits.
>>
>>53997539
google "learn python the hard way"
>>
>>53997539
>>53997581
Pretty short book took. Worth it. http://thorpsci.weebly.com/uploads/1/7/0/0/17001640/think_like_a_programmer.pdf
>>
>>53997581
>https://www.nostarch.com/thinklikeaprogrammer

Hey not that guy but I come from an Academic Math background and only know scripting languages like R, Python, Julia, and a little bit of Ruby

Is it worth my time learning a Language like Java or C? If so how would I get started?
>>
>>53995746
As if "easy for humans to read" is a trivialality and not a huge boon.

Why should I have to worry about function calling conventions or pipeline stalls unless I absolutely have to?

Knowing assembly only serves me well when my debugging tools don't, or in the rare instances that the compiler did something stupider than I would. Lots of bookkeeping and extra cognitive load for no actual benefit. I'd rather spend that extra time solving problems.
>>
>>53997661
I wan to second this.

I took a year of Java in high school and attempted to learn C++ (but didnt get past the very basics) when I was 13. But I loved it and I would love to be able to make programs.
>>
>>53997661
Stick with C++ and maybe Java if you want to build programs. C is for MAYBE embedded systems and that's kind of it nowadays. It'd be worth it to learn if you really want to know a "real" language and get more seriously into computer science or just simply making programs.
>>
File: yui-hirasawa-k-on-8932-1920x1080.jpg (151 KB, 1920x1080) Image search: [Google]
yui-hirasawa-k-on-8932-1920x1080.jpg
151 KB, 1920x1080
>>53996124
Please no...
>>
>>53996047
hit me up wid ur program

t. 5Ghz latest i7
>>
>>53996047
OpenCL that bitch?
>>
>>53997770
lambda syntax needs to be cleaner, but at least it's double now

Swift however is GOAT
>>
sub union (@_x, @_y)
{
my %x;
my %y;
my @r;
my @keys;

for @_x -> $var { %x{"$var"}++; }
for @_y -> $var { %y{"$var"}++; }
for %x.kv -> $i, $z { @keys.push($i); }
for %y.kv -> $i, $z { @keys.push($i); }
@keys = @keys.unique;

for @keys -> $key {
my $a = -1;
$a = %x{"$key"} if %x{"$key"}:exists;
$a = %y{"$key"} if %y{"$key"}:exists and %y{"$key"} > $a;
while $a > 0 {
@r.push($key);
--$a;
}
}

return @r;
}


Am I doing it right, /dpt/?
>>
>>53997802
there*
-double
>>
>>53997807
my bp is moist
>>
>>53997807
scust
>>
>>53995476
I'm taking a course in C++11, but my prof refuses to install a new edition of Visual Studio so is fucking compilers are from like 2010. What should I do? I already used a C++11 exclusive feature today and we are only 3 weeks into the course.

How do I convince him to install Visual Studio?

How do I get GCC to recognize system("PAUSE"); ?
>>
>>53997909
this has got to be bait
>>
File: 1449186561352.jpg (89 KB, 399x516) Image search: [Google]
1449186561352.jpg
89 KB, 399x516
>>53997909
>How do I get GCC to recognize system("PAUSE"); ?

Oh boy
>>
Why do people hate on C++? What would you rather use... Java? Java's kinda slow. Imagine a Java web browser. That's why browsers are C++ usually.
>>
>>53997919
It's not bait. He's being a total faggot. All he has to do is run a fucking executable to run a FREE version of Visual Studio to get the compiler for Code Blocks.

>>53997926

It's not bait. GCC didn't recognize it the last time I did it.
>>
>>53997909
if you are taking a course in C++11, why wouldn't visual studio be 2015 edition? That has C++11/14 all done
>>
>>53997954
He's being a fag. I asked to submit everything using VS2015 and he said no. He's forcing me to use Commie Blocks, and he doesn't even have a recent Microsoft compiler.
>>
>>53997939
Tard, if your school's computers are networked then it should have AT LEAST a version of GCC with C++11 compiler flags. If it doesn't, your school is a shitpile. If it does, your professor will compile the code on a machine compliant with the school's computers. So that makes you the retard.
>>
>>53997939

1. DON'T use system("pause")
2. If you MUST use the system() function, it's in stdlib.h. But unless your professor is forcing you to use it, don't.
>>
>>53997965
get mingw-w64 and just make a makefile which has enabled c++11/14
>>
>>53997909
On the off chance this isn't bait
>How do I convince him to install Visual Studio?
You don't. Deal with it.

>How do I get GCC to recognize system("PAUSE"); ?
For what purpose? If you're doing CLI stuff and it's closing right away, either run your program through the command line, or end it with some shit like "press any key to continue", then wait for a key press.
>>
>>53997965

Code Blocks doesn't use MSVC. This is a good thing. MSVC is shit and you should feel bad if you like it.
>>
>>53997965
You know c++ files aren't IDE specific right? It's compiler flag specific. Hell, the syntax difference even between clang++11 and g++11 are basically null. If you're taking a class in C++11 (never heard a class teach a specific version) then you will submit code that runs on C++11 FUCK.
>>
>>53998004
MSVC is based though, most complete C++14 and has modules as well
>>
>>53998012

>most complete C++14
Doesn't even support extended constexpr. GCC and Clang both have better C++14 support.
>>
>>53997981
I had tons of problems with GCC and Code Blocks, which is why I started using Visual Studio. I don't care what I use as long as it works.

>>53997988

Okay, but why don't I have to include stdlib.h when using a Microsoft compiler?

>>53997990

He wants to click and run the files, so I don't think makefiles would be good here.

>>53997998

No some of the programs just exit when you run them from an IDE. That's why I'm using system("PAUSE");.

>>53998004
Code Blocks can run any compiler installed on my system. Do you really think MSVC is bad for Windows development, which is what I'm doing. It's the best tool for this.

>>53998006

The textbook is C++11. His Microsoft compilers are out of date.

Since both of us are on Windows I see no reason why I shouldn't be using MSVC.
>>
>people not using the GCC toolchain for C/C++ work

This always baffles me.
>>
>>53998034
cool you saw the page and picked one, extended constexpr is planned for 2015 update 3
>>
>>53998059
>>Okay, but why don't I have to include stdlib.h when using a Microsoft compiler?
Because MSVC is fucking garbage.
>>
>>53998034
>extended constexpr
I haven't touched C++, but what the fuck is an extended constexpr?
Is it a constant that's extra const-y?
>>
>>53998078
Careful with that edge. My beloved video games are compiled with MSVC.
>>
>>53998059
Use GCC for fuck sake. MSVC is absolute out of date ass.
>>
>>53998034
https://www.visualstudio.com/news/vs15-preview-vs#Cdoubleplus
>>
>>53998094
It came out last year so I don't think it's out of date.
>>
>>53998096
Oh man, they managed to add a feature that was planned and standardized over three years ago on March 30th. Good job, Microsoft!
>>
>>53998094
>absolute out of date ass.
This was true a few years ago, but it's only lacking 1 or 2 C++14 features now, and they're adding all that shit as well as C++17 stuff soon
>>
>>53998110
and gcc added it in 2015, but didn't matter since most people use the old GPLv2 gcc ;)
>>
>>53998104
http://www.yosoygames.com.ar/wp/2013/12/microsoft-we-need-to-talk-about-visual-studio/
>>
>>53998110
>It's out of date
>No it's not
>WOOOOW THEY ONLY JUST ADDED IT
I don't get it, you tried to argue that it was out of date and you got proven wrong. No need to get desperate, just accept that you're wrong buddy.
>>
>>53998094
>>53998116
C support is still laughably bad though.
>>
>>53998128
>2013
so outdated
>>
>there are people on this board who use anything but C99
>>
>>53998147
> not using C11
>>
File: doQubMU.jpg (66 KB, 540x533) Image search: [Google]
doQubMU.jpg
66 KB, 540x533
I learned python with this https://automatetheboringstuff.com/ this weekend and I'm at the "reading and writing files" part.

I sidetracked and wrote a little program that look through your whole music library folders and suggests a random song. It then asks if you would like another option.

How would I get into GUI stuff so I can make it more user friendly and beautiful. Having a little .exe would be really sweet too but I don't know how to do that either yet.
>>
>>53998141
nobody cares about C though, those that do don't bother with the "new C standard"
>>
>>53998059
>why don't I have to include stdlib.h when using a Microsoft compiler?
Because it's allowing you to get away with non-standards compliant code. A reasonable compiler should throw an error because you're using a function that has yet to be forward declared.

>Do you really think MSVC is bad for Windows development, which is what I'm doing. It's the best tool for this.
Aside from having worse support for C++14 standards, the produced code generally tends to perform worse on benchmarks compared to GCC. It's not the best compiler, it's the worst.

>>53998088
It means you can do things like for loops inside of constexpr functions.
>>
>There are people here who use anything other than C89
How to spot the hobbyist "programmer"
>>
>>53998173

>not using the latest standards of a programming language
>>
the new C standard is pretty much Plan9 C for OS and Go for applications/services
>>
>>53998186
does any compiler even support C11 threads.h yet?
>>
>>53998186
ISO...
>>
>>53998160
Do you have a source for your claim that GCC compiled C++ code performs better than MSVC compiled C++ code on Windows? I find that hard to believe given that GCC relies on MinGW just to run on Windows at all.
>>
>>53998189

None that I know of, but it's considered an optional feature anyways. Plus pthreads works on Windows (and is included with some distributions of mingw out of the box), so you really don't need threads.h.
>>
Is it even possible to install MSVC without the 30GB of visual studio runtime garbage?
>>
>>53998210
>Plus pthreads works on Windows (and is included with some distributions of mingw out of the box),
Yes but with an inconvenient license, especially considering those distributions tend to link their pthreads library in to every generated executable.
>>
>>53998205
see >>53998128

It's a Dec. 2013 article, but you'd have to imply Microsoft has changed anything since then.
>>
>>53998213
look up Visual Studio "15"
https://blogs.msdn.microsoft.com/visualstudio/2016/04/05/visual-studio-15-installing-just-what-you-need/
>>
>>53998218
you don't need to imply, they have already changed since then
>>
>>53998151
https://wiki.python.org/moin/GuiProgramming

You can develop using almost any of the GUI libraries, most of them have python bindings.
tkinter is in the stdlib, but it produces ugly shit, though you could start with it.
If you want to go straight to the big guns, I'd go with either wxPython for wxWidgets or PyQT for QT.
>>
>>53998059
>learning a language with an IDE

Big mistake. Use an IDE when you're a good programmer and you need to program large applications, not sheep counters.

Only thing you should be using is a text editor, a c++ compiler, and a command line.
>>
>>53998218
Can you read? I asked you for a Windows to Windows comparison. This article is a Windows to Linux comparison.

Can you do better or are you just going to admit that you were talking out of your ass?

>>53998252

Why? So I can't read the error messages easily? There is almost no difference between using an IDE as simple as Code Blocks and the command line. My course also requires me to use an IDE, so your suggestion is stupid for more than one reason.
>>
>>53998205

It's a year old, but I don't think MSVC has had a ton of serious performance increases in such a short amount of time.

http://www.blosc.org/blog/hairy-msvc-situation.rst.html

Also:
>I find that hard to believe given that GCC relies on MinGW just to run on Windows at all.

MinGW isn't Cygwin. You're not creating a bunch of fake POSIX system calls that fuck with performance. MinGW is a toolchain for building native Windows applications.

>>53998215

It's not that inconvenient. It's got a runtime linking exception, so you can still use it in your proprietary software, as long as any modifications you make to winpthreads are contributed back.
>>
/dpt/ my only job experience is in web dev but I want to get out of that because I realize it has no job security

I have a BS in CS, what kinds of jobs can I potentially get that are safer?
>>
>>53998296

>My course also requires me to use an IDE
Shit university. Find another one.
>>
>>53998301
that uses visual studio 2013, not 2015
and you can see some of the old 2015 dev blogs they have done
https://blogs.msdn.microsoft.com/vcblog/2014/11/12/speeding-up-the-incremental-developer-build-scenario/
>~30% faster with VS2015 Preview.
>>
>>53998296
It's a compiler comparison retard. Thinking a compiler will act significantly different between operating systems is significantly retarded.
>>
>>53998301
It says right in the article that they were testing on a program originally designed for Linux/OS X and that that is what the developers are familiar with. I would like to see some better benchmarks using generic programs.
>>
>>53998356
Thinking it won't act significantly differently is a much more worrying sing of mental retardation.
>>
>>53998296
Clang has fantastic error messages

>My course also requires me to use an IDE, so your suggestion is stupid for more than one reason.

You mean to tell me they don't discourage you from using IDEs? What kind of school do you go to
>>
>>53997692
Can someone respond to this?

I took a year of Java in high school. Perhaps Java is a good start on an actual programming language? I know I have to learn all kinds of languages and I know that what I want to do will change as my knowledge grows, but I also like a good start on making programs. A plus side is that I could also find a job in it, can I? Or am I wrong?
>>
>>53998400
You can develop the project however you want, but it has to be submitted with Code Blocks.

I haven't had to deal with the command line meme since first year.
>>
>>53997692
see >>53997720
>>
>>53998451
>but it has to be submitted with codeblocks
wat... do they check for cbp files or something? What the fuck cut rate DeVry ass school do you go to?
>>
>>53998442
Java is fine but it's a really bulky language. If you want to learn do Python, else do C.
>>
>>53995515
You get a rusty bar of metal with shards sticking out of it and you stick it as far up as possible inside your ass.
At least that's all I recall from the last time I tried to use GNU autotools.
>>
>>53998468
It's unusual, and it's just this course. All the other programming courses I have taken here have just been code oriented, not IDE based.
>>
>>53998484
No, no, no, you can't quite shove the rusty metal bar into your anus yet. You haven't summoned the m4 macro processor through the detailed ritual yet! First, you must sacrifice your firstborn child to RMS, then, gather the blood of Dennis Ritchie and Brian Kernighan. Place these objects around a pentagram made from ground up GPL licence paper, and then violently rape your code with macros.
>>
If I do web dev will I be out of a job in 5-10 years when all the post-millenials who learned coding in middle school flood the job market?
>>
why is this giving me "set property 'value' of undefined" error?

        var pieData = [];
for (i = 0; i < json.length; i++) {
console.log(json[i]['size']);
pieData[i]['value'] = json[i]['size'];
// console.log(json[i]['size']);
}
>>
>>53998537
what's the object you're calling json? why are you calling it json? call it something memorable/useful.
>>
>>53998562
what does this have to do with the problem?
>>
>>53998537
Because your json entry doesn't have a 'value' entry.
>>
>>53998573
if i knew, why would i ask?

but if you're going to be dodgy about it then i'm sure someone else with more patience will come by and help, so don't worry about it.
>>
>>53998600
ah snm senpai
>>
>>53995744
Try contributing to rosettacode.org if you want to feel like you're actually achieving something useful.

>>53998519
Yes, in 5-10 years web dev will devolve into a drag/drop copy/paste clusterfuck run by SJWs. Get out while you still can.
>>
>>53998484
>GNU autotools
I'd rather write a configure script myself.
>>
>>53998607
christ you sound insufferable

never respond to me im closing this thread and getting the last reply in.

goodbye sweetie x :)
>>
>>53998573
protip: if you're going to ask a stupid stackoverflow-y question, at least provide enough code that we could run it and replicate the problem. don't just assume that you've ruled out causes. you don't need to give the original data, but pare down the code to the most simplified version that still causes the same error.
>>
>>53998624
please try to get over your obnoxious entitled shit. you're the reason people hate javascript folks.
>>
>>53998469
>do C

Why should ANYONE do C i nthis day and age? If you're not doing it out of nerdism or because you want to write embedded software, I don't know honestly.
>>
>>53998808
>i use a library language and i've never written my own library functions
>>
>>53998624
>christ you sound insufferable
It's a common problem in programming circles. Autists and social outcasts read "only the code matters" and they flock around that. And then they don't notice that a lot of the problems in programming aren't of a technical nature, but a social one. Which they can't handle. And then they're pissed.
>>
>>53998883
>people are more important than code :^)

(You)
>>
Say I'm running two threads concurrently and I want one to get more time with the CPU than the other. Is there a way to achieve this without putting it to sleep? I need the "short" thread to run somewhere around 100 times per a second, which makes sleep give inconsistent results. I want the "long" thread to run the rest of the time.
>>
Hey /dpt/,

I am new to programming, does someone got that list with /g/ programming challenges for me
>>
Am I going full retard making my own makefile from scratch? It's tedious but it just werks
>>
Why does 2+2=5986?
>>
File: fuckingimage.png (302 KB, 1920x1080) Image search: [Google]
fuckingimage.png
302 KB, 1920x1080
>>53998957
>>53998618
>>
>>53999178
Thank you, also sorry for this but rolling for a challenge :/
>>
File: 1453542938321.png (378 KB, 1450x1080) Image search: [Google]
1453542938321.png
378 KB, 1450x1080
>>53998957
>>
>>53998957
>>53999178
>>53999188
>>53999193
You retards realise there is an archive? And google?
http://better-dpt-roll.github.io/
>>
In C++ when designing a class, if my constructor is called with data I wish to be invalid, what should I be doing? Calling the destructor? Throwing an exception or something(I have very little idea what this actually is)?

As an example, I'm designing a class to store the date, data members are three integers, year, month, day. I want to make it so that objects cannot be constructed with a month outside of 1-12. I thought of using an if-else, but that just constructs an empty object if an invalid value is initialised to a data member.
>>
>>53999204
whats a google?
>>
>>53999206
>I want to make it so that objects cannot be constructed with a month outside of 1-12.
Use a programming language that solves that problem for you by allowing subtypes.
>>
>>53999218
>Use a programming language that solves that problem for you by allowing subtypes.
I don't have a choice in the matter, it's for a course
>>
>>53999228
In that case throw a self-defined exception. Or pick one of the predefined ones that kind of fit.
>>
>>53999249
Alright, thanks.
>>
>>53999204
I didn't know about this, thanks for the link!

>>53999188
You have half an hour to finish the challange and post results here so we can critique your work. Time starts... NOW!
>>
>>53999264
sorry but I have school right now I needed something to think about besides schoolwork.
I am very new and not able to finish this with research.
>>
Is it bad practice to employ flow control statements inside constructors?

If so, can this be mitigated by calling a member function inside the constructor that would house the flow control statements? C++
>>
>>53999347
I can't see how it would be bad practice, there's more than one way to skin a cat.
>>
>>53999347
depends what you are doing
>>
Learning Java.
I am tutorial wise on control flow.
I want of these japanese cartoon women to be real and tell me to use their mouthpussy to relieve my stress.
>>
>>53999377
Me neither, I just got told that by classmate. I couldn't find any stackoverflow questions about it either.

>>53999439
Just some basic checks to ensure that data that I want considered as invalid for initialization of my class data members doesn't get initialized. Instead if the user tries constructing with invalid data I'd just force initialize a default value instead.
>>
>>53998537
var json=[{size:1}];
var pieData = [];
for (i = 0; i < json.length; i++) {
console.log(json[i]['size']);
pieData[i]['value'] = json[i]['size'];
// console.log(json[i]['size']);
}


TypeError: pieData[i] is undefined
>>
>>53998947
That does not look like a task for threads at all.

Anyway, use a timer. Run your first code exactly 100 times per second.
>>
>>53998947
seems weird don't you think, if you wanted one to be used more then just let it run before starting the other (i.e. no concurrency). Or start it later (like after some time has passed)
>>
>>53999461
yea that's ok
>>
>>53999516
Could you give an example of when using flow control in constructors would be bad? Just so I can make a note and watch out for it later.
>>
>>53999479
Actually you're completely right. There's no reason to use threads in this situation. I originally wanted to use threads so that the program runs well no matter how many cores the user has but it is far better to just call different functions if the user's computer has multiple cores.
>>
What screen size is ok for programming?

I was thinking about 22"-24"? What are good/cheap monitors in that range?

Games and movie watching is a plus obviously
>>
>>53999541
People used to program with really small screens you know.
>>
>>53999347
>>53999524
The statement is bogus. You are completely free to use control flow statements in constructor.

It is not proper to call virtual functions in constructor for and it is not proper to throw exceptions in destruction.
>>
>>53996498
Them existing.
>>
>>53999541
I used 18.5 720p monitors some time ago, they're ok, look for whatever is cheaper in 1080p (21.5,22,23.6,24 whatever)
>>
File: carmack_at_work_full_hd_crt.jpg (37 KB, 520x254) Image search: [Google]
carmack_at_work_full_hd_crt.jpg
37 KB, 520x254
>>53999541
Any size is ok for coding, but with widescreen you can edit two files side-by-side, which is handy.
>>
>>53997413
Have you read your SPIC today?
>>
>>53994577
literally disgusting. kill yourself.
>>
>>53999541
don't cheap out on monitors. good ones will last you 5+ years before the next time you upgrade. get 1440p or higher resolution, IPS panel, needs to have a stand that can switch to portrait mode. and get multiple monitors if you can afford it.
>>
>>53995710
Static polymorphism.
Thread replies: 255
Thread images: 21

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

All trademarks and copyrights on this page are owned by their respective parties. Images uploaded are the responsibility of the Poster. Comments are owned by the Poster.
If a post contains personal/copyrighted/illegal content you can contact me at [email protected] with that post and thread number and it will be removed as soon as possible.
DMCA Content Takedown via dmca.com
All images are hosted on imgur.com, send takedown notices to them.
This is a 4chan archive - all of the content originated from them. If you need IP information for a Poster - you need to contact them. This website shows only archived content.