[Boards: 3 / a / aco / adv / an / asp / b / biz / c / cgl / ck / cm / co / d / diy / e / fa / fit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mu / n / news / o / out / p / po / pol / qa / r / r9k / s / s4s / sci / soc / sp / t / tg / toy / trash / trv / tv / u / v / vg / vp / vr / w / wg / wsg / wsr / x / y ] [Home]
4chanarchives logo
/dpt/ - Daily Programming Thread
Images are sometimes not shown due to bandwidth/network limitations. Refreshing the page usually helps.

You are currently reading a thread in /g/ - Technology

Thread replies: 255
Thread images: 28
File: ew.jpg (100 KB, 600x338) Image search: [Google]
ew.jpg
100 KB, 600x338
What are you working on, /g/?
>>
>anime OP
why
>>
File: wef.jpg (105 KB, 1368x968) Image search: [Google]
wef.jpg
105 KB, 1368x968
>I use a statically typed programming language
>>
>>52211127
Learning C++ so I can become one with this meme.
>>
If I want to implement malloc, and I want to merge/defrag some blocks (because there's no single continuous free block available), perhaps using memmove, pointers pointing to that data might get invalid since the data has been moved. Do I really need a special API to access the data (i.e. I can't just dereference the pointers mymalloc() gives me)?
>>
>>52210297
Are you scraping the page for links instead of using the dedicated API?
>>
>>52211152
This is an anime site and squid girl is a cute. Glad mods deleted the other two that were made a few minutes ago.
>>
File: 1439590011623.jpg (259 KB, 1000x1502) Image search: [Google]
1439590011623.jpg
259 KB, 1000x1502
>>52211322
Glad you'll always be a weebshit manchild and won't take up jobs for people who will actually do something with their lives.
>>
How do I insert an item into a listbox in WPF/C# before my binding data? I want to insert a "[All Artists]" value right at the top before all my bound data (which is set in codebehind using LINQ).
>>
>>52211166
>i can't think straight and am too lazy to develop anything but trivial little scripts
https://strawpoll.me/6398631
>>
QUICK, POST LITERALLY ANYTHING IN YOUR LANGUAGE OF CHOICE
>>
>>52211530
superCoolProof : P ≡ NP
superCoolProof = superCoolProof
>>
>>52211522
When creating the model you bind to, just put "[All Artists]" in first and catch it in event if it the selected item?
>>
how 2 proev P != NP?
>>
>>52211530
struct MyThing {
var a = 0

func doThing() -> () -> Void {
return {[num = a] in
print(num)
}
}
}

var b = MyThing()
let c = b.doThing()
b.a += 1
c()
>>
>>52211530
echo "hurr durr";
>>
>>52211557
No can do friend. If I could do that I certainly wouldn't be having the headache I'm currently having.
>>
File: 1429852208959.jpg (682 KB, 600x3300) Image search: [Google]
1429852208959.jpg
682 KB, 600x3300
>>52211367
>weebshit
>>
>>52211530
o = new ObservableCollection<ObservableCollection<ObservableCollection<ObservableCollection<ObservableCollection<String>>>>>();
>>
>>52211367
Someones upset that there is anime on an anime website.
>>
>>52211563
superDumbProof : ¬ (P ≡ NP)
superDumbProof = superDumbProof
>>
File: rms_on_apl.png (33 KB, 525x168) Image search: [Google]
rms_on_apl.png
33 KB, 525x168
>>
File: merryXmas.jpg (128 KB, 1067x535) Image search: [Google]
merryXmas.jpg
128 KB, 1067x535
>>52211530
>>
>>52211616
>anime website

In 2006 maybe, that's like saying America is a British colony.
>>
>>52211530
fun fact x = if x = 0
then 1
else x * fact(x-1);


I can do maths, me.
>>
>>52211367
>>52211152
>>
>>52211530
def isPrime(x):return len(i for i in range(2,int(x**0.5)+1) if not x%i)==0

:^)
>>
>>52211719
Miller Rabin?
>>
>>52211773
uwotm8
>>
File: 1437691891229.jpg (349 KB, 1024x768) Image search: [Google]
1437691891229.jpg
349 KB, 1024x768
Sup guys, it's the NSA here to do some datamining. Answer my survey about your tech jobs so senpai big brother can notice me.

>Job description
>Qualifications
>Country
>Pay
>>
>>52211526
static languages are literally the new ASM

if you're still writing general software in static languages then you need to come out of the cave and join the modern world, bro.
>>
>>52211809
Anything I want
Math degree
Anywhere I want
300k+
>>
>>52211827
I love this meme!
>>
>>52211809
Neet
N/A
My room
Neet
>>
File: 20160103_175438.jpg (616 KB, 2048x1152) Image search: [Google]
20160103_175438.jpg
616 KB, 2048x1152
>dynamic programming
>advanced technique
American education everyone
>>
File: 1434839815524.png (348 KB, 1280x720) Image search: [Google]
1434839815524.png
348 KB, 1280x720
Ika is cute! CUTE!
>>
>>52211127
Reading through the Swift documentation on the SIL optimizations it does.
>>
>>52211851
Tell me, master programmer. What is 'advanced' in your eyes? I'm assuming you can easily solve div 1 550 problems on topcoder since dynamic programming is so intuitive for you.
>>
/g/ can't write a function that outputs a string that has a length of less than 0
>>
>>52211883

>less than 0
>>
>>52211883
is this the sequel to /g/ can't average two ints
>>
>>52211809
>Job description
Junior Support Engineer
>Qualifications
2 years of BSc ComSci
>Country
Glorious England
>Pay
Shitty £16.5k because I do nothing most of the time
>>
>>52211883
Easy.
def stringLessThanZero():
return ''/0
>>
>>52211851
>Introduction To Algorithms by Cormen et al
>advanced
>>
>>52211955
And yet it is more advanced than you will ever get. :^)
>>
>>52211883
Nobody can.
>>
>>52211927
>tfw can't get into comp sci because no a-levels

Where did you go?
>>
File: 5r6.png (4 KB, 553x120) Image search: [Google]
5r6.png
4 KB, 553x120
>>52211883
Anon, we understand. Negative numbers are a meme.
>>
>>52212007
Greenwich School of Management, it's like the top 100 of 160 unis lel
>>
>>52211569
What language is this?
>>
>>52212031
Congrats lel, I went to MIT which is like the top 1 uni of all unis lel
>>
>>52212035
https://swift.org/
>>
>>52212039
>falling for the mit meme
>>
>>52212062
>implying it's a meme
youre just jealous kid
>>
>>52212041
I never realised how ugly it is. What's the difference between var and let? What's with [num = a] in?
>>
>>52212039
>MIT which is like the top 1 uni of all unis lel
lel, no. for computer science, uc berkeley is the top notch uni.
>>
>>52212086
http://www.usnews.com/education/best-global-universities/computer-science
hurr durr
>>
What /g/ really can't do though is count to infinity.
>>
>>52212079
var is a mutable variable, let is an immutable variable. [num = a] is a capture list. It's saying to capture the current value of a into num. Otherwise it would capture a reference to a, which could change.
>>
>>52212104
data Nat = Zero | Succ Nat

infinity :: Nat
infinity = S infinity
>>
>>52212100
>usnews.com

kek are you serious?
>>
>>52212104
Or draw a perfect circle.
>>
>>52211809
0 ... 0/0
>>
>>52212126
http://www.topuniversities.com/university-rankings/university-subject-rankings/2013/computer-science-and-information-systems#sorting=rank+region=+country=+faculty=+stars=false+search=
You wanna keep going?
>>
>>52211878
Dynamic programming is obvious af though

It's basically the same idea as storing pi to a few decimals instead of computing it again and again
>>
>>52211883
def meme(string):
return string * -1
>>
>>52212139
Yes
>>
>>52212142
You're thinking of memoisation. Dynamic programming just takes memoisation as a building block. Memoisation itself is really intuitive, I agree, but seeing dynamic programming patterns often isn't.
>>
>>52212128
"O"
>>
>>52212039
Daily reminder MIT considers dynamic programming advanced
>>52211851
>>
>>52212164
I'm not that guy though.
>>
>>52212159
It's just applying that idea dynamically
>>
>>52212162
>perfect
>>
>>52212106
That's not so bad I guess. When does the capture occur? It seems unnecessary in your example.
>>
>>52212201
Close enough.
>>
>>52212100
i don't care. i had a look at the courses offered by both mit and berkeley and berkeley is clearly superior. those rankings don't say anything. (eg: https://en.wikipedia.org/wiki/List_of_Turing_Award_laureates_by_university_affiliation)
>>
>>52212194
Agreed, much like quantum mechanics is just analysing matter.
>>
>>52212205
It happens as soon as
let c = b.doThing()
is called.

struct MyThing {
var a = 0

func doThing() -> () -> Void {
return {[num = a] in
print(num)
}
}
}

var b = MyThing()
let c = b.doThing()
b.a += 1
c() // 0


struct MyThing {
var a = 0

func doThing() -> () -> Void {
return { print(a) }
}
}

var b = MyThing()
let c = b.doThing()
b.a += 1
c() // 1
>>
>>52211821
kill yourself web fag
>>
>>52211883
>>52212025
not funny
>>
>>52212242
Oh, I see now. Neat.
>>
>>52212260
Web dev is welcome here, go shitpost elsewhere, m8.
>>
>>52212169
so? MIT is overrated as fuck. bunch of sperglrods
>>
>>52212287
literally fuck off to >>>/g/wdg

fucking retard kill yourself

you are not a programmer, you're nothing but a coder
>>
File: de.gif (184 KB, 300x169) Image search: [Google]
de.gif
184 KB, 300x169
How do I learn JS, /dpt/?
>>
>>52212299
You must be really mad.
>>
>>52212322

>>>/g/wdg
>>>/vg/agdg
>>>/g/sqt
>>>/lgbt/
>>
>>52212320
>you are not a programmer, you're nothing but a coder
They're the thing, baka.
>>
>>52212320
>>52212332
I wish you would go back to >>>/b/, anon. You're just making /dpt/ uncomfy with your autism.
>>
>>52212322
Are you the anon who keeps asking how to learn JS on a daily basis?
>>
>>52212320
>programmer != coder
what is supposed to be the difference?

captcha: aroused midnight
>>
>>52212354
kill yourself

74% of /dpt/ agrees

https://strawpoll.me/6398631
>>
>>52212354
I recognise that image, it's cheese pizza. She's not wearing underwear.
>>
File: ew.png (272 KB, 470x624) Image search: [Google]
ew.png
272 KB, 470x624
>>52212362
N-no.
>>
>>52212366
a programmer develops programs

a coder writes code, like scripts and markup
>>
>there are people in this thread RIGHT NOW who think the language used is relevant

these first timers are so cute with their c tutorial under their belt and thinking they are hardcore
>>
>>52212393
>there are people in this thread RIGHT NOW who think python/javascript/haskell/lisp is relevant
>>
File: what the fuck is this.png (414 KB, 403x587) Image search: [Google]
what the fuck is this.png
414 KB, 403x587
>>52212377
>Lying on the internet
>>
>>52212411
>implying they're not
>>
>there are thread in this people NOW RIGHT who python/javascript/haskell/lisp relevant is think
>>
>>52212415
reported to the cyber police
>>
>>52212415
How do you know she's wearing underwear?
>>
>>52212429
ebin
>>
>>52212386
How is a script not a program?
>>
>>52211530
x,y = y,x
>>
>>52211655
this. desu anime needs to be purged from 4chan as the last remaining cancer of a dark, forgotten era.
>>
>>52212464
Because it cannot run on its own.
>>
writing a perl script which scrapes a business directory and compiles the information (phone, email if available, name, address, province and city) into a csv.

did it for the yellow pages too. i know you shouldn't parse html but fuck the police.

this one is neat because unlike before it doesn't download all the html files into a folder, compile them, remove them and parse, and it accurately gets all of the listings on every page. using hashes too, so it's comfy.
>>
>>52212464
It doesn't have enough semicolons.
>>
>>52212481
>perl
>>
>>52212479
pretty much nothing can run on its own nowadays. you know, having a kernel underneath is pretty useful.
>>
>>52212501
Saw that coming.
I've been using perl since you were still in training bras. I like how hacky it is. it also doesn't whine about my indentation.
>>
>Is JavaScript and back-end web programming languages welcome on /dpt/?

http://strawpoll.me/6439718
http://strawpoll.me/6439718
http://strawpoll.me/6439718
http://strawpoll.me/6439718
>>
>>52212520
>I use perl because it has these negative qualities that I like
>I like perl because it's worse
>I deliberately make my job harder because I find it fun
>I am the one they talk about when they use the words "full retard"
>>
>>52212459
I was referring to the cheese pizza claim, anon.
>>
>>52212534
it literally belongs in >>>/g/wdg
>>
>>52212555
it could be part of a set of images
>>
>>52212479
Unless you write machine code directly, nothing can run on its own.
>>
i started c++ a week ago, as a running first project im making a tamagotchi.

so far i can name, and have simple methods for happy hungry and sleepy, and make it say woof and shit, but its far from playable. hopefully i learn how timers work soon
>>
>>52212578
Doesn't look anything like an image part of a CP album.
>>
>>52212578
It's from

https://www.youtube.com/watch?v=4HSAgOks_wk
>>
>>52212552
sweet opinions, champ.

What seems more likely, not forcing indentation is negative, or you're just jumping on the 'perl is bad' bandwagon because memesnake is so hip and cool!

worse than... ?

it isn't harder than learning an entirely new language when i'm already proficient in this language. this needs to be done fast.

nice ad hominem.

back to importing your programs, chief.
>>
>>52212626
Says the expert.
>>
>>52212534
I don't see why not, everything else is welcome here from traps to anime.
>>
>>52212647
I can't confirm nor deny.
>>
SongList.Where(x => x.SongAlbum == lstAlbum.Items ).Select(x => x).Distinct().ToList();


How in the hell do I query my lstBox full of items and get every song pertaining to those albums?
>>
>>52211127
>Not linking the old thread AND being a fucking weeb
Why do you pathetic excuses for men not kill yourselves?
>>
>>52212697
I don't get on with the OP of the other thread.
>>
>>52212641
>What seems more likely, not forcing indentation is negative, or you're just jumping on the 'perl is bad' bandwagon because memesnake is so hip and cool!
didn't say anything about forced indentation, chieftan. projecting?

>it isn't harder than learning an entirely new language when i'm already proficient in this language. this needs to be done fast.
>my language is shit but I refuse to change because learning is scary
good one, honcho.
>>
Can someone explain to me why some people think that negative numbers actually exist?
>>
>>52212768
They don't, they're just useful for representing data.
>>
>>52212768
because my bank roll is negative.
>>
>>52212768
define existance
>>
>>52212795
Yeah, but that's what the side that defended negative numbers were a meme was saying a few threads ago. The others were implying that negative numbers actually exist, which I find too retarded to even understand
>>
>>52212731
I only script when things need to be done fast, and perl great for parsing information. I use C otherwise. back2import.
Your 'negative' comment was either about forced indentation or being hacky. either way, back2import.

You have nothing of value to add. I posted what I'm working on, you posted boring attempts at memelording. Have a good one.
>>
>>52212768
If negative numbers don't exist then numbers themselves don't exist.
>>
>>52212820
He means you can't have a negative number of things, which is correct, but we use negative numbers to represent data (.e.g. -5 meters above sea level) which just translates into (5 meters below sea level), but it's useful to keep the same reference point when referring to data.

So, if negative numbers are a meme, it is a useful meme.
>>
>>52212898
1 2 3
>>
>>52212671
SongList.Where(song => lstAlbum.Items.Contains(song.SongAlbum));
>>
>>52212898
You can hold a positive number of things in you hand, you can't can't hold a negative number of things in you hand.

>>52212912
That's a silly way of proving it, anon. He could just reply with -1, -2, -3.
>>
>>52212904
>He means you can't have a negative number of things
ambiguous definition, you can have a negative amount of money. you can have a negative amount of charge.
>>
>>52212968
>You can hold a positive number of things in you hand

That's only because the meaning we have given positive numbers applies to that situation. Numbers themselves don't inherently have any existence outside the realm of symbolism.
>>
>>52212987
>you can have a negative amount of money
no you can't, you just have a positive amount of money that you owe to someone else
>>
>>52212987
>you can have a negative amount of money
No you can't, you can owe somebody money you don't have. Using negative numbers is just a neat way to represent it.

>you can have a negative amount of charge.
A substance that gains electrons becomes negatively charged, while a substance that loses electrons becomes positively charged.

A substance never has a negative number of electrons.
>>
>numbers exist
Lay of the drugs for a while
>>
>>52213046
>no you can't, you just have a positive amount of money that you owe to someone else
that is the definition of a negative amount of money. it sounds like you can't explain what you mean because you don't even understand your point.

>>52213047
>A substance never has a negative number of electrons.
It has a negative amount of charge though. you're trying to shift the goalposts by changing the subject from charge to electrons.
>>
>>52213109
>that is the definition of a negative amount of money
so the definition of "negative" relies on "positive", meaning that negative numbers don't actually exist, they're just a nice way of separating positive numbers being used for different purposes
>>
>>52213133
you can apply the exact same logic and say that positive numbers don't actually exist.
>>
>>52213145
at which point you've just redefined the meaning of positive to negative and vice-versa, rendering the entire exercise pointless
>>
What is the best library for c to do visual stuff?
(by visual I mean anything apart from console applications)
>>
>>52213109
>It has a negative amount of charge though. you're trying to shift the goalposts by changing the subject from charge to electrons.
The charge refers to the number of electrons it gains or loses. It can never have a negative number of electrons.

Negative numbers are just a useful way to represent data, you can never physically have a negative number of things.

You can have a positive number of things, but never a negative number of things.
>>
>>52213277
If I have -500 dollars on my account, that means I owe the bank 500 dollars.
>>
>>52213264
OpenGL or Cairo or SDL or GTK depending on what you want
>>
>>52213191
exactly. the clear result is that positive numbers are no more valid or real than negative numbers.

an ill thought through statement like "negative numbers don't actually exist" or "positive numbers don't actually exist" is just a lack of understanding of the nature of numbers. this is apparent when you ask for a clear and unambiguous (I won't even bother to use the word rigour) statement of their point. it always boils down to dumb examples and dumb bullshit.
>>
>>52213291
Yes, you owe the bank 500 dollars you don't have. The minus is just a neat way to represent that.
>>
>>52213277
If I have -500 dollars it means even if I got 500 dollars it would be taken away, leaving me with 0. If negative numbers were a "meme" then I would have 500
>>
>>52213277
>You can have a positive number of things

That does not mean positive numbers exist. I can define two new words foo and bar, someone who is "foo" means they have an apple, "bar" means they do not. Does that mean the state of foo exists and bar does not?
>>
>>52213317
they're just more valid because they're the ones we used to create the negative numbers, if it had been the other way around then positive numbers would be less valid, but, as it stands, negative numbers are a meme
>>
>>52213336
The minus represents that you owe the bank 500 dollars, it doesn't actually mean you have -500 dollars.

Put two coins on your desk in front of you, anon. Now take three of them away. It's just madness.

People need to understand that although minus is useful for representing data, it's just an abstract idea.
>>
>>52213459
>it's just an abstract idea

As are positive numbers.
>>
>>52213483
Positive numbers can be used to refer to things that exist, negative numbers can't.
>>
>>52213521
So? The numbers themselves do not, hence being abstract.
>>
File: 123746786235.jpg (32 KB, 312x346) Image search: [Google]
123746786235.jpg
32 KB, 312x346
I'm developing an exchange website for a niche mmo I'm playing with django/python/sql.

There's no centralized marketplace, so all trading happens at player shops or player to player. Besides commodity raw materials, the economy runs almost entirely off player-crafted items which are so highly customized that players basically have to requisition anything they actually want directly from a crafter as it's not just a sword, it's a sword with these runes and this enchantment etc..

This creates a space for an exchange between crafters and buyers to connect the two rather than everyone spamming trade chat on a one in a million chance the crafter with the patterns to make exactly the custom item you want is online, paying attention to trade chat, and willing to craft it for a price you can afford.

The way it works right now is crafters can contact me for an account (I want to do a little vetting), and then they log in and their profile has a big list of every pattern that mirrors the way it's laid out in game, so they can go through and check off every pattern they can make (these map to arrays where every pattern has its own index number). Then on the other side buyers can custom order an item they want made and the price they're willing to pay for it (it stores these as an array of ints that map to each of the patterns). The crafters then see all buy orders for items they are capable of making, and if they are willing to do it for that price, they claim the order and it disappears from the list.

Now I'm in the process of adding an order fulfillment element that will show when their buy order has been claimed by a crafter, and when the item is ready and which shop to pick it up. My major problem is I don't have access to in-game information at all, so it's impossible for me to know which shops have open space available for crafters to post up the completed orders.
(Cont'd)
>>
>>52213565
Ignoring numbers entirely.

You can add items to an empty list.

You can't take away items from an empty list.
>>
>>52213647
You can't add items to a full list.

You can take away items from a non-empty list.
>>
>>52213674
>You can't add items to a full list.
>You can take away items from a non-empty list.
Correct. We've found something we agree on.
>>
File: tear.png (39 KB, 130x199) Image search: [Google]
tear.png
39 KB, 130x199
>>52213635
So in trying to figure out a decent way to allocate crafters posting up the items for sale, I've had a few different ideas but I'm open to hearing others.

Idea #1: Periodically rotate which of my shops I tell the crafters to post it
Idea #2: Fill a shop 3/4 full and rotate to the next shop hoping that by the time it gets back around to the first shop the orders have all been picked up
Idea #3: Let the crafter figure out which shops have open space in-game, and rely on them to communicate the correct shop to the buyer (don't like this one)
Idea #4: Rotate to a new shop every time
>>
File: 74hc164.png (2 MB, 759x751) Image search: [Google]
74hc164.png
2 MB, 759x751
I'm trying to control a 8-bit shift register IC with an AVR microcontroller. I've connected a 7-seg. LED display into the outputs of the shift register. I'd like to drive some numbers on it so I tried the following function. However the LED display just shows the number 8 all the time. Any ideas and/or suggestions?

#define SREG_PORT PORTD
#define SREG_CLOCKPIN 2
#define SREG_DATAPIN 3

/* Drive an 8-bit shift register */
void SReg_Drive(unsigned char num) {
unsigned char i = 0;
unsigned char bit = 0;

/* Drive shift reg. clock pin to "0" */
SREG_PORT = (SREG_PORT & ~(1 << SREG_CLOCKPIN));

/* Loop through the 8 bits of input byte */
for (i = 0; i < 8; i++) {

/* check if bit #i of input is "1" or "0" */
bit = (num & (1 << i));

/* if "1" set shift reg. data pin high */
if (bit == 1) {
SREG_PORT = (SREG_PORT | (1 << SREG_DATAPIN));

/* if "0" set shift reg. data pin low */
} else {
SREG_PORT = (SREG_PORT & ~(1 << SREG_DATAPIN));

}

/* Set shift reg. clock pin high, wait and set back to low */
SREG_PORT = (SREG_PORT | (1 << SREG_CLOCKPIN));

Delay_ms(1);
SREG_PORT = (SREG_PORT & ~(1 << SREG_CLOCKPIN));

}

}
>>
>>52213674
And that brings us back on to the "infinity is a meme" meme.

Nice.
>>
>>52212260
>>52212287
>>52212320
Java is statically typed and the GOAT language for webdev back-end

the guy you're talking to is probably a nodeshitter
>>
Negative numbers may not exist, but they help by relating real world values with values of debt or depth. If we didnt use negatives, real life calculations would take a bit longer to explain (I have 1000 real dollars but I also have 5000 dollars of dept)
this argument is stupid because much of math is concept made relatable to other numbers.

>>52213771
I dont think anyone at all argues that infinity is quantifyable though
>>
If I was making a game, how would I go about making a computer opponent?
I'm thinking it should try to simulate 3 turns ahead and try to pick the optimal choice without explicitly knowing what all the variables is.
Easy difficulty will have a 1:3 of a "lapse of judgement" where it simply does something random to simulate dumbness.
Medium should be dumb 1:6 of the time.
Hard 1:12 of the time.
And expert should cheat by knowing all the variables, even if you don't know them.
>>
>>52213855
Like I said, they're useful for representing data.

If you're going in a forward direction at -3mph you're going backwards.
>>
>>52213917
I agree.
That was my first post.
>>
>>52211530
section .data

Msg: db "Hello World!",10
MsgLen: equ $-Msg

section .bss

section .text

global main

main:
mov rax, 4
mov rbx, 1
mov rcx, Msg
mov rdx, MsgLen
int 80H

mov rax, 1
mov rbx, 0
int 80H
>>
Is this the daily programming thread or the daily philosophy thread?
>>
>>52213708
I don't get it senpai. What exactly are shops? Do you consider your webshop to be a shop or is it an in-game building?
>>
>>52214039
D programming thread actually
>>
>>52214069
You're mistaking, it's the Go programming thread.
>>
>>52214049
A shop is an in-game building, it can hold 30 items for sale at a time. I can white-list other people to be able to post items in my shops, and then I take a commission on the sale.
>>
>>52214126
Uh, anon, it says /dpt/, not /gpt/
>>
>>52214137
All of your ideas will fail if no orders have been picked up. Isn't there a way to tell if the buyer has picked up his/her item? You have to know the amount of free slots in order to assign a crafter to one.
>>
Why dont we store all integers as null terminated char arrays?
They take up less space at higher number values.
>>
>>52214265
No they don't.
>>
>>52214265
Because it would be a bitch to work with them then.
And didn't you learn your lesson about null-terminated arrays from C?
>>
>>52214264
There's no communication available between the game servers and my website, so manually looking at the shops is the only way to tell which have open spots. It's unlikely that the shops would completely fill from derelict orders, but I want to avoid a situation where one shop filled up due to a systemic issue while the others are mostly empty and now I have the website telling a crafter to post an item to a full shop.
>>
>>52211530
\lambda x.x+y
>>
We need an al gore rhythm to fix climate change.

r8 my joke
>>
>>52214404
idungedit/10
>>
Threadly reminder that you should not refer to the act of programming as coding. It is improper and makes you look like a 15 year old

You are a programmer, not a coder

Software Alchemist is GOAT
Developer is okay
Magician is okay
Software Engineer is okay
Software Architect is okay
>>
>>52214332
Like in #2, add an error margin to your shops for those edge cases. Manually sync the amount of free/occupied slots in the shop by checking in game every once in a while.
Isn't there a way for the crafter/buyer to report back to the website that the item has been picked up?
>>
>>52214454
What's the difference between programming and coding?
>>
>>52214404
Solid 4
>>
>>52214585
Women code, men program.
>>
Can some one please explain to me how the remove function in this example is working?

http://will.thimbleby.net/algorithms/doku.php?id=hash_table

it seems that if I try to remove a value, it performs the hash funciton, finds where my value fits in the hash table, then performs the hash function on it, recursively and never endingly. Am I missing something? are two remove function being used? one made by him and the other some js remove funtion?

please help
>>
>>52211526
dynamic is the future
accept it
>>
>>52214608
That sounds sexist.
>>
>>52214633
>dynamic is the future
>basically all recent programming language developments have been about using types to enable more optimizations and/or make the language safer
>>
>>52214623
/**
* Creates a new HashSet.
* @constructor
* @param {number} [capacity=10] - The initial capacity of the set.
*/
function HashSet(capacity) {
this.array = Array(typeof capacity === "number"? capacity : 10);
}

HashSet.prototype = {
/** Inserts numeric/string `data` into this hash set. */
insert: function(data) {
// Hash the data to get a slot.
var slot = this.hashData(data);

// Insert the data into that slot.
if (!this.array[slot]) {
this.array[slot] = new LinkedList();
}
this.array[slot].insertOrderedUnique(data);
},
/** Removes `data` from this hash set. */
remove: function(data) {
// Hash the data to get a slot.
var slot = this.hashData(data);

// Remove the data from that slot.
if (this.array[slot]) {
this.array[slot].remove(data);
}
},
/** Hash `data` with respect to its type to get a slot. */
hashData: function(data) {
var dataHash;
if (typeof data === "number") {
dataHash = data;
}
else if (typeof data === "string") {
dataHash = fnv1aHashString(data);
}
else {
throw "Unsupported type (not string/number) in HashSet."
}
return Math.floor(Math.abs(dataHash))%this.array.length;
}
}


It hashes the data to get a slot, then it removes the data from that slot.
>>
>>52211930
Traceback (most recent call last):
File "<pyshell#3>", line 1, in <module>
print stringLessThanZero()
File "<pyshell#1>", line 2, in stringLessThanZero
return ''/0
TypeError: unsupported operand type(s) for /: 'str' and 'int'
>>
>>52214708
Yeah thanks. I know that it's removing the data from the slot it hashes to, my only issue is that this line

this.array[slot].remove(data);


Isn't it just recursively running the remove function? Or is it running another function by the same name? I have zero experience with javascript, so I really don't know what I'm missing
>>
>>52214802
Different function, same name. Each slot is a linked list, and that remove function is operating on the list.
>>
>>52211127
Do you guys consider

http://pastebin.com/pryifcYw

Stuff like that completely newbie level or is it somewhat intermediate ?

You are supposed to do them on C#.

I did them all, but I spend 4 hours after the 3 onward. I have no CS background or whatsoever, just doing online courses and reading books in my free time for 3 months now, mainly doing C# and javascript(i know i know)
>>
>>52214487
Asking the buyer to hit a button when they pick it up creates more problems than it solves. They can hit the button and not pick it up; they can forget to hit the button after they pick it up. The crafter confirming it creates similar problems, although they are more reliable. The idea is to minimize the effort on both sides for the transaction to make it as frictionless as possible.

I could manually sync it up, but then the fault point becomes how often I log in and do that, and if I implement that then I'll end up buying more shops just so I can go longer without logging in.

Another problem is when a crafter is trying to do a bunch of orders at once. If I tell them to post all their orders to one shop then I get a problem of stacking all on one shop, and alternatively telling them to travel to each shop to post 1 item is a big hassle for them too.

The only feasible solution with no effort on either side is to have so many shops that any systemic problem I could iron out manually once a week or so. I have to pay for the shops once a week, so it creates lost opportunity whenever they sit empty. The only complete solution is to have the crafter decide where to post it, and have him put that into the website. I believe crafters might be willing to do that since if they don't tell the buyer where to pick it up, the sale won't happen.
>>
>>52214831
Okay thanks a lot, that's what I thought but not knowing was driving me up to the wall.
>>
>>52214404
guilty kek
>>
>>52214454
How about Software Aristocrat?
>>
>>52214835
completely newbie level
>>
the feelings when your whole family is profession X but you just like computers
>>
>>52214835
Definitely beginner.
>>
>>52214886
>>52214896
How/when does one gets better ?
For the last few weeks I've been doing 10-15 exercises everyday and I keep forgeting basic syntax and doing stupid errors in the logic.

What is the normal time to solve a problem like that ? Do I have to give up programming ? Am I too stupid ?
>>
>>52213757
> However the LED display just shows the number 8 all the time.
How often does the number change? If it changes quickly enough, you'll just see all of the segments illuminated.
>>
>>52214970
>How/when does one gets better ?
Become obsessive with being better

>What is the normal time to solve a problem like that ?
Speed is not a relevant factor in learning

>Do I have to give up programming ?
No

>Am I too stupid ?
We all are
>>
>>52214970
This is about chapter 4 or so in textbooks
ch1 being defining programming, or hardware background
Ch2 being variables or datatypes
ch3 being if and ifelse statements
and finally ch4 or so being loops and conditionals
this was second or third week in my highschool cs course
>>
File: 4L_FvuqyU7a.jpg (70 KB, 539x960) Image search: [Google]
4L_FvuqyU7a.jpg
70 KB, 539x960
>>52211166
My issue with dynamically typed languages is this: computers are fast but ultimately stupid. Many programmers who are starting out have issues with just how direct they have to be when programming, as we take our intuition for granted. Computers have no intuition; they only know what you EXPLICITLY tell them. Dynamically typed programs give the computer the choice to decide some pretty important decisions, which often leads to inefficient results and (in my experience) broken code.

>array of integers in a loop
>numbers being added to and removed from array
>array methods being called on what the computer decided was an array, since I defined it as a group of elements in brackets
>at some point, get down to one integer in the array
>computer decides it's no longer an array of integers, just a single integer
>program crashes because it's calling array methods on an integer

This actually happened.
>>
>>52214970
it's normal to take long in the beginning

and it'll still be normal to take long later on when you tackle harder and harder problems

maybe start working on a slightly bigger project of your own and put the little bits and pieces together until you have more of an actual program
>>
>>52215154
This
I never learned shit until I did my own projects. Still intermediate
>>
>>52215126
>>52215154

Thanks, you really motivated me.
>>52215131
Well, I followed the libart meme tier (won a scholarship so it was free) and ended up being useless. I hate modern art now... and I hate all the "designers" just following the next flat trend. But I can't get my time back, so I guess I am better off learnign new stuff that are interesting and actually can provide something useful in the longrun
>>
>>52215134
What language? Normally objects in a dynamically typed language don't change their type on a whim.
>>
>>52214970
I'm not really sure how long it'll take. I remember that I was so used to expecting syntactic errors every time I compiled some code, and become shocked when I began to write code and have it compile properly 90% of the time. Once I was over that hurdle, I had to deal with the fun stuff: Logic errors

Protip: you never get over that hurdle
>>
>>52215202
Free is good. I used to be an 'artist' myself then i switched career choices around midway through highschool.
Cs can stil be creative while still being structured so there's a good reason to stick around and learn to love it.
>>
File: eee.png (241 KB, 645x363) Image search: [Google]
eee.png
241 KB, 645x363
What are some newish programming books I should buy, /dpt/?
>>
Asked this on /sqt/ but got no replies
I have to make a quiz using windows form application and one of the requirements is to randomise the order of the radio buttons every time the quiz is loaded. I can only do this for a checked list box but for the life if me cant figure it out for radio buttons. How can I do this?
>>
>>52215291
Whats your skill level?
>>
>>52215217
JavaScript.

Yeah, neither did I, but then it happened. I showed my TA and some class mates, and everyone was confused as to what the hell happened. On each iteration, I began to print the type of the array while keeping track of what was being added or removed, and it would say "object" up until it was down to one element, at which point it said was a number. It may have just been a freak accident. I've had weird shit like this happen in all kinds of languages, even statically typed ones.

In Java, I had the wrong answer given for some arithmetic process using the Integer class (was using lists) for about 1 out of every 20 tests I passed in, and it fixed everything when I used the intValue method to get primitive values instead.
>>
>>52215299
Google Code in task?
>>
>>52215291
Parents got me Python Crash Course (2015) and I like it so far. Excercises are lacking but I don't mind that.
>>
File: fun.png (61 KB, 640x480) Image search: [Google]
fun.png
61 KB, 640x480
Being unproductive with SDL
>>
>>52215299
use an array
>>
>>52215202
>Thanks, you really motivated me.
No, this is not what you want. You don't want "motivation". "motivation" is a stupid buzzword to prop up children and losers. The time you're spending here asking us dumb questions about whether you're good enough to program or not would be better put to actually programming something, or reading a book, or talking about something programming related (even talking about one of /dpt/'s memes). Stop wasting time.
>>
Any programming related reading material you'd recommend?
I want to learn.
>>
>>52215404
python documentations
>>
>>52215291
http://www.amazon.com/Ruby-Programming-Language-David-Flanagan/dp/0596516177

Will really open your eyes about a "shitty" language
>>
>>52215321
That's an issue with weak typing, not dynamic typing.
>>
>>52215404
cppreference.com

opengl superbible
>>
I'm trying to write a generic makefile that can build any program that has its source code and make file within basedir/src/program_name and headers in basedir/include/program_name

This is what I have so far
%:: BASE=$(shell pwd)
%::
cd $(addprefix src/, $@) && \
INC=$(addprefix -I, $(addsuffix /include/$@, $(BASE))) \
LNK=$(addprefix -L, $(addsuffix /lib, $(BASE))) \
$(MAKE)
mv $(addprefix src/, $@/$@) bin/


A program is built using
make program_name


Anyone know of a cleaner way to do this?
>>
File: mother.chr.png (147 KB, 128x4096) Image search: [Google]
mother.chr.png
147 KB, 128x4096
A small script thats extracts sprites from nes roms
>>
>>52211530
#include <string>

bool status_eval(const std::string status)
{
if (status == "JUST")
{
return 1;
}
return 0;
}

int main()
{
const std::string my_status = "JUST";
return status_eval(my_status);
}
>>
>>52215527
>bool
>return 1;
>return 0;
>>
>>52215371
>>52215263
>>52215223
>>52215154
>>52215131
do you guys think, that if I do programming, even if its something small or stupid, but I do it with other ppl, helping each other with Ideas and so on... will that be better in any way ?
>>
>>52215404
https://github.com/NicolasT/papers
>>
>>52215339
Once I create the array how do I make them appear in random order?
>>
>>52215550
problem officer?
>>
>>52215550
i would like it if sepples had stronger typing like java tbqh
>>
>>52215570
yes, especially if you do a team project
>>
>>52215550
JUST
>>
>>52215570
nah you can do it on your own just fine

other people tend to slow you down

you can always come here for help
>>
>>52215572
shuffle the array

https://en.wikipedia.org/wiki/Fisher-Yates_shuffle
>>
>>52215570
Yes. Those programming dweebs you always see on campus talk 50% about anime and 50% about code
>>
>>52211127
I am working on a program to make myself white. So far it hasn't been working to well.
>>
>>52215622
>I am working on a program to make myself white. So far it hasn't been working to well.
Race isn't that important in men
>>
why do we even have asserts, g?

i mean you can write a macro that does the same thing in like 15 seconds. why ship this with the language?
>>
>>52215622
Why would you? As long as you aren't a women you are gold
>>
>>52215622
as long as you aren't indian, hispanic or south east asian you'll be fine anon
>>
>>52215550
That's valid.
>>
>>52215641
What lang?

In Hindley Milner languages you kind of have to have it as a built in because it needs to have the signature something like
assert : bool -> string -> 'a
, but ya usually it can just be made as a macro it's just that people would prefer to not write that macro and have it ship with the std lib because that's easy and works better across multiple projects (standardization is good)
Thread replies: 255
Thread images: 28

banner
banner
[Boards: 3 / a / aco / adv / an / asp / b / biz / c / cgl / ck / cm / co / d / diy / e / fa / fit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mu / n / news / o / out / p / po / pol / qa / r / r9k / s / s4s / sci / soc / sp / t / tg / toy / trash / trv / tv / u / v / vg / vp / vr / w / wg / wsg / wsr / x / y] [Home]

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.
If a post contains personal/copyrighted/illegal content you can contact me at [email protected] with that post and thread number and it will be removed as soon as possible.
DMCA Content Takedown via dmca.com
All images are hosted on imgur.com, send takedown notices to them.
This is a 4chan archive - all of the content originated from them. If you need IP information for a Poster - you need to contact them. This website shows only archived content.