/dpt/ - Daily Programming Thread

What are you working on, Sup Forums?

Old thread:

Other urls found in this thread:

rust-lang.org/en-US/friends.html
github.com/kud1ing/awesome-rust#applications-written-in-rust
github.com/servo/servo
en.wikipedia.org/wiki/X32_ABI
docs.oracle.com/javase/8/docs/api/java/util/Properties.html
lxr.free-electrons.com/ident?i=pte_t
blog.flameeyes.eu/2012/06/debunking-x32-myths/
en.cppreference.com/w/c/language/arithmetic_types#Boolean_type
pubs.opengroup.org/onlinepubs/009695399/basedefs/stdbool.h.html
twitter.com/NSFWRedditVideo

...

Functional Programming Thread:

Are there any real projects where Rust is used?

anyone?

The new browser from Mozilla?

rust-lang.org/en-US/friends.html
github.com/kud1ing/awesome-rust#applications-written-in-rust

and you ruin a perfectly good pic. thx op for fucking up christmas

should I learn Swing or JavaFX?

Neither.

Swing is deprecated, AFAIK, so JavaFX must be better.

not programming on vacation fuck off

Then you fuck off. We're not going to not create a thread just because you're on vacation you little shit.

xD fuck programming amirite

What new Mozilla browser?

github.com/servo/servo

>64-bit only
Why?

32bit is deprecated

>2016
>32-bit
Not everyone is a retarded winfag.

But everything works just fine.

It won't forever.
It bothers me that there are going to be idiots like you still using 32-bit computers in 2036.

>2036
2038*

>implying time issues are caused by 32-bit computers, but not by wrong choice of time storing value

It doesn't matter when they picked the value. It just means that the problem would happen at some other time.
64-bit makes the range so large, it'll literally be hundreds of billions of years before it's an issue.

Even then, there are plenty of other reasons why it's stupid to target 32-bit (x86) computers.

I suppose it's not possible to create some OS for smartphones that wouldn't be slow?
What would be your ideal smartphone OS?
If there were some cheap smartphone-like device with ROM BASIC, would it be nice?

At least on x86 running 32-bit code is generally faster than 64-bit due to smaller pointers and smaller opcodes (i.e less data and instruction cache pressure).
There are cases where the reverse is true of course, like heavy usage of > 32 bit arithmetic, or certain algorithms where more registers are useful, but they tend to be rare cases.

Could someone please expand on what the following C code means:
pte_t *pte = myMemoryAddress;
if(pte-> &~_PAGE_RW)
{
pte->pte |=_PAGE_RW;
}

I can't even find the right query to google to get an answer. From my existing understanding its flagging the memory page as read writable, what i dont understand is the operators used in the conditional.

Did you forget a pte?
pte->pte & ~_PAGE_RW
This tests for all bits not set in _PAGE_RW

Yes i did for it, and thanks; so & == bitwise comparison then ~ == not?

Sorry, never had to work with bitwise operations in C# before.

>At least on x86 running 32-bit code is generally faster than 64-bit due to smaller pointers and smaller opcodes
There is FAR too much going on to be able to day a massive general statement like that.
Also, x86 is missing a bunch of instructions added in AMD64 and things like all of the SIMD shit added.

>If there were some cheap smartphone-like device with ROM BASIC, would it be nice?
There are plenty of ARM dev-boards out where, Raspberry Pi 3 is pretty much typical smartphone with ARM8 and 1Gb RAM.The only thing they lack is GSM/3G/4G chips, but you can buy it as a separate module.

& stands for bitwise AND
~ stands for bitwise NOT
| stands for bitwise OR
^ stands for bitwise XOR
Do you even boolean logic, man?

>day
I don't even know how the fuck I made that mistake. Maybe I clicked the wrong option on a correction.
Anyway:
make*

No i've never had to use it before. I just remembered || was or and && was and. Never had to touch the others.

Except that 32 bit would limit the browser to only using 3.5gb memory.
The way modern web development is going, that's barely the Hello World framework microservice library microtransaction.

Let's face it, it's perfectly normal for web-pages to gobble memory like they had diabetes, and DDR was an acronym for Delicious Diabetes Remedy.

Also, we've had 64 bit CPUs now for about a decade. And they work with older 32-bit software. So there's no reason to hold back anymore.

I hope you're just learning C.

> There is FAR too much going on to be able to day a massive general statement like that.
Not him, but this is basically a common knowledge, 32bit is generally faster, that's why stuff like x32 ABI for linux exist - en.wikipedia.org/wiki/X32_ABI .
> x86 is missing a bunch of instructions added in AMD64 and things like all of the SIMD shit added.
Most of the new instructions, AVX including, are available from 32-bit mode.

day 2 my friend, no need for the passive aggressiveness.

Not him, but you shouldn't have mentioned C# here, bitwise operations are just as useful in both languages. You're giving C# users a bad name.

Is there a more elegant way of storing this data in Java files, without the need for external libraries?

//new ExtractableObject classes need an entry in these two maps
public static Map identifiers = new HashMap();
static {
identifiers.put("Substance", "R");
identifiers.put("SubstanceSynonym", "RN");
identifiers.put("Company", "FI");
}
public static Map parameterkeys = new HashMap();
static {
parameterkeys.put("Substance", new String[] { "RecordIdentifier", "Node ID", "CAS Code", "EU Index Code", "EINECS Code", "GADSL Duty to declare", "GADSL isUnwanted", "GADSL isProhibited",
"isReach", "isHidden", "isDeleted"});
parameterkeys.put("SubstanceSynonym", new String[] {"RecordIdentifier", "Node ID of basic substance", "Synonym ID", "ISO Language", "Synonym"});
parameterkeys.put("Company", new String[] {"Record Identifier", "Company ID", "Company Name", "Street", "Postbox", "Country Code", "Postal Code", "City", "Is Deleted",
"Is OEM", "Duns - Number"});
}

am I mistaken or does C++ lack a direct Swing equivalent?

is there a flag for gcc to have it not get rid of 'dead' code when optimizing?

Should I learn F#?

Is F# related to OCaml the same way that Scheme and Racket are related to Lisp? Is F# just an OCaml dialect? Or am I being dumb?

docs.oracle.com/javase/8/docs/api/java/util/Properties.html

Consider using one or more Properties files, and just load it on startup.

Doesn't use external libraries, and actually works.

Lua or Harskell?

>what is Qt
Yeah, why not. F# started as OCaml for .NET, but since then it added a lot of unique and interesting features.

Then it's fine.
Bitwise operations operate with bits, each bit for each bit.
AND gives 1 on both 1 operand bits
OR gives 1 on any 1 operand bits
XOR gives 1 only if one of bits is zero and the other is one.

So, construction
pte->pte |=_PAGE_RW;

sets all bits in the pte->pte by the pattern given in _PAGE_RW.
Cheers!

>scripting language vs multi-purpose functional language
No shit.

Rust.

Thanks that clarifies it well, also is there any documentation on the page table entry struct? I can't find anything for it.

Thanks, I will take a look at it.

Another question. I have a HashMap. How do I access the first value of the String[]?

Sup Forumsengineer here

i dont know you guys like this autistic shit

I gave up after knowing my 10k line code was fugged by a ";" and it took me all day to find out

ffug Sup Forums

>I gave up after knowing my 10k line code was fugged by a ";"

>what are IDEs

lxr.free-electrons.com/ident?i=pte_t

I'm setting up a vichan instance to prepare for moderation policy tests (I want to see just how hard or easy it would be to make Sup Forums great again with pure proper moderation and policy change). I'm almost done aetting up but the host is kind of a shit and perms are fucked so I had to manually finish the install process.

There were no outstanding errors or warnings beside the perms issues and associated failures at step 4 of install, and everything seems to work beside one partially important issue: trying to upload files resultin the text "embedding error" appearing instead. I see the json, thumbs and db contents appear correct though.

Any idea what's wrong?

how do i directly connect to sql .db file from python?

>that's why stuff like x32 ABI for linux exist
I know about x32. Nobody really uses it though, as the benefits aren't really worth it.
After a quick search about x32 benchmarks, people seem to think that the performance gains aren't really there.
blog.flameeyes.eu/2012/06/debunking-x32-myths/
>Most of the new instructions, AVX including, are available from 32-bit mode.
Yes, but on 64-bit processors.
If you're using a "normal" 32-bit x86 processor, you cannot guarantee that those instructions exist, and you're forced to cater to the lowest common denominator.

open()?
I believe there's some ODBC driver.

>tfw to smart too receive replies

-fno-dce -fno-dse -fno-tree-dce

-Og

these do absolutely nothing

this enables code elimination

I have -Og enabled and it would be useful to 'unset' the -fdce flag

apparently, not all flags have a 'no' variant

have you put -Og before or after the fno?

before

Working on a sixel encoder/decoder, just finished with the encoder, trying to figure out how to compress shit even further, seems to be impossible tho.

That image when converted to sixels is 7.1MB large, it takes a shitton of time to generate but less to render.

Why do need to enable 10 language extensions to write anything useful in Haskell?

Base level Haskell already competes with most other languages. Extensions are just like super saiyan.

> Base level Haskell already competes with most other languages.

What bout strings tho?

Anyone good with OpenGL here? I has question.

pack

I'm learning Django.
How about you ask the question and see if someone replies?

I guess I can try that.

I'm wondering if it's possible to have a large number of textures in GPU memory. Like thousands.

I know there's often a limit on how many shaders you can "bind" in OpenGL, like 16 or 32.. and I gather that just limits how many textures I can render with one draw call. But I'm wondering if I make 100s of draw calls a frame, can I a thousand different textures without having to copy them to and from GPU each time I change the bindings?

#include

What kind of language can I make to be it useful?

The amount of textures bound at the same time is limited by the number of texture units.
You can have more textures in GPU with most of them unbound.

Also, if you need a lot of 2D textures, I think you could use a 3D texture (it's a collection of 2D ones).

Make a proposal to the C++ committee to add non-trivial designated initializer lists for arrays in C++17.

Make a proposal to the C++ committee to add static_if in C++17.

Pure functional that allows for direct memory management with guarantees

if constexpr is in C++ 17

Don't bother, you can't save the language.
It needs to fucking crash and burn; the sooner the better.

>direct memory management with guarantees
>System runs out of memory
What now faggot? Pretend it succeeded?

I just don't get why they don't add such a basic and useful feature to the language that has existed in C since 1999. What the fuck is their problem

malloc :: Representable a => Memory m (Maybe (Pointer a))
or
malloc :: Representable a => Memory m (NPointer a)

Take this gibberish to /fpt/ and keep it there.

It's a type signature, user.

this is better:

malloc :: (MonadMemory m, Representable a) => m (Maybe (Pointer a))

malloc ::
the type of malloc is

(MonadMemory m, Representable a) =>
Where m has a MonadMemory instance, and a has a Representable instance

m (Maybe (Pointer a))
A monadic action in m, returning a Maybe (Pointer a)
i.e. it might return a pointer to a, or it might not

>i.e. it might return a pointer to a, or it might not
Then it's not a guarantee then is it, it's just a retarded version of C stdlib malloc which does the exact same thing.

I know C is all about being as small of a language as possible, but bools should really be in the language

I didn't mean one that guarantees allocation, I meant that guarantees stuff like no GC if you manually allocate a bunch

And unlike C's malloc, you would make sure
Pointer a
Cannot be null. So if you want nullptr, you need
Maybe (Pointer a)
And if you pattern match on that, and get some Just p, then you know it's not a nullptr

bools are cruft dreamt up by enterprise jerks

Why?
It's flexible just without them.
I've even forgotten why bools even existed.

C isn't a very small language desu.

CPUs don't have anything like bool. C isn't about being small, it's tailored to the way CPUs work. Switch statement is the perfect example.

CPU don't have anything like structs, enums, loops and functions either, yet C has them. There is really no reason to leave bool out, and they realized it when they added _Bool and stdbool.h in C99.

Why it's some external library but not some internal type them?

Pointers of different types would be a better example - those are just byte sequences with occasional padding(afaik fasm has structs).

I agree. It doesn't make sense to make an enumeration for it.

It's an internal type called _Bool - en.cppreference.com/w/c/language/arithmetic_types#Boolean_type , stdbool.h header just aliases it to bool.

Because the type system is weak anyway and it's still going to use !0 to check for truthiness.

Just use an int.

pubs.opengroup.org/onlinepubs/009695399/basedefs/stdbool.h.html

OH MY GOD HOW WILL WE POSSIBLY SURVIVE WITHOUT THIS IN THE BASE LANGUAGE

>Just use an int.
I'll use a char, thankyouverymuch