text:
Location Based AR: Convert lat long to X,Y,Z coordinates in ViroReact

Hi i was assuming if we can access the current location of Viro AR in terms of X and y coordinates to pin images?

@VikAdvani
Thank you so much for your insight. I was wondering if you can help us further?
I understand the steps necessary to make this work, but when i'm projecting lat/lng to x/y - the values i'm getting does not resemble meters. I have to multiply by a factor of 100.000 to get values that resembles meters mirroring the real world..
I'm using ViroImage as my Point of Interest.
the poi has the position in real world lat: 59.911048585168686 lng: 10.73813796043396
the device position in real world is lat: 59.91114769891295 lng: 10.737842327326751
so its quite close.
the output im getting by projecting these coordinates with mercator-projection are:
poi - x: 135.6360092163086, y: 74.46864700317384
device - x: 135.63579898832126, y: 74.46850641905496
As you can see, when i subtract userXY from poiXY
the values are 0.00021 etc.
When i put these values in the position prop of ViroImage the result is that the POI are on top of my head.
I made sure to set worldAlignment="GravityAndHeading" in ViroArSceneNavigator, But i'm not sure how to use it. Do i need to configure Viro components more than setting ViroArSceneNavigator prop to "GravityAndHeading"?
I feel like i'm missing som huge point with this.
Can you please try to fill in the blanks? :)
also:
the distance from device to the poi is 20 meters in real life.
the bearing from device to poi is 123.7 degrees in real life.

Since the position has to be in xyz, assuming that height is 1m
should we translate the xy position like so?
x =  imageFinalPosX
y = 1
z = imageFinalPosY

also, I noticed that VikAdvani's code sample uses a library that returns distance in pixels, how do we translate that to meters... assuming that Viro is expecting xy in meters.

...subtract the two(first ensure 2d positions are in meters)
How do I ensure this?

I'm trying to implement something similar to this issue: mapping a POI using just lat/long and distance from user current location.
When I use mercator-projection to convert current position, I get an object with x and y values.
I then convert the POI lat/long position and get another object with x and y values.
After subtracting the image position from current device position, I get an object
{x: 46.10795959722368, y: 55.79737086742074}
How do I go about mapping these coordinates in my world? @VikAdvani

also - to get this working for android, would we be able to translate this java code that is mentioned in this git issue for AR Core https://github.com/google-ar/arcore-android-sdk/issues/119 into javascript using Viro?

On Android, for rotating the final positions. Would you rotate the positions by the device heading like so, or how?
let angle = heading
let newRotatedX = objFinalPosX * Math.cos(angle) - objFinalPosZ * Math.sin(angle)
let newRotatedZ = objFinalPosZ * Math.cos(angle) + objFinalPosX * Math.sin(angle)

Hi @niallfarrell91 yep that formula seems correct. Does that work for you?

VikAdvani put up a very helpfully code example. Did you check that out?
I got the device heading, using a custom module react-native-heading. This gets the direction which the device is facing in degrees(0 being North). Then I just rotated all my objects in the scene by this rotation

Thank you! its working for me.
I just had a mistake :(

Geolocation:

npm install react-native-geolocation-service
import Geolocation from 'react-native-geolocation-service'
Write below code in componentDidMount()
Watchposition is to trigger getting your location continously

Code:
Geolocation.watchPosition(
(position) => {
this.setState({
latitude: position.coords.latitude,
longitude: position.coords.longitude,
error: null,
string: String(position.coords.latitude)
});
this.getCoordinate()
},
(error) => this.setState({ error: error.message }),
{ enableHighAccuracy: true, timeout: 2000, maximumAge: 2000, distanceFilter: 1 },
)
Translate longitude and latitude --> XYZ (Viromedia location)

npm install ecef-projector
import projector from 'ecef-projector'
follow code below, which will generate [x, y, z]

Code
const userxyz = projector.project(latitude, longitude, 0.0)
Get distance between two location

Follow code below

getDistance = (lon1, lat1, lon2, lat2) => {
if (typeof(Number.prototype.toRad) === "undefined") {
Number.prototype.toRad = function() {
return this * Math.PI / 180;
}
}
var R = 6371; // Radius of the earth in km
var dLat = (lat2-lat1).toRad();  // Javascript functions in radians
var dLon = (lon2-lon1).toRad();
var a = Math.sin(dLat/2) * Math.sin(dLat/2) +
        Math.cos(lat1.toRad()) * Math.cos(lat2.toRad()) *
        Math.sin(dLon/2) * Math.sin(dLon/2);
var c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1-a));
var d = R * c * 1000 // Distance in km
return d.toFixed(2)

}
Hope it will help you @ashmanmalik

Hi all,
I tried using the example code from @devalensio, but I'm not able to get my current location...
what am I doing wrong? I'm trying to show the latitude and longitude in the ViroText component, just to check if the location is correct.
export default class HelloWorldSceneAR extends Component {

  constructor() {
    super();

    // Set initial state here
    this.state = {
      text: "Initializing AR...",
      latitude: "Initializing latitude",
      longitude: "Initializing longitude",
    };

    // bind 'this' to functions
    this._onInitialized = this._onInitialized.bind(this);
  }

  componentDidMount() {
    Geolocation.getCurrentPosition((position) => {
      this.setState({
        latitude: position.coords.latitude,
        longitude: position.coords.longitude,
        error: null,
        string: String(position.coords.latitude)
      });
    }, (error) => this.setState({error: error.message}),)
  }

  render() {

    return (<ViroARScene onTrackingUpdated={this._onInitialized}>
      <ViroText text={String(this.state.longitude)} scale={[.5, .5, .5]} position={[0, -2, -3]} style={styles.helloWorldTextStyle}/>
      <ViroText text={String(this.state.latitude)} scale={[.5, .5, .5]} position={[0, -1, -3]} style={styles.helloWorldTextStyle}/>
      <ViroText text={String(this.state.text)} scale={[.5, .5, .5]} position={[0, 0, -3]} style={styles.helloWorldTextStyle}/>
    </ViroARScene>);
  }

  _onInitialized(state, reason) {
    if (state == ViroConstants.TRACKING_NORMAL) {
      this.setState({
        text : "Hello World!"
      });
    } else if (state == ViroConstants.TRACKING_NONE) {
      // Handle loss of tracking
    }
  }
}

And I'm also getting a warning...
Can anyone please help me with this?

Hi @AntoniaBe,
Are you developing using the Viro Testbed App or did you setup your project with XCode/Android? If you are using the Viro Media Testbed app, then this is why you are seeing the error. The Geolocation module is a native reacct module so you'll need to add it to your XCode or Android project and then build from there, since native modules aren't including with our testbed app.
If you don't add the module properly then you'll get the warning you see above.
Let me know if this helps!

Hi @VikAdvani
sorry for the late reply. I used the testbed app before, but now I managed to make a build on my phone with Android Studio. But I still have the same problem as mentioned in my last post...

Hi @AntoniaBe,
I'm assuming you are using the following npm react native package for geolocation: https://www.npmjs.com/package/react-native-geolocation-service
Did you add the proper dependencies to your build.gradle file and import the the proper files in your JS files as stated on the NPM page?

yes, I did everything according to this page but I'm still getting null as latitude and longitude values... :(

Okay I'm not quite sure what happend over night, but its working now 👍

Hi again,
I have a problem with rotating the final positions. I used @niallfarrell91  code example and the react-native-heading module from this repository https://github.com/zsajjad/react-native-heading, since the original one didn't work for me. But the text I am trying to place always has a different position...so I'm not quite sure what I am doing wrong.
  componentDidMount() {
...
...
  this.listener.addListener('headingUpdated', heading => {
          this.setState({headingAngle: heading});
    });
}

  _transformPointToAR(lat, long) {
...
...
    let angle = this.state.headingAngle;
    let newRotatedX = objFinalPosX * Math.cos(angle) - objFinalPosZ * Math.sin(angle)
    let newRotatedZ = objFinalPosZ * Math.cos(angle) + objFinalPosX * Math.sin(angle)

    return ({
      x:  newRotatedX,
      z: -newRotatedZ
    });
}

Is this correct or did I misunderstood something?

is there no one who can help me with this? :(
any help would be appreciated

Hi @AntoniaBe,
The code seems correct. If it is showing a different position every time I'd check if the headingAngle you are getting is the same or different every time you try it(assuming the device is oriented the same way). If it is different, it's prob due to the way the compass works on the device(most device compasses need to be calibrated). You'll prob want to the user to orient and calibrate the compass on the device themselves(ie. provide an affordance that allows them to orient the device till it's facing north) then take that heading angle and use it orient objects around you.
Let me know if that makes sense or if you need any more info!

Hi @VikAdvani
my headingAngle is the same when the device is oriented the same way, of course when I move it, it changes. So something must be wrong and I can't figure out what it is.
And I don't really understand how to make that affordance, could you maybe give me an example or explain this more in detail?

Hi @AntoniaBe,
If the angle is the same then the math will always give the same position which should lead the text to display at the same location. Are you seeing the text drift? It could be ARCore is not fully 'calibrated' and the text is trying to anchor.
I believe the issue is most likely related to the compass itself. Device based compasses can be distorted easily by even magnets in earphones. What I meant by affordance is that you can ask the user to point their device till it faces 'their north' before the navigation, then retrieve that value from the gyroscope and use it to rotate the points to orient them.
Another thing to check is if your angle from the react-native-heading is in radians as the JS Math libraries take radians and not angles. While this won't explain inconsistent values from the same angle, still worth checking to ensure you get the right values.

Hello guys, really a good discussion, i am also looking to develop similar apps so is it done finally or still in development phase? where can i see final working code ? any help will be appriciated

@Arvrairobo see @VikAdvani comment and attached file on March 30th

hello all, i implemented @VikAdvani and @Arvrairobo given code and my app works fine but the issue is the POI position changes while switching between the app or even if i go to home screen...what can be the problem?..any help will be appreciated

Hi @sjt145, this could be due the compass on the device. The compass may be wildly inaccurate depending on where you are since its based on the magnetic field and that can be distorted by objects. One way to tell if it's the compass is to remove the compass rotations, and see if the positions appear in the same.
If it is the compass, it's best to ask the user to calibrate the compass so they can help your app understand what 'north' it.

hello @VikAdvani thank you for replying...yes i did check with and without compass...the problem is at first when you start app it works fine with all proper position but going on and off the app points get distort...and if its due to compass then is there any other way i can align my point to one position without using compass...and other sensors provided in viro??? please help me out with this code i am new to React-Viro..

Hi @sjt145, unfortunately their aren't really any sensors that can help with this as it's a limitation of the hardware and the way the compass works on the phone. One thing I've seen people do, is ask the user to point to their true north themselves with their device, effectively a way for them to configure north themselves. Once you know what 'north' is, you can infer the other directions based on the gyroscope values of north.
This isn't ideal but a possible solution.

Hi @HLneoh,
If you have 2 positions, [x0, y0, z0] and [x1, y1, z1], then the distance between the two are:
√( (x0 - x1)2 + (y0 - y1)2 + (z0 - z1)2)
You can grab the camera's position through ViroARScene's onCameraTransformUpdate which returns an object w/ the following info:
{
  position : [x, y, z],
  rotation : [x, y, z],
  forward : [x, y, z],
  up : [x, y, z]
}

Then compare the object's position to the camera's position and you can either use the visible prop available on most Viro components to show/hide your object or you can conditionally render the object by removing/adding it to the render() function.

hello @seanyusa here is my code,
'use strict';
import React, { Component } from 'react';
import {StyleSheet,NativeEventEmitter,DeviceEventEmitter,AsyncStorage,PermissionsAndroid} from 'react-native';
import ReactNativeHeading from '@zsajjad/react-native-heading';
import Geolocation from 'react-native-geolocation-service'
import {
  ViroARSceneNavigator,
  ViroARScene,
  ViroText,
  ViroConstants,
  ViroImage,
  ViroARPlane,
  ViroBox,
} from 'react-viro';
import RNSimpleCompass from 'react-native-simple-compass';
const degree_update_rate = 3; // Number of degrees changed before the callback is triggered
export default class HelloWorldSceneAR extends Component {
  async requestLocationPermission()
  {
  try {
    const granted = await PermissionsAndroid.request(
      PermissionsAndroid.PERMISSIONS.ACCESS_FINE_LOCATION
    )
    if (granted === PermissionsAndroid.RESULTS.GRANTED) {
      //console.log("You can use the location")
      //alert("You can use the location");
      Geolocation.getCurrentPosition((Degree=this.state.Degree) => { //change to position if degree doesnt work
        this.setState({
          latitude: Degree.coords.latitude,
          longitude: Degree.coords.longitude,
          error: null,
          string: String(Degree.coords.latitude)
        });
      }, (error) => this.setState({error: error.message}),
      { enableHighAccuracy: true}
      )
    } else {
      //console.log("location permission denied")
      alert("Location permission denied");
    }
    return granted;
  } catch (err) {
    console.warn(err)
  }
}
  constructor() {
    super();
   this.requestLocationPermission=this.requestLocationPermission.bind(this);
    // Set initial state here
    this.state = {
      text: "Initializing AR...",
      latitude: 0,
      longitude: 0,
      femalefirstX: 0,
      femalefirstZ: 0,
      appleX: 0,
      appleZ: 0,
      civilX: 0,
      civilZ: 0,
      subjailX: 0,
      subjailZ: 0,
      dhirajX: 0,
      dhirajZ: 0,
      headingAngle:0,
      headAngle:0
    };
    RNSimpleCompass.start(degree_update_rate, (degree) => {
      this.setState({Degree: degree});
      RNSimpleCompass.stop();
    });
    // bind 'this' to functions
    this._onInitialized = this._onInitialized.bind(this);
    this._latLongToMerc = this._latLongToMerc.bind(this);
    this._transformPointToAR = this._transformPointToAR.bind(this);
  }
  updateHead(){
    AsyncStorage.setItem('headstart',JSON.stringify( this.state.headingAngle))
  }
  componentDidMount() {
   this.requestLocationPermission();
    ReactNativeHeading.start(1)
	.then(didStart => {
		this.setState({
			headingIsSupported: didStart,   })
    })
     var flag = 0
     DeviceEventEmitter.addListener('headingUpdated', heading => {
      this.setState({headingAngle:heading})
      //console.log('heading State',heading)
      if(flag == 0){
        this.updateHead()
      }
      flag = 1
    });
    this.updateHead()
  }
  componentWillUnmount() {
    ReactNativeHeading.stop();
  	DeviceEventEmitter.removeAllListeners('headingUpdated');
  }
  render() {
    return (<ViroARScene onTrackingUpdated={this._onInitialized}>
    <ViroText  text="female first hospital"  transformBehaviors={["billboard"]} scale={[0.2, 0.2, 0.2]}  position={[this.state.femalefirstX, 0, this.state.femalefirstZ]}  style={styles.helloWorldTextStyle} />
          <ViroText text="apple hospital" scale={[4, 4, 4]} transformBehaviors={["billboard"]}  position={[this.state.appleX, 0, this.state.appleZ]} style={styles.helloWorldTextStyle} />
             <ViroText text="civil hospital" scale={[4,4,4]} transformBehaviors={["billboard"]}  position={[this.state.civilX, 0, this.state.civilZ]} style={styles.helloWorldTextStyle} />
          <ViroText text="subjail" scale={[3, 3, 3]} transformBehaviors={["billboard"]}  position={[this.state.subjailX, 0, this.state.subjailZ]} style={styles.helloWorldTextStyle} />
          <ViroText text="dhiraj sons" scale={[5, 5, 5]} transformBehaviors={["billboard"]}  position={[this.state.dhirajX, 0, this.state.dhirajZ]} style={styles.helloWorldTextStyle} />
    </ViroARScene>);
  }
   _onInitialized() {
      var femalefirst = this._transformPointToAR(21.182531,72.826317);
      var apple = this._transformPointToAR(21.182657, 72.831573);
      var civil=this._transformPointToAR(21.179215, 72.821873);
      var subjail=this._transformPointToAR(21.181359, 72.826964);
      var dhiraj=this._transformPointToAR(21.149431, 72.782777);
    this.setState({
      femalefirstX: femalefirst.x,
      femalefirstZ: femalefirst.z,
      appleX: apple.x,
      appleZ: apple.z,
      civilX:civil.x,
      civilZ:civil.z,
      subjailX:subjail.x,
      subjailZ:subjail.z,
      dhirajX:dhiraj.x,
      dhirajZ:dhiraj.z,
      text : "AR Init called."
    });
  }
 _latLongToMerc(lat_deg, lon_deg) {
   var lon_rad = (lon_deg / 180.0 * Math.PI)
   var lat_rad = (lat_deg / 180.0 * Math.PI)
   var sm_a = 637813.70
   var xmeters  = sm_a * lon_rad
   var ymeters = sm_a * Math.log((Math.sin(lat_rad) + 1) / Math.cos(lat_rad))
   return ({x:xmeters, y:ymeters});
}
_transformPointToAR(lat, long) {
  AsyncStorage.getItem('headstart')
    .then(res=> {console.log('HeadAngle',res), this.setState({headAngle:res})} )
    var objPoint = this._latLongToMerc(lat, long);
  var devicePoint = this._latLongToMerc(this.state.latitude, this.state.longitude);
   // latitude(north,south) maps to the z axis in AR
  // longitude(east, west) maps to the x axis in AR
  var objFinalPosZ = (objPoint.y - devicePoint.y);
  var objFinalPosX = (objPoint.x - devicePoint.x);
  //flip the z, as negative z(is in front of us which is north, pos z is behind(south).
   return({x:objFinalPosX, z:-objFinalPosZ});
}
}
var styles = StyleSheet.create({
  helloWorldTextStyle: {
    fontFamily: 'Arial',
    fontSize: 30,
    color: '#d30606',
    textAlignVertical: 'center',
    textAlign: 'center',
  },
});

module.exports = HelloWorldSceneAR;

I hope this will help to find bug
Thank you

@sjt145 I don't think there is anything you can do about that since it will always get disoriented when coming back to foreground. You'll need to re-initialize the AR view if you want to re-orient.

Hi @sjt145.
I've read your code and I think that I've found the bug.
`  _latLongToMerc(lat_deg, lon_deg) {
var lon_rad = (lon_deg / 180.0 * Math.PI)
var lat_rad = (lat_deg / 180.0 * Math.PI)
var sm_a = 637813.70
var xmeters = sm_a * lon_rad
var ymeters = sm_a * Math.log((Math.sin(lat_rad) + 1) / Math.cos(lat_rad))
return ({ x: xmeters, y: ymeters });
}
_transformPointToAR(lat, long) {
var objPoint = this._latLongToMerc(lat, long);
var devicePoint = this._latLongToMerc(this.state.latitude, this.state.longitude);
objPointX = objPoint.x * cos(this.Degree) + objPoint.y * sen(this.Degree);
objPointY = objPoint.y * cos(this.Degree) - objPoint.x * sen(this.Degree);

var objFinalPosZ = (objPointY - devicePoint.y);
var objFinalPosX = (objPointX - devicePoint.x);

return ({ x: objFinalPosX, z: -objFinalPosZ });

}`
As you can see, you have to rotate de cartesian axis before you send the coordinates, this rotation is possible with the degrees that provide rnHeading.
I expect that can work properly.
A greeting.

hey @JulianGarzon22 ,
Thank you for code, I want to know here in this:
objPointX = objPoint.x * cos(this.Degree) + objPoint.y * sen(this.Degree);
what is 'this.Degree', is it the Degree I m getting from react native Heading??
Thanking you

I currently have images on those position, but the scaling is too small for far away coordinates. How do I make it that the image is always the same size no matter how far the coordinate is?

hey @JulianGarzon22 ,
Thank you for code, I want to know here in this:
objPointX = objPoint.x * cos(this.Degree) + objPoint.y * sen(this.Degree);
what is 'this.Degree', is it the Degree I m getting from react native Heading??
Thanking you

Maybe little late, but:
@ashmanmalik i've a little project that you can use as an example.
https://github.com/mherrerabarraza/mapbox-viroreact-point-of-interes
Btw im using 'proj4' module to transform from LAT,LONG (Gps) to UTM (Cartesian).

@mherrerabarraza I was looking over your code and noticed that you don't consider where the user is facing/compass, is it needed?

@jalqueza It would be needed in Android. Since AR Core doesn't support built in heading.

@seanyusa I see so from my understanding iOS would consider where the user is facing, but in android the position has to be transformed in accordance the heading?

@jalqueza That's correct as long as you pass the GravityAndHeading option to the worldAlignment prop on iOS. https://docs.viromedia.com/v2.13.0/docs/viroarscenenavigator You'll find in the docs that the prop doesn't work on Android.

@seanyusa okay thanks I figured. On another note, do you know of another method of how to scale images? Right now I just multiply how far they the coordinate is by an arbitrary integer. Do you know of a more efficient solution?

@mherrerabarraza I was looking over your code and noticed that you don't consider where the user is facing/compass, is it needed?

@jalqueza
I did not even think about it, but it would be a good improvement. The big problem with my code is that I do not know how to put the polyline in a fixed position. For example, when I walk from one point to another along the line, I follow and lose the sense of the pathway. Any Idea?

@AntoniaBe Have you been able to fix the problem? I've got the same problem and using @niallfarrell91 's code to rotate the objects. @VikAdvani can you help me out?
I'm using de magnetometer from react-native-sensors (https://github.com/react-native-sensors/react-native-sensors), but before using this im trying to get this working without real "compass" values. So i'm using constant values for now. See my code below.
createARObjectPosition = () => {
    const objPoint = this.latLongToMerc(latObj, longObj);
    const mobilePoint = this.latLongToMerc(latMobile, longMobile);

    const objDeltaY = objPoint.y - mobilePoint.y;
    const objDeltaX = objPoint.x - mobilePoint.x;

    let degree = 90; // for now i'm using a constant compass value (90 degree clockwise from north)
    let angleRadian = (degree * Math.PI) / 180; // degree to radian

    let newObjX = objDeltaX * Math.cos(angleRadian) - objDeltaY * Math.sin(angleRadian);
    let newObjY = objDeltaX * Math.sin(angleRadian) + objDeltaY * Math.cos(angleRadian);

    return { x: newObjX, y: 0, z: -newObjY }; // y is in my case always 0 (center of the screen).
    // for some reason this AR point is not valid? It jumps to different positions in AR space everytime i restart the AR app.
}

latLongToMerc = (latDeg: number, longDeg: number) => {
    // From: https://gist.github.com/scaraveos/5409402
    const longRad = (longDeg / 180.0) * Math.PI;
    const latRad = (latDeg / 180.0) * Math.PI;
    const smA = 6378137.0;
    const xmeters = smA * longRad;
    const ymeters = smA * Math.log((Math.sin(latRad) + 1) / Math.cos(latRad));

    return { x: xmeters, y: ymeters };
  };

For some reason the calculated AR point seems to be not valid? It jumps to different positions in AR space everytime i restart the AR app. What am i doing wrong?
I've used the following link as example to compare and validate the calculated point results: https://keisan.casio.com/exec/system/1496886458

@AntoniaBe Have you been able to fix the problem? I've got the same problem and using @niallfarrell91 's code to rotate the objects. @VikAdvani can you help me out?
I'm using de magnetometer from react-native-sensors (https://github.com/react-native-sensors/react-native-sensors), but before using this im trying to get this working without real "compass" values. So i'm using constant values for now. See my code below.
createARObjectPosition = () => {
    const objPoint = this.latLongToMerc(latObj, longObj);
    const mobilePoint = this.latLongToMerc(latMobile, longMobile);

    const objDeltaY = objPoint.y - mobilePoint.y;
    const objDeltaX = objPoint.x - mobilePoint.x;

    let degree = 90; // for now i'm using a constant compass value (90 degree clockwise from north)
    let angleRadian = (degree * Math.PI) / 180; // degree to radian

    let newObjX = objDeltaX * Math.cos(angleRadian) - objDeltaY * Math.sin(angleRadian);
    let newObjY = objDeltaX * Math.sin(angleRadian) + objDeltaY * Math.cos(angleRadian);

    return { x: newObjX, y: 0, z: -newObjY }; // y is in my case always 0 (center of the screen).
    // for some reason this AR point is not valid? It jumps to different positions in AR space everytime i restart the AR app.
}

latLongToMerc = (latDeg: number, longDeg: number) => {
    // From: https://gist.github.com/scaraveos/5409402
    const longRad = (longDeg / 180.0) * Math.PI;
    const latRad = (latDeg / 180.0) * Math.PI;
    const smA = 6378137.0;
    const xmeters = smA * longRad;
    const ymeters = smA * Math.log((Math.sin(latRad) + 1) / Math.cos(latRad));

    return { x: xmeters, y: ymeters };
  };

For some reason the calculated AR point seems to be not valid? It jumps to different positions in AR space everytime i restart the AR app. What am i doing wrong?
I've used the following link as example to compare and validate the calculated point results: https://keisan.casio.com/exec/system/1496886458

@jeffreyhaen i am facing similar problem, did u find a solution to your problem ?

Hi @jeffreyhaen, @SteponasIvasovas,

For some reason the calculated AR point seems to be not valid? It jumps to different positions in AR > space everytime i restart the AR app. What am i doing wrong

When you say it jumps to a different point every time you restart the app, I suspect what could be happening is that the 'GravityAndHeading' setting resets to calibrate the AR space with the device compass and the compass frankly isn't that accurate. Since your phone is likely in a different position, the AR space resets to what it thinks is true north, which is taken from the compass. However, the compass readings might be off.
To ensure this is happening you can:

Remove the 'GravityandHeading' setting for worldAlignment.
Start your app, look around to find your lat/long points.
Restart the app in a different position
Look around, the points should be in the same relative position to your start orientation.

If the above checks out, then it is a device compass issue. Other apps have solved this by asking the user to point to 'true north' via UX/UI and then using those values in conjunction with the compass to get a better orientation.
It's an unfortunate limitation of the current devices that the compass value can easily be distorted, esp in dense city areas.

Thanks for answering me @VikAdvani

To ensure this is happening you can:

Remove the 'GravityandHeading' setting for worldAlignment.
Start your app, look around to find your lat/long points.
Restart the app in a different position
Look around, the points should be in the same relative position to your start orientation.

If the above checks out, then it is a device compass issue. Other apps have solved this by asking the user to point to 'true north' via UX/UI and then using those values in conjunction with the compass to get a better orientation.

If i'm understanding the React Viro documentation correctly, the worldAlignment prop is not supported by ARCore on Android but iOS ARKit only. My app is working properly on iOS, i'm facing the issue on Android only.
I've followed your instructions anyways. I've removed worldAlignment and restarted my app in different positions. The points were in the same direction relative to my start position. But the whole point of my issue is that i want to rotate my objects according to the "true north" (based on the magnetometer). See code in my previous comment.

@SteponasIvasovas @CorentinOme @VikAdvani

i am facing similar problem, did u find a solution to your problem ?

I've not fixed my problem yet, but i've come close to a solution. The problem was that i was calculating the new object positions too early. The calculation happend when the AR triggered supported, but i had to wait until AR has been initialized (hence onTrackingUpdated triggers ViroConstants.TRACKING_NORMAL for the first time). After this code change my object positions are recalculated to the correct AR space positions. But for some reason my recalculation only works from 0 to 270. After 270 degree from north the positions are getting consistent incorrect again. I don't understand why.
From my scene component:
onTrackingUpdated = (state: any, reason: any) => {
    if (!this.state.hasARInitialized && state === ViroConstants.TRACKING_NORMAL) {
      this.setState(
        {
          hasARInitialized: true,
        },
        () => {
          this.props.onARInitialized();
        }
      );
    }
  };

Triggered when hasARInitialized is true:
transformGpsToAR = () => {
    const deviceObjPoint = this.latLongToMerc(latObj, longObj); // see previous post for code.
    const mobilePoint = this.latLongToMerc(latMobile, longMobile); // see previous post for code.

    const objDeltaY = deviceObjPoint.y - mobilePoint.y;
    const objDeltaX = deviceObjPoint.x - mobilePoint.x;

    if (isAndroid) {
      let degree = 90; // not using real compass yet.
      let angleRadian = (degree * Math.PI) / 180;

      console.log('Using degree => ', degree);
      console.log('Angle radian => ', angleRadian);

      let newObjX = objDeltaX * Math.cos(angleRadian) - objDeltaY * Math.sin(angleRadian);
      let newObjY = objDeltaX * Math.sin(angleRadian) + objDeltaY * Math.cos(angleRadian);

      console.log('old delta => ', { x: objDeltaX, z: -objDeltaY });
      console.log('new delta => ', { x: newObjX, z: -newObjY });

      return { x: newObjX, z: -newObjY };
    }

    return { x: objDeltaX, z: -objDeltaY };
  };

Hi guys !
I try to put in place your solutions and especially the code given by @jeffreyhaen. I specify that I am under android and currently I am only trying to display a text in the right position with predefined coordinates and without orientation.
But I always have an error with the position of the object as you can see below.
I also put you the code of my HelloWorldSceneAR file. Is there anyone who had the same problem ?

My code :
'use strict';

import React, { Component } from 'react';

import {StyleSheet} from 'react-native';

import {
  ViroARScene,
  ViroText,
  ViroConstants,
} from 'react-viro';

export default class HelloWorldSceneAR extends Component {

  _subscription = false;

  constructor() {
    super();

    // Set initial state here
    this.state = {
      latitude : 0,
      longitude : 0,
      latObj : 40.000000,
      lonObj : 3.000000,
      latMobile : 40.000000,
      longMobile : 3.000000,
      newX : 0.0,
      newY : 0.0,
      displayText : "init"
    };

    // bind 'this' to functions
    this._onInitialized = this._onInitialized.bind(this);
    this.transformGpsToAR = this.transformGpsToAR.bind(this);
  }

  render() {
    return (
      <ViroARScene onTrackingUpdated={this._onInitialized} >
        <ViroText text="The object is here !" scale={[3, 3, 3]} transformBehaviors={["billboard"]} position={[this.state.newX, 0, this.state.newY]} style={styles.helloWorldTextStyle} />
      </ViroARScene>
    );
  }

  _onInitialized(state, reason) {
    if (state == ViroConstants.TRACKING_NORMAL) {
      if(this.state.displayText !== 'good'){
        console.log(this.state.displayText)
        var res = this.transformGpsToAR();

        this.setState({
          newX: res.x,
          newY: res.y,
          displayText: "good"
        });
      }
    } else if (state == ViroConstants.TRACKING_NONE) {
      this.setState({
        displayText: "none"
      });
    }
  }

  transformGpsToAR = () => {
    const deviceObjPoint = this.latLongToMerc(this.state.latObj, this.state.lonObj);
    const mobilePoint = this.latLongToMerc(this.state.latMobile, this.state.longMobile);

    const objDeltaY = deviceObjPoint.y - mobilePoint.y;
    const objDeltaX = deviceObjPoint.x - mobilePoint.x;

    let degree = 0;
    let angleRadian = (degree * Math.PI) / 180;

    let newObjX = objDeltaX * Math.cos(angleRadian) - objDeltaY * Math.sin(angleRadian);
    let newObjY = objDeltaX * Math.sin(angleRadian) + objDeltaY * Math.cos(angleRadian);

    newObjX = Math.round(newObjX*100)/100;
    newObjY = Math.round(newObjY*100)/100;

    return { x: newObjX, z: -newObjY };
  };

  latLongToMerc(latDeg, longDeg){
    const longRad = (longDeg / 180.0) * Math.PI;
    const latRad = (latDeg / 180.0) * Math.PI;
    const smA = 6378137.0;
    const xmeters = smA * longRad;
    const ymeters = smA * Math.log((Math.sin(latRad) + 1) / Math.cos(latRad));
    return { x: xmeters, y: ymeters };
  };

}

var styles = StyleSheet.create({
  helloWorldTextStyle: {
    fontFamily: 'Arial',
    fontSize: 30,
    color: '#000000',
    textAlignVertical: 'center',
    textAlign: 'center',
  },
});

module.exports = HelloWorldSceneAR;

Closing due to inactivity.

Hi, i am also facing the same issue. position of viroImage is changing once restart the viro app

@karthickBabu93629 @jeffreyhaen  can explain about the device compass degree? How do I get the compass degree using react native? can provide code snippet?

Fixed the issue, I used magnetometer and wrote my own custom logic and listeners to find the heading direction and its angle degree

Thats great, could you please share the code or send a PR request?
On Thursday, 30 April, 2020, 01:50:02 am IST, ManigandanRaamanathan <notifications@github.com> wrote:

Fixed the issue, I used magnetometer and wrote my own custom logic and listeners to find the heading direction and its angle degree
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub, or unsubscribe.

hi @VikAdvani
I am facing this problem Convert lat long to X,Y,Z coordinates in ViroReact
actually, I want to do  -
my object (Image ) is 200m from my current location.
I have done the above solution. After done the calculation between the current location to my object .   AR show 5m around from my current location.
but it should be 200m from my location.
please help me
thanks

Hi,
I left this project 2 years ago, but i face the same problem. Since im
using a Free version of the GPS/Map is not so accurate. Maybe you can
follow the same logic, but with a better GPS service.
Cheers
El dom., 19 jul. 2020 a las 6:42, nishant2708 (notifications@github.com)
escribió:

hi @VikAdvani https://github.com/VikAdvani
I am facing this problem Convert lat long to X,Y,Z coordinates in ViroReact
actually, I want to do -
my object (Image ) is 200m from my current location.
I have done the above solution. After done the calculation between the
current location to my object . AR show 5m around from my current location.
but it should be 200m from my location.
please help me
thanks
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/viromedia/viro/issues/131#issuecomment-660624020, or
unsubscribe
https://github.com/notifications/unsubscribe-auth/AJQ3UC5ZG2UEA3Y7XCDHW63R4LE2LANCNFSM4ELJPR3A
.

--
Atentamente,
Manuel Herrera Barraza
+56 9 66451592
Restaurant La Ciudad Nueva
Casa Matriz Centro : Maipu #314, Telefono: +56 55 2388888 (Comida China)
Sucursal Sur 14 de Febrero #1945, Telefono: +56 9 82910663 (Comida
Tailandesa)}
Sucursal Norte: Los Chañares 291, Trocadero. Telefono: +56 55 2838888
(Comida China)
Antofagasta, Chile

Hi @mherrerabarraza
please send the link of  Free version of the GPS/Map.
thanks

You have to get a MAPBOX TOKEN like i mentioned in the Readme.md FIle:
https://github.com/mherrerabarraza/mapbox-viroreact-point-of-interes/blob/master/README.md
El lun., 20 jul. 2020 a las 2:36, nishant2708 (notifications@github.com)
escribió:

Hi @mherrerabarraza https://github.com/mherrerabarraza
please send the link of Free version of the GPS/Map.
thanks
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/viromedia/viro/issues/131#issuecomment-660833661, or
unsubscribe
https://github.com/notifications/unsubscribe-auth/AJQ3UC3QBHZW6EWE33OYIRDR4PQWTANCNFSM4ELJPR3A
.

--
Atentamente,
Manuel Herrera Barraza
+56 9 66451592
Restaurant La Ciudad Nueva
Casa Matriz Centro : Maipu #314, Telefono: +56 55 2388888 (Comida China)
Sucursal Sur 14 de Febrero #1945, Telefono: +56 9 82910663 (Comida
Tailandesa)}
Sucursal Norte: Los Chañares 291, Trocadero. Telefono: +56 55 2838888
(Comida China)
Antofagasta, Chile

thanks  @mherrerabarraza

Your welcome!
El mar., 21 jul. 2020 a las 9:40, nishant2708 (notifications@github.com)
escribió:

thanks @mherrerabarraza https://github.com/mherrerabarraza
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/viromedia/viro/issues/131#issuecomment-661868194, or
unsubscribe
https://github.com/notifications/unsubscribe-auth/AJQ3UC6ZZXU4CLYSF42AXC3R4WLGPANCNFSM4ELJPR3A
.

--
Atentamente,
Manuel Herrera Barraza
+56 9 66451592
Restaurant La Ciudad Nueva
Casa Matriz Centro : Maipu #314, Telefono: +56 55 2388888 (Comida China)
Sucursal Sur 14 de Febrero #1945, Telefono: +56 9 82910663 (Comida
Tailandesa)}
Sucursal Norte: Los Chañares 291, Trocadero. Telefono: +56 55 2838888
(Comida China)
Antofagasta, Chile

Hi @mypark, @ashmanmalik, @amyramnauth,
I've attached code to demonstrate how to do this. I am no longer using the node js package I mentioned as @mypark brought up that package returns results in pixels that represent Google tiles.
I found other projection code here: https://gist.github.com/scaraveos/5409402 that I use to translate lat_long->mercator which is then translated into Viro AR Space.
To complete the transform into Viro AR, the object will have x= (longitude after merc projection - device position)and z=(latitude after merc projection - device position). I then flip the z axis as Viro has -Z facing north.
To align the compass in iOS you'll have to set worldAlignment="GravityAndHeading" in your ViroSceneARNavigator. This makes the x,z axis in Viro AR align to the north, south, east, west of your device compass. For android you'll need to take these final positions and rotate them around what north is using the compass of the device.
Finally for objects more than 60 meters away your object won't appear. This is due to a clipping bug that will be fixed in our next release next week.
Keep in mind, the code attached hard codes the device position as it's for example purposes only:
HelloWorldSceneAR.js.zip
BTW, given the potential inaccuracies of on device compasses it may be worthwhile asking the end user to calibrate their true north.

It worked for me

@SteponasIvasovas @CorentinOme @VikAdvani

i am facing similar problem, did u find a solution to your problem ?

I've not fixed my problem yet, but i've come close to a solution. The problem was that i was calculating the new object positions too early. The calculation happend when the AR triggered supported, but i had to wait until AR has been initialized (hence onTrackingUpdated triggers ViroConstants.TRACKING_NORMAL for the first time). After this code change my object positions are recalculated to the correct AR space positions. But for some reason my recalculation only works from 0 to 270. After 270 degree from north the positions are getting consistent incorrect again. I don't understand why.
From my scene component:
onTrackingUpdated = (state: any, reason: any) => {
    if (!this.state.hasARInitialized && state === ViroConstants.TRACKING_NORMAL) {
      this.setState(
        {
          hasARInitialized: true,
        },
        () => {
          this.props.onARInitialized();
        }
      );
    }
  };

Triggered when hasARInitialized is true:
transformGpsToAR = () => {
    const deviceObjPoint = this.latLongToMerc(latObj, longObj); // see previous post for code.
    const mobilePoint = this.latLongToMerc(latMobile, longMobile); // see previous post for code.

    const objDeltaY = deviceObjPoint.y - mobilePoint.y;
    const objDeltaX = deviceObjPoint.x - mobilePoint.x;

    if (isAndroid) {
      let degree = 90; // not using real compass yet.
      let angleRadian = (degree * Math.PI) / 180;

      console.log('Using degree => ', degree);
      console.log('Angle radian => ', angleRadian);

      let newObjX = objDeltaX * Math.cos(angleRadian) - objDeltaY * Math.sin(angleRadian);
      let newObjY = objDeltaX * Math.sin(angleRadian) + objDeltaY * Math.cos(angleRadian);

      console.log('old delta => ', { x: objDeltaX, z: -objDeltaY });
      console.log('new delta => ', { x: newObjX, z: -newObjY });

      return { x: newObjX, z: -newObjY };
    }

    return { x: objDeltaX, z: -objDeltaY };
  };

@jeffreyhaen Did you finish it on Android yet?

@SteponasIvasovas @CorentinOme @VikAdvani

i am facing similar problem, did u find a solution to your problem ?

I've not fixed my problem yet, but i've come close to a solution. The problem was that i was calculating the new object positions too early. The calculation happend when the AR triggered supported, but i had to wait until AR has been initialized (hence onTrackingUpdated triggers ViroConstants.TRACKING_NORMAL for the first time). After this code change my object positions are recalculated to the correct AR space positions. But for some reason my recalculation only works from 0 to 270. After 270 degree from north the positions are getting consistent incorrect again. I don't understand why.
From my scene component:
onTrackingUpdated = (state: any, reason: any) => {
    if (!this.state.hasARInitialized && state === ViroConstants.TRACKING_NORMAL) {
      this.setState(
        {
          hasARInitialized: true,
        },
        () => {
          this.props.onARInitialized();
        }
      );
    }
  };

Triggered when hasARInitialized is true:
transformGpsToAR = () => {
    const deviceObjPoint = this.latLongToMerc(latObj, longObj); // see previous post for code.
    const mobilePoint = this.latLongToMerc(latMobile, longMobile); // see previous post for code.

    const objDeltaY = deviceObjPoint.y - mobilePoint.y;
    const objDeltaX = deviceObjPoint.x - mobilePoint.x;

    if (isAndroid) {
      let degree = 90; // not using real compass yet.
      let angleRadian = (degree * Math.PI) / 180;

      console.log('Using degree => ', degree);
      console.log('Angle radian => ', angleRadian);

      let newObjX = objDeltaX * Math.cos(angleRadian) - objDeltaY * Math.sin(angleRadian);
      let newObjY = objDeltaX * Math.sin(angleRadian) + objDeltaY * Math.cos(angleRadian);

      console.log('old delta => ', { x: objDeltaX, z: -objDeltaY });
      console.log('new delta => ', { x: newObjX, z: -newObjY });

      return { x: newObjX, z: -newObjY };
    }

    return { x: objDeltaX, z: -objDeltaY };
  };

@jeffreyhaen Did you finish it on Android yet?

Android:
https://developers.google.com/ar/develop/geospatial
iOS:
https://developer.apple.com/documentation/arkit/argeoanchor
I saw both support geolocation base AR scene.

But this repository still doesn't support these features.

authors: AntoniaBe Arvrairobo CorentinOme JulianGarzon22 ManigandanRaamanathan MustafaCov SteponasIvasovas VikAdvani achuvm amyramnauth ansarikhurshid786 arashmad ashmanmalik dam00n devalensio hhong0326 jalqueza jeffreyhaen karthickBabu93629 mherrerabarraza mypark nhatvuminh niallfarrell91 nishant2708 r0bbarnk radvani seanyusa sjt145

repo: viromedia/viro


text:
Sprint 02 Planning

Build out product backlog for all sprints (20 minutes)
Discuss what has been completed (update product backlog) (5 minutes)
Discuss what obstacles exist & collaboratively how to solve them (5 minutes)
Discuss what we will build out (add to and prioritize sprint backlog) (10 minutes)
Discuss what we will work on individually or in pairs (5 minutes)

API/Client: Build out playlist view and playlist functionality in the API
Sockets: Persisting state and giving certain rights to the event creator versus the insider

source: gharchive/issue

repo: visceral-tambourine/visceral-tambourine

license: mit

license_type: permissive

license_source: bigquery


text:
什么时候出文档啊

没有文档，盲用啊，vue组件跟着你的demo用了还是很方便的，但是没有文档啊。

文档得慢一些，主要补的是与 G2 的差异，大部分参数设定与 G2 是一样的，我这周会先把 demo 补上

Access the latest docs here: Viser Docs
Thanks for supporting viser.

authors: arcthur evilucifero zhuss

repo: viserjs/viser


text:
docs: correct links to the hooks source code files

Tried to find the source code for the hooks but the links point to tsx files but the hooks are ts files.
Excited to see where this project goes :D!

Awesome, thanks!

source: gharchive/pull-request

authors: WanderingBrooks usefulthink

repo: visgl/react-google-maps

license: MIT

license_source: github-api


text:
Question wuwu

I'm sorry to bother you.Can I know the relationship between the model under the folder mpinets and the TemporalUNet used. Thank you very much.

Hi,
The model is totally unrelated to our framework. It is the model for MPINETs policy (one of the baselines in our paper). We shall remove it in the upcoming commit. Thanks for informing us!


text:
[feature] 简历部分内容标注/高亮

前置背景
请查看issue

https://github.com/visiky/resume/issues/75

本PR对应方案一
方案一的简述是通过windpw.getSelection()这个API进行浏览器文本选择及替换。
具体方案思路是：

通过提炼自定义hook的方式来添加自定义右键菜单，解耦页面

菜单中实现对window.getSelection()选中的文本、节点进行替换

将替换操作整理成effect，加入effect列表，形成可复现的作用链，支持通过command+z与command+shift+z进行撤销与反撤销

录制一个 gif 看下效果？

如图

authors: GrinZero visiky

repo: visiky/resume


text:
DEBUG_USE_MICROSECONDS=Y DEBUG=* node ./examples/node/useMicroseconds.js

Add an option to use microseconds in timestamps. Tested on macOS 10.12.6 and Ubuntu 16.04 LTS. Sample output:
alec@alec-MS-7596 ~/process/debug (master) $ DEBUG_USE_MICROSECONDS=Y DEBUG=* node ./examples/node/useMicroseconds.js
  use:µs the ∆ is +0µs
  use:µs the ∆ is +1366µs
  use:µs the ∆ is +110µs
  use:µs the ∆ is +31µs
  use:µs the ∆ is +36µs
  use:µs the ∆ is +24µs
  use:µs the ∆ is +23µs
  use:µs the ∆ is +23µs
(node:5403) Warning: N-API is an experimental feature and could change at any time.
  use:µs the ∆ is +11s
alec@alec-MS-7596 ~/process/debug (master) $ DEBUG=* node ./examples/node/useMicroseconds.js
  use:µs the ∆ is +0ms
  use:µs the ∆ is +2ms
  use:µs the ∆ is +0ms
  use:µs the ∆ is +0ms
  use:µs the ∆ is +0ms
  use:µs the ∆ is +0ms
  use:µs the ∆ is +0ms
  use:µs the ∆ is +0ms
  use:µs the ∆ is +11s
alec@alec-MS-7596 ~/process/debug (master) $ npm test

> debug@3.1.0 test /home/alec/process/debug
> ./node_modules/mocha/bin/_mocha

  debug
    ✓ passes a basic sanity check
    ✓ allows namespaces to be a non-string value
    with log function
      ✓ uses it
    custom functions
      with log function
        ✓ uses it

  4 passing (9ms)

Coverage decreased (-0.5%) to 73.256% when pulling 81c1c9e61974bf61194fd077f95151cb9002b7fd on amissine:master into 207a6a2d53507ec9dd57c94c46cc7d3dd272306d on visionmedia:master.

Closing this in favor of #582.

authors: Qix- amissine coveralls

repo: visionmedia/debug


text:
Change default scaling option for Scatter plot and other operators/plots

This is similar to #3274 except for Scatter plot. We should probably also audit rest of plots and operators for any other instances of this. In each case, having the Always, Auto, Never options for which mode the scaling is in and having the default be Auto mode based on aspect ratio is probably a decent choice.  But, we should also take a look at the interface used for the similar feature in views for fullframe mode in 2D view mode and for Curve view mode. The 2D fullframe mode is a similar AAN setting based on aspect ratio whereas the Curve view allows user to specify min/max of the axes. Not sure which of these two modalities is best or if some hybrid of them is best.
In the case of scatter plot, it appears to default to mapping things to the unit square or the unit cube and there is a check-box to disable that. And, again, this leads to incorrect use of the plot for certain common cases. So, it would be better for Scatter plot to default to an auto mode based on aspect ratio.
Impact
(Please click check boxes AFTER submitting ticket)

[ ] High - User productivity significantly improved
[x] Medium - User productivity partially improved
[ ] Low - User productivity trivially improved

This is related to #3727

repo: visit-dav/visit


text:
Should we get rid of (or archive) the issues-test repo

We still have the issues-test repo.
Can we just delete it? If not, maybe we should archive it.

We didn't see any reason to keep it so let's delete it.

We didn't see any reason to keep it so let's delete it.


text:
Update avtWDataFileFormat.C

Bugfix in WData database plugin.
Description
Bugfix. Array iterator had a wrong name

Type of change

[X] Bug fix~~
[ ] New feature~~
[ ] Documentation update~~
[ ] Other~~

How Has This Been Tested?
The bug was noticed by on of the developer in the group and fixed. Now we want to incorporate it to the visit plugin 3.2RC
Checklist:

[X] I have followed the style guidelines of this project.~~
[X] I have performed a self-review of my own code.~~
[ ] I have commented my code where applicable.~~
[ ] I have updated the release notes.~~
[ ] I have made corresponding changes to the documentation.~~
[ ] I have added debugging support to my changes.~~
[ ] I have added tests that prove my fix is effective or that my feature works.~~
[ ] I have confirmed new and existing unit tests pass locally with my changes.~~
[ ] I have added new baselines for any new tests to the repo.~~
[X] I have NOT made any changes to protocol or public interfaces in an RC branch.~~
[ ] I have assigned reviewers (see VisIt's PR procedures for more information).~~

@Belyor thanks so much! 🥇


text:
Refactor experiment/training/finetuning scripts with documentation

Experiment scripts
Finetuning scripts / notebooks
Training MLM / finetuning MLM scripts / notebooks

WIP
2. Finetuning scripts
List of files to refactor

Multiclass and Multilabel Sequence Classification Finetuning scripts
path: ./scripts/downstream/train_sequence_classification_lm_finetuning.py

Todos:

[ ] Move static variables (data type: Dict)  out from the script

[ ] Use default argument class instead of manually create arguments with ArgumentParaser

[ ] Make the finetuner be able to access via thai2transformers module. (for example;
 from thai2transformer.finetuners import SequenceClassificationFinetuner
 seq_cls_finetuner = SequenceClassificationFInetuner( ... )
 # specify base model, tokenizer
 # specify target dataset
 # specify hyperparameters

Token Classification Finetuning scripts
path: ./scripts/downstream/train_token_classificaition_lm_finetuning.py

Todos:


text:
Check Gitlab Visualize Storage

From Claudio Di Gallo, BAR on 29.11.2024 per email

We’re running low on storage on gitlab. It seems the culprit is visualize. Do you have some old tags in there? I think we’ve had this before – but last time with trifid.
Do you have vhsn-access?
SBAR-1282: Disk space on gitlab1.sbar.cust.vshn.net

I was hoping that @bprusinowski would take the task as I am not planned in for visualize right now.

Resolution (copied from reply in VSHN ticket)

I've set up a policy that should help keep space usage low (and manually removed some older containers, as the action will run on a two-week basis).

authors: ptbrowne sosiology

repo: visualize-admin/visualization-tool


text:
updated permissions

Please take a look

 Implementation of IsStaffOrOwner permissions

repo: vitaliisili/petoshield-rest


text:
liveserver unaware of xdist

pytest-xdist allows multi processed testing, liveserver is unaware oft that

Now pytest-flask supports parallel execution via pytest-xdist. New version is available on pypi.

authors: RonnyPfannschmidt vitalk

repo: vitalk/pytest-flask


text:
Trailing slash resolves in 404

Hi,
The pwa works great but I would like to know how to redirect
/blog/post/ to blog/post trailing slashes in the url are not resolving.
It is a static build
build: {
    format: "file"
  },

AstroPWA({
      mode: "production",
      base: "/",
      scope: "/",
      includeAssets: [`icons/${process.env.THEME}/favicon.svg`],
      registerType: "autoUpdate",
      manifest: manifest,
      workbox: {
        navigateFallback: "/404",
        globPatterns: ["**/*.{js,css,html,txt,json,svg,woff,woff2,ico,xml}"],
      },
      devOptions: {
        enabled: false,
        navigateFallbackAllowlist: [/^\/404$/],
      },
    }),

I have a similar problem, where trailing slashes always end up on the root path

Can you configure tralingSlash in Astro? https://github.com/vite-pwa/astro/blob/main/src/index.ts#L54

Can you configure tralingSlash in Astro? https://github.com/vite-pwa/astro/blob/main/src/index.ts#L54

thanks for the quick answer. yes I've now done that, trying both combinations.

trailingSlash: 'always' + build.format: 'directory': only trailing slashes work, without trailing slashes the service worker loads the root page. A hard refresh gives a 404
trailingSlash: 'never' + build.format: 'file': same as above but flipped.. this is how I have currently deployed it.

Example Links:

https://strudel.tidalcycles.org/workshop/getting-started correct page is loaded
https://strudel.tidalcycles.org/workshop/getting-started/ root route is loaded by the SW. cache refresh gives 404

The optimal case would be if it did not matter if a trailing slash is used or not.
I am not entirely sure if this is a vite / astro / vite-pwa or github pages problem...

Just found: https://github.com/slorber/trailing-slash-guide which explains the behavior of github pages for different links, notably:
/file - ✅
/file/ - 💢 404
/folder - ➡ /folder/
/folder/ - ✅
This further confirms that build.format: 'file' will cause a 404 with a trailing slash.
Without using a service worker, it looks like it would work with build.format: 'directory', as it will just do a redirect.
So is suspect that the service worker will interpret urls without trailing slashes as a file and for some reason serve the root file.

I have done a quick test repro with a simple astro project that builds using build.format: 'directory': https://github.com/felixroos/astro-test/
Both of these urls work:

https://felixroos.github.io/astro-test/test/
https://felixroos.github.io/astro-test/test (redirects to above url)

So it seems the problem is really service worker related..

IIRC there is a directoryIndex and cleanUrl in workbox option:
https://developer.chrome.com/docs/workbox/modules/workbox-precaching/#directory-index

I Will try to check your repro tmr.

IIRC there is a directoryIndex and cleanUrl in workbox option: https://developer.chrome.com/docs/workbox/modules/workbox-precaching/#directory-index

EDIT: maybe both options wth another names, the link is about using the workbox modules.

On first sight that sounds like it would help in this case!

I Will try to check your repro tmr.

Thanks!
For completeness sake, I've now done a full reproduction that shows how adding @vite-pwa/astro to the mix results in wrong caching behavior:

https://felixroos.github.io/astro-test-pwa/ ✅ works
https://felixroos.github.io/astro-test-pwa/test ✅ works, redirects to test/ on hard refresh (!)
https://felixroos.github.io/astro-test-pwa/test/ ❌ loads index.astro, works without hard refresh (once)

@felixroos
can you deploy using mode: 'development' in pwa options (https://github.com/vite-pwa/astro/blob/main/examples/pwa-simple/astro.config.mjs#L14)? this way you will see the sw logs, I'll change the logic in the pwa integration to allow configure external manifestTransform, rn the pwa integration will add always a new one to handle Astro directory and trailing slash options.

Since you're deploying to gh pages, the scope is the project name without final slash (check the sw pre cache manifest in your deployed app) and so the sw maybe intercepting the /test/, I'll fix that also (GH Pages redirecting to /astro-test-pwa/ when requesting /astro-test-pwa

Preparing PR to not modify the sw precache manifest when using directory, on local works for /test/, /test, /test/aboutand/test/about/`, check the pwa-simple example (added same folders).

Astro build is inconsistent, why 404/index.html missing? only 404.html in root dist folder

@felixroos can you test in local with current PR or review it (GH Pages maybe will fail from your url sinde /test/ will return 404)?

You can open the pwa-example using this StackBlitz repro

can you deploy using mode: 'development' in pwa options? this way you will see the sw logs

deployed, but it only logs "SW registered: ..." atm

@felixroos can you test in local with current PR or review it

can test tomorrow (if it's still relevant)

(GH Pages maybe will fail from your url since /test/ will return 404)?

with build.format: 'directory', /test/ should work, as it will lead to /test/index.html which exists.
it also works rn: https://felixroos.github.io/astro-test-pwa/test/ (with hard refresh)
the stackblitz example seems to work fine!

@felixroos don't forget to include registerType: 'autoUpdate' in your pwa options, the new sw will be awaiting to confirm update (default is register type is prompt).
It seems SB has fixed the Open in new window link.
I'll check why mode is not working, maybe Astro build changing it, on local workbox messages are there:

https://felixroos.github.io/astro-test-pwa/ now deployed with autoUpdate + menu

@felixroos can you try building the branch and using file protocol to install it in your repo?

clone this repo (all branches)
checkout userquin/fix-allow-custom-manifest-transform  branch
pnpm install && pnpm build && pnpm pack
copy tgz file and paste in your repo (add it to git)
in your repo: pnpm remove -D @vite-pwa/astro && pnpm add -D ./vite-pwa-astro-0.1.3.tgz

done: https://felixroos.github.io/astro-test-pwa/ works!

@felixroos Now the dilemma in this repo with the PR, I'm afraid to put it as is, perhaps with a flag to activate it?

@felixroos Now the dilemma in this repo with the PR, I'm afraid to put it as is, perhaps with a flag to activate it?
EDIT: in any case, the owner can plug its own manifestTransform and do whatever (s)he wants

You mean because an opt-in flag won't break existing setups that rely on the old behavior?

You mean because an opt-in flag won't break existing setups that rely on the old behavior?

YES

I'm not sure as I have too little knowledge of this project to give my opinion on it. Of course, having less config options is always a plus, but maybe the old behavior is sometimes desired, not sure. From my perspective this looks more like a bug that should probably be fixed by default, but maybe it introduces some regression.
Maybe start with the feature flag and test it with a handful of existing projects to see if it has downsides?
Either way, I would be very happy to be able to use this as it will finally fix this annoying bug I was having for some time now.

You mean because an opt-in flag won't break existing setups that rely on the old behavior?

YES (I'll check it next week, maybe you can update the PR, I need to rest...)

I can see what I can do, please give yourself some rest. I can also wait or use the tgz

The problem, I don't use Astro, I switched to Nuxt 3... This repo should be in Astro repo, but the PR was closed a few times without any explanation and finally added here (íles integration for example in the repo not in Vite Org)

@felixroos I'll add it under experimental, like PWA VitePress Integration, check this PR: https://github.com/vite-pwa/vitepress/pull/23

@felixroos I'll add it under experimental, like PWA VitePress Integration, check this PR: vite-pwa/vitepress#23

thanks!

@felixroos can you run the same process with the branch in this PR in you GH repro and deploy to GH Pages?

clone this repo (all branches)
checkout userquin/feat-experimental-trailing-slashes-handler  branch
pnpm install && pnpm build && pnpm pack
in your repo: run pnpm remove -D @vite-pwa/astro then remove vite-pwa-astro-0.1.3.tgz file
copy new tgz file and paste it in your repo (add it again to git)
in your repo: pnpm add -D ./vite-pwa-astro-0.1.3.tgz
include in pwa options:

experimental: { directoryAndTrailingSlashHandler: true }

in your repo pnpm build && pnpm preview and check it is working
deploy to GH Pages

I'm preparing the docs, the experimental option added in VitePress cannot be added, Astro will clone the PWA options and cannot be referenced, it will require a change in vite-plugin-pwa.

If you cannot checkout the new branch, just clone the new branch directly

@felixroos released v0.1.4

@userquin thanks for the release! I am now using the new flag and it works :)

authors: felixroos preetamslot userquin

repo: vite-pwa/astro


text:
fix: use Node.js 18

Using Node.js 18 instead of Node.js 16 should fix VPS's CI.
Also potentially the Laravel CI since its TS error is also about Node.js (CC @timacdonald).
Currently failing eco CI: https://github.com/vitejs/vite/pull/11110#issuecomment-1330110858

This sounds good to me, feel free to merge @dominikg

are you sure this fixed it? afaik node18 is a bit slower than node16 and the executing runtime should not affect the ts types? or is your CI running exclusively in node18?
i changed the types/node override to only apply to vite-3 tests, https://github.com/vitejs/vite-ecosystem-ci/pull/155  but maybe it needs to be removed altogether instead?

Yes, in my case, that specific test is exclusively run with Node.js 18. This test uses res.writeEarlyHints() which was introduced in Node.js 18 so this PR should fix the problem (although I'm not sure whether #155 will interfere).

Thanks for the ping. I think the issue our package was hitting in the Vite CI pipeline was related to this fix: https://github.com/vitejs/vite-ecosystem-ci/pull/154
We had to update these types in our package locally because they started conflicting with a recent TS version.

authors: brillout dominikg patak-dev timacdonald

repo: vitejs/vite-ecosystem-ci


text:
how to config transform

// .swcrc
[
    {
      "test": ".tsx?$",
      "jsc": {
        "parser": {
          "syntax": "typescript",
          "tsx": true,
          "decorators": false,
          "dynamicImport": true
        },
        "transform": {
          "react": {
            "throwIfNamespace": false
          }
        }
      }
    },
]

this is no work

Yeah this is not configurable. What is missing for you?

It would be great to be able to configure "throwIfNamespace": false. As far as I can tell, React supports JSX namespaces at least as far back as v17.

Can you provide an example usage via stackblitz with the Babel version? I'm never encounter them.
If this is something, maybe you should ask to change the default in SWC

authors: ArnaudBarre eightHundreds nsaunders

repo: vitejs/vite-plugin-react-swc


text:
Vite 4's bundle will run out of memory in browser

Describe the bug
I tried to upgrade to Vite v4 today, and the production build will crash on our site's specific page in BROWSER (unlike #2433 which is crash in the Node.js process). Because it's a private repo, I have no idea how to share a minimal reproducible example. So I'm also asking for advice about what could provide to help solve this issue.
I tried upgrading only vite to v4 and upgrading the following packages:
vite 3.2.5 -> 4.0.0
@vitejs/plugin-vue 3.2.0 -> 4.0.0
@vitejs/plugin-vue-jsx 2.1.1 -> 3.0.0

And both will crash in Chrome and Firefox.
Reproduction
N/A
Steps to reproduce
No response
System Info
System:
    OS: macOS 13.0.1
    CPU: (8) arm64 Apple M2
    Memory: 4.25 GB / 24.00 GB
    Shell: 5.8.1 - /bin/zsh
  Binaries:
    Node: 16.18.1 - ~/.asdf/installs/nodejs/16.18.1/bin/node
    Yarn: 3.3.0 - ~/.asdf/installs/nodejs/16.18.1/bin/yarn
    npm: 9.2.0 - ~/.asdf/plugins/nodejs/shims/npm
  Browsers:
    Chrome: 108.0.5359.98
    Firefox: 103.0.2
    Firefox Developer Edition: 108.0
    Safari: 16.1
  npmPackages:
    @vitejs/plugin-vue: 3.2.0 => 3.2.0
    @vitejs/plugin-vue-jsx: 2.1.1 => 2.1.1
    vite: 4.0.0 => 4.0.0

Used Package Manager
yarn
Logs
No response
Validations

[X] Follow our Code of Conduct
[X] Read the Contributing Guidelines.
[X] Read the docs.
[X] Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
[X] Make sure this is a Vite issue and not a framework-specific issue. For example, if it's a Vue SFC related bug, it should likely be reported to vuejs/core instead.
[X] Check that this is a concrete bug. For Q&A open a GitHub Discussion or join our Discord Chat Server.
[X] The provided reproduction is a minimal reproducible example of the bug.

We cannot help without a reproduction.
Maybe it's same with #11330?

Thanks a lot. I tried it with vite 4.0.1 + rollup 3.7.4 and the issue disappear

authors: DanSnow sapphi-red

repo: vitejs/vite


text:
UTF-8 with BOM files cause vite to fail rewrite import

Describe the bug
When the user import a javascript file that is encoded in utf-8 with byte order mark (BOM) the vite fails to rewrite the file and sends the original file. So the developer get erros like:
`Uncaught TypeError: Failed to resolve module specifier "vue". Relative references must start with either "/", "./", or "../".`

If you simple change encoding file back to UTF8 (without BOM) everything works fine.
Reproduction

$ npm init vite-app mytest
inside mytest folder: $ npm run dev
here the app should run fine, now change a file encoding (like src/main.js) to UTF8-8 with BOM (note: I used visual studio code command: Ctrl+Shift+P > Change File Encoding > Save with encoding > UTF-8 With BOM)
reload page and a error appears in console:

Uncaught TypeError: Failed to resolve module specifier "vue". Relative references must start with either "/", "./", or "../".
System Info

required vite version: v1.0.0-rc.4
required Operating System: Windows 10 x64 version 2004
required Node version: v12.4.0
Optional:

npm/yarn version: 6.9.0
Installed vue version (from yarn.lock or package-lock.json): ^3.0.0-rc.10
Installed @vue/compiler-sfc version: ^3.0.0-rc.10

Logs (Optional if provided reproduction)
vite build --debug output looks fine:
vite v1.0.0-rc.4
vite:config env mode: production +0ms
vite:config env: {} +3ms
Building for production...
vite:build:resolve /src/main.js --> C:\Users\leo\Desktop\utf8-test\src\main.js +0ms
vite:build:asset C:\Users\leo\Desktop\utf8-test\src\assets\logo.png -> /_assets/logo.a5e9d5e0.png +0ms
[write] dist_assets\index.07fdad2b.js 37.16kb, brotli: 13.75kb
[write] dist_assets\style.9e6be708.css 0.16kb, brotli: 0.10kb
[write] dist_assets\logo.a5e9d5e0.png 6.69kb
[write] dist\index.html 0.38kb, brotli: 0.15kb
Build completed in 2.96s.
The issue appears to affect only dev environment

Quoting what @Aaron-Pool said in #814 :

@antfu @underfin
Just an FYI, this issue has reemerged in the vite 2.0 importAnalysis plugin. Apparently es-module-lexer doesn't strip the character either, so if the line begins with a Bom character, the line linked below won't return the first import
https://github.com/vitejs/vite/blob/4396057abd69bf55dfc8976f6feaddf6042031a5/packages/vite/src/node/plugins/importAnalysis.ts#L112

authors: julesrx lbosquett


text:
fix: update modulePreload polyfill, dedupe same href fetch

Description
Apply https://github.com/guybedford/es-module-shims/pull/164. I simplified the cache to use a boolean instead of keeping the promise. I think it is better to avoid that.
We thought with @benmccann that this be related to https://github.com/vitejs/vite/issues/5532, but I tested it and the double request is there. The polyfill is simple in that regard, it is doing a direct fetch, and then the import will ask for the resource again. I was always assuming that the browser is able to work in this scenario as @sapphi-red commented on the issue.
I think we could merge this one just to be closer to the current state of es-module-shims.
This may also be related:

https://github.com/guybedford/es-module-shims/issues/354

But it is strange because we had the same behavior for the past two years. If we can't find a way around this, we should look into disabling modulepreload when it isn't supported instead of polyfilling it in the next minor or major version.

What is the purpose of this pull request?

[x] Bug fix
[ ] New Feature
[ ] Documentation update
[ ] Other

I've been playing around with this stuff a fair bit over the last few days, and I've come to believe that modulepreload simply can't be polyfilled. It seems plausible that browsers have changed their behaviour since the polyfill was written, such that fetch and import/modulepreload just put things in different buckets. I would love to be proven wrong!
There is hope though: @jridgewell taught me this week that in Chrome, this...
<link rel="preload" as="script" crossorigin="anonymous" href="./something.mjs">

...works equivalently to modulepreload in Chrome (i.e. no double requests, the code is parsed as a module not a script, and import chains are followed) while also working in Safari (albeit without following import chains, which shouldn't matter here since the graph is flattened). Firefox requests files twice, unfortunately, but 🤷.
There is a catch though: the href must have a .mjs extension, not .js. This is what tells Chrome to treat it the same as a modulepreload.

We can't apply https://github.com/guybedford/es-module-shims/pull/164 without using the whole polyfill. This fix doesn't seem related to https://github.com/vitejs/vite/issues/5532 at the end, as @sapphi-red and
https://github.com/guybedford/es-module-shims/issues/354#issuecomment-1444825190 explains, the request would show duplicated in Firefox but the second one should be a cache hit (only in prod?).
I'm going to close this PR. Right now, I'm not sure we should change the modulepreload default strategy. Each project can avoid the polyfill using modulePreload.polyfill: false. If someone else thinks we should move forward with changing this default in 4.2 let us know, we could review it again in 5.0 if not.

Just FYI, the way we ended up handling this in SvelteKit was to create a preloadStrategy config with three options: https://kit.svelte.dev/docs/configuration#output

authors: Rich-Harris benmccann patak-dev


text:
fix: default host to localhost instead of 127.0.0.1

BREAKING CHANGE: default host is now localhost.
Description
This PR changes default host to localhost.
Related discussions: https://github.com/vitejs/vite/issues/5241#issuecomment-950274569, https://github.com/vitejs/vite/issues/7075#issuecomment-1051021761
I confirmed #5241 will be fixed by this PR. (Node v16.15.1 + Windows)
fixes #5241
fixes #6519
fixes #7016
fixes #7075
close #6523
refs #7271
refs #7274
Why does this solve them?
https://github.com/vitejs/vite/issues/5241#issuecomment-950272281
before
Vite: 127.0.0.1:3000
Other server: [::]:3000
Log output: localhost:3000 => [::1]:3000 Mismatch
after
Vite: localhost:3000 => [::1]:3000
Other server: [::]:3000
Log output: localhost:3000 => [::1]:3000
Additional context

What is the purpose of this pull request?

[x] Bug fix
[ ] New Feature
[ ] Documentation update
[ ] Other

Before submitting the PR, please make sure you do the following

[x] Read the Contributing Guidelines.
[x] Read the Pull Request Guidelines and follow the Commit Convention.
[x] Check that there isn't already a PR that solves the problem the same way to avoid creating a duplicate.
[x] Provide a description in this PR that addresses what the PR is solving, or reference the issue that it solves (e.g. fixes #123).
[x] Ideally, include relevant tests that fail without this PR but pass with it.

If anyone comes across this issue, like me ^^, it's due to my node version.
I switch between node16 and node18 due to some dependencies.
And when you use vite in :

node16 you get http://127.0.0.1:5137
node18 you get https://localhost:5137

So to be sure, check our node version :)


text:
Performance issue when throwing errors that have stackTraceLimit = 0

Describe the bug
When setting Error.stackTraceLimit = 0 in a custom error and throwing it inside a test, the time it takes for vitest to display the error is proportional to the size of the object passed (size of the message string).
In the example below, you can change the value of object size and see in the console that it takes more and more time to return. You can also comment the line Error.stackTraceLimit = 0 to see that the problem disappears.
On my machine, vitest just hangs after a certain size and I have to kill the process manually.
Note that I am using an external library that throws errors with a stackTraceLimit of 0, so I do not control this on my end.
Reproduction
https://stackblitz.com/edit/vitest-dev-vitest-edo7vt?file=test%2Fbasic.test.ts
System Info
from stackblitz:
System:
    OS: Linux 5.0 undefined
    CPU: (8) x64 Intel(R) Core(TM) i9-9880H CPU @ 2.30GHz
    Memory: 0 Bytes / 0 Bytes
    Shell: 1.0 - /bin/jsh
  Binaries:
    Node: 18.20.3 - /usr/local/bin/node
    Yarn: 1.22.19 - /usr/local/bin/yarn
    npm: 10.2.3 - /usr/local/bin/npm
    pnpm: 8.15.6 - /usr/local/bin/pnpm
  npmPackages:
    @vitest/ui: latest => 1.6.0
    vite: latest => 5.3.3
    vitest: latest => 1.6.0

Used Package Manager
npm
Validations

[X] Follow our Code of Conduct
[X] Read the Contributing Guidelines.
[X] Read the docs.
[X] Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
[X] Check that this is a concrete bug. For Q&A open a GitHub Discussion or join our Discord Chat Server.
[X] The provided reproduction is a minimal reproducible example of the bug.

regexr.com/82i8b
https://github.com/vitest-dev/vitest/blob/354fb9d994cdd7c52d34f21964b69756f2faecdf/packages/utils/src/source-map.ts#L90-L91

@AriPerkkio @userquin - how can we move forward with PR #6123?
I really appreciate your efforts trying to fix the problem 🙏 🙏

authors: AriPerkkio jrmdayn

repo: vitest-dev/vitest


text:
when w2grid is shown rows with status "selected" change to unselected

w2ui vs 2.0

Project w2ui with w2layout,
several w2grid in memory, not shown in GUI at once.
I change a w2grid by another in the same panel.
There are records with "selected" status in w2grid before being shown but when w2grid is shown they change the status to unselected.
debugging w2ui library... I think that I have detected the possible issue:
when I change a w2grid by other the event "render" is called and inside this function a "reset(true)" method is called removing the former selection in the w2grid.
I have commented the line and all seems to work now, but I dont know if this is the best solution.

I removed clear selection from reset method. I added it to clear method.

authors: ralonsoreyes vitmalina


text:
Minimum Instance Autoscaling

In worker node pools, I have one set of autoscaling pods. I must have 4 nodes at the start and then auto scale further. But it is not working.
- name: autoscaling-node
  instance_type: ccx22
  instance_count: 4
  location: hel1
  autoscaling:
    enabled: true
    min_instances: 4
    max_instances: 25

But the auto scaler has deployed only one node.

Are you still having problems with this? Are you sure you haven't gone above the limit of the servers you can create with your account? You need to request a limit increase in that case.

pod anti-affinity rules might be helpful to you @rsidhaarth
https://kubernetes.io/docs/concepts/scheduling-eviction/assign-pod-node/#inter-pod-affinity-and-anti-affinity

Yes, you can try to create a cluster with the above specs and try. It will deploy only 1, and then it will add one by one only when the pods need one.
This needs to be fixed because, if there is only one instance then all the pods get deployed in one instance only.

My question was about the Hetzner server limit. Each account has a limit to the number of servers it can creare before you need to request a limit increase. Are you sure you haven't reached this limit? This could explain why more nodes are not created. Also check the autoscaler logs to see if there is useful information there.

Did you check the autoscaler logs as I suggested?

I just tested with the latest version of the autoscaler and I can confirm that the min instances count seems to be ignored. The autoscaler only creates nodes when pods are pending. Not much I can do for now but I will leave this open as a reminder to check again with the next version. I will try to open an issue about it.

For information, the same issue arised to me with hetzner-k3s v1.1.2, when I tried configuring autoscaling ~1-2 days ago.

Indeed the autoscaler is showing strange behavior.
Deployed a cluster with the cluster config below using hetzner-k3s 1.1.3. I would have expected that three master nodes, one static worker node and 0 dynamic worker nodes would be deployed initially. But as soon as the cluster autoscaler is deployed by hetzner-k3s, a dynamic node in the dynamic node pool is provisioned.
Cluster Autoscaler log:
I0630 08:53:14.818685       1 leaderelection.go:248] attempting to acquire leader lease kube-system/cluster-autoscaler...
I0630 08:53:14.919295       1 leaderelection.go:258] successfully acquired lease kube-system/cluster-autoscaler
W0630 08:53:16.932098       1 hetzner_servers_cache.go:94] Fetching servers from Hetzner API
I0630 08:53:17.118858       1 node_instances_cache.go:156] Start refreshing cloud provider node instances cache
I0630 08:53:17.119290       1 node_instances_cache.go:168] Refresh cloud provider node instances cache finished, refresh took 52.121µs
I0630 08:53:27.119379       1 hetzner_node_group.go:438] Set node group draining-node-pool size from 0 to 0, expected delta 0
I0630 08:53:27.119459       1 hetzner_node_group.go:438] Set node group dynamic-small size from 0 to 0, expected delta 0
W0630 08:53:27.119952       1 hetzner_server_type_cache.go:93] Fetching server types from Hetzner API
W0630 08:53:27.194532       1 clusterstate.go:428] AcceptableRanges have not been populated yet. Skip checking
W0630 08:53:27.194575       1 clusterstate.go:428] AcceptableRanges have not been populated yet. Skip checking
I0630 08:53:27.195973       1 scale_up.go:608] Scale-up: setting group dynamic-small size to 1
W0630 08:53:34.749221       1 hetzner_servers_cache.go:94] Fetching servers from Hetzner API
I0630 08:53:45.021089       1 hetzner_node_group.go:438] Set node group draining-node-pool size from 0 to 0, expected delta 0
I0630 08:53:45.021175       1 hetzner_node_group.go:438] Set node group dynamic-small size from 1 to 1, expected delta 0
I0630 08:53:55.045205       1 hetzner_node_group.go:438] Set node group draining-node-pool size from 0 to 0, expected delta 0
I0630 08:53:55.045311       1 hetzner_node_group.go:438] Set node group dynamic-small size from 1 to 1, expected delta 0
I0630 08:54:05.074732       1 hetzner_node_group.go:438] Set node group draining-node-pool size from 0 to 0, expected delta 0
I0630 08:54:05.074813       1 hetzner_node_group.go:438] Set node group dynamic-small size from 1 to 1, expected delta 0
I0630 08:54:15.092047       1 hetzner_node_group.go:438] Set node group dynamic-small size from 1 to 1, expected delta 0
I0630 08:54:15.092419       1 hetzner_node_group.go:438] Set node group draining-node-pool size from 0 to 0, expected delta 0
I0630 08:54:25.124240       1 hetzner_node_group.go:438] Set node group draining-node-pool size from 0 to 0, expected delta 0
I0630 08:54:25.124387       1 hetzner_node_group.go:438] Set node group dynamic-small size from 1 to 1, expected delta 0

Cluster Config:
hetzner_token: *redacted*
cluster_name: *redacted*
kubeconfig_path: "./kubeconfig"
k3s_version: v1.26.4+k3s1
public_ssh_key_path: "~/.ssh/id_rsa.pub"
private_ssh_key_path: "~/.ssh/id_rsa"
use_ssh_agent: false
ssh_allowed_networks:
  - 0.0.0.0/0
api_allowed_networks:
  - 0.0.0.0/0
schedule_workloads_on_masters: false
private_network_subnet: 10.9.0.0/16
disable_flannel: false # set to true if you want to install a different CNI
cloud_controller_manager_manifest_url: "https://github.com/hetznercloud/hcloud-cloud-controller-manager/releases/download/v1.16.0/ccm-networks.yaml"
csi_driver_manifest_url: "https://raw.githubusercontent.com/hetznercloud/csi-driver/v2.3.2/deploy/kubernetes/hcloud-csi.yml"
system_upgrade_controller_manifest_url: "https://raw.githubusercontent.com/rancher/system-upgrade-controller/master/manifests/system-upgrade-controller.yaml"
masters_pool:
  instance_type: cx21
  instance_count: 3
  location: fsn1
worker_node_pools:
- name: static
  instance_type: cx31
  instance_count: 1
  location: fsn1
- name: dynamic-small
  instance_type: cx31
  instance_count: 0
  location: fsn1
  autoscaling:
    enabled: true
    min_instances: 0
    max_instances: 5
additional_packages:
- wireguard
post_create_commands:
- apt update
- apt upgrade -y
- apt autoremove -y

@sebastianklein96 What did you deploy in the cluster and with which resource requests? If the autoscaler has created a node it's likely because there were one or more pods that could not be scheduled for lack of resources.

That is what's confusing me. This happens with a completely fresh cluster, during deployment using hetzner-k3s. I am not deploying any workloads at all. The dynamic worker is created immediately after deployment of the cluster autoscaler. So in theory there should not be a lack of resources. This also happens when deploying more than one static worker.

Weird, it has never happened to me. Perhaps something has changed with the latest version of the autoscaler. I will give it a try as soon as I have some time.

I can confirm that the behaviour of the autoscaler has changed lately. I've got 2 clusters, one deployed 3 months ago on v1.25.3 and another one deployed just yesterday on v 1.26.4. In my previous cluster the autoscaler is only getting triggered when pods cannot be scheduled, without respecting my will about desired minInstances. On my latest cluster, on the other hand, the autoscaler is deploying my desired amount of "minIstances"

I can confirm that the behaviour of the autoscaler has changed lately. I've got 2 clusters, one deployed 3 months ago on v1.25.3 and another one deployed just yesterday on v 1.26.4. In my previous cluster the autoscaler is only getting triggered when pods cannot be scheduled, without respecting my will about desired minInstances. On my latest cluster, on the other hand, the autoscaler is deploying my desired amount of "minIstances"

Thanks, that sounds promising. I will do some testing once I have some time.

I released v1.1.4 and tested with autoscaler 1.27.something and still ignores the minimum instance count. :(

I just found out that this behaviour is expected so I am closing this issue since I can't do anything about it.
https://github.com/kubernetes/autoscaler/blob/master/cluster-autoscaler/FAQ.md#my-cluster-is-below-minimum--above-maximum-number-of-nodes-but-ca-did-not-fix-that-why

If your cluster is below the minimum number of nodes configured for CA, it will be scaled up only in presence of unschedulable pods.

authors: clouedoc kim0 manfredipist rsidhaarth sebastianklein96 vitobotta


text:
About track_comments views, there's a small bug make comment count incorrect.

In template partial_feed_comments.html when feed has no comment, it will return one hint:

{% trans 'Be the first one to comment' %}

static/js/feeds.js line 264 will treat this hint as one comment and update comment count to 1, that's not correct.
264    $(".comment-count", post_container).text($("ol li", container).length);

so how about remove that hint or write it in partial_feed.html below the

 , then update views.trakc_coments and  use jQuery controll it's visibility.

Hi @rthel I haven't been able to replicate the behavior. Until now, the results are consistent with the expected. Can you provide more information?

bug replicate
hello, look at this, I make a jpeg, please click the link and it may help me to explain the issue.

It was hard to spot the bug @rthel and now I see what you're talking about. Can you provide a fix for it in a new PR?

@sebastian-code Yes, I'd love to : )

Solved with #115

authors: rthel sebastian-code

repo: vitorfs/bootcamp


text:
build_runner 2 not compatible with floor_generator

With the new update of build_runner 2.0.0 with null safety floor_generator is not compatible.
 Because build_runner >=2.0.0 depends on code_builder ^4.0.0 and floor_generator 1.0.1 depends on code_builder ^3.7.0, build_runner >=2.0.0 is incompatible with floor_generator 1.0.1.
How to do ? Do you prepare a new version ?

With your advice i have trying this, but not work
dependency_overrides:   code_builder: ^4.0.0

@demos77
You also need to override this:
build_config: '>=1.0.0 <1.1.0'

ok it's work for the moment, the time you upgrade :)

When do you make a new version / tag ?

repo: vitusortner/floor


text:
[Q] DTOs and Onion Architecture

Hi,
I just saw your course, great job.
As you mentioned in The Read Model and the Onion Architecture, the DTOs belongs to outer later of Onion Architecture, the UI layer, but Microsoft believes DTOs belongs to core layer. so which one is correct and why?
Thank you!

Don't know why they included it into the application core, could be a mistake, but DTOs should definitely not belong to that layer. The core layer is for the core domain logic. DTOs come from external applications and must be translated into domain objects by app services.

Steve Smith, another Pluralsight teacher, also included DTOs into the core layer.

DTOs come from external applications

What do you mean by "external applications"?

I recommend module "Decoupling the Domain Model from Data Contracts" of my other course "Refactoring from Anemic Domain Model Towards a Rich One" for the reasons why you need to separate DTOs from the domain layer.

Okay, thank you for your time, I'll try to watch that.

authors: dehghani-mehdi vkhorikov

repo: vkhorikov/CqrsInPractice


text:
Error when redirect after allow

Hello) Can you help me, i try to use your library for sing in with VK. But after click button allow on VK, i get error "Exception while handling OAuth2 callback (null). Redirecting to vkontakte connection status page" if i run my app on ubuntu, or error "java.lang.ClassNotFoundException: org.codehaus.jackson.map.Module". For sing in in my config i use ConnectController. What can I do wrong?

What was the problem?

authors: ElizavetaNevostrueva vkolodrevskiy

repo: vkolodrevskiy/spring-social-vkontakte


text:
Add setup.cfg templating over setup.py

See discussion on https://github.com/vkottler/vmklib/issues/7.

This is probably the next thing to do, because some tree re-balancing to un-block #19 is probably next up

https://setuptools.pypa.io/en/latest/userguide/declarative_config.html
not clear if the setup.cfg way of doing it is better?

packaging docs definitely say to use setup.cfg: https://packaging.python.org/en/latest/tutorials/packaging-projects/#configuring-metadata

Since we have a lot of baked in assumptions about this in the current Python configs, we should take a fresh approach and maybe re-organize the configuration data (maybe even do https://github.com/vkottler/datazen/issues/58, too)

pyproject.toml schema: https://peps.python.org/pep-0621/#specification (minimal JSON schema? https://github.com/vkottler/datazen/issues/58#issuecomment-1079621249)
setup.cfg schema (I think?): https://setuptools.pypa.io/en/latest/userguide/declarative_config.html
Unclear which if these could be datazen "compile" outputs, or if they should be templatized

Getting this warning during build:
/tmp/build-env-g_1tp__1/lib/python3.8/site-packages/setuptools/config/pyprojecttoml.py:103: _ExperimentalProjectMetadata: Support for project metadata in `pyproject.toml` is still experimental and may be removed (or change) in future releases.
  warnings.warn(msg, _ExperimentalProjectMetadata)
Install ``trove-classifiers`` to ensure proper validation. Meanwhile a list of classifiers will be downloaded from PyPI.
/tmp/build-env-g_1tp__1/lib/python3.8/site-packages/setuptools/config/_apply_pyprojecttoml.py:93: _WouldIgnoreField: !!

    ##########################################################################
    # configuration would be ignored/result in error due to `pyproject.toml` #
    ##########################################################################

    The following seems to be defined outside of `pyproject.toml`:

    `entry-points = {'console_scripts': ['mk=vmklib.entry:main']}`

    According to the spec (see the link bellow), however, setuptools CANNOT
    consider this value unless 'entry-points' is listed as `dynamic`.

    https://packaging.python.org/en/latest/specifications/declaring-project-metadata/

    For the time being, `setuptools` will still consider the given value (as a
    **transitional** measure), but please note that future releases of setuptools will
    follow strictly the standard.

    To prevent this warning, you can list 'entry-points' under `dynamic` or alternatively
    remove the `[project]` table from your file and rely entirely on other means of
    configuration.

!!

  warnings.warn(msg, _WouldIgnoreField)

Per this comment, we could try to generate the project toml, but honestly it might not be worth it

So far trying to write a setup.cfg is kind of a disaster. We should just wait for setuptools to actually read metadata from pyproject.toml. Right now it doesn't read everything

Okay, so setuptools is a complete shit show. Relying on setup code for now is fine, we invested a decent amount into just making it not suck. There's no great reason to go back on it. We should just work on https://github.com/vkottler/vmklib/issues/22

repo: vkottler/vmklib


text:
Fix Envers compatibility with ImmutableType

Envers expects (simple) audited types to implement the BasicType interface. This commit changes The ImmutableType to implement BasicType rather than Type.
The first commit is work in progress: It only applies the change to  hibernate-types-55 as a template. If the change is OK, it will be applied to other hibernate-types-* as well.
Resolves: #463

Thanks. I'll review it when I have some time

Applied upstream, thanks

authors: msdousti vladmihalcea

repo: vladmihalcea/hibernate-types


text:
Semantic Installation not triggered

Quoting Readme.md:

Installation
npm install ng-semantic --save
Semantic UI installation will be triggered. Semantic UI must be installed in public folder ( dist folder must be public )

When installing through npm, the Semantic-Ui installation is not triggered
Is that expected now?
Using Windows 10, NodeJs 5.2.0, NPM 3.3.12

No, it is not. I want to decouple semantic from this package.
I will update package and readme files.

I removed SUI from devDependencies.
You must download it separately and include it in your entry file ( index.html )

authors: OClement vladotesanovic

repo: vladotesanovic/ngSemantic


text:
Feature/enable centralize dialog text - [merged]

In GitLab by @DaniloRaposo on Jul 7, 2023, 18:50
Merges feature/enable-centralize-dialog-text -> develop
Gitlab MR Web Template
Descrição
Adição de feature que permite tanto deixar o estilo do conteudo do dialog centralizado, quanto permite adicionar esse estilo pelo shorthand
Tempo de desenvolvimento
1 hora
Tipo de mudança

[ ] Bug fix (Correção de um problema que não quebrava algo grande)
[X] New feature (Mudança que adiciona novas funcionalidades)
[ ] Breaking change (correção ou recurso que faria com que a funcionalidade existente não
funcionasse como esperado)
[ ] Refactor (Alteração que melhora algo que já existente)

Em quais navegadores foi testado?

[X] Google Chrome
[X] Mozilla Firefox
[ ] IE 11 (Windows 10)
[ ] Edge
[ ] Opera
[ ] Opera GX
[ ] IOS Safari
[ ] IOS Chrome
[ ] Android Chrome
[ ] Android Firefox

Testei as seguintes resoluções no navegador:

[ ] 2520 x 1080
[X] 1920 x 1080
[ ] 1400 x 790
[ ] 1280 x 720
[ ] 1024 x 1366 (iPad Pro vertical)
[ ] 1366 x 1024 (iPad Pro horizontal)
[ ] 768 x 1024 (iPad vertical)
[X] 1024 x 768 (iPad horizontal)
[X] 375 x 812 (iPhone X)
[X] 320 x 568 (iPhone 5/SE)

Checklist:
Qualidade

[X] Segui os padrões de criação da stack em svelte
[X] Eu revisei ou reli o meu próprio código
[X] Segui o formato de criação e nomenclatura de variáveis CSS

Documentação

[X] Documentei onde era mais necessário e difícil de entender no meu código
[X] Documentei as variáveis CSS que meu componente externaliza
[X] Criei bons exemplos no storybook para meu componente

Teste

[ ] As mudanças que esta MR implementa possui testes automatizados
[X] Executei e garanto que os testes automatizados já criados estão todos passando
[X] Executei e garanto que não há erros de lint
[X] Executei e garanto que não há erros de typescript

MR

[X] Eu conferi a checklist de atividades, e expliquei no meu merge request caso algo não tenha
sido necessário ou possível

In GitLab by @DaniloRaposo on Jul 7, 2023, 19:03
added 1 commit
1197cc41 - Change log (refactor): add change log
Compare with previous version

In GitLab by @DaniloRaposo on Aug 1, 2023, 12:43
added 6 commits
1197cc41...75968e0a - 5 commits from branch develop6ffce464 - Merge branch 'develop' into feature/enable-centralize-dialog-text
Compare with previous version

In GitLab by @victorandre957 on Aug 1, 2023, 17:46
approved this merge request

In GitLab by @DaniloRaposo on Aug 3, 2023, 11:17
mentioned in commit 0e45c365e3379805216172f478e5999cff0a8647

repo: vlgi/ui


text:
Add past participations

Add past participations to the _data/participations.yml
have this years events on the main page
and link to separate page that lists all the events with a bit more explanation

Extra publications:
https://www.frontiersin.org/articles/10.3389/fmars.2020.572680/full
https://zenodo.org/record/5093125#.YozKkKhBxnI
Extra events:
conference presentation https://biss.pensoft.net/article/58938/;
EOSC Life FAIR Hackathon: hmm, does not really have an EOSC Life link, so will wait until that happens
Our FAIR course! Once Shanna has made it public

is this still relevant for the new theme ?

authors: cedricdcc kmexter marc-portier