[Boards: 3 / a / aco / adv / an / asp / b / bant / biz / c / can / cgl / ck / cm / co / cock / d / diy / e / fa / fap / fit / fitlit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mlpol / mo / mtv / mu / n / news / o / out / outsoc / p / po / pol / qa / qst / r / r9k / s / s4s / sci / soc / sp / spa / t / tg / toy / trash / trv / tv / u / v / vg / vint / vip / vp / vr / w / wg / wsg / wsr / x / y ] [Search | Free Show | Home]

/dpt/ - Daily Programming Thread

This is a blue board which means that it's for everybody (Safe For Work content only). If you see any adult content, please report it.

Thread replies: 324
Thread images: 35

File: 1481234393653.png (102KB, 1000x1071px) Image search: [Google]
1481234393653.png
102KB, 1000x1071px
What are you working on, /g/?

Old thread: >>57935681
>>
Anime is not real
>>
>>57941115
jan 20
>>
>>57940946
>foo . ass . dick $ penis 9
FTFY
>>
File: 200_s.gif (16KB, 292x200px) Image search: [Google]
200_s.gif
16KB, 292x200px
Can we talk job prospects?
How do you get a job as a software developer if you're self-taught and you don't have a degree?

Because pretty much every job listing requires a bachelors in CS.
>>
>>57941131
how much time do you have before you're homeless
>>
>>57941131
Do you have an impressive project portfolio? Take a look at the companies that you're applying to and try to hazard a guess as to what kinds of applications they'd need, then try to write something comparable that you can put on your resume.

https://youtu.be/6G3kQyqMFpQ

Mobile app companies will be ecstatic if you have a few mobile apps.

Video game companies will love you if you have a few video games.

etc etc.
>>57941141
Don't listen to this faggot
>>
I've been on this site for 10 years.
>>
File: 1473908054683.png (173KB, 500x313px) Image search: [Google]
1473908054683.png
173KB, 500x313px
>Rust loop labels
>>
>>57941141

Most of these are terrible places to live.
>>
>>57941243
YOU ARE FUCKING LOSER LAMO
I BET YOU HAVEN'T FELT HAPPY IN ALL THIS TIME
LMAO
I BET YOUR LIFE REVOVLES AROUND WAKING UP EVERY DAY AND GOING TO WORK, ONLY TO HATE THE TIME
LMAO

YOU COME HERE BECAUSE YOU NEVER LEARNED PROPER SOCIALIZATION
YOU NEVER INTEGRATED
YOU JUST DRIFTED AWAY

LMAO
>>
>>57941131
>work at mcdonalds
>get bachelors degree
>still cant find a job
>go back to mcdonalds and work to pay off student loans

america must be hell on earth
>>
>>57941141
That's essentially a laundry list of the scuzziest countries possible without actually going as far as the third world.
>>
>>57941298
I'm happy with my gf.
I'm co owner of our company so i can do whatever i want without constraints.
I come here to talk to you guys.
>>
>>57941304
Fortunately, you'll get put out of your misery soon enough when some /r9k/ autist spergs out over his McNuggets and shoots up the place.
>>
Should I go with Rust or Idris?
>>
>>57941483
Depends which you prefer between intensional and linear type theory, I guess.
>>
>>57941483
for meme lang?
>>
>>57941503
I don't know what those are, friend.

I've used Scala and Haskell, I like the latter more but it's easier to get paid to use the former.
>>
>>57941518
Then you'll probably prefer Idris.
>>
>>57941515
For what to learn.
>>
>>57941131
There's a fella I know who is self taught that worked at the tech company I interned at for a summer. The company is a SF startup so its not like he was in a shitty spot. I think he might have gone to an accelerator school but maybe not. I think he just had enough skills and was able to show them to people.
>>
>>57941528
Thanks.

I must admit the lack of advanced type system features in Rust disturbs me. It's like they're designing it to be obsolete.
>>
>>57941558

What type system features do you feel are needed in a systems programming language, that are not present in Rust?
>>
>>57941602
Basic things like being able to abstract over type constructors.
>>
>>57941558
I think they want to have HKTs and such but can't come to an agreement on how to implement them.

People meme about Mozilla a lot but this may actually be a case where the Rust devs are trying to be too inclusive to opinions. It took a long time to settle how untagged unions should work because some people thought it should be a struct attribute (I agreed with this), others thought it should be an enum attribute, and the rest thought it should be something new entirely (this is what they picked).
>>
>>57941620
They don't get a pass just because they say they have good intentions. The language is already obsolete. It's DOA.
>>
File: ill fuk ur mom son.jpg (27KB, 335x493px) Image search: [Google]
ill fuk ur mom son.jpg
27KB, 335x493px
>>57941243
lol fucker get rekt son

Coulda spent those 10 years working out and getting laid like me
>>
>>57941647
Not very impressive for 10 years of working out. Maybe put down the candy bars, kid
>>
>>57941558
>>57941620
It's kind of irritating that they picked what they picked because the struct attribute solution would have been so easy. A union is just a struct with every field at the same address, after all. But no, this was too hard for people to understand, since structs are usually product types and unions are more like sum types.

>>57941640
I would love to have HKTs too in an ideal world but I've never really found I needed them for the stuff I'm doing.
>>
>cbSize [in]
>Type: UINT
>The size, in bytes, of a RAWINPUTDEVICE structure.
God damn it Microsoft.
>>
This is a Fibonacci function, you fucking plebs. Perhaps you can tell me why you think it works.

int64_t fib(uint8_t n)
{
if (n <= 1) return n;
/* if n is greater than 92, fail */
if (n > 92) return -1;
n -= 2;

uint64_t a = 1, b = 1, c = 0, d = 1, e = 1, f = 0;

while (n) {
uint64_t g, h;
if (n & 1) {
g = a * d + b * e;
h = b * d + c * e;
f = b * e + c * f;
d = g;
e = h;
}
g = a * b + b * c;
a = a * a + b * b;
c = b * b + c * c;
b = g;
n >>= 1;
}

return d;
}
>>
>>57941619

And what is this useful for?

>>57941668

You shouldn't move to a country for job opportunities if the country is terrible to live in.
>>
>>57941726
The same reason generics are useful.
>>
>>57941723
Just reposting because posted in old thread..
>I wanna record the render state of my opengl application for debug purposes. So at first I thought I'd just copy the framebuffer to disk every frame. That failed, clearly doesn't have the memory bandwidth to do that effectively.
>So I'm now considering alternatives. I'd like to save the frames continuously for at least 4-5 seconds back in time. Throughout the application and have them be accessible when I open the debug mode. Shadowplay is a thing. They're saving tons of footage all the time and they're doing it at high quality. Any way I could ask the driver to do the same for me except in a more controlled manner?
>If not that what would be a good cheap compression algorithm for the gpu. Just something to get it down from a stupid large bitmap size to something manageable.
>Also as an aside does anyone know how I could get or reproduce the full fragment shader inputs afterwards? Because ideally when I inspect the frame I'd like to have data saved so I can look at a fragment and deduce what happened in the shader from that. It would be such an amazing tool for finding a lot of issues.
>One way would obviously be to save the entire set of render commands and reproduce the frame. I'll try that for now but of anyone has ideas that'd be great.
>>
>>57941329

you do have constraints. the constraints are your customers.

oh, you dont have any customers?

go write a Fibonacci sequence in haskeel u slime
>>
File: 1478342403370.png (74KB, 1162x850px) Image search: [Google]
1478342403370.png
74KB, 1162x850px
>>57941745
>america is infinitely worse to live in. a libcucked country full of fags, millennials, nazis, and SJWs
good. less piece of shit gun hating euros like you crowding up our voting system
>>
>>57941745
>millennials
No, Anon. You are the millennials.
>>
>>57941755
What's wrong with those?
>>
>>57941141
There's plenty of non shit places that don't think degrees have values.
Like central and northern Europe.

Norway would be a good place to look for work. Being the best country on earth and all that.
>>
>>57941755
Whats the idea behind _t? I don't even know what it stands for. I'd assume type but that's a bit redundant.
>>
>>57941745

There's nothing wrong with the LGBT, millenials are everywhere, and most people aren't on the extreme ends of the political spectrum. America is the richest and freest country on the planet, and if you're living on a developer's salary, everything that sucks about this country doesn't apply to you.
>>
>>57941809
What's a developer's salary for central Jersey?
>>
>>57940702

In C#

        public static void Main(string[] args)
{
BinaryValues(3);
}

public static void BinaryValues(int n)
{
for(int i = 0; i < Math.Pow(2,n); i++)
{
Console.WriteLine(Convert.ToString(i, 2).PadLeft(n, '0'));
}
}
>>
>>57941668
Who are you calling permacucked faggot?

You're the one that thinks you're a worse programmer than Pajeet.
>>
>>57941817
On the contrary, there is nothing wrong with straight white gay men.
>>
>>57941829
It isn't gay if you are wearing a skirt.
>>
>>57941840
Can I legally own an AK-47 in any of those countries? No.
>>
>>57941848
An alpine shithole full of Italians and French.
>>
>>57941843
Pretty much all of them actually. Pretty sure. I'm unsure about new Zealand.
>>
>>57941716
This is a Fibonacci function you fucking plebs. Perhaps you can tell me why you think it works.
import Control.Monad.State
fib = flip evalState (0, 1) . (>> fmap fst get) . ($ const (uncurry ((put .) . ap (,) . (+)) =<< get)) . forM . enumFromTo 0 . subtract 1


See, I can write unnecessarily complicated code too!
>>
Just spent 15 minutes trying to figure out why shit wasn't working only to realize I had an "X" where a "Y" should be.
>>
>>57941868
The first one is efficient.
>>
>>57941868
I didn't find that other version particularly complicated.
>>
>>57941901
>the best privacy laws

toppest fucking kek
>>
>>57941868
how are you sho good at making these obsfucated haskell code
>>
>>57941817

>kill yourself
No you. Most of the LGBT are pretty decent people. There is nothing inherently morally/ethically wrong with being attracted to someone of the same sex.

>objectively false
The term "millennial" refers to anyone born within a certain range of dates. By definition, there are millennial in every country.

>>57941818

Wouldn't know. I don't live there.

>>57941840

Countries that have less billionaires than the US, which do not have as high of a total GDP as the US.

Although I will admit that they are at least decent places to live, especially when compared with those recommended by the other Anon.
>>
>>57941918
autism
>>
File: output3.webm (3MB, 512x512px) Image search: [Google]
output3.webm
3MB, 512x512px
>>57941094
just made this in processing, my first proper OOP and java thing
>>
is there any difference between java's "virtual machine" (or whatever it is called), and c#'s clr?
>>
>try to make a screen filling HTML canvas
>resize listener doesn't work and the canvas doesn't hug the screen edge
I should probably just make it have a fullscreen mode, however I do that.

>>57941840
New Zealand isn't richer.
Plus, we're no longer high on freedom rankings after 8 years of John Key's idiocy.

>>57941843
You can in Switzerland and New Zealand, although New Zealand law requires that the weapon be stored in inoperable condition and when used can only be used with blank rounds.
Not that it matters if you have to store it in inoperable condition, if you have a way of restoring it in just a few seconds; it's still usable for home defence and emergency preparation. And you can have a semi-automatic for home defence instead, don't see why you'd need an AK47 for anything but total anarchy.
>>
>>57941930
What is this kind of effect called?
>>
>>57941939
>requires that the weapon be stored in inoperable condition and when used can only be used with blank rounds
C U C K E D
>>
>>57941951
"Stop, thief or I'll make some very loud sounds and we may both end up with tinnitus!"
>>
>>57941961
I suppose it's better than only being allowed a rape alarm like in the UK.
>>
>>57941940
it's a grid of dots that scale depending on how far away the mouse is (the dot size is can als obe adjusted by clicking), as for the proper name, closest i can think is
https://en.wikipedia.org/wiki/Moir%C3%A9_pattern
>>
>>57941951
>>57941961
Well if you want to compare favorably on US gun policies vs other places in general concealed carry is something that's fairly rare.
>>
>>57941992
You can come out of the closet now.
>>
>>57941992
>also wrong
I'd like to hear what's inherently amoral about consensual sex between consenting adults.
>>
why is /pol/ shit spilling on here?
>>
>>57942016
I'm not Daddy.

I also didn't spend $300 on a pony plushie.
>>
>>57942022
Out new moot isn't good at sewage management it seems.
>>
>>57942031
>all of it
So sex is amoral? That's an interesting view. I don't see how it makes lgbt people particularly responsible.
>>
>>57941961
Why would you use an assault rifle for home defence?
There's all sorts of other perfectly good guns that you are allowed to store in full working condition, and you'd be truly unfortunate to encounter a thief carrying anything dangerous enough that a pocket knife couldn't scare them away.

Thieves here are kind of a joke, and pretty rare.
Last robbery I heard of happening to anyone I know was someone breaking the lock of a door then stealing some lamb and beer. They somehow got caught in the end, even though there was no one home.
And for some reason, only $2 stores seem to get shoplifted enough that they put pictures of the thieves on the windows.
>>
>>57941931

Functionally, both accept bytecode and class metadata as input, and JIT compile it into machine code, which is then executed.

The standards for how each does this are obviously different.

https://en.wikipedia.org/wiki/Java_bytecode_instruction_listings
https://en.wikipedia.org/wiki/List_of_CIL_instructions
>>
>>57942022
Just report it
>>
File: 1481258738446.gif (490KB, 408x230px) Image search: [Google]
1481258738446.gif
490KB, 408x230px
>RegisterClassW suddenly failing with ERROR_NOACCESS consistently
>>
>>57942155
>windows.h
>>
>>57942155
>practically no help online because it's winapi
I don't understand how people develop for the windows platform. It's terrible.
>>
>compile my project for windows
>have to add a half-dozen libraries to the linker
>>
>>57941755
>not using <stdint.h> when bitshifting

Prepare to get assfucked.
>>
>>57942202
Stdint is very different from what the name bignum/bigint would imply.
>>
>>57942174

I recommend drinking everclear straight from the bottle while programming using the Win32 API. It'll lessen the pain.
>>
Win32 is a work of art
>>
>>57942217
You're the one driving a /pol/ discussion here.
Also its impossible for me to be Ruby as I posted within one second of the person with actual tripcode. Clearly not the same.
Again proving how you're actually mentally problematic.
>>
>>57942247
>writing trivial software
Is basically what you're admitting to.
If you don't have performance constraints your shit could be auto generated. You will be the first people we replace.
>>
>>57942301
>Can't even distinguish posters.
Anon come on. Him and me are clearly not the same.
>>
Feels Good Man
>>
>>57942260

>all of it
This doesn't actually address my question. I am asking you to name a moral wrong that is caused by homosexual sex, not which part of homosexual sex is morally wrong.

>in every possible way
Then I will ask that you enumerate some or all of the possible ways that gay sex causes harm to innocents.

>americuck """economists""" whose job it is to perpetuate the MEME
And what do you claim is the standard means for measuring a nation's economic strength, used by every country with the exception of the United States?
>>
>>57942360

That is a filter list, not a report.
>>
Here's an exercise for your guys:
Write a program that will output every series-reduced tree with n vertices, each as an adjacency matrix.

Who's feeling Good Will Hunting?
>>
Want to write a simple chat program in Python, what module should I use?
>>
File: Affine_Dynkin_diagrams.png (14KB, 693x265px) Image search: [Google]
Affine_Dynkin_diagrams.png
14KB, 693x265px
>>57942383
why don't you work out the adjoint representation of these dynkind trees for affine semisimple lie algebras? Thats more goodwill hunting
>>
>>57942443
>>57942443
cmon senpai
>>
>>57942433
You should use Google to find that out you stupid little shit.
>>
Jesus so this is what DPT is like during Yank hours. shamefru
>>
>>57942469
this knowing some definitions and applying linear algebra
culture wars are more interesting
>>
>>57942469
Yeah, but I don't low-key need that program written.
>>
>yfw tic tac toe is hard to do elegantly in functional langs
>>
>>57942579
I don't know what you're talking about. If it's a turn-based game, it's the easiest shit to program.

If you're talking about doing UI, that is horseshit in every language. Use a graphical framework that lets you load layouts from files.
>>
>>57942579
Just use the state monad
>>
>>57942600
>monad
buzzword
>>
>>57942621
You mean a monad in the category of monads?
>>
>>57942505
Indeed. Just look back a >>57931702
And browse. It's so much better than this shit show.
>>
>>57942626
It's a monoid in the category of endofunctors that's a monoid in the category of endofunctors
>>
anyone here /hates-hack-code/
thanks haskell, I now can't use simple recursion, which in my mind means that if it wasn't able to be abstracted with something like foldl, then its the wrong way to do it
>>
>>57942632
holy shit it's night and day
>>
>>57942600
I don't undestand it.
>>
>>57942653
it's really simple

x <- get
-- get the state and bind it to x

put y
-- set the state to y

ta-da
>>
>>57942579
https://www.youtube.com/watch?v=vWSBGD96BHU
>>
>>57942579
The guy does it p. well in this book
>>
>>57942696
gets does something different in Haskell
gets gives you back a function of the state, e.g.

x <- gets read
-- get the value of the state with the function "read" applied
>>
>>57942724
good post
>>
>>57942682
yeah, but, state isn't a thing in haskell
you pass around values
>>
>>57942724
are you reading my code, senpai?
>>
>>57942743
you use the state monad, it's like doing this

x0 ->
x0 = val
x1 = func(x0)
x2 = func(x1)
-> x2
>>
>>57942757
this makes no sense to me
>>
>>57942651
Yeah it puts America in a whole new light honestly. The recent election for instance. There's a clear opposition to change among the Democrats. But they vote in Trump who is at least claiming to have a more national focused work force with him opposing h1b1's during the republican debates for instance.
Americans simply can't compete is the issue. Even in the high skill labour force. It's surprising really.
>>57942652
Anon you need to learn adult sleep patterns. Especially on weekends.
>>
>>57942791
it's simple

x0 - initial state, given as a parameter

x1 = func(x0) -- pure let binding
x2 = func(x1) -- pure let binding
> y = x1 + 3 -- pure let binding

return x2 as final state
return y as output

e.g.
return (x2, y)
>>
>>57942813
can you explain the type of State
I kind of understand
>>
>>57942808
>Americans simply can't compete is the issue.

It's true, I literally cannot compete with pajeet who doesn't live for anything but work because he has his lodging and food expenses covered while his check is sent back to his family while he works in the US.
They also can't find work elsewhere without violating their visa and being deported.
H1B workers are the ideal employee, they're literally slaves in everything but name.

How the fuck am I supposed to compete with that?
>>
>>57942833

type State s a = State (s -> (s, a))
-- state of type s
-- a is the result type


Each stateful process works like this:
s -> (s, a)
Given the initial state s, give back the final state s, and the output a

For instance, return / pure / a process that doesn't change the state would simply return the same state

pure x = State $ \s -> (s, x)

put will override the state, ignoring the initial state, and doesn't need to return anything (so we give back unit)
put x = State $ \_ -> (x, ())

get will return the state as the output, so we put the initial state into both the final state and output slots
get = State $ \s -> (s, s)
-- first is the resulting state, second is the output value

Those are the primitives, you can get everything else from there
>>
>>57942867
whoops, i mean data, not type
>>
File: pooInTheLoo.jpg (22KB, 325x326px) Image search: [Google]
pooInTheLoo.jpg
22KB, 325x326px
>>57942846
By shitting in a toilet and writing maintainable code?
>>
>>57942877
Companies don't want to pay for quality maintainable code, they see programmers as a liability and cut costs any way possible, even if it means their flagship product becomes an unmaintainable horrific mess that requires more and more pajeet magic to modify.
>>
>>57942846
Be good? Assuming you were to keep the political system
I don't see why you as a nation considers slavery of people in other countries problematic. Do you really not recognise the source of this issue?
I'd be very happy to have low-skill workers work for pitiful pay here. We have a welfare system that allow the dumbs we create to just lazy about. The pressure on them to get jobs is causing so many issues.

Also companies here have issues with outsourcing efficiency. So they're clearly not actually competition for our native workforce.

And again, it's just an anecdotal example but dpt quality difference is significant.
>>57942902
Maybe there's reasons for that? Maybe it's hard to find skilled workers so you'd rather have more of a quantitative approach to programming than qualitative. Poorly phrased. Hopefully you get it. More cheap manhours than few effective ones. As the products they produce differ in how easy they are to replace.
>>
>>57942808
>Yeah it puts America in a whole new light honestly. The recent election for instance. There's a clear opposition to change among the Democrats. But they vote in Trump who is at least claiming to have a more national focused work force with him opposing h1b1's during the republican debates for instance.
>Americans simply can't compete is the issue. Even in the high skill labour force. It's surprising really.
you're right anon, people hiring h1b1 employees are focused on code quality. that's why they're hiring indians who will work for pennies on the dollar in the shittiest possible conditions.

h1b1s are the mexicans of the high skill labor industries, except you can't actually expect a product that's consistent with what you'd get from a local employee. you get shit quality spaghetti code because india can't into code.
>>
>>57942902
Stop with this doom and gloom shit.It's been shown time and time again that companies can't skimp on their programmers, and those that have have gone under real fucking quick.

There will always be a place for bright programmers anon, just make sure that you're one of them.
>>
>>57942867
I mostly undestand, I just don't know when to apply. Can you give me homework?
>>
>>57942953
Weren't you working on tic tac toe?
>>
>Reader, Writer, State, Monad, IO, Monad Transformers
>Bytestrings, Trans
>Applicatives, Arrows, Lens

I'm sorry but there is just too much, senpai
>>
So, if I master macros, then I master the universe?
>>
If I wanted to wrap

using (SoundPlayer sp = new SoundPlayer(Soundboard.Properties.Resources.Clip))
{
sp.Play();
}


into a function that could be called such as

PlaySound(Soundboard.Properties.Resources.Clip);


How would I specify the parameters? I figured it would be something like Path in c# but I'm not sure.
>>
>>57943021
99% of that you don't need to write Haskell
basically, read "State", "Monad", "IO"

Reader/Writer/State are some common monads you might like, but if you learn State you've basically learned the others.
Writer is a State that you can only append to, Reader is a state you can only read.

Except is another interesting monad.


MonadTransformers let you use multiple monads at once, e.g. a stateful environment that also supports failure

Bytestrings are just a high performance representation of strings of bytes. It's like an encoded string type.

Lens is a meme library for writing ultra concise ultra unreadable code

Applicative you won't need to know if you can use monads

Arrows are a meme and you don't need to know them
>>
>>57942953
This very simple state represents an internal counter that can be modified by increment and decrement operations. This is obviously a trivial example and not very useful for real programs.
type CounterState a = State Int a

incr :: CounterState ()
incr = do
x <- get
put (x + 1)

decr :: CounterState ()
decr = do
x <- get
put (x - 1)

prgm :: CounterState String
prgm = do
incr
incr
decr
cnt <- get
return $ "Final state is: " ++ show cnt

main :: IO ()
main = print result
where
init_cnt = 0
(result, final_cnt) = runState prgm init_cnt


It's important to note that "prgm" is an object, think of it like a runnable program that we are running in main with
runState
, we get the result and print it out.
>>
>>57941094
sup /dpt/. Can you guys recommend any GUI libraries for C++? My professor suggested I start with JUCE, but there's a lot of different libraries out there and I was thinking a second opinion couldn't hurt.
>>
>>57942953
>>57943090
As for "homework", next you should implement a more complex state: a stack of integers, with operations "push" and "pop", so that we can do:
prgm :: StackState String
prgm = do
push 4
push 5
_ <- pop
push 6
_ <- pop
x <- pop
if x == 4 then
return "Correct"
else
return "Error"
>>
I have an 8 pixel by 8 pixel graphic that I need to rotate by arbitrary amounts in software. Anyone know any fast algorithms that don't involve floating point numbers for doing something like that? Quality doesn't have to be amazing.
>>
>>57943114
I'd say that if performance really matters, and it's always going to be 8x8, then hardcode the sin/cos table for every relevant degree and then just do a lookup
>>
>>57943040
Nevermind, I figured it out. It has to be a Stream type such as

foo(Stream bar)
{
...
}
>>
File: maisy williams.png (1MB, 800x800px) Image search: [Google]
maisy williams.png
1MB, 800x800px
>>57943130
>>
>>57943132
Good idea, I'll give it a shot
>>
>>57943114
Why can't it involve floats?
>>
>>57943100
Depends on what you're doing.
I find qt to be the best simply because it's popular. I don't care for UI overall, so I pick based on what I'd likely face in the future.

It's your typical OOP UI.
>>
>>57943174
Archaic architecture that doesn't support them and attempting to emulate floating points would probably be slow
>>
>>57943195
What arch?
>>
>>57943132
>table
Sounds terribly inefficient. But you won't know unless you compare.

I suppose an 8x8 might not miss the cache too bad.
>>
>>57943202
Motorola 68000
>>
>>57943100
Qt is old obsolete garbage and requires a non standard macro preprocessor. DO NOT USE.
Use gtkmm, it's a C++ wrapper to GTK and it's very nice.
http://www.gtkmm.org/en/
>>
>>57943206
>Sounds terribly inefficient.
No not really, a table lookup is pretty cheap, cheaper than computing sin/cos
>>
>>57943206
Well, you could pre-calculate integer rations for a few angles between 0-90 degrees, and then have math compensate for flipping appropriately it for the remaining 270 degrees.

How fast are stdlib floating point sin/cos anyways?
>>
>>57943192
I'm intending to make a visual novel engine. Yeah, I know there are ones out there already, but I'm more interested in making my own since I think it would be a good project to make something practical, yet not too hard.

I'm under the impression that qt is kind of written different than C++ in some way, is that true? Also, I don't really care one way or the other about cross platform capability since no one expects VNs to be compatible with anything other than Windows, and I don't want to limit myself if there's a more feature filled windows-only library.
>>
Monad.Main <- New.Monad.IO.Main
->
Hello World!
<-
.Monad

easy
>>
>>57943109
Wish I could make you proud, but I barely know what I'm doing
I'll have to cap your posts for digesting later.
import Control.Monad.State

type StackState a = State [Int] a

push :: StackState ()
push x = do
g <- get
put (x:g)

pop :: StackState ()
pop = do
x <- get
put (tail x)

prgm :: StackState String
prgm = do
push 4
push 5
_ <- pop
push 6
_ <- pop
x <- pop
if x == 4 then
return "Correct"
else
return "Error"
>>
>>57943280
>practical
Rehashing something for the 9001st time isn't exactly practical, unless you did something unusual like make one able to be used in-browser.
>>
>>57943207
are you working on something for the genesis or what?
>>
>>57943296
you want to change pop
pop :: StackState Int

it should return the head of the list

but your example does what he wanted
>>
>>57943280
I'm a fan of imgui. So if you're making your own UI library consider that.
>>
>>57943296
That looks perfect anon, well done.
Monads are pretty weird and it definitely takes a bit of digesting to transition to them from imperative languages.
>>
>>57943313
M-maybe...
>>
>>57943333
cool anon, working with ancient architectures is really comfy
>>
>>57943280
>I'm under the impression that qt is kind of written different than C++ in some way, is that true?
Yes. Qt was made before C++ even had vectors, so Qt has their own versions of a lot of basic C++ datastructures, it also has it's own non standard preprocessor system called MOC that is pretty much required to use. Qt in general is also garbage anyway for the end user, not only for the programmer.

If you want a good modern, easy to use GUI library that uses standard C++ features and doesn't build any unnecessary bullshit on top of it, then you'll like gtkmm as I described here >>57943224.

>I'm intending to make a visual novel engine.
You might want to consider SDL2 actually, it's more geared towards graphical stuff like that.
>>
>>57943301
Practical as in something that can actually be used and not just some practice program that I've done dozens of in college. I only really know C++, so it's either use KiriKiri Z which to my knowledge doesn't have complete english documentation, or RenPy which is Python. Which I have used before

>>57943330
This looks pretty nice. Normally don't care for minimalism, but the default look is pretty nice.

>>57943368
I'll take a look into both of those, thanks. I'll definitely avoid qt.
>>
>>57943455
>but the default look is pretty nice.
You misunderstand. imgui is a way of programming GUI.
Dear imgui is one example implmentation.
>>
>>57943224
Not him, but has anyone used Gtk#? Was looking at it for a future .NET Core project, not sure if it's worth using though.
>>
File: script.png (17KB, 848x656px) Image search: [Google]
script.png
17KB, 848x656px
>>57941094
I'm trying to write an ahk script that I can use at work. It has to be able to detect orders that pop up on screen. These orders are always green. So whenever the command PixelSearch returns a value other than 0, it plays a sound to alert the employees to the order.

I'm not too familiar with ahk syntax, here is what I have. It seems to compile alright, but I can't seem to launch ahk. I mean, I right click on the script I wrote and hit compile, it works, but then when I attempt to launch it, nothing happens.

Anyone out there familiar with ahk?
>>
is python for the quick and dirty type?
>>
>>57943854
It's definitely dirty
>>
>>57943854
python is for the meme type
>>
File: wf09.png (83KB, 1223x1033px) Image search: [Google]
wf09.png
83KB, 1223x1033px
Did a bit of rewriting of my Forth compiler (removed about 500 lines of asm), I'm fairly happy with the bootstrapping core now, in the process of porting over my old asm code into Forth now.
The idea is to keep implementing everything I can in Forth, when I hit something I can't implement I will add a new 'inst' primitive.
Postpone was a bit of a mind bender, took me a while to debug and get it right:
: call, `call [ m' `call xhere - patch4 ] xhere - patch4 ;

: postpone m' call, ;


`call is the primitive which executes at compile time and compiles a call rel32.
call, compiles a call to `call by getting the address of `call by escaping back out to the interpreter again and calculating the relative displacement and then compiles a call to patch up the address in the current definition (i.e however called call,).
postpone is then a macro (executed at compile time) which compiles call to 'lookup word' and 'compile call'
>>
http://search.cpan.org/dist/perlsecret/lib/perlsecret.pod#Goatse

Why aren't you writing in the best language?
The goatse operator provides a list context to its right side and returns the number of elements to its left side. Note that the left side must provide a scalar context; obviously, a list context on the left side will receive the empty list in the middle.
>>
>>57943873
>call rel32
>not call rm64

get out
>>
>>57943988
>call rm64
Makes the code section non-relocatable and makes it slower for no reason.
>>
Programming languages as doors:
Scheme - door is a ball of mud
APL - Door can't be opened as it's a dimond... fuck dimonds
Perl - ... can you read hieroglyphs? nither can I
html- it's a door. well... a 2d door
css - door reaches space due to a typo
C - door segfaults and burns up your house down
C++ - same but explodes
Haskell - you have a house... in theory but no IO means it's still on paper
Idris - in theory there's a theory about you having a house
Coq - you never left uni... go home
forth - you need to build the door... and the house too before you can open it
assembly - same as above... start from stone age
python - "but it's just a poorly drawn snake on the pavement"
php - you kill yourself at the thought of it
ruby - as you try opening the door you get hit by a train
java - your door throws a NullPointerException
scala - your door will respond... a week later
clojure - (same (as (above (in parens))))
tex - it's technically a door but not a door
prolog - ?- can_open(house).
yes.
?- open_house(house).
yes.
z80 - you don't have enough space for a door.... it's a shed
javascript - it's client side... you are the door
common lisp - you apply door to door... yes I know it doesn't make sense but I know what I'm doing
rust - it's safe... can't open it but it's safe...
housefuck - like brainfuck but for houses
lambda calculus - your house reduced to identity


So... what language should I learn?
>>
>>57941131
Ride a unicycle... that's how I got an offer for working with Scala
>>
>>57944298
haskell
>>
>>57944298
C# or Java
C++ if you need speed above all
Python for "scripting"

the rest are literal memes
>>
>>57944474
That is literally the memeiest answer you could have given,
Kill youself.
>>
>>57944298
javascript
everything else is a meme
>>
If you don't know at least two memelangs you're not a real programmer
>>
>>57944517
This.

I recommend Haskell and D.
>>
File: 1362960884712.png (102KB, 241x228px) Image search: [Google]
1362960884712.png
102KB, 241x228px
>>57944526
H-haskell's not a meme... right?
>>
>>57944543
Haskell is a good meme, unlike Pepe, you stupid frogposter
>>
>>57944298
Javascript, then something else.
Javascript is a great way to get used to the basics of programming, since you don't have to learn much to get started; no need to learn the complicated process of opening a window in an operating system for example, or learn data types.
If you've learned Javascript, then when you learn something else, you just need to alter your syntax a tiny bit, use data types, and manually create a window.
>>
File: 1469473621356.png (577KB, 480x476px) Image search: [Google]
1469473621356.png
577KB, 480x476px
>>57944547
I didn't hear your mom complaining about Pepe when I memed her last night
>>
>>57944563
I didn't hear your gf complain last night either

but at least my mom actually exists
>>
>>57944459
already have and enjoy it

>>57944474
prefer C and F#, already know python...
Why the hell did they prefer the if elif else mess over switch/case statements? Can't even use jump tables to optimize without ripping hair out when trying to write a compiler. Also no tail call elimination which is shit for a "new" language...

>>57944512
javascript is a meme. forced to learn it though

>>57944517
Does rust and coq count?

>>57944543
it is and isn't in theory

>>57944562
found scheme to be quite nice and half way through SICP so comfortable with programming. Would suggest a simpler language though for those who are new / something to filter out those who copypaste code (C, Lisp, ect...).
>>
>>57941747

you're probably gone by now, but apitrace might be helpful:

https://apitrace.github.io/
>>
How does canvas size in WebGL work?
I sometimes get stuff being drawn in an area smaller than the canvas, with my attempt at canvas resizing code.

Also I'm shit at CSS so I can't figure out how to make the canvas fit perfectly in the screen without borders.
>>
>>57941217
for i in range(1, 20): print("fizz" if i % 3 == 0 else "buzz" if i % 5 == 0 else i)
>>
I need to parse an XML document with a bunch of hex values written as ASCII characters, convert those to the actual hex values, do some bit manipulation, then output the result to a binary file.

Could I do this with C#?
>>
>>57944706
yes write a parser
>>
>>57944592
how hard would it be to use a dictionary instead of a switch?

also
>using python for a compiler and complaining about performance
>>
>>57944738
I can parse the XML and strings just fine, I'm just not sure how I'd take the string "0x0F" and convert that to the binary value 00001111. I don't even know what kind of type a raw binary value would be in C#.
>>
>>57944748
It's awkward asf... and I'm not using python... I was implementing a jit compiler for python in chicken scheme
>>
>>57944773
Actually, I wonder if I can just convert them to decimal and treat them as plain integers
>>
>>57944773
isn't it just an integer.... convert to an int and for hex you could just use something like this
switch(hex){
case '0': return 0;
...
case 'a': return 10;
case 'b': return 11;
...
case 'f': return 16;
default: error("what are you doing?");

to operate on the bits just use binary operators and math... to check the n'th bit you could use this:
 (v>>n) & 0x1 
(in C but should be easy to translate)
>>
>>57944815
byte would be better
and there should be something like Byte.Parse
>>
>meme language
What the fuck does this even mean? I hate this fucking website.
>>
>>57944824
if you want to convert to base16, just use a static lookup table array.
>>
>>57944851
It means a language that's relatively rarely used and/or is partly wildly different or strange
>>
>>57944870
pretty much, just not sure where this person is when it comes to programming (seen what uni students learn... the fuck is wrong with them)
>>
>>57944892
It's sad how some will avoid SICP as they think it's a meme... the book is one of the best introductions to programming out here
>>
>>57944903
going to college to learn programming is a mistake
>>
>>57944892
Generally those are both good things, though. Rarely used means it isn't watered down and unfamiliar means it's actually trying things out.
>>
File: file.png (57KB, 1042x612px) Image search: [Google]
file.png
57KB, 1042x612px
minecraft autism
>>
>>57944929
tutoring a CS student... asked him to define `take` in scheme and he gave me
(define (take xs n) (if (> 1 n) '() (cons (car xs) (take (drop xs 1) (- n 1)))))

Asked him to define `drop` since he used it ad got

him: I don't know how to get the next item
me: use cdr
him: thought that returned the tail and I've never understood examples with cdr in them

seriously he knows how to use `cons` but `cdr` is beyond him... what the actual fuck.
Had to show this for him to understand:
(define (cons x y) (lambda (a) (if a x y)))
(define (car p) (p #t))
(define (cdr p) (p #f))


Then there's shit like
(if (null? xs) '() (map fn xs))
which when asked he said he thought it would raise an exception...
>>
>>57945054
Why is your school teaching an ancient language like lisp to students in 2016?
>>
>>57945090
He wanted to learn programming so I picked lisp as they were teaching python and C++.

Didn't know what they were covering but it looks like they haven't moved past the hello world program yet from how crippled he is in scheme. I'm also covering most of SICP as he's interested in it but for some reason struggles with the book and the lectures.
>>
File: beforeafterpol.jpg (152KB, 1920x841px) Image search: [Google]
beforeafterpol.jpg
152KB, 1920x841px
>>57945054
very bad definition of cons, car, and cdr. you are no lisper to me.
>>
>>57945090

Pretty nice to learn LISP as first language desu.
>>
>>57945165
that sounds awful

>>57945159
>looks like a vampire
proof that /pol/ will steal your soul
>>
>>57945159
It's good enough to get the point across and this person was avoiding `if` after telling him to just use `map fn xs` instead of `if (null? xs) '() (map fn xs)`... this person is not capable of handling anything else
>>
does anyone here use opentk?
>>
File: etgwtwtwt.png (17KB, 503x643px) Image search: [Google]
etgwtwtwt.png
17KB, 503x643px
how would I go about printing this using a for loop?
>>
I wanna make a game for the Raspberry Pi, where do I start? Do I only look for a new compiler for it and just copypaste my code on there?
>>
>>57945348
you know that the raspi is just like a regular computer, right? learn to make games for regular computers.
>>
>>57945300
struct stats mobs[3];

mobs[1].ID
...


for (i > 0; i < 3; ++i)
printf("%d\t%c\t%d\t%d\n", mobs[i].ID, mobs[i].name, mobs[i].hp, mobs[i].atk);
>>
>>57945348
GCC, Clang, Chicken Scheme, heck.. even haskell compiles for it so you're fine

Try compiling after installing the libs you need (assuming you kno what you are doing )
>>
Dear /dpt/ what books should i ask for Christmas to read in 2017?
>>
>>57945300
Please anon, there is a much nicer way you can do this:
int main()
{
struct stats mobs[] = {
{
.id = 1,
.name = "golem",
.hp = 100,
.atk = 25,
},
{
.id = 2,
.name = "bear",
.hp = 60,
.atk = 30,
},
{
.id = 3,
.name = "wolf",
.hp = 30,
.atk = 20,
},
};

for (int i = 0; i < 3; ++i)
printf("%d\t%s\t%d\t%d\n", mobs[i].id, mobs[i].name, mobs[i].hp, mobs[i].atk);
}


Although considering the name and layout of your 'stats' struct, it's a very naive way of trying to do this, and could be done a lot better.
I can't really be bothered explaining it to you though. I like to let new people learn from their mistakes.
>>
>>57945420
SICP, SICM, LYAH, K&R C
all 4
>>
>>57945420
Harry Potter
>>
>>57945420
fashion books to improve your crossdressing and thus your coding ability
>>
>>57945422
>>57945410

thanks
>>
File: 1381228285622.jpg (27KB, 260x384px) Image search: [Google]
1381228285622.jpg
27KB, 260x384px
>>57945467
Le ebin crossdreggin fag maymay XDDD
Me and all me reddit friends le love that meme i crak up evey tiem

But really, fuck off you meme spouter.
>>
>>57945523
I would never hire someone like you.
>>
>>57945523
Fuck you
>>
>>57945151
It's incredibly mean spirited to waste peoples time like this.

Really don't use them as experiment. Ask them what they wish to learn and teach them that.
>>
I eat Objects for breakfast
>>
>>57945539
>>57945542
You need to go back. That shit really is reddit-tier garbage.
You're taking something that wasn't even funny to begin with, and then absolutely drive it into the ground and keep going.
That shit is the same tier as fucking frogposting.
>>
When should I use C over C++? or when C++ over C?
>>
>>57945581
You shouldn't use C++ for any purpose.
So you should always use C over it.
>>
File: 1470263015414.jpg (134KB, 433x480px) Image search: [Google]
1470263015414.jpg
134KB, 433x480px
>>57945576
>*-tier
opinion discarded
>>
In C++, is it safe to omit the enum and struct keywords when using C types from C libraries?
For example, in libmpdclient, there is an enum called mpd_idle, would it be safe to just do
mpd_idle
or should I always do
enum mpd_idle
when interfacing with C code?
>>
>>57945581
You shouldn't use C for any purpose.
So you should always use C++ over it.
>>
>>57945607
It might be but I wouldn't guarantee it
See if it compiles on GCC
>>
>>57945548
He wanted to learn lisp after I gave examples in C, Haskell, Forth, ARM, and of course lisp.

He's learning faster than what he's covering in uni and we'll touch on JIT compilers, sockets, ect.. as that's what he's interested in. Couldn't care less which language I use to teach.

>>57945581
C if you know what you are doing C++ if you don't

>>57945607
keep the `enum` as it's clearer what it is.
>>
File: 9yszk859.jpg (12KB, 208x240px) Image search: [Google]
9yszk859.jpg
12KB, 208x240px
>>57945589
>>57945613
>>
>>57945620
It doesn't need to compile on gcc, it needs to compile on g++, and I know that it does.
I'm just wondering if there would be any potential name conflicts. For example, in C on Linux, stat refers to a function and
struct stat
refers to a struct. Omitting the struct keyword there would definitely cause issues.
>>
>>57945636
I don't think so, maybe in some obscure template context
>>
>>57945636
>gcc
He said GCC (in capitals). They are very similar but different things.
GCC is the GNU Compiler Collection and includes compilers for many languages.
gcc is the C frontend to that compiler collection, after the command used to invoke it.
>>
>>57945670
You're the kind who posts the richard stallman verbatim everytime someone calls it linux, aren't you?
>>
>>57945438
Thanks senpai!
Already have SICP but will ask the rest
>>
>>57945701
That's the modern usage of the 'word'. It leads to a lot less ambiguity.
>>
>>57945704
might also like RWH after LYAH as they introduce Haskell in different ways. Also there's a 35GiB torrent of books called the gentooman library if you want a preview/digital copy

>>57945722
yes but it's clear what he meant
>>
How do I get an object in HTML to fully full the screen?
I can get it to be the width and height of the screen, but it's slightly off of the top left.
>>
>>57945741
>yes but it's clear what he meant
>It doesn't need to compile on gcc, it needs to compile on g++,
That's obviously a misinterpretation of "GCC".
>>
>>57945745
Set the margin to 0 and the width/height to 100% in CSS

I don't know exactly what you want to do but this div would fill the entire screen (I didn't test it though)

#div {
position: absolute;
margin: 0;
width: 100%;
height: 100%;
}
>>
Spoonfeed me on F# please
>>
>>57945838
It's shit
>>
>>57945838
It's better than most imperative languages

It's also shit
>>
>>57945762
yes but the command line tools gcc and g++ are what you use... which is what he meant...

>>57945838
this >>57945843
and feels like a crippled haskell with C#.Syntax()
>>
>>57945810
Yeah, it doesn't work.
>>
>>57945877
You didn't just copy and paste it, right?
>>
>>57945877
bleed over the edge then
>>
>>57945866
>yes but the command line tools gcc and g++ are what you use... which is what he meant...
The original question was clearly about C++, so there was absolutely no issues about that.
He was then told to see if it compiles on "GCC". This obviously meant the GCC C++ compiler, but was mistaken for gcc, which means he doesn't understand the term.
I really can't be fucked arguing semantics any more, and it was only intended as a brief informational post, so this "discussion" has gotten way more posts than it deserves.
>>
>>57945895
No, my code looks more or less like that already, so I just changed a line or two.
>>
>>57945905
yeah, how was your day/are projects going?
>>
>>57945924
I'm not going to start blogposting in /dpt/.
>>
>>57945948
What are you working on, /g/?
>>
>>57945957
Nothing.
>>
are the Red Book and the opengl superbible any good?
I can't understand shit from the tutorials I've found.
>>
So, basically, we all agree that Ruby is a female cosplaying as a male?
>>
File: ruby brony.png (15KB, 796x293px) Image search: [Google]
ruby brony.png
15KB, 796x293px
>>57946273
>>
>>57946273
No, he's a pasty, probably autistic, brony.
>>
File: 1476087736474.jpg (47KB, 327x322px) Image search: [Google]
1476087736474.jpg
47KB, 327x322px
>when you copy/paste code snippets from a dozen different stack overflow posts and it just werkz

The memes are real
>>
>>57946351
can't wait until there's a language dedicated to doing this with neural networks
>>
>>57946351
Pajeet no! This is not why we pay you 15 cents an hour!
>>
>>57946351
https://github.com/drathier/stack-overflow-import
>>
>>57946401
you wouldn't just import a program
>>
File: 1367080519924.jpg (18KB, 326x264px) Image search: [Google]
1367080519924.jpg
18KB, 326x264px
>>57946411
>>
>>57945745
If you have other objects, otherwise you can skip the absolute and remove the padding on the body instead.

position: absolute;
top: 0;
left: 0;
width: 100vw;
height: 100vh;
>>
Could someone tell me what the fuck is going on here?

recv(socket_fd, &((*area)->coords), sizeof((*area)->coords), 0);


This bit in particular, I'm terrible with pointers:

&((*area)->coords)


"area" is a "Area **area" with Area being a complex struct.
>>
>>57946581
dereference area to get an *Area
this is like area[0]

get co-ords
area[0]->coords

take the address
>>
Just finished a brainfuck interpreter in haskell. I know its pretty lame; i'm proud anyways. :3
>>
>>57946401
>parsing HTML with regex

wowzers
>>
>>57947138
>parsing HTML with applicative parsers
>>
>>57947138
> codez = re.finditer(r"<pre[^>]*>[^<]*<code[^>]*>((?:\s|[^<]|<span[^>]*>[^<]+</span>)*)</code></pre>", answer)
What did he mean by this
>>
>>57947192

Probably some disgusting commie bullshit. Fucking reds are EVERYWHERE.
>>
I have a project in C, and when I run my program normally I get a double free error, but running on Valgrind or gdb it runs normally. Valgrind doesn't show the double free. How can I trace where the block was alloced and originally free?
>>
>>57946305
>brony
>probably autistic
>probably
>>
File: parsing HTML with regex.jpg (56KB, 342x588px) Image search: [Google]
parsing HTML with regex.jpg
56KB, 342x588px
>>57947138
>>
>>57947201
>civicuck nigger lover
>commie
pick two
>>
>>57947206
Try setting the MALLOC_CHECK_ environment variable to 2. This will cause glibc to use a more debug-friendly (albeit less efficient) version of malloc that will make debugging easier.
>>
>>57947240
Thanks, I'll give it a go
>>
File: java_is_shit.png (169KB, 1431x839px) Image search: [Google]
java_is_shit.png
169KB, 1431x839px
>people will still argue that java isn't shit
>>
>>57947235

I'm not sure I follow.
>>
File: 1391126757962.jpg (307KB, 796x574px) Image search: [Google]
1391126757962.jpg
307KB, 796x574px
>>57947235
> Using the N-word.

Welp, my poltarded friend, I'm sorry to say this but you're going straight back to your containment board. We don't condone that kind of bigotry around these parts.
>>
I want to make something substantial but the only project idea I can come up with that's a full product is video games... Was /agdg/ right?
>>
File: uzIQ4lJF.png (84KB, 512x512px) Image search: [Google]
uzIQ4lJF.png
84KB, 512x512px
>>57947293
agreed
>>
File: average rust contributor.jpg (20KB, 300x300px) Image search: [Google]
average rust contributor.jpg
20KB, 300x300px
>>57947293
oh boy, it's the rust admin again.
>>
File: 1478901478078.gif (2MB, 233x219px) Image search: [Google]
1478901478078.gif
2MB, 233x219px
>>57947293
>We don't condone that kind of bigotry around these parts
>post picture with nationalist symbols
>>
>>57946351
Most of the time I have to trim about 50% of the code because it's mostly trash or pure redundancy, but yeah, sometimes it does happen.
>>
>>57947257
then you will read all those blogs saying that scala is the big data language of choice, but can't handle data little enough to run on single machine without messing with java configuration
>>
File: here_then.jpg (99KB, 1600x900px) Image search: [Google]
here_then.jpg
99KB, 1600x900px
>tfw your main problem isn't that your programming isn't up to scratch, but that you can't think of anything cool to put on a portfolio

Give me some ideas gents, I need some inspiration
>>
how do i do this?

stair :: IO ()
stair n current -- current starts at 1 and ends at n
| current <= 0 = do
print $ repeater ' ' offset
print $ repeater '#' current
putStrLn ""
stair n (current + 1)
| otherwise = return
where offset = n - current


should be easy to see what i'm going for

compiler says :
• Couldn't match expected type ‘IO ()’ with actual type ‘Int -> Int -> IO b0’
• The equation(s) for ‘stair’ have two arguments,
but its type ‘IO ()’ has none
>>
>>57948063
To be fair big data isn't about what can run on a single machine
>>
File: 1455402685739.jpg (18KB, 300x250px) Image search: [Google]
1455402685739.jpg
18KB, 300x250px
Help me out with something /dpt/. I'm learning Java, and I've now gotten into reading from and writing to text files. I have a program which allows the user to add a new object of type Person, modify the data of any given person, and delete any person from a List.

Now, here's my issue. I keep a List of Person in memory, which is created every time the program starts by reading what's on the text file. What would be the best way to approach a modification to any of the Person objects?

>a) Modify the List in memory, then simply write to the text file given what's on List
>b) Modify the text file, then update the List in memory by reading what's on the text file
>c) Independently update the List and text file, but I'm not sure if this would bring much optimization at all, and it creates the problem of possible lack of concurrency between what's on memory and what's on the text file during execution of the program, unless I control well that a modification to either the List or the text file reflects what happens to the other
>d) Some other way to approach this problem entirely because I'm willing to admit I'm a fucking newbie
>>
File: SADASDASD.png (128KB, 833x1548px) Image search: [Google]
SADASDASD.png
128KB, 833x1548px
help me out here

how the fuck do i populate a jlist with searchresults from db


and in which layer
>>
>>57948159
>The equation(s) for ‘stair’ have two arguments,
> but its type ‘IO ()’ has none
Uhh, right? You've given stair the type of IO(), meaning it takes no parameters and returns a value of type IO (), and just below it you give a definition that takes parameters.
>>
>>57948163
Also, I already figure b) isn't a very optimal choice since it requires more I/O operations, but still, for completion sake I decided to list it as an option.
>>
>>57948159
before you say should be current <= n i know that was a typo, just asking about the error
>>
>>57948160
do you propose instead to grid many machines with 2 GB of RAM for doing a job that needs only 3GB and a single CPU because java can't use more than 2GB per machine?
>>
My rust gameboy emulator now executes the entire boot rom successfully. Shame that actual games aren't as well documented as the boot rom, I'm going to be a lot more blind going forward.

>Pic related, glorious 2bit greenscale.
>>
>>57948193
what do i do instead? i want to use IO while keeping the arguments
>>
>>57948255
targ1 -> targ2 -> IO ()
>>
>>57948248
Where did you learn to build an emulator? Was thinking of building one in C or Java for practice
>>
>>57948269
i ended up just removing the type signature completely and it worked
>>
>>57948324
Read "Learn you a Haskell", then do it in Haskell master race.
>>
>>57948174
Don't use setters. Read the documentation for JList.
>>
>>57948324
There are pretty good guides on how to implement emulator for chip-8. Should be about 500 lines of c.

It boils down to studying the hardware specs and the assembly opcodes which the processor executes. Then you just implement them in software.
>>
>>57943053
If you take that approach, you don't even need State. You can just the IO monad.

Furthermore, you don't even really need to know 'Monad', just how to use do-notation.
>>
New thread:

>>57948378
>>57948378
>>57948378
>>
>>57948334
>>57948159
??

stair has two arguments but your function signature gives it no arguments

change to
Int -> Int -> IO ()


Even your comment is wrong. If you pass a negative number to `stair` then it will run until current == 1. Your otherwise case is just ???, you seem to be confused about what return actually is.
>>
>>57948335
I wouldn't recommend this book
>>
>>57948255
The other error "Couldn't match expected type ‘IO ()’ with actual type ‘Int -> Int -> IO b0’" says:
stair was expected (defined) to have the type IO (), but the actual type of the function that was found was 'Int -> Int -> IO b0'.

A function's type declaration needs to define the arguments as well, which you've left out. Arguments are defined as in >>57948269 . For example Int -> Int -> IO ()

By removing the type declaration Haskell will infer the type on it's own.
>>
>>57944851
>>57944892
'meme' doesn't mean anything any more.

If you ask someone else for a definition of meme, they might say 'something that is overly popular but has no inherent value' or 'something that is only liked for worthless attributes'. Yet this guy say it means 'obscure, different for the sake of being different' (which is actually desirable in PLT, as already pointed out: it's important to explore new areas).

Nobody knows what this fucking word means any more, and they insist on using it as a pejorative. Worse, normies will use it to mean 'funny image'.

I remember when 'meme' meant 'contagious idea'. It had an interesting, useful, and, above all, CLEAR definition. Fucking semantic rot.
>>
>>57945054
'car' and 'cdr' are daft names.

We're stuck with 'cons', but at least it isn't an acronym, and, thankfully, the phrase it abbreviates doesn't refer to implementation details.
>>
>>57941094

Elixir/Erlang. It's good stuff.
>>
>+300
We need a new thread now!

>>57948324
http://imrannazar.com/GameBoy-Emulation-in-JavaScript
>>
>>57948936
You blind, bra?

>>57948389
>>
>>57948248

How did you ever get past learning rust with that stupid compiler? I know its supposed to help but borrowing and lifetimes and all of that are pretty stupid and stop me from writing efficient code and have me worrying about whether or not this will be used than will the program work as a hole. This is why me and bunch of other friends dropped rust.
>>
>>57950143
Only you stop yourself from writing efficient code.

Only you can stop yourself from butchering basic grammar.
Thread posts: 324
Thread images: 35


[Boards: 3 / a / aco / adv / an / asp / b / bant / biz / c / can / cgl / ck / cm / co / cock / d / diy / e / fa / fap / fit / fitlit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mlpol / mo / mtv / mu / n / news / o / out / outsoc / p / po / pol / qa / qst / r / r9k / s / s4s / sci / soc / sp / spa / t / tg / toy / trash / trv / tv / u / v / vg / vint / vip / vp / vr / w / wg / wsg / wsr / x / y] [Search | Top | Home]

I'm aware that Imgur.com will stop allowing adult images since 15th of May. I'm taking actions to backup as much data as possible.
Read more on this topic here - https://archived.moe/talk/thread/1694/


If you need a post removed click on it's [Report] button and follow the instruction.
DMCA Content Takedown via dmca.com
All images are hosted on imgur.com.
If you like this website please support us by donating with Bitcoins at 16mKtbZiwW52BLkibtCr8jUg2KVUMTxVQ5
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.
This is a 4chan archive - all of the content originated from that site.
This means that RandomArchive shows their content, archived.
If you need information for a Poster - contact them.