[a / b / c / d / e / f / g / gif / h / hr / k / m / o / p / r / s / t / u / v / vg / vr / w / wg] [i / ic] [r9k] [s4s] [vip] [cm / hm / lgbt / y] [3 / aco / adv / an / asp / bant / biz / cgl / ck / co / diy / fa / fit / gd / hc / his / int / jp / lit / mlp / mu / n / news / out / po / pol / qst / sci / soc / sp / tg / toy / trv / tv / vp / wsg / wsr / x] [Settings] [Home]
Board
Settings Home
/g/ - Technology



Thread archived.
You cannot reply anymore.



File: file.png (142 KB, 1104x851)
142 KB
142 KB PNG
Actual fucking programming edition.
What are you working on, /g/?

Previous thread: >>61416003
>>
>>61425574
Xth for programming music:

https://www.youtube.com/watch?v=-nC5TBv3sfU
>>
>>61425574
Nice thread :)
I'm writing a bootloader for an NXP microcontroller
>>
Writing a game in Purescript.
Unfortunately my codebase become big enough to make compilation slow, and my macbook air is slow enough to make the development painful.

What should I do? I can get an iMac to enjoy the power, but then I will not be able to code everywhere.
Alternatively, I can use a cloud server+rsync to enjoy the remote power. But I'm not sure how the lag will affect the process, and I don't know how much I will waste setting things up.

What shall I do?
>>
What is the most performance-saving dummy generating method?

openssl rand 1024 -out dummy.tmp


Is what I use.
>>
>>61425574
I finished new raycasting algorithms for my minecraft clone. So far it is more accurate, conciser, more generalized, way faster, and just generally better in every way.

I'm going to work on sprucing up the appearance of the water now.

>>61425669
Fix up your makefile so you recompile less when you make changes. Split your codebase into smaller chunks.
>>
>>61425669
Maybe try programming in a real language where you don't have to recompile the entire project every build?
>>
>>61425725
>Fix up your makefile so you recompile less when you make changes. Split your codebase into smaller chunks.
Will not help, webpack will be building a one huge bundle anyway. And splitting every component into its own bundle would make build config too complicated.

>>61425736
>Maybe try programming in a real language where you don't have to recompile the entire project every build?
Meh, the only real language that will provide a quick change-reload cycle without a different hardware is clojurescript(figwheel is awesome). But any typed flavour of JS, Elm and Purescript are limited by webpack, which is too slow for me.
>>
File: kaskade.png (98 KB, 1359x374)
98 KB
98 KB PNG
Updated my torrent site crawler to search Nyaa.
>>
>>61425574
I just pushed out an FAQ section for the app I work on to 2.2m users...

fucking kill me now.
>>
>>61425985
https://github.com/NotHawthorne/kaskade the script incase anyone is interested. Requires lxml2 and libtorrent-rasterbar but it'll search and download torrents. -tpb for piratebay, -nyaa for Nyaa, both to search both.
>>
>>61425985
Neat
>>
>>61425985
>>61426115
Nicely done Anon!
>>
who else /greenprogramming/ here?

im writing spatial analysis functions that will be used to find the best locations for electric car charging stations, taking into account parking capacity, local population, distance to grid, etc.

i sold my soul for 2 years to the fucking oil corps and it feels so good to be working on something i can actually be proud of
>>
>>61426202
I'm making an app on where to find the most healthy tree to cut down, and also an app to find all the near extinct specie animal to better hunt them.
>>
File: DELET THIS.png (95 KB, 500x378)
95 KB
95 KB PNG
>>61426257

NO
>>
>>61426292
Your pic is extremely offensive to me. Go fuck yourself.
>>
File: shame_cube.gif (496 KB, 250x188)
496 KB
496 KB GIF
>>61426335
>>
>>61426202
Thanks for supporting American fracking anon!

Down here in Texas, I'm really glad that you're switching to natural gas, I mean electric power to drive your cars.
>>
>>61426202
I'd also like to thank you for your support of the lithium industries. I have family in China making bank, and all that electrowinning needed for those lithium batteries and aluminum parts is really good business for the power companies I sell all my fracked natural gas to.
>>
Gentlemen, take a note: this is what JavaScript will do to you.

https://www.youtube.com/watch?v=K7wNpStFPA0
>>
Does anyone actually follow all PEP8 rules?
>E128 continuation line under-indented for visual indent
>E501 line too long (85 > 79 characters)
>>
>>61425674
Why not /dev/urandom?
>>
>>61427401
No line of code should be over 80 characters save for URLs in comments if necessary.
>>
>>61427432
Not him, but /dev/urandom is slow

>>61425674
If your CPU supports AES-NI, this is blazing fast:

dd if=/dev/zero bs=1024 count=1048576 |openssl enc -aes-256-ctr -pass pass:"$(dd if=/dev/urandom bs=128 count=1 2>/dev/null | base64)" -nosalt


(removed redundant dd)
>>
>>61427610
True, but he didn't say it needed to be fast, just not system intensive. You're right that it's probably implied that he's really just looking for a faster method though.
>>
how often do employers actually go to your github? and by employers I mean the average run of the mill no name company that most developers end up working at?
I know Google probably scrutinizes every line of code.
>>
how do i motivate myself to learn qt so i can make a crappy project to put on github
>>
>>61427610
>bs=1024 count=1048576
bs=1K count=1M
>>
>>61425574
Will intro to programming on top of tough teachers for calculus 1 and intro to chem with a 30 hr work week be a bad decision for learning programming ?
>>
General Leo, the brave

Fighterballs edition.
>>
Spent this weekend + today rewriting part of a frontend React application in OCaml via Bucklescript.

I love OCaml.
>>
>>61428096
>>>/wdg/
Wrong thread
>>
>>61428041
nice
>>
>>61428041
Install an integrated terminal, faggot
>>
File: 1492059129942-0.jpg (209 KB, 881x750)
209 KB
209 KB JPG
I'm thinking about creating a protocol & framework for creating TCG games like MTG or Hearthstone. It will have a novel crypto-based backend that allows you to play against another player with a direct connection (no middleman server), yet all the randomization is secure and prevents cheating. You'll be able to load a lisp program containing the rules of the game, which is evaluated in sync by the clients of both players. The goal is to allow anyone to experiment with new ideas for mechanics and rules, design their own sets of cards, etc. It would be amazing if it could replace systems like cockatrice and MTGO, but I'd need help from people who can build nicer GUIs after I finish a proof-of-concept.

However I'm wondering how general such a framework should be. I could make it extremely general, allowing a broad scope of games to be implemented, such as battleships, poker games, maybe even slot machines and multiplayer minesweeper. OR I could design it with TCG games in mind, so that the protocol is simpler, and the UI is more friendly for these kinds of games, but is exclusive to those kinds.

Any opinions, /g/?
>>
>>61425574
How do I write cross-platform C?
>>
>>61428756
Lots of #ifdef's
>>
>>61428756

-Wall -Wextra -pedantic -std=c99 and MISRA C.
>>
emacs, vim, or spacemacs?
>>
>>61425574
Going through K&R

Is there any way I could improve this?
/* Exercise 3.2 - Write a function, esacpe(s, t), that converts
characters like newline and tab into a visible escape sequence
as it copies the string t to s.

Use a switch statement
*/

void escape_to_char(char s[], char t[])
{
int t_ind, s_ind, c;
t_ind = s_ind = 0;

while( (c = t[t_ind++]) != '\0') /*get character at current index */
{
switch(c)
{
/* place escape sequences, if there are any */
case '\n':
s[s_ind++] = '\\';
s[s_ind] = 'n'; break;
case '\t':
s[s_ind++] = '\\';
s[s_ind] = 't'; break;

/* place regular character */
default:
s[s_ind] = c;
}
s_ind++; /*move forward to place the next character */
}
}
>>
>>61428807
vim is incredibly comfy
>>
>>61428807
I'm using emacs with evil right now, it's comfy. It's hard to jump directly into spacemacs since it's basically emacs plus a fuck ton of plugins. I first switched from vim to emacs and decided to learn emacs from the ground up. But now I realize that vim has better shortcuts.
>>
>>61428822
don't lie in your function signature
>>
>>61428863
How am I lying? I'm copying t into s while making escape characters visible... Or am I just being a brainlet?
>>
>>61428822
This might be a personal style choice, but I prefer passing pointers as arguments with the asterisk notation.
void escape_to_char(char *s, char *t)


Other than that, there's nothing off the top of my head to note, really.
>>
>>61428879
what >>61428899 said
There's no such thing as an array argument
>>
>>61428772
>>61428780
Alright cool I stick to misra anyway.
But what about the build system? How do people set up those programs where you go to a website and click "windows" or "linux" and out comes the appropriate build for your system?
Can travisCI do this?
>>
>>61428756

Use cross-platform libraries and don't rely on undefined behavior.
>>
>>61428930
>>61428899
Oh gotcha.

Thanks!
>>
>>61428822
I would do
  s[s_ind++] = '\\';
s[s_ind++] = 'n';
break;

Instead of deferring the statement s_ind++ at the end for no real reason.

It's idiomatic C to do this same thing by incrementing the pointer itself, instead of a index variable, e.g.
  *s++ = '\\';
*s++ = 'n';
break;

I've seen this pattern in multiple C codebases.

>>61428930
I believe that the syntax is still correct, that's totally bikeshedding. K&R is an old book and does a few old C things that people don't do anymore.

>>61428931
If you're using Makefiles, create seperate rules for different platforms, and test them on the target platforms (you could automate this in travis) to make sure the binaries are built correctly. Automatic build systems like cmake have all sorts of options for making things cross platform.
>>
File: 1490204673830-v.png (9 KB, 64x64)
9 KB
9 KB PNG
>>61425637
Just did that as part of my internship
Learnt a lot
Good luck amigo
>>
>>61428958
Like >>61428985 said, consider tracking the position in the string in the pointer itself using pointer arithmetic rather than using a seperate index variable.
Also you might want to indent inside your while loop but that's a style thing.
>>
>>61425574
Did you purposefully forget to free(event)?

Also, why CSFML?
>>
>>61429204
>Did you purposefully forget to free(event)?
there's more code after that (see the scroll bar)
>>
>>61429204
What >>61429230 said.

Also, I just think sepples is ugly and convoluted.
>>
>>61429251
>I just think sepplse is ugly and convoluted
Fair enough, but I guess I mean in comparison to using SDL or Allegro.
>>
>>61429287
Ah, I getcha.
I guess I kinda wanted to expand my knowledge from the usual console output programs and SFML looked like a neat thing to pick up.

Does SDL and Allegro happen to be in native C?
>>
>>61429204

You don't really need to free anything allocated in main, since the program terminates after main ends, and the OS cleans up everything after that.
>>
>>61428822
I'm not too sure how I feel about the other anons suggesting using pointer arithmetic instead of array dereferencing. I always found array syntax to be cleaner to read than a clusterfuck of *'s everywhere. But it's really a nitpicky thing anyway.

"Array" arguments are lies, so I'd recommend calling them pointers.

But I will suggest this:
    case '\n':
s[s_ind+1] = 'n';
case '\t':
s[s_ind+1] = 't';
s[s_ind++] = '\\';
break;

It's a bit less repetitious.
>>
Hrm... I feel I should add something on to that last post. You definitely need to free everything in main if you are:

1. Recursively calling main for some reason.
2. Doing something dumb inside an atexit function that can take forever.
3. Using resources other than memory that may not be cleaned up immediately from the OS.

There is no harm in using free() inside main, but it is not typically required because execution does not typically continue after the main function. For all other functions, all resources should be freed. Using free() in main may help to develop a habit of freeing allocated resources regardless of necessity.
>>
>>61427401
>does anyone [python]
Nobody that matters.
>>
>>61429768
What you should have added is that if your main is calling malloc in a loop it should also free the memory it allocates.
Or you've allocated something so massive you'd page it out if you allocate more memory. That's another good reason to free.
>>
How would you write a function that scans for floats fitting certain parameters? I don't know the alignment of them and I'm reading a binary file. All I have is a marker (ascii string) and I know I'll have zero or more floats in the block before the next ascii string.

I've already written a very ugly version but I'm not happy with it.
>>
>>61428254
I feel like you should focus on card games, but not necessarily just MTG clones.

If you create generalized concepts like hands, decks, field slots, tokens, and cards in your rules, then you should be able to do everything from poker to MTG commander.

I'd resist the desire to make it so general you can program slot machines though. Focus on cards.

It sounds neat though. How would you handle RNG? Would it be through deterministic lockstep of inputs and coherency checks to make sure one player isn't cheating?
>>
>>61428254
Sounds almost completely unnecessary.
Why would you choose to play with someone that's intending to cheat? The reason online games have these issues is because of the way people play games nowadays. What you're doing makes as much sense as anti-cheat for lan. But go ahead. I think it's a cool idea, even if it's not useful.
>>
>>61429868
Post an example of what you're reading.

You say it's a binary file but you also say it has ascii strings?

If it's actually binary use hexdump to show us.
>>
>>61429922
>if it's actually binary
It's binary. It just has some strings as markers. I've read the hex dump and interpreted some of it manually. It's just a lot to process.

I don't see why this would confuse you. Why would a binary file not contain string data? The reason I know I have floats stored is by inspection. There doesn't seem to be a nice system for offsetting off the strings. It must be defined in the binary that reads these.
>show us
Sorry. I can't.

The general question I'm asking doesn't need the file anyway.
>>
>>61429838

Valid points as well.
>>
I'm waiting to get done setting up new es clusters at work so I can pick up doing some tooling go.

I would like to put together a tool to do the majority of our maintenance, emergency and ordinary tasks with a convenient single thing. That way none of us need to write shit by hand and curl it up.

Normally I'd do it in python but distributing that can be a bit annoying.
>>
>>61430012
There's so many variables anon. Are the strings null terminated? Are the floats word aligned? What are the markers? What is the endianness of the binary file? What "certain parameters" are you looking for? Are the floats IEEE754? Are they some dark ages format from before 1980ish?

It's pretty easy to be confused when the person asking for help is working on some fucking SAP shit that he can't show you or can't talk about with any degree of concreteness. Ask the other spooks you work with.
>>
>>61429381
SDL and Allegro are pure C libraries.
>this makes cpp fags happy
>>
>>61430138

Pure C libraries are actually pretty great. It means that you don't have to make a C library wrapping around them to port them to other languages. And C++ never has problems using C libraries.
>>
>>61430112
>null terminated
Technically at least. There's what seems mostly like zero padding but I do find that odd as:
>word aligned
No, the few examples I've done manually indicate no particular alignment. I've found 1, 2 and 4 byte aligned floats. At visual inspection at least. The other stuff is of course valid floats but usually you get stuff like #e-39. Seems unlikely.
>endianess
Big endian
>certain parameters
The routine I had in mind should take a function to evaluate the set of floats. I'm not sure what's relevant yet. Right now the floats I'm looking at look like human edited floats (nice round numbers like 0.1) but I'm sure most won't be.
>format
They're IEEE754.
>ask the other spooks
There are no other spooks.
>>
>>61425574
Playing around in Julia, writing a very basic parser combinor library.

import Base.>>

abstract type ParseResult{T} end

struct Success{T} <: ParseResult{T}
val::T
end

struct Failure{T} <: ParseResult{T}
msg::String
end

## foo :: T -> ParseResult{T}
function eitherBind{T}(foo,res::Failure{T})
res
end

function eitherBind{T}(foo,res::Success{T})
foo(res.val)
end

eitherMap(foo,x) = eitherBind(t->Success(foo(t)),x)

# foo :: (ParseResult{T})
function ifFail{T}(foo,res::Success{T})
res
end

function ifFail{T}(foo,res::Failure{T})
foo()
end

abstract type AbstractParser{T} end

struct Parser{T} <: AbstractParser{T}
parse
end

function runparser(parser::Parser,input)
parser.parse(input)
end

function pchar{T}(charToMatch::T)
function innerFn{U}(str::U)
if isempty(str)
Failure{Tuple{T,U}}("End of String")
elseif (str[1] == charToMatch)
remaining = str[2:end]
Success((charToMatch,remaining))
else
Failure{Tuple{T,U}}(string("Character Mismatch: expected ",charToMatch,", found ",str[1],"."))
end
end

return Parser{T}(innerFn)
end

function andThen{T,U}(parser1::AbstractParser{T}, parser2::AbstractParser{U})
function innerFn(input)
eitherBind(runparser(parser1,input)) do result1
value1,remaining1 = result1
eitherBind(runparser(parser2,remaining1)) do result2
value2,remaining2 = result2
newvalue = (value1,value2)
Success((newvalue,remaining2))
end
end
end
return Parser{Tuple{T,U}}(innerFn)
end

>>(p1::AbstractParser,p2::AbstractParser) = andThen(p1,p2)


function orElse{T,U}(parser1::AbstractParser{T},parser2::AbstractParser{U})
function innerFn(input)
result1 = runparser(parser1,input)
ifFail(result1) do
return runparser(parser2,input)
end
end
return Parser{Union{T,U}}(innerFn)
end

|(p1::AbstractParser,p2::AbstractParser) = orElse(p1,p2)

choice(listOfParsers) = reduce(orElse,listOfParsers)
>>
Mostly fixed my parser up a bit so it produces a better parse tree (structurally, the "pretty-printing" still looks awful).
>>
>>61430244
>There's what seems most likely zero padding.
They're probably not null terminated. The strings have a set size. Pretty common in old computers to have set string sizes in their files and pad out the remainder of the string with 0's.

I don't really have any ideas. Sounds like you're reverse engineering something. I'd just increment through the file one char at a time, reading a float at a time, see if I get a float that passes my standards, and if I do, record where in the file it is and increment the char pointer by 4 instead of 1.

Also worth marking where the padding is and how long it is.

In general I'd want to try to construct a file which contains format information for that file.
>>
>>61425669
Doesn't Purescript support incremental compilation?

>>61428254
Actually interesting. I would suggest also allowing for supply piles to support deck-building games like the Dominion series.
>>
File: 1468311568791.jpg (124 KB, 600x801)
124 KB
124 KB JPG
>>61430305
You using flex and bison?
Also that's the edgiest hostname I ever seen in my entire life.
In a good way tho.
Like some good ol fashioned edgyness only warms my heart in an age dominated by pseuds and pinkpill anime nazis.
>>
Are there any good yet language-agnostic solutions for generic cross-platform modular builds? Would Nix work?
>>
>>61430566
Ragel and Bison, the glue language is D

>Also that's the edgiest hostname I ever seen in my entire life.
>In a good way tho.
>Like some good ol fashioned edgyness only warms my heart in an age dominated by pseuds and pinkpill anime nazis.
T-thanks
>>
Why does Python exist? Why did it get more popular than, say, CL and Scheme?
>>
>>61430781
Fast to get something going, straightforward, simple to use and understand largely, stdlib is pretty good, and lots of good libraries to use for pretty much anything you'd need.

At my work it's usually the first choice for anything operations, tooling or data based, besides Go for tooling/cli applications.
>>
>>61430798
>straightforward, simple to use
I disagree. I think Scheme is straightforward, but not Python.
>>
>>61430904
That's a you problem then, I can't help you with that.
>>
>>61430904
how long would it take you to write a scheme program that does something useful like saving a webpage? not accusing, genuinely don't know. i think python's so popular because it has no real boilerplate
>>
>>61430913
anon pls

I can't bring myself to use Python or Go or JS
>>
>>61431011
I don't blame you for JS, I don't like it too.

The others, not my problem, I have no issue with them.
>>
>>61431009
Probably a couple of weeks, not long at all.
>>
>>61431051
Couple of weeks is an awful lot longer than a couple minutes.
>>
>>61425574
I stopped using Vim the day I saw that there were starving African kids on the Vim home page.
>>
>Two (2) active /dpt/s
Starting master's program next month, gimme a good graduate level book for computer science
>>
>>61430781
You have two sides to the invention of programming languages: the language design and the implementation (science, engineering).
In popular language design you have proclaimed "philosopher-kings", great engineers thinking they have the ability to invent good languages, but lack in the scientific ability.
It is true that Python is a piece of great engineering and generally a pleasure to use because it's pragmatic, has easy to understand tools, has nicely organized automatic documentation, etc. Language design is objectively inferior, Python can still not have an efficient compiler in the present day despite all attempts, while CL and Scheme have them since decades, and manage performance within 2x C, while Python is in 50-100x.
>>
>>61431094
the other one is mostly shitposting
>>
I want a generic way to search files in the file system in a VMDK (search via file name or file hash) I have searched quite a bit but have not found such a tool. Is this something I will have to create? If so would I need to mount each VMDK before searching the file system or is there be a non-mounting way to do it? Would there be a performance hit if I had to mount the VMDKs vs doing it in non-mounting way?
>>
>>61425985
Which Nyaa?
>>
>>61426355
Do you think he believes he's getting magically routed to a solar panel just because his car charger has the color green on it?

He knows where his electricity comes from. Even when it's not renewable renewable it's way more efficient getting your energy from a full size power plant than burning your fuel in the tiny engine of a car.

>>61426732
That's entirely Unity's fault, not JS's. They're not even using a standard JS engine, they're doing some weird shit where they build JS into DLLs.

In fact, apparently it's not even JS, it's some incompatible language with a different standard called UnityScript.
>>
>>61431344
when it's not renewably sourced*
>>
>>61431094
>Two (2)
I really don't understand this meme.
>>
Any good resources for learning Solidity?

Is there money to be made developing contracts on the blockchain?
>>
Anyone here at all familiar with the okhttp3 Java library, specifically its HTTP logging Interceptor and Chain?

Where/how do I initialize the Chain needed for the proceed() method?
>>
>He's using some flavour of the week IDE instead of Vim
Great meme, my friend. :^)
>>
>>61429486
This is C, and event is manually allocated. For every malloc or calloc there should be a free. In C++ this isn't really the case since
sf::Event
is its own class with its own destructor.

>>61425574
What are you making, and why CSFML instead of SFML?
>>
W-Where is Mikoto-chan? ......
I-I just want to pair program with M-Mikoto-chan ...
(つ﹏<)・゚。
>>
>>61431532
kys
>>
>>61431520
Vim is more trouble than its worth and most IDEs and TEs have Vim bindings.
>>
>>61431532

Mikoto is gone forever, because of your autism.
>>
>>61431344
> Even when it's not renewable renewable it's way more efficient getting your energy from a full size power plant than burning your fuel in the tiny engine of a car.
O how wrong thou art.

Efficiency of a car: 14 - 30%. We'll call it 22 to avoid it being embarrassing for electric cars.

Efficiency of a natural gas power plant: 40%
Efficiency of a coal/oil plant: 33%
Efficiency of transmission: 95%
Efficiency of electric cars: 62%
Total efficiency, best case: 23%
Worst: 19%

This is ignoring the costs of manufacturing the cars (electric is much higher), the costs of transporting fuel (higher for oil, highest for coal), the costs of transporting the materials (gotta ship that lithium from Australia & China), and the buying patterns of people who buy them (rich materialistic fucks in commiefornia who buy electric cars just to virtue signal).

t.
https://www.eia.gov/tools/faqs/faq.php?id=107&t=3
https://www.eia.gov/tools/faqs/faq.php?id=105&t=3
http://www.fueleconomy.gov/feg/atv.shtml
http://www.fueleconomy.gov/feg/evtech.shtml

I've actually never calculated the efficiency of an electric car. I knew it would be lower than a gas car but I never bothered. I'm opposed to them on account of what they're made out of. I mentioned fracking just to trigger him. Even though fracking is good for the environment and has reduced the per capita emissions of this country, liberals hate it.

Uh. Programming! Working on my minecraft clone. Adding events to when you place and break stuff. For this, I'm doing very lightweight object oriented design. I guess it fits in nicely in this case since I'm dealing with actual objects.

(define* (make-block-class
block-kind
(break!: break! dumb-break!)
(place!: place! dumb-place!)
(update!: update! dumb-update!))
(lambda (proc . args)
(case proc
((break!) (apply break! (cons block-kind args)))
((place!) (apply place! (cons block-kind args)))
((update!) (apply update! (cons block-kind args))))))
>>
>>61431638
What esoteric programming language is that?
>>
How do I come up with an idea for a project that is actually useful
>>
>>61431710
Use programs.
Find flaws.
Write new software that doesn't have those flaws.
Or
Use open source software.
Find flaws.
Fork it and fix it.
Make a PR.
>>
>>61431809
Also, don't be afraid to make a small program that's useless in the grand scheme of things but could be used to extend other programs.
Like if you find a program lacking a small feature that'd make sense outside the context of the program don't be afraid to write that even if nobody would actually use a program that does just that one thing.
>>
>>61431682
Java 10
>>
>>61425669
>>61430465
It seems like it supports incremental recompilation, I see mentions of it online, and it sounds like this build tool is already using it: https://github.com/purescript-contrib/pulp

>>61431051
>couple of weeks

>>61431638
>Efficiency of a natural gas power plant: 40%
You're probably only considering single cycle gas power plants. Newer designs are significantly higher thermal efficiency https://en.wikipedia.org/wiki/Combined_cycle#Efficiency_of_CCGT_plants
>Efficiency of a coal/oil plant: 33%
This is true, and if this were our only energy source, then yes, this would be a problem, but coal makes up ~30% of US energy production and oil is almost negligible (add them and call it 31%, on par with natural gas).

Even only considering those nonrenewable sources this already beats your figure of 22%. (33+54)/2*0.95*0.62=25.6%. This is *before* counting nuclear, a significantly more efficient (not in terms of thermal efficiency, but environmental impact) source of energy than either of those that makes up 20% of our energy production. And then also the remaining 15% comes from renewables, of course.
>>
Is it possible to tell the quality of software by parameters other than robustness, speed and source code readability/maintainability?

Like, executable size.
>>
>>61431911
memory usage.
CPU usage.
GPU usage
stability.
ease of use.
lack of quirks
etc
>>
Anyone else unironically prefer java 8 to c# / asp.net?
>>
>>61431945
I unironically think they're both fucking shit.
>>
>>61431956
Hear, hear.
>>
>>61431956
true I'm into erlang and C myself but java is the lesser of the devils i find
>>
>>61431911
Some people use https://en.wikipedia.org/wiki/Cyclomatic_complexity

>>61431936
The thing is, some of these are hard to measure objectively
>>
>>61431911

Quality is entirely subjective. Executable size is often a trade-off for other factors.You can balloon the size of the executable through static linking, but what you gain is not having to deal with DLL/dependency hell. Sometimes certain optimizations, such as inlining, can increase the size of the executable, but make the program faster overall. Templates make code re-use easier, and allow you to avoid certain runtime checks, but make the program larger because you are generating a different function for each type parameter. It's not really a matter of bad programming that causes executable size to be larger, but of what tradeoffs are preferred.
>>
>>61431977
>The thing is, some of these are hard to measure objectively
UX is not as subjective as you'd think. Especially when it comes to non-games software.
I shouldn't need to traverse through 4 menus and three drop-downs to find a setting that should be one menu away. Don't split settings into 67 sub-categories that can easily be condensed to 10 or fewer.

You can immediately tell if any animations cross the line from "responsive" to obtrusive. K I S S is universal and timeless.
>>
>>61431911
Functional and non-functional requirements.
>>
>>61431529

I am aware that this is C. I am not talking about resources being freed by RAII. For every program, regardless of what language it is written in, all memory will be freed when the program is terminated, even if the program does not actually request for that memory to be freed. In a C program, while it is generally the case that every malloc or calloc or realloc should be matched with a call to free(), this often is not the case for buffers allocated in the main function. Yes, you are technically leaking memory, but since the program terminates at the end of main, it's irrelevant.

Now I'm not going to say I'll advocate for people to leak memory out of main, only that we don't need to point out people's lack of a call to free() where it is strictly unnecessary.
>>
I made a C++ header that implements base -1+i

http://0xbeef.coffee/posts/post9.html
>>
https://pastebin.com/LE2DJHWu
a twitter bot

Basically my first attempt at creating anything, how much did i fuck up?
what could i do better?
>>
>>61425725
You that guy from YouTube making c++ Minecraft?
>>
File: recording.webm (917 KB, 800x608)
917 KB
917 KB WEBM
>>61431898
The trees are still crying from those fucking batteries in both hybrid and electric car cases. Lithium is pure evil for the environment, and also pure suicide for geopolitics.

Power sources really depends on where you live though. Hydroelectric can't really scale anymore, wind scales horribly and fucking kill me solar panels are an awful scheme of kickbacks.

For most people turning on an electric car means the power plant puts a little more gas in the oven, and shovels a little more coal in the furnace.

>nuclear
I agree sign me up! I want nuclear. Nuclear is a great temporary solution while we work out renewable energy. People who refuse nuclear because it isn't the final solution disgust me. It's like not plugging a sinking ship with a wood dam. Fuck! Wait to do the welding until you aren't about to drown. Only reason we don't do it more is because of the media capitalizing on that dirty laundry. Selling newspapers justified setting the USA back technologically 30 years.

Hydroelectric is alright, but not scalable. But solar and wind are disgusting corrupt messes of kickbacks and lies. People make fun of Trump for calling Global Warming a Chinese hoax, but there's truth in it in that you better believe that China, Russia, and the Middle East all profit greatly off of the US murdering itself by adopting "green" energy.

>>61432258
No. I'm the guy in /dpt/ making a C and Scheme minecraft.

Here's a recording of a couple day old build. You can actually see a raycasting glitch I fixed when a block I place doesn't hit the right spot. Quality is atrocious, but I assure you the game runs well.

FPS: 59.999999
Frametime: 16666667
Thread "FPS": 1237.834026
Thread Frametime: 807862
OpenGL "FPS": 208.230953
OpenGL Frametime: 4802360

Intel Haswell with HD 4400 graphics cards. Pls don't laugh.
>>
>>61432020
> K I S S is universal and timeless.
Is it though for designing user interfaces? Take the type of situation where these types of metrics are most important - where the UI is a massive component of the software project and every little thing has to be accessible through some widget in the UI. I work on the frontend of a monstrous application just like that - it has people whose entire careers are to be trained just to use our software.

There's so many controls and user interface components that a lot of it's more or less standardized so that users don't get surprised when they see new interfaces (and also to save developer time). But there are also critical parts that could be optimized to improve the user experience and save clicks by writing a special interface for it. This is relevant to our users because they're basically clicking through the software all day long. You could think of that like "inlining optimizations" except for the UI.

Except it's got the same cost as inlining - if you inline too much, you run out of instruction cache. Stepping back from the metaphor, I'm saying if you write too many special user interfaces to optimize the experience, your users have to learn too many workflows for the software to be convenient anymore. You've lost the standardization you used to have.

So obviously there's a tradeoff here where KISS doesn't automatically solve our problems.
>>
File: output.webm (2.4 MB, 400x316)
2.4 MB
2.4 MB WEBM
Really starting to think now.
>>
>>61432364

Looks like that evolisa thing, except with lines instead of polygons.
>>
>>61432320
>companies will be against near retard-proof UI's
>managers wouldnt be on your ass to cut maintenance time of using the UI by as many micro-seconds as you can
Nah m8, theres no trade-off with KISS besides eventually, due to size its not as realistic as youd like. Keeping things simple cuts down on many things, especially accidents where somebody clicked the wrong thing, or were in the wrong part of the program because they got confused.

KISS cant really be argued with.
>>
>>61432379

It's much simpler, but the result is still nice. This is an old project, just animating some of my 'generators'.
>>
Adding telemetry to program to find hard-to-find bug on user systems. Whee!

>>61432307
Nuclear's great for supplying base load but not all that great for peaks.
Wind scales nicely, if you're willing to wait for when the power's available rather than stomp feet and demand e-tendies right meow, and if you're willing and able to build some storage for what you might need to store.
It is not the US's role in the world to prevent others from succeeding. It is the US's role to set a good example. If anything, Trump was speaking there for the (((petrodollar))), not for America.
>>
>>61432382
I don't know. I really like vim and it is the antithesis of KISS.
>>
>>61432411
>Adding telemetry to program to find hard-to-find bug on user systems. Whee!
What exactly are you working on? I need to know, so I make sure to never use your software.
>>
>>61432419

Don't worry, he's not spying on your homo doujins.
>>
>>61432415
VIM isnt an end-user application so yeah.
Plus anyone in a development job would be expected to be proficient. Which is why VIM is so famous because high-level users can do a lot.
>>
>>61432419
Relax, you probably never will. I can't say more without doxing myself, but I believe it's an ID 10t error and this is how I find out.
>>
>>61432307
>Lithium is pure evil for the environment, and also pure suicide for geopolitics.
Huh? Lithium production right now consists of simply evaporating water containing lithium salts and extracting it using relatively noncontroversial methods. If you want to talk about controversial ingredients in lipos, cobalt is where it's at.
https://www.thebalance.com/lithium-production-2340123
>Power sources really depends on where you live though.
True, but since we're bringing in energy statistics all we can effectively use is averages, unless we want to bring out double integrals of heatmaps (which the data probably doesn't exist for).
>Hydroelectric can't really scale anymore, wind scales horribly and fucking kill me solar panels are an awful scheme of kickbacks.
True, half true, the last one's kind of true too BUT at this point the price of solar panels has dropped so drastically that all the bullshit that's been going on won't really matter anymore. The progress of semiconductors marches on.
>For most people turning on an electric car means the power plant puts a little more gas in the oven, and shovels a little more coal in the furnace.
True, but on average it's still more efficient today than gasoline vehicles. And certainly better emmissions-wise if you care about that.

Your C/Scheme minecraft project is really awesome btw.
>>
>>61425574
In a tutorial I legally acquired and paid for with my hard earned money someone mentioned some kind of document that set the standard for naming variables. It got me wondering, what other essential papers on computer science or programming are there, or where would I go to look for new significant standards or specifications?
>>
Why is java so complicated? and I don't mean hard
I mean you have to write a bunch of shit for simple stuff like printing a line
>>
>>61429873
alright, thanks for the input. I'm thinking the basic building blocks are going to be zones and entities. Zones are places like decks, hands, battlefield, piles, exiles etc. Entities are card-shaped things within the zones, like face down cards in your deck, face up cards in discard pile, on-battlefield cards with stats like HP, temporary counters, links/arrows between entities, etc. I think this will be simple yet cover a lot of ground. Unfortunately I really only have experience with MTG and I don't want to overlook mechanics from other games. Let me know what you think I might omit.

As for the RNG, basically both players compute lots of random numbers beforehand, and send eachother their hashes so that the numbers cant change. Then to reveal a random number, both players must send eachother one of their random numbers, and they are XOR'd to produce the final result. This is quite powerful, allowing for numbers to be withheld from one or both players.

>>61429921
The anti cheat would just be a small part of it. Mainly its about an extensible card game framework.
The anticheat cryptography means you could also post downloadable replays online, with verifiable signatures, e.g. for records in a competition. Yes, you could just trust all of the players but its not going to be too difficult to add this safeguard, and it will be extremely secure.
>>
>>61432592
Gosling is a hack and the JVM is shit.
>>
>>61432592
(println "hello")
>>
>>61432545
There are a lot of standards bodies in CS. A lot of them are general CS/engineering organizations too. One of the biggest is IEEE, most often referred to for floating point (IEEE 754). For the internet, there's RFCs from the IETF and ISOC, but usually these are low-level internet protocol standards. For the higher level stuff like HTML, it's gone through a lot of bodies - RFCs for the earlier stuff, but the W3C mostly defines it these days. You see involvement from IETF and even ISO though. Both JS (really ECMAScript, but they're effectively the same thing) and C# are standards maintained by a standards body called ECMA.

There's lots of them and they have their own processes. But if you know about them it's easy to find "official" sources of information. Sometimes it can be tough to digest these types of documents, but they're literally always right, so it can be valuable to just tough it through and not bother with some FAQ answers or tutorials sometimes.
>>
File: output5.webm (2.52 MB, 615x409)
2.52 MB
2.52 MB WEBM
Sorry for the atrocious quality, vp8 a shit.
>>
>>61425574
Did they have to allocate that event structure on the heap?
>>
>>61431447
My only guess is it comes from legal writing. It's the only other time I've seen it used.
>>
>>61432983
In vp8's defense, that's a worst-case scenario for pretty much any video encoding format (lots of high spatial frequency data being splattered over the whole image at once). But cool stuff. How does it work?
>>
seed non-crypto PRNG from /dev/urandom or from CLOCK_MONOTONIC?
>>
File: result.png (1.05 MB, 615x818)
1.05 MB
1.05 MB PNG
>>61433022

1. Generate pool of candidates (lines, w/ color & opacity)
2. Pick candidate which reduces error by the greatest amount, and apply to canvas
3. Goto step 1

Very basic approach, but much better results than my similarly designed GA. I was testing whether you could get better quality by increasing the number of lines, or using fewer lines and more candidates.

This result is ~20,000 lines w/ 1,000 candidate each.
>>
File: 1467933407128.gif (269 KB, 146x167)
269 KB
269 KB GIF
void doX(){
//code goes here
}
void doY(func a){
//more code here
a();
//more code here
}
int main(){
doY(doX);
}

Do any languages let you use the functions and methods themselves as arguments (I don't mean return values or passing a class then calling a class method)? I could see a few special cases where it could be useful, but never where it's necessary. Would be nice to have.
>>
>>61432462
Thanks. I gotta stop posting about the environment though. Killing my productivity.

I've reached a point in the project where I finally have to do bit manipulation in Scheme to set render data (in this case data about water blocks). For some reason Chicken doesn't include built in bit manipulators, but here's a quick library for the lazy.
(module bitwise
(bit-and
bit-or
bit-set
bit-shl
bit-shr)
(import foreign chicken scheme bind)
(use srfi-1 lolevel)
#>
#include <stdbool.h>
#include <stdint.h>
<#
(bind-options export-constants: #t)
(bind* "
uint32_t bit_and(uint32_t a, uint32_t b) {
return a & b;
}
uint32_t bit_or(uint32_t a, uint32_t b) {
return a | b;
}
uint32_t bit_shr(uint32_t x, uint32_t n) {
return x >> n;
}
uint32_t bit_shl(uint32_t x, uint32_t n) {
return x << n;
}
uint32_t bit_set(uint32_t x, uint32_t f, uint32_t m) {
return (x & (!m)) + f;
}")
(define (bit-and . args)
(fold bit_and #xFFFFFFFF args))
(define (bit-or . args)
(fold bit_or 0 args))
(define (bit-shr x n)
(bit_shr x n))
(define (bit-shl x n)
(bit_shl x n))
(define (bit-set x f m)
(bit_set x f m))
)



>>61432983
I recognize that General!

>>61433053
Might as well do /dev/urandom. It's just a seed. Unless you're abusing seeds, you're only loading a seed at startup. But clock monotonic should work fine too.
>>
>>61433085
Yes C does. And functional languages like Scheme. C's qsort uses functions and arguments.

Code I posted here >>61433092 actually uses functions as arguments. In bit-and, bit_and is passed as an argument to the "fold" function.
>>
>>61433092
>I recognize that General!

One of history's greatest heroes. God rest his soul.
>>
>>61433067
That's really sweet. Awesome that it naturally draws the background first because that results in the quickest reduction of error.

>>61433092
That's nice that you can integrate with C so easily, since chicken builds to C. I can actually see why this works so well together.
>>
>>61433085
Go and Swift do
>>
>>61433120
>Awesome that it naturally draws the background first because that results in the quickest reduction of error.

It is really neat to watch it work, and if you let it run long enough, the results are considerably better than similar GA-based algos.

I sort of have a love/hate relationship with GAs after I (and a team) came up with a set of unique techniques that managed to play Super Mario Bros very well.
>>
>>61432100
Ah, gotcha.
>>
>>61432603
Interesting... here's a whacko idea: negotiating one shared seed for the whole game among all the players, using a multiparty key exchange algorithm such as this one http://web.cs.ucla.edu/~dakshita/Dakshita_Khurana_Home_files/KRS-15.pdf
Once a seed has been established for a pseudo-random stream, everyone keeps track of the game history and consumes random numbers from the stream according to the game rules and players' choices, possibly censored. Thus you provide the same sort of guarantees of continuity and reproducibility as with git commit ids, and additionally allow some level of tamper-proof offline play, at the cost of sharing part or all of every player's state across all players of a game.

>>61432951
>ECMA
Also, Office Open XML is, or was, maintained by ECMA.
>>
>>61433067
Also, maybe try taking taking a small set of the best candidates each iteration and generating a set of slight variations to use as final candidates (then pick the top as usual)?

So, not quite a GA at that point, but borrowing some conceptual elements from one just to try to reduce noise in the final selection process.
>>
>>61431544
What do you suggest.

I just got my debian looking average but the programming installation is still new to me. Never touched or programmed c++ or C.
>>
>>61433053
whynotboth.jpg

>>61433085
What, like JavaScript?
>>
File: 1468366788066.png (35 KB, 279x380)
35 KB
35 KB PNG
>>61433092
Oh well shit I had no idea, never saw anything on it, but I know very little C so far anyways.
>>61433148
No intention to learn them but it's nice to know I'm not crazy for thinking about it.

Cheers mates
>>
>>61433168
This may not be important depending on the type of game, but wouldn't that allow players to predict event which are meant to be random?
>>
File: 7590.png (573 KB, 396x600)
573 KB
573 KB PNG
>>61433171

That's a possibility I hadn't considered -- sort of like a GA inspired "two-pass" on the top cands. Of course, there's a limitless number of techniques like this that could be applied.

Currently running the Mona Lisa right now, this is 7,590 lines w/ pool size of 3,000.
>>
>>61432307
Looks great
>>
>>61433191
stop doing image bullshit
do something new!
>>
>>61433206

At this point, I hardly even know anything else. I know image processing and breathing.
>>
File: duck.jpg (11 KB, 330x330)
11 KB
11 KB JPG
rate my github

http://www.github.com/paperduck
>>
In a simulation, would you say the difference between rolling 2 4-sided die or 2 6-sided die is significant?
>>
>>61433191
That looks great, man. It's really surprising what you can make with lines across the whole image (humans are terrible at it). If you do end up trying that method, post pics. I gotta go to sleep, but keep doing you.
>>
>>61433230
maybe you should put down visual studio and pick up photoshop
>>>/gd/
>>
>>61433183
Hmm. With full knowledge of the engine and the game, the next few random actions on one's turn could be predicted. That could be mitigated by the active player discarding numbers from their stream once every few seconds and/or based on UI events, and including that discard count in the game log for other players to then simulate as they lock-step their copies of the game state. But then someone could wait, or discard while pretending to wait, for favorable digits before performing their action, just like on /b/. Hmmm.
>>
File: 17360.png (559 KB, 396x600)
559 KB
559 KB PNG
>>61433251

17360 lines

>>61433269

I'm already pretty handy with Photoshop, actually.
>>
><Remote compilation failed: Error sending request>
does anyone still think everything will be web apps? waiting for an unresponsive web app respond is insufferable. even just browsing the web can be infuriating, not because you have bad internet but because some servers are down or slow and "good" sites are still much slower than using a native local application
>>
>>61433269
>>61433300
>not gimp
>>
>>61433168
The problem with seeds is that you can just preemptively PRNGs and then see into the future, e.g. see what cards you will draw.
I'm almost certain my scheme is going to work. Basically both players share a majority of state (which is dictated by the deterministically defined game rules), except for some pieces of state are secrets which may be known by only one party until they are revealed by the other party.
The algorithm works like this: player 1 & 2 generate random numbers A and B. They send hashed versions of the values to eachother, so that when they disclose A or B, they can verify that neither player cheated (e.g. by selecting a new number). The actual value of the random number R = A xor B, but since both players only hold one of A or B, they have no idea what R is. If player 2 sends B to player 1, then player 1 can compute R = A xor B, but player 2 still can't (for example, when player 1 draws a card but keeps it to himself). If both players communicate to eachother A and B, then they can both calculate R, which neither could have previously calculated (for example, rolling a dice).
>>
>>61433323

I actually used GIMP for quite some time when I primarily used Gahnoo/Linux.
>>
>>61432307
What are you using to handle input and for the OGL context?
>>
I'm generating strongly typed code (ocaml) and I need some way to take a user defined function and associate it with a string. My first idea was to use a Hashtable and an anonymous function, which seemed to work, until I realized all the functions would have to take the same number of arguments and all arguments must be the same type.

Do any of you have a solution? How do I into weakly-typed hashtables within Ocaml?

Example of erroneous code:
let hashtable = Hashtbl.create 255;;
Hashtbl.add hashtable "fuck" (fun e -> e + e);;
Hashtbl.add hashtable "cunt" (fun e d -> e ^ d);;
>>
>>61433427
SDL

Been working more on block state. Successfully added stateful water. In this case, water now has the state added so that the renderer only fills it up partially, unless there's another water block on top.

As you can see there's some OOP-lite going on.
(define (water-update/pure kind world state x y z . extras)
(bit-set state
(+ (if (equal? water (finite_getneighbor world x y z TOP))
0
#x8000)
6)
#x8003))

(define (water-update! kind world state x y z . extras)
(finite_alter world kind (water-update/pure kind world state x y z) x y z)
'prop)

(define (water-place! kind world state x y z . extras)
(finite_alter world kind (water-update/pure kind world 0 x y z) x y z)
'success)

(define water-class (make-block-class
water
update/pure: water-update/pure
update!: water-update!
place!: water-place!))
(define glass-class (make-block-class glass))

Now I have to add support for blocks being updated when their neighbors change. And speedup the code I just wrote.
>>
>>61433604
What are the functions being used for?
>>
>>61428041
>== true
for what purpose?
>>
>>61433621
They're just generated by my program and thrown at the ocaml compiler. The specifics are up to the end-user, so long as their input is valid.
>>
>>61433648
any ocaml function?
>>
>>61433667
Yes, any valid ocaml function. int -> int, float -> int, string -> string -> string, etc.

If there is a way to emulate this idea without speed loss, (doesn't require writing a weakly typed interpreter to go along with the generated code and serializing all the functions to strings), I'd be okay with the any alternative.
>>
>>61433648
You could use Obj.magic or a sum type.
>>
>>61433648
I barely know OCaml, but if Obj.magic is too unsafe for you, since these functions are generated, you can unify them under a single function type that takes a list of parameters (the type of the list being a sum type I guess). This kind of thing is how it would work in a lot of other type safe languages.
>>
>>61433722
Also however, that does come with a speed loss over each function call that you wouldn't get from Obj.magic. And if your parameters can be a lot of types it could get hairy...
>>
File: ange.png (585 KB, 2000x1519)
585 KB
585 KB PNG
OH GOD IT HURTS MAKE IT STOP WHAT EVEN AM I DOING AAAAAAAAAAAAAA

#include <stdbool.h>
#include <stdio.h>

// X = Value, Y = Mutable
#define __let(X, Y) _Generic((X), \
/* Basic */ \
default: _Generic((Y), \
false: void, \
default: const void), \
void *: _Generic((Y), \
false: void *, \
default: const void *), \
...
false: short, \
default: const short), \
short *: _Generic((Y), \
false: short *, \
default: const short *), \
int: _Generic((Y), \
false: int, \
default: const int), \
...
double _Imaginary: _Generic((Y), \
false: double _Imaginary, \
default: const double _Imaginary), \
double _Imaginary *: _Generic((Y), \
false: double _Imaginary *, \
default: const double _Imaginary *), \
long double _Imaginary: _Generic((Y), \
false: long double _Imaginary, \
default: const long double _Imaginary), \
long double _Imaginary *: _Generic((Y), \
false: long double _Imaginary *, \
default: const long double _Imaginary *) \
)

#define _(X, Y) __let(X, Y)

typedef union let
{
void;
char;
short;
int;
long;
float;
double;
} let;

int main(int argc, char **argv)
{
let stupidshit = _((char* )"lol this is so fuckign badf", true);

puts(stupidshit);

stupidshit = "wow the string changed this is l33t h4x";

puts(stupidshit);

let morestupidshit = _((int)69, false);

stupidshit = "ok lets end this abomination of a \"\"\"\"program\"\"\"\"";

puts(stupidshit);

return morestupidshit == 69 ? 0 : 1;
}
>>
>>61433794
>prgoranm
>>
>>61433794
>c
hehehehe
>>
>>61433794
>c
Stop.
>>
>>61433682
>>61433722
>>61433733

Thanks, Anons.
>>
do you know any repos for software projects that can be used with microwave ovens, or electric grills, or toasters, or stuff like that to automate cooking? I got me a soldering kit and an Arduino, I'd like to try some fun unusual things.
>>
File: 1490451652679.jpg (46 KB, 438x720)
46 KB
46 KB JPG
I can't figure out why this is looping infinitely, shouldn't the count be stored on the stack just dandy, eventually reaching 100, and then the jne no longer jump?
section .data
text db "Praise the Omnissiah!",10,0
looplength db 100

section .bss
count resb 1
section .text
global _start

%macro print 1
push rbx
push rax
mov rax, %1
push rax
mov rbx, 0

%%printLoop:
inc rax
inc rbx
mov cl, [rax]
cmp cl, 0
jne %%printLoop

mov rax, 1
mov rdi, 1
pop rsi
mov rdx, rbx
syscall
pop rax
pop rbx
%endmacro

%macro exit 0
mov rax, 60
mov rdi, 0
syscall
%endmacro

%macro recall 1
mov rax, 0
%%loop:
push rax
print text
pop rax
inc rax
cmp rax, %1
jne %%loop
%endmacro

_start:
recall looplength
exit
>>
>>61434002
I don't, Anon, but with a few pan, tilt, and yaw servos, you could make an automatic spatula.
>>
File: 1433539161515.webm (1.36 MB, 540x360)
1.36 MB
1.36 MB WEBM
>>61434014
kek I could flip burgers in my face with that yeah, but I was thinking about a way to automate things like temperature or power and cooking time, things like that.
>>
>>61433175
VS Code.
>>
>>61428041
use constants
>>
Why processor prefer generating an interrupt when a division by zero occurs instead of checking if divisor is 0 and then set a flag?
>>
>>61434226
Because, much like a memory address that does not respond, division by zero is not defined and has no valid answer, therefore the instruction cannot complete. Also because setting condition codes can take time, especially with floating point units. Why shouldn't user code just compare the divisor with zero before dividing if it can't guarantee otherwise, which it often can?
>>
File: gorefeldt challenge.png (95 KB, 537x265)
95 KB
95 KB PNG
Is there any benefit to pre-allocating files before writing to them? The only thing I can think of is that you won't encounter any write errors related to the disk being full but it seems like you'd have to write twice as much data that way, once for the allocations and again to fill it. Why do this?
>>
>>61434226
because div by 0 is an error that should not occur on any condition.

>>61433605
github?
>>
>>61433242
not much stuff to see but algo is interesting. is python popular in japan?
>>
>>61434317
So you can ensure that the space is available for use, as while writing large files the user may write data of his own that makes it so your file will no longer be able to fit.
>>
>>61434317
pre-allocation could avoid creating a new file on each modification.
>>
>>61433092
Chigguns scheme uses procedures from Common-Lisp. Logior, logxor, ect. Remember Lisp has arbitrary size VS trying to squash it into an unsigned 32bit int. I'd just use the builtin procedures for shifting/boolean operations
>>
>>61434317
Reducing the risk of fragmentation. If your writing little bits of the file on and off for a long period of time, theres more chance the file will be strewn across the disk.
>>
Is Python worth learning for webdev?
>>
>>61434317
I'm pretty sure preallocation is standard. Shell redirection does it by default, etc.
>>
>>61434673
no more relevant with ssd.
>>
>>61434822
>magnetic storage is somehow depreciated
No, retard.
>>
>>61434838
>magnetic storage is somehow depreciated

never i have said that. but, with a ssd, pre allocation actually does more wrong than good.

>>61434838
>retard
why always so mean? please watch this https://streamable.com/lownv
>>
>>61434822
>ssd storage

retarded
>>
>>61425574
i'm learning c and i'm writing a chip8 emulator
>>
>Used to writing in Vim
>Spend like 5 minutes typing out a post
>Press Esc out of habit
>Delete post
Fucking hell.
>>
thinking about writing an irc client in rust with the win32 api
>>
>>61425574
I hope this isn't too off-topic, but since this is /dpt/ I guess that most people here are programmers.
>What are you working on, /g/?
Getting a job.
I'm currently applying for a software developer job at a company and they want me to do a 4 hour "coding challenge" where I have to solve a bunch of tasks they give me. Has anyone ever done something like that? What are the kind of tasks I can expect, is it some babby recursive fibonacci shit or will they do their best to fuck me up?
>>
>>61434861
>pre allocation actually does more wrong than good
Source on this?
>>
>>61434983
>win32 api
Are you a masochist?
>>
>>61434976
fuckin fag
>>
>>61434992
Nope, didn't do anything technical at all.
>>
>>61434994
a ssd never rewrite a file in place to avoid using the sane memory cells too much
>>
>>61435004
I'm told that GDI is actually pretty comfy for writing a UI.\

>>61435036
If that all happens at a translation layer below the SATA block address anyway, how's it matter?
>>
File: 1453304848381.jpg (42 KB, 712x712)
42 KB
42 KB JPG
I'm trying to look up an optimal and efficient solution for a problem.
For the sake of the example, lets say I'm trying to match up males and females. Ideally, I want as many males matched up as possible. However, each female will only accept a male from a certain set.
There are no assumptions about the number of males or females. There could be more males, more females, or the same amount.

e.g.
males = { M1, M2, M3, M4 }
females = { F1, F2, F3, F4 }

F1 accepts { M1, M4 }
F2 accepts { M2, M4 }
F3 accepts { M1 }
F4 accepts { M1, M3 }

An example optimal solution would be
M1 with F3
M2 with F2
M3 with F4
M4 with F1

Is there a name for this type of problem?
>>
>>61434992
they probably just want to make sure you don't suck balls at programming
>>
>>61435084
try googling Sharia
>>
With C, is it implied that the address of the final element is greater than the address of the first element in an array?
>>
>>61435110
Get your sandnigger shit out of here.
>>
>>61435136
Yes
>>
>>61435084
constraint satisfaction problem
>>
>>61435004
What? Win32 API is incredibly well documented and simple to use, I'll never get the meme that it's bad.
>>
>>61435084
cisbinaryheteronormative patriarchy
>>
>>61435065
https://en.wikipedia.org/wiki/Write_amplification
>>
>>61435196
Do you think my problem would be P or NP-complete?
I could realistically brute-force this, as I would expect a normal worst-case to be 6 males and 8 females, but I still don't really want to do that because it just feels shitty.
I'm not sure if dynamic programming would work.
>>
>>61435084
Monogamy or what?
>>
>>61435315
No. Each male needs 1 female.
>>
>>61435225
It comes from the fact that it's quite extensive and has a lot of redundant features owing to the fact that old features must be retained to preserve backwards compatibility. It can be a little overwhelming for a new developer to process all the information, but I agree that it's really easy to work with if you know what you're looking for.
>>
File: 1498396518124.png (25 KB, 657x527)
25 KB
25 KB PNG
I just got B this semester on data structures
Who here smart like me
>>
File: Capture.png (8 KB, 639x61)
8 KB
8 KB PNG
Web programmers are a cancer and we should gas them all.
>>
>>61435381
Fix your English.
>>
>>61435387
>Javascript
>Simple
>>
>>61435364
This

>>61435225
It's not bad in itself, it's just that there exist a gorillean different frameworks and legacy shit that are there to preserve backwards compatibility. Take driver development for example, the Windows driver model is overwhelming as fuck. Not only are there kernel drivers and usermode drivers, there are also difference in device drivers, generic device drivers, generic drivers etc. Then there's different frameworks to do different stuff. Then there's different debuggers, you can use lk or windbg or both.

The problem I have with the documentation is that it's either too encompassing (as in tl;dr because it's too much to read), or that it's too simplistic (as in, do these and these steps and follow them exactly, no room for options here).

Of course, if you're already familiar with one framework, I guess you like that it is still maintained even when they make new frameworks. But getting started is very overwhelming.
>>
File: Capture.png (13 KB, 668x283)
13 KB
13 KB PNG
>>61435387
This is the "complicated" code btw.
>>
>>61435392
haha Brainlet and his Cs
>>
>>61435327
That's what monogamy is faggot.

Check out for replies later, I'll try to think it out.
>>
>>61435416
>That's what monogamy is faggot.
Oh right. I was thinking of polygamy.
>>
>>61435405
Why would you make an Array rather than just using [] notation?
Why would you put strings in your array only to convert them back to numbers with unary+?
>>
>>61435405
Why not just store them as numbers in the first place
>>
>>61435405
what's wrong with that though? other than using a different language, how would you improve it?
>>
>>61435425
>>61435427
No that was just to demonstrate. He was commenting on the actual algorithm.

>>61435439
All other answers were people sorting arrays. This is a single pass, much faster.
>>
>>61435416
>>61435084
Actually, thinking about my actual problem, I realise I got what the optimum is backwards.
I'm not trying to maximise matched males, I'm trying to maximise matched females.
I'm really trying to match some different hardware resources with each other.
>>
>>61435471
With monogamy the problem is symmetrical: you can optimize for both males and females with same result.
>>
>>61435084
If multiple solutions exists, do you need them all or just one?
>>
>>61435486
Just one.
>>
>>61435396
I find that MSDN is pretty straightforward really, a typical WinAPI page will have the function definition, a list of parameters and what they do, an example short code snippet, and any additional notes on any quirks/behavior the function may have. You rarely need more/less information than is provided.
>>
>>61435381
dumb frogposter
>>
https://www.youtube.com/watch?v=TOIaWMCXzYo
>>
>>61435084
I think this is similar to the eight queens problem. You just use backtracking to find the solution.
>>
>>61435586
>just use backtracking
I thought it would end up doing something like that. I was just hoping there was something more efficient.
>>
>>61435604
Thinking about the problem more you could do something like this

while not all males have been paired do
m <-- fetch male with least amount of female directions
match with female
remove connection
end
>>
>>61435670
Would that be guaranteed to be optimal?
>>
>>61435691
I dunno, you would have to prove it.
>>
>>61435691
Of course not: you will probably not find a match for picked up male and you may find a match for him you you rearrange other connections.
>>
>>61434012
Are you too inept to use a debugger or what is the problem here?
>>
>>61435322

So when is the supposed "deadline"?
>>
>>61435084
Here is what I though out: you pick up list of preferences and do this:
- pick any possible preference from list i
- find optimal solution for rest of preferences
recursively. If you have N lists of preferences of size M you will do it in O(M^N).
>>
>>61435268
CSP problems are NP-complete, but if the set of solutions is dense in the domain of the problem, solvers heuristics can find a solution very quickly. The most difficult thing being modeling the problem.
>>
>>61429018
I'm doing it for an internship too! I'm having a lot of fun at this company, the work is good and I'm learning a whole lot!
>>
a method that enables the computer to "reason" about 3d models and map functions on it.
>>
File: running_river.jpg (190 KB, 540x773)
190 KB
190 KB JPG
Question about reductions:

Reducing problem A to problem B means that problem B is at least as hard as A, if not more so.

If I can reduce sorting to some other problem X, I know that X has a lower-bound of Omega(n log n).
Is that lower-bound guaranteed to be tight? It shouldn't be right? Because X is only known to be at least as hard as A -- implying that it could be harder, and have a longer run-time to boot.
>>
>>61435387
he's right.
>>
>>61436232
into the gas chambers with you.
>>
made my android app say "hello faggot!"
wish me luck on my way to become a professional java poo dev guys!
>>
>implementing skeletal animation
>every implementation tutorial I see does a multiplication with the inverse of the rootnode
>somehow it only works for me if I multiply with the rootnode instead of the inverse
I truly don't know why. It doesn't seem like my coordinate system is at fault.
If I multiply by the inverse I just get a model that is upside down, pointing to -y .
>>
File: kaskade.png (41 KB, 845x186)
41 KB
41 KB PNG
Added -max arg. Gonna add functionality for SkyTorrents searching next. Also on my list of to-do's,
>get descriptions of torrents
>download and open .torrent files for sites who don't have magnet links on the search page
>>
>>61436172
Reducing A to B means A cannot be harder than B (well at least if the reduction is not harder than B itself, but it wouldn't be a reduction then).
"Hardness" here is meant in terms of upper bounds. Reducing sorting to X only means that sorting cannot have a bigger upper bound than X. But since you don't know the upper bound of X, that says nothing about the tightness of its lower bound complexity.

Since optimal sorting is O(n log n), if you want to prove that X is also O(n log n), show that X is reducible to sorting.
>>
>>61436404
openGl has y pointing down, directX up I think
>>
>>61436488
not really.
>>
>>61436566
https://stackoverflow.com/questions/4124041/is-opengl-coordinate-system-left-handed-or-right-handed
>>
File: vg1P7.png (58 KB, 667x544)
58 KB
58 KB PNG
>>61436600
>
yeah y sure is pointing down
>>
which language is the superior meme slob
>>
File: 1403028573264.png (506 KB, 604x453)
506 KB
506 KB PNG
>>61436625
>but of course I just take the first picture I see without reading shit or giving a fuck about context to make an argument
>>
>>61436642
>context
>deprecated fixed function crap
kys
>>
>>61436652
this is pointless. I win, sophist
>>
>>61436666
kill yourself retard
>>
>>61435387
This is the correct view to have on optimization.

Stop wasting hours doing something that essentially worthless. Only optimize if the current performance isn't acceptable.
>>
>>61436625
>hand-draw a picture
>this somehow proves something about how a software program behaves
>>>/s4s/
>>
File: 1416612864901.png (117 KB, 320x263)
117 KB
117 KB PNG
>>61436673
>kill yourself retard
>>
>>61436682
>https://stackoverflow.com/questions/4124041/is-opengl-coordinate-system-left-handed-or-right-handed
>>
>>61436680
why would you waste hours optimizing post hoc when you could just adopt stylistic practices that allow you to write code that's already optimized from the moment you write it
>>
>>61436600
doesn't change anything about my problem (if I even have one, since everything is working right).
The tutorial uses opengl also. The difference is, I am using glm.
I think the tutorial is just wrong.
>>
>>61436715
Why would you even optimize at all?
>>
>>61436708
>the image did not convince him
>quick post an unrelated url
>>>/s4s/
>>
>>61436715
Obviously, you should "preemptively optimize" by writing sane code, and making sane decisions about what you're writing. Using threading and async where applicable, buffering before calling I/O instead of calling I/O on tight loops, etc.

But there's a difference between writing code that is sand and easy to read, and writing code that is perfectly optimized the first time, regardless of readability and the potential time investment needed to analyze what would perfectly optimize that code.
>>
>>61436735
because faster is inherently better in and of itself regardless of whether or not there are any tasks it makes more feasible
>>
>>61436736
>unrelated
>>61436600
>>
>>61436756
Exactly. That's why I don't bother optimizing. It's better to code faster.
>>
>>61436729
i'm not sure what your'e doing but try v*m instead of m*v. you don't need the inverse in that case just use the appropriate m*v or v*m

the other anon is retarded, in modern opengl you only need to care about the NDC coordinate system, which is trivial, the rest you program yourself
>>
>>61436782
but writing code that runs faster is better than coding faster
>>
>>61436782
>>>/g/wdg
>>
>>61436819
Why? Computing time is cheaper than human time.
>>
>>61436485
Thanks, that's pretty intuitive.

Is it fair to say that there may be scenarios where sorting is reducible to X, but X is not reducible to sorting?
>>
>>61436839
>million people using webapp that takes 5 seconds to load
>one faggot hipster taking his time to not write the application in framework of the week
Not everything is just a bash script you run only once
>>
>>61436839
because we should be striving to make less demand of technology over time to accomplish the same tasks, not more
>>
>>61436879
Except it isn't 5 seconds. It's 10 milliseconds.
>>
>>61436903
t. somebody who has never used software
>>
>>61436903
kill yourself delusional cunt
>>
even 10 ms is noticeable and it's a lot more than that in your shitty webshit

https://discuss.emberjs.com/t/why-is-ember-3x-5x-slower-on-android/6577
>>
>>61436903
see: >>61436898
>>
>>61436950
Read the original post we were discussing. It was clearly stated that the difference was between 10ms and 3ms.
>>
>>61436903
And when you're rendering something at 60 FPS, that's 5 ms of your strict 16 ms window.
>>
>>61436989
those are fake numbers that the retarded pajeet pulled out of his ass. if it would take 10ms for the tiny example input i'd be worried. and it'll quickly become more than 10ms on larger input. kill yourself brainlet.
>>
>>61436990
Again with these strawman arguments. The original post had nothing to do with rendering.
>>
>>61436861
Contraposition of >>61436485: if X is harder than sorting, then there's no reduction from X to sorting.
>>
>>61437016
The point was that wasting that much time is a big fucking deal. 5ms for a computer is fucking ages.
>>
>>61437016
web browsers RENDER web content you insufferable RETARD KILL YOURSELF
>>
>>61437024
Ah, of course. Thanks for all the help.
>>
File: consider.jpg (29 KB, 600x600)
29 KB
29 KB JPG
new thread
>>61437065
>>
>>61437034
What does that have to do with anything?
>>
>>61437087
the original post was about javascript webfaggotry. you're beyond clueless or you're a paid google troll to get (You)s so you can get machine learning training data through the captcha or you literally belong in a psychiatric ward
>>
>>61437117
What does the javascript in the original post have to do with rendering?
>>
File: 060.png (80 KB, 500x475)
80 KB
80 KB PNG
>>61437149
here's your (You)
>>
>>61437171
Looks like you ran out of arguments then.
>>
>>61437185
no, you're just plain dishonest, the web browser is doing the rendering, if you're using javascript outside of a web browser you're beyond pathetic and it will be hilarious to see you homeless in the streets of san fagcisco in a year or two
>>
https://en.wikipedia.org/wiki/Homelessness_in_San_Francisco
>Reasons cited for homelessness in the 2015 survey commissioned by the City include job loss (25%),
>>
>>61437207
>web browser is doing the rendering
Exactly! The web browser is doing the rendering, not the javascript. I'm glad you finally get it.
>>
>>61437249
yeah and the performance of your unoptimized javascript code has nothing to do with the user experience. got it.
>>
>>61435773
Yeah I dont know how to use the debugger in nasm




Delete Post: [File Only] Style:
[Disable Mobile View / Use Desktop Site]

[Enable Mobile View / Use Mobile Site]

All trademarks and copyrights on this page are owned by their respective parties. Images uploaded are the responsibility of the Poster. Comments are owned by the Poster.