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

/vt/ is now archived.Become a Patron!

/g/ - Technology


View post   

[ Toggle deleted replies ]
>> No.72809897

>transexual at the beginning of Bjarne's keynote
discuss

>> No.72809915

i think we all know 0xFF would be pronounced fleventy fleven. but how does one say 0xBD? bifty date?

>> No.72809922

>>72809897
Do you mean the extremely effeminate man or the extremely effeminate male youth he introduced?

>> No.72809934

>>72809922
Kalb is effeminate?

>> No.72809942

if transgender people suffer from gender dysphoria, what do non-binary people suffer from?

>> No.72809945

>>72809915
You say it in the same way you say 0xKYS.

>> No.72809951

>>72809945
i see

>> No.72809959

>>72809942
Undefined behaviour

>> No.72809968

>>72809959
based

>> No.72809981

>>72809942
pretentiousness or self-hate

>> No.72810022

>>72810007
goto/label is the way to Heaven
break/continue/return is the way to Hell

>> No.72810052

>>72810013
>class="deadlink" in the middle of code tags
disgusting
>>72810022
setjmp/longjmp is the way of immortal reincarnation
exceptions are for escapist reincarnation

>> No.72810054

>>72809965
No, it's just that it seems to work perfectly OK for simple projects where you have some source files written in a single language, but in that case a multi-platform POSIX makefile does the job. Otherwise, if you eg. want to do a lot of stuff such as have some files with a custom extension that you'd like to preprocess with some utility and then convert to C header files containing a constant array of bytes that are output of that preprocessor, then you've got to have a lot of luck and be prepared for scouring the documentation for weird little tricks that allow that, while standard Makefiles allow you to do the same thing a lot more easily.

>> No.72810141

this code creates a bmp image of Mario

https://pastebin.com/mtBuc6pP

cc mario.c -o mario && ./mario

>> No.72810160

Isn't it fun that C++ can be optimized better than C

>> No.72810178

If you're not programmin using OCaml you won't succeed in life.
open Num;;

let mk_memo f =
let h = Hashtbl.create 10 in
let rec nf n =
if not (Hashtbl.mem h n) then
begin
let r = f nf n in
Hashtbl.add h n r
end;
Hashtbl.find h n in
nf
;;

>> No.72810233

>>72810199
Probably the same fucker that thought putting std:: before every function was a good idea

>> No.72810261

>>72810233
using namespace std;

>> No.72810266

>>72810246
pls recommend some good haskell tutorial/book

>> No.72810268

>>72810199
It's the boiling frog effect. Just one semicolon is bad but people don't notice until they see two, just like how a frog doesn't realize it's in danger unless the heat is turned up high enough.

>> No.72810291

>>72810266
isn't there a relatively new haskell book
wonder what that one is like

>> No.72810372

>>72810335
>ocamlc should throw an error instead on ;;
No. Compiled and interpreted, the behavior should be the same. I put ;; everywhere because I learned with a guy who does it too, and I won't change a habit.

>> No.72810393

>>72810307
Retarded NEETs

>> No.72810394

>>72810372
based and feudal

>> No.72810395

>>72810303
Because people are retarded (who would have thought, huh? Huh?) and can't understand that they don't need to keep the std namespace separate if they don't create conflciting names.

>> No.72810451

>>72810433
Show us your janestreet badge. If you can't within 10 minutes then you're not an employed OCaml programmer.

>> No.72810458

>>72810451
Not employed by Janestreet.

>> No.72810465

>>72810433
they just need to add a flag, like --my-code-has-communicable-STDs, to permit the ;; for diseased legacy code

>> No.72810467
File: 22 KB, 578x535, bazza.png [View same] [iqdb] [saucenao] [google] [report]
72810467

>>72810433
>maried with a child

>> No.72810506

>>72810467
>>72810479
britbongs detected. hide your kitchenware.
>>72810466
not a fan of non-zero definitions of zero, myself.

>> No.72810510

>>72810496
>paid for writing OCaml code.
+$100K a year?

>> No.72810562

death to america

>> No.72810590
File: 214 KB, 607x399, 1564613848218.png [View same] [iqdb] [saucenao] [google] [report]
72810590

>>72810562
based but not programming related

>> No.72810618

>>72809942
gender dysphoria. same thing just less severe

>> No.72810697

>>72810013
ah yes the
v-
v|=
v|=
v|=
v|=
v+

conveyor belt operator

>> No.72810740
File: 97 KB, 640x640, 1419428434997.jpg [View same] [iqdb] [saucenao] [google] [report]
72810740

>>72810690

>> No.72810826

>>72810697
that is the same as
int next(int v)
{
v--;
v|=v>>1;
v|=v>>2;
v|=v>>4;
v|=v>>8;
v|=v>>16;
v++;
return v;
}

main() {

>> No.72810830

>>72810141
very nice!
now try it this way!
// little-endian
#define BYTE(x) ((x) & 0xff)
#define WORD(x) BYTE(x), BYTE(x >> 8)
#define QUAD(x) WORD(x), WORD(x >> 16)

void header_24bpp(int w, int h, FILE *f) {
// VLA array initialization (length always 54)
// http://www.dragonwins.com/domains/GetTechEd/bmp/bmpfileformat.htm
int stride = 4*floor(3*w/4);
unsigned char header[] = {
'B', 'M',
QUAD(54 + h*stride),
</wbr>

>> No.72810937

>>72810690
Hey I do C++, C, and Java too. Plus webshit if I have to.

>>72810710
We use Zabbix for a ton of stuff, and you’re right, I should learn that too and make something that is actually useful. Thanks, I’ll flesh this out some more, instead of it’s current proof-of-concept state.

>> No.72810947

>>72810022
looking back, all those statements should be inside goto and they should add one for goto function calls, goto next-loop.

>> No.72811101
File: 353 KB, 788x576, 1548711072552.jpg [View same] [iqdb] [saucenao] [google] [report]
72811101

>>72811075
I hope you can at least find some small comfort in programming.

>> No.72811115

>>72810830
nice

>> No.72811142

>>72810988
FreeBSD had to stop using junk memory on the stack to initialize /dev/rand when they switched from GCC to Clang for some reason.

The actual memory layout depends on the system and how the compiler works. Linux kernels try to randomize load addresses nowadays.

To recast memory data:
type var = *(type*)&data;

>> No.72811143

>>72810988
in terms:
dma
virtual memory
stack
dynamic memory
malloc
brk
mmap
in English: on modern OSes, new processes get their own address space. Even if they set a pointer to the same value as a pointer in another process, they'll be pointing at different memory.
the OS gives processes a small contiguous chunk of memory for temporary use. Want to reserve an int's worth of memory? get the value of this pointer and then increment it by the size of an int. Programming languages manage and expose this memory in different ways. Some of them use it only for function call stacks (when you jump into a function, you need to push an address to the stack so that you know where to return to) and use other memory allocations for everything else. But it's generally much more efficient and especially predictable to use the stack when you can, than to use an allocator that might perform some expensive calls every time you talk to it.

>> No.72811317

>>72811042
Guess I'll need to dive deeper then.
>>72811042
>you can't change the type of a variable
I meant like changing an int to a float, in C at least, the memory address seems to remain the same when I do so
>>72811142
>>72811143
I can just barely grasp what this all means.

>> No.72811324

Does anyone have the /g/ programming projects image? If that's what it's called

>> No.72811326

>>72811142
>tfw no reinterpret_cast<>()

>> No.72811330

>>72811317
That's because int and float are the same size

>> No.72811363

>>72811317
You're not changing a variable type, never ever. Variables are stuck in the type they're declared with. What you CAN do, though, is put the memory data contained in a float into an int variable, with all the loss of precision that follows.

When you do
float x = 2.0f;
int y = (int)x;

the variables keep their types, you're just sticking the same data into them, which is then interpeted differently based on which type the variables are.

>> No.72811391

>>72811317
do you mean change 'int' to 'float' in C source code? The only way that could matter is if one had to be aligned differently. Alignment aside, types tell you how much space a object takes up; it doesn't affect where the object starts in memory, which is what the address is.
If you want see addresses change, then vary the amount of stuff you allocate before something. change a char[128] to a char[256] and look at addresses after that.

>> No.72811401

>>72811317
Then please start reading a C book. You're trying to tackle a difficult concept (thousands of programmers lived and died by memory handling) while lacking the basics (I don't mean it as an insult, honest).

>> No.72811417

>>72811401
how memory works is a very simple concept

>> No.72811520

>>72811417
That's why literally nobody has trouble understanding pointers, right?

Kill yourself, fucking asshole.

>> No.72811557

Help, I'm being forced to write Javascript
shiftElement = (arr, index, direction) => {
let [i, j] = [index, index + Math.sign(direction)].sort()

if (i < 0) {
// rotate left
return [
...arr.slice(1),
...arr.slice(0,1)
]
} else if (j >= arr.length) {
//rotate right
return [
...arr.slice(-1),
...arr.slice(0,-1)

>> No.72811630

Why the hell do you retards write C/C++/Rust etc in 2019? Just use Python, it does everything those shitlangs can do and more.

>t. Python programmer making over 200k euros per annum without a CS degree and with only 1.5 years exp

>> No.72811648

>>72811630
python is really slow

>> No.72811682

>>72811648
Most modern computers are fast enough that the individual speeds of programming languages don't even register. You're stuck in the stone age.

>> No.72811683
File: 687 KB, 680x680, madoka_vaporwave.png [View same] [iqdb] [saucenao] [google] [report]
72811683

>>72811674
>how-to-write-four-million-lines-of-python

>> No.72811690

I'm new to systems programming, and lack some general knowledge. Suppose I'm using C99 to build a simple, fast terminal application, it needs to handle persistent data - add new entries to a database and make calculations based on all previous ones.
The expected amount of data to be generated yearly is about 5MiB, as it's only small plaintext entries. The data is somewhat structured - date, timestamp, a few integers and a string per entry. Calculations and visualizations happen on the integers from a range selected by date.

What are the elegant, usual ways to handle this? SQL seems to bloated for this, would some key-value db like LMDB be suited better? Or perhaps some sort of simple native datastructure serialization/deserialization like what I'm used to from scripting languages, loading the entire thing into memory every time?

Again, please excuse the stupid question, the amount of options/libraries/databeses I have to solve this problem just seems infinite to me right now.

>> No.72811735

https://www.mercurial-scm.org/wiki/OxidationPlan
>Startup overhead
Python3 is even worse than Python2 in this respect.
"startup doesn't matter" is the popular wisdom of all the languages that lost out to PHP.

>> No.72811751

>>72811740
Read the entire thing from a plaintext file every time? There has to be a better option.

>> No.72811804

>>72811796
>seething this hard
OH NO NO NO

>> No.72811830

>>72811727
Complexity of project shouldn't factor when choosing a reliable way to store and retrieve data.

How many years is your application supposed to run for? How easy should it be to access the data outside of your application?

Why reinvent a broken wheel by trying to use non-scalable, made-on-the-spot clunky file storage when you can have a scalable, tried and true, standard database?

>> No.72811868

>>72811852
:D

>> No.72811890

>>72811845
>I'd use python for front-end and Rust for backend
so double penetration?

>> No.72811908

>>72811690
Does it have to be reliable? Or update stored data on the fly, or do // Anything like that go with SQLite or similar.

If the requirements are not that stringent then CSV or a flat file may do. It would help if the strings NEVER contain a newline character...

Whatever you do, DOCUMENT THE FORMAT, make data reading/writing a project library (to ease creating export utilities) and make it easy to migrate to other databases.

>> No.72811913

>>72811772
It just feels wrong for some reason.
First of all, it would have to be an array of structs, right?
I take it a hash table would be unnecessary given that I'm mostly doing calculations on all previous entries?
>>72811830
I explained that already. I'm not going to use a solution that requires 10000x the amount of resources that the actual program needs.

>> No.72811925

>>72811913
Good luck, then.

>> No.72811965

>>72811913
>It just feels wrong
well you're using C and C does structs. You said you wanted a non-bloated solution. If you want it to be scalable you can use some sort of associative array or database

>> No.72811974

I have N objects, and a predicate
How do I find, in O(n) runtime, if any two of the objects, when given to the predicate, will return true?

>> No.72811998

>>72811974
Just loop over the objects and run the predicate. If you wanna get fancy with it break when you find the second one but it doesn't affect the big O.

>> No.72811999

>>72811674
First, Dropbox is not what I have in mind when talking about "industrial product".
Second, I find it insane (but not surprising) that a service that should be so simple in terms of implementation turns out to be a bloated piece of shit. I guess you could say the same about Discord vs IRC. Development of the former is more about user convenience and interaction than the core feature. But it's a breach in the KISS philosophy.

>> No.72812002

>>72811979
Rust, nim and C++ are modern language. If you just need a job learn Javascript.

>> No.72812020

>>72811979
if you're unemployed, get a job.
if you're writing software, write it well.
if you're getting paid to write bad software in a shitty language, drink after work and start a project on the weekends. As you learn domain knowledge you could also start working on getting an actually good language to be a functional replacement for the one you're using.

>> No.72812028

>>72811708
Yeah the whole point of python is to use it as glue for better frameworks written in faster languages.

If you look at something like Tensorflow with numpy you'll note that 90%+ of the runtime is running in C++ code and like 9% of it is running in Fortran. The remaining 1% is just pure python.

>> No.72812047
File: 51 KB, 1280x720, 1438024455441.jpg [View same] [iqdb] [saucenao] [google] [report]
72812047

Would it be possible to work on some sort of simple project with other anons? If only for the experience of working in a group with others and to achieve some common goal?

>> No.72812057

>>72812028
people were saying this shit back in the 90s, when computers were actually getting faster at a regular pace.
That's no longer true.
Use a real language for glue purposes.

>> No.72812071

>>72812047
We are very opinionated and disorganized. Maybe you can just pick one of the projects we personally work on and start contributing.

>> No.72812079

>>72812047
>>>/wsr/713823

>> No.72812106

>>72812047
What do you want to work on?

>> No.72812112

>>72812047
people from 4chan are usually fucked in the head and it's not a good idea to work with them

>> No.72812116

>>72812057
>people were saying this shit back in the 90s, when computers were actually getting faster at a regular pace.
>That's no longer true.
This is an inane response. I'm saying that Python allows you to spend less dev-time with more cpu-time in compiled runtimes. Do you think that's not true? Would you like to spend more CPU time in the python interpreter then?

>Use a real language for glue purposes.
Is it not a real language? It's widely used as a glue language, which language do you have in mind where it's easy to create c-bindings?

>> No.72812135

>>72812047
Contributions welcome if you aren't jewish ;)
https://gitlab.com/9898287/events

>> No.72812166

>>72812137
Okay but now you should ask yourself, why would large organizations like Facebook and Google with several millions LLOC in C++ use Python for this exact purpose?

Perhaps there's a reason behind organizing C and C++ code so that you can run it in Python?

I think you're just missing the whole point, you're trading off some miniscule amount of CPU time for a massive gain in dev time. Most of the CPU time will be spent in a compiled C++ runtime. If you look at the design of numerical packages like Numpy, Tensorflow, Pytorch etc. you'll notice a trend.

>> No.72812295

>>72809863
Lisp is the most powerful programming language.

>> No.72812319

>>72812220
>Of course I think it's not true.
Well I'm glad you know something that FB and Google don't. Maybe you should join them and tell them how to effectively run large software projects.

>I must be LITERALLY INSANE to be aware of languages that don't suck.
I must ask, is English your second language? Because this sentence doesn't make a lot of sense. Unless you actually are insane that is.

>Scripting languages are not a pit stop on the progression of language development: they are an unnatural cul-de-sac, borne of strange, temporary conditions. As soon as those conditions ended, people did not stop caring about dev time, but people did start investing in making cpu-efficient languages that are also efficient with dev time. Nim f.e. isn't even marginally less dev-friendly than Python as a language, but it's enormously more efficient because it wasn't designed to be hopelessly unoptimizeable.
Well perhaps you should ask yourself why nobody uses Nim while Python holds a massive market share. Could it be because Python is useful while Nim isn't?

Nobody is arguing that Python is particularly elegant or good, it's an ugly monstrosity but it's extremely useful because of where it sits on the tradeoff curve.

>only if maintenance time doesn't count. Only if bugfixing doesn't count.
I think if you're unable to bugfix a couple of Python lines that mostly offload work you'll have an even harder time in C.

>> No.72812335

>>72812173
I say "industrial product", because for such products (like those memetic Internet of Thingies), Python enables tech-illiterate people to conceive absolute monstrosities that just won't make the cut, like a camera that kinda works, at 2 FPS, with copies all around when it could go up to 30 FPS with the right zero-copy techniques. Of course, they could have done it the same in C++ too, but they wouldn't even have been able to go past the compiling step. Also, people who know their shit could have used a Python framework that is basically just bindings to native libraries to get maximum performance, but you may just as well forget about Python and save hundreds of megabytes in the final system image by coding with the intended language for such a job.

>> No.72812337

>>72812319
Appealing to authority and attacking the person you're arguing with just makes you look like a dumbass, and I don't even agree with him

>> No.72812344

>>72812319
>Well I'm glad you know something that FB and Google don't.
I'm glad you gave me a reason to stop reading this quickly.
Get back to me when you invest a lot of time into some Python shit and then get to invest even more time into rewriting it completely.

>> No.72812345

>>72812220
There's no point in using Nim over Python because you'll be optimizing like <1% of the overall runtime. If you want your Python program to run faster optimize the C libs it's calling.

>> No.72812411

Python is so fucking horrendous they chose fucking haskell to write Sigma in

>> No.72812412

>>72812390
>>72812380
>My shitty hello world project is better than code that serves millions of users every day
Well I'm glad you guys are properly equipped for programming discussions. You can go back to not understanding the basics like pointers now.

>> No.72812436

>>72812412
if you don't know anything at all, you're not wrong to identify and prefer what you think some experts think, over what anonymous people say, but it's no replacement for actual knowledge.

>> No.72812451

>>72812424
>Still failing to understand the "appeal to authority" fallacy
Yeah I know you are.

You couldn't write code that served 10 people let alone a million. It's not a logical fallacy if they're actually an authority.

>> No.72812454

>>72812433
>if assembler is so bad then why does everyone use it for everything?
>if COBOL is so bad then why does everyone use it for everything?
>if C is so bad then why does everyone use it for everything?
real brainlet hours.

>> No.72812459

>>72812425
They're generating APIs because it's garbage? If it's garbage they could just keep their user facing APIs in C++ right?

>> No.72812483

>learn that Facebook and Google are software authorities
>Google makes Go
>Facebook makes ReasonML and Haxe
Reason for webshit frontend
Haxe for webshit backend
Go for servers.
Python for nothing :)

>> No.72812485

>>72812473
I'm not a beginner, I already have
Do yourself a favour and stop blindly looking up to people

>> No.72812509

>>72812499
no

>> No.72812557

>>72812534
I've been selling software for nearly 20 years
And your mom is even prouder of me

>> No.72812567

>>72812551
Every employed dev I know say the fucking hate Python and want it to die, that said they all use it for various things.

>> No.72812572

>>72812551
t. retarded bootcamp freshman

>> No.72812603

>>72812590
this, learn agda

>> No.72812641

>tfw i've never drank soda but i'm still fat

>> No.72812643

>>72812551

weakly typed languages are for babies and making quick scripts to automate tasks, not for serious development.

It only leads to sloppy work and eventually tons of hours of fixing later on because they didn't do it right the first time.

>> No.72812687

>>72812648
>You're lying through your teeth. Reality says otherwise.
No he's pretty much spot on
t. employed dev at large telecom

>> No.72812689

>>72812657
bash

>> No.72812692

>>72812661
what
you should get your retardation checked because it seems to have affected more than just your problem solving abilities.

>> No.72812701

>>72812598
Were you getting soda injections every minute for twenty years straight to get 35 pounds out of it alone?

>> No.72812764

>>72812724
Ah, I see. I've never used Python at work and all my employed friends use C and sepples. We all hate C/sepples and love Python.

>> No.72812765

>>72812689
Yeah that was my first option, just needed to be sure. Thanks
>>72812715
I'm on Windows, unfortunately. Surely there'll be a similar solution in powershell.

>> No.72812766

>>72812743
OK anon, see you in ten years for the "thank God everyone's using Crystal now and Python is as widely loved as Perl6" party. Make sure you bring a few stories about some code you had to completely rewrite because Python just couldn't cut it.

>> No.72812775

>>72812765
Well bash is typically what people mean by a linux shell script if you can get that then you're fine.

>> No.72812821
File: 9 KB, 224x225, 9876546789.jpg [View same] [iqdb] [saucenao] [google] [report]
72812821

The highest paying job I'm most likely to get is a sepples one.

>> No.72812822

>>72809863
http://sortalgos.herokuapp.com
this
almost finished

>> No.72812834

>>72812218
Thanks for the pointers, Anon. Any further reading you would recommend?
And just to make sure one last time, AoS is a sane data structure for this, right?

>> No.72812836

>>72812661
Drop breadcrumbs on every square a queen can attack after placing a queen. Don't place a queen on any square already being attacked, and do breadcrumbs for that queen also. Make the breadcrumbs add up so you can subtract after removing a queen.

>> No.72812848

>>72812661
Just mark the squares as being attacked or not

>> No.72812861

>>72812822
That's really fucking cool anon good job.

>> No.72812873
File: 90 KB, 224x224, 1557538544306.png [View same] [iqdb] [saucenao] [google] [report]
72812873

>>72812821
>The highest paying job I'm most likely to get touched my penis

>> No.72812892

>>72812822
Anone, clicking reset after a sort is complete will reset size and speed to their default values, but the slides will stay where the user put them in the previous iteration.

>> No.72812934

>>72812433
https://docs.python.org/3/tutorial/appetite.html

tl;dr directly from the documentation:
>if you're too lazy to make simple applications on C/C++ or java, python is just for you!
>hey, it's better than shell scripting!

I know python is useful in many situations I'm just being rude

>> No.72812958

>>72812892
yeah there are some ui things I have to fix

>> No.72812970

>>72812359
>cpp
kek

>> No.72813001

I think I chose the wrong language.

>> No.72813026

>>72813001
Luckily you are free to change language at any point

>> No.72813314

>>72813034
go on, sneak in another
what are they gonna do, make you write Enterprise Java?

>> No.72813329

Anyone in the Denver area? Trying to see what the hot new languages in need over there are, wanna make a move in a year and a half or so.

>> No.72813343

>>72813329
C99

>> No.72813344

>>72813329
just go on indeed faggot

>> No.72813352

I like SQL guys what do?

>> No.72813384

>>72813352
do you like sql or do you like the ops of maintaining distributed sql databases

>> No.72813452

>>72813352
Repent and stop being gay.

>> No.72813484

>>72813463
Manchester, love

>> No.72813485

>>72813384
I'm sure it's not that second thing
>>72813463
Nope but if you're hiring I might move there

>> No.72813493

>>72813343
>>72813344
>>72813372
Java/Javascript it is

>> No.72813547

>>72813394
If your system gzip's older logs may need to
for GZ in $LOGDIR/*.gz; do
zcat "$GZ" | grep -q PATTERN && cp "$GZ" $OUTDIR/
done

>> No.72813744

>>72813547
The logs in the folder go far back enough for my client, so I won't need to access the compacted ones. Still, this is really cool info and I'll certainly will use it in the future. Once again, thank you.

>> No.72813889

is the sudoers file important in linux config or not rly

>> No.72813908

>>72813889
>important
to who? for what?
common wisdom would be that it's obviously very important because it controls who can act as what user (not just root, although that's pretty critical) and to what extent (not just any extent, although that's pretty critical).

>> No.72814130

public static void hello_world(){
print("Hello world");
}


how i use this lmao

>> No.72814158

>>72814130
Is this C# or Java?
In Java it's System.out.print(); and in C# it's Console.Write();

>> No.72814274

MIGRATE

>>72814267
>>72814267

>> No.72814294

>>72814263
is there something low level I can do in windows with C that I cannot easily do with a higher level language, I need an excuse to write C

>> No.72814301

>>72814274
we aint hit bump limit yet, leave the thread making to people who aren't complete newfags

>>
Name (leave empty)
Comment (leave empty)
Name
E-mail
Subject
Comment
Password [?]Password used for file deletion.
Captcha
Action