[Boards: 3 / a / aco / adv / an / asp / b / bant / biz / c / can / cgl / ck / cm / co / cock / d / diy / e / fa / fap / fit / fitlit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mlpol / mo / mtv / mu / n / news / o / out / outsoc / p / po / pol / qa / qst / r / r9k / s / s4s / sci / soc / sp / spa / t / tg / toy / trash / trv / tv / u / v / vg / vint / vip / vp / vr / w / wg / wsg / wsr / x / y ] [Search | Free Show | Home]

/dpt/ - Daily Programming Thread

This is a blue board which means that it's for everybody (Safe For Work content only). If you see any adult content, please report it.

Thread replies: 315
Thread images: 28

File: you wouldn't steal a car.png (119KB, 563x378px) Image search: [Google]
you wouldn't steal a car.png
119KB, 563x378px
What are you working on, /g/?

Previous Thread: >>61151312
>>
Did any of you ever start that programming puzzle/challange general that was talked about a few months ago?
>>
File: get rekt functional faggots.png (12KB, 577x129px) Image search: [Google]
get rekt functional faggots.png
12KB, 577x129px
>REMIND
>>
>>61156866
>programming puzzle/challange general
Link to archive?
>>
>>61156944
Has he even released TOS or HolyC to the world yet?
>>
>>61156944
cia african american
>>
>>61156457
Homoiconicity is Schemes greatest strength
>>
>>61156971
The source is available for download, as it always has been
>>
>>61157063
My language has a very similar syntax to lisp except I use {} instead of parenthesis because my parenthesis keys are broken
>>
>>61157077
Many Scheme languages allow you to use {} inplace of (). It in no way affects the simple beauty of Lisp.
>>
>modern compiler implementation in java
Ah yes, a fine read JBlow
>>
Should I write my web server in racket?
>>
File: pzwyjf.png (153KB, 1633x772px) Image search: [Google]
pzwyjf.png
153KB, 1633x772px
just relaxing,writing an irc bot plugin on a language i don't understand at all and listening to chill beats

good fridey night
>>
>>61157129
link? why does everyone here have a boner for blow
>>
>>61157257
its literally just been me shitposting for a few days.
https://www.youtube.com/watch?v=vMVGH2c_AVs
~1:18:00
>>
>>61157279
wait, are you the same guy who said that jai is DOA because jblow has a weird opinion on DRY?
>>
>>61157295
>weird
he says he doesnt believe in it, and yes.
>>
Web assembly will herald in a new future where C is compiled to WASM bytecode and sent to your web browser.

A new era in malloc bugs, off-by-1 segmentation faults and the extinction of reflection.

You've made your bed now sleep in it.
>>
my language does this:

push_ctx buf_size 128
do_stuff
pop_ctx buf_size


this basically makes buf_size act like a global variable but just between the push and pop instructions.

any criticism?
>>
>>61156951
Don't have it.

Couple of anons were trying to solve programming challenges on sites like codeforces.com or spoj.com, trying to bring down the time and space complexity of their solutions, making the solution as simple as possible, etc.. Loads of people were down on having a general just for this. A challenge gets posted in the thread, and anons attempt to solve it together. You learn a lot about different data structures, math, optimization, etc by solving these, but it's incredibly difficult.
>>
>>61157346
>C

web homosexuals will compile from rust, as they like cocs
>>
>>61157346
>Web assembly will herald in a new future
no it wont.
People arent going to port their house of cards node.base.
Webdevs dont care about optimization.
>>
What language should a person, who wants to make shitty programs for a hobby, learn? Not for job or money.
>>
what do you think about metaclasses
http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2017/p0707r0.pdf
>>
>>61157350
>global
Little out of your element, pajeet.
>>
>>61157402
>classes
>sepples
literally who cares
>>
New Modern Imageboard
>ReactJS frontend
>Imgur hosting
>Decentralized , DHT esque or IPFS based
>JASON API served by gin-gonic and stormdb

Y/N?
>>
>>61157397
python for web/quick projects/desktop applications/artificial intelligence/text processing/data processing
C for embedded
Assembly for reverse engineering/exploit developement/game hacking
Luajit+Love2D for 2d games
C++, unfortunately, for 3d games
HTML+CSS+Javascript+Python for web developement
>>
>>61157425
>>ReactJS frontend
>Decentralized
>jason
nah m9, im good
>>
>>61157456
Did you not see Modern?

If you want a classic board there's plenty. Or even just text board for you.

This is modern. Embrace it.
>>
>>61157402
uninteresting combination of generics, macros, d style mixins, reflection
>>
>>61157425
every part of this screams "a fucking meme" at me
>>
>>61157425
>>61157466
>Modern

The latest in meme technology, that's for sure
>>
>>61157436
I have been reading a lot how good is Lisp for learning how programming works. Should I get into that first?

I have basic knowledge of HTML and CSS so Python does seem a good choice for all around language
>>
>>61157466
there is nothing modern about json or JShit
>>
>>61157472
Its gonna be fun man. Its modern !
Iwant every autist to be able to start their own image board node with one command.
>>
>>61157485
What do you want? Raw Bytes? Or BSON?

Or a custom data structures?

Also ReactJS is nice for UIs
>>
>>61157480
>I have been reading a lot how good is Lisp for learning how programming works. Should I get into that first?
I personally didn't like lisp*. I liked the idea of it, and I seriously wish every language had a more lisp-like syntax, but after actually giving it a good try i really didn't like it.

*I actually tried chicken scheme and racket, not lisps, but the ideas should be similar
>>
>>61157521
I want JS to die, and all sites to stop using it.
Not sure, but I know json is ass and needs dropped as well
>>
>>61157540
I agree but there's nothing else that controls the browser DOM like JS.

Maybe Dart... But I think that compiles to JS.

What's wrong with JSON? What do you recommend?
>>
Benchmarking SDL2.
>>
>>61157558
>I agree but there's nothing else that controls the browser DOM like JS.
this "cant beat em,join attitude is why webdev is such a shitshow.
JSON is ugly and slow.
>>
>>61157532
So its a good idea or not?
>>
>>61157594

Dude I'm already using a NoSQL db and a Go webserver. I'm not joining any fad.

But yeah if not ReactJS I may look at Dart now.
>>
>>61157613
>Go
>not a fad
How can Rob Pike be so based and yet get something so fundamental wrong?
>>
hi /dpt/ if a young programmer wants to work as such what should he learn?
my guess is C something, java, javascript, amirite?
>>
>>61157627
Hes not writing C 2.0 for nerds

He's writing Python + C 2.0 for brainlets
>>
File: 1484183984106.jpg (65KB, 600x797px) Image search: [Google]
1484183984106.jpg
65KB, 600x797px
>>61157247
>winshit
>>
>>61157636

>java
if you want to be a code monkey
>javascript
If you want to be a web code monkey
>>
>>61157350
how does it handle recursion
>>
File: flask.png (72KB, 866x1514px) Image search: [Google]
flask.png
72KB, 866x1514px
First time in flask and whipped this up. It's very simple but i'd like to expand on it with a dynamic web-based ssh and other tricks.

How do people do web design changes today? About a decade a ago I was using dreamweaver for class, is it still used and viable? Any better alternatives?

Going to start pushing Flask for any gui related projects because fuck cx_freeze and pyqt clusterfuck.
>>
>>61157425
no one cares what technology you use to make it, just how good it is
>>
>>61157360
It sounds awesome. This should become a thing.
>>
>>61157636
You'll need familiarity with, in no particular order
C, it's used in everything
A basic primer in assembler (x86 or ARM)
An OOP "business" language, like Java, C++, or C#
A lisp-like language, like Scheme, Common Lisp, or Clojure
An ML derived language, like Haskell, F#, or Scala
A high-level scripting language like Python or Ruby or Perl or even VB.NET (it's gross but it gets a lot of use)
The native scripting language for your OS (PowerShell for Windows, Bash for everything else)
You'll also want to touch on SQL, Regular Expressions, and most likely at some point the languages of the Web (HTML, CSS, JS)

The important thing is not to pick one flawless language, but rather to choose a wide variety of tools, that you can adapt to different problems. If you pick one language from each of these categories, you should be well equipped for everything that can come at you. When it comes to picking a language from these categories, pick the language that is native to your system (if you're on Windows, stick with F# and C#)
>>
>>61157716
True. I may drop the decentralized part and just stick to traditional web protocols.

Welp here goes my Friday. Basically nextchan was good but was an unpolished piece of shit.
>>
Understand basics of C/or brush a bit on C++ and then go to python.
>>
>>61157697
I've been telling /dpt/ for years now that native applications are ded and web dev is the future.
>>
>>61157675
how does what handle recursion?
>>
I'm writing a streaming server that uses popcorn times scraping api to download and stream movie/shows according to a vote system.

The back end is complete, written in python. Any recommendations for a nice frontend webapp framework?

Right now im playing with flask, but I don't really like the template syntax.
>>
>>61157768
The only non-meme frontend framework is bootstrap
>>
>>61156820

Reminder that if you cast the return of malloc in C you need to reconsider your life choices.
>>
>>61157796
Why?
>>
>>61157346
no.
the next thing that will come is, you'll have a java interpreter made in web assembly, embedded in your browser
>>
>>61157775
Hey that's pretty nice lad, thanks.
>>
>>61157346

awesome
>>
File: gxcnxu.png (76KB, 1149x484px) Image search: [Google]
gxcnxu.png
76KB, 1149x484px
>>61157659
trickd u bro
>>
>>61157840
Every other web front-end framework comes and goes, like dust on the wind, but bootstrap remains
>>
>>61157828
>java
*haskell
>>
>>61157872
you tricked yourself by putting that shite on your machine.
>>
What are some projects to look at for good examples of "modern" C?
>>
>>61157953
>"modern" C?
doesnt exist.
>>
>>61157953
Looks the same as it always did, senpai.
>>
>>61157953
The most recent revision is 2011, and you still don't see many of those practices in people's code.
>>
>>61157978
>>61158013
>>61158046
Oh, come on. There must be some good examples out there of how to write readable, modern, secure C code
>>
>>61158158
Like I said, it looks the same as it always did. The same idioms that were used in C89 are used now. C is for Constant.
>>
>>61158013
>>61158167
>implying

if you're not using stdint these days, you might as well kill yourself
>>
>>61157319
God anon you're a moron. People are far too generalist all the time. It's so obvious. Who could possibly argue against that nowadays?
And computers need specialized solutions. JAI is the first language I see that actually offers you good ways to do this. An example that was brought up recently was hashmaps. They're an interface that can have lots of implementations behind them all for good reasons. Yet people insist on writing general code for them. If we're to have that we need the expressive power to preserve the interface to then while adding a convenient way to modify them to fit the special case. The modify proc (not a JAI expert, whatever lets you alter the function/struct body based on metaprogramming procedure calls) is the cleanest system I've seen for this.
It's trivial to reach any use case for the hashmap with no runtime cost. C++ can do it through templates. But just imagine writing a templetized hashmap that has key and value as pairs. An array of keys and arbitrarily allocated values. Values wrapped in any variety of smart pointers. A hashmap that allows you to invalidate keys while keeping the values in a way that's not horribly error prone. All of these variations is just not sensible to do in templates. You absolutely should go for external metaprogramming tools for that.

And even so, this is all assuming we need to _NEVER_ repeat ourselves. Its an extremist position that's poorly motivated. Having to put in code changes far and wide is bad. But DRY generally covers way more than those cases. You're encouraged to couple completely separate systems together just because a subprocess is similar (at the time of writing, not necessarily after maintaining/extending code).
>>
>>61158198
stdint is the ultimate reason why c89 is shit
>>
>>61158158
read the draft std
look at annex K
you can find the SEI CERT docs with google
stop using gets
>>
>>61157425
>>61157425

Rate:

type Board struct {
ID string
Owner string
ShortName string
}

type Owner struct {
Name string
Password []byte
Owns []Board
}

// There are no Users only posts
type Post struct {
Poster string // Namefagging
Avatar url // Avatarfagging
Anonymize bool // Default. Anonfagging
}

https://repl.it/JJQK/0
>>
>>61157953
Quake 3s GPLd source.
I don't think it's necessary pretty after the styling they've done for the open source release. But as for the actual code and systems it's great.
>>
>>61158253
>. But just imagine writing a templetized hashmap that has key and value as pairs.
i can already do this
>>
>mfw ree-tards say neural networks are the way forward in ai research
reminder that if planck's hypotheses are true the universe itself is a cellular automaton so technically cellular automata have already solved ai because there's us
>>
>>61158403
You're an idiot.
>>
>>61158283
Looks cancerous
>>
>>61158283
>
    Poster    string // Namefagging
Anonymize bool // Default. Anonfagging

just let an empty string be anonymous
>>
>>61157813
There's no point in doing it, you get the proper type from your lvalue.
>>
>>61158362
>stops there
Obviously writing one version is trivial. Writing all these versions (the list goes on) is going to be a proper mess. A hash map isn't even a complicated datastructure where there's many options. You've generally got two choices in how you store your values (buckets being common for a general implementation and other options being less common) and then you have a million ways to store your keys and values in relation to each other, different requirements on iteration. The list goes on. It's not a trivial implementation even with good facilities to help you. But it's completely doable with good facilities.

I personally haven't seen a generic hashmap implementation that covers a lot of these cases. People either decide not to go for it because it'd break their nice generalization or they make a specialized version.

I say JAIs DRY support is better than most languages. The stuff (that I sadly haven't seen demoed yet) about adding capture lists to blocks is amazing for DRY. Allows you to easily and safely move from an inline implementation to a function call implementation. Though Jblows focus seems to be on assisting with thread safety with that feature. Which is also good i suppose.
>>
>>61156971
>>61157075
The real question is, which (if any) non TOS compilers support Holy C? I want to use it outside of TOS.
>>
File: namefagging.png (5KB, 308x144px) Image search: [Google]
namefagging.png
5KB, 308x144px
>>61158283
>>61158461
>>
>>61157279
>no book coming out of academia is actually going to tell you what's a good idea when implementing a compiler
Wew. Shots fired, general academia.
>>61158624
>He doesn't compress his input data where the inputs would produce the same outputs
Not a good idea. You wish to limit inputs as much as possible. If you only accept 1 or 0 as input you give an error for everything else immediately. You don't pass it through your program and catch the error late.
Likewise here you should clear the string when the string is equal to the default string (assuming you don't want any special significance to inputting anonymous as the name, which I do all the time by the way, along with sage).
>>
>>61158669
>the same output
It's not the same.
>>
>>61158624
lol
>>
>>61158681
What is the intended output when you enter the same name as the default name?
>>
>>61158696
One is namefagging and one isn't
>>
>>61158700
>internal transform detail
So what's the output?
>>
>>61157425
Just fork meguca.
>>
>>61158686
>ads
wtf faggot?
>>
>>61158711
I just told you.
One of them is namefagging and one isn't.
>>
>>61158724
There are ads on 4chan. Where is the problem?
>>
>>61158744
As output? But it has the identical output in terms of bitwise comparison. How are these different outputs?
>>
>>61158762
Are you retarded?
One is namefagging and one isn't.
>>
>>61158757
Why are you not using an adblocker? Also why not 4chanx? Are you a faggot?
>>
>>61158799
>using an adblocker
2 reasons
1) they're useless, I have a permanent adblocker, it's called my brain
2) they broke a lot of websites
>4chanx
What does it do?
>Are you a faggot?
You're interested?
>>
>>61158794
Where is that visible in the output? I don't see it.
>>61158852
>adblockers break websites
It's not 2004 gramps
>>
What is the correct way to run a program inside a C++ program?
I am currently using popen, but I may need to shut the program down fast and with popen, I can only do that if the program prints something.
It doesn't have to work on anything else than linux if this makes it easier.
>>
>>61158852
You really are a retard, huh?
Adblockers, increase the speed of page loading, save your bandwidth, save your memory and protect you from tracking.

>2) they broke a lot of websites
You must really try hard for that.

>What does it do?
Good things
Also check out oneechan.

>You're interested?
Yes, I need to rest my cock somewhere comfortably. Both anuses and mouths are fine.
>>
>>61158887
>i cant tell the difference so it doesnt exist!
you'd end up designing systems where users named "guest" are treated like non users
>>
File: 1481460001803.jpg (72KB, 960x656px) Image search: [Google]
1481460001803.jpg
72KB, 960x656px
Quick /dpt/, give me a summer project that isn't shit and is interesting
>>
>>61158909
posix_spawn
>>
What do people dislike about Python?
>>
>>61158951
I don't have the time to explain
>>
>>61158910
>increase the speed of page loading
No. Only on shitty websites, and I don't go there.
>save your bandwidth
Don't give a fuck.
>save your memory
What are you talking about?
              total        used        free      shared  buff/cache   available
Mem: 15G 2.0G 7.6G 588M 5.5G 12G

>Good things
That's not the kind of answers I was waiting for.
>I need to rest my cock somewhere
Sorry, my wife doesn't want me to have sex with men.
>>
>>61158976
Awesome, thanks
>>
>>61158917
>there's no way to tell the difference
OK cool anon so basically you're wrong. Good chat.
>>
>>61159008
YOU can't tell the difference.
>>
>>61158977
>No. Only on shitty websites
Like 4chan

>What are you talking about?
So you enjoy wasting memory, huh?

>he ignored the point about tracking

>Sorry, my wife doesn't want me to have sex with men.
I am fine with her vagina then, you can watch too.
>>
File: 1474230584330.png (65KB, 1092x1037px) Image search: [Google]
1474230584330.png
65KB, 1092x1037px
>>61158924
>tfw no one gives me a (You)
>>
>>61156820
what anime/episode is that pic from
>>
>>61158283
Commit #2
https://repl.it/JJTe

You can now run it
package main

import "fmt"

type Board struct {
ID string
OwnerID string
ShortName string
Anonymize bool // No namefagging
}

type Owner struct {
ID string
Name string
Password []byte
Owns []Board
}

// There are no Users only posts
type Post struct {
Poster string // Anon/Namefagging
Avatar string // Avatarfagging
Message string
Anonymize bool // Always return Anonymous; override or use board default.
}

func NewPost(Name, Avatar, Message string, Anonymize bool) Post {
n := Post{Name, Avatar, Message, Anonymize}
return n

}

func (bp *BoardPost) GetName() string {
if bp.Board.Anonymize || bp.Post.Anonymize {
return "Anonymous"
} else {
return bp.Poster
}
}

type BoardPost struct {
Board
Post
}

func NewBoardPost(board Board, post Post) BoardPost {

n := BoardPost{Board: board, Post: post}
// save to database here
return n
}

func (bp *BoardPost) String() string {
return fmt.Sprintf("[%s]\t %s: %s", bp.ShortName, bp.GetName(), bp.Message)
}

func main() {
o := Owner{"uu", "meep", []byte("sexytime"), nil}
b := Board{"fiddlemedotter", o.ID, "test board", true}
p := NewPost("bearpolice", "bear.gif", "No Poo in forest", false)
x := NewBoardPost(b, p)
fmt.Println(x.String())
}
>>
>>61159019
Did I post with or without name now?
Pick which posts I posted with name and which I posted without.

If you can't tell either then tell me who can?
>>
>>61157346
>Running random blobs in your browser
>>
>>61158924
>>61159034
Secure distributed peer to peer messaging application that does not suck.
>>
>>61156820
I've fallen for the C meme so I've been doing some exercises to learn the language. So far so good, I guess.

Here's a cosine implementation (the n variable is a measure of accuracy, type 20 < or something to get an accurate result).
float
cosine(float x, int n)
{
float sum = 1;
for (int i = 2*n; i > 0; i -= 2)
sum = 1 - x * x * sum / i / (i-1);
return(sum);
}
>>
>>61159063
>can't tell in one case
>can't tell in all cases

I am namefagging right now
>>
>>61159051
>non-diff commits
Disgusting
>>
File: images.jpg (4KB, 225x225px) Image search: [Google]
images.jpg
4KB, 225x225px
>Job description: Consultant

what the fuck is this?

programmer consultant?
>>
>>61159085
Adding git soon when I split the structs into different files
>>
>>61159034
here's a (You).
also here's a serious project. make a programming language. i know, sounds really hard, but it's not.

step 1. follow a "make your own lisp tutorial": even if you don't want to make a list, i sure don't, you'll learn about the basics of lexing, parsing and naive interpreters. make sure to find a tutorial that uses handwritten lexers and parsers. that's what actual compilers use and they are arguably easier that lexer and parser generators.

step 2: read about manual type checking. you'll basically do the same thing as recursive descent manual parsing that you learned in step 1.

step 2.1: learn about symbol tables. very simple but compiler books are lacking in this. google is your friend, there are tons of easy explainations on this.

step 2.2: whenever you are stuck on something, google.

step 3: open a bunch of projects in your favourite language and see everything they are doing. think about what features they are using you want in your language and what you might want to solve differently.

step 4: have fun

it's really not that hard and a lot of fun. the feeling when you get a program written *in your own language* to run is incredible
>>
>>61159079
So you can only tell yourself. But it's not based on the output of the program so what's the point?
>>61159093
There's tons of softare consultancy. Usually it's about correcting pajeets ideas that have infected the company or working on a specific system where the company doesn't have the competency required (you might be tasked with optimizing a system for instance).
>>
>>61159112
>the basics of lexing, parsing
>lisp
no
>>
File: java.jpg (68KB, 651x400px) Image search: [Google]
java.jpg
68KB, 651x400px
I took a class on this, and all I got out of it is that it's one giant meme. The teacher also sucked. Is it worth it to learn, or are there better alternatives?
>>
>>61159133
You view everything in terms of what you can immediately know.
You have the mentality of a child.
>>
>>61159143
Java is made so a hundred pajeets can slave away at a project without really understanding what they're doing and arriving at a working product.
It's good at that.
>>
>>61159135
yes, friend. whether you have a couple of tokens or half a dozen, and whether your grammar is a couple of lines or a hundred, an handwritten recursive descent parser - what any real compiler uses - is the same.
>>
>>61159158
Anon you're gonna have serious security issues if you keep this attitude to inputs.
>>
>>61159143
Pajeet meme
>>
>>61159178
>storing whether or not someone is namefagging is a security issue
holy shit
is this your attempt at a defense?
>>
>>61159160
I don't think that strategy even works desu. Do you have any examples?
>>
File: old_hag_langs.png (173KB, 600x355px) Image search: [Google]
old_hag_langs.png
173KB, 600x355px
ωth for C.
>>61159077
Does that implementation run faster than just straight summation? Looks like there's a lot of multiplication going on, thought I guess you don't need a factorial in this case.
>>
>>61157247
sounds comfy
>>
>>61159191
>Anon you're gonna have serious security issues if you keep this attitude to inputs.
Basically you don't understand this sentence. That's amazing. The claim isn't about storing whether or not you store that.
>>
>>61159219
you must be sweating profusely in order to make these kind of replies

there is a difference between namefagging as anonymous and not namefagging

it is an important detail

the reason you don't care is because you think namefagging and tripcodes are the norm

because you are from reddit
>>
File: r8.png (225KB, 2160x1440px) Image search: [Google]
r8.png
225KB, 2160x1440px
/dpt/ r8 my cornwell's game of life implementation
https://pastebin.com/7fFdE0pd
>>
>>61159022
>Like 4chan
4chan is one of the best made website. It loads very fast.
>>
>>61158924
>make a (model of) a device that automatically calls the cops if the customer leaves their babby in car.
>have brown skin
>???
>
>>
>>61156820
I am a young and inexperienced programmer. What should i do to develop my skills? What jobs (paid or unpaid) are available to me?
>>
>>61159203
It runs much faster. I basically applied Horner's method to the cosine power series.

https://en.wikipedia.org/wiki/Horner%27s_method
>>
>>61158716
this is pretty neat thanks
>>
>>61159258
0/10 it's a still picture it should move
>>
>>61158924
Write a GUI that takes in a Jone's polynomial and outputs a graph of a knot with that polynomial as its knot invariant up to isotopy.
>>
>>61157562
did that a long time ago, kek.
>>
>>61159300
If you're good enough to pass a coding interview, then you should be set as far as jobs are concerned. Work on projects and challenges to develop your skill.
>>
Why, in Python 2.7 can I use self.instancemethod() to access my instance methods, but not cls.classmethod() to access my class methods?
>>
>>61157562
Is this software render?
>>
>>61159403
>Work on projects and challenges to develop your skill.
Such as? Where will i find such projects and challenges?
>>
>>61159475
I'm not sure. But technically I use hardware acceleration.
>>
Hi /g/,

I stumbled upon this piece of old C code. I was just taking a look at the source code of SPICE3 (electrical circuit simulation program) and I saw a function call for
tmalloc()
, looked it up and found this program module.

Sadly I do not know enough C nor dynamic memory management to understand what the author tried to achieve with this code. Replacement for
malloc()
?

Here's the pastebin link, in case the code is too long to fit to /g/: https://pastebin.com/V3gzzGfs

/* This source code is in the public domain. */

/* tmalloc.c: Tray memory allocator */

#include <stdio.h>
#include <sys/types.h>
#include "vt.h"

typedef long Align;
typedef union tlist {
union tlist *next;
Align a;
} Tlist;

#define TRAY_INC sizeof(Tlist)
#define NUM_TRAYS 4
#define MAX_USE_TRAY (NUM_TRAYS * TRAY_INC)
#define TRAY_ELEM 512
#define TRAY_SIZE (TRAY_ELEM * TRAY_INC)

static Tlist *trays[NUM_TRAYS];

char *tmalloc(size)
size_t size;
{
int t, n, i, max_elem;
char *p;

if (size > MAX_USE_TRAY)
return malloc(size);
t = (size - 1) / TRAY_INC;
if (!trays[t]) {
n = t + 1;
trays[t] = (Tlist *) malloc(TRAY_SIZE);
if (!trays[t])
return NULL;
max_elem = TRAY_ELEM - 2 * n;
for (i = 0; i <= max_elem; i += n)
trays[t][i].next = &trays[t][i + n];
trays[t][i].next = NULL;
}
p = (char *) trays[t];
trays[t] = trays[t]->next;
return p;
}

void tfree(ptr, size)
char *ptr;
size_t size;
{
int t;

if (size > MAX_USE_TRAY) {
free(ptr);
return;
}
t = (size - 1) / TRAY_INC;
((Tlist *) ptr)->next = trays[t];
trays[t] = (Tlist *) ptr;
}

char *trealloc(ptr, oldsize, newsize)
char *ptr;
size_t oldsize, newsize;
{
char *new;

if (oldsize > MAX_USE_TRAY && newsize > MAX_USE_TRAY)
return realloc(ptr, newsize);
new = tmalloc(newsize);
memmove(new, ptr, oldsize);
tfree(ptr, oldsize);
return new;
}


>>
How do I git gud at .net?
>>
>>61159588
The readme says it's simply a malloc implementation with thread-local allocation. What's the problem?
>>
>>61159603
Use something else.
t. Windows user and hater
>>
>>61159603
Why not Java?
>>
who else integrate?

double
integrate(double (*f) (double), double a, double b, double epsilon)
{
double low_sum, high_sum;
low_sum = high_sum = 0;
for (double i = a; i < b; i += epsilon) {
low_sum += ((*f)(i) * epsilon);
high_sum += ((*f)(i+epsilon) * epsilon);
}
return((low_sum + high_sum) / 2);
}
>>
How to transition from a beginner to intermediate stage? It feels like most resources online only teach basic syntax and how to create generic as fuck programs. Once I'm done with a book, I feel helpless.
>>
>>61158934
>posix_spawn
this prints the program output directly, with popen, I could get the program output.
>>
>>61159631
a lot of stuff to do for money around me with .net platform, from webshit to various desktopshit. I'm a c++ programmer myself thou
>>
>>61159320
Try linear interpolation method
>>
>>61156820
int main(){
cout<<"is this how seeplusplus?"<<endl;
}
>>
>>61159641

as soon as I posted I found a simpler/faster method

double
integrate(double (*f) (double), double a, double b, double epsilon)
{
double sum = 0;
for (double i = a + epsilon; i < b; i += epsilon)
sum += ((*f)(i) * epsilon);
return(sum + epsilon * ((*f)(a) + (*f)(b)) / 2);
}
>>
HOW TO START A WAR:
C++ vs. Java.
>>
>>61159652
The same goes for Java. In my country at least.
Maybe you could help out the OpenRA project.
>>
>>61159656
>linear interpolation method
that'd probably be faster but it would be a ton more work...
>>
>>61159702
they have different use cases, this is a stupid question

You should be comparing Java and C#
>>
Ask a programmer that only listens to rap music while programming anything
>>
why did it have to be javascript that won the browser war? why!?!?!?
>>
>>61159781
believe it or not, the alternatives were worse
>>
>>61159702
x(kc)D
>>
>>61157597
try it and see how you like it
>>
so what is the purpose of rust?
what niche is it supposed to fill?
>>
>>61157746
Native DESKTOP applications are dead, but hilariously even though mobile devices split users straight down the middle between platforms and webapps would be absolutely ideal, everyone still wants a shitty
wrapper installed on their device that gets everything for them.

So now we have the worst of both worlds, multiple platform GUIs written in shitty languages, meaning fucktons of boilerplate to connect to a useful language to do the real work.
Even if you like Java or Swift, neither is gonna help you when porting to the other side, so you're basically forced to use C/C++ either fucking way in some form given any substantial project.
>>
>>61159834

C++ replacement.
>>
>>61159781
imagine it being (((scheme)))
>>
>>61159836
>Native DESKTOP applications are dead
No there the future. We will have reliabe kernel, and we will start to distribute binaries on website. JS is just the transitional step.
>>
>>61159872
s/there/they're/
>>
>>61159834
C++ with built-in valgrind.
>>
>>61159603
Have you already read the Yellow Book?
>>
>>61159834
Its trying to turn C++ into Haskell
>>
>>61159834
memory safe programs where garbage collection doesn't cut it
>>
>>61160252
Is it all just compiler restrictions and static analysis? Why not just use C/C++ with tools?
>>
>>61160292
to not have do deal with false negatives/positives I guess
>>
>>61159641
>(*f)(i)
you could write that as
>f(i)
>>
The question is why rustfans are so euphoric about it, its just a language
>>
>>61160131
will look into it, thanks
any advanced resources?
>>
File: ran_tewi_wink.png (82KB, 350x238px) Image search: [Google]
ran_tewi_wink.png
82KB, 350x238px
>>61159692
>rectangle rule
t. Dr. Tai
>>
>>61160374
Because all rustfans are paid shills.
>>
>>61160369

Does that work as a parameter?
>>
>>61160391
Honestly, once you get the basics and some of the "fun parts" learned, you should go straight to making things. You're going to learn much more, much faster, if you break big things down into small problems and research the correct way to solve those problems.

Remember that programming is a tool to accomplish something based on other knowledge and skills. Being able to intuitively use a programming language and it's ecosystem of dev tools to solve real-world problems is where you want to be.
>>
>>61159692
This seems to overestimate:
integrate(f(x) = 1, 0, 1, 1) // 2
>>
>>61160374
They consider Rust to be a political tool.
>>
>>61160374
https://github.com/rust-lang/rust/issues/41646
>>
>>61160374
Rust is like the GPL, people don't use it, they just advocate for it.
>>
>>61160622
This. Who uses the Linux kernel anyway?
>>
>>61160653
Your joke doesn't even make sense, wtf.
>>
>>61156820
What's the best way to get into programming?
>>
>>61160672
His claim doesn't even make sense, wtf.
>>
>>61160679
Who's claim? What are you talking about. Are you high or just a non-native speaker?
>>
>>61160689
Did you just assume my country of origin?
>>
>>61160700
No, why would you even think that?
>>
>>61160706
You racist bigot.
>>
Best free cross platform library for creating windows and GUIs that's C-friendly?
>>
>>61160716
It's best not to make assumptions on what people intend if you don't understand the language properly. What's your native language, I might speak it, if I do I can explain this better to you.
>>
>>61160473
Works for me. (poorly coded)
#include <math.h>
#include <stdio.h>

double integrate (double (*f) (double), double a, double b, double eps) {
double s;
double x1;
double x2;
s = 0.0;
x1 = a;
loop:
x2 = x1 + eps;
if (x2 > b) {
s += (b - x1) * (f (x1) + f (b)) / 2.0;
goto end;
} else {
s += eps * (f (x1) + f (x2)) / 2.0;
x1 = x2;
goto loop;
}
end:
return s;
}

double constant1 (double x) {
(void) x;
return 1.0;
}

double pi;

double integrated_sin (double x, double eps) {
return integrate (cos, 0.0, x, eps);
}

int main (void) {
double x;
pi = acos (-1.0);
for (x = 0.0; x < pi; x += 0.01) {
double tst_sin;
double cpu_sin;
tst_sin = integrated_sin (x, 0.000001);
cpu_sin = sin (x);
printf ("%f %f %f\n", cpu_sin, tst_sin, log (cpu_sin / tst_sin));
}
return 0;
}
>>
>>61160752
Did you just assume my metal condition?
>>
>>61160749
electron
>>
>>61160749
Pretty sure the only real options are wxWidgets, Tk, Gtk, and maybe nuklear. Maybe there's some less well known ones.

>>61160761
I'm saying you're making assumptions on what other people are saying but you're incorrect in your assessment. What is your native language?
>>
>>61160789
Nationality is a social construct.
>>
>>61160795
False
>>
File: spine2d.gif (2MB, 343x537px) Image search: [Google]
spine2d.gif
2MB, 343x537px
How do program like Spine or Cubism do the 3d looking animation from 2D sprites (pic related)? Are there any papers on how that kind of thing works/what algorithms are used? Are there any open-source implementations of something similar that i could take a look at?
>>
>>61160808
Stop mansplaining me.
>>
>>61160795
I'm asking what your first language was, not where you come from. Stop being so defensive, I couldn't care less about where you're from I'm just trying to clarify my statement for you, I think it would be easier if you can't understand English. Run this through a translator at least.
>>
>>61160825
Did you just assume me not being from an English speaking country?
>>
File: 1496198005995.png (127KB, 601x508px) Image search: [Google]
1496198005995.png
127KB, 601x508px
I need help with doing programming problems on sites like spoj. The thing is I'm self taught and have been programming for 10 years now, so I know a lot about programming, but I just don't understand the questions on spoj, they don't make any sense to me no matter how many times I read over a problem I just don't know what it's trying to tell me to do. Is there some trick to understanding the questions or something?
>>
>>61160837
Where you are is irrelevant, what languages you speak is what I'm trying to find out.
>>
>>61160850
Stop harassing me.
>>
at this point i honestly prefer unironically s-jew places over having to suffer thru ironic sjwisms
>>
>>61160920
did you just assume my irony level?
>>
>>61160931
end your life
>>
>>61160920
You might be right. I shouldn't give people the benefit of the doubt.
>>
>>61159258
the more pythonic version
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include <unistd.h>
int main(int argc, char **argv) {
srand(time(0)*getpid());
unsigned const rainbow[6] = { 4, 6, 2, 3, 1, 5 },
width = 50, height = 50,
stability = 10000, seam = 2,
nminlive = 2, nmaxlive = 2,
nminnew = 3, nmaxnew = 8,
delay = 60000, fresh = 60;
unsigned seaming = 0,
grid_a[width*height],
grid_b[width*height],
*grid_w = grid_a;
unsigned const *grid_r = grid_b;
for (unsigned i = 0; i < width*height; i++) {
grid_a[i] = 0; grid_b[i] = 0; }
for (;;) {
for (unsigned y = 0; y < height; y++) {
for (unsigned x = 0; x < width; x++) {
unsigned n = 0, f = grid_r[y*width + x],
*g = grid_w + y*width + x;
printf("%c[3%d;1m%c%c", 0x1b, rainbow[(f*6/fresh)%6],
(f ? '#' : ' '),
(x == width - 1 ? '\n' : ' '));
for (unsigned i = 0; i < 9; i++) if (i != 4) {
unsigned nx = (x + i%3 - 1 + width)%width,
ny = (y + i/3 - 1 + height)%height,
j = ny*width + nx;
if (grid_r[j]) n++; }
if (f && (n > nmaxlive || n < nminlive)) *g = 0;
else if (!f && n >= nminnew && n <= nmaxnew) *g = fresh;
else *g = (f ? f - 1 : 0);
if (seaming) {
*g = (f ? 0 : fresh);
if (!(rand()%seam)) seaming = 0;
} else if (!(rand()%stability)) seaming = 1; } }
clock_t then = clock();
while (clock() - then < delay);
printf("%c[0m%c[%dA%c[%dD", 0x1b, 0x1b, height, 0x1b, width);
if (grid_r == grid_a) {
grid_w = grid_a;
grid_r = grid_b;
} else {
grid_r = grid_a;
grid_w = grid_b; } } }
>>
File: 1409939538441.png (72KB, 475x507px) Image search: [Google]
1409939538441.png
72KB, 475x507px
>when you make a reading comprehension mistake and backpedal for several posts
>>
>>61160845
Can you give an example post and your assumed understanding of the problem?
>>
>>61160991
literally any problem, I don't understand at all
>>
>>61160952
I was just shitposting. Anyway...
>Rust is like the GPL, people don't use it, they just advocate for it.
That might be true for Rust, but I disagree on the GPL part. For instance, the Linux kernel is licensed under the GPL.
>>
>>61160845
If you're self-taught you probably never studied any computer science theory or higher math and that's what you're missing. I took a look at some problems there and it's mostly discrete math or graph theory problems in there so that's mainly what you want to read up on. But I'm sure there can be problems from other fields and sometimes these fields intersect so if you want to get into it you might want to also check out mathematical analysis, linear algebra and maybe even some statistics. Math/CS is surprisingly interesting and learning it gives you a broader perspective on programming which most self-taught programmers lack.

For resources, generally check out some open courseware from MIT they have very good lectures but there's also a ton of books on this stuff(for math you want to actually try and solve problems, that's how you really understand the theory) and even wikipedia often has very readable articles on these things including code examples.
>>
>>61161034
You seriously wasted my time just because I have patience to deal with international posters? People who say the quality drop during summertime isn't real are kidding themselves. This site really is the pits anymore, every board treats posting like it's some kind of game to garner attention, fuck this, that's just like Reddit. I am in such a sour mood now.
>>
>>61161087
You should blame yourself. The shitposting was too obvious, even by 4chan standards.
>>
>>61161143
Yeah I'm going to blame myself for your dumb antics while under the impression you don't understand English, real obvious. Why even act like that at all, you wasted my time, your time, and managed to chaff up the thread, for no reason other than you can't read. I seriously can't imagine what would drive someone to act like this, and you do it again with your stupid Linux remarks after admitting to it. Fuck you and everyone like you, if you want to meme it up for points why not just return to reddit instead of spewing your garbage here?
>>
I'm trying to get the hang of C++ basics by doing some project Euler problems. How efficient is this problem to find the largest palindrome of the product of three digit numbers?

int largest = 0;

for(int i = 100; i < 1000; i++){
for(int j = 100; j < 1000; j++){
if(isPalindrome(to_string(i*j))) largest = (i*j > largest)? i*j : largest;
}
}
cout << "The largest palindrome is " << largest;
>>
>>61161227
>reddit
it's more likely to be goons
>>
>>61160609
>https://github.com/rust-lang/rust/issues/41646
so much discussion on literally nothing
jesus christ
>>
>>61160953
Mine is better
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include <unistd.h>
int main(int argc, char **argv) {
srand(time(0)*getpid());
unsigned const rainbow[5] = { 4, 6, 2, 3, 1 },
colors = 5,
width = 40, height = 40,
stability = 20000, seam = 4,
nminlive = 2, nmaxlive = 2,
nminnew = 3, nmaxnew = 8,
delay = 50000, fresh = 50;
unsigned seaming = 0,
grid_a[width*height],
grid_b[width*height],
*grid_w = grid_a;
unsigned const *grid_r = grid_b;
for (unsigned i = 0; i < width*height; i++) {
grid_a[i] = 0; grid_b[i] = 0; }
for (;;) {
for (unsigned y = 0; y < height; y++) {
for (unsigned x = 0; x < width; x++) {
unsigned n = 0, f = grid_r[y*width + x],
*g = grid_w + y*width + x, h = 0;
printf("%c[3%d;1m%c%c", 0x1b,
rainbow[colors - 1 -
(f ? f - 1 : f)*colors/fresh],
(f ? '#' : ' '),
(x == width - 1 ? '\n' : ' '));
for (unsigned i = 0; i < 9; i++) if (i != 4) {
unsigned nx = (x + i%3 - 1 + width)%width,
ny = (y + i/3 - 1 + height)%height,
j = ny*width + nx;
if (grid_r[j]) n++;
if (grid_r[j] > h) h = grid_r[j]; }
if (f && (n > nmaxlive || n < nminlive)) *g = 0;
else if (!f && n >= nminnew && n <= nmaxnew)
*g = (h ? h - 1 : 0);
else *g = (f ? f - 1 : 0);
if (seaming) {
*g = (f ? 0 : fresh);
if (!(rand()%seam)) seaming = 0;
} else if (!(rand()%stability)) seaming = 1; } }
clock_t then = clock();
while (clock() - then < delay);
printf("%c[0m%c[%dA%c[%dD", 0x1b, 0x1b, height, 0x1b, width);
if (grid_r == grid_a) { grid_w = grid_a; grid_r = grid_b; }
else { grid_r = grid_a; grid_w = grid_b; } } }
>>
>>61161238
dont convert to string,
decrement i and j so you can break early when current product is smaller then largest found number
and skip multiples of 10 for i and j.
unroll the for loop a few times
>>
>>61160609
>select a term to force the user to feel guilt and enforce a good practice
>it hurts someones feefees
>remove it
I can't take this seriously.
>>
>>61161227
No offense, but are you a woman?
>>
>>61161081
Meh, that's disappointing, although I've always understood math easier than others I'm not interested in it at all, I thought competitive programming would be for programmers that want to come up with interesting solutions to problems but the way you put it sounds like it's for math people that want to learn programming.
>>
I am trying to learn C via The C Programming Language (2e) and everything was going fine until i got to text IO.

I think i'm starting to get it, but i have a couple questions:

On page 16 the author provides an example program that copies input to output. Here is the code: https://hastebin.com/ecarogivum.cpp

It then says:

"What appears to be a character on the keyboard or screen is of course, like everything else, stored internally just as a bit pattern. The type char is specifically meant for storing such character data, but any integer type can be used. We used int for a subtle but important reason. The problem is distinguishing the end of the input from valid data. The solution is that getchar returns a distinctive value when there is no more input, a value that cannot be confused with any real character. This value is called EOF, for "end of file". We must declare c to be a type big enough to hold any value that getchar returns. We can't use char since c must be big enough to hold EOF in addition to any possible char. Therefore we use int."

I don't understand why we use int as opposed to char. Doesn't getchar() return 0 when it gets to the end of the string (or should i say stream?)? If EOF really is 0, why is that too big to put in a char? Any help would be greatly appreciated.
>>
>>61161238
Why not start at 999 for both counters? Then you decrease said counters and stop the moment you find a palindrome. Or am I interpreting something about the problem wrong?
>>
>>61160609
>we can't use #[allow(bad_style)] because it says BAD! and that might SHAME somebody! delete it!!!
This could be god's chosen language with better performance than C and more libraries than Python and I still wouldn't fucking touch it
>>
>>61161439
No, EOF is not 0. It's actually usually a 32-bit negative 1.
The trouble is that the null character can't be used as EOF, because while strings are null-terminated, files aren't. A file can contain any valid character, including a null character, and many files do contain null characters, especially if they aren't plain text files.
>>
>>61161425
Have you ever studied discrete mathematics or modern algebra? You might check them out if you have time.
>>
>>61161466
>he hates sjws more than he loves god
this is why american """""""""""christian""""""""""" values need reform
>>
>>61161081
Do you have any recommendations on which courses are valuable? Mathematics seems very broad so I'd like to know what parts of it are most commonly applied when programming.

>>61161425
I always wonder why so many renown programmers are math wizards, I just don't understand where they're using it or what they're using it on. I've written a good amount of programs and I feel like an imposter or something for not being a math wiz, it feels like I'm masquerading.
>>
>>61156820
Might be finally getting around to that game engine refactor i've been meaning to do for the past month this weekend.
>>
>>61161439
To add to >>61161489, a signed short would have also been suitable for storing EOF, but it turns out an int is better regardless, because int is supposed to refer to whatever is the most efficient integer type on the target architecture.
>>
>>61161466
>This could be god's chosen language with better performance than C and more libraries than Python and I still wouldn't fucking touch it
Literally this, I don't trust the management to not fuck up huge somehow over something trivial, which is a damn shame because I like the concepts behind Rust but I will never touch it unless it goes into the hands of a responsible team that cares more about the language than about random people.
>>
>>61161517
Use this

fac.ksu.edu.sa/sites/default/files/131_book_transition_to_advanced_mathematics.pdf
>>
Do updates to gcc give any benefit when using it to compile for dead platforms? Every update brings optimizations, but are those optimizations platform dependent, or would I get any benefit from them if I were compiling for something like, m68k, which probably isn't seeing much work targeting it specifically.
>>
>>61160473
hmmm, I just tried it out and it worked for me. Idk why its not working for you.

In general, the last parameter, epsilon, should be very small, say 0.00001. You had it at 1. (I tried it with 1 and it still worked fine though).
>>
>>61161466
To be fair, "because it says BAD!" is a pretty good reason to remove something from a language, regardless of anyone's feelings.
A programming language ought to be impartial. It's there to provide functionality, not express an opinion. The difference between good and bad style should be emergent, not dictated. It's good style if it facilitates using the language, and it's bad style if it causes problems in that regard.
>>
>>61161581
I initially thought that was going to be 131 required books to transition. Thanks for the recommendation.
>>
>>61160675
K&R or SICP or Python
>>
>>61159517
project euler has challenges
r/dailyprogrammer has challenges
I found a free book called "Programming Challenges" by skiena and revilla, google it

You need to use your own imagination too. What do you find interesting? What would be a practical tool to have on your computer? etc. etc.
>>
File: 1494396236166.png (93KB, 942x739px) Image search: [Google]
1494396236166.png
93KB, 942x739px
>>61161624
So you find this acceptable formatting for java code?
>>
>>61161624
Except that wasn't the issue. The issue was how to PC-ify bad so it wouldn't trigger people while still retaining the idea of an enforced style.
>>
>>61161489
yikes i wasn't even aware I was dealing with files.. but sure enough the section says 1.5.1 File Copying. So is a file created when getchar() is called, and then the string the user enters is stored in the file?
>>61161547
>signed short
I apologize but i'm not even sure what that means. I know a short is a type of integer, but i'm not familiar with any type being signed. should i know much about computer architecture before learnign this? I feel as though i don't know near the prerequisites of computer hardware / operating systems when i read this.
>>
>>61161733
No. I don't.
See: >>61161624
>It's good style if it facilitates using the language, and it's bad style if it causes problems in that regard.
That's bad style.
But I would object to the fact that it's bad style being worked into the next Java standard.
>>
>>61161584
I think it depends mostly on where the optimizations are, there can be optimizations in the parser which doesn't effect generated code but there can also be optimizations to the intermediate representation which in turn would still benefit the machine dependent output. I'm not positive but I believe most optimizations today are going to be machine dependent, "we figured out how to do pattern x faster on arch y using exclusive opcodes z".

I honestly have no idea though, that's real wizard shit.
>>
>>61161627
Nope. its a relatively succinct, clear introduction to everything you will need to know. It is what I used, I hope it helps.
>>
>>61160369
Thanks for the tip. I haven't reached function pointers yet in K&R; that style was the first thing that came up on google
>>
What's your goto "code artisan" alias? Mine is programming magician.
>>
File: Ruby_on_Rails.png (107KB, 791x1024px) Image search: [Google]
Ruby_on_Rails.png
107KB, 791x1024px
I'm completely new to webapps development. Is this a good starting point? Or should I be starting with something more "lower-level"?
>>
>>61161825
This is understandable. It's not obvious but function calls get "promoted" to function pointers in C. This makes that language actually "functional"..
>>
>>61161826
Algorithm youkai
>>
>>61161841
It's really simple to use imo and make functional stuff fast and if you're not Amazon you won't feel the limitations. You can check what >>>/g/wdg/ thinks about it too and hope you don't get memed to death
>>
>>61161872
I feel retarded for missing that general. Thanks Anon.
>>
>>61161755
>So is a file created when getchar() is called, and then the string the user enters is stored in the file?
Kind of. The file is already there. I don't know what it would be on Windows, but on Linux, it's called /dev/tty, and the handle getchar() uses for it is called stdin. The terminal is kind of like a text editor that always has /dev/tty open. When getchar() is called, the program waits for more text to be available from /dev/tty at the current position within the file (usually the end, unless someone has typed more than you needed them to) and consumes one character of that text, advancing the position within the file in the process.
>I apologize but i'm not even sure what that means. I know a short is a type of integer, but i'm not familiar with any type being signed.
Types can be signed, which means they can be positive or negative, or they can be unsigned, which means they can only be positive but can represent twice as many positive numbers.
>should i know much about computer architecture before learnign this? I feel as though i don't know near the prerequisites of computer hardware / operating systems when i read this.
Don't worry about it, you'll pick it up. For programs that don't have to be high performance it's usually a non issue anyway.
>>
I'm a bored student, what are my options? Where can i find some neat projects to perhaps give a hand? is joining some modding team a valuable way to acquire experience? Is it worth it?
>>
>>61161910
thank you so much
>>
>>61161755
>I feel as though i don't know near the prerequisites of computer hardware / operating systems
I write embedded OS for a living and even I feel so from time to time.
>>
>>61161938
make an application that can predict stock market values
>>
>>61161755
signed and unsigned are just ways of interpreting a significant bit in a byte, unsigned uses the bit as typical storage for binary values and unsigned uses that same bit to indicate "signedness" which is basically the direction or negation.

A char is 1 byte, so you can fit up to the number 255 inside it in binary, but you could also use 1 bit to indicate "signedness", if the bit is 0 the number is interpreted as positive, if it's 1 it's interpreted as negative, so you have 1 bit dedicated to the sign and 7 bits for storage, which gives you the range of
-128 to 127 (0 is counted in the positive half which is why it's 127 not 128).

https://en.wikipedia.org/wiki/Signedness

>I feel as though i don't know near the prerequisites of computer hardware / operating systems when i read this.
Don't get discouraged, you'll never know everything about everything, and that's fine because you don't have to, you only need to know what's privy to the scope of your ambitions and goals. You'll know when you need to know it and when you need to know it you'll learn it as you need it.
>>
>>61161938
>what are my options
You can masturbate
>>
>>61161970
most appreciated anon, this helps a lot
>>
>>61161517
As I said, problems on that website are mostly discrete math(deals with natural numbers) and graph theory, so that's where you should start. MIT should have free video lectures on both, if not try khan academy.

Linear algebra is also useful for programmers, it has to do with matrices, vectors, linear spaces and such. It's heavily used in graphics programming.

Mathematical analysis has to do with analyzing functions, it's not that important for programming but it's very much a fundamental discipline in math(it's pretty much the first math course you take in most universities), if you want to get into it you want to start with real analysis which focuses on functions of real variables.

There's also algorithms and data structures which are very fundamental, you should know sorting algorithms, basic graphs, graph searching algorithms. If you don't know some of these then grab a book on that first and foremost. Introduction to Algorithms is a good introductory book.

Knowing math allows you to see problems more abstractly. You won't really need it if you're coding website frontends in javascript, however when you're solving problems in graphics, or trying to speed up some software or solving an original problem, you're going to find it very valuable. I can't really explain it very well, but when I look at a coding problem I immediately start to relate it to general theoretical concepts I know, I can see when a structure resembles a binary tree, a fibonacci tre or just a general graph and then I know tons of things about it because I know attributes of those theoretical structures.

>>61161425
It's for programmers who understand some basic math. They use math as a language to describe the problems precisely. The math isn't too high level either, a 101 course in discrete math will teach you most of the concepts you need, add linear algebra and you're set.
>>
>>61162034
Much appreciated.
>>
>>61161517
>I always wonder why so many renown programmers are math wizards

I haven't, but jump into real ML where you actually learn what each line fucking does. Linear algebra, statistics are everywhere and you won't get anywhere without having decent math skills.
>>
How is memory laid out, IE memory addresses like 0x7c00; the location of BIOS MBR but how are addresses like this laid out in accordance with programs and how does one access addresses also does anyone have a good guide on basic memory like this like very basic concepts
BIOS MBR source:
https://www.glamenv-septzen.net/en/view/6
>>
Is K&R the best programming book?

#include <stdio.h>

#define LOWER 0
#define UPPER 100
#define STEP 10

int
main()
{
printf("TABLE 1:\n");
printf("*--------------------*\n");
printf("| Celsius Fahrenheit |\n");
printf("|--------------------|\n");

for (float celsius = UPPER; celsius >= LOWER; celsius -= STEP)
printf("| %5.0f %6.0f |\n", celsius, 1.8 * celsius + 32);

printf("*--------------------*\n");

return(0);
}
>>
>>61162146
I too am curious about this.

Can we sort of think of memory as one really, really long vector/list?
>>
File: twimtbp.gif (1004KB, 300x169px) Image search: [Google]
twimtbp.gif
1004KB, 300x169px
>>61160609
I thought it'd just be a few snowflakes making all the noise, and eventually someone higher up would just shut everyone up.

You can't even say that the rust community is cancerous anymore, because cancer infects an otherwise healthy organism.
It's more like someone has taken a 20kg tumour and tried to plant strawberries inside it, how can anyone be surprised when they never grow properly.
>>
>>61162271
also theres program specific memory (Stack and Heap) and system memory IE that MBR example i gave what are the differences and where are some guides cuz i cant find any
>>
>>61161517
>I always wonder why so many renown programmers are math wizards

I had big problems in uni with math, especially linear algebra, but as soon as I got kicked out, I started learning OpenGL and programming graphics, I started relearning everything because I didn't retain almost anything, but now I had incentive, I wanted to be able to finish a project I was invested in and suddenly everything clicked for me and I learned linear algebra like it was nothing.

That's how they learn, they learn shit as they need it. I always think of John Carmack when I need inspiration. He started without any math knowledge beyond HS, he said he just used with highschool analytical geometry and learned as he went, and now he's working on Oculus which is some of the most advanced graphics coding right now.
>>
>>61162271
>Can we sort of think of memory as one really, really long vector/list?
As I understand it, yes. You have your vector indexes in hexadecimal, and the data in binary.
>>
>>61162338
Sorry, I don't mean "how did they do it" more "why did they learn it?". 3D graphics is the only one that makes sense to me, I don't understand the requirement for such advanced mathematics outside of it, I'm sure there has to be reasons to know it but I don't know what they are. I'm mostly just curious as to what people with the title of "researcher" are working on, it's like some semi-secret cabal where they talk publicly about almost everything but only reference mathematics, not demonstrate applications of them.
>>
is the programming language R considered a high level language? i used google but didn't find anything about that.
>>
I have 6 months work experience and two years education.

Is 45k usd a year decent?
>>
>>61162338
Not sure about your uni but to be fair, i htink many don't focus enough on the visual intuition of linear algebra. the youtuber 3blue1brown has a great series of videos on just that if anyone is interested
>>
>>61162418
Yes.
>>
>>61162447
thanks
>>
>>61162418
Isn't a language only low level if it's heavily platform(hardware) dependent? Specifically meaning you're writing things that only work on a specific platform.
>>
>>61162430
Not enough context.

What's your cost of living like? Where do you live?
>>
>>61162513
That's the classical definition that I stopped using forever ago.
>>
>>61162271
Physical memory: yes
Memory used by applications: not so much.

Look up "memory paging" and "virtual memory".
>>
When reading the standard input one character at a time with the read system call in assembly, is the input stored in the terminal buffer like when using
getchar
in C?
>>
File: sad aku.gif (3MB, 320x240px) Image search: [Google]
sad aku.gif
3MB, 320x240px
Trying to help a friend use the box API...

How do I do basic unix commands, like going to a directory, listing all the directories, etc...
>>
>>61162615
Yes, your terminal will buffer text before it sends it to you. So you'll be stuck waiting until they hit enter.
You need to set your terminal to "raw" mode.
>>
how do I learn C?
>>
>>61162719
start by learning C
>>
>>61162773
youtube or the book?
>>
>>61162787
the standard
>>
>>61162773
Matlab?
>>
>>61162719
>kidnap C programmer
>force him to teach you C
>kill him and take his job
>>
next: >>61162895
>>
>>61162873
Sure, why not? It's basically the same thing.
>>
File: e's.jpg (18KB, 220x329px) Image search: [Google]
e's.jpg
18KB, 220x329px
>>61162954
>mfw
Thread posts: 315
Thread images: 28


[Boards: 3 / a / aco / adv / an / asp / b / bant / biz / c / can / cgl / ck / cm / co / cock / d / diy / e / fa / fap / fit / fitlit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mlpol / mo / mtv / mu / n / news / o / out / outsoc / p / po / pol / qa / qst / r / r9k / s / s4s / sci / soc / sp / spa / t / tg / toy / trash / trv / tv / u / v / vg / vint / vip / vp / vr / w / wg / wsg / wsr / x / y] [Search | Top | Home]

I'm aware that Imgur.com will stop allowing adult images since 15th of May. I'm taking actions to backup as much data as possible.
Read more on this topic here - https://archived.moe/talk/thread/1694/


If you need a post removed click on it's [Report] button and follow the instruction.
DMCA Content Takedown via dmca.com
All images are hosted on imgur.com.
If you like this website please support us by donating with Bitcoins at 16mKtbZiwW52BLkibtCr8jUg2KVUMTxVQ5
All trademarks and copyrights on this page are owned by their respective parties.
Images uploaded are the responsibility of the Poster. Comments are owned by the Poster.
This is a 4chan archive - all of the content originated from that site.
This means that RandomArchive shows their content, archived.
If you need information for a Poster - contact them.