[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
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: 40
File: it's a trap.png (873 KB, 1275x677) Image search: [Google]
it's a trap.png
873 KB, 1275x677
Previous - >>55024124
>>
>>55033213
D
>>
Please do not use an anime image next time, thank you.
>>
first for rust
>>
File: moot.jpg (85 KB, 1024x512) Image search: [Google]
moot.jpg
85 KB, 1024x512
>>55033231
Where Do You Think You Are?
>>
>>55033231
Why not?

anime = better programming
>>
>>55033213
9th for Go

>>55033246
man, even without GC, Rust is slow...
>>
>>55033300
>600KB hello world
>>
File: giphy.gif (905 KB, 240x228) Image search: [Google]
giphy.gif
905 KB, 240x228
>could your write a batch script so i can download my files?
>>
Continuing to read through Intel's developer manuals
Probably not going to remember half the shit I read, but I actually find it kind of interesting
>>
>>55033332
wow, how terrible man, people will be left without disk space for installing Go programs!
>>
an improved f#
https://github.com/gmpl/FSharpPlus/
>>
++*current->value;


Why does this not work in C and how do I get it to work? It works in C++.
>>
>>55033339

Why not use a Powershell Script instead?
>>
>>55033797
Did you try parentheses
>>
>>55033797
What type is current?
>>
Can't wait for you faggots to quit crying about inane shit
>>
>>55033898
>anime
I never said anything about anime. That's why I took it out of my meme arrows.
It was only the himegoto fag for the last several months, and the bailey jay degenerate a couple of months before that.
You fags seriously cannot get any more delusional.
>>
>>55033941
Then what's your problem with images that happen to be traps? Women can't fucking program even in anime
>>
>>55033928
Some traditionalist alt-right Republican faggot got triggered because there's a "degenerate" trap here and because 4chan likes anime. He discovered /g/ two months ago and doesn't know these things are common.

Now he keeps samefagging his salt and won't shut the fuck up.
>>
File: aaaaah.jpg (35 KB, 400x400) Image search: [Google]
aaaaah.jpg
35 KB, 400x400
>>55033928
>Only republicans are allowed to dislike degeneracy

OH BOY
>>
>>55033978
>m-muh values
>stop it u degeneroots
Stick your bible up your ass.
>>
File: kek.gif (3 MB, 286x258) Image search: [Google]
kek.gif
3 MB, 286x258
>>55033951
>Complains about "bigots" shitting up threads with homophobic and anti-anime sentiments
>Is openly misogynistic

Stay classy /dpt/
>>
>>55033797
It does work in C.
>>
File: Noa-chansBattlestation_gAsFuck.png (757 KB, 1280x720) Image search: [Google]
Noa-chansBattlestation_gAsFuck.png
757 KB, 1280x720
>>55033213
First off, thank you for using an anime image. Ignore normies like >>55033231 who wouldn't have been caught dead on 4chan in 2007 when /g/ was techloli/g/y and /b/ and /x/ had actual disturbing content.

>What are you working on, /g/?
Figuring out how to write a script in Bash & Python that will get the 5 most recent anime episodes from my Videos folder, insert them into my main playlist file w/ (hopefully) the correct syntax & all, and then execute the playlist for me w/ mpv.

Not much else that I can think to automate. Regardless, automation & scripting is important skill if I want to be a sysadmin.
>>
File: 12576815649.jpg (144 KB, 349x463) Image search: [Google]
12576815649.jpg
144 KB, 349x463
>>55034079
>thank you for using an anime image
You're welcome anon
>>
I need to discipline myself to learn C, gaymes keep getting in the way!
>>
>>55034096
>>>/a/
>>
>>55033797
Just to actually be clear (and spoonfeed you) the -> operator is performing an additional dereference.

Therefore that line is equivalent to:

++(**current).value;
>>
>>55034113
What parts of C do you need help with?
>>
>>55034129
No it's not. It's equivalent to
++(*((*current).value));

with extra brackets added for clarity.
>>
>>55034129
Nevermind, it's
++*((*current).value)
;
>>
File: turtling.png (126 KB, 795x717) Image search: [Google]
turtling.png
126 KB, 795x717
>pic related
Has programming gone too far?

>>55034134
false flag
>>
>>55034155
Yeah I tried to leave out redundant brackets before I realised it wouldn't function the same.
>>
>>55034129
>Therefore that line is equivalent to:
>++(**current).value;
No.
-> has higher precedence than *

It's equivalent to:

++(*((*current).value));

I.e it increments the pointed-to data of value.
>>
>>55034129
>>55034159
>>55033797

C was a mistake
>>
>>55034160
but why
>>
>>55034186
It's already been corrected, twice.

If you guys are so sharp on your C syntax why did you wait for me to bait... I mean post an accidentally incorrect solution?

You wouldn't be some kind of unhelpful cunts who only post to correct others and feel smug would you?

>>55034197
>Some idiot chooses an example with godawful structuring and can't work out why it's failing
>Somehow Cs fault

Seems legit.
>>
>>55034220
C should make illegal any expression involving more than 2 operators without parentheses
>>
>>55034230
If you don't know the language's operator precedence rules you should not be allowed to program.
>>
>>55034220
>You wouldn't be some kind of unhelpful cunts who only post to correct others and feel smug would you?
I tried to help the original asker, but to make sure I was totally correct, I asked for the type of 'current' (value might be a pointer).
He didn't respond though.
>>
>>55034230
Or you know, just include in the coding style that people should always use brackets to make things as clear as possible. Oh wait...

From the fucking original K&R it suggests leaving a space before and after all mathematical operators too, and yet you still see faggots leaving them out because they want to save columns.

People will always do stupid shit, not making the C syntax as strict as fucking possible was not the worst by a long shot.
>>
>>55034230
>>55034278
>>55034284

Reminder that REAL whitespace based languages are the only solution

5*3  *  4+6         /2

= ((5*3)*(4+6))/2
>>
>>55034279
If they don't know why a relatively simple dereference chain doesn't work, what makes you think they'll be sure what the type is?
>>
At what point do tables start becoming a problem due to number of rows? I'm using Postgres.

I'm working with a table right now that stores surface observations for weather:

Columns:
id(int/pk)
valid (datetime)
air_temp(float)
dew_point_temp(float)
sea_level_pressure (float)
wind_dir (int)
wind_speed (float)
sky_condition(string)
precip_duration (int)
precip_total (int)

I'm currently ingesting historical records for US/CA for 2001, maybe 1/5 through it and sitting at 2,100,000 rows. I was hoping to get 1980->Now but i'm not quite sure how it would handle that.
>>
>>55034035
No it doesn't. I had to dereference it to get it to work.
>>55034129
In C++ it works fine though.
>>
File: snoop.gif (2 MB, 350x197) Image search: [Google]
snoop.gif
2 MB, 350x197
>>55034301
That's disgusting.
>>
>>55034317
Either post your declaration of current or stop baiting.
>>
>>55034322
4+3
2*7
 = (4+3)/(2*7)
>>
>>55034301
Postfix is the master race:

5 3 * 4 6 + * 2 /


Zero ambiguity, 100% consistent, easy to parse and evaluate by machines.
>>
>>55034317
>No it doesn't
Yes it does.
>>
>>55034344
And what happens if you triple stack them, how does it work out the precedence then?

Checkmate athiests
>>
>>55034359
No it doesn't. Which is why the compiler gave errors until I changed it.
>>
>>55034366
It evaluates to a vector
>>
>>55034380
A vector with various operators between its values?

Seems legit.
>>
>>55034378
http://ideone.com/loAur5
>>
>>55034113

Use C to make games. Playing your own games will make debugging fun. It will also make playing games suck.
>>
>>55034396
You made that a pointer to int. It doesn't work if you have a pointer to struct that contains an int unless you deference.
>>
File: sleep-blog-post-img.jpg (408 KB, 1000x667) Image search: [Google]
sleep-blog-post-img.jpg
408 KB, 1000x667
what time do you guys got to bed and wake up?

are you always programming?
>>
>>55034438
It's 2:56 am here
>>
>>55034426
>You made that a pointer to int.
Obviously since that's what the expression implied.
If the struct member is not a pointer it should look like this:

++p->value
>>
>>55034426
Still waiting for your declaration of current you shitposting doublenigger
>>
>>55034456
In C++ it's different though. If you have a pointer to object that contains an int, to increment it with pointer notation, you need to use ++*objectptr->intvar.

In C when I make a pointer to struct with an int I can't use ++*structptr->intvar.
>>
File: out.png (94 KB, 640x480) Image search: [Google]
out.png
94 KB, 640x480
>tfw created a text drawing library from scratch
>tfw also used your own BMP encoder/decoder
>>
>>55034491
There's no difference between C and C++ in this regard (unless you've overloaded -> or * to return a different type from what's generally expected)
>>
>>55034438

Do I have school/work? 7:20 AM wake up, 12-1:20 AM sleep.

Otherwise... whenever.
>>
Hi 4chan.. autistic question here... does anyone know why CW_USEDEFAULT is define as 0x80000000 but read as 128 decimal (is readed backwards)... but when i define in my own console app it is readed forward...
>>
>>55034537
But I didn't. So I'm guessing that in C++, at least with objects, *objectptr->intvar is the equivalent of dereferencing to intvar's value.

While in C it's the equivalence of dereferencing intvar.
>>
File: 1465532257927.gif (738 KB, 500x325) Image search: [Google]
1465532257927.gif
738 KB, 500x325
>>55033803
>powershell
>>
>>55034589
In both language it dereferences the pointer intval inside a struct pointer.
>>
>>55034598

It's better than Batch.
>>
>>55033803
Why not jam your dick in a vice and tighten it until you hear a snap?
>>
>>55034634
dry shit vs wet shit.
>>
>>55034133
I dont understand pointers mostly
>>
>>55034681
They're just memory addresses
>>
File: 1q2wedfghn.jpg (359 KB, 1172x894) Image search: [Google]
1q2wedfghn.jpg
359 KB, 1172x894
>>55034681
everything you need to know about pointers

pic related
>>
File: lrg.jpg (135 KB, 500x656) Image search: [Google]
lrg.jpg
135 KB, 500x656
>>55034681
>>
>>55034651

Well, the fact that anon wants a batch script obviously means he wants some sort of scripting language he can use on his Windows machine without having to install something else, like Ruby or Python. Powershell, while not the best shell language, is relatively tolerable to program in, and completely obsoletes batch, so long as you don't need to program for a Windows XP or earlier machine.

>>55034637

What language would you use for shell scripting on a Windows machine?
>>
>>55034681
Learn some assembly and pointers will become obvious.
>>
>>55034711
It's made for down syndrome programming enthusiast or something?
>>
>>55034731
I would rather setup mingw than deal with native windows scripting, yuck.
>>
>>55034748
yes, its for you.
>>
>>55034681
read a computer architecture book so u understand how memory works and why pointers exist
>>
pointers r fuckin gay
>>
>>55034817
Ok, now it's time to bed little boy!
>>
>>55034748
>It's made for down syndrome programming enthusiast or something?
What makes you say that?
It looks like a pretty well-made introduction.
>>
>>55034754

If you aren't the one who administrates the system, you can't always install new software to get the job done. If you want to write code on a Windows system which you do not have control over the available installed software, your available tools are Batch, Powershell, VBScript, VB.NET, JScript.NET, C#, and JavaScript (in browser).
>>
>>55034846
But he's right, they are.
Why do you think so many C programmers are cross dressers?
>>
What language is clover written in? I want to mod it so that I get push notifications when I get a (You)
>>
>>55034870
>so many
>[citation needed]
>>
>>55034899
/dpt/ is the proof
>>
>>55034858
If you aren't the one who administrates the system, you probably can't run Powershell scripts either.

Did you start using windows yesterday, or was it the day before that?

>hurrdurr use one of the other tools
None of them are installed by default, explain plain old batch. Why the fuck else do you think anyone still uses the godawful thing?
If you can get admin to install any of the others, you can get them to install mingw.
>>
>>55034918
back to 9gag
>>
im burning out on learning c dpt-chan, what do I do? I have k&r next to me but I'm just so low on motivation
>>
>>55034955
Giving up is always an option
>>
>>55034945

>If you aren't the one who administrates the system, you probably can't run Powershell scripts either.

set-executionpolicy unrestricted -scope process


>None of them are installed by default

Windows comes with .NET installed by default. Every .NET installation on Windows comes with csc.exe, vbc.exe, and jsc.exe.
>>
>>55034878
java dude
it's an android app, go look at the github ffs
>>
>>55035090
>Windows comes with .NET installed by default

Which versions of Windows? Since when? Are they even secure enough to stand up to a 10 year old skiddie?
>>
>>55034612
I didn't get a compiler error in C++.
>>
>>55035256

Vista comes with 2.0 and 3.0 by default
7 comes with 3.5 by default
8 comes with 4.5 by default
10 comes with 4.6 by default

https://blogs.msdn.microsoft.com/astebner/2007/03/14/mailbag-what-version-of-the-net-framework-is-included-in-what-version-of-the-os/

If you look in C:/Windows/Microsoft.NET/vNUMBER/, you'll find a number of binaries, including csc.exe, vbc.exe, and jsc.exe

>Are they even secure enough to stand up to a 10 year old skiddie?
This is Windows we are talking about.
>>
File: 1437744747922.jpg (80 KB, 482x424) Image search: [Google]
1437744747922.jpg
80 KB, 482x424
So why did crossdressing become associated with programming on /g/?
>>
>>55035326
Then your C and C++ code isn't identical.
>>
>>55035388
Obviously when we realised that it improved programming skill
>>
>>55035380
>This is Windows we are talking about.

Well I wouldn't ask otherwise :^)
>>
>>55035388
It's just a forced meme.
Ignore it.
>>
>>55035388
When moot proved he was a faggot and attempted to "stamp out" gamergaters.
>>
>>55035511
If only he'd succeeded
>>
I feel like programming is awesome, but also painful. how do you guys make it fun?

also, as a kid, I used to eat books (both technical and fiction). for some reason, I barely read books anymore (although I read a lot, random articles and stuff)... how do you manage to read technical books without raging because of the buzzwords? also, do you fags read fiction?
>>
>>55035587
Practice and experience
>>
>>55035587
>how do you guys make it fun?
By writing programs that you actually want to use. Also, I think the languages/tools you use have an effect on fun. I find shit like Java to be stifling to write.
>how do you manage to read technical books without raging because of the buzzwords
By taking the effort to learn those words.
>do you fags read fiction?
No. Occasionally I read some mango, but that's pretty rare.
>>
>>55035747
>I find shit like Java to be stifling to write.

What do you prefer?
>>
>>55035190
Sorry I don't really have much experience but I need those sweet, sweet replies
>>
>>55035783
C, Rust, Lua, Bash. I find them all fun for different reasons though.
>>
>>55035806
>Java is stifling
>t. Rust

Go to hell
>>
>>55035820
Java is stifling

t. C++, D, Haskell, F#
>>
>>55035820
Rust doesn't force the OOP meme on you. Also it has lots of novel features, which are fun to use, at first.
The ownership system can be a huge pain in the ass though.
>>
>>55035858
>The ownership system can be a huge pain in the ass though.

Yes, that is the stifling part.
>>
So newbie assembly man here. So I've got it opening a file, and when the files opened it tosses each line into a list in c++.

I then want to take each line and parse through it, clearing out spaces, all comments (anything past a //) and basically storing each value as it's own pair in a new list so.

 .text
addu $s0,$zero,$zero //whatever
addu $s1,$zero,$zero
addiu $v0,$zero,5
syscall
sw $v0,n($gp)


as placed in the std::list gets seperated and filed according to it's segment. So Instruction (addiu, j, sw, syscall) gets gets stored as an instruction, $v0, n, $gp, get stored as arguments to that instruction, and together they form a new element in a different container based on (instruction, argument, argument, argument).

tl;dr version: Can I use an array for list elements when converting and parsing. So List<int[3]> ParsedFile?

Here's my code

#include <iostream>
#include <string>
#include <sstream>
#include <stdio.h>
#include <fstream>
#include <list>
using namespace std;

/*typedef struct Line
{ //stores string after upon parse

}*/

int main(int argc, char* argv[])
{
list<string> asmFile;
string filename;
string line;
ifstream inData; //open ifstream for file input
cout << "Enter file name : ";
cin >> filename;
inData.open(filename.c_str()); // open file
if ( inData.is_open() )
{
cout << "File successfully opened." ;
while (getline(inData, line))
{
asmFile.push_back(line); //Puts file into a list (asmFile) by each newline
}
//**Displays list for debugging/clarity**//
/* list<string>::iterator i;
for( i = asmFile.begin(); i != asmFile.end(); ++i)
cout << *i << endl ;
cout << endl; */
list<string>::iterator i;
for( i = asmFile.begin(); i != asmFile.end(); ++i)
{
}
}
else
cout << "**File not found**" ;
}
>>
File: 91i328.jpg (142 KB, 740x740) Image search: [Google]
91i328.jpg
142 KB, 740x740
>>55035917
>std::list
>>
File: vomit.jpg (90 KB, 650x650) Image search: [Google]
vomit.jpg
90 KB, 650x650
>>55035922
>>55035917
>C++
>>
>>55035922
>>55035926

I don't feel like, nor do I really have the time to create my own list or learn a different library. Plus this has to be done in C++. Sorry Madotsuki.
>>
File: 1454634012630.png (415 KB, 496x349) Image search: [Google]
1454634012630.png
415 KB, 496x349
So my college stopped giving C/C++ classes and put forward more Java/ C# for more android app development because "C was failing students",should I worried?
>>
>>55035952
std::vector
>>
>>55035960
Yes, change schools now.
>>
>>55035960
there are like 3 schools in the US whose CS program hasn't devolved into a employment skills meme. just learn shit on your own
>>
>>55035820
iddqd idkfa
>>
>>55035960
also iphone/ipad dev
>>
>>55035966

For the entirety or just for the vector<string[3]> ParsedFile?

Also is there an easier way to convert all these instructions to hex without having to convert to Binary first? I'm planning to just make a tree that divides up by type, Then calls a function based on where it checks in and converts after cleaning.
>>
>>55033213
/dpgt/ I need some serious advice.

I'm really starting to think that programming just isn't for me. I REALLY like programming, don't get me wrong. I spent 5 hours straight yesterday working on an IRC bot, but I've been doing this for like 2 years now, and today I had a bad problem.

Today I decided to give UpWork and Freelancer a look, and I could not do ANY of the things these people were asking for, and it was the most emasculating feeling ever.

Like here,
>Write a program to test the maximum upload speed to Google Drive, Dropbox, OneDrive, etc.

Okay, that sounds simple, but I have absolutely no idea where to start with that. At all.

Maybe I just don't have the problem solving aptitude or whatever. This shit really makes me scared because having a job in programming, what if I just can't do the challenges that a programmer must face on a day to day basis?

Am I just overthinking this? Is it OK to not know how to do that shit?
>>
>>55036336
A lot of freelance programming work boils down to knowing about a particular program or platform, rather than actually being good at building shit from scratch. A bunch of the work I got On Elance boiled down to me actually owning a Raspberry Pi, of all things.

For example:
>Write a program to test the maximum upload speed to Google Drive, Dropbox, OneDrive, etc.
Obviously this would require you to upload then download a small testfile to each of those services and report how long it takes, But tio do that would require spending a significant amount of time reading the API documentation (assuming they have one) for those services, and testing to make sure that you understand those APIs. Viewing a job like that as a pure programming task is unhelpful, because actually putting together the script would be the quickest part of the entire job,

Also:
>Maybe I just don't have the problem solving aptitude or whatever.
Problem solving is a skill, you need practice to get any good at it.
>>
File: Jason Lee Demo 4.gif (2 MB, 1579x739) Image search: [Google]
Jason Lee Demo 4.gif
2 MB, 1579x739
Just wanted to say thanks to the anons who over the past few days helped me make my first DLL in a language I am just beginning to learn (C++). In case you were wondering what it was for it allows my program to take on the color that is set for Windows. May seem pointless to you but it is huge to me and wasn't possible before in this engine.
>>
>>55036440
not >>55036336, but wanted to know: how do you learn the actual process of doing programs? simple experience?
>>
should i learn c++

i don't know jackshit about programming other than this is used to make games and i think making games would keep me interested in learning it. but i'd also like to find a job in tech at some point later on.
>>
>>55033213

What do you folks think of the multi paradigm shenanigans wrought by Oz?
>>
>>55036842
>how do you learn the actual process of doing programs?
What exactly do you mean by that?

>>55036863
>i don't know jackshit about programming
>should i learn c++
I strongly wouldn't advise learning C++ as a first language. Consider something like Lua if you want to make games.
>>
fucking FINALLY finished my harry potter dictionary for kindle
22k entries

http://www.mediafire.com/download/yytl1nhn6aylpmx/

>>55036863
c++ requires more knowledge than other languages like the webdev ones, java, c#, etc. I don't know if it's a good language to start with
>>
>>55036863
Python is a much better beginner language and there are plenty of tutorials out there on how to make games using Python and pyGame or other libraries.
>>
>>55036863
People will probably shit talk you but that is exactly how I got started. I had downloaded the Half Life SDK (which was C++) and wanted to understand the source. Grabbed Sam's Teach Yourself C++ in 24 Hours from a sale at a Borders. That book was meant as a primer for people who already knew programming but I managed to work through all the chapters. It was about 2002.

I wound up really liking programming, went to school for CS and found out that I really liked math as well. Now I work as a dev on a fairly large system.

People will suggest other languages but I don't think it really matters what you start with. You could spend days reading opinions about what is the best language to start with but that time would probably be better spent actually learning how to program.
>>
File: .png (113 KB, 978x768) Image search: [Google]
.png
113 KB, 978x768
learning DBs
building an IP2identity thing
It's a pain to convert all of the DBs into one uniform thing, though.
fuck multiple tables desu
>>
File: 2016-06-12 08.44.45.png (22 KB, 763x167) Image search: [Google]
2016-06-12 08.44.45.png
22 KB, 763x167
>>
is it me or does haskell's type inference seem dodgy

in all the code I have seen, why do people write type signatures all the time?
>>
>>55037295
It's just you
>>
>>55037325
well? why the type signatures
>>
>>55036899
>What exactly do you mean by that?
I mean, let's say someone asks you to solve their problem, how you start doing the research, how do you think about the code beforehand, ...? are there books, videos, etc. on this topic?
>>
>>55037337
Most haskell programmers are unemployed, so they have to find something to do to fill up their time.
>>
>>55037351
google
>>
>>55037526
thanks m8, very helpful
>>
>>55035587
>how do you manage to read technical books without raging because of the buzzwords?
There aren't any buzzwords in technical books unless you're reading some shit on web development.

>>55035587
>I feel like programming is awesome, but also painful. how do you guys make it fun?
I get a high from solving problems or finding neat tricks.
>>
File: 1457220946458.jpg (229 KB, 1280x720) Image search: [Google]
1457220946458.jpg
229 KB, 1280x720
>>55035917
>using namespace std;
>>
>>55037582
>you're reading some shit on web development.
yeah, that's what I was talking about, sadly. i actually love reading truly technical stuff, but I want to become a webdev because I'm a NEET college drop-out that feels quite useless and needs money.
>>
>>55037547
>let's say someone asks you to solve their problem, how you start doing the research
generally they will include some keywords that if you are truly clueless you can literally GOOGLE, otherwise hopefully you have prior experience and can fill in the gaps with reading through documentation (there is a lot of documentation you can find through GOOGLE)

>how do you think about the code beforehand
look at similar projects' source code (that you find through GOOGLE), break the problem down into small steps. "programming" is similar to solving a math problem like you did in school, part of it is rote knowledge the teacher has given you, part is some ingenuity on your part

>are there books, videos, etc. on this topic?
GOOGLE computer science, there is plenty of free as in beer material out there, for example https://github.com/vhf/free-programming-books/blob/master/free-programming-books.md
>>
>>55037619
oh, I thought you meant to google the answer to my question, not that you used google for everything. sorry.
>>
>>55037619
>>55037640
also, thanks!
>>
>>55033771
looks nice anon
>>55034438
depends a lot but I tend to go to sleep between 3am and 5am, 2am at the earliest. if I'm not doing anything that day I'll wake up between 10 and 12, or 6-7 when I have to do shit. if I get less than 5 hours of sleep I'll usually end up taking a nap later in the day for an hour or two
>>
>>55037594
>literally nothing wrong
>>
>/dpt/ is not opened with Himegoto
dropped
>>
>>55038020
>undefined behavior
retard confirmed
>>
>>55036001
This isn't true at all. Even my community college does data structures in C++.
>>
>>55035511
Those people were the most cancerous thing to happen to 4chan, and I'm glad he fucked them.
>>
File: 1461349896154.jpg (50 KB, 472x472) Image search: [Google]
1461349896154.jpg
50 KB, 472x472
>>55036336
I literally just did the same exact thing today, ended up deleting my freelancer account.
I am also writing an IRC bot.
Is your bot on github, what language are you using?
>>
>>55035391
The relevant code was.
>>
https://drive.google.com/open?id=0B8Y8T2uBc3hGWEkwWmw5QldNeXc

Don't know if anyone here needs it, but i'll post it anyway.
>>
File: bg104.gif (9 KB, 70x19) Image search: [Google]
bg104.gif
9 KB, 70x19
Is there anywhere to buy cheap hard copy text books?
>>
>>55035470
this++
>>
>>55036077
Just replace the std::list with a std::vector.
A std::vector gives you random access and guarantees everything is stored contiguously in memory.
>>
In C when passing a pointer by reference as a function argument is there a difference between:

1) prototyping the function with "type** pointer" as an argument and passing "&pointer" to it

and

2) prototyping the function with "type* pointer" as an argument and passing just "pointer" to it

Both seem to work identically.
>>
>>55038237
Why would you ever pass a pointer by reference?
That's just an extra dereference for no good reason.
>>
>>55038259
Because this example (http://geeksquiz.com/linked-list-set-3-deleting-node/) did it that way for the "deletenode" function and I didn't understand why but it worked.

So I tried it the second way (without the **) and it worked. I'm wondering what the difference is.
>>
>>55038272
It allows you to modify the pointer which exists outside of your function, whereas with the simple method you are copying it and you can't affect the original. Now think again about deletenode and reread it thoroughly
>>
>>55038259
>Why would you ever pass a pointer by reference?
>That's just an extra dereference for no good reason.
Duh! Pointers are values, dummass
>>
>>55038295
Is it necessary though? Even when I don't pass the pointer by reference the node deleting still works. I just wrote it as:

void deletenode(int n, struct node* head) {
struct node* temp = head;
struct node* prev;
while (temp->index != n) {
prev = temp;
temp = temp->next;
}
prev->next = temp->next;
free(temp);
}
>>
>>55038306
>it's an >Anon recites the one phrase he knows about the topic to someone he mistakenly thinks doesn't< episode
>>
>>55038319
You don't ever change the temp pointer, so that function works fine with just a struct node*
>>
>>55038319
Try deleting the first node
>>
>>55038319
>>55038336

Oh wait, you change it to the last, ignore me.
Yeah you do want to pass struct node** because you want to modify struct node*

Wish C had reference types
>>
>>55038326
You did omit something crucial. Now stop backpedaling.

T. Anon
>>
>>55038359
I don't care what you have to say because if the phrase "pointers are just values" is ever part of what you are saying then it is clear you likely don't have a very thorough understanding, like when OSGTP says that 'monads are just monoids in the category of endofunctors'
>>
>>55038345
>Yeah you do want to pass struct node** because you want to modify struct node*
In this context does modify mean modify what the outside pointer comes too? In this case why does it work then? I'm just having my trouble wrapping my head around ** arguments.
>>
>>55038414
You're passing a T* because you want to modify the T pointed to
In this case, you're pointing a (T*)* because you want to modify a T*
>>
>>55038379
Except it wasn't my only post, and it's a saying that sums it up nicely.

Here's a syllogism4u
If pointers point to values, and pointers are just values, then pointers can point to pointers that can point to pointer that can point to pointers that can point to pointers... and this, kiddo, is how you create life, the stars *** and everything
>>
>>55038237
There are no references in C. Your first case passes a pointer to a pointer to a type, i.e the address of the pointer. If you want to modify the pointer itself (not the value it points to) you would have to pass in a pointer to a pointer. In both cases you can modify the value of type, but only in the first one can you modify where pointer points to.
>>
File: eugene icks.jpg (185 KB, 600x800) Image search: [Google]
eugene icks.jpg
185 KB, 600x800
>>55038439
>Here's a syllogism4u
>If pointers point to values, and pointers are just values, then pointers can point to pointers that can point to pointer that can point to pointers that can point to pointers... and this, kiddo, is how you create life, the stars *** and everything

I cringed a little
>>
>>55038414
Look at the first part of geekquizwhatever's function. It only occurs when you remove the first node. Have you tried doing so? What were the results?
>>
File: PlantUSc1975a.jpg (69 KB, 640x428) Image search: [Google]
PlantUSc1975a.jpg
69 KB, 640x428
>>55038454
TY
>>
What's the biggest project you've worked on?

What's the project you're most proud of?
>>
>>55038504
(You)

It all started when I first met your mother
>>
>>55038447
If I'm not modifying where the pointer points to my code shouldn't work, but for some reason it does. If I reprint the list after running the function the node will be removed.
>>
>>55038538
No it doesn't work in all cases. It does have a bug.
Which node?
>>
Do you have fun while programming /g/?
>>
>>55038504
The project I started on and the biggest one is a realtime imageboard (you see posts as they are typed). I've been slowly rewriting/expanding it in Go/TypeScript since December. Should be able to get it to beta quality by the end of summer.
>>
>>55035587
>how do you manage to read technical books without raging because of the buzzwords?
I read them slow and carefully. They are not story books that you read to enjoy action. I usually read books in the evenings. I can read 100-150 pages of normal book without a problem but for a tech related one it's good when i read 40 pages in one go.(unless its not some trivial subject i already know)
Focus on examples.
Make sure you understand what you just read.
If you catch yourself on forgeting what you read 1 page ago - go back, read again.
Whenever there is one word you have no clue about, technology you never heard of - google immiedietly. Same applies if you are not reading in your native language.
If you are falling asleep give it a break, you will not learn anymore during that session.

Works for me.
>>
>>55038578
It doesn't work for the first node because I didn't write it to handle the first node, but if it's not modifying what anything points to why does it work when it comes to successfully deleting any of the other infinity nodes?
>>
>>55038612
There aren't infinity nodes?
>>
>>55038538
Is >>55038319 your function? What happens if the node you want to delete is the head or the tail?
>>
>>55038612
It should work for the first node, otherwise your code is incorrect. Now agreed, you don't need a double pointer in this case, but you need a double pointer in the correct version
>>
Is there any other way of writing malware than the win32 api?
>>
>>55038083
My bot isn't on Github, and I'm using Python and the Twisted library.

God this shit is so disheartening. I wanna work as a programmer god damn it, but I'm so in-confident in my abilities, especially after that shit I saw on Freelancer. I've been doing this shit for 2 years and still am not shit.
>>
>>55038724
C++ just passed a filesystem library
Visual Studio might have a preliminary/experimental implementation
>>
In regex, how do I match "he", but not "she"?

I tried "(^s)he". However, this also matches the character in front of it. Meaning that a space or other character has to be in front of it to work. Writing he on a new line will get no match.
>>
>>55038746
How does that help?
>>
File: 2016-06-12_01-45-19.png (20 KB, 1127x477) Image search: [Google]
2016-06-12_01-45-19.png
20 KB, 1127x477
Is there any good minimal and effective ways to program?
So far I've switched from visual studio to sublimetext to emacs, I no longer use my mouse and syntax highlighting is off.

Is there anything else that I'm missing that one could do to improve their efficiency other than taking Ritalin?
>>
File: 1460773096082.png (1 MB, 1280x720) Image search: [Google]
1460773096082.png
1 MB, 1280x720
Sup, guys. I'd like to know the best guide to C++ programming. I tried googling but it returned so many results that I thought it would be more efficient asking you nerds. I have a little experience with Java, Javascript, Python and some C. What book or tutorial you did to make understand C++ better, /dpt/?

Also, I heard that if I start wearing girl clothes I will really get better at programming. Is that true? I mean, I'm asking for a friend.
>>
>>55038772
Why would you limit yourself like that?
>>
>>55038799
http://www.cplusplus.com/doc/tutorial/
and yes, it is true
>>
is it possible to get a programming degree or should i accept the bitter fate that i can only pursue web dev?
>>
>>55038842
Never go full web dev
>>
>>55038842
JOB WITHOUT A PROGRAMMING DEGREE***
>>
>>55038848
*
Never go full stack
>>
>>55038772
How the hell turning syntax highlighting off increase your efficiency?
>>
File: ss (2016-06-12 at 11.42.12).png (4 KB, 306x145) Image search: [Google]
ss (2016-06-12 at 11.42.12).png
4 KB, 306x145
>>55038751
Pic related

I want to match he1, but not she1.
the he1 in she1 still gets matched though.
Any ideas?
>>
>>55038751
$ echo -ne 'he\nshe\n' | egrep '(\s|^)he'
he
>>
>>55038724
What features do you need exactly? You can't really circumvent the OS for certain operations but you can take a look at the Native API https://en.wikipedia.org/wiki/Native_API and some undocumented NTAPI functions.
http://undocumented.ntinternals.net/
>>
File: ss (2016-06-12 at 11.44.50).png (5 KB, 326x186) Image search: [Google]
ss (2016-06-12 at 11.44.50).png
5 KB, 326x186
>>55038946
This also matches the character in front of he1 though.
That will cause trouble with my replacement.
>>
>>55038823
P H I L L Y
H
I
L
L
Y
>>
>>55038964
I managed to solve the problem by doing a double replacement. In the worst case scenario, this will result in two useless replacements, but the text is only one sentence, so processing time shouldn't be a concern.
>>
File: 1458061661804.jpg (69 KB, 600x788) Image search: [Google]
1458061661804.jpg
69 KB, 600x788
>>55038842
Programming is one of the only things you can learn without spending money, don't fuck that up by wasting money on a meme degree. Just because you don't have a degree, doesn't mean you're stuck in web dev. Be an autodidact and after you've learned the ropes, throw yourself in the deep end by doing shitty freelance work until you get good enough to apply for jobs or find decent clients. IMO the best programmers don't do programming degrees, they do other STEM degrees and learn programming by taking problems from their chosen field and solving them with code.
>>
>>55038848
>>55038852
Nothing wrong with webdev.
>>
>>55038931
\bhe\d
>>
>>55038587
For me, it's hard to call it fun, but it's definitely more rewarding than playing a video game I enjoy or listening to good music.
>>
>>55039046
>\b assert position at a word boundary

Thanks, this work as needed without any workarounds
>>
>>55038724
posix api
>>
Recommend some books that cover cybersecurity and hacking
>>
>>55038724
>not writing your malwares in python
nigger ur dumb, how do you even breathe without having a seizure??
>>
>>55034438
4am sleep, 7:30 awake during week days. `program' from 8am till 6ish since it's my job
>>
>>55034681
My problem is fucking Hexadecimals
but that's not C's fault
I just can't think in them.
>>
File: 1463606423970.gif (152 KB, 400x267) Image search: [Google]
1463606423970.gif
152 KB, 400x267
>>55039041
>nothing wrong with webdev
From what I can see, the webdev market is saturated with pajeets and chinks who will do the same job for 10 cents / hour. Not that every other tech market is too far behind, but still, hungry programmers have to eat... Also javascript is evil.

>>55037819
Holy shit! Are you me?
>>
>>55039185
Well its easy when u understand that every hex character corespond to 4 bits of binary
0xF1
0b 1111 0001

If the problem for you is the base (2, 16) of the system other than 10 just practise simple transformations
>>
>>55039232
Do literally have nothing else to do than looking at the screen? When i was a teenager i remember playing all day untill 5am sleeping 3-4 hours and repeat.

Now when i work 7-15 hit the gym afterwards, cook my dinner for the next day im dead at midnight.
>>
File: deadhorse.gif (129 KB, 300x232) Image search: [Google]
deadhorse.gif
129 KB, 300x232
According to the internet c# devs get $90,000 a year! WHERE THE FUCK IS MY $90,000!?

I blame the jews.
>>
>>55039305
you might be incompetent
>>
>>55039283
I'm the definition of autism and nobody likes me so I just stare at screens all day because my computer is the only thing I have complete control over in this cruel world. I tried having friends and they all fucked off, I tried having girlfriends and they all cucked me. I honestly have nothing better to do, I just write code all day...
>>
guys,
I'm going to be offline for a long time,
i'm thinking of downloading tutorial point pdfs,
but they don't seem to be up to date at all.
so i looked more into things, and i found this "offline" version.
i had experience with one offline version of w3schools, of which was about 5 mbs and expanded to gigs and covered that whole site.
back then and to this moment i have no idea whether it contained a virus or not.
so do you recommend downloading an "offline" version of tutorials point or any other site?
what should i watch out for?
>>
File: images-65.jpg (17 KB, 400x306) Image search: [Google]
images-65.jpg
17 KB, 400x306
>>55039354
>>
>>55039444
Never before has anyone dared post pictures of that nature here, in /dpt/

This is now a spiderman thread
>>
>>55039354
Ok every one of us have something autistic in him. I'm not spending my entire days hanging out with tens of friends.
I'm only surprised how you guys can survive with a lack of sleep. Well unless you are older than 22~, if not nevermind.
>>
>>55033797
Isn't it because you're dereferencing current which means you would need to access value using "." instead of "->"?
>>
>>55039066
Was it rewarding from the beginning?
>>
http://www.codeskulptor.org/#user41_qPCQS3WF3X_0.py
http://www.codeskulptor.org/#user41_qPCQS3WF3X_1.py
>>
>>55038587
i enjoy solving the problem

i have no problems with delayed gratification
>>
File: 1465022999175.jpg (186 KB, 690x460) Image search: [Google]
1465022999175.jpg
186 KB, 690x460
What books would you recommend for a beginner? I've finished the Codecademy courses on Python and am looking for a decent book on it.

Also a good book about computing/programming in general would be cool
>>
File: SZPjHwz.jpg (271 KB, 1560x2048) Image search: [Google]
SZPjHwz.jpg
271 KB, 1560x2048
>>55039885
>>
>>55038772

autism
>>
>>55039869
Any advice for someone that has problems with delayed gratification?
>>
>>55038903
It takes more resources to color the text and so the machine is less responsive and he can't type at his full speed.
>>
>>55038772
ritchie, pike, kernighan, etc., all use sam/acme (keyboard + mouse editor)
>>
File: ss (2016-06-12 at 02.00.02).png (29 KB, 729x371) Image search: [Google]
ss (2016-06-12 at 02.00.02).png
29 KB, 729x371
I made a quick series limit checker to check whether my math practice results are correct.

Is there any easy way to make the user input a formula, kind of like in wolfram alpha, and then use that for calculation? So I won't have to enter the formula into the sourcecode every time and recompile.

This sounds incredibly complicated, or am I just overthinking it?
>>
>>55039924
no idea, it's a nurture thing from your childhood and probably genetics

guess read that
http://www.startofhappiness.com/power-delayed-gratification/
>>
>>55039993
write an expression parser
>>
>>55039993
>>55040017
for the time being you could write a higher order function (a function taking a function as a parameter) and make the code a bit cleaner, something like

typedef struct { int i; double d; } Int_Double;

Int_Double converge(double (*fn)(double)) {
double sum = 0.0, i = 0.0, lastsum = -1.0;
while (lastsum != sum && i != 10000000) {
// incidentally, never compare doubles or floats with ==/!=
// always do a range check like checking they're less than 0.001 apart
lastsum = sum;
sum += fn(i);
++i;
}

Int_Double result;
result.i = i;
result.d = sum;
}


double SeriesExample(double i) {
return pow(-1.0, i+1.0) * (1.0 / pow(2.0, i - 1.0));
}

int main(int argc, char* argv[]) {
Int_Double result = converge(SeriesExample);
double
sum = result.d,
i = result.i;
if ((i == 100...
...

return 0;
}



captcha is 236
>>
>>55040065
add
return result;
to the end of converge
>>
>>55040017 >>55040065 >>55040078

>>55039993
Are you using C or C++?
>>
>>55040128
C
>>
>>55040131
Ah ok, either way >>55040065 is a good start because then you can just do

double SeriesExample2(double i) {
return ...
}

converge(SeriesExample2)
>>
I made an enum class, specified uint8_t as the type.
I made a vector of structs, one of that struct's members was defined as uint8_t.
Later on:
if(!string.compare(other string))
vector[element].structmember = ENUM;

Compiler says it can't convert enunname to uint8_t, then tells me to fuck off. However, little does it seem to know, no conversion is required, for it is already an unsigned char.

Why.
>>
>>55040148
The point of an enum class is it isn't actually an enum, unless you use weak typing by addressing, casting & dereferencing

Switch to a regular enum if you want to treat it as an enum (in the sense of using it as an integer)

Underlying representation for enum classes is basically size & optimisation stuff
>>
>>55040146
>>55040065
I'm pretty much a beginner in C, so I have some trouble.
Didn't learn about structs yet, but I guess it's a way to contain multiple values in one struct, so you can return multiple values in one go.

How does

double SeriesExample(double i) {
return pow(-1.0, i+1.0) * (1.0 / pow(2.0, i - 1.0));
}

and
(*fn)
and
sum += fn(i);

work?
Thread replies: 255
Thread images: 40

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.