Computer Programming Discussion

Post » Sun Dec 13, 2009 11:35 am

eh... could you give me an example? :P


string.translate("foo > bar > baz", None, ">")
should return
"foo  bar  baz"
.

Translate does two things: it takes the third parameter as a set of characters to delete and deletes these characters from the string,

then it takes the second parameter as a translation table and substitutes the corresponding character from the translation table for each character in the string.

You can avoid the translation step by specifying None for the second parameter.

(Translation tables are a nuisance to use because they have to be 256 characters long and include the control characters from ordinal 0 to 31 and 255. Use regular expressions instead.)
User avatar
Carlos Vazquez
 
Posts: 3407
Joined: Sat Aug 25, 2007 10:19 am

Post » Sun Dec 13, 2009 11:08 am

Translation tables are a nuisance to use because they have to be 256 characters long and include the control characters from ordinal 0 to 31 and 255.

I'm not certain they do in Python. For instance, to move all characters over by three to the right:

from string import maketransalphabet = 'abcdefghijklmnopqrstuvwxyz'map = maketrans(alphabet, alphabet[3:] + alphabet[:3])someText = 'abc'translated = someText.translate(map)print translated


Still a bit of a nuisance, mind.
User avatar
Mariana
 
Posts: 3426
Joined: Mon Jun 12, 2006 9:39 pm

Post » Sun Dec 13, 2009 9:44 am

Thanks! For a minute there I thought you guys were playing with me because nothing you said worked, but then I realized I was using Python 3.1 :P

I had to modify the code a bit but it all worked eventually ^_^
User avatar
ZANEY82
 
Posts: 3314
Joined: Mon Dec 18, 2006 3:10 am

Post » Sun Dec 13, 2009 5:18 pm

So it seems my school finally offers Visual Studio 2010 both Professional and Ultimate. I got both from them and installed Ultimate on my desktop. I looked at http://www.microsoft.com/visualstudio/en-us/products and it seems like the stuff in Ultimate I may not use. Would professional be fine then for me if I only used Professional of 2008, or should I just installed Ultimate since I am able?
User avatar
Dustin Brown
 
Posts: 3307
Joined: Sun Sep 30, 2007 6:55 am

Post » Sun Dec 13, 2009 6:42 pm

So it seems my school finally offers Visual Studio 2010 both Professional and Ultimate. I got both from them and installed Ultimate on my desktop. I looked at http://www.microsoft.com/visualstudio/en-us/products and it seems like the stuff in Ultimate I may not use. Would professional be fine then for me if I only used Professional of 2008, or should I just installed Ultimate since I am able?

Unless it bogs down your system somehow, may as well go with Ultimate, no? Uses a little extra disc space, but so what?
User avatar
Melung Chan
 
Posts: 3340
Joined: Sun Jun 24, 2007 4:15 am

Post » Sun Dec 13, 2009 7:11 am

Unless it bogs down your system somehow, may as well go with Ultimate, no? Uses a little extra disc space, but so what?

Yeah its not much more space. 6gb for Ultimate. Doesn't seemt o use anything extra resource wise as far as I can see comparing to 2008 Professional outside the nromal Microsoft added bloat since it uses WPF supposedly for its interface.
User avatar
ezra
 
Posts: 3510
Joined: Sun Aug 12, 2007 6:40 pm

Post » Sun Dec 13, 2009 5:38 pm

From what it adds the main thing that may be of use is the extra UML stuff :shrug:

The one thing Visual Studio needs is vim keybindings and Linux support. Then I would want for nothing.
User avatar
Lakyn Ellery
 
Posts: 3447
Joined: Sat Jan 27, 2007 1:02 pm

Post » Sun Dec 13, 2009 9:58 am

I just went ahead and installed Ultimate. Who knows, I may use the tools in the future.

Edit- On my Win7 Pro x86 laptop VS2010 Ultimate said it needed 7.2gb but unless I read it wrong (quite possible) on my Win7 Pro x64 desktop it only wanted 6gb. Unless it split somethign across different discs. But again its possible I read it wrong.
User avatar
electro_fantics
 
Posts: 3448
Joined: Fri Mar 30, 2007 11:50 pm

Post » Sun Dec 13, 2009 7:03 pm

where can i download the editor for c? (not c++)
User avatar
Shelby McDonald
 
Posts: 3497
Joined: Sat Jan 13, 2007 2:29 pm

Post » Sun Dec 13, 2009 9:28 pm

Huh? Visual Studio Pro and Ultimate? MS went and segmented that product too?

where can i download the editor for c? (not c++)

Is there really a difference? c is technically a subset of c++ and c has no classes. You can just code in a procedural way instead of object oriented. Otherwise it's basically the same and you can build it using the same compilers/linkers. Or, you could use struct's, but never mind..
User avatar
Jon O
 
Posts: 3270
Joined: Wed Nov 28, 2007 9:48 pm

Post » Sun Dec 13, 2009 6:46 pm

where can i download the editor for c? (not c++)

Most C++ IDEs work fine with C and will compile C code with a slight change to their settings.

What platform are you using (Windows?)


Is there really a difference? c is technically a subset of c++ and c has no classes. You can just code in a procedural way instead of object oriented. Otherwise it's basically the same and you can build it using the same compilers/linkers. Or, you could use struct's, but never mind..

It that really true any more? I don't think you can use some features introduces in C99 in C++. Variable length arrays spring to mind (although I will admit that you don't really need to given that the compiled result is probably about the same as using a vector). Not that C99 is very well supported by Microsoft or GCC. If you want compatibility C89 is the way to go.

I think C also has another primitive type (long long?) that C++03 doesn't have, although C++0x may have it. I haven't kept up with the changes.
User avatar
Channing
 
Posts: 3393
Joined: Thu Nov 30, 2006 4:05 pm

Post » Sun Dec 13, 2009 8:52 pm

where can i download the editor for c? (not c++)


http://www.codeblocks.org/. You can tell GCC to enforce any of the C standards, if you want to be sure your code is free of C++-isms.

If you want a Windows-only tool, http://www.microsoft.com/express/windows/. But it does not handle C99 syntax (Microsoft's explanation is that there is little demand for it, but there are uncharitable souls who believe Microsoft did this to make code written for GCC not portable to Visual Studio).
User avatar
Mason Nevitt
 
Posts: 3346
Joined: Fri May 11, 2007 8:49 pm

Post » Sun Dec 13, 2009 12:38 pm

http://www.codeblocks.org/. You can tell GCC to enforce any of the C standards, if you want to be sure your code is free of C++-isms.


http://netbeans.org/features/cpp/index.html and (I think) Eclipse are also viable alternatives to Code::Blocks


If you are using windows, Visual Studio is one of the best IDEs I have ever used.
User avatar
Avril Louise
 
Posts: 3408
Joined: Thu Jun 15, 2006 10:37 pm

Post » Sun Dec 13, 2009 8:39 pm

http://netbeans.org/features/cpp/index.html and (I think) Eclipse are also viable alternatives to Code::Blocks


If you are using windows, Visual Studio is one of the best IDEs I have ever used.


Netbeans is good for C and C++. Eclipse is harder to install for C and C++, with lots of ways you can shoot yourself in the foot. A choice between these two depends on your preference more than anything else.

Code::Blocks is lightweight and will run better on machines that aren't strong enough to handle damned big Java apps.

If you are developing on Windows, for Windows, and don't have portability concerns, Visual Studio is still the best.
User avatar
evelina c
 
Posts: 3377
Joined: Tue Dec 19, 2006 4:28 pm

Post » Sun Dec 13, 2009 1:08 pm

.
User avatar
glot
 
Posts: 3297
Joined: Mon Jul 17, 2006 1:41 pm

Post » Sun Dec 13, 2009 4:39 pm

I have an application done in either Borland C++ 3 or 5. Current application development and UI design is done with Visual Studio 2008. How difficult would it be to convert from Borland to VS? Language stays the same, C++, but I'm worried about all the UI stuff even if I could just recreate the project files in VS by adding files into a new project. Then what about all the bugs and inconsistencies in Borland compiler? Everything has to be retested.
User avatar
NAkeshIa BENNETT
 
Posts: 3519
Joined: Fri Jun 16, 2006 12:23 pm

Post » Sun Dec 13, 2009 4:06 pm

I have an application done in either Borland C++ 3 or 5. Current application development and UI design is done with Visual Studio 2008. How difficult would it be to convert from Borland to VS? Language stays the same, C++, but I'm worried about all the UI stuff even if I could just recreate the project files in VS by adding files into a new project. Then what about all the bugs and inconsistencies in Borland compiler? Everything has to be retested.


It depends on how much Borland proprietary stuff (OWL, VCL) the old BC++ code uses. If it's straight C++ or depends only on the Win32 API, it should be no problem to port. If it makes heavy use of OWL or VCL, you may be looking at a rewrite.
User avatar
Taylor Bakos
 
Posts: 3408
Joined: Mon Jan 15, 2007 12:05 am

Post » Sun Dec 13, 2009 9:22 pm

It depends on how much Borland proprietary stuff (OWL, VCL) the old BC++ code uses. If it's straight C++ or depends only on the Win32 API, it should be no problem to port. If it makes heavy use of OWL or VCL, you may be looking at a rewrite.

I'm afraid it might use the proprietary stuff quite heavily, seeing that it has graphical user interfaces made for just this application, and it was not developed with portability in mind.. However, I don't exactly know what OWL and VCL consist of, but I'm assuming they are similar to MFC, that was used in the VS projects over the Win32 API (and now also .NET). I'm still quite lost on all the terminology and abbreviations though. I used to develop for Unix after all..
User avatar
Star Dunkels Macmillan
 
Posts: 3421
Joined: Thu Aug 31, 2006 4:00 pm

Post » Sun Dec 13, 2009 5:21 pm

I'm afraid it might use the proprietary stuff quite heavily, seeing that it has graphical user interfaces made for just this application, and it was not developed with portability in mind.. However, I don't exactly know what OWL and VCL consist of, but I'm assuming they are similar to MFC, that was used in the VS projects over the Win32 API (and now also .NET). I'm still quite lost on all the terminology and abbreviations though. I used to develop for Unix after all..


OWL and VCL were proprietary Borland libraries. OWL = Object Windows Library; VCL = Visual Component Library. They are obsolete (discontinued 1999) and have little to nothing in common with the visual components and program structure to support them that Microsoft uses.

Classes from these libraries are fairly easy to recognize because most of them begin with "T" and tend to have ancestor classes like TWindow and TObject.

You may be able to port OWL applications by using http://sourceforge.net/apps/mediawiki/owlnext/index.php?title=Main_Page.
User avatar
Petr Jordy Zugar
 
Posts: 3497
Joined: Tue Jul 03, 2007 10:10 pm

Post » Sun Dec 13, 2009 1:59 pm

I'm bored

give me a problem to solve

or an idea for a small application
User avatar
Khamaji Taylor
 
Posts: 3437
Joined: Sun Jul 29, 2007 6:15 am

Post » Sun Dec 13, 2009 12:46 pm

I'm bored

give me a problem to solve

or an idea for a small application


Implement http://en.wikipedia.org/wiki/Conway%27s_Game_of_Life.
User avatar
phillip crookes
 
Posts: 3420
Joined: Wed Jun 27, 2007 1:39 pm

Post » Sun Dec 13, 2009 11:38 pm

Implement http://en.wikipedia.org/wiki/Conway%27s_Game_of_Life.

I will most likely make a game of life myself this summer as a project for an old course in C#. Either that or a Paint copy.
User avatar
Jessie Rae Brouillette
 
Posts: 3469
Joined: Mon Dec 11, 2006 9:50 am

Post » Sun Dec 13, 2009 2:49 pm

Implement http://en.wikipedia.org/wiki/Conway%27s_Game_of_Life.

uhm... nooo?

How about something for an amateur programmer?
User avatar
Rachael Williams
 
Posts: 3373
Joined: Tue Aug 01, 2006 6:43 pm

Post » Sun Dec 13, 2009 12:51 pm

uhm... nooo?

How about something for an amateur programmer?

Batch file renamer?
ID3 tag editor?
User avatar
Dustin Brown
 
Posts: 3307
Joined: Sun Sep 30, 2007 6:55 am

Post » Sun Dec 13, 2009 7:19 pm

uhm... nooo?

How about something for an amateur programmer?

Hello World? :P

Make an advanced calculator.(Calculates root, power, sin, cos and so on).
User avatar
NEGRO
 
Posts: 3398
Joined: Sat Sep 01, 2007 12:14 am

PreviousNext

Return to Othor Games