/dpt/ - Daily Programming Thread

What are you working on, Jow Forums?

Previous thread:

Attached: Surviving.jpg (500x627, 65K)

tips for working with bitmaps?

What's the most effective way for a go web server that receives files from some game to gzip them in batches of 5000?

Discord chat github has a repository for a go program for compressing images, look at it and change it for compressing whatever you're doing.

What are some uses for web assembly?
The JS WebAsm interop seems like huge developer pain and has overhead that makes it not worth it unless you're doing number crunching or something.

lock bits, its a hundred times more efficient

i cannot think in more than server side projects but dunno.

why would you program a web server in Go?
What does it have that other languages do not (besides god-forsaken syntax)

For node though it seems like it'd be easier to just call native code from JS and not bother with compiling it to WebAsm.

Isn't Go like really good for scaling up web services? perfect for big n companies

Just use JVM or C++.
Go is for google obsessed brainlets.

webasm will basically replace app stores, since now you can just push a binary and run everything through a browser instead with native access to OpenGL and other local resources.
They now have some scheme where webasm can be streamed and only compiled on demand, making these binaries smaller. There is one huge massive problem though: spectre and meltdown, which makes the orig idea of having webasm be a native binary impossible due to the way memory is handled. Well, impossible for mission critical tasks like banking/finance or anything else requiring privacy and correctness. A big ass game no prob tho.

I spent all day working on tech projects and reading about tech stuff. I feel so good uwu.

is it a good idea to read through YOLO source code? or will i die before i finish

You'll have to ship entire gui library with webasm code or deal with Dom/JS interop overhead.

Go is really good for simple server side things that don't require high speed. Otherwise it is a lot of boiler plate code and annoying error handling but it's standard library is utterly dead simple. Common Lisp you can do this too

So basically diet python but uglier?

Python requires an environment to run in, Go you compile to a native binary. Personally I would use Lisp instead of Go for anything, because if you're just going to hack together stuff might as well use Lisp. You don't need to write piles of unit tests for Lisp because you can just pluck out any function, run it, and test it with all inputs yourself on the fly. Go to me is a hack together this shit and hope it works without worrying about memory leaks kind of language but not nearly as easy to use as something like SBCL.

Not sure but I forked it from some guy and it seems pretty simple. Never even programmed before and I got it running, now I set up a file server on it and I need to package these files into a large gzip but I'm not sure how to go about doing that.

go on libgen.io and get the go programming language book by kernighan you'll prob find the answer in the first few pages

Even if I'm rotating or scaling it?

But should I have the files being packed on a python script running outside the backend or should I encorporstr it into the backend? This thing can handle millions of file uploads a day.

>Never even programmed before and I got it running
doubt.png

Trying to learn a lisp. When I try to evaluate this expression:
(defun distance (dna1 dna2)
"Number of positional differences in two equal length dna strands."
(cond ( (eq (length dna1) (length dna2)) ;test
t ;action
)
) ;;cond
);; defun


SLIME yells at me, saying
; Evaluation aborted on #.

I'm telling you it's very simple.

It's like this bus has css html and a lot of functions for the game.

func main() {
router := gin.Default()
router.Static("/assets", "./assets")
router.StaticFS("/more_static", http.Dir("my_file_system"))
router.StaticFile("/favicon.ico", "./resources/favicon.ico")

// Listen and serve on 0.0.0.0:8080
router.Run(":8080")
}


I added the fileserver tonight. You don't have to be a genius to do it. Now I just have to figure out where to gz the files, running a parallel python script or somewhere in the go server code?

Nevermind this. I was having a weird namespace error.

I spent a year at an ad tech company to get my feet wet in the programming world after a career change, but all I learned was SQL, so I decided to teach at a bootcamp to learn some new languages.

I'm having much more fun trying to make a text adventure than working on any real project. Once I figure out how to create ascii art and format properly and implement a health bar, this thing will be zipping along.

Attached: text adventure.png (1042x769, 51K)

What's teaching at a boot camp like? And how did you get the job?

Working on PPP and learning c++.

It's comfy. Should have started with c++ and not python, but whatever.

Golang is a lightweight compiled garbage collected language has strict types. All other mainstream webserver languages are loosely type interpreted NIGHTMARES.

If you've never worked on a large webserver project, let me tell you.... types are the shit. Knowing what's being passed into a function just by the function syntax makes writing and working with things way easier. Also required explicit error handling makes sure that webservers fail gracefully rather than in a giant diarrhea storm of "silenced" errors and other crap.

>All other mainstream webserver languages are loosely type interpreted
Bullshit

Break this up into smaller functions reeeeee

It's a lot of fun. I made sure to pick a legitimate program (it's sponsored by one of the best tech schools in the region), and I've been pleasantly surprised with how in depth the material is. They definitely teach you a lot of what you need, but there's pretty clear differentials in how well the students do. Some people are doing great, and some are drowning two months in.

A recruiter reached out to me, and I started a few weeks later after going through a light technical interview and a heavier teaching one.

Does getline store everything as a character or a string?

Attached: 1534125506988.jpg (961x816, 239K)

>forked it from some guy
sounds like most of the work was already done

dumb frogposter.
VERY dumb frogposter.

Attached: 1495230699862.jpg (1395x858, 606K)

anyone have any tutorials on using examine in gdb when i have a bunch of addresses just dumped? im trying to match up specific values to addresses or see where an array begins and ends in the dump but im having trouble finding some good tutorials on that specifically.

nigga just look it up

>Extracts characters from is and stores them into str until the delimitation character delim is found (or the newline character, '\n', for (2)).

This is the most human interaction I've had all day

Attached: 1518937679215.png (656x755, 57K)

dont be sad.

everything will be daijoubu

it's ok to be dumb
but it's not ok to be a dumb frogposter

Why is lisp yelling at me so much?
(defun acronym-helper (string
prev-char
index
max-ind)
(let* (
(curr-char (char string index))
(rest-str (acronym-helper string curr-char (+ 1 index) max-ind))
)

(cond (
((eq index max-ind) "")
((is-space curr-char) (concatenate "" rest-str))
((is-space prev-char) (concatenate (char-upcase curr-char) rest-str))
))) ; let body

)


Whenever I run this, it says that
The variable PREV-CHAR is defined but never used.


I feel like this has something to do with my "let" block, but I can't figure out why this isn't working

why do people hate C++'s STL? Is it just boomer memes?

Some people realize it's an unholy behemoth, and the ones that don't or refuse to, rewrite the STL in C++ every new standard.

How does Jow Forums feel about half pixels? It makes animation a bit smoother, but isn't pure pixel art. Maybe only use it in in betweens?

>What are some uses for web assembly?
Getting rid of javascript.

And by Jow Forums I obviously mean /agdg/.

you are all kinds of confused m8.

Oh fuck, wrong thread.

GB emulator

You have to define prev-char in your let* block.

Let subclauses are lexically scoped to the declarations.

In all seriousness, it will mostly be used for tech that requires a lot of processing, and can be run as its own thing normally, like video games, video editing, live video filters, data visualizations, Graphviz, and also frameworks where a lot of the magic is outside user reach like React

It can't really fully replace JS because someone will need DOM manipulation at some point (though some standard could make it possible to just link your wasm file, and it has declarations for DOM manipulation), and also because it's not interpreted, so it's slower to debug and test on the fly (though good practices could circumvent this a little)

the STL is a weird combination of common tools (like the containers and algorithms), metaprogramming tools (like type_traits) and some special purpose ones (like chrono, thread, atomic, etc).
Not all of them are meant to be used for writing applications. Also, since it is so large, some parts of it do not play well with others.

It's a complete pain in the ass to work with. C++ is just a convoluted mess in general which is why it rightly gets so much hate.

Visual Studio+Xamarin is so much better than Android Studio it's not even funny. Why can't Google make a good IDE for their own platform?Why did they leave Eclipse for IntelliJ in the first place

Attached: Screenshot from 2018-09-26 16-29-22.png (530x476, 48K)

If you've used both, it's obvious. Eclipse is ugly, IntelliJ is featureful

eclipse is simple and gets the work done, intellij is the BLOATED

UI is customizable to strip out all you want, where you want your plugins, etc. Eclipse unfortunately cannot be stripped of its ugliness

the code quality here is much too high for this to be /idgaf/
cute!

Do it over a long period of time, dumbass.

fair enough, how would explain its inferiority to VS then

>) ;;cond
> );; defun
Eww
Are those at least autogenerated?

It's Microsoft shit so you know it's not suitable for proper development

Damn, you summed it up perfectly.

even freetards acknowledge how good VS is, what the fuck are you talking about

Do you ever actually use inheritance?

Nah, there's really no reason to anymore after learning the FP way.

Yeah, but not too deeply

Not if I can avoid it.

Whenever it's necessary. I prefer friend classes or composition instead. But when I'm using Java/C# there's no way to avoid inheritance. Even simple shit like vectors are inherited

I took C++ class in the Spring, love the idea but need better algorithmic training-- then took up C# over the Summer, which is great... But I am about to start Java class. I've only "studied" JavaScript Syntax; what am I in for? Is Java really worth learning if what I love are C#/++ and Python?

>his language doesn't have decltypes
o im laffin

Java is never worth learning

I am trying to write a binary search in OCaml to find a string in an array of sorted strings

let rec binary_search a value low high =
if high = low
then (if ((String.compare a.(low) value) = 0)
then low
else -1)
else(
let mid = (low + high) / 2 in
if ((String.compare a.(low) value) = 1)
then binary_search a value low (mid + 1)
else (if ((String.compare a.(low) value) = -1)
then binary_search a value (mid) high
else mid))
;;


let find dict word =
if ((dict = [||]) || (word = ""))
then -1
else(binary_search dict word 0 ((Array.length dict)-1))
;;

This is what I wrote. But somehow this gives me an infinite loop.
I thought it was an issue with integer division but it doesn't seem it's the issue.
Can someone spot my mistake?

>Java
C# is a Java ripoff. So you'll feel right at home.
Except when it comes to employability.

Attached: 1534935983694.jpg (1291x3600, 610K)

Java is simply C# but with less bullshit and worse generics. If you know C# then you can pick up Java in a few days.

>Is Java really worth learning
absolute kek, no

>t. NEET fizzbuzz master

I finished my c++ homework
guess I'll just go to sleep now
still can't think of anything neat to put on my github and the class is really intro tier and boring

how do i unsubscribe from your shitty blog

OP asked me what I was working on....

GB emulator

>OCaml
why someone would learn ocaml in 2018?

Should I read pic related before or after I learn C?

Attached: csapp3e-cover.jpg (504x648, 62K)

r8 my code that I haven't run
pushToTail: function (data) {
if(this.size === 0) {
let node = makeNode(data, null, null);
this.head = node;
this.tail = node;
this.size = 1;
return;
}
this.tail = makeNode(data, this.tail, null);
this.size++;
},

pushToHead: function (data) {
if(this.size === 0) {
let node = makeNode(data, null, null);
this.head = node;
this.tail = node;
this.size = 1;
return;
}
this.head = makeNode(data, null, this.head);
this.size++;
},

popTail: function () {
if(size === 0) {
return null;
}
let node = this.tail;
if(this.size === 1) {
this.head = null;
this.tail = null;
this.size = 0;
return node;
}
node.prev.next = null;
this.size--;
return node;
},

popHead: function () {
if(size === 0) {
return null;
}
let node = this.head;
if(this.size === 1) {
this.head = null;
this.tail = null;
this.size = 0;
return node;
}
node.next.prev = null;
this.size--;
return node;
}

Honestly?
I'm too much of a brainlet for Haskell just yet.
If I can be comfortable with OCaml, I'll then feel "false beginner" in functional programming.
If I can't into OCaml, I won't bother continuing this path.

>video games, video editing, live video filters, data visualizations, Graphviz,
I get it.
>React
What would you do in webasm here? The virtual dom?
I considered writing some webasm datatstructure but it needs to read json and as far as I can tell you'd need to write your own json parser in rust/c and parse json(with maybe unicode values) which JS layed out in memory block. Huge pain.
Mozilla blogged about source maps in webasm but that is custom format they had.

>have to downgrade xamarin plugins to work because the latest ones are incomaptible versions of mono for older android api levels

heh.. microshit indeed, you were right

How can I open a textfile through stdin on C? There’s no actual function called stdin right?

stdin is standard input, user. You can't really do that within a programming language since stdin is first and foremost an operating system concept.

If you want to read data from a file through stdin then something needs to redirect to stdin. For example:

cat file.txt | your_program

Yama no Susume S3

Attached: 1534796851273.jpg (1280x720, 505K)

Yeah I thought so. As some cunt on Stack Overflow said LOL STDIN IS GLOBAL SO JUST PUT STDIN AS ARGUMENT LMAO
Do I just use fopen(file, “r”) instead then?

What are you trying to do? Just read a file? Then fopen() is the way to go, yes.

Read a file, then pass that file to fscanf to copy its content to an array

That seems fine?

Also, is the only way to access this filepath through a shell script is just using comman line arguments in main?(argc, argv)

To make it more clear:
I have an assignment where I make a shell script that will load a textfile through a path and pass it to a C program
First it will try to load from an environment variable, if not load from a command line argument, and if neither, it will prompt the user to enter it through stdin, which I assume is just using read.
Do I pass any of these as a command line argument to the C program or are there other ways to send the path to the C program?

Also how would I make the shell script skip eg the command line argument and input prompt if an environment variable exists and so on?

Attached: ED716DF4-474D-4A3D-BB87-11A280CDB55D.jpg (700x598, 39K)

Why can I access private inherited members in a derived class template in C++? I thought private members were not available to derived classes. Does the fact that they are templates have something to do with it?

I imagine the template was never instantiated