similar to: More idiomatic way of writing a filter

Displaying 20 results from an estimated 3000 matches similar to: "More idiomatic way of writing a filter"

2006 Jun 27
0
More idiomatic way of doing this
Folks, I''m trying to write a validating filter that checks if the user exists and renders XML if not. Most of the controllers will be returning XML on some error or other so I''m including RenderError in ApplicationController. Is my approach a sound one? Also, is there a shorter and more idiomatic way of writing this: if @user.nil? render_user_exists
2009 Sep 09
4
what is the +hex in c++ stack traces?
What is the hex number after the method, e.g. +0x32f below? It matches arg0 and I suspect it''s the c++ "this" pointer, aka hidden first argument. I would like to confirm, though. Thanks, Joel --- XUL`PresShell::ProcessReflowCommands(int)+0x32f XUL`PresShell::FlushPendingNotifications(mozFlushType) +0x19e
2006 Jun 28
2
undefined method `use_transactional_fixtures=''
Folks, I checked my test_helper.rb and it has self.use_transactional_fixtures = true My code was generated with 1.1.2 and I''m using 1.1.3 right now after but the error persists. I googled for this issue and it appears that a require is missing or something like that. I can''t figure it out, please help! /opt/local/bin/ruby -Ilib:test
2011 Apr 29
1
importing and filtering time series data
Folks, I'm new to R and would like to use it to analyze web server performance data. I collect the data in this CSV format: 1304083104.41,Y,668.856249809 1304083104.41,Y,348.143193007 First column is a <seconds.microseconds> timestamp, rows with N instead of Y need to be skipped and the last column has the same format as the first column, except it's request duration (latency).
2009 Aug 28
13
putting a running app into trace mode
Suppose I have a USDT probe in Firefox and that I''m trying to catch the startup with a probe like this: proc:::exec-success /execname == "firefox-bin"/ { start = timestamp; } and stop tracing when Firefox hits this USDT probe: mozilla:::main-entry { exit(0); } How do I put the running firefox-bin into "trace mode" so that my USDT probe fires? Thanks, Joel
2009 Sep 09
4
usdt probes vs pid$target
I added a couple of static probes to Firefox to measure actual work done. I could have used a pid$target probe with a function name but work is done within an if statement, which is where I placed the static probes. I''m wondering about my use, though. Is the following significantly more efficient than pid$target::FunName:entry and return? I heard somewhere that $target does not
2006 Jun 30
8
before_filter: nil vs. true vs. false
Folks, My understanding of how filters work is that I should return true if everything is ok and false if not. How does the filter below work then (from the Rails Recipies book)? It would return nil if there''s a user in the session. Does nil count as true? before_filter :check_authentication def check_authentication unless session[:user] session[:intended_action] =
2009 Sep 09
10
dtrace overhead and proper measuring technique
I''m trying to time a function within Firefoxwith a pid$target probe [2]. e.g dtrace -Zqw -x dynvarsize=64m -x evaltime=preinit -p 13954 -s menu- construct.d -s sigcont.d elapsed: 12.7942481ms cpu : 7.7911194ms count : 40 times I''m also measuring Firefox startup time by running it arguments like this: ... file:///Users/joelr/work/mozilla/startup/startup.html#`python
2009 Oct 28
3
where do kernel data types come from?
I have a script where I can freely reference struct nameidata*, struct vnode*, etc. on Snow Leopard. How does DTrace know about these data types? I understand things like #pragma D depends_on library darwin.d where darwin.d has typedefs. I can''t find definitions of nameidata and vnode in any D scripts, though. How does it work? Thanks, Joel --- firefox for android!
2006 Jun 23
2
Using fixtures from IRB
Folks, I have the standard setup with auto-generated unit tests and fixtures. I edited the fixtures and the tests but would now like to test associations from irb. How do I do this? I''m not sure how to load my fixtures into irb, for example. Once they are loaded I would create objects, save them to the db and pull things out. Thanks, Joel -- http://wagerlabs.com/
2011 May 01
1
microsecond timestamp support
Does R have support for microseconds in timestamps, e.g. when reading this in "Time","Include","Kind","Duration" 2011-04-01 14:20:36.368324,Y,U,1.03238296509 2011-04-01 14:20:35.342732,Y,C,0.0252721309662 2011-04-01 14:20:34.337209,Y,R,0.00522899627686 Thanks, Joel -------------------------------------------------------------------------- - for hire: mac
2006 Jun 11
3
Armageddon
I''m just wondering what happened to Armageddon and whether people had any more information/news about it. I''ve thought about comet but I think that a flash socket would be easier to implement. Does Armageddon have the same drawbacks as other flash sockets, namely not working over port 80 (so the companies firewall blocks it)? -- Posted via http://www.ruby-forum.com/.
2007 Oct 26
1
Spec custom finders
I have some finders in my models where I write some of the sql myself. I of course want to test these, but am not sure the best way. Should I just let them roll through to the db, and verify they return the correct objects based on the fixtures I load, or should I spec the actual query? I know that DB access is sort of frowned upon, but is this a situation where it is more or less acceptable? My
2010 May 08
2
uninitialized constant - Please Help Me...
Hello everyone, I''ve decided to take the step into creating a mini-forum for my website where users can open new posts on exixting topics and allow people to discuss things etc... I am following a tutorial in the book: APRESS - Practical Rails Social Networking Sites and have hit a minor issue. Part of the Forum requirements is to add a moderator role to allow only certain individuals
2009 Sep 14
1
return from memset on mac osx
Does dtrace have a problem catching the return from memset on Mac OSX? The script below catches the entry just fine but the return clause is never entered. Thanks, Joel --- pid$target::memset:entry /arg1 == 0/ { self->size = arg2; self->ts = timestamp; self->vts = vtimestamp; } pid$target::memset:return /self->size/ { @ts = sum(timestamp - self->ts); @vts =
2006 Jul 05
1
Routing via function
I have a route that depends on a username being passed in the URL, such as: map.connect '':username'', :controller => ''user'', :action => ''show'' Is there a way to perform a lookup of the username before matching on this route? I am hoping to be able to do something like this (completely made up): :requirements => {:username =>
2008 Nov 05
3
Problems w/ before_filter getting ignored
Hello, I''m setting up an authentication module that will be called from application.rb. I want to save a rrequest.request_uri into a session to be used as a place holder that will take users back to the page they were on before they logged in. I''m trying to call the store_location method for all methods EXCEPT login by putting login in an except before filter. For some
2010 May 04
3
Idiomatic looping over list name, value pairs in R
Considering the python code: for k, v in d.items(): do_something(k); do_something_else(v) I have the following for R: for (i in c(1:length(d))) { do_something(names(d[i])); do_something_else(d[[i]]) } This does not seem seems idiomatic. What is the best way of doing the same with R? Thanks. Luis
2006 Feb 19
0
looking for more idiomatic way of doing this
I have proposals and members can vote for them. In my proposal view I have a little div where the currently logged in member can vote: <div id="vote_div" class="vote"> Your vote: <% if @member_vote %> You have voted for this proposal<br /> <%= start_form_tag :action => "delete_vote" %> <%= hidden_field_tag :id,
2006 Feb 08
2
Idiomatic way to change partial''s behavior based on caller
Guys, I have a partial that is shared by many controllers, and this partial has a link that needs to do different things based on which controller calls it. So, the partial looks like this: <!-- _part.rhtml --> <tr> <td><%=part.number%></td> <td><%=part.associated_part_number%></td> <td><%=part.drawings%></td>