Iron_Cross 32 Junior Poster

Just because it tells you there's an error doesn't mean your using try/catch block correctly. It will tell you there is an error even if you have any try/catch blocks. You need to try to handle the error in the try catch block.

From what you described, you need to reset the variables you're using inside the try/catch blocks or reset them when the encrypting is done (i.e. in a finally block). I'm like 99.99% sure that's what your problem is.

Iron_Cross 32 Junior Poster

Some other classes you could take the next year is some computer science classes. Those could give you a small taste of what the general idea is. Also, be sure you get plenty of math, it will help you tremendously. Good luck.

Iron_Cross 32 Junior Poster
Iron_Cross 32 Junior Poster

jext.org was made in java...I believe netbeans.org was made in java. Those are not ones I made, but you'll see the capabilities of Java by looking at them.
Java is a very powerful language, just put your mind to it.

Iron_Cross 32 Junior Poster

I often see people asking the same question over and over, "How do I learn to program, and where do I start?" Some people may take that question to the next level by asking, "Which language should I learn first?". The answer to those questions is fairly simple, but also a little subjective. So I'm going to attempt to help solve those very valid, logical questions.

How do I program?
Programming is the act of giving the computer information and directions to complete a certain task. Most often programming is achieved by typing in a certain "Programming Language" into a normal text editor, then compiled (or 'made' into machine language that the computer can understand) into native or interpreted code, which I'll explain soon. There is also several programs that are called IDE's or Integrated Development Environments. These are useful in several aspects. For one, they look similar to a normal text editor, but they color coordinate your code, to make it easier to read at a glance. They can also perform automated tasks for, that ease up the amount of typing you have to do. They also provide a single area to write, compile, link, test, and run your programs, without having to use several different utilities. But you are not forced to use an IDE, it just makes your job, as the programmer, slightly easier. Now, you can't just use any IDE you want, most often, IDEs are specialized for a certain language. Search for …

~s.o.s~ commented: Good one - ~s.o.s~ +14
arjunsasidharan commented: Well Done! +3
Aelphaeis commented: very good summary of languages and getting started on programming +1
FreeBirdLjj commented: Great! +0
\007 commented: Great FAQ! +0
mike_2000_17 commented: Nice! And you managed to keep your pure OOP / Java bias (almost) under control! +14
Iron_Cross 32 Junior Poster

Meh, flash isn't good for long term stuff. That's just my opion. I like flash for little cartoons and games and stuff, not applications.

http://www.daniweb.com/tutorials/tutorial16923.html
Read that.

Iron_Cross 32 Junior Poster

You can do it with the Session and Application objects...but it's better if you use Cookies or GET/POST methods.

Iron_Cross 32 Junior Poster

You can't just reference the particular cell in DataRow[DataColumn] = [some var here] form?

Iron_Cross 32 Junior Poster

Don't quote me on this, but it might have something to do with making it a service, rather than an application.

Iron_Cross 32 Junior Poster

how could u turna string straight to a dataaset

I recently wrote a program that did exactly that. It imported a .csv file into a dataset then exported all the data to a SQL Server 2000 DB. I would give you the source, except there is a lot happening in there that doesn't apply to this so it would be confusing.

Basically what I did was I read one line of text at a time, then I divided that text by the commas. Then I used each of those "cells" as the data for a datatable that I just looped over at the same time I was looping over the CSV file.

Iron_Cross 32 Junior Poster

C# For the absolute beginner is quite good. Really, I haven't seen that many "bad" C# beginner books. You just need to search amazon and you'll find like a thousand. Most of the time from reading the customer reviews you can find out a good amount.

Iron_Cross 32 Junior Poster

Please use the code blocks next time :)

Option Strict On

Public Class videoBonanzaSaleForm
Inherits System.Windows.Forms.Form

' Declare Constants
Const DVD_PRICE_Decimal As Decimal = 2.5D
Const NEW_RELEASE_DVD_Decimal As Decimal = 3D
Const VHS_PRICE_Decimal As Decimal = 1.8D
Const NEW_RELEASE_VHS_Decimal As Decimal = 2D
Const DISCOUNT_RATE_Decimal As Decimal = 0.1D

' Declare module-level variables.
Dim customerCountInteger As Integer
Dim grandTotalDecimal, totalDecimal, itemAmountDecimal As Decimal


Private Sub calculateButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles calculateButton.Click
    ' Calculate and display the current amounts.

    Dim priceDecimal, discountDecimal As Decimal

    If titleTextBox.Text <> "" Then

        If dvdRadioButton.Checked = True Or vhsRadioButton.Checked = True Then

            ' Find the price.
            [b]If dvdRadioButton.Checked Then
                If newReleaseCheckBox.Checked Then
                    priceDecimal = NEW_RELEASE_DVD_Decimal
                Else
                    priceDecimal = DVD_PRICE_Decimal
                End If
            ElseIf vhsRadioButton.Checked Then
                If newReleaseCheckBox.Checked Then
                    priceDecimal = NEW_RELEASE_VHS_Decimal
                Else
                    priceDecimal = VHS_PRICE_Decimal
                End If
            End If [/b]

            ' Calculate the extended price and add to order total.
            If memberCheckBox.Checked Then
                discountDecimal = priceDecimal * DISCOUNT_RATE_Decimal
            Else
                discountDecimal = 0
            End If

            itemAmountDecimal = priceDecimal - discountDecimal
            totalDecimal += itemAmountDecimal

            itemAmountLabel.Text = itemAmountDecimal.ToString("C")
            totalLabel.Text = totalDecimal.ToString("C")
        Else
            MessageBox.Show("A Movies Format Must Be Selected", "Data Entry Error", _
            MessageBoxButtons.OK, MessageBoxIcon.Error)
        End If
    Else
        MessageBox.Show("A Title Must Be Entered.", "Data Enrty Error", _
        MessageBoxButtons.OK, MessageBoxIcon.Error)
        titleTextBox.Focus()
    End If

    ' Allow a change only for a new order.
    memberCheckBox.Enabled = False

    ' Allow clear after an order has begun.
    clearButton.Enabled = True

    ' Reset format Radio Buttons and clear text box.
    vhsRadioButton.Checked = False
    dvdRadioButton.Checked = False
    titleTextBox.Clear()

End Sub

The …

Iron_Cross 32 Junior Poster

First outline what all you want the program to do. Then I'd go in and start implementing the structure of the system in coments and psuedo code. Then you can go in and fill in the blanks. But the main point is to FIRST PUT IT ON PAPER. :)

Iron_Cross 32 Junior Poster

Maybe you're using the wrong encoding? (i.e. ASCII or Unicode. I'd try using unicode, see if that helps)

Iron_Cross 32 Junior Poster

Huh? Do you want to check to see if someone uploaded the same image twice? You could check the filename and filesize...other than that I'm not sure what you're asking.

Iron_Cross 32 Junior Poster

C# is my favorite, it's got a nice clean syntax. Easy to learn, easy to implement. VB (in any form) makes me shudder. C++ managed...why(you could just use C# :D )?! That's my oppinion.

Iron_Cross 32 Junior Poster

There are several ways to do that, I would go about it this way:

// the encrypt button event handler
encrypt_Click(object sender, EventArgs e)
{
    // assuming you've named the text box for the key txtKey and the
    // combo box for the encryption type cboEnc do the following
    string key = txtKey.Text;
    string encType = cboEnc.SelectedItem.ToString();
    switch(encType)
    {
          case "FirstEncryptionType":
               // use this encryption;
               break;
          case "SecondEncryptionType":
               // use this encryption
               break;
          default:
               // use the final incryption type
               break;
       }
}

So maybe I'm not understandin your question properly. But that's how you could do, just use a switch statment to find out which encryption type to use, then do the statements from there.

Iron_Cross 32 Junior Poster

I know this thread has been marked solved, but for anyone else wondering the same thing; you could also use the == operator. It's been overloaded in C#, so it works just fine ;)

Iron_Cross 32 Junior Poster

Umm...what are you tryng to do? To use an array (for example and array of int's) you just do this

int[] dieSides = new int[6];
dieSides[0] = 1;
dieSides[1] = 2;
etc.. 
Iron_Cross 32 Junior Poster

When using VS.NET clikc Debug->Start or press F5

Iron_Cross 32 Junior Poster

What do you want to know about it? If you use C#.NET it's like Java. If you use C++.NET it's like C++. If you use VB.NET it's like VB. If you use J++ or J#.net it's like java (1.1). If you use Perl.NET it's like perl. If you use Python.NET it's like Python. If you use Ruby.NET it's like Ruby....get the picture?

Pretty much the syntax is the exact same as the language it's modeled after.

Iron_Cross 32 Junior Poster

So long as you have an instance of the second internal frame in the class with the listeners it shouldn't be that hard. If worste comes to worste make the instance of the second internal frame static.
Also could you post some of your code, or explain why you're having such a hard time with this problem.

Iron_Cross 32 Junior Poster

If you're having trouble try reading in the integers into an array. Or you could turn the string into an array with the CopyTo() method or ToArray() methods.

Iron_Cross 32 Junior Poster

Could you give us the code example, that might help us answer you question faster. Thanks :)

Iron_Cross 32 Junior Poster

It looks to me like you were trying to make a statement and were proven wrong :D

Iron_Cross 32 Junior Poster

go to www.seclude.org it's an entire messaging system, like aim or msn or whatnot. It's written in Java, and it's fully open source and free to download. It also implements some very advanced encryption techniques. It's quite possibly the safest way to talk over the internet. Download it and see how they conquered this problem.

Iron_Cross 32 Junior Poster

No it's not. The closest thing you'll be able to do is to use a HashMap. Which is a list of key/value pairs. The string would be the key, and the object would be the value.

public class HashTest {
    private HashMap objList;
    private Object obj;
    private String objName;

    public HashTest(){
        this(20);
    }    

    public HashTest(int size){
        this.objList = new HashMap(size);
    }

    public void add(Object obj, String name){
          this.objList.put(obj,name);
    }

    public void remove(String name){
         this.objList.remove(name);
    }
 
    public Object get(String name){
         if(this.objList.containsKey(name))
              this.objList.get(name);
         else
              return;
    }

    public void showObjects(){
         String name;
         ArrayList ar = new ArrayList(this.objList.values());
         for(int i = 0; i < ar.size(); i++){
              name = ar.get(i);
              System.out.println(name);
         }
    }
        
    public static void main(String[] args){
        HashTest test = new HashTest(5);
        
        String name = "sani";
        Object o = new Object(); // <-- that would be some object you want to name
        String name2 = "mandy";
        Object o2 = new Object();
        
        test.add(o,name);
        test.add(o2,name2);

        test.showObjects();
        test.remove("sani");

        test.showObjects();
    }
}

Try that out, you may need to add some casts and stuff, but you should get the idea.

Iron_Cross 32 Junior Poster

have you tried something like System.exec("fileName.exe");
Of course, from an applet you couldn't do this unless you were granted full permissions in security.

Iron_Cross 32 Junior Poster

Yeah. I'd suggest using the 1.4.2 or 1.5.0 packages (which include the awt and swing packages). Unless you're building an applet, then I'd stick to the 1.1 packages.

Iron_Cross 32 Junior Poster

Do you mean an engine? If that's what you mean, then just search google for a Java Game Engine you'll find tons of free ones. Otherwise, I'm not sure I know what you mean. :P

Iron_Cross 32 Junior Poster

http://java.sun.com/
If you think I'm being stupid, just search there. I swear they have better tutorials there than anywhere else on the web.

Iron_Cross 32 Junior Poster
// import java.io package and utility packages
import java.io.*;
import java.util.*;

class Stopwatch{ 

    //declared outside of all methods
    private long startTime;
    public void start() {
        GregorianCalendar now = new GregorianCalendar();
        startTime = now.getTimeInMillis();
    }

    public void showElapsedTime() {
        GregorianCalendar now = new GregorianCalendar();
        long currTime = now.getTimeInMillis();
        long difference = (currTime - startTime)/1000;
        System.out.print(difference);
        System.out.println(" seconds have elapsed.");
    }
}

class Irritating_stopwatch {
    public static void main(String arg[]) throws Exception {
        BufferedReader keyboard = new BufferedReader(new InputStreamReader(System.in));
        Stopwatch timer = new Stopwatch();
        for (int i=9; i>=0; i--){
            System.out.println("Hit the Enter key to Start timer");
            keyboard.readLine();
            timer.start();
            System.out.println("Hit the Enter key to Stop timer");
            keyboard.readLine();
            timer.showElapsedTime();
            Counter.decrease();
            System.out.print(Counter.getValue());
            System.out.println(" More Tries");
            System.out.println();
            System.out.println("Hit the Enter key to initialize timer");
            keyboard.readLine();
        }
        System.out.println("Due to planned obsolescence, this Stopwatch is no longer perational");
        System.out.println();
    }
}

class Counter {
    private static int callCount = 10;

    public static void decrease() {
        callCount --;
    }

    public static int getValue() {
        return callCount;
    }
}

Basically, just instead of creating an instance of Counter, you just call the methods direct... Counter.decrease(); and so on and so forth.

Iron_Cross 32 Junior Poster

Ok, well I'm assuming you know you're running your scripts on a .NET enabled server. Also, I'm assuming you're using your WebForm1.aspx.vb as your code behind page (which is loaded at the top of the *.aspx page. If this isn't the case, take off the .vb
I.e. don't type in a URL like http://www.somesite.com/someDir/somePage.aspx.vb it shouldn't have the .vb
As for the page load, there should be a method in your aspx file that's something like (forgive me if it's wrong because I don't have my docs to look at right now)

public void OnPage_Load(object sender, EventArgs e){
    if(Page.IsPostBack()){
        // do stuff if the page is posted back
    } else {
        // Do stuff only the first time the page loads
    }
    // do stuff no matter which time the page loads
}

That's all in C# but you should get the idea. Once I check my docs, I'll get back to you if it's wrong

Iron_Cross 32 Junior Poster

Yeah, I think it depends on which peice you're wanting to talk to.

Iron_Cross 32 Junior Poster

right click on the .cpp file in the solution menu, then click remove from project or delete.

Iron_Cross 32 Junior Poster

Dude, put your code inside the code tags. And also, you can check in here for the modified code, no one is going to e-mail it to you. That's just rude of you to ask that.

Iron_Cross 32 Junior Poster

My guess is that it's the cache. That happens to me too only when I'm developing in ASP.NET my computer caches the page, so I have to hit refresh to see the updated page. Just give it an hour or so and you sohuld be fine. I think you can also set IE to NOT cache pages.

Iron_Cross 32 Junior Poster

Yeah, use DataBind() you may have to read up on it. But bind to a certain source, say an ArrayList, then just update the ArrayList, after that just do dataGrid.DataBind() and you rows and columns will be updated.

Iron_Cross 32 Junior Poster

You need to add it to your system variables. It depends on what OS you're running as to how to do this. Or you could just type in the full path name like:

C:\Program Files\Sun\JavaSDK\bin\javac.exe program.java
C:\Program Files\Sun|JavaSDK\bin\java.exe program

Of course, your's is probably different. But youshould get the idea.

Iron_Cross 32 Junior Poster
DataTable dt = dataGrid.Table["People"];
dt.Rows[4]["Colum 4"].Text = "BLAH!";

That is asuming you have a datagrid with a table named "People" and in that table you have a column named "Column 4". That would change the text in that particular cell. (Row 4, Column 4)

Iron_Cross 32 Junior Poster

rickste_r,
Don't give out homework for free! They're never going to learn anything if you do it for them. There is nothing wrong with helping them, but DON'T do it for them!
And also, use the code tags around your code please

Thank you.

Iron_Cross 32 Junior Poster

A string tokenizer will separate that long string in an array of small strings.
I.e.
If you had the string "My@Name@Is@bobby@!" (that's not my name btw ;) ) and you set up a string tokenizer to deliminate by @ you'd end up with an array of 5 elements.
"My","Name","is","bobby","!"
Then you could loop through the array trying to match certain cases.

import java.util.*;
public class TokenizerTest{
	public static void main(String[] args){
		String input = "step(sent(1,A,B,vars(Na,Rv,ped(pk(B),cat(Na,A)))))" 
		String output = null;
		StringTokenizer st = new StringTokenizer(input,")");
		while(st.hasMoreTokens()){
			if(st.nextToken().equals("some string")){
				// do stuff here
			}
		}
		System.out.println("Output: "+ output);
	}
}

I'm not sure how the input relates to the output so you can figure that out. But atleast you should know how now. After you tokenize by ")" you'll be left with 8 tokens:
"step"
"sent"
"1,A,B,vars"
"Na,Rv,ped"
"Pk"
"B"
",cat"
"Na,A"

If you want you could deliminate even further by "," but that's up to you.

Iron_Cross 32 Junior Poster

Do you know anything about the .NET framework? Or any of the languages used in it (C#, VB.NET, C++, ASP.NET[well that's kinda like VB and C#], J#, etc) if you know any of those you should be fine.
Or they could be testing you on what the .NET framework provides and does. It's basically an interpreter for MSIL (Microsoft Intermidiate Language) the CLR (Common Language Runtime) interpretes the MSIL. A plus about the .NET framework is that it's language independant. Someone can write C# code, and access it from C++ or VB. Not something that could have been done before (or as easily as now). It also has an awesome base library.
That's probably the stuff they're going to ask you. But just search microsoft.com for .NET stuff. You'll learn a lot there.

Iron_Cross 32 Junior Poster

Here's the modified code

import java.io.*;
public class Quiz
{
	public static void main(String args[]) 
	{
		int correctCounter;
		InputStreamReader reader;
		BufferedReader buffer; 
		keyboard = new BufferedReader (new InputStreamReader (System.in));
	}

	String seekResponse;
	System.out.println("Welcome to Hoffman School .. ")
	{
		// choose the subject
		System.out.println("enter h for humanities, e for English or x for exit");
		seekResponse = keyboard.readline();
		if (seekResponse.equals ("h") //do humanities quiz
		{ 
			System.out.println("The Declaration of Independence is the same as the constitution");
			seekResponse = keyboard.readline();
			if (seekResponse=("t"))
				System.out.println("incorrect answer");
			if (seekResponse.equals ("f"))
				System.out.println("correct");
				System.out.println("At the Boston Tea Party the people threw coffee overboard");
			if (seekResponse.equals ("t"))
				System.out.println("incorrect answer");
			If (seekResponse.equals ("f"))
				System.out.println("correct");
		}
		else if (seekResponse.equals ("e") //do English quiz
		{
			System.out.println("A period goes at the end of a question");
			seekResponse = keyboard.readline();
			if (seekResponse.equals ("t"))
				System.out.println("incorrect answerz");
			if (seekResponse.equals ("f"))
			{
				System.out.println("correct");
				System.out.println("Most sentences begin with a capital letter");
			}
			if (seekResponse.equals ("t"))
				System.out.println("incorrect answer");
			If (seekResponse.equals ("f"))
				System.out.println("correct");
		}
		else if (seekResponse.equals ("x")) 
			exit// do exit logic
		}
	}
}

You shouldn't put a ; at the end of EVERY line. like:

if(1 > 2); // <-- that ; shouldn't be there

The other problem is that if you have more than one statment after an if, you need a curly bracket like this:

if(10 < 200)
    System.out.println("this is ok to do");
// That was ok

if(10 < 200){
    System.out.println("First Line");
    System.out.println("Second Line");
}

If you leave out the curly braces on that second example you will always print the second line, which …

Iron_Cross 32 Junior Poster

Dude, 2 things.
1. Put your code into the code tags
2. Don't just give him the answer to his homework, what good will that do him. You can help him and give him clues, but don't just do it for him. Also, your code seems overly complicated and there is no room for adjustment (i.e. the grade is always 78)

Iron_Cross 32 Junior Poster

I would try not to use ToString() instead used:

dataTbl.Rows[grdResults.SelectedIndex]["Boolean"].Checked == true

More broken down it looks like:

DataRow dr = dataTbl.Rows[grdResults.SelectedIndex];
bool yesNo = dr["boolean"].Checked; // this assumes that "boolean" is the name of the column
if(yesNo)
doStuff();
else
doOtherSTuff();

Hope this helps, haven't tried it yet though.

Iron_Cross 32 Junior Poster

Make MasterMind. Or choose a simple board game like Othelo. That should get you thinking.

Iron_Cross 32 Junior Poster

Not that I know of, unless you're using something like a factory that would programatically choose from a list of predefined choices...You're going to need something to start with.

Iron_Cross 32 Junior Poster

It seems to me, you could use spaces as a tokenizer deliminator. Then just use substring searches to find out if a string containts : or stuff like that, then delete that character. Then it's just a mater of rebuilding the correct format which shouldn't be at all hard.

Iron_Cross 32 Junior Poster

Ok, this is an extremely stupid question, and I feel retarded for asking, considering how much I've been studying Java. But anyways, here goes.

Let's pretend I've created three classes, Class A, Class B, and Class C. Now in A I create an instance of Class B, let's call it AB. And I modify AB's variables, and invoke methods on it. Object AB holds valuable info, say for a database. Now in C I create another instance of Class B, I'll call it CB. From class C, is there any way I can specific information, such as instance vairable values and other such things of object AB (in class A)?

That's my quesiton. Thanks for any help :)