[ 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

>> No.72809915

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

>> No.72809922

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

>> No.72809934

Kalb is effeminate?

>> No.72809942

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

>> No.72809945

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

>> No.72809951

i see

>> No.72809959

Undefined behaviour

>> No.72809968


>> No.72809981

pretentiousness or self-hate

>> No.72810022

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

>> No.72810052

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

>> No.72810054

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


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
let r = f nf n in
Hashtbl.add h n r
Hashtbl.find h n in

>> No.72810233

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

>> No.72810261

using namespace std;

>> No.72810266

pls recommend some good haskell tutorial/book

>> No.72810268

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

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

>> No.72810372

>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

Retarded NEETs

>> No.72810394

based and feudal

>> No.72810395

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

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

>> No.72810458

Not employed by Janestreet.

>> No.72810465

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]

>maried with a child

>> No.72810506

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

>> No.72810510

>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]

based but not programming related

>> No.72810618

gender dysphoria. same thing just less severe

>> No.72810697

ah yes the

conveyor belt operator

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


>> No.72810826

that is the same as
int next(int v)
return v;

main() {

>> No.72810830

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),

>> No.72810937

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

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

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]

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

>> No.72811115


>> No.72811142

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

in terms:
virtual memory
dynamic memory
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

Guess I'll need to dive deeper then.
>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
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

>tfw no reinterpret_cast<>()

>> No.72811330

That's because int and float are the same size

>> No.72811363

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

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

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

how memory works is a very simple concept

>> No.72811520

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 [
} else if (j >= arr.length) {
//rotate right
return [

>> 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

python is really slow

>> No.72811682

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]


>> 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

>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

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

>> No.72811804

>seething this hard

>> No.72811830

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


>> No.72811890

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

>> No.72811908

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

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?
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

Good luck, then.

>> No.72811965

>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

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

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

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

>> No.72812020

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

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]

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

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

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

>> No.72812079


>> No.72812106

What do you want to work on?

>> No.72812112

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

>> No.72812116

>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

Contributions welcome if you aren't jewish ;)

>> No.72812166

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

Lisp is the most powerful programming language.

>> No.72812319

>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

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

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

>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

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

>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

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

>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

>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

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

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

>> No.72812509


>> No.72812557

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

>> No.72812567

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

t. retarded bootcamp freshman

>> No.72812603

this, learn agda

>> No.72812641

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

>> No.72812643


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

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

>> No.72812689


>> No.72812692

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

>> No.72812701

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

>> No.72812764

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

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

>> No.72812766

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

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]

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

>> No.72812822

almost finished

>> No.72812834

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

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

Just mark the squares as being attacked or not

>> No.72812861

That's really fucking cool anon good job.

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

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

>> No.72812892

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


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

yeah there are some ui things I have to fix

>> No.72812970


>> No.72813001

I think I chose the wrong language.

>> No.72813026

Luckily you are free to change language at any point

>> No.72813314

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


>> No.72813344

just go on indeed faggot

>> No.72813352

I like SQL guys what do?

>> No.72813384

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

>> No.72813452

Repent and stop being gay.

>> No.72813484

Manchester, love

>> No.72813485

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

>> No.72813493

Java/Javascript it is

>> No.72813547

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

>> No.72813744

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

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

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

>> No.72814274



>> No.72814294

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

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

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