[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: 21
File: 978-3-540-73133-7.jpg (5 KB, 153x232) Image search: [Google]
978-3-540-73133-7.jpg
5 KB, 153x232
Network Science Edition

Old: >>55283589
>>
>>55296311
DELETE THIS!11!1
>>
Why don't the last modification time of my files of my external backup drive match the original's?
Doesn't matter whether I copy them in Windows Explorer, Putty, rsync or whatever. Local drive is NTFS backup drive is ZFS.
>>
riddle me this you fucking faggots

uint8_t foo[fuck_you];


how do i make a constexpr POINTER to foo

like the equivalent of
void *const ptr = foo;


the pointed-to shit is still non-const and non-constexpr, but i want the POINTER to be const and constexpr
>>
>>55297706
const void const * const ptr = &(foo[0]);
>>
>>55297706
const const void const const * const const const ptr = &(foo[0]);
>>
>>55297706
const const void const void const const * const const const ptr = &(foo[0]);
>>
>>55297861
>>55297886
>>55297895
>when it compiles
fuck C
>>
>>55297918
>my weeaboo shit brain can't grasp a simple language
lel
>>
>>55297706

Riddle me this: If foo is a locally stored array, is its address necessarily going to be the same every time the function it is in is called? If that were the case, it might make sense for a pointer to any of its elements to be a compile time constant (a constexpr). But presumably, this variable will be stored in some sort of function call stack. The address of foo might vary depending on how many levels deep it is called. For instance:

main()
fn_with_foo()

or

main()
bar()
fn_with_foo()

Knowing that the initial stack frames are going to vary depending on which functions are calling the function holding foo, and how many levels nested they are, why would you think that the compiler would be able to know the address of foo as a compile time value?

The reality is this: A constant expression cannot point to any local variables, because it must be deduced at compile time. Since the address of a local variable is allowed to vary at runtime, you cannot make a constexpr pointer to it.
>>
File: unnamed.png (20 KB, 633x352) Image search: [Google]
unnamed.png
20 KB, 633x352
The only code the program is responding to is the close Form bit. I'm getting an error message but it will not tell me what the error is.
>>
anyone use Groovy on a regular or semi-regular basis? is it comfy, or shit?
>>
>>55298001
Replace "And If" with Or.
You're doing two if statements instead of one
>>
>>55296311
C is an outdated and obsolete language, hail Python. It's the future of programming
>>
>>55297990
it's global

basically what i want is

constexpr void *const ptr = foo;


equivalent to

#define ptr ((void*) foo)


and ptr is likely to get "inlined" by the compiler and not stored in memory as a variable?
>>
>>55298048
> It's the future of programming

It has been for 25 years now.
>>
>>55298058
fuck it i'll just #define it, i don't trust these autistic shit compilers
>>
>>55298058
have you heard of relocations? aslr? no, the address is not a compile time constant; the linker determines the address and it's subject to relocation by the executable loader anyway
>>
>>55298058
god i wish i knew you in real life. we would talk programming all fucking day man. i wouldnt even amoke cigarettes. if you are female, we would kiss. if you are male, we would have a secret handshake.

all this stuff you are bringing up is stuff in working on, i just didnt know contexpr was a thing.

btw it seems like thats what it would be doing except that i think define works like a process environment variable and im betting contexpr simply places it at the static level which may or may not be in the same scope as the thread stack, since stacks are allocated to threads. Meaning that if the stack defines the static context for that thread then process itself would hold a "main" and the others would function like trap stacks to it except that the limitations of the assembly flags might not be so straight forward. maybe im just stupid though. i have only recently gotten to trap stacks and how they relate to exceptions and all that.
>>
>>55298173
>define works like a process environment variable
>contexpr simply places it at the static level
>scope
>thread stack
>allocated to threads
>static context
>trap stacks
>limitations of assembly flags
>retard tries to talk about programming
ishyggy
>>
https://play.google.com/store/apps/details?id=eu.depa.captionr
>>
>>55298164
i don't know how the fuck this works. how the fuck should i be doing it then? does the linker magically replace ((void*) foo) with a sensible value or does it have to do some sort of lookup? should i store it in an explicit variable in memory to save having to do the linker shit more than once?
>>
>>55298207
>the dominant color is white
green or brown seems more relevant
>>
>>55298254
>how the fuck should i be doing it then?
do fucking what? what do you need to do? what's the problem you need to solve?
>>
>>55298300
when calling glBufferSubData once in a while in a game loop i need to submit a pointer to the buffer which holds the data i'm uploading. should the pointer be a value that gets read from a variable stored in memory (potentially with a cache miss) or should it be an inline expression of the form ((void*) foo + bar)?
>>
>>55298173
>look how many nonsensical memes I can fit in a post
Holy shit!
>>
>>55298330
>when calling glBufferSubData
>potentially with a cache miss
that fucking call dwarfs any kind of memory access you'll ever do; it's like asking if you should dereference a variable to read a file name before opening and reading 1GB of data over the network or you should just hardcode the string of the filename instead; stop worrying about "muh cache miss" meme and get on with your life
jesus fucking christ, this cargo-culting is insane!
>>
File: 1463941052383.jpg (20 KB, 398x410) Image search: [Google]
1463941052383.jpg
20 KB, 398x410
>F#
>still no HITs
>>
>>55298383
fuck off i just want to know once and for all for future reference for how to deal with pointers, your response is just an excuse for not knowing the answer
>>
>>55298415
you are retarded, do you you understand?
>>
>>55298433
kill yourself
>>
>>55298330
>uploads data to GPU
>worries about cache miss on reading a pointer
bwahahahahahaha! get a load of this webshit!
>>
>>55298448
fuck off retard you're pathetic trash
>>
>>55298415
I hope you understand that once youve made a genuine syntax to assembly flag connetion, or even a high level to low level connection here on /g/ the mods kick it into over drive and start shitting on everything, right? it might even be a cia nigger.
>>
>>55298448
a cache miss could cause lag in a game. it could also cause a lapse in the tempo and if the tempo were crucial like in mobas and rts, then you could essentially create a game with zero balance and zero consistency. you would lock out every autist, and be forced to make a digging platofrmer.
>>
>>55298490
>muh cache miss
>I've heard about it
>it's bad for muh game
c'mon webshit, we all know you're not gonna finish anything, why bother?
>>
>>55298524
nice projecting, you're clearly the one not finishing anything since you spend all day on a weeb forum pretending to be a "big dick playa"
>>
>>55298042
Fixed that, but it is still not displaying anything in the label when I click on the Compare button.
>>
>>55298415
>once and for all
>how to deal with pointers
>I don't understand the problem
>I don't know the solution
>but I'm gonna go with whatever the majority used for an unrelated problem
literally the definition of cargo cult; are you seeking help for your mental illness?
>>
>>55298330
> Programmers waste enormous amounts of time thinking about, or worrying about, the speed of noncritical parts of their programs, and these attempts at efficiency actually have a strong negative impact when debugging and maintenance are considered. We should forget about small efficiencies, say about 97% of the time: premature optimization is the root of all evil. Yet we should not pass up our opportunities in that critical 3%. A good programmer will not be lulled into complacency by such reasoning, he will be wise to look carefully at the critical code; but only after that code has been identified.
>>
>>55298551
stay delusional

>>55298552
>premature optimization is the root of all evil
fantastic meme
>>
>>55298536
>you're clearly the one not finishing anything
>but I do tho, because I worry about cache miss on a pointer access
>the game is finished any day now, I just need to understand these pointers and how to access them
>triple A right here
you're literally shit
>>
>>55298552
>A good programmer will not be lulled into complacency by such reasoning, he will be wise to look carefully at the critical code; but only after that code has been identified.
>A good programmer will not be lulled into complacency by such reasoning, he will be wise to look carefully at the critical code; but only after that code has been identified.
>A good programmer will not be lulled into complacency by such reasoning, he will be wise to look carefully at the critical code; but only after that code has been identified.
>A good programmer will not be lulled into complacency by such reasoning, he will be wise to look carefully at the critical code; but only after that code has been identified.
>A good programmer will not be lulled into complacency by such reasoning, he will be wise to look carefully at the critical code; but only after that code has been identified.
fuck off and die retard
>>
>>55298570
>I'm a shit programmer
>muh """web""" skills tho
top fucking cuck!
>>
>>55298569
stay delusional fucking retard, you couldn't even answer a dead simple question about constexpr, i had to get the answer from anon in the other thread
>>
>>55298559
>delusional
when did you find out you're mentally ill, anon?
>>
>>55298582
stay delusional
>>
>>55298570
>but only after that code has been identified.

This was the important part you dribbling fool. If the code hasn't even been written yet, let alone run on hardware, it hasn't been fucking identified as a performance problem.
>>
>>55298600
kill yourself
>>
>>55298583
>had to get the answer from anon in the other thread
>retard learned from another retard
what a time to be alive! :^)
>>
>>55298591
you are just arguing with a mod or mommya chocl o bottom out of britain. really, just spare yourself the headache and get back to your code or get some sleep and think on it with a clear head tomorrow because that asshole is using years of shit posts to bring you down to his level. Will literally copy and paste on you just to get the feeling of a running start after every post.
>>
>>55298642
>I got raped myself for being retarded
>nothing wrong with our idiocy tho
>>
>>55298642
yeah i'm gonna leave for sure, just hard to commit to closing the thread when people keep replying, only reason i came here was to ask about constexpr pointers because the autistic docs suck at explaining. but now i know (if i understood correctly) there's no such thing as a constexpr pointer because the pointer address is determined at run time
>>
>>55298708
>constexpr pointers
There's no such thing, pajeet.
>autistic docs
Sounds like you're the autist, rajesh.
>now I know
You sure got told, yes.
>because the pointer address is determined at run time
But do you know what run time means, webcuck? That's when the cache miss is stalking your game! Be on your toes! Cache misses HATE successful games! Stay safe!
>>
>>>55298684
lmfao this tard thinks you should never have global state

he's tipping his fedora so hard it might fall off
>>
>>55298741
you changed your writing style a tiny bit, why? you think you're being remotely convincing with this samefagging, "big dick playa"?
>>
File: Untitled-1.png (156 KB, 1235x1200) Image search: [Google]
Untitled-1.png
156 KB, 1235x1200
>>55296311
I'm working on adopting Google's Tensorflow sample for CNN text classification code to work with multiple classes.

I additionally replaced original randomized and learned word embeddings with a premade set of word2vec embeddings, with learning disabled.
>>
>>55298817
>you like to rape me just like the big dick playa
>you must be him, right?
Haven't you heard? The big dick playa is anonymous! Anonymous is the big dick playa!
>convincing
Why would anyone try to convince shits of anything on an anonymous reddit?
>>
>>55298058
quoting myself in last thread
>>55298281
>It can be a reference tho.

int xs[8];
constexpr int &x = xs[4];

int main() { x = 3; }
>>
god i hate this place
sometimes i wish the mods would ban me so i have a reason to not come back
>>
>>55298865
why don't you just sit back and suck my dick in silence?
>>
>>55298861
>quoting myself
retards sure like to quote their own inane shit
>>
>>55298865
just tell yourself "i've had enough of this shit", close /dpt/ and open up your IDE or whatever, i've done it for days at a time, it's so fucking good and productive
>>
>>55298876
i know one guy IRL who talks like you do and he was the biggest fucking idiot i've ever met
>>
>>55298907
everyone knows that people in /dpt/ don't program
>>
>>55298861
It's the same as
int xs[8];
constexpr int *x = &xs[4];

int main() { *x = 3; }

There's nothing special about references.
>>
>>55298924
so can you or can you not have constexpr pointers? or is constexpr meaningless in this context?
>>
File: word2vec.png (730 KB, 1021x600) Image search: [Google]
word2vec.png
730 KB, 1021x600
>>55298818
And here's a visualization I made of my word2vec embeddings.

Each column is a word, words are in order of decreasing frequency of use. with a width of 1021, there are 1021 words pictured.
Each row contains word2vec coefficients (2 pixels tall), blue means it's negative, orange it's positive.

This is similar to GloVe visualization, they offer on their main page. Although it seems word2vec features are much less pronounced.
>>
>>55298912
does he also shit on you every time you open your fuck hole without having a clue what the fuck you're talking about? does he also have a big dick? did he also stretch your mouth?
>>
>>55298944
i think you need a hug
>>
>>55297422
>ZFS
>backup
i thought you wanted to keep your files, not lose them anon
>>
File: 1465457843589.jpg (86 KB, 960x723) Image search: [Google]
1465457843589.jpg
86 KB, 960x723
One thing keeping me away from Haskell is the fact that it doesn't have Lisp-style macros. What's the alternative to them in Haskell?

Another question is, what things does Haskell have that would be difficult if not impossible to implement in Lisp or Scheme?
>>
>>55298936
It's meaningless you fucking retard. Why the fuck do you insist on using constexpr if you don't know what it is and what it does? How many times do you need to get rekt to understand? Fuck off with your mental illness!
>>
>>55298965
if it's meaningless then why is it not an error or a warning?
>>
>>55298949
>dodging the important questions
>>
Hi guys, can I have some tips on Java?

I don't want a gold rule lr something, but I figured you guys can tip me some things to make the learning a little easier.

I'm having a little hard time when I try to look if something is a class or object. I know that an object have (or can have) class, but when I do shit on Eclipse is hard for me to see what the hell are some words.

Sorry for bad english.
>>
File: attention_w.jpg (30 KB, 400x375) Image search: [Google]
attention_w.jpg
30 KB, 400x375
>>55298977
>does he also shit on you every time you open your fuck hole without having a clue what the fuck you're talking about?
>does he also have a big dick?
>did he also stretch your mouth?
>important questions
(You)
>>
>>55298936
Seems like it can, anon is right. Maybe cppref is wrong or I'm not reading it properly.

As for your original thing:
‘void*’ is not a pointer-to-object type


The real question is why do you have a void pointer? it's just less powerful than the original pointer...?

>>55298965
explain this
int xs[8];
constexpr int *x = &xs[4];

int main() { x = nullptr; }

->
assignment of read-only variable ‘x’
>>
>>55298996
a class is like a template for an object. an object is an instance of a class.

this might help:
https://docs.oracle.com/javase/tutorial/
>>
>>55298996
You need to formulate your question better. I honestly can't tell what you're asking about.
>>
>>55298975
because the standard says so; any other retarded questions?
>>
>>55299002
>still dodging
we'll have to assume the answer is yes, right?
>>
>>55299005
>explain this
explain what? what read-only means? how fucking stupid can you be?
>>
>>55298961
ZFS has never let me down.
>>
>>55299021
Yes I understand what it is. Thing is sometimes I can't diference one from each other.

>>55299026
Asking tips to learn Java easier or better. Everything is welcome. Sorry for my poor english.
>>
>>55299065
constexpr is stronger than read-only
>>
>>55299065
>constexpr is meaningless
And I'm not going to give you the benefit of imprecision, you've been enough of a pain in the ass already.

>>55298058
Does that satisfy you? That's all I care about.
>>
>>55299083
>Thing is sometimes I can't diference one from each other.
Could you provide an example of code and point to something in it that you can't tell if it's a class or object?
>>
>>55299091
did I say it's not?
>>
Daily reminder references are just less powerful pointers.
>>
>>55299117
You told anon to not use it because its meaningless and useless for his purposes. I believe it is useful, and I showed that constexpr at least does something to x, but not to *x, which means the compiler is more likely to optimise x if anon uses constexpr and that's what anon wants. I haven't insulted you just fyi.
>>
>>55299102
Of course, I will do when I reach home, in the meantime, I will try typing it again.

My main issue is I'm going to some serious classes and teacher uses sometimes codes that (obviously) he doesn't explain at 100%. Then there's when I have the hard time. I know some safe places when they appear and I know I'm not wrong, but out of that lines I get kinda lost.
>>
File: shiggy memewoman.jpg (124 KB, 691x680) Image search: [Google]
shiggy memewoman.jpg
124 KB, 691x680
>Haskell
>still no β-coinductive types
>>
>>55299174
It's pretty fucking different to not be able to tell them apart. Objects are things in memory. Each object has an address in memory and each object has a class it belongs to.

A class is just that, a class, a name that you can use to classify your objects - this object is a List, that object is also a List, the other object is a Matrix. A class can not be used in a context where an object can be used.

It gets a little bit more complicated with reflection in Java - for each class that's used in the program, an object of one special class (its full name is java.lang.Class) is created for you and exists - but you don't have to even thing about that unless you're working with reflection.
>>
Is OOP a meme?
>>
>>55299340
It's a tool.
>>
>>55299152
>meaningless and useless for his purposes
it is, because I know his purposes; do you know his purposes? his purposes are retarded: he thinks marking it constexpr causes the value of the pointer (which is actually computed by the linker, not the compiler, and later on adjusted by the loader) to become a compile time constant so he can "avoid a cache miss when using the pointer as an argument for glBufferSubData" and refuses to believe that even if there were a cache miss (there isn't, the value of the pointer will be an immediate operand on all architectures) it doesn't fucking matter for performance because that function dwarfs any cache miss effect because it's fucking UPLOADING DATA TO THE GPU!
so, yes, constexpr is meaningless for his """purposes""".
>means the compiler is more likely to optimise x if anon uses constexpr
he gets the same result if he makes the pointer const (which again, is useless for what he thinks he wants); the semantics for which constexpr was introduced in C++ are meaningless to his """purposes"""
I haven't insulted you either
>>
>>55299419
calm down bruv
>>
>>55299419
>(there isn't, the value of the pointer will be an immediate operand on all architectures)
if the value of the pointer is stored in a variable that has to be fetched it can cause a cache miss

>it doesn't fucking matter for performance because that function dwarfs any cache miss effect because it's fucking UPLOADING DATA TO THE GPU!
that was just one example
>>
>>55299241
I keep forgetting the obejct only exists when the program is running. I hate being so short of memory.

Then, I should assume what I'm seeing are classes? I mean, I know method won't be alone (at least, I only saw them as something.method(); and alikes) and properties never are out of the classes.

Am I saying retarded things?
>>
>>55299419
>(which again, is useless for what he thinks he wants)
retard confirmed
>>
>>55299445
>can cause a cache miss
keep being retarded
>was just one example
it was literally the reason why he wanted to """optimize"""
>>55299461
another retard
>>
>>55297918
Pick up a book and C becomes your greatest ally.
>>
>>55299508
i am "him" and you are fucking retarded

kill yourself

you didn't even know what a C++ class is yet you asserted your shitty opinion >>55298824

you should stick to your field of expertise which is averaging two ints in C and fizzbuzz
>>
>pycurl.error: (7, "Can't complete SOCKS5 connection to 0.0.0.0:0. (1)")
can someone tell me why pycurl shits itself when trying to connect through tor?

import argparse
import pycurl
from io import BytesIO
from bs4 import BeautifulSoup
from urllib.parse import urlparse
import os

#default settings
_proxy_url = "localhost"
_proxy_port = 9050
_page_increment = 12
_follow_redirects = True
_useragent = "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/50.0.2661.102 Safari/537.36"

def get_file(url):
buffer = BytesIO()
conn = pycurl.Curl()
conn.setopt(conn.WRITEDATA, buffer)
conn.setopt(conn.PROXY, _proxy_url)
conn.setopt(conn.PROXYPORT, _proxy_port)
conn.setopt(conn.PROXYTYPE, conn.PROXYTYPE_SOCKS5)
conn.setopt(conn.FOLLOWLOCATION, _follow_redirects)
conn.setopt(conn.USERAGENT, _useragent)
conn.setopt(conn.URL, url)
conn.perform()
rcode = conn.getinfo(conn.RESPONSE_CODE)
conn.close()
return rcode, buffer.getvalue()
>>
Stupid question, and I feel like I should know the answer, but when I randomly generate a sequence of 4 letters with a sequence length of 100,000 the output is always a ratio of about 1/4th. Is that because given a large enough sample space the PRNG stops being so random? The answer is dice, I'm dumb.

I guess in that case, how would you bias a PRNG?
>>
Monitoring shit at work, wondering what I can do
>>
>>55299592
program something for me

in winamp AVS

make some crazy shit with math, nerd
>>
>>55298330
anon, when you upload data to the GPU you do tons of bus transfers(i. e. uncached memory accesses)
a single cache miss on a pointer initially really won't matter compared to the rest of the transfer. Also, you CANNOT tell where performance problems will be in a, say, 1000+ LOC codebase without running(and profiling) it.
Here's a very good series of articles about optimizing graphics code: https://fgiesen.wordpress.com/2013/02/17/optimizing-sw-occlusion-culling-index/
the first article talks about uploading data to GPU.
>>
>>55299568
multiplication
>>
>>55299608
cool story bro

way to miss the entire point of the discussion
>>
glBufferSubData was just the easiest example i had on hand since you fucking tards lack the abstract reasoning skills to figure out what i was asking (basically what the most performant way to declare constant pointers is - as macro-substituted inline expressions or as explicit variables)
>>
>>55299419
>the value of the pointer will be an immediate operand on all architectures
why? would the compiler reserve an area in the process image for the buffer?
>>
>>55299534
>averaging two ints in C
lol, that's already above your level
>>
>>55299720
i've seen multiple ways to average two ints in C including one i came up with myself
>>
>>55299534
>didn't even know what a C++ class is
where did I say that? are you trying to """ optimize"""" my posts?
>>
>>55299715
>performant way to declare
bwahahahaha
>constant pointer
there's this keyword const, you probably never heard about tho
>>
>>55299741
anon asked if two classes could point to instances of each other, the example showed that two structs could, then it is clear as day that classes in C++ also can do it, yet you threw a hissyfit because the example used structs instead of classes, because you're so fucking clueless and/or stupid that you couldn't make the aforementioned inference
>>
>>55299715
You cannot declare constant pointers due to ASLR or relocation, the address of a pointer can't be known at the time you write the source code.
>>
>>55299737
>one i came up with myself
incorrect, I bet
>>
>>55299756
i intentionally worded it as "constant", as in it won't change, YOU FUCKING HANDICAPPED DELUSIONAL SPERG
>>
>>55299768
you can choose to understand.
>>
>>55299760
>example showed that two structs could because the shitter didn't know how to do it with classes as requested
top kek
>>
Calm down children, calm down
>>
i'm closing this thread, have fun replying, i won't even read your shitty posts

>>55299785
good luck in life, champ
>>
>>55299775
have you heard of the keyword const tho?
>>
>>55299794
>I got told so I'll shut my shit hole now
good
>>
>>55299768
>cannot declare constant pointers
have you heard about const?
>>
>>55299783
>>55299811
I think he means constexpr, or constant as in _A_ constant, like a literal.
>>
>>55299842
>constant as in _A_ constant, like a literal
he should learn how to speak then
>>
>>55299811
as in
const int *foo
?
>>
>>55299879
that's not a constant pointer, anon
>>
How does the stack get saved in a context switch?
>>
>>55299899
manually
>>
>>55299911
wew, my lad
>>
File: phone calls.png (23 KB, 629x441) Image search: [Google]
phone calls.png
23 KB, 629x441
Can someone explain why the TryParse in this program is not working?
>>
>>55299932
>Ruining the dubs train
What's the error saying
>>
>>55299879
int* const foo
>>
>>55299922
you're welcome
>>
>>55299932
How about hovering over it and reading the error message like the good little microcuck jizzual basick you are?
>>
>>55299607
Nah, I'm just gonna read this thing on malware analysis
Maybe I'll do some programming after lunch
>>
>>55299968
Yes i am an edgelord, by the way.
>>
>>55299899
(for x86) the kernel saves %ebp and %esp in a structure associated with whatever process is switching out and loads the ones it saved for the process switching in. the first process's stack stays wherever it was.
>>
>>55298941
What corpus did you train this on? Is it performing better than simply using Google's pretrained word2vec model?
>>
File: 1466635064614.jpg (74 KB, 300x339) Image search: [Google]
1466635064614.jpg
74 KB, 300x339
>google any programming subject
>mountains of shitty Youtube tutorials, articles full of broken English, and completely off-topic StackOverflow answers, courtesy of India
>>
>>55298962
Macros are a meme. They solve a problem that only arises from the fact that you are using LISP. As such other languages have no need for them.
>>
>>55298048
>less than a year of programming experience
>shilling python

how am I not surprised
>>
>>55300113
it gets better when you're not using a stupid normie language like AngularJS

The tutorials for that are fucking disgusting.
>>
>>55300209
>tutorials
when will shits like you learn to read a book?
>>
>>55300150
pls get b& and kill yours
>>
Is it true linked lists are not good for anything and should never be used?
>>
>>55300219
>reading a book for shitty frameworks
>not just using the reference

lol
>>
>>55300227
>using the reference
>youtube tutorials
please
>>
>>55300226
don't use them. The idea they are faster for insertion or deletion (which itself is questionable) aren't worth the absolute shit access time

https://isocpp.org/blog/2014/06/stroustrup-lists
>>
>>55300226
Way too many cache misses, dynamic arrays are all you need in most of cases.
>>
>>55300226
Rules of thumb suck, test it out for yourself on a program by program basis.
>>
>>55300222
but why? I'm happy with my life, I hope you will too one day :^)
>>
>>55300271
>don't use them
>My point is not about lists as such. They have their uses, but this example isn’t one of them. Please don’t confuse the example with what the example is used to illustrate.
Are you confusing the example with what the example is used to illustrate? Stroustrup says you shouldn't do that.
>most of cases
So there are cases when they're better? Like what?
>>55300290
That's waaaaay too reasonable! :)
>>
>>55300250
Err, see >>55300321
>>
>>55300250
>This shows how anyone can take a simple thing and twist it. An example is just to help express a point, but people can misunderstand and run with it. Get enough people that agree with the invalid argument and you suddenly have people claiming Dr. Stroustrup likes, hates, or <insert fallacy here> something.
>>
I don't really comprehend how intents work in Android. Is there a way to build some kind of listener around them so that I know when a child fragment sends data to my activity so I can send it forward to another fragment?
>>
Another regex question.
(\d)-(\d)-(\d)
Say I normally want to find and capture these 3 numbers.
But sometimes, instead of the 3 numbers, there's just "null" written instead. Now instead of it not capturing null, and having 1 less match, I want it to be included anyway.
[(\d)-(\d)-(\d)|(null)] - This doesn't work.
>>
>>55300717
\d-\d-\d|null
?
>>
>>55300717
Something like [(?:null)(?:\d-\d-\d)] ?
>>
>Tfw it's way too hard to make a good application
>>
File: surprised.gif (874 KB, 220x220) Image search: [Google]
surprised.gif
874 KB, 220x220
Hour before interview. So anxious. If I don't get this I don't know what I'll do. Wish me luck.
>>
>>55300794
>>55300739
Neither worked. Maybe it's easier to see if I post the actual regex instead of a simple example:
"eventNumber"":(\d+).*?data"":{""one"":""(\d+,\d+)"",""x"":""(\d+,\d+)"",""two"":""(\d+,\d+)"

Everything up to data"": is consistent, but sometimes the rest after that is just "null".
>>
what are the best languages for just creating some websites? I'm learning JavaScript, don't really know where I'm going with this
>>
>>55300954
html,css,javascript,php,sql,bootstrap,and wordpress all you need
>>
Win32 API is p comfy.

https://gist.github.com/anonymous/d3553b70d85965b82aaa776736344bc3
>>
>>55300905
I hope you get it anon. Don't fuck it up
>>
>>55300905
Tell the interviewer how much Java is such a shit language
>>
>>55300978
do they all tie in with each other, or do they each have their own respective use? It seems JS is more so for user functions
>>
>>55300923
would be easier if you posted examples of the text that's getting matched rather than the regex
>>
>>55301029
yes, to make a a real full professional website you need to know all of them and they all link together you will see once you start building websites
>>
>>55300954
listen to >>55300978

I've tried making a web app using rails and it was just a pain in the fucking ass. I ended up using pure JS, HTML, and bootstrap and finished it in a day.
>>
>>55301069
>>55300923
"eventNumber":1 <a fuckload of unimportant shit> data":{"one":"1,52","x":"4,00","two":"5,90"
or
"eventNumber":1 <a fuckload of unimportant shit> data":null
>>
>>55301110
>>55301114
Thanks so much, guys. I'll get on it. How long does it usually take? I'm pretty motivated honestly. Any good resources and such? Sorry for all the questions, just ready to actually do something in my life. Been bummed out recently
>>
>>55300996
>>55301002

Thank you! I'll let you guys know how I did in 2hrs (2x45 min phone calls)
>>
>>55301177
Don't try to memorize everything. Build something and learn familiarity. Learn what works and why it works and why some might not. Don't waste your time learning meaningless syntax when you're just going to look it up regardless.
>>
>>55301177
>>55275569
>>
>>55301157
"eventNumber":(\d+).+?data":(?:{"one":"([\d,]+)","x":"([\d,]+)","two":"([\d,]+)"|null)
should work
>>
>>55300226
There are a few cases where they are useful:
- Very large objects which need to be inserted/deleted in arbtrary locations (I saw a benchmark of array vs linked list for iterate + insert with various object sizes and there is a point where linked lists eventually wins, but can't remember exact number, but it was in the hundreds of bytes, maybe up to kb per object).

- Objects which needs to be in multiple lists and can't have their iterators/references invalidated after inserts/deletes (think global state objects like file handles, processes, threads, devices, etc)

- Lock-free algorithms where you can build up lists by acquire/release semantics for the next pointers.
>>
Will I ever use 2d arrays in a real program?
>>
>>55300096
About 1GB of text from news sites.

It's in Russian and google doesn't ship pre-trained word2vec for Russian language.

Interestingly, text-mode vord2vec model weighs about 800MB, not much less than original corpus of text.

Tensorflow model saved to disk with the vord2vex matrix weighs about 300MB.
>>
>>55299459
What you're seeing in code is mostly classes, variables holding references to objects, and class methods/fields.
>>
>>55301376
Of course. Why wouldn't you?
>>
>>55297918
If you struggle to compile, go take a Python class. It's self-explanatory :^)
>>
File: 1453387856719.png (173 KB, 297x556) Image search: [Google]
1453387856719.png
173 KB, 297x556
Is C++ even a language or just pure autism ?
>>
File: sqrt.png (5 KB, 252x219) Image search: [Google]
sqrt.png
5 KB, 252x219
    for (i=1; i < 11; ++i){
j = i;
total += j++;
sqrtX = sqrt(i);
t_sqrtX += sqrtX;
sqrt2 = pow(i, 2);
t_sqrt2 += sqrt2;
sqrt3 = pow(i, 3);
t_sqrt3 += sqrt3;
cout << setw(10) << i << setw(10) << sqrtX << setprecision(3) << setw(10) << sqrt2 << setw(10) << sqrt3 << "\n";
}


3rd and fourth column in total row wrong why?
>>
>>55301627
It's a language but only for autists
>>
>>55301635
Do you set them to 0 initially?
>>
How would I go about reading 4 bytes from a file pointer in C?
>>
>>55301268
That worked, sick. Any idea of how I could get "null" to replace the first number in the capturing group if there are no numbers?
>>
>>55301710
http://linux.die.net/man/2/read
http://linux.die.net/man/3/fread

Pick your poison.
>>
>>55301701
Basically,

    float t_sqrtX;
int t_sqrt2;
int t_sqrt3;
>>
>>55301721
That means you didn't unless they are global.
>>
>>55301721
Those are just variable definitions. They keep whatever value is already in the memory location unless you give them a value.
>>
>>55301719
Thanks!
>>
>>55301711
Nevermind I figured it out, it just ended up in the fifth group.
>>
>>55301758
>>55301733
Thanks, I modified them so that they = 0 in the definitions and it resolved the issue. Thanks.
>>
> Exercise 45. Let’s work through the same problem statement with a time-based data definition:
> ; AnimationState is a Number
> ; interpretation the number of clock ticks since the animation started

More htdp, fun times.
>>
File: 2016-06-28a.png (2 MB, 1600x870) Image search: [Google]
2016-06-28a.png
2 MB, 1600x870
I lost a bunch of stuff after fucking up my computer with too much hax.

So, I gotta rebuild my homepage.
>work in progress
Was gonna do it anyway, so I'm using it as an excuse
Gonna use jQuery to make it do things. Also plan to add a sexy Cirno interactive thing using some of my hentai images maybe. Use some JS to code when clicking the icon that it changes based on the perversion level or something
>>
>>55301828
bwaka homepage
>>
>>55301719
Is there a way to read the 4 bytes into a uni32_t?
>>
>>55298490
That would be valid if glBufferSubData didn't cause a hundred cache misses while reading the buffer. a single cache miss won't cause any problem.
>>
>>55301930
Yes. Specify the address of your uint32_t as one of arguments to the function.
>>
>>55301952
and not to mention if you are creating buffers on your game loop and worry about spikes at the same time, you are already doing it wrong.
>>
>>55300125
What about defining new syntax or being able to provide raw code as input? Can Haskell functions take that?

Take the Lisp 'while' macro for example:
(defmacro while (test &body body)
‘(do ()
((not ,test))
,@body))
>>
>>55301828
This is the cringiest thing I've ever seen on /dpt/. I love you.
>>
I wonder how guido feels for being a huge hack
>>
>>55301976
That's what I did at first but it's not working. I'm loading a .BMP image for a simple steganography exercise. The bytes from 0xA (10) to 0xE (14) are the address of the pixel buffer (where the image data is stored). I tried doing what you suggested:
[code
]int what;
printf("Do you want to read hidden data or to write?\n");
printf("[1]Read\n");
printf("[2]Write\n");
scanf("%d", &what);

if(what == 1){
fp = fopen(argv[1], "r");
if(fp == NULL)
die("Can't open the file! Check if it's there and I have premission!");
fseek(fp, 0xa, SEEK_SET);
uint32_t pixelArrayPointer;
read(fp, &pixelArrayPointer, 4);
printf("%lx\n", pixelArrayPointer);
}
[/code]
,but instead it prints 1 and 0. My hex editor says that the address is 7A so it should print 'z'. What am I doing wrong?
>>
That's what I did at first but it's not working. I'm loading a .BMP image for a simple steganography exercise. The bytes from 0xA (10) to 0xE (14) are the address of the pixel buffer (where the image data is stored). I tried doing what you suggested:
int what;
printf("Do you want to read hidden data or to write?\n");
printf("[1]Read\n");
printf("[2]Write\n");
scanf("%d", &what);

if(what == 1){
fp = fopen(argv[1], "r");
if(fp == NULL)
die("Can't open the file! Check if it's there and I have premission!");
fseek(fp, 0xa, SEEK_SET);
uint32_t pixelArrayPointer;
read(fp, &pixelArrayPointer, 4);
printf("%lx\n", pixelArrayPointer);
}

,but instead it prints 1 and 0. My hex editor says that the address is 7A so it should print 'z'. What am I doing wrong? Sorry for the mess...
>>
>>55299524
I wouldn't say it's your "greatest ally" but it's not that horrible.

To be completely honest, I prefer working in 68k asm most of the time.
>>
>>55302115
you are not reading file in binary mode
>>
>>55302010
well technically, you can define control structures with functions in haskell because it is lazy.

You cannot easily generate code at compile-time from say a DSL without using something like Template Haskell.
>>
>>55302142
Changing "r" to "rb" doesn't change a thing...
>>
>>55300125

Then why does template haskell exist?

Lisp simply doesn't assume it provides everything the programmer needs, unlike most other languages.
>>
>>55302179
>Lisp simply doesn't assume it provides everything the programmer needs, unlike most other languages.
This. Languages that don't put in macros are elitist
>>
>>55302168
well, then you are doing something else wrong. have you tried printing file byte by byte?

also you probably shouldn't combine fopen with regular read but I might be wrong on that
>>
>>55302215
Okay so I tried just reading the first byte into a uint8_t:
fp = fopen(argv[1], "rb");
uint8_t p;
read(fp, &p, 1);
printf("%x", p);

The above prints 6 while the first byte according to my hex editor is 66(decimal).
>>
>>55301627
C++ is the best language ever other than Golang fuck off
>>
File: office11_3152994b.jpg (132 KB, 620x387) Image search: [Google]
office11_3152994b.jpg
132 KB, 620x387
Has anyone here ever read CleanCode? Is it good?

Can you suggest any good books about programming in general and algorithms?

Also good books for C# and C++ and OOP design?
>>
I'm a java noob.

Pls, anybody here can be my mentor?
;u;
>>
>>55302326
have you tried using open instead? does read returns a correct value?
>>
>>55302366
Look up Derek Banana
>>
>>55302326
>The above prints 6
why would you lie on the internet? it doesn't even compile; fopen returns a FILE* and read requires an int as first argument
>>
>>55302366
Look up Pajeet Sanjriti
>>
>>55302402
It gives a warning + I'm not lying.
>>
>>55302444
if you are working with bmps try https://github.com/chazomaticus/libbmpread
>>
>>55302385
>>55302424
I just need someone who tell me I'm a faggot and need to get gud and don't dare to give up, giving me homeworks and stuff to read.
>>
>>55302444
>function takes integer instead of a pointer
and you ignore this warning?
>>
>>55302478
read sicp
write stuff that sounds fun
>>
Why is Java dominating the job market in every Western country? Every job near me is Java,Java, more java

I go into an interview we are doing java I go to another place java and another java it never ends
>>
>>55302473
I want to do it myself.

>>55302480
Okay, okay, my bad. I didn't know about the open() syscall. Using it fixed everything. Thanks!
>>
>>55302539
because you are applying java developer jobs.
>>
File: popularity of oop explained.png (107 KB, 1163x674) Image search: [Google]
popularity of oop explained.png
107 KB, 1163x674
>>55302539
>>
>>55302560
No I applied to all the computer programmer, software developer, software testing, and anything related to programming it is all Java
>>
>>55302363
A friend read that and suggested to me.
>books about programming in general and algorithms?
Introduction to algorihms, Algos in a Nutshell.
For C# you can read the Visual C# step by step, and for Sepples the Bjarne's books is based.
>>
>>55302580
are you a pajeet by any chance?
>>
File: 2016-06-28b-menus.png (2 MB, 1600x870) Image search: [Google]
2016-06-28b-menus.png
2 MB, 1600x870
>>55301828
Got some of the menus done. Wanna finish making the menu items before I go to the bathroom.
>>
File: 1465528686330.jpg (58 KB, 880x500) Image search: [Google]
1465528686330.jpg
58 KB, 880x500
>>55302599
>>
>>55302542
for future reference, you should use -Wall -Werror (or a more sane version of -Wall with -Werror) and learn to check return codes of the functions you called.

also bmp heas a header struct, instead of reading nth byte, read the whole header to a struct and check whatever you want.
>>
>>55302649
gcc build.c -Wall
>>
I learned Python a few days ago and wrote my first script. It was actually very fun.

It makes my Teamspeak server show the time someone's been idle when they're idle for longer than 25 minutes, because people will come into Teamspeak but then leave their computer so people sometimes come into a channel with 4 others but nobody is really there.

I wrote it in 2 other languages, but they crapped out and stopped working, and I didn't wanna fix those. Python seems like the best option.
>>
>>55302099
Go read the read(2) manpage, or turn on all warnings.
>>
What's a good place to read up on type theory
>>
>>55302850
https://www.cs.indiana.edu/~sabry/papers/rational.pdf
>>
>>55296311
>picture for ants
Is it the journal thing?
>>
>>55302179
xddd
>>
Did well on my interviews today!!

problems
- find median of stream of numbers

- list of mines with given x and y coordinates and r, blast radius
find the largest impact (amount of mines)

keep track of k highest number in linear time

given 2d matrix, location points, and 2d box coordinates within, find the location points within the 2d box coordinates.

Goodluck! /g/ helped me. thanks for being there.
>>
>>55303156
Congrats.
>>
This may be a stupid question but I want to avoid a really dumb error.
So Im using a lib that declares an array of bytes.
>BYTE* bits;

I know a byte is 8 bits. But how do I make sure the lib doesnt have some dumb definition and the size of a BYTE is different depending on the machine or something.
I know this is probably a stupid concern but I just want to make sure.
Is there a way to get the the size of in bits. Like ask how many bits are in this type.
>>
>>55303221
Bytes are 12 bits. You are wrong.
>>
>>55303221
sizeof(BYTE)
number of bytes in BYTE

CHAR_BIT
number of bits in a byte
>>
>>55303221
bytes are 7 bits actually
Thread replies: 255
Thread images: 21

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.