Displaying 20 results from an estimated 20000 matches similar to: "Which is faster: searching in a file or in a database"
2009 Jun 17
12
FasterCVS and Rails
Hello all,
I''m trying to import some csv data (that has latin characters) using
faster csv but I keep getting a MalformedCSVError:
"Unclosed quoted field on line 1."
"/ruby/lib/ruby/gems/1.8/gems/fastercsv-1.2.3/lib/faster_csv.rb:1592:in
`shift''"
I''ve tested the same code outside of the Rails application an it works
fine.
Can anyone help me?
Here is
2006 Mar 21
8
Loading the contents of a CSV file to a database
Hello Everybody,
I picked up on the buzz about RoR and wanted to see what the fuss is
about. So far i am very impressed but have hit a bit of a wall with a
little play app i am writting.
I want to iterate through a CSV file of my bank transactions and see
just how much money i spend on beer and pies every month.
I have successfully setup a database with a single table called
transactions
2010 Dec 20
1
Writing to a CSV with Faster::CSV
Is there a way to write a csv file using a hash instead of an array?
Something like this:
header_keys = :first_name, :last_name, :email
FasterCSV.open("path/to/file.csv", "w") do |csv|
User.all.do |user|
csv << user
end
end
Thanks...
--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To
2009 Jun 13
3
How Can I insert another column data into the CSV file when I use FasterCSV?
Hi, All,
Suppose I have a CSV file, there is data in it.
* Column 1 Column2 Column 3 Column 4
Row1 a b c
Row2 a2 b2 c2*
You know, the column 4 is no data
Now, I would like to insert data to Column 4, after save, the CSV file will
be:
* Column 1
2006 May 17
6
newbie wants to know..FasterCSV or just CSV?
I''m trying to grab a CSV file from a user and let them upload it
directly to my database, but doing some minor checks on the data before
saving. Which is the easier way to implement this? CSV or FasterCSV? I
saw that perhaps there were some issues with FasterCSV and csv files
created from Mac versions of Excel.
Anyone have any experience with this and can recommend a newbie friendly
2008 Feb 05
9
ActiveResource / Creating an API
Hi,
I am currently looking at creating an api for a new RESTful app built
using rails 2.0. The two solutions I have come across seems to be
ActiveResource and ActionWebServices.
Although there seems to be plenty of documentation for the older
ActionWebServices (both online and in books), this does not seem to be
the case for ActiveResource.
Does anyone know of any decent articles / screencasts
2007 Jul 25
3
FasterCSV load file to table
Hello Guys,
May be it is simply but any way.... fasterCSV 1.2.0
how to load data from file to table :( I have tried this:
file has just one line 1,2,3
data = FCSV.read("C:\\temp_file.csv")
table = FCSV.parse(data, :headers => true)
puts "data overview"
puts data
puts "table overview"
puts table
but got very strange error:
undefined method
2011 Mar 26
2
upload file, read first 10 lines.
I have a csv file and in my controller:
uploaded_file = params[:upload][:csv].read
@rows << FasterCSV.parse(uploaded_file)
I want to put in @rows only the first 10 lines but the read method
reads all the file.
How can I do?
--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this group, send email to
2005 Dec 07
4
Importing data for excel file or csv file
hey,
i have this website (with ajax also) with lot of records of employee, and as an
extra feature i want that the customer can import his employeelist (perhaps 100+
records), lot of work to do this manually.
i would create a template like this
Firstname Lastname Phone
xxxx xxxxx xxxxx
yyyy yyyyy yyyyy
then they upload the excel file or save it as csv file
2006 May 07
5
File upload/database import
I have been using Ruby on Rails for around 6 weeks now (so far I love
it), but I''ve gotten to a point in the application where I need to allow
the user to upload comma deliminated text files that will get loaded
into one of the database tables.
Before I get started doing this, I was wondering anyone knows of any
examples or tutorials that deal with this. I''d rather do it
2010 Jul 08
4
testing authentication with basic_auth
hi, I''ve got an api which is using
authenticate_or_request_with_http_basic
What are you guys using to test this? I''m using rspec, and before I
was using rspec-rails, I was using authorize from Rack::Test to do the
authentication. However, authorize clearly doesn''t work when using
rspec-rails, so I''m wondering what everyone else is doing?
--
You received this
2008 Jun 12
2
SslRequirement Problem
Hello everyone,
I''m pretty new to the RoR''s thing and am having a problem setting up
SslRequirement plugin.
I have installed the SslRequirement plugin and added it to my
application_controller.rb with include SslRequirement
However, when I try and do "ssl_required :process_payment"
I get the following error:
undefined method `ssl_required'' for
2009 Sep 22
6
Import excel / csv files
Hey,
What way is the best to do imports of CSV files?
2009 Jan 14
1
setting header in views?
currently iam using FasterCSV to render csv pages
format.csv do
csv_string = FasterCSV.generate do |csv|
# header row
csv << @query_result[0].keys
@query_result.each do |x|
csv << x.values
end
end
#send it to the browser
send_data csv_string,
:type => ''text/csv;
2007 Dec 29
2
Simply Rich Authenticator Released
Hi,
I have developed a mini Rails app using Rails 2.0.2, RESTful authentication
and Acts as State Machine. It has the following features:
1. Login
2. Logout
3. User Activation
4. Forgot Password
5. Reset Password
You can check out the code from:
svn checkout *http*://simply-rich-authenticator.googlecode.com/svn/trunk/simply-rich-authenticator-read-only
Happy New Year!
--
2011 Aug 03
2
Malformed CSV Error
Hello,
I am getting error :-
#<CSV::MalformedCSVError: Unclosed quoted field on line 1892.>.
I have following code :-
--------------------------------------------------
@parsed_file =
CSV.open("#{RAILS_ROOT}/private/sales_report_files/#{@file_folder}/#{@sub_file_folder}/#{@file_name.filename}",''r'',:col_sep
=>?\t)
@parsed_file.each_with_index do |row, index|
2009 Aug 05
1
How do I use fastercsv to just read the header row and not the whole file?
How do I use fastercsv to just read the header row and not the whole
file?
I need to read the header row first and not the whole csv file
initially in the web application so I can map the input csv columns to
the db columns. Once the mapping is complete, a rake task will than
process the whole file. I don’t want to read the whole file to save
processing time.
How do I just read the header row
2007 Jun 06
2
lookup in CSV recipe
I await Luke''s node settings implementation with interest. At the
moment however, I have this sort of ugliness:
$site = $hostname ? {
fred => "opsera",
barney => "bedrock",
default => "unknown site",
...
}
So I''ve knocked up this little function to use CSV files instead. Now
I can just do:
$site =
2006 Feb 06
4
Memory Issue while looping through CSV file
I have a site on a shared host at TextDrive. I have an import process
that imports a CSV file into the database using a ruby script executed
using script/runner. TextDrive has a memory limit which I am hitting
and the process gets killed. I get through to about 400 records before
it dies. I guess each time I instantate a new object for each record I
am using more memory but thought I was using
2008 Oct 27
8
why can't johnny download?
I''m working on an app that includes the feature to allow user to
download a csv file of their data.
I''ve got it working on my local machine, but when I deploy it, the link
I''m making doesn''t work for doing the download. The file IS being
created in the location I''m intending, but the file download only works
on my local machine and not on the server.