[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: 335
Thread images: 49

File: 1481609616077.jpg (264KB, 1440x1080px) Image search: [Google]
1481609616077.jpg
264KB, 1440x1080px
What are you working on, /g/?

Old thread: >>58734607
>>
Are you satisfied, sempai?
>>58734724
>>
FP > OOP
>>
>>58739753
Thank you for using a good porgramming language image.
>>
>>58739755
He checks if NONE of the character EVER exists inside of the string.
You do not do that.

You output that "no character matches" when the last character in the string is not one of the searched for characters.
That is something different.
>>
File: karen haskell.png (818KB, 1280x719px) Image search: [Google]
karen haskell.png
818KB, 1280x719px
>>58739732
>>58739753
>>58739766
>>58739771
All good posts

Who /Haskell/ here?
>>
>>58739807
Haskell is cute!
>>
>>58739732
that lady has a GIANT chin
>>
>>58739806
yeah i fucked up
see:
>>58739795
>>
>>58739848
>>58739795

Right, but now you are not much different from the rest.
You say that having two "loop" instead of one is overhead.

But in fact, in the case of having all the characters not exist within the string, we do not even enter the second loop. Meaning we avoid work.

Both don't give or take much. Depending on the actual values they have different "speeds". Not that it matters anways.
>>
>>58739882
In yours, worst case scenario is two loops though, best case scenario is one loop.

In mine is one either way
>>
>>58739732
why did she declare winmain 5 times?
>>
>>58739753
Fucking WinAPI, no one uses that. What the fuck did you do MAN
>>
File: 1437506998544.png (200KB, 768x576px) Image search: [Google]
1437506998544.png
200KB, 768x576px
Is Automate the Boring Stuff good if you already have an intermediate understanding?

Does it teach good style?
>>
>>58739895
Well, it's not my code that i am defending. My code is >>58739006 .

I am not too sure how his lambda expression actually works. Looking at it gives me AIDS, not too sure why people love it so much.

But it actually does seem like his expression actually runs through the entire search-String, instead of vice versa.
My code doesn't run through the search string. It runs through the string of characters to search for and sees if any of them exist.

And then the difference between my code and yours is as i said.
>>
File: 1466577279086.png (71KB, 780x530px) Image search: [Google]
1466577279086.png
71KB, 780x530px
>>58739911
There's no such thing as good python style
>>
>>58739732
>>58739807
>>58739911

Thank you for posting anime pictures
>>
>>58739910
Chill, dude, this picture is from 1995.

>>58739909
Ask Ritsuko, she's not in charge of writing code.
>>
File: never4get.jpg (76KB, 610x660px) Image search: [Google]
never4get.jpg
76KB, 610x660px
>>58739945
What else would you suggest for GIS
>>
File: 1475455485173.jpg (64KB, 610x660px) Image search: [Google]
1475455485173.jpg
64KB, 610x660px
>>58739964
GIS?
>>
>>58739910
what do you use instead if you're C/C++ programmer?
>>
>>58739960
NO
You asked if you did a better job quoting a guy that demanded a more interesting piece of code in the OP.

WinAPI IS NOT INTERESTING
>>
Quick, someone propose a quick challenge
>>
>>58740008
Depends on what you want to do.

There are many libraries that are proper C++ to use if you want to create GUI's or whatever.
>>
>>58740014
Solver for https://en.wikipedia.org/wiki/Des_chiffres_et_des_lettres
>>
>>58740035
filesystem management for example
>>
>>58740054
boost
>>
>>58740065
how about for plain old C?
>>
File: 1485877794703.jpg (21KB, 393x360px) Image search: [Google]
1485877794703.jpg
21KB, 393x360px
Gonna ask again with all the info

I need your opinion /dpt/
I'll try to make it as short as possible.
So for end of study work, I chose to make a fitness app? Just like this one:
https://play.google.com/store/apps/details?id=softin.my.fast.fitness&hl=en

The thing is I'm alone on this project and I have to make it work for October. Didn't do anything for the moment. I'll do it in Java, mainly. I'm kind of good in Java. Like any regular student would be really.
Is it too ambitious ?
I also won't have really the time to only focus on this since I have an internship coming and classes.
Any opinions, advices ?
>>
>>58740076
Sure, you could use WinAPI for that. It's a C-API after all.

Not too familiar with C-best practices.
>>
>>58739964
GIS is not language specific.

GIS is predominantly working with two things:
>fucktons of your own data in a database
>fucktons of publicly available data via APIs

Both of these things are trivial in any modern, high-level language like Python, C#, Java, C++, and even some of the memelangs like Haskell.

You're effectively talking about CRUD when you work with GIS, as you will be using a mapping visualization stack that you yourself do not write.

Even if you did write the map visualization stack yourself, it sure as hell wouldn't be in Python. You'd be looking at something more along the lines of C++.
>>
>>58740105
I'm making a backup manager for linux and windows and I'm trying to figure out which libraries to use and such. Trying to avoid GPL too
>>
File: 1472201510755.jpg (26KB, 274x321px) Image search: [Google]
1472201510755.jpg
26KB, 274x321px
>>58739945
>pythonic way
>non-pythonic way

fucking what
you've got a tool which is never indented to be fast, just shitcode and run, it's inefficient as it is
no we want to argue which way to place bricks of shit is the only true way

i'm fucking mad
>>
>>58740089
Read my response again from last thread, because it is the truth.

We don't know who you are, what your work ethic is, how intelligent you are, or how competent you are with learning new things and programming.

Yes, your goal is realistic for someone who is proficient in Java and has written an Android application before, or has a set of tools that can help facilitate the process.

I'm unsure of the cycles required for standard Android dev, but I know I could get something going with Xamarin + a few services in Azure very quickly, however, this would be with the intent to monetize to recoup Azure hosting costs if many people began using my application.
>>
>>58740142
wew

https://wiki.haskell.org/Why_to_use_Haskell_for_GIS_programming_%3F
https://hackage.haskell.org/package/terrahs
>>
File: fo-drizzle_o_587686.jpg (16KB, 480x273px) Image search: [Google]
fo-drizzle_o_587686.jpg
16KB, 480x273px
>>58739732
I have been snoop doggifying my code as of late. All variables must end in the suffix "-izzle". It definitely helps with readability of the code
>>
File: 1484950781151.jpg (211KB, 1280x720px) Image search: [Google]
1484950781151.jpg
211KB, 1280x720px
Please tell me what useful can be done with array-based programming language.
Hard mode: no "processing arrays"
>>
>>58740277
is that show actually good or does it just get a pass for tiddies and coding
>>
>>58739432
>>58739936

static void FindCharactersAndInformUserOfTheirBullshit(string input, IEnumerable<char> characters)
{
var chars = characters as char[] ?? characters.ToArray();

if (input.IndexOfAny(chars) == -1)
{
Console.WriteLine("The string contains none of the supplied characters.");
return;
}

for (int i = 0; i < input.Length; i++)
{
if (chars.Contains(input[i]))
Console.WriteLine($"Found char {input[i]} at {i}.");
}
}
>>
>>58740298
it's alright

>>58740277
anything since memory is an array
>>
>>58740277
>>58740277
Highly parallel graphics programming, physics simulations, ... that sort of thing, which needs a lot of simple operations done at once. Array programming is basically to gpu what c is to processor (for example check out futhark language). It's for speed.
>>
>>58740277

What do you consider to be an "array-based" programming language?
>>
>>58740277
Fortran
>>
Is anyone familiar with R? I am having some issues splitting rows full of characters into equal rows.
>>
anyone here dropped out of uni and still did good?
>>
>>58741049
No
>>
>>58740196
Yeah I answered too in the last thread.
Other than my basic (not really basic) knowledge of Java, what do you want me to say. I'm as proficient as a student in the end of hi studies might be. I'm not one of the best student there but I'm pretty good.
Plus, really I didn't see the process of making this app being something other than creating a whole lot of DAO models and whole lot of data to put in the database with another bunch of query.
It doesn't have to be the prettiest ever either.
>>
>>58741049
No, you're fucked for life
>>
Reading the modern C pdf it's pretty great
>>
File: 1485904893417.png (2MB, 1220x1220px) Image search: [Google]
1485904893417.png
2MB, 1220x1220px
>>58741174
>modern C
>>
>>58741195
dumb weebposter
>>
>>58740374
Google it trippo
>>
>>58741049
I still have some courses left to get my degree. I was hired out of university and didn't finish them ._.

I still make a lot of money though
>>
File: IMG-20170131-WA0009.jpg (6KB, 623x34px) Image search: [Google]
IMG-20170131-WA0009.jpg
6KB, 623x34px
This compiles!

Finally, a Monad is just a Monoid in the category of endofunctors
>>
>>58741223
What's the big deal?
>>
>>58741252
Well, defining Monoidal categories, Functor categories and the necessary instances was definitely not trivial
>>
>>58741252
Clearly you aren't on the spectrum.
>>
I'm planning a a model of yeast epigenetics coupled to someone else's model of metabolic pathways.

Trouble is, the model of metabolic pathways was done in C, and the epigenetic models are best done in an object-oriented language (because there will need to be a seperate epigenetic map for each gene of interested, which would best be instantiated as objects).

I now need to either a) Learn to implement objects in C (I'm used to Java and Python because I'm a scrub), b) Get the C stuff to talk to epigenetic models in an object-oriented language or c) Update an old Python prototype of the current metabolic simulation to the state of the C version.
>>
Cardgame webapp in flask
Its kinda my first project
>>
>>58740302
To avoid I/O on each iteration of the loop, you should create a string and print it all at once.

In this case, I've used
string.Join()
which is optimized to hell and back with unsafe code:
Console.WriteLine(string.Join(Environment.NewLine, input.Select((x, i) => chars.Contains(x) ? $"Found char {x} at {i}." : null).Where(x => x != null)));


That being said, what you wrote would certainly be more readable to the average person.

You could even use regular
foreach
syntax with the indexer option.
>>
File: 1483345034951.jpg (148KB, 563x712px) Image search: [Google]
1483345034951.jpg
148KB, 563x712px
>>58739732
Can anyone explain to me how returning functions work? It's the only part of coding I do not understand and I need to learn it. I'm learning Lua in case that matters. ty /g/
>>
Will you be affected by the H1-B visa changes, /dpt/?
>>
>>58741792
What part is confusing to you?
>>
I really wish there was a free alternative to this that was as easy to use.
>>
>>58741818
>mfw Javafags will be gone in a couple of weeks
thank you based trump
>>
test
>>
>>58741844
Is that MATLAB?
Have you heard of GNU Octave?
>>
>>58741792
lean about callbacks and also a bit about functional programming

some functions take a function as a parameter that they'll execute at some point in their scope. it's very useful to be able to modify this on the fly which is what lua lets you do.
>>
I'm actually worried about politics for the first time in my life because Trump is an absolute madman
>>
>>58740374
Languages like APL, J and K.

>>58741440
>Learn to implement objects in C
You can do a mock-up of OOP in C like this
#include <stdlib.h>
#include <stdio.h>

typedef struct Array {
int* arr;
size_t length;
} Array;

Array* newArray(int len)
{
Array* ptr = malloc(sizeof(Array));
ptr->arr = malloc(sizeof(int) * len);
ptr->length = len;
return ptr;
}

void assign(Array* obj, size_t index, int x)
{
if (index > obj->length)
return;
else
obj->arr[index] = x;
}

int getNum(Array* obj, size_t index)
{
if (index > obj->length)
return 0;
else
return obj->arr[index];
}
// -----------------------------

int main()
{
size_t i;
Array* arr = newArray(10);
for (i = 0; i < arr->length; i++) {
assign(arr, i, i * 100);
}
for (i = 0; i < arr->length; i++) {
printf("%d\n", getNum(arr, i));
}
return 0;
}


>Get the C stuff to talk to epigenetic models in an object-oriented language
The easiest would be to use C++ with
extern "C"

You could also create a Python wrapper or use the JNI
>>
public class FizzBuzz {
public static void main(String[] args) {
for (int i = 1; i <= 100; i++) {
boolean fizzOrBuzz = false;
if (i % 3 == 0) {
System.out.print("Fizz");
fizzOrBuzz = true;
}
if (i % 5 == 0) {
System.out.print("Buzz");
fizzOrBuzz = true;
}

if (fizzOrBuzz) {
System.out.println();
} else {
System.out.println(String.valueOf(i));
}
}
}
}
>>
>>58741878
>Is that MATLAB?
No. Mathematica.
>>
>>58741838
No where has taught me how to use them.

I took CS50 for a few lessons to learn syntax, then took a full JS course on codecademy and now I've made a few game mods while avoiding the use of it.

Like for example I need to call a function from the game API that returns a string. My objective is to just print the string in chat so I can see it works. Once it's there I know what to do with it.

> function find:Finder()
> local location = GetLocationName()
> return location
> end

I know the code is probably incorrect but for something like that. I want to be able to use it correctly. And if that code saves the result of GetLocationName() to var location how do I use the variable outside of the function if its local scope confines it there

>>58741880
ty anon, I'll look more into those. I am comfortable with freehanding functions it's just returning them I don't understand

> some functions take a function as a parameter that they'll execute at some point in their scope. it's very useful to be able to modify this on the fly which is what lua lets you do.

gonna save that in my goodadvice/g/gaveme text doc
>>
>>58741904
It may not be as easy to use, but have you tried Sage?
>>
>>58739766
procedural > functional
>>
I already know a lot of programming (C++ and C). What other languages should i learn and what certs are people looking for in an employee? It doesn't have to be programming certs specifically. Looking at CompTIA now.
>>
>C
>C++
>Java
How rich am I?
>>
Are you a C programmer?
I'll have you try this >>58725257 (Cross-thread) and realize how hard it is to
1. Come up with a working code in time
2. Then making it secure
>>
>>58741921
Yes. It's okay and probably the closest thing to a competitor Wolfram has right now but it's still a long way off. Ironically I think it'd do better if they ditched Python as the interface and came up with their own language for it. Something more LISP like but better.
>>
I have a question.

I was a prospective student of Chemistry but I'm pretty much deciding to go the other way (CS+IT) last minute.
For someone who finds C++ easy up until OOP/classes but didn't have the drive to learn more, how hard is it going to be for me.

Of course, I also have a more extensive knowledge of hardware and I know just a bit about networking. Figured this would be the best general to ask in.
>>
>>58741974
20 rupees per hour. you're well on your way to that yacht.
>>
>>58742009
20 rupees > 0
>>
>>58742025
just make sure to buy a toilet, pajeet. you've gotta have priorities.
>>
>>58741942
Keep learning those two.
You don't need programming languages. You need to learn technologies, frameworks, things that are being used in companies.

You can also never be perfect in C++. The language is huge and if you truly want to be good in it then you will need at least another decade of working with it.
Read effective c++, more effective c++, etc. Improve and focus on one language, not 10.

No one cares about certs unless they are specific to a business framework - e.g. Hybris.
>>
>>58742048
So bitter lol
>>
>>58741440
>>58741895 (cont.)
I just realized I forgot to write a function that frees memory, but that's easy
void deleteArray(Array* obj) 
{
free(obj->arr);
free(obj);
}


Ask me questions if you don't understand, but basically. the struct is like a class, the newArray function allocates memory for the pseudo-object and return a pointer to it, just new does in C++ and Java, and then I pass that pointer to a bunch of functions to mutate that pseudo-object.

I think you can do real OOP with functions pointers and shit if you are an absolute madman, there is even a 220-page long pdf somewhere on the internet explaining how to do it, but I think this approach should suffice.
>>
>>58742058
absolutely designated
>>
>>58741895
>Structs and functions that work on those structs are OOP
No. That's procedural programming.
>>
>>58742059
>I think you can

Sure as hell you can, methods are nothing but function-pointers.
But it's stupid as fuck to simulate OOP'ness with C.
People that code and live in C actually love the paradigms of C.
They don't want OOP.
>>
Holy fuck this place is still hyper obsessed with muh dichotomous programming paradigms instead of actually programming stuff
>>
I'm writing a function that multicasts one large block of information (512kb to 32MB) out to multiple peers via TCP in Linux. Would this benefit from multiple threads?
>>
File: languages3.png (17KB, 522x384px) Image search: [Google]
languages3.png
17KB, 522x384px
Reminder
>>
>>58742112
I'd quite like a language that lies somewhere between C and C++, with namespaces, maybe a simpler template system. I'm on the fence about RAII.
>>
>>58742135
4chan is a hell hole but it's the only anonymous community with enough people to be useful.
>>
>>58741942
A scripting language like Python is useful to know, but if you are already good at C++, you won't have any picking it up.

You could also learn a bit of Lisp and Haskell just to get a taste of different ways of programming, but if your only concern is doing practical stuff, then you don't need anything else than C/C++ and Python (unless you want to make web or mobile stuff).
>>
>>58742135
OOP = POO

It belongs in the loo
>>
>>58742191
>Python
Way to tell him to do the programming equivalent of giving himself a lobotomy.
>>
ok, so I have the area of a rectangle, and the ratio of length to width
how do I determine the individual length and width?
>>
File: 1463089316883.png (16KB, 958x660px) Image search: [Google]
1463089316883.png
16KB, 958x660px
Ive been reading a bunch of anti-OOP articles. It seems the programming world is moving away from OOP, I believe someone called it the next goto.

how do I properly write say, game objects, or something that would've been easily represented in an inheritance hierarchy without OOP? There has to be a better way than functions that operate on structs.
>>
>>58742223
Mathematics.

a = w . h

w = r . h

∴ a = r . h^2 = w^2 / r
>>
>>58742180
What is there to be on the fence about RAII?

It's simply a solid concept to avoid stupid shit when programming in C++ and if you really need to you can still handle memory manually.

There is just absolutely no benefit to doing so in almost all cases.
>>
>>58742223
You can multiply the width and height both by a constant to get the area, and just solve for x from there, multiplying the width and height by x to get the true value
>>
>>58741988

There's also Mathics
>>
>>58742256
>.
is that multiplication?
>>
File: 1483724678040.jpg (7KB, 235x138px) Image search: [Google]
1483724678040.jpg
7KB, 235x138px
Is it possible to write gtk applications with scala?
>>
>>58742049
This, C and C++ are relevant languages unless you want to go lower than dip into Assembly.
>>
>>58742252
Inheritance is the issue.
>>
>>58741988
Maxima uses LISP and it's quite crappy imo
>>
>>58742268
but I don't know the w or h
>>
>>58742286
Yes.
>>
>>58742287
use Haskell instead, it has a gtk library
and it isn't Scala
>>
>>58742407
Does Haskell have libraries even close to Java? I don't think so
>>
>>58742430
Haskell has a ton of libraries, and they tend to give you much better mileage than Jave libraries

Scala is really bad
>>
>>58741049
yep, work full time now and saving up money in case I want to go back
>>
>>58742456
This. Quality over quantity.

Same story with C#. Libraries are limited by the language.
>>
File: TOX.png (18KB, 1358x522px) Image search: [Google]
TOX.png
18KB, 1358x522px
I had posted earlier about having a /dpt/ group podcast over Tox to talk about our projects and stuff. I set up a ToxBot audio room dedicated to /dpt/ on a dedicated Pi. Message 'invite 0' to get an invite from the ToxBot. Make sure your Tox client supports group chats (qTox works fine).

I can't post the ID directly (spam filter), so here's a pastebin: http://pastebin.com/7BUE5x40
>>
>>58739732
writing an NES emulator in rust, mostly to get more acclimated with the lang
>>
I want to set up my own git server on a vps. I was going to use digital ocean, but I'd like to hear any suggestions...
(Basically I want to have full control - I don't like the idea of being tied to github.)
>>
>>58742256
I don't know w or h, that's the point
I'm trying to find them out
I know a and r though
>>
File: lowpolyworld.png (2MB, 1837x875px) Image search: [Google]
lowpolyworld.png
2MB, 1837x875px
>>58742252
I've done my fair share of OOP bashing but you should always judge for yourself if OOP seems fit for a purpose or not. Whatever makes you produce value over long time (= not spaghetti s.t you get large decrease in production over time) is a good way of programming.

In general most people bashing OOP do not understand the typical solutions to their problem at hand, hence raging on about OOP making software terrible. Not the case. OOP has produced most of the games you've ever played, both bad and good ones.

To answer your question, the inheritance hierarchy is usually the problem, not OOP per se. There is a design pattern called Entity-System-Component (google t-machine ECS) which plentiful of games nowadays employ to architecture their games.

In ECS, you program a set of classes called "components" which can be combined into an "entity". There is also a set of systems, which are classes with some update method who iterates through some subset of the components and change them in some way. If you want a Goblin you attach a PhysicsComponent, a HealthComponent, an AiComponent onto the Entity which represents the goblin (you typically dont have a Goblin class). This entity representing the goblin is then added to some set of systems such as PhysicsSystem, HealthSystem, AiSystem. For a player you probably want the same setup but you also attach an InputComponent and add the player to a KeyboardSystem.

ECS is a data-approach rather than design-approach to games. Each component is simply a POD (plain old struct) which is passed around. The set of PhysicsComponents are stored in some datastructure which the PhysicsSystem traverse in order to update the state of whatever entity with an attached PhysicsComponent. It should be clear that ECS in theory is very modular and maintainable. In theory it should be easy to parallelize since all systems are independent of each other, which is very important on PS4 (many games on PS4 use ECS for this reason).
>>
Writing an GUI in java to log the people that enter the library.
>>
>>58742567
So rearrange things to let you work out w and h from a and r.
>>
>>58742597
>t. poo
>>
Can someone clarify when exactly to use a shared_ptr vs a unique_ptr? I'm nigger tier at C++ and just managed to nig rig my program to work with smart pointers (unique_ptr) but don't really know if i'm using them right. It works though without any drop in performance so that's good enough for me at the moment
>>
File: masterpiece.png (194KB, 3840x2160px) Image search: [Google]
masterpiece.png
194KB, 3840x2160px
>taking python and java at the same time
>java class is like my c class but better paced
>python class is super boring and we haven't even covered any syntax yet
this is seriously the most interesting thing I've done so far
>>
>>58742614
please, im a brainlet, I can't come up with a way to find out w and h given a and r
>>
>>58742662
h = sqrt(a / r)

w = sqrt(a . r)
>>
>>58742660
>making a custom gui with python

It's do-able (e.g. the Dropbox desktop client) but you're gonna have a better time just doing a web interface. No worries about cross platform or Qt licenses or any bullshit.
>>
>>58742456
>>58742407
In Haskell, typeclasses are special-cased and you can only have one implementation for a given type. In Scala, typeclasses arise naturally as a pattern out of more primitive building blocks, and are "just another type" that you can pass around and manipulate in ordinary ways.
>>
>>58742710
then just use implicit parameters and write the dictionaries yourself
>>
>>58742710
C O H E R E N C Y
>>
I'm using WPF and I'm trying to procedurally create a button. How the fuck do I bind a custom ICommand to the button's CommandProperty?
I created a RelayCommand with the appropriate Action and Predicate but when I tie that RelayCommand to a new Binding() and assign it to the button's CommandProperty field, the program just throws an exception.
>>
>>58742860
>>>/g/wdg
>>
>>58742860
this post is so pozzed it gave me AIDs
>>
>>58742597
>To answer your question, the inheritance hierarchy is usually the problem
As well as trying to treat everything uniformly for no reason. ECS suffers from this as well, only it manifests as poor cache utilization. As long as you separate data from code, you don't need to go for the whole ridiculous RDBMS approach. You can use structs for entity types (component configurations) and store them separately and map the systems over them.
http://boreal.aggydaggy.com/programming/2016/05/26/entity-safari.html
>>
>>58742648
shared_ptr is for shared ownership, unique_ptr for unique ownership. Most ownership should be unique.
>>
>>58741844
>he actually BOUGHT Mathematica
Holy shit lmao
>>
File: 1462930379373.png (308KB, 1920x1080px) Image search: [Google]
1462930379373.png
308KB, 1920x1080px
>>58742479
>C#
>Quality
Nice try to slip your shit in, microcock
>>
>>58743064
>implying free as in money, not free as in freedom
ISHYGDDT
>>
>>58743113
>muh open source
>>
I have recently become vegan. Are there any programming languages which were testing / developed using animals which I should avoid?
>>
>>58743125
>implying muh open source, not free software
ISHYGDDT*2
>>
>>58743110
I wasn't praising C#, I was saying it's the same as Java in relation to Haskell.
>>
>>58743135
All of them were tested on animals.
>>
>>58743135
Yet another reason to avoid OOP.
>>
File: mugi_puff.jpg (62KB, 1280x720px) Image search: [Google]
mugi_puff.jpg
62KB, 1280x720px
>>58743140
>>
File: anim.webm (428KB, 1367x847px) Image search: [Google]
anim.webm
428KB, 1367x847px
i added a coverflow view to visualize the play queue no matter which menu you're in
>>
>>58742710
I think that everybody who knows both languages in some depth agrees that Scala implicits are not a good idea (precisely for the reason >>58742821 mentions)
>>
>>58743135
python
ocaml

also avoid the GNU project
>>
File: 1483896475541.jpg (447KB, 800x800px) Image search: [Google]
1483896475541.jpg
447KB, 800x800px
>>58743207
>>58743135
Can't make this shit up
>>
>>58743176
Gives me the 2007 iTunes vibe
>>
>>58742597
thanks will do more research on ECS
>>
>>58743350
ECS is an extreme example of composition. It might not be right for you. Just focus on using composition instead of inheritance and also consider not making all your game objects have the same base class (which isn't really useful, and it seriously gets in the way).

I have written an article about this: >>58742948
The benefits of going from standard composition to a not-too extreme form of ECS are quite clear and it's not very difficult.
>>
Whos brilliant idea was it to name the physical stack and heap after the data structures, and why is it that way? Couldn't it just be "program memory" and "RAM"?
>>
>>58743479
the stack is a fucking stack, and the heap is a heap?
>>
>>58743479
My guess for the stack is how the memory has to be taken off in the reverse order it is put on (like a stack), whereas a heap can be accessed randomly without disrupting other pieces
>>
>>58743479
>Couldn't it just be "program memory" and "RAM"?
That makes no sense
>>
File: 1457010913355.png (46KB, 152x265px) Image search: [Google]
1457010913355.png
46KB, 152x265px
God fuckin damnit, I have so much troubles learning from books.
Is that a normal step ? I only began reading books related to programming recently and that shit is hard to really focus on. Most of them are boring and even the examples they use are boring.
Or am I just retarded and should accept it ?
>>
>>58743479

sounds like you learned about data structures first before learning how a computer works

dont worry i did the same thing
>>
>>58743619
You're typing words into a fucking computer, how exciting do you expect it to be?
>>
>>58743630
You're [spoiler]right[/spoiler]
>>
File: dumb question.png (8KB, 493x65px) Image search: [Google]
dumb question.png
8KB, 493x65px
Beginner CS student, was assigned to do this tonight. I understand everything but the character value part. Am I supposed to make a char just filled with ASCII characters from 33 - 126 or is there some C++ function I've overlooked? I know this is basic shit but the book this come from blows.
>>
File: P00175.jpg (95KB, 390x439px) Image search: [Google]
P00175.jpg
95KB, 390x439px
>>58743641
It's exciting when I understand the language I'm using and from where the errors might coming from. It's even more exciting if I like the project I'm working on.

But right now, I want to learn Spring MVC, the example are about some generic shit and when I code, I rarely manage to correct them.
>>
>>58743695
>But right now, I want to learn Spring MVC
Found the problem
>>
>>58740277
when you're working with large arrays of numeric values, like large matrices.

Any problem that can be expressed as matrix operations are easily done in array based languages.
>>
>>58743676
The character value is the character represented by the number, stop being a dumbass and think a bit more.
>>
>>58743676
Datatype char is just a number value from 0-255.
So just iterate char variable from 33 to 126 and print that.
>>
>>58743743
Dude I've been reading the chapter this comes from for like an hour now. There's nothing in the book about it and googling just gets me answers in C. It's not that I don't understand ASCII, it's just that as far as I can tell, C++ doesn't have anything that can get me the character represented by the number. That's what I don't know.
>>
>>58743676
>or is there some C++ function I've overlooked?
The answer to this is always "Yes"
>>
>>58743803
Store the ASCII characters in an array, then iterate through it.
>>
>>58743719
Why learning about the most used Java EE framework, would be a problem ?
>>
>>58743869
Because it's Java and you expect it not to be boring.
>>
>>58743842
>>58743802
Well see that's what I was thinking I might have to do but that sounded so ridiculous I wanted to ask people who had more experience than me. It just seems like there should be a better way than
char ASCII[] = {'!', '"', '#'}
>>
File: 1424380446087.gif (828KB, 200x189px) Image search: [Google]
1424380446087.gif
828KB, 200x189px
>>58742481
whoa
>>
>>58743915
There is a better way and I just told you what it was. Here you go, I've done your homework for you.

char c = 33;
for (c; c < 126; c++)
{
cout << dec << int(c) << hex << " " << int(hex) << int(c) << " " << oct << int(c) << " " << c << "\n";
}
>>
File: elbow.png (3KB, 640x480px) Image search: [Google]
elbow.png
3KB, 640x480px
>>58743925
we have picture of elbow macaroni pls join
>>
File: tumblr_nzu9xiCcFe1qg4ms7o2_1280.jpg (267KB, 1280x960px) Image search: [Google]
tumblr_nzu9xiCcFe1qg4ms7o2_1280.jpg
267KB, 1280x960px
Pythons are pets, not programming languages.
>>
>>58743948
oh
OH
Okay I misunderstood how fucking chars worked haha. Thanks anon.
>>
>>58744031
I wanna tread on that snek
>>
>>58744062
No prob m80, glad I could help.
>>
File: 1469583171814.png (350KB, 621x393px) Image search: [Google]
1469583171814.png
350KB, 621x393px
>>58743948
>char c = 33;
>for (c; c < 126; c++)
>>
is it niggerish to use smart pointers then pass them to functions using std::move()? it feels like it but it seems to work fine, what could go wrong?
>>
Any cool visual projects to suggest?

eg. 3D Raytracer
>>
A web app to stream all of my music from my server to my phone and laptop.
>>
File: pepe punching.png (123KB, 785x757px) Image search: [Google]
pepe punching.png
123KB, 785x757px
>forcibly being taught c++ for a uni course
>>
>>58741895
>You can do a mock-up of OOP in C like this
And you can take this shit very, very far, as long you don't mind giving up type safety for polymophism, Go-style. Just look at http://libcello.org/.
>>
>>58744269
Why not a 4D raytracer?
>>
>>58744307
>forcibly being taugh java for a uni course
>>
>>58742287
Why would you want that? Honest question.
>>
>>58744326
like at the end of interstellar?
>>
File: hello.png (2KB, 188x108px) Image search: [Google]
hello.png
2KB, 188x108px
>>58744328
>forcibly being taught Hoon for an antiversity course
>>
File: test.webm (725KB, 500x500px) Image search: [Google]
test.webm
725KB, 500x500px
A U T I S M
>>
>>58744261
No, they're meant to be moved if possible. Unique pointers can ONLY be moved, and moving a shared pointer won't touch the reference count (which means no atomic operation).
>>
>>58744326
It hard to debug visually, for one thing.
>>
>>58744183
I expected to get shit for that
I know I could have either done for(;c < 126;c++) or for(char c = 33; c < 126; c++), I just didn't care. Sue me.

Look, I buggered up here as well, do you want to comment that as well
>dec << int(c) << hex << " " << int(hex)
>>
File: 8068-15562.gif (48KB, 320x240px) Image search: [Google]
8068-15562.gif
48KB, 320x240px
>>58744404
Then debug it aurally.
>>
>>58741211
>>58742470
I want to get a CS degree in uni

Problem is I don't even know how to code yet
>>
>>58744492
You won't know after you graduate, so that's not a problem.
>>
>>58744492
Learn how to code, then.
>>
can someone tell me why clang 3.8.256229 puts variable names in the shared library on -O3 (not on -O2)?
>>
>>58744527
>you won't know after you graduate
what do you mean?

that I shouldn't be doing what I don't enjoy?

>>58744528
i am slowly learning
>>
>>58744684
it's compiling with clang and linking with gcc (i'm using android ndk)

if i use the gcc toolchain i don't have this problem

compiler flags:
-O3 -Wall -D__ANDROID__ -fvisibility=hidden -Wl,-s -Wno-sometimes-uninitialized -Wno-maybe-uninitialized -Wno-unknown-warning-option -Wno-unknown-attributes -fdata-sections -ffunction-sections -fno-exceptions -fno-unwind-tables -Wl,--gc-sections -std=gnu++11 -fno-rtti

linker flags:
-O5 -Wl,--gc-sections -Wl,-s
>>
File: 1454458646875.png (115KB, 850x800px) Image search: [Google]
1454458646875.png
115KB, 850x800px
>>58744693
>what do you mean?
He means that CS college graduates rarely get out of college knowing how to program.
>>
What should I do if I never discovered a passion for coding and am even failing python courses due to lack of motivation?

Should I just drop out?
>>
>>58744718
well that's true i guess
>>
>>58744720
What will you do when you drop out? Do you enjoy anything else?
>>
>>58744739
That's the whole problem here.

I don't really enjoy anything else.

I've tried chemistry before but all the cuckery and the thought of staying in a lab forever kills me
>>
>>58744720
if you think python 101 is bad you're in for a world of hurt when you get into real programming.
>>
>>58744760
I'm doing OOP python right now.

I guess I just need to drop out of CS
>>
>>58744756
As opposed to the Indiana-Jonesesque adventures you'll experience programming.
>>
>>58744777
haha

maybe i'm just being a pussy, but i'm probably depressed

the uni life in canada really sucks man
>>
>>58744784
Petition to start an alt-right club in your university. Things will get much more exciting for you then I promise.
>>
>>58744804
i'm asian myself so starting alt-right might not go so well

i was born here and everything but i look like a skinny kpop fag so everyone treats me like a dirty international student
>>
>>58744769
Have you ever programmed anything of your own volition? Or any real world products? Or has it all been course work? Because university coursework, especially the lower levels, is mostly stupid, boring shit that usually isn't in any sort of real world context.
>>
>>58744819
not really except stupid little games
>>
>>58744756
Nothing out of ordinary, most people feel like that, but don't drop out if you don't have a better plan. And you will most likely regret it in future.

So study now, be depressed whenever, just not while you study.
>>
>>58744853
I know plenty of people, especially business majors, who switch into computing science way late into their third year

Right now I'm on academic warning and need to boost my GPA so I'm pretty much fucked.
>>
>>58744853
>Nothing out of ordinary, most people feel like that, but don't drop out if you don't have a better plan. And you will most likely regret it in future.
I can't just drop out right now.

I have to boost my GPA up for the winter term
>>
>>58744812
Wear a Ronald Reagan mask?
>>
>>58743676
What book, Anon?
>>
>>58744890
Alright, you seem to know what you need to do, so get on it.
>>
>>58744826
I never programmed before college, and I was CE. If you're interested in it stay in. Otherwise might as well find something else to do.
>>
>>58744924
At the same time I'm trying to wonder if I should keep my options by taking Python.

I am taking the "easy" courses like linear algebra, stats, and soc, but just feel really anxious because my GPA force me to withdraw

I even have friends who are helping me out, but I still feel really stressed and anxious. We could make a good connection but I'm just really mentally scarred right now.

>>58744931
Problem is I don't fucking know anything else to do, it's already been 2 years of me trying out a bunch of courses
>>
I finished programming Tic Tac Toe using C# and WPF.
Learning how commands work was ass.
Learning how to procedurally generate Buttons with databinding to the model was ass.
Figuring out how databinding worked in the tree was ass.

I'm also pretty confident that I'm not doing MVVM properly 'cause it's hard to figure out what goes in the model as opposed to the viewmodel.
>>
>>58744978
You're not alone, this is why some people don't finish college. It happens.
>>
>>58744931
Are you a brainlet?

Isn't it torture trying to get through without interest?
>>
>>58745050
What did he mean by this?
>>
>>58745048
I know, problem is I can't just drop out right now!

It really sucks being in a python algorithms class with freshmen straight out of high school, thinking they know everything
>>
File: tumblr_nrav7uUXCW1s9amz4o4_1280.jpg (525KB, 1280x960px) Image search: [Google]
tumblr_nrav7uUXCW1s9amz4o4_1280.jpg
525KB, 1280x960px
>>58745075
Pythons make good snakes, but poor programming languages.
>>
>>58745075
Can't you just not go? I don't know how colleges work in Canada, but where I'm from, we can just not show up.
>>
>>58744720
python is shit so maybe it's just that, but you need to be interested in programming or your degree will be a total waste
>>
Somebody who can learn me php ? (email: [email protected])
>>
neural networks and genetic algorithms look fun and interesting as fuc but I'm afraid I'm too garbage at programming to take a crack at it

What are some skills one should know before tackling heuristics?
>>
>>58745120
My prof is a total egotistic douche. He's seen as "better" by the normies

he gave me shit for not closing the lecture door on first day

never replied my emails about switching lab sections

always smirks at me in class because i look dumbfounded or something, well it's a fucking 9am class

Yes I can just not go to class, but apparently there are in-class quizzes
>>
Help me somebody with php ? ([email protected])
>>
>>58745131
b-but muh jobs!
>>
Anyone here who got into CS just for the memes?

Discrete math actually interests me, but I'm too depressed and unmotivated to try to study. not to mention bad time management skills
>>
>>58740298
After having come from Hibike, this show is a major step down for KyoAni.

I wouldn't watch it. Personally dropped it after first episode.
>>
>>58745217
if you think a job as a code monkey will motivate you or make you like programming you are in for a shocker
>>
>>58745308
i know that's exactly what i hated about the idea of computing science, but look where i am here now

maybe i should just drop out of uni, but i have nothing else better to do either

an advisor told me to go for arts or something because i have better marks there, but fuck man wtf lmao
>>
File: 1426548231392.png (141KB, 800x600px) Image search: [Google]
1426548231392.png
141KB, 800x600px
>>58745217
you still need some level of interest to get a decent job and you need to be passionate about programming to really git gud
>>
>>58745320
shit i need to drop out then.

problem is that other things i'm interested are pretty useless or have a bad career forecast

i want to be come an audio engineer but the industry is pretty unstable

i have my own skills but it just bothers me
>>
>>58745316
Don't go into further debt for classes that won't even get you a job at starbucks
>>
>>58745401
i'm in a real shitty situation man.
>>
What's the best way to compare really long strings? Binary search?
>>
>>58745466
Disregard this, I just might be retarded.
>>
File: linkin-park.jpg (113KB, 381x500px) Image search: [Google]
linkin-park.jpg
113KB, 381x500px
>>58744784
>>58744812

you sound emo to me. try listening to linkin park
>>
>>58745550
emo is so 2010s man.
>>
>>58745495
Favorite post
>>
Somebody on learning php with me ? ([email protected]) #((Inse))
>>
>>58745156
Implementing neural networks from scratch is something people generally do for practice and deeper understanding, which we have found is not strictly necessary.
Take the Coursera course on Machine Learning, dick around with Nvidia DIGITS, Tensorflow, or Theano and see where it takes you.
>>
>>58745466
lel
bitches never heard of my radix trees and finite state machines
>>
How do I get into programming? Learning C# with Bob Tabor on MSVA right now. Not far in because im afraid it'll get super complicated. Just finished if statements. Any useful tips?
>>
Did any brainlets get into CS and suddenly spark an interest in programming?

The thought of sitting in a computer all day just depresses me, but muh jobs
>>
File: .png (108KB, 1053x587px) Image search: [Google]
.png
108KB, 1053x587px
I made a script that converts files to base64 and puts the data in the alpha of an image.
>>
>>58745693
I've been interested in programming for over 3 years now, but have never been able to make anything beyond a trivial console application all because of my chronic lack of motivation, discipline and dedication. I'm about 3 weeks into my intro to cs class and I've just about doubled the amount of actual, original code I've written (so I'm not counting all the tutorials I've followed) and when you sit down and finally figure out the solution to your task it gives you this emotional high really similar to when you finally understand something in math and it call clicks perfectly. The class is forcing me to actually program on my own and I'm loving it so far. Just my two cents
>>
>>58745693
Yeah. I can sit for hours it I enjoy and am interested in what I'm doing and I didn't start programming until uni. My work atm though is mainly SQL and excel and it's pretty painfully boring.
>>
>>58745776
What does it look like when an image already has an alpha?
>>
>>58745893
It sets the alpha to whatever it needs to be per pixel until it runs out of data.
It doesn't do anything fancy.
>>
>>58745856
>cs class
>original code
n1 m80
>>
>>58741935
killing yourself > not killing yourself
>>
>>58745933
By "original" I mean simply not mindlessly copying a tutorial and actually being forced to produce it on my own, even if it is a carbon copy of what every other student ends up with as well
>>
File: .png (18KB, 645x172px) Image search: [Google]
.png
18KB, 645x172px
>>58745893
>>
File: 1397489161506.png (67KB, 578x547px) Image search: [Google]
1397489161506.png
67KB, 578x547px
What hipster language should I program my gaymen engine in, /dpt/?
>>
>>58746001
Maple
>>
At the moment I am writing a bot for a game for personal use. I've always wanted to write something like that and there is a good amount of fun challenges that suit my low programming power level. By the way can someone suggest a good read on image processing? There is a large region of screen where a short string may appear and I want to crop it in a way that the resulting image contains the whole string with minimum amount of noise for OCR, but I know next to nothing about either character recognition or image processing.
>>
>>58746001
FORTRAN77
>>
>>58746001
Elm.
>>
>>58746001
Oak
>>
>>58746058
>>58746076
Birch?
>>
>>58746026
If all you want to do is detect the fact that text is present on the screen, you're probably looking for a fully convolutional neural network.
A CNN will build up layers of features (edges -> curvatures -> letters) in a fixed region. A fully convolutional neural network applies this logic in an unfixed region, so it's possible for the search area to grow.
The idea is that you want to sort for symbols that look like letters. You can also take it a step further and actually classify the letters. Problem with this is that it will be overly specific to a particular character set. Letter-like symbols are a broader goal and as such, are more flexible.
>>
>>58740298
>>58745303
Name of show?
>>
>>58746120
Try looking at the image?
>>
>>58746120
小林さんちのメイドラゴン
>>
>>58746120
Boku no meido
>>
>>58746111
Incidentally, character OCR is something of a hello world in neural networks. It's possible to do it with just a one layer perceptron, but it's not at all flexible. Which is why I suggested a CNN.
>>
>>58746144
Oh, that's the actual name of the show. Thanks.
>>
>>58746162
>>58746026
Is that how most game bots are written? Take a screenshot of the screen every frame and then analyze it with a neural network?
>>
babbies first project on fcc
>>
>>58742153
lol not simply not being able to develop fast in python, learn to code please.
>>
>>58746233
No. It really depends on the game and what the bot is doing though.
I remember some of the older, more primitive bots on Runescape which botted for resource gathering would search the screen for certain colours and click it, and constantly rotate the camera.
>>
>>58745320

Is there a stupid-easy answer to this one, like there is for this one?

>>58744718


void PrintX(int SizeOfX)
{
int Counter;
int TextPosition;

for(Counter=0; Counter<SizeOfX; Counter++)
{
for(TextPosition=0; TextPosition<SizeOfX; TextPosition++)
{
if(TextPosition==Counter}
{
printf(“*”);
}

else if(TextPosition==SizeOfX-1-Counter}
{
printf(“*”);
TextPosition = SizeOfX; // No spaces needed after 2nd Asterisk.
}

else
{
printf(“ “);
}
}

printf(“\n”);
}
}
>>
>>58746233
Most popular WoW bot for a while used the allowed addon system to display sequences of colors based on the game state and the bot would read that. Way more straightforward.
>>
>>58746233
>>58746278
If the bot has access to all client-side information, which can be obtained by reading memory dumps, why can't they just trawl through memory and the piles of strings for what they're looking for?
>>
>>58744718
>He means that CS college graduates rarely get out of college knowing how to program.
American education
>>
>>58746276
Yes, there is.
Notice that your output consists of a N x N matrix.
Using this, we can populate the diagonals with 1's and simply print the matrix to the screen. If you enjoy rice, it's a simple matter to replace the 1's with the character of your choice.
You could program this in something like 5 lines in MATLAB.
>>
>>58746407
I'm from Europe and it's same here.

There can only be so much variety in problems they give out to program on exams. A lot of students slip through cracks without really understanding anything.
>>
File: Screenshot_2017-02-01-16-58-53.png (102KB, 1080x1920px) Image search: [Google]
Screenshot_2017-02-01-16-58-53.png
102KB, 1080x1920px
What's the point of a concreteDecorator?
>>
>>58746521
Don't fall for the """Design Patterns""" meme.
Don't fall for the OOP meme.
>>
>>58746525
Well i need to learn OOP to get a gig outside of embedded and web dev-ing realistically
>>
>>58746381
I don't remember, it was a long time ago.
https://www.youtube.com/watch?v=EnmoI2dRwX4
They look like mac fags too.
>>
I have a question /g/, incoming long-winded post. I'm (attempting) to teach myself C++, working through Programming Principles and Practices using C++ by Bjarne Stroustrup, and I try to do all of the exercises and drills I come across. I came across one earlier today that read-
The character 'b' is char('a'+ 1), 'c' is char('a'+ 2), etc. Use a loop to write out a table of characters with their corresponding integer values:
a = 97, b = 98, c = 99 ...... z = 122"

So some reference, It's a question in the middle of chapter 4, which is barely even into the meat of the book. The book just taught me while loops, and I read forward when I couldn't figure it out, and for loops are next. Now I did some searching and found someone who had posted code that works, however there are parts of it that I don't understand why or how it works. I'll post it below, but basically if someone could just break down each part and explain what it's doing to me like I'm an idiot, I'd appreciate it.

char ch = 'a';
for (int i = 0; i < 26; ++i)
cout << (char)(ch + i) << " " << (ch + i) << endl;
>>
>>58746521
To make your concrete look pretty, obviously.
>>
>>58746610
>char ch = 'a'
Sets ch to 'a', or value 97 in ASCII table. It literally has a value of 97 in binary but because it's a character, when you print it out with cout it knows that it's a character and prints out corresponding ASCII value.

>for (int i = 0; i < 26; ++i)
For loop that goes from i = 0, to i = 25, ++i increments i by one through each iteration. It repeats code below until i < 26 is no longer valid.

>cout << (char)(ch + i) << " " << (ch + i) << endl;
>(ch + i)
Value of ch was set to 'a' (97) on first line, and now we add i to it. Through first iteration, i will be 0 and 97 + 0 = 97. So that leaves us with 'a' again. Second iteration we'll have 'a' + 1 or 97 + 1 = 98 which is 'b'.

>cout << (char)(ch + i)
Now because you're adding character and integer, you do cast to (char) so it prints out the character

>cout << (ch + i)
And this prints out the integer

There you go, a very anal look at those 3 lines of code
>>
>>58746610

When you're dealing with a "char" variable, each letter is actually represented by a number inside the computer. Look up "ASCII Table" to see what each one equals. Thus, if you have a particular value stored in that char like, say, 'h', you can write:

cout << h + 1

To output 'i', because it's taking h's ASCII value, and is adding 1 to it. So, in the example, you starting a counter at 0 and are using it as an offset from the letter 'a' as you count up through the alphabet. At the same time, you are also printing the value of that counter next to the letter that it pulls up when being used as an offset.

Also, that (char)(ch + 1) line uses something called "typecasting." It just makes sure that the value stored in ch is printed as a letter and not as a number.
>>
Hi guys, I haven't heard of anything, but, has C any way of playing music or displaying pictures?
>>
if (digit(romanval[i]) 2)
Is this a correct syntax for an if statement or is it missing something like a equals? This was written in C
>>
>>58746738
https://en.wikipedia.org/wiki/Simple_DirectMedia_Layer
>>
>>58746742
I think it would be like
if(digit(romanval[i])==2)
>>
>>58746738
C is capable to do everything if specific library is provided.

>>58746742
What are you even want to state?
>>
>>58746738

C as a language just sees raw data and does things with it. People write code to manipulate that data in such a way that the right information is sent to devices like speakers and screens to produce music and pictures with it. Since doing this for everything yourself would be incredibly time-consuming and pointless, people write "libraries" (pre-compiled code) full of functions with which you can do these things.
>>
>>58746767
Libraries like SDML as stated before?
So, I download the library and work with it, right?
>>
>>58746704
Thank you for this. The part that was tripping me up was the (char)(ch + i) bit, and you cleared that up pretty well. So the (char) part- putting (char) tells it to print the next bit in the corresponding character, not a number, correct? If so, geez, he didn't go over any of this in the book, how the heck was I supposed to know that? ASCII hasn't even been mentioned yet either.
>>58746738
Thank you
>>
>>58746767
>C as a language just sees raw data
I wonder, what languages don't just see raw data?
>>
>>58746765
I''m just comparing code for how to convert from roman numeral to decimal. The first link was by an indian and I didn't get some of his code and it seemed like it wouldn't work
    char romanval[1000];

int i = 0;

long int number = 0;



printf("Enter roman num (Valid digits are I, V, X, L, C, D, M):\n");

scanf("%s", romanval);

while (romanval[i])

{

if (digit(romanval[i]) 2)

{

if (digit(romanval[i]) = digit(romanval[i+1]))

number = number + digit(romanval[i]);

else

{

number = number + (digit(romanval[i + 1]) -

digit(romanval[i]));

i++;

}

i++;

}

printf("Its decimal value is : %ld", number);

return 0;

}
The digit function is just a switch case for the number value of each roman char
>>
How can I check if each element of a std::list is equal in C++?
>>
Guys, I can't understand how the rand function of C's stdlib works. I have looked in the Internet, but can't find what I'm looking for. For example, if I want to generate an integer between 0 and 10, how do I do it?
>>
>>58746806
Scripting languages.
>>
File: thinking_hotaru.png (372KB, 954x768px) Image search: [Google]
thinking_hotaru.png
372KB, 954x768px
>>58746811
Do you literally not know how to count?
>>
New thread:

>>58746848
>>58746848
>>58746848
>>
>>58746844
No, I don't. Is there a standard library function to do it for me?
>>
>>58746786

Assuming you're done learning C, yeah, the next step is to just familiarize yourself with libraries like that. You should be able to understand the documentation and header files associated those kinds of libraries if you understand the language. If you want a deeper understanding of the how people do things like that with the language, you can also often find the source for the library and see how they implemented things. That might be a bit overwhelming if you're just looking to get used to using the language for things more advanced than outputting text though.
>>
>>58746871
Yes it's called "brain" for regular people. But it seems that that package haven't been installed for you. I suggest you rectify that immediately
>>
>>58746894
PROTIP: if you're going to try to insult someone, don't have grammatical errors in your post. Especially if you're trying to say they don't have a brain.
>>
>>58746804
>So the (char) part- putting (char) tells it to print the next bit in the corresponding character, not a number, correct?
Yes, it's called typecasting as >>58746729 said and you use it to convert from one type to another.
It's done because it can only add values of same type.
Char takes up 1 byte in memory and integer depends on the system, but let's say 4 bytes.
Now because integer is bigger, ch + i first implicitly converts char to integer. Only now it can sum those two.
But because ch got implicitly converted to integer, the result of adding two integers is an integer, so now you need to bring it back to char so it prints out the character.
>>
>>58746812
rand() % (max_number + 1 - minimum_number) + minimum_number
?
If you're leaving it at 0 then I think it's just
rand()% 11
>>
>>58746111
>If all you want to do is detect the fact that text is present on the screen
I said that a string may appear, but "may" was a wrong choice of word. I know that string is there and I even know what that string is.
All I want to do is to determine the character position on the screen and I want to use its name that I can make appear on the screen at any moment as a cue. Since the camera may move with respect to last character displacement and map borders, character may appear at any point within a certain region of the screen. I also need to confirm that the string I found matches target character's name since there can be more than one character in the target region with name above it when I toggle show character names option.
I though that maybe if I apply some function to the snapshot of the region that will filter out everything that is not white with blurred black outline, which is hallmark of the font used to draw character names, that would be enough, but I have no idea where to start. I would like to see a list of common methods used to preprocess images for OCR.
I googled a bit and found a blog entry where a guy did something similar:
http://www.danvk.org/2015/01/07/finding-blocks-of-text-in-an-image-using-python-opencv-and-numpy.html
>>58746233
Some game bots do nothing more than search for a pixel of a specific color and click it.
>>
>>58746610
Adding to the other anons post, the author uses the <iostream> header (which has the cout function), and because cout is hilariously inconsistent and unclear, to print a char type as actually ascii you need to cast it into a char type in cout, because it is a number really so cout prints its ascii index.

What you should honestly get in the habit of using is printf() instead, which is in the <stdio.h> header (the .h is because it is a C header) because you can specify the exact type you want the output to be without doing any stupid casting.
>>
>>58746962
>because you can specify the exact type you want the output
That's not the only reason to use stdio. Better syntax, better performance, easier to internationalise, etc.
C++ iostreams are just fucking retarded (as is the whole language, really)
>>
>>58746985
C++ is only retarded if you hate freedom. Do you hate freedom?
>>
>>58747036
>C++ is about freedom.
Sure, anon.
You have the freedom to make bad decisions.
>>
>>58746985
>easier to internationalise
Especially this.
>>
>>58747057
And the freedom to make great ones. Isn't that what it's all about?
>>
>>58746894
>/g/ humor
kill yourself autist
>>
>>58747107
C++ is not a "great decision" any way you could look at it.
It's absolute garbage.
Go learn a "good" language and get some fucking taste.
>>
>>58747118
What's a good language faggot?
>>
>>58747127
C.
It has an elegance and clean design that other languages just don't have.
>>
>>58747136
Exactly what I thought you'd say.
>>
>>58747140
Does that make it wrong?
>>
>>58747190
No, anon, it makes you a faggot.
>>
>>58747197
I hardly think a sepplesfag of all people has the right to try talking down on others.
You can keep playing in your cesspool.
>>
>>58742489
why rust of all languages
>>
>>58745320
r8 pls, im only 7¼ yo btw
    public static void printX(int l) {
char[][] a = new char[l][l];

for(int i = 0; i < l; i++) {
Arrays.fill(a[i], ' ');
a[i][i] = '*';
a[i][l-i-1] = '*';
System.out.println(new String(a[i]));
}
}
>>
>>58741884
im also worried, im not used to winning this much
>>
>>58744812
start lifting
Thread posts: 335
Thread images: 49


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