windows phone voice command syntax - windows-phone-8

I wonted to know is there any way to have optional Phrase in windows phone 8 voice commands.
I mean something like this:
<Command Name="actoin">
<Example>he goes to school</Example>
<ListenFor> he goes to school [{with}] [{time}] </ListenFor>
<Feedback>ok!</Feedback>
<Navigate Target="MainPage.xaml"/>
</Command>
<PhraseList Label="with">
<Item>by bus</Item>
<Item>by tax</Item>
<Item>by his father</Item>
</PhraseList>
<PhraseList Label="time">
<Item>sometimes</Item>
<Item>always<Item>
</PhraseList>
actually i want to make with and time optional and avoid writing a separate command for each combination of them!
thanks

You can have multiple <ListenFor> elements (up to 10) per command; you could build the options that way.
For example:
<Command Name="action">
<Example>he goes to school</Example>
<ListenFor> he goes to school {with} {time} </ListenFor>
<ListenFor> he goes to school {time} </ListenFor>
<ListenFor> he goes to school {with} </ListenFor>
<ListenFor> he goes to school </ListenFor>
<Feedback>ok!</Feedback>
<Navigate Target="MainPage.xaml"/>
</Command>
<PhraseList Label="with">
<Item>by bus</Item>
<Item>by tax</Item>
<Item>by his father</Item>
</PhraseList>
<PhraseList Label="time">
<Item>sometimes</Item>
<Item>always<Item>
</PhraseList>

Related

Issues with text rendering in react component

So I am working with an API, and found this in the documentation:
let message = {
"text" : "<i>or</i> HN: the Next Iteration<p>I get the impression that with Arc being released a lot of people who never had time for HN before are suddenly dropping in more often. (PG: what are the numbers on this? I'm envisioning a spike.)<p>Not to say that isn't great, but I'm wary of Diggification. Between links comparing programming to sex and a flurry of gratuitous, ostentatious adjectives in the headlines it's a bit concerning.<p>80% of the stuff that makes the front page is still pretty awesome, but what's in place to keep the signal/noise ratio high? Does the HN model still work as the community scales? What's in store for (++ HN)?",
"time" : 1203647620
}
So in react (using function component), what is the proper way of rendering message.text? I am asking because my rendering output still has the tag <i></i> and <p></p> in the text when I return {message.text}. So I guess there is something wrong.
If you want to render a string containing html you can use dangerouslySetInnerHTML
In your case will be:
<div dangerouslySetInnerHTML={{ __html: message.text }} />
Watch out using this attribute because it could expose your app to XSS attacks. (check https://reactjs.org/docs/dom-elements.html#dangerouslysetinnerhtml)

Change layout just for one cms page - for instance "customer-service"

I'm using the pages that comes with the default instalation of magento on my web store. The customer want's to have diferent contents on right column of that pages.
For instance, on "customer-service" page wants to have the top FAQ's but on "contacts" want to have the telephone and mail information.
How can I achive that? I been trying to change the 2columns-right layout, on the right column, to each page but I was unable to find a way to do that.
Thanks in advanced.
In 'CMS > Pages' from the Magento back office, go into the 'Design' tab in each page you want to change and set the 'Layout' to '2 columns with rightbar'.
Then, you can use the right.permanent.callout block to call in what content you wish on various pages/page types as wanted.
For example, displaying an image in the right sidebar on contact page only:-
<contacts_index_index>
<reference name="right">
<block type="catalog/product_compare_sidebar" before="cart_sidebar" name="catalog.compare.sidebar" template="catalog/product/compare/sidebar.phtml"/>
<block type="core/template" name="right.permanent.callout" template="callouts/right_col.phtml">
<action method="setImgSrc"><src>images/media/col_right_callout.jpg</src></action>
<action method="setImgAlt" translate="alt" module="catalog"><alt>Keep your eyes open for our special Back to School items and save A LOT!</alt></action>
</block>
</reference>
</contacts_index_index>
You can modify to change the page, page type, or template/block as you wish.

app bar in windows phone 8

Greetings.
I was trying to add an app bar to the windows phone 8(VS 2013 & framework 4.5) application.
<phone:PhoneApplicationPage.ApplicationBar>
<shell:ApplicationBar IsVisible="True" IsMenuEnabled="True" Mode="Default" Opacity="1.0" >
<shell:ApplicationBarIconButton IconUri="/Images/save.png" Text="save" Click="Button1_Click" />
<shell:ApplicationBarIconButton IconUri="/Images/delete.png" Text="delete" Click="Button2_Click" />
<shell:ApplicationBarIconButton IconUri="/Images/help.png" Text="help" Click="Button3_Click" />
<shell:ApplicationBarIconButton IconUri="/Images/settings.png" Text="settings" Click="Button4_Click" />
<shell:ApplicationBar.MenuItems>
<shell:ApplicationBarMenuItem Text="get default size value" Click="MenuItem1_Click" />
<shell:ApplicationBarMenuItem Text="get mini size value" Click="MenuItem2_Click" />
</shell:ApplicationBar.MenuItems>
</shell:ApplicationBar>
</phone:PhoneApplicationPage.ApplicationBar>
The app bar buttons are getting displayed in this specific page, but in other pages it is not visible. How we can make the app bar and its button visible global?
Thanking you in advance
Sebastian
you needed To create a global Application Bar that can be reused on multiple pages. Usually we create an Application Bar on the page we want to use it on, and it applies only to that page. For this purposes here is a good example create a global Application Bar , you needed to create a global Application Bar by using XAML in App.xaml as shown in example.
or
You need to write same AppBar code in all individual pages for displaying it to all pages as you Described in Question
You can also create it programmatically and store a reference to it in your App.xaml.cs, and insert it in every page, in constructor, like this:
this.ApplicationBar = App.GlobalAppBar;
Creation is simple as:
ApplicationBarIconButton firstButton = new ApplicationBarIconButton();
firstButton.IconUri = new Uri("/Images/save.png", UriKind.Relative);
firstButton.Click += Button1_Click;
firstButton.Text = "save";
GlobalAppBar = new ApplicationBar();
GlobalAppBar.Buttons.Add(firstButton);

Localization doesn't work for german?

I googled a lot and did these changes to my project:
.csproj:
<SupportedCultures>
en-US;de-DE;ru-RU;
</SupportedCultures>
WPAppManifest.xaml:
<DefaultLanguage xmlns="" code="en-US" />
<Languages xmlns="">
<Language code="en-US" />
<Language code="de-DE" />
<Language code="ru-RU" />
</Languages>
And of course I have AppResources.de-DE.resx, AppResources.en-US.resx, AppResources.resx and AppResources.ru-RU.resx.
When I set the phone to russian, the app starts in russian as expected. But that doesn't work with german. I checked the AppResources-files many times. It's all in there, they should work. but somehow de-DE doesn't get recognized.
Tried the same with simple "en;de;ru;" with the same result.
Any ideas?
Edit:
I found this tutorial: http://www.silverlightshow.net/items/Windows-Phone-8-Localization.aspx and they also use "de". So I changed all appearances of those strings to "de", "en" and "ru". Still russian works, german appears as english - the default language =/
Okay, stupid, but it was in the project's properties. For some reason the defaultlanguage was set to german.
Still think that it's in confusingly many places. I'll summarize them for everybody who might need it in the future:
project's properties, 1st tab "supported cultures" and "asseblmy information" button!
WPAppManifest.xaml view Code
AppResources.xx.resx
inside AppResources files the "ResourceLanguage"-tag should be set to "de", "en", "fr" or whatever.
That's many places and I hope I didn't forget one O-o

Spring Security multiple filterChainProxy mapping/filters, custom filters Json Output

I have a part of my web application that is an RESTfull api and part a more standard web-pages.
I wish to have the REST part with some custom filters such as the EntryPoint, SuccessHandler and FailureHandler. This part is within the /rest/** mapping.
In the other hand, everything else needs to have more common filters and is mapped with /**.
The problem is to find an easy way to define the filterChainProxy with different mapping-filters.
Right now this solution doesn't work:
<!-- Normal web app -->
<http auto-config="true" use-expressions="true" authentication-manager-ref="authenticationManager">
<form-login/>
<logout/>
<intercept-url pattern="/**" access="hasRole('ROLE_USER')" />
</http>
<!-- Configure RESTfull services -->
<http use-expressions="true" authentication-manager-ref="authenticationManager" entry-point-ref="restAuthenticationEntryPoint" >
<form-login authentication-success-handler-ref="restAuthenticationSuccessHandler" login-page="/rest/login" username-parameter="username" password-parameter="password" />
<logout logout-url="/rest/logout" />
<intercept-url pattern="/rest/**" method="GET" access="hasRole('ROLE_USER')" />
<intercept-url pattern="/rest/**" method="POST" access="hasRole('ROLE_ADMIN')" />
<intercept-url pattern="/rest/**" method="PUT" access="hasRole('ROLE_ADMIN')" />
<intercept-url pattern="/rest/**" method="DELETE" access="hasRole('ROLE_ADMIN')" />
</http>
It complains with: the univseral match being before other patterns.
Is there a way to define such a thing without resorting to define the filterChainProxy with the definition? The http version does help quite a lot to reduce the amount of configuration as I will have to manually set a UsernamePasswordAuthenticationFilter etc.
The next problem is more simple: I have to respond, after the form-login authentication with a JSON object.
So far, I have implemented a SuccessHandler (actually a version of the SimpleUrlAuthenticationSuccessHandler without the redirect part).
How do I write my JSON output?
I must have something like this:
HTTP 200 OK
with:
{"success":true,"customer {"email":"customer#email.com","session_id":"b83a41dfaca6785399f00837888886e646ff9088"}}
and a similar thing with the FailureHandler. It must be quite simple and it's surely is some very basic thing, but how do you do that? Redirecting to a custom controller is not a solution since I will have the 301 redirect status that a very simple REST client might not be able to understand.
At the very least, I wish to have only the http header and no body at all.
thanks!
If you can upgrade to Spring Security 3.1 it supports multiple chains using namespace configuration.