built-in

How do I reinstall a base-R package (e.g., stats, graphics, utils, etc.)?

帅比萌擦擦* 提交于 2019-12-19 07:52:22
问题 I have been using the "stats" package in R 3.0.1 without any problems . But today i deleted the "stats" folder from the R library location and now I can't install it any more. I tried doing the same thing with other packages but I could install everything except "stats" install.packages("stats", dep = TRUE, repos="http://cran.cs.wwu.edu") ## Installing package into ‘%Default R Lib Installation Path%’ ## (as ‘lib’ is unspecified) ## Warning in install.packages : package ‘stats’ is not

likely(x) and __builtin_expect((x),1)

橙三吉。 提交于 2019-12-18 16:52:38
问题 I know the kernel uses the likely and unlikely macros prodigiously. The docs for the macros are located at Built-in Function: long __builtin_expect (long exp, long c). But they don't really discuss the details. How exactly does a compiler handle likely(x) and __builtin_expect((x),1) ? Is it handled by the code generator or the optimizer? Does it depend upon optimization levels? What's an example of the code generated? 回答1: I just tested a simple example on gcc. For x86 this seems to be

Is it possible to overwrite window.location function with a custom function?

坚强是说给别人听的谎言 提交于 2019-12-18 15:05:10
问题 Is it possible to disable, or even better, replace with a custom function, window.location ? This question is related: Disable a built-in function in javascript (alert) While it works quite well for window.alert , this does not work for window.location . We would love to be able to find a way to replace or disable (replace would be ideal, so we can AJAX log) window.location ... Dirty advertisers have at times before used this to steal people away from our web properties. Any ideas? Even

Adding a datetime stamp to Python print

江枫思渺然 提交于 2019-12-18 12:18:47
问题 I am trying to debug the behaviour of a large library I depend on, which uses a scattering (no make that plethora) of debug print statements through its many source files. Trouble is, most if not all of these debug print statements do not contain a date/time stamp so it is hard to associate failures at the application level with failures within the library code itself. Rather than modifying the source code for all the debug prints suspected to be involved in the failure I am seeing, I thought

Bash variable substitution on find's output through exec

核能气质少年 提交于 2019-12-18 06:53:30
问题 Is there any way to apply bash variable substitution on find 's output? I know I've seen some one do it on stack overflow but I can't seem to find that particular post anymore. As an example , let's say I want to rename files *.png to *_copy.png . I know I can do this using rename but it's just a thought experiment. Now I'd like to be able to do something like this: find . -name "*png" -exec mv "{}" "${{}%.*}_copy.png" \; Which results in an invalid substitution . Of course, I could first

When __builtin_memcpy is replaced with libc's memcpy

China☆狼群 提交于 2019-12-18 03:56:00
问题 There is a version of C99/posix memcpy function in GCC: __builtin_memcpy . Sometimes it can be replaced by GCC to inline version of memcpy and in other cases it is replaced by call to libc's memcpy. E.g. it was noted here: Finally, on a compiler note, __builtin_memcpy can fall back to emitting a memcpy function call. What is the logic in this selection? Is it logic the same in other gcc-compatible compilers, like clang/llvm, intel c++ compiler, PCC, suncc (oracle studio)? When I should prefer

Extract file extension from file path

左心房为你撑大大i 提交于 2019-12-18 03:01:36
问题 How can I extract the extension of a file given a file path as a character? I know I can do this via regular expression regexpr("\\.([[:alnum:]]+)$", x) , but wondering if there's a built-in function to deal with this? 回答1: This is the sort of thing that easily found with R basic tools. E.g.: ??path. Anyway, load the tools package and read ?file_ext . 回答2: Let me extend a little bit great answer from https://stackoverflow.com/users/680068/zx8754 Here is the simple code snippet # 1. Load

Extract file extension from file path

早过忘川 提交于 2019-12-18 03:01:09
问题 How can I extract the extension of a file given a file path as a character? I know I can do this via regular expression regexpr("\\.([[:alnum:]]+)$", x) , but wondering if there's a built-in function to deal with this? 回答1: This is the sort of thing that easily found with R basic tools. E.g.: ??path. Anyway, load the tools package and read ?file_ext . 回答2: Let me extend a little bit great answer from https://stackoverflow.com/users/680068/zx8754 Here is the simple code snippet # 1. Load

how to avoid sql injection in codeigniter

99封情书 提交于 2019-12-17 08:17:07
问题 In CodeIgniter, how can I avoid sql injection? Is there any method to set in config file to avoid sql injection? I am using this code for selecting values: $this->db->query("SELECT * FROM tablename WHERE var='$val1'"); and this for inserting values: $this->db->query("INSERT INTO tablename (`var1`,`var2`) VALUES ('$val1','$val2')"); Another method used to insert and select values from the database is CodeIgniter's insert() and get() methods. Is any chance to sql injection while using

How does __builtin___clear_cache work?

梦想与她 提交于 2019-12-17 06:58:09
问题 Going through the gcc documentation, I stumbled into the builtin function __builtin___clear_cache . — Built-in Function: void __builtin___clear_cache (char *begin, char *end) This function is used to flush the processor's instruction cache for the region of memory between begin inclusive and end exclusive. Some targets require that the instruction cache be flushed, after modifying memory containing code, in order to obtain deterministic behavior. If the target does not require instruction