/dpt/ - Daily Programming Thread

Emulator general

Previous:

Attached: DnzqYvSX0AAa83m.jpg (638x631, 55K)

Other urls found in this thread:

nim-lang.org/blog/2018/09/26/version-0190-released.html
github.com/kostya/benchmarks
twitter.com/SFWRedditImages

Which emulator should I work on.

What are you working on, Jow Forums?

Attached: 1537198279816.png (663x801, 174K)

What is overall better design: Making an array of bitmaps which are displayed in an order as given by several arrays of ints with the bitmaps being on top of each other but each individual objects, or taking the time at load to create an array of bitmaps that just contains the final effect (layered, rotated, and combined images) so that the whole animation can be one object when it is playing?

I want to fuck bowserette so bad

Attached: 1501469037294s.jpg (249x222, 5K)

Never fall for the x86 meme, do something fun like CHIP-8 or GB or NES

contribute to cxbxR, pcsx2, rpcs3, or dolphin

Yep, this thread is going to die fast.

The former

Is there 3D model format that I can use directly in my game engine or do I have to come up with some internal binary format that directly maps to my structs?

It makes more sense but the book demands using # to end the input. I'll try with '\0'
?

why aren't you using Nim?

Attached: 1530816202413275178.jpg (848x848, 166K)

0.19 just released as well.
Lots of changes and bug fixes.
nim-lang.org/blog/2018/09/26/version-0190-released.html

>What does it feel like to be hit in the face by an O(log(n))?
soft titties

too slow to write emulators

i beg to differ
github.com/kostya/benchmarks

The main problem you're having is probably the use of `=` instead of `==`
the check can be easily condensed to a single if as if ((First == 'e' || First == 'E') &&(Second == 'i' || Second 'I')){return 1;} else return 0;
seeing as it is a very specific case that's not supposed to be either modular or expandable

It's Bowsette, tryhard.

funny, maybe it's just me but it doesn't look like an emulator

it's a benchmark silly
you should try to write emulator in nim first

How hard would it be to write python script that moves files automatically?, also how do i remember wich types of numbers interact with each other?

Attached: 1463398206750.jpg (857x1200, 254K)

not difficult, everything is in os.path, or just os

dont understand the 2nd question

>How hard would it be to write python script that moves files automatically?
os.rename("/path/filename.ext", "/newpath/newfilenameoptional.ext")
you can also rename it as well as move it

Dunno what's with the second answer

me on the left

import Data.List
import Data.Char (toLower)

readStr = takeWhile (/= '#') getContents

countEI (a:b:xs) = let isEI = map toLower [a, b] == "ei"
in if isEI then 1 + countEI xs else countEI $ b : xs
countEI xs = 0

main = print . countEI =

Attached: 1519705501425.jpg (600x725, 63K)

Never heard of it until now
Is it just c++ for hipsters or is there some reason to use it?

Something else I need to clear about pointers to pointers.

If I do this

new int **A;
**A = 100;

there for, if I ask the console to display the value of **A, it's actually giving me the address of *A?

I mean if I do cout

it has sane syntax, modules and no dependencies single-binary output

so its nothing like C++

puts "receive your eieio award.".scan(/ei/).size

im so bored, tell me what to write in python not involving AI

1. Take Python
2. Make it statically typed and compiled to C
3. Add Lisp's metaprogramming
4. Make C's preprocessor not complete shit
5. Sprinkle on a few more niceties
And that's basically nim's TLDR.

Attached: pls.jpg (750x750, 181K)

you sexy bby

Is it the load time saved or is it the modification potential preservation?

sounds too good to be true
Thanks for the pointers

Oh thanks, that fixed the function but still the loops are not terminating as they should. I'll work on that tomorrow and optimize the function based on your example but on C string are so annoying I'm feeling like trying something else.
is this even C?

chip-8 emulator helper tools

it's haskell you mong

So it's not even C... how pathetic...

Yeah nah, you gotta learn the hard way if you haven't caught it yet
fucking do your flowcharts, this and using = in a comparison means you aren't fucking paying attention

Not what the task was asking you to do though
Here's a simpler but probably less performant version
import Data.List.Split (splitOn)
import Data.Char (toLower)

readStr = takeWhile (/= '#') getContents

countEI = flip (-) 1 . length . splitOn "ei" . map toLower

main = print . countEI =

>no emulator written in Haskell
hmmmmmm

But I do start with a flow chart tho as I work on the program I deviate from it but I'm well aware of the algorithmic logic that the program should have.
I'm not studying that.

Attached: 1464956813115.png (400x300, 106K)

execute the program step by step on paper
this is a very stupid problem that shouldn't happen if you know what the variables are doing inside the while
You obviously don't, get to it you lazy fuck

Jow Forums, I don't understand what's happening here?

It's C# using EPPlus to access items. wb (ExelWorkBook) is opening, but not all elements of it are working, example worksheets which I'm trying to access.

Attached: Untitled.png (1388x598, 68K)

reminder that flip (-) is subtract

also
countEI = length . filter ("ei" `isPrefixOf`) . tails . map toLower

I just sold an hp laptop i refurbished for $120. im feeling smug.

fuck hp

I don't get this problem with python's openpyxl

how do you initialise wb? are you using ExcelPackage?

im using applus like this and never had any problems:

using (ExcelPackage package = new ExcelPackage(input))
{
int sheets = package.Workbook.Worksheets.Count;

}

there is a NES one

Guys, please I know this is the dumbest question you've read in days, but I just need to sort out the confusion from this
When I ask the console to display **X what I'm asking for.
* is the operator for "content of", in this case is it the content of the content of X, or the content of *X which would be the address of a pointer?

dude pointers lmao

Phoneposting right now but there's a cow model in a c header on scratch pixel or whatever that site is called

See pic related.

It's C#

Attached: Capture.png (928x678, 24K)

>Boolean
Why not just bool?

**A is an int
*A is an int*
A is an int**

**A will be the first int in the first array.
*A is the address of where the first array starts.
A (converted to pointer) is the start address of the array of pointers to arrays.

int x;
int *a = &x;
int **b = &a;

*b == a;
*a == x;

Its 'Super Crown Bowser' ffs

She's mine anyways so you all can fuck off

you can have her, she's inferior to boosette anyway

Attached: 1537905972039.jpg (600x800, 445K)

Why is Nim getting shilled so hard here.

It looks like a cool language. I get it. It compiles to a bunch of different targets. That's cool. Everything you can do with Nim you can do with anything else though. I don't see how the syntax of the language is so much better than others we have now. Is everyone hyped about it because it compiles to C & Javascript? I just want to understand what this hype is better.

Disgusting

if I do this:

int A = 100;
int *B= &A;
int **C= &B;

**C = 80;

What does *B equals to?
it suddenly becomes 80 right?
Why?

Sup Jow Forums, could use some advice on this scraper I'm creating. I need some input on the process and design.

I plan to fetch images from Pixiv.

Let's say, every 5 minutes I do a series of HTTP calls to PIXIV. Only text, no images. I produce from that, a list of illustrations. This data model contains for each illustration an URL to the image.

I need to forward the image AND it's related metadata somewhere else. My question is, how do I best handle this?

Do I HTTP GET the Illustration JSON, and save it to the database, then fetch the image immediately? Or should the image fetching be handled by a different process?

absolute shite taste, end yourself

Attached: 1537935232044.jpg (672x700, 99K)

Same reason that recursive fibonacci benchmark got posted here last thread: It was on hackernews.

Because it really doesn't matter does it?

What is the "using" line actually called? What is it doing? That's probably why this isn't working, right?

resources you declare in using statement are disposed at the end of using block, so either you have to do everything in that block or load and dispose the package manually

C is a pointer to B: (C = &B)
so *C is B

B is a pointer to A: (B = &A)
so *B is A

So **C is *B and *B is A.

>What does *B equals to?
You could easily have tested this on your own. Why didn't you?

>Why?
*b gives you a
so *c gives you *b
**c means *b which means a

So I can't store the workbook and current worksheet in the way that I have? If I wanted to do that in a separate method (trying to make this OO) I would need to reopen each time?

>web framework
>example is a todo app
>falls apart with anything more complex
>slow as molasses
>dude just store everything in a global state
>needs 1GB ram

Attached: 1537050768416.png (992x940, 415K)

>so *c gives you b
fix

>example is a todo app
asp?

C#, never again

you can store workbook if you get rid of using statement and just open the package, but you have to remember to call package.Dispose() when you end working with it

I have a question for anyone that knows. I have a c# entry level interview coming up. The recruiter told me that it will be a 45 minute coding test. I will be walked though a multi-part scenario and they want to see how I handle problem solving. Does anyone know anything like this? What they might ask? I suspect it will be based on Data Structures and Algorithms, but it will be c# based.

Should probably just fetch the image where it's final resting place will be since images are large and moving them around is less efficient than just a JSON. That machine can handle pulling the image asynchronously while it stores the metadata into the DB.

.NET core is God tier

you can also make your ExcelFile class implement IDisposable interface, call package.Dispose() in the ExcelFile Dispose method implementation and then you can write shit like
using (ExcelFile excelFile = new ExcelFile(file))
{
//whatever shit you wanna do with the file
}

>try { } catch (Exception e) { Console.WriteLine(e); }

Why are you swallowing the exception? If an error occurs during the initialization, the ExcelFile object is in an unusable state.
You should handle the error in the layer in which the object is created, instead. Is it because someone told you that the constructors should not throw? That's right. It would be better if you had an ExcelFileFactory class with a

>public ExcelFile Build(FileInfo file)

method which throws an exception if something bad happens. Or even better:

> public Either Build(FileInfo file)

so you could use the mo... I mean, railway programming pattern.

you should let another process handle it, call it to download the image whenever you need to with whatever necessary parameters, if it throws an exception you can handle it from the call and that's it
consider that Pixiv requires you to log in to download the full images (403 otherwise), so that's another thing you can handle directly to the separate program, if you wish to hold your credentials/cookies somewhere else
I don't know exactly how the access is handled by the system, but if you have access to the master1200 image, the subfolder is the exact same, /img-original/img/[year]/[2 digits month]/[day]/[GMT-5 hour]/[minutes]/[seconds]/[submissionID]_p[page number].jpg

>Microshit
ew

>Oracle
yuk

>Google
yikes

Indeed
>using corporate enterprise shit for webdev
what were they thinking

>python
unmaster'd

>ruby
cucked

>js
onions'd

split your declarations and assignments, you're only confusing yourself more
int A;
int *B;
int **C;
A = 100;
B= &A;
C= &B;

**C = 80; //or *(*C) = 80 or *B = 80 or A = 80, doesn't matter

A, *B, *(*C), **C are all one and the same bucket that contains 80 after the assignment
say A is bucket #1234, B is bucket #2345 and C is bucket #3456
then A contains 80, B contains 1234 and C bucket 2345 at the end of execution
&A means 'get the label of bucket A'
B=&A means 'put the label of bucket A in bucket B'
*B means 'read the label that is in B and fetch the corresponding bucket' so
**C = 80 means 'read the label that is in C, fetch that bucket, read the label that's in there, fetch THAT bucket and put 80 in it'

this is probably what every C tutorial so I don't know why I'm writing all this

all at least better than microshit, pooshit and googleshit

tempted to say php is even better but that might be pushing it

That's what I had, but was then trying to use the package later on after that had completed.

I'm now trying to use the package and then will call the dispose method at the end.

I'm just writing the code I want for now, so spitting the exception out to Console so can understand them. The intention is to put in proper error checking so that I'm dealing with the exception correctly.

>all at least better than microshit, pooshit and googleshit
care to give some actual arguments?

Ok

yuk

yikes

Will either be related to the job, or be some kind of simple problem where you can apply data structures or algorithms. Really depends on the role and experience required.

>googleshit
just call it poogle lmao

brilliant

There was just a new release so nimfags are shilling.

OK, I've modified my code like this, but my count is returning 0?

I have 3 worksheets in the file, 2 of which actually contain data.

It does the same if i use Count()

Attached: Capture.png (833x923, 30K)

>Everything you can do with Nim you can do with anything else though.
Thats true of every single language

except python

which editor? this is kino

Ignore me, I fucked it up! Found another error check I need to do though!

Attached: ffffffffuck.jpg (560x561, 109K)