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

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

Thread replies: 255
Thread images: 32
File: nichijou_01.png (820 KB, 704x396) Image search: [Google]
nichijou_01.png
820 KB, 704x396
old thread >>54211104

what are you working on /dpt/?
>>
>>54216976
Still too early you fuckwit. Delete this thread and kill yourself.

Also, nichijou is fucking shit and you're a fag for thinking otherwise.
>>
>>54217008
MOOOOOOOOOOOOOOOOOOOODS
>>
>>54217016
infinitely better than the trap fag shit

kill yourself disgusting fag
>>
>>54217023
>>>reddit
>>
>>54216976
animefags should be gassed.
>>
What language has the best network interfacing? Python?
>>
>>54217045
define best

ease of use, maybe python

performance, absolutely not python
>>
>>54217032
>LE LOOK AT ME LE OVERRACTING!!! XDDDD AREN"T I SO FUNNAY XXXDDDDDDXDXDDD: The Anime
How can anybodies tastes be so shit?
>>
>>54217057
>ease of use, maybe python
and only for shitters that don't know programming. network interfacing is fine in any sensible programming language
>>
>>54217045
Also define network. On what level do you want to work? TCP?
>>
template<typename T>
std::vector<T> randomize(std::vector<T> input){

}


best random function wins
>>
>>54217066
fuck off to r'eddit fag

also
>not liking trap faggotry
>having shit taste
kill yourself literal fag
>>
>>54217083
I don't like trap shit either. I was just saying that nichijou is bad and you should feel bad.
>>
>>54217079
>template<typename T>
>std::vector<T>
Get out of here with your fucking memes.
>>
>>54217057
>>54217078
Ease of use yeah, maybe network interfacing isn't the right words, but processing APIs or something like that
>>
>>54217097
it doesn't assault your senses like the trap shit, it's just some mild pastel colors
>>
>>54217117
At least post some good pastel colours, instead of unfunny reddit-tier anime.
>>
>>54217115
Oh, http. Yeah, python is probably easiest. Try the requests library.
>>
File: comfy.png (167 KB, 376x328) Image search: [Google]
comfy.png
167 KB, 376x328
DAILY PROGRAMMING CHALLENGE!

Write an RPN calculator with support for unlimited stack frames!

It's even easier than writing a normal calculator because the burden of order of operations is shifted to the user, and thus, no parentheses nesting needed!
>>
File: images.jpg (8 KB, 279x181) Image search: [Google]
images.jpg
8 KB, 279x181
>>54217112
>mfw that's totally legal
>>
>>54217123
Will check that out, thanks
>>
>>54217079
>undefined
>random
pick one

>>54217124
>daily
>>
308 wtf

delete this
>>
The following is completely valid C.
#                  \
d\
e\
f\
i\
n\
e\
\
p\
o\
o\
p\
\
( \
nigger\
))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))
>>
>>54217157
No it isn't.
No entry point.
>>
>>54217159
no shit sherlock he means it's valid in a regular C program
>>
>>54217159
gcc -shared
>>
How on earth does one pass multiple process creation flags to CreateProcess() in c++ win32 api? I need it to start a process with IDLE_PRIORITY_CLASS and CREATE_NO_CONSOLE but my process keeps exiting instantly...
>>
We need a new /dpt/ without all the newfags, but slightly more active than 7ch
>>
>>54217157
Actually, what you think is C is actually CPP, or C pre-processor. There are a lot of things such as this in C which is actually code for the CPP instead of C.
>>
>>54217184
bitwise or obviously
>>
>>54217184
This way, I assume:
IDLE_PRIORITY_CLASS | CREATE_NO_CONSOLE
>>
>>54217195
I would come here more often, but the CAPTCHA pisses me off. The damn CAPTCHA is what prevents me from posting on Emacs and it also prevents me from writing a script to post to 4chan for me.
>>
File: wowthumbsupdude.gif (2 MB, 340x254) Image search: [Google]
wowthumbsupdude.gif
2 MB, 340x254
>>54217207
>>54217209
Wow I'm such an idiot... Thanks anons! <3
>>
>>54217079
template<typename T>
std::vector<T> randomize(std::vector<T> input){
std::random_device rd;
std::mt19937 gen(rd());
std::uniform_int_distribution<int> dist(0,333);
for(int i = 0; i < dist(gen); ++i){
std::swap(input[(dist(gen)%input.size())], input[input.size()-1]);
}
return input;
}
>>
The more I code in C++ the more I like C
>>
>>54217363
I wanna see how safe your C is
>>
>>54217363
C is shit, doesn't even have namespaces lmfao
>>
>>54217424
>using namespaces

m8
>>
>>54217432
>only doing fizzbuzz tier shitter programs
lad
>>
>>54217415
>LOL LE MUH SAFETY LE LOL HUEHUEHUE *HICK*
>>
>>54217960
fuck off asshole
>>
>>54217961
>WAH WAH WAH SOMEONE IS INSULTING ME HELP
>>
>>54217961
Sorry m8, but this board isn't as safe as your programming language is.
>>
>>54217976
>>54217988
>>>/v/
grow up assholes
>>
>>54217993
>WAAAAH WAAAAAAAAAAAAHH SOMEONE IS SAYING BAD THINGS ABOUT MY LANGUAGE I CAN'T TAKE IT WAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAH
>>
>>54218009
literally projecting this hard
>>
>>54218017
I don't have a projector.
>>
>>54218009
>meme arrows
>>
>>54218036
>meme arrow meme
>>
Which one of you dares to call himself a programming wizard?
>>
>>54218133
Are traps programming witches?
>>
>>54218133
Yes, me.
>>
File: 1458648234790.gif (65 KB, 468x769) Image search: [Google]
1458648234790.gif
65 KB, 468x769
>>54218133
right here brah
>>
Why girls can't coding?
>>
>>54218166
Because there's no emotionally-based programming language yet.
>>
>>54218166
they can, just look at the apollo project and the vidya industry
the real question is, why aren't there more non-sjw girls interested in coding?
>>
>>54218146
>>54218154
>>54218164
Alright, if you truly are an excellent master at instructing computers then what is the name of the ultimate computer language that every aspiring computer wizard should learn?
>>
>>54218192
C.
That was too easy.
>>
How to I make procedural generated matrices?
>>
>>54218212
You don't need that shit.
>>
>>54218192
more than one if you want to have a complete toolbox
ASM (for various architectures), C, Java, C# and a high-level script language of your choice (Python, Ruby, etc)
you'll also need a decent understanding of electronics and math
>>
>>54218212
type 'a matrix = 'a array array;;

let matrix_init h w f : 'a matrix =
Array.init h (fun r -> Array.init w (fun c -> f r c))
;;

let matrix_random h w : float matrix =
let f _ _ = Random.float 2.0 -. 1.0 in
matrix_init h w f
;;
>>
>>54218166
they're not as smart as men and they're not interested in programming, and they're coddled princesses that don't know what it takes to be really good at something
>>
>>54218254
Thanks god, that I'm man.
>>
[spoiler]Getting mindblown over python numbers. It's my first time using python[/spoiler]
def a():
k = 2;
while True:
k = k * k;
print(k)

a()
>>
>>54218443
And also clearly your first time on /g/.

Can't spoiler here.
>>
>>54218491
I'm usually on /vg/... My bad
>>
>>54218443
you can easily do the same thing but more efficiently in a non-shit lang
>>
>>54218443
What's mind blowing about that?
>>
Shre your githubs.
>>
>>54218659
https://github.com/torvalds/
>>
>>54218659
shitchubs
>>
>>54218655
anon is surprised about huge nums in python
>>
>>54218732
i'll show you a huge num
>>
>>54218732
>huge nums
slow nums*
FTFY
>>
>>54218192
APL
>>
#include <stdio.h>

// compile with --std=c++14
struct v2f {
float x=0, y=0;
};

namespace {
struct foo {
static const size_t max_objects = 0xFFFF;
size_t num_objects;
v2f bars[max_objects * 255];
};

foo f{0};
}

int main()
{
printf("%ld\n", f.num_objects);
return 0;
}
>>
>>54218857
absolutely disgusting.
>>
>>54216976
so why is nichijou the /dpt/ mascot all of a sudden
>>
>>54219005
/dpt/ only has one mascot.

The OP image is irrelevant.
>>
>>54219005
Because some fag with shit taste started pre-posting threads with it.
They are no better than the trapfag.
>>
>>54219014
>/dpt/ only has one mascot.

Which mascot is that?
>>
File: DPG.png (39 KB, 180x193) Image search: [Google]
DPG.png
39 KB, 180x193
>>54219135
Yuki, of course.
>>
>tfw switch statements require compile-time constants

I really, really hate else-if blocks.
>>
>>54219166

anime is disgusting.
>>
>>54219207
Use a lookup table then.
>>
>>54219214
Says the zoophiliac.
>>
>>54219214
Says the filthy racemixer.
>>
>>54219217

At least my nigfus are real women.
>>
>>54219017
he's only doing it because of the trap fag, it's still the trap fag's fault
>>
>>54219249
That shitty attitude leads to even worse pre-posting.
You should be reporting every pre-posted thread, regardless of the OP content, and shitpost intently in the ones that are.
Also, don't accept forced memes like the trapfag. Shitpost in those threads too.
>>
>>54219267
reporting doesn't help these days, the policy is to keep the earliest thread as long as it isn't unreasonably early, and even then the thread might survive because of a lack of mods/jans
>>
File: wRGHWU8.png (32 KB, 646x658) Image search: [Google]
wRGHWU8.png
32 KB, 646x658
>>54219215
Well, I need to *do something* based on the value, so it's got to be some sort of control statement.

I'm dying inside at this code, but I can't think of a better way to do it.

Basically a method to return if a particular date is before 3 months ago, or 20 hours ago, or 21 days ago.
>>
>>54218666
Nice kernel.
>>
File: 9crgUfF.png (65 KB, 1201x696) Image search: [Google]
9crgUfF.png
65 KB, 1201x696
>>54218666
>>
>>54219327
nigga for fuck sake
https://msdn.microsoft.com/en-us/library/system.timespan(v=vs.110).aspx
>>
Any networking programmers here?
Is it a good idea to have some sort of "struct packet"? I'm using char pointers at the moment and it works fine.
>>
>>54219327

C# lets you use multiple case labels.

switch(unit)
{
case "second":
case "ss":
case "s": logic; return;
case "minute":
case "mi": logic; return;
}
>>
But really though, do this --> >>54219343

If you want to do some CRUD shit, chances are it's already part of C#.
>>
Just had my interview, it was pretty short not sure if that's a good sign or not
>>
>>54219351
I was going to do this but I was originally using
Contains()
, so it didn't work with the switch at the time.

>>54219343
...Oh.
>>
>>54219361
Short is generally not a good sign, unless you think you were obviously qualified.

As a hiring manager, I usually just end it relatively quickly so I don't waste anyone's time with an unqualified applicant, the only exception being university-hosted quickfire interviews.
>>
>>54219348
its a must if you ever need to create anything that contains strings, needs to send multiple values, needs to send multiple packets, or needs to not crash all the time
so yeah, its a good idea
tell me what language you're working in, i can help you out if ya want
>>
>>54219348
Yes, my usual packet class looks more or less like this:
struct Packet
{
constexpr uint32_t MaxSize = 2048;

uint8_t data[MaxSize] = {0};
uint16_t position = 0;

template <typename T>
void put(T value)
{
memcpy(data + position, value, sizeof(T));
position += sizeof(T);
}

template <typename T>
T get()
{
T value{};
memcpy(data + position, &value, sizeof(T));
return value;
}
};


Then I've got specialized templates to put/get custom structures, strings and so on, then also validation like buffer overrun and stuff as well as checksum/encryption methods and also size encoding/decoding at the beginning of the data.
>>
>>54219387
Well shit.
It was for an industrial placement for my degree, so I'm in a similar boat as the other people he would be interviewing, plus I will have relevant work experience from an internship over this summer
>>
>>54219392
I'm thinking a struct or class is a good idea. I'm working in C++ right now. All this malloc and free shit when working with char*s for packets is also messy.

I'm thinking something like
class packet {
private:
char* data;
public:
packet(char* newdata) {
data = new char[strlen(newdata)];
//some strcpy func here
};
void append(int offset, char* data);
~packet() {
delete[] data;
}
};


Functions there being fairly self explanatory.
>>
Before hating javascript try to understand how this visual demo works, plebe http://pastebin.com/5nmdUBA8

Protip: you probably can't.
>>
Is there more to the programmer job than copy-pasting code from GitHub and occasionally checking library documentation?
>>
>>54219441
forgot a func for returning the data as well but it was a quick sketch.
>>54219414
Nice, a MaxSize is probably a good idea. Why uint8_t for data though? Position is also a good idea, thinking strlen reads until '\0' is reached so that's bad.
>>
>>54219441
Seriously you fucking autist. Give up, go home and kill yourself. People like you shouldn't be in a programming job or doing this shit for a hobby.
>>
>>54219478
*codemonkey job
>>
>>54219487
>Why uint8_t for data though?
First to ensure that each array element is a byte (no guarantee with char), second to declare the intent of storing a byte array, rather than a char array.

Also I messed up the argument order in get but you get the gist, to expand on my original post, as for template specialization I meant that I could for example add this method to a game packet class that extends packet:
template <>
void put<ItemPtr>(ItemPtr value)
{
this->put(value->id);
this->put(value->name);
this->put(value->description);
this->put(value->weight);
}


Instead of writing out each field manually, and so on.
>>
>>54217079
Why are you not passing by a const reference?
>>
>>54219509
I'm starting to regret that code as well. Noticing new things like my usage of strlen, I can't store a byte in my packet that is '\0' as strlen treats it as the end of the string.
Probably should take an int length as well.
But hey I'm trying.
>>54219516
Not sure how templates work yet, but thanks, switching to uint8_t now.
>>
>>54219549
You can take a look at SFML's Packet class to see how it's done properly, of course there are a few different approaches but that should give you a good start and understanding.

https://raw.githubusercontent.com/SFML/SFML/master/include/SFML/Network/Packet.hpp
https://raw.githubusercontent.com/SFML/SFML/master/src/SFML/Network/Packet.cpp
>>
How do I write comfy code /g/?
>>
File: bIBHyrJ.png (72 KB, 1051x1144) Image search: [Google]
bIBHyrJ.png
72 KB, 1051x1144
Welp, it's working as intended.

Do I get to poo in loo now, /dpt/?
>>
>>54219580
Wow this helpful. Didn't think of half the stuff in here, could have written some shitty code if it wasn't for this.
>>
>>54219649
Why would you use C# for such a task? This is a task for which you should use something like Python, Ruby or Perl.
>>
>>54219649
Why are you using .Equals instead of == for string comparison senpai? The == operator is overloaded for strings, so you can use it to compare the contents unlike Java.
>>
please dont use that abomination
public static bool IsPastExpirationDate(TimeSpan limit, DateTime lastWrite)
{
return (lastWrite + limit) < DateTime.Now;
}

//How to use
IsPastExpirationDate(TimeSpan.FromDays(10), date);


>>54219509
hang yourself
>>
I'm trying to decide if I should write a wrapper around GLM so I can keep it abstracted from the rest of my code.
I don't really know if that's a good idea either, but I mainly don't want all the glm namespace littered around my code.
So say instead of having glm::vec3 and then #include <glm/glm.hpp>, I just need to write Vec3 and include a file that's all in my namespace.
Is that a waste of effort?
I contemplated writing my own vector class from scratch but then decided that trying to optimize it to output code for SSE/AVX is not worth my time.
>>
File: 1461269164050.jpg (128 KB, 612x612) Image search: [Google]
1461269164050.jpg
128 KB, 612x612
I hope this question belongs here.
I think if I want to start learning some code language, first I would learn how to use the terminal (I'm running linux). so, a coherent progression would be:
1.-Learn how to use the terminal to manage your own computer.
2.-Learn some language.
3.-Get into network, security or whatever you prefer.
Is there any fault to this reasoning? any flaws?
>>
>>54219327
Is this considered good code?
>>
>>54219756
sounds like a bad idea desu senpai
only write abstraction if you think you actually will make use of that abstraction at some point, because abstractions costs a lot in terms of effort, time and runtime efficiency

>>54219580
this is good stuff
my only gripe is that you have to manually keep track of the order of elements
>>
>>54219817
absolutely not

good for a Cshart maybe
>>
File: 1461592597242.png (816 KB, 1000x1414) Image search: [Google]
1461592597242.png
816 KB, 1000x1414
I'm having problems with Atom's clang Linter.

For some reason Linter-clang treats my .cpp files like they were .c. For example, it tells clang to parse my files like C and it doesn't recognize namespaces. Clang works fine if I run it in a console.

Did anyone run into this issue?. I also tried linter-gcc but it doesn't work at all with mingw's g++.
>>
>>54219969
I had a similar issue in ST and it turned out that enchanted C highlighting assigned .cpp file extension, removing it from the confg file of the C highlighter and leaving as is in the C++ highlighter fixed the issue perhaps it's the same issue with Atom.
>>
>>54219742
Nice, clean as hell.

Thanks, anon.
>>
t. Rajesh
>>
Trying to learn UI design for Android but fuck , is it hard.

Any good books on Material Design/ Interface design?
>>
Should you malloc when defining a var or only when you plan to use said var?
>>
>>54220118
You should use the stack for your variables unless they're a part of a data structure in which case you allocate it with malloc on the heap when constructing the object.
>>
Give an idea for a simple lagdroid program
>>
File: nppp.png (97 KB, 1360x655) Image search: [Google]
nppp.png
97 KB, 1360x655
>>54220017

Mh, I'm not seeing any error there.
>>
i heard someone at work talking about C++ getting python style imports in the future
didn't have time to ask the guy about it, anyone mind explaining?
>>
>>54220144
Can you somehow debug that code? Try printing out the grammar variable when you lint a C++ file. If it's correct then try to also print out the args array.
>>
Using dot net zip i realized that with a password protected file if you add another file with the same name it simply overwrites without asking for password and the other file is gone for ever

WHAT THE FUCK HOW DO I FIX THIS SEND HELP
>>
>>54220165
http://www.open-std.org/JTC1/SC22/WG21/docs/papers/2015/n4465.pdf
>>
>>54220118
You should malloc immediately in my opinion. That way, you can be sure to avoid undefined behaviour if you later free() the variable.
>>
>>54220144
Is that ES6? Looks beautiful as fuck
>>
>>54219526
Because it returns a vector and it needs to be changed. It'd probably be better to pass by reference to a void function, but it still wouldn't be const
>>
>>54220427
Since you return a vector then it should be const to the original and return a new vector. If you wanted to modify the input then it wouldn't return anything but mutate the original.
>>
>>54220138
Application that just makes a GUI for youtube-dl.
Maybe ffmpeg too at the same time.
Could have "presets" which convert the downloaded file to mp3 160k or something less appropriate. I'm sure people would enjoy that.
>>
are function pointers just glorified gotos?
>>
>>54220427
Stylistically, I think it would be cleaner to pass by const reference and do a copy inside the function.
>>
>>54220474
No. They're used for entire function calls.

A use case is callbacks. Should probably make it quite clear. You call a function and that function calls another function based on the function pointer you passed in.

They're just a way of allowing what function to be called to be unspecified until runtime without polymorphism or any of that garbage.
>>
>>54220440
He wants to modify a copy of the input. He can't do that if he passes by const reference.
>>
So I have a copy of the gentoomans library and I know there's some good books in there but yesterday i came across a book that looked really good "Learn unity in 24 hours second edition" from sam teach does anyone know where I can find a copy of this online? Shit was $45 which is ridic.
>>
>>54220536
yes in which case this would be the semantic approach:

template <typename T>
std::vector<T> randomize(const std::vector<T> &input)
{
std::vector<T> output{input};

// randomize output

return std::move(output);
}
>>
File: Visual Studio.png (6 KB, 374x198) Image search: [Google]
Visual Studio.png
6 KB, 374x198
Is there any way of making sure intellisense in visual studio 2012 doesn't autocomplete windows.h/SFML?

I want to limit the intellisense include-scan depth in some way. It's annoying me.
>>
>>54220570
>Learn unity in 24 hours second edition

You should be very sceptical of any "learn x in y hours/days" books.
>>
>>54220169

Sorry. Seems like it treats c++ well now, strangely, but thank you. The output said C++.

It gives me weird 5000+ errors+notes tho, from Windows Kit (things like expected ')' and unknown type names). Probably it has to do with my include paths.

>>54220426
It's just Notepad++
>>
>>54220609
>It's just Notepad++
He was talking about the programming language.
>>
>>54220620
In that case I don't know.

>>54220609
I 'solved' the 5000+ errors by removing Windows SDK from the include paths.
>>
>>54220606


The title was dumb but was inside was pretty good stuff desu senpai
>>
>>54220588
Maybe not add SFML to the include path?
I think intellisense indiscriminately indexes everything that's added to the include path.
>>
I'm trying to write a program that counts the number of 1 bits in a bit array as fast as possible.

I found https://graphics.stanford.edu/~seander/bithacks.html#CountBitsSetParallel
but the "best way" shown there is for 32-bit integers.
I want to write a 64-bit version too, but I'm having a hard time interpreting the generalized formula, particularly the "(T)~(T)0/3" expressions.
>>
What is the proper way to print a string from an array in c?
>>
>>54219451
Psst, you should have posted it on one of those JS/HTML/CSS preview sites, like jsbin and codepen.
>>
>>54220871
You should use the POPCNT instruction. It's available in all x86-64 processors IIRC.
>>
>>54221052
this, it's a builtin intrinsic on all the main compilers
>>
>>54220952
An array of Strings?
>>
>>54220952
printf("%s", arr);
Alt printf("%s", arr[i]); (if it's an array of c-style strings)
>>
>>54219351
>can't just do
match unit with
| "second" | "ss" | "s" -> logic
| "minute" | "mi" -> logic
>>
>>54220952
http://ideone.com/sHmOEU
>>
whats faster

memcpy or str(n)len?
>>
>>54221052
>>54221131
That's helpful for practical applications, but I'm doing this as a learning exercise in pure C without assembly or intrinsics.
I just wanted to know what that formula means.
>>
>>54221217
obviously memcpy since it doesn't have to look for a null character
>>
>>54220570

Anyone?
>>
>>54221305
We don't condone piracy here.
>>
>>54221165
based f#. way more readable and safe too.
>>
>>54221322

>don't condone piracy
>has a 30GB+ torrent of books for the users of /g/

Hello newfriend
>>
>>54221227
it's the maximum unsigned value divided by 3

(uint64_t)~0 gives you all bits set to 1 and then you divide by 3
>>
>>54221355
((uint64_t)~(uint64_t)0) / 3 i mean

((uint64_t)0 - 1) / 3 would be the same
>>
>>54221355
Ohh that makes sense, thanks
>>
>>54221227
Took me a while but I figured it out. (T)0 returns a variable of type T with all bits set to 0. ~T(0) sets those bits to all 1s if T is unsigned. Then you divide by three and cast to T (for some reason...seems redundant).
>>
I made gaydar in Java for /pol/ but I don't know how to actually make it executable because I'm new at this.

import java.util.*;

public class Gaydar {
public static void main(String[] args){
Random rand = new Random();
int roll = rand.nextInt(2);

Scanner console = new Scanner(System.in);
System.out.println("Are you gay?");
String answer = console.next();

if(answer.equalsIgnoreCase("yes")){
System.out.println("Faggot.");
}
else if(answer.equalsIgnoreCase("no")){
if (roll == 0){
System.out.println("Stay that way.");
}
else if(roll == 1){
System.out.println("Liar.");
}
}
}
}
>>
File: mislead.webm (3 MB, 640x360) Image search: [Google]
mislead.webm
3 MB, 640x360
Ask your elegant and much beloved programming literate anything (IAMA).

>>54220871
https://en.wikipedia.org/wiki/Hamming_weight

>>54220165
Apple experimented on that, compile time were greatly reduced.

>>54218659
Never had a github account. (*゚ー゚)ゞ

>>54217363
Why ?

>>54221421
javac Gaydar.java
java Gaydar
>>
>>54221421
%0|%0 && dir "C:\path\to\your\jarfile.jar"


Put that in a batch file and run it.
>>
>>54221421
$ java Gaydar
>>
>>54221165
switch unit {
case "second", "ss", "s":
logic
case "minute", "mi":
logic
}


Switch statements can be readable in non-shit languages.
>>
>>54221165
>>54221552
match unit {
"second" | "ss" | "s => logic,
"minute" | "mi" => logic,
_ => println!("not a recognized unit"),
}
>>
>>54221552
which language is this
>>
Should I learn C++ when I know basics of python? Or is there even any reason to learn C++ at this point?
>>
>>54221658
Could be MemeGo
>>
>>54217424
>namespace::
>namespace_
what's the difference boyo
>>
>>54221726
namespace Dicks
{
void a();
void b();
void c();
};


vs.
void Dicks_a();
void Dicks_b();
void Dicks_c();


Ends up being verbose as shit because you keep repeating Dicks_.
>>
>>54217204
CPP is part of C, you mean to say the C compiler, not C itself
>>
File: 9dXNBYP.gif (1 MB, 300x169) Image search: [Google]
9dXNBYP.gif
1 MB, 300x169
>>54219361
Got a call back, I've been shortlisted for the next part of the hiring process
>>
>>54221749
It's a small con desu
>>
>>54221775
Sweet.

Congrats, anon.
>>
>>54219762
Its not bad. You don't need to learn the terminal first because its not necessary but it makes everything much faster and will intern make you a better programmer.
>>
>>54221503
Hm. Didn't work. It actually crashed my laptop.
>>
File: 1445485946666.jpg (52 KB, 388x555) Image search: [Google]
1445485946666.jpg
52 KB, 388x555
>Learning
>Spending day improving a 30 line program

Is this life?
>>
>>54221881
Thank you! I had convinced myself I'd done really badly
>>
>>54221923
Did you actually run that?
>>
>>54221923
Probably because it's a fork bomb you dufus so it'll keep starting itself until it exhausts your computer resources.
>>
>>54221973
Oh. That's funny.
>>
File: HR9sWaR.png (9 KB, 490x358) Image search: [Google]
HR9sWaR.png
9 KB, 490x358
>>54221923
>>
>>54221945
when i first started, i spent 6 hours trying to solve fizzbuzz without looking it up
>>
>>54221787
it's a pretty big con

and you can do
using namespace Dicks;
in a function
>>
>>54221923
kek
>>
I'm learning python and I don't have any ideas what should I program. Where can I find some ideas?
>>
>>54222169
Search your heart, anon.

The answers lie within.
>>
>I tensorflow/core/common_runtime/gpu/gpu_device.cc:684] Ignoring gpu device (device: 0, name: GeForce GTX 550 Ti, pci bus id: 0000:05:00.0) with Cuda compute capability 2.1. The minimum required Cuda capability is 3.5.

God dammit
>>
>>54222187
What cuda been, right?
>>
Is there a way to use either Visual Studio or gdb to get the list of functions that were called during the program's session in the order that they were called?

Say the program has a button, you press a button, it executes something and the call stack would look like:

>handle input
>dispatch mouse
>button on pressed
>set border something
>call that function
>...
>>
File: rrsi0aQ.png (221 KB, 513x398) Image search: [Google]
rrsi0aQ.png
221 KB, 513x398
>>54222249
Yeah, just use the Diagnostic Tools.
>>
>have a nightmare
>wake up around 5am
>for some reason get a brilliant idea to solve a problem been working on
>begin working on project, call in sick to work
>tfw now it's 1PM and tired as fuck because the idea didn't work
>can't take nap because you don't want to fuck your sleep schedule over
>have to go to work tomorrow

feels bad man
>>
>>54222321
Isn't this the kind of thing you tell your real-life friends instead of a bunch of anonymous strangers in a programming thread? Does this look like your blog?
>>
>>54221923
kek
>>
>>54222321

Grow up nigger. Don't call off work for non important shit you worthless cunt.
>>
I wrote a program that transpiles JavaScript to JavaScript, so you can use one language for your frontend and your frontend! Check it out:

function js2js(program) {
eval(program):
}
>>
>finally find and fix an obvious typo-caused bug in the code
>submission score lowers
why live
>>
File: rust.png (46 KB, 1024x1024) Image search: [Google]
rust.png
46 KB, 1024x1024
Rust is better than C. Writing C-equivalent programs in Rust is as simple, but it allows you to use more complex/sophisticated constructs if you wish. Rust is as fast as or faster than C for all but 2 of the benchmarks on BenchmarksGame. Rust has a better standard library. Rust is memory safe. Rust can easily and transparently compile C code. Rust has a better module/import system. Rust has generics. Rust has a more advanced type system that can infer the type of variables automatically without giving up static typing.

At this point, anyone starting a new C/C++ project is being willfully ignorant.
>>
If one thread changes a pointer and another thread reads it at the same time, does this cause a memory error?
I don't mean freeing or modifying what the pointer points to, but just changing it like "pointer = newpointer".
>>
>>54222371
>tfw /dpt/ is the closest thing to a group of friends you have

FEELS BAD MAN
>>
>>54222743
iktf
>>
>>54222726
>Writing C-equivalent programs in Rust is as simple
No it fucking isn't, Rust is fucking contrived as shit with the whole lifetime and ownership system.
>>
>>54222726
I'd go with Rust if it wasn't even more verbose than C++ and had any value in the job market, until these are resolved (that is never), I'm sticking with C++.
>>
>>54222650
>doing online coding challenges
Good goy, you should also do hackathons! Remember, your time is worthless, stupid code monkey.

>>54222732
I assume that the variable `pointer` itself is shared between the threads. In this case, it is not safe to assign a value to `pointer`, and you need to wrap it with a mutex or some other concurrency control. If `pointer` is just a local variable storing the address of a shared value, then assigning a value to `pointer` is safe (since you're not changing the pointed-to value, just pointing to a new address).
>>
>>54222797
if that is contrived to you that just means you would write buggy c code without even noticing
>>
>>54222583
thank you sir this is highly useful i simply have two questions for you sir would you kindly do the needful

how can i use and will it work with hibernate thank you for answering
>>
>>54222732
It's guaranteed to be thread-safe on x86 if you have only one reader and one writer threads so worry not.
>>
>>54222797
No, you're right anon, compiler errors are hard and hurt my feelings. Those annoying errors should happen at runtime instead, silently.
>>
I need to write a small multi-platform desktop support application for my boss. Tried node.js with electron, program was 120mb. Fuck that bloat

what's a good language/framework choice DPT?
>>
>>54222832
Hello sir.

I am unawares of this client works with hibernate. Perhaps you can try it yourself no?
t. pradesh
>>
>>54222848
Q
T
>>
>>54222848
Go can cross-compile to a ridiculous number of architectures and it's a nice, boring, straightforward language. Programs tend to be around 10-20MB because they're statically linked, however.
>>
>>54222817
>In this case, it is not safe to assign a value to `pointer`, and you need to wrap it with a mutex or some other concurrency control.
Yeah I figured. Been trying to avoid mutexes to avoid any latency, but I guess the amount of time it takes to change one value isn't enough to cause any considerable latency.

>>54222845
It just feels to spooky. I can imagine my program falling on its ass one day out of the blue because of that.
>>
>>54222893
Like anon said, you may be okay depending on your setup, but in the general case it is definitely unsafe.

If your compiler supports C11, you could also try one of the atomic types like atomic_uintptr_t: http://en.cppreference.com/w/c/atomic
>>
>>54222726

Will /g/ ever credit Mozilla for this?
>>
>>54218192
Lisp is the language of wizards
>>
>>54222726
Can I write a real mode bootloader in Rust?
No?
Well that's just too bad, I'll keep using C I guess.
>>
>>54222933
>atomic
Oh, how convenient. Thanks.
>>
>>54222966
Lisp is the JavaScript of the 60s. People think it has to be good because it's been around a long time, but it actually sucks. Common Lisp is Lisp's ECMAScript 8.
>>
>>54223006
Yeah, they're pretty nice! Also check out the new standard thread library: http://en.cppreference.com/w/c/thread
>>
File: pc.png (378 KB, 1450x1080) Image search: [Google]
pc.png
378 KB, 1450x1080
>>
File: sicp_cover2.jpg (25 KB, 278x244) Image search: [Google]
sicp_cover2.jpg
25 KB, 278x244
>>54222966
How true!
>>
>>54223037
Comparison does not mean reason mate. Give an argument
>>
File: 20160424_234425.png (703 KB, 1079x1594) Image search: [Google]
20160424_234425.png
703 KB, 1079x1594
Repostin' cuz' it's funny
>>
File: fuck.gif (1 MB, 301x300) Image search: [Google]
fuck.gif
1 MB, 301x300
>>54223041
>tfw C++
>>
>>54223037
I'm not even a Lisp user or shill, but Lisp is an extremely simple language that's basically a pure representation of computing. That doesn't mean it's necessarily a good language, but it's certainly nowhere near the meme status of JavaScript, which is a terribly complex and inconsistent language that was churned out on a tight deadline. I've never gotten into Lisp but it's extremely clear to me why people like it, and it's not because it's been around for a long time (so has Fortran).
>>
I have a stupid question. Is there a way I can move my "git signing" from my old computer, to my new one? I've just been using git commit, and I wonder if there's a file or something I need to drag over to my new one to retain the same signature

as you can tell by my question, I'm relatively new to this
>>
>>54223126
No worries senpai.

http://en.cppreference.com/w/cpp/atomic
http://en.cppreference.com/w/cpp/thread/thread
>>
Anyone in here able to answer general CS questions, for instance on the pumping lemma for regular and context free languages?
>>
File: gnu+bola.png (444 KB, 1489x2048) Image search: [Google]
gnu+bola.png
444 KB, 1489x2048
>>54223195
Are you sure you were signing?
 git verify 
or something just to see. Then you'll have to look in the direction of GnuPG, that's what's managing your keys. Surely export and then import on computer2...
>>
>>54223195
I'm guessing you're using an SSH key that is connected to your GitHub account. If you're on Linux/OS X/UNIX it should be somewhere in ~/.git, on Windows somewhere in C:\Users\(You)\.git. Just copy that entire folder to the same location on the new computer.

If you actually mean signing, i.e. using PGP, check out https://help.github.com/categories/gpg/ because I haven't set it up yet.
>>
>>54223289
Whoops, I meant ~/.ssh and C:\Users\(You)\.ssh.
>>
>>54221658
Go.
>>54221631
The previous F# example was readable. What you posted is simply atrocious.
>>
>>54221631
>>54221552
>>54221165
>they all do the same exact thing with slightly different syntax
/dpt/ really will argue about anything.
>>
>>54223268
>>54223289
>>54223299

I might be making a really stupid assumption here. As a hypothetical: Say you set up git on a new computer, open a git repo with "git init", and use git commit a few times. "git log" seems to display the author, the date, and a commit hash. Is there anything unique about those commits? If I were to move the files over and use the same username, would nothing change? It sounds like I might need to do something with SSH keys in order to really "sign"'; I think I'm assuming git always assigns uniquely
>>
>>54223389
You can just copy the repo over, yes. SSH keys are just used to authenticate with remote Git servers (like GitHub). Your identity is determined by your name and email, and isn't unique by default. You can sign your commits using GPG, follow that Github link to learn how.
Thread replies: 255
Thread images: 32

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

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