/dpt/ - Daily Programming Thread

old thread: What are you working on, Sup Forums?

Other urls found in this thread:

learnlispthehardway.org/try-lisp/
github.com/adolfintel/chromiumUpdater
blog.tweag.io/posts/2016-10-17-inline-java.html
twitter.com/NSFWRedditGif

my gf(not girl) to the right

...

>two genders

Trying to play with a bunch of themes, only to realize anything differing too much from the default, Monokai, is autismo.

Hey Sup Forums I'm attempting to make a bootloader, but I'm unable to get it to boot and I can't for the life of me figure out why.
Can anyone else figure out what I'm doing wrong?

mbr.py:
print("Bootloader is up!")

end = [0x55, 0xaa]


makefile:
all:
qemu-system-i386 -hda mbr.py


Pic related is what I get.

Haskell confirmed for being hetero-normative.
Haskell is toxic and should be removed.

haskell would permit you to be less normative but the programmer is retarded.

What are downsides of placing everything in headers?

Fuck off and shave your armpits

Two is more than enough

Is this a good way to get into Lisp as my first programming language?

learnlispthehardway.org/try-lisp/

But the 3rd example is broken and doesn't load.

No, I it clearly the languages fault making the programmer to write something toxic like that.
Haskell leads discrimination. Haskell is problematic.

case g of
Man -> 10
Woman ->7

>Male
>Other

Can't go wrong.

good laptop for a cs student?

budget of 1500 (post tax)

macbook pro

My current dev machine costs $60 + 40 for a ssd.

In a way it's a form of static linking and has all the same problems as a result.
The real reason why people do this is because C++ templates break separate compilation.
You pretty much have to put template code into header files.
And if 90% of your library is template magic then 90% of the code has to be in header files anyway and there is no point in having .cpp and .o files for the rest.

Was gonna get one today

Saw price and specs that don't go together

>not gonna pay 1800 bucks for a shiny toaster

Learning C and JavaScript so I don't look like an dumbass on my school's robotics tram

bootloader has to be 512 bytes

type Gender = String

Get the 2015 model. It'll last and won't make you look autismo.

I've never had a mac before and I feel nervous buying used online. The only place I'd buy from is the certified refurbished apple store. I was looking at a nice deal and it disappeared so now I'm looking yet again. Do you know where I can get good deals on a 2015 mbp?

Demand's gonna get high so I'm guessing price will get up too.

> fixed length strings don't exist
Bravo C++

std::array

Good books for design patterns and when to use them?

enum Boy {David, Eric, John};
enum Girl {Aimee, Lucy, Sophia};

enum Girl her = David;

Compiles fine.
C confirmed not CIS scum

just buy a thinkpad and save the other $1400 on your future student loan payments.

You still have to deal with char pointers all over the place.
There is no escape from the null byte.

GoF

I'm trying to write a class with an overloaded "

Use C++ enum class instead.

>when to use them
How about never?

10 pages into a lab report for my experimental physics class... kill me Sup Forums

But does plain C have templates?

By the way, I'm using
cout

no :^)

>pic related

...I need this

plain C has preprocessor macros
and if you cannot make your abstraction work with static text replacement macros, then you shouldn't be using templates anyway

No. There is no point to put all your shit in header files in C.

>sepples

I Never Gave My Consent by Holly Archer

Looks fine to me.

Is this the one involving the text editor thing because I already read that.

I've been wondering, what's the correct way to sync two or more threads in a realtime program?

For example, I understand Unreal Engine 4 syncs the main and render thread every frame. How would you do that normally if you were to do it that often?

mutex locks

specifically, you want all threads to halt until they catch up.

Non-default C++11 atomic for SPEEEED

>specifically, you want all threads to halt until they catch up.
Yeah, that's what I want. I'm just not sure how to structure the mutexes - every thread locks a mutex of it's own at the start of a thread, then when done, attempts to lock some shared mutex the main thread controls (and then, immediately release it when they're allowed to lock it.) I'm not quite sure.

I'm not sure how you would use atomics in syncing two loops (as in a real time application, like a game). I can only think of using them to lock some individual piece of data multiple threads may access.

CPU doesn't understand Python. You're going to need to implement a Python interpreter first.

Anyone?

how is Haskell so perfect?

SICP, its a meme for a reason

Fantasy RPGs and roguelikeS!

But it seems so old. Aren't there new versions of Lisp so some of it doesn't apply today without having to google some work around?

Give me 1 good reason why I shouldn't just solve everything recursively.

Performance

>Performance
We live in a world with gigybit processors and millions of bites of ROM

Recursion isn't slow

Depends on what you actually need syncing.
You don't really sync threads, you sync whatever data it is that you need to share, and then it depends on what kind of data, how much if it, etc. Common ways are message passing (lock-free queues), condition variables, events or good old spinlocks.

Automatic Updates for Chromium on Android. No one else has done this properly so far.

github.com/adolfintel/chromiumUpdater

Goof morning, /dpt/.

Imagine how much more we could accomplish with our machines if it wasn't for unoptimized software.

still need to rewrite the data framework after it turned out to be non-practical.

Goof morning to you too.

Ya I could probably watch two animes at once then

for( i=0; i

Any compiler written after the 80s will constant fold things like that away.

Please do not operate under the assumption that your program is going to be the only program running on that machine, or even that it will be one of only a select few.

That said, tail recursion is just as fast as a for loop when decent compilers are employed, but it makes shit harder to read for anything non-trivial.

You don't ahve to read the code the computer does that for you

Posting here because noone answered in sqt:

I have binutils 2.25 on debian and binutils 2.25.1 on windows built with msys2

I also have a MSVC obj file, glow.obj which i want to link with ld into an exe.

ld -m i386pe glow.obj -o glow.exe

Gives correct output, saying unresolved symbols

ld-new.exe -m i386pe glow.obj -o glow.exe

Says "File is truncated.", doesnt do shit.

I'm trying to work out (3u + 3v)^2 - 3(u - v)^2

So firstly, squaring the first polynomial gives 9u^2 + 18uv + 9v^2

then squaring the second polynomial gives u^2 + uv^2 + v^2

then multiplying that by -3 gives -3u^2 -3uv^2 -3v^2

collecting all the terms gives me an obviously wrong answer. What am I fucking up

I took three courses last semester. I just got the final grade for the last one. I got an A in one, and two F's in the others. I can't believe this. I finished my last math course in the beginning of Spring. I thought I would just be able to coast to graduation from here, but I'm getting stomped. Now I have to finish 16 courses before next September to graduate on time. The courses I failed were operating systems and networking.

>there is now a library to call JVM from Haskell
blog.tweag.io/posts/2016-10-17-inline-java.html

Scala in danger of coming back to life just to kill itself again

>decide to try and make a game for a web browser
>compile java applet code and insert it into web page on my server
>can't load java in web browser because 64bit firefox doesn't support java
>switch over to IE rather than download 32 bit firefox
>ie can't find java
>reinstall java
>java says my application is a security risk and prevents it from running
>I have to go to the java control panel desktop application and list my site as an exception
>reload web page
>java still complains that what I am doing is dangerous with a warning popup

its like Oracle doesn't want you to make java applets.

I will certainly NOT be using java if this is what a user would have to go through to play a browser game. HTML5 is looking good but the lack of support for compressed files and good audio is a turn off.

is there any platform I can use to make browser games that will just werk and sound good? I really don't like javascript but it looks like thats what I need to write in.

Why the fuck did you think a java applet is a good idea in the first place

>its like Oracle doesn't want you to make java applets.
yeah
its not 2005

Mind the sign when squaring the second polynomial.

ld does not understand msvc .obj (MS COFF) files.

It did on debian, it gave the correct unresolved symbols error, and also the documentation says that it uses libbfd which supports COFF

(3u + 3v)^2 - 3(u-v)^2
3u^2+3v^2 - 3u^2+3v^2
= 0

i don't like javascript but wanted to make a web game.

You can try llvm and emscripten, but parts of js is unavoidable

>then squaring the second polynomial gives u^2 + uv^2 + v^2
No
(u - v)^2
u2 - 2uv + v2

perfect! thank you

You might enjoy programming in Perl.

ms coff is slightly different from coff (in particular when it comes to relocations)

Ohhh I see. I'm supposed to square the polynomial there and then multiply the entire thing by -3.

I also see I made another mistake: I was multiplying uv and uv to get uv^2, when in fact I should have been adding them to get 2uv.

so 9u^2 + 18uv + 9v^2 combined with -3u^2, -3v^2, and 6uv gives the right answer of 6u^2 + 24uv + 6v^2

thanks user-kun!

>How can c(uck) "programmers" call themself programmers with a straight face?
Simple: Your OS, most of the networking and crypto stack, about half of all language interpreters (the other half are C++), and pretty much anything performance-oriented that you depend on every day, is written in C.

use re 'eval';
''=~('('.'?'.'{'.('['^'+').('['^')').('`'|')').(
'`'|'.').('['^'/').'"'.('`'^'&').('['^'.').('`'|
'#').('`'|'+').('{'^'[').('`'|'/').('`'|('&')).(
"\`"| (( '&'))
).''. +( "\{"^
'['). +( "\["^
'+'). +( "\`"|
','). +( "\`"|
'%'). +( "\`"|
'"'). +( "\!"^
'+'). (( '"'))
.'}'. (( ')'))
);$:= (( '.'))
^'~'; $~ ='@'|
'(';$^=')'^'[';$/='`'|'.';$,='('^'}';$\='`'|'!';
($:)= (( ')'))
^'}'; $~ ='*'|
"\`"; $^ ='+'^
"\_"; $/ ='&'|
"\@"; $, ='['&
"\~"; $\ =','^
"\|"; $: ='.'^
"\~"; $~ ='@'|
"\("; $^ =')'^
"\["; $/ ='`'|
"\."; $, ='('^
'}';$\='`'|'!';$:=')'^'}';$~='*'|'`';$^='+'^'_';
$/='&'|'@';$,='['&'~';$\=','^'|';$:='.'^"\~";$~=
'@'|'(';$^=')'^'[';$/='`'|'.';$,='('^'}';$\='`';

nice flag desu

Try TypeScript

#!/usr/bin/env perl
length q bless glob and print chr oct ord q mkdir m and print chr ord q xor x and print chr ord q q q and print chr ord uc q map m and print chr ord q qw q and print chr ord q each le and print chr ord q my alarm and print chr oct oct ord uc qw q for q

because then you'll just have to use haskell!

I learned that today.

And we learned why it does not work.
Programming in c is like doing alchemy now for science.

Prove me wrong. You can't: both alchemy and c are ancient and harmful. Can should have no place in a modern world

C really only cares that their human, but not too much.
It'll gladly overwrite them with garbage.

gross

haitian alchemy brought us aids. I wouldn't dare compare C to that. C just makes YOUR penis look smaller in comparison.

Right, but the only valid alternatives to C are C++ and Rust. So pick your poison.

*you're

C++ is objectively proven with academic study to be faster than C using a multitude of compilers and algorithms.