• Hey, guest user. Hope you're enjoying NeoGAF! Have you considered registering for an account? Come join us and add your take to the daily discourse.

Programming |OT| C is better than C++! No, C++ is better than C

Are there any online resources for AI dev? Unlike everything else, there aren't really any "Paths" posted anywhere. My university has class and programs, but they're all upper-level and graduate courses and I'm kind of impatient.
 

Pau

Member
I cannot wrap my head around using classes with Tkinter or updating the GUI with user input in Python.

This is probably too long for anyone to really go over but basically what I'm trying to do:
1) Start off with a start screen that gives two options: a) type in a character's name to get some info about their social network b) type in two characters' names to get a list of issues they both appear in.
2) Once a user hits submit on one of the two options with a name in the entry box, "draw" a new page that holds all the info for that character's social network.

I have everything working as separate programs and separate GUIs but I can't figure out how to put it all together. Particularly, once I've gotten the character's name from the user, how do I use it to draw a new frame that will now show the social network info?

My code's really long so I feel bad posting about it in this thread, but if anyone wants to take a look at it let me know. :(
 

JesseZao

Member
Are there any online resources for AI dev? Unlike everything else, there aren't really any "Paths" posted anywhere. My university has class and programs, but they're all upper-level and graduate courses and I'm kind of impatient.

I just found a few books to read. There are probably some udacity or coursera courses on AI/Machine Learning. It's a field I want to get into eventually.
 

Jokab

Member
I cannot wrap my head around using classes with Tkinter or updating the GUI with user input in Python.

This is probably too long for anyone to really go over but basically what I'm trying to do:
1) Start off with a start screen that gives two options: a) type in a character's name to get some info about their social network b) type in two characters' names to get a list of issues they both appear in.
2) Once a user hits submit on one of the two options with a name in the entry box, "draw" a new page that holds all the info for that character's social network.

I have everything working as separate programs and separate GUIs but I can't figure out how to put it all together. Particularly, once I've gotten the character's name from the user, how do I use it to draw a new frame that will now show the social network info?

My code's really long so I feel bad posting about it in this thread, but if anyone wants to take a look at it let me know. :(

I can't help you with this problem specifically, but you can post long code pieces on http://gist.github.com.
 

Ledbetter

Member
My code's really long so I feel bad posting about it in this thread, but if anyone wants to take a look at it let me know. :(

If you want, you can PM me the code. I haven't used Tkinter that much, but I'll see what can I do.

Are there any online resources for AI dev? Unlike everything else, there aren't really any "Paths" posted anywhere. My university has class and programs, but they're all upper-level and graduate courses and I'm kind of impatient.

AI is very heavy on theory so first, I'd recommend reading Artificial Intelligence: A Modern Approach by Russell and Novig. I feel like it's the starting point for everyone who wants to get into that field. There's also a Coursera Machine Learning course that starts next week, if you're into that.
 

Ambitious

Member
Oh boy. Gonna have my first job interview next Wednesday. I hope I can keep my nerves under control, otherwise it's gonna be an embarrassing disaster.
 
It just looks bad because each call requires you to fill out a large structure of parameters. In reality you would wrap it all in a class so it's easy to use
 

Kieli

Member
Hey Gaf, I have a series of questions for you. I'm currently wrapping my head around several things.

Anyone know what the file extensions .msi and .sha256sum are for?

In C++, how come we can't recursively call the main function?
 
Hey Gaf, I have a series of questions for you. I'm currently wrapping my head around several things.

Anyone know what the file extensions .msi and .sha256sum are for?

In C++, how come we can't recursively call the main function?

Msi is a Microsoft installer package. Second sounds like it contains a sha256 checksum.

You can't call main recursively because the c++ language standard says so
 
Hey gaffers quick question do you guys recommend certification or degree and if this help any I'm looking to stay in the IT career path for MCSE solutions expert any advise is appreciated
 

Makai

Member
I really hate C# now. I can't believe it. Language of choice for years. Ready for something like Swift or F# to kill it.
 

vypek

Member
There are days when I am coding and I feel like I know absolutely nothing. Recently I've found that I'm not sure how to actually start making a large scale or more complex projects. I can debug and modify them in a tolerable fashion but can't start projects.
 

Makai

Member
Why? I still love it, although I almost never get to use it
I have a religious belief that variables are the devil. I love F# and think Swift is an acceptable compromise. I try to write stateless code at my day job but C# makes it so hard. My code generally ends up extremely testable because of it, but it sure is janky. Struct and readonly keywords everywhere. I wrote some extension methods for function currying and composition, but I can't get it to work with methods - just Actions and Funcs. No nested type aliases and I can only declare them in the header. No member bindings. If C# got discriminated unions and pattern matching I'd be a lot happier. Just do it like Swift does it and make it so I don't have to use the default case if I've matched every case.
 
I have a religious belief that variables are the devil. I love F# and think Swift is an acceptable compromise. I try to write stateless code at my day job but C# makes it so hard. My code generally ends up extremely testable because of it, but it sure is janky. Struct and readonly keywords everywhere. I wrote some extension methods for function currying and composition, but I can't get it to work with methods - just Actions and Funcs. No nested type aliases and I can only declare them in the header. No member bindings. If C# got discriminated unions and pattern matching I'd be a lot happier. Just do it like Swift does it and make it so I don't have to use the default case if I've matched every case.

Meh, I mean it sounds like you're trying to hit a square nail into a round hole. It's hard to write stateless code in C# because it's not really designed to be good at writing stateless code. State may very well be the source of a lot of problems as a general principle, but I'd argue that using languages incorrectly is a net negative. A better option would be to find a job where you can use F# or Swift instead of C#.
 

Jokab

Member
Tips on essential programming/software development books that don't address a specific language? So far I have (but not read) The Pragmatic Programmer and Gang of four.
 

JeTmAn81

Member
Tips on essential programming/software development books that don't address a specific language? So far I have (but not read) The Pragmatic Programmer and Gang of four.

I have been reading Clean Code by Robert C. Martin as well as Head First Design Patterns (that one may retread Gang of four material, not sure) lately and I recommend them both.
 

Makai

Member
Meh, I mean it sounds like you're trying to hit a square nail into a round hole. It's hard to write stateless code in C# because it's not really designed to be good at writing stateless code. State may very well be the source of a lot of problems as a general principle, but I'd argue that using languages incorrectly is a net negative. A better option would be to find a job where you can use F# or Swift instead of C#.
F#'s pretty unpopular. Not too easy to find that job. Swift is more plausible but I don't know the iOS API at all or want to lock myself into iOS development. Maybe after it goes multiplatform.
 

Slo

Member
Due to new ventures at work I am now going to learn Scala, pretty exciting actually.

Cool! How are they teaching you? Is it Spark? Play Framework, or something else? I'm looking to learn myself, but Scala adoption seems to be so low that there's not much of a community that I can find.
 
Cool! How are they teaching you? Is it Spark? Play Framework, or something else? I'm looking to learn myself, but Scala adoption seems to be so low that there's not much of a community that I can find.

By throwing me to the deep end! I have no idea of the actual implementation(s) yet so I'll have to get back to you on that after I familiarize myself.

Have you ever used a functional language before?

I am a JavaScript dev mostly and many of the modern paradigms in JavaScript are based on or benefit from functional programming so the concepts and their uses are pretty well known to me I guess. Overall I don't think that the change is going to be too drastic: modern JavaScript and Scala seem to share many of the concepts and are rather close in syntax so I am not too worried :)
 

hateradio

The Most Dangerous Yes Man
Due to new ventures at work I am now going to learn Scala, pretty exciting actually.
The Scala learning curve in words.

- Wow looks so easy
- Fuck Java!
- Wow, so many language features
- Wait what
- Wait what is that method again? #:: or #+ or #:
- Wait what do I pass to this fold?
- Oh crap, I should have just used a pattern match
- Fuck, what is this thing passing?
- FlatMap, FlatMap, FlatMap
- Keep it together, keep it safe, keep it immutable
- Fuuuuuuuu
- Actors -- is this real life
- Recursions forever


lightspeed-o.gif



Have fun! It's pretty cool in the end. :D


And since there was a discussion about C# and state, in Scala everything can be done in any way you want, which means you have a lot more options to fuck up and to make some amazing shit.

I am a JavaScript dev mostly and many of the modern paradigms in JavaScript are based on or benefit from functional programming so the concepts and their uses are pretty well known to me I guess. Overall I don't think that the change is going to be too drastic: modern JavaScript and Scala seem to share many of the concepts and are rather close in syntax so I am not too worried :)
JS doesn't follow the functional paradigm that closely, but you will see.
 

Pau

Member
Anyone here work with R? I'm trying to figure out how to bootstrap the proportion of a population from a simple sample, but I don't think I'm doing it right. All my resamples have seem to have the same exact proportion as my original sample. And I can't seem to find any example online that don't use R's boot package.

Code:
#Import the CSV file containing the data. Table of one column with value of 1 or 2
# 1 = Male; 2 = Female
# n = 925
gamingGender.data <- read.csv(file.choose())

#Calculate the sample proportion point estimate of video game players who are women
n = 925
w = sum(gamingGender.data == 2)
pbar = w/n
#Calcualte the standard error of the sample
se = sqrt(pbar*(1-pbar)/n)

#Resamples
N <- 10^4
#Resample vector
resample <- numeric(N)
resampleW <- numeric(N)
my.bootprop <- numeric(N)
x <- gamingGender.data
#Bootstrap algorithm
for (i in 1:N)
{
  resample <- (sample(x, replace=TRUE))
  #Number of women in resample i
  resampleW[i] = sum(resample == 2)
  #Proportion of women in resample i
  my.bootprop[i] = resampleW[i]/n
}
mean(my.bootprop)
 

Kieli

Member
Gaf, what debuggers do you recommend to parse C++ code?

I'm not using an IDE, so I don't have access to built-in debuggers. :\
 

luoapp

Member
Anyone here work with R? I'm trying to figure out how to bootstrap the proportion of a population from a simple sample, but I don't think I'm doing it right. All my resamples have seem to have the same exact proportion as my original sample. And I can't seem to find any example online that don't use R's boot package.

Isn't (sample(x, replace=TRUE)) just a permutation of x, therefore has the same exact proportion?
 

luoapp

Member
That makes sense, but then I should be resampling from where? A binomial distribution with p equal to the sample proportion?

No. I was wrong, (sample(x, replace=TRUE)) works as intended. Did you check my.bootprop or just the mean?
 

Pau

Member
print out resample and manually check. could be a bug.
I'm looking at the number of successes and yeah, they're all the same. So it's not just rounding... :(

I tried changing it to:
Code:
x <- rbinom(925, 1, (468/925))

And I actually get different samples, but I have no idea if that's a legitimate way of doing it.
 

luoapp

Member
I tried changing it to:
Code:
x <- rbinom(925, 1, (468/925))

And I actually get different samples, but I have no idea if that's a legitimate way of doing it.

No, it's not. You're generating a new set of samples.

This snippet basically does the bootstrap (unless sample here doesn't work either), still not sure what's wrong with your original code.

Code:
resample <- vector(mode="numeric", length=n)
for (i in 1:n)
{
  t <- sample(1:n, 1)
  resample[i]=x[t]
}
 
I dunno if this is enough context, but here goes.

I'm trying to swap two elements in an array in MASM.

The following code works:

Code:
pushad
 
	mov eax, [esp+40]
	mov ecx, [eax]
	mov ebx, [esp+36]       
	mov edx, [ebx]
	mov [eax], edx
	mov [ebx], ecx
	popad           
	ret 8

However, this code does not

Code:
push ebp
mov ebp, esp
 
	mov eax, [ebp+8]
	mov ecx, [eax]
	mov ebx, [ebp+12]       
	mov edx, [ebx]
	mov [eax], edx
	mov [ebx], ecx
	pop ebp           
	ret 8


The two should be equivalent but something is going very wrong.

edit: Apparently the value of ebx is getting corrupted. So saving it actually is important. Hmm. Good to know.
 
Top Bottom