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: 1.95 MB, 1618x1308, hidamari_dpt_waifu2x_traps.png [View same] [iqdb] [saucenao] [google] [report]
65850737 No.65850737 [Reply] [Original] [archived.moe] [rbt]

Old thread: >>65844787

What are you working on, /g/?

>> No.65850765

>>65850737
i disagree, OP!
traps ARE programming related.
they have been programmed to go against their nature. not just in mind, but in physical forms as well. deviant behavior.
some 7331 hAx0R$ have won.

>> No.65850771
File: 147 KB, 500x281, average dpt poster.png [View same] [iqdb] [saucenao] [google] [report]
65850771

>>65850765
*hacks you*
you're trap now

>> No.65850776

>>65850771
you and i BOTH wish

>> No.65850780

>>65850737
anon in old thread
>>65850689
yeah, i'm wrapping everything in classes at the moment. so using classes as my data structures for storing the rings and points will be fine. already tried and approach with arrays and it got really messy, since i'm not the best programmer right now.

here's some incomplete code, missing some features. how shit is it?

>> No.65850784
File: 164 KB, 1280x720, 1525444236947.jpg [View same] [iqdb] [saucenao] [google] [report]
65850784

>>65850776
gay

>> No.65850793
File: 21 KB, 221x246, 1472362242684.jpg [View same] [iqdb] [saucenao] [google] [report]
65850793

public static String makePolygons(String lat_a, String lon_a, String lat_b, String lon_b, Double alt_a, Double alt_b, Integer steps_in_circles) {

/* How many degrees are in a meter? */
double lat_meter = 1 / (Constants.EARTH_CIRCUMFERENCE_IN_M / 360);
double lon_meter = (1 / Math.cos(Math.toRadians(Double.valueOf(lat_a))) * lat_meter);
/* $steps_in_path is an array of values between 0 (at $from) and 1 (at $to)

First we do that at some fixed fractions of path
*/

//List<Double> pathSteps = new ArrayList<Double>();
List<Double> steps_in_path = new ArrayList<Double>();
steps_in_path.add(0.0);
steps_in_path.add(0.25);
steps_in_path.add(0.4);

//{0, 0.25, 0.4};
double[] taper_steps = new double[]{0.3,1,2,4,7,10,20,40,70,100};
List<Double> temp = new ArrayList<Double> ();

double fromLat = Double.valueOf(lat_a);
double fromLon = Double.valueOf(lon_a);
double toLat = Double.valueOf(lat_b);
double toLon = Double.valueOf(lon_b);
double fromAlt = alt_a;
double toAlt = alt_b;

double dis = PtPMath.distanceUsingGPS(fromLat, fromLon, toLat, toLon, fromAlt, toAlt);
double bear = PtPMath.bearingBetweenTwoPoints(fromLat, fromLon, toLat, toLon);
double wavel = wavelen;

// Then we add some steps set in meters because that looks better at
// the ends of the beam

for (double step : taper_steps) {
steps_in_path.add( step / dis );
}

temp.addAll(steps_in_path);
// Add the reverse of these steps on other side of beam
for (double step : temp) {
steps_in_path.add( 1 - step );
}

// Sort and remove duplicates
steps_in_path.sort(Comparator.naturalOrder());
List<Double> pathStepsNoDupes = new ArrayList<Double>(new LinkedHashSet<>(steps_in_path));

return polygons.toString();
}

>> No.65850798

>>65850793
dumb frogposter

>> No.65850860

>>65850793
>/* How many degrees are in a meter? */

I don't even.

>> No.65850889

>>65850860
it's some GIS shit. how many lat/lon degrees are in a meter? it's a valid question

>> No.65850907

>>65850889
But wouldn't that be constant?

>> No.65850972
File: 330 KB, 782x1021, 1525392298109.png [View same] [iqdb] [saucenao] [google] [report]
65850972

>https://www.visualstudio.com/services/intellicode/
>his language doesn't have an IDE with AI intellisense.

>> No.65850983
File: 64 KB, 180x236, 1453656893901.png [View same] [iqdb] [saucenao] [google] [report]
65850983

>>65850972
>she needs someeone else to program for her

>> No.65850987

>>65850793
>return polygons.toString();
So basically, the function is completely useless?

>> No.65850996

so much samefagging.
not even gonna get a (You) from me.

>> No.65851010

>>65850807

if any of you feel like helping a guy out

>> No.65851045
File: 290 KB, 498x710, 1513153372009.png [View same] [iqdb] [saucenao] [google] [report]
65851045

>>65850983
>she writes her own programs

>> No.65851054

>>65851010
where do you live and are you willing to move to get a job?

>> No.65851059
File: 54 KB, 311x311, 1462665702455.png [View same] [iqdb] [saucenao] [google] [report]
65851059

>>65851045
>she has programs written

>> No.65851066

>>65851054
London and yeah. I'm with parents at the moment, the only reason I'm not moving is money.

>> No.65851080

>>65851010
people who knit, can knit with red yard or green yarn, thin or fluffy, hell, the same yard can be used for crocheting. you can even use yarn in a loom.

people who fish can catch bass, blue gill, sturgeon, catfish, etc... they can use various rods, reels, line, hooks.

people who drive can drive a BMW, Tesla, Ford, Chevy, Mistubishi, etc...

pick a language and get comfortable with it. once you get a feel for thinking logically and in order of operation, you should be able to pick up every language you feel like.

advice: buy 15 week course. or get the government to pay for it. git gud and start making useful stuff. when you feel ready, apply for jobs.

>> No.65851088

>>65851010
https://www.youtube.com/watch?v=EFwa5Owp0-k

>> No.65851093

>>65851080
Nice spacing, you fucking faggot.

>> No.65851102

>>65851093
thanks, cocksucker! :)

>> No.65851107

>>65851102
Don't post a smiley face when you're not smiling.

>> No.65851112

>>65851107
grinning ear-to-ear, m8

>> No.65851123


function makeFresnelPolygons($from, $to, $freq, $steps_in_circles) {

// How many degrees is a meter?
$lat_meter = 1 / ( CIRCUMFERENCE_OF_EARTH / 360 );
$lon_meter = (1 / cos(deg2rad($from['lat']))) * $lat_meter;


$distance = distance($from, $to);
$bearing = bearing($from, $to);
$wavelen = SPEED_OF_LIGHT / $freq; // Speed of light


// $steps_in_path is an array of values between 0 (at $from) and 1 (at $to)
// These are the distances where new polygons are started to show elipse

// First we do that at some fixed fractions of path
$steps_in_path = array(0,0.25,0.4);

// Then we add some steps set in meters because that looks better at
// the ends of the beam
foreach (array(0.3,1,2,4,7,10,20,40,70,100) as $meters) {
// calculate fraction of path
$steps_in_path[] = $meters / $distance;
}

// Add the reverse of these steps on other side of beam
$temp = $steps_in_path;
foreach ($temp as $step) {
$steps_in_path[] = 1 - $step;
}




1/2

>> No.65851125

Heya I'm having a weird problem here. I reinstalled Ubuntu on my laptop today, to upgrade to the new release, and now I'm noticing an odd problem with elixir, more specifically mix. I can't seem to be able to create new projects with mix, when I try to run 'mix new foo' it just prints an error:

** (Mix) Application name must start with a letter and have only lowercase letters, numbers and underscore, got: "foo". The application name is inferred from the path, if you'd like to explicitly name the application then use the "--app APP" option.

And nothing else seems to be working with mix either, so far I haven't found a single thing that would work. I've tried reinstalling it too. Anyone here have an idea of what I'm doing wrong?

>> No.65851128

>>65851112
No. You aren't.

>> No.65851136

>>65851128
ok... i'm sure you know better than me.

>> No.65851139
File: 1.54 MB, 2448x3264, 1476929733307.jpg [View same] [iqdb] [saucenao] [google] [report]
65851139

>>65851123

// Sort and remove duplicates
sort($steps_in_path, SORT_NUMERIC);
$steps_in_path = array_unique($steps_in_path);

// Fill array $rings with arrays that each hold a ring of points surrounding the beam
foreach ($steps_in_path as $step) {

$centerpoint['lat'] = $from['lat'] + ( ($to['lat'] - $from['lat']) * $step );
$centerpoint['lon'] = $from['lon'] + ( ($to['lon'] - $from['lon']) * $step );
$centerpoint['alt'] = $from['alt'] + ( ($to['alt'] - $from['alt']) * $step );

// Fresnel radius calculation
$d1 = $distance * $step;
$d2 = $distance - $d1;
$radius = sqrt( ($wavelen * $d1 * $d2) / $distance );

// Bearing of line perpendicular to bearing of line of sight.
$ring_bearing = $bearing + 90 % 360;

unset ($ring); // clear rings

for ($n=0; $n<$steps_in_circles; $n++) {

$angle = $n * ( 360 / $steps_in_circles );
$vertical_factor = cos(deg2rad($angle));
$horizontal_factor = sin(deg2rad($angle));
$lat_factor = cos(deg2rad($ring_bearing)) * $horizontal_factor;
$lon_factor = sin(deg2rad($ring_bearing)) * $horizontal_factor;

$new_point['lat'] = $centerpoint['lat'] + ($lat_factor * $lat_meter * $radius);
$new_point['lon'] = $centerpoint['lon'] + ($lon_factor * $lon_meter * $radius);
$new_point['alt'] = $centerpoint['alt'] + ($vertical_factor * $radius);

$ring[] = $new_point;
}

$rings[] = $ring;

}


2/3

>> No.65851148

>>65851136
I do. Good job on taking notice of that.

>> No.65851151
File: 97 KB, 577x704, 1483767974338.jpg [View same] [iqdb] [saucenao] [google] [report]
65851151

>>65851139

// Make the polygons

// since polygons connect this ring with next, skip last one.
for ($ring_nr = 0; $ring_nr < count($rings) - 1; $ring_nr++) {

$next_ring_nr = $ring_nr + 1;

for ($point_nr = 0; $point_nr < $steps_in_circles; $point_nr++) {

$next_point_nr = $point_nr + 1;

if ($point_nr == $steps_in_circles - 1) {
$next_point_nr = 0;
}

unset ($polygon);
$polygon[] = $rings[$ring_nr][$point_nr];
$polygon[] = $rings[$next_ring_nr][$point_nr];
$polygon[] = $rings[$next_ring_nr][$next_point_nr];
$polygon[] = $rings[$ring_nr][$next_point_nr];

$polygons[] = $polygon;


}
}

$ret = '';

foreach ($polygons as $polygon) {
$ret .= '<Polygon><altitudeMode>absolute</altitudeMode><outerBoundaryIs><LinearRing><coordinates>';

foreach ($polygon as $point) {
$ret .= $point['lon'] . ',' . $point['lat'] . ',' . $point['alt'] . " ";
}

$ret .= '</coordinates></LinearRing></outerBoundaryIs></Polygon>';
}

return $ret;

}

3/3

help port to java pls

>> No.65851160

>>65851151
got to freelancer, or fiverr.
you can pay someone to do you work/homework for you.

>> No.65851162
File: 29 KB, 826x392, 1449361855035.png [View same] [iqdb] [saucenao] [google] [report]
65851162

>>65851125
>updating your dev environment

>> No.65851166

>>65851123
>>65851139
>>65851151
Why do you have so many nonsensical spaces?

>> No.65851175

>>65851166
it's from here

https://github.com/freifunkhamburg/Fresnelzonen/blob/master/line-of-sight.php

>> No.65851178

>>65851162
I realize it was a mistake now

>> No.65851190

>>65851178
well you live and learn

>> No.65851204

>>65851160
come on, we are creating a free second internet. look up freifunk. help us out

>> No.65851207

>>65851066
I'm not from the UK but if you want a job in the city (finance) then learn python and they take people with all kinds of degrees. I wouldn't go for a purely technical role. I'd also recommend you do some sort of program because they like fancy pieces of paper.

>> No.65851263
File: 61 KB, 573x619, le smug.jpg [View same] [iqdb] [saucenao] [google] [report]
65851263

>>65851059
>she programs

>> No.65851266
File: 2.73 MB, 1976x1352, Fblosv-2.png [View same] [iqdb] [saucenao] [google] [report]
65851266

>>65851151
it's supposed to do this

>> No.65851268
File: 139 KB, 270x360, 1463064892991.png [View same] [iqdb] [saucenao] [google] [report]
65851268

>>65851263
>she is even vaguely associated with the sort of nerds who program

>> No.65851275

>>65851268
fucker master smug

>> No.65851341

>>65850737
What do you guys think of Guice for Java?
Why does someone need a DI framework rather than doing it manually?
Why do other languages not seem to have these DI frameworks?
Why use Guice over e.g. Spring?

>> No.65851365

>>65851341
Why would use java for anything other than being a wagecuck using spring boot and nhibernate?

>> No.65851371

>>65851365
>nhibernate
That is another poolang. I meant hibernate

>> No.65851421

>>65851266
if (trim($location['Koordinaten'])) {

>Germans

>> No.65851490
File: 190 KB, 555x516, g.png [View same] [iqdb] [saucenao] [google] [report]
65851490

found typical /g/ programmer on live stream

>> No.65851525

>>65851490
Le funny trap meme xD
It's just as funny as the last 400 million times you've brought it up.

>> No.65851617 [DELETED] 
File: 1.30 MB, 360x252, 1479510851679.gif [View same] [iqdb] [saucenao] [google] [report]
65851617

I don't get it.

>The algorithm and, hence, the program, works whether m is bigger than n or not. Using the
example above, if m is 24 and n is 42, when the loop is executed the first time, it will set m
to 42 and n to 24. In general, if m is smaller than n, the first thing the algorithm does is
swap their values.

while (n != 0) {
r = m % n;
m = n;
n = r;
}
printf(“\nTheir HCF is %d\n”, m);

>> No.65851692

>>65851207
thank you, seems like a fair roadmap for someone in my position

>>65851080
Okay. I understand that the first the language is more about grasping programming concepts rather than learning it to mastery, which was why I was worried about building bad habits. A government-paid course may be perfect though.

>>65851088
So I should just continue to sit on my ass like a lemon? I'm asking if it's reasonable to think about a job within a year, which should show I don't think I'll be job-ready after a 12-week course. Plus, I'm not in it just for the money.

>> No.65851807
File: 243 KB, 1078x1412, Screen Shot 2018-05-08 at 9.01.56 AM.png [View same] [iqdb] [saucenao] [google] [report]
65851807

wonder if this counts as shitposting in code form

>> No.65851814
File: 957 KB, 500x418, 1525522080204.gif [View same] [iqdb] [saucenao] [google] [report]
65851814

>want to keep learning programming
>always tired and can't concentrate

>> No.65851820

>>65851617
Oh i get it nvm

>> No.65851840

>>65851807
why not have a null document be an empty map document

>> No.65851842
File: 104 KB, 327x300, sigtrap.png [View same] [iqdb] [saucenao] [google] [report]
65851842

>>65850765
>>65850771
Fresh OC

>be a candid thread of code
>wander around unknowingly in the spaghetti written by Pajeet
>suddenly, a Qt slot appears
>you branch into it
>???
>SIGTRAP
>you're caught by GDB, the GNU debugger
>"Wanna share your code under GPL, anon thread?"
>the Qt slot was actually Stallman in polymorphic disguise

>> No.65851853

>>65851840
because anon that's not null, that's en empty map

>> No.65851868

>>65851853
what should a null document be? a non-document? better use std::optional

>> No.65851872

>>65851807
It counts as fucking abomination.

>> No.65851934

>>65851868
no, that means it's a maybe-document
the document itself can have a null value which is distinct from the document itself being optional

>> No.65851938

Anyone here use LLVM? I've been trying to learn it here recently but I'd really like a good tutorial. I've got a basic "hello word" situation going but it seems every tutorial I run across is a different version from mine and subtly doesn't work.
I don't even know how to check my LLVM version outside of Clang.

>> No.65851949

>>65851934
What is the null document, conceptually?
why does it differ from an empty map document?

>> No.65852048

>>65851949
It's a class I'm writing to hold the parsed contents of HTTP request bodies (and similar stuff) in some standard way. So the data the document holds can be null (e.g. parsed from the JSON string null) or the document itself can be optional (e.g. returned from a caching function where a cached document may or may not exist).

>> No.65852078

>>65852048
So you are using your "null document" in the way that you WOULD be using an optional<document>?

>> No.65852128

ok so how can I define a generic (==) operator overloading for ValueTuples ?

>> No.65852286

>>65852078
null_document = document exists, contents null
otpional<document> = document may or may not exist

>> No.65852358

>>65852286
you aren't understanding
how is your null document different from an empty map document?
should an empty map document any different from a regular document without any contents?

>> No.65852377

>>65852358
Or a document with an empty string

>> No.65852397

>>65852377
yeah that too

>> No.65852414

>>65852377
>>65852397
actually that might be different
because document is also being used as a value
so if you have e.g.
{'x':"asdf"
,'y':""}
but with an empty map i don't see a difference

>> No.65852426

>>65852358
Just look at the JSON data model anon, null != {}. (And it's also distinct from no-such-value) What anon is doing makes total sense in this context. It depends on the model.

>> No.65852437

>>65852414
Can you insert keys into an empty map?
Can you insert keys into null?

>> No.65852484

>>65852437
You can insert a key into an empty document to produce a singleton document
>>65852426
I guess it makes sense for JSON, but JSON is retarded

>> No.65852486

>>65852358
>>65852377
>>65852397
>>65852414
Because a string is a different type than a mapping, which is a different type from an explicit null value, regardless of what data they actually contain. This is a representation of a data abstraction, not C strings.

>>65852437
Well you can in Niels Lohmann's JSON library that I'm also using, but I don't have the time to re-implement a 17,000-line header file library just to add some MIME type metadata.

>> No.65852514

>>65852484
>I guess it makes sense for JSON, but JSON is retarded
This is for standardizing the parsed content of JSON, YAML, multipart/*, application/x-www-form-urlencoded, and eventually maybe XML requests & responses.

>> No.65852528

god damn my dick is so hard

>> No.65852612

>>65852528
me too anon

>> No.65852622
File: 60 KB, 1294x478, sBJG8sT.jpg [View same] [iqdb] [saucenao] [google] [report]
65852622

A wild Terry Davis appears. What do you do?

>> No.65852648

>no statically typed and type inferred common lisp with manual memory management
why even live

>> No.65852680

>>65852622
U8 *p = NULL; *p = 0;

>> No.65852686

>>65852648
Lisp existed before garbage collection. Garbage collection was invented FOR lisp anon. There's a reason why.

>> No.65852707

>>65852648
Literally nobody wants this language.
But here's something like it:
https://github.com/carp-lang/Carp/

>> No.65852727
File: 163 KB, 500x530, question.png [View same] [iqdb] [saucenao] [google] [report]
65852727

how do i get into programming? are the socks mandatory?

>> No.65852747

>>65852622
why is daniel day lewis so racist?

>> No.65852749

>>65852707
>defn
>fn
I wonder what psychosis causes people who design languages without garbage collectors to try to shorten all the keyword names beyond what is reasonable.

>> No.65852786

>>65852749
Nothing wrong with making common keywords short, anon. If that's your biggest concern in a programming language's design then you're just an idiot.

>> No.65852794

>>65850765
I think there are also Trap functions in Assembly programming.

>> No.65852806

>>65852727
https://www.google.co.uk/search?q=learn+haskell

>> No.65852834

>>65852727
highly recommended.

>> No.65852849

>>65852786
It's a good thing it isn't my biggest concern, which in this case is writing a lisp with manual memory managment. But there is reason to value aesthetics. fn, chosen to be the start of fnord, is just plain ugly. Clouds your code in an aura of hideousness.

>> No.65852859

>>65852648
There are good reasons why Lisp is garbage-collected and dynamically-typed. Writing your own dialect of Lisp isn't hard and neither are simple algorithms for type inference like Algorithm W. Try implementing your ideas. I guarantee you that you'll run into problems that will either make you to give up on them or end up with something that can't really be called Lisp.

>> No.65852941
File: 11 KB, 348x260, 1519543111544.jpg [View same] [iqdb] [saucenao] [google] [report]
65852941

#include <stdio.h>
int main() {
int n;

printf("%d\n",n);
printf("%d\n",++n);
printf("%d\n",n);
printf("%d\n",n++);
printf("%d\n",n);
}


0
1
1
1
2

makes me think

>> No.65852962

>>65852941
x=x++
is a no-op

>> No.65853005

>>65852941
>int n;
undefined behavior notwithstanding, what's your problem with this?

>> No.65853007

>>65852849
What kind of type discipline would your perfect language have?
The reason most languages don't have manual memory management, especially typed ones, is that use-after-free breaks all type safety guaruntees so it makes all of the theoretical results of the type system useless.

>> No.65853018

>>65852962
Wrong

>> No.65853028

>>65852941
That's how those operators are supposed to work and it's perfectly fine. If you have a problem with it go write Go, it only has post-increment operator and it's a statement, not an expression.

>> No.65853055

>>65853028
thanks big brother that's exactly what im going to do

>> No.65853061

>>65853007
>the reason languages don't have manual memory management is because MUH TYPES
I'm pretty sure it's actually because about 90% of the time writing free() is a waste of time and raii is an abortion. strong dynamic if you're wondering. unless I'm specifying memory layout, types are also a waste of time. I'm writing software not proving theorems, and I don't need to pretend to be a mathematician because I am one.

>> No.65853064

Why might a static build produce a segfault, where another does not? The failure is immediate, no output occurs. Most programs are fine, the one that isn't has no obvious distinguishing features other than using cmake for a build system.

Using MSYS2, gcc C++.

>> No.65853090

>>65852941
https://stackoverflow.com/questions/1812990/incrementing-in-c-when-to-use-x-or-x
Makes sense to me, though I don't know in what situations you'd make use of the distinction. It won't make for intuitively readable code. I'd actually start putting increments on their own line to make sure I never have to fix a bug caused by using the wrong one.

>> No.65853138

>>65853061
>registers and memory alignment doesn't exist
>cache is infinite enough to just let a program do whatever
>I mask my dislike for thought and work by claiming nothing is as it seems and that I simply have a better way because I am better
>Computers are magic math machines, not signal manipulators and processors. I justify this perspective with the philosophical standpoint that math and logic are the same, despite the nature of computational machinery in this universe mapping very poorly to human conceptions of "math", both in silicon and biology.
>I prefer to think what feels good, is good. I am not a realist and believe I define the universe, rather than admit my slavery to laws I have no control over. This is what my brittle idea of beauty is dependent on.
You just do that, then.

>> No.65853148

>>65853138
>unless I'm specifying memory layout
see me after class anon.

>> No.65853177

>>65853148
I am God.

>> No.65853241

I have a question about C best practice.
I want to make a function that computes the pseudo inverse of a matrix (defined as a struct).
let's call A the input matrix and B its pseudo inverse.

The pseudo inverse uses the a transpose matrix of A, a copy of A, an inverse matrix and two tmp matrices to store some multiplications.

Should I better pass pointers to these temporary matrices as argument to the function, or should I instead malloc and free the temporary every time I call the function (the function is called very often)

>> No.65853266

>>65853177
Because you're perfect doesn't mean you're free of blame.

>> No.65853286

>>65853241
why would you need to call malloc tho

>> No.65853302

I like /wdg/ better because people there are actually working on profitable and useful projects. Nobody cares about your binary tree made in C.

>> No.65853319

>>65853286
typedef struct {
int rows;
int cols;
double *data;
} matrix;

void new_matrix(matrix *output, int rows, int cols) {
/* Creates a new matrix of a given dimensions
*/
// sanity check
if (rows <= 0 || cols <= 0) {
output->rows = 0;// NULL;
output->cols = 0;
output->data = NULL;
}
// Set the dimensions and allocate data space accordingly
output->rows = rows;
output->cols = cols;
output->data = malloc(rows * cols * sizeof(double));
}

void initialize_zero_matrix(matrix *output) {
// initialize with zero
for (int i = 0; i < output->rows * output->cols ; i++) {
output->data[i] = 0.0;
}
}


So every time I create a matrix, I am calling malloc

>> No.65853379

>>65853241
You could make use of static variables:
static struct matrix *tmp1, *tmp2;

void some_func_i_call_often(struct matrix *m)
{
if (!tmp1 || some_condition_for_reallocation) {
tmp1 = allocate_matrix(...);
tmp2 = allocate_matrix(...);
}
...
}

>> No.65853402

>>65853319
is there a reason your matrices aren't just double[][]s?

>> No.65853439

>>65853379
Note: you could even pass tmp1/tmp2 to allocate_matrix() and use realloc() inside allocate_matrix() so you wouldn't even need to free() them in case of reallocation.

>> No.65853452

>>65853402
double**s, you mean? Don't use [] syntax. If you make it a flat array you can expect a certain cache performance. If you use double** you have to malloc each one of them separately and that can result in high amount of cache misses if two double*s end up being far apart in memory.

>> No.65853480

>>65853379
As global variables? I don't mind actually. Is there any performance difference as using pointers to the temporary matrices?
>>65853439
What's the difference with calling malloc, using the matrices as temporary values holders and calling free before exiting the program?
>>65853402
I want to have the dimensions if the matrix embedded within it rather than having to do it manually.
I am not gud enough to use double[][] within a struct so I use this convoluted way .

>> No.65853482

> Which node modules do I download in order to sum these two integers?
Nah, mate.

>> No.65853492

>>65853302
>>65853482

>> No.65853499

>>65853452
>double**s, you mean?
Don't put words in my mouth. A variable declared as double[x][y]; is sequential in memory just like a double[x * y];

>> No.65853516
File: 217 KB, 1600x1304, Erlang Community Engagement.png [View same] [iqdb] [saucenao] [google] [report]
65853516

Say something nice about Erlang, NOW!

>> No.65853564

>>65853516
Its not C.
God I hate C.

>> No.65853568
File: 148 KB, 1920x1080, 2018-05-08-175052_1920x1080_scrot.png [View same] [iqdb] [saucenao] [google] [report]
65853568

You have 30 seconds to explain why you still use obscure and boring programming languages in comparison to emojicode (pic related), you can finally code with your fruit toy smartphone without having to use a computer.
Joke aside, i will maybe try to implement this programming language to android, at least the emojis are already on the keyboard...

>> No.65853584

>>65853516
>freenode
kek. everyone is moving to slack or discord.

>> No.65853589

>>65853516
Elixir is lovely.

>> No.65853591

>>65853480
>As global variables? I don't mind actually. Is there any performance difference as using pointers to the temporary matrices?
>What's the difference with calling malloc, using the matrices as temporary values holders and calling free before exiting the program?
The main idea is to keep pointers to temporary matrices out of the function arguments. Performance-wise, it's practically the same as passing pointers at every call, except you have to manage your temporary matrices yourself if you pass pointers.

>> No.65853595

>>65853499
But then you can't have variable-sized matrices.

>> No.65853601

>>65853584
Only SJW are moving to it though. The real programmers are still using Freenode.

>> No.65853622

>>65853601
no. freenode is mostly bots as of now.

>> No.65853652

>>65853601
define real programmers

>> No.65853789

>>65853652
The self-employed gun owner kind.

>> No.65853803

>>65853652
Kernel, free software, complicated software not for brainlet (haskell, C, lisp)...
Developers on slack or discord are java/python/javascript "programmers" using ton of library to forks a bloated software using Electron for shinny animations.

>> No.65853811

>>65853591
I see. So I should also consider adding a function free_tmp_matrix that I would call before exiting the program

>> No.65853830

>>65853492
Are you trying to make us fight? I don't program in javascript you fucking fagloid.

>> No.65853848

>>65853803
You are a meme.

>> No.65853886

>>65853595
His point is that double[][] is like double*, not double**.

>> No.65853888

>>65852707
>shit brackets [] for parameters
>@ instead of *
it's shit

>> No.65853917

>>65853595
>>65853886
In the static vs. dynamic sense, not the parameter decay sense.

>> No.65854074
File: 1.17 MB, 1194x768, birdiecig.png [View same] [iqdb] [saucenao] [google] [report]
65854074

>>65850737
I'm working on a "hyperreality" network that combines ideas from 4chan, forum software, and social features of (((Facebook))) without tracking. And it's completely free software. Live streaming at https://youtu.be/QK8ofS75M9w
Basedhub at https://github.com/kennymalac/mediacenter

>> No.65854298

Yeah, I need a little help here deciding.

I've been using ThinkJava to learn java programming for about a month nearly got to the end and then dropped it cos some life issues popped up.

I've picked it up again to continue and realised that I've forgotten a chunk of it and thought I might as well start again maybe with a different source to learn from i.e. lynda/udemy but while going through them (and maybe it's just the particular course I chose) they seem to be less in-depth, like they seem to take shortcuts. Thinkjava had an exercise where I had to make a method to work out x to the power n and the lynda/udemy course just tells you straight up to use Math.pow.

Should I just start from scratch on Thinkjava?

>> No.65854323

>>65850737
Working on an EML validator in PHP.
<?php
$email_file = "message.eml";

$eml = file( $email_file );

// Divide file into heading and contents sections
$size = sizeof( $eml );
for( $i = 0; $i < $size; $i++ ){
if( trim( $eml[$i] ) == '' ){
$heading = array_slice( $eml, 0, $i );
$contents = array_slice( $eml, $i+1, $size-$i );
}
}

// Strip newlines from ends of fields
$size = sizeof( $heading );
for( $i = 0; $i < $size; $i++ ){
$heading[$i][strlen( $heading[$i] ) - 1] = "\000";
}

// Unfold header fields
$unfolded = array();
$ui = -1; // Index in unfolded array
for( $i = 0; $i < $size; $i++ ){
if( $ui == -1 && $heading[$i][0] == ' ' ){
die( "Parse error: Leading whitespace characters.\n" );
}
if( $heading[$i][0] != ' ' ){
$unfolded[++$ui] = $heading[$i];
}
else{
$unfolded[$ui] .= $heading[$i];
}
}

// Validate header fields
foreach( $unfolded as $field ){
if( ereg( '^[^:]+:[^:]*$', $field ) == false ){
die( "Parse error: Header fields in wrong format.\n$field\n" );
}
}

printf( "Parsing complete. File is valid EML.\n" );
?>

>> No.65854332

>>65854074
SMOK IS BED

>> No.65854343

>>65853402
the type of a 2D array decays to double * foo[x] where x is a fixed number. The program needs to have the second dimension be fixed at compile time so it knows the pointer arithmetic for the first dimension.

>>65854298
I've never heard of no thinkjava but whatever. You can't just expect to read from a book to learn something. You have to practice it too or of course you will forget. Udemy is low quality though.

>> No.65854431

>>65854343
>You can't just expect to read from a book to learn something.
ThinkJava came with examples and exercises to do.

>>65854343
>Udemy is low quality though.
Any other source you suggest to learn java (so I can get a job?)

>> No.65854464

>>65853811
if you're using gcc you could use the a destructor function to clean up all static temporaries you have for your various functions, so you don't have to remember to call a function
but since the program terminates anyway at that point you might not need to free them at all

>> No.65854478

>>65854464
It's preferable to use C++ destructors than GCC extensions desu. At least C++ is portable.

>> No.65854488

>>65854478
No, it's preferable to not use C++.

>> No.65854536

>>65854478
That's what atexit() is for in C. But unfreed heap memory is still freed by the OS when the program exits anyway. You only need to free memory for short-lived objects.

>> No.65854552

>>65854536
>But unfreed heap memory is still freed by the OS when the program exits anyway.
Only if there's an operating system, and even then, sometimes not. It's bad practice not to free your allocations.

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

Employed Haskell programmer here

>> No.65854632

>>65854610
You may be a Haskell programmer, but how's that ebin J2EE subcontractor project going? :^)

>> No.65854665

>>65854610
"Have you written a compiler? Have you written an interrupt routine? Do you even know what an interrupt routine is?" as said by Terry Davis

>> No.65854754

A continuous-time functional reactive language for real-time systems. The trick is that a reactive program cannot actually have continuous semantics on real hardware, so there must always be sampling involved. How do you get real-time? With a real-time sample scheduler, of course. It's really for soft real-time, because there will be no guarantees about meeting deadlines, but the schedulers can choose to recover in different ways. One might be able to adjust sample precision, increasing throughput at the cost of quality. Another might be able to vary the sample rate, increasing throughput at the cost of latency. The most basic scheduler would be for when you can tolerate the slowdown. These strategies can be swapped out easily (or even on the fly) without modifying the rest of the application.

>> No.65854814

i'm having so much trouble naming variables and functions. like what would you call a process that takes class objects in RAM and converts them to JSON/binary/etc so they can be easily serialized and stored to disk? this is why being self-taught sucks, i don't know any terms for processes like these. i literally have the code written out but my function is still called "foo"

>> No.65854845

>>65854814
>like what would you call a process that takes class objects in RAM and converts them to JSON/binary/etc so they can be easily serialized and stored to disk?
You used the exact word in that sentence

>> No.65854849

I am working on appending a header to the top of text submitted via a web form and displaying the past history below it.

Right now I can append my header with no issues, but it keeps overwriting my past data. Any suggestions?


edit.php

Add Text
<textarea name="txtnotes"></textarea>

Text History
<?php echo $result["notes"];?>


save.php

//Append to Notes
$ipaddress = $_SERVER['REMOTE_ADDR'];
$header = "----- Updated by " . $ipaddress . " on " . date("Y-m-d") . " at " . date("h:i:sa") . " ----- <br>";
$newnotes = $_POST["txtnotes"];
$oldnotes = ["notes"];
$appendednotes = $header . $newnotes . $oldnotes;

notes = '$appendednotes'

>> No.65854857

This probably gets asked every thread but what book should I use to learn C?

Also there really needs to be a pastebin or some kind of resource in the OP for FAQs and general guidance.

>> No.65854886

>>65854857
K&R.

>> No.65854900
File: 161 KB, 1024x768, 2018-05-08-192232_1024x768_scrot.png [View same] [iqdb] [saucenao] [google] [report]
65854900

awoo-gif-1

>> No.65854914
File: 32 KB, 716x717, retard anime.jpg [View same] [iqdb] [saucenao] [google] [report]
65854914

>>65854845
oh

i see

>> No.65854960

ey help me out

I've just finished python programming for the absolute beginner, what do now?

what's the best next book/tut to follow?

>> No.65854973

https://twitter.com/AlwaysCheyenne/status/993836725452488704

You've gone too far this time /dpt/

>> No.65854988

>>65854886
I figured that'd be the answer, is it really still good even after all this time?

I guess I'll try it, thanks.

>> No.65855009

Can you make an array of List<Integer>s in Java? comparisons on various SAT solvers and the DPLL approach requires removal of elements so I can't just use arrays; I want to minimize the overhead and avoid using a List of Lists by having the row-list be an array

>> No.65855014

>>65854988
The style is a bit out of date, but in terms of the concepts you need to grok C it's unmatched.

>> No.65855016

>>65854845
No name for it. The naming conventions available to you:
C: memserial, memdump
Java: ObjectSerializer and derived FooObjectSerializer
C++: obj_serializer<M>

>> No.65855046
File: 31 KB, 1179x1041, gui.png [View same] [iqdb] [saucenao] [google] [report]
65855046

I made a simple gui library with buttons, menus, text fields, and some other features for Richard Russell's BBC BASIC for Windows/SDL, and then I used it to make a simple paint program and some other simple things

>> No.65855159

>>65855046
That's kind of rad, anon

>> No.65855162

>>65855009
Why wouldnt you be able to. Just do List<int>[] like you would normally do to create an array. At least you can do that in other oop langs like c#

>> No.65855258

>>65855162
List<Integer>[] cause Java is caca but that's correct what you wrote.

>> No.65855283

>>65855162
The row list might as well be an ArrayList tho the overhead will be basically the same

>> No.65855297

>>65855283
Meant at >>65855009

>> No.65855312
File: 866 KB, 500x259, scold.gif [View same] [iqdb] [saucenao] [google] [report]
65855312

>>65851268
>>65851263
>>65851059
>>65851045
>>65850983
>>65850972
>she

>> No.65855345

>>65855312
> >she

>> No.65855590
File: 6 KB, 225x225, 1525783305255s.jpg [View same] [iqdb] [saucenao] [google] [report]
65855590

>doing Pattern Recognition/Machine Learning project
>professor gives us a data set with more than 5GB of data
>this data set describes the image's features
>each image has a (17000x1) related vector
>there are more than 39000 images


what the fuck

>> No.65855627

>>65855258
>>65855162
this creates a list of arrays not an array of lists
I don't think you can make an array of lists

>> No.65855652

>>65855627
Isn't it just List<Integer[]>?

>> No.65855811

>>65855046
this is really dank. what resources are you using as a reference?

>> No.65856309
File: 4 KB, 654x76, 5.png [View same] [iqdb] [saucenao] [google] [report]
65856309

Hey, I'm playing around with python today because the teacher gave us a python task and I have never done anything in Python before so I am clueless, I appreciate any help.

Basically I'm supposed to implement a turing machine in Python and I've managed to initialize it with any given input but I'm not sure how to access the states and apply them to the input. From what I've seen it's a python dictionary type that does not support indexing, which makes my initial idea not work. Basically I seem to only be able to access the dictionary keys using their string names (q1, q2) which wouldn't make it too hard implementing this specific example, but I have no idea how I could generalize it for all possible functions. Can anyone give me a tip?

>> No.65856363

>>65855627
List<Integer>[] is an array of list you mongoloid fuckface

>> No.65856388

>>65855811
Thanks.
>what resources are you using as a reference?
You mean, for learning BBC BASIC?
I use this site: http://www.riscos.com/support/developers/bbcbasic/
And also this site: http://www.bbcbasic.co.uk/bbcwin/manual/

>> No.65856402

>>65856309
this is a nested dictionary, it maps states to dictionaries which in turn map tape symbols to (nextState, newSymbol, direction)
I guess you could also write this as a function that takes a state and a symbol and returns the triple

>> No.65856450
File: 42 KB, 386x269, Gooby_car_suspicious.png [View same] [iqdb] [saucenao] [google] [report]
65856450

>Segmentation fault

>> No.65856486

>>65856450
Reminder that, this is the smallest C program that causes segmentation fault.
main;


Try to compile it.

>> No.65856492

>>65856450
>he didn't restore the program to valid state with sigsetjmp
dumb shitter

>> No.65856507

>>65856450
you fault for using an unsafe programming language.

>> No.65856523

>>65856507
what to use instead?

Rust?

>> No.65856531

>>65856486
not a valid program at all, tard.

>> No.65856545

>>65856523
haskell

>> No.65856550

>>65856531
>not a valid program at all, tard.
Wrong Rajesh.

>that reading comprehension

>> No.65856556

>>65856523
ocaml

>> No.65856560

>>65856550
>it compiles therefore it is valid
only rustlets and hasklets believe that.

>> No.65856578

>>65856556
>no native thread support
>no unsigned types
>boxed types
>shitty FFI
>no macros, have to use external tool
>;;
Ocaml is shit
consider SML, SML# or actually good programming language

>> No.65856589

>>65856402
Yea it being a nested dictionary is kind of the problem. I have no way of accessing it other than the strings right? That's the example given so I'm not allowed to change it and I'm not sure how I could turn it into a function.

>> No.65856605

>>65856560
http://llbit.se/?p=1744

>> No.65856607
File: 23 KB, 645x773, 1523386635027.png [View same] [iqdb] [saucenao] [google] [report]
65856607

>>65856531
Thanks Sherlock.

>> No.65856621

>>65856589
how else would you want to access it? you probably have a string that represents the current state, a list of strings that represents the tape and an integer to represent the head

>> No.65856637

>>65856607
then it is not a C program.

>> No.65856660

>>65856605
yes we know you read an ebin blog post. the idea of doing that has been floating around the tubes for about 30 years. main is supposed to be a function so it still isn't valid.

>> No.65856669

>>65856660
It is.

Sorry sweetheart.

>> No.65856673
File: 49 KB, 481x523, 1522280161860.jpg [View same] [iqdb] [saucenao] [google] [report]
65856673

>>65856637

>> No.65856682

>>65856450
(core dumped)

>> No.65856701

>>65856486
if you compile with -nostartfiles, gcc will happily compile an empty file into a segfaulting executable

>> No.65856702

>>65856673
the standard is explicit: a program either has main() or another procedure as entry point. a conforming implementation would not compile that program. blame gcc, not c.

>> No.65856711

>>65856621
Well what I'm thinking is that I need to implement this no matter how many states there are. Now it seems the nested dictionary doesn't do indexing, what I was thinking is that I can determine the length of the dictionary and then somehow define all the states in variables that I can easily access. I think this could work if we assume the states are always called q<number> and e but I have no idea how to do it.

I didn't really understand your tip anyway, I thought you meant I should drop the nested dictionary. I don't really understand how I can access these through a function.

>> No.65856803

>>65856711
nah if you're stuck with the dict you'll have to do it as it is.
You don't need to know what states there are, all you need to know is the start state, and the dictionary will give you new states as your machine transitions into them. if you want to look at all the states, there should be a function you can call on your dict, I think its something like delta.keys()

>> No.65856872

>>65856803
Ah you're right!
Now I just need to think of a way to actually do that, thanks for the help.

>> No.65856926

>>65854900
( ˙-˙ )
way too much carb and sugar. prepare for diabetus.

>> No.65856931
File: 910 KB, 1920x1080, bb647f1c017320c6b0991e00b58be02f5486e4ce.webm [View same] [iqdb] [saucenao] [google] [report]
65856931

Still working on my simple space 2D game to play with my son. Next step is to implement collision.

>> No.65856950

>>65856931
Since he is your wife son why not just play God of War?

>> No.65856958

>>65856950
Not interested by GoW.

>> No.65856975

>>65856958
Then play LABO.

>> No.65857097

>>65856975
You're inspired today.

>> No.65857126

>>65857097
w/e cuck

>> No.65857164
File: 18 KB, 402x383, 2018-05-08-214928_404x385_scrot.png [View same] [iqdb] [saucenao] [google] [report]
65857164

>>65856926
uhhh honey, no
I will have cereal for supper

>> No.65857169

>>65856931
What are some of these bullets doing? What happens if you touch a static bullet? Or since you didn't implement collision yet, what do you intend to happen when a player touches a static bullet?

>> No.65857275

>>65857164
sugar lowering mental capacities is a scientific truth. please have a look at the keto diet before it's too late.

>> No.65857321

Which one should I choose for C++ GUI library and what is each advantage / disadvantage:
GTK
QT
FLTK

>> No.65857329

lisp

>> No.65857333

>>65857169
>What are some of these bullets doing?
The bullets have the inertia of the shooting vessel.
>what do you intend to happen when a player touches a static bullet?
Probably a life system.

>> No.65857419

>>65857321
GTK works well on Linux (usually), not so much on other OSes. Qt is "native" cross-platform but also has it's own weird ecosystem on top of C++ and requires a pre-compile step. Don't know anything about FLTK.
>disclaimer: never used any of these

>> No.65857822

>>65851010
You do realise people spend 4 years at uni constantly learning relevant information to get a high-paying job in CS (that's after taking maths & FM at A-level), right?

You can "learn" to code to business standard in 6 months if you work your ass off, but good luck a) getting a job offer b) getting a decent wage c) enjoying it.

That being said, it's entirely possible gl

>> No.65857915

>>65851010
>>65857822
https://www.youtube.com/watch?v=UPO-9iMjBpc

>> No.65857922

How do I adequately push my limits for effective learning?
I learned the basics of Java but I find it hard to find projects for myself that either aren't out of reach or aren't so simple that don'tforce me to think outside of what I can do.

Perhaps any recommendations for some fun third party websites or programs?

>> No.65857939

>>65857915
Hahaha, enjoy working at google

>> No.65858060
File: 46 KB, 778x512, gib.jpg [View same] [iqdb] [saucenao] [google] [report]
65858060

>>65857939
http://uk.businessinsider.com/rest-and-vest-millionaire-engineers-who-barely-work-silicon-valley-2017-7

>> No.65858077

I've been learning C for about a week, now it seems the default C library isn't that huge and naturally you have to write lots of helper functions (like strlen, searching through arrays etc), is there some kind of standard practice of including helper functions? Like putting them them in a helper.c and including helper.h?

>> No.65858113

>>65858060
dumb frogposter

>> No.65858145

>>65858077
uhm strlen is part of the standard library (string.h) but that would work. Better would be to put it where it makes the most sense.
>stuff for arrays -> arrayutil.h
>stuff for strings -> stringutil.h

>> No.65858183

>>65856931
oh and how do you plan on doing that?
I'd use GJK

>> No.65858241

lads, which one of these is faster?
let promises = [promise1, promise2, promise3]
Promise.all(promises).then( results => results.forEach( r => process(r) ) )


or

let promises = [promise1, promise2, promise3]
for await (let p of promises) process(p)


Does 'for await' yield on every iteration of the loop, thereby running the promises in sequence?

>> No.65858283

>>65858183
It's OK, I know my math.Any object is just a collection of triangles.

>> No.65858319

R8
am I a scheme master now?
(define (rember a L)
(if (null? L)
'() ;'
(if (eq? (car L) a)
(cdr L)
(cons (car L) (rember a (cdr L))))))

(define (Nth list index)
(if (<= index 1) (car list) (Nth (cdr list) (- index 1))))


(define (QuicSrt L)
(define (inSort List Pivot)
(define List-No-Pivot (rember Pivot List))
(append
(QuicSrt (filter (λ (x) (>= Pivot x)) List-No-Pivot))
(cons Pivot
(QuicSrt (filter (λ (x) (< Pivot x)) List-No-Pivot)))))
(if (or (null? L) (null? (cdr L)) (not (pair? L)))
L
(inSort L (Nth L (/ (length L) 2)))))

>> No.65858406

>>65858319
define (rember a L)
(if (null? L)
'() ;'
(if (eq? (car L) a)
(cdr L)
(cons (car L) (rember a (cdr L))))))


(cond [(null? L) '()]
[(eq? (car L) a) (cdr L)]
[else (cons (car L) (rember a (cdr L)))])

>> No.65858422

>>65858406
yeah, that part was older code
only included it in the post because it's used in the main function

>> No.65858426

>>65851807
enjoy your std::visit

>> No.65858445

>>65852622
report him for hate speech and ban him. obviously.

>> No.65858513

>>65854900
Is that deepin?

>> No.65858559
File: 10 KB, 238x212, 1523164484744.jpg [View same] [iqdb] [saucenao] [google] [report]
65858559

What happened to Eli the /dpt/ guy? He seems to be slowly going crazy.

>>65850765
>>65850771
>traps quietly in bedroom with locked door so roommates don't walk in to a huge shock
OwO teehee.

>>65852727
The socks are 100% mandatory.

>> No.65858562

>>65858319
>quicksort on lists
Absolutely not. I feel sick thinking about your code. Convert it to a vector, sort the vector, then convert the vector to a list if you insist on quicksort.

>> No.65858582

>>65858559
>The socks are 100% mandatory.
do they make me a better programmer? can i see yours, for inspiration?

>> No.65858606
File: 301 KB, 615x597, 1524516983754.png [View same] [iqdb] [saucenao] [google] [report]
65858606

>>65858513
what's deeping

>> No.65858622

So i've installed two of my most used libraries
https://github.com/fmtlib/fmt
https://github.com/mpark/patterns

in my system in CMake install prefix. Should I have to recompile/reinstall each time there's a GCC update?

Reminder that Rust does not have this problem

>> No.65858632

>>65858183
if i were him I'd just calculate barycentric coordinates. gjk is for convex sets, so it would only be good for a rough pass, which in this case radius is perfectly suitable for.

>> No.65858645

>>65858426
The common use cases for this won't require pattern matching at all. A request body will be parsed into a document, then the request handler checks to see if it's in an acceptable form, which will most often be a mapping/"object" (aka "user" or "product" object). If it isn't acceptable, 400.

>> No.65858653

Please help I'm retarded, I need to make a makefile for a simple piece of shit C file that uses pthreads.

All I have is this
line: shit.c
gcc shit.c -o FuckYou -pthread


It says pthread doesn't exist

>> No.65858685

>>65858653
-lpthread
look up a gcc flag reference

>> No.65858698

Anyone have experience with Entity Framework (Core)?

How do you even write tests for this pile of counter-intuitive mess? Let's say I have a deck of cards. But I want real cards and mock cards, so that I can unit test my deck. So obviously I want to make an interface ICard, and then let Card and MockCard inherit from that, right? But my Deck can't have an ICollection<ICard> property because EF doesn't support interfaces in code-first design or something.

Why is doing such a simple and basic thing so difficult in this framework? I feel like I must be missing something...

>> No.65858703

Hello, so I'm new to shell scripting. How can I add options to my script? So it could be executed like script.sh -o , or script.sh -p. and each option doing something different? Use switch statements?

>> No.65858769

>>65858703
They're called arguments.

http://linuxcommand.org/lc3_wss0120.php

>> No.65858779

>>65858685
Thankyou, I'm retarded

>> No.65858789

>>65858703
Getopt for anything with a lot of options https://www.gnu.org/software/libc/manual/html_node/Getopt.html

>> No.65858836
File: 2.25 MB, 1992x700, gurly.png [View same] [iqdb] [saucenao] [google] [report]
65858836

>>65858582
>do they make me a better programmer
Yes they do and you can't forget about those /diversity quotas/ that need filling.

Well... If it's for inspiration... I guess... But I need to keep this technology related so uhh.. How about that RGB guys...? It's basically killing the technology profession, very sad, very sad indeed, in 2005 computers were hideous, beige with no colour coordination now they are these spectacular displays of customizable colour, and what about bezel sizes who cares about that what a waste of resources amirite?

>> No.65859003

>>65858562
alright, I'm taking your advice, most translates directly without any real changes, but it seems scheme has no native vector-filter so I'm trying to make a filter that works on vectors
so far I have something roughly like
(vector-map (λ (i x) (if (> x 3) x '())) '#(5 6 3 2 1 4))
which would return
#(5 6 () () () 4)
is there any way to get rid of those empty bits?
or at least make a new vector without the ()s
can't seem to find a way to do it

>> No.65859021

Patches::Events::OnEvent([this](auto player, auto event, auto definition) -> void { OnEvent(player, event, definition); });

how do i simplify this lambda expression?
OnEvent is a member function so i cant just directly pass a function pointer

in java this is just this::OnEvent

>> No.65859106

>>65858836
Not thicc enough to be considered girlish

>> No.65859153

>>65859021
forgot to mention that Patches::Events::OnEvent takes std::function

>> No.65859178

>>65859003
Never heard of no vector map. You aren't making the mistake of using racket are you? Anyway your code is still gonna be pretty bad if you just use list procedures that are ever so slightly to be vector procedures.

You should be quicksorting in-place, i.e. swapping elements around the pivot. Reuse that vector. Quicksort's a distinctively non-functional sorting algorithm.

>> No.65859197

>>65859178
>Never heard of no vector map
it's an SRFI addition
https://srfi.schemers.org/srfi-43/srfi-43.html

>You should be quicksorting in-place, i.e. swapping elements around the pivot. Reuse that vector.
sure, i'll do that

>> No.65859360

#include <iostream>
#include <string>

int main()
{
// ask for the person's name
std::cout << "Please enter your first name: ";
// read the name
std::string name; // define name
std::cin >> name; // read into
// write a greeting
std::cout << "Hello, " << name << "!" << std::endl;
return 0;
}

When I compile this set of code on vs the "application" closes after I inserted a name, while on code::blocks with gcc it works perfectly fine. A similar problem also occurs when compiling this:


int main()
{
std::cout << "Enter two numbers:\n";
int v1 = 0, v2 = 0;
std::cin >> v1 >> v2;
std::cout << "The sum of " << v1 << " and " << v2 << " is " << v1 + v2;
std::cin.get();
}

Is it my compiler settings on VS or VS' compiler simply shit?

>> No.65859531

Beginner here, trying to make some basic things in Unity with c#.
Does a script have to be attached to a gameobject in order for other scripts to be able to reference or change variables in it?
Right now I have a piece of code that kinda looks like

public LampVar hasX;

void Start()
{
hasX = GetComponent<LampVar>();
}

void OnTriggerEnter(Collider other)
{
if(other.gameObject.name == "Player" && hasX.playerHas == true)
{
Debug.Log("Working");
}
}

In this case, playerHas is a bool set to false that changes when I pick up an object ingame.
I get that the problem is that this script doesn't access the other script (LampVar), but I don't know why it's not able to do so.
Am I wrong in my way of thinking how variables are accessed across scripts?

>> No.65859664

>>65859178
>You aren't making the mistake of using racket are you?
What's wrong with racket?

>> No.65859726

I'm a bit unclear on what I would put into my switch statement for my getDaysInYear statement if I really only want to account for what the month is. I just want to know what the year is to account for the leap year function I have.
public static boolean isLeapYear (int year){
if (year < 1 || year > 9999) {
return false;
}else if ( year % 4 == 0 && year % 100 != 0 || year % 400 == 0){
return true;
}
return false;
}

public static int getDaysInMonth (int month, int year) {
if (month < 1 || month > 12 || year < 1 || year > 9999) {
return -1;
}
switch (getDaysInMonth(month)){
case 1:
return 31;
case 2:
if (isLeapYear(year)) {
return 29;
}
return 28;
case 3:
return 31;
case 4:
return 30;
case 5:
return 31;
case 6:
return 30;
case 7:
return 31;
case 8:
return 31;
case 9:
return 30;
case 10:
return 31;
case 11:
return 30;
case 12:
return 31;
default:
return -1;
}
}

>> No.65859750

What's the hot marketable meme language now? I use java and JavaScript at my job and I'm looking to move and get a new job not sure what languages I should test out and look for in the future

>> No.65859784
File: 69 KB, 788x298, file.png [View same] [iqdb] [saucenao] [google] [report]
65859784

AAAHHHHHHH

>> No.65859793

>>65859726
Nevermind, I'm a fucking moron, just realized I'm calling my method in my switch statement.

>> No.65859808

>>65859750
rust probably

>> No.65859881

>>65859808
You won't ever get employed if you use Rust

>> No.65859938

>>65859153
>std::function
Just go back to Java. You don't know how to use C++ properly.

>> No.65859944

>>65859881
Yeah I dont think so.
Ive seen people making mad cash from doing rust.
This is happening at scandinavian oil niggers currently.

>> No.65859957

>>65859944
Proof or you are making shit up

>> No.65859969

>>65859957
you want me to pull out their bank statements?
fucking idiot

>> No.65859970

>>65859938
dont blame me

>> No.65860001

>>65859969
If you can't pull out their bank statements, then how do you know they earn a lot of money? I think you are the fucking idiot.

>> No.65860148

>>65860001
missed it by that much ><

>> No.65860169

>>65859784
dat color scheme!

kill it!
KILL IT WITH FIRE!!!

>> No.65860171

Can someone explain to me why we always do stuff to the power of 2? I know base 2 is obviously binary but why the 2^x?
Why use groups of 8 as a popular method?
Like we see to the power of 7 quite frequently

>> No.65860193

>>65860169
go back 2 reddit please

>> No.65860194

>>65860171
^2 BECAUSE it is binary
its inherently obvious.
base 10 uses ^10
base 12 uses ^12
etc...

>> No.65860206

>>65860193
go back to colors that are't shit, please.

>> No.65860221
File: 54 KB, 540x511, sweating pepe.jpg [View same] [iqdb] [saucenao] [google] [report]
65860221

you have two (2) minutes to write a binary adder

>> No.65860245

>>65860194
I mean in cases like 2^7 for 128kb for example why choose it. That does answer the 8 bit vs whatever other bit part

>> No.65860321

>>65860245
back before IBM made binary the standard, many computers ran on words. - clunky, not even worth understanding today.
the bit is a single 1 or 0, standardizing keystrokes to be uniquely identified within a set size led to the 8-bit byte. (look at braille, it's 6-bits per character).

128kb should = 128,000 b
but usually it's jargon for 131,072 b

>> No.65860430

>>65860221
Literally a XOR and an AND

>> No.65860458

>>65860321
So 8 bits to a byte is just sort of arbitrary? Ive wondered why systems seemed to increase by double each time (8bit, 16, 32 etc) yet stuff like color space seems minimal growth from 8 to 10bit

>> No.65860476

>>65860458
>Ive wondered why systems seemed to increase by double each time (8bit, 16, 32 etc)
Backward compatibility.

>> No.65860489

>>65860476
But if we made a 10 bit system it would still have space for 8 bit programs to run wouldnt it?

>> No.65860529

>>65860489
8-bit died in the 90s as far as comsumer PCs go.
32-bit vs 64-bit for example.
it's how much data can pass at once to be processed.
it's a different standard.
its why they had to rewrite Super Mario Bros in Super Mario All-Stars on the SNES (16-bit) cuz the 8-bit NES is a diffferent standard.

>> No.65860688

C is the future.

>> No.65860703

how many of you have actual programming jobs?
What kind of things do you have to do in your job?

>> No.65860704

>>65850737
feelio when too brainlet for latex ;_;

>> No.65860708

>>65860704

LaTeX is easy though.

>> No.65860722

fuck sepples

>> No.65860724

>>65860708
I understand the basics but can't seem to wrap my head around "best practice".

Everyone online says to install a new third party package for every little thing I want to do
>want to make have smaller margins? install the "geometry" package!
>want text to not justify by default? install the "ragged2e" package!
>can't get something formatted right? insert a 5mm vspace here!

Latex is supposed to be powerful, right? Surely there's a better way. I just can't figure out this "better way".

>> No.65860758
File: 94 KB, 813x384, rdcman[1].png [View same] [iqdb] [saucenao] [google] [report]
65860758

I have an idea for a program that is able to launch several instances of a particular game client (.exe), automatically log you into the game via credentials you create and save in the program. Up to this point, my idea is basically RDCMan (Remote Desktop Connection Manager; pic related) or MRemoteNG, but for a video game (a game where it's not uncommon to be running multiple game clients at once).

What makes my idea special is that I want it to leave a lot of control to the user over how the game clients are shown on the screen. And this is what I'm stuck on, especially as I consider the possibility of making this program cross-platform.

I basically want to let the user decide whether to show or hide the titlebar/border for their windows, arrange their windows however they please, even overlap their windows.

Aside from using the win32 api directly, which would limit this idea to Windows, is what I'm asking possible in any way? I really have no idea how to even research my options here or if there is a way to find best practices for this scenario.

>> No.65860779

Nothing because I can never come up with project ideas. Pls help I just want to program but there are no problems bothering me to solve

>> No.65860807

>>65860703
I do

Implement boring business logic in the ordained language

>> No.65860829

>>65860758
Just because you use Win32 directly doesn't mean you can't alternatively use X11 directly, Wayland directly, Cocoa directly, etc. depending on platform.

>> No.65860851

>>65860724

The "correct" way to do things in LaTeX really is to use different packages for basically everything. You're not making a program, you're making a PDF. You shouldn't worry about bloat here.

>> No.65860913
File: 18 KB, 569x855, killrf_by_esk.png [View same] [iqdb] [saucenao] [google] [report]
65860913

>>65858703
>>65858769
>>65858789

i had to make a script to accept options and a numb from the command line and print out the numbers up to the number enter from the cmd line, how can i add a way to check that no invalid option is input? so that if -x is put it prints error message, thanks for the help

>> No.65860914

>>65850737
GR15 should be extended.

>> No.65860938
File: 9 KB, 400x500, drago.jpg [View same] [iqdb] [saucenao] [google] [report]
65860938

>>65850737
I've been working on a chatbot in python.
I took a bunch of 4chan posts, put them in a txt file, and trained a program to respond to questions. It didn't work well though.

I had a weird dicussion with it.

>>Me: What's your name?
>>Bot: Okay...
>>Me: Are you fucking stupid?
>>Bot: What's your favorite color?
>>Me: Green.
>>Bot: So am I.

It knows Shrek jokes. I'm fucked...

>> No.65860945

>>65859197
>>65859664
alright, here we go
r8
(define (Quic-Vect V) ;sets things up
(define (theSort Vect Low High) ;does the main bit
(define (Part) ;returns the pivot index
(define (Swapper Current Ind) ;does the swapping
(cond [(= Current High)
Ind]
[(< (vector-ref Vect Current) (vector-ref Vect High))
(begin
(vector-swap! Vect Current Ind)
(Swapper (+ Current 1) (+ Ind 1)))]
[else
(Swapper (+ Current 1) Ind)])) ;;end Swapper
((λ (point)
(begin
(vector-swap! Vect point High)
point))
(Swapper Low Low))) ;; end Part
(if (< Low High)
((λ (p)
(begin
(theSort Vect Low (- p 1))
(theSort Vect (+ p 1) High )
Vect))
(Part)))) ;; end theSort
(if (vector-empty? V)
V
(theSort V 0 (- (vector-length V) 1) ))) ;;end Quic-Vect

>> No.65861063

>>65860913

elif [ -z $1] ; then
echo "All Numbers"
NUM=$1
else
echo "Error"
fi

>> No.65861098

> variables in the initializer list are not initialized in the order that they are specified in the initializer list. Instead, they are initialized in the order in which they are declared in the class.

What if this ordering is altered by the compiler to reduce padding? Consider I have this:


#include <iostream>

struct Seq
{
float a;
bool b;
double c;

Seq(int i)
: a{ i++ }
, b{ i++ }
, c{ i++ }
{}
operator std::string() const
{
return "a = " + std::to_string(a) + " b = " + std::to_string(b) +
"c = " + std::to_string(c);
}
};



Also, what could the std::string() operator look like in C++11 trailing return type form?

>> No.65861104

>>65860851
i get what you mean, but that's real fucking gay

>> No.65861105

>>65851868
>>65859153
>>65859360


reminder that you are not an uber leet haxor for being "too cool to use a namespace" now go to hell

>> No.65861120

>>65861116
>>65861116
>>65861116
>>65861116

>> No.65861123

>>65861104

LaTeX is a real pain to do anything complex in, so we just got a bunch of people to write packages for it that we use without knowing how to write said packages ourselves.

>> No.65861137

brainlet here, can someone tell me why my if statement breaks when i call it from a Boolean method, even though the method I am calling is true? In this case, I know that two numbers, say 1 and 3, are odd because they pass through my isOdd method just fine, but when I pass those arguments through the sumOdd parameters, the if statement breaks and it just goes straight to -1.
public static Boolean isOdd(int number) {
if (number > 0) {
if (number % 2 != 0) {
return true;
}
}
return false;
}

public static int sumOdd (int start, int end) {
int sum = 0;
if (isOdd(start) && isOdd(end)) {
if ((start > 0) && (end > 0) && (end >= start)) {
for (int n = start; n < end; n ++) {
if (n % 2 != 0) {
sum += n;
}if (n == end) {
System.out.println(sum);
return sum;
}
}
}
}
return -1;
}

>> No.65861155

>>65861105
what are you talking about retard

>> No.65861280

>>65860829
So basically, separate codebases for each display server. Yeah, I think I'll stick to Windows only.

>> No.65861354

>>65851692
"bad habits" is a fucking meme. Python is good to understand the basics but if you want to have a job quick you should learn Web tech first
HTML/CSS/Js/Php .

>> No.65861409

>>65860945
pls respond
I need feedback
I don't want to form bad habits

>> No.65861415

>>65850765
please never post in this general ever again

>> No.65861484
File: 51 KB, 999x798, 2759311207617009770.png [View same] [iqdb] [saucenao] [google] [report]
65861484

what do you guys think of the Google's new AI? PRETTY HORRIFYING DESU

>> No.65861511
File: 77 KB, 1440x810, 1517504385343.jpg [View same] [iqdb] [saucenao] [google] [report]
65861511

>>65859106
b-but they are pretty thicc compared to the rest of me

>> No.65862530

>>65861484
wheres this from

>> No.65862778

>>65860221
dumb frogposter

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