Is there a way to dynamically generate dropdownoptions in Umbraco 7.3 backoffice? - umbraco7

I have a folderstructure that looks a little like this (DocumentType in square brackets):
Municipality [Landingpage]
|_Areas [Area]
|_Plot [Plot]
|_Subdivision [Zoning]
| |_Ballig, Falkevej [Zone]
| |_Durup, Torpager [Zone]
| |_...
| |_Vinkel, Vinkelpletvej [Zone]
|_Properties [Properties]
|_Private Homes [Types]
|_Coporate Buildings [Types]
|_Other Buildinglots [Types]
In each [Zone] I would like to have a dropdown called "Type". And that type should be a value matching the name of one of the [Properties] [Types].
Visual example (comma separation = new option in dropdown):

You could try nuPickers (https://our.umbraco.com/packages/backoffice-extensions/nupickers/) - there's an XML data source that let's you do Xpath for content (https://github.com/uComponents/nuPickers/wiki/Data-Source-Xml).
You'd be setting "Options Xpath" to something like "//Types" to get all document of type "Types" in a dropdown. I think (haven't used nuPickers for a while).

Related

Include an interactive plot (wordcloud) in a dashboard

I created an interactive dashboard using hvPlot .interactive and Panel:
template = pn.template.FastListTemplate(
title='Central Africa - Word Frequency Analysis',
sidebar=['Frequency' , yaxis],
main=[ihvplot.panel(), ipanel.panel()],
accent_base_color="#88d8b0",
header_background="#88d8b0",
sidebar_width=450,
theme='dark',
)
template.show()
Where ivplot and ipanel are my interactive plot and table, respectively. However, I would like to put instead of the table, an interactive wordcloud which I created using ipywidgets:
list1 = ['Corbeau News','Journal de Bangui','Le Potentiel','Ndjoni Sango','RJDH','Radio
Lengo Songo','Radio Ndeke Luka']
def makingclouds(Category,frame,col,atitle):
wordcloud_bangui = WordCloud(stopwords= stopword , width=1600 , height=800 ,
background_color="black",
colormap="Set2").generate(''.join(data_file_1['Content']))
plt.figure(figsize=(20,10),facecolor='k')
plt.title(atitle, fontsize=40)#,fontweight="bold")
plt.imshow(wordcloud_bangui, interpolation="bilinear")
plt.axis("off")
plt.tight_layout(pad=0)
wordcloud = interact(makingclouds, Category=list1, df=fixed(data_file_1),
col=fixed('Content'),
atitle=fixed('Most used words media - Central Africa'),
frame=fixed(data_file_1[['Source','Content']]))
My question is how can I do it. I've tried simply to put 'wordcloud' instead of itable in the 4th line of the first piece of code but it tells me that the object does not have a function panel.
What can I do?

Pythonic way to generate an IPv4 report

I am looking for the most Pythonic way to print a very generic report based on input data, to sort by number instances per IP address.
The incoming data looks like this
{'file3.txt': ['notice of IP abuse', '67.60.2.222', 'sender Bill Foobar'], 'file2.txt': ['DMCA notice 987654321', '101.143.22.22', 'Copyright Owner'], 'file1.txt': ['6.22.123.222', 'spam notification', 'Esmeralda Hopkins III'], 'file0.txt': ['DMCA notice 123456789', '67.60.2.222', 'Ian Flemming']}
I want to generate output that looks like this:
(2) 67.60.2.222
Bill Foobar | notice of IP abuse
Ian Flemming | DMCA notice 123456789
(1) 101.143.22.22
Copyright Owner | DMCA notice 987654321
(1) 6.22.123.222
Esmerelda Hopkins III | spam notification
Unfortunately I am stuck with Python 2 on Windows for this task, and I am unable to install any modules like Panda because I don't have pip.
I have tried all of the following:
print dict(sorted(matrix.items(), key=lambda item: item[1]))
print matrix
print dict(sorted(matrix.items(), key=lambda item: ip))
print dict(sorted(matrix.items))
print sorted(matrix)
sorted_x = sorted(matrix.items(), key=operator.itemgetter(0))
print sorted_x
the result is always this or something very similar:
{'file3.txt': ['notice of IP abuse', '67.60.2.222', 'sender Bill Foobar'], 'file2.txt': ['DMCA notice 987654321', '101.143.22.22', 'Copyright Owner'], 'file1.txt': ['6.22.123.222', 'spam notification', 'Esmeralda Hopkins III'], 'file0.txt': ['DMCA notice 123456789', '67.60.2.222', 'Ian Flemming']}
edit: I am able to sort the lists using this:
sorted_x = sorted(matrix.items(), key=operator.itemgetter(1))
print sorted_x
Now I am looking for a way to print in a report format, without using any any specialized modules since I don't have pip. I am thinking the Naïve Method is probably the best way, so my question is what is the most pythonic way to format it pretty?

I cannot get my honeycomb panel in Sumo Logic to display the correct colors

I have the following search:
_sourceCategory="/api/SQLWatch" AND "'checktype':'AGDetails'"
| parse "'synchronization_pair':''" as synchronization_pair
| parse "'Database_Name':''" as Database_Name
| parse "'synchronization_health_desc':''" as synchronization_health_desc
| parse "'AG_Name':''" as AG_Name
| parse "'DAG':'*'" as DAG
| IF (synchronization_health_desc = "HEALTHY", 1, 0) as isHealthy
| first(_messagetime) group by synchronization_pair, Database_Name, synchronization_health_desc, AG_Name, DAG, isHealthy
which produces results like this:
synchronization_pair Database_Name synchronization_health_desc AG_Name DAG Healthy
ServerA-ServerB DB1 HEALTHY AG1 No 1
ServerC-ServerD DB2 UNHEALTHY AG2 Yes 0
When I add a honeycomb panel to my dashboard with this search all the honeycombs are blue.
I add the following settings to my Visual Settings and they are still blue.
1 to 1 GREEN
0 to 0 RED
Please help.
Thanks.
Charles.
i figured it out!
the column in the first() is the value used for the visual settings
i changed the last line to the following and it works now!!!
| first(isHealthy) group by synchronization_pair, Database_Name, synchronization_health_desc, AG_Name, DAG //, isHealthy

How do I include selectors in a theme for RStudio?

I have modified this cobalt2 .tmTheme and installed it for RStudio. I want to use some of the more granular features available for the .rsTheme format. When I go into the .rsTheme file generated by RStudio, I see many of the selectors described on this site, along with a number of additional selectors (complete list below), each followed by 1 or more declarations. I've figured out that these are CSS selectors.
.ace_active_debug_line
.ace_active-line
.ace_bracket
.ace_comment
.ace_console_error
.ace_constant
.ace_constant.ace_language
.ace_constant.ace_numeric
.ace_cursor
.ace_editor
.ace_editor.ace_autocomplete
.ace_editor_theme
.ace_find_line
.ace_fold
.ace_foreign_line
.ace_gutter
.ace_gutter-active-line
.ace_invisible
.ace_keyword
.ace_keyword.ace_operator
.ace_layer
.ace_layer.ace_marker-layer
.ace_layer.ace_print-margin-layer
.ace_line
.ace_line-hover
.ace_marker-layer
.ace_markup.ace_heading
.ace_meta.ace_tag
.ace_print-margin
.ace_selected-word
.ace_selection
.ace_selection.ace_start
.ace_step
.ace_string
.ace_support.ace_function
.ace_support.ace_type
.ace_variable
.nocolor.ace_editor
.profvis-flamegraph
.rstudio-themes-flat
.rstudio-themes-flat.ace_editor_theme
.rstudio-themes-flat.editor_dark.ace_editor_theme
.rstudio-themes-flat.rstudio-themes-dark-menus
.terminal
.terminal.focus
.terminal.focus.xterm-cursor-style-bar
.terminal.xterm-cursor-style-block.focus
.terminal-cursor
.xtermBgColor0
.xtermBgColor1
.xtermBgColor10
.xtermBgColor100
.xtermBgColor101
.xtermBgColor102
.xtermBgColor103
.xtermBgColor104
.xtermBgColor105
.xtermBgColor106
.xtermBgColor107
.xtermBgColor108
.xtermBgColor109
.xtermBgColor11
.xtermBgColor110
.xtermBgColor111
.xtermBgColor112
.xtermBgColor113
.xtermBgColor114
.xtermBgColor115
.xtermBgColor116
.xtermBgColor117
.xtermBgColor118
.xtermBgColor119
.xtermBgColor12
.xtermBgColor120
.xtermBgColor121
.xtermBgColor122
.xtermBgColor123
.xtermBgColor124
.xtermBgColor125
.xtermBgColor126
.xtermBgColor127
.xtermBgColor128
.xtermBgColor129
.xtermBgColor13
.xtermBgColor130
.xtermBgColor131
.xtermBgColor132
.xtermBgColor133
.xtermBgColor134
.xtermBgColor135
.xtermBgColor136
.xtermBgColor137
.xtermBgColor138
.xtermBgColor139
.xtermBgColor14
.xtermBgColor140
.xtermBgColor141
.xtermBgColor142
.xtermBgColor143
.xtermBgColor144
.xtermBgColor145
.xtermBgColor146
.xtermBgColor147
.xtermBgColor148
.xtermBgColor149
.xtermBgColor15
.xtermBgColor150
.xtermBgColor151
.xtermBgColor152
.xtermBgColor153
.xtermBgColor154
.xtermBgColor155
.xtermBgColor156
.xtermBgColor157
.xtermBgColor158
.xtermBgColor159
.xtermBgColor16
.xtermBgColor160
.xtermBgColor161
.xtermBgColor162
.xtermBgColor163
.xtermBgColor164
.xtermBgColor165
.xtermBgColor166
.xtermBgColor167
.xtermBgColor168
.xtermBgColor169
.xtermBgColor17
.xtermBgColor170
.xtermBgColor171
.xtermBgColor172
.xtermBgColor173
.xtermBgColor174
.xtermBgColor175
.xtermBgColor176
.xtermBgColor177
.xtermBgColor178
.xtermBgColor179
.xtermBgColor18
.xtermBgColor180
.xtermBgColor181
.xtermBgColor182
.xtermBgColor183
.xtermBgColor184
.xtermBgColor185
.xtermBgColor186
.xtermBgColor187
.xtermBgColor188
.xtermBgColor189
.xtermBgColor19
.xtermBgColor190
.xtermBgColor191
.xtermBgColor192
.xtermBgColor193
.xtermBgColor194
.xtermBgColor195
.xtermBgColor196
.xtermBgColor197
.xtermBgColor198
.xtermBgColor199
.xtermBgColor2
.xtermBgColor20
.xtermBgColor200
.xtermBgColor201
.xtermBgColor202
.xtermBgColor203
.xtermBgColor204
.xtermBgColor205
.xtermBgColor206
.xtermBgColor207
.xtermBgColor208
.xtermBgColor209
.xtermBgColor21
.xtermBgColor210
.xtermBgColor211
.xtermBgColor212
.xtermBgColor213
.xtermBgColor214
.xtermBgColor215
.xtermBgColor216
.xtermBgColor217
.xtermBgColor218
.xtermBgColor219
.xtermBgColor22
.xtermBgColor220
.xtermBgColor221
.xtermBgColor222
.xtermBgColor223
.xtermBgColor224
.xtermBgColor225
.xtermBgColor226
.xtermBgColor227
.xtermBgColor228
.xtermBgColor229
.xtermBgColor23
.xtermBgColor230
.xtermBgColor231
.xtermBgColor232
.xtermBgColor233
.xtermBgColor234
.xtermBgColor235
.xtermBgColor236
.xtermBgColor237
.xtermBgColor238
.xtermBgColor239
.xtermBgColor24
.xtermBgColor240
.xtermBgColor241
.xtermBgColor242
.xtermBgColor243
.xtermBgColor244
.xtermBgColor245
.xtermBgColor246
.xtermBgColor247
.xtermBgColor248
.xtermBgColor249
.xtermBgColor25
.xtermBgColor250
.xtermBgColor251
.xtermBgColor252
.xtermBgColor253
.xtermBgColor254
.xtermBgColor255
.xtermBgColor26
.xtermBgColor27
.xtermBgColor28
.xtermBgColor29
.xtermBgColor3
.xtermBgColor30
.xtermBgColor31
.xtermBgColor32
.xtermBgColor33
.xtermBgColor34
.xtermBgColor35
.xtermBgColor36
.xtermBgColor37
.xtermBgColor38
.xtermBgColor39
.xtermBgColor4
.xtermBgColor40
.xtermBgColor41
.xtermBgColor42
.xtermBgColor43
.xtermBgColor44
.xtermBgColor45
.xtermBgColor46
.xtermBgColor47
.xtermBgColor48
.xtermBgColor49
.xtermBgColor5
.xtermBgColor50
.xtermBgColor51
.xtermBgColor52
.xtermBgColor53
.xtermBgColor54
.xtermBgColor55
.xtermBgColor56
.xtermBgColor57
.xtermBgColor58
.xtermBgColor59
.xtermBgColor6
.xtermBgColor60
.xtermBgColor61
.xtermBgColor62
.xtermBgColor63
.xtermBgColor64
.xtermBgColor65
.xtermBgColor66
.xtermBgColor67
.xtermBgColor68
.xtermBgColor69
.xtermBgColor7
.xtermBgColor70
.xtermBgColor71
.xtermBgColor72
.xtermBgColor73
.xtermBgColor74
.xtermBgColor75
.xtermBgColor76
.xtermBgColor77
.xtermBgColor78
.xtermBgColor79
.xtermBgColor8
.xtermBgColor80
.xtermBgColor81
.xtermBgColor82
.xtermBgColor83
.xtermBgColor84
.xtermBgColor85
.xtermBgColor86
.xtermBgColor87
.xtermBgColor88
.xtermBgColor89
.xtermBgColor9
.xtermBgColor90
.xtermBgColor91
.xtermBgColor92
.xtermBgColor93
.xtermBgColor94
.xtermBgColor95
.xtermBgColor96
.xtermBgColor97
.xtermBgColor98
.xtermBgColor99
.xtermBlink
.xtermBold
.xtermColor0
.xtermColor1
.xtermColor10
.xtermColor100
.xtermColor101
.xtermColor102
.xtermColor103
.xtermColor104
.xtermColor105
.xtermColor106
.xtermColor107
.xtermColor108
.xtermColor109
.xtermColor11
.xtermColor110
.xtermColor111
.xtermColor112
.xtermColor113
.xtermColor114
.xtermColor115
.xtermColor116
.xtermColor117
.xtermColor118
.xtermColor119
.xtermColor12
.xtermColor120
.xtermColor121
.xtermColor122
.xtermColor123
.xtermColor124
.xtermColor125
.xtermColor126
.xtermColor127
.xtermColor128
.xtermColor129
.xtermColor13
.xtermColor130
.xtermColor131
.xtermColor132
.xtermColor133
.xtermColor134
.xtermColor135
.xtermColor136
.xtermColor137
.xtermColor138
.xtermColor139
.xtermColor14
.xtermColor140
.xtermColor141
.xtermColor142
.xtermColor143
.xtermColor144
.xtermColor145
.xtermColor146
.xtermColor147
.xtermColor148
.xtermColor149
.xtermColor15
.xtermColor150
.xtermColor151
.xtermColor152
.xtermColor153
.xtermColor154
.xtermColor155
.xtermColor156
.xtermColor157
.xtermColor158
.xtermColor159
.xtermColor16
.xtermColor160
.xtermColor161
.xtermColor162
.xtermColor163
.xtermColor164
.xtermColor165
.xtermColor166
.xtermColor167
.xtermColor168
.xtermColor169
.xtermColor17
.xtermColor170
.xtermColor171
.xtermColor172
.xtermColor173
.xtermColor174
.xtermColor175
.xtermColor176
.xtermColor177
.xtermColor178
.xtermColor179
.xtermColor18
.xtermColor180
.xtermColor181
.xtermColor182
.xtermColor183
.xtermColor184
.xtermColor185
.xtermColor186
.xtermColor187
.xtermColor188
.xtermColor189
.xtermColor19
.xtermColor190
.xtermColor191
.xtermColor192
.xtermColor193
.xtermColor194
.xtermColor195
.xtermColor196
.xtermColor197
.xtermColor198
.xtermColor199
.xtermColor2
.xtermColor20
.xtermColor200
.xtermColor201
.xtermColor202
.xtermColor203
.xtermColor204
.xtermColor205
.xtermColor206
.xtermColor207
.xtermColor208
.xtermColor209
.xtermColor21
.xtermColor210
.xtermColor211
.xtermColor212
.xtermColor213
.xtermColor214
.xtermColor215
.xtermColor216
.xtermColor217
.xtermColor218
.xtermColor219
.xtermColor22
.xtermColor220
.xtermColor221
.xtermColor222
.xtermColor223
.xtermColor224
.xtermColor225
.xtermColor226
.xtermColor227
.xtermColor228
.xtermColor229
.xtermColor23
.xtermColor230
.xtermColor231
.xtermColor232
.xtermColor233
.xtermColor234
.xtermColor235
.xtermColor236
.xtermColor237
.xtermColor238
.xtermColor239
.xtermColor24
.xtermColor240
.xtermColor241
.xtermColor242
.xtermColor243
.xtermColor244
.xtermColor245
.xtermColor246
.xtermColor247
.xtermColor248
.xtermColor249
.xtermColor25
.xtermColor250
.xtermColor251
.xtermColor252
.xtermColor253
.xtermColor254
.xtermColor255
.xtermColor26
.xtermColor27
.xtermColor28
.xtermColor29
.xtermColor3
.xtermColor30
.xtermColor31
.xtermColor32
.xtermColor33
.xtermColor34
.xtermColor35
.xtermColor36
.xtermColor37
.xtermColor38
.xtermColor39
.xtermColor4
.xtermColor40
.xtermColor41
.xtermColor42
.xtermColor43
.xtermColor44
.xtermColor45
.xtermColor46
.xtermColor47
.xtermColor48
.xtermColor49
.xtermColor5
.xtermColor50
.xtermColor51
.xtermColor52
.xtermColor53
.xtermColor54
.xtermColor55
.xtermColor56
.xtermColor57
.xtermColor58
.xtermColor59
.xtermColor6
.xtermColor60
.xtermColor61
.xtermColor62
.xtermColor63
.xtermColor64
.xtermColor65
.xtermColor66
.xtermColor67
.xtermColor68
.xtermColor69
.xtermColor7
.xtermColor70
.xtermColor71
.xtermColor72
.xtermColor73
.xtermColor74
.xtermColor75
.xtermColor76
.xtermColor77
.xtermColor78
.xtermColor79
.xtermColor8
.xtermColor80
.xtermColor81
.xtermColor82
.xtermColor83
.xtermColor84
.xtermColor85
.xtermColor86
.xtermColor87
.xtermColor88
.xtermColor89
.xtermColor9
.xtermColor90
.xtermColor91
.xtermColor92
.xtermColor93
.xtermColor94
.xtermColor95
.xtermColor96
.xtermColor97
.xtermColor98
.xtermColor99
.xterm-cursor-blink-on
.xtermHidden
.xtermInvertBgColor
.xtermInvertColor
.xtermItalic
.xterm-selection
.xtermStrike
.xtermUnderline
.xterm-viewport
Are all of these declarations things I can safely change? Where can I find more detailed information about how to edit .rsTheme files and what type of feature each selector points to? Is there a way to include the selectors in the .tmTheme file, so that RStudio creates the "generated values" automatically?

trying to parse specific data using xpath

I have a small xml file that I'm trying to grab the away_team first and then the home_team second.
/game/team/statistics/#goals gives me the data I want but I need to reverse the order. So I'm trying to understand how to get the away_team goals first, followed by the home_team.
Below is the file
<game id="f24275a9-4f30-4a81-abdf-d16a9aeda087" status="closed" coverage="full" home_team="4416d559-0f24-11e2-8525-18a905767e44" away_team="44167db4-0f24-11e2-8525-18a905767e44" scheduled="2013-10-10T23:00:00+00:00" attendance="18210" start_time="2013-10-10T23:08:00+00:00" end_time="2013-10-11T01:32:00+00:00" clock="00:00" period="3" xmlns="http://feed.elasticstats.com/schema/hockey/game-v2.0.xsd">
<venue id="bd7b42fa-19bb-4b91-8615-214ccc3ff987" name="First Niagara Center" capacity="18690" address="One Seymour H. Knox III Plaza" city="Buffalo" state="NY" zip="14203" country="USA"/>
<team name="Sabres" market="Buffalo" id="4416d559-0f24-11e2-8525-18a905767e44" points="1">
<scoring>
<period number="1" sequence="1" points="1"/>
<period number="2" sequence="2" points="0"/>
<period number="3" sequence="3" points="0"/>
</scoring>
<statistics goals="1" assists="2" penalties="7" penalty_minutes="23" team_penalties="0" team_penalty_minutes="0" shots="27" blocked_att="14" missed_shots="8" hits="25" giveaways="5" takeaways="10" blocked_shots="7" faceoffs_won="22" faceoffs_lost="28" powerplays="1" faceoffs="50" faceoff_win_pct="44.0" shooting_pct="3.7" points="3">
<powerplay faceoffs_won="2" faceoffs_lost="0" shots="0" goals="0" missed_shots="1" assists="0" faceoff_win_pct="100.0" faceoffs="2"/>
<shorthanded faceoffs_won="3" faceoffs_lost="3" shots="1" goals="0" missed_shots="0" assists="0" faceoffs="6" faceoff_win_pct="50.0"/>
<evenstrength faceoff_win_pct="40.5" missed_shots="7" goals="1" faceoffs_won="17" shots="26" faceoffs="42" faceoffs_lost="25" assists="2"/>
<penalty shots="0" goals="0" missed_shots="0"/>
</statistics>
<shootout shots="0" missed_shots="0" goals="0" shots_against="0" goals_against="0" saves="0" saves_pct="0"/>
<goaltending shots_against="33" goals_against="4" saves="29" saves_pct="0.879" total_shots_against="33" total_goals_against="4">
<powerplay shots_against="0" goals_against="0" saves="0" saves_pct="0"/>
<shorthanded shots_against="7" goals_against="0" saves="7" saves_pct="1.0"/>
<evenstrength goals_against="4" saves_pct="0.846" shots_against="26" saves="22"/>
<penalty shots_against="0" goals_against="0" saves="0" saves_pct="0"/>
<emptynet goals_against="0" shots_against="0">
<powerplay goals_against="0"/>
<shorthanded goals_against="0"/>
<evenstrength goals_against="0"/>
</emptynet>
</goaltending>
Here's an XPath 2.0 expression that should do what you asked, yielding a sequence of two elements:
(/game/team[#id = /game/#home_team]/statistics/#goals,
/game/team[#id = /game/#away_team]/statistics/#goals)
Credit to #Ian for sleuthing out the details of the question.
In XPath 1.0, you could concatenate string data from the two teams in whatever order you want:
concat(/game/team[#id = /game/#home_team]/statistics/#goals, ' ',
/game/team[#id = /game/#away_team]/statistics/#goals)
But as Ian said, you can't produce a nodeset with an order different from document order. (I don't think a nodeset has any intrinsic order at all... it's how it's processed that imposes an order.)
Update:
As Ian pointed out, your XML data is in a namespace, thanks to the default namespace declaration on <game>. Since you said that "/game/team/statistics/#goals gives me the data", I'm assuming that you've already taken care of this aspect of the problem, perhaps by declaring the default namespace in your XPath execution environment.

Resources