Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Wanet Telecoms Ltd on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Search results for query: *

  1. invalid6363

    Connection Ruby program to databse

    Ok. Thanks for your help.
  2. invalid6363

    Connection Ruby program to databse

    I have made a GUI application using Ruby\FXRuby and i would like to be able to connect it to a database to save the data that is entered in the application. It's a simple application that saves a person's contacts (name, address, email, etc.). I'm trying to use SQLite3 but i have not been able...
  3. invalid6363

    Need help creating edges between all vertices

    Ok. Thanks. new code to add edges between vertices: private static void setVertices(int n) { int vertexLength = n; /* Create vertices */ for(int i = 0; i < vertexLength; i++) { undirGraph.addVertex("City" + String.valueOf(i+1) + " - "); } } private static void setEdges()...
  4. invalid6363

    Need help creating edges between all vertices

    ...all the vertices. Here is the code for adding vertices and edges: private static void setVertices(int n) { int vertexLength = n; /* Add vertices */ for(int i = 0; i < vertexLength; i++) { undirGraph.addVertex("City" + String.valueOf(i+1) + " - "); } } private static...
  5. invalid6363

    Trouble with accepting user input

    Oh, ok. Thanks for your help. I made the change in the code and it works perfectly now. :-)
  6. invalid6363

    Trouble with accepting user input

    hello, i'm new to ruby and i'm trying a to write a simple greeting program that accepts input from the user (user's name) but its not completely working the way i would like it to. It doesn't print out the goodbye messages and doesn't work when nothing is typed in (Hello World should print out)...
  7. invalid6363

    Need help creating multithreaded program

    ...m, int n, int[][] A, int[][]B, int [][]C) { this.m = m; this.n = n; this.A = A; this.B = B; this.C = C; } public void run() { /* calculate the matrix product in C[row][col] */ for(int i = 0;i < m;i++){ for(int j = 0;j < n;j++){ for(int h = 0;h < k;h++){...
  8. invalid6363

    help with arranging flags program

    i'm trying to learn prolog and one of the problems that i am trying to do is the following: Write a Prolog program that takes the total number of flags of each color and some initial arrangement of flags. The initial arrangement may be empty, or it may specify that certain positions in the line...
  9. invalid6363

    formating character lenght of a line in a txt file

    ok, i made the change from [i+2..-1] to [i+2..$#line] and it is now working correctly but isn't -1 and $#line stating the same thing, to go from i+2 to the end of the list?
  10. invalid6363

    formating character lenght of a line in a txt file

    Oh, ok. i get it. thanks franco but one minor problem. when i ran the code for format 3 the address field did not print to the outfile but the other fields did and in the correct order. instead of printing to outfile: 23573456 Mary Beth Davis 000 (541) 555-4321 234 Bridge St. Abc, OR. 24356 it...
  11. invalid6363

    formating character lenght of a line in a txt file

    franco, could you explain your code for format 3, i don't fully understand how it works: for(my$i=1;$i<@line;$i++){ if($line[$i]=~/^\(\d{3}\)$/){ $phone=join' ',@line[$i..$i+1]; $name=join' ',@line[0..$i-1]; $address=join' ',@line[$i+2..-1]; last; } } how did you determine...
  12. invalid6363

    formating character lenght of a line in a txt file

    thanks franco for your help. i got the second format to work. elsif(length($line) == 150){ $name = substr($line,0,50); $account = substr($line,50,10); $phone = substr($line,60,14); $status = substr($line,74,3); $address = substr($line,77,73)...
  13. invalid6363

    formating character lenght of a line in a txt file

    any suggestions on how to improve code?
  14. invalid6363

    formating character lenght of a line in a txt file

    Here is what the code looks like so far: #!/usr/bin/perl open(INFILE, "input.txt"); open(OUTFILE, ">output.txt"); open(ERRORFILE, ">errorfile.txt"); #performs data cleanup and formatting functions on a semi-structured input #file. #name = [A-Za-z\s-']+ #phone number =...
  15. invalid6363

    formating character lenght of a line in a txt file

    These are the fields that make up a data record: Name: Customer names may contain any alphabet letter, spaces, hyphens, and apostrophes. Address: May contain any letter or number, spaces, and the following symbols: # , ' :. - / Phone Number: Will always be in format (###) ###-#### Status: 3...
  16. invalid6363

    formating character lenght of a line in a txt file

    here is an example of how the input data could look in the text file: Joe Smith, 1 Uni Dr. Camarillo, CA. 93012., (805) 555-1234, AW87124356, 001 Joe Smith AW87124356(805) 555-12340011 Uni Dr. Camarillo, CA. 93012...
  17. invalid6363

    formating character lenght of a line in a txt file

    ...= @line; if(length($name) < 50) { $pad_len = 50 - length($name); $padded = sprintf ("%-*s", $pad_len, $name); print outfile $padded . "\n"; } elsif(length($address) < 10) { $pad_len = 10 - length($address); $padded = sprintf...
  18. invalid6363

    formating character lenght of a line in a txt file

    ...($name,$address,$phone,$status,$account) = @line; if(lenght($name) < 50) { $pad_len = 50 - length($name); $padded = sprintf outfile "%-*s", $pad_len, $name"; } ...repeat process for other fields } but looking at this, it seems that it will print each of the fields one at a time...
  19. invalid6363

    Searching for a pattern in a list

    what about for a pattern of three? i tried just simply adding another variable : occurs([X,Y,Z|_],X,Y,Z). occurs([_|L],X,Y,Z) :- occurs(L,X,Y,Z). but this does not work at all. any suggestions?
  20. invalid6363

    Searching for a pattern in a list

    this seems to work for a pattern of two: occurs([X,Y|_],X,Y). occurs([X|Y],X,Y). occurs([_|L],X,Y) :- occurs(L,X,Y).

Part and Inventory Search

Back
Top