text:
Q: When does causal separation imply no spacelike separation? (See here for notation.) In Minkowski space, if $p\prec q$, then there is no spacelike curve $c:[0,1]\to \mathbb{R}^{n-1,1}$ with $c(0)=p$ and $c(1)=q$. This is obvious from a spacetime diagram. Here a "spacelike curve" is a $C^1$ mapping from a nondegenerate inverval into a Lorentzian manifold with everywhere spacelike tangent vector.
Take the cylinder $M=S^1\times\mathbb{R}$ with the Lorentzian metric $\mathrm{d}s^2=-\mathrm{d}\theta^2+\mathrm{d}t^2$. This spacetime is not causal, the circles $t=\mathrm{const.}$ are closed timelike curves. Let $\Sigma$ be a "surface" of constant $\theta$. It is clear that if $p,q\in\Sigma$, then there exists a spacelike curve $c$ connecting the two. But if they are close enough, then there exists a timelike curve $\lambda$ connecting the two as well. So $p\prec q$ (or the other way around). Thus the above result for Minkowski space does not apply to all spacetimes.
Thus my question is: what are the necessary and sufficient conditions on the spacetime topology and metric so that $p\prec q$ $\implies$ there exists no spacelike curve connecting $p$ and $q$?
Some observations: $J^+(p)\neq M$ for any $p$ is necessary. (Otherwise $p\prec q$ for all $q\in M$, in particular those connected to $p$ by a spacelike curve.) So $M$ should be causal, and probably even strongly causal. Perhaps one can reverse the question: if $p,q$ can be connected by a spacelike curve, what are the conditions for which $p\not\prec q$? Then, suppose $p$ and $q$ are contained in a Cauchy surface. There is a spacelike curve connecting them, but they cannot be connected by a causal curve because a causal curve intersects a Cauchy surface once.

A: There exist no necessary and sufficient conditions on the topology and the metric that guarantee that when $p$ is in the causal past of $q$ then there exists no spacelike curve between the two events.
Why? Because there exists two Lorentzian manifolds, both with a Minkowski metric, and both with the same topology, one which has the property you desire and one which does not.
For the topology of the manifold, each manifold can have the topology of the cylinder: $\mathbb S\times \mathbb R.$
One manifold can literally be $$\{(a,b,c):a^2+b^2=1,c\in[0,10]\},$$ with time going around in the circular direction and space going in the direction of length ten.
The other manifold can be the same manifold but excluding the points $$\{(1,0,c):c\geq 0.01\},$$ and the points $$\{(0,1,c):c\leq 9.99\},$$ with time going around in the circular direction and space going in the direction of length ten.
The topology of the second manifold equals the topology of the first (cutting a finite slit out of a manifold, starting at an edge, doesn't change the topology). And the topology of the first is the same as the topology of the cylinder ($\mathbb S\times \mathbb R$).
So if someone told you your topology was $\mathbb S\times \mathbb R$ and told you that your metric was Minkowski, then you might have the first one, or you might have the second (or something else). And the first one does not have the property you want (the causal future of any event is the whole manifold), and the second one does.
So knowing the metric and knowing the topology simply isn't enough information.

A: The canonical Lorentzian cylinder $(R × S^1 , g = −dt^2 + dθ^2 )$  is globally hyperbolic and you can find points that can be joined causally and also with a spacelike curve. For example, take a null geodesic that join $p,q$ and notice that you can find always a spacelike curve by taking the helix that join these points.
See Fig. 13
Therefore any causal condition from the hierarchy can not be a sufficient condition such that $p\prec q$ implies that $p,q$ can not be join by a spacelike curve.
On the other hand if $p,q$ belong to a Cauchy surface, by definition a Cauchy surface is acausal, $p\not\prec q$
There is an interesting paper about how to determine a cauchy surface from intrinsic properties.

A: In any spacetime (even Minkowski) of dimension $n\ge 3$ any two causally related events are connected by a spacelike curve. The idea is as follows.  Connect $p$ and $q$ with a causal curve $\sigma$. Take a metric mith slightly larger cones $g'>g$, so that $\sigma$ becomes $g'$-timelike. Now there is a $g'$-lightlike curve (hence $g$-spacelike) which connects $p$ to $q$, it is obtained as an helix winding over a cylinder with axis $\sigma$.


text:
Q: Kotlin channel.receive() does not timeout when used in withTimeout() block I want channel.receive() to timeout to do some other stuff when the channel does not receive a message after a specific time.
I have tried using a withTimeout() block but it actually does not timeout.
val incomingNotification = withTimeout(1000L) {
    (session.outgoing as Channel<Frame>).receive()
}

Could it be that receive() is actually not cancelable?
What am i doing wrong?

redpajama_set_name: RedPajamaStackExchange


text:
Q: How reference data in returned promise How do I access the data array in the Promise.Object.collection?

A: Basically you have everything. All you need to do is to set the return on each if and itacate over a map, each item of the map is an object of collection
function fetchRequests (){
....
}).then(responde => response.json())
.then(responde => {
    const { result, collection } = response;
   If (result==="success") {
      return collection.map(item => new Person(item))
   }
})

You need to create a new class of the object your getting on the collection
class Perdon {

    constructor (data) {
        Object.assign(this, data);
   }
}

Where ever you call your method fetchRequests
async function funcCaller () {
   const people = await fetchRequests();
   // people have your collection
}


text:
Q: Not able to change right navigation button title I set up a right navigation button like so inviewWillAppear in . a class ChatMessageViewController..
let button2 = UIBarButtonItem(image: nil, style: .plain, target: self, action: #selector(blockPressed(sender:)))
button2.title = "Block"
self.navigationItem.rightBarButtonItem = button2

Now on the click of blockPressed another shared function is called like so...
@objc fileprivate func blockPressed(sender: UIButton) {
    XMPPConfig.shared.blockUser(userJID: theUserJID!) //XMPPConfig is another class having some common functions and delegate methods.

  }

(This function basically blocks a certain user like blocking a whatsapp user. Once blocking happens, certain delegate methods are called. One such delegate method after which I change the Block button is given as follows..)
func xmppBlocking(_ sender: XMPPBlocking!, didBlockJID xmppJID: XMPPJID!) {
    print("successfully blocked!")

    ChatMessageViewController.shared.setupUnBlock()

  }

Doing this also properly calls setupUnBlock() function in ChatMessageViewController like so...
func setupUnBlock() {

    if XMPPConfig.shared.sectionGroupsFlag == false {
      let button2 = UIBarButtonItem(image: nil, style: .plain, target: self, action: #selector(unblockPressed(sender:)))
      button2.title = "Unblock"
      self.navigationItem.rightBarButtonItem = button2
    }
  }

But the button title still remains unchanged...i.e. it is still "Block"..what could be the reason for this...?

A: You should initialize your UINavigationBarButton using another initializer:
let right = UIBarButtonItem(title: "Some title", style: .plain, target: self, action: #selector(rightNavBarButtonPressed))

You are using UIBarButtonItem(image:... instead.

A: I tried to duplicate your code and apparently everything works.
So, the problem may be due to three possible problems, as far as i can see.

*

*it may be thread problem. This is unlikley unless you have not turned on the thread checker in xcode.. But inside both unblock and block codes, enter
print(Thread.current)
to see both blocks of codes in setting the rightbarButton is in main thread. If not, you should know how to solve them.

*It may be view update problem, unlikely still, but worth a try.. So in your block of codes where you are adding rightBarButton, add one more line of code.
self.navigationController?.viewIfLoaded?.setNeedsLayout()
to update the navigationController's view after you have set the rightBarButtonItem.

*The most likely problem in my opinion is that, you have been doubling calling block barButtonItem codes. This means when you have called unblock barButtonItem setup codes, you accidentally called the block barButtonItem too.

To debug this is easy, you just put a statement in each of block of the codes, to see if they appear together.


text:
Q: Visualising a linear model using effects package in R I have ran this model in R:
model <- lm(mpg ~ hp + drat + disp, data=mtcars)

And I have visualised this model using effects package in R:
library(effects)
model_effects <- effect("hp", model, list(drat=mean(mtcars$drat), disp = mean(mtcars$disp)))
plot(model_effects)

I believe this plot shows the relationship between mpg and hp whilst holding drat and disp constant at their mean values. Could somebody confirm this is what the plot is doing?


text:
Q: wpf Stop ctrl+Alt+del and windows button using C# how to disable ctrl+Alt+del and windows button using C# with wpf ??
I tried to use some events form events like key down but fail.

A: It isn't possible to disable the shortcut for Ctrl-Alt-Del specifically,
this is because the Ctrl-Alt-Del combo is a deeply baked system call.
However it is possible to filter them separately, so you can prevent the other shortcuts with these keys.
To do this you need to hook into the OS events:

this hooks onto the system events.
private delegate IntPtr LowLevelKeyboardProc(int nCode, IntPtr wParam, IntPtr lParam);
[DllImport("user32.dll", CharSet = CharSet.Auto, SetLastError = true)]
private static extern IntPtr SetWindowsHookEx(int id, LowLevelKeyboardProc callback, IntPtr hMod, uint dwThreadId);

if you set the id to 13 it will hook onto the keyboard inputs.

in the callback you need several things:
[StructLayout(LayoutKind.Sequential)]
private struct KBDLLHOOKSTRUCT
{
    public readonly Keys key;
    private readonly int scanCode;
    private readonly int flags;
    private readonly int time;
    private readonly IntPtr extra;
}

this struct is required to read the actual keys in c#.
this can be used by giving the delegate a function like:
private static IntPtr CaptureKey(int nCode, IntPtr wp, IntPtr lp)
{
    if (nCode < 0) return (IntPtr) 1; //CallNextHookEx(_ptrHook, nCode, wp, lp);
    KBDLLHOOKSTRUCT objKeyInfo = (KBDLLHOOKSTRUCT)Marshal.PtrToStructure(lp, typeof(KBDLLHOOKSTRUCT));
    if(objKeyInfo.key == /*some key*/){
        // do something
    }
}

when using this you can get the key from objKeyInfo.key
for more background info about the Ctrl-Alt-Del combo:
Is there any method to disable logoff,lock and taskmanager in ctrl+alt+del in C#

A: Tamas Piros wrote a nice article on that subject
http://tamas.io/c-disable-ctrl-alt-del-alt-tab-alt-f4-start-menu-and-so-on/
Should work in WPF too


text:
Q: Import statement works on PyCharm but not from terminal PyCharm 2016.2.3, Mac OS X 10.11.1, Python 3.5 (Homebrew);
I have this folder structure
project
  /somepackage
    /subpackage
     __init__.py
     bar.py
   __init__.py
   foo.py

foo.py:
import somepackage.subpackage.bar
print("foo")

bar.py:
print("bar")

So my expected output is
bar
foo

This works fine when run from PyCharm. However, when I run it from my terminal I get an ImportError:
$ pwd
$ /home/project (not the actual path; just omitting some personal stuff)
$ python3.5 somepackage/foo.py
File "foo.py", line 1, in <module>
import somepackage.subpackage.bar
ImportError: No module named 'somepackage'

I have found this question, which is about the same problem. However, none of the suggested solutions work for me, as I am indeed using the same Python interpreter as PyCharm does and I am currently in the folder that contains the /somepackage folder.
Does anyone have any other suggestions about how to solve this issue?

A: Setting PYTHONPATH is what makes it work, as noted above. I use the following VSCODE .env content so that it works for any project:
PYTHONPATH=${PROJ_DIR}:${PYTHONPATH}

This is essentially what PyCharm does when you check "Add Content Roots to PYTHONPATH" in your run/debug configuration. It's a helpful setting, but it spoils you because your code fails outside PyCharm.
Or, if you run in terminal, first export:
export PYTHONPATH=...

Took me days to work all this out.

A: i solved my problem by two steps on Linux:

*

*first step
go to the root directory of your project and set:

export PYTHONPATH=$PATHONPATH:`pwd`

*second step
run python3 -m somepackage.foo
remember Without '.py' suffix

A: You are running foo.py like a script, but you are really using it like a module. So the proper solution is to run it as a module:
python3 -m somepackage.foo

For the record, another alternative is to edit your path like:
export PYTHONPATH=.

(Or you could put the absolute directory in there, and of course you should append any other directories that are already in your PYTHONPATH.) This is closer to what PyCharm does, but is less philosophically correct.

A: I just had the same problem using scapy.layers.http Module,
this problem occurred on my Kali (linux-Debian) but run fine on Win-10 (after few modifications.)
packet was installed (scapy-http) correctly  and the program was running in PyCharm but not as script (from terminal)
I tried solving it with reinstalling in main root, and messing with the sys.path but None have worked.
Troubleshoot & Solution

*

*I found that it looks for the http module in:
/usr/local/lib/python3.7/dist-packages/scapy/layers/init.py
and got the ImportError:
from scapy.layers import http --->
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: cannot import name 'http' from 'scapy.layers' (/usr/local/lib/python3.7/dist-packages/scapy/layers/__init__.py)

*So then I checked where scapy-http is really installed, which is module called  http.py, so I just copied it to:
 /usr/local/lib/python3.7/dist-packages/scapy/layers/

  found the http.py file in :/usr/local/lib/python3.7/dist-packages/scapy_http/

And that did it :)!
I know its a bit glitchie but that worked!


text:
Q: Certain external Images (google drive) not caching on iOS Mobile Safari Demo:
http://c.atara.net/simple.html
When You click Show 1 and Show 2 on a Desktop Browser the background changes immediately, because I assume, the images are already loaded on the page (cached)
However on an iPad or iPhone, the images don't seem to cache .The background turns white first and there is a pause while each image loads. I think this may have something to do with the images being hosted on Google Drive (they are redirected?).
Can anyone come up with any way to get the images to cache on the mobile browser? I can't host them anywhere else.
I am looking for any solution no matter how crazy-- such as if theres a javascript way to turn the images into base64 and then cache that.
Here is the revelant code


text:
Q: Bash find where the current execution is located I have a shell program in a directory (ie dir1/dothis.sh) - works fine when I cd to that directory and ./dothis.sh
if I created a ln to that directoy  with a new name - dir2 and do dir2/dothis.sh
it would execute but it thinks the current execution path is the new dir where dir2 is pointing to at
in dothis.sh - how do I find where dothis.sh actually located?  The problem I have is that the dir1/dothis.sh can be relocated from system to system so there is no warranty where dir1/dothis.sh can be hard code

A: Use the bash built-in
#!/bin/bash
echo "Current path: $PWD"

A: try this:
#!/bin/bash
echo $0
a=`pwd`
echo $a
b=$a"/"$0
echo `dirname $b`

A: How about
dirname $(readlink -f $0)

It will also resolve symbolic link if any...


text:
Q: MVC Razor Form submit not working I am trying to use a simple form to allow authorized users to modify content on select pages on an MVC3 Razor site that I'm building.  I am unable to get the edit form to post correctly though.
My model is as follows:
public class WebContent
{
    public virtual UInt32 id { get; set; }
    public virtual String page { get; set; }
    public virtual String section { get; set; }

    [UIHint("tinymce_jquery_full"), AllowHtml]
    public virtual String content { get; set; }
}

My Controller:
    [Authorize]
    public ActionResult Edit(String page, String section)
    {
        WebContent content = _WebContent.GetSection(page,section);
        return View(content);
    }

    [Authorize]
    [HttpPost]
    public ActionResult Edit(WebContent content)
    {
        if (ModelState.IsValid)
        {
            _WebContent.Update(content);
            return View("Index");
        }
        else return View("Index");
    }

And my View:
@model SongbirdsStudios.Models.WebContent
@{
  ViewBag.Title = "Edit '"+Model.page+"'Page Content";
}

Edit

@using (Html.BeginForm())
{

    <fieldset>
        <legend>Page Content</legend>
        @Html.HiddenFor(m => m.id)
        @Html.HiddenFor(m => m.page)
        @Html.HiddenFor(m => m.section)

            Content

            @Html.EditorFor(m => m.content)

            <input type="submit" value="Update" />

    </fieldset>
}

The view renders correctly and displays the expected elements.  The UIHint("tinymce_jquery_full") is getting picked up correctly and the TinyMCE editor appears on the page.  But, when the form submits, I get an exception.
System.Web.HttpRequestValidationException: A potentially dangerous Request.Form value was detected from the client (content=...)

Everything I've read indicates that the AllowHTML attribute should allow this to post, but it's not for some reason.
I can get around this by adding the [ValidateInput(false)] attribute to the HttpPost controller method. If I do that, then this exception does not occur, but the model still does not get passed to the controller.  It just passes null instead.  Examining the HttpContext in the debugger indicates that it is passing 4 separate values - one for each property in my model instead of passing the model class back to the controller.  I can't figure out what I need to change to make this work correctly.
I'm hoping it's something simple that I missed, and someone with a better eye can see what it is.

A: So after further investigation into how ASP MVC maps form fields to the model class and examining the HTML emitted to the browser, I found that this was an issue with the name of the property in my WebContent class.
public virtual String content { get; set; }

The TinyMCE editor uses a content variable to define certain characteristics associated with the editor interface.  This was apparently causing the HTML 'content' generated by the user input in the editor to not get mapped back to the Model property.
Simply changing the name of the property in the model class (and of course fixing the corresponding database mapping and view references) immediately fixed the problem.
public virtual String web_data_content { get; set; }

Everything else being identical, this worked perfectly with the UIHint and AllowHTML attributes.

A: Add this attribute on your action
[ValidateInput(false)]

This should solve your problem

A: if you use ie7
this may has some err
<input type="submit" value="Update" />

give the button a name


text:
Q: request parameters from jsp in java without using servlets I want to request parameters in a java file from a jsp without using servlets. Does anyone know how to do this? I believe its something to do with setting an attribute but I'm new to java so its all a learning game from me. I want to send the lotsize and bedrooms parameters to the java file. My jsp file is shown below and i need to know what to put in my java file in order to retrieve these parameters

A: Create a JSP file as shown below. Also Create a java file com.test.Room and pass the value to the Class
<%@ page import = "com.test.Room"%>

<%
   String bedRooms = request.getParameter("bedrooms");
   String lotSize = request.getParameter("lotSize");
%>

bedrooms
       <%=bedRooms%>

lotsize
       <%=lotSize%>

<%
   Room room = new Room(bedRooms, lotSize);
   //Other logic, if any
%>


text:
Q: Module not detected in python3 but works in python2 I installed a python package which has below dir structure.
pkg_name/
  __init__.py
  work.py
  helper.py

In work.py, an import is done as below -
from helper import MyClass

It works fine in python2.7 virtual env but gives below error in python3 venv

ModuleNotFoundError: No module named 'helper'

I modified the work.py import statement by adding "." as below and then it works fine in python3.
from .helper import MyClass

Question - Is there a way to make it run in python3 without modifying package files? (Or the package is published keeping just python2 in mind)
EDIT: Adding __init__.py content below
from .work import Sample
from .helper import MyClass

A: I think you run out of luck. The documentation of Python 3 states:

Relative imports use leading dots. A single leading dot indicates a
  relative import, starting with the current package. Two or more
  leading dots indicate a relative import to the parent(s) of the
  current package, one level per dot after the first.

For more information about this change, see this PEP from almost 16 years ago.
I suggest to stop using Python 2 and get used to the Python 3 way of working.

A: Whether you had helper.py in your python path would determine if you are able to import it directly or not.
And if you did not explicitly set PYTHONPATH, the directory from where you tried to run your script would get added to the PYTHONPATH.
Addendum:
If we are trying import something with a relative import:
from .module import data

is adviced.
However, it is always better to provide the full path like this:
from pkg_name.helper import MyClass

to avoid any ambiguity.


text:
Q: problem running mysql in Arch Linux downloaded MySQL 8.0.36 from the AUR repository and then ran sudo systemctl start mysqld (after running sudo systemctl enable mysqld). However, it gives the following error:

Job for mysqld.service failed because the control process exited with error code.
See "systemctl status mysqld.service" and "journalctl -xeu mysqld.service" for details.

The contents of journalctl -xeu mysqld.service:
-- Journal begins at Fri 2021-08-13 03:39:16 IST, ends at Mon 2021-09-20 16:06:37 IST. --
Sep 20 15:02:20 archlinux systemd[1]: Starting MySQL Server...
░░ Subject: A start job for unit mysqld.service has begun execution
░░ Defined-By: systemd
░░ Support: https://lists.freedesktop.org/mailman/listinfo/systemd-devel
░░
░░ A start job for unit mysqld.service has begun execution.
░░
░░ The job identifier is 3035.
Sep 20 15:02:20 archlinux mysqld_pre_systemd[46389]: mktemp: failed to create file via template '/var/lib/mysql-files/install-validate-password-plugin.XXXXXX.sql': No such file or directory
Sep 20 15:02:20 archlinux mysqld_pre_systemd[46390]: chmod: cannot access '': No such file or directory
Sep 20 15:02:20 archlinux mysqld_pre_systemd[46388]: /usr/bin/mysqld_pre_systemd: line 43: : No such file or directory
Sep 20 15:02:20 archlinux mysqld_pre_systemd[46388]: /usr/bin/mysqld_pre_systemd: line 44: $initfile: ambiguous redirect
Sep 20 15:02:20 archlinux mysqld_pre_systemd[46391]: 2021-09-20T09:32:20.610211Z 0 [Warning] [MY-010915] [Server] 'NO_ZERO_DATE', 'NO_ZERO_IN_DATE' and 'ERROR_FOR_DIVISION_BY_ZERO' sql modes should be used with strict mode. They will be merged with strict mode in a future release.
Sep 20 15:02:20 archlinux mysqld_pre_systemd[46391]: 2021-09-20T09:32:20.610288Z 0 [System] [MY-013169] [Server] /usr/bin/mysqld (mysqld 8.0.26) initializing of server in progress as process 46391
Sep 20 15:02:20 archlinux mysqld_pre_systemd[46391]: 2021-09-20T09:32:20.641296Z 1 [System] [MY-013576] [InnoDB] InnoDB initialization has started.
Sep 20 15:02:34 archlinux mysqld_pre_systemd[46391]: 2021-09-20T09:32:34.012850Z 1 [System] [MY-013577] [InnoDB] InnoDB initialization has ended.
Sep 20 15:03:09 archlinux mysqld_pre_systemd[46391]: 2021-09-20T09:33:09.683021Z 0 [Warning] [MY-013746] [Server] A deprecated TLS version TLSv1 is enabled for channel mysql_main
Sep 20 15:03:09 archlinux mysqld_pre_systemd[46391]: 2021-09-20T09:33:09.683407Z 0 [Warning] [MY-013746] [Server] A deprecated TLS version TLSv1.1 is enabled for channel mysql_main
Sep 20 15:03:09 archlinux mysqld_pre_systemd[46391]: 2021-09-20T09:33:09.781991Z 0 [ERROR] [MY-010455] [Server] Failed to open the bootstrap file (null)
Sep 20 15:03:09 archlinux mysqld_pre_systemd[46391]: 2021-09-20T09:33:09.782008Z 0 [ERROR] [MY-013236] [Server] The designated data directory /var/lib/mysql/ is unusable. You can remove all files that the server added to it.
Sep 20 15:03:09 archlinux mysqld_pre_systemd[46391]: 2021-09-20T09:33:09.782034Z 0 [ERROR] [MY-010119] [Server] Aborting
Sep 20 15:03:27 archlinux mysqld_pre_systemd[46391]: 2021-09-20T09:33:27.728729Z 0 [System] [MY-010910] [Server] /usr/bin/mysqld: Shutdown complete (mysqld 8.0.26)  Source distribution.
Sep 20 15:03:28 archlinux mysqld[46486]: 2021-09-20T09:33:28.102954Z 0 [Warning] [MY-010915] [Server] 'NO_ZERO_DATE', 'NO_ZERO_IN_DATE' and 'ERROR_FOR_DIVISION_BY_ZERO' sql modes should be used with strict mode. They will be merged with strict mode in a future release.
Sep 20 15:03:28 archlinux mysqld[46486]: 2021-09-20T09:33:28.103034Z 0 [System] [MY-010116] [Server] /usr/bin/mysqld (mysqld 8.0.26) starting as process 46486
Sep 20 15:03:28 archlinux mysqld[46486]: 2021-09-20T09:33:28.129728Z 1 [System] [MY-013576] [InnoDB] InnoDB initialization has started.
Sep 20 15:03:29 archlinux mysqld[46486]: 2021-09-20T09:33:29.170005Z 1 [System] [MY-013577] [InnoDB] InnoDB initialization has ended.
Sep 20 15:03:29 archlinux mysqld[46486]: mysqld: Table 'mysql.plugin' doesn't exist
Sep 20 15:03:29 archlinux mysqld[46486]: 2021-09-20T09:33:29.385429Z 0 [ERROR] [MY-010735] [Server] Could not open the mysql.plugin table. Please perform the MySQL upgrade procedure.
Sep 20 15:03:29 archlinux mysqld[46486]: 2021-09-20T09:33:29.386859Z 0 [Warning] [MY-010441] [Server] Failed to open optimizer cost constant tables
Sep 20 15:03:29 archlinux mysqld[46486]: 2021-09-20T09:33:29.387861Z 0 [Warning] [MY-010441] [Server] Failed to open optimizer cost constant tables
Sep 20 15:03:29 archlinux mysqld[46486]: 2021-09-20T09:33:29.388740Z 0 [Warning] [MY-010441] [Server] Failed to open optimizer cost constant tables
Sep 20 15:03:29 archlinux mysqld[46486]: 2021-09-20T09:33:29.389869Z 0 [Warning] [MY-010441] [Server] Failed to open optimizer cost constant tables
Sep 20 15:03:29 archlinux mysqld[46486]: 2021-09-20T09:33:29.390711Z 0 [Warning] [MY-010441] [Server] Failed to open optimizer cost constant tables
Sep 20 15:03:29 archlinux mysqld[46486]: 2021-09-20T09:33:29.391554Z 0 [Warning] [MY-010441] [Server] Failed to open optimizer cost constant tables
Sep 20 15:03:29 archlinux mysqld[46486]: 2021-09-20T09:33:29.392562Z 0 [Warning] [MY-010441] [Server] Failed to open optimizer cost constant tables
Sep 20 15:03:29 archlinux mysqld[46486]: 2021-09-20T09:33:29.780759Z 0 [Warning] [MY-010015] [Repl] Gtid table is not ready to be used. Table 'mysql.gtid_executed' cannot be opened.
Sep 20 15:03:30 archlinux mysqld[46486]: 2021-09-20T09:33:30.017576Z 0 [Warning] [MY-010015] [Repl] Gtid table is not ready to be used. Table 'mysql.gtid_executed' cannot be opened.
Sep 20 15:03:30 archlinux mysqld[46486]: 2021-09-20T09:33:30.049664Z 0 [Warning] [MY-013746] [Server] A deprecated TLS version TLSv1 is enabled for channel mysql_main
Sep 20 15:03:30 archlinux mysqld[46486]: 2021-09-20T09:33:30.050224Z 0 [Warning] [MY-013746] [Server] A deprecated TLS version TLSv1.1 is enabled for channel mysql_main
Sep 20 15:03:30 archlinux mysqld[46486]: 2021-09-20T09:33:30.053313Z 0 [Warning] [MY-010068] [Server] CA certificate ca.pem is self signed.
Sep 20 15:03:30 archlinux mysqld[46486]: 2021-09-20T09:33:30.054132Z 0 [System] [MY-013602] [Server] Channel mysql_main configured to support TLS. Encrypted connections are now supported for this channel.
Sep 20 15:03:30 archlinux mysqld[46486]: 2021-09-20T09:33:30.059712Z 0 [Warning] [MY-010441] [Server] Failed to open optimizer cost constant tables
Sep 20 15:03:30 archlinux mysqld[46486]: 2021-09-20T09:33:30.060885Z 0 [ERROR] [MY-013129] [Server] A message intended for a client cannot be sent there as no client-session is attached. Therefore, we're sending the information to the error-log instead: MY-001146 - Table 'mysql.component' doesn't exist
Sep 20 15:03:30 archlinux mysqld[46486]: 2021-09-20T09:33:30.061569Z 0 [Warning] [MY-013129] [Server] A message intended for a client cannot be sent there as no client-session is attached. Therefore, we're sending the information to the error-log instead: MY-003543 - The mysql.component table is missing or has an incorrect definition.
Sep 20 15:03:30 archlinux mysqld[46486]: 2021-09-20T09:33:30.063609Z 0 [ERROR] [MY-010326] [Server] Fatal error: Can't open and lock privilege tables: Table 'mysql.user' doesn't exist
Sep 20 15:03:30 archlinux mysqld[46486]: 2021-09-20T09:33:30.064458Z 0 [ERROR] [MY-010952] [Server] The privilege system failed to initialize correctly. For complete instructions on how to upgrade MySQL to a new version please see the 'Upgrading MySQL' section from the MySQL manual.
Sep 20 15:03:30 archlinux mysqld[46486]: 2021-09-20T09:33:30.066133Z 0 [ERROR] [MY-010119] [Server] Aborting
Sep 20 15:03:32 archlinux mysqld[46486]: 2021-09-20T09:33:32.332310Z 0 [System] [MY-010910] [Server] /usr/bin/mysqld: Shutdown complete (mysqld 8.0.26)  Source distribution.
Sep 20 15:03:32 archlinux systemd[1]: mysqld.service: Main process exited, code=exited, status=1/FAILURE
░░ Subject: Unit process exited
░░ Defined-By: systemd
░░ Support: https://lists.freedesktop.org/mailman/listinfo/systemd-devel
░░
░░ An ExecStart= process belonging to unit mysqld.service has exited.
░░
░░ The process' exit code is 'exited' and its exit status is 1.
Sep 20 15:03:32 archlinux systemd[1]: mysqld.service: Failed with result 'exit-code'.
░░ Subject: Unit failed
░░ Defined-By: systemd
░░ Support: https://lists.freedesktop.org/mailman/listinfo/systemd-devel
░░
░░ The unit mysqld.service has entered the 'failed' state with result 'exit-code'.
Sep 20 15:03:32 archlinux systemd[1]: Failed to start MySQL Server.
░░ Subject: A start job for unit mysqld.service has failed
░░ Defined-By: systemd
░░ Support: https://lists.freedesktop.org/mailman/listinfo/systemd-devel
░░
░░ A start job for unit mysqld.service has finished with a failure.
░░
░░ The job identifier is 3035 and the job result is failed.
Sep 20 15:03:32 archlinux systemd[1]: mysqld.service: Consumed 5.170s CPU time.
░░ Subject: Resources consumed by unit runtime
░░ Defined-By: systemd
░░ Support: https://lists.freedesktop.org/mailman/listinfo/systemd-devel
░░
░░ The unit mysqld.service completed and consumed the indicated resources.
Sep 20 15:09:11 archlinux systemd[1]: Starting MySQL Server...
░░ Subject: A start job for unit mysqld.service has begun execution
░░ Defined-By: systemd
░░ Support: https://lists.freedesktop.org/mailman/listinfo/systemd-devel
░░
░░ A start job for unit mysqld.service has begun execution.
░░
░░ The job identifier is 3201.
Sep 20 15:09:11 archlinux mysqld[47078]: 2021-09-20T09:39:11.388078Z 0 [Warning] [MY-010915] [Server] 'NO_ZERO_DATE', 'NO_ZERO_IN_DATE' and 'ERROR_FOR_DIVISION_BY_ZERO' sql modes should be used with strict mode. They will be merged with strict mode in a future release.
Sep 20 15:09:11 archlinux mysqld[47078]: 2021-09-20T09:39:11.388129Z 0 [System] [MY-010116] [Server] /usr/bin/mysqld (mysqld 8.0.26) starting as process 47078
Sep 20 15:09:11 archlinux mysqld[47078]: 2021-09-20T09:39:11.395117Z 1 [System] [MY-013576] [InnoDB] InnoDB initialization has started.
Sep 20 15:09:12 archlinux mysqld[47078]: 2021-09-20T09:39:12.422857Z 1 [System] [MY-013577] [InnoDB] InnoDB initialization has ended.
Sep 20 15:09:12 archlinux mysqld[47078]: mysqld: Table 'mysql.plugin' doesn't exist
Sep 20 15:09:12 archlinux mysqld[47078]: 2021-09-20T09:39:12.658089Z 0 [ERROR] [MY-010735] [Server] Could not open the mysql.plugin table. Please perform the MySQL upgrade procedure.
Sep 20 15:09:12 archlinux mysqld[47078]: 2021-09-20T09:39:12.659336Z 0 [Warning] [MY-010441] [Server] Failed to open optimizer cost constant tables
Sep 20 15:09:12 archlinux mysqld[47078]: 2021-09-20T09:39:12.660203Z 0 [Warning] [MY-010441] [Server] Failed to open optimizer cost constant tables
Sep 20 15:09:12 archlinux mysqld[47078]: 2021-09-20T09:39:12.661077Z 0 [Warning] [MY-010441] [Server] Failed to open optimizer cost constant tables
Sep 20 15:09:12 archlinux mysqld[47078]: 2021-09-20T09:39:12.662207Z 0 [Warning] [MY-010441] [Server] Failed to open optimizer cost constant tables
Sep 20 15:09:12 archlinux mysqld[47078]: 2021-09-20T09:39:12.663015Z 0 [Warning] [MY-010441] [Server] Failed to open optimizer cost constant tables
Sep 20 15:09:12 archlinux mysqld[47078]: 2021-09-20T09:39:12.663854Z 0 [Warning] [MY-010441] [Server] Failed to open optimizer cost constant tables
Sep 20 15:09:12 archlinux mysqld[47078]: 2021-09-20T09:39:12.664683Z 0 [Warning] [MY-010441] [Server] Failed to open optimizer cost constant tables
Sep 20 15:09:12 archlinux mysqld[47078]: 2021-09-20T09:39:12.827203Z 0 [Warning] [MY-010015] [Repl] Gtid table is not ready to be used. Table 'mysql.gtid_executed' cannot be opened.
Sep 20 15:09:13 archlinux mysqld[47078]: 2021-09-20T09:39:13.164880Z 0 [Warning] [MY-010015] [Repl] Gtid table is not ready to be used. Table 'mysql.gtid_executed' cannot be opened.
Sep 20 15:09:13 archlinux mysqld[47078]: 2021-09-20T09:39:13.197466Z 0 [Warning] [MY-013746] [Server] A deprecated TLS version TLSv1 is enabled for channel mysql_main
Sep 20 15:09:13 archlinux mysqld[47078]: 2021-09-20T09:39:13.198322Z 0 [Warning] [MY-013746] [Server] A deprecated TLS version TLSv1.1 is enabled for channel mysql_main
Sep 20 15:09:13 archlinux mysqld[47078]: 2021-09-20T09:39:13.201045Z 0 [Warning] [MY-010068] [Server] CA certificate ca.pem is self signed.
Sep 20 15:09:13 archlinux mysqld[47078]: 2021-09-20T09:39:13.201683Z 0 [System] [MY-013602] [Server] Channel mysql_main configured to support TLS. Encrypted connections are now supported for this channel.
Sep 20 15:09:13 archlinux mysqld[47078]: 2021-09-20T09:39:13.207418Z 0 [Warning] [MY-010441] [Server] Failed to open optimizer cost constant tables
Sep 20 15:09:13 archlinux mysqld[47078]: 2021-09-20T09:39:13.208493Z 0 [ERROR] [MY-013129] [Server] A message intended for a client cannot be sent there as no client-session is attached. Therefore, we're sending the information to the error-log instead: MY-001146 - Table 'mysql.component' doesn't exist
Sep 20 15:09:13 archlinux mysqld[47078]: 2021-09-20T09:39:13.209144Z 0 [Warning] [MY-013129] [Server] A message intended for a client cannot be sent there as no client-session is attached. Therefore, we're sending the information to the error-log instead: MY-003543 - The mysql.component table is missing or has an incorrect definition.
Sep 20 15:09:13 archlinux mysqld[47078]: 2021-09-20T09:39:13.211124Z 0 [ERROR] [MY-010326] [Server] Fatal error: Can't open and lock privilege tables: Table 'mysql.user' doesn't exist
Sep 20 15:09:13 archlinux mysqld[47078]: 2021-09-20T09:39:13.211872Z 0 [ERROR] [MY-010952] [Server] The privilege system failed to initialize correctly. For complete instructions on how to upgrade MySQL to a new version please see the 'Upgrading MySQL' section from the MySQL manual.
Sep 20 15:09:13 archlinux mysqld[47078]: 2021-09-20T09:39:13.213634Z 0 [ERROR] [MY-010119] [Server] Aborting
Sep 20 15:09:15 archlinux mysqld[47078]: 2021-09-20T09:39:15.117539Z 0 [System] [MY-010910] [Server] /usr/bin/mysqld: Shutdown complete (mysqld 8.0.26)  Source distribution.
Sep 20 15:09:15 archlinux systemd[1]: mysqld.service: Main process exited, code=exited, status=1/FAILURE
░░ Subject: Unit process exited
░░ Defined-By: systemd
░░ Support: https://lists.freedesktop.org/mailman/listinfo/systemd-devel
░░
░░ An ExecStart= process belonging to unit mysqld.service has exited.
░░
░░ The process' exit code is 'exited' and its exit status is 1.
Sep 20 15:09:15 archlinux systemd[1]: mysqld.service: Failed with result 'exit-code'.
░░ Subject: Unit failed
░░ Defined-By: systemd
░░ Support: https://lists.freedesktop.org/mailman/listinfo/systemd-devel
░░
░░ The unit mysqld.service has entered the 'failed' state with result 'exit-code'.
Sep 20 15:09:15 archlinux systemd[1]: Failed to start MySQL Server.
░░ Subject: A start job for unit mysqld.service has failed
░░ Defined-By: systemd
░░ Support: https://lists.freedesktop.org/mailman/listinfo/systemd-devel
░░
░░ A start job for unit mysqld.service has finished with a failure.
░░
░░ The job identifier is 3201 and the job result is failed.
Sep 20 15:09:15 archlinux systemd[1]: mysqld.service: Consumed 1.235s CPU time.
░░ Subject: Resources consumed by unit runtime
░░ Defined-By: systemd
░░ Support: https://lists.freedesktop.org/mailman/listinfo/systemd-devel
░░
░░ The unit mysqld.service completed and consumed the indicated resources.
Sep 20 15:09:49 archlinux systemd[1]: Starting MySQL Server...
░░ Subject: A start job for unit mysqld.service has begun execution
░░ Defined-By: systemd
░░ Support: https://lists.freedesktop.org/mailman/listinfo/systemd-devel
░░
░░ A start job for unit mysqld.service has begun execution.
░░
░░ The job identifier is 3290.
Sep 20 15:09:50 archlinux mysqld[47207]: 2021-09-20T09:39:50.075264Z 0 [Warning] [MY-010915] [Server] 'NO_ZERO_DATE', 'NO_ZERO_IN_DATE' and 'ERROR_FOR_DIVISION_BY_ZERO' sql modes should be used with strict mode. They will be merged with strict mode in a future release.
Sep 20 15:09:50 archlinux mysqld[47207]: 2021-09-20T09:39:50.075348Z 0 [System] [MY-010116] [Server] /usr/bin/mysqld (mysqld 8.0.26) starting as process 47207
Sep 20 15:09:50 archlinux mysqld[47207]: 2021-09-20T09:39:50.152770Z 1 [System] [MY-013576] [InnoDB] InnoDB initialization has started.
Sep 20 15:09:55 archlinux mysqld[47207]: 2021-09-20T09:39:55.107623Z 1 [System] [MY-013577] [InnoDB] InnoDB initialization has ended.
Sep 20 15:09:55 archlinux mysqld[47207]: mysqld: Table 'mysql.plugin' doesn't exist
Sep 20 15:09:55 archlinux mysqld[47207]: 2021-09-20T09:39:55.251280Z 0 [ERROR] [MY-010735] [Server] Could not open the mysql.plugin table. Please perform the MySQL upgrade procedure.
Sep 20 15:09:55 archlinux mysqld[47207]: 2021-09-20T09:39:55.251890Z 0 [Warning] [MY-010441] [Server] Failed to open optimizer cost constant tables
Sep 20 15:09:55 archlinux mysqld[47207]: 2021-09-20T09:39:55.252313Z 0 [Warning] [MY-010441] [Server] Failed to open optimizer cost constant tables
Sep 20 15:09:55 archlinux mysqld[47207]: 2021-09-20T09:39:55.252715Z 0 [Warning] [MY-010441] [Server] Failed to open optimizer cost constant tables
Sep 20 15:09:55 archlinux mysqld[47207]: 2021-09-20T09:39:55.253229Z 0 [Warning] [MY-010441] [Server] Failed to open optimizer cost constant tables
Sep 20 15:09:55 archlinux mysqld[47207]: 2021-09-20T09:39:55.253664Z 0 [Warning] [MY-010441] [Server] Failed to open optimizer cost constant tables
Sep 20 15:09:55 archlinux mysqld[47207]: 2021-09-20T09:39:55.254124Z 0 [Warning] [MY-010441] [Server] Failed to open optimizer cost constant tables
Sep 20 15:09:55 archlinux mysqld[47207]: 2021-09-20T09:39:55.254496Z 0 [Warning] [MY-010441] [Server] Failed to open optimizer cost constant tables
Sep 20 15:09:55 archlinux mysqld[47207]: 2021-09-20T09:39:55.445838Z 0 [Warning] [MY-010015] [Repl] Gtid table is not ready to be used. Table 'mysql.gtid_executed' cannot be opened.
Sep 20 15:09:55 archlinux mysqld[47207]: 2021-09-20T09:39:55.686140Z 0 [Warning] [MY-010015] [Repl] Gtid table is not ready to be used. Table 'mysql.gtid_executed' cannot be opened.
Sep 20 15:09:55 archlinux mysqld[47207]: 2021-09-20T09:39:55.718563Z 0 [Warning] [MY-013746] [Server] A deprecated TLS version TLSv1 is enabled for channel mysql_main
Sep 20 15:09:55 archlinux mysqld[47207]: 2021-09-20T09:39:55.719234Z 0 [Warning] [MY-013746] [Server] A deprecated TLS version TLSv1.1 is enabled for channel mysql_main
Sep 20 15:09:55 archlinux mysqld[47207]: 2021-09-20T09:39:55.721865Z 0 [Warning] [MY-010068] [Server] CA certificate ca.pem is self signed.
Sep 20 15:09:55 archlinux mysqld[47207]: 2021-09-20T09:39:55.722757Z 0 [System] [MY-013602] [Server] Channel mysql_main configured to support TLS. Encrypted connections are now supported for this channel.
Sep 20 15:09:55 archlinux mysqld[47207]: 2021-09-20T09:39:55.728447Z 0 [Warning] [MY-010441] [Server] Failed to open optimizer cost constant tables
Sep 20 15:09:55 archlinux mysqld[47207]: 2021-09-20T09:39:55.729640Z 0 [ERROR] [MY-013129] [Server] A message intended for a client cannot be sent there as no client-session is attached. Therefore, we're sending the information to the error-log instead: MY-001146 - Table 'mysql.component' doesn't exist
Sep 20 15:09:55 archlinux mysqld[47207]: 2021-09-20T09:39:55.730413Z 0 [Warning] [MY-013129] [Server] A message intended for a client cannot be sent there as no client-session is attached. Therefore, we're sending the information to the error-log instead: MY-003543 - The mysql.component table is missing or has an incorrect definition.
Sep 20 15:09:55 archlinux mysqld[47207]: 2021-09-20T09:39:55.732637Z 0 [ERROR] [MY-010326] [Server] Fatal error: Can't open and lock privilege tables: Table 'mysql.user' doesn't exist
Sep 20 15:09:55 archlinux mysqld[47207]: 2021-09-20T09:39:55.733607Z 0 [ERROR] [MY-010952] [Server] The privilege system failed to initialize correctly. For complete instructions on how to upgrade MySQL to a new version please see the 'Upgrading MySQL' section from the MySQL manual.
Sep 20 15:09:55 archlinux mysqld[47207]: 2021-09-20T09:39:55.735486Z 0 [ERROR] [MY-010119] [Server] Aborting
Sep 20 15:09:57 archlinux mysqld[47207]: 2021-09-20T09:39:57.465393Z 0 [System] [MY-010910] [Server] /usr/bin/mysqld: Shutdown complete (mysqld 8.0.26)  Source distribution.
Sep 20 15:09:57 archlinux systemd[1]: mysqld.service: Main process exited, code=exited, status=1/FAILURE
░░ Subject: Unit process exited
░░ Defined-By: systemd
░░ Support: https://lists.freedesktop.org/mailman/listinfo/systemd-devel
░░
░░ An ExecStart= process belonging to unit mysqld.service has exited.
░░
░░ The process' exit code is 'exited' and its exit status is 1.
Sep 20 15:09:57 archlinux systemd[1]: mysqld.service: Failed with result 'exit-code'.
░░ Subject: Unit failed
░░ Defined-By: systemd
░░ Support: https://lists.freedesktop.org/mailman/listinfo/systemd-devel
░░
░░ The unit mysqld.service has entered the 'failed' state with result 'exit-code'.
Sep 20 15:09:57 archlinux systemd[1]: Failed to start MySQL Server.
░░ Subject: A start job for unit mysqld.service has failed
░░ Defined-By: systemd
░░ Support: https://lists.freedesktop.org/mailman/listinfo/systemd-devel
░░
░░ A start job for unit mysqld.service has finished with a failure.
░░
░░ The job identifier is 3290 and the job result is failed.
Sep 20 15:09:57 archlinux systemd[1]: mysqld.service: Consumed 1.169s CPU time.
░░ Subject: Resources consumed by unit runtime
░░ Defined-By: systemd
░░ Support: https://lists.freedesktop.org/mailman/listinfo/systemd-devel
░░
░░ The unit mysqld.service completed and consumed the indicated resources.

A: Here is the relevant line in the error log I believe:
Sep 20 15:03:09 archlinux mysqld_pre_systemd[46391]: 2021-09-20T09:33:09.782008Z 0 [ERROR] [MY-013236] [Server] The designated data directory /var/lib/mysql/ is unusable. You can remove all files that the server added to it.

Scrolling shows "The designated data directory /var/lib/mysql/ is unusable."
Have you initialised you mysqld installation so that the folder is populated?
If no: Please see and follow e.g. https://dev.mysql.com/doc/refman/5.7/en/data-directory-initialization.html
If yes:
Have you tried restoring that folder (also check owner/group/access mask) and perhaps emptying and re-initialising it (before you do: stop daemon and move files elsewhere, don't delete them)?
This is how the folder itself looks like on my system (example from non-arch but should be the same):
# ls -ld /var/lib/mysql
drwxr-xr-x. 5 mysql mysql 4096 Sep 13 00:13 /var/lib/mysql

How does it look like on your system?  Any content?


text:
Q: Make additional wordpress profile fields uneditable I have created extra profile fields for WP users but I want to make sure they are only editable by admins, is this possible?
Thnaks
Pam

A: While adding the fields, you need to check if logged in user has admin capabilities or not.
if ( current_user_can( 'manage_options' ) ) {
    /* A user with admin privileges */
} else {
    /* A user without admin privileges */
}

accordingly you can show/hide the fields as per the user role.


text:
Q: python regular expression with re.split() i have this string equation:
400-IF(3>5,5,5)+34+IF(4>5,5,6)

i want to split it by string 'IF(3>5,5,5)', means 'IF()' syntax, so here i used two if syntax.
so re.split() should give list with length: 2   ['400-', '+34+']
I made re and used as below.
re.split('IF[\(][0-9,a-z,A-Z,\$]*[\>|\<|=|/|%|*|^]?(.*)+[\,][0-9,a-z,A-Z,\$]*[\,][0-9,a-z,A-Z,\$]+[\)]', '400-IF(3>5,5,5)+34+IF(4>5,5,6)
')

But it is not returning proper answer. What is the mistake in my re. I am new in re.
Can anyone modify this re in python?

A: x="400-IF(3>5,5,5)+34+IF(4>5,5,6)"
print [i for i in re.split(r"IF\([^)]*\)",x) if i]

You can simply use this.

A: >>> z = '400-IF(3>5,5,5)+34+IF(4>5,5,6)'
>>> ' '.join(re.split(r'IF\(.*?\)',z)).split()
['400-', '+34+']


text:
Q: How to write cross-browser compatible userscripts? My past attempts at writing userscripts ended working in Firefox, but not Opera, because of subtle differences between the two browsers. Is it possible to use of those libraries that abstract the differences away like jQuery inside userscripts to make them cross-browser compatible with little effort?

A: Yes, as the google search for greasemonkey jquery shows:

*

*http://userscripts.org/topics/2324

*http://joanpiedra.com/jquery/greasemonkey/
As the posts in the first link say, it means you add a relatively large jQuery cost to your userscript. It's not very hard to make the code work across Firefox and Opera -- you don't have to worry about IE :)


text:
Q: SpringBoot Websockets gives me a 404 when trying to connect I'm trying to build a chat using SpringBoot and websockets. When I try to connect to the controller I get a 404 in the debugger. What am I doing wrong?
main.js
function connect(event) {
username = document.querySelector('#name').value.trim();

if (username) {
    usernamePage.classList.add('hidden');
    chatPage.classList.remove('hidden');

    var socket = new SockJS('http://localhost:8080/ws');
    stompClient = Stomp.over(socket);

    stompClient.connect({}, onConnected, onError);
 }
event.preventDefault();
}

WebSocketConfig.java
@Configuration
@EnableWebSocketMessageBroker
public class WebSocketConfig implements WebSocketMessageBrokerConfigurer {

@Override
public void registerStompEndpoints(StompEndpointRegistry registry) {
    registry.addEndpoint("/ws").setAllowedOrigins("*").withSockJS();
}

}


text:
Q: Leveberg-Marquard Optimization for Intensity-based Image Alignment Matlab Failed I am trying to implement the intensity-based image alignment algorithm in the paper Efficient, Robust, and Fast Global Motion Estimation for Video Coding on MATLAB. The problem is that the Levenberg-Marquardt (LM) optimization doesn't work properly, so the energy function cannot approach even a local minima due to very tiny update term computed from the LM approximation equation. I've searching for a week but still could not figure out the problem. Here is my implementation.
I have two gray images I and T equal in size (W x H) and would like to estimate a rigid transformation F (scale + rotation + translation) that aligns I onto T. This could be obtained by minimizing the following energy function

Where

According to LM, I can derive the gradient term of E with respect to each parameter a_i (i=1,4) as follow (from equation (5) in the paper).

And the terms of the Hessian matrix of E are (from equation (4) in the paper)

From the above equations, I derive the bellow MATLAB procedure to compute beta and alpha terms.
%========== 1. Compute gradient of T using Sobel filter
gx = [-1 -2 -1; 0 0 0; 1 2 1] / 4;
gy = [-1 0 1; -2 0 2; -1 0 1] / 4;

Tx = conv2( T, gx, 'same' );
Ty = conv2( T, gy, 'same' );

%========== 2. Warp I using F to compute diff_image = I(x, y) - T(F(x,y,a)). F was previously initialized by an identity matrix of size 3x3
tform = affine2d( F );
I_warp = imwarp( I, tform, 'linear', 'OutputView', imref2d( size( T ) ) );
diff_img = I_wapr - T;

% create a mask for overlaping region between two aligned images
mask = ones( size( T ) );
mask_warp = imwarp( mask, tform, 'nearest', 'OutputView', imref2d( size( T ) ) );
overlap_area = numel( mask_warp );
diff_img = diff_img .* mask;
error = sum( sum( diff_img ) ) / 2 / overlap_area;

% create x, y grids
[y, x] = ndgrid( 0 : h-1, 0 : w-1 );
x_warp = imwarp( x, t_form, 'nearest', 'OutputView', imref2d( size(T) ) );
y_warp = imwarp( y, t_form, 'nearest', 'OutputView', imref2d( size(T) ) );

%======== compute beta_i = - dE/da_i (i=1,4)
sx = Tx .* diff_img;
sy = Ty .* diff_img;

beta_1 = sum( sum( x_warp .* sx + y_warp .* sy ) );
beta_2 = sum( sum( y_warp .* sx - x_warp .* sy ) );
beta_3 = sum( sum( sx ) );
beta_4 = sum( sum( sy ) );
beta = -[beta_1; beta_2; beta_3; beta_4] / overlap_area;

%======= compute alpha_ij = (dE/da_i) * (dE/da_j)  i,j = 1,4
Sxx = (Tx .^ 2) .* mask_warp;
Syy = (Ty .^ 2) .* mask_warp;
Sxy = (Tx.* Ty) .* mask_warp;

xx = x_warp .^2;
yy = y_warp .^2;
xy = x_warp .* y_warp;

alpha_11 = sum( sum( xx .* Sxx + 2 * xy .* Sxy + yy .* Syy ) );
alpha_12 = sum( sum( (yy - xx) .* Sxy + xy .* (Sxx - Syy) ) );
alpha_13 = sum( sum( x .* Sxx + y .* Sxy ) );
alpha_14 = sum( sum( x .* Sxy + y .* Syy ) );
alpha_22 = sum( sum( yy .* Sxx - 2 * xy .* Sxy + xx .* Syy ) );
alpha_23 = sum( sum( y .* Sxx - x .* Sxy ) );
alpha_24 = sum( sum( y .* Sxy - x .* Syy ) );
alpha_33 = sum( sum( Sxx ) );
alpha_34 = sum( sum( Sxy ) );
alpha_44 = sum( sum( Syy ) );

alpha = [alpha_11 alpha_12 alpha_13 alpha_14;
         alpha_12 alpha_22 alpha_23 alpha_24;
         alpha_13 alpha_23 alpha_33 alpha_34;
         alpha_14 alpha_24 alpha_34 alpha_44] / overlap_area;
% With lamda was previously initialized by 0.0001
for i = 1 : 4
    alpha(i, i) = alpha(i, i) * (lamda + 1);
end

%======== Find the update term: delta_a = alpha^(-1) * beta
delta_a = pinv( alpha ) * beta

% Or we can solve for delta_a using SVD
%[U, S, V] = svd( alpha );
%inv_S = S;
%for ii = 1 : size(S, 1)
%    if S(ii, ii)
%        inv_S(ii, ii) = 1 / S(ii, ii);
%    end
%end
%delta_a = V * inv_S * U' * beta;

%======== Update a_i and new error value
a = [   F(1, 1)-1;
        F(2, 1);
        F(3, 1);
        F(3, 2)];
new_a = a + delta_a;
new_F = [new_a(1)+1   -new_a(2)    0;
          new_a(2)    new_a(1)+1   0;
          new_a(3)     new_a(4)    1];

tform = affine2d( new_F );
mask_warp = imwarp( mask, tform, 'nearest', 'OutputView', imref2d(size(T)));
new_I_warp = imwarp( I, tform, 'linear', 'OutputView', imref2d(size(T)));
new_diff_img = (new_I_warp - T) .* mask_warp;
new_error = sum( sum( new_diff_img .^2 ) ) / 2/ sum( sum( mask_warp ) );

if( new_error > error )
    lamda = lamda * 10;
elseif new_error < error
    lamda = lamda /10;

The above process is repeated until the iteration reach the limitation or the new_error value less than a predetermined threshold. However, after each iteration, the update terms are too small that parameters make trivial movement. For example,
delta a = 1.0e-04 * [0.0011   -0.0002    0.2186    0.2079]

Is there anybody know how to fixed it? Any help would be highly appreciated.


text:
Q: [mod_rewrite]: Problems with redirecting i have a problem with rewriting urls. i have coded a small framework for myself because i don't need a full sized framework with lots of stuff for my projects. I defined the general behavior like zend framework:
Rewritten url: domain/controller/action
Real path: domain/index.php?ctrl=controller&act=action
Controller and action should be displayed instead of it $_GET named key. After controller and action if i add an infinite amount of additional parameters, it should be added as key/value like this:
domain/controller/action/key/value/key2/value2/key3/value3 ...
This is my .htaccess:
RewriteEngine On
RewriteBase /
RewriteRule ^([\w-]+)/([\w-]+)/([\w-]+)/([\w-]+)/([\w-]+)/([\w-]+)/([\w-]+)/([\w-]+)/([\w-]+)/([\w-]+)/([\w-]+)/([\w-]+)/([\w-]+)/([\w-]+)/?$ index.php?ctrl=$1&act=$2&$3=$4&$5=$6&$7=$8&$9=$10&$11=$12&$13=$14 [L]
RewriteRule ^([\w-]+)/([\w-]+)/([\w-]+)/([\w-]+)/([\w-]+)/([\w-]+)/([\w-]+)/([\w-]+)/([\w-]+)/([\w-]+)/([\w-]+)/([\w-]+)/?$ index.php?ctrl=$1&act=$2&$3=$4&$5=$6&$7=$8&$9=$10&$11=$12 [L]
RewriteRule ^([\w-]+)/([\w-]+)/([\w-]+)/([\w-]+)/([\w-]+)/([\w-]+)/([\w-]+)/([\w-]+)/([\w-]+)/([\w-]+)/?$ index.php?ctrl=$1&act=$2&$3=$4&$5=$6&$7=$8&$9=$10 [L]
RewriteRule ^([\w-]+)/([\w-]+)/([\w-]+)/([\w-]+)/([\w-]+)/([\w-]+)/([\w-]+)/([\w-]+)/?$ index.php?ctrl=$1&act=$2&$3=$4&$5=$6&$7=$8 [L]
RewriteRule ^([\w-]+)/([\w-]+)/([\w-]+)/([\w-]+)/([\w-]+)/([\w-]+)/?$ index.php?ctrl=$1&act2=$2&$3=$4&$5=$6 [L]
RewriteRule ^([\w-]+)/([\w-]+)/([\w-]+)/([\w-]+)/?$ index.php?ctrl=$1&act=$2&$3=$4 [L]
RewriteRule ^([\w-]+)+/([\w-]+)?$ index.php?ctrl=$1&act=$2 [L]
RewriteRule ^([\w-]+)+/?$ index.php?ctrl=$1 [L]

The page can only called with controller and action. If one of them is missing, the user will be redirected. I set headers for that:
// Redirects
if (!isset($_GET) || !isset($_GET['ctrl'])) {
    header('location: /index/index/');
}

if (!isset($_GET['act']) || (isset($_GET['act']) && empty($_GET['act']))) {
    header("location: /".$_GET['ctrl']."/index/");
}

It's dirty i know. Generally it works, but there are some problems that i can't solve:

*

*if i try to call the webapp with domain/ the page can't be displayed or i will be redirected to google with the search "domain/". If i type domain/controller/action it works.

*If i add a trailing slash after the action, it ends up with 404. It should be the same behavior like without the slash at end.

*If i add a slash before the path in header('location:... it works for the following pattern: domain/controller. It will be redirected to domain/controller/action (in this case controller/index).
But if i try domain/ it results in 404.
Without slash before:
domain/controller/ results in domain/controller/controller/action but domain/ will be redirected correctly to  domain/index/index
What am i missing? :(
Thanks
Tyr

A: I think you forgot this:
rewritecond %{http_host} ^yoururl.com/ [nc]
rewriterule ^(.*)$ http://yoururl.com/$1 [r=301,nc]

This code needs to go under:
RewriteBase /


text:
Q: Convert namedtuple to list in python and generate CSV Ref: https://stackoverflow.com/a/19726081/1182021
OrderedDict([
('company 1', tup(price=246, year='1991', month='march')),
('company 2', tup(price=245, year='1990', month='jan')),
('company 3', tup(price=243, year='1990', month='jan')),
('company 4', tup(price=247, year='1991', month='december')),
('company 5', tup(price=245, year='1991', month='june'))])

How to export this data in csv format like this:
Company Name , Price , Year , Month
Company 1    , 246   , 1991 , march
Company 2    , 245   , 1990 , jan

I tried creating a csv using import csv like this (ALL IN SAME ROW):
myfile = open(csvfile, 'wb')
wr = csv.writer(myfile , quoting=csv.QUOTE_ALL)
wr.writerow(data_list)

EDIT 1
where data_list is the OrderedDict and I am getting all data incorrect format
Company-A | Filtered(Year='2013', Month='Dec', Price=0) Company-B   | Filtered(Year='2013', Month='Dec', Price=0) |     Company-C  |    Filtered(Year='2013', Month='Dec', Price=0) |   Company-D |     Filtered(Year='2013', Month='Dec', Price=0) Company-E |     Filtered(Year='2013', Month='Dec', Price=0)

EDIT 2
OK I converted OrderedDict to simple list by data_list = OrderedDict.items()
And as suggested by mkrehili I have this as my export method:
def ExportData(csv_file, data_list):
    csv_file = open(csv_file, 'wb')
    wr = csv.writer(csv_file, quoting=csv.QUOTE_ALL)

    for company_name, company_data in data_list:
        wr.writerow([company_name] + list(company_data))

And I am getting this list now:
[('Company-A', Filtered(Year='2013', Month='Dec', Price=0)), ('Company-B', Filtered(Year='2013', Month='Dec', Price=0)), ('Company-C', Filtered(Year='2013', Month='Dec', Price=0)), ('Company-D', Filtered(Year='2013', Month='Dec', Price=0)), ('Company-E', Filtered(Year='2013', Month='Dec', Price=0))]

But when I am converting it in CSV the following is the output:
Company-A   2013    Dec 0
Company-B   2013    Dec 0
Company-C   2013    Dec 0
Company-D   2013    Dec 0
Company-E   2013    Dec 0

EDIT 3
Actually both the data are not coming same:
In OrderedDict its:
OrderedDict([
('company A', tup(price=246, year='1991', month='march')),
('company B', tup(price=245, year='1990', month='jan')),
('company C', tup(price=243, year='1990', month='jan')),
('company D', tup(price=247, year='1991', month='december')),
('company E', tup(price=245, year='1991', month='june'))])

But once I do data_list = OrderedDict.items() it gives me this data: Which is not in correct format:
[('Company-A', tup(price=0, year="2013", month='Dec')),
 ('Company-B', tup(price=0, year="2013", month='Dec')),
 ('Company-C', tup(price=0, year="2013", month='Dec')),
 ('Company-D', tup(price=0, year="2013", month='Dec')),
 ('Company-E', tup(price=0, year="2013", month='Dec'))]

So majorly my issue is to create a simple list where i have list like this:
Company Name , Price , Year , Month
Company A    , 246   , 1991 , march
Company B    , 245   , 1990 , jan
......
......

EDIT 4
with open(csv_file, 'w') as f:
    w = csv.writer(f)
    w.writerow(('Company Name', 'Year', 'Month', 'Price'))
    w.writerows([(name, data.year, data.month, data.price) for   name, data in data_list])`

This is giving me right export, but after each line I am having an empty row, like this:
Company Name    Year    Month   Price

Company-A   2000    Mar 1000

Company-B   2007    Mar 986

Company-C   1993    Jun 995

Company-D   2002    Apr 999

Company-E   2008    Oct 997

A: import csv
from collections import namedtuple, OrderedDict

tup = namedtuple('tup', ['price', 'year', 'month'])
prices = OrderedDict([
    ('company A', tup(price=246, year='1991', month='march')),
    ('company B', tup(price=245, year='1990', month='jan')),
    ('company C', tup(price=243, year='1990', month='jan')),
    ('company D', tup(price=247, year='1991', month='december')),
    ('company E', tup(price=245, year='1991', month='june'))])

with open('output.csv', 'w') as f:
    w = csv.writer(f)
    w.writerow(('Company Name', 'Price', 'Year', 'Month'))    # field header
    w.writerows([(name, data.price, data.year, data.month) for name, data in prices.items()])

Writes to output.csv:
Company Name,Price,Year,Month
company A,246,1991,march
company B,245,1990,jan
company C,243,1990,jan
company D,247,1991,december
company E,245,1991,june

A: namedtuple is still iterable so treat it like such:
>>> tup = namedtuple('tup', ['price', 'year', 'month'])
>>> c = tup(price=246, year='1991', month='march')
>>> list(c)
[246, '1991', 'march']
>>> print(*c)
246 1991 march

So in your example (you didn't post complete code, which makes things harder):
for company_name, company_data in data_list.items():
    wr.writerow([company_name] + list(company_data))

A: Here is a solution that honors the question title (which mentions named tuples but not OrderedDict).
OrderedDict like in the other answers is probably a better approach but I am listing this just in case it is useful to others who might not need rows to be indexed.
I made a more generic Gitlab Snippet, Name Tuple Demo: Saving a named tuple to csv which goes over a bit more on this subject.
from collections import namedtuple
import csv
from pathlib import Path

CompanyDetails = namedtuple(
    'CompanyDetails', ('company_name', 'price', 'year', 'month',)
)

def format_csv_header(header_fields):
    return tuple(
        header_field.replace("_", " ").title()
        for header_field in header_fields
    )

def write_contents_to_csv(contents, csv_file):
    with Path(csv_file).open('w') as outfile:
        writer = csv.writer(outfile)
        header = format_csv_header(contents._fields)
        rows = zip(*contents)
        all_rows = (header,) + (*rows,)
        writer.writerows(all_rows)

# Example: Row Indexed. Consider using OrderedDict here instead!
company_details = CompanyDetails(
    company_name=(
        'Company 1', 'Company 2', 'Company 3', 'Company 4', 'Company 5',
    ),
    price=(246, 245, 243, 247, 245,),
    year=('1991', '1990', '1990', '1991', '1991',),
    month=('march', 'jan', 'jan', 'december', 'june',)
)
write_contents_to_csv(company_details, '/tmp/company_details.csv')


text:
Q: How to assign Interpolated string into template Ref variables Is there a way to assign an element reference variable by interpolating a string into it?
<mat-list-item *ngFor="let item of studentItems " [class.is-active]="ref.isActive" >
      {{item.title}} {{profile}}
      <mat-icon matListIcon class="mat-grey" [class.link-active]="ref.isActive">{{item.icon}}</mat-icon>
</mat-list-item>

I am considering variable interpolation for template Ref to gain a unique ref literal for each mat list item otherwise css class would pollute all of the selected and not selected when many items has the same ref .

A: of course, but with using Angular Router and it's directives

or

even anchor links can be provided with Angular Router, using ActivatedRoute fragment property


text:
Q: How to center a text using coordinates and text length I'm generating a certificate with a user name for a course platform. I want to center a text but it is not centered at all, It starts in the middle but the text is moved i. I'm using PHP 8.0 and the library MPDF.
My code is the following:
$mpdf = new \Mpdf\Mpdf(['orientation' => 'L']);
$mpdf->setSourceFile('storage/' . $certificate->url); // absolute path to pdf file
$certificatePDf = $mpdf->importPage(1);

$mpdf->useTemplate($certificatePDf, 0, 0, null, null, true);
$pageSize = $mpdf->getTemplateSize($certificatePDf);
$textSize = strlen($name);
$mpdf->SetFont('Sanchez-Regular', '', 40,);
$mpdf->SetY(130);
//centering the name on the pdf
$mpdf->WriteText($pageSize['width']/2 - $textSize/2  , 130, $name);
$mpdf->Output('newpdf.pdf');

My formula is the following: $totalPageSize/2 - $textSize/2.
An example:
What else if left to center based on text length?

A: Mpdf allows to enter text in HTML, even if  you're trying to load a pdf or an HTML view as a template.
Here is what I did:
My Solution


text:
Q: How to Assign the Output of comm Command To Variable I need assign the Output of comm Command to variable. I use comm to campare two list of values.
These two lists are defined as:
DATA_REF_DATA_OPIT_SIP='PCSCF4A
PCSCF4B
PCSCF5A
PCSCF5B'
DataExist='PCSCF4B
PCSCF5A
PCSCF5B'

And when i do
comm -23 <(sort <<<"$DATA_REF_DATA_OPIT_SIP") <(sort <<<"$DataExist")

Output :
PCSCF4A

I want to assign the output of comm to a Variable. So i did :
res=$(comm -23 <(sort <<<"$DATA_REF_DATA_OPIT_SIP") <(sort <<<"$DataExist"));
echo $res

I get empty output.
instead of :
echo $res
PCSCF4A

Please Help. Thanks you.


text:
Q: Table stretches out in Google Chrome and Opera webbrowser when I refresh the page I made an HTML table,

But when I refresh my page it's totally stretched out in Google Chrome and in the Opera webbrowser. It's also tested in Internet Explorer and Firefox and there it stays the normal table.
The subnormal table after page refresh looks like:

Under this you can see the CSS part of my table:
.rdThemeDataTableCell, table.rdAgDataTable td {
    background-color: #fff;
    padding: 4px;
}

td.rdThemeDataTableCell.rdCgPositionCellXAxis {
    background-color: #ffffff;
    border-style: none;
}

td.rdThemeDataTableCell.rdCgPositionCellXAxis {
    background-color: #ffffff;
    border-style: none;
}

Now I don't know how this comes that it works in some browser and in some it doesn't, but it needs to work everywhere.

A: I don't know whether this might help you or not.
The padding, border seems to be varying in different browsers. To the best of my knowledge your problem is related to a specific browser.
There are ways to target a specific browser and apply custom styling to presice content where the problem located.
-WebKit- For Chorme, Opera
@media screen and (-webkit-min-device-pixel-ratio:0) {
    .ar #form-wrapper {
        width: 330px;
    }
}

moz-document For Firefox:
 @-moz-document url-prefix() {
    .submit_btn {
        padding-bottom: 5px;
    }
}

Link regarding other browser tricks.

A: The answer was that I used a time input, but my time picker didn't have a style class. This created the problem that Chrome and Opera couldn't react well on it.


text:
Q: How to append more data to a dictionary Assume I have this:
tradedict = {'id': 325920, 'order_id': 109185014, 'matched_order_id': 109181538,
'direction': 'BUY', 'trading_pair_id': 48, 'symbol': 'ECS/EUR', 'amount': '1',
'price': '0.1507', 'date': 1654433352373}

and I want to add this to the dictionary:
{'id': 325910, 'order_id': 109179557, 'matched_order_id': 109179004,
'direction': 'BUY', 'trading_pair_id': 50, 'symbol': 'BTC/ECS', 'amount': '0.001',
'price': '193499.99', 'date': 1654429749384}

So it will look like this: (If it possible.)
tradedict = {'id': 325920, 'order_id': 109185014, 'matched_order_id': 109181538,
'direction': 'BUY', 'trading_pair_id': 48, 'symbol': 'ECS/EUR', 'amount': '1',
'price': '0.1507', 'date': 1654433352373},

{'id': 325910, 'order_id': 109179557, 'matched_order_id': 109179004,
'direction': 'BUY', 'trading_pair_id': 50, 'symbol': 'BTC/ECS', 'amount': '0.001',
'price': '193499.99', 'date': 1654429749384}

I'm not good to python, so I don't know if this is possible. If it is possible how do I search for element: 'trading_pair_id': 50 and if the 'id' for that index has changed I want to update all elements with new data for that index.

A: I dont think the output you mentioned in your question is a valid dictionary.. It's more like a tuple.. So I came up with my code to join these two dictionaries.
tradedict = {'id': 325920, 'order_id': 109185014, 'matched_order_id': 109181538,
'direction': 'BUY', 'trading_pair_id': 48, 'symbol': 'ECS/EUR', 'amount': '1',
'price': '0.1507', 'date': 1654433352373}

another_tradedict = {'id': 325910, 'order_id': 109179557, 'matched_order_id': 109179004,
'direction': 'BUY', 'trading_pair_id': 50, 'symbol': 'BTC/ECS', 'amount': '0.001',
'price': '193499.99', 'date': 1654429749384}

for i in tradedict:
    temp = []
    temp.append(tradedict[i])
    temp.append(another_tradedict[i])
    tradedict[i] = temp

print(tradedict)

And the output would be something like this,
{'id': [325920, 325910], 'order_id': [109185014, 109179557], 'matched_order_id': [109181538, 109179004], 'direction': ['BUY', 'BUY'], 'trading_pair_id': [48, 50], 'symbol': ['ECS/EUR', 'BTC/ECS'], 'amount': ['1', '0.001'], 'price': ['0.1507', '193499.99'], 'date': [1654433352373, 1654429749384]}

A: You cannot repeat keys in a dictionary
What I meant to say is,
Your primary dictionary is having a key name "id", "order_id" etc
tradedict = {'id': 325920, 'order_id': 109185014, 'matched_order_id': 109181538,
'direction': 'BUY', 'trading_pair_id': 48, 'symbol': 'ECS/EUR', 'amount': '1',
'price': '0.1507', 'date': 1654433352373}

But the dictionary you wish to add also has the same keys, hence you will not be able to add these two dictionaries in particular.
But what you can do is:
You can add new key-value pairs in your dictionary
tradeict["Company"]="amazon"

You will get this as a result
{'id': 325920,
 'order_id': 109185014,
 'matched_order_id': 109181538,
 'direction': 'BUY',
 'trading_pair_id': 48,
 'symbol': 'ECS/EUR',
 'amount': '1',
 'price': '0.1507',
 'date': 1654433352373,
 'company': 'amazon'}

Notice how new key value pair has been added to the dictionary


text:
Q: How to manage a RDS Database including recovery from snapshots in CDK I am managing an RDS Database in an CDK Project. From time to time it is necasary to recover an old state of the database from snapshot.
To make this possible, I have CDK Context Parameter specifying the Snapshot from which the Database should be recovered. If it is given, the snapshot is bassed to the RDS Construct. This leads to a replacement of the database (which is fine).
Now, if the database has been recovered from snapshot and I do some other update in the CDK Project and want to update the project (which is done via CD Pipeline) I usally start the update without giving any snapshot. This leads to the database to be replaced by an empty one, which is of course not what I want.
To summarize, this is how it currently works:

Current state of the stack
Deployment Paramter
Result

Not created from snapshot
No snapshot
DB is not replaced

Not created from snapshot
snapshot
DB is replaced

created from snapshot
No snapshot
DB is replaced

created from snapshot
snapshot (same)
DB is not replaced

created from snapshot
snapshot (different)
DB is replaced

This is IMHO not managable.
But what I want is something like this:

Current state of the stack
Deployment Paramter
Result

Not created from snapshot
No snapshot
DB is not replaced

Not created from snapshot
snapshot
DB is replaced

created from snapshot
No snapshot
DB is not replaced

created from snapshot
snapshot (same)
DB is replaced

created from snapshot
snapshot (different)
DB is replaced

Or, to put it in other words:

*

*If I specify no snapshot, don't replace the DB

*If I specify a snapshot, repalce the DB

Is this possible? Or is there another good way to manage an RDS Database using CDK?


text:
Q: What's the correct pronunciation of the indefinite article "a"? I have noticed watching series, that some characters, or even the voice of my translator speaks the letter "a" with two different sounds when it's in a sentence.
For example:
It's correct to say "ae bus" or "ah" bus? (a bus)?
I'm struggling to get the pattern, but I couldn't figure it out.

A: I don't know why everyone is confusing the issue so much.
In ordinary conversation, the indefinite article a is pronounced as an indeterminate vowel (the schwa ). I assume that's what you mean by ah.
Occasionally, if you want to put stress on the indefinite article (perhaps to tell someone to use a and not the), you might pronounce it like the letter A (your ae).

A: It's better to say a it is more complex and brief at this point.


text:
Q: Sources of lore I'm having a lot of trouble to find lore.
I exhausted the bookstore, the auction, Mansur until the Stag door and the expeditions I could find. Where else can I find lore?

A: This is the way I see to be the quickest path to acquire Lore:

*

*Keep buying everything from Morland's Shop. It will keep bringing books to study that will become Lore.

*When Morland's shop closes, start buying books at Oriflamme's Auction House until it doesn't have any more books to sell. Oriflamme can also be found by a believer Exploring.

*If you Explore with Secret Histories Lore, they will convert into Aspect: Location+Vault. Those might bring back more Lore. Here is a comprehensive description and requirements for all expeditions.

*Dream with Passion and in the slot add a Lantern or Knock Lore. It will bring you Way: The wood. This guide at The Mansus section has a great explanation on how to open each location further and what you will find there. The idea here is to grab all the Secret Histories you can find and transform them into expeditions (as commented above). Expeditions bring a lot of Lore.

*If you already made/have all the expeditions of a certain level (they start to repeat the location), start to "merge" the same Secret Histories to get advanced levels of them.

*Some Lore books need to be translated. Some Patrons can translate those books if you pay them with Spintria. Patrons pays their commissions with Spintria or you can get it from expeditions. You will have to summon Teresa, King Crucible and Ezeem to learn Fucine, Deep Mandaic and Phrygian respectively.

A: maybe this will help:

Lore Fragments are a resource that can be obtained from studying some books, and some interactions. They can be upgraded by studying it with a fragment same aspect and level(or, for knock fragments, upgraded with any same level fragment except for secret histories). All fragments(except Secret Histories and Knock) can be subverted into another type of lore.

source


text:
Q: Change route files based upon URI path in Slim 3 Ok so I have 4 folders all which have their own route.php. So I would like to require the path to each folder based upon the uri path. So for example, if my website path is www.example.com/user then the Slim framework would require the path to controller/users/routes. I'm trying to achiee this using middleware but when I test it I get a "Call to a member function error" so how do I fix this.
Here is my code below:
 //determine the uri path then add route path based upon uri
$app->add(function (Request $request, Response $response, $next) {
    if (strpos($request->getAttribute('route'), "/user") === 0) {
        require_once('controllers/users/routes.php');
    } elseif (strpos($request->getUri()->getPath(), "/public") === 0) {
        require_once('controllers/public/routes.php');
    } elseif (strpos($request->getUri()->getPath(), "/brand") === 0) {
        require_once('controllers/brands/routes.php');
    }elseif (strpos($request->getUri()->getPath(), "/admin") === 0) {
        require_once('controllers/admin/routes.php');
    }elseif (strpos($request->getUri()->getPath(), "/") === 0) {
        require_once('routes.php');
    }

    $response = $next($request, $response);
    return $response;
});

So before anything the framework determines the route then adds the required path. But something is not functioning right, any ideas?

A: Well you shouldn't do this because it shouldn't take much time to register all routes.
But if you want todo this you weed to make some changes to you'r code:

*

*$request->getAttribute('route') doesn't return the path, it returns the route object of slim
If you want to use the path use $request->getUri()->getPath() instead (it doesn't start with a / so the route f.ex is (/customRoute/test it returns customRoute/test

*You need to use the $app as $this in this context is the ContainerInterface from Pimple and not the App of slim

*Make sure you didn't set determineRouteBeforeAppMiddleware inside the settings to true as it checks which route to execute before the middleware execution.
Here a running example:
$app = new \Slim\App();
$app->add(function($req, $res, $next) use ($app) {
    if(strpos($req->getUri()->getPath(), "customPath" ) === 0) {
        $app->get('/customPath/test', function ($req, $res, $arg) {
            return $res->write("WUII");
        });
    }
    return $next($req, $res);
});
$app->run();


text:
Q: How do I remove duplicates that have a difference of one word? I have a folder with thousands of zip files, many of which are the same but for different countries. E.g. I would have three files called:

*

*File 1 (USA)

*File 1 (World)

*File 1 (Europe)

How can I make it so that the world and europe get deleted. Also, i want priority. so that if there is only world and europe, world should be kept?

A: Making the assumption, that you don't care about the Country.  That is, all files will end up * (USA).

*

*Use FileExplorer to select all Europe Files, Move them to Folder E.

*Then Move all World Files to Folder W.

*Rename both these sets of files to *(USA)

*Now Move Folder E files to the original folder, and Skip, when asked.

*Repeat with Folder W

*Delete Folders E and W


text:
Q: Left Join Performance with addtional Left Table Filter Hi I am wondering if putting additional conditions in left joing will improve performance.
Example Code is below.
I only need to know the Price data for certain offers but will need need all offers data.
Just wondering if it's worth putting the additional join conditions to speed up performance?
SELECT
    *
FROM
    OFFERS
LEFT JOIN PRICE ON (
    PRICE.PH_SUBS_LINK_SK = ACTSUBS.PH_SUBS_LINK_SK and
    PRICE.PRICE_END_DT= '09-09-9999' and
    OFFERS.PERCENT_VALUE >0 and
    OFFERS.VALUE_OR_PERCENT = 'PERCENT' and
    OFFERS.PRODUCT_OFFER_TYPE = 'RC' and
    OFFERS.OFFER_STATUS_CODE in ('ACT','PTM')
    )

A: I suggest to change above code for this:
    SELECT
    *
FROM
    OFFERS
LEFT JOIN PRICE ON
    PRICE.PH_SUBS_LINK_SK = ACTSUBS.PH_SUBS_LINK_SK
WHERE PRICE.PRICE_END_DT= '09-09-9999' and
    OFFERS.PERCENT_VALUE >0 and
    OFFERS.VALUE_OR_PERCENT = 'PERCENT' and
    OFFERS.PRODUCT_OFFER_TYPE = 'RC' and
    OFFERS.OFFER_STATUS_CODE in ('ACT','PTM')

To improve performance create an index for the fields used on the where statement.


text:
Q: TBitmapImage is rendered larger than its size on scaled display in Inno Setup 6 Just updated to latest Inno Setup v.6.0.3. But now I get white borders in my TBitmapImage image. The script below worked just fine with the older version 5.
So, what's seems to be wrong with the newer version and the script I have been using for years?
Please note that I have scaled my display about 125%.
ExtractTemporaryFile(ExpandConstant( '{#BackgroundImage}' ));
BackgroundBitmapImage := TBitmapImage.Create(MainForm);
BackgroundBitmapImage.Left := 0;
BackgroundBitmapImage.Top := 50;
BackgroundBitmapImage.AutoSize := True;
BackgroundBitmapImage.Bitmap.LoadFromFile( ExpandConstant('{tmp}\{#BackgroundImage}')  );
BackgroundBitmapImage.Parent := MainForm;

Neither the exact size of the image fixed the problem.
ExtractTemporaryFile(ExpandConstant( '{#BackgroundImage}' ));
BackgroundBitmapImage := TBitmapImage.Create(MainForm);
BackgroundBitmapImage.Left := 0;
BackgroundBitmapImage.Top := 50;
BackgroundBitmapImage.Width := 600;
BackgroundBitmapImage.Height := 500;
BackgroundBitmapImage.AutoSize := False;
BackgroundBitmapImage.Bitmap.LoadFromFile( ExpandConstant('{tmp}\{#BackgroundImage}')  );
BackgroundBitmapImage.Parent := MainForm;

A: The display, where your MainForm window is located, is scaled/zoomed.
When you set the .Parent, the control is rescaled to the target display. To prevent that, set the .Parent before (implicitly) setting the size.
ExtractTemporaryFile('{#BackgroundImage}');
BackgroundBitmapImage := TBitmapImage.Create(MainForm);
BackgroundBitmapImage.Parent := MainForm;
BackgroundBitmapImage.Left := 0;
BackgroundBitmapImage.Top := 50;
BackgroundBitmapImage.AutoSize := True;
BackgroundBitmapImage.Bitmap.LoadFromFile(
  ExpandConstant('{tmp}\{#BackgroundImage}'));

Note that there's no need to call ExpandConstant for '{#BackgroundImage}', as it does not contain any constant.


text:
Q: NMOS IV characteristics turned out to be different with same configuration I am ploting the IV characteristics of the NMOS.
Here I sweep the Vgate and the VDS.
note that the Vdc=-Vg has a minus sign, so Vg is actually positive.
The only difference between the 2 setup is that in one I put the positive drain voltage at the top. The other one I put the positive drain voltage at the bottom.
But why I am getting 2 different IV characteristic results? should't they be the same?


text:
Q: Selecting JavaScript Dropdown in Selenium I'm just brushing up on my selenium and have this problem. I'm popultaing the google sign in page at https://accounts.google.com/signup. I'm trying to enter the value 'February' in the Birth Month Field. Since I cannot use the select option here, i'm clicking on it to expand, and the waiting for a while and the clicking on the xpath of the option February.
    //Setting up the Birthday
    w1=d1.findElement(By.xpath(".//*[@id='BirthMonth']"));
    System.out.println(w1.getText());
    w1.click();
    Thread.sleep(3000);

    d1.findElement(By.xpath(".//*[@id=':2']")).click();
    d1.findElement(By.id("BirthDay")).sendKeys("17");
    d1.findElement(By.id("BirthYear")).sendKeys("1982");

But it does not select anything. Nor does it throw an error. It behaves as though I clicked outside the box and closed it. The page says 'you cannot leave this option blank' and my code terminates. Why could this be happening? Could this be an issue with the finder for the option February?


text:
Q: Convert Date to Fiscal Period with C# Is there a standard or convenient way to get the current financial period in a custom workflow activity and use it to convert a calendar date field to it's financial date?
Fiscal periods are monthly.
Manually removing months from the date field to get the fiscal date is not really an option.
I have found this set, but it is empty:
XRMServices/2011/OrganizationData.svc/MonthlyFiscalCalendarSet

A: I found this
<d:FiscalCalendarStart m:type="Edm.DateTime">
    2013-10-01T10:59:00Z
</d:FiscalCalendarStart>

in

/XRMServices/2011/OrganizationData.svc/OrganizationSet

This method returns the fiscal period (as month) from a calendar date:
/* returns month, year */
private Tuple<int, int> GetFinancialDate(WorkflowContext context, DateTime? date)
{
    var start = context.Linq.OrganizationSet
        .FirstOrDefault().FiscalCalendarStart;
    if (date.HasValue && start.HasValue)
    {
        var localDate = date.Value.ToLocalTime();
        var month = localDate.Month - start.Value.ToLocalTime().Month + 1; // +1 because not 0 based
        var year = (localDate.Month == 1) ? localDate.Year : localDate.Year + 1; // if it is Jan then do not move the year forward - move forward for Feb onward
        if (month <= 0) // the date is in the previous financial year, 0 would be the last period of the previous fiscal year
        {
            --year; // move to the previous year
            month = month + 12; // month is negative or 0 before this, so is 12 or less after
        }
        return Tuple.Create(month, year);
    }
    return Tuple.Create(0, 0);
}


text:
Q: Angular ng-select : selectedItems.map is not a function When I'm using ng-select in reactive form angular I get this error:

ERROR TypeError: selectedItems.map is not a function

I have 3 select the first two work very well but in this third one I get the error ! to map item i'm using the function (the ng-select is inside *ngFor) :
//for mappinig item :
mapLabelValueBS(objet) {
return objet.map(data => {
 return {
   id: data,
   text: data.name
 }
})
}
//this is the one that is causing the problem
<ng-select
  [allowClear]="true"
  [items]="mapLabelValueBS(filieres)"
  placeholder="Filière non sélectionné"
  (selected)="selecteFiliere($event)"
  formControlName="filiere">
</ng-select>

the result in my page (when I click on the field it doubles itself) :

A: Without the code is difficult to know, but today I had the same error. The reason was that I determined a default value in the FormControl that had no relation with the array that ng-select demands. When the FormGroup loaded, and this mistaken default was loaded into the ng-select, the error was selectedItems.map is not a function

A: This error came while I was passing [items]="value" where the value was not an array, so please check if you are not passing non array element to items binding.

A: You are trying to bind the items of object type. [items] attribute accepts an array. You can trying adding a pipe keyvalue
<ng-select
  [allowClear]="true"
  [items]="jsonData | keyvalue"
  placeholder="Filière non sélectionné"
  (selected)="selecteFiliere($event)"
  formControlName="filiere">
</ng-select>

A: few days ago i came across this error if you are binding a list that is filled from backend server be sure to fill the list using concat method like this
   this.userService.getLookup().subscribe((res: any) => {
        this.apps = this.apps.concat(res.data);
    });

A: I had same problem, because the list of items was undefined sometime in the middle of page preparing, so I added a silly condition to show those select only when the list of items is ready:
<ng-select
  *ngIf="selectedItems.map"
  [allowClear]="true"
  [items]="jsonData | keyvalue"
  placeholder="Filière non sélectionné"
  (selected)="selecteFiliere($event)"
  formControlName="filiere">
</ng-select>


text:
Q: How do I resolve Uncaught TypeError: Cannot read properties of undefined (reading 'map')? This is my code. Unable to resolve this error I am getting in the console and nothing is printed when I run the file.
import React from 'react';
import axios from 'axios';
import { Grid } from '@mui/material';
import { Box } from '@mui/material';

class TableGen extends React.Component {
  constructor() {
    super();
    this.state = {
      tableData: [],
    };
  }
  componentDidMount() {
    const res = axios
      .post(
        'https://us-central1-stockmarketcharting-8c469.cloudfunctions.net/server/performance/getbest'
      )
      .then((res) => {
        this.setState({ tableData: res.array });
      });
  }

  render() {
    return (

        {this.state.tableData.map((row) => {
          return (
            <Grid item sm={6}>
              {row.data.price}
            </Grid>
          );
        })}

    );
  }
}
export default TableGen;

I am getting a Cannot read properties of undefined error. Any suggestions on how to resolve this would be appreciated.

A: Response of axios call comes with data object so everything you'll get is inside it like array, price, items , etc ..
i would try to log res.data to the console and see the response object, there you'll find out what it contains and the required data you need :
import React from 'react';
import axios from 'axios';
import { Grid } from '@mui/material';
import { Box } from '@mui/material';

class TableGen extends React.Component {
  constructor() {
    super();
    this.state = {
      tableData: [],
      // add some flag
      isErrorFetching: false
    };
  }
  componentDidMount() {
    const res = axios
      .post(
        'https://us-central1-stockmarketcharting-8c469.cloudfunctions.net/server/performance/getbest'
      )
      .then((res) => {
        console.log("response ===>>> ", res.data);
        this.setState({ tableData: res.data });
      })
      .catch(err => {
        this.setState({ tableData: [], isErrorFetching: true });
      })
  }

  render() {
    if (isErrorFetching) {
     return
Something went wrong!

    }
    if (!tableData.length) {
     return
There are no items found!

    }

    return (

        {this.state.tableData.map((row) => {
console.log("row ::: ", row);
          return (
// ensure there is a price property
            {row?.data?.price && (
             <Grid item sm={6}>
              {row.data.price}
             </Grid>
            )}
          );
        })}

    );
  }
}
export default TableGen;

Let's assume the res.data is an array, then you cannot get the price from the item of array, then let's log the row to the console to see if it contains price or any other required data .


text:
Q: Determining whether a transformation is linear based on input and output coordinates I was asked to check if there is a linear transformation that lives up to the requirements. If so, I should come up with T(x,y,x). Otherwise, I should explain why not.
a) $T:R^3 \to R^2$, so that $T(0,2,-1)=(-1,3)$, $T(2,-2,-1)=(1,4)$ and $T(1,-4,1)=(2,1)$.
b) $T:R^3 \to R^2$, so that $T(1,1,-1)=(-1,3)$, $T(1,1,1)=(1,4)$ and $T(1,0,1)=(2,1)$.
The way I resolved it was as follows:
a) I created the following matrices:
$$\begin{matrix}a&b&c\\d&e&f\end{matrix}$$
multiplied by
$$\begin{matrix}0&2&1\\2&-2&4\\-1&-1&1\end{matrix}$$
equals
$$\begin{matrix}-1&1&2\\3&4&1\end{matrix}$$
Then I wrote down the resulting two sets of equations. First:
2b-c=-1
2a-2b-c=1
a-4b+c=2
and resolved this through a matrix.
Next:
2e-f=3
2d-2e-f=4
d-4e+1f=1
and tried to resolve this via a matrix, but there was a contradiction, so no solutions. I assumed that meant that the transformation is not linear.
I did exactly the same for b), but this time the resulting two systems of equations both came out with one solution each. I assumed that this means this is indeed a linear transformation.
Is the reasoning correct?
Thank you!

A: Actually, the transformation in the first case is also linear. To find the matrix we just have to set up the linear system of equations
$$
\begin{bmatrix}a&b&c\\d&e&f\end{bmatrix}
\begin{bmatrix}0&2&1\\2&-2&4\\-1&-1&1\end{bmatrix}=
\begin{bmatrix}-1&1&2\\3&4&1\end{bmatrix}.
$$
The square matrix of the system is invertible, hence, the solution is
$$
\begin{bmatrix}a&b&c\\d&e&f\end{bmatrix}=
\begin{bmatrix}-1&1&2\\3&4&1\end{bmatrix}
\begin{bmatrix}0&2&1\\2&-2&4\\-1&-1&1\end{bmatrix}^{-1}
$$
Similar system can be solved in the second case.


text:
Q: ExcelJS node: is there a method/ module for converting xlsx to json in exceljs https://github.com/guyonroche/exceljs
I m new to exceljs and just see the description of exceljs at github i

.e : "Read, manipulate and write spreadsheet data and styles to XLSX
  and JSON."

I need to convert workbook into JSON object and did not find any method / module like for csv in exceljs.
let me know if there is one.

A: I know this question is old but I am posting an answer for others who may be in the same position I am today.
Yes, there is.
I was looking for the same answer as you, but without success. After a bit of search, I found a way to do it.
import Exceljs from 'exceljs';

const workbook = new Exceljs.Workbook();
await workbook.xlsx.load(data);
const json = JSON.stringify(workbook.model);
console.log(json); // the json object

I combined the response to this issue and Exceljs' read me to figure it out. I hope this helps.

A: It's very simple to get values from excel file using exceljs.
const book = [];
workbook.eachSheet( sheet => {
  const sheet = [];
  worksheet.eachRow(row => {
    sheet.push(row.values);
  });
book.push(sheet);
});

But take a look on array indexes. Cells usually starts from 1.

A:     // data
    let excelTitles = [];
    let excelData = [];

    // excel to json converter (only the first sheet)
    workbook.worksheets[0].eachRow((row, rowNumber) => {
        // rowNumber 0 is empty
        if (rowNumber > 0) {
            // get values from row
            let rowValues = row.values;
            // remove first element (extra without reason)
            rowValues.shift();
            // titles row
            if (rowNumber === 1) excelTitles = rowValues;
            // table data
            else {
                // create object with the titles and the row values (if any)
                let rowObject = {}
                for (let i = 0; i < excelTitles.length; i++) {
                    let title = excelTitles[i];
                    let value = rowValues[i] ? rowValues[i] : '';
                    rowObject[title] = value;
                }
                excelData.push(rowObject);
            }
        }
    })
    console.log(excelData);
    return;


text:
Q: C# if statement with multiple or conditions not returning expected behavior I have an if statement that will display a .CSHTML Layout under the following conditions:
    @if ((ViewBag.title != "Log in")
    || (ViewBag.title != "Register")
    || (ViewBag.title != "Confirm Email")
    || (ViewBag.title != "Login Failure")
    || (ViewBag.title != "Forgot your password?")
    || (ViewBag.title != "Forgot Password Confirmation")
    || (ViewBag.title != "Reset password")
    || (ViewBag.title != "Reset password confirmation")
    || (ViewBag.title != "Send")
    || (ViewBag.title != "Verify"))
{ Layout markup }

When I load the Log in page; however, the Layout template appears. Setting a breakpoint shows that the page title correctly corresponds to the != "Log in" condition and no exceptions are being thrown. Just to be sure, I checked my markup against the solution in this post and it appears to be fine... Have a screwed up my statement logic somehow and just don't see it?

A: you want &&, not || here.  Your logic is faulty, your condition will always be true.

A: Your condition always evaluates to true. Consider following condition:
if(value != "A" || value != "B")

It's always true, because value can't be equal to A and B at the same time.
What you're looking for is &&
@if ((ViewBag.title != "Log in")
&& (ViewBag.title != "Register")
&& (ViewBag.title != "Confirm Email")
... )
{ Layout markup }

A: Use the && opreator, in your current state your condition its always true..


text:
Q: Why does the tabbar items label change when Pushing using UINavigationController? I created UITabController with three tabs. One Tab has UINavigationController that pushes three controllers A,B, &C.
When I push segue from A to B or B to C, I change the titles on A, B, &C. Changing the title on A, B or C also changes the title of my third tab item in the main tabController. How can I make the tab bar items labels on the main Controller fixed?

A: I had the same problem and this thread fixed my problem: self.title sets navigationController and tabBarItem's title? Why?
You basically need to set your title in your viewDidLoad method in your UIViewController (which is displayed by the UINavigationController) like this:
self.navigationItem.title = @"Your Title";

instead of this
self.title = @"Your Title";


text:
Q: Display custom tooltip as Balloon I am using a custom tooltip class in my WinForm application. It works great. But i would like to show it as a Balloon. Here is my code-
class CustomToolTip : ToolTip
{
    public CustomToolTip()
    {
        this.OwnerDraw = true;
        this.Popup += new PopupEventHandler(this.OnPopup);
        this.Draw += new DrawToolTipEventHandler(this.OnDraw);
    }

    private void OnPopup(object sender, PopupEventArgs e) // use this event to set the size of the tool tip
    {
        e.ToolTipSize = new Size(200, 100);
    }

    private void OnDraw(object sender, DrawToolTipEventArgs e) // use this event to customise the tool tip
    {
        Graphics g = e.Graphics;

        LinearGradientBrush b = new LinearGradientBrush(e.Bounds,
            Color.GreenYellow, Color.MintCream, 45f);

        g.FillRectangle(b, e.Bounds);

        g.DrawRectangle(new Pen(Brushes.Red, 1), new Rectangle(e.Bounds.X, e.Bounds.Y,
            e.Bounds.Width - 1, e.Bounds.Height - 1));

        g.DrawString(e.ToolTipText, new Font(e.Font, FontStyle.Bold), Brushes.Silver,
            new PointF(e.Bounds.X + 6, e.Bounds.Y + 6)); // shadow layer
        g.DrawString(e.ToolTipText, new Font(e.Font, FontStyle.Bold), Brushes.Black,
            new PointF(e.Bounds.X + 5, e.Bounds.Y + 5)); // top layer

        b.Dispose();
    }
}

Any suggestion?
Thanking you in anticipation.

A: You could just draw an ellipse then add a piece to point to the target.
But why not use the default tooltip control.
It has a IsBalloon flag that when set to true looks like this:


text:
Q: How could I execute 'apt-get install' on docker ubuntu contain? firstly, I installed and ran docker contain using below command.
docker run -i -t ubuntu /bin/bash

Then I executed below commands.
root@d444a77039e7:/# apt-get update
0% [Connecting to archive.ubuntu.com (91.189.92.200)]

It blocked all the time.
Then I ran the below command, but met issues.
root@d444a77039e7:/# apt-get install nodejs
Reading package lists... Done
Building dependency tree
Reading state information... Done
E: Unable to locate package nodejs

Then I set the http and https proxy like below, but it failed as well.
root@d444a77039e7:/# export HTTP_PROXY=http://proxy.xxx.com
root@d444a77039e7:/# export HTTPS_PROXY=http://proxy.xxx.com

Could you tell me how can I fix this issue? thanks. My host machine is redhat5.9 which does not support latest version of nodejs. So I plan to install it on docker engine.

A: Try with small letters.
export http_proxy=http://proxy.xxx.com
export https_proxy=http://proxy.xxx.com

The proper way to overtake this issue is, you can create a new image with below Dockerfile, with that, you needn't manually set it any more.
FROM ubuntu
ENV http_proxy http://proxy.xxx.com
ENV https_proxy http://proxy.xxx.com

A: That means your docker build has not been started with the new docker 1.9+ build-arg arguments. That will avoid putting the full proxy (which can include sometimes your credentials) in the Dockerfile:

You can use ENV instructions in a Dockerfile to define variable values. These values persist in the built image. However, often persistence is not what you want. Users want to specify variables differently depending on which host they build an image on.
A good example is http_proxy or source versions for pulling intermediate files. The ARG instruction lets Dockerfile authors define values that users can set at build-time using the --build-arg flag:

$ docker build --build-arg HTTP_PROXY=http://10.20.30.2:1234 .

This flag allows you to pass the build-time variables that are accessed like regular environment variables in the RUN instruction of the Dockerfile. Also, these values don't persist in the intermediate or final images like ENV values do.


text:
Q: Why does this Query return "OK"? about "delete" +------------+--------+----------+-------+-----+--------+
| customerid | id     | password | level | age | name   |
+------------+--------+----------+-------+-----+--------+
|          1 | L1234  | 12345A   | J1    |  24 |        |
|          2 | L12134 | 12345a   | J1    |  23 | SYPARK |
+------------+--------+----------+-------+-----+--------+
2 rows in set (0.00 sec)

mysql> DELETE FROM customer WHERE age='23';

1.  Query OK, 1 row affected (0.00 sec)
mysql> DELETE FROM customer WHERE age='23';

2.  Query OK, 0 rows affected (0.00 sec)
at this situation. why does this Query return "OK"? which is number 2.
I thought it would not work(get the Error). because the data isn't exist that was removed before Query number of 2.
but I got the result of OK. Why is this like this?

A:
at this situation. why does this Query return "OK"?

Query OK just means that the query executed without errors (either syntax errors or runtime errors) - which is the case here: the query did not fail, it just did not find any record to delete.
You can see in the remaining of the message, however, that the query did not affect any row; this being a DELETE statement, it means that no rows was deleted.