javascript – Magento2: Sometime js load sometime js not load properly

I got the JS error in console. Sometime when page load got the JS error and Sometime when page load it is working. I don’t know what the exact issue. I disabled all 3rd party extension after that got the same error on the website.

Please let me we need to upgrade jquery version.

Plesae see the screenshot below.

enter image description here

Plesae help me on this.

Using Bootstrap’s thumbnail feature / How to use them properly?

I have made some google search and could not find a clear explanation for a complete beginner like me.

bootstrap’s page provides the following HTML to create a clickable thumbnail:

<div class="row">
  <div class="col-xs-6 col-md-3">
    <a href="#" class="thumbnail">
      <img src="https://drupal.stackexchange.com/..." alt="http://drupal.stackexchange.com/...">
    </a>
  </div>
  ...
</div>

but it does not tell me where to put it. For example, I am trying to create a homepage where there will be like 220×220 pxs images which will send the visitor to another page of the site when any of them is clicked.
I have accomplished this using the code below inside the content’s body field that I have created and placed them horizontally using Views Module in table & grid setting.

<p>
 <a href="http://drupal.stackexchange.com/plant-nutrition">
  <img alt="Responsive image" class="img-responsive" data-entity-type="file" data-entity-uuid="948cd381-a04e-499e-95fb-e3e8704418fa" src="https://drupal.stackexchange.com/sites/default/files/inline-images/picture.jpg" />
 </a>
</p>

What is the best practice of achieving my goal here? Should I use bootstrap’s grid and then use the html provided by the bootstrap above? If I do so I end up with a clickable thumbnail inside an unclickable thumbnail (which is created by the View’s page)

Windows Touchscreen drivers not working properly

I’m currently using Windows 10 on a tablet/PC, the touch screen feature used to work flawlessly on the original install of Windows 10 which came with the device. But after I tried to install Ubuntu I couldn’t login on Windows anymore and had to make a fresh install, but now the driver doesn’t work properly anymore with the screen touch commands mirrored, apparently divided in half and the cursor moving on the opposite direction of my finger. I tried to install the drivers from the Windows update catalogue and the ones made available by the manufacturer, but the screen behave even more strangely or no change was perceived. I think the device is a Silead Touch L2c.

  • Is there a way to check the device (Touchscreen) model on my machine?
  • What is the correct way to install a driver having the *.sys and *.fw files.
  • Can You think of any possible solution? The manufacturer offered to collect my device for technical assistance, but I can’t allow being without my device at the moment.

entities – How to properly manage field types for a content type created by a module for Drupal 9?

I’m a bit confused about two different errors I get, which seem to contradict each other. I guess I didn’t register my field types properly. The first one appears when I try to uninstall my module.

DrupalCoreFieldFieldException: Attempt to create a field field_example that does not exist on entity type node. in DrupalfieldEntityFieldConfig->getFieldStorageDefinition() (line 312 of coremodulesfieldsrcEntityFieldConfig.php).

The second one appears as an error message within the UI when I try to fix it by introducing another module which should only create the field type.

Unable to install Helper, field.field.node.content_type_example.field_example already exists in active configuration.

In general, the module calls an external API and fetches data which is then used to create nodes with several fields. These are defined inside the config/install directory. Furthermore, inside src/Plugin/Field there are FieldType, FieldFormatter and FieldWidget classes, more or less as described here.

I used this module when I tried to fix the first error without a helper module. With its help, I removed the field types created by my module in the first place. Unfortunately, I don’t know a lot about drush, which seems to be capable of solving the issue. On the other hand, it would be great if it was possible to “reset” the content type and the field types programmatically whenever the module is installed or uninstalled. So far, I tried the following code, without much luck:

<?php
// mymodule.install file
use DrupalfieldEntityFieldStorageConfig;

function mymodule_install() {
  if (FieldStorageConfig::loadByName('node', 'field_example')) {
    FieldStorageConfig::loadByName('node', 'field_example')->delete();
  }
}

Does someone know how I can fix the error and how I should manage these fields in the future? Thanks!

Why does the sendmsg code not work properly?

I’ve been trying to get where my bot says something in a certain channel by copying the channel ID, and using .sendmsg (ID) (message) , but for some reason, all I get is the else code of “Please specify a channel in the server!”
Here’s the code I have for it:

         elif message.content.startswith('{}sendmsg'.format(self.__cfg.pfx)):
            await message.delete()
            parts = message.content.split(' ')
            channel = self.__cfg.get_server().get_channel(parts(1))
            if channel:
                msg = ''
                for k in range(2, len(parts)):
                    msg += parts(k) + ' '

                await channel.send(msg)
            else:
                await message.channel.send('Please specify a channel in this server')
            return

nikon – Recovering a video file that was never closed properly?

The situation has happened a few times now. My Camera a Nikon d5600 will occasionally give me a message about the battery not being being a Nikon battery and shut down the power. (It is an OEM Nikon battery) and another time when I was plugged in with the camera and accidentally pulled the plug. Anyway power went off in the middle of shooting a time lapse and the file was lost.

So I have looked around at recovery software and it seems all the stuff I can find is for recovering deleted files. While there maybe something that works to recover a file that was not deleted but not saved properly, I cannot find it with the free stuff. I don’t mind paying for software but it is not clear if the software will work in my situation and I don’t want to put cash out for a none solution. If you have been able to recover a file in this kind of situation I would appreciate knowing the software you used. I hate to be picky about an answer but if you have not actually had and fixed this particular problem you might be mudding the solution with conjecture.

internal sd – SDcard not mounted properly in device

I have an Android 8.1 device (encrypted, not rooted) that is configured to use an SD card as internal storage. That SDcard broke down and needed to be replaced.

After inserting a fresh replacement card, the device recognized it and asked how it should be formatted. I chose “internal”, and the format went though without issues. The card shows up under “Storage” with the correct capacity, just as the old one did.

However, using this card is not possible. All apps that try to access it (like camera, browser downloads, file managers) show “SD card not available” errors.

When I connect to the device through adb shell to check how the file systems are mounted, I can see a difference. This is what shows up when the old card is inserted:

/ $ mount
(...)
/dev/block/dm-3 on /mnt/expand/beb7cb3c-0c09-43cf-83b8-ce1eac90a92b type ext4 (rw,dirsync,seclabel,nosuid,nodev,noatime)
/mnt/expand/beb7cb3c-0c09-43cf-83b8-ce1eac90a92b/media on /mnt/runtime/default/emulated type sdcardfs (rw,nosuid,nodev,noexec,noatime,fsuid=1023,fsgid=1023,gid=1015,multiuser,mask=6,derive_gid)
/mnt/expand/beb7cb3c-0c09-43cf-83b8-ce1eac90a92b/media on /storage/emulated type sdcardfs (rw,nosuid,nodev,noexec,noatime,fsuid=1023,fsgid=1023,gid=1015,multiuser,mask=6,derive_gid)
/mnt/expand/beb7cb3c-0c09-43cf-83b8-ce1eac90a92b/media on /mnt/runtime/read/emulated type sdcardfs (rw,nosuid,nodev,noexec,noatime,fsuid=1023,fsgid=1023,gid=9997,multiuser,mask=23,derive_gid)
/mnt/expand/beb7cb3c-0c09-43cf-83b8-ce1eac90a92b/media on /mnt/runtime/write/emulated type sdcardfs (rw,nosuid,nodev,noexec,noatime,fsuid=1023,fsgid=1023,gid=9997,multiuser,mask=7,derive_gid)
/ $

and this appears when the new card is inserted:

/ $ mount 
(...)
/dev/block/dm-3 on /mnt/expand/49d563a3-0905-4173-a1b3-8c29e3917d2c type ext4 (rw,dirsync,seclabel,nosuid,nodev,noatime,data=ordered)
/ $

So it seems the new card is not initialized correctly and/or several directories do not get mounted for whatever reason.

Things I tried to no avail:

  • re-formatting the card
  • eject, mount
  • reboot the device
  • ran sm partition disk:179,64 private in adb shell just to see if there are any errors on the console (via) – there is no error

What’s going on here and what else can I do to make the card work?

Why does Google Sheets Conditional Formatting not apply properly to all cells?

Alright, so I’ve been having this issue for a few hours now and am confident to say that I can’t fix it by myself.

I’ve been playing around with Google Sheets trying to apply Conditional Formatting when another referenced cell is not empty.

Here’s an image of the issue, it will definitely help you understand what I’m trying to do.

However, here’s what happens when I do the following two things (using an IF function to determine the state and then parse the true or false state towards the Conditional Formatting rule), here’s where the broken magic comes into play.

When I set it to =IF(ISBLANK(B2), false, true), this happens.
But when I reverse it and set it to =IF(ISBLANK(B2), true, false), this happens again.

I am lost to why this happens as from what you can see in the screenshots, B2 is never empty.

EDIT: For whatever reason, when I set it to =IF(ISBLANK(B2), true, true), it works as expected, as seen here. I would still like to hear an explanation if anybody has one.

entities – Current Logged In user id not working properly Drupal 8

First, I want to disclose that I am a beginner in Drupal.

I’m having trouble getting to work the current logged in user id. I’m creating a menu link programmatically and adding the uri to go to ‘/user/userid/edit’. First of all, I should mention that it works at first, but then I get a bizarre behavior. I have two users for this test account. user1 has an id of 7, and user2 has an ID of 8. When I log in as user1, everything seems to be working properly, I hover over the menu link and it shows ID of 7. But then when I log out, and log in as user2 and when I hover over the menu link, I still see ID of 7 instead of ID of 8. I don’t know why that is.

I added a picture down below so that you can see visually of what I’m talking about. The arrow that is pointing to the ‘edit’ link under user2, that link always works and gets the user ID each and every time I log out and log in between the two users. I don’t mind putting that link in my menu, but I don’t know how.

enter image description here

The code below is where I’m creating the menu link and adding the ID of the “currently” logged in user.

<?php

namespace Drupalcurrent_user_idPluginMenu;

use DrupalCoreMenuMenuLinkDefault;
use DrupalCoreMenuStaticMenuLinkOverridesInterface;
use DrupalCoreSessionAccountInterface;
use DrupalCoreUrl;
use SymfonyComponentDependencyInjectionContainerInterface;
use DrupalCoreSessionAccountProxyInterface;
use DrupaluserEntityUser;

class UserOrdersMenuLink extends MenuLinkDefault {

  protected $currentUser;

  public function __construct(array $configuration, $plugin_id, $plugin_definition, StaticMenuLinkOverridesInterface $static_override, AccountInterface $current_user) {
    parent::__construct($configuration, $plugin_id, $plugin_definition, $static_override);

    $this->currentUser = $current_user;
  }

  public static function create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition) {
    return new static(
      $configuration,
      $plugin_id,
      $plugin_definition,
      $container->get('menu_link.static.overrides'),
      $container->get('current_user')
    );
  }

  public function getTitle() {
    return $this->t('Edit Profile');
  }

  public function getUrlObject($title_attribute = TRUE) {

    $con = mysqli_connect("localhost","root","");
    if (!$con){die('Could not connect: ' . mysqli_error());}
    mysqli_select_db($con,"drupal");

    $sid = session_id();
    $userline = mysqli_query($con,"SELECT uid FROM sessions WHERE sid='$sid'");
    $u_row = mysqli_fetch_assoc($userline);
    $uid = $u_row('uid');

var_dump($uid);
    //$current_user_ID = $this->currentUser->id();

    //$account = DrupaluserEntityUser::load(Drupal::service('session')->get('uid'));


    //$user = DrupaluserEntityUser::load(Drupal::service('session')->get('uid'));

    //$uid = $user->get('uid')->value;

    //var_dump(session_id());

    return Url::fromUri('internal:/user/' . $uid . '/edit');
  }

}

The commented code is code that I tried; I got them in drupal stackexchange or stackoverflow basically where people were having similar issue as what I’m facing.

I tried connecting to the database and fetching out the user the old way, and even that failed. I get a ‘NULL NULL’

If you guys can help me out, I’d really appreciate it! Thank you!

authentication – How to properly invalidate JWT tokens and sessions in this use case?

I am building a web app, which is made of a Node.js Backend and Angular (NOT AngularJS!!! I only used the tag, because Angular was not available..) Frontend.

How do I properly secure this app? I already have an idea to use JWT tokens (I already implemented this) with a set expiration date, which will be way longer than the Frontend timer. The frontend timer should be like 15 minutes of inactivity. But how do I secure this Frontend timer against RAM modification with tools like Cheat Engine and also JavaScript modification/injection/editing? Are there any flaws in this logic? Any suggestions?

I was thinking of renewing JWT tokens, but that’s apparently not possible. I am sure there’s something wrong with my logic but I can’t put my finger on it. Maybe I am lacking general sessions and their management?