Kivy Async Image - Static Google API doesn't load - asynchronous

i try to asyncronously load a static google maps image via the google api.
The code below is taken from the kivy reference base, it works with other images, but not if i use the google link. The link works fine in the web browser. (Also note that the source string is in one line in my original py file, that just doesn't display right here)
my kv
from kivy.app import App
from kivy.uix.image import AsyncImage
from kivy.lang import Builder
class TestAsyncApp(App):
def build(self):
return AsyncImage(
source='http://maps.googleapis.com/maps/api/'+\
'staticmap?center=47.909,7.85&zoom=13&size=600x300')
if __name__ == '__main__':
TestAsyncApp().run()
Help is very appreciated!

With Kivy 1.8.0, URLs like the one above don't work as expected. Kivy tries to parse the URL and find the file extension, which fails of course. In the development version, we now check the MIME type reported by the server, but you can work around this in 1.8.0 by using a fake query parameter:
return AsyncImage(
source='http://maps.googleapis.com/maps/api/'+\
'staticmap?center=47.909,7.85&zoom=13&size=600x300&ext=.png')

Related

Is there a way to run a flutter app on web when the app uses a plugin which is not developed for web

I am using firebase_dynamic_links in my app and I wish to deploy the app on the web. firebase_dynamic_links is not implemented for flutter web.
Now, I am using dynamic links in just one file. is it possible for me to use a separate code file just for the web version that does not use dynamic links?
The code is pretty extensive and the part consisting of dynamic links is pretty small, I don't want to maintain a separate repo just because of this.
You could simply wrap it in:
try{
// app code
}catch(e){
// web code
}
You could also try:
import 'dart:io';
if(Platform.isAndroid){
// app code
}
else{
// web code
}
Although I've found that this will sometimes throw an error on the web, so you might want to wrap it it a try/catch.
You could also do:
import 'package:flutter/foundation.dart' show kIsWeb;
if (kIsWeb){
\\ web code
}
else{
\\ app code
}

SSR project with VUE 3, express and usevue/head

So I have a project on vue 3, in with was requested to add metadata(og, and twitter), so has been a long week, due I never had to work with something like that before, and it seems there are only 2 options available as I can see, so I have chose to work with usevue/head plugin, however the SSR part was not clear in the documentation, assuming that you already know. So after a long research, testing, and watching tutorials, I found how to, the component rendering to head was the easy part and is done(in my main project not in this repository, because my project I still don't have the ssr part and it's what I'm trying to figure out).
However for the SSR I created a empty project(check repository here) where I just want to run the server together with the plugin example code from the documentation, however now I'm facing 2 issues:
For some reason the css coming from the components is not being "compile" by the server.
More important, when importing the usevue/head plugin into the project I got an error: "UnhandledPromiseRejectionWarning: ReferenceError: useHead is not defined"
I suppose is because now I have 2 "main" js files, one for the server, and one for the client side, so I'm guessing that I need to import somehow the plugin to the main.server one as well, which currently looks like that:
import App from './App.vue'
export default App;
While my client side one looks like:
import { createApp } from 'vue'
import App from './App.vue'
import { createHead } from '#vueuse/head'
const head = createHead();
createApp(App).use(head).mount('#app');
If I am guessing correctly, the question is, how do you include in general a third party plugin in a server side file, not to mention the router?
Thank you in advance for your help. Also if you can recommend something else, also is very welcome.

Google Cloud Vision API could not find a declaration file

I'm following this tutorial that uses Ionic framework and Firebase backend to create an image recognition app https://www.youtube.com/watch?v=taPczl94Eow
For this line:
import * as vision from '#google-cloud/vision'
I keep getting the error:
Could not find a declaration file for module '#google-cloud/vision'.
'/Users/Private/Workspace/project/functions/node_modules/#google-cloud/vision/src/index.js' implicitly has an 'any' type.
Try `npm install #types/google-cloud__vision` if it exists or add a new declaration (.d.ts) file containing `declare module '#google-cloud/vision';`
What should I do? I already installed it properly. I also enabled the API from the GCP platform and followed their instructions
I was also having the same problem, so I had to replace this line:
import * as vision from '#google-cloud/vision'
For this line (it works with Typescript):
const vision = require('#google-cloud/vision');
I hope this works for your case.

Google analytics automation testing

The ask is, we have a website which triggers multiple events based on user's action and we wanted to simulate those scenarios using automation script and also needs to understand if Google Analytics events has been raised behind the scene.
Just curious whether is there any tool available in market which can help us to automate. Thanks!
Install Chrome Extension Source Viewer. Go to the analytics debugger extension in the store and use the Extension Source Viewer to download a zip file of the extension. Open background.js and edit debug = false(line 4 currently) to
debug = true
In Chrome Browser go the Extensions Window, turn on Dev Mode (checkbox in that window). Use the Pack Extension button and select the folder you just edited to make a file called ga_tracker.crx.
Drop that crx file into your project. For example I copied it into my virtualenv.
test.py
env/
bin/
ga_tracker.crx
And this is python selenium test, test.py. Edit the path for add_extension if you put it somewhere else.
import re
from selenium import webdriver
from selenium.webdriver.chrome.options import Options
class FindTest():
def test(self):
self.chrome_options = webdriver.ChromeOptions()
self.chrome_options.add_extension('env/bin/ga_tracker.crx')
self.driver = webdriver.Chrome(chrome_options=self.chrome_options)
self.driver.get('https://www.localsbarguide.com')
for entry in self.driver.get_log('browser'):
print(entry)
for entry in context.driver.get_log('browser'):
if 'https://www.google-analytics.com/analytics_debug.js' in entry['message']:
my_regex = re.escape('title') + r".*." + re.escape('The Premiere Drink Special & Happy Hour resource | Locals Bar Guide San Francisco')
if re.search(my_regex, entry, re.IGNORECASE):
print('Found GA event with expected title.')
self.driver.quit()
runtest = FindTest()
runtest.test()

Using meteor in chrome extension

Is it possible to take for example the todos app (from the meteor examples ) and load it as a chrome extension?
Meaning the extension will display the list of the todos on my meteor web app?
You could load the webpage with the extension, yes.
If you wanted to do something more native, you would have to import the data somehow. You could create a page that outputs JSON for the todo list, and process that from within the extension.

Resources