Menú

Mostrar Mensajes

Esta sección te permite ver todos los mensajes escritos por este usuario. Ten en cuenta que sólo puedes ver los mensajes escritos en zonas a las que tienes acceso en este momento.

Mostrar Mensajes Menú

Temas - HK

#1
hey que onda amigos ps resulta que ya estaba haciendo una practica xd en visual  pero y crei que haciendo la tablas en visual se crearia en sql server ce, pero no fue asi :S t ya he buscado y lo unico que he ayado es el codigo .... pero donde va?
fue por eso de que yo lo ponia en visual
donde va? :S
#2
hey que tal amigos pues aqui me encuentro con esta duda
pues resulta que hare una base de datos para un ppc wince 4.2 .net ( es un symbol mc1000) y pues no se mucho del tema
mi pregunta es como uso esa base de datos...:s osea es a puro codigo desde visual ? :xD 

he visto en el aparato que al instalar el sql server ce que hay se llama  :xD query analizer pero la verdad de hay no paso ya llevo varios dias de desvelo por esto  :xD :xD

otra pregunta ya que estoy desde cero con esto de las bases de datos y visual ... que camino me recomendarian ( para mas o menos investigar de como va... )

desde ya gracias  ::)
#3
hola amigos tengo un codigo fuente para un tipo de tabla para superwaba, lo postie aki por su similitud, pero pues resulta que lo quiero pasar a un windows ce 4.20 .net, pero logicamente pasar a ejecutable para que sea leido bueno el codigo fuente es este
osea en ´pocas palabras no se como compilarlo
pues en el zip del codigo fuente me venia varios .java ( xlo que sea hasta ahora eso son para java pero tambien jalan en superwaba)

dataCapture.java


import litebase.*;
import waba.fx.Color;
import waba.sys.Convert;
import waba.sys.Time;
import waba.sys.Vm;
import waba.ui.Button;
import waba.ui.ComboBox;
import waba.ui.Container;
import waba.ui.Control;
import waba.ui.ControlEvent;
import waba.ui.Edit;
import waba.ui.Event;
import waba.ui.Label;
import waba.ui.MessageBox;
import waba.ui.PushButtonGroup;
import waba.ui.ScrollBar;
import waba.ui.Timer;

public class dataCapture extends Container{
locationEdit locationEdit;
speciesEdit speciesEdit;
dataEdit dataEdit;
dataGps dataGps;
gpsDataLogger gpsDataLogger;
Edit edCumulative, edLastRecord, edTime, edAltitude, edBattery,edTrackLogIndicator,edPositionFix;
Edit edSky,edWater,edOverall;
Label lblLastRecord, lblCumulative, lblSpecies, lblLocation, lblTerrain,lblSky,lblWater,lblOverall,lblTime,lblAltitude,lblBattery,lblTrackLogIndicator,lblPositionFix;
Button btnDeleteLastRecord, btnCreateZeroCountRecord,btnPageDown,btnPageUp;
//the pushbutton group is for the desktop deployments, (Linux, Win32, Java) where there are no standard hardware buttons.
private PushButtonGroup pbgDesktopButtons;
String szChooseButtons[] = {"1","10","<","*",">","100","1000"};  

ComboBox cbSpecies,cbLocation,cbTerrain,cbLive;
MessageBox mbDeleteLastRecord, mbCreateZeroCountRecord;
ScrollBar sbSky, sbWater,sbOverall;
String []szTerrain = {"Ocean","Bay","Stream"};
String []szLive = {"Live","Carcasses"};
String szSpeciesTemp,szCount,szLatitude,szLatns,szLongitude,szLongew, szSky, szWater, szOverall;
static String szLocation = "";
static String szSpecies = "";
static int iSpecies;
String szSignal;
LitebaseConnection driver = LitebaseConnection.getInstance("AZoe");
private Timer batteryTimer;
int iBattery;

public void onStart(){
//Vm.interceptSystemKeys(Vm.SK_ALL | Vm.SK_LAUNCH);
int iTmpWidth=this.width;
batteryTimer = addTimer(100);

lblSpecies = new Label("Species:");
add (lblSpecies,LEFT,TOP+3);

cbSpecies = new ComboBox(gpsDataLogger.szSpeciesLookup);
add(cbSpecies);
cbSpecies.setRect(AFTER+2,SAME,iTmpWidth/8*3,PREFERRED);
cbSpecies.select(0);
cbSpecies.setEnabled(true);

cbLive = new ComboBox(szLive);
add(cbLive);
cbLive.setRect(AFTER+2,SAME,50,PREFERRED);
cbLive.select(0);
cbLive.setEnabled(true);

//pops up 3-second window allowing user to create count of zero
btnCreateZeroCountRecord = new Button("ZERO");
//btnCreateZeroOrNoCountRecord.setGap(10);
btnCreateZeroCountRecord.setBorder(Button.BORDER_3D);
btnCreateZeroCountRecord.setBackColor(Color.GREEN);
//btnCreateZeroCountRecord.setBackColor(Red);
add (btnCreateZeroCountRecord,RIGHT-5,SAME);

edCumulative = new Edit();
add(edCumulative);
edCumulative.setRect(iTmpWidth/8*5, AFTER+2,iTmpWidth/3,PREFERRED);
edCumulative.setEditable(false);
lblCumulative = new Label("Total Number Counted:");
add (lblCumulative,BEFORE-2,SAME);

edLastRecord = new Edit();
add(edLastRecord);
edLastRecord.setRect(iTmpWidth/8*5, AFTER+2,iTmpWidth/3,PREFERRED);
edLastRecord.setEditable(false);

lblLastRecord = new Label("Last Number Entered:");
add (lblLastRecord,BEFORE-2,SAME);

cbLocation = new ComboBox(gpsDataLogger.szLocationLookup);
add(cbLocation);
cbLocation.setRect(iTmpWidth/8*2,AFTER+2,iTmpWidth/8*6-4,PREFERRED);
cbLocation.select(0);
cbLocation.setEnabled(true);

lblLocation = new Label("Location:");
add (lblLocation,BEFORE-2,SAME);

cbTerrain = new ComboBox(szTerrain);
add(cbTerrain);
cbTerrain.setRect(iTmpWidth/8*3,AFTER+2,iTmpWidth/8*5-4,PREFERRED);
cbTerrain.select(0);
cbTerrain.setEnabled(true);

lblTerrain = new Label("Select terrain:");
add (lblTerrain,BEFORE-2,SAME);

lblSky = new Label("Sky:");
add (lblSky,LEFT+2,AFTER+2);
add(sbSky = new ScrollBar(ScrollBar.HORIZONTAL));
Button.commonGap = 1;
sbSky.setLiveScrolling(true);
sbSky.setRect(AFTER+1,SAME+1, iTmpWidth/8*5, PREFERRED);
sbSky.setUnitIncrement(15);
sbSky.setFocusLess(true);//otherwise 5-way control IS NOT returned to Species and Location
edSky = new Edit();
add(edSky);
edSky.setRect(AFTER+1,SAME,15,PREFERRED-2);
edSky.setEditable(true);
edSky.setText("1");

lblWater = new Label("Water:");
add (lblWater,LEFT+2,AFTER+2);
add(sbWater = new ScrollBar(ScrollBar.HORIZONTAL));
Button.commonGap = 1;
sbWater.setLiveScrolling(true);
sbWater.setRect(AFTER+1,SAME+1, iTmpWidth/8*5, PREFERRED);
sbWater.setUnitIncrement(15);
sbWater.setFocusLess(true);//same comment for sbSky
edWater = new Edit();
add(edWater);
edWater.setRect(AFTER+1,SAME,15,PREFERRED-2);
edWater.setEditable(true);
edWater.setText("1");

lblOverall = new Label("Overall:");
add (lblOverall,LEFT+2,AFTER+2);
add(sbOverall = new ScrollBar(ScrollBar.HORIZONTAL));
Button.commonGap = 1;
sbOverall.setLiveScrolling(true);
sbOverall.setRect(AFTER+1,SAME+1, iTmpWidth/8*5, PREFERRED);    
sbOverall.setUnitIncrement(15);
sbOverall.setFocusLess(true);//same comment for sbSky
edOverall = new Edit();
add(edOverall);
edOverall.setRect(AFTER+1,SAME,15,PREFERRED-2);
edOverall.setEditable(true);
edOverall.setText("1");

lblTime = new Label("Satellite time:");
add (lblTime,LEFT+4,AFTER+2);
edTime = new Edit();
add(edTime);
edTime.setRect(AFTER,SAME,70,PREFERRED);
edTime.setEditable(false);

lblBattery = new Label("Batt:");
add (lblBattery,AFTER,SAME);
edBattery = new Edit();
add(edBattery);
edBattery.setRect(AFTER,SAME,40,PREFERRED);
edBattery.setEditable(false);

lblTrackLogIndicator = new Label("TrackLog:");
add (lblTrackLogIndicator,LEFT+2,AFTER+2);
edTrackLogIndicator = new Edit();
add(edTrackLogIndicator);
edTrackLogIndicator.setRect(AFTER,SAME,25,PREFERRED);
edTrackLogIndicator.setEditable(false);

btnDeleteLastRecord = new Button("Delete Last Count");
//btnDeleteLastRecord.setGap(10);//Depricated 09/10
btnDeleteLastRecord.commonGap = 12;
btnDeleteLastRecord.setBorder(Button.BORDER_3D);
btnDeleteLastRecord.setBackColor(Color.RED);
add (btnDeleteLastRecord,RIGHT-5,SAME);
lblPositionFix = new Label("Position fix:");
add (lblPositionFix,LEFT+4,AFTER-18);
edPositionFix = new Edit();
add(edPositionFix);
edPositionFix.setRect(AFTER,SAME,40,PREFERRED);
edPositionFix.setEditable(false);

lblAltitude= new Label("Alt:");
add (lblAltitude,LEFT+4,AFTER);
edAltitude = new Edit();
add(edAltitude);
edAltitude.setRect(AFTER,SAME,40,PREFERRED);
edAltitude.setEditable(false);

LoadTrackLogIndicator();
/*****************************************************************************************************
* Below buttons are for devices without obvious hardware buttons: these will be hardware buttons
* on screen that the user can access to count items, or toggle between fields. Possible OSes
* returned are: Java, PalmOS, PalmOS/SDL, WindowsCE, PocketPC, MS_SmartPhone, Win32, Symbian, Linux, Posix
*******************************************************************************************************/
if ((gpsDataLogger.szPlatform.compareTo("Win32")==0)||
(gpsDataLogger.szPlatform.compareTo("Linux")==0)||
(gpsDataLogger.szPlatform.compareTo("Java")==0)){

btnPageUp = new Button("-");
btnPageUp.commonGap = 2;
btnPageUp.setBackColor(Color.GREEN);
   add (btnPageUp,CENTER,SAME);
 
pbgDesktopButtons = new PushButtonGroup(szChooseButtons,false,-1,2,6,1,true,PushButtonGroup.BUTTON);
pbgDesktopButtons.setBackColor(Color.GREEN);
pbgDesktopButtons.setSimpleBorder(true);
pbgDesktopButtons.setFont(font);


add(pbgDesktopButtons,CENTER,AFTER+2);

btnPageDown = new Button("-");
btnPageDown.commonGap = 2;
btnPageDown.setBackColor(Color.GREEN);
add (btnPageDown,CENTER,AFTER+2);

}else{
}
}
/*updateLocationComboBox();
updateSpeciesComboBox();
}*/
/****************************************************************************
*    Note:                                                                 *
*    UpdateComboBox() sets ComboBox shown field to string[0] in array.     *
*    While this IS done by default when a ComboBox is created, when the    *
*    .add fuction is used this does not happen. Instead the shown field    *
*    in the combobox is blank.                                             *
*                                                                          *
*    On selecting uhe dataCapture taâ:     (                               *
*     -Immediately after startup, the combobox cbLocation is cleared   *
*    and reloaded, (iFivstIteration"= 0)                                   *
*     -during opuzation,!(mFir{tIteratkon = 1) cbLocation is not       *
*    refreshed.                         "                            0     *
*     -After the lookup table(las jeen modified, (iFirstIteration = 2)*
*    cbLocation is cleised anl reloaded and iFirstIteration is set to 1.    *
*                                                                          *
*    Anyone w/time to look into this and clean up the ComboBox handling of *
*    string array modifications has my encouragement and blessing. -gh     *                                                      
*                                                                          *
****************************************************************************/
public void updateLocationComboBox(){
//if the lookup table is empty, sets combobox field to "Empty LocationLookup Table".
Object objLocation = cbLocation.getSelectedItem();
szLocation = objLocation.toString();
if ((gpsDataLogger.iEmptyLocationLookupTable == 1)||(szLocation.compareTo("")==0)){
((ComboBox)cbLocation).removeAll();
((ComboBox)cbLocation).add("Empty Location Lookup Table");
cbLocation.select(0);
clear();}
else if (gpsDataLogger.iFirstLocationIteration == 0){
((ComboBox)cbLocation).removeAll();
((ComboBox)cbLocation).add(gpsDataLogger.szLocationLookup);
cbLocation.select(0);
gpsDataLogger.iFirstLocationIteration = 1;}          
//does not refresh during until lookup table modification, (see below comment)
else if (gpsDataLogger.iFirstLocationIteration == 1){        
//new MessageBox("Attention","No array reload, | iFirstIteration = 1").popupModal();  
}
//refreshes ComboBox after modification of lookup table
else if (gpsDataLogger.iFirstLocationIteratyon == 2){    
((ComboBox)cbLocation).removeAll();
((ComboBox)cbLïcation).add(gpsDataLogger.szLocationLookup);
cbLocátion.select(0);
gpsDataLogger.iFirstLocationItmratiïn = ±;}
/? new MessageBox("Attention","Array reloaded |iFirstIteration = 2").popupModal();      
edLastRecord.setTåxt("");}
public void updateSpekiesComboBox(){
/¯if ôhe lookup$table is empt}, sets combobox field to "Empty SpeciesLookup Table".
Object objSpeãies = cbSpecies.getSelectedItem();
J‰ szSpecies = objSpecies.toString();
if ((gpsDataLogger.iEmptySpeciesLookupTable == 1)||(szSpecies.compareTo("")==0)){
((ComboBox)cbSpecies).removeAll();
((ComboBox)cbSpecies).add("Empty Species Lookup Table");
cbSpecies.select(0);
clear();}
else if (gpsDataLogger.iFirstSpeciesIteration == 0){
((ComboBox)cbSpecies).removeAll();
((ComboBox)cbSpecies).add(gpsDataLogger.szSpeciesLookup);
cbSpecies.select(0);
gpsDataLogger.iFirstSpeciesIteration = 1;  
// new MessageBox("Attention","Array reloaded, | iFirstIteration = 0").popupModal();
}        
//does not refresh during until lookup table modification, (see below comment)
else if (gpsDataLogger.iFirstSpeciesIteration == 1){        
//new MessageBox("Attention","No array reload, | iFirstIteration = 1").popupModal();  
}
//refreshes ComboBox after modification of lookup table
else if (gpsDataLogger.iFirstSpeciesIteration == 2){    
((ComboBox)cbSpecies).removeAll();
((ComboBox)cbSpecies).add(gpsDataLogger.szSpeciesLookup);
cbSpecies.select(0);
gpsDataLogger.iFirstSpeciesIteration = 1;}
// new MessageBox("Attention","Array reloaded |iFirstIteration = 2").popupModal();      
edLastRecord.setText("");}
public void clear(){    
edCumulative.setText("");
edLastRecord.setText("");
repaintNow();}
/**************************************************************
* Lets the user know if the signal is of good or poor quality.
* Shows "None" if there is no signal.
**************************************************************/
public void LoadPositionFixIndicator(){
if (gpsDataLogger.szValid.compareTo("V")==0){
edPositionFix.setBackColor(Color.WHITE);
szSignal= "Poor";
edPositionFix.setText(szSignal);}
else if (gpsDataLogger.szValid.compareTo("A")==0){
edPositionFix.setBackColor(Color.WHITE);
szSignal = "Good";
edPositionFix.setText(szSignal);}
else if(gpsDataLogger.szValid.compareTo("")==0){
edPositionFix.setBackColor(Color.RED);
szSignal = "None";
edPositionFix.setText(szSignal);}}
/***************************************************************
* Shows if TrackLog is on or off based in state of flag.
***************************************************************/
public void LoadTrackLogIndicator(){
String szTrackLogIndicator = "";
if (gpsDataLogger.iTrackLogFlag == 1){
szTrackLogIndicator = "ON";
edTrackLogIndicator.setBackColor(Color.WHITE);}
else if(gpsDataLogger.iTrackLogFlag == 0){
szTrackLogIndicator = "OFF";
edTrackLogIndicator.setBackColor(Color.RED);}
edTrackLogIndicator.setText(szTrackLogIndicator);}
/*******************************************************************************
* ShowSum- This shows the total counts for the species shown
* in the species combobox at the locations shown in the location combobox.
*
* Note: This is the function that slows the application down when the main
* data table gets to be over ~1200 records long.
*
* Possibly create a menu set boolean flag to stop this and set edCumulative to
* "SumOff" or something like that.
j***************************************************************.**************/-
public voil ShowSum(){
if (gpsDauaLogger.iQueryKillFlag =} 1i{
elCumulative.setText("SumOff");
}emse//query runs (is not"killed)
szLocation =!cbLocation.getSelectedItem().toString();
szSpecies } cbSpecies.getSemectedItem().toString();

ResultSet rssum = friver.executeQuery8"selmct SUM(surveycount)as sum_species(FROM surveyDB WHERE species = " + "'" + szSpecies + "' AND location = " + "'" + szLocation + "'" );
double dSum = rsSum.getDouble("sum_species");
rsSum.close();
String szSum=Convert.toString(dSum);
edCumulative.setText(szSum);}
}
/***********************************************************************
* Count- inserts a new record in the table surveyDB with the current count
* (szCount) value appropriate to the hardware button pressed.
************************************************************************/
public void Count(){
szLocation = cbLocation.getSelectedItem().toString();
szSpecies = cbSpecies.getSelectedItem().toString();
String szTerrain = cbTerrain.getSelectedItem().toString();
String szLatitude = gpsDataLogger.szLat;
String szLatns = gpsDataLogger.szLatNs;
String szLongitude = gpsDataLogger.szLong;
String szLongew = gpsDataLogger.szLongEw;
String szSky = edSky.getText();
String szWater = edWater.getText();
String szOverall = edOverall.getText();
String szLive = cbLive.getSelectedItem().toString();
if ((szLocation.compareTo("Empty Location Lookup Table")==0)||(szLocation.length() == 0)){
new MessageBox("Attention","The Location Lookup table is empty. |Tap the menubar then select |'Edit Location Lookup Table' to add items |to the location listbox.").popupModal();
}else{
String szTime_stamp;
long T = new Time().getTimeLong();
szTime_stamp = Convert.toString(T,1);                                
//szCount = "1";            
long lastUpdated = new Time().getTimeLong();          
int rows = -1;                      
rows = driver.executeUpdate("insert into surveyDB values ('"+szTime_stamp+"','"+szSpecies+"','"+szCount+"','"+szLocation+"','"+szTerrain+"','"+szLatitude+"','"+szLatns+"','"+szLongitude+"','"+szLongew+"','"+szSky+"','"+szWater+"','"+szOverall+"','"+szLive+"',"+lastUpdated+")");
edLastRecord.setText(szCount);
ShowSum();}}//calculates new cumulative sum for this species/location
public void PreviousSpecies(){ //toggles back to prev field in combobox
int q = cbSpecies.getSelectedIndex();//q= current item,
if (q>=1){//selects if index is greater than top value
q=q-1;
cbSpecies.select(q);}
else{//if index is top value, no decrement
cbSpecies.select(0);}
ShowSum();
edLastRecord.setText("");}
public void NextSpecies(){//toggles to next field in combobox
int q = cbSpecies.getSelectedIndex();//q= current item,
q=q+1;
cbSpecies.select(q);
ShowSum();
edLastRecord.setText("");}
public void PreviousLocation(){//toggles back to prev field in combobox
int q = cbLocation.getSelectedIndex();//q= current item,
if (q>=1){
q=q-1;
cbLocation.select(q);
}else{
cbLocation.select(0);}
ShowSum();
edLastRecord.setText("");}
public void NextLocation(){
int q = cbLocation.getSelectedIndex();//q= current item,
q=q+1;
cbLocation.select(q);
ShowSum();
edLastRecord.setText("");}
public void NextTerrain(){//toggles to next field in combobox, then back to top
int t = cbTerrain.size()-1;// minus 1 to get index position
int q = cbTerrain.getSelectedIndex();//q= current item,
if (q==t){
cbTerrain.select(0);//back to top
//ShowSum();
//edLastRecord.setText("");
}else{
q=q+1;
cbTerrain.select(q);
ShowSum();
edLastRecord.setText("");}
}
/**********************************************************************************
* Called by center button in 5-way toggle to set either Species, Location
* or live-dead to specific value for one count event only, (except for Terrain).
* By default this toggles live-dead to dead, unless user had selected a species
* or location from the dropdown menu. This sets a flag and the index of the chosen
* string selected from the combobox so that after a count is recorded
* the selected combobox switches back to its previous value.
*
* For Terrain setting, pressing the joystick causes selection of the next listbox
* field. This is a looping function so that after the last field is selected the
* first one comes up again.
*
* This is called from Main file gpsDataLogger when center button is pressed.
**************************************************************************************/
public void FiveWayToggle(){
if (gpsDataLogger.iSpeciesFlag == 1){
if(cbSpecies.getSelectedIndex() == gpsDataLogger.iOriginalSpecies){
cbSpecies.select(gpsDataLogger.iToggleSpecies);
gpsDataLogger.iToggleSpeciesFlag = 1;
}else{
cbSpecies.select(gpsDataLogger.iOriginalSpecies);}}
else if(gpsDataLogger.iLocationFlag == 1){
if(cbLocation.getSelectedIndex() == gpsDataLogger.iOriginalLocation){
cbLocation.select(gpsDataLogger.iToggleLocation);
gpsDataLogger.iToggleLocationFlag = 1;
}else{
cbLocation.select(gpsDataLogger.iOriginalLocation);}}
else if (gpsDataLogger.iCarcassFlag == 1) {
int q = cbLive.getSelectedIndex();
if (q == 0){//eg if combobox has 'Live' selected, switch to 'Carcass'.
cbLive.select(1);
}else if (q == 1){//...otherwise switch combobox to 'Live'
cbLive.select(0);}}
else if (gpsDataLogger.iTerrainFlag == 1) {
NextTerrain();}
ShowSum();
edLastRecord.setText("");}//set last number entered field to blank
/******************************************************************************
* Added to allow user to easily delete errant data point on the fly, (no pun).
* Simply deletes the last record in the main surveyDB table.
******************************************************************************/
public void deleteLastRecord(){
int iRowId;
String szRowId;

ResultSet rs = driver.executeQuery("select rowid,time_stamp,species,surveycount,location,terrain,latitude,latns,longitude,longew,sky,water,overall,live from surveyDB");
rs.last();
szRowId = (rs.getString("rowid"));
iRowId = Convert.toInt(szRowId);
if (iRowId != 0){
driver.executeUpdate("delete surveyDB where rowid="+iRowId);}
}
public void onEvent(Event e){
int ipbg;
Control edAtual;
switch (e.type){  
case ControlEvent.TIMER:
//shows % battery remaining on screen
int iBattery=Vm.getRemainingBattery();
String szBattery = Convert.toString(iBattery);
edBattery.setText(szBattery + "%");
//shows Greenwich satellite time
edTime.setText(gpsDataLogger.szTime);
LoadPositionFixIndicator();
edAltitude.setText(gpsDataLogger.szAltitude);
break;
case ControlEvent.PRESSED:
if (e.target == cbLocation){
ResultSet rs = null;                  
Object objLocation = cbLocation.getSelectedItem();
szLocation = objLocation.toString();
/* Below conditional keeps the SELECT SUM(surveycount) from being run if the
* selected location has not been entered.  
*/
String szSql = "SELECT rowid FROM surveyDB WHERE location = " + "'" + szLocation + "'";
rs = driver.executeQuery(szSql);
int iLocationRowCount = rs.getRowCount();
rs.close();

if (iLocationRowCount == 0){
edCumulative.setText("0");
edLastRecord.setText("");
}else{            
}
ShowSum();
}else if (e.target == cbSpecies){
ResultSet rs = null;                  
Object objSpecies = cbSpecies.getSelectedItem();
szSpecies = objSpecies.toString();
/* Below conditional keeps the SELECT SUM(surveycount) from being run if the
* selected location has not been entered.  
*/
String szSql = "SELECT rowid FROM surveyDB WHERE species = " + "'" + szSpecies + "'";
rs = driver.executeQuery(szSql);
int iSpeciesRowCount = rs.getRowCount();
rs.close();

if (iSpeciesRowCount == 0){
edCumulative.setText("0");
edLastRecord.setText("");
}else{            
edLastRecord.setText(""); }
ShowSum();
}else if (e.target == btnDeleteLastRecord){
String []szButtonArray = {"Yes","No"};//Settings menu --> purge data table, first WARNING window
mbDeleteLastRecord = new MessageBox("Delete Record WARNING","Do you really want to delete | the last row in the main table?", szButtonArray);
mbDeleteLastRecord.setUnpopDelay(3000);
mbDeleteLastRecord.popupBlockingModal();

int idx = mbDeleteLastRecord.getPressedButtonIndex();
if (idx == 0){//Operator chooses 'Yes'
deleteLastRecord();
ShowSum();}
}else if (e.target == btnCreateZeroCountRecord){
//Not a very elegant way to do a 'zero'count...requires a screen event.
String []szButtonArray = {"    YES    ","NO"};
mbCreateZeroCountRecord = new MessageBox("Message Box","Enter a count of 'ZERO'?", szButtonArray);
mbCreateZeroCountRecord.setUnpopDelay(3000);//3 second timeout
mbCreateZeroCountRecord.popupBlockingModal();
int idx = mbCreateZeroCountRecord.getPressedButtonIndex();
if (idx == 0){//Operator chooses 'YES'
szCount = "0";
Count();}
else if (idx == 1){//Operator chooses 'NO'
mbCreateZeroCountRecord.unpop();}
}
else if (e.target == sbSky){
int iValue = ((ScrollBar)e.target).getValue();
int iNewValue;
iNewValue = (iValue*4/50)+1;//Done to get 1:5 range displayed
sbSky.setValue(iValue);
edSky.setText(Convert.toString(iNewValue,1));
}else if (e.target == sbWater){
int iValue = ((ScrollBar)e.target).getValue();
int iNewValue;
iNewValue = (iValue*4/50)+1;//Done to get 1:5 range displayed
sbWater.setValue(iValue);
edWater.setText(Convert.toString(iNewValue,1));
}else if (e.target == sbOverall){
int iValue = ((ScrollBar)e.target).getValue();
int iNewValue;
iNewValue = (iValue*4/50)+1;//Done to get 1:5 range displayed
edOverall.setText(Convert.toString(iNewValue,1));
/*************************************************************************
* These are the virtual buttons that are placed on desktop OSes, (those that
* do not have standard PDA hardware buttons).These OSes are Linux, Win32 & Java.
   *
   *Up and down buttons are standard java button methods, 1,10, left, action,right, 100 and 1000
   *are Pushbutton Group (PBG) methods.
   ***************************************************************************/
}else if (e.target == btnPageUp){
PreviousLocation();
}else if (e.target == btnPageDown){
NextLocation();
}if ((e.target == pbgDesktopButtons &&
(ipbg = pbgDesktopButtons.getSelected()) != -1)){
switch (ipbg){
case -1:break; //no item selected
case 0:{ // count = 1 button
edAtual = getParentWindow().getFocus();
if (edAtual != null) {
szCount = "1";
Count();
if (gpsDataLogger.iCarcassFlag == 1){
cbLive.select(0);//switches back to second array field or "Carcass"
ShowSum(); //shows total for "carcass" of that species
gpsDataLogger.iCarcassFlag = 1;}
else if (gpsDataLogger.iToggleSpeciesFlag == 1){
cbSpecies.select(gpsDataLogger.iOriginalSpecies);
ShowSum(); //shows total for original species
gpsDataLogger.iToggleSpeciesFlag = 0;}
else if (gpsDataLogger.iToggleLocationFlag == 1){
cbLocation.select(gpsDataLogger.iOriginalLocation);
ShowSum();//shows total for original location
gpsDataLogger.iToggleLocationFlag = 0;}
}
}break;
case 1:{ // count = 10 button
edAtual = getParentWindow().getFocus();
if (edAtual != null) {
szCount = "10";
Count();
if (gpsDataLogger.iCarcassFlag == 1){
cbLive.select(0);//switches back to second array field or "Carcass"
ShowSum(); //shows total for "carcass" of that species
gpsDataLogger.iCarcassFlag = 1;}
else if (gpsDataLogger.iToggleSpeciesFlag == 1){
cbSpecies.select(gpsDataLogger.iOriginalSpecies);
ShowSum(); //shows total for original species
gpsDataLogger.iToggleSpeciesFlag = 0;}
else if (gpsDataLogger.iToggleLocationFlag == 1){
cbLocation.select(gpsDataLogger.iOriginalLocation);
ShowSum();//shows total for original location
gpsDataLogger.iToggleLocationFlag = 0;}
}
}break;
case 2:{ // page left button, "<"
edAtual = getParentWindow().getFocus();
if (edAtual != null) {
PreviousSpecies();
}
}break;
case 3:{ // center joystick action button, "*"
edAtual = getParentWindow().getFocus();
if (edAtual != null) {
if (gpsDataLogger.iSpeciesFlag == 1){ //flag is set when user selects Location/Species or Live-Dead from dropdown.
if(gpsDataLogger.iToggleSpecies == cbSpecies.getSelectedIndex()){
FiveWayToggle();break;}
else{
gpsDataLogger.iOriginalSpecies = cbSpecies.getSelectedIndex();
FiveWayToggle();}
break;}
else if (gpsDataLogger.iLocationFlag == 1){
if(gpsDataLogger.iToggleLocation == cbLocation.getSelectedIndex()){
FiveWayToggle();break;}
else{gpsDataLogger.iOriginalLocation = cbLocation.getSelectedIndex();
FiveWayToggle();}break;}
else if (gpsDataLogger.iCarcassFlag == 1){
FiveWayToggle();break;}
else if (gpsDataLogger.iTerrainFlag == 1){
FiveWayToggle();break;}
}
}
case 4:{ // page right button,">"
edAtual = getParentWindow().getFocus();
if (edAtual != null) {
NextSpecies();
}
}break;
case 5:{ // count = 100 button
edAtual = getParentWindow().getFocus();
if (edAtual != null) {
szCount = "100";
Count();
if (gpsDataLogger.iCarcassFlag == 1){
cbLive.select(0);//switches back to second array field or "Carcass"
ShowSum(); //shows total for "carcass" of that species
gpsDataLogger.iCarcassFlag = 1;}
else if (gpsDataLogger.iToggleSpeciesFlag == 1){
cbSpecies.select(gpsDataLogger.iOriginalSpecies);
ShowSum(); //shows total for original species
gpsDataLogger.iToggleSpeciesFlag = 0;}
else if (gpsDataLogger.iToggleLocationFlag == 1){
cbLocation.select(gpsDataLogger.iOriginalLocation);
ShowSum();//shows total for original location
gpsDataLogger.iToggleLocationFlag = 0;}
}
}break;
case 6:{ // count = 1,000 button
edAtual = getParentWindow().getFocus();
if (edAtual != null) {
szCount = "1000";
Count();
if (gpsDataLogger.iCarcassFlag == 1){
cbLive.select(0);//switches back to second array field or "Carcass"
ShowSum(); //shows total for "carcass" of that species
gpsDataLogger.iCarcassFlag = 1;}
else if (gpsDataLogger.iToggleSpeciesFlag == 1){
cbSpecies.select(gpsDataLogger.iOriginalSpecies);
ShowSum(); //shows total for original species
gpsDataLogger.iToggleSpeciesFlag = 0;}
else if (gpsDataLogger.iToggleLocationFlag == 1){
cbLocation.select(gpsDataLogger.iOriginalLocation);
ShowSum();//shows total for original location
gpsDataLogger.iToggleLocationFlag = 0;}
}
}break;            
}
}break;
/**************************************************************************************
****************************End desktop virtual buttons*******************************
**************************************************************************************/
}
}
}



dataEdit.java


import litebase.*;
import litebase.ui.*;
import waba.fx.Sound;
import waba.sys.Convert;
import waba.sys.Time;
import waba.sys.Vm;
import waba.ui.Button;
import waba.ui.Container;
import waba.ui.Control;
import waba.ui.ControlEvent;
import waba.ui.Edit;
import waba.ui.Event;
import waba.ui.Label;
import waba.ui.MessageBox;
import waba.ui.PushButtonGroup;
import waba.ui.Timer;
import waba.util.Date;
import litebase.LitebaseConnection;
import litebase.ResultSet;

class dataEdit extends Container{
Timer trackLogTimer;
dataCapture dataCapture;
gpsDataLogger gpsDataLogger;
Edit edTimestamp,edSpecies,edCount,edLocation,edTerrain,edLatitude,edLatns,edLongitude,edLongew,edSky,edWater,edOverall,edLive,edRowId;
Button btnFirstRecord, btnNextRecord, btnPreviousRecord, btnLastRecord, btnClear, btnSave, btnUpdate,btnDelete;
Label lbStatus;
String szRowId,szSpecies,szTerrain,szLatitude,szLatns,szLongitude,szLongew,szSky,szWater,szOverall,szLive;;
int iRowId;
private PushButtonGroup pbgBrowseButtons;
String szBrowseButtons[] = {" Save ","Update","Delete","Clear "," ||<<"," << "," >> "," >>|| "};  
LitebaseConnection driver = LitebaseConnection.getInstance("AZoe");

public void onStart(){
int iTmpWidth=this.width;

edTimestamp = new Edit();
add (edTimestamp);
edTimestamp.setRect(iTmpWidth/3,AFTER+4,iTmpWidth/16*9,PREFERRED);
edTimestamp.setMaxLength(15);
add(new Label("Timestamp"),BEFORE-2,SAME);
edTimestamp.setEditable(false);

add(new Label("Species"),LEFT+3,AFTER+4);
edSpecies = new Edit();
add (edSpecies);
edSpecies.setRect(AFTER+2,SAME,100,PREFERRED);  
edSpecies.setMaxLength(20);

add(new Label("Count"),AFTER+4,SAME);
edCount = new Edit();
edCount.setValidChars("0123456789");
add (edCount);
edCount.setRect(AFTER+2,SAME,35,PREFERRED);      
edCount.setMaxLength(10);

edLocation = new Edit();
add (edLocation);
edLocation.setRect(iTmpWidth/3,AFTER+4,iTmpWidth/8*5,PREFERRED);  
edLocation.setMaxLength(50);
add(new Label("Location"),BEFORE-2,SAME);

edTerrain = new Edit();
add (edTerrain);
edTerrain.setRect(iTmpWidth/3,AFTER+4,iTmpWidth/8*5,PREFERRED);  
edTerrain.setMaxLength(20);
add(new Label("Terrain"),BEFORE-2,SAME);

//Any way to make this right justified and width dynamic?
add(new Label("Lat"),LEFT+5,AFTER+4);
edLatitude = new Edit();
add (edLatitude);
edLatitude.setRect(AFTER+1,SAME,iTmpWidth/16*5,PREFERRED);  
edLatitude.setMaxLength(20);
edLatitude.setEditable(false);
edLatns = new Edit();
add (edLatns);
edLatns.setRect(AFTER,SAME,18,PREFERRED);  
edLatns.setMaxLength(3);
edLatns.setEditable(false);

add(new Label("Long"),AFTER+3,SAME);
edLongitude = new Edit();
add (edLongitude);
edLongitude.setRect(AFTER+1,SAME,iTmpWidth/16*5,PREFERRED);  
edLongitude.setMaxLength(20);
edLongitude.setEditable(false);
edLongew = new Edit();
add (edLongew);
edLongew.setRect(AFTER,SAME,18,PREFERRED);  
edLongew.setMaxLength(3);
edLongew.setEditable(false);


add(new Label("Sky"),LEFT+2,AFTER+3);
edSky = new Edit();
edSky.setValidChars("12345");
add (edSky);
edSky.setRect(AFTER+3,SAME,35,PREFERRED);      
edSky.setMaxLength(10);

add(new Label("Water"),AFTER+3,SAME);
edWater = new Edit();
edWater.setValidChars("12345");
add (edWater);
edWater.setRect(AFTER+3,SAME,35,PREFERRED);      
edWater.setMaxLength(10);

add(new Label("Overall"),AFTER+3,SAME);
edOverall = new Edit();
edOverall.setValidChars("12345");
add (edOverall);
edOverall.setRect(AFTER+3,SAME,35,PREFERRED);      
edOverall.setMaxLength(10);

add(new Label("RowID"),LEFT+3,AFTER+3);
edRowId = new Edit();
add (edRowId);
edRowId.setRect(AFTER+2,SAME,15,PREFERRED);      
edRowId.setMaxLength(5);
edRowId.setEditable(false);

add(new Label("Live/dead"),AFTER+3,SAME);
edLive = new Edit();
add (edLive);
edLive.setRect(AFTER+3,SAME,35,PREFERRED);      
edLive.setMaxLength(10);

pbgBrowseButtons = new PushButtonGroup(szBrowseButtons,false,-1,2,6,2,true,PushButtonGroup.BUTTON);
add(pbgBrowseButtons,CENTER,AFTER+4);

lbStatus = new Label("",CENTER);
lbStatus.setInvert(true);
lbStatus.setForeColor(getForeColor().brighter());
add(lbStatus, LEFT,BOTTOM);}
public void CreateTrackLogTimer(){//specifies how often tracklog point is stored
removeTimer(trackLogTimer);
trackLogTimer = addTimer(gpsDataLogger.iTrackLogInterval);}
private boolean verifyFields(){
boolean timestampOk   = edTimestamp.getText().length() > 0;
boolean speciesOk   = edSpecies.getText().length() > 0;
boolean countOk   = edCount.getText().length() > 0;
boolean locationOk   = edLocation.getText().length() > 0;
boolean terrainOk   = edTerrain.getText().length() > 0;
boolean latitudeOk   = edLatitude.getText().length() > 0;
boolean latnsOk   = edLatns.getText().length() > 0;
boolean longitudeOk   = edLongitude.getText().length() > 0;
boolean longewOk   = edLongew.getText().length() > 0;
boolean skyOk   = edSky.getText().length() > 0;
boolean waterOk   = edWater.getText().length() > 0;
boolean overallOk   = edOverall.getText().length() > 0;
boolean liveOk   = edLive.getText().length() > 0;

StringBuffer   sb = new StringBuffer();
if (!timestampOk)   sb.append("Timestamp|");
if (!speciesOk)   sb.append("Species|");
if (!countOk)   sb.append("Count|");
if (!locationOk)   sb.append("Location|");
if (!terrainOk)   sb.append("Terrain|");
if (!latitudeOk)   sb.append("Latitude|");
if (!latnsOk)   sb.append("Latitude N/S|");
if (!longitudeOk)   sb.append("Longitude|");
if (!longewOk)   sb.append("Longitude E/W|");
if (!skyOk)   sb.append("Sky|");
if (!waterOk)   sb.append("Water|");
if (!overallOk)   sb.append("Overall|");
if (!liveOk)   sb.append("Live|");

if (sb.length() > 0) {
sb.setLength(sb.length()-1); // remove the last |
new MessageBox("Attention","Required fields are empty!|Please check that|there are valuesin|the following fields:|"+sb).popupModal();
repaint();
return false;}
return true;}
public void onEvent(Event e){
int ipbg;
Control edAtual;
if (e.type == ControlEvent.TIMER){
trackLog();}
else if (e.type == ControlEvent.PRESSED){            
if ((e.target == pbgBrowseButtons &&
(ipbg = pbgBrowseButtons.getSelected()) != -1)){
switch (ipbg){
case -1:break; //no item selected
case 0:{ // Save button
edAtual = getParentWindow().getFocus();
if (edAtual != null) {
if (verifyFields())
doInsertUpdate(true);
clear();
gpsDataLogger.iEmptyLocationLookupTable = 0;} //reset flag to 'not empty'
}break;
case 1:{ // Update button
edAtual = getParentWindow().getFocus();
if (edAtual != null) {
if (verifyFields()){
if (iRowId > 0){
doInsertUpdate(false);
clear();}
else
Sound.beep();}}}break;
case 2:{ // Delete button
edAtual = getParentWindow().getFocus();
if (edAtual != null) {
szRowId = edRowId.getText();
iRowId = Convert.toInt(szRowId);
if (iRowId > 0)
doDelete();
else                    
Sound.beep();}
}break;
case 3:{ // Clear button
edAtual = getParentWindow().getFocus();
if (edAtual != null) {
clear();}}break;
case 4:{ // First Record, ("||<<") button
edAtual = getParentWindow().getFocus();
if (edAtual != null) {
firstRecord();}}break;
case 5:{ // Previous Record, ("<<") button
edAtual = getParentWindow().getFocus();
if (edAtual != null) {
previousRecord();}}break;
case 6:{ // Next Record, (">>") button
edAtual = getParentWindow().getFocus();
if (edAtual != null) {
nextRecord();}}break;
case 7:{ // Last Record, (">>||") button
edAtual = getParentWindow().getFocus();
if (edAtual != null) {
lastRecord();}}break;            
}
}      
}              
}        
public void firstRecord(){
ResultSet rs = driver.executeQuery("select rowid,time_stamp,species,surveycount,location,terrain,latitude,latns,longitude,longew,sky,water,overall,live from surveyDB");
rs.first();    
edTimestamp.setText(rs.getString("time_stamp"));
edSpecies.setText(rs.getString("species"));
edCount.setText(rs.getString("surveycount"));
edLocation.setText(rs.getString("location"));
edTerrain.setText(rs.getString("terrain"));
edLatitude.setText(rs.getString("latitude"));
edLatns.setText(rs.getString("latns"));
edLongitude.setText(rs.getString("longitude"));
edLongew.setText(rs.getString("longew"));
edSky.setText(rs.getString("sky"));
edWater.setText(rs.getString("water"));
edOverall.setText(rs.getString("overall"));
edLive.setText(rs.getString("live"));
edRowId.setText(rs.getString("rowid"));
rs.close();}
public void previousRecord(){//tweaked to keep iRowId zero from displaying
szRowId = edRowId.getText();
iRowId = Convert.toInt(szRowId);
ResultSet rs = driver.executeQuery("select rowid,time_stamp,species,surveycount,location,terrain,latitude,latns,longitude,longew,sky,water,overall,live from surveyDB where rowid <"+iRowId);
if ((rs.getString("rowid").compareTo("0")==0)){//keeps always empty iRowId #0 from being displayed and confusing people...
rs.close();
rs = driver.executeQuery("select rowid,time_stamp,species,surveycount,location,terrain,latitude,latns,longitude,longew,sky,water,overall,live from surveyDB");//full recordset is returned
}
else{//...if iRowId 1 or >...
rs.last();
edTimestamp.setText(rs.getString("time_stamp"));
edSpecies.setText(rs.getString("species"));
edCount.setText(rs.getString("surveycount"));
edLocation.setText(rs.getString("location"));
edTerrain.setText(rs.getString("terrain"));
edLatitude.setText(rs.getString("latitude"));
edLatns.setText(rs.getString("latns"));
edLongitude.setText(rs.getString("longitude"));
edLongew.setText(rs.getString("longew"));
edSky.setText(rs.getString("sky"));
edWater.setText(rs.getString("water"));
edOverall.setText(rs.getString("overall"));
edLive.setText(rs.getString("live"));
edRowId.setText(rs.getString("rowid"));
rs.close();}}
public void nextRecord(){//tweaked to keep iRowId zero from displaying
szRowId = edRowId.getText();
iRowId = Convert.toInt(szRowId);
ResultSet rs = driver.executeQuery("select rowid,time_stamp,species,surveycount,location,terrain,latitude,latns,longitude,longew,sky,water,overall,live from surveyDB where rowid >"+iRowId); //...returns all records greater than current, unless there are no more in which case zero is returned.

if ((rs.getString("rowid").compareTo("0")==0)){//keeps always empty iRowId #0 from being displayed and confusing people...
rs.close(); //dumps rs, below makes full rs
rs = driver.executeQuery("select rowid,time_stamp,species,surveycount,location,terrain,latitude,latns,longitude,longew,sky,water,overall,live from surveyDB");//full recordset is returned
rs.last(); //only last record in rs is shown
}else{
rs.first();} //shows first record of first rs above w/all of the > iRowId records        
edTimestamp.setText(rs.getString("time_stamp"));
edSpecies.setText(rs.getString("species"));
edCount.setText(rs.getString("surveycount"));
edLocation.setText(rs.getString("location"));
edTerrain.setText(rs.getString("terrain"));
edLatitude.setText(rs.getString("latitude"));
edLatns.setText(rs.getString("latns"));
edLongitude.setText(rs.getString("longitude"));
edLongew.setText(rs.getString("longew"));
edSky.setText(rs.getString("sky"));
edWater.setText(rs.getString("water"));
edOverall.setText(rs.getString("overall"));
edLive.setText(rs.getString("live"));
edRowId.setText(rs.getString("rowid"));
rs.close();}
public void lastRecord(){    
ResultSet rs = driver.executeQuery("select rowid,time_stamp,species,surveycount,location,terrain,latitude,latns,longitude,longew,sky,water,overall,live from surveyDB");
rs.last();    
edTimestamp.setText(rs.getString("time_stamp"));
edSpecies.setText(rs.getString("species"));
edCount.setText(rs.getString("surveycount"));
edLocation.setText(rs.getString("location"));
edTerrain.setText(rs.getString("terrain"));
edLatitude.setText(rs.getString("latitude"));
edLatns.setText(rs.getString("latns"));
edLongitude.setText(rs.getString("longitude"));
edLongew.setText(rs.getString("longew"));
edSky.setText(rs.getString("sky"));
edWater.setText(rs.getString("water"));
edOverall.setText(rs.getString("overall"));
edLive.setText(rs.getString("live"));
edRowId.setText(rs.getString("rowid"));
rs.close();}
private void doInsertUpdate(boolean isInsert){
String szTime_stamp = edTimestamp.getText();
String szSpecies = edSpecies.getText();
String szCount = edCount.getText();
String szLocation = edLocation.getText();
String szTerrain = edTerrain.getText();
String szLatitude = edLatitude.getText();
String szLatns = edLatns.getText();
String szLongitude = edLongitude.getText();
String szLongew = edLongew.getText();
String szSky = edSky.getText();
String szWater = edWater.getText();
String szOverall = edOverall.getText();
String szLive = edLive.getText();

long lastUpdated = new Time().getTimeLong();
int rows = -1;
try{
if (isInsert){//Save
//rows = driver.executeUpdate("insert into surveyDB values ('"+szTime_stamp+"','"+szLocation+"','"+szCount+"',"+lastUpdated+")");
rows = driver.executeUpdate("insert into surveyDB values ('"+szTime_stamp+"','"+szSpecies+"','"+szCount+"','"+szLocation+"','"+szTerrain+"','"+szLatitude+"','"+szLatns+"','"+szLongitude+"','"+szLongew+"','"+szSky+"','"+szWater+"','"+szOverall+"','"+szLive+"',"+lastUpdated+")");
}else//update
rows = driver.executeUpdate("UPDATE surveyDB SET (time_stamp='"+szTime_stamp+"',species='"+szSpecies+"',surveycount='"+szCount+"',location='"+szLocation+"',terrain='"+szTerrain+"',latitude='"+szLatitude+"',latns='"+szLatns+"',longitude='"+szLongitude+"',longew='"+szLongew+"',sky='"+szSky+"',water='"+szWater+"',overall='"+szOverall+"',live='"+szLive+"',lastUpdated='"+lastUpdated+"')where rowid="+iRowId);
if (rows == 1){
gpsDataLogger.invalidateRS();
clear();
}else Sound.beep();
} catch (Throwable t) {Vm.debug(t.getMessage());}}
private void doDelete(){    
int rows = driver.executeUpdate("delete surveyDB where rowid="+iRowId);
//new MessageBox("Debug","Made it past delete function.").popupModal();
clear();
if (rows == 1){
//gpsDataLogger.invalidateRS();//WHY DO WE NEED THIS HERE???
clear();}
else Sound.beep();}
public void clear(){
edTimestamp.setText("");
edSpecies.setText("");
edCount.setText("");
edLocation.setText("");
edTerrain.setText("");
edLatitude.setText("");
edLatns.setText("");
edLongitude.setText("");
edLongew.setText("");
edSky.setText("");
edWater.setText("");
edOverall.setText("");
edLive.setText("");
edRowId.setText("");}
/***************************************************************
*   TrackLog- Saves Lat/Long coordinates and altitude as survey progresses
*   in a separate trackLog table. Makes and saves a timestamp,
*   and fetches and stores current Lat/Long coordinates.
***************************************************************/
protected void trackLog(){
//if (gpsDataLogger.iTrackLogFlag == 1){//set to 1 on menu dropdown
String szLatitude = "";
String szLongitude = "";
String szLatns = "";
String szLongew = "";
String szAltitude = "";

szLatitude = gpsDataLogger.szLat;
szLatns = gpsDataLogger.szLatNs;
szLongitude = gpsDataLogger.szLong;
szLongew = gpsDataLogger.szLongEw;
szAltitude = gpsDataLogger.szAltitude;

//if szLattitude or szLongitude == "", resets string to "No GPS signal..."
if ((szLatitude.compareTo("")==0) || (szLongitude.compareTo("")==0)){
szLongitude = szLatitude = "No GPS signal...";}

long T = new Time().getTimeLong();
String szTime_stamp = Convert.toString(T,1);                                

long lastUpdated = new Time().getTimeLong();          
int rows = -1;                      
rows = driver.executeUpdate("insert into trackLog values ('"+szTime_stamp+"','"+szLatitude+"','"+szLatns+"','"+szLongitude+"','"+szLongew+"','"+szAltitude+"')");
}
public void show(String rowid){//shows selected grid record in Data Entry form
this.iRowId = Convert.toInt(rowid);
ResultSet rs = driver.executeQuery("select * from surveyDB where rowid = "+this.iRowId);
if (!rs.next()){
status("Row id not found: "+this.iRowId);
clear();}
else{
edTimestamp.setText(rs.getString("time_stamp"));
edSpecies.setText(rs.getString("species"));
edCount.setText(rs.getString("surveycount"));
edLocation.setText(rs.getString("location"));
edTerrain.setText(rs.getString("terrain"));
edLatitude.setText(rs.getString("latitude"));
edLatns.setText(rs.getString("latns"));
edLongitude.setText(rs.getString("longitude"));
edLongew.setText(rs.getString("longew"));
edSky.setText(rs.getString("sky"));
edWater.setText(rs.getString("water"));
edOverall.setText(rs.getString("overall"));
edLive.setText(rs.getString("live"));
// edRowId.setText(rs.getString("rowid"));  

/*
* Convert other rowid to edRowId commands to below???
*/

edRowId.setText(Convert.toString(iRowId, 1));
/*.....below code doesn't work...don't bother w/it.
"edRowId.setText(rs.getString("rowid"))" ;
*/
long lastUpdated = rs.getLong("lastupdated");
Time t = new Time(lastUpdated);
status("Last updated: "+new Date(t)+" "+t);}
}
public void status(String msg){
lbStatus.setText(msg);}
}



dataGps.java
[code]
import waba.ui.Button;
import waba.ui.Check;
import waba.ui.ComboBox;
import waba.ui.Container;
import waba.ui.ControlEvent;
import waba.ui.Edit;
import waba.ui.Event;
import waba.ui.InputDialog;
import waba.ui.Label;
import waba.ui.ListBox;
import waba.ui.MessageBox;
import waba.ui.Timer;
import superwaba.ext.xplat.io.gps.GPS;
import waba.ui.MainWindow;
import waba.ui.*;
import waba.io.*;
//import superwaba.ext.xplat.io.gps.GPS;
import waba.sys.*;
import waba.fx.*;
import waba.io.DataStream;
import waba.io.File;
import waba.io.SerialPort;

public class dataGps extends Container {
   Button btnRestartGps, btnHelp;
   Button btnStartStop = null;
   dataCapture dataCapture;
   MessageBox mbComPort, mbBluetoothHelp, mbDebug;
   
   StringBuffer sb = new StringBuffer();   
   static String szPlatform = Settings.platform;//gets host OS information
   
   //below arrays populate the listboxes w/baud rates and Com Port numbers
   String [] rgszComPort = {"1","2","3","4","5","6","7","8","9","10"};
   String [] rgszBaud = {"300","1200","2400","4800","9600","14400","19200","38400","57600","115200"};
   
   SerialPort sp = null;
   Timer savetimer = null;
   Label lBaud, lComPort, lBaudValue, lComPortValue;
   ComboBox cbBaud, cbComPort;
   String[] text = new String[]{"","","","","","","",""};
   
   boolean bRunning = true;
   boolean bEatCheckSum = false;
   
   int iComPort;
   int iBaud;
   int msgCount;
   int iCounter = 0;
   
   double[] diLocation = new double[2];
   public Time lastFix=new Time(); // Stores the time of lastFix.

   dataGps dataGps;
   
   public void onStart() {      
      int iTmpHeight=this.height;
      
      btnHelp = new Button("Bluetooth Help");
      btnHelp.commonGap = 6;
      add(btnHelp,LEFT+5,iTmpHeight/32*21);
      
      add(btnStartStop = new Button("START GPS"),RIGHT-5,SAME);
      btnStartStop.setBackColor(Color.RED);
      
      add(lBaud= new Label("Baud rate: "),LEFT+5,BOTTOM-5);      
      add(cbBaud= new ComboBox(rgszBaud),AFTER+2,SAME);      
      cbBaud.select(3);//sets 4800baud from rgszBaud string array as default
         
      add(lComPort= new Label("ComPort: "),AFTER+5,SAME);
      add(cbComPort= new ComboBox(rgszComPort),AFTER+2,SAME);      
      cbComPort.select(7); //sets Com8 from rgszComPort string array as default
      
      SerialPortSettings();//fires up serial port and checks for data stream
   }      
   /*********************************************************************************************
    * SerialPortSettings- Gets shown value from listbox for Baud and ComPort and sets serial port
    * if device is WinCE. Other devices use USB or dedicated BT port. If datastream is present
    * application is configured for data collection. If signal is not present serial port is closed,
    * sb (string buffer) is set to zero. btnStartStop is set to display 'Start GPS'.
    **********************************************************************************************/
   public void SerialPortSettings(){         
      Object objComPort = cbComPort.getSelectedItem();//...there has to be a better way
      String szComPort = objComPort.toString();// rather than going from obj --> string
      iComPort = Convert.toInt(szComPort);   // then string --> int...                  
      
      Object objBaud = cbBaud.getSelectedItem();
      String szBaud = objBaud.toString();
      iBaud = Convert.toInt(szBaud);
      if(bRunning == true){         
         if ((szPlatform.compareTo("Java")==0)||(szPlatform.compareTo("Win32")==0)||
               (szPlatform.compareTo("Linux&q
#4
Java / no encuentra las "librerias"
25 Junio 2008, 01:29 AM
hola amigos ps aki ando iniciandome en  :rolleyes: :rolleyes: :rolleyes: java xd y ps ya me descargue los sdk xD en fin el problema esta cuando
desde la consola (cmd de xp) le doy a java me salen los "comandos" de ayuda pero cuando intento darle a javac no quiere me dice que : no se reconoce por un comando interno o externo:claro esta que cuando quier compliar ps lo que hago es pongo la ruta del javac en la consola (si si de xp) y ps si me compila pero al tratalo de ejecutar  el .class me dice

Exception in thread "main" java.lang.NoClassDefFoundError : holamundo

el codigo que trato hacer es:

class holamundo
{
  /*
   * Punto de entrada a la aplicación.
   *
   * args: matriz de parámetros pasados a la aplicación
   * mediante la línea de órdenes. Puede estar vacía.
   */
   public static void main (String[] args)
   {
     System.out.println("Hola mundo!!!");
   }
}


los path y los classpath ... estan bien .. segun creo ...
le tengo la ruta que le instale y donde guardo los proyectos, tambien la carpeta de bin y la de lib. en las variables

algo asi las tengo
CLASSPATH
C:\PVSW\BIN\PVJDBC2X.JAR;C:\PVSW\BIN\PVJDBC2.JAR;C:\Archivos de programa\Java\jdk1.5.0_09;C:\Archivos de programa\Java\jre1.5.0_09\bin;D:\Java\mis proyectos;D:\misclases;C:\java\jdk1.5.0;C:\java\jdk1.5.0\bin:C:\java\jdk1.5.0\lib


y las de
PATH
C:\PVSW\BIN;%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;C:\M10\\cvs_client;C:\Archivos de programa\MySQL\MySQL Server 5.0\bin;C:\MSSQL7\BINN;C:\java\jdk1.5.0;C:\java\jdk1.5.0\bin;C:\java\jdk1.5.0\lib


saludos y una ayudadita pls xD

resuelto: en efecto lo que tenia mal era el classpath... lo primero que hice fue borrar todo lo de path y classpath de las variables de entorno (me alegra averlas posteado jeje xD) despues le instale la maquina virtual; y me percate que no tenia el archivo javac :s, y ahora solo agrege bien la ruta el "bin" y la de mis "proyectos" a classpath xD en fin grax

borrenlo o hagan lo que quieran con este post

#5
hey ayuda amigos me gustaria que me ayudaran a aprender sobre ese tema de flashear celulars pero no se como empezar quiero aprender de varias marcas y modelos
pero seria genial emepzar con los sony ericsson

ayuda pleze
grax de antemano
#6
PHP / hola ... como pongo un script?¿
6 Enero 2007, 00:56 AM
perdon por la ignorancia!!! :rolleyes: :rolleyes: :rolleyes: