Bind html to webbrower control? - windows

i used this method link:http://compiledexperience.com/blog/posts/binding-html-to-the-web-browser-control
but had error message like "HTML not found in the type of webbrowercontrol property". i think it's a simple mistake but I'm new to windows phone.so please help me.

You haven't given much information, but my guess is that you are trying to set a HTML property on the WebBrowser control. The blog post you linked to describes the creation of an attached property, so you need to supply a prefix:
<Page xmlns:cxi="clr-namespace: ...">
<phone:WebBrowser cxi:WebBrowserHelper.Html="{Binding Question.Body}" />
</Page>
I would suggest reading about XAML namspaces and attached properties on MSDN.

Related

Extending Visual Studio 2017 XML editor

I'm trying to improve our workflow with some XML-configuration files we use in a Visual Studio Solution. I figured I'll start with explaining what I'm trying to accomplish and then explain some of my ideas that I've tried for several hours without success.
The Problem
I'm working with a system where the data model is configured in a database, the models are also stored on disk using xml-files, these are then synced during startup of the app. Here's part of the stuff that are synced:
Data Types
All data types lives in one XML configuration file per data type and each has some properties like Name and Key. All data types are configured in the same folder, example: /config/dataTypes
Example
textString.config
<?xml version="1.0" encoding="UTF-8" ?>
<DataType Key="a45c9a94-09d7-4df9-85e6-d6930abc6c12" Name="Textstring">
textArea.config
<?xml version="1.0" encoding="UTF-8" ?>
<DataType Key="b104788f-4e2f-4592-9387-8b3861bd8046" Name="Textarea">
Entity Types
Think of these as models with X number of properties, each property is configured and connected to a Data Type.
Example
customer.config
<?xml version="1.0" encoding="UTF-8" ?>
<Entity>
<Properties>
<Property Name="Firstname" TypeKey="a45c9a94-09d7-4df9-85e6-d6930abc6c12" />
<Property Name="Lastname" TypeKey="a45c9a94-09d7-4df9-85e6-d6930abc6c12" />
<Property Name="Description" TypeKey="b104788f-4e2f-4592-9387-8b3861bd8046" />
</Properties>
</Entity>
My end goal is to provide intellisense when editing a Entity Type so that I'll get all the Data Types as suggestions when entering the "TypeKey" property of the Property element. Preferably showing the Name of the data type in the dropdown list and when choosing it adding the guid as value for the TypeKey-property. I would also like to show the Data Types name when hovering the GUID with the mouse (or in some other way).
As you can imagen during the process with a project new data types can be added so the intellisense needs to be dynamic based on the files in the data types-folder.
I should also mention that these configuration files also can be edited from a UI in the application and I don't have control over how they are serialized, hence - there is no XML namespace in the files, they look like in the examples above.
We also have multiple different VS-solutions with different setups of Data Types and Entity Types. So we need individual intellisense in each project.
What I've tried
My first idea was to create a VS-extension that creates a dynamic XML Schema XSD-file based on the files in the data types folder. The VS would then pick up and use the XSD for XML-files in the Project, turns out that this only works with a namespace configured (remember, I can't add namespaces since I don't control the external app).
To get around this it worked to manually add the schema-file to the XML file while editing the file. (Like this: https://learn.microsoft.com/en-us/visualstudio/xml-tools/how-to-select-the-xml-schemas-to-use?view=vs-2019). The problem with this is that it needs to be done for each xml-file and the setting is not stored.
I then started to play with the VS extension possibilities to try to automatically configure this Schema to a XML-file that is opened. Turns out I had a really hard time to get the "configuration object" that is pushed to the Properties Browser when the XML file is opened. I managed to get a event-handler setup that was triggered when the XML files as getting "focus" but I was stucked trying getting the properties from the Properties Browser.
I also tried another approach with a custom "code completion"-extension but it made the UI feel very "cluttered" while editing.
After spending about 10 hours playing around with this I feel I don't really have a good path to a solution as my experience with VS-extensions is not that extensive.
I would love to get some feedback and ideas on how to approach this problem, since the XSD is different from each project if I go down the "dynamic" path we can't use the global VS settings since each project has different data types hence needs different allowed values for the TypeKey property.
One approach that I'm thinking about is to use a generic XSD (allowing all values for the TypeKey) in the Global Schema Cache for Visual Studio and create a "code completion"-feature for just the TypeKeys.
Any thoughts and pointers in the right direction would be very much appreciated.

Telerik RadEditor spellchecker is not working

Trying to implement spellcheck and I got a message:
Web.config registration missing. The Telerik dialogs require a
HTTPHandler registration in the web.config file. Please use the
control's smart tag to add the handler automatically.
I did it by adding but still have the same message is coming up... I need some help please!
Regarding the Spell Check Handler Server Error, AjaxUrl property is used to set the path to the handler and is used in scenarios where you may have a UrlRewriter module which overwrites the handlers url even if they are set in the web.config. A correct value of this property is like follows:
RadEditor1.SpellCheckSettings.AjaxUrl = "Telerik.Web.UI.SpellCheckHandler.aspx";
Once you set the new AjaxUrl value, go to the web.config file and update the Telerik.Web.UI.SpellCheckHandler.axd instances to Telerik.Web.UI.SpellCheckHandler.aspx
Check these articles for more information about problems with handlers: https://www.telerik.com/support/kb/aspnet-ajax/editor/details/error-web-config-registration-missing!-the-telerik-dialogs-require-a-httphandler-registration-in-the-web-config-file-
and
https://www.telerik.com/forums/radspell-javascript-error

Selenium Webdriver/TestNG/Maven/Xvfb - take screenshot on fail?

wanted to ask you about the best way to take screenshot on fail in such project?
Should I do it in the Selenium code, or in the Maven project via some command or with Xvfb?
Im using Firefox headless via Xvfb.
I have seen a few classes on the internet that take screenshots, but Im missing the big picture here.
How does this class know when to take the screenshot?
How does Jenkins tell the java test code that it has failed, so it will take a picture?
Where in the test code should I reference the take screenshot class?
Should I use a try catch on the whole test?
Isnt there a Jenkins plugin that will automatically save screenshot on fail?
I just found an article that explains a much better way to do it: http://darrellgrainger.blogspot.com/2011/02/generating-screen-capture-on-exception.html
How does it work?
Effectively, you pass in a custom WebDriverEventListener, which has functions that will be called on certain events. One of those events is onException(). So every time an exception is thrown by WebDriver, you can write the code to take a screenshot.
I have seen three different ways to do this:
If you have a static driver, the easiest way is to set up a listener in TestNG (Overridding TestListenerAdapter), and then to take a screenshot in the onTestFailure() method.
My personal method is to use the Selenium Page Object pattern, but modified a bit. I have created an EnhancedWebElement object that wraps and extends a normal WebElement, and has a reference to the driver. Then in each of the methods that WebElement has, I perform the call in a try/catch and in the catch, I then take a screenshot. I'm open to sharing the code, but I'd have to trim away quite a bit to post here, so please tell me if you want to see it.
Alternatively, you can set up a proxy around the WebElement or the Driver itself and have it catch everything. I haven't done this, but I've seen it work on other projects.
just found an article that explains a much better way to do it: http://darrellgrainger.blogspot.com/2011/02/generating-screen-capture-on-exception.html
Blockquote
But this dicision have some problem. it will save screenshoot on any exception even when you try/catch some in your code.
I use methods from that article. But in my testng.xml files i add
`
<listeners>
<listener class-name="MyListener" />
</listeners>
`
And than i create
`
public class MyListener implements ITestListener{
//almost all methods i create blank
//but implement only onTestFailure
//
onTestFailure(){
//here i used methods from article ubove
//
}
}
`
And screenshots done only in case when my #Test fail.

Check Using JSTL/Spring-MVC tag regarding Spring Binding Error

I am trying to find a way by which i can check if there is any binding error and based on them i want to show some messages to the user in Spring-MVC. i know one way of this like
<spring:hasBindErrors name="userName">
</spring:hasBindErrors>
but this seems to be with respect to a specific filed of my form, what i want is to check if there is any binding error at all for the current input form or not?
i have also experience of Struts2 and they have a very convient method hasError() which allow a developer to see if there is any error at all for the input fields.
Is there such method defined for Spring-MVC validation or not?
Not an expert of Spring-MVC as i have used it very rarely but if i am correct all you want an equivalent of bindingResult.hasErrors() and if i am correct all you need to use
hasBindErrors tag. For more details refer to the doc
hasBindErrors
Hope this might help you

Quick MSDN Search in Firefox

Is there a way to get an MSDN search bar in Firefox which will autocomplete .Net class and member names (and preferably also Win32 API methods) and take me directly to the MSDN page?
Google toolbar with Shift+Enter (I'm feeling lucky) will usually go directly to the msdn page for a .Net class, but it doesn't have targeted autocomplete. Also, since I'm too lazy to type site:msdn.microsoft.com, it doesn't always take me to MSDN. (eg, Graphics)
There are several msdn search providers available.
This search plugin (from the list flyfishr64 linked to) works quite well (suggestions and everything).
You could create a bookmark with a wildcard %s and the msdn keyword by using the following url for the bookmarked page:
http://social.msdn.microsoft.com/search/en-us/?query=%s
Now in the address bar, when I type "msdn StringBuilder" it brings me to this result page: http://social.msdn.microsoft.com/search/en-us/?query=StringBuilder
I did the same with the stackoverflow keyword and the http://stackoverflow.com/questions/tagged/%s url.
EDIT: as #AgentConundrum pointed out, using the http://www.google.com/search?hl=en&safe=off&q=%s%20site:msdn.microsoft.com url will restrict Google search to the msdn.microsoft.com site.
I ended up editing this search plugin from Shog9's answer and changing the search URL to Google's I'm Feeling Lucky.
Here's the XML:
<?xml version="1.0" encoding="UTF-8"?>
<OpenSearchDescription xmlns="http://a9.com/-/spec/opensearch/1.1/" xmlns:moz="http://www.mozilla.org/2006/browser/search/">
<!-- Created on Thu, 07 Jan 2010 15:11:13 GMT -->
<ShortName>MSDN</ShortName>
<Description>Search MSDN documentation</Description>
<Url type="text/html" method="get" template="http://www.google.com/search?hl=en&q={searchTerms}+site%3Amsdn.microsoft.com&btnI=I"/>
<Url type="application/x-suggestions+json" template="http://services.social.microsoft.com/search//Data/AutoCompleteTerms?t={searchTerms}&b=Msdn&l=en-US&m=10&rf=oss10"/>
<Image width="16" height="16">http://mycroft.mozdev.org/updateos.php/id0/msdn_schnore.ico</Image>
<Developer>Schabse Laks</Developer>
<InputEncoding>UTF-8</InputEncoding>
<moz:SearchForm>http://social.msdn.microsoft.com/Search/en-US/</moz:SearchForm>
<Url type="application/opensearchdescription+xml" rel="self" template="http://mycroft.mozdev.org/updateos.php/id0/msdn_schnore.xml"/>
</OpenSearchDescription>

Resources