text:
Q: Lightning Web Component with search box doesn't load data when first loaded I've built a LWC that displays a list of data (in card form) and has a search box that will allow users to search within the displayed list.
Here's what should happen:

*

*If the search box is empty (i.e. when the page first loads), all of the data should be displayed.

*If the user types in a search term, then all of the records that match that search term in the PO Number field should show up.
Here's what is happening:

*

*When the page first loads, no data is displayed.

*If the user types in a search term, then all of the records that match that search term in the PO Number field should show up. (Hooray!)

*If the user deleted what's in the search box, all of the data is displayed.

I'm trying to figure out why all the data isn't showing up when the component is first loaded.
LWC html
<template>
<lightning-card>

    <lightning-layout multiple-rows="true" pull-to-boundary="small">
        <lightning-layout-item padding="around-small" size="12" small-device-size="6" medium-device-size="6" large-device-size="6" class="coh-style-pre-heading">

Product Order History

        </lightning-layout-item>
        <lightning-layout-item padding="around-small" size="12" small-device-size="6" medium-device-size="6" large-device-size="6" class="slds-var-p-around_x-small">

                <lightning-input
                    label="Search Term"
                    variant="label-hidden"
                    placeholder="Search Orders by PO"
                    type="text"
                    value={searchTerm}
                    onchange={handleSearchTermChange}>

                </lightning-input>

        </lightning-layout-item>

    </lightning-layout>

        <template if:true={orders.data}>
            <lightning-layout multiple-rows="true" pull-to-boundary="small">
                <template for:each={orders.data} for:item="o">
                    <lightning-layout-item padding="around-small" key={o.Id} size="12" small-device-size="6" medium-device-size="6" large-device-size="6" class="slds-var-p-around_x-small">

                        <lightning-card>
                            {o.Order_Id__c}

PO: {o.PoNumber}

Status: {o.Order_Status__c}

Ship Date: {o.RollUp_Product_Confirm_Date__c}

Tracking Number(s): {o.Tracking_Number__c}

                        </lightning-card>

                    </lightning-layout-item>
                </template>
            </lightning-layout>
        </template>

        <template if:true={orders.error}>

                An error occurred while loading the list: {error.message}

        </template>

</lightning-card>
</template>

LWS js
import { LightningElement,track,wire } from 'lwc';

 /** CustomerOrdersController.getOrders Apex method */
 import getOrders from '@salesforce/apex/CustomerOrdersController.getOrders';
 import searchOrders from '@salesforce/apex/CustomerOrdersController.searchOrders';
export default class OrderList extends LightningElement {
@wire(getOrders) orders;
@track searchTerm;

handleSearchTermChange(event) {
    this.searchTerm = event.target.value;
    const selectedEvent = new CustomEvent('newsearch',{detail: this.searchTerm});
    this.dispatchEvent(selectedEvent);
}

@wire(searchOrders, {
    searchTerm: '$searchTerm'
}) orders;

}

Apex controller
public with sharing class CustomerOrdersController {
@AuraEnabled(Cacheable=true)
public static order[] getOrders() {

        return [
            SELECT
                Id,
                Name,
                Order_Id__c,
                PoNumber,
                Order_Status__c,
                Service_Order_Start_Date_Time__c,
                RollUp_Product_Confirm_Date__c,
                Effective_Total_All_Orders__c,
                Tracking_Number__c,
                Account.Name
            FROM Order
            WHERE Type != 'Change Order'
                AND PO_Override_by_Sales_Manager__c = False
                AND PoNumber != null
                AND (Management_Entity__r.Name = '610'
                    OR Management_Entity__r.Name = '640'
                    OR Management_Entity__r.Name = '650'
                    OR Management_Entity__r.Name = '660'
                    OR Management_Entity__r.Name = '440')
            ORDER BY RollUp_Product_Confirm_Date__c desc
            LIMIT 100
        ];
}

@AuraEnabled(cacheable=true)
public static order[] searchOrders(String searchTerm){
    if(String.isNotBlank(searchTerm)){
        String newSearchTerm = '%' + searchTerm + '%';
        return [
            SELECT
                Id,
                Name,
                Order_Id__c,
                PoNumber,
                Order_Status__c,
                Service_Order_Start_Date_Time__c,
                RollUp_Product_Confirm_Date__c,
                Effective_Total_All_Orders__c,
                Tracking_Number__c,
                Account.Name
            FROM Order
            WHERE Type != 'Change Order'
                AND PO_Override_by_Sales_Manager__c = False
                AND PoNumber != null
                AND (Management_Entity__r.Name = '610'
                    OR Management_Entity__r.Name = '640'
                    OR Management_Entity__r.Name = '650'
                    OR Management_Entity__r.Name = '660'
                    OR Management_Entity__r.Name = '440')
                AND (PoNumber LIKE :newSearchTerm)
            ORDER BY RollUp_Product_Confirm_Date__c desc
            LIMIT 100
        ];

    } else {
        return [
            SELECT
                Id,
                Name,
                Order_Id__c,
                PoNumber,
                Order_Status__c,
                Service_Order_Start_Date_Time__c,
                RollUp_Product_Confirm_Date__c,
                Effective_Total_All_Orders__c,
                Tracking_Number__c,
                Account.Name
            FROM Order
            WHERE Type != 'Change Order'
                AND PO_Override_by_Sales_Manager__c = False
                AND PoNumber != null
                AND (Management_Entity__r.Name = '610'
                    OR Management_Entity__r.Name = '640'
                    OR Management_Entity__r.Name = '650'
                    OR Management_Entity__r.Name = '660'
                    OR Management_Entity__r.Name = '440')
            ORDER BY RollUp_Product_Confirm_Date__c desc
            LIMIT 100
        ];
    }

}
}

A: You declared orders twice:
@wire(getOrders) orders;
@wire(searchOrders, {
  searchTerm: '$searchTerm'
}) orders;

You can't name the same variable twice (how would the computer know which is which?). The easy fix from here is a getter to sort the problem out:
get orders() {
  return this.searchOrderResults || this.defaultOrders;
}
@wire(getOrders) defaultOrders;
@wire(searchOrders, {
  searchTerm: '$searchTerm'
}) searchOrderResults;

You may need some additional tweaking, but this should get you started.


text:
Q: why is click handler called twice I've created a very simple jsFiddle example of a click handler being assigned to two radio buttons with:
    $(document).ready(function () {
        $(".title").on("click", function (event) {
            alert('clicked');
        });
    });

As you can see, each time a radio button is selected the handler is called twice, why?

    <input type="radio" name="heading" checked="checked" />Introduction and General Information about the Marketing Tool

    <input type="radio" name="heading" />Implementation Steps of the Marketing Tool

A: You're using the title class in both labels, which means that it is used on both radio boxes. When you click it, it fires the event on both radio boxes. You should do your work with the radio button selector:
$(document).ready(function () {
    $(":radio").on("change", function (event) {
        alert('clicked');
    });
});

demo
reference change
by click
$(document).ready(function () {
    $(":radio").on("click", function (event) {
        alert('clicked');
    });
});

demo

A: This happens because your <input> tag is inside the  tag; since clicking the label triggers a click on the radio as well, you are basically clicking the radio two times.
If you move the <input> tag out of the  tag, you should be ok.

A: Use Change Event. It will work fine.
$(document).ready(function () {
    $(".title").on("change", function (event) {
        alert('clicked');
    });
});

A: Try
$(".title input").on("click", function (event) {
  alert('clicked');
});

A: The problem is comming from  because when you click on label , radio is clicked as well and vise versa.
If you change  to
 ,this problem will be solved : DEMO HERE

    <input type="radio" name="heading" checked="checked" />Introduction and General Information about the Marketing Tool

    <input type="radio" name="heading" />Implementation Steps of the Marketing Tool

Or just try to add click event only to input like this :
$(document).ready(function () {
    $(".title input[type='radio']").on("click", function (e) {
        alert('clicked');
    });
});

A: It's to do with the scope of the title element I thing.
If you add a class to the inputs, and then bind the event to that it'll work correctly.
HTML:

    <input type="radio" class='checkbox' name="heading" checked="checked" />Introduction and General Information about the Marketing Tool

    <input type="radio" class='checkbox' name="heading" />Implementation Steps of the Marketing Tool

Script:
    $(document).ready(function (e) {
        $(".checkbox").on("click", function (event) {
            alert('clicked');
        });
    });

Fiddle

A: did some modification and it is working fine... though your code is correct here is your example
    $(document).ready(function () {
        $("input[type=radio]").on("click", function (event) {
            alert('clicked');
        });
    });

redpajama_set_name: RedPajamaStackExchange


text:
Q: Stop floating div before a specific div (universal) I am trying to make a div float and then stop before a specific div (in this case; the footer), it works on my screen, but when trying in a larger screen, the floating div is a little higher.
I want to avoid media screen for every specific screens as well.

  $window.scroll(function() {

  ws_cart = $(this).scrollTop();

  var cart_position = $('.product_desc').position();
  var footer_position = $('.footer_position').position();
  // alert('width__>'+scWidth+' height __> '+ scHeight);
  // alert(ws_cart+'<__>'+footer_position.top);
  // alert(footer_position.top-350);
  // alert(ws_cart);
  if (scWidth >= 1024 && scWidth <= 1125) {

   if (ws_cart > (cart_position.top + 65)) {
    $('.product_fixed').css({
     "position" : "fixed",
     "right" : "1.6em",
     "top" : "0px",
     "z-index" : "999",
     "background" : "#fff"
    });

   } else {
    $('.product_fixed').css({
     "position" : "relative",
     "top" : "",
     "right" : "0",
     "width" : "320px"
    });

   }

   if (ws_cart > (cart_position.top + 65)
     && ws_cart > (footer_position.top - 624)) {

    $('.product_fixed').css({
     "position" : "relative",
     "right" : "0",
     "top" : "146em",
     "height" : "600px",
     "z-index" : "999",
     "background" : "#fff"
    });
   }
  } else if (scWidth >= 1125 && scWidth <= 1199) {

   if (ws_cart > (cart_position.top + 65)) {
    $('.product_fixed').css({
     "position" : "fixed",
     "right" : "1.6em",
     "top" : "0px",
     "z-index" : "999",
     "background" : "#fff"
    });

   } else {
    $('.product_fixed').css({
     "position" : "relative",
     "top" : "",
     "right" : "0",
     "width" : "320px"
    });

   }

   if (ws_cart > (cart_position.top + 65)
     && ws_cart > (footer_position.top - 460)) {

    $('.product_fixed').css({
     "position" : "relative",
     "right" : "0",
     "top" : "90em",
     "height" : "600px",
     "z-index" : "999",
     "background" : "#fff"
    });
   }

  } else if (scWidth >= 1200 && scWidth <= 2560) {

   if (ws_cart > (cart_position.top + 65)) {
    $('.product_fixed').css({
     "position" : "fixed",
     "right" : "1.6em",
     "top" : "0px",
     "z-index" : "999",
     "background" : "#fff"
    });

   } else {
    $('.product_fixed').css({
     "position" : "relative",
     "top" : "",
     "right" : "0",
     "width" : "320px"
    });

   }

   if (ws_cart > (cart_position.top + 65)
     && ws_cart > (footer_position.top - 512)) {

    $('.product_fixed').css({
     "position" : "relative",
     "right" : "0",
     "top" : "102em",
     "height" : "520px",
     "z-index" : "999",
     "background" : "#fff"
    });
   }

  }

 });
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>


text:
Q: Automatically change between std::string and std::wstring according to unicode setting in MSVC++? I'm writing a DLL and want to be able to switch between the unicode and multibyte setting in MSVC++2010. For example, I use _T("string") and LPCTSTR and WIN32_FIND_DATA instead of the -W and -A versions and so on.
Now I want to have std::strings which change between std::string and std::wstring according to the unicode setting. Is that possible? Otherwise, this will probably end up getting extremely complicated.

A: Why not do like the Win32 API does: Use wide characters internally, and provide a character-converting facade of DoSomethingA functions which simply convert their input to Unicode.
That said, you could define a tstring type like so:
#ifdef _UNICODE
typedef std::wstring tstring;
#else
typedef std::string tstring;
#endif

or possibly:
typedef std::basic_string<TCHAR> tstring;


text:
Q: How to position a slideshow? I'm currently making my own website with the knowledge I am gaining through this course and came across a small obstacle. I do photography as a hobby and am making a website for my photography page. On the front of the page, I am trying to make a small slideshow (highlighted in the image below), however my slideshow is coming to the bottom of the page and is too big. I also included the code I wrote in HTML and CSS and was wondering if someone could guide me through to make this happen. Thank you so much for taking the time to read this!
Below is my code from my HTML file.

Not sure how to show my CSS code so it would be nice if anyone could help me out here!
.slide-container {
  width: 800px;
  height: 600px;
  margin-left: auto;
  margin-right: auto;
  overflow: hidden;
  text-align: center;
}

.image-container {
 width: 2400px;
 height: 600px;
 position: relative;
 transition: left 0.2s;
}

.slider-image {
  float: left;
  margin: 0px;
  padding: 0px;
}

.button-container {
  top: -20px;
  position: relative;
}

.slider-button {
  display: inline-block;
  height: 10px;
  width: 10px;
  border-radius: 5px;
  background-color: white;
}

#slider-image-1:target~.image-container {
  left: 0px;
}

#slider-image-2:target~.image-container {
  left: -800px;
}

#slider-image-3:target~.image-container {
  left: -1600px;
}

I wanted the position of my slideshow (currently 3 pictures but want to add at least 8) to be on the front page on the bottom left corner, which unfortunately isn't showing up and it is showing up all the way to the bottom, with the image being enlarged.


text:
Q: Longtable with landscape I need to make a table that spans several pages, likely in landscape format. The code that I have pasted below works well, but I need it to be longtable instead of table so that I can continue adding rows of information without going beyond the page dimensions. When I replace table with longtable, I get an error message:

Package array Error: Illegal pream-token (\caption): `c' used.

I should also add that I have the following in my preamble so that tables are APA formatted, and so that I can have automatically-numbered row.
\DeclareCaptionLabelSeparator*{spaced}{\\[1ex]}
\captionsetup[table]{textfont=it,format=plain,justification=justified,
  singlelinecheck=false,labelsep=spaced,skip=0pt, belowskip=-10pt}

 \preto\tabular{\setcounter{magicrownumbers}{0}}
\newcounter{magicrownumbers}
\newcommand\rownumber{\stepcounter{magicrownumbers}\arabic{magicrownumbers}.}

Below is my table. Any thoughts here? Thanks in advance!
\begin{landscape}

\begin{table}[h]
\caption{Table Caption Goes Here}
\label{table_lable}
\begin{tabular}{p{1cm} p{10.75cm} p{3.25cm} p{3.75cm}}
\toprule
No. & Header1 & Header2 & Header3 \\
\midrule
{\makebox[0.5cm][l]{1-\rownumber}} & (a) text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text  & text text text text text text  & text text text text text text  \\

& (b) text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text & text text text text text text  & text text text text text text  \\

& (c) text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text & text text text text & text text text text  \\

{\makebox[0.5cm][l]{1-\rownumber}} & (a) text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text  & text text text text & text text text text  \\

& (b) text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text  & text text text text & text text text text  \\

{\makebox[0.5cm][l]{1-\rownumber}} & text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text  & text text text text & text text text text  \\
\bottomrule
\end{tabular}
%\bigskip
%\small\textit{Note}.
\end{table}

\end{landscape}

A:
\documentclass{article}
\usepackage{longtable}
\usepackage{pdflscape}
\usepackage{booktabs}
\usepackage{caption}
\usepackage{etoolbox}
\DeclareCaptionLabelSeparator*{spaced}{\\[1ex]}
\captionsetup[table]{textfont=it,format=plain,justification=justified,
  singlelinecheck=false,labelsep=spaced,skip=0pt, belowskip=-10pt}

 \preto\tabular{\setcounter{magicrownumbers}{0}}
\newcounter{magicrownumbers}
\newcommand\rownumber{\stepcounter{magicrownumbers}\arabic{magicrownumbers}.}
\begin{document}

\begin{landscape}

\begin{longtable}{p{1cm} p{10.75cm} p{3.25cm} p{3.75cm}}
\caption{Table Caption Goes Here}
\label{table_lable}\\
\toprule
No. & Header1 & Header2 & Header3 \\
\midrule
\endfirsthead
\caption{Table Caption Goes Here - continued from previous page}
\label{table_lable}\\
\toprule
No. & Header1 & Header2 & Header3 \\
\midrule
\endhead
\bottomrule
\endfoot
{\makebox[0.5cm][l]{1-\rownumber}} & (a) text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text  & text text text text text text  & text text text text text text  \\

& (b) text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text & text text text text text text  & text text text text text text  \\

& (c) text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text & text text text text & text text text text  \\

{\makebox[0.5cm][l]{1-\rownumber}} & (a) text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text  & text text text text & text text text text  \\

& (b) text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text  & text text text text & text text text text  \\

{\makebox[0.5cm][l]{1-\rownumber}} & text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text  & text text text text & text text text text  \\

{\makebox[0.5cm][l]{1-\rownumber}} & text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text  & text text text text & text text text text  \\

{\makebox[0.5cm][l]{1-\rownumber}} & text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text  & text text text text & text text text text  \\

{\makebox[0.5cm][l]{1-\rownumber}} & text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text  & text text text text & text text text text  \\
\end{longtable}

\end{landscape}
\end{document}


text:
Q: Docker container permission denied on startup I have 2 AWS instances with percona cluster running in docker containers.
After someone rebooted one of instances I needed to repair a large amount of things. But I can't restart percona cluster on one instance (owner of swarm). I can't delete cluster and recreate it again because of files included in it. When executing docker start percona-mysql container responds with folowing:
ERRO[0001] error waiting for container: context canceled
Error response from daemon: OCI runtime create failed: container_linux.go:348: starting container process caused "chdir to cwd (\"/\") set in config.json failed: permission denied": unknown

How I can repair this issue? On second instance cluster starts as intended.


text:
Q: How do I translate this unsupported LINQ query to its native Mongo equivalent? I have this chained LINQ query which MongoDB fails to execute:
RoleCollection.AsQueryable().Where(r => r.Users.Any(id => id == user.Id))
    .Select(r => r.Name).ToArray();

This results in the following error:
Any is only support for items that serialize into documents. The current serializer is ObjectIdSerializer and must implement IBsonDocumentSerializer for participation in Any queries.

How can I translate the query into a native query which Mongo will support?

A: You should be able to replace .Any() with a combination of .Where() and a length check, like so:
RoleCollection.AsQueryable().Where(r => r.Users.Where(id => id == user.Id).Length > 0)
    .Select(r => r.Name).ToArray();

Note however that there is a performance implication here since it will pull back all of the Users with that id to do a length on it.
I'm not sure what Mongo supports (Sorry I'm answering this purely from a linq perspective), but you could also use a combination of FirstOrDefault and perform a null check in your where. That might be better since you're only ever expecting one or nothing:
RoleCollection.AsQueryable().Where(r => r.Users.FirstOrDefault(id => id == user.Id) != null)
    .Select(r => r.Name).ToArray();

A: I got the following query working, although I'm not entirely certain as to its semantics yet:
RoleCollection.Find(new QueryDocument("Users", user.Id))
            .Select(r => r.Name).ToArray();


text:
Q: @DataJpaTest doesn't read spring.jpa.* properties while @SpringBootTest does I'm using Spring Boot 2.0.4.RELEASE, and configured src/test/resources/application.yml to be
spring:
  jpa:
    show-sql: false
    hibernate:
      dialect: org.hibernate.dialect.SQLServer2012Dialect
      ddl-auto: none
      naming:
        physical-strategy: org.hibernate.boot.model.naming.PhysicalNamingStrategyStandardImpl
      properties:
        hibernate:
          generate_statistics: false
          show_sql: false

I have a very simple test:
@DataJpaTest
@AutoConfigureTestDatabase(replace = AutoConfigureTestDatabase.Replace.NONE)
@ExtendWith(SpringExtension.class)
public class MyTest {
  ...
}

The test ignores the properties (can be easily seen as it prints the hibernate statements). Putting the same properties in a application.properties file is working.
Changing the name to application-test.yml and running on profile test didn't help either.
When changing the @DataJpaTest annotation to @SpringBootTest it's working...
It's important to note that the rest of the properties (things related to my application specifically and are not with spring.* prefix are being read and used normally
I do prefer to use a yaml file (like in /src/main/resources) and rather not load a complete @SpringBootTest just for pure JPA tests... Is there anything else that I can configure for this to work?

A: It is a problem of indentation. properties has to be moved one level to the left.
spring:
  jpa:
    show-sql: false
    hibernate:
      dialect: org.hibernate.dialect.SQLServer2012Dialect
      ddl-auto: none
      naming:
        physical-strategy: org.hibernate.boot.model.naming.PhysicalNamingStrategyStandardImpl
    properties:
      hibernate:
        generate_statistics: false
        show_sql: false

But you could also try this if you use logback.xml for logging config:
<logger name="org.hibernate.stat" level="OFF"/>

A: @AutoConfigureTestDatabase(replace = AutoConfigureTestDatabase.Replace.NONE) - This causes the DataJpaTest to use the same configuration as Spring Boot Main.


text:
Q: is it possible to do 1 Advice to multiple PointCut? For ex: i want to log every behavior in a book class.
Is it possilbe to do it with Spring-AOP?

A: you can try with bellow expression in @Around, for example :
    @Pointcut("execution(* AOPviaAnnotation.Book.*(..))")
    public void allMethodOfBook() {};

    @Around("allMethodOfBook()")
    public void logBookInfo(){
     ...
    }

or try with ||
    @Pointcut("execution(* AOPviaAnnotation.Book.add(..))")
    public void addMethod() {};
    @Pointcut("execution(* AOPviaAnnotation.Book.delete(..))")
    public void deleteMethod() {};

    @Around("addMethod() || deleteMethod()")
    public void logBookInfo(){
     ...
    }


text:
Q: SpringDoc openAPI tool not scanning for APIs in Spring Boot Project I'm having trouble getting this to work. I've started with a working SpringBoot (v2.2.2) app with a working @RestController. To get springdoc to work I've included the following dependency in my pom:
 <dependency>
  <groupId>org.springdoc</groupId>
  <artifactId>springdoc-openapi-ui</artifactId>
  <version>1.2.28</version>
</dependency>

I then built and started my service. I've then browsed to the api-docs endpoint and I get:
{"openapi":"3.0.1","info":{"title":"OpenAPI definition","version":"v0"},"servers":[{"url":"http://localhost:8081","description":"Generated server url"}],"paths":{},"components":{}}

Am I missing a step? I was assuming at runtime it would scan my code, find the @RestController, find the @RequestMapping methods and generate the api from that.
As a second attempt, I decided to annotate one of my methods with swagger @Operation annotations and still things don't get picked up.
Lastly, I tried specifying the package with my Controller manually using springdoc.packagesToScan and that didn't work either.
This feels like springdoc isn't seeing my Controller.. even though spring does.. it's perfectly active and it works..
Not sure what I'm missing..
here are my project dependencies:
[INFO] +- org.springframework.boot:spring-boot-starter-web:jar:2.2.2.RELEASE:compile
[INFO] |  +- org.springframework.boot:spring-boot-starter:jar:2.2.2.RELEASE:compile
[INFO] |  |  +- org.springframework.boot:spring-boot:jar:2.2.2.RELEASE:compile
[INFO] |  |  +- org.springframework.boot:spring-boot-autoconfigure:jar:2.2.2.RELEASE:compile
[INFO] |  |  +- org.springframework.boot:spring-boot-starter-logging:jar:2.2.2.RELEASE:compile
[INFO] |  |  |  +- ch.qos.logback:logback-classic:jar:1.2.3:compile
[INFO] |  |  |  |  \- ch.qos.logback:logback-core:jar:1.2.3:compile
[INFO] |  |  |  +- org.apache.logging.log4j:log4j-to-slf4j:jar:2.12.1:compile
[INFO] |  |  |  |  \- org.apache.logging.log4j:log4j-api:jar:2.12.1:compile
[INFO] |  |  |  \- org.slf4j:jul-to-slf4j:jar:1.7.29:compile
[INFO] |  |  +- jakarta.annotation:jakarta.annotation-api:jar:1.3.5:compile
[INFO] |  |  \- org.yaml:snakeyaml:jar:1.25:compile
[INFO] |  +- org.springframework.boot:spring-boot-starter-json:jar:2.2.2.RELEASE:compile
[INFO] |  |  +- com.fasterxml.jackson.core:jackson-databind:jar:2.10.1:compile
[INFO] |  |  |  +- com.fasterxml.jackson.core:jackson-annotations:jar:2.10.1:compile
[INFO] |  |  |  \- com.fasterxml.jackson.core:jackson-core:jar:2.10.1:compile
[INFO] |  |  +- com.fasterxml.jackson.datatype:jackson-datatype-jdk8:jar:2.10.1:compile
[INFO] |  |  +- com.fasterxml.jackson.datatype:jackson-datatype-jsr310:jar:2.10.1:compile
[INFO] |  |  \- com.fasterxml.jackson.module:jackson-module-parameter-names:jar:2.10.1:compile
[INFO] |  +- org.springframework.boot:spring-boot-starter-tomcat:jar:2.2.2.RELEASE:compile
[INFO] |  |  +- org.apache.tomcat.embed:tomcat-embed-core:jar:9.0.29:compile
[INFO] |  |  +- org.apache.tomcat.embed:tomcat-embed-el:jar:9.0.29:compile
[INFO] |  |  \- org.apache.tomcat.embed:tomcat-embed-websocket:jar:9.0.29:compile
[INFO] |  +- org.springframework.boot:spring-boot-starter-validation:jar:2.2.2.RELEASE:compile
[INFO] |  |  +- jakarta.validation:jakarta.validation-api:jar:2.0.1:compile
[INFO] |  |  \- org.hibernate.validator:hibernate-validator:jar:6.0.18.Final:compile
[INFO] |  |     +- org.jboss.logging:jboss-logging:jar:3.4.1.Final:compile
[INFO] |  |     \- com.fasterxml:classmate:jar:1.5.1:compile
[INFO] |  +- org.springframework:spring-web:jar:5.2.2.RELEASE:compile
[INFO] |  |  \- org.springframework:spring-beans:jar:5.2.2.RELEASE:compile
[INFO] |  \- org.springframework:spring-webmvc:jar:5.2.2.RELEASE:compile
[INFO] |     +- org.springframework:spring-aop:jar:5.2.2.RELEASE:compile
[INFO] |     +- org.springframework:spring-context:jar:5.2.2.RELEASE:compile
[INFO] |     \- org.springframework:spring-expression:jar:5.2.2.RELEASE:compile
[INFO] +- com.google.guava:guava:jar:28.1-jre:compile
[INFO] |  +- com.google.guava:failureaccess:jar:1.0.1:compile
[INFO] |  +- com.google.guava:listenablefuture:jar:9999.0-empty-to-avoid-conflict-with-guava:compile
[INFO] |  +- com.google.code.findbugs:jsr305:jar:3.0.2:compile
[INFO] |  +- org.checkerframework:checker-qual:jar:2.8.1:compile
[INFO] |  +- com.google.errorprone:error_prone_annotations:jar:2.3.2:compile
[INFO] |  +- com.google.j2objc:j2objc-annotations:jar:1.3:compile
[INFO] |  \- org.codehaus.mojo:animal-sniffer-annotations:jar:1.18:compile
[INFO] +- org.apache.commons:commons-lang3:jar:3.9:compile
[INFO] +- org.springdoc:springdoc-openapi-ui:jar:1.2.28:compile
[INFO] |  +- org.springdoc:springdoc-openapi-webmvc-core:jar:1.2.28:compile
[INFO] |  |  \- org.springdoc:springdoc-openapi-common:jar:1.2.28:compile
[INFO] |  |     +- io.swagger.core.v3:swagger-models:jar:2.1.1:compile
[INFO] |  |     +- io.swagger.core.v3:swagger-annotations:jar:2.1.1:compile
[INFO] |  |     \- io.swagger.core.v3:swagger-integration:jar:2.1.1:compile
[INFO] |  |        \- io.swagger.core.v3:swagger-core:jar:2.1.1:compile
[INFO] |  |           +- javax.xml.bind:jaxb-api:jar:2.3.1:compile
[INFO] |  |           |  \- javax.activation:javax.activation-api:jar:1.2.0:compile
[INFO] |  |           +- com.fasterxml.jackson.dataformat:jackson-dataformat-yaml:jar:2.10.1:compile
[INFO] |  |           \- javax.validation:validation-api:jar:2.0.1.Final:compile
[INFO] |  +- org.webjars:swagger-ui:jar:3.24.3:compile
[INFO] |  \- org.webjars:webjars-locator:jar:0.38:compile
[INFO] |     \- org.webjars:webjars-locator-core:jar:0.41:compile
[INFO] |        +- io.github.classgraph:classgraph:jar:4.8.44:compile
[INFO] |        \- org.webjars.npm:angular__http:jar:2.4.10:compile
[INFO] +- org.assertj:assertj-core:jar:3.14.0:test
[INFO] \- org.springframework.boot:spring-boot-starter-test:jar:2.2.2.RELEASE:test
[INFO]    +- org.springframework.boot:spring-boot-test:jar:2.2.2.RELEASE:test
[INFO]    +- org.springframework.boot:spring-boot-test-autoconfigure:jar:2.2.2.RELEASE:test
[INFO]    +- com.jayway.jsonpath:json-path:jar:2.4.0:test
[INFO]    |  +- net.minidev:json-smart:jar:2.3:test
[INFO]    |  |  \- net.minidev:accessors-smart:jar:1.2:test
[INFO]    |  |     \- org.ow2.asm:asm:jar:5.0.4:test
[INFO]    |  \- org.slf4j:slf4j-api:jar:1.7.29:compile
[INFO]    +- jakarta.xml.bind:jakarta.xml.bind-api:jar:2.3.2:test
[INFO]    |  \- jakarta.activation:jakarta.activation-api:jar:1.2.1:test
[INFO]    +- org.junit.jupiter:junit-jupiter:jar:5.5.2:test
[INFO]    |  +- org.junit.jupiter:junit-jupiter-api:jar:5.5.2:test
[INFO]    |  |  +- org.opentest4j:opentest4j:jar:1.2.0:test
[INFO]    |  |  \- org.junit.platform:junit-platform-commons:jar:1.5.2:test
[INFO]    |  +- org.junit.jupiter:junit-jupiter-params:jar:5.5.2:test
[INFO]    |  \- org.junit.jupiter:junit-jupiter-engine:jar:5.5.2:test
[INFO]    +- org.junit.vintage:junit-vintage-engine:jar:5.5.2:test
[INFO]    |  +- org.apiguardian:apiguardian-api:jar:1.1.0:test
[INFO]    |  +- org.junit.platform:junit-platform-engine:jar:1.5.2:test
[INFO]    |  \- junit:junit:jar:4.12:test
[INFO]    +- org.mockito:mockito-junit-jupiter:jar:3.1.0:test
[INFO]    +- org.hamcrest:hamcrest:jar:2.1:test
[INFO]    +- org.mockito:mockito-core:jar:3.1.0:test
[INFO]    |  +- net.bytebuddy:byte-buddy:jar:1.10.4:test
[INFO]    |  +- net.bytebuddy:byte-buddy-agent:jar:1.10.4:test
[INFO]    |  \- org.objenesis:objenesis:jar:2.6:test
[INFO]    +- org.skyscreamer:jsonassert:jar:1.5.0:test
[INFO]    |  \- com.vaadin.external.google:android-json:jar:0.0.20131108.vaadin1:test
[INFO]    +- org.springframework:spring-core:jar:5.2.2.RELEASE:compile
[INFO]    |  \- org.springframework:spring-jcl:jar:5.2.2.RELEASE:compile
[INFO]    +- org.springframework:spring-test:jar:5.2.2.RELEASE:test
[INFO]    \- org.xmlunit:xmlunit-core:jar:2.6.3:test

here is the tree of my project.. it's a standard spring boot structure.. The Controller is under the web dir/package
.
├── java
│   └── com
│       └── neodem
│           └── orl
│               ├── collections
│               ├── config
│               ├── engine
│               │   ├── core
│               │   │   ├── actions
│               │   │   └── model
│               │   └── original
│               │       ├── actions
│               │       └── model
│               ├── service
│               └── web
└── resources

A: That resolved it for me. It did not recognize @Controller.
It found every API after using @RestController instead.
Paths for the UI are (assuming port 8080):
http://localhost:8080/swagger-ui/index.html
http://localhost:8080/v3/api-docs
http://localhost:8080/v3/api-docs.yaml

A: It's because you're using springdoc-openapi-ui, it uses when you want to integrate springdoc-openapi with Swagger UI, so for check the results you should first add and enable Swagger UI then check the swagger link. like: http://localhost:8080/swagger-ui.html.
If you don't want swagger you must use springdoc-openapi-core instead of springdoc-openapi-ui.
In summary

Solution 1

*

*Add and Enable Swagger UI

*Check the Swagger Url ({server-address}:{port}/swagger-ui.html.)

Solution 2

*

*Change dependency from springdoc-openapi-ui to springdoc-openapi-core
Your dependency must like below snippet:
<dependency>
    <groupId>org.springdoc</groupId>
    <artifactId>springdoc-openapi-core</artifactId>
    <version>1.1.44</version>
</dependency>

Solution 3

List the packages to include in the documentation by config
#Packages to include
springdoc.packagesToScan=com.neodem.orl.web

Also
This link might be useful. (Documenting a Spring REST API Using springdoc-openapi)

A: I have found the solution in my case, and posted a the springdoc git Issue (https://github.com/springdoc/springdoc-openapi/issues/378). It reads (in part):
when defining a REST Controller, spring allows you to declare @RequestMapping(value = "/init") with no explicit Method and will accept a POST request. However, in your OpenApiResource class you make a call to calculatePath, in there (on line 129) you make a call to the spring RequestMappingInfo.getMethodsCondition() and in my case you get back no results (since the method wasn't explicitly defined in the annotation).. thus no request method => no path calculated.
If I explicitly define the method: @RequestMapping(value = "/init", method = RequestMethod.POST) everything works as expected.
so the solution is to explicitly declare the Method in the @RequestMapping

A: I faced same problem when i try to develop in Spring Boot 3 env. Swagger-UI and docs not working without any message and log. Then I investigate and find this solution. I must migrate Swagger UI 2.0 new version for Spring Boot 3.
Docs:
https://springdoc.org/v2
New Dependency:
   <dependency>
      <groupId>org.springdoc</groupId>
      <artifactId>springdoc-openapi-starter-webmvc-ui</artifactId>
      <version>2.0.0</version>
   </dependency>

And Also document say: For the integration between spring-boot and swagger-ui, add the library to the list of your project dependencies (No additional configuration is needed)
Note: If you need to use native image usage then use this properties:
springdoc.enable-native-support=true

A: Just to add that I had the same issue and solved by replacing @Controller by @RestController.

A: It is:
Instead of:

@GetMapping(BookConfig.BOOK_ENDPOINT)

You must do:

@RequestMapping(value = BookConfig.BOOK_ENDPOINT, method = RequestMethod.GET)

This was a major pain to discover the root cause. OpenAPI needs to enhance its framework to support Spring's latest annotation version. It has actually been there for quite some time, already.
Less typing is the way to go.

A: Fix paths-to-match to scan APIs as follows:
springdoc:
  swagger-ui.path: swagger-ui
  api-docs.path: /booking
  paths-to-match: /booking/v1/**  >>>> (/booking/v1)is the prefix path of rest apis defined in controller

A: Regarding the error springdoc openapi No operations defined in spec!, I got this issue. The reason in my case is during refactoring the code I changed the controller's package but I have not updated the Swagger Configuration that I defined. When I gave the correct controller in .packagesToScan(.......) in GroupedOpenApi.builder()..... the swagger ui started showing the endpoints :)

A: I had similar issue and I solved putting my main class in the root of my package
.
├── java
│   └── com
│       └── neodem
│           └── orl
│               ├── collections
│               ├── config
│               ├── engine
│               │   ├── core
│               │   │   ├── actions
│               │   │   └── model
│               │   └── original
│               │       ├── actions
│               │       └── model
│               ├── service
│               └── web
│               └── MainApp.java <- this is important
└── resources


text:
Q: Routing in Neo4j for OSM PointOfInterest 1.I have downloaded OSM file for one city and imported data to Neo4j via https://github.com/neo4j-contrib/osm
2.Followed README, I have added distance,Intersection, ROUTE relationship, PointOfInterest.
3.However, The ROUTE relationship is bidirectional, not sure if this is the cause of leading routing algorithm failed or not.
FYI,my script of above steps

*

*Calculate distances

'MATCH
(awn:OSMWayNode)-[r:NEXT]-(bwn:OSMWayNode)
WHERE NOT exists(r.distance)
RETURN awn,bwn,r',
'MATCH
(awn)-[:NODE]->(a:OSMNode),
(bwn)-[:NODE]->(b:OSMNode)
SET r.distance=round(distance(a.location,b.location))',
{batchSize:10000,parallel:false});

2.Decide what is  intersection
'MATCH(n:OSMNode)
WHERE size((n)<-[:NODE]-())>2
AND NOT (n:Intersection)
RETURN n',
'MATCH
(n)<-[:NODE]-(wn:OSMWayNode),(wn)<-[:NEXT*]-(wx),
(wx)<-[:FIRST_NODE]-(w:OSMWay)-[:TAGS]->(wt:OSMTags)
WHERE exists(wt.highway)

SET n:Intersection',
{batchSize:10000,parallel:false});

3.Connect decision points(Intersections) with new distance relationship
'MATCH(x:Intersection)
CALL spatial.osm.routeIntersection(x,false,false,false)
YIELD fromNode,toNode,distance,fromRel,toRel
RETURN fromNode,toNode,distance,fromRel,toRel',
'MERGE (fromNode)-[r:ROUTE {fromRel:id(fromRel),toRel:id(toRel)}]->(toNode)
ON CREATE SET r.distance=round(distance)',
{batchSize:10000,parallel:false});

4.Create Point Of Interest, follow same way I created another 3 point of interest for location :{longitude:103.835553,latitude:1.3045739},{longitude:103.78152251,latitude:1.28357103},{longitude:103.8604644,latitude:1.305788741}
MATCH(n:OSMNode)
WHERE
distance(n.location,point({longitude:103.8958005,latitude:1.330945169})
)<100 AND (n)-[:ROUTE]->() and NOT n:PointOfInterest
WITH n,n.location as poi LIMIT 1
MATCH(m:OSMNode)
WHERE distance(poi,m.location)<100
WITH n,m
MATCH(m)<-[:NODE]-(wn:OSMWayNode),
(wn)<-[:NEXT*]-(wx),
(wx)<-[:FIRST_NODE]-(w:OSMWay)
WITH n,w
WITH n,COLLECT(w) AS ways
CALL spatial.osm.routePointOfInterest(n,ways) YIELD node
SET n:PointOfInterest,n.name="AAA"
RETURN count(node)

Question:
I want to use gds.alpha.spanningTree.minimum.write to get the minimum effort from Point AAA to all the others PointOfInterest, namely BBB,CCC,DDD
CALL gds.alpha.spanningTree.minimum.write({
  nodeProjection: 'PointOfInterest',
  relationshipProjection: {
    ROUTE: {
      type: 'ROUTE',
      properties: 'distance',
      orientation: 'UNDIRECTED'
    },
    startNodeId: id(n),
    relationshipWeightProperty: 'distance',
    writeProperty: 'MINST',
    weightWriteProperty: 'writeCost'
  }
})
YIELD createMillis, computeMillis, writeMillis, effectiveNodeCount
RETURN createMillis, computeMillis, writeMillis, effectiveNodeCount;

But I'm always having error
Failed to invoke procedure `gds.alpha.spanningTree.minimum.write`: Caused by: java.lang.IllegalArgumentException: Cannot construct a relationship filter out of a java.lang.Long

Is it possible to achieve my purpose using above way?If yes, is there anything wrong with my cypher?

A: With respect to your error, some of documented examples are unfortunately wrong. It looks like you were trying to follow one of the buggy examples.
The relationshipProjection should only contain ROUTE, and no other properties.
Try this:
CALL gds.alpha.spanningTree.minimum.write({
  nodeProjection: 'PointOfInterest',
  relationshipProjection: {
    ROUTE: {
      type: 'ROUTE',
      properties: 'distance',
      orientation: 'UNDIRECTED'
    }
  },
  startNodeId: id(n),
  relationshipWeightProperty: 'distance',
  writeProperty: 'MINST',
  weightWriteProperty: 'writeCost'
})
YIELD createMillis, computeMillis, writeMillis, effectiveNodeCount
RETURN createMillis, computeMillis, writeMillis, effectiveNodeCount;

I have created an issue for the documentation problems.


text:
Q: Editor de fotografías Estoy haciendo un app en Android, que al tomar una foto la guarde en una resolución predefinida, por ejemplo 300X400, el problema es que no logro configurar la cámara para poder realizar dicha función, alguna idea de como lo puedo hacer?
Estoy utilizando la cámara nativa de Android y este es el código que uso para llamar a la cámara:
  private void openCamera() {
         try {
             File file = new File(Environment.getExternalStorageDirectory(), MEDIA_DIRECTORY);
             boolean isDirectoryCreated = file.exists();
             if (!isDirectoryCreated)
                 isDirectoryCreated = file.mkdirs();
             if (isDirectoryCreated) {
                 Long timestamp = System.currentTimeMillis() / 10000;
                imageName = timestamp.toString() + ".jpg";
                 mPath = Environment.getExternalStorageDirectory() + File.separator + MEDIA_DIRECTORY
                         + File.separator + imageName;
                 File newFile = new File(mPath);
                 Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
                 intent.putExtra(MediaStore.EXTRA_OUTPUT, Uri.fromFile(newFile));
                 startActivityForResult(intent, PHOTO_CODE);
             }
         } catch (Exception e) {
             e.printStackTrace();
         }
     }

A: Si realizas un  startActivityForResult(intent, PHOTO_CODE) dentro de onActivityResult() al obtener la imagen puedes realizar el cambio de tamaño:
protected void onActivityResult(int requestCode, int resultCode, Intent data){
    //Obtiene el bundle.
    Bundle extras = data.getExtras();
    //Obtiene la imagen.
    Bitmap imageBitmap = (Bitmap) extras.get("data");

    //Crea imagen escalada 300 x 400.
    imageBitmap = Bitmap.createScaledBitmap(imageBitmap , 300, 400, false);
    ByteArrayOutputStream bytes = new ByteArrayOutputStream();
    imageBitmap.compress(Bitmap.CompressFormat.JPEG, 80, bytes);

    File f = new File(Environment.getExternalStorageDirectory()
        + File.separator + "myimagen.jpg");
    f.createNewFile();
    FileOutputStream fo = new FileOutputStream(f);
    fo.write(bytes.toByteArray());
    fo.close();

}

A: Intenta con un Intent como este:
Intent photoPickerIntent = new Intent(
                        Intent.ACTION_PICK,
                        android.provider.MediaStore.Images.Media.EXTERNAL_CONTENT_URI);
                photoPickerIntent.setType("image/*");
                photoPickerIntent.putExtra("crop", "true");
                photoPickerIntent.putExtra("outputX", 300);
                photoPickerIntent.putExtra("outputY", 400);
                photoPickerIntent.putExtra("aspectX", 1);
                photoPickerIntent.putExtra("aspectY", 1);
                photoPickerIntent.putExtra("scale", true);
                photoPickerIntent.putExtra(MediaStore.EXTRA_OUTPUT, getTempUri());
                photoPickerIntent.putExtra("outputFormat",
                        Bitmap.CompressFormat.JPEG.toString());
                startActivityForResult(photoPickerIntent, RESULT_LOAD_IMAGE);


text:
Q: Reducing words in a set of relators I have a set of relators $[r_1, r_2, r_3, r_4]$ of a free group on two generators $a$ and $b$, where $\begin{cases} r_1 = a^{2p} \text{  (where $p$ is some positive integer) } \\ r_2 = b^4 \\ t_3 = (ab)^2,\\ r_4 = (ab^{-1})^2 \end{cases}$
how one can express words like $w = a^{-2}ba^2b^{-1}$ that  lie in the group generated by the $r_i$ as words formed by the $r_i$. What I tried was to take a $r$ that is an $r_i$ up to a certain power or up to a cyclic rotation of its generators (in this example $ba$ or $ba^{-1}$) and make the product $wr$ such that there are less generators in the original word. I don't know if this method always works as I'm afraid that the resulting words will become bigger and bigger. Is there an specific method that always gives a result?

A: This is in general a hard problem. You might want to read up on Dehn's algorithm (which is a bit like what you hope for, but requires special circumstances):
https://en.wikipedia.org/wiki/Small_cancellation_theory


text:
Q: EC2 instance refused to connect I have a site built on NodeJS, which I am currently trying to deploy on the free tier on AWS.
So far I have created an instance, launched it, I can connect via SSH (console) to my instance, and have successfully pulled my files from my Git repository. However, when I try to browse my public DNS, I get: http://ec2-13-234-136-30.ap-south-1.compute.amazonaws.com:2222 took too long to respond.
I have also had a look at the settings on security group (as recommended on a different post) and ensured that inbound and outbound 'HTTP' and 'HTTPS' traffic are allowed (screenshot below):
Inbound settings: Inbound settings

Outbound settings: enter image description here
Any ideas on what else could be causing this issue? I would greatly appreciate your help. Thanks.

A: Your security configuration is too permissive, please limit to the port and protocols you are using.
Given that your firewall is off, which you should definitely check to confirm,
I guess you start NodeJs server binding to hostname 127.0.0.1, which allows only local traffics from EC2 instance.
Try changing it to 0.0.0.0, which allows public traffic and see if that solves your problem.


text:
Q: How do I delete a Kafka Consumer Group to reset offsets? I want to delete a Kakfa consumer group so that when the application creates a consumer and subscribes to a topic it can start at the beginning of the topic data.
This is with a single node development vm using the current latest Confluent Platform 3.1.2 which uses Kafka 0.10.1.1.
I try the normal syntax:
sudo /usr/bin/kafka-consumer-groups --new-consumer --bootstrap-server localhost:9092 --delete --group my_consumer_group

I get the error:
Option [delete] is only valid with [zookeeper]. Note that there's no need to delete group metadata for the new consumer as the group is deleted when the last committed offset for that group expires.

If I try the zookeeper variant:
sudo /usr/bin/kafka-consumer-groups --zookeeper localhost:2181 --delete --group my_consumer_group

I get:
Delete for group my_consumer_group failed because group does not exist.

If I list using the "old" consumer, I do not see my consumer group (or any other consumer groups)
sudo /usr/bin/kafka-consumer-groups --zookeeper localhost:2181 --list

If I list using the "new" consumer, I can see my consumer group but apparently I can't delete it:
sudo /usr/bin/kafka-consumer-groups --new-consumer --bootstrap-server localhost:9092 --list

A: In Kafka 0.11 (or Confluent 3.3) you can reset the offsets of any existing consumer group without having to delete the topic. In fact you can change the offsets to any absolute offset value or timestamp or any relative position as well.
These new functions are all added with the new --reset-offsets flag on the kafka-consumer-groups command line tool.
See KIP-122 details here https://cwiki.apache.org/confluence/display/KAFKA/KIP-122%3A+Add+Reset+Consumer+Group+Offsets+tooling

A: Upgrading to the just released Confluent Platform 3.2 with Kafka 0.10.2 solved my underlying issue. When I delete a topic, offset information is now correctly reset. So when I create a topic with the same name, consumers start from the beginning of the new data.
I still can't delete new style consumer groups with the kafka-consumer-groups tool, but my underlying issue is solved.
Before Kafka 0.10.2, there were hacks, but no clean solution to this issue.

A: If you use Java client, you can first get the beginning offset.
TopicPartition partition = new TopicPartition("YOUR_TOPIC", YOUR_PARTITION);
Map<TopicPartition, Long> map = consumer.beginningOffsets(Collections.singleton(partition));

And the offset that consumer using to start processing, (if not delete the consumer group).
Long committedOffset = consumer.committed(partition).offset();

Now, if you think start from committedOffset is ok, just poll records.
if you want the beginning offset,
    consumer.seek(partition, map.get(partition));

A: This can be done with Kafka 1.1.x. From the documentation:
bin/kafka-consumer-groups.sh --bootstrap-server localhost:9092 --delete --group my-group --group my-other-group

A: you can also reset the offset of single topic without deleting the entire consumer group :
bin/kafka-consumer-groups.sh --bootstrap-server localhost:9092 --group my-group --topic my-topic --reset-offsets --to-earliest --execute

A: If you're using Windows and you need a JAAS config with password & username to access your kafka cluster, you can use the following commands
#consumer.properties
sasl.jaas.config=org.apache.kafka.common.security.plain.PlainLoginModule required username="XXXXXXXXXXXXXXX" password="XXXXXXXXXXXXXXXXXXX";
security.protocol=SASL_SSL
sasl.mechanism=PLAIN

.\kafka\bin\windows\kafka-consumer-groups.bat --bootstrap-server xxxxxxxxxx.confluent.cloud:9092 --group cop-group --topic topic_name_ini --reset-offsets --to-earliest --execute --command-config .\kafka\config\consumer.properties

In the command above we used --command-config to pass a properties file for the JAAS config


text:
Q: What does "that" mean at the beginning of a sentence? "That which is certain is of no interest."
Above sentence starts with a "that", which I am curious about the meaning it adds. Would anybody please explain it?

A: The function of 'That' in your sentence is to refer to any thing that your sentence could apply to. So if I say 'That which doesn't kill me only makes me stronger' means 'Whatever doesn't kill me, makes me stronger'.
You could even write the same as 'Anything which is certain is of no interest'.

A: It means Anything which is certain is of no interest. I.e. if something is certain then it is necessarily of no interest.
The construction that which ... (meaning anything which ...) has a slightly old-fashioned ring to it, although it's by no means obsolete. It's usually found it stock phrases, e.g.:
That which doesn't kill us makes us stronger.
In certain circumstances, you could replace that which with what, e.g.
What doesn't kill us makes us stronger.


text:
Q: Automatic column text wrapping in html Is there any way to text wrapping into two or more columns in HTML only with CSS?
I have continous text with p tags only like this:

Lorem ipsum dolor sit amet, ...

Nulla ullamcorper diam arcu, ...

In libero diam, facilisis quis urna nec, ...

Sed varius et mi quis dictum. ...

I wan to wrap this text into two columns at 50% of the text, like in Microsoft Word or LibreOffice, etc.
It is possible?

A: See the "column" rule:
http://www.w3schools.com/css/css3_multiple_columns.asp
As you can see, it's a CSS3 rule, and so you might not find browser support as complete as you'd like..
MDN:
https://developer.mozilla.org/en-US/docs/Web/Guide/CSS/Using_multi-column_layouts
Breakdown of browser support:
http://caniuse.com/#feat=multicolumn
More reading, examples etc:
http://css-tricks.com/guide-responsive-friendly-css-columns/
(fairly comprehensive)

A: Multi-column layout in CSS with the columns property and related properties is rather well supported in modern browsers. At the very simplest, you would set just columns: 2 on the div element. In practice, you additionally need vendor prefixed versions for reasonable browser coverage:

#needtowrap {
  -webkit-columns: 2;
  -moz-columns: 2;
  columns: 2;
}
#needtowrap p {
  margin: 0;
}
#needtowrap p + p {
  text-indent: 1em;
}

Lorem ipsum dolor sit amet, ...
  Well we need some real content too.
  Otherwise this looks rather dull.

Nulla ullamcorper diam arcu, ...
  And some more text to make this look like a paragragh.

In libero diam, facilisis quis urna nec, ...
  By the way, fake Latin is not good fill text.
  It behaves differently from the texts you will really use.

Sed varius et mi quis dictum. ...
  But I digress.

The example uses "literary paragraph" formatting: instead of default vertical spacing between paragraphs, the first line of each paragraph except the first one is indented a bit. In multi-column rendering, this works much better than the default p formatting (which reflects defaults of office automation software rather than typographic traditions).
There are many other things to consider. As a rule, multi-column text usually looks much better when justified on both sides. This in turn makes hyphenation more or less a necessity.


text:
Q: Change size of QGroupBox I like to change QGroupBox size.
Two QGroupBox (horizontalGroupBox, gridGroupBox) are in GUI.
I like to have horizontalGroupBox size is according to the widget inside and the rest is taken by gridGroupBox.
Now is taking the space half by half.
How to set  horizontalGroupBox size to be fitting the widget inside?
My code is below.
        horizontalGroupBox = QGroupBox('Controllers')
        horizontalGroupBox.setGeometry(100,100,200,200)
        gridGroupBox = QGroupBox('Camera displays')
        mainLayout = QVBoxLayout()
        mainLayout.addWidget(horizontalGroupBox)
        mainLayout.addWidget(gridGroupBox);
        layout = QHBoxLayout();
        self.button1 = QPushButton("RUN APP", self)
        self.button1.setStyleSheet("background-color : aqua")
        self.button1.clicked.connect(self.start_thread)
        self.button1.setGeometry(200, 150, 100, 40)
        layout.addWidget (self.button1);
        self.button2 = QPushButton("STOP", self)
        self.button2.setStyleSheet("background-color : lightblue")
        self.button2.clicked.connect(self.stopexecution)
        self.button2.setEnabled(False);
        layout.addWidget (self.button2);
        self.button3 = QPushButton("TEST VIDEOS", self)
        self.button3.setStyleSheet("background-color : royalblue")
        self.button3.clicked.connect(self.start_videotest_thread)
        layout.addWidget (self.button3);
        self.button4 = QPushButton("STOP VIDEOS", self)
        self.button4.setStyleSheet("background-color : lightblue")
        self.button4.clicked.connect(self.videotest_stopexecution)
        self.button4.setEnabled(False)
        layout.addWidget (self.button4);
        horizontalGroupBox.setLayout(layout);
        glayout = QGridLayout();
        self.videoList = {}
        if(self.num_soures < 4):
           self.videoList[f"video_0"] = QLabel(f"video_0")
           self.videoList[f"video_0"].setStyleSheet("background-color: mintcream")
           glayout.addWidget(self.videoList[f"video_0"], 0, 1)
           self.videoList[f"video_1"] = QLabel(f"video_1")
           self.videoList[f"video_1"].setStyleSheet("background-color: mintcream")
           glayout.addWidget(self.videoList[f"video_1"], 1, 0)
           self.videoList[f"video_2"] = QLabel(f"video_2")
           self.videoList[f"video_2"].setStyleSheet("background-color: mintcream")
           glayout.addWidget(self.videoList[f"video_2"], 1, 1)

        elif(self.num_soures >= 4):
           self.num_plots_ver = self.num_plots_ver + 1
           k = 0
           for i in range(self.num_plots_ver):
              if(i <= 0):
                 for j in range(1, self.num_plots_hor, 1):
                    self.videoList[f"video_{k}"] = QLabel(f"video_{k}")
                    self.videoList[f"video_{k}"].setStyleSheet("background-color: mintcream")
                    glayout.addWidget(self.videoList[f"video_{k}"], i, j)
                    k = k+1
              elif(i > 0 and i < self.num_plots_ver-1):
                 for j in range(self.num_plots_hor):
                    self.videoList[f"video_{k}"] = QLabel(f"video_{k}")
                    self.videoList[f"video_{k}"].setStyleSheet("background-color: mintcream")
                    glayout.addWidget(self.videoList[f"video_{k}"], i, j)
                    k = k+1
              elif(i >= self.num_plots_ver-1):
                 for j in range(self.num_remainder):
                    self.videoList[f"video_{k}"] = QLabel(f"video_{k}")
                    self.videoList[f"video_{k}"].setStyleSheet("background-color: mintcream")
                    glayout.addWidget(self.videoList[f"video_{k}"], i, j)
                    k = k+1
        gridGroupBox.setLayout(glayout);
        self.setLayout(mainLayout)


text:
Q: jQuery accordion expanded I am trying to create an accordion with jQuery from this example
http://docs.jquery.com/UI/Accordion
The markup is the same, i.e.

First header

First content

Second header

Second content

And I have script file enqueued correctly, which has the following content:
$ = jQuery;
$(document).ready(function() {
   $("#accordion").accordion();
});

But I get this error in the console output
TypeError: 'undefined' is not a function (evaluating '$("#accordion").accordion()')

The result being all divs are expanded, i.e not clickable.

A: Is this what you are looking for :  http://jsfiddle.net/epinapala/faEg9/
Your dependent js files are not present I suppose!
 <link href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/themes/base/jquery-ui.css" rel="stylesheet" type="text/css"/>

First header

First content

Second header

Second content

  $(document).ready(function() {
    $("#accordion").accordion();
  });

A: Try using this:
//$ = jQuery;
jQuery(document).ready(function() {
     $("#accordion").accordion();
});


text:
Q: Entity Framework 1-to-1 relationship with ASP.NET Boilerplate How to set 1:1 relationship with the below-mentioned models when we use ASP.NET Boilerplate? Thanks in advance.
Note 1: I have seen this nice answer about the EF 1-to-1 relationship. But unfortunately, I don't know how to set it with ASP.NET Boilerplate because PK is automatically set by ABP. In my scenario, both tables have int PK.
Note 2: Here, the Property and Address models have 1:1 relationship.
Property model:
[Table("IpProperties")]
public class Property : FullAuditedEntity
{
    public virtual bool Vacant { get; set; }

    public virtual Address Address { get; set; }
}

Address model:
[Table("IpAddresses")]
public class Address : FullAuditedEntity
{
    [Required]
    [MaxLength(MaxLength)]
    public virtual string StreetNumber { get; set; }

    public virtual Property Property { get; set; }
}

A: Relationship mapping should be done in the OnModelCreating method of your DbContext. Your DbContext class will be in the EntityFramework project under the EntityFramework folder.
You can use something like the following:
protected override void OnModelCreating(DbModelBuilder modelBuilder)
{
    base.OnModelCreating(modelBuilder);
    modelBuilder.Entity<Property>().HasRequired(e => e.Address).WithOptional(e => e.Property);
}

If the Property property of the Address should not be null, the .WithOptional() method can be replaced with WithRequiredDependent() or WithRequiredPrincipal(), depending on the use case.
Another Solution :
ABP forum - REFERENTIAL INTEGRITY ISSUE - ONE TO ONE RELATIONSHIP

A: You will not find an HasOptional equivalent method in EF7. By convention if your FK property is nullable, you navigation property will be treated as optional
 modelBuilder.Entity<Blog>()
                .HasOne(p => p.Document)
                .WithOne(i => i.CancelNote)
                .HasForeignKey<Document>(b => b.CancelNoteForeignKey);

About your second question,EF Core (EF7) doesn't support Lazy Loading. In this link you will find the options you have now to load related entities
PS: please use your own entity names.


text:
Q: Consistency checking with 2 arrays issue When consistency checking between 2 arrays, what is needed so that the position immediately following an anomaly is not skipped. Could someone post a loop that iterates over 2 arrays and prints whether or not values match?
$arr1 = array('apple', 'pear', 'banana', 'orange', 'melon', 'kiwi');
$arr2 = array('apple', 'pear', 'banana', 'melon', 'kiwi');
$count = 0; //keeps track of position to be checked in arrays.

The loop should print true, true, true, false, true, true in this case. It should be noted that when an anomaly is found, that value is removed so future values are checked with the position normalized to account for the removed erroneous value. I have tried using unset() followed by array_values() but the next value is always skipped. It's an off-by-one nightmare for me. Any ideas?
$count = 0;
$lines = file("url");
foreach($lines as $line_num => $line){
    if(strcmp(sub($line, 0, 3), 'gis') == 0){
        $site = sub($line, 3, 7); //get latitude eg. gis4021
        if($site != $sites[$count]){
            //deal with case where $site does not equal expected value in base array
        }
        else//$sites equals expected value in array
            $count++;
    }
}

A: This works but obviously you'd need to add some kind of error checking, e.g. to see if $arr2 is not longer than $arr1:

$arr1 = array('apple', 'pear', 'banana', 'orange', 'melon', 'kiwi');
$arr2 = array('apple', 'pear', 'banana', 'melon', 'kiwi');

$count = count($arr1);
for ($i = 0, $j = 0; $i < $count; $i++) {
    if ($arr1[$i] == $arr2[$j]) {
        $j++;
        print 'true ';
        continue;
    }

    print 'false ';
}

The code outputs true true true false true true.
As you can see it iterates through ALL entries of $arr1 as $i always gets incremented, however, $j, which is the iterator for $arr2 only gets incremented if a matching value is found.


text:
Q: How do I resize my containers to remove overflow in flutter? I'm very new at coding with flutter and looking for help on something I am doing for school. My issue is that our instructor wants us to have padding on each side of our columns (10px) while also keeping our containers 1,2,3,4,5,6 width & height to 100px. What I am wondering is if there is anyway that I can resize my containers to fit inside my view without changing their width and height specified. This is the code I have and am open to any help I can get.
import 'package:flutter/material.dart';

void main() {
  runApp(MyApp());
}

class MyApp extends StatelessWidget {
  // This widget is the root of your application.
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Flutter App01 Lucas Holmes',
      theme: ThemeData(
        // This is the theme of your application.
        //
        // Try running your application with "flutter run". You'll see the
        // application has a blue toolbar. Then, without quitting the app, try
        // changing the primarySwatch below to Colors.green and then invoke
        // "hot reload" (press "r" in the console where you ran "flutter run",
        // or simply save your changes to "hot reload" in a Flutter IDE).
        // Notice that the counter didn't reset back to zero; the application
        // is not restarted.
        primarySwatch: Colors.blue,
        // This makes the visual density adapt to the platform that you run
        // the app on. For desktop platforms, the controls will be smaller and
        // closer together (more dense) than on mobile platforms.
        visualDensity: VisualDensity.adaptivePlatformDensity,
      ),
      home: MyHomePage(title: 'Row and Column Widgets'),
    );
  }
}

class MyHomePage extends StatefulWidget {
  MyHomePage({Key key, this.title}) : super(key: key);

  // This widget is the home page of your application. It is stateful, meaning
  // that it has a State object (defined below) that contains fields that affect
  // how it looks.

  // This class is the configuration for the state. It holds the values (in this
  // case the title) provided by the parent (in this case the App widget) and
  // used by the build method of the State. Fields in a Widget subclass are
  // always marked "final".

  final String title;

  @override
  _MyHomePageState createState() => _MyHomePageState();
}

class _MyHomePageState extends State<MyHomePage> {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
        appBar: AppBar(
          title: Text(widget.title),
        ),
        backgroundColor: Colors.blueGrey,
        body: Container(
            child: Padding(
          padding: EdgeInsets.only(left: 10, right: 10),
          child: Row(
            children: [
              Padding(
                  padding: EdgeInsets.only(left: 10, right: 10),
                  child: Column(
                    children: [
                      Container(
                        height: 100,
                        width: 100,
                        child: Center(
                            child: Text("Container 1",
                                textAlign: TextAlign.center)),
                        decoration: BoxDecoration(
                            color: Colors.orange,
                            border: Border.all(color: Colors.black, width: 3)),
                      ),
                      Transform.rotate(
                          angle: .8,
                          child: Container(
                            height: 100,
                            width: 100,
                            child: Center(
                                child: Text("Container 2",
                                    textAlign: TextAlign.center)),
                            color: Colors.white,
                          )),
                    ],
                  )),
              Padding(
                  padding: EdgeInsets.only(left: 10, right: 10),
                  child: Column(
                    children: [
                      new Expanded(
                          child: Container(
                              height: 100,
                              width: 100,
                              child: new Align(
                                  alignment: Alignment.bottomCenter,
                                  child: Text("Container 3",
                                      textAlign: TextAlign.center)),
                              color: Colors.yellow,
                              margin:
                                  const EdgeInsets.only(top: 10, bottom: 10))),
                      new Expanded(
                          child: Container(
                              height: 100,
                              width: 100,
                              child: new Align(
                                  alignment: Alignment.centerRight,
                                  child: Text("Container 4")),
                              color: Colors.lightBlue,
                              margin:
                                  const EdgeInsets.only(bottom: 10, top: 10)))
                    ],
                  )),
              Padding(
                  padding: EdgeInsets.only(left: 10, right: 10),
                  child: Column(children: [
                    Container(
                      height: 100,
                      width: 100,
                      margin: EdgeInsets.only(top: 140),
                      child: Center(
                          child: Text("Container 5",
                              textAlign: TextAlign.center,
                              style: TextStyle(color: Colors.white))),
                      decoration: BoxDecoration(
                          color: Colors.black,
                          border: Border.all(color: Colors.white, width: 3),
                          borderRadius: BorderRadius.circular(100)),
                    ),
                    new Expanded(
                        child: Container(
                      height: 100,
                      width: 100,
                      margin: EdgeInsets.only(top: 160, right: 0, left: 0),
                      child: Text(
                        "Con 6",
                        style: TextStyle(fontSize: 30),
                        textAlign: TextAlign.start,
                      ),
                      color: Colors.red,
                    ))
                  ]))
            ],
          ),
        )));
  }
}

This is what it is supposed to look like
This is the issue I'm running into
I was trying to see if I could get flexible to work but I wasn't able to get it to work properly. Sorry if my code is awful. I just started today lol. Our teacher said it is okay for us to get help from outside resources. So I'm just looking to be pointed in the right direction in how to solving this issue. So close to done this was the only issue I ran into. Any help would be great. Thanks :)

A: you can wrap your container with SingleChildScrollView and set scrollDirection to Axis.horizontal like code below.
Remember because we have different screen sizes you should avoid to set constant value for width and height.
Scaffold(
        appBar: AppBar(
             title: Text(widget.title),
            ),
        backgroundColor: Colors.blueGrey,
        body: SingleChildScrollView(
          scrollDirection: Axis.horizontal,
          child: Container(
              child: Padding(
            padding: EdgeInsets.only(left: 10, right: 10),
            child: Row(
              children: [
                Padding(
                    padding: EdgeInsets.only(left: 10, right: 10),
                    child: Column(
                      children: [
                        Container(
                          height: 100,
                          width: 100,
                          child: Center(
                              child: Text("Container 1",
                                  textAlign: TextAlign.center)),
                          decoration: BoxDecoration(
                              color: Colors.orange,
                              border:
                                  Border.all(color: Colors.black, width: 3)),
                        ),
                        Transform.rotate(
                            angle: .8,
                            child: Container(
                              height: 100,
                              width: 100,
                              child: Center(
                                  child: Text("Container 2",
                                      textAlign: TextAlign.center)),
                              color: Colors.white,
                            )),
                      ],
                    )),
                Padding(
                    padding: EdgeInsets.only(left: 10, right: 10),
                    child: Column(
                      children: [
                        Expanded(
                            child: Container(
                                height: 100,
                                width: 100,
                                child: Align(
                                    alignment: Alignment.bottomCenter,
                                    child: Text("Container 3",
                                        textAlign: TextAlign.center)),
                                color: Colors.yellow,
                                margin: const EdgeInsets.only(
                                    top: 10, bottom: 10))),
                        Expanded(
                            child: Container(
                                height: 100,
                                width: 100,
                                child: Align(
                                    alignment: Alignment.centerRight,
                                    child: Text("Container 4")),
                                color: Colors.lightBlue,
                                margin:
                                    const EdgeInsets.only(bottom: 10, top: 10)))
                      ],
                    )),
                Padding(
                    padding: EdgeInsets.only(left: 10, right: 10),
                    child: Column(children: [
                      Container(
                        height: 100,
                        width: 100,
                        margin: EdgeInsets.only(top: 140),
                        child: Center(
                            child: Text("Container 5",
                                textAlign: TextAlign.center,
                                style: TextStyle(color: Colors.white))),
                        decoration: BoxDecoration(
                            color: Colors.black,
                            border: Border.all(color: Colors.white, width: 3),
                            borderRadius: BorderRadius.circular(100)),
                      ),
                      Expanded(
                          child: Container(
                        height: 100,
                        width: 100,
                        margin: EdgeInsets.only(top: 160, right: 0, left: 0),
                        child: Text(
                          "Con 6",
                          style: TextStyle(fontSize: 30),
                          textAlign: TextAlign.start,
                        ),
                        color: Colors.red,
                      ))
                    ]))
              ],
            ),
          )),
        ));

A: You can also wrap Expanded widget to Row's children like this
class _MyHomePageState extends State<MyHomePage> {

  @override
  Widget build(BuildContext context) {
   return Scaffold(
        appBar: AppBar(
          title: Text(widget.title),
        ),
        backgroundColor: Colors.blueGrey,
        body: Container(
            child: Padding(
          padding: EdgeInsets.only(left: 10, right: 10),
          child: Row(
            children: [
              Expanded(child: Padding(
                  padding: EdgeInsets.only(left: 10, right: 10),
                  child: Column(
                    children: [
                      Container(
                        height: 100,
                        width: 100,
                        child: Center(
                            child: Text("Container 1",
                                textAlign: TextAlign.center)),
                        decoration: BoxDecoration(
                            color: Colors.orange,
                            border: Border.all(color: Colors.black, width: 3)),
                      ),
                      Transform.rotate(
                          angle: .8,
                          child: Container(
                            height: 100,
                            width: 100,
                            child: Center(
                                child: Text("Container 2",
                                    textAlign: TextAlign.center)),
                            color: Colors.white,
                          )),
                    ],
                  ))),
            Expanded(child:Padding(
                  padding: EdgeInsets.only(left: 10, right: 10),
                  child: Column(
                    children: [
                     Container(
                              height: 100,
                              width: 100,
                              child: new Align(
                                  alignment: Alignment.bottomCenter,
                                  child: Text("Container 3",
                                      textAlign: TextAlign.center)),
                              color: Colors.yellow,
                              margin:
                                  const EdgeInsets.only(top: 10, bottom: 10)),
                       Container(
                              height: 100,
                              width: 100,
                              child: new Align(
                                  alignment: Alignment.centerRight,
                                  child: Text("Container 4")),
                              color: Colors.lightBlue,
                              margin:
                                  const EdgeInsets.only(bottom: 10, top: 10))
                    ],
                  ))),
              Expanded(child:Padding(
                  padding: EdgeInsets.only(left: 10, right: 10),
                  child: Column(children: [
                    Container(
                      height: 100,
                      width: 100,
                      margin: EdgeInsets.only(top: 140),
                      child: Center(
                          child: Text("Container 5",
                              textAlign: TextAlign.center,
                              style: TextStyle(color: Colors.white))),
                      decoration: BoxDecoration(
                          color: Colors.black,
                          border: Border.all(color: Colors.white, width: 3),
                          borderRadius: BorderRadius.circular(100)),
                    ),
                     Container(
                      height: 100,
                      width: 100,
                      margin: EdgeInsets.only(top: 160, right: 0, left: 0),
                      child: Text(
                        "Con 6",
                        style: TextStyle(fontSize: 30),
                        textAlign: TextAlign.start,
                      ),
                      color: Colors.red,
                    )
                  ])))
            ],
          ),
        )));
  }
}


text:
Q: inequality between two increasing sequences I'm looking to answer the following question:
There are given two increasing sequences
$$a_n : 0.001; 0.004; 0.009; ... $$
$$b_n : 100; 300; 500; ... $$
Can the 1st sequence catch up with the 2nd(that is, can the inequality $a_n > b_n$ be satisfied for some $n$)
Looking at the 2 sequences I suspect that $a_n$ will surpass $b_n$ for some n as the intervals for a_n are growing.
How would I describe the situation in mathematical notation? In other words, I can see the answer to the question but I don't know how to write it down mathematically.

A: hint
for $n\ge 1$,
$$a_n=0.001\times n^2$$
$$b_n=-100+200n.$$


text:
Q: update with same name to Alfresco i want to update a file to Alfresco, but when Alfresco has a file with the same name it takes exceptions "duplicate child name".
Can i update files with the same names and keep all of them. For example i upload the file with name "fileNew" and then i try to upload again a file with the same name exactly (so they have only different versions to Alfresco)

A: Looks like you are in fact not updating but trying to create a child which already exists. Alfresco requires child names to be unique (have a look at contentModel.xml)
  <type name="cm:folder">
     <title>Folder</title>
     <parent>cm:cmobject</parent>
     <archive>true</archive>
     <associations>
        <child-association name="cm:contains">
           <source>
              <mandatory>false</mandatory>
              <many>true</many>
           </source>
           <target>
              <class>sys:base</class>
              <mandatory>false</mandatory>
              <many>true</many>
           </target>
           <duplicate>false</duplicate>
           <propagateTimestamps>true</propagateTimestamps>
        </child-association>
     </associations>
  </type>

Make sure to use the "update" (in old web-client) or "upload new Version" in share and not "add content" or "upload".


text:
Q: MongoDB: Failed to set up sockets during startup I have Windows 8.1 Enterprise 64 bit machine. I have installed mongodb msi for windows with SSL support. I created all the perquisites required for environment setup. Now using command prompt I navigated to the bin directory present into the mongodb installation folder and executed the following command:
mongod.exe --dbpath "c:\data"
And I see the following response:
C:\mongodb\bin>mongod.exe --dbpath "c:\data"
2016-05-27T17:09:43.362+0530 I CONTROL  [initandlisten] MongoDB starting : pid=2
108 port=27017 dbpath=C:\data\db\ 64-bit host=TestServer
2016-05-27T17:09:43.363+0530 I CONTROL  [initandlisten] targetMinOS: Windows 7/W
indows Server 2008 R2
2016-05-27T17:09:43.364+0530 I CONTROL  [initandlisten] db version v3.2.6
2016-05-27T17:09:43.364+0530 I CONTROL  [initandlisten] git version: 05552b562c7
a0b3143a729aaa0838e558dc49b25
2016-05-27T17:09:43.364+0530 I CONTROL  [initandlisten] OpenSSL version: OpenSSL
 1.0.1p-fips 9 Jul 2015
2016-05-27T17:09:43.364+0530 I CONTROL  [initandlisten] allocator: tcmalloc
2016-05-27T17:09:43.364+0530 I CONTROL  [initandlisten] modules: none
2016-05-27T17:09:43.364+0530 I CONTROL  [initandlisten] build environment:
2016-05-27T17:09:43.364+0530 I CONTROL  [initandlisten]     distmod: 2008plus-ss
l
2016-05-27T17:09:43.364+0530 I CONTROL  [initandlisten]     distarch: x86_64
2016-05-27T17:09:43.365+0530 I CONTROL  [initandlisten]     target_arch: x86_64
2016-05-27T17:09:43.365+0530 I CONTROL  [initandlisten] options: {}
2016-05-27T17:09:43.365+0530 E NETWORK  [initandlisten] listen(): bind() failed
errno:10048 Only one usage of each socket address (protocol/network address/port
) is normally permitted. for socket: 0.0.0.0:27017
2016-05-27T17:09:43.366+0530 E STORAGE  [initandlisten] Failed to set up sockets
 during startup.
2016-05-27T17:09:43.366+0530 I CONTROL  [initandlisten] dbexit:  rc: 48

Can anyone please help me to how to fix this issue.

A: run
netstat -a -n | find "27017"

and chek if port 27017 is already used

F:\data\bin> netstat -a -n | find "27017"
TCP    0.0.0.0:27017    0.0.0.0:0              LISTENING

or run taskmgr and find and kill all mongod processes


text:
Q: Can I use projection on $lookup? I have this function:
return db.collection( process.env.SPACECOLLECTION ).aggregate( [
            {
                $lookup: {
                    from: "users",
                    localField: "challengers",
                    foreignField: "_id",
                    as: "members"
                }
            }
        ] ).toArray();

What I get:
{
      _id: 5dfa26f46719311869ac1756,
      tokens: [],
      friends: [Array],
      incomingFriendRequest: [],
      incomingSpaceInvites: [],
      name: 'Account 2',
      email: 'account2@gmail.com',
      password: '$2b$10$VRrdAdFdGAlqN5lZ/J/za.S5gqjCpII8LBhPLNiTmHrFDHvESRRTC',
      spaces: [Array]
    }

What I want:
{
      _id: 5dfa26f46719311869ac1756,
      name: 'Account 2',
      email: 'account2@gmail.com',
    }

My issue is that the "users" collection, contains fields such as password and tokens. This is something that I do not want to receive when doing this lookup functions.
Basically my question is: Is there any way to choose what fields from the document I get, similar to how projection works on for example findOne?
IF NOT, how would I go about this? Delete the field in the backend after I got it from the DB?
Thank you!

A: Yes, you can use $lookup with a custom pipeline like so:
return db.collection( process.env.SPACECOLLECTION ).aggregate( [
    {
        $lookup: {
            from: "users",
            let: { challengers : "$challengers"},
            pipeline: [
                { $match:
                        { $expr: // i'm assuming challengers is an array.
                                { $in: [ "$_id",  "$$challengers" ] },
                        }
                },
                { $project: { password: 0, email: 0 } }
            ],
            as: "members"
        }
    }
] ).toArray();


text:
Q: How to Customize Login Form to be User's Email instead of User's Username I am following a tutorial for Login in Django and after finishing I found that the Login Form requires the Username and Password but I want to replace the username with the user's Email instead.
Here is the views.py
@login_required
def register(request):
    if request.method == 'POST':
        form = UserRegisterForm(request.POST)
        if form.is_valid():
            form.save()
            username = form.cleaned_data.get('username')
            messages.success(request, f'Your account has been created! You are now able to log in')
            return redirect('login')
    else:
        form = UserRegisterForm()
    return render(request, 'users/register.html', {'form': form})

@login_required
def profile(request):
    if request.method == 'POST':
        u_form = UserUpdateForm(request.POST, instance=request.user)
        p_form = ProfileUpdateForm(request.POST,
                                   request.FILES,
                                   instance=request.user.profile)
        if u_form.is_valid() and p_form.is_valid():
            u_form.save()
            p_form.save()
            messages.success(request, f'Your account has been updated!')
            return redirect('profile')

    else:
        u_form = UserUpdateForm(instance=request.user)
        p_form = ProfileUpdateForm(instance=request.user.profile)

    context = {
        'u_form': u_form,
        'p_form': p_form
    }

    return render(request, 'users/profile.html', context)

Here is the forms.py

class UserRegisterForm(UserCreationForm):
    email = forms.EmailField()

    class Meta:
        model = User
        fields = ['username', 'email', 'password1', 'password2']

class UserUpdateForm(forms.ModelForm):
    email = forms.EmailField()

    class Meta:
        model = User
        fields = ['username', 'email']

class ProfileUpdateForm(forms.ModelForm):
    class Meta:
        model = Profile
        fields = ['image']

Here is the template
<form class="login100-form validate-form" method="POST">

 Account Login

 <fieldset class="input100 m-b-20">
  {% csrf_token %}
  {{ form|crispy }}
     </fieldset>

  <button class="login100-form-btn" type="submit" style="width: 90%">
       Sign in
   </button>

  Forgot Password ?

  </form>

My question how to change from username to user's email?

A: To create a Django login with email We have to overwrite Default User, We can start writing models, but first you might want to create different app for your users (its a good practice).
Models.py
class User(AbstractBaseUser):
    email = models.EmailField(
        verbose_name='email address',
        max_length=255,
        unique=True,
    )
    active = models.BooleanField(default=True)
    staff = models.BooleanField(default=False) # a admin user; non super-user
    admin = models.BooleanField(default=False) # a superuser
    # notice the absence of a "Password field", that is built in.

    USERNAME_FIELD = 'email'
    REQUIRED_FIELDS = [] # Email & Password are required by default.

    def get_full_name(self):
        # The user is identified by their email address
        return self.email

Django has built-in methods for the User Manager. We have to customize them in order to make our custom user model work correctly.
class UserManager(BaseUserManager):
    def create_user(self, email, password=None):
        """
        Creates and saves a User with the given email and password.
        """
        if not email:
            raise ValueError('Users must have an email address')

        user = self.model(
            email=self.normalize_email(email),
        )

        user.set_password(password)
        user.save(using=self._db)
        return user

Then you need to run migrations.
python manage.py makemigrations
python manage.py migrate

Here's the post you can follow: here

A: go to your models.py, and add
USERNAME_FIELD = 'email'
remove username from form.

A: I'd recommend using django-allauth. It's a powerful tool for authenticating users and you can set the user to log-in with email instead of username by adding this to your settings.py:
ACCOUNT_EMAIL_REQUIRED = True
ACCOUNT_AUTHENTICATION_METHOD='email'

A: You can do that in two ways. By using AbstractUser or AbstractBaseUser
AbstractUser: define your user class by subclassing AbstractUser . AbstractUser class has all the necessary fields that you might need in user(you can add more). You can do something like setting email as username field and making username field as null. Use this option if you are good with the existing fields on the User model and just want to remove the username field.
class User(AbstractUser):
    username = None
    email = models.EmailField(_('email address'), unique=True)

    USERNAME_FIELD = 'email'
    REQUIRED_FIELDS = []

AbstractBaseUser:define your user class by subclassing AbstractBaseUser.It doesnt have existing fields.Use this option if you want to start from scratch by creating your own, completely new User model.
class User(AbstractBaseUser):
    email = models.EmailField(('email address'), unique=True)
    active = models.BooleanField(default=True)  # can login
    staff = models.BooleanField(default=False)  # staff user non super
    admin = models.BooleanField(default=False)  # superuser
    first_name = models.CharField(max_length=30, blank=True, null= True)
    last_name = models.CharField(max_length=30, blank=True, null= True)

    USERNAME_FIELD = 'email'
    REQUIRED_FIELDS = []

You need to write your custom manager depending on your need.

A: You can create backends.py
def authenticate(username=None, password=None):
    if '@' in username:
        kwargs = {'email': username}
    else:
        kwargs = {'username': username}
    try:
        user = User.objects.get(**kwargs)
        if user.check_password(password):
            # print(user.username)
            return user
    except User.DoesNotExist:
        return None

class EmailOrUsernameModelBackend(object):
    def authenticate(self, username=None, password=None):
        if '@' in username:
            kwargs = {'email': username}
        else:
            kwargs = {'username': username}
        try:
            user = User.objects.get(**kwargs)
            if user.check_password(password):
                # print(user.username)
                return user
        except User.DoesNotExist:
            return None

    def get_user(self, user_id):
        try:
            return User.objects.get(pk=user_id)
        except User.DoesNotExist:
            return None

After that, add the following code in settings.py
AUTHENTICATION_BACKENDS = (
    'users.backends.EmailOrUsernameModelBackend',
    'django.contrib.auth.backends.ModelBackend',
)

Then modify views.py
from django.contrib.auth import login as auth_login
def ajax_login(request):
    if request.method == 'POST':
        username = request.POST.get('email', '').strip()
        password = request.POST.get('password', '').strip()

        if username and password:
            user = authenticate(username=username, password=password)

            if user is not None:
                if user.is_active:
                    auth_login(request, user, backend='users.backends.EmailOrUsernameModelBackend')
                    try:
                        order = Order.objects.filter(user=request.user)
                    except Order.DoesNotExist:
                        order = None

                    if order is not None:
                        exist_order = True
                    else:
                        exist_order = False

                    data = {'success': True, 'order': exist_order}
                else:
                    data = {'success': False, 'message': 'User is not active'}
            else:
                data = {'success': False, 'message': 'Invalid username or password'}

    return JsonResponse(data)


text:
Q: Workbox img GET third url net::ERR_INTERNET_DISCONNECTED when offline My project needs to support offline mode and use react.
It will be embedded in other customers' PWA apps.
I package project by webpack 3.
The project is that the user will click the button and show the download page until all resources are ready.
It works well for the local file like "launcher.bundle.js", "local base64 image", "http//api fetch query"
I test it in localhost, prepare all downloaded resources then change the network condition to offline.
To get the third-party URL, it will show "GET URL net::ERR_INTERNET_DISCONNECTED"
But I already fetch that URL.
Could someone tell me what's wrong with my code?
Constructor
webpcak 3
  new CopyWebpackPlugin([
    {
      from: 'src/index.html',
      to: 'index.html',
    },
    {
      from: 'src/service-worker.js',
      to: 'service-worker.js',
    }
  ]),

index.js
if ('serviceWorker' in navigator) {
  // Use the window load event to keep the page load performant
  window.addEventListener('load', () => {
    navigator.serviceWorker.register('./service-worker.js');
  });
}

App.openLaucher()

App.openDownload()

Download page structor
export default class OfflineMode extends Component {
  constructor(props) {
    super(props);
  }

  componentDidMount() => {
    this.downloadFiles()
  }

  downloadFiles = async () => {
    await someDonwloadfunction()
  }

  render() {

{this.state.progress}

  }
}

Complete service-worker.js
importScripts('https://storage.googleapis.com/workbox-cdn/releases/6.4.1/workbox-sw.js');

workbox.googleAnalytics.initialize();

const cacheName = 'webmodule:network-first';
const networkFirst = new workbox.strategies.NetworkFirst({
  cacheName,
  matchOptions: {
    ignoreSearch: true,
    ignoreVary: true
  },
  plugins: [
    new workbox.cacheableResponse.CacheableResponsePlugin({statuses: [0, 200]}),
    new workbox.rangeRequests.RangeRequestsPlugin(),
  ],
});

workbox.routing.registerRoute(/^https:\/\/somewhere\//, networkFirst);

workbox.routing.registerRoute(/.*\.(?:html|js|css|png|jpg|jpeg|svg|gif|json)/, networkFirst);

workbox.routing.registerRoute(/^localhost\//, networkFirst);

self.addEventListener('install', function (event) {
  event.waitUntil(self.skipWaiting());
});

self.addEventListener('activate', function (event) {
  event.waitUntil(self.clients.claim());
});

content
export default class launcher extends Component {
  constructor(props) {
    super(props);
  }

  render() {

  }
}

Info screenshot
Fetch success

error log

query local file

query third-party URL

service worker

Thanks for your help.


text:
Q: Writing Tests for Flow and Mortar Apps I was wondering if there were any examples of writing unit tests for Flow and Mortar Android apps. Part of the advantage of the MVP pattern that it offers the split of the presentation and view logic, and the presentation logic is what you want to write tests against. I was hoping I could see some samples of how people are doing this with Flow & Mortar, and what libraries they are relying on. It'd be great to establish some best practices.
Edit: It's worth noting that Google just released junit support for Android.

A: There is u2020-mortar project which ports u2020 with use of Mortar and Flow. It has some test examples using Espresso.