[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: 314
Thread images: 31

File: anime urine dispenser2.jpg (311KB, 1067x1600px) Image search: [Google]
anime urine dispenser2.jpg
311KB, 1067x1600px
old thread: >>56912619

What are you working on, /g/?
>>
>>56924121
What the actual fuck is this?
Fuck off with that pedo shit.
>>
First for Rust
>>
>>56924121
python is the best beginner language, prove me wrong
>>
>>56924121
https://github.com/Floctioncers/Fi
Working on little 4chan image downloader written in Prolog.
>>
>java doesn't have structs, pointers or unsigned integers

what the fuck is java good for then??
>>
>Java doesn't have structs, would passing references to a bean be what I'm looking for?
AAAAAAAAJ
>>
>>56924219
Replacing Cobol
>>
>>56924121
Rate my fibonacci sequence function:
static List<int> Fibonacci(int n)
{
var fib = new List<int>() { 1 };
Range(0, n).Aggregate( new { now = 1, prev = 1 }, (x, i) =>
{
fib.Add(x.now);
return new { now = x.prev + x.now, prev = x.now };
});
return fib;
}


Also, it seems like it's up in the air if it's supposed to start on 0 or 1.

What do you think, /dpt/?
>>
>>56924194
If the fields are only set once before the other threads access them then what is the problem?
>>
>>56924219
http://java.metagno.me/
>>
any ideas for how to handle huge files in a text editor?
>>
Memory is the most valuable resource. It's 2016.

Prove me wrong. You can't because Chrome is using 4G and swapping.
>>
>>56924331
Actually, memory BANDWIDTH is.
>>
>>56924355
Surely you mean memory LATENCY.
>>
anyone here having problems crawling 4chan?

i have a simple crawler that searches for a porn term and when i run it in the terminal it's giving me a timeout

its in python and it runes every 5 minutes
>>
>>56924379
Actually, I do. Disregard that post, I suck cocks.
>>
>>56924186
I really love writing in Prolog. Are there any free compilers available?
>>
>>56924380
You're the reason 4chan will be sold to Disney.
>>
>>56924186

I am truly gobsmacked that Prolog has a web library. It's not like most languages don't have them, it's just that I never expected someone to use Prolog for something like this.
>>
>>56924393
I would definitely recommend SWI-prolog, look at http://www.swi-prolog.org
>>
>>56924267
>ConfigClassesAndProfilesWithCustomDefaultsMetaConfig.DevConfig
>>
>>56924219

C# has ALL THREE!
>>
>>56924443
Actually Prolog is used often used as server-side language, so it naturally has a library to work with web.

I think Prolog is being a bit underestimated, which sadens me a bit.
>>
Why isn't there a modern C successor with a conservative feature set like Go but without GC shit?
>>
>>56924480
Well, using pointers in C# is pain in the ass, to be honest.
>>
>>56924630

It's actually easy peasy, my neezy.

>>56924595

Huh, I guess you learn something new every day. I didn't figure Prolog for a commonly used server language.
>>
>>56924121
Where can I get something like in that pic?
>>
>AbstractMappingContentNegotiationStrategy
Okay there's no way this is real.
>>
Is there a way to run the Erlang VM from a shell/command prompt?
>>
Where can I find someone to baby step me through this problem that I'm having in java?
I've been stuck for a week, and /g/ and several hundred websites haven't been able to help.

I need to be shown how to build a .java file that I have edited, so that I have an updated .class file. It's part of a library, and has several dependencies that I am unsure of.

Eclipse is useless, and building in cmd doesn't work.
>>
>>56924830
You again...

Posting the error messages you get when building from the command line might help
>>
chat + forum in erlang
>>
/dpt/-chan, daisuki~

rate my state-of-art string reverser/10
>>
fuck static typing. for maximum clarity never write your methods like this:
User build(String name, Integer age);

For maximum clarity, instead use
Object build(Object[] objects);

which results in much faster code.
>>
How do I print out a character every Nth time I scan in some input?

Eg: print out a '.' every 10th time some input is scanned in

(C)
>>
>>56924991
what do you mean by "scan in some input?"
>>
does anyone have that random language/project picker image
I need something to do
>>
What's the correct way to declare enums to use as bit flags?
OPTION_1 = (1 << 3)
OPTION_1 = 0x08
>>
>>56924991
while (...)
{
unsigned int readInput = 0;

scanf(...);
++readInput;

if (readInput % 10 == 0 && readInput)
printf(".");
}
>>
>>56924991
Every time you take input, increment a counter.

If the counter hits n, print the character.

If you want this to happen no matter where it's used in your code, you'll need to define some sort of object or method that both scans and increments a global variable, and to a ctrl+H on everything to use your new method.
>>
File: 1373662916812.jpg (171KB, 600x400px) Image search: [Google]
1373662916812.jpg
171KB, 600x400px
>>56925074
enum Foo
{
A = 1,
B = A << 1,
C = B << 1,
};
>>
>>56925069
http://better-dpt-roll.github.io/
>>
File: cmderrors.png (141KB, 1041x1428px) Image search: [Google]
cmderrors.png
141KB, 1041x1428px
>>56924864
>You again...
I know, I'm tired of it too

The .java that I'm trying to build was originally in gdx-liquidfun.jar, which I added as a dependency.
>>
>>56924179
the question is should it be used for serious development?
>>
How do I program up enough courage to kill myself? Any language will do, but preferably C.
>>
File: image.jpg (3MB, 3264x2448px) Image search: [Google]
image.jpg
3MB, 3264x2448px
Scanning 100 thousands of pages of 30 year old 56bit OT keys to the recorded transaction records processing front end- regenerating a old database of tax records from NY state. Happy happy joy joy.

Why Paper? Because paper can deny easy access to the Discovery process. Haha, jokes on them. Magnetic media ages and 2650bit per inch tape can mold if stored improperly and then pick-off of the magnetic media from the substrate causes irrecoverable data loss. Paper can mold but we have ways of recovering paper.

Paper is 30+ years old and perfectly legible.
>>
>>56924179
>python is the best beginner language, prove me wrong
You couldn't be more wrong. It doesn't teach you anything about programming.
>>
File: godsofprogramming.jpg (100KB, 600x600px) Image search: [Google]
godsofprogramming.jpg
100KB, 600x600px
>>56925137
Pick Java, its garbage collector will automatically dispose the piece of trash that you are.
>>
>>56925112
thanks m8
it'd be nice if it had a language roller too though
>>
>>56925167
Which language teaches you about programming?
>>
>>56925187
Bonus point: Java will make you want to kill yourself even more.
>>
>>56925194
Make a language roller of your own.

It would be silly to put any arbitrary number of languages up there, and the idea is that you complete the challenge in the language of your choice to help you master the language.

On top of that, some languages are more suitable to certain tasks.

I'm not going to write a mobile application in fucking assembly, and I'm not going to write a USB driver in Python.
>>
>>56925197
Something with static types at the very least.
>>
File: shitgetserious.png (298KB, 2271x2380px) Image search: [Google]
shitgetserious.png
298KB, 2271x2380px
>>56925167
https://news.ycombinator.com/item?id=1803815
>>
>>56925224
Java is pure.
>>
>>56925083
>>56925101

fanks bros
>>
>>56925240
>2178 days ago
It's 2016
>>
>>56925242
Pure shit untouched by features developed after the 1980.
>>
>>56925240
>But Python has the edge (with a large number of students) when the main goal is communication, not programming per se.

At least read the dumb shit you post.
>>
>>56925133

Well, there you go: the package doesn't exist.
>>
File: Lanka45.png (22KB, 124x101px) Image search: [Google]
Lanka45.png
22KB, 124x101px
>>56925187
>I'm a good language but never used!
It's not fair
>>
>>56925249
http://cacm.acm.org/blogs/blog-cacm/176450-python-is-now-the-most-popular-introductory-teaching-language-at-top-u-s-universities/fulltext

>>56925268
yes python is better for learning and teaching.
>>
>>56925280
It exists within gdx-liquidfun.jar, and as far as I can tell I've added it as a dependency - see the top line.
>>
>>56925290
>July 7, 2014
Not even the current year.
>>
Is it even worth learning C?
>>
>>56925299

Have you tried extracting the entirety of the source from gdx-liquidfun, making the changes, compiling, and then repacking the jar?
>>
>>56925312
Yeah, I'd say so.
>>
I want to learn a language for fast prototyping. My main language is C.
>>
>>56925312
No, C is obsolete.
>>
I really like using python and ruby so I want to use them as my main languages
>>
>>56925374
Congrats
>>
>>56925290
>yes python is better for learning and teaching.
Ok but not programming. He specifically said not programming.
>>
What's the state of Swift on Linux?
>>
>>56925313
I have done. It creates a .jar without any errors. However the edited .java files do not build, so the .class files remain unchanged.

I'm receiving no errors when I do this. I click build and it says it's built, but the .class files do not get updated.
>>
>>56925374
I really like using mayonnaise and tuna, so I'm going to use them as my main filling for my jacket potato
>>
File: image.jpg (2MB, 3264x2448px) Image search: [Google]
image.jpg
2MB, 3264x2448px
>>56925137
Arduino
C
Ether
Relay board
Solenoids
Secure metal door
Closet
Electric deadbolt
Random number generator

Allow the Arduino to randomly lock you in the closet for 1-30 minutes

Allow it to spray ten full cans of Ether based starting fluid through ten tiny holes in the door either Completely, or randomly let it spray one for 1/4 second every 5 minutes.

Take a nap while Kernighan and Ritchie watch over you.


Sweet dreams little one. Sleep well.
>>
>>56925496
>I'm receiving no errors when I do this. I click build and it says it's built, but the .class files do not get updated.

Have you tried deleting the class files before building?
>>
>>56925549
You should post that to the AdaFruit and SainSmart project pages including wiring, parts list with sources, and program including options to modify the random number generator LFSR.
>>
I'm trying to make a game for my wife's son in Python with pygame. I can only get it to run with 2.7, not 3.4

As far as I can tell there isn't any compatibility problems, it should run with Python 3. I'm on Ubuntu and everything is installed.

Is my wife's son going to be stick with a trash game written in Python 2.7
>>
>>56925197
Prolog
>>
>>56925137
https://yandex.com/images/touch/search?text=suicide%20machine%20using%20arduino%2C%20relays%2C%20electric%20deadbolt%2C%20steel%20closet%20door%2C%20ether%2C%20automotive%20starting%20fluid&parent-reqid=1475615595415425-1065507288994055935018094-sas1-5977-TCH&p=0&source=wiz

Yandex Search doesn't judge you like Google.
>>
>>56925598
I have tried deleting the .class files that I need updating. They simply remain deleted, and aren't built or included in the .jar.

I'm currently using Eclipse. Would a different compiler make any difference, if so, what would you recommend?
>>
>>56925688
There's a very niche selection of people that can understand the levels of complexity in this post.
>>
>>56925688
Python was a mistake
>>
>>56925450
Boot Linux
fire up VirtualBox
boot VirtualBox image of a Mac running Oh Capitan, My Capitan
Sign up to be Apple Developer
pay money
Download development software for iOS, AppleTVOS, MacOS (OSX latest version is not NOT OS/X OSX OS/2-looking type name but reverts back to MacOS. next year it will be AppleOS. 2019 it will become OS/XXY.)
Begin coding in Swift, Metal, ObjectionableC, ObjectiveC.
Hang yourself in your closet like Robin Williams. post results. Apple Did Not Approve your app for the Apple App Store as there were already 400 Sudoko, 27 Tank Battle games, and Tinder already exists. Your Steel Dildo Puzzle Tank Battle Meet Greet Fuck AIDS or Not app is denied.
>>
>>56925726
>They simply remain deleted, and aren't built or included in the .jar.

See, that's going to be a problem.
>>
>>56925450
See >>56925549
>>
Why don't you tell me what the fucking problem is so I can just make the change, repack the jar, and you can stop asking this question every day for the next year and a half?
>>
I need the 100 highest elements of a 2 million element list. In Java to do this with any level of efficiency, I need to do
List<Integer> top100(List<Integer> in) { 
PriorityQueue p = new PriorityQueue();
for (Integer i : in) {
p.add(i);
if (p.size > 100) {
p.poll()
}
}
return new ArrayList<Integer>(p);
}

but in Haskell I can just do
top100 in = (take 100) (sort in)

What gives?
>>
>>56924595
PROLOG is kinda slow, but powerful. Had to learn it for machine translation.
>>
File: Based Bjarne.jpg (53KB, 502x359px) Image search: [Google]
Based Bjarne.jpg
53KB, 502x359px
>>56925905

There is no need to be upset
>>
>>56925908
Laziness that essentially leads to a different sorting algorithm that stops after the first 100 items. You had to do this manually in Java.
>>
>>56925713
iAPX432 High Level Object Processing microprocessor chipset teaches you that the higher the level of obfuscation between inputs and outputs results in bigger, slower, more complex programs that require throwing more actual and virtual and hyper threaded processing cores at them until you begin with having to suck your own dick to get your app to load the development environment when you click on your project file.
>>
>>56925908
>>56925965
Also,
top100 = take 100 . sort
>>
>>56925966
Intel Dead project folder
>>
>>56925908
>Haskell
>efficiency
oh I'm lafin
>>
>>56925962
Bjarne Strousroup
Pascal
Modula-2
C++
SuckingHisPwnCock
>>
>>56925962

I am already upset.
>>
>>56926060
There's no need to be.
>>
>>56926087

I won't be any longer when this guy tells me what change needs to be made.
>>
>>56925879
>See, that's going to be a problem.
That is THE problem.
I've spent over 60 hours trying to solve this.

You don't have any suggestions?
>>
>>56924883

Using sizeof() on an array of characters returns the amount of bytes + 1.
>>
>>56926121
>You don't have any suggestions?

Literally read what I wrote above.. What change needs to be made?
>>
File: 1351969447082.jpg (60KB, 323x323px) Image search: [Google]
1351969447082.jpg
60KB, 323x323px
>>56925133
>\dir\...
r u sure about that anon
>>
Rate my string reverser:

#include <stdio.h>

void reverse(char *in, char **out)
{
if (*in) {
reverse(in + 1, out);
**out = *in;
(*out)++;
}
}

int main(void)
{
char in[] = "Hello World";
char out[sizeof(in)] = { 0 };

reverse(in, &(char *) { out });

puts(out);
}
>>
>>56926158
I meant suggestions that I haven't tried
I didn't mean to sound rude in my previous post, I'm bad at conveying emotion in my writing.

>>56926216
Now that you're questioning me, I am not.
the command 'dir' brings up the a list of all of the files on my desktop, which include the .jars i want to include
>>
>>56926136
>of characters returns the amount of bytes + 1
which is correct. '\0' is part of the string.
>>
Rate my string reverser:
word = "hello"
word[::-1]
>>
>>56926242
I'm pretty sure it doesn't work like that, mayb -cp ".;.\*"
I'm pretty sure you can use the wildcard to match all jar files.
>>
>>56926242
>I meant suggestions that I haven't tried

You obviously can't get this to build right, so I am offering to provide you with the jar, featuring said changes, why are you fighting me on this?

I already have this extension set up to build to a jar (minus Usage.Color being an error).
>>
>>56926233
>all bytes of the output must be set to '\0' before calling reverse
1/10
>>
>>56926248
Doesn't it automatically add a null terminator when you declare an array like `char d[10];`, making it 11 bytes large?
>>
>>56926233
>Recursion
Fuck off and kill yourself.
>>
>>56926304
No.
>>
>>56925905
>>56926284
I didn't see your post, unless there's a (you), I am blind

https://github.com/finnstr/gdx-liquidfun-extension/blob/master/libs/gdx-liquidfun.jar
Could you add something like
public void doTestPls() {
System.out.println("test done");
}


to gdx-liquidfun\finnstr\libgdx\liquidfun\ParticleSystem

And if you can make it work, tell me how you did it?
>>
>>56926233
~21% slower
>>
>>56926233
Hi, you missed out a letter in your include there, you put <stdio.h> instead of <studio.h>, that's probably why it fails to compile. Easy enough to miss I guess.
>>
>>56926595

Font?
>>
File: done.png (47KB, 1066x748px) Image search: [Google]
done.png
47KB, 1066x748px
>>56926471

If I tell you how I did it, you won't learn anything.
>>
>>56926676
top and right is NovaMono
bottom i don't remember.
>>
Let's say i have a function that takes as arguments some input data, and some configuration variables, and then acquires some resources, does some work on the data and then releases the resources before returning. The straightforward way to handle this is of course a function with the signature
dowork(date, conf1, conf2, conf3, ...)


Personally i feel that when the number of config variables gets more than couple this gets to look ugly and clumsy.

So my thought is i could make a struct containing the configurations and make the function
dowork(data, confStruct)


Taking that thought further one could also make the function into a method
conf.dowork(data)

or even wrap everything into a class and just call
data.dowork()


Is there some merit to this train of thought, or am i unnecessarily overengineering things?

What do you think?
>>
>>56926762
This is so backwards retarded.

If i don't know how to do something, i'm not going to learn how to do it by continued ignorance.
>>
Rate my string reverser.

stringReverse = reverse
>>
>>56926762
You created the Main class to call doTest() so that it builds?

Would you be able to send me what you've done, as well as the .jar you've created?

I will love you forever if you've fixed my problem.

>>56926871
this is not me
>>
>>56926871

As the great John Daly once said, "Grip it, and rip it!"
>>
>>56926880
>my
>>
>>56926887
no, it's me

>>56926890
it rhymes, therefore it's a deep universal truth
>>
>>56926925
The real me wants to find a solution and is very grateful for any help. I wouldn't write hostilities to someone who's literally saving my life.
>>
>>56926887
>You created the Main class to call doTest() so that it builds?

I also changed Usage.Color to Usage.ColorPacked in ColorParticleRenderer.java. Frankly, I have no fucking clue what it's supposed to do, but that's the nearest member that makes sense.

Something isn't QUITE right with the build process at the moment, so give me a hot second.
>>
>>56926471
I just popped in to tell you that you're literally retarded.
I just grabbed gdx.jar from the same github user, and it compiled fine.
>>
>>56924267
>ContentNegotiationManagerFactoryBean
Wew, just how Indian are Spring devs?
>>
>>56926952
i get that, so i have to do it for you
>>
>>56926471
>>56926987
To actually add some useful content to this, rather than shitposting as I so enjoy doing:

I just downloaded your file and got gdx.jar from https://github.com/finnstr/libgdx/blob/liquidfun-1.0.0/builds/gdx.jar.
Unzipped the gdx-liquidfun.jar, moved finnstr/../ParticleSystem.jar to the base of the dir, then compiled as:
javac -cp ".:./*" ParticleSystem.java

I suppose on windows it would be
javac -cp ".;.\*" ParticleSystem.java

And it just werked, outputting ParticleSystem.class, ParticleSystem$1.class, which you could easily move back into the .jar file.
>>
>>56926952

See:
>>56926987
>>56927060

He's leading you in the right direction.
>>
>>56924267
HttpComponentsClientHttpRequestFactory
what the actual fuck
I was looking at a job that required use of the spring framework the other day too, I was actually considering starting a small project using it, but this is ridiculous.
>>
>>56924681
Literally just print out Madoka, laminate her, and stick her to your coffee machine.
>>
File: 1470851275805.jpg (53KB, 500x737px) Image search: [Google]
1470851275805.jpg
53KB, 500x737px
I'm making a forum indexer but I'm having some trouble with the actual logic of indexing, at the minute it goes like this

>Refresh main forum page
>Check if thread exist, if it doesn't create it and fetch posts
>Check post number of each thread if it's different from the stored version visit thread and fetch remaining posts and update edited posts
>Refresh main forum page when all is done

Is there any other way of doing this, just give me an idea or some examples because it's not efficient and also I miss some shit when some outdated thread leaves the first page before I can check it out
>>
>>56925167
If you want to learn mathematics, yeah.
>>
>>56926987
>>56927060
>>56926977
Thank you all for helping, I'm feeling optimism after so many hours of sadness.
gdx.jar looks like the correct .jar i should be using, I was originally using gdx-liquidfun.jar

>moved finnstr/../ParticleSystem.jar to the base of the dir
Where am I moving it to?

>javac -cp ".;.\*" ParticleSystem.java
I haven't learnt how to understand those symbols in the middle, but I should just keep them as they are? You don't want me to replace anything with my own path?
>>
>>56927416

You need both gdx.jar AND gdx-liquidfun.jar!

gdx-liquidfun is an extension, and it uses many of the classes from the base gdx library.
>>
>>56924179
>Went to uni to do a physics degree
>Told we would learn Python
>Had to copy the same 50 lines every lesson to draw graphs
>Had to manually input ~100 values from an excel spreadsheet
>Computers from 2002 took 15 minutes to open the compiler

Didn't learn a single thing, it just made me hate the language
>>
>>56927449

Sounds like a series of user errors. Not your fault, specifically, but it's still true.
>>
>>56927416
>I haven't learnt how to understand those symbols in the middle

In ".\*", the period represents the current directory, and the wildcard operator when used in the classpath simply matches all .jar files in said directory.
".;.\*"
would be the same as doing:
".;.\gdx.jar;.\gdx-liquidfun.jar"
>>
File: tomoko lite uses thinkpaddu.png (984KB, 1920x1080px) Image search: [Google]
tomoko lite uses thinkpaddu.png
984KB, 1920x1080px
Is it possible to go overboard with makefile automation?

My makefile has become a long undulating chain of $(patsubst and $(filter-outs just so I don't have to update the .o dependencies manually for every executable.

It works really well.
>>
What is it about Node that attracts such raging faggots? Is it the webdev thing?
>>
File: fsuihfiusdhfs.png (3MB, 2015x1264px) Image search: [Google]
fsuihfiusdhfs.png
3MB, 2015x1264px
>>56927441
Ah, thank you!

>>56927516
Thank you, this was really helpful! What's this language called? I'll have to learn the basics.

A lot of files were created, more than I expected! But I'll add the new ParticleSystem.class file to gdx-liquidfun.jar and tell you how it goes

>pic related
>>
Posted it before (months ago), but I made a WebM encoding interface: https://github.com/rzumer/Webbum
Been functional for a while but I just fixed some big bugs.
If anyone wants to give it a try, please let me know what you think. Especially compared to WebM for Retards.
>>
What kind of jobs do you guys have? My city doesn't seem to have very many tech companies or start ups..
>>
>>56927672
shit shoveller
>>
>>56927619
http://docs.oracle.com/javase/7/docs/technotes/tools/windows/classpath.html
>>
i have a probably stupid question and i'm looking for a general answer for this kind of situation (as opposed to an answer tailored specifically for my problem), but i've been tossing it around in my mind for the past few days getting nowhere, and doing shitty google searches yielding little advice.

im trying to determine a good way to retrieve data from a class with a data structure. should i return the data one object at a time, or as an array, or just return a copy of the whole data structure? or some other way of handling it?

this is c++, but the concept should apply to any language with containers and classes i would think.

basically, i have a class that has a stack of some objects. for the most part, only the top most item of the stack is used until it's no longer needed, at which point it's placed somewhere else (hence why I chose a stack).

but what if I need to read all objects in the stack (i'm considering using a different container because of this - maybe a deque)? how could I go about efficiently sending that data out? maybe creating a struct that contains all of the relevant information and wrapping it up in that?
>>
>>56927619

Congrats, Sam.
>>
>>56927516
>>56927060
>>56926977
Thank you all so much!
It works perfectly. I'm so happy!

>>56927793
Thank you Austin!
>>
>>56927719
It should be possible to create an iterator to go through all elements in a container.

But i don't think i really understand your problem. Do you not know how to read all elements in a collection? Do you not know what to do with the data once read? What?
>>
>>56927852
>Thank you Austin!

wew lad
>>
>>56928030
Dear Austin,

I'm going to address all of my future posts to you with your name, so you know who I am.

It will be like a secret friendship.
>>
File: 1463670003574.jpg (801KB, 1920x1080px) Image search: [Google]
1463670003574.jpg
801KB, 1920x1080px
Hi /dpt/, I'm writing a simple text relay server in Python.

Currently it works like this:
do forever:
clientA.send(clientB.receive())
clientB.send(clientA.receive())


However, this means that the server will wait until it gets information from one side before it transmits any information it has to the other. Since socket streams are character buffers, I should be able to peek at them, right? I want to know if there's a function so I can do something like:
do forever:
if peek(clientA):
clientB.send(clientA.receive())
if peek(clientB):
clientA.send(clientB.receive())

That way my clients can handle when they get new information, if there is any.

If a function like this doesn't exist, how can I set up my server so that the clients can request information from each other whenever they like? I don't want my server to have to wait for both clients to have said something before the other client can read what the first wrote.
>>
Newbie on C here
One hundred million internets to anyone who can figure out why this function is going to the else statement when inputting a digit between 0 and 9

long decin(void) {

long inputFound = 0; //accepted/found digits
long total = 0;
int counter = 0;
int character = 0;

while(character != '\n'){
character = fgetc(stdin);
if(( character >= 0 && character <= 9)){
inputFound = character;
total = total*10 + inputFound ;
}else{
counter++;
digiterror(character, &total, OUT_OF_RANGE);
writeline("message", stdout);

}
}

return total;
}


Not even my college's TA managed to understand why this is happening.
/g/ is my last hope.
>>
>>56928251
have it print out the integer c immediately. you will see
ask for your money back also
>>
>>56928251
The ASCII digit for '0' is not the integer value 0. When you enter '0' into your program, you're actually getting 48.
So pretty much, change
if(( character >= 0 && character <= 9)){

to
if(( character >= '0' && character <= '9')){
>>
>>56927856
>It should be possible to create an iterator to go through all elements in a container.
i've thought of this, but stack doesn't implement iterators (i think?) so i'd have to switch my container (a non-issue, really).

internally, using an iterator to go through the container elements isn't a problem, but i'm trying to find a way to allow something OUTSIDE the class to occasionally read the data in my container. if i passed an iterator to something outside the class, wouldn't they need to know when to stop?

i guess i could create my own iterator within the class, which could know when to stop, and send that outside for whoever to play with.

>But i don't think i really understand your problem. Do you not know how to read all elements in a collection? Do you not know what to do with the data once read? What?
yeah i didn't do a good job explaining what im trying to accomplish/learn

say you have a class that stores some data. the data can only be modified in specific ways, and the class handles all of that. but occasionally, all the data needs to be read by some other class, maybe to display it or perform some action based on the state of the data. is there a generally accepted way of doing that?

is just sending a constant reference/copy of the entire container acceptable? or is there a better way?
>>
>>56928307
>>56928303
We tried that, still goes to the else statement...
>>
Are there any tutorials or videos that teach the C++ STL? All the series on YT don't cover the STL in depth and reading every page on cppreference isn't my thing.
>>
>>56924248
I'd start with 0
>>
>>56928361
I wouldn't dare speak of what might be the best way of doing it, but i'm thinking you could return a couple of const_iterators to the beginning and end of your collection.

Looks like you're right about std::stack not exposing iterators, but std::deque (which is the default underlying collection for stack) does.

I don't know how one goes about extracting the underlying collection from the stack. Might be as simple as recasting a pointer, although purists would hate that.
>>
How do I efficiently set a variable to a new string object every iteration of a loop in ruby? If I use new will it leave the old ones floating around in space until the program exits?
>>
Learning how to do integration and unit testing in python
>>
>>56928728
nvm im retarded and wasnt naming correctly for local scope
>>
>>56928382
if ((character >= (int)'0' && character <= (int)'9'))
>>
File: 2016-10-04_21-06-46.png (33KB, 521x221px) Image search: [Google]
2016-10-04_21-06-46.png
33KB, 521x221px
I am in struggle.

So I'm [a student] going through some practice problems in a sheet that my professor gave us as sort of a practice exam that should prepare us for the midterm coming up.

This one problem is killing me and I can't find any sort of broader category of problems that this falls under.
I found the solution to the problem relatively easily just with a greedy approach, but I cannot, for the life of me, prove that it provides an optimal solution.

I'm just wondering if this rings a bell to anyone as a well-known question, like in the sense that the activity scheduling problem is well-known.

The gist of it is:

You are given a list of intervals with a starting point, s, and ending point, e, in the form of {(s1, e1), ... , (sn, en)}. The starting and ending points are integer values on a number line.
Each interval has a weight associated with it. Each interval must have points distributed over it such that the number of points satisfies the weight of the interval. Find a solution that places the minimum number of points over the range of the intervals.

I know this is kind of like asking for help with homework, which is why I'm not asking for the solution, just a name or something that I can google.
>>
>>56928307
I'm not familiar with C, so I want to make sure I'm following your code:

you have an integer variable called character, which you initialize to 0.

once you enter the while loop, you set character to the integer value of (presumably) the first character in whatever stream you're reading from (if not, some character in the stream)

if the integer value of this character is between 0 through 9, then you enter the if statement

otherwise, you enter the else statement

according to an ascii table, the characters that correspond with the integer values 0 through 9 are:

null char
start of heading
start of text
end of text
end of transmission
enquiry
acknowledgement
bell
backspace
horizontal tab

does that sound right?
>>
>>56928775
That explanation of the problem makes my head hurt. Try again, or provide an example.
>>
>>56928769
That should matter because of implicit casting rules.
>>
File: 2016-10-04_21-12-48.png (58KB, 810x200px) Image search: [Google]
2016-10-04_21-12-48.png
58KB, 810x200px
>>56928818
My greedy solution is basically:
>prioritize earlier endpoints
>When you reach the next endpoint, place X pebbles a distance 0.5 before the endpoint, where X is the weight of the endpoint minus the number of pebbles previously placed in the range of the interval whose endpoint you are at.
>>
File: 1463511026473.jpg (1MB, 3888x2592px) Image search: [Google]
1463511026473.jpg
1MB, 3888x2592px
>>56928188
pls halp
>>
>>56928872
Try it. You'll see.
>>
>>56926766

Thanks. That'd be the one I wanted.
>>
>>56928616
>I wouldn't dare speak of what might be the best way of doing it
that's ok, i appreciate the time you've given me.

between what you've suggested and some ideas i came up with while asking/wording my questions, i'll play around a little bit and see what seems to work best.
>>
>>56928897
>>56928872
>>56928769

Actually, nevermind. It's late and i'm retarded.

How do you now it doesn't go into the if statement. Try inserting some trace prints inte both the if and the else.
>>
I love Julia more and more the more I learn about it. It is the upgrade from Lisp that I have wished for for so long.

A "real" Lisp with focus on runtime speed, a non-shit syntax for anything mathy and code that is actually readable to people other than myself is just god-tier for my particular use-case. Having Matlab-style syntax for matrix multiplication on top of that is enough to bring a tear to my eye.
>>
>>56928932
What other ideas did you come up with?
>>
>>56928879
That makes a little more sense now. This problem is a constrained search and is NP complete. So it's unlikely your greedy solution is optimal.
>>
>>56929007
i'm intrigued by the suggestion that it might be appropriate for machine learning and isn't python, matlab, or r
http://juliacomputing.com/blog/2016/09/28/knn-char-recognition.html
>>
>>56929135
I think the question I've been given isn't asking for speed-optimism. When it says prove it's optimal, I think it just means to prove that you do indeed only use the minimum number of pebbles.
>>
>>56928872
what about this: >>56928785
i just realized i responded to the wrong poster.
am i interpreting the problem correctly?

>>56929008
mostly just what i had already written. i kinda rubber ducked a few things as I was writing out my question.

there are a few ways i can think of dealing with this problem, and i think only 2 are reasonable:

1. using iterators (there are two ways I could do this: implement my own iterator, or use an iterator from a container).

2. wrapping the most basic data in a struct and returning that

I think your recommendation of using iterators is probably the best in my situation.

the other ways are:

3. returning a constant reference of the container.
i dont like this method because what if i decide to change the type of container? i'd have to rewrite my code in other places as well

4. returning an array of the data
on the one hand, this would work because the data im working with in this situation is pretty simple data. on the other hand, how long is the array? id have to create another method to retrieve that kind of information. i dont even know why im considering this a possibility
>>
>>56924179
>>56927449
Actually came here to ask if learning Python would be worth it.
My university's also offering a class in it, along with MySQL. I haven't done any serious programming in the past, by the way.
>>
File: 1409331389545.png (297KB, 1000x1164px) Image search: [Google]
1409331389545.png
297KB, 1000x1164px
How can I enter flags with escape characters (like %$?./ etc) into UNIX system terminals, as part of the flag?
>>
>>56929306
escape the escape character
>>
what kind of knowledge would I need before doing a wm in c.
aside from xlib of course
>>
>>56929184
I know what optimum means.

Perhaps you can say the number of pebbles used is minimum because all n number of pebbles before the answer p cannot generate a solution. So your algorithm would be to start with n=1 pebble and attempt to solve the problem, keep increasing n until a solution is found. This one of the optimal solutions.

If you must minimize excess weight, that's undecidable.
>>
>>56929273
Yes.
Python is easy, yet capable language. You can do anything you want in Python, but it's not really suitable for big projects and places that require extreme runtime efficiency. Other than that it's one of the best choices.

Ofcource you probably won't learn much about how computers are working and what it's really all about, but you don't have to build a watch to check what time is it.
>>
>>56929273
If you have the motivation I would go for it.
I plan on learning C#, Python and SQL as my next languages, respectively
>>
>>56929205
I don't know who you are. If you asked the question you are incorrect because you didn't make the integers characters, i.e. 0 => '0'. That explanation is correct. You are checking ascii encodings 0 through 9 instead of the characters 0 though 9. Also, your TA is clueless and bring your questions here from now on.
>>
>>56929273
no, python isn't worth it, and also SQL isn't really a "language", it's more of just a thing you use sometimes. just learn java
>>
>>56929508
Why isn't python worth it? It seems it is really good for a bunch of things.
>>
>>56929458
im not the one who asked the original question, but i am the one who wrote >>56928785

my post was intended for >>56928251 (the original question) but i responded to the wrong post.

i know very little c, so im unfamiliar with functions like fgetc() - specifically what EXACTLY it does. from what I read about the function, it seems like it grabs the next character in whatever stream was given.

with that assumption, it seems like >>56928251 is assigning the integer variable 'character' to the integer value of the first character in the stdin, which more than likely will not fall between ascii character code 0 and 9, which is what he's checking.

for example say the first character in the stream is H, then the variable 'character' will be assigned 72, which does not fall between 0 and 9, so it goes to the else statement.
>>
>>56929529
like what?

>>56929508
java isn't worth it. just learn sepples
>>
>>56929529
Because it is.
Java is nice, aspecially since version ~1.8, but it has still a lot of boilerplate. Python is much more comfy, easy, faster to write and cleaner.

If you ask /dpt/ about any language you will always find some fags claiming it's shit.
>>
>>56929552
Web dev, socket programming, file handling, math related shit, web scraping, prototyping, data management, etc...
>>
>>56929563
>especially since version ~1.8
Java 8's stream API is the most half-assed thing I've ever seen in a serious programming language.
>>
>>56929563
Lol yea I know, I just wanted to see his dumb ass answer.
>>
being a child is when you love C. being an adult is when you realize C++ makes more sense
>>
>>56929639
(You)
>>
>>56929578
yeah i'm a dumbass while you're the one learning python because you googled "what's the best first programming language"
>>
>>56929578
also you say python's good for "math related shit" when it has dynamic closures and is at its core mathematically incorrect
>>
File: 1451380653640.jpg (128KB, 267x789px) Image search: [Google]
1451380653640.jpg
128KB, 267x789px
I'm in the middle of rewriting akari-bbs to accommodate threads and entire boards, which is long overdue, I think.
>>
>>56929662
Thats not why I learned python. I learned C first. I don't think python is a good first language. But I do think it is a good language for what it is meant for.
>>
how long would it take me to learn xlib?
>>
>>56929374
>You can do anything you want in Python, but it's not really suitable for big projects and places that require extreme runtime efficiency.

I'm assuming getting that language down would help with learning other languages that could so such things?
>>
>>56929695
good. we're going to need a replacement soon
>>
>>56929716
Depends. If you are talking about a language like ruby, then yes. but if you are talking about a static typed language like C then no.
>>
>>56929734
inb4 someone claims that python is statically typed
>>
>>56924121
This is pretty fucking loco ese. But I would take a clean freaky NEET over those disgusting ones who can't take the trash out.
>>
File: no problems.png (11KB, 477x181px) Image search: [Google]
no problems.png
11KB, 477x181px
>>56929749
>>
>>56929749
Lol what? I have never seen anyone THAT dumb
>>
>>56929759
I have.
>>
>>56929695

Do you plan to plan to make it multi-threaded (in the parallelism sense)?
>>
>>56929548
Well you are correct. I'm guessing he hasn't responded to anyone because he figured it out, but it's hard to tell. Per thread IDs aren't a bad thing. They get reset every thread, which is like 4 hours tops during peak hours.
>>
>>56924331
I understood that reference.
>>
File: 250px-Alexander_Stepanov.jpg (15KB, 250x333px) Image search: [Google]
250px-Alexander_Stepanov.jpg
15KB, 250x333px
>mfw writing c++ templates is tolerable now
cooking up some monads as we speak lads
>>
>>56929943
We are all very proud of you anon. So when are you going to get a job and move out?
>>
>>56924179
>racket has every feature of python and more
>you can implement more features if you want
QED
>>
>>56929943
>template <typename T> X
in Haskell this is just

forall T. X

or
∀T. X
>>
File: 2016-10-04-230028_453x33_scrot.png (4KB, 453x33px) Image search: [Google]
2016-10-04-230028_453x33_scrot.png
4KB, 453x33px
readng the xlib
what does it mean by pic related
>>
>>56929980
>>56929943
C++ template meta programming is pretty cool but it grinds compilation times to fucking halt
>>
>>56930040
I'm guessing it means if you try to output an image outside the non-drawn bounds, the previously drawn parent window will overshadow it.
>>
>>56924121
writing a dos clone kind of thing
[bits 16]
[org 07C00h]

cli
xor ax, ax
mov ds, ax
mov es, ax
mov sp, 0x7C00
mov bp, sp
sti
mov si, diskload

call print
call load_sector_2
jmp $
;Print SI
print:
mov ah, 0Eh
.loop:
lodsb
cmp al, 0
je .end
int 0x10
jmp .loop
.end:
mov al, 0
ret


read_sectors:
pusha
mov si, 0x02
.top:
mov ah, 0x02
int 0x13
jnc .end
dec si
jc .end
xor ah, ah
int 0x13
jnc .top
.end:
popa
retn

load_sector_2:
mov al, 0x01
mov bx, 0x7E00

mov cx, 0x0002
mov dl, 0x00
xor dh, dh
call read_sectors
jnc .success
mov si, diskerror
call print
jmp $
.success:
jmp 0x0000:0x7E00


diskload db "[SB] Loading disk.", 0Dh, 0Ah, 0
diskerror db "[ER] Disk error, halting", 0Dh, 0Ah, 0
disksuccess db "[OK] Stage 2 Loaded", 0Dh, 0Ah, 0
times 510-($-$$) db 0
dw 0xAA55
>>
what is the program with most loc?
>>
>>56930272
>16-bit x86
>>
>>56929007
>>56929140
I'm using Julia right now in the Stanford algorithms course on coursera. It's really great for that kind of stuff imho.

The syntax for if, while, for and recursive calls is very similar to that of the pseudocode typically used in algorithms courses and textbooks and you have easy access to all the important data structurs. But you also get to use a fast compiled language to try out bigger cases, and all the nice goodies that separate the lisps from the blubs.
>>
>>56926233
Unnecessary recursion.
When programs run too fast to identify which method is better, then you feed it huge amounts of data and run it 100, 2000, 50000, or a million times and try it a different way. Regardless of the cuteness factor of a shorter or more elegant looking program, the bits don't Care how they are sorted, moved, added, or manipulated- they don't care about speed either, but You should.


Is this using more processor cycles than necessary? Yes.

Recursion IS useful, but not reversing a string. I only use recursion for the non-player intelligence of board games, checkers, chess, multiplayer golf peg games, sudoku puzzle creation, etc. because when a choice is made, and others exist, one can push the unexplored choices onto a stack, or added to a list, and recursively call itself (the solution finding routine) again. The supervisory routine analyzes viability of solutions, until it exhausts the stack, or list. It's not useful for reversing a string in place where, much more simply, two integers or pointers can be incremented and decremented to run through the string, swapping indexed characters.
>>
>>56930280
healthcare.gov
>>
>>56930289
listen, its my first operating system. im not going to jump into protected mode immediately. i still need muh interrupts
>>
>>56926639
Lol
Autocorrect fail

Stu stu studio
>>
is there an elegant way to read in backspace-delimited integers from console up until a newline in C/C++

such that
 14 15 16 17 

turns into
array[0] == 14
array[1] == 15
array[2] == 16
array[3] == 17


my brain isn't working right now
>>
>>56930360
>C/C++
Why are you grouping two completely different languages together?
>>
>>56930388
fuck off, C is a subset of C++.
>>
>>56930395
(You)
>>
>>56926762
No you need to explain Why you are doing something as you show how to do it. Discovering how to do something is important, but why that method works may elude somebody completely. Thus a good tutor allows for discovery and experimentation after an example is given with the description of how and why it works.
>>
>>56930399
for my purposes it is. i know you guys are prickly and pedantic but i thought it would be obvious that i'm asking for a solution which might use a C standard library function
>>
>>56930425
>prickly and pedantic
You don't even have to be pedantic. There are many major and glaring differences between the languages, even in C89.
>but i thought it would be obvious that i'm asking for a solution which might use a C standard library function
I don't even want to help you, because you're a fucking obnoxious retard.
>>
>>56930463
who's the obnoxious retard, someone who asks a quesiton or someone who diverts it to a literally completely different subject for his own gratification? get fucked.
>>
Is C++ the best language?
>>
>>56930488
You're question is CS101 tier. You're clearly extremely inexperienced and you try to act like you know shit.
Do it yourself, you retard.
>>
>>56930501
nigger, do you think i am unaware of how little i know? literally why would i even be asking otherwise? if you can find me an example of an implementation for my specific problem which isn't contrived or outlined expressly for the purpose of demonstrating the differences between C and C++ ill suck your dick like you obviously want me to. but otherwise you'll just have to look for a more willing supplicant
>>
>>56930562
What was your original question bro? I'm not digging through all this shit to find it
>>
>>56930360
Read the entire line (can be done without buffering shit, if you're using C++ functions) and then read individual ints using something like strol()
If you want elegant string manipulation, just throw C the fuck away and use something else.

Python:
ints = map(int, input().split())


Haskell:
ints :: IO [Int]
ints = (map read . words) <$> getLine


Scheme:
(define ints
(map string->integer
(string-split (read-line))))


My point is it's gonna be ugly
>>
>>56930583
i'm literally just trying to read a sequence of backspace-delimited integers from command line and feed them into an array
>>
>>56930600
>backspace-delimited
wat
>>
>>56930592
alright, thanks. i'll just deal with the ugly then
>>
>>56930631
[Code]14\b15\b16\n[\Code]
at least, that's how i assume the buffer looks like
>>
>>56930360
scanf("%d", &array[n])

literally

I think scanf skips prefix whitespace
>>
>>56930635
Here's my ugly implementation.
Alternatively you could use strtol or scanf but this deals with spaces correctly
#include <stdio.h>
#include <stdlib.h>

int read_ints (int* array, int len)
{
int count = 0;
int any_number = 0;
int accum = 0;
char c = '\0';

while (c != '\n') {
c = getchar();
if (c >= '0' && c <= '9') {
/* accumulate digits */
accum = accum * 10 + (c - '0');
any_number = 1;
}
else if (any_number) {
/* maybe add to array */
if (count < len)
array[count++] = accum;
/* reset accumulator */
any_number = 0;
accum = 0;
}
}

return count;
}

int main (int argc, char** argv)
{
int array[4];
int count = read_ints(array, 4);
for (int i = 0; i < count; i++) {
printf("array[%d] = %d\n", i, array[i]);
}
return 0;
}
>>
>>56930696
>tfw to intelligent for a trip
>>
OS anon here
currently each command can only be 4 characters long but I can extend that later on. by the end of the year, i'm hoping to have a FAT12 filesystem driver, audio support, and maybe some partial networking. i'll keep you guys updated when i make any big progress
>>
>>56930719
oh and i forgot to mention, the numbers after the command are just for debugging. that is the contents of the EAX register. i know it stores the command backwards but it's a start
>>
>>56930719
how do I get started on doing what ur doing
>>
>>56930743
http://mikeos.sourceforge.net/write-your-own-os.html
http://wiki.osdev.org/Main_Page
>>
>>56930719
Thinking about building a kernel myself. How difficult is it to implement FAT and TCP?
>>
>>56930755
i have no idea about TCP but FAT should be relatively simple.
http://wiki.osdev.org/FAT
>>
>>56930719

Do FAT32. Fuck FAT12.
>>
>>56930675
That's pretty shit, mate.
#include <stdio.h>
#include <stdlib.h>

_Bool read_ints(size_t n, int arr[static n])
{
char buf[256];
char *ptr = buf, *endptr;

if (!fgets(buf, sizeof buf, stdin))
return 0;

for (size_t i = 0; i < n; ++i, ptr = endptr) {
arr[i] = strtol(ptr, &endptr, 10);
if (ptr == endptr)
return 0;
}

return 1;
}
>>
>>56930805
>C++17
>still no automatic arrays
>>
>tfw too dumb for programming
>>
>>56930805
>_Bool read_ints(size_t n, int arr[static n])
What the fuck? Is C dependently typed now? When was this standardized?
>>
>>56926233
Needs more levels of indirection.

I just love how out of all things that are wrong with this including the potential for undefined behaviour, the first thing C fags on this board complain about is the recursion.
>>
>>56930834
read this in a non-memetic context
suicide is an actual option
think about it, im trying to help you
>>
>>56930885
thx, i wish i could
>>
>>56926233
I'm confused. How does this function know about the length of the arrays exactly? I see no length parameter being passed or comparisons, just pointer arithmetic.
>>
>>56924121
Will dressing like a girl make me a better programmer?
>>
>>56930788
it should really be FAT28 considering you cant use the last 4 bits but yeah, i'll try and add it at some point
>>
>>56930927

It doesn't need to know the length of either. it just needs to know where the end of the string is, which is null terminated. The function abuses the call stack to execute actions in reverse order. This isn't exactly wise, as it opens the function up to stack overflow.
>>
>>56930927
if (*in) {

It detects the string-terminating 0 and starts climbing back up the recursion stack.
>>
Is there a way to split a string in bash. If so how can I do it?
>>
>>56930998
But realistically, how long does a string have to be for this to be a problem?
>>
>>56931059
on most platforms, about 5 to 8000 bytes.
>>
>>56930719
>when you write absolutely abhorrent code
cmdlen equ 4
getkeypress:
mov ah, 0x00
int 0x16
ret

getcommand:
mov cx, 0
.loop:
call getkeypress
cmp al, 0Dh
je .done
cmp al, 20h
je .arg1
cmp cx, cmdlen
je .loop
mov ah, 0x0E
int 0x10
mov bx, cx
mov [command+bx], al
inc cx
jmp .loop
.arg1:
mov ah, 0Eh
mov al, ' '
int 0x10
mov cx, 0
.arg1loop:
call getkeypress
cmp al, 0Dh
je .done
cmp cx, cmdlen
je .arg1loop
mov ah, 0x0E
int 0x10
mov bx, cx
mov [arg1+bx], al
inc cx
.done:
ret

kernmain:
mov si, kernloaded
call print
call getcommand
mov eax, [command]

;Reserved memory
section .bss
;Command system
command: resb 4
arg1: resb 4

also, print is in an include somewhere else
>>
>>56924219

RAM inutilization
>>
>>56931065
8000 is a pretty long string
>>
>>56931113
Not really.
>>
>>56931087
typing the command meme with the argument meme triple faults my emulator while abcd with the argument abcd works just fine. what did it mean by this?
>>
>>56931059

It would depend upon the compiler, the size of a pointer on the architecture, and how much stack space the OS gives to the program (although programs may request more, IIRC). Each stack frame at the very least is going to need to hold three pointers: the return address, and each of the two parameters. Depending on the compiler, it might also push a base pointer at each frame, and if the compiler decides to cache the value of *in, it might push some more data, aligned to the machine's word size, not to mention any extra stack space mandated by the calling convention as a "shadow stack" or "red zone"

Compiling the reverse function using -O3 on the MinGW compiler targeting x86_64 Windows seems to use about 64 bytes of stack per instance. 8 for each pointer, 8 for the return address, and 40 for a shadow stack (convention requires 32, but maybe GCC is using that extra 8 bytes for something else). Windows allows applications to have 1 MiB of stack space for applications unless more is requested. Diving this amount by 64 gives us 16,384 stack frames, tops. This may seem like a lot, but if we imagine our input was a file read into memory, this would seem severely limiting.
>>
Someone bullied me for using CodeBlocks.

H-he's just a bully, right?
>>
>>56931383
I want to bully you too.
>>
>>56931383
Why do you care? Do you have a crush on said bully?
>>
File: slhwxOg.jpg (426KB, 1366x727px) Image search: [Google]
slhwxOg.jpg
426KB, 1366x727px
>>56931404

why

>>56931419

no I was wondering if there was something better I'm missing out on
>>
>>56931490

A good portion of /g/, myself included, prefer not to use IDEs. Hence, bullying.

If you are going to use an IDE for C or C++ though, QtCreator is generally considered pretty decent.
>>
/g/, on C, if I'm setting a character = fgetc(stdin), and when I print that character, it shows "10"

What character is fgetc getting? For any character that I set it to, it outputs 10.
I'm not sure what that is though (checked ASCII and no idea), is it a newline character, and I'm not properly clearing the buffer?
>>
>>56925330
Use C. Write your own metaprograming language.
Realise that it's better than any of the bullshit languages that have been made so far.

Go is also an option I suppose. It has good following among data analysts people who normally use stuff like python. I don't know why but I imagine they see some convenience.
>>
I was just writing this
Now I'll go to bed, sun is already up.

>>56931711

Something that I should do about my style? It feels extremely chaotic.
>>
>flushing the input buffer in C
>>
do I really need to read h&p before k&r?
>>
>>56931987
read kernighan & pike
>>
C is a pretty nice language as long as you use some compiler extensions.
>>
>>56931603
>A good portion of /g/, myself included, prefer not to use IDEs. Hence, bullying.
>autists bullying people for not being autistic
wew lad. we have truly come full circle
>>
>>56932048
what do?

I
>learned 60% of the c language
>am about to memorize the standard libraries and how they work

what do next
>networking?
>>
OS anon back again. just finished commands with multiple arguments and backspaces.i'm still gonna have to work on the argument parsing stuff though
>>
>>56925111
Be careful with that if you have more than 32 flags you will have to static cast the left side to 64-bit integer first.
>>
paypal more like gaypal
>>
>>56932336

Yes, but what does this have to do with programming?
>>
>>56932366
haven't you had to use the paypal api's?
>>
>>56932381

Nope. I don't do web programming, and if I were to handle payment, I'd preferably work with Google Wallet. Yes, it's botnet, but it's better than a company known to fuck over merchants.
>>
isn't 4chan written in php still

maybe i should rewrite it in a decent language and budget problems would be less of an issues
>>
>>56932418
someone is already rewriting 4chan in C
>>
>>56932418
php is fine
>>
ruby are you here?
>>
what i wanted to ask was:

what are some real world applications for ruby

why use ruby over any other language
>>
>>56932475
Yes. Albeit lurking a few other threads.

>>56932516
Ruby is comfy, but slow. It is very nice for writing scripts that deal with a lot of string and/or list processing. Most cases where Python or Perl might be appropriate, Ruby is a nicer alternative.
>>
>>56932516
It's a nice language to use on your macbook in starbucks
>>
>>56932599
>>56932599
>>56932599


migrate slowly
>>
>>56928251
>int character
>long inputFound
>inputFound
To be honest, you should shoot up your collage, you'd be doing everyone a favour, then end yourself.
>>
>>56930675
Hi, I see you included <stdio.h>, anon. I think that's why your program isn't compiling. What you need is <studio.h>, it's a common mistake, don't worry about it anon.
>>
reminder to follow the advice of your haskell bretheren
https://www.youtube.com/watch?v=ojZbFIQSdl8
Thread posts: 314
Thread images: 31


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