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

/dpt/ - Daily Programming Thread

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

Thread replies: 320
Thread images: 18

File: timetocode.webm (2MB, 1152x648px) Image search: [Google]
timetocode.webm
2MB, 1152x648px
This is /dpt/, the best subreddit of /g/

In this thread:
r/programming
r/compsci
r/ReverseEngineering
r/softwaredevelopment

/!\ ** Read this before asking questions ** /!\

http://mattgemmell.com/what-have-you-tried/
http://www.catb.org/~esr/faqs/smart-questions.html


What are you working on ?
>>
First for anime rules /dpt/
>>
File: indians5.png (44KB, 753x772px) Image search: [Google]
indians5.png
44KB, 753x772px
>>56952169
nth for data warehousing and ETL software
>>
File: akari~~!.gif (1017KB, 471x265px) Image search: [Google]
akari~~!.gif
1017KB, 471x265px
second for akari-bbs!
>>
>>56952112
now phpmyadmin is telling me

#1045 Cannot log in to the MySQL server

what do
>>
>>56952196
kek
>>
>>56952205
Consider supplying the correct credentials.
>>
>>56952205
nm i got it, i needed to enter root as the username

i just fucked with a lot of files needlessly though so hopefully i didn't break anything
>>
gimme so ideas
Im an bored econ student in holidays
>>56952187
>>
atomic_fetch_add_explicit(&post_counter, 1, memory_order_relaxed)th for suicidal thoughts
>>
>>56952205
>>56952228
>>>/g/wdg/
>>
what the the most relevant language for artificial intelligence? I'd like to ask the same for viruses aswell.
>>
File: 729.gif (227KB, 600x600px) Image search: [Google]
729.gif
227KB, 600x600px
>Programming the semiconducting Jew
>>
>>56952252
Python, C
>>
>>56952252
C

C
>>
>>56952252
>what the the most relevant language for artificial intelligence?
All of the major languages are used in this field for various components.
>>
>>56952271
>>56952282
people still use C?
huh
>>
>>56952252
Ruby and Python and other very high level languages. Some functional are also pretty useful.
>heard that from a brazilian Sc.D. in Computer Science at an AI lecture or something.
>>
>>56952271
people still use python?
>>
>>56952291
>people still use C?
Kill yourself.
>>
>>56952337
>Kill yourself.
Kill yourself.

>>56952291
Unfortunately, C and other lower-level languages are going to be around for a while, because high-level languages can only go so far with performance-critical applications.
>>
File: 1412143057384.png (82KB, 420x248px) Image search: [Google]
1412143057384.png
82KB, 420x248px
Why does this run?

main("Hello World!"){int *char};
>>
>>56952380
>>56952337
I don't mean it as a insult, I just thought C has less demand nowadays, all my seniors in uni keep buzzing about Java, C# , python etc etc
>>
File: took ur jerbs.png (3KB, 173x114px) Image search: [Google]
took ur jerbs.png
3KB, 173x114px
>>56952405
Well, it does have less demand, but it's still got about the same amount of jobs as Python and C++.

Java is the job king, with C# in second.
>>
>>56952434
what about pay?
>>
>>56952454

Depends on work more than language
>>
>>56952252
ai is a big subject. you'll have to be more specific. usually the language is not the problem
>>
>>56952454
C has a very high pay average, primarily because the developers are often older boomers, and there are less C developers nowadays.

Make sure you do the research on your area or the area you plan to live for salaries and job availability.

In every case, salary depends on your experience and a myriad of other factors outside of the language you're using.
>>
>>56952291
Well, it's better than assembly, so yes.
>>
>>56952392
C or C++?
>>
>>56952519
>>56952490
thanks for input, will take it into account.

>>56952505
I would say what is used for the recent stuff like neural networks and machine learning.

>>56952540
I've been wondering this myself, should I just learn C as opposed to assembly for low level programming? I have a Basic C++ background.
>>
>>56952588
Well, assembly is what you want to learn if you know how a computer works, such as memory mapping and CPU registers. C is what you want to learn if you don't want to deal with all that
>>
Okay I don't know if it's the right place to ask but I really want to learn how to code and I don't know where to start. I've only messed around in Game Maker for a bit but I'm realizing now how limited it is and I think it would help me more if I learned from the basics.
The thing is there are so many languages and ressources and this is a little overwhelming.
I would like a language that will make my true skills shine as a programmer, not a dumbed down laguage for normies, you know.
And I don't wanna go to college.
What do I learn? Where do I learn it?
Bonus if I can get a career out of it but whatever
>>
>>56952638
hmmm, guess I'll bite the bullet then.
>>
>>56952642
I would recommend learning python first, it has clear and concise syntax and several features. You can learn at:
khanacademy.org
codecademy.com
learnpython.org
>>
I want to learn a functional programming language.

What's an "easy" language to begin with?
>>
Some styleguide question for opinions: Should I go and set the maximum stack size myself, when I need to make a really huge array as regular variable, oder should I just move that to the heap?

unsigned int[1000][1000] is apparently to big for the stack, which seems a bit odd to me, since 4 times unsigned int[500][500] works. Am I missing something?
>>
>>56952681
Python. Probably the easiest langauge for a beginner to pick up, or at least so I've found. Java and C# are also easy to learn, if you want to do web development, javascript
>>
>>56952716
>functional programming language
>>
>>56952729
C, C++, Java, Assembly, COBOL, FORTRAN
>>
>>56952754
>functional
>>
>>56952710
Why do you need a 2D array with 10<exp>8</exp> space?
>>
Is there any special reason to use this->member in class functions in C++? As I see I get the same results if I simply just call the member by its name.

Also, why do I find codes where the author puts the return statement at the end of a void? What's the purpose?
>>
>>56952588
machine learning i know a little bit more about. my opinion is that a lot of it is just a sexy repackaging of statistics. it still depends a lot on where you are and what you want out of it

if you're just getting started i think you use whatever language matches a guide you find appealing. you need to learn some (easy, if you aren't proving anything about it) math and you need just the right amount of data to play around with

this looks like a decent introduction (i've read a related book) which also tells you about r. andrew ng's course is available freely and i think he uses octave

http://www-bcf.usc.edu/~gareth/ISL/
>>
>>56952789

I don't know C++ but, you would want a void to return a 0 or a 1 to see if the method completed with or without errors on compilation.
>>
>>56952681
Try scheme, it's good coz it rhymes with meme.
>>
>>56952816
then you might want change method type from void to your_own_custom_error_handling_enum_t and then it's good.
>>
>>56952781
Currently to count ocurrences, like a histogram.
Unsigned short is not enough per bin.

It's also not sparse enough to really be sure I don't end up with more space needed if I tweak it.
>>
>>56952892
just go with the heap
>>
>>56952789
> this->member
dereferences a data type from inside of a struct if it's a pointer to a struct. Equal to (*struct_name).member
> return statement at end of a void
Return doesn't need to return anything, it can just return control to the main loop of a program, this is usually the purpose in a void function
>>
>>56952906
yeah, probably the best.
>>
>>56952892
What language are you using? If java I recommend using ArrayLists or HashMaps fro java.util. Otherwise, make your own ADT to hold it. Arrays aren't meant to have 1000 members
>>
>>56952958
I'm on C.

I'm currently contemplating using a std::vector
>>
>>56952968
C doesn't have a vector header, you'll have to make your own ADT for it.
>>
>>56952980
>C doesn't have a vector header
damn, forgot that's ++ already.
>>
>>56952768
> functional
well, it does have functions, so it's technically a "functional" paradigm
>>
Should I focus on Android or IOS development?
>>
>>56953079
iOS.
Android a shit.
>>
>>56953079
I'm currently looking at Apple development (macOS and iOS) through a Hackintosh. Sounds easy enough and makes for a fairly quick buck, though I believe it costs about $100 to register for the store.
>>
>>56953120
Yes, and you renew each year
>>
doing a LONDON 4-directions string function.

void quadString(const char* str) {

cout << str << endl;

for (int i=1;i<strlen(str)-1;i++) {
cout << str[i];
for (int j=0;j<strlen(str)-2;j++) cout << " ";
cout << str[strlen(str)-i-1];
cout << endl;
}

for (int i=strlen(str)-1;i>=0;i--) cout << str[i];
cout << endl;
}



main

int main() {
cout << "Enter Word\n";
char str[20];
int i= 0;
cin >> str;
str[strlen(str)]='\0';

quadString(str);

return 0;
}


LONDON
O O
N D
D N
O O
NODNOL
>>
>>56953083
>>56953120
Looks like the developer will make more money focusing on the Ios platform. So I guess that's a good pick.

So I should learn swift?
>>
>>56953157
fucked up formatting

LONDON
O O
N D
D N
O O
NODNOL

>>
>>56953176
make a union jack out of it
>>
>>56952681
F# is probably the easiest "functional-first" programming language.

Bonus points for transferable skills of general .NET dev.
>>
File: Panic_(large).jpg (18KB, 248x248px) Image search: [Google]
Panic_(large).jpg
18KB, 248x248px
>decide to dick around with node.js
>start making a shitpost generator
>mfw node start shitting "Cannot read property 'replace' of undefined" on my regexp for no reason
>mfw it stop doing that without me touching the code
>mfw it's doing it again after an hour of tranquility
I don't know anymore and at this rate the problem will go away before i find the solution.
>>
File: Soul_Twisting_(large).jpg (17KB, 248x248px) Image search: [Google]
Soul_Twisting_(large).jpg
17KB, 248x248px
>>56953268
>problem is gone
>>
defer makenewthread()
>>
>>56953157
At least you tried.
>>
Learning assembly, and it seems like you can't add a constant directly to a byte in the registry, even though you can load one directly. How come? There's addi, but that still requires a second registry entry.
>>
>>56953309
have you tried something like
add al, byte 88

compiles just fine in fasm and works like a charm
>>
>>56953309
It depends on the architecture. It's whatever the designer thought was a good tradeoff. You can however, write things called macros to define pseudo instructions and fill out the pieces you find missing.
>>
>>56953337
Doesn't compile.
>>56953342
Alright. I'm doing it for a microcomputer course so maybe that had something in mind there
>>
>>56952454

iirc Ruby developers are paid the most out of the bunch, followed by python,c++
>>
>>56953303
whats wrong with it?
>>
>>56953309
>>56953337
mov eax, 1
add al, 0ffh

in this case al will wrap around and set carry flag, so eax will be 0 instead of 100h
if you use eax, it will be treated like a dword
>>56953402
what compiler? what cpu architecture?
>>
dark vs light theme
>>
>>56953420
Only works for a subset of ascii.
>>
>>56953424
>what compiler?
Atmel Studio
>what cpu architecture?
I'm not sure. It's this mc one http://www.atmel.com/devices/atmega328p.aspx
>>
Do you think if Reddit used Elo (or something similar that doesn't give the same weight to every votes) content would be more relevant?
>>
>>56953501
No.
>>
Oh god every time I get a technical interview I bomb so fucking hard it's not even funny. Why the hell wasn't I taught this shit in school?
>>
>>56953442
tell me where it doesnt work?
>>
>>56953525
バカなの?
>>
>>56953484
oh, no wonder it doesn't work, I pasted a x86 code snippet
I haven't tried avr asm.

but looking here http://www.atmel.com/Images/Atmel-0856-AVR-Instruction-Set-Manual.pdf you can see ADDIW instruction that adds a six bit number to a register pair

try using LDI to load that constant to one register and then add that register to your other register. it takes more cycles, but in the end you get what you wanted. http://www.atmel.com/webdoc/avrassembler/avrassembler.wb_LDI.html
>>
>>56953516
>college was supposed to teach me how to be a developer

I've got bad news, anon. You were supposed to learn the technical details on your own time.
>>
>>56952805
I would say he should go with a language that has the most learning resources available for machine learning, now that's python by a huge margin
>>
>>56952221
i lol'd
>>
>>56953612
well, fuck
>>
>>56953596
>try using LDI to load that constant to one register and then add that register to your other register.
Yea, that's what I figured. Seemed a byte wasteful to use a spot in the register just for simple addition, though.
>>
>>56953484
Ahh AVR. Refreshingly simple architecture. You want to do subi and subtract the negative of the immediate you want to add.
>>
>>56953703
lol ofc
>>
What is the best way to rank user generated content and why?

>Time based (Futaba style)
>Voting (Reddit)
>Weighted voting (Leddit with Elo or any sorting algorithm)
>Graph (Twitter and Facebook)
>Popularity (number of answers or number of views)
>Derivative of popularity (relative to itself)
>Google style (push content on the top for a short timeframe and monitor user interest)
>Random
>>
>>56953846
(you)
>>
Here was my project of today. A page that plays random /wsg/ webms infinitely. Space bar skips.

http://78.108.50.220/

I just now updated it with play history.

Source:
https://github.com/Booom3/Random-Wsg-Webm
>>
>>56953863 (Too)
>>
>>56953516
what is it that you're bombing in the interview?
>>
>>56953846
Mix of google style and popularity. "See what sticks" + content that was proven to be sought after > le downboat squad deciding that they don't like the content.
>>
>>56953516
have you looked at some of the interview books? maybe it's just a racket but they seem to help people i know
>>
>>56953874
Everything. Literally everything.

Maybe things would work better if I just specialized in a single language since every job I apply to asks very language-specific questions that I can't answer becuase I just don't fucking know what they call a static variable or abstract class in every goddamn language

I wonder whether I should learn Django or one of a million javascript APIs since there only seem to be web dev jobs anyway
>>
File: VID_20161006_212124030.webm (3MB, 1280x720px) Image search: [Google]
VID_20161006_212124030.webm
3MB, 1280x720px
>>
>>56952200
When are you changing the color palette again?
>>
File: 2de.png (1MB, 673x435px) Image search: [Google]
2de.png
1MB, 673x435px
>>56953268
>>56953288
>tfw you will never play a panic mesmer again
>>
>>56952252
Scheme.
>>
>>56953911
Pretty much what I thought. The algorithm I use sort according to "the average posted time of every answers"

>New contents are always on top
>Popular contents stay on top if
>Unpopular contents require less posts to rank up
>>
>>56953956
Do you actually know the language for the job you're applying for?
>>
>>56954132
Yeah, but not as well as I thought I did apparently. The questions they're asking seem really obscure and language-specific
>>
File: 1445163783391.jpg (194KB, 931x1398px) Image search: [Google]
1445163783391.jpg
194KB, 931x1398px
Can I use this for learning Scheme?
>>
>>56954196
Like what?

I'm curious, because I might move horizontally into a straight dev role from my BI role.
>>
>>56954228
For example, they asked me the difference between a String, String Buffer and String Builder in Java. I knew the first two, but I've never even heard of the third one
>>
>>56954210
https://ds26gte.github.io/tyscheme/
>>
>>56953215

void unionJack( char* str) {
char empt[strlen(str)] = " ";
cout << str << endl;

for (int i=1;i<strlen(str)-1;i++) {
empt[i]=str[i];
empt[strlen(str)-i-1]=str[strlen(str)-i-1];
cout << empt;
cout << endl;

for (int i=0;i<strlen(str);i++) empt[i] = ' ';
}
cout << str << endl;
}


LONDON
O O
ND
ND
O O
LONDON



on some long words the upper right letter is missing

VERYLONGWORD
E
R O
Y W
L G
ON
ON
L G
Y W
R O
E R
VERYLONGWORD

>>
>>56954306
VERYLONGWORD
E R
R O
Y W
L G
ON
ON
L G
Y W
R O
E R
VERYLONGWORD
>>
>>56954306
You are missing a R >>56954339
>>
>>56954306
>
VERYLONGWORD
E R
R O
Y W
L G
ON
ON
L G
W
R O
E R
VERYLONGWORD

I fixed it for you.
>>
>>56954261
StringBuilder comes up later on in Java but not too much later. My buddy is using it a lot for his ciphers-something class, can't remember what, but it's a thing you should know. I think he said he learned it in his second class after his intro.

(responded to wrong anon)
>>
>>56954339
>>56954354
>>56954368

code]
SOMETHINGHAPPENED
O
M N
E E
T P
H P
I A
N H
G
N H
I A
H P
T P
E E
M N
O E
SOMETHINGHAPPENED

[/code]

ICANTWAKEUP
C
A E
N K
T A
W
T A
N K
A E
C U
ICANTWAKEUP

>>
>>56953868
Any way to skip on mobile?
>>
>>56954392
god dammit

SOMETHINGHAPPENED
O
M N
E E
T P
H P
I A
N H
G
N H
I A
H P
T P
E E
M N
O E
SOMETHINGHAPPENED

>>
>>56954385
Second class? I graduated from college months ago
>>
>>56954433
wew
>>
>>56952980
ADT?
>>
>>56954399
I added a skip button just now, refresh the page for it. Suggestions for a better way to skip on mobile are appreciated, preferably with a short snippet because I'm not good with web design.
>>
>>56954410
Well, why don't you fix it?
>>
File: output.webm (501KB, 600x600px) Image search: [Google]
output.webm
501KB, 600x600px
Playing with Processing.
Here's a dumb flock.
>>
>>56954540
still smarter than le reddit average user
>>
>>56954520
i did anon, i did

char empt[strlen(str)];
for (int i=0;i<strlen(str);i++) empt[i] = ' ';


instead of
char empt[strlen(str)] = "      ";
>>
>>56954453
abstract data type
>>
>>56953846
The issue with many if these is that they don't respect the temporal aspect of information and entertainment. Futaba+rating based archive is the most superior.
>>
>>56954540
is it just random directions?
>>
>>56954699
No. There are 3 rules:
1. they tend to the average direction of the flock;
2. they try to avoid each other as to prevent overcrowding; and
3. they tend to stick together in lumps.

This is only very basic code and the parameters aren't fine-tuned, so it looks more random than anything. For a good example, see this: https://www.youtube.com/watch?v=QbUPfMXXQIY
>>
>>56954632
Thanks.
>>
Why are entry level jobs so hard to find in new york?
>>
>>56954759
thank you for sharing
>>
>>56954838
You're just not competitive enough. Sorry that your life doesn't add anything necessary to the evolution of the human specie.
>>
>>56954838
Shitty bait. I mean who the hell would fall for "oh geez New York is a hell hole and I didn't know it".
>>
How do i average 2 ints in c?
>>
>>56954934
(a+b)/2. Andy other answer is not idiomatic C.
>>
I want to build a REST API backend for my app.
What are some good languages/frameworks to use?

I was thinking of something in python or RoR.
>>
>>56954980
Don't fell for the REST meme. It's a multidimensional time-sucking black hole.
>>
Anyone familiar with windows programming? Trying to use C to open up a com port and write to it. CreateFile keeps throwing me error 2 which apparently means it cant find the file/port I'm trying to open. My USB serial device is COM3 which is what I have for the file in CreateFile. I've also tried \\.\COM3 which some suggested online. Still no change. Anyone have an idea?
>>
>>56955038
Isn't REST just basically a design pattern?
What would you recommend instead?
>>
>>56955044
WinAPI is notoriously horrible.
>>
>>56955064
something something udp
>>
>>56955064
do it in python flask, easiest shit
>>
>>56955076
I know, and I'm actually more at home in the linux programming environment. I'm doing this on windows begrudgingly.
>>
>>56952588
assembly <<< gap >>> other languages including C

C is not low level
>>
>>56954980
I've been messing around with go lately and it seems pretty nice. At least for setting up basic REST APIs. I still haven't found solutions I like for some things though (persistent storage), so it depends on what your REST API needs to be able to do.
>>
if (p)
{
whatevs
}
>>
>>56955170
I'll check it out.

I just need some basic auth, and for users to create resources. Nothing too fancy.
>>
>>56955190
It doesn't really matter if p or not my dude. Just do your thing man.
>>
>>56955190
Triggered my autism

if (p) {
whatevs
}
>>
>>56955153
What is in this arbitrarily made gap of yours?
Syntax differences? Lmao
You can do low level programming directly in C
>>
>>56955232
???
just learn what assembly is instead of posting.
>>
>>56955204
if (p)
whatevs
>>
>>56955204
That triggers my autism
if (p)
{
whatevs
}
>>
>>56955255
Not him but I mean you can do AND OR NOT XOR and bit shifting in C. Isn't that at least fairly low level?
>>
>>56955270
>>56955259
You're the reason why I can't sleep properly

if (p) whatevs;
>>
>>56955272
You can do that in java as well

>A high-level language is a programming language such as C, FORTRAN, or Pascal that enables a programmer to write programs that are more or less independent of a particular type of computer. Such languages are considered high-level because they are closer to human languages and further from machine languages. In contrast, assembly languages are considered low-level because they are very close to machine languages

let's not get too worked up over what 'low level' and 'high level' language means
>>
A language is low-level if and only if you can access and modify arbitrary memory addresses.
>>
>>56955300
Anyone get Shenzhen I/O?
>>
>>56955360
So pointers are low level?
>>
>>56954934
a + b >> 1
>>
>>56955283
How about
p ? whatevs : p;

or even
p && whatevs;

which is totally valid C.
>>
File: 1460540055313.jpg (42KB, 500x441px) Image search: [Google]
1460540055313.jpg
42KB, 500x441px
why dpt i'm shit at programming, i'm working on a project in python currently and I want to be able to ask the user to enter 3 numbers and the type of operation requested. And after googling for a bit I still have no clue how to do it.
>>
>>56955406
>And after googling for a bit I still have no clue how to do it.
1. a switch
>>
>>56955406
well*, also pls help
>>
File: bios_hack_01.jpg (2MB, 2352x1568px) Image search: [Google]
bios_hack_01.jpg
2MB, 2352x1568px
I wonder if /dpt/ can help me crack the password to this bios.

I'm attempting to use an Arduino Uno to brute force a bios password. roughly following this project:

http://www.alfersoft.com.ar/blog/2011/11/14/brute-force-attack-a-bios-with-arduino/

I'm much better with the circuits than I am with the code.

Would some /dpt/ anon be able to point me to where I've gone wrong?
>>
>>56955076
I don't have a ton of experience with it, what's horrible about it?
I assume the problems are caused by backwards compatibility.
>>
>>56955406
Here's a really simple way to do it:
n1, n2, n3, operation = 0
n1 = input("number 1 ")
n2 = input("number 2 ")
n3 = input("number 3 ")
operation = input("operation ")
if operation == "+":
print(n1 + n2 + n3)


Yes, there are better ways to do it and I'm aware.
>>
>>56952716
>JavaScript
ecks dee

JS is a clusterfuck of shit. PHP and then looking into doing important things surrounding that with javascript is fine, but using 'vanilla' JS and the frameworks/libraries that cropped up the last year or so is appalling.

Also they fall as soon as they rise.
>>
>>56955500
Actually, do operation = ""
I messed up.
>>
>>56955420
Switches are noob traps.
>>
>>56955044
You've taken into account the fact that '\' characters need to be escaped, right?
>>
>>56955524
They're essential for beginners to start to understand logic flow.

Anything can be abused though, it's not really exclusive to switches.
>>
>>56955524
>>56955556

Why so? Would this not be fine in python?

switch operation:
case "+":
doAddition(a, b, c)
break
case "-":
doSubtraction(a, b, c)
break
default:
throwOpError(operation)
break

>>
>>56955618
it would be

if only python have switch statement
>>
>>56955362
Didn't mean to reply
>>
>>56955618
[...] break[...] break [...] break
>>
I'm almost done with this Java assignment but I have a problem in a do-while loop.

do

{

//lots of shit here

System.out.println("repeat?");
response = scan.nextLine();
}
while (response.equals("yes"));


When I run it and type in yes at the end it doesn't repeat the loop. What am I doing wrong.

also first time posting on /g/, not sure if I got the code thing right
>>
>>56955636
banter lad...

Don't really know python that well and I went from dong PHP web stuff to doing software dev written in BCPL for work.. So I have very much gone back in time.

I need to get back in touch with a modern language.

Python, Java or C#? Or something else?
>>
>>56953625
do you know of a complete course/book that would take him through using, say, scipy for this sort of thing?
also i don't want to openly suggest python for something here
>>
>>56955672
This will be your first lesson in debugging.

After response = scan.nextLine();
print out the value of response.

Now you tell me why it doesn't repeat?

Next time you get stuck on something, do yourself a favor and learn about breakpoints.
>>
I'm writing my own key/value storage database written in Go.

- communication over TCP
- full in-memory
- periodically makes a backup (configurable periods) of the whole memory into a local json file
- will try to recover json backup on startup

Functions: has(key) / read(key) / write(key, value) / delete(key) / clear() / count()

always sent as JSON:

{method: "has", key: "test"}

will return

{has: true, error: null}

or

{method: "read", key: "test"}

will return (if exists and has value "memes")

{value: "memes", error: null}

and that's it.

What else could I implement?
>>
>>56955672
post more of it
>>
>>56955721
Passing in a nested array of keys/values?
A way to wildcard search for keys and/or values, returning amount of hits and/or those that were hit.
Sorting?
>>
>>56955752
Right now I can always only return one value by an explicit key. So you mean something like "search" and pass a regex, which then will return a collection?
>>
>>56955721
i became more aware of this rethinkdb thing because they're shutting down. you might try to figure out what it is people liked so much about it
>>
>>56955397
while (p--) whatevs;
>>
>>56955721
Make it ACID compliant.
>>
>>56955775
>rethinkdb
that was actually the starting impulse of letting me write this. Even if we have to keep in mind that I will probably never finish it.
But I will open-source it and post it here once it minimally works.
>>
>>56955712
I'm just learning now what breakpoints are, we haven't learned them yet. Where should I put a breakpoint?

>>56955724
here's the very end of the program, which is the part that's not working. I should also mention that I have no clue what the "Skips newline character is". Our instructor introduced it in the assignment. Maybe that's the problem.

       do
{
//this part is just calculating a hypothetical employee raise. It's a bit long to post everything

//Run the program again?
System.out.println("Process next employee salary and raise? Enter yes or no: ");
response = scan.nextLine();
System.out.println(response);

scan.skip("\n"); //Skips newline character

}
while (response.equals("yes")); //end do while
}

}
>>
>>56955804
thank you for the nice read. I never heard about that.
>>
>>56955803
damn, you got me
>>
>>56955721
why the fuck would anyone want to send decoded json strings over a socket? Just impelemt a rest api fucking granpa.
>>
>>56955805
cool. i would read it
>>
File: 180px-Yellowvan.gif (300KB, 180x138px) Image search: [Google]
180px-Yellowvan.gif
300KB, 180x138px
Noob concurrency question:

So if I need multiple concurrent parts of a program to all write (but not read) to the same file, what would be the best way to do this? Should I make them all pass data to a dedicated "write" thread, which exclusively will bounce around the file and write data in chunks? Or would it make more sense to maybe do something like memory mapping and then give the worker threads disjoint segments to work on at a time?
>>
>>56955554
From what I've read, I really shouldn't even need the '\'s. Apparently that's just for com ports over 9 (don't ask me, it seems to be a windows thing). But to be honest no I didn't know the \s needed to be closed. Can someone link me to what the slashes actually do? I'm a C and general programming beginner so no idea.
>>
>>56955830
You should still print response to see what it is. I think that maybe you used something like next or nextInt, so whatever the previous line was, \n still remains.
>>
>>56955889
'\' is used for escapes, so it ITSELF must be escaped if you wanted a literal slash, so "\\". link for further reading:

https://en.wikipedia.org/wiki/Escape_sequences_in_C
>>
>>56955947
Thanks mate!
>>
>>56955429
post some pastebin
>>
>>56955889
The \ (backslash) character is used to add special characters in a string (char*) constant, like the one you're feeding to CreateFile. For instance, if you want to add a newline character as a value in a char*, you can't just hit your Enter button because that's no longer valid C syntax, but you type '\n' instead.

When the compiler sees a \ in a char* constant it assumes you're trying to add a special character, so if you type in "\COM3", not only does it not actually add a backslash but it tries to escape '\C' as a special character. Basically, try it with "\\\\.\\COM3" because '\\' is the escape sequence for an actual, literal backslash character in a string.

I haven't used CreateFile to open a COM port, but it would be excessively odd for it to require different syntax based on the COM port number. Win32 is usually annoying as fuck to work with but not quite that retarded, but I don't know for sure. Just try "\\\\.\\COM3" as I've said.
>>
>>56955763
Effectively but doesn't have to start off as complex as regex, do some basic wildcard masks and such...

For instance, you have a key of name, 10 records.. Doing a search for "*an*" will find 'Dan', 'Brandon', 'Andrew'.
>>
I have a function that takes a function pointer to a callback functions as an argument.

The callback function i want to use happens be an object method, and this makes the compiler very complainy.

I don't know how to solve this. Halp?
>>
>>56956036
Sounds literally impossible unless you want to make your stack executable.
>>
>>56956036
>I have a function that takes a function pointer to a callback functions as an argument.
for what reason
>>
>>56956050
I don't know what this means.
>>
what's the point of variable length arrays in structs?
>>
>>56956066
An object method consists of two pointers: one to the function and one to the object. Since you cannot pass two pointers you have to store one pointer somewhere. This is on the stack. And then you have to dynamically create a function on the stack that calls uses those pointers. And then you pass the pointer to that function.
>>
>>56955885
writing data to a single file can not be sped up using concurrency on common file systems, as the disk write-speed generally is the limiting factor. on HDDs concurrent writes usually even reduce total write-speed for mechanical reasons.
>>
>>56956065
>for what reason
Does it matter?

The callback function is supposed to continuously provide audio data to fill the playback buffer..
>>
Why the fuck does gcc not default to the latest c standard?
>>
>>56956036
You shouldn't be using methods that way. I don't know how C++ or whatever language you're using handles the this variable, but I know some languages have it as a hidden parameter. Really no reason to use methods, just use static functions.
>>
>>56956072
being able to have your array have a different length for each use.
>>
Are there any text editor's that support the multi line editing you can do in visual studio? I think it's shift+alt and it lets you highlight based on column and line instead of just entire lines
>>
>>56956098
Sounds reasonable. But i'm not immediately seeing how to code this.
>>
>>56955982
Still the same error. But I think I kind of understand now. Is it almost like how Bash can recognize spaces in a file name but only if \ is in front of the space?

also just for the sake of being thorough.
hSerial = CreateFile(
"\\\\.\\COM3", GENERIC_READ|GENERIC_WRITE, 0, NULL,
OPEN_EXISTING, 0, NULL );
if (hSerial == INVALID_HANDLE_VALUE)
{
fprintf(stderr, "CreateFile failed with error %d.\n", GetLastError());
return 1;
}

here is the offending code.
And the windows thing I found here.
https://msdn.microsoft.com/en-us/library/windows/desktop/aa363858%28v=vs.85%29.aspx
its about 3/4 of the way down the page under the communications resources heading.
>>
>>56956127
because 99% of all existing makefiles would shit in your face if you do that. same as gcc also assumes std=c98 iirc.
>>
>>56956128
Static functions are yucky.
>>
>>56956133
A lot of them do. I know atom and sublime text do. I'm not sure about VScode.
>>
>>56956136
You don't unless you know a lot about assembly and related stuff. And you don't want your stack to be executable anyway.
>>
>>56956104
Speed is not the reason this program is set up that way. I of course realize the overhead.

>on HDDs concurrent writes usually even reduce total write-speed for mechanical reasons.

Essentially my writer thread would be jumping all over the file anyway, not much different from "concurrent" access, so is doing this concurrently throw MM slower or would it be about the same in terms of overhead?
>>
>>56956150
Well, you still haven't explained why you're using methods. What are you trying to achieve with function pointers?
>>
>>56956148
It apparently doesn't even use one of the standards. It's done Frankenstein of ANSI and c99
>>
>>56956130
why not just make the member a pointer to array and malloc?
>>
>>56956127
>>56956148
>>56956179
lots of implications here
>>
>>56956036
If the callback isn't static and you still need to use the object method, either overload said function so that you can pass the object instance (if you can edit that function), or pass a static method that can take an object instance so that the static method can call the object method.
>>
>>56955885
I would personally go and let each one write in temps and merge those into a new with a special thread occasionally. Would ensure that you always have a consistent file, even if you lost data.
>>
>>56956155
Isn't that kind of the same as wrapping the object in a function using a global object pointer though? But that's ugly code.

I'm also thinking i might capture the object in an anonymous lambda function and sending that as the callback function. Would that work?
>>
>>56956142
Typical windows-code-bullshit. The "CreateFile" function is typedef'd to either CreateFileA or CreateFileW, depending on msvc unicode setting at compile time, while the first parameter is fixed to char* in your code, when it should be wchar* if compiling with unicode support.
>>
>>56956196
>implications

Exactly. gcc implicitly picks one standard, so people who wanted said standard didn't explicitly state that version. So now if gcc changes it, it would break people's builds.
>>
>>56956221
If the function accepts only a function pointer then it won't accept a closure.
>>
>>56956229
But that's all wrong.

>>56956127
GCC6 defaults to gnu11 which is the latest C version supported by GCC.
>>56956148
GCC5 changed the default from gnu90 to gnu11 and nobody complained.
>>56956179
It's actually C11 plus GNU extensions.
>>
>>56956166
>What are you trying to achieve with function pointers?
>>56956107

And as for why i'm using methods: structuring my problem into objects just makes it easier to keep track of what the hell i'm doing with my code. Yes, i realise i'm probably oop damaged.
>>
>>56956236
fuck
>>
>>56956257
>nobody complained.

I'm sure somebody, somewhere did.
>>
>>56956268
Just pass in the object itself, let the callback function call whatever member function it needs to.
>>
>>56956355
That means i have to rewrite the object as a functor.
>>
>>56956160
You simply cannot open a file a second time with write-access on NTFS, (ex)fat, ext2/3... filesystems.

>Essentially my writer thread would be jumping all over the file anyway
Random access writes should not be done on files on disk. Even changing only one bit usually implies writing atleast the size of one block (multiple KiB) back to disk.
Instead, load the file completely into ram. Then you can modify it with multiple threads. Once you're done write it back to disk in one thread.
>>
>>56956355
it sounds like he doesn't have control over part of this setup
>>
Ok, guys, I'm going to try this out later, but I want to know if there's an easy way to fucking do this.

I have to take STRINGS (not arrays [and I KNOW it's a character array])
and concatenate them without duplicate data.

For instance:
str1 = "cat, dog; fox. Wolf"
str2 = "wolf, Lizardry Clinton, cat-dog, boat"
str3 = "boat, boat, Lizardry Clinton, fish;;;;; hamster"

Should return first:
"cat, dog; fox. Wolf, Lizardry Clinton, cat-dog, boat"
And THEN:
"cat, dog; fox. Wolf; Lizardry Clinton; cat-dog; boat; fish; hamster"

Now, the way I was thinking to approach this would be to take the concatenating string (str2, and then subsequently str3 on the next round) and find the indexes of any of the following:
/[\?\!\.;,]/

Does that look right?
And break that up and store it in a temp array, one word to an index?

Now, that's all well and good, but here's the catch:
It's an Excel macro, and it needs to be programmed in VBA.
So... Does VB have something like Vectors? Or will I have to go old-school and create a temp array and transfer everything over?
>Moreover, does VBA have a way to copy arrays, or will I have to reinvent that shit, too?
Or, is it possible to use the redim function to just increase the size without losing data?

Also, lastly, what's the best way to handle the indexes? Should I store the index of each delimiter in another array, or does VBA have a way to search FROM one point to another?
>I also ask this, because I can't really, off the top of my head, think of a way to search straight through for ANY of the symbols without storing the index somewhere... Because from what I can tell on the MSDN site (which suck dick beyond cock in explaining anything), it doesn't seem to support a RegEx search as an indexof() parameter.

Finally... Can anyone explain their implementation of RegEx? I can never get the global and case-insensitive modifiers to work, you know /(pattern)/gi. It doesn't even seem to work AT ALL if I use the slashes...

Thanks
>>
>>56956390
Actually, could i do this? Would this work?
>>
Does anybody have a good, achievable and progressive (in complexity and difficulty) list of challenges/programs to write?

Language specific or not language specific, I want something to work through and have lots of holiday left at work, might sit down for a week and try to learn something.
>>
>>56956473
1. fizzzbuzz
2. fizzbuzz
3. fizzbuzz
>>
>>56956473
Develop your own language.
>>
If you really love reddit so much OP I suggest you go and suck cock there and never come back here you piece of shit.
>>
>>56956495
1.fizz
2.buzz
3.fizzbuzz
4.buzzfizz
5.fizzbuzzfizz
6.buzzfizzfizzbuzz
7.fizzfizzbuzzfizzbuzzbuzzfizzboppfizz
>>
>>56956228
Ok, so I haven't had a whole lot of experience with typedef. So the windows function only accepts a specific variable type that needs to be typedefed as wchar?
>>
>>56956401
>You simply cannot open a file a second time with write-access on NTFS, (ex)fat, ext2/3... filesystems.

irrelevant here and not what I even wrote. You absolutely can share memory mapped files. That's kind of the point of them, generally.

> Even changing only one bit usually implies writing atleast the size of one block (multiple KiB) back to disk.

At no point did I say I would be making arbitrarily SIZED writes, only location. Think of the torrent protocol for a good analogy to my work load. I'd be buffering data and then writing in chunks. When those chunks are available though would not be easy to predict without.

>Instead, load the file completely into ram.
I'm WRITING, not reading. I want to save data as soon as possible for reliability sake, so as little data as possible is lost.

All I'm trying to understand is if writing my own caching scheme would really be more effective than memory mapping. The OS should already be buffering memory maps anyway to ensure that it wont block. I can just make sure to flush the buffer to disk once I'm done. If I had a single thread doing this, I would have to handle all these buffers manually. So if there is little overhead with memory mapping, it'd be much easier to do it that way.
>>
Am I weird if I actually like Python's whitespace? That and the lack of semicolons has completely spoiled me.
>>
File: 20161002_175247.jpg (2MB, 4128x2322px) Image search: [Google]
20161002_175247.jpg
2MB, 4128x2322px
>>56955975
Thanks anon, Here's some pastebin

http://pastebin.com/G1u1rJjj
>>
>>56956592
Pervert.
>>
So I want a function in C that is ran periodically

I do this with setitimer and a signal handler.
However, signal handlers are very limited in what you can do.

Would I have to use a separate thread for it to not be limited?
>>
File: Programmerpenis.png (1021KB, 3840x2160px) Image search: [Google]
Programmerpenis.png
1021KB, 3840x2160px
>>56956473
disregard the markings, I don't have the template at hand right now.
Choose something and go ahead.
>>
>>56956617
stop using C
>>
>>56956573
That or turn off unicode support when I compile? I don't really know how to do that but do you think it would help?
>>
Can anyone recommend me java books that guides you through professional/advanced projects?
>>
>>56956640
no
>>
>>56956573
>>56956643
For now just try doing it the very dirty way and replace the CreateFile call with CreateFileA and see if it works.
>>
>>56956599
Some more information.

I have managed to get the Arduino to detect as a keyboard, and if I flash the Virtualusbkeyboard program (that bioshack is derived from) to the arduino I can get it to output 'hello world' when the appropriate pin is shorted.

I also have got the LCD display working as it is meant to.

But the bioshack program doesn't seem to output anything.

Also, I could probably leave out the VGA sniffing part of the code if necessary. But I don't know enough about programming to be able to do that cleanly.
>>
>>56956617
Use timerfd.
>>
I'm really contemplating to write some interactive Boids for the holo lens right now.

too bad I won't get my hands on one to test it for a long time.
>>
>>56956626
Thank you Anon.

Some of these.. dafuq.
>>
>>56956672
Its still giving me the same error. Code for reference.
hSerial = CreateFileA(
"COM3", GENERIC_READ|GENERIC_WRITE, 0, NULL,
OPEN_EXISTING, 0, NULL );
if (hSerial == INVALID_HANDLE_VALUE)
{
fprintf(stderr, "CreateFile failed with error %d.\n", GetLastError());
return 1;
}

I also tried with the \\\\.\\COM3. Visual studios is fighting me right now so I'm actually compiling with gcc through cygwin. Do you think that could cause a problem?
>>
what's primitive recursion? my professor gave a bunch of examples of primitive recursion and i don't see how it's special. what's an example of non-primitive recursion?
>>
>>56956862
Is it possible its some kind of permissions issue? I am just running the executable from the cygwin command prompt.
>>
>>56956686
so I can use select() and have my process stop?
If I were to do that, then I would have to use a separate thread
>>
>>56956617
#include <stdio.h>
#include <signal.h>
#include <time.h>

void my_function(union sigval arg)
{
printf("%d\n", arg.sival_int);
}

int main()
{
timer_t timer;

struct sigevent se = {
.sigev_notify = SIGEV_THREAD,
.sigev_notify_attributes = NULL,
.sigev_notify_function = my_function,
.sigev_value = { .sival_int = 10 },
};

if (timer_create(CLOCK_MONOTONIC, &se, &timer) == -1) {
perror("");
return 1;
}

struct itimerspec its = {
.it_value = {
.tv_sec = 1,
.tv_nsec = 0,
},
.it_interval = its.it_value,
};

timer_settime(timer, 0, &its, NULL);

while (1) {
// Keep doing something else with the rest of your program
}
}
>>
>>56956862
No idea about cygwin since I barely used it at all, but I definitely wouldn't rule out the fact that it won't work with something Windows-specific like a COM port (serial devices are handled differently in Linux, there are no COM ports). I don't know exactly what cygwin does/how it works since I never needed it, but even things like regular file paths look different, don't they? Fuck knows how/if COM ports are handled.

Also, I think Windows treats COM ports as files, so maybe you can give fopen/fread/fwrite a shot too, although you'd obviously still need to use some Win32 functions to set it up (baud rate, parity, etc.).
>>
>>56956958
so POSIX clocks are the way to go?

aiight den
>>
>>56956862
>Tip : Try opening this file with fopen() since you are using the CRT...

Also is the file open someplace else ?
>>
>>56956587
now i understand. your best course of action depends on the target OS. on windows i assume a memory mapped file would be your best option, while on ext2/3 systems you generally could just store the chunks in separate files and then merge them with posix function calls or even gnu shell utils. merging files on ext2/3 this way wont modify disk contents (no additional read / write outside of file descriptors, which should be 1 or 2 ops at most).
>>
I've had to cut Java out of my job search since every time I interview the interviewer has a painfully thick indian accent that I can't understand a word of. That leaves me with python and js. That said, I don't have experience with django or angular, so what the fuck do I do now?
>>
>>56956859
Some of them read hard in the first place but are easy once you get a little hold of the topic. I'm serious.
>>
>>56957067
>That leaves me with python and js.
I think what you meant to say was that YOU have a thick indian accent, and the interviewer can't understand YOU. It's ok though, easy mistake for an ESL to make.

If you want to get hired try becoming useful.
>>
Making a cli/ auto downloader for a torrent site I visit
>>
>>56956984
Ok, so I got the project to compile in Visual Studios and the same error results. Despite that I may stick with Visual Studios just so I know I'm not making another problem. Going to try the the other file write functions. Also I got the COM3 nomenclature from the device manager. I actually just used dev/ttyUSB0 on linux.

>>56957028
I mean I honestly don't know where the file for serial port COM3 is. If its in use by something it certainly isn't me.
>>
>>56957054
I'd like it to target windows, OSX, and linux, although linux would be first class support (to be honest I'm not even sure I want to use memory mapped files because it requires MMU, which would restrict portability, but I digress). Even with Linux only I don't want to make assumptions based on filesystem (linux users could be writing on a fat partition for example).

I could store them as separate files temporarily, but this seems a bit impolite if I'm just working in the current directory. I suppose I could write to /tmp/ or .cache or w/e but still seems a bit gross. i would think that sparse files would operate fairly similarly to separate files if the fs supports those kinds of file joins, no?
>>
>>56956643
>>56956862

I am using this code in a live project targeting XP to 10:
pastebin.com/yZqGaFu9
>>
Hi guys, I have a question. Please take a look at this example.

// Function to compute the square root of a number

float squareRoot (float x)
{
const float epsilon = .00001;
float guess = 1.0;

while ( absoluteValue (guess * guess - x) >= epsilon )
guess = ( x / guess + guess ) / 2.0;
return guess;
}

int main (void)
{
printf ("squareRoot (2.0) = %f\n", squareRoot (2.0));
printf ("squareRoot (144.0) = %f\n", squareRoot (144.0));
printf ("squareRoot (17.5) = %f\n", squareRoot (17.5));

return 0;

Output:
squareRoot (2.0) = 1.414216
squareRoot (144.0) = 12.000000
squareRoot (17.5) = 4.183300



My question is what is epsilon standing for? Is it a limit on the precision of the number? If so, then why do the answers have 6 places after the point instead of 5 like epsilon(.00001) has? This condition confuses me as well. ( while ( absoluteValue (guess * guess - x) >= epsilon ) ) confuses me.
>>
>>56957172
>sparse files
I have no hands on experience with this. However sparse files are generally as much reliant on the underlying file system as is doing file merges based on the assumption of performance.
>>
>>56957172
and on another note, using /tmp would be the same as operating in ram, as /tmp usually is a tempfs (ram only).
>>
>>56957186
you basically reduce your guess as long as the square of your guess is further away from the number you entered than epsilon, it's your precision. guess2 - x should be zero and thereby smaller than epsilon when your guess is 100% correct.

"%f" goes with 6 digits per default, it doesn't care that your precision is lower.
>>
>>56957186
Error tolerance and how many decimals it needs to calculate.
If g=0.001, then sqrt(2) = 1.410000
If g=0.01 then sqrt(2) = 1.400000
You can't use g=0 because then your system is not prepared to handle decimals, all division results would need to be integers and that's simply not feasible on a system such as this one.
>>
>>56957263
Forgot to add, to reduce how many decimals get printed (not calculated, printed) use %xf, where x is how many digits you want on decimals.
%2f would be 1.41, %4f would be 1.4142, etc
>>
>>56953868
Could add some way to skip screamers (audio spikes near the end of file) no idea how this shit works but mite b interesting to implement
>>
>>56957279
>use %xf, where x is how many digits you want on decimals.
>%2f would be 1.41, %4f would be 1.4142, etc
That's slightly incorrect. %.2f will print to 2 decimal places.
%2f will just make sure that at least 2 characters are printed.
>>
>>56957279
for float its %.4f: %<n_before_decpoint>.<precision>f
>>
>>56957301
disregard <n_before_decpoint>
>>56957299
is correct.
>>
>>56957263
Thanks for the answer!

Question. Why is it a different answer with g=0.001 || g=0.01? C's limitations? Really interesting either way.
>>
>>56957244
Thanks for the answer man! Although, the first long sentence was kind of hard to read because of the lack of commas. I really do appreciate the answer tho.
>>
>>56957356
>Why is it a different answer with g=0.001 || g=0.01?
Because that is how the algorithm works: you get the square root up to a certain precision. Higher precision means more computation time though.
>>
>>56957394
So, to avoid mistakes in the future, I should always set my floats or doubles as accurate as possible to avoid the error that was just pointed out above? Sweet, I will keep that in mind. Thanks anon.
>>
Where would I begin for driver programming? I want to make custom drivers for Chinese drawing tablets.
>>
What would be considered best practice for passing a very large amount of variables that are essentially constants to threads? These variables are the exact same in every thread instance.
Seeing as I want to avoid collisions between the threads accessing these variables and all of them are accessing the same variables repeatedly, what should I do?

1.Pass a reference to a struct to the thread and then have the thread set its local fields from said struct, but this would cause memory overhead and wasted cycles assigning the variables.

2.Pass a new copy of said struct to the thread, which would have the same overhead and cycle issues

3.Pass a reference to a synchronized struct, which would allow all the threads to access it without collision.... which would result in the threads constantly fighting over get functions which would make it far slower than it has to be

wat do
>>
>>56957356
you stop searching for the correct solution earlier.
This has nothing to do with C's or computer limitations. setting g exactly to zero, however has to to with the limitations, due to how floats work. If you're at the lower end of float's precision, things get weird. Mathematical operations produce seemingly random results there and it's kind of luck to hit 0. Also, you can't store the exact value of sqrt(2) in a float.

>>56957381
Sorry mate, it's late here. Anyway, you're welcome.
>>
>>56957437
I would go with 2 if the number of accesses from inside the threads greatly outnumber the generation of new threads.
>>
>>56952681
Haskell :^]
>>
>>56957437
If they are constants do 3 obviously, and you wont need any synchronization.
>>
>>56957437
>very large amount of variables that are essentially constants
If they're immutable, why do you even need synchronisation?
You only need to protect shit that might change.
>>
>>56957420
It doesn't have to do with floating point error, just the tolerance for error in the output for the algorithm. Say you're trying to calculate the sqrt(2) and epsilon=0.001, the algorithm will terminate when it finds an approximation to sqrt(2), denoted 'x', such that sqrt(2)-x < epsilon.
>>
>>56957478
>>56957473
I was under the impression that if any two threads attempted to do anything at all to a variable or method at the exact same time (including reading it) that you would get a collision
>>
>>56957483
Rather, abs(sqrt(2)-x) < epsilon.
>>
>>56957496
>including reading it
Only if another thread is trying to write to it at the same time.
>>
>>56957437
Is concurrent access of constants really an issue? I mean, you don't have race conditions and it all has to go through the same memory buss anyway?

I think you should write a version of 2. and a version of 3. and measure if it actually makes a difference.
>>
>>56957544
second for this. I'm also curious.
>>
>>56957502
Huh
For some reason, I was always taught that with threading you had to be ~uber careful~ because accessing literally anything at the same time, even if you're just reading from it, will cause cause a crash.
Good to know, thanks anons

>>56957544
Wouldn't 2 be categorically slower as long as accessing never causes collisions?
>>
>>56957570
Even writing and reading at the same time doesn't necessarily cause a crash, as in nothing will explode if you do that, but the value you read may be in some invalid transitional state and you may essentially get garbage instead (which could cause your program to crash, depending on what it does).
>>
>>56957570
>Wouldn't 2 be categorically slower as long as accessing never causes collisions?
Dunno. Depends on how you handle initialization, i guess. But that should only be constant time overhead in any case, and you can account for that.
>>
>>56957615
>>56957615
>>56957615
>>56957615
>>56957615
>>
Retard here, could someone help me out?

public class ModuloPrint {

public ModuloPrint() {
for (int i=1;i<=70;i++) if (i % 5 == 0) System.out.print(" "+i);
System.out.println();
}

}


I want the printing to be able to take place anytime after the object is created, in a seperate class member. Meaning I want the modula loop working/caluclating by itself, and a seperate class member that can print the results of ModulaPrint. I know, the class names are retarded atm, gonna change it when I find a solution to my problem. Any help would be appreciated
>>
>>56957425
you will now begin by realizing that is almost impossible to write a driver without detailed hardware and interface documentation of your chinese tablets. also a good place to start is looking at driver source code if you target linux. for windows you should start at the msdn, but make sure to have enough hard drugs, alcohol and a strong rope ready.
>>
>>56957629
Call the member function?
>>
>>56957198

>However sparse files are generally as much reliant on the underlying file system as is doing file merges based on the assumption of performance.

Correct. But it was more inline with the politeness, which is why I brought it up. I would assume that where merges are efficient, so would sparse files be, as it seems they would rely on the same machinery. This is obviously not a guarantee, though.

Is there a general place to ask these sorts of specific implementation questions, apart from stack overflow?

>>56957228
Well it's configurable, but yes most distros use ram by default.

At this point I feel its better to implement one and then just test it to make sure it doesn't blow up significantly.
>>
>>56957814
>Is there a general place to ask these sorts of specific implementation questions
I'd try the IRC or mailinglist of the filesystem developers/maintainers, starting with ext4,ext3,ext2, well thats it. the rest is closed source, irrelevant or does no longer have active developers/communities.
>>
>>56957920
zfs? btrfs? HFS+? :^)
>>
>>56957941
if you are using zfs/btrfs on your home/torrent machine you probably have informed yourself well enough to understand how these fs should be used in such cases.
if you are using HFS+ and are arguing about FS performance your only chance to fix your shit would be a bullet to the head.
>>
>>56957755
No idea what you mean ¯\_(ツ)_/¯

Please, enlighten me
>>
>>56957629
Sounds suspiciously like
>do my homework for me

Also sounds like you want to read up on threads.

Also, a member is variable that belongs to a class or an object. A method is a function that belongs to a class or an object.
Thread posts: 320
Thread images: 18


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

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


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