nested

nmake - simulating eval function

淺唱寂寞╮ 提交于 2019-12-08 08:36:57
问题 I'd like to get value of variable named $(MYVAR)_SOME_SUFFIX in the b.mak makefile. Instead I get "b.mak(2) : fatal error U1001: syntax error : illegal character '$' in macro" # ---- a.mak ---- all : set MYVAR=SOME_PREFIX nmake -f b.mak #--- END --- # ---- b.mak ---- all: @echo $($(MYVAR)_SOME_SUFFIX) #--- END --- 回答1: You can sort of do what you want with inline files. # ---- piotr1.mak ---- all : nmake -nologo -f piotr2.mak MYVAR=BBB #--- END --- # ---- piotr2.mak ---- AAA_SETTING=17 BBB

Closing nested tabs using WPF?

一曲冷凌霜 提交于 2019-12-08 08:14:47
问题 I'm trying to design a UI that contains nested tabs, but I can't seem to find information on how to remove the nested tabs in an MVVM fashion. Here's my XAML (snipped for brevity): <TabControl Name="ProjectTabControl" DockPanel.Dock="Top" ItemsSource="{Binding ProjectTabs}" IsSynchronizedWithCurrentItem="True"> <TabControl.ContentTemplate> <DataTemplate> <TabControl DockPanel.Dock="Top" ItemsSource="{Binding FileTabs}" Padding="1"> <Button Command="{Binding CloseTabCommand}" CommandParameter=

LINQ to get Distinct Count/Sort in List<List<string>>

旧巷老猫 提交于 2019-12-08 07:32:44
问题 I have a List<> that contains a List<string> , of which I need to determine the unique count from the List<string , and order by the frequency of the count. Example: "a","b","c" "d","e","f" "a","b" "a", "b", "c" "a", "b", "c" "a","b" This would output (rank / combination / frequency) 1 - "a", "b", "c" - 3 2 - "a", "b" - 2 3 "d", "e", "f" - 1 I can come up with a brute-force approach but can this be done more elegantly with LINQ? This isn't exactly a Cartesian approach from what I can tell.

Aggregate Python lists stored as values in a nested dictionary into one list for arbitrary levels [duplicate]

时光总嘲笑我的痴心妄想 提交于 2019-12-08 07:16:44
问题 This question already has answers here : How to flatten nested python dictionaries? (4 answers) Closed last year . Suppose I have a nested dictionary where, at some level, the terminal values are lists. For example: nested_dict = {1 : {'a' : [1,2,3], 'b' : [4,5]}, 2 : {'a' : [6], 'b' : [7,8,9]}} I want to aggregate the list values into [1,2,3,4,5,6,7,8,9] . For two levels I have values = [] for key1 in nested_dict.keys(): for key2 in nested_dict[key1].keys(): for value in nested_dict[key1]

Find Maximum Value in Nested Dictionary and return Key

大憨熊 提交于 2019-12-08 07:02:46
问题 So I have this block of code dictionary = { 'key1': {'a': 1, 'b': 2, 'c': 10}, 'key2': {'d': 1, 'e': 1, 'c': 11}, 'key3': {'d': 2, 'b': 1, 'g': 12}} and list1 = (a,b,c) What I want to do is run a loop that finds the maximums of all the items in the list and returns the key. So for example, the maximum of 'c' would return 'key2', the maximum of 'b' would return 'key1', etc. So far I have for value in list1: m = max(dictionary, key=lambda v: dictionary[v][value]) print(m + "\n") But this only

Flask/Jinja2 - Iterating over nested dictionaries

拟墨画扇 提交于 2019-12-08 05:29:54
问题 I'm trying to display the contents and structure of a dictionary in the form of a bunch of nested un-ordered lists. The data that I've managed to pull together looks like this, {'.': {'walk.py': None, 'what.html': None, 'misc': {}, 'orders': {'order1.html': None, 'more': {'stuff.html': None}}}} which represents this directory tree, .: misc/ orders/ walk.py what.html ./misc: ./orders: more/ order1.html ./orders/more: stuff.html How would I go about iterating over this using the Jinja2 Syntax?

SQL - Use results of a query as basis for two other queries in one statement

陌路散爱 提交于 2019-12-08 05:06:43
问题 I'm doing a probability calculation. I have a query to calculate the total number of times an event occurs. From these events, I want to get the number of times a sub-event occurs. The query to get the total events is 25 lines long and I don't want to just copy + paste it twice. I want to do two things to this query: calculate the number of rows in it, and calculate the number of rows in the result of a query on this query. Right now, the only way I can think of doing that is this (replace

Nested integral within integral2 in matlab

守給你的承諾、 提交于 2019-12-08 05:00:46
问题 I'm attempting to take the double integral (using integral2) of a function that is defined by an integral. http://i.imgur.com/gIUsLSw.jpg Here is what I am currently attempting: t=linspace(0,1,50); fun_1= @(v) exp(.071*v) fun = @(x,y) exp(0.14*0.00607*integral(@(u)fun_1(u),0,x)).*exp(-(x-y).^2).*exp(0.14*0.00607*integral(@(u)fun_1(u),0,x)); for i=2:length(t) for j=i:length(t) A(i,j)=integral2(fun,t(i-1),t(i),t(j-1),t(j)); end end I'm receiving the error Error using integral (line 86) A and B

How to apply functions in columns for data frames with different sizes in nested list?

无人久伴 提交于 2019-12-08 04:55:42
问题 In R, to apply some function to a column, you can do: df$col <- someFunction(df$col) Now my question is, how do you the similar task when you have data frames in a nested list? Say I have a following list like this, where I have data frames in the second level from the root. +------+------+ type1 | id | name | +----------->|------|------| | | | | | | | | year1 | +------+------+ +------------------+ | | | | +------+------+-----+ | | type2 | meta1|meta2 | name| | +----------> |------|------|---

How to set parameters in nested query in DQL

核能气质少年 提交于 2019-12-08 04:35:50
问题 Hi , I'd like to get number of created articles by a user, the query used to work until I added some parameters filtering the query by "fromDate" and "toDate" dates, here's my query : // query String $dql = 'SELECT u.idUser, u.lastName, u.email, u.mobile, (SELECT AVG(n.note) FROM MyBundle:Note n WHERE n.noteFor = u.idUser) AS note, (SELECT COUNT(a) FROM MyBundle:Article a WHERE (a.createdBy = u.idUser) AND (a.createdAt BETWEEN :fromDate AND :toDate)) AS articles FROM MyBundle:User u'; //