Modify text file by different user?

My AIR Application create one text file under Administrator. but guest user cannot modify that text file.The code is below
var file:File = new File("file:///D:/BALA /test.txt ");
var str = String(Math.round(Math.random()*9)+1);
var fileStream:FileStream = new FileStream();
fileStream.openAsync(file, FileMode.WRITE);
fileStream.writeUTFBytes(str);
fileStream.close();
Can any one solve this issue?
Thanks
Regards
Balasubramaniyan.S

The AIR app has the OS rights of the user account used to run the app.

Similar Messages

  • How do I prevent sharing a text file by different users

    Hello,
    I am using LV8.6.1 and writing this application that read and write to a text file. The application is being used by many users at different sites and I want to prevent writing to the text file when other user is already using it (reading or writing to it). The other user should only be able to use it when it's not being read or getting written.
    Any suggestions? I know LV file function 'Set Permissions' won't work. I need a file attribute that tells that the file is open, so don't use it.

    I think the only real obtion is one I've seen some other programs use.
    Create a lock file in the same directory.
    1.  You want to open myfile.txt.
    2.  Your program looks to see if myfile.lck is present.  (Same filename, just the extension is different)
    3.  If it is present, you don't open the file or you give a warning.
    4.  If it is not present, you create a myfile.lck file.  It could be a small text file.  Perhaps you place in it the user name of the person who is opening the file.
    5.  When your VI is done with the file and "closes" it, your VI deletes the myfile.lck file.
    So the presence of the myfile.lck file indicates the file is being used.
    The absence of the myfile.lck indicates the file is available to be used.
    The only risk is if somehow the person who "takes out" the file somehow ends their application unexpectedly and the .lck file doesn't get deleted even though they are done.  You would need to manually go in and delete the .lck file.  But username data in the .lck could help determine who had the file last and you could confirm if they are really using it or not.  Putting the filedate in the warning information would help determine if it was a recent lock, or an old lock that is likely stale.

  • DSC powershell xwindowsprocess to execute batch file under different user account

    DSC powershell run under "NT AUTHORITY\SYSTEM".
    I am trying to execute a batch file under different user account using xwindowsprocess in DSC resource kit.
    I created a custom dsc resource with 3 parameters namely Exepath, Arguments, Credential.
    I received those parameter values in settargetresource method.
    CallPInvoke
    [Source.NativeMethods]::CreateProcessAsUser(("$ExePath "+$Arguments), $Credential.GetNetworkCredential().Domain, $Credential.GetNetworkCredential().UserName, $Credential.GetNetworkCredential().Password)
    I tested it by invoking a batch file and writing username under which it executes to a text file.
    After executing, the output text file still contains the "Systemname$".

    Configuration Sample_xService_ServiceWithCredential
    param
    [string[]]
    $nodeName = 'localhost',
    [System.String]
    $Name,
    [System.String]
    [ValidateSet("Automatic", "Manual", "Disabled")]
    $StartupType="Automatic",
    [System.String]
    [ValidateSet("LocalSystem", "LocalService", "NetworkService")]
    $BuiltInAccount="LocalSystem",
    [System.Management.Automation.PSCredential]
    $Credential,
    [System.String]
    [ValidateSet("Running", "Stopped")]
    $State="Running",
    [System.String]
    [ValidateSet("Present", "Absent")]
    $Ensure="Present",
    [System.String]
    $Path,
    [System.String]
    $DisplayName,
    [System.String]
    $Description,
    [System.String[]]
    $Dependencies
    Import-DscResource -Name MSFT_xServiceResource -ModuleName xPSDesiredStateConfiguration
    Node $nodeName
    xService service
    Name = $Name
    DisplayName = $DisplayName
    Ensure = $Ensure
    Path = $Path
    StartupType = $StartupType
    Credential = $credential
    $Config = @{
    Allnodes = @(
    Nodename = "localhost"
    PSDSCAllowPlainTextPassword = $true
    #Sample Scenarios
    $credential = Get-Credential
    Sample_xService_ServiceWithCredential -ConfigurationData $Config -Name "Sample Service" -DisplayName "Sample Display Name" -Ensure "Present" -Path "C:\DSC\TestService.exe" -StartupType Automatic -Credential $credential
    ¯\_(ツ)_/¯

  • Sharing files for different users on same computer without duplicating

    Newbie here, I got my 1st mac (in ten years) last week and have been really enjoying it. I set up 3 user's accounts and wanted to share files such as iphoto and itune for all users. So I put my pictures in the shared folder, however, when I opened iphoto in each user's account, I had to import all the photos for every user, which resulted in duplicated files on each user's folders. I have tens of thousands of photos and don't want redundant files eat up my hard drive space. For this reason I'm holding off sharing my itune files.
    I'm wondering if there's a way to allow access for different users without making duplicates.
    20 in. imac   Mac OS X (10.4.8)  

    ewrspotter
    Preferably only admin can edit/import
    Well this makes things very easy and is the way that iPhoto is intended to share. In your Admin account, go to iPhoto -> Preferences -> Sharing and enable Sharing. Note that you can share an entire library or just individual albums. Leave iPhoto running and use Fast-User Switching to move to the other Account(s). In Launch iPhoto and go to Preferences -> Sharing and enable 'Look for Shared Photos'. The main library will turn up in the Source (or left-hand) pane of the other iPhoto.
    Remember that for this to work, the Admin account must be logged in and iPhoto must be running there.
    I don't really care as long as there's no redundant files.
    Define 'redundant'. You do realise that iPhoto is a database, with built-in image viewer, lightweight editor and version control. Version control means that if you modify a photo then iPhoto makes a copy, including the changes, and keeps the Original. This way you can always Revert to Original from the Photos menu. Many people switching to iPhoto are confused by this at first. If you don't want version control I strongly suggest using a different app. There a many, many image viewers for the Mac.
    As to your point comment about One-Touch DVD. I'm not familiar with that piece of Software, but every DVD (and CD) that you burn is assembled on the HD first, then burned. That assembly is a cache file and should be trashed on completion.
    As to disk space: you need to keep about 10 gigs of space on the Start-Up disk for Virtual memory, Temp files and other OS uses. If you do get an external at some point in the future it is possible to run both iPhoto and iTunes from it to free up space on the internal. Just check the help or post back to the relevant forum before moving them. It's not difficult, but there is a procedure that needs to be followed.
    Regards
    TD

  • Scenario or adapter to sending a text file to different target directories

    Hi experts
    In XI 3.0 I have developed a file2file scenario that takes a comma-separated file (*.csv) and converts it and returns a text file that is sent to a specific directory, the name input file determines the Target Directory, for each input file there is a sender channel and receiver channel that put the output file in the Target Directory. The problem is that i have many channels and not know how to make only one sender channel which takes the input file and the receiver channel to sends the output file to the destination directory through the file name. e.g. VTAS03.csv file located in target directory //work becomes in Clients.txt file in the directory //sap03 ie //work/VTAS03.csv --> //sap03/Clients.txt while the file VTAS05.csv must go to the directory //sap05 i.e. //work/VTAS05.csv --> //sap05/Clients.txt, //work/VTAS07.csv --> //sap07/Clients.txt so on.
    In short the output file name is the same for all but must go to different directories according to the input file name without using as many channels of communication.
    Someone can help me or tell me how to do this?
    Thanks  

    Liz,
    Please use the below steps if you are considering of using mapping program.
    Select the check boxes for the following Adapter Specific Message attributes in
    Sender Channel - FILE
    Receiver Channel - DIRECTORY
    Put the file name as Clients.txt in receiver channel , and directory name can be anything like TEST
    DynamicConfiguration conf = (DynamicConfiguration) container
        .getTransformationParameters()
        .get(StreamTransformationConstants.DYNAMIC_CONFIGURATION);
    DynamicConfigurationKey key = DynamicConfigurationKey.create(
        "http://sap.com/xi/XI/System/File",
        "Directory");
    DynamicConfigurationKey key1 = DynamicConfigurationKey.create(
        "http://sap.com/xi/XI/System/File",
        "FileName");
    String temp = conf.get(key1);
    String src_filname = temp.substring(4,5) //This is used to get the last two digit value from the file name
    String tar_dir = "//sap"+src_filename+"/";
    conf.put(key,tar_dir);
    return "";
    I hope the above suggestion solves your problem!
    Thanks!

  • Is SAP capable of sending a TEXT file in different modes like DOS ?

    Is SAP capable of sending a TEXT file (.txt)  in different modes like DOS ?

    Yes SAP is capable to send .txt file in different mode.
    For this you have to maintain the setting of Code page and encoding. There so may types of encoding (UTF-8, UTF-8 without BOM, UTF-16 etc) supported by SAP. You can check them from SAP logon pad.
    If you are creating the file on application server then you can also mentioned encoding statement in OPEN DATASET statements.
    For more details check open dataset statement.

  • Write arrays into a text file in different columns at different times

    Hi,
              I have a problem write data into a text file. I want to write 4 1D arrays into a text file. The problem is that I need to write it at different time and in different column (in other word, not only append the arrays).
    Do you have an idea to solve my problem?
    Thank you

    A file is long a linear string of data (text). In order ro insert columns, you need to rewrite the entire file, because colums are interlaced over the entire lenght of the file.
    So:
    read file into 2D array
    insert columns using array operations
    write resulting 2D array to file again.
    (Only if your colums are guaranteed to be fixed width AND you know the final number of colums, you could write the missing columns as spaces and then overwrite later. Still, it will be painful and inefficient, because column data are not adjacent in the file.)
    LabVIEW Champion . Do more with less code and in less time .

  • How to create different log files for different users in log4j

    I want to create different logs for different users, using different appenders for each user so that logs are created in his file only.
    Confusion:How to direct them to different files in my logger class

    Hi Avi,
    First of all I have given a first reading to log4j and I think there will some more easy way of logging debugging messages than log4j (If you could provide me a detailed explanation of a servlet,jsp,java bean that uses log4j and how to use log4j then it will be very helpful for me). The other easy ways (if I am not using log4j) to my problem i.e creating different log files for each of web applications deployed in oc4j are
    I have created multiple instances of OC4J that are configured to run on different ports and so on each instance I have deployed a single web application . And I started the 2 oc4j instances by transferring thier error/log messages to a file. And the other way is ..
    I have download from jakarta site a package called servhelper . This servhelper is a thread that is started in a startup servlet and stopped in the destroy method of that startup servlet. So this thread will automatically capture all the system.out.println's and will print those to a file. I believe that this thread program is synchronized. So in this method I need not run multiple instances of OC4J instead each deployed web application on single instance of oc4j uses the same thread program (ofcourse a copy of thread program is put in each of the deployed web applications directories) to log messages on to different log files.
    Can you comment on my above 2 approached to logging debugging messages and a compartive explanation to LOG4J and how to use LOG4J using a simple servlet, simple jsp is appreciated ...
    Thanks and Regards,
    Ravi.

  • Are plain text files treated differently in SP 2010 than MOSS 2007?

    We just moved to SP 2010 a week ago.  A user just contacted us asking why the files she accesses are not displaying.
    When she accessed these plain text files in MOSS 2007, they displayed within IE as a full page of text.
    When she accesses these now in SP 2010, she is prompted to download the file.
    These files do not end in .txt - they are names such as 2013.09.20 or whatever.
    Is there a way to configure 2010 to display, without any interpretation, plain text files within the browser?
    Thank you.

    Hi ,
    According to your description, my understanding is that you could not access the txt files with browser after migrading to SharePoint 2010..
    Whether this issue occurred if you upload a new txt file to a library.
    In my testing, everything worked well. The Open Documents in Client Applications by Default feature was acitve, and in the Library Settings->Advanced settings, ‘Use the server default(Open in the client application)’ was selected. When I clicked the file
    name, it promted a dialog like the below, I selected ‘Read-Only’, and clicked OK, the file could open with browser.
    Please go to IE->Tools->Internet Options->Programs->Manage add-ons, enable all add-ons related to SharePoint, compare the result.
    I hope this helps.
    Thanks,
    Wendy
    Wendy Li
    TechNet Community Support

  • Writing or modifying text files in java

    Dear all,
    I have the next text file:
    goods: 5
    bids: 4
    % num, price, good, good, ..., good, #
    0 2075 1 4 #
    1 3000 1 2 3 4 #
    2 520 3 #
    3 3000 2 3 4 #
    I have to modify or create the file above, using output data from one java program. For example, The output of my java program in the next execution is:
    goods: 8
    and price (0) changes from 2075 to 2078.
    so, using this output data my java program should write (create or modify) the next text file with the changes:
    goods: 8
    bids: 4
    % num, price, good, good, ..., good, #
    0 2078 1 4 #
    1 3000 1 2 3 4 #
    2 520 3 #
    3 3000 2 3 4 #
    I have tried using: output.write( objetc );
    but it doesn't work as I need :( .
    Somebody can help me or give me some idea?
    Thanks,
    Andrea

    This is the code:
    File testFile = new File("D:\\result1.txt");
    setContents(testFile, " bla bla bla (few characters) ");
    static public void setContents(File aFile, String aContents)
    throws FileNotFoundException, IOException {
    try {
    //use buffering
    output = new BufferedWriter( new FileWriter(aFile) );
    output.write( aContents );
    finally {
    //flush and close both "output" and its underlying FileWriter
    if (output != null) output.close();
    I mean, this code dont work because it let me write few characters only. I need to write the whole file:
    goods: 8
    bids: 4
    % num, price, good, good, ..., good, #
    0 2078 1 4 #
    1 3000 1 2 3 4 #
    2 520 3 #
    3 3000 2 3 4 #
    with the special characters as (#).
    Sorry, if it post is not clear.
    Thanks.

  • Saving text file at different rate

    Hello all,
    I am a little bit new to LabView, so maybe this question is trivial, but is giving me a lot of pain.
    I want to continuously save a given string at two different rates; in the example provided these rates are at every 500 ms and 50 ms, in two different text files (one for each rate). I tried to use while structured loops for this purpose. When I use only one, it works fine, but when I use both of them at the same time, it seems Labview limits both paths to the lowest speed, which in this case is obviously 500 ms, and eventually I obtain two exact files with the string saved at 500 ms period.
    How can I make it work?
    Thanks in advance.

    You still have ways to go for a more reasonable code.
    For example, typically you want to open the files before the loop, keep appending inside the loops, and close the files after the loop, when the program stops. Now you don't even need to set the file position inside the loops because it will automatically keep writing right after the previous write position. This is much more efficient than to open and close the file with each iteration.
     

  • Share the same files to different users over the network

    Hi,
    I have a server running in my home network and want to share my photos accross the network. The photos have to be accessable from linux and windows clients and from different user accounts. The filesystem to share is btrfs right now. I would like to stick to it, but if this should turn out to be an issue, I will change it to s.th. else. I could use samba with a dedicated samba user or ftp, but both solutions feel hacky to me. Is there a better approach to the problem?
    Thanks,
    Wolfgang
    Last edited by ReedWood (2013-09-13 08:32:26)

    Personally I'd go with an ftp server since I got that to work in the past but samba might do a decent job, too (don't know, never used it). But you can also just set up a web server to share your pics (maybe with a nice gallery web app?). The technology used itself does not matter that much.
    Now, on to the important question: What about security? Do you need some kind of authentication or can you get away without any login stuff (since no bad guys can connect to your network anyway)?
    FYI I used vsftp and pam as described at http://www.cyberciti.biz/tips/centos-re … users.html to get my ftp server running. You might be able to expand this to other solutions as well. I had to password protect my ftp server since I wanted to have write permission, too. For read only I might have been fine with anonymous ftp back then.

  • Load Multiple Dynamic Text Files in Different frames on Maintimeline

    Hello!
    I have managed to load an external text file in one place one the maintimeline. I would like to do the same thing on other frames. When I go to duplicate the same thing that I did on the first one I get a duplicate textReq request. Do I need to give the textReq a more specific name for each section? When I did this the movie wouldn't even recognize and of the code that was working before.
    Can anyone help me with this code? Thanks in advance
    I am attaching link so you can see sections I am talking about. Also you will notice that the swf file I loaded won't go away. That's another problem...ugh.
    Here is link:
    http://www.sandraschmitt.com/coclico/index100.html
    Here is code on maintimeline:
    stop();
    import fl.transitions.*;
    import fl.transitions.easing.*;
    import flash.net.URLRequest;
    import flash.display.Loader;
    import flash.events.Event;
    import flash.events.ProgressEvent;
    function startLoad() {
        var swfLoader:Loader = new Loader();
        var swfRequest:URLRequest = new URLRequest("endlessCoclico3.swf");
        swfLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, onCompleteHandler);
        swfLoader.contentLoaderInfo.addEventListener(ProgressEvent.PROGRESS, onProgressHandler);
        swfLoader.load(swfRequest);
    function onCompleteHandler(loadEvent:Event) {
        addChild(loadEvent.currentTarget.content);
    function onProgressHandler(swfProgress:ProgressEvent) {
        var percent:Number = swfProgress.bytesLoaded/swfProgress.bytesTotal;
        trace(percent);
    startLoad();
    //handle events for buttons...
    collections.addEventListener(MouseEvent.CLICK, clickSection);
    raison.addEventListener(MouseEvent.CLICK, clickSection);
    stores.addEventListener(MouseEvent.CLICK, clickSection);
    news.addEventListener(MouseEvent.CLICK, clickSection);
    contact.addEventListener(MouseEvent.CLICK, clickSection);
    home.addEventListener(MouseEvent.CLICK, clickSection);
    function clickSection(evtObj:MouseEvent) {
        //trace shows what's happening... in the output window
        trace("The "+evtObj.target.name+" button was clicked!");
        //go to the section clicked on...
        gotoAndStop(evtObj.target.name);
    Here is code on actual frame where the dynamic text is working:
    //Loaded exteranl text fields
    var textLoader:URLLoader = new URLLoader();
    var textReq:URLRequest = new URLRequest("text_philosophy.txt");
    function textLoaded(event:Event):void {
        philosophy_txt.text = textLoader.data;
    textLoader.load(textReq);
    textLoader.addEventListener(Event.COMPLETE, textLoaded);

    Textfields:  What I like to do, mainly for peace of mind, is to have a layer that I dedicate to actionscript that only has code in frame 1 but it extends the full length of the timeline so that this code is available to every frame on any other layer.  In this frame I put variables and functions that can get used/shared wherever they happen to be needed.  I usually create another separate layer for actions types of actionscript... stuff that happens at the local frame level, like stop();, or like assigning a variable a new value, etc... things local to being at that frame/location.  So with that in mind
    In frame 1 on my shared-by-everyone layer, I'd probably declare the variable....
    var textReq:URLRequest;
    And when I get to a particular frame where I want to load a new textfield with data, I assign that var its value on the local actions layer...
    textReq = new URLRequest("text_philosophy.txt");
    along with the rest of the local execution regarding loading the file, etc...
    SWF's:
    Yeah, pretty much, and it becomes an object that has a home on the timeline, so if you move away from that frame the swf doesn't follow.

  • Sharing files between different users on same computer

    how do I go about sharing files between two users on the same computer?
    also, what about iTunes, can I transfer songs between users, or do I have to pay for it everytime, even though it's on the same computer?

    You can control sharing of a user's itune library in the sharing preference. It is good for users on the same computer and the same local network (usually your house of small office).
    As for files on another users folder, they have to either change the permissions of the parent folder (get info) or put the file to be shared into the public folder.

  • Callback event for modified text file

    I am looking for a way to register, in LabVIEW, an event that signals when a text file has been changed by a 3rd party software. I could use the 'File/Directory Info' LV primitive in a loop to let me know when the file has been changed but that would be very inefficient. Does someone know of a COM object that would let me 'stream' the changes of the text file or that allowed me to register an ActiveX callback event?
    Chris_Mitchell
    Product Development Engineer
    Certified LabVIEW Architect

    Archimedes wrote:
    I am looking for a way to register, in LabVIEW, an event that signals when a text file has been changed by a 3rd party software. I could use the 'File/Directory Info' LV primitive in a loop to let me know when the file has been changed but that would be very inefficient. Does someone know of a COM object that would let me 'stream' the changes of the text file or that allowed me to register an ActiveX callback event?
    If you know C/C++ well, take a look Window API: FindFirstChangeNotification.
    You can find it doc on MSDN.
    George Zou
    http://gtoolbox.yeah.net
    George Zou
    http://webspace.webring.com/people/og/gtoolbox

Maybe you are looking for

  • How to get changes of a custom PL/SQL package updated in ISG?

    Hi All, I need some help on how to change a custom PL/SQL package in ISG integration repository: I already uploaded my custom PL/SQL package to the integration repositoy some time ago. Now I have made some changes to PL/SQL record/table types defined

  • Ipod not working on ITunes :S

    My Ipod Touch is fairly new.. but it has been connected to Itunes many times. Today, i connected my Ipod and it came up with the message: "Iphone detected, but has not been identified. Please disconect, reconnect and try again" 1) Its a Ipod Touch no

  • How do you find the range of a counter and what do you mean by time limit

    hi can any one please tell me how to find the range of a counter for an 6025e DAQ board thanks

  • ABAP Web Services Exception Valorization in SOAP Fault Message

    Hi, I created a Custom Function Module in ABAP with a custom exception ( "Exception1) in exception list (including a short text description of the exception ("This is the first exception!!!")). I exposed it as web services by means of 'Web service AB

  • Badi in ecc6.0

    screen in se18 and se19 in ECC6.0 is different from ECC5.0    so please guide me step by step to build badi in ecc6.0         rahul siemens