Google places autocomplete suggestion without country name - api

I am looking for a possibility to get suggestions without country name.
I have the following js code:
... var autocomplete_pickup = new google.maps.places.Autocomplete(pickup_field, {
types: ["address"], componentRestrictions: {country: "de"}
}); ...
The result is e.g.
Bahnhofstrasse 4, Hamburg, Deutschland
Now I want to have for that example only
Bahnhofstrasse 4, Hamburg
I have limited the countries only to Germany and therefore is not necessary to show the country name.
Do you have an idea?
Thanks.
Heinz-Peter

For resolve it, just add this query param &region=de into your script path
It seems like this:
<script type="text/javascript" src="https://maps.googleapis.com/maps/api/js?key=[API-KEY]&libraries=places&region=de"></script>
It helped me.

Related

Expo Calendar - Using the recurrenceRule for createEventAsync()

I'm struggling with some of the formatting for parameters inside the recurrenceRule when trying to create a new event with Expo Calendar. I can't seem to find any robust recurrence examples in the docs or anywhere else for that matter. One specific thing I'm struggling is daysOfTheWeek, where I'm trying to pass multiple days but I'm not even sure if you can.
Does anyone have a good working example of the recurrenceRule in action?
After struggling with this myself I found that if you look up types in your Calendar.d.ts file it should give you the required structure of the recurrenceRule.
export declare type RecurrenceRule = {
frequency: string
interval?: number // #default 1
endDate?: string | Date
occurrence?: number
daysOfTheWeek?: DaysOfTheWeek[]
daysOfTheMonth?: number[]
monthsOfTheYear?: MonthOfTheYear[]
weeksOfTheYear?: number[]
daysOfTheYear?: number[]
setPositions?: number[]
};
So if your use case is like mine and you just want the event to occur only once something like this will work: recurrenceRule: {frequency: 'DAILY', occurrence: 1} I think. Expo-documentation says recurrence rule can be set to null, but this throws an error. Hope this helps!

ITunes lookup api doesn't work with language or country code?

url = "https://itunes.apple.com/lookup?id=1510853708
This only returns English results. I want to add a language or country code for China, but none of these worked:
url = "https://itunes.apple.com/lookup?id=1510853708&country=cn
url = "https://itunes.apple.com/lookup?id=1510853708&l=zh
It returned 0 results. I changed id to bundleId, but is the same.
However, search api worked with country=cn. So why doesn't lookup api doesn't work?
try this "https://itunes.apple.com/cn/lookup?id=",
and confirmed that your app sales areas contains China mainland.

Vue.js root variable

I am working on my own directory for my purchases of cryptocurrencies.
I am getting prices of BTC, ETH, and LTC via API, then I created a component for each of my punched coin, so then I want to calculate current price (ownedCoins * currentPrice).
So in my $root I have { eth: 324.233, btc: 2211.43, ltc: 41.341 }
Here is where I want to calculate it:
self.eur = response.data.sum[0].quantity * this.$root.ltc;
But I want to make this dynamic, so what I want to do is to create a dynamic variable. Something like that: self.eur = response.data.sum[0].quantity * this.$root.{this.coinName};
How would I do that?
I would read the State Management part of the VueJS docs then checkout the Vuex docs. Once your data store get even mildly more complex your method of managing it with your sample code will become overwhelming.
Your question doesn't have anything to do with vue, but just plain javascript. To access object variables in javascript you have 2 ways, using the dot notation or bracket notation (I call it array notation):
const car = { wheels: 4, seats: 5, horsepower: 145 };
console.log(car.wheels);
console.log(car['wheels']); //same result
So
this.$root[this.coinName];
will give you the result you are looking for.

can there be a tooltip with data from the database

I need to know can there be a tooltip populated with data from database to be displayed in the tooltip.
something like the tooltip should contain
name stauts
abc active
xyz active
pqr active
name and status are retrived from db
I need this tooltip onmouseover, am using CJSON decoded to render the content
i did go google but hardly did find that i would throughly understand and implement.
can anyone out there has any ideas for what am looking.
There is a extension named yii-bootstrap, which described clearly here.
For using tooltip easily in this extension, just look here.
I use cluetip for this. Its not related to Yii but will give you some idea :
JS
function renderInfoTips(opts){
var elements=$('#'+opts.form).get(0).elements;
for(i=0; i<opts.tips.length;i++){
$(elements[opts.tips[i].field]).parent().prepend(opts.tips[i].tip);
}
var clue_opts={arrows:true,splitTitle: '|',closePosition: 'title',sticky:true,dropShadow:false,mouseOutClose:true,
onShow:function(ct, ci){
if(!$.browser.webkit) $(ct).css('top',$(ct).position().top- 30+'px');
}
}
$('#'+opts.form).find(".infotip").cluetip(clue_opts);
}
PHP
function setInfoTipsJavascript($form_id,infotips){
if (count($this->infotips) <1 ) return '';
//get all tip names
$names_csv=join(',',array_keys(infotips));
//get tips details from db
$query="select name, description from infotips where FIND_IN_SET(name ,'$names_csv')";
//run the query, in Yii you have to use InfoTipsModel , I have skipped that portion
//$infotipS , lets say this is query object
$tips=array();
while($tip=$infotipS->Assoc()){
$this->infotips[$tip['name']]['tip']="<a href='javascript:void(0)' class='infotip' title='|{$tip['description']}'> </a>";
$tips[]=$this->infotips[$tip['name']];
}
$tips=json_encode($tips);
$script="\nrenderInfoTips({\"form\":'{$form_id}', \"tips\":{$tips}});\n\n";
echo $script;
}
I am sharing this hoping this will give u some idea. Its obvious you have to : create infotips table, a model for that, and create a widget etc to fetch infotips related to your form fields . As someone suggested, if you are using Bootstrap, you have better way to do that.

eBay API categoryId in findItemsAdvanced call returns wrong categories

I'm trying to use the categoryId in my findItemsAdvanced query:
api.execute('findItemsAdvanced', {
'keywords': 'laptop',
'categoryId': '51148'}
The results I get are, for example (printing the searchResult dictionary):
'itemId': {'value': '200971548007'}, 'isMultiVariationListing': .............
'primaryCategory': {'categoryId': {'value': '69202'}, 'categoryName': {'value': 'Air Conditioning'}}
....."
You can see that the result has a categoryId of 69202, and not 51148.
What am I doing wrong here? I'm just using the finding.py code at:
https://github.com/timotheus/ebaysdk-python
Thanks
Edit
I've done some tests. I extracted the XML that the SDK builds. If I call with:
'categoryId': '177'
The response is:
the request_xml is <?xml version='1.0' encoding='utf-8'?><findItemsAdvancedRequest
xmlns="http://www.ebay.com/marketplace/search/v1/services"><categoryId>177</categoryId>
<itemFilter><name>Condition</name><value>Used</value></itemFilter><itemFilter>
<name>LocatedIn</name><value>GB</value></itemFilter><keywords>laptop</keywords>
<paginationInput><entriesPerPage>100</entriesPerPage><pageNumber>1</pageNumber>
</paginationInput></findItemsAdvancedRequest>
and I get the same with
'categoryId': ['177']
I find this a bit odd, I thought the appropriate name for the XML categoryId was 'CategoryId' with a capital C. If I do that I don't get an error, but the result is not restricted to the categoryId requested.
Doing it like above, I still get the error:
Exception: findItemsAdvanced: Domain: Marketplace, Severity: Error,
errorId: 3, Invalid category ID.
The code below will do a keyword search for 'laptops' across the UK eBay site and restrict the search to the two categories Apple Laptops(111422) and PC Laptops & Netbooks(177). In addition the results are filtered to only show the first 25 used items that are priced between £200 and £400. The results are also sorted by price from high to low.
There are a few things to keep in mind about this example.
It assumes that you have already installed ebaysdk-python.
According to the eBay docs the categoryId field is a string and more than one category can be specified. An array is therefore used to hold the category ids that we are interested in.
Our request needs to search for items in the UK eBay site. We therefore pass EBAY-GB as the siteid parameter.
Category ids are different across each eBay site. For example the category PC Laptops & Netbooks(177) does not exist in Belgium. (Which incidently is the site that is used in the ebaysdk-python finding.py example.)
This example is also available as a Gist
import ebaysdk
from ebaysdk import finding
api = finding(siteid='EBAY-GB', appid='<REPLACE WITH YOUR OWN APPID>')
api.execute('findItemsAdvanced', {
'keywords': 'laptop',
'categoryId' : ['177', '111422'],
'itemFilter': [
{'name': 'Condition', 'value': 'Used'},
{'name': 'MinPrice', 'value': '200', 'paramName': 'Currency', 'paramValue': 'GBP'},
{'name': 'MaxPrice', 'value': '400', 'paramName': 'Currency', 'paramValue': 'GBP'}
],
'paginationInput': {
'entriesPerPage': '25',
'pageNumber': '1'
},
'sortOrder': 'CurrentPriceHighest'
})
dictstr = api.response_dict()
for item in dictstr['searchResult']['item']:
print "ItemID: %s" % item['itemId'].value
print "Title: %s" % item['title'].value
print "CategoryID: %s" % item['primaryCategory']['categoryId'].value
I hope the following will explain why performing a search on the Belgium site results in items that contain the category 177 even though this is not valid for Belgium but is valid for the UK.
Basically eBay allow sellers from one site to appear in the search results of another site as long as they meet the required criteria, such as offering international shipping. It allows sellers to sell to other countries without the need to actually list on those sites.
From the example XML that elelias provided I can see that a keyword search for 'laptop' was made on the Belgium site with the results filtered so that only items located in the UK was to be returned.
<itemFilter>
<name>LocatedIn</name>
<value>GB</value>
</itemFilter>
Because the search was limited to those located in the UK you won't see any Belgium items in the results. Since the items where listed on the UK site they will contain information relevant to the UK. For example the category id 177. eBay does not convert the information to make it relevant to the site that you are searching on.
It is important to remember that what ever you are trying to do with the Finding API can also be repeated using the actual advance search on eBay. For example it is possible to re-create the issue by performing a keyword search for used items on the Belgium site.
This url is the equivalent of your code that was performing the search without specifying the category 177. As you can see from the results it returns items that where listed on the UK site but which are appearing in the Belgium site. It you click on some of the items, for example, you can even see that it displays the UK category PC Laptops & Netbooks (177) even though this does not exist on the Belgium site. This matches the results form your code where it was returning 177 but would not let you specify the same value in the request as you was searching the Belgium site.
I hope this helps.
Because categoryId is repeatable. You will need to pass an array into the call. Something like this should work.
api.execute('findItemsAdvanced', {
'keywords': 'laptop',
'categoryId': [
{'51148'}
]
}
Note: See how the itemFilter element is an array in the sample file of the SDK.
'itemFilter': [
{'name': 'Condition',
'value': 'Used'},
{'name': 'LocatedIn',
'value': 'GB'},
],