Null values coming from JSON
Ok. heres whats going on. I have a bunch of charts all with
two series , demand and baseline. About half of them have a null
value for the last value in demand and of the half 2 have null for
the entire baseline.
my problem is one of the afore mentioned 2 charts will not
show up (chart shows but without lines) unless I iterate through
and set all null values to zero in the baseline series. Then
baseline will lie on the x axis(BAD) and demand will show
correctly(missing the last value because it null, GOOD)
my question is why? why does demand disappear when baseline
values are null? here is some code to maybe help you out
quote:
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="
http://www.adobe.com/2006/mxml"
xmlns:myComp="*"
layout="vertical" viewSourceURL="srcview/index.html"
preinitialize="srv.send();" uid="theApp">
<mx:Script>
<![CDATA[
import mx.charts.series.LineSeries;
import mx.charts.chartClasses.Series;
import mx.charts.AxisRenderer;
import mx.charts.CategoryAxis;
import mx.controls.HorizontalList;
import mx.containers.Panel;
import mx.collections.ArrayCollection;
import mx.rpc.events.ResultEvent;
import com.adobe.serialization.json.JSON;
import mx.controls.Alert;
import mx.utils.ObjectUtil;
[Bindable]private var ercotDem:Array = new Array();
[Bindable]private var ercotBase:Array = new Array();
[Bindable]private var times:Array = new Array();
private function onJSONLoad(event:ResultEvent):void{
try{
// ---- i know this json stuff works.
// ---- i have printed out the data and cheaked
// ---- to make sure its goign into the array correctly
// ---- and i use it all over the place in other files
var rawData:String = String(event.result);
var jsonOBJ:Object = (JSON.decode(rawData) );
ercotDem = jsonOBJ.ERCOT.demand as Array;
ercotBase = jsonOBJ.ERCOT.baseline as Array;
times = jsonOBJ.times as Array;
} catch(err:Error){
Alert.show(err.message);
private function popup():void{
Alert.show("Fail!!");
]]>
</mx:Script>
<!-- other charts here too -->
<mx:Panel title="Ercot Demand" height="300" width="600"
layout="horizontal">
<mx:LineChart id="linechart_ercot" height="100%"
width="100%"
showDataTips="true" dataProvider="{times}"
mouseSensitivity="50">
<mx:horizontalAxis>
<mx:CategoryAxis />
</mx:horizontalAxis>
<mx:horizontalAxisRenderer>
<mx:AxisRenderer canDropLabels="true" canStagger="true"
/>
</mx:horizontalAxisRenderer>
<mx:series>
<mx:LineSeries displayName="Ercot Baseline"
dataProvider="{ercotBase}" />
<mx:LineSeries displayName=" Ercot"
dataProvider="{ercotDem}" />
</mx:series>
</mx:LineChart>
</mx:Panel>
<mx:HTTPService id="srv" resultFormat="text"
showBusyCursor="true"
url="--myserver--"
result="onJSONLoad(event)" fault="popup()" />
</mx:Application>
keep in mind this is only one panel theres about 9 and all of
them work as expected and the code is all the same.
any ideas?
no one has any ideas?
Similar Messages
-
How to retrieve null-valued attributes from a LDAP server?
(I posted this in the ES board but then thought this is more of a programmer's question, sorry for the duplication).
I am using JNDI api to do search operations on a Java Directory Server( part of SunOne).
However, I found all the attributes that do not have values are automatically filtered out from the search result.
NamingEnumeration answer = ctx.search(ctxName, filterExpr, cons);
while(answer.hasMore()){
SearchResult sr = (SearchResult)answer.next();
Attributes attrs = sr.getAttributes();
for(NamingEnumeration ne = attrs.getIDs();ne.hasMore();){
System.out.println("ids:"+ne.next());
System.out.println("-------------------------------------------------------");
for (NamingEnumeration ae = sr.getAttributes().getAll(); ae.hasMore();) {
Attribute attr = (Attribute)ae.next();
System.out.println("attrName:"+attr.getID());
//System.out.println("attribute: " + attr.getID());
NamingEnumeration e = attr.getAll();
while(e.hasMore()){
System.out.println(" attrVal:"+e.next());
}Is there anything I did wrong here?
Here are a couple of things I noticed,
1. in a Softerra LDAP browser, those no-valued attributes are not present either. But in JXplorer, I can see the full list that includes the attributes that do not have a value.
2. I had Schema disabled in the server console.
Thank you in advance.There are only two ways to read data from Directory Server:
1. a. just fetch the entry
b. display the content
2. a. fetch the entry
b. parse the entry and figure what object classes it is of
c. lookup each object class definition in the schema and retrieve the attribute list
d. combine the attributes of the entry with all the "possible" attributes of its object classe(s)
e. display the content
Here's for an easy example we can relate to:
I have the following entry in my DS
cn=the_duuuuuude,dc=forum,dc=sun,dc=com
objectClass: person
cn: the_duuuuuude
sn: arnaudIf you use method 1, you will get just what is stored in the db. That is:
cn=the_duuuuuude,dc=forum,dc=sun,dc=com
objectClass: person
cn: the_duuuuuude
sn: arnaudif you use method 2, you will get:
cn=the_duuuuuude,dc=forum,dc=sun,dc=com
objectClass: person
cn: the_duuuuuude
sn: arnaud
description:
seeAlso:
telephoneNumber:
userPassword:because when you looked up the 'person' object class you got this:
objectClasses: ( 2.5.6.6 NAME 'person' DESC 'Standard LDAP objectclass' SUP top MUST ( sn $ cn ) MAY ( description $ seeAlso $ telephoneNumber $ userPassword ) X-ORIGIN 'RFC 2256' )Now the important thing to note is that physically in the database, the attributes description, seeAlso, telephoneNumber and userPassword are NOT stored. It's not that they have a 'null' value. They're just not there. It doesn't stop you from looking up the schema.
Optimally, in your client, you would fetch the whole server schema and cache it so you have to do the extra round trip for every entry you process.
The difference you observe with various LDAP browsers might simply be that one uses method 1 and the other method 2.
Hope this helps wrap your mind around this.
-=arnaud=- -
How to retrieve null-valued attributes from LDAP server.
I am using JNDI api to do search operations on a Java Directory Server( part of SunOne).
However, I found all the attributes that do not have values are automatically filtered out from the search result.
NamingEnumeration answer = ctx.search(ctxName, filterExpr, cons);
while(answer.hasMore()){
SearchResult sr = (SearchResult)answer.next();
Attributes attrs = sr.getAttributes();
for(NamingEnumeration ne = attrs.getIDs();ne.hasMore();){
System.out.println("ids:"+ne.next());
System.out.println("-------------------------------------------------------");
for (NamingEnumeration ae = sr.getAttributes().getAll(); ae.hasMore();) {
Attribute attr = (Attribute)ae.next();
System.out.println("attrName:"+attr.getID());
//System.out.println("attribute: " + attr.getID());
NamingEnumeration e = attr.getAll();
while(e.hasMore()){
System.out.println(" attrVal:"+e.next());
}Is there anything I did wrong here?
Here are a couple of things I noticed,
1. in a Softerra LDAP browser, those no-valued attributes are not present either. But in JXplorer, I can see the full list that includes the attributes that do not have a value.
2. I had Schema disabled in the server console.
Thank you in advance.There are only two ways to read data from Directory Server:
1. a. just fetch the entry
b. display the content
2. a. fetch the entry
b. parse the entry and figure what object classes it is of
c. lookup each object class definition in the schema and retrieve the attribute list
d. combine the attributes of the entry with all the "possible" attributes of its object classe(s)
e. display the content
Here's for an easy example we can relate to:
I have the following entry in my DS
cn=the_duuuuuude,dc=forum,dc=sun,dc=com
objectClass: person
cn: the_duuuuuude
sn: arnaudIf you use method 1, you will get just what is stored in the db. That is:
cn=the_duuuuuude,dc=forum,dc=sun,dc=com
objectClass: person
cn: the_duuuuuude
sn: arnaudif you use method 2, you will get:
cn=the_duuuuuude,dc=forum,dc=sun,dc=com
objectClass: person
cn: the_duuuuuude
sn: arnaud
description:
seeAlso:
telephoneNumber:
userPassword:because when you looked up the 'person' object class you got this:
objectClasses: ( 2.5.6.6 NAME 'person' DESC 'Standard LDAP objectclass' SUP top MUST ( sn $ cn ) MAY ( description $ seeAlso $ telephoneNumber $ userPassword ) X-ORIGIN 'RFC 2256' )Now the important thing to note is that physically in the database, the attributes description, seeAlso, telephoneNumber and userPassword are NOT stored. It's not that they have a 'null' value. They're just not there. It doesn't stop you from looking up the schema.
Optimally, in your client, you would fetch the whole server schema and cache it so you have to do the extra round trip for every entry you process.
The difference you observe with various LDAP browsers might simply be that one uses method 1 and the other method 2.
Hope this helps wrap your mind around this.
-=arnaud=- -
Hide one value coming from DB in LOVs on ADF pages.
Hi,
We need to hide one value from user from List of values.
We are populating the List of values from DB through Web service data control.
We have
L1
L2
L3
L4
L5 in the list of values
But we dont want to see L5 in the list of values on the screen.
Now the drop down should look like below
L1
L2
L3
L4
Thanks in Adv...is it always the last value that you need to remove ?
once i tried to remove the first empty string value in my selectOneChoice component that bind to an ADF DataControl.
function init(){
if (document.forms[0].soc11.options[0].value=='') {
document.forms[0].soc11.options[0] = null;
document.forms[0].soc11.value = document.forms[0].soc11.options[0].value;
//put below code before your form tag
<af:clientListener method="init" type="load"/>or you can remove the data from your VO query by limit it or put it in the WHERE clause -
Change an Object property based on a value coming from the Excel sheet
hi all
i've been able to bind a value from the excel sheet to my my component
but i want to change a property of an object in my component based on this value at the run time.
during the design time, it works fine
for example, if my value called "_xvisible"
and i use to it to hide some object.
if i set _xvisible during the design time in excel, it works fine in the run mode.
but during the run mode, if the value got changed, there is no affect.
thank you
AmrHi
See the xcelsius samples present inside xcelsius SDK. there are examples describing how to bind data which will work at runtime also.
Hope this helps
Rush-me -
Value coming from query is chaing in the Table view
Hi experts,
I am new to VC and developing a basic model by using a BI query as a data service.
I have a field "Project Code" which can return value numeric or alpha numeric or Character.
for example
Project Code= 14000000000000002782007 or
ATROVASTATIN
When i am right clicking the query and doing the test query function its displaying correctly but when i am draging from the output port of this query and using a Table view to display the data the numeric values like in our example "14000000000000002782007" is displaying as 1.4e+23 its displaying the same value where ever i have some numeric value in the field.
But its displaying the Char value right "ATROVASTATIN" as it is.
In the table view the field which is getting this value is with Datatype Text.
How can i solve this problem.
Thanks and regards
NeelHi Neel,
Have a look at this link,
https://www.sdn.sap.com/irj/sdn/wiki?path=/display/vc/sizeof_key+values& -
Not all selection screen value coming from selection screen only first val
hi i am doing
SELECTION-SCREEN BEGIN OF BLOCK gl_ac3 WITH FRAME TITLE text-019.
SELECT-OPTIONS: gl_acdp1 FOR gv_gldep1.
SELECTION-SCREEN END OF BLOCK gl_ac3.
then i am using seelct as below
SELECT robukrs
rzzhkont
FROM zzamd1t INTO TABLE it_amdt
WHERE ryear = p_gjahr
AND robukrs IN so_bukrs
AND rzzhkont IN gl_acdp1.
but the value selected by select statement from internal table is for only first value of gl_acdp1 ie for first account c1 but user is entereng three acts c1 c2 and c3 so fro all data should be selected but for only one it is being selected
pls sugestHi,
Is gv_gldep1 & rzzhkontare of same data type.
Do as below
SELECTION-SCREEN BEGIN OF BLOCK gl_ac3 WITH FRAME TITLE text-019.
SELECT-OPTIONS: gl_acdp1 FOR gv_gldep1.
SELECTION-SCREEN END OF BLOCK gl_ac3.
INITILIZATION.
MOVE 'I' TO gl_acdp1-sign,
'EQ' TO gl_acdp1-option,
'C1' TO gl_acdp1-low,
APPEND gl_acdp1.
MOVE 'I' TO gl_acdp1-sign,
'EQ' TO gl_acdp1-option,
'C2' TO gl_acdp1-low,
APPEND gl_acdp1.
MOVE 'I' TO gl_acdp1-sign,
'EQ' TO gl_acdp1-option,
'C3' TO gl_acdp1-low,
APPEND gl_acdp1.
START-OF-SELECTION.
SELECT robukrs
rzzhkont
FROM zzamd1t INTO TABLE it_amdt
WHERE ryear = p_gjahr
AND robukrs IN so_bukrs
AND rzzhkont IN gl_acdp1.
Make sure that ur table zzamd1t has values for C1, C2 and C3.
Tell us how is ur output with this code.
Regards,
Bala Krishna
Edited by: Bala Krishna on Aug 11, 2008 9:11 PM -
How to pass value coming from a program to a transaction
hi gurus,
In my requirement i will get a value from a program and i need to send this value to a field present in a transaction.
can any one help me in this matter.First got to the data element of the field to which you want to pass the value to and check the Parameter ID in the Further Characterstics tab
For Example it is XYZ
Then
In BADI
Set Parameter ID 'XYZ' Field P_FIELD_VALUE.
Call Transaction 'ABCD'.
santhosh -
GR unit value coming from the Invoice
I have the following situation:
PO 100 units price 3,14 u20AC/unit
IR: 1 unit at a price of 314 u20AC/unit
GR: Post GR for 100 units and the system is generating the accounting doc. for a value of 624,86 u20AC, that comes from
- 1 unit at the price of the Invoice 314 = 314 u20AC
- 99 units at the price of the PO 3,14 u20AC/unit = 310,86 u20AC
The total GR amount is bigger that the PO amount.
Is this the standard SAP behavior?
Is there a way to get only the price from the PO, not from the Invoice
Best regardsYes this is standard SAP design. This situation will raise if you post Invoice before doing GR. also depends on price control in material master.
To fetch the price from PO u must follow GR followed by posting an Invoice.
Edited by: Sachin D C on Nov 10, 2010 3:47 PM
Edited by: Sachin D C on Nov 10, 2010 3:48 PM -
Delete Null value records from 0BPARTNER
Hi Experts,
For 0BPARTNER info object we have 40 attributes. My requirement to delete the 0BPARTNER records which have all the attributes are NULL. I tried to delete the NULL records from master data maintenance, but those records already loaded to upstream targets.
Can anyone please suggest me any other solution to delete the NULL records from 0BPARTNER master data.
Thanks in advance,
Sai Chand.Shi
try this
/BI0/PBPARTNER is the transparent table name for the 0BPARTNER.
steps
1.Go to SE14 t-code
2.Enter Table Name /BI0/PBPARTNER
3.Click on the Radio Button - Delete Data
delete the data S , P-Tables in the database -
How to remove gaps/null values from set of columns in a row
Im trying to implement a solution for removing null value columns from a row.
Basically in below example i have five codes and corresponding id's for that codes.What im trying to achive here is if
i have a null code then i have to move next not null code and id into its new location.
Example:
'A1'cd1,'A2'cd2,null cd3,'A4'cd4,null cd5,'i1'id1,'i2'id2,null id3,'i4' id4,null id5 So here cd4 and id4 should take positions of cd3 and id3.
Output should look like this
cd1 cd2 cd3 cd4 cd5 id1 id2 id3 id4 id5
A1 A2 A4 i1 i2 i4Any help would be highly appreciated for below example:
with temp_table as
(select 'A1'cd1,'A2'cd2,null cd3,'A4'cd4,null cd5,'i1'id1,'i2'id2,null id3,'i4' id4,null id5 from dual union all
select 'A11',null,null,'A44','A55','id11',null,null, 'id44','id55' from dual union all
select null,'A111',null,null,'A555',null,'id111',null, null,'id555' from dual union all
select 'A',null,null,'A1111','E55','id11',null,null, 'id111','id1111' from dual )
select * from temp_table;Edited by: GVR on Dec 1, 2010 8:27 AMI like case expression B-)
The same question of my homepage http://www.geocities.jp/oraclesqlpuzzle/7-81.html
with temp_table(cd1,cd2,cd3,cd4,cd5,id1,id2,id3,id4,id5) as(
select 'A1' ,'A2' ,null,'A4' ,null ,'i1' ,'i2' ,null,'i4' ,null from dual union all
select 'A11',null ,null,'A44' ,'A55' ,'id11',null ,null,'id44' ,'id55' from dual union all
select null,'A111',null,null ,'A555',null ,'id111',null,null ,'id555' from dual union all
select 'A' ,null ,null,'A1111','E55' ,'id11',null ,null,'id111','id1111' from dual)
select
case when SumCD1 = 1 then CD1
when SumCD1+SumCD2 = 1 then CD2
when SumCD1+SumCD2+SumCD3 = 1 then CD3
when SumCD1+SumCD2+SumCD3+SumCD4 = 1 then CD4
when SumCD1+SumCD2+SumCD3+SumCD4+SumCD5 = 1 then CD5 end as CD1,
case when SumCD1+SumCD2 = 2 then CD2
when SumCD1+SumCD2+SumCD3 = 2 then CD3
when SumCD1+SumCD2+SumCD3+SumCD4 = 2 then CD4
when SumCD1+SumCD2+SumCD3+SumCD4+SumCD5 = 2 then CD5 end as CD2,
case when SumCD1+SumCD2+SumCD3 = 3 then CD3
when SumCD1+SumCD2+SumCD3+SumCD4 = 3 then CD4
when SumCD1+SumCD2+SumCD3+SumCD4+SumCD5 = 3 then CD5 end as CD3,
case when SumCD1+SumCD2+SumCD3+SumCD4 = 4 then CD4
when SumCD1+SumCD2+SumCD3+SumCD4+SumCD5 = 4 then CD5 end as CD4,
case when SumCD1+SumCD2+SumCD3+SumCD4+SumCD5 = 5 then CD5 end as CD5,
case when SumID1 = 1 then ID1
when SumID1+SumID2 = 1 then ID2
when SumID1+SumID2+SumID3 = 1 then ID3
when SumID1+SumID2+SumID3+SumID4 = 1 then ID4
when SumID1+SumID2+SumID3+SumID4+SumID5 = 1 then ID5 end as ID1,
case when SumID1+SumID2 = 2 then ID2
when SumID1+SumID2+SumID3 = 2 then ID3
when SumID1+SumID2+SumID3+SumID4 = 2 then ID4
when SumID1+SumID2+SumID3+SumID4+SumID5 = 2 then ID5 end as ID2,
case when SumID1+SumID2+SumID3 = 3 then ID3
when SumID1+SumID2+SumID3+SumID4 = 3 then ID4
when SumID1+SumID2+SumID3+SumID4+SumID5 = 3 then ID5 end as ID3,
case when SumID1+SumID2+SumID3+SumID4 = 4 then ID4
when SumID1+SumID2+SumID3+SumID4+SumID5 = 4 then ID5 end as ID4,
case when SumID1+SumID2+SumID3+SumID4+SumID5 = 5 then ID5 end as ID5
from (select cd1,cd2,cd3,cd4,cd5,id1,id2,id3,id4,id5,
nvl2(cd1,1,0) as SumCD1,
nvl2(cd2,1,0) as SumCD2,
nvl2(cd3,1,0) as SumCD3,
nvl2(cd4,1,0) as SumCD4,
nvl2(cd5,1,0) as SumCD5,
nvl2(id1,1,0) as SumID1,
nvl2(id2,1,0) as SumID2,
nvl2(id3,1,0) as SumID3,
nvl2(id4,1,0) as SumID4,
nvl2(id5,1,0) as SumID5
from temp_table)
order by cd1,cd2,cd3,cd4,cd5;
CD1 CD2 CD3 CD4 CD5 ID1 ID2 ID3 ID4 ID5
A A1111 E55 null null id11 id111 id1111 null null
A1 A2 A4 null null i1 i2 i4 null null
A11 A44 A55 null null id11 id44 id55 null null
A111 A555 null null null id111 id555 null null nullMy SQL articles of OTN-Japan
http://www.oracle.com/technology/global/jp/pub/jp/ace/sql_image/1/otnj-sql-image1.html
http://www.oracle.com/technology/global/jp/pub/jp/ace/sql_image/2/otnj-sql-image2.html -
Result region not displaying values properly from backend table
HI All,
We have a search page wherein we have added a new column called grade range in the table as well as in the search region.The new column is mapped to a altogether new column which
is created in the database table with a default value.The table in the search page has Entity object assosciated with it which is taking care of all the DML operations.
The name of the newly created item in the serach region is grade range which has three value coming from lookup like 12 ,13 and all,and also the new column
created in the database table has default value of all.
When we are trying to query the results in the search page with the filter criteria of any value for grade range, then we are able to see the records in the result table but with the column grade range being null. But When we update any record in the result table , then we are able to see the value for grade range column for updated records after submit.
And this behaviour of the search page is after the data base refresh. Before that, it was working fine.Hi,
I hope, these two characterstics are from different base cubes. SO you are getting two rows. I hope, it is not possible to display those two rows(what you explained in the example) in a single row. This is very common property of Multi provider. To solve this problem you have to enhance one of DS to include both characterstics and it should feed the data to one cube only. Then you have to built the query directly on that cube.
With rgds,
Anil Kumar Sharma .P -
How to change the Text of Dropdown by Key Dynamically thats coming from RFC
HI All,
I need an urgent help . I have a parameter coming from RFC -> YYTEXT with a value Range and I am binding this parameter in my DROPDOWN BY KEY .Now I have a requirement that two values coming from this parameter i need to change it
.Can you please tell me how to get the values from this YYTEXT attribute which is in NODE1 and then set the two new texts to this attribute so that it shows different text in the droodown .
Thank you in Advance .
NaazWill appreciate any comments on the question ?
-
Events or attributes triggered by data coming from a data file
Without using scripts, is there any way to have rectangles or textboxes act on values coming from a data file? If not, does anyone know or have some scripting suggestions to do that. For examplle if the value in a textbox was greater than 10 coming from a data record, could the textbox change color, or any other attribute to make it change from record to recortd as it is being viewed or printed?
ThanksThat is how I solve your question.
I use a formula in Excel:
I import the result in ID, not Column A, but B (result of the calculation):
And I modify the paragraph style like this:
It is easy and fast to do. -
i'm working on this project i'm trying to copy the fFile (in this case the fFile is the file that i'm trying to copy from the M: drive which is a tree directory) to the C: drive
please i need any help that i can get
thanks
* MenuPanel.java
* Created on August 16, 2007, 11:03 AM
import java.util.zip.*;
import java.util.concurrent.*;
import java.util.concurrent.locks.*;
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
import java.io.*;
import java.lang.*;
import java.sql.*;
public class MenuPanel extends JFrame
private JButton fMenuOpen;
private JButton fMenuSave;
private JButton fMenuClose;
private JPanel northPanel;
private JPanel southPanel;
private Lock lockprograms;
JTextArea fTextArea;
JavaFilter fJavaFilter = new JavaFilter ();
File fFile = new File ("file to be copy");
File dir = new File("C:\\ActiveMachineData");
/** Creates a new instance of MenuPanel */
public MenuPanel(String title)
super("Engineer Drive");
// add a north panel
northPanel = new JPanel();
northPanel.setLayout(new GridLayout(0,3,1,2));
fMenuOpen = new JButton("Check Out");
northPanel.add(fMenuOpen);
fMenuSave = new JButton("Save");
northPanel.add(fMenuSave);
fMenuClose = new JButton("Quit");
northPanel.add(fMenuClose);
add(northPanel);
Container content_pane = getContentPane ();
// Create a user interface.
content_pane.setLayout ( new GridLayout (1,2) );
// fTextArea = new JTextArea ("");
content_pane.add ( northPanel, "north");
setSize (300,100);
//register the event
OpenFileHandler handle = new OpenFileHandler(); //creates an event handler
SaveFileHandler handle1 = new SaveFileHandler(); //creates an event handler
QuitFileHandler handle2 = new QuitFileHandler(); //creates an event handler
fMenuOpen.addActionListener(handle); //handle the event
fMenuSave.addActionListener(handle1); //handle the event
fMenuClose.addActionListener(handle2); //handle the event
private class OpenFileHandler implements ActionListener
public void actionPerformed(ActionEvent event)
boolean status = false;
//status = openFile ();
status = copyFile();
if (!status)
JOptionPane.showMessageDialog (
null,
"Error copying file!", "Copy File Error",
JOptionPane.ERROR_MESSAGE);
else if (status)
JOptionPane.showMessageDialog(null,
"Coping File...", "sucess message",
JOptionPane.INFORMATION_MESSAGE);
private class SaveFileHandler implements ActionListener
public void actionPerformed(ActionEvent event)
boolean status = false;
status = saveFile ();
if (!status)
JOptionPane.showMessageDialog(
null,
"IO error in saving file!!", "File Save Error",
JOptionPane.ERROR_MESSAGE);
private class QuitFileHandler implements ActionListener
public void actionPerformed(ActionEvent event)
try
dispose ();
DabaseLog bl = new DabaseLog();
bl.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
bl.setSize(250, 200);
bl.setLocation(300,300);
bl.setVisible(true);
catch(SQLException sqlException)
JOptionPane.showMessageDialog(null, sqlException.getMessage(), "Database error", JOptionPane.ERROR_MESSAGE);
catch(ClassNotFoundException classnotfound)
JOptionPane.showMessageDialog(null, classnotfound.getMessage(), "Database error", JOptionPane.ERROR_MESSAGE);
* Use a JFileChooser in Open mode to select files
* to open. Use a filter for FileFilter subclass to select
* for *.java files. If a file is selected then read the
* file and place the string into the textarea.
boolean copyFile ()
// 8/29
boolean checkOut = false;
String file_string = readFile (fFile);
JFileChooser fc = new JFileChooser ();
fc.setDialogTitle ("Copy File");
// Choose only files, not directories
fc.setFileSelectionMode ( JFileChooser.FILES_AND_DIRECTORIES);
// Start in Mfg-eng-01 directory
fc.setCurrentDirectory (new File ("M:"));
// Set filter for Java source files.
fc.setFileFilter (fJavaFilter);
// Now open chooser
int result = fc.showOpenDialog (this);
if (result == JFileChooser.CANCEL_OPTION)
// return true;
else if (result == JFileChooser.APPROVE_OPTION)
// throw
//8/29
// File srcfile= null;
// File destFile= null;
/* try
InputStream in = new FileInputStream(dir+"\\"+fFile);
System.out.print(dir);
} catch (FileNotFoundException ex) {
ex.printStackTrace();
try
OutputStream out = new FileOutputStream(dir+"\\"+fFile);
} catch (FileNotFoundException ex) {
ex.printStackTrace();
// catch (IOException io)
// System.out.print(io)
//8/30
try
{ String Folder = "C:\\ActiveMachineData";
File file = null;
String dataString = null;
// String document = new fFile();
PrintWriter out =
new PrintWriter (new BufferedWriter (new FileWriter (Folder+"\\"+file)));
System.out.println(file);
out.print (dataString);
out.flush ();
out.close ();
catch (IOException e)
return true;
return true;
// copyFile
* Use a JFileChooser in Save mode to select files
* to open. Use a filter for FileFilter subclass to select
* for "*.java" files. If a file is selected, then write the
* the string from the textarea into it.
boolean saveFile ()
File file = null;
JFileChooser fc = new JFileChooser ();
// Start in current directory
fc.setCurrentDirectory (new File ("M:"));
// Set filter for Java source files.
fc.setFileFilter (fJavaFilter);
// Set to a default name for save.
fc.setSelectedFile (fFile);
// Open chooser dialog
int result = fc.showSaveDialog (this);
if (result == JFileChooser.CANCEL_OPTION)
return true;
// if ()
else if (result == JFileChooser.APPROVE_OPTION)
fFile = fc.getSelectedFile ();
if (fFile.exists ())
int response = JOptionPane.showConfirmDialog (null,
"Overwrite existing file?","Confirm Overwrite",
JOptionPane.OK_CANCEL_OPTION,
JOptionPane.QUESTION_MESSAGE);
if (response == JOptionPane.CANCEL_OPTION)
return false;
return writeFile (fFile, fTextArea.getText ());
else
return false;
} // saveFile
/** Use a BufferedReader wrapped around a FileReader to read
* the text data from the given file.
public String readFile (File file)
StringBuffer fileBuffer;
String fileString=null;
String line;
try
FileReader in = new FileReader (file);
BufferedReader dis = new BufferedReader (in);
fileBuffer = new StringBuffer () ;
while ((line = dis.readLine ()) != null)
fileBuffer.append (line + "\n");
in.close ();
fileString = fileBuffer.toString ();
catch (IOException e )
return null;
return fileString;
} // readFile
* Use a PrintWriter wrapped around a BufferedWriter, which in turn
* is wrapped around a FileWriter, to write the string data to the
* given file.
public static boolean writeFile (File file, String dataString)
try
System.out.println("system");
PrintWriter out =
new PrintWriter (new BufferedWriter (new FileWriter (file)));
out.print (dataString);
out.flush ();
out.close ();
catch (IOException e)
return false;
return true;
} // writeFile
}I apology ,
basically what i'm trying to do is copy a file from one directory to another
the Ffile is a string to get the file name from the JFileChooser.
i did a System.out on different block of the code and this is what i'm getting, that's where the null is coming from.
Database connected
LOG_IN DATABASE AdmLogIN
AdmPassword
null
BUILD SUCCESSFUL (total time: 23 seconds)
also in the other directory that i want to copy the file i'm getting that null output
boolean copyFile ()
// 8/29
String file_string = readFile (fFile);
JFileChooser fc = new JFileChooser ();
fc.setDialogTitle ("Copy File");
// Choose only files, not directories
fc.setFileSelectionMode ( JFileChooser.FILES_AND_DIRECTORIES);
// Start in Mfg-eng-01 directory
fc.setCurrentDirectory (new File ("M:"));
// Set filter for Java source files.
fc.setFileFilter (fJavaFilter);
// Now open chooser
int result = fc.showOpenDialog (this);
if (result == JFileChooser.CANCEL_OPTION)
// return true;
else if (result == JFileChooser.APPROVE_OPTION)
//8/30
try
{ String Folder = "C:\\ActiveMachineData";
File file = null;
String dataString = null;
PrintWriter out =
new PrintWriter (new BufferedWriter (new FileWriter (Folder+"\\"+file)));
System.out.println(file);
out.print (dataString);
out.flush ();
out.close ();
catch (IOException e)
return true;
return true;
// copyFile
Maybe you are looking for
-
I need to unregister my phone # from imessage. How?
-
Wil the OCZ vortex 3 SSD work in the apple Mac Book Pro?
I really want to get the fastest SSD (money is not the issue) out there in my Macbook Pro 2011 I was just wondering if the Vortex 3 will be able to work at his maximum perfomance in the mac book pro 2011, and is 6Gb/s SATA 3 supported.
-
Do Not Use Set-up Cartridge Message
I just changed all the cartridges in my HP Officejet Pro 8600. Now the error message "DO NOT USE SET-UP Cartridges" is on the screen. I have turned machine off, unplugged power, double checked cartridges (which are NOT set-up cartridges", and NADA.
-
Third party certificate and mobility express 526
Hi! I want to get rid of the certificate warning for my guest users using webauthentication. With my 2100 controller i have the option to upload a trusted certificate but can´t find anything on this controller. Is it even possible on this controller?
-
Infopath 2010 - Can't turn off Underline on a textbox
I have added and re-added a textbox to a form trying to fix this, but can't get it working. If I select the textbox then click the Underline icon, it turns off...then turns right back on. I have other textboxes that work fine, but I can't find anyt