Need Advice on Language for this Project

Status
This thread has been Locked and is not open to further replies. Please start a New Thread if you're having a similar issue. View our Welcome Guide to learn how to use this site.

Alex Ethridge

Thread Starter
Joined
Apr 10, 2000
Messages
9,232
I apologize for the length of this post; but, not being a programmer, I don't know how to express this differently.

I need a form that will make comprehensive comparisons of relatively simple number sets based on value outputs assigned to user-selected radio buttons. Not being a programmer, I have no idea which programming language/program to use for this project and this is what I need recommendations on. What programming language will enable me to learn enough about it in the shortest time before being able to start on my project?

I did this same project years ago; but, in that case, I had someone write a PERL script and I ran it from a web site. My limitations in programming may find it more practical to run from a web site again; however, I still have to do the programming myself as I will be tweaking this thing regularly for a while.

When finished, the program needs to run on about any system Windows 98 and above and be small enough for convenient and free download. It is preferable that no installation be necessary (just download and use); but, I realize this might not be practical. Being able to print and/or save the form after filling it in would be nice as this would allow me to troubleshoot problems reported by users.

I'll call this the "Level Calculator"

Section A:
Item A1
User ticks one of four radio buttons with a mathematical value of 1, 2, 3, or 4.
Item A2:
User ticks one of four radio buttons with a mathematical value of 1, 2, 3, or 4.
Item A3:
User ticks one of four radio buttons with a mathematical value of 1, 2, 3, or 4.
Item A4:
User ticks one of four radio buttons with a mathematical value of 1, 2, 3, or 4.

If none of the values of A1 through A4 match, A=the lowest one of all the values.
If two or more of the values for A1 through A4 match, A=the lowest one of the two matching values.

Section B:
Item B1
User ticks one of four radio buttons with a mathematical value of 1, 2, 3, or 4.
Item B2:
User ticks one of four radio buttons with a mathematical value of 1, 2, 3, or 4.
Item B3:
User ticks one of four radio buttons with a mathematical value of 1, 2, 3, or 4.
Item B4:
User ticks one of four radio buttons with a mathematical value of 1, 2, 3, or 4.

If none of the values of B1 through B4 match, B=the lowest one of all the values.
If two or more of the values for B1 through B4 match, B=the lowest one of the two matching values.

Section C:
Item C1
User ticks one of four radio buttons with a mathematical value of 1, 2, 3, or 4.
Item C2:
User ticks one of four radio buttons with a mathematical value of 1, 2, 3, or 4.
Item C3:
User ticks one of four radio buttons with a mathematical value of 1, 2, 3, or 4.
Item C4:
User ticks one of four radio buttons with a mathematical value of 1, 2, 3, or 4.

If none of the values of A1 through C4 match, C=the lowest one of all the values.
If two or more of the values for C1 through C4 match, C=the lowest one of the two matching values.

Section D:
Item D1
User ticks one of four radio buttons with a mathematical value of 1, 2, 3, or 4.
Item D2:
User ticks one of four radio buttons with a mathematical value of 1, 2, 3, or 4.
Item D3:
User ticks one of four radio buttons with a mathematical value of 1, 2, 3, or 4.
Item D4:
User ticks one of four radio buttons with a mathematical value of 1, 2, 3, or 4.

If none of the values of D1 through D4 match, D=the lowest one of all the values.
If two or more of the values for D1 through D4 match, D=the lowest one of the two matching values.

Now for the final calculation, called "Level". This section takes the output from Sections A through D, and makes a simlilar calculation as was made above:
If none of A, B, C and D match, Level=the lowest one of all the values.
If two or more of A, B, C and D match, Level=the lowest one of the two or more matching values.

This is not all of it. There will be other sections in the program and some addition and maybe some subtraction and division; but, these calculations will always be based on the output assigned to user-selected radio buttons.

Thank you for your time.
 
Joined
Jul 19, 2005
Messages
37
Interesting project. I shall write it in php for you, to view on my web server. As you will have to tweak it regularly, you might want to consider installing an apache server with php enabled on your own computer. It might come in handy for other tasks too...
But for now: I'll post the php here, and a functional version on www.sforum.nl/jobs/sandbox/pattern.php
I'll do this as soon as it's done, of course.
 
Joined
Jun 15, 2005
Messages
431
To avoid having to install anything else, it would be better to do it in a compilable language, like C++.
 
Joined
Jul 19, 2005
Messages
37
Alex Ethridge said:
--snip--
however, I still have to do the programming myself as I will be tweaking this thing regularly for a while.
--snip--
He might not want to learn c++, especially as an HTML response parser (or dialog parser)
 

Alex Ethridge

Thread Starter
Joined
Apr 10, 2000
Messages
9,232
Thanks for the replies.

EtHeO,

Please don't go to any trouble writing a script, unless you simply want to play around a bit. I have from time to time wished I could do some perl; but, I haven't taken the time.

I have a couple of old boxes here I am contemplating putting a penguin into. That would make it possible to see how it would perform on a REAL Linix server. I'm afraid to load Perl onto a Windows box and expect there to be no bugs when the same script is ported to Linux.

Last time I contemplated this was in January 2000. I don't know if PHP was alive then.

So, you recommend PHP over perl, I assume. What are some of the differences in the way they operate--their dependencies, etc? Example: perl relies on Perl being loaded to execute the perl script. What does PHP rely on?
 
Joined
Jul 19, 2005
Messages
37
Hmm.. I'm affraid that the 'don't write a script'-part came a bit too late :)
I've finished it, it's operable, and the source is available here:
PHP:
<?PHP
//fancy bit for getting all the vars
if(isset($_POST['A1'])){ //if the submit button has been pressed
 for($char=97;$char<=100;$char++){ //for every ascii code from A to D, do:
  for($name=1;$name<=4;$name++){ //for every number from 1 to 4, do:
   $var[chr($char)][$name] = $_POST[strtoupper(chr($char)).$name]; //store the var name
  }
  asort($var[chr($char)]); //sort the array on the values, not the keys
  for($a=0;$a<=2;$a++){ //now try and figure out what representing number whe should give
   if($var[chr($char)][$a] == $var[chr($char)][$a+1]){ //if we got matching numbers, 
    $var[chr($char)]['result']=$var[chr($char)][$a];   //store that number as a result
   }
  }
  if(!isset($var[chr($char)]['result'])){ //if there was no value selected
   $var[chr($char)]['result'] = $var[chr($char)][0]; //select the lowest value
  }
  $var[chr($char)]=$var[chr($char)]['result']; //replace the array of numbers with the final value
 }
 $transition=$var; //begin of the "lose the text keys section"
 $var=""; //clear var, temporarily
 foreach($transition as $level){
  $var[] = $level; 
 } //end of the section

 asort($var); //sort the arrays
 for($a=0;$a<=2;$a++){ //now for the final part
  if($var[$a]==$var[$a+1]){ //if this one is the same
   $var['result'] = $var[$a]; //store it as the final level
  }
 }
 if(!isset($var['result'])){ //if no final level is stored
  $var['result']=$var[0]; //make one
 }
 $level = $var['result'];
var_dump($var);
}else{
?>
<form method=post action=pattern.php>
<input type="radio" name="A1" value="1">
<input type="radio" name="A1" value="2">
<input type="radio" name="A1" value="3">
<input type="radio" name="A1" value="4"><br>

<input type="radio" name="A2" value="1">
<input type="radio" name="A2" value="2">
<input type="radio" name="A2" value="3">
<input type="radio" name="A2" value="4"><br>

<input type="radio" name="A3" value="1">
<input type="radio" name="A3" value="2">
<input type="radio" name="A3" value="3">
<input type="radio" name="A3" value="4"><br>

<input type="radio" name="A4" value="1">
<input type="radio" name="A4" value="2">
<input type="radio" name="A4" value="3">
<input type="radio" name="A4" value="4"><br><br>

<input type="radio" name="B1" value="1">
<input type="radio" name="B1" value="2">
<input type="radio" name="B1" value="3">
<input type="radio" name="B1" value="4"><br>

<input type="radio" name="B2" value="1">
<input type="radio" name="B2" value="2">
<input type="radio" name="B2" value="3">
<input type="radio" name="B2" value="4"><br>

<input type="radio" name="B3" value="1">
<input type="radio" name="B3" value="2">
<input type="radio" name="B3" value="3">
<input type="radio" name="B3" value="4"><br>

<input type="radio" name="B4" value="1">
<input type="radio" name="B4" value="2">
<input type="radio" name="B4" value="3">
<input type="radio" name="B4" value="4"><br><br>

<input type="radio" name="C1" value="1">
<input type="radio" name="C1" value="2">
<input type="radio" name="C1" value="3">
<input type="radio" name="C1" value="4"><br>

<input type="radio" name="C2" value="1">
<input type="radio" name="C2" value="2">
<input type="radio" name="C2" value="3">
<input type="radio" name="C2" value="4"><br>

<input type="radio" name="C3" value="1">
<input type="radio" name="C3" value="2">
<input type="radio" name="C3" value="3">
<input type="radio" name="C3" value="4"><br>

<input type="radio" name="C4" value="1">
<input type="radio" name="C4" value="2">
<input type="radio" name="C4" value="3">
<input type="radio" name="C4" value="4"><br><br>

<input type="radio" name="D1" value="1">
<input type="radio" name="D1" value="2">
<input type="radio" name="D1" value="3">
<input type="radio" name="D1" value="4"><br>

<input type="radio" name="D2" value="1">
<input type="radio" name="D2" value="2">
<input type="radio" name="D2" value="3">
<input type="radio" name="D2" value="4"><br>

<input type="radio" name="D3" value="1">
<input type="radio" name="D3" value="2">
<input type="radio" name="D3" value="3">
<input type="radio" name="D3" value="4"><br>

<input type="radio" name="D4" value="1">
<input type="radio" name="D4" value="2">
<input type="radio" name="D4" value="3">
<input type="radio" name="D4" value="4"><br><br>

<input type=submit value=recognize>
</form>
<?PHP
}
?>
One case was not yet perfectly handled, two of the same values, eg a1 = 1, a2 = 2, a3 = 1, a4 = 2. It then selects the highest of the two.
This can be easily changed by setting the start and end values of the loop differently.

PHP is very much like perl, except for the language. That is, it must be run through an interpreter, like perl, it usually outputs HTML, like perl, and it is a very powerful language, like perl.
There are however some differences too. Some of those are the constant development of PHP as a language, the ease of using PHP and the bitchy errors I get when trying perl. ;)
The best place to learn about PHP is php.net, which also can be used as a reference manual. Just type php.net/file to learn about the file command, and so on. Let me know if I was any help.
 
Joined
Jul 8, 2002
Messages
14,681
If you're doing the project in PHP/HTML, the users would have to download the PHP interpreter and install a web server and that's a pretty big pain for them.

If it needs to be done in PHP, you can make the GUI in PHP-Gtk and use PriadoBlender to get it into a file that doesn't need to be installed.
http://www.priadoblender.com
 

Alex Ethridge

Thread Starter
Joined
Apr 10, 2000
Messages
9,232
Tried to post earlier but the page froze and I was in a hurry to finish a job.

I will have to decide whether to serve this page from a web server/site or distribute it in C++. I have an old version of Borland C++ from about the time we went from Windows 3.1 to Windows 95. I don't want to fork over the bucks for a new edition and, frankly, I wasn't impressed with Borland's C++ anyway.

Most likely I will do it from a web server first. Now to go look at some books on PHP.

I need to get the postitves and negatives of both perl and PHP. What I have read from a Perl book I got in January 2000 sounds good; but, I haven't read anything at all about PHP.
 
Joined
Jul 19, 2005
Messages
37
PHP is just a dream, as you can read right here: http://www.netconcepts.com/php-vs-perl.htm
Personally, I don't think you need any books, as I didn't. (And I've been able to make the script pretty fast)
If you would like any help considering php, I would be happy to help you. Perl, however, I don't know. I've tried, but as soon as I viewed "easy examples" it made me want to jump out of a window :)

By the way, if you want to work in C++, there's a lot of alternatives for Borland.
http://www.cplusplus.com/info/compilers/
 
Joined
Jul 8, 2002
Messages
14,681
This is a pretty simple script, it doesn't really matter if you use Perl or PHP. Either one of these languages will make distributing your program a pain. You'd have to use either PHP-Gtk or wxPerl for the GUI.
You could go with C++ and use a free compiler.
 
Status
This thread has been Locked and is not open to further replies. Please start a New Thread if you're having a similar issue. View our Welcome Guide to learn how to use this site.

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

As Seen On
As Seen On...

Welcome to Tech Support Guy!

Are you looking for the solution to your computer problem? Join our site today to ask your question. This site is completely free -- paid for by advertisers and donations.

If you're not already familiar with forums, watch our Welcome Guide to get started.

Join over 807,865 other people just like you!

Latest posts

Staff online

Top