Primitive data changes visible to other threads?

I thought that if one thread changes an instance variable, the change may not be visible to other threads if synchronization is not used.
Today I read that primitive types whose assignment is atomic are an exception. Is that correct?
Maybe I'm not clear about the original idea. Is it simply that another thread might be in the middle of a method where the old value is in use? Or is it more complex than that? For some reason, I had it in my head that each thread somehow maintains its own "view" of memory.
Thanks,
Krum

I think you are mixing two different things here.
The assignment of most types are atomic. They either contain a value or not. This does not nessecarly mean that they are written to the main memory, they could still be in the thread-local memory area. Once they are being transfered, the transferation will also be atomic. Example of non-atomic is that longs and doubles are assigned the first 32 bits and then the rest of the 32 bits. This would for instance if two threads wrote to the shared memory, you could end up with the first 32 bits belonging to the change made in thread 1 and the last 32 bits belonging to thread 2.
So, for a method that is not declared synchronous but assigns one single value before returning is "thread" safe in the aspect that one thread will manipulate the data on at the time. This does not however guarantee order. So, thread 1 can enter the method but not do the assignment, thread 2 enters the method, does the assignment that is imidiatly written over by thread 1. Synchronous would make sure that thread 2 could not enter until thread one written it's change.
There is a reserved keyword 'volatile' in java that has the purpose of warning JVM's that a variable is not allowed to be stored in thread-local memory space, but as far as I know, no JVM implements this functionality properly.
What the article states is that if you only do one assignment or return it will be executed atomically as long as we are not using long or double. It is a bit braver than I would say, since technically an reference assignment can be atomically assigned before the object is actually created (se articles from Doug Lea about the failure of double-checked locking ) and therefor some thread problem could occur as it might use an object before it is actually there.
Regards,
Peter Norell

Similar Messages

  • Transferring primitive data types via UDP other than a String

    Hi ALL,
    I am new to Socket programming in UDP.
    I need to implement a FTP client-server application.
    Now the packet that I need to transfer using UDP as a DatagramPacket consists of multiple primitive data types, (3short types and 1 byte array of size 265.)
    How do I do that?
    All the samples and examples I managed to find on the Internet illustrated the problem of transferring a String type converted to getBytes and the byteArray is transferred.
    However, in my case i need to pass this structure..(3fields) to the other side. If I convert the 4 fields to a single concatenated string there's this problem of finding out where each of the four fields begin and where do they end.
    Please suggest and help...
    thanks..
    : )

    Just create a class that represents your structure and convert-it to a byte array that can be sended over a DatagramSocket.
    Try this sample code :
    import java.io.*;
    import java.net.*;
    public class DP
        /** Creates a new instance of DP */
        public DP ()
         * @param args the command line arguments
        public static void main (String[] args)
            try
                System.out.println ("Starting server ...");
                DatagramServerThread server = new DatagramServerThread ("Datagram server");
                server.start ();
                System.out.println ("Creating your object ...");
                ByteArrayOutputStream baos = new ByteArrayOutputStream (); // Creating byte array output stream ..
                ObjectOutputStream oos = new ObjectOutputStream (baos);// Creating a object output stream that writes to byte array output stream..
                YourStructure newObject = new YourStructure (); // creating your data structure..
                newObject.setShortField1 ((short)12);// setting values ...
                newObject.setShortField2 ((short)45);
                newObject.setShortField3 ((short)4);
                newObject.setArray (new byte [256]);
                oos.writeObject (newObject); // write your structure to object output stream...
                byte data_to_be_sent[] = baos.toByteArray (); // retrieving equivalent byte array...
                // send data...
                DatagramSocket s = new DatagramSocket ();
                System.out.println ("Sending ...");
                DatagramPacket packet = new DatagramPacket (data_to_be_sent, data_to_be_sent.length);
                packet.setAddress (InetAddress.getByName ("localhost"));
                packet.setPort (8888);
                s.send (packet);
            catch (Exception e)
                e.printStackTrace ();
    class YourStructure implements Serializable
         * Holds value of property shortField1.
        private short shortField1;
         * Holds value of property shortField2.
        private short shortField2;
         * Holds value of property shortField3.
        private short shortField3;
         * Holds value of property array.
        private byte[] array;
         * Getter for property shortField1.
         * @return Value of property shortField1.
        public short getShortField1 ()
            return this.shortField1;
         * Setter for property shortField1.
         * @param shortField1 New value of property shortField1.
        public void setShortField1 (short shortField1)
            this.shortField1 = shortField1;
         * Getter for property shortField2.
         * @return Value of property shortField2.
        public short getShortField2 ()
            return this.shortField2;
         * Setter for property shortField2.
         * @param shortField2 New value of property shortField2.
        public void setShortField2 (short shortField2)
            this.shortField2 = shortField2;
         * Getter for property shortField3.
         * @return Value of property shortField3.
        public short getShortField3 ()
            return this.shortField3;
         * Setter for property shortField3.
         * @param shortField3 New value of property shortField3.
        public void setShortField3 (short shortField3)
            this.shortField3 = shortField3;
         * Getter for property array.
         * @return Value of property array.
        public byte[] getArray ()
            return this.array;
         * Setter for property array.
         * @param array New value of property array.
        public void setArray (byte[] array)
            this.array = array;
        public String toString ()
            StringBuffer buffer = new StringBuffer ();
            buffer.append ("Short field 1 is ");
            buffer.append(this.getShortField1 ());
            buffer.append ("\nShort field 2 is ");
            buffer.append (this.getShortField2 ());
            buffer.append ("\nShort field 3 is ");
            buffer.append (this.getShortField3 ());
            buffer.append ("\nYour array field is ");
            for (int index = 0; index < this.getArray ().length; index++)
                buffer.append ("Index [" + index + "] = " + this.getArray () [index] + "\n");
            return buffer.toString ();
    class DatagramServerThread extends Thread
        protected DatagramSocket socket = null;
        public DatagramServerThread (String name) throws IOException
            super (name);
            socket = new DatagramSocket (8888);
        public void run ()
            try
                byte buffer [] = new byte [socket.getReceiveBufferSize ()];
                DatagramPacket packet = new DatagramPacket(buffer, buffer.length);
                System.out.println ("Server is ready. Waiting for packet ...");
                socket.receive(packet); // waiting for packet ...
                System.out.println ("Packet received! : ");
                byte received_data[] = packet.getData ();
                ByteArrayInputStream bais = new ByteArrayInputStream (received_data); // Creating byte array input stream ..
                ObjectInputStream ois = new ObjectInputStream (bais); // Creting Object input stream
                Object readed_object = ois.readObject ();
                YourStructure your_original_object = (YourStructure)readed_object;
                System.out.println (your_original_object.toString ());
                System.out.println ("Exiting server thread. Bye");
                socket.close ();
            catch (Exception e)
                System.err.println ("Server error");
                e.printStackTrace ();
    }

  • JavaScript: Use a dropdown to change visibility of other fields

    Hello
    I'm new here and hope you can help me.
    I have no JavaScript experience. I've tried a lot, but it doesn't work so far.
    I use Adobe Acrobat X (Version 10.1.9).
    My idea:
    A User should select his country in a dropdown. Depending on the user's selection, appears another dropdown. If no country is selected, no other dropdown is visible.
    When the user select the country "England" the dropdown "EnglandAreas" should get visible.
    When the user select the country "Scotland" the dropdown "ScotlandAreas" should get visible.
    etc
    Now I think there are two ways.
    1. For each country it has an own area dropdown. When the user opens the document, all area dropdowns are hidden. The User select his country and a JavaScript set the correct area dropdown visible.
    2. For all countries there is one area dropdown. When the user opens the document, the area dropdown is hidden. The User select his country and a JavaScript fills the area data of the selected country in the area dropdown and set the area dropdown visible.
    Which method makes more sense or is there a third method?
    One of my non-working code (try method 1):
    var co = this.getField("Country");
    var aren = this.getField("AreaEN");
    if (co== "England") {
    event.value = (aren.display = display.visible)
    } else {
    event.value = (aren.display = display.hidden)
    Thanks for all the help.

    Where is that code placed, exactly? It should be something like this:
    // Get a field value and a field object
    var co = this.getField("Country").valueAsString;
    var aren = this.getField("AreaEN");
    // Set the visibility of the AreEN field based on the selected value
    if (co == "England") {
        aren.display = display.visible;
    } else {
        aren.display = display.hidden;
    But the correct code does depend on where it's placed.

  • HT4847 I have a new iphone and cannot delete the backup from icloud.  It says that it is in use.  I have read some of the other threads and it only seems to be haphazard solutions. Is there a definite way to fix this? I am not able to change icloud accoun

    I have a new iphone and cannot delete the backup from icloud.  It says that it is in use.  I have read some of the other threads and it only seems to be haphazard solutions. Is there a definite way to fix this? I am not able to change icloud accounts.

    Follow the steps in wjosten's post here: https://discussions.apple.com/message/13356770#13356770 (for Windows, substitute Outlook in step 2).

  • Saved VI file size changes when data is visible on a graph but not the default value

    If a VI is saved when data is visible on a graph, the file size is larger; even though the default is set to be a blank graph.  I have tested this in LabVIEW 8.6 and 2009.  If you load the larger file, the graph is blank as expected.  If this behavior is by design, it appears odd to me.
    To duplicate the issue:
    Create a blank VI.
    Add a Sine Waveform VI and set the number of samples to 1,000,000.
    Add a Waveform Graph VI that spans the entire monitor and connect it to the output of the Sine Waveform VI.
    Save the VI and note the file size.
    Run the VI.
    Save the VI and compare the size to the original size.
    The VI file size is larger.
    In the Waveform Graph, select “Reinitialize to default value.
    The VI file size returns to It’s original size.

    Your obeservation is correct, and expected behavior.
    This behavior is useful when you have inputs that you would like to set as defaults for the user.
    Obviously, if there is a value to be saved, it will require some memory to store the value.
    If the input is left empty by default, that memory is made available again.
    It may not be easy to think of a good use for this for a graph, but think about for numeric or string controls.
    What if the user isnt sure how they should input a certain parameter or value?
    You could store a default value so they could see how they should input their value.
    Message Edited by Cory K on 09-15-2009 11:12 AM
    Cory K

  • Changing "Created Date" on image and other files.

    I am scanning old family photographs and need to redate all of these photos.  I would like to place them in actual date order, but iphoto doesn't allow that.
    How can I change the "Created Date" on the .jpg files I'm creating on my iMAC?
    Thanks!!
    (And i'm fairly new to the MAC world, "I WAS A PC"..... ;-)

    Hello & a warm welcome to the forums & Macdom!
    There's the terminal method...
    http://danilo.ariadoss.com/howto-change-date-modified-date-created-mac/
    Then a couple of Apps to do it...
    http://www.publicspace.net/ABetterFinderAttributes/
    Mac App Store - File Date Changer 5
    And Automator method...
    http://reviews.cnet.com/8301-13727_7-57411491-263/how-to-batch-rename-files-usin g-automator-in-os-x/

  • One thread adding/updating value  and other thread getting values....issue

    am using a spring bean (singleton) and this is how it looks like
    public class MySingletonService {
    private Map<String, List<TaskVO>> alerts = new HashMap<String, List<TaskVO>>();
    //spring will call this method every 15 minutes
    public void pollDatabase() {
    //initialize the alerts instance variable and create/fill the alerts instance variable with new alerts for the employee(from database) .The key for the hashmap is the employee id
    //some client code (e.g. GUI) will call this method to get the alert for the operator id.This can be called anytime to get the latest info from the alert Map
    public List<TaskAlertVO> getOutstandingAlerts(String operatorId) {
    return alerts.get(operatorId);
    The issue here is that when getOutstandingAlerts is invoked by a thread,some other thread(Spring) calling the pollDatabase method might be updating the value.Please give me some idea and solution to get around this issue.
    I was thinking of creating a copy of alerts instance variable in the getOutstandingAlerts method and then use the copy to find the key and return the alert for that operator id.This way we dont have to worry about data conflict.
    Please advice

    Manjit wrote:
    jtahlborn wrote:
    if the pollDatabase() method is getting a complete new copy of the alerts every time, and the alerts map isn't being modified at all after load, then you can just:
    - make the alerts member variable volatible
    - create a new HashMap each time pollDatabase() is called, fill it in, and then assign it to the alerts member variable. Jtalhorn,I think I got your point.Basically you are suggesting that by creating a brand new map in each pollDatabase operation, then I dont have to worry about get operation ,simply because the client code is still looking at old memory location(old copy) and hence should not worry about values getting changes by pollDatabase method.
    I got it.
    But the small doubt is that why even I should bother about making the instance variable volatile ? Your suggestion should work without making it volatilebecause volatile ensures correct memory visibility between threads. if you didn't use volatile, then a caller to getOutstandingAlerts() could see some partially initialized/corrupt version of the map.

  • Problem writing meta data changes in xmp in spite of enabled settings

    Dear Adobe Community
    After struggling with this for two full days and one night, you are my last hope before I give up and migrate to Aperture instead.
    I am having problems with Lightroom 5 writing meta data changes into xmp and including development settings in JPEG, inspite of having ticked all three boxed in catalog settings.
    In spite of having checked all boxes, Lightroom refused to actually perform the actions. I allowed the save action to take a lot longer than the saving indicator showed was needed, but regardless of this no edits made in the photo would be visible outside Lightroom. I also tried unticking and ticking and restarting my compute.
    Therefore, I uninstalled the program and the reinstalled it again (the trial version both times). I added about 5000 images to Lightroom (i.e. referenced). After having made a couple of changes for one photo in development settings, I tried closing the program. However, then this message was then displayed:
    I left the program open and running for about 5-5 hours, then tried closing the program, but the message still came up so I closed the program and restarted the computer. I tried making changes to another photo, saving and then closing and the same message comes up. The program also becomes unresponsive, and of course still no meta data has been saved to the photo, i.e. when opening it outside Lightroom, the edits of the photos is not shown.
    What do do? I would greatly appreciate any insights, since I have now completely hit the wall.
    Oh yes, that´s right:
    What version of Lightroom? Include the minor version number (e.g., Lighroom 4 with the 4.1 update).
    Lightroom 5.3
    Have you installed the recent updates? (If not, you should. They fix a lot of problems.)
    I installed the program two days ago and then for the second time today.
    What operating system? This should include specific minor version numbers, like "Mac OSX v10.6.8"---not just "Mac".
    Mozilla/5.0 (Macintosh; Intel Mac OS X 10_8_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/31.0.1650.63 Safari/537.36
    What kind(s) of image file(s)? When talking about camera raw files, include the model of camera.
    JPEG
    If you are getting error message(s), what is the full text of the error message(s)?
    Please see screen dumps above
    What were you doing when the problem occurred?
    Trying to save metadata + trying to open images that it seemed I had saved meta data to
    Has this ever worked before?
    No
    What other software are you running?
    For some time Chrome, Firefox, Itunes. Then I closed all other software.
    Tell us about your computer hardware. How much RAM is installed?  How much free space is on your system (C:) drive?
    4 GB 1333 MHz DDR3
    Has this ever worked before?  If so, do you recall any changes you made to Lightroom, such as adding Plug-ins, presets, etc.?  Did you make any changes to your system, such as updating hardware, printers or drivers, or installing/uninstalling any programs?
    No, the problems have been there all the time.

    AnnaK wrote:
    Hi Rob
    I think you succeeded in partly convincing me. : ) I think I will go for a non-destrucitve program like LR when I am back in Sweden, but will opt for a destructive one for now.  Unfortuntately, I have an Olypmus- so judging from your comment NX2 might not be for me.
    Hi AnnaK (see below).
    AnnaK wrote:
    My old snaps are JPEG, but I recently upgraded to an Olympus e-pl5 and will notw (edited by RC) start shooting RAW.
    Note: I edited your statement: I assume you meant now instead of not.
    If you start shooting raw, then you're gonna need a raw processor, regardless of what the next step in the process will be. And there are none better for this purpose than Lightroom, in my opinion. As has been said, you can export those back to Lightroom as jpeg then delete the raws, if storage is a major issue, or convert to Lossy DNG. Both of those options assume you're willing to adopt a non-destructive workflow, from there on out anyway (not an absolute requirement, but probably makes the most sense). It's generally a bad idea to edit a jpeg then resave it as a jpeg, because quality gets progressively worse every time you do that. Still, it's what I (and everybody else) did for years before Lightroom, and if you want to adopt such a workflow then yeah: you'll need a destructive editor that you like (or as I said, you can continue to use Lightroom in that fashion, by exporting new jpegs and deleting originals - really? that's how you want to go???). Reminder: NX2 works great on jpegs, and so is still very much a candidate in my mind - my biggest reservation in recommending it is uncertainty of it's future (it's kinda in limbo right now).
    AnnaK wrote:
    Rob Cole wrote:
    There is a plugin which will automatically delete originals upon export, but relying on plugins makes for additional complication too.
    Which plugin is this?
    Exportant (the option is invisible by default, but can be made visible by editing a text config file). To be clear: I do not recommend using Exportant for this purpose until after you've got everything else setup and functioning, and even then it would be worth reconsidering.
    AnnaK wrote:
    Rob Cole wrote:
    What I do is auto-publish to all consumption destinations after each round of edits, but that takes more space.
    How do you do this?
    Via Publish Services.
    PS - I also use features in 'Publish Service Assistant' and 'Change Manager' plugins (for complete automation), but most people just select publish collections and/or sets and click 'Publish' - if you only have a few collections/services it's convenient enough.
    AnnaK wrote:
    Would you happen to have any tips on which plugins I may want to use together with Photoshop Elements?
    No - sorry, maybe somebody else does.
    Did I get 'em all?
    Rob

  • After importing images from my card using LR 5.4, the GPS data does not show in the metadata panel. However, when I look at the imported images using Bridge, the GPS data is visible. Anybody know why LR is not seeing the GPS data? Camera is Canon 6D.

    After importing images from my card using LR 5.4, the GPS data does not show in the metadata panel. However, when I look at the imported images using Bridge, the GPS data is visible. Anybody know why LR is not seeing the GPS data? Camera is Canon 6D.

    Ok, the issue seem to be solved. The problem was this:
    The many hundred files (raw and xmp per image) have been downloaded by ftp in no specific order. Means - a couple of files in the download queue - both raw and xmps. Most of the time, the small xmp files have been finished loading first and hence the "last change date" of these xmp files was OLDER than the "last change date" of the raw file - Lightroom then seem to ignore the existence of the xmp file and does not read it during import.(a minute is enough to run into the problem)
    By simply using the ftp client in a way that all large raw files get downloaded first followed by the xmp files, we achieved that all "last changed dates" of the xmp files are NEWER than the related raw files. (at least not older)
    And then LR is reading them and all metadata information has been set / read correctly.
    So this is solved.

  • How to determine Default Table Logging (log data changes )

    Does anyone know how to view exactly what tables and related data fields have change logging enabled by default? I know that some of the standard reports will produce "edit reports" show who changed what field, when ,old and new values, etc, but I don't know how to determine where the data is retrieved from.
    For example: If I look in the ABAP Dictionary at table LFA1, technical settings, it shows that log data changes is not "checked" or enabled. But if I run the standard AR Master Data Change Report, I get output showing valid field changes.
    I have seen other threads that refer to SCU3 but I can't determine the above this from report.
    Any assistance would be greatly appreciated.

    Hi Arthur,
    As far as I am aware, these are 2 different things. 
    There is table logging which is at the table level & if activated (i.e. it's listed in table DD0LV, PROTOKOLL=X and the table logging parameter is set in the system profile/s).
    The second one is programatical logging for change documents when data is maintained though a program that has been written to include a log.  I'm not sure how to identify a complete lit of these though unfortunately.
    Hope that is of some assistance.

  • Custom renderer in datagrid, needs to know if data changed

    Hi,
    I am hoping someone can help me out please.
    I have a datagrid that uses a custom renderer that is
    subclassed from a TextInput. When the user changes the data in a
    cell, I need to color the cell. This is so that on a potentially
    big grid, the user can easily see which cells he has made changes
    to.
    It is easy enough to set the color of the itemrenderer by
    using setStyle() inside the overridden set data() method of the
    custom renderer, but that is only a fraction of the solution. Since
    Flex instantiates and destroys custom renderers at will depending
    on if it is scrolled into view by the datagrid, keeping the state
    of whether a value has changed inside the custom rendererer is not
    an option.
    So the only choice I have is to call back from the custom
    renderer into the container that hosts the datagrid. As the
    itemEditEnd event is handled in that container, a list of cells
    that have had their data changed can be stored. The custom renderer
    then needs to call back into the container with its cell
    coordinates and ask if the data has changed, and if it has, set its
    color.
    How can a custom renderer know its cell position as x,y
    coordinates? I see that TextInput implements IListItemRenderer
    interface and has properties x and y, but putting a trace on these
    gives me nonsensical numbers that seem to have no relation to the
    cell coordinates.
    The other thing I need to do is have the custom renderer call
    back into the container that hosts the datagrid to know whether
    data has changed. Is outerDocument the reference? Or is there a
    proper way of doing this?
    Thanks for the help you can give.

    Here is a simplified version of how we track the cell by cell
    changes in a datagrid. It does require you to identify the fields
    that will be editable and maintaining the original data for each
    column in the data source.
    Our production version is much more complex than this but it
    will give you the idea.
    <?xml version="1.0" encoding="utf-8"?>
    <mx:Application
    xmlns:mx="
    http://www.adobe.com/2006/mxml"
    layout="absolute"
    creationComplete="initApp()"
    viewSourceURL="srcview/index.html">
    <mx:Script>
    <![CDATA[
    import mx.binding.utils.BindingUtils;
    import mx.collections.ArrayCollection;
    import mx.core.Application;
    import flash.events.*;
    import mx.events.DataGridEvent;
    import mx.controls.TextInput;
    [Bindable] public var editAC : ArrayCollection = new
    ArrayCollection();
    [Bindable]
    public var somedata:XML = <datum><item>
    <col0>0</col0>
    <col1></col1>
    <col2></col2>
    <col3>2</col3>
    <col4></col4>
    <col5></col5>
    <col6></col6>
    <col0Orig>0</col0Orig>
    <col1Orig></col1Orig>
    <col2Orig></col2Orig>
    <col3Orig>2</col3Orig>
    <col4Orig></col4Orig>
    <col5Orig></col5Orig>
    <col6Orig></col6Orig>
    </item>
    <item>
    <col0></col0>
    <col1></col1>
    <col2></col2>
    <col3></col3>
    <col4></col4>
    <col5></col5>
    <col6></col6>
    <col0Orig></col0Orig>
    <col1Orig></col1Orig>
    <col2Orig></col2Orig>
    <col3Orig></col3Orig>
    <col4Orig></col4Orig>
    <col5Orig></col5Orig>
    <col6Orig></col6Orig>
    </item>
    <item>
    <col0></col0>
    <col1></col1>
    <col2></col2>
    <col3></col3>
    <col4></col4>
    <col5></col5>
    <col6></col6>
    <col0Orig></col0Orig>
    <col1Orig></col1Orig>
    <col2Orig></col2Orig>
    <col3Orig></col3Orig>
    <col4Orig></col4Orig>
    <col5Orig></col5Orig>
    <col6Orig></col6Orig>
    </item>
    <item>
    <col0></col0>
    <col1></col1>
    <col2></col2>
    <col3></col3>
    <col4></col4>
    <col5></col5>
    <col6></col6>
    <col0Orig></col0Orig>
    <col1Orig></col1Orig>
    <col2Orig></col2Orig>
    <col3Orig></col3Orig>
    <col4Orig></col4Orig>
    <col5Orig></col5Orig>
    <col6Orig></col6Orig>
    </item>
    <item>
    <col0></col0>
    <col1></col1>
    <col2></col2>
    <col3></col3>
    <col4></col4>
    <col5></col5>
    <col6></col6>
    <col0Orig></col0Orig>
    <col1Orig></col1Orig>
    <col2Orig></col2Orig>
    <col3Orig></col3Orig>
    <col4Orig></col4Orig>
    <col5Orig></col5Orig>
    <col6Orig></col6Orig>
    </item>
    <item>
    <col0></col0>
    <col1></col1>
    <col2></col2>
    <col3></col3>
    <col4></col4>
    <col5></col5>
    <col6></col6>
    <col0Orig></col0Orig>
    <col1Orig></col1Orig>
    <col2Orig></col2Orig>
    <col3Orig></col3Orig>
    <col4Orig></col4Orig>
    <col5Orig></col5Orig>
    <col6Orig></col6Orig>
    </item>
    </datum>
    private function initApp():void {
    var dgcols:Array = grid1.columns;
    for (var i:int=1;i<12;i++) {
    var dgc:DataGridColumn = new DataGridColumn();
    if(i < 6) {
    dgc.width=60;
    dgc.editable=true;
    dgc.dataField="col" + i.toString() ;
    dgc.rendererIsEditor=true;
    var ir :DGItemRenderer = new DGItemRenderer();
    dgc.itemRenderer = ir;
    else {
    dgc.width=0;
    dgc.visible = false
    dgc.dataField="col" + i.toString() + "orig" ;
    dgcols.push(dgc);
    grid1.columns = dgcols;
    ]]>
    </mx:Script>
    <mx:DataGrid x="31" y="27" width="200" height="150"
    id="grid1" dataProvider="{somedata.children()}"
    horizontalScrollPolicy="on" rowHeight="25"
    editable="true">
    <mx:columns>
    <mx:DataGridColumn headerText="Column 0"
    dataField="col0" width="30" editable="false"/>
    </mx:columns>
    </mx:DataGrid>
    </mx:Application>
    <?xml version="1.0" encoding="utf-8"?>
    <mx:TextInput xmlns:mx="
    http://www.adobe.com/2006/mxml"
    creationComplete="init()"
    implements="mx.controls.listClasses.IDropInListItemRenderer,
    mx.core.IFactory"
    >
    <mx:Script>
    <![CDATA[
    import mx.collections.ArrayCollection;
    import mx.controls.dataGridClasses.DataGridListData;
    public function newInstance():* {
    var ir : DGItemRenderer = new DGItemRenderer();
    return ir;
    override public function set data(value:Object):void
    super.data = value;
    if (value != null) {
    var colName : String= DataGridListData(listData).dataField;
    var valOrig : String = data[colName + "Orig"];
    var val : String = data[colName];
    if(valOrig != val)
    this.setStyle("backgroundColor",0xA7FF3F);
    else
    this.setStyle("backgroundColor", "#ffffff");
    ]]>
    </mx:Script>
    </mx:TextInput>

  • JAX-RPC and non-primitive data types

    Hello all!
    I am using JWSDP v1.3 and i have a problem using non-primitive data types as return types for my operations.
    Consider the helloservice example of the JWSDP1.3 tutorial. Now suppose that instead of having the simple operation sayHello() that returns a String, we execute a query on a database, get some ResultSetMetaData and we want these Metadata to be the return type of our operation. I.e. have the operation
    public ResultSetMetaData sayHello()
    instead of the
    public String sayHello()
    of the tutorial.
    When trying to build the service i get the following error which is normal, because ResultSetMetaData is not a supported JAX-RPC type.
    run-wscompile: [echo] Running wscompile: [echo] C:\jwsdp\apache-ant\../jaxrpc/bin/wscompile.bat -define -d build - nd build -classpath build config-interface.xml -model build/model. gz [exec] error: invalid type for JAX-RPC structure: java.sql.ResultSetMetaData [exec] Result: 1
    Is there any way to define an operation like this? Can i specify somehow ResultSetMetaData as a supported-type?
    I hope someone can give me some advice on it, because i have lost one evening trying to figure it out myself :)
    Regards,
    Kostas

    Courtesy links to crossposts so people don't waste their time answering a question which has already been answered
    http://forum.java.sun.com/thread.jsp?thread=482875&forum=59&message=2253704
    http://forum.java.sun.com/thread.jsp?thread=482873&forum=331&message=2253699

  • Should Java introduce new primitive data types??

    In Java SE 5.0, many character- related methods (especially in the class Character) handle code points by using int type, i.e. return (code point) type is int, or receive (code point) int as parameter. This leads several problems. First, the variable used for storing returned result should be carefully stated, otherwise confusion may arise. Second, the parameters of method should be carefully ordered, otherwise conflict of method signature may meet.
    By those reasons, I suggest that Java should introduce new primitive data types for handling characters, they are:
    1. wchar
    this type states the variable stores 32-bit UNSIGNED integer, and it could be used to store either the code point, or the UTF-16 code of a character.
    2. ascii
    this type states the variable stores 8-bit UNSIGNED integer, and it could be used to store the code point of a elemental (ascii) character.

    short char, no. Nononono.
    No.
    wchar, I think I'd pref to see Java version 2 come
    out, and that be wchar by default, but that is not
    going to happen.
    I don't see a great need for it at this time.http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4504839
    Though I do not think that Java developer would like to change too much program code for using proposed (unsigned) primitive data types, I still believe that Java developer will eventually introduce these types, because it is not efficient to pretend signed integer to unsigned integer, and the success of a programming language is determined by how it can meet the programmers' need.

  • Employee date change after pay roll run

    HI sapiers,
    i have an issue
    one employee join on 10th of the may but in sysytem it was enterd as 13th of the may
    and pay roll was processed to that employee
    now can we change the employe join date now
    if yes how can we do this
    please help me its urrgent
    thanks in advance
    shjish khan

    Hi Shajish,
    There are three scenarios when you may need to change hiring date:
    1) After payroll is run - when hiring date is before actual Hiring date.
    2) After payroll is run when hiring date is after actual Hiring Date.
    3) Before the payroll is run.
    1) PA30 -- Copy actions info type - action type - incorrect entry -- save and come out PA 30 copy actions info type -- action type - correct entry - now correct your entries, save your date is changed.
    2) PA30 - Utilities - change payroll status - delete accounted to field, save and come out - then again utilities change entry leaving date - correct the hiring date - save and come out.
    3) PA30 - Utilities change entry/leaving date change your date and save.
    Try this aslo
    Go to PA30
    Enter personnel number.
    Select action infotype.
    Select subtype hire mini master record.
    Change to new date.
    Under reasons, select new position.
    Click save.
    Please refer the below links:
    http://help.sap.com/saphelp_470/helpdata/en/48/35c5c34abf11d18a0f0000e816ae6e/content.htm
    http://help.sap.com/saphelp_470/helpdata/en/48/35c5c34abf11d18a0f0000e816ae6e/frameset.htm
    http://help.sap.com/saphelp_46c/helpdata/en/1b/3e5c16470f11d295a100a0c9308b52/frameset.htm
    Also we have several threads in the forum related to this.
    http://scn.sap.com/thread/1185695
    http://scn.sap.com/thread/1185695
    http://scn.sap.com/thread/2012142
    http://scn.sap.com/thread/1466306
    Thanks,
    Madhav

  • JTabel, detecting data changes

    Hi,
    I am new to the JTable component... I have set up a JTabel which displays some sample information. I have to display results I get from one of my methods... There is the Swing/JTable tutorial at http://java.sun.com/docs/books/tutorial/uiswing/components/table.html#modelchange ("Detecting Data Changes"), however, the necessary code has been removed from the tutorial! I hope you can help me...
    I have set up the following table:
    public class InfoDialog extends JDialog {
         String[] columnNames = {"Type", "Value"};
         Object[][] data = {
                   {"Angle", "90"},
                   {"Speed", "50"},
         public InfoDialog() {
              Container cp = this.getContentPane();
              setLayout(new BoxLayout(cp, BoxLayout.PAGE_AXIS));
              JTable table = new JTable(data, columnNames);
              table.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
              JPanel tablePanel = new JPanel();
              tablePanel.setLayout(new BorderLayout());
              tablePanel.add(table.getTableHeader(), BorderLayout.PAGE_START);
              tablePanel.add(table, BorderLayout.CENTER);
    (...)From one of my other classes, GameStart, one of the methods, calculateAngle, returns the measured angle. I would like to display this result in the appropriate cell.
    In the Swing tutorial I just can read "You can see the code for that method in [PENDING: The Bingo example has been removed.]"
    So I am a little bit confused. I think I have to first extend AbstractTableModel, then I have something to do with fireTableCellUpdated... Can you maybe show me a working example or is this "Bingo example" from the Swing available elsewhere?
    Thanks for your help!

    so I can't extend AbstractTableModel... Why are you trying to do this?I first followed the example given by Sunan.N (reply #6).
    Here is a complete working example:
    http://forum.java.sun.com/thread.jspa?forumID=57&threa
    dID=566133Thanks for this example. As a newbie I still have one problem: how can I set the a new value? I use the table.getModel().setValueAt(...) method... but which code goes into the tableChanged method and which into the setValueAt method?
    Here is my code:
    public class InfoDialog extends JDialog implements TableModelListener {
         private static final long serialVersionUID = 1L;
         public JTable table;
            String[] columnNames = {"Type", "Value"};
         Object[][] data = {
                   {"Angle", "90"},
                   {"Speed", "50"},
         public InfoDialog {
              Container cp = this.getContentPane();
              setLayout(new BoxLayout(cp, BoxLayout.PAGE_AXIS));
              Dimension dim_topPanel = new Dimension(300, 150);
              JPanel topPanel = new JPanel();
              topPanel.setPreferredSize(dim_topPanel);
              topPanel.setBackground(Color.YELLOW);
              DefaultTableModel model = new DefaultTableModel(rowData, columnNames);
              model.addTableModelListener(this);
              table = new JTable(model);
              table.setPreferredScrollableViewportSize(table.getPreferredSize());
              JPanel tablePanel = new JPanel();
              tablePanel.setLayout(new BorderLayout());
              tablePanel.add(table.getTableHeader(), BorderLayout.PAGE_START);
              tablePanel.add(table, BorderLayout.CENTER);
              cp.add(topPanel);
              cp.add(tablePanel);
              setDefaultLookAndFeelDecorated(false);
              try {
                   UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
              } catch(Exception e) {
                   e.printStackTrace();
              setResizable(false);
              setDefaultCloseOperation(DISPOSE_ON_CLOSE);
              pack();
              setLocationRelativeTo(null);
              setVisible(true);
         public void tableChanged(TableModelEvent e) {
              System.out.println("Table change");          
         public void setValueAt(Object aValue, int row, int column) {
    }What do I have to do to change, e.g., "Speed" from 50 to 60? I call the setValueAt method like this: table.getModel().setValueAt(60, 2, 2); but what do I have to write into my setValueAt method? I thought that my table will automatically change the value when calling the setValueAt method...?
    The tableChanged method is being called when a value in my table changes... OK, but what should I do with this method? I just would like to set a new value...
    :confused:

Maybe you are looking for

  • Calling Database Functions

    Hi All, Just wondering whether anyone has experienced problems in calling a database function. We have Forte 3.0.L.2 and Oracle 8.1.7. Here's how the function is being called: l_tdCurrentStatus = (SQL EXECUTE PROCEDURE me_status.get_status(input I_MC

  • Reg Header in loop

    hi All, i want to Print Header in multiple pages using Folder in loop. and that loop contains multiple folders and loops in side. in Folder events i selected Header and Start of table and at Page break. but it is triggering only Start of table event

  • RMI Exceptions

    Hello, I am new to java RMI, I have written a simple program, I can run Server without problems, but when I try to run Client I get these exceptions: Exception in thread "main" java.security.AccessControlException: access denied (java.net.SocketPermi

  • Query Documentation

    Hi All, I have requirement to display User Guide or some documentation / description for reports already published in Portal as iview. Can you please suggest me how i can display custom documents at query level? How can i edit  or add some descriptio

  • Suggestion for init scripts

    I like the simplified sysvinit scripts that Arch uses, but I think the file locations could be improved a bit.  /etc should be reserved for configuration files only; when you put init scripts in there as well the /etc folder gets a little cluttered.