text:
Q: How to insert data into SQL database using jquery How to insert data into SQL database using jquery.
I am trying to insert data into database using jQuery but data is not inserting.It is displaying alert as error. Can anyone help me with this.
CS:
[WebMethod]
public static void insertion(string Title,string Description,string  Category,
string Priority,string Attachment)
{
   using (SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["msgscon"].ConnectionString))
   {
       using (SqlCommand cmd = new SqlCommand("INSERTMD", con))
       {
           cmd.CommandType = CommandType.StoredProcedure;
           cmd.Parameters.AddWithValue("@MD_TITLE", Title);
           cmd.Parameters.AddWithValue("@MD_DESC", Description);
           cmd.Parameters.AddWithValue("@MD_CAT_ID", Category);
           cmd.Parameters.AddWithValue("@MD_P_ID", Priority);
           cmd.Parameters.AddWithValue("@MD_ATTACHMENT", Attachment);
           con.Open();
           cmd.ExecuteNonQuery();
           con.Close();
       }
   }
}

aspx:
$('#btn_savemd').click(function () {
           var title = $('#tb_title').val();
           var cat = $('#DDL_cat option:selected').index();
           var prior = $('#DDL_prior option:selected').index();
           var desc = $('#tb_desc').val();
           var attach = $('#FileUpload1').val();
           var strfields = ''; var missfields = ''; var i = 0;
           if (title == '') {
               missfields = true;
               i = i + 1;
               strfields += i + " Please enter  Title \n";
           }
           if (cat == 0) {
               missfields = true;
               i = i + 1;
               strfields += i + " Please select Category \n";
           }
           if (prior == 0) {
               missfields = true;
               i = i + 1;
               strfields += i + " Please select Priority \n";
           }
           if (desc == '') {
               missfields = true;
               i = i + 1;
               strfields += i + " Please enter Description \n";
           }

           if (attach == '') {
               missfields = true;
               i = i + 1;
               strfields += i + " Please select Attachment \n";
           }
           if (missfields) {
               alert('Please fill following details \n' + strfields);
               return false;
           }
           var data = { Title: title, Description: desc, Category: cat Priority: prior, Attachment: attach };
           $.ajax({
               type: "POST",
               contentType: "application/json; charset=utf-8",
               url: "jQueryMsgs.aspx/insertion",
               data: '{' + JSON.stringify(data) + '}',
               dataType: "json",
               success: function () {
                       alert('Message Details Added Successfully');
               },
               error: function () {
                   alert('Error');
               }
           });
       });


text:
Q: hdparm: SECURITY_SET_PASS: Input/output error I'm trying to use hdparm to secure erase an SSD as suggested here.
Following the directions in that guide has worked okay so far, but I can't seem to resolve this error:
~ $ sudo hdparm --user-master m --security-set-pass NUL /dev/sda
security_password="NUL"

/dev/sda:
 Issuing SECURITY_SET_PASS command, password="NUL", user=master, mode=high
SECURITY_SET_PASS: Input/output error

I've searched around and tested things, as suggested here, but to no avail. How else can I deep-wipe an SSD, if this is not an option?
Note: Yes, there is a BIOS password "on" the hard disk, in that it must be typed at boot, but it's not (as far as I know) attached to the disk itself.

sudo hdparm -I /dev/sda:
/dev/sda:

ATA device, with non-removable media
    Model Number:       SanDisk SDSSDA240G
    Serial Number:      153655402044
    Firmware Revision:  U21010RL
    Media Serial Num:
    Media Manufacturer:
    Transport:          Serial, ATA8-AST, SATA 1.0a, SATA II Extensions, SATA Rev 2.5, SATA Rev 2.6, SATA Rev 3.0
Standards:
    Used: unknown (minor revision code 0x0110)
    Supported: 9 8 7 6 5
    Likely used: 9
Configuration:
    Logical     max current
    cylinders   16383   16383
    heads       16  16
    sectors/track   63  63
    --
    CHS current addressable sectors:   16514064
    LBA    user addressable sectors:  268435455
    LBA48  user addressable sectors:  468862128
    Logical  Sector size:                   512 bytes
    Physical Sector size:                   512 bytes
    Logical Sector-0 offset:                  0 bytes
    device size with M = 1024*1024:      228936 MBytes
    device size with M = 1000*1000:      240057 MBytes (240 GB)
    cache/buffer size  = unknown
    Form Factor: 2.5 inch
    Nominal Media Rotation Rate: Solid State Device
Capabilities:
    LBA, IORDY(can be disabled)
    Queue depth: 32
    Standby timer values: spec'd by Standard, no device specific minimum
    R/W multiple sector transfer: Max = 1   Current = 1
    Advanced power management level: disabled
    DMA: mdma0 mdma1 mdma2 udma0 udma1 udma2 udma3 udma4 udma5 *udma6
         Cycle time: min=120ns recommended=120ns
    PIO: pio0 pio1 pio2 pio3 pio4
         Cycle time: no flow control=120ns  IORDY flow control=120ns
Commands/features:
    Enabled Supported:
       *    SMART feature set
       *    Security Mode feature set
       *    Power Management feature set
       *    Write cache
            Look-ahead
       *    Host Protected Area feature set
       *    WRITE_BUFFER command
       *    READ_BUFFER command
       *    DOWNLOAD_MICROCODE
            Advanced Power Management feature set
            SET_MAX security extension
       *    48-bit Address feature set
       *    Device Configuration Overlay feature set
       *    Mandatory FLUSH_CACHE
       *    FLUSH_CACHE_EXT
       *    SMART error logging
       *    SMART self-test
       *    General Purpose Logging feature set
       *    WRITE_{DMA|MULTIPLE}_FUA_EXT
       *    64-bit World wide name
       *    {READ,WRITE}_DMA_EXT_GPL commands
       *    Segmented DOWNLOAD_MICROCODE
       *    Gen1 signaling speed (1.5Gb/s)
       *    Gen2 signaling speed (3.0Gb/s)
       *    Gen3 signaling speed (6.0Gb/s)
       *    Native Command Queueing (NCQ)
       *    Host-initiated interface power management
       *    Phy event counters
       *    READ_LOG_DMA_EXT equivalent to READ_LOG_EXT
       *    DMA Setup Auto-Activate optimization
            Device-initiated interface power management
       *    Software settings preservation
            Device Sleep (DEVSLP)
       *    Data Set Management TRIM supported (limit 8 blocks)
Security:
    Master password revision code = 11822
        supported
        enabled
        locked
    not frozen
    not expired: security count
        supported: enhanced erase
    Security level high
    2min for SECURITY ERASE UNIT. 2min for ENHANCED SECURITY ERASE UNIT.
Logical Unit WWN Device Identifier: 5001b44ed2285a3c
    NAA     : 5
    IEEE OUI    : 001b44
    Unique ID   : ed2285a3c
Checksum: correct
Device Sleep:
    DEVSLP Exit Timeout (DETO): 70 ms (drive)
    Minimum DEVSLP Assertion Time (MDAT): 31 ms (drive)

A: My computer's BIOS had a password on it.
Removing the password, rebooting, and retrying the above command fixed the problem.
My BIOS has a password again.

redpajama_set_name: RedPajamaStackExchange


text:
Q: How I can print listbox item count along with Expander header? I want to print listbox item count alog with header of expander like
header1 (count) . How can I achieve this in WPF

A: You haven't provided any code for what you have done, such as if you are using a ViewModel or doing code-behind. There are multiple ways to go about it.
My ViewModel Way
In this example, I've made a ViewModel containing an ObservableCollection of string to populate the ListBox. The Expander header is bound to a property that is populated using a combination of the HeaderText and ItemCount.
   public class ViewModel : INotifyPropertyChanged
   {

      public event PropertyChangedEventHandler PropertyChanged;

      private string _headerText = string.Empty;
      private string _headerTextFull = string.Empty;
      private ObservableCollection<string> _listItems = new ObservableCollection<string>();
      private int _itemCount = 0;

      public ViewModel() { }

      public string HeaderText
      {
         get { return _headerText; }
         set
         {
            _headerText = value;
            NotifyPropertyChanged("HeaderText");
            UpdateHeader();
         }
      }

      public string HeaderTextFull
      {
         get { return _headerTextFull; }
         set
         {
            _headerTextFull = value;
            NotifyPropertyChanged("HeaderTextFull");
         }
      }

      public ObservableCollection<string> ListItems
      {
         get { return _listItems; }
         set
         {
            _listItems = value;
            NotifyPropertyChanged("ListItems");
            ItemCount = (_listItems != null ? _listItems.Count : 0);
         }
      }

      public int ItemCount
      {
         get { return _itemCount; }
         set
         {
            _itemCount = value;
            NotifyPropertyChanged("ItemCount");
            UpdateHeader();
         }
      }

      private void UpdateHeader()
      {
         HeaderTextFull = String.Format("{0} ({1})", _headerText, _itemCount);
      }

      public void NotifyPropertyChanged(string propertyName)
      {
         if (PropertyChanged != null)
         {
            PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
         }
      }
   }

The XAML for the Window:
<Window x:Class="SO37192142.Window1"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    Title="Window1" Height="300" Width="300">
    <Grid>
      <Grid.RowDefinitions>
         <RowDefinition Height="*" />
         <RowDefinition Height="Auto" />
      </Grid.RowDefinitions>
      <Expander Grid.Row="0" Name="expander1" Header="{Binding Path=HeaderTextFull, FallbackValue='Items'}" IsExpanded="True">
         <Grid>
            <ListBox Name="listBox1" Width="Auto" Height="Auto" ItemsSource="{Binding Path=ListItems}" />
         </Grid>
      </Expander>
      <Button Grid.Row="1" Content="Add an Item" Click="Button_Click" />
   </Grid>
</Window>

The code-behind:
   public partial class Window1 : Window
   {
      ViewModel myModel = new ViewModel();
      public Window1()
      {
         InitializeComponent();

         myModel.ListItems.CollectionChanged += new NotifyCollectionChangedEventHandler(ListItems_CollectionChanged);

         myModel.HeaderText = "Items";
         myModel.ListItems.Add("Item 1");
         myModel.ListItems.Add("Item 2");
         this.DataContext = myModel;
      }

      void ListItems_CollectionChanged(object sender, NotifyCollectionChangedEventArgs e)
      {
         myModel.ItemCount = myModel.ListItems.Count;
      }

      void Button_Click(object sender, RoutedEventArgs e)
      {
         myModel.ListItems.Add("Another item");
      }

   }

When it starts, the Expander header will say "Items (2)". Every time the button is clicked, the header will update to show the new count.
Slight Variation of Above
Here's an example that provides the above example, but also adds a second list to demonstrate a different way. Notice the Expander.Header section.
<Window x:Class="SO37192142.Window1"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    Title="Window1" Height="300" Width="300">
    <Grid>
      <Grid.RowDefinitions>
         <RowDefinition Height="*" />
         <RowDefinition Height="Auto" />
      </Grid.RowDefinitions>
      <Grid.ColumnDefinitions>
         <ColumnDefinition Width="*" />
         <ColumnDefinition Width="*" />
      </Grid.ColumnDefinitions>

         <Expander Grid.Row="0" Grid.Column="0" Name="expander1" Header="{Binding Path=HeaderTextFull, FallbackValue='Items'}" IsExpanded="True">
         <Grid>
            <ListBox Name="listBox1" Width="Auto" Height="Auto" ItemsSource="{Binding Path=ListItems}" />
         </Grid>
      </Expander>

       <!-- SECOND EXPANDER THAT DOESN'T RELY ON A VIEWMODEL -->
      <Expander Grid.Row="0" Grid.Column="1" Name="expander2" IsExpanded="True">
         <Expander.Header>
            <StackPanel Orientation="Horizontal">
               <TextBlock Text="{Binding ElementName=listBox2, Path=Items.Count, UpdateSourceTrigger=PropertyChanged, StringFormat={}Items ({0})}" />
            </StackPanel>
         </Expander.Header>
         <Grid>
            <ListBox Name="listBox2" Width="Auto" Height="Auto" ItemsSource="{Binding Path=ListItems}" />
         </Grid>
      </Expander>
      <Button Grid.Row="1" Grid.ColumnSpan="2" Content="Add an Item" Click="Button_Click" />
   </Grid>
</Window>

Only Code Behind
If, for some reason, you are just using code-behind, you can do it this way:
   public partial class Window1 : Window
   {
      public Window1()
      {
         InitializeComponent();

         ((INotifyCollectionChanged)listBox1.Items).CollectionChanged += new NotifyCollectionChangedEventHandler(ListBox_CollectionChanged);

      }

      void ListBox_CollectionChanged(object sender, NotifyCollectionChangedEventArgs e)
      {
         expander1.Header = "Items (" + listBox1.Items.Count + ")";
      }

   }


text:
Q: Condition whether field A or B is required in Django Rest Framework I have a serializer in which I would like to give the opportunity to send a NEW address with a POST request OR give an ID of an already existing address.
One of both is required, but right now it asks for both to be given.
Any possibility to achieve that it validates with a condition?
class OrderSerializer(serializers.ModelSerializer):

class Meta:
    model = Order
    #fields = '__all__'
    exclude = ['in_calculation','canceled',]
address = AdressSerializer()
addressid = serializers.CharField(source='address')
read_only_fields = ['id','user','status','costs','']

A: You could use validate() and a customized create/update method like this:
class OrderSerializer(serializers.ModelSerializer):
    address_detail = AddressSerializer(write_only=True, required=False)

    class Meta:
        model = Order
        fields = (
            'address',         # to set from an existing address
            'address_detail',  # to create a whole new address
        )
        extra_kwargs = {
            'address': {'required': False},  # make `address` to optional if your address in model is required.
        }

    def validate(self, attrs):
        # if `address` and `address_detail` are both present or none of them is present
        if bool('address' in attrs) == bool('address_detail' in attrs):
            raise serializers.ValidationError('You can specify exactly one from these two fields.')

        return attrs

    def create(self, validated_data):
        # do custom logic

A: class OrderSerializer(serializers.ModelSerializer):
    class Meta:
        model = Order

        extra_kwargs = {
            'address': {'required': False},
        }

        exclude = [] # some fields that should not be shown
        read_only_fields = [] # some fields that should not be edited

    # Add a nested Serializer to add new addresses while creating an order
    address_detail = addressSerializer(required=False)

    def __init__(self, *args, **kwargs):
        super().__init__(*args, **kwargs)
        try:
            if "GET" in self.context['request'].method:
                self.fields['client'] = ClientSerializer()
                # ... some Nested Serializers which are ready-only on GET request.
        except KeyError:
            pass

    def create(self,validated_data):
        # check for uniqueness of ordernr and clientnr
        try:
            order = Order.objects.get(client=validated_data.get('client'),ordernr=validated_data.get('ordernr'))
            if order:
                raise ValidationError({'ordernr':'Ordernumber and Client-combination already exists'})
        except ObjectDoesNotExist:

            if validated_data.get('address_detail'):
                address_detail = validated_data.pop('address_detail')
                if address_detail:
                    address, existent = address.objects.get_or_create(**address_detail)
                    order = Order.objects.create(**validated_data, address=address)
            elif validated_data.get('address'):
                order = Order.objects.create(**validated_data)
        return order

    def validate(self, data):
        validationerrors = {}
        print(data)
        # if `address` and `address_detail` are both present or none of them is present
        if bool('address' in data) == bool('address_detail' in data):
        validationerrors['address'] = "You need to specify exactly one from these two fields."
        # a lot of other validations...
        if validationerrors:
            raise serializers.ValidationError(validationerrors)
        return data


text:
Q: angularjs angular-google-chart, remove the percent from the tooltip of piechart I use angularjs and angular-google-chart directive to make PieChart.
This is a working* example on plunkr

The A pie is with true data but i want to render something like B pie because I have on element ('mnhn') who have 99% of the data and the others elements are almost unselecteable on hover.
This is A pie rows data :
var rows =[
    {"c":[{"v":"mnhn"},{"v":6311883}]},
    {"c":[{"v":"um2"},{"v":36042}]},
    {"c":[{"v":"mhnaix"},{"v":25346}]},
    ...
];

This is B pie rows data
// the only change is that i divided the value for "mnhn" by 15 and add the "f" property
var rows =[
    {"c":[{"v":"mnhn"},{"v":420792.2,"f":6311883}]},
    {"c":[{"v":"um2"},{"v":36042,"f":36042}]},
    {"c":[{"v":"mhnaix"},{"v":25346,"f":25346}]},
    ...
]

Now the chart use the "v" property to calculate the percent but it also display this (wrong) percent on the tooltip on hover. I want to remove the percent from the tooltip or replace it by the "f" property (which can be a percent that i calculate).
Using "tooltip": {'text' : 'value' } with "f" property make the google-chart.js crash.
Any advice please ?

A: problem solved.
The plunckr was updated too.
var rows =[
{"c":[{"v":"mnhn"},{"v":420792.2,"f":"6311883"}]},
{"c":[{"v":"um2"},{"v":36042,"f":"36042"}]},
{"c":[{"v":"mhnaix"},{"v":25346,"f":"25346"}]},
...

]
It display only the "f" value with the option "tooltip": {'text' : 'value'}. In the rows data the field "f" MUST BE A STRING TO WORK PROPERLY or the code crash. take 2 days to found it...


text:
Q: Understanding drawImage() I've been having trouble with drawing using drawImage(BufferedImage, int, int, null). I always get a NullPointerException for the drawImage line, even when I am sure that my BufferedImage input exists and is, in fact, a BufferedImage. My code is below, and I guarantee that the getTerrainAsset() method of Area will return a BufferedImage.
import javax.swing.JFrame;
import java.awt.Graphics;
import java.awt.Image;
import java.awt.image.*;

public class CastleDefense {

   public static void main(String[] args) {
    new CastleDefense();
  }
  public CastleDefense() {
    Area area = new Area();
    JFrame frame = new JFrame("Castle Defense");
    frame.setSize(300, 500);
    Graphics g = area.getGraphics();
    g.drawImage(area.myArea[0][0].getTerrainAsset(), 10, 10, null);
    frame.setVisible(true);
    frame.add(area);
  }
 }

In other code I've seen that uses Graphics, there's a paintComponent(Graphics) method that contains the drawImage line and a super.paintComponent(Graphics) line, but the paintComponent(Graphics) method itself is never called in the main method. I don't understand how this works.


text:
Q: C++ array of unknown length strings with behaviour like a Python list of strings I'm trying to learn C++ from a Python background. I've been finding it difficult to find C++ learning materials that have engaging examples or toy program guides that feature something simple yet meaningful to me (don't get me wrong - there's tonnes of explanatory material but I find I learn best through toy examples that nonetheless have some utility).
So as an exercise, I want to write a program in C++ that can basically store a bunch of sentences that are being inputted line-by-line, and then print out those sentences all at once. It may be a little easier to explain if I just show how I would write this in Python 3:
print("Your notes are now being recorded. Type 'e' and press enter to stop taking notes.")

note_list = []
for i in note_list:
    a = input()
    if a == 'e':
        break
    note_list.append(a)

for i in note_list:
    print(i)

I'm not under any illusions that this can be expressed nearly as easily in C++, but I'm having trouble knowing how to replicate the string storage component.
At the moment I'm shamefully only able to express my starting prompt and initialise a string value in C++ as follows:
# include <iostream>
# include <string>

int main()
{
    std::cout << "Your notes are now being recorded. Type 'e' and press enter to stop taking notes.\n";
    std::string x;
    int flag = 1;
    while (flag == 1)
    {
        // presumably a function will go here that adds any input unless
        // it's 'e' which will make the flag = 0
        std::getline(std::cin, x) // some variation of this maybe?
    }

    // Once I have my collection of strings (an array of strings?) I assume I
    // use a C++ for loop very similar to how I might use a Python for loop.

    return 0;
}

Could I please have some direction as to how I might achieve my goal? Even just some general directions to specific resources would be fantastic.
Again, my main point of uncertainty is in figuring out how to store each string in a way similar to the way I would simply append them a list in Python (or at least as easily as possible).
My apologies if the question is a little broad.
Thanks.

A: What you're looking for here is two different things: storing input until a condition is met, and then outputting each of those stored inputs.
Getting inputs
To collect the inputs, given that you don't know how many to expect, I'd use a vector - it's similar to a python list in that it is a dynamic collection type. You'll need to include it:
#include <vector>

There are multiple ways to get a value into a vector, but push_back(value) works similarly to python's list.append - it adds the specified value to the end of the collection.
std::vector<std::string> inputs; // A vector (of strings) to collect inputs

while(true){  // Infinite loop
    // Retrieve input
    std::string input;
    std::getline(std::cin, input);

    // Check for terminal input
    if(input == "e"){
        break;
    }

    // Add the input to our collected inputs
    inputs.push_back(input);
}

Outputting stored strings
To output the stored inputs, you could use a traditional for loop, but coming from a python background you may find that a range-based for loop (also referred to as a for-each loop) feels more familiar.
// Range-based for loop
for(const auto& output : inputs){
    std::cout >> output >> endl;
}


text:
Q: xml.dom.minidom Document() in Python/django outputting memory location I'm learning Python and django at the same time.  I'm trying to create an xml document to return some XML from a view.  I'm using the django development server at the moment and I keep getting this information spitting out in my views instead of the document I tried to create.
Here's my code
    from django.http import HttpResponse
    from mypoject.myapp.models import Username
    from django.core import serializers
    from xml.dom.minidom import Document
    import datetime

    def authenticate(request, username):
        if request.method == "GET":

            #Try to get the username
            try:
                checkUser = Username.objects.get(username__exact = username)
                user = userCheck.get(username__exact = username)
                userXML = serializers.serialize("xml", checkUser)

            except Username.DoesNotExist:
                #return XML with status "Failed"
                return HttpResponse(xml, mimetype="text/xml")
            except:
                #return XML with status "Failed"

                xmlFailed = Document()

                meta = xmlFailed.createElement("meta")
                xmlFailed.appendChild(meta)

                status = xmlFailed.createElement("status")
                meta.appendChild(status)
                statusText = xmlFailed.createTextNode("Failed")
                status.appendChild(statusText)

                message = xmlFailed.createElement("message")
                meta.appendChild(message)

                totalRecords = xmlFailed.createElement("totalRecords")
                meta.appendChild(totalRecords)

                executionTime = xmlFailed.createElement("executionTime")
                meta.appendChild(executionTime)

                return HttpResponse(xmlFailed, mimetype="text/xml")
            else:
                #return happy XML code with status "Success"

And here's what's going to the screen when I view it in my browser...
<xml.dom.minidom.Document instance at 0x993192c>

If I comment out the Document() creation that goes away.  So I'm think I just need it to not spit out the information.  I've been searching all over and I can't find a strait answer which leads me to believe I'm missing something blatantly obvious.
Thanks for any help!

A: You'll need to call xmlFailed.toxml() or the like in order to get XML out of your object -- looks like that's not what you're doing (in the code you didn't show us).


text:
Q: Generate a unicode map in a PDF with iTextSharp I'm trying to generate a unicode map in a pdf.
In this pdf unicode map is missing for a specific font. I need to extract text from the page but without this map it gives me strange characters.
Using Code from itextsharp source code, I wrote this code.
Anyway, pageText1 and pageText2 seems to be the same ignoring metrics I defined.
static void Main(string[] args)
    {
        var textPart = ReadFilePart("test.pdf", 1);
    }

    private static string ReadFilePart(string fileName, int pageNumber)
    {
        var pdfReader = new PdfReader(fileName);

        var pageText1 = PdfTextExtractor.GetTextFromPage(pdfReader, pageNumber, new SimpleTextExtractionStrategy());

        pdfReader = fontFix(pdfReader);

        var pageText2 = PdfTextExtractor.GetTextFromPage(pdfReader, pageNumber, new SimpleTextExtractionStrategy());

        pdfReader.Close();

        return pageText;
    }

    static PdfReader fontFix(PdfReader reader)
    {
        Dictionary<int, int[]> longTag = new Dictionary<int, int[]>
        {
            {1, new[] {32,32,32}},
            {2, new[] {33,33,33}},
            {3, new[] {34,34,34}},
            {4, new[] {35,35,35}},
            {5, new[] {36,36,36}},
            {6, new[] {37,37,37}},
            {7, new[] {38,38,38}},
            {8, new[] {39,39,39}},
            {9, new[] {40,40,40}},
            {10, new[] {41,41,41}},
            {11, new[] {42,42,42}},
            {12, new[] {43,43,43}},
            {13, new[] {44,4,44}},
            {14, new[] {45,45,45}},
            {15, new[] {46,46,46}},
            {16, new[] {47,47,47}},
            {17, new[] {48,48,48}},
            {18, new[] {49,49,49}},
            {19, new[] {50,50,50}},
            {20, new[] {51,51,51}},
            {21, new[] {52,52,52}},
            {22, new[] {53,53,53}},
            {23, new[] {54,54,54}},
            {24, new[] {55,55,55}},
            {25, new[] {56,56,56}},
            {26, new[] {57,57,57}},
            {27, new[] {58,58,58}},
            {28, new[] {59,59,59}},
            {29, new[] {60,60,60}},
            {30, new[] {61,61,61}},
            {31, new[] {62,62,62}},
            {32, new[] {63,63,63}},
            {33, new[] {64,64,64}},
            {34, new[] {65,65,65}},
            {35, new[] {66,66,66}},
            {36, new[] {67,67,67}},
            {37, new[] {68,68,68}},
            {38, new[] {69,69,69}},
            {39, new[] {70,70,70}},
            {40, new[] {71,71,71}},
            {41, new[] {72,72,72}},
            {42, new[] {73,73,73}},
            {43, new[] {74,74,74}},
            {44, new[] {75,75,75}},
        };

        int[][] metrics = new int[longTag.Count][];
        longTag.Values.CopyTo(metrics, 0);

        int documentPages = reader.NumberOfPages;
        for (int page = 1; page <= documentPages; page++)
        {
            PdfDictionary pageResources = reader.GetPageResources(page);
            if (pageResources == null)
                continue;
            PdfDictionary pageFonts = pageResources.GetAsDict(PdfName.FONT);
            if (pageFonts == null || pageFonts.Size == 0)
                continue;

            foreach (PdfName key in pageFonts.Keys)
            {
                PdfIndirectReference fontReference = pageFonts.GetAsIndirectObject(key);
                if (fontReference == null)
                    continue;

                DocumentFont font = (DocumentFont)BaseFont.CreateFont((PRIndirectReference)fontReference);
                if (font == null)
                    continue;

                var unicodeMap = GetToUnicode(metrics);

                font.FontDictionary.Put(PdfName.TOUNICODE, unicodeMap);
            }
        }
        return reader;
    }

    public static PdfStream GetToUnicode(Object[] metrics)
    {
        if (metrics.Length == 0)
            return null;
        StringBuilder buf = new StringBuilder(
            "/CIDInit /ProcSet findresource begin\n" +
            "12 dict begin\n" +
            "begincmap\n" +
            "/CIDSystemInfo\n" +
            "<< /Registry (TTX+0)\n" +
            "/Ordering (T42UV)\n" +
            "/Supplement 0\n" +
            ">> def\n" +
            "/CMapName /TTX+0 def\n" +
            "/CMapType 2 def\n" +
            "1 begincodespacerange\n" +
            "<0000><FFFF>\n" +
            "endcodespacerange\n");
        int size = 0;
        for (int k = 0; k < metrics.Length; ++k)
        {
            if (size == 0)
            {
                if (k != 0)
                {
                    buf.Append("endbfrange\n");
                }
                size = Math.Min(100, metrics.Length - k);
                buf.Append(size).Append(" beginbfrange\n");
            }
            --size;
            int[] metric = (int[])metrics[k];
            string fromTo = ToHex(metric[0]);
            buf.Append(fromTo).Append(fromTo).Append(ToHex(metric[2])).Append('\n');
        }
        buf.Append(
            "endbfrange\n" +
            "endcmap\n" +
            "CMapName currentdict /CMap defineresource pop\n" +
            "end end\n");
        string s = buf.ToString();
        PdfStream stream = new PdfStream(PdfEncodings.ConvertToBytes(s, null));
        stream.FlateCompress(-1);
        return stream;
    }
    internal static string ToHex(int n)
    {
        if (n < 0x10000)
            return "<" + System.Convert.ToString(n, 16).PadLeft(4, '0') + ">";
        n -= 0x10000;
        int high = (n / 0x400) + 0xd800;
        int low = (n % 0x400) + 0xdc00;
        return "[<" + System.Convert.ToString(high, 16).PadLeft(4, '0') + System.Convert.ToString(low, 16).PadLeft(4, '0') + ">]";
    }


text:
Q: offlineaduiocontext.resume() does not fire on mobile safari offlineaudiocontext.state is suspended with page load on mobile safari. I used resume() method but that does not change the state and the state remains suspended. If i use a button click on the page, that changes the state from suspended to running.

alert(offlineaudiocontext.state);
if (offlineaudiocontext.state === 'suspended') {
   alert('in if');
   offlineaudiocontext.resume().then(function() {
     alert('after resume' , offlineaudiocontext.state);
   });
}
alert(offlineaudiocontext.state);

A: I believe on mobile Safari, you MUST have some kind of user gesture to start an online AudioContext. Don't know why this requirement should affect an offline audio context.


text:
Q: PlayFab integration with Azure AD B2C as OpenID Connect I am trying to integrate Azure AD B2C as OpenID Connect into PlayFab to support AD user to login into PlayFab, below are the steps which I have tried-
Azure AD B2C

*

*Registered Client app under B2C

*Create SignUp and SignIn User Flow

*Added Google and Facebook as Identity Provider under User Flow.

*Successfully able to login user using Google and Facebook.

PlayFab Configuration

*

*Created Game title

*Successfully able to add logins players using LoginWithCustomID, LoginWithFacebook.
OpenId Connect config in PlayFab:

*

*Under OpenId Connect, I have added Connection ID, Client ID, Client Secret and Issuer.

*Under Issuer, I have added entry as https://{tenant-name}.b2clogin.com/{tenant-name}.onmicrosoft.com/b2c_1_signupsignin/v2.0
Problem:
When I am trying to hit LinkOpenIdConnect API from PlayFab, API is returning blow error-
{
    "code": 403,
    "status": "Forbidden",
    "error": "NotAuthorized",
    "errorCode": 1089,
    "errorMessage": "IDX20803: Unable to obtain configuration from: 'https://{tenant-name}.b2clogin.com/{tenant-id}/v2.0/.well-known/openid-configuration'."
}

Could anyone please help me where I am doing wrong? Thank you in advance.

A: Please check if below can be worked around.
Please Make sure the Authority, on the API server, should be set to a URL that points to one of the policies so that it can be properly fetched in the openid configuration.
Make sure that policy settings have the issuer URL format set to the one that does NOT include a specific policy in the issuer URL.
And provide the generic issuer url in portal  like below
https:// /tfp//v2/
(or)
policy specific issuer :
https://domain/tfp//b2c_1_ policy/v2/
Authority something like https://<tenantname>.b2clogin.com/tfp/{tenantName}.onmicrosoft.com/B2C_1_{signup_policy}/v2.0/ "
Or
https://<tenantname>.b2clogin.com/tfp/TenantId /B2C_1_{signup_policy}/v2.0/

/tfp is optional but try to include and check by adding tfp
Where Instance is "https://XXXX.b2clogin.com/tfp/",  Domain is "XXXX.onmicrosoft.com"
Issuer (iss) claim is a property that identifies the Azure AD B2C tenant that issued the token.
The default value is https://<domain>/{B2C tenant GUID}/v2.0/.
whereas, the value of https://<domain>/tfp/{B2C tenant GUID}/{Policy ID}/v2.0/
includes IDs for both the Azure AD B2C tenant and the user flow that was used in the token request
Reference


text:
Q: chaining load and show intersitial ad with admob and libgdx I am using  this code to show load an add
AdRequest interstitialRequest = new AdRequest.Builder().build();
interstitialAd.loadAd(interstitialRequest);

and this to show it
interstitialAd.show();

What way do you recommend to chain this 2 events. The goal is to automatically present an interstitial ad every 60s. Something like calling a function loadAd(), and once loading is done, it shows it. Basically I some kind of listener that gets triggered when the ad is loaded and ready to display.

A: First, you should not display interstitials like that (at regular intervals). It should always be at logical break points during the usage of your app like level chande or exiting the app.
But, if you still want go go ahead and do that write a timer and check elapsed time and call the show method immediately followed by the load method every 60 secs.
- Read more here
Again, I'll highly recommend not to call it like that every minute. It is not as per guidelines and will severely degrade the user experience.


text:
Q: Javascript Affecting Image Position I have an image and a line of text on top of a blue box, all fading in with JavaScript. If I don't use any JS, I can center the image without any problems. But as soon as the JS is used, the image does not center anymore. However, the line of text does. Why does this happen?
Here are the code samples:

$("#box").velocity("fadeIn", {
  duration: 5500
});

$("#txt").velocity("fadeIn", {
  duration: 10500
});

$("#pic").velocity("fadeIn", {
  duration: 10500
});
#box {
  width: 100%;
  height: 1000px;
  background-color: lightblue;
}

p {
  text-align: center;
}

img {
  width: 40%;
  display: block;
  margin: 0 auto;
}
<!DOCTYPE html>

  <meta charset="UTF-8">
  <link rel="stylesheet" href="cultura.css">

 a line of text

A: Velocity is setting your element's CSS display property to inline. Explicitly specify the fadeIn should set the display to block on your #img element:

$("#box").velocity("fadeIn", {
  duration: 5500
});

$("#txt").velocity("fadeIn", {
  duration: 10500
});

$("#pic").velocity("fadeIn", {
  duration: 10500,
  display: "block"
});
#box {
  width: 100%;
  height: 1000px;
  background-color: lightblue;
}

p {
  text-align: center;
}

img {
  width: 40%;
  display: block;
  margin: 0 auto;
}
<!DOCTYPE html>

  <meta charset="UTF-8">
  <link rel="stylesheet" href="cultura.css">

 a line of text


text:
Q: division of polynomials Consider the set of polynomials $k[x^1,\cdots,x^n]$ over any field $k$. Now, given $p,q\in k[x^1,\cdots,x^n]$, what are the necessary and suficient conditions in order to q divide p? That is: $\exists r \in k[x^1,\cdots,x^n]$ such that $p = rq$. I know that necessary condition is that every root of $q$ is also a root to $p$, but I don't know if this is a sufficient condition since I only can prove it when the field is algebraic close $k=\bar{k}$.
Is this even a good question to be done? If not please let me know why


text:
Q: Solidworks: activation license mode is not supported in this virtual environment (Qemu-KVM) The question is not around Solidworks actually, so please continue to read.
The whole idea of virtualization is to be hardware independent. Before our eyes a whole new dependency level is being created - affixment to the hypervisor.
As far as I know searching in a way to find a workaround of this problem is not violation of the Solidworks license and local law in my country.
My client and I want to activate Solidworks Products on KVM virtual machine. For some weird reasons (Hyper-V and VMware are supposed to be well tested :) they (developers) of Solidworks 2015 PDM don't want their products to be activated (last 2014 version worked just fine) on Qemu-KVM.
http://www.solidworks.com/sw/support/11168_ENU_HTML.htm

I am using:

As you can see it's KVM-based VM with Windows 2012 and Solidworks PDM installation.
Question:
What else can they check if I am running my VM in Qemu-KVM besides checking:

*

*MAC address(es) of VM's Ethernet adapter,

*Device driver labels,

*CPU model,

*ACPI tables.

I am going to rule out the above mentioned things in next few hours, but I'd like to know if You have any other ideas.
Solution:
It turns out they validate two things:

*

*As Michael Hampton correctly pointed there's -cpu,kvm=off option

to disable the CPUID 0x40000000 leaf.

*ACPI Tables on the guest.

Relevant parts of qemu command line parameters:
-cpu host,kvm=off -smbios type=0,vendor=LENOVO,version=FBKTB4AUS,date=07/01/2015,release=1.180 -smbios type=1,manufacturer=LENOVO,product=30AH001GPB,version=ThinkStation P300,serial=S4M88119,uuid=cecf333d-6603-e511-97d5-6c0b843f98ba,sku=LENOVO_MT_30AH,family=P300

Libvirtd config file syntax:
<domain type='kvm' xmlns:qemu='http://libvirt.org/schemas/domain/qemu/1.0'>
# Please notice there is xmlns definition in <domain> tag. Without it
# <qemu:commandline> and <qemu:arg> tags won't work.
  <name>acm-server</name>
  <uuid>d0e14081-b4a0-23b5-ae39-110a686b0e55</uuid>
  <memory unit='KiB'>81920000</memory>
  <currentMemory unit='KiB'>81920000</currentMemory>
  <vcpu placement='static'>4</vcpu>
  <os>
    <type arch='x86_64' machine='pc-1.1'>hvm</type>
    <boot dev='hd'/>
    <bootmenu enable='yes'/>
  </os>
  <features>
    <acpi/>
    <apic/>
    <pae/>
  </features>
# Please notice there is no CPU definition on the top.
  <qemu:commandline>
    <qemu:arg value='-cpu'/>
    <qemu:arg value='host,kvm=off'/>
    <qemu:arg value='-smbios'/>
    <qemu:arg value='type=0,vendor=LENOVO,version=FBKTB4AUS,date=07/01/2015,release=1.180'/>
    <qemu:arg value='-smbios'/>
    <qemu:arg value='type=1,manufacturer=LENOVO,product=30AH001GPB,version=ThinkStation P300,serial=S4M88119,uuid=cecf333d-6603-e511-97d5-6c0b843f98ba,sku=LENOVO_MT_30AH,family=P3'/>
  </qemu:commandline>
</domain>

As a proof, now it wants to activate:

Update 21.04.2017r.
DS Justice mentioned that Qemu (I used virtio in this example) disk mode may be relevant as well.

A: I just wanted to share my experience here as well, in case others are in a similar situation (trying to install solidworks on a virtualbox VM)
My attempted setup:
xubuntu 16.04 host OS, VirtualBox, Windows 10, and Solidworks 2015. I was seeing the same error discussed above.
The Solution:
The solution I eventually found was to use the hidevm.bat script included in the Solidsquad crack, for tricking Solidworks into thinking it isn't running in a VM. you can use the .bat file even if you have a legitimate license (as I would hope you do). the .bat is intended for users running Solidworks inside a VirtualBox VM, with Windows as the host OS as well, however if you're like me trying to run Linux as the host OS, you can still open up the .bat file, pick out the relevant commands, adjust them for linux, and run them. the modified relevant commands are:
VMNAME=[whatever your VM name is]
rand9="abcdefghi" #any 9 character string
rand20="abdcefghijklmnopqrst" #any 20 character string
rand8="abcdefgh" #any 8 character string

VBoxManage setextradata $VMNAME "VBoxInternal/Devices/pcbios/0/Config/DmiBIOSVendor" "American Megatrends Inc"
VBoxManage setextradata $VMNAME "VBoxInternal/Devices/pcbios/0/Config/DmiBIOSVersion" "2.1.0"
VBoxManage setextradata $VMNAME "VBoxInternal/Devices/pcbios/0/Config/DmiSystemVendor" "ASUSTek Computer"

VBoxManage setextradata $VMNAME "VBoxInternal/Devices/pcbios/0/Config/DmiSystemSerial" $rand9

VBoxManage setextradata $VMNAME "VBoxInternal/Devices/ahci/0/Config/Port0/SerialNumber" $rand20

VBoxManage setextradata $VMNAME "VBoxInternal/Devices/ahci/0/Config/Port0/FirmwareRevision" $rand8
VBoxManage setextradata $VMNAME "VBoxInternal/Devices/ahci/0/Config/Port0/ModelNumber" "SEAGATE ST3750525AS"

In case your VM is configured to use EFI firmware you need to replace pcbios by efi in the keys. See 9.12. Configuring the BIOS DMI information.

A: The official way of activating Solidworks server on KVM is to apply for a "Activation Exempt licensing for SolidWorks".  We do this through the reseller, but possibly could be done directly through Solidworks support.
Solidworks sends a license file that Solidworks License Manager loads through the Advanced Options of the Server Administration tab.
Given that the last two years it has taken more than 2 weeks for Solidworks to send the license file, it would be nice to have them not blacklist KVM.
Solidworks has an "Enhancement Request" open with the title: "Provide SNL Server support for VM KVM Qemu Libvirt." ER # 1-9482749288  I found it by logging in to Solidworks portal, finding the Enhancement Request link, and typing KVM.
Please leave a comment on this Enhancement Request!  Hopefully they'll decide KVM is a legitimate virtualization environment.

A: '/> missing on EOL <qemu:arg value='type=1,manufacturer=LENOVO so here is the complete libvirt config modifications :
<domain type='kvm' xmlns:qemu='http://libvirt.org/schemas/domain/qemu/1.0'>
 (...)

... Please notice there is no CPU definition on the top.
   <qemu:commandline>
     <qemu:arg value='-cpu'/>
     <qemu:arg value='host,kvm=off'/>
     <qemu:arg value='-smbios'/>
     <qemu:arg value='type=0,vendor=LENOVO,version=FBKTB4AUS,date=07/01/2015,release=1.180'/>
     <qemu:arg value='-smbios'/>
     <qemu:arg value='type=1,manufacturer=LENOVO,product=30AH001GPB,version=ThinkStation P300,serial=S4M88119,uuid=cecf333d-6603-e511-97d5-6c0b843f98ba,sku=LENOVO_MT_30AH,family=P3'/>
   </qemu:commandline>
 (...)

A: Most current hypervisors that run on Intel hardware use CPUID leaves 0x40000000 et seq. to pass information about the hypervisor from host to guest.
KVM, Xen, VMware and Hyper-V all use this method.
This is in addition to the hypervisor feature flag set in CPUID leaf 0x1, which indicates that the machine is a virtual machine.
It's therefore trivial for a program which can call the CPUID instruction to determine whether it is running under one of these hypervisors.
Recent versions of KVM include a command line option to disable the CPUID 0x40000000 leaf, -cpu kvm=off.

A: I figured i'd share my method which worked to hide VM from Windows/Task MGR (It's also got less needless stuff and is easier to read). I was not trying to activate Solidworks but IMO this thread is more about hiding your running in a VM and maybe should be edited as such. Anyway...
Add the following to your domain.xml and make sure to completley remove the CPU Section
<domain type='kvm' xmlns:qemu='http://libvirt.org/schemas/domain/qemu/1.0'>
#Regaular Stuff
#No CPU Type Set
 <features>
    <acpi/>
    <apic/>
    <kvm>
      <hidden state='on'/>
    </kvm>
    <vmport state='off'/>
  </features>
#Add to Bottom of Domain.xml
  </devices>
  <qemu:commandline>
    <qemu:arg value='-cpu'/>
    <qemu:arg value='host,hv_time,kvm=off,hv_vendor_id=null,-hypervisor'/>
  </qemu:commandline>
</domain>

Turn VM off and back on and test!


text:
Q: Starting and then destroying a Foreground service won't stop VS debugger I have a foreground service which runs fine, when I close the application I use the OnDestroy method to stop my service. Everything seems to work but my debugger in VS2019 never stops. I checked the developer section in the emulator for Running services and there a none (related to this project), the application is closed.
This leads me to believe that there might still be something running in the back - or the VS is somehow bugged in this scenario. Am I doing the start and stop in a wrong way?
This is my service
[Service]
public class ForegroundService : Service
{
    public override IBinder OnBind(Intent intent)
    {
        return null;
    }

    public override void OnDestroy()
    {
        if (Build.VERSION.SdkInt >= BuildVersionCodes.N)
        {
            StopForeground(StopForegroundFlags.Remove);
        }
        else
        {
            StopForeground(true);
        }
        StopSelf();

        base.OnDestroy();
    }

    public override StartCommandResult OnStartCommand(Intent intent, StartCommandFlags flags, int startId)
    {
        PendingIntent pendingIntent = PendingIntent.GetActivity(
            Android.App.Application.Context,
            NotificationSettings.NotificationPendingIntentId,
            new Intent(Android.App.Application.Context, typeof(MainActivity)),
            PendingIntentFlags.UpdateCurrent);

        var notification = new NotificationCompat.Builder(Android.App.Application.Context, NotificationSettings.ChannelId)
            .SetContentIntent(pendingIntent)
            .SetContentTitle(NotificationSettings.Notification_app_name)
            .SetContentText(NotificationSettings.Notification_text)
            .SetLargeIcon(BitmapFactory.DecodeResource(Android.App.Application.Context.Resources, Resource.Drawable.xamagonBlue))
            .SetSmallIcon(Resource.Drawable.xamagonBlue)
            .SetDefaults((int)NotificationDefaults.Sound | (int)NotificationDefaults.Vibrate)
            .Build();

        StartForeground(NotificationSettings.SERVICE_RUNNING_NOTIFICATION_ID, notification);

        return StartCommandResult.Sticky;
    }
}

This is inside MainActivity:
protected override void OnCreate(Bundle savedInstanceState)
{
    TabLayoutResource = Resource.Layout.Tabbar;
    ToolbarResource = Resource.Layout.Toolbar;
    base.OnCreate(savedInstanceState);
    Xamarin.Essentials.Platform.Init(this, savedInstanceState);
    global::Xamarin.Forms.Forms.Init(this, savedInstanceState);
    CrossCurrentActivity.Current.Init(this, savedInstanceState);
    LoadApplication(new App());

    CreateNotificationChannel();

    startServiceIntent = new Intent(this, typeof(ForegroundService));
    if (Android.OS.Build.VERSION.SdkInt >= Android.OS.BuildVersionCodes.O)
    {
        StartForegroundService(intent);
    }
    else
    {
        StartService(intent);
    }
}

protected override void OnDestroy()
{
    StopService(startServiceIntent);

    base.OnDestroy();
}

Update 1
I think I'm on to something. If I StopService(startServiceIntent); on a button click and then close the app in emulator the debugger stops correctly. What I'm thinking is that OnDestroy is too late to call StopService, which leads to another question when should I then stop my service?

A: I had the same issue and had to use this in my service class
public override void OnTaskRemoved(Intent rootIntent)
{
     if (Build.VERSION.SdkInt >= BuildVersionCodes.O)
         StopForeground(true);
     else
         StopService(new Intent(this, typeof(YourServiceClass)));
    base.OnTaskRemoved(rootIntent);
    //will kill threads when app is manually killed by user.
    Java.Lang.JavaSystem.Exit(0);
}


text:
Q: Java netty/okhttp gRPC client throwing intermittent UNAVAILABLE: io exception while trying to connect I am trying to connect to go server with java GRPC client (netty and okhttp). But both of them are throwing UNAVAILABLE: io exception intermittently.
The occurrence is random and we don't know what's causing this behaviour. We found out that the request didn't reach the go server.
The blocking stub used to connect is something similar to:
public SomeServiceGrpc.SomeServiceBlockingStub getBlockingStub() {

        ManagedChannel channel = OkHttpChannelBuilder
                .forAddress(configuration.getHost(), configuration.getPort())
                .useTransportSecurity()
                .keepAliveTime(1, TimeUnit.MINUTES)
                .keepAliveTimeout(5, TimeUnit.SECONDS)
                .intercept(deadlineInterceptor)
                .build();
        return SomeServiceGrpc.newBlockingStub(channel);
    }

These are the libraries used for okhttp and protobuf:
    compile 'io.grpc:grpc-okhttp:1.21.0'
    compile 'io.grpc:grpc-protobuf:1.20.0'
    compile 'io.grpc:grpc-stub:1.20.0'

These are the libraries used for netty and protobuf:
    compile group: 'io.grpc', name: 'grpc-netty', version: '1.22.1'
    compile group: 'io.netty', name: 'netty-handler', version: '4.1.35.Final'
    compile group: 'io.netty', name: 'netty-tcnative-boringssl-static', version: '2.0.25.Final'
    compile 'io.grpc:grpc-protobuf:1.20.0'
    compile 'io.grpc:grpc-stub:1.20.0'

Any help or lead appreciated.

A: Solved it by adding keepAliveWithoutCalls as true at client and server side.
public SomeServiceGrpc.SomeServiceBlockingStub getBlockingStub() {

        ManagedChannel channel = OkHttpChannelBuilder
                .forAddress(configuration.getHost(), configuration.getPort())
                .useTransportSecurity()
                .keepAliveTime(1, TimeUnit.MINUTES)
                .keepAliveTimeout(5, TimeUnit.SECONDS)
                .keepAliveWithoutCalls(true)
                .intercept(deadlineInterceptor)
                .build();
        return SomeServiceGrpc.newBlockingStub(channel);
    }


text:
Q: Symfony 3 Looking for Class in Wrong Place I wrote some code in a Symfony 3 project that was working last night, but now when I execute sf server:run, it throws the following error:
[RuntimeException]
The autoloader expected class "InventoryBundle\InventoryBundle" to be defined in file"/Users/parth/Sites/debate-inventory/src/InventoryBundle/Tests/InventoryBundle.php". The file was found but the class was not in it, the class name or namespace probably has a typo.

I did some digging, and in the root directory of my bundle I have a file called InventoryBundle.php, which contains:
<?php

namespace InventoryBundle;

use Symfony\Component\HttpKernel\Bundle\Bundle;

class InventoryBundle extends Bundle
{
}

However, the system keeps looking for Tests/InventoryBundle.php, and I recently discovered there is a file there. The file contains:
<?php

namespace InventoryBundle\Tests;

use Symfony\Component\HttpKernel\Bundle\Bundle;

class InventoryBundle extends Bundle
{
}

I've never used the testing service before so I don't know what's going on.
Thanks in advance!


text:
Q: how can one create a purge command so I have been searching far and wide on the internet and found nothing to help me code a purge command.
how can one create a purge command? for example when a user says: ":purge (amount)"
if anyone can help me then it would be great because I spent literally hours and still can't find working one. I know this is a bit much but I don't know where else to find and ask.

A: first of all welcome to stack overflow!
So a clear/purge would require an additional argument which will read the number of messages you want to delete ( i guess you would already know that ).
So first of all you would require an if condition aruond the function in order to all only administrations/moderators to use this command which you can do by using if(message.member.roles.cache.has('Role ID')){}
After that you would require a few more if statements in case the person doesn't mention the number/ wrong input or mentions over 100 messages ( you can only delete a maximum of 100 messages at a time )
Now the thing you were waiting for, the function you can use for purge/clear is

await message.channel.messages.fetch({
  limit: args[0]
}).then(messages => {
  message.channel.bulkDelete(messages);
})

A: As you said that you have used client.on("message"), you can use the following code for your discord bot under the main javascript file.

client.on("message", async(message, args, cmd, client, Discord) => {
  if (command == "purge");
  if (message.member.roles.cache.has('Role ID')) {
    if (!args[0]) return message.reply("Number not defined");
    if (isNaN(args[0])) return message.reply("Not a real number");

    if (args[0] > 100) return message.reply('I can only delete a maximum of 100 mesages');
    if (args[0] < 1) return message.reply('You cannot delete less than 1 message');

    await message.channel.messages.fetch({
      limit: args[0]
    }).then(messages => {
      message.channel.bulkDelete(messages);
    })

  } else {
    message.channel.send('Incorrect permissions.')
  };
});


text:
Q: Repeated conditional change with sapply or a loop in R I am trying to do a conditional change for a list of 11 columns in R. My conditional is always the same survey$only0 == 1. I wrote the following code:
survey$w.house[survey$only0 == 1] <- 1
survey$w.inc[survey$only0 == 1] <- 1
survey$w.jobs[survey$only0 == 1] <- 1
survey$w.com[survey$only0 == 1] <- 1
survey$w.edu[survey$only0 == 1] <- 1
survey$w.env[survey$only0 == 1] <- 1
survey$w.health[survey$only0 == 1] <- 1
survey$w.satisf[survey$only0 == 1] <- 1
survey$w.safe[survey$only0 == 1] <- 1
survey$w.bal[survey$only0 == 1] <- 1
survey$w.civic[survey$only0 == 1] <- 1

My code works well, but I would like to shorten my code using a loop or a function as sapply or lapply. Does anyone know how to do it ?
Thank you for your help !
David

A: We can do this easily with lapply by looping through the columns of interest ('nm1'), and replace the values of it to 1 where 'only0' is 1.
survey[nm1] <- lapply(survey[nm1], function(x) replace(x, survey$only0==1, 1))

Or as @Vlo mentioned the anonymous function call is not needed
survey[nm1] <- lapply(survey[nm1], replace, list = survey$only0==1, values=1)

where
nm1 <- c("w.house", "w.inc", "w.jobs", "w.com", "w.edu", "w.env",
     "w.health", "w.satisf", "w.safe", "w.bal", "w.civic")

A: You can try,
survey[survey$only0 == 1, cols] <- 1

where cols are the columns for which you want to check the condition.
cols <- c("w.house", "w.inc", "w.jobs", "w.com", "w.edu", "w.env",
            "w.health", "w.satisf", "w.safe", "w.bal", "w.civic")


text:
Q: Search an array, display results by relevance to query I'd like to perform a search in a javascript array, that displays all results in relevance to the query, something equivalent to the following SQL statement:
"SELECT * FROM table WHERE column LIKE input"

Here's an example:
var array = [];
array[0] = "Apple";
array[1] = "Apricot";
array[2] = "Pear";
array[3] = "Peacock";

Let's say my querystring is "ap", it would return results in the following order:
1. "Apple"
2. "Apricot"

query = "p"
result:

1. "Pear"
2. "Peacock"
3. "Apple"
4. "Apricot"

query = "r"
result:

1. "Apricot"
2. "Pear"

Is this possible in javascript? How?

A: Try this,
    var arr = [];
    arr[0] = "Apple";
    arr[1] = "Apricot";
    arr[2] = "Pear";
    arr[3] = "Peacock";

    var resultArr=[];
    var str='ap'//string to search

    for(var i=0;i<arr.length;i++){
      if(arr[i].indexOf(str) != -1){
         resultArr.push(arr[i]);
      }
    }

  alert('search results:'+resultArr);
    //resultArr contains reults

A: var array = [];
array[0] = "Apple";
array[1] = "Apricot";
array[2] = "Pear";
array[3] = "Peacock";

function searchArray(query){
    resultArray = [];
    for(var i=0;i<query.length-1;i++){
        var char = query.charAt(i);
        if(array[i].indexOf(char)!=null){
            resultArray.push(array[i]);
        }
    }
    return resultArray;
}

This is untested, just off the top of my head. But you should have the result you are looking for in resultArray


text:
Q: Closed Form and Pullback compatibility given:
$U,V \subset \mathbb{R}^N, f\in C^1(V,U)$ a diffeomorphism
Let $\omega$ be a k-Form on U and $f^*\omega$ a closed Form.
Then with $ 0 = df^*(\omega)  = d \omega(df)$ we have ,that $\omega$ is a closed Form. Is this correct?

A: If $f$ is a diffeomorphism, $f^*$ is an isomorphism of vector-spaces of $(k+1)$-forms, hence $0=df^*\omega = f^*d\omega$ implies $d\omega=0$.


text:
Q: Verification by Linkedin platform team needed
*

*Created an app/product to do a social login using Linkedin for website www.lifeschool10.nl.

*The app/product was verified by the business owner of the company lifeschool10.

*However there is also verification needed by the LinkedIn platform team .... see the attachment.

*It states that this will be done in 3-5 days but sofar this has not been done.

*Can you please update me with a status or inform me what else/additional I have to do?enter image description here
Regards Walter.


text:
Q: AS3: Create static variables in registry from external list I have an application which will be using large numbers of assets. In order to better handle that I chose to use a registry to hold all the assets so they are accessible across the entire application:
package
{
    public class SpriteRegistry
    {
        public static var SPRITENAME = "link to image file";

        public function SpriteRegistry()
        {

        }

    }

}

What I would like to do is create an XML document and list off the file name and link so that when the application starts, this registry creates its variables which are freely accessible from that list without me needing to hard code any content directly into it.
Specifically what I need to know is how to get the "public static" effect or how to get an equivalent effect for variables that I CAN dynamically produce.
More info:
I am using a function that loads a sprite texture into a sprite object based on a string variable called mouseAttribute:
loadGraphic(SpriteRegistry[currentAttribute+"Texture"]);

Basically it's like a painting program but for a level editor for a video game.
The problem is that I'm eventually going to have 100+ sprites that I need to application to load and then I need the loadGraphic function to still be able to point effectively to the target sprite.
The library I'm using also needs me to embed the source into a class before I can pull it into the sprite object:
[Embed(source = "/Images/GridTile.png")]
public static var gridTileTexture:Class;

The reason I'm trying to avoid an array is because it means that I will have to search through an array of 100+ objects to find one sprite every time I click a single grid on the editor. That is going to chug.

A: It's very simple - just use a static function, which will return the XML. So you will need to load the XML file somehow (you decide where, but your registry class should have reference to it). Something similar to this:
private static var _xml:XML;

public static function initialize(xml:XML):void {
    _xml = xml;
}

public static function getXML():XML {
    return _xml;
}

So you will use it like that:
SpriteRegistry.initialize(loadedXML); // done only once when you initialize your app
trace(SpriteRegistry.getXML().someValue); // someValue is directly from the XML

It's a common used strategy and most of the times you would have something like an app initializer - something to load and instantiate all the things, then pass them to some registries that keep them stored for faster and global usage.
Edit:
After reading your further comments, I can't see any big change - everything would be ok with this resolution.
If you are worried about the 'need to search through array' - just do it as an object! This way you will be able to directly access the proper one using a key exactly like you pointed:
private static var _registry:Object;

public static function initialize(xml:XML):void {
    // loop through xml and insert items
    _registry[key] = resource;
}

public static function getResource(id):Object {
    return _registry[id];
}

This way you can use it like:
SpriteRegistry.getResource(currentAttribute+"Texture");

A: My personal opinion is that you should avoid statics wherever possible. Instead, you should just create a single instance and provide it through dependency injection where needed.
If you were to go with that approach, you could do something like:

public function getSprite(spriteName:String):Class{
    return this[spriteName];
}
or

public function getSprite(spriteName:String):Class{
    return yourDictionaryOrObject[spriteName];//I'd implement it this way
}
Otherwise you could go with something like:

public static function getSprite(spriteName):Class{
    return ThisHonkingBigUnnchangeableClassname[spriteName];
}
What I would not do is create a Dictionary in a static-only Class, because you're almost inevitably going to wind up with global mutable state.
Discussion, per request
Why would you want to create an instance and pass it, rather than hard-code a reference to a specific Class? A lot of the answers are covered in the global mutable state link above, but here are some that are specific to this kind of problem:

*

*Flexibility. Say you build everything with the idea that you'd only have one set of resources being used in parallel, then you discover you need more than one--for example you might need one for color blind users, or multiple languages, or thumbnails vs. full-sized. If you hard-code to a static, then you'll have to go in every place that was hard-coded and make some sort of change to use a different set, whereas if you use DI, you just supply a different instance loaded with different resources, and done.

*Testability. This is actually covered in the link, but I think it bears pulling out. If you want to run a quick test on something that needs a resource, you have to have that static "thing" and you can't change anything about it. It then becomes very difficult to know if the thing you're actually testing is working or if it just appears to be working based on the current implementation of the "thing."

*Resource use: everything about an all-static Class exists from the time the swf loads to the time it unloads. Instances only exist from when you instantiate them until they are garbage collected. This can be especially important with resource files that contain embedded assets.
I think the important thing about Frameworks is to realize how they work. The major ones used in ActionScript work the same way, which is they have a central event dispatcher (event bus) that anything loaded to the framework can get a reference to by declaring an interest in it by asking for it to be injected. Additionally, they watch the stage for an event that says that something has been added (in RL it's ADDED_TO_STAGE, whereas in Mate it's the Flex event CREATION_COMPLETE). Once you understand these principles, you can actually apply them yourself with a very light hand without necessarily needing everything that comes along with a framework.
TL;DR
I usually try to avoid answering questions that weren't asked, but in this case I think it would be helpful to discuss an entirely different approach to this problem. At root, the solution comes down not to injecting an entire resource instance, but instead just injecting the resource that's needed.
I don't know what the OP's code is like, but this solution should be general enough that it would work to pass named BitmapDatas to anything that implements our Interface that is capable of dispatching against whatever IEventDispatcher we set as the eventBus (this could be the stage, a particular DisplayObject, or an EventDispatcher that is created just for the purpose.
Note that this code is strikingly similar to code I have in production ;).
public class ResourceManager {
   //this can be loaded dynamically, or you can create subclasses that fill the registry
   //with embedded Classes in the constructor
   protected var registry:Dictionary = new Dictionary();
   protected var _eventBus:IeventDispatcher;
   public function registerResource(resourceName:String, resourceClass:Class):void {
      var bitmap:BitmapData = new resourceClass as BitmapData;
      if (resourceClass) {
          registry[resourceName] = bitmap;
      } else {
          trace('Class didn\'t make a BitmapData');
      }
   }
   public function getResource(resourceName:String):BitmapData {
      var resource:BitmapData = registry[resourceName];
      if (!resource) trace('there was no resource registered for', resourceName);
   }
   public function get eventBus():IEventDispatcher {
      return _eventBus;
   }
   public function set eventBus(value:IEventDispatcher):void {
      if (value != _eventBus){
         if (_eventBus) {
            _eventBus.removeEventListener(YourCustomEvent.GET_RESOURCE, provideResource);
         }
         _eventBus = value;
         if (_eventBus) {
            _eventBus.addEventListener(YourCustomEvent.GET_RESOURCE, provideResource);
         }
      }
   }
   protected function provideResource(e:YourCustomEvent):void {
      var client:IBitmapResourceClient = e.target as IBitmapResourceClient;
      if (client) {
         client.resource = getResource(e.resourceName);//your custom event has a resourceName property that you populated when you dispatched the event.
      }
   }
}

Note that I didn't provide the Interface or the custom event or an example implementation of the Interface due to the fact I am on my lunch break, but if anyone needs that to understand the code please post back and I'll fill that in.


text:
Q: Are there any restrictions in the career when you bought a starter pack? So I bought the Amarr Explorer Starter Pack on Eve Online through Steam due to being only $4. But I am far more interested in being a bounty hunter.
So I wonder if I actually need to stay as an explorer now/am I going to find it harder if I decide the switch to a bounty hunter?

A: The starter pack has nothing to do with your career, only with the ships you get as a small bonus. Just train the skills you need and do whatever you want.

A: To be clear, there are no real "careers" in EVE like there is classes in other MMOs. You choose what you do, and what interests you.


text:
Q: How I can logout throught Facebook application using C# I am working on facebook application and I wanted to logout from the facebook application so I am usgin https://www.facebook.com/logout.php? but it will not log out and reload to the facebook.com so I am using WebBrowser.
my code look like.
string LogoutUri = "https://www.facebook.com/logout.php?";
               if (uri!=null)
                {
                    if (uri.Contains("https://www.facebook.com/logout.php?"))
                    {
                        browser.Focus();
                        browser.Navigate(new Uri(LogoutUri, UriKind.RelativeOrAbsolute));
                    }
                }

I am using WPF C# for facebook application.
Thank you..!!

A: If you are using the WebBrowser control, then find the logout button control using the findhtmlcontrol in the whole webbrowser source code and then invoke the click event for the logout button. Hope this will solve the problem of yours.


text:
Q: how to configure bazel toolchain for cross compile use rules_foreign_cc my project need cross compile for arm aarch64 on ubuntu x86_64, but failed at configure stage, below is log
log
# Execution platform: //platforms:linux_gcc9_aarch64
SUBCOMMAND: # @boost//:filesystem [action 'Linking external/boost/libfilesystem.so', configuration: fc89852de14da3c51e8226c7c5e3087929e4f56710d05ed9ab86ed21b8eb16d4, execution platform: //platforms:linux_gcc9_aarch64]
(cd /root/.cache/bazel/_bazel_root/dbf178c3b436e7b271af34e78939cab5/execroot/bazel_simple_demo && \
  exec env - \
    PATH=/root/.cargo/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/usr/local/go/bin:/root/src/go/bin:/usr/local/jdk-11.0.15/bin:/root/.ft:/data/.cache/npm/global/bin \
    PWD=/proc/self/cwd \
  external/gcc9_arm_aarch64/bin/aarch64-none-linux-gnu-gcc -shared -o bazel-out/k8-fastbuild/bin/external/boost/libfilesystem.so bazel-out/k8-fastbuild/bin/external/boost/_objs/filesystem/codecvt_error_category.o bazel-out/k8-fastbuild/bin/external/boost/_objs/filesystem/directory.o bazel-out/k8-fastbuild/bin/external/boost/_objs/filesystem/exception.o bazel-out/k8-fastbuild/bin/external/boost/_objs/filesystem/operations.o bazel-out/k8-fastbuild/bin/external/boost/_objs/filesystem/path.o bazel-out/k8-fastbuild/bin/external/boost/_objs/filesystem/path_traits.o bazel-out/k8-fastbuild/bin/external/boost/_objs/filesystem/portability.o bazel-out/k8-fastbuild/bin/external/boost/_objs/filesystem/unique_path.o bazel-out/k8-fastbuild/bin/external/boost/_objs/filesystem/utf8_codecvt_facet.o bazel-out/k8-fastbuild/bin/external/boost/_objs/filesystem/windows_file_codecvt.o -Wl,-S -lstdc++ -lm -Wl,-no-as-needed -Wl,-z,relro,-z,now -Wall -pass-exit-codes '-fuse-ld=gold')
# Configuration: fc89852de14da3c51e8226c7c5e3087929e4f56710d05ed9ab86ed21b8eb16d4
# Execution platform: //platforms:linux_gcc9_aarch64
ERROR: /root/.cache/bazel/_bazel_root/dbf178c3b436e7b271af34e78939cab5/external/rules_foreign_cc/toolchains/BUILD.bazel:130:10: BootstrapGNUMake external/rules_foreign_cc/toolchains/make failed: (Exit 1): bash failed: error executing command
  (cd /root/.cache/bazel/_bazel_root/dbf178c3b436e7b271af34e78939cab5/execroot/bazel_simple_demo && \
  exec env - \
    PATH=/root/.cargo/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/usr/local/go/bin:/root/src/go/bin:/usr/local/jdk-11.0.15/bin:/root/.ft:/data/.cache/npm/global/bin \
  /bin/bash -c bazel-out/k8-opt-exec-277332AD/bin/external/rules_foreign_cc/toolchains/make_tool_foreign_cc/wrapper_build_script.sh)
# Configuration: 920514b75167e08aaf5b08b6fc5ff1721a7e3be841d2c442cd3624a15e568e52
# Execution platform: //platforms:linux_gcc9_aarch64
rules_foreign_cc: Build failed!
rules_foreign_cc: Keeping temp build directory and dependencies directory for debug.
rules_foreign_cc: Please note that the directories inside a sandbox are still cleaned unless you specify --sandbox_debug Bazel command line flag.
rules_foreign_cc: Printing build logs:
_____ BEGIN BUILD LOGS _____
+ AR=/root/.cache/bazel/_bazel_root/dbf178c3b436e7b271af34e78939cab5/execroot/bazel_simple_demo/external/gcc9_arm_aarch64/bin/aarch64-none-linux-gnu-gcc-ar
+ ARFLAGS=rcsD
+ CC=/root/.cache/bazel/_bazel_root/dbf178c3b436e7b271af34e78939cab5/execroot/bazel_simple_demo/external/gcc9_arm_aarch64/bin/aarch64-none-linux-gnu-gcc
+ CFLAGS='-fPIC -U_FORTIFY_SOURCE -fstack-protector -Wall -Wunused-but-set-parameter -Wno-free-nonheap-object -fno-omit-frame-pointer -march=armv8-a -g0 -O3 -DNDEBUG -D_FORTIFY_SOURCE=2 -ffunction-sections -fdata-sections -funsafe-math-optimizations -ftree-vectorize -std=c99 -no-canonical-prefixes -fno-canonical-system-headers -Wno-builtin-macro-redefined -D__DATE__=redacted -D__TIMESTAMP__=redacted -D__TIME__=redacted'
+ LD=/root/.cache/bazel/_bazel_root/dbf178c3b436e7b271af34e78939cab5/execroot/bazel_simple_demo/external/gcc9_arm_aarch64/bin/aarch64-none-linux-gnu-gcc
+ LDFLAGS='-lstdc++ -lm -Wl,-no-as-needed -Wl,-z,relro,-z,now -Wall -pass-exit-codes -fuse-ld=gold -Wl,--gc-sections'
+ ./configure --without-guile --with-guile=no --disable-dependency-tracking --prefix=/root/.cache/bazel/_bazel_root/dbf178c3b436e7b271af34e78939cab5/execroot/bazel_simple_demo/bazel-out/k8-opt-exec-277332AD/bin/external/rules_foreign_cc/toolchains/make
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... /bin/mkdir -p
checking for gawk... gawk
checking whether make sets $(MAKE)... yes
checking whether make supports nested variables... yes
checking whether make supports the include directive... yes (GNU style)
checking for gcc... /root/.cache/bazel/_bazel_root/dbf178c3b436e7b271af34e78939cab5/execroot/bazel_simple_demo/external/gcc9_arm_aarch64/bin/aarch64-none-linux-gnu-gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables...
checking whether we are cross compiling... configure: error: in `/root/.cache/bazel/_bazel_root/dbf178c3b436e7b271af34e78939cab5/execroot/bazel_simple_demo/bazel-out/k8-opt-exec-277332AD/bin/external/rules_foreign_cc/toolchains/make.build_tmpdir':

config.log
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.

It was created by gperftools configure 2.9.1, which was
generated by GNU Autoconf 2.69.  Invocation command line was

  $ /root/.cache/bazel/_bazel_root/dbf178c3b436e7b271af34e78939cab5/execroot/bazel_simple_demo/external/com_github_gperftools_gperftools/configure --prefix=/root/.cache/bazel/_bazel_root/dbf178c3b436e7b271af34e78939cab5/execroot/bazel_simple_demo/bazel-out/k8-fastbuild/bin/external/com_github_gperftools_gperftools/gperftools_build.build_tmpdir/gperftools_build --enable-shared=no --enable-frame-pointers --disable-libunwind

## --------- ##
## Platform. ##
## --------- ##

hostname = ubuntu
uname -m = x86_64
uname -r = 5.4.0-109-generic
uname -s = Linux
uname -v = #123-Ubuntu SMP Fri Apr 8 09:10:54 UTC 2022

/usr/bin/uname -p = unknown
/bin/uname -X     = unknown

/bin/arch              = unknown
/usr/bin/arch -k       = unknown
/usr/convex/getsysinfo = unknown
/usr/bin/hostinfo      = unknown
/bin/machine           = unknown
/usr/bin/oslevel       = unknown
/bin/universe          = unknown

PATH: /root/.cache/bazel/_bazel_root/dbf178c3b436e7b271af34e78939cab5/execroot/bazel_simple_demo/bazel-out/k8-fastbuild/bin/external/com_github_gperftools_gperftools/gperftools_build.ext_build_deps/bin
PATH: /root/.cache/bazel/_bazel_root/dbf178c3b436e7b271af34e78939cab5/execroot/bazel_simple_demo
PATH: /root/.cargo/bin
PATH: /usr/local/sbin
PATH: /usr/local/bin
PATH: /usr/sbin
PATH: /usr/bin
PATH: /sbin
PATH: /bin
PATH: /usr/games
PATH: /usr/local/games
PATH: /snap/bin
PATH: /usr/local/go/bin
PATH: /root/src/go/bin
PATH: /usr/local/jdk-11.0.15/bin
PATH: /root/.ft
PATH: /data/.cache/npm/global/bin
PATH: /root/.cache/bazel/_bazel_root/dbf178c3b436e7b271af34e78939cab5/execroot/bazel_simple_demo/bazel-out/k8-fastbuild/bin/external/com_github_gperftools_gperftools/gperftools_build.ext_build_deps/bin/toolchains

## ----------- ##
## Core tests. ##
## ----------- ##

configure:2617: checking build system type
configure:2631: result: x86_64-pc-linux-gnu
configure:2651: checking host system type
configure:2664: result: x86_64-pc-linux-gnu
configure:2700: checking for a BSD-compatible install
configure:2768: result: /usr/bin/install -c
configure:2779: checking whether build environment is sane
configure:2834: result: yes
configure:2978: checking for a thread-safe mkdir -p
configure:3017: result: /bin/mkdir -p
configure:3024: checking for gawk
configure:3040: found /usr/bin/gawk
configure:3051: result: gawk
configure:3062: checking whether /root/.cache/bazel/_bazel_root/dbf178c3b436e7b271af34e78939cab5/execroot/bazel_simple_demo/bazel-out/k8-opt-exec-2B5CBBC6/bin/external/rules_foreign_cc/toolchains/make/bin/make sets $(MAKE)
configure:3084: result: yes
configure:3113: checking whether /root/.cache/bazel/_bazel_root/dbf178c3b436e7b271af34e78939cab5/execroot/bazel_simple_demo/bazel-out/k8-opt-exec-2B5CBBC6/bin/external/rules_foreign_cc/toolchains/make/bin/make supports nested variables
configure:3130: result: yes
configure:3260: checking whether to enable maintainer-specific portions of Makefiles
configure:3269: result: no
configure:3296: checking for git
configure:3314: found /usr/local/bin/git
configure:3327: result: /usr/local/bin/git
configure:3400: checking whether /root/.cache/bazel/_bazel_root/dbf178c3b436e7b271af34e78939cab5/execroot/bazel_simple_demo/bazel-out/k8-opt-exec-2B5CBBC6/bin/external/rules_foreign_cc/toolchains/make/bin/make supports the include directive
configure:3415: /root/.cache/bazel/_bazel_root/dbf178c3b436e7b271af34e78939cab5/execroot/bazel_simple_demo/bazel-out/k8-opt-exec-2B5CBBC6/bin/external/rules_foreign_cc/toolchains/make/bin/make -f confmf.GNU && cat confinc.out
this is the am__doit target
configure:3418: $? = 0
configure:3437: result: yes (GNU style)
configure:3507: checking for gcc
configure:3534: result: /root/.cache/bazel/_bazel_root/dbf178c3b436e7b271af34e78939cab5/execroot/bazel_simple_demo/external/gcc9_arm_aarch64/bin/aarch64-none-linux-gnu-gcc
configure:3763: checking for C compiler version
configure:3772: /root/.cache/bazel/_bazel_root/dbf178c3b436e7b271af34e78939cab5/execroot/bazel_simple_demo/external/gcc9_arm_aarch64/bin/aarch64-none-linux-gnu-gcc --version >&5
aarch64-none-linux-gnu-gcc (GNU Toolchain for the A-profile Architecture 9.2-2019.12 (arm-9.10)) 9.2.1 20191025
Copyright (C) 2019 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

configure:3783: $? = 0
configure:3772: /root/.cache/bazel/_bazel_root/dbf178c3b436e7b271af34e78939cab5/execroot/bazel_simple_demo/external/gcc9_arm_aarch64/bin/aarch64-none-linux-gnu-gcc -v >&5
Using built-in specs.
COLLECT_GCC=/root/.cache/bazel/_bazel_root/dbf178c3b436e7b271af34e78939cab5/execroot/bazel_simple_demo/external/gcc9_arm_aarch64/bin/aarch64-none-linux-gnu-gcc
COLLECT_LTO_WRAPPER=/root/.cache/bazel/_bazel_root/dbf178c3b436e7b271af34e78939cab5/external/gcc9_arm_aarch64/bin/../libexec/gcc/aarch64-none-linux-gnu/9.2.1/lto-wrapper
Target: aarch64-none-linux-gnu
Configured with: /tmp/dgboter/bbs/rhev-vm2--rhe6x86_64/buildbot/rhe6x86_64--aarch64-none-linux-gnu/build/src/gcc/configure --target=aarch64-none-linux-gnu --prefix= --with-sysroot=/aarch64-none-linux-gnu/libc --with-build-sysroot=/tmp/dgboter/bbs/rhev-vm2--rhe6x86_64/buildbot/rhe6x86_64--aarch64-none-linux-gnu/build/build-aarch64-none-linux-gnu/install//aarch64-none-linux-gnu/libc --with-bugurl=https://bugs.linaro.org/ --enable-gnu-indirect-function --enable-shared --disable-libssp --disable-libmudflap --enable-checking=release --enable-languages=c,c++,fortran --with-gmp=/tmp/dgboter/bbs/rhev-vm2--rhe6x86_64/buildbot/rhe6x86_64--aarch64-none-linux-gnu/build/build-aarch64-none-linux-gnu/host-tools --with-mpfr=/tmp/dgboter/bbs/rhev-vm2--rhe6x86_64/buildbot/rhe6x86_64--aarch64-none-linux-gnu/build/build-aarch64-none-linux-gnu/host-tools --with-mpc=/tmp/dgboter/bbs/rhev-vm2--rhe6x86_64/buildbot/rhe6x86_64--aarch64-none-linux-gnu/build/build-aarch64-none-linux-gnu/host-tools --with-isl=/tmp/dgboter/bbs/rhev-vm2--rhe6x86_64/buildbot/rhe6x86_64--aarch64-none-linux-gnu/build/build-aarch64-none-linux-gnu/host-tools --enable-fix-cortex-a53-843419 --with-pkgversion='GNU Toolchain for the A-profile Architecture 9.2-2019.12 (arm-9.10)'
Thread model: posix
gcc version 9.2.1 20191025 (GNU Toolchain for the A-profile Architecture 9.2-2019.12 (arm-9.10))
configure:3783: $? = 0
configure:3772: /root/.cache/bazel/_bazel_root/dbf178c3b436e7b271af34e78939cab5/execroot/bazel_simple_demo/external/gcc9_arm_aarch64/bin/aarch64-none-linux-gnu-gcc -V >&5
aarch64-none-linux-gnu-gcc: error: unrecognized command line option '-V'
aarch64-none-linux-gnu-gcc: fatal error: no input files
compilation terminated.
configure:3783: $? = 1
configure:3772: /root/.cache/bazel/_bazel_root/dbf178c3b436e7b271af34e78939cab5/execroot/bazel_simple_demo/external/gcc9_arm_aarch64/bin/aarch64-none-linux-gnu-gcc -qversion >&5
aarch64-none-linux-gnu-gcc: error: unrecognized command line option '-qversion'; did you mean '--version'?
aarch64-none-linux-gnu-gcc: fatal error: no input files
compilation terminated.
configure:3783: $? = 1
configure:3803: checking whether the C compiler works
configure:3825: /root/.cache/bazel/_bazel_root/dbf178c3b436e7b271af34e78939cab5/execroot/bazel_simple_demo/external/gcc9_arm_aarch64/bin/aarch64-none-linux-gnu-gcc -fPIC -U_FORTIFY_SOURCE -fstack-protector -Wall -Wunused-but-set-parameter -Wno-free-nonheap-object -fno-omit-frame-pointer -std=c99 -no-canonical-prefixes -fno-canonical-system-headers -Wno-builtin-macro-redefined -D__DATE__=redacted -D__TIMESTAMP__=redacted -D__TIME__=redacted  -lstdc++ -lm -Wl,-no-as-needed -Wl,-z,relro,-z,now -Wall -pass-exit-codes -fuse-ld=gold -lpthread conftest.c  >&5
configure:3829: $? = 0
configure:3877: result: yes
configure:3880: checking for C compiler default output file name
configure:3882: result: a.out
configure:3888: checking for suffix of executables
configure:3895: /root/.cache/bazel/_bazel_root/dbf178c3b436e7b271af34e78939cab5/execroot/bazel_simple_demo/external/gcc9_arm_aarch64/bin/aarch64-none-linux-gnu-gcc -o conftest -fPIC -U_FORTIFY_SOURCE -fstack-protector -Wall -Wunused-but-set-parameter -Wno-free-nonheap-object -fno-omit-frame-pointer -std=c99 -no-canonical-prefixes -fno-canonical-system-headers -Wno-builtin-macro-redefined -D__DATE__=redacted -D__TIMESTAMP__=redacted -D__TIME__=redacted  -lstdc++ -lm -Wl,-no-as-needed -Wl,-z,relro,-z,now -Wall -pass-exit-codes -fuse-ld=gold -lpthread conftest.c  >&5
configure:3899: $? = 0
configure:3921: result:
configure:3943: checking whether we are cross compiling
configure:3951: /root/.cache/bazel/_bazel_root/dbf178c3b436e7b271af34e78939cab5/execroot/bazel_simple_demo/external/gcc9_arm_aarch64/bin/aarch64-none-linux-gnu-gcc -o conftest -fPIC -U_FORTIFY_SOURCE -fstack-protector -Wall -Wunused-but-set-parameter -Wno-free-nonheap-object -fno-omit-frame-pointer -std=c99 -no-canonical-prefixes -fno-canonical-system-headers -Wno-builtin-macro-redefined -D__DATE__=redacted -D__TIMESTAMP__=redacted -D__TIME__=redacted  -lstdc++ -lm -Wl,-no-as-needed -Wl,-z,relro,-z,now -Wall -pass-exit-codes -fuse-ld=gold -lpthread conftest.c  >&5
configure:3955: $? = 0
configure:3962: ./conftest
/root/.cache/bazel/_bazel_root/dbf178c3b436e7b271af34e78939cab5/execroot/bazel_simple_demo/external/com_github_gperftools_gperftools/configure: line 3964: ./conftest: cannot execute binary file: Exec format error
configure:3966: $? = 126
configure:3973: error: in `/root/.cache/bazel/_bazel_root/dbf178c3b436e7b271af34e78939cab5/execroot/bazel_simple_demo/bazel-out/k8-fastbuild/bin/external/com_github_gperftools_gperftools/gperftools_build.build_tmpdir':
configure:3975: error: cannot run C compiled programs.
If you meant to cross compile, use `--host'.
See `config.log' for more details

bazel toolchain configuration:
toolchain:
http_archive(
    name = "gcc9_arm_aarch64",
    build_file = "@bazel_build_file_repo//bazel:gcc_arm_aarch64.BUILD",
    sha256 = "8dfe681531f0bd04fb9c53cf3c0a3368c616aa85d48938eebe2b516376e06a66",
    strip_prefix = "gcc-arm-9.2-2019.12-x86_64-aarch64-none-linux-gnu",
    #urls = ["https://developer.arm.com/-/media/Files/downloads/gnu-a/9.2-2019.12/binrel/gcc-arm-9.2-2019.12-x86_64-aarch64-none-linux-gnu.tar.xz"],
    urls = ["file:///root/src/cpp/toolchains/gcc-arm-9.2-2019.12-x86_64-aarch64-none-linux-gnu.tar.xz"],
)

platform config
constraint_setting(name = "gcc_version")

constraint_value(
    name = "gcc_9",
    constraint_setting = ":gcc_version",
)

constraint_value(
    name = "gcc_10",
    constraint_setting = ":gcc_version",
)

constraint_value(
    name = "gcc_11",
    constraint_setting = ":gcc_version",
)

platform(
    name = "linux_gcc9_aarch64",
    constraint_values = [
        "@platforms//cpu:aarch64",
        "@platforms//os:linux",
        ":gcc_9",
    ],
)

toolchain config
toolchain(
    name = "gcc9_arm_aarch64_xcompile_toolchain",
    exec_compatible_with = [
        "@platforms//cpu:x86_64",
        "@platforms//os:linux",
    ],
    target_compatible_with = [
        "@platforms//cpu:aarch64",
        "@platforms//os:linux",
        "//platforms:gcc_9",
    ],
    toolchain = "@gcc9_arm_aarch64//:cc_toolchain",
    toolchain_type = "@bazel_tools//tools/cpp:toolchain_type",
)

here is a very tiny demo to reproduce it:
[enter link description here][https://github.com/xiedeacc/bazel_simple_demo.git]


text:
Q: Domain of an adjoint operator I'm studying a bit of functional analysis for quantum mechanics and I'm stuck on a definition our professor gave us.
Given an operator and its domain $(A,\mathcal{D}(A))$ densely defined in $\mathcal H$ Hilbert space, there exists the adjoint operator $(A^*,\mathcal{D}(A^*))$ which satiesfies
$$(Ax,y)=(x,A^*y),      x\in\mathcal{D}(A),y\in\mathcal{D}(A^*)$$
and it is defined in
$$\mathcal{D}(A^*)=\{y\in \mathcal H|L_y:\mathcal H\rightarrow\mathbb{C},x\mapsto (Ax,y) \text{ is a continuous linear functional}\}$$
It is the continuity part of the statement that I dont understand. I get that if $A$ is continuous that condition is satisfied for every $x,y$, but in general what does $y$ have to do with the continuity of $L_y$, since it acts on $x$? I mean, based on the way $L_y$ is defined I can't understand why it would be continuous for some $y$ but not for others.

A: This definition of the adjoint operator is a direct application of Riesz' lemma. (I prefer another equivalent definition which does not use Riesz' lemma.)
If $H$ is a Hilbert space, a linear functional $H \ni x \to f(x)\in \mathbb{C}$ is continuous if and only if it is of the form $f(x)=\langle x, z_f\rangle$ for some $z_f\in H$ and this element turns out to be uniquely determined by $f$.
To see that the proposed  definition makes sense, suppose you already know the adjoint operator $A^*$ with its domain  $D(A^*)$ as defined in question.
Saying that  $y \in D(A^*)$ means that $f: D(A) \ni x \mapsto \langle Ax,y\rangle = \langle x, A^*y\rangle$.
This  map is trivially continuous since the inner product is continuous.
Now, exploiting Riesz' lemma, I show that the result is reversible, just applying the definition of $D(A^*)$ given in the question.
If, for some $y\in H$, $f: D(A) \ni x \mapsto \langle Ax,y\rangle$ is continuous, since $D(A)$ is dense, we can extend this functional to an everywhere defined continuous functional we can indicate with the same symbol. Hence we can apply Riesz' lemma obtaining that
$$\langle Ax, y\rangle = \langle x, z_y\rangle \quad \forall x \in D(A)\:.$$
It is not difficult to see that the vectors $y\in H$ satisfying the identity above form a linear subspace, we denote by $D(A^*)$, and that the map $D(A^*) \ni y \mapsto z_y$ is linear. Finally we can define $A^*y := z_y$.
So, regarding your last question, saying that $L_y$ is not continuous, is equivalent to saying that there is no $z_y$ such that $\langle Ax,y\rangle = \langle x, z_y\rangle$ for all $x\in D(A)$.

A: First, notice that if $L_y$ is continuous for every $y \in \mathcal H$, by the uniform boundedness principle you would conclude that $A$ is a bounded operator. So if $A$ is unbounded, there will be some $y\in\mathcal H$ such that $L_y$ is unbounded.

Now, for any $y\in \mathcal H$, we know $L_y$ is at least defined on $\mathcal D(A)$. It can be bounded, in which case it extends to a bounded linear function on the whole $\mathcal H$; but it can also be unbounded (since $A$ is unbounded).

Now, a concrete example. Consider $ \mathcal H = L^2([0,1])$ with the usual scalar product and define a derivative operator $A$ by :
\begin{align}
&\mathcal D(A) = \mathcal C^1([0,1])\\
&\forall \psi \in \mathcal D(A), A\psi =\psi'
\end{align}
Then, if $\phi \in \mathcal C^1([0,1])$ and $\phi(0) = \phi(1) =0$, an integration by part shows that for any $\psi \in \mathcal D(A)$ :
\begin{align}
\langle A\psi,\phi\rangle &= -\langle\psi,\phi'\rangle \\
|L_\phi(\psi)| \leq \|\psi\|\|\phi'\|
\end{align}
Therefore, $L_\phi$ is bounded and extends to a continuous functional $L_\phi:\mathcal H\to \mathcal C$, ie $\phi \in \mathcal D(A^*)$ and :
$$\{\phi\in\mathcal C^1([0,1])|\phi(0)=\phi(1) = 0\}\subset \mathcal D(A^*)$$
However, consider the constant function $\phi = 1$. Then, for $\psi\in\mathcal D(A)$, integration by part gives :
$$\langle A\psi,\phi\rangle = \psi(1)-\psi(0)$$
which is unbounded for the $L^2$ norm. Therefore, $\phi \notin \mathcal D(A^*)$.


text:
Q: Getting and Error I'm installing SEO Suite Installation via Composer but during installation I'm getting an error. Can anyone help me for the solution of this. Screenshot of error is attached.

A: The error message is pretty obvious you have a dependance psr/cache that requires php 8 and you are still under php 7
Check for a version of that module (less than 3.0.0 apparently) working with your current php version. Or update to php 8.


text:
Q: Can't see items from one project in another C# I have all of my references set up, and the classes are public, but I still cannot see the classes and project in the project I'm working in.  Does anyone have any other ideas to try?  Thanks!

A: There can be number of reasons for this.

*

*Please Check If added the Reference Correctly to your project

*Then Check your accessor methods in the referring project.make sure you use the public keyword for classes and methods you want to reference.

*Bothe projects should be in same .NET version or Reference project should be less than the refereeing project

*if you can show the specific code both projects it's easier to determine


text:
Q: How to import data into my React component and use as javascript object? I'm building a name generator web app with React and need to import a custom array with id, name, meaning, gender into my component in order to build a randomizer. I am importing the file as NameData, and attempting to parse the list for names via const RandomName = NameData.name but nothing is displaying when I attempt to call the object like this {name}.
How can I correctly import the array from my names file and create JS objects for ids, names, meanings, and gender?
custom array (NameData.js) code:
// temporary list of 4 names
export default [
  {
    id: 0,
    name: 'Astghik',
    sex: 'female',
    meaning: '"little star". Derived from the Armenian word "astgh" meaning "star" and the suffix "ig" meaning "little." Famous real-life people named Astghik Astghik in song, story & screen. Astghik is the Armenian goddess of fertility and love.',
  }, {
    id: 1,
    name: 'Lusine',
    sex: 'female',
    meaning: 'Lusine is a feminine given name derives from the Armenian "Lusin (Լուսին)", meaning "moon". The ancient Armenians, like the Latins, possessed two different names for the moon.'
  }, {
    id: 2,
    name: 'Hayk',
    sex: 'male',
    meaning: 'Hayk the Great (Armenian: Հայկ, Armenian pronunciation: [hajk]), or The Great Hayk, also known as Hayk Nahapet (Հայկ Նահապետ, Armenian pronunciation: [hajk nahapɛt], Hayk the "head of family" or patriarch), is the legendary patriarch and founder of the Armenian nation.'
  }, {
    id: 3,
    name: 'Razmik',
    sex: 'male',
    meaning: 'little soldier/fighter'
  }
];

component (Generator.js) code:
import React, { useState } from 'react';
// name data
import NameData from "./NameData.js";
// shuffle button via material-ui icons
import IconButton from "@material-ui/core/IconButton";
import SvgIcon from "@material-ui/core/SvgIcon";
// material-ui
import { Typography, Grid } from "@material-ui/core";
import '../App.css';

// converting name data into objects
const RandomName = NameData.name;

function Generator() {
    const [startingName, newName] = useState('name');

    return (
        <>
             <Typography variant="h1" component="h2" gutterBottom>
                {startingName}
            </Typography>
            <Grid id="generator-buttons-container">
                <IconButton
                    aria-label="favorite name"
                    // onClick={() =>
                    // }
                >
                    <SvgIcon id="generator-favorite-icon">
                        <path xmlns="http://www.w3.org/2000/svg" d="M16.5 3c-1.74 0-3.41.81-4.5 2.09C10.91 3.81 9.24 3 7.5 3 4.42 3 2 5.42 2 8.5c0 3.78 3.4 6.86 8.55 11.54L12 21.35l1.45-1.32C18.6 15.36 22 12.28 22 8.5 22 5.42 19.58 3 16.5 3zm-4.4 15.55l-.1.1-.1-.1C7.14 14.24 4 11.39 4 8.5 4 6.5 5.5 5 7.5 5c1.54 0 3.04.99 3.57 2.36h1.87C13.46 5.99 14.96 5 16.5 5c2 0 3.5 1.5 3.5 3.5 0 2.89-3.14 5.74-7.9 10.05z"/>
                    </SvgIcon>
                </IconButton>
                <IconButton
                    aria-label="generate new name"
                    onClick={() =>
                        newName(RandomName[Math.floor(Math.random() * RandomName.length)])
                    }
                >
                    <SvgIcon id="generator-shuffle-icon">
                        <path xmlns="http://www.w3.org/2000/svg" d="M10.59 9.17L5.41 4 4 5.41l5.17 5.17 1.42-1.41zM14.5 4l2.04 2.04L4 18.59 5.41 20 17.96 7.46 20 9.5V4h-5.5zm.33 9.41l-1.41 1.41 3.13 3.13L14.5 20H20v-5.5l-2.04 2.04-3.13-3.13z"/>
                    </SvgIcon>
                </IconButton>
            </Grid>

        </>
    );
};

export default Generator;


text:
Q: CALayer mask property I found this line confusing?

When configuring a mask, remember to set the size and position of the mask layer to ensure it is aligned properly with the layer it masks.

What align means here? Does it means that you have to provide a mask that as a frame equal the bounds of the masked layer? Does it means that you can't be outside the visible part of the bounds of the masked layer?


text:
Q: Node.js - passing values to other pages I'm trying to build a web service using node.js.
In this architecture, curl is used to POST data to the index.js app. The index.js app process the output and then it should pass the output to different pages.
For example, if the ID received is between 100-200 then push the ID to movies.html and so on.
Now I have been able to achieve the processing of POST request using CURL and node.js
I have no idea how to pass the data to other pages.
Here is my index.js code.
var http = require('http');
var qs=require('querystring');

var redis=require('redis').createClient();
console.log('Server Starting Now: ');
var count=0;

http.createServer(function (req, res) {
    if(req.method=='POST'){
        count=count+1;
        var body="";

        req.on('data',function(data){
            body+=data;
        });

        req.on('end',function(){
           var post=qs.parse(body);
           console.log(post);
           res.write("Received");
           redis.lpush('XMLqueue',JSON.stringify(post));
        });
    }

}).listen(8124, "127.0.0.1");
console.log('Server running at http://127.0.0.1:8124/');

How do I pass the data from this index.js page to other pages?

A: Create handlers for other URLs which will respond with the data you want it to.
But actually, you seem to be confused by nodejs  and overall http server architecture a lot. I'd suggest you to read any "getting started nodejs" tutorial you find at Google and like to get the basics. Also, search for something like "nodejs express" and reading it will probably help you to get an easy start.