Skip to main content
GameDev.net gamedev.net
🔒 Locked

Which language for this problem

Started by Dwiel Nov 25, 2004 at 10:29 PM 12 replies 1.9k views
Original Post
Dwiel
Dwiel
Hello, I am working on a program which downloads a file from a server and then executes stuff based on it, and then uploads a resulting file back to the server. I have writen a large portion of the code already in C++, but it is getting out of hand with all of the system calls and trying to debug a multithreaded program. It's multithreaded because I want a systray icon to show up with a play/pause option on it. Right now, it also pops up a bunch of dos windows really fast which is no good. I know that this is because I am using a system( ); call, but the other alternatives get very messy. Here are the steps this program must complete: 1) Download a zip file 2) extract the zip file 3) load an ini file which holds all of the filenames for this particular job 4) check the ini file and make sure all of the dependencie files are up to date. If not, download the new version from the server. 5) execute some batch files that were in the zip file 6) execute a script (This is the part where all of the interesting, time consuming work is done) 7) possibly run some more batch files (depends on what it has in the ini) 8) zip everything back up 9) upload the zip back to the server 10) rinse and repeat Also, I must have a method for running this program in idle as well as pause it at any point of time. Does anyone have any ideas on which language might be better than C++? I have written a lot of helpful scripts in perl, which seems well suited for this job, but I don't want to force the users to download an extra 20MB implementation of perl. Is there an easy way to do something like this or should I just keep plowing ahead in C++? Thanks! Dwiel
C-Junkie
C-Junkie
Have you looked for software that already does something similiar?

For example, I'm not sure what you're trying to do, but sometyhing like Ajanta might do something like you're looking for... (though perhaps not any of the specifics...)

and, of course, If I were writing it, It'd be in python.
Qw3r7yU10p!
Qw3r7yU10p!
I'd use Python. If you want to package it up into an executable, use py2exe.
Zahlman
Zahlman
Quote:
Original post by petewood
I'd use Python. If you want to package it up into an executable, use py2exe.


+1. You're doing mostly "glue code" type stuff, with some file manipulation (and upload/download). Perl might be an option too, depending on personal taste (it's what I would have recommended before I learned Python ;) )
JuNC
JuNC
Fourthed Python, there are libs to do almost all of that, you'd only have to write a tiny amount of code :)
Qw3r7yU10p!
Qw3r7yU10p!
Quote:
Original post by Anonymous Poster
Download Cygwin and write a bash script; it will probably be less than 20 lines.


!

what about the thing of not requiring others to download stuff?
Dwiel
Dwiel
I pretty much got it all working using some of those utilities like wget and a command-line zip-utility. That and a combination of short DOS batch files (easily converted to linux) and 'compiled' perl code which does the uploading. I am now working on using Python to do this as hopefully the compiled code will be much smaller.

I think I am going to keep the multi-threaded part in C though because I am familiar with it... Also, the only way I can allow for pausing in my main loop is to call it using C/C++...

It looks like I'll just be coding more of the glue with python. Is there a preffered Python compiler?

Thanks!

Dwiel
Qw3r7yU10p!
Qw3r7yU10p!
Quote:
Original post by Tazzel3D
Is there a preffered Python compiler?

There's really only the one (although there is Jython too).
Dwiel
Dwiel
hmm... I wonder why googling Python Compiler didnt bring right to a link... All I found was documentation.

Thanks!

Dwiel
Qw3r7yU10p!
Qw3r7yU10p!
Quote:
Original post by Tazzel3D
hmm... I wonder why googling Python Compiler didnt bring right to a link...


It's not compiled, it's an interpreted language.

sindisil
sindisil
Quote:
Original post by petewood
Quote:
Original post by Tazzel3D
hmm... I wonder why googling Python Compiler didnt bring right to a link...


It's not compiled, it's an interpreted language.


Um, no. It's actually bytecode compiled. I've never been sure why the python.org website calls it a "portable, interpreted, object-oriented programming language". I suppose that the fact that there is no seperate "compile" command (a la javac/java in the Java world) lends itself to just calling it interpreted to keep folks from being confused.
Zahlman
Zahlman
Quote:
Original post by sindisil
I suppose that the fact that there is no seperate "compile" command (a la javac/java in the Java world) lends itself to just calling it interpreted to keep folks from being confused.


Well, there is, sort of. ;) It's built into the language, presumably to make it easier to develop Python shells (such as used by IDLE) in Python itself:

Quote:

compile( string, filename, kind[, flags[, dont_inherit]])

Compile the string into a code object. Code objects can be executed by an exec statement or evaluated by a call to eval(). The filename argument should give the file from which the code was read; pass some recognizable value if it wasn't read from a file ('' is commonly used). The kind argument specifies what kind of code must be compiled; it can be 'exec' if string consists of a sequence of statements, 'eval' if it consists of a single expression, or 'single' if it consists of a single interactive statement (in the latter case, expression statements that evaluate to something else than None will printed).

... etc.


The depth of Python's reflection capabilities is truly amazing. Makes java.lang.reflect look like some kind of sick joke. [smile]

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.