Force evaluate index expression before passing to sum()

南楼画角 提交于 2019-12-11 03:32:20
问题 I want to write an (somehow) enhanced sum function which takes a number of indices at once, but I cannot understand how to get it work. Here is what I currently have: (%i1) nsum(indexes, expr) := if indexes = [] then expr else nsum(rest(indexes), sum(expr, first(indexes),1, N)) $ (%i2) nsum([i,j], i+j), nouns; sum: index must be a symbol; found intosym(first(indexes)) #0: nsum(indexes=[k,j],expr=k+j) I think this could be fixed by forcing Maxima expand first(indexes) into a symbol before

" instead sign of quote (")

岁酱吖の 提交于 2019-12-11 03:08:15
问题 I have writteln asp.net web projet in C#. The problem is in saving sign of quote " in a database and displaying this again in a page. For example there is a textbox and I type following: "abcd" and save this in DB. However, when I read this again and display it in a page I see: "abcd" So what is a problem here?Does someone know the solution? the charset I use is utf8 and colattion is utf8generalci 回答1: Try use HTML decode and encode HttpUtility.HtmlDecode Refer http://msdn.microsoft.com/en-us

How to get Quote Item Id after adding a product to cart?

寵の児 提交于 2019-12-11 02:43:57
问题 I want quote item id every time a product added to cart. I have tried many event they return the quote item object but object doesn't contain quote item id as it exists only when cart save to the db. So is there any event which will return the quote item object with quote item id? I have used following events checkout_cart_product_add_after sales_quote_add_item but it will not return quote_item_id in public function addItemToSalesModelInfo(Varien_Event_Observer $observer){ $item = $observer-

Is there a way of using PHP PDO::quote method without creating a connection?

百般思念 提交于 2019-12-11 01:59:35
问题 I've been using PDO::quote to generate SQL statements. I use the generated SQL to create a memcached key. I'd like to avoid having to create a connection solely for the purpose of escaping SQL values. What is the purpose of needing to establish a connection to use PDO::quote method and can it be avoided? 回答1: Because PDO is an abstraction layer, and each database's quoting methods differ. PDO must know WHICH database you're going to be using to be able to use the proper quoting/escaping API

R encoding ASCII backtick

随声附和 提交于 2019-12-10 23:34:51
问题 I have the following backtick on my list's names. Prior lists did not have this backtick. $`1KG_1_14106394` [1] "PRDM2" $`1KG_20_16729654` [1] "OTOR" I found out that this is a 'ASCII grave accent' and read the R page on encoding types. However what to do about it ? I am not clear if this will effect some functions (such as matching on list names) or is it OK leave it as is ? Encoding help page: https://stat.ethz.ch/R-manual/R-devel/library/base/html/Encoding.html Thanks! 回答1: My

why are there periods in php [duplicate]

余生颓废 提交于 2019-12-10 17:12:35
问题 This question already has answers here : Closed 8 years ago . Possible Duplicate: What does the 'period' character (.) mean if used in the middle of a php string? as the title says, why are the periods? such as require("mod/".$modarrayout."/bar.php"); obviously its because the variable is between strings, but shouldnt the quotes have taken care of that? Just want to know to clarify further coding 回答1: In PHP, the period is the concatentation operator. Putting the periods in tells PHP to

How to pass column name as parameter to function in dplyr?

▼魔方 西西 提交于 2019-12-09 15:16:04
问题 I want to do the same as here but with dplyr and one more column. I want to selecting a column via a string variable, but on top I also want to select a second column normally. I need this because I have a function which selects a couple of columns by a given parameters. I have the following code as an example: library(dplyr) data(cars) x <- "speed" cars %>% select_(x, dist) 回答1: You can use quote() for the dist column x <- "speed" cars %>% select_(x, quote(dist)) %>% head # speed dist # 1 4

Why use #' with lambda?

前提是你 提交于 2019-12-09 09:05:02
问题 Why should I use #' together with lambda? It is usually written that way, so I guess it is good form. But these lines seem equal to me: > (mapcar #'(lambda (x) (+ x 1)) '(1 2 3)) (2 3 4) > (mapcar (lambda (x) (+ x 1)) '(1 2 3)) (2 3 4) Anyone care to enlighten a beginner about the difference? 回答1: #' is shorthand for function , which returns a pointer to a function (instead of applying it). lambda returns a function, and it's usual to want a pointer to that function. Since this is so common,

The correct COPY command to load postgreSQL data from csv file that has single-quoted data?

你说的曾经没有我的故事 提交于 2019-12-09 08:54:07
问题 I have csv file that has contents like this: 10,53073,0,0,'Y','2008-05-30 21:46:55',0,'2008-05-30 21:48:04',0,53071,2 I want to load the csv data into my_table. CREATE TABLE my_table ( ad_tree_id numeric(10,0) NOT NULL, node_id numeric(10,0) NOT NULL, ad_client_id numeric(10,0) NOT NULL, ad_org_id numeric(10,0) NOT NULL, isactive character(1) NOT NULL DEFAULT 'Y'::bpchar, created timestamp without time zone NOT NULL DEFAULT now(), createdby numeric(10,0) NOT NULL, updated timestamp without

display a php variable that contain quotes

江枫思渺然 提交于 2019-12-08 07:43:07
问题 I have an xml file for which I try do display some informations into a php form. So i've been trying to do something like that: <?php $url="tmp/".$_GET['n_doss']."-".date('d-m-Y')."-legale.xml"; if(file_exists($url)) { $chaineXML= $url; $dom = new DomDocument(); $dom->load($chaineXML); $date = $dom->getElementsByTagName('time'); $time = DateTime::createFromFormat("d/m/Y H:i:s", $date->item(0)->nodeValue); $datecreditsafe=date_format($time, 'd-m-Y'); if($dom->getElementsByTagName('errors')-