Search Results

Search found 11972 results on 479 pages for 'writing'.

Page 32/479 | < Previous Page | 28 29 30 31 32 33 34 35 36 37 38 39  | Next Page >

  • Uploading or writing to files contained within s3

    - by Chase
    We have a widget that needs to be hosted on s3 due to a bunch of hoopla that isn't relevant to the issue. I'd explain if it was worth the time. Problem is it calls an external XML file for part of its content. The XML file is accessible if it is local on s3 but I cannot get my php file to write to it on s3. The widget could also be useful if I could access the xml file elsewhere but s3 does not seem to permit this. Suggestions? Here's the error I'm getting when trying to write to S3. [function.fopen]: failed to open stream: HTTP wrapper does not support writeable connections.

    Read the article

  • Writing complex records to file

    - by DrSobhani
    Hi I have defined some records in my project which may be consisted of other records and also dynamic arrays of normal data types and other records , it is n example of a record type Type1=record x:integer; end; Type2=record Y:array of X; str:string; end; When I tried to save one of variables of these records type to file with blockwrite function like this : var Temp1:Type2; begin setlength(temp1.y,100); blockwrite(MyFile,Temp1,sizeOf(Temp1); it just wrote as much as the size of pure record is ,but temp1 has a dynmic arrays which is resized , Could someone please tell me how I can write a complex record to a file , I mean something like what is used in VB6 . Thanks

    Read the article

  • File writing problem on Windows 7 Professional in c#

    - by Ummar
    I have an application in C# which I write some data to file. I am facing the problem on windows 7 professional that when I write data to C:\ProgramData, Access denied acception is thrown. If I login from an administrator account this issue vanishes, and if I login from some other account who have administrative previlages this issue comes up. This issue is only produces on windows 7 professional, it is working fine on all other flavors of windows 7 as well as windows vista. try { XmlTextWriter myXmlTextWriter = new XmlTextWriter("Configuration.xml", null); myXmlTextWriter.Formatting = Formatting.Indented; myXmlTextWriter.WriteStartDocument(true); myXmlTextWriter.WriteDocType("ApplicationConfigurations", null, null, null); ////myXmlTextWriter.WriteComment("This file represents another fragment of a book store inventory database"); myXmlTextWriter.WriteStartElement("Configuration"); myXmlTextWriter.WriteElementString("firstElement", pe.ToString()); myXmlTextWriter.WriteEndElement(); myXmlTextWriter.WriteEndDocument(); myXmlTextWriter.Flush(); myXmlTextWriter.Close(); }catch(Exception e) { //Exception is thrown in Win7 professional }

    Read the article

  • C: writing the following code into functions

    - by donok
    Dear respected programmers. Please could you help me (again) on how to put the following code into functions for my program. I have read on-line and understand how functions work but when I do it myself it all goes pear shaped/wrong(I am such a noob). Please could you help with how to for example to write the code below into functions.(like opening the input file). My attempt: void outputFile(int argc, char **argv) { /* Check that the output file doesnt exist */ if (stat(argv[argc-1], &inode) != -1) { printf("Warning: The file %s already exists. Not going to overwrite\n", argv[argc-1]); return -1; } /*Opening ouput files*/ file_desc_out = open(argv[i],O_CREAT | O_WRONLY | O_EXCL , S_IRUSR|S_IWUSR); if(file_desc_out == -1) { printf("Error: %s cannot be opened. \n",argv[i]); //insted of argv[2] have pointer i. return -1; } } Any help on how I would now reference to this in my program is appreciated thank you. I tried: ouputfile(but I cant figure out what goes here and why either).

    Read the article

  • python writing a list to a file

    - by gfar90
    I need to write a list to a file in python. I know the list should be converted to a string with the join method, but since I have a tuple I got confused. I tried a lot to change my variables to strings etc, this is one of my first attempts: def perform(text): repository = [("","")] fdist = nltk.FreqDist(some_variable) for c in some_variable: repository.append((c, fdist[c])) return ' '.join(repository) but it gives me the following error: Traceback (most recent call last): File "", line 1, in qe = perform(entfile2) File "", line 14, in perform return ' '.join(repository) TypeError: sequence item 0: expected string, tuple found any ideas how to write the list 'repository' to a file? Thanks!

    Read the article

  • Writing a generic function that can take a Writer as well as an OutputStream

    - by ebruchez
    I wrote a couple of functions that look like this: def myWrite(os: OutputStream) = {} def myWrite(w: Writer) = {} Now both are very similar and I thought I would try to write a single parametrized version of the function. I started with a type with the two methods that are common in the Java OutputStream and Writer: type Writable[T] = { def close() : Unit def write(cbuf: Array[T], off: Int, len: Int): Unit } One issue is that OutputStream writes Byte and Writer writes Char, so I parametrized the type with T. Then I write my function: def myWrite[T, A[T] <: Writable[T]](out: A[T]) = {} and try to use it: val w = new java.io.StringWriter() myWrite(w) Result: <console>:9: error: type mismatch; found : java.io.StringWriter required: ?A[ ?T ] Note that implicit conversions are not applicable because they are ambiguous: both method any2ArrowAssoc in object Predef of type [A](x: A)ArrowAssoc[A] and method any2Ensuring in object Predef of type [A](x: A)Ensuring[A] are possible conversion functions from java.io.StringWriter to ?A[ ?T ] myWrite(w) I tried a few other combinations of types and parameters, to no avail so far. My question is whether there is a way of achieving this at all, and if so how. (Note that the implementation of myWrite will need, internally, to know the type T that parametrizes the write() method, because it needs to create a buffer as in new ArrayT.)

    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

  • Writing a file shredder in python or ruby?

    - by pmilb21
    In the effort to learn python and/or ruby, I was wondering how a file shredder would be implemented? I would like it to take in a file as an argument and then employ an algorithm to make that file unrecoverable. Would possibly add the support for multiple files or even whole directories later.

    Read the article

  • Problem with reading and writing to binary file in C++

    - by Reem
    I need to make a file that contains "name" which is a string -array of char- and "data" which is array of bytes -array of char in C++- but the first problem I faced is how to separate the "name" from the "data"? newline character could work in this case (assuming that I don't have "\n" in the name) but I could have special characters in the "data" part so there's no way to know when it ends so I'm putting an int value in the file before the data which has the size of the "data"! I tried to do this with code as follow: if((fp = fopen("file.bin","wb")) == NULL) { return false; } char buffer[] = "first data\n"; fwrite( buffer ,1,sizeof(buffer),fp ); int number[1]; number[0]=10; fwrite( number ,1,1, fp ); char data[] = "1234567890"; fwrite( data , 1, number[0], fp ); fclose(fp); but I didn't know if the "int" part was right, so I tried many other codes including this one: char buffer[] = "first data\n"; fwrite( buffer ,1,sizeof(buffer),fp ); int size=10; fwrite( &size ,sizeof size,1, fp ); char data[] = "1234567890"; fwrite( data , 1, number[0], fp ); I see 4 "NULL" characters in the file when I open it instead of seeing an integer. Is that normal? The other problem I'm facing is reading that again from the file! The code I tried to read didn't work at all :( I tried it with "fread" but I'm not sure if I should use "fseek" with it or it just read the other character after it. Forgive me but I'm a beginner :(

    Read the article

  • how to start writing a very simple programming language

    - by Rex Homming
    Recently, I was going around looking for ideas on what I can build using C this summer and I came across this post: http://stackoverflow.com/questions/1257376/interesting-project-to-learn-c Implement a programming language. This doesn't have to be terribly hard - I did the language that must not be named - but it will force you to learn a lot of the important parts of C. If you don't want to write a lexer and/or parser yourself, you can use lex/flex and yacc/bison, but if you plan on that you might want to start with a somewhat smaller project. I was kinda intrigued about the implementing a programming language answer and I'm wondering how do I go about starting this? I've gone through the whole K&R book and I've done some of the exercises as well. I also have a bit of experience in C++ and Java if that matters. Any tips? Thanks!

    Read the article

  • Need Help Writing SQL query

    - by user204588
    I have two product tables Product1 and Product2. There is a one 2 one mapping on the field ProductId. What I want is to get all the product ids where the Product2.Exported field is false AND Where the product ids that are in Product1 but not in Product2 table. Right now I have two queries that I'm trying to mash into one. SELECT ProductId FROM Product1 WHERE ProductId NOT IN(Select ProductId From Product2) SELECT ProductId FROM Product2 WHERE Exported = 0

    Read the article

  • VBScript Writing to Server Text File

    - by Keyfer Mathewson
    I have created a VBScript which pulls the service tag, username, and computer name from a computer. What I need to do now is compile this information in a text document. How it's set up is as follows: We have an Active Directory Server, with a folder for login scripts. I have created a batch file to run this .vbs script, and the script works well so far. What I now need is for a file on the AD server, called "logging.txt", to be populated with the information that is created with the .vbs script. This is the script I have so far: 'Get Dell Service Tag Info set ProSet = GetObject("winmgmts:").InstancesOf("Win32_BIOS") Set ProSet1 = GetObject("winmgmts:").InstancesOf("Win32_SystemEnclosure") For each Pro in ProSet For each Pro1 in ProSet1 ServiceTag=Pro.SerialNumber wscript.echo ServiceTag exit for Next exit for Next 'get username and computername, could also be asked in a batch Set oShell = WScript.CreateObject("WScript.Shell") Set oShellEnv = oShell.Environment("Process") sComputerName = oShellEnv("ComputerName") sUsername = oShellEnv("username") wscript.echo sComputerName & " " & sUsername Thank you very much in advance!

    Read the article

  • Writing Content Between Firefox Tabs

    - by GregH
    I am trying to write some values that I extract from a page (via JS/JQuery) opened in a tab in Firefox, to another opened page in a different tab within Firefox. Is this possible? Basically, I am trying to write some values I extract to a Google document that I have open in a different tab. I can see the "document" value in the DOM for my Google Document is something like: Doc?docid=0AQyS4r3XWCQ7ZGZ3dnE2OHNfMTNmcHE2OHAzMg&hl=en Can I just write to that document?

    Read the article

  • Accessing a file (for writing) from a JBoss Web Service

    - by Andreas Grech
    Let's say I have this structure of my Java Web Application: TheProject -- [Web Pages] -- -- abc.txt -- -- index.jsp -- [Source Packages] -- -- [wservices] -- -- -- WS.java WS.java is my Web Service, which is situated in a wservices package. Now from this service, I need to access the abc.txt file and write to it. These are my urls: http://127.0.0.1:8080/TheProject/WS <- the webservice http://127.0.0.1:8080/TheProject/abc.txt <- the file I want to access To read the file, I tried with getResourceAsStream and I was successful in reading from it. But now I also want to write to this file, and I tried such a method but failed. Is there a way I can get access to the abc.txt file from WS.java and be able to successfully read from and write to it?

    Read the article

  • Picture.writeToStream() not writing out all bitmaps

    - by quickdraw mcgraw
    I'm using webview.capturePicture() to create a Picture object that contains all the drawing objects for a webpage. I can successfully render this Picture object to a bitmap using the canvas.drawPicture(picture, dst) with no problems. However when I use picture.writeToStream(fos) to serialize the picture object out to file, and then Picture.createFromStream(fis) to read the data back in and create a new picture object, the resultant bitmap when rendered as above is missing any larger images (anything over around 20KB! by observation). This occurs on all the Android OS platforms that I have tested 1.5, 1.6 and 2.1. Looking at the native code for Skia which is the underlying Android graphics library and the output file produced from the picture.writeToStream() I can see how the file format is constructed. I can see that some of the images in this Skia spool file are not being written out (the larger ones), the code that appears to be the problem is in skBitmap.cpp in the method void SkBitmap::flatten(SkFlattenableWriteBuffer& buffer) const; It writes out the bitmap fWidth, fHeight, fRowBytes, FConfig and isOpaque values but then just writes out SERIALIZE_PIXELTYPE_NONE (0). This means that the spool file does not contain any pixel information about the actual image and therefore cannot restore the picture object correctly. Effectively this renders the writeToStream and createFromStream() APIs useless as they do not reliably store and recreate the picture data. Has anybody else seen this behaviour and if so am I using the API incorrectly, can it be worked around, is there an explanation i.e. incomplete API / bug and if so are there any plans for a fix in a future release of Android? Thanks in advance.

    Read the article

  • C# character counter when writing to new line

    - by Mike
    Basically i'm trying to read a really big text file and when the charecters of the line reach X amount write to a new line, but i can't seem to get the charecter count to work. Any help is appricated! using (FileStream fs = new FileStream(betaFilePath,FileMode.Open)) using (StreamReader rdr = new StreamReader(fs)) { while (!rdr.EndOfStream) { string betaFileLine = rdr.ReadLine(); int stringline = 0; if (betaFileLine.Contains("þTEMP")) { //sb.AppendLine(@"C:\chawkster\workfiles\New Folder\GEL_ALL_PRODUCTS_CONCORD2.DAT"); string checkline = betaFileLine.Length.ToString(); foreach (string cl in checkline) { stringline++; File.AppendAllText(@"C:\chawkster\workfiles\New Folder\GEL_ALL_PRODUCTS_CONCORD3.DAT", cl); if(stringline == 1200) { File.AppendAllText(@"C:\chawkster\workfiles\New Folder\GEL_ALL_PRODUCTS_CONCORD3.DAT","\n"); stringline = 0; } } } } foreach (string cl in checkline) Error 1 Cannot convert type 'char' to 'string'

    Read the article

  • Writing a simple incrementer counter in rails

    - by Trip
    For every Card, I would like to attach a special number to them that increments by one. I assume I can do this all in the controller. def create @card = Card.new(params[:card]) @card.SpecNum = @card.SpecNum ++ ... end Or. I can be blatantly retarded. And maybe the best bet is to add an auto-incremement table to mysql. The problem is the number has to start at a specific number, 1020. Any ideas?

    Read the article

  • Get file size of BufferedImage before writing the data

    - by David
    I'm working on a Java program that needs to send an image (preferably in PNG format, though I could perhaps use another format if necessary) over the network. The logical way to do this is, of course, to first send the length of the PNG image data, then the data itself. Problem: I don't see any method in ImageIO or anywhere else that will give me the length of the image data. Does this exist somewhere in the Java 1.6 standard library? I know I could just write it to a ByteArrayOutputStream and get the length of the resulting array, but before resorting that I wanted to make sure I'm not missing something built in. And besides, that makes an extra copy of the image data, which I'd rather not do if it's not necessary.

    Read the article

  • Help needed in writing regular expression using TCL

    - by user330727
    Hello Everyone, Just seeking a favour to write a regular expression to match the following set of strings. I want to write an expression which matches all the following strings TCL ( XYZ XZZ XVZ XWZ ) Clue : Starting string is X and Z ending string is same for all the pairs. Only the middle string is differs Y Z V W. My trial: [regexp {^X([Y|Z|V|W]*)Z$}

    Read the article

  • TSQL Writing into a Temporary Table from Dynamic SQL

    - by Jeff
    Consider the following code: SET @SQL1 = 'SELECT * INTO #temp WHERE ...' exec(@SQL1) SELECT * from #temp (this line throws an error that #temp doesn't exist) Apparently this is because the exec command spins off a separate session and #temp is local to that session. I can use a global temporary table ##temp, but then I have to come up with a naming scheme to avoid collisions. What do you all recommend?

    Read the article

  • Writing an AI for a turn-based board game

    - by Cyril
    Hi, i'm currently programming a board game (8x8) in which I need to develop an AI. I have read a lot of articles about AI in board games, minmax with or without alphabeta pruning, but I don't really know how to implements this, I don't know where to start... About my game, this is a turn-based game, each player has pieces on the board, they have to pick one and choose in moving this piece (1 or 2 cells max) or clone the piece (1 cell max). At the moment, I have a really stupid AI which choose a random piece then choose a random move to play... Could you please give me some clues, on how to implement this functionality ? Best regards

    Read the article

< Previous Page | 28 29 30 31 32 33 34 35 36 37 38 39  | Next Page >