Change language in ui.bootstrap.datepicker - angularjs

I was trying to make the calendar info to be shown in Ukrainian language, so at first I looked through this and hoped that I would just override tha template:
angular.module("uib/template/datepicker/datepicker.html", []).run(["$templateCache", function($templateCache) {
$templateCache.put("uib/template/datepicker/datepicker.html",
"<div class=\"uib-datepicker\" ng-switch=\"datepickerMode\" role=\"application\" ng-keydown=\"keydown($event)\">\n" +
" <uib-daypicker ng-switch-when=\"day\" tabindex=\"0\"></uib-daypicker>\n" +
" <uib-monthpicker ng-switch-when=\"month\" tabindex=\"0\"></uib-monthpicker>\n" +
" <uib-yearpicker ng-switch-when=\"year\" tabindex=\"0\"></uib-yearpicker>\n" +
"</div>\n" +
"");
}]);
When I found nothing there, I searched in the datepicker.js hoping to find some arrays with the name of months and days that I could override, but I found nothing.I have no idea how to do this, and can't find appropriate solution here. I would be very grateful if you tell me (or show answered question which I couldn't find) how to do this, using minimum hacks and mocks :)

You can add the localized js file to your scripts. This should help you find the correct file.

Related

Output contents of label array in Blogger expression

I'm attempting to generate the labels of a blog post within the post container as classes, like so:
<div expr:class='"post hentry grid-item" + (data:post.labels any (l => l.name !="" : " " + l.name)' itemprop='blogPost' itemscope='itemscope' itemtype='http://schema.org/BlogPosting'>
Help would be greatly appreciated!
As Lambda expressions in Blogger generate arrays(in some cases boolean and numbers as well) as their results, we need some way to iterate over that array. We can use a b:loop tag for that. Also, as we can't include a b:loop tag in class attribute (otherwise the Blogger's XML parser will show errors) therefore escaping the HTML and including the b:loop tag is one of the way. The code will look like -
<div class='post hentry grid-item <b:loop var="labelName" values="data:post.labels" ><b:eval expr='data:labelName.name + " " ' /></b:loop>' itemprop='blogPost' itemscope='itemscope' itemtype='http://schema.org/BlogPosting'>
</div>

Write scope within dynamic string

I am working on localization within my angular project. It reads a JSON file which is having key and it's localized value in string.
Like: text1:"Localized text"
This prints "Localized text" on page correctly. But when I need to add some dynamic text in the string, like:
text1: "Showing page {{cur_page_num}} of {{total_pages}} pages"
where the cur_page_num and total_pages values will come from controller. I have tried
"Showing page {{cur_page_num}} of {{total_pages}} pages"
but it's printing {{cur_page_num}} and {{total_pages}} as it is without evaluating it.
use ng-bind-html
EX:
<p ng-bind-html="obj.text1"></p>
At this point you may get an error.
attempting to use an unsafe value in a safe context error
you need to either use ngSanitize or $sce to resolve that.
try storing the json values in an array .
iterate it on html & render it there .
if it is from template then your code should be like this,
text1: "Showing page " + {{cur_page_num}} + " of " + {{total_pages}} + " pages"
or if it is from controller then it can be like below,
text1: "Showing page " + $scope.cur_page_num + " of " + $scope.total_pages + " pages"

How to upload multiple files to the page

I am trying to upload multiple files to the page with
<input id="dropInput" type="file" multiple>
For one file it is as simple as:
driver.FindElement(By.Id("dropInput")).SendKeys(#"path-to-file");
As a user I can click Choose Files button and select number of files (with Ctrl) so in Open dialog I can see sth like: "file-1" "file-2"
From the script it does not work. I have tried different combinations of SendKeys argument:
#"file-1" + " " + #"file-2"
#"file-1" + ", " + #"file-2"
"\"path\\to\\file-1\" \"path\\to\\file-2\""
Path.GetFullPath(file-1) + " " + Path.GetFullPath(file-2)
"\"" + Path.GetFullPath(file-1) + "\" \"" + Path.GetFullPath(file-2) + "\""
The input accepts the last file only. The same with sending keys several times. For the last example I have got an exception:
unknown error: path is not absolute: "file-1" "file-2"
I am out of ideas.
I'd like to know if there is any simple solution for that before I'll start injecting jQuery scripts to the page under test.
Please advise.
Cheers,
Przemek

System.Collections.Generic.List<ActualEstimatation.frmEstimate.ItemInfo>' does not contain a definition for 'Where'

I am trying to bind treeview dynamically.
I Searched in Google and found some good links.
When I try to run in my system its showing error something like this
'System.Collections.Generic.List<ActualEstimatation.frmEstimate.ItemInfo>' does not contain a definition for 'Where' and no extension method 'Where' accepting a first argument of type 'System.Collections.Generic.List<ActualEstimatation.frmEstimate.ItemInfo>' could be found (are you missing a using directive or an assembly reference?)
Those links are
How to dynamically populate treeview (C#)
and sga101's Solutions
How to insert Datas to the Winform TreeView(C#) in effitive coding?
I searched in Google to solve the above issue but not found any solution.
Please help me to solve this issue.
Thanks in advance
i need to see more of your code but i believe what you are missing is LINQ statement.
here you can read about it and start to see how to implement in your application.
for example:
using (ServiceContext svcContext = new ServiceContext(_serviceProxy))
{
var query_where1 = from a in svcContext.AccountSet
where a.Name.Contains("Contoso")
select a;
foreach (var a in query_where1)
{
System.Console.WriteLine(a.Name + " " + a.Address1_City);
}
}

How could I save somewhere a short text with my Chrome Extension?

I am writing a Chrome extension which allows me to translate individual words on a website from one language to another. See my code below:
function getword(info,tab) {
console.log("Word " + info.selectionText + " was clicked.");
chrome.tabs.create({
//Open a dictionary website
url: "http://pl.bab.la/slownik/polski-angielski/" + info.selectionText,
})
}
chrome.contextMenus.create({
title: "Translate: %s",
contexts:["selection"],
onclick: getword,
});
I'd like to keep the list of all requested words, so later, I can return to them and find out how many of them I have already rememberd. What approaches do you suggest?
Should I just keep these words on a hard disk and if so, how to do it with JavaScript or HTML5?
Should I use a database? This solution lets me keep there also number of searches for each word and have them ordered by count of requests
(Other solution)
Please use local storage for this. https://developer.chrome.com/extensions/storage.html

Resources