How to concat string in Ionic 4 with the template? - ionic-framework

I need to contact the name and surname in my Ionic 4 Full Starter kit template:
<app-text-shell [data]="customer?.surname + customer?.name"></app-text-shell>
Unfortunately there is not the space between them; how Can I do? If I create a function in customer link getNameAndSurname() there is a message error.

Simply Pass this way
<app-text-shell [data]="customer?.surname +" "+ customer?.name"></app-text-shell>
add space
+" "+
or
customer = { surname: "weerasinghe", name: "chanaka" };
.html
<app-text-shell [data]="customer"></app-text-shell>
Access data
this.data.surname

The above answer did work for me in Ionic 4 with little enhancement. Replacing "" with '' inside the data property.
<app-text-shell [data]="details?.min_salary+' '+details?.min_salary"></app-text-shell>

When 'customer' is defined but contains only empty properties, then this will end up showing 'undefined undefined', instead of the app shell (at least for me), because that added space does make it non-empty.
So my solution is instead of this:
<app-text-shell [data]="details?.min_salary+' '+details?.min_salary"></app-text-shell>
Use this:
<app-text-shell [data]="details.min_salary? details.min_salary+' '+details.min_salary : ''"></app-text-shell>

Related

Magento MAGMI - Custom Options not working correctly

I'm trying to create custom options through magmi.
This is what I'm using
Choose your Size:field:1:0
0.00:fixed:size:0`
When I use this it creates a custom option but without a Title name and no SKU image below.
When I try this
Choose your Size:field:1:0
:0.00:fixed:size:0
the use of " : "before the 0.00 then it creates the following
In this case everything is correct except that its missing the price of "0.00"
This is how it should be created as below.
I found the solution.
use a double " :: " before 0.00 as follows.
Choose your Size:field:1:0
::0.00:size:size:0

Split location.href for multiple values?

I have a varient that finds the current url and splits it as follows:
var ehref = window.location.href.split('?',1);
This is then used to match the url with a navigation link href and give an ID to the page. My issue is that when our cookie pop up is closed, # is added to the url. Subsequently the page links are passed around between users with the # and the page ids do not work.
What is a simple way of splitting the url at a # as well? I am new to jquery, thus I understand the gist of what I'm 'reading,' but anything I've tried from researching the net has broken the page. I can replace the '?' With '#' but that doesn't really solve the issue.
Thanks!
If you want to get string after '#' you can write like this:
window.location.hash
in javascript ,see here
I have been searching for a way to split up a URL and replace with a new URL. as example, YouTube.com/ "user/video" and change it to YouTube.com/v/"video" so I would not have to sign in to watch a video that got restricted. But then needed to use the same code that would grab whatever string I want between two marks. So here we go!
Our goal: To isolate a part of a URL and use it within another URL!
The line of code will be broken up in sections for easy reading
The line of code will be for a web-link, clicked from the browser’s bookmark
Example URL
https: //duckduckgo.com/?q=School&t=h_&atb=v102-5_f&ia=web
The code:
javascript:var DDG=(window.location.href.split('?q=')[1]);DDG2=DDG.split('&t')[0];DD2G="https://www.google.com/search?q="+DDG2;window.location.assign(DD2G);
Variable name;
DDG = duckduckgo
DDG2 = duckduckgo2
DD2G = duckduckgo 2 google
The code break down:
javascript:var DDG=(window.location.href.split('?q=')[1]);
DDG2 = DDG.split('&t')[0];
DD2G="https://www.google.com/search?q="+DDG2;
window.location.assign(DD2G);
The first part of the code defines it as a JavaScript, we create a variable (var) with the name DDG
Var DDG
The next part we want the value to be what the current URL of the users browser and split that into sections
window.location.href.split
We want to find within the URL this string ‘?p=’ which indicates the search inquiry/s in duckduckgo
But I only want what comes after ‘?p=’ represented by [1], which will give our variable name DDG the value of this: School&t=h_&atb=v102-5_f&ia=web
We now want to split the new value we just gave to our DDG variable, so we do a split on that
DDG.split, and this time we only want everything before the ‘&=’ so we put [0] and assigned that result to a new variable we called DDG2
DDG2 = DDG.split(‘&t’)[0]
We now have a new variable with the value we wanted and we will use DDG2 to replace whatever we want in another URL!
DDG2 = School (this updates every time there is a new search.)
Now we want to replace the URL with our new URL + our variable name.
We make our final variable name DD2G with the value of: https:// www.google .com/search?q= but we want to add our value from DDG2
DD2G="https: //www.google.com/search?q="+DDG2;
Which would look like this (https: //www.google.com/search?q=School).
We now want to assign that to the browser and it will redirect to the new URL with the search term.
window.location.assign(DD2G);
= window.location.assign(“https: //www.google.com/search?q=” + (DDG2))
= window.location.assign(“https: //www.google.com/search?q=School”)
= https: //www.google.com/search?q=School //our new URL with our search term we started with from duckduckgo, without having to retype the inquiry.
So for your question, just replace the string between '' '?q=' with the first string you want the script to look for, then from that result, change the second string between'' '&t' with the second string you want it to look for.
I hope this helps!
if you want to test it out select all of this:
javascript:var DDG=(window.location.href.split('?q=')[1]);DDG2=DDG.split('&t')[0];DD2G="https://www.google.com/search?q="+DDG2;window.location.assign(DD2G);
and drag it to an empty space in your toolbar/bookmarks, in Firefox, I do not know if this works with other browsers, but if they support JavaScripts, it should work. Now navigate to DuckDuckgo.com and search for something, then click on that bookmarked with that code.

SSIS Formatting input from flat file

I'm a SSIS newbie. I wanna format the inputs of my flat file before saving the entries in a database table. Initially I created a flat file as follows:-
"1","Superman","Metropolis"
"2","Batman","Gotham"
"3","Spiderman","New York"
"4","James Bond","London"
"5","Green Lantern","Oa"
The solution for stripping this was simple as shown here http://www.mssqltips.com/sqlservertip/1316/strip-double-quotes-from-an-import-file-in-integration-services-ssis/
But now i have created a new similar package and given my input file like this:-
"6", "TMNT", "Sewers NY"
"7", "Iron Man", "New York"
Note here I've put a space after the delimiting comma. Now when I follow the above method the first number field stripped of the double quotes, but rest of the entries retain their quotes. Any idea how to work around this? One suggestion on a similar question on stackoverflow mentioned use of a "Transformation script". Since I'm a newbie can anyone please throw light on this method?
Yes, you can use Script component transformation. Select all columns, and change them to ReadWrite. The code:
public override void Input0_ProcessInputRow(Input0Buffer Row)
{
Row.ID = Row.ID.Replace("\"", string.Empty);
Row.Movie = Row.Movie.Replace("\"", string.Empty);
Row.City = Row.City.Replace("\"", string.Empty);
}
If you want to trim the spaces you can use
Row.ID.Replace("\"", string.Empty).Trim();
You would also need to take care if you want to preserve the values that are " ". Please post if the suggestion was helpful or if you have any questions.
In the 'General' tab you can set a text qualifier of ". Then those quotes will be ignored.
Then you don't need to write error prone script when there is a simple solution.

Unable to use Variable in XPath in Eclipse - Selenium

I need to pass values from excel sheet ( stored in variable api ) to XPATH in eclipse (java - Selenium).
I tried several options but none works. Please guide.
Here is my line of code.
String appcode = //input[contains(#id,'app') and contains(#type,'text') and ancestor::div[contains(#id, '+api+')]]
When i hardcode the value of api as below it works.
String appcode="//input[contains(#id,'app') and contains(#type,'text') and ancestor::div[contains(#id, 'setmember')]]";
Isnt it this easy?
Appreciate your help
pk
you probably did not end the String constructor properly. Try this:
String appcode = "//input[contains(#id,'app') and contains(#type,'text') and ancestor::div[contains(#id, '" +api+" ')]]";
My assumption is, that api variable is type String
you can use \" so you would have something like
String appcode ="//input[contains(#id,\" "+[VARIABLE]+ " \")[..] ";

ZEND currency symbol is displaying 1

I'm using zend currency to display the currency based on locale. When I use the following code the symbol gets replaced by 1 instead of simply being removed:
$currency = new Zend_Currency($locale);
$currency->setFormat(array('symbol' => Zend_Currency::NO_SYMBOL));
What normally gets returned is this: € 2.500,01
but after the "setFormat" call I'm getting this: 1 2.500,01
I don't want the "1 " in there.
Any ideas on how to fix this?
Thanks.
Here's the ZF tutorial page for this. It looks like it will set a person in the right direction: zend currency tutorial page
You're setting the wrong option in setFormat. You need to set display to Zend_Currency::NO_SYMBOL. Like this:
$c = new Zend_Currency();
$c->setFormat(array('display' => Zend_Currency::NO_SYMBOL));
echo $c->toCurrency(2500.01);
Which outputs
2,500.01
The way you are currently doing it is literally setting the symbol to 1 because that's what the constant NO_SYMBOL evaluates to.