text:
Q: Does anyone have a working example of a GATT HID Keyboard Server using BLUEZ? I'm using my Raspbery PI4-b with Raspian Lite distro to write a virtual keyboard using BLUEZ to create a GATT HID (HOGP) Service.
I've taken the GATT sample code for a heart rate monitor service provided by BLUEZ and modified it to add Services and Characteristics to try and make my GATT HID Keyboard Server.
I did the best I could to get my server working but can't quite figure it out. So was wondering if anyone has a working example of this type service I could work from?
I have my server connecting ok to Windows 10 and my Android phone as a ble keyboard peripheral, but neither client will start the report characteristic notify function so i can start sending reports containing key press data.
THANKS!!! In advance for any help.
The code I created from the BLUEZ heart monitor sample:
#!/usr/bin/env python3
# SPDX-License-Identifier: LGPL-2.1-or-later

import time
import dbus, dbus.exceptions
import dbus.mainloop.glib
import dbus.service

import array
try:
  from gi.repository import GObject
except ImportError:
  import gobject as GObject
import sys

from random import randint

mainloop = None
hidService = None

BLUEZ_SERVICE_NAME = 'org.bluez'
GATT_MANAGER_IFACE = 'org.bluez.GattManager1'
DBUS_OM_IFACE =      'org.freedesktop.DBus.ObjectManager'
DBUS_PROP_IFACE =    'org.freedesktop.DBus.Properties'

GATT_SERVICE_IFACE = 'org.bluez.GattService1'
GATT_CHRC_IFACE =    'org.bluez.GattCharacteristic1'
GATT_DESC_IFACE =    'org.bluez.GattDescriptor1'

class InvalidArgsException(dbus.exceptions.DBusException):
    _dbus_error_name = 'org.freedesktop.DBus.Error.InvalidArgs'

class NotSupportedException(dbus.exceptions.DBusException):
    _dbus_error_name = 'org.bluez.Error.NotSupported'

class NotPermittedException(dbus.exceptions.DBusException):
    _dbus_error_name = 'org.bluez.Error.NotPermitted'

class InvalidValueLengthException(dbus.exceptions.DBusException):
    _dbus_error_name = 'org.bluez.Error.InvalidValueLength'

class FailedException(dbus.exceptions.DBusException):
    _dbus_error_name = 'org.bluez.Error.Failed'

class Application(dbus.service.Object):
    """
    org.bluez.GattApplication1 interface implementation
    """
    def __init__(self, bus):

        self.path = '/'
        self.services = []
        dbus.service.Object.__init__(self, bus, self.path)

        self.add_service(HIDService(bus, 0))
        self.add_service(DeviceInfoService(bus, 1))
        self.add_service(BatteryService(bus, 2))
        #self.add_service(TestService(bus, 3))

    def get_path(self):
        return dbus.ObjectPath(self.path)

    def add_service(self, service):
        self.services.append(service)

    @dbus.service.method(DBUS_OM_IFACE, out_signature='a{oa{sa{sv}}}')
    def GetManagedObjects(self):
        response = {}
        print('GetManagedObjects')

        for service in self.services:
            response[service.get_path()] = service.get_properties()
            chrcs = service.get_characteristics()
            for chrc in chrcs:
                response[chrc.get_path()] = chrc.get_properties()
                descs = chrc.get_descriptors()
                for desc in descs:
                    response[desc.get_path()] = desc.get_properties()

        return response

class Service(dbus.service.Object):
    """
    org.bluez.GattService1 interface implementation
    """
    PATH_BASE = '/org/bluez/example/service'

    def __init__(self, bus, index, uuid, primary):
        self.path = self.PATH_BASE + str(index)
        self.bus = bus
        self.uuid = uuid
        self.primary = primary
        self.characteristics = []
        dbus.service.Object.__init__(self, bus, self.path)

    def get_properties(self):
        return {
                GATT_SERVICE_IFACE: {
                        'UUID': self.uuid,
                        'Primary': self.primary,
                        'Characteristics': dbus.Array(
                                self.get_characteristic_paths(),
                                signature='o')
                }
        }

    def get_path(self):
        return dbus.ObjectPath(self.path)

    def add_characteristic(self, characteristic):
        self.characteristics.append(characteristic)

    def get_characteristic_paths(self):
        result = []
        for chrc in self.characteristics:
            result.append(chrc.get_path())
        return result

    def get_characteristics(self):
        return self.characteristics

    @dbus.service.method(DBUS_PROP_IFACE,
                         in_signature='s',
                         out_signature='a{sv}')
    def GetAll(self, interface):
        if interface != GATT_SERVICE_IFACE:
            raise InvalidArgsException()

        return self.get_properties()[GATT_SERVICE_IFACE]

class Characteristic(dbus.service.Object):
    """
    org.bluez.GattCharacteristic1 interface implementation
    """
    def __init__(self, bus, index, uuid, flags, service):
        self.path = service.path + '/char' + str(index)
        self.bus = bus
        self.uuid = uuid
        self.service = service
        self.flags = flags
        self.descriptors = []
        dbus.service.Object.__init__(self, bus, self.path)

    def get_properties(self):
        return {
                GATT_CHRC_IFACE: {
                        'Service': self.service.get_path(),
                        'UUID': self.uuid,
                        'Flags': self.flags,
                        'Descriptors': dbus.Array(
                                self.get_descriptor_paths(),
                                signature='o')
                }
        }

    def get_path(self):
        return dbus.ObjectPath(self.path)

    def add_descriptor(self, descriptor):
        self.descriptors.append(descriptor)

    def get_descriptor_paths(self):
        result = []
        for desc in self.descriptors:
            result.append(desc.get_path())
        return result

    def get_descriptors(self):
        return self.descriptors

    @dbus.service.method(DBUS_PROP_IFACE,
                         in_signature='s',
                         out_signature='a{sv}')
    def GetAll(self, interface):
        if interface != GATT_CHRC_IFACE:
            raise InvalidArgsException()

        return self.get_properties()[GATT_CHRC_IFACE]

    @dbus.service.method(GATT_CHRC_IFACE,
                        in_signature='a{sv}',
                        out_signature='ay')
    def ReadValue(self, options):
        print('Default ReadValue called, returning error')
        raise NotSupportedException()

    @dbus.service.method(GATT_CHRC_IFACE, in_signature='aya{sv}')
    def WriteValue(self, value, options):
        print('Default WriteValue called, returning error')
        raise NotSupportedException()

    @dbus.service.method(GATT_CHRC_IFACE)
    def StartNotify(self):
        print('Default StartNotify called, returning error')
        raise NotSupportedException()

    @dbus.service.method(GATT_CHRC_IFACE)
    def StopNotify(self):
        print('Default StopNotify called, returning error')
        raise NotSupportedException()

    @dbus.service.signal(DBUS_PROP_IFACE,
                         signature='sa{sv}as')
    def PropertiesChanged(self, interface, changed, invalidated):
        pass

class Descriptor(dbus.service.Object):
    """
    org.bluez.GattDescriptor1 interface implementation
    """
    def __init__(self, bus, index, uuid, flags, characteristic):
        self.path = characteristic.path + '/desc' + str(index)
        self.bus = bus
        self.uuid = uuid
        self.flags = flags
        self.chrc = characteristic
        dbus.service.Object.__init__(self, bus, self.path)

    def get_properties(self):
        return {
                GATT_DESC_IFACE: {
                        'Characteristic': self.chrc.get_path(),
                        'UUID': self.uuid,
                        'Flags': self.flags,
                }
        }

    def get_path(self):
        return dbus.ObjectPath(self.path)

    @dbus.service.method(DBUS_PROP_IFACE,
                         in_signature='s',
                         out_signature='a{sv}')
    def GetAll(self, interface):
        if interface != GATT_DESC_IFACE:
            raise InvalidArgsException()

        return self.get_properties()[GATT_DESC_IFACE]

    @dbus.service.method(GATT_DESC_IFACE,
                        in_signature='a{sv}',
                        out_signature='ay')
    def ReadValue(self, options):
        print ('Default ReadValue called, returning error')
        raise NotSupportedException()

    @dbus.service.method(GATT_DESC_IFACE, in_signature='aya{sv}')
    def WriteValue(self, value, options):
        print('Default WriteValue called, returning error')
        raise NotSupportedException()

class BatteryService(Service):
    """
    Fake Battery service that emulates a draining battery.

    """
    SERVICE_UUID = '180f'

    def __init__(self, bus, index):
        Service.__init__(self, bus, index, self.SERVICE_UUID, True)
        self.add_characteristic(BatteryLevelCharacteristic(bus, 0, self))

class BatteryLevelCharacteristic(Characteristic):
    """
    Fake Battery Level characteristic. The battery level is drained by 2 points
    every 5 seconds.

    """
    BATTERY_LVL_UUID = '2a19'

    def __init__(self, bus, index, service):
        Characteristic.__init__(
                self, bus, index,
                self.BATTERY_LVL_UUID,
                ['read', 'notify'],
                service)
        self.notifying = False
        self.battery_lvl = 100
        self.timer = GObject.timeout_add(30000, self.drain_battery)

    def notify_battery_level(self):
        if not self.notifying:
            return
        self.PropertiesChanged(
                GATT_CHRC_IFACE,
                { 'Value': [dbus.Byte(self.battery_lvl)] }, [])

    def drain_battery(self):
        if not self.notifying:
            return True
        if self.battery_lvl > 0:
            self.battery_lvl -= 2
            if self.battery_lvl < 5:
                #self.battery_lvl = 0
                GObject.source_remove(self.timer)

        print('Battery Level drained: ' + repr(self.battery_lvl))
        self.notify_battery_level()
        return True

    def ReadValue(self, options):
        print('Battery Level read: ' + repr(self.battery_lvl))
        return [dbus.Byte(self.battery_lvl)]

    def StartNotify(self):
        if self.notifying:
            print('Already notifying, nothing to do')
            return

        self.notifying = True
        self.notify_battery_level()

    def StopNotify(self):
        if not self.notifying:
            print('Not notifying, nothing to do')
            return

        self.notifying = False

#sourceId="org.bluetooth.service.device_information" type="primary" uuid="180A"
class DeviceInfoService(Service):

    SERVICE_UUID = '180A'

    def __init__(self, bus, index):
        Service.__init__(self, bus, index, self.SERVICE_UUID, True)
        self.add_characteristic(VendorCharacteristic(bus, 0, self))
        self.add_characteristic(ProductCharacteristic(bus, 1, self))
        self.add_characteristic(VersionCharacteristic(bus, 2, self))

#name="Manufacturer Name String" sourceId="org.bluetooth.characteristic.manufacturer_name_string" uuid="2A29"
class VendorCharacteristic(Characteristic):

    CHARACTERISTIC_UUID = '2A29'

    def __init__(self, bus, index, service):
        Characteristic.__init__(
                self, bus, index,
                self.CHARACTERISTIC_UUID,
                ["read"],
                service)

        self.value = dbus.Array('HodgeCode'.encode(), signature=dbus.Signature('y'))
        print(f'***VendorCharacteristic value***: {self.value}')

    def ReadValue(self, options):
        print(f'Read VendorCharacteristic: {self.value}')
        return self.value

#sourceId="org.bluetooth.characteristic.model_number_string" uuid="2A24"
class ProductCharacteristic(Characteristic):

    CHARACTERISTIC_UUID = '2A24'

    def __init__(self, bus, index, service):
        Characteristic.__init__(
                self, bus, index,
                self.CHARACTERISTIC_UUID,
                ["read"],
                service)

        self.value = dbus.Array('smartRemotes'.encode(), signature=dbus.Signature('y'))
        print(f'***ProductCharacteristic value***: {self.value}')

    def ReadValue(self, options):
        print(f'Read ProductCharacteristic: {self.value}')
        return self.value

#sourceId="org.bluetooth.characteristic.software_revision_string" uuid="2A28"
class VersionCharacteristic(Characteristic):

    CHARACTERISTIC_UUID = '2A28'

    def __init__(self, bus, index, service):
        Characteristic.__init__(
                self, bus, index,
                self.CHARACTERISTIC_UUID,
                ["read"],
                service)

        self.value = dbus.Array('version 1.0.0'.encode(), signature=dbus.Signature('y'))
        print(f'***VersionCharacteristic value***: {self.value}')

    def ReadValue(self, options):
        print(f'Read VersionCharacteristic: {self.value}')
        return self.value

#name="Human Interface Device" sourceId="org.bluetooth.service.human_interface_device" type="primary" uuid="1812"
class HIDService(Service):
    SERVICE_UUID = '1812'

    def __init__(self, bus, index, application):
        Service.__init__(self, bus, index, self.SERVICE_UUID, True)

        self.parent = application
        self.protocolMode = ProtocolModeCharacteristic(bus, 0, self)
        self.hidInfo = HIDInfoCharacteristic(bus, 1, self)
        self.controlPoint = ControlPointCharacteristic(bus, 2, self)
        self.report = ReportCharacteristic(bus, 3, self)
        self.reportMap = ReportMapCharacteristic(bus, 4, self)

        self.add_characteristic(self.protocolMode)
        self.add_characteristic(self.hidInfo)
        self.add_characteristic(self.controlPoint)
        self.add_characteristic(self.report)
        self.add_characteristic(self.reportMap)

        self.protocolMode.ReadValue({})

#name="Protocol Mode" sourceId="org.bluetooth.characteristic.protocol_mode" uuid="2A4E"
class ProtocolModeCharacteristic(Characteristic):

    CHARACTERISTIC_UUID = '2A4E'

    def __init__(self, bus, index, service):

        Characteristic.__init__(
                self, bus, index,
                self.CHARACTERISTIC_UUID,
                ["read", "write-without-response"],
                service)

        #self.value = dbus.Array([1], signature=dbus.Signature('y'))
        self.parent = service
        self.value = dbus.Array(bytearray.fromhex('01'), signature=dbus.Signature('y'))
        print(f'***ProtocolMode value***: {self.value}')
        print('********', service.parent)

    def ReadValue(self, options):
        print(f'Read ProtocolMode: {self.value}')
        return self.value

    def WriteValue(self, value, options):
        print(f'Write ProtocolMode {value}')
        self.value = value

#sourceId="org.bluetooth.characteristic.hid_control_point" uuid="2A4C"
class ControlPointCharacteristic(Characteristic):

    CHARACTERISTIC_UUID = '2A4C'

    def __init__(self, bus, index, service):
        Characteristic.__init__(
                self, bus, index,
                self.CHARACTERISTIC_UUID,
                ["write-without-response"],
                service)

        self.value = dbus.Array(bytearray.fromhex('00'), signature=dbus.Signature('y'))
        print(f'***ControlPoint value***: {self.value}')

    def WriteValue(self, value, options):
        print(f'Write ControlPoint {value}')
        self.value = value

#id="hid_information" name="HID Information" sourceId="org.bluetooth.characteristic.hid_information" uuid="2A4A"
class HIDInfoCharacteristic(Characteristic):

    CHARACTERISTIC_UUID = '2A4A'

    def __init__(self, bus, index, service):
        Characteristic.__init__(
                self, bus, index,
                self.CHARACTERISTIC_UUID,
                ['read'],
                service)

        self.value = dbus.Array(bytearray.fromhex('01110002'), signature=dbus.Signature('y'))
        print(f'***HIDInformation value***: {self.value}')

    def ReadValue(self, options):
        print(f'Read HIDInformation: {self.value}')
        return self.value

#sourceId="org.bluetooth.characteristic.report_map" uuid="2A4B"
class ReportMapCharacteristic(Characteristic):

    CHARACTERISTIC_UUID = '2A4B'

    def __init__(self, bus, index, service):
        Characteristic.__init__(
                self, bus, index,
                self.CHARACTERISTIC_UUID,
                ['read'],
                service)

        self.parent = service
        #self.value = dbus.Array(bytearray.fromhex('05010906a101850175019508050719e029e715002501810295017508810395057501050819012905910295017503910395067508150026ff000507190029ff8100c0050C0901A101850275109501150126ff0719012Aff078100C005010906a101850375019508050719e029e715002501810295017508150026ff000507190029ff8100c0'), signature=dbus.Signature('y'))
        self.value = dbus.Array(bytearray.fromhex('05010906a101050719e029e71500250175019508810295017508810195067508150025650507190029658100c0'), signature=dbus.Signature('y'))
        print(f'***ReportMap value***: {self.value}')

    def ReadValue(self, options):
        print(f'Read ReportMap: {self.value}')
        return self.value

#id="report" name="Report" sourceId="org.bluetooth.characteristic.report" uuid="2A4D"
class ReportCharacteristic(Characteristic):

    CHARACTERISTIC_UUID = '2A4D'

    def __init__(self, bus, index, service):
        Characteristic.__init__(
                self, bus, index,
                self.CHARACTERISTIC_UUID,
                ['read', 'notify'],
                service)

        #self.add_descriptor(ClientConfigurationDescriptor(bus, 0, self))
        self.add_descriptor(ReportReferenceDescriptor(bus, 1, self))

        #[ 0xA1, reportNum, 0, 0, 0, 0, 0, 0, 0, 0 ]
        #self.value = dbus.Array(bytearray.fromhex('00000000000000000000'), signature=dbus.Signature('y'))
        self.value = dbus.Array(bytearray.fromhex('0000000000000000'), signature=dbus.Signature('y'))
        print(f'***Report value***: {self.value}')

        self.notifying = False
        #self.battery_lvl = 100
        #GObject.timeout_add(5000, self.drain_battery)

    def send(self, value='Hey'):
        print(f'***send*** {value}');
        self.payload = dbus.Array(bytearray.fromhex('a100004800000000'))
        self.PropertiesChanged(GATT_CHRC_IFACE, { 'Value': self.payload }, [])

        print(f'***sent***');

    def ReadValue(self, options):
        print(f'Read Report: {self.value}')
        return self.value

    def WriteValue(self, value, options):
        print(f'Write Report {self.value}')
        self.value = value

    def StartNotify(self):
        print(f'Start Notify')
        if self.notifying:
            print('Already notifying, nothing to do')
            return

        self.notifying = True
        self.notify_battery_level()

    def StopNotify(self):
        print(f'Stop Notify')
        if not self.notifying:
            print('Not notifying, nothing to do')
            return

        self.notifying = False

#name="Client Characteristic Configuration" sourceId="org.bluetooth.descriptor.gatt.client_characteristic_configuration" uuid="2902"
class ClientConfigurationDescriptor(Descriptor):

    DESCRIPTOR_UUID = '2902'

    def __init__(self, bus, index, characteristic):
        Descriptor.__init__(
                self, bus, index,
                self.DESCRIPTOR_UUID,
                ['read', 'write'],
                characteristic)

        self.value = dbus.Array(bytearray.fromhex('0100'), signature=dbus.Signature('y'))
        print(f'***ClientConfiguration***: {self.value}')

    def ReadValue(self, options):
        print(f'Read ClientConfiguration: {self.value}')
        return self.value

    def WriteValue(self, value, options):
        print(f'Write ClientConfiguration {self.value}')
        self.value = value

#type="org.bluetooth.descriptor.report_reference" uuid="2908"
class ReportReferenceDescriptor(Descriptor):

    DESCRIPTOR_UUID = '2908'

    def __init__(self, bus, index, characteristic):
        Descriptor.__init__(
                self, bus, index,
                self.DESCRIPTOR_UUID,
                ['read'],
                characteristic)

        self.value = dbus.Array(bytearray.fromhex('0001'), signature=dbus.Signature('y'))
        print(f'***ReportReference***: {self.value}')

    def ReadValue(self, options):
        print(f'Read ReportReference: {self.value}')
        return self.value

#############################
# my sandbox
#############################
class TestService(Service):
    """
    Dummy test service that provides characteristics and descriptors that
    exercise various API functionality.
    """

    SERVICE_UUID = '12345678-1234-5678-1234-56789abcdef0'

    def __init__(self, bus, index):
        Service.__init__(self, bus, index, self.SERVICE_UUID, True)
        self.add_characteristic(TestCharacteristic(bus, 0, self))

class TestCharacteristic(Characteristic):
    """
    Dummy test characteristic. Allows writing arbitrary bytes to its value, and
    contains "extended properties", as well as a test descriptor.
    """

    CHARACTERISTIC_UUID = '12345678-1234-5678-1234-56789abcdef1'

    def __init__(self, bus, index, service):
        Characteristic.__init__(
                self, bus, index,
                self.CHARACTERISTIC_UUID,
                ['read', 'write'],
                service)

        self.add_descriptor(TestDescriptor(bus, 0, self))
        #self.value = []
        self.value = dbus.Array(bytearray.fromhex('05010906a101850175019508050719e029e715002501810295017508810395057501050819012905910295017503910395067508150026ff000507190029ff8100c0050C0901A101850275109501150126ff0719012Aff078100C005010906a101850375019508050719e029e715002501810295017508150026ff000507190029ff8100c0'), signature=dbus.Signature('y'))

    def ReadValue(self, options):
        print('TestCharacteristic Read: ' + repr(self.value))
        return self.value

    def WriteValue(self, value, options):
        print('TestCharacteristic Write: ' + repr(value))
        self.value = value

class TestDescriptor(Descriptor):
    """
    Dummy test descriptor. Returns a static value.
    """

    DESCRIPTOR_UUID = '12345678-1234-5678-1234-56789abcdef2'

    def __init__(self, bus, index, characteristic):
        Descriptor.__init__(
                self, bus, index,
                self.DESCRIPTOR_UUID,
                ['read', 'write'],
                characteristic)

        self.value = dbus.Array('Test'.encode(), signature=dbus.Signature('y'))
        print(f'***TestDescriptor***: {self.value}')

    def ReadValue(self, options):
        print('TestDescriptor Read')

        return self.value

    def WriteValue(self, value, options):
        print(f'TestDescriptor Write: {value}')
        self.value = value

def register_app_cb():
    print('GATT application registered')

def register_app_error_cb(error):
    print('Failed to register application: ' + str(error))
    mainloop.quit()

def find_adapter(bus):
    remote_om = dbus.Interface(bus.get_object(BLUEZ_SERVICE_NAME, '/'),
                               DBUS_OM_IFACE)
    objects = remote_om.GetManagedObjects()

    for o, props in objects.items():
        if GATT_MANAGER_IFACE in props.keys():
            return o

    return None

def main():
    global mainloop

    dbus.mainloop.glib.DBusGMainLoop(set_as_default=True)

    bus = dbus.SystemBus()

    adapter = find_adapter(bus)
    if not adapter:
        print('GattManager1 interface not found')
        return

    service_manager = dbus.Interface(
            bus.get_object(BLUEZ_SERVICE_NAME, adapter),
            GATT_MANAGER_IFACE)

    app = Application(bus)

    mainloop = GObject.MainLoop()

    print('Registering GATT application...')

    service_manager.RegisterApplication(app.get_path(), {},
                                    reply_handler=register_app_cb,
                                    error_handler=register_app_error_cb)

    mainloop.run()

if __name__ == '__main__':
    main()


text:
Q: transfering variables between main page to internal pages In a way to separate the html and php code, I came up to the following structure -
Index.php - The brain of the code - receive data, process data and then choose what page to sent to the user.
Before accessing the main site, you have to login or register. After you do that ,index.php will load the site.html which will have the dyn_content block - The content will be loaded by javascript depending on what link clicked by the user.
index.php
...
case "inside": {
            site();
            break;
        }
...
function site () {
    $Page = file_get_contents("site.html");
    echo $Page;  // if it is not good way to display page, plz let me know the better way.
    return 1;
}
...

site.html
...

...

jquery
...
$(document).on("click",'#link_profile',  function (){
        $("#dyn_content").load("in_page/profile.php",function() {
            $('#m_main_top').load("menu/m_profile.php");});
            return false;
    });
$(document).on("click",'#link_setings',  function (){
        $("#dyn_content").load("in_page/set.php",function() {
            $('#m_main_top').load("menu/m_set.php");});
            return false;
    });
...

To display the data when page is loaded in din_content, I need get it from database (user data for profile.php for an example). Since I separated the code, I need to do it in index.php (I can't do it in profile.php since it will destroy the concept of separation). However the variables in index.php is not visible in pages loaded in dyn_content  (but I  expect that they will work since we still in index.php).
So the first question - is it posible to make the index variables visible in pages loaded in block dyn_content? May be the problem is that the page site.html is already loaded by index.php, and when the pages (pages in dyn_content block) loaded by jquery is too late since this action happen on user side?
So I come up with idea - to get all requrement data in some sort of space, and then take this data when it needed. So I come up with the following ideas how to do it:

*

*I thought about to transfer variables from index.php to jquery and then from jquery to the dyn_block page. But I think it is not the best way.

*Sent the json data from index.php to other pages. It is look good, but the problem is that we don't know the destination until user will click on one of the links (it can be settings.php or profile.php or other links). Plus the data must be processed only when the page need to be displayed. So I have problem with realization that idea and I'm not sure that it is the best one.

*Use Sessions or browser's cach. It is, I think, the best way how to do it. But I'm not sure if it good since we can use 50 variables that will take user place. And if it is already full on user side, we will have problem with displaying data.

So it is all ideas what I get.
So the question is - Can I make the variables in index.php make visible in internal parts as was described above? if no, how better to transfer them?

A: There is more unified and simplified approach:
Let's say you have initial html parts right inside your index.php:
// index.php content
...

Home

Profile

Settings

Contact Us

...

...

    if(isset($_GET['page']) && !empty($_GET['page'])){
       switch($_GET['page']){
           case "profile":
               $some_variable = 111;
               $profile_id = $_SESSION['user_id']; // just for example
               include ("in_page/profile.php");
               break;
           case "settings":
               $some_variable = 222;
               include ("in_page/set.php");
               break;
           default:
               include ("index.php");

       }
    }

...

From inside any included page, you may access global variables of "parent" page declared before inclusion
// profile.php content
<a href="/users/<?php echo $profile_id ?>">My link

<img src="/users/images/<?php echo $profile_id ?>"/> // avatar
... // approximate content

redpajama_set_name: RedPajamaStackExchange


text:
Q: Review seems to need to be refreshed Whenever I get the "there are no more items to review in this queue" (or "you've performed your limit for this queue") and click on Review at the top left to go back to the main Review page, I seem to need to click it again to actually see updated results.
That is, it most often still displays non-zero numbers for the queue I've just cleared (and if I do click on them again they immediately show "no more items"), but they're zeroed on a refresh.
I'm guessing this is actually some sort of caching bug.


text:
Q: Unique matrix transpose problem: contradictory reports from cachegrind and perf In the following question, we're talking about an algorithm which transposes a matrix of complex values struct complex {double real = 0.0; double imag = 0.0;};. Owing to a special data-layout, there is a stride-n*n access between the rows, which means that the loading of a subsequent row causes the eviction of the previously loaded row. All runs have been done using 1 thread only.
I'm trying to understand why my 'optimized' transpose function, which makes use of 2D blocking, is performing badly (coming from: 2D blocking with unique matrix transpose problem) and so I'm trying to use performance counters/cache simulators to get a reading on what's going wrong.
According to my analysis, if n=500 is the size of the matrix, b=4 is my block-size and c=4 is my cache-line size, we have for the naive algorithm,
for (auto i1 = std::size_t{}; i1 < n1; ++i1)
{
    for (auto i3 = std::size_t{}; i3 < n3; ++i3)
    {
        mat_out(i3, i1) = mat_in(i1, i3);
    }
}

Number of cache-references: (read) n*n + (write) n*n
Number of cache-misses: (read) n*n / c + (write) n*n
Rate of misses: 62.5 %.
Sure enough, I'm getting the same output as per cachegrind:
==21470== Cachegrind, a cache and branch-prediction profiler
==21470== Copyright (C) 2002-2017, and GNU GPL'd, by Nicholas Nethercote et al.
==21470== Using Valgrind-3.15.0 and LibVEX; rerun with -h for copyright info
==21470== Command: ./benchmark/benchmarking_transpose_vslices_dir2_naive 500
==21470==
--21470-- warning: L3 cache found, using its data for the LL simulation.
--21470-- warning: specified LL cache: line_size 64  assoc 12  total_size 9,437,184
--21470-- warning: simulated LL cache: line_size 64  assoc 18  total_size 9,437,184
==21470==
==21470== I   refs:      30,130,879,636
==21470== I1  misses:             7,666
==21470== LLi misses:             6,286
==21470== I1  miss rate:           0.00%
==21470== LLi miss rate:           0.00%
==21470==
==21470== D   refs:      13,285,386,487  (6,705,198,115 rd   + 6,580,188,372 wr)
==21470== D1  misses:     8,177,337,186  (1,626,402,679 rd   + 6,550,934,507 wr)
==21470== LLd misses:     3,301,064,720  (1,625,156,375 rd   + 1,675,908,345 wr)
==21470== D1  miss rate:           61.6% (         24.3%     +          99.6%  )
==21470== LLd miss rate:           24.8% (         24.2%     +          25.5%  )
==21470==
==21470== LL refs:        8,177,344,852  (1,626,410,345 rd   + 6,550,934,507 wr)
==21470== LL misses:      3,301,071,006  (1,625,162,661 rd   + 1,675,908,345 wr)
==21470== LL miss rate:             7.6% (          4.4%     +          25.5%  )

Now for the implementation with blocking, I expect,

Hint: The following code is without remainder loops. The container intermediate_result, sized b x b, as per suggestion by @JérômeRichard, is used in order to prevent cache-thrashing.
for (auto bi1 = std::size_t{}; bi1 < n1; bi1 += block_size)
{
    for (auto bi3 = std::size_t{}; bi3 < n3; bi3 += block_size)
    {
        for (auto i1 = std::size_t{}; i1 < block_size; ++i1)
        {
            for (auto i3 = std::size_t{}; i3 < block_size; ++i3)
            {
                intermediate_result(i3, i1) = mat_in(bi1 + i1, bi3 + i3);
            }
        }

        for (auto i1 = std::size_t{}; i1 < block_size; ++i1)
        {
            #pragma omp simd safelen(8)
            for (auto i3 = std::size_t{}; i3 < block_size; ++i3)
            {
                mat_out(bi3 + i1, bi1 + i3) = intermediate_result(i1, i3);
            }
        }
    }
}

Number of cache-references: (read) b*b + (write) b*b
Number of cache-misses: (read) b*b / c + (write) b*b / c
Rate of misses: 25 %.
Once again, cachegrind gives me the following report:
==21473== Cachegrind, a cache and branch-prediction profiler
==21473== Copyright (C) 2002-2017, and GNU GPL'd, by Nicholas Nethercote et al.
==21473== Using Valgrind-3.15.0 and LibVEX; rerun with -h for copyright info
==21473== Command: ./benchmark/benchmarking_transpose_vslices_dir2_best 500 4
==21473==
--21473-- warning: L3 cache found, using its data for the LL simulation.
--21473-- warning: specified LL cache: line_size 64  assoc 12  total_size 9,437,184
--21473-- warning: simulated LL cache: line_size 64  assoc 18  total_size 9,437,184
==21473==
==21473== I   refs:      157,135,137,350
==21473== I1  misses:             11,057
==21473== LLi misses:              9,604
==21473== I1  miss rate:            0.00%
==21473== LLi miss rate:            0.00%
==21473==
==21473== D   refs:       43,995,141,079  (29,709,076,051 rd   + 14,286,065,028 wr)
==21473== D1  misses:      3,307,834,114  ( 1,631,898,173 rd   +  1,675,935,941 wr)
==21473== LLd misses:      3,301,066,570  ( 1,625,157,620 rd   +  1,675,908,950 wr)
==21473== D1  miss rate:             7.5% (           5.5%     +           11.7%  )
==21473== LLd miss rate:             7.5% (           5.5%     +           11.7%  )
==21473==
==21473== LL refs:         3,307,845,171  ( 1,631,909,230 rd   +  1,675,935,941 wr)
==21473== LL misses:       3,301,076,174  ( 1,625,167,224 rd   +  1,675,908,950 wr)
==21473== LL miss rate:              1.6% (           0.9%     +           11.7%  )

I cannot explain this discrepancy at this point, except to speculate that this might be because of prefetching.
Now, when I watch the same naive implementation using perf (with option "-d"), I get:
Performance counter stats for './benchmark/benchmarking_transpose_vslices_dir2_naive 500':

         91.122,33 msec task-clock                #    0,933 CPUs utilized
           870.939      context-switches          #    0,010 M/sec
                17      cpu-migrations            #    0,000 K/sec
        50.807.083      page-faults               #    0,558 M/sec
   354.169.268.894      cycles                    #    3,887 GHz
   217.031.159.494      instructions              #    0,61  insn per cycle
    34.980.334.095      branches                  #  383,883 M/sec
       148.578.378      branch-misses             #    0,42% of all branches
    58.473.530.591      L1-dcache-loads           #  641,704 M/sec
    12.636.479.302      L1-dcache-load-misses     #   21,61% of all L1-dcache hits
       440.543.654      LLC-loads                 #    4,835 M/sec
       276.733.102      LLC-load-misses           #   62,82% of all LL-cache hits

      97,705649040 seconds time elapsed

      45,526653000 seconds user
      47,295247000 seconds sys

When I do the same for the implementation with 2D-blocking, I get:
Performance counter stats for './benchmark/benchmarking_transpose_vslices_dir2_best 500 4':

         79.865,16 msec task-clock                #    0,932 CPUs utilized
           766.200      context-switches          #    0,010 M/sec
                12      cpu-migrations            #    0,000 K/sec
        50.807.088      page-faults               #    0,636 M/sec
   310.452.015.452      cycles                    #    3,887 GHz
   343.399.743.845      instructions              #    1,11  insn per cycle
    51.889.725.247      branches                  #  649,717 M/sec
       133.541.902      branch-misses             #    0,26% of all branches
    81.279.037.114      L1-dcache-loads           # 1017,703 M/sec
     7.722.318.725      L1-dcache-load-misses     #    9,50% of all L1-dcache hits
       399.149.174      LLC-loads                 #    4,998 M/sec
       123.134.807      LLC-load-misses           #   30,85% of all LL-cache hits

      85,660207381 seconds time elapsed

      34,524170000 seconds user
      46,884443000 seconds sys

Questions:

*

*Why is there a strong difference in the output here for L1D and LLC?

*Why are we seeing such bad L3 cache-miss rate (according to perf) in case of the blocking algorithm? This is obviously exacerbated when I start using 6 cores.

Any tips on how to detect cache-thrashing will also be appreciated.
Thanks in advance for your time and help, I'm glad to provide additional information upon request.
Additional Info:
The processor used for testing here is the (Coffee Lake) Intel(R) Core(TM) i5-8400 CPU @ 2.80GHz.

*

*CPU with 6 cores operating at 2.80 GHz - 4.00 GHz

*L1 6x 32 KiB 8-way set associative (64 sets)

*L2 6x 256 KiB 4-way set associative (1024 sets)

*shared L3 9 MiB 12-way set associative (12288 sets)


text:
Q: I want to find values which lies between 25th- 50th percentile in matlab I have 80*80 matrix of PM10, i want to find all the values which lie between percentile 25th-50th. How to write a code for it?
I have changed my code like this:
for i=1:80;
for j=1:80;
t(i,j) = prctile(ans(i,j),25) > ans(i,j) | prctile(ans(i,j),75) < ans(i,j);
out(i,j) = t(i,j);
out(ans) = nan;
end;
end;

But , the output showing all the grids value as zero. Can someone please rectify my code. Thank you.

A: You have no reason to loop over the matrix elements, because prctile works on the whole data. After that, use logical indexing to directly turn all the rest of the values to NaN:
p=prctile(PM10(:),[25 50]);
PM10(PM10<p(1) | PM10>p(2))=NaN;


text:
Q: How to convert data datetime from database? i have data I get from database, it's like this:

I want to convert it to datetime because it cannot be comparing to other variabel with time value, and it cannot because there a character and other object follow there.
This is error:

How to get just its datetime and don't make it the other object follow on value ?

A: Use casting on your model. In this way laravel automaticlly convert attribute to expected type if it is possible.
// Your model class
class Booking {

    protected $casts = [
         'batasbayer' => 'datetime'
    ];

}

You may find other casts here.

A: Take value as $items[0]->batasbayar or if its in loop : foreach($items as $item){ $item->batasbayer  }. And try converting $item->batasbayer

A: When you want a Model field to be retrieve as a Carbon instance you can add it to the protected $dates  property of That Model

This is deprecated in Laravel 8

The recommended way is to pass that field name in the $casts property and specify the type in which you want to cast that field.
protected $casts = [
     'batasbayer' => 'datetime'
];


text:
Q: Can someone explain the difference between these 2 for loops? int n = strlen(s)
for (int i = 0; i < n; i++)
{
printf("%c", s[i]);

}

for (int i = 0; i <strlen(s); i++)
{
printf("%c", s[i]);
}

What I'm trying to ask is what is happening in memory(under the hood). Let's say the string length is 4, is 4 assigned to n, and would that make it easier for the compiler to compile? In the second code, would the compiler have to check what the string length of s is over and over? Is the point of the first code to make the compiler remember the string length is so it doesn't need to check for it every time. I'm sorry if my question isn't clear enough, telling me how to improve would be greatly appreciated.

A:
In the second code, would the compiler have to check what the string length of s is over and over

That's exactly right. The condition of a for loop is evaluated every iteration. Therefore, you should cache the length (or any other result that does not change in each iteration, for that matter).
In this case, as people pointed out, you can do even better avoiding to compute the length since you are iterating the string anyway.

A: The main difference is that the first loop will call strlen on every iteration.
int foo(const char *s)
{
    for (int i = 0; i <strlen(s); i++)
    {
        printf("%c", s[i]);
    }
    return 0;
}

int bar(const char *s)
{
    int n = strlen(s);
    for (int i = 0; i < n; i++)
    {
        printf("%c", s[i]);
    }
    return n;
}

and the resulting code:
foo:
        push    rbp
        mov     rbp, rdi
        push    rbx
        xor     ebx, ebx
        sub     rsp, 8
        jmp     .L2
.L3:
        movsx   edi, BYTE PTR [rbp+0+rbx]
        add     rbx, 1
        call    putchar
.L2:
        mov     rdi, rbp
        call    strlen
        cmp     rax, rbx
        ja      .L3
        add     rsp, 8
        xor     eax, eax
        pop     rbx
        pop     rbp
        ret
bar:
        push    r12
        push    rbp
        push    rbx
        mov     rbx, rdi
        call    strlen
        mov     r12, rax
        test    eax, eax
        jle     .L6
        lea     eax, [rax-1]
        lea     rbp, [rbx+1+rax]
.L8:
        movsx   edi, BYTE PTR [rbx]
        add     rbx, 1
        call    putchar
        cmp     rbx, rbp
        jne     .L8
.L6:
        mov     eax, r12d
        pop     rbx
        pop     rbp
        pop     r12
        ret

(gcc -O3) https://godbolt.org/z/1oh991


text:
Q: Modifying Page files - "Changes to this file were not saved to file system" When you open google chrome devtools, and go to Sources and look at the files under Page, how can you modify them and observe changes?
To be more specific, I want to modify some files inside top/webpack:// when you open Sources, on some websites, to experiment and see how things inside actually work.
But after any changes (Such as inserting a simple console.log("hello"); inside a .js file), I get "Changes to this file were not saved to file system".

CLARIFICATION: The only solution to "Changes to this file were not saved to file system" warning I've found was discussed on stackoverflow, but It did not resolve my issue since I can not (don't know how?) to add things from top/ to workspace.


text:
Q: Java RESTful services - What is the difference between QueryParam and PathParam in terms of their usage? What is the difference between QueryParam and PathParam in terms of their usage?
I understand that data can be passed to service using both of them. PathParam is the data preceeding ? in the URL and QueryParam are name value data after ?. But I wonder how exactly these are used.

A: @QueryParam is used to access key/value pairs in the query string of the URL (the part after the ?). For example in the url http://example.com?q=searchterm, you can use @QueryParam("q") to get the value of q.
@PathParam is used to match a part of the URL as a parameter. For example in an url of the form http://example.com/books/{bookid}, you can use @PathParam("bookid") to get the id of a book.
See this page for an example as used in JAX-RS.

A: There is probably not a single correct answer to the question in practice, since there are so many different URL schemes in usage out in "the wild".  However a helpful way to look at it would be in terms of REST URL processing.  In REST (REpresentational State Transfer), the idea is to be able to uniquely identify every resource that you want to provide access to.  In a common REST scheme, the path portion of the URL could be thought of as a set of coordinates in N-space (i.e., x, y, z => //myApp/x/y/z) and the query parameters are further specifiers. These further specifiers could be used as search criteria for incomplete path specifications, to return a list of matching resources.
See the following question for more examples of REST URLs.
EDIT:
@marcok has a good technical answer, but as your updated comment exposed, you seem more interested in when to choose one over the other.  Generally if you are going to be creating "pure" RESTful API, anything that is part of the path should uniquely identify resources by their identity. Oftentimes, this might have your URL ending in an ID value as part of the path to uniquely identify a resource.
However, if your API is directly exposing the ability to search/filter by attributes (probably excluding IDs), you would be more likely to encode that as a query parameter.
These are just examples, and there are different opinions of what entails a good API, and more specifically how purely-RESTful an API needs to be.

A: @QueryParam: Used to get parameter as key-value pair and based on key in QueryParam can get the value of key from the URL.
E.g. example.com/id=searchParam
@QueryParam("id") then value will be searchParam
@PathParam: Used to get the parameters(If parameters contains by URL) from the URL.
E.g. abc.com/searchParam/{empId}
@PathParam("empId")


text:
Q: How to iterate through a list in Python without using a "for" loop? I want to print all the elements in the range from 2 to 8 then use for loop:
E.g:
for i in range(2,8):
    print(i)

What is the best method to iterate without using a for, or while loop, which reduces the time complexity?

A: How about using recursion?
def iterate(lst, start, end):
  if start < 0 or end >= len(lst) or start > end:
    return
  print(lst[start])
  iterate(lst, start + 1, end)

Call it like this:
iterate([1, 2, 3, 4, 5, 6, 7, 8, 9, 10], 2, 8)

A: Let's take this sample list:
>>> mylist
['zero', 'one', 'two', 'three', 'four', 'five', 'six', 'seven', 'eight', 'nine']

Now, let's print elements 2 through 8 without looping:
>>> ' '.join(mylist[2:9])
'two three four five six seven eight'

Here, 2:9 tells python to uses indices starting with 2 and continuing up to but not including 9.

A: By slicing the list
>>> l = [1,2,3,4,5,6,7,8,9,10]
>>> print(l[1:8])
[2, 3, 4, 5, 6, 7, 8] # output in console

To get the summation of the values in l[1:8] use sum
>>> sum(l[1:8])
35 # output

EDIT because of @pzp:
If you want to print all the elements between index 2 and index 8 both inclusive,just replace print(l[1:8]) in the code above with print(l[2:9]).

A: simple solution using list comprehension
list1 = [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20]
sum1 = sum([i for i in list1 if i > 2 and i < 9])


text:
Q: Как в webpack 5 исключить удаление некоторых файлов? Коллеги, в webpack_5 использую плагин clean-webpack-plugin, все прекрасно работает.
Но тут пришлось реализовать такую штуку, исключить удаления двух файлов. Мне надо исключить файлы
.git && README.md

Прочел  оф. доку.
npm - clean-webpack-plugin
github - clean-webpack-plugin
Вроде это то, что надо    {cleanAfterEveryBuildPatterns : ['.git', 'README.md']}
Но это не работает.
Где-то нашел свойство exclude: []
но на оф. сайте про такое не нашел ни какой информации.  Подскажите как исключить удаление
этих файлов .git && README.md?


text:
Q: Need help on Javascript coding converting to use my html table I have a table which has the number of rows depended on what the number is in the spinner. This does work e.g If I enter 25 in spinner it comes up with 25 rows, if I enter 7 in spinner comes with 7 rows.This is retrieved through the $spinnerCount.
The problem is that everytime I submit a question (using a textarea and submit buttom to enter and submit a question) into the table, it creates a new row. So if I had 20 empty rows in the table because I stated in the spinner I wanted 20 questions, then what happens is every time I submit a question, it adds a new row every time, so submitting 20 questions from the textarea would mean the table would contain 20 blank rows and 20 rows with questions. I am guessing it is because of this for example:
var enumeratorCell = document.createElement("td");

So except creating an element to create a new row, I wanted to retrieve an element so that it submits the question in an existing row (each row contains a text box so question would go into the text box in the row) starting from top row and going down one row every time a question is submitted, rather than creating a new row everytime a question is submitted. The questions would go under the "Questions" column.
Now somebody (user: nnnnn) posted this to me:
Below is an example of a table the user coded himself:

      1
      2

      3
      4

Below is user's javascript:
//If you want to retrieve or change the contents of the existing cells you can do this:

// get reference to the table
var t = document.getElementById("myTable"),
    r,
    c,
    i, j;

// loop through the rows
for (i=0; i<t.rows.length; i++) {
   // get reference to current row
   r = t.rows[i]; //
   // loop through tds of current row
   for (j=0; j<r.cells.length; j++) {
       // get reference to current cell
       c = r.cells[j]; // equivalent to t.rows[i].cells[j]
      // display content of cell
      alert(c.innerHTML);
      // change content of cell
      c.innerHTML = "New value " + i + j;
    }
}

The problem is that I have tried to manipulate this into my code  but #i could not get it to work. Reason for this is because I don't know to use this javascript for my table. so what I wanted to know is can somebody manipulate this javascript code so that it matches with my table?
Below is code for my table and the textarea where the questions will be entered and submitted:
//My table

    Question No
    Question
    Option Type
    Duration
    Weight(%)
    Answer
    Video
    Audio
    Image

    <?php
    $spinnerCount = $_POST['textQuestion'];
if($spinnerCount > 0) {
   for($i = 1; $i <= $spinnerCount; $i++) {?>

    <?php echo $i; ?>

    <?php
}
}
?>

//textarea and submit button where questions are typed in and submitted, the textarea and submit button is placed below the table above
<form id="enter" action="<?php echo htmlentities($_SERVER['PHP_SELF']); ?>" method="post">

SESSION DETAILS

Question:
<textarea rows="5" cols="40" id="questionTxt" name="questionText"></textarea>

<input id="addQuestion" type="button" value="Add Question" name="addQuestionBtn" onClick="insertQuestion()" />

</form>

A: Give your placeholder rows a "blank" class... remove a blank for each row you add.

A: Looks like your not getting your table element.
Change
var t = document.getElementById("myTable"),

to
var t = document.getElementById("qandatbl"),

I think that should do it.
In response to your question in the comments:
move <?php echo $i; ?> into the question column <?php echo $i; ?>


text:
Q: How to launch a parent iOS App from its App Extension Does any one know how to launch the parent app from the app extension's view controller?
I just want to launch the main app from its app extension.

A: Working solution in Swift 3.1 (tested in iOS10):
You need to create your own URL Scheme for your host app, then add this function to your ViewController and call it with openURL("myScheme://myIdentifier")
//  Function must be named exactly like this so a selector can be found by the compiler!
//  Anyway - it's another selector in another instance that would be "performed" instead.
func openURL(_ url: URL) -> Bool {
    var responder: UIResponder? = self
    while responder != nil {
        if let application = responder as? UIApplication {
            return application.perform(#selector(openURL(_:)), with: url) != nil
        }
        responder = responder?.next
    }
    return false
}

A: it is working in my current working app using action extension
1- in parent app plist add custom URL like

2- add both functions in your extension view controller
func openURL(url: NSURL) -> Bool {
    do {
        let application = try self.sharedApplication()
        return application.performSelector(inBackground: "openURL:", with: url) != nil
    }
    catch {
        return false
    }
}

func sharedApplication() throws -> UIApplication {
    var responder: UIResponder? = self
    while responder != nil {
        if let application = responder as? UIApplication {
            return application
        }

        responder = responder?.next
    }

    throw NSError(domain: "UIInputViewController+sharedApplication.swift", code: 1, userInfo: nil)
}

3- call this function in your button action or somewhere you want to do
self.openURL(url: NSURL(string:"openPdf://HomeVC")!)

here homevc is the class name of your View controller which should be presented
4- in your app delegate implement the method like
  func application(_ app: UIApplication, open url: URL, options: [UIApplication.OpenURLOptionsKey : Any] = [:]) -> Bool {
    let urlPath : String = url.absoluteString
    print(urlPath)
    if urlPath.contains("HomeVC"){
        //here go to firstViewController view controller
        self.window = UIWindow(frame: UIScreen.main.bounds)

        let storyboard = UIStoryboard(name: "Main", bundle: nil)

        let initialViewController = storyboard.instantiateViewController(withIdentifier: "homeVC")

        self.window?.rootViewController = initialViewController
        self.window?.makeKeyAndVisible()
    }
}

I hope will work fine, can also share data between extension app and parent app

A: I asked a similar question here: Communicating with/opening Containing app from Share extension. Basically, you can do a couple things.

*

*Use a UIWebView's loadRequest webView to load an NSURL request with your containing app's url. For example,
NSURL *url = [NSURL URLWithString:@"myurl"];
NSURLRequest *request = [[NSURLRequest alloc] initWithURL:url];
[self.webView loadRequest:request];

*Use a UIDocumentInteractionController and a custom file extension type to provide a link to your containing app (and your containing app only)

*Start a "fake" NSURL session to get the following functionality: In iOS, if your extension isn't running when a background task completes, the system launches your containing app in the background and calls the application:handleEventsForBackgroundURLSession:completionHandler: app delegate method.
The first one is probably your best bet.

A: The documentation is pretty clear on saying that you can use extensionContext openURL within a Today extension.  By implication, openURL can only be used in a Today exception and our experiences are proving this to be true--I also can't get it working from within a Share extension.
I would be interested to see if any of these work arounds are accepted by Apple's review process.  I doubt it.  If Apple wanted it to work, it would have been easy enough for them to allow it.

Apple allows any Today widget to use the openURL:completionHandler:
  method to open the widget's own containing app.
If you employ this method to open other apps from your Today widget,
  your App Store submission might entail additional review to ensure
  compliance with the intent of Today widgets.

I'm certain this second paragraph was added after Launcher was accepted, rejected, and then later approved for sale.

A: Here is another way to do it:

*

*Step 1 from here

*Select extension target and go to its Build Settings. Set Require Only App-Extension Safe API to NO.

*Use UIApplication.shared.openURL(URL(string:"openPdf://")!) as you normally would do it outside extension to open urls.

Note, that you'll get 'openURL' was deprecated in iOS 10.0 warning. So this looks like it is not guaranteed to work in future.
Consider using local Notifications to wake up host app instead of this.

A: Here is Valentin Shergin's solution for ios 14 & xcode 13
extension KeyboardViewController{
    func openURL(url: NSURL) -> Bool {
            do {
                let application = try self.sharedApplication()
                return (application.perform("openURL:", with: url) != nil)
            }
            catch {
                return false
            }
        }

        func sharedApplication() throws -> UIApplication {
            var responder: UIResponder? = self
            while responder != nil {
                if let application = responder as? UIApplication {
                    return application
                }

                responder = responder?.next
            }

            throw NSError(domain: "UIInputViewController+sharedApplication.swift", code: 1, userInfo: nil)
        }
}

A: In the WWDC session Creating Extensions for iOS and OS X, Part 1 around the 22 minute mark the say to use the openURL:completionHandler: method from the UIViewController's extensionContext to open a custom URL scheme
[self.extensionContext openURL:[NSURL URLWithString:@"your-app-custom-url-scheme://your-internal-url"]
             completionHandler:nil];

A: Here is working solution (tested on iOS 9.2) at least for Keyboard Extension. This category adds special method for access to hidden sharedApplication object and then call openURL: on it.
(Of course then you have to use openURL: method with your app scheme.)
extension UIInputViewController {

    func openURL(url: NSURL) -> Bool {
        do {
            let application = try self.sharedApplication()
            return application.performSelector("openURL:", withObject: url) != nil
        }
        catch {
            return false
        }
    }

    func sharedApplication() throws -> UIApplication {
        var responder: UIResponder? = self
        while responder != nil {
            if let application = responder as? UIApplication {
                return application
            }

            responder = responder?.nextResponder()
        }

        throw NSError(domain: "UIInputViewController+sharedApplication.swift", code: 1, userInfo: nil)
    }

}


text:
Q: C# - How to create progress bars dynamically I'm trying to develop a little program which can support several uploads simultaneously. However, I'm facing a problem : if I have one file uploading, there is a progress bar; but when I put more files to upload, I don't know how to create progress bars for each file independently and how to automatically add additional bars on multiple uploads.
I use WebClient class with UploadFileAsync.
String file is the path needed for uploading and uploadForm is the Form where I would show progress bars and do uploads.
EDIT : final code to make it functional
private void UploadEnProgres(object sender, UploadProgressChangedEventArgs e, String file, ProgressBar nouvelleProgressBar)
{
    Console.WriteLine("{0} : {1} octet sur {2} au total. {3} % envoyés...", file, e.BytesSent, e.TotalBytesToSend, e.ProgressPercentage);
    nouvelleProgressBar.Value = (int)((e.BytesSent * 100) / e.TotalBytesToSend);
}

private void UploadFini(object sender, UploadFileCompletedEventArgs e, String file, ProgressBar nouvelleProgressBar, TextBox nouvelleTextBox, Int32 hauteur)
{
    if ((e.Cancelled) || (e.Error != null))
    {
        Console.WriteLine("{0} : ERREUR -- {1}", file, e.Error);
        return;
    }
    Console.WriteLine("{0} : upload terminé, statut : ", file, System.Text.Encoding.UTF8.GetString(e.Result));
    uploadForm.Controls.Remove(nouvelleProgressBar);
    uploadForm.Controls.Remove(nouvelleTextBox);
    hauteur = 12;
}

public void HTTPClientUpload(String file)
{
    Console.WriteLine("Upload button.");
    WebClient clientUpload = new WebClient();
    String authInfo;
    authInfo = utilisateur + ":" + motDePasse;
    authInfo = Convert.ToBase64String(Encoding.Default.GetBytes(authInfo));
    clientUpload.Headers["Authorization"] = "Basic " + authInfo;

    // CODE HTTP UPLOAD

    this.hauteur += 22;

    ProgressBar nouvelleProgressBar = new ProgressBar();
    nouvelleProgressBar.Size = new Size(180, 20);
    nouvelleProgressBar.Maximum = 100;
    nouvelleProgressBar.Minimum = 0;
    nouvelleProgressBar.Location = new Point(258, hauteur);
    nouvelleProgressBar.Visible = true;
    uploadForm.Controls.Add(nouvelleProgressBar);

    TextBox nouvelleTextBox = new TextBox();
    nouvelleTextBox.Size = new Size(180, 20);
    nouvelleTextBox.Location = new Point(70, hauteur);
    nouvelleTextBox.Text = Path.GetFileName(file);
    nouvelleTextBox.Enabled = false;
    uploadForm.Controls.Add(nouvelleTextBox);

    clientUpload.Headers.Add("Chemin", "/" + identifiantAppareil + file.Replace(@"\", "/"));
    clientUpload.UploadFileCompleted += new UploadFileCompletedEventHandler((sender, e) => UploadFini(sender, e, Path.GetFileName(file), nouvelleProgressBar, nouvelleTextBox, hauteur));
    clientUpload.UploadProgressChanged += new UploadProgressChangedEventHandler((sender, e) => UploadEnProgres(sender, e, Path.GetFileName(file), nouvelleProgressBar));
    clientUpload.UploadFileAsync(new Uri(urlServeur, "v1/ul"), file);
}

A: //Create a new progressbar each time you start an upload in code
var progressbar = new ProgressBar()

//add it to the form
uploadForm.Controls.Add(progressbar );

you'll need to look into how you group / position them

A: For organization, I would suggest a TableLayoutPanel to add newly created controls to.


text:
Q: How can I intelligently group rows of integers for a faceted search? I'm not even quite sure what terms I should be using for what I want, so any advice on what I'm even asking for would be very welcome.
Basically, my web site lists user-generated accommodations. Each has a rent price, which users will be able to query in our new faceted search box.
Users search by city, and within each city I'd like to present a different rent grouping. That is to say that in City #1, if we have listings ranging from $200 - $1000, I'd like to present checkboxes for:

*

*less than $300

*$301 - $500

*$501 - $700

*more than $700

However, if City #2 has values that range from $500 - $1500, I want the ranges above to change accordingly. So, if I say that I want 5 or 6 range options in each city, I think I have two options:

*

*Take the min and max values and just split the difference. I don't like this idea because one listing with a rent of $10,000 will throw the whole scale off.

*Intelligently calculate the ranges using means, medians etc.
Number 2 is what I need help with. I'm a web developer that gets logic, but was never strong on math and statistics at school. Can anyone point me towards a guide that'll help me figure this out?

A: If you're looking for 4 groups, you need 3 splitpoints.  Take the median of your whole set to get the middle one, then the median of those above and below that to get your other two.

A: Instead of trying to figure out the scale dynamically based upon the data set, why not have a static scale (or formula for determining scale) and then determine if there is data to support displaying the search options.
For example, if your scale is [(0-300), (301, 600), (601-700), ...] and your dataset contains [$250, $500, $550, $1000] then you would need to display [(0-300), (301-600), (1001-1300)].
You could figure this out with LINQ.

A: Split your data by quantity.
Something like this (pseudo-C code):
Let "set" be the data, "n" be the number of entries, and "s" be the number of splits.
int increment = ceil(n/s);
int start = 0;
int end = increment;
OrderSet(set); // So set[0] is min and set[n-1] is max
for (int i = 0; i < s; i++)
{
  while (set[end] == set[start] && end < n - 1)
    end++;
  AddGroup(start, end);

  if (end == n - 1)
    break;

  start = end;
  end = start + increment;
  if (end >= n)
    end = n - 1;
}


text:
Q: Are there differences in the linkers between VS2017 and VS2015? For many years I have been using a library 'wot I wrote' which has a particular peculiarity in that it defines main().
This means that applications that I write don't have to have main themselves because the linker already has an unresolved reference to it and goes looking for it and finds it in my library.
This technique has worked on several platforms including VS2005/2008/2015. Now I have just installed VS2017 and started a new project referencing the library which was built with VS2015.
The new project only has one source file like this:
// necessary #includes elided
namespace gp {
    void Options(Run& runner) {
        runner << "test2017";
    }
}

My expectation is that this file will compile and link with my library (for instance the type Run is declared and defined there).
The linker then complains:
LINK : fatal error LNK1561: entry point must be defined

However, simply adding these lines to the one source file:
int main(int, char*[]);
auto p = &main;

the program links and runs and I get the expected output:
**** test2017 ****

A: Try to specify /SUBSYSTEM:CONSOLE to the linker. It's because maybe it searches for WinMain instead of main.
In the Property Pages of your project you can set this in Linker/System/SubSystem and select Console (/SUBSYSTEM:CONSOLE) (instead of Windows (/SUBSYSTEM:WINDOWS))


text:
Q: Spring security custom FilterInvocationSecurityMetadataSource implementation 403 forbidden issue To make things short I'm trying to implement a custom FilterInvocationSecurityMetadataSource in order to secure/authorize certain parts/URL endpoints dynamically in my web app using spring security 5.0.6 and Spring Boot 2.0.3.
The issue is that no matter what Role I use it always gives me the forbidden page.
I have tried several things with different role names and (believe me) I have searched the whole internet even on spring security 5.0.6 books but nothing seems to work.
This issue may be similar to this: Spring Security issue with securing URLs dynamically
Below the relevant parts of the custom FilterInvocationSecurityMetadataSource
public class DbFilterInvocationSecurityMetadataSource implements FilterInvocationSecurityMetadataSource {

public Collection<ConfigAttribute> getAttributes(Object object)
        throws IllegalArgumentException {
    FilterInvocation fi=(FilterInvocation)object;
    String url=fi.getRequestUrl();

    System.out.println("URL requested: " + url);

    String[] stockArr = new String[]{"ROLE_ADMIN"};

    return SecurityConfig.createList(stockArr);
}

Below the relevant parts of the custom implementation of securitywebconfigAdapter
@Configuration
public class Security extends WebSecurityConfigurerAdapter {
    @Override
    protected void configure(HttpSecurity http) throws Exception {
        http
            .authorizeRequests()
            .anyRequest().authenticated()
            .withObjectPostProcessor(new ObjectPostProcessor<FilterSecurityInterceptor>() {
            public <O extends FilterSecurityInterceptor> O postProcess(
                    O fsi) {
                FilterInvocationSecurityMetadataSource newSource = new DbFilterInvocationSecurityMetadataSource();
                fsi.setSecurityMetadataSource(newSource);
                return fsi;
            }
        })
        .and()
        .formLogin()
        .permitAll();
}

Below the relevant parts for custom userDetails authorities.
The user has the role: ROLE_ADMIN in database.
public class CustomUserDetails extends User implements UserDetails {

@Override
public Collection<? extends GrantedAuthority> getAuthorities() {
    List<String> dbRoles=new ArrayList<String>();
    for (Role userRole : super.getRoles()) {
        dbRoles.add(userRole.getType());
    }

    List<SimpleGrantedAuthority> authorities=new ArrayList<SimpleGrantedAuthority>();
    for (String role : dbRoles) {
        authorities.add(new SimpleGrantedAuthority(role));
    }
    return authorities;
}

What am I doing wrong??
If more code is needed just comment below.
If you have even good books where I can learn this dynamic part of Spring security authorization comment below.
Thanks!

A: I managed to get into the security flow by debugging and it seems that by creating ConfigAttributes of this SecurityConfig class is the 'culprit'
return SecurityConfig.createList(stockArr);
public static List<ConfigAttribute> createList(String... attributeNames) {
    Assert.notNull(attributeNames, "You must supply an array of attribute names");
    List<ConfigAttribute> attributes = new ArrayList(attributeNames.length);
    String[] var2 = attributeNames;
    int var3 = attributeNames.length;

    for(int var4 = 0; var4 < var3; ++var4) {
        String attribute = var2[var4];
        attributes.add(new SecurityConfig(attribute.trim()));
    }

    return attributes;
}

Above is the actual implementation of the method where you can see
attributes.add(new SecurityConfig(attribute.trim()));

And this always creates an instance of SecurityConfig type.
And below you can actually see where and how the decision is being made.
private WebExpressionConfigAttribute findConfigAttribute(Collection<ConfigAttribute> attributes) {
    Iterator var2 = attributes.iterator();

    ConfigAttribute attribute;
    do {
        if (!var2.hasNext()) {
            return null;
        }

        attribute = (ConfigAttribute)var2.next();
    } while(!(attribute instanceof WebExpressionConfigAttribute));

    return (WebExpressionConfigAttribute)attribute;
}

So in order for it to actually return a configattribute for checking it must be of type WebExpressionConfigAttribute which is never going to be the case because of this
attributes.add(new SecurityConfig(attribute.trim()));

So the way I fixed it is to create my own accessDecisionManager the following way
public class MyAccessDecisionManager implements AccessDecisionManager {
@Override
public void decide(Authentication authentication, Object object, Collection<ConfigAttribute> configAttributes)
        throws AccessDeniedException, InsufficientAuthenticationException {
    if(configAttributes == null){
        return  ;
    }
    Iterator<ConfigAttribute> ite = configAttributes.iterator();
    while(ite.hasNext()){

        ConfigAttribute ca = ite.next();

        String needRole = ((SecurityConfig)ca).getAttribute();

        for(GrantedAuthority grantedAuthority : authentication.getAuthorities()){
            if(needRole.trim().equals(grantedAuthority.getAuthority().trim())){
                return;
            }
        }
    }
    throw new AccessDeniedException("Access is denied");
}

And registering as above now setting the accessdecisionManager with my custom one
.withObjectPostProcessor(new ObjectPostProcessor<FilterSecurityInterceptor>() {
        public <O extends FilterSecurityInterceptor> O postProcess(
                O fsi) {
            FilterInvocationSecurityMetadataSource newSource = new DbFilterInvocationSecurityMetadataSource();
            fsi.setSecurityMetadataSource(newSource);
            fsi.setAccessDecisionManager(new MyAccessDecisionManager());
            return fsi;
        }


text:
Q: extract the values which match in both columns I have data.frame of two columns with different size:
type1    type2
user1  user1
user2  user4
user3  user6
user4

how to get the matches? that the result would be
user1
user4

A: See ?match or the similar ?"%in%":
df$type1[df$type1 %in% df$type2]

A: First of all, the columns in a data.frame must all have the same length (see http://cran.r-project.org/doc/manuals/R-intro.html#Data-frames.) so I will assume the last entry in your example is just an empty string "".
What you are looking for is the "intersection" of your two columns, i.e., the elements that can be found in both columns. You can use the intersect function for that:
df <- data.frame(type1 = c("user1", "user2", "user3", "user4"),
                 type2 = c("user1", "user4", "user6", ""))
df
#   type1 type2
# 1 user1 user1
# 2 user2 user4
# 3 user3 user6
# 4 user4

intersect(df$type1, df$type2)
# [1] "user1" "user4"


text:
Q: How to wait until the importxml is finished loading on Google App Script as code below Thank you for your help :)
I would like to wait until newSellPriceFunction and newBuyPriceFunction is finished loading before going to the next steps. As now sometimes it doesn't wait until the loading finished and return data with "Loading...".
function GoldPriceNotification() {
  // get the Spreadsheet and sheet
  var ss = SpreadsheetApp.openById("1oVMpP_MvwX2cUNviJc1NcubBj4ezR0qs2FjHEWfV8ps").getSheetByName("Gold")

  // fetch data to get the price gold price
  var newSellPriceFunction = ss.getRange("C6").setValue("=importxml(D2,E2)");
  var newBuyPriceFunction = ss.getRange("C7").setValue("=importxml(D3,E3)");

  // get value from the previous fetching gold price
  var lastSellPrice = ss.getRange("C2").getDisplayValue();
  var lastBuyPrice = ss.getRange("C3").getDisplayValue();

  // get current date and time
  var date = ss.getRange("B5").setValue("=now()")
  var time = ss.getRange("B5").getDisplayValue();

  // get value from the new gold price (newSellPrice is on the second because it creates span of time while its data is fetching)
  var newBuyPrice = ss.getRange("C7").getDisplayValue();
  var newSellPrice = ss.getRange("C6").getDisplayValue();

  // if the data fetched get "#N/A, clear C6:C7
  if (newSellPrice == "#N/A" || newBuyPrice == "#N/A") {
    ss.getRange("C6:C7").clear()

    // if the data fetched get "Loading...", clear C6:C7
  } else if (newSellPrice == "Loading..." || newBuyPrice == "Loading...") {
    ss.getRange("C6:C7").clear()

    // Check if the last and new prices are different, send Line Notify
  } else if (lastSellPrice != newSellPrice || lastBuyPrice != newBuyPrice) {

    // Copy new Price to the old price area
    var reNewOldPrice = ss.getRange("C6:C7").copyValuesToRange(ss, 3, 3, 2, 3)

    // Send Line Notify to the group
    var message = "\nเอ็งฮงฮวด สวัสดีค่ะ" + "\nขออนุญาตแจ้งราคาทอง" + "\n⏳ณ " + time + "⏳" + "\nราคาซื้อ:  " + newBuyPrice + "\nราคาขาย: " + newSellPrice + ""
    sendLineNotify(message)

    // Need to clear as sometime when duplicate function. it doesn't show the latest value
    ss.getRange("C6:C7").clear()

    // if the new and old price are the same, clear C6:C7
  } else {
    ss.getRange("C6:C7").clear()
  }
}

A: You can fetch data directly in your code without using IMPORTXML formulas with the UrlFetchApp.fetch method. Try this code
function ImportXMLData() {
  const url = 'https://www.goldtraders.or.th/default.aspx',
        response = UrlFetchApp.fetch(url);
  let content = {
    Sell : '',
    Buy  : ''
  }
  if (response) {
    let html = response.getContentText();
    if (html) {
      content.Sell = html.match(/(.*)<\/font><\/b><\/span>/i)[1];
      content.Buy  = html.match(/(.*)<\/font><\/b><\/span>/i)[1];
    }
  }
  return content;
}


text:
Q: Install list of packages I have a list of packages mypacket.x86_64.rpmhttps://pastebin.com/uiUDvaFi that I need to install for my project.
Is there a way to install them with only one command?
Btw, I'm using Centos, with yum downloader
Thanks for the help
Warok


text:
Q: How is the best way to model this data structure using loopback I'd like to have the following data structure:
Blog
{
  name: "blog test",
  description: "description",
  additionalFields: {
    fieldExample: {
      property1: "test",
      property2: "test",
      property3: "test"
    },
    fieldExample2: {
      property1: "test",
      property2: "test",
      property3: "test"
    }
  }
}

Being "fieldExamples" dynamically created and "property1", "property2", "property3" fixed.
Using loopbackjs and embedded models, how is the best way to model the field "additionalFields"?
I've read about embedded models and relations in the documentation, but I couldn't figure out how to model this. I'd appreciate some help.

A: I think embedsMany can do the trick. As this link said the solution can be something like the following code:
common/models/blog.json
{
  "name": "Blog",
  "base": "PersistedModel",
  "idInjection": true,
  "properties": {
    "name": {
      "type": "string"
    },
    "description": {
      "type": "string"
    }
  },
  "relations": {
    "additionalFields": {
      "type": "embedsMany",
      "model": "AdditionalFields",
      "property": "additionalFields",
      "options": {
        "validate": true,
        "forceId": false
      }
    }
  }

common/models/additionalFields.json
{
  "name": "AdditionalFields",
  "base": "Model",
  "idInjection": true,
  "properties": {
    "property1": {
      "type": "string"
    },
    "property2": {
      "type": "string"
    },
    "property3": {
      "type": "string"
    }
  }

The only difference between this code and your sample will be additionalFields. In your code, it is an object, but the output of the above code will be an array for additionalFields. I'm not sure is it acceptable in your code or not.
If you need to save fieldExample as well, I think you can simply add a filed in AdditionalFields model and save the value of fieldExample in it.


text:
Q: How to prevent Fedora 28's texlive packager interfering with my freedom to maintain a vanilla installation of TeX Live? This is essentially a follow-up to earlier questions concerning the procedure for installing vanilla TeX Live from upstream on a GNU/Linux system.
Part of that process involves the installation of a dummy package, which satisfies the distro's package manager that relevant dependencies are installed when installing programmes which require a TeX installation (e.g. TeX editors, frontends and associated software).
In Arch Linux, this is unproblematic and Debian derivatives seem reasonably pliant also.
However, Fedora is altogether more trouble. Moreover, with the release of Fedora 28, the annoyances have mushroomed into all-out warfare. I am battling dnf in a life-and-death struggle entirely of another's making. The packaging is not just exponentially worse. It is ??!! Bonkers. Aggressive. Intrusive. Insidious. Violent. Rude. Insane. Batty. Bananas. Hideous. Eruptive. Disruptive. It is Extreme Packaging taken to its Irrational Logical Conclusion. It is a reductio ad absurdum of distros' TeX Live packaging. It is, in a word, Nuts.
Fedora is, moreover, spectacularly unsympathetic to upstream installations. What's wrong with our packages, they ask? The packager worked hard to package the entire TeX Live tree!
The answer to which is: nothing is wrong with them. But this is my machine and I demand the freedom to run the software I want on it. If that means abandoning Fedora, so be it. But this would seem antithetical to the spirit, though not the technical lettering, of the commitments to software freedom which Fedora itself espouses.
Moreover, I like Fedora and I'm hoping that I do not have to leave Fedora in order to exercise freedoms Fedora otherwheres supports.
Originally, it was not hard to build a dummy package to satisfy Fedora. Things got trickier in Fedora 24 and trickier still in Fedora 26 and 27, but the problem was not entirely unmanageable.
Today, however, I updated from Fedora 26 to Fedora 28 and, lo and behold, the damn thing pulled in piles and piles of texlive- packages. There are so many matching packages in Fedora's repos that dnf reports finding none if you search just for texlive or even something like texlive-d*. Apparently, it can't cope with that many results, so concludes there are none whatsoever.
I ended up hacking together a .spec file to convince dnf to let me remove the unwanted packages, but posting it here goes over SE's character limit, so I've put it at https://pastebin.com/QXFjqW9C instead. The file has  11593 lines,  23249 words and 347644 characters.
This is, clearly, insane. Moreover, the file will need to be continually updated each time Fedora's packager gets a new package from TeX Live. That is, constantly. This is because it seems that some of Fedora's packages include direct dependencies on the lowest level of packaging, so upgrading a system with Kile installed, for example, pulled in specific LaTeX packages - not just some meta package or package group, as I'd have expected.
However, I cannot find a way to avoid this difficulty. A dummy package like this is, I think, the right way to do this, but I can't make it work.
So I've also edited /etc/dnf.conf:
[main]
gpgcheck=1
installonly_limit=3
clean_requirements_on_remove=True
excludepkgs=texlive-a*,texlive-b*,texlive-c*,texlive-e*,texlive-f*,texlive-g*,texlive-h*,texlive-i*,texlive-j*,texlive-k*,texlive-l*,texlive-m*,texlive-n*,texlive-o*,texlive-p*,texlive-q*,texlive-r*,texlive-s*,texlive-t*,texlive-u*,texlive-v*,texlive-w*,texlive-x*,texlive-y*,texlive-z*,texlive-0*,texlive-1*,texlive-2*,texlive-3*,texlive-4*,texlive-5*,texlive-6*,texlive-7*,texlive-8*,texlive-9*,texlive-da*,texlive-db*,texlive-dc*,texlive-dd*,texlive-de*,texlive-df*,texlive-dg*,texlive-dh*,texlive-di*,texlive-dj*,texlive-dk*,texlive-dl*,texlive-dm*,texlive-dn*,texlive-do*,texlive-dp*,texlive-dq*,texlive-dr*,texlive-ds*,texlive-dt*,texlive-dv*,texlive-dw*,texlive-dx*,texlive-dy*,texlive-dz*,texlive-d0*,texlive-d1*,texlive-d2*,texlive-d3*,texlive-d4*,texlive-d5*,texlive-d6*,texlive-d7*,texlive-d8*,texlive-d9*,texlive-dua*,texlive-dub*,texlive-duc*,texlive-dud*,texlive-due*,texlive-duf*,texlive-dug*,texlive-duh*,texlive-dui*,texlive-duj*,texlive-duk*,texlive-dul*,texlive-dun*,texlive-duo*,texlive-dup*,texlive-duq*,texlive-dur*,texlive-dus*,texlive-dut*,texlive-duu*,texlive-duv*,texlive-duw*,texlive-dux*,texlive-duy*,texlive-duz*,texlive-du0*,texlive-du1*,texlive-du2*,texlive-du3*,texlive-du4*,texlive-du5*,texlive-du6*,texlive-du7*,texlive-du8*,texlive-du9*,texlive-duma*,texlive-dumb*,texlive-dumc*,texlive-dumd*,texlive-dume*,texlive-dumf*,texlive-dumg*,texlive-dumh*,texlive-dumi*,texlive-dumj*,texlive-dumk*,texlive-duml*,texlive-dumn*,texlive-dumo*,texlive-dump*,texlive-dumq*,texlive-dumr*,texlive-dums*,texlive-dumt*,texlive-dumu*,texlive-dumv*,texlive-dumw*,texlive-dumx*,texlive-dumy*,texlive-dumz*,texlive-dum0*,texlive-dum1*,texlive-dum2*,texlive-dum3*,texlive-dum4*,texlive-dum5*,texlive-dum6*,texlive-dum7*,texlive-dum8*,texlive-dum9*,texlive-dumma*,texlive-dummb*,texlive-dummc*,texlive-dummd*,texlive-dumme*,texlive-dummf*,texlive-dummg*,texlive-dummh*,texlive-dummi*,texlive-dummj*,texlive-dummk*,texlive-dumml*,texlive-dummm*,texlive-dummn*,texlive-dummo*,texlive-dummp*,texlive-dummq*,texlive-dummr*,texlive-dumms*,texlive-dummt*,texlive-dummu*,texlive-dummv*,texlive-dummw*,texlive-dummx*,texlive-dummz*,texlive-dumm0*,texlive-dumm1*,texlive-dumm2*,texlive-dumm3*,texlive-dumm4*,texlive-dumm5*,texlive-dumm6*,texlive-dumm7*,texlive-dumm8*,texlive-dumm9*,texlive-dummya*,texlive-dummyb*,texlive-dummyc*,texlive-dummyd*,texlive-dummye*,texlive-dummyf*,texlive-dummyg*,texlive-dummyh*,texlive-dummyi*,texlive-dummyj*,texlive-dummyk*,texlive-dummyl*,texlive-dummym*,texlive-dummyn*,texlive-dummyo*,texlive-dummyp*,texlive-dummyq*,texlive-dummyr*,texlive-dummys*,texlive-dummyt*,texlive-dummyu*,texlive-dummyv*,texlive-dummyw*,texlive-dummyx*,texlive-dummyy*,texlive-dummyz*,texlive-dummy0*,texlive-dummy1*,texlive-dummy2*,texlive-dummy3*,texlive-dummy4*,texlive-dummy5*,texlive-dummy6*,texlive-dummy7*,texlive-dummy8*,texlive-dummy9*

Still pretty mad, but a bit less insane and - possibly - slightly more robust than the dummy package. But I'm not sure how wise the approach is or how safe.
dnf now tells me that no texlive* packages are found either installed or in the repository, though a search for texlive-dummy-cfr nonetheless finds my attempt to produce a dummy.
I'd rather not shackle dnf like this: I want to stop it installing stuff - not finding it. But only sledge hammers appear to be provided. On the bright side, most of the time dnf doesn't acknowledge the existence of any texlive packages anyway, so I guess not much is lost for practical purposes.
However, not even all this has eradicated the contamination of the texlive- packages entirely. Although the tree is empty, /usr/share/texmf is a pretty full hierarchy of empty directories. dnf tells me this is provided by texlive-base, which is not installed. So I can't even kill the thing completely with both the insane .spec and the mad dnf sledge hammer.
It is difficult to believe that there is not a cleaner, more elegant way to install Kile than one of these kludges, without abandoning Fedora.
What is the best, most elegant and robust solution on Fedora?
Note: in case it is not obvious, installing Fedora's packages is not an option. Getting rid of Fedora is an option, but that is my strategy of last resort.


text:
Q: android admob banner will not display I have tried everything (admob tutorials, GitHub clones, youtube tutorials, etc.). It will not show on any device (phone or tablet) nor emulator. If anyone could give me some direction I would be grateful.
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:ads="http://schemas.android.com/apk/res-auto" android:layout_width="match_parent" android:layout_height="match_parent" android:fitsSystemWindows="true" android:orientation="vertical"> <FrameLayout
    android:layout_width="match_parent"
    android:layout_height="192dp"
    android:background="@drawable/listback1"
    android:alpha="0.8"
    android:orientation="vertical">

    <TextView
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_gravity="bottom"
        android:paddingLeft="16dp"
        android:paddingBottom="5dp"
        android:gravity="right"
        android:textColor="@color/orange"
        style="@style/TextAppearance.AppCompat.Title"
        android:text="Food For Thought"
        android:elegantTextHeight="true"
        /> </FrameLayout>

<android.support.v7.widget.Toolbar
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="50dp"
    android:background="@drawable/textsign"
    android:id="@+id/toolbar"
    app:menu="@menu/menu_main"
    android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"
    app:title="Choose Your Dining Experiance"/>

<ExpandableListView
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:id="@+id/expandableListView"
    android:layout_alignParentTop="true"
    android:layout_alignParentLeft="true"
    android:layout_alignParentStart="true"
    android:divider="@color/orange"
    android:textColor="#000000"
    android:dividerHeight="1dp"
    android:layout_marginTop="20dp" />

    <com.google.android.gms.ads.AdView
        android:id="@+id/ad_view"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_centerHorizontal="true"
        android:layout_alignParentBottom="true"
        android:paddingTop="15dp"
        ads:adSize="BANNER"
        android:layout_below="@id/expandableListView"
        android:layout_weight="1"
        ads:adUnitId="@string/banner_ad_unit_id" />

    </LinearLayout>

    Activity
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.expandable_layout);

AdView mAdView = (AdView) findViewById(R.id.ad_view);
AdRequest adRequest = new AdRequest.Builder().build();
mAdView.loadAd(adRequest);}

gradle
     compile 'com.google.android.gms:play-services-auth:8.4.0'
     compile 'com.google.android.gms:play-services-appindexing:8.4.0'
     compile 'com.google.android.gms:play-services-ads:8.4.0'
     compile 'com.google.android.gms:play-services-identity:8.4.0'
     compile 'com.google.android.gms:play-services-gcm:8.4.0'

android manifest:
    <activity android:name="com.google.android.gms.ads.AdActivity"

     android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|ui
    Mode|screenSize|smallestScreenSize"
    android:theme="@android:style/Theme.Translucent" />

A: Change in your ExpandableListView
android:layout_height="0dp"
android:layout_weight="1"


text:
Q: Azure CLI commands not working inside azure function apps (portal) I have powershell scripts which is running locally.But those scripts not running insite function apps > powershell (windows) machine.

az login --service-principal -u $ServicePrincipalId -p
  $ServicePrincipalPass --tenant $ServicePrincipalTenant

Getting below when i run the script
ERROR: The term 'az' is not recognized as the name of a cmdlet, function, script file, or operable program.

since i dont have az cli installed in the windows machine,  i have added below line to install az command in my script.
Install-Module -Name Az -AllowClobber  -Scope CurrentUser

Getting access issue while installing the az.
2019-06-11T12:42:59.698 [Warning] WARNING: InternalWebProxy: Could not find a part of the path 'D:\Program Files (x86)\SiteExtensions\Functions\2.0.12507\32bit\workers\powershell\runtimes\win-x86\lib\netcoreapp2.1\ref'.
2019-06-11T12:42:59.843 [Warning] WARNING: Win32Helpers: Could not find a part of the path 'D:\Program Files (x86)\SiteExtensions\Functions\2.0.12507\32bit\workers\powershell\runtimes\win-x86\lib\netcoreapp2.1\ref'.
2019-06-11T12:43:05.023 [Warning] WARNING: User declined to install module (Az).

even -Force is not working. need to know what is causing the issue.
Note :- The script is perfectly running in local windows machine. the issue is when try to run on portal > functionapp> timertrigger
Attaching azure function app creating with windows machine

Getting error after adding cli folder into kudu
> 2019-06-13T12:29:40.510 [Error] ERROR:   File
> "C:\Users\VSSADM~1\AppData\Local\Temp\pip-install-68v0_w99\azure-cli-core\azure\cli\core\commands\__init__.py", line 523, in execute Microsoft.Azure.WebJobs.Script.Rpc.RpcException :
> Result: ERROR:   File
> "C:\Users\VSSADM~1\AppData\Local\Temp\pip-install-68v0_w99\azure-cli-core\azure\cli\core\commands\__init__.py", line 523, in execute Exception:   File
> "C:\Users\VSSADM~1\AppData\Local\Temp\pip-install-68v0_w99\azure-cli-core\azure\cli\core\commands\__init__.py", line 523, in execute

kudu console

A: As the error shows that you do not install the Azure CLI in the environment. To install the Azure CLI, a possible way is to copy the whole CLI directory that you installed in the local machine to your function KUDU path /home.
In the test, the copy path in the function KUDU is D:/home/CLI2/.
Test code:
D:/home/CLI2/wbin/az.cmd login --service-principal -u 'xxxxxx' -p 'xxxxxx' --tenant 'xxxxxx' | Write-Host

The screenshot of the output: