Unofficial Programming Thread IV

Post » Tue Jun 18, 2013 12:37 pm

Previous threads:
http://www.gamesas.com/topic/1166756-unofficial-programming-thread-iii/
http://www.gamesas.com/index.php?/topic/1092028-unofficial-programming-thread/page__p__15933926__fromsearch__1&#entry15933926
http://www.gamesas.com/index.php?/topic/1092028-unofficial-programming-thread/page__p__15933926__fromsearch__1&#entry15933926

Last post:

Variables are temporariy in memory until the program ends so if you need to persist the information for recall later you need to write it out to some sort of file.
User avatar
Ezekiel Macallister
 
Posts: 3493
Joined: Fri Jun 22, 2007 12:08 pm

Post » Tue Jun 18, 2013 5:23 am

Ok, I have 2 different textboxes. each one has different information. Can I save them both in one text file then load them to both of the textboxes?

Sorry about my frequent questions, I'm fairly new to C#.
User avatar
courtnay
 
Posts: 3412
Joined: Sun Nov 05, 2006 8:49 pm

Post » Tue Jun 18, 2013 8:04 am

I don't know much about C#, but you should be able to. You just need to distinguish them somehow so when you parse the file later they won't be lumped in the same textbox.
User avatar
MatthewJontully
 
Posts: 3517
Joined: Thu Mar 08, 2007 9:33 am

Post » Tue Jun 18, 2013 4:59 am

Yes, look up StreamReader and StreamWriter on MSDN it even has simple examples on how to do that. I would have to dig out an old project to get some of my own examples but they probably also are a bit beyond the scope of what you need.
User avatar
Tamara Dost
 
Posts: 3445
Joined: Mon Mar 12, 2007 12:20 pm

Post » Tue Jun 18, 2013 8:12 am

I couldn't find any tutorials on MSDN for what I'm trying to do.

@DarkOneVenzar you mentioned earlier that you had some examples. Could you please post one?
User avatar
Hearts
 
Posts: 3306
Joined: Sat Oct 20, 2007 1:26 am

Post » Tue Jun 18, 2013 5:39 am

Finally decided to learn GUI programming in C++. Any suggestions for a library? I'm looking at qt right now, seems decent.
User avatar
Batricia Alele
 
Posts: 3360
Joined: Mon Jan 22, 2007 8:12 am

Post » Tue Jun 18, 2013 1:10 pm

I thought I'd try to branch out from XNA and C# so I started a new project using Java and LWJGL. It amazes me how similar the syntax is but I'm having to rebuild a lot of the stuff that came with XNA from scratch. It's taking a lot of getting used to but at least I managed to get a couple of sprites on screen spinning around.
User avatar
Fam Mughal
 
Posts: 3468
Joined: Sat May 26, 2007 3:18 am

Post » Tue Jun 18, 2013 4:05 pm

If anyone is interested I am working on a subnetting practice application in Python 3.2, though I may switch to a C# console application using .NET, to practice subnetting and potentially offer to a former teacher for his students since I need practice subnetting for an exam. Anyone who would be interested in testing or helping me write this is welcome.
User avatar
David John Hunter
 
Posts: 3376
Joined: Sun May 13, 2007 8:24 am

Post » Tue Jun 18, 2013 2:58 pm

In the official Python 3.2.2 documentation it says you can make .exe files using the freeze module which gets installed by the Python installer, if I read it correctly, but I do not see this module. I looked into cx_freeze which is supposed to take Python scripts and make an .exe of them but it adds other files that are required when I was hoping to keep it as compact as possible. Other than just distributing the.py files does anyone have any recommendations for deploying Python scripts? I had quite a bit of the code done in C# of the same program but did notbring my code, however I eventually want both finished. I figure if I can make an .exe of the Python script it would be simpler to share as opposed to the .NET version.
User avatar
jaideep singh
 
Posts: 3357
Joined: Sun Jul 08, 2007 8:45 pm

Post » Tue Jun 18, 2013 12:13 am

All the Python exes I have made with have ended up being about 10mb. It is possible to condense it with a something like upx but it has to contain the virtual machine which is always going to have some bulk.

I haven't used python3 at all, so can't comment on the use of that module.
User avatar
Amy Siebenhaar
 
Posts: 3426
Joined: Fri Aug 10, 2007 1:51 am

Post » Tue Jun 18, 2013 1:01 pm

That size is not an issue to me even if they are a bit larger. py2exe is most commonbut I am working in Python 3 so it is not applicable.
User avatar
Svenja Hedrich
 
Posts: 3496
Joined: Mon Apr 23, 2007 3:18 pm

Post » Tue Jun 18, 2013 4:17 pm

I want to start learning programming, and I'm uncertain if I should go with Java or C++. What's the differences, etc and what should I go with? My friend started with C++ and is now doing Java (making a game last I heard) and he said Java is better, but I wanted the internet's opinion. I'll probably pick up a book to teach me/look around the internet. So?
User avatar
Trey Johnson
 
Posts: 3295
Joined: Thu Oct 11, 2007 7:00 pm

Post » Tue Jun 18, 2013 8:26 am

I would vote for C++ but it also might be a bit tough for a starting language. Python could be a good starting place or if you want tied to Microsoft Visual Basic wouldn't be too tough to start with, however I am not a fan of VB myself but rather C#.
User avatar
Ricky Rayner
 
Posts: 3339
Joined: Fri Jul 13, 2007 2:13 am

Post » Tue Jun 18, 2013 12:40 am

Why is it that I can read and understand almost any programming language but the documentation looks like it was written in an obscure dialect of ancient Romulan?
User avatar
Laura Simmonds
 
Posts: 3435
Joined: Wed Aug 16, 2006 10:27 pm

Post » Mon Jun 17, 2013 11:51 pm

Java, in my opinion, is easier to learn. But I'd also vote for C++, because C++ is awesome.
User avatar
Monika Fiolek
 
Posts: 3472
Joined: Tue Jun 20, 2006 6:57 pm

Post » Tue Jun 18, 2013 7:28 am

Hmm... any reason why C++? I'm not to familiar with programming terms, so layman terms please I'd prefer to delve into the harder stuff head first, even if there is a steep learning curve
User avatar
Cool Man Sam
 
Posts: 3392
Joined: Thu May 10, 2007 1:19 pm

Post » Tue Jun 18, 2013 1:38 am

You can do bigger projects with C++. And I think C++ is less notepad and more other stuff.
User avatar
Isaac Saetern
 
Posts: 3432
Joined: Mon Jun 25, 2007 6:46 pm

Post » Tue Jun 18, 2013 12:05 pm

If you had said C++ was less enterprisy you would have made more sense . There are huge projects in both C++ and Java. You just probably haven't directly used a large Java program.


C++ is a horrible language as far as complexity and design goes.
No one uses Java except for enterprise stuff.
Learn Python. It has less horrible bits and is easier, faster to develop with and error messages are sane (most of the time).
User avatar
Katie Louise Ingram
 
Posts: 3437
Joined: Sat Nov 18, 2006 2:10 am

Post » Tue Jun 18, 2013 7:35 am

I have to agree with the Python suggestion, I may have even mentioned it before.It is pretty easy to pick up and seems pretty powerful from the few things I have done with it. Though making a GUI is a bit of a challenge.
User avatar
Steve Fallon
 
Posts: 3503
Joined: Thu Aug 23, 2007 12:29 am

Post » Tue Jun 18, 2013 6:59 am

To elaborate, it depends on the scope of the variable, the type of data stored in the variable (object or scalar / reference type or value type, etc.), and the language you're using. In most languages variables can have a lifetime of a single procedure call, the lifespan of a single object ("member variables" or "fields"), the lifespan of the process/application (often referred to as "globals" and should almost never be used), or the lifespan of a thread.

Value types like numeric values and (in many languages) strings and simple structures can actually be thought of as "stored" in the variable. Reference types like complex structures and those that also contain behaviors (classes) cannot be thought of that way. When you store an instance of a class, or object, in a variable you're actually only storing a reference to the object. The object itself is stored in a mechanism that's often called a "heap." This trips up a lot of developers that are new to object-oriented programming...some people have a difficult time understanding the difference between a reference to an object and an instance of an object.

One is not "better" than the other. They're different tools used for different purposes. If your purpose is to learn about programming without jumping headlong into arcane syntax and lower-level concepts like memory addresses and bitwise operations then I'd say that Java is the better of the two tools. Python is fun too. As others have mentioned, though, if you're trying to develop skills that translate into enterprise IT applications then Java is probably a better bet. I wouldn't agree that nobody uses Java outside of the enterprise, though. Most smartphone apps are developed on platforms that are at least derivatives of Java, and a ton of cross-platform open-source tools that I use personally are developed in Java. It's only the most-used language on the planet.

That said, I actually like C# better than Java. Don't tell anyone!

No offense, but neither of these statements make a lick of sense.
User avatar
Hannah Barnard
 
Posts: 3421
Joined: Fri Feb 09, 2007 9:42 am

Post » Tue Jun 18, 2013 12:24 am

Bigger project = less notepad. Every programmer worth their salt knows the BPELN rule.
User avatar
Alister Scott
 
Posts: 3441
Joined: Sun Jul 29, 2007 2:56 am

Post » Tue Jun 18, 2013 4:02 pm

Ooooh, that one. Where I'm from it's referred to as the UNOBPEPS (Using Notepad On Big Project Equals Programmer Suicide) rule.
User avatar
Britta Gronkowski
 
Posts: 3475
Joined: Mon Apr 09, 2007 3:14 pm

Post » Tue Jun 18, 2013 11:41 am

I have never heard of it. That said, I don't use many operating systems with notepad installed
User avatar
Mark Hepworth
 
Posts: 3490
Joined: Wed Jul 11, 2007 1:51 pm

Post » Tue Jun 18, 2013 2:54 pm

This should be prefaced with "In most garbage collected languages". Languages like C++ it is possible (and obviously preferred) to allocate memory for objects on the stack.

Ak. I forgot about smartphones.

But if you look at most open source projects, the newer ones tend not to be in Java. (Excluding Android stuff). Not to say there aren't notable open source Java projects, but it isn't the language that most people chose to develop in (for obvious reasons when you look at Ruby and Python).

But yeah, you make a good point. But if learning for fun I would pick a more fun language than Java. If you become even just a decent programmer picking up Java should be trivial (Like a day to get yourself around the core concepts at max).
User avatar
Guinevere Wood
 
Posts: 3368
Joined: Mon Dec 04, 2006 3:06 pm

Post » Tue Jun 18, 2013 3:38 pm

Yes, learn Python.

I'm back on some Android development after several months of almost exclusively Python. Java is just horrible. So verbose.
User avatar
Sarah MacLeod
 
Posts: 3422
Joined: Tue Nov 07, 2006 1:39 am

Next

Return to Othor Games