Unofficial Programming Thread III

Post » Tue Aug 03, 2010 2:12 am

This morning I figured out a way to create a random string of characters (but can be changed to include numbers and symbols) and was thinking of posting the tutorial online. I already submitted it to the DreamInCode website so hopefully it gets approved. But I was thinking of create a simple site to host tutorials as well, not only for C# but other languages as well. Would anyone be interested in working on this with me to expand it for other languages as well?

Would this be it? http://www.dreamincode.net/forums/topic/225686-generate-random-string-of-letters/
User avatar
Nick Tyler
 
Posts: 3437
Joined: Thu Aug 30, 2007 8:57 am

Post » Tue Aug 03, 2010 8:56 am

Thought this was pretty funny.
http://www.rinkworks.com/stupid/cs_programming.shtml
User avatar
neil slattery
 
Posts: 3358
Joined: Wed May 16, 2007 4:57 am

Post » Tue Aug 03, 2010 1:44 am

Thought this was pretty funny.
http://www.rinkworks.com/stupid/cs_programming.shtml

In that case you may also enjoy:
http://thedailywtf.com/Default.aspx
User avatar
no_excuse
 
Posts: 3380
Joined: Sun Jul 16, 2006 3:56 am

Post » Tue Aug 03, 2010 3:26 pm

Would this be it? http://www.dreamincode.net/forums/topic/225686-generate-random-string-of-letters/

Yeah that is it. I recently added it to my class library I have been putting together that contains a bunch of random code, some of which I might not even use again. I am going to add in all the hashing stuff I had done for another program to make it easier to use later.

I am currently fighting with a weird styling issue with WPF that is annoying me. I may just redo a good chunk of the program I think since right now some of my code uses the old WinForms method for working with controls and does not apply to WPF the same. I also need to add in some error catching just because. I don't plan to release the program but I may as well do things right if I am going to do them, or at least try.

Also, I am hoping to start a programming organization here on campus but I am stuck with coming up with a short name and abbreviation for it but I need something soon. To start it next school year I need to have everything done before the start of May which is causing issues since I have other stuff I need to get done by then as well.
User avatar
OTTO
 
Posts: 3367
Joined: Thu May 17, 2007 6:22 pm

Post » Tue Aug 03, 2010 9:50 am

Also, I am hoping to start a programming organization here on campus but I am stuck with coming up with a short name and abbreviation for it but I need something soon.

At Edinburgh we just have the Computing Soceity, which is shortened to CompSoc. Of course it does a lot of social things not related to geekyness in any way.
User avatar
Mrs shelly Sugarplum
 
Posts: 3440
Joined: Thu Jun 15, 2006 2:16 am

Post » Tue Aug 03, 2010 3:28 am

I'm going to start messing around with http://www.ogre3d.org/ and was wondering if you guys know a place similar to http://www.spriters-resource.com/, but for meshes/animations. Also, have any of you used OGRE? What are your thoughts on it?
User avatar
Christine Pane
 
Posts: 3306
Joined: Mon Apr 23, 2007 2:14 am

Post » Tue Aug 03, 2010 6:01 am

So, I'm making something in c#, and, as I'm not too experienced in it, I'm not sure what the most elegant way to solve my problems are. Firstly, loading external resources - doing this by absolute path is a terrible idea, but the relative path is relative to the executable, which is compiled to a different place depending on whether I compile in release or debug. This seems... inelegant, to have two seperate copies of all the resources. Secondly, some of the external resources I want to load are going to need a little information about them, is there a standard way to do this in C# (A decent XML reader in the standard library, maybe?) or am I going to be parsing my own files?
User avatar
Jeneene Hunte
 
Posts: 3478
Joined: Mon Sep 11, 2006 3:18 pm

Post » Tue Aug 03, 2010 2:25 am

Also, have any of you used OGRE? What are your thoughts on it?
Nice library. The documentation is really good. I am not sure if I agree with the almost excessive singleton use but meh. It works.


Regarding your question:
http://www.ogre3d.org/tikiwiki/Free+Resources


So, I'm making something in c#, and, as I'm not too experienced in it, I'm not sure what the most elegant way to solve my problems are. Firstly, loading external resources - doing this by absolute path is a terrible idea, but the relative path is relative to the executable, which is compiled to a different place depending on whether I compile in release or debug.
You can set the working directory that you wish to run the program with.

This seems... inelegant, to have two seperate copies of all the resources. Secondly, some of the external resources I want to load are going to need a little information about them, is there a standard way to do this in C# (A decent XML reader in the standard library, maybe?) or am I going to be parsing my own files?


For some reason the C# guys want you to use XML for config files so you could use System.XML (I don't like XML files for configuration, as you can't see the settings for the syntax, but there we go :shrug:)
User avatar
Pixie
 
Posts: 3430
Joined: Sat Oct 07, 2006 4:50 am

Post » Tue Aug 03, 2010 2:34 am

You can set the working directory that you wish to run the program with.



For some reason the C# guys want you to use XML for config files so you could use System.XML (I don't like XML files for configuration, as you can't see the settings for the syntax, but there we go :shrug:)

How does that handle release mode compilation? Eventually I'll surely want to have the executable next to the resources. I suppose I could just set that back immediately before compiling for that, but still.
I'll give System.XML a look, ta.
User avatar
Fanny Rouyé
 
Posts: 3316
Joined: Sun Mar 25, 2007 9:47 am

Post » Tue Aug 03, 2010 8:01 am

How does that handle release mode compilation? Eventually I'll surely want to have the executable next to the resources. I suppose I could just set that back immediately before compiling for that, but still.

The current working directory has nothing to do with the binary itself, just how it is executed.
User avatar
Baylea Isaacs
 
Posts: 3436
Joined: Mon Dec 25, 2006 11:58 am

Post » Tue Aug 03, 2010 11:59 am

So, I'm making something in c#, and, as I'm not too experienced in it, I'm not sure what the most elegant way to solve my problems are. Firstly, loading external resources - doing this by absolute path is a terrible idea, but the relative path is relative to the executable, which is compiled to a different place depending on whether I compile in release or debug. This seems... inelegant, to have two seperate copies of all the resources. Secondly, some of the external resources I want to load are going to need a little information about them, is there a standard way to do this in C# (A decent XML reader in the standard library, maybe?) or am I going to be parsing my own files?

Why would using an absolute path be terrible? You could just do the below to get a varying path based on user. Or am I not getting what you're saying?

System.Environment.GetFolderPath(Environment.SpecialFolder.Personal);

User avatar
Melung Chan
 
Posts: 3340
Joined: Sun Jun 24, 2007 4:15 am

Post » Tue Aug 03, 2010 4:03 pm

I have a couple questions regarding C++.

First of all, what is the difference between these:
int *n = 5;

int* n = 5;

In a couple tutorials I've done for Ogre it's made all the difference, and broken my application.

My second question is regarding header files.
class SomeApp{public:// public methodsprivate:// private methodsprotected:// protected methods};

What are the differences between public/private/protected methods?

Another question regarding headers.
class SomeApp{public:virtual void mVirtualMethod(void);void mMethod(void);};

What is the difference between virtual and non-virtual methods?

Thanks guys. I probably should know this stuff by now, but I don't.
User avatar
mike
 
Posts: 3432
Joined: Fri Jul 27, 2007 6:51 pm

Post » Tue Aug 03, 2010 1:28 pm

Does anyone else here use Python? I think it's incredibly fun to use for smaller games.
User avatar
Haley Merkley
 
Posts: 3356
Joined: Sat Jan 13, 2007 12:53 pm

Post » Tue Aug 03, 2010 5:45 am

I have a couple questions regarding C++.

First of all, what is the difference between these:
int *n = 5;

int* n = 5;

In a couple tutorials I've done for Ogre it's made all the difference, and broken my application.

Both of those are syntax errors. If the compiler differentiates between the two or compiles the code with either of those two then the compiler is buggy. Your n there is an (integer) pointer and you can't assign an integer value to a pointer. I presume this is what you wanted to do there:
int* n;n = new int;*n = 5;

Or this:
int *n;n = new int;*n = 5;



My second question is regarding header files.
class SomeApp{public:// public methodsprivate:// private methodsprotected:// protected methods};

What are the differences between public/private/protected methods?

http://www.cplusplus.com/doc/tutorial/inheritance/


Another question regarding headers.
class SomeApp{public:virtual void mVirtualMethod(void);void mMethod(void);};

What is the difference between virtual and non-virtual methods?

Thanks guys. I probably should know this stuff by now, but I don't.

http://en.wikipedia.org/wiki/Virtual_function
User avatar
chloe hampson
 
Posts: 3493
Joined: Sun Jun 25, 2006 12:15 pm

Post » Tue Aug 03, 2010 7:36 pm

I have a couple questions regarding C++.

First of all, what is the difference between these:
int *n = 5;

int* n = 5;

In a couple tutorials I've done for Ogre it's made all the difference, and broken my application.


I'm not aware of any difference between the two. As far as I know they are both identical.

My second question is regarding header files.
class SomeApp{public:// public methodsprivate:// private methodsprotected:// protected methods};

What are the differences between public/private/protected methods?


Public methods can be accessed by anyone. Private methods can only be accessed by objects of that type. Protected methods can only be accessed by objects of that type and descendants of that type.

Another question regarding headers.
class SomeApp{public:virtual void mVirtualMethod(void);void mMethod(void);};

What is the difference between virtual and non-virtual methods?


A virtual method is a method which behaves like a proper object oriented method. It is virtuous. It's pretty confusing terminology.

[EDIT]: Damnit! Beaten to it!
User avatar
Shae Munro
 
Posts: 3443
Joined: Fri Feb 23, 2007 11:32 am

Post » Tue Aug 03, 2010 6:28 am

Both of those are syntax errors. If the compiler differentiates between the two or compiles the code with either of those two then the compiler is buggy. Your n there is an (integer) pointer and you can't assign an integer value to a pointer. I presume this is what you wanted to do there:
int* n;n = new int;*n = 5;

Or this:
int *n;n = new int;*n = 5;


My question is what is the difference between putting the asterisk after the type or before the variable name?
// doing this didn't break my appint* n;

// doing this did break my appint *n;

Just to clear things up, I'm using int n as an example, it's not actually in my source file.

Sorry for using an example that would produce an error, but I just wanted to get an example out there.
http://www.cplusplus.com/doc/tutorial/inheritance/
http://en.wikipedia.org/wiki/Virtual_function

Thanks.

Edit: I'm using VS 10 as a compiler.
User avatar
Laura-Jayne Lee
 
Posts: 3474
Joined: Sun Jul 02, 2006 4:35 pm

Post » Tue Aug 03, 2010 9:27 am

Does anyone else here use Python? I think it's incredibly fun to use for smaller games.

I've actually just started doing the http://code.google.com/edu/languages/google-python-class/index.html on Python. I'm using http://ironpython.codeplex.com/ though just because I like my Visual Studio 2010.

So far I have mixed feelings about it. I don't like the whitespace changing the meaning of the code. I like being able to format my code so I can read it my way. But that's the only thing I don't like.
User avatar
Richard Thompson
 
Posts: 3302
Joined: Mon Jun 04, 2007 3:49 am

Post » Tue Aug 03, 2010 1:39 pm

Does anyone else here use Python? I think it's incredibly fun to use for smaller games.

Yeah I've used PyGame in the past but I didn't really like it.

I do use Boo sometimes when I'm programming for Unity though (Boo is a variant of Python)
User avatar
K J S
 
Posts: 3326
Joined: Thu Apr 05, 2007 11:50 am

Post » Tue Aug 03, 2010 12:10 pm

My question is what is the difference between putting the asterisk after the type or before the variable name?
// doing this didn't break my appint* n;

// doing this did break my appint *n;

There's no difference, but beware - the first can be misleading, for example:

int* a, b, c;

On first sight one might thing that this makes all three variables integer pointers, but that is not the case - a is integer pointer, b and c are integers. That's why it is better to always put the asterisk before the variable name, like this:

int *a, *b, *c;

or if you wanted exactly what the first example did:

int *a, b, c;

That way it is less confusing and misleading.
User avatar
^_^
 
Posts: 3394
Joined: Thu May 31, 2007 12:01 am

Post » Tue Aug 03, 2010 6:34 am

How does that handle release mode compilation? Eventually I'll surely want to have the executable next to the resources. I suppose I could just set that back immediately before compiling for that, but still.
I'll give System.XML a look, ta.

Take a look at System.Xml.Linq it makes creating and reading the XML documents much easier.
User avatar
cutiecute
 
Posts: 3432
Joined: Wed Sep 27, 2006 9:51 am

Post » Tue Aug 03, 2010 6:45 am

Anyone have any ideas for a programming project. I'm completely out of ideas.
User avatar
Lucy
 
Posts: 3362
Joined: Sun Sep 10, 2006 4:55 am

Post » Tue Aug 03, 2010 2:31 pm

Anyone have any ideas for a programming project. I'm completely out of ideas.

What sort of programming projects are you willing to be doing?
User avatar
Jerry Jr. Ortiz
 
Posts: 3457
Joined: Fri Nov 23, 2007 12:39 pm

Post » Tue Aug 03, 2010 6:12 am

What sort of programming projects are you willing to be doing?

Anything not too sophisticated. And no games either. Just boring old application software. :)
User avatar
Ann Church
 
Posts: 3450
Joined: Sat Jul 29, 2006 7:41 pm

Post » Tue Aug 03, 2010 4:34 pm

Anything not too sophisticated. And no games either.

Yes, those tend to fall under "sophisticated" anyway so no need to specify that.

How about writing a quine? If you don't know what a quine (in programming) is, it's a program which as its output produces its own source code. There, that's not sophisticated and it's still head-scratchingly tricky. And no cheating (i.e. googling a source code of a quine)!
User avatar
laila hassan
 
Posts: 3476
Joined: Mon Oct 09, 2006 2:53 pm

Post » Tue Aug 03, 2010 10:22 pm

So a program that looks at it's own executable and decompiles it to original source code?
User avatar
Jodie Bardgett
 
Posts: 3491
Joined: Sat Jul 29, 2006 9:38 pm

PreviousNext

Return to Othor Games