Nathan Campos 23 Junior Poster

Hello,
I'm learning Java ME and when i complete the development of an application that uses RecordStore, it's simple a contact book, but when i completed the code i see that my program have an error and i use Eclipse, then it marks wrong codes in the left of the line with an X. Here is the error description:

The type simplecontacts must implement the inherited abstract method CommandListener.commandAction(Command, Displayable)

Here is the code of my program:

package contacts;
import java.io.*;
import javax.microedition.midlet.MIDlet;
import javax.microedition.midlet.MIDletStateChangeException;
import javax.microedition.rms.*;
import javax.microedition.lcdui.*;

public class simplecontacts extends MIDlet implements CommandListener, ItemStateListener {
	private Display display;
	private Alert alerta;
	private Form telainicial, adicionaReg;
	private TextField nome, telefone;
	private Command sair, adicionar, voltar, salvar, zerar;
	private RecordStore rs = null;
	String tipo, mensagem;
	boolean gravacaoOK = false;
	private ChoiceGroup tipo_contato;
	private String[] listaTipo = {"Amigos", "Família", "Trabalho"};
	
	public simplecontacts() {
		display = Display.getDisplay(this);
		sair = new Command("Sair", Command.EXIT, 0);
		adicionar = new Command("Adicionar Registros", Command.SCREEN, 1);
		zerar = new Command("Zerar Registros", Command.SCREEN, 1);
		voltar = new Command("Voltar", Command.SCREEN, 1);
		salvar = new Command("Salvar Registro", Command.SCREEN, 1);
		nome = new TextField("Nome:", "", 20, TextField.ANY);
		telefone = new TextField("Telefone:", "", 10, TextField.PHONENUMBER);
		
		telainicial = new Form("Simple Contacts");
		telainicial.addCommand(sair);
		telainicial.addCommand(adicionar);
		telainicial.addCommand(zerar);
		telainicial.setCommandListener(this);
		adicionaReg = new Form("Adiciona Contato");
		tipo_contato = new ChoiceGroup("Tipo do Contato", Choice.POPUP, listaTipo, null);
		adicionaReg.append(nome);
		adicionaReg.append(telefone);
		adicionaReg.append(tipo_contato);
		adicionaReg.addCommand(salvar);
		adicionaReg.addCommand(voltar);
		adicionaReg.setItemStateListener(this);
		adicionaReg.setCommandListener(this);
	}

	protected void destroyApp(boolean arg0) {
		notifyDestroyed();

	}

	protected void pauseApp() {
		// TODO Auto-generated method stub

	}

	protected void startApp() throws MIDletStateChangeException {
		try …
Nathan Campos 23 Junior Poster

Then Iamkishan, edit your post to correct the code tags!
Thanks!

Nathan Campos 23 Junior Poster

Thanks Peter!!

Nathan Campos 23 Junior Poster

Hello,
I'm learning Servlets technology, but i'm already a Java developer and i want to know how i can develop a servlet that have two pages, the first is a page that have a button and two text fields, one field of title and the other a memo field, but when the user clicks in the button the servlet write what the user typed in the title field, and down the title line it puts the content of the memo field, then down the memo field line it puts some -------------------------------------, but if the file already have something it puts all the newer things down the ---------------------------, remember that the file is: memos.txt.

Thanks,
Nathan Paulino Campos

Nathan Campos 23 Junior Poster

Thanks, i'm going to read about JavaMail.

Thanks!

Nathan Campos 23 Junior Poster

Hello,
I'm learning Java and i want to build a program that save emails to an *.txt file, like this: One guy send me an email, then the program periodically search if i have emails every 10 minutes and if i have it saves all the emails in a single *.txt file, remember that is only one file, like emails.txt and if the file already have emails on it, the program inserts the content of the new emails down the others. All this is because i want to develop for me an integration of my emails and a system that i'm developing.

Remember that the email that have to use in this aplication is: nathanjava@yahoo.com

Thanks,
Nathan Paulino Campos

Nathan Campos 23 Junior Poster

Hello,
I'm starting in Java ME development, but i'm already a Java for desktop developer, but how i can build Jar files for my Java ME applications using my Eclipse or command-line, i want to build it only.

Thanks,
Nathan Paulino Campos

Nathan Campos 23 Junior Poster

Thanks harsh2327, this is a very silly mistake, because i didn't noted that.
Thanks very much!

Nathan Campos 23 Junior Poster

Hello,
I'm starting in Java ME development, but when i finished the code, that i'm developing using Eclipse, it shows that my code have an error, with that red x in the left of the code line, here is the code:

package comm;
import javax.microedition.midlet.MIDlet;
import javax.microedition.midlet.MIDletStateChangeException;
import javax.microedition.lcdui.Display;
import javax.microedition.lcdui.Displayable;
import javax.microedition.lcdui.Command;
import javax.microedition.lcdui.CommandListener;
import javax.microedition.lcdui.Form;

public class comm extends MIDlet implements CommandListener {
    private Display display;
    private Form inicio;
    private Form logado;
    private Form recusado;
    private Command cancelar;
    private Command login;
    private Command info;
    private Command help;
    private Command naousuario;
    private Command voltar;
	
	public comm() {
		inicio = new Form("Entrar");
		cancelar = new Command("Cancelar", Command.CANCEL, 0);
		login = new Command("Login", Command.OK, 1);
		info = new Command("Info", Command.OK, 1);
		help = new Command("Help", Command.OK, 1);
		inicio = new Form("Logado");
		recusado = new Form("Não Usuário");
		logado = new Form("Logado");
		naousuario = new Command("Não Usuário", Command.OK, 1);
		voltar = new Command("Voltar", Command.BACK, 0);
	}

	protected void destroyApp(boolean unconditional) throws MIDletStateChangeException {
		notifyDestroyed();
	}

	protected void pauseApp() {
		// TODO Auto-generated method stub

	}

	protected void startApp() throws MIDletStateChangeException {
		// Form Inicial
		display = Display.getDisplay(this);
		inicio.addCommand(cancelar);
		inicio.addCommand(login);
		inicio.addCommand(info);
		inicio.addCommand(help);
		inicio.addCommand(naousuario);
		inicio.setCommandListener(this);
		
		// Form Usuário Logado
		logado.addCommand(info);
		logado.addCommand(voltar);
		logado.setCommandListener(this);
		
		// Form Não Usuário
		recusado.addCommand(voltar);
		recusado.setCommandListener(this);
		display.setCurrent(inicio);
	}

	public void commandAction(Command c, Displayable d) {
		if (c == cancelar) {
			destroyApp(true);
		} else if (c == login) {
			display.setCurrent(logado);
		} else if (c == naousuario) {
			display.setCurrent(recusado);
		} else if (c == voltar) {
			display.setCurrent(inicio);
		}
	}
}

The error is in …

Nathan Campos 23 Junior Poster

Thanks for the resource!

Nathan Campos 23 Junior Poster

Thanks, for the tips and the resource!

Nathan Campos 23 Junior Poster

Hello,
I'm trying to get a string from a thing that is inside quotes as you can see here, but when i try to compile i got this errors:

ubuntu@eeepc:~/C++/Tree$ g++ -o tree tree.cpp
tree.cpp: In function ‘int main(int, char**)’:
tree.cpp:65: error: ‘get’ was not declared in this scope
tree.cpp:65: error: expected ‘,’ or ‘;’ before ‘file’
tree.cpp:66: error: ‘struct std::string’ has no member named ‘indexOf’
tree.cpp:66: error: ‘copy_input’ was not declared in this scope
tree.cpp:67: error: ‘struct std::string’ has no member named ‘indexOf’
tree.cpp:69: error: ‘struct std::string’ has no member named ‘substring’
tree.cpp:70: error: ‘struct std::string’ has no member named ‘indexOf’
tree.cpp:71: error: ‘struct std::string’ has no member named ‘indexOf’
tree.cpp:73: error: ‘struct std::string’ has no member named ‘substring’
ubuntu@eeepc:~/C++/Tree$

And here is the code of my program:

#include <iostream>
#include <fstream>
#include <string>
#include <cstdlib>
#include <stdlib.h>
#include <stdio.h>
using namespace std;
int main( int argc, char* argv[] )
{
    // Error Messages
    string extension = argv[ 1 ];
    
    if(argc != 2)
    {
       cout << "Error syntax is incorrect!\nSyntax: " << argv[ 0 ] << " <file>\n";
      return 0;
    }
    if(extension[extension.length()-3] != '.')
    {
       cout << "Extension not valid!" << endl;
       cout << "Default extension *.tr" << endl;
      return 0;
    }
    if(extension[extension.length()-2] != 't')
    {
       cout << "Extension not valid!" << endl;
       cout << "Default extension *.tr" << endl;
      return 0;
    }
    if(extension[extension.length()-1] != 'r')
    {
       cout << "Extension not valid!" << endl;
       cout << "Default extension *.tr" << endl;
      return 0;
    } …
Nathan Campos 23 Junior Poster

I want to read the thing that are in the quotes and use this thing that is inside the quotes as a variable(char*), only this.

Nathan Campos 23 Junior Poster

But how i can do this?

Nathan Campos 23 Junior Poster

Hello Slayerace180,
Please don't put titles like your, put what is the real problem, read the forum rules!

Thanks,
Nathan Paulino Campos

Nathan Campos 23 Junior Poster

Hello VernonDozier,
That syntax is in my language that i'm developing.

Thanks,
Nathan Paulino Campos

Nathan Campos 23 Junior Poster

Hello,
I'm learning C++ and all that i learn i try to put in a interpreter of a language that i'm developing, it's only to practice, but here is a thing that i don't learned already, that is how i can get a string that is inside quotes, because i want to build a copy function in my language, here is the source of my interpreter:

#include <iostream>
#include <fstream>
#include <string>
#include <cstdlib>
#include <stdlib.h>
#include <stdio.h>
using namespace std;
int main( int argc, char* argv[] )
{
    // Error Messages
    string extension = argv[ 1 ];
    
    if(argc != 2)
    {
       cout << "Error syntax is incorrect!\nSyntax: " << argv[ 0 ] << " <file>\n";
      return 0;
    }
    if(extension[extension.length()-3] != '.')
    {
       cout << "Extension not valid!" << endl;
       cout << "Default extension *.tr" << endl;
      return 0;
    }
    if(extension[extension.length()-2] != 't')
    {
       cout << "Extension not valid!" << endl;
       cout << "Default extension *.tr" << endl;
      return 0;
    }
    if(extension[extension.length()-1] != 'r')
    {
       cout << "Extension not valid!" << endl;
       cout << "Default extension *.tr" << endl;
      return 0;
    }
    // End of the error messages
    
    ifstream file(argv[ 1 ]);
    if (!file.good()) {
       cout << "File " << argv[ 1 ] << " does not exist.\n";
      return 0;
    }
    
    string linha;
    while (!file.eof())
    {
    getline(file, linha);
    if (linha.find("print") != pos)
        {
           size_t idx = linha.find("\""); //find the first quote on the line
           while ( idx != pos )
              {
                 size_t idx_end = linha.find("\"",idx+1); //end of quote …
Nathan Campos 23 Junior Poster

It's ok Sieghuirt!
Follow the tips of VernonDozier!

Nathan Campos 23 Junior Poster

Ok, i'm going to check!

Nathan Campos 23 Junior Poster

Please, post code in code tags and don't put as title things like: URGENT!!!, HELP!!!!!!, ERROR!!!!, Your Title Here...

Thanks!

Nathan Campos 23 Junior Poster

Hello,
I'm learning C++ and i want to know how i can build a program that play videos, don't take care of types, any type of video, not all, but one, remember that iwant to build a command-line app and i'm using Linux.

Thanks,
Nathan Paulino Campos

Nathan Campos 23 Junior Poster

Thanks for the tip!

Nathan Campos 23 Junior Poster

Thanks for the help!
+1 Of Reputation, because you help me outside of the question, for my future project.

Thanks!

Nathan Campos 23 Junior Poster

Thanks very very much, now i can go ahead with my simple project, thanks for your help, you are a very good man, because you help many people!
Thanks!
+1 Of Reputation!

Nathan Campos 23 Junior Poster

Thanks, i use Linux, but this will be very good to port my program to Windows.
Thanks!

Nathan Campos 23 Junior Poster

Hello,
I'm building a cp like program and here is the code of the file copy, i'm in the beginning, i'm going to put the error messages when i be in some good state of the program:

#include <iostream>
#include <fstream>
using namespace std;

int main( int argc, char* argv[] )
{  
    char* inputFile;
    char* outputFile;
    inputFile = argv[ 1 ];
    outputFile = argv[ 2 ];
   
    ofstream(outputFile) << ifstream(inputFile).rdbuf();
  return 0;
}

But how i can do a code that the program finds if the file is in the directory that the terminal is and copy it to the output location, remember that i'm using Linux.

Thanks,
Nathan Paulino Campos

Nathan Campos 23 Junior Poster

I was looking for some reference and here is a working code:

ofstream(argv[2]) << ifstream(argv[1]).rdbuf();

Thanks!

Nathan Campos 23 Junior Poster

Thanks, but how i can do a code for only copying files, like *.txt, *.mp3, *.mpg...

Nathan Campos 23 Junior Poster

Thanks very much!

Nathan Campos 23 Junior Poster

Thanks for all, but i learned myself, for those who needs here is it:

#include <stdlib.h>
#include <stdio.h>
using namespace std;

int main( int argc, char *argv[] )
{
    (void)system( "gedit" );
  return(0);
}

Thanks!

Nathan Campos 23 Junior Poster

Hello,
I'm learning C++ and i want to build a simple program that copy files, remember that i want a program that copy all types of files, not only *.txt or only binary files.

Thanks,
Nathan Paulino Campos

Nathan Campos 23 Junior Poster

Hello,
I'm learning C++ and i want to know how i can build a program written in C++ that can execute other programs, like firefox.

Thanks,
Nathan Paulino Canpos

Nathan Campos 23 Junior Poster

Thanks very much, +1 of reputation.

Nathan Campos 23 Junior Poster

Hello,
I want to know how i can build a program that reads what is in a parenthesis and print it using cout, but remember that i have to use this inserted a if method. Here is a sample of syntax:

test (test of output)

Remember that this syntax is in a file, because of this i'm putting it into a if method.

Thanks,
Nathan Paulino Campos

Nathan Campos 23 Junior Poster

Hello,
I'm learning C++ and i want to know how i can develop a program that reads a file like a database, but the program don't know how many lines or columns the file have, and the file is like this:

"Name Test" "1901" "email@test.com"
"John Google" "6673" "john@test.com"

And how i can remove the quotes automatically, remember that this is a test file, the program have to read more lines or not and the program don't know how many lines and columns are, this is my difficult.

Thanks,
Nathan Paulino Campos

Nathan Campos 23 Junior Poster

Hello,
In my opinion you can install MinGW and install Eclipse, but if you want to use NetBeans or other IDE you need to have MinGW.

Nathan Campos 23 Junior Poster

Hello,
I'm new here in DaniWeb, and this is my first post, but i'm learning C++ and before this i was reading some tutorials in the internet of the Adobe AIR development, but if Adobe AIR is so much easy to learn and C++ is a very flexible and good language it's possible to integrate those two languages in a same project.

Thanks,
Nathan Paulino Campos