[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: 336
Thread images: 47

File: yF1VCTm.jpg (89KB, 1366x768px) Image search: [Google]
yF1VCTm.jpg
89KB, 1366x768px
Old thread: >>57068375

What are you working on, /g/?
>>
File: haskell..png (7KB, 397x131px) Image search: [Google]
haskell..png
7KB, 397x131px
>OOP
just use Haskell instead
>>
>>57072629
>Heskell
Just use assembly.
>>
which haskell though

there's a billion out there

there's great fragmentation
>>
>>57072697
aarch64 assembly is my favorite.
>>
>>57072697
GHC
>>
>>57072697
What most people refer to as Haskell is in fact just GHC Haskell
>>
>>57072629
I'd just like to interject for a moment. What you’re referring to as Haskell, is in fact, GHC Haskell or, as I’ve recently taken to calling it, Useless Programming Language X. Haskell is not a useful programming language unto itself but rather another useless component of the FP circle jerk financed by taxpayers earning real money with real programming languages.
>>
>>57072868
nice meme but watch this
>xd
what are you gonna do now
>>
File: 1476249731621.jpg (229KB, 1281x721px) Image search: [Google]
1476249731621.jpg
229KB, 1281x721px
So I was tasked with making a program (in java) that takes an amount of seconds and converts it to a time. I've wrote it and it compiles and runs fine. But I want to use the joption panes to input the amount of seconds and then another joption pane to display the time. How would I do this?
Here's my code

import javax.swing.JOptionPane;

public class Exercise4 {

private static final int MinsInHour = 60;
private static final int SecsInMinute = 60;

public static void main(String[] args) {

int seconds = 50391;

System.out.println(timeConversion(seconds));

}

private static String timeConversion(int seconds) {

final int MinsInHour = 60;
final int SecsInMinute = 60;

int minutes = seconds / SecsInMinute;
seconds -= minutes * SecsInMinute;

int hours = minutes / MinsInHour;
minutes -= hours * MinsInHour;

return hours + " hours " + minutes + " minutes " + seconds + " seconds";
}
}
>>
I can't tell if people are joking about Haskell being useless because of the title of that video or if people actually think Haskell can't do anything.
>>
need performance - use C

need convenience - use whatever is most convenient
>>
>>57072932
> java
> returning formatted string instead of an object
> pajeet, go awy
>>
>>57072629
I want to delve more deeply into Haskell and Lisp/Scheme because they are very interesting from a conceptual point of view, but I don't have any idea of things to create with them so I could learn more than the basics by practicing.
I'm mostly interested in audio processing and stuff like this where you have to take care of things happening at a low-level, and C/C++ have everything I need for that, plus Python for quick prototyping and scripts.
And I feel like I should learn more useful stuff like GUI programming and make more practical projects with those three languages right now.
>>
>>57072932
first you would read about joptionpane
the problem here has nothing to do with the code you've given us really
>>
>>57072936
SPJ clearly says in the video that Haskell is useless.
>>
>>57072936
I can't think of any area where Haskell would be actually useful or better than any other alternative.
>>
>>57073026
Well, it's empirically not.

>>57073068
Language implementation, especially type theory, is a big one.
>>
Does anyone here has any idea how to work with MBDyn?

There is some official documentation, but no proper detailed help, no books, no nothing.
>>
>>57073068
type THEORY

that's a big one
>>
Working on a replacement for a faggot Excel based reporting system used by a fuck-huge aerospace firm.

Shit fucking culture there though.
>>
>>57073143
Mathematical theories are not theories in the pleb sense, that is unproven ideas.

I mention type theory because both Agda and Idris are implemented with Haskell.
>>
>>57073209
agreed

what advancements have you made in type theory today
>>
>>57073209
Explain again why it's easier to implement Idris in Haskell than in, say, C++.
>>
>>57073143
for you
>>
>>57073234
https://github.com/idris-lang/Idris-dev/tree/master/src/Idris
>>
>>57073277
>i've got nothing
hmm
>>
>>57073288
look at any of the code
>>
File: discord-logo.jpg (36KB, 1080x675px) Image search: [Google]
discord-logo.jpg
36KB, 1080x675px
You guys are cordially invited to the /dpt/ discord

https://discord.gg/tzAR2
>>
>>57073305
this really IRCs me
>>
>>57073288
look at the code, i don't have time to write down an argument
>>
>>57073295
Look at this: https://github.com/llvm-mirror/clang

C++ is obviously the best language to implement compilers in.
>>
>>57073328
you're clearly just trolling
>>
File: 1476466461349.png (2MB, 4096x2048px) Image search: [Google]
1476466461349.png
2MB, 4096x2048px
complete (semi-opensource) stronghold rewrite (as a side project)

converting and packing of the assets works so far.
>>
>>57073335
stop projecting
>>
>>57073234
Because Haskell is basically a language designed entirely around manipulating trees. Capture-avoiding substitution in a lambda calculus forms a monad, too.
>>
what's a nice cheap laptop I can use to practice programming when I'm not at home?
Bonus point if there's a pink model
>>
>>57073351
>hahaha projection
havent you lost enough
why give up your dignity
>>
>>57073363
any cheap laptop that has a pink model will do
>>
>>57073364
Haskellfags lost when they implied that the Idris compiler being implemented said anything about the usefulness of Haskell. Haskellfags using Haskell? Amazing.

At this point Haskellfags have been utterly destroyed.
>>
https://wiki.haskell.org/Haskell_in_industry
>>
File: euphoric.jpg (38KB, 548x618px) Image search: [Google]
euphoric.jpg
38KB, 548x618px
>>57073433
>Haskellfags lost when they implied that the Idris compiler being implemented said anything about the usefulness of Haskell. Haskellfags using Haskell? Amazing.
>At this point Haskellfags have been utterly destroyed.
>>
>grams a little bit
>calls himself a programmer
Is there anything more cringy? If you're not making money you're not a pro, no matter how good you are at gramming
>>
>>57073350
is that the rts where you could use suicide niggers to burn enemy structures?
>>
>>57073557
t. congammer
>>
>>57073473
>unemployable neckbeard obsessed with his own intelligence and disgusted the ways of normal people
Is that a photo from the last FP convention?
>>
>>57073570
Yeah, it's the guy that kept trying to shut it down while crying that it's not a real language
>>
File: jg.jpg (368KB, 1360x768px) Image search: [Google]
jg.jpg
368KB, 1360x768px
>>57073464
kek

* 1.1 billion desktops run Java
* 930 million Java Runtime Environment downloads each year
* 3 billion mobile phones run Java
* 31 times more Java phones ship every year than Apple and Android combined
* 100% of all Blu-ray players run Java
* 1.4 billion Java Cards are manufactured each year
* Java powers set-top boxes, printers, games, car navigation systems, ATMs, lottery terminals, medical devices, parking payment stations, and more
>>
>>57073585
wow

that's a lot of C devices
>>
File: p3.jpg (124KB, 415x315px) Image search: [Google]
p3.jpg
124KB, 415x315px
>* 1.1 billion desktops run Java
>* 930 million Java Runtime Environment downloads each year
>* 3 billion mobile phones run Java
>* 31 times more Java phones ship every year than Apple and Android combined
>* 100% of all Blu-ray players run Java
>* 1.4 billion Java Cards are manufactured each year
>* Java powers set-top boxes, printers, games, car navigation systems, ATMs, lottery terminals, medical devices, parking payment stations, and more
>>
File: 716342.jpg (4MB, 2560x1600px) Image search: [Google]
716342.jpg
4MB, 2560x1600px
>>57073565
that's stronghold crusader. but basically the same. it's from 2001 and has the most beautiful hand drawn assets. too bad it never actually reached its potential like giant maps and stuff. Im gonna fix that
>>
>>57073585
It really amazes me how such an awful language is used by so many
>>
>>57073609
this is a good post
>>
>>57073616
java is a product mean to be sell.
>>
if python is to c what haskel is to java then what is lisp to?
>>
>>57073079
>when is this language ever useful?
>it's useful for implementing other, more useful languages
>...in theory, in practice no one uses compilers implemented in haskell
couldn't make this shit up if i tried
>>
I wish i knew one of you anti-OOP people irl, so i could discuss design in person.
>>
>>57073642
>misinterpreting the word "theory" again
>>
>>57073642
Kekked out loud.
>>
>>57073636
premises are contradictory
>>
>>57073652
attend a good CS conference and you will meet all sorts of crazy people
>>
>>57073690
But that doesn't help me now.
>>
>>57073652
what are your questions about design
>>
>>57073636
haskell is older than java and lisp is older than anything.
>>
>>57073724
I'm writing a small wrapper library for WASAPI, to be used for audio playback. I've heard a lot about not trying to cram everything into the oop paradigm, so i thought i'd try to avoid that. But i really see no reason why i shouldn't contain all the library functions and internal config variables in a class.
>>
>>57072966
I'm a student who needs help, educate me.
>>
>>57073873
Yeah, when you pay me for my time
>>
>>57073026
'That video' is from 2011.

>>57073234
It's probably not. Once you get to high enough level, all languages have pretty much the same efficiency. For instance, Lean is written in C++, Isabelle in Standard ML and Coq in OCaml.

>>57073361
Nice buzzwords. They don't even use the latter fact anywhere in the development, though.
>>
>>57073828
use golang
>>
Animu usenet indexer

Finally got around to working on it again after ages. Pic related is the series page, where different releases related to that show get shown.
>>
I just had craziest bug tonight.
It looked like this
 
char* foo2txt(int foo){
static char buf[32];
switch(foo){
case E1 : return "EhOne";
case E2 : return "EhTwo";
case E3 : return "EhThree";
defualt:
snprintf(buf, 32, "err E%d", foo);
return buf;
}
}

I've made a unit test and it was failing because it was like "expected: "err E444", got <gibberish>".
I thought I was going crazy. Not only it printed gibberish, debugger on switch case didn't went into default branch. It went right to the end of function on the "}".

Then I realized that I misspelled "default" and warnings are at not decent level enough.

SICP save me from the sins of C.
>>
>>57074179
t. Cy De Fect
>>
File: laughing eating salad.png (198KB, 337x225px) Image search: [Google]
laughing eating salad.png
198KB, 337x225px
Is this what it looks like when you program?
>>
>>57074202
That man doesn't look like he's laughing nor eating a salad
>>
>>57074179
>and warnings are at not decent level enough
Why don't you stop hitting yourself?
>>
>>57072602
Making a PCB
>>
>>57074179
Exciting lack of basic checks C
>>
>>57074202
More like this. My back really doesn't appreciate my career.
>>
>>57074226
Because I've switched to modern portable CMake from my Makefiles that have -Wall -Werror.

And it seems this modern portable cmake has no feature for this out of the box (http://stackoverflow.com/questions/2368811/how-to-set-warning-level-in-cmake)

For fuck sake.
>>
>Copy/pasting something from the erlang documentation
>Somehow it gives me an error, even though I didn't change anything
>Can't manage to fix it by myself
I feel so stupid sometimes.
>>
>>57074132
No.
>>
File: neko desu.gif (1MB, 487x456px) Image search: [Google]
neko desu.gif
1MB, 487x456px
Why do people use cmake?

Writing a generic makefile is pretty easy, and if your needs get complex, it also punishes you by making you describe your complexity in a terse way.
>>
>>57073305
>willingly creating a circlejerk place where most of the people will be tripfags anyway who are obnoxious in the thread alone to begin with

enjoy your cesspool
>>
>>57074303
when people post cute anime girls I take it in good faith that the posters actually look like that and it makes my 4chan experience a lot more enjoyable desu
>>
>>57074303
>Writing a generic makefile is pretty easy

Writing a generic CMakeLists.txt file is even easier, and it comes with the added benefit of portability.
>>
>>57074303
"muh portability"
>>
>>57074368
>>57074371
I don't understand?

Do GNU makefiles not work in all versions of GNU make on every platform?
>>
>>57074388
>Do GNU makefiles not work in all versions of GNU make on every platform?
AAAAHAHAHAHAHA
>>
>>57074368
Not having to write any build system config is even easier because I dont use a cucked language
>>
>>57074441
Which language is that?
>>
>>57074461
Java
>>
>>57074494
How big exactly is Oracle's cock?
>>
File: 1271220533348.jpg (10KB, 252x248px) Image search: [Google]
1271220533348.jpg
10KB, 252x248px
>>57074494
> java
> not cucked

That's funniest thing I read today
>>
>>57074494
>
>>
>>57074314
There's no tripfags in there at the moment that I know of.

So far, the discussion has actually been on-topic and not faggoty.
>>
>>57074611
Just give it some time, that's what happened with essentially every other "official <x> discord guys" on 4chan.
>>
>>57074303

I used to prefer plain makefiles, but CMake is actually pretty simple once you get used to it. It's also a lot more flexible when your needs get complex, and can generate targets other than makefiles if one wants. For instance, Ninja files, which are faster to parse.
>>
File: maxresdefault.jpg (121KB, 1600x900px) Image search: [Google]
maxresdefault.jpg
121KB, 1600x900px
>>57074611
Heeerreee's Johnny
>>
File: 1456140456887.png (16KB, 454x163px) Image search: [Google]
1456140456887.png
16KB, 454x163px
>>57072602
working on pic related
so far got my asian_countries.txt and hobbies.txt
it takes 5 mins to write a script that takes data from those two and applies the formula at random, pic related

why? idk fucking why
>>
File: stallman gnu drake.jpg (186KB, 690x460px) Image search: [Google]
stallman gnu drake.jpg
186KB, 690x460px
>>57073305
>requires downloading AND running nonfree JavaScript blobs to even LOAD THE FUCKING page
>>
>>57074627
This. These things start out great until the tripfags/people who act like tripfags come crawling out of the woodwork.
>>
File: malaysian funny pages.jpg (26KB, 400x300px) Image search: [Google]
malaysian funny pages.jpg
26KB, 400x300px
>>57074687
I wanna see it when it's done, anon.
>>
>>57074648
Things I like about CMake: modules.
cotire(precompiled headers for the project in couple of lines!), FindWhatever are awesome.

options() are good (as kdevelop UI supports them)

Things that really grinds my gear: code generation. add_custom_command feels awkward after "%.tab.c: %.y\n\t$(YACC) $<"
>>
File: anal beads.png (16KB, 281x419px) Image search: [Google]
anal beads.png
16KB, 281x419px
>>57074687
Oh, that's pretty similar to my racial slur generator.

You can use https://restcountries.eu/rest/v1/all for the demonyms.
>>
File: anal beads.png (18KB, 365x295px) Image search: [Google]
anal beads.png
18KB, 365x295px
>>57074687
>>57074812
Well that took all of 5 seconds.

I'm using the wikipedia article on arts and crafts that end in "ing".

Pic related. Now I just gotta filter by region...
>>
File: 1393543032283.jpg (29KB, 380x250px) Image search: [Google]
1393543032283.jpg
29KB, 380x250px
>haven't touched C in 5 years
>asked to modify some program in C

Any good tutorial to remind myself of C again? I already know basics
>>
>>57074866
well fuck you too anon
>>
Someone give me a problem to solve, I wanna test my knowledge.
>>
>>57074870
K&R
>>
>>57074911
Traveling Salesman problem.
>>
>>57074179
>defualt
>>
>>57074921
Tell the salesman to get a less shittier job
Next
>>
>>57074911
test if every even number greater than 2 is the sum of 2 prime numbers
>>
>>57074932
3-SAT
>>
File: anal beads.png (18KB, 395x293px) Image search: [Google]
anal beads.png
18KB, 395x293px
Alright, now it only uses demonyms from the Asian regions, and randomly cycles through "message board", "image board", and "forum".

C# Source (5-minute job, pardon the mess):

var demonyms = new List<string>();

var url = "https://restcountries.eu/rest/v1/all";

using (var client = new HttpClient())
{
var response = await client.GetAsync(url);
var result = await response.Content.ReadAsStringAsync();
var json = JArray.Parse(result);

WriteLine(json);

demonyms = json
.Where(x => ((string)x["region"]).Equals("Asia"))
.Select(x => (string)x["demonym"])
.Where(x => x.Length > 1)
.ToList();
}


HtmlDocument doc = new HtmlWeb().Load("https://en.wikipedia.org/wiki/Category:Handicrafts");

var slurs = doc.DocumentNode
.SelectNodes("//a[contains(@href, '/wiki/')]")
.Select(x => x.InnerText)
.Where(x => x.Length > 2 && x.EndsWith("ing"));

var foo = demonyms.OrderBy(x => Guid.NewGuid()).ToList();
var bar = slurs.OrderBy(x => Guid.NewGuid()).ToList();

for (int i = 0; i < bar.Length(); i++)
{
WriteLine($"{foo[i]} {bar[i]} {new List<string>() {"image board", "message board", "forum" }.OrderBy(x => Guid.NewGuid()).First() }");
}
>>
>>57074944
>Nepalese fly-tying message board
>>
>>57073305
it says it expired
make a new one you goober
>>
>>57074975
https://discord.gg/FeaKm
>>
going to start fucking around with the android sdk. What's a good place to start?
>>
>>57074944
so this is for me, I'm not made for programming, I'm but a simple idea-man
>>
>>57074944
>
using (var client = new HttpClient())

GC really is a meme.
>>
>>57074944
kek
>>
>>57074944
Nice
>>
File: trippy.webm (3MB, 1278x718px) Image search: [Google]
trippy.webm
3MB, 1278x718px
Playing with Processing.
Here's a trippy visual.
>>
>>57072602
Learning Japanese and Java.
>>
>>57074944
>
HtmlDocument doc = new HtmlWeb().Load("https://en.wikipedia.org/wiki/Category:Handicrafts");

Use the API, Anon
https://en.wikipedia.org/w/api.php?action=query&list=categorymembers&cmprop=title&cmlimit=500&cmtitle=Category:Handicrafts
>>
>>57074944
gonna write this up in python
>>
>>57074938
#include <stdio.h>
int test ()
{
int isit=0, int i;
for (i=2; i<=16384; i++)
if (i%2==0)
if (32768%i!=0)
isit=1;
return isit;
}

main()
{
int i;
for (i=2; i<=16384; i++)
if (i%2==0)
if ((test(i)!=0 || (test(16384-i)!=0))
printf ("\nNot every even number greater than 2 is the sum of 2 prime numbers");
}


:^)
>>
>>57075308
Fuck it; challenge accepted, I'm gonna write one in Haskell, too.
>>
>>57075047
Ironic that you say that on the one statement that does its own memory reclamation.

>>57075298
Yeah, it was just a quick rework of another similar function I've written for >>57074812

I might start plugging all these little dumb things I write into a /dpt/-themed website.
>>
>>57075348
>Ironic that you say that on the one statement that does its own memory reclamation.
Exactly. Once you have any resource that is not memory you need to manually take care that it's closed in time. The meme levels go off the charts when GC friends tell me how RAII is too complicated.
>>
>>57075407
Do you understand why some objects implement
IDisposable
?

I'd be happy to explain if you're a bit confused on the subject.
>>
File: eustiserror.png (34KB, 713x562px) Image search: [Google]
eustiserror.png
34KB, 713x562px
I don't suppose anybody can tell me what any of this means?

The thing worked just fine in codeblocks...
>>
>>57075445
You corrupted the heap by writing out of bounds or something.

No, really, that's quite impressive.
I've never completely fucked the heap in all my years writing C.
>>
File: 1289015929465.jpg (54KB, 378x372px) Image search: [Google]
1289015929465.jpg
54KB, 378x372px
Does anyone know how skype resolvers work specifically?
Everything I've seen is "use this api lmao" or "they have bots do it"
I've read http://superuser.com/questions/600207/how-do-skype-resolvers-work
Doesn't explain in detail..
Links? Ideas?
>>
>>57075433
I'm talking about using and not IDisposable. You seem to be confused on the issue. Maybe you should read up on what using does.
>>
Anyone got something with busybox on it nearby?
Can you run a "which timeout" for me to see if that binary is there?
Cheers.
>>
>>57075461
What's more impressive is he done it with simple fibonacci. That requires some dedication.
>>
File: 1424152621115.gif (301KB, 350x464px) Image search: [Google]
1424152621115.gif
301KB, 350x464px
>>57075461
Think you'd be willing to comb through a few hundred lines of amateur code to tell me why I'm such a fuck up?
>>
>>57075561
Sure, I could use a laugh.
>>
>>57075524
The only reason the
 using 
keyword exists is to handle managed objects that implement
IDisposable
, you fucking retard.

 using 
is inextricably linked to the concept of
IDisposable
, and the reasons that they created that interface in the first place.
>>
How hard would it be to learn how to program in java/javascript so I could make Minecraft mods for myself?
No programming knowledge whatsoever.
>>
>>57075524
>I'm talking about using and not IDisposable.
using exists because IDisposable exists
>>
I'm doing a hash table, I'll use the middle-square method to assign my int numbers into the array, I'm thinking of using strings to obtain the middle numbers (I'm actually struggling with string functions). The problem is that I don't really know how to deal with collisions, besides I know how to make a single linked list and dinamic arrays.
>>
>>57075620
You still don't know what using does and why its necessity is caused by GC being a crippled concept for anything but memory.

Well, enjoy using using whenever you need a poor imitation of RAII. I'm gonna watch anime instead.
>>
>>57075626
If you're motivated, not difficult.
But it takes a while to beginners to learn to think in abstract terms and not in syntax.

When you discover the power of abstraction, and you'll know when it hits you, you'll be ready to attempt any project, even if you have no idea what you're doing.
>>
>>57075580
Much appreciated

http://pastebin.com/X3YDa0Pb
>>
>>57075670
what the fuck
>>
>>57075670
jeeeesus christ
>>
File: 1337772490866.gif (2MB, 300x277px) Image search: [Google]
1337772490866.gif
2MB, 300x277px
>>57075670
Just use gmp senpai.

>>57075691
also this
>>
>>57075670
Shit, forgot the header file.

refresh it, there's a struct that was missing.
>>
sunny is our girl not the skank in the op
>>
>>57075445
Compile with -g -fsanitize=address or use Valgrind.
>>
>>57075665
Where do I begin?
>>
Hey guys, my teacher wants us to make a function that takes a name and returns a boolean of whether or not it starts and ends with the same letter. I've been trying for a long time and I can't get it to work. Can someone tell me what's wrong? Thanks in advance.

def checkaname(name):
i = 0
number_of_characters = len(name)
firstCharacter = ""
lastCharacter = ""
while i < number_of_characters:
if i == 0:
firstCharacter = name[i]
if i == number_of_characters:
lastCharacter = name[i]
i = i + 1
firstCharacter = firstCharacter.lower()
lastCharacter = lastCharacter.lower()
if firstCharacter == lastCharacter:
return "true"
elif firstCharacter != lastCharacter:
return "false"

boolean = checkaname("David")
print(boolean)
>>
who /openGL/ here

I'm missing a gl header and I can't build this example: https://github.com/colinstein/minimalopengl/blob/master/test.c

it just isn't in my GL folder (ubuntu 14.04) but I'm sure I have all the packages I need

I've been trying for days to get this shit to work

The fucked up part is I had got it to build before. Not sure what went wrong
>>
JAVA:
I want to create a queue and have it persist every time i run a program.
The program will have a queue that takes an argument string and adds it to the queue. If the argument is "pop" then I'll pop an item off the queue.
I've never needed data do persist between runs. What should i be reading about to find a suitable solution? To my knowledge the best option would be to save the items in the queue to a file and reload the file every time I run the program.

Thanks in advance.
>>
>>57075670
parseInt looks like it has some potential segfaults
>>
>>57075670
What the fuck is this?
Also you should probably be settings pointers to NULL after you've freed them.
>>
>>57075751
a boolean is not a string
>>
>>57075665
>When you discover the power of abstraction, and you'll know when it hits you, you'll be ready to attempt any project, even if you have no idea what you're doing.
Oh, so that's why i suck. I've been programming for 5 years and it still hasn't hit me.
>>
>>57075751
Just do
return name[0] == name[-1]

with the proper bound checking
>>
>>57075769
yes use a file if that'll suffice

do what werks bro no need to complicate things
>>
>>57075738
I strongly recommend C, and "Programming in C" by Stephen Kochan.

K&R is also good, but was written for Pascal programmers, not total beginners.

The fastest way to learn is to attempt projects right away with what you know.
If you don't know how something is done, you google it until you DO know.
>>
>>57075762
work on my machine (tm)
>>
>>57075751
>while i < number_of_characters:
>if i == number_of_characters:
this also seems like a problem
>>
>>57075751

that's a fucked up way to do it

first of all you should really use a for loop when you iterate through an array. It's just easier to think about.

     for i in range(0,len(name)-1):
....


Second of all, you don't need to iterate through an array to compare the first and last char. Just get the first and last index.

Also, don't return a string. He wanted a bool.
>>
>>57074944
hey, do you have a list of asian countries + hobbies, or can you pastebin it
>>
>>57075751
while i < number_of_characters:
...
if i == number_of_characters:
lastCharacter = name[i]

This if statement will never execute, since i can't be less than and equal to number_of_characters at the same time.
It should be
if i == number_of_characters - 1:

return "true"
return "false"

Booleans are not strings. I think it's True and False in python.
if firstCharacter == lastCharacter:
elif firstCharacter != lastCharacter:

You don't need to have an if statement for these situations. You can just return the result of the comparison directly.
return firstCharacter == lastCharacter


Also, your code contains a lot of logic that you don't even need. You can just index the string right away instead of going through the while loop.
name[0].lower() == name[len(name) - 1].lower()
>>
File: 1460938535801.jpg (74KB, 512x512px) Image search: [Google]
1460938535801.jpg
74KB, 512x512px
What was the biggest mistake in programming?
>>
>>57075793

DESU I'm just not sure what the standard procedure is for what I'm trying to do. If I do something new it's good learning experience.
>>
>>57075898
Object orientation.
>>
>>57075751
>>57075786
>>
>>57075898
4chan
>>
How do I make a for each loop in C?
>>
>>57075798

My problem is this:

/usr/local/include/GLFW/glfw3.h|147|fatal error: GL/glcorearb.h: No such file or directory|


> go to my usr/include/GL
> no glcorearb.h

What do?
>>
Why is python so shit? I've been programing in Java (which is admittedly also shit) and recently switched to python. How do you deal with the god-awful dynamic typing?
>>
>>57075900
i dont know either desu

i just use a file, though there are other options to store information using libraries and other types of files

but in the end it's still a file you are using

if you need a simple file, no need to use anything more demanding

people store stuff in files all the time, seems standard
>>
>>57075930
You don't deal with it.
You don't have to deal with it.
That's the beauty of dynamic typing.
>>
>>57075930
How do you deal with type erasure?
>>
File: 1473604729001.png (99KB, 600x600px) Image search: [Google]
1473604729001.png
99KB, 600x600px
>>57075670
http://pastebin.com/Py26ysRG
In short: you delete the return value of fib inside fib and delete it again in main. Aside, from that you extensively leak memory.
>>
>>57075898
NULL
>I call it my billion-dollar mistake…At that time, I was designing the first comprehensive type system for references in an object-oriented language. My goal was to ensure that all use of references should be absolutely safe, with checking performed automatically by the compiler. But I couldn’t resist the temptation to put in a null reference, simply because it was so easy to implement. This has led to innumerable errors, vulnerabilities, and system crashes, which have probably caused a billion dollars of pain and damage in the last forty years.
>- Tony Hoare, inventor of ALGOL W.
>>
>>57075943
how do you remember if you have a list of lists or a list of dicts or a list of objects or....
>>57075951
very infrequently
>>
>>57075930
Develop autism, its the only way to do big dynamic typed projects.
>>
Ok so I'll be finishing my education soon and I've started looking for a job, but what's the difference between all these fucking job titles?

>Computer programmer
>Programmer analyst
>Software developer
>Applications developper
ect...
>>
>>57075904
>>57075879
>>57075851
>>57075824
>>57075786
>>57075775

Thanks guys! /dpt/ is love <3
def checkaname(name):
return name[0].lower() == name[-1].lower()

boolean = checkaname("David")
print(boolean)
>>
>>57075751
dunno if it works
def checkname(name):
if name[0] = 'a':
return true
else:
return false
>>
>>57075978
Why did you write "Pajeet Needed" 4 times?
>>
File: 1458318926736.jpg (48KB, 496x504px) Image search: [Google]
1458318926736.jpg
48KB, 496x504px
>>57075978
>not computer scientist
step it up
>>
>>57075930

The point of python is you don't ever have to think about memory. It allows you to get things done quickly. I wouldn't call it a bad system, really just niche
>>
>>57075978
Programs computers
Analyzes programs
Develops software
Develops applications
Hope that helps
>>
>>57072932
Replace system.out with JOptionPane.showMessageDialog(). Atleast read your lecture slides mate.
>>
>>57073068
https://github.com/Gabriel439/post-rfc/blob/master/sotu.md
>>
what would I need to spawn some function, yet not wait for it to finish, aka, keep it in a background and when it finishes, then there'd be some way for me to know, like some stack

I want to do this in C
something tells me threads and sockets, but I know nothing about them, am I right?
>>
>>57076120
threads, just use pthreads if you're on a POSIX system, it's super easy
>>
>>57076120
Yes, you would need multi-threading to do that.
Or coroutines, but doing coroutines in C is a nightmare.
>>
>>57076120
>threads
Correct
>and sockets
Don't bother

what you want is
man 7 pthreads
and
man 2 eventfd
>>
File: 1454435411651.jpg (53KB, 907x718px) Image search: [Google]
1454435411651.jpg
53KB, 907x718px
>>57076176
>doing coroutines in C is a nightmare
>>
>>57076145
It's 2016
>>
>>57076178
I've always been curious, what's with the number in between "man" and whatever command/program you're wanting the manual for?
>>
>>57076178
thanks!
>>
File: 1460138722337.png (192KB, 576x507px) Image search: [Google]
1460138722337.png
192KB, 576x507px
>>57076248
>>57076248
>It's 2016
>>
>>57076262
You have never use man, have you?
>>
>>57073143
Coq is better for type theory
>>57073305
MOMMY GET IN HERE REEEEEEEEEE
>>
>>57076248
Thanks for letting us know. I've almost lost track myself.
>>
How's Deitel's Java: How to program?
Will be using it this semester in college.
>>
>>57076293
>Coq is better for type theory
Andromeda is even better. Also, Twelf for the ultimate fidgetry.
>>
File: 555.jpg (34KB, 338x305px) Image search: [Google]
555.jpg
34KB, 338x305px
>>57074288
>Use shit tools
>Be mad that they're shit
>>
>>57076302
> Using non portable threading
>>
File: zpTD7yd.jpg (42KB, 516x422px) Image search: [Google]
zpTD7yd.jpg
42KB, 516x422px
>>57076357
>if you're on a POSIX system
>Portable Operating System Interface
>>
>>57076282
I use it all the time, but I've always used it like "man <command>". I've never understood what the number was for.
>>
File: positions.jpg (49KB, 678x678px) Image search: [Google]
positions.jpg
49KB, 678x678px
>>57074494
Of course you don't have to configure anything, Java is equally terrible on all platforms right out of the box.
>>
>>57076328
haven't fucked with Andromeda yet, but i just checked it out and it looks pretty nice. syntax looks a lot cleaner than Coq. might give it a try some time
>>
>>57076376
Oh shit, I'm sorry. Can you point out where pthreads.h is in the standard library?
>>
>>57076410
Protip: It's not, you fucking uneducated pleb.
>>
>>57076414
That's the point you literal moron
>>
>>57074870
C is like riding a bike, you never forget.

But it doesn't matter how good you are, you'll still get run over by a truck.
>>
>>57076409
If you want something like Coq but nicer syntax, try Lean. It even has fairly nice support for HoTT.
>>
>>57076421
Every POSIX system has pthreads. If you want a standard library, use threads.h, which will use pthreads on POSIX anyway.
>>
>>57076376
kek, POSIX is portable like UAP is universal
>>
>>57076443
can you explain us what makes it non-portable anon? with examples please
>>
>>57073612
Guthub? This seems super cool
>>
>>57076378
man man
>>
>>57076466
https://en.m.wikipedia.org/wiki/POSIX_Threads
>>
File: huggg.webm (3MB, 896x504px) Image search: [Google]
huggg.webm
3MB, 896x504px
/dpt/-chan, daisuki~

>>57076229
He's right. Preemptive coroutines in C is painful.

>>57076120
Concurrency (either parallel or time sharing). C is shit for this.

>>57075930
TDD

>>57075917
With Generators.

>>57075898
C

>>57075769
Read about serialization.

>>57075626
https://yfain.github.io/Java4Kids/

>>57075285
Ganbatte

>>57075274
Source?

>>57075006
http://guides.codepath.com/android

>>57074911
r/dailyprogrammer

>>57074870
https://learnxinyminutes.com/docs/c/

>>57074729
>while posting on 4chan

>>57074243
You need stronger abs.

>>57072936
Haskell always meant to be a programming language for PLT.

>>57072602
Thank you for using an anime image.
>>
>>57076440
Which is why you should use threads, not pthreads
>>
>>57076428
just saw it the other day and it looks pretty cool, but Andromeda's OCaml syntax is really appealing since I write so much OCaml anyways. plus Andrej Bauer's working on it so it's instantly pretty cool
>>
>>57076520
>just use pthreads if you're on a POSIX system
I said nothing about using threads in general, you incredibly colossal faggot.
>>
>>57072602
Writing a network stack for Temple OS.
>>
>>57076534
If it's the same then you should use the one that's in the standard library.
>>
>>57076556
I agree.
>>
>>57076440
>use threads.h, which will use pthreads on POSIX anyway.
mine use winapi threads.
>>
god danm, programming in C is very hard
how do I design the program
how do I make it modular
how do I know what I'll need.
which libraries do I use

newcommer here, I'm scared of C, its just too hard
>>
>>57076608
git gud
>>
>>57076490
You didn't give me specific examples, but at least you found a link where you can learn what pthreads is about then become able to talk about it.
>>
I think I got into my dream company, /dpt/. Today is a good day.

>>57076554
Sacrilege.
>>
>>57076622
Yes, we all know it's hard to read a 500 word wikipedia article.
>>
>>57076608
>how do I design the program
>how do I make it modular
The same way you do it in other languages.
>how do I know what I'll need.
I don't even.
>which libraries do I use
Probably none.
>>
File: what the fuck.png (272KB, 708x402px) Image search: [Google]
what the fuck.png
272KB, 708x402px
>mfw implementing TSP in 4 dimensions for >100k cities
>mfw nearest neighbor isn't good enough
>mfw Christofides isn't good enough
>mfw Ant Colony isn't good enough
>mfw fucking Bogosort converges faster than Ant Colony
God, I hate this shit.
Can't look at the graph
Can't even use fucking tables
>>
File: comfy.png (167KB, 376x328px) Image search: [Google]
comfy.png
167KB, 376x328px
Rate my C for-each loop!
#define in(x) ,x
#define x_each(i, lmt) (i = 0; i < (lmt); i++)
#define each(x) x_each(x)

for each (i in (ptr->size))
...
for (i = 0; i < (ptr->size); i++)
>>
>>57076647
it kind of is when you're laughing at someone's attempt to seem smart and knowledgeable then fall flat on their faces being exposed.
>>
>>57076671
>Windows does not support the pthreads standard natively,
>>
>>57076669
Amazing https://www.youtube.com/watch?v=-pCRSrq0dhA
>>
>>57076687
>one system doesn't support it therefore it's non-portable
you gotta do better than this my man
>>
>>57076687
But windows 10 does. git gud grandpa
>>
>>57072602
>>57072932
I came here to get some coding done

now my dick is exploding for a fap
thanks
>>
>>57076712
>The most popular os doesn't support it, therefore it's non-portable
You're right
>>
I live in San Francisco. My parents would pay for a web immersive course at GA that costs $13k. 12 week immersive.

Should I do it? (money is not the problem, I just don't want to waste my time)
They will basically teach me HTML/CSS/JavaScript and some Rails.

Can i get a job as a jr developer with just those skills?
>>
>>57076720
>The most popular os
Android?
>>
>>57076725
Are you a woman, minority (not asian or hispanic), LGBT or diagnosed with a mental illness?

If so, you're guaranteed a job in silicon valley.
>>
>>57076650
Maybe try simulated annealing? Christofides is O(n^3), so you're already getting pretty good time complexity at that point (considering the problem at hand).

>>57076669
Pretty good, but the parentheses make me sad. You can probably get rid of the function macros and just use object macros if you add "do" to the end of your syntax.
>>
>>57076744
I am a gay and Uruguayan, but I pass off as a white male.
>>
>>57076730
get a load of this guy
>>
>>57076749
>object macros if you add "do" to the end of your syntax.

Explain?
>>
>>57076756
Let's compare the number of devices running Android and the number of devices running windows sold last year.
>>
>>57076725
>basically teach me HTML/CSS/JavaScript and some Rails.
>13K
holy sheeeeeet expensive as fuck, but if moneys not a problem than go ahead

though desu thats too long for basic HTML/CSS/JS things

if its 1 week of html/css and then 11 weeks of JS than for sure
JS can get extremely extensive and complicated at advance levels
>>
>>57074870
You're just manipulating buffers of memory in a handful of different ways. There's really not much to 'get' about C.
>>
How do I incorporate buzzwords into my resume without seeming Indian?
>>
When building a Java Server Client application, what sort of library should one use for the connection - given that it's probably a good idea not to write everything from scratch.

Thought of something like SIMON but maybe there are better alternatives?
>>
>>57076730
>Android fully supports pthreads
Tell me more anon
>>
>>57076820
that's what I am hoping.
I am excited about the backend they describe:

"Back-End Web Development
Build web applications from the ground up using Ruby on Rails, a modern web language and MVC framework. Build quality APIs using Node.js and integrate data from other apps (like Twitter or Yelp) into your project."
>>
>>57076755
>>57076755
>I am a gay and Uruguayan

more like Urgayan
lmao
>>
>>57076720
but android already supports it, next time research the subjects you talk about so you don't embarrass yourself my man
>>
>>57076930
>>57076867
Kys
>>
>>57076888
to answer your earlier question: no, 12 weeks aren't enough for a company to pay you money.
>>
>>57076971
is there a number of weeks that will magically determine if I am hirable?
I think it may be possible to have a decent portfolio ready to present at the end of those 12 weeks, but I may be wrong.
>>
>>57076942
don't kill yourself since that would be doing yourself a favor
>>
>tfw pajeets have 5 times more knowledge, experience, and are willing to actually do the math
>tfw they will take whatever is on the table, half of what I would work for

they are popping babies like if a pussy hole is a gun machine barrel too
deving is the next burger flipping job
>>
>>57077001
Kek, move the goal posts all you want. Pthreads aren't portable.
>>
>>57076998
12 weeks of html=1mil starting, the other anon is just meming you bruh.
>>
>>57076998
did i understand this correctly, that you've got no experience at all?
in that case you simply cannot learn enough in 12 weeks to be worth hiring, even when throwing a lot of money at it and spending a lot of time on stuff during those 12 weeks.
>>
>>57076775
Ahh, sorry anon; I just tried messing around with the preprocessor - I don't think there's a way to get around at least one set of parentheses without gutting the for loop itself using #define for. Oh well.

I'm going to try to make it work anyway.
>>
>>57077054
i understand your point of view.
my question is, what is the amount of time you think someone should spend before they begin applying for jobs?
>>
>>57077023
Whatever helps you feel better about being wrong my man
>>
>>57077054
well imagine most college students do 20 hours of code a week and you do 10 hours a day in 12 weeks

it will get you someone where faster
though it is true that it will have to be at least 4 times that amount to aim for a junior job
>>
>>57076781
let me be more explicit since you are apparently incapable of functioning socially in any other context. i meant "get a load of this guy; he thinks taking everything literally despite surely knowing what people mean makes him look smart or has any other benefit whatsoever when in reality it wastes everybody's time and make him look like a smartass teenage sperg"
>>
>>57077145
You should get the fuck out.
>>
File: 2d54e7f737e0e30b71de77e7866ec9e9.jpg (177KB, 1345x750px) Image search: [Google]
2d54e7f737e0e30b71de77e7866ec9e9.jpg
177KB, 1345x750px
I just completely bombed an employment test /dpt/, this was the best job prospect I've had since I got fired from the last one
>>
>>57077181
Seconded
>>
>>57077135
that is motivational, but i've heard that 90% of successful students do get jobs within two months of completing the course.

of course, the source of this information is GA itself.
>>
>>57077184
Was it a tech interview, or one of those online screening tests? How are you going about practicing for your interviews?
>>
>>57077135
That is the equivalent of cramming. It does little good.
>>
can someone explain the stack and heap to me?
>>
>>57077217
It was a screening test. I didn't prepare.

There were a bunch of java-specific questions, and I haven't used Java for anything in like 3 years. It was a mistake applying for that job.

On top of that, I only answered one of the three questions where I was asked to program, because the first one I misunderstood the question and the second caused the environment to time out due to recursion (it was a pathfinding question)
>>
>>57077263
they're blocks of memory where program variables are stored. the heap is for global variables while the stack is local. the stack is cleared when a block ends, but recursion can cause it to overflow
>>
>>57077181
you should consider wasting less time splitting hairs and willfully misunderstanding people. for everybody's sake, first and foremost your own
>>
>>57077184
What did it entail?

>>57076725
Why not Hack Reactor or Maker Square?

I'm currently solving a codewars challenge that takes as input any number of integers, where I have to output the highest number palindrome out of any combination of Arguments multiplied to eachother

https://www.codewars.com/kata/largest-numeric-palindrome/train/javascript

I whipped this up without reading the full description, but it works for the test cases
function numericPalindrome(...theargs){
var arr = theargs.reduce(function(a,b){return a * b}).
toString().split("");

var doubles = arr.filter(function(num){
return arr.lastIndexOf(num) !== arr.indexOf(num);
});

doubles = doubles.splice(0,doubles.length / 2).
sort(function(a,b){return b - a});

var highest = arr.filter(function(num){
return doubles.indexOf(num) === -1;
});

if (highest[0] === undefined){highest = ""}
else {highest =
highest.reduce(function(a,b){return Number(a) >= Number(b) ? a : b})}

return Number(doubles.concat(highest).concat(doubles.reverse()).join(""));
}


I didn't realize that it could be any combination of arguments summed to eachother, so I'm going to have to add that in.

I interviewed with HR the other week and basically froze up. He told me about rest and I just sat there like an idiot. I was able to solve it in under 6 minutes after the interview (and I just implemented it pretty easily in the code above)

They actually didn't even invite me back for another interview, which is disheartening though I'm pretty sure I could make one happen. I just don't even know what to do at this point.
>>
>>57077303
>the heap is for global variables

lmao
>>
>>57077309
3 java coding tests, 12 multiple choice which dealt with both java-specifc programming questions and math problems. I failed 2/3 programming questions (they didn't let us see stdout and my pathfinding answer timed out) and at least 2 of the multiple choice questions.

I had an interview scheduled for monday, but I'm pretty sure they're not even going to consider me. I fucked up royally
>>
File: cantonese cartoons.png (305KB, 853x480px) Image search: [Google]
cantonese cartoons.png
305KB, 853x480px
Quick, /g/, what to program. I'm already pretty drunk.
>>
File: kek.png (38KB, 960x246px) Image search: [Google]
kek.png
38KB, 960x246px
http://www.gwan.com/blog/20160405.html
kek
>>
>>57076775
>>57077060
Ah, I figured it out. Needed one parentheses.
#include <stdio.h>

#define for(x) {int __loop = 0,__n=-1;int x;while(__loop){x;
#define in =__n=(__loop?__n+1:0);__loop=__n<
#define end }}

int main() {
for(i in 10)
printf("%i ", i);
end
printf("\n");
}

Outputs
1 2 3 4 5 6 7 8 9 10 
.

>>57077269
Ah... Ouch. I would start doing some practice. There's great sites like hackerrank, interviewbit, and leetcode to help you.
>>
File: 1454273146472.png (2MB, 1200x1726px) Image search: [Google]
1454273146472.png
2MB, 1200x1726px
>>57074202
>>
>>57077263
stack is where local, defined variables are stored. the variables are pushed on the stack on entering the local scope and removed from the stack when leaving the scope. the size of the stack is very small. the heap is a much bigger space of memory, but it is not managed. you allocate memory dynamically (e.g. malloc() in C or new() in C++) and you are responsible to free that memory if you don't need it anymore, except for languages that have a garbage collector, which will free unused memory automatically.
>>
>>57077263
> Needing the heap
>>
>>57077570
>>can someone explain aids to me
>needing aids
>>
>>57077570
do you work exclusively on embedded systems?
>>
>>57074230
What circuit are you making?
>>
>>57077638
You can remove most use of the heap on most applications with a little planning.
>>
>>57077725
does not address anons shitpost >>57077570
>>
>>57077506
this is what happens when you have a 30:1 male to female ratio in a field, the cutiest boipussy has to take all the dick
>>
>>57077754
Well the heap's nice, but you don't need it.
>>
>>57077806
Too bad almost all the guys are ugly sperglords.
>>
>>57077506
I guess when you dress like a girl, you code like one too.

That's some truly shit code.
>>
how do i print file information like that i get from file filename, except recursively for all files?
>>
>>57077922
for i in *; do file $i; done;
>>
>>57077922
SearchOption.AllDirectories
>>
File: 1401729524499.jpg (26KB, 300x265px) Image search: [Google]
1401729524499.jpg
26KB, 300x265px
>>57075952
Thanks, man. I know I'm crap at this.
>>
>>57077864
Wonder why all the smart women drop engineering and go for social or natural sciences
Is it cultural (including boundaries) or biological
>>
>>57077994
smart women don't waste their fertile years in an industry that's full of anti-social autists.
>>
>>57077506
Excuse my ignorance, but how did the whole "programmers are traps" thing start?
>>
>>57077941
that just prints all the directory names. the situation is that there's a lot of directories, and each of them has a lot of files. the file i need has certain properties. i figured a way to do it with find but i want to know if i can print all the files info out too
>>
>>57075952
>>57077993
stop posting qts
qts are all mine
>>
File: chihiro is dog.jpg (42KB, 410x530px) Image search: [Google]
chihiro is dog.jpg
42KB, 410x530px
>>57078035
for i in */*; do file "$i"; done;

>>57078026
there's a lot of trap programmers in anime
>>
>>57072602
the amount of weebs in these threads is disgusting end yourselves
>>
scripting is fun as fuck
why nobody told me before
>>
NEW THREAD!!

>>57078072
>>
>>57077570

Without the heap, how would you handle the case of needing to store an amount of data only knowable at runtime? For example, you are reading user input. You could receive as little as 1 byte, or as much as 1 gigabyte or more.
>>
File: 1446755405998.jpg (151KB, 797x522px) Image search: [Google]
1446755405998.jpg
151KB, 797x522px
> not codeine while blazed
> not increasing your imaginatory powers by 70%
> not coding while youre in stacys apartment when chad is going to bang her any minute
> not unleashing the occult powers of unholy algorithms
> 1992+24
>>
File: 043.png (222KB, 449x401px) Image search: [Google]
043.png
222KB, 449x401px
>>57077941
> Recursive
find . -type f -exec file {} \;
>>
>>57078104
DONT RUN THIS
it makes mustard gas
>>
>>57077810
sure you don't technically *need* it, but there are plenty of times when you should definitely use it. nothing says "scalable" like #define MAX_THINGS 512. and this is coming from someone who keeps as much as possible on the stack and uses const/constexpr wherever applicable (wait for it) *when doing so doesn't arbitrarily compromise functionality*

>>57078086
easy, just allocate 2 gigabytes and make a note of the maximum allowed input size in the documentation. kek
>>
>>57075445
valgrind and gdb are your friends.
>>
>>57078086
The same way you would with the heap, but with chunks of stack blocks.
>>
>>57078120

Allocating 2 gigabytes would create a lot of waste if most of your uses involve less than a kilobyte of data. It also limits one to only 2 gigabytes of data. If the user had 16 GB of RAM and wanted to work on 3 GB of input data, they should be able to do that. If the user only has 1 GB of RAM, but wants to be able to work on 512 MB of input data, they should also be able to do that.

With heap allocation, one can allocate as much memory as is needed, and not much more.
>>
>>57078243

There is no stack equivalent to realloc().
>>
>>57078276
I think I can come up with something. Obviously this example completely defeats the purpose of pure stack allocation(speed and reliability) by using io.
>>
>>57078266
i uh... i know. i was joking. i wanted to say "how could you possibly think i was serious?" but then i remembered that this is /dpt/. you'd think the "kek" at the end or the rest of the post might have given it away tho
>>
>>57078419
Ruby is autistic
>>
>>57076749
I tried simulated annealing.
Other than the reverse-swap move operation being slow as balls, and a questionable heuristic, especially for such a huge graph, there wasn't much difference.
I found out that the solution I have has more or less already converged, but it isn't good enough for some reason.
I don't really understand.
>>
File: 1476318838519.jpg (34KB, 380x364px) Image search: [Google]
1476318838519.jpg
34KB, 380x364px
In C#, what is the best practice method of reading a binary file with delimiters? It doesn't seem that there's a method of reading bytes one by one from a BinaryReader.
>>
>>57079055
Would this be a good approach? Once I hit a single delimiter, all of the other dimensions are the same (albeit some are obviously at dimension ^ dimension size)
int dimensionSize = 0;
using (BinaryReader reader = new BinaryReader(stream)) {
if (reader.ReadInt16() != -1)
dimensionSize++;
}[
>>
>>57079055
>It doesn't seem that there's a method of reading bytes one by one from a BinaryReader.

https://msdn.microsoft.com/en-us/library/system.io.binaryreader.readbyte(v=vs.110).aspx

???
>>
>>57079226
I had misread the documentation and I didn't realize that calling ReadByte() repeatedly would actually read the /next/ byte and not just the first one
I suppose I had a total misunderstanding of how readers worked in C#
>>
>>57079232

Yes. That is how they work.
>>
Why is this thread so dead
Thread posts: 336
Thread images: 47


[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.