[ 3 / biz / cgl / ck / diy / fa / g / ic / jp / lit / sci / tg / vr / vt ] [ index / top / reports / report a bug ] [ 4plebs / archived.moe / rbt ]

Due to resource constraints, /g/ and /tg/ will no longer be archived or available. Other archivers continue to archive these boards.Become a Patron!

/g/ - Technology

View post   

[ Toggle deleted replies ]
File: 327 KB, 1158x980, cool kids club_.png [View same] [iqdb] [saucenao] [google] [report]
59332981 No.59332981 [Reply] [Original] [archived.moe] [rbt]

What are you working on, /g/?

Old thread: >>59327254

>> No.59333014

whatever, this thread seems nicer

>> No.59333031 [DELETED] 
File: 40 KB, 603x388, pig3 (1).jpg [View same] [iqdb] [saucenao] [google] [report]


>> No.59333035
File: 21 KB, 851x49, Capture.jpg [View same] [iqdb] [saucenao] [google] [report]

Need help plox

>> No.59333038

>created way before bump limit


>> No.59333057 [DELETED] 
File: 47 KB, 931x486, 1489154047193.png [View same] [iqdb] [saucenao] [google] [report]

>but muh C!!

>> No.59333060

assembly question

i can't seem to be able to find an example of x86 assembly (preferrably ATT syntax) of a program using command line arguments

i just need to know where I access the number of arguments(ie argc) and where i access the pointer to the arguments (ie char** argv)
and where i access the name of the program

i should be able to just use ebp somehow, but i don't know where ebp points to in the beginning and can't find info


>> No.59333067

>created way before bump limit
Not true.

>> No.59333077

It is true, you made this at 309

>> No.59333091


>> No.59333099

Chart doesn't seem too far off, but I do question it a bit.

Namely, the fact that Javascript isn't higher.

>> No.59333116
File: 662 KB, 667x836, SS_002.png [View same] [iqdb] [saucenao] [google] [report]

Can someone help me with this, this is what happens when i try to start downloading from my app

>> No.59333119

Most of the job listings I see for C# say ".NET Developer".
I'd be curious as to what that looks like if you take that into account.
Probably tons of javascript jobs left off due to them just saying "website developer".

>> No.59333131

>his is what happens when i try to start downloading from my app
What do you think should happen instead?

>> No.59333135 [DELETED] 

Depends on your ABI, that's what you'll have to document yourself on. The x86 SystemV ABI for example pushes C arguments from right to left on the stack, whereas on x86-64 it uses rsi and then r8, r9... iirc.

>> No.59333145

He's clearly making fun of these popularity charts.

>> No.59333147

It is not downloading file anon, it add torrent and remove it for unknown reason

>> No.59333157


>> No.59333198

That multiple selection poll is just woefully inadequate for measuring anything. Speaks for how retarded the person who made it is.

>> No.59333200

a[n]>a[n-1]: add to ms_arr; inc n;
else: inc n;
Repeat for various starting positions: start at n=0,n=1,etc... check size of ms_arr;

>> No.59333206 [DELETED] 

>khm.. search tag `zoo` on yespornplease .. khm

>> No.59333221

wouldn't that find only consecutive numbers?

>> No.59333222

Ahhh, yes, thanks... I mean I wouldn't do that, of course, but it's good to know.

>> No.59333239

Yes. He misunderstood the problem.

>> No.59333242 [DELETED] 

Oh shit yeah I fucked up. It should be:
a[n]>ms_arr[k]: add to ms_arr; inc n;

>> No.59333276

My goal in life is to learn the top 3 reasonably well + Python. Still haven't gotten into C# though.

>> No.59333282

I believe it is specifically made to get a rise from reasonable people like you.

>> No.59333293

Could you write those 2 for loops in code, i'm not really sure if you're correct

>> No.59333295

>use references for everything in c++
>feel like a fucking god

>> No.59333322

>old thread got deleted
what a radical solution

>> No.59333332

I'm sick of being at the mercy of the scummy dev's who make a living off of the play store.
I want to make my own android apps, where's a good place to start?

I already know Java, just never tried to make anything for another device.

>> No.59333337
File: 47 KB, 931x486, 1489154047193.png [View same] [iqdb] [saucenao] [google] [report]

The top 3 being Java, C++ and C#.

>> No.59333338

Install Android Studio and fill in the gaps

>> No.59333351


case Circle c:
WriteLine($"circle with radius {c.Radius}");
case Rectangle s when (s.Length == s.Height):
WriteLine($"{s.Length} x {s.Height} square");
case Rectangle r:
WriteLine($"{r.Length} x {r.Height} rectangle");
WriteLine("<unknown shape>");
case null:
throw new ArgumentNullException(nameof(shape));

(string first, string middle, string last) LookupName(long id) // tuple return type
// retrieve first, middle and last from data storage
// ...

return (first, middle, last); // tuple literal

// ...

var names = LookupName(id);
WriteLine($"found {names.first} {names.last}.");

public int Fibonacci(int x)
if (x < 0) throw new ArgumentException("Less negativity please!", nameof(x));
return Fib(x).current;

(int current, int previous) Fib(int i)
if (i == 0) return (1, 0);
var (p, pp) = Fib(i - 1);
return (p + pp, p);

>> No.59333356

>ŧfw your hardcore number crunching pushes the java GC to the limit
i-i dont want to learn C++ just for this

>> No.59333368
File: 1.79 MB, 1920x1080, 59192433f06676f852d20ed6763db54427fa44ba.png [View same] [iqdb] [saucenao] [google] [report]

>What are you working on, /g/?
Still working on Hydrus tag repository scraper. Writing parsers for 50 thousand levels of nested tuples.

>> No.59333395

looks like mod finally arrived with banhammers

>> No.59333426
File: 651 KB, 561x800, 1452715120528.png [View same] [iqdb] [saucenao] [google] [report]

Do you have an anime picture of your favorite programming language?

>> No.59333459

Fuck the C haters
C ftw

>> No.59333470

you wrote the piece of shit. you should know

>> No.59333471
File: 1.30 MB, 1200x1800, 1442750574870.png [View same] [iqdb] [saucenao] [google] [report]

C is a classy mature woman.
What's your favorite?

>> No.59333487

C++ is best girl, but the language is shit.

>> No.59333505

>Writing parsers for 50 thousand levels of nested tuples.
why does it matter how nested the tuples are

it's a tree either way

>> No.59333516

C++ a slut, she takes whatever hot feature members of the standard committee want to put in her.

C is far more conservative.

>> No.59333529

PHP is cutest.

>> No.59333567
File: 786 KB, 1000x1300, anime.png [View same] [iqdb] [saucenao] [google] [report]

Haskell, because she's pure

>> No.59333615

in python you get to pet the snake

>> No.59333637

Neon Genesis Evangelion: C
Serial Experiment Lain: Lisp

>> No.59333647

C++ is the sluttiest

>> No.59333648

anime : trash

>> No.59333652

Because it's not a tree, it's a structure of multi-level nested objects without keys mixed with tuple arrays. To make it worse, it's full of redundant data, that can be easily inferred. Here's a truncated sample: https://hastebin.com/uheqodeyej.json

>> No.59333658

Serial Experiment Lain: Python
Flip Flappers: Haskell

>> No.59333668
File: 342 KB, 714x738, 1421164417027.png [View same] [iqdb] [saucenao] [google] [report]

Anime website

>> No.59333671

Python was barely known at the time of Serial Experiment Lain

>> No.59333676

first sort the array, then do what >>59333200

>> No.59333678

opinion: discarded

>> No.59333693

Lain is often seen programming in Lisp

>> No.59333713

Lain is the entry level bro anime of deep shows like Python, Flip Flappers is the apex like Haskell.

>> No.59333729

so it's a complex tree without parent pointers

>> No.59333738
File: 18 KB, 480x360, hqdefault (4).jpg [View same] [iqdb] [saucenao] [google] [report]

Asm is Texhnolyze

>> No.59333769

My point it that it does not need to be a complex tree. This API would have been far easier to use, if it returned a struct with 2-3 tuple/struct array fields.

>> No.59333796

Paranoia agent: brainfuck

>> No.59333832

writing a compiler
it will have 1 (one) datatype a 32bit signed int
it will also have pointers, 32bit ints also

if you want to pass a char to a function, you pass an int from 0 to 256

if you want strings, well, you use arrays of ints and utilize bit operations to fit 4 bytes/int

this scheme is feasible write, no problem to write a "standard" IO library for such a language

>> No.59333864
File: 40 KB, 620x413, king autists.jpg [View same] [iqdb] [saucenao] [google] [report]

>blaming devs when devs have to pay to get in

>> No.59333870

Are you making Java?

>> No.59333901

>0 to 256

What the fuck?

>> No.59333903

> That Java dominance
Here's it's 50/50 .Net and Java stacks.
Makes for much funnier banter at meet-ups etc.

"Web Dev" is also up there.

>> No.59333923

the thing that will be the syntax looks like this currently, the language will be prettier but transformed to this

this takes two arguments, a and b
has 0 local storage(for local variables)
and returns the bigger one
in the language everything is an expression, so like rust

compile_function("max", [["a", "1"], ["b", "1"]],
["if", [">", "a", "b"], "a", "b"])

i will use an ascii table
actually 0 to 255, obviously

>> No.59333930

ActionScript looks like artwork from Rustle.

>> No.59333933

If you sort it you fuck up everything mate

>> No.59333950

>writing in a typesafe language in an ide on a mac

>> No.59333957

What do you guys think of ruby?

>> No.59333964

I don't like tripfags in overall.

>> No.59333970

Her favourite language is shit

>> No.59333973

.type max, @function
pushl %ebp
movl %esp, %ebp
movl 8(%ebp), %eax
pushl %eax
popl %eax
neg %eax
pushl %eax
movl 12(%ebp), %eax
pushl %eax
popl %eax
neg %eax
pushl %eax
popl %ebx
popl %eax
cmpl %ebx, %eax
popl %eax
movl %eax, %ebx
shrl $7, %eax
and $1, %eax
shrl $11, %ebx
and $1, %ebx
xor %eax, %ebx
pushl %ebx
popl %eax
cmpl $0, %eax
je else_clause_max_0
movl 8(%ebp), %eax
pushl %eax
jmp skip_else_clause_max_0
movl 12(%ebp), %eax
pushl %eax
popl %eax
movl %ebp, %esp
popl %ebp

here's the assembly
it has tons of "push %eax, pop %eax", but those are VERY easily optimized away later

i honestly can't remember what it does since i wrote most of the code months ago with 0 comments

but it's processing the "if" expression


>> No.59334005

microsoft donated the source code of DOS 1.0 to a museum, it's available for download and study. Check that.

>> No.59334025

// If submit with POST
if ($_POST) {
// Test for nothing entered in field
if ($_POST['firstName'] == "") {
$firstNameErr = "Error - you must fill in a first name";
$dataValid = false;
if ($_POST['lastName'] == "") {
$lastNameErr = "Error - you must fill in a last name";
$dataValid = false;
// If the submit button was pressed and something was entered in both fields, process data
// (we just print a mesg)
if ($_POST && $dataValid) {
Data is valid!
// If no submit or data is invalid, print form, repopulating fields and printing err mesgs
} else {
<form method="post" action="">
First name:<input type="text" name=firstName value="<?php if (isset($_POST['firstName'])) echo $_POST['firstName']; ?>"><?php echo $firstNameErr;?>
Last name:<input type="text" name=lastName value="<?php if (isset($_POST['lastName'])) echo $_POST['lastName']; ?>"><?php echo $lastNameErr; ?>
<br />
<input type="submit">

why is some text not in php tags when this is a php file?
what happens to the text that is not inside php tags

>> No.59334031

> out variables
Just fucking why.

Is there anything, anything at all, that these fuckers will not add to their language?

> touples
I'm kind of on the fence about this.
On the one hand they make some common use cases simpler. On the other hand, for production code that's going in a large enterprise system, you really should use separate classes for this, so that it's always semantically clear what you're getting in return.

Basically, instead of
return (4, 5);
you actually should return
return new Coordinates(4,5);

This does requires you to make a whole new class, but C# has decorators to make that shit fucking obvious.

And if you really need the speed, you have all sorts of disgusting tricks to do it fast regardless.

For quick and dirty exploratory code though, it seems really fucking nice.

> hardcore number crunching
> pushes GC to the limit
Stop generating garbage as much as possible.

Java has an unsigned int type.
It also has 8, 16, 32 and 64 bit signed int types, floats and doubles.

>> No.59334042

this is in reference to my apache server and php module

>> No.59334064

I was thinking of the language.

>> No.59334074

JavaScript isn't ADHD enough. I guess this was made back when the JS community was content with jQuery.

>best girl being worst language
Why is this allowed?

>> No.59334084

Try some implementation of Dijkstra's algorithm, searching for the longest path (in terms of number of nodes).

>> No.59334130

Learn how GC works. Reuse objects if you have to. Look into object pools.

Or just don't use Java for hardcore number crunching. It's like trying to use word when you really need libreoffice calc.

>> No.59334175

dijkstra is a shortest path algorithm and you can't use it to find longest paths even if you flip the weights to be negative

>> No.59334230

genetic evolution of fuzzy rules
please help they converge to quickly (probably to few rules and inputs)

>> No.59334264
File: 405 KB, 630x630, 1488993470343.png [View same] [iqdb] [saucenao] [google] [report]

>mfw nobody wants a Ada developer

>> No.59334289

>mfw no one on /g/ provided clear answer for this shitty problem for 2 days already

>> No.59334359

I can't think of anything that isn't bruteforce big-O(n!)

>> No.59334361

>clear answer
There has been plenty of clear answers. But nobody can explain well enough for a retard to get it.

>> No.59334384

I'm learning Python and I don't know why

>> No.59334391

>tfw reading Maximum length sequence wiki
>tfw don't get it
>tfw must mean I'm retarded
>tfw retarded

>> No.59334407

My condolences. But it's not that bad. You can become a prostitute.

>> No.59334437

Well I'm a JS dev just visiting from /wdg/.. I come here when I wanna feel dumb.

>> No.59334441

>JS dev
So you're already a prostitute..

>> No.59334457

>js dev
Top kek!

So you copypaste from stack overflow and glue frameworks together with spaghetti code

Fuck web """devs'""

>> No.59334478

Is it smart to run a tor exit node on your computer for plausible deniability about what you're searching for online?

>> No.59334494
File: 67 KB, 528x600, 54c86e3ebd-1486689444701.jpg [View same] [iqdb] [saucenao] [google] [report]

Hey /dpt/ do you guys know if theres a VM that allows you to see its memory?
Am writing a small os in assembly and its hell to write without knowing whats going on in the stack.

>> No.59334497

typedef struct list
int v;
struct list *n;
} list;

/* O(n^2) */
int findSequence( int *seq, int n, int **res )
int len = 1, *lengths, ind;
list *l;

allocArray(&lengths, n);
l = malloc(sizeof(list) * n);
memset(l, 0, sizeof(list) * n);

for (int i = 0; i < n; i++)
l[i].v = seq[i];

for (int i = n - 1; i >= 0; i--)
for (int j = i; j < n; j++)
if (l[j].v > l[i].v && lengths[j] >= lengths[i])
lengths[i] = lengths[j] + 1;
l[i].n = &l[j];

len = maxElement(lengths, n, &ind);

allocArray(res, len);

list *s = &l[ind];

for (int i = 0; i <= len; i++)
(*res)[i] = s->v;
s = s->n;


return len;

int main( void )
int *a = 0, n = 0, len = -1, *res = 0;

if (readSequence("muhSequence.2", &a, &n))

len = findSequence(a, n, &res);

for (int i = 0; i <= len; i++)
printf("%i ", res[i]);



>> No.59334498

I'd probably not ask here, but rather look at court cases similar to those you expect.

And I certainly wouldn't say that I'm planning to employ tactics to counter the judicial system on 4chan.

>> No.59334502

Just implement a hex dump function.

>> No.59334504

Make a 'sequence' array, initially empty.

Get a number from the input array, placing into every sequence into the sequence array where it is larger than the last element. Otherwise, make a new sequence in the array and make that the initial element.

Continue for all the numbers in the input array. Once completed, find the sequence in the sequence array with the maximum length.

for num in input
for sequence in sequences
if num > sequence[end]
sequence[end+1] = num

print(max(filter(\x: len(x), sequences)))

O(n) time, O(n^2) space.

>> No.59334512

I feel like your ISP would shut you down for all the sketchy plaintext stuff going on

>> No.59334513

>spaghetti code
It's getting better with frameworks that enforce better project structure.

>So you're already a prostitute
Yes, I'm a total whore for js

So how long have you guys been devs? What do you do? I'm wondering how different it is from my job

>> No.59334528

>So how long have you guys been devs?
You think people here have jobs? Hah, silly /wdg/.

>> No.59334532


Thats the thing I need to see it in real time because I keep getting a bug in qemu and virtualbox which only happens 50% of the time when testing on real hardware, its fucking bizarre.

>> No.59334533

I fucked up the pseudo-code. Forgot the bit to place the number in a new sequence if it couldn't put it in another sequence.

for num in input
placed = false
for sequence in sequences
if num > sequence[end]
placed = true
sequence[end+1] = num
if not placed
sequences[end+1] = [num]

print(max(filter(\x: len(x), sequences)))

>> No.59334562

never bring python pseudocode here again

>> No.59334571

In Javascript, is there a function that takes multiple arrays and combines them into one big array?

>> No.59334573

Use a debugger.

>> No.59334591

It's actually closer to MATLAB or Lua if you look at it. Besides the lambda of course.

>> No.59334612


Look it up on mdn

>> No.59334642

{9, 6, 2, 7, 4, 7, 6, 5, 8, 4}

() -> ((9)) -> ((9) (6)) -> ((9) (6) (2)) -> ((9) (6 7) (2 7))

we already lost (2 4 6 8)

>> No.59334651

O(n^2) time, consider {5,4,3,2,1}

>> No.59334685

You can do it in O(n) space. Keep a solution array of tuples/length 2 lists ect. From the back of the list, walk forward. For each item, search backward and find the maximum subarray length based on the current value, as well as the maximum sub array length index. Keep track of index with max 'length' as you walk backward to the front of the input, the just walk down the indices you collected for your max length subarray.

>> No.59334686

What a fail

>> No.59334694

It is O(n^2), but this

Anyway, your example would contain only
[[5], [4], [3], [2], [1]] because nothing is sequentially larger.

But yes, my off-the-cuff response wasn't correct. Oh well.

>> No.59334709


no way son

>> No.59334758

kinda did it here, yeah >>59334497
looks like O(n^2) time and O(n) space

wiki says that The Donald solved it in O(nlogn)

>> No.59334837
File: 22 KB, 683x462, problemwithrecursion.png [View same] [iqdb] [saucenao] [google] [report]

I fucking hate recursion. I can't follow wtf is going on. I'm trying to reverse a string with only the lower case letters in tact. Idk how to swap with last in the string cause not provided with the length.

>> No.59334860

if (*str == '\0')
str = str+1;

>if the end of the string, keep on going

>> No.59334862

>I fucking hate recursion

Recursion is a crutch used by bad programmers that can't properly form an iterative solution.

>> No.59334874

I'm trying to get my head around fuzzy logic, seems theres no one in the field that can explain it concisely without a load of fucking bullshit.

anyone know of any FL texts that aren't absolute fucking trash?

>> No.59334884
File: 111 KB, 1058x705, ree.jpg [View same] [iqdb] [saucenao] [google] [report]

>if (*str == '\0')
str = str+1;

>> No.59334886

Excellent bait

>> No.59334895

>using a meme this literally
poor form

>> No.59334897

Fuzzy logic, at it's heart, is extremely basic.

At the risk of oversimplifying:
Rather than saying it's "old" or "new", say how old it is. "Very old." "Somewhat new." Take these things and quantify them somehow in a meaningful way and make decisions based on this.

>> No.59334911

The example is wrong because it could be 2,4,7,8 as well as 2,4,6,8.

>it says maximum so it means sum.

No it doesn't. It says maximal sequence, which could mean length.

>> No.59334914

the non PHP text is just html
QEMU has this functionality IIRC. might be with some remote debug feature can't remember the details

>> No.59334915

i get that my dude, and all texts do make that very clear, its just when it comes to the fuzzy implication and defuzzification stages the writer's minds turn to sludge and they either gloss over details entirely or overload the reader with information

>> No.59334917
File: 488 KB, 1600x1048, almost male. somewhat female, I guess.png [View same] [iqdb] [saucenao] [google] [report]

>I'm trying to get my head around fuzzy logic

pic related

>> No.59334933

What is fuzzy logic used in? GC?

>> No.59334934

You're right, this example has multiple solutions and your solution would be found first if it starts from left to right

>> No.59334939

What is the difference between fuzzy logic and just a computation with numbers in a specific range?

If there is a case where I say, well I'm only 76% true that this is the case, why don't they just call it computation with floats?

>> No.59334953


>> No.59334956

Foundations Of Soft Case-based Reasoning - SANKAR K. PAL

They needed a buzzword to sell washing machines, its basically doing neural net encoding but without the neural net.

>> No.59334957

its more for translating human intuition to something a computer can handle. like how hard you press brakes based on your speed.

>> No.59334985

2 points :/
Hate Apple, Hate Ubuntu

>> No.59335001

i.e. are you going "fast" or "really fast" or "slow", how hard do you press? "EXTREME", "medium", "little" and so on. its best used when you dont fully understand the model used

>> No.59335069

If I want to learn about web development, backend and frontend what should I learn?

Should I go with python/django or Node/reactJS?

>> No.59335090

It's just passed in on the stack. It's pretty similar to getting the variables passed to a regular function.

>> No.59335123


>> No.59335149

I'm pretty sure that the loader places the values in the locations pointed to by argc and argv when the program loads. Just define them and the loader does the rest.

>> No.59335174

nvm this.


comes in as first and second arguments to the main func. lol.

>> No.59335189

Fuck all that noise. Fuzzy logic is like this: You take a set of [0, 1) inputs, and use the defuzzification method to find their location on the control surface, which is the set of rules you've laid out previously. For a two-input system, this looks like a 2D landscape with hills and valleys and shit. With 3 inputs, it looks like a 3D landscape, high and low but also wide and also tall.

For example,
Temperature: 0, .33, .66, 1 (cold, cool, warm, hot)
Speed: 0, .5, 1. (off, low, max)

When you pass in two values, it'll find how close those inputs are to the current rules, and then tell you which rules it's falling under: so you give it Temp .45, Speed .45, and based on the defuzzification method you use, it'll tell you which of those above values will fire. In this case, it'd be the second rule in Temperature and the second rule in Speed that fire.

If you get super complex you assign values to each pair of rules, and use the output values as your next input in some sort of controller.

>> No.59335252

Depends on the abi.
On amd64 sysv (i.e linux, bsd, mac) rsp points to argc and rsp+8 to argv on entry point.

>> No.59335265

Folks hate on python (they're fucking idiots), but you should check out skfuzzy: http://pythonhosted.org/scikit-fuzzy/ it'll show you everything you need to get an understanding of how it works. i don't like the way it's done, but it's clear and obvious and will teach you the principles.

>> No.59335307

Can someone explain how php sessions work, particularly through a proxy, and are they completely secure? The W3S site says they leave a key on your computer, yet they are different from cookies? Just can't wrap my tiny brain round it.

>> No.59335310
File: 32 KB, 412x430, 1484332469273.jpg [View same] [iqdb] [saucenao] [google] [report]

using System.Linq;
using System.Diagnostics;
using System.Collections.Generic;

namespace MaximalSequenceOfIncreasingElements {
public class Program {
public static List<List<int>> longest = new List<List<int>>();

public static void Main(string[] args) {

var elements = new List<int>() { 9, 6, 2, 7, 4, 7, 6, 5, 8, 4 };


public static void LongestSequences(List<int> elements) {
longest.Add(new List<int>());

for (var n = 0; n < elements.Count; n++) {
LongestSequences(new List<int>(), elements.Skip(n).ToList());

public static void LongestSequences(List<int> taken, List<int> remaining) {
var combined = taken.Concat(remaining).ToList();

if (Sorted(combined) && combined.Count >= longest.Last().Count) {
if (combined.Count > longest.Last().Count) {

for (var n = 0; n < remaining.Count; n++) {
LongestSequences(taken.Concat(remaining.Take(1)).ToList(), remaining.Skip(n + 1).ToList());

public static bool Sorted(List<int> elements) {
for(var n = 0; n < elements.Count - 1; n++) {
if(elements[n] >= elements[n + 1]) {
return false;
return true;

public static void Print(List<List<int>> elements) {
foreach (var element in elements) {

public static void Print(List<int> elements) {
foreach (var element in elements) {
Debug.Write(" ");

Ugly, slow, but works.

>> No.59335359

I've been learning about Selection sort algorithm and every single example i've seen uses some variable when they need to swap the numbers

Why no one does something simple as this:

for (int i = 0; i < arr.Length - 1; i++)
for (int j = i+1; j < arr.Length; j++)
if (arr[j] < arr[i])
temp = arr[i];
arr[i] = arr[j];
arr[j] = temp;

>> No.59335371

Emphasis on ugly. gj though

>> No.59335372


there has to be cleaner solution

>> No.59335388

Can you give an example of how others are doing it?

>inb4 python arr, arr[j] = arr[j], arr

>> No.59335398

wtf is this? c#?
kys my man

>> No.59335413

for example this
public void selectSort(int [] arr)
//pos_min is short for position of min
int pos_min,temp;

for (int i=0; i < arr.Length-1; i++)
pos_min = i;//set pos_min to the current index of array

for (int j=i+1; j < arr.Length; j++)
if (arr[j] < arr[pos_min])
//pos_min will keep track of the index that min is in, this is needed when a swap happens
pos_min = j;

//if pos_min no longer equals i than a smaller value must have been found, so a swap must occur
if (pos_min != i)
temp = arr[i];
arr[i] = arr[pos_min];
arr[pos_min] = temp;

or this

for (int j = 0; j < array_size - 1; j++)
min_key = j;

for (int k = j + 1; k < array_size; k++)
if (array[k] < array[min_key])
min_key = k;

tmp = array[min_key];
array[min_key] = array[j];
array[j] = tmp;

>> No.59335462

Why can't I seem to overload the "<<" operator on my struct?

#include <iostream>
#include <set>

struct Index
int xInd, yInd;
Index(int x, int y)
this->xInd = x;
this-> yInd = y;

bool operator<(const Index& rhs)
return (this->xInd < rhs.xInd);
std::ostream& operator<<(std::ostream& out)
out << "( " << this->xInd << ", " << this->yInd << ")\n";
return out;


int main()
Index i(5, 5);
std::cout << &i << std::endl;
return 0;

When I compile this, I get the following error: Invalid operands to binary expression ('const Index' and 'const Index')

in the file /usr/include/c++/v1/__functional_base:63:21
I have no idea what's going on

>> No.59335477

Which tutorial on the example page gives a good overview of Fuzzy Logic? All of them? I wanna check it out.

>> No.59335539

I'm listening.

>> No.59335549

not op but looking through, https://pythonhosted.org/scikit-fuzzy/userguide/fuzzy_control_primer.html seems good

>> No.59335563

thanks friendo, some of the things here look good. presumably thats because they're demonstrating them with code along the way and it forces correct descriptions of things

>> No.59335606

I wish i knew

>> No.59335651

Those are some good pages, but look out at the end of the control primer page, cuz it gives you the "old api" tutorial, and the "new api" tutorial is much better: http://pythonhosted.org/scikit-fuzzy/auto_examples/plot_tipping_problem_newapi.html

The underlying idea is you're finding out "how much" of a given rule an input falls under, and then computing what the output should be based on the inputs. That's the "fuzzy" part. So at the end of the tipping tutorial, it's saying "because the service was VERY GOOD (9.8), we're going lend significantly more weight to it's value than the quality, which was only slightly above average (6.5)."

This is what I meant when I said "control surface": http://pythonhosted.org/scikit-fuzzy/auto_examples/plot_control_system_advanced.html

>> No.59335654

Get to fucking work, boy.

>> No.59335655

//read data
int n = int.Parse(Console.ReadLine());
int[] arrayInt = new int[n];
for (int i = 0; i < n; i++)
arrayInt[i] = int.Parse(Console.ReadLine());
//find longest rising sequence
int[] sequenceLength = new int[n];
int[] previousInd = new int[n];
int bestEndInd = 0;
int maxCount = 0;
for (int i = 0; i < arrayInt.Length; i++)
int maxBefore = 0;
for (int j = 0; j < i; j++)
if (arrayInt[j] < arrayInt[i] && sequenceLength[j] > maxBefore)
maxBefore = sequenceLength[j];
previousInd[i] = j;
sequenceLength[i] = maxBefore + 1;
if (sequenceLength[i] > maxCount)
bestEndInd = i;
int arrayIntInd = bestEndInd;
int[] bestSequence = new int[maxCount];
for (int i = 0; i < maxCount; i++)
bestSequence[i] = arrayInt[arrayIntInd];
arrayIntInd = previousInd[arrayIntInd];
for (int i = 0; i < maxCount; i++)
Console.Write(bestSequence[maxCount - i - 1]);
if (i < maxCount - 1)
Console.Write(" ");

>> No.59335676

Reminder everyone can code, if you don't think so then you're a white male biggot.

>> No.59335710

>Anyone can code!
Not with those CS and math course dropout rates.

>> No.59335721

This only prints a single array. What if there are multiple solutions?

>> No.59335733


>> No.59335750

It didn't ask for multiple solutions

>> No.59335774

>everyone can code
I find it slightly racist that they put a black kid there. But I dunno maybe that's not racist, I'm sure they wouldn't be racist. There's no white people in the picture.
I'm very confused.

>> No.59335778

There's no way this works. What's the output for [1,9,2,3,4,5,6,7]?

>> No.59335784

Thanks for coming. Don't call us, we'll call you.

>> No.59335801

Actually it's UK people of modern times.

>> No.59335803

It does work. Output is 1 2 3 4 5 6 7, just as you would expect.

>> No.59335804

I don't think that makes any difference.

>> No.59335806


What kind of shit English is this?

>> No.59335820

im trying to loop through an array of JSON objects

i'm getting results but they're being repeated too many times. I should be getting only 3 results instead i get 100+. I even tested the query im using in the command line and it worked, so i know the query is fine.

var data = JSON.parse(this.responseText);
for (x in data)
for (i in data[x])
document.getElementById("resultList").insertAdjacentHTML("beforeend", data[x].Name + "<br />");

what went wrong?

>> No.59335843

ayy it works

>> No.59335889

/g/ butthurt: the problem

>> No.59335931
File: 39 KB, 367x458, 1474325720217.jpg [View same] [iqdb] [saucenao] [google] [report]

memesnek is the most worstest of popular languages around
meaningful whitespace was a mistake

>> No.59335933
File: 225 KB, 800x600, image.jpg [View same] [iqdb] [saucenao] [google] [report]

Write a function that accepts an array of 10 integers (between 0 and 9), that returns a string of those numbers in the form of a phone number.

createPhoneNumber([1, 2, 3, 4, 5, 6, 7, 8, 9, 0]) // => returns "(123) 456-7890"

My attempt:
function createPhoneNumber(numbers){
let str = "";
for (var i=0;i<numbers.length;i++) {
if(numbers.indexOf(i) === 0) {
str += "(";
if(numbers.indexOf(i) === 3) {
str += ") ";
if(numbers.indexOf(i) === 6) {
str += "-";
str += numbers[i];
return str;

Produces error:
Expected: '(123) 456-7890', instead got: '1(234) 567-890'

Why is this the case when I did:
if(numbers.indexOf(i) === 0) {
str += "(";

Inb4 homework, it's just a challenge I'm working on at codewars

>> No.59335945

Modules are type classes

>> No.59335986

what the fuck are you doing

>> No.59335995
File: 1.78 MB, 1280x720, miyako_code.png [View same] [iqdb] [saucenao] [google] [report]

This was made back when I only knew C++, Python and Mathematica.

>> No.59336006

Maybe try of instead of in.

>> No.59336010

let createPhoneNumber = n => `(${n.slice(0,3).join('')}) ${n.slice(3,6).join('')}-${n.slice(6).join('')}`

>> No.59336013
File: 28 KB, 380x380, image.jpg [View same] [iqdb] [saucenao] [google] [report]

i-it should probably be a foreach r-right?

>> No.59336014

Friendly reminder that ownership is monadic :^)

>> No.59336024

In C this would just be
void createPhoneNumber(int* numbers){
printf("(%d%d%d) %d%d%d-%d%d%d",
numbers[6],numbers[7], numbers[8],numbers[9]);
//altenatvely use sprintf

But if this were C you'd probably be given a different assignment. C makes programming too easy for class in many cases.

(most languages replicate sprintf or printf in some form, unless it's forbidden it's wise to use formatting functions for string processing)

>> No.59336039

Less powerful than that. Everything you can do with substructural types, you can do with a spin on good old algebraic effects.

>> No.59336052

>missed a %d
>get a runtime error.
Well shit.
"(%d%d%d) %d%d%d-%d%d%d%d"

As the format string obviously.

>> No.59336054

numbers.indexOf(i) will give you the index of i. So when i == 0 numbers.indexOf(i) == 9.
You want if (i == 0)

>> No.59336069


i figured out. I actually started with that code from a stackoverflow answer. But he was retarded since you don't need nested for loops to loop through an array of objects.

correct code is:

for (x in data)
document.getElementById("resultList").insertAdjacentHTML("beforeend", data[x].Name + "<br />");

>> No.59336076

yeah my whole method was wrong i realize i should have went with a foreach

this anon thinks outside the box though
t-thanks senpai

>> No.59336081 [DELETED] 

In [5]: alist = [1, 2, 3, 4, 5, 6, 7, 8, 9, 0]

In [6]: result = "(123) 456-7890"

In [7]: def create(l):
...: return '({}{}{}) {}{}{}-{}{}{}{}'.format(*l)

In [8]: create(alist)
Out[8]: '(123) 456-7890'

In [9]: def create(l):
...: builder = ''
...: for idx, num in enumerate(l):
...: if idx == 0:
...: builder += '('
...: elif idx == 3:
...: builder += ') '
...: elif idx == 6:
...: builder += '-'
...: builder += str(num)
...: return builder

In [10]: create(alist)
Out[10]: '(123) 456-7890'

>> No.59336097

for loop is fine here because you want the index in addtion to the element. I personally dont like using indexOf at all because it has strange results when a number appears multiple times

>> No.59336099

Really? I don't remember seeing that.

>> No.59336101

In [5]: alist = [1, 2, 3, 4, 5, 6, 7, 8, 9, 0]

In [6]: result = "(123) 456-7890"

In [7]: def create(l):
...: return '({}{}{}) {}{}{}-{}{}{}{}'.format(*l)

In [8]: create(alist)
Out[8]: '(123) 456-7890'

In [9]: def create(l):
...: builder = ''
...: for idx, num in enumerate(l):
...: if idx == 0:
...: builder += '('
...: elif idx == 3:
...: builder += ') '
...: elif idx == 6:
...: builder += '-'
...: builder += str(num)
...: return builder

In [10]: create(alist)
Out[10]: '(123) 456-7890'

>> No.59336104

What do you mean? Is it non-deterministic?

>> No.59336105

Lain often evades memory

>> No.59336119

>strange results
bruh, it's not strange, it's simple: it returns the first index. that's it. don't use indexof if you could possibly have multiple elements of the same value, unless you absolutely want the first.

>> No.59336121

typically its the index first element but it varies between languages so I always need to look it up and sometimes i want the second element. plus its a somewhat costly operation so its best to avoid it

>> No.59336188

Is it possible to receive calls and sms messages on a pc with some sort of a usb sim card reader?

>> No.59336223

There's such a thing on aliexpres for 2.5$.
"USB SIM Card Reader Adapter Mobile Phone SMS Edit Copy Backup GSM CDMA Blue"

>> No.59336262


>> No.59336305

I don't give a shit about the data sim card holds.
I want to programmatically handle sms and calls live.

>> No.59336370

operator<< should take an ostream on the left hand side and your own type on the right. right now you got it the wrong way around.
try this:
friend auto& operator<<(std::ostream& out, const Index& i) const
out << "( " << i.xInd << ", " << i.yInd << ")";
return out;

needs to be "friend" since it's not a member function. but you can still define it inside your struct.

also don't put a newline in your operator<< for no reason.

std::cout << &i << std::endl;

you're only printing the address of your struct there.

>> No.59336386

Ada's not good for Pajeet. Pajeet finds it difficult to use a real type system.

>> No.59336484

>real type system
Ada can do barely any checking statically, though.

>> No.59336520

That's not what a compiler is for

>> No.59336522

Years of type theory research disagree with you.

>> No.59336541

by the way there's no reason to use "this->" everywhere, unless you're inheriting from some other type. and your constructor can be simplified by avoiding assignment:
int xInd, yInd;
Index(int x, int y): xInd(x), yInd(y) { }

doesn't really matter for plain integers, but you should get used to using this method. when initialization order matters, or your variables' types don't have a default constructor, or assignment is expensive (involves copying), this is the only way to do it.

>> No.59336542

It's what analysis tools are for.

>> No.59336551

Why have a separate analysis tool when the compiler can do it and use the increased information to perform more optimizations?

>> No.59336590

Cause the compiler already assumes the best. The analysis is so you can trust the compilers choices.

>> No.59336619

In order for that to be practical you need to have an intermediate language that has all the annotation capabilities of the typed language (e.g. a language without linear types but with restrict), and the analysis tools should convert from one to the other.

Why bother when you can just do it all with one language, one type system, and one tool?

>> No.59336623

That's the dumbest shit I've ever heard.

>> No.59336652

No one's stopping you to do that with any language. Why do you think that's language specific for some reason?

>> No.59336690

The point is, Ada doesn't have a good type system. It relies on the programmer doing a ton of proving in some other language like Coq or whatever and then turning off the dynamic checks that Ada does automatically in order to get a verified and fast program. It's a massive gain in productivity to just do it all at once instead of with different languages and tools like this.

>> No.59336723

How can I make it so the function will start printing out the first set of dashes. Like right now it only prints 3 dashes, i want to start from a defined # of dashes then move from there. Using recursion.

void triangle(int a, int b)
//Base Case - Reach beginning value again
//Recursively increase length of dashes until reach max
//When reach max, we decrement until reach beinning value again

if (a == b)

//Recursive Case
cout << "-" ;
triangle(a + 1, b); //A++ until get to amount of B then reroll, B stays the Same

/*Should look Like:

int main()

int a = 4;
int b = 7;
triangle(a, b);

>> No.59336725
File: 38 KB, 434x541, image.jpg [View same] [iqdb] [saucenao] [google] [report]

I'm back and requesting help with another codewars challenge...

Given: an array containing hashes of names

Return: a string formatted as a list of names separated by commas except for the last two names, which should be separated by an ampersand.

list([ {name: 'Bart'}, {name: 'Lisa'}, {name: 'Maggie'} ])
// returns 'Bart, Lisa & Maggie'

list([ {name: 'Bart'}, {name: 'Lisa'} ])
// returns 'Bart & Lisa'

list([ {name: 'Bart'} ])
// returns 'Bart'

// returns ''

The following solution works except that it produces the error.
function list(names){
let str = "";
for(var i=0;i<names.length;i++) {
if( names[i].name != names[names.length-1].name &&
names[i].name != names[names.length-2].name) {
str += `${names[i].name}, `;
} else if (names[i].name === names[names.length-2].name) {
str += `${names[i].name}`;
} else {
str += ` & ${names[i].name}`;
return str;

>> No.59336729

Ada's type system is great. Just because the compiler doesn't require you to put if statements around every single arithmetic operation doesn't mean it's poor.

>> No.59336743

>The following solution works except that it produces the error.
produces the error in the image.jpg

>> No.59336751

What can the type system do more so than, say C++?

Yeah you can specify invariants for your types but these don't participate in type checking at all, they're just done periodically at run time. You can prove these invariants externally and switch off the dynamic checks, but you don't use Ada to do so.

>> No.59336815

Ada actually facilitates such a concept in real, valid Ada standard syntax.

Typing allows the compiler to do some optimization, by removing checks that are not necessary.

More obvious information to the user what the pre contact and post contact and global side effects of a function are.

Guaranteed failure for logical errors pertaining to type limits.

>> No.59336838

I'd do it like this.
function list(nameArray){
if (!nameArray || nameArray.length == 0) {
return '';

if (nameArray.length == 1) {
return nameArray[0].name;

let lastName = nameArray[nameArray.length - 1].name;
let otherNames = [];
nameArray.forEach((name) => {

return [otherNames.join(', '), lastName].join(' & ');

I'm not up to date with ES6/7 so I'm sure there's some fancy new methods to shorten this.

>> No.59336895

I ordered a M590E GSM kit.
I haven't looked into it yet but you could start with that.

>> No.59336905

I forgot to remove the lastName from the array, so use
let lastName = nameArray.pop().name;

>> No.59336923

>Typing allows the compiler to do some optimization, by removing checks that are not necessary.
If the compiler can determine that they are redundant. This involves the compiler being more complex, taking longer, and still not being able to do as much as a human can. That's where the external proofs come in.

>More obvious information to the user what the pre contact and post contact and global side effects of a function are.
And these are checked dynamically for the most part. This is worse than checking statically for all the same reasons you want a static type system over a dynamic type system. A stronger type system essentially lets you turn more dynamic checks into static verification.

>Guaranteed failure for logical errors pertaining to type limits.
Again, done dynamically except for constants.

>> No.59336956


>> No.59336967

dark themes btfo

>> No.59336979

s = '({0}{1}{2}) {3}{4}{5}-{6}{7}{8}{9}'
x = [1, 2, 3, 4, 5, 6, 7, 8, 9, 0]
print s.format(*x)

>> No.59336984

the session ids are stored in a cookie.

>> No.59337018

The redundancies are noticed by the type system, so no extreme complexity.

Most of them are yes, but the user will be less likely to send bad values to a function specifically requesting certain numbers. Since Ada is strongly typed, and with the added information, giving a function bad data is rare.

Miles better than C++, which is what you asked for. And can be statically checked trivially, as far as the user is concerned.

>> No.59337022

All this being said, Ada does do a good job of helping programmers to verify their programs externally, much more than most languages. You simply can't beat having a high degree of static verification as part of the language itself.

>> No.59337043

I don't know if I'd call the type system itself much better than C++. The facilities for dynamic checking are way better (C++ has assertions and that's it) but, again, not the type system itself.

>> No.59337051

Anyone else here working on classified military projects with Haskell and Assembly?

>> No.59337103

help pls. :>

>> No.59337125

If you're not doing anything fancy with the order of the inputs, you don't have to numerically label each of your brackets.

>> No.59337153

The dynamic checking is so good BECAUSE of the type system. Ada also lends itself to static verification, from the very start, 30 years ago.

>> No.59337169

Thanks for the response!

Unfortunately, the code you provided gives the same error... I'm thinking of just asking StackOverflow if I can't get this by a couple of hours from now

Bit of a follow up question, why can't I declare the << operator as a member function? Like, why would I need to add the "friend" keyword

>> No.59337186

>Ada's type system is great
Does it have dependent types?

>> No.59337248


>> No.59337255

Demonstrate it.

>> No.59337277


>> No.59337281

>dependent types
I have still never seen a valid use for these in my entire life.

>> No.59337333

They are a minimal requirement for a type system to be considered non-garbage.

>> No.59337366

>They are a minimal requirement for a type system to be considered non-garbage.

>> No.59337384

any good sources on learning design patterns/algorithm shit?

... preferably with js ;o

>> No.59337387

Because anything which doesn't have them is pretty much untyped as far as I'm concerned.

>> No.59337397
File: 51 KB, 410x640, 219-hindi%20through%20english.jpg [View same] [iqdb] [saucenao] [google] [report]


>> No.59337401

no, java is trash, redditor. leave. just fucking leave and spare yourself from further embarrassment.

>> No.59337406

But why?

You haven't explained at all, you just keep saying that they are required, without justifying it.

>> No.59337414


go to fucking wdg

>> No.59337451

I'm writing a python program which teleoperates a small radiotelescope and uses the measurements to draw a map of the milky way.

The choice of python is mainly because of libraries and compatibility with telescope hardware. I am getting a bit annoyed at python's crippled lambdas and map/filter/fold functions though.

>> No.59337479


public class Triangle {

public static void main(String[] args) {
triangle(1, 7);

static void triangle(int a, int b) {
// Base Case - Reach beginning value again
// Recursively increase length of dashes until reach max
// When reach max, we decrement until reach beinning value again

if (a == 0) {

if (a == b) {
a = -a + 2;

// Recursive Case
for (int i = 0; i < Math.abs(a); i++) {

triangle(a + 1, b); // A++ until get to amount of B then reroll, B
// stays the Same


>> No.59337491

>But why?
They allow less programs which have errors (obvious or otherwise) to pass type-checking.

I didn't claim they were "required". I'm just that anything that doesn't have them might as well be completely typeless (aka garbage) as far as I'm concerned.
So they are a barrier of sorts, a pleb filter.

>> No.59337507

you embarrassed yourself pretty heavily with that post desu

>> No.59337524

_<_ : Nat -> Nat -> Prop
_ < zero = False
zero < succ _ = True
succ m < succ n = m < n

Array : Set -> Nat -> Set
Array A zero = Unit
Array A (succ n) = A * Array A n

Index : Nat -> Set
Index n = (i : Nat) * (i < n)

subscript : {n : Nat} -> Array A n -> Index n -> A
subscript {zero} () (_, p) = absurd p // this case can never come up because (_ < 0) is false (uninhabited)
subscript {succ n} (a, _) (zero, _) = a
subscript {succ n} (_, as) (succ i, p) = subscript as (i, p)

>> No.59337543

Fuck off, Rajesh. You sperged out for literal months wrapping your poo-in-loo "buu huuu animoooooooooo" statements in code blocks for every thread.

>> No.59337566

What language? Agda? Should I learn it or Idris?

>> No.59337572

Pseudo-Agda. Learn Idris.

>> No.59337613

If someone duplicated your cookie with the session id in could they not trick the site into thinking they have logged in/ it's their session?

>> No.59337634

I don't know what you are talking about, just hope you know that js and java are different things anon.

>> No.59337683

Not at all, just repeat after me:
>would you like fries with that?

>> No.59337733

>They allow less programs which have errors (obvious or otherwise) to pass type-checking.
Why would this be a good thing?

>> No.59337771

Why wouldn't it? Did you misread it or something?

>> No.59337785

The only thing you need to believe to accept that it's a good thing is the following: errors are undesirable.

>> No.59337798

Are you retarded?

>> No.59337825

>Yes I shit on streets so what?

>> No.59337866
File: 107 KB, 613x533, 1341619539905.jpg [View same] [iqdb] [saucenao] [google] [report]

>Programs doing what you specifically don't want is ok

>> No.59337873


>> No.59337890

Reading this.
It's really good.

What's with the ':)' though? They're everywhere and it looks so condescending all the time.

>> No.59337892

This is close, but it seems can never get to base case of a==0. End up getting a stack overflow. Thank you though, getting much closer.

>> No.59337954


>not at all

JS is weakly, dynamically typed, and is run directly from source, which is JIT compiled into native code. The same program that does lexing and parsing of grammar is the same program that does native code generation.

Java is strongly, statically typed, and is compiled into bytecode, which is then JIT compiled by a VM into native code.

In JS, a prototype model is used instead of a class model for object creation, as opposed to Java, which is strictly class-based. Moreover, JS allows for free functions, whereas in Java, if one wants a free function, one must instead create it as a static method.

JS was designed to run inside of a web browser, and to cause as few errors as possible. As a result, it lets a lot of "funny business", like adding strings and integers together, or subtracting a string from an array, and returning NaN, a float. Java, by comparison, was designed to run inside a virtual machine, and will throw exceptions like it is nobody's business. It will also hit you with compiler errors if you try to do certain things that shouldn't make sense to begin with.

These are VERY different languages, and you are a moron for believing that there is any similarity aside from the first four letters of their names. And incidentally, JavaScript isn't even the proper name for the language anyways, it's ECMAScript.

>> No.59338042

>Design patterns are spoonfeed material for brainless programmers incapable of independent thought, who will be resolved to producing code as mediocre as the design patterns they use to create it.
-Christer Ericson, Currently VP of Technology at Activision (the company that owns Blizzard) who has a very technical background and has written Real-Time Collision Detection.

The only reason to learn design patterns is if you want to work with losers.
>... preferably with js ;o
So yeah. Go learn design patterns I guess.

>> No.59338060
File: 103 KB, 400x400, 1458993598219.png [View same] [iqdb] [saucenao] [google] [report]

baited for this exact response

>> No.59338097

I am fucking around with making a browser game and trying to identify what is giving me framerate issues. I created a test page that gives me pretty much the same results. IE and Chrome give me close to 60 FPS while bouncing around a bit. But FF 52 gives me a framerate at a steady rate of <10 FPS. I know FF is shit, and Javascript is shit, but this is unacceptable. I am not using requestAnimationFrame because I figured it shouldn't be required for my shitty game.

// Framerate testing
var canvas;
var context;

function drawFramerate(framerate) {
context.fillStyle = "rgb(255, 0, 0)";
var text = framerate.toFixed(2);
context.fillText(text, (canvas.width / 2) - (context.measureText(text).width / 2), (canvas.height / 2) - 10);

function loop() {
var t = window.performance.now();
var execution_time = window.performance.now() - t;
var framerate = 1 / execution_time;
setTimeout(loop, 0);

function update() {

function draw() {
context.clearRect(0, 0, canvas.width, canvas.height);

window.addEventListener('load', function() {
canvas = document.getElementById('gcanvas');
context = canvas.getContext('2d');

>> No.59338112

What language?

>> No.59338128

you sound like you're a great guy to hand out with

>> No.59338137


>> No.59338150

Logical thinking has a direct correlation with IQ.

>> No.59338171

My entire post is pretty much just the quote.

>> No.59338174

I disagree vehemently.

>> No.59338217


>> No.59338229
File: 50 KB, 512x509, 1484669762267.jpg [View same] [iqdb] [saucenao] [google] [report]

I'm working on a front end to ZFEC that is meant to be a kind of back up system. I posted my repo in the last thread for someone but he apparently left before I posted.

If anyone is interested in checking it out I'll repost the github repo for it. shit is gpled obviously

>> No.59338241

don't use settimeout but requestanimationframe to do your main loop

>> No.59338290

Same results.

>> No.59338301

Programming is shit.

>> No.59338312

I don't care for Javascript or people who think it's a good idea to learn javascript. Or people who use design patterns and think they're a good idea. Doesn't particularly make me a bad person to hang out with though.
Implicit in this is that I don't like people who don't think. Since it's not hard to come to these conclusions if you look at the programming industry just a little bit.

Perhaps people who give a shit aren't "fun" for you. But that doesn't say either of us are particularly bad people to hang out with. We're just not interested in the same things.

>> No.59338340

just tried this:
#include <iostream>

struct Index
int xInd, yInd;
Index(int x, int y): xInd(x), yInd(y) { }

bool operator<(const Index& rhs)
return (xInd < rhs.xInd);

friend auto& operator<<(std::ostream& out, const Index& i)
out << "(" << i.xInd << ", " << i.yInd << ")";
return out;

int main()
Index i(5, 5);
std::cout << i << std::endl;
return 0;

compiles fine here with gcc 6.3.

operators with two arguments are non-member functions. that's just the way things are. member operators (with a single argument) imply the struct type is on the left hand side of the operator, with the argument on the right.
normally you would define a non-member operator outside the struct, but you can't access private data in a non-member function. that's why you need to declare the function as a "friend" of your class. from there, you can define the function body inside your struct as well, even though it's technically not a member of your struct.

>> No.59338342
File: 38 KB, 1152x1018, triangle.png [View same] [iqdb] [saucenao] [google] [report]


works fine for me

>> No.59338366
File: 44 KB, 672x888, haskell-book.png [View same] [iqdb] [saucenao] [google] [report]

Is good?

>> No.59338368
File: 239 KB, 372x508, 1484966990277.png [View same] [iqdb] [saucenao] [google] [report]

Why do you use a struct in a C++ program?

>> No.59338384

Why not?

>> No.59338392

The only difference between struct and class in C++ is the default visibility.
//is like a

>> No.59338393
File: 94 KB, 500x275, 1466800367189.gif [View same] [iqdb] [saucenao] [google] [report]

Because it has objects, and it is an object oriented programming language

>> No.59338400

interesting. Few more questions, after the session ends is the cookie deleted? is the session id deleted? is it only deleted under certain circumstances? What actually generates the session ID, and how?

>> No.59338404

I prefer the wikibook.

>> No.59338405

structs can't polymorphism

>> No.59338406

because OOP is a mistake

>> No.59338411

write fizzbuzz in smalltalk then try telling us that c++ is "object oriented language"

>> No.59338422

Completely wrong

>> No.59338429

It's a multi-paradigm programming language.
>it has objects
It has classes..
>it's an OOP language
Most would say you "can do" OOP in C++ but it's not really an OOP language.
Polymorphism has to do with virtual functions..

>> No.59338438


>> No.59338448

No, use the wikibook

>> No.59338449

I suggest you take a C++ program and change the classes to structs with private: at the top of them. See what breaks.

>> No.59338531
File: 233 KB, 520x423, 1472919571125.png [View same] [iqdb] [saucenao] [google] [report]

If classes and structs are exactly the same, why do they both exist?

Why not just pick one (probably structs in this case because C had them too) and remove the other?

>> No.59338533
File: 43 KB, 1288x485, foxfps.png [View same] [iqdb] [saucenao] [google] [report]

you aren't measuring fps but how long it takes to execute your functions.
if you look at the browsers frame rate you can see all of them rendering at 60fps doing your loop.


>> No.59338543

Fuck off furfag

>> No.59338547

Structs have no tools to prevent access to internal data from outside.

>> No.59338549

What's the best laptop on the market right now for programming?

>> No.59338558
File: 94 KB, 482x641, heresy.jpg [View same] [iqdb] [saucenao] [google] [report]

Anon if you start asking such heretical questions you might begin to understand that C++ is not a good language.
I advise you to stop.

>> No.59338560


>why would you want this

>> No.59338572

They do.
in your struct.

>> No.59338574
File: 1.18 MB, 1524x1208, ayyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy.jpg [View same] [iqdb] [saucenao] [google] [report]


>> No.59338583

I don't get this data hiding meme. If everything is properly documented and properly written, why would it matter that every object can access it's children's data?

Don't you trust the people working with your code (often that's just you) enough to not abuse the variables you mark as "DO NOT CHANGE BUT FEEL FREE TO ACCESS"?

>> No.59338585

any laptop, as long as it has a buckling spring keyboard.

>> No.59338592

php sets a session cookie, once you close the browser the browser forgets those.
php generates the id.
php has no knowledge when you close your browser, but sessions have a timeout, once it runs out and no request has been made by that id php forgets it.

go look in their source code how they generate it.

>> No.59338598



Might as well just carry my desktop around.

Isn't there anything compact and semi-powerful?

>> No.59338619

New thread:


>> No.59338628

That's the OOP meme. You encapsulate things to ensure the users of your objects are accessing your data "correctly".

It's not a good idea. But that was the idea. If you want the favorable argument there's plenty of OOP preachers all over the internet. I'm not gonna repeat it.

>> No.59338640

Compact and programming doesn't mesh well imo. You need a good keyboard.

>> No.59338643

Whatever, I don't know C++

>> No.59338660

Kinda rude to mislead someone about it then but it's only a drop in the bucket of the confusion he has to face with C++.

>> No.59338679

I tried to answer from my knowledge standpoint.
You were more clever, I'm wrong.
Sorry me please.

>> No.59338694

No problem. But when I'm uncertain and tell people things I generally make it clear I'm uncertain.

>> No.59338719

I was certain that that is the main difference of C++ classes from C structs.

>> No.59338740

Yeah sure, we all make mistakes.

>> No.59339460

what is the purpose of that comma?

>> No.59339811

Thanks! I found out that there were actually two issues! One was that I was compiling with C++11 instead of C++14 (how I didn't figure this out sooner speaks to my lack of programming experience), and the other was kind of weird

I had a function that adds Index instances to a set (I had the '<' operator overloaded), but when I ran it, it would give me the "Invalid operands to binary expression" error.

I changed the '<' operator from :
bool operator<(const Index& rhs)
return (xInd < rhs.xInd);

friend bool operator<(const Index& lhs, const Index& rhs)
return (lhs.xInd < rhs.xInd);

And now it works! Would you happen to know why making '<' a non-member operator took away this error (even though in both cases I had const Index instances?)

Thanks for all the help, though!

>> No.59340447

oh that's odd. I don't immediately see any problems there. the const thing may have something to do with it, even though I don't think that matters when comparing integers.
you could try declaring the operator function const too, eg:
bool operator<(const Index& rhs) const

which should make the implicit "this" pointer a "const Index*" so you would be comparing two const integers. again I don't really see how that matters here.

>> No.59340661

Less than requires two arguments you big dummy

Friendship doesn't matter

Name (leave empty)
Comment (leave empty)
Password [?]Password used for file deletion.