text:
Q: Klipfolio (Podio integration) is missing values Using API I have exported data from my Podio app into Klipfolio but somehow not all data is being exported. When trying to show all values from a field, only some of them are shown.
I have tried to find the root of the problem by contacting Klipfolios support but have gotten the following answer
"The data in the datasource is all of the data being returned by the service you are connected to via the API, if there is a discrepancy in what you are seeing in the service portal and the datasource then you will need to contact that service to determine the issue as it is not something that Klipfolio is restricting "
As an example of the problem I have included two screenshots.

*

*A screenshot of the Podio app export called "Personale"

.

In column R (highlighted in red) the values for the "Stilling" field is seen. There is a total of 155 values.

*

*A screenshot from Klipfolio with the values from the "Stilling" field put into a table:
.

As seen there is only 80 items and when I scroll down some of them is not even from the "Stilling" field, but from the one of the other fields.

Somehow not all values are being exported into the Klipfolio data source (JSON format). Can anyone tell me how I can solve the problem, or do I need to provide more information?

A: I am not quite sure, since I haven't actually played around with Podio as such, but I've once heard that there is some kind of limitation on how much data you can pull out at once from Podio. Try to check that out :)

A: Your Klipfolio config says: @/items/fields[16]/values/..., which expects to have needed data always at 16th position.
Luckily Podio doesn't return value if there is no value to return, so you can't use this straight-forward approach. So, field that you expect to be 16th will be 15th if 15th is empty. And you have to address fields differently (e.g. by name, or id) which will be constant and won't depend of other fields and won't depend on app fields re-arrangements.

A: As Pavlo mentioned, you will need to filter based on a JSON record name and not the indices of the JSON record as not all field arrays will be in the same position for each item. The following JSON expressions should return all the value records for where the label of the field is "Stilling"
@/items/fields[label='Stilling']/values/value/text


text:
Q: How to find translation and rotation between 2 images I have 2 grid pattern images.
image1: reference image
image2: sensed image
I want to find the translation and rotation between these 2 images such that the overlap area is maximizing.
I believe this question is related to image registration and I followed the example from this website
https://www.sicara.ai/blog/2019-07-16-image-registration-deep-learning
but the result is not satisfactory
Here is my code
import numpy as np
import cv2

img1 = cv2.imread('image1.png', cv2.IMREAD_GRAYSCALE)
img2 = cv2.imread('image2.png', cv2.IMREAD_GRAYSCALE)

akaze = cv2.AKAZE_create()
kp1, des1 = akaze.detectAndCompute(img1, None)
kp2, des2 = akaze.detectAndCompute(img2, None)

bf = cv2.BFMatcher()
matches = bf.knnMatch(des1, des2, k=2)

good_matches = []
for m, n in matches:
    if m.distance < 0.75*n.distance:
        good_matches.append([m])

output = cv2.drawMatchesKnn(img1, kp1, img2, kp2, good_matches, None, flags=cv2.DrawMatchesFlags_NOT_DRAW_SINGLE_POINTS)
cv2.imwrite('output.png', output)

Here is the output  output.png
Any ideas or suggestions would be great, thank you!

redpajama_set_name: RedPajamaStackExchange


text:
Q: How to power a device using a USB port instead of AA batteries? I have a device that uses 3 AA batteries and I would like to power it from a USB port instead.
As I understand I will have to use resistors but I have no idea on which ones.
I have found the following calculator: Voltage Divider Calculator
While it does its work, the wiring shown in diagram is quite confusing:

I guess this is some logical schema rather than real wiring schema.
Question:
What resistor values do I need to get ~3.6V from a 5V USB port, and how should I wire them ?
Is there a better way than using resistors to get 3.6V from 5V?

A: Resistors will not be the best option, you need to know the source current of the device and there will be large voltage swings if the device changes it's current. Resistors may also not be possible if the device draws large amounts of current.
Three alkaline batteries is lower than 4.5V (could be as low as 3.6V when their dead). Since the device running from 3 alkaline batteries should be able to accept 4.5V, a voltage regulator like the might be a good way to ensure that the device is getting the appropriate voltage, however you might need to select one with a lower dropout than 0.5V which might be hard if your device needs more than 100mA.
Another option would be to find out if the device already has a linear regulator or switching regulator on the input. If it does, then you might be able to run 5V straight into the device.


text:
Q: relation between QAudioInput bufferSize() and bytesReady() in QT I am trying to understand the relation between bufferSize() and bytesReady() for QAudioInput class in QT.
Assume that I have:
m_audioInput = new QAudioInput(m_Inputdevice, m_format, this);
bs = m_audioInput->bufferSize();
br = m_audioInput->bytesReady();

When I look at the values of bs and br (these are default values and I did not change the buffer size), I see that bs is 5 times larger than br. So it looks like there is a buffer that holds 5 blocks of audio input data. My question:
Is this a circular buffer? If I have these:
m_input = m_audioInput->start();
connect(m_input, SIGNAL(readyRead()), SLOT(myFunc()));

Then when I perform a read by:
MainClass::myFunc()
{
   qint64 l = m_input->read(m_buffer.data(), br);
   .
   .
 }

*

*Does it read from the buffer in a circular manner? i.e. if I perform read 2 times consequently after a readyRead() is emitted does the buffer pointer moves from 1 block to second block (if it has 5 blocks in total)?

*Is there any documentation on the buffer pointer, and if it is a circular buffer, etc.?

*Are there automatic read and write pointers to the buffer? Do I need to take care of those, or it is being taken care of automatically?

Any help and pointer related to this is very much appreciated.

A: I don't really understand your use case. First thing, I suppose when you call
br = m_audioInput->bytesReady();

you are either in QAudio::ActiveState or QAudio::IdleState. Otherwise br is just junk.

So it looks like there is a buffer that holds 5 blocks of audio input data.

A Sample is a unit of audio data. If by that you mean 5 samples then it is not correct. There is also no such thing as block of audio when it comes to non-encoded data.
You can compute how much seconds(or milliseconds) of audio are in your buffer:

*

*Buffer size/ Sample size gives #samples

*1/sampling frequency gives you sample size in seconds

*sample size x #samples the size of buffer in seconds.

*That's in mono mode (one channel). You need to divide by the number of channels

In Qt:
   BuffersizeSeconds = (int)((1.0/m_format->sampleRate())
                             *(m_audioInput->bufferSize()/m_format->sampleSize())
                             *(1.0/m_format->channelCount())
                             );


text:
Q: How to use Any() with System.Linq.Dynamic? I have an example with two tables - Movies and Genders. The relationship is N:N so I have in Movies a collection of Genders and in Genders a collection of Movies.
I am using System.Linq.Dynamic to create my query and I would like to know how to get all the movies that at least one of its gender is in a list of genders (the parameters of search).
I try to do something like this:
Genders.Any(x => lstGenders.Contains(x))

But I get an exception that there does not exist an x field in Genders.
Is it possible to all the movies that at least has a gender that is in the list?


text:
Q: .Net based web crawler sample I am using VSTS 2008 + C# + .Net 3.5. I want to find a tool (open source) which crawls all web pages for a web site, and for any other domain pages which is linked by this web site, I want to skip to crawl them (I only need page for this specific domain only). For crawled web page, I want to store them into local file directory.
Any samples or ready to use open source tool?

A: Arachnode.net might be what you are looking for.

A: I am the author of AN.
AN indexes all languages by default.  Nothing to configure.

*

*Mike


text:
Q: Sync on-premises Active Directory to Office 365 I'm trying to find the correct way to sync new Active Directory accounts on an on-premises server to Office 365 for existing 365 accounts without breaking things. My attempts so far appear to cause problems.
The context:
I have staff who have existing 365 accounts. They need access to SQL services served from our on-premises server, so I created new user accounts for them on the server AD. On recommendation, I set these to be synced to 365.
The problem:
Setting the user logon name breaks (i.e. overwrites and changes) either the Windows username or the email address of the users, whereas I don't really want either to change.
To elaborate:

*

*Our Windows usernames follow the pattern FirstnameLastname e.g. JoeBloggs

*Our email addresses follow the pattern firstname@company.com e.g. joe@yoyodyne.com

*Our Windows accounts are AzureAD, so CMD whoami returns azuread\joebloggs
When setting up a new on-premises AD account, if I follow the pattern for the user logon name to be firstname@company.com this changes the Windows username from "JoeBloggs" to "joe". That breaks things for our file structures.
But if I follow the pattern of FirstnameLastname@company.com the Windows username stays correct but the user's email address changes from joe@yoyodyne.com to JoeBloggs@yoyodyne.com. I don't want to change my staff's email addresses.
How can I set up a new AD account on my on-premises server, synced to Office365, without breaking things for staff who are existing 365 users?
enter image description here

A: You can easely change things on the on premise AD server to reflect your existing mail addresses:

*

*Go to Start > Run and type adsiedit.msc

*Find the user account > Properties

*Edit the proxyAddresses attribute

*Add primary email address in this format: SMTP:emailaddress@example.com (uppercase SMTP)

*Add secondary email addresses in this format: smtp:emailaddress@example.com (lowercase smtp)


text:
Q: Python: Append to dictionary in for loop I'm getting unexpected results when trying to populate a dict with output from the Linux fio command.
with open('normal_output.txt', 'rb') as f:
    for line in f.readlines():
        d = {}

        if ':' not in line:
            continue
        print("LINE: ", line)
        key, value = line.strip().split(':', 1)
        d[key] = value

I expect a dictionary full of KVPs like:
('KEY: ', 'READ')
('VALUE: ', ' io=131220KB, aggrb=13890KB/s, minb=13890KB/s, maxb=13890KB/s, mint=9447msec, maxt=9447msec')
('KEY: ', 'WRITE')
('VALUE: ', ' io=130924KB, aggrb=13858KB/s, minb=13858KB/s, maxb=13858KB/s, mint=9447msec, maxt=9447msec')
('KEY: ', 'Disk stats (read/write)')
('VALUE: ', '')
('KEY: ', 'sda')
('VALUE: ', ' ios=32642/32600, merge=0/12, ticks=7472/936, in_queue=8392, util=88.18%')
{'sda': ' ios=32642/32600, merge=0/12, ticks=7472/936, in_queue=8392, util=88.18%'}

But instead, I'm just getting the very last KVP:
{'sda': ' ios=32642/32600, merge=0/12, ticks=7472/936, in_queue=8392, util=88.18%'}

I tried d[key].append(value) but that gives me: KeyError: 'fio_test'

A: In your loop you're creating a new empty dictionary d. Move it outside the for loop.
From
with open('normal_output.txt', 'rb') as f:
    for line in f.readlines():
        d = {}
        # do work

to
with open('normal_output.txt', 'rb') as f:
    d = {}
    for line in f.readlines():
        # do work

You can even move the dictionary creation outside the context manager (with statement) to keep the logic better organized, but that's more of a matter of taste and style.

A: You are instantiating the dictionary in the for loop, so every time it loops you are overwriting your dictionary. Bring d={} outside the for loop


text:
Q: Supabase Edge function says no body was passed I'm invoking a supabase edge function with the following
    async function getData(plan_data){
        console.log(plan_data)
        console.log(JSON.stringify({plan_data}))
        const { data, error } = await supabase.functions.invoke("create-stripe-checkout",
        {
            body: JSON.stringify({
                plan_data
            }),
        }
        )
        console.log(data, error)
        // console.log(data)

    }

In the edge function I console logged the request and it stated bodyUsed: false. Essentially  the edge function acts like and believes that no value was passed. (A value is passed to the getData function properly).I've played around with the syntax a bit to no avail, am I missing something?
EDIT:
Edge function is as follows
import { serve } from "https://deno.land/std@0.131.0/http/server.ts"

serve(async (req) => {
  if (req.method === "OPTIONS"){
    return new Response (null, {
      headers: {
        "Access-Control-Allow-Origin": "*",
        "Access-Control-Allow-Headers": "apikey, X-Client-Info, Authorization, content-type",
      }
    })
  }
  console.log(req)
  const { planId } = await req.json()
  console.log(planId)
  return new Response(
    JSON.stringify({ planId }),
    { headers: {
      "Access-Control-Allow-Origin": "*",
      "Access-Control-Allow-Headers": "apikey, X-Client-Info, Authorization, content-type",
      // "Content-Type": "application/json",
    } },
  )
})

EDIT: I tried running it with supabase's example code and had the same issue.

A: Seeing how this was a CORS error, I ended up allowing all headers in the preflight check response CORS headers.
I.e.
...
if (req.method === "OPTIONS"){
    return new Response (null, {
      headers: {
        "Access-Control-Allow-Origin": "*",
        "Access-Control-Allow-Headers": "*", // <-- change here
      }
    })
  }
...

A: Does adding the content type header work?
async function getData(plan_data) {
  console.log(plan_data)
  console.log(JSON.stringify({ plan_data }))
  const { data, error } = await supabase.functions.invoke("create-stripe-checkout",
  {
    headers: {
      "Content-Type": "application/json",
    },
    body: JSON.stringify({
      plan_data
    }),
  });
  console.log(data, error)
}

A: Supabase SDK will take care of json encoding, so you don't need to do it by yourself.
async function getData(plan_data){
        const { data, error } = await supabase.functions.invoke("create-stripe-checkout",
          {
             body: { plan_data },
          }
        )
        console.log(data, error)
      }

You should be able to get the data on your Edge Function like this:
const { plan_data } = await req.json()
console.log(plan_data)


text:
Q: Is static friction an impulsive force? For example: let's consider a static sphere on an horizontal rough surface. I apply an impulse $J$ parallel to the ground and in the middle of the sphere.
If, like my book says, the friction is not an impulsive force, then I can use $J=\Delta p=mv_{CM}-0$, so $v_{cm}(0)=J/m$. But this is counterintuitive, because if I apply a small impulse ,for instance $J=1 Ns$, to a sphere of $m=10^{10} Kg$,  the static friction force ($F=\mu_{s}mg$) is surely enough to keep the sphere static.

You can repeat the reasoning without a sphere: an impulse $J_{x}=1 Ns $ on a point mass of $m=10^{10} Kg$ on a rough surface. If friction is not impulsive, then you move the object (of course, only for a very short time, because you have a dynamic friction that slow the motion) no matter what the mass is.
EDIT: The definition given in my book is: "very intense forces that act on a short time, compared to the observation time".

A: Simple example of impulsive force of friction: a marble hitting a hard surface at an oblique angle. During the (short) impact (which most would agree is an impulse) the normal force will be very large - and a component of friction will appear along the surface. When the marble is no longer in contact with the surface it will be rotating - showing that a torque impulse ($F_f r\delta t$) must have been applied.
So yes - it can be an impulsive force when $F_f \delta t$ remains constant in magnitude as the interval gets shorter. But in your example the normal force (on which magnitude of friction depends) does not change with duration of impulse so the product vanishes as $\delta t$ goes to zero: in that case instantaneous friction does not contribute significantly to the motion immediately after the impulse.

A: I found a couple definitions of impulsive force, one of which states

The force that two colliding bodies exert on one another acts only for a short time, giving a brief but strong push. This force is called an impulsive force.

Frictional forces don't typically satisfy the criterion of strong in magnitude. Or at least the magnitude of $F\Delta t$ is small compared to the actual collision-based (car-on-car) impulses present.

The idea behind this definition of impulsive forces is that a typical collision happens during a very short time interval $\Delta t$. The forces involved are quite high, such that the impulse $J=F\Delta t$ are appreciable. Small force compared to typical collision forces means not much impulse during the short time interval.

A: I think you're confusing the definition of Impulse. All forces can be impulses if acted through a period of time. As such, friction can be an impulse if that friction acts over a period of time. This is most easily thought of with dynamic friction since, as some object slides and returns to a stop, some force must be resisting that sliding - this is obviously dynamic friction in the most general case.
The following picture is from an impact hammer hitting a piston which is connected to a captive LVDT. The impact hammer outputs a signal of ~$1.0~\text{mv/lbf}$ (~$9~\text{lbf}$ avg) and acts over a period of time ($\sim \ 4$ ms). This impulse illicits a response in the piston which causes it to deflect, as seen on the teal-ish curve. The LVDT ouputs a signal of $15~\text{mm}$/V(absolute deflection from state 1 to state two is ~$15~\text{mm}$ in ~$23~\text{ms}$).
By looking at the LVDT curve, and seeing that the curvature of that line over which it is changing is parabolic of the 2nd order [I have the csv for this and can confirm that it is 2nd order parabolic], and by noting that the position with respect to time (neglecting initial conditions) can be simplified to $(\frac{1}{2})at^2$, it is obvious that the dynamic friction of the o-rings on the piston are implying a constant force over a period of time to slow and stop the piston.
This constant force over a period of time by the o-rings is directly an impulse.
By using a coulomb-friction impulse balance of J=J, average dynamic friction can be found.
Oscilliscope output:


text:
Q: lastUpdated is not showing in maven-metadata.xml I have an issue with an artifact's maven-metadata.xml is not showing up.
Here is the environment i am working on:
Apache Archiva , Ivy, ant.
Problem: When I am Deploying artifact via the Web UI Form, I am able to see all the attributes in maven-metadata.xml.
<metadata>
  <groupId>twitter evt</groupId>
  <artifactId>authentication</artifactId>
  <versioning>
    <latest>1.1</latest>
    <release>1.1</release>
      <versions>
       <version>LATEST</version>
       <version>1.0</version>
       <version>1.1</version>
      </versions>
   <lastUpdated>20090729142510</lastUpdated>
  </versioning>
</metadata>

But when i deploy the artifact through ivy by command prompt (ant publish-latest -Dversion=1.0.3), artifact is updating fine with latest changes but artifact's maven-metadata.xml is missing  attribute with latest time stamp.
<metadata>
  <groupId>twitter evt</groupId>
  <artifactId>twitter_account_management</artifactId>
   <versioning>
     <latest>1.1.1</latest>
     <release>1.1.1</release>
        <versions>
          <version>LATEST</version>
          <version>1.0</version>
          <version>1.0.1</version>
          <version>1.0.2</version>
          <version>1.0.3</version>
          <version>1.0.4</version>
          <version>1.0.5</version>
          <version>1.1</version>
          <version>1.1.1</version>
       </versions>
   </versioning>
</metadata>

Here is my ant publish-latest target:
<target name="publish_latest" depends="_loadantcontrib,dist" >
  <ivy:settings file="${ivy.settings.dir}/ivysettings.xml" />
  <ivy:resolve file="${ant.dir}/ivy.xml" transitive="false" />
  <ivy:findrevision organisation="${ivy.organisation}" module="${ivy.module}" revision="latest.integration"/>
  <echo message="looking in: ${basedir}/${build_distdir}/${jar_tcs_libdir}/${component.distfilename}/${component_version}/" />
  <ivy:publish resolver="ibiblio" artifactspattern="${basedir}/${build_distdir}/${jar_tcs_libdir}/${component.distfilename}/${component_version}/[artifact].[ext]" pubrevision="${version}" overwrite="true" update="true"/>
</target>

Please help me on this issue, I struck at this point in process of getting the latest artifact.

A: I'm not familiar with this aspect of Ivy, but there's potential that it's a bug in Ivy that doesn't write the field.
One potential way to correct this is to turn on Archiva's automated metadata correction. Try enabling the metadata-updater consumer in the Consumers of Known Content section at the bottom of the Repository Scanning admin page, then deploy the artifact again.
More information is available here: http://archiva.apache.org/docs/1.3/adminguide/consumers.html


text:
Q: QDialog won't stay on top of parent QMainWindow I'm trying to use Qt to make an option dialog that stays on top of the program's main window (which is a QMainWindow). QDialog seemed like a perfect fit, but clicking the main window would bring it back to the front. However, I have managed to make two tiny examples: one which works, and another which doesn't (which is derived from my actual application). I don't know what makes the behavior different between these two examples.

The option window in the following example stays on top of the main window:
test.cpp
#include <QApplication>
#include <QMainWindow>
#include <QDialog>

int main(int argc, char *argv[])
{
    QApplication test(argc, argv);
    QMainWindow *mainWindow = new QMainWindow;
    mainWindow->show();

    QDialog * optionsWindow = new QDialog(mainWindow);
    optionsWindow->show();

    return test.exec();
}

test.pro
TEMPLATE = app
TARGET = test
INCLUDEPATH += .
QT = core gui widgets

SOURCES += test.cpp

The option window in the following example does not stay on top of the main window:
TestApp.cpp
#include <QApplication>
#include "MainWindow.hpp"

int main(int argc, char *argv[])
{
        QApplication testAppGUI(argc, argv);

        MainWindow *mainWindow = new MainWindow();
        mainWindow->show();

        return testAppGUI.exec();
}

MainWindow.hpp
#ifndef MAINWINDOW_HPP
#define MAINWINDOW_HPP

#include <QMainWindow>
#include "OptionWindow.hpp"

class MainWindow : public QMainWindow
{
    Q_OBJECT
    public:
        explicit MainWindow(QWidget *parent = 0)
        {
            optionWindow = new OptionWindow(this);
            optionWindow->show();
        }
        OptionWindow *optionWindow;
};

#endif

OptionsWindow.hpp
#ifndef OPTIONWINDOW_HPP
#define OPTIONWINDOW_HPP

#include <QDialog>

class OptionWindow : public QDialog
{
    Q_OBJECT
    public:
        explicit OptionWindow(QWidget *parent = 0){}
};

#endif

TestApp.pro
TEMPLATE = app
TARGET = TestApp
INCLUDEPATH += .

QT = core gui widgets

HEADERS +=  MainWindow.hpp \
            OptionWindow.hpp

SOURCES +=  TestApp.cpp

This SO answer suggests giving the QDialog a parent, which I do. It also mentions setting the Qt::Tool flag, but it could not solve my problem (and the working example above doesn't use it).
This other answer suggests using a QDockWidget, but it doesn't meet my wanted visual style or expected behavior.
Speaking of which, here's what I expect of my options dialog:

*

*The options window should always be on top of the main window, but not of the other applications;

*Only the main window shows in the taskbar;

*Minimizing the main window also minimizes the options window, and restoring it also restores the options window (on top of the main window);

*The main window should still be enabled when the options window is open.

I am using QMake 3.1, Qt 5.8.0, g++ 5.4.0 and Xfce 4.12 on Linux Lite 3.4.

A: A couple of points...
Firstly, you're not using the parent parameter passed to the OptionWindow ctor: you need...
class OptionWindow: public QDialog {
  Q_OBJECT;
public:
  explicit OptionWindow (QWidget *parent = nullptr)
    : QDialog(parent) /* <-- Added */
  {}
};

That issue I understand but... secondly, it appears you need to make sure you call show on the parent before calling show against the QDialog.
class MainWindow: public QMainWindow {
  Q_OBJECT;
public:
  explicit MainWindow (QWidget *parent = nullptr)
    {
      optionWindow = new OptionWindow(this);
      show(); /* <-- Added */
      optionWindow->show();
    }
  OptionWindow *optionWindow;
};

That one I can't really explain -- sorry (although it could be a function of my window manager: fvwm -- I'm on Suse linux using Qt5.8).  Perhaps someone else can chip in and I'll update.


text:
Q: Knockout Conditional - How can I have something happen every "X" times? I want something to be visible starting on iteration 1, 33, 65, 97, 129.  Is there an easy way to to this?  Something similar to below?

A: You can use the mod/remainder operator for that:

EG:

var vm = {
  c: ko.observableArray([])
}

for (var x = 0; x < 150; x++)
  vm.c.push({
    Counter: x
  });

ko.applyBindings(vm);


text:
Q: What is a named Apollo Server field within a resolver? How does it work? In a server I'm working on, I've noticed it has different named resolvers and I'm unsure how they work:
export const resolver = {
 Query: {
  getUsersById(...
 },
 Mutation: {
  updateUserById(...
 },
 User: {
 accounts(...
 },

I understand that the Query field will mean that the resolver getUserById will be a query and the same with resolvers within the Mutation field. I can query those by doing:
query {
  getUsersById(...)
}

I don't understand how this works with named fields since obviously I can't do:
user {
 accounts(...)
}

I can't find any documentation on this either, so any clarification would be appreciated!

A: Those may be field resolvers. When Apollo finishes a query or mutation resolver and is about to return an object, e.g. in your example, Users or accounts, it runs it through any field resolvers that are present for that object. The field resolver can modify or add fields that are part of the object.


text:
Q: How can I transfer my domains from my existing registrar/hosting service to something like GoDaddy? Will I have to pay again? I have about 9 months left before renewal but my current provider doesn't offer many options / control panels.
Update: thanks for everyone's help - I've finally completed this now.
I had to:

*

*Ask my old registrar to "Unlock" the domain

*Ask my old registrar to set the admin email address of the domain to my email

*Ask my old registrar for the "authcode"

*For the rest I just followed GoDaddy's instructions

What a pain in the a**

A: This is how it works
Lets say you have 9 more months for your current domain to expire
you transfer the domain to GoDaddy (or to any other decent Registrar)
you will be charged the price (little more or equal) to the price of booking a new domain
BUT, you will have the domain for 9 months + one year (or the no. of years you paid godaddy for)
So, you choose to transfer the domain and pay USD9.99 (for a year), you will have the domains for 1 year + 9 months

A: I did this when I had to switch hosts from awful, unreliable Fuitadnet.  They managed the domain for me so I emailed them that I wanted to transfer my domain.  (I transferred to GoDaddy.)
I don't remember all of the details, but I seem to recall it was a multiple-handshake process.  First, they had to get my current registrar to release the domain; this involved having an email sent to me so I could confirm I actually wanted to release the domain.  Then, I got a confirmation code that I sent to the new registrar, who did something or the other and came back with a new confirmation code.  Once I entered the final confirmation code, the domain belonged to the new registrar.  It took a few days and for some reason my first set of codes didn't work, but I found GoDaddy was pretty good at explaining what was going on.
I did have to pay a transfer fee, but the registration retained its length.  I opted to renew it because there was a discount at the time.
If you contact your current host/registrar and they should be able to help you out; this was one of the few times I actually got good service out of fuitadnet.

A: You must have the domain unlocked with your current registrar and make sure that your contact information is up to date.
You can then have the new registrar submit a transfer request.  This will result in you being sent a notification (assuming your contact information is accurate).
You will have to follow the directions in that transfer request email.
The domain may take up to a few days to fully transfer to the new registrar.
When you transfer a domain, you are effectively extending the registration for another year so you will be charged the standard transfer/registration fee.
If you have any questions, you can always contact the company you would like to become the new registrar.  I am sure they would be able to walk you through their process exactly.

A: Just so you know, GoDaddy as a company has a somewhat dubious reputation.  I personally have never had any problems with them but I have only a few low-profile sites and have never done anything even remotely complicated with the DNS.

A: There is a domain transfer procedure.  It's kind of complex, since it's intended to keep people from stealing domains by transferring them to another registrar (like happened to sex.com back in the 90's).  GoDaddy does a good job of talking you through it (I've transferred a domain to them in the past).  Of course, you're going to have to pay them to register the domain for you (though they occasionally offer discounts on domain transfers).

A: You probably will have to pay. If you check with your current registrar and with your target registar and see what needs to be done with them and what the costs are.
It is diferent for every registar, even though the actual process is the same.

A: they charge you to transfer (like 6.99?), but godaddy will then renew it for a year. You usually need to contact your current hosting and have them release it for transfer, then follow godaddy's procedure for transferring a new domain in.

A: You may need to pay, but when I switched from Register.com to goDaddy.com I paid a very small amount to transfer (like $10) and also renewed the domain for another 2 years. (This turned out to be much cheaper than renewing with Register.com)

A: Yeah!! I was charged by my new registrar when I moved. Also remember you should have the secret key (transfer code) before you start your transfer process.

A: Depends on the host also. If you go with a company like BlueHost, for example, they'll give you free domain transfers from the losing registrar. I think, in fact, they may give you free transfers. They will and ask if you want to renew your domain with them which will cost you, though.


text:
Q: I want to navigate on a url after login in Angular js (4.4.6) import { Component } from '@angular/core';
import { Loginservice } from './services/login.service';
import { FormGroup, FormControl, Validators } from '@angular/forms';
import { Router } from '@angular/router';

@Component({
    selector    : 'app-login',
    templateUrl : 'user-login.html',
    styleUrls   : ['styles/login-style.css']

})
export class UserLogin{

    public userDetail:any[];
    public islogin:boolean;
    public routers : Router;
    constructor(private service:Loginservice){

    }
    loginform = new FormGroup({
        username    : new FormControl('',[Validators.required, Validators.minLength(5)]),
        password    : new FormControl('',[Validators.required, Validators.minLength(5)])
    });

    get username(){
        return this.loginform.get('username');
    }
    get password(){
        return this.loginform.get('password');
    }

    getStyle(){
        return {
            'font-size': '11px',
            'text-align': 'center'
        };
    }

    authLogin(loginObj){

        let username = loginObj.value.username;
        let password = loginObj.value.password;
        let postdata = {'username':username, 'password':password};
        //console.log(postdata);
        this.service.validateUser(postdata)
                    .subscribe(
                       response => {
                           this.islogin= response.json().status=='1'?true:false;
                           //alert(this.islogin);
                           //console.log(response);
                           this.routers.navigate(['/register']);
                       },
                       error =>{
                           alert(error+"asdsadsa");
                       }

                    );

    }
}

this is the code of my component. when i login then i want to go to another component having a common header and footer. but it does not go to any component and giving error "Cannot read property 'navigate' of undefined". and one more thing i want to know that how to add common header and footer file in each component except login/registration.

A: The Best way to achieve it is create separate header and footer components, as I did, below:

The code inside header and footer can represent whatever you want:

{{copyright}}

and
import { Component, OnInit } from '@angular/core';

@Component({
    selector: 'footer',
    templateUrl: './footer.component.html',
})

export class FooterComponent implements OnInit {
    copyright: string;
    constructor() {}

  ngOnInit(): void {

   this.copyright = 'My Copyright';
    return;

  }

}

Similarly you can create header component.
Once done, all you need to do is to use the selector tags, wherever you want to include it, generally in case of different HTML files.

                <My-App></My-App>


text:
Q: Circular Permutation Can someone please explain how to solve circular permutation sums. I just cannot seem to understand them.
eg.

$\text{(4)}$ The number of ways in which $6$ men and $5$ women can dine at a round table if no two women are to sit together is given by

*

*$\text{(a)}$ $6!*5!$

*$\text{(b)}$ $50$

*$\text{(c)}$ $5!*4!$

*$\text{(d)}$ $7!*5!$

A: Firstly let the 6 men sit at the table, this can happen in $(6 - 1)!$ ways. Then there are 6 spots between the men for the women to sit. This can be done in $6.5.4.3.2 = 6!$ ways, hence you have the answer $6!*5!$.

A: First seat the $6$ men. If they were seated in a row, there would be $6!$ possible permutations of them. However, they're actually seated around a circular table, which changes things. The six permutations $ABCDEF,BCDEFA,CDEFAB,DEFABC,EFABCD$, and $FABCDE$ are the same when the men are sitting in a circle: the only differences is where in the circle you started the list. Thus, each arrangement of the men around the table corresponds to $6$ permutations in a straight line, and there are therefore only $\frac{6!}6=5!$ possible arrangements of the men around the table. (This is a useful general fact: there are $(n-1)!$ circular permutations of $n$ things.)
Now we seat the $5$ women. There are $6$ positions available between adjacent men, so we have $6$ possible ways to seat the first woman. If we put another woman between the same two men, she'd be sitting next to the first woman; we don't want that, so we have to seat her in one of the other $5$ gaps between adjacent men. That leaves $4$ open gaps for the third women, $3$ for the fourth woman, and $2$ for the last woman, so altogether we can seat the women in $6\cdot5\cdot4\cdot3\cdot2=6!$ different ways.
Combining the two results, we see that the $11$ people can be seated in $5!\cdot6!$ different orders around the table if no two women sit next to each other.


text:
Q: What does it mean "get the email off"? During watching a gameplay walkthrough of a games named "SOMA"
I came across this sentence, " I got the email off. he must have caught up by now."
What does it mean "get the email off"?
I googled it, but still I can't get it what that means.
Thank you in advance.

A: That means he sent it out to him and now he expects him to receive it. The email was no longer on his computer, it was off the computer.


text:
Q: Links under result in SERPS? Sometimes when you google search, under a result will be links within that site eg 'contact', 'about', etc.  How does google decide weather to generate these and can you encourage it to happen?

A: I believe that is automatic. There is no way to 'make' that happen.
It depends on how search friendly your site is,how long your site has been up on the web, hits, visits etc...


text:
Q: How to call MVC Action using Jquery AJAX and then submit form in MVC? On my MVC View I have button:
<input id="btnSave" type="submit" name="Save" value="Save" />

When I click this button I need call one Action, do some stuff there and then Submit my form.
I have this jQuery:
$('#btnSave').click(function () {
    $.ajax({
        url: "/Home/SaveDetailedInfo",
        type: "POST",
        data: JSON.stringify({ 'Options': someData}),
        dataType: "json",
        traditional: true,
        contentType: "application/json; charset=utf-8",
        success: function (data) {
            if (data.status == "Success") {
                alert("Done");
            } else {
                alert("Error occurs on the Database level!");
            }
        },
        error: function () {
            alert("An error has occured!!!");
        }
    });
});

Then I want to submit my form. In Controller I have 2 Actions:
public ActionResult SaveDetailedInfo(Option[] Options)
{
    return Json(new { status = "Success", message = "Success" });
}

[HttpPost]
public ActionResult Save()
{
    return RedirectToAction("Index", "Home");
}

The problem is when I have type="submit" in my button, I can't reach SaveDetailedInfo Action, cause ajax gives me error, but when I remove type="submit", ajax works fine, but Save Action never executes.
Please, any ideas how to execute both Actions? I thought maybe after Ajax > Success try to add type=submit through jquery and use .click(), but it sounds strange to me.

A: Assuming that your button is in a form, you are not preventing the default behaviour of the button click from happening i.e. Your AJAX call is made in addition to the form submission; what you're very likely seeing is one of

*

*the form submission happens faster than the AJAX call returns

*the form submission causes the browser to abort the AJAX request and continues with submitting the form.

So you should prevent the default behaviour of the button click
$('#btnSave').click(function (e) {

    // prevent the default event behaviour
    e.preventDefault();

    $.ajax({
        url: "/Home/SaveDetailedInfo",
        type: "POST",
        data: JSON.stringify({ 'Options': someData}),
        dataType: "json",
        traditional: true,
        contentType: "application/json; charset=utf-8",
        success: function (data) {

            // perform your save call here

            if (data.status == "Success") {
                alert("Done");
            } else {
                alert("Error occurs on the Database level!");
            }
        },
        error: function () {
            alert("An error has occured!!!");
        }
    });
});

A: Use preventDefault() to stop the event of submit button and in ajax call success submit the form using submit():
$('#btnSave').click(function (e) {
    e.preventDefault(); // <------------------ stop default behaviour of button
    var element = this;
    $.ajax({
        url: "/Home/SaveDetailedInfo",
        type: "POST",
        data: JSON.stringify({ 'Options': someData}),
        dataType: "json",
        traditional: true,
        contentType: "application/json; charset=utf-8",
        success: function (data) {
            if (data.status == "Success") {
                alert("Done");
                $(element).closest("form").submit(); //<------------ submit form
            } else {
                alert("Error occurs on the Database level!");
            }
        },
        error: function () {
            alert("An error has occured!!!");
        }
    });
});

A: Your C# action "Save" doesn't execute because your AJAX url is pointing to "/Home/SaveDetailedInfo" and not "/Home/Save".
To call another action from within an action you can maybe try this solution:
link
Here's another better solution : link
[HttpPost]
public ActionResult SaveDetailedInfo(Option[] Options)
{
    return Json(new { status = "Success", message = "Success" });
}

[HttpPost]
public ActionResult Save()
{
    return RedirectToAction("SaveDetailedInfo", Options);
}

AJAX:
Initial ajax call url: "/Home/Save"
on success callback:
   make new ajax url: "/Home/SaveDetailedInfo"


text:
Q: How to generate and post .xlsx file to web api using Angular 2? Without downloading this file on local computer On click on the upload button, I need to generate and post excel (.xlsx) file with a table to WEB API as FormData. The file shouldn't be downloaded on a local computer.
I am using Angular v10, If anyone has an idea please let me know.
Thanks in advance.

A: You need a library to generate the xlsx files. Angular or browser doesn't have such functionality. The first one I found is sheetjs. Seems like a good one.

A: To send data through WEB API, you need to convert .xlsx data into JSON, Once you create JSON you can send JSON data through HTTP service. You can create a table as well.
To convert .xlsx data into JSON look into the below jsFiddle example link.
example


text:
Q: How to calculate Markov Chain balance equations when number of servers change dynamically I'm trying to understand how balance equations work when the number of servers in a system can change on demand. For example, say the number of servers in a system is 1 when the number of customers is less than 5, but three when the number of customers is greater than or equal to 5. The maximum number of customers in a system is 8.
So then we have this state transition diagram that I'm trying to understand:

and the equation $\lambda P_3$ = $\mu P_4 + 2\mu P_4'$ and $\lambda P_4+ \lambda P_4' = 3 \mu P_5'$
So does this mean that the value for $P_4$ is the same for both $P_4$ and $P_4'$? and how do we calculate $P_0$ in this case? Is this still by assuming all probabilities sum to 1?

A: The balance equations that you've written down are correct, but you'll need to deduce at least one more "unusual" balance equation. You cannot simply assume $P_4 = P_4'$, and most of the time these will not be equal.

In general, all balance equations come from the single-state ones which say that for every state, the rate that we leave it equals the rate that we enter it. Together with the condition that all the stationary probabilities must sum to $1$, these are always enough to solve for the stationary distribution. But these single-state equations are often inconvenient: for example, for state $2$, they say that $(\lambda + \mu)P_2 = \lambda P_1 + \mu P_3$, which is much more annoying to deal with than the $\lambda P_2 = \mu P_3$ you're used to seeing.
To deduce better equations, we can take the sum of several individual balance equations, and cancel like terms, to deduce a more general rule: for any set of states $S$, the rate at which we leave $S$ (to go to its complement) equals the rate at which we enter it (from its complement). That's where $\lambda P_2 = \mu P_3$ comes from: it is the balance equation for the set $S = \{0,1,2\}$, and comes from adding up the three individual balance equations for those states.
In general, we can replace the individual balance equations by any other set of balance equations, provided that we take enough. This comes down to a linear algebra spanning set question, but a basic necessary condition is that for an $n$-state problem, we'll need at least $n-1$ balance equations. (The last equation is the condition that all probabilities sum to $1$.)
In this problem, we already have the following:

*

*We get the usual $\lambda P_0 = \mu P_1$, $\lambda P_1 = \mu P_2$, and $\lambda P_2 = \mu P_3$ from the balance equations between $S = \{0\}$, $S = \{0,1\}$, and $S = \{0,1,2\}$ and their complements.

*We get the usual $\lambda P_5 = 3\mu P_6$, $\lambda P_6 = 3\mu P_7$, and $\lambda P_7 = 3\mu P_8$ from the balance equations between $S = \{6,7,8\}$, $S = \{7,8\}$, and $S = \{8\}$ and their complements.

*We get $\lambda P_3 = \mu P_4 + 2\mu P_4'$ from the balance equation between $S = \{0,1,2,3\}$ and its complement.

*We get $\lambda P_4 + \lambda P_4' = 3 \mu P_5$ from the balance equation beween $S = \{0,1,2,3,4,4'\}$ and its complement.

But that's only $8$ balance equations, and we have $10$ states! So we need one more balance equation.
There's many of them we could write down, but maybe the simplest one is the one for $S = \{0,1,2,3,4\}$: $$\lambda P_4 = 2\mu P_4'.$$


text:
Q: Android some time my code give not accurate distance in android? I have android app in which i am getting distance travelled speed and time some time the app works fine but sometime the app does not give accurate result i am using fused API in locationService class. any suggestions are welcomed.
Thanks

A: I'm assuming you're using a real android phone on your test and your code is 100% correct maybe the problem might be with the device itself. Have you turned  gps high accuracy on? Have you tested your application with another phone?


text:
Q: No response data from Laravel API using Axios I am setting up authentication using Laravel (Laravel Framework version 5.8.4) as a REST API, but when I make a post request using Axios, I get back an empty string.
Here is my code in Laravel:  "login" endpoint in my main controller:
 class MainController extends Controller
{

public function login(Request $request){

$data = [
'message' => 'yo'
];

return Response::json($data, 200);

 }
}

Here is my Axios code (from Vue.js method):
methods: {

      submitRegistration: function() {

    axios.post('http://envelope-api.test/api/auth/login', {
    name: this.form.name,
    email: this.form.email,
    password: this.form.password,
    password_confirmation: this.form.password_confirmation
  })
  .then(function (response) {
      console.log("here's the response")
      console.log(response);
    })
  .catch(function (error) {
    console.log(error);
  });

    },
  }

Here is the response from Postman (it works!)
{
    "message": "yo"
}

Here is the response from my axios request in console (empty string, where's the data?) :
{data: "", status: 200, statusText: "OK", headers: {…}, config: {…}, …}

A: To get data from axios you should use response.data, not just response.
Edit: Try to respond with the helper.
response()->json($data);

A: I've got this figured out. Thanks for your help.
I had this chrome extension installed to allow CORS (Cross Origin Resource Sharing) so I could do API requests from localhost (apparently, not needed for Postman?).
I turned it off and installed it locally on Laravel using this post (answer from naabster)
After I installed this way, it worked regularly.


text:
Q: getting input value on button click in django i'm trying to get the input value on button click
if request.method == 'POST':
   if request.POST['fah']:

this is getting me False when page is loaded and if i click on button, it's not changing
how can i write something like js addEventListener in django?
my button
<button type="button" class="bbtn" name="fah" id="fah" value="fah">Convert</button>

A: The value of a button is not submitted if the button does not have role submit. You can include a hidden field that contains your value or pass the value as a URL query string.


text:
Q: Could not load System.ServiceModel.ServiceBehaviorAttribute in .NET Core project I have a .NET Core test project. In this, I need to call WebApi and WCF services (as we have migrated only some of our projects and I need to generate test data using old and new services). I have added the System.ServiceModel.Primitives package to the project but I still get this exception:
System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation.
 ---> System.TypeLoadException: Could not load type 'System.ServiceModel.ServiceBehaviorAttribute' from assembly 'System.ServiceModel, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'.

Has somebody an idea what I could have missed?

A: I found out that there were a lot of missing references in my project, none of them related to WCF directly. When debugging with breakpoints on the exceptions, I added the missing packages one after the other. In some cases, I found online that there is just an exception in .NET Core and you can't do anything for it, and have to just ignore it. Quite strange but at the end my tests were running.
I still have no idea why the exception from the question was occurring but it disappeared once all of the required references were available. Maybe something wan't building correctly before that and so the WCF package wasn't loaded?
Never mind, should you get such a message, just enable breakpoints on all exceptions and debug to see what is really going on.


text:
Q: Bash alias for ls that prints multiple columns by "type" I'm listing just the file basenames with an ls command like this, which I got from here:
ls --color -1 . | tr '\n' '\0' | xargs -0 -n 1 basename

I would like to list all the directories in the first column, all the executables in the next, all the regular files last (perhaps also with a column for each extension).
So the first (and main) "challenge" is to print multiple columns of different lengths.
Do you have any suggestions what commands I should be using to write that script? Should I switch to find? Or should I just write the script all in Perl?
I want to be able to optionally sort the columns by size too ;-) I'm not necessarily looking for a script to do the above, but perhaps some advice on ways to approach writing such a script.

A: #!/bin/bash

width=20

awk -F':' '

/directory/{
  d[i++]=$1
  next
}

/executable/{
  e[j++]=$1
  next
}

{
  f[k++]=$1
}

END{
  a[1]=i;a[2]=j;a[3]=k
  asort(a)
  printf("%-*.*s | \t%-*.*s | \t%-*.*s\n", w,w,"Directories", w,w,"Executables", w,w,"Files")
  print "------------------------------------------------------------------------"
  for (i=0;i<a[3];i++)
    printf("%-*.*s |\t%-*.*s |\t%-*.*s\n", w,w,d[i], w,w,e[i], w,w,f[i])
}' w=$width < <(find . -exec file {} +)

Sample output HERE
This can be further improved upon by calculating what the longest entry is per-column and using that as the width. I'll leave that as an exercise to the reader


text:
Q: list of lists of dictionaries? I need to create a structure, in my mind similar to an array of linked lists (where a python list = array and dictionary = linked list). I have a list called blocks, and this is something like what I am looking to make:
blocks[0] = {dictionary},{dictionary},{dictionary},...
blocks[1] = {dictionary},{dictionary},{dictionary},...
etc..
currently I build the blocks as such:
blocks = []
blocks.append[()]
blocks.append[()]
blocks.append[()]
blocks.append[()]
I know that must look ridiculous. I just cannot see in my head what that just made, which is part of my problem. I assign to a block from a different list of dictionary items. Here is a brief overview of how a single block is created...
hold = {}
hold['file']=file
hold['count']=count
hold['mass']=mass_lbs
mg1.append(hold)
  ##this append can happen several times to mg1
blocks[i].append(mg1[j])
##where i is an index for the block I want to append to, and j is the list index corresponding to whichever dictionary item of mg1 I want to grab.
The reason I want these four main indices in blocks is so that I have shorter code with just the one list instead of block1 block2 block3 block4, which would just make the code way longer than it is now.

A: Okay, going off of what was discussed in the comments, you're looking for a simple way to create a structure that is a list of four items where each item is a list of dictionaries, and all the dictionaries in one of those lists have the same keys but not necessarily the same values. However, if you know exactly what keys each dictionary will have and that never changes, then it might be worth it to consider making them classes that wrap dictionaries and have each of the four lists be a list of objects. This would be easier to keep in your head, and a bit more Pythonic in my opinion. You also gain the advantage of ensuring that the keys in the dictionary are static, plus you can define helper methods. And by emulating the methods of a container type, you can still use dictionary syntax.
class BlockA:
    def __init__(self):
        self.dictionary = {'file':None, 'count':None, 'mass':None }
    def __len__(self):
        return len(self.dictionary)
    def __getitem__(self, key):
        return self.dictionary[key]
    def __setitem__(self, key, value):
        if key in self.dictionary:
            self.dictionary[key] = value
        else:
            raise KeyError
    def __repr__(self):
        return str(self.dictionary)

block1 = BlockA()
block1['file'] = "test"
block2 = BlockA()
block2['file'] = "other test"

Now, you've got a guarantee that all instances of your first block object will have the same keys and no additional keys. You can make similar classes for your other blocks, or some general class, or some mix of the two using inheritance. Now to make your data structure:
blocks = [ [block1, block2], [], [], [] ]
print(blocks) # Or "print blocks" if you're not using Python 3.x
blocks[0][0]['file'] = "some new file"
print(blocks)

It might also be worthwhile to have a class for this blocks container, with specific methods for adding blocks of each type and accessing blocks of each type. That way you wouldn't trip yourself up with accidentally adding the wrong kind of block to one of the four lists or similar issues. But depending on how much you'll be using this structure, that could be overkill.


text:
Q: How to pass the scope to the callback? I have the following code structure and I am trying to maintain the scope of "this" to the current object in the success and error callbacks.
I have tried using Apply function, but I am not sure how to use in my use-case and that's where I need some help.
Here is the code I have :
function navigateToDocumentList(record){
  var self= this;
    var handoutDocumentList=Ext.create('xxx.view.HandoutsDocumentListPanel');
    var navigationView = self.getNavigationView();
    navigationView.push(handoutDocumentList);
    navigationView.getNavigationBar().show();
    navigationView.getNavigationBar().setTitle(record.data.name);
    var url =  intermountain.constants.HANDOUTS_DOCUMENTS_OF_CATEGORY_SERVICE_URL+record.data.name;
    self.makeAJAXCallWIthParams(url,
                               16000,
                               self.navigateToDocumentListSuccess,
                               self.navigateToDocumentListError,
                               self);
}

function makeAJAXCallWithParams(url, timeout, success, error, callbackObj) {
Ext.Viewport.setMasked({
                        xtype: 'loadmask',
                        message: 'Loading ...'
                    });
Ext.Ajax.request({
                url: url,
                timeout: 5000,
                success: success.apply(callbackObj,[]),// I need to know how to pass the function arguments here as earlier I was just calling it by success and now I need to call it using apply function
                failure: failure

            });
}

Please let me know if I need to explain the problem better. Any input / hint would be appreciated.
Thanks for your time!

A: To answer your question about arguments, each function in Javasctript can access a list with all its arguments via the arguments pseudo-parameter:
success: function(){ return success.apply(callbackObj, arguments) }

However, its going to be simpler to use the bind method instead of apply or call.
success: success.bind(callbackObj),
failure: failure.bind(callbackObj)


text: Q: How to prove that $\sum_{n=1}^{\infty}\frac{1}{1+n^2x}$ is continuous on $(0,\infty)$ I know the series is pointwise convergent on $(0,\infty)$ and that it is uniformly convergent on $[a,\infty)$ for any $a>0$ but I'm not sure how to prove it is continuous on $(0,\infty)$.  Any help would be greatly appreciated. Thanks!


text:
Q: Yii One relation for multiple tables I am trying to write a customized relation that uses multiple tables, and this relation neeeds to join to the other tables by using a key from the first table.
Each table has the same columns.
So, let the story begin:
I am developing a online strategy based game. (PBBG - Persistant Browser Based Game)
I had a big table (30.000.000 rows) and I have split that table in 100 smaller tables (300.000 rows in each table).
The action happens within villages.
Details about the villages are stored within the village table.
Each village is situated within a continent, so there is a k number that gives me the continent that the village belongs to.
The village table has the following columns:
id - p.k.
x - x position on map
y - y position on map
k - f.k. continent id
name
user_id f.k.
points
I have 100 continents, that's why i have 100 new smaller tables.
I also have a table where I store the details for all the buildings.
The building details were stored within the village_building table.
So, from the original table village_building i now have village_building_k1, village_building_k2, ..., village_building_k100.
A village_building_k... table has the following columns:
id - p.k.
village_id - f.k.
building_id - f.k.
Now, I am trying to write a relation that jumps from model village to model village_building_kX where X should change when needed.
If I could use the k value from model village, that would give me the name of the table that i need to join.
If k = 2, the i need to jump from village to village_building_k2 using a concat
public function tableName() {
        return 'village_building_k' . self::$k;
    }

public function relations() {
        return array(
            'relation_village_building' => array(self::HAS_MANY, 'VillageBuildingKXSlaveM', 'village_id'),
        );
    }

$model_village->relation_village_building->building_id

A: Are you sure, that you need to solve this problem on framework level? I suggest to use here something like http://en.wikipedia.org/wiki/Shard_(database_architecture)

A: I think you need to add some shared databases. Due to your big database you can't manage it by your framework. Just try shared database for manage databases. Also you can try mysql cluster for manage database Follow this link and
this This may be helpful for you. Remember one frameworks are some set of functions so that you can to manipulate your function with your codes and supporting environment like databases and etc.

A: Actually you can try to pass db name from some global parameters, for example from session.
public function tableName()
{
   return 'village_building_k' . Yii::app()->session['table'];
}

Problem is to save session for your gamer long time. If you'll get alot of users, it will become a problem.
If you have few tables with same structure, probably your database architecture is wrong. If it was sharding, you need to change AR for this.
Main problem in yii and sharding is that AR in __construct() calls getMetaData() to get table schema, so you need table name in that level.
Search on forums for solutions, i personally didn't found good article on english. Here is article about horizontal sharding realisation with Yii and Redis here. It's on Russian, but you can watch atleast some code.
And 30.000.000 table is ok, if you'll work right way with it, even in mysql.


text:
Q: Guessing a number I want to create a program that gives you three tries to find any given number. It's going to essentially be a guessing game. The problem is, I have to do this without any loops. So far, I'm only able to get input from the user, read that input and tell them if they've won or 'lost' the game. The program only runs once and stops(as expected).
I was told that it could be done without loops, albeit with a lot more code. Can you guys let me know what I'm doing wrong here and give me some pointers on what I should change? If you need clarification let me know.
Thanks.
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {

        Scanner ran = new Scanner(System.in);
        System.out.println("Enter a number: ");
        int x = ran.nextInt();

        if (x < 3) {
            System.out.println("Too low. Try again.");

            System.out.println("Enter a number: ");
        } else if (x > 3) {
            System.out.println("Too high. Try again");

        } else if(x == 3) {
            System.out.println("You win. Nice job.");
        } else {
            System.out.println("You lose");
        }

        System.out.println("Number Guessing Game (c) 2017 Anna Gibson");
    }
}

A: You can do this using recursion. See this program. Find explanations within comments.
import java.util.Scanner;

public class HelloWorld {

    private static Scanner ran = new Scanner(System.in);

    //this is number of tries you want to give to user
    private static int counter = 5;

    //The actual number
    private static final int NUM = 3;

    public static boolean guessingMachine() {
        //counter indicates that number of attempts remaining
        if(counter == 0) {
            return false;
        }
        counter--;

        System.out.println("Enter a number: ");
        int x = ran.nextInt();

        if (x < NUM) {
            System.out.println("Too low. Try again.");
            //try again... call this method again
            return guessingMachine();
        } else if (x > NUM) {
            System.out.println("Too high. Try again");
            //try again... call this method again
            return guessingMachine();
        } else {
            //x == NUM success
            return true;
        }
    }

    public static void main(String[] args) {
        boolean result = guessingMachine();

        if(result)
            System.out.println("You win. Nice job.");
        else
            System.out.println("You lose");

        System.out.println("Number Guessing Game (c) 2017 Anna Gibson");
    }
}

A: You could next conditions:
get user input
if input is correct, congratulation user and exit
    else
        get user input //second attempt
        if input is correct, congratulation user and exit
...

You can continue from there. The code you provided, where you tell the user if they are too high or low, would have to be included in each of the branches of the pseudocode above.

A: I think the main purpose of this exercise is intended for you to strengthen your nested if-else concepts.
import java.util.Scanner;

public class HelloWorld{
 public static void main(String []args){
    int num=3;
    int count=1;
    Scanner ran = new Scanner(System.in);
    System.out.println("Enter a number: ");
    int x = ran.nextInt();

    if(x>num || x<num)
    {
        System.out.println("incorrect guess");
        count++;
        System.out.println("Enter a number: ");
         x = ran.nextInt();
         if(x>num || x<num)
         {
              System.out.println("incorrect guess");
              count++;
                          System.out.println("Enter a number: ");
                           x = ran.nextInt();
                           if(x>num || x<num)
                           {
                               System.out.println("incorrect guess YOU LOSE");
                           }
                           else
                           {
                                               System.out.println("YOU WIN");
                           }
         }
         else
         {
               System.out.println("YOU WIN");
         }

    }

    if(x==num && count==1)
    {
        System.out.println("YOU WIN");
    }

    System.out.println("Number Guessing Game (c) 2017 Anna Gibson");
 }
}


text:
Q: Let $f $ be a continuous function such that $f: \mathbb{R} \to \mathbb{R}$. Prove that $\{x : f(x) = k\} $ is a closed subset of $\mathbb R$. Let $f $ be a continuous function such that $f: \mathbb{R} \to \mathbb{R}$ and $k\in \mathbb{R}$. Prove that $\{x : f(x) = k\} $ is a closed subset of $\mathbb R$.
$\{x : f(x) \neq k\} =\{x : f(x) < k\}\cup \{x : f(x) > k\}$
since $\{x : f(x) < k\}$ and $ \{x : f(x) > k\}$ are both open then $\{x : f(x) \neq k\} $ is open.
Then the complement of $\{x : f(x) \neq k\} $ i.e $\{x : f(x) = k\} $ is closed
Is this correct?

A: I believe your answer is correct.
More simply, you could have said $f^{-1}(k)$ is closed because $f$ is continuous and {$k$} is closed.
[A map of a metric space such as $\mathbb R$ to a metric space such as $\mathbb R$ is continuous
if and only if the inverse map of any closed (open) set is closed (respectively, open).]

A: It is correct if you really know that $\{x: f(x)<k\}$ and $\{x: f(x)>k\}$ are open. This is not absolutely trivial. I believe it would be a bit easier simply to prove that the set contains its closure. If $x_n\to x$ and $f(x_n)=k$ for all $n$ then by continuity $f(x)=k$ as well.


text:
Q: How to disable tslint for an unused import in Angular I've a small project. I wanted to create a production built for the same. I used this command:
ng build --prod
But it was throwing some build errors. So I asked my tech lead and she told me add this import:
import ResizeObserver from 'resize-observer-polyfill'
The build was successful after this but now the files are not passing linting test. Since the import is not used anywhere else in this code. I'm getting this error:

ERROR: C:/Users/320035648/Angular/pinc-insights-ui/src/app/app.module.ts:29:1 - All imports on this line are unused.
Lint errors found in the listed files.

So I added this line before the import:
/* tslint: disable: no-unused-variable */
But still I'm getting same error. Please help me.

A: If you are not using ResizeObserver, and so only using library import side-effects, why not simply importing the library this way:
import 'resize-observer-polyfill'


text:
Q: How can I get toggle to collapse? I have a working toggle function that expands and collapses but my list when expanded is very long and I wanted to put a "Close" link at the bottom to enable collapse so my users don't have to scroll to top to click and collapse. Any ideas how I can modify this code to expand it's functionality for my purposes?

my html looks like:

My Expanding/Collapsing Data

Content

if I insert the same link li at the bottom before the closing ul the user has to click it twice to collapse. I'd prefer a single click solution.

My Expanding/Collapsing Data

Content

Close

A:
My Expanding/Collapsing Data

Content

Close

An id should be used for a single element. Never ever use the same id for more elements.

A: If you use toggle() event on formxyz, the new close action will break the original rule, therefore sometimes you have to click formxyz twice to show content.
So use click() event with fadeToggle() action on formxyz. It will show content while it's hiding.
Then add a class on all "close", use parents method to find it's parents div (it should be the content div), then hide it.
The html:

My Expanding/Collapsing Data

Content

Close

The js file:
$(function(){
  $(".formname").click(function(){
    var id=$(this).attr('id');
    $("#form"+id).fadeToggle('slow').focus();
  });

  $(".closeform").click(function(){
    $(this).parents("div.content").fadeOut('slow');
  });
});

OR Check emulate code on jsFiddle. It's executable.


text:
Q: SQL Server 2008 R2 connection on a VmWare Instance Here is the scenario I am facing.

*

*I have installed Windows 7 Professional on a VMWare.

*Installed SQL Server 2008 R2.

When I launch the Server Management Studio and try to connect to the instance I get the following error

"A network-related or instance-specific error occurred while
  establishing a connection to SQL Server. The server was not found or
  was not accessible. Verify that the instance name is correct and that
  SQL Server is configured to allow remote connections. (provider: Named
  Pipes Provider, error: 40 - Could not open a connection to SQL Server)
  (Microsoft SQL Server, Error: 53)"

Now, I installed all the packages of SQL server with default settings. The only change that I had done is selected a mix-mode for authentication.
I setup a similar instance on a desktop and it works fine. Before posting it here I have searched on the web and made sure all the services, ports and protocols are enabled/running.
But I still cannot seem to connect, any help?

A: Ok, so finally found the solution the above mentioned problem. Not sure why, but when I give the instance name pre-appended with .\ it works fine.
.\<INSTANCENAME>

A: You may not have a default instance installed?
http://msdn.microsoft.com/en-us/library/ms143531.aspx


text:
Q: Magento 2.4: PayPal error when adding custom tax programmatically I am getting this error when I add custom tax amount programmatically:
PayPal gateway has rejected request. The totals of the cart item amounts do not match order amounts (#10413: Transaction refused because of an invalid argument. See additional error messages for details).
This is my code:
class Tax extends \Magento\Tax\Model\Sales\Total\Quote\Tax
{
  /**
    * Class constructor
    *
    * @param \Magento\Tax\Model\Config $taxConfig
    * @param \Magento\Tax\Api\TaxCalculationInterface $taxCalculationService
    * @param \Magento\Tax\Api\Data\QuoteDetailsInterfaceFactory $quoteDetailsDataObjectFactory
    * @param \Magento\Tax\Api\Data\QuoteDetailsItemInterfaceFactory $quoteDetailsItemDataObjectFactory
    * @param \Magento\Tax\Api\Data\TaxClassKeyInterfaceFactory $taxClassKeyDataObjectFactory
    * @param CustomerAddressFactory $customerAddressFactory
    * @param CustomerAddressRegionFactory $customerAddressRegionFactory
    * @param \Magento\Tax\Helper\Data $taxData
    */
    public function __construct(
        \Magento\Tax\Model\Config $taxConfig,
        \Magento\Tax\Api\TaxCalculationInterface $taxCalculationService,
        \Magento\Tax\Api\Data\QuoteDetailsInterfaceFactory $quoteDetailsDataObjectFactory,
        \Magento\Tax\Api\Data\QuoteDetailsItemInterfaceFactory $quoteDetailsItemDataObjectFactory,
        \Magento\Tax\Api\Data\TaxClassKeyInterfaceFactory $taxClassKeyDataObjectFactory,
        CustomerAddressFactory $customerAddressFactory,
        CustomerAddressRegionFactory $customerAddressRegionFactory,
        \Magento\Tax\Model\Calculation $taxCalculation,
        \Magento\Tax\Helper\Data $taxData,
        \Magento\Customer\Model\Session $session,
        \Magento\Customer\Model\Group $group
        ) {

        $this->setCode('tax');
        $this->taxCalculation = $taxCalculation;
        $this->session = $session;
        $this->group = $group;

        parent::__construct(
            $taxConfig,
            $taxCalculationService,
            $quoteDetailsDataObjectFactory,
            $quoteDetailsItemDataObjectFactory,
            $taxClassKeyDataObjectFactory,
            $customerAddressFactory,
            $customerAddressRegionFactory,
            $taxData
        );
    }

    /**
    * Custom Collect tax totals for quote address
    *
    * @param Quote $quote
    * @param ShippingAssignmentInterface $shippingAssignment
    * @param Address\Total $total
    * @return $this
    */
    public function collect(
        \Magento\Quote\Model\Quote $quote,
        \Magento\Quote\Api\Data\ShippingAssignmentInterface $shippingAssignment,
        \Magento\Quote\Model\Quote\Address\Total $total
    ) {
        parent::collect($quote, $shippingAssignment, $total);

        $taxamount = 0;
        $customerSession = $this->session;
        $customerGroup = $this->group;
        $customerGroupId = $customerSession->getCustomer()->getGroupId();
        $collection = $customerGroup->load($customerGroupId);
        $customerGroup = $collection->getCustomerGroupCode();
        $shippingAddress = $quote->getShippingAddress();
        $shippingMethod = $shippingAddress->getShippingMethod();

        if($shippingMethod == 'shqpickup1_collect'){

            foreach($quote->getAllVisibleItems() as $item) {

                // Tax Calculation
                $productTaxClassId = $item->getTaxClassId();

                $request = new \Magento\Framework\DataObject(
                    [
                        'country_id' => 'US',
                        'region_id' =>'43',
                        'postcode' => '10001',
                        'customer_class_id' => '3',
                        'product_class_id' => $productTaxClassId
                    ]
                );

                // Calculate tax
                $taxInfo = $this->taxCalculation->getResource()->getRateInfo($request);

                // Classify different taxes
                if (count($taxInfo['process']) > 0) {
                    foreach ($taxInfo['process'][0]['rates'] as $key => $rate) {
                        $itemPrice = $item->getQty() * $item->getPrice();
                        if($item->getDiscountAmount() > 0){
                            $itemPrice = ($item->getQty() * $item->getPrice())-$item->getDiscountAmount();
                        }
                        $taxamount += ($itemPrice * $rate['percent']) / 100;
                    }
                }
            }

            if($customerSession->isLoggedIn()){
                // Tax Exempt Customer
                if($customerGroup != 'Tax Exempt Customer'){
                    $total->setTaxAmount($taxamount);
                    $total->setBaseTaxAmount($taxamount);
                    $total->setTotalAmount($this->getCode(),$taxamount);
                    $total->setBaseTotalAmount($this->getCode(),$taxamount);
                }
            }else{
                $total->setTaxAmount($taxamount);
                $total->setBaseTaxAmount($taxamount);
                $total->setTotalAmount($this->getCode(),$taxamount);
                $total->setBaseTotalAmount($this->getCode(),$taxamount);
            }
        }

        return $this;
    }

}

Any help would be appreciated.


text:
Q: Derived categories and homotopy categories There are two constructions that look quite similar to me: the derived category of an abelian category, and the homotopy category of a model category. Is there any explicit relationship between these two constructions? (This question is related to, and indeed the inspiration for, one of my previous questions.)

A: Both give rise to derivators, and indeed thinking about homotopy theories as non-abelian derived categories is what led Grothendieck to introduce then (note that Heller and Franke independently came up with derivators, but I'm not sure they had the same motivation)

A: Unfortunately, it isn't quite right to say that derived categories of abelian categories are a special case of model categories. Morally this might be true, but for a general abelian category there is no known model category structure on its (unbounded) category of chain complexes whose weak equivalences are the quasi-isomorphisms. There is such a model structure when the abelian category is a Grothendieck category; this is shown in

*

*Mark Hovey -- Model category structures on chain complexes of sheaves (2001).

Quillen originally gave the example of a model structure on the category of non-negatively bounded complexes of R-modules, but the case of unbounded complexes of R-modules seems not to have appeared in print until the publication of Hovey's book

*

*Mark Hovey -- Model categories (1999).

As far as I'm aware, none of the standard references on model categories talk about unbounded derived categories of abelian categories---probably because in general they don't arise as the homotopy category of any known model structure on the category of chain complexes!

A: Yes. The former is a special case of the latter. There is a model category structure on the category of (say bounded) chain complexes of objects in your given abelian category. The weak equivalences are the quasi-isomorphisms, and the homotopy category is the derived category.
In the case of R-modules, for a ring R, this is explained in detail in
this paper by Dwyer-Spalinski.

A: Some information may be found at nLab: homotopy category. Following the links there you also find information on all the other keywords mentioned above.
Urs Schreiber

A: I think you don't want any bounded condition. I don't see how the category of chain complexes with bounded cohomology could be a model category. It doesn't have all small colimits; just take longer and longer chain complexes with trivial differentials, and you get something with unbounded cohomology.


text:
Q: OpenVpn issue with FTP traffic OpenVpn traffic counter stops to increase when downloading file via ftp.
At the beginning, when downloading file via ftp, everything is as expected, but when some portion of file is downloaded, openvpn counter stops to increase for the left amount of traffic.
All subsequent ftp downloads also do not change openvpn traffic counter.
After restarting openvpn connection the situation repeats again.
I have configured openvpn to route all traffic throug vpn. This is part of my configuration parameters:
client
dev tun

route-nopull
route 0.0.0.0 0.0.0.0
dhcp-option DNS 8.8.8.8
dhcp-option DNS 8.8.4.4

proto udp

redirect-gateway

The routing table looks fine and the tracert command to ftp server also goes through vpn. I really do not know why this happens for ftp, since for http it works as expected all the time.
UPDATE:
I use Windows 8.1 x64 as OS.
I get the traffic counters value via openvpn management interface by using --management ip port argument.
VPN server I use has api for getting traffic counters values. They also stop to increase when downloading ftp. I tested where packets go using wireshark, and all of them goes through openvpn during ftp download.

A: There is no traffic counter built into OpenVPN, so you must be using additional software to do the traffic counting.  You should probably provide more detail here.  (Where you are getting tthe traffic counter info from, the OS you are using etc)
FTP is a messy protocol.   I'd postulate that there is an issue related to connection tracking / NAT for the protocol, and that some traffic counting rule is being intercepted before the traffic is hitting the rules associated with OpenVPN.
The problem is almost certainly not related to the OpenVPN configuration, as traffic would not get through if it was wrong.


text:
Q: IE doesn't render  element if its left and width are large numbers I saw a strange rendering issue in IE.
When I set left of an element to a large negative value and width to a large positive value, IE (10) doesn't render the element at all, even though the element should be partial visible. I tried it in Firefox and it works fine. Part of the element is shown in Firefox.
My question is why it happens and what's the work around?
Below is the code to reproduce it
<!DOCTYPE html>

    <meta http-equiv="X-UA-Compatible" content="IE=Edge" />
    <meta charset="utf-8" />
    <meta http-equiv="Content-Type" content="text/html" />

A: IE max px values are 1342177.27px


text:
Q: CKEditor checkDirty() on source editing area Whenever one or more of my CKEditor WYSIWYG instances is changed, I give the corresponding textarea the attribute data-dirty="1", so my application knows it has changed.
I'm using the following snippet for this:
$('textarea.wysiwyg').ckeditor(ckeditor_config, function () {
    var call_once = false;
    this.on('change', function () {
        if (this.checkDirty()) {
            if (!call_once) {
                $(this.element).attr('data-dirty', 1);
                $('#edit_form').change();
            }
            call_once = true;
        }
    });
});

This works nicely, unless the user only edits the HTML via the Source Button. In such cases, checkDirty() does not seem to get fired.
Does anyone know how I can get this functionality working on both views of the editor? I am using the latest version of CKEditor (CKEditor 4.5.7), full edition, so the plugins are the latest versions aswel.
Thanks in advance.

A: As the documentation for the change event states:

Please note that the change event is only fired in the wysiwyg mode. In order to implement similar functionality in the source mode, you can listen for example to the key event or the native input event (not supported by Internet Explorer 8).

editor.on( 'mode', function() {
    if ( this.mode == 'source' ) {
        var editable = editor.editable();
        editable.attachListener( editable, 'input', function() {
            // Handle changes made in the source mode.
        } );
    }
} );

If you are using jQuery adapter and multiple editor instances in one page, you can try below:
        $( '#editor1' ).ckeditor( function(){ this.on( 'mode',
            function( evt ) {
                if ( this.mode == 'source' ) {
                    var editable = this.editable();
                    // Get the textarea
                    var element = $(this.element);
                    editable.attachListener( editable, 'input', function( ev ) {
                        // Handle changes made in the source mode.
                        console.log( ev );
                        // Set an attribute on the textarea for handling
                        element.attr('data-dirty',1);

                    } );
                }
            });
        });

The above is the callback function will be executed on a single editor instance but if you specify selector covering multiple editor instances e.g. .myeditor then listener will be attached to every editor instance created by this method.


text:
Q: Calculating energy using MATLAB Energy, which is as follows:

can be found based on the MATLAB documentation using:
stats = graycoprops(glcm, properties)

For example, I typed this:
>> a = [1 2; 3 4]

a =

     1     2
     3     4

>> stats = graycoprops(a, {'energy'})

stats =

    Energy: 0.3000

If we want to do this manually, how did we get the energy value shown above?
This is the part I didn't get clearly.

A: If I'm not wrong:
ans=sum(a(:).^2)/sum(a(:)).^2

A: In an energy network, there is a supply point (i) and a receiver point (j). If we follow this rule that the energy carried out between these two-point, then according to energy conservation law the total energy consumption at node "i" should be equal to total energy supplied from node "j". I called it energy flow due to the concept of sending to receiving points in an energy system.
Then,  "i" is the sender and the "j" is the receiver of the power we can write a summation of the inlet energy flow minus outlet energy flow (demand):
Total_Power = sum(Inlet_energy(:,:))-sum(Outlet_energy(:,:));
print (Total_Power);


text:
Q: ownCloud 10.0.7 failed to connect to the database Date: April 2018 - Google Cloud Platform - Deploy a predesigned solution (Marketplace) - ownCloud Certified by Bitnami
Running correct (It was not modified, since the initial installation)
Date: May 08, 2019:

Exception occurred while logging exception: Failed to connect to the database: An exception occured in driver: SQLSTATE[HY000] [2002] Connection refused
#0 /opt/bitnami/apps/owncloud/htdocs/lib/composer/doctrine/dbal/lib/Doctrine/DBAL/Connection.php(429): OC\DB\Connection->connect()
#1 /opt/bitnami/apps/owncloud/htdocs/lib/composer/doctrine/dbal/lib/Doctrine/DBAL/Connection.php(389): Doctrine\DBAL\Connection->getDatabasePlatformVersion()
#2 /opt/bitnami/apps/owncloud/htdocs/lib/composer/doctrine/dbal/lib/Doctrine/DBAL/Connection.php(328): Doctrine\DBAL\Connection->detectDatabasePlatform()
#3 /opt/bitnami/apps/owncloud/htdocs/lib/composer/doctrine/dbal/lib/Doctrine/DBAL/Connection.php(623): Doctrine\DBAL\Connection->getDatabasePlatform()
#4 /opt/bitnami/apps/owncloud/htdocs/lib/private/DB/Connection.php(145): Doctrine\DBAL\Connection->setTransactionIsolation(2)
#5 /opt/bitnami/apps/owncloud/htdocs/lib/composer/doctrine/dbal/lib/Doctrine/DBAL/DriverManager.php(172): OC\DB\Connection->__construct(Array, Object(Doctrine\DBAL\Driver\PDOMySql\Driver), Object(Doctrine\DBAL\Configuration), Object(Doctrine\Common\EventManager))
#6 /opt/bitnami/apps/owncloud/htdocs/lib/private/DB/ConnectionFactory.php(145): Doctrine\DBAL\DriverManager::getConnection(Array, Object(Doctrine\DBAL\Configuration), Object(Doctrine\Common\EventManager))
#7 /opt/bitnami/apps/owncloud/htdocs/lib/private/Server.php(493): OC\DB\ConnectionFactory->getConnection('mysql', Array)
#8 /opt/bitnami/apps/owncloud/htdocs/lib/composer/pimple/pimple/src/Pimple/Container.php(113): OC\Server->OC{closure}(Object(OC\Server))
#9 /opt/bitnami/apps/owncloud/htdocs/lib/private/AppFramework/Utility/SimpleContainer.php(111): Pimple\Container->offsetGet('DatabaseConnect…')
#10 /opt/bitnami/apps/owncloud/htdocs/lib/private/ServerContainer.php(87): OC\AppFramework\Utility\SimpleContainer->query('DatabaseConnect…')
#11 /opt/bitnami/apps/owncloud/htdocs/lib/private/Server.php(1160): OC\ServerContainer->query('DatabaseConnect…')
#12 /opt/bitnami/apps/owncloud/htdocs/lib/private/Server.php(370): OC\Server->getDatabaseConnection()
#13 /opt/bitnami/apps/owncloud/htdocs/lib/composer/pimple/pimple/src/Pimple/Container.php(113): OC\Server->OC{closure}(Object(OC\Server))
#14 /opt/bitnami/apps/owncloud/htdocs/lib/private/AppFramework/Utility/SimpleContainer.php(111): Pimple\Container->offsetGet('AppConfig')
#15 /opt/bitnami/apps/owncloud/htdocs/lib/private/ServerContainer.php(87): OC\AppFramework\Utility\SimpleContainer->query('AppConfig')
#16 /opt/bitnami/apps/owncloud/htdocs/lib/private/Server.php(1089): OC\ServerContainer->query('AppConfig')
#17 /opt/bitnami/apps/owncloud/htdocs/lib/private/Server.php(547): OC\Server->getAppConfig()
#18 /opt/bitnami/apps/owncloud/htdocs/lib/composer/pimple/pimple/src/Pimple/Container.php(113): OC\Server->OC{closure}(Object(OC\Server))
#19 /opt/bitnami/apps/owncloud/htdocs/lib/private/AppFramework/Utility/SimpleContainer.php(111): Pimple\Container->offsetGet('AppManager')
#20 /opt/bitnami/apps/owncloud/htdocs/lib/private/ServerContainer.php(87): OC\AppFramework\Utility\SimpleContainer->query('AppManager')
#21 /opt/bitnami/apps/owncloud/htdocs/lib/private/Server.php(1359): OC\ServerContainer->query('AppManager')
#22 /opt/bitnami/apps/owncloud/htdocs/lib/private/legacy/app.php(346): OC\Server->getAppManager()
#23 /opt/bitnami/apps/owncloud/htdocs/lib/private/legacy/app.php(110): OC_App::getEnabledApps()
#24 /opt/bitnami/apps/owncloud/htdocs/lib/base.php(579): OC_App::loadApps(Array)
#25 /opt/bitnami/apps/owncloud/htdocs/lib/base.php(998): OC::init()
#26 /opt/bitnami/apps/owncloud/htdocs/index.php(54): require_once('/opt/bitnami/ap…')
#27 {main}

Server configuration:
Operating system:
Debian (9)
Web server:
Apache (2.4.29)
Database:
MySQL (5.7.21)
PHP version:
PHP (7.0.28)
ownCloud version: (see ownCloud admin page)
ownCloud (10.0.7)
The content of config/config.php:
    $CONFIG = array ( 'passwordsalt' => '#####',
    'secret' => '########',
    'trusted_domains' => array ( 0 => '127.0.0.1', 1 => '35.194.21.102', 2 => '####.org', ),
    'datadirectory' => '/opt/bitnami/apps/owncloud/data',
    'overwrite.cli.url' => 'http://localhost',
    'dbtype' => 'mysql',
    'version' => '10.0.7.2',
    'dbname' => 'b######',
    'dbhost' => '127.0.0.1:/opt/bitnami/mysql/tmp/mysql.sock',
    'dbtableprefix' => 'oc',
    'mysql.utf8mb4' => true,
    'dbuser' => 'b#_####',
    'dbpassword' => '#####',
    'logtimezone' => 'UTC',
    'installed' => true,
    'instanceid' => '#####',
    'openssl' => array ( 'config' => '/opt/bitnami/common/openssl/openssl.cnf', ),

A: I had similar problems when I used Owncloud in the past. It often crashed the database. The issues went away for me when I switched to Nextcloud. I hope this helps.


text:
Q: SQL Server: replace multiple occurrences of a word with one I have a SQL Server table with a column Event which contains values like this:
[Event]
----------------------------------------
Payment stopped, Claim, Claim, Claim
Claim
Claim, Claim, Claim
Claim, Claim, Payment stopped, Case Closed

Now the user wants to view this column which has the summary count of the word 'Claim', so that the below column would look like
[Event]
-------------------------------------
Payment stopped, 3 Claims
Claim
3 Claims
2 Claims, Payment stopped, Case Closed

The word 'Claim' could present up to 400 times, they don't mind keeping the count in the starting of the value (3 Claims, Payment stopped), or end of the value (Payment stopped, 3 Claims). I have an udf that could get the count of this word, but removing the commas, spaces seems really difficult.
Is there a way to do this (with or without udf)? I am using SQL Server 2008.

A: First you need to split the items by id using split function and get the count of each item. After that we need to conctenate the result. Below is the query with sample data.
declare @myevent table(id int identity,name varchar(max));

insert into @myevent select 'Payment stopped, Claim, Claim, Claim';
insert into @myevent select 'Claim';
insert into @myevent select 'Claim, Claim, Claim';
insert into @myevent select 'Claim, Claim, Payment stopped, Case Closed';

with cte as(
    select id,cast(count(item) over(partition by id,ltrim(rtrim(item))) as varchar(5)) + ' ' + ltrim(rtrim(item)) Item
    from @myevent
        cross apply dbo.Split(name,',')
)
,cte1 as(
    select distinct id,item
    from cte
)
select distinct id
        ,substring((select ','+item
                    from cte1 c1
                    where c1.id = c2.id
                    order by id
                    for xml path('')
                    )
                    , 2, 1000
                ) [result]
from cte1 c2

Below is the Split Function
CREATE FUNCTION [dbo].[Split] (
      @InputString VARCHAR(8000),
      @Delimiter VARCHAR(50)
)

RETURNS @Items TABLE (
      Item VARCHAR(8000)
)

AS
BEGIN
      IF @Delimiter = ' '
      BEGIN
            SET @Delimiter = ','
            SET @InputString = REPLACE(@InputString, ' ', @Delimiter)
      END

      IF (@Delimiter IS NULL OR @Delimiter = '')
            SET @Delimiter = ','

      DECLARE @Item VARCHAR(8000)
      DECLARE @ItemList VARCHAR(8000)
      DECLARE @DelimIndex INT

      SET @ItemList = @InputString
      SET @DelimIndex = CHARINDEX(@Delimiter, @ItemList, 0)
      WHILE (@DelimIndex != 0)
      BEGIN
            SET @Item = SUBSTRING(@ItemList, 0, @DelimIndex)
            INSERT INTO @Items VALUES (@Item)

            -- Set @ItemList = @ItemList minus one less item
            SET @ItemList = SUBSTRING(@ItemList, @DelimIndex+1, LEN(@ItemList)-@DelimIndex)
            SET @DelimIndex = CHARINDEX(@Delimiter, @ItemList, 0)
      END -- End WHILE

      IF @Item IS NOT NULL -- At least one delimiter was encountered in @InputString
      BEGIN
            SET @Item = @ItemList
            INSERT INTO @Items VALUES (@Item)
      END

      -- No delimiters were encountered in @InputString, so just return @InputString
      ELSE INSERT INTO @Items VALUES (@InputString)

      RETURN

END -- End Function

output
id  result
1   1 Payment stopped,3 Claim
2   1 Claim
3   3 Claim
4   1 Case Closed,1 Payment stopped,2 Claim,2 Claim

A: Try the below script
DECLARE @V_WORD NVARCHAR(10)    =   'Claim'

DECLARE @TABLE  TABLE
(   [Event] NVARCHAR(MAX))

INSERT INTO @TABLE
VALUES('Payment stopped, Claim, Claim, Claim'),('Claim'),('Claim, Claim, Claim'),('Claim, Claim, Payment stopped, Case Closed')

;WITH CTE
AS  (
        SELECT  [Event]
                ,CHARINDEX(@V_WORD,[Event],0)   [stpos]
                ,(LEN([Event]) - LEN(REPLACE([Event],@V_WORD,''))) / LEN(@V_WORD)   AS  [ECount]
        FROM    @TABLE
)

SELECT  REPLACE([Event]
                ,SUBSTRING([Event],[stpos],([ECount] * LEN(@V_WORD)) + (([ECount]-1) * 2))
                ,CAST([ECount] AS NVARCHAR) +' Claim' +
                    (CASE WHEN [ECount] > 1 THEN 's' ELSE '' END)
                )   [Result]
FROM    CTE

Result:
Payment stopped, 3 Claims
1 Claim
3 Claims
2 Claims, Payment stopped, Case Closed

A: I agree with the other commenters that you should really look at your import processes and data schema to hold all the different events as individual table rows.
If this is not possible however, you can do the required manipulation relatively simply, without the use of ctes or additional functions.  Be mindful that this will not work for anything other than the word Claim, as that is all that has been asked for in your question:
declare @Event table(Event nvarchar(500));
insert into @Event values
 ('Payment stopped, Claim, Claim, Claim')
,('Claim')
,('Claim, Claim, Claim')
,('Claim, Claim, Payment stopped, Case Closed')
,('Payment stopped, Case Closed');

select Event
        ,case (len(Event) - len(replace(Event,'Claim','')))/5
                    when 0 then ''
                    when 1 then '1 Claim' + case when len(replace(Event,'Claim','')) > 0 then ', ' else '' end
                    else cast((len(Event) - len(replace(Event,'Claim','')))/5 as nvarchar(5)) + ' Claims' + case when len(replace(Event,'Claim','')) > 0 then ', ' else '' end
                 end
            + case when len(replace(Event,'Claim','')) > 0
                    then replace(replace(replace(Event,', Claim',''),'Claim, ',''),'Claim','')
                    else ''
                    end as Result
from @Event;

Output:
Event                                       | Result
````````````````````````````````````````````|````````````````````````````````````````
Payment stopped, Claim, Claim, Claim        | 3 Claims, Payment stopped
Claim                                       | 1 Claim
Claim, Claim, Claim                         | 3 Claims,
Claim, Claim, Payment stopped, Case Closed  | 2 Claims, Payment stopped, Case Closed
Payment stopped, Case Closed                | Payment stopped, Case Closed

A: One more way is scalar function for doing this.
Schema from your Question.
CREATE TABLE #Event (EVENT_LIST VARCHAR(MAX))

INSERT INTO #Event
SELECT 'Payment stopped, Claim, Claim, Claim'
UNION ALL
SELECT 'Claim'
UNION ALL
SELECT 'Claim, Claim, Claim'
UNION ALL
SELECT 'Claim, Claim, Payment stopped, Case Closed'

You need to do count of each word for every record. So need to create a Function which will execute per row once and gives result.
Function with Logic:
CREATE FUNCTION [dbo].FN_REPEAT_COUNT(@VAR VARCHAR(MAX))
RETURNS VARCHAR(MAX)
AS
BEGIN

 SET @VAR=@VAR+','
;WITH CTE AS  --Recursive CTE for calculating ',' indexes
(
    SELECT 1 INDX_FRM
    , LEN(@VAR) LEN_VAR
    , CHARINDEX(',',@VAR)+1 AS INDX_TO

    UNION ALL

    SELECT CAST(INDX_TO+1 AS INT)
    , LEN_VAR
    , CHARINDEX(',',SUBSTRING(@VAR,INDX_TO+1,LEN_VAR))+INDX_TO+1

    FROM CTE WHERE INDX_TO<LEN_VAR
)
,CTE2 AS(    --cte to generate records based on ',' index
SELECT  SUBSTRING(@VAR,INDX_FRM,INDX_TO-INDX_FRM-1 ) AS LIST FROM CTE
)
,CTE3 AS (  --cte for count of word Claim and making them back to column
SELECT (
        SELECT CAST(COUNT(CASE
                        WHEN LIST = 'Claim'
                            THEN 1
                        ELSE NULL
                        END) AS VARCHAR(2)) + ' ' + LIST + ','
        FROM CTE2
        GROUP BY LIST
        FOR XML PATH('')
        ) COUNTED

)
--Removing 0 and replacing ',' with Empty String
SELECT @VAR = REPLACE( SUBSTRING(COUNTED,1,LEN(COUNTED)-1),'0','') FROM CTE3
RETURN @VAR
END

And now just call the Scalar function on your column like below
SELECT *, dbo.FN_REPEAT_COUNT(EVENT_LIST) AS FN_RES FROM #Event

And the Output is
╔════════════════════════════════════════════╦═══════════════════════════════════════╗
║                 EVENT_LIST                 ║                FN_RES                 ║
╠════════════════════════════════════════════╬═══════════════════════════════════════╣
║ Payment stopped, Claim, Claim, Claim       ║ 3 Claim, Payment stopped              ║
║ Claim                                      ║ 1 Claim                               ║
║ Claim, Claim, Claim                        ║ 3 Claim                               ║
║ Claim, Claim, Payment stopped, Case Closed ║  Case Closed,2 Claim, Payment stopped ║
╚════════════════════════════════════════════╩═══════════════════════════════════════╝


text:
Q: How to delete a commit after "sharing a new project using SVN" Eclipse I want to synchronize my existing project with the same in SVN, so I make

*

*Team-> Share Project,

*enter my SVN repository url

*in the last dialog window, SVN ask me to enter commit body

*press OK.

(the same steps as here -> https://eclipse.org/subversive/documentation/teamSupport/sharing_wiz.php )
How to roll-back this commit? I don't see this commit in Team -> Show History

A: You cannot remove a commit from history, but it is pretty easy to undo the effects of the commit.  Here are a couple of blog posts I have written in the past that explain how to do it:
Second Chances and Subversion
How to Undo a Commit in Subversion
The second of those in particular show how to do it via Subclipse GUI (as it existed back in 2007).


text:
Q: Word 2013 - captions will not be update I have copied a section of text, which contains figures and tables, from another Word 2013 document into a new template document from an older version of Word. For some reason the table and figure numbers will not update with F9. When you right click on a caption 'update field' is blocked out. They are still recognised as fields and will update if you right click on them individually, select 'edit field', and then click ok (without making any change to the field code etc.). However, the associated cross-references do not update. This is the case regardless of whether the new document is in compatibility mode or converted to Word 2013. I would really like some advice so that I don't have to manually update all of these numbers and cross references.

A: Hi Maybe not a solution but a workaround.
Save the old file into the latest version and copy from that latest version.
It should work.