Quantcast
[ 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: 415 KB, 690x764, HAPPENING.png [View same] [iqdb] [saucenao] [google] [report]
68522504 No.68522504 [Reply] [Original] [archived.moe] [rbt]

What are you working on, /g/?

Previous thread: >>68514754

>> No.68522530

>>68522504
I don't even remotely understand or care about this image, but I appreciate the non-anime programming for retards thread.

based op

>> No.68522567

>>68522530
Nice grammar, tard.

>> No.68522635
File: 128 KB, 1600x900, perlscr.png [View same] [iqdb] [saucenao] [google] [report]
68522635

Workin on some perl for class

Yes it's terrible

>> No.68522696

>>68522635

What class?

>> No.68522708

>>68522530
Assange is a hacker who has contributed to postgresql, netbsd, ... he may be prosecuted for high treason towards the united states of america.

>> No.68522718

#define FREADW(buf, cnt, file) (fread((buf), (cnt), 1, (file)) == (cnt))

Good or bad?

>> No.68522727

>>68522696
A general scripting course

We're taught bash, python, and then perl

>> No.68522739

>>68522718
Macros are always a bad idea. Is there a reason you can't use a function for this?

>> No.68522741

>>68522718
"Upon successful completion, fread() shall return the number of elements successfully read which is less than nitems only if a read error or end-of-file is encountered."

>> No.68522745
File: 307 KB, 640x404, autistic helmet.png [View same] [iqdb] [saucenao] [google] [report]
68522745

>>68522567
>can't read
literally nothing wrong with it you brainlet
also ^ not writing a story here mate? it's literally a shitpost on 4chan you fruitcake; no one follows proPER grammer or spelling or literally gives two fucks About that shit except for autistic fags like yourself;!;:?

get ass-mad freak,

>> No.68522758

>>68522718
yeah, think about what would happen if FREADW(..., ++a, ...)

>> No.68522764

>>68522739
Well, is there such a function?
>>68522741
Right. Do you mean I should change it to this?
#define FREADW(buf, cnt, file) (!(fread((buf), (cnt), 1, (file)) < (cnt)))

>> No.68522778

>>68522758
That's not an intended use case, so who cares.

>> No.68522779

>>68522718
Make it a function instead. I don't see the point in making it a macro. If your optimizing compiler doesn't optimize away the wrapping call you should focus on getting a new optimizing compiler before doing things like this.

This is of course ignoring the possibility that you're working on some ancient platform with no real support. I say a macro is better than trying to build optimizations into ancient compilers.
>>68522758
A function would sort this too. Of course you could also rewrite your macro to capture the cnt value once.

>> No.68522796

trying to learn some erlang. It's my first fp language beyond scheme in SICP course

Are functions like this an abominations that should be purged and rewritten or is it ok in a functional world, it's just me not getting used to it?
divLine([Xfirst|Xtail],
[YFirst,YSecond|YTail]) ->
divLine(Xtail, [YSecond|YTail], [(YFirst - YSecond) / Xfirst]).
divLine([Xfirst|Xtail],
[YFirst,YSecond|YTail],
Result) ->
divLine(Xtail, [YSecond|YTail], [(YFirst - YSecond) / Xfirst|Result]);
divLine(_,_,Result) -> Result.
[\code]

>> No.68522824

>>68522745
I insulted your grammar because "I appreciate the non-anime programming for retards thread" doesn't mean what you wanted it to mean.
You're calling yourself a retard, lmao.

>> No.68522829

>>68522764
cnt = fread(buf, max_cnt, 1, file);

if (0 > ferror(file))
perror("Could not read file");

>> No.68522843
File: 191 KB, 880x410, file.png [View same] [iqdb] [saucenao] [google] [report]
68522843

I'm watching this talk:
https://youtu.be/BWvSSsKCiAw?t=952
But right here (15:50) I'm confused. What's surprising about this? Seems completely obvious to me. I don't understand what the expected behavior would be in case we didn't expect an ambiguity in referencing string here.
Is this a slide bug?
#include <string>
namespace name {
using namespace std;
struct string{}; //this can be before or after the using
}
using namespace name;
void moo(){
name::string ns;
std::string ss;
string as; //ambiguous
}


I'm thinking this is something people could be confused about more and it fits better with his motivation. So I'm wondering if there's some depth I'm missing in the example or if Titus has some _very_ low standards for C++ programmers.

>> No.68522856

>>68522824
I fully understand what I posted you dumb shit.

>> No.68522877

>>68522856
You did but every native reading it understood it differently.

>> No.68522883

>>68522877
not really, sounds like you got it to me.

>> No.68522895

>>68522708
Is he an American? If not, how can he be prosecuted for high treason? That's like prosecuting an enemy soldier for treason because he shot one of your guys.

>> No.68522896

>>68522829
But I want to know if I'm at EOF or not.

>> No.68522911
File: 36 KB, 850x400, quote-talk-is-cheap-show-me-the-code-linus-torvalds-45-66-13.jpg [View same] [iqdb] [saucenao] [google] [report]
68522911

Show me the code /dpt/.

>> No.68522927
File: 20 KB, 196x208, 1471290086830.png [View same] [iqdb] [saucenao] [google] [report]
68522927

>>68522911
>w<
free(malloc(0))

>> No.68522942
File: 593 KB, 3840x2160, Screenshot from 2018-11-17 04-42-41.png [View same] [iqdb] [saucenao] [google] [report]
68522942

>>68522911
I keep rewriting the same shit

>> No.68522949

>>68522895
I don't think the US government cares how they justify an unlawful arrest and ruling as long as ignorant masses buy it.

>> No.68522966

>>68522896
int feof(FILE *stream);

The feof() function shall return non-zero if and only if the end-of-file indicator is set for stream.

>> No.68523083

>>68522966
Yeah, that seems like a good solution.
>>68522911
13 enum filetype
14 { SCRAPE,
15 TORRENT,
16 UNKNOWN
17 };
18
19 enum filetype what_type(FILE* in)
20 {
21 # define CNT 8
22 enum filetype rc = UNKNOWN;
23 char buf[CNT];
24 fread(buf, CNT, 1, in);
25 if (!(feof(in) || ferror(in)))
26 { if (!memcmp(buf, "d5:files", CNT))
27 rc = SCRAPE;
28 else if (!memcmp(buf, "d4:infod", CNT))
29 rc = TORRENT;
30 }
31 return rc;
32 # undef CNT
33 // "d4:infod5:files";
34 // "d5:files";
35 }
36
37 void fast_forward(FILE* in, enum filetype type)
38 { // there's a small "header" -- this skips over it to get to the repeating part
39 int offset;
40 switch(type)
41 { case SCRAPE:
42 offset = 0;
43 break;
44 case TORRENT:
45 offset = 7;
46 break;
47 default:
48 assert(0);
49 }
50 fseek(in, offset, SEEK_CUR);
51 }

>> No.68523090
File: 357 KB, 720x720, 1483601820443.png [View same] [iqdb] [saucenao] [google] [report]
68523090

>>68523083
for a second i thought hiro added line numbers
fuck you

>> No.68523110

>>68522911
static void extract_initramfs() {
printk("Extracting initramfs... ");
auto *p = kmap(u32(bootinfo.initramfs), bootinfo.initramfs_size, 0);

vfs_mount("ramfs", {}, "a:/");
String path;

tar_foreach(p, [&path](const TarHeader &hdr, const u8 *buf) {
auto size = string_to_uint_octal<usize>(hdr.size).value();

path = "a:/";
path += Str(hdr.name, strlen(hdr.name));

if (path.back() == '/') { // This is a directory, create it.
assert(vfs_mkdir(path) == 0);
}
else { // Otherwise this is a file, create it and copy it over.
auto file = vfs_open(path, O_CREATE | O_TRUNCATE).value();
assert(file->write(buf, 0, size) == isize(size));
}
});

kunmap(p, bootinfo.initramfs_size, KUNMAP_FREE);
printk("Done\n");
}

>> No.68523118

>>68522843
I kept watching.
The ADL segment in this talk is TERRIFYING. That C++ is used in any context of any significant importance is ridiculous.
Stop now. Please.

>> No.68523239

https://www.yegor256.com/2018/11/13/bigotry.html

>> No.68523284

If I have a set of data points for the velocity and acceleration of an object in an elliptical orbit, how do I find the position of the object at any given time? Assuming at time t = 0, the object is at one of the vertices of the ellipse.

>> No.68523296

>>68523284
iterating is the only reliable way

>> No.68523340
File: 43 KB, 636x616, 1474325315193.jpg [View same] [iqdb] [saucenao] [google] [report]
68523340

Employed Haskell programmer reporting in

>> No.68523359
File: 9 KB, 300x222, deadly loli.jpg [View same] [iqdb] [saucenao] [google] [report]
68523359

>>68523340
give me your job

>> No.68523372

>>68523296
The hard part is the direction. I don't know by how much the object rotates with each step. I know pretty much everything else about the ellipse, though (circumference, semi-major axis, focal length, etc.).

>> No.68523388

>>68523340
Why larp on an online Bruneian tofu fermenting imageboard?

>> No.68523509

>>68523239
>Do you agree with these guys? Most probably, just like me, you don’t.
assertion failure

>> No.68523774

Is there a combined web interface for Git that includes a wiki with the ability to attach files to pages? It should support multiple users

>> No.68523784

is rust really hard?

>> No.68523801

>>68523784
No it's just annoying

>> No.68523831

>>68523784
Not really. More depends on what type you are.
M? Rust is for you.
S? C++ is for you.

>> No.68523847

>>68523784
Basically it is a less than stellar language with a strict static analysis. But any good static analysis tool for C or C++ can do the same thing as Rust. The only difference is Rust refuses to compile if it deems something is unsafe. A strict static analysis tool will show errors but it isn't tied to the compiler.

>> No.68523849

>>68523831
M? S?

>> No.68523950

>>68523849
oh i got it sadomasochism

>> No.68523956
File: 400 KB, 1280x720, 1516991410072.jpg [View same] [iqdb] [saucenao] [google] [report]
68523956

>> No.68524035

>>68522504
Lisp is the most powerful programming language.

>> No.68524056

>>68524035
no anon
you are

>> No.68524070
File: 49 KB, 586x417, file.png [View same] [iqdb] [saucenao] [google] [report]
68524070

>>68523090
I made this horrible mess, just for you. <3
https://pastebin.com/nXEmW9Qr

>> No.68524104

guys what is the best way to measure similarity between two images? I have a program that compares images of typed out letters 0 to 9 to a different font 0-9, I split up each letter into 9 regions and save the black/white pixel ratio for each region and calculate the euclidean distance for it. but basically its shit and guesses almost every letter incorrectly so I'm assuming I need more things to compare but what else even is there to compare?

>> No.68524115

>>68524104
spectral clustering using features learned from a deep net

>> No.68524308

>>68524070
doesn't work though.
installed on greasemonkey btw

>> No.68524325

>>68524308
Odd. What does it write in the console?

>> No.68524357
File: 14 KB, 663x243, 3333.png [View same] [iqdb] [saucenao] [google] [report]
68524357

>>68524325
is it because i'm using greasemonkey instead of tampermonkey?

>> No.68524369

>>68524357
I would guess so but I want it to work for both.

>> No.68524386
File: 55 KB, 1216x647, carsales-2014-01-14.png [View same] [iqdb] [saucenao] [google] [report]
68524386

>>68523784

>> No.68524407

>>68524386
>made by cpp programmer who can't code in rust

>> No.68524426

>>68524407
>made by rust programmer who can't code in cpp

>> No.68524443
File: 2.36 MB, 640x360, _.webm [View same] [iqdb] [saucenao] [google] [report]
68524443

Can openGL do this?

>> No.68524463

>>68524443
Do what? Render 3D objects?
Yeah of course.

>> No.68524693

Anyone know perl?

How do I pass arguments, and then pipe in a text file?

For instance I'm trying to count the frequency of words in a text file.

If my text file is "foo bar foo foo bar"

Then I would do

./myfile.pl foo bar < input.txt

foo: 3
bar: 2


I know how to read from ARGV I'm just wondering how I pipe a file in and read from it off of argv

>> No.68524705

inf bottles of beer on the wall!
inf bottles of beer!
Take one down, pass it around
inf bottles of beer on the wall!

>> No.68524725
File: 38 KB, 640x480, 1476811327277.jpg [View same] [iqdb] [saucenao] [google] [report]
68524725

>>68524705

>> No.68524730

>>68524705
>performing operations on special cases
if you, you know, wanted to perform operations on something it would probably be best if it wasn't a special case

>> No.68524744

>>68524730
In what way is inf a special case.

>> No.68524748

>>68523784
It's too hard AND too easy, simultaneously

>> No.68524806

0 bottles of beer on the wall!
0 bottles of beer!
Take one down, pass it around
18446744073709551615 bottles of beer on the wall!

>> No.68524819

>>68523110
>String
>strlen
why can't you decide on one

>> No.68524829

>>68524744
https://en.wikipedia.org/wiki/IEEE_754 because infinity is returned as a value in boundary cases in the same contexts as NaN, and that operations on infinity are specifically well defined because people apparently don't want their computations to grind to a halt by an exception just because they ran out of precision and wound up naturally dividing by 0

>> No.68524917

all these programming language wars, what about DB wars?
Let's start with natural vs surrogate keys. My teacher seems fond of surrogate keys, he said that if you're using more than 2 PKs then better to use ID surrogate key or else other tables will have many FKs and it will be annoying and costly to join tables where you need to compare many FKs instead of just one. But it seems to me this gives more drawbacks that benefits.

You can't do INSERT x ON DUPLICATE KEY UPDATE but with natural PKs you can. Also when inserting into a table that has a surrogate FK it seems I need to do a fucking select to find that the correct FK value is.

>Example
I have tables of artists, albums and songs. If I had natural keys I could easily detect a duplicate during INSERT album
because the PK would be artist's name and album's name. With surrogate keys I can't.
Also doing an INSERT of a new song requires me to do a select just to get the correct album ID that was auto-generated from autoincrement.
Enlighten me DB engineers

>> No.68525119

>>68524819
Because name is defined like this: char name[100];
And I have an overload on String constructor and operators that takes an array of chars with static size to avoid a strlen (because the compiler for some reason rarely decides to optimize strlen out. Beyond me).
So I'd end up concatenating some chars, a null terminator, and a bunch of junk to the string and since String doesn't give a single shit about null terminators shit will hit the fan. I just tried it now and it kernel panicked trying to access a bad optional (duh, because it couldn't find the name).
So I have to call strlen explicitly and wrap it up in a string view and then concatenate that. It's still zero cost besides the strlen.

In my OS I stay away from null terminators in general and use sized strings, even in the syscall interface. I always use Str for string parameters/refs and String for owned strings. I only have bare minimum support for null terminators because unfortunately you can't get completely away from them because lmao fuck you t. C. But I'd still prefer to pretend they don't exist in most places and pretend statically sized char arrays don't have a null terminator anywhere but the end. Anywhere where that isn't true I can explicitly take the length, and that's very rare.
I didn't design the tar spec and it uses null terminators, so oh well.

>> No.68525124

>>68524829
Who said anything about computers?

>> No.68525147

>>68524705
You mean ω.

>> No.68525189
File: 20 KB, 497x247, file.png [View same] [iqdb] [saucenao] [google] [report]
68525189

>>68524357
>>68524369
https://pastebin.com/nGZvVBXw
This works for greasemonkey. Couldn't get the function include to work. And I don't know where my functions end up in greasemonkey. I added a toggle to the tampermonkey version.
https://pastebin.com/2c08UWHS

>> No.68525198

>>68524829
>implying it makes sense to underflow to 0 in the first place

>> No.68525208

>>68524917
I would suspect it's because it can cause issues down the line.
For instance, say you insert an artist "System Of A Down", and then add some albums for it. Then you realize it should be spelled "System of a Down". Now you need to change all those referencing that key, which potentially creates issues.
Also, there might be performance issues with strings - it's a mixed bag depending on which database you have.
>If I had natural keys I could easily detect a duplicate during INSERT album
because the PK would be artist's name and album's name. With surrogate keys I can't.
Add a UNIQUE constraint in the table on album_name and artist_name.
>Also doing an INSERT of a new song requires me to do a select just to get the correct album ID that was auto-generated from autoincrement.
Yes, just use a subquery.
INSERT INTO songs (artist, album, song_name) (SELECT id FROM artists WHERE artist_name = :artist), (SELECT id FROM albums WHERE artist_name = :artist AND song_name = :song), :song;

>> No.68525238 [DELETED] 

>>68525208
>Add a UNIQUE constraint in the table on album_name and artist_name.
I cannot put an album's name as unique because different artists might have same album name.
Is there a way to make the pair (album_name, artist_name) unique?

>> No.68525279

DBfags get out
Not programming.

>> No.68525292

What is a good programming language to learn if you want a job fast (as in a junior position).
I only have the following: general IT certification from school (4 year course with everything from basic computer stuff to servers and networking), CompTIA A+ and Network+ and HTML5/CSS3.
I was considering python since there is a lot of demand for it over here, JavaScript and PHP is in high demand as well.

>> No.68525315

>>68525292
C++

>> No.68525335

>>68525208
>Add a UNIQUE constraint in the table on album_name and artist_name.
I cannot put an album's name as unique because different artists might have same album name.
Is there a way to make the pair (album_name, artist_name) unique?

>> No.68525348

>>68525315
No job listings for C++ unfortunately.

>> No.68525361

>>68525335
Yes.
UNIQUE (album_name, artist_name);

>> No.68525392

>>68525292
Haskell
300k starting
Any woman you want

>> No.68525405

>>68525392
*woman (male)

>> No.68525408

How expensive is making a new thread relative to the cost of any other syscall?

>> No.68525434

>>68525392
Don't you need to be a wizard with math for Haskell ?

>> No.68525460

>>68525434
No.

>> No.68525463

>>68522504
HANG. HIM. HIGH.

>> No.68525485
File: 345 KB, 800x716, yuru_yuri_render_pack_by_ganesa221-d79ijbr.png [View same] [iqdb] [saucenao] [google] [report]
68525485

any linux expert here?

>> No.68525544

>>68522504
*python*
class Name(object):
def __init__(self, name):
self.name = name

what is the fucking difference between "class Name(object)" and "class Name()"?

>> No.68525560

>>68525544
fuck spaces

>> No.68525572

>>68525348
liar

>> No.68525646

>>68525544
object will be the superclass in that case. Probably not what you wanted. () are not required if you have no superclass.

>> No.68525846

>>68525572
Nothing near me unfortunately.

>> No.68525867

how to make 2d mutableListOf in kotlin?

>> No.68525872

What do you think about Agile and SCRUM?

>> No.68525952
File: 402 KB, 1440x900, 0.png [View same] [iqdb] [saucenao] [google] [report]
68525952

https://plugins.jetbrains.com/plugin/10804-doki-doki-literature-club-theme

>> No.68525970

>>68525485
Don't ask to ask, idiot.
It better be programming related, though.

>> No.68525994

>>68525952
qt. gonna install it at work

>> No.68526034

i wanna learn a language to make ios games in. which one should I learn?

>> No.68526048

>>68526034
Swift

>> No.68526058
File: 3 KB, 300x38, Capture.png [View same] [iqdb] [saucenao] [google] [report]
68526058

what the fuck

>> No.68526059

I'm currently trying to create my own physics engine and I'm looking at how other game engines do it, it seems like most of them have a static class Game.Physics. I'm wondering how would that static class have access to a specific gameObject's x,y variables and be able to modify it. It also seems like there are some parameters allowing the physics to affect certain objects but not others. So I'm assuming all game objects are in an array and the physics engine will loop through them applying certain physics on each one depending on their respective parameters. That leads me to question how those parameters are stored because it certainly doesn't seem like each gameObject have a gravity setting for it self.

>> No.68526070

>>68526048
isn't swift kind of a meme?

>> No.68526076

>>68526070
Yes, but so is mobile development as a whole.

>> No.68526086

>>68526070
Not for ios programming

>> No.68526100

>>68526059
Create a "Body" or "Volume" class that contains position, shape, weight, speed, drag etc.

>> No.68526132

>>68526076
Its a market for easy money. make a game and charge $1 for something small and youll rake in money

>> No.68526157

>>68526132
About 8 years late on that biz plan

>> No.68526171

>>68525646
is this like 2.7 thing?

>> No.68526189

>>68526157
Still works.

>> No.68526203

>>68526058
have you imported it

>> No.68526217

>>68525361
wow so easy
The biggest reason I didn't want IDs as only PKs was that I wouldn't be able to detect duplicates and had to program them myself but unique solved this and now I also don't have multiple foreign keys on other tables, just one nice ID.
The only issue with IDs is that they're not useful by themselves, I always need to join with some other table and do where id = id if I want more info.

>> No.68526224

>>68526070
thats kotlin
it works in android studio but when I paste it to intelij IDEA it gives me this fucking error REEEEEEEEEEEEEEEEEEEEEEEEEEEEEE

>> No.68526256

>>68526224
>REEEEEEEEEEEEEEEEEEEEEEEEEEEEEE
Jesus christ, just fuck off.

>> No.68526267
File: 9 KB, 385x169, Capture.png [View same] [iqdb] [saucenao] [google] [report]
68526267

>>68526203

>> No.68526277

holy fuck is this language serious


impl Post {
// --snip--
pub fn approve(&mut self) {
if let Some(s) = self.state.take() {
self.state = Some(s.approve())
}
}
}

trait State {
fn request_review(self: Box<Self>) -> Box<dyn State>;
fn approve(self: Box<Self>) -> Box<dyn State>;
}

struct Draft {}

impl State for Draft {
// --snip--
fn approve(self: Box<Self>) -> Box<dyn State> {
self
}
}

struct PendingReview {}

impl State for PendingReview {
// --snip--
fn approve(self: Box<Self>) -> Box<dyn State> {
Box::new(Published {})
}
}

struct Published {}

impl State for Published {
fn request_review(self: Box<Self>) -> Box<dyn State> {
self
}

fn approve(self: Box<Self>) -> Box<dyn State> {
self
}
}

>> No.68526302

>>68526267
Try:
val x = mutableMapOf<String, String>()

>> No.68526310

>>68526277
I don't know why you're putting everything in a Box<>, or even what the point of that code is.
Trying to emulate reality in a program's structure is usually a fucking mistake.

>> No.68526338
File: 6 KB, 367x48, DeepinScreenshot_select-area_20181116172010.png [View same] [iqdb] [saucenao] [google] [report]
68526338

i'm satisfied by this message

>> No.68526339

>>68526310
>I don't know why you're putting everything in a Box<>
Because that's how you simulate polymorphism in rust

>> No.68526347

desu onions basedboy nigger

>> No.68526349
File: 3 KB, 318x89, Capture.png [View same] [iqdb] [saucenao] [google] [report]
68526349

>>68526302
reinstalled intelij
it works now

>> No.68526353

>>68526339
That's a shit way to program, in any language.
Just use an enum.

>> No.68526377

>>68526338
ew

>> No.68526424

>>68525867
???

>> No.68526434

>>68525872
pls respond

>> No.68526449

>>68526434
this is the programming thread, pls fuckoff

>> No.68526470

>>68526449
It is forced in so many programming jobs, how is it not programming related?

>> No.68526484

>>68526424
nvm >>68526349 works now

>> No.68526506

>>68524693
I don't know perl, but have you tried reading from stdin?

>> No.68526519

>>68526470
>stupid non sequitur
eating lunch is also a part of many programming jobs

>> No.68526553

>>68526519
>latin for no damned reason
Eating lunch does not have anything to do with the work you are doing. How fucking retarded are you?

>> No.68526567

>>68526553
>latin for no damned reason
Not him, but: brainlet begone.

>> No.68526571

>>68526553
Wow, nice, you've figured it out! Good job! Confused by your last sentence though, shouldn't it be "thanks for enlightening me, I will refrain from posting off topic again!"?

>> No.68526631

>>68526567
>>68526571
Excuse me? Is that a way to treat a lady?

>> No.68526648

>>68526631
xd

PS agility and scum are good but a lot of teams seem to say "we do agile" but really they mean "we do standup every morning but have no real process other than that"

>> No.68526653

>>68526631
>How fucking retarded are you?
>lady
You're not acting like a lady.

>> No.68526679

>>68526653
What's the matter? Can't handle some strong words from a strong woman?

>> No.68526697

>>68526679
>woman
Stop being delusional. I can't stand hypocrisy, and double standards. So, miss with that feminist bullshit.

Enough of this off-topic shit.

>> No.68527056
File: 2.31 MB, 279x350, 200.0% BOTHER.gif [View same] [iqdb] [saucenao] [google] [report]
68527056

>>68522911
Just plagiarising someone else's game of noughts and crosses. It's half done, just missing the logic.
Simplified all of the names to post it ITT. Should still work.
>Error: Too many lines
Bother.
#include <stdio.h>
#include <stdlib.h>

typedef struct{ char **gB; int st; int se; int t; } G;

char **sB(){ char **b = calloc(9, sizeof(char *)); int i, j;
for(i = 0; i < 9; i++) b[i] = calloc(9, sizeof(char)); for(j = 0; j < 9; j++)
for(i = 0; i < 9; i++) b[j][i] = '.'; return b; }

void fB(char **b){ int i = 9; while(i) free(b[--i]); free(b); }

void pB(G *g){ char **b = g->gB; int i, j, k, l; for(i = 0; i < 9; i++)
for(j = 0; j < 9; j++) if(b[i][j] >= '1' && b[i][j] <= '9') b[i][j] = '.';
if(!(g->se)) for(i = 0; i < 9; i++) b[i][4] = '1' + i; else{
for(j = 0; j < 3; j++) for(i = 0; i < 3; i++){
char *c = &(b[g->se - 1][3*j + i]); if(*c != 'O' && *c != 'X')
*c = 3*j + i + '1'; } } puts("\n"); for(l = 2; l >= 0; l--){
for(j = 2; j >= 0; j--){ printf(" "); for(k = 0; k < 3; k++){
for(i = 0; i < 3; i++) putc(b[3*l + k][3*j + i], stdout); if(k != 2)
putc('|', stdout); } fputc('\n', stdout); } if(l) puts(" ---+---+---"); }
printf("Turn: %c\n", g->t ? 'X' : 'O'); printf("Input: "); }

int pI(){ int i; while((i = getc(stdin)) < '1' || i > '9'); return i; }

int aP(G *g, int i){ if(i == -1) exit(0); i -= '0'; int seg = g->se; if(!seg){
g->se = i; return 1; } char *s = &((g->gB)[seg - 1][i/3 + i%3]);
if(*s == 'O' || *s == 'X') return 0; *s = g->t ? 'X' : 'O'; g->t = !(g->t);
g->se = i; return 1; }

int main(){ while(1){ G g; g.gB = sB(); g.st = g.se = g.t = 0; while(g.st == 0){
pB(&g); int i = pI(); aP(&g, i); } fB(g.gB); } }

>> No.68527081

>>68527056
It looks like you're trying out for ioccc.

>> No.68527096

>>68525872
Its not good or bad, depends on what you want. In ye olden days you had to ship a finished piece of software, on physical media with printed manuals. That meant everything had to be finished, code mostly-bug free, to the point that people just put up with whatever bugs were left, manuals completed etc.

Nowadays you can just ship out a "minimum viable product", which in some cases is just a mobile app with stub menus and no actual functionality, ,and then just iterate features/bugfixing as you receive feedback from the users.

I prefer working on software that will be A) finished B) in use a long time. A friend I knew was employed providing support for software running a mechanics shop running on a C64 with a dot-matrix printer attached. The software was stable, they just engaged him whenever new legislation/car models needed to be added.

>> No.68527098

>>68527081
Sadly, I'm just trying to post on 4chan.

>> No.68527231

Just finished and published the first release of my sFlow parser library
Started working on a Linux kernel module that hooks into Netfilter and can export sFlow directly from the kernel. I'm not sure whether I want to control it using sysctls and /proc/sys, or if I should use a Netlink interface with a nice utility like ip and tc

>> No.68527298

>>68527231
github link?

sounds serious business

>> No.68527343

>>68527298
Search for pysflow on GitHub, it's the first result
The kmod is not there yet. I'll publish it after the first working prototype

>> No.68527364

>>68526697
>feminism is hypocritical
no it's not you chauvinist

>> No.68527416

Hello dear anons
Im learning Python
I've read basic things + completed a course at Codecademy
Now I'm making some projects ( and learning new things doing that) but I feel that it (learning) goes somewhat wrong/slow/retarded
Any hints for learning?

>> No.68527437

>>68527416
stop being dumb?

learning is the easiest thing in the world if you can't even manage it you should just resign yourself to flipping burgers

>> No.68527474

>>68522635

if ($counter eq 4) { ... }
if ($bool ne 0) { ... }
[\code]

Perl 5 is pretty flexible regarding regarding numeric and string coercion but why use the string comparison operators instead of the more appropriate numeric ones?


Put spaces around the string concatenation operator. That looks so much like a method call.

>> No.68527487

>>68527364
>women are equal to men
>women need special treatment so that men don't dominate politics and business

>> No.68527492

>>68522635
if ($counter eq 4) { ... }
if ($bool ne 0) { ... }


Perl 5 is pretty flexible regarding regarding numeric and string coercion but why use the string comparison operators instead of the more appropriate numeric ones?


Put spaces around the string concatenation operator. That looks so much like a method call.

>> No.68527502

>>68527487
>me unga
>you bunga
Really? Anyway if you're actually interested in the matter, look into the distinction between equal consideration and equal treatment.

>> No.68527542

>>68524693
https://stackoverflow.com/questions/2810145/simple-file-reading-in-perl

>> No.68527585

>>68527364
Bitch, I said enough!

>> No.68527630

>>68527437
What's the point of you even posting? Why don't go beat your dog or something?

>> No.68527695

Gtk - yes or no?

>> No.68527698

>been setting up rtorrent webui, rutorrent
>make it run under nginx
>remember I haven't installed php yet
>installing php also installs apache
>"huh, whatever"
>install, start getting 403 on /rutorrent
>god knows why apache has priority over nginx and took over port 80
>disable apache and kill processes
>apache page still shows up
>what
>best answer I found was "this happens, just wait a bit"
>can't even restart the machine because python compiling in another session and that takes forever
So that's how my friday night is going

>> No.68527818

>>68527695
No. Glib is a bloated nightmare.

>> No.68527908

>>68522504
Didn't he die two years ago a month ago

>> No.68528012

>>68527818
But it really doesn't look like there's anything else for C.

>> No.68528086

>>68528012
I don't know why all GUI libraries are such garbage.
Everything I've ended up doing has been done using the native windowing protocol directly (libxcb and libwayland-client), but the use for it was simple enough to not really matter.

>> No.68528089

>>68528012
>for C
found your problem

>> No.68528177

Dumb as fuck question here: how do I display images in C++? For example, create a window showing a 600x400 image where I can specify the colour of each pixel in said image, and also display animations by constantly redrawing the pixels/refreshing the image. Right now everything I do is just text in the terminal.

>> No.68528240

>>68528177
you probably need to install SFML.

>> No.68528313

name a language with the smallest amount of undefined behaviour?

>> No.68528324

>>68528313
Rust

>> No.68528327

>>68528177
This is entirely dependent on the windowing system that is being used.

>> No.68528407

>>68527630
Why would I beat my dog?

>> No.68528413

>>68523239
SJWs are not actually inclusive. Did this guy only now discover this?

>> No.68528422

>>68528313
haskell

>> No.68528428

>>68528177
You can't, not without adding a pile of platform specific external dependencies. Use Java instead.

>> No.68528445

>>68528422
>literally has undefined

>> No.68528448

>>68527698
>"""install php"""
>it also installed Apache
what did he mean by this?

>> No.68528461

>>68528445
... so?

>> No.68528507

>>68528313
Haskell, obviously.

>>68528445
The behaviour of that construct is well defined. You would have known this if you had just googled it before making a food of yourself.

>> No.68528528

>>68528461
>>68528507
Haskell people are so defensive all the time they can't take a joke that obvious.

>> No.68528534

>>68527698
What distro is this?
>can't even restart the machine because python compiling in another session and that takes forever
Gentoo?

>> No.68528566

>>68524917
Anything but an integer autoincrement as PK is absolutely retarded.

>> No.68528608

>>68528534
Nah, raspbian. It's just one of the several packages that don't have the latest stable version in the official repositories.
Same thing with nginx, they offer 1.10 out of the box, at least I didn't have to compile that too.
Also docker. arm really is a pain in the ass.

>> No.68528613

>>68528528
>II-I-I w-was just pretending!!!
sure

>> No.68528639

>>68524917
>If I had natural keys I could easily detect a duplicate during INSERT album
>because the PK would be artist's name and album's name.

Assumes there can't be two different artists with the same name and same album. What if some retard decides to copy another artist rightdown to the name? Your "natural" shit will work 99% of the time and then you will get fucked by incredibly obscure cases you didn't think of. Same reason why anything but a free-form text field for people's names is wrong.

>> No.68528682

>>68528639
>>68528566
Calm down dude. Some of us work in nonretarded domains and can actually reason about our data. Meaningless pk is a last resort.

>> No.68528707

having a primary key in your databases at all is based on radical atheistic atomism and is no doubt in violation of the Holy Roman Church's catechism

>> No.68528723

Can someone post the "programming challenges" picture?

>> No.68528742

>>68528723
No.

>> No.68528746

>>68528723
no

>> No.68528753

>>68528682
Basing the integrity of your DB on business rules (uniqueness of (album, artist)) sounds like an awful idea, regardless of specific domain.
Do you have an example?

>> No.68528791

>>68528177
Need a library. Either SDL or SFML will suit you in exploring graphics and sound.

>> No.68528810

>>68528682
LOL I love it when people think they understand domains. They don't. Even experts in a field don't fully understand their domain.

Basically if you can't publish a mathematically sound paper proving beyond shadow of doubt that every single data point is absolutely positively unique and it stands rigorous peer review, you have no business "reasoning" about anything.

>> No.68528827

>>68528753
Yeah, so for example a client's project cannot have the same name as another project of theirs. So we need a unique constraint anyway and have a way to uniquely refer to a project. Why add a superfluous column? Answer: because your dumb.

>>68528810
??????

>> No.68528845
File: 507 KB, 1070x601, kill me.png [View same] [iqdb] [saucenao] [google] [report]
68528845

>>68522504
>Writing a direct map cache simulator using a stack to find LRU for my systems class
>200 lines in and I wanna fucking kill myself

I HATE C

>> No.68528860
File: 1.76 MB, 1075x1518, 1537985908896.png [View same] [iqdb] [saucenao] [google] [report]
68528860

>>68528845
r e w r i t e
i n t o
H a s k e l l

>> No.68528867

>>68528827
Oh, this is bait.

>> No.68528882

>>68528827
Ah yes, the "its fine because our client said so" defense. And then an unforeseen business opportunity happens! Your client takes over somebody else's project! And it just so happens to have the same name! And then it ends up as name2 in the database because it'd be a pain in the ass to rename everything! Ahh the bliss.

>> No.68528897

>>68528860
who this cumslut be

>> No.68528912

>>68528867
Don't be mad, dumby. Consider this a chance to expand your little horizons.

>>68528882
Because the client said so? No, there are many clients, and we do not allow them to have projects with the same name. The uniqueness is on (client, name). Your counterargument is retarded anyway since the "other project" isn't in the system anyway so why would it have to have the same name?

>> No.68528928

in c++, I have an base class inside a header. It's never going instantiated, only the derived classes are.
Can I define a method that's gonna be used by derived classes directly inside the header file?

>> No.68528946

>>68528928
Sure, why not. By the way what's a header file? Is that like an xml file?

>> No.68528953

>>68528897
all Haskell programmers are anime girls this attractive

>> No.68528960

>>68528953
Gay. No, I'm male, why are you assuming my gender?

>> No.68528966

>>68528960
there's a lot to unpack in this post

>> No.68528989

So, start with C++, then Assembly, some Lisp and then I will be a master at computaz.

>> No.68529007

I am practically a good at programming. It would be unjust for me to hog all of the genius poured into me by the heavens though, so i want to teach nerds how to program. What's the best way to do this?

>> No.68529019
File: 634 KB, 460x460, 1541009643199.png [View same] [iqdb] [saucenao] [google] [report]
68529019

>>68529007
shitpost on /g/

>> No.68529028

>>68529007
Start streetsweeping operations on Stackoverflow.

>> No.68529029

>>68529019
Ok!

>> No.68529039

>>68529028
SO is ok if you're just altruistic in general and want to help people out. I mostly want to teach people to program in general though and SO is largely about solving specific, discrete problems... I wanna teach people the big picture stuff!

>> No.68529041

>>68523956
Sauce? I want more femdom programming!

>> No.68529044

>>68528928
No, but you can make the method pure virtual.

class base{
void method() = 0;
};


This is a bit different than what you asked, because it has no definition. This means any class that inherits base that will be instantiated will have to define method.

>> No.68529047

>>68529039
Stackoverflow is filled with misinformation. You can do you part by ridding the community of this dirt.

>> No.68529049

>>68529039
SO is so boring these days. I've been hanging around retrocomputing instead

>> No.68529108 [DELETED] 
File: 960 KB, 1080x1080, despiseful_woffee.jpg [View same] [iqdb] [saucenao] [google] [report]
68529108

>>68522708
>>68522504
>bomb kids in countless countries
>murder scientists in other countries
>throw viruses, trojans, and malware around in other countries like it is candy
>literally claim resources in other countries as their own
>force other countries to stop talking to some country, and do everything in their power to mess with their government/elections
suddenly
>some basedbro is tired of this shit and yoinks their diary and shows it to his friends
>"OMG TREASON TRAITOR MURDER MUHHH FREEDOM NO MORE!11"
I hate americans so much

>> No.68529139

>>68525292
Java, but you will probably kill yourself in future, because you will be java programmer.

Better learn C, C++ and x86 + AMD64 asm and get a job as a reverse engineerer.

>> No.68529140 [DELETED] 

>>68529108
Don't worry bro
America will kill itself with leftism soon
We will literally aee america implode in our lifetimes

>> No.68529183 [DELETED] 

>>68529108
Your logic
>America is the bad guy! They bombed Japan and Germany! They even shot soldiers there!!!!!
You realize how dumb you are? Go fap to your loli cartoons and hope the government doesn't get you for your 5 terabytes of childporn.

>> No.68529211 [DELETED] 

>>68529183
oh thanks for reminding me
>japan bombs a military installation
>"REEEEEEEEEEEEEEEEE"
>goes on to bomb magnitudes more in civillians
>"h-home of the brave"

>> No.68529219

>>68529108
that sounds like self interest, anon.

>> No.68529223 [DELETED] 

>>68529108
US is baby shit compared to the stuff Israel does on a daily basis. But now q the replies of calling me a dumb /pol/ poster.

>> No.68529232

>>68528089
What's wrong with C? I think it's great for linux systems programming.

>> No.68529234 [DELETED] 

>>68529223
as if there is a difference between the two :^)

>> No.68529249 [DELETED] 

>>68529140
God I hope so. It will be like watching the collapse of Barad-dur.

>> No.68529250

>>68527698
make sure that you have the /rutorrent aliased correctly in your nginx.conf file.

>> No.68529278 [DELETED] 

>>68529234
well atleast we fought for our land. And didn't get it through means of post-war confusion and playing the victim to a war we largely contributed to ourselves.
You really have to admire the dedication though.

>> No.68529312

jesus christ /pol/ shit get out of my thread RRRRREEEEEEEEEEEEEEEE

>> No.68529350 [DELETED] 

>>68529211
Play stupid games
Win stupid prices

>Waaahhh they bombed them more!!
Have you finished primary school yet? If you think the real world, and by extension political-military strategy works, you're a fucking retard.

>> No.68529413

What are, in your opinion, some examples of projects with beautiful source code?

>> No.68529428

>>68529413
The linux kernel is generally pretty good to look at.

>> No.68529447

>>68529413
>>68529428
All projects in C are disqualified because C is an inherently ugly language.

>> No.68529463

>>68529447
And what do you think looks good, meme-kun?
inb4 a C-like syntax.

>> No.68529473

>>68529463
D and Idris.
Though like any language, you can easily write ugly code in both. But generally code looks good rather than shit.

>> No.68529479

>>68529428
I don't like the braces with on the same line as the control flow construct.

>> No.68529481

>>68529473
>D
AHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHHAHA

No.

>> No.68529487

>>68529473
>D
HAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHA

>> No.68529488

>>68529479
Well, you just have objectively shit taste.

>> No.68529496

>>68529481
>>68529487
now tell me why instead of
>lmao ded lang

>> No.68529502

>>68529488
>objectively
kek. Seriously though, it's more readable to me.

>> No.68529522

>>68529502
second
it avoids you having to zigzag-scan for the opening and closing to confirm that they are there
(because after all, omitting them is something people often do when there is only 1 line for some inexplicable reason).

>> No.68529524

>>68529413
I'm sorry, I should have specified I meant code that is easy to read and understand, not just aesthetically pleasing

>> No.68529526

>>68529496
D had templates or something retarded like that inside fucking string literals.

>> No.68529533

>>68529526
you fucking what m8?
You talking about string mixins?

>> No.68529544

>>68529533
Probably; I don't fucking know that meme language.
I just remember seeing strings being used in a really retarded way.

>> No.68529566

>>68529522
>(because after all, omitting them is something people often do when there is only 1 line for some inexplicable reason).
I omit when the control flow construct is on the innermost nest.
/* Bueno */
if (trees)
smoke(trees);

if (!bong_clean)
{
if (isopropyl_alcohol)
clean(bong);
}

/* No bueno */
if (!bong_clean)
if (isopropyl_alcohol)
clean(bong);

>> No.68529573

>>68529544
Well regardless, a controversial tool hardly counts as the whole language.

>> No.68529588

>>68529413
My code. Too bad the repository's private.

>> No.68529632

>>68522530
fpbp

>> No.68529756 [DELETED] 

>>68529211
>Japanese
>civilians
Every man woman and child who weren't already conscripted were given sharpened sticks and told to fight for their emperor. We could bleed them slowly via land invasion, having to enact total warfare and kill magnitudes of tens more then we did. Or we could scare the absolute shit out of them and have them cease and desist.

Reminder we had to completely vaporize not one, but TWO(2) cities before they lost the will to fight. 2 times, we had to incinerate an in instant everything in a huge radius to get them to stop. Imagine if all we had available was simply land invasion? The slow process of losing ground, but seeing the immediate satisfaction of murdering American GIs. We need only look to Korea and Vietnam to see how well that worked.

>> No.68529770 [DELETED] 

>>68529756
whoa there anon, be careful with that logic, it's pretty dangerous around brainlets

>> No.68529800 [DELETED] 

>>68529756
This. The slopes were ready to make everyone fight to the death.

>> No.68530078 [DELETED] 

>>68529800
based japanese

>> No.68530164 [DELETED] 

>>68529756
>[Current year]
>Americans still believe in generations old propaganda

>> No.68530204 [DELETED] 

>>68530164
>[Current]
>Japs still spread their assholes and apologize every year
>Last industrialized country to ban cp
>nips were grandfathered in up until two years ago
Fuck you, and everything you stand for.

>> No.68530275 [DELETED] 

>>68530204
The president knew about a planned attack three days before Pearl harbor and its no coincidence that carriers were missing.
The idea that the nukes were necessary for peace is still contested. Japanese leadership were fearing a Soviet invasion more than anything and would have likely surrendered without the 6 gorillion allied death toll that the US predicted.
The nukes were primarily used as a display of America's power.

>> No.68530298

Lua is a nice implementation hidden underneath a shitty language.

>> No.68530312 [DELETED] 

Test

>> No.68530316 [DELETED] 

>>68530275
I grow tired of your stupidity. Fuck off with your off-topic bullshit, you diaper sniffing faggot.

>> No.68530340

Are code tags broken?

>> No.68530363

>>68530340
seems to be

>> No.68530529

Should I bother learning web scraping (python scrapy) if I want to get into test automation? Thinking of learning both selenium and scrapy but it's time consuming.

>> No.68530578 [DELETED] 

>>68530316
>I grow tired of your stupidity. Fuck off with your off-topic bullshit, you diaper sniffing faggot.
I didn't make the thread and I was replying to two paragraphs of pure bullshit.

Did your grandpa get killed or are you just another flouridated mutt?

>> No.68530601 [DELETED] 

>>68530578
Enough, I won't ask you again.

>> No.68530621 [DELETED] 

>>68530578
the japanese would consider you a faggot anon

>> No.68530628 [DELETED] 

>>68530621
*would have
defending your own country is one thing, but being such a bitch pacifist is another

>> No.68530643 [DELETED] 
File: 124 KB, 691x680, 1494800045024.jpg [View same] [iqdb] [saucenao] [google] [report]
68530643

Watch out we got a 56% badass over here. >>68530601

>> No.68530646 [DELETED] 

>>68530621
>>68530628
Stop with the off-topic horseshit.

>> No.68530661

>>68530646
You realise this dude will be back again and again if you just leave him right?

>> No.68530696 [DELETED] 

>>68530621
Why would I care about the opinion of micropeen gooks?
Im not defending the honor of the Japanese or some bullshit. Im tired of these flouridated tards who think their country is some bastion of liberty and justice.

>> No.68530703

>>68530601
Nope, no last post for (you).

>> No.68530711 [DELETED] 

>>68530298
>1 indexed
>>68530696
>flouridated tards who think their country is some bastion of liberty and justice
no shit it's a secular republic

>> No.68530719

>>>/pol/
This is /g/dpt/

>> No.68530724 [DELETED] 

>>68530711
>flouridated
go back to /x/

>> No.68530732

>>68529566
dude
weed
lmao

>> No.68530752

>>68530732
Fuck off, that's just what popped in my head.

>> No.68530797

I'm curious about server hardware for a specific task. What kinda equipment do you think I'd need if I wanted people to be able to upload an image and then I'd use FFMPEG to add that image in the bottom right hand corner of a video and then download it?

>> No.68530834

>>68530797
It depends on how many clients you are servicing. If you're doing, say 1000 downloads a month, you could probably get away with an older laptop w/ port forwarding. If you were doing significantly more, you might want to look into IAAS hosting. I doubt you would want to pay for the hardware and business line.

>> No.68530893

>>68530834

I was intending on using a VPS like Digital Ocean so I couldn't get away with a laptop I'm afraid. I would estimate about 400 videos needing to be rendered each month, not all at the same time though.

>> No.68530905

>>68530893

Forgot to mention: With each video downloaded only once so I don't expect the bandwidth to be the Achilles heel.

>> No.68530947

>>68530893
>I was intending on using a VPS like Digital Ocean
I can vouch for them, they're very good for what they charge. A couple of instances when my server was down because of something on their end.

>so I couldn't get away with a laptop I'm afraid.
I have a few clients to which I provide telephony with voip; I have my old college shit dell laptop running strong. You can do it!

>I would estimate about 400 videos needing to be rendered each month, not all at the same time though.
That's not much. You probably want a server with two or more cores.

>Forgot to mention: With each video downloaded only once so I don't expect the bandwidth to be the Achilles heel.
Heh, you don't want to pay for the excess bandwidth usage. I remember when they're were still planning on charging for bandwidth. Sure, would have to configure that in the backend.

>> No.68531001

>>68530947

That sounds pretty reasonable and around what I was hoping. Thankfully since the videos will be between 1-5 minutes even the terabyte of bandwidth you get on their cheapest plans should be more than enough. Thanks very much for your advice!

>> No.68531044

>>68531001
>Thankfully since the videos will be between 1-5 minutes
Dude, that can easily be done in a reasonable amount of time.

>even the terabyte of bandwidth you get on their cheapest plans should be more than enough.
protip: compress and lose some quality, just enough that isn't readily discernible.

>Thanks very much for your advice!
np, godspeed.

>> No.68531076

>>68531044

That's what I was hoping for! They'll actually only be stored at 720p so the storage size will be relatively small as well. They're videos to be used for social media marketing and FB only really does 720p so no need to store copies online at that resolution (though obviously I'm holding onto the 4k originals for future-proofing).

>> No.68531128
File: 462 KB, 682x960, lewds_to_get_replies.png [View same] [iqdb] [saucenao] [google] [report]
68531128

I'm trying to use the substr function in CPP but I can't seem to get it to work, Here is the following code and its output


cout << PI << '\n';
cout << PI.substr(0, 5) << '\n';


which outputs:


10110110010000000000000000000000
00000


Anyone know why? I've been stuck on this for ages.

>> No.68531153

>>68531128
What is PI?

>> No.68531167

>>68531153
duh nevermind

>> No.68531187
File: 1.08 MB, 1264x1728, 1511297700882.jpg [View same] [iqdb] [saucenao] [google] [report]
68531187

>>68531153
I'm Simulating the Manchester Baby experiment and PI is the present instruction. But what you likely meant: Here's the declaration of PI in my default constructor. It changes value as it is read in from a file
string PI;
PI = "00000000000000000000000000000000";

>> No.68531194

>>68531167
>>68531153
4chan X updated too late...

>> No.68531214

>>68531187
I think you're missing or forgetting something you did in your code.
grep cout code.cpp

>> No.68531292
File: 29 KB, 640x351, s7hwqorjjaaz.jpg [View same] [iqdb] [saucenao] [google] [report]
68531292

>>68531214
Nah, If I comment out those two lines then nothing else outputs, however during testing I noticed some really weird which might be the key to working this out.

The following code
for (size_t i = 0; i < PI.length(); i++) {
std::cout << "index: " << i << " Ouputs: " << PI.at(i) << '\n';
}


Outputted:
index: 0Ouputs: 0
index: 1Ouputs: 0
index: 2Ouputs: 0
index: 3Ouputs: 0
index: 4Ouputs: 0
index: 5Ouputs: 0
index: 6Ouputs: 0
index: 7Ouputs: 0
index: 8Ouputs: 0
index: 9Ouputs: 0
index: 10Ouputs: 0
index: 11Ouputs: 0
index: 12Ouputs: 0
index: 13Ouputs: 0
index: 14Ouputs: 0
index: 15Ouputs: 0
index: 16Ouputs: 0
index: 17Ouputs: 0
index: 18Ouputs: 0
index: 19Ouputs: 0
index: 20Ouputs: 0
index: 21Ouputs: 0
index: 22Ouputs: 0
index: 23Ouputs: 0
index: 24Ouputs: 0
index: 25Ouputs: 0
index: 26Ouputs: 0
index: 27Ouputs: 0
index: 28Ouputs: 0
index: 29Ouputs: 0
index: 30Ouputs: 0
index: 31Ouputs: 0
index: 32Ouputs:
index: 33Ouputs: 1
index: 34Ouputs: 1
index: 35Ouputs: 1
index: 36Ouputs: 0
index: 37Ouputs: 0
index: 38Ouputs: 0
index: 39Ouputs: 0
index: 40Ouputs: 0
index: 41Ouputs: 0
index: 42Ouputs: 0
index: 43Ouputs: 0
index: 44Ouputs: 0
index: 45Ouputs: 0
index: 46Ouputs: 0
index: 47Ouputs: 1
index: 48Ouputs: 0
index: 49Ouputs: 0
index: 50Ouputs: 0
index: 51Ouputs: 0
index: 52Ouputs: 0
index: 53Ouputs: 0
index: 54Ouputs: 0
index: 55Ouputs: 0


It keeps going, but word limit, it seems that every time I try to replace the the previous PI with the next line in the file it instead adds it onto the end of the current PI, but won't display unless i treat it like a array, it's only supposed to be of size 32.

>> No.68531380

>>68531214
Never mind, fixed the issue, after explaining it out I decided to go look at my load from file function again and it was loading the entire string into every index of the array...

¯\_(ツ)_/¯

>> No.68531381

>>68531292
Get off your phone. I don't know sepples, I use C, but it seems like the length of PI isn't 33; it's just null terminated at position 32.
cout << "PI.length(): " << PI.length() << endl;

Use pointers, my dude.

>> No.68531435

>>68531380
>>68531381


Also not on my phone, What about my grammar makes you think I am?

>> No.68531436

>>68531128
based alter poster

>> No.68531465

>>68531435
>but word limit

>> No.68531471

>>68531465
4chan has a word limit of 2000, doesn't it?

>> No.68531488

>>68531471
Ah, I thought it was auto-correct.

>> No.68531501

Anyone else getting "Connection error." when they try to post code blocks?

>> No.68531506

>>68531501
git
gud
nerd

>> No.68531519

>>68531501
lol, he's teasing you. You used a keyword that's barred as a prophylactic measure.

>> No.68531529

>>68526449
fucking moron

>> No.68531537

>>68531529
>moron fucking
Well, that explains you...

>> No.68531552
File: 37 KB, 1280x720, bane.jpg [View same] [iqdb] [saucenao] [google] [report]
68531552

>>68531187
string PI;
PI = ...;

Why would you declare a variable only to define it on the next line?

>> No.68531564

>>68531552
you're a big type.

>> No.68531567

>>68531552
not him, but maybe declaration and initialization happens on non-adjacent lines.

>> No.68531571

>>68531552
It's actually a private variable and the declaration is the default one in the constructor, I simply moved them side by side for ease of people reading.

>> No.68531630
File: 120 KB, 836x693, Schermafbeelding 2018-11-17 om 09.43.34.png [View same] [iqdb] [saucenao] [google] [report]
68531630

I have a switch inside an if statement inside a function that executes every frame(of the game). Is this bad practice?

>> No.68531735

>>68522504
Does w10 run any integrity checks on system EXEs before running them?

Would it be possible to inject or replace explorer.exe for example and get away with it?

>> No.68531777

>>68531735
>Does w10 run any integrity checks on system EXEs before running them?
Yes, I believe so.

>Would it be possible to inject or replace explorer.exe for example and get away with it?
Today, I don't think so. Download a vm, and test it. BTW you want to do DLL injection, not replace explorer. If you really want to exploit windows, learn ROP and how to get mem leaks to exploit windows. JS is popular for this.

>> No.68531794

>>68531777
downloading a vm as we speak. My another target is bloatware running in the background like synaptics touch helper and such...

>JS is popular for this.
What do you mean? the built in javascript interpreter from the win98 days?

>> No.68531807

>>68531630
Don't know. Just keep on programming.

>> No.68531819

>>68531794
>My another target is bloatware running in the background like synaptics touch helper and such...
Fuzz the shit out of it, my dude.

>What do you mean? the built in javascript interpreter from the win98 days?
No, I mean make a website, and try to use js to get a mem leak. With a leaked address, you circumvent ASLR. You're trying to find bugs in microshafts js engines. You might want to take some time and learn about all this before you try and quit out of frustration.

>> No.68531820
File: 56 KB, 621x702, vO7lRZ7.png [View same] [iqdb] [saucenao] [google] [report]
68531820

trying to understand parser combinators
we are on like 5 or 6 levels of higher order functions right now fuck

>> No.68531826

New thread:
>>68531821
>>68531821
>>68531821

>> No.68531850
File: 18 KB, 426x493, 19105960_1930444043911856_8358147151837272571_n.jpg [View same] [iqdb] [saucenao] [google] [report]
68531850

Came here to meet fellow real alpha Codeforces programmers.
But all of you are just dumb langfags, as it seems.

>> No.68531885

>>68531850
Thanks for gracing us with your comment.

>> No.68532734

>>68528566
>has never worked at web scale
uuid is the most future proof. if you out grow a single db instance you can shard across multiple or move your data to dynamo or other key value architecture. numeric monotonic increasing keys don’t work well in that scenario

>> No.68533785

How do I write a JavaFx fxml document to handle dynamic content?

I have this tile view below, I want to populate it with a list of objects that will eventually have images and other fields but for now I just want to display a title and description for each.

<?xml version="1.0" encoding="UTF-8"?>

<TilePane prefHeight="400" prefWidth="600" fx:controller="org.project.ui.controller.MainController"
xmlns:fx="http://javafx.com/fxml" alignment="center" hgap="10" vgap="10" prefColumns="5">

</TilePane>


Normally with something like angular js you could just do something like:

<table for each object List<Object>>
<row>$object.title + $object.description</row>
</table>


How do I do the same in fxml, I know I can bind a list into the fxml, but how do I then do a single line that will iteratively display every item in that list? Or do I have to create the ui objects in the controller and insert complete objects into an empty tile view with no display information i.e. completely ruining the point of using a MVC architecture?

>> No.68534049

>>68531630
you could put all switch code in a separate function TouchStep(Touch), then call TouchStep(touch[0]) instead of putting the whole switch block in the Update() function
about fingerCount, throw it away from the switch code and manage it before call to TouchStep()
it will be minimally less efficient, but much easier to later read, modify and maintain

>> No.68534191 [DELETED] 

Lets say I have the following situation

[CODE]
class A {

B b = new B();

someMethod() {
//does something
}
}

class B {

someVar;
}

[CODE]

and I want someMethod() do be called every time b.someVar changes. What would the cleanest way be of achieving that?

The solutions I can think of all lead to code smell.

>> No.68534200

Lets say I have the following situation

[CODE]
class A {

B b = new B();

someMethod() {
//does something
}
}

class B {

someVar;
}

[/CODE]

and I want someMethod() do be called every time b.someVar changes. What would the cleanest way be of achieving that?

The solutions I can think of all lead to code smell.

>> No.68534204

>>68534191
Setter?

>> No.68534209

>>68534191
>>68534200
Just use a setter, fag.

>> No.68534217
File: 104 KB, 1200x900, doveassangeofgoodluck.jpg [View same] [iqdb] [saucenao] [google] [report]
68534217

>>68522504
Posting Assange Dove.
Also, working on decentralized image board as alternative to ((4chan)).

>> No.68534220

>>68534204
>>68534209
I have to specify the method in A, not B.

And I have to make sure that it is not possible to set somevar without calling someMethod().

>> No.68534236

>>68534220
That doesn't change anything.

>> No.68534239

>>68534220
Pass someMethod as a lambda in B's constructor.

>> No.68534242

>>68534236
It does.

>>68534239
Mm that might work.

>> No.68534250

>>68534217
Glad our gov is finally taking the aussie shitposting menace seriously tbqh

>>
Name (leave empty)
Comment (leave empty)
Name
E-mail
Subject
Comment
Password [?]Password used for file deletion.
Captcha
Action