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...
I'm trying to create a graph with 'n' vertices and create edges between 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++)
{...
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)...
i'm trying to do one of the exercises from my OS book. the exercise is about creating a multithreaded solution that performs matrix multiplication.(A[i,j] x B[i,j]= C[i,j])
it says that for this exercise you need to calculate each element C[i,j] in a separate worker thread. This will involve...
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...
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?
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...
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...
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)...
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 =...
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...
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...
Here is the majority of the code and it does work but not as it should:
#Format 2
#Each line is fixed at 150 characters in length.
#Each field has an assigned number of characters. If the
#data for that field contains less than the maximum number of characters, that field will be right-padded...
i need help on writing some code that will take each line of a file and determine if it contains the right length of characters for each line (150 max). Each line in the file contains 5 fields and has an assigned number of characters:
name (0-49)
address (50-59)
phone number (60-73)
status...
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?
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.