text:
Q: Change input text color on DropdownSearch Is there a way to change the input color of a DropdownSearch widget? The default color is black but I want to change it to grey. I have tried
labelStyle: TextStyle(color: Colors.white) but it does not work.
This is my DropdownSearch Widget
                    Container(
                      child: DropdownSearch<String>(
                        mode: Mode.BOTTOM_SHEET,
                        showSearchBox: true,
                        dropdownSearchDecoration: new InputDecoration(
                          enabledBorder: UnderlineInputBorder(
                            borderSide: BorderSide(color: Colors.white),
                          ),
                          focusedBorder: UnderlineInputBorder(
                            borderSide: BorderSide(color: Colors.white),
                          ),
                          prefixIcon: const Icon(
                            Icons.corporate_fare,
                            color: Colors.white,
                          ),
                        ),
                        showAsSuffixIcons: true,
                        showClearButton: false,
                        dropdownButtonBuilder: (_) => Padding(
                          padding: const EdgeInsets.all(8.0),
                          child: const Icon(
                            Icons.arrow_drop_down,
                            size: 24,
                            color: Colors.grey,
                          ),
                        ),
                        showSelectedItem: true,
                        items: _industry,
                        onChanged: (String newValue) {
                          setState(() {
                            dropDownValue = newValue;
                          });
                        },
                        selectedItem: dropDownValue,
                      ),
                    ),

A: there are 2 options:
first, you can wrap it with Theme widget:
Theme(
          data: ThemeData(
            textTheme: TextTheme(subtitle1: TextStyle(color: Colors.green)),
          ),
          child: DropdownSearch<String>(
            mode: Mode.BOTTOM_SHEET,
            showSearchBox: true,
            dropdownSearchDecoration: new InputDecoration(
              enabledBorder: UnderlineInputBorder(
                borderSide: BorderSide(color: Colors.red),
              ),
...

or you can change it from the library. go to selectDialog.dart. line 349 is the search box. add color to textField:
...
TextField(
                style: TextStyle(color: Colors.red),
                controller: widget.searchBoxController,
                focusNode: focusNode,
                onChanged: (f) => _debouncer(() {
                  _onTextChanged(f);
                }),
...

you have to stop and restart the app to makes it work.


text:
Q: POWER BI Save Visualised table into a new table (internal data export) couldn't find an answer for this anywhere.
let's say we have 3 tables, when i visualize the join between them i get a table displayed on the screen, i want to save this table as static as it is (for ex in databases we create views)
i want to use this table and to make more process on it (like i could export it inside the file as table and not only as excel or csv)

note that some of tables can be a calculation tabs. I don't deal with it on intern without export. I tried to create a new table that makes the join, but the data is somehow unrelated to perform it and sometimes there is 4 or 5 tables in the path to get the join, which PBI do it auto.

A: Create a calculated table with the DAX formula you require.
myNewTable = SUMMARIZECOLUMNS(Table[Colonne 1],'Table (2)'[Colonne 1],'Table (3)'[Colonne 1])

redpajama_set_name: RedPajamaStackExchange


text:
Q: Python; screen exit error
*

*I have made a code in two files in python.

*From main.py a function screen is called which have some radio button.

*error is when I run the code & main screen is opened, if click "Ok"
button then it work fine. However if I close the window by pressing close button, error appears.
[code]

Exception in Tkinter callback
Traceback (most recent call last):
File "C:\Python27\lib\lib-tk\Tkinter.py", line 1536, in __call__
    return self.func(*args)
File "E:\main_menu.py", line 51, in suicide
    self.screen.destroy()
File "C:\Python27\lib\lib-tk\Tkinter.py", line 1898, in __getattr__
    return getattr(self.tk, attr)
AttributeError: screen
[/code]

*main.py
    [code]
import main_menu

while True:
    val = main_menu.screen()
    if(1 == val):
        //do something
    elif(2 == val):
        //do something
    elif(3 == val):
        //do something

    #print(val)
[/code]

*main_screen.py
    [code]
from Tkinter import *
import Tkinter

class menu1(Tkinter.Tk):

    def __init__(self, master):
        Tkinter.Tk.__init__(self,master)
        self.master = master

        self.protocol("WM_DELETE_WINDOW", self.suicide)

        #clear value
        self.val1 = 1

        #default selection
        self.v = IntVar()
        self.v.set(1)

        #create a label
        self.x1 = Label(self,text="Choose a function:",justify = CENTER,padx = 100)
        self.x1.pack()

        #first radiobutton
        self.x2 = Radiobutton(self,text="text1",padx = 100,variable=self.v,value=1)
        self.x2.pack(anchor=W)

        #second radiobutton
        self.x3 = Radiobutton(self,text="text2",padx = 100,variable=self.v,value=2)
        self.x3.pack(anchor=W)

        #third radiobutton
        self.x4 = Radiobutton(self,text="text3",padx = 100,variable=self.v,value=3)
        self.x4.pack(anchor=W)

        #fourth radiobutton
        self.x5 = Radiobutton(self,text="text4",padx = 100,variable=self.v,value=4)
        self.x5.pack(anchor=W)

        #create button
        self.x6 = Button(self,text="OK",command=self.submit)
        self.x6.pack()

    def submit(self):
        self.val1 = self.v.get()
        self.destroy()

    def suicide(self):
        self.val1  = 0
        self.screen.destroy()

def screen():
    #create a root object
    root = menu1(None)
    root.title("Option")
    root.geometry("480x320")
    root.mainloop()
    return root.val1
[/code]

A: self.screen.destroy() raises an exception because you do not have a self.screen.
I think you just need self.destroy(), as in the submit() method above


text:
Q: (Python) How to make discord bot respond able to respond to multiple users at the same time I created a discord bot in python that runs some other code if a user sends it a message. The problem I'm having is that while the code is being run, the bot will not respond to any other messages. How can I make it so that while the bot is running code behind the scenes it can still respond to other messages?
Code looks like this:
from secrets import TOKEN
import discord

def code_that_takes_time():
    items = []
    for x in range(10):
        item = do_something() #get request in my case. takes 20s per iteration
        items.append(item)
    return items

@client.event
async def on_message(message):
    user_message = str(message.content)
    send = message.channel.send

        if message.author == client.user:
            return

        if user_message.startswith('$do'):
            result = code_that_takes_time()
            send(result)

        if user_message.startswith('hello'):
            send('hello, nice to meet you')

client.run(TOKEN)

I want it so that the bot can still respond to the 'hello' message  while it's running code_that_takes_time and then send the result whenever it finishes.
Thanks in advance for the help and ideas.

A: anything that has a chance of blocking, such as your code_that_takes_time should ideally be written as a co-routine so that it will sleep and let other code execute while it is waiting. I'm relatively new to asyncio myself, but I believe the syntax is to use async on your code_that_takes_time, i.e.:
async def code_that_takes_time:
    items = []
    for x in range(10):
        item = do_something() #get request in my case. takes 20s per iteration
        items.append(item)
    return items

then make sure to call it with the await keyword (if you try to call a coroutine normally, the call just retrieves and returns the coroutine object), e.g.:
#put any needed arguments in the parentheses as with a normal call
await code_that_takes_time()

I wish I could be more help than that, but I'm also a newb with this stuff and don't want to mislead.


text:
Q: Parallelizing access to S3 objects in Scala I'm writing a Scala program to read objects matching a certain prefix on S3.
At the moment, I'm testing it on my Macbook Pro and it takes 270ms (avg. over 1000 trials) to hit S3, retrieve the 10 objects (avg. size of object 150Kb) and process it to print the output.
Here's my code:
val myBucket = "my-test-bucket"
val myPrefix = "t"
val startTime = System.currentTimeMillis()

//Can I make listObject parallel?
val listObjRequest: ListObjectsRequest = new ListObjectsRequest().withBucketName(myBucket)
val listObjResult: Seq[String] = s3.listObjects(listObjRequest).getObjectSummaries.par.toIndexedSeq.map(_.getKey).filter(_ matches s"./.*${myPrefix}.*/*")

//Can I make forEach parallel?
listObjResult foreach println //Could be any function

println(s"Total time: ${System.currentTimeMillis() - startTime}ms")

In the big scheme of things, I've got to sift through 50Gb of data (approx. 350K nested objects) and delete objects following a certain prefix (approx. 40K objects).
Hardware considerations aside, what can I do to optimize my code?
Thanks!

A: A possible solution would be to batch the request objects and send a request for batch deletion in S3. You can group the objects to delete and then parallalize the mapping over the parallel collection:
import com.amazonaws.services.s3.AmazonS3Client
import com.amazonaws.services.s3.model.DeleteObjectsRequest.KeyVersion
import com.amazonaws.services.s3.model.{DeleteObjectsRequest, DeleteObjectsResult}

import scala.collection.JavaConverters._
import scala.concurrent.Future
import scala.concurrent.ExecutionContext.Implicits.global
import scala.concurrent._
import scala.util.Try

object AmazonBatchDeletion {
  def main(args: Array[String]): Unit = {
    val filesToDelete: List[String] = ???
    val numOfGroups: Int = ???

    val deletionAttempts: Iterator[Future[Try[DeleteObjectsResult]]] =
      filesToDelete
       .grouped(numOfGroups)
       .map(groupToDelete => Future {
          blocking {
            deleteFilesInBatch(groupToDelete, "bucketName")
          }
        })

    val result: Future[Iterator[Try[DeleteObjectsResult]]] =
      Future.sequence(deletionAttempts)

    // TODO: make sure deletion was successful.
    // Recover if needed form faulted futures.
  }

  def deleteFilesInBatch(filesToDelete: List[String],
                         bucketName: String): Try[DeleteObjectsResult] = {
    val amazonClient = new AmazonS3Client()

    val deleteObjectsRequest = new DeleteObjectsRequest(bucketName)
    deleteObjectsRequest.setKeys(filesToDelete.map(new KeyVersion(_)).asJava)

    Try {
      amazonClient.deleteObjects(deleteObjectsRequest)
    }
  }
}


text:
Q: ssrs Datasource CSV semi colon delimited giving long column name I have a tool that generates csv automatically but in semicolon ;however when I run the query in SSRS   it is giving only one column to all the fields in the report. When I changed the semicolon with comma, it is working well.
I want to modify or change the settings in the SSRS to give the correct format. I run the query for example  the csv has sample1;sample2;sample3;;;; a;b;c; , the output is giving sample1;sample2;sample3;;;; a;b;c;
I tried changing the reportingservices.config  this way but not working

 <Extension Name="Semicolon" Type="Microsoft.ReportingServices.Rendering.DataRenderer.CsvReport,Microsoft.ReportingServices.DataRendering">
                <OverrideNames>

    <Name Language="en-US">CSV (semicolon delimited)</Name>
                 <Name Language="en-EN">CSV (semicolon delimited)</Name>

                </OverrideNames>
                <Configuration>
                    <DeviceInfo>
             <FileExtension>csv</FileExtension>
                        <FieldDelimiter>;</FieldDelimiter>
<SuppressLineBreaks>True</SuppressLineBreaks>
                    </DeviceInfo>
                </Configuration>
            </Extension>

I want this kind of output.
sample1 |  sample2 | sample3
     a          b         c

Any idea on how to do this in SSRS.

A: I have decided to just write a batch file to replace the semicolon immediately the csv is generated by the .exe application. The example to replace is also in this link :  Batch script to find and replace a string in text file without creating an extra output file for storing the modified file
@echo off
setlocal enabledelayedexpansion

::  rem   editing and replacing  a text file without redirecting the output to file

@echo off
    setlocal enableextensions disabledelayedexpansion

    set "search=%;"
    set "replace=%,"

    set "textFile=try2.csv"

    for /f "delims=" %%i in ('type "%textFile%" ^& break ^> "%textFile%" ') do (
        set "line=%%i"
        setlocal enabledelayedexpansion
        >>"%textFile%" echo(!line:%search%=%replace%!
        endlocal
    )
pause


text:
Q: Delay property updates until a bunch of properties have been changed (ie. lock a control) I have made a control which has a property that is calculated by using a few other properties as input. When any of these input properties change, the property needs to be updated. I already have made this possible through implementing property-changed events for them, marking the dependent property as updated. Changing 3 properties means 3 property refreshes.
The problem I am experiencing is that when more than one of these properties change, the dependency property is updated each time any of these properties is changed. The property however takes some time to calculate (and/or render). When more than one property is going to be changed, I would like to let it update only once, after I have updated all the properties.
Goal: The control needs to be updated only when the program is done changing all the properties.
What I have tried:

*

*Make the property lazy by only updating it when requested. (Does not work, WPF requests it anyway);

*Cache the result of the calculation. (Does not work because there is always 1 input changed, making the cache invalid);

*Make a method to set multiple properties at once. (Does not work, some properties are inherited and come from another control);

*Make the control collapsed before manipulating the properties. (Does not work, WPF still refreshes the properties).

Does anybody have a better solution?

A: You can postpone raising the property changed event. Or create a method that will stop propagating this event (i.e. StartUpdating) and another method that will fire all the events (i.e. EndUpdating).
private bool _isUpdating;
private List<string> _properties = ...;

private void RaisePropertyChanged(string propertyName)
{
   if(_isUpdating)
   {
     if(!_properties.Contains(propertyName)) _properties.Add(propertyName);
     return;
   }

   PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
}

void StartUpdating() { _isUpdating = true; }

void EndUpdating()
{
  _isUpdating = false;
  foreach(var propertyName in _properties) RaisePropertyChanged(propertyName);
}

and in your methods
void LongRunningMethodSync()
{
  try
  {
    StartUpdating();
    // do something synchronously
  }
  finally
  {
    EndUpdating();
  }
}

void LongRunningMethodAsync()
{
  StartUpdating();
  ExecuteMyAsyncTask(done => EndUpdating());
}

A: Take a look at the binding's IsAsync property. I imagine it could work in combination with a debounce like pattern.


text:
Q: Changing the color of different intent in an application I want to change the color of different intent in an application.Like for one intent action bar color is red and for some other intent the action bar color is yellow.
Here is my AndroidMenifest.xml in which i changed the text of label.
But how to change background of that text background same as of main screen of application.
Look i did the changes but its not working.
    `package com.example.android.miwok;
import android.app.Activity;
import android.content.Intent;
import android.graphics.Color;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.widget.TextView;

public class MainActivity extends AppCompatActivity {

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    // Set the content of the activity to use the activity_main.xml layout
file
    setContentView(R.layout.activity_main);

    TextView numbers = (TextView) findViewById(R.id.numbers);

// Set a click listener on that View
    numbers.setOnClickListener(new View.OnClickListener() {
        // The code in this method will be executed when the numbers View is
clicked on.
        @Override
        public void onClick(View view) {
            Intent numbersIntent = new Intent(MainActivity.this,
NumbersActivity.class);
            startActivity(numbersIntent);
            Intent i=new Intent(MainActivity.this,NumbersActivity.class);
            i.putExtra("toolbarColor", Color.BLUE);
        }
    });
    TextView family = (TextView) findViewById(R.id.family);

// Set a click listener on that View
    family.setOnClickListener(new View.OnClickListener() {
        // The code in this method will be executed when the family View is
clicked on.
        @Override
        public void onClick(View view) {
            Intent familyIntent = new Intent(MainActivity.this,
FamilyMembersActivity.class);
             startActivity(familyIntent);
        }
    });
    TextView colors = (TextView) findViewById(R.id.colors);

// Set a click listener on that View
    colors.setOnClickListener(new View.OnClickListener() {
        // The code in this method will be executed when the colors View is
clicked on.
        @Override
        public void onClick(View view) {
            Intent colorsIntent = new Intent(MainActivity.this,
ColorsActivity.class);
            startActivity(colorsIntent);
        }
    });
    TextView pharses = (TextView) findViewById(R.id.phrases);

// Set a click listener on that View
    pharses.setOnClickListener(new View.OnClickListener() {
        // The code in this method will be executed when the numbers View is
clicked on.
        @Override
        public void onClick(View view) {
            Intent pharsesIntent = new Intent(MainActivity.this,
PharsesActivity.class);
            startActivity(pharsesIntent);
        }
    });
}
public void openNumberList(View view){
    Intent viewNumber= new Intent(this,NumbersActivity.class);
    startActivity(viewNumber);
}
public void openFamilyMembersList(View view){
    Intent viewFamily= new Intent(this,FamilyMembersActivity.class);
    startActivity(viewFamily);
}
public void openPharsesList(View view){
    Intent viewPharses= new Intent(this,PharsesActivity.class);
    startActivity(viewPharses);
}
public void openColorsList(View view){
    Intent viewColor= new Intent(this,ColorsActivity.class);
    startActivity(viewColor);
}
}

`

A: You can send the color as an extra to the activity.
Intent intent = ..;
intent.putExtra("toolbarColor", Color.BLUE);

And in the activity you want the toolbar color to change
int color = getIntent().getExtra("toolbarColor");
toolbar.setBackgroundDrawable(new ColorDrawable(color));

A: Is that what you want? If so, follow my step. I will show you how to do.

*

*First, declare the style of each activity.[res/values/styles.xml]
<?xml version="1.0" encoding="utf-8"?>
<resources>

    <!-- other styles ... -->

    <style name="NumbersBg" parent="Theme.AppCompat.Light.DarkActionBar">
        <item name="colorPrimary">@color/colorPrimaryNumbers</item>
        <item name="colorPrimaryDark">@color/colorPrimaryDarkNumbers</item>
        <item name="colorAccent">@color/colorAccent</item>
    </style>

    <style name="FamilyMembersBg" parent="Theme.AppCompat.Light.DarkActionBar">
        <item name="colorPrimary">@color/colorPrimaryFamilyMembers</item>
        <item name="colorPrimaryDark">@color/colorPrimaryDarkFamilyMembers</item>
        <item name="colorAccent">@color/colorAccent</item>
    </style>

    <style name="ColorsBg" parent="Theme.AppCompat.Light.DarkActionBar">
        <item name="colorPrimary">@color/colorPrimaryColors</item>
        <item name="colorPrimaryDark">@color/colorPrimaryDarkColors</item>
        <item name="colorAccent">@color/colorAccent</item>
    </style>

    <style name="PhrasesBg" parent="Theme.AppCompat.Light.DarkActionBar">
        <item name="colorPrimary">@color/colorPrimaryPhrases</item>
        <item name="colorPrimaryDark">@color/colorPrimaryDarkPhrases</item>
        <item name="colorAccent">@color/colorAccent</item>
    </style>

</resources>

by the way, the colors mentioned above should be declared earlier in colors.xml[res/values/colors.xml]:
<?xml version="1.0" encoding="utf-8"?>
<resources>

    <!-- other colors ... -->

    <!-- Numbers -->
    <color name="colorPrimaryNumbers">#fd8d28</color>
    <color name="colorPrimaryDarkNumbers">#AE611C</color>
    <!-- Family Members -->
    <color name="colorPrimaryFamilyMembers">#3b913c</color>
    <color name="colorPrimaryDarkFamilyMembers">#2C6B2C</color>
    <!-- Colors -->
    <color name="colorPrimaryColors">#87149e</color>
    <color name="colorPrimaryDarkColors">#4C0C59</color>
    <!-- Phrases -->
    <color name="colorPrimaryPhrases">#26afc8</color>
    <color name="colorPrimaryDarkPhrases">#186D7C</color>

</resources>

*Quote the styles you declared before in AndroidManifest.xml.
<?xml version="1.0" encoding="utf-8"?>
<manifest>
    <application>

        <!-- other activities ... -->

        <activity
            android:name=".NumbersActivity"
            android:theme="@style/NumbersBg" />

        <activity
            android:name=".FamilyMembersActivity"
            android:theme="@style/FamilyMembersBg" />

        <activity
            android:name=".ColorsActivity"
            android:theme="@style/ColorsBg" />

        <activity
            android:name=".PhrasesActivity"
            android:theme="@style/PhrasesBg" />

    </application>
</manifest>

*run it.


text:
Q: Kinect hand waving gesture I'm doing a kinect Application using Kinect SDK.
The Result I want that it has to able to identify the hand waving for 5sec. Do something if it does Anyone knows how to do so?
I'm doing in a WPF application. Would like to have some example. I'm rather new to Kinect.

A: Check the Kinect Toolbox project @ http://kinecttoolbox.codeplex.com/. It has Swipe gesture detector implementation.

A: You can write a simple alghoritm to get the wage gesture. For your example you need a time limit
public static int timeLimit = 5000;

Now think about wave. It has 3 states
1) Neutral pose when your hand is at the same position on X-axis as your elbow.
2) When hand is to the right of elbow
3) When hand is to the left of elbow
Remember that you start from state 1. To get from 2 to 3 you need to go with 1 in the middle. So as you can see there is a combination
1 - 2 - 1 - 3 - 1 <-- first wave
The secuence you can get from Position of Joint
first.Joints[JointType.HandRigh].Position.X

it`s simple math.
About the  sec. Just get from (for example) SkeletonFrame timestamp and compare
if((currentTimestamp - startTimestamp) < MainWindom.timeLimit)

startTimestamp is timestamp when your hand is in position to start.
Add also a flag tha indicates that the the hand is on a good track
I hope it helped

A: I recommend Channel 9 Kinect for Windows Quickstarts if you need to learn the basics.
Back to the waving gesture, use math like polar coördinates to check the distance between your hand and let's say your middle shoulder and calculate the angle.
In that way you'll be able to check with previous values.
Is this clear or not really?


text:
Q: How to test Quarkus REST client interface? I am using the MicroProfile REST client in Quarkus and would like to know how I can unit test custom client interfaces?
Example service:
@Path("/v1")
@RegisterRestClient
public interface CustomService {

    @POST
    @Path("/custom")
    void postCustomObject(CustomObject object);
}

Is it possible to write a unit test that covers this functionality? E.g. I would like to test that the request body is processed properly and contains the correct JSON (especially since I have an issue where the behaviour differs between JVM and native image mode).
REST server resources can easily be tested with REST-assured, but I did not find anything similar for REST client interfaces.
The Quarkus guide on using the REST client does not help me any further either, since it is using an actual service to make the call. In my case the server side is not available during the build/test process.
Any suggestions?

A: A little bit late, but I try to answer the question for future reference.
Although I agree with the @Héctor's comment, it could be useful to test the MicroProfile rest client itself (e.g. to actually test an error handler) or in the bean which the rest client is injected in.
Anyway, you need a mock server such as WireMock. The official guide for Quarkus actually covers this topic.
I can report here an example for it (which I took from here).
Add this dependency to your pom.xml (if you are using Maven):
<dependency>
    <groupId>com.github.tomakehurst</groupId>
    <artifactId>wiremock-jre8</artifactId>
    <scope>test</scope>
    <version>${wiremock.version}</version>
</dependency>

Create a class which will start the mock server befor the tests are executed (and which will shutdown it once they are all executed):
package org.acme.getting.started.country;

import java.util.Collections;
import java.util.Map;

import com.github.tomakehurst.wiremock.WireMockServer;
import io.quarkus.test.common.QuarkusTestResourceLifecycleManager;

import static com.github.tomakehurst.wiremock.client.WireMock.*;

public class WiremockCountries implements QuarkusTestResourceLifecycleManager {

    private WireMockServer wireMockServer;

    @Override
    public Map<String, String> start() {

        wireMockServer = new WireMockServer();
        wireMockServer.start();

        //define a static response when the request matches a url declared as a regex
        stubFor(get(urlEqualTo("/v2/name/GR"))
                .willReturn(aResponse()
                        .withHeader("Content-Type", "application/json")
                        //read the WireMock docs: you can even use a json file in /resources/__files/ (default expected location) in place of a string
                        .withBody(
                        """
                        [
                            {
                                "name": "Ελλάδα",
                                "capital": "Αθήνα"
                            }
                        ]
                        """
                        )));
        //remap the base url of the external service to the base url of the mock server
        return Collections.singletonMap("org.acme.getting.started.country.CountriesService/mp-rest/url", wireMockServer.baseUrl());
    }

    @Override
    public void stop() {
        if (null != wireMockServer) {
            wireMockServer.stop();
        }
    }
}

Memento: at the moment, you cannot test a @Singleton bean, so put on the rest client interface the annotation @ApplicationScoped.
Finally, use this class in the actual test class:
package org.acme.getting.started.country;

import javax.inject.Inject;

import io.quarkus.test.common.QuarkusTestResource;
import io.quarkus.test.junit.QuarkusTest;
import org.eclipse.microprofile.rest.client.inject.RestClient;
import org.junit.jupiter.api.Test;

import static org.assertj.core.api.Assertions.assertThat;

@QuarkusTest
@QuarkusTestResource(WiremockCountries.class)
class RegularCountriesServiceTest {

    @Inject
    @RestClient
    CountriesService countriesService;

    @Test
    void testGR() {
//      assertThat(countriesService.getByName("GR")).hasSize(10).extracting("name").contains("Greece");
        assertThat(countriesService.getByName("GR")).hasSize(1).extracting("name").contains("Ελλάδα");
    }
}

If you want to test the rest client one level above, all you need to do is reusing the wrapper class for the mock server and inject with @Inject the bean which declares the rest client as its dependency. Do something like this:
@QuarkusTest
@QuarkusTestResource(WiremockWrapperAsBefore.class)
class MyBusinessClassTest {

    @Inject
    MyBusinessClass myBusinessClass;

    @Test
    void testMyRestCleintInjectedIntoMyBusinessClass() {

        ResponseDTO dto = myBusinessClass.methodWhichCallsMyMicroProfileRestClient(String someParam);
        assertNotNull(dto);
    }
}

Otherwise, it could be useful in another scenarios to create a proxy implementation with RestClientBuilder for the MicroProfile rest client interface, as shown here:
import java.net.MalformedURLException;
import java.net.URI;
import org.eclipse.microprofile.rest.client.RestClientBuilder;
import static org.junit.Assert.assertNotNull;
import org.junit.Test;

public class RestClientTest {

    @Test
    public void init() throws MalformedURLException {
        URI baseURI = URI.create("http://localhost:8080");
        PingClient client = RestClientBuilder.newBuilder().
                baseUri(baseURI).
                build(PingClient.class);
        assertNotNull(client);
        String result = client.ping();
        assertNotNull(result);
    }
}

The corresponding interface is easy to guess, but it is like follows:
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import org.eclipse.microprofile.rest.client.inject.RegisterRestClient;

@Path("/restclient/resources/ping")
@RegisterRestClient
public interface PingClient {

    @GET
    String ping();
}

You won't need the following dependencies in that case if you are using Quarkus, but I will report the anyway from the link above in case someone is using MicroProfile but not Quarkus:
<dependencies>
    <dependency>
        <groupId>junit</groupId>
        <artifactId>junit</artifactId>
        <version>4.12</version>
        <scope>test</scope>
    </dependency>
    <dependency>
        <groupId>javax</groupId>
        <artifactId>javaee-api</artifactId>
        <version>8.0</version>
        <scope>provided</scope>
    </dependency>
    <dependency>
        <groupId>org.apache.cxf</groupId>
        <artifactId>cxf-rt-rs-mp-client</artifactId>
        <version>3.3.1</version>
        <scope>test</scope>
    </dependency>
</dependencies>


text:
Q: Search elements including roots and descendents What's a good way to search a small set of elements structured like this? I want to be able to find any element given its ID, without having to know exactly where I'm looking for it.
const elements = $(`

`);

*

*.find("#id") can find aa, but not a or b

*.filter("#id") can find a and b, but not aa or bb

*I also tried .siblings().addBack().find("#id"), but that doesn't seem to work either (can't even find a)

I can't seem to get around the fact that find misses the root elements, but filter misses the descendent elements. I need some combination of the two...

A: From jQuery 1.11.2 and 2.1.2 onwards you can effectively use a documentFragment like this:
$(document.createDocumentFragment())

This does not introduce an element. If you append the element contents to it, and query the parent of #a you'll get no match.

var elements = $(`

`);

// wrap elements in a document fragment
elements = $(document.createDocumentFragment()).append(elements);

// elements.find('#a') works, but second argument of $() can be used:
console.log('#a', $('#a', elements).length);
console.log('#ab', $('#ab', elements).length);
console.log('#ba', $('#ba', elements).length);

console.log('parents of #a:', $('#a', elements).parent().length);

A: I guess ultimately the solution is simply to use both find and filter and just check both. Together they will search everything.
const search = `#${elementName}`;

const maybeAtRoots = elements.filter(search);
if (maybeAtRoots.length)
   return maybeAtRoots;

const maybeUnderRoots = elements.find(search);
if (maybeUnderRoots.length)
   return maybeUnderRoots;

throw new Error(`failed to find element '${elementName}'`);


text:
Q: Single SPA integration with server side rendered html pages I have an application in which UI is rendered on the server-side using Thymeleaf and the backend is in Spring Boot.
Now, we have a requirement to combine this application with another react application. So, it should be like micro frontend architecture.
For this, I am evaluating the framework Single-SPA and seems like a good option when we have separate frontend projects and we need to combine them in one.
Is it possible to integrate the existing SSR pages with Single-SPA?

A: This should be possible with single-spa-html as long as there is no JavaScript that is dynamically created. Another limitation is that single-spa-html doesn't process <script/> tags due to browser security. If your application can meet those requirements, it should be able to interop with single-spa-html.
single-spa-html allows providing a template asynchronously, so a fetch or ajax call could retrieve the microfrontend template from the backend. Then the corresponding JavaScript is included in the microfrontend instead of script tagged in.
You can also see an example of enhancing a static html mfe with JS here: https://github.com/filoxo/single-spa-html-with-js-example/

Note: I believe we discussed this on the Slack channel but I want to share here for the benefit of the wider single-spa community.


text:
Q: RxAndroidBle keeping a persistant connection + Write/Notification handling I am building an Android application that has specific requirements regarding Bluetooth Low Energy.
I need to write to a Write-only characteristic and receive responses on a separate notification characteristic, and I need to do it in many, many activities. Is there a Rx way to send a request on the 1st characteristic, wait for the answer on the second one, then proceed to another request?
Also, to share my instance of RxAndroidBle I thought about doing some sort of BleManager Singleton where I would expose the Observables, so I can easily subscribe to them in my Presenter. I just want to avoid having to copy the connection logic for each activity and have (ideally) a persistant connection. This way I could only expose the connectionObservable and subscribe to it, so I can easily send Write Requests and get Notifications, but I am sure there is a better way to do it.
This is what I have for now:
@Singleton
public class BleManager {

  private PublishSubject<Void> disconnectTriggerSubject = PublishSubject.create();
  private Observable<RxBleConnection> connectionObservable;
  private boolean isConnected;

  private final UUID CTRL_FROM_BRIDGE_UUID = UUID.fromString("someUUID");
  private final UUID BLE_WRITE_CHARACTERISTIC_UUID = UUID.fromString("someOtherUUID");

  private final RxBleClient bleClient;
  private String mMacAddress;
  private final Context context;
  private RxBleDevice bleDevice;

  @Inject
  public BleManager(Context context, RxBleClient client) {
    Timber.d("Constructing BleManager and injecting members");
    this.context = context;
    this.bleClient = client;
  }

  public void setMacAddress(String mMacAddress) {
    this.mMacAddress = mMacAddress;

    // Set the associated device on MacAddress change
    bleDevice = bleClient.getBleDevice(this.mMacAddress);
  }

  public String getMacAddress() {
    return mMacAddress;
  }

  public RxBleDevice getBleDevice() {
    Preconditions.checkNotNull(mMacAddress);
    return bleClient.getBleDevice(mMacAddress);
  }

  public Observable<RxBleScanResult> getScanSubscription() {
    Preconditions.checkNotNull(context);
    Preconditions.checkNotNull(bleClient);

    return bleClient.scanBleDevices().distinct();
  }

  public Observable<RxBleConnection> getConnectionSubscription() {
    Preconditions.checkNotNull(context);
    Preconditions.checkNotNull(bleDevice);

    if (connectionObservable == null) {
      connectionObservable = bleDevice.establishConnection(context, false)
                                      .takeUntil(disconnectTriggerSubject)
                                      .observeOn(AndroidSchedulers.mainThread())
                                      .doOnUnsubscribe(this::clearSubscription)
                                      .compose(new ConnectionSharingAdapter());
    }

    return connectionObservable;
  }

  public Observable<byte[]> setupListeners() {
    return connectionObservable.flatMap(rxBleConnection -> rxBleConnection.setupNotification(CTRL_FROM_BRIDGE_UUID))
                               .doOnNext(notificationObservable -> Timber.d("Notification Setup"))
                               .flatMap(notificationObservable -> notificationObservable)
                               .observeOn(AndroidSchedulers.mainThread());
  }

  private void triggerDisconnect() {
    disconnectTriggerSubject.onNext(null);
  }

  public Observable<byte[]> writeBytes(byte[] bytes) {
    return connectionObservable.flatMap(rxBleConnection -> rxBleConnection.writeCharacteristic(
      BLE_WRITE_CHARACTERISTIC_UUID,
      bytes)).observeOn(AndroidSchedulers.mainThread());
  }

  private boolean isConnected() {
    return bleDevice.getConnectionState() == RxBleConnection.RxBleConnectionState.CONNECTED;
  }

  /**
   * Will update the UI with the current state of the Ble Connection
   */
  private void registerConnectionStateChange() {
    bleDevice.observeConnectionStateChanges().observeOn(AndroidSchedulers.mainThread()).subscribe(connectionState -> {
      isConnected = connectionState.equals(RxBleConnection.RxBleConnectionState.CONNECTED);
    });
  }

  private void clearSubscription() {
    connectionObservable = null;
  }

}

A: I have thought a bit about your use-case. With sharing the same connection you're introducing states to your application which needs a bit of state handling and therefore it is impossible (or at least I have no idea how) to be purely reactive.
I have focused on establishing a connection and performing a write-notify transmission to a BLE device that is serialized.
private PublishSubject<Pair<byte[], Integer>> inputSubject = PublishSubject.create();

private PublishSubject<Pair<byte[], Integer>> outputSubject = PublishSubject.create();

private Subscription connectionSubscription;

private volatile int uniqueId = 0; // used to identify the transmission we're interested in in case more than one will be started at the same time

public void connect() {
    Observable<RxBleConnection> connectionObservable = // your establishing of the connection wether it will be through scan or RxBleDevice.establishConnection()
    final UUID notificationUuid = // your notification characteristic UUID
    final UUID writeUuid = // your write-only characteristic UUID

    connectionSubscription = connectionObservable
            .flatMap(
                    rxBleConnection -> rxBleConnection.setupNotification(notificationUuid), // subscribing for notifications
                    (rxBleConnection, notificationObservable) -> // connection is established and notification prepared
                            inputSubject // waiting for the data-packet to transmit
                                    .onBackpressureBuffer()
                                    .flatMap(bytesAndFilter -> {
                                                return Observable.combineLatest( // subscribe at the same time to
                                                        notificationObservable.take(1), // getting the next notification bytes
                                                        rxBleConnection.writeCharacteristic(writeUuid, bytesAndFilter.first), // transmitting the data bytes to the BLE device
                                                        (responseBytes, writtenBytes) -> responseBytes // interested only in the response bytes
                                                )
                                                        .doOnNext(responseBytes -> outputSubject.onNext(new Pair<>(responseBytes, bytesAndFilter.second))); // pass the bytes to the receiver with the identifier
                                            },
                                            1 // serializing communication as only one Observable will be processed at the same time
                                    )
            )
            .flatMap(observable -> observable)
            .subscribe(
                    response -> { /* ignored here - used only as side effect with outputSubject */ },
                    throwable -> outputSubject.onError(throwable)
            );
}

public void disconnect() {
    if (connectionSubscription != null && !connectionSubscription.isUnsubscribed()) {
        connectionSubscription.unsubscribe();
        connectionSubscription = null;
    }
}

public Observable<byte[]> writeData(byte[] data) {
    return Observable.defer(() -> {
                final int uniqueId = this.uniqueId++; // creating new uniqueId for identifying the response
                inputSubject.onNext(new Pair<>(data, uniqueId)); // passing the data with the id to be processed by the connection flow in connect()
                return outputSubject
                        .filter(responseIdPair -> responseIdPair.second == uniqueId)
                        .first()
                        .map(responseIdPair -> responseIdPair.first);
            }
    );
}

This is an approach that I think is good as the whole flow is described in one place and therefore easier to understand. The part of communication that is stateful (writing request and waiting for response) is serialized and it has the possibility to persist the connection till the disconnect() call.
The downside is that the transmission relies on the side effects of different flow and calling the writeData() before the connection is established and notification setup will never complete the returned Observable though it shouldn't be a problem to add handling for this scenario with a state check.
Best Regards


text:
Q: Boot system security I'm running Ubuntu 16.04 LTS + Windows 7 & 10 on 3 hard drives and would like to have one boot system yet am mildly security conscious:

*

*Will using the Ubuntu graphical interface GRUB 2 boot fixer with a view to loading Ubuntu 'OR' either Windows system affect the security of the Windows 7 & 10 systems, as in can the Linux part be used to place root kits etc. in them?

A:
affect the security of the Windows 7 & 10 systems

Only if someone has access to your system. Physical access to a machine means that person has control over the machine and can do anything. Format the disks, install rootkits, keyloggers. Anything.

as in can the Linux part be used to place root kits etc in them?

Yes, but Windows will the entry point for malware, not Ubuntu/Linux. In Ubuntu/Linux there are a few simple rules:

*

*A good admin password

*Create backups.

*Stick to official sites to install software, don't install software you do not use

*Don't install software to access your system remotely

... and it is impossible for someone other than you to install a root kit.
It is very easy to install a root kit when you have physical access. You can reboot Ubuntu/Linux and you can use an live session to install software onto the system. Remotely that is very hard to pull off.

The entry points into Ubuntu/Linux are WINE, samba shares, connection software into your system (remote desktop), software installed from unofficial sites.
(all of these require admin password; so use a good one).
And then the more unlikely methods ... bugs in browsers, deliberate bugs in encryption tools, or openSSL (NSA) a breached repository, hacked websites where someone altered ISO's and the hashes for those ISOs (Mint with their wordpress site).
(these... well we need to trust someone. Canonical has a good track record; they have yet to admit to something related to a breach that impacted us all where they where the responsible party. Their track record is better than Microsoft or Apple, and better than the maintainers of Mint).


text:
Q: How to programmatically uncheck checkbox? I want to programmatically uncheck a checkbox. I know how to it in javascript but since I'm using angular, i think it's different.
Here's the link of jsfiddle : https://jsfiddle.net/TKVH6/499/
This is the first time I used jsfiddle so please let me know if you cant see the script and html.
This is the html
<input type="checkbox" ng-model="v" ng-click="checkAll()" />
<button ng-click="x()">eto</button>

This is the angular
$scope.x = function () {
    $scope.v.checked=false;
};

I know there are lots of question like this, I've already tried those but I can't make it work.
Thanks!

A: <input type="checkbox" ng-checked="v" ng-click="checkAll()" />

In your controller
$scope.v = true; // or false

A: First thing : You have specified controller on ul and bind click event of button outside the ul so moved ng-controller on div.
Second thing: In order to check it pragmatically you need to set $scope.Items[i].Selected = true;
$scope.x = function () {
    alert("x");
    $scope.Items[0].Selected=true;
};

Why we need to set Selected property of Items[i] while I have not declared?

The reason behind that is your html binding is something like this:
<li ng-repeat="item in Items">
    <label>{{item.Name}}
        <input type="checkbox" ng-model="item.Selected" />
    </label>
</li>

Here every item is element from Items array that means your checkbox checked value is now bind to selected property of that object. Even though you have not defined that property in Items collection angular will create it and will bind it to that property. So you are required to set that property. I hope it would help you.
Here is working fiddle => link


text:
Q: Python web scraping with Selenium on Dynamic Page - Issue with looping to next element I am hoping someone can please help me out and put me out of my misery. I have recently started to learn Python and wanted to challenge myself with some web-scraping.
Over the past couple of days I have been trying to web-scrape this website (https://ebn.eu/?p=members). On the website, I am interesting in:

*

*Clicking on each logo image which brings up a pop-up

*From the pop-up scrape the link which is behind the text "VIEW FULL PROFILE"

*Move to the next logo and do the same for each

I have managed to get Selenium up and running but the issue is that it keeps opening the first logo and copying the same link as opposed to moving to the next one. I have tried in various different ways but came up against a brick wall.
My code so far:
from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC

PATH = "/home/ed/Documents/python/chromedriver" # location of the webdriver - amend as requried

url = "https://ebn.eu/?p=members"

driver = webdriver.Chrome(PATH)
driver.get(url)

member_list = []

# Flow to open page and click on link to extract href

members = driver.find_elements_by_xpath('//*[@class="projectImage"]') # Looking for the required class - the image which on click brings up the info

for member in members:
    print(member.text) # to see that loop went to next iteration
    member.find_element_by_xpath('//*[@class="projectImage"]').click()
    wait = WebDriverWait(driver, 10)
    element = wait.until(EC.element_to_be_clickable((By.LINK_TEXT, 'VIEW FULL PROFILE')))
    links = driver.find_element_by_partial_link_text("VIEW FULL PROFILE")
    href = links.get_attribute("href")
    member_list.append(href)
    member.find_element_by_xpath("/html/body/div[5]/div[1]/button").click()

    print(member_list)
driver.quit()

P.S: I have tried changing the member.find to:
member.find_element_by_xpath('.//*[@class="projectImage"]').click() But then I get "Unable to find element"
Any help is very much appreciated.
Thanks

A: If you study the HTML of the page, they have the onclick script which basically triggers the JS and renders the pop-up. You can make use of it.
You can find the onclick script in the child element img.
So your logic should be like (1)Get the child element (2)go to first child element (which is img always for your case) (3)Get the onclick script text (4)execute the script.
child element
for member in members:
    print(member.text) # to see that loop went to next iteration
    # member.find_element_by_xpath('//*[@class="projectImage"]').click()

    #Begin of modification
    child_elems = member.find_elements_by_css_selector("*") #Get the child elems
    onclick_script = child_elems[0].get_attribute('onclick')#Get the img's onclick value
    driver.execute_script(onclick_script)                   #Execute the JS
    time.sleep(5)                                           #Wait for some time
    #end of modification
    wait = WebDriverWait(driver, 10)
    element = wait.until(EC.element_to_be_clickable((By.LINK_TEXT, 'VIEW FULL PROFILE')))
    links = driver.find_element_by_partial_link_text("VIEW FULL PROFILE")
    href = links.get_attribute("href")
    member_list.append(href)
    member.find_element_by_xpath("/html/body/div[5]/div[1]/button").click()

    print(member_list)

You need to import time module. I prefer time.sleep over wait.until, it's more easier to use when you are starting with web scraping.


text:
Q: A bunch of directories backed up from my previous OS install have setgid permissions, how can I remove it from them? I'm OS X 10.10.1
I just reinstalled my OS, and after restoring the contents of my documents folder from a flash drive, all the directories seem to have setgid permissions because they are showing up in a command prompt with a yellow background.
I have tried chmod g-s directory_name chmod -R g-s directory_name etc. and the highlighting doesn't seem to go away.
I've looked to see if the syntax for OS X is different, but it doesn't appear to be. What am I doing wrong?
This affects the directories within the directories as well. How can I recursively remove the setgid permissions from all of these folders?

A: Based on the 777 (rwxrwxrwx) mode you're seeing, it is probably highlighting the fact that those files have world/others bits set, which is generally considered bad practice.
I'd suggest setting mode 770 (rwxrwx---) on the directories, and mode 660 (rw-rw----) on documents. Minimally, you should be able to clear the world bits with chmod -R o-rwx -- that will however still leave your documents 'executable', which is also bad practice.


text:
Q: Is my understanding of this assembly loop correct? I have compiled some C code that does a loop as below:
#include <stdio.h>

int main(int argc, char *args[]){
  for(int i = 0; i < argc; i++){
    printf("%s\n", args[i]);
  }
}

I have compiled it with optimisation by doing gcc -O2 -S -c main.c.
Which gave this output (I have made my own comments too):
  .section  __TEXT,__text,regular,pure_instructions
  .globl  _main                   ## -- Begin function main
_main:                                  ## @main
  pushq %rbp                      #Backup base pointer
  movq  %rsp, %rbp                #point stack pointer to base pointer

  pushq %r14                      #Backup r14
  pushq %rbx                      #Backup rbx
  movq  %rsi, %rbx                #Move rsi (argc) to rbx
  testl %edi, %edi                # does edi == 0?
  jle LBB0_3                      #if <= 0; goto LBB0_3
## %bb.1:
  movl  %edi, %r14d               #set edi to
LBB0_2:                                 ## =>This Inner Loop Header: Depth=1
  movq  (%rbx), %rdi              #Move value of address of rbx into argument 1
  callq _puts                     #call puts print(argument two)
  addq  $8, %rbx                  #add eight to rbx (length of char type)
  decq  %r14                      #r14--
  jne LBB0_2                      #if edi != 0, goto LBB0_2
LBB0_3:
  xorl  %eax, %eax                #return 0

  popq  %rbx                      #restore rbx
  popq  %r14                      #restore r14

  popq  %rbp                      #restore base pointer
  retq                            #go to call address

And this is my pseudocode that I have created from the assembly code:
rbx = command line arguments (CLI)
if argc == 0 {
    goto LBB0_3
}

r14d = argc
LBB0_2:
    arg1 =  value at CLI address
    puts(arg1)
    increment address of CLI by 8
    r14--
    if r14 != 0 {
        goto LBB0_3
    }
    goto LBB0_2
LBB0_3:
    return 0

Is my understanding of this assembly loop correct?


text:
Q: Authentication token type [(null)] is not supported I have configured sssd on my servers (some RHEL and CentOS 6), but on some of them, I get the following error in /var/log/sssd/sssd_example.com.log:
[sssd[be[example.com]]] [sdap_auth_send] (1): Authentication token type [(null)] is not supported
[sssd[be[example.com]]] [fo_set_port_status] (4): Marking port 389 of server 'example.com' as 'not working'

SSSD is configured to use an LDAP server. /etc/sssd/sssd.conf contains:
[..]
ldap_default_bind_dn = CN=example,cn=com
ldap_default_authtok_type = obfuscated_password
ldap_default_authtok = AAAgAE/vW3+JSwU737kaW/fByo/8zxXgFqyrsFn62RiOyuo2C9475/X9Ps5jnNvm6T61mQW3gjPrzr8tqWIbRh7qrGTe/TDiHkt13l4r8yMqCqpeAAECAyEC
[..]

What is wrong ?

A: The error is related to ldap_default_authtok_type which has an invalid value.
In my case, I prepared my setup on some RHEL/CentOS 6.2 servers, but deployed it on some old RHEL/CentOS 6.0 servers, which don't support obfuscated_password scheme (see sss_obfuscate).
So there are two options:

*

*Upgrade your system, so obfuscated_password is supported by sssd.

*Use non obfuscated password in sssd.conf:

Example:
ldap_default_authtok_type = password
ldap_default_authtok = mycleartextpassword


text:
Q: Infinite loop, removing duplicates from a stack? I get an infinite loop when printing the new stack that's returned by removeDuplicates function, but I don't know what's causing it? All the other functions are working perfectly. The functions should keeps the first occurrence if the element is duplicated. This is the code:
class Stack {
      Node *head;

      public: Stack() {
          head = NULL;
      };

      ~Stack() {
          while (head) {
              Node * temp = head;
              head = head->next;
              delete temp;
          }
      }

      void push(int data);
      int pop();
      bool isEmpty();
      void print();
      Stack removeDuplicates();
 };

 void Stack::push(int data) {
    Node *temp = new Node(data);
    temp->next = head;
    head = temp;
 }

 int Stack::pop() {
    if (head != NULL ) {
        int x = head->data;
        Node *temp = head;
        head = head->next;
        delete temp;
        return x;
    } else {
        cout << "The stack is empty!";
        return -1;
    }
 }

 bool Stack::isEmpty(){
    return head == NULL;
 }

 void Stack::print() {
     Node * temp = head;
     while(temp != NULL ) {
         cout << temp->data << " ";
         temp = temp->next;
     }
 }

 Stack Stack::removeDuplicates(){
    Stack st;
    Node *temp = NULL;
    bool flag;

    while (head != NULL) {
        if (st.head == NULL) {
            st.push(head->data);
            temp = st.head;
        } else {
            flag = true;
            while (temp != NULL) {
                if (head->data == temp->data)
                    flag = false;
                temp = temp->next;
            }
            if (flag == true)
               st.push(head->data);
         }
         Node *del = head;
         head = head->next;
         delete del;
     }
     return st;
 }

A: What is head declared as outside the function?
Does any code outside the function modify head?
If head is null going into the function then your function won't do anything, and depending on the print code you also didn't present, it might just loop forever for just that reason alone.
In your first if statement you have if (st.head == NULL) ... and then you set temp to st.head, e.g. temp = NULL, so when is temp ever going to be non-null to use in the else branch of the if statement?
Why don't you initialize all your variables explicitly inside the function instead of merely declaring them and associating them with types, since, if they're stack variables they are undefined.  It also helps to understand and maintain code if you format it so it is easier to parse visually.  You'd be surprised how many errors you can catch with that discipline.
  Stack Stack::removeDuplicates() {
    Stack st;
    Node *temp = NULL;
    bool flag;

    while (head != NULL) {
        if (st.head == NULL) {
            st.push(head->data);
            temp = st.head;
        } else {
            flag = true;
            while (temp != NULL) {
                if (head->data == temp->data)
                    flag = false;
                temp = temp->next;
            }
            if (flag)
               st.push(head->data);
        }
        Node *del = head;
        head = head->next;
        delete del;
     }
     return st;
  }


text:
Q: Specifying 'Where' keyword with numeric types I'm not quite sure how to resolve this and my current implementation is clunky. I have a generic method in my class that applies a numeric value to a combo box's Value property. I would like this method to work for ints, floats, decimals, and doubles. Internally it will cast to a decimal. Here is my code currently:
private void UpdateValueFromComboBox<T>(ComboBox tSource, NumericUpDown tDest)
{
    NamedKeyValuePair<String, T> tKV = tSource.SelectedItem as NamedKeyValuePair<String, T>;
    if (tKV != null)
    {
        // Update the Control's value with what was saved
        tDest.Value = Decimal.Parse(tKV.Value.ToString());
    }
}

What I want to do is get rid of the ToString() and Parse() calls. Basically, I want the assignment to be as follows:
tDest.Value = (Decimal) tKV.Value;

But because C# doesn't know what 'T' is or will be, it gives me an error. I get an error that "Cannot convert type 'T' to 'decimal'". Is there a way to specify, using the Where keyword, that the values being passed in are numeric??

A: This is not possible.
Instead, you can add where T : struct, IConvertible and call tKV.Value.ToDecimal(CultureInfo.InvariantCulture).

A: Not built in:
https://stackoverflow.com/search?q=numeric+generic+C%23
You could try Convert.ToDeciaml(tKV.Value) since it takes an object as a parameter.


text:
Q: Replace string time lyrics or subtitles to data attribute - Jquery can help me
or example how to replace string,
if you can use jQuery, so I can easily understand it
Here's an example

[00:00.00]text 1
[00:14.71]text 2
[00:43.42]text 3
[00:57.34]text 4
[01:12.00]text 5
[01:29.69]text 6
[01:44.13]text 7
[01:58.05]text 8
[02:12.39]text 9
[02:33.23]text 10

and the result

text 1

text 2

text 3

text 4

text 5

text 6

text 7

text 8

text 9

text 10

Sorry if my english is not good.
thank you if willing to help

A: Assuming your div is in the current document, you could do it like this:

$('#subtitles').contents().replaceWith(
    $('#subtitles').text()
        .match(/\[.*/gm)
        .map(s => [s.substr(10), +s.substr(4,5) + 60*s.substr(1,2)])
        .map(([text, minutes], i, arr) =>
            $('
').addClass('sub')
                .attr('data-on', minutes)
                .attr('data-off', (i+1) in arr ? arr[i+1][1] : 'Infinity')
                .text(text)
        )
);

[00:00.00]text 1
[00:14.71]text 2
[00:43.42]text 3
[00:57.34]text 4
[01:12.00]text 5
[01:29.69]text 6
[01:44.13]text 7
[01:58.05]text 8
[02:12.39]text 9
[02:33.23]text 10


text:
Q: How to create a common IconButton in WPF Here is my case,
To create a common icon button, which can be used with different icons whereever.
Here are my steps:
1). create a custom IconButton derived from Button, it has a DefaultImageSource dependency property. Here it is:

public class IconButton : Button
{
    public static readonly DependencyProperty DefaultImageSourceProperty =
       DependencyProperty.Register("DefaultImageSource", typeof(ImageSource), typeof(IconButton), new FrameworkPropertyMetadata(null));//, new FrameworkPropertyMetadata(OnImageSourceChanged));

    public ImageSource DefaultImageSource
    {
        get { return (ImageSource)GetValue(DefaultImageSourceProperty); }
        set { SetValue(DefaultImageSourceProperty, value); }
    }
}

2). Create a style for IconButton in project resource where supppose to use this IconButton with this style,

        <Style x:Key="IconButtonTemplate" TargetType="{x:Type WpfApplication3:IconButton}">
            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate TargetType="{x:Type WpfApplication3:IconButton}">
                        <Grid>
                            <Image Source="{Binding RelativeSource={RelativeSource Self}, Path=DefaultImageSource}"  Stretch="Uniform" Width="Auto" Height="Auto" x:Name="imageArt"/>
                            <Ellipse x:Name="focusEllipse" Fill="Transparent"/>
                        </Grid>
                        <ControlTemplate.Triggers>
                            <Trigger Property="IsMouseOver" Value="True">
                                <Setter TargetName="focusEllipse" Property="Fill" Value="#AAFFFFFF"/>
                            </Trigger>
                            <Trigger Property="IsPressed" Value="True">
                                <Setter TargetName="focusEllipse" Property="Fill" Value="#AA808080"/>
                            </Trigger>
                            <Trigger Property="IsEnabled" Value="False">
                                <Setter TargetName="focusEllipse" Property="Fill" Value="#80808080"/>
                            </Trigger>
                        </ControlTemplate.Triggers>
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
        </Style>

3). Create multi IconButton in my WPF window, and binding them to different icon, but no luck; icons don't show up when openning this window,

<Grid>

    <DockPanel>

        <WpfApplication3:IconButton Width="30" Height="30" DefaultImageSource="{DynamicResource RefreshIcon}" Style="{DynamicResource IconButtonTemplate}"></WpfApplication3:IconButton>

        <WpfApplication3:IconButton Width="30" Height="30" DefaultImageSource="{DynamicResource RunIcon}" Style="{DynamicResource IconButtonTemplate}"></WpfApplication3:IconButton>
    </DockPanel>
</Grid>

It might be issue of the wrong binding for the image resource, but can't figure out with several tries. Any suggestion? Thanks.

A: I can see the issue in Binding . Using
 <Image Source="{Binding RelativeSource={RelativeSource Self}, Path=DefaultImageSource}"  Stretch="Uniform" Width="Auto" Height="Auto" x:Name="imageArt"/>

using Self Mode you are trying to Bind Source to DefaultImageSource property of Image Control. And Image doesnot have any such property so bang.
Try this
 <Image Source="{TemplateBinding DefaultImageSource}"  Stretch="Uniform" Width="Auto" Height="Auto" x:Name="imageArt"/>

This will try to bind the Source of Image to DefaultImageSource property of Button.
I hope this will help.


text:
Q: button height in percent makes it flat I've been trying to create a button that resizes with screen resolution but it's giving me trouble. For some reason the width is fine - but with all the same code the height won't go above about 5 pixels. This is what I'm doing:

.links a {
  text-decoration: none;
  border: red 2px solid;
  border-radius: 100%;
  display: inline-block;
  height: 12%;
  width: 12%;
  overflow: hidden;
}

button.links {
  background:#003678;
  border: none;
  height: 60%;
  width: 60%;
}
<button class="links">

</button>

button.links is the parent in this case. I've tried targeting the body element and adding another element to target for size. What's going wrong?


text:
Q: Not able to start service when app is in background I want to start service to play mp3 url when push notification is received but when app in background or idle service doesn't start due to android restriction policy here is my code so doing with notification.
I am also using data payload its working fine app is in foreground but the problem is coming when app goes to background.
My FirebaseMessaging Class  where staring the service
 val resultIntent = Intent(applicationContext, MusicService::class.java)
                        resultIntent.putExtra("title", title)
                        resultIntent.putExtra("body", body)
                        resultIntent.putExtra("action_type", action_type)
                        resultIntent.putExtra("deep_link_type", deep_link_type)
                        resultIntent.putExtra("deep_link_id", deep_link_id)
                        resultIntent.putExtra("masjid_Id", masjid_Id)
                        resultIntent.putExtra("url", url)
                        Log.i("***TAG", "From Background")
                        resultIntent.setAction("com.example.mymasjid");
//                        resultIntent.flags = Intent.FLAG_ACTIVITY_NEW_TASK or Intent.FLAG_ACTIVITY_SINGLE_TOP
                        startService(resultIntent)

**My Music Service Class**

class MusicService : Service(), MediaPlayer.OnPreparedListener, MediaPlayer.OnCompletionListener,
    MediaPlayer.OnErrorListener {

    var objService: MusicService? = null
    var title: String = ""
    var body: String = ""
//    private val mBinder: IBinder = LocalBinder()

    override fun onCreate() {
        super.onCreate()
//        if (title.isNotEmpty() && body.isNotEmpty())
            adhanNotification(title, body)
    }

    override fun onStartCommand(intent: Intent?, flags: Int, startId: Int): Int {
//        val url = intent!!.getStringExtra("url")
         title = intent!!.getStringExtra("title").toString()
         body = intent!!.getStringExtra("body").toString()
//        if (title!!.isNotEmpty() && body!!.isNotEmpty())
            Log.i("***TAG","From Background Service")
            adhanNotification(title, body)
        val url = "https://cdn.islamic.network/quran/audio/64/ar.alafasy/9.mp3"
        if (mediaPlayer != null) {
            mediaPlayer!!.stop()
            mediaPlayer!!.release()
            mediaPlayer = null
        }
        mediaPlayer = MediaPlayer()
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
            mediaPlayer!!.setAudioAttributes(
                AudioAttributes.Builder()
                    .setUsage(AudioAttributes.USAGE_MEDIA)
                    .setContentType(AudioAttributes.CONTENT_TYPE_MUSIC)
                    .setLegacyStreamType(AudioManager.STREAM_MUSIC)
                    .build()
            );
        } else {
            mediaPlayer!!.setAudioStreamType(AudioManager.STREAM_MUSIC);
        }
        try {
            mediaPlayer!!.setDataSource(url)
            mediaPlayer!!.prepare()
            mediaPlayer!!.start()
        } catch (e: IOException) {
            e.printStackTrace()
        }
        mediaPlayer!!.setLooping(false)
        mediaPlayer!!.setOnPreparedListener(this);
        mediaPlayer!!.setOnCompletionListener(this);
        return START_STICKY
    }

    override fun onBind(intent: Intent): IBinder? {
        return null
    }

    override fun onPrepared(p0: MediaPlayer?) {
        mediaPlayer!!.start()
        Log.i("***play", "play")
    }

    override fun onCompletion(p0: MediaPlayer?) {
        mediaPlayer!!.stop()
        Log.i("***play", "complete")
        stopSelf()
        /* mediaPlayer!!.release()

         mediaPlayer=null*/
    }

    override fun onError(p0: MediaPlayer?, p1: Int, p2: Int): Boolean {
        Log.i("***play", "error")
        return false
    }

    override fun onDestroy() {
        isServiceRunning = false
        objService = null
        super.onDestroy()
    }

    private fun adhanNotification(title: String, body: String) {
        val notificationManager = getSystemService(NOTIFICATION_SERVICE) as NotificationManager
        val mBuilder = NotificationCompat.Builder(applicationContext, "notify_001")
        val collapsedView = RemoteViews(
            packageName,
            R.layout.notification
        )
        val expandView = RemoteViews(packageName, R.layout.notification_expand)

        val onCancelIntent = Intent(this, CancelNotification::class.java)
        val onDismissPendingIntent =
            PendingIntent.getService(this.applicationContext, 0, onCancelIntent, 0)

        val time = Utility.getTime("LLL dd, KK:mm aaa")
        collapsedView.setTextViewText(R.id.tvNotifyTime, time)
        collapsedView.setTextViewText(R.id.title, title)
        collapsedView.setTextViewText(R.id.body, body)
        expandView.setTextViewText(R.id.tvNotifyTime, time)
        expandView.setTextViewText(R.id.title, title)
        expandView.setTextViewText(R.id.body, body)
//        val switchIntent = Intent(this, BackgroundService.switchButtonListener::class.java)

        mBuilder.setSmallIcon(R.drawable.ic_notification)
        mBuilder.setDeleteIntent(onDismissPendingIntent)
        //mBuilder.setAutoCancel(true)
        mBuilder.setOngoing(false)
        /*    if (sound=="default")
                mBuilder.setSound(uri)
            else if (sound=="silent")
                mBuilder.setSilent(true)*/
        mBuilder.priority = Notification.PRIORITY_HIGH
//        mBuilder.setOnlyAlertOnce(false)
        mBuilder.build().flags = Notification.FLAG_NO_CLEAR or Notification.PRIORITY_HIGH
        //mBuilder.setCustomContentView(contentView)
        mBuilder.setCustomContentView(collapsedView)
        mBuilder.setCustomBigContentView(expandView)
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
            val channelId = "channel_id"
            val channel =
                NotificationChannel(channelId, "channel name", NotificationManager.IMPORTANCE_HIGH)
            channel.enableVibration(true)
            channel.vibrationPattern = longArrayOf(100, 200, 300, 400, 500, 400, 300, 200, 400)
            notificationManager.createNotificationChannel(channel)
            mBuilder.setChannelId(channelId)
        }
        val random = (0 until 100).random()
        val notification = mBuilder.build()
        notificationManager.notify(random, notification)
    }

    companion object {
        var isServiceRunning = false
        var mediaPlayer: MediaPlayer? = null
    }
}


text:
Q: How to match until first occurrence of a pattern? I am parsing a file and trying to extract multiple sections in the file. One such section is called 'Report', a single file might contain multiple reports. I wish to extract each of these 'Report' sections from the file using a regex.
Issue being faced:
There are multiple sections which end with '-----', how do I stop at the first occurrence of it?
Current Regex:
-+(\s+)?Report(\s+)?-+\n(.*\n)+\n-{72}

This regex, unfortunately, matches all the sections as a single one, whereas I intend to stop at the first occurrence of '----' section ending pattern.
Sample File:
----------- Report -----------
Lorem ipsum dolor sit amet, consectetur adipiscing elit. At hoc in eo M. Si longus, levis; Ita prorsus, inquam; Tu quidem reddes; Ratio quidem vestra sic cogit. Duo Reges: constructio interrete. Tum Torquatus: Prorsus, inquit, assentior
------------------------------
Putabam equidem satis, inquit, me dixisse. Dicimus aliquem hilare vivere; Quonam, inquit, modo? Nescio quo modo praetervolavit oratio.
----------- Report -----------
At hoc in eo M. Sed quae tandem ista ratio est? Quoniam, si dis placet, ab Epicuro loqui discimus. Venit ad extremum; Illud non continuo, ut aeque incontentae.
------------------------------
Illi enim inter se dissentiunt. Equidem e Cn. At multis malis affectus. Hoc loco tenere se Triarius non potuit. Haec dicuntur inconstantissime. Efficiens dici potest.
----------- Analysis -----------
At hoc in eo M. Sed quae tandem ista ratio est? Quoniam, si dis placet, ab Epicuro loqui discimus. Venit ad extremum; Illud non continuo, ut aeque incontentae.
----------------------------
Note:

*

*The ending '----' pattern has '-' repeating 72 times

*There is always a one empty line after '--- Report ---' and before the ending '----'pattern

*Language being used: Python

A: You may use
(?s)-+\s*Report\s*-+\n(.*?)\n-{72}

Or - since ---Report----s start at the start of the lines:
(?sm)^-+\s*Report\s*-+\n(.*?)\n-{72}

See the regex demo
Details:

*

*(?s) - enable DOTALL mode

*-+ - 1+ hyphens

*\s* - 0+ whitespaces

*Report - a substring of literal chars

*\s*  - 0+ whitespaces

*-+ - 1+ hyphens

*\n  - a newline

*(.*?) - capturing group 1 matching any 0+ chars but as few as possible up to the first...

*\n-{72} - newline followed with 72 hyphens.

Use with re.findall.


text:
Q: How can i trigger slideNext in Ionic 4 I am using Ionic 4 and i want to trigger slideNext() in my custom function but I don't know how to call slideNext(). Can anyone help me. This is my html code.
<ion-slides pager="true">
    <ion-slide class="step-one">
        <ion-img src="/assets/icon/favicon.png"></ion-img>

Heading 1

Text

    </ion-slide>

    <ion-slide class="step-two" *ngIf = "verificationCodeSent == 1">
        <ion-img src="/assets/icon/favicon.png"></ion-img>

Heading 2

Text

    </ion-slide>

    <ion-slide class="step-three" *ngIf = "verificationDone == 1">
        <ion-img src="/assets/icon/favicon.png"></ion-img>

Heading 3

Text

        <ion-button (click)="finish()">FINISH TUTORIAL!</ion-button>
    </ion-slide>
</ion-slides>

A: heres one example of how to use it
.html
  <ion-slides pager="true" #theSlides>
<ion-slide class="step-one" (click)="move(theSlides)">
    <ion-img src="/assets/icon/favicon.png"></ion-img>

Heading 1

Text

</ion-slide>

<ion-slide class="step-two" >
    <ion-img src="/assets/icon/favicon.png"></ion-img>

Heading 2

Text

</ion-slide>

<ion-slide class="step-three" >
    <ion-img src="/assets/icon/favicon.png"></ion-img>

Heading 3

Text

    <ion-button (click)="finish()">FINISH TUTORIAL!</ion-button>
</ion-slide>

.ts
move(slides){
    console.log(slides)
    slides.slideTo(2)
}

Pass a reference (#theSlides) to the slide in the custom function (move(theSlides))


text:
Q: using docker image from registry with terraform Im trying to use an docker image which is hosted on the docker hub registry with terraform. When i run terraform apply is says that it does not exist or docker login is required. And then it fails with an requested access to the resource is denied. What am i doing wrong?
main.tf:
provider "docker" {
    host = "npipe:////.//pipe//docker_engine"

    registry_auth {
        address = "registry.hub.docker.com"
        username = "username"
        password = "passwword"
    }
}

resource "docker_image" "ubuntu" {
  name          = "data.docker_registry_image.ubuntu.name"
  pull_triggers = ["data.docker_registry_image.ubuntu.sha256_digest"]
}

data "docker_registry_image" "ubuntu" {
  name = "ubuntu:latest"
}

versions.tf:
terraform {
  required_providers {
    docker = {
      source = "terraform-providers/docker"
    }
  }
  required_version = ">= 0.13"
}

error output:
Error: Unable to read Docker image into resource: Unable to pull image data.docker_registry_image.ubuntu.name: error pulling image data.docker_registry_image.ubuntu.name: Error response from daemon: pull access denied for data.docker_registry_image.ubuntu.name, repository does not exist or may require 'docker login': denied: requested access to the resource is denied

  on main.tf line 11, in resource "docker_image" "ubuntu":
  11: resource "docker_image" "ubuntu" {

A: You need to remove the four quotation marks from within the resource "docker_image" "ubuntu" block.


text:
Q: I get an error everytime i import Animated from Reanimated 2 into my Expo project. Error below The error --> Error: Exception in HostFunction: java.lang.IllegalArgumentException: Could not find @ReactModule annotation in com.swmansion.gesturehandler.react.RNGestureHandlerModule
Here is where i try to import it:

import Animated, { SlideInUp, SlideInDown } from "react-native-reanimated";

const HomeScreen = ({ navigation }: any) => {
  return (
    <View style={styles.container}>
      <Text>Home</Text>
      <Navigation navigation={navigation} />
      <StatusBar style="auto" />
    </View>
  );
};


text:
Q: Help with PHP While function Why is this not working?
<?php
$select = "select * from messages where user='$u'";

$query = mysqli_query($connect,$select) or die(mysqli_error($connect));

$row = mysqli_num_rows($query);

$result = mysqli_fetch_assoc($query);

$title = mysqli_real_escape_string($connect,trim($result['title']));

$message = mysqli_real_escape_string($connect,trim($result['message']));

while(($result = mysqli_fetch_assoc($query))){
echo $title;
echo '
';
echo '
';
echo $message;
}

?>

where as this works -
<?php

echo $title;

?>

SORRY TO SAY, BUT NONE OF THE ANSWERS WORK. ANY OTHER IDEAS?

A: If your mysqli query is returning zero rows then you will never see anything printed in your while loop.  If $title and $message are not set (because you would want reference them by $result['title'] & $result['message'] if that are the field names in the database) then you will only see two
 tags in your pages source code.

A: If the while loop conditional is not true then the contents of the while loop will never execute.
So if there is nothing to fetch from the query, then you won't see any output.

A: Does you code display anything, or skip the output entirely?
If it skips entirely, then your query has returned 0 rows.
If it outputs the
 s, then you need to check your variables. I could be wrong, not knowing te entire code, but generally in this case you would have something like
echo $result['title'] instead of echo $title

A: If $title and $message come from your mysql query then you have to access them through the $result array returned by mysqli_fetch_assoc.
echo $result['title'];
echo $result['message'];

A: Also if your using mysqli you'd be doing something like this:
$mysqli = new mysqli("localhost", "user", "password", "db");

if ($result = $mysqli->query($query)) {

    while ($row = $result->fetch_assoc()) {
      print $row['title'];
    }

    $result->close();
}

A: Try this:
<?php

$result = mysql_query($query);
while($row = mysqli_fetch_assoc($result)){
   echo $title.'

'.$message;
}

?>

A: Does this work;
<?php
$select = "select * from messages where user='$u'";

$query = mysqli_query($connect,$select) or die(mysqli_error($connect));

$row = mysqli_num_rows($query);

while(($result = mysqli_fetch_assoc($query))){
    echo $result['title'];
    echo '
';
    echo '
';
    echo $result['message'];
}

?>

Basically I've made sure that it's not picking the first result from the query & then relying on there being more results to loop through in order to print the same message repeatedly.


text:
Q: anonymous namespaces and the one definition rule Am I violating the One Definition Rule with the following program?
// foo.hpp
#ifndef FOO_HPP_
#define FOO_HPP_

namespace {
   inline int foo() {
       return 1;
   }
}

inline int bar() {
    return foo();
}
#endif
//EOF

and
// m1.cpp

#include "foo.hpp"

int m1() {
    return bar();
}

//EOF

and
// m2.cpp

#include "foo.hpp"

int m2() {
    return bar();
}

//EOF

and finally
// main.cpp
#include <iostream>

int m1();
int m2();

int main(int, const char* [])
{
    int i = m1();
    int j = m2();

    std::cout << (i+j) << std::endl;
    return 0;
}

// EOF

In the above, note that foo() is defined in an anonymous namespace, so I expect that each translation unit m1.cpp and m2.cpp will get its own version, so there is no violation of the ODR.  On the other hand, bar() is just a plain old inline function which happens to call 2 different foos.  So it violates the ODR, right?
Update:
  Previously I had macros in the definition of foo that changed the value it returned and each of m1 and m2 defined the macro differently before including foo.hpp. (And with that previous example, g++ would produce a binary that output (i+j) with a value other than what you would expect.) But in fact this program violates the ODR even if the body of foo() is identical.

A: This does violate the ODR. See 3.2/5 which is talking about extern inline functions (bar):

in each definition of D, corresponding names, looked up according to
  3.4, shall refer to an entity defined within the definition of D, or shall refer to the same entity...

In this case bar refers to two different versions of foo, thus violating the rule.

A: Yes, this definition of bar() does violate the One Definition Rule. You are creating multiple definitions, each of which calls a different function called foo().
As you say, it would be a violation even if all versions of foo() are identical, since they are still different functions.


text:
Q: DataGrid column width sync I have a listbox which items are built horizontally.
Also i have a DataGrid whose Columns are built dynamically.
Each ListBoxItem is coresponding to a DataGrid Column
I want to sync between the DataGrid Column and the right ListBoxItem, so each ListBoxItem will be parallel to a column. Also when resizing the column , it will change the size of the ListBoxItem.
How can i do it?

A: You can bind item width with to the datagrid column actualwidth
      <StackPanel Grid.Column="1" Orientation="Vertical">
            <DataGrid Grid.IsSharedSizeScope="True">
                <DataGrid.Columns>
                    <DataGridTextColumn Header="Some col 1" x:Name="first"  />
                    <DataGridTextColumn Header="Some col 2" x:Name="second" />
                    <DataGridTextColumn Header="Some col 3" />
                </DataGrid.Columns>

            </DataGrid>

            <ListBox>
                <ListBox.ItemsPanel>
                    <ItemsPanelTemplate>
                        <StackPanel IsItemsHost="True" Orientation="Horizontal" />
                    </ItemsPanelTemplate>
                </ListBox.ItemsPanel>
                <Button Content="button 1" Width="{Binding Path=ActualWidth, ElementName=first}"></Button>
                <Button Content="button 2" Width="{Binding Path=ActualWidth, ElementName=second}"></Button>
            </ListBox>
        </StackPanel>

If you create them dynamically, set binding in code.


text:
Q: Xcode: libpods.a is red
Does anyone know why this is? I'm using SWRevealViewController.  It has been working up until this point.  I'm using the workspace, and I've already looked into other articles and nothing has worked so far.  It's not pulling up an error, but when I run the program it won't load anything because SWRevealViewController is the first thing that comes up.
Thoughts?

A: Do you get an error message when you try to compile? I've had libPods.a in red before, but that didn't stop my project from working. If I remember correctly, this used to be some kind of display bug back in previous versions of Xcode.


text:
Q: How much space does a GPT partition table take up? When you create a GPT partition table on a storage drive, how much of the space is used up by GPT itself? I'm assuming it's on the order of megabytes.
I'm mostly just curious, but when I search this online, I can only find information about the maximum size of a disk that GPT can work with.

A: How much (of the) space is used up by GPT itself?

I'm assuming it's on the order of megabytes.

No, it is much smaller:

In 64-bit Windows operating systems, 16,384 bytes, or 32 sectors, are reserved for the GPT, leaving LBA 34 as the first usable sector on the disk.

Source GUID partition table| DiskInternals

Note: The green block represents the Primary GPT, the blue block
  represents the secondary GPT (which is located at the end of the
  disk).
The GPT uses a modern system of Logical Block Addressing (LBA) rather
  than the outdated CHS (Cylinder-Head-Sector) method, used in MBR.
  Passed down from its predecessor, block LBA 0 contains MBR, with the
  Primary GPT Header in LBA 1. Following the GPT Header is the partition
  table itself. In the 64-bit version of Microsoft Windows NT, the GPT
  reserves the first 32 sectors, so that the first used sector on every
  hard drive is LBA 34.
That aside, the GPT provides data duplication; the header and
  partition table are stored both at the start and the end of the disk.

Source NTFS information: Hard Disk Drive Basics

Further reading

*

*A comparison of GPT and MBR partition structures - gHacks Tech News

*Frequently asked questions about the GUID Partitioning Table disk architecture


text:
Q: Why in this code it is used the RxJS pipe() operator to encapsulate a single map() operator and not to chain multiple RxJS operators? I am not so into RxJs. I am following an Angular video course based on Angular+RxJS and I have the following doubt. Basically it creates a service class that call a REST API returning a JSON like this:
{
   "payload":[
      {
     "id":1,
     "description":"Serverless Angular with Firebase Course",
     "longDescription":"Serveless Angular with Firestore, Firebase Storage & Hosting, Firebase Cloud Functions & AngularFire",
     "iconUrl":"https://s3-us-west-1.amazonaws.com/angular-university/course-images/serverless-angular-small.png",
     "lessonsCount":10,
     "category":"BEGINNER",
     "seqNo":6,
     "url":"serverless-angular",
     "price":50
      },
      {
     "id":2,
     "description":"Angular Core Deep Dive",
     "longDescription":"A detailed walk-through of the most important part of Angular - the Core and Common modules",
     "iconUrl":"https://s3-us-west-1.amazonaws.com/angular-university/course-images/angular-core-in-depth-small.png",
     "lessonsCount":10,
     "category":"BEGINNER",
     "seqNo":3,
     "url":"angular-core-course",
     "price":50
      },
      {
     "id":3,
     "description":"RxJs In Practice Course",
     "longDescription":"Understand the RxJs Observable pattern, learn the RxJs Operators via practical examples",
     "iconUrl":"https://s3-us-west-1.amazonaws.com/angular-university/course-images/rxjs-in-practice-course.png",
     "courseListIcon":"https://angular-academy.s3.amazonaws.com/main-logo/main-page-logo-small-hat.png",
     "category":"BEGINNER",
     "lessonsCount":10,
     "seqNo":2,
     "url":"rxjs-course",
     "price":50
      },
      {
     "id":4,
     "description":"NgRx (with NgRx Data) - The Complete Guide",
     "longDescription":"Learn the modern Ngrx Ecosystem, including NgRx Data, Store, Effects, Router Store, Ngrx Entity, and Dev Tools.",
     "iconUrl":"https://angular-university.s3-us-west-1.amazonaws.com/course-images/ngrx-v2.png",
     "category":"BEGINNER",
     "lessonsCount":10,
     "seqNo":1,
     "url":"ngrx-course",
     "promo":false,
     "price":50
      },
      {
     "id":5,
     "description":"Angular for Beginners",
     "longDescription":"Establish a solid layer of fundamentals, learn what's under the hood of Angular",
     "iconUrl":"https://angular-academy.s3.amazonaws.com/thumbnails/angular2-for-beginners-small-v2.png",
     "courseListIcon":"https://angular-academy.s3.amazonaws.com/main-logo/main-page-logo-small-hat.png",
     "category":"BEGINNER",
     "lessonsCount":10,
     "seqNo":4,
     "url":"angular-for-beginners",
     "price":50
      },
      {
     "id":6,
     "description":"Angular Security Course - Web Security Fundamentals",
     "longDescription":"Learn Web Security Fundamentals and apply them to defend an Angular / Node Application from multiple types of attacks.",
     "iconUrl":"https://s3-us-west-1.amazonaws.com/angular-university/course-images/security-cover-small-v2.png",
     "courseListIcon":"https://s3-us-west-1.amazonaws.com/angular-university/course-images/lock-v2.png",
     "category":"ADVANCED",
     "lessonsCount":11,
     "seqNo":9,
     "url":"angular-security-course",
     "price":50
      },
      {
     "id":7,
     "description":"Angular PWA - Progressive Web Apps Course",
     "longDescription":"Learn Angular Progressive Web Applications, build the future of the Web Today.",
     "iconUrl":"https://s3-us-west-1.amazonaws.com/angular-university/course-images/angular-pwa-course.png",
     "courseListIcon":"https://s3-us-west-1.amazonaws.com/angular-university/course-images/alien.png",
     "category":"ADVANCED",
     "lessonsCount":8,
     "seqNo":10,
     "url":"angular-pwa-course",
     "price":50
      },
      {
     "id":8,
     "description":"Angular Advanced Library Laboratory: Build Your Own Library",
     "longDescription":"Learn Advanced Angular functionality typically used in Library Development. Advanced Components, Directives, Testing, Npm",
     "iconUrl":"https://angular-academy.s3.amazonaws.com/thumbnails/advanced_angular-small-v3.png",
     "courseListIcon":"https://angular-academy.s3.amazonaws.com/thumbnails/angular-advanced-lesson-icon.png",
     "category":"ADVANCED",
     "seqNo":11,
     "url":"angular-advanced-course",
     "price":50
      },
      {
     "id":9,
     "description":"The Complete Typescript Course",
     "longDescription":"Complete Guide to Typescript From Scratch: Learn the language in-depth and use it to build a Node REST API.",
     "iconUrl":"https://angular-academy.s3.amazonaws.com/thumbnails/typescript-2-small.png",
     "courseListIcon":"https://angular-academy.s3.amazonaws.com/thumbnails/typescript-2-lesson.png",
     "category":"BEGINNER",
     "seqNo":12,
     "url":"typescript-course",
     "price":50
      },
      {
     "id":11,
     "description":"Angular Material Course",
     "longDescription":"Build Applications with the official Angular Widget Library",
     "iconUrl":"https://s3-us-west-1.amazonaws.com/angular-university/course-images/material_design.png",
     "category":"BEGINNER",
     "seqNo":14,
     "url":"angular-material-course",
     "price":50
      },
      {
     "id":12,
     "description":"Angular Testing Course",
     "longDescription":"In-depth guide to Unit Testing and E2E Testing of Angular Applications",
     "iconUrl":"https://s3-us-west-1.amazonaws.com/angular-university/course-images/angular-testing-small.png",
     "category":"BEGINNER",
     "seqNo":5,
     "url":"angular-testing-course",
     "lessonsCount":10,
     "promo":false,
     "price":50
      },
      {
     "id":14,
     "description":"NestJs In Practice (with MongoDB)",
     "longDescription":"Build a modern REST backend using Typescript, MongoDB and the familiar Angular API.",
     "iconUrl":"https://angular-university.s3-us-west-1.amazonaws.com/course-images/nestjs-v2.png",
     "category":"BEGINNER",
     "lessonsCount":10,
     "seqNo":8,
     "url":"nestjs-course",
     "promo":false,
     "price":50
      },
      {
     "id":16,
     "description":"Stripe Payments In Practice",
     "longDescription":"Build your own ecommerce store & membership website with Firebase, Stripe and Express",
     "iconUrl":"https://angular-university.s3-us-west-1.amazonaws.com/course-images/stripe-course.jpg",
     "lessonsCount":10,
     "category":"BEGINNER",
     "seqNo":7,
     "url":"stripe-course",
     "price":50
      },
      {
     "id":17,
     "description":"Reactive Angular Course",
     "longDescription":"How to build Angular applications in Reactive style using plain RxJs - Patterns and Anti-Patterns",
     "iconUrl":"https://angular-university.s3-us-west-1.amazonaws.com/course-images/reactive-angular-course.jpg",
     "courseListIcon":"https://angular-academy.s3.amazonaws.com/main-logo/main-page-logo-small-hat.png",
     "category":"BEGINNER",
     "lessonsCount":10,
     "seqNo":0,
     "url":"reactive-angular-course",
     "price":50
      }
   ]
}

As you can see it contains a payload property containing n objects. The tutorial show as, starting from the Observable emitting this payload property  it will return another Observable that emit only the array.
This is the proposed solution:
@Injectable({
  providedIn: 'root'
})
export class CoursesService {

  constructor(private http:HttpClient) {}

  loadedAllCourses(): Observable<Course[]> {
    // The obsarvable return a JSON containing the "payload" property containing the array
    //return this.http.get<Course[]>("/api/courses");
    return this.http.get<Course[]>("/api/courses")
          .pipe(
            map(res => res["payload"])
          );

  }

}

Now I know that the map() operator works on an Observable and return another Observable "modified" by the arrow function passed to the origianl Observable (in this case I am accesing to the content of the payload field of the API call response and I am creating a new Observable containing only the payload field content. It is clear.
The thing that I can not understand is: why this map() operator is defined inside a pipe() operator. From what I understood reading the official documentation the pipe() operator is used to chain multiple operators in declarative fashion (so for example: apply OPERATOR 1, on the output of the OPERATOR 1 (that is an Observable) apply OPERATOR 2 and return another Observable and so on.
Is this reasoning correct? In the previous case I only have a map() operator so in theory I can use the map() operator directly on the Observable returned by the get() method (directly on the Observable containing the API response). Is it right?
Why in this course the istructor always use the pipe() operator also when only a single operator is applied? (as in the previous case). Is it a sort of convention or is it an "error"?

A: In this course the instructor always use the pipe() operator because starting from RxJs 6 they use pipeable operators and that goes from official documentation - https://rxjs.dev/guide/v6/pipeable-operators.
Regarding the way how you use map, seems like "pluck" operator is more appropriate for your case:
   this.http.get<Course[]>("/api/courses")
    .pipe(
        pluck("payload")
    );