Stack Overflow

Subscribe to Stack Overflow feed
most recent 30 from stackoverflow.com 2018-01-24T04:53:46Z
Updated: 2 hours 34 min ago

Add a string of html attributes to a html element

Wed, 10/04/2017 - 13:08

I have a string of attributes written in valid html, and I want to put those attributes on an actual html element (not a html string of an element).

For example, I have the string of attributes in the sensibly named attributesStr variable, and I want to add those attributes to the #htmlElement div.

var attributesStr = ""; attributesStr += " class='regularClass'"; // Needs to handle key value attributes. attributesStr += " title='Title... with spaces!'"; // And attributes with spaces. attributesStr += " style='color: red; font-weight: bold;'"; // And style with multiple properties. attributesStr += " data-attributenovalue"; // And attributes with no value. // Your special code to add the attributes to `#htmlElement` goes here. <div id="htmlElement"> The HTML element! </div>

After the JQuery / JavaScript code is run, #htmlElement should look like:

<div id="htmlElement" class='regularClass' title='Title... with spaces!' style='color: red; font-weight: bold;' data-attributenovalue> The HTML element! </div>

How can I do this in JavaScript or Jquery?

First attempt: I was thinking I could do this by .split()ing attributesStr on spaces, and then splitting each individual attribute key value pair on the =, and then iterating that array and adding each key value pair with JQuery's .prop() or .attr(), but this wouldn't work for two reasons:

  1. It would fail on the style and title attributes because they have spaces.
  2. It might fail on the attributes with no value.

Is it possible to align flex items children with cousins from sibling flex items?

Wed, 10/04/2017 - 13:07

Vertically aligning items to top, bottom or centre is simple when the items are fixed heights, but if more than 1 child of the flex item is fluid I can not get cousins to align using CSS3.

I know this can easily be achieved with Masonry but would prefer to avoid using JS if possible. Fixed heights also resolves the issue, but when content comes from user input this can fall over, especially if responsive.

The following snippet shows the first two flex items children aligning with their cousins nicely.

* { box-sizing: border-box; } .container { background-color: #ccc; display: flex; flex-wrap: wrap; max-width: 680px; padding: 5px; margin: 0 auto; } .block { display: flex; width: 50%; padding: 5px; } .block-content { display: flex; flex-direction: column; background-color: #fff; width: 100%; padding: 10px; } .block-content h2 { margin-top: 0; margin-bottom: auto; } .block-content p:nth-of-type(1) { flex-grow: 1; flex-shrink: 0; flex-basis: auto; } .block-content p:nth-of-type(2) {} .block-content p:nth-of-type(3) {} <div class="container"> <div class="block"> <div class="block-content"> <h2>Title 1</h2> <p>Test text 1</p> <p>Test text 2</p> <button>Button</button> </div> </div> <div class="block"> <div class="block-content"> <h2>Title 2</h2> <p>Test text 1 is a bit longer to force it to wrap</p> <p>Test text 2</p> <button>Button</button> </div> </div> <div class="block"> <div class="block-content"> <h2>Title 3 is a bit longer to make it wrap</h2> <p>Test text 1 is a bit longer to force it to wrap</p> <p>Test text 2</p> <button>Button</button> </div> </div> <div class="block"> <div class="block-content"> <h2>Title 4</h2> <p>Test text 1</p> <p>Test text 2 is a bit longer to force it to wrap</p> <button>Button</button> </div> </div> </div>

When the title text string is a bit longer in the third flex item to make it wrap onto 2 lines, 'Title 4' does not expand to push down the first paragraph. If I set flex-grow to 1 on the h2s and to 0 for the first paragraph, this issue is resolved but a new issue arises with 'Test text 1' in the first flex item.

I would also like 'Test text 2' in the fourth flex item to align to the 'text top' of its cousin in the third flex item. In other words for the last paragraph in third block to grow to height of last paragraph in the fouth block, ideally without effecting the row above as they both fit on one line.

How do I vectorize this code?

Wed, 10/04/2017 - 12:54

I have written a recursive function, however, it takes a lot of time. Hence I vectorized it, but it does not yield the same result as the recursive function. This is my non-vectorized code:

function visited = procedure_explore( u, adj_mat, visited ) visited(u) = 1; neighbours = find(adj_mat(u,:)); for ii = 1:length(neighbours) if (visited(neighbours(ii)) == 0) visited = procedure_explore( neighbours(ii), adj_mat, visited ); end end end

This is my vectorized code:

function visited = procedure_explore_vec( u, adj_mat, visited ) visited(u) = 1; neighbours = find(adj_mat(u,:)); len_neighbours=length(neighbours); visited_neighbours_zero=visited(neighbours(1:len_neighbours)) == 0; if(~isempty(visited_neighbours_zero)) visited = procedure_explore_vec( neighbours(visited_neighbours_zero), adj_mat, visited ); end end

This is the test code

function main adj_mat=[0 0 0 0; 1 0 1 1; 1 0 0 0; 1 0 0 1]; u=2; visited=zeros(size(adj_mat,1)); tic visited = procedure_explore( u, adj_mat, visited ) toc visited=zeros(size(adj_mat,1)); tic visited = procedure_explore_vec( u, adj_mat, visited ) toc end

This is the algorithm I'm trying to implement:

If vectorization is impossible, a mex solution would also be good.

Update benchmark: This benchmark is based on MATLAB 2017a. It shows that the original code is faster than other methods

Speed up between original and logical methods is 0.39672 Speed up between original and nearest methods is 0.0042583

Full code

function main_recersive adj_mat=[0 0 0 0; 1 0 1 1; 1 0 0 0; 1 0 0 1]; u=2; visited=zeros(size(adj_mat,1)); f_original=@()(procedure_explore( u, adj_mat, visited )); t_original=timeit(f_original); f_logical=@()(procedure_explore_logical( u, adj_mat )); t_logical=timeit(f_logical); f_nearest=@()(procedure_explore_nearest( u, adj_mat,visited )); t_nearest=timeit(f_nearest); disp(['Speed up between original and logical methods is ',num2str(t_original/t_logical)]) disp(['Speed up between original and nearest methods is ',num2str(t_original/t_nearest)]) end function visited = procedure_explore( u, adj_mat, visited ) visited(u) = 1; neighbours = find(adj_mat(u,:)); for ii = 1:length(neighbours) if (visited(neighbours(ii)) == 0) visited = procedure_explore( neighbours(ii), adj_mat, visited ); end end end function visited = procedure_explore_nearest( u, adj_mat, visited ) % add u since your function also includes it. nodeIDs = [nearest(digraph(adj_mat),u,inf) ; u]; % transform to output format of your function visited = zeros(size(adj_mat,1)); visited(nodeIDs) = 1; end function visited = procedure_explore_logical( u, adj_mat ) visited = false(1, size(adj_mat, 1)); visited(u) = true; new_visited = visited; while any(new_visited) visited = any([visited; new_visited], 1); new_visited = any(adj_mat(new_visited, :), 1); new_visited = and(new_visited, ~visited); end end

Linear regresion of rectangular table against one set of values

Wed, 10/04/2017 - 12:52

I have a rectangular table with three variables: country, year and inflation. I already have all the descriptives I can have, now I need to do some analytics, and figured that I should do some linear regression against a target country. The best idea I had was to create a new variable called inflation.in.country.x and loop through the inflation of x in this new column but that seems somehow unclean solution.

How to get a linear regression of a rectangular data table? The structure is like this:

> dat %>% str 'data.frame': 1196 obs. of 3 variables: $ Country.Name: Factor w/ 31 levels "Albania","Armenia",..: 9 8 10 11 12 14 15 16 17 19 ... $ year : chr "1967" "1967" "1967" "1967" ... $ inflation : num 1.238 8.328 3.818 0.702 1.467 ...

I want to take Armenia inflation as dependent variable and Albania as independent to get a linear regression. It is possible without transforming the data and keeping the years coherent?

How to enable TextColor & FontSize selection option in WYSIWYG editor for web content in liferay DXP

Wed, 10/04/2017 - 12:02

I am having a html field in web content in liferay 7. i am using liferay default WYSIWYG editor. I want to allow user to change the text color and background.

Let me know if anyone has idea to achieve this.

Thanks

How to create multiple buttons to change a shortcode inline

Wed, 10/04/2017 - 10:39

I have a number of photo galleries created in my WordPress site, but I only want to show one at a time. I'm trying to create a series of buttons / hyperlinks that will change which gallery is displayed in a page (not a popup page).

I've tried the following (each <li> is a different attempt) but nothing is working for me. Can anyone help?

<ul> <li><a onClick="document.getElementById('showMe').innerHTML = '[foogallery id=123]'">Gallery 1</a></li> <li><a onClick="document.getElementById('showMe').innerHTML = '<?php echo do_shortcode( \'[foogallery id=234]\' ); ?>'">Gallery 2</a></li> <li><a href="<?php echo do_shortcode( '[foogallery id=345]' ); ?>" target="showMe" >Gallery 3</a></li> </ul> <div id="showMe"></div>

Migrating an On Premise solution to Azure

Wed, 10/04/2017 - 10:24

I have an on premise solution that consists of a server (1 machine) and X users (each in 1 machine). All the users are using the same Win32 application. The question is: How do I translate this in to an Azure enviroment? Each of the users machines are using 4 CPUs and 8 GB of RAM (this is necessary).

Do I have to configure a new machine which has to have the 4 CPUs and 8GB per user, or is there a more efficient way to get this done? Because otherwhise this is not economically profitable.

I was thinking about using XenApp and only one VM for all the users to solve this problem. But I'm not quite sure.

Any help is welcome.

How to find xpath in below two html blocks?

Wed, 10/04/2017 - 09:54

How can I find out xpath in below 2 html blocks? Both html code are same, but only ID differs. Id is dynamic, so difficult to find xpath:

<div id="discoverytree-body" class="x-panel-body x-grid-body x-panel-body-default-framed x-panel-body-default-framed x-layout-fit" style="padding: 0px; border-top-width: 1px; width: 264px; left: 0px; height: 425px; top: 48px;"> <div id="treeview-1015" class="x-grid-view x-fit-item x-grid-view-default" tabindex="-1" style="margin: 0px; width: 262px; height: 423px;"> <table class="x-grid-table x-grid-table-resizer" style="width:10000px;" cellspacing="0" cellpadding="0" border="0"> <tbody> <tr class="x-grid-header-row"> <th class="x-grid-col-resizer-treecolumn-1014" style="width: 10000px; height: 0px;"/> </tr> <tr class="x-grid-row x-grid-tree-node-expanded"> <td class="x-grid-cell-treecolumn x-grid-cell x-grid-cell-treecolumn-1014 x-grid-cell-first"> <div class="x-grid-cell-inner" style="text-align: left; ;"> <img class="x-tree-elbow-end-plus x-tree-expander" src="data:image/gif;base64,R0lGODlhAQABAID/AMDAwAAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw=="/> <img class="x-tree-icon x-tree-icon-parent iconDiscovery" src="data:image/gif;base64,R0lGODlhAQABAID/AMDAwAAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw=="/> Discovery </div> </td> </tr> <tr class="x-grid-row x-grid-tree-node-leaf"> <td class="x-grid-cell-treecolumn x-grid-cell x-grid-cell-treecolumn-1014 x-grid-cell-first"> <div id="ext-gen1349" class="x-grid-cell-inner " style="text-align: left; ;"> <img class="x-tree-elbow-empty" src="data:image/gif;base64,R0lGODlhAQABAID/AMDAwAAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw=="/> <img class="x-tree-elbow" src="data:image/gif;base64,R0lGODlhAQABAID/AMDAwAAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw=="/> <img class="x-tree-icon x-tree-icon-leaf iconOU" src="data:image/gif;base64,R0lGODlhAQABAID/AMDAwAAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw=="/> Common Settings </div> </td> </tr> <tr class="x-grid-row x-grid-tree-node-leaf"> <td class="x-grid-cell-treecolumn x-grid-cell x-grid-cell-treecolumn-1014 x-grid-cell-first"> <div id="ext-gen1345" class="x-grid-cell-inner " style="text-align: left; ;"> <img class="x-tree-elbow-empty" src="data:image/gif;base64,R0lGODlhAQABAID/AMDAwAAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw=="/> <img class="x-tree-elbow" src="data:image/gif;base64,R0lGODlhAQABAID/AMDAwAAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw=="/> <img class="x-tree-icon x-tree-icon-leaf iconOU" src="data:image/gif;base64,R0lGODlhAQABAID/AMDAwAAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw=="/> Manage Components </div> </td> </tr> <tr class="x-grid-row x-grid-tree-node-expanded x-grid-row-over"> <td class="x-grid-cell-treecolumn x-grid-cell x-grid-cell-treecolumn-1014 x-grid-cell-first"> <div class="x-grid-cell-inner " style="text-align: left; ;"> <img class="x-tree-elbow-empty" src="data:image/gif;base64,R0lGODlhAQABAID/AMDAwAAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw=="/> <img class="x-tree-elbow-plus x-tree-expander" src="data:image/gif;base64,R0lGODlhAQABAID/AMDAwAAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw=="/> <img class="x-tree-icon x-tree-icon-parent iconManagerDiscovery" src="data:image/gif;base64,R0lGODlhAQABAID/AMDAwAAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw=="/> Manager Discovery </div> </td> </tr> <tr class="x-grid-row x-grid-tree-node-expanded"> <td id="ext-gen1342" class="x-grid-cell-treecolumn x-grid-cell x-grid-cell-treecolumn-1014 x-grid-cell-first"> <div class="x-grid-cell-inner " style="text-align: left; ;"> <img class="x-tree-elbow-empty" src="data:image/gif;base64,R0lGODlhAQABAID/AMDAwAAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw=="/> <img class="x-tree-elbow-line" src="data:image/gif;base64,R0lGODlhAQABAID/AMDAwAAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw=="/> <img class="x-tree-elbow-plus x-tree-expander" src="data:image/gif;base64,R0lGODlhAQABAID/AMDAwAAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw=="/> <img class="x-tree-icon x-tree-icon-parent iconSettings" src="data:image/gif;base64,R0lGODlhAQABAID/AMDAwAAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw=="/> Settings </div> </td> </tr> <tr class="x-grid-row x-grid-tree-node-leaf x-grid-row-selected x-grid-row-focused"> <td id="ext-gen1384" class="x-grid-cell-treecolumn x-grid-cell x-grid-cell-treecolumn-1014 x-grid-cell-first"> <div id="ext-gen1340" class="x-grid-cell-inner " style="text-align: left; ;"> <img class="x-tree-elbow-empty" src="data:image/gif;base64,R0lGODlhAQABAID/AMDAwAAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw=="/> <img class="x-tree-elbow-line" src="data:image/gif;base64,R0lGODlhAQABAID/AMDAwAAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw=="/> <img class="x-tree-elbow-line" src="data:image/gif;base64,R0lGODlhAQABAID/AMDAwAAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw=="/> <img class="x-tree-elbow" src="data:image/gif;base64,R0lGODlhAQABAID/AMDAwAAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw=="/> <img class="x-tree-icon x-tree-icon-leaf iconOU" src="data:image/gif;base64,R0lGODlhAQABAID/AMDAwAAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw=="/> General </div> </td> </tr> <tr class="x-grid-row x-grid-tree-node-leaf"> <td id="ext-gen1380" class="x-grid-cell-treecolumn x-grid-cell x-grid-cell-treecolumn-1014 x-grid-cell-first"> <div class="x-grid-cell-inner " style="text-align: left; ;"> <img class="x-tree-elbow-empty" src="data:image/gif;base64,R0lGODlhAQABAID/AMDAwAAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw=="/> <img class="x-tree-elbow-line" src="data:image/gif;base64,R0lGODlhAQABAID/AMDAwAAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw=="/> <img class="x-tree-elbow-line" src="data:image/gif;base64,R0lGODlhAQABAID/AMDAwAAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw=="/> <img id="ext-gen1336" class="x-tree-elbow" src="data:image/gif;base64,R0lGODlhAQABAID/AMDAwAAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw=="/> <img class="x-tree-icon x-tree-icon-leaf iconOU" src="data:image/gif;base64,R0lGODlhAQABAID/AMDAwAAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw=="/> Virtual Platforms </div> </td> </tr> <tr class="x-grid-row x-grid-tree-node-leaf"> <td class="x-grid-cell-treecolumn x-grid-cell x-grid-cell-treecolumn-1014 x-grid-cell-first"> <div class="x-grid-cell-inner " style="text-align: left; ;"> <img class="x-tree-elbow-empty" src="data:image/gif;base64,R0lGODlhAQABAID/AMDAwAAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw=="/> <img class="x-tree-elbow-line" src="data:image/gif;base64,R0lGODlhAQABAID/AMDAwAAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw=="/> <img id="ext-gen1376" class="x-tree-elbow-line" src="data:image/gif;base64,R0lGODlhAQABAID/AMDAwAAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw=="/> <img id="ext-gen1332" class="x-tree-elbow" src="data:image/gif;base64,R0lGODlhAQABAID/AMDAwAAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw=="/> <img class="x-tree-icon x-tree-icon-leaf iconOU" src="data:image/gif;base64,R0lGODlhAQABAID/AMDAwAAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw=="/> Public Clouds </div> </td> </tr> <tr class="x-grid-row x-grid-tree-node-leaf"> <td class="x-grid-cell-treecolumn x-grid-cell x-grid-cell-treecolumn-1014 x-grid-cell-first"> <div id="ext-gen1243" class="x-grid-cell-inner " style="text-align: left; ;"> <img class="x-tree-elbow-empty" src="data:image/gif;base64,R0lGODlhAQABAID/AMDAwAAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw=="/> <img id="ext-gen1372" class="x-tree-elbow-line" src="data:image/gif;base64,R0lGODlhAQABAID/AMDAwAAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw=="/> <img class="x-tree-elbow-line" src="data:image/gif;base64,R0lGODlhAQABAID/AMDAwAAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw=="/> <img id="ext-gen1239" class="x-tree-elbow" src="data:image/gif;base64,R0lGODlhAQABAID/AMDAwAAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw=="/> <img class="x-tree-icon x-tree-icon-leaf iconOU" src="data:image/gif;base64,R0lGODlhAQABAID/AMDAwAAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw=="/> Citrix NetScalers </div> </td> </tr> <tr class="x-grid-row x-grid-tree-node-leaf"> <td class="x-grid-cell-treecolumn x-grid-cell x-grid-cell-treecolumn-1014 x-grid-cell-first"> <div id="ext-gen1247" class="x-grid-cell-inner " style="text-align: left; ;"> <img class="x-tree-elbow-empty" src="data:image/gif;base64,R0lGODlhAQABAID/AMDAwAAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw=="/> <img id="ext-gen1368" class="x-tree-elbow-line" src="data:image/gif;base64,R0lGODlhAQABAID/AMDAwAAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw=="/> <img class="x-tree-elbow-line" src="data:image/gif;base64,R0lGODlhAQABAID/AMDAwAAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw=="/> <img id="ext-gen1325" class="x-tree-elbow" src="data:image/gif;base64,R0lGODlhAQABAID/AMDAwAAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw=="/> <img class="x-tree-icon x-tree-icon-leaf iconOU" src="data:image/gif;base64,R0lGODlhAQABAID/AMDAwAAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw=="/> vCloud Directors </div> </td> </tr> <tr class="x-grid-row x-grid-tree-node-leaf"> <td class="x-grid-cell-treecolumn x-grid-cell x-grid-cell-treecolumn-1014 x-grid-cell-first"> <div id="ext-gen1251" class="x-grid-cell-inner " style="text-align: left; ;"> <img class="x-tree-elbow-empty" src="data:image/gif;base64,R0lGODlhAQABAID/AMDAwAAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw=="/> <img class="x-tree-elbow-line" src="data:image/gif;base64,R0lGODlhAQABAID/AMDAwAAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw=="/> <img class="x-tree-elbow-line" src="data:image/gif;base64,R0lGODlhAQABAID/AMDAwAAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw=="/> <img id="ext-gen1321" class="x-tree-elbow-end" src="data:image/gif;base64,R0lGODlhAQABAID/AMDAwAAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw=="/> <img class="x-tree-icon x-tree-icon-leaf iconOU" src="data:image/gif;base64,R0lGODlhAQABAID/AMDAwAAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw=="/> Storage Discovery </div> </td> </tr> <tr class="x-grid-row x-grid-tree-node-expanded"> <td class="x-grid-cell-treecolumn x-grid-cell x-grid-cell-treecolumn-1014 x-grid-cell-first"> <div class="x-grid-cell-inner " style="text-align: left; ;"> <img class="x-tree-elbow-empty" src="data:image/gif;base64,R0lGODlhAQABAID/AMDAwAAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw=="/> <img class="x-tree-elbow-line" src="data:image/gif;base64,R0lGODlhAQABAID/AMDAwAAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw=="/> <img class="x-tree-elbow-end-plus x-tree-expander" src="data:image/gif;base64,R0lGODlhAQABAID/AMDAwAAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw=="/> <img class="x-tree-icon x-tree-icon-parent iconActions" src="data:image/gif;base64,R0lGODlhAQABAID/AMDAwAAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw=="/> Actions </div> </td> </tr> <tr class="x-grid-row x-grid-tree-node-leaf"> <tr class="x-grid-row x-grid-tree-node-leaf"> <tr class="x-grid-row x-grid-tree-node-leaf"> <tr class="x-grid-row x-grid-tree-node-expanded"> <td class="x-grid-cell-treecolumn x-grid-cell x-grid-cell-treecolumn-1014 x-grid-cell-first"> <div class="x-grid-cell-inner " style="text-align: left; ;"> <img class="x-tree-elbow-empty" src="data:image/gif;base64,R0lGODlhAQABAID/AMDAwAAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw=="/> <img class="x-tree-elbow-end-plus x-tree-expander" src="data:image/gif;base64,R0lGODlhAQABAID/AMDAwAAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw=="/> <img class="x-tree-icon x-tree-icon-parent iconAgentDiscovery" src="data:image/gif;base64,R0lGODlhAQABAID/AMDAwAAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw=="/> Agent Discovery </div> </td> </tr> <tr class="x-grid-row x-grid-tree-node-expanded"> <td class="x-grid-cell-treecolumn x-grid-cell x-grid-cell-treecolumn-1014 x-grid-cell-first"> <div class="x-grid-cell-inner " style="text-align: left; ;"> <img class="x-tree-elbow-empty" src="data:image/gif;base64,R0lGODlhAQABAID/AMDAwAAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw=="/> <img class="x-tree-elbow-empty" src="data:image/gif;base64,R0lGODlhAQABAID/AMDAwAAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw=="/> <img class="x-tree-elbow-plus x-tree-expander" src="data:image/gif;base64,R0lGODlhAQABAID/AMDAwAAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw=="/> <img class="x-tree-icon x-tree-icon-parent iconSettings" src="data:image/gif;base64,R0lGODlhAQABAID/AMDAwAAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw=="/> Settings </div> </td> </tr> <tr class="x-grid-row x-grid-tree-node-leaf"> <td class="x-grid-cell-treecolumn x-grid-cell x-grid-cell-treecolumn-1014 x-grid-cell-first"> <div class="x-grid-cell-inner " style="text-align: left; ;"> <img class="x-tree-elbow-empty" src="data:image/gif;base64,R0lGODlhAQABAID/AMDAwAAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw=="/> <img class="x-tree-elbow-empty" src="data:image/gif;base64,R0lGODlhAQABAID/AMDAwAAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw=="/> <img class="x-tree-elbow-line" src="data:image/gif;base64,R0lGODlhAQABAID/AMDAwAAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw=="/> <img class="x-tree-elbow-end" src="data:image/gif;base64,R0lGODlhAQABAID/AMDAwAAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw=="/> <img class="x-tree-icon x-tree-icon-leaf iconOU" src="data:image/gif;base64,R0lGODlhAQABAID/AMDAwAAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw=="/> General </div> </td> </tr> <tr class="x-grid-row x-grid-tree-node-expanded"> <td class="x-grid-cell-treecolumn x-grid-cell x-grid-cell-treecolumn-1014 x-grid-cell-first"> <div class="x-grid-cell-inner " style="text-align: left; ;"> <img class="x-tree-elbow-empty" src="data:image/gif;base64,R0lGODlhAQABAID/AMDAwAAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw=="/> <img class="x-tree-elbow-empty" src="data:image/gif;base64,R0lGODlhAQABAID/AMDAwAAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw=="/> <img class="x-tree-elbow-end-plus x-tree-expander" src="data:image/gif;base64,R0lGODlhAQABAID/AMDAwAAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw=="/> <img class="x-tree-icon x-tree-icon-parent iconActions" src="data:image/gif;base64,R0lGODlhAQABAID/AMDAwAAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw=="/> Actions </div> </td> </tr> <tr class="x-grid-row x-grid-tree-node-leaf"> <td class="x-grid-cell-treecolumn x-grid-cell x-grid-cell-treecolumn-1014 x-grid-cell-first"> <div class="x-grid-cell-inner " style="text-align: left; ;"> <img class="x-tree-elbow-empty" src="data:image/gif;base64,R0lGODlhAQABAID/AMDAwAAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw=="/> <img class="x-tree-elbow-empty" src="data:image/gif;base64,R0lGODlhAQABAID/AMDAwAAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw=="/> <img class="x-tree-elbow-empty" src="data:image/gif;base64,R0lGODlhAQABAID/AMDAwAAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw=="/> <img class="x-tree-elbow-end" src="data:image/gif;base64,R0lGODlhAQABAID/AMDAwAAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw=="/> <img class="x-tree-icon x-tree-icon-leaf iconOU" src="data:image/gif;base64,R0lGODlhAQABAID/AMDAwAAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw=="/> Enable/Disable </div> </td> </tr> </tbody> </table> </div> </div> </div>

Above HTML is full page code, Here where I have to select the Discovery -> Manager Discovery, Actions->Enable/Disable

Xpath -

.//*[contains(text(), 'Manager Discovery')] //following::td[9]

Where td[9] denotes Actions->Enable/Disable and there is 1 matching node in UI.. but in code, no such element exception found. Tried with try catch block, JavaScript, Implicit and explicit wait, webdriver waits

Reset Fields on AMP Form Submission

Wed, 10/04/2017 - 09:45

I want to reset all the form fields on successful AMP form submission as I am allowing user for multiple data entry.

Manually I can do it by managing states of each field through amp-bind but I want to reset fields in one go. Is there any function like form.reset present which I can call on form submit success event?

Can I call this dialog in Xamarin.IOS?

Wed, 10/04/2017 - 09:16

Is this a built-in dialog that can be called in IOS or would you compose it manually using UIActivityViewController?

Unable to connect with socket server from internet explorer

Wed, 10/04/2017 - 07:21

Currently I have implemented one secure server using TCPListener and trying to connect to it from client which is, Javascript application through browser. I am trying to communicate using SSLStream and proper certificate is provided using following method.

private static X509Certificate2 GetServerCert() { X509Store store = new X509Store(StoreName.My, StoreLocation.LocalMachine); store.Open(OpenFlags.ReadOnly); X509Certificate2Collection cert = store.Certificates.Find(X509FindType.FindByThumbprint, "XXXXXX-THUMBPRINT_OF_CERTIFICATE_HERE-XXXXXXX", true); return cert[0]; }

Now when I connect with this server using "wss://ipaddress:port", handshake and data communication works well if client is running from Chrome browser but when I connect same from Internet explorer, client gets connected with server but no data is received using SSLStream i.e. zero bytes from SSLStream and again automatically gets disconnected from server.

Please let me know are there any browser specific settings for connecting with TCPListener for wss requests.

Internet Explorer Version : 11.0.9600.18738 (Not working)

Chrome Version : 61.0.3163.100 (Official Build) (64-bit) (Working)

Certificate being used is added to Trusted Certificate Store. Even if it works from Chrome there is one more question, it always get two requests for one click from client. In the first hit, it gets blank header and then automatically in the second hit it gets full header.

What I have tried: Non secure requests from same client application are working properly with TCPListener Server from both the browsers(Internet Explorer and Chrome). "ws://ipaddress:port

Bilingual Ubiquitious Language

Wed, 10/04/2017 - 06:56

One problem in a project with Domain Driven Design:

In discussions about the domain model, many terms of the Ubiquitous Language (UL) are used in German by the team members (all German speakers) , whereas the English version is used within the analysis model and the code model.

What is good practise to handle this issue? Should we force us to use the English term in discussions also, or is it ok to translate the term for modeling and implementation?

Pages