similar to: Symbols as Parameters

Displaying 20 results from an estimated 10000 matches similar to: "Symbols as Parameters"

2005 Aug 23
10
Creating a simple sum (or: I suck at blocks!)
I''ve been hacking on this for awhile and am not even getting close. Consider the following... results = Sample.find(:all) total_counter = results.each{|result| #Add together result.counter} I just want to simply iterate through the list and sum the counter field for each row into an aggregation. I could do it in a full for loop, but is there a nice one liner I''m missing?
2006 Feb 15
7
Ackbar - ActiveRecord Adapter for KirbyBase
= About Ackbar Ackbar is an adapter for ActiveRecord (the Rails ORM layer) to the KirbyBase pure-ruby plain-text DBMS. Because KirbyBase does not support SQL, joins or transactions, this is not a 100% fit. There are some changes to the ActiveRecord interface (see below), but it may still be useful in some cases. = URIs Ackbar: http://ackbar.rubyforge.org KirbyBase:
2004 Apr 05
1
Changes to ClassViewer
Kevin, Very cool. I initially tried to figure out how to do it without those evals, but I failed (thanks for picking up the slack :) Your changes definitely improved the code, and made it much cleaner. Thanks. By the way, what is pickaxe? I''m not familiar with that term. _________________________________________________________________ Free up your inbox with MSN Hotmail Extra
2006 Jul 05
2
[Newbie] The pickaxe book and benchmark
Hello, I was reading the pickaxe book and then I arrived to the chapter "When trouble strikes" in the Benchmark section. I have this code: #!/usr/bin/ruby -w require ''benchmark'' include Benchmark LOOP_COUNT = 1_000_000 bm(12) do |test| test.report("normal:") do LOOP_COUNT.times do |x| y = x +1 end end
2006 Mar 09
15
regular expressions slay me
I am furiously trying to find what I am looking for in Pickaxe book and not finding it. I''m getting some values back from a posted form and I need to get the ''id'' number off the backend. The ''String'' will always come back to me as... Some_name\r\n123 where 123 is actually the id number which I need to execute the find. The reason they are coming back
2006 Jul 04
2
clear all sessions keys
hi list, how to iterate over the Session object to reset all session keys (after a logout for example) session[''something'']=nil session[''another_key'']=nil ... is there something like session.keys{|aSessionKey| session[aSessionKey]=nil} ? thanks arnaud
2017 Jun 12
3
count number of stop words in R
define your string as whatever object you want: data <- "Mhm . Alright . There's um a young boy that's getting a cookie jar . And it he's uh in bad shape because uh the thing is falling over . And in the picture the mother is washing dishes and doesn't see it . And so is the the water is overflowing in the sink . And the dishes might get falled over if you don't fell
2017 Jun 12
0
count number of stop words in R
Defining data as you mentioned in your respond causes the following error: Error in UseMethod("tm_map", x) : no applicable method for 'tm_map' applied to an object of class "character" I can solve this error by using Corpus(VectorSource(my string)) and the using your command but I cannot see the number of stop words in my string! On Monday, June 12, 2017 8:36
2009 Jul 10
2
how can I download an english version of R ?
Dear colleagues, I am Professor of Operations Management at IUM, Intl. University of Monaco. The language at IUM is English and I want to test R. But I'm unable to get an English version (only useless French). Please help me. Thanks, Casimir SYSTEMS CONSULT, Pr Dr C. de RHAM 17 av de l'Annonciade, MC-98000 MONACO Tl +377 93 50 68 65, Fx +377 93 50 69 47 Google Earth:
2006 Feb 08
5
Regular Expression Question
I have looked through the Ruby Pickaxe book as well as done a search but can''t figure out how to validate the format of a field. The field I want to validate is a credit card expiration date field. Based on our user study (going around the office and asking everyone the way they like to fill out that particular field type) everyone prefers the following format in one field:
2006 May 02
4
ordering after a inject
Hi, My results are getting out of order after I do the following command: count = result.inject({}) { |hsh, row| hsh[row[''name'']] = row[''count''].to_i; hsh } Why? Here are more specifics: My complete method is this (based off of acts_as_taggable code - not'' DHHs, but the original one): def self.sql_to_count_plays(lookback) sql =
2006 Jan 12
24
The Guilt List
I''m not a paid developer, but I still feel guilty. I thought it might be entertaining to have a little "programmer confession." So let''s hear an answer to this simple question: What makes you guilty about your Rails development? Mine is a bad one: I don''t write tests. I understand that TDD makes sense, but I just don''t do it. I''ve
2017 Jun 12
3
count number of stop words in R
You can define stop words as below. data <- tm_map(data, removeWords, stopwords("english")) Patrick Casimir, PhD Health Analytics, Data Science, Big Data Expert & Independent Consultant C: 954.614.1178 ________________________________ From: R-help <r-help-bounces at r-project.org> on behalf of Bert Gunter <bgunter.4567 at gmail.com> Sent: Monday, June 12, 2017
2006 Jul 05
2
splitting a paragraph into words and spaces
I''m using this: <% words = article.content.split(/ /) %> <%= words[0..20] %> to (ostensibly) split a paragraph into component words, with spaces in between, then print to html only the first 20 items, words and spaces. I got this (split(/ /)) from the online pickaxe book at http://rubycentral.com/book/ref_c_string.html#String.split . The problem is, the resulting array
2017 Jun 12
0
count number of stop words in R
Thanks for your reply. I know the command data <- tm_map(data, removeWords, stopwords("english")) removes English stop words, I don't know how should I count stop words of my string: str="Mhm . Alright . There's um a young boy that's getting a cookie jar . And it he's uh in bad shape because uh the thing is falling over . And in the picture the mother is
2007 Jul 04
2
content_type from a local file?
I''m using a Rake task to add local files into a database designed for use with attachment_fu. http://eldorado.googlecode.com/svn/trunk/db/migrate/039_create_avatars.rb http://eldorado.googlecode.com/svn/trunk/lib/tasks/import_files.rake So, attachment_fu has a "content_type" field, which apparently is receiving that information from the browser...? I''m trying to
2006 May 09
2
what are all these methods?!?! :)
I''ve been happily riding the Ruby/Ruby on Rails learning curve .. I bought the pickaxe book, first and beta second editions of the agile book and i''ve been using the api.rubyonrails.com but i''ve come across something which as stumped me I''m fooloing around with :acts_as_tree in the console and I instantiated a new tree object and went to use the readline
2006 Jul 04
7
inverse of eval() ?
I''m trying to figure out how to turn a string into an object. Can anyone point me? Here''s some background. Here''s the part of what I''m trying to do that works. ------------------------------------- @ford = [''mustang'', ''pinto''] make = ''@ford'' puts eval(make) --> produces mustang pinto
2005 Dec 29
14
Rails 1.0 - Agile book still good?
I''m new to Ruby and RoR but excited to learn what I can do with RoR; I have Pickaxe second edition and want to get "Agile Web Development with Rails" but I''m aware that the book was published some while before RoR version 1.0 was released. Has a lot changed since then, and would I therefore be advised to wait for a second edition of AWDwR? Many thanks in advance
2007 Sep 20
3
Bug? in wxSugar enumerable_controls.rb
Hi, I wanted to use wxSugar enumerable features to add a method for returning checked items'' index to the CheckListBox class : require ''wx_sugar/version'' require ''wx_sugar/wx_classes/control_with_items'' require ''wx_sugar/wx_classes/listctrl'' class Wx::CheckListBox def checked_items # use of find_all method from Enumerable