I have CSV file with sample data in this form :
220 30 255 0 0 Javascript
200 20 0 255 128 Thinking in java
, where the first column is height, second thickness, next three are rgb values for color and last one is title. All need to be treated as separate variables. I have already written my own solution for this, ...
Hello All, I am reading csv file and creating dataset.
string MyPath = System.IO.Path.GetDirectoryName(Filename);
string ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + MyPath + ";Extended Properties='text;HDR=Yes;FMT=Delimited'";
//string CmdText = "select * from JDL-NurseryParts" + System.IO.Path.GetFileName(File...
In this script I have problems with file-name-extensions:
if I use /home/mm/test_x it works, with file named /home/mm/test_x.csv it doesn't:
#!/usr/bin/env perl
use warnings; use strict;
use 5.012;
use DBI;
my $table_1 = '/home/mm/test_1.csv';
my $table_2 = '/home/mm/test_2.csv';
#$table_1 = '/home/mm/test_1';
#$table_2 = '/home/mm/tes...
Hi,
I have XML:
<results>
<Countries country="Albania">
<Regions region="Centralna Albania">
<Provinces province="Durres i okolice">
<Cities city="Durres"
cityCode="2B66E0ACFAEF78734E3AF1194BFA6F8DEC4C5760">
<IndividualFlagsWithForObjects Status="1...
In most cases, CSV files are text files with records delimited by commas. However, sometimes these files will come semicolon delimited. (Excel will use semicolon delimiters when saving CSVs if the regional settings has the decimal separator set as the comma -- this is common in Europe. Ref: http://en.wikipedia.org/wiki/Comma-separate...
Why does only the second example append the extension to the filename and what is the "/r" in ".csv/r" for.
#!/usr/bin/env perl
use warnings; use strict;
use 5.012;
use DBI;
my $dbh = DBI->connect( "DBI:CSV:f_dir=/home/mm", { RaiseError => 1, f_ext => ".csv/r"} );
my $table = 'new_1';
$dbh->do( "DROP TABLE IF EXISTS $table" );
$dbh->d...
From the SQL::Statement::Functions documentation:
Creating User-Defined Functions
...
More complex functions can make use of a number of arguments always passed to functions automatically. Functions always receive these values in @_:
sub FOO { my( $self, $sth, $rowhash, @params ); }
#!/usr/bin/env perl
use 5.012;
use warning...
Hey,
I have a string like the following:
<118>date=2010-05-09,time=16:41:27,device_id=FE-2KA3F09000049,log_id=0400147717,log_part=00,type=statistics,subtype=n/a,pri=information,session_id=o49CedRc021772,from="[email protected]",mailer="mta",client_name="example.org,[194.177.17.24]",resolved=OK,to="[email protected]"...
I upload data into a mysql table from csv file in a standard way like this:
TRUNCATE TABLE table_name;
load data local infile '/path/to/file/file_name.csv' into table table_name
fields terminated by ','
enclosed by '"'
lines terminated by '\r\n'
(id, name, type, deleted);
All 'deleted' column entries in csv file has either 'current' o...
I have a script which outputs a CSV file. How should I format dates or date+time fields so that Excel will correctly parse that field as a date?
PS: I'd like to keep timezone information intact as well.
...
This is from the DBD::File-documentation:
f_ext
This attribute is used for setting the file extension where (CSV) files are opened. There are several possibilities.
DBI:CSV:f_dir=data;f_ext=.csv
In this case, DBD::File will open only table.csv if both table.csv and table exist in the datadir. The table will still b...
Hi,
I am trying to specify the colClasses options in the read.csv function in R. In my data, the first column "time" is basically a character vector while the rest of the columns are numeric.
data<-read.csv("test.csv" , comment.char="" , colClasses=c(time="character","numeric") , strip.white=FALSE)
In the above command, I would want ...
I have a csv file which looks like this
$lines[0] = "text, with commas", "another text", 123, "text",5;
$lines[1] = "some without commas", "another text", 123, "text";
$lines[2] = "some text with commas or no",, 123, "text";
And I would like to have a table:
$t[0] = array("text, with commas", "another text", "123", "text","5");
$t[1]...
Here is my class,
public class FreebasePeopleResults {
public String intendedSearch;
public String weight;
public Double heightMeters;
public Integer age;
public String type;
public String parents;
public String profession;
public String alias;
public String children;
public String siblings;
public String spouse;
public String degree;...
I'm trying to export data to a csv file. It should contain a header (from datastack) and restacked arrays with my data (from datastack). One line in datastack has the same length as dataset. The code below works but it removes parts of the first line from datastack. Any ideas why that could be?
s = ','.join(itertools.chain(dataset)) + ...
I have some CSV data files that I want to import into mySQL. I would like to do the insert in a shell script, so that it can be automated. However, I am a bit weary of having the username and password in clear text in the script
I have the following questions:
I am uncomfortable with the idea of a uname/pwd in clear text in the scrip...
I'm trying to import data from a csv file to some html code to use it in a graph I have already coded. I'm trying to use PHP and fgetcsv to create arrays for each separate piece of data to use PHP to put it into the html code. I know how to open the csv file and to print it using PHP, and how to print each separate row, but not each piec...
Hi,
I am using the code from this tutorial to parse a CSV file and add the contents to a database table. How would I ignore the first line of the CSV file? The controller code is below:
def csv_import
@parsed_file=CSV::Reader.parse(params[:dump][:file])
n = 0
@parsed_file.each do |row|
s = Student.new
s.name = row[0]
...
Hi,
I'm uploading a large amount of data from a CSV (I'm doing it via MySQL Workbench):
LOAD DATA INFILE 'C:/development/mydoc.csv' INTO TABLE mydatabase.mytable CHARACTER SET utf8
FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"'
LINES TERMINATED BY '\r';
However, I'm noticing that it keeps adding an empty line full of nulls/zeros...
I have a varchar field that contains a string like "10,11,12,13". How can I use that CSV string to join to another table with those IDs? Here's the approach I'm taking now:
select *
from SomeTable a
WHERE (',' + @csvString + ',') LIKE '%,' + CONVERT(varchar(25), a.ID) + ',%'
Where @csvString is "10,11,12,...". I intend to use this ...