richieking 44 Master Poster

you need to chmod the file. i think is os.chmod(filname,octal value)

richieking 44 Master Poster

Vegaseat be nice will you.?
yea i faultered. Its PYTHON. thanks for your tip ))

richieking 44 Master Poster

you need to include ctype header.
then once you recieve the input you check with isdegit() method.
its a bool method so you do if statement.

richieking 44 Master Poster

check with the bind method name( event handler method). its different to the method name it calls.
self.Color is not the same as onColor.

richieking 44 Master Poster

you need to put the ode that opens the file in try-except braces.
Then open a wxMessagebox inside the catch(exeption) brace. Its been along time i worked with wx but the style and logic is the same on GUI's.

try{
    open file()
    }
except(msg){
     wxMessageBox(values,message,...)
     }
richieking 44 Master Poster

it is function / method overloading.

operator overloading is quiet a different stuff. ))

richieking 44 Master Poster

You dont seem to have a 2d array here my friend.
2d array is only

col and row. once you name int cols1 and int cols2 then int rows1 and int rows2.
You got 4d array.

Understand that 2d arrays are rows and cols. no more no less so get back to arrays 101 again ok?

richieking 44 Master Poster

hay buddy work on this .
i have not check it but should work.

chunk_val = raw_input("chunk values : ").lower() # values to search

check_val = raw_input("check stuff : ").lower() # search values. dont repeat search values. eg values appears once for checking
data ={}  #dir to keep distinct

for c in chunk_val:    #ussual stuff
    for x in check_val:
        if x == c:
            print c+"\n";
            if c not in data.keys():
                data[c]=1
            else:
                data[c] = data.get(c)+1

print " ".join((["-" for x in range(10)]))
for x in data.values():
    print(x)


print data  # debug dir
richieking 44 Master Poster

very strange. can you show your code?

richieking 44 Master Poster

Or Atleast some code maybe?

richieking 44 Master Poster

you can sum the value from an array in a very simple style. eg;

<?php
$value;
// Array value contain 40 int;
$array_int[39];
// Now sum the stuff;

for($value=0;$value < count($array_int);$value++){

 // Sum the value from the array
 $value +=$array_int[$value];

}
echo "the Ssum is ";
echo $value;

?>
richieking 44 Master Poster
while(inFile.good()){
// read the file content

}

Thats another way to read file content. listen to vernon... he has given more information than you needed.
You can also get the size of the file and read the content in little chunks.

richieking 44 Master Poster

Also you can bring the innitializing of the
int[] values = new int[numbValues]; into the constructor.

 Object(int numbValues) {
values = new int[numbValues];
this.numbValues = numbValues;
}

but leave the declaration outside .
that is
`int [] values;'

By this you will be fine also.
that means you will need to called the class with a value new Object(33);

nostalgia commented: Solved my problem, thanks! +0
richieking 44 Master Poster

this is a clue...

public stack <datatype> foo = new stack<datatype> foo();
public Node <stack> nfoo = new Node<stack> nfoo();

now you can put stack into node.

richieking 44 Master Poster

Can you be kind to yourself and show us some code dear friend?

richieking 44 Master Poster

There are 2 thing that may help fix your problem. At least anyone of them is enough for the task.
1.Thread
2.javax swing Timer.

1.if you need thread then you will need to call the runnable method to innitiate the clock. This must be called in an event.

  1. If you use the javax swing timer, then thhats more easier..
    Timer timer = new Timer(int);
    then you innitiate the timer.start(); in the event.

Also to make things more protective . Always organize data that you will use in many places so that there wont be a subtle error.

here.

Font font = new Font("Impact", Font.BOLD, 45);

min.setFont(font);

You get the idea?

richieking 44 Master Poster

pretty useless until you give more codes to support that. sorry ..

richieking 44 Master Poster

Which GUI are you working with? if its default swing, then you need JFileChooser to do that. Also you will need to know about actions that activates the right clicking.

Put something there and we will assist you. We dont give codes here. We are not free code factory. We only assist.

richieking 44 Master Poster

Also you are using the standard laout manager with Swing. How do you want to see the app layout, can you draw or show us a pic or something how you want to see your layout so that we can assist you?

richieking 44 Master Poster

use layout to restrict objects to place and area you want.
As i can see, your JTable need a size set also.

richieking 44 Master Poster
String st  = "D foo New Yrk"; // foo.readline()
String del =" ";          // split delimeter
String [] al = st.split(del); // you got that splitted
// note that to get the values that you need to use
for (int x=0;x< al.length;x++){

         System.out.println(al[x]);
        }

got the idea?

richieking 44 Master Poster

what is your level in c++?
Do you need to store something permanent ?
Do you have experience with database?

sarafadeenl1 commented: fairly good, i dont need to store something permanently, i do have little +0
richieking 44 Master Poster

And always main() must be int method not void as it returns a value.

WaltP commented: You must work with the Department of Redundency Department. Am I not clear? Do you people have to repeat everything that I say? -3
richieking 44 Master Poster

try google py4a. there is layers for that.

richieking 44 Master Poster

you need o produce more code than this as we cant help you without the entire code that makes sense. post full lenght of code.

richieking 44 Master Poster

you must readline then split the line by spaces, count splited data, then know how many data splitted, then insert into the corresponding variables. with this you will always know the amount of data needed to insert.

Also why use substring if you can not determing the data. Use regular expression. You can do all in 5lines of code i think.

richieking 44 Master Poster

This is very simple to achieve however, you need to show some effort ok?

richieking 44 Master Poster

Python like java operates on object. At least python is not purely OB. but the concepts are similer.

richieking 44 Master Poster

I think he did not write this script himself because he coild have spoted that the
error was due to zero info in the String array that he is trying to index.

To make things simple for you,hard code your ip address and add a readin to your script
to take in messages that needs to be sent.

Start from there. Let me know if you will need that help but you must do something yourself first.

richieking 44 Master Poster

Also is the data supposed to be used often and saved for future checkups...?
if the above is false, then keeping in array is the best idea cos it is only for a short period of time.

richieking 44 Master Poster

And so what is the current proble then :=)

richieking 44 Master Poster

That is the getters and the setters methods.

richieking 44 Master Poster

There are 2 things that comes to mind..
1. Did you code this yourself
2. If so , then why didnt you use a supported object like ListIterator of ArrayList which will be easy to manipulate?

Also with the int and interger examples...

line 40 and 85 is nt necessary as you could simply do

public static void foo(int bar, Dim dim){
   // int does not really need interger object as it safe casted.
   int faa = bar; // there was no need for new interger. 
   dim = new Dim;

   /// bla bla bla

}

on line 47 and 88..

if(foo.equals("null"){ // then do this or that}
Always use this if you are checking for null datas
Its very accurate.
Also mind you that null and zero are not the same.
zero is a value but null means empty. So be very careful what you are checking for.

Hope it helps :-)

richieking 44 Master Poster

You read all the files with this check "*.txt"

richieking 44 Master Poster

you think the world will come to an end because of me posting three lines of code not between code-tags? (Damn, those maya's were right after all :-|)


yes, code tags makes the whole a lot more easier to read, but in this case, every code posted was pretty straight-forward and easy to read, even while not in code tags, so I don't think it's a capital crime.

no one can or will blame you if you decide not to help solving the problem here (which probably has been solved, even without the use of code-tags), no one will even look badly at you for asking for code-tags, but what's stopping you from formulating it a bit like this:

"Hey, could you guys please use code tags? It's a bit hard to read."

rules and regulations.... They were made to assist others and ourselves. its ok not to put tags but its not right for the ake of the forum's regulations.... wait a munite. never mind.

richieking 44 Master Poster

You need to know how to use time. Every GUI got time that run. You need to bind the movement and speach with the time. Very simple. You must also know the length of the audio you want to use. You show give the same time for both animation and sound......

Hope this help.

richieking 44 Master Poster

Why dont you simply post the code??

richieking 44 Master Poster

Have you guys forgotten about something?? The code tags!!???

richieking 44 Master Poster

Sometimes its more easier to do a prototype as NormR1 said.
Nice you got it fix

richieking 44 Master Poster

TrickyT show what you have done so far ok..?

richieking 44 Master Poster

What is your level in java??

richieking 44 Master Poster

Well said James.

Everything in java is object and though you may not see inside, but they are connected one way or another. JFrames,JButtoms etc.. all externds from the JComponent .
from htc phone.

richieking 44 Master Poster

please close the thread.

richieking 44 Master Poster

try this.

#include <iostream>
       using namespace std;
        #define STACKSIZE 10
        class stack
        {
                private:
                        int arr[STACKSIZE+1];
                        int tos;
                public:
                        stack();
                        void push(int x);
                        int  pop();
                        bool is_empty();
                        bool is_full();
                        int  size();
                        void display();
        };

        stack::stack()
        {
                tos = 0;
        }

        void stack::push(int x)
        {
                if(!is_full())
                        arr[tos++] = x;
                else
                        cout << "Stack is full, Can not push " << x << endl;
        }

        int stack::pop()
        {
                if(!is_empty())
                        return arr[--tos];
                else
                        cout << "Stack is empty, cannot pop" << endl;
                return -1;
        }

        bool stack::is_empty()
        {
                if(tos == 0)
                        return true;
                else
                        return false;
        }

        bool stack::is_full()
        {
                if(tos == STACKSIZE)
                        return true;
                else
                        return false;
        }

        int stack::size()
        {
                return tos;
        }

        void stack::display()
        {
                if(tos == 0)
                {
                        cout << "No elements to display" << endl;
                        return;
                }
				else
				{
					for(int i=0;i<STACKSIZE;i++)
					{
						cout <<i <<"   =    "<< arr[i] << " ";
						cout << endl;
					}
				}
        }

        int main()
        {
                stack mystack;
                cout << mystack.size() << endl;
               for(int i =0;i<STACKSIZE;i++){
            	   mystack.push(i*STACKSIZE);
               }

		mystack.display();
                if(mystack.is_full())
                        cout << "stack is full" << endl;
                mystack.pop();
                if(mystack.is_empty())
                        cout << "stack is empty" << endl;
        }
/***
OUTput
0
0   =    0 
1   =    10 
2   =    20 
3   =    30 
4   =    40 
5   =    50 
6   =    60 
7   =    70 
8   =    80 
9   =    90 
stack is full
*/
richieking 44 Master Poster

sorry its fillRect..
pardon me ...

richieking 44 Master Poster

For the body to follow.... you need a 2 dimentional array that consists of the points to use as a route.

The array consists of cordinations x and y; your computer screen consists of the same dots(cordination) called pixels. That means the food for the snake must register on one of the cordinating x&y axis. Your snake move only via the cordiation you have already made in the 2 dim. Array. I cant give you all these lectures... use google ok?

richieking 44 Master Poster

reduce the setColor values to (0,0,619,419).

Image may overlapse as the size are identical hence ot of bounds error. try that!

richieking 44 Master Poster

at least paste some updated code so far ok?

richieking 44 Master Poster

I think ravenous said it all ;-)

richieking 44 Master Poster

Update with better style than this newbie did and changing the match to be similar to this better regular expression, which is little restricted version from
http://www.regular-expressions.info/email.html (no test.@web.com accepted)

Here you see some examples that standard would pass:
http://en.wikipedia.org/wiki/Email_address#Valid_email_addresses

# -*- coding: latin1 -*-
import re

def validate_email(address):
    """ Validate by python equivalent to regular expression below """
    #to not allow single letter parts increase len_limit to 2 or more
    len_limit, max_domain = 1, 4
    # only ascii values not all alpha
    sep = [code for code in address if not code.isalpha() or ord(code) > 128]
    if (# sep joined must be ..@.... form
        ''.join(sep).strip('.') != '@' or
        # must have point after @
        sep[-1] == '@'):
        return False
    else:
        end = address
        for s in sep:
            part, s, end = end.partition(s)
            if len(part) < len_limit:
                return False
            
    return max_domain >= len(end)>1

def email_validate_re(address):
    """ from http://www.regular-expressions.info/email.html """
    pattern = r"\b[a-zA-Z0-9._%+-]*[a-zA-Z0-9_%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,4}\b"
    return re.match(pattern, address)

if __name__ == '__main__':
    emails = [ "test.@web.com","test@com", "test+john@web.museum", "test+john@web.m",
               "address@n.dk", "and.bun@webben.de","marjaliisa.hamalainen@hel.fi",
               "marja-liisa.hämäläinen@hel.fi", "marjaliisah@hel.",'tony@veijalainen.localhost']
    print("Valid emails by my function are:")
    print('\t' + '\n\t'.join(email for email in emails if validate_email(email)))
    print("\nRegexp answer:")
    print('\t' + '\n\t'.join(email for email in emails if email_validate_re(email)))

"""
Valid emails by my function are:
	address@n.dk
	and.bun@webben.de
	marjaliisa.hamalainen@hel.fi

Regexp answer:
	address@n.dk
	and.bun@webben.de
	marjaliisa.hamalainen@hel.fi
"""

Though i like your function pytony, there are alot of emails your function may reject which will be very alarmin. consider this .....

# -*- coding: latin1 -*-
import re

def …