Can i write an Object back as an http response.
can i write an Object back as an http response.
my device will send an object to the servlet and in response i need to send an object. is this possible... can i write a sample program to simulate the device.
Yes, though your object must be Serializable.
public void doGet(HttpServletRequest req, HttpServletResponse res)
throws ServletException, IOException {
// code here for real work: Assume obj is the object you want to send back
try {
ObjectOutputStream oos =
new ObjectOutputStream(res.getOutputStream());
oos.writeObject(obj);
oos.close();
} catch (IOException exc) {
exc.printStackTrace();
}
Similar Messages
-
How can I write new objects to the existing file with already written objec
Hi,
I've got a problem in my app.
Namely, my app stores data as objects written to the files. Everything is OK, when I write some data (objects of a class defined by me) to the file (by using writeObject method from ObjectOutputStream) and then I'm reading it sequencially by the corresponding readObject method (from ObjectInputStream).
Problems start when I add new objects to the already existing file (to the end of this file). Then, when I'm trying to read newly written data, I get an exception:
java.io.StreamCorruptedException
at java.io.ObjectInputStream.readObject0(Unknown Source)
at java.io.ObjectInputStream.readObject(Unknown Source)
Is there any method to avoid corrupting the stream? Maybe it is a silly problem, but I really can't cope with it! How can I write new objects to the existing file with already written objects?
If anyone of you know something about this issue, please help!
JaiHere is a piece of sample codes. You can save the bytes read from the object by invoking save(byte[] b), and load the last inserted object by invoking load.
* Created on 2004-12-23
package com.cpic.msgbus.monitor.util.cachequeue;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.RandomAccessFile;
* @author elgs This is a very high performance implemention of Cache.
public class StackCache implements Cache
protected long seed = 0;
protected RandomAccessFile raf;
protected int count;
protected String cacheDeviceName;
protected Adapter adapter;
protected long pointer = 0;
protected File f;
public StackCache(String name) throws IOException
cacheDeviceName = name;
f = new File(Const.cacheHome + name);
raf = new RandomAccessFile(f, "rw");
if (raf.length() == 0)
raf.writeLong(0L);
* Whne the cache file is getting large in size and may there be fragments,
* we should do a shrink.
public synchronized void shrink() throws IOException
int BUF = 8192;
long pointer = getPointer();
long size = pointer + 4;
File temp = new File(Const.cacheHome + getCacheDeviceName() + ".shrink");
FileInputStream in = new FileInputStream(f);
FileOutputStream out = new FileOutputStream(temp);
byte[] buf = new byte[BUF];
long runs = size / BUF;
int mode = (int) size % BUF;
for (long l = 0; l < runs; ++l)
in.read(buf);
out.write(buf);
in.read(buf, 0, mode);
out.write(buf, 0, mode);
out.flush();
out.close();
in.close();
raf.close();
f.delete();
temp.renameTo(f);
raf = new RandomAccessFile(f, "rw");
private synchronized long getPointer() throws IOException
long l = raf.getFilePointer();
raf.seek(0);
long pointer = raf.readLong();
raf.seek(l);
return pointer < 8 ? 4 : pointer;
* (non-Javadoc)
* @see com.cpic.msgbus.monitor.util.cachequeue.Cache#load()
public synchronized byte[] load() throws IOException
pointer = getPointer();
if (pointer < 8)
return null;
raf.seek(pointer);
int length = raf.readInt();
pointer = pointer - length - 4;
raf.seek(0);
raf.writeLong(pointer);
byte[] b = new byte[length];
raf.seek(pointer + 4);
raf.read(b);
--count;
return b;
* (non-Javadoc)
* @see com.cpic.msgbus.monitor.util.cachequeue.Cache#save(byte[])
public synchronized void save(byte[] b) throws IOException
pointer = getPointer();
int length = b.length;
pointer += 4;
raf.seek(pointer);
raf.write(b);
raf.writeInt(length);
pointer = raf.getFilePointer() - 4;
raf.seek(0);
raf.writeLong(pointer);
++count;
* (non-Javadoc)
* @see com.cpic.msgbus.monitor.util.cachequeue.Cache#getCachedObjectsCount()
public synchronized int getCachedObjectsCount()
return count;
* (non-Javadoc)
* @see com.cpic.msgbus.monitor.util.cachequeue.Cache#getCacheDeviceName()
public String getCacheDeviceName()
return cacheDeviceName;
} -
Can we write client object model code with Server object model?
Hi everyone,
I have to create one timer job using client object model (C#) in Sharepoint 2010 template on feature activation. Is it possible to write the code of client object in sharepoint empty project to create timer job? If yes/no? then why?
Thanks in advance!!!Hi ShindeK,
Yes you can used CSOM in Sharepoint but Timer jobs run directly on the server. The Client Side Object Model is a wrapper that brokers its calls to the server via the built in web services that SharePoint provides.
You will not get any performance gains in this scenario using CSOM. You should use the full server object model of SharePoint
SharePoint 2010 also has three Client Object Models (Managed, Silverlight, JavaScript) which are meant to be used by code accessing SharePoint remotely.
--You can also used powershell script in timer job
Chekc the link which cann help you step by step CSOM in Sharepoint timer job
http://www.youtube.com/watch?v=Z7wHj-bSk0g
You can also try the below link....
https://bramdejager.wordpress.com/2013/08/02/using-csom-and-powershell-to-query-sharepoint-online-or-on-premise/
http://stackoverflow.com/questions/3656920/run-sharepoint-timer-jobs-from-powershell
Please mark the Answer and Vote me if you think that it will help you to resolved your issue -
Serialization question: can't write an object
this may be a simple question but I do need to find out what's wrong with the object I am trying to serialize:
The method (included) I use to write object works fine for some simple objects but stops without giving any message for some complex objects. It stops at "out.writeObject(obj)". Is there any other exceptions need to be caught or something else. Thanks a lot.
public void writeAnObject(Object obj) {
ObjectOutputStream out = null;
try {
out = new ObjectOutputStream(new FileOutputStream("obj.saved"));
out.writeObject(obj);
out.close();
} catch (FileNotFoundException e) {
System.err.println("Caught FileNotFoundException");
e.printStackTrace(System.err);
} catch (IOException e) {
System.err.println("Caught IOException ");
e.printStackTrace(System.err);Ok, one last thing... don't know if it will make any differance but why not?! This is a class that I used successfully in several projects when serializising Collections to file:
* @author Andrew
* @version 1.0 (2000-11-24)
public class PersistentStorage {
// The objectoutputstream
private ObjectOutputStream out;
// The objectinputstream
private ObjectInputStream in;
* This method saves a collection persistent to specified file.
* @param obj The collection we want to save.
public void saveCollection(Collection obj, String fileName)
throws FileNotFoundException, IOException {
// Create a objectoutputstream
out = new ObjectOutputStream(new FileOutputStream(fileName));
// Write the collection object to file
out.writeObject(obj);
// Close the objectoutputstream
out.close();
* This method read a collection object from specified file.
* @return collection The collection we have read.
public Collection readCollection(String fileName)
throws FileNotFoundException, IOException, ClassNotFoundException {
// Create a objectinputstream
in = new ObjectInputStream(new FileInputStream(fileName));
// Asign the read object to a Collection "container"
Collection collection = (Collection) in.readObject();
// Close the objectinputstream
in.close();
return collection;
}The differens is that I don't catch any exceptions in those method writing and reading objects. Only throw exceptions.
Try it out and see if it helps... (last shot) ;)
/Andrew -
CSS SSL Proxy - how can I write the original source address in http header
I'm replacing some BigIP's with CSS11500's that are configured to do front/backend ssl proxying in a one-armed configuration. The BigIP's write the original source IP address as a http header value when the traffic is sent to the application, and the application uses the IP to match against an application ACL. How can I do the same in the CSS.
thanks,
Brianhere is what you can insert with the SSL module :
http://www.cisco.com/en/US/products/hw/contnetw/ps792/products_configuration_guide_chapter09186a0080292a76.html#wp1027619
Gilles. -
Simple use for text output is System.out.println("Hallo");
But how Can I write text in different color?http://www.javaworld.com/javaworld/javaqa/2002-12/02-qa-1220-console.html
-
I am using NI OPC Server and I can read Siemens S7-300 PLC tags such as thermocouple values from the PLC. Additonally I can write manually a constant value to that tag by selecting it in the NI Distributed System Manager. And I can read the written value from NI Distributed System Manager or from NI OPC Server. But I can not write any value to the S7300 PLC tags such as by using a knob object at the NI Vision Builder AI Inpection (.vbai) page.
Any help is welcomed. Thanks in advance.
Attachments:
manual_writing_to_plc.png 298 KBThe tutorial at the following location explains how to use Vision Builder AI as a OPC server.
https://decibel.ni.com/content/docs/DOC-18647
http://www.ni.com/white-paper/13574/en
To allow VBAI to connect to an OPC Server (i.e. act as an OPC client), you need to purchase and install the DSC Run-time System.
Once installed, you can create an OPC I/O client using the Distributed System Manager, create variables bound to OPC tags, then create VBAI network variables that are bound to these variables.
Another possible technical solution to connect to OPC Servers supporting Data Access 2.0 is to use the datasocket API in a Run LabVIEW step.
http://forums.ni.com/t5/Machine-Vision/Read-and-Write-with-OPC-through-NI-Vision/m-p/2048278/highlig...
Hope this helps.
-Christophe -
How can I write relative path in File, ImageIcon objects
I have downloaded examples from
http://java.sun.com/docs/books/tutorial/uiswing/components/example-swing/index.html
but for some reason images are invisible until I write absolute paths?(I use windows) How can I write relative path in File, ImageIcon objects?Hello;
I've found a lot of complaints about this through the Forte forum as well as on Dejanews. I'm just curious as to whether any of you ended up finding a solution to this problem.
There was one posting about setting up the subdirectory as a URL rather than a String and then using that as the source of the ImageIcon ... but this didn't work for me.
Any help whatsoever would be appreciated.
Thanks! -
Can you write javac in java Language
Hi,
is it possible to write java compiler in java language.Here's a compiler written in Java, it is part of an IDE I wrote:
Compiler.java: import java.io.*;
* Wrap up javac.
* The class exists to supply a single method - to compile a file
* and report status along with error/success messages
* Compilation (by javac) is carried out asynchronously using a
* background Thread. Status and any error messages are passed back to
* the calling object through a callback method.
public class Compiler implements Runnable
* Constructor.
* @param owner the <TT>JavacTool</TT> that has created this Compiler
public Compiler( CompilerListener owner )
myOwner = owner;
private CompilerListener myOwner;
* Compile a file using javac.
* This method will compile a Java source file and report both the
* status of the operation and any error strings produced.
* The method kicks off a separate Thread that actually carries out
* the compilation. Upon completion a the JavacTool is called back with
* a CompilerStatus object.
* @param filename the name of a file which <I>must</I> be in the same directory
* as the JavacTool was run from. this tool does not have tha capability
* of working across multiple directories.
public void compile( String fileToCompile )
filename = fileToCompile;
new Thread( this ).start();
private String filename;
* The method run by the separate Thread.
* It runs once for each filename passed to the Compiler object.
* It creates a new OS process to run "javac filename" externally
* and captures the error output from the real compiler into
* a String so that it can be returned to the calling code via
* a callback method (very similar in principle to an event)
public void run()
CompilerStatus returnValue = new CompilerStatus();
returnValue.outputString = new String();
try
Runtime r = Runtime.getRuntime();
Process p = r.exec( "javac " + filename );
InputStream is = p.getErrorStream();
BufferedReader rdr = new BufferedReader( new InputStreamReader( is ) );
String line = rdr.readLine();
while( line != null )
returnValue.outputString += (line + "\n");
line = rdr.readLine();
p.waitFor();
returnValue.exitValue = p.exitValue();
if( returnValue.exitValue == 0 )
returnValue.outputString = "Compilation successful\n\nNo errors\n";
catch( Exception e )
e.printStackTrace();
myOwner.compileComplete( returnValue );
} CompilerStatus.java: public class CompilerStatus
public int exitValue;
public String outputString;
}JavacTool.java: import java.util.*;
import java.io.*;
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
* The main class in the application
* Provides the screen presence for the controllers and the output view
public class JavacTool extends JTextArea implements CompilerListener
* Constructor for the tool
* @param list A java.util.Vector containing the list of files for compilation
* or null if none entered.
public JavacTool( JTextArea jTextArea )
// View
outputWindow = jTextArea;
outputWindow.setFont( new Font( "Monospaced", Font.PLAIN, 12 ) );
outputWindow.setText( "TBJava IDE: -ready to compile" );
// Get it going!
// Must create a Compiler object and provide it with a link
// so that it can call this object back when it has completed
theCompiler = new Compiler( this );
// set the size and the visibility
setSize( 500, 250 );
setVisible( true );
public void Compile( String fileToCompile )
// Infrom user that something is happening
filename = fileToCompile;
outputWindow.setBackground( Color.white );
outputWindow.setText( "Compiling " + filename );
setCursor( new Cursor( Cursor.WAIT_CURSOR ) );
theCompiler.compile( fileToCompile );
// When compilation is complete, the Compiler
// object will callback on the method compileComplete
// The Compiler runs its own Thread so this method
// will complete immediately and the outputWindow
// update can occur.
private String filename; // the filename as a String
private JTextArea outputWindow; // the window containing the messages
private Compiler theCompiler; // the compiler
* Method called by the Compiler when it has completed
* @param status A CompilerStatus object that contains
* the exit value from the compiler
* (indicating success or failure) value == 0 => OK and value != 0 => error
* and an appropriate text message
public void compileComplete( CompilerStatus status )
setCursor( new Cursor( Cursor.DEFAULT_CURSOR ) );
if( status.exitValue == 0 )
outputWindow.setBackground( new Color( 0.85F, 1.0F, 0.85F ) );
// pale green
else
outputWindow.setBackground( new Color( 1.0F, 0.85F, 0.85F ) );
// pale red
outputWindow.setText( status.outputString );
}This is taken straight from my IDE; you'll have to adapt it slightly to make it into a seperate application -
How can i write a string into a specified pos of a file?
How can i write a string into a specified pos of a file without read all file into ram and write the whole file again?
for example:
the content of file is:
name=123
state=456
i want to modify the value of name with 789
(write to file without read all file into ram)
How can i do it? thank youtake this as an idea. it actually does what i decribed above. you sure need to make some modifications so it works for your special need. If you use it and add any valuable code to it or find any bugs, please let me know.
import java.io.*;
import java.util.*;
* Copyright (c) 2002 Frank Fischer <[email protected]>
* All rights reserved. See the LICENSE for usage conditions
* ObjectProperties.java
* version 1.0, 2002-09-12
* author Frank Fischer <[email protected]>
public class ObjectProperties
// the seperator between the param-name and the value in the prooperties file
private static final String separator = "=";
// the vector where we put the arrays in
private Vector PropertiesSet;
// the array where we put the param/value pairs in
private String propvaluepair[][];
// the name of the object the properties file is for
public String ObjectPropertiesFileName;
// the path to the object'a properties file
public String ObjectPropertiesDir;
// reference to the properties file
public File PropertiesFile;
// sign for linebreak - depends on platforms
public static final String newline = System.getProperty("line.separator");
public ObjectProperties(String ObjectPropertiesFileName, String ObjectPropertiesDir, ObjectPropertiesManager ObjectPropertiesManager)
// System.out.println("Properties Objekt wird erzeugt: "+ObjectPropertiesFileName);
this.ObjectPropertiesFileName = ObjectPropertiesFileName;
this.ObjectPropertiesDir = ObjectPropertiesDir;
// reference to the properties file
PropertiesFile = new File(ObjectPropertiesDir+ObjectPropertiesFileName);
// vector to put the param/value pair-array in
PropertiesSet = new Vector();
// System.out.println("Properties File Backup wird erzeugt: "+name);
backup();
// System.out.println("Properties File wird eingelesen: "+PropertiesFile);
try
//opening stream to file for read operations
FileInputStream FileInput = new FileInputStream(PropertiesFile);
DataInputStream DataInput = new DataInputStream(FileInput);
String line = "";
//reading line after line of the properties file
while ((line = DataInput.readLine()) != null)
//just making sure there are no whitespaces at the beginng or end of the line
line = cutSpaces(line);
if (line.length() > 0)
//$ indicates a param-name
if (line.startsWith("$"))
// array to store a param/value pair in
propvaluepair = new String[1][2];
//get the param-name
String parameter = line.substring(1, line.indexOf(separator)-1);
//just making sure there are no whitespaces at the beginng or end of the variable
parameter = cutSpaces(parameter);
//get the value
String value = line.substring(line.indexOf(separator)+1, line.length());
//just making sure there are no whitespaces at the beginng or end of the variable
value = cutSpaces(value);
//put the param-name and the value into an array
propvaluepair[0][0] = parameter;
propvaluepair[0][1] = value;
// System.out.println("["+ObjectPropertiesFileName+"] key/value gefunden:"+parameter+";"+value);
//and finaly put the array into the vector
PropertiesSet.addElement(propvaluepair);
// error handlig
catch (IOException e)
System.out.println("ERROR occured while reading property file for: "+ObjectPropertiesFileName);
System.out.println("ERROR CODE: "+e);
// System.out.println("in ObjectProperties");
// function to be called to get the value of a specific paramater 'param'
// if the specific paramater is not found '-1' is returned to indicate that case
public String getParam(String param)
// the return value indicating that the param we are searching for is not found
String v = "-1";
// looking up the whole Vector
for (int i=0; i<PropertiesSet.size(); i++)
//the String i want to read the values in again
String s[][] = new String[1][2];
// trying to get out the array from the vector again
s = (String[][]) PropertiesSet.elementAt(i);
// comparing the param-name we're looking for with the param-name in the array we took out the vector at position i
if (s[0][0].equals(param) == true)
//if the param-names are the same, we look up the value and write it in the return variable
v = s[0][1];
// making sure the for loop ends
i = PropertiesSet.size();
// giving the value back to the calling procedure
return v;
// function to be called to set the value of a specific paramater 'param'
public void setParam(String param, String value)
// looking up the whole Vector for the specific param if existing or not
for (int i=0; i<PropertiesSet.size(); i++)
//the String i want to read the values in again
String s[][] = (String[][]) PropertiesSet.elementAt(i);
// comparing the param-name we're looking for with the param-name in the array we took out the vector at position i
if (s[0][0].equals(param) == true)
//if the param-names are the same, we remove the param/value pair so we can add the new pair later in
PropertiesSet.removeElementAt(i);
// making sure the for loop ends
i = PropertiesSet.size();
// if we land here, there is no such param in the Vector, either there was none form the beginng
// or there was one but we took it out.
// create a string array to place the param/value pair in
String n[][] = new String[1][2];
// add the param/value par
n[0][0] = param;
n[0][1] = value;
// add the string array to the vector
PropertiesSet.addElement(n);
// function to save all data in the Vector to the properties file
// must be done because properties might be changing while runtime
// and changes are just hold in memory while runntime
public void store()
backup();
String outtofile = "# file created/modified on "+createDate("-")+" "+createTime("-")+newline+newline;
try
//opening stream to file for write operations
FileOutputStream PropertiesFileOuput = new FileOutputStream(PropertiesFile);
DataOutputStream PropertiesDataOutput = new DataOutputStream(PropertiesFileOuput);
// looping over all param/value pairs in the vector
for (int i=0; i<PropertiesSet.size(); i++)
//the String i want to read the values in
String s[][] = new String[1][2];
// trying to get out the array from the vector again
s = (String[][]) PropertiesSet.elementAt(i);
String param = "$"+s[0][0];
String value = s[0][1];
outtofile += param+" = "+value+newline;
outtofile += newline+"#end of file"+newline;
try
PropertiesDataOutput.writeBytes(outtofile);
catch (IOException e)
System.out.println("ERROR while writing to Properties File: "+e);
catch (IOException e)
System.out.println("ERROR occured while writing to the property file for: "+ObjectPropertiesFileName);
System.out.println("ERROR CODE: "+e);
// sometimes before overwritting old value it's a good idea to backup old values
public void backup()
try
// reference to the original properties file
File OriginalFile = new File(ObjectPropertiesDir+ObjectPropertiesFileName);
File BackupFile = new File(ObjectPropertiesDir+"/backup/"+ObjectPropertiesFileName+".backup");
//opening stream to original file for read operations
FileInputStream OriginalFileInput = new FileInputStream(OriginalFile);
DataInputStream OriginalFileDataInput = new DataInputStream(OriginalFileInput);
//opening stream to backup file for write operations
FileOutputStream BackupFileOutput = new FileOutputStream(BackupFile);
DataOutputStream BackupFileDataOutput = new DataOutputStream(BackupFileOutput);
// String content = "";
String line = "";
// do till end of file
while ((line = OriginalFileDataInput.readLine()) != null)
BackupFileDataOutput.writeBytes(line+newline);
// error handlig
catch (IOException e)
System.out.println("ERROR occured while back up for property file: "+ObjectPropertiesFileName);
System.out.println("ERROR CODE: "+e);
System.out.println("this is a serious error - the server must be stopped");
private String cutSpaces(String s)
while (s.startsWith(" "))
s = s.substring(1, s.length());
while (s.endsWith(" "))
s = s.substring(0, s.length()-1);
return s;
public String createDate(String seperator)
Date datum = new Date();
String currentdatum = new String();
int year, month, date;
year = datum.getYear()+1900;
month = datum.getMonth()+1;
date = datum.getDate();
currentdatum = ""+year+seperator;
if (month < 10)
currentdatum = currentdatum+"0"+month+seperator;
else
currentdatum = currentdatum+month+seperator;
if (date < 10)
currentdatum = currentdatum+"0"+date;
else
currentdatum = currentdatum+date;
return currentdatum;
public String createTime(String seperator)
Date time = new Date();
String currenttime = new String();
int hours, minutes, seconds;
hours = time.getHours();
minutes = time.getMinutes();
seconds = time.getSeconds();
if (hours < 10)
currenttime = currenttime+"0"+hours+seperator;
else
currenttime = currenttime+hours+seperator;
if (minutes < 10)
currenttime = currenttime+"0"+minutes+seperator;
else
currenttime = currenttime+minutes+seperator;
if (seconds < 10)
currenttime = currenttime+"0"+seconds;
else
currenttime = currenttime+seconds;
return currenttime; -
How can I write a tree report?
How can I write a tree report? If you have any document/ link can you please send that.
Regards,
SubhasishREPORT zdemo_alv_tree.
Demo program prepared for ****************
CLASS cl_gui_column_tree DEFINITION LOAD.
CLASS cl_gui_cfw DEFINITION LOAD.
DATA tree1 TYPE REF TO cl_gui_alv_tree_simple.
INCLUDE <icon>.
INCLUDE bcalv_simple_event_receiver.
DATA: gt_sflight TYPE sflight OCCURS 0, " Output-Table
gt_fieldcatalog TYPE lvc_t_fcat, " Field Catalog
gt_sort TYPE lvc_t_sort, " Sorting Table
ok_code LIKE sy-ucomm. " OK-Code
END-OF-SELECTION.
CALL SCREEN 100.
*& Form BUILD_FIELDCATALOG
This subroutine is used to build the field catalog for the ALV list
FORM build_fieldcatalog.
get fieldcatalog
CALL FUNCTION 'LVC_FIELDCATALOG_MERGE'
EXPORTING
i_structure_name = 'SFLIGHT'
CHANGING
ct_fieldcat = gt_fieldcatalog.
change fieldcatalog
DATA: ls_fieldcatalog TYPE lvc_s_fcat.
LOOP AT gt_fieldcatalog INTO ls_fieldcatalog.
CASE ls_fieldcatalog-fieldname.
WHEN 'CARRID' OR 'CONNID' OR 'FLDATE'.
ls_fieldcatalog-no_out = 'X'.
ls_fieldcatalog-key = ''.
WHEN 'PRICE' OR 'SEATSOCC' OR 'SEATSMAX' OR 'PAYMENTSUM'.
ls_fieldcatalog-do_sum = 'X'.
ENDCASE.
MODIFY gt_fieldcatalog FROM ls_fieldcatalog.
ENDLOOP.
ENDFORM. " BUILD_FIELDCATALOG
*& Form BUILD_OUTTAB
Retrieving the data from the table and filling it in the output table
of the ALV list
FORM build_outtab.
SELECT * FROM sflight INTO TABLE gt_sflight.
ENDFORM. " BUILD_OUTTAB
*& Form BUILD_SORT_TABLE
This subroutine is used to build the sort table or the sort criteria
FORM build_sort_table.
DATA ls_sort_wa TYPE lvc_s_sort.
create sort-table
ls_sort_wa-spos = 1.
ls_sort_wa-fieldname = 'CARRID'.
ls_sort_wa-up = 'X'.
ls_sort_wa-subtot = 'X'.
APPEND ls_sort_wa TO gt_sort.
ls_sort_wa-spos = 2.
ls_sort_wa-fieldname = 'CONNID'.
ls_sort_wa-up = 'X'.
ls_sort_wa-subtot = 'X'.
APPEND ls_sort_wa TO gt_sort.
ls_sort_wa-spos = 3.
ls_sort_wa-fieldname = 'FLDATE'.
ls_sort_wa-up = 'X'.
APPEND ls_sort_wa TO gt_sort.
ENDFORM. " BUILD_SORT_TABLE
*& Module PBO OUTPUT
This subroutine is used to build the ALV Tree
MODULE pbo OUTPUT.
IF tree1 IS INITIAL.
PERFORM init_tree.
ENDIF.
SET PF-STATUS 'ZSTATUS'.
ENDMODULE. " PBO OUTPUT
*& Module PAI INPUT
This subroutine is used to handle the navigation on the screen
MODULE pai INPUT.
CASE ok_code.
WHEN 'EXIT' OR 'BACK' OR 'CANC'.
PERFORM exit_program.
WHEN OTHERS.
CALL METHOD cl_gui_cfw=>dispatch.
ENDCASE.
CLEAR ok_code.
ENDMODULE. " PAI INPUT
*& Form exit_program
free object and leave program
FORM exit_program.
CALL METHOD tree1->free.
LEAVE PROGRAM.
ENDFORM. " exit_program
*& Form register_events
Handling the events in the ALV Tree control in backend
FORM register_events.
define the events which will be passed to the backend
DATA: lt_events TYPE cntl_simple_events,
l_event TYPE cntl_simple_event.
define the events which will be passed to the backend
l_event-eventid = cl_gui_column_tree=>eventid_node_context_menu_req.
APPEND l_event TO lt_events.
l_event-eventid = cl_gui_column_tree=>eventid_item_context_menu_req.
APPEND l_event TO lt_events.
l_event-eventid = cl_gui_column_tree=>eventid_header_context_men_req.
APPEND l_event TO lt_events.
l_event-eventid = cl_gui_column_tree=>eventid_expand_no_children.
APPEND l_event TO lt_events.
l_event-eventid = cl_gui_column_tree=>eventid_header_click.
APPEND l_event TO lt_events.
l_event-eventid = cl_gui_column_tree=>eventid_item_keypress.
APPEND l_event TO lt_events.
CALL METHOD tree1->set_registered_events
EXPORTING
events = lt_events
EXCEPTIONS
cntl_error = 1
cntl_system_error = 2
illegal_event_combination = 3.
set Handler
DATA: l_event_receiver TYPE REF TO lcl_tree_event_receiver.
CREATE OBJECT l_event_receiver.
SET HANDLER l_event_receiver->on_add_hierarchy_node
FOR tree1.
ENDFORM. " register_events
*& Form build_header
build table for header
FORM build_comment USING
pt_list_commentary TYPE slis_t_listheader
p_logo TYPE sdydo_value.
DATA: ls_line TYPE slis_listheader.
LIST HEADING LINE: TYPE H
CLEAR ls_line.
ls_line-typ = 'H'.
LS_LINE-KEY: NOT USED FOR THIS TYPE
ls_line-info = 'ALV TREE DEMO for ****************'.
APPEND ls_line TO pt_list_commentary.
p_logo = 'ENJOYSAP_LOGO'.
ENDFORM. "build_comment
*& Form init_tree
Building the ALV-Tree for the first time display
FORM init_tree.
PERFORM build_fieldcatalog.
PERFORM build_outtab.
PERFORM build_sort_table.
create container for alv-tree
DATA: l_tree_container_name(30) TYPE c,
l_custom_container TYPE REF TO cl_gui_custom_container.
l_tree_container_name = 'TREE1'.
CREATE OBJECT l_custom_container
EXPORTING
container_name = l_tree_container_name
EXCEPTIONS
cntl_error = 1
cntl_system_error = 2
create_error = 3
lifetime_error = 4
lifetime_dynpro_dynpro_link = 5.
create tree control
CREATE OBJECT tree1
EXPORTING
i_parent = l_custom_container
i_node_selection_mode =
cl_gui_column_tree=>node_sel_mode_multiple
i_item_selection = 'X'
i_no_html_header = ''
i_no_toolbar = ''
EXCEPTIONS
cntl_error = 1
cntl_system_error = 2
create_error = 3
lifetime_error = 4
illegal_node_selection_mode = 5
failed = 6
illegal_column_name = 7.
create info-table for html-header
DATA: lt_list_commentary TYPE slis_t_listheader,
l_logo TYPE sdydo_value.
PERFORM build_comment USING
lt_list_commentary
l_logo.
repid for saving variants
DATA: ls_variant TYPE disvariant.
ls_variant-report = sy-repid.
register events
PERFORM register_events.
create hierarchy
CALL METHOD tree1->set_table_for_first_display
EXPORTING
it_list_commentary = lt_list_commentary
i_logo = l_logo
i_background_id = 'ALV_BACKGROUND'
i_save = 'A'
is_variant = ls_variant
CHANGING
it_sort = gt_sort
it_outtab = gt_sflight
it_fieldcatalog = gt_fieldcatalog.
expand first level
CALL METHOD tree1->expand_tree
EXPORTING
i_level = 1.
optimize column-width
CALL METHOD tree1->column_optimize
EXPORTING
i_start_column = tree1->c_hierarchy_column_name
i_end_column = tree1->c_hierarchy_column_name.
ENDFORM. " init_tree -
I have a new iMac (like this):
I am trying to connect the Drobo that I used to use with my Windows Computer. It has 4 drives @ 3TB each, and the whole drive is over half full, so I am not terribly interested in the cost that it would take to "back up" that whole disk pack. It took some shenanigans (reboots of both the drive and the computer; disconnections, and reconnections; fiddling around with MAC Disk Utility) to get it to show up in Finder at all. I still have issues with it unmounting and needing to remount it, but that's not my main issue.
THE REAL PROBLEM:
Though I can get the Drobo to show up in finder, and I can read from it, I can't write to it. Based on some earlier searching I tried this terminal command, which helped it to show up in finder, but didn't seem to affect it's being read-only:
new-host-3:~ davidholcomb$ getfileinfo /Volumes/Drobo
directory: "/Volumes/Drobo"
attributes: avbstclinmedz
created: 12/10/2012 19:06:46
modified: 09/11/2014 03:37:07
Looking at another thread (partition map check failed because no slices were found), which I wandered into because I was getting this error in Disk Utility upon running Verify Disk because I got a failure when I tried to "mount" the drive in Disk Utility:
This thread suggested I try a couple additional Terminal Commands, which I will post the results of here:
#1: diskutil list
new-host-3:~ davidholcomb$ diskutil list
/dev/disk0
#: TYPE NAME SIZE IDENTIFIER
0: GUID_partition_scheme *121.3 GB disk0
1: EFI EFI 209.7 MB disk0s1
2: Apple_CoreStorage 121.0 GB disk0s2
3: Apple_Boot Boot OS X 134.2 MB disk0s3
/dev/disk1
#: TYPE NAME SIZE IDENTIFIER
0: GUID_partition_scheme *1.0 TB disk1
1: EFI EFI 209.7 MB disk1s1
2: Apple_CoreStorage 999.3 GB disk1s2
3: Apple_Boot Recovery HD 650.0 MB disk1s3
/dev/disk2
#: TYPE NAME SIZE IDENTIFIER
0: Apple_HFS Macintosh HD *1.1 TB disk2
/dev/disk4
#: TYPE NAME SIZE IDENTIFIER
0: GUID_partition_scheme *17.6 TB disk4
1: Microsoft Basic Data Drobo 17.6 TB disk4s1
#2 diskutil cs list
new-host-3:~ davidholcomb$ diskutil cs list
CoreStorage logical volume groups (1 found)
|
+-- Logical Volume Group 7DACBFD5-E22C-404B-98B1-99D97AD08B2F
=========================================================
Name: Macintosh HD
Status: Online
Size: 1120333979648 B (1.1 TB)
Free Space: 114688 B (114.7 KB)
|
+-< Physical Volume F26F7717-B081-4312-8252-65C9E3040AD4
| ----------------------------------------------------
| Index: 0
| Disk: disk0s2
| Status: Online
| Size: 120988852224 B (121.0 GB)
|
+-< Physical Volume 414053B5-EFD8-4FC0-87CE-F3913D6E876B
| ----------------------------------------------------
| Index: 1
| Disk: disk1s2
| Status: Online
| Size: 999345127424 B (999.3 GB)
|
+-> Logical Volume Family BE5280EF-B093-4137-88A2-5AF3F1ACEFCC
Encryption Status: Unlocked
Encryption Type: None
Conversion Status: NoConversion
Conversion Direction: -none-
Has Encrypted Extents: No
Fully Secure: No
Passphrase Required: No
|
+-> Logical Volume D35043A0-F886-4223-81DD-4880F04ECEA3
Disk: disk2
Status: Online
Size (Total): 1114146996224 B (1.1 TB)
Conversion Progress: -none-
Revertible: No
LV Name: Macintosh HD
Volume Name: Macintosh HD
Content Hint: Apple_HFS
and #3: Mount:
new-host-3:~ davidholcomb$ mount
/dev/disk2 on / (hfs, local, journaled)
devfs on /dev (devfs, local, nobrowse)
map -hosts on /net (autofs, nosuid, automounted, nobrowse)
map auto_home on /home (autofs, automounted, nobrowse)
/dev/disk4s1 on /Volumes/Drobo (ntfs, local, nodev, nosuid, read-only, noowners)
Another user who had run these commands and posted the results, seemed to have been missing an EFI partition on their external drive and was asked to run this command and post results. But the thread with that user dies there. Here are my results of this command:
new-host-3:~ davidholcomb$ diskutil info disk4
Device Identifier: disk4
Device Node: /dev/disk4
Part of Whole: disk4
Device / Media Name: TRUSTED Mass Storage Media
Volume Name: Not applicable (no file system)
Mounted: Not applicable (no file system)
File System: None
Content (IOContent): GUID_partition_scheme
OS Can Be Installed: No
Media Type: Generic
Protocol: USB
SMART Status: Not Supported
Total Size: 17.6 TB (17592186044416 Bytes) (exactly 34359738368 512-Byte-Units)
Volume Free Space: Not applicable (no file system)
Device Block Size: 512 Bytes
Read-Only Media: No
Read-Only Volume: Not applicable (no file system)
Ejectable: Yes
Whole: Yes
Internal: No
OS 9 Drivers: No
Low Level Format: Not supported
Can anyone help me with a next step to make this drive read/writeable?Turns out that the Drobo needs to be plugged straight into computer. I had it via hub. Though it has worked for the past couple weeks in this configuration, the new update pushed it over the edge, I guess. Plugged in directly and working fine.
-
Hi All,
powershell script Method required to read a value from registry and then taking the backup of that values in some text file.
For example the hive is
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Environment\Path
and under path i need to take back up of values in some text file and then put some value in the registry after back is taken in text file.
Also how to read the text file values so that we can again write to registry hive back from the back up text file.
Your help is much appreciated.
Umeed4uI think you need to read this first:
http://social.technet.microsoft.com/Forums/scriptcenter/en-US/a0def745-4831-4de0-a040-63b63e7be7ae/posting-guidelines?forum=ITCG
Don't retire TechNet! -
(Don't give up yet - 12,830+ strong and growing) -
Converting a class object back to a .class file
Hi,
How can i convert a class object back to a .class file ? Thanksany pointers on how to do it then ? i don't have
access to the native codeIf I have understood you correctly, you have native code that generates bytecode. Currently you load the class this bytecode represents right into the classloader, but you want to save it to disk as a .class file. Right?
If so, you just have to get hold of that bytecode before it "disappears" into the classloader, and save it to disk. How you can best do this depends on exactly how you communicate with that native code.
If I have misunderstood your problem (and that's not unlikely), please try to be clearer. -
Crystal Report XI: Can you write your query in SQL instead of using the GUI
Hello
In crystal report version XI, can you write your query in sqlplus and then use the crystal report designer to build your report instead of using the GUI . I would like to be able to go database and show sql query and open that query and make changes directly there, is that possible on this version, if yes is there a setting somewhere? Please let me know.
Thank you
alphaMoved to Database forum.
No you can no longer modify the SQL directly. Use a Command Object to enter the SQL directly.
Thank you
Don
Maybe you are looking for
-
Help! java wont download and I NEED it!
Okay so I have tried to download every version of java I can and none of them are working and I need it for my website. I have os x 10.4.8 Tiger so I don't know why it won't work. Can anyone please help me out with this? Thank You.
-
Error when saving Crystal Report to SAP BW (via SAP toolbar)
Dear Experts - Our landscape is: Backend - SAP BW7.4 with Service pack 5 Crystal Version - Crystal Reports 2013 SP1 Patch 6 Business Objects - SAP BI 4.1 SP1 Patch 6 I'm trying to save a crystal report to SAP BW via the toolbar option, but the attach
-
Hello! Just like the title, is there a way to create a "common desktop" for all RD/TS 2012 users? I know how to do this using regular W7 workstations and 2008 Servers, but the "Default" folder under the USERS directory is gone and I'm not sure how t
-
Reg :-maintain a table maintenance view for the z table.suggest me the code
i have question.i have created a z table related to pp module.the requirement is to maintain {table maintenance view} for this z table.how could this be done.can any one suggest me the code for this?
-
File missing in petstore1.4
Hi all, i unzipped the sample bundle of j2ee1.4 but i got an error while doing asant in the samples/bluprints/petstore1.4/src folder as the instructions say. The error is about java.io.FileNotFoundException: samples/common-ant.xml (No such file or di