/dpt/ - Daily Programming Thread

Old thread: What are you working on, Jow Forums?

Attached: hidamari_dpt_waifu2x_traps.png (1618x1308, 1.95M)

Other urls found in this thread:

visualstudio.com/services/intellicode/
youtube.com/watch?v=EFwa5Owp0-k
github.com/freifunkhamburg/Fresnelzonen/blob/master/line-of-sight.php
github.com/carp-lang/Carp/
google.co.uk/search?q=learn haskell
twitter.com/NSFWRedditVideo

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.

*hacks you*
you're trap now

Attached: average dpt poster.png (500x281, 147K)

you and i BOTH wish

user in old thread
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?

gay

Attached: 1525444236947.jpg (1280x720, 164K)

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 pathSteps = new ArrayList();
List steps_in_path = new ArrayList();
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 temp = new ArrayList ();

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 pathStepsNoDupes = new ArrayList(new LinkedHashSet(steps_in_path));

return polygons.toString();
}

Attached: 1472362242684.jpg (221x246, 21K)

dumb frogposter

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

I don't even.

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

But wouldn't that be constant?

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

Attached: 1525392298109.png (782x1021, 330K)

>she needs someeone else to program for her

Attached: 1453656893901.png (180x236, 64K)

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

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

if any of you feel like helping a guy out

>she writes her own programs

Attached: 1513153372009.png (498x710, 290K)

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

>she has programs written

Attached: 1462665702455.png (311x311, 54K)

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

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.

youtube.com/watch?v=EFwa5Owp0-k

Nice spacing, you fucking faggot.

thanks, cocksucker! :)

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

grinning ear-to-ear, m8

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

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. You aren't.

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

// 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

Attached: 1476929733307.jpg (2448x3264, 1.54M)

I do. Good job on taking notice of that.

// 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 .= 'absolute';

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

$ret .= '';
}

return $ret;

}

3/3

help port to java pls

Attached: 1483767974338.jpg (577x704, 97K)

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

>updating your dev environment

Attached: 1449361855035.png (826x392, 29K)

Why do you have so many nonsensical spaces?

it's from here

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

I realize it was a mistake now

well you live and learn

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

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.

>she programs

Attached: le smug.jpg (573x619, 61K)

it's supposed to do this

Attached: Fblosv-2.png (1976x1352, 2.73M)

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

Attached: 1463064892991.png (270x360, 139K)

fucker master smug

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?

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

>nhibernate
That is another poolang. I meant hibernate

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

>Germans

found typical Jow Forums programmer on live stream

Attached: g.png (555x516, 190K)

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

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);

Attached: 1479510851679.gif (360x252, 1.3M)

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

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.

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.

wonder if this counts as shitposting in code form

Attached: Screen Shot 2018-05-08 at 9.01.56 AM.png (1078x1412, 243K)

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

Attached: 1525522080204.gif (500x418, 957K)

Oh i get it nvm

why not have a null document be an empty map document

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, user thread?"
>the Qt slot was actually Stallman in polymorphic disguise

Attached: sigtrap.png (327x300, 104K)

because user that's not null, that's en empty map

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

It counts as fucking abomination.

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

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.

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

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

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

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

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

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?

Or a document with an empty string

yeah that too

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

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

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

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

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.

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.

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

god damn my dick is so hard

me too user

A wild Terry Davis appears. What do you do?

Attached: sBJG8sT.jpg (1294x478, 60K)

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

U8 *p = NULL; *p = 0;

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

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

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

Attached: question.png (500x530, 163K)

why is daniel day lewis so racist?

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

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

I think there are also Trap functions in Assembly programming.

google.co.uk/search?q=learn haskell

highly recommended.

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.

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.

#include
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

Attached: 1519543111544.jpg (348x260, 11K)

x=x++
is a no-op

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

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.

Wrong

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.

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