/dpt/ - Daily Programming Thread

What are you werking on?

Attached: 1529381023816.png (615x597, 301K)

Other urls found in this thread:

desuarchive.org/desu/thread/3366/
github.com/Meachamp/archiver
sitepoint.com/java-8-streams-filter-map-reduce/
clhs.lisp.se/Body/f_map.htm
paulgraham.com/quotes.html
carlchenet.com/you-think-the-visual-studio-code-binary-you-use-is-a-free-software-think-again/
mitpress.mit.edu/books/little-typer
twitter.com/AnonBabble

first for COBOL

Ruby is cute!

I made a stereoscoper for outlines on transparency, and one that cycles through the rainbow.

Attached: ezgif-4-d545c83532.gif (436x1032, 2.6M)

nth for install shen

Nothing
I have no energy. I have no idea what to do. I've finished my degree in spring and been too depressed to apply for a job.

Attached: DcFAjVRW4AABqz2.jpg large.jpg (1170x916, 249K)

get well soon friendo

C++

Python3 for apps

Things seem bleak right now, but they'll get better, buddy. Start by doing small things. Just keep on trying.

Do some exercise as well. It helps.

only 4 days until cpp con!

Attached: .png (496x777, 1.12M)

>C preprocessor convention
Holy fuck, does that sound dull.

I can't believe it's nearly CPPCon already. Damn this year went fast, it feels like only a week ago CPPCon 2017 was happening.

I'm teaching myself Perl at the moment.

Attached: 1533547280300.png (539x454, 194K)

Good job. Are you having fun?

redpill me on reader macros

cool

Thank you. I'm making combining the rainbow with a pendulum I already made now.

int *ip[4]; //array of pointers to int
int (*ip)[4];//pointer to an array of four ints

Attached: C++ programmer.png (625x773, 112K)

Can I use functions as data in Java yet?
Also, is there some resouce to learn programming in java but functionally.

It runs really slow because I don't know how to optimize for shit.

Attached: ezgif-2-3446e86267.gif (570x388, 861K)

We are the shitty programmers who say IF ! if if if if if if

We are the keepers of the sacred words IF, AND, and ELIF !

Attached: latest[1].jpg (720x480, 47K)

I got some books today, hoping to learn how to do an asynctask.

Anyone touched these before?

Attached: IMG_20180918_180447.jpg (4048x3036, 3.89M)

reminder that a replacement for asagi is still needed and the current winner is a node project
desuarchive.org/desu/thread/3366/
github.com/Meachamp/archiver

does anyone on Jow Forums even know cobol?
i'm not baiting i'm genuinely curious

>Can I use functions as data in Java yet?
yes

>cobol
*sip*

Kiwis are cute, but perl is shit.

The shitty programmers who say IF... demand a sacrifice! We want...

a 100+ line script with nested IF conditions and slight variations of conditions were obviously copy/pasted several times and had a number or two changed.

Attached: 400px-Knightni[1].jpg (400x220, 28K)

Cringe

if if if if if

good post, don't listen to use "fi" next time, there are legit langs that use fi (if backwards) to terminate if

Attached: #.gif (540x304, 2.37M)

sorry does anyone on Jow Forums know COBOL?

So I can return functions on the fly, and take functions as parameters?
I can do this in Java?
(defun adder (n)
(lambda (x) (+ x n)))

and the function will remember the context it was created in and such?

Can I also do this in java?
(funcall (adder 1) 2)

static void main(String[] args) {
out.println(adder(1).applyAsInt(2)); // 3
}

static IntUnaryOperator adder(int n) {
return x -> x + n;
}

>It runs really slowly.
What's the general structure of your program?

From reverse-engineering it, it looks like you create five pendulums, then manually update each pendulum, and redraw them.
You *might* want to try to calculate all the positions for the pendulums in a given cycle, and for each "frame", draw the five pendulums. I'm not sure if this would be faster, but might be worth a shot.This way, you only update the frame you draw instead of doing calculations in addition to drawing.

resources?
Can I also do this?

(apply #'+ '(1 2 3))

what this does is basically take an "arrayList" and a function and calls the plus functions with arrayList's contents as arguments

timer = new Timer();
timer.schedule(new TimerTask() {
@Override
public void run() {
if (pendirector0 == 0) {
pencounter0 = pencounter0 + onehalf0;
penangle0 = pencounter0 + penangle0;
if (penangle0 >= 0) {
pendirector0 = 1;
}
} else {
pencounter0 = pencounter0 - onehalf0;
penangle0 = penangle0 + pencounter0;
if (penangle0

Oh and the value of "onehalf#" is different for each so that they will be synchronized, even considering their different starting position

not sure what that means but you probably can

in lisp, everything's a list
so
(+ 1 3)

is a list with symbol +, and numbers 1 and 3 as elements
the lisp parser reads this list and looks at the first element, and says, is it a symbol, does this symbol name a function, it gives an error otherwise. then it applies the function to the arguments
you can make the lisp reader not interpret something by putting a quote before it, like so
'(+ 1 3)
the lisp reader will not try to interpret the code, but will instead return the literal list, containing +, 1 and 3
with (apply #'+ '(1 2))
lisp will read and apply the "apply" function to the arguments #'+ and '(1 2))
#'+ is a shorthand for saying (the function named by a symbol, in this case +)
and ' you already know is shorthand for saying "give me whatever's next, but literally, or a list in this case)
apply basically does this
(+ 1 3)
which is like putting the symbol + inside the list '(1 3) (at the head), and then making lisp read (+ 1 3) which evaluates to 4

I'm wondering if Java can do such a thing, have a function that will take a function, and an a collection of sorts, most likely an ArrayList, and then return the calling of the function with the ArrayList's contents as the arguments to the functions

Can this be done, or it a big hassle?

int (*foo)(int(*)(int*(*[4])(int[4])),int*(**)(int**(*[4])(int(*[4])(int(*[4])())))); // a pointer to a function that returns int and takes 2 arguments: 1) a pointer to a function that returns int and takes an array of 4 pointers to functions that return a pointer to int and take an array of 4 ints as an argument 2) a pointer to a pointer to a function that returns a pointer to an int that takes an array of 4 pointers to functions that return pointers to pointers to int and take an array of 4 pointers to functions returning int and taking an array of 4 pointers to functions that take no arguments

that's the power of C++ baby

respond you fucking SHITS

so you can have custom syntax

so i can make a rough python implementation in lisp?

yes, you can
you can do anything in lisp
except run really really fast but even then you kinda can

Sounds like what you're looking for is the equivalent of a "Map/Reduce/Filter" functionality.
sitepoint.com/java-8-streams-filter-map-reduce/

i see, thanks for the succinct explanation

lisp is pretty cool. sometimes I wonder why very few languages incorporate its features since it has been around for about 50 years

all of them basically copied lisp since it's so old
lisp evolves too, and incorporates OOP as seen by CL
LMAO you fucking faggot that has nothing to do with APPLY

Yeah, I don't understand why I'd be wrong in this case...

The request was:
>A function that will take a function, and an a collection of sorts, ...
> then return the calling of the function with the ArrayList's contents as the arguments to the function
Which is exactly the functionality provided by MAP
clhs.lisp.se/Body/f_map.htm

Attached: Screen Shot 2018-09-18 at 7.03.37 PM.png (3562x688, 212K)

Ada or Go?

I've been trying to get haskell to work this entire evening. Keep getting errors and other bullshit

I see what you say, but I mean
this
f(a,b,c,d,e)
instead of this
f(a), f(b), f(c), f(d), f(e)

I thought you were trolling sorry

But anyways I doubt it has that because functions in java barely take varags

what errors?

I wanted to use ATOM with haskell. Fiddled with it for a couple hours, turned out haskell needed an update. So I uninstall, reinstall because I'm fairly certain that's the only real way to update GHCI

First time nothing starts up, uninstall, reinstall
Second time I get a PATH error. No idea what that is. Uninstall, waiting for reinstall. No idea why this is so difficult.

>haskell needed an update
Haskell is a language.

not him but you probably have to put the haskell installation's bin folder in your PATH environment variable. what os are you on?

What are you using with Atom? You're probably trying to use some plugin that adds IDE features, that depends on a library or EXE that adds all sorts of dependencies.
If you just install ghc(i) and only use a syntax highlighter you'll be golden
PATH is an environment variable that makes certain directories implicitly available

Windows 7

Actually it's a way of life

I do want an IDE that gives me all the comfy features of something like Racket. (without being so fucking slow)

go to control panel, search "environment variables", click on the thing to modify environment variables, scroll down in the lower box to PATH, and add your path to the end (separated from the previous one with a semicolon, i think)

Honestly, syntax highlighting and hlint are pretty much all you need. Personally I'd recommend VSCode but atom should be fine anyway.
It should be as simple as
>install stack by exe
>stack setup (install a version of GHC/Haskell)
>stack install hlint (install a package called hlint)
>on your editor, enable or get haskell syntax highlighting + hlint or haskell lint

thanks m8
I need my graphical interface to make me feel coddled

Hm... Nothing seems to be terribly out of place here. Let me write my version of this and I'll get back to you.
Deal?

Out of curiosity, is there a reason you hard-code the "1-6" part instead of making each pendulum its own object and factoring out the common functionality?

The image on Java Threads makes me very uneasy.

I want to do a Chip-8 emulator but I've never written one before. I'd like to read the code for another before I start but I feel like that would make it too easy to write my own.

>We were not out to win over the Lisp programmers; we were after the C++ programmers. We managed to drag a lot of them about halfway to Lisp.
- Guy Steele, Java spec co-author
paulgraham.com/quotes.html

It's a creature that lives under your bed.

If you're worried about that then just write a shitty version and then when you're done read a better version and rewrite the shitty version.

"halfway between C++ and Lisp" is an extremely uncomfortable place

I'm not saying that java is a good language; I'm just saying that it's important to know why it came to be.

I keep getting ghosted after interviews and no one responds even if I meet the criteria for the position perfectly. I performed pretty well at the few interviews I've had and I'm 99% sure I'm not autistic. Losing hope.

Do your internships, kids.

They should have thrown it in the river as soon as they realized what they created.

It's an echinoderm

>Out of curiosity, is there a reason you hard-code the "1-6" part instead of making each pendulum its own object and factoring out the common functionality?
100% just doing what I know how to, I'm self taught. If there's a better way and I know it I will use it, but my knowledge base is miniscule.

yeah

WHO THE FUCK MADE D3 DASHBOARDS WITH APIS SO DIFFICULT. AHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHH!

Attached: kill self 2989.jpg (600x391, 45K)

>live in south america
>be poor
>economy is a disaster
>cant find job
>want to sperg out with Jow Forumsentleman every once in a while
>have only one notebook
>share with cute sister
>cant install Linux
>12GB per month of 4G internet
>MS fucked me in the ass with WinUpdate
>never again

>learn about something called Powershell
>read something here and there
>make a script to stop it every time is running

$serv = Get-Service("wuauserv")

if($serv.Status -eq "Running") {
Stop-Service $serv
Write-Host "Stopping" $serv "service."
} elseif($serv.Status -eq "Stopped") {
Write-Host $serv "is not running."
} else {
Write-Host "An error occurred."
}

Read-Host -Prompt "Press Enter to exit"


I had to set Execution Policy to RemoteSigned for now, but I hope to generate a certificate later and have the script running in a Schedule Job at startup. Also, it would be nice to change property to also check and disable it if possible, I guess.

Attached: 1530244710066.jpg (1000x1777, 174K)

Yeah no worries, my dude!
I think looking at other people's code is usually a really good way of learning about programming (even if it's in a different language), so if I finish soon-ish, I'll send you code that's documented!

renge dont do it

Here's the graphic I am using if you want to use it too. Also the red starts at 60 degrees, O at 63, Y 66, G 69, B 72, I 75, V 78. and the rate of change in the change in degrees is .06, .063, .066, .069, .072, .075, and .078 respectively.

Attached: pendulumhandtwo.png (220x220, 2K)

next time pirate the enterprise edition and you'll be able to stop updates from the root

Is it just me or are ~90% of programmers just really bad at programming anything other than tiny pieces of OO CRUD systems?

>CRUD
define;

carlchenet.com/you-think-the-visual-studio-code-binary-you-use-is-a-free-software-think-again/
>Data Collection. The software may collect information about you and your use of the software, and send that to Microsoft.
>UPDATES. The software may periodically check for updates, and download and install them for you. You may obtain updates only from Microsoft or authorized sources. Microsoft may need to update your system to provide you with updates. You agree to receive these automatic updates without any additional notice. Updates may not include or support all existing software features, services, or peripheral devices.
VS Code useds BTFO eternally

I remember pointing out that exact clause on Jow Forums when vs code was first released. everyone shat on me

and here i am still using emacs after all these years, it just werkz

Keep fighting the good fight, user. I've never been used by VS Code either. Emacs is simply superior.

Go to bed, Kyle.

Essentially, systems which read from/update a few tables in a database and little else, and generally do nothing interesting at all. I suspect that it is impossible to work on them for long without losing a portion of your soul.

>I suspect that it is impossible to work on them for long without losing a portion of your soul.
Its impossible to work on anything for someone else without that happening. Thats why I'm glad I mined BTC in 2012.

>Its impossible to work on anything for someone else without that happening.
How sad that you've evidently never worked on anything for someone you love.

Ok thats different, like I painted this portrait of my grandpa, and I probably gained soul from it. I mean wageslavery specifically.

Attached: any excuse.jpg (1125x1545, 415K)

Sorry, that was mean of me. I understood what you really meant. Some types of employment are certainly more draining than others, though.

I hope your grandpa likes the portrait. I'm no art critic and I obviously don't know what he looks like IRL but you've given him a lot of character and life in it.

>this portrait of my grandpa
Terry?!

>I suspect that it is impossible to work on them for long without losing a portion of your soul.
I think it depends on how comfortable the lang is

I really like this painting, mind if I save it?

>I think it depends on how comfortable the lang is
Oh, for sure. Let me work in Haskell or OCaml and it's not so bad because at least then the tools work with me, not against me. Force me to repeatedly bash my head against the wall with Java and I'll absolutely hate it.

go ahead
Cole
No hard feelings

Attached: friend portrait.jpg (796x1024, 155K)

>the little typer isn't on libgen yet

Buy a copy. mitpress.mit.edu/books/little-typer

You're good at painting user. Were they gifts for those people?

These are nice paintings, no homo.