Problem reading weight from my Ohaus Pro scout balance. Model SP2001
Good evening.
I am trying to read a single measurement from a Ohaus Balance (model SP2001). The connection seems to be good, but when I send a print command : P\r, it always reads 0 grams, no matter what I put on the balance. Now the display on the balance shows the correct weight, its what is read on labview that is always Zero.
Also, when I send the command for Mode: 0M\r , to get it in gram mode, the command needs to be sent in normal codes display in order for the VISA write not to bug, but when I send the print command: P\r, it only gives no error when it is in \ codes display, I dont get it.
I have attached the code I'm using here, wich is pretty much inspired by the SP2001 driver that I found on NI hopefully someone knows how to work with this.
Attachments:
Ohaus_measure_test_2014_07_18.vi 36 KB
Ok so I wrote \r on here but as you can see in the code, I actually send a string carriage return with the command when setting up the mode
When I say to bug: it gives me and error stating that timeout expired.
Nothing is wrong specifically wrong with the driver, it gives me the exact same problem, the code I'm using now is basically all there is in the driver put in one stacked sequence
Similar Messages
-
How do i remove my reading list from my macbook pro
How do i remove my reading list from my macbook pro?
Hi marazulnet,
Do you mean the reading list in Safari?
Click on Clear All.
Regards,
Ian. -
Problem reading data from oracle database 11g using OleDbDataReader
Hi everyone I work with Visual Studio 2010 and C# programming language. I have a problem reading data from the oracle database. I created a WPF application with my main Window Xaml and class files and 1 more class called DataFiles. The thing I want is to read some data from the database on my grid in my WPF window. Problem is even though it connects to the database the grid is always empty. It isn't the connection string as I tested it and it connects to the database the problem seems to be in showing the LASTNAME (PREZIME in my native tongue) on the grid which is what it's supposed to do.
Here is the code:
Data Files Code
using System;
using System.Collections.ObjectModel;
using System.Data.SqlClient;
using System.Data.OleDb;
namespace SQLKonekcija
public class clsEmployee
public string Prezime { get; set; }
public class DataAccess
OleDbConnection oleCon;
OleDbCommand oleComd;
public DataAccess()
string connectionString = "provider=ORAOLEDB.ORACLE; data source=ORCL; password=****; user id=****;";
oleCon = new OleDbConnection(connectionString);
public ObservableCollection<clsEmployee> GetAllEmployee()
ObservableCollection<clsEmployee> EmpCol = new ObservableCollection<clsEmployee>();
oleComd = new OleDbCommand();
oleComd.Connection = oleCon;
oleComd.CommandText = "Select PREZIME from UPOSLENICI";
oleCon.Open();
OleDbDataReader Reader = oleComd.ExecuteReader();
Reader.Read();
while (Reader.Read())
EmpCol.Add(new clsEmployee()
Prezime = Reader["PREZIME"].ToString()
oleCon.Close();
return EmpCol;
}And here is my main window.cs code
public partial class MainWindow : Window
clsEmployee objEmpToAdd;
DataAccess objDs;
public MainWindow()
InitializeComponent();
private void Window_Loaded(object sender, RoutedEventArgs e)
objDs = new DataAccess();
dgEmp.ItemsSource = objDs.GetAllEmployee();And the XAML
<Window x:Class="SQLKonekcija.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="MainWindow" Height="350" Width="525" Loaded="Window_Loaded">
<Grid>
<DataGrid AutoGenerateColumns="False" Height="237"
HorizontalAlignment="Left" Margin="18,66,0,0" Name="dgEmp"
VerticalAlignment="Top" Width="466" ColumnWidth="*"
>
<DataGrid.Columns>
<DataGridTextColumn Binding="{Binding PREZIME}" Header="Prezime"></DataGridTextColumn>
</DataGrid.Columns>
</DataGrid>
<TextBlock Height="42" HorizontalAlignment="Left" Margin="18,15,0,0" Name="textBlock1" Text="TEST CONNECTION" VerticalAlignment="Top" Width="462" TextAlignment="Center" FontSize="28" FontWeight="ExtraBold" />
</Grid>
</Window>
The guys on the MSDN forums told me I should ask the question here so sorry if it's not your field.
Hope u guys can help, thanks.I tried it, commented out the reader.read and have the following connection string
string connectionString = "provider=ORAOLEDB.ORACLE; data source=ORCL; password=****; user id=****; OLEDB.NET=True"
Unfortunately the result is the same.
Edited by: Dino2dy on Nov 24, 2011 12:53 AM -
JavaConsole Error: Problem reading data from server
HI All
We are getting this error on java console on a page:
Error: Problem reading data from Server - Java.Security.AccessControlException:access denied (java.util.PropertyPermission http.strictpostredirect Read)
In this page we are not firing a SQL Query of huge data.
Any suggestions on this why it is happening?
Thanks
ManishaManisha,
I think JVM(Java Virtual Machine) is trying to access something at network level and it cant able to find it.Or any new patches of java is installed.
Or may be due to IIS or Applet,Don't know exactly.
You can find some answers in below links:
http://java.sun.com/j2se/1.4.2/docs/api/java/security/AccessControlException.html
http://www.webdeveloper.com/forum/archive/index.php/t-46358.html
-Suresh -
Problem reading data from two tables
Hi experts,
I'm developing a JDBC - IDOC scenario that needs to read data from two oracle tables. I have created a BPM that has a initial fork for the two channels and it works fine.
The problem is that I need to read data from the first, two or both tables depending if there is data to read. If there is data in the two tables it works, but if only there is data in one of the two tables, I have read problems. I have tryed to set the 'neccesary branches' to 1 but this is a problem when I have data in both tables.
Any idea?
Best Regards,
Alfredo Lagunar.Hi,
have your fork step inside a block and then right-click your block to insert a deadline branch to your BPM process and specify the time after which your BPM process should be cancelled.....so if in that time, you get data from both tables, your BPM will work okay otherwise if that time is over, then your BPM process will be cancelled.
Regards,
Rajeev Gupta -
How can I read weight from scale
Hi,
I want to setup SAP so that HUPAST transaction can read the weight from the scale. I could see that it looks for an RFC destination and scale name etc. But didnt succeed in creating the RFC destination
Please let me know if a third party software is a MUST or SAP has an inbuilt software for reading scales, if so how can we configure it. We are on ECC 5.0
Thanks for reading.After a few more experiments, you can get correct values from the 'bounds'-descriptor.
function getTextExtents(text_item) {
app.activeDocument.activeLayer = text_item.parent
var ref = new ActionReference()
ref.putEnumerated( charIDToTypeID("Lyr "), charIDToTypeID("Ordn"), charIDToTypeID("Trgt") )
var desc = executeActionGet(ref).getObjectValue(stringIDToTypeID('textKey'))
var bounds = desc.getObjectValue(stringIDToTypeID('bounds'))
var width = bounds.getUnitDoubleValue (stringIDToTypeID('right'))
var height = bounds.getUnitDoubleValue (stringIDToTypeID('bottom'))
var x_scale = 1
var y_scale = 1
if (desc.hasKey(stringIDToTypeID('transform'))) {
var transform = desc.getObjectValue(stringIDToTypeID('transform'))
x_scale = transform.getUnitDoubleValue (stringIDToTypeID('xx'))
y_scale = transform.getUnitDoubleValue (stringIDToTypeID('yy'))
return { x:Math.round(text_item.position[0]), y:Math.round(text_item.position[1]) , width:Math.round(width*x_scale), height:Math.round(height*y_scale) }
I tested that this returns correct values both when image and text box get scaled. There is some strange Photoshop behaviour to note though:
bounds.left seems to be always 0 like one could assume
bounds.top on the other had is most times -1-3px. This probably corresponds to the amount the actual text rises above the text box. I feel it's a bug, i.e. it should be part of content bounding box, not the text area. But maybe it's like it was specced and I'm just interpreting it wrong.
x_scale and y_scale seem to be always equal. For example if you create a 100x100px text box and scale it to 200px horizontally, both x_scale and y_scale will be 2 and text_item.height will be 50. -
Reading Weight from Weigh Bridge....
Hi.
The scenario here is that we have to create module pool for picking up
the weights of trucks from weigh bridge ( AVERY brand ).
The existing system is in foxpro . Please find attached the text of AVERY guidance which exhaustively shows how the fox system is reading the
weight from the port, to which the weigh bridge is attached, on the
system kept at the location.
I wish to have the info regarding how, this functionality can be
achieved in ABAP as my perception is that this is not a simple
execution / run of an external program.
regards,
Suman
TEXT
getwt.prg
sample weight recieving program for Avery CTH
this is demo program for getting weight from the CTH
using the CALL and LOAD commands of dBASE III PLUS only.
This demo program demonstrates the use of LOAD and CALL commands
of dBASE III PLUS to get the weight from the CTH. The actual
program to get the weight is a file called GETCTH.BIN
To use GETCTH.BIN directly do the following:
1. Start dBASE III PLUS normally.
2. Type the command - LOAD GETCTH at the dot prompt of dBASE III PLUS.
(Be sure to give the correct drive and/or directory where the
file GETCTH.BIN resides in your computer system).
3. The program GETCTH.BIN will return the weight in a variable
passed from dBASE III PLUS, so first initialize a variable in
dBASE III PLUS to recieve the weight.
The weight string returned by the CTH is 26 charecters long so
define a variable of length 26 by typing the following command
at the dot prompt:
WEIGHT = "ABCDEFGHIJKLMNOPQRSTUVWXYZ" { Any dummy value }
or
WEIGHT = "2BCDEFGHIJKLMNOPQRSTUVWXYZ" for COM2 port
( Note -> The choice for the name of the above variable is
purely arbitrary. Any name could have been chosen)
4. Next type the following command at the dot prompt to call the
GETCTH function :
CALL GETCTH WITH WEIGHT
5. After some time the dot prompt will return. At the dot prompt
type the following :
? WEIGHT
If the GETCTH function has been successfull in getting the weight
from the CTH then this function will return the weight as a string
of 26 charecters containing the weight and other information.
Otherwise, if the function is not successfull then the value of
the variable passed will be set to 26 spaces. The major reason
for the failure of the function will be a timeout error i.e.
the CTH did not respond after a preset time interval had elasped.
The returning of 26 spaces makes it easy for a dBASE III PLUS
program to retry the weighing operation if failure is detected.
The use of this in a loop till the function succeeds in getting
a weight is illustrated below in the program.
The weight returned by the CTH consists of a string of 26 charecters
A sample weight that could be returned is reproduced below:
ABCDEFGHIJKLMNOPQRSTUVWXYZ
19600 kg G 000016 O
The following is the sequence of charecters :
1. The first two charecters ( positions A - B above ) are
space charecters.
2. The next five charecters ( positions C - G above ) is the
weight from the CTH - ( 19600 in this case).
3. The next charecter ( position H above ) is a space charecter.
4. The next two charecters ( positions I - J above ) are the weight
units - ( kg in this case ).
5. The next four charecters ( positions K - N above ) are space
space charecters.
6. The next charecter ( position O above ) specifies mode of
operation. It shows 'G' for Gross mode and 'T' for Tare
mode of operation.
7. The next charecter ( position P above ) is a space charecter.
8. The next six charecters ( positions Q - V above ) is the
consecutive number which is unique for each weighing.
9. The next charecter ( position W above ) is a space charecter.
10. The next charecter ( position X above ) is the machine ID number.
11. The last two charecters ( positions Y - Z above ) are
Carriage return and Line feed charecters.
Clear the screen and show the copyright notice.
clear
@ 0, 0 TO 23, 79 DOUBLE
@ 3, 1 TO 3, 78
@ 11, 25 TO 18, 57
set color to w/n+
@ 1, 26 SAY "A V E R Y I N D I A L I M I T E D"
set color to
set color to n/w+
@ 2, 10 SAY " Demo program for getting weight from Avery weight digitiser - CTH "
set color to
set color to w/n+
@ 6, 3 SAY "(C) Avery India Ltd.- 1989,1990 All rights reserved."
@ 8, 10 SAY "The source code of this program is for pure demo purposes and all"
@ 9, 10 SAY "copyright of this demo program and its source rests with"
@ 10, 10 SAY "Avery India Ltd."
@ 20, 10 SAY "This program and its accompaining source code cannot be used"
@ 21, 10 SAY "without the prior permission of Avery India Ltd."
set color to
set color to n/w+
@ 17,26 say " Press any key to continue... "
set color to
wait ""
@ 4,0 clear to 23,79
@ 0,0 to 19,79 double
WEIGHT = space(26) && define a variable to get the weight
load getcth && load the module from disk
&& this assumes that the file GETCTH.BIN
&& is in the current drive/directory.
&& If not, use drive specifier.
do while weight = space(26) && the main loop
call getcth with weight
enddo
set color to w/n+
As explained above the last two charecters of the weight string
are the Carriage return (CR) and the Line feed (LF) charecters
out of the total of 26 charecters of the weight string. So to get
the whole weight string other than these last two chareceters we
can use the SUBSTR command of dBASE III PLUS as follows :-
@ 14,20 say "The weight is : " + substr(weight,1,24)
This will show the whole weight string on the screen i.e. all
24 charecters ( it will not show the CR and the LF charecters ).
The CR and the LF charecters are as it is unprintable charecters
and will show up as control charecters if printed on the screen.
If the whole weight string is not required and only, say, the
weight and the weight units are required, then the following command
could be used :-
@ 14,20 say "The weight is : " + substr(weight,1,10)
This will show the weight value and the weight units (this substring
will include the embedded space charecters in this susbtring).
Similarly, other parameters from the weight string could be
incorporated, if required, from the whole string to enhance
the weighing process on the computer.
The idea of putting the CALL statement above in a loop is that
sometimes due to unavoidable reasons, there may some garbage
charecters on the serial port. Thus it may be necessary to flush these
charecters from the port by CALLing the function again.
Sometimes, the function may return without a timeout error but the
variable may contain some control charecters which do not make sense.
In this case the function should called repeatedly till the proper
charecters are returned. This occurs due to the reason explained
above.
@ 14,20 say "The weight is : " + substr(weight,1,24)
set color to
set color to n/w+
@ 16,5 say "Please read the README.DOC file on this disk for more information"
release module getcth && release module from memory
set color to
Please refer to the dBASE III PLUS manuals for a
complete discussion on the LOAD, CALL and RELEASE
commands.
Message was edited by: Suman TyagiThanks, but I've already seen this thread and done the steps described on it.
Actually, my question is very specific... How to populate the fields LinkVal and LinkUnit of the registry...
I read all the threads here in SDN and they don't answer my question...
I'd be glad if someone had already done tcode HUPAST works for Filizola...
Tks again. -
HUPAST - Reading weight from scale
Hello everyone,
I've found some threads explaining how to get the weight from transaction HUPAST.
We've already done almost all the configs related.
I've a specific doubt regarding the registry parameters LinkUnit and LinkVal.
When I execute HUPAST, I receive error on the values entered on these fields.
I'm trying to connect to PcScale from Filizola. If someone has already done this configurations, please let me know...
Tks in advance.
FlavioThanks, but I've already seen this thread and done the steps described on it.
Actually, my question is very specific... How to populate the fields LinkVal and LinkUnit of the registry...
I read all the threads here in SDN and they don't answer my question...
I'd be glad if someone had already done tcode HUPAST works for Filizola...
Tks again. -
Problem reading image from input Stream
I'm having a problem reading an image through an input stream. It gives me the error
Premature end of JPEG file
sun.awt.image.ImageFormatException: JPEG datastream contains no imageand my code looks like
public Image getImage(String name, String command){
if(command.equals(pCode)){
Image image=null;
System.out.println(name);
InputStream is = getClass().getResourceAsStream(name);
BufferedInputStream bis = new BufferedInputStream(is);
byte[] byBuf =new byte[10000];
try {
int byteRead = bis.read(byBuf,0,10000);
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
image = Toolkit.getDefaultToolkit().createImage(byBuf);
return image;
return null;
}And the string name looks when printed is: usr/images/PRLogo.jpgIf the image is bigger than 10K, this code will break.
You can pass an InputStream to javax.imageio.ImageIO.read. That's probably an easier option than trying to do the buffering yourself. -
Sync problem w/ DVD from Final Cut Pro X
My project is a 2-hour play. I improved the audio in ProTools then dragged it back into FCP. I was able to get the improved audio to sync perfectly with the video (both are 48K), then mute the original audio. I checked the whole 2-hour play for sync. I burned a DVD, played it on my DVD player, and the audio gets ahead of the video around the 30 minute mark and keeps drifting. Several DVD burns yield the same problem. Any advice?
Thanks Russ. OK, I am now rendering again via Compressor 4, this time I have 2 files in one tab - 1) a MPEG-2 and 2) an AC3 file. Seems to make sense.
To burn the DVD immediately after, I added a 'Job Action' to 'Create DVD' after the render, and the dialog confuses me. No problems with the 'Job Action' tab, but the "A/V Attributes" tab indicates the follwing:
Type: Final Cut Pro.app (shouldn't this be a reference to the rendered file/s?)
Video - showing the same dimensions of my FCPx Project file (NTSC ..640 x 480) instead of the MPEG-2 (Pal ...720 x 576).
Audio - Properties show Linear PCM... 6 channels, etc... not the AC3 file.
My question is, how do I create a DVD from the newly rendered files output from Compressor - is the Job Action the way to do it, and if so, how do I get it to reference the new files?
Thanks,
Geoff -
Problem reading data from textField?
I have a problem in my program I'm currently doing.
I have a textArea and a textField in a container.
Inside the textArea will be displayed some questions which require user to give answers to in the textField.
When user types something in the textField and presses enter, an actionListener will trigger and take in String.
My problem is how do you wait for the user to type something in the textField?
thanksHi
I am trying to read a value from a textField object in the following code, but its returning an empty string. any kind of help would be appreciated. thanks.
bhavesh
import java.awt.*;
import java.awt.event.*;
import java.applet.*;
import java.io.*;
import java.lang.*;
public class Applet1 extends Applet implements ActionListener, TextListener{
String text = "";
Image logo;
static TextField usr;
static TextField pswd;
static Button logOn;
public boolean authenticate(Graphics g){
g.setColor(Color.RED);
g.setFont(new Font("Monospaced", Font.PLAIN, 20));
text = "Username:";
g.drawString(text, 300, 300);
text = "Password:";
g.drawString(text, 300, 325);
g.setFont(new Font("Serif", Font.PLAIN, 20));
usr = new TextField(40);
usr.setBounds(420,280, 200,20);
usr.setEditable(true);
//usr.addActionListener(this);
add(usr);
//add (new Label("Enter number:"));
pswd = new TextField(40);
pswd.setEditable(true);
pswd.setBounds(420,310, 200,20);
//pswd.addActionListener(this);
add(pswd);
//add (new Label("Enter number:"));
logOn = new Button("Log on ...");
logOn.setBounds(380,340,80,20);
logOn.addActionListener(this);
add(logOn);
return true;
public void actionPerformed(ActionEvent ae){
System.out.print(usr.getText()+"rr\n"+ae);
System.out.print(pswd.getText()+"bb\n");
if ( usr.getText().compareTo("gusr")==0 && pswd.getText().compareTo("gpswd")==0 ){
System.out.print("COOOOOOL");
else{
System.out.print("BAD");
public void textValueChanged(TextEvent te){
String foo = usr.getText();
System.out.print("\n\nevent please\n\n"+foo+" +"+usr.getSelectedText());
public void paint(Graphics g) {
logo = getImage(getCodeBase(),"logo2.gif");
g.setColor(Color.WHITE);
g.fillRect(0,0,1000,625);
g.drawImage(logo, 0, 0, this);
g.setFont(new Font("SansSerif", Font.ITALIC, 20));
g.setColor(Color.BLUE);
text = "Welcome to AMPD Timecard!";
g.drawString(text, 300, 255);
authenticate(g); -
Problem reading data from nested internal table.
Hi,
Below is my code;
*********SAP Code********
TYPES: BEGIN OF v54a0_scdd,
fknum LIKE vfkk-fknum,
change LIKE vfkkd-updkz,
x TYPE v54a0_scd,
y TYPE v54a0_scd,
tvtf LIKE tvtf,
END OF v54a0_scdd.
SCD table for dialog
TYPES: v54a0_scdd_tab TYPE v54a0_scdd OCCURS 1.
*********SAP Code********
*Custom declaration*****
data: wa_freight_costs type v54a0_scdd_tab.
data: it_freight_costs type v54a0_scdd_tab occurs 0.
*****Here data is getting appended to it_freight_costs. P_frieght_costs is coming from standard program.
move p_freight_costs TO wa_FREIGHT_COSTS.
append wa_freight_costs to it_freight_costs.
clear wa_freight_costs.
***Now the problem is here. I am not able to read the data from the nested internal table x-item.
if i use <fs_f_costs> to move data from it_freight_costs in the outer loop, i get a syntax error; <i> "the line type of the table it_freight_costs is not compatible with field symbol type <fs_f_costs>" </i>
FIELD-SYMBOLS: <fs_f_costs> type line of v54a0_scdd_tab.
LOOP AT it_freight_costs assigning <fs_f_costs>.
LOOP AT <fs_f_costs>-x-item ASSIGNING <fs_freight_item>.
<b> I want to read <fs_freight_item>-vfkp-netwr.</b>
ENDLOOP.
Can anyone guide me?A quick look at how I would do this. Note I haven't checked if this compiles just done a quick brain-dump.
DATA: lr_f_costs TYPE REF TO v54a0_scdd_tab,
lr_f_cost TYPE REF TO v54a0_scdd.
LOOP AT it_freight_costs REFERENCE INTO lr_f_costs.
LOOP AT lr_f_costs->* REFERENCE INTO lr_f_cost.
ENDLOOP.
ENDLOOP.
As you can see I personally prefer pointers to field symbols - I don't believe there is any performance differences and because of my background in other languages pointers make more sense to me.
Cheers
Graham Robbo -
I have been using FF for several years and well as front page to maintain and upload to my site. As of two days ago I started getting comments that recently updated pages were not readible. I have not changed any settings but have found out that what can not be read in Fire fox can be read just fine in IE
Can you post a link to a public page that doesn't require authentication (log in) to access it?
Clear the cache and the cookies from sites that cause problems.
"Clear the Cache":
*Tools > Options > Advanced > Network > Offline Storage (Cache): "Clear Now"
"Remove Cookies" from sites causing problems:
*Tools > Options > Privacy > Cookies: "Show Cookies"
See also:
*https://support.mozilla.org/kb/Websites+look+wrong
If you use extensions (Tools > Add-ons > Extensions) like <i>Adblock Plus</i> or <i>NoScript</i> or <i>Flash Block</i> that can block content then make sure that such extensions aren't blocking content.
*https://support.mozilla.org/kb/Troubleshooting+extensions+and+themes -
Problem Reading Data from .dat File
I am trying to read in data from lines 384-475. The data looks something like this
198 95 70 71 93-99-99-99-99-99-99-99-99-99-99 5 17 17 17 17-99-99-99-99-99-99-99-99-99-99 1
78 95 70 69-99-99-99-99-99-99-99-99-99-99-99 6 2 1 1-99-99-99-99-99-99-99-99-99-99-99 2
70 73-99-99-99-99-99-99-99-99-99-99-99-99-99 0 1-99-99-99-99-99-99-99-99-99-99-99-99-99 1This is only the data from lines 384-475. I keep getting an error though, and I can't figure it out.
import java.util.*;
import java.io.*;
public class ProgrammingExercise1
public static double findAccuracy(String systemCommand) throws IOException
Process proc = Runtime.getRuntime().exec(systemCommand);
Scanner scan = new Scanner(proc.getInputStream());
PrintStream logOut = new PrintStream(new FileOutputStream("log.dat"));
while(scan.hasNextLine())
logOut.println(scan.nextLine());
logOut.close();
scan.close();
proc.destroy();
Scanner input = new Scanner(new File("log.dat"));
String line = "";
for(int c=1; c<=4; c++)
line = input.nextLine();
double finalAccuracy = Double.parseDouble(line.substring(22,27));
input.close();
return finalAccuracy;
public static void main (String[] args) throws IOException
try {
String s;
int count=0;
String temp;
int aInt;
int med;
int[] daM = new int[251];
String[] pos = new String[251];
int[][] da = new int[251][507];
int[] daSort = new int[da.length];
for (int i=0; i<251; i++)
daM[i] = 0;
for (int j=0; j<507; j++)
da[i][j] = 0;
//creating an input stream
FileInputStream fstream = new FileInputStream("dataset.dat");
DataInputStream in = new DataInputStream(fstream);
BufferedReader br = new BufferedReader(new InputStreamReader(in));
while((s = br.readLine()) != null)
//safety check as the last line in not null, but empty
//break the procedure info from the string/line
String sub = s.substring(384, 475);
for (int k=0; k<15; k++)
temp = sub.substring(k*3, (k*3)+3);
//removes spaces from the string to alleviate integer conversion errors
temp = temp.replace(" ", "");
aInt = Integer.parseInt(temp);
if (aInt > -1)
da[count][aInt] = 1;
sub = s.substring(260, 264);
temp = sub.replace(" ", "");
aInt = Integer.parseInt(temp);
if (aInt > -1)
daSort[count] = aInt;
daM[count] = aInt;
count++;
in.close();
bubbleSort(daSort);
med = daSort[daSort.length/2];
for (int t=0; t<daM.length; t++)
if (daM[t]<med)
pos[t] = "+1";
else
pos[t] = "-1";
for (int r=0; r<da[t].length; r++)
if (da[t][r]==1)
pos[t] +=" " + r + ":1.0";
Collections.shuffle(Arrays.asList(pos));
File file = new File("testSet.dat");
PrintWriter output = new PrintWriter(new FileWriter(file));
String tempOut = "";
for (int ii=0; ii<pos.length/4; ii++)
tempOut += pos[ii];
output.write(tempOut);
tempOut = "";
output.write("\n");
output.close();
file = new File("crossValidationSet.dat");
output = new PrintWriter(new FileWriter(file));
for (int jj=(pos.length/4); jj<pos.length/2; jj++)
tempOut += pos[jj];
output.write(tempOut);
tempOut = "";
output.write("\n");
output.close();
file = new File("trainingSet.dat");
output = new PrintWriter(new FileWriter(file));
for (int kk=(pos.length/2); kk<pos.length; kk++)
tempOut += pos[kk];
output.write(tempOut);
tempOut = "";
output.write("\n");
output.close();
System.out.println("Your file has been written");
catch (Exception e)
System.err.println("Error: " + e.getMessage());
} // end ProgrammingExercise1The main error I can't figure out is as follows... "Error: For input string: "93-"
*Note: I had to remove some of the code due to exceeding the maximum characters allowed. I THINK the error is found at the //creating an input stream section.The input data that I included is the exact data I am trying to read...just three lines instead of the 251. There is plenty of other data surrounding the included data, but I am not concerned with it.
Here is the first 3 lines of data...
4200410577816 76-99 9 177 1 1 0 5.573125262 5 429429422MED0262 25080403915990 427322851 5789 250402859 2111 50 99 159 106 60 153 50 59 47-999-999-999-999-999-999 -999-999-999-999 0 1 4025AZ 14 141010 5868 2817 9 0 04223 3 105 -9 2451644434443 70 93 93-99-99-99-99-99-99-99-99-99-99-99-99 3-99-99-99-99-99-99-99-99-99-99-99-99-99-99 3 40667 40667.002004 1
4200410581753 79-9911 177 1 1 0 5.5731252 3 5 429429422MED0262 250822851 4271 486 5789 785595990 41400V4581 50 60 106 122 153 249 159 101 101-999-999-999-999-999-999 -999-999-999-999 0 1 4025AZ 8 81010 2043 883 9 0 04223 2 105 -9 245134824 70 77-99-99-99-99-99-99-99-99-99-99-99-99-99 4-99-99-99-99-99-99-99-99-99-99-99-99-99-99 3 25444 25444.002004 1
4200410277559 67-99 3 177 1 0 0 5.5731252 3 5 229229221MED0236 25080707146827 4280 7318 73027041042506045981 50 199 197 108 212 201 3 50 121-999-999-999-999-999-999 -999-999-999-999 0 0 4047AZ 29 291010 2414 5409 9 0 04223 6 111 -9 1392745164542884288483950 57 70 95189190 61-99-99-99-99-99-99-99-99-99 18-99-99-99-99-99-99-99-99-99-99-99-99-99-99 1 141927 141927.002004 4
import java.util.*;
import java.io.*;
public class ProgrammingExercise1 {
public static void bubbleSort(int[] x)
int n = x.length;
for (int pass=1; pass < n; pass++)
for (int i=0; i < n-pass; i++)
if (x[i] > x[i+1])
int temp = x;
x[i] = x[i+1];
x[i+1] = temp;
}// end bubbleSort
public static void main (String[] args) throws IOException
try {
String s;
int count=0;
String temp;
int aInt;
int med;
int[] daM = new int[251];
String[] pos = new String[251];
int[][] da = new int[251][507];
int[] daSort = new int[da.length];
for (int i=0; i<251; i++)
daM[i] = 0;
for (int j=0; j<507; j++)
da[i][j] = 0;
FileInputStream fstream = new FileInputStream("dataset.dat");
DataInputStream in = new DataInputStream(fstream);
BufferedReader br = new BufferedReader(new InputStreamReader(in));
while((s = br.readLine()) != null)
String sub = s.substring(384, 475); //!!! Is this supposed to be (384, 475) or (384, 428)???
for (int k=0; k<15; k++)
temp = sub.substring(k*3, (k*3)+3);
temp = temp.replace(" ", "");
aInt = Integer.parseInt(temp);
if (aInt > -1)
da[count][aInt] = 1;
sub = s.substring(260, 264);
temp = sub.replace(" ", "");
aInt = Integer.parseInt(temp);
if (aInt > -1)
daSort[count] = aInt;
daM[count] = aInt;
count++;
in.close();
bubbleSort(daSort);
med = daSort[daSort.length/2];
for (int t=0; t<daM.length; t++)
if (daM[t]<med)
pos[t] = "+1";
else
pos[t] = "-1";
for (int r=0; r<da[t].length; r++)
if (da[t][r]==1)
pos[t] +=" " + r + ":1.0";
Collections.shuffle(Arrays.asList(pos));
File file = new File("testSet.dat");
PrintWriter output = new PrintWriter(new FileWriter(file));
String tempOut = "";
for (int ii=0; ii<pos.length/4; ii++)
tempOut += pos[ii];
output.write(tempOut);
tempOut = "";
output.write("\n");
output.close();
file = new File("crossValidationSet.dat");
output = new PrintWriter(new FileWriter(file));
for (int jj=(pos.length/4); jj<pos.length/2; jj++)
tempOut += pos[jj];
output.write(tempOut);
tempOut = "";
output.write("\n");
output.close();
file = new File("trainingSet.dat");
output = new PrintWriter(new FileWriter(file));
for (int kk=(pos.length/2); kk<pos.length; kk++)
tempOut += pos[kk];
output.write(tempOut);
tempOut = "";
output.write("\n");
output.close();
System.out.println("Your file has been written");
catch (Exception e)
e.printStackTrace();
Edited by: djcochran on Jan 27, 2010 5:22 PM -
Problem reading data from database
Hi All,
I'm doing some test with Oracle Coherence, particulary testing partitioned cache of a database. I'm using a client/server archictecture and I developed my own CacheStore. So, the problem is, after start the server and the client, when i do a get() in the client for a object that is on database and not in the cache, the cache answer is it doesn't exist. Isn't it supposed the cache "call" the cache store and read/verify if it is on database?
My Configuration file:
<?xml version="1.0"?>
<!DOCTYPE cache-config SYSTEM "cache-config.dtd">
<cache-config>
<caching-scheme-mapping>
<cache-mapping>
<cache-name>Recharge</cache-name>
<scheme-name>partitioned-cache</scheme-name>
</cache-mapping>
</caching-scheme-mapping>
<caching-schemes>
<distributed-scheme>
<scheme-name>partitioned-cache</scheme-name>
<backing-map-scheme>
<read-write-backing-map-scheme>
<write-delay>0</write-delay>
<read-only>false</read-only>
<internal-cache-scheme>
<local-scheme>
<scheme-name>InMemoryScheme</scheme-name>
</local-scheme>
</internal-cache-scheme>
<cachestore-scheme>
<class-scheme>
<class-name>RechargeCacheStore</class-name>
</class-scheme>
</cachestore-scheme>
</read-write-backing-map-scheme>
</backing-map-scheme>
<listener/>
<autostart>true</autostart>
</distributed-scheme>
</caching-schemes>
</cache-config>
Tanks,
Paulo SousaHi Paolo,
You should use a fully qualified class name to enable the JVM class loader to find the RechargeCacheStore class.
Regards,
Harv
Maybe you are looking for
-
Requisition Change History - not showing all records from CDHDR/CDPOS
Hello, When viewing the Item Changes for a requisition in ME53N, I don't always see all the records that are contained in tables CDHDR / CDPOS. The missing records are related to release strategies. Does anyone have any ideas why this happens? Thank
-
Why does my 3rd generation iPod touch freeze and crash randomly?
My sister has a used 3rd Gen iPod touch. It looks fine, not much physical damage beyond normal wear. But it will continuly randomly freeze and crash. It will shut off and we have to turn it back on, only to have it crash again. The frequency of this
-
Powerpoint in maximized window, when de machine is starting up from batch
Hello, I want to start a .pps presentation with Powerpoint Viewer in a maximized window, after the machine is powered-up. The slide show is saved with kiosk settings as a .pps (slideshow). I put a shortcut with screen maximized on in the STARTUP dire
-
Assassin's Creed and Boot Camp bricked my iMac!
Okay, so it is not quite bricked, but it is very close, and I am at a loss. For the first time I have exhausted my knowledge and a series of Google searches and have come up short. Hopefully one of you guys can help. Sorry about how long this is, but
-
Large file size and slow pagination when form filled out in Reader 7
Hi all, I have designed a form with Livecycle Designer 8. For compatibility, I have made it an Acrobat 7 (Dynamic) XML Form. The form itself is 18 pages long and when filled in with Reader 8, pagination is quick and the file size only jumps about 100