Search Results

Search found 24117 results on 965 pages for 'write'.

Page 22/965 | < Previous Page | 18 19 20 21 22 23 24 25 26 27 28 29  | Next Page >

  • Why use buffers to read/write Streams

    - by James Hay
    Following reading various questions on reading and writing Streams, all the various answers define something like this as the correct way to do it: private void CopyStream(Stream input, Stream output) { byte[] buffer = new byte[16 * 1024]; int read; while ((read = input.Read(buffer, 0, buffer.Length)) > 0) { output.Write(buffer, 0, read); } } Two questions: Why read and write in these smaller chunks? What is the significance of the buffer size used?

    Read the article

  • How to write this kind of INI file

    - by menok
    I want to write a ini. file in MFC ,and I know those typical methods with section names, key names and key values. I`m wondering how to write a ini file which contains only a section name. a ini file like below ... [section] ... I have tried the function writeprivateprofilestring() with two NULL parameters but it failed.

    Read the article

  • Read/Write versus Create/Read/Update/Delete permissions difference

    - by archmeta
    From a practical standpoint, is there any real-world difference between Read/Write permissions and Create/Read/Update/Delete permissions? It would seem that if a user had the ability to 'create', he should always have the ability to 'update' or 'delete'? If this is correct, then read/write should always be sufficient, and there is no need to store separate Create/Read/Update/Delete permissions? Are there any real-world use cases in which a user should be given permissions to create but not update, or update but not delete, etc...?

    Read the article

  • Write Mysql tables to XML : Security Issue

    - by jasmine
    I want to make a news portal(php) with minimum mysql force. :create a cron, fetch data from mysql and write to a php file . (I dont know is it right way) But Can I use xml instead of php file? Write mysql data to xml. Is this a secure way? What is the best way? XML or php file? Thanks in advance

    Read the article

  • Write string to fixed-length byte array in C#

    - by toasteroven
    somehow couldn't find this with a google search, but I feel like it has to be simple...I need to convert a string to a fixed-length byte array, e.g. write "asdf" to a byte[20] array. the data is being sent over the network to a c++ app that expects a fixed-length field, and it works fine if I use a BinaryWriter and write the characters one by one, and pad it by writing '\0' an appropriate number of times. is there a more appropriate way to do this?

    Read the article

  • Simple stream read/write question in java

    - by Marius
    Hi, I'm trying to upload a file via URLConnection, but i need to read/write it as a binary file without any encoding changes. So i've tried to read byte[] array from FileInputStream, but now i have an issue. The PrintWriter object i use for outputing to the server does not allow me to do writer.write(content) (where content is of type byte[]). How can i fix this? Or is there another way to quickly copy binary data from a FileInputStream to a PrintWriter? Thank you

    Read the article

  • How to write submit form in another manner?

    - by user281180
    I have the follwing: <% using (Ajax.BeginForm("ChangePassword", new AjaxOptions { OnComplete = "ChangePasswordComplete" })) {% <%Html.RenderPartial("ChangePassword"); % <input type="submit" value="test" /> <%} % I want to write it in the following manner: <form> <%Html.RenderPartial("ChangePassword"); %> <input type="submit" value="test" /> </form> How can I do that? What to write in the form tag

    Read the article

  • How to write contents of a rails database to external file

    - by user1296787
    I'm trying to have rails send the contents of my database to an external textfile. I wanted this done everytime a new user is created. However, when i try to do the following in my user.rb model file, before_save :write_data def write_data() File.open("data.txt", "w") do |myfile| myfile.write(User.all) end end It doesn't write the actual contents of the database, instead, it displays something like this User:0x109858540 Can anyone help? Thanks.

    Read the article

  • Ruby - How to write a new file with output from script

    - by Sam
    I have a simple script that does some search and replace. This is basically it: File.open("us_cities.yml", "r+") do |file| while line = file.gets "do find a replace" end "Here I want to write to a new file" end As you can see I want to write a new file with the output. How can I do this?

    Read the article

  • How to write into registry using VC++ 2010 ?

    - by rajivpradeep
    HKEY CURRENT USER \software \microsoft\ windowsNT \CurrentVersion\ AppCompatFlags "application path" = RUNASXP3 I want to create an application which runs in default XP mode on windows 7 when i run the application so, i want to write into the registry as in the link above. I am building the application in VC++ 2010, i want to write into the above registry through the program, so that when i run the program it runs in XP mode. How to do this..?

    Read the article

  • How to write to a remote domain

    - by user347743
    Hello, I have a domain www.example.com In the domain, www.example.com/write directory is chmod to 777. Now, suppose, if I want to create a new directory like www.example.com/write/new from www.some-domain.com, what should I be doing. I know PHP, Python. Please relate the answers to this.

    Read the article

  • .NET: IOException for permissions when creating new file?

    - by Rosarch
    I am trying to create a new file and write XML to it: FileStream output = File.Create(Path.Combine(PATH_TO_DATA_DIR, fileName)); The argument evaluates to: C:\path\to\Data\test.xml The exception is: The process cannot access the file 'C:\path\to\Data\test.xml' because it is being used by another process. What am I doing wrong here? UPDATE: This code throws the same exception: StreamWriter writer = new StreamWriter(Path.Combine(PATH_TO_DATA_DIR, fileName)); UPDATE 2: The file I am trying to create does not exist in the file system. So how can be it in use?

    Read the article

  • PList Chicken/Egg Scenario

    - by David van Dugteren
    Hi, I want to read/write to cache.plist If I want to read an existing premade plist file stored in the resources folder I can go: path = [[NSBundle mainBundle] bundlePath]; NSString *finalPath = [path stringByAppendingPathWithComponent@"cache.plist"]; NSMutableDictionary *root = ... But then I wish to read it from the iPhone. Can't, the Resources folder is only readable. So I need to use: NSDocumentDirectory, NSUserDomain,YES So how can I have my plist file preinstalled to the Document Directory location? Thus meaning I don't have to mess around with untidy code copying the plist file over at startup. (Unless that's the only way).

    Read the article

  • Shell script to name videos on device

    - by Jordan
    I have a .sh script that automounts any usb device that is plugged in. I need it to also find if there are videos in a certain location on the device that is plugged in then write them to a videos.txt file. Here's what I have and its not working. Also I need it to put the mountpoint in the videos.txt file. ${MOUNTPOINT}$count is the path to the mounted device. VIDEOS=ls ${MOUNTPOINT}$count/dcim/100Video | grep mp4 if [ "$VIDEOS" -ne "" ] ; then "${MOUNTPOINT}$count" > ${MOUNTPOINT}$count/videos.txt; "$VIDEOS" >> ${MOUNTPOINT}$count/videos.txt; fi What am I doing wrong?

    Read the article

  • Php writing to file - empty ?

    - by The Devil
    Hey, I've been struggling with writing a single string into a file. I'm using just a simple code under Slackware 13: $fp = fopen('/my/absolute/path/data.txt', 'w'); fwrite($fp, 'just a testing string...'); fclose($fp); The file gets created (if it's not already created) but it's empty ?! The directory in which this file is written is owned by apache's user & group (daemon.daemon) and has 0777 permissions. This has never happened to me before. I'm curious what's the reason I'm not able to write inside the file ? Thanks in advance.

    Read the article

  • Need to change ip address in app.config in runtime without runnning as admin

    - by djerry
    Hey guys, There's a lot of post saying how to change info in the app.config and there are posts that say you shouldn't edit info in the app.config but store info in user folders. I understand these topics. But what i want is a combination of both. I have a wcf setup for my client in an app.config, which contains the endpoint address to which it should connect. When The server changes ip, or when a client is installed on a computer in another company, the user should be able to insert another ip-address which should be stored in the app.config. This cannot be stored in a file in appdata or something like that, as the client reads the info in the app.config on startup. How can i write (so remember the new ip-address) in the app.config when the client is installed in program files, the UAC is enabled and the program isn't run as an admin? Thanks in advance.

    Read the article

  • download file in iframe in IE

    - by Estelle
    in a webpage I have a link to let the user download file, such as, "showfile.aspx?filename=xxx" in showfile.aspx, I send the file using Response.OutputStream.Write method. now I get some problem when somebody put this webpage in an IFrame and open in IE, as I checked the code, showfile.aspx is requested twice when clicks the link, and in the second time the cookies of authorization and session Id are missing. I tried to add the p3p header but not working. my question is, is this how the IE designed with iframe? is there anyway to work around? thanks.

    Read the article

  • reading unformatted fortran file in matlab - which precision?

    - by Griff
    I have just written out a file: real*8 :: vol_cel real*8, dimension(256,256,256) :: dense [... some operations] open(unit=8,file=fname,form="unformatted") write(8)dense(:,:,:)/vol_cell close(8) dense and vol_cell are real*8 variables. My code to read this in in Matlab: fid = fopen(fname,'r'); mesh_raw = fread(fid,256*256*256,'double'); fclose(fid); The min and max values clearly show that it is not reading it in correctly (Min is 0 and max is a largish positive real*8). min = 3.3622e+38 max = -3.3661e+38 What precision do I need to set in Matlab to make it read in the unformatted Fortran file? A somewhat related question: This Matlab code I am using reads binary files OK but not unformatted files. Though I am generating this new data on my Mac OSX using gfortran. It doesn't recognize form="binary" so I can't do it that way. Do I need to add some library?

    Read the article

  • Writing photos (and other things) to disk and getting them later in iphone

    - by ebabchick
    I'm trying to write an image to disk: NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES); NSString *documentsPath = [paths objectAtIndex:0]; NSString* savePath = [documentsPath stringByAppendingPathComponent:@"photo"]; BOOL result = [data writeToFile:savePath atomically:YES]; if(result) NSLog(@"Save of photo success!"); Then, later, I try to retrieve for a table view cell image: NSData* getPhoto = [NSData dataWithContentsOfFile:[leaf content]]; UIImage* myImage = [UIImage imageWithData:getPhoto]; cell.imageView.image = myImage; Yes, I checked to make sure the [leaf content] returns the same NSString as savePath. What else could be the problem? [NSData dataWithContentsOfFile:[leaf content]]; returns nil.... Thanks guys

    Read the article

  • Which is the best and appropriate way to write the code in Winforms ?

    - by Harikrishna
    What is the best way to write the code ? (1) Like directly writing the code in the button_click() event. or (2) Make the function of that code which I write in button_click() event and write this function in one class and then that function I should call in the button_Click() event.Like is it called three-tired approach to write the code ? Like in button_Click() event I write the code to save the records in csv file from datatable.So I should write that code in button_Click() event or I should make one new function and one new class and write that code in that function which is the new class and calling that function in button_Click() event. This is only one example but I am talking about all the code written in my application that which is the appropriate and best way to write the code and what are the benefits ? Note that I write the code in Winforms with c#.

    Read the article

  • Flash CS4/AS3 Writing local file from local game without save dialog prompt?

    - by dragonridingsorceress
    I'm writing a game to be run locally, on the user's computer. NOT over the internet. I want to have a file that will hold the usernames and avatar indices (they're in an array). I want to know if there's a way to write to files through Flash with AS3. I'm using CS4. I'd also like to know if you can delete files through Flash, though that's just optional. Thanks in advance for any help you can give.

    Read the article

  • Graphite SQLite3 DatabaseError: attempt to write a readonly database

    - by Anadi Misra
    Running graphite under apache httpd, with slqite database, I have the correct folder permissions [root@liaan55 httpd]# ls -ltr /var/lib | grep graphite drwxr-xr-x. 2 apache apache 4096 Aug 23 19:36 graphite-web and [root@liaan55 httpd]# ls -ltr /var/lib/graphite-web/ total 68 -rw-r--r--. 1 apache apache 65536 Aug 23 19:46 graphite.db syncdb also seems to have gone fine [root@liaan55 httpd]# sudo -su apache bash-4.1$ whoami apache bash-4.1$ python /usr/lib/python2.6/site-packages/graphite/manage.py syncdb /usr/lib/python2.6/site-packages/graphite/settings.py:231: UserWarning: SECRET_KEY is set to an unsafe default. This should be set in local_settings.py for better security warn('SECRET_KEY is set to an unsafe default. This should be set in local_settings.py for better security') /usr/lib/python2.6/site-packages/django/conf/__init__.py:75: DeprecationWarning: The ADMIN_MEDIA_PREFIX setting has been removed; use STATIC_URL instead. "use STATIC_URL instead.", DeprecationWarning) /usr/lib/python2.6/site-packages/django/core/cache/__init__.py:82: DeprecationWarning: settings.CACHE_* is deprecated; use settings.CACHES instead. DeprecationWarning Creating tables ... Creating table account_profile Creating table account_variable Creating table account_view Creating table account_window Creating table account_mygraph Creating table dashboard_dashboard_owners Creating table dashboard_dashboard Creating table events_event Creating table auth_permission Creating table auth_group_permissions Creating table auth_group Creating table auth_user_user_permissions Creating table auth_user_groups Creating table auth_user Creating table django_session Creating table django_admin_log Creating table django_content_type Creating table tagging_tag Creating table tagging_taggeditem You just installed Django's auth system, which means you don't have any superusers defined. Would you like to create one now? (yes/no): yes Username (leave blank to use 'apache'): root E-mail address: [email protected] Password: Password (again): Superuser created successfully. Installing custom SQL ... Installing indexes ... Installed 0 object(s) from 0 fixture(s) bash-4.1$ exit and the local-settings.py file is as follows STORAGE_DIR = '/var/lib/graphite-web' INDEX_FILE = '/var/lib/graphite-web/index' DATABASES = { 'default': { 'NAME': '/var/lib/graphite-web/graphite.db', 'ENGINE': 'django.db.backends.sqlite3', 'USER': '', 'PASSWORD': '', 'HOST': '', 'PORT': '' } } I still get this error [Sat Aug 23 19:47:17 2014] [error] [client 10.42.33.238] File "/usr/lib/python2.6/site-packages/django/db/backends/sqlite3/base.py", line 344, in execute [Sat Aug 23 19:47:17 2014] [error] [client 10.42.33.238] return Database.Cursor.execute(self, query, params) [Sat Aug 23 19:47:17 2014] [error] [client 10.42.33.238] DatabaseError: attempt to write a readonly database not sure what is missing in this configuration

    Read the article

< Previous Page | 18 19 20 21 22 23 24 25 26 27 28 29  | Next Page >