[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: 320
Thread images: 29

File: himegoto2.webm (3MB, 854x480px) Image search: [Google]
himegoto2.webm
3MB, 854x480px
old thread: >>55760118

What are you working on, /g/?
>>
Having "fun" with monads and zippers.
>>
>>55767074
I want to remove her cute shoes and tickle her feet :3
>>
first for C++
>>
>>55767092
interestingly zippers are comonads
>>
>>55767115
Check your pronouns, shitlord.
>>
>>55767211
They're monads as well.
>>
Im making a text based game in vs2015, c++.

How do I output unicode block such as:



?

It would be to visually display stats/health bar but I've heard conflicting information about implementation.
>>
>>55767331
Gee I don't fucking know let's try googling "unicode output c++".

http://stackoverflow.com/questions/12015571/how-to-print-unicode-character-in-c

Oh look there it is.
>>
>>55767331
>unicode console output
not necessarily portable
>>
File: rick_giphy.gif (2MB, 902x695px) Image search: [Google]
rick_giphy.gif
2MB, 902x695px
>>55767331
Just DONT
its absolutely the most retarded project
At least go for a fucking GUI
It takes 2-3 days to get some understanding of Qt and make few windows with the text shown, maybe some background image for it.. buttons for next and previous scene, additional stuff
and doint that you are actually learning

doing text base game... your are just wasting time and you learn nothing
>>
>>55767407
>reddit.gif
>stupid post

Not surprising.
>>
>>55767407
I agree with this completely, assuming you're set on C++.

Something like that would be more comfy to write in C#, though.
>>
>>55767439
What makes it a reddit gif?
What makes it a stupid post?

did you learn a lot writing if/else text based games
>>
C and c++ gets so much flak in this board

c# any good?
>>
Look at my elegant numerical integration method:

numIntegral :: (Double -> Double) -> Double -> Double -> Double
numIntegral f a b = (b-a)* (mean [ (f x) | x <- list ])
where list = linspace a b (100000)


Does anyone have good ideas like this to work on?

Right now I've been doing stuff like making a simple ODE/SDE solver, numerical integration in a variety of languages.
>>
>>55767407
well I've been making a couple different projects to refresh my memory.

I've actually learned quite a bit making this project.
>>
>>55767477
No, do C or C++

>>55767497
[ f x | x <- list ]
f <$> list

You should generalise this so it doesn't just work on doubles
>>
>>55767477
>c# any good?
Depends on what you're doing.

Yes, C# is a good language. It's got tons of support and it's much easier to go from nothing to a working thing.

It's silly to compare it to C, though.
>>
Is the transition from Python to Java a good idea? Looking for my next programming language to be something actually good
>>
>>55767571
>Python to Java
>looking for a good language
I like this shitpost
Very nice
>>
>>55767571
What projects you made in Python?
What projects you want to make in Java?

the fact that you have no idea what to do after learning some syntax does not change with more languges
>>
>>55767571
>something actually good
>Java

It's like you want to be bullied here on purpose.
>>
>>55767516
>[ f x | x <- list ]
>f <$> list
Very nice, just changed that.

Also I might generalise this to Num a but for this module, everything is in doubles.
>>
>>55767571
what's wrong with python?
>>
>>55767477
What you use C# for is completely different than what you use C and C++ for
>>
>>55767690
It's a girl language
>>
File: 44891599_p0.jpg (132KB, 760x1044px) Image search: [Google]
44891599_p0.jpg
132KB, 760x1044px
What would a database schema for an imageboard look like?
>>
>>55767653
<$> is fmap
>>
>>55767729
I did not know that.

You got any other interesting ideas for me to program in Haskell?

I was thinking about a function that does a line integral or something.
>>
File: forumschema.png (45KB, 631x724px) Image search: [Google]
forumschema.png
45KB, 631x724px
>>55767711
>>
>>55767711
board -> thread -> reply
>>
>>55767407
This. He could even keep it "text" based in the sense that he would make a GUI to manage stuff like inventory, abilities and such and a main canvas to paint "text characters" for the map.
>>
>>55767766 > >>55767750
>>
>>55767750
>>55767766
so...

board containing all the current thread IDs
a table for every thread containing replies and text, image locations?
>>
File: 1449724285095.jpg (32KB, 414x656px) Image search: [Google]
1449724285095.jpg
32KB, 414x656px
>>55767700
What do people use C# for?
>>
>>55767830
>a table for every thread
Anon...
>>
>>55767601
I want to get in to mobile app development, what other languages do you suggest for that?
>>
>>55767477
C# = Microsoft Java

It's good if you want to work in a low skill .Net shop.
>>
>>55767843
what?
>>
>>55767832
Pretty much everything that isn't a driver.
>>
>>55767849
For that you could go with Java, or possibly even Java.
>>
>>55767708
so you can't think of anything?
>>
>>55767832
cuddling
>>
>>55767862
Please go research relational database design basics.

If you thing you need a table for each thread, you clearly don't even understand the basics.
>>
>>55767192
C++ is almost like another brainfuck

people think it's just another programming language like others, but it's an unusable monstrosity for autists

just a friendly warning
>>
>>55767886
C++ was a mistake.
>>
>>55767880
Where do I look this up?
>>
>>55767092
Editor, font, color scheme please?

Thanks, it just looks comfy i had to ask
>>
File: JUST.jpg (71KB, 680x659px) Image search: [Google]
JUST.jpg
71KB, 680x659px
>Program compiles and runs perfectly fine in g++ and clang++
>doesn't compile in VC++
>dumb it down for that retard
>still compiles and runs perfectly in all normal compilers
>compiles in VC++ but fails in some completely undebuggable way

Can't I just debug programs compiled in a normal compiler in VS instead of having to use this braindead compiler just to have a good debugger?
>>
>>55767746
Type checker for simply-typed lambda calculus. Then build on top of that, polymorphism, naturals, inductive types, etc.
>>
>>55767886
in terms of real life usability, creativity and performance (speed and size-wise) what is something close to C++ ?

Python is out of the way for sure, is
>Swift
>Objective C
>or Rust

Any good ?
>>
>>55767924
>lambda calculus

Never looked into this. Sounds like something that'll keep me busy for the coming few weeks.
>>
>>55767746
this >>55767924


>>55767849
swift, iphones
avoid android & java like the plague
>>
>>55767914
(Neo)Vim in uxterm, font Consolas. colorscheme is zellner, but I think it's a bit fucked up in the console so it might look different in gvim.
>>
>>55767910

Intro to database design:

http://www.datanamic.com/support/lt-dez005-introduction-db-modeling.html

Once you've levelled up in that, here's a comprehensive guide to indexes:

http://use-the-index-luke.com/
>>
>>55767944
it's extremely simple

imagine if haskell had no values or types, just:

applications
lambdas
variables

data Λ a = Var a | Abs a (Λ a) | App (Λ a) (Λ a)
>>
File: shyanimegirl.jpg (98KB, 500x528px) Image search: [Google]
shyanimegirl.jpg
98KB, 500x528px
Is there an alternative to QT?
>>
>>55767994
ncurses
>>
>>55767922
>Program doesn't just compile and run in Visual Studio or any other IDE, have to manually compile it using "g++ -std=c++14 main.cpp -lpthread"

>Put that as a top comment of the file, send it to a fellow student, and remind him one more time at the end that it wont just compile at any of the IDE's, even the online ones, but it functionallity is what it should be, and it's matter of time to fix it and make it work, its just a temporary solution for a bigger project...

>The retard never saw any of the comments, just straight forward told me "It does not compile, please consider to debug your code before sending it, you are slowing down the group project"

I am learning a lot about programming, and stuff at the university but I never knew there is so many retarded people in this field
>>
>>55767994
Motif
>>
>>55768035
He very well saw that comment, Anon.
>>
>>55767994
wx, fltk, nuklear
>>
>>55767843
alright, so it would be more like
a table for all boards, a table for all threads, and a table for all comments?
>>
>>55768072
Yes, exactly.

There are obviously other considerations (information for IPs, Mods/Admins, metadata, etc.), but that would be the basic gist of it.
>>
>>55767074
Stumbled onto a non-deterministic bug. Now trying to figure out how to fix it. Also started drinking some Guiness.
>>
>>55767994
Yeah there are a few but all of them are objectively inferior. I'm not saying Qt is perfect though it's just that the alternatives don't cut it.
>>
Stumbled onto a compiler bug. Also started doing heroin.
>>
>>55767708
But you're on /g/ so you (presumably) want to be a girl-boy!
>>
which one is thread safe?

version A
ArrayList<Dogger> database = new ArrayList<Dogger>();
Dogger pupper= new Dogger("pupper");
database.add(pupper);


ArrayList<Dogger> database = new ArrayList<Dogger>();
database.add(new Dogger("pupper"));
>>
>>55768061
With my code alone, the project was done, we had 3 more months, I could of fix it in 1 day or less. The end result was way way way worse.
It did compile, and all, but the final functionality was never achieved, there was many bugs... the guy was retarded normie that never stopped to talk about his dad working for a big company downtown and how after the end of the semester he is going there as intern... I never saw him again, I think he quit or transfered or somethign
>>
Stumbled over a bug. Also, I think it was doing PCP.
>>
>>55767994
WXWidgets
>>
>>55768142
forgot to say, the latter is version B
>>
>>55768142
neither
>>
>>55767949
thanks
>>
>>55768142
>calling a simple object in your code a 'database'
>>
>>55768072
One table is enough for threads and posts combined.
>>
>>55768161
Good that you cleared it up.
>>
>>55767974
You got any good books/pdfs/youtube vids on this?
>>
I want to do a project that puts ciphers in photos using c.

So how do I open up a photo and change the rgb in c? also I would like to create new images as well.
>>
>>55768189
No, that's dumb, and you should feel bad.
>>
>>55768189
So I add a column, isOP?
>>
>>55768217
Why? OPs are just posts as any other, it's also much more flexible.

>>55768224
Something like that, or 'parent' and have that point to the OP for regular posts and NULL for OPs.
>>
>>55767932
java and c# are almost pythons in their productivity compared to c++
>>
>>55768224
Yes, just violate the second normal form.

Surely this will not cause performance or conceptualization issues later :^)

>>55768189
End your life.
>>
>>55768254
comment posts cannot be promoted to OP, and if an OP is pruned, so are it's child posts, so why bother?

an OP is not a comment.
>>
>>55768256
>muh normal forms
Your literally worse than OOP and hasklelfags combined
>>
The App I am developing is pretty simple, it just needs to register the inventory items and items sold of a Shop.

The Inventory part is pretty much done, since it's basically a CRUD.

Whenever the User is registering a new Sale, he should be able to pick the items and the quantity of each item sold. To do this, I create a screen like this. It's basically a RecyclerView that shows the item name and a SeekBar where the user can select it's quantity.

To solve the "knowing how many of each item was sold" problem I thought about, for each time the user interacts with the SeekBar, adding or removing an from the Purchase Item's list. For example, if the User registers that he sold 5 Apples, the list would be filled five times with the same Apple object.

But, doing this would make it really hard to restore the items when the User is editing a Sale. I actually don't even know how to do this.

Could someone help me figure out a better solution for this problem?
>>
>>55768035
Did you all agree on what you're group is going to develop on? If not you're asking for trouble. If they all are using an iDE you should also.
>>
>>55768254
And then you cannot store facts about the thread itself without tying them to every single post within the thread, such as whether a thread is a sticky. Even if you only include the information in the OP post, it still allocates storage for the other posts, with some caveats.

1000 posts = 1000 extra bits denoting whether or not the thread is a sticky.

Kill yourself.

t. An actual database architect.
>>
>>55768295
There's a reason why basically every single relational database meets 3NF. 4th and 5th are just wankery, but 3NF is crucial to not repeat data.
>>
>>55768305
>t. An actual database architect.
keep telling you're self that
>>
>>55767946
why is swift better than java? whats wrong with developing for android?
>>
>>55768358
I can tell you have no experience with Java or Android
>>
>>55768374
I don't which is the reason why I'm asking. Please elaborate.
>>
So this is the basic gist of what an imageboard database would look like?
>>
>>55768392
Yes, but obviously you're missing tons of information, such as timestamps.

You'll need something like a table for known IP addresses so you can do things like IP ban, etc.
>>
>>55768420
it's just the basic gist
also, can I just hash their IP so I can ban them without knowing their IPs?
>>
I have N pokemon(s), and it costs "COST" candies to evolve one. I have M candies, and I can sell a pokemon for "SELL" candies. I want to sell enough pokemon to evolve the highest amount of pokemon left.

Basically I have to optimise M/COST while keeping it >= N, but I can subtract from N to get more candies. Hopefully this makes sense
>>
>>55768434
You mean without storing their IPs, you're going to have to have the IP in order to hash it.
You could do so, but you may want to rangeban.
>>
>>55768305
>t. An actual database architect.

Fancy title, CRUDlord.
>>
>>55768305
What I do is make replies child documents of threads. OP is a child of the thread like any other. NoSQL of course.
>>
I think I've figured out markov chains.Correct me if I'm wrong.

For a set of states a markov chain records the probability that a state will change to a different state.
>>
>>55768553
Exactly.
>>
>>55768553
Now implement it in Prolog
>>
>>55768464
I guess I could make a unique_users table that holds every unique IP address that posts here along with an identifier to mark all their posts in the comments and threads tables.

I could also add an is_banned flag.
>>
>>55767932
Go.
>>
>>55768455
Sounds like the pokemons you should sell have a high sell price and a high evolution price. The pokemons you should evolve have a low asking price and a low sell price.

Sort the pokemans high to low by CostToEvolve+SellPrice. Sell the tail end of the sorted list one by one while evolving the front end one by one.
>>
>>55767074
When/how did the Himegoto meme begin?
>>
question from the previous thread for
>>55765872

Pardon the noob question here, but can you elaborate on what you mean by guide to the programmer? Would you be talking about things like mutators/accessors, and safe pointers like the 'this' keyword by chance?
>>
>>55768455
Take into consideration that you get an extra candy per evolution.
>>
huffman tree creator with GUI

saw it some days ago being done on a twitch stream[spoiler][/spoiler] and I wanted to do it myself

am I the only one writing comments for myself which are funny only to realized how stupid they are and how I'll not be able to tell what the code does so I write "serious"-verbose comments
>>
>>55768672
i think it was this thread
https://rbt.asia/g/thread/S51640760
>>
Is it really a bad idea for a beginner programmer to start from SICP+Scheme then move on to C? People are saying these are outdated and useless languages, but then others say this is a solid path that gives a strong understanding of the fundamentals. Looking for opinions here!
>>
File: Hd7obYs.png (33KB, 662x492px) Image search: [Google]
Hd7obYs.png
33KB, 662x492px
So my database for a very simplistic Shop management looks like picture related.
My currently problem is, I need to keep track of each item sold in each purchase. To do this I could add a "Quantity Sold" field in my ItemPurchase Junction Table, but I am unable to do this at the moment.
Is there a way to keep track of each item sold in each purchase without adding a field to my Junction Table?
>>
File: ?.png (7KB, 120x120px) Image search: [Google]
?.png
7KB, 120x120px
>>55768392
what tool is this?
>>
>>55768560
So for a markov text chain, I record the probability that a word will appear next to another, right?

>>55768584
I would have no idea where to begin
>>
>>55768900
whats the graphical software you are using for that ?
>>
>>55768899
>People are saying these are outdated and useless languages
They're right
>>
>>55768900
RecentTransactions table containing the user account who made the purchase

purchased items go in a separate table with a foreign key transaction ID
>>
>>55768938
http://ondras.zarovi.cz/sql/demo/
>>
>>55768951
I don't have a User Account table and, for now, I won't need one.
>>
>>55768978
ok then, just list their shipping address and their transaction ID
tie their purchases to the same transaction ID so you can email them a receipt
>>
Why is himegoto always in this threads
>>
>>55769026
why don't you go back to >>>/a/ ?
>>
>>55769048
Why?
>>
>>55768940
C is not useless
>>
File: justD.jpg (14KB, 297x331px) Image search: [Google]
justD.jpg
14KB, 297x331px
>want to publish meme app on android
>25
>tfw poor
>>
>>55769316
fuck off poor fag
>>
>>55769339
xD
>>
>>55769001
So basically you're suggesting a fourth table?
>>
what's the difference betwwen
sh script.sh


and

./script.sh
>>
File: IMG_20160419_233135.jpg (35KB, 800x800px) Image search: [Google]
IMG_20160419_233135.jpg
35KB, 800x800px
>tfw trappy but can't code very well
How 2 git gud? I wanna b a meme, anons.
>>
>>55769026
One autistic faggot always posts it.
>>
>>55769527
. is the current directory
>>
>>55768640
As much as I love it, there is 0 jobs with Go in my area
>>
File: output.webm (1MB, 320x571px) Image search: [Google]
output.webm
1MB, 320x571px
next: Explosions and fragments

r8 pls
>>
>>55769536
>tfw mental illness but can't code very well
ftfy
>>
>>55769579
looks neet, what's it written in
>>
>>55769536
more things up your arse faggot
>>
>>55769579
HUEHUEHUEHEUHUE nice job though
>>
>>55769527
The second one can only be done if it's executable.
>>
how do you anons deal with the monotony of working for an enterprise?
>>
I wanna pound hime's boipucci
working on gnu turd
>>
>>55769536
I sincerely doubt that.

But if you're serious, read K&R.
Starting from C is truly the best way to learn how to think programatically, because literally every other language will baby you and try to do things for you.
>>
>>55769578
If you want jobs and not to work on personal projects, nothing beats Java, C# and JS.
>>
>>55769611
Thanks anon <3
Doesn't matter if you don't believe me, I got what I wanted.
>>
>>55769610
Are you gonna make it actually usable within the next decade?
>>
>>55769608
I do side projects while at work, usually I am done for the day by 12 or so, take 2-3 hours rest (including lunch time) and around 3 or so I dongle and fiddle with my personal project, and even stay after 5, like I like to work overtime, but my train is at 6:15 so I am actually gaining some time
>>
>>55769626
C++ ? Coz I like it for what it is
>>
>>55769661
Sure, but to a lesser extent.
>>
>>55769596
Swift

>>55769602
thx
>>
>>55769630
The pajeet game should be done tonight (you're an indian that's escaping from the shits you've taken on the beach and they gained life)
>>
File: C vs C++.png (463KB, 785x678px) Image search: [Google]
C vs C++.png
463KB, 785x678px
>>
>>55769735
So, both are bakas?
>>
>>55769611
>literally every other language will baby you and try to do things for you.
C does a lot of things for you, but they're usually never what you want.

C implicitly truncates numbers and if it overflows, it's "undefined behavior" and the compiler is allowed to do anything.

C lets you do things with uninitialized variables, which you might think it's whatever data is left on the stack or in a register, but it's not. The compiler can do whatever it wants with the entire program because it's "undefined behavior."

"Hello" + 'a'
is valid C. It adds the character code of 'a' to the address of the string constant.

Strings end in a character '\0' by convention, turning O(1) operations into O(n). You have to scan the whole string to find its end and there are libraries intended to make this operation faster. People are writing libraries for something that shouldn't exist in the first place.

for(;P("\n"),R--;P("|"))for(e=C;e--;P("_"+(*u++/8)%2))P("| "+(*u/4)%2);
is valid C.

C makes systems programming more error-prone than assembly language. People think programming used to suck because of C and have a distorted view of what compilers and programming languages are supposed to do.
>>
>>55767074
What the hell am I doing wrong /dpt/
>Make three paragraphs and fill them
>Made three paragraphs and filled them with shit
>You left some blank :)
Horse shit. All <p>'s are closed.
>>
>>55769898
>C lets you do retarded things if you're retarded

WOW

Also, that implicit char value conversion is extremely useful when converting ASCII to integers and converting integers to ASCII.
>>
>>55769935
>/dpt/
>clearly should be in /wpg/
OUT OUT OUT
>>
>>55769935
>>>/g/wdg
>>
>>55769943
Sure, fine.
>>
>>55767994
GTK+
>>
>>55769935
Get rid of the p tags around the h1 you retard
>>
>>55769898
C is not your mom.
>>
>>55769935
Anon, you don't enclose h1 tags in p tags.
>>
>>55769942
>c default behaviors are retarded and you have to use libraries to get around that
>not using atoi or itoa

>c
>good
>>
>>55769989
>c default behaviors are retarded

>WAAH WHY CANT I ADD 2 STRINGS TOGETHER LIKE IN JS??? C IS SHIT!!
>>
The people who hate on C on this board are the same people who suck at using it.
>>
>>55769985
Thanks
>>
>>55769942
You don't understand why people write compilers or programming languages.

The programmers who write C compilers have to put "retarded things" in their compiler in order to call it a C compiler. They went out of their way to make the compiler more complicated for things nobody ever wants to do intentionally.
>>
>>55770064
Those "retarded things" are part of the C standard.
If they're not in there, it's not a standards compliant C compiler.
>>
>>55770008
>why can i get O(1) in javascript but O(n) in "fast" C?
>>
>>55768584
certified Prolog cancer patient
>>
>>55770084
if string operations are your real bottleneck, write your own damn string container with the size as an integer.
>>
>>55770084
Because JavaScript is an infinitely better and safer language than C. We should be writing all our drivers in it.
>>
>>55769579
Did you intend for the movement of the ship to lag so much?
>>
>>55767074

Hello /g/

I'm looking to get into programming, what's the best language to learn?
>>
>>55770170
Haskell
>>
>>55770170
Not again.
>>
How are there so many C# jobs when I see little to no C# software packages out there.

Whens the last time you used a production software that was made in C#?
>>
>>55770113
>just reinvent the wheel! c has it all if you can build it!
>>55770143
>only defense for his language is using it for drivers
>>
>>55770143
>the only alternatives are C and JavaScript
If you like C, you'll like JSFuck.

JavaScript does retarded things too.
>>
>>55767074
Hey /g/, anyone recommended material for getting familiar with python?
>>
>>55770195
>just reinvent the wheel! c has it all if you can build it!

I can guarantee that O(n) strlen operations are not your bottleneck, but if you're really this retarded, I'm saying that C lets you do things your way.
>>
File: 1469486333934.jpg (45KB, 600x600px) Image search: [Google]
1469486333934.jpg
45KB, 600x600px
>>55767074
Since it-ebooks is ded, where should I look for tech books? I'm a hikki and can't afford them until I get a job.
>>
>>55770226
I can guarantee your bottleneck is not program performance, just use a higher level language anon. In many cases like this you'll even get better performance :^)
>>
>>55770250
http://gen.lib.rus.ec/
>>
>>55770170
JavaScript
>>
>>55770270
ty lad
>>
>>55769573
>>55769606
Jesus christ. This is /g/, right? Where the fuck am I?
>>
>>55769989
>itoa
not standard.
>c
>good
stop being retarded and maybe you wouldn't blame the language.
>>
>>55770710
>C is portable!
>builtin functions? don't use those! they're not standard!
>>
>>55770769
C's portability comes from the fact you can barely do anything with it
>>
>>55770679
Hell
>>
File: tumblr_o419mhrNKg1rc7zl1o2_400.gif (2MB, 300x300px) Image search: [Google]
tumblr_o419mhrNKg1rc7zl1o2_400.gif
2MB, 300x300px
I know that there are community-maintained code generation libraries for Go which allow you to write something like Templates / Generics.

What's the best one / one that sucks the least right now?
>>
>>55770769
Just write your own itoa, dumbshit.
>>
>>55771055
no thanks i'll just write my own language since it's less work than using C
>>
>>55771037
she didn't knew
>>
>>55770154
it doesn't lag at all on the device, just on the simulator (I guess the Intel graphics can't handle iOS simulation very well)
>>
What IDE for Python?
>>
Haskell is L I T E R A L L Y the only good language
Kill yourselves OOP niggers
>>
>>55771229
Visual Studio has some Python tools

>>55771263
>false flagging this hard
You must be really desperate
Is it because there aren't enough Haskell haters for your liking?
Maybe you should get better taste
>>
>>55770200
>JavaScript does retarded things too.
I'd say it does more retarded things. It can only be so good when it was designed and implemented in 2 weeks time.
>>
>>55768212
Use a library
>>
File: PYTHOON.png (22KB, 1542x379px) Image search: [Google]
PYTHOON.png
22KB, 1542x379px
i'm a baby beginner (started programming yesterday) and i'm stuck on this, please help
>>
I'm trying to split my project up in C++, do I only put function signatures in the .h files, then make another .cpp file for the actual code?

Why not just stick the whole function in the header file?
>>
>>55771578
>Why not just stick the whole function in the header file?
Every single time you compile, your header is compiled.
If you separate header from source, it will only get compiled again if you made changes.
This is the difference between 3 second compile times and 10 minutes for larger projects.
>>
File: 1468020095725.jpg (161KB, 908x889px) Image search: [Google]
1468020095725.jpg
161KB, 908x889px
>>55769579
>that font
Pick up calligraphy
>>
Has anyone used Marmalade SDK to make android apps? Their showcase is big but I never really hear about it.
It seems a lot better than having to use Java.
>>
>>55771570
your number of entries is getting decremented to zero
>>
>>55771612
I see. Thanks.
>>
>>55771739
If you use templates you can't split it into header/source afaik but otherwise do split it.
>>
Why do so many engines use dissolve for LOD?

The constant shimmering is truly vomitous.
>>
>>55771815
>truly vomitous
Just like your taste in women
>>
>>55771849

At least I can admit it. Negresses are an acquired taste, like stouts and vegemite.
>>
>>55771723
how do i fix this??
>>
>>55771886
store your number of entries twice, use one in the loop and one to find the average
>>
>>55767074
Fuck off this programming fag meme.
>>
Hey /dpt/, retard coming through

I am making a small forum management system, just for fun, and I'm working on a way for users to log in to the system.

Could someone please explain to me, in language that a potato could understand, what exactly the purpose of a password salt is?

Why is it not enough to simply hash and store the user's password? What is the point of a salt?
>>
>>55771986
"In cryptography, a salt is random data that is used as an additional input to a one-way function that "hashes" a password or passphrase. Salts are closely related to the concept of nonce. The primary function of salts is to defend against dictionary attacks versus a list of password hashes and against pre-computed rainbow table attacks."
straight from https://en.wikipedia.org/wiki/Salt_(cryptography)
>>
>>55771986
There are things people use in password cracking called rainbow tables, which is a massive list of pre-computed hashes. Using one of these, they can crack most of your password ridiculously quickly.
If you salt the passwords, their rainbow tables won't work, as they were generated from the wrong/no salt.
>>
Is there anyway to do Java multi-threading without using the main method? The framework im using gets wonky when I use the main.
>>
>>55771986
assume your database gets leaked and your users used stupid passwords that could be cracked really easily with a dictionary attack or just brute force

now if you appended let's say 30 random characters that only the server knew to each password, it suddenly gets really difficult to crack those passwords without the person knowing the 30 characters you used
>>
>>55771986
Well think of it like this
If everyone uses the same hashing algorithm on an input without salting and the password for a given hash is known (dictionary), it's easy to hack.

Website A
User john password is apple -> XXXX
Website A was hacked and someone kept a dictionary of hashes and passwords

Website B
User jim password is also apple ->XXXX
Oh shit here come dat hacker
You got hacked and that guy knows what password gets this hash because of the previous site

If you salt it you get this instead -> YYYY
Now that guy has nothing
>>
>>55772031
>>55772072
>>55772153
>>55772218

Thank you guys for the explanations, this really makes it all clear now.
>>
>>55768930
Look up the 99 Prolog Problems and their solutions. You can find graph representation and algorithms implemented there.
>>
>>55769316
Go mow the neighbors lawn you lazy fucking niglet.
>>
I've implemented a multiply function and a divide function for my VM, but I'm too lazy to write tests for them.

Writing in bytecode is hard
>>
Any Anon's willing to share their thoughts on Typescript? I'm working with javascript right now, looking to make it a bit more bearable.
>>
>>55772611
write a compiler
>>
>>55772646
I was planning on doing that when the VM was mostly completed.

I could probably write some unittests instead.
>>
What should I use for unit testing in C++?
>>
I had a very frustrating day at work. We have some code that counts some data and stores the results in a database. We also have a "thresholds" table with maximum counts. We just needed to write some code to check if any of the data counts exceed the values in the threshold table. Pretty simple, right?

One of my coworkers was tasked with writing it. In her first attempt she was hitting the database in a god damn loop. Fucking no! You don't need to open/close 1000+ connections and grab one fucking row at a time. Just use a single query. So she goes back and does manage to make it so it's not hitting the database in a loop, but it's still a bunch of separate queries. I'm looking through the convoluted Java code around it and suddenly I realized, "this is just a fucking inner join". She was literally writing gobs and gobs of convoluted as fuck Java code when two lines in her query would have accomplished the same thing.

I firmly believe there are people who just don't have the skill to take a problem and break it down into reasonable steps. Their brain just doesn't work that way. They simply aren't capable of writing clean, readable code. They always come up with incredibly convoluted solutions that are 10x larger than necessary.
>>
>>55768142
neither of them. ArrayList is not a thread-safe collection.
>>
>>55772682
surely this isn't real
>>
What's the best way to view the memory addresses and values that are being used by your computer?
>>
>>55772724
It is. I deal with this shit everyday. For every 10 programmers at my company, maybe 1 is any good. The rest come up with code so fucking convoluted that I'm actually a little amazed at the creativity shown in avoiding the obvious and direct solution.
>>
>>55772747
Formatted output, debugger
>>
>>55772759
Where is your company located? Hiring?
>>
File: island.png (103KB, 223x311px) Image search: [Google]
island.png
103KB, 223x311px
>>55769935
>[Kali Linux]
>[Kali Docs]
>[Kali Tools]
>having trouble with HTML
good luck buddy ....
>>
is installing slackware on a VM and learning to code C on it overkill for a beginner?
>>
>>55772911
No
>>
>>55772911
Yes. But if you can accomplish that then you won't be a beginner for very long.
>>
>>55772911
That's called retardation. Why do you need a VM? Your CPU can't run C?
>>
>>55772911
Linux is linux. If you're trying to get into systems development with C, then distro isn't something you should worry about in the beginning, because the vast majority of what you are going to do is distro-independent.

Get something with less configuration required, like Debian or Fedora.

Slackware, gentoo, and arch are all nice distros, but are overkill when you just want to install something in a VM and start programming.
>>
>>55772911
Why Slackware?
>>
>>55772911
basically what I did back in the day. Except not through a vm just installed some super early version of red hat on my spare machine and started fucking shit up and strengthening the defense of my virginity.
>>
File: Pythtest.png (37KB, 1542x473px) Image search: [Google]
Pythtest.png
37KB, 1542x473px
total noob here again, the code i wrote works in the two instances my tutorial software gave but it still says "make sure your code also works for similar inputs", i know im sabotaging my code somehow, just dont know how.
>>
Is there a better way to parse words?


while(i<text.length){
var word ="";
while(i<text.length-1 && text[i]!=' '){
word+=text[i];
}
wordArray[word]={};
alert(word);
word ="";
i++;
}
>>
>>55773118
>repeatedly prompt the user

Looks like your code is only prompting once.

Hint: Some of the stuff from line 3 has to be moved to line 8
>>
Explain this shit

>>> a
'abcd'
>>> for i in a:
... i = chr(ord(i)+1)
...
>>> a
'abcd'
>>>



why is a still 'abcd', when i changed every letter in the loop?
>>
>>55773267
i is a copy of each character in a, not a reference
>>
>>55773267
i have no idea what language this is but that for loop could be pass by value not pass by reference?
>>
>>55773307
python
>>55773296
how to do it then?
>>
>>55773333
String are immutable so you can't modify the string directly. Instead you should first convert to a list:
l = [chr(ord(c) + 1) for c in a]
a = str(l)
>>
>>55773333
for i in range(0, len(a)):
a[i] = chr(ord(a[i]+1))
>>
File: unneccessessary.jpg (19KB, 188x277px) Image search: [Google]
unneccessessary.jpg
19KB, 188x277px
>>55773198
javascript?
words = text.split(' ')

reference:
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/split

assuming this wasn't complete bait, this is babies first program type shit
like goddamn
>>
>>55773402
TypeError: cannot concatenate 'str' and 'int' objects 


>>55773389
thanks
i added to your solution
a = ''.join(l)
>>
>>55772759
these people can get jobs and i don't even get replies to my resume

i've sent my resume and cover letter to 100 openings and I haven't received a single reply or phone call
i even checked the github visitor statistics on my repos and nobody is looking at them
>>
>>55773430
Not bait, thanks
>>
Need advice /dpt/.

When I'm running my application during development, the executable, shared objects, config files, assets, etc. will all be located in a single directory. This makes it easy for my executable to find the various files it needs at runtime. But when I package and ship the application (on Linux), the different files will be in separate directories. ie the executable will be in /usr/bin, the config files in /etc/my_app/, etc.

How can I handle this?
>>
>>55760170
>>55760203
>>55760262
>>55761042
You guys stink at Haskell.

onChunks f n = takeWhile (not . null) . map (f . take n) . iterate (drop n)
chunk = onChunks id
dropEvery n = onChunks (drop 1) n . (undefined:)
>>
>>55773433
Oh right, I forgot that's how you convert a list to a string.
>>
>>55773512
symlink your program executable in /usr/local/bin
put your program in /opt
put your config files in ~/config/yourprog/whatever.conf
>>
File: 48475313_p53.jpg (199KB, 481x470px) Image search: [Google]
48475313_p53.jpg
199KB, 481x470px
I got the basics of C and Python. Now how should I practice them?
>>
>>55773540
That seems like a lazy way to do it. Most programs don't use symlinks, so how do they do it?
>>
File: Programming Challenges 1.png (717KB, 1261x1000px) Image search: [Google]
Programming Challenges 1.png
717KB, 1261x1000px
>>55773552
I got two other lists as well
>>
>>55773552
Work on project. Ideally one that integrates the two.

Just an idea: make a checkers playing program. You can write the core of the engine in C and compile it to a Python module, and use Python for some higher level logic. It's a bit contrived, but might be fun.
>>
>>55773568
most programs get packaged up by a distro maintainer

if your program didn't get installed from a package manager, I highly suggest not putting your stuff directly in /usr/bin

As an example, sublime text 2 puts it's executables and program files in a folder in /usr/local and has a symlink in /usr/local/bin
>>
>>55773552
work on knowing more than just 'the basics'.
>>
i'm interested in trying to make some simple bots that play games

i've been doing some research and the most common ways to do this are to look for pixels on the screen to determine state and then send mouse clicks and such. or to actually read the memory of the process to determine state.

anyone have advice on how to get started?
>>
>>55773593
That seems reasonable, thanks.
>>
>>55773626
Really depends on the type of game. What did you have in mind?
>>
>>55773653

kind of just want to learn the 'fundamentals' . I guess i'm thinking like, something running on desktop (not web) , probably in windows.
>>
Which library / framework should I pick up in order to build desktop programs in C++?
>>
>>55773715
You might want to look into WoW. From what I hear, they used an internal scripting language which makes it easy build bots. No need to process screen output or read memory.
>>
>>55773749
you're looking for Qt if you want a GUI
>>
>>55773785
not him but does it work with visual studio or do i have to use their entire IDE
>>
File: asciifull.gif (27KB, 715x488px) Image search: [Google]
asciifull.gif
27KB, 715x488px
Hmm, on the ASCII table I can't find any correlation between the 0-9 and their respective +shift counterparts.

Am I doomed to have to write a shit ton of conditional statements? There is an onShift method but it is only a boolean.


button.setOnKeyPressed(e -> {


System.out.println("Test KeyCode: " + e.getText().toString());

});
>>
>>55773864
no idea.

check this http://doc.qt.io/vs-addin/
>>
>>55773868

Yes, unfortunately. If you look at any library that implements stuff like this, keys like that usually have to be manually defined. It's a pain.
>>
who /gray/ here

gray :: Int -> [String]
gray 0 = [""]
gray n = let child = gray (n - 1)
in (map ((:) '1') child) ++ reverse (map ((:) '0') child)
>>
If I'm working on a cross-platform C# project, what UI framework should I use. As far as I know, WPF isn't ported to mono and winforms is still in odd shape. Are QTsharp or GTK# my best bet?
>>
Is autotools still relevant?
>>
>>55773937
e-electron?
>>
>>55773930
shitty code
>>
>>55774065
what is your solution senpai?
>>
>>55774031
I thought about it, I was worried it would take longer to get everything going.
>>
After learning Scheme with SICP is it a better idea to move on to assembly first then C or the other way around? Evidently, my aim is to get a good grip on low level languages
>>
the other day someone mentioned that developing apps in jave for android was shit compared to developing in swift for iOS, can anyone vouch for this? looking to make apps here
>>
what is objectively best programming language and why?
>>
>>55774264
System F
>>
>>55774262
if you're just getting started there's almost certainly far more documentation and history for the basic java/android setup.
>>
>>55774245
I'd say at the very least the basics of C first (pointers, malloc, heap vs stack, basically representing data without lispy abstractions)
>>
>>55774262
The android api is a huge clusterfuck, I can't speak for swift though. There are some helper libraries you can get for android development that make things a bit more elegant though.
>>
>>55774264
Haskell, because it is the most expressive
>>
>>55774296
Idris is more expressive and safer
>>
File: idris.gif (496KB, 397x283px) Image search: [Google]
idris.gif
496KB, 397x283px
>>55774309
>>
>>55774309
>flat effect system
no thanks
>>
File: UnAssigned_095.jpg (1004KB, 2000x1335px) Image search: [Google]
UnAssigned_095.jpg
1004KB, 2000x1335px
is this a retarded way to orginaze a long switch statement?

switch(inputString.charAt(0)){
case '1': return '!'; case '2': return '@'; case '3': return '#';
case '4': return '$'; case '5': return '%'; case '6': return '^';
case '7': return '&'; case '8': return '*'; case '9': return '(';
case '0': return ')'; case '-': return '_'; case '=': return '+';
case '[': return '{'; case ']': return '}'; case '\\': return '|';
case ';': return ':'; case '\'': return '"'; case ',': return '<';
case '.': return '>'; case '/': return '?'; case '`': return '~';
}
>>
>>55773430
> not
words=text.split(/\s/)
>>
>>55774768
just do an array, fampai!

var a={
'1':'!',
'4':'$',
}
>>
>>55767571

This is exactly what I did. I learned python to get familiar and comfortable with Object Oriented Programing. Then I moved to Java so I can do bots on my fav game.
>>
>>55774802
This functionality doesn't exist in Java.
>>
File: k language.jpg (54KB, 919x404px) Image search: [Google]
k language.jpg
54KB, 919x404px
>>55774264
K programming language
>>
>>55774768
fucking kids these days

return inputString.charAt(0) - 12;
>>
What is the absolute hardest thing that's possible to program?
>>
>>55774869
gf
>>
>>55774869
a program that can analyze itself and determine if it will successfully run
>>
>>55774842
Java has HashMaps:
http://stackoverflow.com/questions/7775919/writing-an-initialized-static-hashtable-elegantly
>>
NEW THREAD!!

>>55774900
>>
>>55774768
data should be values and not code. so, use a map.

HashMap<Character, Charcater> myMap = new HashMap();
String x = '123456789'
String y = '!@#$%^&*('
for (int i = 0; i < x.length; i++)
myMap.put(x[i], y[i]);

myMap.get('5') //example


or similar...

>>55774802
>array
>this is what we get for keeping javascript in 2016

>>55774862
>I think it's cool and funny to troll newbies in /dpt/


>>55774887
>misunderstanding halting problem
>2016

doesThisProgramSuccessfulyHalt():
return True
>>
>>55767497
wait, is that calculus integration?
why
>>
>>55774887
The halting problem is perfectly solvable.
>>
>spend 2 hours trying to make an iterative factorial program as an added challenge after making a recursive one in assembly

>segmentation fault first run

guess i cant make anything without extreme hand holding in this language
>>
>broken mips

>>55774952
move $v1, 1
label begin
beq $a0 1 end
mul $v1, $v1, $a0
sub $a0 $a0 1
jmp begin
label end
ret
>>
>>55774993
so programming from the ground up is a shit book for x86 then? cause it seems to make this longer than it should be. might just be to teach calling conventions though
>>
>>55774914
Yes it is. I didn't have anything to do.
>>
>>55774245

Definitely start with c and get the basic knowledge of pointers and the heap vs stack to a decent level before you start assembly.

In a majority of cases you will never or rarely use the assembly knowledge directly outside of reverse engine / debugging. It just gives you a solid basis for analyzing what your code is doing at the cpu level.
Thread posts: 320
Thread images: 29


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