text:
Q: Jupyter/Colab won't load/update local files properly When importing local files, if I add/change functions then it doesn't update.
Local File
Named Dataset3:
def function_thingy(abc, bcd):
    return None

def added_more_functions(blah):
    return None

In Colab:
import Dataset3

Dataset3??

Output:
Type:        module
String form: <module 'Dataset3' from '/storage/homes/tejaspan/FlowVO/Dataset3.py'>
File:        /storage/homes/tejaspan/FlowVO/Dataset3.py
Source:
def function_thingy(abc, bcd):
    return None

def added_more_functions(blah):
    return None

In Colab:
import Dataset3

#Dataset3??
Dataset3.function_thingy??

Output:
Object `Dataset3.function_thingy` not found.

In Colab:
import Dataset3

#Dataset3??
#Dataset3.function_thingy??
Dataset3.added_more_functions??

Output:
Object `Dataset3.added_more_functions` not found.

I don't have a good idea if somethings wrong or if it's the expected result. Restarting the kernels fixes the issue.


text:
Q: Copy files using drag-drop from Firefox in Ubuntu Usually you can save a picture from the web just by dragging and dropping it from your browser to a folder, right? I have always done that, but in my computer at work that runs on Ubuntu 10.10 I always get an error trying to do it.
I'm using Firefox, and I have this same error since version 3.5, so I think it's not a Firefox problem, but rather an Ubuntu problem. I don't know the exact error message, even because it's not in english, but it's something like "cannot copy to an invalid location".
Does anyone ever experienced this problem? I have the same distro in a laptop but never had any problems.

redpajama_set_name: RedPajamaStackExchange


text:
Q: Limit Lebesgue measure of the preimage of a vanishing set (i.e. a set which tends to be empty) Let $f: \mathbb{R} \to \mathbb{R}$ be a continuous real-valued function defined over a compact domain $[0, T] \subset \mathbb{R}$.
Let $c \in \mathbb{R}$ such that $\min_{x\in[0, T]} f(x) < c <\max_{x\in[0, T]} f(x)$.
It seems that the following result is true although I don't manage to prove it:
$$\lim_{h \to 0^+} \lvert f^{-1} \left(\ ]c, c+h[\ \right) \rvert = \lim_{h \to 0^+} \lambda\left( f^{-1} \left(\ ]c, c+h[\ \right) \right) = 0$$
where $\lambda(\cdot) = \lvert \cdot \rvert$ is the Lebesgue measure of a measurable set.
If someone comes up with a hint or a reference I would be very grateful!

A: Hint: sets of the form $(c+\frac{1}{n+1},c+\frac{1}{n}]$ are disjoint. So are their preimages. Add up the measures of their preimages. Use facts about absolutely convergent series.

A: This is an alternative approach to @ChrisSanders's.
Define for some $\varepsilon>0$, $A_{\varepsilon, n}=(c,c+\varepsilon/n)$. We have $A_{\varepsilon,n}\supseteq A_{\varepsilon,n+1},\,\forall n$. Furthermore, $\cap_{n \in \mathbb{N}}A_{n,\varepsilon}=\emptyset$. Also, $f^{-1}(A_{\varepsilon,n})\supseteq f^{-1}(A_{\varepsilon,n+1})$ and $\cap_{n \in \mathbb{N}}f^{-1}(A_n)=f^{-1}(\cap_{n \in \mathbb{N}}A_n)=f^{-1}(\emptyset)=\emptyset$. If we can use continuity of measures, we have $\lambda(f^{-1}(A_{\varepsilon,n}))\to 0$. We can justify continuity of measures if there exists $\varepsilon>0$ s.t. $\lambda(f^{-1}(A_{\varepsilon,1}))<\infty$. In this case, this $\varepsilon$ exists because $f$ is continuous over $[0,T]$: just choose $\varepsilon=|c-\sup_{x \in [0,T]} f(x)|$. We then have $\lambda(f^{-1}(A_{\varepsilon,1}))\leq \lambda([0,T])=T$.


text:
Q: Rails - ActiveRecord::RecordNotFound (Couldn't find Comment with 'id'=27): I'm building an Event app using Rails and have comments as a nested resource. I'm trying to implement an Edit function using Ajax/in-line editing but my Edit link isn't working.
I'm not getting an error up on screen but I am getting above error from my development log. The comment 'id' = 27 relates to the event_id not the comment id. How do I rectify this?
Here's the relevant code -
comments_controller.rb
class CommentsController < ApplicationController

    before_action :set_event, only: [:show, :create, :edit, :update, :destroy]
    before_action :set_comment, only: [:show, :create, :edit, :update, :destroy]

    def create

        @comment = @event.comments.create(comment_params)
        @comment.user_id = current_user.id

        if @comment.save
            redirect_to @event
        else
            render 'new'
        end
    end

    # GET /comments/1/edit
    def edit

        respond_to do |f|
            f.js
            f.html
        end
    end

    def show
    end

    def update
        if @comment.update(comment_params)
            redirect_to @event, notice: "Comment was successfully updated!"
        else
            render 'edit'
        end
    end

    def destroy

        @comment.destroy

        redirect_to event_path(@event)
    end

    private

    def set_comment
      @comment = Comment.find(params[:id])
    end

    def set_event
        @event = Event.find(params[:event_id])
    end

    def comment_params
      params.require(:comment).permit(:name, :body)
    end

end

_comment.html.erb

    <div id="<%=dom_id(comment)%>" class="comment">

<%= comment.name %>

<%= comment.body %>

      <% if user_signed_in?  %>

<%= link_to 'Edit', edit_event_comment_path(@event, @comment.event), id: "comment", remote: true %>

<%= link_to 'Delete', [@comment.event, comment],
                  method: :delete,
                  class: "button",
                  data: { confirm: 'Are you sure?' } %>

      <% end %>

edit.js.erb
$('#comment').append('<%= j render 'form' %>');

_form.html.erb
<%= simple_form_for([@event, @comment], remote: true) do |f| %>

    <%= f.label :comment %>

    <%= f.text_area :body %>

    <%= f.button :submit, label: 'Add Comment', class: "btn btn-primary" %>
<% end %>

I've checked the routes and they're all as they should be.I can't check whether the in-line editing will work unless I fix this first.

A: As far as I can see you have two before actions, set_event and then set_comment.
If you've set both of these to look for params[:id], then it means they will obviously both be using the same value for a search. You will need to change one of them, let us say set_event, to something like:
def set_event
  @event = Event.find(params[:event_id])
end

You will also have to change your routes to account for the new id. If you are using your standard resource routes:
resources :events, param: event_id do
  resources :comments
end

This will give you routes such as:
localhost:3000/events/:event_id/comments/:id

Which you can then use to find your events and comments.


text:
Q: Gensim: cannot import name 'Phraser' It may be very basic problem but i have stuck with this since 2 hours.
I am trying to execute below line of code:
from gensim.models.phrases import Phrases , Phraser

but i am getting error: cannot import name 'Phraser' as for as i know we get this kind of error when Phraser is neither variable nor function in gensim.models.phrases but i have checked gensim's homepage and found this:

class gensim.models.phrases.Phraser(phrases_model)

I have gensim's latest module 0.13.4 and i am using Python 3.5.2 |Anaconda 4.1.1 (64-bit), on windows 10.

A: I was able to import Phraser like this on Windows 8:
from gensim.models.phrases import Phraser

Using Anaconda with Python 2.7 and gensim 1.0.1


text:
Q: Identical sums of elements in two arrays I have two arrays of integers v1 and v2 with same length. I want to find the largest subset of elements of v1 for which the sum is identical to that of the corresponding elements in v2. For example, let
v1 = [1 2 3 1]
v2 = [2 3 1 2]

the sum of the 2nd, 3rd and 4th element is 6 in both arrays so this would be the subset that I am looking for.
Is there a way to compute this?
Thanks a lot in advance.
Cesare

A: Compute the deltas, and the problem is reduced to the subset sum problem. In other words, create a third array where each element is the difference between the corresponding elements in the two input arrays.
For example, given the input arrays v1 and v2, create a third array v3 that contains the differences:
       0  1  2  3   <-- index into the array
v1 = [ 1  2  3  1]
v2 = [ 2  3  1  2]
v3 = [-1 -1  2 -1]

Then any subset in v3 that adds to 0 is a solution. In this example, the solutions are represented by the sets of indexes: {0,1,2}, {0,2,3}, and {1,2,3}.


text:
Q: Incorrectly embedded jQuery variable the callback function here isn't working. I think I'm using the startColor variable incorrectly.
note: This requires jQuery UI.
$("a").hover(function() {
    var startColor = $(this).css("color");
    $(this).stop().animate({ color: "#54a888"}, 350);
    },function() {
    $(this).stop().animate({ color: " + startColor + "}, 350);
});

Thanks guys. I was actually trying to refactor this code:
$("nav ul li a, aside ul li a").hover(function() {
    $(this).stop().animate({ color: "#54a888"}, 350);  //End color
    },function() {
    $(this).stop().animate({ color: "#5944b2"}, 350);  //Start color
});
$("h5#logo a, button").hover(function() {
    $(this).stop().animate({ backgroundColor: "#54a888"}, 350);
    },function() {
    $(this).stop().animate({ backgroundColor: "#000000"}, 350);
});
    $("h3 a").hover(function() {
    $(this).stop().animate({ color: "#54a888"}, 350);
    },function() {
    $(this).stop().animate({ color: "#000000"}, 350);
});

I have different starting colors and different properties that I want to animate. Seems like there's a better solution than repeating the same code 3 times.

A: The " + + " doesn't make sense. Just use
$(this).stop().animate({ color: startColor}, 350);  //Start color  });

A: Declare it outside the two functions, and remove the " + + "
var startColor;

$("a").hover(function() {
    startColor = $(this).css("color");
    $(this).stop().animate({ color: "#54a888"}, 350);  //End color
},function() {
    $(this).stop().animate({ color: startColor}, 350);  //Start color
});

...or better yet, use .data() to remember the color for that particular element:
$("a").hover(function() {
    if( !$(this).data( 'startColor' ) ) {
        $(this).data( 'startColor', $(this).css("color") );
    }
    $(this).stop().animate({ color: "#54a888"}, 350);  //End color
},function() {
    $(this).stop().animate({ color: $(this).data('startColor')}, 350);
});

...or if the color happens to be the same for all the links, just get it once, and reuse that value. It may actually be safer since you're dealing with an animation.
var startColor = $(a).css("color");

$("a").hover(function() {
    $(this).stop().animate({ color: "#54a888"}, 350);  //End color
},function() {
    $(this).stop().animate({ color: startColor}, 350);  //Start color
});

EDIT: Based on your updated question, it looks like you're trying to do a little code reduction. Seems like there's enough difference between them that trying to consolidation would be complicated enough that  you may end up with more code.
One way to reduce would be to change your hover() handlers to accept 1 function instead of 2:
$("h3 a").hover(function( e ) {
    $(this).stop().animate({ color: e.type == 'mouseenter' ? "#54a888" : "#000000"}, 350);
});

Shortens it up a bit.
Another option (since you're using jQueryUI I assume) would be to animating a toggleClass (though I think it may be broken in the latest version of UI).
$("h3 a,nav ul li a, aside ul li a,nav ul li a, aside ul li a").hover(function( e ) {
    $(this).stop().toggleClass('hover', 350);
});

Then in CSS:
h3 a.hover {
    color:#000000;
}

nav ul li a.hover, aside ul li a.hover {
    color:#54a888;
}

// etc...

...just be aware again that I think it may be broken in the latest version, and you'll need to test because it can sometimes be flakey.

A: You're creating a local variable in one callback and trying to use it in the other.
Instead, you should store the old color using $.data.
Also, don't put quotes around the variable; that makes it into a string.


text:
Q: How to add textviews in response to button clicks (strings that user enters)? I want to display underneath my AutoCompleteTextView what the user entered when they press the button beside it. So basically adding a textview in response to button clicks. I have "hello world" displaying where i want them to be right now, but am stuck on how to do this inside a button listener. Any help is appreciated thank you.
Here is an image example of what I am trying to accomplish exactly.
sample display
my onCreate so far:
public class MainActivity extends AppCompatActivity {

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    TextView textView = new TextView(this);
    textView.setText("hello world");

    LinearLayout linearLayout = (LinearLayout) findViewById(R.id.activity_main);
    //LayoutParams is a class to specify layout properties when adding a view to a layout
    LinearLayout.LayoutParams layoutParams = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT,
            LinearLayout.LayoutParams.WRAP_CONTENT);
    linearLayout.addView(textView, layoutParams);
  }
}

XML for layout:
<LinearLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:id="@+id/activity_main"
    android:orientation="vertical"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:paddingLeft="@dimen/activity_horizontal_margin"
    android:paddingRight="@dimen/activity_horizontal_margin"
    android:paddingTop="@dimen/activity_vertical_margin"
    android:paddingBottom="@dimen/activity_vertical_margin"
    tools:context="com.example.tester.MainActivity">

    <LinearLayout
        android:orientation="horizontal"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content">

        <AutoCompleteTextView
            android:text="AutoCompleteTextView"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:id="@+id/autoCompleteTextView"
            android:layout_weight="1" />

        <Button
            android:text="PRESS ME"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:id="@+id/button2"
            android:layout_weight="1" />
    </LinearLayout>
</LinearLayout>

A: Try this
Button button1 = (Button) findViewById(R.id.button2);
AutocompleteTextView autoTv = (autocompleteTextView) findViewById(R.id.autocompleteTextView);
button1.setOnClickListener(new View.OnClickListener() {
  @Override public void onClick(View v) {
    String enteredText = autoTv.getText().toString();
    if (!enteredText.isEmpty()) {
      TextView textView = new TextView(this);
      textView.setText(enteredText);

      LinearLayout linearLayout = (LinearLayout) findViewById(R.id.activity_main);
      //LayoutParams is a class to specify layout properties when adding a view to a layout
      LinearLayout.LayoutParams layoutParams = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT,
          LinearLayout.LayoutParams.WRAP_CONTENT);
      linearLayout.addView(textView, layoutParams);
    }
  }
});


text:
Q: How compare too similar files I have two text files like this:
line are like => SITE.MACHINE.VARIABLE_NAME=VARIABLE_VALUE
CPM-NOMINAL.WAC12.CHRONO_SANSREPONSE_KEEPALIVE=0
CPM-NOMINAL.WAC13.CHRONO_SANSREPONSE_KEEPALIVE=0
DEMO-WEB.WAC7.XN_TCP_SERVICE_PDD_PORT=32099
...

They are already sort -u
I have to find out which lines are in one file or in another or have been modified (I do not care about the common ones), like sdiff command.
But the files are have too similar lines that create the diff error.
I'm thinking of diff on the left side of "=" and, if ok, check for the right side.
I am looking for a solution that prints an output like sdiff or kind of.
output wanted exemple :
File1                                                         | File2
CPM-NOMINAL.WAC10.SAR_PARI_SUJET_A_COTES="1:0:1:1:0:0:0:0:0"  | CPM-NOMINAL.WAC10.SAR_PARI_SUJET_A_COTES="1:0:1:1:0:0:0:1:0"
CPM-NOMINAL.WAC12.CHRONO_SANSREPONSE_KEEPALIVE=1              | CPM-NOMINAL.WAC12.CHRONO_SANSREPONSE_KEEPALIVE=0
CPM-NOMINAL.WAC12.PARIS_SANSREPONSE_KEEPALIVE=1               | CPM-NOMINAL.WAC12.PARIS_SANSREPONSE_KEEPALIVE=0
CPM-NOMINAL.WAC12.PARIS_SANS_EMISSION_KEEPALIVE=1             | CPM-NOMINAL.WAC12.PARIS_SANS_EMISSION_KEEPALIVE=0
CPM-NOMINAL.WAC12.PROTOCOLE_PDD=2                             | CPM-NOMINAL.WAC12.PROTOCOLE_PDD=3
                                                              > CPM-NOMINAL.WAC7.SQL_PROC_INIT_XAPDD_MBN_TEST="p_initialiser"
CPM-NOMINAL.WAC8.FAIRE_VERIF_CHAINAGE=FALSE                   | CPM-NOMINAL.WAC8.FAIRE_VERIF_CHAINAGE=TRUE
DEMO-WEB.WAC7.XN_TCP_SERVICE_PDD_PORT=3201                    | DEMO-WEB.WAC7.XN_TCP_SERVICE_PDD_PORT=32099
DEMO-WEB.WAC7.XN_TCP_SERVICE_SAR_PORT=3201                    | DEMO-WEB.WAC7.XN_TCP_SERVICE_SAR_PORT=3204

Thank you.

A: something like this can be done with join
$ join -a1 -a2 -e"---" -t= -o1.1,1.2,2.2,2.1 file1 file2 | column -ts=

CPM-NOMINAL.WAC10.SAR_PARI_SUJET_A_COTES         "1:0:1:1:0:0:0:0:0"             "1:0:1:1:0:0:0:1:0"  CPM-NOMINAL.WAC10.SAR_PARI_SUJET_A_COTES
CPM-NOMINAL.WAC12.CHRONO_SANSREPONSE_KEEPALIVE   1                               0                    CPM-NOMINAL.WAC12.CHRONO_SANSREPONSE_KEEPALIVE
CPM-NOMINAL.WAC12.PARIS_SANSREPONSE_KEEPALIVE    1                               0                    CPM-NOMINAL.WAC12.PARIS_SANSREPONSE_KEEPALIVE
CPM-NOMINAL.WAC12.PARIS_SANS_EMISSION_KEEPALIVE  1                               0                    CPM-NOMINAL.WAC12.PARIS_SANS_EMISSION_KEEPALIVE
CPM-NOMINAL.WAC12.PROTOCOLE_PDD                  2                               3                    CPM-NOMINAL.WAC12.PROTOCOLE_PDD
---                                              ---                             "p_initialiser"      CPM-NOMINAL.WAC7.SQL_PROC_INIT_XAPDD_MBN_TEST
CPM-NOMINAL.WAC8.FAIRE_VERIF_CHAINAGE            FALSE                           TRUE                 CPM-NOMINAL.WAC8.FAIRE_VERIF_CHAINAGE
DEMO-WEB.WAC7.XN_TCP_SERVICE_PDD_PORT            3201                            32099                DEMO-WEB.WAC7.XN_TCP_SERVICE_PDD_PORT
DEMO-WEB.WAC7.XN_TCP_SERVICE_SAR_PORT            3201                            3204                 DEMO-WEB.WAC7.XN_TCP_SERVICE_SAR_PORT

common values can be eliminated with piping to awk '$2!=$3'

A: Here is a possible way of doing this with traditional tools and pipelines. I use the terminology key and value as the file looks like
key = value

The following list of commands give you possible answers:
# lines common between file1 and file2
grep -F -f file1 file2
# lines in file2 not in file1
grep -v -F -f file1 file2
# changed key values from file1 to file2
cut -d'=' -f1 file1 | grep -F -f - <(grep -v -F -f file1 file2)
# keys in file1 but not in file2
cut -d'=' -f1 file1 | grep -v -F -f - file2
# keys in file2 but not in file1
cut -d'=' -f1 file2 | grep -v -F -f - file1

Or you can just go for one simple awk, this is not the most optimised, but gives a clean output:
$ awk '
    BEGIN{FS=" *= *"}
    {key=$1;value=$2}
    (NR==FNR){a[key]=value; next}
    {b[key] = value }
    END {
       for (key in a) if (key in b) {
           print (a[key] == b[key] ? "COMM" : "DIFF"), key,"=",a[key],"<=>",b[key]
           delete a[key]
           delete b[key]
       }
       for (key in a) {
           print "UNI1", key,"=",a[key]
       }
       for (key in b) {
           print "UNI2", key,"=",b[key]
       }
    }' file1 file2

This will produce some output looking like
 COMM key1 = val1 <=> val1
 COMM key2 = val2 <=> val2
 DIFF key3 = val31 <=> val32
 COMM key4 = val4 <=> val4
 UNI1 key5 = val5
 UNI2 key6 = val6


text:
Q: Django: "request" does not contain the 'method' (POST/GET) I've created a [seemingly] straightforward form for customers, however, after the user submits the form, when i try to check the returning request m- I'm getting :
Exception Type:
AttributeError
Exception Value:
'QueryDict' object has no attribute 'method'
when i checked I saw that the request objects contains only the data submitted in the form, and doesn't include the "method" attribute
this is the function that is used by the form:
def institutionapply(request):
    print(request)
    print("request: ",request)
    a=get_ip(request)
    print (a)
    country=get_country(request)
    # if this is a POST request we need to process the form data

    if request.method == 'POST':
        # create a form instance and populate it with data from the request:
        form = institutionapply(request.POST)
        print ("form in post clause:",form)
        #print ("duration output:",form.duration)
        # check whether it's valid:
        if form.is_valid():
            print ("print form is valid")
            print (form.cleaned_data['title'])
            print (form.cleaned_data['country'])

            # process the data in form.cleaned_data as required
            # ...
            # redirect to a new URL:
            #return HttpResponseRedirect('/thanks/')
            #return redirect(name='home')
    # if a GET (or any other method) we'll create a blank form
    else:
        # create a form instance and populate it with data from the request:
        data = {'title': '', 'first': '', 'last':'', 'country':'','internationalprefix':'','phone':'','email':'','institutionname':'','institutionurl':'',}
        form = institutionform(data)
    return render(request,'app/intitutionapply.html', {'form': form})

any ideas why the "method" object is nowhere to be found?
EDIT : url configuration:
urlpatterns = [
    url(r'^$', views.home, name='home'),
    url(r'^InstitutionApply$', views.institutionapply, name='institutionapply'),
    url(r'^contact$', views.contact, name='contact'),
    url(r'^about', views.about, name='about'),
    url(r'^admin/', admin.site.urls),

from the html template , the form declaration is:

the functions from views.py
def get_country(request):
    a=get_ip(request)
    country='United States'
    g = GeoIP2(path='D:/newTelumis/newTelumis/GeoLite2-Country.mmdb')
    return country

def  get_ip(request):
    try:
        x_forward= request.META.get("HTTP_X_FORWARD_FOR")
        if x_forward:
            ip=x_forward.split(",")[0]
        else:
            ip=request.META.get("REMOTE_ADDR")
    except:
        ip=""
    return ip

A: def institutionapply(request):
    ...
    if request.method == 'POST':
        ...
        form = institutionapply(request.POST)

Replace institutionapply with institutionform.


text:
Q: Not able to access the internet on CentOS 6.2? I have installed the VMware Player to use the CentOS 6.2 on my machine having Windows XP operating system. When I am using the CentOS , I am not able to access the internet . But the sites hosted by our organization's intranet are accessible.
Also , I am able to access the internet and intranet  when I am accessing it in the XP environment.
I have not created any user for the CentOS and it is avaialbe to me  when I am selecting any instance of the CentOS through the VMware Player.
Looking for Help!

A: I had this problem too, and it seems the solution is to modify
/etc/sysconfig/network-scripts/ifcfg-eth0

So that the line reads
 ONBOOT=yes instead of the default   ONBOOT=no
Then restart your computer, or run ifup eth0 and you should have internet working. Since the default is to have no network, it can be tricky to find the solution if you haven't got another computer to look it up from!


text:
Q: Atualizar uma variável PHP dentro de uma função Javascript Estou utilizando o seguinte código para exibir a hora atual do servidor:

As variáveis segundosInicio, inicioYujiaLynxA e difLynx estão definidas em outro arquivo, chamado através de  no início do documento.
A variável segundoAtual define a posição de um elemento (pin), sobre um mapa...
O resultado é obtido em segundos desde a meia noite de hoje.
Ou setInterval não está sendo executado para atualizar a hora, ou a variável só poderá ser atualizada se a página for recarregada?

A: Apenas quando a página for atualizada, ideal seria vc fazer o seguinte:
Criar uma página PHP que retorna o horário do servidor.
Crie uma segunda página com o seu javascript chamando via ajax essa página que retorna o horário. Assim você pode atualizar seu elemento javascript.
test.php

hora.php
<?php
date_default_timezone_set('America/Sao_Paulo');
$cH = date('G');
$cM = date('i');
$cS = date('s');
echo ($cH*60*60)+($cM*60)+$cS;
?>


text:
Q: iPhone - can I use MapKit without displaying a Map? I am writing an app that will use Reverse Geocoding to translate the user's current location into something like a Street Address or City. It seems the only way to get this kind of information is via MapKit (specifically the Placemark class).
Can I use this without having to display a map to the user?
The reason I am asking this is because in the Google HTTP Reverse Geocoding documentation it states:

Note: the geocoding service may only be used in conjunction with displaying results on a Google map; geocoding results without displaying them on a map is prohibited. For complete details on allowed usage, consult the Maps API Terms of Service License Restrictions.

I'm wondering if this holds true for the MapKit API as well or if Google and Apple worked something out.

A: I answer my own question way too much around here -

10.12 use or display the Content without a corresponding Google map, unless you are explicitly permitted to do so in the Maps API Documentation, the Street View API Documentation, or through written permission from Google (for example, you must not use geocodes obtained through the Service except in conjunction with a Google map, but the Street View API Documentation explicitly permits you to display Street View imagery without a corresponding Google map); or

via Google Maps iPhone TOS

A: The Map Kit framework provides an embeddable map interface for your application. Use it to display map or satellite imagery from the windows and views of your custom applications. You can also use the framework to annotate your maps with points of interest and other custom information.
What was stated above about using Googles HTTP API for reverse geocoding would be a better way to display the information you are looking for and using a text box to read the information.


text:
Q: Scheme program freezes with no exceptions Ok, i'm taking this scheme class on the university, and we just got our first assignment. I'm experiencing this wierd thing though. Sometimes the program will freeze, do absolutely nothing without giving me any sort of warning as to why this is...
Take the following procedure:
(define (calc-week-day y1 m d w y2) ; anta y2 > y1
  (define (days-between-months m1 m2 y)
    (if (= m1 m2)
        0
        (+ (month-length y m1) (days-between-months (+ m1 1) m2 y))))
  (define (days-between-years y1 y2)
    (if (= y1 y2)
        0
        (+ (year-length y1) (days-between-years (+ y1 1) y2))))
  (define (days-til-months-end d m y)
    (- (month-length y m) d))
  (define (calculate-day day offset)
    (cond ((> day 6) (calculate-day 0 (- offset 1)))
          ((= offset 0) day)
          (else (calculate-day (+ day 1) (- offset 1)))))

  (define dager-til-nyttår (+ (days-between-months m 12 y1)
                              (days-til-months-end d 12 y1) 1))
  (define dager-fra-nyttår (+ (days-between-months 1 m y2) d 2))
  (define dager-mellom-datoer (+ dager-til-nyttår (days-between-years y1 y2)
                                 dager-fra-nyttår))

  (num->day (calculate-day (day->num w) dager-mellom-datoer)))

calc-week-day basically takes two years where y2 > y1 always. m = month, d = day and w = day of the week (monday, tuesday...) The function figures out the difference in days between the same date in y1 and y2, and figures out the day of the week in y2 ...
This procedure doesn't work as it should. This will in fact not produce any output. However, if I remove the last digit (2) from (define dager-fra-nyttår ...) it works just fine and produces the day of the week to the output screen (though not the correct dates).
Anyone know why this is? (using Racket 5.2 on Mac OSX Lion)

A: It sounds like you're stuck in an infinite loop.
My guess is that either days-between-months or days-between-years is calling itself endlessly.
For example, days-between-months seems to presume that m1 <= m2.  But if you call it with m1 > m2, it looks like it would keep calling itself "forever" -- keep trying to increment m1 until it equals m2, but it never will, because it's already greater. (Well, "never", or at least for a long time until the integer value wraps around.)
Practically, there are two ways to address this.

*

*The "defensive programming" way is to change your if test from (= m1 m2) to (<= m1 m2).  A lot of programmers would do this.

*The Writing Solid Code way would be to say, wait, the problem is with the caller passing nonsense values to the function: The caller should be fixed, rather than the function silently hiding the mistake. If you like this approach, you'd add an assert in a language like C, or here you could do something like (when (> m1 m2) (error)) to deliberately cause an error. Or in Racket, you could use a contract, and it will complain if you try to violate the conditions you required.
After years of writing code, I prefer the second approach. But you will find good arguments both ways. Also it depends on the nature of the system you're coding, whether you prefer it to be "brittle" about failures so you can find and fix them, or muddle along as best it can. Also some people take the brittle approach in "debug" builds, and the tolerant one for the released product.
Finally, your code calls a couple functions that aren't defined in what you provided (like month-length and year-length), and the problem(s) could be there instead of or in addition to what I mentioned.


text:
Q: Android preferences from settings menu - for phonegap developer I've never written any single line in Java and I doesn't know much about the Java world, so when I hear that I can create android apps using phonegap I was very happy. But as I discovered later, I cannot escape from Java if I want to do something more.
I want to create settings page for my application, I found phongeap extension that allows me to read the phonegap applications settings but to use it I must create the settings GUI which can be done via XML and some Java. I found good tutorial to do it but since I'm not Java developer I cannot understand much from it.
Can someone tell me where to put all this Java and XML stuff to simply get the settings GUI working in phonegap application. I mean what files I need, with what content and in what directories.

A: With phonegap you can escape all the java codes, as you'll see in the following code, you wont need any java code:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
                      "http://www.w3.org/TR/html4/strict.dtd">
<html>
  <head>
    <title>Cordova Menu Button Example</title>

    <script type="text/javascript" charset="utf-8" src="cordova-2.3.0.js"></script>
    <script type="text/javascript" charset="utf-8">

    // Call onDeviceReady when Cordova is loaded.
    // At this point, the document has loaded but cordova-2.3.0.js has not.
    // When Cordova is loaded and talking with the native device,
    // it will call the event `deviceready`.
    function onLoad() {
        document.addEventListener("deviceready", onDeviceReady, false);
    }

    // Cordova is loaded and it is now safe to make calls Cordova methods
    function onDeviceReady() {
        // Register the event listener
        document.addEventListener("menubutton", onMenuKeyDown, false);
    }

    // Handle the menu button
    function onMenuKeyDown() { alert("menu btn pressed");

    }

    </script>
  </head>
  <body onload="onLoad()">
  </body>
</html>

Dont use plugins for this feature, just go to the main documentation.
Also you may find the other events like:

*

*deviceready

*pause

*resume

*online

*offline

*backbutton

*batterycritical

*batterylow

*batterystatus

*menubutton

*searchbutton

*startcallbutton

*endcallbutton

*volumedownbutton

*volumeupbutton


text:
Q: plot Histogram with shaded area and without common borders in R I'm trying to draw a histogram with a shaded area (between 2 X values), but without the vertical common lines (lines between breaks) and with a abline. I have the following example code:
x<-rnorm(n=100, m=0, sd=1)
h<- hist(x, breaks=50)
cuts<- cut(h$breaks, c(-1, 1))
plot(h, col="green"[cuts])
abline(v=mean(x), lty=2, lwd=2)`

thank you very much, in advance.

A: Try this (follows from your creation of h):
np = length(h$breaks)
x = c(h$breaks[1],rep(h$breaks[-c(1,np)],rep(2,(np-2))), h$breaks[np])
y=rep(h$counts,rep(2,length(h$counts)))

Now x and y are the "skyline" coordinates. Try this:
plot(h)
lines(x,y, col="red", lwd=2)

So for your plot:
# make the plot
plot(h)
# fill the area with green fill and green outline
plot(h, col="green"[cuts], border="green"[cuts],add=TRUE)
# restore the skyline
lines(x,y)
abline(v=mean(x), lty=2, lwd=2)

Giving:

A: I used a much more crude approach. I create two histograms, and then, I overlap them.
h <- hist(x, breaks=50, plot=FALSE)
cuts <- cut(h$breaks, c(-1, 1))
plot(h$breaks, c(h$counts,0) ,type="s",col="black", lwd=2)
plot(h, col="gray"[cuts], lty="blank", add=T)
abline(v=mean(x), lty=2, lwd=2)


text:
Q: Node.js when it makes sense to use async? I am asking myself when it makes sense to be async with callbacks on node.js.
Is it just usefull when I am working with I/O, Databases and everything else what blocks or also in the rest of my code?
For example, I got a "layouter" for a board game. It creates a board instance with a given json layout. I understand that it makes sense to use async for I/O (reading the json layout file), because that blocks.
Whats about for example with a foreach loop?
Should it be async? Does the underlaying libuv profit in any way from this?
Here is the version with the async lib:
/*jshint node: true, strict: true, globalstrict: true*/
"use strict";

// Imports
var fs = require('fs');
var async = require('async');
var Figure = require('../models/figure.js');
var Field = require('../models/field.js');
var Board = require('../models/board.js');

/**
 * @param {Board} board
 * @param {Array} template
 * @param {string} owner
 * @param {function(Error)} callback
 */
var createFigures = function (board, template, owner, callback) {
    async.forEach(template, function (data, done) {
        var figure = new Figure(owner, data.kind);
        board.setFigure(data.x, data.y, figure);
        done();
    }, callback);
};

/**
 * @param {Board} board
 * @param {Array} fields
 */
var createFields = function (board, fields, callback) {
    async.series([
        function(done) {
            for (var x = 0; x < board.getSize().x; x++) {
                for (var y = 0; y < board.getSize().y; y++) {
                    var field = new Field(true, false);
                    board.setField(x, y, field);
                }
            }
            done();
        }, function(done) {
            async.forEach(fields, function(data, iteratDone) {
                var field = new Field(data.passable, data.corner);
                board.setField(data.x, data.y, field);
                iteratDone();
            });
            done();
        }
    ], callback);
};

/**
 * @param {{
 *  ....
 */
var build = function (layoutObj, callback) {
    var board = new Board(layoutObj.name, layoutObj.size.x, layoutObj.size.y);

    async.parallel([
        function (done) {
            createFigures(board, layoutObj.figures.white, Figure.owners.white, done);
        },
        function (done) {
            createFigures(board, layoutObj.figures.black, Figure.owners.black, done);
        },
        function (done) {
            createFields(board, layoutObj.fields, done);
        }
    ],
        function (err) {
            callback(err, board);
        }
    );
};

/**
 * @param string layoutPath
 * @param {function(Error, )} callback
 * @return {Board}
 */
var generateBoardWithLayout = function (layoutPath, callback) {
    async.waterfall([
        function(done) {
            fs.stat(layoutPath, function(err, stats) {
               done(null, stats);
            });
        }, function(stats, done) {
            if (stats.isFile()) {
                var jsonData = '';
                fs.readFile(layoutPath, function(err, data) {
                    jsonData += data;
                    done(null, jsonData);
                });
            } else {
                done(new Error("There is no '" + layoutPath + "'"));
            }
        }
    ], function(err, jsonData) {
        build(JSON.parse(jsonData), callback);
    });

};

module.exports.build = build;
module.exports.generateBoardWithLayout = generateBoardWithLayout;

And thats the version without the async link
/*jshint node: true, strict: true, globalstrict: true*/
"use strict";

// Imports
var Figure = require('../models/figure.js');
var Field = require('../models/field.js');
var Board = require('../models/board.js');

/**
 * @constructor
 */
function Layouter() {

}

Layouter.generateBoardWithLayout = function(layoutPath) {
    var fs = require('fs');

    var jsonData = fs.readFileSync(layoutPath);
    if (!jsonData) {
        throw new Error("There is no '" + layoutPath + "'");
    }

    return new Layouter().build(JSON.parse(jsonData));
};

Layouter.prototype = {

    /**
     * @param {{
     *     ....
     */
    build: function (layoutObj) {
        var board = new Board(layoutObj.name, layoutObj.size.x, layoutObj.size.y);

        this.createFigures_(board, layoutObj.figures.white, Figure.owners.white);
        this.createFigures_(board, layoutObj.figures.black, Figure.owners.black);
        this.createFields_(board, layoutObj.fields);

        return board;
    },

    /**
     * @param {Board} board
     * @param {Array} template
     * @param {string} owner
     * @private
     */
    createFigures_: function (board, template, owner) {
        template.forEach(function (data) {
            var figure = new Figure(owner, data.kind);
            board.setFigure(data.x, data.y, figure);
        });
    },

    /**
     * @param {Board} board
     * @param {Array} fields
     * @private
     */
    createFields_: function (board, fields) {
        for (var x = 0; x < board.getSize().x; x++) {
            for (var y = 0; y < board.getSize().y; y++) {
                var field = new Field(true, false);
                board.setField(x, y, field);
            }
        }

        fields.forEach(function (data) {
            var field = new Field(data.passable, data.corner);
            board.setField(data.x, data.y, field);
        });
    }

};

module.exports = Layouter;
module.exports.generateBoardWithLayout = Layouter.generateBoardWithLayout;

Thanks for your time!
Greetings,
Markus

A: looks like you just make new object instances without doing any I/O, in this case u are unnecessarily complicating the code, it is ugly. You can only continue your program in the last callback function, which limit your entire flow into one single big async call.
Normally your program flow should not depend on its previous async callback to excute first, in you code
createFigure();
createField();

both are one single async call, what if something in createField depend on createFigure to be excuted first, in this case the behavior is undefined. Generally, don't use async unless you are doing blocking operations

A: I think you miss idea behind asynchronicity in Node.js. It's not about using async package (which is just npm package that can be used with Node, and not Node's internal package), but about processing external processes in asynchronous way. e.g. when you query the database, you may do a lot of stuff just while waiting for result, that's the deal.
If your code doesn't query any external processes but it's plain JavaScript, then with single process you can't benefit from asynchronicity directly (Node.js is single threaded), what you may do however is to delegate some work to different process and communicate with it (see child_process.fork).


text:
Q: WCF Rest Service Error Acess Denied Created a WCF Rest Service. It works fine with URL like localhost but when access it with 192.168.1.41 (ipaddress) it throws error "Access Denied".
Tried all the suggestions like Permissions, Enabled Tracing (but nothing logged).
Any Suggestions would be appreciated.
    <?xml version="1.0"?>
<configuration>

  <system.web>
    <trust level="Full" />
    <compilation debug="true" targetFramework="4.0">
      <assemblies>
        <add assembly="System.Data.Entity, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
      </assemblies>
    </compilation>
  </system.web>
  <system.serviceModel>
    <behaviors>
      <serviceBehaviors>
        <behavior name="coTrainServBehavior">
          <!-- To avoid disclosing metadata information, set the value below to false and remove the metadata endpoint above before deployment -->
          <serviceMetadata httpGetEnabled="true" />
          <!-- To receive exception details in faults for debugging purposes, set the value below to true.  Set to false before deployment to avoid disclosing exception information -->
          <serviceDebug includeExceptionDetailInFaults="true" />
        </behavior>
      </serviceBehaviors>
      <endpointBehaviors>
        <behavior name="web">
          <webHttp />
        </behavior>
      </endpointBehaviors>
    </behaviors>
    <services>
      <service name="CoTrain.CoTrainService" behaviorConfiguration="coTrainServBehavior">
        <endpoint address="rh" binding="webHttpBinding" behaviorConfiguration="web" contract="CoTrain.ICoTrainService" />
      </service>
    </services>
    <serviceHostingEnvironment multipleSiteBindingsEnabled="true" minFreeMemoryPercentageToActivateService="0" aspNetCompatibilityEnabled="true" />
    <diagnostics>
      <messageLogging
           logEntireMessage="true"
           logMalformedMessages="true"
           logMessagesAtServiceLevel="true"
           logMessagesAtTransportLevel="true"
           maxMessagesToLog="3000"
           maxSizeOfMessageToLog="2000"/>
    </diagnostics>

  </system.serviceModel>
  <system.diagnostics>
    <trace autoflush="true"/>
    <sources>
      <source name="System.ServiceModel"
               switchValue="Information, ActivityTracing, Error, Warning, Critical" propagateActivity="true">
        <listeners>
          <add name="messages"
          type="System.Diagnostics.XmlWriterTraceListener"
          initializeData="D:\CoTrainPublished\messages.svclog" />
        </listeners>
      </source>
    </sources>
  </system.diagnostics>
  <system.webServer>
    <modules runAllManagedModulesForAllRequests="true" />
  </system.webServer>

  <connectionStrings>
    <add name="CoTrainEntities" connectionString="metadata=res://*/DAL.CoTrainModel.csdl|res://*/DAL.CoTrainModel.ssdl|res://*/DAL.CoTrainModel.msl;provider=System.Data.SqlClient;provider connection string="data source=192.168.1.11;initial catalog=CoTrain;persist security info=True;user id=sa;password=TestServer@123;multipleactiveresultsets=True;App=EntityFramework"" providerName="System.Data.EntityClient" />
  </connectionStrings>
</configuration>

Thanks
Anand


text:
Q: strongswan initiator takes forever to connect Lately I have experienced rather strange problems with my VPN setup. Certain clients fail to connect for a long time. Then it works for a while, until it doesn't. All systems involved (initiators and responder) are Debian buster and up-to-date. Same strongswan packages installed (libcharon-extra-plugins strongswan-charon strongswan-starter libstrongswan-extra-plugins). Same config (usernames and ips differ, obviously). Most of the initiators are VMs on the same host. Same config in regards to network. Some show this problem, others don't. Once a client behaves problematic it stays that way. Most of the clients are running without any problems for months now.
Another problem may or may not be related. In my setup, the initiators are able to connect to each other via the VPN. That works for most of them, but a few cannot reach their peers and neither can't they reach them. And also here, once a client has this problem, it will stick to it
Responder shows a load of 0.00 and 800 MB out of 2 GB are free.
My configs:
Responder:

root@ipsec-1:/home/karsten# cat /etc/ipsec.conf
config setup
    charondebug="ike 0, knl 0, cfg 0"

conn GoogleCloud
    compress=no
    type=tunnel
    keyexchange=ikev2
    fragmentation=yes
    forceencaps=yes
    dpdaction=clear
    dpddelay=300s
    eap_identity=%identity
    left=%any
    leftid=@ipsec.xxxxxxxxx
    leftcert=fullchain.pem
    leftsendcert=always
    leftsubnet=172.31.0.2/24
    rightdns=172.31.0.1
    right=%any
    rightid=%any
    rightauth=eap-mschapv2
    rightsourceip=%config
    rightsendcert=never
    auto=add

Initiator:
root@ROUTER:/home/karsten# cat /etc/ipsec.conf
config setup
   charondebug="ike 0, knl 0, cfg 0"

conn routerhome
   dpdaction=clear
   dpddelay=300s
   fragmentation=yes
   type=tunnel
   keyexchange=ikev2
   eap_identity=routerhome
   left=%defaultroute
   leftsourceip=172.31.0.151
   leftauth=eap-mschapv2
   rightauth=pubkey
   right=35.xxx.xxx.xx
   rightsubnet=172.31.0.0/24
   rightid=%any
   auto=route

eap_identity and leftsourceip are different on other initiators.
root@ipsec-1:/home/karsten# ipsec status
Security Associations (16 up, 0 connecting):
Syslog on the problematic client:

Jun  5 19:20:01 Openxpki CRON[8343]: (root) CMD (   ping -c 5 172.31.0.1 > /dev/null)
Jun  5 19:20:32 Openxpki charon: 14[JOB] CHILD_SA ESP/0xce0decda/192.168.1.251 not found for delete
Jun  5 19:20:32 Openxpki charon: 11[IKE] initiating IKE_SA openxpki[48] to 35.xxx
Jun  5 19:20:32 Openxpki charon: 11[ENC] generating IKE_SA_INIT request 0 [ SA KE No N(NATD_S_IP) N(NATD_D_IP) N(FRAG_SUP) N(HASH_ALG) N(REDIR_SUP) ]
Jun  5 19:20:32 Openxpki charon: 11[NET] sending packet: from 192.168.1.251[500] to xxx[500] (1080 bytes)
Jun  5 19:20:32 Openxpki charon: 16[NET] received packet: from 35.xxx[500] to 192.168.1.251[500] (272 bytes)
Jun  5 19:20:32 Openxpki charon: 16[ENC] parsed IKE_SA_INIT response 0 [ SA KE No N(NATD_S_IP) N(NATD_D_IP) N(FRAG_SUP) N(HASH_ALG) N(MULT_AUTH) ]
Jun  5 19:20:32 Openxpki charon: 16[IKE] establishing CHILD_SA openxpki{145}
Jun  5 19:20:32 Openxpki charon: 16[ENC] generating IKE_AUTH request 1 [ IDi CERTREQ CPRQ(ADDR DNS) SA TSi TSr N(MOBIKE_SUP) N(ADD_6_ADDR) N(MULT_AUTH) N(EAP_ONLY) N(MSG_ID_SYN_SUP) ]
Jun  5 19:20:32 Openxpki charon: 16[NET] sending packet: from 192.168.1.251[4500] to 35.xxx[4500] (368 bytes)
Jun  5 19:20:36 Openxpki charon: 05[NET] sending packet: from 192.168.1.251[4500] to 35.xxx[4500] (368 bytes)
Jun  5 19:20:43 Openxpki charon: 07[NET] sending packet: from 192.168.1.251[4500] to 35.xxx[4500] (368 bytes)
Jun  5 19:20:56 Openxpki charon: 13[NET] sending packet: from 192.168.1.251[4500] to 35.xxx[4500] (368 bytes)
Jun  5 19:21:20 Openxpki charon: 02[NET] sending packet: from 192.168.1.251[4500] to 35.xxx[4500] (368 bytes)

Any ideas?
Update: Today ipsec on the Openxpki initiator is working fine. Connection is established and VPN peers are reachable.
The problem now is with Proxmox host. Ipsec connection is established. But peers are not reachable. Neither can the host itself be connected to from other peers. Via the VPN that is. No problems using local ips.

root@P-T1650:/home/karsten# ipsec statusall
Status of IKE charon daemon (strongSwan 5.7.2, Linux 5.4.41-1-pve, x86_64):
  uptime: 58 minutes, since Jun 08 02:28:42 2020
  malloc: sbrk 3080192, mmap 0, used 1131120, free 1949072
  worker threads: 11 of 16 idle, 5/0/0/0 working, job queue: 0/0/0/0, scheduled: 5
  loaded plugins: charon test-vectors ldap pkcs11 tpm aesni aes rc2 sha2 sha1 md5 mgf1 rdrand random nonce x509 revocation constraints pubkey pkcs1 pkcs7 pkcs8 pkcs12 pgp dnskey sshkey pem openssl gcrypt af-alg fips-prf gmp curve25519 agent chapoly xcbc cmac hmac ctr ccm gcm curl attr kernel-netlink resolve socket-default connmark farp stroke updown eap-identity eap-aka eap-md5 eap-gtc eap-mschapv2 eap-radius eap-tls eap-ttls eap-tnc xauth-generic xauth-eap xauth-pam tnc-tnccs dhcp lookip error-notify certexpire led addrblock unity counters
Listening IP addresses:
  192.168.1.147
  2a01:c22:3434:9900:92b1:1cff:fe9c:82a0
  2a01:c23:5c09:1100:92b1:1cff:fe9c:82a0
Connections:
      athome:  %any...35.xxx  IKEv2, dpddelay=300s
      athome:   local:  uses EAP_MSCHAPV2 authentication with EAP identity 'proxmoxhome'
      athome:   remote: uses public key authentication
      athome:   child:  dynamic === 172.31.0.0/24 TUNNEL, dpdaction=clear
Routed Connections:
      athome{1}:  ROUTED, TUNNEL, reqid 1
      athome{1}:   192.168.1.147/32 === 172.31.0.0/24
Security Associations (1 up, 0 connecting):
      athome[1]: ESTABLISHED 58 minutes ago, 192.168.1.147[192.168.1.147]...35.xxx[ipsec.xxx]
      athome[1]: IKEv2 SPIs: dfdcf7762d70554a_i* e8fb6db55242bdb8_r, EAP reauthentication in 103 minutes
      athome[1]: IKE proposal: AES_CBC_128/HMAC_SHA2_256_128/PRF_AES128_XCBC/ECP_256
      athome{3}:  INSTALLED, TUNNEL, reqid 1, ESP in UDP SPIs: c09f2550_i cfc03b8d_o
      athome{3}:  AES_CBC_128/HMAC_SHA2_256_128, 0 bytes_i, 24164 bytes_o (243 pkts, 5s ago), rekeying in 28 minutes
      athome{3}:   172.31.0.150/32 === 172.31.0.0/24

root@P-T1650:/home/karsten# ip route list table 220
172.31.0.0/24 via 192.168.1.1 dev vmbr0 proto static src 172.31.0.150

This kind of problem appears once in a while. Restart of ipsec doesn't solve it.
The wazuh agent will send logs to the wazuh server via the VPN. Now it can't:

root@P-T1650:/home/karsten# tail -f /var/ossec/logs/ossec.log
2020/06/08 03:34:09 ossec-agentd: WARNING: (4101): Waiting for server reply (not started). Tried: '172.31.0.164'.
2020/06/08 03:34:20 ossec-agentd: INFO: Trying to connect to server (172.31.0.164:1514/udp).
2020/06/08 03:34:41 ossec-agentd: WARNING: (4101): Waiting for server reply (not started). Tried: '172.31.0.164'.
2020/06/08 03:34:52 ossec-agentd: INFO: Trying to connect to server (172.31.0.164:1514/udp).

When the ipsec service ist stopped it will look like this:

2020/06/08 03:34:58 ossec-agentd: ERROR: (1218): Unable to send message to 'server': Network is unreachable
2020/06/08 03:35:03 ossec-agentd: ERROR: (1218): Unable to send message to 'server': Network is unreachable
2020/06/08 03:35:09 ossec-agentd: ERROR: (1218): Unable to send message to 'server': Network is unreachable
2020/06/08 03:35:16 ossec-agentd: ERROR: (1218): Unable to send message to 'server': Network is unreachable

Starting ipsec with charondebug="ike 2, knl 2, cfg 2":

Jun  8 03:44:06 P-T1650 systemd[1]: Stopped strongSwan IPsec IKEv1/IKEv2 daemon using ipsec.conf.
Jun  8 03:44:19 P-T1650 systemd[1]: Started strongSwan IPsec IKEv1/IKEv2 daemon using ipsec.conf.
Jun  8 03:44:19 P-T1650 ipsec[9539]: Starting strongSwan 5.7.2 IPsec [starter]...
Jun  8 03:44:19 P-T1650 charon: 00[DMN] Starting IKE charon daemon (strongSwan 5.7.2, Linux 5.4.41-1-pve, x86_64)
Jun  8 03:44:20 P-T1650 charon: 00[CFG] PKCS11 module '<name>' lacks library path
Jun  8 03:44:20 P-T1650 charon: 00[KNL] known interfaces and IP addresses:
Jun  8 03:44:20 P-T1650 charon: 00[KNL]   lo
Jun  8 03:44:20 P-T1650 charon: 00[KNL]     127.0.0.1
Jun  8 03:44:20 P-T1650 charon: 00[KNL]     ::1
Jun  8 03:44:20 P-T1650 charon: 00[KNL]   eno1
Jun  8 03:44:20 P-T1650 charon: 00[KNL]   vmbr0
Jun  8 03:44:20 P-T1650 charon: 00[KNL]     192.168.1.147
Jun  8 03:44:20 P-T1650 charon: 00[KNL]     2a01:c22:3434:9900:92b1:1cff:fe9c:82a0
Jun  8 03:44:20 P-T1650 charon: 00[KNL]     fe80::92b1:1cff:fe9c:82a0
Jun  8 03:44:20 P-T1650 charon: 00[KNL]   vmbr1
Jun  8 03:44:20 P-T1650 charon: 00[KNL]     fe80::8c04:b8ff:feb5:c59f
Jun  8 03:44:20 P-T1650 charon: 00[KNL]   tap104i0
.
.
.
Jun  8 03:44:20 P-T1650 charon: 00[JOB] spawning 16 worker threads
Jun  8 03:44:20 P-T1650 ipsec[9539]: charon (9565) started after 20 ms
Jun  8 03:44:20 P-T1650 charon: 05[CFG] received stroke: add connection 'athome'
Jun  8 03:44:20 P-T1650 charon: 05[CFG] conn athome
Jun  8 03:44:20 P-T1650 charon: 05[CFG]   left=%any
Jun  8 03:44:20 P-T1650 charon: 05[CFG]   leftsourceip=172.31.0.150
Jun  8 03:44:20 P-T1650 charon: 05[CFG]   leftauth=eap-mschapv2
Jun  8 03:44:20 P-T1650 charon: 05[CFG]   right=35.238.244.88
Jun  8 03:44:20 P-T1650 charon: 05[CFG]   rightsubnet=172.31.0.0/24
Jun  8 03:44:20 P-T1650 charon: 05[CFG]   rightauth=pubkey
Jun  8 03:44:20 P-T1650 charon: 05[CFG]   rightid=%any
Jun  8 03:44:20 P-T1650 charon: 05[CFG]   eap_identity=proxmoxhome
Jun  8 03:44:20 P-T1650 charon: 05[CFG]   dpddelay=300
Jun  8 03:44:20 P-T1650 charon: 05[CFG]   dpdtimeout=150
Jun  8 03:44:20 P-T1650 charon: 05[CFG]   dpdaction=1
Jun  8 03:44:20 P-T1650 charon: 05[CFG]   sha256_96=no
Jun  8 03:44:20 P-T1650 charon: 05[CFG]   mediation=no
Jun  8 03:44:20 P-T1650 charon: 05[CFG]   keyexchange=ikev2
Jun  8 03:44:20 P-T1650 ipsec[9539]: 'athome' routed
Jun  8 03:44:20 P-T1650 charon: 05[KNL] 35.xxx is not a local address or the interface is down
Jun  8 03:44:20 P-T1650 charon: 05[CFG] added configuration 'athome'
Jun  8 03:44:20 P-T1650 charon: 08[CFG] received stroke: route 'athome'
Jun  8 03:44:20 P-T1650 charon: 08[KNL] using 192.168.1.147 as address to reach 35.238.244.88/32
Jun  8 03:44:20 P-T1650 charon: 08[CFG] configured proposals: ESP:AES_CBC_128/AES_CBC_192/AES_CBC_256/HMAC_SHA2_256_128/HMAC_SHA2_384_192/HMAC_SHA2_512_256/HMAC_SHA1_96/AES_XCBC_96/NO_EXT_SEQ
Jun  8 03:44:20 P-T1650 charon: 08[KNL] adding policy 172.31.0.0/24 === 192.168.1.147/32 in [priority 371328, refcount 1]
Jun  8 03:44:20 P-T1650 charon: 08[KNL] adding policy 172.31.0.0/24 === 192.168.1.147/32 fwd [priority 371328, refcount 1]
Jun  8 03:44:20 P-T1650 charon: 08[KNL] adding policy 192.168.1.147/32 === 172.31.0.0/24 out [priority 371328, refcount 1]
Jun  8 03:44:20 P-T1650 charon: 08[KNL] getting a local address in traffic selector 192.168.1.147/32
Jun  8 03:44:20 P-T1650 charon: 08[KNL] using host 192.168.1.147
Jun  8 03:44:20 P-T1650 charon: 08[KNL] getting iface name for index 3
Jun  8 03:44:20 P-T1650 charon: 08[KNL] using 192.168.1.1 as nexthop and vmbr0 as dev to reach 35.238.244.88/32
Jun  8 03:44:20 P-T1650 charon: 08[KNL] installing route: 172.31.0.0/24 via 192.168.1.1 src 192.168.1.147 dev vmbr0
Jun  8 03:44:20 P-T1650 charon: 08[KNL] getting iface index for vmbr0
Jun  8 03:44:30 P-T1650 charon: 10[KNL] received a XFRM_MSG_ACQUIRE
Jun  8 03:44:30 P-T1650 charon: 10[KNL]   XFRMA_TMPL
Jun  8 03:44:30 P-T1650 charon: 10[KNL] creating acquire job for policy 192.168.1.147/32[udp/34832] === 172.31.0.1/32[udp/1025] with reqid {1}
Jun  8 03:44:30 P-T1650 ipsec[9539]: 00[DMN] Starting IKE charon daemon (strongSwan 5.7.2, Linux 5.4.41-1-pve, x86_64)
Jun  8 03:44:30 P-T1650 ipsec[9539]: 00[CFG] PKCS11 module '<name>' lacks library path
Jun  8 03:44:30 P-T1650 ipsec[9539]: 00[KNL] known interfaces and IP addresses:
Jun  8 03:44:30 P-T1650 ipsec[9539]: 00[KNL]   lo
Jun  8 03:44:30 P-T1650 ipsec[9539]: 00[KNL]     127.0.0.1
Jun  8 03:44:30 P-T1650 ipsec[9539]: 00[KNL]     ::1
Jun  8 03:44:30 P-T1650 ipsec[9539]: 00[KNL]   eno1
Jun  8 03:44:30 P-T1650 ipsec[9539]: 00[KNL]   vmbr0
Jun  8 03:44:30 P-T1650 ipsec[9539]: 00[KNL]     192.168.1.147
Jun  8 03:44:30 P-T1650 ipsec[9539]: 00[KNL]     2a01:c22:3434:9900:92b1:1cff:fe9c:82a0
Jun  8 03:44:30 P-T1650 ipsec[9539]: 00[KNL]     fe80::92b1:1cff:fe9c:82a0
Jun  8 03:44:30 P-T1650 ipsec[9539]: 00[KNL]   vmbr1
Jun  8 03:44:30 P-T1650 ipsec[9539]: 00[KNL]     fe80::8c04:b8ff:feb5:c59f
Jun  8 03:44:30 P-T1650 ipsec[9539]: 00[KNL]   tap104i0
.
.
.
Jun  8 03:44:30 P-T1650 charon: 11[IKE] IKE_SA athome[1] state change: CREATED => CONNECTING
.
.
.
Jun  8 03:44:30 P-T1650 charon: 11[CFG] sending supported signature hash algorithms: sha256 sha384 sha512 identity
Jun  8 03:44:30 P-T1650 charon: 11[ENC] generating IKE_SA_INIT request 0 [ SA KE No N(NATD_S_IP) N(NATD_D_IP) N(FRAG_SUP) N(HASH_ALG) N(REDIR_SUP) ]
Jun  8 03:44:30 P-T1650 charon: 11[NET] sending packet: from 192.168.1.147[500] to 35.xxx[500] (1080 bytes)
Jun  8 03:44:30 P-T1650 charon: 12[NET] received packet: from 35.xxx[500] to 192.168.1.147[500] (272 bytes)
Jun  8 03:44:30 P-T1650 charon: 12[ENC] parsed IKE_SA_INIT response 0 [ SA KE No N(NATD_S_IP) N(NATD_D_IP) N(FRAG_SUP) N(HASH_ALG) N(MULT_AUTH) ]
Jun  8 03:44:30 P-T1650 charon: 12[IKE] received FRAGMENTATION_SUPPORTED notify
Jun  8 03:44:30 P-T1650 charon: 12[IKE] received SIGNATURE_HASH_ALGORITHMS notify
Jun  8 03:44:30 P-T1650 ipsec[9539]: 11[KNL] using 192.168.1.147 as address to reach 35.238.244.88/32
.
.
.
Jun  8 03:44:30 P-T1650 charon: 12[CFG] selected proposal: IKE:AES_CBC_128/HMAC_SHA2_256_128/PRF_AES128_XCBC/ECP_256
Jun  8 03:44:30 P-T1650 charon: 12[CFG] received supported signature hash algorithms: sha256 sha384 sha512 identity
Jun  8 03:44:30 P-T1650 charon: 12[IKE] local host is behind NAT, sending keep alives
Jun  8 03:44:30 P-T1650 charon: 12[IKE] remote host is behind NAT
Jun  8 03:44:30 P-T1650 charon: 12[IKE] reinitiating already active tasks
Jun  8 03:44:30 P-T1650 charon: 12[IKE]   IKE_CERT_PRE task
Jun  8 03:44:30 P-T1650 charon: 12[IKE]   IKE_AUTH task
Jun  8 03:44:30 P-T1650 charon: 12[IKE] sending cert request for "O=Digital Signature Trust Co., CN=DST Root CA X3"
Jun  8 03:44:30 P-T1650 charon: 12[CFG] no IDi configured, fall back on IP address
Jun  8 03:44:30 P-T1650 charon: 12[IKE] building INTERNAL_IP4_DNS attribute
Jun  8 03:44:30 P-T1650 charon: 12[CFG] proposing traffic selectors for us:
Jun  8 03:44:30 P-T1650 charon: 12[CFG]  0.0.0.0/0
Jun  8 03:44:30 P-T1650 charon: 12[CFG] proposing traffic selectors for other:
Jun  8 03:44:30 P-T1650 charon: 12[CFG]  172.31.0.0/24
Jun  8 03:44:30 P-T1650 charon: 12[CFG] configured proposals: ESP:AES_CBC_128/AES_CBC_192/AES_CBC_256/HMAC_SHA2_256_128/HMAC_SHA2_384_192/HMAC_SHA2_512_256/HMAC_SHA1_96/AES_XCBC_96/NO_EXT_SEQ
Jun  8 03:44:30 P-T1650 charon: 12[IKE] establishing CHILD_SA athome{2} reqid 1
Jun  8 03:44:30 P-T1650 charon: 12[KNL] got SPI c2cc1356
Jun  8 03:44:30 P-T1650 charon: 12[ENC] generating IKE_AUTH request 1 [ IDi CERTREQ CPRQ(ADDR DNS) SA TSi TSr N(MOBIKE_SUP) N(ADD_6_ADDR) N(MULT_AUTH) N(EAP_ONLY) N(MSG_ID_SYN_SUP) ]
Jun  8 03:44:30 P-T1650 charon: 12[NET] sending packet: from 192.168.1.147[4500] to 35.xxx[4500] (368 bytes)
Jun  8 03:44:30 P-T1650 charon: 13[NET] received packet: from 35.xxx[4500] to 192.168.1.147[4500] (1236 bytes)
Jun  8 03:44:30 P-T1650 charon: 13[ENC] parsed IKE_AUTH response 1 [ EF(1/3) ]
Jun  8 03:44:30 P-T1650 charon: 13[ENC] received fragment #1 of 3, waiting for complete IKE message
Jun  8 03:44:30 P-T1650 charon: 15[NET] received packet: from 35.xxx[4500] to 192.168.1.147[4500] (1236 bytes)
Jun  8 03:44:30 P-T1650 charon: 15[ENC] parsed IKE_AUTH response 1 [ EF(2/3) ]
Jun  8 03:44:30 P-T1650 charon: 15[ENC] received fragment #2 of 3, waiting for complete IKE message
Jun  8 03:44:30 P-T1650 charon: 14[NET] received packet: from 35.xxx[4500] to 192.168.1.147[4500] (644 bytes)
Jun  8 03:44:30 P-T1650 charon: 14[ENC] parsed IKE_AUTH response 1 [ EF(3/3) ]
Jun  8 03:44:30 P-T1650 charon: 14[ENC] received fragment #3 of 3, reassembled fragmented IKE message (2976 bytes)
Jun  8 03:44:30 P-T1650 charon: 14[ENC] parsed IKE_AUTH response 1 [ IDr CERT CERT AUTH EAP/REQ/ID ]
Jun  8 03:44:30 P-T1650 charon: 14[IKE] received end entity cert "CN=ipsec.xxx"
Jun  8 03:44:30 P-T1650 charon: 14[IKE] received issuer cert "C=US, O=Let's Encrypt, CN=Let's Encrypt Authority X3"
.
.
.
Jun  8 03:44:31 P-T1650 ipsec[9539]: 07[CFG] selecting traffic selectors for us:
Jun  8 03:44:31 P-T1650 ipsec[9539]: 07[CFG]  config: 172.31.0.150/32, received: 172.31.0.150/32 => match: 172.31.0.150/32
Jun  8 03:44:31 P-T1650 ipsec[9539]: 07[CFG] selecting traffic selectors for other:
Jun  8 03:44:31 P-T1650 ipsec[9539]: 07[CFG]  config: 172.31.0.0/24, received: 172.31.0.0/24 => match: 172.31.0.0/24
Jun  8 03:44:31 P-T1650 ipsec[9539]: 07[KNL] adding SAD entry with SPI c2cc1356 and reqid {1}
Jun  8 03:44:31 P-T1650 ipsec[9539]: 07[KNL]   using encryption algorithm AES_CBC with key size 128
Jun  8 03:44:31 P-T1650 ipsec[9539]: 07[KNL]   using integrity algorithm HMAC_SHA2_256_128 with key size 256
Jun  8 03:44:31 P-T1650 ipsec[9539]: 07[KNL]   using replay window of 32 packets
Jun  8 03:44:31 P-T1650 ipsec[9539]: 07[KNL]   HW offload: no
Jun  8 03:44:31 P-T1650 ipsec[9539]: 07[KNL] adding SAD entry with SPI cc78d74c and reqid {1}
Jun  8 03:44:31 P-T1650 ipsec[9539]: 07[KNL]   using encryption algorithm AES_CBC with key size 128
Jun  8 03:44:31 P-T1650 ipsec[9539]: 07[KNL]   using integrity algorithm HMAC_SHA2_256_128 with key size 256
Jun  8 03:44:31 P-T1650 ipsec[9539]: 07[KNL]   using replay window of 0 packets
Jun  8 03:44:31 P-T1650 ipsec[9539]: 07[KNL]   HW offload: no
Jun  8 03:44:31 P-T1650 ipsec[9539]: 07[KNL] adding policy 172.31.0.0/24 === 172.31.0.150/32 in [priority 371327, refcount 1]
Jun  8 03:44:31 P-T1650 ipsec[9539]: 07[KNL] adding policy 172.31.0.0/24 === 172.31.0.150/32 fwd [priority 371327, refcount 1]
Jun  8 03:44:31 P-T1650 ipsec[9539]: 07[KNL] adding policy 172.31.0.150/32 === 172.31.0.0/24 out [priority 371327, refcount 1]
Jun  8 03:44:31 P-T1650 ipsec[9539]: 07[KNL] getting a local address in traffic selector 172.31.0.150/32
Jun  8 03:44:31 P-T1650 ipsec[9539]: 07[KNL] using host 172.31.0.150
Jun  8 03:44:31 P-T1650 ipsec[9539]: 07[KNL] getting iface name for index 3
Jun  8 03:44:31 P-T1650 ipsec[9539]: 07[KNL] using 192.168.1.1 as nexthop and vmbr0 as dev to reach 35.238.244.88/32
Jun  8 03:44:31 P-T1650 ipsec[9539]: 07[KNL] installing route: 172.31.0.0/24 via 192.168.1.1 src 172.31.0.150 dev vmbr0
Jun  8 03:44:31 P-T1650 ipsec[9539]: 07[KNL] getting iface index for vmbr0
Jun  8 03:44:31 P-T1650 charon: 07[KNL] virtual IP 172.31.0.150 installed on vmbr0
Jun  8 03:44:31 P-T1650 ipsec[9539]: 07[IKE] CHILD_SA athome{2} established with SPIs c2cc1356_i cc78d74c_o and TS 172.31.0.150/32 === 172.31.0.0/24
Jun  8 03:44:31 P-T1650 ipsec[9539]: 07[IKE] received AUTH_LIFETIME of 9863s, scheduling reauthentication in 9323s
.
.
.
Jun  8 03:44:31 P-T1650 charon: 07[CFG] selecting traffic selectors for us:
Jun  8 03:44:31 P-T1650 charon: 07[CFG]  config: 172.31.0.150/32, received: 172.31.0.150/32 => match: 172.31.0.150/32
Jun  8 03:44:31 P-T1650 charon: 07[CFG] selecting traffic selectors for other:
Jun  8 03:44:31 P-T1650 charon: 07[CFG]  config: 172.31.0.0/24, received: 172.31.0.0/24 => match: 172.31.0.0/24
Jun  8 03:44:31 P-T1650 charon: 07[KNL] adding SAD entry with SPI c2cc1356 and reqid {1}
Jun  8 03:44:31 P-T1650 charon: 07[KNL]   using encryption algorithm AES_CBC with key size 128
Jun  8 03:44:31 P-T1650 charon: 07[KNL]   using integrity algorithm HMAC_SHA2_256_128 with key size 256
Jun  8 03:44:31 P-T1650 charon: 07[KNL]   using replay window of 32 packets
Jun  8 03:44:31 P-T1650 charon: 07[KNL]   HW offload: no
Jun  8 03:44:31 P-T1650 charon: 07[KNL] adding SAD entry with SPI cc78d74c and reqid {1}
Jun  8 03:44:31 P-T1650 charon: 07[KNL]   using encryption algorithm AES_CBC with key size 128
Jun  8 03:44:31 P-T1650 charon: 07[KNL]   using integrity algorithm HMAC_SHA2_256_128 with key size 256
Jun  8 03:44:31 P-T1650 charon: 07[KNL]   using replay window of 0 packets
Jun  8 03:44:31 P-T1650 charon: 07[KNL]   HW offload: no
Jun  8 03:44:31 P-T1650 charon: 07[KNL] adding policy 172.31.0.0/24 === 172.31.0.150/32 in [priority 371327, refcount 1]
Jun  8 03:44:31 P-T1650 charon: 07[KNL] adding policy 172.31.0.0/24 === 172.31.0.150/32 fwd [priority 371327, refcount 1]
Jun  8 03:44:31 P-T1650 charon: 07[KNL] adding policy 172.31.0.150/32 === 172.31.0.0/24 out [priority 371327, refcount 1]
Jun  8 03:44:31 P-T1650 charon: 07[KNL] getting a local address in traffic selector 172.31.0.150/32
Jun  8 03:44:31 P-T1650 charon: 07[KNL] using host 172.31.0.150
Jun  8 03:44:31 P-T1650 charon: 07[KNL] getting iface name for index 3
Jun  8 03:44:31 P-T1650 charon: 07[KNL] using 192.168.1.1 as nexthop and vmbr0 as dev to reach 35.238.244.88/32
Jun  8 03:44:31 P-T1650 charon: 07[KNL] installing route: 172.31.0.0/24 via 192.168.1.1 src 172.31.0.150 dev vmbr0
Jun  8 03:44:31 P-T1650 charon: 07[KNL] getting iface index for vmbr0
Jun  8 03:44:31 P-T1650 charon: 07[IKE] CHILD_SA athome{2} established with SPIs c2cc1356_i cc78d74c_o and TS 172.31.0.150/32 === 172.31.0.0/24
Jun  8 03:44:31 P-T1650 charon: 07[IKE] received AUTH_LIFETIME of 9863s, scheduling reauthentication in 9323s
Jun  8 03:44:31 P-T1650 charon: 07[IKE] peer supports MOBIKE
Jun  8 03:44:31 P-T1650 charon: 07[IKE] activating new tasks
Jun  8 03:44:31 P-T1650 charon: 07[IKE] nothing to initiate
Jun  8 03:44:31 P-T1650 charon: 11[KNL] getting iface index for vmbr0
Jun  8 03:44:31 P-T1650 charon: 11[KNL] getting iface index for vmbr0

After reboot of the responder server the initiator that couldn't connect before but worked today is again unable to connect.
root@Openxpki:/home/karsten# ipsec statusall
Status of IKE charon daemon (strongSwan 5.7.2, Linux 4.19.0-9-amd64, x86_64):
  uptime: 3 minutes, since Jun 08 08:47:13 2020
  malloc: sbrk 2940928, mmap 0, used 962544, free 1978384
  worker threads: 11 of 16 idle, 5/0/0/0 working, job queue: 0/0/0/0, scheduled: 2
  loaded plugins: charon test-vectors ldap pkcs11 tpm aesni aes rc2 sha2 sha1 md5 mgf1 rdrand random nonce x509 revocation constraints pubkey pkcs1 pkcs7 pkcs8 pkcs12 pgp dnskey sshkey pem openssl gcrypt af-alg fips-prf gmp curve25519 agent chapoly xcbc cmac hmac ctr ccm gcm curl attr kernel-netlink resolve socket-default connmark farp stroke updown eap-identity eap-aka eap-md5 eap-gtc eap-mschapv2 eap-radius eap-tls eap-ttls eap-tnc xauth-generic xauth-eap xauth-pam tnc-tnccs dhcp lookip error-notify certexpire led addrblock unity counters
Listening IP addresses:
  192.168.1.251
  2a01:c22:3434:9900:a00:27ff:feeb:7283
Connections:
    openxpki:  %any...35.238.244.88  IKEv2, dpddelay=300s
    openxpki:   local:  uses EAP_MSCHAPV2 authentication with EAP identity 'openxpkihome'
    openxpki:   remote: uses public key authentication
    openxpki:   child:  dynamic === 172.31.0.0/24 TUNNEL, dpdaction=clear
Routed Connections:
    openxpki{1}:  ROUTED, TUNNEL, reqid 1
    openxpki{1}:   192.168.1.251/32 === 172.31.0.0/24
Security Associations (0 up, 1 connecting):
    openxpki[1]: CONNECTING, 192.168.1.251[192.168.1.251]...35.238.244.88[%any]
    openxpki[1]: IKEv2 SPIs: 82eef527dc777857_i* 0c6594db8ab2676e_r
    openxpki[1]: IKE proposal: AES_CBC_128/HMAC_SHA2_256_128/PRF_AES128_XCBC/ECP_256
    openxpki[1]: Tasks active: IKE_CERT_PRE IKE_AUTH IKE_CERT_POST IKE_CONFIG CHILD_CREATE IKE_AUTH_LIFETIME IKE_MOBIKE

Syslog:
Jun  8 08:55:31 Openxpki ipsec[15972]: 07[CFG] received supported signature hash algorithms: sha256 sha384 sha512 identity
Jun  8 08:55:31 Openxpki ipsec[15972]: 07[IKE] reinitiating already active tasks
Jun  8 08:55:31 Openxpki ipsec[15972]: 07[IKE]   IKE_CERT_PRE task
Jun  8 08:55:31 Openxpki ipsec[15972]: 07[IKE]   IKE_AUTH task
Jun  8 08:55:31 Openxpki ipsec[15972]: 07[IKE] sending cert request for "O=Digital Signature Trust Co., CN=DST Root CA X3"
Jun  8 08:55:31 Openxpki ipsec[15972]: 07[CFG] no IDi configured, fall back on IP address
Jun  8 08:55:31 Openxpki ipsec[15972]: 07[IKE] building INTERNAL_IP4_DNS attribute
Jun  8 08:55:31 Openxpki ipsec[15972]: 07[CFG] proposing traffic selectors for us:
Jun  8 08:55:31 Openxpki ipsec[15972]: 07[CFG]  0.0.0.0/0
Jun  8 08:55:31 Openxpki ipsec[15972]: 07[CFG] proposing traffic selectors for other:
Jun  8 08:55:31 Openxpki ipsec[15972]: 07[CFG]  172.31.0.0/24
Jun  8 08:55:31 Openxpki ipsec[15972]: 07[CFG] configured proposals: ESP:AES_CBC_128/AES_CBC_192/AES_CBC_256/HMAC_SHA2_256_128/HMAC_SHA2_384_192/HMAC_SHA2_512_256/HMAC_SHA1_96/AES_XCBC_96/NO_EXT_SEQ
Jun  8 08:55:31 Openxpki ipsec[15972]: 07[IKE] establishing CHILD_SA openxpki{3}
Jun  8 08:55:31 Openxpki ipsec[15972]: 07[KNL] got SPI ce2cfd23
Jun  8 08:55:31 Openxpki ipsec[15972]: 07[ENC] generating IKE_AUTH request 1 [ IDi CERTREQ CPRQ(ADDR DNS) SA TSi TSr N(MOBIKE_SUP) N(ADD_6_ADDR) N(MULT_AUTH) N(EAP_ONLY) N(MSG_ID_SYN_SUP) ]
Jun  8 08:55:31 Openxpki ipsec[15972]: 07[NET] sending packet: from 192.168.1.251[4500] to 35.238.244.88[4500] (368 bytes)
Jun  8 08:55:31 Openxpki ipsec[15972]: 10[IKE] retransmit 1 of request with message ID 1
Jun  8 08:55:31 Openxpki ipsec[15972]: 10[NET] sending packet: from 192.168.1.251[4500] to 35.238.244.88[4500] (368 bytes)
Jun  8 08:55:31 Openxpki ipsec[15972]: 11[IKE] retransmit 2 of request with message ID 1
Jun  8 08:55:31 Openxpki ipsec[15972]: 11[NET] sending packet: from 192.168.1.251[4500] to 35.238.244.88[4500] (368 bytes)
Jun  8 08:55:31 Openxpki ipsec[15972]: 13[IKE] retransmit 3 of request with message ID 1
Jun  8 08:55:31 Openxpki ipsec[15972]: 13[NET] sending packet: from 192.168.1.251[4500] to 35.238.244.88[4500] (368 bytes)
Jun  8 08:55:31 Openxpki ipsec[15972]: 14[IKE] retransmit 4 of request with message ID 1
Jun  8 08:55:31 Openxpki ipsec[15972]: 14[NET] sending packet: from 192.168.1.251[4500] to 35.238.244.88[4500] (368 bytes)
Jun  8 08:55:31 Openxpki ipsec[15972]: 16[IKE] retransmit 5 of request with message ID 1
Jun  8 08:55:31 Openxpki ipsec[15972]: 16[NET] sending packet: from 192.168.1.251[4500] to 35.238.244.88[4500] (368 bytes)
Jun  8 08:55:31 Openxpki ipsec[15972]: 07[KNL] received a XFRM_MSG_ACQUIRE
Jun  8 08:55:31 Openxpki ipsec[15972]: 07[KNL]   XFRMA_TMPL
Jun  8 08:55:31 Openxpki ipsec[15972]: 07[KNL]   XFRMA_POLICY_TYPE
Jun  8 08:55:31 Openxpki ipsec[15972]: 07[KNL] creating acquire job for policy 192.168.1.251/32[udp/47894] === 172.31.0.1/32[udp/1025] with reqid {1}
Jun  8 08:55:31 Openxpki ipsec[15972]: 07[IKE] queueing CHILD_CREATE task
Jun  8 08:55:31 Openxpki ipsec[15972]: 07[IKE] delaying task initiation, IKE_AUTH exchange in progress
Jun  8 08:55:31 Openxpki ipsec[15972]: 11[KNL] received a XFRM_MSG_EXPIRE
Jun  8 08:55:31 Openxpki ipsec[15972]: 11[KNL] creating delete job for CHILD_SA ESP/0xce2cfd23/192.168.1.251
Jun  8 08:55:31 Openxpki charon: 13[IKE] peer not responding, trying again (3/3)
Jun  8 08:55:31 Openxpki ipsec[15972]: 11[JOB] CHILD_SA ESP/0xce2cfd23/192.168.1.251 not found for delete


text:
Q: Hiding a column in XSLT by comparing column header I am new to XSLT.  I have a table in which the number of columns are to be determined by the user dynamically as per need.  The last column in my table allows the user to add a new row and other row transformations.  While I display, I want all my columns of the table except this row transformation column at the end of the table.  Is there any way that I could always hide the last column from display on page?
Since the number of columns is dynamic, I set up a variable called count and got the number of columns. Then, I fetched entire data using

My XML Code:

Link(Required)
Categorty(Required)
Department
Class timings
Row Options

Graduate Studies
Student Info
Graduates
Afternoon
<form class="add_row" onsubmit="return addRow(this);"><input type="submit" value="Add Row Below" /></form>
<form class="delete_row" onsubmit="return deleteRow(this);"><input type="submit" value="Delete Row" /></form>
<form class="move_row" onsubmit="return moveRow(this, 'up');"><input type="submit" value="Move Up" /></form>
<form class="move_row" onsubmit="return moveRow(this, 'down');"><input type="submit" value="Move Down" /></form>

XSLT Code:
<xsl:template match="table[contains(@class, 'tf-data-tables_var_cols')]">
        <xsl:variable name="count" select="count(./thead/tr/th)"/>

            <xsl:apply-templates select="*" />

    </xsl:template>

I get the full table along with the last column as output.  How do I hide/delete the last column?
Output I got
I want to remove the row options

A: To remove the last column and its header and keep everything else as is, you can do:
XSLT 1.0
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes"/>
<xsl:strip-space elements="*"/>

<xsl:template match="@*|node()">
    <xsl:copy>
        <xsl:apply-templates select="@*|node()"/>
    </xsl:copy>
</xsl:template>

<xsl:template match="th[last()] | td[last()]"/>

</xsl:stylesheet>


text:
Q: What's an isomorphism between $Z_{p^2}^*$ and $Z_p\times Z_{p-1}$ Is it true that $Z_{p^2}^* \simeq Z_p\times Z_{p-1}$? One can verify that $|Z_{p^2}^*|=p(p-1)$. Can you give an isomorphism?

A: Any two cyclic groups of the same order are isomorphic. $\mathbb{Z_p}\times\mathbb{Z_{p-1}}$ is cyclic by the Chinese remainder theorem while $\mathbb{Z_{p^2}^*}$ is cyclic because there is a primitive root mod a power of a prime number. (this is a theorem in number theory)

A: Here is a sketch for an odd prime:

*

*$1+p$ has order $p\bmod p^2$.

*$\mathbf Z_p^\times $ is cyclic, of order $p-1$, hence, if $a \bmod p$ is one of its generators, $a\bmod p^2$ has order a multiple of $p-1$. So a power $b$ of $a$ has order exactly $p-1\bmod p^2$.

*Thus , as $p$ and $p-1$ are coprime, $(1+p)b$ has order $p(p-1)$.

Now, let $u$ be a unit $\bmod p^2$. It can be written as $u=(1+p)^r b^s$ $\;(0\le r<p,\: 0\le s <p-1)$.
This  enables us to define an isomorphism as follows:
\begin{align}
\mathbf Z_{p^2}^\times & \longrightarrow \mathbf Z_p\times\mathbf Z_{p-1} \\
u=(1+p)^r b^s&\longmapsto(r\bmod p, s\bmod p-1)
\end{align}

A: The operation of $\mathbb{Z}^*_{p^2}$ is multiplication and the operation of $\mathbb{Z}/p\mathbb{Z} \times \mathbb{Z}/(p-1)\mathbb{Z} $ of component addition. It remains to find a map $\phi: \mathbb{Z}^*_{p^2} \rightarrow \mathbb{Z}/p\mathbb{Z} \times \mathbb{Z}/(p-1)\mathbb{Z}$ that satisfies $\phi(ab) = \phi(a) + \phi (b)$ or show that no map exists.
Case example: $ p = 2 $
Let us first take $a=1$. Then, $\phi(b) = \phi(1)+ \phi(b) \implies \phi(1) = 0$ (here, $0$ is $(0,0)$). Thus, $\phi(3) = (1,0)$. This is easily verified to be a homomorphism under the group operations. But the inverse map is not a homomorphism: $\phi^{-1}((1,0)+(0,0)) = 3 \neq \phi^{-1}(0,0) + \phi^{-1}(1,0)$.
Your claim is not true for the even primes. For the odd primes, we may discuss the work of user Bernard.

A: The canonical surjective ring homomorphism $\mathbf Z/p^2 \to \mathbf Z/p$ defined by $a$ mod $p^2 \to a$ mod $p$ obviously induces a group homomorphism $ f :(\mathbf Z/p^2)^* \to (\mathbf Z/p)^*$ which is surjective because any integer $a$ representing a class of $\mathbf Z/p$ and prime to $p$ will represent a class of $(\mathbf Z/p^2)^*$. So Imf$f=(\mathbf Z/p)^*$ is cyclic of order $(p-1)$ (every finite multiplicative subgroup of a field is cyclic), hence is isomorphic to $(\mathbf Z/(p-1), +)$.
Let us determine Ker$f$. If an integer $a$ is $\equiv 1$ mod $p$, it can be written $\equiv 1+kp$ mod $p^2\mathbf Z$. Letting $k=0,1,...,p-1$, one gets $p$ distinct classes of $(\mathbf Z/p^2)^*$ which are all in Ker$f$. This shows at the same time that Ker$f$ is the image of the multiplicative group $1+p\mathbf Z$ in $\mathbf Z/p^2\mathbf Z$ and has order $p$, hence is isomorphic to $(\mathbf Z/p, +)$. Since $p$ and $(p-1)$ are coprime, the CRT actually gives a direct product decomposition $((\mathbf Z/p^2)^*,\times)\cong (\mathbf Z/p, +)\times (\mathbf Z/(p-1), +)$.
NB : This argument can be extended almost without change to show that, for any odd prime $p$ and any $r\ge 1$, $(\mathbf Z/p^r)^*$ is cyclic, $\cong (\mathbf Z/p^{r-1})\times (\mathbf Z/(p-1))$. The prime $2$ plays the usual trouble maker : for $r\ge 3, (\mathbf Z/2^r)^*$ is abelian of type $(2^{r-2}, 2)$. Note that these results are sharper than the usual Euler totient function which gives the order of $(\mathbf Z/p^r)^*$.


text:
Q: Eloquent where clause on belongsTo relationship Lets say I have already loaded the relationship and now I want to get models that fulfill it.
Is there a way to do it in an objective way, rather than using ids directly?
Here is an example Controller describing what I want to achieve:
public function videos(User $user, Category $category)
{
    $videos = Video::where('user', $user)->where('category', $category)->get();
    // ...
}

I know I can do it like this, but I would like to skip extracting the id and leave it to the framework if possible:
public function videos(User $user, Category $category)
{
    $videos = Video::where('user_id', $user->id)->where('category_id', $category->id)->get();
    // ...
}

A: So you would have a video that belongs to a user, correct? You could do something a little like this:
In your User model:
public function videos()
{
    return $this->hasMany(Video::class);
}

And then you can call this funciton like
$user->videos();

or
$this->user->videos->toArray();

If you start creating relationships like this in the model, it can make retrieving data so much easier. Might not be the full answer but is definitely on the right track. Good luck!
Eloquent relationships: https://laravel.com/docs/5.7/eloquent-relationships

A: Its not perfect, but I found a way to do it easily using scopes.
Here is my code:
trait WhereBelongsTo
{
    /**
     * @param \Illuminate\Database\Eloquent\Builder|self $query
     * @return \Illuminate\Database\Eloquent\Builder|self
     */
    public function scopeWhereBelongsTo($query, $relationship, $value)
    {
        /** @var \Illuminate\Database\Eloquent\Relations\BelongsTo $relationship */
        $relationship = call_user_func([$this, $relationship]);

        $foreignKey = $relationship->getForeignKey();
        $ownerKey = $relationship->getOwnerKey();

        if($value === null) {
            return $query->whereNull($foreignKey);
        } else {
            return $query->where($foreignKey, $value->$ownerKey);
        }
    }
}

After adding this trait to a Model, I can use it like this:
public function videos(User $user, Category $category)
{
    $videos = Video::whereBelongsTo('user', $user)->whereBelongsTo('category', $category)->get();
    // ...
}


text:
Q: Ways to earn experience-points Besides the obvious ways to earn experience like:

*

*killing mobs

*completing quest

which other ways exist get earn XP in SWTOR? I've only played about 30 minutes till now and wanted to know if i will get XP for:

*

*PVP matches (only match-wins? every kill?...)

*open world PVP-kills

*skilling professions

*is there something like the resting-bonus in wow and, if so, how exactly does it work

*something else

A: Space missions award a non-trivial amount of experience as well.  When you unlock each "tier" (first should be available when you get your ship, and consists of three missions.  Second opens at level 20), you'll get a set of quests from the ship computer, one for each mission in that tier.  These award 8-10k each, plus the experience for the mission itself.
Once you've completed the single missions, you'll get the repeatable "campaign" missions, which usually encompass the whole "tier" (exception for the first tier, which is broken in two, a single one for the escort, then a double one for the other two).  These are dailies that award 8-10k.
Completing the first "tier" of missions, as well as the campaigns for the first time, has consistently gained my characters just over a level.  That's doing them as soon as the ship becomes available, usually around level 15-16.
In the space missions themselves, there are optional objectives to complete, which also award experience.
There are hidden objectives as well.  For example, in the first-tier "Cartel Listening Post", there's a heavily-shielded attackable point on the bottom of the space station.  Destroying this (use missiles every chance you have, it takes quite a few, at least at level 1 upgrades) will gain you an additional 2.5k xp/credits.  This appears to be a daily as well.  Destroying it in subsequent runs gains you 500xp flat out, no bonus.
For the first tier, running that particular mission (without the associated quest) awards ~330 credits and ~1900xp each time, in addition to what's acquired in the mission itself.  You can easily reach ~4k per run.
These don't appear to take Rested into account, however.

A: *

*Quests/Flashpoints (and bonus stages)

*Bonus parts of quests

*Area quests

*Companion storylines

*Space combat

*PvP

*Exploration

*Finding datacrons

*Bonus rested experience (when you log off at a cantina, your ship, or at the fleet)

*Killing mobs

*Talking to each of the crew skill trainers the first time (usually when you get to the fleet)

A: Here's an expanded list, although I make no promises about its completeness:

*

*Completing bonus objectives in a quest.

*Helping a member in your group complete a bonus objective in their quest.

*Yes, that means that more than one person in the group is doing the same quest, you get the XP for your bonus objective plus the bonus XP for helping your friend for each member in the party that had the quest and bonus objective.

*Exploring new areas. Each time you fill in a new part of a world's map you get a spot of XP, plus another spot when you've discovered all areas on a given map.

*Reading 'lore objects'. They vary from blatantly obvious to incredibly easy to miss.

*Participating in PVP warzones. I'm not privy to the exact formula by which it calculates the reward, but you gain XP, "valor" and cash even if you're not on the winning team.
Things that don't give XP:

*

*crewskills and crafting. Their expertise level is entirely independent from your level progression.

As to your last point, SW:TOR does have a 'resting' bonus; rest areas are cantinas on planets, the main space station of your side's fleet and the interior of your ship (earned after completing your class story arc on your side's capital planet). Rested XP accrues while you're in a resting area whether you're logged on or not at a rate depending on your level. So far I haven't seen or heard of an upper bound on the amount of earnable resting XP.
Finally, after completing the first "chapter" of your class story arc (mid-thirties) on the first character you get that far, you get the not-optional option of choosing a 'legacy name' that can then get displayed as part of your character title and is shared among all alts on that server regardless of side, and all your alts on that server will start to accrue "legacy XP" that's again shared. It currently doesn't seem to do anything, but it's there for Bioware to attach stuff to later on I guess...


text:
Q: Microsoft Excel: Moving caret with keyboard in "Edit Formatting Rule" dialog When applying a conditional formatting rule in Excel, using the "Edit Formatting Rule" dialog, and using "Use a formula to determine which cells to format," you cannot move the caret (text insertion point) in the formula editor with the keyboard. If you try to use the arrow keys it inserts the cell name next to the cell in focus depending whether you hit the up/down/left/right key. Is there some way to turn this off? or some way to move the caret with the keyboard?

A: After you enter your formula, press F2 to enable edit mode allowing you to move the cursor with the arrow keys.


text:
Q: What is this scripting and how it is using .NET 4.5? Is it C# scripting? PowerShell Scripting? VBA Scripting? What is this scripting and how it is using .NET 4.5? Is it C# scripting? PowerShell Scripting? VBA Scripting?
I've found this answer in another question and was curious about it. As it's using .NET 4.5, I tried using the same methods in my .NET 4.7 solution and it wasn't available in Intellisense. Also I don't understand how you can call .NET 4.5 in that way from PowerShell and whey it would differ from the methods I get from my SDK?
The below code was submitted by @MDMarra
[Reflection.Assembly]::LoadWithPartialName("System.IO.Compression.FileSystem")
$Compression = [System.IO.Compression.CompressionLevel]::Optimal
$IncludeBaseDirectory = $false

$Source = "C:\Path\To\Source"
$Destination = "C:\CoolPowerShellZipFile.zip"

[System.IO.Compression.ZipFile]::CreateFromDirectory($Source,$Destination,$Compression,$IncludeBaseDirectory)

Does Windows have a built-in ZIP command for the command line?

A: powershell is [mostly] built on top of dotnet. it has many ways to access the underlying dotnet code, c# code, compiled DLL code, etc. the PoSh cmdlets are designed for easy use & readability. however, direct access to the guts of things is somewhat faster & may allow more control in some situations.
so, the process of doing so is made fairly easy. [grin]
as for file compression, yes, there is a cmdlet for that nowadays: Compress-Archive, which is a wrapper around the .NET class [System.IO.Compression.ZipArchive]. there was no such cmdlet early on, tho.

A: It seems to me as a powershell script that calls System.IO.Compression.FileSystem which is a C# class.


text:
Q: Factoring $x^5-1$ over $\mathbb{Z_5}$ How do I completely factor $x^5-1$ over $\mathbb{Z_5}$?
I saw one was a root so I divided by $x-1$ and got $(x-1)(x^4+x^3+x^2+x+1)$ which duh is the 5th cyclotomic polynomial and this is the same factorization over the integers. Do I just look for roots from here or is there a better way to go about this? I mean I know I could try to factor it as arbitrary quadratics also, but i'm wondering if there was a more fundamental insight that i'm missing that would make this simpler. Thanks!

A: Since $1$ is a root, we can divide out $x-1$ by the factor theorem: $x^5-1=(x-1)(x^4+x^3+x^2+x+1)$.
$1$ is a root of $x^4+x^3+x^2+x+1$, so we can divide it out again: $x^4+x^3+x^2+x+1=(x-1)(x^3+2x^2+3x+4)$
$x^3+2x^2+3x+4=(x-1)(x^2+3x+1)$.
Lastly,
$x^2+3x+1=(x-1)(x-1)$. So we can write $x^5-1$ as the product $(x-1)^5$ in $\mathbb{Z}[x]$.


text:
Q: CPLEX float precision Question: How small can a float be before CPLEX sees it as 0?
I am asking this question because my ILP usually deals with small numbers however now it has encountered numbers of 10^-18 to 10^-35. And the results indicated that there was something wrong. Java didn't read or write them wrong and the next step is the CPLEX solving of the ILP so I am wondering how small the float can be.
More information: Without going into too much detail, my system uses a form of percentile relaxation to allow artificial variables to take over the work of the objective function variables, however it seems now that these artificial variables with no influence over the objective function are not picked over the objective function variables which do have a weight.


text:
Q: Extend Struct definition golang I want to extend a struct definition from that of the other
type A struct {
    name string
}

type B struct {
    A
}

So here A is a sub struct of B. But I do not want that. Instead I want the B's definition to be the same as A without any nesting
    var a A
    var b B
    fmt.Printf("%v, %v \t", a, b)

    a.name = "john"
    b.name = "rick"

    fmt.Printf("%v, %v \t", a, b)

So output of this is {john} {{rick}}. I want it to be {john}{rick}

A: You can do:
type B A

However, if you do this, any methods you defined for A will not be available for B.


text:
Q: Launching Android Weather App Via Intent I want to launch the stock weather app from my android app via an
intent, but I keep getting a force close runtime error, and LogCat
gives me nothing.  The code I am trying to use to achieve this is:
public void startWeatherActivity() {
   Intent intent = new Intent("android.intent.action.MAIN");
   intent.setComponent(ComponentName.unflattenFromString("org.anddev.android.weatherforecast/
        org.anddev.android.weatherforecast.WeatherForecast"));
   intent.addCategory("android.intent.category.LAUNCHER");
   startActivity(intent);
}

A: Try to get your intent from getLaunchIntentFromPackage:
android doc
just as a comment, you should use Intent.ACTION_MAIN instead of the explicit string constant.


text:
Q: Center align of a text in a table in gitlab I am writing readme for a repository in gitlab, Although I do everything the same as tutorial I have couldnt center align some text in a table
here is the code Im using
### Qualitative Result

|    Fake     |   Real  |
|:---:|:---:|
| ||

however Fake and Real will not be center aligned.

A: The headers are always left-aligned in Chrome and Firefox, and centered in Safari. See https://docs.gitlab.com/ee/user/markdown.html#tables, in the blue box.


text:
Q: VBA Message Box when Row is added/deleted but only once I'm trying to make a message box that tells you to open some other files before adding/deleting rows to make sure references aren't lost. The below works but it works every time a row is added, is it possible to show only once when the first row is added/deleted? Any help is much appreciated.
Private Sub Worksheet_Change(ByVal Target As Range)
    If Target.Address = Target.EntireRow.Address Then
    MsgBox "If File 1 and File 2 are not open, please close this workbook without saving and open all files first."
    End If
End Sub

A: What you can do is declare a Boolen type public variable. See below codes. Message will be displayed once after open the file. If file is closed and re-open then once again will show message for one time.
Public StopPopMsg As Boolean

Private Sub Worksheet_Change(ByVal Target As Range)
    If Not StopPopMsg Then
        If Target.Address = Target.EntireRow.Address Then
            MsgBox "If File 1 and File 2 are not open, please close this workbook without saving and open all files first."
            StopPopMsg = True
        End If
    End If
End Sub


text:
Q: Can I delete "WINRE_DRV" OEM Partition if I only want to install Ubuntu and Not dual Boot? I want to replace Windows 10 and Install Ubuntu on Lenovo Ideapad 330. I want to make use of the Complete hard drive and want to delete "WINRE_DRV" partition .
Can I do that without worrying about anything?

A: don't pre-partion.
the installer is perfectly capable of doing this and it's made really really easy too.
way easyer than whatever you were about to do
Just run the ubuntu install process and when you reach this step select this :

this will give you the exact result you are looking for.


text:
Q: similarity between these two number series I have two number series:
$$4,5,6,7,8,9,10,11\dots$$
and
$$30,60,105,168,252,360,495,660\dots$$
please could you help me to understand how these two series are related.
i.e. how can I obtain one if the other is given.

A: It we let the first sequence be denoted by $a_n$ and second sequence be denoted by $b_n$ then it looks like that $b_n = \frac{a_n^3-a_n}{2}$ but without further information i am not sure.

A: $$b_i = \frac{(a_i-1)a_i(a_i+1)}{2}$$ Oops, Ahmad had the answer before me.

A: If we denote the two series $a$ = first series and $b$ = second series, where terms are $a_n$ and $b_n$.
Let's check some ratios: $\frac{b_1}{a_1} = 7.5, \frac{b_2}{a_2} = 12, \frac{b_3}{a_3} = 17.5, \frac{b_4}{a_4} = 24, \frac{b_5}{a_5} = 31.5$
So let's say the series of differences between consecutive ratios are $d$, so: $d_1 = 4.5, d_2 = 5.5, d_3 = 6.5, d_4 = 7.5$. The pattern is that the differences increment by $1$ each time.
So if we want to get $a$ from $b$ and vice versa, we need to use this pattern to find a specific ratio. If we derive out a quadratic sequence with first term $7.5$, first difference $4.5$ and constant difference between differences $1$; the $nth$ ratio is $\frac{n^2 + 6n + 8}{2}$.
I got this from a general sum function I derived for all quadratic sequences, if you want to I can post it here.
So we know that the denominator for a ratio is $a_n$, which means $b_n$ must just be $a_n$ multiplied by the ratio:
$$b_n = a_n\frac{n^2 + 6n + 8}{2}$$
And similarly:
$$a_n = \frac{2b_n}{n^2 + 6n + 8}$$
EDIT: didn't notice that there were answers before me, I'll leave my answer here anyways.


text:
Q: All jComboBoxes are mirroring each other I am using Net-beans so, I have 40 Combo box in one frame enclosed in a panel.
So, i resized 8 of them to my convenience and i copied and pasted all 8 Combo Boxes in the panel 5 times. In run time however, whenever i select 1 Combo Box say to index 2 all the other FORTY of them get automatically selected to index 2 as well.
So, i did some testing and found out that when I remove this following piece of code all JComboBoxes work perfectly. Here's the code...
public void MoveToComboBox()
{
try
{
Class.forName("java.sql.Driver");
Connection conn= (Connection)DriverManager.getConnection("jdbc:mysql://localhost:3306/teacher?zeroDateTimeBehavior=convertToNull","root","1234");//standard
PreparedStatement pst=conn.prepareStatement("Select * from sections");
DefaultComboBoxModel dcm=new DefaultComboBoxModel();
ResultSet rs=pst.executeQuery();
while(rs.next())
{
    String a=rs.getString("section");
    dcm.addElement(a);
}

d11.setModel(dcm);
d12.setModel(dcm);
d13.setModel(dcm);
d14.setModel(dcm);
d15.setModel(dcm);
d16.setModel(dcm);
d17.setModel(dcm);
d18.setModel(dcm); //these are just 8 of them rest 40 are all like this just like this
}
catch(Exception e)
{
JOptionPane.showMessageDialog(null,"Please Prepare the data for first use first.");
}
}

I created a method to get the data from a SQL table called sections and set it on all the combo boxes
then at window activated i run this method...
private void f3WindowActivated(java.awt.event.WindowEvent evt) {
f3.setLocationRelativeTo(null);
MoveToComboBox(); // <-- This is the code if I comment this everything works fine
t1.requestFocus();
}

Yep that's it and the said problem of mirroring combo boxes arises;

A: It is such that a data model will have one or more views as listeners and model changers. Does the model change, will all views change (on receiving a change event). In this case the model:

*

*contains all elements

*maintains a selected element (which causes the problem mentioned)

In your case make N DefaultComboBoxModels and share just the data:
Vector<String> sections = new Vector<>();
try (Connection conn = DriverManager.getConnection(...);
        PreparedStatement pst = conn.prepareStatement("SELECT section FROM sections");
        ResultSet rs = pst.executeQuery()) {
    while(rs.next()) {
        String s = rs.getString(1);
        sections.add(s);
    }
}
d11.setModel(new DefaultComboBoxModel(sections));
d12.setModel(new DefaultComboBoxModel(sections));
d13.setModel(new DefaultComboBoxModel(sections));
...

Above I use an ugly construct try-with-resources that ensures the following will be called at the end:

*

*rs.close();

*pst.close();

*conn.close();

(This is because all objects are AutoCloseable.)
You can call them also explicitly at the end.
Class.forName exists just to load MySQL's product, as during compilation one does not need (or event want) to import a MySQL specific driver. However that is nowadays not really needed, as JDBC database drivers can now be found dynamically.
And your Class.forName did not load the MySQL class.
Note that the Vector class is rather old, but DefaultComboBoxModel(Vector) fits.


text:
Q: Is a pinned photodiode necessary in a 4T APS cell? I would like to know if a pinned photodiode (PD) is required or desirable for a 4T APS cell that performs global shutter?
If yes, Why is it so necessary instead of using a conventional PD?


text:
Q: Playbook with with_items is not going through all statements I have this code
  1 - hosts: webservers
  2   remote_user: user
  3   become: yes
  4   become_method: sudo
  5   tasks:
  6
  7   - name: Adding hosts to file
  8     lineinfile:
  9                  dest=/etc/hosts
 10                  state=present
 11                  insertafter=EOF
 12                  line="someline1"
 13     with_items:
 14       - line="someline2"
 15       - line="someline3"
 16       - line="someline4"
 17       - line="someline5"

However, when the script runs, it only goes through two of the cases, like this and it doesnt tell me about the line in the original lineinfile function -
PLAY [webservers] *************************************************************

GATHERING FACTS ***************************************************************
ok: [user@11.11.11.11]

TASK: [Adding hosts to file] **************************************************
ok: [user@11.11.11.11] => (item=line="someline2")
ok: [user@11.11.11.11] => (item=line="someline3")
ok: [user@11.11.11.11] => (item=line="someline4")
ok: [user@11.11.11.11] => (item=line="someline5")

PLAY RECAP ********************************************************************
user@11.11.11.11        : ok=2    changed=0    unreachable=0    failed=0

Someline3, 4, and 5 are not added into the file.  Any idea what the issue might be?

A: You are checking for the same line every time. Change this to suit your needs:
  - name: Adding hosts to file
    lineinfile:
                 dest=/etc/hosts
                 state=present
                 insertafter=EOF
                 line={{item}}
    with_items:
      - "someline1"
      - "someline2"
      - "someline3"
      - "someline4"
      - "someline5"


text:
Q: Retrieve list of inputboxes selected I want to retrieve the list of inputboxes(sessions) selected after saving the form. Below is the code I am using.
Page:
<apex:page controller="listex">
    <apex:form >
        <apex:pageBlock >
            <apex:pageBlockTable value="{!sessions}" var="a">
                 <apex:column value="{!a.numb}"/>
                 <apex:column value="{!a.str}"/>
                 <apex:column ><apex:inputcheckbox /></apex:column>
            </apex:pageBlockTable>
            <apex:commandButton value="save" action="{!save}"/>
        </apex:pageBlock>
    </apex:form>
    <!--Get the list of sessions selected after save is clicked-->
</apex:page>

Controller:
public class listex {
    public list<s> inte;

    public list<s> getsessions(){
    list<s> inte = new list<s>();
        for(integer i=1;i<4;i++) {
            inte.add(new s(i,'session'+i));
        }
        return inte;
    }

    public class s{
        public integer numb{get;set;}
        public string str{get;set;}
        public s(integer i, string s){
            this.numb = i;
            this.str = s;
        }
    }

    public pagereference save(){
        return null;
    }

}

Thanks.

A: You don't say what problem you are having with this, but I do see that you are not binding a variable to your checkbox.
<apex:column ><apex:inputcheckbox /></apex:column>

There's a working example of this here.  The key line is
<apex:inputCheckbox value="{!c.selected}"/>

but the supporting wrapper class is needed as well.


text:
Q: Route for hosts in LAN should not handled by VPN-DNS I use NordVPN-NetworkManager to handle my VPN servers. This works well with NetworkManager, with one single problem: Local hosts will not be resolved by my local DNS (Unify setup) but from the DNS of the VPN.
Is there a way to have multiple DNS servers at the same time for different subnets/"zones", so I can access my local hosts (like my fileserver) and at the same time be connected to the VPN?