问:
RecyclerView peek behaviour
I'm using a horizontal RecyclerView with PagerSnapHelper to make it look like a ViewPager. It's displaying child views.

How can I make it show a small peek of the next entry? The user needs to see close to 20% of the next entry to understand intuitively that they need to swipe horizontally. The earlier entry needs to align back.

There could be other indications of dots at the bottom but this is the expected behaviour. The child view occupies the entire recycler view, so adjusting the width of the child so as to make other siblings come onto the screen isn't an option.

Right now I'm using a RecyclerView that is set up with a PagerSnapHelper.

I'm able to scroll to 20% of the next entry by using this:

```<code>val nextPosition = (currentPosition + 1) % numOfEntries
val xscrollDistance = carouselRecyclerView.width * 0.80
linearLayoutManager.scrollToPositionWithOffset(nextPosition, xscrollDistance.toInt())
</code>```

With this, I see the next entry come onto the screen like a peek but here's what I'm unhappy with:

This scroll isn't smooth, I'm looking for a smooth scroll to the 20% peek of the next entry

Snap doesn't work. I was hoping when I do step 1., the snap behaviour will kick in and align the earlier entry onto the screen. It doesn't happen that way.

The peeking behaviour also needs to be cyclic. Last entry's peek should be the 0th entry.

I'm also looking for a less complex solution if any.

I checked an older solution - How to peek RecyclerView + PagerSnapHelper but I'm hoping to find a cleaner solution instead.

Title: RecyclerView peek behaviour

Body:
I'm using a horizontal RecyclerView with PagerSnapHelper to make it look like a ViewPager. It's displaying child views.

How can I make it show a small peek of the next entry? The user needs to see close to 20% of the next entry to understand intuitively that they need to swipe horizontally. The earlier entry needs to align back.

There could be other indications of dots at the bottom but this is the expected behaviour. The child view occupies the entire recycler view, so adjusting the width of the child so as to make other siblings come onto the screen isn't an option.

Right now I'm using a RecyclerView that is set up with a PagerSnapHelper.

I'm able to scroll to 20% of the next entry by using this:

val nextPosition = (currentPosition + 1) % numOfEntries
val xscrollDistance = carouselRecyclerView.width * 0.80
linearLayoutManager.scrollToPositionWithOffset(nextPosition, xscrollDistance.toInt())

With this, I see the next entry come onto the screen like a peek but here's what I'm unhappy with:

This scroll isn't smooth, I'm looking for a smooth scroll to the 20% peek of the next entry

Snap doesn't work. I was hoping when I do step 1., the snap behaviour will kick in and align the earlier entry onto the screen. It doesn't happen that way.

The peeking behaviour also needs to be cyclic. Last entry's peek should be the 0th entry.

I'm also looking for a less complex solution if any.

I checked an older solution - How to peek RecyclerView + PagerSnapHelper but I'm hoping to find a cleaner solution instead.


来源: stackexchange

问:
How to get clickable links to errors and code lines in CLion terminal (like VS code)
Is it possible to to get clickable links to errors and code lines in the CLion terminal? I want to get the same output as the "Build Output", but in the terminal so I can use other commands.

Build output:

Console output:

VS code for reference: (using ctrl + click to go to the line of code)

Note: Using Powershell

ContentLicense: CC BY-SA 4.0


问:
Intercept all nginx requests to serve series of static content?
Question: Is there a way to 'intercept' more specific locations? Before many locations (e.g., location /activity, location = /search, location ~ "^/content/([a-f\d]{24})/$", etc.), I would like to do potentially serve html and then handle the original request.

Background: An nginx.conf I'm working with serves up a series of html pages (e.g., international agreement page, location page, supplier welcome page, etc.) following user SSO login and the user attempting to access a URL of our product.

The current nginx configuration works by adding a try_files $uri /<location that could serve .html page>?redirecturi=$redirecturi; to many location blocks. This is cumbersome because numerous locations point to the same location (e.g., /landing as seen below); it would be more maintainable to have a single location as an entry point to this 'flow' of html pages.

Example location block that refers to a location (e.g., /landing) that can server html

```<code>location /workitem {
    ...
    auth_request /auth;
    ...
    recursive_error_pages on;
    try_files $uri /landing?redirecturi=$redirecturi;
}
</code>```

Example location that can serve html

```<code>location = /landing {
    internal;
    ...
    proxy_method GET;
    proxy_pass <scheme>://<host>/api/internationalAgreement?redirecturi=$redirecturi;
    recursive_error_pages on;
    error_page 378 =200 /internationalAgreement.html;
    error_page 395 =200 /supplier?redirecturi=$redirecturi;
}
</code>```

On the backend, we expose APIs to that update the user's session when they've seen a page:

```<code>router.get('/internationalAgreement',
 (req, res) => {
    const redirectUri = req.query.redirecturi;
    if (!redirectUri) {
      return res.status(403).end();
    }

    // International Agreement not posted yet
    if (req.session.showContentLandingPage === 'true') {
      return res.status(378).end();
    }
    ...
  });
</code>```

Pending response code, the location block either serves the .html page or routes to a different block that might serve html (e.g., /supplier as referenced above in /landing). When the user clicks 'Next' on the html page, an HTTP request is made, the backend updates the user's session with the page they saw, then the request if 'forwarded' to another block that could serve html.

Example location arrived when user clicks next

```<code>location = /api/ge/itc {
    limit_except POST { deny all; }
    ...
    proxy_pass <scheme>://<host>/api/internationalAgreement?redirecturi=$arg_ouri;
    recursive_error_pages on;
    error_page 379 =200 /userLocation?redirecturi=$upstream_http_x_mbe_redirect;
}
</code>```

Eventually, these locations just pass through requests after the users has stepped through the required pages.

I've tried searching for examples of locations that match all locations but generally can only find the '/' would match as a catch all and not intercept more specific locations.

Body:
Question: Is there a way to 'intercept' more specific locations? Before many locations (e.g., location /activity, location = /search, location ~ "^/content/([a-f\d]{24})/$", etc.), I would like to do potentially serve html and then handle the original request.

Background: An nginx.conf I'm working with serves up a series of html pages (e.g., international agreement page, location page, supplier welcome page, etc.) following user SSO login and the user attempting to access a URL of our product.

The current nginx configuration works by adding a try_files $uri /<location that could serve .html page>?redirecturi=$redirecturi; to many location blocks. This is cumbersome because numerous locations point to the same location (e.g., /landing as seen below); it would be more maintainable to have a single location as an entry point to this 'flow' of html pages.

Example location block that refers to a location (e.g., /landing) that can server html

location /workitem {
    ...
    auth_request /auth;
    ...
    recursive_error_pages on;
    try_files $uri /landing?redirecturi=$redirecturi;
}

Example location that can serve html

location = /landing {
    internal;
    ...
    proxy_method GET;
    proxy_pass <scheme>://<host>/api/internationalAgreement?redirecturi=$redirecturi;
    recursive_error_pages on;
    error_page 378 =200 /internationalAgreement.html;
    error_page 395 =200 /supplier?redirecturi=$redirecturi;
}

On the backend, we expose APIs to that update the user's session when they've seen a page:

router.get('/internationalAgreement',
 (req, res) => {
    const redirectUri = req.query.redirecturi;
    if (!redirectUri) {
      return res.status(403).end();
    }

    // International Agreement not posted yet
    if (req.session.showContentLandingPage === 'true') {
      return res.status(378).end();
    }
    ...
  });

Pending response code, the location block either serves the .html page or routes to a different block that might serve html (e.g., /supplier as referenced above in /landing). When the user clicks 'Next' on the html page, an HTTP request is made, the backend updates the user's session with the page they saw, then the request if 'forwarded' to another block that could serve html.

Example location arrived when user clicks next

location = /api/ge/itc {
    limit_except POST { deny all; }
    ...
    proxy_pass <scheme>://<host>/api/internationalAgreement?redirecturi=$arg_ouri;
    recursive_error_pages on;
    error_page 379 =200 /userLocation?redirecturi=$upstream_http_x_mbe_redirect;
}

Eventually, these locations just pass through requests after the users has stepped through the required pages.

I've tried searching for examples of locations that match all locations but generally can only find the '/' would match as a catch all and not intercept more specific locations.


问:
Using withCheckedContinuation vs a task
I have the following function:

func saveCredential(_ credential: String, service: String, account: String) async throws {
  let query = [
    kSecValueData: credential.data(using: .utf8)!,
    kSecClass: kSecClassGenericPassword,
    kSecUseDataProtectionKeychain: true,
    kSecAttrSynchronizable: true,
    kSecAttrService: service,
    kSecAttrAccount: account,
  ] as CFDictionary

  let status = (Task {
    // Add data in query to keychain
    return SecItemAdd(query, nil)
  }).value

  switch status {
  case errSecSuccess:
    return;
  case errSecDuplicateItem:
    try updateCredential(credential, service: service, account: account)
  default:
    try throwStatus(status)
  }
}
```
<p>While discussing whether this is the idiomatic way to do this code, someone in a discord server said that it would be cleaner to write this as:</p>
<pre class="lang-swift prettyprint-override"><code>func addKeychainItem(attributes attrs: CFDictionary) async -> (OSStatus, CFTypeRef?) {
  return await withUnsafeContinuation { continuation in
    var item: CFTypeRef?
    let result = SecItemAdd(attrs, &item)
    completion(result, item)
  }
}
</code>```

Now, this code obviously doesn't do the same thing as the example above, because it has a bunch of stuff left out, but is there a functional difference between the two? An is one of them indeed considered more idiomatic?

Title: Using withCheckedContinuation vs a task

Body:
I have the following function:

func saveCredential(_ credential: String, service: String, account: String) async throws {
  let query = [
    kSecValueData: credential.data(using: .utf8)!,
    kSecClass: kSecClassGenericPassword,
    kSecUseDataProtectionKeychain: true,
    kSecAttrSynchronizable: true,
    kSecAttrService: service,
    kSecAttrAccount: account,
  ] as CFDictionary

  let status = (Task {
    // Add data in query to keychain
    return SecItemAdd(query, nil)
  }).value

  switch status {
  case errSecSuccess:
    return;
  case errSecDuplicateItem:
    try updateCredential(credential, service: service, account: account)
  default:
    try throwStatus(status)
  }
}

While discussing whether this is the idiomatic way to do this code, someone in a discord server said that it would be cleaner to write this as:

func addKeychainItem(attributes attrs: CFDictionary) async -> (OSStatus, CFTypeRef?) {
  return await withUnsafeContinuation { continuation in
    var item: CFTypeRef?
    let result = SecItemAdd(attrs, &item)
    completion(result, item)
  }
}

Now, this code obviously doesn't do the same thing as the example above, because it has a bunch of stuff left out, but is there a functional difference between the two? An is one of them indeed considered more idiomatic?


问:
Remove add on product from cart when product category is removed
I am working on an ecommerce store selling a variety of products. We have one line where there is an ice pack included to make sure our shipping prices are accurate. I have added code so the product gets added. The issue is when they remove the products the ice pack stays in the cart. I am looking to have it be auto removed as well.

I have added this code into the functions.php of my child theme

```<code>function df_add_ticket_surcharge( $cart_object ) {
global $woocommerce;
$specialfeecat = 45; // category id you want to check for
$spfee = 0.00; // initialize special fee
$spfeeperprod = 0.00; //special fee per product
$found = $false; //required to make the code later only add the item once, also stop loops.
$product_id = 1414; //product id of the one you want to add

foreach ( $cart_object->cart_contents as $key => $value ) {

    $proid = $value['product_id']; //get the product id from cart
    $quantity = $value['quantity']; //get quantity from cart
    $itmprice = $value['data']->price; //get product price

//check if the desired product is already in cart.
if ( sizeof( $woocommerce->cart->get_cart() ) > 0 ) {
        foreach ( $woocommerce->cart->get_cart() as $cart_item_key => $values ) {
            $_product = $values['data'];
            if ( $_product->id == $product_id )
                $found = true;
        }
    }

//check for the category and add desired product
    $terms = get_the_terms( $proid, 'product_cat' ); //get taxonomy of the products
    if ( $terms && ! is_wp_error( $terms ) ) :
        foreach ( $terms as $term ) {
            $catid = $term->term_id;
            if($specialfeecat == $catid && ! $found) {
                WC()->cart->add_to_cart( 1414 );
            }
        }
    endif;
   }
}
add_action( 'woocommerce_cart_calculate_fees', 'df_add_ticket_surcharge' );

</code>```

Body:
I am working on an ecommerce store selling a variety of products. We have one line where there is an ice pack included to make sure our shipping prices are accurate. I have added code so the product gets added. The issue is when they remove the products the ice pack stays in the cart. I am looking to have it be auto removed as well.

I have added this code into the functions.php of my child theme

function df_add_ticket_surcharge( $cart_object ) {
global $woocommerce;
$specialfeecat = 45; // category id you want to check for
$spfee = 0.00; // initialize special fee
$spfeeperprod = 0.00; //special fee per product
$found = $false; //required to make the code later only add the item once, also stop loops.
$product_id = 1414; //product id of the one you want to add

foreach ( $cart_object->cart_contents as $key => $value ) {

    $proid = $value['product_id']; //get the product id from cart
    $quantity = $value['quantity']; //get quantity from cart
    $itmprice = $value['data']->price; //get product price

//check if the desired product is already in cart.
if ( sizeof( $woocommerce->cart->get_cart() ) > 0 ) {
        foreach ( $woocommerce->cart->get_cart() as $cart_item_key => $values ) {
            $_product = $values['data'];
            if ( $_product->id == $product_id )
                $found = true;
        }
    }

//check for the category and add desired product
    $terms = get_the_terms( $proid, 'product_cat' ); //get taxonomy of the products
    if ( $terms && ! is_wp_error( $terms ) ) :
        foreach ( $terms as $term ) {
            $catid = $term->term_id;
            if($specialfeecat == $catid && ! $found) {
                WC()->cart->add_to_cart( 1414 );
            }
        }
    endif;
   }
}
add_action( 'woocommerce_cart_calculate_fees', 'df_add_ticket_surcharge' );


问:
Twilio not executing flow
I have a flow set up so when a user calls:

Phone A rings

If Phone A does not pick up after 4 seconds, Phone B rings

If Phone B does not pick up a voicemail message plays

Caller has an option to leave a voicemail that gets emailed to us

The flow is not executing. When one dials, both phones dial at the same time and do not play the voicemail. Any ideas?

Screenshot of the flow

I have looked at the logs for the flow and it is not detecting any incoming calls despite testing it.

Title: Twilio not executing flow


问:
How to use Either/DartZ with null Safety flutter
I'm trying to do some tests on my project in clean architecture using Dartz:

My entity class:

```<code>// ignore_for_file: public_member_api_docs, sort_constructors_first

class User {
  final String fullname;
  final String email;
  final String password;
  final String cpf;
  final int phone;
  final String city;
  final String objectId;
  final String token;
  final String responsibility;
  User({
    required this.fullname,
    required this.email,
    required this.password,
    required this.cpf,
    required this.phone,
    required this.city,
    required this.objectId,
    required this.token,
    required this.responsibility,
  })
}
</code>```

My UserCase class:

```<code>abstract class SingIn {
  Future<Either<Exception, User>> call(
      {required String email, required String password});
}

class SingInImpl implements SingIn {
  @override
  Future<Either<Exception, User>> call(
      {required String email, required String password}) async {}
}
</code>```

My Test class:

```<code>void main() {
  final signIn = SingInImpl();
  test('Deve retornar um Usuario', () async {
    final result =
        await signIn.call(email: 'xxxxxxx@xxxx.com', password: 'xxxxx');

    expect(result, isA<Right>());
    expect(result.getOrElse(() => null), isA<User>());
  });
}
</code>```

My User case class gives me the following error:

The body might complete normally, causing 'null' to be returned, but the return type, 'FutureOr<Either<Exception, User>>', is a potentially non-nullable type.

Try adding either a return or a throw statement at the end.dartbody_might_complete_normally.

And my Test class:

The return type 'Null' isn't a 'User', as required by the closure's context.

My User case class causes the following error:

The body might complete normally, causing 'null' to be returned, but the return type, 'FutureOr<Either<Exception, User>>', is a potentially non-nullable type.

Try adding either a return or a throw statement at the end.dartbody_might_complete_normally

Body:
I'm trying to do some tests on my project in clean architecture using Dartz:

My entity class:

// ignore_for_file: public_member_api_docs, sort_constructors_first

class User {
  final String fullname;
  final String email;
  final String password;
  final String cpf;
  final int phone;
  final String city;
  final String objectId;
  final String token;
  final String responsibility;
  User({
    required this.fullname,
    required this.email,
    required this.password,
    required this.cpf,
    required this.phone,
    required this.city,
    required this.objectId,
    required this.token,
    required this.responsibility,
  })
}

My UserCase class:

abstract class SingIn {
  Future<Either<Exception, User>> call(
      {required String email, required String password});
}

class SingInImpl implements SingIn {
  @override
  Future<Either<Exception, User>> call(
      {required String email, required String password}) async {}
}

My Test class:

void main() {
  final signIn = SingInImpl();
  test('Deve retornar um Usuario', () async {
    final result =
        await signIn.call(email: 'xxxxxxx@xxxx.com', password: 'xxxxx');

    expect(result, isA<Right>());
    expect(result.getOrElse(() => null), isA<User>());
  });
}

My User case class gives me the following error:

The body might complete normally, causing 'null' to be returned, but the return type, 'FutureOr<Either<Exception, User>>', is a potentially non-nullable type.

Try adding either a return or a throw statement at the end.dartbody_might_complete_normally.

And my Test class:

The return type 'Null' isn't a 'User', as required by the closure's context.

My User case class causes the following error:

The body might complete normally, causing 'null' to be returned, but the return type, 'FutureOr<Either<Exception, User>>', is a potentially non-nullable type.

Try adding either a return or a throw statement at the end.dartbody_might_complete_normally


问:
How do I test a data API (Youtube Data API) with fake data?
I am currently working with the YouTube Data API and do not understand how I can test my calls. For instance, I have a call that retrieves all donations made during a YouTube livestream. Without having to create a livestream and donate to myself, how can I create some sample data for testing?</p>


问:
How disable a stylesheet in  when edit with WP Bakery editor
So i have a problem with a code that i added via a WP coder plugin ( a plugin that i can add HTML, CSS JS without coding intern Wordpress)

So the code i add is;

```<code><meta http-equiv="refresh" content="180;url=https://test.link-example.nl/weer/" />
</code>```

it will redirect in 180s = 3minutes. ( You can guess what happens in a front editor )

The annoying thing is that WPBakery in front-editor mode also redirected within 3 minutes. What i want is when im in the front-editor mode that it not redirect. Only when its in display mode-(just normal web view)

How to fix this?

Perrys.

I tried to make a class and display:none; but that doesn't work.

Title: How disable a stylesheet in </head> when edit with WP Bakery editor

Body:
So i have a problem with a code that i added via a WP coder plugin ( a plugin that i can add HTML, CSS JS without coding intern Wordpress)

So the code i add is;

<meta http-equiv="refresh" content="180;url=https://test.link-example.nl/weer/" />

it will redirect in 180s = 3minutes. ( You can guess what happens in a front editor )

The annoying thing is that WPBakery in front-editor mode also redirected within 3 minutes. What i want is when im in the front-editor mode that it not redirect. Only when its in display mode-(just normal web view)

How to fix this?

Perrys.

I tried to make a class and display:none; but that doesn't work.


问:
Angular: Select checkbox on another checkbox selection ( dynamic form control )
I'm new to angular.

I have this UI. I wanted to make Bill To checkbox checked if any one (Address, Email or Phone) of the checkbox is checked. I'm using dynamic form control for checkbox.

code snippet: This solution didnt work , as combineLatest is emitting only when all the three checkboxes get selected

```<code>combineLatest([this.form.customerInfo.address.valueChanges(),
  this.form.customerInfo.email.valueChanges(),
  this.form.customerInfo.phone.valueChanges()])
  .subscribe((formValues)=>{
    if (formValues.every((value) => value === false || value === undefined)) {
      this.form.customerInfo.billTo.setValue(false)
    }
    else {
      this.form.customerInfo.billTo.setValue(true)
    }
});

this.form.customerInfo.billTo.valueChanges().pipe(distinctUntilChanged()).subscribe(value =>{
// if billTo is false or unchecked- unchecked all
  if(!value){
    this.form.customerInfo.address.setValue(value);
    this.form.customerInfo.phone.setValue(value);
    this.form.customerInfo.email.setValue(value);
  }

})
</code>```

another solution: it's a bit complicated

```<code>combineLatest([
  this.form.customer.address.valueChanges().pipe(startWith(false)),
  this.form.customer.phone.valueChanges().pipe(startWith(false)),
  this.form.customer.email.valueChanges().pipe(startWith(false)),
])
  // adding debounce until we can listen for form changes and patch multiple form values simultaneously
  .pipe(debounceTime(100))
  .subscribe(([address, phone, email]) => {
    if ((address || phone || email) && !this.form.customerInfo.billTo.value) {
      // one of the nested values is true, and billTo is false, make billTo true
      this.form.customer.billTo.setValue(true);
    }
  });

// when customer toggle billTo to false, we set all children to false
this.form.customer.billTo
  .valueChanges()
  .pipe(filter((value) => value !== true))
  .subscribe(() => {
    const address = this.form.customer.address.value;
    const phone = this.form.customer.phone.value;
    const email = this.form.customer.email.value;
    // if any of the nested values are true, set them to false
    if (address) {
      this.form.customer.address.setValue(false);
    }
    if (phone) {
      this.form.customer.phone.setValue(false);
    }
    if (email) {
      this.form.customer.email.setValue(false);
    }
  });
</code>```

Can anyone tell how to improve this? Thanks in advance.

Body:
I'm new to angular.

I have this UI. I wanted to make Bill To checkbox checked if any one (Address, Email or Phone) of the checkbox is checked. I'm using dynamic form control for checkbox.

code snippet: This solution didnt work , as combineLatest is emitting only when all the three checkboxes get selected

combineLatest([this.form.customerInfo.address.valueChanges(),
  this.form.customerInfo.email.valueChanges(),
  this.form.customerInfo.phone.valueChanges()])
  .subscribe((formValues)=>{
    if (formValues.every((value) => value === false || value === undefined)) {
      this.form.customerInfo.billTo.setValue(false)
    }
    else {
      this.form.customerInfo.billTo.setValue(true)
    }
});

this.form.customerInfo.billTo.valueChanges().pipe(distinctUntilChanged()).subscribe(value =>{
// if billTo is false or unchecked- unchecked all
  if(!value){
    this.form.customerInfo.address.setValue(value);
    this.form.customerInfo.phone.setValue(value);
    this.form.customerInfo.email.setValue(value);
  }

})

another solution: it's a bit complicated

combineLatest([
  this.form.customer.address.valueChanges().pipe(startWith(false)),
  this.form.customer.phone.valueChanges().pipe(startWith(false)),
  this.form.customer.email.valueChanges().pipe(startWith(false)),
])
  // adding debounce until we can listen for form changes and patch multiple form values simultaneously
  .pipe(debounceTime(100))
  .subscribe(([address, phone, email]) => {
    if ((address || phone || email) && !this.form.customerInfo.billTo.value) {
      // one of the nested values is true, and billTo is false, make billTo true
      this.form.customer.billTo.setValue(true);
    }
  });

// when customer toggle billTo to false, we set all children to false
this.form.customer.billTo
  .valueChanges()
  .pipe(filter((value) => value !== true))
  .subscribe(() => {
    const address = this.form.customer.address.value;
    const phone = this.form.customer.phone.value;
    const email = this.form.customer.email.value;
    // if any of the nested values are true, set them to false
    if (address) {
      this.form.customer.address.setValue(false);
    }
    if (phone) {
      this.form.customer.phone.setValue(false);
    }
    if (email) {
      this.form.customer.email.setValue(false);
    }
  });

Can anyone tell how to improve this? Thanks in advance.


问:
How to update the lines so that they do not break away from the rectangles after dragging?
I beg you to help me. I'm creating a small chart and it's not working make the connecting lines between the rectangles so that they stretch
after moving the rectangle-nodes. What we have:

3 rectangles created in OOR js svg;

created connecting lines with rectangles (in OOP js svg);

function for moving rectangle-nodes.
What is the problem. When dragging nodes, the lines break away from the rectangles.
An example of how a diagram works
here

I ask for help in creating a function for updating the line when dragging the nodes of the diagram.
I think that it needs to put the value of the points of contact, put the name of the update function
to the code of the drag/drop function

created the updateLines() function;

inserted conn1.x1 into it; conn.y1;conn1.x2;conn1.y2;

inserted into it var connect1 = new Lines();
connect1.draw();
varx3 = rec3.location.x+100; var y3 = rec3.location.y; /////
var connect2 = new Lines(rec1.location.x+100,rec1.location.y+80, rec3.location.x+100, rec3.location.y,stroke='green',id='l2');
connect2.draw();

I inserted the name of the function into the makeDraggable(evt) code;

```<code><style>
    .background {
      fill: #eee;
    }
    .static {
      cursor: not-allowed;
    }
    .draggable {
      cursor: move;
    }
  </style>
-----------------------
<svg xmlns="http://www.w3.org/2000/svg" id="forDraw" viewBox="0 0 1330 420" onload="makeDraggable(evt)">
  </svg>

------------------
function makeDraggable(evt) {
        var svg = evt.target;
        svg.addEventListener('mousedown', startDrag);
        svg.addEventListener('mousemove', drag);
        svg.addEventListener('mouseup', endDrag);
        function getMousePosition(evt) {
          var CTM = svg.getScreenCTM();
          return {
            x: (evt.clientX - CTM.e) / CTM.a,
            y: (evt.clientY - CTM.f) / CTM.d
          };
        }
        var selectedElement, offset;
        function startDrag(evt) {
          if (evt.target.classList.contains('draggable')) {
            selectedElement = evt.target;
            offset = getMousePosition(evt);
            offset.x -= parseFloat(selectedElement.getAttributeNS(null, "x"));
            offset.y -= parseFloat(selectedElement.getAttributeNS(null, "y"));
          }
        }
        function drag(evt) {
          if (selectedElement) {
            var coord = getMousePosition(evt);
            selectedElement.setAttributeNS(null, "x", coord.x - offset.x);
            selectedElement.setAttributeNS(null, "y", coord.y - offset.y);
          }
        }
        function endDrag(evt) {
          selectedElement = null;
        }
      }
    var recWidth = '200';
    var recHeight = '80';
    function Rectangle(width,height, location={x: 400, y: 50},style='draggable', fill = 'red', stroke = 'green',id='ivan') {
   this.width = recWidth;
   this.height =  recHeight;
   this.location = location;
   this.style = style;
   this.fill = fill;
   this.stroke = stroke;
   this.id = id;

     this.draw = function() {
 forDraw.innerHTML += `<rect  width="${this.width}" height="${this.height}"  x="${this.location.x}" y="${this.location.y}"
  class="${this.style}" fill="${this.fill}" stroke="${this.stroke}" id="${this.id}" />`;

     }
}
Rectangle.prototype.draw = function() {
   if (forDraw.getElementById(this.id)) forDraw.getElementById(this.id).remove();
   forDraw.innerHTML += `<rect  width="${this.width}" height="${this.height}"  x="${this.location.x}" y="${this.location.y}"
  class="${this.style}" fill="${this.fill}" stroke="${this.stroke}" id="${this.id}" />`;
}
var rec1 = new Rectangle();
rec1.draw();
var rec2 = new Rectangle(150,90, {x: 300, y:300}, style='draggable','yellow', 'red','petro');
rec2.draw();
var rec3 = new Rectangle(150,90, {x: 550, y:300}, style='draggable','green', 'blue','dima');
rec3.draw();
function Lines(x1=rec1.location.x+100, y1=rec1.location.y+80, x2=rec2.location.x+100, y2=rec2.location.y, stroke='blue',id='l1') {
     this.x1 = x1;
   this.y1 = y1;
   this.x2 = x2;
   this.y2 = y2;
   this.stroke = stroke;
   this.id = id;
    this.draw = function() {
      forDraw.innerHTML += `<line x1="${this.x1}" y1="${this.y1}"  x2="${this.x2}" y2="${this.y2}"
 stroke="${this.stroke}" id="${this.id}" />`;
    }
   }

var connect1 = new Lines();
connect1.draw();
var x3  = rec3.location.x+100;
  var y3  = rec3.location.y;
 /////
var connect2 = new Lines(rec1.location.x+100,rec1.location.y+80, rec3.location.x+100, rec3.location.y,stroke='green',id='l2');
connect2.draw();

</code>```

Body:
I beg you to help me. I'm creating a small chart and it's not working make the connecting lines between the rectangles so that they stretch
after moving the rectangle-nodes. What we have:

3 rectangles created in OOR js svg;

created connecting lines with rectangles (in OOP js svg);

function for moving rectangle-nodes.
What is the problem. When dragging nodes, the lines break away from the rectangles.
An example of how a diagram works
here

I ask for help in creating a function for updating the line when dragging the nodes of the diagram.
I think that it needs to put the value of the points of contact, put the name of the update function
to the code of the drag/drop function

created the updateLines() function;

inserted conn1.x1 into it; conn.y1;conn1.x2;conn1.y2;

inserted into it var connect1 = new Lines();
connect1.draw();
varx3 = rec3.location.x+100; var y3 = rec3.location.y; /////
var connect2 = new Lines(rec1.location.x+100,rec1.location.y+80, rec3.location.x+100, rec3.location.y,stroke='green',id='l2');
connect2.draw();

I inserted the name of the function into the makeDraggable(evt) code;

-----------------------
<svg xmlns="http://www.w3.org/2000/svg" id="forDraw" viewBox="0 0 1330 420" onload="makeDraggable(evt)">
  </svg>

------------------
function makeDraggable(evt) {
        var svg = evt.target;
        svg.addEventListener('mousedown', startDrag);
        svg.addEventListener('mousemove', drag);
        svg.addEventListener('mouseup', endDrag);
        function getMousePosition(evt) {
          var CTM = svg.getScreenCTM();
          return {
            x: (evt.clientX - CTM.e) / CTM.a,
            y: (evt.clientY - CTM.f) / CTM.d
          };
        }
        var selectedElement, offset;
        function startDrag(evt) {
          if (evt.target.classList.contains('draggable')) {
            selectedElement = evt.target;
            offset = getMousePosition(evt);
            offset.x -= parseFloat(selectedElement.getAttributeNS(null, "x"));
            offset.y -= parseFloat(selectedElement.getAttributeNS(null, "y"));
          }
        }
        function drag(evt) {
          if (selectedElement) {
            var coord = getMousePosition(evt);
            selectedElement.setAttributeNS(null, "x", coord.x - offset.x);
            selectedElement.setAttributeNS(null, "y", coord.y - offset.y);
          }
        }
        function endDrag(evt) {
          selectedElement = null;
        }
      }
    var recWidth = '200';
    var recHeight = '80';
    function Rectangle(width,height, location={x: 400, y: 50},style='draggable', fill = 'red', stroke = 'green',id='ivan') {
   this.width = recWidth;
   this.height =  recHeight;
   this.location = location;
   this.style = style;
   this.fill = fill;
   this.stroke = stroke;
   this.id = id;

     this.draw = function() {
 forDraw.innerHTML += `<rect  width="${this.width}" height="${this.height}"  x="${this.location.x}" y="${this.location.y}"
  class="${this.style}" fill="${this.fill}" stroke="${this.stroke}" id="${this.id}" />`;

     }
}
Rectangle.prototype.draw = function() {
   if (forDraw.getElementById(this.id)) forDraw.getElementById(this.id).remove();
   forDraw.innerHTML += `<rect  width="${this.width}" height="${this.height}"  x="${this.location.x}" y="${this.location.y}"
  class="${this.style}" fill="${this.fill}" stroke="${this.stroke}" id="${this.id}" />`;
}
var rec1 = new Rectangle();
rec1.draw();
var rec2 = new Rectangle(150,90, {x: 300, y:300}, style='draggable','yellow', 'red','petro');
rec2.draw();
var rec3 = new Rectangle(150,90, {x: 550, y:300}, style='draggable','green', 'blue','dima');
rec3.draw();
function Lines(x1=rec1.location.x+100, y1=rec1.location.y+80, x2=rec2.location.x+100, y2=rec2.location.y, stroke='blue',id='l1') {
     this.x1 = x1;
   this.y1 = y1;
   this.x2 = x2;
   this.y2 = y2;
   this.stroke = stroke;
   this.id = id;
    this.draw = function() {
      forDraw.innerHTML += `<line x1="${this.x1}" y1="${this.y1}"  x2="${this.x2}" y2="${this.y2}"
 stroke="${this.stroke}" id="${this.id}" />`;
    }
   }

var connect1 = new Lines();
connect1.draw();
var x3  = rec3.location.x+100;
  var y3  = rec3.location.y;
 /////
var connect2 = new Lines(rec1.location.x+100,rec1.location.y+80, rec3.location.x+100, rec3.location.y,stroke='green',id='l2');
connect2.draw();


问:
xmlns attribute makes the object null while unmarshalling with JAXB
The code below works perfectly and i am able to get the success value  when i remove the namesace xmlns(xmlns="http://w/p-print") from the xml. But when xml comes with xmlns attribute, response object becomes null after unmarshalling. I tried to map the xmlns attrubute in Response class too but it did not make any difference. Seems like whenever I run into xmlns attrubute in the xml, entire Response object being null. Any idea about it? Thank you all in advance.

The xml that I am unmarshalling
`

```<code><?xml version="1.0" encoding="utf-8"?>
<PRInfo Version="2.00">

        <ePrint>
            <Params>
                <devid>test</devid>
                <printjobid>2323</printjobid>
            </Params>
            <PResonse>
                <response xmlns="http://w/p-print" success="true"/>.
                </response>
            </PResonse>
        <ePrint>

</PRInfo>
</code>```

`

Class Based Mapping

```<code>@XmlAccessorType(XmlAccessType.FIELD)
public class PRInfo {

    // required XmlElements comes here

    @XmlAccessorType(XmlAccessType.FIELD)
    public static class ePrint {

        //required XmlElementa comes here

        @XmlAccessorType(XmlAccessType.FIELD)
        public static class Params {
            // required XmlElement come here...
        }

        @XmlAccessorType(XmlAccessType.FIELD)
        @XmlType(name = "", propOrder = {"response"})
        public static class PResonse {

            @XmlElement
            private Response response;
           // Getter Setter
        }
    }
}

@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "response")
public class Response {

    @XmlAttribute(name = "success")
    protected Boolean success;
// Getter and Setter
}

</code>```

Unmarshal the xml and get the success value from response object.

Body:
The code below works perfectly and i am able to get the success value  when i remove the namesace xmlns(xmlns="http://w/p-print") from the xml. But when xml comes with xmlns attribute, response object becomes null after unmarshalling. I tried to map the xmlns attrubute in Response class too but it did not make any difference. Seems like whenever I run into xmlns attrubute in the xml, entire Response object being null. Any idea about it? Thank you all in advance.

The xml that I am unmarshalling
`

<?xml version="1.0" encoding="utf-8"?>
<PRInfo Version="2.00">

        <ePrint>
            <Params>
                <devid>test</devid>
                <printjobid>2323</printjobid>
            </Params>
            <PResonse>
                <response xmlns="http://w/p-print" success="true"/>.
                </response>
            </PResonse>
        <ePrint>

</PRInfo>

`

Class Based Mapping

@XmlAccessorType(XmlAccessType.FIELD)
public class PRInfo {

    // required XmlElements comes here

    @XmlAccessorType(XmlAccessType.FIELD)
    public static class ePrint {

        //required XmlElementa comes here

        @XmlAccessorType(XmlAccessType.FIELD)
        public static class Params {
            // required XmlElement come here...
        }

        @XmlAccessorType(XmlAccessType.FIELD)
        @XmlType(name = "", propOrder = {"response"})
        public static class PResonse {

            @XmlElement
            private Response response;
           // Getter Setter
        }
    }
}

@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "response")
public class Response {

    @XmlAttribute(name = "success")
    protected Boolean success;
// Getter and Setter
}

Unmarshal the xml and get the success value from response object.


问:
Workspace apps does not always appear for gmail IOS
It is not clear why sometimes it appears and sometimes it doesn’t.


问:
reflective texture for arbitrary shapes
I have been looking for a way to make a reflective (mirror) texture for arbitrary meshes. I understand that there are a couple of approaches the most popular seems to be rendering the scene from the perspective of the sides of a "reflective" cube and using the rendered images as textures for the object. Are there faster/more accurate approaches to the problem?</p>

Title: reflective texture for arbitrary shapes


问:
Removing first element of data array before passing it to Blob constructor breaks the output video
I am working on a retroactive screen capture application in JS using mediaDevices, MediaRecorder, and the Blob constructor APIs. I want to store screen output, discard stale data past a certain threshold, and then let the user capture and output the remaining data as video. To generate the files I  pass an array (chunks) of stream data to the Blob constructor. The problem is that I want to remove a certain number of leading elements from the array, but when I remove the first element of the array the output videos are broken.

For starters, the app can pass data into chunks array, make a blob, then output a video successfully. If i call chunks.shift() the array ->blob->mp4 chain no longer produces a functional video. Below is the function I wanted to use to trim stale data during an ongoing "monitoring" period, when toggled to "recording" instead of "monitoring" all data would be retained. But calling shift in this way breaks things.

```<code>   function handleDataAvailable (e) {

        if (monitoring){
            // only do the shifting when we are monitoring not recording
            if (chunks.length > stalenessThreshold) {
                console.log("we are trimming data");
                chunks.shift();
            }
        }
        chunks.push(e.data);
    }
</code>```

I have tried putting the shift call elsewhere, including a single call rather than multiple calls and the same issue results, and actually if I add the first chunk I back to the front of the array, it works again, as below:

```<code>      let first = chunks.shift()
      chunks.shift()
      chunks.pop()
      chunks.unshift(first)
</code>```

So I can remove elements from the middle and end of the chunks array as long as I add that first element back in.

I've also tried passing a slice of the chunks array to the Blob constructor, same result. I'm curious if I could trim the resulting blob, but I'm not well versed on slicing/working with blobs directly, and it also seems less performant that just trimming the input array. The Blob API call looks like this (I've tried with webm):

```<code>const blob = new Blob(chunks, { 'type' : 'video/mp4'})
</code>```

I would like to understand this at a conceptual level, I've been reading docs and I can't make sense of it. Why is this first chunk essential? It seems the chunks arrray should be an array of blobs or blob like data that could be rearranged any old way? I would also like to find a solution for my application, so that I can monitor a set timeframe of recent screen activity. First stackoverlow question, hopefully it meets guidelines, thanks for reading, happy to provide more context and snippets.

Body:
I am working on a retroactive screen capture application in JS using mediaDevices, MediaRecorder, and the Blob constructor APIs. I want to store screen output, discard stale data past a certain threshold, and then let the user capture and output the remaining data as video. To generate the files I  pass an array (chunks) of stream data to the Blob constructor. The problem is that I want to remove a certain number of leading elements from the array, but when I remove the first element of the array the output videos are broken.

For starters, the app can pass data into chunks array, make a blob, then output a video successfully. If i call chunks.shift() the array ->blob->mp4 chain no longer produces a functional video. Below is the function I wanted to use to trim stale data during an ongoing "monitoring" period, when toggled to "recording" instead of "monitoring" all data would be retained. But calling shift in this way breaks things.

   function handleDataAvailable (e) {

        if (monitoring){
            // only do the shifting when we are monitoring not recording
            if (chunks.length > stalenessThreshold) {
                console.log("we are trimming data");
                chunks.shift();
            }
        }
        chunks.push(e.data);
    }

I have tried putting the shift call elsewhere, including a single call rather than multiple calls and the same issue results, and actually if I add the first chunk I back to the front of the array, it works again, as below:

      let first = chunks.shift()
      chunks.shift()
      chunks.pop()
      chunks.unshift(first)

So I can remove elements from the middle and end of the chunks array as long as I add that first element back in.

I've also tried passing a slice of the chunks array to the Blob constructor, same result. I'm curious if I could trim the resulting blob, but I'm not well versed on slicing/working with blobs directly, and it also seems less performant that just trimming the input array. The Blob API call looks like this (I've tried with webm):

const blob = new Blob(chunks, { 'type' : 'video/mp4'})

I would like to understand this at a conceptual level, I've been reading docs and I can't make sense of it. Why is this first chunk essential? It seems the chunks arrray should be an array of blobs or blob like data that could be rearranged any old way? I would also like to find a solution for my application, so that I can monitor a set timeframe of recent screen activity. First stackoverlow question, hopefully it meets guidelines, thanks for reading, happy to provide more context and snippets.


问:
How to access a Strapi custom GraphQL query in Gatsby's data layer?
I'm making a blog using Gatsby v4.4.0 as the frontend and Strapi v4.4.5 as the backend/CMS, and want to be able to query articles by random (for example, get 3 random articles). I created a custom GraphQL query by extending Strapi's GraphQL schema (following this article and the Strapi docs on GraphQL) for this purpose.

The query resolver in Strapi - src/api/article/graphql.js:

"use strict";

module.exports =
  (strapi) =>
  ({ nexus }) => ({
    typeDefs: `
        type RandomArticleResponse {
            data: [ArticleEntity]!
        }

        extend type Query {
            randomArticle(limit: Int, exclude: ID): RandomArticleResponse
        }
    `,
    resolvers: {
      Query: {
        randomArticle: {
          resolve: async (parent, args, context) => {
            const DEFAULT_LIMIT = 3;
            const limit = args.limit || DEFAULT_LIMIT;
            const excludedIds = args.exclude ? [args.exclude] : [];

            const ids = (
              await strapi.db.connection
                .select("id")
                .from("articles")
                .whereNotIn("id", excludedIds)
                .orderByRaw("RANDOM()")
                .limit(limit)
            ).map((it) => it.id);

            const data = await strapi.entityService.findMany(
              "api::article.article",
              {
                filters: {
                  id: {
                    $in: ids,
                  },
                },
              }
            );

            return { data };
          },
        },
      },
    },
  });
```
<p>This part works fine and I can query from Strapi's GraphQL playground (image), but to be able to be used in Gatsby the query has to be accessible from Gatsby's GraphQL Data Layer, which it seemingly isn't by default since the query isn't showing up in GraphiQL (image).</p>
<p>I am using <code>gatsby-source-strapi</code> for pulling documents into Gatsby from the Strapi API. My options in <code>gatsby-config.js</code> are:</p>
<pre class="lang-js prettyprint-override"><code>{
  resolve: `gatsby-source-strapi`,
  options: {
    apiURL: process.env.STRAPI_API_URL || "http://localhost:8082",
    accessToken: process.env.STRAPI_TOKEN,
    collectionTypes: [
      {
        singularName: "article",
        queryParams: {
          publicationState:
            process.env.GATSBY_IS_PREVIEW === "true" ? "preview" : "live",
          populate: {
            cover: "*",
            column: "*",
            tags: "*",
            blocks: {
              populate: "*",
            },
            author: "*",
            references: "*",
          },
       },
     },
     {
       singularName: "author",
     },
     {
       singularName: "column",
       queryParams: {
         populate: {
           articles: "*",
         },
       },
     },
     {
       singularName: "tag",
       queryParams: {
         populate: {
           articles: "*",
         },
       },
     },
   ],
   singleTypes: [
     {
       singularName: "about",
       queryParams: {
         populate: {
           author: "*",
           blocks: "*",
         },
       },
     },
     {
       singularName: "global",
       queryParams: {
         populate: {
           favicon: "*",
           defaultSeo: "*",
         },
       },
     },
   ],
 },
}
</code>```

I think I have to add randomArticles to a data source plugin somehow but I'm not sure how to do that. I've tried reading gatsby-source-strapi docs and the docs about Source Plugins but I'm not sure which parts are relevant to this problem. Has anyone had issues with this same use case? Any advice would be appreciated. Thanks!

Body:
I'm making a blog using Gatsby v4.4.0 as the frontend and Strapi v4.4.5 as the backend/CMS, and want to be able to query articles by random (for example, get 3 random articles). I created a custom GraphQL query by extending Strapi's GraphQL schema (following this article and the Strapi docs on GraphQL) for this purpose.

The query resolver in Strapi - src/api/article/graphql.js:

"use strict";

module.exports =
  (strapi) =>
  ({ nexus }) => ({
    typeDefs: `
        type RandomArticleResponse {
            data: [ArticleEntity]!
        }

        extend type Query {
            randomArticle(limit: Int, exclude: ID): RandomArticleResponse
        }
    `,
    resolvers: {
      Query: {
        randomArticle: {
          resolve: async (parent, args, context) => {
            const DEFAULT_LIMIT = 3;
            const limit = args.limit || DEFAULT_LIMIT;
            const excludedIds = args.exclude ? [args.exclude] : [];

            const ids = (
              await strapi.db.connection
                .select("id")
                .from("articles")
                .whereNotIn("id", excludedIds)
                .orderByRaw("RANDOM()")
                .limit(limit)
            ).map((it) => it.id);

            const data = await strapi.entityService.findMany(
              "api::article.article",
              {
                filters: {
                  id: {
                    $in: ids,
                  },
                },
              }
            );

            return { data };
          },
        },
      },
    },
  });

This part works fine and I can query from Strapi's GraphQL playground (image), but to be able to be used in Gatsby the query has to be accessible from Gatsby's GraphQL Data Layer, which it seemingly isn't by default since the query isn't showing up in GraphiQL (image).

I am using gatsby-source-strapi for pulling documents into Gatsby from the Strapi API. My options in gatsby-config.js are:

{
  resolve: `gatsby-source-strapi`,
  options: {
    apiURL: process.env.STRAPI_API_URL || "http://localhost:8082",
    accessToken: process.env.STRAPI_TOKEN,
    collectionTypes: [
      {
        singularName: "article",
        queryParams: {
          publicationState:
            process.env.GATSBY_IS_PREVIEW === "true" ? "preview" : "live",
          populate: {
            cover: "*",
            column: "*",
            tags: "*",
            blocks: {
              populate: "*",
            },
            author: "*",
            references: "*",
          },
       },
     },
     {
       singularName: "author",
     },
     {
       singularName: "column",
       queryParams: {
         populate: {
           articles: "*",
         },
       },
     },
     {
       singularName: "tag",
       queryParams: {
         populate: {
           articles: "*",
         },
       },
     },
   ],
   singleTypes: [
     {
       singularName: "about",
       queryParams: {
         populate: {
           author: "*",
           blocks: "*",
         },
       },
     },
     {
       singularName: "global",
       queryParams: {
         populate: {
           favicon: "*",
           defaultSeo: "*",
         },
       },
     },
   ],
 },
}

I think I have to add randomArticles to a data source plugin somehow but I'm not sure how to do that. I've tried reading gatsby-source-strapi docs and the docs about Source Plugins but I'm not sure which parts are relevant to this problem. Has anyone had issues with this same use case? Any advice would be appreciated. Thanks!


问:
Saving RecyclerView state in a fragment when exiting it
I am trying to make a app that sends messages to a recyclerView from fragment to another using a navgraph, but whenever I go back to my previous fragment to add a new message I lose the data of my recyclerView, and does not pile up.

---This is the kotlin code for the first fragment:

```<code>package com.example.passingdata

import android.os.Bundle
import androidx.fragment.app.Fragment
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.widget.Button
import android.widget.EditText
import androidx.navigation.Navigation

private const val ARG_PARAM1 = "param1"
private const val ARG_PARAM2 = "param2"

class Fragment_A : Fragment() {
    // TODO: Rename and change types of parameters
    private var param1: String? = null
    private var param2: String? = null

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        arguments?.let {
            param1 = it.getString(ARG_PARAM1)
            param2 = it.getString(ARG_PARAM2)
        }
    }

    override fun onCreateView(
        inflater: LayoutInflater, container: ViewGroup?,
        savedInstanceState: Bundle?
    ): View? {
        return inflater.inflate(R.layout.fragment__a, container, false)
    }

    override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
        super.onViewCreated(view, savedInstanceState)

        val messageET = view.findViewById<EditText>(R.id.ETmessageTaker)
        val enterBTN = view.findViewById<Button>(R.id.BTNenter)

        enterBTN.setOnClickListener{
            val action = Fragment_ADirections.actionFragmentAToFragmentB(messageET.text.toString())
            Navigation.findNavController(view).navigate(action)

        }

    }

    companion object {
        fun newInstance(param1: String, param2: String) =
            Fragment_A().apply {
                arguments = Bundle().apply {
                    putString(ARG_PARAM1, param1)
                    putString(ARG_PARAM2, param2)
                }
            }
    }
}
</code>```

---XML code for first fragment:

```<code><?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context=".Fragment_A">

    <EditText
        android:id="@+id/ETmessageTaker"
        android:layout_width="0dp"
        android:layout_height="wrap_content"
        android:layout_margin="10dp"
        android:ems="10"
        android:hint="Message"
        android:inputType="textPersonName"
        android:minHeight="48dp"
        android:textSize="30sp"
        app:layout_constraintBottom_toBottomOf="parent"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toTopOf="parent" />

    <Button
        android:id="@+id/BTNenter"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_margin="5dp"
        android:text="Enter"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintTop_toBottomOf="@+id/ETmessageTaker" />
</androidx.constraintlayout.widget.ConstraintLayout>
</code>```

---Kotlin code for second fragment :

```<code>package com.example.passingdata

import android.content.ContentValues.TAG
import android.os.Bundle
import android.os.Parcelable
import android.util.Log
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import androidx.fragment.app.Fragment
import androidx.navigation.Navigation
import androidx.navigation.fragment.navArgs
import androidx.recyclerview.widget.LinearLayoutManager
import com.example.passingdata.databinding.FragmentBBinding
import messageAdapter

private const val ARG_PARAM1 = "param1"
private const val ARG_PARAM2 = "param2"
var state: Parcelable? = null

class Fragment_B : Fragment() {
    // TODO: Rename and change types of parameters
    private var param1: String? = null
    private var param2: String? = null
    private val args:Fragment_BArgs by navArgs()
    private var _binding: FragmentBBinding? = null
    private val binding get() = _binding!!

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        arguments?.let {
            param1 = it.getString(ARG_PARAM1)
            param2 = it.getString(ARG_PARAM2)
        }
    }

    override fun onCreateView(
        inflater: LayoutInflater,
        container: ViewGroup?,
        savedInstanceState: Bundle?
    ): View? {
        _binding = FragmentBBinding.inflate(inflater, container, false)
        return binding.root
    }

    override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
        super.onViewCreated(view, savedInstanceState)

        val eachMessage = args.messageRecieved
        //putting words in TV
        binding.TVNewMessage.text = eachMessage

        //putting words in RV
        val messageList = mutableListOf(
            message(eachMessage)
        )
        val adapter = messageAdapter(messageList)
        binding.RVMessages.adapter = adapter
        binding.RVMessages.layoutManager = LinearLayoutManager(context)

        binding.BTNBack.setOnClickListener {
            Navigation.findNavController(view).navigate(R.id.action_fragment_B_to_fragment_A)
        }
    }

    companion object {
        fun newInstance(param1: String, param2: String) =
            Fragment_B().apply {
                arguments = Bundle().apply {
                    putString(ARG_PARAM1, param1)
                    putString(ARG_PARAM2, param2)
                }
            }
    }

    override fun onResume() {
        super.onResume()
        Log.d(TAG, "onResume Called")
        state = binding.RVMessages.layoutManager?.onSaveInstanceState();
    }

    override fun onPause() {
        super.onPause()
        Log.d(TAG, "onPause Called")
        state = binding.RVMessages.layoutManager?.onSaveInstanceState();

    }

    override fun onStop() {
        super.onStop()
        Log.d(TAG, "onStop Called")
        state = binding.RVMessages.layoutManager?.onSaveInstanceState();
    }

    override fun onDestroy() {
        super.onDestroy()
        Log.d(TAG, "onDestroy Called")
        _binding = null
    }
}
</code>```

---XML code for second fragment:

```<code><?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context=".Fragment_B">

    <androidx.recyclerview.widget.RecyclerView
        android:id="@+id/RV_messages"
        android:layout_width="match_parent"
        android:layout_height="0dp"
        android:layout_marginBottom="20dp"
        app:layout_constraintBottom_toTopOf="@+id/TV_newMessage"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toTopOf="parent" />

    <TextView
        android:id="@+id/TV_newMessage"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginBottom="60dp"
        android:text="TextView"
        android:textSize="20sp"
        app:layout_constraintBottom_toBottomOf="parent"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintStart_toStartOf="parent" />

    <Button
        android:id="@+id/BTN_back"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginBottom="20dp"
        android:layout_marginRight="10dp"
        android:text="Back"
        app:layout_constraintBottom_toBottomOf="parent"
        app:layout_constraintEnd_toEndOf="parent" />

    <Button
        android:id="@+id/BTN_save"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginBottom="20dp"
        android:text="Save"
        app:layout_constraintBottom_toBottomOf="parent"
        app:layout_constraintStart_toStartOf="parent" />

</androidx.constraintlayout.widget.ConstraintLayout>
</code>```

Someone suggested I override the 3 states and save them like this, but it did not work.

I even tried using SharedPrefrences but it gives me a error saying, "Unresolved reference: getSharedPrefrences".

```<code>
override fun onResume() {
super.onResume()
Log.d(TAG, "onResume Called")
state = binding.RVMessages.layoutManager?.onSaveInstanceState();
}

override fun onPause() {
super.onPause()
Log.d(TAG, "onPause Called")
state = binding.RVMessages.layoutManager?.onSaveInstanceState();

}

override fun onStop() {
super.onStop()
Log.d(TAG, "onStop Called")
state = binding.RVMessages.layoutManager?.onSaveInstanceState();
}
</code>```

Body:
I am trying to make a app that sends messages to a recyclerView from fragment to another using a navgraph, but whenever I go back to my previous fragment to add a new message I lose the data of my recyclerView, and does not pile up.

---This is the kotlin code for the first fragment:

package com.example.passingdata

import android.os.Bundle
import androidx.fragment.app.Fragment
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.widget.Button
import android.widget.EditText
import androidx.navigation.Navigation

private const val ARG_PARAM1 = "param1"
private const val ARG_PARAM2 = "param2"

class Fragment_A : Fragment() {
    // TODO: Rename and change types of parameters
    private var param1: String? = null
    private var param2: String? = null

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        arguments?.let {
            param1 = it.getString(ARG_PARAM1)
            param2 = it.getString(ARG_PARAM2)
        }
    }

    override fun onCreateView(
        inflater: LayoutInflater, container: ViewGroup?,
        savedInstanceState: Bundle?
    ): View? {
        return inflater.inflate(R.layout.fragment__a, container, false)
    }

    override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
        super.onViewCreated(view, savedInstanceState)

        val messageET = view.findViewById<EditText>(R.id.ETmessageTaker)
        val enterBTN = view.findViewById<Button>(R.id.BTNenter)

        enterBTN.setOnClickListener{
            val action = Fragment_ADirections.actionFragmentAToFragmentB(messageET.text.toString())
            Navigation.findNavController(view).navigate(action)

        }

    }

    companion object {
        fun newInstance(param1: String, param2: String) =
            Fragment_A().apply {
                arguments = Bundle().apply {
                    putString(ARG_PARAM1, param1)
                    putString(ARG_PARAM2, param2)
                }
            }
    }
}

---XML code for first fragment:

<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context=".Fragment_A">

    <EditText
        android:id="@+id/ETmessageTaker"
        android:layout_width="0dp"
        android:layout_height="wrap_content"
        android:layout_margin="10dp"
        android:ems="10"
        android:hint="Message"
        android:inputType="textPersonName"
        android:minHeight="48dp"
        android:textSize="30sp"
        app:layout_constraintBottom_toBottomOf="parent"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toTopOf="parent" />

    <Button
        android:id="@+id/BTNenter"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_margin="5dp"
        android:text="Enter"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintTop_toBottomOf="@+id/ETmessageTaker" />
</androidx.constraintlayout.widget.ConstraintLayout>

---Kotlin code for second fragment :

package com.example.passingdata

import android.content.ContentValues.TAG
import android.os.Bundle
import android.os.Parcelable
import android.util.Log
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import androidx.fragment.app.Fragment
import androidx.navigation.Navigation
import androidx.navigation.fragment.navArgs
import androidx.recyclerview.widget.LinearLayoutManager
import com.example.passingdata.databinding.FragmentBBinding
import messageAdapter

private const val ARG_PARAM1 = "param1"
private const val ARG_PARAM2 = "param2"
var state: Parcelable? = null

class Fragment_B : Fragment() {
    // TODO: Rename and change types of parameters
    private var param1: String? = null
    private var param2: String? = null
    private val args:Fragment_BArgs by navArgs()
    private var _binding: FragmentBBinding? = null
    private val binding get() = _binding!!

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        arguments?.let {
            param1 = it.getString(ARG_PARAM1)
            param2 = it.getString(ARG_PARAM2)
        }
    }

    override fun onCreateView(
        inflater: LayoutInflater,
        container: ViewGroup?,
        savedInstanceState: Bundle?
    ): View? {
        _binding = FragmentBBinding.inflate(inflater, container, false)
        return binding.root
    }

    override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
        super.onViewCreated(view, savedInstanceState)

        val eachMessage = args.messageRecieved
        //putting words in TV
        binding.TVNewMessage.text = eachMessage

        //putting words in RV
        val messageList = mutableListOf(
            message(eachMessage)
        )
        val adapter = messageAdapter(messageList)
        binding.RVMessages.adapter = adapter
        binding.RVMessages.layoutManager = LinearLayoutManager(context)

        binding.BTNBack.setOnClickListener {
            Navigation.findNavController(view).navigate(R.id.action_fragment_B_to_fragment_A)
        }
    }

    companion object {
        fun newInstance(param1: String, param2: String) =
            Fragment_B().apply {
                arguments = Bundle().apply {
                    putString(ARG_PARAM1, param1)
                    putString(ARG_PARAM2, param2)
                }
            }
    }

    override fun onResume() {
        super.onResume()
        Log.d(TAG, "onResume Called")
        state = binding.RVMessages.layoutManager?.onSaveInstanceState();
    }

    override fun onPause() {
        super.onPause()
        Log.d(TAG, "onPause Called")
        state = binding.RVMessages.layoutManager?.onSaveInstanceState();

    }

    override fun onStop() {
        super.onStop()
        Log.d(TAG, "onStop Called")
        state = binding.RVMessages.layoutManager?.onSaveInstanceState();
    }

    override fun onDestroy() {
        super.onDestroy()
        Log.d(TAG, "onDestroy Called")
        _binding = null
    }
}

---XML code for second fragment:

<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context=".Fragment_B">

    <androidx.recyclerview.widget.RecyclerView
        android:id="@+id/RV_messages"
        android:layout_width="match_parent"
        android:layout_height="0dp"
        android:layout_marginBottom="20dp"
        app:layout_constraintBottom_toTopOf="@+id/TV_newMessage"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toTopOf="parent" />

    <TextView
        android:id="@+id/TV_newMessage"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginBottom="60dp"
        android:text="TextView"
        android:textSize="20sp"
        app:layout_constraintBottom_toBottomOf="parent"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintStart_toStartOf="parent" />

    <Button
        android:id="@+id/BTN_back"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginBottom="20dp"
        android:layout_marginRight="10dp"
        android:text="Back"
        app:layout_constraintBottom_toBottomOf="parent"
        app:layout_constraintEnd_toEndOf="parent" />

    <Button
        android:id="@+id/BTN_save"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginBottom="20dp"
        android:text="Save"
        app:layout_constraintBottom_toBottomOf="parent"
        app:layout_constraintStart_toStartOf="parent" />

</androidx.constraintlayout.widget.ConstraintLayout>

Someone suggested I override the 3 states and save them like this, but it did not work.

I even tried using SharedPrefrences but it gives me a error saying, "Unresolved reference: getSharedPrefrences".

override fun onResume() {
super.onResume()
Log.d(TAG, "onResume Called")
state = binding.RVMessages.layoutManager?.onSaveInstanceState();
}

override fun onPause() {
super.onPause()
Log.d(TAG, "onPause Called")
state = binding.RVMessages.layoutManager?.onSaveInstanceState();

}

override fun onStop() {
super.onStop()
Log.d(TAG, "onStop Called")
state = binding.RVMessages.layoutManager?.onSaveInstanceState();
}


问:
I am getting undefined symbol error while trying to import tensorflow_text in google colab
I have downloaded all dependencies but still unable to import import tensorflow_text for bert

installed all libraries and dependencies but still getting

NotFoundError:
/usr/local/lib/python3.8/dist-packages/tensorflow_text/python/metrics/_text_similarity_metric_ops.so:
undefined symbol:
_ZNK10tensorflow8OpKernel11TraceStringERKNS_15OpKernelContextEb


问:
Django-ckeditor5 how to set codeblock's programming languages in admin template
I am integrating django-ckeditor5 in my Django website but facing some difficulties with adjusting the programming languages that appears on the code-block drop-down from my admin.

I want to customize this section to only include programming languages like Python, SQL and JavaScript. I haven't seen a way to configure this via the setting.py file. Please, I need help.


问:
How to incorporate BIRT 4.9.0 into POM?
Scenario:

I am refactoring my application to work under java 17. Birt runtime 3.7.x is embedded in my application.

In updating to point to birt 4.9.0, I have updated my pom as follows:

```<code>        <dependency>
            <groupId>org.eclipse.birt</groupId>
            <artifactId>birt-runtime</artifactId>
            <version>4.9.0</version>
        </dependency>
        <!-- https://mvnrepository.com/artifact/org.eclipse.birt/birt-runtime-osgi -->
        <dependency>
            <groupId>org.eclipse.birt</groupId>
            <artifactId>birt-runtime-osgi</artifactId>
            <version>4.9.0</version>
        </dependency>
</code>```

When I build,  I get the exception

```<code>org.eclipse.birt:birt-runtime:jar:4.9.0 was not found in https://repo1.maven.org/maven2 during a previous attempt
</code>```

I have deleted and rebuilt my local .m2 directory.

When I dig around the maven repository I find the file at https://repo1.maven.org/maven2/org/eclipse/birt/birt-runtime/4.9.0/

This link (BiRT latest Runtime as one Maven Dependency for Eclipse) was resolved by manually downloading the file and pointing to a local copy.  I'd prefer to avoid that, since Maven is all about avoiding that kind of scenario.

I suspect there's something in the maven path I am missing.

Thank you in advance.

Title: How to incorporate BIRT 4.9.0 into POM?

Body:
Scenario:

I am refactoring my application to work under java 17. Birt runtime 3.7.x is embedded in my application.

In updating to point to birt 4.9.0, I have updated my pom as follows:

        <dependency>
            <groupId>org.eclipse.birt</groupId>
            <artifactId>birt-runtime</artifactId>
            <version>4.9.0</version>
        </dependency>

        <dependency>
            <groupId>org.eclipse.birt</groupId>
            <artifactId>birt-runtime-osgi</artifactId>
            <version>4.9.0</version>
        </dependency>

When I build,  I get the exception

org.eclipse.birt:birt-runtime:jar:4.9.0 was not found in https://repo1.maven.org/maven2 during a previous attempt

I have deleted and rebuilt my local .m2 directory.

When I dig around the maven repository I find the file at https://repo1.maven.org/maven2/org/eclipse/birt/birt-runtime/4.9.0/

This link (BiRT latest Runtime as one Maven Dependency for Eclipse) was resolved by manually downloading the file and pointing to a local copy.  I'd prefer to avoid that, since Maven is all about avoiding that kind of scenario.

I suspect there's something in the maven path I am missing.

Thank you in advance.


问:
HttpUrlConnection isn work with mobile data
I use httpUrlConnection to get information from the server. When I run it on Android, if the device is connected to Wi-Fi, there is no problem, but when I use mobile data, No information is received from the server.

My Codes:

```<code>new Thread(){

 @Override public void run(){

 try {
 URL u = new URL("https://api.jsonbin.io/v3/b/63a744c0dfc68e59d570253e");
 HttpURLConnection c = (HttpURLConnection) u.openConnection();
 c.setRequestMethod("GET");
 c.connect();
 InputStream in = c.getInputStream();
 final ByteArrayOutputStream bo = new ByteArrayOutputStream();
 final byte[] buffer = new byte[1024];
 in.read(buffer); // Read from Buffer.
 bo.write(buffer); // Write Into Buffer.

 runOnUiThread(new Runnable() {
 @Override
 public void run() {

     TextView t = findViewById(R.id.tv);
     t.setText("bo.toString");

 try
 {
 bo.close();
 }catch(IOException e){
 e.printStackTrace();
 } }
 });

 } catch (MalformedURLException e) {
 e.printStackTrace();

 } catch (ProtocolException e) {
 e.printStackTrace();

 } catch (IOException e) {
 e.printStackTrace();
 } }
 }.start();
</code>```

I tried different Internet operators  and I reinstalled application But again the information was not received.

Body:
I use httpUrlConnection to get information from the server. When I run it on Android, if the device is connected to Wi-Fi, there is no problem, but when I use mobile data, No information is received from the server.

My Codes:

new Thread(){

 @Override public void run(){

 try {
 URL u = new URL("https://api.jsonbin.io/v3/b/63a744c0dfc68e59d570253e");
 HttpURLConnection c = (HttpURLConnection) u.openConnection();
 c.setRequestMethod("GET");
 c.connect();
 InputStream in = c.getInputStream();
 final ByteArrayOutputStream bo = new ByteArrayOutputStream();
 final byte[] buffer = new byte[1024];
 in.read(buffer); // Read from Buffer.
 bo.write(buffer); // Write Into Buffer.

 runOnUiThread(new Runnable() {
 @Override
 public void run() {

     TextView t = findViewById(R.id.tv);
     t.setText("bo.toString");

 try
 {
 bo.close();
 }catch(IOException e){
 e.printStackTrace();
 } }
 });

 } catch (MalformedURLException e) {
 e.printStackTrace();

 } catch (ProtocolException e) {
 e.printStackTrace();

 } catch (IOException e) {
 e.printStackTrace();
 } }
 }.start();

I tried different Internet operators  and I reinstalled application But again the information was not received.


问:
lowdb change format database (SET)(PUSH)

I have this form look below
```<code>{
  "options": {
    "valueone": {
      "test": "okay"
    },
   "valuetwo": {
     "test": "okay"
}
  }
}
</code>```
```<code>const low = require('lowdb')
const FileSync = require('lowdb/adapters/FileSync')

const adapter = new FileSync('db.json')
const db = low(adapter)

const options = 'valueone' // or "valuetwo"
db.defaults({ options: {} })
  .write()
 db.set("options", {[options]: { test: 'okay'}}).write()

</code>```

I don't know how to rewrite to (PUSH) instead of (SET) because set updates or writes. and I need to add with exactly the same format. Friends, I can't do it anymore.
https://www.npmjs.com/package/lowdb/v/2.0.0

Body:
I have this form look below

{
  "options": {
    "valueone": {
      "test": "okay"
    },
   "valuetwo": {
     "test": "okay"
}
  }
}

const low = require('lowdb')
const FileSync = require('lowdb/adapters/FileSync')

const adapter = new FileSync('db.json')
const db = low(adapter)

const options = 'valueone' // or "valuetwo"
db.defaults({ options: {} })
  .write()
 db.set("options", {[options]: { test: 'okay'}}).write()

I don't know how to rewrite to (PUSH) instead of (SET) because set updates or writes. and I need to add with exactly the same format. Friends, I can't do it anymore.
https://www.npmjs.com/package/lowdb/v/2.0.0


问:
Mobile menu and Media Query
I have created a mobile version of my site with a hamburger menu.
The close icon and hamburger icon are not responding to media query selectors and neither can be made visible on top of the mobile menu.

.nav-open   is to be applied to the .page-header by Javascript to open the mobile menu.

```<code>**Html:**

<header class="page-header">
      <a href="index.html" class="menu-logo">
                <img
          src="images/header.footer/logo.png"
          alt="Easy Eddy's Tree Service Logo"/>
            </a>

    <nav class="menu">
        <ul class="menu-list">
          <li><a href="index.html">Home</a></li>
          <li><a href="history.html">Our History</a></li>
           <li><a href="about-us.html" title="About Us">About Us</a></li>
        </ul>
      </nav>

      <button class="menu-btn">
        <svg
          class="icon-mobile-nav"
          name="menu-outline"
        </svg>
        <svg
          class="icon-mobile-nav"
          name="close-outline"
        </svg>
      </button>

**
 css:**

    .page-header {
     position: relative;
}

    .menu-btn {
     display: none;
     border: none;
     background: none;
     cursor: pointer;
     align-self: center;
}

.icon-mobile-nav[name="close-outline"] {
  display: none;
}

**Media query css:**

.menu-btn {
    display: block;
  }

  .menu {
    background-color: rgb(189, 189, 189);
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    grid-column: 1 / -1;
    /* flex-direction: column; */
    transform: translateX(100%);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: all 0.5s ease-in;
    pointer-events: none;
    visibility: hidden;
    z-index: 1;
  }

  .nav-open .menu {
    opacity: 1;
    pointer-events: auto;
    visibility: visible;
    transform: translateX(0);
  }

  .nav-open .icon-mobile-nav[name="close-outline"] {
    display: block;
  }

  .nav-open .icon-mobile-nav[id="menu-outline"] {
    display: none;
  }

}

</code>```

the selectors at the bottom of media query are having no effect. - those reading .nav-open at the beginning.

Removing z-index from the page header did nothing to change visibility of menu icons

Changed "name" attribute on html and selectors to "title" and "id" - no change

changed the svg elements(which are hidden due to their size) to script-inserted icons- no change

edited .menu-btn style to display: block which only made the hamburger visible all the time(except when the menu was opened.
-changed the svg elements to p elements with text- no change in functionality

Title: Mobile menu and Media Query

Body:
I have created a mobile version of my site with a hamburger menu.
The close icon and hamburger icon are not responding to media query selectors and neither can be made visible on top of the mobile menu.

.nav-open   is to be applied to the .page-header by Javascript to open the mobile menu.

**Html:**

Home

Our History

About Us

      <button class="menu-btn">
        <svg
          class="icon-mobile-nav"
          name="menu-outline"
        </svg>
        <svg
          class="icon-mobile-nav"
          name="close-outline"
        </svg>
      </button>

**
 css:**

    .page-header {
     position: relative;
}

    .menu-btn {
     display: none;
     border: none;
     background: none;
     cursor: pointer;
     align-self: center;
}

.icon-mobile-nav[name="close-outline"] {
  display: none;
}

**Media query css:**

.menu-btn {
    display: block;
  }

  .menu {
    background-color: rgb(189, 189, 189);
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    grid-column: 1 / -1;
    /* flex-direction: column; */
    transform: translateX(100%);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: all 0.5s ease-in;
    pointer-events: none;
    visibility: hidden;
    z-index: 1;
  }

  .nav-open .menu {
    opacity: 1;
    pointer-events: auto;
    visibility: visible;
    transform: translateX(0);
  }

  .nav-open .icon-mobile-nav[name="close-outline"] {
    display: block;
  }

  .nav-open .icon-mobile-nav[id="menu-outline"] {
    display: none;
  }

}

the selectors at the bottom of media query are having no effect. - those reading .nav-open at the beginning.

Removing z-index from the page header did nothing to change visibility of menu icons

Changed "name" attribute on html and selectors to "title" and "id" - no change

changed the svg elements(which are hidden due to their size) to script-inserted icons- no change

edited .menu-btn style to display: block which only made the hamburger visible all the time(except when the menu was opened.
-changed the svg elements to p elements with text- no change in functionality


问:
how to make python argparse to accept not declared argument
I have a script that receives online arguments using argparse, like this:

```<code>parser = argparse.ArgumentParser()
parser.add_argument(
    "--local", action="store_true", help=("Write outputs to local disk.")
)

parser.add_argument(
    "--swe", action="store_true", help=("Indicates 'staging' environment.")
)

args = parser.parse_args()
</code>```

I want argparse to handle undeclared arguments and just to add them to the arguments dictionary, but it raises an error when I try python runner.py --local true --swe true --undeclared_argument this_is_a_test:

```<code>runner.py: error: unrecognized arguments: --undeclared_argument this_is_a_test
</code>```

Body:
I have a script that receives online arguments using argparse, like this:

parser = argparse.ArgumentParser()
parser.add_argument(
    "--local", action="store_true", help=("Write outputs to local disk.")
)

parser.add_argument(
    "--swe", action="store_true", help=("Indicates 'staging' environment.")
)

args = parser.parse_args()

I want argparse to handle undeclared arguments and just to add them to the arguments dictionary, but it raises an error when I try python runner.py --local true --swe true --undeclared_argument this_is_a_test:

runner.py: error: unrecognized arguments: --undeclared_argument this_is_a_test


问:
SharpDX SwapChain1 AccessViolationException
So I try to create a SwapChain1 in SharpDX.

Here is the Code:

```<code>

            SwapChainDescription1 desc = new()
            {
                Width = toSetSize.Value.Width,
                Height = toSetSize.Value.Height,
                Format = Format.R8G8B8A8_UNorm,
                Stereo = false,
                SampleDescription = new SampleDescription(1, 0),
                Usage = Usage.BackBuffer | Usage.RenderTargetOutput,
                BufferCount = 1,
                Scaling = Scaling.Stretch,
                SwapEffect = SwapEffect.Discard
            };

            SwapChainFullScreenDescription scd = new SwapChainFullScreenDescription()
            {
                RefreshRate = new Rational(60, 1),
                Scaling = DisplayModeScaling.Stretched,
                Windowed = false
            };

            using (var dxgiDevice2 = device.QueryInterface<SharpDX.DXGI.Device2>())
            using (var dxgiAdapter = dxgiDevice2.Adapter)
            using (var dxgiFactory2 = dxgiAdapter.GetParent<SharpDX.DXGI.Factory2>())
            {
                res = new SwapChain1(dxgiAdapter.GetParent<SharpDX.DXGI.Factory2>(), device, Window.Handle, ref desc, scd);
                return res;
            }
</code>```

my issue is, this code throws a AccessViolationException with the Attempted to read or write corrupted memory stuff.

What am i doing wrong?

How can i fix this?

I tried:

Changing the Parameters inside of "desc" and "scd"

Edit: So i got a step further, seemingly factory.NativePointer was IntPtr.Zero, i have updated the code, hope this helps...

Edit2: Okay one step closer, again, i enabled Debugging from native code and got this:

```<code>        Exception called at 0x759CE292 in Demo.exe: Microsoft C++ Exception: _com_error at location 0x0297C5B8.
        Exception called at 0x6BA81D22 (dxgi.dll) in Demo.exe: 0xC0000005: Access violation at position 0x000000B8.
</code>```

Untranslated (german):

```<code>        Ausnahme ausgelöst bei 0x759CE292 in Demo.exe: Microsoft C++-Ausnahme: _com_error bei Speicherort 0x0297C5B8.
        Ausnahme ausgelöst bei 0x6BA81D22 (dxgi.dll) in Demo.exe: 0xC0000005: Zugriffsverletzung beim Lesen an Position 0x000000B8.
</code>```

Body:
So I try to create a SwapChain1 in SharpDX.

Here is the Code:

            SwapChainDescription1 desc = new()
            {
                Width = toSetSize.Value.Width,
                Height = toSetSize.Value.Height,
                Format = Format.R8G8B8A8_UNorm,
                Stereo = false,
                SampleDescription = new SampleDescription(1, 0),
                Usage = Usage.BackBuffer | Usage.RenderTargetOutput,
                BufferCount = 1,
                Scaling = Scaling.Stretch,
                SwapEffect = SwapEffect.Discard
            };

            SwapChainFullScreenDescription scd = new SwapChainFullScreenDescription()
            {
                RefreshRate = new Rational(60, 1),
                Scaling = DisplayModeScaling.Stretched,
                Windowed = false
            };

            using (var dxgiDevice2 = device.QueryInterface<SharpDX.DXGI.Device2>())
            using (var dxgiAdapter = dxgiDevice2.Adapter)
            using (var dxgiFactory2 = dxgiAdapter.GetParent<SharpDX.DXGI.Factory2>())
            {
                res = new SwapChain1(dxgiAdapter.GetParent<SharpDX.DXGI.Factory2>(), device, Window.Handle, ref desc, scd);
                return res;
            }

my issue is, this code throws a AccessViolationException with the Attempted to read or write corrupted memory stuff.

What am i doing wrong?

How can i fix this?

I tried:

Changing the Parameters inside of "desc" and "scd"

Edit: So i got a step further, seemingly factory.NativePointer was IntPtr.Zero, i have updated the code, hope this helps...

Edit2: Okay one step closer, again, i enabled Debugging from native code and got this:

        Exception called at 0x759CE292 in Demo.exe: Microsoft C++ Exception: _com_error at location 0x0297C5B8.
        Exception called at 0x6BA81D22 (dxgi.dll) in Demo.exe: 0xC0000005: Access violation at position 0x000000B8.

Untranslated (german):

        Ausnahme ausgelöst bei 0x759CE292 in Demo.exe: Microsoft C++-Ausnahme: _com_error bei Speicherort 0x0297C5B8.
        Ausnahme ausgelöst bei 0x6BA81D22 (dxgi.dll) in Demo.exe: 0xC0000005: Zugriffsverletzung beim Lesen an Position 0x000000B8.


问:
Accidentally deleted almost all images from openshift image registry. What to do next?
I know I'll have to rebuild all my microservices images myself, but is there any way to recover the default images from openshift?

For example:
image-registry.openshift-image-registry.svc:5000/openshift/nginx

Under the openshift-image-registry project, there's 3 deployments:

cluster-image-registry-operator

image-registry

registry-nginx

Would restarting any of those do the trick?

I wanted to delete all images from a specific project, but because of an error in my logic, the grep filtering the project didn't work and so it started deleting all images in all projects.

By the time I realized what was going on it had already deleted maybe 70% of the whole registry.


问:
PERN stack deploying to Railway
Hi I've just finished a PERN project that I want to deploying using Railway, should be very easy according the people on the internet.

But I'm just so lost even to begin, I tried connecting to my Github, and I run into a an error already.

Then I wanted to try deploy my local postgres db first, so I set up the postgres db on railway, got the config pages and change my local postgres config to match railway...and then I'm lost

I tried searching on Youtuber and google, but it seems most people are either migrating from heroku, using django, or just not really showing how to deploy from beginning to end.

So I'm here looking for help to see if anyone could guide me to the right place (article or video) that actually shows or teaches how to deploy PERN stack to railway from step 1, which is after finishing the project locally.

A bit more info about the stack I'm using...

react 18

express.js

postgresql 14

node 16

BTW, I don't know if this is way I run into the first issue with Nixpacks, but I have my client (react) folder and server (express + postgres db) folder inside a project folder.

Thank you all so much, I appreciate all the help.

Title: PERN stack deploying to Railway


问:
how can i use group_by in text mining with r
I am just wondering why I cant use group_by() in corpus-text.
I tried using some packages too but at the end nothing.
Also tried to convert to tibble.

My code:

```<code>data <- data %>%
  group_by(Title) %>%
  mutate(line = row_number()) %>%
  ungroup()
</code>```

The output:

```<code>Error:
! All columns in a tibble must be vectors.
✖ Column `text` is a `corpus_text` object.
Run `rlang::last_error()` to see where the error occurred.
</code>```

Body:
I am just wondering why I cant use group_by() in corpus-text.
I tried using some packages too but at the end nothing.
Also tried to convert to tibble.

My code:

data <- data %>%
  group_by(Title) %>%
  mutate(line = row_number()) %>%
  ungroup()

The output:

Error:
! All columns in a tibble must be vectors.
✖ Column `text` is a `corpus_text` object.
Run `rlang::last_error()` to see where the error occurred.


问:
Firebase functions deploy failed: illegal operation on a directory, read
I am using the latest version of the firebase cli. About 2 hours ago the firebase deploy command was working fine, but then it randomly started giving the following error message even though I hadn't changed any code:

```<code>Error: EISDIR: illegal operation on a directory, read] {
  errno: -4068,
  code: 'EISDIR',
  syscall: 'read',
  methodName: 'constructor'
}
</code>```

I tried commenting out my entire cloud function, but the problem persisted. The only way I managed to fix the problem was by restarting my computer, but after that the next time I deployed my function I started getting the error again.

Body:
I am using the latest version of the firebase cli. About 2 hours ago the firebase deploy command was working fine, but then it randomly started giving the following error message even though I hadn't changed any code:

Error: EISDIR: illegal operation on a directory, read] {
  errno: -4068,
  code: 'EISDIR',
  syscall: 'read',
  methodName: 'constructor'
}

I tried commenting out my entire cloud function, but the problem persisted. The only way I managed to fix the problem was by restarting my computer, but after that the next time I deployed my function I started getting the error again.


问:
Only Install keras.utils without tensorflow
I just want to run some utility functions that comes with keras to preprocess my data, I don't need to train or run any model. Can I just install keras without tensorflow?</p>


问:
How to use SVM classifier with keras CNN model?
I am working on predicting seizure epilepsy using CNN. I have 2 classes in my dataset. I want to use CNN model as a feature extractor, then I want to use SVM as a classifier. I don't know how to do this with my model.

I am using mode.fit_generator in my model and I don't have x and y because I use generator for my data. How can I use the traditional SVM for my model?

My model

```<code> input_shape=(33,3840,1)
    model = Sequential()
    #C1
    model.add(Conv2D(16, (5, 5), strides=( 2, 2), padding='same',activation='relu',
    input_shape=input_shape))
    model.add(keras.layers.MaxPooling2D(pool_size=( 2, 2),  padding='same'))
    model.add(BatchNormalization())
    model.compile(loss=categorical_focal_loss(), optimizer=opt_adam, metrics=['accuracy'])
    history=model.fit_generator(generate_arrays_for_training(indexPat, train_data, start=0,end=100),
                                validation_data=generate_arrays_for_training(indexPat, test_data, start=0,end=100),
                                steps_per_epoch=int((len(train_data)/2)),
                                validation_steps=int((len(test_data)/2)),
                                verbose=2,epochs=65, max_queue_size=2, shuffle=True)
</code>```

I want to make SVM classifier as my final classifier in this model so how can I do that?

Any help would be appreciated.
Thanks in advance.

Body:
I am working on predicting seizure epilepsy using CNN. I have 2 classes in my dataset. I want to use CNN model as a feature extractor, then I want to use SVM as a classifier. I don't know how to do this with my model.

I am using mode.fit_generator in my model and I don't have x and y because I use generator for my data. How can I use the traditional SVM for my model?

My model

 input_shape=(33,3840,1)
    model = Sequential()
    #C1
    model.add(Conv2D(16, (5, 5), strides=( 2, 2), padding='same',activation='relu',
    input_shape=input_shape))
    model.add(keras.layers.MaxPooling2D(pool_size=( 2, 2),  padding='same'))
    model.add(BatchNormalization())
    model.compile(loss=categorical_focal_loss(), optimizer=opt_adam, metrics=['accuracy'])
    history=model.fit_generator(generate_arrays_for_training(indexPat, train_data, start=0,end=100),
                                validation_data=generate_arrays_for_training(indexPat, test_data, start=0,end=100),
                                steps_per_epoch=int((len(train_data)/2)),
                                validation_steps=int((len(test_data)/2)),
                                verbose=2,epochs=65, max_queue_size=2, shuffle=True)

I want to make SVM classifier as my final classifier in this model so how can I do that?

Any help would be appreciated.
Thanks in advance.


问:
NestJS @Sse: Return values from a third party API using @nestjs/axios
I am learning Nestjs and got an eye on the SSE section of the docs.

I wanted to expand a little bit and return data from a third party API which in this case is not relevant. I am using the HttpModule provided by @nestjs/axios for requesting the data.

Thing is that I am getting confused a lot with the RXJS stuff as I am learning and don't know what to do next.

The method of the service that I am using to request data from the API looks like this:

```<code>get() {

    return this.httpService.get(url)
}
</code>```

And the SSE method inside the controller is like this:

```<code>  @Sse('sse')
  sse(): Observable<MessageEvent> {

    return interval(1000).pipe(
      map((_) => ({ data: { ...this.sseService.get() } } as MessageEvent))
    );

  }
</code>```

And of course I get nothing. I know there is some stuff I have to add but honestly have no idea what it is.

Body:
I am learning Nestjs and got an eye on the SSE section of the docs.

I wanted to expand a little bit and return data from a third party API which in this case is not relevant. I am using the HttpModule provided by @nestjs/axios for requesting the data.

Thing is that I am getting confused a lot with the RXJS stuff as I am learning and don't know what to do next.

The method of the service that I am using to request data from the API looks like this:

get() {

    return this.httpService.get(url)
}

And the SSE method inside the controller is like this:

  @Sse('sse')
  sse(): Observable<MessageEvent> {

    return interval(1000).pipe(
      map((_) => ({ data: { ...this.sseService.get() } } as MessageEvent))
    );

  }

And of course I get nothing. I know there is some stuff I have to add but honestly have no idea what it is.