Friday, June 3, 2022

Recent Questions - Stack Overflow

Recent Questions - Stack Overflow


ClusterIP service Not accessible from within the cluster pods

Posted: 03 Jun 2022 07:07 AM PDT

I have got 2 deployments in my cluster UI and USER. Both of these are exposed by Cluster IP service. There is an ingress which makes both the services publicly accessible.

Now when I do "kubectl exec -it UI-POD -- /bin/sh" and then try to "ping USER-SERVICE-CLUSTER-IP:PORT" it doesn't work.

All I get is No packet returned i.e. a failure message.

Attaching my .yml file

apiVersion: apps/v1  kind: Deployment  metadata:    name: user-service-app    labels:      app: user-service-app  spec:    replicas: 1    selector:      matchLabels:        app: user-service-app    template:      metadata:        labels:          app: user-service-app      spec:        containers:        - name: user-service-app          image: <MY-IMAGE-URL>          imagePullPolicy: Always          ports:          - containerPort: 3000          livenessProbe:            httpGet:              path: /ping              port: 3000          readinessProbe:            httpGet:              path: /ping              port: 3000                            ---  apiVersion: "v1"  kind: "Service"  metadata:    name: "user-service-svc"    namespace: "default"    labels:      app: "user-service-app"  spec:    type: "ClusterIP"    selector:      app: "user-service-app"    ports:    - protocol: "TCP"      port: 80      targetPort: 3000    ---  apiVersion: apps/v1  kind: Deployment  metadata:    name: ui-service-app    labels:      app: ui-service-app  spec:    replicas: 1    selector:      matchLabels:        app: ui-service-app    template:      metadata:        labels:          app: ui-service-app      spec:        containers:        - name: ui-service-app          image: <MY-IMAGE-URL>          imagePullPolicy: Always          ports:          - containerPort: 3000    ---  apiVersion: "v1"  kind: "Service"  metadata:    name: "ui-service-svc"    namespace: "default"    labels:      app: "ui-service-app"  spec:    type: "ClusterIP"    selector:      app: "ui-service-app"    ports:    - protocol: "TCP"      port: 80      targetPort: 3000          ---  apiVersion: networking.k8s.io/v1  kind: Ingress  metadata:    name: awesome-ingress    annotations:      nginx.ingress.kubernetes.io/rewrite-target: /$2  spec:    ingressClassName: nginx    defaultBackend:      service:        name: ui-service-svc        port:          number: 80    rules:    - http:        paths:              - path: /login          pathType: Prefix          backend:            service:              name: ui-service-svc              port:                number: 80        - path: /user(/|$)(.*)          pathType: Prefix          backend:            service:              name: user-service-svc              port:                number: 80  

How to make an SPList support minor versioning in Sharepoint?

Posted: 03 Jun 2022 07:07 AM PDT

I have a list to which I am trying to write files with different versions. But whenever it hits list.EnableMinorVersions = true; it throws the error message - This list does not support minor versioning. How do i fix it? If possible, I'd like to do it within the code itself.

Thanks for all the help.

Distube.js1 hour or more length

Posted: 03 Jun 2022 07:07 AM PDT

Does Distube.js can play 2 hours song/video length?

i was making a discord bot that uses distube for music and I was trying my play command if it going to work, it does work perfectly but when I tried to play a 2hrs music video like full album it just stop the queue but when the video is live its working fine..

I'm making this on discord.js v13 also 1hr songs are fine

How to affect the order in which imagePullSecrets are used?

Posted: 03 Jun 2022 07:07 AM PDT

If I add (by oc/kubectl patch like this) a custom image pull secret to the default serviceaccount (in k8s or OKD), and given that I cannot effectively delete the default image pull secret (it gets automatically regenerated), how can I determine and control the order in which imagePullSecrets are used (to use custom one first, before default is used)?

Note that after such patching of the default serviceaccount with the custom Secret (here named readonly-docker-hub-cred-for-mirekphd) this secret gets always inserted at the top (above `default-dockercfg-* ones that get auto-regenerated when I try to delete them), but does this top position give it also priority when pulling images (over the default one with much worse pull rate limits)?:

$ oc get sa default -o yaml  apiVersion: v1  imagePullSecrets:  - name: readonly-docker-hub-cred-for-mirekphd  - name: default-dockercfg-?????  kind: ServiceAccount  metadata:    creationTimestamp: 20??-08-09T06:57:32Z    name: default    namespace: ??    resourceVersion: "370297143"    selfLink: /api/v1/namespaces/??/serviceaccounts/default    uid: 7d5ac6cf-9ba1-11e8-bfd8-0050569f????  secrets:  - name: default-token-?????  - name: default-dockercfg-?????  

Nbomber How to execute steps just one time

Posted: 03 Jun 2022 07:07 AM PDT

I'm using NBomber for load testing. Is there a way to execute steps just one time? (or exactly n times)

I've found this: context.StopScenario(context.ScenarioInfo.ScenarioName, "Stop Reason"); But it doesn't seem to work, the statistics show 0 requests. Maybe I'm doing something wrong.

Here my code: enter image description here

And the statistics:

enter image description here

How to cancel the day's recurring notifications in UserNotifications

Posted: 03 Jun 2022 07:07 AM PDT

I am developing a Todos App based on SwiftUI. It can notify users at a fixed time every day if they don't finish today's todos, I use the UserNotifications to implement the notification function. Currently I want to cancel the notification of the day if users finished their todos. So how can I implement based on UserNotifications?

How replace a row in a dataframe with a subset of that dataframe

Posted: 03 Jun 2022 07:07 AM PDT

I have a dataframe like this:

df1

     Category  Type    Dependent-Category   0    1         O       A                  <---- Replace this row   1    1         O       24   2    1         O       5   3    1         Y       14   4    A         Y       10   5    A         O       2   6    A         O       9  

I want to replace row 0, with all the rows where Category == A. Final df should look like this

df_final

     Category  Type    Dependent-Category   0    A         Y       10   1    A         O       2   2    A         O       9   3    1         O       24   4    1         O       5   5    1         Y       14   6    A         Y       10   7    A         O       2   8    A         O       9  

Uncaught SyntaxError: Invalid or unexpected token (datastable) i can't solve this error

Posted: 03 Jun 2022 07:07 AM PDT

I use many js libraries. I got an error that I can't understand. Seems to be giving error within the library.

Library way of definition is

<script type="text/javascript" src="/zollu/keen/vendors/custom/datatables/datatables.bundle.js"></script>  <script type="text/javascript" src="/zollu/js/common.js"></script>      <script type="text/javascript" src="/zollu/keen/vendors/global/vendors.bundle.js"></script>  

error image

Django + Twilio 500 Error (Session issue?)

Posted: 03 Jun 2022 07:07 AM PDT

I forked this Tutorial https://github.com/TwilioDevEd/automated-survey-django and am trying to get it to run locally. The current behavior is that, I send a text to the Twilio number and then it correctly texts me the first question of the survey. However, then when I text back, I don't get a response (should be the 2nd question of the survey) and I see a 500 error in Django. I can see that the second text message is being received by Django and, from the following function, it prints HELLO. However, it doesn't make it to YEP, so it appears to be erroring on answering_question = request.session.get('answering_question_id'), which seems like it is a problem with the session. I can see that there is a new session in the Django_session table created from my first text. I'm stuck on what is going wrong. request.session['answering_question_id'] is being set elsewhere in the code, but, my understanding, is if wasn't set, then answering_question would just be false, not an error. I'm stuck - any thoughts?

def redirects_twilio_request_to_proper_endpoint(request):      print("HELLO")      answering_question = request.session.get('answering_question_id')      print("YEP")      if not answering_question:          print('1')          first_survey = Survey.objects.first()          redirect_url = reverse('survey',          kwargs={'survey_id': first_survey.id})     else:         print('2')         question = Question.objects.get(id=answering_question)         redirect_url = reverse('save_response',         kwargs={'survey_id': question.survey.id,                 'question_id': question.id})  return HttpResponseRedirect(redirect_url)  

Example error [03/Jun/2022 03:34:36]"GET /automated-survey/first-survey/?ToCountry=US&ToState=CA&SmsMessageSid=SM9f799005f09308ae910a7c5af722bf76&NumMedia=0&ToCity=LOS+ANGELES&FromZip=95747&SmsSid=SM9f799005f09308ae910a7c5af722bf76&FromState=CA&SmsStatus=received&FromCity=ROSEVILLE&Body=Pink&FromCountry=US&To=%2B17472454008&ToZip=&NumSegments=1&ReferralNumMedia=0&MessageSid=SM9f799005f09308ae910a7c5af722bf76&AccountSid=ACef9b14863560f9a5b30961d21029d03c&From=%2B19164327401&ApiVersion=2010-04-01 HTTP/1.1" 500 139520

Download full article from Inoreader RSS

Posted: 03 Jun 2022 07:07 AM PDT

I am using Inoreader API for scraping articles,but for many RSS feeds it returns a small summary of articles. Any idea how to take the whole context??

How to generate the value selected in a toolbar angular

Posted: 03 Jun 2022 07:06 AM PDT

I'm trying to get the selected value of a toolbar, so I can use it to generate a table in the database with that value as a condition.

How do you get the posterior estimates from a stanfit object just as you would from a brmsfit object in R?

Posted: 03 Jun 2022 07:06 AM PDT

I am fairly new to R/STAN and I would like to code my own model in STAN code. The problem is that I don't know how to obtain the estimate__ values that conditional_effects(brmsfit) produces when using library(brms).

Here is an example of what I would like to obtain:

library(rstan)  library(brms)    N <- 10  y <- rnorm(10)  x <- rnorm(10)  df <- data.frame(x, y)    fit <- brm(y ~ x, data = df)    data <- conditional_effects(fit)    print(data[["x"]])  

Which gives this output:

           x         y cond__    effect1__ estimate__      se__  

1 -1.777412243 0.1417486 1 -1.777412243 0.08445399 0.5013894 2 -1.747889444 0.1417486 1 -1.747889444 0.08592914 0.4919022 3 -1.718366646 0.1417486 1 -1.718366646 0.08487412 0.4840257 4 -1.688843847 0.1417486 1 -1.688843847 0.08477227 0.4744689 5 -1.659321048 0.1417486 1 -1.659321048 0.08637019 0.4671830 6 -1.629798249 0.1417486 1 -1.629798249 0.08853233 0.4612196 7 -1.600275450 0.1417486 1 -1.600275450 0.08993511 0.4566040 8 -1.570752651 0.1417486 1 -1.570752651 0.08987979 0.4501722 9 -1.541229852 0.1417486 1 -1.541229852 0.09079337 0.4415650 10 -1.511707053 0.1417486 1 -1.511707053 0.09349952 0.4356073 11 -1.482184255 0.1417486 1 -1.482184255 0.09382594 0.4292237 12 -1.452661456 0.1417486 1 -1.452661456 0.09406637 0.4229115 13 -1.423138657 0.1417486 1 -1.423138657 0.09537000 0.4165933 14 -1.393615858 0.1417486 1 -1.393615858 0.09626168 0.4126735 15 -1.364093059 0.1417486 1 -1.364093059 0.09754818 0.4060894 16 -1.334570260 0.1417486 1 -1.334570260 0.09737763 0.3992320 17 -1.305047461 0.1417486 1 -1.305047461 0.09646332 0.3929951 18 -1.275524662 0.1417486 1 -1.275524662 0.09713718 0.3870211 19 -1.246001864 0.1417486 1 -1.246001864 0.09915170 0.3806628 20 -1.216479065 0.1417486 1 -1.216479065 0.10046754 0.3738948 21 -1.186956266 0.1417486 1 -1.186956266 0.10192677 0.3675363 22 -1.157433467 0.1417486 1 -1.157433467 0.10329695 0.3613282 23 -1.127910668 0.1417486 1 -1.127910668 0.10518868 0.3533583 24 -1.098387869 0.1417486 1 -1.098387869 0.10533191 0.3484098 25 -1.068865070 0.1417486 1 -1.068865070 0.10582833 0.3442075 26 -1.039342271 0.1417486 1 -1.039342271 0.10864510 0.3370518 27 -1.009819473 0.1417486 1 -1.009819473 0.10830692 0.3325785 28 -0.980296674 0.1417486 1 -0.980296674 0.11107417 0.3288747 29 -0.950773875 0.1417486 1 -0.950773875 0.11229667 0.3249769 30 -0.921251076 0.1417486 1 -0.921251076 0.11420108 0.3216303 31 -0.891728277 0.1417486 1 -0.891728277 0.11533604 0.3160908 32 -0.862205478 0.1417486 1 -0.862205478 0.11671013 0.3099456 33 -0.832682679 0.1417486 1 -0.832682679 0.11934724 0.3059504 34 -0.803159880 0.1417486 1 -0.803159880 0.12031792 0.3035792 35 -0.773637082 0.1417486 1 -0.773637082 0.12114301 0.2985330 36 -0.744114283 0.1417486 1 -0.744114283 0.12149371 0.2949334 37 -0.714591484 0.1417486 1 -0.714591484 0.12259197 0.2915398 38 -0.685068685 0.1417486 1 -0.685068685 0.12308763 0.2905327 39 -0.655545886 0.1417486 1 -0.655545886 0.12409683 0.2861451 40 -0.626023087 0.1417486 1 -0.626023087 0.12621634 0.2834400 41 -0.596500288 0.1417486 1 -0.596500288 0.12898609 0.2838938 42 -0.566977489 0.1417486 1 -0.566977489 0.12925969 0.2802667 43 -0.537454691 0.1417486 1 -0.537454691 0.13050938 0.2782553 44 -0.507931892 0.1417486 1 -0.507931892 0.12968382 0.2765127 45 -0.478409093 0.1417486 1 -0.478409093 0.13252478 0.2735946 46 -0.448886294 0.1417486 1 -0.448886294 0.13414535 0.2727640 47 -0.419363495 0.1417486 1 -0.419363495 0.13453109 0.2710725 48 -0.389840696 0.1417486 1 -0.389840696 0.13526957 0.2683500 49 -0.360317897 0.1417486 1 -0.360317897 0.13675913 0.2665745 50 -0.330795098 0.1417486 1 -0.330795098 0.13987067 0.2658021 51 -0.301272300 0.1417486 1 -0.301272300 0.14111051 0.2668740 52 -0.271749501 0.1417486 1 -0.271749501 0.14382292 0.2680711 53 -0.242226702 0.1417486 1 -0.242226702 0.14531118 0.2662193 54 -0.212703903 0.1417486 1 -0.212703903 0.14656473 0.2670958 55 -0.183181104 0.1417486 1 -0.183181104 0.14689102 0.2677249 56 -0.153658305 0.1417486 1 -0.153658305 0.14749250 0.2698547 57 -0.124135506 0.1417486 1 -0.124135506 0.14880275 0.2711767 58 -0.094612707 0.1417486 1 -0.094612707 0.15072864 0.2719037 59 -0.065089909 0.1417486 1 -0.065089909 0.15257772 0.2720895 60 -0.035567110 0.1417486 1 -0.035567110 0.15434018 0.2753563 61 -0.006044311 0.1417486 1 -0.006044311 0.15556588 0.2783308 62 0.023478488 0.1417486 1 0.023478488 0.15481341 0.2802336 63 0.053001287 0.1417486 1 0.053001287 0.15349716 0.2833364 64 0.082524086 0.1417486 1 0.082524086 0.15432904 0.2868926 65 0.112046885 0.1417486 1 0.112046885 0.15637411 0.2921039 66 0.141569684 0.1417486 1 0.141569684 0.15793097 0.2979247 67 0.171092482 0.1417486 1 0.171092482 0.15952338 0.3022751 68 0.200615281 0.1417486 1 0.200615281 0.15997047 0.3048768 69 0.230138080 0.1417486 1 0.230138080 0.16327957 0.3087545 70 0.259660879 0.1417486 1 0.259660879 0.16372900 0.3125599 71 0.289183678 0.1417486 1 0.289183678 0.16395417 0.3185642 72 0.318706477 0.1417486 1 0.318706477 0.16414444 0.3240570 73 0.348229276 0.1417486 1 0.348229276 0.16570600 0.3273931 74 0.377752075 0.1417486 1 0.377752075 0.16556032 0.3316680 75 0.407274873 0.1417486 1 0.407274873 0.16815162 0.3391713 76 0.436797672 0.1417486 1 0.436797672 0.16817144 0.3465403 77 0.466320471 0.1417486 1 0.466320471 0.16790241 0.3514764 78 0.495843270 0.1417486 1 0.495843270 0.16941330 0.3590708 79 0.525366069 0.1417486 1 0.525366069 0.17068468 0.3662851 80 0.554888868 0.1417486 1 0.554888868 0.17238535 0.3738123 81 0.584411667 0.1417486 1 0.584411667 0.17358253 0.3796033 82 0.613934466 0.1417486 1 0.613934466 0.17521059 0.3869863 83 0.643457264 0.1417486 1 0.643457264 0.17617046 0.3939509 84 0.672980063 0.1417486 1 0.672980063 0.17710931 0.3967577 85 0.702502862 0.1417486 1 0.702502862 0.17816611 0.4026686 86 0.732025661 0.1417486 1 0.732025661 0.17998354 0.4094216 87 0.761548460 0.1417486 1 0.761548460 0.18085939 0.4165644 88 0.791071259 0.1417486 1 0.791071259 0.18114271 0.4198687 89 0.820594058 0.1417486 1 0.820594058 0.18294576 0.4255245 90 0.850116857 0.1417486 1 0.850116857 0.18446785 0.4333511 91 0.879639655 0.1417486 1 0.879639655 0.18498697 0.4407155 92 0.909162454 0.1417486 1 0.909162454 0.18729221 0.4472631 93 0.938685253 0.1417486 1 0.938685253 0.18952720 0.4529227 94 0.968208052 0.1417486 1 0.968208052 0.19203126 0.4579841 95 0.997730851 0.1417486 1 0.997730851 0.19408999 0.4671136 96 1.027253650 0.1417486 1 1.027253650 0.19551024 0.4751111 97 1.056776449 0.1417486 1 1.056776449 0.19700981 0.4804208 98 1.086299247 0.1417486 1 1.086299247 0.19756573 0.4850098 99 1.115822046 0.1417486 1 1.115822046 0.20044626 0.4915511 100 1.145344845 0.1417486 1 1.145344845 0.20250046 0.4996890 lower__ upper__ 1 -1.0567858 1.1982199 2 -1.0438136 1.1831539 3 -1.0228641 1.1707170 4 -1.0072313 1.1596104 5 -0.9864567 1.1438521 6 -0.9689320 1.1282532 7 -0.9505741 1.1173943 8 -0.9357609 1.0983966 9 -0.9230198 1.0859565 10 -0.9104617 1.0757511 11 -0.8874429 1.0631791 12 -0.8687644 1.0467475 13 -0.8513190 1.0348922 14 -0.8290140 1.0236083 15 -0.8126063 1.0166800 16 -0.7975146 1.0011153 17 -0.7869631 0.9873863 18 -0.7760327 0.9721754 19 -0.7551183 0.9585837 20 -0.7427828 0.9479480 21 -0.7269582 0.9405559 22 -0.7072756 0.9284436 23 -0.6975987 0.9161489 24 -0.6884648 0.9040642 25 -0.6684576 0.8923201 26 -0.6535668 0.8811996 27 -0.6517693 0.8714208 28 -0.6394743 0.8652541 29 -0.6235719 0.8542377 30 -0.6127188 0.8433206 31 -0.6017256 0.8346912 32 -0.5845027 0.8192662 33 -0.5701008 0.8098853 34 -0.5596900 0.7982326 35 -0.5473666 0.7980605 36 -0.5340069 0.7908127 37 -0.5239994 0.7826979 38 -0.5124559 0.7811926 39 -0.4986325 0.7786670 40 -0.5044564 0.7745791 41 -0.4940340 0.7699341 42 -0.4871297 0.7698303 43 -0.4808839 0.7678166 44 -0.4790951 0.7662335 45 -0.4711604 0.7576184 46 -0.4690302 0.7577330 47 -0.4675442 0.7567887 48 -0.4673520 0.7554134 49 -0.4649256 0.7499373 50 -0.4600178 0.7494690 51 -0.4500426 0.7500552 52 -0.4475863 0.7505488 53 -0.4437339 0.7513191 54 -0.4429276 0.7564214 55 -0.4427087 0.7578937 56 -0.4451014 0.7613821 57 -0.4418548 0.7706546 58 -0.4377409 0.7787030 59 -0.4397108 0.7882644 60 -0.4462651 0.8026011 61 -0.4538979 0.8069187 62 -0.4542826 0.8163290 63 -0.4557042 0.8285206 64 -0.4572005 0.8335650 65 -0.4638491 0.8413812 66 -0.4681885 0.8539095 67 -0.4775714 0.8633141 68 -0.4888333 0.8698490 69 -0.4952363 0.8791527 70 -0.4975383 0.8833882 71 -0.5088667 0.8863114 72 -0.5197474 0.8951534 73 -0.5316745 0.9085101 74 -0.5409388 0.9207023 75 -0.5572803 0.9282691 76 -0.5643576 0.9357900 77 -0.5751774 0.9517092 78 -0.5855919 0.9625510 79 -0.5995727 0.9781417 80 -0.6115650 0.9946185 81 -0.6198287 1.0071916 82 -0.6297608 1.0208370 83 -0.6447637 1.0357034 84 -0.6511860 1.0506364 85 -0.6659993 1.0608813 86 -0.6794852 1.0702993 87 -0.6893830 1.0801824 88 -0.7040491 1.1026626 89 -0.7183266 1.1196308 90 -0.7387399 1.1401544 91 -0.7541057 1.1561184 92 -0.7608552 1.1701851 93 -0.7783620 1.1855296 94 -0.7920760 1.2014060 95 -0.8063188 1.2157463 96 -0.8224106 1.2307841 97 -0.8377605 1.2484814 98 -0.8530954 1.2580503 99 -0.8684646 1.2731355 100 -0.8840083 1.2891893

Where I can easily plot the estimate__ vs x columns to obtain my linear regression.

Now assuming I want to do the same but with my own STAN code using the stan() function:

library(rstan)    N <- 10  y <- rnorm(10)  x <- rnorm(10)  df <- data.frame(x, y)    stan('stan_test.stan', data = list(y=y, x=x, N=N))  

How would I obtain the same estimate__ column as well as the lower__ and upper__ columns?

Note: I know I can easily plot it using the intercept and slope means, but I would like to plot more complex models that can't be plotted as easily, as such this is just a simple example.

Thank you very much.

"If statement" is not working porperly in c

Posted: 03 Jun 2022 07:07 AM PDT

I have written a program with a function that looks at a two dimensional array ir_data[60][768]. The While loop should call the "Hotspotberechnung" function only when there is a value that equals or is over 30 in a given row. "Hotspotberechnung" should store the given row in an array[24][32] and then print the array. The problem is that the program prints an array without any values equal or over 30. Unfortunatlly, I cannot find the mistake on my own.

The While Loop:

while (get_ir_data( &Temperatur[0], sizeof(Temperatur)/sizeof(Temperatur[0])) == 0)  {     for(int k=0; k<768; k++)     {         if(Temperatur[k] >= 30)         {            Hotspotberechnung(Temperatur,bild);         }        }  }  

The function :

bool Hotspotberechnung(int8_t tabelle1[768],int8_t tabelle2[24][32])      {          int i=0, j=0, x=0, y=0;            for(j=0; j<24; j++)                             //Tabellen werden gefüllt          {              for(i=0; i<32; i++)              {                  tabelle2[j][i] = tabelle1[(j*24)+i];              }          }          for(j=0; j<24; j++)          {              for(i=0; i<32; i++)              {                  printf("%d.%d=%d\n",j,i,tabelle2[j][i]);              }          }  

get_ir_data :

int8_t get_ir_data(int8_t* data, int n)  {      static uint8_t idx = 0;        if (n != 24 * 32) {          printf("Invalid size of array data!\n");          return -1;      }        memcpy(data, ir_data[idx], n);      idx++;        if (idx >= sizeof(ir_data) / sizeof(*ir_data))          return -2;        return 0;  }  

ESP8266 TCP packet fragmentation

Posted: 03 Jun 2022 07:07 AM PDT

I am trying to send TCP packets to a remote server, using the Wemos D1 Mini Pro (ESP8266), configured in lwIP v2 high bandwidth mode (TCP_MSS = 1460, LWIP_ FEATURES = 1).

I set a maximum buffer size of 1810 bytes :

#define MAX_BUFFER_SIZE 1810  

I declare the buffer as a global static variable :

static uint8_t buffer[MAX_BUFFER_SIZE];  

and I am continually sending packetSize (user-definable size) packets using TCP_write :

uint16_t sent = TCP.write((uint8_t*)buffer,packetSize);  

most of the times I get sent equal to packetSize, however, once a while the function returns a smaller value. For instance, if packetSize = 1135, I usually get the first bad value equal to 650 and a few zero values after that. Normal operation restores after a few failed sends.

I am looking for the reasons behind this fragmentation issue.

Thoughts : should I use a buffer size (currently 1860) smaller than TCP_MSS = 1460, no matter if packetSize is actually smaller than TCP_MSS ? If yes, should I try to declare buffer as a dynamic array with size equal to packetSize ?

Creating and assigning values of a new Pandas DataFrame column

Posted: 03 Jun 2022 07:07 AM PDT

Problem Statement-Create a new categorical variable with value as Open and Closed. Open & Pending is to be categorized as Open and Closed & Solved is to be categorized as Closed.

Description: I have a dataframe where there is a column 'Status' with the following values

0       Closed  1       Closed  2       Closed  3         Open  4       Solved           ...    2219    Closed  2220    Solved  2221    Solved  2222    Solved  2223      Open  

Now I am supposed to create another column based on the column status as mentioned above but if the value of Status is 'Open' or 'Pending' then the new column 'Final Status' should have a value of 'Open' and similarly if the value of Status is 'Closed' or 'Pending' then the new column 'Final Status' should have a value of 'Closed'. I tried applying the following code to do so but it doesn't work and gives me the following incorrect results. Telecom is the dataframe

for i in Telecom['Status']:      if i =='Open' or i =='Pending':          Telecom['Final Status']= Telecom['Status'].replace(['Open','Pending'],'Open')      elif i =='Closed' or i =='Solved':          Telecom['Final Status']= Telecom['Status'].replace(['Closed','Solved'],'Closed')  

The result for the column 'Final Status' is as follows: Status Final Status 0 Closed Closed 1 Closed Closed 2 Closed Closed 3 Open Open 4 Solved Solved

I can't figure out where I am going wrong. Seems its just copying the values from 'Status' and putting it in 'Final Status'

thymeleaf replacing th:field to comply with th:selected

Posted: 03 Jun 2022 07:07 AM PDT

I appreciate your passing by my post. I have searched here in StackOverFlow and google as well to fix my following code:

My HTML code:

<form th:action="@{/surgerywaitinglist/saveToWaitinList}"              th:object="${waitinglistDTO}" method="POST">  .  .  .      <select name="departmentName"                                                        th:field="*{department.departmentName}"              th:with="departmentName = ${waitinglistDTO.department.departmentName}"              class="form-control" id="departmentJS">                    <option value="" th:selected="selected"                 th:disabled="disabled">select option          </option>                                                            <option th:each="department: ${departments}"                  th:value="${department.departmentName}"                  th:text="${department.departmentName}">           </option>                </select>  .  .  .  <input type="submit" value="Save" class="btn btn-primary" />  </form>  

form other posts like this post I found out that th:field and th:selected do not work together; in fact, th:field needs to be replace with something else. Notice that the th:object holds another object (from Department class) ...

My DTO class:

public class WaitinglistDTO {        private Long waitingListId;      @NotBlank(message = "Please enter a procedure")      private String waitingListProcedure;      private String waitingListDiagnosis;      private Long waitingListPatientId;      private Long waitingListSurgeonId;      private Long waitingListDepartmentId;      @DateTimeFormat(iso=ISO.DATE)      private Date waitingListAdditionDate;      @DateTimeFormat(iso=ISO.DATE)      private Date waitingListActualBookingDate;                  private Patient patient;      private Surgeon surgeon;      private Department department;  

Could you help me figure this out?

Many thanxxxxx :)

server 500 err when runing a github cloned project on lampp stack ubuntu

Posted: 03 Jun 2022 07:08 AM PDT

just started working on Ubuntu 22.04 I just installed lamp stack on my Ubuntu pc and it is working fine but the problem is when i clone a repo from GitHub when i try to run the project by a browser i see a "localhost is currently unable to handle this request." 500 server err i can create a simple file in projects directory and run it with no errors and i can't either use localhost/phpmyadmin i basically get the same error heres my ls -la log result for var/www/html

drwxr-xr-x  3 root      root       4096 Jun  3 16:00 ..  -rw-rw-r--  1 www-data  www-data  10671 Jun  3 16:31 index.html  -rw-rw-r--  1 root      root         20 Jun  3 15:32 info.php  lrwxrwxrwx  1 root      root         21 Jun  3 16:01 phpmyadmin -> /usr/share/phpmyadmin  drwxrwxr-x 10 mrmirzaee mrmirzaee  4096 Jun  3 17:13 Todo  

Heres my error.log file for apache2 while trying to open localhost/phpmyadmin [Fri Jun 03 18:30:05.279825 2022] [php:error] [pid 82981] [client ::1:44972] PHP Fatal error: Uncaught Error: Call to undefined function mb_strpos() in /usr/share/phpmyadmin/libraries/classes/Url.php:263\nStack trace:\n#0 /usr/share/phpmyadmin/libraries/classes/Url.php(213): PhpMyAdmin\\Url::getArgSeparator()\n#1 /usr/share/phpmyadmin/libraries/classes/Url.php(176): PhpMyAdmin\\Url::getCommonRaw()\n#2 /usr/share/phpmyadmin/libraries/classes/Core.php(752): PhpMyAdmin\\Url::getCommon()\n#3 /usr/share/phpmyadmin/libraries/classes/Core.php(339): PhpMyAdmin\\Core::linkURL()\n#4 /usr/share/phpmyadmin/libraries/classes/Core.php(366): PhpMyAdmin\\Core::getPHPDocLink()\n#5 /usr/share/phpmyadmin/libraries/classes/Core.php(994): PhpMyAdmin\\Core::warnMissingExtension()\n#6 /usr/share/phpmyadmin/libraries/common.inc.php(131): PhpMyAdmin\\Core::checkExtensions()\n#7 /usr/share/phpmyadmin/index.php(15): require_once('...')\n#8 {main}\n thrown in /usr/share/phpmyadmin/libraries/classes/Url.php on line 263

and heres the access log for that ::1 - - [03/Jun/2022:18:30:05 +0430] "GET /phpmyadmin/ HTTP/1.1" 500 185 "-" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/102.0.5005.61 Safari/537.36" ::1 - - [03/Jun/2022:18:30:56 +0430] "-" 408 0 "-" "-"

the same log files while opening my projects : access log : ::1 - - [03/Jun/2022:18:35:12 +0430] "GET /Todo/ HTTP/1.1" 500 185 "-" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/102.0.5005.61 Safari/537.36" error log : [Fri Jun 03 18:35:12.880098 2022] [php:warn] [pid 82977] [client ::1:44978] PHP Warning: include(E:/xampp/htdocs/todo/bootstrap/config.php): Failed to open stream: No such file or directory in /var/www/html/Todo/Bootstrap/init.php on line 3 [Fri Jun 03 18:35:12.880251 2022] [php:warn] [pid 82977] [client ::1:44978] PHP Warning: include(): Failed opening 'E:/xampp/htdocs/todo/bootstrap/config.php' for inclusion (include_path='.:/usr/share/php') in /var/www/html/Todo/Bootstrap/init.php on line 3 [Fri Jun 03 18:35:12.880319 2022] [php:warn] [pid 82977] [client ::1:44978] PHP Warning: include(E:/xampp/htdocs/todo/vendor/autoload.php): Failed to open stream: No such file or directory in /var/www/html/Todo/Bootstrap/init.php on line 4 [Fri Jun 03 18:35:12.880337 2022] [php:warn] [pid 82977] [client ::1:44978] PHP Warning: include(): Failed opening 'E:/xampp/htdocs/todo/vendor/autoload.php' for inclusion (include_path='.:/usr/share/php') in /var/www/html/Todo/Bootstrap/init.php on line 4 [Fri Jun 03 18:35:12.880385 2022] [php:warn] [pid 82977] [client ::1:44978] PHP Warning: include(E:/xampp/htdocs/todo/libs/helpers.php): Failed to open stream: No such file or directory in /var/www/html/Todo/Bootstrap/init.php on line 5 [Fri Jun 03 18:35:12.880433 2022] [php:warn] [pid 82977] [client ::1:44978] PHP Warning: include(): Failed opening 'E:/xampp/htdocs/todo/libs/helpers.php' for inclusion (include_path='.:/usr/share/php') in /var/www/html/Todo/Bootstrap/init.php on line 5 [Fri Jun 03 18:35:12.880457 2022] [php:warn] [pid 82977] [client ::1:44978] PHP Warning: Undefined variable $db_config in /var/www/html/Todo/Bootstrap/init.php on line 7 [Fri Jun 03 18:35:12.880470 2022] [php:warn] [pid 82977] [client ::1:44978] PHP Warning: Attempt to read property "host" on null in /var/www/html/Todo/Bootstrap/init.php on line 7 [Fri Jun 03 18:35:12.880482 2022] [php:warn] [pid 82977] [client ::1:44978] PHP Warning: Undefined variable $db_config in /var/www/html/Todo/Bootstrap/init.php on line 7 [Fri Jun 03 18:35:12.880492 2022] [php:warn] [pid 82977] [client ::1:44978] PHP Warning: Attempt to read property "db_name" on null in /var/www/html/Todo/Bootstrap/init.php on line 7 [Fri Jun 03 18:35:12.880506 2022] [php:warn] [pid 82977] [client ::1:44978] PHP Warning: Undefined variable $db_config in /var/www/html/Todo/Bootstrap/init.php on line 7 [Fri Jun 03 18:35:12.880537 2022] [php:warn] [pid 82977] [client ::1:44978] PHP Warning: Attempt to read property "user" on null in /var/www/html/Todo/Bootstrap/init.php on line 7 [Fri Jun 03 18:35:12.880548 2022] [php:warn] [pid 82977] [client ::1:44978] PHP Warning: Undefined variable $db_config in /var/www/html/Todo/Bootstrap/init.php on line 7 [Fri Jun 03 18:35:12.880558 2022] [php:warn] [pid 82977] [client ::1:44978] PHP Warning: Attempt to read property "pass" on null in /var/www/html/Todo/Bootstrap/init.php on line 7 [Fri Jun 03 18:35:12.880730 2022] [php:error] [pid 82977] [client ::1:44978] PHP Fatal error: Uncaught Error: Call to undefined function diePage() in /var/www/html/Todo/Bootstrap/init.php:10\nStack trace:\n#0 /var/www/html/Todo/index.php(3): include()\n#1 {main}\n thrown in /var/www/html/Todo/Bootstrap/init.php on line 10 IDK why it's returning so much errs i literally use the same project on my windows xampp

Unable to build android application Offline Mode

Posted: 03 Jun 2022 07:06 AM PDT

I'm unable to build my android application and I don't understand why. When I try to build it I get this error:

No cached version of org.jetbrains.kotlin:kotlin-android-extensions-runtime:1.6.21 available for offline mode.  Disable Gradle 'offline mode' and sync project  

If I toggle offline mode then I get this error:

Could not GET 'http://dl.bintray.com/lukaville/maven/org/jetbrains/kotlin/kotlin-android-extensions-runtime/1.6.21/kotlin-android-extensions-runtime-1.6.21.pom'. Received status code 502 from server: Bad Gateway  

What can I do? I didn't find any solution :/

I get this error only in 1 app, in others app it works :/

Thank you

Apache Livy : Could not find or load main class org.apache.livy.server.LivyServer

Posted: 03 Jun 2022 07:07 AM PDT

I am trying to start Apache Livy 0.8.0 server on my windows 10 machine for spark 3.1.2 and hadoop 3.2.1. I am taking help from here.. I have successfully built apache livy using maven (I have attached a screenshot of it) But I am not able to run the livy server. When I run it I get the following error -

starting C:/AmazonJDK/jdk1.8.0_332/bin/java -cp /d/ApacheLivy/incubator-livy-master/incubator-livy-master/server/target/jars/:/d/ApacheLivy/incubator-livy-master/incubator-livy-master/conf:D:/Program_files/spark/conf:D:/ApacheHadoop/hadoop-3.2.1/etc/hadoop: org.apache.livy.server.LivyServer, logging to D:/ApacheLivy/incubator-livy-master/incubator-livy-master/logs/livy--server.out ps: unknown option -- o Try `ps --help' for more information. failed to launch C:/AmazonJDK/jdk1.8.0_332/bin/java -cp /d/ApacheLivy/incubator-livy-master/incubator-livy-master/server/target/jars/:/d/ApacheLivy/incubator-livy-master/incubator-livy-master/conf:D:/Program_files/spark/conf:D:/ApacheHadoop/hadoop-3.2.1/etc/hadoop: org.apache.livy.server.LivyServer: Error: Could not find or load main class org.apache.livy.server.LivyServer full log in D:/ApacheLivy/incubator-livy-master/incubator-livy-master/logs/livy--server.out

I am using Git bash. If you need more information I will provide. Please help !

Clicking on GLTF models - Threejs

Posted: 03 Jun 2022 07:07 AM PDT

I'm working on a threejs project where I'm trying to load a GLTF file containing geometric shapes. I am writing a logic to get info, for now just the name, of the shapes that I click within the GLTF file. For now, I am just using console.log() to print the name of the shape I have clicked. I also want a side navigation bar to appear with the name of the component, I have a simple OpenNav() function for the navigation bar, as shown below. I now want to use the HTML header tag to display found[index].object.name (the component's name). I am kind of stuck here. How do I achieve this?

<div id = "mySidenav" class = "sidenav">          <a href="javascript:void(0)" class="closebtn" onclick="closeNav()">&times;</a>          <h2>Hello world!</h2>  </div>      <script src = "three.js"></script>      <script type = "module" src = "index.js"></script>      <script>          function closeNav() {              document.getElementById("mySidenav").style.width = "0";          }        </script>    

click event function in index.js

function openNav() {    document.getElementById("mySidenav").style.width = "300px";  }    window.addEventListener('click', event => {      // enables object selection    clickMouse.x = ( event.clientX / window.innerWidth ) * 2 - 1;    clickMouse.y = - ( event.clientY / window.innerHeight ) * 2 + 1;    // enables different object selection     raycaster.setFromCamera( clickMouse, camera );    //checking mesh objects the ray are intersecting with    const found = raycaster.intersectObjects( scene.children );    // console.log(found);    // console.log(found[0]);    if(found.length > 0){        // console.log(found);         for (let index = 0; index < found.length; index++) {           if (found[index].object.name === "Cone") {              console.log(found[index].object.name);                        openNav();           }      }    }  })  

Git + IntelliJ - how to make files appear again in commit-tab

Posted: 03 Jun 2022 07:07 AM PDT

IntelliJ has this nice features with a commit-tab in their IDE, which allows you to see all the changes in all files, and also has the revert-button and a lot of other useful functions that I like.

The thing is that those files are only shown there when they are uncommited and then when I commit they disappear (as they should)

enter image description here

Now I have been working a few weeks on a project, and I have made 5 commits, and after each commit the window is cleared out, so they are no longer present in that window.

Question: If I squeeze all commits into one, with:

git rebase -i HEAD~5  

Will that make all of the previous commited files to appear in this window again, so I can clean up and make a push to remote repo?

NPM stuck on idealTree: timing idealTree

Posted: 03 Jun 2022 07:07 AM PDT

Today i decided to start react native cli project. Everything works great since i want to add new lib of course using npm . So i ran npm install ... . And this command always stuck on Image

idealTree: timing idealTree Completed in 3440ms

And nothing happened. So i tried to ran

npm install --verbose

And again stuck on the same place. Also clear cache npm cache clear --force and nothing happened again. I don'n know how to fix this

Yup validation for loginID with dynamic data type(either email or phone number)

Posted: 03 Jun 2022 07:07 AM PDT

I am trying to implement login functionality using Formik and Yup. This is my current schema

let loginSchema = yup.object().shape({loginId:  yup    .string()    .email("That doesn't look like a valid email")    .required("This field is required."),password: yup.string().required("This field is required."),});  

But my loginId can either be a phone number or email. So, how do i add the validation based on the type of field that has been entered in the form. If its an email, trigger validation for email or if its phone number, i want to validate it against a regex.

Your connection was interrupted. ERR_NETWORK_CHANGED when parse with Selenium

Posted: 03 Jun 2022 07:07 AM PDT

I wrote a parser in selenium, which clicks to different links and parses data. But from time to time I get an error

Your connection was interrupted. ERR_NETWORK_CHANGED

Perhaps this error is not related to selenium.

But, if I wait a little (about 1 second), then the connection appears again and I can continue to parse.

What way is there to solve this problem programmatically? Maybe in this case, somehow, I can reload the page until the connection appears again?

Pyautogui on RDP

Posted: 03 Jun 2022 07:07 AM PDT

I am using pyautogui in Windows 10 with Python 3, in a virtual machine accessed by remote desktop.

Unfortunately, the program stops execution when I close remote connection, giving "OSError: screen grab failed".

I've searched for a solution online, but the only workaround that I've found is from this link

Use a remote desktop client that allows you to keep outputting the display, even if you minimise the window/close your PC. I used terminals (https://terminals.codeplex.com/ - not affiliated with them at all just recommending as it solved this issue for me).You can set this up to persist the display, and your code should then run fine.

The problem is that I can't find a setting for persisting display. I've also found this:

pyautogui._pyautogui_x11._display = Xlib.display.Display(              os.environ['DISPLAY']          )  

... but it doesn't seems to work either (gives me errors...).

Do you have some workaround to do the trick?

How to dismiss flutter dialog?

Posted: 03 Jun 2022 07:07 AM PDT

I am new to flutter, I want to dismiss my dialog after the task completion. I've tried with:

Navigator.pop(context, true);   

But my screen is getting black and dialog is still up there. here is my dialog code.

Dialog _dialog = new Dialog(    child: new Row(      mainAxisSize: MainAsixSize.min,       children: <Widget> [      new CircularProgressIndicator(),       new Text("Loading")]),         );   

How to access the results of queries? [duplicate]

Posted: 03 Jun 2022 07:06 AM PDT

I am working on writing a simple test to validate that the number of distinct values in an "id" column matches the number of rows for each table. I am expecting to be able to access particular values of an object, but when I run code and try to print the value of my variable, I can see that my object is a sqlalchemy.engine.result.ResultProxy object at..., as opposed to being something human readable. I have been on the SQLAlchemy website for over an hour, and have googled several permutations of my question, but have not found what I am looking for.

My code, with terminal output, is below:

from sqlalchemy import create_engine   engine = create_engine('postgresql://kyle.pekosh@localhost:5432/testload')  connection = engine.connect()  id_count = connection.execute('SELECT COUNT(DISTINCT(id)) FROM csv.agencies')  id_count  <sqlalchemy.engine.result.ResultProxy object at 0x10357d290>  

sqlalchemy print results instead of objects

Posted: 03 Jun 2022 07:07 AM PDT

I am trying to print the results of my query to the console, with the below code, but it keeps returning me the object location instead.

test = connection.execute('SELECT EXISTS(SELECT 1 FROM "my_table" WHERE Code = 08001)')  print(test)  

Result that I get is - <sqlalchemy.engine.result.ResultProxy object at 0x000002108508B278>

How do I print out the value instead of the object?

Reason I am asking is because I want to use the value to do comparison tests. EG:

if each_item not in test:      # do stuffs  

Is there any way to prevent certain references from being included on a project?

Posted: 03 Jun 2022 07:07 AM PDT

Basically I want to do some preventative maintenance. There are certain 3rd party libraries that I'd like to prevent being included as references in a certain project. Is there any way you can specify which references are prohibited for a project?

EDIT: I'll clarify the purpose a bit. The project I want to protect is a class library that I want to have functionality from a very specific set of 3rd party libraries. The class library is used in other solutions for common data access functionality so if those 3rd party libraries were referenced, they would be needed as well. The aim is to keep that one project just a data access library and keep the "package" lightweight.

Need iterator when using ranged-based for loops

Posted: 03 Jun 2022 07:07 AM PDT

Currently, I can only do ranged based loops with this:

for (auto& value : values)  

But sometimes I need an iterator to the value, instead of a reference (For whatever reason). Is there any method without having to go through the whole vector comparing values?

1 comment:

  1. One of the most frequent network troubles experienced by Google Chrome users is the Err network changed error. When using Google Chrome to connect to the internet, customers encounter numerous issues. Google Chrome Err Network Changed Windows 10 errors indicate that your internet connection or browser is preventing you from loading a specific page. The primary problem is that, unless you fix this mistake, Google Chrome won't let you open any websites. Let's examine the causes of and solutions for the Err network changed problem.
    err_network_changed

    ReplyDelete