/dpt/ - Daily Programming Thread

old thread: What are you working on, Cred Forums?

Other urls found in this thread:

gnu.org/software/libc/manual/html_node/Exit-Status.html
github.com/expeditiousRubyist/Memesnake/blob/master/Makefile
stackoverflow.com/questions/388242/the-definitive-c-book-guide-and-list
developer.mozilla.org/en-US/docs/Web/API/WebSockets_API
pastebin.com/iuWPvWTf
play.google.com/store/apps/details?id=planc.refugeeraft
gcc.gnu.org/onlinedocs/gcc/Vector-Extensions.html
en.wikipedia.org/wiki/64K_intro
twitter.com/NSFWRedditVideo

What the fuck is that op?

Second for Haskell

...

Sneks blown the fuck out

Do we need more women in tech ? why?

Is there any reason to learn Java or is just another one of those learning languages like python

Learn D, it can do everything Java can and more

just another lang

Bjarne's book on sepples told me to write a function with no return value using void. So I tried this in Visual Studio:

void write_sorry()
{
cout

RESTful interface to LDAP, not even kidding

Visual Studio a shit

Yes
Women are cute and nice to look at, fat guys with glasses are not

Women suck.
We need more guys dressed like schoolgirls in tech.

reminder to set up a local dev environment if you're doing webdev

you'll save so much time not having up mess around with an ftp program every time you change a line of code

...

I thought this went without saying?
Who the fuck tests all their changes live?

>What are you working on, Cred Forums?
Making pong in SFML

this isnt Python you webshit
you need a main
it's complaining about your "write_sorry();"

cont...
I still have no idea how to make the UI for thesemobile apps...
does anyone have experience with node.js + mapbox?

>learning languages

i had to do it because i wasn't allowed to export order info

Then create a sample database with dummy data?

Are you retarded?

...

Yes,
because the technological masterrace needs to reproduce.

Our autism enables us to do great things, but at the same time hinders the development of some skills. We need to increase our quantity, and the
best way to do that is to increase contact with women.

1) I am new to programming and C++ is literally my first language, I'm not a webshit
2) I do have a main function, I didn't bother including it in my post for brevity

what is even the point of "return 0" if void itself is supposed to return nothing?

Please tell me this is uncensored

hipster cutie

What the fuck is mapbox?

You can make cross platform mobile apps using html+JS using cordova, phoneGap, appcelerator and a bunch of others.

it's edited. original wasn't very good. art style isn't suited for hentai

Still working on akari-bbs!

I had this idea about giving each quotelink it's own unique ID, but I couldn't figure out how to do it in a deterministic way without introducing the same problems as my current version.

Namely, if you spam >> linkquotes to the same post, the popup only appears on the top-most one.

yes :(

wow, that's an autistic idea. but I must concur with this.

uh... just put the mouse over target as the one to display it next to

you know you can connect to the database directly from your local machine...

main is still returning an int you dipshit.

main returns an int

"return 0" is used as an exit code. If everything goes well and your program runs without any issue, it will end with exit code 0.

If it doesn't return 0 (a common one I see is "exit code 9"), that means there was an error ("9" means that you had some sort of really long loop and had to terminate the program manually)

I probably explained it piss-poorly, so here's gnu explaining it
gnu.org/software/libc/manual/html_node/Exit-Status.html

i only did it for a year and a half and didn't do /that/ much work

only since i got hired hourly did i decide to spend a few hours setting it up

But what is even the point of needing to return anything with void?

The code in the textbook is literally pic related, but it won't compile because of no return value for void. But why should void need a return value at all?

>i only did it for a year and a half
>only
>a year and a half
>1.5 years
>547 days
>only

I already know this and it is irrelevant to my question, see

you can completely skip the return 0 part and nothing bad will happen

main isn't void
main returns an int
so the return 0 is main returning 0
kys

post your fucking code you fucking idiot
all of it

fucking frogposter

Well, I can't speak for all the uses for void methods, but in cases where you simply need a method to display text, it's useful to have a function that doesn't return a value and just displays output.

example:
void displayIntroText()
{
cout

How do I select that in javascript?

>>>>>>>>>>>>>>>>methods

This stuff

sorry guys, a beginner here, but there is a way to program before creating a project?

like just code first and after decide directory, name etc?

i'm using the language C++ (actually in Code::Blocks IDE)

>all this drama about returning value to void
forget about C++ and go C. C fucks all the rules

when you're only doing a couple of hours a week its not a big deal

this is why IDEs are cancer
just use vim

func(x,y)
{
(x

No. Despite claims from the industry that they are going to be desperately starved for labor, it should be plainly obvious from any programmer's perspective that there is no labor shortage at all. We still have some cases of computer science majors graduating to not even find themselves in a job in their field.

We don't need more people period. And qualifiers like gender, race, sexuality, etc... are meaningless descriptors when looking for employees. Credentials should be the only category one considers. If it turns out that one is disproportionately one of these qualifiers relative to the nation's population, as long as it can be demonstrated that one is not discriminating, the discrepancy can be chalked up to lack of interest or skill in the group.

Try not using an IDE. Just type up your code in a text editor, save the file, and then run gcc in your terminal to build.

its just the target of the mouseover...
so the callback would be like function(el){ el.target }

IDEs not even once

What's edited? The story or the artstyle?

>And qualifiers like gender, race, sexuality, etc... are meaningless descriptors when looking for employees.

There have been a few automated CV analysers that seemingly have learned to be racist or sexist to pick better candidates

>see

If the code of we have two functions. the first one
void write_sorry()
has the return type void and so it doesn't have a return value.
In the function body
{
cout

nice numbers
>try not using an IDE
Any reason in specific to not to use?
or just a simple solution?

so... literally use any text editor, like "notepad.exe" and compile after?

there are better text editors, such as sublime text, atom, vim, emacs, etc, but yeah.

>sublime text, atom

If he's always used an IDE, this is what he'd like.

I'm wondering how I should go about analysing some time series data to identify possible correlations between events and trends. I tried doing it in excel but excel doesn't seem to work very well with large datasets and dates, so I'm wondering...

Anyone know of a good data analysis / data plotting system that works in something like ruby or Python which has good documentation?

that still doesn't answer my question, I don't know why everybody keeps trying to tell me about return values when I stated I already know this several times. I suppose I worded my question poorly.

actually the problem was that I am in fact retarded, but for a different reason. I was trying to execute the function in main by writing the function *after* main instead of before it, now it works

thanks anyway though

No wonder you can't program
You're a frogposter

learn what a function prototype is

I'm assuming I will when I get to chapter 8

do you have any idea how much time i've wasted on a simple mistake like this? i accidentaly used single equation instead of double in if statement. fun part is, it didn't change the way program worked

u choose to return void or not, no need for it

Hey /dpt/, retard coming through

How exactly do "p2p" network protocols work?

I mean, even if I'm torrenting, I have to connect to a tracker (a central server) in order to get the list of peers who have the file?

To go along with the example, how is bittorrent p2p if I am required to connect to the tracker in order to get the required information?

>I don't know why everybody keeps trying to tell me about return values when I stated I already know this several times.

But anime poster, I already know this.

If you're ever working at a big company, do your best to build a positive relationship with your manager.

I just got the job I wanted in the office I wanted despite downward trending performance reviews because my manager advocated for me.

It's true in university too: build a relationship with your professors. I got away with taking the final in the third week of class and having that be my full grade because I chatted with the professor after class.

learn what a function pepetype is

The actual file transfers are P2P. Also, you're not limited to 1 tracker.

so you would have know that its purely template consistency and u wouldn't have to ask the question in the first place.

the file transfer is purely p2p. also because you can use DHT
...which technically is still a tracker but you pretty much connect only once

>Any reason in specific to not to use?
IDEs make you dumber as a programmer, because they don't force you to think about how your program is laid out, or how it is built. Everything gets abstracted behind "just hit build", but when you need to change the build process, everything is a lot more of a pain in the ass to change compared to just modifying a build script or a makefile.

And once you've actually gotten used to writing code with a proper editor and the command line, IDEs just feel like a bloated piece of shit that gets in the way more often than not.

added some new animations.
It's laggy because it's running on simulator, couldn't run on iPhone because iOS 10.

You actually don't need to connect to a tracker. With DHT + peer exchange, you only need to connect to at least one other peer in the swarm to bootstrap.

'Not Touhou'/10

Maybe you're right, and now I am sort of forgetting why I had a problem in the first place, since it stopped asking me for a return type when I moved the function to before main instead of after

but I did already know that void isn't required for a function and that functions either can or can't return a value depending on what you want to do, which is what I thought you were trying to tell me

So when are you going to fix the art style and redo the heart, star, and clock icons?

YOU'RE A BLOATED PIECE OF SHIT, RUBY! I'LL NEVER FORGIVE YOU FOR THIS INSULT.

wait no now I remember

basically the function has to be declared before main and executed inside main (unless you're using function prototypes I guess, which I haven't learned yet), my fuckup was that I was trying to execute the function outside of main, and declaring it after main

is this correct?

Reposting because of I'm total lost.

(You)
(You)

Nice game user

Hi /dpt/, I'm writing a server for a university project. The server has to communicate messages between two clients. My plan was to do something like this:

Do forever:
find a connection
if you have 2 or more connections:
take the two oldest connections
launch a thread with details about those two connections

thread(clientA, clientB):
Do forever:
if clientA has a message:
sendTo(B, clientA.message())
if clientB has a message:
sendTo(A, clientB.message())


Does this actually work in the context of threads? I've been looking at some example servers and they only seem to connect the client to the server for the purposes of relaying information. I'm wondering if I misunderstand threads, and that each thread has a socket/address built in and it can only have one. If so, how would I implement the thread structure I described in Python?

Thanks for your help

remember user top-bottom left-right

>he doesn't use -Wparentheses
pleb

...

We are different people, though.

Did Microsoft give you that 200 plushie to shill for C#?

th-thanks onii-chan

don't post these images ever again

this anime triggers me

...

Have either of you learned Haskell yet?

pls no

the show was too scary and i dropped it halfway through

Not yet.

Can I have a bump, please?

>Java
I've heard use IntelliJ
but Java is terrible

What's taking you so long?
It's easier than C

>What's taking you so long?

I'm procrastinating and I'm stupid. Okay? There it is, the truth.

Trying to learn objective C
The book I'm using is pretty chill, but I hate that it does this... Couldn't they just give me a quick run down of what that means instead of making me wait?

>being so stupid you can't understand this code


inb4 muh short circuiting

B-but thats when shit turned really crazy...

I'm fixing some shit, soon I will be dealing with the sprites user!

Why does this work:
//mapDisplay is a DataGrid
SolidColorBrush myBrush = new SolidColorBrush(Colors.Red);
mapDisplay.RowBackground = myBrush;


But this doesn't?
foreach(DataGridRow x in mapDisplay.Items)
{
SolidColorBrush myBrush = new SolidColorBrush(Colors.Red);
x.BackGround = myBrush;
}

Really made me think

>it's valid Haskell code

but why

who does this

>new SolidColorBrush
inside the loop no good

self-documenting code

Doesn't do any good outside of it, either.

False && _ = False
_ && False = False
_ && _ = True

-- or

(&&) x
| x = id
| otherwise = const False

You probably gotta pass DataGridRow x as a reference

What's the best way to add text to a textpad in Tkinter?

aaaand another example of a haskell user prematurely abstracting something completly fine for no benefit, sacrificing readability

As in, display a certain word in the text area.

Pretty readable to me m8

True && x = x
False && _ = False

(this is the same as 's second definition)

So how do i compile multiple files in terminal(c++)?
Do i need to:
g++ "main.cpp" "then.cpp" "other.cpp" "classes.cpp" ?

Why don't you try it and see?

how so
SolidColorBrush myBrush = new SolidColorBrush(Colors.Red);
foreach(DataGridRow x in mapDisplay.Items)
{
x.BackGround = myBrush;
}

im doing it user, im doing it

This doesn't change the background of my DataGrid. I'm not sure why.

constructors
operator overloading

I haven't done anything in c++ for a year, I'm rusty desu

>desu
wtf lol
i typed i'm rusty desu

>being this much a newfag

baka desu senpai

i didnt know about that тбх user, pls no bully

i haven't been on Cred Forums for a year, I'm rusty desu

Hey guys im new to computer science. first time student., when do i start to comprehend things in the long run? this is getting really difficult to learn so fast. a bit overwhelming to say the least.

codecademy is a shit resource, that's why you're having a bad time

py has nice docs, you should check that

what does?
seems pretty advanced to be honest. whats wrong with it?

>what does?
a?

emt

tfw your epididymis is swollen and you cant program

He знaм штa дa ти кaжeм дpyжe, нe paзyмeм тe (((
Дeлyјeш ми пpиглyпo, нaдaм ce дa гpeшим (((
Хтeo caм дa кaжe дa јe пaјтoнoвoa дoкyмeнтaцијa дoбpa, мoждa би тpeбao дa јe пoглeдaш.

Using codeblocks as idea
Want to use termite as terminal
'termite -e' results in a terminal that only flashes and exits. What flags do I use? 'xterm -T $TITLE -e' works fine

You'll start to grok it by the end of your data structures course and have a good feel for it by the time you hit software engineering and senior design stuff. At least if your university is similar to mine in any way.

Ideally, one of two scenarios:
>Launch a thread for every connection
>Put new connections in a queue for a pool of threads to handle

The first is easiest to implement, but the bottom is the correct one. First is similar to what you posted just minus the "if you have 2 or more connections". Second should go like this:

ListOfThreads : List of Threads
PacketQueue : Queue of Packets

Start:
spawnThreads
Do forever:
wait for a new packet to arrive
add to queue: new packet

Thread:
Do forever:
while there is no packet in queue
wait
otherwise
get packet from queue
do main processing here

I'm experienced with C#, but I barely know anything about C++.

I just spent 5 hours debugging my code only to find out that how C++ takes an argument is different from C#

what I did:
int main (char args[])
{
return 0;
}

what it was supposed to be:
int main(int argc, char* argv[])
{
return 0;
}


are there any other traps that I have to watch out for as someone who's coming from C#?

adderall-fueled autistic megapost incoming, pls don't judge me:

we should have as many women in tech as are actually passionate about tech. the problem with recent campaigns to garner interest in tech among women is that they ignore reality, and they are misleading. there already exists definitive evidence that there are (and there are bound to be) general differences in the levels of interest in an occupation between men and women. a study that surveyed people in 50-something countries covering a very wide range of social/cultural states found that, while the overall levels of interest in a given occupation vary based on country/culture, the difference in interest between men and women is about the same in every country, from ultra-progressive countries like norway and sweden, to countries where women are legitimately and significantly oppressed. another study found that male and female infants tend to display significant differences in interest (measured by duration of eye contact) extremely early in life, proving that there are differences between the average male and female brain not caused by social conditioning (which shouldn't surprise anyone because we've been evolving as a dimorphic species for ages, but it still manages to be controversial). with that in mind, consider how aggressive campaigns looking to equalize gender distribution in occupations may do more harm than good. if men and women tend to have different interests, but you make great effort to get particular jobs to a 50/50, all you've done is mislead some number of people into a career they don't actually enjoy or find fulfilling as much as they would something else if you hadn't been there to "guide" them. doesn't quite sound like a liberal utopia to me

(cont.)

and i've already seen campaigns that are aggressive to the point of being deceptive, which is fucked up. if the only way a particular girl will touch tech is when you show her she can 3D print a bracelet, or randomize articles of clothing on a model, then that girl quite possibly isn't really interested in tech, but rather fashion. and if that's the case, exaggerating (or fabricating) the prevalence of tech in fashion or jewelry design or whatever isn't gonna do her any favors. there are campaigners out there who care so much about getting the numbers up, they're willing to decieve impressionable young women, who could very well then go into debt for some tech degree program, only to ultimately realize they're not really into it when they find out what kind of work is actually going to be available to them in the real world. they should be finding the people who are actually naturally interested in tech and giving them access to resources to pursue their interest, not tricking as many people as possible into thinking they're interested in tech

It was a joke post, but im in MIT on my third week about to be on my 4th.
Still the same ideology stands, feels like im learning how to swim by drowning.

>Generics/templates don't work the same way
Generics in C++ don't work anything like they do in C#. Don't think of them as the same
>Namespace conflicts.
It's why you'll see a lot of examples using std::cout rather than
using namespace std;
...
cout Always free your memory.
There is no GC to do it for you.

>are there any other traps that I have to watch out for as someone who's coming from C#?
Sepples foreach are better, they can change the collection itself, but that might change the iterator.
Learn pointers, references, and smart pointers.
You can have multiple inheritance, and static variables in functions (goddamn, I really miss those).
And obviously C++ isn't GC.

There's a lot you have to have perfect for it to do anything. You'll get it but it takes a while.

>friend at uni was trap
>went to career fair for internships
>didn't get a single interview
>goes next day to career fair dressed as boy
>gets an interview everywhere he went

>Autistic cross dresser
>Vs
>Autistic guy.
big difference.

Oh and just a bit of clarification:

The main difference is how much resources are used on the system.

On an idle system, the second version takes more resources because you have several idle threads. But if you request 1000 times within a second, you'll have 1000 threads compared to maybe 4 or 8. Those threads are expensive to spawn.

I dont get it, one was wearing the cross taht jesus died on and he got the job? sorry english no frost language

Yes

Thanks

she come to india we do not think discriminate, she have job programming instant

Deal with it, GTP. Regular text editors are superior.

If you're trying to score an interview, you should dress professionally.

>Facebook is proud to be an Equal Employment Opportunity and Affirmative Action employer.

Does this sentence contradict itself /dpt/?

The trouble is that I specifically need to pair connections together. It's a one-on-one chatting service, not everyone in the same room. That's why I structured my code the way I did.

Please share your makefile template. I prefer text editors, makefiles, terminal, etc. And they are more maneuverable. But fuck me are they a pain to learn to use.

rv = SSL_CTX_load_verify_locations(
tallis->ssl_context,
"/etc/ssl/certs/UTN_USERFirst_Hardware_Root_CA.pem",
"/etc/ssl/certs");


Is this the correct way to use this function?

If you're on windows, you should write C++/CLI and use WPF for graphical applications.
Forget code bollocks, use visual studio community 2015.

>C++/CLI
How to take away all advantages for using C++.

You can always just add more information to the packets.
Your packet should become:
{ Room#, WhoSentIt, Message }

Your system will then take that packet, find the correct room for it, and do the rest that you'd usually do.

Fuck off and derail somewhere else

the story.
the artstyle is pretty great actually. I've seen it before, but I don't remember the source

what's the best book to learn c++? Programming: Principles and Practice Using C++, by Bjarne Stroustrup?
I already know a bit of C (from the basic stuff until stuff like how to work with pointers, structures, etc.)

This was the Makefile I used for a project called Memesnake:

github.com/expeditiousRubyist/Memesnake/blob/master/Makefile

Feel free to make what you want of it.

That's the basic one isn't?
But yeah, Bjarne's book are the way to go.

I see. So, is it uncensored?

That is the book I'm using to learn C++ without any previous programming knowledge, it is the only one listed as good for brand new programmers here:

stackoverflow.com/questions/388242/the-definitive-c-book-guide-and-list

If you already know some C then maybe the books listed in the more advanced categories will help you, such as

>Effective C++ (Scott Meyers) This was written with the aim of being the best second book C++ programmers should read, and it succeeded. Earlier editions were aimed at programmers coming from C, the third edition changes this and targets programmers coming from languages like Java. It presents ~50 easy-to-remember rules of thumb along with their rationale in a very accessible (and enjoyable) style. For C++11 and C++14 the examples and a few issues are outdated and Effective Modern C++ should be preferred. [Review]

Stroustrup's Principles and Practice starts by assuming you are day 1 and don't know what a variable is, but he does mention that the book can be useful to more experienced programmers and says stuff like "If you already have programming experience, you might think x."

Why do people have anime avatars on github?
They clearly use their github as a portfolio.

Don't they realize companies trash their resume immediately as soon as they see cartoons?

Help me. I'm stupid.

struct n
{
int v;
int c;
struct n *p;
struct n **k;
};

//Assume everything got initialized correctly, which I am pretty sure happened.

struct n **tree;
struct n *pop;

//...

for(int i = 1; i < n; i++)
{
tree[i]->p = pop;
//Segfault if I included below line
tree[i]->p->k[tree[i]->p->c] = tree[i];
}


Am I doing something specifically wrong there? Or more information needed?

what if they only want to get hired by the type of place that hires people with anime avatars?

A company I interviewed at saw my Sakamoto (from Nichijou) profile picture and still hired me.

what the fuck are you doing

pop hasn't been malloc'd so you can't dereference (->) it

that's just a cat tho
if you posted nano or hakase you wouldn't have gotten hired

Maybe, yeah. Had the connections tho

Should've put my message about initialization below in the //... .

I can printf pop's initialized fields.

Still better than managed C++.
Also explain yourself, from what I know C++/CLI only added features.

>trashes their resume immediately
>having cute loli as avatar
>still gets hired for the github portfolio

I am this user

I've written my server, and now I have to write the client program. However, my server is written in Python, and I need to write my client in Javascript. All I need is a Javascript function which initialises the connection and returns some object which remembers the connection, a Javascript function which sends a message to that IP/port, and a function which returns a string that was transmitted to that client from the server.

However, I know no JS at all. How can I do this? I found a library called Socket.IO but I think that it might be for Node.JS and I'm not sure if that's different to just Javascript.

If it helps, it's because I am writing a script for Unity that it has to be JS. I could also use C# but I assume JS would be simpler.

use gdb, valgrind

Did you leave out the mallocs? That's the important part.

i am reading k&r today, currently at page 1.
I don't know if that counts as programming though

Sure it does!

like a homeless person looking for a landlord who's homeless too?

People with real jobs don't post on Github, and they sure as hell don't watch anime.

SPJ is equally as expressive in his talks as Haskell is

it's a programming book

if that's true then how come R9K NEETs and various other frogposting fauna are always bitching about how much they hate anime and how Cred Forums is somehow not a weeaboo website?

Doing so, something weird came up. Is there a reason why p would be empty still after assigning it to pop even when pop is initialized?

Please respond.

>Socrates is mortal
>therefore everyone else is immortal
Even people without jobs hate anime sometimes.

if you do
x = pop
pop = malloc
x->
then it will segfault

?

Why?

>all good logic is classical
>what is humanity
>am i a robot?

p = NULL;
x = p;
p = malloc
x->l // what is x??

i interview undergrads to see if i want them to work on projects i'm doing (i'm a grad student). i've seen all sorts of shit, and my responses are generally the following:
- something offensive (swastika, 88, etc...) -> instant reject.
- unambiguous Cred Forumstard or borderline loli stuff (pepe, , etc...) -> lean toward reject.
- benign anime stuff (a picture of a cat, or something like that, like said) -> kind of neutral (there are some caveats, but i doubt anyone cares)
- some facebook tier photo (group photo, a full body shot making their identity basically impossible to discern, essentially using github as a social network) -> lean slightly toward accept
- clear profile shot (clear face, shoulders, maybe down to the waist but not more than half the body; the box isn't that big) illustrating that you're ready to use github like an adult uses any social work environment -> lean toward accept.

maybe you think they're arbitrary. maybe you think they're unfair. i bet if you asked people to rank the inputs i listed you would see the same *order*, if not the same actual outputs, that i gave. you can either complain that it's not fair that the shit you do online negatively affects you offline, or you can deal with it.

C++/CLI is still a managed language. You're compiling to CIL bytecode.

If you want to run shit on .NET, just use C#. If you want to use C++, build to native code proper. If you want to use a good GUI framework in C++, try Qt. You'll have the advantage of also being portable.

>clear profile shot (clear face, shoulders, maybe down to the waist but not more than half the body; the box isn't that big) illustrating that you're ready to use github like an adult uses any social work environment -> lean toward accept.
Holy shit are there actually programmers using Github as a dating site?
Is that why it's so popular? They're using it to social?

What about an anime pic?
You didn't actually answer what you think of an plain old cute anime pic.

So I have a DataGrid in C#, that gets its info from a DataTable:
//mapDisplay is DataGrid & myTable is DataTable
mapDisplay.DataContext = myTable.AsDataView();


This displays absolutely fine, but if I do this, it returns 0:
int x = mapDisplay.Items.Count;


Why is this? It's telling me that, despite displaying a DataTable in itself correctly, it has no items.

>- something offensive (swastika, 88, etc...) -> instant reject.
>- unambiguous Cred Forumstard or borderline loli stuff (pepe, , etc...) -> lean toward reject.

I can understand that.

For anything else I would be indifferent.

>pepe
>reject
How many times have you done this?
You're doing God's work

Isn't mapDisplay using the property ItemsSource instead of Items? Since you're setting it manually.

Why not just attempt to use it to determine whether it's correct? I know nothing about OpenSSL's C bindings, so I refrained from trying to help even though you posted a weeb picture, but to the best of my knowledge, looking at the docs, it seems correct.

better not to distract you with inadequently explained issues

FWIW I work at Google and I've seen several people internally using anime avatars. This is the same picture that shows up next to your name in emails you send. Nobody really cares unless you're obsessive. Programmers can be pretty weird, liking anime is relatively lightweight. As long as it doesn't stop you (or others) from getting stuff done then why would it matter? Obviously if you're a director or VP you need to be more professional, but for an L3-5 it's pretty irrelevant.

Yep, this fixed that problem. Both displayed correctly, but ItemsSource correctly set the count;

I made a script for phantomJS to scrape all "entries" (playlists / songs) from a users soundcloud page, and output a json with song/album info. I just tested this out with a reposts page of an account with 644 reposts and it worked fine.

Finished the login for muh enterprise app, now I need to find a way to store safely the user's password. Currently using dummies values and SecureString.

how about no avatar at all

pls help me

But for some reason this happens:
>use garbage file -> function returns error
>use valid CA -> function returns success
>use valid CA but change a couple characters around manually in an attempt to invalidate it -> function returns success
This shouldn't happen, right?

I'm no expert at PKC, but wouldn't that make it so you're just fucking up the CA's public key? In other words, when you try to verify a signature later in the program, it would fail not because the pem is invalid, but because the (valid) key in it is garbage.

I imagine this could only happen if you replaced characters. What's in that file?

what about no pic at all, and only a few projects?

any decent programming language supports sockets.

With Triggers in WPF, how can you set it so that the colour of a DataGrid cell is changed according to its value? I want all cells with a certain number to be red. This code here is how I have it set out, but currently it just turns any moused over cell Red.

I know that they do, but JS is not a decent programming language, JS is a steaming pile of garbage. I can't find documentation anywhere that just allows me to implement a function for connection, sending a string and receiving a string.

>kinda understand using now

wew

am I 1/1000000th of the way to being a programmer now? I just wrapped my head around this stuff properly

>DataGrid cell is changed according to its value?
>to its value?
To what value exactly?

What the fuck is this op?

Made a script to sort posts by reply count so I can easily find best gifs/webms on /gif/.

var replies = document.querySelectorAll('.replyContainer');
var replyCount, n = 0;
var chanX = document.querySelector("[title='Cred Forums X Settings']") !== null;

function getReplyLength(node) {
if(chanX) {
return node.querySelectorAll('.desktop .container a').length;
}
return node.querySelectorAll('.desktop .backlink > span').length;
}

for(var i = 0; i < replies.length; i++) {
replyCount = getReplyLength(replies[i]);

if(replyCount > n) {
n = replyCount;
}
}

while(n !== -1) {
for(var i = 0; i < replies.length; i++) {
replyCount = getReplyLength(replies[i]);

if(replyCount === n) {
document.querySelector('.thread').appendChild(replies[i]);
}
}

n--;
}


Tell me how shit my code is, /dpt/. I'm new to the programming meme.

My DataGrid Cells contain a value between 0 and 5.

Of course all the top posts ITT are shitposts.

>I know that they do, but JS is not a decent programming language, JS is a steaming pile of garbage. I can't find documentation anywhere that just allows me to implement a function for connection, sending a string and receiving a string.
I 100% agree... I'm having the exact same problem at the moment, can't find docs for a shitload of node packages that are supposed to help me make some app
anyway, I guess you could do it in C#, as you said, or as

>or as *ask

Hi, I don't know about Unity or C#, but I'm experienced in JS and WebSockets, at least. You don't need one thread per connection to clients. For your purposes, I think you're looking for either TCP or WebSockets, not just WebSockets. Socket.io is a library which makes using WebSockets easier, but it's intended for browsers.

So what's the difference between WebSockets and TCP? WebSockets are a thin layer on top of TCP that JS uses. They're not directly compatible with each other, though.

Chances are your Python server is listening for TCP connections (I haven't seen the code), so trying to connect to it using WebSockets wouldn't work. (You'd need a special library to run a WebSocket server in Python, which I assume you would have mentioned.

I don't know much about C# or Unity, but the way I see it, you have at least these options -

Keep the client using WebSockets, and change the server to use WS as well by either:
* Using a Python WS library
* Running a server on Node.js instead and using one of its WS libraries (probably better supported)

Or change the client to use TCP, and keep the server using TCP (which I assume it is doing right now):
* Use C# on the client, and it should be straightforward (I don't know the API, but I would be astounded if Unity didn't have good TCP support)
* Find a way to use TCP from JS using Unity's APIs (not sure how that would work, it's not in standard JS)

babby's first time browsing /dpt/

developer.mozilla.org/en-US/docs/Web/API/WebSockets_API

I think you can use a MultiTrigger, something like:






...



...

Yeah, it's a TCP server. Thanks user, I'll try and do it with C# instead

I need to have a cool web dev project done by monday. I was thinking of making a music visualizer w/ soundcloud api, but that's been done a bunch of times.

Any neat ideas for a two day sprint?

You really need to start using new images, they're getting boring tbqh.

No problem.

I like to think they maintain the theme of the thread, but we do need some new ones to freshen things up. The best ones have captions, so some minor editing work has to be involved.

>We still have some cases of computer science majors graduating to not even find themselves in a job in their field
thats me...

not because i can't but because i haven't tried

im too scared to try

Didn't work for me.

/dpt/ lost a general theme ever since we stopped using Yuki.

All images are fine now.

Well, then you will need to create a custom control (Data/Control Templates), or find a way to use the DataGrid's value for being setted in a style.

I believe in you user. The faster you act the better. I've actually found it really rare that people don't find jobs in CS - and no, I'm not from a prestigious university. Even the people I knew who were incompetent yet graduated have all gotten jobs, because they always end up needed somewhere. Getting *a* job in CS isn't that hard, but getting an A grade job in CS is hard. Popular companies in California have no shortage of bad resumes to toss out. They have no shortage of good resumes to toss out.

Since when have traps and language shitposting not been a thing in almost every thread?

Dudes
I am so drunk right now

nodes = xmlTree.findall(".//listeners")
listeners = int(nodes[1].text) + int(nodes[2].text)


"listeners" : sum([int(a.text) for a in xmlTree.findall(".//listeners")[1:3]])


Which one is better? I guess #1 is more readable but #2 is more compact

>Since when have traps and language shitposting not been a thing in almost every thread?

It isn't always a theme in the OP image and it doesn't need to be is my point.

Yuki has represented /dpt/ more than any trap image has, but that's irrelevant now, all images are now fine.

*cracks a beer*
heh... right there with u bro...

Well, uh... Keep on keeping on, I guess. Won't change what everyone else is posting.

>tfw kinda like being drunk
>but hate beer and most hard a

*pours a glass of boxed wine*

this is for you...

I think more people need to start posting /dpt/ threads instead of letting a single person force their favourite image tbqh.

More variety can only be a good thing.

Smae
I can keep it programming related tho

I'm fine
Just gotta keep it programming related
Don't ban me mods

Okay, I've made progress.
So currently I can change colours based on Cell value. The problem is, it changes the whole row's color instead of the individual cell, even though it's only getting data from that cell. Thoughts on how to fix that?

And so the true motivational factor comes out. Truth be told, I could tell from the first post - at least, I was 90% sure - but I was willing to give that 10% the benefit of the doubt in exchange for the chance at a pleasant conversation.

By the way, this is actually my first time visiting /dpt/ in about a week or so. Do you really think there's some singular boogeyman out there who stays up 22 hours a day and spams trap jokes even though he never sees nobody else respond in turn?

anyone else*

>the land I stand on turns into america for the moment
funny thing is that Nazis used the same argument. almost exactly worded like that as an excuse for their aggression.

can't really tell, gotta show the code

sigh... anyone remember the times students going into CS were expected to at least know how to program?

Too complicated to post here. All that really needs to be understood is that Days of the Week are the Column Headers. That's why I don't understand why setting the binding path to Tuesday would change the background for the entire row.

Okay, so I'm writing a client class in C#. The code is not very good because I don't know C# and am only using it because I have to.

pastebin.com/iuWPvWTf

I am trying to use the Main method as a placeholder until I know everything works, then I'll remove it. As a result, my connect method is private.

Within my Main method, if I don't use "this.transmit()", "this.receive()" and "this.connect()" it errors on compilation with:
"An object reference is required to access non-static member "
Okay, so I have to put the "this"s in, right? But then if I do, it errors:
"Keyword 'this' is not valid in a static property, static method or static field initialiser"

Does anyone here know C#? I only know Java so am bumbling through.

u would get more of a clear idea making a simple datagrid in some other project and tried stuff there, and actually looking at the documentation for it.
solving something randomly doesn't really tell you much

Was that ever a thing outside of prestigious universities? Computers used to be more expensive and less available than they are now.

I don't know C# at all, but it looks like you want those three methods and the properties they reference to be static. The same error would happen in Java. Basically, since main is a static method, this doesn't exist, so you can't do this.connect(). If everything's static, and the this references are removed, then no errors regarding this should be thrown.

Yeah I just worked this out, thanks anyway user.

What about pseudo-artistic zerochan/pixiv images?

are we voting for pepe

>Was that ever a thing outside of prestigious universities?
Over 20 years ago there were only a handful of unis that had CS courses, so things were different. And it wasn't like it was an official requirement. You just got assignments that needed programming so either you crammed it _somehow_ or you came prepared.

>solving something randomly

It's called trial and error, Mr. Reddit.

So what's a data structure wich implementation is kinda rare in c++ and would be useful for devs to have something to import and forget?
I want to do something like that and put it on github.

learning programming makes me want to kill myself

Why on earth are you doing it then?

because I want to make computer programs

you mean games?

no

molyneux is an aggy daggy meme tho

If making programs makes you want to kill yourself, then maybe you don't actually want to make computer programs.

Array.

why use an array instead of a vector

a vector is like a resizable array, if you don't need it to be resizable you use an array

Exactly.

use a vector anyway so you get rid of having to put stuff on heap yourself and get a cleaner code

To all of you who works as a programmer/developer:

Do you suffer from scoliosis, if yes what do you do about it?

I have just started uni, I am learning to be a Computer Scientist, and I am scared of my future cause I have developed scoliosis in my teens.

Fortunately, it is minor and I do streches and exercise 4 times a week, so I live actively.

I think /dpt/ would be interested in this. I made this thread to discuss the reason for having languages other than assembly in use.

make those bullets faster and bigger user.

C is a lot easier for humans to deal with and the generated assembly is almost as efficient as good handwritten assembly anyway

>why don't people do a much harder time sink instead of an easier, more timely thing

really makes u think

I've been working on a mobile game. Feedback would be appreciated.

play.google.com/store/apps/details?id=planc.refugeeraft

>almost as efficient as good handwritten assembly
yeah, if you call a 5x-10x slowdown "almost"

protip: most of the time when you program something speed is not an issue.

Please provide a benchmark for a non-trivial test where someone's handwritten assembly is at least 5 times faster than a C implementation with appropriate optimisations turned on.

>backpedaling

>5x-10x slowdown
source?

anything benefiting from simd; all C compilers are crap at vectorization
experience

>anything benefiting from simd; all C compilers are crap at vectorization
That is not a benchmark.
Please provide a link.

Doesnt it vectorize pretty often when you use restricted pointers?

>experience
lol maybe from decades ago

now memory latency matters far more than raw computation performance and compilers are quite good at optimizing C code

also you can still use SIMD instructions manually in C

gcc.gnu.org/onlinedocs/gcc/Vector-Extensions.html

it tries, it can't match hand written assembly, not by far; just take a look at anything more complicated than adding 4-element arrays and you'll see an insane amount of useless instructions that no human would write
you're simply an idiot
at that point you're writing assembly by hand but with C-ish syntax

>at that point you're writing assembly by hand but with C-ish syntax
that's basically what C is

and feel free to provide a reasonable example of a program where the assembly version runs 5+ times faster than the C version

>at that point you're writing assembly by hand but with C-ish syntax
Jesus, talk about grasping at straws.

>just take a look at anything more complicated than adding 4-element arrays and you'll see an insane amount of useless instructions that no human would write
And try to make anything but a pet project with assembly, I dare you.
>in before MUH NASA

>that's basically what C is
you're a moron
>talk about grasping at straws.
are you retarded or you just don't know what the discussion is about?
>I dare you
I don't give a fuck tho

there was a library, i don't remember which one, where they removed the handwritten assembly because the java code was actually faster.

twats

your claim about 5-10x perf difference between handwritten assembly and C seems ridiculous and you apparently have no evidence to back it up

yes, all bytecode-to-native bridges are expensive to cross, it's only worth it if the work to be done is significant
he made no such claim; I did

>seems ridiculous to the average fizzbuzzer
ftfy

a JNI call only adds around 200 cycles of overhead

ok kid

Tell me anons, what is best for programming on Linux, c++
Should i use vim/sublime or some ide like netbeans/eclipse
>intellij works like shit, i know all of their programs are good, but on linux i have problem with them. I have license for all their products and that makes me sad :(

eclipse is good

vim/emacs if you're a poser

i just called you a twat, i don't care about no ass emblem

fascinating

i like vim for web dev, but i dont find it good for c++/java/c

twat

New thread:

>adds around 200 cycles
which sometimes is too much

you're delusional if you don't think you're getting cache misses and pipeline stalls, i bet you think assembly is 1 clock per instruction lol

You sound like a CS student friendo. Are you still learning this stuff? Good for you buddy, good for you

>muh ass emblem
keep thinking assembly is 5-10x faster than C even though you have no credible evidence whatsoever

>keep thinking
he didn't say that, I did

keep thinking assembly is 5-10x faster than C even though you have no credible evidence whatsoever

>bet you think assembly is 1 clock per instruction
it can be more clocks per instruction or many instructions per clock, depends on the assembly; in your case, it's definitely the former, you obviously aren't very knowledgeable
>lol
the sign of mental illness

Have you ever decompiled a GCC executable (with -O0) to compare with the same asm program? Compilers produce a lot more overhead (eg stack cookies) for the application, which most of the times is unneeded.

What do you know about this stuff? I'm writing AT&T asm and C code all my life.

Of course if you add optimizations the compiler might find a better (faster or more efficient) way to solve your problems, but that doesn't mean anything really. The actual comparison should be without optimizations if that's what you're talking about.

>5-10x
Find me one **practical** case where C is outperformed by assembly by a factor of 10

there are some occasions where assembly is significantly faster, but i'm yet to see a case where optimized assembly outperforms optimized c by a factor of 10

>there are some occasions where assembly is significantly faster, but i'm yet to see a case where optimized assembly outperforms optimized c by a factor of 10

It may have been true 30 years ago when some very bad assembly was being generated.

en.wikipedia.org/wiki/64K_intro
65k Demos are usually all ASM for both space and performance.

High performance bits of operating systems are written ASM almost always. Can't find the source now, but some versions of the Linux elf loader are in ASM I think. Just grep your Kernel for .S files.

Often it is less painful to do high performance SIMD extension work in ASM than hoping your compiler gets it right (not sure if that counts!)

I don't think your challenge is exactly matched up with the real world use case of x86 ASM at least, which is almost never used for whole progs.

Anyway ASM gives you the freedom to discard safety / best practices / standard procedures for pure speed and memory efficiency.

It almost certainly outperform C by a factor of 5 or so in terms of memory space and executable size. You can always pick shorter opcodes by hand, and do tricks in memory to save space that no sane compiler would think to do.

That's not the same as computer speed, but it's certainly an advantage. I'm sure a compiler with the proper constraint engine could do this too, but it'd be awful slow.

It was almost ubiquitously true 30 years ago. That doesn't mean its never true today.

People don't realize how much freedom you can get in terms of memory layout with ASM. Truly wonders can be done.

I'm not saying people should never use ASM, only that a speedup of x10 is not realistic.

It's honestly not out of the question in terms of total memory and disk space saved. In terms of speed... it's certainly not out of the question depending on what you are looking at and how badly you want to mangle it optimizing it.

There is no "instant 1-1" conversion into a hand written assembly program.