Page 1 of 3

Programming

PostPosted: Thu Oct 30, 2008 11:38 am
by KupoTony
:comp:Well Hello Everyone.
I made this thread for people who are interested in Programming,and the only two languages i know so far is Java,and Basic programming in a TI-83+ calculator.Well in Java i'm in the progress of learning it,so i would also ask for a more knowledgeable person to help me out with this thread.
Also I don't know C++,so i would need great support from someone who knows about it much.I got an official book called Java Programming,so i can pretty much teach what's neccesary,to learn how to Program in basic steps.
So feel free to join,you can ask questions,if you want to post a program you've made you can also do that,or teach something you've learned,yes you can do that,which is the sole purpose of this thread.

PostPosted: Thu Oct 30, 2008 12:29 pm
by KupoTony
As a start,i'll be posting basic programs,in rawsourcecode,something like "Hello World",or "Hi",both in Java and TI-83+ BasicP.I would like for someone to post them in C++ and explain each component's role within the code.
As of now i'm not using a computer,but when i do,i'll be posting the programs.

PostPosted: Thu Oct 30, 2008 5:01 pm
by Midori
I'd be glad to participate when I can, because I enjoy programming too. I'm not the best at C++ or Java, but if they're simple programs, I can probably translate them if I have the time. I might translate to Perl too, if I'm feeling that way. :P

On the other hand, I don't really want to explain each component like that. If there are specific questions feel free to ask them and I or someone else may be able to answer, but I don't want to feel like I'm a student in a class, if you know what I mean. I get enough of that in school. :dizzy:

PostPosted: Thu Oct 30, 2008 8:02 pm
by KupoTony
Thank you Midori,i'm glad there is someone who can help.
Don't worry about the explaning unless someone asks "how does it work",but please do give a small explanation for particullar lines.

PostPosted: Thu Oct 30, 2008 10:33 pm
by Midori
Well, if there's something in particular I really want to explain, I might put it in a comment directly in the program.

PostPosted: Fri Oct 31, 2008 2:21 am
by Warrior4Christ
I know C++, Java, and perhaps assembly language to an "advanced level". I used to do BASIC back in the day. XD I remember the thrill of making awesome programs on the graphics calculators at school, which were Casio 9850-GB Pluses, rather than TI-83s...
I'm almost-just-about-pretty-much finished my degree now too...

PostPosted: Fri Oct 31, 2008 4:31 pm
by KupoTony
Thank you warriorforChrist
You do know more than me,it seems.You will definitely help us out on this thread-room.

PostPosted: Mon Nov 03, 2008 11:25 pm
by Dante
//Cool. A programming thread!

Most of my code can be found on my webpage:
http://www.tensor-industries.com
under the physics section... more to come because graduate level numerical analysis has decided that I will code every numerical technique under the sun (collapses from homework).

EDIT: I know C#.NET, VB.NET, Java, html and a little Python (although I don't like python that much and I don't know much about it... In fact I use C# almost exclusively). In the future I am hoping to teach myself XNA. The web page above was built entirely in notepad (bragging).

PostPosted: Tue Nov 04, 2008 10:19 am
by Icarus
Pascal (post: 1268088) wrote://Cool. A programming thread!

more to come because graduate level numerical analysis has decided that I will code every numerical technique under the sun (collapses from homework).


Yep yep.

I know some C++, and might be able to make sense of others.

Last thing I wrote was a small encryption program.
Code: Select all
/*Bad Asc, a small, weak encrpytion program written by  "Icarus".
 * The purpose is to take a stream of text and convert it to the numeric
 * equivalent mod some integer. */

//standard include statements for writing to the screen and files.
#include <iostream>
#include <fstream>

//just for convenience
using namespace std];
   char ofilename[30];

   //most likely I could have gotten away with just one variable,
   //but for ease of reading I used two. 'a' holds the choice of
   //operation.
   char text, a;

   ofstream ofile;
   ifstream ifile;

   cout<<"Would you like to (e)ncode or (d)ecode a file?" ;
   cin>>a;
   cout<<"Please enter the file name: ";
   cin>>ifilename;
   
   cout<<"Output goes to which file? ";
   cin>>ofilename;

   //open the files for reading and writing.
   ifile.open(ifilename);
   ofile.open(ofilename);

   if(a=='e'){
      cout<<"Please enter an integer between 70 and 100: ";
      cin>>key;
      //I might add a multiplication key here so that it multiplies
      //by a random number first, then mods by 'key'


      int count=0;

      //I use ifile.get() here instead of just ifile>> to ensure that
      //I preserve whitespace. I tried it without but decoding resulted in
      //one long line of solid characters.
      ifile.get(text);
      ofile<<key<<endl;

      //As long as we aren't at the end of the file:
      while(!ifile.eof()){
         //convert the character to it's ascii equivalent
         x=static_cast<int>(text);
         //divide by the key, and keep the remainder
         quot= x / key;
         rem= x % key;

         //and write them to a file.
         ofile<<quot<<" "<<rem<<" ";
         count+=5;
         //add five spaces to count.
         //once it hits 80, print a new line.
         if(count>75){
            ofile<<endl;
            count=0;
            }
         ifile.get(text);
      }
   }

   //since they don't want to encrypt something, let's decrypt.
   else{
      //read in the key...
      ifile>>key;
      while(!ifile.eof()){
         //and then the values. multiply and add accordingly
         ifile>>temp;
         x=temp *key;
         ifile>>temp;
         x+= temp;

         //then the ascii  value to character and write it
         //to the file.
         text= static_cast<char>(x);
         ofile<<text;
      }

   }

   //close the files and exit.
   ofile.close();
   ifile.close();
   return 0;
}

PostPosted: Tue Nov 04, 2008 1:04 pm
by Dante
Ahh... that's a fun type of program to build, I built my own using C#.NET for the next nations and states game. Its rather complex, but I don't intend on publishing it to the net at the current time :P. (Its always best to keep your encryption programs private instead of public)

PostPosted: Tue Nov 04, 2008 4:51 pm
by KupoTony
Wow you guys blow me with your knowledge,i'm surprised,go ahead post a program you've developed,right now i can't do anything 'cause i don't have a computer,all i use is my Wii to surf the web,but you guys can go ahead and post your programs,please tell which program you used(Java,C++,C#,Basic,TI-83s,etc..)
it would be nice if you could explain it in details,how does your program work,and explain its components....since there are many of us learning and want to know more.
But feel free to show off your programs,
as for anyone else you can request for help in how to build a particular program,and we'll help you out.

PostPosted: Tue Nov 04, 2008 11:38 pm
by Slater
I know C++, Java, HTML, Javascript, PHP, unix scripting, and MIPS ASM very well.

I also know a tiny, tiny bit of x86 ASM. A couple of professors are also splattering half a dozen scripting languages in my face, so I'm picking those up as well (they're pretty nifty).

Also studying the Theory of Computing this semester... it's ffffffffffun...

PostPosted: Wed Nov 05, 2008 3:52 am
by Warrior4Christ
Pascal (post: 1268190) wrote:Ahh... that's a fun type of program to build, I built my own using C#.NET for the next nations and states game. Its rather complex, but I don't intend on publishing it to the net at the current time :P. (Its always best to keep your encryption programs private instead of public)

Open source encryption programs disagree. :P

Pascal (post: 1268088) wrote://Cool. A programming thread!

Most of my code can be found on my webpage:
http://www.tensor-industries.com
under the physics section... more to come because graduate level numerical analysis has decided that I will code every numerical technique under the sun (collapses from homework).

Do you have the book "Numerical Recipes In C" or another variant? That might be useful.

My final year engineering project has been an arbitrary precision (integer) arithmetic library in the Residue Number System (written in C). It's almost complete. RNS is another numerical technique you might want to have some fun with. :P

PostPosted: Wed Nov 05, 2008 8:37 am
by Technomancer
Slater (post: 1268427) wrote:I know C++, Java, HTML, Javascript, PHP, unix scripting, and MIPS ASM very well.

I also know a tiny, tiny bit of x86 ASM.


Assembly's fun. I need to focus a bit more on that, esp. for the TI C6173 since I expect I'll be working with that a fair bit in the near future.

My main languages have been Pascal, C/C++ and MATLAB, although I've also done assembly programming with the x86, Z80 and 8051. Aside from the TI stuff, I'm also hoping to get the time to learn UML (not programming) and if I'm able to, Ada.

PostPosted: Wed Nov 05, 2008 8:59 pm
by blkmage
I know C++ and Java fairly well, and I've picked up JavaScript/Actionscript, PHP, and Python. I do want to get into some functional programming, which I'll probably start out with in JavaScript but I do want to get into a Lisp eventually.

PostPosted: Thu Nov 06, 2008 6:23 am
by termyt
I'm old school. I know C and Visual Basic best (as well as Lisp, Pascal, and some Assembler) and I'm a little weak on object-oriented programming. I’m working on picking up Java in my spare time, which I have little of :sweat:

The upside is I’m doing it for work, so it means I get paid to learn it. The downside is it’s also work that’s the reason I don’t have the time I need to learn it quickly or properly :P

Ah well, we can’t have it all ways.

PostPosted: Thu Nov 06, 2008 12:44 pm
by Ashley
*sends up the Cap'n Nick signal* I know he'd be interested in this thread...

PostPosted: Thu Nov 06, 2008 3:07 pm
by Steve Racer
Icarus (post: 1268156) wrote:Yep yep.

I know some C++, and might be able to make sense of others.

Last thing I wrote was a small encryption program.

//most likely I could have gotten away with just one variable,
//but for ease of reading I used two. 'a' holds the choice of
//operation.


You named your variables 'a' and 'e'? :) When I was in my first programming class in college, I used to use x,y, and z. My teacher kept telling me to use descriptive variables but I never did... so my next project worked fine, compiled no errors... and I got a ZERO.

After that I got much better at commenting, indenting, and variable naming.

I am an MCSD in Visual Basic, and I can do C and Java too... I do some PHP sometimes. I wrote a game in Visual Basic in 2000 to practice my VB for the certification.

It's STILL up but it's old if you want to play it: http://stephanosquest.cjb.net/

PostPosted: Thu Nov 06, 2008 11:59 pm
by Icarus
Eh, I did this one for fun, and random variables don't need good names. Matrix indexing variables get row, col, layer, etc. Important stuff gets named well, random get a, x, y, j, etc.

And e is my favorite number.

PostPosted: Fri Nov 07, 2008 7:49 am
by Amzi Live
*walks in quietly*
Well,I'm a totall neophyte,but I'm studying computer engineering,and will be taking this eventually. I'll be following this thread. I'd always wanted to get into programming.

PostPosted: Fri Nov 07, 2008 8:10 am
by ClosetOtaku
termyt (post: 1268770) wrote:I'm old school. I know C and Visual Basic best (as well as Lisp, Pascal, and some Assembler) and I'm a little weak on object-oriented programming. I’m working on picking up Java in my spare time, which I have little of :sweat:

The upside is I’m doing it for work, so it means I get paid to learn it. The downside is it’s also work that’s the reason I don’t have the time I need to learn it quickly or properly :P

Ah well, we can’t have it all ways.


You are my hero!!

I know Basic, Pascal, C, and Assembler (specifically for the Motorola 68000) very well.

I've also programmed in LISP, FORTRAN, and COBOL; I've tinkered in Visual Basic, C++, and Java, but not nearly enough to consider myself fluent.

This kind of dates me...

The best learning exercise I have ever had was the final project for COMP SCI 211, when I was an undergrad at Carnegie-Mellon. It was a take-home exam (that didn't help any).

We were given a programming language called "Small", which was a Pascal-like construct. We were given a program that was written in "Small" and told to execute it.

To do so, we were given a compiler, written in Pascal, that would take the program in Small and turn it into a Pascal executable. Here's the kicker: there were huge chunks of the compiler that were missing.

The final exam: fill in the huge chunks, compile the program, run the program.

This exercise took about two weeks. But it was undoubtedly the best programming challenge I've had to date.

PostPosted: Sat Nov 08, 2008 12:32 am
by Icarus
[quote="ClosetOtaku (post: 1268996)
The best learning exercise I have ever had was the final project for COMP SCI 211, when I was an undergrad at Carnegie-Mellon. It was a take-home exam (that didn't help any).

We were given a programming language called "Small", which was a Pascal-like construct. We were given a program that was written in "Small" and told to execute it.

To do so, we were given a compiler, written in Pascal, that would take the program in Small and turn it into a Pascal executable. Here's the kicker: there were huge chunks of the compiler that were missing.

The final exam: fill in the huge chunks, compile the program, run the program.

This exercise took about two weeks. But it was undoubtedly the best programming challenge I've had to date.[/QUOTE"]


... Wins.

PostPosted: Sat Nov 08, 2008 7:06 pm
by Warrior4Christ
[quote="ClosetOtaku (post: 1268996)"]You are my hero!!

I know Basic, Pascal, C, and Assembler (specifically for the Motorola 68000) very well.

I've also programmed in LISP, FORTRAN, and COBOL]
That's pretty cool (cruel?)...

There used to exist a subject called Compiler Construction which really interests me, but they finished it a year or two before I could choose it (apparently it was one that lecturers that did it back in their day really liked and were challenged by it). Oh well.. they still had all the notes and resources there, so I'm part way through looking at it all myself.

PostPosted: Sun Nov 09, 2008 5:56 pm
by Dante
Do you have the book "Numerical Recipes In C" or another variant? That might be useful.

My final year engineering project has been an arbitrary precision (integer) arithmetic library in the Residue Number System (written in C). It's almost complete. RNS is another numerical technique you might want to have some fun with.


Probably will pick that one up when I get more money. Do you know if the older edition is as good as the new one?

PostPosted: Mon Nov 10, 2008 6:41 am
by Technomancer
Most of the basic algorithms don't change; although I believe there were a few additions to reflect recent advances. You can also download some of the older books for free:

http://www.nr.com/oldverswitcher.html

Most of the book's contents should still be quite relevant.

PostPosted: Mon Nov 10, 2008 6:59 am
by termyt
One of my favoriteclasses back in my days at the University of Akron was the Compiler course. We wrote a non-Ansi C compiler from scratch over the 15 week course.

A similar class that I did not like as much was the Operating System class. It was kind of similar - we wrote an OS over 15 weeks, but that was no where near as much fun.

Those are still the "good old days" though. The class just one year behind me started doing everything in C++ and OOP, so I was kind of jealous, or at least sad I wasn't born a year later :P

PostPosted: Tue Nov 11, 2008 10:10 pm
by KupoTony
I know guys this might sound for you very newbie,but.......does anyone know a simple step-by-step Algorithm for RNGs,and RBGs,without using functions that already has the ability to display random numbers,(in Basic,TI-83+ is rand,randint(),randnm())......and can anyone show me the sketch of a Seed,and how to make one,and a randomnumberfunction,in just hardcore algorithms,not functions with related capabilities,can you show it in Java and explain it.....
Also as for the things i was gonna do,still i'm not using a computer as of now(i only have a Wii),so i can't post simple Java programs like the text "Hello World" coming out of a tea cup with the word Java encrypted around......as for now u guys can post your own basic programs,so others can learn about them,please explain their components if necessary,otherwise don't have to.....

Oh yeah as for the heck of it,x-one guy post his program,and x-two guy review it,and edit it,and post it,showing explanation why he edited it,and so on.....you guys can do that also.

PostPosted: Tue Nov 11, 2008 10:45 pm
by Warrior4Christ
KupoTony (post: 1269926) wrote:I know guys this might sound for you very newbie,but.......does anyone know a simple step-by-step Algorithm for RNGs,and RBGs,without using functions that already has the ability to display random numbers,(in Basic,TI-83+ is rand,randint(),randnm())......and can anyone show me the sketch of a Seed,and how to make one,and a randomnumberfunction,in just hardcore algorithms,not functions with related capabilities,can you show it in Java and explain it.....

It's not a trivial task to do. It's hard to make it as pseudo-ly random as possible.

This book covers it though:
http://www.informit.com/store/product.aspx?isbn=0201896842

PostPosted: Wed Nov 12, 2008 10:04 pm
by muskrat
Doesn't matter what experience they had pre-college, our school starts everyone out with Ada. Its a strongly typed language with a fairly strict compiler so it teaches proper programming technique (I guess). Past that, I know a little C/C++/Java, some shell scripting (bash) and might be able to help if anyone is messing with Prolog.

PostPosted: Thu Nov 13, 2008 7:00 pm
by KupoTony
Well i heard there is not such thing as a random generator function,instead it's a distributor of very large sequences,repeating itself at a fixed point,and that that's what the Seed does basically-gives a domain to the function and a headstart variable with a sequential-algorithm,but i have no idea how to develope a Seed.neither a suedo-random number distributor,that requires a Seed......
Has anyone ever developed one,or copied a structure of one and use it,if so can i see it,i would love to see one,this will definitely help me out alot in being lenguage-minded for future reference..........??????