Programming

The geek forum. PHP, Perl, HTML, hardware questions etc.. it's all in here. Got a techie question? We'll sort you out. Ask your questions or post a link to your own site here!

Programming

Postby KupoTony » Thu Oct 30, 2008 11:38 am

: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.
[color="Blue"]
[/color]The Divine Trinity of Holiness:
Love.
Righteousness.
Justice.
Both in series and paralleled,Tangeable,Independant of Itself,but dependable to each other.
KupoTony
 
Posts: 39
Joined: Tue Oct 28, 2008 8:51 pm
Location: Strasburg,Virginia

Postby KupoTony » Thu Oct 30, 2008 12:29 pm

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.
[color="Blue"]
[/color]The Divine Trinity of Holiness:
Love.
Righteousness.
Justice.
Both in series and paralleled,Tangeable,Independant of Itself,but dependable to each other.
KupoTony
 
Posts: 39
Joined: Tue Oct 28, 2008 8:51 pm
Location: Strasburg,Virginia

Postby Midori » Thu Oct 30, 2008 5:01 pm

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:
User avatar
Midori
 
Posts: 1805
Joined: Mon Sep 12, 2005 6:43 pm
Location: Mingling with local sentients

Postby KupoTony » Thu Oct 30, 2008 8:02 pm

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.
[color="Blue"]
[/color]The Divine Trinity of Holiness:
Love.
Righteousness.
Justice.
Both in series and paralleled,Tangeable,Independant of Itself,but dependable to each other.
KupoTony
 
Posts: 39
Joined: Tue Oct 28, 2008 8:51 pm
Location: Strasburg,Virginia

Postby Midori » Thu Oct 30, 2008 10:33 pm

Well, if there's something in particular I really want to explain, I might put it in a comment directly in the program.
User avatar
Midori
 
Posts: 1805
Joined: Mon Sep 12, 2005 6:43 pm
Location: Mingling with local sentients

Postby Warrior4Christ » Fri Oct 31, 2008 2:21 am

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...
Everywhere like such as, and MOES.

"Expect great things from God; attempt great things for God." - William Carey
User avatar
Warrior4Christ
 
Posts: 2045
Joined: Sat Aug 20, 2005 8:10 pm
Location: Carefully place an additional prawn on the barbecue

Postby KupoTony » Fri Oct 31, 2008 4:31 pm

Thank you warriorforChrist
You do know more than me,it seems.You will definitely help us out on this thread-room.
[color="Blue"]
[/color]The Divine Trinity of Holiness:
Love.
Righteousness.
Justice.
Both in series and paralleled,Tangeable,Independant of Itself,but dependable to each other.
KupoTony
 
Posts: 39
Joined: Tue Oct 28, 2008 8:51 pm
Location: Strasburg,Virginia

Postby Dante » Mon Nov 03, 2008 11:25 pm

//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).
FKA Pascal
User avatar
Dante
 
Posts: 1323
Joined: Thu Mar 04, 2004 8:24 pm
Location: Where-ever it is, it sure is hot!

Postby Icarus » Tue Nov 04, 2008 10:19 am

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;
}
The Forsworn War of 34

††
User avatar
Icarus
 
Posts: 1477
Joined: Sun Nov 09, 2003 5:00 am
Location: 34

Postby Dante » Tue Nov 04, 2008 1:04 pm

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)
FKA Pascal
User avatar
Dante
 
Posts: 1323
Joined: Thu Mar 04, 2004 8:24 pm
Location: Where-ever it is, it sure is hot!

Postby KupoTony » Tue Nov 04, 2008 4:51 pm

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.
[color="Blue"]
[/color]The Divine Trinity of Holiness:
Love.
Righteousness.
Justice.
Both in series and paralleled,Tangeable,Independant of Itself,but dependable to each other.
KupoTony
 
Posts: 39
Joined: Tue Oct 28, 2008 8:51 pm
Location: Strasburg,Virginia

Postby Slater » Tue Nov 04, 2008 11:38 pm

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...
Image
User avatar
Slater
 
Posts: 2671
Joined: Sat May 22, 2004 10:00 am
Location: Pacifica, Caliphornia

Postby Warrior4Christ » Wed Nov 05, 2008 3:52 am

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
Everywhere like such as, and MOES.

"Expect great things from God; attempt great things for God." - William Carey
User avatar
Warrior4Christ
 
Posts: 2045
Joined: Sat Aug 20, 2005 8:10 pm
Location: Carefully place an additional prawn on the barbecue

Postby Technomancer » Wed Nov 05, 2008 8:37 am

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.
The scientific method," Thomas Henry Huxley once wrote, "is nothing but the normal working of the human mind." That is to say, when the mind is working; that is to say further, when it is engaged in corrrecting its mistakes. Taking this point of view, we may conclude that science is not physics, biology, or chemistry—is not even a "subject"—but a moral imperative drawn from a larger narrative whose purpose is to give perspective, balance, and humility to learning.

Neil Postman
(The End of Education)

Anti-intellectualism has been a constant thread winding its way through our political and cultural life, nurtured by the false notion that democracy means that my ignorance is just as good as your knowledge

Isaac Aasimov
User avatar
Technomancer
 
Posts: 2379
Joined: Fri Jun 13, 2003 11:47 am
Location: Tralfamadore

Postby blkmage » Wed Nov 05, 2008 8:59 pm

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.
User avatar
blkmage
 
Posts: 4529
Joined: Mon May 03, 2004 5:40 pm

Postby termyt » Thu Nov 06, 2008 6:23 am

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.
[color="Red"]Please visit Love146.org[/color]
A member of the Society of Hatted Members
Image
If your pedantic about grammar, its unlikely that you'll copy and paste this into your sig, to.
User avatar
termyt
 
Posts: 4289
Joined: Sat Jun 26, 2004 12:00 pm
Location: oHIo

Postby Ashley » Thu Nov 06, 2008 12:44 pm

*sends up the Cap'n Nick signal* I know he'd be interested in this thread...
Image
User avatar
Ashley
 
Posts: 7364
Joined: Mon May 26, 2003 10:00 am
Location: Fort Worth, Texas

Postby Steve Racer » Thu Nov 06, 2008 3:07 pm

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/
-Steve Racer
Director of Fans for Christ
Author of God Loves the Freaks
Film and Voice Actor
User avatar
Steve Racer
 
Posts: 83
Joined: Sat Jan 29, 2005 11:02 am
Location: Los Angeles, CA

Postby Icarus » Thu Nov 06, 2008 11:59 pm

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.
The Forsworn War of 34

††
User avatar
Icarus
 
Posts: 1477
Joined: Sun Nov 09, 2003 5:00 am
Location: 34

Postby Amzi Live » Fri Nov 07, 2008 7:49 am

*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.
[font="Arial Narrow"] Teach me thy way, O LORD; I will walk in thy truth: unite my heart to fear thy name. Psalm86:11[/font]
Proud lurker? Join MOES,and help us stay cool.
[SIGPIC][/SIGPIC]
User avatar
Amzi Live
 
Posts: 360
Joined: Fri Jun 08, 2007 3:12 pm
Location: I walk in fields,forests,and cities of sound ♪♫♫♪

Postby ClosetOtaku » Fri Nov 07, 2008 8:10 am

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.
"If I find in myself a desire which no experience in this world can satisfy, the most probable explanation is that I was made for another world." -- C.S. Lewis
User avatar
ClosetOtaku
 
Posts: 927
Joined: Tue Jul 06, 2004 3:12 am
Location: Alexandria, VA

Postby Icarus » Sat Nov 08, 2008 12:32 am

[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.
The Forsworn War of 34

††
User avatar
Icarus
 
Posts: 1477
Joined: Sun Nov 09, 2003 5:00 am
Location: 34

Postby Warrior4Christ » Sat Nov 08, 2008 7:06 pm

[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.
Everywhere like such as, and MOES.

"Expect great things from God; attempt great things for God." - William Carey
User avatar
Warrior4Christ
 
Posts: 2045
Joined: Sat Aug 20, 2005 8:10 pm
Location: Carefully place an additional prawn on the barbecue

Postby Dante » Sun Nov 09, 2008 5:56 pm

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?
FKA Pascal
User avatar
Dante
 
Posts: 1323
Joined: Thu Mar 04, 2004 8:24 pm
Location: Where-ever it is, it sure is hot!

Postby Technomancer » Mon Nov 10, 2008 6:41 am

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.
The scientific method," Thomas Henry Huxley once wrote, "is nothing but the normal working of the human mind." That is to say, when the mind is working; that is to say further, when it is engaged in corrrecting its mistakes. Taking this point of view, we may conclude that science is not physics, biology, or chemistry—is not even a "subject"—but a moral imperative drawn from a larger narrative whose purpose is to give perspective, balance, and humility to learning.

Neil Postman
(The End of Education)

Anti-intellectualism has been a constant thread winding its way through our political and cultural life, nurtured by the false notion that democracy means that my ignorance is just as good as your knowledge

Isaac Aasimov
User avatar
Technomancer
 
Posts: 2379
Joined: Fri Jun 13, 2003 11:47 am
Location: Tralfamadore

Postby termyt » Mon Nov 10, 2008 6:59 am

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
[color="Red"]Please visit Love146.org[/color]
A member of the Society of Hatted Members
Image
If your pedantic about grammar, its unlikely that you'll copy and paste this into your sig, to.
User avatar
termyt
 
Posts: 4289
Joined: Sat Jun 26, 2004 12:00 pm
Location: oHIo

Postby KupoTony » Tue Nov 11, 2008 10:10 pm

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.
[color="Blue"]
[/color]The Divine Trinity of Holiness:
Love.
Righteousness.
Justice.
Both in series and paralleled,Tangeable,Independant of Itself,but dependable to each other.
KupoTony
 
Posts: 39
Joined: Tue Oct 28, 2008 8:51 pm
Location: Strasburg,Virginia

Postby Warrior4Christ » Tue Nov 11, 2008 10:45 pm

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
Everywhere like such as, and MOES.

"Expect great things from God; attempt great things for God." - William Carey
User avatar
Warrior4Christ
 
Posts: 2045
Joined: Sat Aug 20, 2005 8:10 pm
Location: Carefully place an additional prawn on the barbecue

Postby muskrat » Wed Nov 12, 2008 10:04 pm

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.
User avatar
muskrat
 
Posts: 24
Joined: Tue Jan 31, 2006 6:51 pm
Location: Where am I?

Postby KupoTony » Thu Nov 13, 2008 7:00 pm

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..........??????
[color="Blue"]
[/color]The Divine Trinity of Holiness:
Love.
Righteousness.
Justice.
Both in series and paralleled,Tangeable,Independant of Itself,but dependable to each other.
KupoTony
 
Posts: 39
Joined: Tue Oct 28, 2008 8:51 pm
Location: Strasburg,Virginia

Next

Return to Computing and Links

Who is online

Users browsing this forum: No registered users and 168 guests