[a / b / c / d / e / f / g / gif / h / hr / k / m / o / p / r / s / t / u / v / vg / vr / w / wg] [i / ic] [r9k / s4s / vip / qa] [cm / hm / lgbt / y] [3 / aco / adv / an / asp / bant / biz / cgl / ck / co / diy / fa / fit / gd / hc / his / int / jp / lit / mlp / mu / n / news / out / po / pol / qst / sci / soc / sp / tg / toy / trv / tv / vp / wsg / wsr / x] [Settings] [Home]
Board
Settings Home
/g/ - Technology



Thread archived.
You cannot reply anymore.



File: learnkotlin.jpg (282 KB, 934x1000)
282 KB
282 KB JPG
Last thread: >>64110006

What are you working on, /g/?
>>
c++ is the greatest language of all time
>>
r*st is trash
>>
>>64114166
>>
>>64114135
wait can java be used in a similar way as javascript. ie... for responsive websites
>>
>>64114207
>ie... for responsive websites
What?
>>
typedef struct foo {} foo;

or
typedef struct {} foo;
>>
ive started to learn python. i like the way typing fast in a text editor feels so i have been typing lines of print('random text') over and over, with some if/else loops thrown in. how long do i have before my autism goes terminal and i die a virgin?
>>
>>64114275
data class Foo()
>>
I'm mastering the art of matlab scripting, where 4 dimensional arrays are nothing to fear of!
>>
File: haskell.jpg (220 KB, 676x676)
220 KB
220 KB JPG
>>64114323
>before my autism goes terminal and i die a virgin?
You still have a long way to go.
>>
reminder to report and ignore shitposting
>>
Rate my sieve, /g/

sieve = (n) => {
let range = (n, step=1) => Array.from({length: Math.floor(n/step)}, (_, i) => i*step);
let candidates = range(n).splice(2);

candidates.slice(0, Math.floor(Math.sqrt(n))).forEach((i) => {
if (i != 0) {
range(n, i).slice(2).forEach((j) => {
candidates[j-2] = 0;
});
}
});

return candidates.filter((i) => i != 0);
};

sieve(100).forEach((i) => console.log(i));
>>
Thoughts on the Carp language?

>A statically typed lisp, without a GC, for high performance applications.
Carp is a small programming language designed to work well for interactive and performance sensitive use cases like games, sound synthesis and visualizations.

>The key features of Carp are the following:

>Automatic and deterministic memory management (no garbage collector or VM)
>Inferred static types for great speed and reliability
>Ownership tracking enables a functional programming style while still using mutation of cache-friendly data structures under the hood
>No hidden performance penalties – allocation and copying are explicit
>Straightforward integration with existing C code
>>
>>64114415
very functional of you
>>
>>64114442
Thank you, that was my intention.
>>
>>64114415
Have a bug:
sieve = (n) => {
let range = (n, step=1) => Array.from({length: Math.floor(n/step)}, (_, i) => i*step);
let candidates = range(n).splice(2);

candidates.slice(0, Math.floor(Math.sqrt(n))).forEach((i) => {
if (candidates[i] != 0) {
range(n, i).slice(2).forEach((j) => {
candidates[j-2] = 0;
});
}
});

return candidates.filter((i) => i != 0);
};

sieve(20).forEach((i) => console.log(i));
>>
File: yuki03.png (1.2 MB, 1592x3216)
1.2 MB
1.2 MB PNG
>>64114135
Need different /dpt/-girl images with better books.
>>
>>64114720
>>64114135
BRING BACK THE TRAPSS!!!!!!
>>
>>64114795
>'no'
>>
I finished 2048 in C.
That was fun.
>>
I have an SQL table that has a column for month and a column for year. How do I write a where clause that excludes the current month/year combo?
This was my initial attempt but obviously it will exclude all results from 2017 and all results from month 12:
SELECT * FROM table WHERE year != 2017 AND month != 12;
>>
>>64114428
let me know when it hits 0.5 atleast
>>
>>64114901
https://pastebin.com/T2HKrQy7
i'm assuming linking it would be more helpful
>>
>>64114980
SELECT * FROM table WHERE not (year = 2017 AND month = 12);
>>
>>64115035
thanks!
>>
File: background13.jpg (172 KB, 1308x1006)
172 KB
172 KB JPG
>higher rank polymorphism and quantification require explicit type/proof applica-
*blocks your path*
>>
>>64115024
not portable 3/10 see me after class
>>
>>64115091
>gay typefag math stuff
*ignores it and actually writes programs*
>>
who /poopgramming/ here?
I'm on the toilet right now lol
>>
>>64114428
It's a toy at best. No namespaces, no macros, overly simplistic linear type system, typechecking happens AFTER monomorphization (like C++). There's absolutely nothing novel about it
>>
>>64115128
>it takes him longer than 30 seconds to poop
eat some fiber senpai
>>
>>64115128
I'm more of an /a/ pooper. There's so many poop shows that are only worth my poop time.

Also my laptop sucks for toilet programming.
>>
>>64115091
Based Dunfield-Krishnaswami type inference
>>
>>64115113
>trying to get terminals to not buffer input on multiple platforms
no thanks, i don't want to have to deal with that shit
>>
>>64115172
It's called bidirectional typing nerd.
>>
>>64115124
this
>>64115091
seriously, why bother typesetting confusing math notation when you can type 2 paragraphs in plain english and say the same thing in half the time?
>>
>>64115185
Well yes, but it also does some other neat stuff like hindley-milner-esque unification in the subtyping relation

>>64115198
>why bother typesetting confusing math notation when you can type 2 paragraphs in plain english and say the same thing in half the time?
Because it would take a lot of paragraphs to explain this algorithm (the paper comes with plenty of text, if you'd like to read it :) ), and the math notation isn't very confusing if you're used to reading it. Consider it just a form of densely-abbreviated code
>>
>>64115158
>not pooping and just staying on the toilet for an hour
>>
>>64114720
This is actually kind of cute, would SICP if I could.
>>
>>64115158
I've tried that
I even added fiber supplement to my beverages every day for a few months
it doesn't work
>>
File: dijkstra works.png (39 KB, 669x562)
39 KB
39 KB PNG
i've finally fucking got my dijkstra implementation to work. Just need to find a way to draw it now.

shout out to those two posters who helped out.
>>
>>64115309
nice
now implement flocking/swarming behaviour
>>
>>64115309
I don't know your exact problem but the first thing with your image that comes to mind is A*, not dijkstra.
>>
Birbs can be taught to talk, can they be taught to program?
>>
is it possible in C to know the range of returned address from malloc?
I made a function that call malloc, then do something else.
But if another part of the code fails, the function will free the memory, then returning another value as error code.
void * somecode(){
void * retval;
char fail;
retval = malloc(sizeof(sometype));
fail = 0;
if(!retval)
{
return 0;
}
//initialize the object;
if(fail)
{
return 1;
}
return retval;
}
//the function that call somecode() now need to check whether it return a nullpointer or a pointer to address 1;


But i don't know whether by any chance malloc could return the address 1 itself, so the caller program interpret it as fail.
Is there any way to know the range of address that will be returned by malloc?
>>
>>64115309
>not 4,0/3,1/2.2
>>
>>64115336
A* is dijkstra's algorithm with a heuristic
>>
>>64115336
If you want to find all shortest paths up to a certain cost (e.g. for movement in a tactics game) then you use Dijkstra.
>>
>>64115359
I know, but it seems he's looking to move somewhere. The heuristic is simple in this case, distance.
>>
>>64115309
What exactly is the problem? Align first by Y or X and then just go up/down/left/right until the target?
>>
>>64115336
you select a little solider and select a tile in the blue range to move him to.

since you can move him to any tile in the range, I'm using dijkstra and not a* (no direction required).

>>64115337
Yes
>>
>>64115354
:(
>>
>>64115158
I actually have a medical condition that makes fiber act similar to laxatives so I take a lot of imodium but that just makes it harder to poo but it's okay because other wise liquid will be leaking out my butt every other hour
>>
>>64115345
No, it's not. And typically malloc will never return 1. In fact, it'll never return an address that isn't a multiple of 8 on most systems
>>
File: 1505721548419.png (172 KB, 300x300)
172 KB
172 KB PNG
>>64115238
This. Sometimes, I just go to the English building after my last class, go to the bathroom, take a shit in like 30 seconds and then program/masturbate in the stall for like an hour.

>>64115474
Your post sounds like an ancapball meme tbqh
>>
>>64115519
>Your post sounds like an ancapball meme tbqh
if only it was a meme, ileo anal pouches are tough
>>
>>64115345
Not portably, no. Although you could do like linux kernel does with the IS_ERR() macro, using some values as errno's and others as pointers. Difference is that linux controls the address space.

Why do you need to do this? NULL should be your error value with the reason in errno(ENOMEM = malloc failed, EINVAL = invalid value, ...).
>>
>>64115561
I'm sorry about that though, for real. It sounds pretty fucking terrible.
>>
So, why do you need [capture] in lambdas?
>>
>>64115632
impurity
>>
>>64115605
yeah man it sucked
went through the surgeries when I was 13, now all I can talk about is pooping
>>
>>64115655
Can't you take reference or pointers in the argument?
>>
>>64115692
to mutate or not to mutate
>>
>>64115678
at least you don't have huge hemorrhoids like I do
sometimes the bleeding is so profuse when I shit that I'm afraid that I will pass out, bleed out, and never wake up
>>
if i cant find a job because no degree what are the odds to make a "decent" living with free lancing? i do live in a big city so i can network pretty well
>>
>>64115758
that sucks, at least with mine my poop looks vastly different deepening what I eat so it's kinda like a game
i started taking specimens and have a logbook and everything
it's a fun hobby but people aren't that understanding
>>
>>64115786
very few places care if you have a degree or not
they usually say right in the job posting "degree or equivalent experience"
>>
>>64115786
It depends. If you are living in a shithole, freelancing will pay your bills.

If you can't find a job, make a good/killer app and open up a patreon.
>>
>>64115655
>>64115741
>Haskellweenies still convinced that mutation is impure
>>
>>64115806
Not a haskellfag, but if you are mutating the arguments, or any variable outside the scope it's no longer pure
>>
>>64115824
>what are effect systems
>>
>>64115858
effects suck
>>
got feathers all over my keyboard again
>>
>>64115961
lewd
>>
>>64115881
Then why is Haskell getting linear types?
>>
>>64116015
they're just feathers anon
>>
I've failed to learn C++ but I still want to try and learn it. What is the best way to open a gamewindow on windows and print text to the screen in a non-retarded way? I'd like to try and learn C++ a little bit by working on what's basically a small text adventure game. I'm not entirely new to programming and I've read enough intro to C and C++ books to be familiar with the concept of pointers and bitwise operations and logic and stuff. I'm just completely lost on the libraries and workflow front.

Header Files and compiling projects with multiple files still makes me incredibly uncomfortable. I've done some 2D interface programming and graphics programming with C# and OpenGL though.
>>
i just had this sick idea for an app

i need an expert java programmer immediately who knows how to do augmented reality stuff
>>
>>64116121
Sure, just wire me 12.5 million dollars.
>>
>>64116037
what
>>
>>64116118
Check out SDL for game development.

It's full of bad practice for c++ development but will get you started on video games.

http://b-ok.org/book/2190882/ea606c

Header files are simple, just remember to use include guards.
>>
>>64116118
>>64116212
makes no sense to use SDL with C++
use SFML instead
>>
>>64116249
What about with Rust?
>>
>>64115091
Mathematicians are worse than Perl Monks, I swear to god.
>>
File: IMG_0025.jpg (151 KB, 1536x2048)
151 KB
151 KB JPG
i'm starting to learn ios tweak development. my first tweak just removes the dock, but it's a start.

%hook SBDockView

-(void)SetBackgroundAlpha:(double)arg1 {

%orig(0)

}

%end
BAM
>>
>>64116259
you shouldn't play with it, you might get tetanus
>>
>>64116300
What the fuck is this disgusting language?
>>
>>64116300
Could you make a tweak that removes iOS entirely?
>>
>>64116301
anon please I'm just trying to make memory-safe games
>>
>>64116315
Just don't violate memory then.
>>
probably retarded question but im making a java desktop program and whenever i want to compile and run it i have to do the commands over and over again to compile then run it. Is there a faster way to compile and run the program?
>>
>>64116353
easier said than done in any non-trivial program
>>
>>64116312

Objective-C. it does look disgusting tho, i won't lie.

>>64116313

lol i could do that if I wanted but then i'd have to update my ios
>>
>>64116378
Build system, like makefiles.
>>
>>64116378
make a makefile
>>
I made the OP image btw. Does the shop look good? It was my first time using free transform on photoshop.
>>
Kotlin is the next Java
>>
>>64116443
Looks like a crappy photoshop, honestly.
You gotta zoom in and spend more time blurring and cleaning up lines.
>>
>>64116443

it looks great, don't sweat
>>
Recommend me a vps provider
>>
>>64116410
>>64116432
makefiles aren't for java though. Apache ant is more suitable.
>>
>>64116300
oh no i forgot to add the semicolon for my code (I'm the OP for that, if you couldn't guess.
>>
>>64116378
just press f5 in your ide
>>
>>64116457
Trutru.
>>
>>64116481
i'm sure you can use makefiles to just run the commands, right?
>>
This is matlab, pls no bully.
y1(find(n>=min(n1)&(n<=max(n1))==1))=x1

Isn't the "==1" redundant?

I imagine it's the same in other programming languages where
if (x > y)


is the same as
if((x>y) == 1)
>>
>>64116519
Well yeah for just a few commands for a simple project, but if you want an actual build system for java it's not the one.
>>
>>64116538
probably,
but maybe "&" does a bitwise& which results in an integer type and matlab requires a boolean type as a parameter there, so it then does ==1 to get it into the correct type?
>>
>>64116585
>but maybe "&" does a bitwise&
Nah, & is logical in matlab.
I tried doing it on my own signals, and I got the same result either way, but I'm not sure if that's because of the dataset. I just got weirded out that they did ==1 for max, but not min. I think the authors were just being weird.
>>
oh wtf it's 4:45 am shit
>>
File: ackchyually.png (21 KB, 700x700)
21 KB
21 KB PNG
>>64116249
>makes no sense to use SDL with C++
if you use DirectX it does since SFML gives you an OpenGL context whether you want it or not
>>
File: sdl.png (41 KB, 1501x765)
41 KB
41 KB PNG
>>64116212
So my game is basically done now right?
>>
>>64116648
why would you sacrifice the portability of opengl for... nothing?
>>
>>64116538
I don't really use matlab but isn't it different in matlab? Like if n is a vector, n <= ... will also be a vector? So the ==1 might be an explicit check for a scalar value. Just a guess.
>>
>>64116682
Why the fuck do people recommend SDL for game dev? SDL only gives you an OpenGL context, and OpenGL is a pain in the ass, completely dwarfing the "simplicity" of SDL
>>
>>64116792
The simplicity of SDL is in how it abstracts over a bunch of platform specific subsystems that every game needs.
>>
>Be me
>Remaking an old project from ye olde C to C++
>CompletedWithoutProblem.cpp
>./testrun
>all_is_perfect.png
>Rerun test while viewing the resource consumption
>Notice that the program constantly eats up to 1GiB, while the C version peaked at 10 MiB
>Spend countless hour with gdb and valgrind to search for the leak
>Noleak.sh
>desperate, ask colleagues wtf is wrong with this
>He noticed that there is lot's of vector that pass by value, instead of pass by reference
>Also there is lot's of vector as return by value

FUCKING SEPPELS
>>
>>64116682
>>>/vg/agdg
>>
>>64116808
>converting c array to vector
you know there's std:array right
>>
>>64116378

im using command line
>>
File: 130221984383.jpg (45 KB, 600x578)
45 KB
45 KB JPG
>>64116820
>>
>>64116834
that's nice, from what I can remember you can run make in the command line.
>>
>>64116806
So does SFML, and SFML gives you a bunch of really easy drawing utilities.
I see how SDL is extremely useful, but it's just not a good choice for beginners who've barely even touched C++
>>
I just want everyone in /dpt/ to know how happy I am that we talk about sepples more than any other language.
>>
>>64116864
I'm kind of upset about this. It's not language, it's just discussion about it is boring.
>>
>>64116864
why wouldn't we? it's the best language after all
>>
>>64116864
you are shit
>>
>>64116864
All publicity is good publicity.
Hence, Rust
>>
>>64116864
I like C discussion better, not autism standard stuff and "help me with K&R exercise 1.3" but when people start talking about C it sometimes leads to talking about operating systems and shit.

I don't mind C++ discussion but it's always just arguing about the STL or C++3028 stuff.

I guess I just don't like discussing languages themselves but applications.
>>
>>64116792
>>64116806
>>64116861
Why the fuck then dont just use Unity or UE?

Unless you are willing to completely learn OpenGL/gfx API in general and all the innards (5-7+ years just for that) you wont get better performance
>>
>>64116965
>Unity or UE
>OpenGL/gfx API in general and all the innards
don't need any of that for a 2d game
>>
>>64116961
Sorry I'm bad at programming and building applications or I'd try and provide input.
>>
File: Capture.png (54 KB, 1550x725)
54 KB
54 KB PNG
Can someone help me understand why this isn't working right? Its a modification of a previous exercise, except I'm suppose to read the names from a file instead of cin. What I don't understand is why nothing is being stored into front, but the names gets compared and stored into back accordingly just fine. FYI it worked perfectly with cin, but I deleted all the code instead of doing a new file like I should have but keep forgetting. Anyway I just want something to explain it to me whats going wrong here
>>
>>64117016
>char [10]
>strcmp
>strcpy
>C++
why are you doing this
>>
>>64116961
>I don't mind C++ discussion but it's always just arguing about the STL or C++3028 stuff.
I can't be bothered to keep up with a lot of the C++ standard changes and I actually learn about a lot of new features here from people trying to one-up each other with (intelligent) shitposts.
>>
>>64117001
That's true but then again you can use Unity or UE for 2D game easily.
Otherwise you will need:
- write your own coroutines pipeline
- animation system
- texture system
- audio system

I mean, there is a less than 10% chance you will ever finish it further than primitive prototype with static images moving by input. Unless that is the point, the slow process not the game itself?
>>
>>64117016
well, first of all you created front, back, enn
but never initialized any of the values, so they're filled with garbage
>>
>>64117054
sfml has all of that except for possibly whatever you mean by "coroutines pipeline"
>>
>>64117032
Why not?

>>64117065
I don't understand how that would make any difference
>>
>>64117094
>I don't understand how that would make any difference
what is the expected result of strcmp(enn, RandomGarbageBytes) ?
>>
>>64117094
>Why not?
C++ introduced this thing called string
it's really great
what you're writing is just C with cout
>>
>>64117123
>great
>>
>>64117164
Let the C stockholm syndrome damage control begin...
>>
>>64117181
if it were great it wouldn't be written in C++ and often compatible with the C string
>>
>>64117181
Maybe he just really loves tedious manual buffer length management?
People get off on the weirdest things nowadays you know.
>>
>>64117191
What

>>64117197
Yeah, it gives them back a sense of "control" that they lack in their offline relationships
>>
Still waiting for the implementation of pascal string in seppels's STL
>>
>>64117123
I'm trying not to jump ahead and use what the book hasn't yet covered. The only reason I used strcpy is because it was the only way to get the arrays to copy
>>64117112
I just assumed it would compare 0 or null? It's like I said it worked with cin so I don't understand why it wouldn't work now. Plus it copies to back just fine? It would be one thing if they both didn't work, but the fact that one does is why I'm confused
>>
File: assertq - Copy.png (364 KB, 3840x1080)
364 KB
364 KB PNG
std::assert giving me an incorrect identifier error

:O>)
>>
What is the difference between formatted and unformatted IO?
>>
>>64117575
Is the answer...

IO class formatting member functions running their course?
>>
I've been trying to set up a webserver on a KVM slice running Arch. I am trying to use flask and uWSGI but I just can't grasp networking. I don't see how people did it with the documentation that is out there.

/wdg/ is no help either.
>>
>>64117575
F:
"1. x, 2. y 3. z

UF:
1. ,2. ,3. ,x,y,z
>>
>>64117615
Does your answer and anons question have anything to do with File Stream Objects?
>>
>>64117568
>assert.h
is a c header
>>
I unironically listen to a "coding music" ỳoutube playlist while coding

anyone else?
>>
Do I need to abstract my entire life if I learn haskell?
>>
File: haskell newbie.png (75 KB, 447x64)
75 KB
75 KB PNG
>>64117796
I believe in you!
>>
>>64114901
well without the makefile or how to compile/run it, then you basically just made a program for yourself only. I can't figure out how to compile this to check it out.
>>
>>64117872
It's all standard libs. If you can't see that, you shouldn't be bitching at people on /dpt/ for a while. Lurk moar.
>>
>>64114275
Aren't both acceptable?
>>
>>64115035
De Morgan's laws tell me this isn't going to work.
>>
>>64118079
Oh wait no, it is, it's just me being retarded.
>>
best way to do a case-insensitive string compare?
>>
>>64118110
if (tolower(s1[i]) == tolower(s2[i])) ...
>>
>>64118137
the second string must remain case sensitive. it cant be lowered.
>>
>>64118181
example,

if "ZBO" in aBc123

ZBO can be zBo, zbo, etc.
abc123 must remain the same. it cannot be ABC123, or abc123, since that would conflict with something else
>>
>>64118181
i'm assuming tolower(x) is some function that returns the lowered version of x, it doesn't modify it in place (and if it can't be lowered it leaves it identical)

i don't know c libs though so you might have to write your own
>>
>>64117016
Can anyone else help me with my fucking shit? Please? It's the only thing I got stuck on with this chapter
>>
>>64116465
Scaleway is the most bang per buck among the reliable providers.
>>
>>64116808
>vector that pass by value
You're just dumb.
>>
>>64117016
>>64118370
>strcmp(enn, front)
The contents of front are undefined at this point, that's UB.

>strcpy(front, enn);
strcpy is strcpy(dest, src), I think you have those reversed. That's also a buffer overflow vuln just so you know, not that it matters in your exercise program.

I stopped reading after the strcpy.
>>
>>64114275
struct foo {};


Don't pollute the namespace, and never typedef a struct unless you're ABSOLUTELY CERTAIN you want the structure to be opaque to the user.
>>
>>64118437
How am I suppose to define it then? Also the source is enn which is being read from the file and copied into front, I don't see how that isn't right. And how is it overflow?
>>
>>64114275
Just cnile problems.
>>
>>64117796
Yes. I took the functional pill and installed NixOS; I fell for the meme hard but don't regret it.
>>
>>64118541
Sorry you do have the order right on the strcpy, it's still a buffer overflow vuln.

The problem you have is the first time this line is called(also your other strcmp with back) and the only definition of front is how large it is.

char front[10];
if (strcmp(enn, front) < 0 )


What in your mind are you comparing enn to? What would expect the result of the following to be?

int n;
printf("%d\n", n + 1);


The value of n is undefined, n + 1 is a meaningless expression. The same applies to front.

>How am I suppose to define it then?
I don't know, it's your program and I have no idea what you're trying to do.

And about the buffer overflow vuln, if you have char front[10] and you just strcpy(which doesn't have size parameter to make it not go past writing 10 bytes to front) then a malicious user(the one giving input to program, enn) could write past the end of the buffer front. This is a buffer overflow vulnerability, he can write way passed the end of the buffer all the way to saved return address of your function and take over the control of your program. This is how people get l33t h4x3d.
>>
>>64114275
If only C had the arguments for typedef the other way round, like it is in Go. Then you could just do
typedef foo struct {
};

Btw the best form is
typedef struct foo foo;
struct foo {
};

Because then you keep the clauses together.
>>
>all the personal projects I feel compelled to do would be incredibly offensive to most people's taste

Should I go ahead with them and list them in my portfolio anyway? It's firearm related and I live in cuckifornia if that matters.
>>
>>64115024
if (!board[i]) {
return 1;


Kill yourself immediately
>>
>>64118636
>typedef'ing structs
>>
>>64118636
>If only C had the arguments for typedef the other way round, like it is in Go.
C has fucked up inside out declaration syntax and Go doesn't.
>>
>>64118218
regular expressions, not sure what language you're in but it should have some regex search function and just search [Zz][Bb][Cc]
>>
>>64118640
Can't you just make pretend they're vidya game guns? I don't really know how firearms apply to software but many of those anti-gun fags are video gaming manchildren.
>>
>>64115024
>no stdio.h
Holy shit anon kys
>>
>>64118618
Well in my mind I assumed that front would = \n, and since that begins the ASCII it would copy the first name no matter what. It's like I said it worked fine when I did
cout << enter a name
cin >> enn
So I figured it wouldnt be a problem with reading the names from a file. Also I didn't really think to limit the input since the exercise didn't call for it, but it does remind me of another program where I tried to do that and couldnt get it to work. I'd post it but I really just want help with this problem right now.
>>
>>64118725
In your code, front is not \n, it's unknown value. It could be "\n", it could also be "faggot", "segfault incoming", "ahhhhhhh" or anything.

If you want to work with assumption that front is initially "\n", then set it to "\n" when you declare it.

char front[10] = "\n";
>>
>>64115359
No its not. A* is Uniform cost search with a heuristic. Uniform cost search is different from djikstra's in that it doesn't require you set all nodes to distance infinity and thus know all nodes prior to starting the algorithm.
>>
>>64118725
>>64118769
I also want to point out something that was already pointed out to you before but there is absolutely no reason for using C strings in C++ or C++ shit in C.

Pick a fucking a language.
>>
>>64118769
>>64118811
I already tried doing that it doesn't work. Using a double quote will just print out that string. Also given everything you said, how do you explain the fact that back works perfectly fine? And why does it matter if I use C or not in C++? What is the big deal?
>>
>>64118842
I'm tired of trying to help you, run your buggy shit through valgrind, it probably has more patience than I do.
>>
>>64118842
Picking and sticking to a single programming style is going to be useful for readability.
>>
>>64118859
If you can't answer my question just say so. You're telling me why front isn't working yet that doesn't explain how or why back works or why it works with cin.
>>64118865
It's just char arrays, is it really that serious? I mean I'm sorry I'm not getting what the problem is here. Later on, the book goes into strings. Right now it does char arrays so I want to follow along. Is that so bad?
>>
File: 1476837548708.png (660 KB, 1106x1012)
660 KB
660 KB PNG
programming in C# with ASP.NET for my web class next semester
>>
>>64118910
What the fuck part of undefined behavior do you not understand?

run it through valgrind, debug your ugly mess yourself.
>>
>>64118910
I've not been following the conversation. What's the issue?
>>
File: iot.png (553 KB, 905x856)
553 KB
553 KB PNG
What's a good hypothesis/technology I should test/extend relating to IoT. I gotta do some kind of research (not really) this for a meme course.
>>
>>64118932
He's a stubborn retard.
>>
>>64118930
Okay, but is back not undefined too? Or am I missing something here?
>>64118932
I have no idea, I honesty don't. Somehow using char arrays is beneath C++ or some shit
>>
>>64114428
>performance sensitive

Just say real time, fucking brainlet.
>>
>>64118947
C++fags usually prefer std::strings instead of char[]s and char*s.

You're going through a book, right? Sometimes books teach C++ by teaching C first. That's fine and necessary, but some people don't like it when you write that sort of thing in real code.
>>
>>64118970
No C++ book in existence will teach you to use strcpy/strcmp before introducing std::string.
>>
>>64116682
>c++
Fucking kill yourself brainlet.
Your game will run like shit and nobody will play it.
Up until very recently most games were written in C and there were literally no problems with them. Nothing has changed in the difficulty of writing C; millennial soyboys have just gotten entitled and lazy.
>>
>>64118970
That's understandable, but I don't like being mocked or made fun of for using char arrays like it's some kind of cardinal sin. Especially when it doesn't even address the original problem or issue I was having in the first place. And yes I am going through a book. It's just ridiculous that I can't ask questions ITT without getting mocked for the compiler I use, or the language I'm learning with, or now for using C instead of C++ when I'm just following along with the book.
>>
>>64119021
Welcome to /dpt/ I guess.

So what's the issue?
>>
>>64119030
see>>64117016
>>
>>64119021
>I don't like being mocked or made fun of for using char arrays like it's some kind of cardinal sin

Welcome to C++ programming.
>>
>>64119052
I'm not entirely sure what the program is supposed to do but chances are the problem is that your front and back arrays aren't initialized. Zero initialize them both with something like
char front[10] = {0};

Otherwise the array is storing whatever garbage was left behind by the previous user of that memory.
>>
>>64119084
He was already told that and just argued against it. It's not /dpt/ bullying him, he's literally retarded.
>>
>>64117016
front and back are not initialised (read: they contain non null-terminated garbage) and you're using strcmp on them (rather than strncmp). You're going to have a bad time.
>>
>>64119084
That still doesn't work. It just returns a white space
>>64119110
I didn't argue back I said it doesn't work, which it doesnt
>>
>>64119128
What is your program even supposed to do?

The reason why blank is stored in front is because the string "" will always be less than any non-empty string.
>>
>>64119128
Oh right, that makes sense. You ought to make a bool flag to determine if any real string has been entered in the array yet, otherwise the comparison will never become true and no string will ever be entered into the array.

Also the others are right, you better use strncmp.
>>
>>64119141
>>64119151
Alright I got it to work with {125}, and I understand the explanation but what I DONT understand if why back would work even if it's not initialized yet front does not. And why it worked with cout/cin. Does reading the data from the file play some kind of factor here? The program originally read names from cin and determined who stands in the front and back of the line. All I had to do here was change the input read from cin to a file, that's it. And it worked completely good with cin. What's the difference between strncmp and strcmp?
>>
so im trying to get my first android app running on my phone. I'm connected through USB. When I build/run on android studio it builds fine but when i my log says "Client not ready yet..."

wat do
>>
>>64119227
>I got it to work with {125}
What?
>125 = '}'
I-I'm pretty sure you still have undefined behavior dude.
>>
File: ;;;.png (56 KB, 1520x669)
56 KB
56 KB PNG
>>64119266
Like it said it works when I do it. Also notice how back is {0} yet it plays no factor. How is it not a null in this case? I still don't get it
>>
>>64119299
Oh, I see, it was so simple just intialize front to "}".

Yeah, that totally makes sense.
>>
>>64119299
actually forget what i said about back i see how it would work, but still
>>
>>64119299
I still have no idea what you're trying to do.
>>
>>64119323
I guess so, it just annoys me it took this long to finally get it to do what I wanted.
>>64119384
What are you confused about? I've already said multiple times what it does
>>
>>64119299
>Also notice how back is {0} yet it plays no factor.
I'm starting to think that you're mentally challenged.

strcmp returns less than 0 if the first string alphabetically precedes the latter. It returns greater than 0 if the latter precedes the former. It returns 0 if the strings are equal.

Character array strings ("C strings") are null-terminated strings, that is, the way all these functions know the length of the string is by checking for the value 0.

This means, that when you pass in a null terminated string to a function that does not explicitly know the length of the string (for example when you use strcmp instead of strncmp), it's going to either terminate when it finds the two strings non-equal or start running out of bounds searching for a non-existing null-terminator.

You're asking why it works differently for back than for front, well the answer is simply that you ARE FUCKING CHECKING FOR THE OPPOSITE CONDITION, you imbecile.

To ensure that it would work in all cases, do this:
for (int num = 0; num < 10; ++num) 
{
front[num] = 255; // maximum value for a char
back[num] = 0; // minimum value for a char
}

while (!lineup.eof())
{
lineup >> enn; // this may actually overflow if lines are longer than 9 characters, so you shouldn't do this
if (strncmp(enn, front, 10) < 0)
{
strncpy(front, enn, 9);
enn[9] = 0;
}
else if (strncmp(enn, back, 10) > 0) {
strncpy(back, enn, 9);
back[9] = 0;
}
}
>>
so if I compile something to llvm, it'll run anywhere that has llvm... right?
that's the point of a vm isn't it?

[genuine question from a genuine brainlet]
>>
>>64119596
LLVM isn't actually a VM, it's a compiler framework. It's basically like GCC, the GNU compiler collection, not the GNU C compiler(gcc, which is part of GCC).
>>
>>64119596
LLVM isn't much of a VM anymore. LLVM IR is a platform-ambiguous assembly-like format.
Writing a new LLVM backend that translates LLVM IR to some new platform is significantly easier than porting the top level language over, and writing a new frontend to LLVM IR will give you more immediate portability than a compiler for any particular platform.
>>
>>64119635
>low level virtual machine
>>
>>64119840
Not anymore, no.
>>
>>64119840
Not anymore. LLVM isn't even an acronym for that anymore and you'll find no reference to "low level virtual machine" in the docs. They don't call it that anymore because it's no longer that.

It's LLVM now, it doesn't mean anything, it's just LLVM.
>>
>>64119641
>LLVM isn't much of a VM anymore
It's never been imo, despite the name (see the original paper, nothing closely relates to traditional VM architecture). The only program that remotely appears like a VM is lli, but
>using LLVM to do JIT
>>
>>64119890
At least GCC that used to be the GNU C compiler could be changed to GNU compiler collection.

Now try to find a new acronym for LLVM that describes it, good luck.
>>
>>64119933
>projects need acronyms
Ok I'll call every company in the world to let them know, thanks for your input.
>>
>>64119946
It doesn't need it but now LLVM doesn't stand for anything and just causes confusion like that anon.

It would be cool if somebody could find something that makes sense.
>>
>lists experience with a dozen different languages in his CV
>one of them has the letter S in its name
Goes straight into the trash. We don't hire language memers.
>>
>>64118589
props my dude. I used to run it a while back. Such a shame everyone is still on old-style self-modifying global-state software updates. It was the best available solution in the 70 but not now.
>>
>>64120117
Why does everybody always pretend to be an interviewer on /dpt/?
>>
>>64120140
Nothing else to do.
>>
>>64120140
/dpt/ - daily pretense thread.
>>
File: 1509459593520.jpg (59 KB, 268x237)
59 KB
59 KB JPG
Employed interviewer here
>>
File: rust-programmer.jpg (41 KB, 852x480)
41 KB
41 KB JPG
Employed Rust programmer here.
>>
File: 1514788748593.jpg (128 KB, 588x823)
128 KB
128 KB JPG
>llvm was rightfully called low level virtual machine
>>
https://www.youtube.com/watch?v=PBsUD40nPkI
>>
>>64120217
Rude.
>>
Don't make me tap the sign.
>>
>>64119928
why the hell would they name it as if it's a VM then
>>
@64120342
>le i was only pretending
>epin trole m i rite guise
>>
>>64120362
No one is pretending anything, beta anon. Why are you deluding yourself.

In case you forgot what I asked you, why calling LLVM by its original name is ``dumb``?
>>
This is where I wish I still had that simpsons torrent so I could make a webm of the sign being tapped.
>>
>>64120389
The sign doesn't say you can't about about them.
>>
File: 1508747959630.png (35 KB, 408x450)
35 KB
35 KB PNG
>if I keep ignoring the posts that answer my question then I can pretend no one answered it!!!
>>64120345
http://llvm.org/pubs/2004-01-30-CGO-LLVM.pdf because it _seemed_ to make sense at the time, but it's actually nothing more than another "language + compiler" combo. This doesn't change the fact that there was nothing at the time that made it like any VM. Notice through the paper the only times "VM" designates LLVM in when spelling the full name, whereas he specifically uses the word virtual machine to designate other implementations several times. LLVM is defined by its IR, there is nothing inherently related to virtual machines about it (again, except doingt JIT, but LLVM is very unsuited for this thing, there is a blog post from a Julia dev where he talks about it in great details).
So in short, just because I decide to name my cat "Lionking" doesn't make it a lion nor a king.
>>
>if it uses IR, it's a virtual machine
Reminder not to give lebbit refugees any (You)s.
>>
>>64120417
IR is an intermediate representation, which is not machine code. Many languages can compile to IR, thanks to LLVM's front end.
LLVM IR has baked-in constants, ABI details, and other platform-specific things.
Many languages compile to JVM's bytecode too. It's not rocket science.
>>
File: 1512668377410.png (35 KB, 645x729)
35 KB
35 KB PNG
>if there's an IR, it's a virtual machine
>>
File: reddit.png (160 KB, 568x1023)
160 KB
160 KB PNG
>lol u mad??? mad? lol stay mad!!
>>
>>64120547
I'm saying it is. You, however are void of counter-arguments.

In fact, seeing none of you are able to indicate what exactly changed from the current LLVM and the original LLVM(low level virtual machine), I'm tempted to believe that it still is the same.

It still uses IR, front ends compile different languages like Obj-C, C etc to IR, which is not machine code.
"JVM languages" also use bytecode, front ends compile different languages like Java or Scala to bytecode too.
>>
Python has made me enjoy programming again. I was burned out of all these statically and strongly typed languages and >muh close to the metal.
>>
Nobody fucking cares about your LLVM naming shit, ignore the tripfag and just shut the fuck up about it.
>>
>>64116390
>%hook
That's not objective-c, that seems some kind of directive added for iOS tweaks development. Apart from that, Objective-C is the best language ever created. It's OOP in C done right. Then it got replaced by Swift because >muh modern language xd.
>>
>>64120644
objective C looks pretty wretched from a cursory glance, what do you like about it?
>>
Thank you hot pockets.
>>
@64120583
>durr prove me wrong!
Your conclusion just doesn't follow from your premise. You can translate code into an intermediate representation without ever intending to execute it directly in a VM. I think LLVM does have a vestigial IR interpreter from the days it was intended to include a legit VM with speculative runtime optimizations, but this is no longer a goal of the project.
>https://llvm.org/
>The LLVM Project is a collection of modular and reusable compiler and toolchain technologies. Despite its name, LLVM has little to do with traditional virtual machines. The name "LLVM" itself is not an acronym; it is the full name of the project.
>The name "LLVM" itself is not an acronym
In any case, filtered.
>>
>>64120696
The way they do object-orientation and message-passing. Reference counting built-in and done pretty much automatically with ARC (C with automatic memory management, what's not to like?). The Cocoa/UIKit API is very well done, consistent and predictable. The fact it's C under the hood and you can easily use C or C++ libraries. The language itself being pretty simple unlike C++. There's more but I haven't used it since a while, I think the last time I used it was before the introduction of Swift.
>>
Is it true that g(x) = O(f(n)) and g(x) = Omega(f(n)) if and only if g(x) = Theta(f(n))?
>>
>>64120799
omega = O ^ theta
(more or less)
>>
>>64120799
Yep. literally stated in that table on
https://en.wikipedia.org/w/index.php?title=Big_O_notation#cite_ref-knuth_13-0
I had to check tho. Gotta review all this fucking material
>>
>>64114275
typedef struct tag_foo {} foo;
>>
>>64120644
well, yeah, it's a version of objective-c so we can hook into ios header files to change the methods. i changed the method 'setBackgroundAlpha' so it set the background to 0, as seen in:
%orig(0);


that runs the original code with "0" as its argument.
>>
end me RN
>>64114135

Task 3 - Network (35 points, 1 sec, zad3.pas, zad3.c, zad3.cpp, zad3.java)
The USG network contains n servers numbered from 1 to n. Some server pairs are connected by two-way communication channels, which have a total of m. It is guaranteed that it is possible to transfer information
between any two servers. A server set A is basic if, in the event of a failure of a connection link, it is valid: for each X server that does not belong to the A set, there is a way of transmitting information over other
channels of connection with at least one server from set A.


In order to minimize costs, the basic set must have as little server as possible. In addition, the administration is interested in how many modes such a "minimum" basic server set can be made.
As the number of modes can be large, it is necessary to print this number by module 109 + 7.
>>
>>64121154

sorry for bad translation
n is number of server, m number of connections, it is a graph,...
>>
Hello /dpt/.
Whats the best way to get into programming? I kinda feel like C# would be a nice first language, as i'm also interested in making garbage in Unity.
Any books, sites or anything really to recommend?
>>
File: 1512275363722.gif (1.24 MB, 400x533)
1.24 MB
1.24 MB GIF
>>64114135
I'm working on transition to sepepele. I'm half past Straustrup therapy and already trying some qt clothes. Wish me luck with Meyers modern effective operation, /dpt/!
>>
>>64121191
it really doesn't matter so long as you pick a place and get going
>>
>>64121191
https://stackoverflow.com/questions/388242/the-definitive-c-book-guide-and-list
>>
>>64121227
Yeah.. i realize that it's the case, but i kinda want to go the most effective way when picking this up. I don't want to kinda get it, but still have big holes in my knowledge.
>>64121255
That seems to be for c++. Would you recommend that as a better starting language anon?
>>
>>64121288
If you want to start with C I recommend Gustedt's Modern C, King's C Programming: A Modern Approach is quite often recommended too but I haven't looked at it.
If you want to start with C++ (fine choice too) use Principles & Practices or follow one of Kate Gregory's courses.
>>
>want to write a web browser for kicks and laughs since I've done basically every simpler things
>decide to have a look at servo since it's supposed to be the hot new shit
>foreign API is outdated by several years
kms
>>
so if I compile a program with clang on linux it won't run on windows?
is llvm not a virtual machine at all?
then what is it? what purpose does it serve [again, genuine question, not trying to fling shit]
>>
File: SCI cS.jpg (2.95 MB, 2500x4048)
2.95 MB
2.95 MB JPG
>>64121288
The definite guide to ascension
>>
>>64121330
>>64121405
Thats a lot of litteratur to go around. Thanks anons.
I mainly wanted to do C#, but i guess C and C++ is fine too for now. I starting first year of a computer engineering bachelor next semester and we are apparently starting out with C and java anyway.

I will start right away, should be nice.
>>
>>64121405
i don't trust /sci/
>>
File: llvm.png (21 KB, 558x206)
21 KB
21 KB PNG
>>64121396
>The LLVM Project is a collection of modular and reusable compiler and toolchain technologies.
>reusable
>modular
>technologies
>compiler and toolchain

pic related, note the hourglass structure
>>
>>64121511
and there are more language frontends supported (e. g. Rust) as well as more backends (Windows vs Linux, 32-bit intel vs 64-bit intel)
>>
File: aaaaaaa.png (5 KB, 240x56)
5 KB
5 KB PNG
How to use IO Bool in if/else in haskell?

    • Couldn't match expected type ‘Bool’ with actual type ‘IO Bool’
• In the expression: doesDirectoryExist path
In a stmt of a 'do' block:
if doesDirectoryExist path then putStrLn "ok" else putStrLn "err"
>>
>>64121580
Inside a do block:
exist <- doesDirectoryExist path
putStrLn (if exist then "ok" else "err")
>>
File: 1494749779343.jpg (8 KB, 213x255)
8 KB
8 KB JPG
>>64121621
thank you
>>
>>64121661
thou art welkom. Arguably tho it's unwieldly
>>
Tcl is the greatest language of all time
>>
class Bingo:
def __init__(self, items):
self._items = list(items)
random.shuffle(self._items)

def pick(self):
return self._items.pop()


hey guys, this is part of some code from a book. What's the difference between 'items' and '_items'? Why wouldn't he just do "self.items = list(items)" on the init declaration?
>>
>>64121972
he could have
it's just some convention I guess
>>
>>64121972
Sticking _ before a class member in Python implies that it is a private member. The constraint isn't actually enforced, it's a conventional thing.
>>
>>64121972
people sometimes use leading underscores in various languages to indicate that the variable is private and not to fuck with it externally. python doesn't have public/private enforcement like descendants of C++, so it's just a convention more than anything
>>
>>64121989
>>64121999
so it's not a syntax feature, just a naming convention, like saying 'pls don't mess with this variable'?
>>
.SYNTAX PROGRAM

OUT1 = '*1' .OUT('GN1')
/ '*2' .OUT('GN2')
/ '*' .OUT('CI')
/ .STRING .OUT('CL ' *) .,
OUTPUT = ('.OUT' '(' $ OUT1 ')' / '.LABEL' .OUT('LB') OUT1) .OUT('OUT') .,
EX3 = .ID .OUT('CLL ' *)
/ .STRING .OUT('TST ' *)
/ '.ID' .OUT('ID')
/ '.NUMBER' .OUT('NUM')
/ '.STRING' .OUT('SR')
/ '(' EX1 ')'
/ '.EMPTY' .OUT('SET')
/ '$' .LABEL *1 EX3 .OUT('BT ' *1) .OUT('SET') .,
EX2 = (EX3 .OUT('BF ' *1) / OUTPUT) $(EX3 .OUT('BE') / OUTPUT)
.LABEL *1 .,
EX1 = EX2 $('/' .OUT('BT ' *1) EX2)
.LABEL *1 .,
ST = .ID .LABEL * '=' EX1 '.,' .OUT('R') .,
PROGRAM = '.SYNTAX' .ID .OUT('ADR ' *)
$ ST
'.END' .OUT('END') .,
.END
>>
>>64122033
Yep.
>>
>>64122042
thx guys
>>
>>64121405
>computer science
Into the trash.
>>
Is it a bad idea using popen(some command) instead of a c library for that command?
>>
So how do i alias in bash so that
When I type
lnc getroute <id>
It gets aliased to
lnc getroute <id> | jq
?
>>
>>64116118
Are you familiar with having to link a library when compiling?
So, for example, I've just done a bit of nCurses stuff (for better control over the command line interface/command prompt) and the bit of text I had to type to get it to compile is:
gcc prog.c -lncurses -o prog

... which is something that I'm still fuzzy on when linking other libraries.
>>
>>64122402
use a function instead.

lnc() {
if [[ $2 == getroute ]]; then
command lnc "$@" | jq
else
command lnc "$@"
fi
}
>>
>>64122459
Should I put that in .bashrc ?
Thanks!
>>
>>64122521
sure, just put it wherever you keep your aliases.
>>
>>64121405
>taking care of myself. A healthy Hygiene, Puberty and Personal Curriculum for young people with autism, by Mary Wrobel
kek
>>
How do RNGs work in pure functional languages?
>>
>>64122354
depends what command and in what situations. Commands might not be available in certain production environments, or fuck up for some reason. Libraries would be more reliable in principle, but there could be counter-examples.

What's a "library for that command"? A library that wraps the popen or a library that does the job that this command does without calling it?
>>
>>64122574
>How do RNGs work in pure functional languages?
Muh moan-ads.
>>
>>64122574
PRNGs:
functions that take the old PRNG state as an argument and return the new state of it as well as the randomly generated value. It's probably why QuickCheck-like fuzzing tools began in Haskell since Haskell makes this state explicit whereas most langs just use a hidden global variable, which is sinful.

>TRNGs and CSRNGs
using the appropriate monad like any other system call. (which will get 20% slower tomorrow on intel CPUs because of KAISER)
>>
>>64122584
The library that does the job of the command
The command is jq, a json parser and its really simple to use on the terminal but I can't be bothered to learn how to use it in C https://github.com/stedolan/jq/wiki/C-API:-jq-program-invocation
>>
>>64122649
>functions that take the old PRNG state as an argument and return the new state of it as well as the randomly generated value
Surely Haskellers aren't stupid enough to do that. You would have to manually thread this piece of state through the entire program. Isn't this precisely the kind of problem monads are supposed to solve?
>>
How can I deploy my C++ projects?
I use Maven for Java, but I don't know what to use for C++.
>>
>>64122727
Yes they use state monads.
>>
Next thread: >>64122992
>>
>>64122720
Yep, they mention that it's undocumented, altho it's probably not that complex. I mean approximately jq_compile() then apply the result on your data and voilà, but idk. It would be better to do it using libjq directly, like you would use libcurl and regexec rather than invoking curl and grep, but it's not high-priority afaict.
>>
>>64123051
>>64122584
Thank-you!
>>
>>64122866
https://docs.microsoft.com/en-us/cpp/ide/walkthrough-deploying-your-program-cpp
>>
There is a programming adage which goes something like "90% now, 10% later". I can't remember the source on this, and google doesn't seem to come up with anything. Can anyone recall where this is from?
>>
>>64123912
The last 10% to compete a project takes 90% of the total time?
>>
>>64123969
It was something like implement 90% of the features now and 10% later (or in other words, "don't try to do everything at once"). It might have been something related to esr's writings
>>
>>64124036
Ok I was referring to this one


“The first 90% of the code accounts for the first 90% of the development time. The remaining 10% of the code accounts for the other 90% of the development time.”
(Tom Cargill)
>>
File: 123123d.png (159 KB, 648x830)
159 KB
159 KB PNG
I have work due in 1 week for an assignment where I have to create a basic program in C. My lecturer is Asian and nobody can understand a thing he says, despite apparently graduating from Harvard. Is there anyone I could pay?




Delete Post: [File Only] Style:
[Disable Mobile View / Use Desktop Site]

[Enable Mobile View / Use Mobile Site]

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.