[Boards: 3 / a / aco / adv / an / asp / b / biz / c / cgl / ck / cm / co / d / diy / e / fa / fit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mu / n / news / o / out / p / po / pol / qa / r / r9k / s / s4s / sci / soc / sp / t / tg / toy / trash / trv / tv / u / v / vg / vp / vr / w / wg / wsg / wsr / x / y ] [Home]
4chanarchives logo
/dpt/ - Daily Programming Thread
Images are sometimes not shown due to bandwidth/network limitations. Refreshing the page usually helps.

You are currently reading a thread in /g/ - Technology

Thread replies: 255
Thread images: 34
File: i2a.jpg (118 KB, 1000x750) Image search: [Google]
i2a.jpg
118 KB, 1000x750
old thread >>54656366


What are you working on, /g/?
>>
>Creating threads before the bump limit
Delete this shit and kill yourself.
>>
>>54660284
"No."
>>
>>54660278
fuck everything about that textbook
>>
Hey /dpt/, I've been thinking about making a little language that compiles to brainfuck.
Now, is it an ok idea to make an "assembly" that "assembles" to brainfuck, to make the compiler easier?
>>
>>54660336
If you're too retarded for that book I'd hate to see you read Knuth.
>>
>>54660278
I'm learning about WPF, so far so good.
>>
File: Screenshot_129.jpg (8 KB, 219x120) Image search: [Google]
Screenshot_129.jpg
8 KB, 219x120
Can I have multiple return statements in case like this?
>>
>>54660360
Yes, why wouldn't you?
>>
>>54660360
why not?
why ask when you can just test it?
>>
>>54660360
Yeah it don't care
>>
>>54660360
sure.

also, make any but the first "else if"

or use switch/case
>>
>>54660391
there is no reason to, he's using a return
>>
>>54660371
>>54660373
This program has errors I don't understand, so I'm going down the list checking things off.
>>
>>54660406
You're in over your head kiddo
>>
>>54660406
does in.get() remove a character from the stream?
If so, your if statements are consuming too much input.
>>
>>54660416
Honestly regret taking this class, it's not at all what I thought it would be. I'm no programmer.
>>
java.lang.NumberFormatException: For input string:

Why?
I have a string made of numbers.
>>
>>54660395
might change that later or add another line to one or more of the cases

good practice is good practice even in an edge case.
>>
>>54660434
>>> stackoverflow
>>
File: 1463210410094.png (1 MB, 1000x1400) Image search: [Google]
1463210410094.png
1 MB, 1000x1400
You have been visited by the crossdressing C programmer of Shimoshina Academy!

Good performance, triple indirection, and tail call optimization will come to you, but only if you post "Keep overflowing the stack, Hime!" in this thread.
>>
File: Screenshot_130.jpg (42 KB, 474x454) Image search: [Google]
Screenshot_130.jpg
42 KB, 474x454
>>54660422
Yeah, I think so.
Like, I said I have a hard time following this program and how it's making "Tokenizer" objects and how it accesses them.
It's supposed to be a calculator, and I'm trying to take into the account of the different cases of if I wanted to find:
20 >= 9
vs
20 >> 9
So if it ever encounters an inequality it needs to read the next character. I used in.get just because of the above method.
>>
>>54660430
Ignore him. None of us were born with the ability to write fizzbuzz. We learnt through classes, articles, and shitposting on here. Keep at it.
>>
LWJGL isn't working for the HelloWorld class provided on their website.

it's giving me this error (I already upgraded to a new version of Eclipse that support Java 8)
Exception in thread "main" java.lang.UnsupportedClassVersionError: src/HelloWorld : Unsupported major.minor version 52.0
>>
>>54660472
Is there some sort of .peek() function? One that will look at what the next character is, but not remove it from the stream.
>>
>>54660463
Anyone have the picture of that crazy / anime Japanese C programming book; where the character / title was "Thinking about malloc"?
>>
>>54660463
>Trapfag is so butthurt that he didn't get to post his degeneracy in the OP, he spams his stupid /b/-tier shit in this thread
>>
>>54660347

Do your self a favor and get into MVVM as fast as possible if you're going to get a job with it.
>>
>>54660520
I've never been into design patterns, but I'll definitely take a look.
>>
>>54660551
I've done 4-5 years of WPF work, its pretty popular and doesn't really hurt for the most part.
>>
>>54660430
You taking a compiler course? It only gets worse. glhf.
>>
>>54660278
trying to teach myself mql4 (some bastard child of C++ used for trading currency).

this first attempt of mine is shit and obviously incorrect and riddled with fuck ups but im going over some tutorials and i will try again.
>>
>>54660430

see

>>54660487
>>
>>54660582
That's nice, I'm actually aiming to get a job position of C# and WPF, btw, do you have any kind of resources that can recommend? Specially to git good, and translating my PS mockups to WPF.
>>
>>54660490
I was hoping that I could just pop it off, then push it back on, but I can't even find where it's initializing these objects called "opStack" and "postFixStack", I ctrl+f and I can only find where they're getting functions called on them.
>>54660487
Thanks. I suck at programming (I'm a math major), but I'll never give up! I can take the banter.
>>
>>54660632
MVVM is a must then - it decouples the UI from the backend code, allowing you to do whatever the hell you want to the front end without breaking anything.

You don't need a fancy framework for it, its just how you structure the files, however, dependency injection does make it a lot easier - so if you don't know what that is i'd start there as well.

Most of the people that did fancy UI tweaks with WPF used "Blend" to get started and imported it into their project as well.
>>
>>54660665
you must be 18 or older to post here
>>
>>54660634
>>54660490

       ungetc() pushes c back to stream, cast to unsigned char, where it is available for  subse‐
quent read operations. Pushed-back characters will be returned in reverse order; only one
pushback is guaranteed.
>>
>>54660647
Thank you
>>
>>54660665
This has to be the stupidest forced meme in a long time, who finds this shit funny?
>>
>>54660665
This is, in general, the biggest forced meme ever.
>>
>>54660371
Isn't impossible to get more than one return or am I misunderstanding? I thought once the line reaches a return command the function will return and skip all other lines unless there is something like a finally?
>>54660360
I could be wrong, but I thought it was impossible to get more than one return. I would think it would return with whatever return is first executed if there are multiple possible ones.
>>
>>54660737
>Isn't impossible to get more than one return or am I misunderstanding?
When the function / program returns, it returns. That stack frame for that function (excepting statically declared variables) stops executing / existing when it returns.

>I thought once the line reaches a return command the function will return and skip all other lines
Exactly. Maybe this will clear it up: those are POINTS at which it will return.
>>
File: raichu_riding.jpg (327 KB, 500x1000) Image search: [Google]
raichu_riding.jpg
327 KB, 500x1000
>>54660278
How come Lua doesn't print zero with cos or sin?
E.g.
> print(math.cos(math.rad(0)))
1
> print(math.cos(math.rad(90)))
6.1232339957368e-17
> print(math.cos(math.rad(180)))
-1
> print(math.cos(math.rad(270)))
-1.836970198721e-16
> print(math.sin(math.rad(0)))
0
> print(math.sin(math.rad(90)))
1
> print(math.sin(math.rad(180)))
1.2246467991474e-16
> print(math.sin(math.rad(270)))
-1

I need it to print zero and not an arbitrarily low number.
>>
>>54660787

because they have to use approximations of pi, which is an irrational number.

you can just round it if you want
>>
>>54660673
Thanks.

>>54660737
>thought once the line reaches a return command the function will return and skip all other lines
Yes, that's exactly what I want it to do.
>>
>>54660802
Okay, thanks.
>>
>>54660787
6.1235254352345e-17
That's a mere 6 times machine epsilon. That's basically zero.
>>
>>54660472
Where could I find what you're working on? Is it from nand2tetris?
>>
gettimeofday() or clock_gettime() for a game engine on Linux?
>>
>>54660867
I know, but I want it to be zero. I can't seem to figure out a way to properly round it because there is only
math.floor
and
math.ceil
.
>>
>>54660886
clock_gettime(CLOCK_MONOTONIC,&timeobj)
>>
>>54660904
What about CLOCK_MONOTONIC_COARSE?
Does a game engine need precise time? exactly how coarse is CLOCK_MONOTONIC_COARSE?
>>
>>54660891
Floats aren't exact. If you're doing equality checks with floats you're doing it wrong. If you just want to print 0 then you just print a finite number of decimal places so it prints 0.000000000000000
>>
>>54660886
>>54660904
>>54660929

How about time(NULL)?
>>
>>54660929
I have never heard of CLOCK_MONOTONIC_COARSE.
>Linux 2.6
Oh fuck I feel old now.

Check its resolution with clock_getres. If it's more than a few hundred ns I wouldn't bother.
>>
>>54660954
>Time in seconds
>For a game loop.
>>
>>54660964
>For a game loop.

This was not made clear.
>>
>>54660929
Also note that CLOCK_MONOTONIC_COARSE is a Linux only thing so if you wanna have your game run on nonfree OSX or cuckoldry BSD you can't use it.
>>
>>54660933
Nah, it was because I wanted to easily generate a set of numbers
{(0,1), (1,0), (-1,0), (0, -1)}
and I thought that the simplest way would be to use cos and sin. I found some function to properly round. I have this
#!/usr/bin/lua

function round(num)
if num >= 0 then return math.floor(num+.5)
else return math.ceil(num-.5) end
end

for i = 0, 270, 90 do
print(round(math.cos(math.rad(i))) .. "," ..
round(math.sin(math.rad(i))))
end

This outputs:
$ ./test.lua
1,0
0,1
-1,0
-0,-1
>>
>>54660874
It's from a Data Algorithms class at my uni.
It's a big project itself (as in it's a lot of files), but the students are only supposed to implement a few of the operators in evaluator.cpp.h and tokenizer.cpp.h
You can check it out if you're curious:
http://lpaste.net/164078 - the driver
http://lpaste.net/164079 - evaluator.cpp.h
http://lpaste.net/164080 - tokenizer.cpp.h
http://lpaste.net/164081 - token.h
http://lpaste.net/164082 - evaluator.h
http://lpaste.net/164083 - tokenizer.h

I tried commenting out what I implemented, but it doesn't show up too well on that website.
>>
>>54660929

Millsecond or lower is a decent precision for controlling tickrate. 60 fps requires a frame update time of around .0016 seconds
>>
>>54661012
That's seriously overkill just do a remainder and a switch case.
>>
Reading C Primer Plus 6th edition, and on chapter 12, my god, I find scope to be so simple but Stephen Prata spends so much time explaining it.
>>
>>54661036
No. Millisecond most definitely is not. I switched from a millisecond timer to a nanosecond timer to find that everything was smooth. Millisecond timers produce jittery awful games.
>>
Anyone here know how streams work in python? Trying to stream a blob from Azure to the filesystem.

get_blob_to_file is attempting to put it in memory (exit code 137 - getting killed due to memory). I figured get_blob_to_stream would solve that but its a bit over my head.

method:

self.blob_service.get_blob_to_stream(container_name='container', blob_name=blob_name, {STREAM})

Would I use something along the lines of

with io.open('file.extension', 'w') as file: and pass in file?
>>
>>54661066

It's an important topic.
>>
>>54661118

oh good, fucked that up.
>>
File: AJ201205080012M.jpg (72 KB, 462x347) Image search: [Google]
AJ201205080012M.jpg
72 KB, 462x347
Hey, how does that book compare to other's OP?

I've heard Sedgewick / Wayne was better and that's what I've been reading. Should I switch?
>>
File: 1463796633895.jpg (226 KB, 869x1776) Image search: [Google]
1463796633895.jpg
226 KB, 869x1776
>>
>>54661066
Great book.
He's just making sure *all* of the readers get it, I assume. I'm sure people got chapter 15 real quick and easy but I know I didn't. (I think that's the one with all the string functions? or is that 9?)
>>
>>54661162
I've only every gotten through the sorts senpai, dont really know
>>
>>54661179
me on the left
>>
>>54661162
I read Sedgewick
Pretty based and gives practical examples

I think Wayne also did a online course which you can probably find on coursea or the Uni (was it Princeton?)
>>
I'm using a long on a shitty calculator.

why does a long doesn't give me negative numbers?
>>
>>54661195
On a scale from 1 to Java, how much of the examples in his text are in Java? Looking at the description it seems like most, but I am not really a Java person.
>>
How do C variables work in assembly?
If I declare a variable in C, and then reference it later, how?
>>
>>54661077
It really depends on genre.

I've found that Millisecond timers perform adequately for most common indy games (Platformer / Rpg).

If you're getting jitter it's from not interpolating between two physics steps to get a approximate position at render time.
>>
>>54661284
It's not Java specific, you could easily convert it to c++
>>
>>54661292
in memory there's an area for floats, and another for integers. so when you declare an int, the compiler allocates space in the integer memory section. it keeps track of the memory location of that int. then if you want to access it you just find the memory location.
>>
>>54661325
>It keeps track of the memory location of that int.
this is what I'm asking
>>
>>54661292
In a register or on the stack.

>>54661325
That's not how it works at all.
>>
>>54661332
>>54661325
I get it, nevermind, thank you anons
>>
It's there any calculator that holds a historial of operations?

That's my big million dollar idea sempai.
>>
File: 1463067231566.png (1 MB, 1280x720) Image search: [Google]
1463067231566.png
1 MB, 1280x720
>>54660463
>Keep overflowing the stack, Hime!
Keep overflowing the stack, Hime!
>>
>>54661292
>How do C variables work in assembly?
It depends on the variable.
>If I declare a variable in C, and then reference it later, how?
If you're talking about global variables, then it would be declared with external linkage, and its name will be a symbol that refers to where your variable resides in memory.
For example:
long a = 10;

.global _start
.extern a

_start:
movq $60, %rax
movq a, %rdi
syscall

When this C file and assembly file are linked together, the program will return 10.

If you're talking about local variables, they reside on the runtime stack or exist only in registers.
>>
>>54660278
can anybody think of an easy way to get the dates of every monday and saturday in a year in a vba script (excel)?

for example this month would be:
5.2 - 5.7
5.9 - 5.14
5.16 - 5.21
5.23 - 5.28
5.30 - 6.4

I have a method that works, but it feels like a dirty workaround and I think there's probably already something in excel that would do the job better, but I'm not sure where to look for it.
>>
>>54661118

I'm using get_blob_to_stream from: http://azure.github.io/azure-storage-python/ref/azure.storage.blob.baseblobservice.html

via:

with io.open(file_path, 'w') as file:
self.blob_service.get_blob_to_stream(container_name='container', blob_name=blob_name, stream=file)


but it still isn't writing anything to the file (it creates it, 0 bytes. Process is getting killed for taking to much memory - does anyone know what i'm doing wrong?
>>
>>54660346
>that feel when you can't get through a knuth lecture because he won't stop stuttering

old man knuth pls
>>
>>54661179
>all those extra lines of code and a third else which will never actually be used.

so rustled.
>>
What is the best fixed-width bitmap font?
>>
>>54661118
Another stream question here

How would i get the pointer to ammend the file instead of erasing it in C#?

Any kind of quick thing to make the pointer search for the end of the file?
>>
>>54661179
>An int is a number without a decimal
>The face below might as well be XD

This was engineered to trigger us, genderwar when
>>
>>54661179
what the literal fuck does the left code do?
>>
>>54661799

Fast inverse square root
>>
File: waeht.png (156 KB, 327x359) Image search: [Google]
waeht.png
156 KB, 327x359
>>54661810
>>
>>54661842
Q_rsqrt(x) quickly calculates an approximation to 1/(x^0.5). Useful for lighting calculations (back when lighting was done on the CPU).
>>
>>54661860
quicker than this?
>>
>program for classes
>do nothing at home
>graduate
>program for work
>do nothing at home
>die
>>
>>54661893
>program at home
>program in classes that aren't programming classes
>do nothing in programming classes
it's great
>>
>>54661888
The other one does integer calculations instead of floating point calculations.
>>
>>54661842
JUMP THE CHASM
>>
>>54661888
Yes.

SSE has an approximate inverse square root instruction that's the same thing baked into silicon.
>>
>>54661901
I just [spoiler]learn Japanese[/spoiler] during classes.
Computer science was a mistake.
>>
>>54661931
How did you fucking know you fucking weeaboo.. That's what I actually do.
I'm on chapter 15 of genki 2, 700 mature cards iirc in anki core 2k
>>
>>54660336
Let's be constructive here. If you don't like the textbook, what alternatives do you suggest?

If being constructive doesn't do it for you, see filename.

Also, everyone else feel free to answer for him.

>SubtleSuggestionRequest.php
>>
Need to learn c++ before July
It's too fucking hard mate
>>
File: out-3.webm (2 MB, 400x300) Image search: [Google]
out-3.webm
2 MB, 400x300
Been working more on my minecraft clone. I implemented the ability to see what side a pick ray was entering a block from. This was horrendous and evil, as most things involving linear algebra are. Luckily there exists nice and optimized algorithms for triangle-ray intersections so I didn't have to solve any systems of equations and optimize them for floating point computation. However constructing the triangles for intersection was a nightmarish pain. I had to construct 2 triangles for every side of a particular block (x,y,z). This triangle construction with some other considerations took in total a maddening ~150 lines of code alone.

Since pick rays now return side information, that means I was able to implement block placement on right click as a neat little demo.

I'll release the source code for this project when it's a little more polished and ready.

>>54661298
>Millisecond timers perform adequately for most common indy games (Platformer / Rpg)
Fucking disgusting. It's not that hard to use clock_gettime or the windows equivalent. Goddamn indie devs.

>>54661799
>http://h14s.p5r.org/2012/09/0x5f3759df.html
Nice dubs.
>>
>>54660278
I'm doing a mini bulletin board using Suave for a class. Actually the class was about ASP.NET and MVC5, but it was too slow and heavy, the code-first approach using the EntityFramework was giving more headache than joy. The tools for making the database schemes are good and the SQLProvider gives me everything that LINQ-to-SQL would give me and saves lots of code.

Still, C# gets all the attention...
>>
>>54662086
>Still, C# gets all the attention...

because C# is goat.
>>
>>54662134
no
{
it's
{
not
}
honestly
{
seriously
}
shit
}
>>
>>54662086

how do you even fuck up code first EF?
>>
>>54662140

You can use K&R brackets if you want.. homo.
>>
>>54662153
otbs
>>
>>54662053
>triangle-ray for a cube world
WHY
>>
File: 1463604502077.jpg (60 KB, 670x503) Image search: [Google]
1463604502077.jpg
60 KB, 670x503
>>54662156
>otbs

Come on, son.
>>
>>54662134
C# is my favourite OOP language, but when making a RESTful API using a functional and stateless approach seems better. So F# is more productive in that case.

>>54662143
By making changes on the models. I expected it to Just Work™. It didn't.
>>
>>54662174
Cubes are built out of triangles man. And the algorithm I used is designed for triangles.

Granted I couuuuld modify it to use the parametric equation for squares but I fucking despise linear algebra and don't wanna touch it.
>>
>>54662180
what do you now like about otbs famalam
>>
>>54662211
I'm sure you could hack around Bresenham's without much difficulty.
>>
>>54662241
yeah but it's done and works perfectly. I have the basic idea of how to modify it for parallelograms.

I'll do that if I'm ever in the weird situation where there's a performance drop caused by ray picking with side detection.

However, I can't see that happening. Ray picking with side detection would happen at most once a frame. The only reason I can think of to need what side the ray is coming from is for block placement. All the other ray picking I can think of in Minecraft (TNT, some mods have laser guns and shit), doesn't give a fuck about the side the ray comes from.
>>
>>54662205
I like NHibernate more than EF, but instead of setting up migrations I just set my application to rebuild database on model change and commented it out when I left for the next dude to deal with it.
>>
File: 1458227072130.jpg (59 KB, 566x800) Image search: [Google]
1458227072130.jpg
59 KB, 566x800
I want to convert my project from Python to a "proper" programming language. I have experience in C and C++, but C++ feels extremely bloated for what I want to do.

The project started out as a hobby/pet project so I just went with Python for quick coding, but right now it's gotten to the point that I need to optimize it, and the most logical way to do that is to move languages.

As I said, C++ feels bloated as fuck, is there like a C + Objects but not full C++?

Here's a github link to the code if anyone has any other suggestions. It's pretty well documented. In short it generates a bunch of stars.

https://github.com/Lemuren/kosmos/commit/6ec71849fca0399f0abd5a363afc0833e6d286f2
>>
>>54662340
Rust.
>>
>>54662340
Just give up and enroll into a humanities program, you're not cut out for "thinking" and other such activities.
>>
>>54662340
Speed is probably algorithm issues. But if you really wanna switch to a faster language you could switch to Scheme or Ruby or something. C doesn't seem suitable and giving up the ability to run interpreted is ehh.
>>
>>54662317
I'm making lots of little one-to-one tables for extending functionality so I can test things easily. This way if I want the user to have a picture, I can just make a table using the user id as primary and foreign key and have the type provider give me a easy access to everything I need without trouble. If I don't like, I can just drop the table.

>>54662340
It's not object heavy, and as you already is using Python, I think that you can use F# really well to redo that.
>>
Is it still worth learning SICP and scheme?

Is there a replacement?
>>
>>54662403
Yes, it's worth it. I know it's kind of become a meme, but it's good.

>>54662398
Maybe it's not object heavy, but I still feel the best way to organize these things is through objects. Having each star be a separate object of a star class just makes sense in my head.

>>54662357
What makes you say that?
>>
>>54662403
Hell yeah.

People are going to recommend you how to design programs. Fuck those people. HTDP teaches design patterns not CS.
>>
>>54662419
>>54662415
Do you recommend the video lectures, or just the book?
>>
>>54662446
I recommend both. The video lectures are a great supplement to the book. The lectures are also really, really good lectures. Like top tier examples on what lectures should be.
>>
>>54662471
it's a shame that no one is seeding it right now ;_;
>>
>>54662471
>>54662486
nvm, it's on youtube
>>
>>54662415
There isn't much changing, so it can use records instead. Stuff like stars dying could be implemented as filtering a list. Better classification using discriminated unions can be also be useful with the pretty printing that the language gives.
>>
>>54662378
>giving up the ability to run interpreted
God damn, what a stupid issue. Compilation of C programs is usually pretty quick, and small to medium sized projects will do a full compile in a matter of seconds. It's not C++ where you need to recompile your template shit for the 10 billionth time.
>>
>>54662378
You realize there are a number of C interpreters though, right?
>>
I want to learn to program, and I have my mind set on making a searchable database that spits back multiple relevant results from several texts based on the keywords entered. What would the best language for me to start on this beginner's project be?
>>
>>54662340
>https://github.com/Lemuren/kosmos/commit/6ec71849fca0399f0abd5a363afc0833e6d286f2

You're literally looking at a bunch of fucking structs. That code straight up translates over to c with just little extra work implementing the sorting functions.
>>
>>54662378
>Ruby and Scheme faster than C
wew lad
>>
>>54662566
C, after you master the important concepts (loops, memory, variables, functions, etc.) move to a scripting, or higher level language to make things quick.
>>
>>54662562
Not to mention JITs
>HolyC
>>
>>54660360
>>54660430
>>54661033

I literally I spent all day wondering why I couldn't get this stupid thing to work, and where I had written everywhere else:
postFixStack.push_back(lhs);


I had written a few lines as:
postFixStack(lhs);


Add .pushback to them and the program works fine. Such a horrible feeling that I didn't see something so stupid.
>>
>>54662624
Rubber duck debbuging.
>>
>>54662486
>>54662498
It's available on the MIT website...
>>
>>54662624
it's probably because stack and back rhyme
>>
>>54662566
Depends how serious you are about it. Typically text search and databases are written in low level languages ala C or at least something but then none of those things are really something you're realistically going to deal with as a novice.

If you want a learning project then you could give it a swing, probably learn a lot, language would be largely irrelevant.
>>
should I learn ML or Ocaml after having finished Scheme
>>
What is the real difference between jpg and png?
They seem to be long strings of characters and numbers, and it is very quick to translate between the two. And they can be launched with the incorrect filenames..
>>
>>54662692
>they can be launched with the incorrect filenames..

Your image viewer is looking at the header, not the file name.
>>
>>54662671
Standard ML is more in touch with the ML family's academic roots than Ocaml is, but the latter is morel likely to be found out in the world (although both are quasi-obscure). It's kind of like the scheme/common lisp dichotomy with scheme being the more elegant tool but CL being the thing you use when you need to get shit done, often at the cost of significant kludginess.
>>
>>54662692
jps is lossy png is lossless
thats the main difference
png also supports alpha while standard jpg doesnt
>>
>>54662692
Use PNG for illustrations, comics, line art, manga, screenshots that look decent with 256 colours.

Use JPG for photos, high-quality art, computer generated rice-traced wallpapers that looks decent with 256 million colours and a bit of fuzz.
>>
htis is sleepytime

goodnight f;;dpt
>>
>>54662692
The way they compress images is completely different.
Also, PNG is lossless, so no data is lost in encoding, while JPG is not.
>And they can be launched with the incorrect filenames
Nothing actually cares about the filename. The files themselves contain numbers which identify them as PNGs or JPGs.
>>
>>54662671
If you are familiar with .NET, F# is also a ML-like alternative.
>>
>>54662086
Those m$ cucks need to put HKT into CLR already
>muh VB interop!
holy shit who still codes VB
>>
File: 1368958148877.gif (141 KB, 700x727) Image search: [Google]
1368958148877.gif
141 KB, 700x727
>>54662737
Nighty night, frum other hemisphere.
>>
>>54662403
Clojure is where jobs are at, so learn that
>>54662671
F# has more prospects, but not all of the features (e.g. functors are missing). It does include some not features in others tho
>>
>>54662692
If you're asking about the file format's binary structure, it's probably better to google it, few people here can help
>>
>>54662745
>no data is lost
m8
>>
>>54662791
You don't know what lossless mean, do you?
From something that is losslessly compressed, you can retrieve the original file exactly as it was.
>>
>>54662760
>Clojure is where jobs are at, so learn that
Within the lisp world I guess but finding a half decent clojure job isn't a walk in the park. I've been trying to land a decent gig slinging clojure that isn't an ad analytics platform (I fucking hate ads analytics, I don't even have a particular gripe with ads, it's just the analytics side of it that's painfully boring) on and off for like a year.
>>
>>54662804
>You don't know what lossless mean, do you?
I do actually

>From something that is losslessly compressed, you can retrieve the original file exactly as it was.
True, the issue here is that you don't know what the term "data" means
>>
>>54662831
>you don't know what the term "data" means
The original image data, as in the colour of every pixel.
>>
>>54662581
>>54662650

C it is. Thanks guys. If it matters, the idea is to input a topic or something and have it spit back bible verses, quotes from the catholic catechism and past popes, church fathers, etc.

It's a real niche thing but it's a niche that needs filled and I'm dedicated enough to do it.
>>
>>54662852
Data is lost though. "Data" describes bit patterns, not meaning or image under transform (decompression). Data is fundamentally lost because png encoding take less space than raw image data.
>>
>>54662900
You're a fucking retard.
>>
File: Dog.jpg.converted.png (104 KB, 189x189) Image search: [Google]
Dog.jpg.converted.png
104 KB, 189x189
>>54662745
>>54662791
I used to use PNG as if it was a zip. Relevant image.
>>
>>54662900
If you convert an uncompressed BMP to PNG and then back to BMP, you will get a bit-identical file back.

Same as if you had converted WAV to FLAC and back to WAV
>>
>>54662671
SML is nicer since it's a very specifically designed language, but it lacks a lot of the features of the more advanced features in OCaml (GADTs, open types, polymorphic unions, etc.)
It's also a bit more lacking in the space of library/tooling support but for most usage it sees that's not a problem
>>54662725
this is mostly right, but I think it's more of a double-edged sword than that. I think that both could learn a few tricks from the other
>>
>>54662340
Racket.
>>
>>54662403
Of course. There's a
#lang sicp
available for Racket.
>>
>>54663074
I'm using guile since it's built in
>>
>>54660338

Generate an AST. Let the AST translate to brainfuck.
>>
File: 4CLRorotn5Wa2VYZR-X_1Q.jpg (30 KB, 290x387) Image search: [Google]
4CLRorotn5Wa2VYZR-X_1Q.jpg
30 KB, 290x387
PROBLEM:
I took apart an apk and tried to recompile it into android studio. i get alot of errors. help.

GOAL:
I found an apk that installs assets to a newly created file path. I want to just change a few things and repackage it to sell it.
I make game expansion packs and google play can help me for a wider group rather than just paypal my shit.
>>
>>54663103

It might be easier to transpile to C. There are C to BF transpilers available.
>>
File: bffordummies.png (3 KB, 641x33) Image search: [Google]
bffordummies.png
3 KB, 641x33
>>54660338
Sounds like a fun as fuck project. As well as the other anon's suggestions, check out this doc, Brainfuck for Dummies, which has a ton of functionality you can transpile to Brainfuck. Link in the image as 4chan thinks my post is spam
>>
>>54663394
pastebin nigga
>>
>>54663434
I am behind the times

http://pastebin.com/QuimMu0K
>>
>>54660278
A package for atom.
>>
New to OOP.

In C++ how would i call the default constructor from a constructor with arguments?
Basically I want to retain the default initialization without having to duplicate code and just fill in the extra variables I passed in.
>>
File: st.jpg (61 KB, 670x645) Image search: [Google]
st.jpg
61 KB, 670x645
>>54660278
Trying to apply Dijkstra's algorithm to run on a complete graph under some constraints. I need to find the shortest path from the first node to the other 8 nodes, but I have 3 mandatory edges that I need to traverse through.

It was easy modifying Kruskal's Algo to accommodate the constraints. But this is confusing.
>>
>>54663549
Did they dieded?
>>
>>54663558
I don't know man. He posts some weird stuff.
http://www.thobias.se/vice/
>>
>>54663592
>fashion
Ok it's just an ad campaign.
Didn't look like a person trying to land well, that bottom one.
>>
>>54663542
>In C++ how would i call the default constructor from a constructor with arguments?
The syntax is `<constructor signature> ":" <superclass constructor> "(" <subset of subclass constructor args> ")"`. So like:

class FooBar : SuperClass {
public FooBar(int ag1, int arg2) : SuperClass() {
// init as usual
}
}
>>
>>54663616
No I'm not intending anything that complicated.
I found that you could do sortof what i want but that was for passing arguments pass arguments to a constructor.
class Foobar{
Foobar();
Foobar(int arg1,int arg2):Foobar(){arg1Destination=arg1;arg2Destination=baz(arg2);}
}
This is what I want to do.

Does it have to be in the class declaration?
>>
>>54663558
It looks like they're jumping into something. Look at the feet of blue.

Also my god red's hair is shiny.
>>
>>54663643

Are you talking about something like this?

class foobar {
foobar();
foobar(int arg1, int arg2);
private:
int arg1destination;
int arg2destination;
};

foobar::foobar()
{
// Do something
}

foobar::foobar(int arg1, int arg2) : foobar::foobar() {
arg1destination = arg1;
arg2destination = arg2;
}


Assume that the foobar class definition is in a head file and the actual implementations are in a cpp file.
>>
>>54663643
On MSVC 11 (2012) if that matters.
>>
>>54663643
Oh, you just want to call the same (not super) class's default constructor? Uhh, I'm not sure, I don't know that I've ever run into that. I'd typically do something like:

class Foobar {
Foobar() {
init();
}
Foobar(int arg1, int arg2) {
// assign constructor args to member props or w/e
int();
}
private:
init() {
// whatever shared logic exists between the default constructor and your alternative constructor
}
>>
>>54663700

Oh and and I forgot to put a public: tag before the constructor definitions.
>>
>>54663714
>int();
err, *init();
>>
>>54663714

This method does work just fine..

class foobar {
public:
foobar();
foobar(int arg1, int arg2);
void printArgs() { cout << "Arg1: " << arg1destination << " Arg2: " << arg2destination << "\n"; }
private:
int arg1destination;
int arg2destination;
};

foobar::foobar()
{
cout << "It worked! \n";
}

foobar::foobar(int arg1, int arg2) : foobar::foobar() {
arg1destination = arg1;
arg2destination = arg2;

printArgs();
}

int main(void)
{
foobar foo(1, 2);
cin.get();
return 0;
}
>>
File: Microsoft Visual Studio.png (12 KB, 539x283) Image search: [Google]
Microsoft Visual Studio.png
12 KB, 539x283
>>54663700
That's exactly what I want (assuming I understand it correctly).
>>54663714
>init()
That's a nice solution i suppose.
It'd be pretty to not have to do that.
>>54663740
Not for me.
>>
>>54663751
Oops. Left out the default constructor declaration in the header.
It's there though
>>
>>54661179
The only thing I like about the right hand side is that at least it's commented - albeit some of them are obviously unneeded.
>>
>>54662019
It's really not, though.
>>
>>54663751

Odd it should be working Delegating constructors should be supported in most c++11 compatible compilers.

https://en.wikipedia.org/wiki/C%2B%2B11#Object_construction_improvement
>>
>>54661179
Assuming that's real. She's trolling.

It's perfect. Comic-sans, the fast inverse square root, the comments.
Doesn't even implement the same thing.

Wouldn't surprise me if she was hired by some sexist organization that wants to alter the perception of women who code.

That said women are very good at writing clear code. Looking at code-review/years experience anyway. Maybe just hyperbole.
>>
what happens in the case of:
AH := AL * AL

are the higher bits of the product assigned to AH and the lower bits lost?
are the lower bits of the product assigned to AL?
>>
>>54663823
>Assuming that's real.
On 4chan, that's a pretty big assumption.
>>
>>54661194
hey john, shouldn't you be fucking your wife or writing game engines no one is going to use instead of posting /g/?
>>
>>54661842
Limmy's show should be a real thing.
We have streaming services now.
Why can't there be something like that now?
People throw money at people who play videogames for literally nothing why can't this exist?

Just take a comedian and fucking do it.

It's a stream anyway. Nobody expects quality 100% of the time. I'd watch highlights.
>>
i'm currently making a basic chess game in python.

my plan is to have a method in a "chess piece" class which returns a list of valid positions the piece can move to.

is there a way to do this method that's better than just a bunch of conditionals?; e.g."if the piece is a pawn, and these conditions are met, then these spaces are valid".

thoughts appreciated xo
>>
File: 1463817277914315725151.jpg (1 MB, 3120x4160) Image search: [Google]
1463817277914315725151.jpg
1 MB, 3120x4160
>>54660278
>>
Doing my favorite things: deleting old code and replacing larger blocks of code with new code that has the same functionality, but with less bugs, often faster, and takes less space.

Inefficient algorithms begone!
>>
>>54663977
def available_places(gridx, gridy)
"""
returns a list of available pieces on an 8x8 chess board given its size, based on self.x and self.y (or a vector object). Spaces containing an edible piece are also returned. Pawns are special, they have a self.is_first_turn variable
"""

def edible():
"""
returns a list of object types that are edible. Uses 'is' to check the other piece
"""
>>
File: 122711ronpaul-236x300.jpg (18 KB, 236x300) Image search: [Google]
122711ronpaul-236x300.jpg
18 KB, 236x300
>>54661962
Hey yeah, that's a great idea! Let's all listen to this guy and do what he says! >_>

<_<
>>
>>54664048
readable edition
def available_places(gridx, gridy)
"""
returns a list of available pieces on an 8x8 chess board given its size, based
on self.x and self.y (or a vector object). Spaces containing an edible piece are
also returned. Pawns are special, they have a self.is_first_turn variable
"""

def edible():
"""
returns a list of object types that are edible. Uses 'is' to check the other piece
"""
>>
gonna start developing a game from scratch in C

i've been learning music and drawing too so i can make this dream a reality, plus trying to convert my mediocre c++ knowledge -> decent c knowledge

it's tedious and hard but satisfying to see myself improve
>>
File: error.png (37 KB, 713x524) Image search: [Google]
error.png
37 KB, 713x524
help sempaitachi.
>>
>>54664108
>Babby's first calculator failed this hard
>>
>>54663549
>SOS 666

tryhard provocativeness
>>
>>54664183
Not him.
Android is a mess.
I honestly would recommend just wrapping the NDK unless you really can't avoid it.
>>
>>54664096
Are you going to use actual engine?
Because if you are I wanna which engine exports C api.
>>
>>54664183
the project works on windows, but can't get it to work on my phone.
>>
>>54664205
I'm using the Allegro library.
>>
>>54664096
handmadehero.org
If you ever need it.

It's actually not that hard. But I feel like you're in for a lot of pain if you don't know how to design programs.
>>54664222
Personally recommend GLFW but that's fine.

Dunno what you consider from scratch about using a game-library though but that's fine. Taking that step puts you above 90% of /agdg/.
>>
>>54663823

cd kode
cd ..
cd kode
cd kode
cd kode
cd ..
cd ..
>>
>>54664247
Thank you. Also, by "from scratch" I meant not using an engine/game maker like RPG Maker or some other cancerous thing. I haven't done anything of this scale before so I'd need a multimedia library to get my foot in the door, so to speak.
>>
>>54661179

>Incorrect indentation on the right-hand side

Given how much she's boasting about her clear and readable programming...
>>
>>54664280
Yeah. It makes sense.
Handmade hero is a great guide in many ways. I understand you probably want to make your project your own. But I think maybe leading with this is a good idea:
https://hero.handmade.network/episode/game-architecture/day026
It's an introduction to how games are generally structured with motivation. It's very good.
>>
>>54664299
I think this will be very useful. Thanks, Anon!
>>
I'm gonna do my thesis on GPGPUs in a few months and I was wondering which would be better: nvidia cards or amd cards

What do you think, /g/?
>>
>>54664335
>nvidia cards or amd cards
Why don't you start a Vim VS Emacs thread while you're at it?
>>
>>54664029

>No fold marks, completely pristine

It's not a fucking picture. You're giving that picture no love at all, for shame.
>>
>>54664345

maybe if I was actually trying to incite a flame war, I would
>>
>>54662053
Mojang on suicide watch.
>>
>>54664037
>I love bumming code

There, I made your post more efficient. Don't proclaim your love and not practise it everywhere.
>>
nvidia. They're just more well established.
Depends on what you do though.
>thesis on GPGPUs
Is kinda broad.

AMD is more open source though. But it's certainly not like you can look at what the card does.
>>
Found this article by the maker of the self made hero series because someone was talking about him here.

He basically shits on OOP.

https://mollyrocket.com/casey/stream_0019.html

Thoughts?
>>
File: short_capture.webm (3 MB, 1328x592) Image search: [Google]
short_capture.webm
3 MB, 1328x592
warnet.io

An indie game Ive been working on my own for ages now ... Its getting there..... slowly
>>
>>54664576
are you my shitty C prof.?
>>
#define usingNavVar(n)  Vector2 Position=n.Position;\
Vector2& Velocity = n.Velocity;\
Vector2& Direction = n.Direction;\
float& acceleration = n.acceleration;\
float& maxSpeed = n.maxSpeed;\
float& maxTurnSpeed = n.maxTurnSpeed;\
float& minTurnSpeed = n.minTurnSpeed;\
float& rotationSpeed = n.rotationSpeed;\
float& friction = n.friction;

Does anyone think this is a bad idea?
I really get sick of referencing my long descriptive names sometimes.
Usage would be
{//Nav
usingNavVar(Nav); maxSpeed=PLAYER_DEFAULT_MAXSPEED;
}


I don't see how it could fail. Unless I forget the block. But maybe I can somehow fix that too? Can I create named scopes in C++?
Something like
{//OtherScope
{
#BEGINSCOPE(Name)
//do stuff
{
//other seperate scope

#ENDSCOPE(Name)

}//other seperate scope ends here
}//OuterScopeEnds


>>54664564
>OOP
That's the kind of language discussion that always goes sour.
Also I read that back then. It's not even about OOP. He just shits at OOP at the start because it doesn't allow for his semantic compression scheme to work.
Not saying he's wrong about shitting on OOP. I really dislike OOP too.
I certainly agree that those code transformations would be way more difficult in OOP'd code. And you'd fight with the encapsulation. Arguably there'd be a clear way to extend the code to a more general case if it was in OOP but that's really just someone else doing the work he's doing here upfront.
>>
>>54664589
>Epic moneymaking scheme
Post a key or GTFO faggot
>>
>>54664589
Looks pretty sweet anon.
Probably won't make much money. It's a complicated game I'm assuming.
>>
#include <stdio.h>

int main( ) {
int a,i,y,j,c;
printf("enter starting number: \
scanf("%d",&a);
printf("enter max number: \n");
scanf("%d",&c);
printf("Prime numbers between %d and %d\n",a,c);
for(i=a;i<c;i++) {
for(j=2;j<c;j++) {
y= i*j ;
if(i%j==0 && y%2!=0) {
if(j<i) {
break;
}
else {
printf("%d\n",i);
}
}
if (i==c) {
i=1;
if(j == c) {
break;
}
}
}
}

I wrote a code to find prime numbers. How is it?
>>
>>54664617
My computer didn't copy some things but you get the idea.
>>
>>54664601
>>54664613


I know I have yet to make enough to buy some ramen, I am wondering whether I could somehow get a publisher on board, but I have no itnerest in anything other than programming the game. I just cannot get interested in marketing, turning it into a business. I have no contacts in the industry , I am just totally alone with it.

Atleast recruiters seem to like it *sigh*
>>
>>54660278
We should make a pastebin containing essential programming literature that we can put in every OP.
>>
>>54664646
Yes, that would be really helpful
>>
>>54664646
Yes, we should.

*chirp chirp*
>>
File: opensuse.png (97 KB, 1599x857) Image search: [Google]
opensuse.png
97 KB, 1599x857
I also built this, this week.
>>
>>54661433
don't all modern compilers return (void*) after a malloc?
>>
>>54664636
Contact them. What's the harm? Pitch the game.
If you can say it's already done pretty much that's a big plus.

Projects usually start with funding. This is a project that you funded and want to have someone help you market.

You should probably also know you're in a strong position (assuming they think there's good moneymaking potential for the game) because you're so close, there was recently this big web game and stuff.
>>
>>54664564
That's because most of OOP is a meme.

Inheritance is a meme because it is messier than using mixins, interfaces and practicing composition

Encapsulation is a meme because no one working on your project, or with your tools is going to care about what's public or private

Representing everything that can be represented as an object, using classes is unnecessary effort
>>
>>54664669
Doesn't work. (Click the box, there's no cursor, can't type anything in)
I run chromium on windows.
Disabled adblock.
>>
>>54664346
I have a copy too but I'm too ashamed to admit I can't read it because it's way too hard
>>
>>54660278
That's a big book.
>>
I'm learning C and I'm a little lost with regards to the right way of doing even basic things in the language. Like for instance, suppose I want to write a function that takes some values as input and returns a string based on those values. Since strings aren't a primitive type in C and since the way strings are declared affects how much memory is allocated to them, then it seems that the only ways to write such functions are to do pointer stuff and/or rely on side effects or something (I'm not going to pretend I totally understand what's going on).

Am I supposed to be writing these functions as a function that take in said input values and a string and then alter the string in the process (i.e. altering the state via side effects)? I'm a mathfag coming from a functional programming background so forgive me if I sound retarded for asking something so basic, but it just seems like it wouldn't be the standard way to do things.

Is there a recommended text for learning modern C11?
>>
>>54664697
hmm it should atleast work on chrome, thanks for the feedback Ill try to fix it.

>>54664679
Thank you for your reply. The hardest part is even knowing who and how to pitch them the game. Do I just email random suits in big companies? Im pretty confused about how to go about it. But thanks.
>>
>>54664738
>Do I just email random suits in big companies?
Well I'm just offering "common sense" advice from a position of ignorance.
Should have said that.

But I'm sure there's good information somewhere.
I think maybe look for a similar project as yours and email a developer (or multiple, if you're not expecting an answer) asking them.
People help a lot when you ask.
>>
>>54664764
Thank you man, have a good day dude
>>
File: 1445731801488.gif (1 MB, 560x460) Image search: [Google]
1445731801488.gif
1 MB, 560x460
>>54662624
iktf

a couple days ago I was looking for a memory leak, and it took me almost 2 hours to find that I had a negation operator in the wrong place
Thread replies: 255
Thread images: 34

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

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.
If a post contains personal/copyrighted/illegal content you can contact me at [email protected] with that post and thread number and it will be removed as soon as possible.
DMCA Content Takedown via dmca.com
All images are hosted on imgur.com, send takedown notices to them.
This is a 4chan archive - all of the content originated from them. If you need IP information for a Poster - you need to contact them. This website shows only archived content.