Widespread Augmented Reality

Widespread Augmented Reality
Click on the image to get the Android Augmented Reality Heads up Display

Saturday, May 22, 2021

Google Translate listing languages in dropdown

This code lists languages in a sort of spinner drown down list, which is good for viewing on a mobile device.

<head>
<script type="text/javascript">
function googleTranslateElementInit() {
  new google.translate.TranslateElement({pageLanguage: 'en'}, 'google_translate_element');
}
</script>
<script type="text/javascript" src="//translate.google.com/translate_a/element.js?cb=googleTranslateElementInit"></script>
</head>

<body>
    <div id="google_translate_element"></div>  
</body>

 

This script formats the languages in a pop up box that does not resize or scroll to fit a mobile screen.  This is bad.

<script type="text/javascript">
function googleTranslateElementInit() {
  new google.translate.TranslateElement({pageLanguage: 'en', layout: google.translate.TranslateElement.InlineLayout.SIMPLE}, 'google_translate_element');
}
</script><script type="text/javascript" src="//translate.google.com/translate_a/element.js?cb=googleTranslateElementInit"></script>

Thursday, May 6, 2021

Android App with Joystick and Button Animation

I created this app to experiment with button animations and a joystick interface.  None of the interactive elements do anything. That is up to you to fill in with intents, fragments, activities et. al.


Source code and apk:

https://github.com/shimart96/MyJoystick2

 


 

Mossberg 500 Forearm Change

Change forend

https://www.youtube.com/watch?v=QOlH-_Ky2oU

Takedown:

 https://www.youtube.com/watch?v=oahhxCMDFB8

Current set up:


 

 

 

Wednesday, May 5, 2021

Android Studio and GitHub


Open an Android Studio project that you wish to upload to GitHub. 

Android Studio was not showing a Git or Github option under File | Settings | Version Control.

After installing Git for Windows from https://github.com/git-for-windows/git/releases/download/v2.31.1.windows.1/Git-2.31.1-64-bit.exe,

I then selected File | Settings | Plugins and checked the boxes for Git and GitHub.


Now go back to File | Settings | Version Control to make sure that path is set correctly.


Go to VCS | Enable Version Control | Git and then theoptions should look like this.


Send project to GitHub through the VCS menu.

 

If get the message: Invalid authentication data 404 not found, then go back to http://github.com

and create a Personal Token through dropdown on User Icon | Settings | Developer Settings



After creating and copying the token, go back to Android Studio File | Settings | Version Control | GitHub and add account using the token.

 Now click green arrow in the Android Studio toolbar.


Then share on GitHub through the VCS menu and using the token to login to GitHub

A list of useful links.


 



Sunday, May 2, 2021

Great Circle Calculation

I need to get all MySQL geotags within 10 miles of my current location.

Given that my current location is latitude = 34.034940, longitude = -117.950060 and I have a MySQL table of geotag rows with columns for lat and lng, then my query will be:

SELECT `idtags`, `lat`, `lng` FROM `mygeotags` WHERE (((acos(sin((34.034940*pi()/180)) * sin((`lat`*pi()/180)) + cos((34.034940*pi()/180)) * cos((`lat`*pi()/180)) * cos(((-117.950060 - `lng`)*pi()/180)))) * 180/pi()) * 60 * 1.1515) <= 10 

ORDER BY `idtags` ASC

I derived this query from an example at https://martech.zone/calculate-great-circle-distance/

Another query using radians can be found at https://stackoverflow.com/questions/574691/mysql-great-circle-distance-haversine-formula

This is a version going against my geotag table substituting $lat, $lng for my current location.

SELECT `idtags`, `lat `, `lng`  FROM `mygeotags`  WHERE ( 3959 * acos( cos( radians($lat) ) * cos( radians( lat ) ) * cos( radians( lng ) - radians($lng) ) + sin( radians($lat) ) * sin(radians(lat)) ) ) <= 10 

ORDER BY `idtags` ASC

Helps to visualize parallels of  latitude and meridians of longitude.