text:
JSS with Sites Enabled:  Seen this issue before?

I was wondering if you'd come across any issues with Sites being enabled.  Below is an error I got yesterday from AutoPkgr, but the specific error seems to be from one of the other tools.
[ERROR] Error: Computer (ID:XXX, Name:computername) is enabled for a site.
It appeared on the 2nd item, in this case Firefox.jss (GoogleChrome.jss ran first with no error).
Below is the full entry.
11/20/14 10:24:19.865 AM AutoPkgr[71342]: (FULL AUTOPKG TRACEBACK)
File "/usr/local/bin/autopkg", line 1334, in
sys.exit(main(sys.argv))
File "/usr/local/bin/autopkg", line 1328, in main
exit(subcommands[verb]'function')
File "/usr/local/bin/autopkg", line 1152, in run_recipes
autopackager.process(recipe)
File "/Library/AutoPkg/autopkglib/init.py", line 466, in process
self.env = processor.process()
File "/Library/AutoPkg/autopkglib/init.py", line 295, in process
self.main()
File "/Library/AutoPkg/autopkglib/JSSImporter.py", line 596, in main
self.groups = self.handle_groups()
File "/Library/AutoPkg/autopkglib/JSSImporter.py", line 345, in handle_groups
computer_group = self._add_or_update_smart_group(group)
File "/Library/AutoPkg/autopkglib/JSSImporter.py", line 374, in _add_or_update_smart_group
update_env="jss_group_updated", added_env="jss_group_added")
File "/Library/AutoPkg/autopkglib/JSSImporter.py", line 425, in _update_or_create_new
self.j.put(url, recipe_object)
File "/Library/Python/2.7/site-packages/jss/jss.py", line 238, in put
self._error_handler(JSSPutError, response)
File "/Library/Python/2.7/site-packages/jss/jss.py", line 186, in _error_handler
raise exception
jss.jss.JSSPutError: JSS Error. Response Code: 409 Response" Conflict
Error: Computer (ID:XXX, Name:computername) is enabled for a site.
I removed the computer from the site but on the second run it simply hit the error on a different machine name. I'm not actually utilizing the 'Sites' feature, it was just left over from some testing, so I removed all sites and everything went back to working normally.

I ran into this today too.  Not using the site features either and removing all of the computers under my Exclusions list of the policy fixed it.

I had the same issue, no exclusions though on the policy, but it was set to install on the smart group and the machine that the error quoted. Removed the policy altogether and let it run again and that resolved the issue. So looks like if you scope a policy to anything but whats in the template it freaks out, but I had this without automagic and on sheacgraigs recipe so I think its JSSImporter issue

Hi @ungerjm — I don't have access to any Casper installs which use "sites," so I'm going to have to rely on others' feedback here.
Are you able to fix it by removing the policy exclusions, or by sticking to the scope defined in the policy template?
You may also want to update to the latest version of JSSImporter.

I know this is closed. I've just run into the same error myself. I've been testing it by going through the Auto Update Magic instructions and using the Firefox.jss. I have multiple sites in my Casper 9.32 install. Unlike Charliwest the machine causing the error dialog isn't in my firefox-update-smart group. I'm running the current AutoPkgr and the tools are all uptodate according to that.

@leoos can you maybe run the recipe manually with a -vvv to get some more info on the error? Also check if the policy installing firefox is scoped to only the smart group.
Another troubleshooting step would be to remove the policy and smart group and run the recipe again, just to see what happens maybe?

I've looked at this.
Removing the Policies and Smart Groups that were created in my JSS before I started adding overrides and following the instructions for AutoUpdateMagic allowed me to Check the Apps in AutoPkgr or run autopkg from the Command Line.
The problem resurfaces when I try to run the check the next time as the smart groups have been populated at this stage due to the initial run.
Below is the Traceback error message I get when I try to run my Firefox.jss a second time. This came in the terminal after the Output text I gathered in this text file.
https://github.com/leoos/eternalfrost/blob/master/Firefox_Output
The smartgroup is populated by the machine thats mentioned to be causing the error.
Here is the output running Adobe Flash Player with an override for the first time
https://github.com/leoos/eternalfrost/blob/master/Flash_Output

Traceback (most recent call last):
File "/usr/local/bin/autopkg", line 1469, in
sys.exit(main(sys.argv))
File "/usr/local/bin/autopkg", line 1463, in main
exit(subcommands[verb]'function')
File "/usr/local/bin/autopkg", line 1287, in run_recipes
autopackager.process(recipe)
File "/Library/AutoPkg/autopkglib/init.py", line 466, in process
self.env = processor.process()
File "/Library/AutoPkg/autopkglib/init.py", line 295, in process
self.main()
File "/Library/AutoPkg/autopkglib/JSSImporter.py", line 671, in main
self.groups = self.handle_groups()
File "/Library/AutoPkg/autopkglib/JSSImporter.py", line 393, in handle_groups
computer_group = self._add_or_update_smart_group(group)
File "/Library/AutoPkg/autopkglib/JSSImporter.py", line 428, in _add_or_update_smart_group
update_env="jss_group_updated", added_env="jss_group_added")
File "/Library/AutoPkg/autopkglib/JSSImporter.py", line 482, in _update_or_create_new
self.j.put(url, recipe_object)
File "/Library/Python/2.7/site-packages/python_jss-0.5.5-py2.7.egg/jss/jss.py", line 229, in put
self._error_handler(JSSPutError, response)
File "/Library/Python/2.7/site-packages/python_jss-0.5.5-py2.7.egg/jss/jss.py", line 174, in _error_handler
raise exception
jss.exceptions.JSSPutError: JSS Error. Response Code: 409	Response" Conflict
Error: Computer (ID:573, Name:csm-test-29711) is enabled for a site.

@leoos you may want to mask those passwords (and immediately change them, since GitHub's history lives forever.)

I was seeing the same error.  I figured out that the fix was to add
<site>
     <id>id-of-site</id>
     <name>name-of-site</name>
</site>

to the PolicyTemplate.xml and SmartGroupTemplate.xml files in the RecipeOverrides folder.  If you're building for different sites, you may need to make multiple template files that are customized as needed.

authors: charliwest homebysix leoos rougegoat ungerjm wooj1

repo: homebysix/auto-update-magic


text:
PKG rather than DMG as an option for Munki recipe's

Is there a way or option to allow for PKG's to be used in Munki recipe's rather than DMG's ?
The Reason is that we are looking to block DMG's being mounted for some users, but would still like to use Munki to deploy updates so PKG's would be dishabille ?
I can modify the recipes after creation to do PKG's but it would be nice to have the option to select type.

This isn't something I need, and I suspect very few people block dmg mounting, so I'm not planning on building it in.
However, if you submit a PR that does this, I'd be open to it. It would need to be a configurable option, with dmg remaining the default.

source: gharchive/issue

authors: Lotusshaney homebysix

repo: homebysix/recipe-robot

license_type: permissive

license_source: github-api


text:
docs: describe web-vitals instrumentation config options

View Formatted Readme
Proposes a configuration set-up for web-vitals, for discussion & alignment prior to writing the actual implementation code
(note: this was originally included as part of #61; pulled out into its own PR)

As we chatted about, closing this in favour of a new PR

source: gharchive/pull-request

authors: ahrbnsn pkanal

repo: honeycombio/honeycomb-opentelemetry-web


text:
크루스칼, 프림, 다익스트라, 벨만-포드, 플로이드

최소 스패닝 트리(MST)
최소 스패닝 트리는 그래프에서 만날 수 있는 최소 비용 문제 중 모든 정점을 연결하는 간선들의 가중치의 합이 최소가 되는 트리를 의미합니다.
그렇다면 스패닝 트리는 무엇일까요??
스패닝 트리
n개의 정점으로 이루어진 무향 그래프에서 n개의 정점과 n-1개의 간선으로 이루어진 트리를 신장트리라 합니다. 다른 말로, 원래 그래프의 정점 전부와 간선의 부분 집합으로 구성된 부분 그래프 입니다. 이 때, 스패닝 트리에 포함된 간선들은 정점들을 트리 형태로 전부 연결해야 합니다.
이런 특징들로부터 우리는 스패닝 트리가 유일하지 않고 여러개가 존재합니다.
가중치 그래프의 여러 개의 스패닝 트리 중 가중치의 합이 가장 작은 트리를 찾는 문제입니다.
크루스칼
크루스칼의 알고리즘은 상호 배타적 집합 자료 구조를 사용하는 좋은 예입니다.
크루스칼 알고리즘을 접근하기 전에 다음 질문의 답을 생각해보겠습니다.

가중치가 가장 작은 간선과 가중치가 가장 큰 간선 중 어느 쪽이 최소 스패닝 트리에 포함될 가능성이 높을까?

대부분 가중치가 가장 작은 간선일 것입니다. 크루스칼의 알고리즘은 여기서 출발합니다.
그래프의 모든 간선을 가중치의 오름차순으로 정렬합니다. 그 후, 스패닝트리에 하나씩 추가합니다. 이때 주의할 점은, 간선들이 사이클을 이루지 않게 해야하는 것입니다. 그렇기 때문에, 가중치가 작다고 무조건 간선을 트리에 더하는 것이 아닌, 결과적으로 사이클이 생기는 간선을 제외한 간선 중 가중치가 가장 작은 간선들을 트리에 추가합니다.
이처럼 크루스칼 알고리즘은 모든 간선을 한 번씩 감사한 뒤 종료합니다.
다음은 크루스칼 알고리즘이 최소 스패닝 트리를 만드는 과정을 표현한 그림입니다.

크루스칼 알고리즘의 구현
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.Comparator;
import java.util.StringTokenizer;

public class KuruskalTest {

    static class Edge implements Comparable<Edge> {
        int start, end, weight;
        public Edge(int start,int end, int weight){
            this.start = start;
            this.end = end;
            this.weight = weight;
        }
        @Override
        public int compareTo(Edge o){
            return Integer.compare(this.weight,o.weight);
        }
    }
    static int V;
    static int E;
    static BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
    static StringTokenizer st;
    static Edge[] edgeList;
    public static void main(String[] args) throws IOException {
        st = new StringTokenizer(br.readLine()," ");
        V = Integer.parseInt(st.nextToken());
        E = Integer.parseInt(st.nextToken());

        edgeList = new Edge[E];
        for(int i = 0;i<E;i++){
            st = new StringTokenizer(br.readLine()," ");
            int start = Integer.parseInt(st.nextToken());
            int end = Integer.parseInt(st.nextToken());
            int weight = Integer.parseInt(st.nextToken());
            edgeList[i] = new Edge(start,end,weight);
        }
        Arrays.sort(edgeList);//오름차순
        make();// 모든 정점을 각각 집합으로 만들고 출발한다.
        //간선 하나씩 시도하며 트리를 만든다.
        int cnt = 0,result = 0;
        for(Edge edge : edgeList){
            if(merge(edge.start,edge.end)){
                result += edge.weight;
                if(++cnt == V-1) break;// 신장트리 완성.
            }
        }
        System.out.println(result);

    }
    static int[] parents;
    static void make(){
        parents = new int[V];
        for(int i = 0;i<V;i++){
            parents[i] = i;
        }
    }
    //u가 속한 트리의 루트 번호를 반환한다.
    static int find(int u){
        if(u == parents[u]) return u;
        //return find(parent[u]); --- 기울어진 트리의 경우 비효율적
        //최적화(Path Compression)
        return parents[u] = find(parents[u]);
    }
    //u가 속한 트리와 v가 속한 트리를 합친다..
    static boolean merge(int u, int v){
        u = find(u);
        v = find(v);
        //u와 v가 이미 같은 트리에 속하는 경우는 걸러낸다.
        if(u ==v) return false;
        parents[u] = v;
        return true;
    }
}

정당성 증명

크루스칼 알고리즘이 선택하는 간선 중 그래프의 최소 스패닝 트리 T에 포함되지않는 간선이 있다고 가정
이 중 첫번째로 선택되는 간선을 (u,v)라 하자. T는 이 간선을 포함하지않기 때문에, u와 v는 T에서 다른 경로로 연결되어 있을 것이다.
이 경로를 이루는 간선 중 하나는 반드시 (u,v)와 가중치가 크거나 같아야한다.(그 이유는 모두 (u,v)보다 가중치가 작다면 크루스칼 알고리즘이 이미 이 간선들을 모두 선택해서 u와 v를 연결했을 것이기 때문에 (u,v)가 선택됐을리 없다.
따라서 이 경로 상에서 (u,v) 이상의 가중치를 갖는 간선을 하나 골라서 T에서 지워버리고 (u,v)를 추가해도 스패닝 트리는 유지되면서 가중치의 총합은 줄거나 같을 것입니다.
하지만 T가 이미 최소 스패닝 트리라고 가정했기 때문에, (u,v)를 포함하면서 최소 스패닝 트리가 되어야합니다.
따라서 (u,v)를 선택한다고 하더라도 남은 간선들을 잘 선택하면 항상 최소 스패닝 트리를 얻을 수 있습니다.
1~6의 성질은 마지막 간선을 추가해 스패닝 트리가 완성될 때까지 성립하기 때문에, 마지막에 얻은 트리는 항상 최소 스패닝 트리가 됩니다.

시간복잡도
DisJointSet에대한 연산은 실질적으로 상수기간이기 때문에,실제 트리를 만드는 for문의 시간복잡도 O(|E|)입니다. 따라서 크루스칼 알고리즘의 전체 시간복잡도는 간선 목록의 정렬에 걸리는 시간 O(|E|log|E|)가 됩니다. 간선 목록의 정렬하는 시간이 알고리즘 전체 시간 중에 지배적으로 크기 때문에, 간선의 수가 많아지면 크루스칼 알고리즘은 효율이 떨어집니다.
프림
프림의 알고리즘은 다익스트라 알고리즘과 거의 같은 형태를 띠고 있습니다.
크루스칼 알고리즘이 여기저기서 산발적으로 만들어진 트리의 조각들을 합쳐서 스패닝 트리를 만든다면, 프림 알고리즘은 하나의 시작점으로 구성된 트리에 간선을 하나씩 추가하는 방식으로 진행됩니다. 그렇기 때문에, 항상 선택된 간선들은 중간 과정에서도 연결된 트리를 만듭니다.
프림 알고리즘은 선택할 수 있는 간선들 중 가중치가 가장 작은 간선을 선택하는 과정을 반복합니다.
아래는 프림 알고리즘을 이용해서 최소 스패닝 트리를 만드는 과정을 표현한 그림입니다.

파란색으로 표현된 선은 이번 단계에서 고려할 간선이고, 그 중 선택된 간선을 하늘색으로 표현했습니다. 초록색 선은 이미 선택된 간선들을 의미합니다.
프림 알고리즘의 구현
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;

public class PrimTest {
    public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        int N = Integer.parseInt(br.readLine());
        int[][] adjMatrix = new int[N][N];
        boolean[] visited = new boolean[N];
        int[] minEdge = new int[N];

        StringTokenizer st = null;
        for(int i = 0;i<N;i++){
            st = new StringTokenizer(br.readLine()," ");
            for(int j = 0;j<N;j++){
                adjMatrix[i][j] = Integer.parseInt(st.nextToken());
            }
            minEdge[i] = Integer.MAX_VALUE;
        }

        int result = 0;//최소 신장 트리 비용
        minEdge[0] = 0;//임의의 시작점 0의 간선 비용을 0으로 세팅 index는 아무거나 상관없다.
        for(int i = 0;i<N;i++){
            // 1. 신장 트리에 포함되지않은 정점 중 최소간선비용의 정점 찾기
            int min = Integer.MAX_VALUE;
            int minVertex = -1;//최소간선비용의 정점번호
            for(int j = 0;j<N;j++){
                if(!visited[j] && min>minEdge[j]){
                    min = minEdge[j];
                    minVertex = j;
                }
            }
            visited[minVertex] = true;//신장트리에 포함시킴.
            result += min;//간선비용 누적.

            //2. 선택된 정점 기준으로 신장트리에 연결되지않은 타 정점과의 간선 비용 최소로 업데이트
            for (int j = 0; j < N; j++) {
                //인접 안해있으면 인풋이 0이므로 걔가 최소가 되어버림.
                if(!visited[j] && adjMatrix[minVertex][j]!=0 && minEdge[j] > adjMatrix[minVertex][j]){
                    minEdge[j] = adjMatrix[minVertex][j];
                }
            }
        }
        System.out.println(result);
    }
}

다익스트라 알고리즘의 구현과 비슷한 코드입니다.
각 정점에대해서 지금까지 알려진 최단 거리를 저장하는 것이 아닌, 마지막 간선의 가중치를 저장하는 방식으로 구현했습니다.
우선 순위 큐를 이용해서 최소 간선 비용의 정점을 찾으면 코드를 최적화 할 수 있습니다. 이렇게 구현을 하면, 우선순위 큐는 minEdge[ ]가 증가하는 순서로 정렬해서 담고있게 됩니다.
정당성 증명
크루스칼 알고리즘의 증명과 똑같이 증명할 수 있습니다.
크루스칼 vs 프림
크루스칼이 간선 위주였다면 프림은 정점을 위주로 풀어나가는 알고리즘입니다.
둘은 이미 만들어진 트리에 인접한 간선을 고려하는지의 여부를 제외하면 완전히 똑같은 알고리즘입니다.
다익스트라
다익스트라는 그래프의 한 시작 정점이 주어졌을 때, 그 정점에서 다른 정점으로의 최단 경로를 구하는 알고리즘입니다.
다음은 다익스트라 알고리즘의 동작 방식을 표현한 그림입니다.

출처
Basic idea
//init
S = {v0}; distance[v0] = 0;
for (w 가 V - S에 속한다면)//V-S는 전체 정점에서 이미 방문한 정점을 뺀 차집합.
	if ((v0, w)가 E에 속한다면) distance[w] = cost(v0,w);
	else distance[w] = inf;

//algorithm
S = {v0};
while V–S != empty {
  //아래의 코드는 지금까지 최단 경로가 구해지지않은 정점 중 가장 가까운 거리를 반복한다는 의미
	u = min{distance[w], w 는 V-S의 원소};//---1

  S = S U {u};
  V–S = (V–S)–{u};
	for(vertex w : V–S)
		distance[w] = min{distance[w],distance[u]+cost(u,w)}//update distance[w];---2
}

위의 코드에서 1로 마킹한 부분에대한 설명을 하겠습니다.
먼저 length[v]는 최단 경로의 길이를 의미하고 distance[w]는 시작점에서부터의 최단 경로의 길이를 의미합니다.
S는 시작점을 포함해서 현재까지 최단 경로를 발견한 점들의 집합을 의미합니다.
정당성 증명

u = min{distance[w], w 는 V-S의 원소}의 의미는 u까지의 최단 거리의 길이는 distance[u] 와 같다는 의미입니다.
둘이 같다는 것은 다음처럼 증명할 수 있습니다.

distance[u] > length[u]라고 가정해보겠습니다.
P를 시작점부터 u까지의 최단 경로라고 하면
P의 길이 = length[u]입니다.
P는 S에 속하지않는 최소 1개의 정점을 가집니다. 그렇지않다면 P의 길이 = distance[u]가 됩니다.
P의 경로에 속하면서 S에 속하지않는 시작점에서 가장 가까운 점을 w라 하겠습니다.
그렇게 된다면 distance[u] > length[u] >= length[w] 가 성립하고, length[w] = distance[w]이기 때문에  이로부터
**distance[u] > distance[w]**를 유추해낼 수 있습니다.
이는 다익스트라 알고리즘은 아직 최단경로가 찾아지지않은 정점들만 선택한다는 정의에 어긋납니다.(지금 보는 점보다 가까운 경로가 존재한다면 이전 탐색에서 걸러져서 S에 포함되어있기 때문입니다.)

그렇기 때문에 distance[u] = length[u]입니다.
다음으로는 distance[w]를 업데이트하는 부분입니다.

위의 그림에서와 같이 시작점 v0에서 u를 거쳐 w로 가는 경로와 v0에서 w로 가는 경로의 길이 중 가까운 경로를 distance[w]로 설정하고 S와 V-S를 최신화해줍니다.
distance[ ]를 업데이트할 때 각각의 간선들이 2번씩 체크되는데 그 이유는 다음과 같습니다.

아직 최단 경로를 찾지 못한 정점 중 u에 인접한 정점들의 거리를 업데이트 할 때 u와 w를 연결하는 간선이 체크가 됩니다.

정점 w의 최단 경로가 찾아졌기 때문에, w는 S에 속하게됩니다. 아직 최단 경로를 찾기 못한 정점들에서 w까지의 거리를 업데이트하는 과정에서 u에서 w로의 간선이 다시 한 번 체크됩니다.
이런 방식으로 코드를 작성하면 각 정접들에대해서 u에 인접한 모든 간선을 살펴보는 연산이 추가되기 때문에 최악의 경우 시간복잡도가 O(𝑛^2)가 되버립니다. 이를 개선하는 방법으로는 대표적으로 우선순위 큐를 사용하는 방법(O( 𝑛 + 𝑚 log 𝑛))과 피보나치 힙을 사용하는 방법(O(𝑛 log 𝑛 + 𝑚))이 있습니다.
피보나치 힙에대한 내용은 피보나치 힙 을 확인해주시고, 지금은 우선순위 큐에대한 내용을 다루겠습니다.
다익스트라 알고리즘 로직(우선순위 큐)

첫 번째 정점을 기준으로 연결되어있는 정점들을 추가해가면서 최단 거리를 갱신합니다.
첫 정점부터 각 노드 사이의 거리를 저장하는 배열을 만든 후에 첫 정점의 인접 노드 간의 거리부터 먼저 계산하면서, 첫 정점부터 해당 노드 사이의 가장 짧은 거리를 해당 배열에 업데이트 합니다. 이런 로직은 현재의 정점에서 갈 수 있는 정점들부터 처리한다는 점에서 BFS와 비슷합니다.
다양한 다익스트라 알고리즘이 있지만 가장 개선된 형태인 우선순위 큐를 사용하는 방식을 다뤄보겠습니다.
먼저 우선 순위 큐를 간단하게 설명하면 MinHeap 방식을 사용해서 현재 가장 짧은 거리를 가진 노드 정보를 먼저 꺼냅니다.
꺼낸 노드는 다음의 과정을 반복합니다.

첫 정점을 기준으로 배열을 선언핸 첫 정점에서 각 정점까지의 거리를 저장합니다.

초기에는 첫 정점의 거리를 0, 나머지는 무한대(inf)로 저장합니다.
우선순위 큐에 순서쌍 (첫 정점, 거리 0) 만 먼저 넣어줍니다.

우선순위 큐에서 노드를 꺼냅니다.

처음에는 첫 정점만 저장된 상태이기때문에 첫번째 정점만 꺼내집니다.
첫 정점에 인접한 노드들 각각에대해서 첫 정점에서 각 노드로 가는 거리와 현재 배열에 저장되어있는 첫 정점에서 각 정점까지의 거리를 비교합니다.
배열에 저장되어 있는 거리보다, 첫 정점에서 해당 노드로 가는 거리가 더 짧은 경우, 배열에 해당 노드의 거리를 업데이트 합니다.
배열에 해당 노드의 거리가 업데이트된 경우, 우선순위 큐에 해당 노드를 넣어줍니다.

2번의 과정을 우선순위 큐에서 꺼낼 노드가 없을 때까지 반복합니다.

우선순위 큐를 사용하면 지금까지 발견된 가장 짧은 거리의 노드에대해서 먼저 계산을 해서 더 긴 거리로 계산된 루트에 대해서는 계산을 스킵할 수 있다는 장점이 있습니다.

pseudo 코드는 다음과 같습니다.
found[], distance[]를 초기화
construct min_heap(V-{s});
for(i = 0; i < n-2; i++) { //𝑛−1iterations(=Θ(𝑛))---(1)
  distance[u]가 최소인 정점 u를 선택합니다. //Θ(1) found[u] = T;로 바로 배열로 접근 가능
  min_heap에서 정점 u를 제거; //O(log𝑛)---(2)
  for(every vertex w adjacent to u) //Θ(𝑚)total---(a)
      if(found[w] == F && distance[u] + cost(u,w) < distance[w]){
        distance[w] = distance[u] + cost(u,w);
        adjust heap(w); //𝑂(log𝑛)foreachedgecheck---(b)
  } // distance[w]가 수정됐기 때문에 heap을 조정해주는 for문
}

시간 복잡도
위의 pseudo code에서 다음 2가지 과정을 거칩니다.
(1),(a) - 각 정점마다 인접한 간선들을 모두 검사하는 과정 -> 𝑂(𝑛)
(2),(b) - 우선순위 큐에 정점/거리 정보를 넣고 삭제하는 과정 -> 𝑂(log𝑛)
따라서 전체 알고리즘은 O((𝑛+𝑚)log𝑛)입니다.
벨만-포드
다익스트라 알고리즘이 한 시작점에서 다른 모든 정점까지의 최단 거리를 구하는 유용한 알고리즘이지만, 음수 간선이 있는 그래프의 경우에는 그 정당성이 보장되지 않습니다. 벨만-포드 알고리즘은 이런 문제점을 해결하는 알고리즘입니다.
벨만-포드 알고리즘은 다익스트라 알고리즘과 똑같은 단일 시작점 최단 경로 알고리즘이지만, 음수 간선이 있는 그래프에 대해서도 최단 경로를 찾을 수 있습니다. 또한 그래프에 음수 사이클이 있어서 최단 거리가 제대로 정의 되지않을 경우도 알려줍니다.
벨만-포드 알고리즘은 시작점에서 각 정점까지 가는 최단 거리의 상한선을 적당하게 예측한 뒤에 예측 값과 실제 최단 거리 사이의 오차를 반복적으로 줄여가는 방식으로 동작합니다.
벨만-포드 알고리즘은 너비 우선 탐색을 기반으로 작동합니다.
수행 과정에서 각 정점까지의 최단 거리의 상한을 담은 배열 upper[ ]을 유지합니다.
이 값은 알고리즘이 진행되면서 점점 줄어들며, 알고리즘이 종료되는 시점에는 실제 최단 거리를 담게 됩니다.
벨만-포드의 동작 과정

알고리즘이 시작되는 시점에는 그래프의 구조에 대해서 아는 것은 시작점에서 시작점까지의 최단 거리가 0이라는 것 뿐입니다. 그렇기 때문에 upper[s] = 0으로 초기화하고, 나머지 원소들은 모두 아주 큰 수인 INF = Integer.MAX_VALUE 와 같이 초기화를 합니다.
벨만-포드 알고리즘은 이 예측값을 실제 최단 거리에 더 가깝게 갱신하기 위해서 다음과 같은 최단 거리의 특성을 이용합니다.

시작점에서 u와 v까지의 최단 거리 dist[u]와 dist[v]라 할 때 다음 조건은 항상 참입니다. w(u,v)는 u에서 v까지의 거리를 의미합니다.
dist[v] <= dist[u] + w(u,v)

이 속성을 이용하면 upper의 값을 실제 최단 거리에 가깝게 보정할 수 있습니다.
upper[u] + w(u,v) < upper[v]인 상황을 통해서 예를 들어보겠습니다.
u까지 가는 최단 거리는 항상 upper[u]이거나 upper[u]보다 짧습니다. 그 뒤에 (u,v)를 붙인 경로의 길이는 최대 upper[u]+w(u,v)이기 때문에, upper[v]를 upper[u]+w(u,v)로 줄이는 것이 가능합니다.

벨만-포드 알고리즘은 위와 같은 과정을 모든 간선에 대해서 반복적으로 실행하면서, 최종적으로 실제 최단 거리를 구할 수 있게됩니다.

벨만-포드의 종료 조건과 정당성 증명
하지만 위와 같은 방식으로는 몇 번이나 어떤 순서로 완화를 해야할지가 명확하지 않습니다.
또한 , upper가 실제 최단 거리와 같아진 다는 것을 어떻게 알 수 있을까요? 그리고 어떤 정점을 택하더라도 upper[u] = dist[u]가 되는 것이 확실할까요?
모든 간선에대해서 완화를 시도하는 작업을 x번 반복하면 x개 이하의 간선을 사용하는 최단 경로들을 전부 찾을 수 있습니다.
따라서 모든 간선이 전부 완화가 실패할 때까지 반복하면 모든 최단 경로를 찾을 수 있습니다.
그렇다면 몇 번을 반복해야 최단 경로를 구할 수 있을지 미리 알 수 있는 방법은 없을까요??
음수 사이클이 없는 그래프에서 최단 경로가 한 정점을 2번 지나는 일이 없다는 특징을 이용하면, 최단 경로가 포함하는 간선의 상한선을 쉽게 알 수 있습니다.
최단 경로는 최대 |V|개의 정점을 갖기 때문에 최대 |V|-1개의 간선을 가질 수 있습니다.
따라서 모든 간선에 대한 완화 과정은 전체 |V|-1번이면 충분합니다.
그렇다면 음수 간선이 존재하는 경우에는 최단 거리를 어떻게 구할 수 있을까요?
벨만-포드의 음수 사이클의 판정
그래프에 음수 사이클이 존재할 경우 벨만-포드 알고리즘도 의미없는 값을 반환하게됩니다. 하지만 간단한 변형을 통해서 벨만-포드 알고리즘이 음수 사이클의 존재 여부를 판정하게 만들 수 있습니다.
벨만-포드 알고리즘은 그래프가 음수 사이클이 존재하면 의미없는 값을 반환하는 것이 아니라 음수 사이클이 존재한다는 오류를 반환하게 합니다.
음수 사이클의 존재 여부를 판정하려면 |V|-1번 모든 간선에 대한 완화를 시도하는 대신 1번 더 해서 |V|번 완화를 시도하면 됩니다. 그래프에 음수 사이클이 없다면 |V|-1번만 반복해도 모든 최단 거리를 찾을 수 있기 때문에, 마지막 반복의 완화는 전부 실패할 것이기 때문입니다. 반면, 음수 사이클이 있는 경우에는 |V|번째 반복에도 항상 완화가 한 번은 성공합니다.
구현
int V;//그래프의 정점의 개수
ArrayList<Edge> adj = new ArrayList<Edge>();

int[] d = new int[V+1];
void bellmanford(int start){
	for(int i = 1;i<=n;i++){
		d[i] = Integer.MAX_VALUE;
	d[start] = 0;
	for(int i = 1;i<=n-1;i++){
		for(int j = 0;j<adj.size();j++){
			Edge temp = adj.get(j);
			if(d[temp.end] > d[temp.start] + temp.weight){
				d[temp.end] = d[temp.start] + temp.weight;
			}
		}
	}
}
class Edge{
    int start;
    int end;
    int weight;

    public Edge(int start, int end, int weight) {
        this.start = start;
        this.end = end;
        this.weight = weight;
    }
}

실제 경로 계산하기
벨만-포드 알고리즘을 수행하는 과정에서 각 정점을 마지막으로 완화시킨 간선들을 모으면 스패닝 트리를 얻을 수 있습니다. 각 정점을 마지막으로 완화시킨 간선들은 항상 최단 경로 위에 있기 때문에, 각 정점에서부터 스패닝 트리의 루트인 시작점까지 거슬러 올라가는 경로는 항상 시작점에서 해당 경로까지의 최단경로가 됩니다.
이는 너비 우선 탐색이나 다익스트라 알고리즘과 비슷한 방식으로 실제 정점의 목록을 계산할 수 있습니다.
플로이드의 모든 쌍 최단 거리 알고리즘
다익스트라 알고리즘과 벨만-포드 알고리즘은 시작점을 기준으로 다른 정점들까지의 최단 경로를 구하는 알고리즘입니다.
하지만 문제에 따라서는 한 개의 시작점이 아닌 모든 정점 쌍에 대해서 둘 사이의 최단 거리를 구해야 할 때도 있습니다.
이런 문제를 다익스트라나 벨만-포드 알고리즘을 이용해서 그래프의 존재하는 모든 쌍의 최단 거리를 구하면 시간 복잡도는 다음과 같습니다.

다익스트라

Linear Array 를 사용한 경우 0(V^3+VE) = 0(V^3)
우선 순위 큐(min-heap)을 사용한 경우 O((V^2)*logV+VE)

벨만-포드

O(V^2E) = O(V^4)
이보다 조금 더 빠르고 간단한 방법으로 모든 쌍 간의 최단 거리를 구하는 방법이 플로이드의 모든 쌍 최단 거리 알고리즘입니다.

플로이드 알고리즘은 그래프의 모든 정점 쌍의 최단 거리를 저장하는 2차원 배열 dist[ ][ ]를 계산하는 방식으로 동작합니다. 이 때, dist[u][v]는 u에서 v로 가는 최단 거리를 의미합니다.
플로이드 알고리즘은 경로의 경유점이라는 개념을 이용해서 동작합니다.

정점의 경유점
두 정점 u,v를 잇는 어떤 경로가 있고 그 경로는 시작점u와 끝점 v를 항상 지난다고 가정하겠습니다.
이 경로는 다른 정점들을 지나쳐 갈 수 있습니다. 그 이유는 u와 v를 직접 연결하는 간선이 없거나, 다른 정점을 경유해서 가는 경로가 전체 경로가 더 짧을 수 있기 때문입니다. 이 때 경로가 거쳐가는 정점들을 경유점이라고 합니다.
정점 집합 S에 포함된 정점만을 경유점으로 사용해서 u에서 v로 가는 최단 경로의 길이를 Ds(u,v)라고 하겠습니다.

S에 포함된 정점만을 경유점으로 사용해 u에서 v로 가는 최단 경로를 알고있다고 가정하겠습니다. S 중에 정점을 하나 골라서 x라고 하면, 최단 경로는 x를 경유할 수도 있고 경유하지 않을수도 있습니다.

경로가 x를 경유하지 않는다 : 이 경로는 S- {x} 에 포함된 정점들만을 경유점으로 사용합니다.
경로가 x를 경유한다 : 이 경로는 u에서 x로 가는 구간과 x에서 v로 가는 구간으로 나눌 수 있습니다. 이 2개의 부분 경로들은 각각 u와 x, x와 v를 잇는 최단 경로들이어야 합니다.
당연하게도 두 개의 부분 경로들은 x를 경유하지않으며, 따라서 S-{x}에 포함된 정점들만을 경유점으로 사용합니다.

S를 경유점으로 사용해 u에서 v로 가는 최단 경로는 위 2가지 중 더 짧은 경로가 될 것입니다.
Ds(u,v)를 다음과 같이 재귀적으로 정의할 수 있습니다.

위의 점화식을 살짝만 수정하면 모든 쌍에대한 최단 거리 문제를 동적 계획법으로 해결할 수 있습니다.
표기법을 살짝 고쳐서 Ck = D_s_k라 하면 다음과 같이 표현할 수 있습니다.

이 점화식은 C_k의 모든 값은 C_(k-1)에만 의존하기 때문에 동적 계획법을 이용할 수 있습니다.
구현
구체적인 구현에 앞서 플로이드 알고리즘의 프로토타입은 다음과 같습니다.
d[k,i,j] = set{1,2,...,k} 에 포함되는 i에서 j 로 가는 최단 경로
k가 0인 경우에는 중간 경로 없는 vertex i에서 vertex j로 바로 가는 경로이기 때문에 d[0,i,j] = w[i,j] 입니다.
for(int k = 0;k<n;k++){
	for(int i = 0;i<n;i++){
		for(int j = 0;j<n;j++){
			if(k == 0) d[k][i][j] = w[i,j];
			else d[k][i][j] = min(d[k-1][i][j],d[k-1][i][k] + d[k-1][k][j]);
		}
	}
}

위의 코드에서 볼 수 있듯 플로이드 알고리즘의 시간복잡도는 3중 for문을 돌기 때문에 O(|V|^3)입니다. 공간복잡도 역시 3차원 배열을 사용하기 때문에 (|V|^3) 입니다.
여기서 공간 복잡도를 줄일 수 있는 방법이 있습니다.
k번째 case를 계산할 때 k-1번째의 연산으로 부터 저장된 정보가 overwrite 될 수 있습니다. 그 이유는 출발점이나 도착점이 k번 정점일 때 사용 가능한 경유점의 목록에 k가 추가되는 것은 아무 의미가 없기 때문에, 이를 구분하지 않고 써도 되기 때문입니다.
예를 들면, 지하철 역에 들러 학교로 가는 최단 경로와 지하철역과 학교를 들러 학교로 가는 최단 경로는 똑같기 때문입니다.
이런 이유로 우리는 더이상 3차원 배열을 사용해서 k번째 연산과 k-1번째 연산을 구분할 필요없이 한 개의 2차원 배열을 이용해서 코드를 짤 수 있습니다.
for(int k = 0;k<n;k++){
	for(int i = 0;i<n;i++){
		for(int j = 0;j<n;j++){
			d[k][i][j] = min(d[k-1][i][j],d[k-1][i][k] + d[k-1][k][j]);
		}
	}
}

2차원 배열을 사용하면 시간 복잡도는 그대로지만 공간 복잡도는 O(|V|^3)에서 O(|V|^2)로 줄일 수 있습니다.

시간 복잡도에대한 최적화는 빠른 시일내로 업데이트 하겠습니다.

repo: hongcheol/CS-study

license: MIT


text:
onLoadMoreRequested方法一开始就会调用？

mLoadMoreWrapper.setLoadMoreView(R.layout.item_universal_more);
mLoadMoreWrapper.setOnLoadMoreListener(new LoadMoreWrapper.OnLoadMoreListener(){
			@Override
			public void onLoadMoreRequested(){

		});

一开始就在加载，这个不应该是滑动到最底部才触发吗？

如果条目没有超过屏幕就会触发，比如你列表就有一个条目的时候

我也出现这种情况,每屏加载4个,一共9个数据,进入App就触发了onLoadMoreRequested();
我用了以下布局   viewPager内加入fragment,  fragment加入RecyclerView

我觉得应该是事件冲突,但是没有找到解决方法

我也出现这种情况,
以下为布局
`<android.support.v4.widget.SwipeRefreshLayout>
<android.support.design.widget.CoordinatorLayout >

    <android.support.design.widget.AppBarLayout>

        <android.support.design.widget.CollapsingToolbarLayout >

            <ImageView>

            <android.support.v7.widget.Toolbar>

            <android.support.design.widget.TabLayout>

        </android.support.design.widget.CollapsingToolbarLayout>

    </android.support.design.widget.AppBarLayout>

    <android.support.v4.view.ViewPager >

</android.support.design.widget.CoordinatorLayout>

</android.support.v4.widget.SwipeRefreshLayout>`
ViewPager  --->  FragmentPagerAdapter ----> RecyclerView
应该是事件冲突,还没找到解决方法

一开始就调用不是有逻辑错误吗？怎么解决？

authors: fanxl12 megoc scsfwgy yikwing

repo: hongyangAndroid/baseAdapter


text:
Hono.js not working on Supabase Edge function

I tried using Hono.js with the edge function but it failed to work.
Function Code:
import { Hono } from 'https://deno.land/x/hono@v3.0.1/mod.ts'
import { serve } from 'https://deno.land/std@0.168.0/http/server.ts'

console.log('Notion Parser Method Functions!')

const app = new Hono()

app.get('/', (c) => c.text('Hello Deno 123!'))

serve(app.fetch)

The code is building but giving a 404 Not Found error both locally and after deployment.
I have created a ticket regarding this issue on the Supabase repo https://github.com/supabase/supabase/issues/12629.
Posting it here to get help.

Hi @Akash187 !
Actually, I have never run Hono in Supabase. I will try later.

@yusukebe Issue is fixed Supabase team helped me.
For future reference Solution Link - https://github.com/supabase/supabase/issues/12629

Wow, cool!

repo: honojs/hono


text:
feat(middleware): introduce Request ID middleware

Request ID middleware generates a unique id for a request.
The unique request id can be used to trace a request end-to-end.
const app = new Hono()

app.use(requestID())
app.get('/', (c) => {
    console.log(c.get('requestID'))
    return c.text('Hello World!')
})

It is also easily customizable with several options.
type RequesIDOptions = {
  // The maximum length of request id. If positive truncates the request id at the specified length.
  // The default value is 255.
  limitLength?: number
  // The header name used in request id.
  // The default value is 'X-Request-Id'.
  headerName?: string
  // The request id generation function.
  // The default value is 'crypto.randomUUID()'.
  generator?: () => string
}

The author should do the following, if applicable

[x] Add tests
[x] Run tests
[x] bun run format:fix && bun run lint:fix to format the code
[x] Add TSDoc/JSDoc to document the code

Hi @ryuapp
I love this middleware since it's simple! I think this has no problem and is ready to merge.
@usualoma @nakasyou @MathurAditya724 @fzn0x and others. Do you have any thoughts on this?

I can't decide between requestId and requestID in the variable and middleware name.
The former follows the naming convention and looks better, but I thought 'L' and 'I' were confusing, so I chose the latter.
However, I realized that the above problem is a font problem and does not affect anything other than the document, so I am thinking of fixing it, but does anyone have any opinions?

I think requestId is better to use when typing on keyboard, and it already use since then and accepted by the majority, so maybe just go with requestId?

Interesting middleware! Can already think about multiple use cases for this. And I am voting for requestId.

I prefer requestId for the same reason as @fzn0x 👍

Thank you for all the opinions.
Many people agree with requestId and the reason is obvious, I will change it to requestId.

The tests is failing on next regardless of this branch, I submit a PR to fix it. #3115

Hello @usualoma .
Thank you for your proposal.
When I ran a benchmark with Deno, it seems that the cost of checking with regular expressions is greater.
benchmark               time (avg)        iter/s             (min … max)       p75       p99      p995
------------------------------------------------------------------------ -----------------------------
no-check: valid         68.51 ns/iter  14,595,900.4  (60.83 ns … 240.78 ns) 66.26 ns 136.44 ns 158.73 ns
pre check: valid        96.83 ns/iter  10,327,663.8     (85.27 ns … 154 ns) 92.97 ns 148.24 ns 149.35 ns
no-check: invalid       93.97 ns/iter  10,641,957.4  (90.13 ns … 212.15 ns) 92.73 ns 122.85 ns 146.21 ns
pre check: invalid     246.53 ns/iter   4,056,358.6 (235.76 ns … 670.25 ns) 240.52 ns 547.67 ns 621.05 ns

Source codes

const validId = crypto.randomUUID();
const invalidId = validId + "!";
const limitLength = 255;
const isValidIncomingHeaderValueRe = new RegExp(
  `^[\\w\\-]${limitLength ? `{0,${limitLength}}` : "+"}$`,
);

let id;
console.log(isValidIncomingHeaderValueRe);
console.log(!isValidIncomingHeaderValueRe.test(validId));
console.log(!isValidIncomingHeaderValueRe.test(invalidId));
Deno.bench({
  name: "no-check: valid",
  fn() {
    id = validId.replace(/[^\w\-]/g, "");
    id = limitLength > 0 ? id.substring(0, limitLength) : id;
  },
});

Deno.bench({
  name: "pre check: valid",
  fn() {
    if (!isValidIncomingHeaderValueRe.test(validId)) {
      id = validId.replace(/[^\w\-]/g, "");
      id = limitLength > 0 ? id.substring(0, limitLength) : id;
    }
  },
});
Deno.bench({
  name: "no-check: invalid",
  fn() {
    id = invalidId.replace(/[^\w\-]/g, "");
    id = limitLength > 0 ? id.substring(0, limitLength) : id;
  },
});

Deno.bench({
  name: "pre check: invalid",
  fn() {
    if (!isValidIncomingHeaderValueRe.test(invalidId)) {
      id = invalidId.replace(/[^\w\-]/g, "");
      id = limitLength > 0 ? id.substring(0, limitLength) : id;
    }
  },
});

However, as you say, String.prototype.replace() is heavy. The longer the requestid, the higher the load.
This validation is added to respect Ruby on Rails, but it may not be suitable for JavaScript. I also checked other frameworks (primarily written in GO) and they didn't have this kind of functionality.
I'm thinking of removing this validation, leaving only lengthLimit. What do you think about this?

@ryuapp
Oooh, sorry, you are right, my version was slow. First of all, I apologise for taking up your time.
I also benchmarked and confirmed the following.
Checking with a regular expression like const isValidCharsOnlyRe = /^[\w\-]+$/;, "node" and "deno" might perform a bit better on normal systems.  In "bun", my approach did not perform well in any way.

scripts
Both benchmarks are the same.
deno
const validId = crypto.randomUUID();
const invalidId = validId + "!";
const limitLength = 255;
const isValidIncomingHeaderValueRe = new RegExp(
  `^[\\w\\-]${limitLength ? `{0,${limitLength}}` : "+"}$`,
);
const isValidCharsOnlyRe = /^[\w\-]+$/;

let id;
console.log(isValidIncomingHeaderValueRe);
console.log(!isValidIncomingHeaderValueRe.test(validId));
console.log(!isValidIncomingHeaderValueRe.test(invalidId));
console.log(!isValidCharsOnlyRe.test(validId));
console.log(!isValidCharsOnlyRe.test(invalidId));
Deno.bench({
  name: "no-check: valid",
  fn() {
    id = validId.replace(/[^\w\-]/g, "");
    id = limitLength > 0 ? id.substring(0, limitLength) : id;
  },
});

Deno.bench({
  name: "pre check: valid",
  fn() {
    if (!isValidIncomingHeaderValueRe.test(validId)) {
      id = validId.replace(/[^\w\-]/g, "");
      id = limitLength > 0 ? id.substring(0, limitLength) : id;
    }
  },
});

Deno.bench({
  name: "pre check w/ isValidCharsOnlyRe: valid",
  fn() {
    if (!isValidCharsOnlyRe.test(validId) || (limitLength > 0 && validId.length > limitLength)) {
      id = validId.replace(/[^\w\-]/g, "");
      id = limitLength > 0 ? id.substring(0, limitLength) : id;
    }
  },
});

Deno.bench({
  name: "no-check: invalid",
  fn() {
    id = invalidId.replace(/[^\w\-]/g, "");
    id = limitLength > 0 ? id.substring(0, limitLength) : id;
  },
});

Deno.bench({
  name: "pre check: invalid",
  fn() {
    if (!isValidIncomingHeaderValueRe.test(invalidId)) {
      id = invalidId.replace(/[^\w\-]/g, "");
      id = limitLength > 0 ? id.substring(0, limitLength) : id;
    }
  },
});

node / bun
import { run, group, bench } from 'mitata'

const validId = crypto.randomUUID()
const invalidId = validId + '!'
const limitLength = 255
const isValidIncomingHeaderValueRe = new RegExp(
  `^[\\w\\-]${limitLength ? `{0,${limitLength}}` : '+'}$`
)
const isValidCharsOnlyRe = /^[\w\-]+$/

let id
console.log(isValidIncomingHeaderValueRe)
console.log(!isValidIncomingHeaderValueRe.test(validId))
console.log(!isValidIncomingHeaderValueRe.test(invalidId))

group('uuid validation', () => {
  bench('no-check: valid', () => {
    id = validId.replace(/[^\w\-]/g, '')
    id = limitLength > 0 ? id.substring(0, limitLength) : id
  })
  bench('pre check: valid', () => {
    if (!isValidIncomingHeaderValueRe.test(validId)) {
      id = validId.replace(/[^\w\-]/g, '')
      id = limitLength > 0 ? id.substring(0, limitLength) : id
    }
  })
  bench('pre check w/ isValidCharsOnlyRe: valid', () => {
    if (!isValidCharsOnlyRe.test(validId) || (limitLength > 0 && validId.length > limitLength)) {
      id = validId.replace(/[^\w\-]/g, '')
      id = limitLength > 0 ? id.substring(0, limitLength) : id
    }
  })
  bench('no-check: invalid', () => {
    id = invalidId.replace(/[^\w\-]/g, '')
    id = limitLength > 0 ? id.substring(0, limitLength) : id
  })
  bench('pre check: invalid', () => {
    if (!isValidIncomingHeaderValueRe.test(invalidId)) {
      id = invalidId.replace(/[^\w\-]/g, '')
      id = limitLength > 0 ? id.substring(0, limitLength) : id
    }
  })
})

run()

deno
benchmark                                   time (avg)        iter/s             (min … max)       p75       p99      p995
-------------------------------------------------------------------------------------------- -----------------------------
no-check: valid                             50.84 ns/iter  19,667,727.7       (48.6 ns … 74 ns) 51.19 ns 59.42 ns 66.02 ns
pre check: valid                            61.92 ns/iter  16,150,143.1   (59.85 ns … 74.46 ns) 62.24 ns 65.65 ns 66.93 ns
pre check w/ isValidCharsOnlyRe: valid      35.25 ns/iter  28,369,004.6   (33.86 ns … 40.23 ns) 35.56 ns 37.77 ns 38.45 ns
no-check: invalid                           76.43 ns/iter  13,083,104.8    (72.61 ns … 97.5 ns) 77.72 ns 87.95 ns 90.08 ns
pre check: invalid                         181.03 ns/iter   5,524,007.4 (174.89 ns … 193.31 ns) 183.09 ns 191.79 ns 192.09 ns

node
• uuid validation
------------------------------------------------------------------------------ -----------------------------
no-check: valid                          46.04 ns/iter     (43.56 ns … 131 ns)  45.51 ns   68.5 ns  80.02 ns
pre check: valid                         59.99 ns/iter   (56.76 ns … 81.89 ns)  60.77 ns  67.26 ns  73.71 ns
pre check w/ isValidCharsOnlyRe: valid   33.85 ns/iter   (32.67 ns … 66.59 ns)  34.02 ns  39.79 ns  46.81 ns
no-check: invalid                        67.87 ns/iter     (64.53 ns … 139 ns)  67.55 ns  92.77 ns    115 ns
pre check: invalid                         169 ns/iter       (159 ns … 209 ns)    169 ns    195 ns    207 ns

bun
• uuid validation
------------------------------------------------------------------------------ -----------------------------
no-check: valid                            1.8 ns/iter      (1.63 ns … 219 ns)   1.75 ns   2.28 ns   9.09 ns
pre check: valid                          2.29 ns/iter    (2.18 ns … 21.18 ns)   2.26 ns   2.83 ns   6.19 ns
pre check w/ isValidCharsOnlyRe: valid     2.4 ns/iter    (2.24 ns … 38.45 ns)   2.38 ns   3.01 ns   6.73 ns
no-check: invalid                          1.8 ns/iter    (1.69 ns … 99.83 ns)   1.79 ns   2.22 ns   5.33 ns
pre check: invalid                        2.02 ns/iter    (1.89 ns … 23.52 ns)   2.01 ns   2.44 ns   6.39 ns

I'm thinking about this now.

I'm thinking of removing this validation, leaving only the lengthLimit What do you think about this?

Ah, using const hasInvalidCharRe = /[^\w\-]/ gave the best performance for valid id, whether "node", "deno" or "bun".

script
import { run, group, bench } from 'mitata'

const validId = crypto.randomUUID()
const invalidId = validId + '!'
const limitLength = 255
const isValidIncomingHeaderValueRe = new RegExp(
  `^[\\w\\-]${limitLength ? `{0,${limitLength}}` : '+'}$`
)
const isValidCharsOnlyRe = /^[\w\-]+$/
const hasInvalidCharRe = /[^\w\-]/

let id
console.log(isValidIncomingHeaderValueRe)
console.log(!isValidIncomingHeaderValueRe.test(validId))
console.log(!isValidIncomingHeaderValueRe.test(invalidId))

group('uuid validation', () => {
  bench('no-check: valid', () => {
    id = validId.replace(/[^\w\-]/g, '')
    id = limitLength > 0 ? id.substring(0, limitLength) : id
  })
  bench('pre check: valid', () => {
    if (!isValidIncomingHeaderValueRe.test(validId)) {
      id = validId.replace(/[^\w\-]/g, '')
      id = limitLength > 0 ? id.substring(0, limitLength) : id
    }
  })
  bench('pre check w/ isValidCharsOnlyRe: valid', () => {
    if (!isValidCharsOnlyRe.test(validId) || (limitLength > 0 && validId.length > limitLength)) {
      id = validId.replace(/[^\w\-]/g, '')
      id = limitLength > 0 ? id.substring(0, limitLength) : id
    }
  })
  bench('pre check w/ hasInvalidCharRe: valid', () => {
    if (hasInvalidCharRe.test(validId) || (limitLength > 0 && validId.length > limitLength)) {
      id = validId.replace(/[^\w\-]/g, '')
      id = limitLength > 0 ? id.substring(0, limitLength) : id
    }
  })
  bench('no-check: invalid', () => {
    id = invalidId.replace(/[^\w\-]/g, '')
    id = limitLength > 0 ? id.substring(0, limitLength) : id
  })
  bench('pre check: invalid', () => {
    if (!isValidIncomingHeaderValueRe.test(invalidId)) {
      id = invalidId.replace(/[^\w\-]/g, '')
      id = limitLength > 0 ? id.substring(0, limitLength) : id
    }
  })
})

run()

deno
• uuid validation
------------------------------------------------------------------------------ -----------------------------
no-check: valid                          47.77 ns/iter         (0 ps … 977 ns)      0 ps    977 ns    977 ns !
pre check: valid                         59.64 ns/iter         (0 ps … 977 ns)      0 ps    977 ns    977 ns !
pre check w/ isValidCharsOnlyRe: valid    36.8 ns/iter         (0 ps … 977 ns)      0 ps    977 ns    977 ns !
pre check w/ hasInvalidCharRe: valid     35.77 ns/iter         (0 ps … 977 ns)      0 ps    977 ns    977 ns !
no-check: invalid                        72.89 ns/iter         (0 ps … 977 ns)      0 ps    977 ns    977 ns !
pre check: invalid                         174 ns/iter         (0 ps … 977 ns)      0 ps    977 ns    977 ns !

node
• uuid validation
------------------------------------------------------------------------------ -----------------------------
no-check: valid                          46.79 ns/iter     (42.56 ns … 139 ns)  45.65 ns  67.34 ns  79.71 ns
pre check: valid                         61.04 ns/iter     (56.62 ns … 274 ns)  60.91 ns  81.44 ns    227 ns
pre check w/ isValidCharsOnlyRe: valid   33.54 ns/iter   (31.78 ns … 61.83 ns)  33.26 ns  38.43 ns  43.01 ns
pre check w/ hasInvalidCharRe: valid     32.59 ns/iter   (30.66 ns … 57.82 ns)  33.06 ns  37.76 ns  40.98 ns
no-check: invalid                        67.71 ns/iter     (62.32 ns … 123 ns)  67.59 ns  92.26 ns    108 ns
pre check: invalid                         169 ns/iter       (162 ns … 243 ns)    170 ns    201 ns    241 ns

bun
• uuid validation
------------------------------------------------------------------------------ -----------------------------
no-check: valid                           1.76 ns/iter      (1.59 ns … 179 ns)   1.69 ns   3.34 ns  10.23 ns
pre check: valid                           2.2 ns/iter    (2.05 ns … 18.33 ns)   2.16 ns   2.85 ns    6.9 ns
pre check w/ isValidCharsOnlyRe: valid    2.37 ns/iter    (2.24 ns … 33.63 ns)   2.34 ns   3.07 ns   7.02 ns
pre check w/ hasInvalidCharRe: valid      1.55 ns/iter    (1.44 ns … 25.37 ns)   1.55 ns   1.95 ns   5.72 ns
no-check: invalid                         1.74 ns/iter     (1.63 ns … 22.5 ns)   1.73 ns   2.18 ns   6.37 ns
pre check: invalid                        1.96 ns/iter    (1.83 ns … 26.43 ns)   1.93 ns    2.4 ns   6.73 ns

However...

@usualoma  Thank you for investigating this.
I agree with your opinion.
Of all the ideas we can think of at the moment, I think "re-generating" makes the most sense and is a good idea.
I was concerned that Deno's benchmarks were slow, but it seems like crypto.ramdomUUID() on Deno is just slow.
We can ignore this issue.
ok. I adopt the proposal. Thanks so much!

@ryuapp Thank you!

@usualoma Thank you for reviewing, @ryuapp Thank you for such great middleware.
Now, I'll merge this into the next!


text:
🛑 FWAw is down

In 6aac4ea, FWAw ($FWA_SITE) was down:

HTTP code: 0
Response time: 0 ms

Resolved: FWAw is back up in f3cf157 after 18 minutes.

repo: hoopybe/uptime


text:
hyprgrass failing to build (GestureManager.cpp)

When trying to install hyprgrass, it encounters an error when compiling GestureManager.cpp (see Sceenshot)
After using hyprpm update -v, you can enable hyprgrass, but the plugin fails as it cannot find hyprgrass.so.

OS: Arch Linux x86_64 (6.8.9-arch1-2)
Hyprland Version 0.40.0
I am new to linux and not used to submitting issues, so if you require any more logs or info please tell me! ^^

currently hyprland-git branch breaks plugins, please use 0.40.0 instead (commit cba1ade, i wrote that from memory might be wrong)
if it still doesn't build/doesn't work on 0.40.0 let me know

I am not using the AUR package (hyprland-git), I am using the official package. (hyprland-0.40.0-1)
Is that still a wrong version?

show hyprctl version?

nevermind it's probably my fault, I'll push a fix later

should be fixed now

please open new issue if it persists

repo: horriblename/hyprgrass


text:
[SPARK-LLAP-130] Support LOAD INPATH statement

What changes were proposed in this pull request?
This PR supports LOAD INPATH.
How was this patch tested?

[x] Pass Travis CI
[x] Add a test case and pass the all test cases.

[hive@hdp26-3 python]$ ./spark-ranger-secure-test.py
.........................
----------------------------------------------------------------------
Ran 25 tests in 3630.891s

OK

@merlintang .
Could you review this PR? This passed the test suite.

Thank you, @merlintang .

repo: hortonworks-spark/spark-llap

license_source: bigquery


text:
Change CP output stream name to have a suffix that is user friendly

We changed CP output stream name to have custom_processor_ where node id is the processor id in the catalog of processors. This is not very user friendly when we connect two instances of same CP in to a join processor. Talked to @shahsank3t and seems to be non trivial change. I think this is not a blocker we should try to get this change in.

@priyank5485 Few things we didn't think about while deciding on using componentName+'_stream_'+id:
When user drops the another instance of the same component, UI adds the unique identifier componentName-<count> (example: CCP, CCP-1, CCP-2, etc)
So using this name if we create stream it will be something like: CCP_stream_1, CCP-1_stream_2, CCP-2_stream_3.
This is pretty user-friendly, but I believe backend throws runtime exception while deploying a topology if streamId has a hyphen (-) in it.
Can you confirm if it's true or not?

@priyank5485, can you please talk to Harsha and get this prioritized?

Had a discussion with @priyank5485 and just to summarize the issue:
Currently, if you have 2 custom processors that have output streams named as “custom_stream_1”, “custom_stream_2” and both are being connected to Join processor.
Being an end user, he might not be aware that “custom_stream_1” is coming for which custom processor so we wanted to change the streamId (output stream name) to something that user can figure out visibly from the UI as well as it should be unique but currently we don’t have any such unique value.
As a turn around for this issue, the user can click on the link between 2 components and check stream name (as visible in the image below) that is being passed to next component and use that info while configuring processors.

So IMO, this shouldn’t be a blocker(P0) for the release and should be moved out from this release.
cc: @sureshms @harshach

Thanks @shahsank3t . This works as designed. We will see if there are further improvements based on user feedback.

repo: hortonworks/streamline


text:
Add the Mac M1 segfault fix into Procfile

This attempts to fix https://github.com/hostedgpt/hostedgpt/issues/42
However, I'm not able to repro this issue any longer in my dev environment so it's hard for me to confirm. But I think it's safe to merge in and since it happened to multiple people I do think it's still an issue.

@krschacht I haven't had this issue since moving SolidQueue out of puma.

authors: krschacht robacarp

repo: hostedgpt/hostedgpt


text:
Gestion des Twilio::REST::RestError

Certains Match ne peuvent pas être envoyés par SMS correctement pour plusieurs raisons 👍

Le numéro de téléphone est "fake" (e.g. 06 06 06 06 06)
Le numéro de téléphone est un téléphone fixe (e.g. 01 .. .. .. ..)
Le numéro de téléphone n'est pas autorisé sur le plan Twilio (numéro étranger par exemple)

Le problème actuel est que le lendemain, ces users vont retomber dans les campagnes, sans plus de succès. Il faut flagger ces utilisateurs pour qu'ils ne soient plus pris en compte dans les campagnes futures (et eventuellement les notifier par mail en leur demandant de mettre à jour leur telephone portable pour être prévenus s'ils le souhaitent)
ℹ Lorsqu'on passera à Sendinblue, il faudra ajouter les exceptions de ce service.

@ssaunier @GuillaumeWrobel si personne n'est déjà en train de travailler dessus je veux bien m'en occuper.
L'utilisation d'une gem comme phonelib ou phony me semblerait pratique ici, sauf si vous préférez continuer avec une solution de contrôle maison ?

Should we close this issue if it is fixed ?

Je ferme l'issue comme on va changer de provider.

authors: EmCousin mininao ssaunier yann120

repo: hostolab/covidliste


text:
[Zipcode] Validation à la création d'un User ou d'un Partner

Ajout d'une validation de presence d'un code postale pour les adresse uniquement lors d'une création d'un utilisateur ou d'un centre, j'ai rajouté une validation pour être sûr d'avoir un code postale au minima dans l'adresse, ca nous assure entre guillemets qu'il est cliqué sur un des éléments proposé par Algolia ou bien quand Algolia est down d'avoir au minima le code postale. La page de confirmation des matchs passe comme c'est déjà le cas car c'est un update et pas un create

⚠ conflicts to resolve

authors: mathieuripert navidemad


text:
Legend labeling simplification

Number and labeling of categories is slightly hard to parse visually.

Idea for adjustment:
100% - green
75% - yellow
50% - dark yellow
25% - orange
0% - red
@ann26 thoughts?

Yeah, sounds good - still have a draft issue around (in a tab) with other areas we'd want to add/amend text

Something like this @smit1678 ?

with the value completeness:
100% means 100% complete
75% means 75% - <100% complete
50% means 50% - <75% complete
25% means 25% - <50% complete
0% means <25% complete

@ann26 👍  yes, this looks good

repo: hotosm/field-campaigner


text:
Indexing does not complete

When testing the oauth-login branch on the production oin-hotosm S3 bucket, the indexing does not fully complete. It seems to run about 30 seconds and only indexes about 111 images. When it reruns the next time, it doesn't index any new files either.
This is seen when running the API locally using Docker. Subset of the logs here.
@tombh have you seen this behavior?

To add some information here:

on the oin-hotosm-staging bucket, local API indexes 144 images. But on our staging API, we only have 41. I think there are more than 144 images on our staging bucket; it's been around for a while
when uploading through staging environment, images show up and are indexed on the staging API. But when uploading to the staging bucket from a locally running API and browser, the images show up locally but are not indexed on the staging API.

To update here, discussed with @tombh that this may be fixed by #104. This needs to be tested and confirmed with that PR.

repo: hotosm/oam-catalog


text:
[Bug]: RTL glitches and i18n missing strings

Version

[x] I'm using version 1.15.1

Known issues

[X] I've checked Known issues

Existing issues

[X] I've checked Existing issues

Advanced Preferences

[X] I've checked Advanced Preferences

What operating system are you using?
macOS
Operating System Version
Sonoma 14.2.1
Reproduction steps

Switch to Hebrew or Arabic
Open the preferences

Reproduces how often: Always
Expected Behavior
Should align neatly
Actual Behavior
Some elements misbehave and some are not translated
The top bar is aligned to the left.
The text under the heart icon is LTR.
The words seconds and minutes are untranslated.
The speaker icon is too close to the text.
Relevant log output
No response
Preferences
No response
Additional information

Code of Conduct

[X] I agree to follow this project's Code of Conduct

Hi,
translations are community effort, you can help here: https://hosted.weblate.org/projects/stretchly/
Unfortunately, I don't speak Hebrew or Arabic so not sure how it should look like. PRs would be appreciated.

@hovancik I am translating this project already :)
The problem is the RTL alignment and the fact that these terms are translated yet appear in the native language regardless, as you can see in the screenshots.

Gotcha, the syncing process to the app is manual, so new translations appear once I make a new version.

Hmmm I highly doubt that, this string was translated around 2 years ago:
https://hosted.weblate.org/translate/stretchly/stretchly/he/?q=minutes&sort_by=-priority%2Cposition&checksum=#history
And it was submitted to the repository:
https://github.com/hovancik/stretchly/blob/7038e073e6048f6f55a292595fbdef01eec2e334/app/locales/he.json#L205
It looks like an i18n issue, I can't verify it with other languages but it does look like it.

Seems like we have it wrong?
    "minutes_one": "דקה",
    "minutes_two": "{{count}} דקות",
    "minutes_many": "{{count}} דקות",
    "minutes_other": "{{count}} דקות",

This https://jsfiddle.net/6bpxsgd4 suggests it should be _one, _two, _other. But not sure why extra element would be an issue.

Ah, other languages have the same issue, will try to look at it. Do you remember if this was issue as well in previous versions?

So it seems it's not issue with i18next but with how I am refreshing translations after changing language. Can you try hitting Cmd+R after changing the language? For me I can see correct translations then:

Or after Stretchly restarts / Preferences gets reopened

Thank you!
What about the RTL glitches I've  mentioned?

Could you please explain / show how the correct one should look like? It's hard for me to imagine what is wrong
The top bar is aligned to the left.
The text under the heart icon is LTR.

Settings should be rightmost, then Scheduling, Themes and About, while the support button should appear leftmost.
Regarding the text on the support button, this is the right form:
תמיכה ב־Stretchly (Starting from the right).
The current wrong layout is:
תמיכה ב־Stretchly
It looks like Stretchly Support instead of vice versa.
Thanks :)

Thanks, regarding Support button, I guess translation should be changed? "heart": "תמיכה ב־Stretchly",
Others seems to fit:

Ah, I think I found it. Is this correct?

Great! It looks way better!
The "Preferred language" box has its combobox arrow aligned to the right instead of left but I think it's a small price to pay after all the great job you've been doing, thank you :)

Thanks for all the feedback, I think I was able to fix the select as well :)

Thank you so much!
One last thing that I've noticed and I'm not sure it's possible to fix without setting the whole system to RTL:

This is what I see on Linux, but no idea what the correct way is:

From what I read in Electron docs, there is no such an option in Menus :(

authors: hovancik yarons

repo: hovancik/stretchly


text:
Full screen not working

I just installend Stretchly and like it a lot. But the fullscreen option (breaks are fullscreen) does not work: the popup is not fullscreen but fills only about 1/4 part of my screen.
Is that how it suposed to work?

Hi there,
this is a bug, which I have already fixed. I am gonna release new version during weekend ;]

Hi, sounds great. Thank you :)

Hi. Does not work for me and it's not fullscreen. The content looks like it is fullscreen but the container is normal size so the content is cropped! @hovancik

@mrdimaan are you on Linux? If yes, there is a known bug in electron ;[

@hovancik is there a way to perhaps pass the initial window size through the command line on Linux? This bug is nasty

@illright not sure, what do you mean?

Well, currently, when the break comes up in non-fullscreen mode, the window is of certain size. I was thinking that if this size could be changed by the Electron config or command-line parameters, maybe we could use it as a temporary workaround

authors: albert-cb hovancik illright mrdimaan


text:
why convo.on() and .trigger() aren't in docs?

dont you recomend its use?

No there is no great reason, other than they are rarely used. You can see examples of their usage peppered throughout the docs alongside more detailed explanations of arguably more useful functions.

authors: adantoscano peterswimm

repo: howdyai/botkit

license: mit


text:
Unable to save received files

Hi, I'm using crocgui on a Xiaomi 11T with MIUI Global 12.5.5.
Whenever I try to send a file to my device it seems to download correctly, but after it finishes getting it, a file explorer pops up, and it doesn't show any way to save the file. If some screenshots or logs would be of help, I'm happy to provide them.

screenshots would help
Also, are you able to try "Fyne Demo" on the google play store? Just to see if the save/file dialog works there.

Also, are you able to try "Fyne Demo"

So according to that application, the File Save dialog does not work on my device, but the Folder Open dialog does. So, the window I get showed whenever I receive a file is the Folder Open one.
Also, here are some screenshots. Before downloading, everything works like normal. After it finishes getting the file, the Folder  Open dialog appears, which doesn't have any options to save the file. If I select a file and click on confirm, it goes back to the app and shows that error while freezing it. If I just cancel, the app crashes.

I think your best bet is to get the "fyne demo" to do file save, as all I do is use fyne. I don't know how to help you.

Hi again. This apparently was a problem with MIUI that seems to be fixed in its version 13.
Will be closing the issue for now

authors: Katzenwerfer howeyc

repo: howeyc/crocgui

license: ISC


text:
Hybrid Parallel Plugin下TP显存比同配置下deepspeed要高？？？

您好，请问下为啥Hybrid Parallel Plugin下TP显存比同配置下deepspeed要高？？？

好像是显存碎片造成？而且很严重，请问下有对应的优化改进措施吗？

repo: hpcaitech/ColossalAI


text:
Added functionality to grab vlan-tagged iscsi ports with getPorts()

Problem: the hp3parclient doesn't see vlan-tagged iscsi ports because
the WSAPI API doesn't provide that port data from the '/ports' endpoint.
This is bad for two reasons: it disables users from making use of the client
when they have vlan-tagged iscsi ports and it stops the Openstack Cinder
driver from connecting servers to 3par nodes for making volumes.
Solution: I added code to getPorts() to execute the 'showport -iscsivlans'
command when SSH is set up and then create cloned dictionaries of the physical
ports in the port list with the IP/vlan address information switched out.  To
facilitate parsing of the ssh command I created the ShowportParser which is
extensible if needed.
old workflow: get ports from WASPI '/ports' -> return ports
new workflow: get ports from WSAPI '/ports' ->
if SSH is enabled, run 'showport -iscsivlans' ->
search the ports list for physical ports with the same information as the vlan ports ->
make copies of those ports and append them to the list of ports ->
update the members count->
return ports.

Thanks for your pull request on adding support for querying iscsi vlan tags. Please check the review comment given above.

Closing this PR and will re-open again to trigger a travis CI build explicitly.

Changes in this PR will be referenced in https://github.com/hpe-storage/python-3parclient/pull/59 , since we have to do some additional fixes on top of this original PR.

authors: Ctesias hpe-storage wdurairaj


text:
SC-5070 change hard coded school ids according to the seed data

Description

Links to Tickets or other pull requests
https://github.com/hpi-schul-cloud/schulcloud-server/pull/1599
https://ticketsystem.schul-cloud.org/browse/SC-5070

Changes

Deployment

New Repos, NPM pakages or vendor scripts

Approval for review

[x] All points were discussed with the ticket creator, support-team or product owner. The code upholds all quality guidelines from the PR-template.

Notice: Please remove the WIP label if the PR is ready to review, otherwise nobody will review it.

Link to Definiton of Done
More and detailed information on the definition of done can be found on Confluence

was merged in another PR by @Metauriel. This PR will be closed.

authors: pkleybolte yuliashikhareva

repo: hpi-schul-cloud/integration-tests


text:
linebreaks for long messages

Closes #217

Messages werden aktuell immer mit 50px abstand zur vorherigen message geadded, was aber nicht mehr für die neuen längeren messages reicht, hier stattdessen bitte mehr abstand einfügen, damit die sich nicht überlagern

das geht nicht mit mehr abstand
da muss sich jemand ransetzen und iwie rauskriegen wie wir die messages spacen

vresize etc wird nicht bei height eingerechnet glaube ich

hast du das schon gefixed mit den überlappenden messages?

Yes ist gefixed

authors: Mrnikbobjeff rohansaw

repo: hpi-swa-teaching/TelegramClient


text:
Tsserver now provides snippet completion, does this unblock arg ghost-test in completions?

According to neovim/nvim-lspconfig#1259 tsserver supports snippet completion now. Does this mean that ghost-text for args can now work?  Is there something that needs to be set in capabilities to get it working?
Apologies if I'm misunderstanding the issue.
Previously closed issue for reference:
The ghost text content is determined by the LSP server (or custom source).
For example, gopls will show the function arguments as ghost text. So it is depending on the your server. I can't support it in nvim-cmp. Sorry.

Originally posted by @hrsh7th in https://github.com/hrsh7th/nvim-cmp/issues/503#issuecomment-964444450

Looking at the linked pull request to the TS repository (https://github.com/microsoft/TypeScript/pull/43149), I'm inclined to believe that there has been a misunderstanding here. TSServer currently implements snippet completions only for autoimports, and not for filling out function call parameters. Here's the closest I could find to a "tracking issue" for support of snippets in TSServer: https://github.com/microsoft/TypeScript/issues/25207, and it says that "method completions are currently implemented by VSCode manually" (a look into the built-in VSCode extension for Typescript confirms that: 1, 2, 3). So yeah, typescript-language-server does, in fact, support snippets in completion, just not the kind of snippets you were hoping for.

@dmitmel Please ignore my ignorance, JS is a complicated ecosystem. I have seen this release a while ago and tried to set it up with no success. I am referring to second item on the list:

feat: add support for snippet completions for methods/functions (#303)

Oh, I think I have found the issue. The PR you mentioned, https://github.com/typescript-language-server/typescript-language-server/pull/303, does implement this functionality, and typescript-language-server does return snippets for function calls if you set the setting completions.completeFunctionCalls, but it does so in the completionItem/resolve method, and not with the initial batch of completions requested in textDocument/completion. cc @hrsh7th: nvim-cmp should respond to updates of insertText in completionItem/resolve.

Thanks @dmitmel

Hm... The LSP spec seems to define the resolvable properties in capabilities.
OK. I'll add it.


text:
Improve context handling

toooooo difficult

Oh yah I've been bothered by seeing lsp suggestions in comments or have snippet suggestion while doing rust magic completion.
If you need any help or have a question just ping me 🙏

It can't solve in this PR, I think.
I will check rust-analyzer's behavior.

snippet suggestion can be solved (but that is not depends on this PR. We should implement in another PR).

Could you maybe add some docs for this new feature? :upside_down_face:

This PR is just a general improvement of context handling.
But one feature was added that will invoke new completion after confirmation by pressing <CR>, if if a trigger character has found.

The new feature will be useful if you are writing css.
For example, old compe does not invoke new completion if font-si|<CR> -> font-size: |;.
But new compe will invoke completion so you can look 0em/0px/0em as completion candidates.

This doesn't seem to work for me. Then I type:
fo-si

I get font-size property completion item, but no snippet. Selecting property completion does not insert ; at the end of the line nor it triggers another completion for units.

Ah. Sorry.
If you use nvim-lspconfig, your css-ls is old.
I'm using vscode-css-language-server.
You can install it via npm i -g vscode-langservers-extracted

It works, beautiful, thanks a lot!

Ah, is it worth also replacing html and json server from those suggested in lspconfig? Are your versions superior?

Yes. All my versions are better than old one.


text:
sbt 1.4.9 / switch to github download / scala 3 preparations

fixes #131

@hseeberger maybe we can just drop 2.11.x from now on as 3.x should arrive soon?

repo: hseeberger/scala-sbt


text:
Update sbt to 1.9.4

About this PR
📦 Updates org.scala-sbt:sbt from 1.6.2 to 1.9.4
📜 GitHub Release Notes - Version Diff
Usage
✅ Please merge!
I'll automatically update this PR to resolve conflicts as long as you don't change it yourself.
If you'd like to skip this version, you can just close this PR. If you have any feedback, just mention me in the comments below.
Configure Scala Steward for your repository with a .scala-steward.conf file.
Have a fantastic day writing Scala!

⚙ Adjust future updates
Add this to your .scala-steward.conf file to ignore future updates of this dependency:
updates.ignore = [ { groupId = "org.scala-sbt", artifactId = "sbt" } ]

Or, add this to slow down future updates of this dependency:
dependencyOverrides = [{
  pullRequests = { frequency = "30 days" },
  dependency = { groupId = "org.scala-sbt", artifactId = "sbt" }
}]

labels: library-update, early-semver-minor, semver-spec-minor, version-scheme:early-semver, commit-count:1

Superseded by #150.


text:
internal(demo): static export deploys

:house: Internal

internal(demo): mv demo site out of ./src to ./
internal(demo): update doc pages relative paths
internal(demo): static export deploys
internal(demo): run prettier

closing in favor of https://github.com/hshoff/vx/pull/748

repo: hshoff/vx


text:
建议

直接说了
1、添加“访客“功能，可以直接打开。不需要登入，只能看到访客才能看到的内容；
2、添加”管理员“选项，在右下角的菜单栏添加管理员登入选项，只有进入管理员才能有编辑权限，同时能看到一些管理员才能看到的分组；
3、添加”编辑模式开关“在右下角的菜单栏添加编辑模式开关选项，管理员状态下，只有打开编辑模式才能编辑，这样可以防止误修改；
4、添加”分组“功能，可以建立分组，同时可以设置分组的权限，是否属于私有分组；
5、添加”权限“功能，可以对分组、进行权限设置，因为对单个网页去分配权限排版比较麻烦，分组却比较方便；
6、添加”拖拽“通过鼠标拖拽更加方便调整位置。
以上是我个人的建议，也是我个人对项目的理解，若有冒犯，请包涵。

同时感谢作者，开发一套符合国人的审美的导航项目

repo: hslr-s/sun-panel


text:
Roadmap for v1.0.0

Hi! I'll resume developing the template and this is my roadmap:
Requirements for v1.0.0

[x] Support kss-node v2.x
[ ] Publish to package managers (npm, bower)
[ ] More compatibility with user css (https://github.com/htanjo/kss-node-template/issues/7)
[ ] Update document and demo

Feature plans in v1.x

Responsive design
Permalink of each section
Copy to clipboard (like Bootstrap docs)

If you have any ideas, feel free to tell me. PR is also welcome!

I drop some features from 1.0.0 for quick release.

repo: htanjo/kss-node-template


text:
Session Cookie set secure attribute

In the case that my tide application is behind a reverse proxy that terminates https, I need a way to override the session middleware from using the scheme to set whether to set secure to true or not on the session cookie.

This is broadly an unresolved issue in tide — there needs to be a configuration that's the equivalent of https://expressjs.com/en/guide/behind-proxies.html, but tide doesn't currently have a notion of configuration

I threw together a PR that address this by just allowing you to configure the session middleware.
I ended up just copying the session middleware into my app and doing something similar so I could override it. I noticed that my reverse proxy includes an X-Forwarded-Proto. I also noticed in the express link you posted that they can look at the proto via the X-Forwarded-Proto header. The middleware is pulling the scheme off the request url. If it could ask for the proto in a more dynamic way, much like .remote() and .host() on Request, I think tide could continue to set the secure attribute dynamically.
I also like what your express link is doing, and it could easily solve these issues. In thinking about using Tide to get there, I could probably do quite a bit of the work via Middleware, like rejecting requests if they didn't come from a trusted proxy. However I think having a function that helps me (and anyone else in the stack) get the scheme/proto in a consistent way is probably going to be the biggest hurdle in having it work with the session middleware.
Another thought, In implementing some of the same site params, I noticed that they have some requirements on being able to set SameSite=None when you don't set Secure. Is this something we want the middleware to worry about when setting the cookie?

A solution that worked for me was this middleware that rewrites the url according to the X-Forwarded-Proto or Forwarded headers.
use async_trait::async_trait;
use tide::{Middleware, Next, Request};

pub struct ReverseProxyMiddleware {}

#[async_trait]
impl<State: Clone + Send + Sync + 'static> Middleware<State> for ReverseProxyMiddleware {
    async fn handle(&self, mut req: Request<State>, next: Next<'_, State>) -> tide::Result {
        let ll_req: &mut tide::http::Request = req.as_mut();
        let forwarded = tide::http::proxies::Forwarded::from_headers(ll_req)?.clone();

        if let Some(forwarded) = forwarded {
            // here we clone stuff, because we need to mutable borrow the ll_req (forwarded object keeps Cow refs)
            let host = forwarded.host().map(|h| h.to_string());
            let proto = forwarded.proto().map(|p| p.to_string());

            let url = ll_req.url_mut();
            if let Some(host) = host {
                url.set_host(Some(&host))?;
            }
            if let Some(proto) = proto {
                url.set_scheme(&proto).unwrap(); // kinda wonky, but dunno what error should I return
            }
        }
        Ok(next.run(req).await)
    }
}

Please notice, that this is quite a naive solution, as it doesn't whitelist the address of reverse proxy, making it kinda insecure in some configurations

authors: DCNick3 jbr murphysean

repo: http-rs/tide


text:
Unclear support for client basic authentication (secure or insecure)

I was looking forward to use http4s to query a server that provides json-ld content.
I managed to do this with jsonld-java.
It is unclear to me how to do the equivalent with http4s.

I figured it out.
I think that the doc could explain the different kinds of headers one can use with http4s.
Currently, the topic of authorization is explained from the perspective of a service; which is important, but substantially different from client requests.
For example, it could be helpful to have a synopsis of basic authentication for client requests like this:
val httpClient = PooledHttp1Client(config =
    // Choose one of the two.
    BlazeClientConfig.default
    // BlazeClientConfig.insecure
)
val uri: Uri = Uri.fromString(....)
val req = Request(Method.GET, uri, Headers(Authorization(BasicCredentials("<username>", "<password>"))))
val task = httpClient.expect[<type>](req)

I've wondered about a .withBasicAuth(username, password) method as a convenience for this.  Shortcuts like that could get out of hand, but maybe useful for a few common cases.
Either way, it's worth documenting.

I definitely agree about documenting this; I'm skeptical about adding convenience methods.
I presume you're talking about a syntax like this:
val req = Request(Method.GET, uri).withBasicAuth(username, password)

that would be the equivalent of:
val req = Request(Method.GET, uri, Headers(Authorization(BasicCredentials(username, password))))

I'm skeptical because the convenience method hides the fact that authentication is header information. The savings in syntax doesn't seem to me worth the fact that this convenience method will have to be documented and would only diminuish the minimalistic nature that http4s is intended to be.

Not strongly for or against adding a helper, but one argument for is it increases discoverability.  If I'm in IntelliJ or Ensime, it's probably easy to find withBasicAuth() using auto-complete.  Another keystroke or two lets me see how it is implemented.  Docs achieve the same, but they're more detached from the process of writing code.

It depends on where the helper is defined.
It would be convenient to define it on Request; however, it could mislead a developer in thinking that authentication is a property of a request, thereby writing code like this:
val req1 = Request(....).withBasicAuth(username, password)
...
val req2 = Request(....).withBasicAuth(username, password)
...

Wouldn't it be preferable to encourage writing instead:
val h = Headers(Authorization(BasicCredentials(username, password)), ....)
val req1 = Request(..., headers=h, ...)
...
val req2 = Request(..., headers=h, ...)
...

I think the point above, keeping common authorization in a val (or even a simple middleware), is persuasive.

authors: NicolasRouquette bfritz rossabaker


text:
Header.Select needs a method like from that preserves ParseFailures

I'm working on updating Rho to support the new header redesign. One of the issues I've run into is Rho prefers to throw errors for headers that fail to parse, and the new header redesign appears to prefer simply ignoring the errors?

Can we get a method on Header.Select that doesn't convert the Either to Option?
Should this same type of method exist on Headers?
Should this method preserve every parse error or just the first in the case of Recurring?
Would we prefer something like:

List[Header.Raw] => Either[ParseFailure, F[A]]
List[Header.Raw] => F[Either[ParseFailure, A]
List[Header.Raw] => EitherNel[ParseFailure, F[A]]

Happy to submit a PR, just need advice and guidance.

I think this might be a rare use case for Ior, specifically Ior[NonEmptyList[ParseFailure], F[A]].  "Tell me everything you had to throw away, but give me a value if you can."

On the happy path, we get an Ior.Right.
If it's total garbage, we get an Ior.Left.
If it's a recurring header and m of n are bad, for 0 <  m < n, we'll get an Ior.Both with the good values and warnings of what we choked on, and the caller can decide what to do about it.

/cc @SystemFw.  This was all his brainchild.

authors: rossabaker zarthross


text:
Add simple ResponseTiming middleware and test

Uses implicit Clock[F] to time from headers parsed to response started
Adds header to Response, named "X-Response-Time" be default

For #2014

Thanks!

This failure is #2199.
This failure is #2192.

I'm busy with blaze and test stability, so I'm relying others to review the code.

authors: gstro rossabaker


text:
Access-Control-Max-Age header

Here it's the changes that introduce management of the header Access-Control-Max-Age.
I'm still missing some parsing internals, but I think it could be a good starting point.
The reference issue is #5010

I saw that the CI build failed. However, the test that didn't pass doesn't seem to depend on the code I pushed. I supposed there is some non-deterministic test that exceeded the timeout.

Hey, @rossabaker. Sorry for the ping. I want to know if there is any problem with the PR. It's my first contribution, and I probably made something wrong 😄.
Let me know.

I closed this PR since I just opened PR #5171 to the right branch.


text:
HTTPie doesn't apply type checking to the top-level lists

Checklist

[x] I've searched for similar issues.
[x] I'm using the latest version of HTTPie.

Minimal reproduction code and steps
http httpbin.org/post '[1]=1' '[2]=2' x=5 --offline

Current result
POST /post HTTP/1.1
Accept: application/json, */*;q=0.5
Accept-Encoding: gzip, deflate
Connection: keep-alive
Content-Length: 32
Content-Type: application/json
Host: httpbin.org
User-Agent: HTTPie/3.0.0

{
    "": [
        null,
        "1",
        "2"
    ],
    "x": "5"
}

Expected result
HTTPie Type Error: Can't perform 'key' based access on '' which has a type of 'array' but this operation requires a type of 'object'.

Debug output
Please re-run the command with --debug, then copy the entire command & output and paste both below:
$ http httpbin.org/post '[1]=1' '[2]=2' x=5 --offline --debug
HTTPie 3.0.0
Requests 2.22.0
Pygments 2.7.2
Python 3.8.5 (default, May 27 2021, 13:30:53)
[GCC 9.3.0]
/usr/bin/python3
Linux 5.10.81.1-microsoft-standard-WSL2

<Environment {'as_silent': <function Environment.as_silent at 0x7ff7f371c550>,
 'colors': 256,
 'config': {'default_options': []},
 'config_dir': PosixPath('/home/ducaale/.httpie'),
 'devnull': <property object at 0x7ff7f3af47c0>,
 'is_windows': False,
 'log_error': <function Environment.log_error at 0x7ff7f371c5e0>,
 'program_name': 'http',
 'stderr': <_io.TextIOWrapper name='<stderr>' mode='w' encoding='utf-8'>,
 'stderr_isatty': True,
 'stdin': <_io.TextIOWrapper name='<stdin>' mode='r' encoding='utf-8'>,
 'stdin_encoding': 'utf-8',
 'stdin_isatty': True,
 'stdout': <_io.TextIOWrapper name='<stdout>' mode='w' encoding='utf-8'>,
 'stdout_encoding': 'utf-8',
 'stdout_isatty': True}>

<PluginManager {'adapters': [],
 'auth': [<class 'httpie.plugins.builtin.BasicAuthPlugin'>,
          <class 'httpie.plugins.builtin.DigestAuthPlugin'>,
          <class 'httpie.plugins.builtin.BearerAuthPlugin'>],
 'converters': [],
 'formatters': [<class 'httpie.output.formatters.headers.HeadersFormatter'>,
                <class 'httpie.output.formatters.json.JSONFormatter'>,
                <class 'httpie.output.formatters.xml.XMLFormatter'>,
                <class 'httpie.output.formatters.colors.ColorFormatter'>]}>

>>> requests.request(**{'auth': None,
 'data': b'{"": [null, "1", "2"], "x": "5"}',
 'headers': <HTTPHeadersDict('User-Agent': b'HTTPie/3.0.0', 'Accept': b'application/json, */*;q=0.5', 'Content-Type': b'application/json')>,
 'method': 'post',
 'params': <generator object MultiValueOrderedDict.items at 0x7ff7f337c7b0>,
 'url': 'http://httpbin.org/post'})

POST /post HTTP/1.1
Accept: application/json, */*;q=0.5
Accept-Encoding: gzip, deflate
Connection: keep-alive
Content-Length: 32
Content-Type: application/json
Host: httpbin.org
User-Agent: HTTPie/3.0.0

{
    "": [
        null,
        "1",
        "2"
    ],
    "x": "5"
}

Additional information, screenshots, or code examples
N/A

I don't think we have documented the top-level list functionality, so we probably need to discuss it from a few aspects.
Current implementation ensures these conditions and then if all checks out, it promotes the the value to a standalone object:

Is the resulted object has only one key?
Is the only present key an empty string?
Is the value for that key is a list?

{
    "": [...]
}

=>

[...]

Other objects, even if they have an empty string key with a list stay the same.
{
    "": [...],
    ...: ...
}

=>

{
    "": [...],
    ...: ...
}

So technically, this undocumented feature, supports stuff like this
$ http --offline --print=B pie.dev/post [a]=1 [b]=2

{
    "": {
        "a": "1",
        "b": "2"
    }
}

And this
https://github.com/httpie/httpie/blob/86ba995ad881a1a09b04c8088211c40329932256/tests/test_json.py#L318-L325
There are 3 possible things we could do to resolve this:

(1) Change it completely, don't allow top-level empty keys at all. Forbid usage of [...]=something syntax completely (where there is no key, unlike a[...]=something), unless ... is an integer (or empty, since it would be append then).
(2) Change it partially, what the initial issue suggests (forbid mixed operations).
(3) Do nothing, since technically this is the correct behavior under the spec. Not the most intutive one though.

I started to like 1, it seem to match be consistent on the correctness aspect. But I fear the bad side might hit us, which there is no way to create empty top-level keys:
$ http --offline --print=B pie.dev/post [a]=1 [b]=2

{
    "": {
        "a": "1",
        "b": "2"
    }
}

Unlike intermediary objects, which you could do this:
$ http --offline --print=B pie.dev/post a[b]:='{"": "x"}'

{
    "a": {
        "b": {
            "": "x"
        }
    }
}

2 is alright, since it would solve the basic problem in the hand. But doesn't feel like a long term solution.
Leaving it as is doesn't seem very intutitve, so I'd say we should handle it one way or another.

I recall that we discussed this previously on a discord thread, but there weren't any resolution. I think reconsidering that example might make sense under this discussion.

Thanks for explaining the current implementation.

I started to like 1, it seem to match be consistent on the correctness aspect. But I fear the bad side might hit us, which there is no way to create empty top-level keys:

I think @jakubroztocil mentioned in the same thread that it would still be possible to create empty top-level keys if the [string] syntax was banned:

Actually, the key part of key/value items is optional, so you can just pass =aaa or :=1 and you’ll get an empty key:
$ http --print=B --offline pie.dev/post :=1

{
   "": 1
}

Therefore, we don’t need the special [foo]=bar syntax for that.

Ah, I have missed that. If we have a way like that, we can safely embed nested data directly http --offline pie.dev/post ':={"foo": "bar"}'. I think in the light of this, we can implement something similiar to your suggestion. @jakubroztocil WDYT?
start: (literal | index_path | append_path) path*
literal: TEXT | NUMBER
path:
     key_path
     | index_path
     | append_path

authors: ducaale isidentical

repo: httpie/httpie


text:
fix -  get response data with jmespath when variable in validate field

- type_match: [body.data."$ids".id, int]

为了支持这种验证路径中有variable的情况
修改前会返回
check_item: body.data."$ids".id
check_value: body.data."2565".id(str)
assert_method: type_match
expect_value: int(str)

@ArthurSmoke Your PR will have some other compatible problems, such as the example below.
- eq: ["$var", 123]

The variable var is defined in variables or extracted from former teststep. In your PR, the variable will first be evaluated, assume it is 123, and then parsed with jmespath, which will get None.

@debugtalk  I can't see the working scenario for your example.
why to check extracted variable's value?
The scenario I mentioned above is more common

@ArthurSmoke Yes you're right. Thanks for your PR.

authors: ArthurSmoke debugtalk

repo: httprunner/httprunner


text:
Unable to install in andriod 11.

Performing Streamed Install
adb: failed to install pinning-demo.apk: Failure [INSTALL_PARSE_FAILED_NO_CERTIFICATES: Failed collecting certificates for /data/app/vmdl1878923663.tmp/base.apk: Failed to collect certificates from /data/app/vmdl1878923663.tmp/base.apk: Attempt to get length of null array]```

Hmm, that's weird. I must've forgotten to sign that. I've just signed an updated version - can you test out the new APK at https://github.com/httptoolkit/android-ssl-pinning-demo/releases/tag/v1.2.1 and let me know if it works for you?

@pimterry installs properly now. Thanks.

@pimterry installs properly now. Thanks.

repo: httptoolkit/android-ssl-pinning-demo


text:
Create module to analyse and visualise the different scenarios

Include plots and export results.


text:
CPU usage when train

hello, thanks your clean code.
But i found a strange phenomenon that is my cpu usage is very high(almost 100% usage per kernel spied by linux system monitor) so that it run smoothly and stop for a while and continue run...
Have you also experienced this phenomenon when training?What may cause this phenomenon in code?

BTW, its GPU usage is not so tight as cpu usage

Different from other implementation on Siamese trackers. This demo directly crop trian image in original GOT10K dataset rather than crop the whole dataset before train. So during the train process, there will be a big burden on CPU. I have tried this demo on I7 9700k CPU RTX2080Ti GPU, it will taken 100% usage of CPU while token no more than 5% usage of GPU. If you don't have a powerful CPU and large RAM, I strongly recommend you to crop the training datasets for the first time.

authors: conquerhuang laisimiao

repo: huanglianghua/siamfc-pytorch


text:
固定列和缩放边栏造成表格显示异常

这是侧边栏显示展开之后刷新页面，显示正常，然后收缩侧边栏，固定最左列，最左列会被拉动，跟其他列分离。

这是侧边栏收缩或刷新页面，显示正常。然后展开侧边栏，固定最左列，最左列会被向右挤，跟其他列重合

收到，尽快修复

你好这个问题修复了没
https://github.com/huangshuwei/vue-easytable/issues/78

The new version has solved this problem.
Please use version 2.0

The new version has solved this problem.
Please use version 2.0

authors: huangshuwei iTestinglab vcrh88

repo: huangshuwei/vue-easytable


text:
run error

localhost:MeiTuan Leo$ npm install
npm WARN peerDependencies The peer dependency react@* included from react-navigation will no
npm WARN peerDependencies longer be automatically installed to fulfill the peerDependency
npm WARN peerDependencies in npm 3+. Your application will need to depend on it explicitly.
npm WARN peerDependencies The peer dependency react@* included from react-native-tab-view will no
npm WARN peerDependencies longer be automatically installed to fulfill the peerDependency
npm WARN peerDependencies in npm 3+. Your application will need to depend on it explicitly.
npm WARN deprecated connect@2.30.2: connect 2.x series is deprecated
npm WARN peerDependencies The peer dependency react@* included from react-native-drawer-layout will no
npm WARN peerDependencies longer be automatically installed to fulfill the peerDependency
npm WARN peerDependencies in npm 3+. Your application will need to depend on it explicitly.
npm ERR! Darwin 16.7.0
npm ERR! argv "/usr/local/Cellar/node/8.2.1/bin/node" "/usr/local/bin/npm" "install"
npm ERR! node v8.2.1
npm ERR! npm  v2.15.0
npm ERR! code EPEERINVALID
npm ERR! peerinvalid The package react@16.0.0-alpha.6 does not satisfy its siblings' peerDependencies requirements!
npm ERR! peerinvalid Peer react-native@0.44.0 wants react@16.0.0-alpha.6
npm ERR! peerinvalid Peer react-navigation@1.0.0-beta.11 wants react@*
npm ERR! peerinvalid Peer react-test-renderer@16.0.0-alpha.6 wants react@^16.0.0-alpha.6
npm ERR! Please include the following file with any support request:
npm ERR!     /Users/Leo/ReactNativeProjects/MeiTuan/npm-debug.log

I have solved this problem:
https://stackoverflow.com/questions/45148532/cant-install-react-transition-group

repo: huanxsd/MeiTuan


text:
Reindex error

I did a reindex on TEST with the latest PROD neo4j copy using the test-release branch, which uses the refactored entity-api and refactored indexer. At the time the reindex was executed, the test-release branch had already merged the PR #242
Example error:
[2021-03-06 19:38:04] ERROR in indexer: Exception encountered during executing indexer.update_index() for uuid: 4e8d64722e354aa4c14def7009440c19
Traceback (most recent call last):
  File "/usr/src/app/src/elasticsearch/indexer.py", line 508, in update_index
    transformed = json.dumps(transform(json.loads(doc)))
  File "/usr/src/app/src/elasticsearch/addl_index_transformations/portal/__init__.py", line 145, in transform
    add_partonomy(doc_copy)
  File "/usr/src/app/src/elasticsearch/addl_index_transformations/portal/add_partonomy.py", line 30, in add_partonomy
    ancestor_list = _get_ancestors_of(uri, index)
  File "/usr/src/app/src/elasticsearch/addl_index_transformations/portal/add_partonomy.py", line 36, in _get_ancestors_of
    node = index[node_id]
KeyError: 'http://purl.org/sig/ont/fma/fma15828'

And a list of uuids that threw this error:
[2021-03-06 19:03:19] ERROR in indexer: Exception encountered during executing indexer.update_index() for uuid: 3d2bc79885fc7720f77fddd2c23f02e5
[2021-03-06 19:04:06] ERROR in indexer: Exception encountered during executing indexer.update_index() for uuid: 5f043da4d6347e2b6f93509c000804d1
[2021-03-06 19:04:34] ERROR in indexer: Exception encountered during executing indexer.update_index() for uuid: d093d6563dad2457356074c3781d9bea
[2021-03-06 19:05:07] ERROR in indexer: Exception encountered during executing indexer.update_index() for uuid: 17cdad1671514b52baaeee599fa06ebf
[2021-03-06 19:05:11] ERROR in indexer: Exception encountered during executing indexer.update_index() for uuid: 39c3c7a6fb9f98c346065eb771febd08
[2021-03-06 19:09:33] ERROR in indexer: Exception encountered during executing indexer.update_index() for uuid: 074c96e0c614d3f8132a60afdd536db4
[2021-03-06 19:09:47] ERROR in indexer: Exception encountered during executing indexer.update_index() for uuid: 960f1766a95573bb5ccd5e45c81a7e1b
[2021-03-06 19:11:07] ERROR in indexer: Exception encountered during executing indexer.update_index() for uuid: 988d21f5795b193ba51a7e00b1574ddf
[2021-03-06 19:11:34] ERROR in indexer: Exception encountered during executing indexer.update_index() for uuid: f50b8ce55392beae9fa0547a81288f25
[2021-03-06 19:14:03] ERROR in indexer: Exception encountered during executing indexer.update_index() for uuid: 4fb887c5b17d203e20143d9044c0bf94
[2021-03-06 19:14:59] ERROR in indexer: Exception encountered during executing indexer.update_index() for uuid: 8d593ea6872956bb98ced0e9b8fda5c8
[2021-03-06 19:15:24] ERROR in indexer: Exception encountered during executing indexer.update_index() for uuid: ef2f2dc788ae3e63ed9649d69c3ec7f5
[2021-03-06 19:15:57] ERROR in indexer: Exception encountered during executing indexer.update_index() for uuid: 7000456f479ecdd3a5c7f4ba70ada709
[2021-03-06 19:36:01] ERROR in indexer: Exception encountered during executing indexer.update_index() for uuid: 01b0f11f3fc13542c6d837cc47712b85
[2021-03-06 19:36:11] ERROR in indexer: Exception encountered during executing indexer.update_index() for uuid: ba906793fcba084898ac24e850d5a964
[2021-03-06 19:36:15] ERROR in indexer: Exception encountered during executing indexer.update_index() for uuid: 798978f4efbbbe2d061651bd1460a9c3
[2021-03-06 19:36:23] ERROR in indexer: Exception encountered during executing indexer.update_index() for uuid: 3f431785d52ce16e00102749e5eca384
[2021-03-06 19:36:27] ERROR in indexer: Exception encountered during executing indexer.update_index() for uuid: 84089f9d892b2a3f580d078ce2423656
[2021-03-06 19:36:48] ERROR in indexer: Exception encountered during executing indexer.update_index() for uuid: 191050c2ef9bb9314d0057b48e31ab0d
[2021-03-06 19:36:51] ERROR in indexer: Exception encountered during executing indexer.update_index() for uuid: 7c504503496b18f731a95e844884f591
[2021-03-06 19:37:01] ERROR in indexer: Exception encountered during executing indexer.update_index() for uuid: 2aefc156eeab64b7ca8efc49425f39c0
[2021-03-06 19:37:04] ERROR in indexer: Exception encountered during executing indexer.update_index() for uuid: f3f064df9fba093884256bf9f99aacaa
[2021-03-06 19:37:12] ERROR in indexer: Exception encountered during executing indexer.update_index() for uuid: 379708792c96e7679337c17651551950
[2021-03-06 19:37:19] ERROR in indexer: Exception encountered during executing indexer.update_index() for uuid: 32e38bed28499ae00c3b2c45831bc9b4
[2021-03-06 19:37:36] ERROR in indexer: Exception encountered during executing indexer.update_index() for uuid: eb580ab691158f63336056cbb9920f5b
[2021-03-06 19:37:40] ERROR in indexer: Exception encountered during executing indexer.update_index() for uuid: 5a743beb0514fc5c6d80c58342c645d9
[2021-03-06 19:37:47] ERROR in indexer: Exception encountered during executing indexer.update_index() for uuid: e639a1b529940388a533ef0124c69ac9
[2021-03-06 19:37:57] ERROR in indexer: Exception encountered during executing indexer.update_index() for uuid: 51cb57b4d8dd205b9c60a9f1daf599f8
[2021-03-06 19:38:04] ERROR in indexer: Exception encountered during executing indexer.update_index() for uuid: 4e8d64722e354aa4c14def7009440c19

@mccalluc any insights?

Can you provide me with the JSON for a document which errors? I may not be looking in the right place... In order to get to the line that throws the error, we need to pass both these checks:
    if 'rui_location' not in doc:
        return
    rui_location = loads(doc['rui_location'])

    if 'ccf_annotations' not in rui_location:
        return
    ccf_annotations = rui_location['ccf_annotations']

but taking the first UUID in the list as an example:

https://portal.hubmapconsortium.org/browse/sample/4e8d64722e354aa4c14def7009440c19.json does not contain rui_location
https://portal.test.hubmapconsortium.org/browse/sample/4e8d64722e354aa4c14def7009440c19.json is 404, even when logged in.

@bherr2 -- Assuming a reproducing document can be found, that URI is not what I expect to see. What I expect is something like this example:
  "ccf_annotations": [
    "http://purl.obolibrary.org/obo/UBERON_0001157"
  ],

... and I'm expecting the URI string to match the string in the partonomy-json-ld, where it's all UBERON. Is the data here wrong, or do I need to do more resolve it, or should I skip URIs which don't match, instead of throwing an exception?

Hmm we did have some fma nodes in the partonomy before. I wouldn't assume it's just from Uberon or that the partonomy necessarily has all annotations. But ya I think for your purposes just ignore the nodes you don't recognize. A longer term solution involves looking up the terms using a service a la Jonathon Silverstein's solution.

@mccalluc here is the JSON returned from entity-api for 4e8d64722e354aa4c14def7009440c19 which had that error.
{
    "created_by_user_displayname": "Marda Jorgensen",
    "created_by_user_email": "marda@ufl.edu",
    "created_by_user_sub": "694c6f6a-1deb-41a6-880f-d1ad8af3705f",
    "created_timestamp": 1614800407532,
    "data_access_level": "consortium",
    "description": "NBF fixed lower 5mm from a 1cm cube collected from against the hilum",
    "direct_ancestor": {
        "created_by_user_displayname": "Marda Jorgensen",
        "created_by_user_email": "marda@ufl.edu",
        "created_by_user_sub": "694c6f6a-1deb-41a6-880f-d1ad8af3705f",
        "created_timestamp": 1614089582575,
        "data_access_level": "consortium",
        "description": "1cm slab through CCF-3",
        "entity_type": "Sample",
        "group_name": "University of Florida TMC",
        "group_uuid": "07a29e4c-ed43-11e8-b56a-0e8017bdda58",
        "hubmap_id": "HBM948.SJCG.773",
        "image_file_metadata": [
            {
                "description": "Section with hilum at top facing up",
                "filepath": "/hive/hubmap/data/uploads/07a29e4c-ed43-11e8-b56a-0e8017bdda58/25f25864816a790ec6868744eef15ec9/HuBMAP 21-010 Spleen CC3 Region (3rd Cut).JPG"
            }
        ],
        "lab_tissue_sample_id": "21-010 Spleen CCF-3",
        "last_modified_timestamp": 1614089582575,
        "organ": "SP",
        "protocol_url": "dx.doi.org/10.17504/protocols.io.bc3kiykw",
        "specimen_type": "organ_piece",
        "submission_id": "UFL0010-SP-3",
        "uuid": "71b342817e4c093c2ba8a4cb7812a285"
    },
    "entity_type": "Sample",
    "group_name": "University of Florida TMC",
    "group_uuid": "07a29e4c-ed43-11e8-b56a-0e8017bdda58",
    "hubmap_id": "HBM237.NWXR.445",
    "lab_tissue_sample_id": "21-010 SP-CC3 Block F",
    "last_modified_timestamp": 1614961892034,
    "last_modified_user_displayname": "Marda Jorgensen",
    "last_modified_user_email": "marda@ufl.edu",
    "last_modified_user_sub": "694c6f6a-1deb-41a6-880f-d1ad8af3705f",
    "organ": "SP",
    "protocol_url": "dx.doi.org/10.17504/protocols.io.bc3kiykw",
    "rui_location": {
        "@context": "https://hubmapconsortium.github.io/hubmap-ontology/ccf-context.jsonld",
        "@id": "http://purl.org/ccf/1.5/221301ef-b4de-48df-87da-624eeb9dba72",
        "@type": "SpatialEntity",
        "ccf_annotations": [
            "http://purl.org/sig/ont/fma/fma15828",
            "http://purl.org/sig/ont/fma/fma15837",
            "http://purl.obolibrary.org/obo/UBERON_0001248"
        ],
        "creation_date": "2021-03-05",
        "creator": "Marda Jorgensen",
        "creator_first_name": "Marda",
        "creator_last_name": "Jorgensen",
        "dimension_units": "millimeter",
        "placement": {
            "@context": "https://hubmapconsortium.github.io/hubmap-ontology/ccf-context.jsonld",
            "@id": "http://purl.org/ccf/1.5/221301ef-b4de-48df-87da-624eeb9dba72_placement",
            "@type": "SpatialPlacement",
            "placement_date": "2021-03-05",
            "rotation_order": "XYZ",
            "rotation_units": "degree",
            "scaling_units": "ratio",
            "target": "http://purl.org/ccf/latest/ccf.owl#VHMSpleen",
            "translation_units": "millimeter",
            "x_rotation": 83,
            "x_scaling": 1,
            "x_translation": 32.79,
            "y_rotation": 53,
            "y_scaling": 1,
            "y_translation": 62.571,
            "z_rotation": 5,
            "z_scaling": 1,
            "z_translation": 19.667
        },
        "x_dimension": 10,
        "y_dimension": 10,
        "z_dimension": 5
    },
    "specimen_type": "ffpe_block",
    "submission_id": "UFL0010-SP-3-5",
    "uuid": "4e8d64722e354aa4c14def7009440c19"
}

Thanks! -- I hadn't thought about the current Entities API response being different from what's in the index. Will ignore the IDs which aren't in the partonomy.

@bherr2 FYI, on TEST, we are currently using contains_human_genetic_sequences as a boolean rather than string "yes"/"no" in both entity-api and search-api. We talked about this before and it seems to be a quick change on your end. Just wanted you know that this has been deployed TEST.

@yuanzhou Yep, we made that change a while back. Thanks!

authors: bherr2 mccalluc yuanzhou

repo: hubmapconsortium/search-api