Open Side Menu Go to the Top

11-13-2012 , 09:09 AM
Quote:
Originally Posted by Xhad
The CEO of zynga has outright admitted into tricking kids into doing things like installing malware and adding charges to their parents' phone bills. Pincus makes zynga really easy to hate imo.
I didn't know this. This seems like a fair reason to consider them evil.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD **
$25m Guaranteed WPM on CoinPoker
Join the action now
Daily Rewards • Splash Pots • CoinRaces
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD **
11-13-2012 , 09:05 PM
hey guise

so maybe like 5 years ago i used to program in highschool as a hobby, knowing basic VB, C, C++ pretty much enough to make basic applications such as calculators and basic games etc.. recently i started getting back into my old online communities and realized how much i missed it..

i want to get back into it as a hobby. just as a heads up has anything big happened in 5 years? I've been really left out of the loop.. whats the most prevalent coding used for mac applications nowadays?
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
11-14-2012 , 12:29 PM
Amazon S3 now supports archiving/retrieval to/from Glacier ($.01/GB cold storage).
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
11-15-2012 , 02:30 AM
I asked about the performance difference between v8 js and java for doing array lookup based hand evaluation a little while ago.

I finally did some tests tonight and got an answer, thought some of you might be interested. v8 is about 10x slower than java, at least on my laptop.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
11-15-2012 , 05:23 AM
anyone know where i can find a version of poker-eval as a .dll file with some docs? i just want to be able to evaluate hands by calling some dll functions from AHK
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
11-15-2012 , 05:29 AM
Quote:
Originally Posted by greg nice
anyone know where i can find a version of poker-eval as a .dll file with some docs? i just want to be able to evaluate hands by calling some dll functions from AHK
Check the windows FPDB package and our downloads directory. Gimick compiled this for our distribution at some point in history.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
11-15-2012 , 04:27 PM
Quote:
Originally Posted by greg nice
anyone know where i can find a version of poker-eval as a .dll file with some docs? i just want to be able to evaluate hands by calling some dll functions from AHK
Depending on what you're doing, you might have it a bit easier than raw poker-eval with psim.dll from here: http://www.pokerai.org/pf3/viewtopic...b0be68608dd371 there's a nice AHK GUI full of examples
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
11-15-2012 , 07:47 PM
I've sort of finished the first chapter of K&R, and I'm not quite feeling the love that is rained on the book. I guess it feels a tad incomplete in the initial areas...

I have a question that has been bothering me. Basically, they give a few examples, including this code and a few alternatives:

Code:
#include <stdio.h>

main (){
     int c;
     
     c = getchar();
     while (c != EOF){
           putchar(c);
           c = getchar();
     }
}
There's a problem, and it probably spikes out into several issues. For those who don't know what it does, this code takes your input and prints it back on the screen:

Code:
~\cfiles>filecopy.exe
a
a
b
b
a;lskdjfklasjfd
a;lskdjfklasjfd
According to the book, EOF is valued at 0 or 1?

Quote:
EOF is an integer defined in <stdio.h>, but the specific numeric value doesn’t matter as long as it is not the same as any char
value. By using the symbolic constant, we are assured that nothing in the program depends on the specific numeric value.
Quote:
Exercsise 1-6. Verify that the expression getchar() != EOF is 0 or 1.
Exercise 1-7. Write a program to print the value of EOF.
1.5.2 Character
Obviously (?), I can exit the program with ^C, but that isn't satisfactory. Is this information out-dated, or am I missing something obvious?

The result of this is interesting:

Code:
#include <stdio.h>

main (){
    printf(EOF);
}
Code:
~\cfiles>gcc test.c
test.c: In function 'main':
test.c:4:5: warning: passing argument 1 of 'printf' makes pointer from integer w
ithout a cast [enabled by default]
c:\mingw\bin\../lib/gcc/mingw32/4.6.2/../../../../include/stdio.h:294:37: note:
expected 'const char *' but argument is of type 'int'
There is a slight hint from the book. They give this piece of code:

Code:
#include <stdio.h>

main(){
	int c;
	while ((c = getchar()) != EOF)
	putchar(c);
}
And this explain why this code I wrote is dangerous:

Code:
#include <stdio.h>

main(){
	int c;
	while (c = getchar() != EOF)
	putchar(c);
}
Quote:
The parentheses around the assignment, within the condition are necessary. The precedence of != is higher than that of =,
which means that in the absence of parentheses the relational test != would be done before the assignment =. So the statement
Code:
c = getchar() != EOF
is equivalent to
Code:
c = (getchar() != EOF)
This has the undesired effect of setting c to 0 or 1, depending on whether or not the call of getchar returned end of file.
(More on this in Chapter 2.)
Now I'm not even sure if that code is anything worthy anyways. I try to compile and get no errors, but no .exe file either?
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
11-15-2012 , 08:34 PM
Dave,

Are you taking cs50x too? If you're just starting C you might want to use clang as a compiler instead of gcc. It supposedly has much more human readable errors and has similar features to gcc.

I only know what I know from a bit of cs50x but I think you need to pass a string to printf and pass variables like so:

Code:
printf("The EOF value is: %d", EOF);
In the above case you're saying you want to output an int as %d and it gets replaced with the value of EOF. Since a string in C is nothing but an array of chars that might explain the warning? We haven't even worked with real strings yet, they gave us a helper lib that mimics a "string" type.

Last edited by Shoe Lace; 11-15-2012 at 08:39 PM.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
11-15-2012 , 08:48 PM
I was originally using Dev C++ but I decided I'd like to learn how to do raw compilations for a bit especially since what I'm doing right now is rather simple, I didn't know how to compile files, and I'd rather set it up in Emacs. IDE's get on my nerves.

The question has nothing to do with "how to debug."
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
11-15-2012 , 09:01 PM
Quote:
Originally Posted by daveT
I was originally using Dev C++ but I decided I'd like to learn how to do raw compilations for a bit especially since what I'm doing right now is rather simple, I didn't know how to compile files, and I'd rather set it up in Emacs. IDE's get on my nerves.

The question has nothing to do with "how to debug."
clang has nothing to do with an IDE. You can think of it as gcc except with non-cryptic error messages.

Read this marked answer:
http://stackoverflow.com/questions/8...e-and-contrast
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
11-15-2012 , 09:06 PM
Quote:
Originally Posted by daveT
I've sort of finished the first chapter of K&R, and I'm not quite feeling the love that is rained on the book. ...
You mean "The C Programming Language", circa 1988? Then yeah, you're talking about a rather ancient love. Much of whats in that book is going to be considered pretty anachronistic by modern standards... in fact a lot of the syntax in that book will have been deprecated by modern c/c++ compilers.


Quote:
...
According to the book, EOF is valued at 0 or 1?
...
No, they actually do mean the value of the *expression* (getchar() != EOF) must be equal to either 0 or 1.


Quote:
Obviously (?), I can exit the program with ^C, but that isn't satisfactory. Is this information out-dated, or am I missing something obvious?
Its just old. You're living in an iOS-era world, reading a vt102-era book.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
11-15-2012 , 10:06 PM
dave,

^d sends eof in (most) unix terminals. i think on windows it's ^z<ENTER>.

jason,

i don't really want to debate it but i think you write off k&r c too readily. old or new, i've yet to see a primer on C that is as elegant as k&r's original.

Last edited by tyler_cracker; 11-15-2012 at 10:07 PM. Reason: ^ = CTRL in case that's not obvious
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
11-15-2012 , 10:58 PM
I already knew a bit of C when I read K&R but I remember it really helped solidify some concepts for me. It's been a while now, but its treatment of pointers was particularly good IIRC. I really liked the book even if some of is a bit out of date now.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
11-16-2012 , 12:38 AM
oh, I didnt mean to imply there's anything bad about k&r... its just that if you use it as your source of C knowledge, you'll end up with bunch of stuff that you'll just want to un-learn: old-school function parameter syntax, "typedef struct...", old for-loop scoping rules, and all that kind of thing.

its all good... I'm not looking for a debate either... if I was I would have ended with "at least its still better than Java".
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
11-16-2012 , 02:53 AM
Quote:
Originally Posted by Shoe Lace
Dave,

Are you taking cs50x too? If you're just starting C you might want to use clang as a compiler instead of gcc. It supposedly has much more human readable errors and has similar features to gcc.

I only know what I know from a bit of cs50x but I think you need to pass a string to printf and pass variables like so:

Code:
printf("The EOF value is: %d", EOF);
In the above case you're saying you want to output an int as %d and it gets replaced with the value of EOF. Since a string in C is nothing but an array of chars that might explain the warning? We haven't even worked with real strings yet, they gave us a helper lib that mimics a "string" type.
That compiles but doesn't create a .exe file. I'm really not liking this.

Code:
-*- mode: compilation; default-directory: "~/Desktop/cfiles/" -*-
Compilation started at Thu Nov 15 22:13:19

gcc test.c

Compilation finished at Thu Nov 15 22:13:19
Quote:
Originally Posted by Shoe Lace
clang has nothing to do with an IDE. You can think of it as gcc except with non-cryptic error messages.

Read this marked answer:
http://stackoverflow.com/questions/8...e-and-contrast
Neither of those look to promising tbh. Java error messages are easier to read than that!

Plus I'm still in Windows world. Just can't quite find the time to pick up Linux yet (or cs50x) and no, I don't want to run VS! Emacs seems to pretty up the error message pretty well, to be honest.

Code:
#include <stdio.h>

main(){
	
  prin ("hello World);
	
}
Code:
-*- mode: compilation; default-directory: "~/Desktop/cfiles/" -*-
Compilation started at Thu Nov 15 22:51:50

gcc test.c
test.c: In function 'main':
test.c:6:9: warning: missing terminating " character [enabled by default]
test.c:6:3: error: missing terminating " character
test.c:8:1: error: expected expression before '}' token
test.c:8:1: error: expected ';' before '}' token

Compilation exited abnormally with code 1 at Thu Nov 15 22:51:50
Quote:
Originally Posted by sng_jason
You mean "The C Programming Language", circa 1988? Then yeah, you're talking about a rather ancient love. Much of whats in that book is going to be considered pretty anachronistic by modern standards... in fact a lot of the syntax in that book will have been deprecated by modern c/c++ compilers.
Yes. I started to suspect that. For example, K&R has

Code:
main (){
  while (blah blah)
    do stuff;
}
And this works just as well...

Code:
main (){
  while(blah blah){
    do stuff;
  }
}


Quote:
No, they actually do mean the value of the *expression* (getchar() != EOF) must be equal to either 0 or 1.
Wow, you can evaluate an *expression* in C? I love the language already!

Quote:
Originally Posted by tyler_cracker
dave,

^d sends eof in (most) unix terminals. i think on windows it's ^z<ENTER>.
To clarify: if you want to exit a program quickly, then you'd press ^c. If you like having the assurance of not accidentally exiting prematurely, you can do ^z [enter]. I haven't quite been burned by exiting immediately yet, so I just hit ^c. To exit the Windows Command Prompt, you have to 'exit' [enter].

I didn't expect a near argument to break out about the book. I thought it would be on how I do the brackets.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
11-16-2012 , 07:20 AM
Code:
gcc test.c
I would expect this to produce test.o, nothing more. Then after you compile all your .c files, you need to pass a list of .o files to the linker to get your executable. To do that in one pass, I'd expect something like:

Code:
gcc test.c -o test.exe
Not sure where you got this:

Code:
  prin ("hello World);
"prin" is not a function and "hello World" is missing the closing quote.

I prefer this book: http://publications.gbdirect.co.uk/c_book/
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
11-16-2012 , 08:22 AM
That was a generic name for a file.

I wrote that error code on purpose. Shoe Lace was saying that clang is better, in part, because the error outputs were more understandable. He linked to an SO thread showing the difference, and I showed what c-mode in Emacs displays.

Specifically, the error of the program he linked is:

Code:
-*- mode: compilation; default-directory: "~/Desktop/cfiles/" -*-
Compilation started at Fri Nov 16 04:11:38

gcc newfile.c
newfile.c:1:18: fatal error: string: No such file or directory
compilation terminated.

Compilation exited abnormally with code 1 at Fri Nov 16 04:11:38
which oddly is the same thing I get when I try to compile in the command line. I don't know, maybe gcc changed this issue recently or Windows simply acts differently. ??
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
11-16-2012 , 09:03 AM
I'm surprised how much they leave out in the basic K&R examples. Maybe cs50x is just being extra safe but they expect us to always have a return type for main (either void or int), and always explicitly pass in void or the argc/argv combo if we expect command line args.

Btw dave any construct that only has 1 thing to evaluate in its body can be written WITHOUT curly braces. That is why your while example works in both cases. The same can happen with if statements, for loops, etc..

As soon as you have more than 1 thing to eval then the braces are mandatory. It's usually good practice to just always include them but that's a style thing. There's nothing archaic about this way of handling braces. People do it both ways even today.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
11-16-2012 , 10:50 AM
An old book that covers using the basic command line tools: http://www.amazon.com/dp/1565921127/

It's all about getting started. Should still work fine with cygwin.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
11-16-2012 , 03:38 PM
http://c.learncodethehardway.org/boo...d-waych55.html

The "learn the hard way" guy also has criticized K&R.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
11-16-2012 , 03:51 PM
Quote:
Originally Posted by _dave_
Depending on what you're doing, you might have it a bit easier than raw poker-eval with psim.dll from here..
thanks _dave_, i found this too after a bit more searching
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
11-17-2012 , 05:54 AM
Quote:
Originally Posted by e i pi
http://c.learncodethehardway.org/boo...d-waych55.html

The "learn the hard way" guy also has criticized K&R.
Zed Shaw is pretty critical of everything, I think:

Ruby on Rails is a Ghetto:

http://web.archive.org/web/200801030..._a_ghetto.html

On my Twitter Feed, he was asking about what books to use to learn Clojure. I think he'll be pretty upset to find many people from RoR are moving to Clojure (the code from the RoR people is really bad).
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
11-17-2012 , 06:42 AM
He seems like a dick.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
11-17-2012 , 04:06 PM
Quote:
Originally Posted by jjshabado
Part of what I find fascinating and what I want to start a thread about is how people's background/experience totally shape their programming beliefs and how this forum is made up of a very different group of people than the people I've worked with/met in my real life.
+1 on this thread idea. You should start it, would be interesting I think.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD **
$25m Guaranteed WPM on CoinPoker
Join the action now
Daily Rewards • Splash Pots • CoinRaces
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD **

      
m