/dpt/ - Daily Programming Thread

ActionScript edition
What are you working on, Sup Forums?
Old thread:

Other urls found in this thread:

pastebin.com/3Fw42jJL
github.com/qbittorrent/qBittorrent/wiki/How-to-write-a-search-plugin
ideone.com/c5LvNY
benchmarksgame.alioth.debian.org/u64q/compare.php?lang=ghc&lang2=gcc
ideone.com/O3k1i3
twitter.com/NSFWRedditGif

Employed calculus of constructions programmer reporting in.

function ackermann(m:uint, n:uint):uint
{
if (m == 0)
{
return n + 1;
}
if (n == 0)
{
return ackermann(m - 1, 1);
}

return ackermann(m - 1, ackermann(m, n - 1));
}

>Design Patterns
ActionScript = ActionShit

shutup actionscript was a great babbys first programming language because flash was more easily deployable than almost every runtime out there when it came out

I believe in the last thread somebody said Haskell was faster than Java. Are you fucking retarded?

Threadly reminder that dlang-chan is not dead; she's going to have her GC tumor removed (eventually); and she's super duper cute and easy to prototype in! Say something nice about her, /dpt/!

Just because you are employed and a programmer does not mean you are employed AS a programmer.

Haskell is faster than C

...

VS Codeā„¢ is pretty nice lads.
What does Sup Forums think of it?

I am though.

it's got some decent plugins and it runs better than that piece of shit atom so it has that going for it. already dropped visual studio a while back in favor of qt creator for C++, but i often use vs code for C#, shaders, JSON, XML, plaintext, etc. might make a DSL soon and i'd consider doing a plugin for highlighting/completion if the API looks alright

playfilly speaking

unemployed dna programmer. post code snippets as tribute and I will imburse. can share intribute to those willing to act as playment for time. The last few were garbage and I have no keyboard atm.

None of that is programming.

>it runs better than that piece of shit atom
I've got to wonder why that is. Does Atom just get commits from tranny "programmers"?

not so playfully speaking


anyone have a clue how i can make code sheets quick and well enough just using my shitty smart phone?

Write a C program which adds two integers using 5-star pointers.

Not faster, just about the same. As long as you're in the decidable subset.

pastebin.com/3Fw42jJL
github.com/qbittorrent/qBittorrent/wiki/How-to-write-a-search-plugin
What am I doing wrong?

are you high?

at first i assumed it must have been because atom runs on a node.js backend, but then i saw that vs code actually runs on the same framework. so yeah, i don't know, maybe it's just shit contributors

What the coolest/most complex program you have ever made?

FizzBuzz

haha! xD

your drink

VS Code is awesome when developing in Angular 2. It has Typescript highlighting and that is nice. Also SASS and other stuff.
Like the other guys say. It's a good editor and pretty lightweight.
Oh and by the way. Fuck Atom.

you sound your diction like a loud indian kid

please comment and subscribe it helps a lot

Rust programmer here, did i do it right?

ideone.com/c5LvNY

>get contractor to do comms protocol stack
>application layer needs to set bit7 of a byte to make acknowledgement message
outputbyte = inputbyte == message1 ? message1ack :
inputbyte == message2 ? message2ack :
inputbyte == message3 ? message3ack :
inputbyte == message4 ? message4ack :
inputbyte == message5 ? message5ack :
inputbyte;

Looks who's talking

>and pretty lightweight.

What are you guys smoking?

>benchmarksgame.alioth.debian.org/u64q/compare.php?lang=ghc&lang2=gcc

Are you a disagreeing fag?

Seeing the last thread, i started on a O(1)-indexable string in Rust

marcu

>Vector
Shiggy diggy

I'm building servo right now. Why is it that they say it's usable *now* but when I try it's a giant shitshow? I've been waiting ages for it to get more stable so I can make my own browser

What's wrong with Vector?

It's usable in the sense you can build it and render websites somewhat okay. What you want is feature parity with other engines, i.e. websites rendered with servo look the same as other engines. That's still far off.

>What you want is feature parity with other engines
I actually just want it to not take a giant dump and not crash.

File a bug?

>Rust won first place for "most loved programming language" in the Stack Overflow Developer Survey in 2016 and 2017.
Someone get me off this ride. PLEASE

ideone.com/O3k1i3

You don't really need to use malloc...

>a meaningless award
Shillzilla can buy all the shit they want, it wont stop rust from being a fad.

Can you recommend me some imageboard or similar chat open source for linux? I would like to host that and practice.

Does /dpt/ listen to synthwave/electronic etc? Could you gals recommend me some top tier bands? Metal bands who use a lot of electronics like Turmion Kat. is also preferable.

I am tried listening to Carpenter Brut, Die Krupps, Crematory over and over again while programming. I tried Hypocrisy too, but the lyrics are too damn good to not listen to it, fuck u Peter.

I scored a job at a trendy startup. I need an avatar icon that will make people think I am cool.

Help, please

nvm figured it out

I heard Pepe was the in thing

Good on you, user!

dumb implicit frogposter

thats the thing i thought about instantly, but the people here probably browse IT news sites or reddit and think its a nazi symbol

Time to redpill your co-workers.
Stay woke user.

Just use the universally accepted symbol of shitposting.

I did some comparing of C++ and Java , more precisely the amount of memory that these two languages use up when running the same operation. The operation was the filling of 8 000 000 array with a value of 777. After tracking the memory that both languages used in this program, Java managed to use up more than five times more than C++. All the values were written to heap memory.
What might be the factors that contribute to such high memory usage in Java?

Java is garbage

Is Fortran deprecated? I'm final year in civil engineering department at college but nevertheless research room's teacher gave a crash course about it and I liked its simplicity.

physicists still use it for number crunching

it is an IT company
meaning it is packed to the brim with pajeets
meaning its not a good idea to post alt-right memes

Is this what C fags consider good code? Got this snippet from my professor.
#define STRLEN 81

int equals(char x[STRLEN], char y[STRLEN])
{
unsigned i = 0;
while(x[i] == y[i])
if(!x[++i]) return true;
return false;
}

what's wrong with that?

any ideas on how to solve/display a recaptcha in a terminal application? can i display it with framebuffers on console? what would a nice way in xorg?

>Professor
No

No, why is it a sized array parameter if the size isn't used in the body? Just pass char* x and char* y like God intended.

>int equals
>return false

disgusting

Nice tumor.

Seek help for your condition.

Yes, actually.

Answer

ur such an ebic trole xDD

I made this!

It's a super simple WPF application that just takes the text fields, appends them to a string builder, and then writes the text to a file with the date as a filename.

You can select a directory to write to within the current directory using a combobox and you can create directories in the current directories with a text field and a button.

Answer .

Good job user, that's actually pretty neat

Thanks, I'll post my games too if I have anything cool to show.

How do you guys deal with 3rd party libraries using a different code style, so for example they use camel case and you use snake case?
Do you write wrappers just for this?
Ignore it?

Depends.
If they're a one-time usage kindof thing, i'll suck it up. If i have to use it regularly i write wrappers

How do I find an open source project to contribute to?

Want to get some python and C contributions on my CV

What case are you supposed to use for C?

Camel? Snek?

snake_case you shitter

Gnu has many projects written in C that might need new maintainer or just developers in general.

I personally use dicKCase

>too late to invent Facebook
>too early to make millions mining asteroids
>just in time to witness the dawn of the dicKCase era

i need to do a web application for my final proyect, it uses a certain technology so it must be in java. where should i start? i've looked into Spring Boot but it seems weird and bloated, maybe there are better alternatives

I tried this a while back.

Noone new to C wants to get stuck trying to offer bugfixes to a clusterfuck like most of GNU's 30 year old legacy code.

It's actually disappointing, exciting projects are well managed by people who don't need much help, and exceedingly unexciting projects just suck.

why cant neovim recognise the ft
halp pls

Just starting f#. Any idea why this just returns a list of the same digits?

let x = 10
let y = 10

let generateRandomness =
let rnd = System.Random()
List.init x (fun _ -> (rnd.Next(0, 2)))


let Maze = [for i in 1..y -> generateRandomness]


returns
val Maze : int list list =
[[0; 1; 0; 0; 1; 1; 0; 0; 1; 1]; [0; 1; 0; 0; 1; 1; 0; 0; 1; 1];
[0; 1; 0; 0; 1; 1; 0; 0; 1; 1]; [0; 1; 0; 0; 1; 1; 0; 0; 1; 1];
[0; 1; 0; 0; 1; 1; 0; 0; 1; 1]; [0; 1; 0; 0; 1; 1; 0; 0; 1; 1];
[0; 1; 0; 0; 1; 1; 0; 0; 1; 1]; [0; 1; 0; 0; 1; 1; 0; 0; 1; 1];
[0; 1; 0; 0; 1; 1; 0; 0; 1; 1]; [0; 1; 0; 0; 1; 1; 0; 0; 1; 1]]


I'd want the list to have unique variables.

Because you're creating a new Random on every loop.

Declare your Random outside of the loop, and use the same Random to call rnd.Next().

Pic related shows the behavior you're wanting, followed by what you're currently doing.

This is due to the fact that Random is seeded based on the current DateTime ticks, so creating 100 new Random objects nearly instantly all at once is going to produce the same initial random number.

var x = 10;
var y = 10;

var rnd = new Random();

List generateRandomness() => Range(0, x).Select(i => rnd.Next(0, 2)).ToList();

var Maze = Range(0, y).Select(i => generateRandomness());

Cheers chaps

Still struggling with it as moving rand outside the loop didn't work, just need to convert the other solution into f#.

>moving rand outside the loop didn't work
Probably for the same reason this doesn't work (returns the same list over and over):
var x = 10;
var y = 10;

var rnd = new Random();

var generateRandomness = Range(0, x).Select(i => rnd.Next(0, 2)).ToList();

var Maze = Range(0, y).Select(i => generateRandomness);

But this does (returns a new random list on each iteration):
var x = 10;
var y = 10;

var rnd = new Random();

var generateRandomness = Range(0, x).Select(i => rnd.Next(0, 2));

var Maze = Range(0, y).Select(i => generateRandomness);

The distinction here is whether you're realizing your list of random numbers before you begin to call upon it.

I'm assuming that List.init is similar to C#'s .ToList().

In the former, you're creating a list of random numbers, rather than a query on how to get 10 random numbers, because I'm calling .ToList(), doing the work, and getting that information in memory.

In the latter, I'm creating a LINQ enumerable that "knows how to retrieve 10 random numbers", so if I call upon this ten times, it's going to do the actual work to retrieve 10 random numbers 10 times.

What stimulant do you use dpt?
caffeine mints masterrace here

elp pls ;-;

basic bash script


how do you pass an argument with double quotes in a var that you want to execute with echo ` ... $var` ?

pls help, how do i web app in java?

Doing a C assignment for some kid for 200 turkish liras involving POSIX semaphores, threads and shm. He's paying me to have fun pretty much

>bumping your post 45 minutes later when it's early in the morning here in the civilized world
>talking about java and immediately jumps to the nonsensical "weird and bloated" complaint because it's too hard for your curry-infested brain to grasp
>not using the last 45 minutes of your life to do a modicum of research and easily see all of the modern Java web frameworks and at least picking one and doing an initial demo

You're not going to make it.

They have STEM in roachland?

yeah, we do the real work and leave the webdev and stuff to you cuz we know that's what you can do xd

what is this meme language, learn java and get a job neet fag

Hatching cockroach eggs is not real work

Cheers man, I appreciate the help.

Looks like I might be taking the wrong approach then based on what you're saying.

Rather than grabbing that list every time, I may as well have nested for-loops within Maze that would generate it so it would be different everytime.