[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: Ffffriday Night Muthafucka: edition

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: 338
Thread images: 46

File: Fffriday_f9ec44_1047727.jpg (81KB, 560x452px) Image search: [Google]
Fffriday_f9ec44_1047727.jpg
81KB, 560x452px
WAYWO?

Me
>consolidating my knowledge of statistical functions by writing a quick iPhone app to calculate expected outcomes with confidence intervals
>>
Masturbating and watching anime

>finished finals
>exhausted
>no motivation for anything

I eat, I beat my meat and I sleep
Haven't even showered this past week, fuck it
>>
File: pay for my healthcare.png (121KB, 500x323px) Image search: [Google]
pay for my healthcare.png
121KB, 500x323px
Daily reminder that C++ is the only worthwhile language besides Python.
>>
File: pp.png (72KB, 1366x768px) Image search: [Google]
pp.png
72KB, 1366x768px
Exokernel for ARM64.
>>
>>60224844
>Exokernel
for what purpose?
didn't tanenbaum admit that monolithic is the way to go?
>>
>>60224787
ha, i feel like that all the time
>>
>>60224855
look up "exokernel cheetah benchmarks"
>>
>>60224844
>ask me anything
what is it with this reddit tier OS?
>>
>>60224870
wtf why is it so good
>>
File: fig3.gif (12KB, 606x386px) Image search: [Google]
fig3.gif
12KB, 606x386px
>>60224896
forgot image
>>
File: indexer.png (434KB, 1026x906px) Image search: [Google]
indexer.png
434KB, 1026x906px
Fixing up and adding some more stuff to my indexer. Haven't spent any time working on it in months due to other work.
Nyaa dying gave me a couple hundred more hits so I figure its a good time to work on it.
>>
>>60224896
direct hardware access enables applications to perform direct optimizations (i.e configuring more ram for the igpu) thus getting more performance
>>60224871
where do you see AMA?
>>
>>60224910
I see, that's interesting. Do exokernels know how to do direct hardware access securely? Seems pretty insecure to let any executable access the hardware.
>>
>>60224938
security is a big concern yes, but ARM64 comes with different access levels for applications in order to specify which applications are trustworthy enough to do such kind of access. You can enable your 3D shooter game to send direct commands to the Mali GPU but also restrict your shady street shitter made battery app (though all this happens automatically on android for ex).

The exokernel's job is to basically prevent intrusions and prevent race conditions (multiple apps trying to access the same file sector for ex). It does no abstractions or hiding beyond that like other OS's do thus allowing room for good optimizations (like allowing the Cheetah server to access file sectors directly bumping the perf so much)
>>
>>60224833
>python and C++
What twisted mind would argue for these two?
>>
>>60224980
Thanks for the details.
How does memory management work with exokernels?
Can't a program running on an exokernel modify it's own page table?

So does an exokernel need virtual memory at all?
>>
File: 1489572404064.webm (596KB, 224x400px) Image search: [Google]
1489572404064.webm
596KB, 224x400px
>>60224787
WHAT ARE YOU:
>EATAN
peanut butter on toast
>DRINKAN
chinese green tea
>WORKAN
powering through a C# book because I'm a pajeet level slav who wants to have a well paying code monkey job
>LISTENAN
just having dexter in the background, the last few episoded are pretty shitty
>WATCHAN
same as listenan
>FAPPAN
nothing, just broke up with gf of 4 years, dick refuses blood transfusions
>FEELAN
kinda sad, but hopeful for the future
>>
>>60225020
On the hardware level, virtual memory is enabled but no abstractions like processes, threads or buffers declared so the OS layer is free to define these (or the applications to override their own address space allowed), but you still need permission from the kernel to modify other address spaces. Yes you can modify your own address space as a process for ex but not the other ones, message passing and shared memory are possible and potentially faster though
>>
>>60225030
> just broke up with gf of 4 years
You okay anon? Need anything?
>>
Learning Scheme.
Currently in SICP/1.3
>>
>>60225058
are you offering yourself as his new gf?
>>
>>60225058
I just want some distractions from the feels.

Can anyone suggest really simple stupid projects for C# I can practice with? I need something
>>
Ive used c++ libraries before but cannot someone explain to me how to make one. having a hard time getting it to compile and do what I want.
Say I have an OOP with a driver. Can I just compile that as a library or do I have to delete the main function. Are there restrictions to how the code can be made so is it fine if I can access what I need in the header files.
Do the header files need to be in the same relative location as they were in before compiling the library.
>>
>>60225219
Write a Monty Hall problem simulation.
>>
>>60224787
Some shitty JSON compressor/store

One of the data sources I use a lot can occasionally throw back GB or so of JSON, and my laptop was not very happy with it.
>>
(Java)
Where did I fuck up? What I need to do is to use the methods that are in taskTemp (wich is an instance of the class RunnableTask) but the two last method can not be resolved.

public void runTask(@RequestBody Task task)
throws ClassNotFoundException, IllegalAccessException, InstantiationException {
Class<?> runnableTask = Class.forName(task.getRunnableClassName());
Object taskTemp = runnableTask.newInstance();
taskTemp.setParameters(task.getTaskParameters());
taskTemp.runTask();
}
>>
File: c propoganda.jpg (2MB, 2000x2610px) Image search: [Google]
c propoganda.jpg
2MB, 2000x2610px
RUST 1.17
>>
Is it much harder to implement a suffix tree with Ukkonen's algorithm than if I were to use a less complex but slower algorithm to construct the suffix tree?

I've been looking for implementations that don't use Ukkonen's but they're few and far between.
>>
File: suomi.png (10KB, 683x601px) Image search: [Google]
suomi.png
10KB, 683x601px
>>60225332
>Ukkonen
Torilla tavataan
>>
>>60225219
Learntris and Chip-8 emulator are my go-to projects to practice a new language.
>>
>>60224827
Sounds like my ideal lifestyle
>>
File: cb945117a03b0ca352a32eb716222f00.jpg (576KB, 1920x1080px) Image search: [Google]
cb945117a03b0ca352a32eb716222f00.jpg
576KB, 1920x1080px
>>60225280
>>60225395
Appreciate it, /g/entlemen. You are really helping a brother out.
>>
I have a math question if anyone is willing to help.
How would I get angle and speed from dx and dy vectors?
(example) I know my dx movement is 2 and my dy movement is 1.
Is it my punishment for skipping Physics?
>>
>>60225058
plz be my a.i gf
>>
>>60225657
Pythagoras for distance and acos(dx/distance) for angle if my memory serves me right (I'm on the shitter and can't be assed to Google it for you)
And obviously distance/time for speed

Alternatively I recommend khan academy
>>
>>60225332
S U O M I M A I N I T T U
U
O
M
I

M
A
I
N
I
T
T
U
>>
>>60224787
I don't know what to do. I wanna code.
>>
>>60226947
code something that you think will be useful to you.
>>
File: 1336924583670.jpg (68KB, 300x300px) Image search: [Google]
1336924583670.jpg
68KB, 300x300px
Let's say we have two arrays in C
char n[30] = {'+', '4', '3', 'X'}; // + 34
char m[30] = {'-', '8', '1', 'X'}; // - 18
sum(m, n);

And I want to sum them manually so the result equals 16. What can I do?
>>
>>60226947
story of my life
>>
>>60227001
Before anyone asking: yes, it needs to be this impractical.
>>
>>60225096
No, are you looking for one?
>>60225219
Sorry mate I never touched it. Usually in cases like that I try picking up a new language.
>>60225982
I'm flattered, but I'm not sure I qualify
>>
redpill me on java anons, i need it
>>
Is 22 too late to start learning to code anons?
I know really basic html and css but thats it
>>
>>60227057
Yes, you're too old. It's better to just give up.

Too late for you grandpa.
>>
>>60227057
no,as long as you have a functioning brain, its never too late. there are 60 year olds who retire and become great painters.

you've just got to be motivated and determined to progress.
>>
xcode is a quality IDE
>>
>>60227001
What does 'X' do?
>>
>>60227291
It's a stop signal to ignore everything after X, including itself.

It would be used correctly if I filled the array with a loop, but I wanted to simplify the example.
>>
>>60227001
Convert the numbers to integers and multiply and add them up so they are in the correct order. If the first element is -, multiply that number by -1. After that you can just sum those two numbers.
>>
>>60227475
Thanks, I'll try it out.
>>
File: 1492600215869.jpg (117KB, 1280x720px) Image search: [Google]
1492600215869.jpg
117KB, 1280x720px
Daily programming challenge: given an arrray x, find all unique elements which, added, are y.
For example with:
x = [1, 2, 3, 4, 5, 7]
y = 8
It should output:
1, 3, 4
1, 7
3, 5
>>
Using swift because i have to

I want to pass values from some UI elements to a calculate function. it's all just numbers, and text converted to numbers, plus a slider.

how do I do this without having each IBAction holding it's own copy of the variables (this cannot be the correct way to do it)
>>
>>60228369
>Using swift because i have to
do they make you wear a leather gimp suit too?
>>
File: rustism.jpg (43KB, 875x304px) Image search: [Google]
rustism.jpg
43KB, 875x304px
Rust is autism
fn main()
{
use std::io::{stdout, Write};
let stdout = stdout();
let mut out = stdout.lock();
let mut buf = String::new();
for input in std::env::args().skip(1) {
buf.clear();
buf.push_str("(((");
buf.push_str(&input);
buf.push_str(")))");
buf.push(' ');
out.write_all(buf.as_bytes()).unwrap();
}
out.write(b"\n").unwrap();
}
>>
>>60228410
yes mate, why'd you have to bring it up?
>>
>>60228458
I wear mine by choice, that is the difference between you and I.
>>
File: dpt.jpg (36KB, 544x337px) Image search: [Google]
dpt.jpg
36KB, 544x337px
>>60228330
Posting a modified version to my attempt at this week's similar leddit challenge. Output is :

[1, 3, 4]
[1, 2, 5]
[3, 5]
[1, 7]
>>
Is live code editing useful or useless for you people? I'm sure most would like the option but how often do you actually find a use for it?
>>
>>60228330
Isnt this just an O(n^2). Is there faster way to do it. Not gonna code it, but you just iterate through the array for all elements the follow after the element and see if they add to y.
Though since the array shrinks each time is it log n. Been way too long.
>>
>>60228602
This is so disgusting.
>>
File: screen.1493996697.png (19KB, 698x653px) Image search: [Google]
screen.1493996697.png
19KB, 698x653px
>>60228330
output =
[1,3,4]
[1,2,5]
[3,5]
[1,7]
>>
>>60228900
Language? Looks like Java...
>>
Would it be wrong if I closed a github issue from someone that clearly didn't follow the install instructions with the message "rtfm"?
>>
>>60228969
C#.

Also I just googled it.

http://stackoverflow.com/questions/10738926/efficient-algorithm-to-find-a-combination-which-summation-is-equal-to-a-known-n

Post a programming challenge that can't be google'd and maybe then I'll feel like trying
>>
>>60228989
What happened when he didn't follow install instructions?
>>
>>60229007
well, he hadn't set the config location, so the program KeyError'd when it tried to look for a setting, with the message "Setting not found"
>>
N N
e e
i
e e
N N
>>
Is there any site that offers problems for java? Like for practicing, i want some oop, data structures, patterns problems, just to practice
>>
>>60229030
Provide default config and default config location then.
>>
>>60229048
Something something poo in loo
>>
>>60228330
You have to explain further. Is every element in X unique. Makes a HUGE difference in the algorithm.
>>
File: 1440372343909.gif (153KB, 255x224px) Image search: [Google]
1440372343909.gif
153KB, 255x224px
>>60224844
>assembly in eclipse
>>
>>60229116
Can't provide default config, it flat out won't work unless the config is exactly right for your usage.

It's a sync server between two threat intelligence platforms, and needs to connect to both of them in order to function
>>
>>60224844
Exokernels will be more prone to malware and less stable.
>>
>>60229223
Force user to set config dir in the install script then
>>
>>60229261
There is no install script, just instructions. It's just a little python thing :<
>>
>>60225657
>>60226054
>acos(dx/distance) for angle
You may be right (too lazy to think about it) but arctan(dy/dx) would be an easier solution
>>
>>60228873
s/disgusting/beautiful
>>
I got a trial code for Pluralsight from uni.
Is it any good to learn shit like python and ruby?
>>
File: 90644302332363.jpg (52KB, 1280x720px) Image search: [Google]
90644302332363.jpg
52KB, 1280x720px
Is a list the best way to hold information about a set of values/objects of the same type? I've been doing this for quite some time, but I don't if it's the best practice.

public class FileProperties
{
public List<AudioStream> AudioStreams { get; set; }
public List<VideoStream> VideoStreams { get; set; }

public FileProperties()
{
AudioStreams = new List<AudioStream>();
VideoStreams = new List<VideoStream>();
}
}


public struct AudioStream
{
public string Codec;
public string Number;
public string Language;
}


public struct VideoStream
{
public string Codec;
public string Number;
}
>>
>>60224787

http://104.131.160.52/ - Excuse the lack of TLD....
>>
>>60224787
>WAYWO?
Making an entity-component-system in C++. I like the idea of the pattern, but it seems to be quite a fuckery to implement it in a usable and performant way in C++.
>>
>>60229624
Not making a supergeneric object called File which contains a Codec and a Number only. Making the audio and videostream a specialisation.
>>
>>60228415
Non-autistic version.

fn main() {
for input in std::env::args().skip(1) {
println!("((({})))", input);
}
}
>>
>>60229062
the ^ should tell me where the error is. those are the : of the if statement, i really don't get it
>>
>>60229802
Remove the very first ( in the following :

newpath = ((r'C:Users\Anon\Desktop\temp\No. %s' % (i))

So that it becomes

newpath = (r'C:Users\Anon\Desktop\temp\No. %s' % (i))
>>
>>60229802
Close your parens you dipshit. Especially when they are unnecessary!
>>
>>60225982
HATE LEAFS
>>
Is there any string comparison in C++ that is faster than str1==str2 ? I just need to know if both have identical content or not.
And yes it would make a difference in what I am working on as my tool makes a couple of millions of string comparisons when I run it.
>>
File: 44579941.jpg (48KB, 500x500px) Image search: [Google]
44579941.jpg
48KB, 500x500px
>>60229718
The code is small, but I see what you mean.
Something like this?

public class File
{
public string Codec;
public string Number;
}


public class AudioStream: File
{
public string Language;
}


public struct VideoStream : File
{
}
>>
>>60229925
use std::string::compare
if(string1.compare(string2) == 0) // they have equal content
>>
>>60224787
>no link to previous thread
>no link in previous thread to this
Nice job retard
>>
File: Java output.png (14KB, 612x193px) Image search: [Google]
Java output.png
14KB, 612x193px
I'm trying to send a string from a webpage using JavaScript to a very simple TCP server written in Java, but when I print the received string, it's just a series of characters (most of them "squares"), and the message received is different for each time (the sent string remains a constant). I'll post relevant code:

JavaScript method:
https://pastebin.com/1GKEAKEE

Java code:
https://pastebin.com/FNg2Ryuz

Do you know exactly what I'm printing here?
Do you know why the message gets "scrambled"?
Is there a better way to do what I'm trying to do? The only thing I need is to send a string from the webpage using JavaScript, and receive the same string in the Java server.

I'm fairly new to all of this, so sorry if this is a retarded question. Any input is greatly appreciated.
>>
>>60224844
What are exokernels?
>>
>>60229985
isn't that basically an alias for == ? (or the other way around)
>>
>>60230120
yes == calls compare but if he is using a compüiler that performs little or no optimization it still saves some calls
>>
>>60228999
Or you could just not google it. But fine, next time I'll think of a daily programming challenge which you can't just look up on Google.
>>
>>60230078
>System.out.println(tcpin.readLine().toString());
why do you need to do readline to string? doesn't readline already output a string?
>>
>>60230172
That might be, didn't check the docs and it was just a quick test.
>>
>>60229131
Every element doesn't have to be unique.
>>
>>60230187
https://docs.oracle.com/javase/7/docs/api/java/io/BufferedReader.html#readLine()
... i literally don't even know Java
>>
>>60229876
>>60229878
5 parentesis man i'm retarded. thanks guys
>>
>>60230243
>BufferedReader
Check if the encodings match.
>>
are static methods cancer, /dpt/? Let's say I have a really expensive static method that takes a really long time to compute
public class Foo { 
public static int doSomeCrazyShit(Object a, Object b) { ... }
}

That's fine but then I have another class that does some stuff, including calling that static method:
public int parseOrWhatever(ByteStream a, Parser b) { 
...
Foo.doSomeCrazyShit(x, y);
...
}

If I want to unit test parseOrWhatever, the test will be SUPER slow because doSomeCrazyShit has to be called. but if doSomeCrazyShit was an instance method, I could eaisily rewrite as
public int parseOrWhatever(ByteStream a, Parser b, Foo foo) { 
...
foo.doSomeCrazyShit(x, y);
...
}

And mock the shit out of foo and unit tests would be speedy fast. Given this, should I just never make anything static?
>>
>>60225030
Come back to irc, I forgive you.
>>
>landed job as frontend webdev
>know really the basics about angularjs
what's a good resource other than the official documentation to learn the trips and tricks of the language?

I also proposed to the boss to automate a part of their "mini websites" deployment, but I'm not sure on what's the best method to generate the sitemap and to insert/remove lines at a specific position in a php file using bash (server is running debian).

Lastly, some good templates to take a look at to have some inspiration for angularjs websites? most used modules (like ladda, ui-router, ui-bootstrap, etc...) with a showcase maybe?

Please halp ;_;
>>
>>60228330
You're actually finding all the subsets of x such that the sum of all elements is y.
>>
>>60230431
Educate me, familia, but why:

Foo.doSomeCrazyShit(x, y);


Is slower than:
foo.doSomeCrazyShit(x, y);



One you're calling directly from the class and the other one from the instantiated object. There shouldn't be a difference.
>>
>>60230538
I am talking specifically about unit tests. In my unit test, I will mock Foo like so:
private class MockFoo { 
public int doSomeCrazyShit(Object a, Object b) {
return 3;
}
}
public void testParse() {
...
parseOrWhatever(bs, p, new MockFoo());
...
}

Which will be very fast. It is impossible to mock a static method that's called within a method. If I make doSomeCrazyShit an instance method, it is very easy to mock.
>>
HTML sucks!
What's the best canvas/webgl GUI library for js for creating webpages?
>>
Can someone remind me, in C, how do I make an array whose elements are k ints? I mean, if the arrays name was a, then (a + 1) would give the address of a+k*sizeof(int).
>>
>>60230596
why do you even use static anything other than for "I CAN MASTURBATE TO MY LINTERS XD" thing? do whatever's most efficient, safe and readable.
>>
File: cute_hinata_by_madwulf.png (213KB, 1280x1066px) Image search: [Google]
cute_hinata_by_madwulf.png
213KB, 1280x1066px
How the fuck do I use string streams? I thought it would be the same as "cin" but I get an exception error here.


string User_Response;
while (ss >> User_Response)
{

if (User_Response == "Done")
{

break;
}

else
{
user_input_storage[counter] = User_Response;
counter++;
//continue adding to array
}

}


>>
>>60230741
Exactly my point. Static methods seem like utter trash in 90% of cases. Why do they even exist?
>>
>>60230744
forgot to add the declaration,

 

stringstream ss;

>>
>>60230750
Factory methods.
>>
>>60230761
Why not make those factory methods instance methods?
>>
>change workplace
>have to maintain and develop a REST api that relies on a SOAP api
>about 100~ different possible api calls
>no documentation at all
>NOT A SINGLE LINE OF DOCUMENTATION
>have to basically bug the only other programmer for the APIs for the whole 8 hours of the workday
ahaha dude I'm loving this xd
>>
>>60230796
Because that would violate OOP principles. A method without instance context must be static.
>>
File: 1493551059747.jpg (7KB, 200x135px) Image search: [Google]
1493551059747.jpg
7KB, 200x135px
>>60230808
>>
>>60230816
>muh principles
who cares
>>
>>60230838

have fun writing unreadable code anon
>>
>>60230856
I actually document and comment everything I write, so my code is pretty readable
>>
File: sdasv.png (780KB, 795x436px) Image search: [Google]
sdasv.png
780KB, 795x436px
What drugs do you use while coding?
>>
>>60230873
caffeine
>>
>>60230873
I smoke a lot of wax on the job but honestly its overpowered completely by the LD50 dose of espresso i take every morning
>>
>>60230873
I am provided a 2L bottle of water and a coffee machine.
>>
>>60230873
caffeine
>>
Man, every time I comeback to C or Lisp from another webshit, I always feel so comfy and alive.
>>
>>60230871
If your code were readable you would need no comments.
>>
>>60230911
>if I have no coworkers my code is readable
nice joke friendo.
>>
>>60230919
Enjoy being replaceable.
>>
>>60230816
why?
>>
>>60230925
I actually keep the most important part of our codebase pretty much unreadable for this purpose.
>>
File: 54280119956.jpg (53KB, 704x480px) Image search: [Google]
54280119956.jpg
53KB, 704x480px
>>60230750
>Why do they even exist?
Because you can call them without the need to instantiate the class?
>>
>>60230873
caffeine and alcohol
>>
>>60230939
Because instance methods imply a change in state.
>>
>>60230925
>tfw i write my comments in polish so my code is perfectly clear for me even after few years and dark magic to all co-workers
>>
>>60230494
>>>/g/wdg/
>>
>>60230966
no they dont. one example: getter methods
>>
>>60230985
getter methods are pajeet meme
>>
File: Alpha_AXP_21064_diephoto1.jpg (216KB, 454x550px) Image search: [Google]
Alpha_AXP_21064_diephoto1.jpg
216KB, 454x550px
Alright, I've decided to scrap R, because I think it's a mess of an ISA.
I've basically ended up deciding I want to remake alpha. Anyone got some ideas on what to add, scrap, and improve?
>>
>>60230985

getter methods are still stateful, even if they don't mutate state
>>
>>60230744
>>60230756
looks fine. what exception is thrown?
>>
>>60230985

String getName() {
log.write(Calendar.now,user,"get name");
return this.name;
}


>>
File: oss.png (134KB, 613x507px) Image search: [Google]
oss.png
134KB, 613x507px
>be me
>using dwm
>feels alright
>it's from suckless
>"hmm, sounds pretentious but alright"
>..
>"We are the home of quality software such as dwm, dmenu, st and plenty of other tools, with a focus on simplicity, clarity and frugality."
>ok
>check dwm.c
>it's 2000+ lines of uncommented C code
roflmaoed a little to be honest with you
>>
>>60228858
I think if you sort the array you can ensure that you keep the number of checks to a minimum. Since you can early out when the next value you try would exceed the target number.
Eliminating numbers that are bigger than the target number is also a good idea.
>>
>>60231015
you're moving the goalposts and my point still stands. classes that call static methods are not unit testable.
>>
So, intellij idea is slow because of open java or because it is shitty ide?
Every time when i run my code it take at least 3 seconds to compile and run it, it is too much.
>>
File: 4126452_orig.jpg (23KB, 410x240px) Image search: [Google]
4126452_orig.jpg
23KB, 410x240px
>>60231017
I start the program and I get
>Unhandled exception at "some memory address", Integer division by zero.

I'm using visual studio btw, but I'd usually get this type of error in linux as segmentation fault.
>>
>>60224844
Activate your windows, anon.
>>
What stimulants does dpt use? caffeine pills any good assuming I use them monthly and thats my only source of caffeine
>>
I'd like to learn Python (because it's what Godot's scripting language is based on). What's a good book or course for learning it?
>>
>>60231417
It says the issue is in the yellow arrow of pic related.
>>
>>60231507
automate the boring stuff with python is free online (in video and book form)
>>
>>60231531
initialize counter to start at 1 then see what happens.
>>
>Create a scheme to make any sorting algorithm stable
1. create attributes of key, original index
2. sort by key
3.
for i in range(1, len(A)):
if A[i-1].key == A[i].key:
p = A[i-1]
q = A[i].original_index
while A[p].original_index > q:
A[p+1] = A[p]
p -= 1
A[p] = q


any better way?
>>
>>60231531

use spaces for your indents plz, it's 2017
>>
>>60231596
should've included "and A[p].key == A[i].key" in the nested while loop, what i'm asking is if there's a better way than doing insertion sort a bunch of times
>>
>>60231606
kill yourself
>>
>>60231606
Fuck off.
>>
>>60231638
>>60231703

lel

just look at all the unused space and floating curly brackets

ewww
>>
>>60231594
it worked but now it doesn't allow me to have user input. How do I have it so user inputs to a string, but when placing it in the array it'll include the space when placing it into an index, and will only break after a new line.

I thought string stream included user input as well, but now I think i have to combine them together.

Also why does ss work now, I had counter initialized to 0, works fine with cin but not with string streams?
>>
/g/, make this faster

while ($data = fgetcsv($file))
{
$num = count($data);
for ($x = 0; $x < $num; $x++)
{
if ($data[2] == $replacement_num && $data[7] == "REPLACEMENTS")
{
array_push($arr, $data[4]);
array_push($arr, $data[6]);
break;
}
}
}
>>
File: did this nigga just say Alfred.jpg (35KB, 640x480px) Image search: [Google]
did this nigga just say Alfred.jpg
35KB, 640x480px
>Writing .NET dll add-in for another program
>Said program's docs are less than stellar, and it's closed-source
>Need to use function to do thing
>One of the input arguments is literally just fucking "Input as Object", except any 'non-valid' object throws an exception
>Docs say that argument "Must be a valid entity" with NO explanation on what a 'valid entity' might be
Well now fucking what? I just finished brute-forcing the first dozen object types I thought it might be, but for all I know it's some other bullshit that makes it not 'valid'
>>
>>60230188
Still not enough information
Does every element in the result have to be unique.
if x is {8,8,8,8,8} and y is 8, what should the result be then.
Not explaining properly is a really really critical flaw.
>>
File: AESTHETICSHITCODING.jpg (102KB, 1920x1080px) Image search: [Google]
AESTHETICSHITCODING.jpg
102KB, 1920x1080px
>>60228330
SOME FOLKS SAYS RUST IS IDIOMATIC.
I CAN BE IDIOMATIC WHILST WRITING AESTHETIC CODE.
       IDENTIFICATION DIVISION.
PROGRAM-ID. RUST-IS-FOR-FAGS-CHECK-MY-AESTHETICS.

DATA DIVISION.
WORKING-STORAGE SECTION.
01 WS1-TABLE.
02 WS1-ELEMENTS OCCURS 7 TIMES.
03 WS1-DATA PICTURE 9.
01 WS2-RESULT PICTURE 99.
01 WS3-INDEX PICTURE 9.
01 WS4-INDEX PICTURE 9.
01 WS5-INDEX PICTURE 9.

PROCEDURE DIVISION.
BEGIN.
MOVE '1234567' TO WS1-TABLE.
PERFORM DATA-INDEX VARYING WS3-INDEX FROM 1 BY 1
UNTIL WS3-INDEX IS EQUAL TO 8.
STOP RUN.
DATA-INDEX.
PERFORM CALCULATE VARYING WS4-INDEX FROM 1 BY 1
UNTIL WS4-INDEX IS EQUAL TO 8.
EXTRA-DATA-INDEX.
IF WS5-INDEX IS NOT EQUAL TO WS1-DATA(WS4-INDEX)
IF WS5-INDEX IS NOT EQUAL TO WS3-INDEX
ADD WS5-INDEX WS2-RESULT GIVING WS2-RESULT
IF WS2-RESULT IS EQUAL TO 8
DISPLAY WS1-DATA(WS4-INDEX) ', '
WS3-INDEX ', '
WS5-INDEX.
CALCULATE.
IF WS3-INDEX IS NOT EQUAL TO WS1-DATA(WS4-INDEX)
ADD WS3-INDEX TO WS1-DATA(WS4-INDEX)
GIVING WS2-RESULT
IF WS2-RESULT IS LESS THAN 8
PERFORM EXTRA-DATA-INDEX VARYING WS5-INDEX
FROM 1 BY 1
UNTIL WS5-INDEX IS EQUAL TO 8
ELSE
IF WS2-RESULT IS EQUAL TO 8
DISPLAY WS1-DATA(WS4-INDEX) ', ' WS3-INDEX.
>>
How do you guys get ideas for what to program?
>>
File: 1478163441503.png (418KB, 600x802px) Image search: [Google]
1478163441503.png
418KB, 600x802px
What is the best language known to mankind as of 06/05/2017 and why?
>>
>>60230431
Static methods are equivalent to global variables. Cancer usually. Dont use it unless the function is called VERY often from everywhere whenever through multiple threads and variables.
Otherwise a function pointer will cover anything else
>>
>>60232115
python 3.x
because it's the one I use
>>
File: questioning.jpg (28KB, 192x214px) Image search: [Google]
questioning.jpg
28KB, 192x214px
We have 10 integer arrays with each a size of 350 and they are completely filled with random numbers
We also have a single array with a size of 3500 and it is completely full wih random numbers.

Is the second array takes up more space in memory then the first one?
Is the 2nd array takes up more space in memory then the first one if we used the .NET framework?
>>
>>60232127
I said "mankind".
>>
>>60232130
>Is the second array takes up more space in memory then the first one?
No. Integers are infinite.
>>
>>60232075
The elements in the results don't have to be unique as you have to find all possible sums
>>
File: blue_finger.png (17KB, 650x650px) Image search: [Google]
blue_finger.png
17KB, 650x650px
>>60232115
Why do you faggots keep having the same boring discussion every fucking thread? People like you wont produce anything of worth with them anyway.
>>
>>60227057
22 is when I started as well, not too late at all.
>>
File: 1464988239815.png (509KB, 454x642px) Image search: [Google]
1464988239815.png
509KB, 454x642px
>>60232199
Really? OK that was silly.
>>
Inductive list (T : Type) (n : nat) : Type :=
| Empty : n = O -> list T n
| Cons : forall m : nat, n = S m -> T -> list T m -> list T n.
Check list.
Check Empty.
Check Cons.

Fixpoint length (T : Type) (n : nat) (l : list T n) : nat :=
match l with
| Empty _ _ H_n_eq_O => O
| Cons _ _ m _ _ tail => 1 + length T m tail
end.
Check length.
Arguments length {_ _} _.

Theorem length_is_length :
forall (T : Type) (n : nat) (l : list T n), length l = n.
intro T.
(induction n).
(induction l).
(unfold length).
auto.
(unfold length).
(unfold length in IHl).
(rewrite IHl).
auto.
(induction l).
auto.
(unfold length).
(unfold length in IHl).
(rewrite IHl).
auto.
Qed.
>>
>>60232199
Apologize.
>>
>>60232025
is it a .NET assembly? if so, decompile it
>>
>>60227057
Are you good at math?
If yes do it. Coding is basically math in a much easier form. If you suck at math its too late for you.
>>
>>60229497
Learning ruby right now, fuck is it an ugly language for frontend but backend is alright
>>
>>60232115
Wasnt aware it was june
>>
>>60227057
>code
Wrong thread.
>>>/g/wdg/

>>60232224
>Coding
Nope. Coding isn't related to mathematics in any way.
>>>/g/wdg/
>>
>>60232283
>Coding isn't related to mathematics in any way.
Coding monkey who will never accomplish anything confirmed.
>>
>>60230494
AngularJS Material is pretty good from what I've heard. Take a look at codepen to see if theres something you like.
>>
>>60232292
I don't "code", I program. Which is basically mathematics in a much harder form.
>>
programming is literally just algebra, and calculus if you wanna get into some real shit like 3d game engines
>>
>>60232224
if it's math in a much easier form then wouldn't that make it particularly appealing to people who aren't great at math?
>>
>>60232283
So now instead of redirecting to reddit, you're redirecting to the webshit general. Please actually ingest cyanide, you crossboarding filth.
>>
Web development is programming.
>>
>>60232316
>algebra
Which "algebra"?
>>
>>60232338

uhh linear?
>>
>>60232087
Think about what people want, then try to make it something they need. Working on a gps tracker for finding friends at outdoor concerts
>>
>>60232346
In which case "programming is literally just linear algebra" is possibly the most retarded thing I have ever heard in this thread.
>>
>tfw C#
>tfw I write managed code
>tfw I'm literally KEKED by the .Net framework and the Common Language Runtime.
>tfw nothing I write actually gets directly turned into machine code.

Who not real programmer and never touch or talk to CPU or virtual memory here?
>>
>>60232320
Excuse me?
>>
>>60232372

sometimes you just don't want to clean up your own garbage

Just be glad you can create your own value types
>>
>>60232358

uhh actually they are very similar

chances are if you suck at algebra or hate it, you wont be a competent programmer
>>
>>60232351
2normie4me
>>
>>60232374
read this sentence
>>
>>60232391
normie shit sells man
>>
>>60232115
Java

>statically typed
>well tooled
>state of the art GC

no other language has all three
>>
>>60232387
>uhh actually they are very similar
Not at all. Unless you mean game programming, which isn't all programming.
>algebra
What algebra are you referring to?
>>
>>60231729
Ok so I have messed around with your code for a bit. Also I have done a bit of searching myself. To be quite honest i'm not very good.
but Turns out you do need iostream if it solely based on user Input.

Honestly I thought that ss >> string would work too but guess not.
Anywho.
From where I got my source it says you need to do
getline(std::cin, User_Response)[\code] 
in the while statement and then put

which would probably defeat the purpose of using stringstream correct me if i'm wrong.
However I also found another example
. . .
int a, b;
std::string s = "34 22";
std::istringstream ins; // Declare an input stringstream.
. . .
ins.str(s); // Specify string to read.
ins >> a >> b; // Reads the integers from the string.[\code]
which I found interesting to say the least

As about that counter thing I was memeing; But I think it has something to do with how your IDE functions. In my version it doesn't give me a division by 0 error it just crashes my program.
sorry I couldn't be more help.
>>
>>60232316
>programing is calculus
let me know when u get a cpu that can handle continuous numbers lamo
>>
>>60232372
>>60232406
Where is this from?
>>
let find x y =
let rec print_list = function
| [] -> print_newline ()
| [ x; ] -> Printf.printf "%d\n" x
| x :: xs ->
Printf.printf "%d " x;
print_list xs in
let rec loop took left_sum = function
| [] -> ()
| x :: xs ->
if x < left_sum then
loop (x :: took) (left_sum - x) xs
else if x = left_sum then
print_list (x :: took);
loop took left_sum xs in
if y = 0 then
print_list []
else
loop [] y x
;;

let () = find [1; 2; 3; 4; 5; 7] 8;;


You forgot [1, 2, 5] anon.
>>
>>60232406

The JVM is great, but Java itself is kind of crap.
C# is much nicer to write.
>>
>>60232434
I'm quoting myself. I said that aloud as I typed it.
>>
>>60232318
>Which is basically mathematics in a much harder form
Brainlet confirmed. You probably don't even know what real math is. Probably never went past computational math.
>>60232318
No math is hard as balls. Im saying its way easier than set theory. Id actually agree with >>60232316
Its about as hard as linear algebra at top level, calc 2 for most people, and if you are just a code monkey basic algebra.
>>
>>60232406
>statically typed
So any imaginable programming language?
>well tooled
Even if we assume this isn't a meaningless buzzword, it's not a property of the language.
>>
>>60232420
>matrices are only used in game programming
Ive that wage going.
>>
>>60232440
not sufficiently tooled on linux, mono is a terrible meme. C# traps you into the microshit ecosystem
>>
>>60232449
>set theory
Take that garbage to >>>/g/wdg/
>>
>>60232466

Well yes, that's the only drawback besides that. Java has the superior ecosystem but C# is much more comfy as a language.
>>
>>60232466
>meme
>>>/v/
>>
>tfw don't know what a dictionary is
>tfw don't know what a linkedlist is
>tfw don't know what a Random is
>tfw don't know what a stringbuilder is
>tfw don't know what a textblock, textbox, label, stackpanel. button, toolStripMenu, or any other UI component is
>tfw #region Fields #endregion, #region Properties #endregion,
#region Constructor #endregion,
#region Methods #endregion
every single class regardless of whether its actually needed or not.
>tfw I've never created a struct, ever.
>tfw whats an algorithm?
>>
>>60232466
>traps
great!
>>
>>60232496
Sorry but did you reply to the correct post?
>>
>>60232420

>game programming isn't programming

ya now you just lost me

i dont understand why linear algebra doesnt plays a role in programming unless your program is simple input and output or something
>>
>>60232512
>game programming isn't programming
Is your reddit spacing impacting your ability to comprehend basic sentences?
>>
>>60232496

What langauge do you even program in?
>>
>>60232540
C#/.NetFramework
>>
>>60232537

lel i read it as "isn't at all programming"
>>
>>60232115
C++17
+
+
1
7
>>
>>60232579

What's new in 17?
>>
>>60232372
at least you went with C# rather than Java. and hey, there's rare isolated edge cases where the JIT compiler ends up generating faster assembly than equivalent C. so chin up, champ
>>
>>60232600
Broken patches over broken design choices.
>>
>>60232512
Game programming is a lot different in terms of architecture than other applications.

>generally runs a loop a certain amount of times per second
>the application loops until the user exits and doesn't wait for user input to enter the next loop.
>game logic is usually arbitrary as fuck and its difficult to program because you aren't solving a simple problem like parsing text or transferring a filetype or something.

By far the biggest difference is the whole "this application runs at a certain FPS and needs to do stuff within that time frame regardless of user input" thing though. It creates problems that don't exist in like, any other type of program.
>>
backwards compatibility was a mistake
>>
>>60232645
t. Bjarne
>>
>>60232600
std::string_view
std::pmr::polymorphic_allocator
namespace nested::name::spaces
template<auto>
[structured, bindings] = get();

probably more I forgot
>>
>>60232641
In fact game programming belong to embed world.
>>
>>60232641

exactly its more complex so you need to bring in calculus, algebra, etc
>>
>>60232663
>namespace nested::name::spaces
Now thats what i call idiomatic.
>>
>>60232641
>>the application loops until the user exits
just like any gui-driven application
>>
python has this neat feature:
def thing(): 
return 2, 4

a, b = thing()

that a lot of other languages are missing so I've taken to simulating pointers in languages like C# and Java:
void thing(Integer a, Integer b) { 
a = 2;
a = 3;
}

Integer a;
Integer b;
thing(a, b);
>>
>>60230609

Why do you want to mimic in WebGL what HTML was designed for? Would you use OpenGL to do what Qt/GTK/FLTK/WxWidgets and the like are used for?

>>60230649

int a[SIZE][k];

>>60230741
>>60230750

An instance method is going to have an invisible argument passed to it every time -- the object it's being used on. If you aren't using the object, it makes little sense to push an unused parameter into a register every time that function is called. By contrast, static methods in Java serve the purpose of naked functions... just with a namespace.

>>60230873

None.
>>
>>60232790
C# has tuples
>>
>>60232814

>Fucked up my code tag
Goddammit.

>>60232645

Backwards compatibility is how you get users. No one wants to write a whole library stack from scratch.
>>
>>60232223
Tried with dotPeek and didn't find anything useful, am I doing it wrong?
>>
>>60232790

You're really returning a tuple.
def thing():
return (2, 4)

(a, b) = thing()

I don't know if there's an easy way to do multiple return in Java or C# though.
>>
>>60232814

>Ruby senpai
>looking like a newbie neet trying to do code tags for the first time

whats going on man
>>
>>60232825
and its clunky as fuck
Tuple<int, int> thing() { 
return new Tuple<int, int>(3,4);
}

Tuple<int, int> result = thing()
int a = result.item1;
int b = result.item2;
>>
>>60230991
Anyone got some ideas?
>>
>>60232579
constexpr
higher-order
generic
lambdas
nigga

also constexpr if (easy compile-time branching), class template type deduction, formerly only available for function templates (which can be guided in cases that aren't obvious enough to be generated by the compiler from constructor signatures), generally eliminating the need for make functions/cutting down on template syntax. also a type-safe variant type with (potentially constexpr) visitation (has the cost of a normal function call, using normal overload resolution, no need for runtime switching), also it's optionally lambda-based (with a simple helper class that essentially allows you to overload lambdas which is now much easier to make because of the addition parameter pack expansions for using statements), and with generic lambdas you can do pattern matching in the form of having a visitation case for something like vector<auto>, for example, which will match a vector of any type. among other things. those are my favorites though
>>
>>60232882
C# 7
>>
>>60232882

I'm not familiar with c#, could you not use a struct? or maybe there's a pass by ref funcitonality?
>>
>>60232777
You typically aren't redrawing stuff with that loop or running ai code or anything like that. Microsoft Word isn't constantly doing shit, its waiting for the user.
>>
File: 1490243298992.png (598KB, 673x680px) Image search: [Google]
1490243298992.png
598KB, 673x680px
Finishing messing around with my capstone project.

It's researching image classification with a bag of features + classifier type structure

Right now, I just finished implementing SURF feature detecting and am comparing it to how well SIFT is detecting features. Pretty interesting results. relatively small data set size but still should be okay for testing these different methods.

Accuracy on test images after training classifiers
SIFT + kNN classifier = 71 %
SURF + kNN classifier = 81 %
SIFT + SVM classifier with linear kernel = 77.35 %
SURF + SVM classifier with linear kernel = 77.06 %

going to try a Gaussian kernel, probably will work better.
also seeing a lot of variance between each train/test cycle, don't know why, maybe k means clustering part

my university just added a machine learning class next year but im graduating so I can't take it, baka, guess I'll continue learning outside of class
>>
>>60232422
I'll try to work from what you have.. Thanks for the help anon. :)
>>
>>60232882
C# has tuple literal syntax now. you can even name the values and the compiler brings the names into calling scope. contrived example, but:

(float x, float y) Add2D((float x, float y) a, (float x, float y) b)
{
return (a.x + b.x, a.y + b.y);
}

// ...

var a = (1.0f, 2.0f);
var b = (3.0f, 4.0f);
var c = Add2D(a, b);
var (d, e) = Add2D((a.x, b.y), c);
>>
>>60232978
Where to I subscribe to your blog?
>>
If I have a 3D Perlin noise function, can I get 2D perlin noise by just using a constant z input?
>>
>>60233014
nice, I'll have to check that out
>>
>>60232978
very nice, the Gaussian kernel improved the svm, and they surpassed kNN
>>
>>60233049
I think so.
>>
>>60233040
bruh, why do you have to be a dick, I was just excited about posting this, I know i'm a fucking pleb when it comes to this machine learning but its exciting
>>
>>60232978
poast coad pls
>>
>>60232022

anyone? c'mon you big O guru's
>>
>>60233049
yes, but if that's all you need, for performance reasons i would definitely recommend using a 2d version of the function if you can
>>
>>60233089
i'll post the github that got me started, my code is too fucking messy

https://github.com/bikz05/bag-of-words

his dataset is way too small though so find a different one after implementing it.

findFeatures.py and getClass.py are the important files to look at

you must install opencv though to use cv2

also the syntax has changed so instead of this....


# Create feature extraction and keypoint detector objects
fea_det = cv2.FeatureDetector_create("SIFT")
des_ext = cv2.DescriptorExtractor_create("SIFT")

# List where all the descriptors are stored
des_list = []

for image_path in image_paths:
im = cv2.imread(image_path)
kpts = fea_det.detect(im)
kpts, des = des_ext.compute(im, kpts)
des_list.append((image_path, des))


1/2
>>
>>60233177
put this... and wherever else you use sift same way

sift = cv2.xfeatures2d.SIFT_create()
descriptors_list = []

for path in imgpaths:
img = cv2.imread(path)
gray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)
(kps, descs) = sift.detectAndCompute(gray, None)
descriptors_list.append((path, descs))


2/2
>>
>>60233049
>>60233064
technically you dont need it but ive found that you can keep the z index to do interesting thing like provide a randomized gradient to the map or something
>>
>>60232022
 for ($x = 0; $x < $num; $x++)

this loop does nothing
why are you writing this in PHP?
>>
>>60233256

pretty sure i do need it cuz it wouldnt stop reading the file or something, can't remember exactly i wrote the code few months ago

and im using php because im spitting out the results and converting it to JSON because JSON is based.
>>
>>60232860

I derped. It happens sometimes.
>>
>>60230873
phenidates
>>
>>60230873
SSRIs
>>
>>60230873
adderall,

it's double edge sword though, it's godlike while programming, but when you program too much with it, it makes programming suck without it
>>
>>60233492

thats why you only use it to study - once you got it all down then you get off it - now whatever you learned is in your memory forever
>>
>>60233540
good idea, still feels nice to just rip through a project addied out every once in awhile
>>
>>60233288
>ask for help from gurus
>ignore their advice because you're "pretty sure"
>dont have automated tests to check for you
>cant read your own code
pajeet is that you?
>>
>mfw compiling and linking for an embedded system in C++
>>
>>60233608

yea well i went back and removed that part and stopped working properly

where is your god now?
>>
How the fuck does PNG and DEFLATE work? Holy shit this amount of not saying it directly in the documentation is cancer.

So I have the fucking 1 byte header in the IDAT section every 65535th data byte, set to 0 normally and 1 when last block because I want non compressed PNGs because fuck implementing DEFLATE.

But apparently NOOOO, that's not correct. Do I need to fucking pack the first byte with non compressed data, too? What the fuck is the point with that?

FCUK.
>>
File: apina.jpg (58KB, 546x546px) Image search: [Google]
apina.jpg
58KB, 546x546px
>>60233618
>compiling C for android or windows
cross compiling fucking sucks
>>
File: 1481197081838.jpg (144KB, 1183x664px) Image search: [Google]
1481197081838.jpg
144KB, 1183x664px
>>60224787
Working on a pokemonbot for discord with python

Am I one of y-you guys?
>>
>>60233722
everyone will say no but you definitely are.
>>
>>60233722
There is no organized group. Everyone is just a shitposting faggot.
>>
>>60233642
Still nicer than compiling on actual windows.
>>
>>60233751
>tfw cross compiling in Windows
>>
C and C++ are horrible to compile, it's just that it's alright on UNIX since it was designed for it with /include and /lib and such. Modern languages are easier to compile than C and C++ and it's uniform on every platform.
>>
>>60233793
>C and C++ are horrible to compile,
Only on windows. On all other systems, they are usually nicer than most other languages.
>>
>>60233793
believe it or not those languages still have the same problems with linking libraries and stuff, they just circumvent the issue by packaging their dependencies locally or in a virtual environment.
>>
>>60233824
So how is it a problem?
>>
>>60233822
>Only on windows.
No it's fucking easy.
>>
>>60233793
Point is, if your language needs support in the fucking OS to not be a nightmare, you've got a problem.
>>
>>60233830
virtualenv shouldnt be used in production for a variety of reasons. packaging your deps locally becomes more of an issue when there become version mismatches between things using those deps, etc. the problem is 'solved' in a way that doesn't really take direction from finesse.
>>
I am trying to write a very single program with 2 functions that fill and print an array in pascal.
For some reason the filling function only fills the last element.

program array_functions;

uses sysutils;

procedure WriteArrElems(arr : array of integer);
var
i : integer;
begin
for i := 1 to Length(arr) do
begin
write(arr[i]:5);
if i mod 5 = 0 then writeln;
end;
end;

procedure FillArrElems(arr : array of integer);
var
i, temp : integer;
begin
for i := 1 to Length(arr) do
begin
write('Enter ' + IntToStr(i) + 'th element: ');
read(arr[i]);
end;
end;

var
mas : array [1..10] of integer;

begin
FillArrElems(mas);
WriteArrElems(mas);
end.


Output:
Enter 1th element: 1
Enter 2th element: 2
Enter 3th element: 3
Enter 4th element: 4
Enter 5th element: 5
Enter 6th element: 6
Enter 7th element: 7
Enter 8th element: 8
Enter 9th element: 9
Enter 10th element: 1
0 0 0 0 0
0 0 0 0 1
--------------------------------------------------
Press enter
>>
>>60233954
Pass by reference
>>
Can anybody help me simplify my Haskell code:

v      = volume       n
ino = inode n
fsize = fromIntegral $ iSize ino -- The size of the file.
blist = blockList v
sb = superBlock v
bsize = getBlockSize sb
blocks = concat [direct,singly,doubly,triply]
direct = getBlocks $ iDirect ino
singly = getBlocks' $ getBlock $ iSinglyIndirect ino
doubly = getBlocks'' $ getBlock $ iDoublyIndirect ino
triply = getBlocks''' $ getBlock $ iTriplyIndirect ino
getBlock = (blist !!) . fromIntegral
getBlocks = map getBlock
getBlocks' = getBlocks . (take asPerB) . flip peekObjects 0
where asPerB = bsize `div` (fromIntegral $ sizeof (0 :: Word32)) -- The number of addresses stored per block
getBlocks'' = concatMap getBlocks' . getBlocks'
getBlocks''' = concatMap getBlocks' . getBlocks''



This code reads Ext2 inodes, and concatenates all of the blocks into a list. The reason it's this complex is because of the indirect blocks. For those who don't know Ext2, each file has 12 "direct" blocks, which contain data. If blocks are 4 kiB, then this only gives us 48 kiB worth of space. So there are also "indirect" blocks: the "singly-indirect" block points to a block of direct blocks, the "doubly-indirect" block points to a block of indirect blocks, and there's also a triply-indirect block which, you guessed it, points to a block of doubly-indirect blocks. This gives a maximum size of 4 TiB per file with 4 kiB blocks.
>>
>>60233985
Dunno if this can get any simpler
>>
>>60233013
I think I have it now
while(getline(std::cin, User_Response)){
ss << User_Response;
if(ss.str() == "Done"){
break;
}
else{

StringV.push_back(ss.str());
// ss.clear();
ss.str("");
counter++;
}
}

Is something like this what you wanted? or did you not want to use iostream?
>>
>>60234073
What is the type of ss?
>>
>>60233832
It is, as long as you don't need to use any libraries.

If you need more than zero libraries, Bill help you.
>>
>>60234350
If the libraries are correctly written it's fucking easy to link.
>>
>>60234073
It fixes the exception but I can't exit loop for some reason.

This is very close, I'll be back later tonight and update on whether or not I've got it completely working.

Thanks again. :)
>>
>Project options
>Additional dependencies
>"muh.lib"
wew, that was hard. gonna go sleep now
>>
>>60231531
did you initialize stringstream, like
stringstream ss(some_string);

or after initialization
ss.str(some_string);
>>
>dev who gets mad when people say they mostly do front end (who also happens to do almost exclusively front end) changes CSS on page for no reason
> Oooooooh well done! - corporate

... Don't mind me. Just going through you're massive backlog of huge security issues that don't technically effect UX directly... Thats fine. (Reees internally)
>>
>>60234058
Yeah, you're probably right. At least it works.
>>
It's been a while since I programmed in Java.

Thanks to a semester of programming in C, I now have the urge to error-check everything.

Returning to Java, how much error-checking would be considered redundant? For example, should I still check that method arguments are of correct type? What's a good rule of thumb here?
>>
File: Untitled.jpg (42KB, 609x391px) Image search: [Google]
Untitled.jpg
42KB, 609x391px
Why does this only return 16?
>>
>>60234662
you don't seed the random number generator
>>
>>60234658
It's C, you must not check arguments. DOn't call functions with invalid arguments.

>Speed over safety
C creators
>>
>>60234658
>check that method arguments are of correct type
that is the compiler's job. why would you ever do this in a statically typed language?
>>
>>60234670
How does "random" have any state if it only takes the upper bound?
>>
>>60234698
shit, you're right. I need to stop drinking
>>
Redpill me on xml parsers, /dpt/

How much office bitchwork can be automated if you use them properly?
>>
>>60234721
Lisp is impure
>>
>>60234747
about tree fiddy
>>
>>60234747
they parse xml.
>How much office bitchwork can be automated if you use them properly?
any amount of office bitchwork related to parsing xml
>>
File: 1463593008371.png (71KB, 300x346px) Image search: [Google]
1463593008371.png
71KB, 300x346px
I'm halfway through learning D and Rust. Which one should I finish learning first?
D or Rust?
>>
>>60234947
>mixing d with heretical r*st
end yourself.
>>
>>60234979
>mixing d with heretical r*st
Who said that?
>>
>>60235007
devote your attention to one at a time.

rust probably has more library support though.
>>
>>60235007
I said that aloud as I was posting that comment.
>>
>>60235042
Why do you quote yourself?
>>
>>60235055
I have a nice habit of quoting smart people.
>>
File: 1486067102261.png (648KB, 640x619px) Image search: [Google]
1486067102261.png
648KB, 640x619px
>>60224787
creating a fork of a popular encrypted document store and modifying it's back end storage class to store data in encrypted base64 encoded chunks in threads on an old anime forum (while seeing how long it takes them to cite their misuse policy against me)
>>
>>60235085
Then you should not be quoting yourself
>>
File: 1491340427652.png (387KB, 684x577px) Image search: [Google]
1491340427652.png
387KB, 684x577px
>>60235055
>>60235085
>>60235098
FUCKING REKT
>>
>>60235105
>replying to yourself
>>
>>60235141
meant for >>60235042
>>
Coding as a job would be most convenient for me but I have a TINY brain. Is there a way to consolidate these factors?
>>
>>60235159
"Code" in Python
>>
>>60235159
>>60235199
or Python's SJW fat lesbian cousin: Ruby
>>
New thread
>>60235248
>>60235248
>>60235248
>>
File: cat in bath.webm (386KB, 261x194px) Image search: [Google]
cat in bath.webm
386KB, 261x194px
>>60228369
bump
>>
>>60229048
project euler
>>
#include "stdio.h"
#include "math.h"

float calc(int total, int population){
float const z95 = 1.96;
float const one = 1.0;

float p_hat;
double stderr_p_hat = sqrt((p_hat * (one - p_hat)/total));
float lower_bound = p_hat - (z95 * stderr_p_hat);
float upper_bound = p_hat + (z95 * stderr_p_hat);

//char ub_string[] = ftos(upper_bound);
//char lb_string[] = ftos(lower_bound);
p_hat = (float)population / (float)total;


char message[] = "95 percent confidence that the true value lies between ";

fprintf("%s %s and %s.", message, lower_bound, upper_bound);

return 0;
}

int main(int argc, char const *argv[])
{

int total;
int population;

//take input
printf("What is the total and standard deviation?\n");
scanf("%d", &total);
scanf("%d", &population);

//give input to calc
calc(total, population);

/* code */
return 0;
}




>Segfault 11

Dropped.

But for real, how do I into C?
>>
I need some simple C++ challenges to sharpen up on it. Haven't done anything with it in a while and it's always good to have practice, but I don't really have anything in mind that I need. Anybody have something?
>>
>>60235347
Look into printf format strings.
>>
>>60234384
Add \n to your terminate string. Pretty sure getline grabs the newline character as well.
Thread posts: 338
Thread images: 46


[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.