[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: 201
Thread images: 14
File: monkey trouble.png (819 KB, 1282x722) Image search: [Google]
monkey trouble.png
819 KB, 1282x722
old thread: >>54750565

What are you working on, /g/?
>>
Haskell is basically the minimum acceptable language these days.
>>
Is there any point in learning assembly in the year 2016?
>>
basically the minimum acceptable language these days is Haskell.
>>
>>54757493
Are you programming PICs? Then yes. Otherwise, no.
>>
>>54757472
If you actually want to be employable, you will write your frontends in JS and your backends in C.
>>
these days, the minimum acceptable language is basically Haskell
>>
>>54757493

Compiler backends
Reverse engineering
Shellcode
Boot level code/firmware

It has its uses.
>>
>>54757542
Not him, but you'll never need any of that. Just learn a language like python.
>>
Is it autistic to use greek unicode symbols in my variable names?
>>
>>54757665
No.
>>
>>54757472
>>54757502
Stop wasting time with outdated and obsolete languages like Haskell or Assembly. Python is all you'll need these days.
>>
>>54757455
REAL THREAD

>>54750726
>>54750726
>>
>>54757472
>>54757502
if you mean it's basically the worst language then yes
>>
>>54757665
Yes
>>
>>54757742
your thread is old and busted
>>
>>54757782
kys fag
>>
>>54757782
Fuck off.
>>
>>54757810
you can't even say kill yourself, you dumb redditor?

kill yourself
>>
>>54757834
kill yourself FAG
>>
>>54757834
Fuck off faggot
>>
>>54757624

>you'll never need any of that
Depends what you're working on. While there are certainly plenty of applications where you can get by only knowing Python, how would you expect someone to, for example, write an emulator, without knowing assembly?
>>
>>54757969
stay delusional shitty fag poster, if this thread was legit you wouldn't need to bump it

REAL THREAD

>>54750726
>>54750726
>>54750726
>>
>>54758029
bampity bamper bamp :^)
fuck off with your pedo shit
>>
i took apart an apk and i want to know how to correctly upload all the resources into android studio and make it work
>>
>>54758049
>using the smiley with a carat nose
>>
>>54759753
>Posting your stupid memes just to bump this degenerate thread
Kill yourself
>>
>>54759770
tell that to whoever decided to bump the thread with the smiley with a carat nose
>>
:::::::::::::::::::::^)))
>>
bump lol
>>
Quick C++ question. I'm leaning about scope and references and I thought of this code to test what happens.

#include <iostream>

int a = 11;

int main(){
int &i = a;
a = 40;
std::cout << i;
}

It prints 40, but should't it print 11 since 'i' is seated to the 'a' from the outer scope?
What is going on here?
>>
File: 1443092730617.png (178 KB, 336x330) Image search: [Google]
1443092730617.png
178 KB, 336x330
>>54760092
install gentoo
>>
Planning on learning C++ by doing the Programming Principles book by stroustrup, and later the regular C++ programming book he made. Any suggestions for other books to read?
>>
>>54760092
i is a reference type. Whatever you do to i will be done to a, and vice-versa.
>>
>>54760121
Let me add this too:
Because i and a represent the same object.
>>
>>54760121
Yes but aren't there actually two 'a's: each belonging to the outer and inner scope? So
 a = 40; 
actually declares a new 'a' in the inner scope that is independent of the outer 'a', right?
>>
>>54760177
cont.

#include <iostream>

int a = 11;

int main(){
int a = 40;
std::cout << a << '\n';
std::cout << ::a;
}


this code depicts the scope behavior I am talking about. Two different objects i think
>>
File: PERFECT TABLES.png (22 KB, 977x421) Image search: [Google]
PERFECT TABLES.png
22 KB, 977x421
i made PERFECT TABLE
>>
When you declare and define a outside of main, you create an integer in the global scope called a. In your first example, you did not declare a in main so it defaulted to the global scope a. In the second example, you defined a global and local a so it prints 40 then 11.
>>
>>54760177
no,
 a = 40; 
refers to the global a. If you did
 int a = 40; 
you would see this behavior.
>>
>>54760177
> actually declares a new 'a'
No it doesn't. That's not a declaration, it's just assignment.

>>54760212
This declares a new, distinct variable. But there's no i in this so what's your question?
>>
>>54760258
>>54760212
accidentally forgot to reply. Make sure you understand how declarations and definitions work since that is the root of your confusion.
>>
>>54760262
ah! thanks mang
>>
What's your excuse for not knowing C?
>>
Working on a new personal startpage

Then hopefully to make my first iOS app, just a thing for the notification center
>>
What should I name my rss reader?
>>
>>54760988
RSS Reader Proâ„¢
>>
>>54761644
Good names don't describe the product
>>
>>54761662
You joking man? That name might not be "good", but it would sell like $$$FIRE$$$
>>
>>54761662
Exactly.

RSS Reader Pro
>>
>>54757455
Js, actually need some help on this. Im trying to make a conditional statement where 3 statements need to be true, but when i use the string color == "black" with && it doesnt run, the other two statements are fine however. Heres the code
<script type= "text/javascript">
var toes = 3;
var digTime = 30;
var color = "black"
if(toes == 3 && digTime == 30 && color == "black"){
document.write("I am a bradypus sloth");
}
if else(toes == 2 && digTime == 30){
document.write("I am a 2 toed sloth");
}
else{
document.write("I am not a sloth");
}
</script>
>>
>>54757455
>source
source?
>>
>>54761871
source: hime;goto source;
>>
r'ing the "size in bytes" webm.

Also, practicing some algorithm writing in C.
>>
>>54761928
What is that webm? A list of sizeof's for x86_64?
>>
>>54761966
The himegoto webm used sometimes as the OP image.
>>
I need some help understanding this.

I'm trying to build this:
https://github.com/mosra/magnum/tree/master
using cmake, visual stuido and clang on windows.

But I really can't figure this out.
I either need some materials to help me with what's going on or some pointers.

I try setting CC and CXX to my llvm installs clang-cl and clang++ executable path's but it still says
-- The C compiler identification is unknown
-- The CXX compiler identification is unknown
-- Check for working C compiler: /c/MinGW/bin/cc.exe
-- Check for working C compiler: /c/MinGW/bin/cc.exe -- broken
CMake Error at /usr/share/cmake-3.3.1/Modules/CMakeTestCCompiler.cmake:61 (message):
The C compiler "/c/MinGW/bin/cc.exe" is not able to compile a simple test


I'm so unfamiliar with this.
>>
>>54762103
>using cmake, visual stuido and clang on windows
Yick. What an overcomplicated development environment.

It looks like you're not pointing to clang correctly. Are you sure you have the file paths entered correctly?
>>
>>54762183
>PATH=/c/Programs/LLVM/bin:[...]
Yep. Put it at the front too (this is cygwin translating the path, it's written like any other path would be on windows).

I'm inclined to agree this seems incredibly complicated given what it has to do. But I'm inexperienced so I can't really say anything.
>>
>>54762103
>>54762183
>>54762221
Should I just install Linux in a VM and try there?
I don't really mind. Supposedly cross platform deployment is very easy with this graphics engine.
>>
>>54762264
You could just use cmake from cygwin since you already have it installed.
>>
>>54762288
I already am though. I just imagine most of the people working on this are on Linux. I'd rather not use mingw since the readme says:
>Note that full feature set is available only on GCC 4.8.1 and Clang 3.1.
I don't really know what the difference would be though..
>>
>>54762333
If you're using it from the the cygwin command prompt then what do you mean you're using visual studio?
>>
>>54762397
It's supposed to produce a visual studio project file which I can open and then develop using.

But I've found this now:
http://mosra.cz/blog/magnum-doc/building.html
Gonna try more.
>>
New to C and already know Python but would like to do the following from python to C:
 a = "N"
b = "Z"
c = "P"
a = b

What I think I'm doing right now in C is:
char a[] = "N";
char b[] = "Z";
char c[] = "P";

Not sure if this is correct, any help lads?
>>
>>54762397
>>54762468
Still same issue..
I'm just gonna sleep on it.
>>
>>54762552
That's valid but you'll have to use memcpy to set a to b.

It is more idiomatic to do
char * a = "N";
char * b = "Z";
char * c = "P";
a = b;


The
char a[] = "N";

is static initialization of a to the char array {'N', 0}, whereas the other is setting a pointer to the immutable string literal "N".
>>
>>54762552
Soo what's the goal of that python code?
char a[] = "N";

Declares A as a characterpointer pointing to the string literal "N\0" (N with null terminator, standard for strings in C, null terminator just means "string is over" usually).
char a[] = "N";
char b[] = "z";
a = b;

Would mean you now have a pointing to that array of characters AND b pointing to that array of characters. So you can reference "N" through b. But it's not a copy.
You would ahve to use memcpy to make a copy.
>>
>>54762624
>Declares A as a characterpointer pointing
No it doesn't. It's declaring an array. To see for yourself do sizeof(a); (it's 2, not 8).
>a = b
is invalid. You can't assign arrays.

My advice is to stay the fuck away from arrays as much as possible if you're new. They're a bit of an advanced topic and pointers are much simpler.
>>
>>54762702
True. Weird how I didn't know that.
I guess I never did weird stuff like that I suppose.
>>
Hime is code. Hime is love. Hime is life.
>>
File: notevenonce.jpg (36 KB, 278x400) Image search: [Google]
notevenonce.jpg
36 KB, 278x400
>>
>>54762609
What does the * do, i heard it has something to do with pointers.
>>
>>54762759
Yep arrays are weird. Here's some code to look at to see how arrays work a little more in C.
#include <stdio.h>
//shorthand for char a[2] = {'N', 0};
char a[] = "N";

//This type signature is a lie
//it is actually void foo(char * fnord)
//in my opinion using a signature like this bad practice because it is deceptive
void foo(char fnord[]) {
printf("size of fnord: %i bytes\n",sizeof(fnord));
}

int main() {
char * a_ptr = a; //this is possible because of "array decay"
printf("a: %i bytes\n",sizeof(a));
printf("a_ptr: %i bytes\n",sizeof(a_ptr));
printf("Now for some function signature lies\n");
foo(a_ptr); //this is valid because the type signature is a lie
foo(a); //array decay happens
return 0;
}


>>54762811
It's the signature for a pointer.
char * ptr;

is C for "create a pointer to a char named ptr."
>>
>>54762859
>>54762624
>>54762609
Would it be possible to do something like this?
Say:
char a[] = "N";
//do stuff i.e. if statements
//then go back and do this:
a = "Z";
>>
Struct packing:
#include <stdio.h>
struct strange { char c; int i; char d; };
struct optimized_strange { int i; char c; char d; };

int main() {
struct strange fnord = { 'N', 0, 'O' };
struct optimized_strange ok = { 0, 'N', 'O' };

printf("fnord size: %i bytes\n", sizeof(fnord));
printf("fnord.c size: %i bytes\n", sizeof(fnord.c));
printf("fnord.i size: %i bytes\n", sizeof(fnord.i));
printf("fnord.d size: %i bytes\n", sizeof(fnord.d));

printf("ok size: %i bytes\n", sizeof(ok));
printf("ok.c size: %i bytes\n", sizeof(ok.c));
printf("ok.i size: %i bytes\n", sizeof(ok.i));
printf("ok.d size: %i bytes\n", sizeof(ok.d));
return 0;
}


>>54763014
No. Assignment to arrays is undefined unless it is static initialization. You should seriously stay away from arrays.
>>
>>54763063
Damn C is hard. I liked the days where python or java made me look smarter. Now i cant even assign strings into a variable.
>>
>>54763100
Just use char pointers to string literals
char * string = "literal";
and the functions in string.h
>>
>>54763100
If you just do the same thing but don't use [] and just put * before your a/b/c it works.
>>
>>54761845
>var color="black";
YoU mIsSeD a SeMiCoLoN!!!
>>
File: 562.jpg (36 KB, 600x600) Image search: [Google]
562.jpg
36 KB, 600x600
>>54757455
>posting the homosexual trap anime image
>>
Maybe I can get an answer here...

I want to try using a surface pro 4 for c#/unity programming. Is this feasible?

I want to be able to program on the go, but also use it to play vns while comfy. Is this a longshot, and my money would be better spent elsewhere?
>>
>>54763382
SHIETTT thanks lmao, spent quite some time trying to find the error..
>>
>>54763302
>>54763127
Well I'm an idiot.. haha thanks senpai.
>>
>>54757542
this
you might as well learn it, you can easily do it in a few hours
assembly is pretty easy on its own, the difficulty comes from the code being large as fuck
>>
>>54763569
It'll work. not sure what vns is but you can at least program.
>>
how does your company manage sql migrations?
>>
>>54763875
I don't really know about assembly being easy. It's pretty difficult to read because you have to keep track of what is in what register and whatnot. There being so many aliases of each register that have subtle differences is hella annoying. rax, eax, ax, ah, al oh boy. Then there's a million slightly different versions of each instruction: jl, je, jne, jz, jnz jnl, jg, jng. The instructions are also annoying because a lot of them like lodsp, idiv, je assume certain register states.
>>
Hey /g/uys, I'm reading C primer plus, and was wondering if somebody could recommend a better source for learning file I/O, I just don't feel like I'm understanding how its laid out in that book.
>>
real thread: >>54761124
>>
>>54764162
This one is older you dipshit.
>>
>>54764174
this one was never legit
>>
>>54757455
>What are you working on, /g/?
I just completed my Brainfuck compiler for Mac OS X.

I will see if I will ever get bothered with optimising it. Right now every single increment or decrement will do a load + incr/decr + store, which I guess is not the most efficient.

Also, I will see if I ever have time to complete some options (like specifying cell width, array size, EOF behaviour, OOB behaviour etc).
>>
>>54764208
Oops, forgot link:

https://github.com/enfiskutensykkel/bf-compiler
>>
>>54764200
I don't care how much you hate trapfags, this one is older. Stop creating duplicate threads out of your autistic hatred.
>>
>>54764231
Both threads are 10 hours old you dip, who are you even bitching at?
>>
>>54764244
Compare
>>54757455
>>54761124
This thread is 4 hours older.
>>
>>54764231
have fun posting in this forced fag thread then idiot
>>
>>54764281
It's just an opening image, fag.
>>
>>54764298
ok idiot enjoy your shitty thread with shitty content
>>
i just scrolled through this thread and basically nothing useful or interesting was said in this entire thread
>>
>>54764320
good for you, now move on goy
>>
What is the best language for learning about network security?
I want to be Francis Pritchard from Deus ex
>>
>>54764569
Well if you want to exploit flaws you have know how computers work at a low level, so assembly.
>>
Anybody here transitioned from web dev to programming? How do you do that and what do you need to learn?

>inb4 usual memes

I know, I know. But what, if I learned Java I could suddenly call myself a """"real programmer""""? I mean, I learned programming in C++ and I dabbled in Java, it's not like the language would be some big barrier. I'm seriously asking this because web development kinda seems boring to me aside from being a hobby. I have my CS basics (could learn more algorithms and data structures though), but I have a different degree than CS so I had web development subjects for the past 2 years. I could e.g. transition into software engineering but desu it's retarded, I'd just learn Java and .NET there, and building """mobile apps""".

Anyway, I'm looking forward for at least one normal reply itt, it would be something new for once.
>>
>>54764648
just choose a language and start with tutorials like usual, skipping what you already know
whatever you do dont ask for advice here, you will only get shitposts and fizzbuzz-tier shitters who think they're hot shit
>>
>>54764569
C, C++
>>
>>54763900
Uh... Visual novels... S-senpai
>>
>>54764669
Thx, yeah I'm aware of that. /wdg/ is usually more helpful that /dpt/ but what can you do.
>>
>>54764648
>Anybody here transitioned from web dev to programming?
Web dev *is* programming, you're thinking of web design.

I worked two years as a web developer, I worked with Python and C++ and never wrote a single HTML tag or CSS descriptor.
>>
>>54764696
Legit question - where did "webdev babby" meme come from? It is because of how mainstream it is with all those sjws and kode with karlie plebs?
>>
>>54764733
because webdevs use frameworks with batteries included
>>
File: 625058_p0.png (84 KB, 400x400) Image search: [Google]
625058_p0.png
84 KB, 400x400
I'm trying to build my own wearable device.

it includes a skin conductance monitor, uses galvanic skin response.

I had a PCB printed based on a circuit schematic I found in a research paper for the sensor.

I'm trying to make sense of the signal I'm getting however.

Skin conductance isn't as intuitive to read the signal as say pulse rate.

I've written a Java program to simply plot the trace of the signal over time (the sensor PCB outputs to the analog inputs of an arduino).

So now I'm trying to write a program to plot the power spectrum estimation for my signal. I need to write a Java function to compute DFT first then I can calculate the power spectrum.

My assumption is the frequencies mos represented in the power spectrum will constitute the signal data and the rest likely noise.

Next I'm going to try and add a function that constitutes a digital filter to my program, so as to filter my signal data based on the frequencies I desire according to results of power spectrum estimation.

Then I could plot the filtered data set to the screen.

I'm wondering what other peoples' opinion on what I'm trying to accomplish is. I'm not an expert in signal analysis and I wanna know if the digital filtering tool I'm trying to build into my device makes sense, or will actually help me eliminate noise in my skin conductance data.
>>
>>54764733
>Legit question - where did "webdev babby" meme come from?
Ignorance

>It is because of how mainstream it is with all those sjws and kode with karlie plebs?
Well, partly that and partly because /g/ is full of tryhard hipsters who think they are bigshot programmers because they've written FizzBuzz in C#.
>>
>>54764741
>skin conductance monitor
why doe
>>
>>54764741
>I'm wondering what other peoples' opinion on what I'm trying to accomplish is.
i dont know, because you never said exactly what you are trying to accomplish
admit it, you just made that post to try and confuse people so you could feel good about how smart and superior you are
>>
>>54764733
From the people that have actually fucking used this thread regularly for a while and aren't completely and utterly new
Web apologists are NOT welcome
>>
>>54764772
neither are autistics spergs
grow up
>>
>>54764782
>>>/wdg/
>>
File: sicp.jpg (280 KB, 700x849) Image search: [Google]
sicp.jpg
280 KB, 700x849
>>54764648
What are you looking to do with "programming"?

If it's just for a hobby pic related is a good start for a novice.

If you wanna do theoretical CS shit like a PhD or something it will be a lot of learning but pic related is a good start for a novice.

If you just wanna become some programming wizard it will be a lot of learning but pic related is a good start for a novice.

If you want to have a job you're damned to .NET.
>>
>>54764818
>why not both.jpg
its like you fags think you cant have a job writing in .NET while doing other more complicated shit in your free time
>>
>>54764768
i'm trying to filter noise from a signal, I think.

as far as complicated, everything I've done so far has been copying what other people have already done; my PCB and most of the Java to plot the signal collected from my arduino are both copied from stuff i've found online.

what i'm uncertain about is probably the only bit of my post that requires some special knowledge. I took a class in signals and systems and got the idea that I can do discrete fourier transform on my data to get the frequency components, and then filter it digitally. If you don't know how that's done then I'm as lost as you are right now.

I'm just hoping someone here happens to have more understanding than I do of what I'm trying, including how to program a digital filter, and if what I'm trying is meaningful. I'm not sure it will improve the "quality" of my data, if that makes sense.
>>
>>54764838
you could meme your boss into writing F#, since it's .NET
F# is better than scheme anyway
>>
>>54764838
Of course I understand that. That's why each statement begins with if and not else if. The only thing I meant to imply was that pic related isn't really a resume builder.
>>
Sincere question although it is kind of odd..

Is there a way to program something where after a specified number of milliseconds (static value), count +1.

I guess my main questions are:
what would be the best method to count milliseconds?
How accurate would this be if the specified millisecond value is statically assigned?

Thanks in advance.
>>
>>54764757
just thought it'd be cool and different?
you can monitor stress from what i've read, probably because your skin gets more saturated with electrolytes when you sweat.
>>
>>54764772
>>54764738
This is what I was talking about.

When "dpt's" come to wdg, wdg helps them. When it's the other way around wdg's get shat on.

Idk man, I have programmed in Python too, maybe I get a ticket to come here too, r-right?
>>
>>54764859
Homoiconicity.
>>
>>54764859
F# is too pure for him
>>
>>54764868
Further clarification: any language really. I have no preference other than the one that seems to work for this application best.
>>
>>54764875
Just because you let a girl into your house doesn't mean you should expect her to let you into her house
>>
>>54764868
use a timer ya doof
read up on CPU clock frequencies if you wanna know how it works on the technical level
>>
>>54764868
The best way to do it is to busywait while checking a high resolution timer. When 1 ms passes you the busywait loop ends.
>http://linux.die.net/man/2/clock_gettime
>>
>>54764875
microframeworks are programming, not Rails or Django though
>>
>>54764896
>CPU clock frequencies
Is not how the clock works. It used to be that way but shit's complicated now. There's dedicated hardware for the clock. CPUs don't even run at a constant clock speed anymore.
>>
>>54764916
>this kind of programming is programming while this kind isn't
i dont even
>>
>>54764896
>>54764905
>>54764922
Much appreciated info. Thanks to all of you
>>
>>54764935
>unironically defending memes using memes and expecting it to be accepted
m8...
>>
>>54764922
shit, now i feel old
you dont happen to have a link or something on how modern CPU's work?
google just keeps coming up with stuff from 2005
>>
>>54764953
what?
>>
>>54764966
?
>>
File: LegoLegends.png (70 KB, 1097x656) Image search: [Google]
LegoLegends.png
70 KB, 1097x656
>>54757455

I'm making a simple League of Legends CLI program to improve my programming skills :^)
>>
>>54764973
>Cute lil' boi doing his cute boi stuff
>>/cuteboys/
>>
>>54764986

What are you working on, summoner?
>>
>>54764954
I believe this is what you're looking for:
>https://en.wikipedia.org/wiki/High_Precision_Event_Timer
>>
>>54757455
what anime is this from?
>>
>>54764916
Is Sinatra a microframework and thus considered a realest programming?

It kinda looks cool.
>>
>>54764973
looks neat anon
i made a lasthit bot not too long ago
>>
>>54764905
Question though. How big of a deviation should I expect when taking into account latency issues from the time it takes to complete one loop to count 1ms?
>>
>>54765027
Assuming you do it in C, basically fucking nothing. Nanoseconds. Just remember to use CLOCK_MONOTONIC.

>>54765014
The 2014 anime short series Himegoto.
>>
Is MVC pattern an overengineered meme?

I tried to learn MEAN stack and all that shit, but it seems so bloated it's pretty amazing. Really feels like legos.

I've been looking at Flask and it seems much nicer.
>>
>>54765081
>Is MVC pattern an overengineered meme?
Yes, but it is a good idea to separate business logic from representation.

>I've been looking at Flask and it seems much nicer.
Flask is not a pattern, it's just a microframework. You can easily implement MVC in flask.
>>
>>54765081
Is MVC pattern an overengineered meme?
no, it IS however designed for teams consisting of hundreds of developers, meaning its a bit less efficient for single developers making shit in their freetime
>>
Can someone explain why C++ programs have pointers all over the fucking what place when they could have just used a variable? What are the advantages?
>>
>>54765195
Pass by reference means pushing an address on the stack.

Pass by value, however, often mean doing a deep copy.

Imagine you have a string of text. Passing that string as a reference/pointer means that you just pass the memory address of the first character and a number signifying how long it is.

Passing by value, however, means that you copy each byte/character in the string into your own local copy.
>>
>>54765195
this is too big of a subject to cover in a 4chan post
google it

but pretty much
>>54765211
>>
>>54765222
Why wouldn't it?
>>
File: schematic.png (68 KB, 882x715) Image search: [Google]
schematic.png
68 KB, 882x715
can someone pls help me with this here question?

based on this circuit, what word should be placed in the TRISB register?
All the PORTB pins look like they're outputting signals to LED.
So if it's all output then the the word i input to the TRISB register to set them as outputs should be b'00000000', right?

But RB6 & RB7 also appear to be receiving clock inputs from PGC & PGD if i'm not mistaken.
So should those 2 pins be set as an input or an output (0 or 1) when inputting a word to TRISB to set it?

sorry, I hope that wasn't worded confusingly.
>>
>>54765211
So basically a reference is the same as a pointer?

Does references in e.g. Javascript work the same way?
>>
>>54765278
>So basically a reference is the same as a pointer?
From an implementation perspective, yes. From a language syntax point of view, sort-of maybe-ish. In C++ references are like pointers with additional constraints
>not assignable (and can't be used to do arithmetics)
>can't be NULL
>some other stuff

>Does references in e.g. Javascript work the same way?
Yes, under the hood. Most modern interpreted languages do pass by reference for object types.
>>
which ApplyTo will be called /dpt/?

#include <iostream>

class Device;
class DerivedDevice;

class Effect
{
public:
void ApplyTo(DerivedDevice* device)
{
std::cout << "DerivedDevice" << std::endl;
}

void ApplyTo(Device* device)
{
std::cout << "Device" << std::endl;
}
};

class Device
{
public:
void ApplyEffect(Effect* effect)
{
effect->ApplyTo(this);
}
};

class DerivedDevice : public Device
{
int y;
};

int main()
{
Device d;
DerivedDevice dd;
Effect e;

d.ApplyEffect(&e);
dd.ApplyEffect(&e);

return 0;
}
>>
File: lisp.png (482 KB, 1074x1205) Image search: [Google]
lisp.png
482 KB, 1074x1205
How can Pajeet and other Java monkeys even compete?
>>
>>54757624
>you'll never need any of that.
Oops! Too late for that.

And even without that, if you want to debug your software and you can't read a disassembly, you're going to be wasting so much time when something subtle happens.
>>
>>54765278
>So basically a reference is the same as a pointer?
In some ways, but not in all.
>Does references in e.g. Javascript work the same way?
Clearly no. In JS all variables are references. (except ints or something) In C++ at most one variable isn't a reference, it is the object itself directly. (Could call it the owner, ownership extends this concept) When it goes out of scope, the object is destroyed even if there are pointers or references around (nothing checks that you're not fuckung up). By definition, stack-allocated objects have a "direct" variable somewhere and heap-allocated ones never do (although you can treat them the same if you only get passed a pointer or reference). Also note that there is no big distinction between primitive types and object types, so there can be int pointers, and even pointers to pointers.
>>
>>54765323

It will not compile
>>
>>54760233
0/10, use a fucking + at the intersection, like everyone else
>>
>>54765345
>g++ compiled without warnings
>>
>>54765323
It would obviously print "Device", since you call ApplyTo(Device*).
There's no vtable anywhere in sight, I don't know how you could be confused.
>>
>>54765024
i found a library which basically makes a keyboard driver for you to send commands to

undetectable af since it's just a keyboard to the game
>>
File: QuarrelsomeRegalHusky.webm (483 KB, 656x432) Image search: [Google]
QuarrelsomeRegalHusky.webm
483 KB, 656x432
how the fuck do i 2d scaling?

how do i make all the objects move away from eachother?
>>
Monkey problems why would I be having monkey problems?
>>
>>54765887
http://www.alanzucconi.com/2016/02/10/tranfsormation-matrix/
>>
>>54765963
>tranfsormation
?
>>
>>54765887
come on this is very basic math

multiply each coordinate by a factor

do an offset (subtraction) before you multiply if you want to scale around a certain point
>>
In wangblows is there a way to override the print dialog and use another process?
>>
>>54766545
What the fuck is "the print dialog"?
>>
https://gist.github.com/johnazariah/f6f4761f4e542ff8f584560c50e96b31

LMAO
can't use enum then switch since no compile-time guarantee of total matching

that is some shit on C#'s part
>>
>>54757931
Assembly here, assembly there, that is fine. Still the funny thing is gameboy-emulators in javascript.
>>
>>54766414
ok, but, how can i scale by a factor of less than 2 (it's too big), when terminal coordinates are only integers?
>>
Anyone have that programming roll image?
>>
>>54767141
>terminal graphics
>current year
try doing it kinda like how gpus do it like if you have a "pixel" in between two integer coordinates then each coordinate gets half the color or something
>>
How do I stop being autistic and accept hacking together solutions instead of doing "the right thing"?
>>
can someone redpill me on software engineering?

I've been working as the solo code guy for this firm for a while now, but now they're hiring a couple of guys to work with me, and I'm getting stuck with the project management job. This is my first job so I'm pretty confused.
>>
Programming in PHP does make me a programmer (I did some scrapper and stuff) ?
>>
>>54767542
Read up on waterfall, agile, etc
Look into how to set up code reviews/git server

Look into requirements gathering, etc

Basically Google project management for software

I imagine you will be the one doing the code reviewing
>>
>>54767408
short answer: you dont
long answer: with experience, you eventually learn to predict whether or not this piece of code is likely to change in the future
if its not, then you dont have to make an abstraction and can write any piece of crap that works

but really, when writing large stuff you should almost always aim for the "right way"
>>
>>54767408
do it right from the start or else you might get fucked over later on
>>
is there a good irc lib for C++
im too dumb to write my own with sockets and stuff because crossplatforming sucks
>>
>>54764741
>My assumption is the frequencies mos represented in the power spectrum will constitute the signal data and the rest likely noise.
That's a pretty big assumption, and most likely wrong.

>>54764858
>i'm trying to filter noise from a signal, I think.
You're going to need more than that. What you need to do right now is read up on skin conductance. You need to understand what it is, and what your sensor is measuring. Only once you know what you're looking for can you start thinking about how you'll get it.

Filtering as you describe it will only be useful if your signal is limited to a certain band of frequencies. Then you can filter out anything outside that band.
>>
>>54767769
IRC lib? Dude, IRC is fucking trivial.
I can write a IRC client in less than 100 chars.
>>
>>54767896
great for you, dude, I cannot do that. and again, crossplatforming sucks with sockets because windows requires one thing and linux another one
>>
>>54767769
JUST ABSTRACT THE FUNCTIONS FOR READING AND WRITING DUDE LMAO
>>
>>54767916
Yes you can, you just gotta stop for a second and fucking think.
Read the goddamned doc, and you'll figure it out.

If you can't even do the most basic shit by yourself you're not a programmer, you're a copy-paster.
Programming is not mashing together code OTHER PEOPLE WROTE.
>>
>>54767931
ok
nice help
idk
>>
>>54767944
no im dumb
reinventing the wheel doesnt always help, I would rather use someone's code that is better in any way than anything I could write ever.
>>
>>54767967
If you're not even going to try, then fuck off my /g/ and go annoy the StackOverflow people.
>>
>>54767980
i can try, but i know im bound to failure or inefficient code
thanks for help nevertheless good to know that youre better at coding that me
>>
>>54767980
>then fuck off my /g/
how about you fuck off you autistic sperg
>>
>>54767995
If you don't even try, you'll never get better.
Nobody fucking care if your code is inefficient, it's a fucking IRC client, you can't make it slow even if you try.

Grow some fucking confidence and google it, faggot.
>>
>>54764891
I won't bother desugaring this, but to show it works for more than just primitive recursion:
ack : (i : Size) -> (j : Size) -> Nat i -> Nat j -> Nat #
ack i j zero n = succ # n
ack i j (succ i' m) zero = ack i' $j m (succ $j (zero j)) -- i' < i
ack i j (succ i' m) (succ j' n) = ack i' # m (ack i j' (succ i' m) n) -- i' < i, j' < j

All the type system needs to prove totality is that the size arguments decrease with a lexicographic ordering. So in this case, either the first size has to decrease, or it has to stay constant and the second size has to decrease.

It also works for corecursion.
>>
File: richcloseup.gif (2 MB, 335x334) Image search: [Google]
richcloseup.gif
2 MB, 335x334
I'm streaming webdev at SHTheSuper on Twitch.

I'm doing React/frontend stuff, so if you have a thing for watching people in pain, it should be fun for you.
Thread replies: 201
Thread images: 14

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.