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

/dpt/ - Daily Programming Thread

This is a blue board which means that it's for everybody (Safe For Work content only). If you see any adult content, please report it.

Thread replies: 321
Thread images: 23

File: dpt_flat.png (102KB, 1000x1071px) Image search: [Google]
dpt_flat.png
102KB, 1000x1071px
Old thread: >>56994001

What are you working on /g/?
>>
http://code.rpgify.com/

discuss.
>>
>>57001843
Docker integration and shell scripting for my Software class.
Kinda sad I can't transfer files from Docker shell to Docker shell but I'll probably survive. Just one extra copy command
>>
>>57001866
Less is more.
>>
Does using const make your code faster?
>>
Reposting:

I wish to learn some programming. Nothing professional, but as an engineer i believe i am supposed to know some of it, and some problems i face could be easier solved with coding knowledge.

I only learned very little about it on college, some C++ focused on basic number crunching calculus functions.

Should i stick with c++ for general purpose coding? Any good book for me to study?
>>
https://github.com/rust-lang/rust/pull/25585

reminder
>>
>>57001916
yes.
>>
>>57001866
fucking normies
>>
>>57001916
in a lot of cases the compiler can optimize it even if you don't use const, but you should use const whenever you can because not writing const correct code is fucking disgusting
>>
>>57001866
So this is just for webdev faggots, right?

>GOTTA COLLECT ALL THE NPM DEPS!
>>
>>57001920
I would suggest Python to be honest.

If you want to learn something to crunch numbers with, there's always R. But for general purpose programming Python is a pretty good place to start.
>>
>>57001923
Can't make this shit up
>>
>>57001923
>However, because this mistake has stood since 1985, I have changed all of the pronouns to be female, to make up for lost time. If someone would like to revert this patch or switch to neutral pronouns after 30 years, feel free to set your alarm clock for 2045
What an insufferable faggot, what's even worse is that everyone went along with it. Does anyone in that community ever think, "man, does what we're discussing even matter?"
>>
>>57001950
>giving honest advice to noobs who can't into internet search

>spoonfeeding

fuck off
>>
>>57001970
>Does anyone in that community ever think, "man, does what we're discussing even matter?"

99% of software development problems could easily fall under this category.
>>
>>57001866
This looks great actually, despite what people here might initially think. I've been tracking lines of code written as a means to help with my motivation issues. I look forward to trying it.
>>
>>57001942
I would make the argument that even if the compiler could do it 100% of the cases you should do it.
In fact, if the compiler detects constants that aren't declared as such, you should be able to set a flag where it warns you about it.

const is not just something you tell the compiler. It's also something you tell your fellow programmer.

And that is a reason WHY it's fucking disgusting to not write const. You're too lazy to communicate properly, and this says something about your attitude.
>>
File: ani.webm (1MB, 854x480px) Image search: [Google]
ani.webm
1MB, 854x480px
/dpt/-chan, daisuki~

>>57001843
>What are you working on /g/?
Made a Typoglycemia encoder (rate/10 please)

https://en.wikipedia.org/wiki/Typoglycemia

import random

def typoglycemia(text):
itext = iter(text)
word = ""
oText = ""
for char in itext:
if char.isalpha():
word += char
if itext.__length_hint__():
continue
if 4 == len(word):
word = word[0] + word[2] + word[1] + word[3]
elif 4 < len(word):
mid = list(word[1:-1])
random.shuffle(mid)
word = word[0] + "".join(mid) + word[-1]
oText += word + char
word = ""
return oText


example with >>57001950

"""
I would sueggst Photyn to be henost.

If you wnat to lrean sntoimehg to crncuh nrmeubs wtih, there's alawys R. But for geernal prosupe paiogmrnrmg Phtyon is a pertty good palce to strat.
"""
>>
>>57001916
Does the variable get written? That's when you should use const. It also makes it clear if there are side effects to your functions.
>>
>>57001991
Is it really spoonfeeding though?
It's /dpt/. She didn't make her own thread to shit up the board or anything. It's a simple and easy to answer question.

(If you want gender neutral terms, feel free to do

sudo date -s "9 OCT 2045 22:34:00"

)
>>
I'm stuck on my script trying to figure out how to redirect my output to a specified input. What am I not getting. I'm sure it has something to do with how I'm redirecting
I tried 2>"${2}" and 2>&1 "${2}

basically "world.sh" has this in there
echo "Hello World!"
./world.sh > "${2}"


I want to take it and put whats inside into a new file

$ ./world.sh newfile.txt
$ cat newfile.txt
Hello World!

Say if were to put in "notnewfile.txt" next in my parameter it should save Hello World! in there too

If I do this next
$ ./world.sh supdpt

it should create new file supdpt with the output "Hello World!" too
>>
>>57002046
what

he already got a response in the previous thread

the ass hole even "reposted" because he wasn't satisfied with the answer

he should really fuck off with that attitude
>>
File: 1VHZYKk.jpg (2MB, 2304x3072px) Image search: [Google]
1VHZYKk.jpg
2MB, 2304x3072px
Reminder that if you aren't doing something with machine learning, you're going to be left behind in 5 years
>>
File: ultimate-fornærmelsen.jpg (36KB, 948x669px) Image search: [Google]
ultimate-fornærmelsen.jpg
36KB, 948x669px
>>57002078
Come now. It's not 2045 yet. So use female pronouns. SHE should really fuck off with that attitude.
>>
>>57002094
>>57001970
read last sentence of this post
>>
>>57001991

>Everywhere should go by /a/ rules.
>>
>>57002089
i will write a neural net to see how it is and also try to learn and employ boosting

i just have to read on the math again, it's really easy, there's just symbols and stuff to keep track of as always
>>
File: 1389224279388.jpg (44KB, 500x316px) Image search: [Google]
1389224279388.jpg
44KB, 500x316px
I want to store entries in a database by tag. What's the database/kind of database I'm looking for? I'd roll my own but I want the reliability of an established one and I don't want to make reinvent the wheel but shittier.
I'm using C# if that matters.
>>
>>57002089

I've dabbled with ML in a couple of classes, but I'm doing my master's research on a security-related topic. I don't really think cybersecurity's going to be a dead end.
>>
>>57002119
Come on sis.
It's 2016, not 2045.

...

And just to annoy you even more:
Go back to \pol\
>>
I'm having a little trouble understanding relational databases.

Let's say I need to model a 2-way relationship between independent entities. For example I have a list of characters and a list of guilds. Characters can be members of guilds and guilds can have guild members.

Of course when you look up a character you should get to see the guild it belongs to, and if you look up the guild you should see a list of characters that are members of the guild.

Also I would need to search through the character list as well as the guild list, so it makes sense to have those two lists as tables right?

So when a new character joins or leaves a guild, do I just have to deal with updating the references at both points? I.e. I need 2 update queries (in one transaction)? That doesn't seem right because it could quickly get out of hand as you start adding more and more relations like that.
>>
>>57002292
can characters belong to multiple guilds?
>>
>>57002217
You want to what?

If you want to basically store a giant hashmap, go with one of the key-value stores, like MongoDB or Riak. They're relatively easy to learn.

If you already know SQL, just download Postgres and stop asking stupid questions.
>>
>>57002342
>you want to what?
my question isn't exactly mysterious my man, I want a DB that stores data by its tag(s).

Regardless, thank you.
>>
File: 123yr.png (39KB, 1000x1071px) Image search: [Google]
123yr.png
39KB, 1000x1071px
>>57001843
>>57001843
your png is now optimized
>>
>>57002292
when you remove a character you could have the character notify the guilds to remove the reference to the character

what do you mean "it could get out of hand"

do you have a requirement that the updates have to be atomic/recoverable and all that stuff?

in that case you could just do versioning or use a log
>>
>>57002292
you set up a table of characters and a table of guilds.

can a character belong only to one guild?
add a column to the character table, something like guild_id, put an FK on it so it must reference an existing guild (or NULL).

can a character belong to multiple guilds?
create another table, each row in this table contains character_id and guild_id. add non-nullable FKs and there you go.
>>
>>57002292

Many to Many relations use an intermediary table.

You'd look at something like having Character, Guild and Membership.
Membership would consist of a Character field, a Joined field (date) and a left field (which would need a special value if they haven't left yet).

So if you want to see active members of guild #231, you'd run SELECT character FROM Joined WHERE guild=231 AND left is null;

Join it with the Character table if you want more up to date information.

Everything you want to ask questions about should be a table.
>>
File: 1403077467913.png (130KB, 494x351px) Image search: [Google]
1403077467913.png
130KB, 494x351px
>>57001843
I have some experience in coding (C#,java,some C++) and developed some console applications, and I want to try to expand my portfolio with some android apps.

Do I start with Android Studio or should I try to set it up in visual studios? Also any good source of info for coding in android?
>>
/g/ is one of the most hostile environments on 4chan. most other generals have at least a slight sense of shared purpose but /g/ is absolutely full to the brim of self-important, narcissistic pedants whose entire raison d'etre seems to be pampering their own ego at the expense of people who are less experienced and/or knowledgeable. why is this?

my own theory is that the better you get, the more you realize you don't know. the more you don't know and feel like you should, the more insecure you get, and the more you need to lash out at others to mask your insecurity.

everyone likes to think that they're awesome and amazing, but from my personal experience, the people who really know their shit and are comfortable with it aren't the ones lashing out. it's the un(/der)employed with no other outlet who need to lash out. i think this is endemic of any community in which there are a bunch of """""smart""""" people, but it's particularly expressed here on /g/
>>
>>57002413
Install Android Studio and follow the google developer guides.
>>
>>57002233
Security benefits from ML in big ways. You can log more information and analyze it more quickly. Fraud detection and phishing detection are also real applications of ML.

If you aren't writing security tools/libraries, you'll just be a pentester, which are today's CRUD developers. You'll always be necessary but you're really a blue-collar worker.
>>
File: what?.jpg (32KB, 310x280px) Image search: [Google]
what?.jpg
32KB, 310x280px
>>57002461
what?
>>
>>57002461
You're always welcome to fuck off.
You won't be missed.
>>
File: output.webm (2MB, 960x843px) Image search: [Google]
output.webm
2MB, 960x843px
Still working on my terminal emulator, got some nice progress done and an important milestone, vim works.

Next milestone GNU screen and tmux, which require erase capabilities.
>>
>>57002461
Why don't you apply as a volunteer for some feminism foundation if you're looking for a less hostile environment then?
>>
>>57001886
What others have you taken? Just out of curiosity, since I'd like some knowledge in regards to security, since I'm still in school, and I'd like to take some courses that they don't teach us.
>>
When working in assembly (I'm working with MIPS, I'm not sure if it's handled differently on different architectures/instruction sets) is there a clean way to deal with storing variables on the stack? I'm manipulating the stack directly with immediate offsets and can't help but wonder if there's a more elegant way.
>>
>>57002468
Thanks mate, easy answer and will check it out.
>>
>>57002546
>>57002513
don't get me wrong, i don't give a shit how hostile you are -- it has no bearing on me personally. your hostility just proves my point, really :^)
>>
>>57002538
how does it work exactly
>>
>>57002584
Why the fuck do you shitpost a rant then if you don't give a fuck about it?
>>
>>57002538
nice work anon
>>
>>57002600
How do you mean? What do you want to know?
>>
>>57002337
In my specific example no. But I'm more asking it as a general question of how to handle 2-way or n-way relationships.

>>57002377
Atomicity shouldn't be a problem if I update all sides of the n-way relationship in one transaction if I understand correctly. It won't get out of hand with just 2-way relations... but for example in a big MMO characters have to have a huge net of relations, to other characters as friends, guilds, to items, to auctions... Let's say you then delete or ban a character, do you need to perform 100s of queries to clean up all the other tables on the other side of those relations?

>>57002390
Doesn't that mean that, if I want a list of guild members for guild abc, I would need to SELECT * FROM characters WHERE guild=abc? It seems wrong to have to query over the characters table to get information about a guild. Or are you saying I need a guild table too so I can select from that? In that case I guess I don't have a choice but to update them separately.

>>57002408
>Everything you want to ask questions about should be a table.
Again it seems very difficult to make sure everything is consistent across the whole database then. I would have to make absolutely sure that I can never have a situation where a character is a member of a guild, but a guild doesn't have that character as a member.

Maybe just joining the tables at query time is sufficient, even though it's not that performant. A table of guild names, a table of characters with a "belongs to guild" field, join them on the guild name and go from there... it just seems like an anti-pattern somehow.
>>
>>57002461
We're like the Army. We're not gay enough for the Navy and not good-looking enough for the Air Force and too smart/too weak for the Marines. We bitch and yell because it is actually a decent way to quickly teach a human not to do bad things. We've seen a lot of awful shit out there and we don't want more people doing awful shit because that awful shit might be dumped onto our heads one day. There are plenty of safe spaces for you to go to on the internet where you can connect with other pseudo-genders and adorn your laptop with political stickers.
>>
>>57002610
how you emulate the terminal
how does what you write in your emulation end up be executed as if it is a terminal, where did you plug the thing
>>
>>57002461
You are free to leave.
>>
>>57002645
Are you sure you know what a terminal emulator is?

Your question doesn't make much sense to me.
>>
>>57002602
maybe i misspoke -- i obviously care, otherwise i wouldn't have written anything in the first place. i feel like it's somewhat my obligatoin to call people out on their bullshit when they're slinging shit at each other in an echo chamber.
>>57002626
>We bitch and yell because it is actually a decent way to quickly teach a human not to do bad things.
i think that's just a rationalization. if you take a step back you'll notice that most """"hostile"""" posting isn't actually about teaching at all. it's more just grinding someone down into the dirt.
>>
>>57002614
>It seems wrong to have to query over the characters table to get information about a guild. Or are you saying I need a guild table too so I can select from that? In that case I guess I don't have a choice but to update them separately.

Querying the guilds table without looking at the characters table would require you to store all of the characters in a single column.

I'm not sure what seems wrong about it. A single table doesn't necessarily represent the source of truth for the entire concept you're mapping to the database.
>>
>>57002683
>i think that's just a rationalization. if you take a step back you'll notice that most """"hostile"""" posting isn't actually about teaching at all. it's more just grinding someone down into the dirt.

And that's a good thing because that will only make the person willing to improve themselves to not get yelled at the next time, unless you're a teenager whose hormones are still buzzing (in which case you shouldn't be here), then you'll probably get mad instead and throw a tantrum.
>>
>>57002720
so it's not actually about teaching, it's about making someone feel shitty about themselves? what exactly do you get out of that?
>>
>>57002741
>what exactly do you get out of that?
Enjoyment.
>>
>>57002741
I discourage the use of shitty practices and what not which in turn, when people will feel shitty about themselves and willing to improve, will benefit the programming community as a whole when they decide to contribute to a project or release a project for the public. Plus I can call someone a bitch without facing the consequences of being punched in the face, that's a good thing as well.
>>
>>57002461
we're just putting down bad behavior and pointing out programming mistakes, like your pathetic whining, fucking kill yourself faggot
>>
Starting to learn Python. I'm using one of the sites suggested on the wiki. I want use VIM but I don't know how to make it work as a Python interpreter/compiler.
>>
>>57002684
>Querying the guilds table without looking at the characters table would require you to store all of the characters in a single column.
I was thinking something like having a guild table with a members field, so to get a list of guild members you would just SELECT * FROM members.

Then any time you a character changes guilds, the old guild's table gets updated to remove that character and the new guild's table gets update to add it.

>A single table doesn't necessarily represent the source of truth for the entire concept you're mapping to the database.
This makes sense though.
>>
>>57002679
get fucked
>>
File: DeepinScreenshot20161009232203.png (157KB, 849x696px) Image search: [Google]
DeepinScreenshot20161009232203.png
157KB, 849x696px
Wow this post got long, hope at least some of you read it.
So I was lurking SO, and stumbled upon pic related, and I know there are a lot of those on SO, but it got me thinking.
Solving this problem requires you to read the error message which literally (checked myself) says:
SyntaxError: Missing parentheses in call to 'print'

Now of course I understand that some people are just starting out wth coding and you can't expect wonders from them,
but the thing is, when I recall to my beginings in coding, I was able to read what compiler said to me (which isn't a major gift i presume), and when I didn't I was always able to google such a trivial problem.
Now I remember a while back here on /dpt/ we had a discussion about wheter some people are simply unable to learn programming, because there were some studies that suggested this (https://blog.codinghorror.com/separating-programming-sheep-from-non-programming-goats/).
This stackexchange question (https://programmers.stackexchange.com/questions/163631/has-not-everyone-can-be-a-programmer-been-studied) debates this very topic, and some people seem to cite sources confirming it, but a lot of people also tries to justify why these studies are wrong, and opinions are very split.
to be continued
>>
>>57002812
I'm not sure about Vim because it's been long since I used it but cannot you switch to command mode or whatever it's called (the mode where you enter "commands") and just type ":!python <filename>" or even bind it to a key?
>>
>>57002759
your enjoyment is based in insecurity. don't you want to deal with that, anon? it'll make you happer.
>>57002772
i didn't ask what the programming community gets out of it, i asked what you get out of it. your desire to call someone a bitch is a surface emotion with justifications and rationalizations behind it.
>>
>>57002058

You probably want to do something like this:

#!/bin/bash

for var in ${@}
do
./world.sh >> ${var}
done
>>
>>57002841
cont'd
While contemplating this whole thing I remembered reading about some other not CS related studies (that unfortunately I'm unable to find, so if any of you heard of it please say where), that suggested, that certain people are unable (or it comes extremely hard to them, and it scales with age) to learn to recognize new patterns, to kind of, rewire their brain. They were able to learn new stuff in a sense of absorbing knowledge, say, in a school, but they ultimately didn't have the ability to 'learn how to think'. And they concluded this phenomenon was linked to being - very early in life - punished (or not getting encouraged) for showing any sign of thinking 'outside the box' or anything like that (punished not necessarily on purpose by their parents, but they generally learned to associate this with bad things).
I'd like to believe that anyone can learn anything if they really want it, but there seems to be a pattern here saying otherwise.
So firstly did you guys have pic-related-type problems when you were starting out with coding?
And secondly what do you think about this whole thing? Are some people really unable to learn certain things (like coding)? Or is it just the "If you genuinely like it then you can be good at it" thing?
>>
>>57001843
I'm still on my scatterplot thingy. It feels like it's a thing of minutes, but I didn't feel very motivated over the weekend.

But, let's get back. yay!
>>
>>57002853
here's your (You)
>>
>>57002853
>your enjoyment is based in insecurity.
Nah, it's just banter. That's all /dpt/ is. If you don't like the way people talk here you might like reddit more.

I've actually learned a shit load about programming here over the years.
>>
>>57002883
yep, that's the easiest way out
>>
>>57002584
This is 4chan, idiot.
People acting hostile doesn't mean anything. It's the default tone here.
>>
>>57002885
this

you don't have to step on eggshells and let people believe that what they're doing isn't shit, they should be thankful for getting to learn how to do things right, instead of wasting years programming in haskell or some garbage lang like that
>>
>>57002906
>implying languages matter that much

pajeet
>>
>>57002885
nah, banter is by definition good-natured. it's not surprising that there's confusion about this but most of what goes on here isn't banter at all.
>>57002901
true to a point. what you say really doesn't mean shit in the long run, but it's symptomatic of a certain mindset. appealing to a broader group of like-minded, unhappy people doesn't really do much to affirm the healthiness of it.
>>57002906
it's inefficient. but it's an inefficiency that people run with because it's widespread, not because it holds any intrinsic worth

also reddit is shit. it's where people go to be high-minded and put on a front. i prefer talking to people when they're being themselves
>>
>>57002950
>also reddit is shit. it's where people go to be high-minded and put on a front. i prefer talking to people when they're being themselves
the irony
>>
stpo responding to the bait poster
>>
>>57002978
i'm not putting on a front. but attack the person rather than the message, right? :^)
>>
>>57002950
>but most of what goes on here isn't banter at all.
like what? Can you point out some examples?
>>
>>57002934
>implying haskell is useful for anything but experimental toy compilers
nathan
>>
>>57002995
no, i don't feel like poring through warosu to prove a point. i'm not going to quote any replies to what i've been saying because this is already a meta-discussion. people are more likely to respond that way by virtue of what i'm saying just to prove a point anyway. just be aware that 4chan's idea of """"banter"""" isn't actually banter in any real sense.
>>
>>57002993
>i prefer talking to people when they're being themselves
people here are being themselves but you're whining about it

you're free to fuck off and kill yourself
>>
gotta make a CVS in bash for my linux class

this shit kind of sucks
>>
>>57002950
Good armchair psychology, fuckface.
You must know every person to a tee, because of how they post on 4chan.

>>57002985
I have nothing better to reply to right now.
>>
newfags can't average two ints in C
>>
>>57003049
noone can
>>
>>57002826
I'm just trying to answer your questions, but I can't if they don't make sense to me.
>>
>>57003049

Nobody can. It's not possible.
>>
>>57002815
Updating the foreign key that maps to the guild is more efficient than updating a single members column that has a list of members.

The reason for this is when a character drops from a guild, you will know which character ID this is if there's any sense to the rest of the application. Your character table can easily be indexed by the character ID, making "SELECT * FROM characters WHERE ID = x" very fast.

Even if you do not know the character IDs, you will still know the guild ID, and you can index that as well on your character table.

I'm not even sure how you would store all of the guild members in a single column. You would have to do JSON or XML or some other format that can be de-serialized easily into a collection. The cost of serializing/de-serializing this column already outweights the storage cost of the index + index lookup.

Then your database or your app would then have to search through that collection, remove the individual, and then serialize the collection again and update that column. Since this is a game and is likely networked, you are paying a lot of bytes to send the collection object over the wire or keep it in the server's memory.
>>
>>57003049
Newfags can't average an arbitrary number of ints in C.
#include <stdlib.h>

int iavg(int n, const int arr[static const n])
{
int avg = 0;
int rem[2] = {0, 0};
int add[2] = {0, 0};

for (int i = 0; i < n; ++i) {
avg += arr[i] / n;

int a = abs(arr[i] % n);
int j = arr[i] < 0;

if (rem[j] >= n - a) {
rem[j] = a - (n - rem[j]);
++add[j];
} else {
rem[j] += a;
}
}

avg += add[0] - add[1];

if (avg < 0 && rem[0] > rem[1])
++avg;
else if (avg > 0 && rem[0] < rem[1])
--avg;

return avg;
}
>>
>>57003036
>linux class
why are you taking a class for something everyone can and do learn on their own

dont you feel shame
>>
>>57003027
>no, i don't feel like poring through warosu to prove a point.
just one example is fine. You just said most of what's said here isn't banter.

I guess that's too much work though. Compelling argument right there anon.
>>
>>57002841
Checking on what the compiler says exactly is usually only my second intention.
Mainly because usually when there's an error in C++ (the language in what I learned most of my programming), you don't get only one error but a plethora of unrelated errors. I kind of learned: "don't try to follow this". Now, compilers/interpreters change in behaviour from language to language and this sometimes isn't the case, but I still have the same automatism first. First look at code, only then look at error warnings. On the other hand, I've been starting to program at an early age (11).

Now I know people also have differences in coping with problems, some try to solve problems socially. The internet here plays the role of an instructor that is missing in person, who could answer and direct in such questions.

I mostly tend to be that person (having been that person in real life to a lot of people). And while there are hopeless cases even to me, I think it's not as bad as it seems sometimes.
>>
>>57003040
right, everyone is a special snowflake and completely pure expressions of their own individuality. there are absolutely no patterns in human behavior which can be collated and evaluated.

if you ever want a laugh, jump into any old thread on 4chan and pretend you care about them. watch people sperg out en masse trying to push you away
>>
>>57003058
>how does your project work mate
>i don't understand the question, doesn't make sense to me

you are not very smart are you
>>
>>57003098
>right, everyone is a special snowflake and completely pure expressions of their own individuality. there are absolutely no patterns in human behavior which can be collated and evaluated.
Are you a qualified psychologist? Have you performed a study on 4chan users?
Everything you're saying is baseless conjecture and you're a fucking idiot.
>>
get a room
>>
>>57003148
who's to say i'm not and aren't in this very instant? :^)
>>
>>57003072
That makes a lot of sense, I'll try something like that. Thanks.
>>
>>57003158
seconded.
>>
>>57003122
>how you emulate the terminal

It's an emulation of the old text terminals.

>how does what you write in your emulation end up be executed as if it is a terminal, where did you plug the thing

This doesn't make any sense in regards to terminals.
>>
>>57003162
>i.e. I'm a fedora-tipping retard who thinks I've better than everyone else
Good one :^)
>>
>>57003091
Well, C++ was my first language too.
But I think no matter what is your way to cope with problems when you see: Syntax error on line X, and you look at it, and based on your knowledge that parenthesis should go in pairs, how hard can it be to fix it? Not to mention using google.
>>
>>57003180
why are you so personally invested in this exchange, milady? you seem rather distraught
>>
>>57002857
Thanks a ton for replying.

Its doing what I want. The only thing is what is var doing? and what is the @ doing?

I tried this out in another script where the second parameter displays the number of times I want hello world displayed. The third parameter ($2) here is the name
for example
$.newworld.sh 7 newfile.txt
Hello World

>Hello World is printed 7 times but 4chan thought it was spam

$cat newfile.txt

For some reason it only displays 6 Hello worlds only instead of 7. If I put say 4 in $1 it still displays 6 Hello Worlds?

appreciate anyhelp
>>
>>57003179
>This doesn't make any sense in regards to terminals.
it makes perfect sense, you are just a fucking retard
>>
>>57002461
Imagine having a club where gearheads come to talk about and discuss cars, and on the regular outsiders pop in and ask questions or stupid shit like "Should I get a green car or a red car??" or "Ford is best!!! Volvo sucks!" or "I live 20km from my workplace, what kind of wipers should I buy for my nephews tractor?"
You'd tell them to fuck off and kill themselves too
>>
going to bed

as awlways ill be hoping C-shit stains won't be there when i wake up tomorrow
>>
The existence of casting in a language is an indication that its type system is abysmal.
>>
>>57003182
Wouldn't be the first time that I missed that myself, actually.
It's also a hard step in the world of learning how to code to know that these things are important.
Because while they are formally existant in the non coding world, they are simply typos. A missing parenthesis in your homework doesn't make it garbage. You just don't pay attention to it, you got to learn that first.
>>
>>57003265
I'll take "stuff that isn't true" for 500 alex
>>
>>57003265

So if you wanted to get an integer from a float, would you rather the language handle it implicitly, that it require an explicit cast, or that it be handled through a library function? How about strings to integers and vice versa? In a language with your ideal type system, how are variables converted into different types, and what is your reasoning for this?
>>
>>57002292
If a character can belong to one guild only, you have classic one-to-many relationship with two tables like this:
guild(id, name)
character(id, name, guild_id)

guild_id is a foreign key, obviously. You can allow NULL for no guild affiliation.

If a character can belong to multiple guilds, you have many-to-many with an additional table:
guild(id, name)
character(id, name)
character_guild(character_id, guild_id)


In either case, when a character joins or leaves a guild, you only have one table to update.
To query characters along with their respective guilds, you'd use JOINs.
>>
>>57003326
>inb4 "I'd rather just rename the function that does the casting something else so it is no longer obvious that I am casting"
>>
When would I need to worry about signed unsigned numbers? I've just been using the normal int, double, etc
>>
>>57003210
Guess you aren't interested in an answer then, have a nice evening.
>>
>>57003326
>how are variables converted into different types
noy him, but functions would pretty well
>>
>>57003355
I use unsigned when assigning types that logically can't be below zero, like distances or counters - you'd waste half of the possible range of your variable on nothing.

Also, when you need to save on memory space and you have, let's say, a maximum value of something that goes up to 3 Billion, you don't need an 8 byte integer to store that, but can take a 4 byte unsigned.

Many filetypes work with unsigned integers to do exactly the latter, saving on space while getting as much info out of it as possible. 24 bit BMP for example can have 255 values for each color per pixel stored in a byte - logically 255 positive values. signed that would be -128 to 127, and you'd need two byte integers to hold 255 positive values. Making the file twice as large.
>>
File: sFD6EHw.png (80KB, 706x365px) Image search: [Google]
sFD6EHw.png
80KB, 706x365px
Haven't worked on it today, but I wrote an x86 assembler and then ported it to the operating system I'm writing. It can assemble, link, and then format as an ELF executable.
>>
>>57003265
>unsafeCoerce / coerce
>>
>>57003380

Functions are plenty nice, but consider that some types may be represented the same in hardware (pointers, integers, booleans), or may be readily converted in hardware with but one instruction on many platforms (floats <-> integers). In these cases, does it not make sense to use a cast, whether it be implicit (as in C) or explicit (as in Ada)? Surely, there does not need to be a function overhead for what could be a language construct.
>>
>>57003355

Pretty much only if you are comparing values against one another (like a signed int >= an unsigned int). Or overflows, but if you're using C you can just interconvert signed/unsigned.
>>
>>57003326
Take mono-typed languages like Tcl. Everything is text, including numbers, arrays and hash tables. This creates a kind of interface where casting isn't needed by the developer because there's only one type available: the string.

This means you can express classes, data structures, algorithms and indeed entire programs as just text. Internally, the interpreter keeps track of what text could mean (hash table, array, plain integer, floating-point, etc), but the programmer does not need to know nor care about it.
>>
>>57003489

That's how my Not A Lisp language stores valus.
>>
>>57003455
>there does not need to be a function overhead for what could be a language construct.
well, if the functions are built into the language they can be optimised at compile time.

I don't know, it's a much of a muchness.

I find casting useful when you have objects that you don't always know the type of and there's no easy way to make the type known at compile time.
>>
>>57003499

values**
>>
>>57003198
Well first "$@" has the content of all of your command line parameters. If you pass $@ through a loop you can do something with each of your command line parameters.For example if you call the command "hello.sh" like this:

./hello.sh one 2 three

the $@ contains "one 2 three"

In my code you are creating a temporary variable called "var" that is only available within the for loop. The var variable has the content of each of the parameters for each of the loops. From the above example the first time through the loop var would contain "one" the second time through the loop it would contain "2" and the 3rd time "three".

Could you show me to code you used?
>>
>>57003489
>Everything is text, including numbers, arrays and hash tables
mfw

>but the programmer does not need to know nor care about it.
The programmer always needs to know the type. If the programmer doesn't know what the type of every variable is at every point of the program, the program will break. This is a huge fucking meme that dynamic typing advocates actually believe, but it makes zero sense.
>>
>>57003455
Well everything that's not represented the same at the hardware level, it needs a function to convert. If it's the same it's just a language construct.
>>
>>57003489

That all sounds like a terrible idea.
>>
>>57003611
dynamic typing was a mistake
>>
>it stores the text and the interpreter uses its type to determine how to interpret it
>any different from
>it stores the binary data and the interpreter uses its type to determine how to interpret it
>>
>>57003611
Tcl ditches the middle-man. What's the difference between ints, floats and strings anyway? They're all bits internally. Just strip away typing completely and make everything text.
>>
>>57003532
>>57003198

This should do what you are trying to do:

#!/bin/bash

limit=$1
shift

count=0
while [ $count -lt $limit ]
do
for var in "${@}"
do
cat world.txt >> ${var}
done
count+=1
done
>>
>>57003675
>C ditches the middle-man. What's the difference between ints, floats and strings anyway? They're all bits internally. Just strip away typing completely and make everything bits.
Are you that fucking stupid?
>>
>>57003675
You do realize that the rule on how the interpreter interprets the text IS the type, right?
>>
>>57003675
ints and strings -- as arrays of chars -- are similar, in that chars are ints. floating point number representations are completely, entirely different in a huge fucking way
>>
>>57003731
he means like "52" and "56.53" and "this was a string in the first place wtf"
>>
>>57003489
>but the programmer does not need to know nor care about it
what are you even writing
>>
>>57003773
52i, 56.53f and "this was a string in the first place wtf" are all just bytes too.

His whole premise makes no sense.
>>
>>57003489
>This means you can express classes, data structures, algorithms and indeed entire programs as just text
>what is source code
>>
>>57003726
The underlying type in Tcl is not exposed to the programmer. The middle-man (an elaborate type system) is entirely cut away. Everything is exposed as a string value. What the interpreter does with those values is irrelevant to the developer.

PHP for example makes the mistake of introducing a type system, then doing away with it. Example: you can add a numeric string value, e.g. "11" to an integer-typed value, 22. The result is int 33. PHP should not have a type system at all if it's going to ignore it anyway. Perl does exactly the same.
>>
>>57003860
>>Internally, variables have types like integer and double, but converting is purely automatic.
its literally just another dynamically typed language
is this your first time hearing of dynamic typing?
>>
>>57003675

>What's the difference between ints, floats and strings anyway?
How they are represented in memory, and what operations on each of them do. If I wanted to store the number 58008, I might represent it as:

98 E2 00 00 # 32-bit Integer, Little-Endian
35 38 30 30 38 00 # Null-terminated string
00 98 62 47 # Single Precision IEEE Float, Little-Endian

If I had this in string format, and I wanted to add a number to it, I would have to convert it to the 32-bit integer format. This would not be cheap, especially if done regularly.
>>
just finished codeacademy's python thing, still feel like a retard, where to next?
>>
>>57003961
a real language
>>
>>57002017
import re, random
def tg (word):
if len(word) > 4:
old = word
while word == old:
mid = list(word[2:-2])
random.shuffle(mid)
word = word[:2] + "".join(mid) + word[-2:]
return word

def typoglycemia (text):
return "".join(tg(seq) for seq in re.findall("[A-Za-z]|.", text))
>>
>>57003969
Change 2's to 1's if you aren't following the text:
"In a puiltacibon of New Scnieitst you could ramdinose all the letetrs, keipeng the first two and last two the same, and reibadailty would hadrly be aftcfeed. My ansaylis did not come to much beucase the thoery at the time was for shape and senqeuce retigcionon. Saberi's work sugsegts we may have some pofrweul palrlael prsooscers at work. The resaon for this is suerly that idnetiyfing coentnt by paarllel prseocsing speeds up regnicoiton. We only need the first and last two letetrs to spot chganes in meniang."
>>
>>57003966
(you)
>>
>>57003675
That's easy to implement, but sucks in practice. It works for extremely small programs but is absolutely garbage if when you start implementing slightly complex constructs. bash is mono-typed as well and it's only acceptable because it's exclusively used as a tool for small scripts to automate other programs.
While integers can sufficiently express names and most numbers, they are horrifically inefficient, and absolutely suck at representing even the slightest abstraction, e.g. lists, tables.
>>
type systems are a crutch for programmers who don't want to write their own unit tests
>>
so i'm just starting to get my feet wet in assembly. is recursion expensive because with every recursive call a new stack frame is instantiated and not deallocated until it returns?
>>
my language > your language. prove me wrong, faglords
also, I bet you can't average two ints in C


>>57003961
>codeacademy
it's shit
try udacity instead
>>
>>57004068
That's why everyone says recursion is dangerous
>>
>>57004068
If it's a tail call, you don't need to allocate a new stack frame, at least.

>>57004093
why hello there, I see you are a memeslinger like myself
>>
>>57004068
is that not how non-tail recursion always works in every language? by creating a new stack frame, and not deallocating it until it returns?
>>
>>57004137
yes but abstraction
>>
In C, how would I go about printing the current index of a string pointer?
>>
>>57004147
store base, subtract current from base divide by offset
>>
>>57004156
er, subtract base from current
>>
I think I actually appreciate how everything in Ruby is really an object.
>>
I think I actually appreciate how every woman inherits from Object.
>>
>>57004156
>>57004162
preferably something a bit earlier on in the learning process
>>
>>57004147
from
man index
,
...
The index() function returns a pointer to the first occurrence of the character c in the string s.

The rindex() function returns a pointer to the last occurrence of the character c in the string s.

The terminating null byte ('\0') is considered to be a part of the strings.

...

CONFORMING TO
4.3BSD; marked as LEGACY in POSIX.1-2001. POSIX.1-2008 removes the specifications of index() and rindex(), recommending strchr(3) and strrchr(3)
instead.


>>57004173
shut the fuck up you militarist-lolbertarian-statist

>>57004183
kek
>>
>>57004173
>tfw methods and classes aren't objects in Ruby
>>
>>57004183
didn't appreciate this the first time i read it, now i do
>>
>>57004207

You can get Method objects, though.
>>
>>57004197
your pointer is just a stored memory location. normally to access that data, pointers are dereferenced, but one of the more powerful tools in C is your ability to work on pointers (and hence memory locations) arithmetically. if your base points to the beginning of an array at memory location 0x0 (it won't, but for sake of example), the next piece of data will be at memory address 0x0 + sizeof(<type>). when doing arithmetic on pointers the compiler helps you out and automatically infers the offset -- the amount of bites per <type> -- and converts it for you.
>>
>>57004207

>methods
Are backed by an object. Method calls are just expressions, however.

>classes
A class is an object of class Class. You can even generate new classes on the fly with Class.new.
>>
>>57004183
based trump
>>
File: 1476059182155.png (76KB, 868x700px) Image search: [Google]
1476059182155.png
76KB, 868x700px
>>57004296
speaking of trump, the debate is on in just 20 minutes from now
>>
>>57004353
trump's already fucked, not even worth watching. lost 4 points in ohio off his "GRAB HER BY THE PUSSY" antics
>>
>>57004376
over 90% of voters don't care about pussygate, clinton has done far worse things than talk lewdly in a private conversation, if he can get the message across he still has a decent chance
>>
>>57004353
the whole """debate"""" consists of personal attacks
the US is a fucked up place to live, when your next president can be as dirty as hillary or trump... as were all the previous presidents
>>
I'm creating a little goal making web page. So far it's not much. It just gives you points for every tsdk complete. I'm running into trouble though.
How can I have the score stay the same each time I open the web page? Like if I have 600 points, close the webpage, then come back, I'd like it to still be at 600.
>>
>>57004425
You either need a backend to handle that or use localStorage.
>>
>>57004425
cookies and/or user accounts
also, >>>/wdg/
>>
>>57004376
>antics

How is it 'antics' if he did it over a decade ago and it was strategically released a few days ago because Clinton's illegal actually-recent activities were coming to light?
>>
>>57004376
bear in mind that was 10 years ago so it's not like he fucked up recently. i still wish he got someone to run for him instead of doing it himself. he needed a clean proxy, he's been in the public for way too long to not have dirt like this on him. he'll lose but hopefully he's shown the republican party that people aren't ok with them being open border and free trade. and that there's a desire for populism. a bog standard republican winning would've been only a bit better than hillary winning. either way, things keeping they way they were going was going to have us fucked. so we lose this time and in the future maybe we have a clean politician with the positions of trump without his antics

also i think it was /dpt/ that called me a crazy beaner a long time ago for saying that illegal immigrants are voting in a lot of places, whereas now it's in the news that there's lots of scandals coming out about non-citizens who commited terrorist acts having voted multiple times in the past, and the only reason the public finds out is because they shot up a mall or something
>>
>>57004425
mysql database
>>
>>57004473

I hope the tape of him saying 'nigger' on The Apprentice comes out and he still wins.
>>
>>57004467
i mean semantics, but antics are antics. old antics in this case i guess, but still "antics."
>>57004473
in politics, dirt is dirt is dirt. people are jumping on kaine for some goofy shit he did back in the 70s in south america. the idea (not that i particularly subscribe to it myself) is that your actions before you were political are accurate gauges of your character -- that the further from politics you were when something occurred, the more "natural" it is to your core personality and/or set of beliefs. thing is, trump's an old man. 10 years ago for him is a subjectively much shorter period of time than it is for say, a 20 year old. that's half your life at 20. at 70 it's 14%. to a 70 year old actions taken 10 years ago are much closer to you than 10 years ago for a 20 year old.

or something.
>>
>>57004552
i wouldn't get your hopes up. he wasn't likely to win even before the october surprise. i'm still voting for him but i'd give him a 10% chance of winning. remember that ukip had a lot of failures and was around a LONG ass time before they got brexit. it could be another 10 years before america has a true nationalist revival
>>
>>57004600

Did you hear that Nigel Farage just came back as leader of UKIP? He is honestly my hero.
>>
>>57004581
i'm not saying that he's changed as a person since then. i'm sure he's changed zero since then. you just seemed to be implying that he took some action recently that caused him to be fucked
>>
File: 58331584_p0.png (656KB, 694x1220px) Image search: [Google]
58331584_p0.png
656KB, 694x1220px
have you been optimizing your code /g/?
>>
>>57004635
optimization is for compilers
>>
>>57004635
>implying i can optimize assembly better than a modern compiler can
>>
>>57004581

Still, his antics are nothing compared to what Hillary and Bill have actually done, so I don't see how anybody could use this as justification to vote FOR her.

Anyway, we should get back to programming.
>>
>>57002882
bugfixing, yay!

1 [main] "Ù×╝"ÓÁáµä»Õ¼ÂµäüÙ×╝"µ░ºÒ¼â
5180 cygwin_exception::open_stackdumpfile: Dumping stack trace to GD.exe
.stackdump


what the actual hell.
>>
>>57003532
If I show you the real one I'd get in trouble

Basically what I need is to copy my output created from $2 and into new file $3

I found better luck using an if statement.

Inside if what I have now is
file_name.sh $1 >> ${2}


The thing is though it's not taking the output generated by the for loop it's creating it's own instead because of the $1 in there. I'm not sure how else to redirect it so I end up with the output in the file being different from the output in the screen.
>>
>>57004669
optimize your source code
>>
>>57003681
what does shift do? it moves on to the next parameter? can I change that to $2

I have to leave for 20 min I'll be back though
>>
LMFAO THIS IS SO GOOD
>>
File: 58681464_p0.png (1MB, 1600x1200px) Image search: [Google]
58681464_p0.png
1MB, 1600x1200px
>>57004659
have you been writing your code so your code has the least overhead
>>
>>57004807
quit asking questions and sit in my lap little anime girl
>>
>>57004635
mainly my algorithms. Learning there are better ways to do a lot of things.
>>
File: 1474487105462.webm (966KB, 1280x720px) Image search: [Google]
1474487105462.webm
966KB, 1280x720px
>>57004810
>>
debate is live boys. quit your optimizing and watch the train wreck in real time
>>
>>57004841
shut up
>>
In C#, if a method is a
public static async Task

then the static refers to the Task (I.E. the thing that can create threads) and not the actual contents itself, right?
So if I were to call
Parallel.For(0, 100, i =>
{
Task task = new Task ( () => SomeClass.StaticTaskMethod ) ).Start();
}

it would work as expected and not wait.
>>
>>57004868
IDK what are you trying to say, but static means that method is part of the class type and not from a particular instance, right?

>it would work as expected and not wait.
IIRC that only works when the method is an async awaited method.
>>
>>57004684
It seems I'm killing the stack somehow.
>>
>Sharp-eyed readers will have noticed that at the start of this discussion of matrices I said “in OpenGL”, not “in WebGL”. This is because WebGL doesn’t have this stuff built in to the graphics library. Instead, we use a third-party matrix library — Brandon Jones’s excellent glMatrix — plus some nifty WebGL tricks to get the same effect
Well fuck you I'm not a sharp eyed reader, and want to know how to do all that without juggling libraries.
>>
>>57005009
>>>/g/wdg/
>>
>>57005009
Neither OpenGL nor WebGL provides a matrix library.
>>
>>57005009
>we use a third-party matrix library
webdevs everyone
>>
>>57005040
I recall that GLSL matrices are a thing, but I'm guessing there's no simple way to create a matrix in WebGL?
Could always go with an array I suppose.
>>
>>57005072
>sizeof argv[1]
>sizeof(char *)
Are you sure that is actually what you want? strlen seems to be what you're actually looking for.
char s[strlen(argv[1]) + 1];
strcpy(s, argv[1]);


There is also the non-C standard (but POSIX standard) strdup.
char *s = strdup(argv[1]);
...
free(s);
>>
>>57005072
What do you expect
sizeof argv[1]
to resolve to?
>>
>>57005104
thx, just read how retarded I am hence deleting it
>>
>>57005065
Within the shader language, yes, matrices and vectors and swizzling, all that good stuff.
However they don't define how you should store a matrix in your RAM, only how they should read it from your RAM (order, stride, etc) when you send it to the VRAM.
>>
>>57003380
How are you gonna implement that function?
>>
>>57005065
you upload it from an array
>>
What's a more useful class in computer science:
Numerical Methods
or Cryptography?
>>
>>57004937
I'm asking if I, from any thread, call a public, static, asynchronous task with a lambda expression if said task will operate as intended (by running on a new spawned thread each time it is called, which the operation that called it will not wait on)
>>
>>57005239
To put it in simpler terms:

If I call
[quote] Task task = new Task ( () => SomeClass.StaticTaskMethod ) ).Start();[/quote]

at the exact same time in two different threads, will everything operate as intended, with it spawning two threads that neither of the other two threads wait on?
>>
>>57005255
AFAIK, yes, but might be careful with accessing/writing the same resources at the same time, because it could corrupt data. Btw, currently I'm reading the book "Async in C# 5.0", might help.
>>
>>57005218
Numerical Methods.
>>
Okay, this is a dumb question:

lets say I have class A with a constructor.

And I have class B thet contains a array of objects of class A.
upon the creation of an object of class B, is the constructor of A called for every element?
>>
>>57005383
if you got it on your class B's constructor you fucked up
>>
according to my professor for c#, my project is "not incorporated"

Wtf does that mean? it works exactly as the lesson says it should and I dont have any errors
>>
>>57005383
Yes.
>>
>>57005383
in java i believe yes and that the default constructor is used
>>
>>57005419
Maybe not extensible or "able to be incorporated into something" is what he meant?

Like "write fizzbuzz up to 100" and writing "printf("..., 24, buzz, 26,...")" would also produce the correct output with no errors but still be wrong.
>>
>>57005428
Yeah thanks.

>>57005448
it's c++.
>>
>>57005452
yeah but hes given chunks of the code and im supposed to make it work using what we're learning and I have.
idk im confused as shit, i emailed him
>>
>>57005503
Okay, I figured out I must be leaving an array subscript somewhere. That may take a while.
>>
>>57005419

Maybe you should ask your professor what the fuck that means.
>>
>>57005419

Look up how to incorporate a business and you should be on your way.
>>
>>57005672
I did but its 10:30, not really expecting a reply and didnt know if this is some general term programmers use that I didnt know
>>
File: 59209057_p0.jpg (2MB, 1061x1500px) Image search: [Google]
59209057_p0.jpg
2MB, 1061x1500px
>>57005717
he probably meant that he didn't teach you to do it the way you did it, but that's me just guessing, but if i'm right your professor is probably a stupid asshole
>>
>>57004841

fuck all that noise.
>>
>>57005419
name your source
homework,inc.cs
>>
>>57003681
>>57003532
In case you are still around thanks a bunch. Couldn't have figured it out without yall

So for the past 3 hours I autistically did trial and error. Finally had a breakthrough

What was missing was a duplicate echo with output in the for loop that had >> ${2}
#inside my for loop displaying all my echos
echo "picked output"
echo "picked output" >>${2}


This displayed the echos to the screen and copied that to a new file like I wanted. Had I not began on a goosechase after posting here I doubt I would've figured it out
>>
>>57005871
not him but i enjoyed the debate big league, trump really stepped up his game, probably with the coaching of based nigel farage
>>
>>57005601
yeah thats what you are supposed to fact check -_-
>>
>>57006048
He did well, plus she's more or less blown her load and has nothing left at this point
>>
>>57006048

gonna vote third party. i like trump, but I can't support a candidate whose against encryption
>>
>>57006097
might as well not vote idiot
>>
>>57006186

nope I think I will
>>
Help! I need a regex nerd ASAP.
>>
>>57006274
>He can't do regular expressions
How do you even call yourself a computer scientist?
>>
>>57006286

lol I don't, your banter will be dismissed.
>>
>>57006301
If you're going to ask a question, just ask it.
There is no point going over some exchange where someone says they are going to help you.
>>
>>57006317

You are correct...might as well ask now.

I want to evaluate a string with a pattern, so I can extract a portion of the string. In example if I have
Word:123456
, what I want is 123456

So how would it be?

(for the record, I plan to learn more about regex in the near future, but in the meantime I need help)
>>
>>57006423
nothing in vanilla regular expressions, but a common feature of regexp libraries is that you can form "captures" of pieces of your regular expression, basically meaning that when you match, it will output the string that matched part of your regexp. I'm not sure how that usually works though because I use the superior parsing technology of parser combinators, such as those in various haskell libraries.
>>
>>57006423
Use sub-expression captures.
You put parenthesis around the part of the match that you want to extract:
[a-zA-Z]+:([0-9]+)

I don't know what languages and regex implementation you're using, so I can't tell you exactly what function/method to call, but there will be one that will return all of the sub-expressions found in the regex.
>>
I am writing a B+ Tree

http://paste.debian.net/860476/
>>
>>57006493
lol, not good enough to write an A+ tree?
>>
>>57006539
Literally Rebbit humor
>>
>>57006608
dumbass
>>
>>57006452
>>57006478

I get the gist of it, it did work so thanks for that. I'm doing my best to unpleb myself in order o avoid this type of questions.
>>
>>57006539
good joke anon, i liked it
>>
Reading the C++ standard. Currently on page 89.
>>
>>57005528
that error was so stupid, I actually facepalmed so loud that the cat woke up.
>>
What is the best IDE for C++?
>>
>>57002461
Reddit is where dumb people go to act smart, 4chan is where smart people go to act dumb. Given your writing, I suggest you get back there afayc.
>>
>>57004635
can you stop posting these
im at nofap day 2
>>
>>57006971

If you must use an IDE, use QtCreator. Otherwise, I recommend using a good text editor with gcc and make (and maybe cmake or automake)
>>
finally mastered ncurses
#include <time.h>
#include <stdlib.h>
#include <ncurses.h>

int
main ()
{
srand(time(NULL) + clock());
initscr();
noecho();
curs_set(0);
halfdelay(1);

int y, x;
getmaxyx(stdscr, y, x);

while (1) {
for (int i = 0; i < rand() % (y*x); i++) {
mvaddch(rand() % y, rand() % x, rand() % 256);

if (getch() == 'q')
goto exit;
}
clear();
}
exit: endwin();
}


also, rate this source code
>>
>>57007039
>rand
>>
How do I master C?

>>57007049
Where do I get randomness from then?
>>
>>57007058
https://en.wikipedia.org/wiki/Xorshift
>>
>>57007058
>How do I master C?
Just as another thing, practice. "Deep C secrets" might help too.
>>
>>57007058
Step 1: Read the standard
Step 2: Read the standard
>>
File: 1474435644684.jpg (14KB, 343x343px) Image search: [Google]
1474435644684.jpg
14KB, 343x343px
>>57001843
>15,017 allocs, 15017 frees
>>
>>57007176
>not 15017 allocs, 0 frees

just let the OS clean up for you
>>
>>57007176
When my browser has been swapping real good, and I mean 1G swapped to disk, then it takes 10 minutes to exit because it tries to free everything first.

Don't do that.
>>
>>57007189
but then my professor would get mad at me!
>>
>>57007189
You should stop programming.
>>
>>57007229
Depends on what you're doing.

http://www.drdobbs.com/cpp/increasing-compiler-speed-by-over-75/240158941

>Since compilers are short-lived programs, and speed is of the essence, DMD just mallocs away, and never frees.
>>
>A prvalue of floating point type can be converted to a prvalue of another floating point type. If the
>source value can be exactly represented in the destination type, the result of the conversion is that exact
>representation. If the source value is between two adjacent destination values, the result of the conversion
>is an implementation-defined choice of either of those values. Otherwise, the behavior is undefined.
the more you know
>>
working on a real project with Rust+GTK. things I've learned so far:
- Rust's syntax is in need of repair. missing sugar for lots of common patterns
- error handling in Rust is about as meme as
if err != nil

- designing usable Rust libraries actually takes some thought
- Rusqlite a shit
- gtk-rs is great
>>57001866
it's a meme. judges your programming ability by how good you are at writing a lot of code, instead of how good you are at writing a little. see http://programmingisterrible.com/post/139222674273/write-code-that-is-easy-to-delete-not-easy-to
>>57002233
>>57002498
reminder that "ML" refers to the ML family of programming languages and not memechine learning
>>
File: goatse1.jpg (3KB, 93x125px) Image search: [Google]
goatse1.jpg
3KB, 93x125px
i want to learn go can anyone recommend me a good book?
im looking at:
The Way to Go: A Thorough Introduction to the Go Programming by Ivo Balbaert
Programming in Go by Mark Summerfield

tending towards the first one.

reason being im a fullstack webdev and usually do backend stuff, mostly rest apis, databank and business logic with either python or node and sometimes rails.
increasingly however ive run into various issues with all those. go seems like a good alternative and seems to be made with the web in mind.
>>
>>57007106
As dumb as this sounds, is there anywhere that you can easily read the standard in one place?

It was really helpful for Python and Erlang but I never found anything similar for C
>>
>>57007376
lol just use React.js
>>
>>57007392
The standard is published as a pdf.
>>
>>57002017
>C
Strawman

nums.reduce(function(a,b){return a + b}) / nums.length


I have enough faith in programming languages to guess that your code is probably just shit
>>
>>57007395
i dont think you know what you are saying.
>>
>>57007432
Meant for

>>57003074

Anyway. I'm up for a coding challenge that isn't as gay as typoglycemia encoder.
>>
>>57007432
in haskell this is just

uncurry div . (sum &&& length)
>>
Hey faggots I have a question.
Everyone points and laughs at PHP for being a dead language that nobody uses, yet I see tons of job listings that are pure PHP required and focused. What gives? Questioning if I should bother learning it or not.
>>
File: Grid.png (22KB, 198x204px) Image search: [Google]
Grid.png
22KB, 198x204px
>>57007501

Solve this numerically
>>
>>57007525
>pure PHP
Okay
>>
>>57007525

>Implying 50 year old company bosses who have no idea of a computer work and what is good / bad for their websites know which kind of programmer he should hire.

It is on life support. When this kind of people get advised by someone even remotely tech savvy, it is over for PHP. No real engineering / programming company hire this kind of person.
>>
>>57007459
? react.js + server side rendering with tensorflow is pretty much the way to go for backend web design these days
>>
>>57007525
It doesn't really take long to "learn", the thing is that no one fully knows PHP, not even the developers

One of the reasons it's such a pain to work with is that it is completely random and inconsistent and you have to keep the documentation on hand, even though that itself is full of wrong answers
>>
>>57007561
>>57007544
>>57007569
I was just wondering because like I said I've seen numerous listing asking for PHP and nothing else, here's an example.
>Title: PHP Developer needed for 1-2 week project
>Desc: We need a strong PHP developer for a 1-2 week project which could extend to longer term work.
>The project revolves around intelligent chat - building a script that takes an input, compares it to a database, then returns a value. If the input doesn't exist, the system needs to clarify what the user is looking for, store and associate the original request, and return the closest stored, similar value. We have the chat system, just need someone to help on this script.
>Must be an expert at PHP/MySQL.
Anyways thanks for the replies guys, I really appreciate it.
>>
>>57001923
wow
>>
>>57007602
Why PHP? Is it just being used as a wrapper?
>>
>>57007432
>>57007501
>>57007507
My solution will not overflow on any input and does not convert to a larger type.
Your solution does not have those gurantees.
>>
File: cat-halp.jpg (75KB, 347x364px) Image search: [Google]
cat-halp.jpg
75KB, 347x364px
Hey /g/, I hope you wouldn't mind me asking, but I really need some help.
You see, I have a test that I really need to pass today in 5 hours.
I need to write some random class in C++ and give description of what each part of it does and what it is here for.
Now, I could have easily done it two or three years ago, even a year ago probably, but my programming skills became very rusty lately.
What can I read/watch and where to look for some examples?
It shouldn't be anything fancy, but I have little time(five hours) and as my computer broke down 2 days ago, I can't really programm on anything bar online compilers.
>>
>>57007376
Go is really nice, you don't need a book to learn it. Just imagine you're writing nodejs code but it's in C with a ton more libraries and less memory management. It has all the stuff you're used to, routes and middleware and what have you... you just gotta learn the syntax and a few oddities.
>>
>>57007649
f = uncurry (/) . (sum &&& (fromIntegral . length))
g = f :: [Rational] -> Rational
>>
>>57007702
>Rational
Don't bring that shit into it.
Integers only.
>>
>>57007708
f = uncurry div . (sum &&& (fromIntegral . length))
g = f :: [Integer] -> Integer
>>
>>57007744
>BigNums
Stop cheating.
>>
>>57007748
>BigNum
It's an integer you fucking idiot
"BigNum" is the most retarded 5 year old shit I've ever heard
>>
>>57007770
I know Haskell's "Integer" is arbitrary precision, idiot.
That doesn't satisfy the "not converting to a larger type" condition.
"Int" only.
>>
>>57007777
>I know Haskell's "Integer" is arbitrary precision, idiot.
Read as: "I know Haskell's """""INTEGER"""" is an integer, idiot"
>That doesn't satisfy the "not converting ..."
It takes integers as input. The only thing that's converted is the length of the list. (because it's not generic by default)
>"Int" only
What size of int? 8/16/32/64?
>>
>>57007788
The original statement was "newfags can't average two ints in C".
"int" obviously means the C type, not integers in general.
>What size of int? 8/16/32/64?
It doesn't really matter, as long as you stick to one.
>>
>>57007824
>averaging 2 integers in C
Part of the joke was people giving a function that returns an integer, but whatever

f xs = sum qs + (sum rs `div` n)
where n = length xs
qs = map fst qrs
rs = map snd qrs
qrs = map (`quotRem` n) xs
>>
>>57007824
>It doesn't really matter, as long as you stick to one.
Actually part of the fun is that C ints can be any of these sizes.
>>
>>57007844
Just to be pedantic, "int" in C must be at least 16 bits.
>>
>>57007836
For reference:

qs is a list of quotients, rs is a list of remainders
e.g.

qs = [1 / 10, 2 / 10, 3 / 10, ... ] (where / is div)
rs = [1 % 10, 2 % 10, 3 % 10, ...]
(10 is the length of the list)

What it gives is the sum of the quotients (the results of (`div` n)) plus [[the sum of remainders (the results of (`mod` n))] divided by the length], so
[1,4,7] -> (1/3 + 4/3 + 7/3) + [(1%3 + 4%3 + 7%3)/3]
(0 + 1 + 2) + [(1 + 1 + 1)/3]
4
>>
>>57007836
>>57007874
and if you do genericLength or (fromInteger . length) then it will work on any integral, including Int/Integer/Word8/Word16/etc
>>
>>57007884
>fromInteger . length
fromInteger . toInteger . length
Haskell's quite autistic about this, but there is a genericList in Data.List
>>
New thread:
>>57008055
>>57008055
>>57008055
>>
>>57003675
Yeah, and how do the operators know what to do with the text? suddenly you have types again.
Fuck off.
>>
File: 1474407401351.jpg (204KB, 1200x833px) Image search: [Google]
1474407401351.jpg
204KB, 1200x833px
>>57007019
Nofap is stupid and unhealthy, just give in already.
There's no harm in it.
>>
>>57004768
sorry was gone figured I'd reply today if you still needed help.

since I assigned the content of $1 to $limit in line 3 I did not need it. Shift moves all of the variables in $@ to the left by one and drops of the first one on the left ($1) you could also use that in your loop to go through the variables one by one.

So $1 dropped with shift and the content of $2 was moved to $1 so you could now use $1 to refer to the 2nd parameter.
Thread posts: 321
Thread images: 23


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

I'm aware that Imgur.com will stop allowing adult images since 15th of May. I'm taking actions to backup as much data as possible.
Read more on this topic here - https://archived.moe/talk/thread/1694/


If you need a post removed click on it's [Report] button and follow the instruction.
DMCA Content Takedown via dmca.com
All images are hosted on imgur.com.
If you like this website please support us by donating with Bitcoins at 16mKtbZiwW52BLkibtCr8jUg2KVUMTxVQ5
All trademarks and copyrights on this page are owned by their respective parties.
Images uploaded are the responsibility of the Poster. Comments are owned by the Poster.
This is a 4chan archive - all of the content originated from that site.
This means that RandomArchive shows their content, archived.
If you need information for a Poster - contact them.