Search Results

Search found 15210 results on 609 pages for 'technical writing'.

Page 44/609 | < Previous Page | 40 41 42 43 44 45 46 47 48 49 50 51  | Next Page >

  • 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

  • Writing to CSV issue in Spyder

    - by 0003
    I am doing the Kaggle Titanic beginner contest. I generally work in Spyder IDE, but I came across a weird issue. The expected output is supposed to be 418 rows. When I run the script from terminal the output I get is 418 rows (as expected). When I run it in Spyder IDE the output is 408 rows not 418. When I re-run it in the current python process, it outputs the expected 418 rows. I posted a redacted portion of the code that has all of the relevant bits. Any ideas? import csv import numpy as np csvFile = open("/train.csv","ra") csvFile = csv.reader(csvFile) header = csvFile.next() testFile = open("/test.csv","ra") testFile = csv.reader(testFile) testHeader = testFile.next() writeFile = open("/gendermodelDebug.csv", "wb") writeFile = csv.writer(writeFile) count = 0 for row in testFile: if row[3] == 'male': do something to row writeFile.writerow(row) count += 1 elif row[3] == 'female': do something to row writeFile.writerow(row) count += 1 else: raise ValueError("Did not find a male or female in %s" % row)

    Read the article

  • Help needed in writing regular expression -- 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 i) ( 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$}] I want to write an another regexp which catches/matches only the following string wherever comes ii) (XYZ) My trial: [regexp {^X([Y]*)Z$}]

    Read the article

  • What I need to know for writing a Camera Component

    - by Delphawi
    I want to write a component that uses 2 webcams (1 integrated in my laptop , the other is a USB webcam) What do I need to know (or have) to build a component to deal with the cameras (capture , record , movement recognition , and other image and video processing) ? and how ? (with C++ or Delphi) I just need to know the concepts and main techniques , any good resources or source codes would be great :) Thank you .

    Read the article

  • writing a shell script if statement to check for directory

    - by user1553248
    I need to write a script that will recreate my opt folder if it gets deleted when I remove a package from it. Here's a link to my previous post: dpkg remove to stop processes Now, the issue I'm running into could be better described here: http://lists.debian.org/debian-devel/2006/03/msg00242.html I was thinking of just adding a postrem script which checks if an opt directory exists, and if not, creates one. My experience with shell scripts is pretty limited though..

    Read the article

  • Writing a unique identifier to script?

    - by dannycab
    I'd like to write a subscript that adds a unique identifier (machine time) to a script everytime that it runs. However, each time I edit the script (in IDLE) the indetifiers are over-written. Is there a elegant way of doing this. The script that I wrote appears below. import os, time f = open('sys_time_append.py','r') lines = f.readlines() f.close() fout = open('sys_time_append.py','w') for thisline in lines: fout.write(thisline) fout.write('\n#'+str(time.time())+' s r\n') fout.close() Thanks for any help.

    Read the article

  • Writing Great Software

    - by 01010011
    Hi, I'm currently reading Head First's Object Oriented Analysis and Design. The book states that to write great software (i.e. software that is well-designed, well-coded, easy to maintain, reuse, and extend) you need to do three things: Firstly, make sure the software does everything the customer wants it to do Once step 1 is completed, apply Object Oriented principles and techniques to eliminate any duplicate code that might have slipped in Once steps 1 and 2 are complete, then apply design patterns to make sure the software is maintainable and reusable for years to come. My question is, do you follow these steps when developing great software? If not, what steps do you usually follow inorder to ensure it's well designed, well-coded, easy to maintain, reuse and extend?

    Read the article

  • writing structs and classes to disk

    - by Phenom
    The following function writes a struct to a file. int btwrite(short rrn, BTPAGE *page_ptr) { long addr; addr = (long) rrn * (long) PAGESIZE + HEADERSIZE; lseek(btfd, addr, 0); return (write(btfd, page_ptr, PAGESIZE)); } The following is the struct. typedef struct { short keycount; /* number of keys in page */ int key[MAXKEYS]; /* the actual keys */ int value[MAXKEYS]; /* the actual values */ short child[MAXKEYS+1]; /* ptrs to rrns of descendants */ } BTPAGE; What would happen if I changed the struct to a class, would it still work the same? If I added class functions, would the size it takes up on disk increase?

    Read the article

  • Perl, FastCGI and writing uploaded files

    - by ibogdanov
    My upload function looks like: sub Upload_File{ my ($file, $mime, $description) = @_; my $file_name = param('filename'); my $data; $file = UnTaint($file); if ($mime =~ /text/) { sysopen(VAULT, "$path/$file", O_RDWR | O_EXCL | O_CREAT | O_TEXT) or die "couldn't create $file for R/W: $!\n"; } else { sysopen(VAULT, "$path/$file", O_RDWR | O_EXCL | O_CREAT | O_BINARY) or die "couldn't create $file for R/W: $!\n"; } my $upfh = \*VAULT; flock $upfh, 2; seek $upfh, 0, 0; select((select($upfh), $| = 1)[0]); while( sysread($file_name, $data, 8192) ) { syswrite($upfh, $data, 8192) or die "couldn't write $upfh: $!\n"; } close $upfh; } When I am using read and print with FastCGI upload script, files uploaded with corruptions (including simple text files), this is because perl uses buffered I/O. But when I use syswrite and sysread i.e. non-buffered I/O, as a result I get good text files, but binary files are corrupted anyway.

    Read the article

  • Writing at the end of file

    - by user342534
    Hi, I'm working on a system that requires high file I/O performance (with C#). Basically, I'm filling up large files (~100MB) from the start of the file until the end of the file. Every ~5 seconds I'm adding ~5MB to the file (sequentially from the start of the file), on every bulk I'm flushing the stream. Every few minutes I need to update a structure which I write at the end of the file (some kind of metadata). When flushing each one of the bulks I have no performance issue. However, when updating the metadata at the end of the file I get really low performance. My guess is that when creating the file (which also should be done extra fast), the file doesn't really allocates the entire 100MB on the disk and when I flush the metadata it must allocates all space until the end of file. Guys/Girls, any Idea how I can overcome this problem? Thanks a lot!

    Read the article

  • Writing a script with the cmd prompt.

    - by Josh
    I'm trying to make a script that will place a list (in a .csv file) of processes that are running that take up more than 10 mb of RAM and shows the time + date the script was run. My teacher did this during his lecture but I can't remember how he did it. Just trying to figure out how to be better at IT. So my question is, can anyone help me with this? I don't even know where to start.

    Read the article

  • writing into a file in c.

    - by mekasperasky
    i have an char array b[20] which i want to write into a file . After every iteration the value of b[20] changes , so i would like to write the string in each line of the file in each iteration . So how can i change a new line in a file and also put in a array of character?

    Read the article

  • writing 'bits' to c++ file streams

    - by Sorush Rabiee
    How can i write 'one bit' into a file stream or file structure each time? is it possible to write to a queue and then flush it ? is it possible with c# or java? this was needed when i try to implement an instance of Huffman codding. i can't write bits into files. so write them to a bitset and then (when compression was completed) write 8-bit piece of it each time (exclude last one).

    Read the article

  • Writing a file by a webservice

    - by mouthpiec
    Hi, I have a wevservice, and I would like to write logs into a textfile. My problem is that i do not know what path to give when creating the streamwriter: TextWriter tw = new StreamWriter("????"); Can you please help what path I should enter?

    Read the article

  • Java: Writing a DOM to an XML file (formatting issues)

    - by Vhaerun
    I'm using org.w3c XML API to open an existing XML file. I'm removing some nodes , and I'm adding others instead . The problem is that the new nodes that are added are written one after another , with no newline and no indentation what so ever. While it's true that the XML file is valid , it is very hard for a human to examnine it. Is there anyway to add indentation , or at least a newline after each node ?

    Read the article

  • Writing a script for reading many .csv files with similar filenames

    - by wahalulu
    I have several .csv files with similar filenames except a numeric month (i.e. 03_data.csv, 04_data.csv, 05_data.csv, etc.) that I'd like to read into R. I have two questions: Is there a function in R similar to MATLAB's varname and assignin that will let me create/declare a variable name within a function or loop that will allow me to read the respective .csv file - i.e. 03_data.csv into 03_data data.frame, etc.? I want to write a quick loop to do this because the filenames are similar. As an alternative, is it better to create one dataframe with the first file and then append the rest using a for loop? How would I do that?

    Read the article

  • c++ unicode writing is not working

    - by Jugal Kishore
    I am trying to write some Russian unicode text in file by wfstream. Following piece of code has been used for it. wfstream myfile; locale AvailLocale("Russian"); myfile.imbue(AvailLocale); myfile.open(L"d:\\example.txt",ios::out); if (myfile.is_open()) { myfile << L"?????? ????" <<endl; } myfile.flush(); myfile.close(); Something unrecognizable is written to the file by executing this code, I am using VS 2008.

    Read the article

  • Writing Logs to an XML File with .NET

    - by JL
    I am storing logs in an xml file... In a traditional straight text format approach, you would typically just have a openFile... then writeLine method... How is it possible to add a new entry into the xml document structure, like you would just with the text file approach?

    Read the article

  • Writing a C++ wrapper for a C library

    - by stripes
    I have a legacy C library, written in an OO type form. Typical functions are like: LIB *lib_new(); void lib_free(LIB *lib); int lib_add_option(LIB *lib, int flags); void lib_change_name(LIB *lib, char *name); I'd like to use this library in my C++ program, so I'm thinking a C++ wrapper is required. The above would all seem to map to something like: class LIB { public: LIB(); ~LIB(); int add_option(int flags); void change_name(char *name); ... }; I've never written a C++ wrapper round C before, and can't find much advice about it. Is this a good/typical/sensible approach to creating a C++/C wrapper?

    Read the article

  • Writing a collection to Excel

    - by jame
    I'm working in VS2005 and I need the C# syntax write to write collection values in an Excel sheet. I initialize the collection like this: Reports oReports =new Reports();//oReports is a collection Assuming that this collection has values, how would I write them to Excel?

    Read the article

< Previous Page | 40 41 42 43 44 45 46 47 48 49 50 51  | Next Page >