[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: 315
Thread images: 16

File: himegoto vol2.jpg (347KB, 500x717px) Image search: [Google]
himegoto vol2.jpg
347KB, 500x717px
old thread: >>55811464

What are you working on, /g/?
>>
>>55817516
First for D
>>
LINKED LIST STACK IMPLEMENTATION
>>
>>55817589
read this
http://isis.poly.edu/kulesh/stuff/src/klist/test_list.c
>>
>Draw a girl
>Call it a boy
Why is this allowed?
>>
>>55817589

This calls for someone to secretly replace the linked list allocator to take from a sequential memory pool.. So in reality it is a stack implemented on a linked list implemented on a plain old array or vector.
>>
>>55817619
That's how the a linked list implemented in the Linux kernel
>>
>>55817655
yes, and it is a very good way of having a general linked list
>>
can I always pass parameters as references in c++?
>>
>>55817758
You can do whatever you want anon
>>
>>55817631
all anime characters look like girls anyway
>>
>>55817794
thanks <3
>>
>>55817758
You should.
>>
>>55817827
except for when you shouldn't
>>
oh hey, another thread about people programming shitty lists of anime and basic conversions

have fun talking about languages that don't matter and programs a child could make
>>
>>55817758
References are ultimately memory addresses, which are values.
>>
I want to make a program that writes it's own code by trying every single combination of characters until it compiles.
It WILL eventually create the greatest program of all time.
>>
>>55817835
sorry, i forgot about scripts that make your homescreen glitter too
>>
>>55817842
References are just retarded const pointers
>>
>>55817864
have fun with that

just know that there is really no way to know if your program will terminate

it will take trillions of eons
>>
>>55817864
you do realize you haven't set a standard for what it does.

so in theory if it tried enough combinations it could end up just printing something random and since it executed it would then stop.

it has no reason to continue once it has successfully run.
>>
>>55817619
>isis
I'm not opening that link. It's not even a HTTPS address, so anyone can see what I'd be opening.

I fear I've already being watched because of this thread. Posting this comment is dangerous too.
>>
>>55817864
I did this.
After an hour it produced a subtracting function, and somthing that printed out powers of 13, with about 55 lines of junk.
Don't bother.
>>
>>55817804
Only the type of anime you watch.
>>
>>55817888
>>55817966
>>55818001
I just tried it and got a working kernel, suck it fags
>>
>>55818001
That's actually pretty surprising results.
I would've expected it to be 100% garbage that segfaults at runtime anyway.
>>
Do employers not care about non-trendy-meme-technology works in a prospective hire's portfolio?
>>
>2016
>using SQL bloat
>>
why do people put huge amounts of code after
if __name__ == '__main__'

?

Also, should we import the modules at the beginning or after
if __name__ == '__main__'

?
>>
>>55818413
that is pythons int main()..

and imports should go at the top of the file.

Go read the pep guides
>>
>>55818001

it actually printed something? damn
>>
What's up guys

i'm writing a kernel in C and Assembly, does anyone want to see?
>>
>>55818647
Sure
>>
>>55818657
okay. here's my github:

https://github.com/torvalds/linux

if you have any question, just ask
>>
>tfw I can't finish anything bigger than a few thousand lines
How do you do it senpai-tachi? I just get bored of working on the same program as soon as I figure out the general structure and whatever gimmick I set out to make. For example, if I want to make a pokemon GO clone I'd just get to the point where it queries google maps for data and uses the GPS to place you on a virtual map... And then I'd quit and never re-open that project because it feels like from there on it's just filling in a bunch of boring shit. How do I fix this so that I can actually make something of note, something interesting beyond short "project euler"-like programs?
>>
Linked lists are better than array lists.
>>
>you will never inseminate hime's boipussy
why live
>>
>>55818783
I have a similar problem. I can't get myself to actually write anything. Once a year or so I get completely into some book / whatever, then finish a bunch of their problems and get completely bored.

Decide I want to write something actually useful (for me) and then... I have no idea what. Everything I can think of already exists somewhere.
>>
>>55818886
why don't you kill yourself then?
>>
>>55818911
Yeah, it really does feel like anything useful has already been made, and anything fun (video games for example) I can't make to a satisfactory degree solo. I've been desperately looking for a way to make programming fun again. I tried taking a look at getting into open source programming, but all the OSS I use myself (linux, various frameworks) already has a thousand contributors, the barrier to entry is high and kind of intimidating...
>>
File: IMG_20160729_090249.jpg (385KB, 3055x1402px) Image search: [Google]
IMG_20160729_090249.jpg
385KB, 3055x1402px
Anons give me a very small command line game to make for practicing my C. I have gotten all the way to understanding how to do bubble sorting of arrays. Pic related I am reading the beginner's guide to c before K&R.
>>
File: 1455627561626.png (8KB, 995x63px) Image search: [Google]
1455627561626.png
8KB, 995x63px
>>55818675
How did you get that many contributors?
>>
>>55819224
Blackjack is a very nice exercise imo.
Make a deck (array of all the 52 cards), make a function to shuffle, a function to draw and so on. You don't have to bother with the weird rules like doubling, but you should at least keep aces as 1 or 11.
>>
Learning Java now

Any tips?
>>
>>55819321
Switch over to C#
>>
>>55818783
Get a job
>>
>>55819334
this desu
>>
>>55819334
This is the best advice when it comes to Java.
>>
>>55819334
It's for work, I already know a bit of C#
>>
>>55819365
Then learn more of it and get a job in C#.
>>
>>55819379
But I like my job

I tried to get a job in c# but it didn't happen

I just got told today to drop everything and learn Java because they want to put me on some project
>>
File: 1449018224624.jpg (57KB, 540x531px) Image search: [Google]
1449018224624.jpg
57KB, 540x531px
I'm working on a little Python malware - basically a reverse shell. I'm connecting the victim's machine to mine through a socket, and it works fine. The thing is - the code must have my IP adress, but then the victim could have my IP. How can I hide my real IP?
>>
>>55819425
>Python malware
Write it in a compiled language you dipshit.
I really hope this is a troll.
You must be 12 years old.
>>
>>55819418
This is literally the only reason why Java is being used over C#. You're forced to at your job.
>>
>>55819425
Get a cheap VPS
>>
>>55819346
Are you my mom?
>>
>>55819443
Ok, so I'm writing a fucking chat, or whatever the fuck you want. The problem is the same.
>>
>>55819446
I think there are more, better implementations of the JVM than .NET. You can even run java on some embedded systems. And I say this as a total C# fanboy, but it looks like improving on this is the current focus of the .NET team.
>>
>>55819467
Yeah, I think I'll have to do that.
>>
>>55819470
You'll find it easier to write more if you are paid/forced to do it
>>
>>55819502
That's because java is much more aggressively optimized, isn't it? That could definitely be solved with a better jit/compiler There's a big talk about this on the roslyn github..

The fact that the language itself is much better still stands.
>>
>>55819486
With a reverse shell, inevitably you will have to connect to something. There's no two ways about it. Hiding your IP in this case is not different from how you'd normally do it... tor, proxies, whatever. A safer approach is having your malware read from a certain twitter account where you can give it commands, however that only allows for one-way communication and you would still need to hide your IP when connecting to twitter. Of course you can replace twitter with any other online service that lets you post shit.
>>
I have this idea of how to do a password system in a python scripted video game I'm making, I'm sure there is a function that will pull it all together but I don't know what that is.

There will be a grid where you checkmark boxes for you on screen. On the backend, checking these boxes appends integers to an array. In the end, when you've finished the password, I need a function that will check if your password array contains specific integer variables AND have the correct number of array items total.

Like, say the password is [1, 7, 9, 13]. What do I use to check if my array contains those numbers and that there are only four of them there total? Order doesn't matter. If you checked the boxes in a different order and got [13, 1, 9, 7], it should be exactly the same. I can do everything else.
>>
How do I solve this?
Backjump limit reached (currently 2000, change with --max-backjumps or try to
run with --reorder-goals).


--max-backjumps=-1 or --reorder-goals together or by itself does nothing.
>>
>>55819561
I tried connecting to a VPN and using the IP from the VPN, but it didn't work. The Twitter ideia is interesting, maybe I'll work on that.
>>
>>55819558
It's partially an optimization issue (java has filthy hacks like storing all integers up to 128 as static objects, using primitives that aren't actually objects etc.), and partially just that java was first, became more popular and so people started writing JVMs for everything.
>>
>>55819638
It's called command and control, https://en.wikipedia.org/wiki/Botnet
>>
>>55819585
If there 64 boxes or less, you could always use a ulong with bitmasking. Otherwise what's stopping you from iterating over the 2 arrays?
>>
>>55817516
Raspberry Pi based Bitcoin ATM
Currently working on error detection and correction with the JSON RPC

https://github.com/Dako300/RPI_BTC_ATM
>>
>>55819585
The appropriate data structure is a set (unordered collection, duplicates discarded), take a look at the first answer here http://stackoverflow.com/questions/9623114/check-if-two-unordered-lists-are-equal
>>
>>55819609
Any haskellfag knows?
>>
Where do I learn about manipulating 2d arrays and using relational data to interact with them?
I tried to look it up and found some examples for Conway's Game of Life but I didn't see one that actually explained in depth how they manipulated the date.
Help? I've never done anything like this before.
>>
>>55819585
Well, you could just sort both arrays before checking:
def is_equal(array1, array2):
if array1.sort() == array2.sort():
return True
return False
>>
>>55819909
Probably should have added I'm doing this with python.
>>
>>55819796
Thanks, that was easy.

password_array = [5,4,3,2,1]
correct_password = [1,2,3,4,5]

if set(password_array) == set(correct_password):
print("you win!")
else:
print("LOSER")
#this works, as is. will always print "you win"


are there any nuances to set() that I should be aware of? It seems perfect. It doesn't care about order just like I wanted.
>>
>>55819870
I've never touched haskell, but backjump limit reached sounds like you've created an infinitely recursing loop? Check your termination conditions.
>>
>>55819976
password_array = [5,4,3,2,1]
correct_password = [1,2,3,4,5]
print ("you win!") if set(password_array) == set(correct_password) else ("LOSER")
>>
>>55819976
That is slower than >>55819928
>>
File: ?.png (7KB, 120x120px) Image search: [Google]
?.png
7KB, 120x120px
What's the real definition of code monkey?
>>
>>55820041
Someone who suck at coding but code for money.
>>
>>55820041
u
>>
>>55819976
It differes from lists/arrays in two major ways:
1. Order is non-existant in a set, and
2. Can't have duplicates

You already noticed the order-agnosticism, and then there's also set([1, 1, 1]) == set([1]).

So for data like this it's perfect. If you wanted to extend your code and turn it into a regular keypad, so that i could have passwords like 1337, you would have to use a different data structure because of the duplicate 3s.
>>
>>55819982
This is an error in the default package manager.
>>
>>55820071
Also specifically part of a large group of coding monkeys, that is it must be cheaper for a company (on short term of course) to have 3 weak coder than one good coder.
Also, see web devs.
>>
>>55817864
Make a prgoram that creates a text file and fills it with a random amount of random characters, and then runs a compiler over it. Let it run for like a few billion years and then come back.
>>
>>55817516
Cleaning up my fixed thread image saver, finishing my github demo (for potential employers), and if I have time, either giving Django a day in court (vs my current NodeJS setup) or finishing a use-cases doc/chart for my app.

>>55818783
You were born to be a software designer, not a programmer... but yeah, software design is hard for programmers and programming is hard for software designers, for different reasons. To programmers, software design is difficult because of math/logic/abstraction, and to software designers, programming is hard because it is boring. This is why programming is a dying profession in the states and is increasingly outsourced to indians and gooks.
>>
>>55820041
Someone who can program but not necessarily design an algorithm or choose the right data structure for a job. Its like a software designer without a college degree.
>>
Every WPF book I come across has a section on the 3D API.
But they never seem to answer my question:
For an API that is ostensibly used only for the GUIs of business-end applications, why the fuck would anyone use it?
>>
>>55820303
You might want to draw some kind of 3d graph or implement doom and run it in the sub window.
Your userbase would love you.
>>
>>55820241
>You were born to be a software designer, not a programmer
You're probably right desu, I hadn't thought of that. Software design does tend to require a background in programming though, and it's hard for me to take on a leadership role because I'm beta as fuck. I guess my best bet is to dredge through the boring parts of programming just to get it done and try to focus on the design aspects so that down the line I can eventually land myself a job with a fancy title such as systems architect... It's tough for now though, but such is life I guess.

>>55820303
2 words: three-dimensional pie charts, motherfucker.
>>
>>55820041
Look up the definition of "Cargo Cult".
Essentially, code monkeys put the practice of cargo-culting into daily use as programmers.

It just so happens that cargo-culting as a programmer actually does give you satisfying results, as opposed to building a landing strip on an unmanned island. Not that the code monkey would ever be able to do more than just copy what other people have done.
>>
>>55817516
Transistor programming.
>>
>friend gets in on this stupid Pokemon Go craze
>make a Pokemon Go bot
>makes $90k in less than a week

Why can I never think of this stupid shit?
>>
>>55820538
i dont think people are selling pokemon go bots
>>
>>55820538
There are a lot of great money making ideas in the area of web automation.
The problem is identifying the audience, and identifying the path to automation.

For example, writing a bot that buys limited-edition shoes for niggers to gift to their 'baes' is actually quite difficult once you have to deal with emulating calls to the webshop's encrypted credit card APIs. (They do this to discourage botting)
>>
>>55820576
They are seeking leveled up accounts to dumb people that can't into using a bot.
>>
>>55820576
They are. $8 per license.
>>
>>55820655
nice link there butty.

Link it so i can reverse engineer it and crack it so the fucker doesnt make money
>>
>>55820655
all the better bots are free
https://github.com/NecronomiconCoding/NecroBot
>>
>>55820036
No it isn't you dolt. The sort is O(n log(n)), making a set and comparing them is O(n).
>>
>>55820590
I saw a defcon talk about how some guy used a (legal) botnet to bid on used cars for his dealership and earned a ton of money. The story took place in the early 2000s I think, so it's a lot harder nowadays.
>>
>>55820697
I was going to make the same comment, but the fact that set() is a function could mean that python does some weird conversion so that it's faster to just sort them in practice. I don't know though, I only use python when I have to and it's never for anything performance-critical. For that reason I prefer the cleaner approach of just using sets.
>>
>>55820756
No it isn't you dolt. The sort is O(n log(n)), making a set and comparing them is O(n).
>>
>>55820496
I know the struggle, bro... believe me.
>>
>>55820801
Was this another anon or is something fucky?

>>55820756
Python has an excellent set implementation and semantics. Something I feel is missing from some other languages.
>>
Working on a swing application to visually create mediawiki tables. So far so good. It can handle table resizing, cells spanning multiple rows and columns, and headers.

Now I just need to make it so you can actually edit the table.
>>
>>55817864

Not that hard in Mindfuck to create something like 'hello world'
>>
I need himegoto to sit on my lap and wiggle while """she""" is coding
I lost interest in making an OS lol fuck it imma just keep doing webdev
>>
What's the best course of action when your life is in spiraling out of control and you can't do anything about it?
>>
>>55820945
Crash so you can restart it.
>>
>>55820945
just keep moving bro.

Life is like a photograph.

you need the negatives to develop.
>>
Hello fellow Pajeets,

I am learning Android development, and i want to start with a basic Tic Tac Toe game.

I will try to approach this in an MVC-way, so the Model will be some background code about the rules of the game, and the turn system, etc.
the View will be the Main Activity,
but i'm confused about the Controller part.

do i put everything into the onCreate method of the main activity, or do i create like a Service that runs in the background, or how does this work?
>>
>>55820945
By spiraling out of control you mean you are starting to realize you aren't going anywhere in life.
>>
>>55820998
>Life is like a photograph.
>you need the negatives to develop.

You're male the equivalent of one of those dumb shallow bitches on Facebook who goes out clubbing every Friday and has had multiple abortions and STD's.
>>
If I have TreeMap<String, Double> will the tree map sort the strings or the double?
>>
>>55820945
Put a bullet in your head.
>>
>>55821256
Most likely by the key.
>>
>>55821124
How about you fucking write something that works rather than worry about your memevc design pattern
>>
>>55821175

Something to that effect, yeah.
>>
>>55821230
>being this triggered by a quote
kek
sounds like you're projecting
>>
>>55821287
Thanks, i'll just test it out either way.
>>
>>55821256
Assuming the strings are the keys, it will be sorted by the strings (because those are what you're normally going to look up)
>>
>>55821302
I'd hate to see you go, but ever thought about leaving the keyboard for a few hours every day? The only time I don't see you on here or /pol/ is when I presume you're sleeping.
>>
>>55821324
>projecting

Well you know what they say

Life is like a photograph
>>
>>55821336

I do post a lot, but I'm not always at the computer. I post from my phone quite often.
>>
>>55821302
what went wrong in your life? aren't you a programmer?
>>
>>55821345

I find that life is more like cellulose acetate film. Prone to spontaneous combustion.
>>
>>55821388

Or rather, the other way around. It's like nitrate film.
>>
>>55821373
>I'm not always at the computer, but when I'm not I post from my computer.

What I do when something goes out of control, be that an airplane, software, hardware, or my dick, the first thing I do is stop EVERYTHING and immediately attempt to grasp the most important thing in order to regain control of it. Branch out from there. Aviate, Navigate, Communicate.

Nothing good comes out of wildly moving your flight stick around if you have no idea what your bearing is going to be in the next second.
>>
Are Haskell coders TOO smart to be employed?
>>
File: inigomontoya.jpg (45KB, 500x420px) Image search: [Google]
inigomontoya.jpg
45KB, 500x420px
>>55821324
>projecting
>>
>>55821864
No, you're just never gonna convince non-technical "bigwigs" to switch to anything not java.
>>
>>55821931
I'd try to convince them that it's cheaper in the long run to pay better trained developers to architect the software than to pay a hundred cheap-as-dirt monkeys to ruin your software.
>>
>>55817516
What does this image have to do with programming?
>>
>rust can't implement linked lists
wtf, literally no better than go
>>
>>55821883
>reddit.png
>>
>>55822046
Yes it can, but, it is a royal pain in the hemorrhoid laden rectum.
http://cglab.ca/~abeinges/blah/too-many-lists/book/
>>
>>55821841
>Nothing good comes out of wildly moving your flight stick around if you have no idea what your bearing is going to be in the next second.

But, I enjoy it when the avionics say "WHOOP WHOOP!"
>>
File: cucklang.png (73KB, 2048x1024px) Image search: [Google]
cucklang.png
73KB, 2048x1024px
>>55822046
>>
>>55821989
Nothing. It's just one autistic boy-molesting lala homo man spamming his trap waifu.
>>
>>55822046
>>55822078
Rust is one of those languages, seems good on paper, but in practice, it's easier to deal with a few use after free bugs.
>>
>tfw no gf to program together with
>>
Why does XML like to use webpages for its schema namespaces, such as
[codehttp://schemas.microsoft.com/winfx/2006/xaml/presentation[/code]

It's obviously not a real webpage. And yet HTML, among other things, love namespaces to nonexistent webpages. Apparently these webpages are hardlinked by the software to refer to something else.
>>
>>55822450
4chan tag parser confirmed for a shit.
>>
>>55822450
Because XML is cancerous shit.
>>
>>55822432
it hurts too much anon
>>
File: 1455306842444.jpg (12KB, 400x250px) Image search: [Google]
1455306842444.jpg
12KB, 400x250px
>>55822046
struct Node {
forward: Option<Box<Node>>,
backward: Option<Box<Node>>,
}
>>
>>55822450
I think it's some dumb-ass semantic web meme.

>>55822534
She could sit on your lap and help you input those hard-to-reach emacs combinations...
>>
>>55821124
The controller handles user interaction, like clicks, restarts, etc.
>>
>>55822564
>Option
>O
>Box
>B
literally the worst language
>>
>>55822611
>you will never play twister with your gf on the keyboard so you can input dumbass emacs shortcuts
>>
What is your preffered IDE for C++ in GNU/Linux?
Actually I'm with anjuta, but i feel like there are many better ones.
>>
>>55822751
Small programs: Vim
Large programs: Eclipse
>>
I am trying code web app in Java for { game }. The { game } take input two integers and give output sum of two integers... I try implementing with Builder pattern but no avail. Please tell what are patterns very suitable for this problem ? Thank you kindly for help.
>>
>>55822807
You implement it by kindly doing the needful, Rajesh.
>>
>>55822687
this, i never use the shufit key, languages where i have to are not ones i want to uswe
>>
Here's something that stumps me.
Let's say you want to design software for a card game.
Think MtG or some shit.
Obviously there are a shitload of cards.
How would you design it so that you minimize the amount of tedious, mind-numbing bullshit involved in the data-entry task of enumerating all of these cards?
>>
>>55822931
For MtG cards they need to be somewhat well designed, you can't just use random generation and hope to get a playable game. Most likely you create a tool that lets you edit a database of cards easily. For example adding a new card could have a front-end with a simple form, input a number in the damage and health fields, mark some checkboxes for effects/keywords like counter, absorb etc.

tl;dr you don't, it is manual data entry but you can make it less painful by slapping a simple CRUD frontend on it.
>>
>>55823039
So then I suppose you would have to be careful of cards that do stupid gimmicky shit like "Playing this card ends the game", rather than follow the common theme of actions.
>>
Can go automatically derive functors?
>>
>>55823086
All of those things have to be programmed in manually. I remember reading an interview with some of the devs behind Path of Exile, a diablo-like. They ended up having several thousand stats tied to your character, because they have so many gimmicky effects like >CausesBleedingOnHitIfTargetIsPoisoned

I think in general it's best to keep the rules simple, kinda like hearthstone's keywords. Charge, taunt, combo, discover... Not only is it a ton easier to implement, but in my opinion it's better game design because it's easier to keep things consistent and clean.
>>
Can go express functors?
>>
File: Prototypes.png (66KB, 1043x1043px) Image search: [Google]
Prototypes.png
66KB, 1043x1043px
So I think I'm over-engineering this text game I'm making, which is a good thing but now I have some problems.

How could I use the data found in, lets say Scene Data to compute? If the Scene Data is text, I can parse it but then how can I execute the code inside? (and securely do it).
>>
Noob question, how do I access element at (x,y)?

ArrayList[][] sudoku = new ArrayList[9][9];
sudoku[0][0] = new ArrayList();
sudoku[0][0].add(3);
>>
>>55823343
sudoku[x][y]


Ic bidde þē, notaþ Haskell.
>>
>>55823343
Why do you have a 2D array of lists?
>>
>>55823288
>Genitalia

I'd say you're over-engineering it.
>>
>>55823393
https://docs.oracle.com/javase/8/docs/api/java/util/ArrayList.html

Should I just use a regular 2D array instead of Array List?
>>
>>55823393
More than likely he's making a list of all the possible numbers that can go in each position.

Really he should be using sets, but he didn't go to school, so he probably doesn't even know what a set is.
>>
>>55823288
I'm not understanding your question.
Why should you have to parse your scene data?
Is it in a database of some sort?
Why does your Scene Data have ``code" instead of relevant tags? Do as this guy says >>55823215
It's called Implicit Invocation.

>>55823424
Clearly he's making some furfag shit.
>>
>>55823288
Write an interpreter?
Use DLLs?
>>
>>55823457
Furthermore, your detail on exactly what Scene Data is, is sparse.
This is the metaphorical equivalent of telling someone to interpret meaning from cosmic chaos.
In the words of K&R: garbage in, garbage out.
>>
>>55823343
int sudoku[9][9];
sudoku[x][y]
>>
>>55823448
At the moment you have the ability to store multiple values per cell, which confuses me given the name of the variable is sudoku. Might a 2D array of Optionals be more appropriate?
>>
>>55823481
Or in the words of Pajeet, kindly doing the needful.
>>
>>55823457
>Clearly he's making some furfag shit

Probably. I imagine the game will allow you to strap on your +4 dam Bad Dragon XXL.
>>
>>55823533
Don't knock it until you've Tried it. Especially the double ended one.
>>
>>55823500
I am using the 2D array of 81 elements to represent a sudoku board.

Is this not a good approach?
>>
>>55823651
Okay, so your array is 9x9?

So each cell can either be empty, or a number. Is that correct? Having each cell be an Optional<Integer> would model that well.
>>
>>55823457
Well, to be honest it was a COC clone, but the genetalia will just have values depicting what it is. It's not furfag shit, it's just porn.
>>
>>55823709
Just give everyone a vagina.
>>
>>55823688
I'd like the user to be able to mark any cell however they wanted. So instead of leaving a cell empty they could write in "2 or 3". So string is what I'm going to use. Then check the numerical value of the strings when looking for a solution.
>>
>>55823709
Sicher, Bernd, sicher.

>>55823651
Please look up the correct way to instantiate a 2D array.
Furthermore, understand the differences between an Array and an ArrayList.
There is no meaning in creating a 2D ArrayList for Sudoku, it only makes things more difficult due to the list nature of the data structure.
>>
>>55823739
Don't carry information like that in strings, especially if you need it to conform to a specific form or grammar. It would be tacky and pointless to check and parse that information.
>>
>>55823745
Then what would I use? You said to use a set? Alright... time to look up what that is.

I'm guessing I'll have to make 9 sets of 9?
>>
>>55823745
Oi, mein ComputerSpiel hat das Furries nicht.
Ich möchte mönstrosmädchen im mein Spiel.

>>55823732
Verboten.
>>
>>55823786
No, a HashSet is also suboptimal for Sudoku due to its unordered nature.

A regular 2D array of primitives is fine for Sudoku.
Like the other poster, I prefer Optional<Integer> simply because it doesn't require extra logic to implement a sentinel value.
I would not use a string, because I prefer parsing strings to their most relevant datatypes as immediately as possible. In this case, it prevents loops when you don't need them.

You will understand why you should dislike branching after taking a course in Computer Architecture.
>>
>>55823785
It doesn't NEED to follow the format "x or y" that was an example. It could say anything. It's just so the user could mark a tile with whatever they like as they would if they were doing it on a piece of paper. Obviously if the string could not be converted to a number than it would return an automatic failed solution.
>>
>>55823816
Warum ist es verboten?
>>
>>55823896
Die Mann muss die Schlange im die Frau stellen.
>>
>>55823634
>Especially the double ended one.

That doesn't exist, though.
>>
>>55823987
You have to make it yourself.

>>55823984
Tribbing is more fun.
>>
>>55824026
DESU I always thought it looked rather stange.
Besides, I like COC's idea of having the environment corrupt someone, but I didn't like how rampant the sex was.
>>
back to working on my compiler, but it's pretty difficult since I can't use SSH at the moment and all I have is a Windows laptop. haven't compiled my code in like a week now and I have no way of testing any of it.
anyways, started working on the type checker but I'm not really sure whether I'll implement type inference or not. still no lexer or parser though, since I still have no idea what the syntax should be like.
>>
>>55824119
You should make heavy use of Unicode in order to keep programs concise.
>>
>>55824137
Nobody needs another emoji programming language.
>>
>>55824149

We've had symbol packed languages long before emoji. Everybody remembers how successful APL was, right?
>>
>>55824137
I actually thought about it. I'll probably make it so that you can use most Unicode characters as identifiers or operators. I really want Unicode in the types so I can make the type annotations really compact.
>>55824149
:^)
>>
>>55824175
What sort of type system are you going for, anon?
>>
I'd love to be working on something, anything, but my neck and shoulders are fucked.

I don't know if I'll ever be able to do programming again as a day job.
>>
>>55824199
pretty standard Hindley-Milner type system for the most part, but I'm adding subtyped variants with row polymorphism (based on OCaml) and some other features to help with that. for example, you can "flatten" a variant type to just the constructors without arguments and sort-of pattern match against those types in a type signature (hard to explain without an example but I'm my phone right now so I can't type one up)
>>
>>55819321
Switch over to Kotlin.

>>55819353
>>55819359
Microshills fuck off please.
>>
>>55824301
That's okay, I don't think I'd understand given that I don't know what a variant type is!
>>
>>55824305
JetBrains shill pls go
>>
>>55824305
>>55824347
Emacs/vim + Haskell, now pls go pajeets
>>
>>55824246
Protip: Wear Suspenders.

They'll fix your posture problems in a jiffy. Also make sure you have good posture.
>>
>>55824365
How do you live with yourself?
>>
>>55824365
Ordering some now, I hope you're right. I haven't been able to program for over a year now.
>>
>>55824398
Quite comfortably.

>>55824401
Stretching does wonders too. If that doesn't work, go see a chiropractor.
>>
>>55824345
think of like a type `A or `B. more complicated types are like `A Int Int or `B Float Float, which means a tag `A that holds two ints or a tag `B that holds two floats. sample values are `A 1 5 or something like `B 2.3 0.5
>>
>>55824415
I've been seeing a physio, it hasn't helped. I'll have a look around for a chiropractor.

Thanks for the suggestions, man. I just want my life back.
>>
>>55824436
That sounds an awful lot like ADTs/Haskell's Either type...
>>
>>55824471
yes, but the type is subtyped. for example, [`A] <: [`A | `B Int]. that means that it can also be inferred and the type can change between two different functions but use the same tags
>>
>>55824436
I've heard of the variant type from C++ proposals from a while ago and still cannot figure out a use case for it.
>>
>>55824520
Ah, I think I see. To me that sounds a bit more like how ADTs are normally encoded in Scala (if you're familiar with it), only in your language it's presumably not a dirty hack.
>>
PYTHON 2.7 OR PYTHON 3.5 FOR A BOARD GAME OVER A NETWORK GO
>>
So /g/, I fell for the C meme and completed an entire course using almost nothing but C, read all of K&R and implemented nearly every /g/ challenge that didn't require leaving the command line; but now that I've worked my ass off to accomplish what Pajeet could've imported from a library in a day I want to work on GUI applications and actually get hired, so I need to learn C++.

What's the best way to go from C to C++? Even John Carmack said that Doom 3 wasn't all that great of C++ code because he was "thinking in C", and I'd like to avoid that trap and write C++ that'll actually get me employed.
>>
>>55824548
lets you define a linked list in one line of code:
data List a = Nil | Cons a (List a)
in OCaml you can get it to zero using type inference
>>55824560
it's kind of similar to Scala, yeah. honestly, I suggest trying it in OCaml because there's some really cool stuff you can do. or just wait for me to start shilling my language here once it's done :^)
>>
>>55824650
3.5 you fucking autist. There's absolutely no reason to use 2.7 anymore because even if whatever obscure library you """""need"""""" to use doesn't support 3.5 yet it will eventually; and when it does eventually get updated 2.7 will be utterly deprecated.
>>
Sudoku guy here. Struggling to come up with an efficient way to come up with a way to determine what 3 x 3 area a particular co-ordinate is in, what row it is in, etc. Also not sure if I should merge these two methods or not.

public static boolean isValidPlacement (int x, int y, int value, int [][] sudoku) {
if (sudoku[x][y] > 0) {
return false;
}
if (isPresentInArea(x,y,value,sudoku)) {
return false;
}
return true;
}

public static boolean isPresentInArea (int x, int y, int value, int[] [] sudoku) {

}
>>
>>55824668
Unlike C, there is an actually idiomatic way to write C++. Whereas C is more of a "If it works, it ain't wrong", C++ is more "Design poorly and you will hate your life".
I recommend treating C++ as an entirely separate language.The best book I can offer you are Bjarne Stroustrup's most recent book, A Tour of C++, and Herb Sutter's presentations on C++11 and up at CppCon
>>
>>55824668

The first step is get used to the extra features c++ has over c. Templates, Classes, and the standard library. C++ primer plus is a good place to start.

The second step is picking up a idiomatic and sane style.

This will help :p
https://github.com/isocpp/CppCoreGuidelines/blob/master/CppCoreGuidelines.md

I'd also look at a lot of the information posted by Herb Sutter on C++14 / C++11.


Oh, and be ready gui frameworks are almost always a pain to work with.
>>
>>55824710
areaSize = 3
areaX = X / areaSize

Should give you:
areaX = 0 when X = 0, 1, 2
areaX = 1 when X = 3, 4, 5
areaX = 2 when X = 6, 7, 8

Same goes for areaY.
>>
>>55824754
>>55824760
I haven't looked at the books yet, but I'd assume (or hope) that they're not aimed at people who know literally nothing about programming. If I read one more introductory programming book I think I'll hang myself with my laptop charger.
>>
>>55824668
I'm so sorry anon. You're fallen for the thing known as "taste".
You'll never be able to write "idiomatic C++" without wanting to kill yourself.
>>
>>55824754
that still doesn't stop people from writing complete crap that "if it works, it ain't wrong".
>>
>>55824820
Dang... this is the monstrosity I came up with. I was gonna run this 9 times.

if (x <= 2 && y<= 2) {
for (int i = 0; i <=2; i++ ) {
for (int k = 0; k <= 2; k++) {
if (sudoku[x][y] > 0 || sudoku[x][y] == value) {
return true;
}
}

}
}
>>
>>55824867
I want to be employable though, I don't want to flip burgers my whole life when I have a perfectly valid job skill that just needs to be honed.
>>
File: 1466277628928.jpg (122KB, 692x864px) Image search: [Google]
1466277628928.jpg
122KB, 692x864px
#include <stdio.h>
#include <stdlib.h>
#include<time.h>

int main()
{
int diceRoll, i, extraRoll;
int rollAgain = 1; // true
char ui;

while(rollAgain == 1)
{


printf("Roll the dice three times by pressing enter: \n");

getchar();
for (i=0; i<3; i++)
{
diceRoll = (rand()%6) + 1;
printf("%d\n", diceRoll);
}
puts("Those three numbers are randomly generated ");
puts("and I want you to guess the next roll by guessing ");
puts("if it is higher, lower, or the same.\n");
puts("'h', 'l', 's'\n");

scanf("%c", &ui);
puts("\n");

srand(time(NULL));
extraRoll = (rand()%6) + 1;
printf("%d\n", extraRoll);


switch(ui)
{
case 'h': if(extraRoll > diceRoll)
puts("\nCorrect it is higher.\n");
else
puts("\nIncorrect it is not higher.\n");
break;
case 'l': if(extraRoll < diceRoll)
puts("\nCorrect it is lower.\n");
else
puts("\nIncorrect it is not lower.\n");
break;

case 's': if(extraRoll == diceRoll)
puts("\nCorrect it is the same.\n");
else
puts("\nIncorrect it is not the same.\n");
break;

default: puts("\nInvalid input.\n");
break;

}
printf("Roll again? 1 - yes 2 - no \n");
scanf("%d", &rollAgain);
}

return 0;
}

The output is ugly in my opinion, help /dpt/
>>
Alright can anyone tell me why my getline function is returning the \r at the end of the line as well. Im on windows. I read here
>http://www.cplusplus.com/forum/general/51349/
that if I were on a mac reading a file written on windows this could happen, but Im on a windows computer so this shouldnt be happening. Only catch is that I generated the file programatically but I used \n. Either way why is there a \r at the end of the string Im reading into.
>>
>>55825019
The file is probably open in binary mode or some shit.
>>
>>55824880
Actually that doesn't help at all, because there's no way to relate the area size to the actual tiles in the array which means I'm still just writing 9 if statements.
>>
>>55824850
Books like K&R and anything Bjarne Stroustrup writes aren't for introductory programmers.
Those books are written for developers to learn a language.
Which is why I never recommend those books to beginners, because they turn into code monkeys afterwards.
>>
>>55825024
God dammit your right. I was gonna originally make the generated file a binary file but changed my mind and when I was going back to change how its read forgot to switch it from binary mode.
I really appreciate it. Its a real sign you know what youre talking about when you can guess mistakes like that.
>>
>>55823847
>A regular 2D array of primitives is fine for Sudoku
I guess you could use bitsets.
>>
>>55825166
Think I'll just cheat and see how someone else implemented it. Whoever said that Sudoku was "easy" to code was a dummy.

Is there anyway to not do these repetitive if statements? I feel really dumb doing it this way.

if(x<=2 && y > 2 && y<=5) {
for (int i = 0; i <2; i++ ) {
for (int k = 3; k < 5; k++) {
if (sudoku[i][k] == value) {
return true;
}
}
}
}
>>
>>55825198
Are you talking about a soduku solver, or a soduku application?
A sudoku solver is easy if you understand some algorithmic design.
>>
>>55825198
Sudoku is rather easy to program.
Even if you were to naively program the result checker, it would merely be 4 loops with an O(3n^2) runtime.

If you want the absolute FASTEST runtime, you should see Norvig & Russel, writers of the most legendary Introduction to Data Structures & Algorithms.

He has a Sudoku solver on his website http://norvig.com/sudoku.html which, if you think about it, is basically identical to a maze solver.
>>
>>55825263
It was listed on one of those programming challenge pictures as Easy as simply Sudoku.

What I'm doing now is making a method called isPresentInSquare which determines if a particular number is present in the square.

Next up is isPresentInRow and isPresentinColumn.

Then the populateSudoku method which takes an array, loops and generates a random number in a random position if all the above methods are false. This goes on til a certain number of numbers are generated.

The code block I posted was 2/9 if statement that determines what square to check based on the co-ordinates.
>>
>>55825277
Wait shit, IDSA was written by Cormen, et al.
Norvig & Russell wrote Artificial Intelligence: a Modern Approach, which is equally legendary.
>>
>>55825317
>It was listed on one of those programming challenge pictures as Easy as simply Sudoku.
It probably meant a sudoku solving algorithm. But keep it up. How are you having the user play the game? Is it all console and you are interpreting certain keys (w, a, s, d) are arrows and allowing the user to enter the number for the highlighted square? Seems like you could benefit from something like ncurses.
>>
It's so easy to make gui programs in java.
>>
>>55825349
First comes generating the board, then I can find a way to represent it. Probably javafx.
>>
>>55825390
I thought you said you were doing it in C?
>>
File: output.webm (2MB, 640x360px) Image search: [Google]
output.webm
2MB, 640x360px
I'm messing around with OpenGL. I added gravity to my program!
>>
>>55825408
Nah... maybe someone else.
>>
>>55825420

Cool.. Now try doing the same thing except with magnetism instead of gravity.
>>
>>55825420
now add particle-particle collision
>>
>>55825473
I suppose he could do it by approximating magnetic domains using a vector per particle
But programming the interactions between all the particles sounds like ass.

Did he really program gravity using brute force simulations?
>>
>>55825581

I think it is completely doable. I've been thinking about it myself at a slightly larger scale of simulation.

I've been recently watching pages like http://hubpages.com/education/Gravity-is-Magnetism

I find it interesting. The universe can literally be broken into just waves (Probabilities) or vibrations.
>>
>>55825581
>>55825473

i'll give it a try. Seems like a good excuse to move my physics stuff to a Compute Shader.
>>
>>55824980
At least add some flair to your game.

Rate my implementation of that anon's game:
http://pastebin.com/4pvGK7JN
>>
>>55825770
I'll be honest with you, he reads like a conspiracy theorist.
>>
>>55825836
>>55825836

Read some of the stuff quantum physicists are putting out there. It's all out there and mind blowing.

At this point there are studies popping up that are starting to show what we think only happens at the quantum level is remaining true at non-quantum levels.

There are many who are actively trying to disprove the existence of what we know as "time".

We still cannot explain why observation affects / sets the outcomes of measuring quantum particles.
>>
File: 4868.png (20KB, 480x480px) Image search: [Google]
4868.png
20KB, 480x480px
>>55825770

> waves (Probabilities)
>>
>>55825820
Ty for replying and btw I am learning so a lot of that you put I barely understood.
>>
File: chaintelligencedotorg.png (9KB, 256x256px) Image search: [Google]
chaintelligencedotorg.png
9KB, 256x256px
An antisocial chat website. Type /help for a "comprehensive" overview of its functionality. The rest should be self explaining.

>URL related.

Ignore the name, I'm just recycling.
>>
>>55825911

Have you not heard of a "wave function" in quantum mechanics?

What exactly is your green text implying?
>>
>>55825820
#define EMPH(str) "\033[31;1m" str "\033[0m"

What the fuck?
>>
>>55826003
https://en.wikipedia.org/wiki/ANSI_escape_code#Colors
>>
>>55825928
Go through his program and comment as much as you can yourself, trying to understand what every line of code does. It's completely doable, his code is fairly neat (as in, clean or organized) and self-explanatory.
>>
>>55826003
ANSI escape codes.
It makes it red and bold.
>>
>>55826003
Did you bother compiling, no; even looking at the fucking code? It's a function that accepts a char as an argument and makes it bold.
>>
Currently working on a spigot algorithm for log(2) (gets the nth digit of logBASE10 of 2), and am having trouble.

I'm following this guide from wikipedia: https://en.wikipedia.org/wiki/Spigot_algorithm, and what I have so far gets me the correct decimal. However, I'm having trouble converting the double to a binary representation.

Basically, I'm not sure why the bit-wise shift doesn't work (Sum and Temp are both doubles, and you can't shift a fraction of a bit)
>>
>>55826031
>It's a function that accepts a char
It's a macro that accepts a string literal.
It makes use of the fact that string literals in C are concatenated together.
>>
>>55826052
I can't tell whether you are using bitmap fonts very wrongly or very rightly.
>>
>>55826105
A little bit of column a, a little bit of column b...I've been told it looks better when it's larger
>>
>>55826052

What font is that?

Double and float have a sign bit, an exponent, and the mantissa. The compiler is right to say it is a invalid operation. I should also note any hack around this constraint is undefined behavior.
>>
>>55826157
The font is gohu (http://font.gohu.org/)

Okay... But then how would I go about getting the first few bits of the decimal point from the result?
>>
>>55826173

There isn't really a safe method of doing so that I can think of off the top of my head. All floating point representations are machine defined.

Honestly, I've only seen the spigot algorithm represented as nested loops. Typically we just use a math library that has already defined functions like this.

You could take the money approach and represent your floating point values as integers.
>>
>>55826052
It just so happens that Doubles are not binary decimals.
>>
>>55817516
I want to pair program with hime while she sits on my lap and I touch her no-nos.
>>
>>55826490
>she
>>
>>55826523
My privilege is fully checked
>>
>>55826523
It's clearly a girl. All of the features are that of a girl. None of the features are that of a boy.
You can't just arbitrarily label something as "boy".
>>
>>55826564
That's just the cover tho.
>>
>>55826564

Watch the show or read the manga. Hime is a boy who is blackmailed into crossdressing.
>>
How do I access values in a f# type using c#??
>>
>>55817516
Is Xamarin on Windows a pain in the ass or is it just me?
>>
>>55826696
Yes, I know about that shitty series.
It was more of a statement about lazy as fuck artists, and the mouth breathing retards who defend it.
>>
>>55826696
No, some spoiled rich student council girls offer to give hime money to keep loan sharks away if he becomes their pet trap.
>>
>>55826717
Yeah, it's a pain using VS2015... Did they really deprecate xamarin studio for windows??
>>
>>55826766
Yes. I have had nothing but problems doing the absolute most basic shit. When was the last time you used it?
>>
>>55826718
I'm not entirely sure if you can chalk it up to laziness. The entire fucking series is pretty much just fan service. If they made Hime look like a more realistic crossdresser, with a few masculine features being poorly covered up, it might not be popular enough to spam every day in DPT.

>>55826731
Yeah, but the whole fucking thing feels coerced.
>>
>>55826711

The same way you would access values in a C# or VB.NET type?
>>
>>55826838
>Yeah, but the whole fucking thing feels coerced.

So what?
>>
>>55826883
I've wondered why do you tripcode users feel the need to preserve some sort of identity on this site. I've used a tripcode once to try it out and it really just felt like it got in the way of discussion with the whole "look at me and acknowledge my identity" it gives off.
>>
>>55827039
The point is that the series is shit and your "precious traps" are just girls that you decided to label something else.
>>
>>55827060
I don't need to take that from a brony autist who posts pics of his shaved legs on 8ch.

Put your trip back on ruby, you're not fooling anybody.
>>
>>55825944
That keming tho
>>
Learning JS through the good parts.
>>
>>55819321
Switch over to Racket.
>>
>>55827271

Clojure is also a viable option here. If the portability offered by the jvm is actually that important.
>>
>>55827039
The point is you're all furiously masturbating over a character that isn't a trap of their own volition, but merely to save their own hide.

>>55827155
1. That isn't me
2. I've posted my hairy legs in DPT just to prove that nonsense wrong.
>>
>>55827191

There are no good parts in JS.
>>
>>55827271
muh negro
>>
> tfw using haskell more and more and using lisp less
>>
>>55818783
>>55820241
this is literally my problem too
>>
>>55825277
that sudoku solver isn't nearly the fastest
>>
>>55817516
sometimes, I have breakfast before work and I have free time to kill.
Free time I wanna progress in programming.
Where can I read source code?
>>
>>55827830
Start with the Linux kernel.
Move on once you understand every subsystem.
>>
>>55827890
i want to understand java code
>>
>>55827949
Find the nearest designated shitting street and observe the patterns of poo on the ground.
>>
>>55828144
> dpt
> need an answer to bridge time too short to code
> get shitpost answers.

T-Thanks
>>
>>55827949

You must make the great pilgrimage to Indonesia and embrace the customs and learning patterns. That way you can truly become a enlightened java user.

The left hand is for wiping and the designated area for waste is the street with numerous men squatting with their shorts down. In this place you may learn many great Indonesian secrets for superb corporate java software.
>>
>>55827652
Haskell is amazing
>>
>>55828606
amazingly slow
>>
>>55828616
-o3 -threaded
ST
StateT
IO
>>
>>55827695
rainbow tables is cheating
>>
>>55828841
you have no idea what are you talking about
>>
trying out this challenge
https://www.reddit.com/r/dailyprogrammer/comments/4tetif/20160718_challenge_276_easy_recktangles/
>>
Pythonpinhead here.


My currently response to 'charmap' coedec errors and UnicodeEncodeErrors is just skipping over it. I dislike this.


How do I finally and irrevocably learn to AVOID UNICODE ERRORS!?
>>
New thread:
>>55829467
>>55829467
>>55829467
No drawings of girls labelled as guys edition.
>>
>>55829426
what is people's obsessions with memetext? you could at least do something where you learn something useful
>>
>>55818783
Have someone pay you for something they need. Then you'll produce long code (and learn/practice) either way.
Thread posts: 315
Thread images: 16


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