Search Results

Search found 4783 results on 192 pages for 'txt'.

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

  • How to compare if string has a enter key in the end using jquery/javascript?

    - by user144842
    I have a string value from a user input box. I have to figure out if last char is a enter key (line feed). Thats the code. Here I am checking if last char has a whitespace. Now I also have to check if last char is enter key (carriage return or line feed). How can i do this? var txt = $get("<%= txtUserText.ClientID %>"); if (txt.value.substring(txt.value.length -1) !== ' ' || <checkifLastCharIsEnterKey>) //my code to take action **I don't think i need a keypress or keyup event because this above piece of code is not invoked at the time of user input.

    Read the article

  • Help with variables and new lines, and quoting in a bash script

    - by Scott
    I would like to automate the following svn command. Note this command produces the desired results on my system - Ubuntu 10.04, svn 1.6.6, bash shell, when issued from the command line: svn ci -m $'Added new File: newFile.txt\nOrig loc: /etc/networking/newFile.txt' /home/user/svnDir/newFile.txt I would like to run that command in a bash script, assuming that the original full path to the file is contained in the variable $oFileFull, and the filename is in $oFileName. The script is executed from the svn directory. I need to allow for the possibility that the file name and or path contain spaces. so the line inside my shel script might look like: svn ci -m$'Added new file: ${oFileName}\nOrig loc: ${oFileFull}' ${oFileName} But I want the variables (which may contain spaces) expanded before the command is executed, and I cannot figure out how to do this while enclosing the svn comment in single quotes which is necessary in order to get the new line in the subversion comment log. I am pulling my hair out trying to figure out how to properly quote and assemble this command. Any help appreciated.

    Read the article

  • how do you load files in windows phone 7?

    - by matt
    do you seriously have to make your own content pipeline project for every single type of file you want to load? Microsoft just seem to be pretending that the iphone doesn't exist (even though they are now paying devs to port between them). I'm trying to port my game from the iphone to winmo7, and I already have a nice asset pipeline set up for exporting textures in the exact format we want (16 bit fmts ect) I just want to be able to open a file and read it, just like I would on any other platform. I have tried System.IO.File.OpenText("atextfile.txt"), but it says that function is "RESTRICTED!!!!" I have tried just adding the txt file to the content project, setting its properties to "content" and "copy always" and then trying to open it doing this.Content.Load("atextfile.txt"); with and without the extension, says it can't find the file.

    Read the article

  • How to open new window and write data into that

    - by B. Kumar
    I want to write some selected date in another window. For that i wrote JavaScript code like that.... function Writer() { winobj=window.open('','','toolbar=no,status=no,scrollbars=yes,width=800,height=600'); var txt=''; if(document.selection) { txt = document.selection.createRange().text winobj.document.selection.createRange().text = txt; } else { return } } This function working well with Internet Explorer but not working with Firefox or Crome.... Anyone plz modify this code or plz suggest me another code so that i can work with all browser. Thanks

    Read the article

  • splitting on all kind of spaces and tabs

    - by rockyurock
    hello, i am reading some parameters(from user input) from a .txt file and want to make sure that my script could read it even a space or tab is left before that particular parameter by user. also if i want to add a comment for each parameter followed by # , after the parameter (e.g 7870 #this is default port number) to let the user know about the parameter how can i achieve it in same file ? here is wat i am using (/\|\s/) code:: $data_file="config.txt"; open(RAK, $data_file)|| die("Could not open file!"); @raw_data=; @Ftp_Server =split(/\|\s/,$raw_data[32]); config.txt (user input file) PING_TTL | 1 CLIENT_PORT | 7870 FTP_SERVER | 192.162.522.222 could any body suggest me a robust way to do it? /rocky

    Read the article

  • python need some help

    - by maxt0r
    hi i have my codes i have to do a module def subjects but i cant figure out how can u help me thanks. class Enrol: def init(self, dir): def readFiles(, dir, files): for file in files: if file == "classes.txt": class_list = readtable(dir+"/"+file) for item in class_list: Enrol.class_info_dict[item[0]] = item[1:] if item[1] in Enrol.classes_dict: Enrol.classes_dict[item[1]].append(item[0]) else: Enrol.classes_dict[item[1]] = [item[0]] elif file == "subjects.txt": subject_list = readtable(dir+"/"+file) for item in subject_list: Enrol.subjects_dict[item[0]] = item[1] elif file == "venues.txt": venue_list = readtable(dir+"/"+file) for item in venue_list: Enrol.venues_dict[item[0]] = item[1:] elif file.endswith('.roll'): roll_list = readlines(dir+"/"+file) file = os.path.splitext(file)[0] Enrol.class_roll_dict[file] = roll_list for item in roll_list: if item in Enrol.enrolled_dict: Enrol.enrolled_dict[item].append(file) else: Enrol.enrolled_dict[item] = [file] try: os.walk(dir, _readFiles, None) except: print "directory not properly been recognise error" def subjects(what should i write here??): for name in suject_list: print name, out put should look like import enrol e = enrol.Enrol("/path/to/data") e.subjects() ['bw101', 'bw110', 'bw232', 'bw290', 'bw660']

    Read the article

  • Optimizing simple search script in PowerShell

    - by cc0
    I need to create a script to search through just below a million files of text, code, etc. to find matches and then output all hits on a particular string pattern to a CSV file. So far I made this; $location = 'C:\Work*' $arr = "foo", "bar" #Where "foo" and "bar" are string patterns I want to search for (separately) for($i=0;$i -lt $arr.length; $i++) { Get-ChildItem $location -recurse | select-string -pattern $($arr[$i]) | select-object Path | Export-Csv "C:\Work\Results\$($arr[$i]).txt" } This returns to me a CSV file named "foo.txt" with a list of all files with the word "foo" in it, and a file named "bar.txt" with a list of all files containing the word "bar". Is there any way anyone can think of to optimize this script to make it work faster? Or ideas on how to make an entirely different, but equivalent script that just works faster? All input appreciated!

    Read the article

  • How to Implement Web Based Find File Database Via Text Search

    - by neversaint
    I have series of files like this: foo1.txt.gz foo2.txt.gz bar1.txt.gz ..etc.. and a tabular format file that describe those files: foo1 - Explain foo1 foo2 - Explain foo2 bar1 - Explain bar1 ..etc.. What I want to do is to have a website with a simple search bar and allow people to type foo1 or just foo and finally return the gzipped file(s) and the related explanation of the file(s). What's the best way to implement this and what kind of tools should I use. Sorry I am totally new in this area.

    Read the article

  • How to read the whole istream correctly?

    - by L.Lawliet
    Here is a simple code to print all characters of a txt file on screen: #include <iostream> #include <fstream> #include <string> using namespace std; int main() { int **i; int j,k; char a; ifstream test("test.txt", ios::binary); while((a=test.get())!=-1)//if I use "while(!test.eof())" here, how to avoid the output of the last character(-1) to std::cout, or any ostream objects? { putchar(a);//also change this to putchar(test.get()); } getchar(); } As I noted in the code, if I use "test.eof()" to judge the end of test.txt, I'll always get an extra blank at the end of the output. How to avoid it?

    Read the article

  • fopen in C(Linux) returns "Too many open files"

    - by liv2hak
    static char filename[128] = "trace.txt"; g_file = fopen(filename, "w"); if(NULL == g_file) { printf("Cannot open file %s.error %s\n",filename,strerror(errno)); exit(1); } I am trying to open a empty text file named trace.txt in write mode (in my working directory.) The program is creating an empty file trace.txt in my directory.but the check (NULL == g_file) is returning true and it is returning error code 24 (Too many open files.).Any idea why this is.This is the first file I am opening in my program.

    Read the article

  • jQuery way to handle select lists, radio buttons and checkboxes

    - by Álvaro G. Vicario
    When I handle HTML form elements with jQuery, I always end up with an ugly mix of jQuery syntax and plain JavaScript like, e.g.: function doStuff($combo){ if( $combo.get(0).options[$combo.get(0).selectedIndex].value=="" ){ var txt = ""; }else{ var txt = $combo.get(0).options[$combo.get(0).selectedIndex].text; } var $description = $combo.closest("div.item").find("input[name$=\[description\]]"); $description.val(txt); } Are there standard jQuery methods to handle typical operations on elements like <select>, <input type="radio"> and <input type="checkbox">? With typical, I mean stuff like reading the value of the selected radio button in a group or replacing elements in a selection list. I haven't found them in the documentation but I admit that method overloading can make doc browser kind of tricky.

    Read the article

  • input URL, output contents of "view page source", i.e. after javascript / etc, library or command-li

    - by Ryan Berckmans
    I need a scalable, automated, method of dumping the contents of "view page source" (DOM) to a file. Programs such as wget or curl will non-interactively retrieve a set of URLs, but do not execute javascript or any of that 'fancy stuff'. My ideal solution looks like any of the following (fantasy solutions): cat urls.txt | google-chrome --quiet --no-gui \ --output-sources-directory=~/urls-source (fantasy command line, no idea if flags like these exist) or cat urls.txt | python -c "import some-library; \ ... use some-library to process urls.txt ; output sources to ~/urls-source" As a secondary concern, I also need: dump all included javascript source to file (a la firebug) dump pdf/image of page to file (print to file)

    Read the article

  • how to write a text file after the previous line in c#??

    - by riad
    Dear all, My below code create a txt file and write something to that file.but i need to write new line after the previous lines when i run the script several times. code: string filePath = "D:\\DOT_NET\\C#\\abc.txt"; FileInfo t = new FileInfo(filePath); StreamWriter Tex = t.CreateText(); Tex.WriteLine("Hi freinds"); Tex.WriteLine("csharpfriends is the new url for c-sharp"); Tex.Write(Tex.NewLine); Tex.Close(); current output on the abc.txt file: Hi friends csharpfriends is the new url for c-sharp but i need the output if i run the script several times. Hi friends csharpfriends is the new url for c-sharp Hi friends csharpfriends is the new url for c-sharp Hi friends csharpfriends is the new url for c-sharp How can i do that? Pls help thanks Riad

    Read the article

  • Hudson: where to download file and stop specific builds running ?

    - by Kim Jong Woo
    I have a file that is generated inside (hudson server) /var/lib/hudson/jobs/jobtitle/1/out.txt I need to fetch this file, but doing a GET request for http://myhudson:8090/job/jobtitle/1/out.txt doesn't actually locate the file. Basically, I have another box that will grab this file from the hudson server. This box will make the out.txt file available for download. Another challenge is the build number directories. How would I be able to use the hudson API to stop or delete the specific builds running ? I am forced to do iterate through all build numbers to send STOP or DELETE api call in php using wget to do the REST API call. This is not very efficient. for ($i=0; $i < 3000; $i++){ exec('wget -O /dev/null "http://myhudson:8090/job/' . 'jobtitle' . '/$i/stop"'); }

    Read the article

  • index error:list out of range

    - by kaushik
    from string import Template from string import Formatter import pickle f=open("C:/begpython/text2.txt",'r') p='C:/begpython/text2.txt' f1=open("C:/begpython/text3.txt",'w') m=[] i=0 k='a' while k is not '': k=f.readline() mi=k.split(' ') m=m+[mi] i=i+1 print m[1] f1.write(str(m[3])) f1.write(str(m[4])) x=[] j=0 while j<i: k=j-1 l=j+1 if j==0 or j==i: j=j+1 else: xj=[] xj=xj+[j] xj=xj+[m[j][2]] xj=xj+[m[k][2]] xj=xj+[m[l][2]] xj=xj+[p] x=x+[xj] j=j+1 f1.write(','.join(x)) f.close() f1.close() It say line 33,xj=xj+m[l][2] has index error,list out of range please help thanks in advance

    Read the article

  • How do I prevent buffer overflow converting a double to char?

    - by Tommy
    I'm converting a double to a char string: char txt[10]; double num; num = 45.344322345 sprintf(txt, "%.1f", num); and using ".1f" to truncate the decimal places, to the tenths digit. i.e. - txt contains 45.3 I usually use precision in sprintf to ensure the char buffer is not overflowed. How can I do that here also truncating the decimal, without using snprintf? (i.e. if num = 345694876345.3 for some reason) Thanks

    Read the article

  • Putting a thread to sleep until event X occurs

    - by tipu
    I'm writing to many files in a threaded app and I'm creating one handler per file. I have HandlerFactory class that manages the distribution of these handlers. What I'd like to do is that thread A requests and gets foo.txt's file handle from the HandlerFactory class thread B requests foo.txt's file handler handler class recognizes that this file handle has been checked out handler class puts thread A to sleep thread B closes file handle using a wrapper method from HandlerFactory HandlerFactory notifies sleeping threads thread B wakes and successfully gets foo.txt's file handle This is what I have so far, def get_handler(self, file_path, type): self.lock.acquire() if file_path not in self.handlers: self.handlers[file_path] = open(file_path, type) elif not self.handlers[file_path].closed: time.sleep(1) self.lock.release() return self.handlers[file_path][type] I believe this covers the sleeping and handler retrieval successfully, but I am unsure how to wake up all threads, or even better wake up a specific thread.

    Read the article

  • Copy contents of one document to another

    - by zakereen
    Hi All, I am trying to copy the contents of one document and append it to another document through command prompt. It works fine for simple .txt file through the command (copy fileA.txt + fileb.txt). But when I try to copy the contents of a MSWord file to another MSWord file, it does not happen. Though the target file size keeps increasing but without any content. When opened the doc file in notepad, it shows soe unreadable data keeps getting added. Please help.

    Read the article

  • How to load a resource bundle from a file resource in Java?

    - by user143794
    I have a file called mybundle.txt in c:/temp - c:/temp/mybundle.txt how do I load this file into a java.util.resource bundle? The file is a valid resource bundle. This does not seem to work: java.net.URL resourceURL = null; String path = "c:/temp/mybundle.txt"; java.io.File fl = new java.io.File(path); try { resourceURL = fl.toURI().toURL(); } catch (MalformedURLException e) { } URLClassLoader urlLoader = new URLClassLoader(new java.net.URL[]{resourceURL}); java.util.ResourceBundle bundle = java.util.ResourceBundle.getBundle( path , java.util.Locale.getDefault(), urlLoader ); What is the best way to do this?

    Read the article

  • Problem with loop MATLAB

    - by Jessy
    no time scores 1 10 123 2 11 22 3 12 22 4 50 55 5 60 22 6 70 66 . . . . . . n n n Above a the content of my txt file (thousand of lines). 1st column - number of samples 2nd column - time (from beginning to end ->accumulated) 3rd column - scores I wanted to create a new file which will be the total of every three sample of the scores divided by the time difference of the same sample. e.g. (123+22+22)/ (12-10) = 167/2 = 83.5 (55+22+66)/(70-50) = 143/20 = 7.15 new txt file 83.5 7.15 . . . n so far I have this code: fid=fopen('data.txt') data = textscan(fid,'%*d %d %d') time = (data{1}) score= (data{2}) for sample=1:length(score) ..... // I'm stucked here .. end ....

    Read the article

  • What is the reliable way to return error code from an MPI program?

    - by mezhaka
    The MPI standard (page 295) says: Advice to users. Whether the errorcode is returned from the executable or from the MPI process startup mechanism (e.g., mpiexec), is an aspect of quality of the MPI library but not mandatory. Indeed I had no success in running the following code: if(0 == my_rank) { FILE* parameters = fopen("parameters.txt", "r"); if(NULL == parameters) { fprintf(stderr, "Could not open parameters.txt file.\n"); printf("Could not open parameters.txt file.\n"); exit(EXIT_FAILURE); //Tried MPI_Abort() as well } fscanf(parameters, "%i %f %f %f", N, X_DIMENSION_Dp, Y_DIMENSION_Dp, HEIGHT_DIMENSION_Dp); fclose(generation_conf); } I am not able to get the error code back into the shell in order to make a decision on further actions. Neither of two error messages are printed. I think I might write the error codes and messages to a dedicated file. Has anyone ever had a similar problem and what were the options you've considered to do a reliable error reporting?

    Read the article

  • Whhether or not it is an elegant way in such a situation?

    - by z_axis
    There are some text files which needed to be manipulated line by line. I wrote a withFile function as below: let withFile fn handle = let rec iter_lines fh = try handle (input_line fh); iter_lines fh with _ -> close_in fh in iter_lines (open_in fn);; So i can manipulate each file as : withFile "file1.txt" (fun line -> (*...*)) withFile "file2.txt" (fun line -> (*...*)) ... But i amnot sure how to exit elehantly when i donot want to handle all lines. For example: withFile "file3.txt" (fun line -> (*when the line meets some condition, i will exit without handling other lines*) ); Any suggestion is appreciated !

    Read the article

  • transform file/directory structure into 'tree' in javascript

    - by dave
    I have an array of objects that looks like this: [{ name: 'test', size: 0, type: 'directory', path: '/storage/test' }, { name: 'asdf', size: 170, type: 'directory', path: '/storage/test/asdf' }, { name: '2.txt', size: 0, type: 'file', path: '/storage/test/asdf/2.txt' }] There could be any number of arbitrary path's, this is the result of iterating through files and folders within a directory. What I'm trying to do is determine the 'root' node of these. Ultimately, this will be stored in mongodb and use materialized path to determine it's relationships. In this example, /storage/test is a root with no parent. /storage/test/asdf has the parent of /storage/test which is the parent to /storage/test/asdf/2.txt. My question is, how would you go about iterating through this array, to determine the parent's and associated children? Any help in the right direction would be great! Thank you

    Read the article

  • C: theory on how to extract files from an archived file

    - by donok
    In C I have created a program which can archive multiple files into an archive file via the command line. e.g. $echo 'file1/2' > file1/2.txt $./archive file1.txt file2.txt arhivedfile $cat archivedfile file1 file2 How do I create a process so that in my archivedfile I have: header file1 end header file2 end They are all stored in the archive file one after another after another. I know that perhaps a header file is needed(containing filename, size of filename, start and end of file) for extracting these files back out into their original form, but how would I go about doing this. I am stuck on where and how to start. Please could someone help me on some logic as to how to approach extracting files back out of an archived file.

    Read the article

  • Mercurial adding new file gives no match found error

    - by Ivo
    I have a strange problem with updating Mercurial. Everytime when I add a file to my repository and then update another location of the repository (for example with in CI process), the error "no match found" occures. Then when I remove to whole folder and clone it again there are no problems and the new added file(s) are there. Updating and removing doesnt give problems When I do "a" Verify the following is shown: data/test.txt.i@54: missing revlog! 54: empty or missing test.txt test.txt@54: b80de5d13875 in manifests not found 3 integrity errors encountered! (first damaged changeset appears to be 54) Any idea what could be causing this?

    Read the article

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