[ 3 / biz / cgl / ck / diy / fa / g / ic / jp / lit / sci / tg / vr / vt ] [ index / top / reports / report a bug ] [ 4plebs / archived.moe / rbt ]

Due to resource constraints, /g/ and /tg/ will no longer be archived or available. Other archivers continue to archive these boards.Become a Patron!

/g/ - Technology

View post   

[ Toggle deleted replies ]
File: 98 KB, 640x640, 1495684064452.jpg [View same] [iqdb] [saucenao] [google] [report]
61784776 No.61784776 [Reply] [Original] [archived.moe] [rbt]

Old thread: >>61776941

What are you working on, /g/?

>> No.61784805

Dumb cat

>> No.61784827

getting a job

>> No.61784883

Smart cat

>> No.61784892


>> No.61784902

Oh Shit Got To Poop

>> No.61784912

/dpt/ - Daily pooinloo thread

>> No.61784986
File: 29 KB, 300x250, superthumb.jpg [View same] [iqdb] [saucenao] [google] [report]

After learning several languages and not liking them, I am overcome with the desire to make my own language.
How do I overcome this common malaise?

well, I don't know shit about compilers or machine logic anyway, my gripes are mostly syntactical ones.

Why couldn't early programmers do a sensible thing and leave all the performance features a programming language in the machine code domain, with syntax being a parser/interpreter layer of abstraction for the end programmer? All languages would just compile to intermediate binary code, which then would be optimized and compiled into machine code by a unified compiler.
Then we could even do freaky shit like syntax being defined by the local settings of the IDE, so every programmer could use his own syntax, even within the same project on the same codebase.

I guess you could still make a syntactical wrapper around C or something.

>> No.61784988

what lightweight laptop would you recommend for some 2d and low poly 3d gamedev?
as long as it can run ide/blender/unity/ue4 that would be great.

>> No.61785000
File: 1.47 MB, 2048x1536, 1499819727053.jpg [View same] [iqdb] [saucenao] [google] [report]


>> No.61785001
File: 35 KB, 317x344, aaaa.jpg [View same] [iqdb] [saucenao] [google] [report]

(reposting from last thread)


>> No.61785006

Not enough

>> No.61785011

>After learning several languages and not liking them
Which languages?

>> No.61785037

C/C++ and Python, mainly

>> No.61785042



>> No.61785045

No one can beat Stroustroup in book thikkness. That's why he's the king.

>> No.61785057

Common Lisp is the only good language.
Too it's dynamically typed and there's no good implementation.

>> No.61785072

You can only write so much about something as featureless as C

>> No.61785103

I've written in C, Python, Pascal, JS, ADA and C#.

As weird as it sounds, I liked Pascal the best, but it has lots of problems of its own. I think the way it internally uses pointers, but abstracts the mess away with function parameter flags is great. But the way it treats arrays and loops is clunky as fuck.
ADA was hell to work with, I think they went too far in a few places with the safety and verbosity. But unique closing blocks for each type of block such as (endif, endfor, etc) is also a great idea.

>> No.61785169

>unique closing blocks for each type of block such as (endif, endfor, etc)
Worst idea ever

>> No.61785174

please respond dev-kuns

>> No.61785180

maybe try agdg?

>> No.61785184
File: 26 KB, 190x200, 15008766077630.jpg [View same] [iqdb] [saucenao] [google] [report]

Can one just fork GCC and modify the parser only as to change the syntax without altering the inner workings of the language itself?

>> No.61785191

That's a cute kitty

>> No.61785193
File: 18 KB, 284x339, 1499496082605.jpg [View same] [iqdb] [saucenao] [google] [report]

I think Rust made a mistake by abandoning many C/C++ conventions for no reason. Is it hard for people to start using a new syntax? Yes, very hard.

>> No.61785213

I've been wondering about ways to hide audio messages in innocent music clip videos.
Basically I'd like to merge two audio streams A and B in such a way that a youtube viewer would hear a lightly distorted stream A, and a program could decode it to stream B in realtime. And this method would have to survive youtube's reencoding, so it should be signal methods and not bit based methods.
I have found some papers which I find relevant.
Any particular ideas on this?

>> No.61785214

GCC can compile many languages and has many targets.
You should see how to add new GCC frontend, might not even require modyfing GCC itself.

>> No.61785243

These are all Algol-type languages. Try ML-like (Ocaml or F#), Haskell and Lisp (Racket or CL).

>> No.61785250


>> No.61785256

damn... i just did and they sent me to g

>> No.61785259

you can't do anything with GCC's source except for compiling it

>> No.61785274
File: 235 KB, 1804x891, Doc#1.png [View same] [iqdb] [saucenao] [google] [report]

Started learning Python today as my first scripting language. This is surprisingly fun and rewarding.

>> No.61785282


It is not very hard to learn a new syntax. You're just retarded.

>> No.61785368

Its not off the shelf, its a cheap Chinese knockoff
What would you suggest learning with? I have a lot of time soon

>> No.61785386

Trying to get the hang of it before starting a programming course in September.

Today I realized that in C# 'Console' is the same class as any other and WriteLine is a method like any other.

Believe it or not, it makes things (i.e. understanding the concept of classes and methods) much clearer for me.

>> No.61785541


>> No.61785563

It's possible, you can modify the parser so that *your* concrete syntax would generate the same AST as the correspondent standard C's syntax. After that you can just reuse all the immediate code generations and backends of GCC.
But of course it's not practical especially if you just have silly gripes with an ancient language's syntactic quirks. You'd have an easier time defining new CPP's macros to implement your own """syntax""". That was how Stroustroup originally implemented C++ and that was why C++ started out shit and only gets worse as time goes by, because its originator is a fucking hack.

>> No.61785613

Yeah, but keep in mind that you're typically using static methods on Console, like Write, which allows you to call a method that belongs to a class without creating an instance of that class to use. Those are going to work a little differently, and be designed differently, than non-static methods made to work on a unique instance.

>> No.61785619

Rust's syntax borrows a lot from ML's family, so yeah it's easy for me. But if you can't even handle something as trivial as the syntax differences how could you handle its completely different type system? Just man the fuck up my anon-kun.

>> No.61785651

I rather have problems with the user interface design that the syntax encapsulates. It seems most syntax is the way it is to appease the parser and the compiler, not to appease the programmer or achieve some kind of usability goals.

It's just poor interface design and I don't like it aesthetically. My idea is that the syntax should be a concise and internally consistent design language for controlling the compiler behavior.

>> No.61785682

perhaps he's fine with it but is worried that these choices will restrict its popularity

>> No.61785721

It's easier for the parser though, as silly as it sounds the ``dangling ifs'' was an actual parser implementing problem.
Nah, beside the lexer, the parser is just the tiniest and most trivial part for pretty much every compiler (even toy ones) in existence. C's syntax being this way is just solely of historical reason.

>> No.61785770

>controlling the compiler behavior
You don't control the compiler behavior with syntax though. Most of the code generation, static analysis, IR rearrangement and optimization, backend code generator's interfacing and linking have nothing to do with the language's syntax.
Syntax is not anything complicated, it's just that once you defined a concrete syntax it's really hard to make posthoc changes. That's why languages like Scheme and Lisp are so valuable.

>> No.61785822

Question is, why is something so superficial also so tightly embedded into the language that it can't just be changed on the fly.
Why isn't there an intermediate parser output or something.
Damn, I'm so smart with my hindsight.

>> No.61785898

>Why isn't there an intermediate parser output or something
There are, they are call abstract syntax tree, IR code and backend code. The problem is there are already a fuckload of softwares written in the old ``surface'' syntax that wouldn't build anymore if you just nonchalantly changed it.
In languages where you can directly access and modify ASTs like the Lisp languages, you can change the syntax to suit your taste, especially if you have reader macros like in Common Lisp.

>> No.61785992

I'm skeptical that Rust will be the next big thing. So like others I think I won't make that huge time investment. It would be easier if the syntax was C/C++/Java like.

>> No.61786037

stay left behind then punk

>> No.61786078

Hol up, what if you like, build your codebase into the intermediate language and store it as that, with IDEs or whatever interface just decoding it into your syntax of choice?
Damm, I'm so smartta

>> No.61786082

inheratance is a worse form of composition

>> No.61786121

A lot of bigshot compiler implementations of other languages reuse GCC's and LLVM's code generation as their backend, so yeah alternatively you could make your own language and do just that.
It's called decompilation and if you have ever looked at a decompiler's output, you'll realize you aren't that smart after all.
To be honest I feel like I'm talking with a clueless sophomore with too much confident in himself or something. Just learn that damn undergrad compiler course before trying to reinventing the wheel for the 2^64th time ``please''.

>> No.61786176

>clueless sophomore with too much confident in himself
Unironically the correct description of 90% of /dpt/fags

>> No.61786190
File: 20 KB, 420x420, d20.jpg [View same] [iqdb] [saucenao] [google] [report]

lmao I bet decompilation is just a problem of implementation, especially from an intermediate binary stage
it's just that nobody was smart enough to do it right
before me

my iq is one of the hifhest

>> No.61786216
File: 35 KB, 450x384, kimochi warui.jpg [View same] [iqdb] [saucenao] [google] [report]


>> No.61786230
File: 36 KB, 478x640, 13903333.jpg [View same] [iqdb] [saucenao] [google] [report]


>> No.61786267
File: 191 KB, 1765x1006, re.png [View same] [iqdb] [saucenao] [google] [report]

I have just found out there existed sanic hegehog videos games on android, and I couldn't resist looking inside since android reverse engineering is easy and fun.
So it's implemented in a x86 library on top of openGL ES, symbols are present, and java decompilation gives signatures of JNI entry points.
So I'm sure a sufficiently dedicated autist could dlopen that library and wrap that into a Linux desktop game without great difficulty.

>> No.61786307
File: 23 KB, 300x420, -Adidas-promo-work-in-Berlin--14-300x420[1].jpg [View same] [iqdb] [saucenao] [google] [report]

What is the Klossiest programming language/ framework?

>> No.61786316

Probably Ruby!

>> No.61786361

I just saw her in a youtube ad selling some premade webshit app.
I think she gave up programming because it's too hard.

>> No.61786370

Must be this http://samshadwell.me/TrumpScript/

>> No.61786373

>I think she gave up programming
she never started. its just propaganda.

>> No.61786408


Read SCIP, if you find scheme boring you need another profession.

>> No.61786421

Kut her some fucking slack, she's not even 25 yet.

>> No.61786502

Try Rust!
It's open source, no SJWs control it.

>> No.61786526

I've misjudged Python like so many others

>> No.61786533

in what way?

>> No.61786538

>It's open source
/g/ should fork it and make it not shit then
Call it /g/ust

>> No.61786586

Let's call it /g/arbage then, for the lack of a garbage collector means its eternal reign as the shittiest language in existence!

>> No.61786598

She is 25 and some days.

>> No.61786610

Hello Christian.

>> No.61786612

I am garbage collector pilled now.

Trying to manually manage your memory is like trying to manually optimize your code. Why bother if the compiler/GC is going to do it a million times more efficient than you? Wasted effort.

>> No.61786621

Use Rust and have the compiler do it for you at compile time without any overhead!

>> No.61786653

nah jk

>> No.61786656
File: 314 KB, 500x684, 1501958812871.png [View same] [iqdb] [saucenao] [google] [report]

>make it not shit
Why are you on 4chan when you lack the reading comprehension of a 12 year old
Underaged b&

>> No.61786668

>make it not shit
Because it's impossible for /g/ to make anything equally or less shitty.

>> No.61786697
File: 161 KB, 720x720, 20b8aa41a97fbae1b4b9d7917ae9473f--hair-inspo-karlie-kloss[1].jpg [View same] [iqdb] [saucenao] [google] [report]

>i missed karlie's birthday

I really fucked up, /g/.

>> No.61786762


>> No.61786791

Is there a way to automatically organize source files in VS?
Like when my function definitions are not in the same order as the header declarations?
No spectrum comments.

>> No.61786857


The fruits of liberal faggotry.

>> No.61786927
File: 24 KB, 850x400, 1448868602454.png [View same] [iqdb] [saucenao] [google] [report]

Why is it bad to sizeof() a char?

>> No.61786930

Keep at it

>> No.61786965

it's always 1, i do it anyway because it's more readable

>> No.61786978
File: 51 KB, 374x626, 9yQkEL8.jpg [View same] [iqdb] [saucenao] [google] [report]

Good for you anon, have fun with snek

>> No.61786983

Is guaranteed to be 1, so it's pointless. It just clutters up code.

>> No.61787003

Trying to write some I2C bare-metal code for an STM32 platform. I'm really considering switching to an OS, does anyone know an extra lightweight one who's been ported to Cortex-M ?

>> No.61787033

Why? Making a special condition check for char will clutter up your code

>> No.61787055
File: 126 KB, 1896x679, yessir.png [View same] [iqdb] [saucenao] [google] [report]

Day 1 of self-study, burned through 2 chapters of Matthes' book on Python. At page 70 of 562. Going to take a break for a while, then get at least one more chapter in today. This is going swimmingly. If I keep up this solid pace, I'll be done before the month is over!

Thanks for the well-wishes!

>> No.61787119

>special condition check for char
What special condition?
It's almost always blatantly obvious that what you're allocating is a string, even without the sizeof(char).
Typical uses would be
// Functionally equivalent to strdup
char *dup = malloc(strlen(str) + 1);
strcpy(dup, str);

// Functionally equivalent to asprintf
int len = snprintf(NULL, 0, "%d%d%d", a, b, c);
char *str = malloc(len + 1);
sprintf(str, "%d%d%d", a, b, c);

A sizeof(char) doesn't add anything meaningful.

>> No.61787157
File: 1.19 MB, 1550x1048, klossy.png [View same] [iqdb] [saucenao] [google] [report]

>Then we could even do freaky shit like syntax being defined by the local settings of the IDE, so every programmer could use his own syntax, even within the same project on the same codebase.

Sounds cool at first, but do you trust pajeet to come up with his own syntax that makes sense to others? It would make collaborative programming an absolute clusterfuck.

Maybe check out an X or T-series Thinkpad. As long as you get an i3 or higher, it should do the job.

You picked a good choice, anon.

The banner on her coding camp's website has a Ruby extension. Good guess.

>> No.61787214

>Sounds cool at first, but do you trust pajeet to come up with his own syntax that makes sense to others? It would make collaborative programming an absolute clusterfuck.
Well, it wouldn't matter, since the actual source code would be in binary, displaying it in a given syntax would just be a local user decompilation stage. You just open the binary source and your IDE translates it to the syntax of your choice.

>> No.61787234


>> No.61787256

LLVM has the Fatal Flaw of not being invented by me.

>> No.61787341

Just fork LLVM then? That's the point of FOSS, just take credit for it.

>> No.61787363

>What special condition?
For getting the byte size of an arbitrary variable, which is the whole point of sizeof. The whole point is that sizeof works with any object. If I'm writing a function to validate an arbitrary variable, I'm not going to write a break case just for a char type.

>> No.61787408

So the Git repo or whatever source control would have a preset syntax too, but could then be decompiled when it's cloned to the user's local? Might be an interesting way to add my own syntactic sugar to the language. Or could a Java programmer use this to make C# "look like" Java, assuming someone takes the time to make a syntax tree for them.

>> No.61787426

I have to use some baby IDE called BlueJ for a dumb intro to programming course.
Now I not only have to program in Java, but I have to program clicking on stuff.
It's so fucking braindead.

>> No.61787489

See no reason the Git repo wouldn't contain the intermediate binaries, with each user just choosing a pre-set or user-defined display syntax like one would choose a color scheme on a website.

>> No.61787505

>size of an arbitrary variable
Keep doing that then. You're taking this argument out of proportion. It's not a case of "Don't ever do this, it's completely terrible and can break everything", it's just a preferred style thing because it could be pointless. If a sizeof(char) or something gets generated by a macro or whatever, it's not anything to even be bothered about.
I think taking the size of a variable directly is always appropriate (and preferable to taking the size of a type directly), even if the variable is a char. It allows you to change things later, like changing the string a wide string or something easily later.

The argument is really against cases where you're allocating a string or "raw" data in terms of bytes and putting a sizeof(char) in the malloc expression.

>> No.61787527

Or if there's a problem of browser bloat or PC performance, store several decompiled versions in most common syntaxes or whatever.

Wait, this is getting dumb.

>> No.61787531

Try Go or Ruby!

>> No.61787595
File: 55 KB, 600x413, 1500849375801.jpg [View same] [iqdb] [saucenao] [google] [report]

What's a good IDE for learning C? I don't want it to autocomplete, just to run stuff without having to go into terminal/commandline and use gcc
I already know Java and Python, so it's more specifically learning C and lower level language material than learning to program, to be clear.

>> No.61787630

Gonna learn nodeJS so I can get a memejob and hopefully escape the pajeets of my javashop. What's a good free html editor? Or at least a cheap one?

>> No.61787641

>without having to go into terminal/commandline and use gcc
The command line is honestly the best way.
Just set up a simple build system (plain makefiles work fine), and compiling your program is as simple as typing 'make'.

>> No.61787647


>> No.61787658

I don't understand how Rust syntax is different? I've only learnt a bit of Rust and it doesn't seem to be much different at all. I actually like Rust because it has a lot of my favourite features which appear in other languages.

>> No.61787673

Literally any text editor. Sublime will do fine, Atom or VSCode if you don't mind a heavier editor that looks better out of the box.

>> No.61787740

what IDE is that?

>> No.61787750

I meant more like a modern GUI builder. Surely we must have moved on from the mid 2000s?

>> No.61787873

For higher level languages like python, is it bad practice to change a variable's type
for example
a = 1
a = "text"

>> No.61787899


If you absolutely need an IDE, then Code::Blocks or Qt Creator will do okay.

Otherwise, I highly recommend learning with the command line. I remember when I was working on my Bachelor's being in a networking class where we had to write a program that would snoop on connections passing through it and filtering the data, and displaying results in a TUI using curses. At least a few of the students had no clue why it was that they were running into errors not finding certain symbols from curses when "they included the right header files." They were apparently unaware of the role of the linker and how to link a third party library.

I honestly can't find the ability to respect people who neither understand nor desire to understand their build process. If you want to be a C programmer, you should know the basics of how your compiler and linker work, and know how to use a build tool. Once you understand how everything works, it's really as simple as just typing make all the time.

>> No.61787923

what college?

>> No.61787942

It's bad practice for any programming language to do that.

>> No.61787992

Dynamic typing was a mistake.

>> No.61788032

What's the idea behind dynamic typing?
Is it really that hard to declare your variables before using them?

>> No.61788067
File: 34 KB, 710x720, defensive.jpg [View same] [iqdb] [saucenao] [google] [report]

R-Ruby senpai, .... why d-don't you learn .... R-Rust! I-I started l-learning it and i-it is .... v-very comfy!

>> No.61788130

It's Geany.


Very pleasant experience so far. Looking forward to continuing with it.

>> No.61788151


I have actually learned a bit of it. It's a nice language, though it is missing a few features I'd like to see in it as a systems language. But given that they just added untagged unions, I'd say they're probably not done adding features. I'm not sure if I'd use it as a primary programming language, but I've been keeping tabs on it and watching its development.

>> No.61788190

I will never understand why in javascript you have to define a variable with var instead of a real data type or just omit var entirely

>> No.61788213


Please don't do that.

>> No.61788233


Well, I would imagine it would help with scope. Say we declare some variable foo in global scope. Now we assign foo to something else in a function scope. Are we mutating the global variable or starting a new variable? If we declared it with var, we'd be making explicit that this is a new scope, would we not?

That said, I'm not JavaScript expert. I've played around with it, but never used it for much and never delved deep into the language. Web programming isn't my thing.

>> No.61788256
File: 122 KB, 962x640, 1501379009864.jpg [View same] [iqdb] [saucenao] [google] [report]

All data is data, just ones and zeros that can't be distinguished without knowing what it is already. Assembly itself has no data types either.
JS, in it's shitty introduction to the world, never had the bright idea to allow easy use of data types like int or double, despite almost every other language already having that feature.
For why you need var itself, i assume >>61788233 is probably correct, since it still needs to be called for scope reasons.

>> No.61788419

Found this little snippet on Stack Overflow.

// These are both globals
var foo = 1;
bar = 2;

var foo = 1; // Local
bar = 2; // Global

// Execute an anonymous function
var wibble = 1; // Local
foo = 2; // Inherits from scope above (creating a closure)
moo = 3; // Global


Looks like I was right.

>> No.61788434


>despite almost every other language already having that feature.
Yes, well, its creator was a big fan of Lisp, the father of dynamic typing.

>> No.61788436

absolutely disgusting.

>> No.61788446

Like clicking on your majestic cherry blue keyboard

>> No.61788478


They have their purpose, but should be used sparingly. Personally, I like Ruby's approach: using symbols on the variable name to indicate the scope. $foo is a global, @foo is an instance variable, and foo is a local variable. @@foo should be avoided in favor of a class level instance variable.

>> No.61788497

>They have their purpose,
no they dont.

>> No.61788553
File: 90 KB, 250x367, file.png [View same] [iqdb] [saucenao] [google] [report]

What is a good way too learn Python? I bought "Learn Python the Hard Way" but a friend said the author's a hack for making me use Python 2 and Notepad++

>> No.61788606


I take it you've never done concurrent programming?

>> No.61788618

You're right instead of globals you should use the singleton pattern (TM) or alternatively pass a handler to every single class.

>> No.61788625


Pearson Publishers, Starting out with python is the best if you have never programmed before. Yes, Zed Shaw is a cunt.

Mark Lultz learning python is okay but lacks substantial exercises, so maybe give that a miss.

>> No.61788629

Literally just start writing shit in your spare time for the purpose of learning the language. Read the hitchhikers guide to python, and effective python, and really any book. Nothing wrong with learning 2.7 but you should save yourself the trouble and just skip to 3.x

>> No.61788630

>you need globals for concurrency
wow ruby, you become more of a baka every day

>> No.61788691


It's not that one NEEDs it, it's just that it makes the problem of sharing data a lot easier.

>> No.61788695

use a language with modules.

>> No.61788790


Listen to this. Python 2 is just not worth learning anymore unless you have to for work. Generator functions introduced in 3 are so useful.

>> No.61788800
File: 67 KB, 940x722, 2017-08-07-Aug-08-1502152216_940x722.png [View same] [iqdb] [saucenao] [google] [report]

Learning linear regression with python. I ended up wasting a lot of time on an aside in matplotlib: you can draw a line of best fit pretty easily for 1D linear regression by just running plot(X, Yhat), but a drawing a plane of best fit for a 2D linear regression is more challenging, since plot_surface(X1, X2, Yhat) for mplot3D takes data in as 2D coordinate matrices instead of just a list of points.

>> No.61788843

what's that?

>> No.61788860

whats what?

>> No.61788868
File: 409 KB, 770x1100, 1457576176147.jpg [View same] [iqdb] [saucenao] [google] [report]

Realistically speaking, if someone with a great github portfolio has an anime avatar, are they automatically unemployable?

>> No.61788872

Nothing really desu. Basically a language where static is default.

Modules are a pain in the ass and don't really add any value. They just end up discouraging you from making new files.

>> No.61788882

modules in languages

>> No.61788887

I've been using Geany for a couple years. I like it.

>> No.61788890


Namespacing data doesn't make it any less global in practice. Incidentally, Ruby does have modules. Nonetheless, there are still some times when it might make sense to make a global, and it would honestly be silly just to make a module to act as a container for it.

>> No.61788909
File: 16 KB, 190x188, aya_happy.jpg [View same] [iqdb] [saucenao] [google] [report]

Only if the avatar is cute.

>> No.61788925

Is this a linked list in Rust?
use IntList::{Node, Empty};

// This program defines a recursive data structure and implements methods upon it.
// Recursive data structures require a layer of indirection, which is provided here
// by a unique pointer, constructed via the `Box::new` constructor. These are
// analogous to the C++ library type `std::unique_ptr`, though with more static
// safety guarantees.
fn main() {
let list = IntList::new().prepend(3).prepend(2).prepend(1);
println!("Sum of all values in the list: {}.", list.sum());
println!("Sum of all doubled values in the list: {}.", list.multiply_by(2).sum());

// `enum` defines a tagged union that may be one of several different kinds of values at runtime.
// The type here will either contain no value, or a value and a pointer to another `IntList`.
enum IntList {
Node(i32, Box<IntList>),

// An `impl` block allows methods to be defined on a type.
impl IntList {
fn new() -> Box<IntList> {

fn prepend(self, value: i32) -> Box<IntList> {
Box::new(Node(value, Box::new(self)))

fn sum(&self) -> i32 {
// `match` expressions are the typical way of employing pattern-matching,
// and are somewhat analogous to the `switch` statement from C and C++.
match *self {
Node(value, ref next) => value + next.sum(),
Empty => 0

fn multiply_by(&self, n: i32) -> Box<IntList> {
match *self {
Node(value, ref next) => Box::new(Node(value * n, next.multiply_by(n))),
Empty => Box::new(Empty)

>> No.61788936

So I'm fine with an ugly grandma avatar?

>> No.61788944

>modules and globals are the same things
Alright, heres your last (you)

>> No.61788946
File: 80 KB, 400x400, 1149047.png [View same] [iqdb] [saucenao] [google] [report]

there was a guy who used to post here that is programmer god
and his github has this picture

>> No.61788955
File: 901 KB, 1037x1056, excited.png [View same] [iqdb] [saucenao] [google] [report]

No, you are only employable if your avatar is cute!

>> No.61788982
File: 767 KB, 1599x899, Screenshot_2017-08-07_20-25-19.png [View same] [iqdb] [saucenao] [google] [report]

Cleaned up my pretty printer a bit. Next step is adding unions.

>> No.61788997
File: 34 KB, 640x427, 1494544017286.jpg [View same] [iqdb] [saucenao] [google] [report]

All you have to do is
>Dye your hair any tone of cool colors
>Identify as a pneumosexual unsigned turboxir
>Have a github that does pull requests on random projects
>Your only contribution should exclusively be renaming "problematic" variable names or comment into safe space mellow words
Now you're hired by Google, all you have to do to keep your free allowance is pretend to do something twice a year

>> No.61789009

when i wrote my compiler i printed my AST with dots

>> No.61789047

>Senior / Lead NodeJS Developer
>£100,000 - £120,000 per annum

>> No.61789092

This is modern C++

constexpr auto x =*
(f1 | f2)--[1_p - U - 6_p]--(f3)
(f4)--[2_p , 5_p]--(f5)
(f6)--[3_p - _ - 4_p]--(f7);

If you don't know what this does then you don't know C++

>> No.61789104

>If you don't know what this does then you don't know C++
I'm not sure I want to

>> No.61789121

Pattern matching on a bunch of functions?

>> No.61789129

why would anyone want to know what this garbage does

>> No.61789131

I'm glad I don't desu.

I feel dirty when I write a quasiquote, let alone doing shit like that.

>> No.61789146

>If you don't know what this does then you don't know C++
Like everything else in that godforsaken language, some feature some other language had that somebody somewhere wanted so they implemented a half-functional, never-going-to-be-used version of it so they can say "YEAH BUT SEPPLES CAN DO IT TOO!!!!!!" no matter how arcane or hacked together it is.

>> No.61789231


A module's name is globally accessible, and typically its members are too. A variable kept in a module might not be called a global variable, but for all practical purposes, it is one. Using a singleton has the same effect. All you're doing is adding an extra step to accessing a variable that is accessible from any function with a shared state.

>> No.61789269


>> No.61789292

Post your other monitor

>> No.61789301


Not knowing the types of any of these variables, nor knowing the definition of the _p user defined literal, it is impossible for anyone to know what that code does from just that snippet.

>> No.61789336
File: 2.53 MB, 1918x1079, Screenshot_2017-08-07_20-50-59.png [View same] [iqdb] [saucenao] [google] [report]

Well if you insist

>> No.61789404
File: 401 KB, 1948x1127, frongshot.jpg [View same] [iqdb] [saucenao] [google] [report]


>> No.61789456
File: 37 KB, 1024x576, question.jpg [View same] [iqdb] [saucenao] [google] [report]

Is this valid C? Because I tested it and it works.
#include <stdio.h>
#include <stdlib.h>

int main(int argc, char *argv[])
int i;
int *arr = malloc(sizeof(int) * 10);
int *d = arr;

for (i = 0; i < 10; i++)
*(arr++) = i;

for (i = 0; i < 10; i++)
printf("%d\n", d[i]);
return 0;

>> No.61789499

dumb karenposter

>> No.61789501

No. You're writing out of the bounds of the memory allocated to you. Your code isn't segfaulting out of luck. Malloc could theoretically return a region close to a page boundary where you'd get burned.

>> No.61789502

looks about right, but you forgot to free arr

>> No.61789513

How is it allocating to out of bounds memory?

>> No.61789514

not him, but how so? arr is only incremented after writing i, so there's never an out of bounds write

>> No.61789515


Looks like valid C to me.

>> No.61789521


>> No.61789528


>> No.61789530


It's a cat; it doesn't know any better.

>> No.61789537

>hard coded URLs
>setting height in JS

>> No.61789539

dumb rustposter.

>> No.61789585

Consider this:
# every time you "add" strings, they get copied, so this is a big waste of resources and time. BUT, this
message = person.title() + " " + "has" + " " + str(beans) + "beans!"
# is the same as this
message = " ".join((person.title(), "has", str(beans), "beans!"))
# or this, if you like C syntax
message = "%s has %s beans!" % (person.title(), beans)
# there's also str.format, but if you're running a newish version it's basically obsoleted by these (also called format strings)
message = f"{person.title()} has {beans} beans!"

>> No.61789591
File: 158 KB, 1080x1080, qq.jpg [View same] [iqdb] [saucenao] [google] [report]

what's wrong about that?

>> No.61789593

Oh fuck I misread. Yeah it's fine.

>> No.61789619


>Malloc could theoretically return a region close to a page boundary where you'd get burned.
Could it give you a region close to a page boundary? Yes. Would it burn you? No. You likely wouldn't even notice the performance hit from the kernel having to swap pages in and out.

>> No.61789635

I'm pretty sure he was implying that the page won't be mapped to anything.

>> No.61789673

I thought he was moving down the array twice desu.

I almost always use array syntax for pointers so I saw 2 ++'s and alarm bells started ringing desu. 10 elements is also small enough that if there was the error I imagined there being, it probably wouldn't crash.

Also page boundary crossings are so overblown. God forbid if I get a cache miss there's a little more indirection once every 4096 bytes.

>> No.61789689

jquery is a big download you'll use 5% of (check axios for ajax)

setTimeout will make a nightmare of your application state when used with animations - if you have to do that, use Promises so you know when they're done

Hard coded URLs are sloppy and create a surface to introduce 404s (that code would break if the site was deployed to /asdf/ instead of /)

Use flexbox instead of setting height in JS, or at least add a window resize hook

ES5 is high school tier

>> No.61789721

Where does /g/ go to look for part time work?

>> No.61789728

There's a good bridge near me I beg/hook under

>> No.61789750

the grocery store

>> No.61789756

>inviting 60 more people to your gold mine

>> No.61789765

c++ or python better

>> No.61789775

Totally different uses. Python is scientists and C++ is video game devs.

>> No.61789778

You probably already know this, but in the general case, if you write the first loop like this
for (i = 0; i < 10; i++)
arr[i] = i;

it will be easier for the compiler to optimize.

>> No.61789801

It also has less mutation going on so retards like me are less likely to misread it.

>> No.61789862

so which one is better

>> No.61789878

Totally different uses. Python is scientists and C++ is video game devs.

>> No.61789892

so which one is better

>> No.61789905

Guys how do I convince my boss to move back to Java after he decided to move to Scala? The compile times are killing us

>> No.61789908

Totally different uses. Python is scientists and C++ is video game devs.

>> No.61789913

Python, since it can do everything it's intended to do just fine with a okay syntax and no real major fuckups
C++ can do only half of each of those.

>> No.61789921

pooe on his chair

>> No.61789928

>The compile times are killing us

>> No.61789946

tell him the compile times are killing you

>> No.61789974
File: 248 KB, 808x805, c-baby.jpg [View same] [iqdb] [saucenao] [google] [report]


>> No.61789975

I have done, he just says they won't be so bad in the next version of the language

It was a metaphor

>> No.61789989

do people here actually use c or is it a meme like gentoo

>> No.61789990

ok, say I want my job to be something like this:
i like to solve difficult problems and learn skills, but I'm not an entrepreneur with original ideas. I'd like to realize someone's idea for an application with my own skills (which I don't have yet but you get what I mean). that's what a programmer/"software engineer" does, right? also what language would you learn for this type of programming job?

>> No.61790010

I use C

>> No.61790013
File: 8 KB, 480x360, fed2.jpg [View same] [iqdb] [saucenao] [google] [report]

It's part of /g/ fedoracore.

>> No.61790018

i see

>> No.61790019


>> No.61790027

Oh yeah I agree. Getting a job in the game dev industry is retarded. And you shouldn't use C++ if you're indie; C++ is used because "industry standard" not because it's the right tool for the job. You can really feel the resentment game engine designers like Mike Acton have for C++.

>> No.61790029

>that's what a programmer/"software engineer" does, right?
Most software engineer roles are very tedious. You are expected to do the same frontend/backend/sql shit every day for the rest of your employment.

I think you are looking for more of a "research assistant" position. If you land an intellectually-stimulating job with only a bachelor's degree, you've hit the jackpot.

>> No.61790039

please make your next app a cli app and help put an end to gui tyranny

>> No.61790055

>tinder app in the terminal

>> No.61790056

I'm learning it right now to do some linux stuff

>> No.61790084

As far as I'm concerned, C *is* programming.

>> No.61790087

>wanting to be limited by cli

>> No.61790094

Writing a compiler in assembly is programming

>> No.61790117

I have now begun the process of reprogramming my taste buds.

>> No.61790123

I'd prefer everything to run in emacs but I don't think most people are ready for that yet.

>> No.61790152

So be rational. If it's amounting to like 15 minutes of your day, time your coffee run with a build. If it's taking a lot more, then tell your boss it's going to affect how productive your team is until that next version addresses your concern.

>> No.61790156

d-do you have a test case for semen? I can provide the sample~

>> No.61790183

Well, that's disappointing if true...

>> No.61790295

Retards like this? >>61789501

>> No.61790319

No that guy eats paint I'm not that retarded anon.

>> No.61790361

What is the programming equivalent of this?


>> No.61790373


somebody please post the "Microsoft Certified Solutions Expert" image

>> No.61790376


If I needed that, I am more than capable of producing it myself. Anyways, the whole idea is to get myself used to not drinking something super sweet with every meal, like soda or fruit juice. And I'm going to try and replace it with possible bitter things like black coffee and unsweetened tea.


Emacs hurts my hands.

>> No.61790393

try tap water, it's still a little sweet

>> No.61790399

>Emacs hurts my hands.
Have you tried using a more ergonomic keyboard and/or evil mode?

>> No.61790417

It's Java, no doubt about it.

>> No.61790442

Jaba dev, can confirm.

>> No.61790454

why do americans always drink so much sugar water?

>> No.61790477

If you're an indie developer, the best language to learn now is Java.

>> No.61790539

Can someone explain to me why callbacks are considered asynchronous in various javascript frameworks? I keep seeing them say the meme catchphrase "functional programming" and I don't remember lisp being considered an innately asynchronous or parallel language.

>> No.61790571


Honestly, tap water has not much real taste. Although if you freeze it into a solid bottle of ice and let it slowly melt, it's pretty delicious.


>different keyboard
I use a laptop. I'd rather not use a USB keyboard, and I don't want to add another criterion on for my already picky needs for laptops.


Because sugar is arguably more addictive than cocaine, and it's everywhere here. We grow a fuckload of corn in the mainland, which we turn into syrup since people can only eat so much actual corn.


Java is gross. Don't use it unless you need it for Android or for some enterprise job.

>> No.61790586

They are "functional programming" in that you're passing functions around, using functions in interesting ways, whatever (a callback is just a function that runs after another function returns)
Functional programming is a much broader category, and you're right, not necessarily async

>> No.61790589

Fuck off tripidiot.

>> No.61790598

>I use a laptop.
Oh shit. Why? They're terrible for you.

>Because sugar is arguably more addictive than cocaine
You could try replacing it with a healthier habit. Do you like hot peppers?

>> No.61790599

New trippie coming through, please be nice to me!!!

More girls in coding, yay!!! (ᴗ)

>> No.61790611

How new are you?

Jessica is a unisex name

>> No.61790616

>freeze it into a solid bottle of ice and let it slowly melt

i can't stand cold stuff (or really hot stuff either)
lukewarm or bust

>> No.61790618

pls sex me

>> No.61790621

Then how do async callbacks in nodeJS work? Is a new thread somehow spun up every time a callback is called? They keep saying you don't have to wait for a function to return because asynchronous but I'm beginning to think no one actually understands what it's doing and they're just shitposting because I keep seeing the same stupid console.log example in the explanations.

>> No.61790622

>girl on /g/
Nice try :^)

>> No.61790632

>if a tripfag attention whores for long enough then it's not a bad thing that they're attention whoring
i will never understand this retard logic

>> No.61790641

disregard this i suck cocks

>> No.61790650

Ruby has a decent amount of programming knowledge from what I've seen

>> No.61790679

Xhe's a complete autist outside of /dpt/ though, every time I look at the board there's some post by Ruby responding to either blatant sarcasm or obvious trolls and generally dragging the quality of the board down by enabling these sorts of shitposts.

>> No.61790687

Well that's because /dpt/ is the best part of /g/ by far.

>> No.61790719


Because I don't want to be confined to a desk and every tablet that doesn't have Surface Pro in its name is terrible.

>hot peppers
Honestly I hate them, although cayenne pepper's alright in small amounts.


So what programming languages do you know? What's the most interesting thing you've programmed? Also, niceness needs to be earned. This is 4chan, not Reddit.


That is an odd taste. Cold makes everything better.


At least bother to spell everything right including the A at the end and the ! before Sempai.

>> No.61790722

Why do you produce so much corn? I heard that you have tight control over how much sugar can be important and the government buys any excess sugar is produced. Corn syrup sounds like such a disgusting substitute for sugar.

>> No.61790731

>Corn syrup sounds like such a disgusting substitute for sugar.
You have no idea, if you ever go to America stay far away from anything containing """"sugar""". I'm not a big fan of soda in the first place, but boy American coca-cola was a new low. Tastes like literal shit, no wonder anyone with any sort of functioning tastebuds over there imports sugary drinks/food from 1st world countries that actually use sugar.

>> No.61790769

Look up "node event loop". There's a queue of callbacks, and each time the loop runs it goes through the queue, running any callbacks it can, and leaving the ones that can't execute yet in the queue.
Let's say your main thread does these two things (in shitty pseudocode):
console.log('i just ran');

First, node reads line 1. It sees that get_data_from_server runs asynchronously, and it adds process_that_data() to the callback queue.
Next is line 2. We print the message to the console.
Finally, we get the data back from the server (because doing this took longer than executing line 2). So we run the callback now, and remove it from the queue.

>> No.61790803


We grow so much fucking corn because it's just what grows in this climate, and we clearly have buyers (soda companies). Anyways, corn syrup sucks, but cane sugar isn't that much better.

>> No.61790819

Midwest here, there is nothing wrong with growing a metric fuckton of corn

>> No.61790833

You have sugar cane in Florida. Why does your government fucking claim they believe in shit like free market, yet does protectionist bullshit over sugar plantations or basically any product?

What is point of growing corn? Can't you grow something else like pumpkins or cows or some shit?

>> No.61790839

The united states has had a communist agricultural system since the great depression. The farm czars have decided that corn is worthy to be produced.

Also the farm czars set the price of sugar. The price of sugar in the US is higher than market value.

Corn syrup is pretty close to sugar desu. It's dissolved in water and instead of sucrose you have fructose + glucose but otherwise it's the same as sugar.

>tap water has not much real taste
Tap water has the realest taste.

>> No.61790882

Corn is more suitable than pumpkins and cows because it's more vertical and needs less space. But yeah sugarcane would be way better but fucking farm czars.

This is definitely not me being biased because I live in Texas where sugarcane grows really well. It grows well all along the south. Hot as fuck + humid as fuck = sugarcane.

>> No.61790892

Corn is love, corn is life
Welcome to the cornfields motherfucker

>> No.61790903


Because it's a bullshit government and nobody likes it. Seriously, it's almost a national pastime to bitch about the government.


>Can't you grow something else like pumpkins or cows or some shit?
Oh yeah, that's another reason to grow so much corn: feeding livestock. And yeah, we raise a lot of cows here.

>> No.61790904

Isn't sucrose just fructose and glucose?

>> No.61790930
File: 44 KB, 636x616, 1474325315193.jpg [View same] [iqdb] [saucenao] [google] [report]

Employed Haskell programmer reporting in

>> No.61790947

Okay, I see. That's actually pretty simple. The fact that there's a queue for the callbacks pretty much explains everything. Not sure why a million blogs can't just explain it so straightforward and transparently.

Thanks anon

>> No.61790955

Sucrose is those two bound together along a glycosidic bond. They taste a little different but about the same thing.

Don't do the fallacy of composition anon. Sugar is made out of carbon and water but you aren't going to be able to replace it by sticking coal and water in a blender.

>> No.61790981

>you aren't going to be able to replace it by sticking coal and water in a blender
Sounds like that's Ruby's end goal.

>> No.61790985

>yet does protectionist bullshit over sugar plantations or basically any product?
Because almost every other government has protectionist bullshit over everything too and it gives them an advantage over a nation that doesn't have any such policies. I swear libertarians are as bad as commies. It doesn't work in practice because the world is bigger than your backyard.

>> No.61791004

I am also employed, and am also a Haskell programmer

>> No.61791011


And where are you employed, Anon? What is your job title?


Nah, my end goal is to make things that taste bitter not taste bitter to me, and to stop craving sugar.

>> No.61791038

The farming practices of the USA are not protectionist at all. It's just good old fashioned corruption. Big corn lobbies congress. Congressmen protect big corn. Congressmen magically end up with money, speeches with outrageous fees, free dinners, free golfing trips, etc.

>> No.61791107

So things like broccoli?

>> No.61791163

How do I make my game engine/framework not require hamachi just to connect to each other (peer to peer).
Other than hosting a web server obviously

>> No.61791185

Just wondering if there's any way other than port forwarding or VPN or server

>> No.61791213


Broccoli isn't bitter at all. It's pretty damn good.

>> No.61791290

You still need a server but you can do:
The server doesn't need to host the game though. I think this is what hamachi is.

>> No.61791372

Yeah I meant that one of the players/clients would host a lobby from their computer (which wouldn't have a public IP)
I'll give that a read thanks

>> No.61791384


> What is your job title?

Cock sucker.

>> No.61791394

Thanks dude

>> No.61791410

What you do is you setup a server just for holepunching that redirects users to the player's local lobby. It's basically running your own hamachi but probably better because making users download hamachi to use your program to its fullest is shit desu.

>> No.61791423

I ain't judging, if you can make an easy living off the fact that you happen to be gay then good for you

>> No.61791440

Yeah that's what I figured.
Just sucks because I'm poor lmao.
Thanks :)

>> No.61791495

r8 muh m8kefile
.PHONY: all executable objects dependencies\
clean-executable clean-objects clean-dependencies clean

CFLAGS = -g -c -O0 -Wall -Wextra -Werror -Wold-style-cast -std=c++14
DFLAGS = -MM -o [email protected]
LIBS = -lGL -lGLU -lglut -lm
SOURCES = $(wildcard *.$(LANGUAGE))
OBJECTS = $(patsubst %.$(LANGUAGE),%.o,$(SOURCES))
DEPENDENCIES = $(patsubst %.$(LANGUAGE),%.d,$(SOURCES))

all: executable

executable: $(EXECUTABLE)

objects: $(OBJECTS)

> @:


%.o: %.$(LANGUAGE)

%.d: %.$(LANGUAGE)


> rm -f $(EXECUTABLE)

> rm -f *.o

> rm -f *.d

clean: clean-executable clean-objects clean-dependencies

-include $(DEPENDENCIES)

>> No.61791505
File: 2.17 MB, 1136x875, bw.png [View same] [iqdb] [saucenao] [google] [report]

No problem.

>tfw feeling welcomed from becoming part of /dpt/ in one day of learning Python.

>> No.61791512

You could probably get away with using your home Internet connection desu. A domain name should cost like 20 bux a year.

The amount of data that such a server needs to send is really really fucking minimal. And if not you can get away with a really low bandwidth server. There's severs that are a dollar a month.

>> No.61791540

What happens if use your home desktop as a web server?

>> No.61791550

Yeah I don't have a home internet connection lol.
Situation is complicated.
But I'll be looking at hosting in a few months.

>> No.61791566

0/10 kill yourself

>> No.61791660
File: 834 KB, 1920x1080, DeepinScreenshot_20170808143944.png [View same] [iqdb] [saucenao] [google] [report]

So in line 8, the middle statement is supposed to check something, right? what does s check?

>> No.61791720

It checks if the current char is 0 ('\0')

>> No.61791835

>Non-standard names for standard variables
It's shit.

>> No.61791873

'\0' which is equivalent to "null" which is falsey, terminating the loop.

>> No.61791914

cool beans

>> No.61791966
File: 1.58 MB, 800x608, rightclick-polymorphism.webm [View same] [iqdb] [saucenao] [google] [report]

Working on Minecraft clone. Added polymorphism to the right click action.
(define slab-upgrades `((,stone-slab ,stone) (,grass-slab ,grass)))
(define permeable (list air water))

(define (slab-player-place! kind world state x y z side . extras)
(if (and (equal? side TOP) (equal? (finite_getblock world x y z) kind))
(place-block! world (cadr (assoc kind slab-upgrades)) state x y z)
(let* ((coords (getneighbor_coords x y z side))
(replaced (apply finite_getblock world coords)))
(if (equal? kind replaced)
(apply place-block! world (cadr (assoc kind slab-upgrades)) state coords)
(if (member replaced permeable)
(apply place-block! world kind state coords))))))

(make-block-class stone-slab player-place!: slab-player-place!)
(make-block-class grass-slab player-place!: slab-player-place!)

And this is the class if you're wondering:
(define* (make-block-class
(break!: break! dumb-break!)
(place!: place! dumb-place!)
(player-place!: player-place! dumb-player-place!)
(update!: update! dumb-update!)
(update/now!: update/now! dumb-update/now!))
(let ((rtn
(lambda (proc . args)
(case proc
((update/now!) (apply update/now! block-kind args))
((update!) (apply update! block-kind args))
((place!) (apply place! block-kind args))
((break!) (apply break! block-kind args))
((player-place!) (apply player-place! block-kind args))))))
(hash-table-set! block-class-table block-kind rtn)

>inb4 oop memes
It just werks for things that are actual objects. Like blocks in a minecraft clone.

I hope you're a fursecutor.

>> No.61792033

How do we stop this?
>Node.js Emerging as the Universal Development Framework for a Diversity of Applications

>> No.61792064

By putting the javascriptlets out of business.

Invest heavily into wasm. After that's done, replacement "full stack" technology that isn't javascript.

>> No.61792085

Write to the editor and tell them that they misused the word diversity.

>> No.61792086

string calibornifier() {
static vector<string> const canon = {
string prefix = canon[rand()%canon.size()];
string suffix = canon[rand()%canon.size()];
return prefix.substr(0, prefix.find('B')) + suffix.substr(suffix.find('B'));

>> No.61792119

This seems overengineered.

>> No.61792171

At firsthought this is what I'dd do:
The encrypted audio has to a lot shorter then the other one
You strech the short audio so it fits the long ones length with some function in the form g(1/n * x)
Add the signals together, the distortion should be low, bc of the transformation

To extract, do it in reverse:
Subtract original audio from the one that has a meseage
Aply a function in the formnof g^-1(n*x)
You should have the original meseage audil

>> No.61792264

You could vocode the audio reducing the amount of data you need drastically, then embed the output channels as low frequency elements of the waveform, as humans are insensitive to low frequencies.

Vocoders are proven technology for low quality signals. Not to mention the output is going to sound like kraftwerk too so that's a bonus.

>> No.61792308 [DELETED] 

Not necessarily. Often when you're playing around with byte offsets, for example in messaging through sockets, sizeof(char), or sizeof(int8) or something similar will be more readable.

>> No.61792334

Whatever you're doing would have to make it past the psycho-acoustic model yt uses to compress the audio channels. Depending on the source material, I don't think there's enough bandwidth for you to do it in the audio channel.
However, you also have a video channel, which has a lot more bandwidth. You could perturb parts of the image stream, watermark-style, to send a low-bandwidth, redundantly-coded side channel. I don't know how much bandwidth you could get out of such a scheme, but with both the audio and video channels perturbed, it just might be sufficient for a tightly compressed mono voice channel.

>> No.61792351

Your program is shit if it isn't programmed in Rust.

>> No.61792420

I'd rather it be shit than programmed in Rust desu.

But if you wanna write a rust program that can dynamically load both compiled executables and source code and invoke a repl that can touch the program state, be my guest anon.

>> No.61792498


>> No.61792526

Very nice.

Are you procedurally generating the map?

>> No.61792551

The terrain generation is very simple and currently just 2 dimensional pink noise. Anything below the noise value is grass and anything below block that isn't grass is water.

I've mostly been focusing on adding technical features. I'm not too worried about creating a profound terrain generator right now since doing that wouldn't improve the underlying engine.

>> No.61792558

Ada is the shit, at least for embedded / safety stuff. I much prefer Ada to C for writing code that could kill someone due to bugs.

>> No.61792574

>anything below block that isn't grass is water
Anything below y=64 that isn't grass is water. Augh.

>> No.61792622

Why not use the HAL? You don't need an rtos for i2c on a cortex-M.

>> No.61792657 [DELETED] 
File: 138 KB, 1911x837, sieging python.png [View same] [iqdb] [saucenao] [google] [report]

I made some parts more complicated for the purpose of reinforcing what I'm learning, and it's going well. Though, I'm having trouble figuring out how to capitalize items in a list. Would someone please give me some advice? I had to resort to adding the 'title' method to each item in advance.

>> No.61792676
File: 138 KB, 1911x837, sieging python.png [View same] [iqdb] [saucenao] [google] [report]

I've been studying Python, and it's going well.
I made some parts more complicated for the purpose of reinforcing what I'm learning, and everything is still running fine. Though, I'm having trouble figuring out how to capitalize all items in a list. Would someone please give me some advice? I had to resort to adding the 'title' method to each item in advance instead of as a group.

>> No.61792720

>Ada is shit

>> No.61792758

Have you not learned how to iterate over items in an array/list?

>> No.61792797

How do static and inline relate in C? Why would I declare a function that is inline but not static? Are there problems with defining static inline functions in header files?

>> No.61792818

>Why would I declare a function that is inline but not static?
You have a function that is called from many other files and overhead from the function call is limiting speed

>> No.61792888

>Why would I declare a function that is inline but not static?
Non-static inline functions are really weird. Actually, extern inline, "plain" inline and static inline all have slightly different semantics.
- static inline
Inline the function in this translation unit; no external symbol is produced.
- "plain" inline
Create an alternative implementation of an external function for this translation unit; no external symbol is produced, and the which function gets called (the inline or external function) is unspecified.
MAYBE this could be used to create a faster/more efficient version of some function (perhaps with less error checking?), but the functions should semantically be the same.
The standards committee probably were trying to create more useful functionality when they thought this up, but it's really just unnecessarily confusing.
- extern inline
Inline the function in this translation union, but also generate a normal symbol that other translation units can use.

>Are there problems with defining static inline functions in header files?
No, it's perfectly fine. Overdoing it can lead to long compile times and possibly executable size bloat.
An inline function really should at max 3 lines long.

>> No.61792927

I've been able to capitalize everything else so far. I'd clarify, but my post keeps getting detected as spam, and don't know what to do to circumvent it. Refer to the last line in the picture in my last post, and imagine I want to add a title method to it. That's been breaking it.

>> No.61792930

Cheers, that clears it up nicely.

>> No.61792941

I have two programs in the same git repository, a server and a client. They have some shared data they need to load, but then they also have files that are different (like config files).

I would like to make a directory for that shared data and create a symlink out of each program's run directory to it. But mklink on Windows seems to have some problems, mostly that it requires admin privileges. What could I do not to duplicate the data by copying it into the run folders of both applications?

>> No.61792960

>I would like to make a directory for that shared data and create a symlink out of each program's run directory to it.
Just put it in some well-known location and read it from there. That's what a normal program's installation does.

>> No.61792975

New thread:

>> No.61792981

I don't want the installation to put anything outside of the program's own directory, and I don't want to have to intall it after every build while debugging, so I need the paths to be relative to the run directory.

>> No.61792997

├── client/
│ └── prog
├── server/
│ └── prog
└── shared_data

>> No.61793025

But that's not the structure the program will be distributed in, so once the actual shipping build is made, all the relative paths will be different.

>> No.61793034

Or programs*, rather. In the shipped form, I want each one of the two programs to have their executables in the root directory, and then a separate data folder. And they're distributed separately.

>> No.61793037

Why not environment variables or command-line flags to override what will ship?

>> No.61793077

I do use those to for example set LD_LIBRARY_PATH on Linux to the current directory. But I can't really think of a way to move link data directory into the run directory with those.

>> No.61793145

Well, it seems like you can create directory junctions without admin privilieges, so guess I'll use those.

>> No.61793250

How do you reverse-sort a list temporarily in Python? This is what I have so far, but I'm unsure of how to add the reverse argument in this case:

color_list = ['red', 'blue', 'green']
print("Here is the original color list:")
print("Here is the temporarily sorted color list:")
print("Here is the original color list once more:")

>> No.61793294


>> No.61793360

So it's:

If I want to print that, right? That's what I just did, and it seemed to work. Though, the:


segment looked strange to me. The book just stated that temporary reverse-sorting could be done, but not how. Would you please explain that part for me briefly?

>> No.61793378

It's list slicing.
list[x:y:z] returns a new list where x is the starting index, y is the ending index, and z is the increment between indices.
list[3:9:2] would get a new list comprising of the 3rd, 5th, 7th and 9th elements of the old one.
list[::-1] uses default values of x and y (the final and first elements) and goes down in steps of 1.

>> No.61793406
File: 26 KB, 680x447, 1494580643455.jpg [View same] [iqdb] [saucenao] [google] [report]

That makes perfect sense, thank you! I've snipped a picture of this for future reference.

>> No.61793619

Why isn't web dev considered programming? What's the logic?

>> No.61793888

How come?

>> No.61794081

And don't use php, peasant

>> No.61794712

If you only need an iterator, though, there's always reversed().

>> No.61794792

Because front-end is mostly decorating and UX.
And back-end is just connecting wires.

>> No.61794955

>Mike Acton
How can a guy that looks dawny not be retarded?

>> No.61795581

>part time work?
Is there other kinds of work?

Name (leave empty)
Comment (leave empty)
Password [?]Password used for file deletion.