search for: ends_with

Displaying 11 results from an estimated 11 matches for "ends_with".

2024 Apr 13
1
any and all
...NA,?????? 1L,?????? 0L, ? 1L,??????? 0L,?????? NA, ? NA,?????? NA,?????? 1L ) ``` Let's say we only want to keep rows that have a non-missing value for either `first.a` or `first.b` (or hypothetical later generations like `second.a` and `second.b` etc.): ``` data |> ? filter(if_any(ends_with(c(".a", ".b")), \(x) !is.na(x))) ``` So: `filter()` (keep observations) `if_any` of the columns ending with .a or .b is not `NA` (we have to wrap `!is.na` into an anonymous function for it to be a valid argument type). This would yield ``` # A tibble: 3 ? 3 ? first.a firs...
2006 Apr 27
3
Removing a default value for a foreign key with not null set
...ation and remove and 0 values for _id fields, but I''m looking for a cleaner solution: class Person < ActiveRecord::Base belongs_to :household validates_presence_of :household_id def before_validation attributes.each do |key, value| self[key] = nil if value == 0 and key.ends_with?(''_id'') end end end Is there a better way? Cheers, Jonathan. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://wrath.rubyonrails.org/pipermail/rails/attachments/20060427/9406c26f/attachment.html
2014 Jul 29
4
[PATCH 0/2] supermin: improve handling of memory
Hi, the two patches improve the way memory is handled in supermin, by cleanly exiting on memory allocation failures, and free'ing memory when not needed (to keep working and not run out of memory). Pino Toscano (2): Check for failures in memory allocations Free memory buffers when not used src/ext2fs-c.c | 13 +++++++++++-- src/init.c | 13 +++++++++++++ 2 files changed, 24
2024 Apr 12
2
any and all
Base R has generic functions called any() and all() that I am having trouble using. It works fine when I play with it in a base R context as in: > all(any(TRUE, TRUE), any(TRUE, FALSE)) [1] TRUE > all(any(TRUE, TRUE), any(FALSE, FALSE)) [1] FALSE But in a tidyverse/dplyr environment, it returns wrong answers. Consider this example. I have data I have joined together with pairs of
2016 Feb 17
0
[PATCH supermin v2 1/4] init: Uncompress modules before adding them to the mini initrd.
...ot; PACKAGE_VERSION -#ifdef HAVE_ZLIB_STATIC - " zlib" -#endif -#ifdef HAVE_LZMA_STATIC - " xz" -#endif "\n"); read_cmdline (); @@ -283,20 +269,6 @@ main () exit (EXIT_FAILURE); } -#if HAVE_LZMA_STATIC -static int -ends_with (const char *str, const char *suffix) -{ - if (!str || !suffix) - return 0; - size_t lenstr = strlen (str); - size_t lensuffix = strlen (suffix); - if (lensuffix > lenstr) - return 0; - return strncmp (str + lenstr - lensuffix, suffix, lensuffix) == 0; -} -#endif - static void insm...
2009 Jan 03
1
Finding a nested resource's 'parent' object?
Say I have this setup: class Ticket < ActiveRecord::Base belongs_to :project end map.resources :projects do |p| p.resources :tickets end How would I go about programatically figuring out that Ticket is nested under Project? --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
2016 Feb 17
2
[PATCH supermin 0/2] Allow an alternate libc to be used for init.
Allow an alternate libc, such as dietlibc, to be used for the init binary in the supermin appliance. Rich.
2013 Aug 19
5
[PATCH v2 0/3 supermin] URPMI & xz support.
Joseph, Please try my modified versions of these patches. These are compile-tested on Fedora and they don't break any existing functionality, but I don't have either urpmi nor a statically-linked xz so I cannot fully test them. I have also fixed detection of zlib (2/3). Rich.
2016 Feb 17
8
[PATCH supermin 0/2] Allow an alternate libc to be used for init.
v1 -> v2: - If we split out the init program into a separate init/ directory, that makes it much easier to build against an alternate libc. I tried to build against uClibc, but uClibc requires an entire build chain, which looked like it was going to be a massive ballache. Rich.
2006 Sep 26
12
resource_feeder feedback
...you *are* using Builder 2.0, aren''t you?), then you need to add a .to_xs to escape the string. If you want to put plain text into an Atom <summary> or <content element>, you need do nothing as that is the default. Now you need a convention (possibly as simple as .downcase.ends_with?("html")) and an a way to override this (perhaps options[:feed][:content_type]?). If content_type==''html'', you want to omit the call to .to_xs for RSS 1.0 and RSS 2.0. For Atom, simply do xml.content(:type => options[:feed][:content_type] || ... || ''t...
2014 Feb 25
2
[PATCH supermin v4] Supermin 5 rewrite.
...ed to run means we may not be able to run any commands. - */ - show_directory ("/"); - show_directory ("/bin"); - show_directory ("/lib"); - show_directory ("/lib64"); - fflush (stderr); - - exit (EXIT_FAILURE); -} - -#if HAVE_LZMA_STATIC -static int -ends_with (const char *str, const char *suffix) -{ - if (!str || !suffix) - return 0; - size_t lenstr = strlen (str); - size_t lensuffix = strlen (suffix); - if (lensuffix > lenstr) - return 0; - return strncmp (str + lenstr - lensuffix, suffix, lensuffix) == 0; -} -#endif - -static void -insm...