text:
Q: Magento2 How to add column in sales order item renderer in admin order view I have two custom fields in sales_order_item table. Now i want to show that two fields in sales order item section. I tried this solution. But it is always adding new column at the end.
So, how i can add my custom column after Item status and also should be editable? Like attached example.

A: Finally i found the solution. Using this code i am able to arrange columns as per my requirement.
<referenceBlock name='order_tab_info'>
            <block class="Magento\Sales\Block\Adminhtml\Order\View\Items" name="order_items" template="Magento_Sales::order/view/items.phtml">
                <arguments>
                    <argument name="columns" xsi:type="array">
                        <item name="sku" xsi:type="string" translate="true">SKU</item>
                        <item name="product" xsi:type="string" translate="true">Product</item>
                        <item name="status" xsi:type="string" translate="true">Item Status</item>
                        <item name="product-cost" xsi:type="string" translate="true">Product Cost</item>
                        <item name="ship-cost" xsi:type="string" translate="true">Ship Cost</item>
                        <!-- <item name="price-original" xsi:type="string" translate="true">Original Price</item> -->
                        <item name="price" xsi:type="string" translate="true">Price</item>
                        <item name="ordered-qty" xsi:type="string" translate="true">Qty</item>
                        <item name="subtotal" xsi:type="string" translate="true">Subtotal</item>
                        <item name="tax-amount" xsi:type="string" translate="true">Tax Amount</item>
                        <item name="tax-percent" xsi:type="string" translate="true">Tax Percent</item>
                        <item name="discont" xsi:type="string" translate="true">Discount Amount</item>
                        <item name="total" xsi:type="string" translate="true">Row Total</item>
                    </argument>
                </arguments>
                <block class="Magento\Sales\Block\Adminhtml\Order\View\Items\Renderer\DefaultRenderer" as="default" name="default_order_items_renderer" template="Magento_Sales::order/view/items/renderer/default.phtml">
                    <arguments>
                        <argument name="columns" xsi:type="array">
                            <item name="sku" xsi:type="string" translate="false">col-sku</item>
                            <item name="product" xsi:type="string" translate="false">col-product</item>
                            <item name="status" xsi:type="string" translate="false">col-status</item>
                            <item name="product-cost" xsi:type="string" translate="false">col-product-cost</item>
                            <item name="ship-cost" xsi:type="string" translate="false">col-ship-cost</item>
                            <!-- <item name="price-original" xsi:type="string" translate="false">col-price-original</item> -->
                            <item name="price" xsi:type="string" translate="false">col-price</item>
                            <item name="qty" xsi:type="string" translate="false">col-ordered-qty</item>
                            <item name="subtotal" xsi:type="string" translate="false">col-subtotal</item>
                            <item name="tax-amount" xsi:type="string" translate="false">col-tax-amount</item>
                            <item name="tax-percent" xsi:type="string" translate="false">col-tax-percent</item>
                            <item name="discont" xsi:type="string" translate="false">col-discont</item>
                            <item name="total" xsi:type="string" translate="false">col-total</item>
                        </argument>
                    </arguments>
                </block>
                <block class="Magento\Sales\Block\Adminhtml\Items\Column\Qty" name="column_qty" template="Magento_Sales::items/column/qty.phtml" group="column"/>
                <block class="Magento\Sales\Block\Adminhtml\Items\Column\Name" name="column_name" template="Magento_Sales::items/column/name.phtml" group="column"/>
                <block class="Magento\Sales\Block\Adminhtml\Items\Column\DefaultColumn" name="column_sku" template="HK_CustomField::items/column/sku.phtml" group="column"/>
                <block class="Magento\Sales\Block\Adminhtml\Items\Column\DefaultColumn" name="column_product-cost" template="HK_CustomField::items/column/product_cost.phtml" group="column" />
                <block class="Magento\Sales\Block\Adminhtml\Items\Column\DefaultColumn" name="column_ship-cost" template="HK_CustomField::items/column/ship_cost.phtml" group="column" />
                <block class="Magento\Framework\View\Element\Text\ListText" name="order_item_extra_info"/>
            </block>
        </referenceBlock>


text:
Q: Firebase Real-time database with SwiftUI I'm searching 3 days now for a tutorial in firebase real time database and not firestore and i can't find anything.
I just want to retrieve some data from my db and then display it on a list
Can someone help me?
Thanks

A: Take a look at the new Firebase Quickstart for Real Time Database at https://github.com/firebase/quickstart-ios/tree/master/database/DatabaseExampleSwiftUI/DatabaseExample. It's still in progress, but should be enough to get you started.

redpajama_set_name: RedPajamaStackExchange


text:
Q: Can't use pool.map for a class method in ROS Python I have a time-consuming function which is called many times with different input arguments. I am trying to parallelize it by using the Pool from the multiprocessing module in Python 3. Please see a sample code below:
#! /usr/bin/env python3

import rospy
import actionlib
import multiprocessing as mp
from actionlib_tutorials.msg import FibonacciAction, FibonacciResult

def time_taking_task(n):
    # only for debugging
    a, b = 0, 1
    for _ in range(0, n):
        a, b = b, a + b
    return a

class FibonacciActionClass(object):
    def __init__(self, name):
        self._as = actionlib.SimpleActionServer(
            name,
            FibonacciAction,
            execute_cb=self.cb,
            auto_start=False,
        )
        self._as.start()

    def time_taking_task(self, n):
        # only for debugging
        a, b = 0, 1
        for _ in range(0, n):
            a, b = b, a + b
        return a

    def cb(self, goal):
        result = FibonacciResult()
        result.sequence.append(0)
        with mp.Pool(processes=4) as pool:
            nums = pool.map(self.time_taking_task, list(range(1, goal.order + 1)))  # doesn't work
            # nums = pool.map(time_taking_task, list(range(1, goal.order + 1))) # works
        result.sequence.extend(nums)
        self._as.set_succeeded(result)

if __name__ == "__main__":
    rospy.init_node("fibonacci")
    server = FibonacciActionClass(rospy.get_name())
    rospy.spin()

The map method takes a function and an iterable object. Giving time_taking_task as function works but self.time_taking_task throws the following error:
[ERROR] [1643875827.675670]: Exception in your execute callback: cannot pickle '_thread.RLock' object
Traceback (most recent call last):
  File "/opt/ros/noetic/lib/python3/dist-packages/actionlib/simple_action_server.py", line 289, in executeLoop
    self.execute_callback(goal)
  File "/home/user/ros_ws/src/actionlib_tutorials/scripts/fibonacci_server.py", line 34, in cb
    nums = pool.map(self.time_taking_task, list(range(1, goal.order + 1)))
  File "/usr/lib/python3.8/multiprocessing/pool.py", line 364, in map
    return self._map_async(func, iterable, mapstar, chunksize).get()
  File "/usr/lib/python3.8/multiprocessing/pool.py", line 771, in get
    raise self._value
  File "/usr/lib/python3.8/multiprocessing/pool.py", line 537, in _handle_tasks
    put(task)
  File "/usr/lib/python3.8/multiprocessing/connection.py", line 206, in send
    self._send_bytes(_ForkingPickler.dumps(obj))
  File "/usr/lib/python3.8/multiprocessing/reduction.py", line 51, in dumps
    cls(buf, protocol).dump(obj)
TypeError: cannot pickle '_thread.RLock' object

I believe ROS isn't allowing the Pool somehow. Any workaround, please?

A: If you want to run a function in a python mutliprocessing subprocess, the function and all its arguments must be pickable. As self is one of the arguments for the function you are passing to the pool, your class seems to be not pickable. This seems to be due to actionlib.SimpleActionServer nit being pickable due to the RLock object. See this website for what types are pickable by default.
You could either try using another library like pathos instead of multiprocessing, as it uses a different way of pickling objects. Or, you could try to move your function out of your class and pass data that resides in your class and that has to be used by the function as function arguments.


text:
Q: Dimension of a subspace smaller than dimension of intersection Suppose I have a finite-dimensional vector space $V$, and $U_1, U_2$ are subspaces of $V$, such that $U_1\nsubseteq U_2$.
Is it possible that $\dim{U_1}\leq\dim{U_1 \cap U_2}$?

A: In general, $\dim (U_1 \oplus U_2) = \dim U_1 + \dim U_2 - \dim(U_1 \cap U_2)$. Hence, $$\dim U_1 = \dim(U_1 \cap U_2) \implies \dim U_2 = \dim (U_1 \oplus U_2) \implies U_1 \subset U_2.$$

A: Fact: If $X$ is a subspace of the finite dimensional vector space $Y,$ and $\dim X = \dim Y,$ then $X=Y.$ Hence if $\dim U_1 \le \dim U_1\cap U_2,$ then $\dim U_1 = \dim U_1\cap U_2,$ hence $U_1\cap U_2$ equals $U_1.$ This implies $U_1 \subset U_2,$ contradiction.


text:
Q: Mongoose findOneAndUpdate() deep nested structure I am building a mock customer satisfaction app. It will include a questions and answers section where the user can click a yes or no button to indicate whether an answer to a specific question was helpful or not. I am trying to write a PATCH method that can increment this yes/no property, but am having trouble with accessing the property. My data is an array of objects, each object is formatted like this:
    {
    "_id": "5f70eba3f66102b605e9b513",
    "question_id": 7,
    "product_id": 81,
    "created_at": "2020-09-07T15:49:10.232Z",
    "user": "Jerome_Rice12",
    "question_body": "Et aliquam ea doloribus.",
    "answers": [
        {
            "helpful": {
                "yes": 0,
                "no": 3
            },
            "_id": "5f70eba3f66102b605e9b514",
            "answer_id": 2713,
            "created_at": "2020-01-17T03:07:41.298Z",
            "body": "Est voluptatum iure necessitatibus aut et.",
            "user": "Travon.Gottlieb"
        },
        { more answer objects },
    ],
    "__v": 0
},
{ more question objects },

To access the yes or no property, I first have to find the relevant question id, then the correct answer id, then go in and update the answers.helpful.yes/no property. Each attempt so far has failed with postman. I have tried many different formats of the following - nothing has worked so far. Any help will be appreciated.
const quesId = req.params.question_id;
const ansId = req.params.answer_id;

Questions.findOneAndUpdate({
question_id: quesId, answers: { answer_id: ansId } },
  { $inc: { 'answers.$.helpful.$.no': 1 } }).exec()
.then((data) => {
  res.send(data);
});

A: Try this:
Questions.findOneAndUpdate({
    question_id: quesId,
    'answers.answer_id': ansId
},
{
    $inc: {
        'answers.$.helpful.no': 1
    }
})


text:
Q: django haystack unable to remove stale records - AttributeError: Nonetype object has no attribute '_meta' I am using django-haystack 2.4.1 version with elasticsearch and django 1.8.11
I am having issues while updating the index with remove parameter. If some of my models get deleted and then if I run
./manage.py update_index --remove

I get the error AttributeError: Nonetype object has no attribute '_meta'
I checked the trace and found out that the error is coming from default_get_identifier method
default_get_identifier
    return u"%s.%s" % (get_model_ct(obj_or_string),

Here as the model is deleted already, get_model_ct returns the attribute error.
Then I found out about the HAYSTACK_IDENTIFIER_METHOD parameter, so I thought of defining my own method which is mentioned below
def getHaystackIdentifier(obj_or_string):
    return (str(obj_or_string)+"."+str(obj_or_string._get_pk_val()))

But the fundamental problem remains same as obj_or_string model is already deleted from the database,
How can I get the identifier of the stale records and delete them from index?
Shouldn't haystack automatically delete the records if model is not found corresponding to that? I am not sure if I am missing something here

A: I was able to solve this issue. The problem was HAYSTACK_ID_FIELD defined in django settings file as my field name (id) was colliding with the default haystack field. http://django-haystack.readthedocs.io/en/v2.4.1/settings.html#haystack-id-field
I changed my field name to something else and removed this setting and everything seems to be working fine. Note that even if I change my field name but don't remove this entry from settings file, it still gives me error.
Check the full trace of this error on github issues here
https://github.com/django-haystack/django-haystack/issues/1380


text:
Q: Notification bar getting black when showing SnackBar I'm using SnackBar in my android lolypop app. Every thing going fine but when SnackBar is open, notification Bar gets black, and when SnackBar close again notification bar looks fine as defines.
Here is code:
    SnackBar snackbar = new SnackBar(ActivityName.this,
            "msg", "OK",
            new View.OnClickListener() {

                @Override
                public void onClick(View v) {
                }
            });
    snackbar.show();


text:
Q: Vector space exercise The set of all triples of real numbers $(x,y,z)$ with the operations $(x,y,z)+(x´,y´,z´)=(x+x´,y+y´,z+z´$) and $k(x,y,z)=(kx,y,z)$.
Show if the set of objects given with operations of addition and scalar multiplication is a vector space.
According to the solutions axiom 8)$(k+l)u=ku+lu$ fails.
However I cannot understand why since $ku=(kx,y,z)$ and $lu=(lx,y,z)$, therefore $(k+l)u==ku+lu$
What am I doing wrong?

A: Say $(x,y,z)=(1,1,1)$ and $k=l=1.$ Then $(k+l)(x,y,z)=2(1,1,1)=(2,1,1),$ but $k(x,y,z)+l(x,y,z)=(1,1,1)+(1,1,1)=(2,2,2).$

A: In a vector space, $0v=0$ for all $v$, but in your space $0(1,1,1)=(0,1,1) \ne 0$.


text:
Q: jQuery, detecting actual input text value I'm running into an issue where the value grabbed by jQuery, and what's actually in the input text field, are different.
A form with a variety of inputs are populated when the page loads with information from our database. Thus, the input text fields all have a value.
When the form is submitted, I have a function that runs first to check for text inputs. This is a portion of that function:
$("form#accountSettingsForm input").each(function(){
var input = $(this);
var value = input.attr("value");
}

Lets say the input value is 12 when the page had initially loaded. If I delete the 12 in the textbox and leave the field blank, and submit the form, the above code retrieved "value" is still 12, not empty.
How can I detect what's actually the textbox's value? Thanks in advance.

A: This is a situation where there's a difference between the value attribute and the value property. The attribute comes from the HTML, the property is from the dynamic state of the DOM. To get the current value of an input after the user has modified it, use the jQuery .val() method.

$("#accountSettingsForm").submit(function() {
  $(this).find("input").each(function() {
    var input = $(this);
    var value = input.val();
    console.log(this.name + " = " + value);
  });
  return false;
})

<form id="accountSettingsForm">
  Input 1:
  <input name="field1" type="text">

Input 2:
  <input name="field2" type="text">

  <input name="submit" type="submit">
</form>

A: The following appears to work well. If you want to regularly remember/store the value, register for the on('input') event. With this, you get an event every time the user types in the textbox:
$("#accountSettingsForm :input").on('input', function() {
    console.log($(this).val());
});

As far as I can tell, the $(this).val() method of access works fine.
Here's a JSFiddle: https://jsfiddle.net/uz8k7rjp/
And the original post where I got this method: JQuery: detect change in input field


text:
Q: Variable manipulation in Oracle So I've been digging around on the net all afternoon to find the answer to this. I have a table that looks like so:
CREATE TABLE ldap_domains (
    domain varchar(128) NOT NULL,
    name varchar(16) NOT NULL,
    description varchar(32) NOT NULL
)

ALTER TABLE ldap_domains
ADD CONSTRAINT pk_domain PRIMARY KEY (domain);

INSERT INTO ldap_domains VALUES ('test', 'test', 'test');
INSERT INTO ldap_domains VALUES ('test1', 'test', 'test');
INSERT INTO ldap_domains VALUES ('test2', 'test', 'test');
INSERT INTO ldap_domains VALUES ('test3', 'test', 'test');

I need to modify this table so that a new column becomes the primary key. As part of this I need to update the new column with unique values before the constraint is applied. This looks like so:
ALTER TABLE ldap_domains
DROP CONSTRAINT pk_domain;

ALTER TABLE ldap_domains
ADD id int;

DECLARE @key int
SET @key = 0
UPDATE ldap_domains SET @key = id = @key + 1;

ALTER TABLE ldap_domains
ALTER COLUMN id int NOT NULL;

ALTER TABLE ldap_domains
ADD CONSTRAINT pk_id PRIMARY KEY (id);

This works as expected with SQLServer, however, I need this to work for Oracle as well. Essentially the section Oracle doesn't like is:
DECLARE @key int
SET @key = 0
UPDATE ldap_domains SET @key = id = @key + 1;

Can anyone enlighten me?

A: The sytnax is not correct for Oracle.
You could try something like
declare
  v_key integer := 0;
begin
  update ldap_domains
  set ldap_domains.key = v_key+1;
end;

I suggest you brush up on PL/SQL syntax, it's a bit different. This code sample above is just a starting point, you will probably have a bit more work to do, and it would look differnent if you wanted to do it in a sqlplus script but not use PL/SQL blocks.
I also admit I'm confused about what SET @key = id = @key + 1; will do, so I'm not 100% sure how to translate it. Is this a SQL-Server feature? What will be the result of this statement?

A: It appears that what you're trying to do is initially set each row to have a different ID.  The preferred way to do this in Oracle is to use a sequence:
CREATE SEQUENCE seq_ldap_domains START WITH 0;

UPDATE ldap_domains SET id = seq_ldap_domains.nextval;

This will not guarantee that the inserted values are sequential (though, in this case, they likely will be), if that's relevant.
Since it is not likely that you will have any other processes updating the field at the same time, it's probably safe to cheat a little and use something like this, if you really don't want to create a sequence:
UPDATE ldap_domains SET id = rownum-1;

As far as I know, you can't simultaneously read and set an environment variable on a per-row basis in Oracle.


text:
Q: Codeigniter - custom configuration files loaded depending on machine I was wondering if there is a way of telling codeigniter to use different autoload/database config when deployed on different machine ?
Aim is to have 2 separate files for config files so it will look something like this:
autoload and autoload-server
database and database-server
config and config-server

So i can just deploy app to the server and not worry about changing stuff in these files as codeigniter will automatically use ...-server config files and when on dev machine it will use the other files.
Simple flagging could be done via method like that
public function determineHost() {
    $addr = $_SERVER['SERVER_ADDR'];
    $name = $_SERVER['SERVER_NAME'];

    if($addr == "remote ip" || $name == "remote host name") {
        return "server";
    }
    if(($addr == "127.0.0.1" || $addr == "::1") || $name == "localhost") {
        return "local";
    }
}

and i could have a method which will tell codeigniter to use -server files
public function confSelector() {
    if("server"){
        use server specific configuration
    }
    if("local") {
        use local specific configuration
    }
}

Any thoughts how i could approach this ? or any solutions


text:
Q: Is there a way to SOQL or identify 'My Unresolved Items' other than going to the dedicated SFDC page for "My Email to Salesforce" for each user? For those that utilize the old feature "My Email to Salesforce", the following page in your org should have 'My Unresolved Items":
https://ourinstance.my.salesforce.com/6AC?src=7
I really would like to create a report or SOQL the data to find out how many MailAssociationItem (My Unresolved Items) records have been created using the "Email to Salesforce" feature.
I realize I could probably make an assumption that any task with a subject that starts with 'Unresolved Items'. However, there must be something behind the scenes that Salesforce is using to distinctly flag these. Because I could clone an existing task with the same subject where the subject starts with 'Unresolved Email: testing email' and it would not show up in my queue on the dedicated SFDC Unresolved Items page.
I see that the prefix in the URL above (6AC) is the sObject MailAssociationItem. But that doesn't appear searchable...
I even tried creating a custom public list view, but unfortunately, it's as if these records sharing are set to Private and I can't see any others, not even as an admin:
https://ourinstance.my.salesforce.com/6AC?src=4&fcf=00B8b00000DoXqL#


text:
Q: Object instance is stripped of its methods For an online board game I am making, I have defined a Tile class, whose instances I use to create a "map". The Tile class has several properties, and a method called show which displays the instance on the canvas.
All the scripts are passed on to the clients as static files via script tags in the index.html which is served by node.js. The instantiation of the Tile class worked properly before I introduced the server. Now it produces some very weird and interesting results.
The HexMap class, creates upon instantiation a 2d array of Tiles as follows:
function HexMap (width, height, image) {
    this.width = width;
    this.height = height;
    this.contents = [];
    for (let i = 0; i < this.width; i++) {
        this.contents[i] = [];
        for (let j = 0; j < this.height; j++)
            this.contents[i].push(new Tile(i, j, size, image, "SEA"));
    }

}

The code for the Tile class is this:
var Tile = function (row, column, side, image, type) {

Vector.call(this, row, column);

this.unit = null;
this.canvas = null;
this.side = side;

this.type = type;

this.startingPoint = new Vector(this.x*Math.sqrt(3)*this.side + (this.y& 1) * this.side*Math.sqrt(3)/2, this.side*1.5*this.y);
this.middlePoint = new Vector(this.startingPoint.x + Math.sqrt(3)*this.side/2, this.startingPoint.y + this.side/2);

this.getOffset = function () {
    return {
        "SEA" : 0,
        "SHORELINE" : 60,
        "PLAINS" : 120,
        "FOREST_LIGHT" : 180,
        "FOREST_HEAVY" : 240,
        "MOUNTAINS" : 300,
        "SWAMP" : 360,
        "MARSH" : 420
    }[this.type];
};

this.getVector = function () {
    return new Vector(this.x, this.y);
};

this.show = function (context) {
    if(!this.canvas){
        this.canvas = makeTemplate(side, this.type, image);
    }
    context.drawImage(this.canvas, this.startingPoint.x - this.getOffset(), this.startingPoint.y);
};

this.getPixelX = function () {
    return this.x*Math.sqrt(3)*this.side + (this.y & 1) * this.side;
};

this.getPixelY = function () {
    return this.side/2 + this.side*2*this.y;
};

this.setType = function (type){
    this.type = type;
};

};

Printing a Tile object in the console would normally display something like this:
Tile {x: 0, y: 0, unit: null, canvas: canvas, side: 15, …}

I tried the same thing using the server this time, and the result is this:
{x: 0, y: 1, unit: null, canvas: null, side: 15, …}

Interestingly enough, the result is indeed an object, but not a Tile object. It has all the properties a Tile object has, but has none of its methods.
The error I end up getting is this:
tile.show is not a function

The map object is created and transferred to the server via socket.io sockets. The following piece of code runs on the client (the guest).
function selectGame(id) {
        var hexmap = new HexMap(rowspan, colspan, spritesheet);
        hexmap.generateIsland();
        socket.emit('game-select', {id: id, hexmap: hexmap});
    }

The server then receives the map:
socket.on('game-select', function (data) {

    //The 2 sockets corresponding to the players join the same room
    io.sockets.connected[data.id].join(games[data.id].identifier);
    io.sockets.connected[socket.id].join(games[socket.id].identifier);

    //The start-game event is emitted for just the sockets of the same room
    io.to(games[socket.id].identifier).emit('start-game', {
        map: data.hexmap
    });

});

Then both the clients receive it again:
    socket.on('start-game', function (data) {
        let el = document.getElementById("wrapper");
        el.parentNode.removeChild(el);
        hexmap = data.map;
        contexts = setupCanvas();
        displayMap(hexmap, contexts.mapContext);
    });

What displayMap does is it iterates through the contents of the map, and displays each Tile using its show method.
I cannot pin down the problem no matter how hard i try... Any suggestion on how to solve this?


text:
Q: What is the standard source list file for 18.10? I've badly damaged my package system. So I found another solution,
sudo apt-get build-dep <package>
But when I typed sudo apt-get build-dep update-manager, I got,
E: You must put some 'source' URIs in your sources.list

Then I accessed it using the sudo nano /etc/apt/sources.list. The list was blank. Now I'm unsure on how to add more source URIs. I cannot access the software updater to change it. I've tried Synaptic Package Manager.
sudo apt-get -f install
Reading package lists...  Done
Building dependency tree
Reading state information... Done
E: The package python3 needs to be reinstalled, but I can't find an archive for it.

Update:
I have edited sources.list using @karel's answer on What is the correct output of cat /etc/apt/sources.list? and replacing bionic with cosmic.
Now when I try to launch software-properties-gtk, I'm getting:
bash: /usr/bin/software-properties-gtk: /usr/bin/python3: bad interpreter: Too many levels of symbolic links

Outputs for symbolic links of python3:
$ ls -l /usr/bin/python3
lrwxrwxrwx 1 root root 18 May 27 20:30 /usr/bin/python3 -> /usr/bin/python3.6

$ ls -l /usr/bin/python3.6
lrwxrwxrwx 1 root root 25 May 27 16:31 /usr/bin/python3.6 -> /etc/alternatives/python3

$ ls -l /etc/alternatives/python3
lrwxrwxrwx 1 root root 18 May 27 16:31 /etc/alternatives/python3 -> /usr/bin/python3.6

Output of ls -l /usr/bin/python*:
lrwxrwxrwx 1 root root      18 May 27 23:10 /usr/bin/python -> /usr/bin/python3.2
lrwxrwxrwx 1 root root       9 Jun  7  2018 /usr/bin/python2 -> python2.7
-rwxr-xr-x 1 root root 3691008 Apr  9 05:50 /usr/bin/python2.7
lrwxrwxrwx 1 root root      18 May 27 20:30 /usr/bin/python3 -> /usr/bin/python3.6
lrwxrwxrwx 1 root root      25 May 27 16:31 /usr/bin/python3.6 -> /etc/alternatives/python3
lrwxrwxrwx 1 root root      33 Apr  9 05:59 /usr/bin/python3.6-config -> x86_64-linux-gnu-python3.6-config
-rwxr-xr-x 1 root root 4530552 Apr  9 05:59 /usr/bin/python3.6m
lrwxrwxrwx 1 root root      34 Apr  9 05:59 /usr/bin/python3.6m-config -> x86_64-linux-gnu-python3.6m-config
-rwxr-xr-x 2 root root 4804160 Apr  9 05:56 /usr/bin/python3.7
-rwxr-xr-x 2 root root 4804160 Apr  9 05:56 /usr/bin/python3.7m
lrwxrwxrwx 1 root root      16 Oct 25  2018 /usr/bin/python3-config -> python3.6-config
lrwxrwxrwx 1 root root      10 Oct 25  2018 /usr/bin/python3m -> python3.6m
lrwxrwxrwx 1 root root      17 Oct 25  2018 /usr/bin/python3m-config -> python3.6m-config

A: You've learned a valuable lesson today:  Backup files before editing them.
sudo cp /etc/apt/sources.list /etc/apt/sources.list.bak

If you mess up the file, you can copy the backup and start again:
sudo cp /etc/apt/sources.list.bak /etc/apt/sources.list

Things to think about:

*

*/tmp files are removed on reboot.  Be careful when backing up to /tmp.

*Be careful and ensure backed up files don't contain and leak sensitive information.

To restore your sources.list file, you can empty out the sources.list file, and then use software-properties-gtk to re-create the list.  Details about this process are found in this answer, but you use the GUI to uncheck and check which sources you want.  You need at least "main", and will likely want "universe" as well.  After you enable these, be sure to update your database via apt update.


text:
Q: How to remove default message error on C#? I'm trying to remove a message error on my C# application (WPF).It's a WinPE application.
I execute this application from a external device like a USB key.
I would like to unplug the usb key when the application is steel open and have no error message. I just want to close the application when i remove the USB key.
Is that possible ?
Thank's very much !
Regards

A: Quick and dirty solution would be to use the unhandled exception event:
/// <summary>
/// Interaction logic for App.xaml
/// </summary>
public partial class App : Application
{
    public App()
    {
        this.DispatcherUnhandledException += (s, e) =>
        {
            //ignore or log the info in here
        };
    }
}

However
I would encourage you to handle this type of behaviour in your app.
- This will not make it better you will only cover the problem.
- If the application is showing error there is a reason for it and user should be aware of that.
- With this hack you will also lose the ability to pick on any exceptions that have happened for all the other reasons.
- I can't say enough bad things about this approach.


text:
Q: Eigenvalues of anti-circulant matrix Is there any theorem to find the eigenvalues of any anti-circulant matrix with real entries?
By anti-circulant matrix, I mean any $n\times n$ matrix  of the form :
$$ \begin{pmatrix}a & b & c & d & e & f \\ b & c & d & e & f & a \\ c & d & e & f &  a & b \\ d & e & f & a & b & c \\ e & f & a & b & c & d  \\ f & a & b & c & d & e  \end{pmatrix}$$

A: Let $v_k=\pmatrix{1&\zeta^k&\zeta^{2k}&\cdots&\zeta^{-k}}^\top$
where $\zeta=\exp(2\pi i/n)$. Of course the $v_k$ are the eigenvectors
of the $n$-by-$n$ circulant matrix, but for an anticirculant $A$ one
has $Av_k=\lambda_k v_{-k}$ instead. Here $\lambda_k=\sum_j \zeta^{jk}a_j$
where $\pmatrix{a_0&a_1&\cdots&a_{n-1}}$ is the top row of $A$. So
$\lambda_0$ is an eigenvalue and so is $\lambda_{n/2}$ if $n$ is even.
The rest of the space of column vectors split up into subspaces with
bases $\{v_k,v_{-k}\}$, where $0<k<n/2$. On this space $A$ acts
like $\pmatrix{0&\lambda_k\\\lambda_{-k}&0}$ which gives eigenvalues
$\pm\sqrt{\lambda_k\lambda_{-k}}$.


text:
Q: H2O asfactor() for new data I am using hf[[x1, x2]] = hf[[x1, x2]].asfactor() to transform X1 and X2 to categorical variables and then train a classification model with automl(). Now for the new and unseen data, how should I convert the data? If I simply use the above method, is there any guarantee that it will be transformed similar to transformation in training phase?
In scklearn you should save the fitted object and use it for transforming train and new dataset but here I have no idea what to do?!

A: It is safe to convert them to categorical .asfactor(). It will treat the new transformed data the same as it will if it saw the levels earlier (it would be consistent).
If new levels are being transformed and predicted then it will be treated as unseen data and will follow the majority direction.


text:
Q: What should I make the type of a "marital status" field? I have a field in my table "marital status" , the user has to choose (radiobutton) if he's (married, divorced, single, voeuf)
What should I make the type of this field?
Is there a boolean type?

A: marital status doesn't sound like a boolean anyway. It sounds like an enumeration. A boolean would be married (Y/N), although I think in this day and age you might want to be able to store multiple kinds of relationships in there, and you specified yourself that you need to store 'devorced' as well, so a boolean is out of the question.
So I'd recommend making a table named MaritalStatus, having an ID and a description. Store the various states in there, and make a foreign key to MaritalStatusID in your table.

A: Make it an INT field , Create another table in your database something like
CREATE TABLE dbo.MaritalStatus
(
M_ID INT PRIMARY KEY NOT NULL,
M_Status NVARCHAR(20)
)
GO

INSERT INTO  dbo.MaritalStatus
VALUES
(1, 'Single'),(2,'Married'),(3,'Divorced'),
(4,'Widowed'),(5,'Other'),(6,'Prefer Not to say').... bla bla

Now in your Table in "Marital Status" field refer to a user Marital Status using INT values from dbo.MaritalStatus table's "M_ID".
Boolean or in SQL bit datatype is best when you have a situation where something can be TRUE or NOT TRUE, for someone's Marital Status there can be more than two possible values therefore you should create a separate table for all the possible Marital Status and use Foreign key constraint.

A: The boolean equivalent for T-SQL is bit.
Though, it seems like you want more than a yes/no answer. In this case use an int and then convert the int to an enum.
Edit: Dukeling removed the C# tag in an edit, so I am not sure how relevant this part is anymore /Edit
The enum:
enum MaritalStatus
{
   Single,
   Married,
   Divorced,
   ...
}

The int from DB:
int maritalStatusFromDB = //value from DB

Convert int to enum:
MaritalStatus maritalStatus = (MaritalStatus)maritalStatusFromDB;

Be aware that your database may contain int values that are not defined in your enum, such as 10. You can check whether maritalStatusFromDB is a valid MaritalStatus as follows:
bool isValid = Enum.IsDefined(typeof(MaritalStatus), maritalStatusFromDB);
if( isValid == false )
{
    //handle appropriately
}


text:
Q: Import files using key words I would like to import image files using parts of their names. I have 100 .tif images whose names are composed of 3 different elements, say Ai, Bi and Ci in such way: "A1 B1 C1.tif", "A1 B2 C1.tif", "A1 B1 C2.tif", "A2 B1 C1.tif"...
I defined Ai, Bi and Ci at the beginning of the code, and want to call the file that contains these 3 elements.
I have tried options that have no chance to be correct, but cannot find anything better:
f = readTiff(Ai Bi Ci)
f = readTiff(Ai, Bi, Ci)
f = readTiff("Ai Bi Ci")

and the same using readImage and file.name. The getwd gives the correct path.
Thank you in advance.

A: You can use the paste command to glue strings together.
# for i for A, j for B selection and k for C selection
my.filename <- paste("A", i, " B", j, " C", k, ".tif", sep = "")

so if you wanted to import A1 B2 C2.tif
i <- 1
j <- 2
k <- 2
my.filename <- paste("A", i, " B", j, " C", k, ".tif", sep = "")

Note paste0 defaults to sep = "" so paste0("A", i, " B", j, " C", k, ".tif")
results in my.filename
 1)  "A1 B2 C2.tif"

if you are working with paths then:
my.filename <- paste("A", i, " B", j, " C", k, ".tif", sep = "")
my.path <- getwd() # or set this
readTiff(file.path(my.path, my.filename))

If you want to work through all combinations of i, j, k in loops then you can use file.exists and if it does then import it.
Note: Which package are you using for readTiff? Do not forget to make sure this package is loaded in your script, with library(thispackage) if you are getting "object not found" errors.


text:
Q: Changing WordPress form redirect URL based on options chosen? I am creating a simple WordPress website, similar to this one: http://viewsyoutubes.com/
I need a form inserted, that when completed, will send the visitor to the PayPal payment page (so when the form is submitted, it redirects the visitor to the payment page URL).
However, I don't know how to make it so that depending on the option they have chosen, it sends them to a different payment page (there are different prices for different products - so when a product is selected, it needs to redirect the visitor to the corresponding payment page). It needs to be something like this:
http://viewsyoutubes.com/buy-youtube-views/
When a different package is selected, it sends you to a different payment page.
This is the site at the moment, as you can see there are 20 options in the drop down list, and i need the submit URL to change corresponding to the item that was chosen.
Thanks.
medialads.tk/youtube-views-likes/

A: You mean something like this?
<form target="paypal" action="https://www.paypal.com/cgi-bin/webscr" method="post" >
<input type="hidden" name="cmd" value="_cart">
<input type="hidden" name="business" value="Your@email.com">
<input type="hidden" name="lc" value="US">
<input type="hidden" name="item_name" value="Shopping Cart">
<input type="hidden" name="button_subtype" value="products">
<input type="hidden" name="no_note" value="0">
<input type="hidden" name="no_shipping" value="0">
<input type="hidden" name="currency_code" value="USD">
<input type="hidden" name="add" value="1">
<input type="hidden" name="bn" value="PP-ShopCartBF:btn_cart_LG.gif:NonHosted">
<input type="hidden" name="on0" value="Sizes"><select name="os0">
    <option value="Small">Small $5.00 USD</option>
    <option value="Med">Med $7.00 USD</option>
    <option value="Larg">Larg $10.00 USD</option>
    <option value="Super Size">Super Size $15.00 USD</option>
</select>
<input type="hidden" name="currency_code" value="USD">
<input type="hidden" name="option_select0" value="Small">
<input type="hidden" name="option_amount0" value="5.00">
<input type="hidden" name="option_select1" value="Med">
<input type="hidden" name="option_amount1" value="7.00">
<input type="hidden" name="option_select2" value="Larg">
<input type="hidden" name="option_amount2" value="10.00">
<input type="hidden" name="option_select3" value="Super Size">
<input type="hidden" name="option_amount3" value="15.00">
<input type="hidden" name="option_index" value="0">
<input type="image" src="https://www.paypalobjects.com/en_US/i/btn/btn_cart_LG.gif" border="0" name="submit" alt="PayPal - The safer, easier way to pay online!">
<img alt="" border="0" src="https://www.paypalobjects.com/en_US/i/scr/pixel.gif" width="1" height="1">
</form>


text:
Q: GoogleSignInResult#isSuccess() returns false everytime I am trying to enable google signin in my android app following this tutorial.. But GoogleSignInResult#isSuccess() always return false. The value of result.getStatus().getStatusCode(); is 0 which was success accoding to GoogleAPI's CommonStatusCode
I researched a bit and found similar issues. I have tried

*

*Generating a google-services.json from SHA key from my application and pasting it in my app folder.

*Also by generating signed apk and seprately(not running from android studio) installing it in my phone
But none of them works for me.
Any help would be appreciated

A: I have faced this same exact problem. This occurs when you do not provide the SHA-1 app code when you download the google-services.json.

*

*Go to console.firebase.com and create another android app in your project.

*Fill in ALL the fields including the SHA-1 code.

*Download the google-services.json

*Put the google-services.json in the App directory root.


text:
Q: Using where search clause after select I'm new to rails and I'm adding some updates to already existing app. I need to add filtering by search word and I'm trying to use where with ILIKE to do that but due to the original code is written. the original code uses Model.select to get the records and when i try to chain where with the ILIKE clause to that it still returns the whole array not filtered.
  date_format = get_js_date_format_by_id(@account.date_format_id)
  sort_format = "#{params[:sort_item] || "date"} #{params[:sort_order] || "asc"}"

  @expenses = Expense.select("expenses.*, to_char(expenses.date, '#{date_format}') as formatted_date,
      to_char(
        CASE
          WHEN expense_categories.is_calculated = true then expenses.amount * expense_categories.unit_cost
          ELSE expenses.amount
        END, 'FM999999990.00') as total,
        CASE
        WHEN expense_categories.is_calculated = true then expense_categories.unit_name
          ELSE null
          END as unit_name,
        '' as images_list,
       users.name as user_name, expense_categories.name as category_name, projects.name as project_name, clients.name as client_name")
       .joins(:user, :project, :expense_category, :client)

  if params[:query]
    @expenses.includes(:user).where('users.name ILIKE :query', { query: "%#{params[:query]}%"}).references(:users)
  end
  @expenses.where(conditions)
  .order(sort_format)

  if params[:page]
    @expenses = @expenses.page(params[:page]).per(params[:per_page])
  end

  @expenses

I'm adding the filtering part starting at if params[:query] the rest is the original code. any help would be appreciated to pin pointing the problem.
thanks!

A: The problem is that you don't modify the current @expenses scope with:
  if params[:query]
    @expenses.includes(:user).where('users.name ILIKE :query', { query: "%#{params[:query]}%"}).references(:users)
  end

This line returns the new scope you want, but you are not saving it anywhere. Following code should work:
  if params[:query]
    @expenses = @expenses.includes(:user).where('users.name ILIKE :query', { query: "%#{params[:query]}%"}).references(:users)
  end

Note: same thing applies for the sorting under the params[:query] condition.


text: Q: Are droids' names unique? Does each droid have a unique name or does that designation refer to an entire class of droid? To put it another way, is R2-D2 specifically the droid we see in the films, or are there hundreds if not thousands of R2-D2s across the galaxy? If not, it would seem that they would run out of names fairly quickly.


text:
Q: Retrieve Data that do not exist in the primary table, exist in the secondary only Problem:
I would like to retrieve the value that do not exist in the list table b but it exist in table a.
I don't know how to do it.
Please remember that the data will change very often.
SELECT [id]
      ,[name]
      ,[email]
      ,[phone]
      ,[cellphone]
      ,[none]
  FROM [test].[dbo].[datatable]

SELECT [id]
      ,[name]
      ,[email]
      ,[phone]
      ,[cellphone]
      ,[none]
  FROM [test].[dbo].[datatable2]

A: Use LEFT OUTER join on the tables:
Please find the sample query below:
select a.*
from tableA a
Left outer join TableB b
on a.id=b.id
where b.id is NULL

A: If you're looking to see if the entire row matches, you can use EXCEPT to find the result set.
SELECT [id],
    [name],
    [email],
    [phone],
    [cellphone],
    [none]
FROM [test].[dbo].[datatable]
EXCEPT
SELECT [id],
    [name],
    [email],
    [phone],
    [cellphone],
    [none]
FROM [test].[dbo].[datatable2]

If you're only worried about the key, I like using NOT EXISTS to get the result set.
SELECT [id],
    [name],
    [email],
    [phone],
    [cellphone],
    [none]
FROM [test].[dbo].[datatable] t1
WHERE NOT EXISTS (SELECT 1 FROM [test].[dbo].[datatable2] t2 WHERE t2.[id] = t1.[id])


text:
Q: Prove $i_*$ is an embedding I'm stuck in this problem:

"Let $i:S^2\rightarrow \mathbb{R}^3$ the inclusion. Prove that the map $i_{*}:TS^2\rightarrow T\mathbb{R}^3$ is an embedding".

I consider $p=(x_1,x_2,x_3)\in S^2$ and $X=(X^1,X^2,X^3)\in TS^2$, so
\begin{array}{crcl}
i: &S^2 & \longrightarrow & \mathbb{R}^3 \\
 & p & \longmapsto & i(p)=p
\end{array}
and
\begin{array}{crcl}
i_*: & TS^2 & \longrightarrow & T\mathbb{R}^3 \\
 & (p,X) & \longmapsto & \big(i(p),i_{*p}(X)\big)=\big(p, J_i X^T\big)
\end{array}
where $J_i$ is the Jacobian matrix of $i$. If we compute the Jacobian matrix of $i_*$, we get
\begin{equation}J_{i_*}=\left(
\begin{array}{cc}
\frac{\partial(x_1,x_2,x_3)}{\partial (x_1,x_2,x_3)} & \frac{\partial (x_1,x_2,x_3)}{\partial (X^1,X^2,X^3)} \\
\frac{\partial J_i X^T}{\partial (x_1,x_2,x_3)} & \frac{\partial J_i X^T}{\partial (X^1,X^2,X^3)}
\end{array}
\right)=\left(
\begin{array}{cc}
J_i & 0 \\
\frac{\partial J_i X^T}{\partial (x_1,x_2,x_3)} & J_i
\end{array}
\right)
\end{equation}
Since $i$ is an embedding, it's an immersione and then $J_i$ has full rank, per columns, $rank(J_i)=\dim(S^2)$. So we have that $J_{i_*}$ has full rank, per columns, $rank(J_{i_*})=\dim(TS^2)$ and then $i_*$ is an immersion.
Now I just need to prove that $i_*$ is a homeomorphism into its image, or even just that $i_*(TS^2)$ is an embedded submanifold.
So the question is: how can I prove that $i_*(TS^2)$ is an embedded submanifold?
Thank you so much


text:
Q: What to put for `p` in a binomial test to obtain a CI? I have a simple binomial test in which $55$ successes out of $100$ trials have been found. In R, it is necessary to pick a p (probability of success) to run a binomial test and obtain a $Confidence ~Interval$.
In my case, I was wondering if I should put $.55$ ($55$ out of $100$) for that p?
binom.test(55, 100, p = .55)$conf.int

A: You can put in anything you want. binom.test 's p parameter is the null value of $p$ for a null hypothesis for a hypothesis test. If you only want the confidence interval, this number is immaterial. Check for yourself: change the value and notice how nothing happens to the conf.int member.


text:
Q: The most effective way to load and use objects from an xml-file I am looking for the smartest (and most effective) way to implement the following project:
I want to develop an app that accesses to about 100 different sport exercises. The exercises are available in an xml-file. The access to the exercises can be in different ways on different activities:

*

*show all

*show only exercises of a special category

*mark as favorite and show favorites

*show details of an exercise

*sort

*etc.

Loading the xml-file and creating the exercise-objects is already working and its not problem. But I think about the most effective way to implement things like that. Thinking about RAM and performance...

*

*Parsing the xml-file once the app is started, creating the 100 objects and dealing with them during the app is running (of course ensure to reload the data if the objects where cleaned up by the garbage collector in the meantime). Is this possible and recommended? How can such a central point, where I can pick up the objects in all activities, look like? Can I find an example anywhere?

*Parsing the xml-file every time an activity (that is using the exercises in any way) is created?

*completely different way?

Maybe someone can give me a keyword.

A: It is just my suggestion If possible can you please make change that XML into JSON format, so in that case you can be able to use the GSON Converter and libraries to get rid of the performance issues.

A: What I understand from your question is you want to parse XML as app starts every time and generate 100s of Object that time, which you want to use in all other activity.
You can extend Application class for accessing same object for more than one activity. Take look at this question
Application is base class of your app and it is the first one to call. So, you can call your service here and also setter/getter of your objects here. By which you can access it in all activities.
Learn more about Application
Also, you can use SharedPreference or SQLite to store your data in database.


text:
Q: If $n$ is an rational, when is $n^{1/n}$ rational? Given that $n$ is rational, when is $\sqrt[n]{n}$ rational?
We can make a polynomial $x^{n}-n$ whose root is $\sqrt[n]{n}$ and using RRT we can show that there are no rational roots, but in the process we are assuming that $n$ is an integer (coefficients must be integers for RRT to work).
How can we solve this problem?

A: If $1/n$ is an integer, it works... conversely, if $(p/q)^{q/p}$ is a rational $a/b$, where $p,q$ are coprime positive (and $a,b$ as well), then $p^q/q^q=a^p/b^p$, both as quotients of coprime positive integers, so $p^q=a^p$.
So if $\pi$ is a prime divisor of $p$ with multiplicity $\nu$ (ie $\pi^{\nu}|p$, $\pi^{\nu+1}$ doesn't divide $p$), then the $\pi$-adic valuation of $p^q$ is $\nu q$. But as $p^q$ is a $p$-th power, said valuation is a multiple of $p$, and thus $p|\nu q$. But as $p$ and $q$ are coprime, $p|\nu$, thus $\nu \geq p$, and hence $p \geq \pi^{\nu} > \nu$, a contradiction. Thus $p=1$ (because $p$ has no prime divisors), whence the conclusion.


text:
Q: How to fix 'TypeError: Cannot read property 'groupBy' of undefined"' error in ALL browsers I have a vue app working in all browser bundled with webpack, but for Internet Explorer, I coded the app manually as much as I can.
I see the following error in browser console.
vue.js?ver=5.1.1:634 [Vue warn]: Error in render: "TypeError: Cannot read
property 'groupBy' of undefined"

I've already tried adding lodash library but it didn't help.
var locationsByCity = _.groupBy(locations, function(location) {
   return location.location_data['prefix-tc_map_city'];
});

Scripts are added before the </body> in the following order.
wp_enqueue_script( 'vue', 'https://cdn.jsdelivr.net/npm/vue/dist/vue.js' ); // Vue
wp_enqueue_script( 'google-maps', 'https://maps.googleapis.com/maps/api/js?key=XXXX' ); // Google Maps
wp_enqueue_script( 'es6-polyfill', 'https://cdn.jsdelivr.net/npm/es6-promise@4/dist/es6-promise.min.js' ); // ES6 Polyfill | Promise fixer for ie 11
wp_enqueue_script( 'es6-polyfill-auto', 'https://cdn.jsdelivr.net/npm/es6-promise@4/dist/es6-promise.auto.min.js' ); // ES6 Polyfill | Promise fixer for ie 11
wp_enqueue_script( 'axios', 'https://cdnjs.cloudflare.com/ajax/libs/axios/0.18.0/axios.min.js' ); // Axios
wp_enqueue_script( 'lodash', 'https://cdnjs.cloudflare.com/ajax/libs/lodash.js/4.17.15/lodash.min.js' ); // Lodash

// Local Libs
wp_enqueue_script( 'vue-collapse', plugin_dir_url( dirname( __FILE__ ) ) . 'ie/js/vue2-collapse.js' ); // Vue Collapse
wp_enqueue_script( 'vue-geolocation', plugin_dir_url( dirname( __FILE__ ) ) . 'ie/js/vue-geolocation.js' ); // Vue Browser Geolocation
wp_enqueue_script( 'he-js', plugin_dir_url( dirname( __FILE__ ) ) . 'ie/js/he.js' ); // He.js
wp_enqueue_script( 'geolib-js', plugin_dir_url( dirname( __FILE__ ) ) . 'ie/js/geolib.js' ); // Geolib.js

// Init
wp_enqueue_script( 'init-js', plugin_dir_url( dirname( __FILE__ ) ) . 'ie/js/init.js' ); // init.js

I expect the output to run smoothly and _.groupBy shouldn't be showing undefined.


text:
Q: Python: How can I convert a UTC timestamp into python utc datetime?
*

*I get the client timestamp as Wed, 20 Nov 2013 13:53:35 GMT

*I want to convert this into a python utc timestamp so that I can subtract it and get remaining number of days in month

def get_days_left_in_month(from_date):
        # todo : how to validate if from_date is valid?
        start_day, end_day = Day.get_start_end_days_for_year_and_month(
            from_date.year, from_date.month
        )
        remaining_days = (end_day - from_date).days
        return remaining_days if remaining_days == 0 else remaining_days - 1

How can I do this using python?

A: Try this
import time
a = "Wed, 20 Nov 2013 13:53:35 GMT"
time.strptime(a, "%a, %d %b %Y %H:%M:%S %Z")

And have a look here for available formats.


text:
Q: CNAME problem: godaddy- Kindly help I would like to point same location by 3 domains.

*

*abc.com -> main domain : ip 123.123.123.123

*1st-pointing-abc.com

*2nd-pointing-abc.com

Now, domain with godaddy and hosting too.
How will I chnage CNAME and A record in case of 1st-pointing-abc.com and 2nd-pointing-abc.com?
Right now----
1st-pointing-abc.com:
A Record: @ ip:123.123.123.123
CNAME: www "points to" abc.com
What I am doing wrong? I am getting the message:
Quote:
Forbidden
You don't have permission to access / on this server.
Additionally, a 403 Forbidden error was encountered while trying to use an ErrorDocument to handle the request.
godaddy says:
Quote:
1st-pointing-abc.com has no files to
pull up. Since it's custom dns, they are limited to how much support
the can provide.
any help greatly appreciate. thanks!

A: Sounds to me like this is a web server issue - you're probably using name-based virtual hosts, but only have a server name directive for the main domain.
Assuming you're using Apache, you probably just have a "ServerName 1.com" directive. You'll also need to add "ServerAlias 2.com" and "ServerAlias 3.com" directives.

A: Your question is a little confusing but it sounds to me like you need to set up host headers on your web site to match the CNAME records you've created.


text:
Q: Is "all" a determinative here?
This all started in 1965.

Is 'all' a determinative here or an adverb?

A:
This all started in 1965.

"All" is never an adverb. Here it is a determinative functioning as a quantificational adjunct in clause structure. It is separable and not part of the subject NP, but an adjunct in clause structure as is evident from the fact that when the verb is an auxiliary, it preferentially follows rather than precedes it, as in:

This had all started in 1965.

The only other part of speech that "all" belongs to is that of pronoun, as in
We ate it all
where "it" and "all" are inseparable and hence best analysed as a compound pronoun.

A: The word all must be a determiner there because the role of a determiner, in layman's terms, is to give more precise information about how much or how many of something we have. Adverbs, on the other hand, describe how actions happen and work only with verbs. Adverbs modify verbs, as they say.
As a determiner, all is used to refer to the whole quantity or extent of something. In other words, when referring to something as all, we're talking about all of it or about it in its entirety. And phrases like this all or all that can generally be rewritten as all of this and all of that. For instance:

They all were missing. / All of them were missing.
They all went there. / All of them went there.
This all makes no sense. / All of this makes no sense.
All people on board the plane survived the crash. / All of the people on board the plane survived the crash.
I spent all my money. / I spent all of my money.

As an adverb, all simply means completely. For example:

They were all naked. / They were completely naked. (How naked were they? They were all or completely naked.)
I was all tired. / I was completely tired. (How tired was I? I was all or completely tired.)

Which one of the two uses of all do you think fits better into the context of your example? Did it start completely in 1965 or did all of this start in 1965? To me, it certainly sounds like the latter case: all of this started in 1965.


text:
Q: Scatterplot with color gradient and additional point After coming back to ggplot2 for some evolve scatterplot, I feel like I am lost:
I have two datasets, df1 and df2 (this last being a single point).
>df1
    DATE        XOV        DAX
1  16479  2.1880142 -1.8203765
2  16482  2.7930760 -2.1501989
3  16483  2.8998516 -1.9903619
4  16484  1.8676874 -1.8704841
5  16485  1.5473606 -1.8007140
6  16486  1.3338094 -1.4620117
7  16489  0.7643395 -1.4512291
8  16490  0.4084208 -1.2044965
9  16491  0.2660533 -1.2577755
10 16492 -0.5169678 -0.9438099

>df2
   DATE      XOV       DAX
1 13514 1.620395 -1.927569

What I wanna obtain (1) is a scatterplot with df1, with point colored depending on the date, according to a gradient, and (2) add the single point in red on it with a bigger size.
I can obtain (1) with:
library(ggplot2)

ggplot() +
geom_point(data=df1, aes(x=DAX, y=XOV, colour=DATE)) +
theme(legend.position="none") +
scale_colour_gradient(low="#A9C8F3", high="#0C2389")

Giving:

When I wanna add (2), I use:
library(ggplot2)

ggplot() +
geom_point(data=df1, aes(x=DAX, y=XOV, colour=DATE)) +
theme(legend.position="none") + scale_colour_gradient(low="#A9C8F3", high="#0C2389") +
geom_point(data=df2, aes(x=DAX, y=XOV, color="red"))

But then get the error:
$ Discrete value supplied to continuous scale

I apologize if it's a duplicate, already looked for solutions but I did not get what was wrong, despite pulling each dataframe out of ggplot() ...

A: You should specify the colour argument outside of the aes:
ggplot() +
  geom_point(data=df1, aes(x=DAX, y=XOV, colour=DATE)) +
  theme(legend.position="none") +
  scale_colour_gradient(low="#A9C8F3", high="#0C2389") +
  geom_point(data=df2, aes(x=DAX, y=XOV), colour="red",size=5)

Explanation for the behavior can be found here:

When specified inside aes, an aesthetic is mapped to the value of a
  variable in the data. Since there is a mapping between the data and
  the visible aesthetic, there is a legend which shows that mapping.
  Outside of an aes call, the aesthetic is just set to a specific value.


text:
Q: CSS works, breaks on Chrome when moved to live MediaWiki http://codepen.io/Drexl/pen/CBjdL
The above works just fine in both FF and Chrome. However when used on a live MedaWiki it fails on Chrome, works fine on FF.
This is the result when viewed in chrome:
http://i.imgur.com/0bALNzc.png (ignore the small edit I made).
Notice that it appears to be keeping the formatting, but the border is not present. I've used these border settings on other elements just fine which compounds my confusion.
Thanks for any advice/guidance you can provide! ^_^

A: You must add the -webkit- and -moz- prefixes for border radius and box shadow, reading this source might help you understand CSS3 better..


text:
Q: Microsoft Word 2007 opening all docs with field codes toggled off Recently, something changed with my Microsoft Word 2007 installation/preferences on Windows XP, such that whenever I open a word document, all the field codes are displayed raw instead of as their expanded value.  For example, my header reads:
My Name { TITLE \* MERGEFORMAT }    Version { REVNUM \* MERGEFORMAT }

But, if I copy and paste it here, it reads expanded:
My Name My Doc Title    Version 42

I expect to see the copy and paste version directly inside Word, I can work around this by right clicking on each such field and choosing toggle field codes, however, I never had to do that before, as previously, the document opened with all such field codes expanded.
Another example is the Table of Contents which shows as:
{ TOC \o "1-3" \h \z \u }

Instead of the full table of contents.
I searched the word options dialog, but could not find anything that appeared relevant.
Please suggest how to restore the old behavior.

A: I found the control in Word 2007 in the Advanced section of the options dialog under 'Show Document Content':

A: You need to clear this checkbox.

A: I had the same problem in Word 2010 on Windows 7, and it was also solved the above steps. Note that at the same time I had ActiveX buttons tied to VBA macros and the buttons were converted to pictures and so no longer functioned as buttons. I have found no way to reverse this. It is possible that the two problems occurring together are evidence of some sort of corruption, since I am certain I did not change the field codes setting. Further, this problem occurred when I opened up older documents that could not have been independently corrupted.
This problem occurred after I exited Word but the process was still running and I ended up rebooting.

A: And if you are working with MS Office for Mac you will find this checkbox by:

*

*Word --> Preferences

*From the first row at the top "Authoring and Proofing Tools" --> cick View

*In the first group of options "Show" --> Untick the box: "Field codes"

That'll do the trick.


text:
Q: Unicode strings not showing in Win32 ComboBoxEx I am creating a WC_COMBOBOXEX on Windows Vista and adding strings to it, but they don't show up in the control.  The same strings show up fine if I use the old WC_COMBOBOX with CB_ADDSTRING.
I am calling InitCommonControlsEx with ICC_USEREX_CLASSES and creating the comboboxex using CreateWindowEx with style WS_CHILD|WS_CLIPSIBLINGS|CBS_SIMPLE|CBS_SORT|CBS_HASSTRINGS (no extended styles).  I am adding the strings using
COMBOBOXEXITEM cbem = {0};
cbem.mask    = CBEIF_TEXT;
cbem.iItem   = -1;
cbem.pszText = L"hello";
SendMessage(hWnd_, CBEM_INSERTITEM, 0, TOLPARAM(&cbem));

The combobox comes up empty but when I move the cursor up and down in the editcontrol/listbox, I see funny block characters sometimes.
Eventually, I want to add it as a CBS_DROPDOWNLIST to a rebar control but I read somewhere that comboboxex works a lot better in there than the old combobox.
Thanks.

A: Does it help if you send CBEM_SETUNICODEFORMAT?

A: From MSDN:
ComboBoxEx controls support only the following ComboBox styles:
CBS_SIMPLE
CBS_DROPDOWN
CBS_DROPDOWNLIST
WS_CHILD

So CBS_SORT and CBS_HASSTRINGS may be messing up the style bits.


text:
Q: Performance: Inheritance and inlining? I have a base class named "SensorData", for which different implementations exist. The base class does more, but for the sake of simplicity, let's say I only want the implementations to return a constant, implementation-specific value "maxRange". The obvious way to implement this would be:
Base class:
class SensorData {
  virtual float getMaxRange() = 0;
  virtual ~SensorData();
};

Example implementations would look like this:
class Velo64 : public SensorData {
  inline float getMaxRange() { return 120.0f;}
};

class Velo16 : public SensorData {
  inline float getMaxRange() { return 90.0f;}
};

Additionally, I have a factory that returns a pointer to an implementation.
My question is: Does inlining work here? AFAIK, inlining means the compiler replaces all function calls with the actual function. Since the actual function is not defined at compile time (but instead determined at runtime, depending on which implementation is used?), can the function even be inlined?
I am asking this because the function (and others like it) will be called millions of times per second in a performance-critical application. Alternatively, is there any better way to go? For example, using variables instead of a get-function?


text:
Q: Notify me when the Flash movie is done playing I'm new to working with flash and have a quick question about embedding Flash with the SWFObject.js file.
I can successfully embed an object and play it, but what I'd like to know now is if there is a way that I can be notified when the movie is done being played without editing the flash file itself, since I have no real way to do that.
Is there a callback or an event that I could somehow connect to?

A: There is no way to do this without editing the source, which would be a very simple change if you could do it.
The reason, as far as I can guess, as to why no such callback event exists is there would be no real logical place to have the event fired.  Imagine a timeline animation that gets to the last frame and says stop().  Is that done?  What if I can still click on buttons within the movie that allow me to do other things... or if the final frame just has a delayed function call to do something else, like restart.  There is no "END" to a flash movie, unless you make it so there is one yourself.


text:
Q: Bertini theorem for big divisors and klt pairs Let $X$ be a smooth projective variety and let $D$ be a big $\mathbb Q$-divisor on $X$. Assume that for $m$ large $|mD|$ has no fixed components. Is there a $\mathbb Q$-divisor $D'\equiv D$ so that $(X,D)$ is klt?
For $D$ ample, this follows from the usual Bertini theorem, as we can take $D'=\frac1m H$ for $H\in |mD|$ generic, for $m$ large. Does it make sense for a similar `Bertini-type result' in the above situation?

A: If $X$ is $\mathbb P ^2$ blown up at a point $O$ with exceptional divisor $E$ and $D=H+E$ where $H$ is the pull-back of the hyperplane class, then any effective divisor $D'\equiv D$ will vanish along $E$ with multiplicity $\geq 1$ (i.e. $D'\geq E$) and hence $\mathcal J(D')\subset \mathcal J(E)=\mathcal O _X(-E)$. In other words, the non-klt locus contains $E$. On the other hand, if $D$ is nef and big, then using Wilson's theorem you can show that $\mathcal J (||D||)=\mathcal O _X$ which implies that $(X,D')$ is klt for some effective $\mathbb Q$-divisor $D'\sim _{\mathbb Q}D$ (this is surely proved somewhere in Lazarsfeld positivity books).

A: If you want an example where $|mD|$ has no fixed codim-1 components, you can do the following.  Let $X \dashrightarrow X^+$ be an Atiyah flop of a curve $C$, and let $H \subset X$ be a general member of a very ample linear system with $H \cdot C \geq 2$.   The strict transform $\tilde{H} \subset X^+$ is still big.  Let $Y$ be the resolution of the flop with exceptional divisor $E$, and $\bar{H}$ the strict transform of $H$ on $Y$.
On $Y$, we have $K_Y = g^* K_{X^+} +E$, and the strict transform is $\bar{H} = f^*H$ (since $H$ is general, it doesn't contain $C$).  It's easy to check $f^*H+aE = g^*\tilde{H}$, where $a = H \cdot C$.  Then $K_Y + \bar{H} = (g^*K_{X^+} + E) + f^\ast H = (g^* K_{X^+} + E) + (g^*\tilde{H} - aE)$ i.e. $K_Y + \bar{H} = g^*(K_{X^+} + \tilde{H}) + (1-a)E$.  Since $a \geq 2$, the pair $(X^+,\tilde{H})$ is not numerically klt (or even numerically lc, if you take $a>2$).  The problem is that $|\tilde{H}|$ is too singular along the flopped curve $C^+$; $\tilde{H}$ is already general in its linear series, so we can't get the multiplicity along $C^+$ to be any smaller, and passing to a multiple doesn't help. (Hopefully I got all my signs right!)


text:
Q: ErrorException Trying to get property 'id' of non-object I'm trying to check error for my web app, I tried to register and I can't register user. How should I solve this error?
"ErrorException Trying to get property 'id' of non-object"

UserRequest.php
        $rules = [
            'email'     => 'required|email',
            'password'  => 'required|min:6',
            'password_confirmation' => 'filled',
        ];

       if ($this->password_confirmation) {
        $rules['name']      = 'required|max:20';
        $rules['email']     = ['required', 'email', Rule::unique('users')->ignore($this->user()->id)];
        $rules['password']  = 'required|min:6|confirmed';
        }
        return $rules;

UserController.php
    public function store(UserRequest $request)
    {
    $user     = new User;
    $name     = $request->input('name');
    $email    = $request->input('email');
    $password = $request->input('password');
    $params   = [
      'name'      => $name,
      'email'     => $email,
      'password'  => Hash::make($password),
    ];
    if (!$user->userSave($params)) {
        return redirect()->route('user.create')->with('error_message', '');
    }
    if (!Auth::attempt(['email' => $email, 'password' => $password])) {
      return redirect()->route('user.signin')->with('error_message', '');
    }
    return redirect()->route('bbs.index');
    }


text:
Q: Why does io.Pipe() continue to block even when EOF is reached? While playing with subprocesses and reading stdout through pipes I noticed interesting behaviour.
If I use an io.Pipe() to read the stdout of a subprocess created through os/exec, reading from that pipe hangs forever even when EOF is reached (the process is finished):
cmd := exec.Command("/bin/echo", "Hello, world!")
r, w := io.Pipe()
cmd.Stdout = w
cmd.Start()

io.Copy(os.Stdout, r) // Prints "Hello, World!" but never returns

However, if I use the built-in method StdoutPipe() it works:
cmd := exec.Command("/bin/echo", "Hello, world!")
p := cmd.StdoutPipe()
cmd.Start()

io.Copy(os.Stdout, p) // Prints "Hello, World!" and returns

Digging into the source code of /usr/lib/go/src/os/exec/exec.go, I can see that the StdoutPipe() method actually uses os.Pipe(), not io.Pipe():
pr, pw, err := os.Pipe()
cmd.Stdout = pw
cmd.closeAfterStart = append(c.closeAfterStart, pw)
cmd.closeAfterWait = append(c.closeAfterWait, pr)
return pr, nil

This gives me two clues:

*

*File descriptors are being closed at certain points. Critically, the "write" end of the pipe is being closed after process start.

*Instead of io.Pipe() as I used above, os.Pipe() (a lower level call that roughly maps to pipe(2) in POSIX) is used.

However I am still unable to understand why my original example behaves the way it does after taking into account this newfound knowledge.
If I try to close the write end of an io.Pipe() (instead of an os.Pipe()) then it appears to break it completely and nothing gets read (as if I'm reading from a closed pipe even though I thought I passed it to the subprocess):
cmd := exec.Command("/bin/echo", "Hello, world!")
r, w := io.Pipe()
cmd.Stdout = w
cmd.Start()

w.Close()
io.Copy(os.Stdout, r) // Prints nothing, no read buffer available

Okay, so I guess an io.Pipe() is quite different than an os.Pipe(), and probably doesn't behave like Unix pipes where one close() doesn't close it for everybody.
Just so you don't think I'm asking for a quick fix, I already know I can achieve my expected behaviour by using this code:
cmd := exec.Command("/bin/echo", "Hello, world!")
r, w, _ := os.Pipe() // using os.Pipe() instead of io.Pipe()
cmd.Stdout = w
cmd.Start()

w.Close()
io.Copy(os.Stdout, r) // Prints "Hello, World!" and returns on EOF. Works. :-)

What I'm asking for is why does io.Pipe() seem to ignore an EOF from the writer, leaving the reader blocking forever? A valid answer could be that io.Pipe() is the wrong tool for the job because $REASONS but I can't figure out what those $REASONS are because according to the documentation what I'm trying to do seems perfectly reasonable.
Here is a complete example to illustrate what I'm talking about:
package main

import (
  "fmt"
  "os"
  "os/exec"
  "io"
)

func main() {
  cmd := exec.Command("/bin/echo", "Hello, world!")
  r, w := io.Pipe()
  cmd.Stdout = w
  cmd.Start()

  io.Copy(os.Stdout, r) // Blocks here even though EOF is reached

  fmt.Println("Finished io.Copy()")
  cmd.Wait()
}

A: "why does io.Pipe() seem to ignore an EOF from the writer, leaving the reader blocking forever?"  Because there is no such thing as "EOF from the writer".  All an EOF is (in unix) is an indication to the reader that  no processes hold the write side of the pipe open.  When a process attempts to read from a pipe which has no writers, the read system call returns a value that is conveniently named EOF.  Since your parent still has one copy of the write side of the pipe open, read blocks.  Stop thinking of EOF as a thing. It is merely an abstraction, and the writer never "sends" it.

A: You can use a goroutine:
package main

import (
  "os"
  "os/exec"
  "io"
)

func main() {
   r, w := io.Pipe()
   c := exec.Command("go", "version")
   c.Stdout = w
   c.Start()
   go func() {
      io.Copy(os.Stdout, r)
      r.Close()
   }()
   c.Wait()
}


text:
Q: How to use remote/dynamic HTML templates in Actionmailer - Rails 4 I have a use-case where our email templates are designed by end-users and uploaded on cloud (AWS S3) as HTML. Now while sending emails, I basically want the mailers to use HTMLs from S3 using something like remote_url in actionmailer's methods.
Is there any way to achieve this?


text:
Q: How to install de_DE.iso88591? (JasperReports Umlaute problem on Rockylinux) I use Docker Base Image rockylinux/rockylinux:8.4 and Oracle Java JDK 8 to compile JasperReports (v6) containing German Umlaute characters.
In the produced PDF they're displayed as "?".
If I compile the JasperReport on the host the PDF contains the correct character "ä".
On the host "locale -a" contains "de_DE.iso88591" in the output. That's not the case in the container. Which package do I have to install to install de_DE.iso88591?
locale

LANG=en_US.UTF-8
LC_CTYPE="en_US.UTF-8"
LC_NUMERIC="en_US.UTF-8"
LC_TIME="en_US.UTF-8"
LC_COLLATE="en_US.UTF-8"
LC_MONETARY="en_US.UTF-8"
LC_MESSAGES="en_US.UTF-8"
LC_PAPER="en_US.UTF-8"
LC_NAME="en_US.UTF-8"
LC_ADDRESS="en_US.UTF-8"
LC_TELEPHONE="en_US.UTF-8"
LC_MEASUREMENT="en_US.UTF-8"
LC_IDENTIFICATION="en_US.UTF-8"
LC_ALL=

locale -a

C
C.utf8
de_AT
de_AT@euro
de_AT.utf8
de_BE
de_BE@euro
de_BE.utf8
de_CH
de_CH.utf8
de_DE
de_DE@euro
de_DE.utf8
de_IT
de_IT.utf8
de_LI.utf8
de_LU
de_LU@euro
de_LU.utf8
en_AG
...

locale -m

...
ISO-8859-1
ISO-8859-10
ISO-8859-11
ISO-8859-13
ISO-8859-14
ISO-8859-15
...

A: By using an resource bundle key instead of the plain text we managed to get it work. In the resource bundle key we use escaping for Umlaute. That solves the problem for us. However, I still don't know how to install de_DE.iso88591


text:
Q: DBEngine(0)(0).Execute DELETE to complete before APPEND I have two statements in VBA. Here is a fragment of code:
'delete records from tbl_PLAN_data
 strErr = "1a"
    strSQL = "DELETE tbl_PLAN_data.*"
    strSQL = strSQL & " FROM tbl_PLAN_data;"
DBEngine(0)(0).Execute strSQL, dbFailOnError + dbSeeChanges
DoEvents

strErr = "2a"
'append records to tbl_PLAN_data
DBEngine(0)(0).Execute "qryAppPLAN", dbFailOnError + dbSeeChanges
DoEvents

SQL string of qryAppPLAN:
INSERT INTO tbl_PLAN_data ( ID, Qty, QtyPln, QtyAct, ProdT, TmStamp, TID, Wks, vol, v4, v4k, DataPln, Shift, DataPlnShift, GRD, Wk, Wkd, GRDLdKf, KFig )
SELECT tbl_OrderDetailsSub.OrderDetailsSubID, [Quantity]-Sum(Nz([Qtyact],0)*IIf([np]=0,1,-1)) AS Qty, tbl_OrderDetails.Quantity, Sum(Nz([Qtyact],0)*IIf([np]=0,1,-1)) AS QA, Sum(tbl_OrderDetailsSub.PT) AS SumOfPT, Now() AS TmStamp, tbl_OrderDetailsSub.TID, tbl_Tooling.WksID, tbl_OrderDetailsSub.Volume, tbl_OrderDetailsSub.Vol4, tbl_OrderDetailsSub.Vol4K, tbl_OrderDetailsSub.DataPln, tbl_OrderDetailsSub.Shift, [datapln] & "-" & [shift] AS datshift, IIf(InStr([oprdetails],"G")>0 Or InStr([oprdetails],"Hs")>0 And InStr([oprdetails],"GL")=0,1,0) AS GRD, DatePart("ww",[DataPln],0,2) AS w, DatePart("w",[DataPln],0,2) AS wd, tbl_OrderDetailsSub.TblLoadKf, Nz([Koef],1) AS Expr1
FROM ((tbl_Order INNER JOIN (tbl_OrderDetails INNER JOIN tbl_OrderDetailsSub ON tbl_OrderDetails.[OrderDetailsID] = tbl_OrderDetailsSub.[OrderDetailsID]) ON tbl_Order.[OrderID] = tbl_OrderDetails.[OrderID]) LEFT JOIN tbl_ProdAct ON tbl_OrderDetailsSub.[OrderDetailsSubID] = tbl_ProdAct.ODSubID) INNER JOIN tbl_Tooling ON tbl_OrderDetailsSub.TID = tbl_Tooling.TID
WHERE (((tbl_Order.ProdTypeID)<>"S" Or (tbl_Order.ProdTypeID) Is Null) AND ((tbl_Order.CancelledDate) Is Null) AND ((tbl_Order.RefusingReason) Is Null) AND ((Right(CStr(Nz([tbl_Order]![ProcessedDate],"12:00:00")),8))="12:00:00") AND ((tbl_Order.OrderType)<>"Pasiûlymas") AND ((tbl_Order.ShippedDate) Is Null))
GROUP BY tbl_OrderDetailsSub.OrderDetailsSubID, tbl_OrderDetails.Quantity, tbl_OrderDetailsSub.TID, tbl_Tooling.WksID, tbl_OrderDetailsSub.Volume, tbl_OrderDetailsSub.Vol4, tbl_OrderDetailsSub.Vol4K, tbl_OrderDetailsSub.DataPln, tbl_OrderDetailsSub.Shift, [datapln] & "-" & [shift], IIf(InStr([oprdetails],"G")>0 Or InStr([oprdetails],"Hs")>0 And InStr([oprdetails],"GL")=0,1,0), DatePart("ww",[DataPln],0,2), DatePart("w",[DataPln],0,2), tbl_OrderDetailsSub.TblLoadKf, Nz([Koef],1), tbl_OrderDetails.Quantity
HAVING ((([Quantity]-Sum(Nz([Qtyact],0)*IIf([np]=0,1,-1)))>0) AND ((tbl_OrderDetailsSub.DataPln)>Date()-30))
ORDER BY tbl_OrderDetailsSub.DataPln;

Sometimes at second execute statement I get error "Record is deleted". It seems logic when I append records after deletion. But how to force VBA to wait till delete statement completes?

A: I would suggest you create a Database Object and execute on that object rather than using the DBEngine(0)(0), as when you use this, you are not only performing an expensive operation of creating a new instance of the Database, you are also trying to query the table which you just modified (deleted), so you might have a small glitch.
Dim dbObj As DAO.Database

Set dbObj = CurrentDB()
'delete records from tbl_PLAN_data
strErr = "1a"
strSQL = "DELETE tbl_PLAN_data.* FROM tbl_PLAN_data;"

dbObj.Execute strSQL, dbFailOnError + dbSeeChanges

'Optional
'DoEvents

strErr = "2a"
'append records to tbl_PLAN_data
dbObj.Execute "qryAppPLAN", dbFailOnError + dbSeeChanges

By creating a Database Object, you are making sure the operations are made against the "active" object on which you also made a modification, so would return you the right information. DoEvents might not even be required. I have added it, if you feel it is still causing problems introduce it again and see if it makes any difference.
Good Luck !


text:
Q: Semantic UI - Vertical centering a div Are there any known ways to center a <div> tag using Semantic UI's web development framework, without adding my own CSS styles?
I have tried several position-related tags in the documentation, such as <div class="centered grid'>, however these only work for horizontal centering.
This is not a case of challenging implementation, I am just surprised something as common as vertical centering isn't included within a web development framework, and I am curious if my Google searches and eyes have glazed over it. I would prefer to comply to the framework styles before creating custom styles. I know that there are several methods to implement my own vertical centering (this is the least preferable option in my opinion to implement), however I would prefer to use a class from the framework.

A: As per Semantic UI v2.2.2, you can force vertical alignment in the middle by adding middle aligned class(es). It affects the following elements:

*

*table, its rows and cells,

*grid, its rows and columns,

*image,

*list and item with an image,

*modal dialog content.

You cannot set vertical alignment in the middle that way to an arbitrary div element, outside any of these structures.
Otherwise, some other Semantic UI elements align their content vertically in the middle by default:

*

*header or message with an icon or image,

*circular segment,

*step,

*button etc.


text:
Q: Locate Python binary location in windows (Tensorflow) I'm trying to follow tensorflow instructions in R but am stuck on providing the Python binary path location on Windows. I believe the instructions are given to Mac environment? I would like to know where can I locate my Python binary on my windows environment.
Link to Tutorial: https://github.com/rstudio/tensorflow
Sys.setenv(TENSORFLOW_PYTHON="/usr/local/bin/python")

A: Try this on the command prompt:
python -c "import sys; print(sys.executable)"

That will give you the full executable path for the python version that you are using.
Output: [Your output may be different]
C:\Users\<username>\AppData\Local\Programs\Python\Python35\python.exe


text:
Q: Make a turing machine that accepts a certain language problem im having trouble solving the following problem:
Make a turing machine that accepts words from the following language: { x ∊ {a,b,c}* / x has a subsequence bbb on the center, before that subsequence it cannot contain a, and after the subsequence it cannot contain c}
I tried making a flow graph modelling the problem, my main problem is that the word can contain b's before the subsequence, and i don't know how to make a distinction between the b's before the subsequence and the subsequence itself (i kinda need to since it loops back to q0 an when it reaches the first b of the subsequence it diverts to the accepting state).
Here is a picture of my solution
If anyone could help me i would be really grateful.


text:
Q: World of Warcraft image processing As I´ve looked for a way to create an addon, which checks the WoW-PvP-Queue-Status, for creating a REST service, I was told that it`s not possible to have a real-time connection between an addon and a REST service. So I was thinking about another way to solve my problem and came to the point, where I thought about analyzing the WoW-Window and searching for a visual pattern to accomplish for what I´m looking for.
 My program should check and tell me, whenever a user of the program is queuing for an battleground and should also tell me on which battleground he/she is queuing, so I can gather the data and post it to my service/website. I could create some visual feedback with an WoW-Addon, for the events I´m looking for ... like a signal, which tells my program what to do.
So I´d like to know, how I would accomplish to create such signal-interpreter( so like an Screen Grabber). I was thinking about OpenCV, but dont know where to start, especially I´m kinda curious in how Warden(Anti Cheat Engine) would interpret such program, I really don`t want my users to get banned for such a thing. It should really just interpret visual feedback of the addon I´d create.
So for example:
If user queues for Arathi Basin, a yellow signal should pop and if the yellow signal pops up, the program tells my service that player xyz has queued up, which should be displayed later on ... on my homepage in real-time. If the user queues up for Warsong, another signal pops up, etc.
I´m currently just experienced with C#/.NET in an early stage and would start a little project with such an service, so what I need to learn to get this thing build up?
I really just would love to have a little guide on which knowledge I need, to solve this problem.

A: for Windows it is doable but grabbing WinAPI is a bit unstable.
So write new App that:

*

*you need to find the WoW Client window (its handle)

*grab its canvas as bitmap
If gfx driver allows it if not try to take the desktop image instead. So create canvas with:
Canvas->handle = GetDC(WOW_window_handle);

its size you get like this:
RECT r; GetWindowRect(WOW_window_handle,&r);

so now just copy rectangle from canvas to your bitmap for processing ...

*then you can do what ever you need to
as the image is computer generated it will not be too much noisy only scaled +/- some filters so it should be relatively easy to detect if the image contains battleground info or not. Also detect/read text in it should be easy enough

*if searched event/info was detected
then just send the data to your WEB
if you need to have this info also inside the ADDON
then you need to search for some way to receive it. I am not familiar with WoW addon programming so have no clue...
but I would try:

*

*if you got any IPC capability from Addon use it

*if you have access to files
then continuosly scan a file from addon and send the info there (be careful with multiple file access conflicts)

*can try to send keystrokes to your WoW client
if you can detect them from Addon or specific actions like wrote specific text message (not conflicting your movement keys)

*if you can hack in your Server/Clienet TCP/IP stream
you could inject packets with specific meaning like incoming private message etc but you would need to be familiar with WoW Server/Client communication (WoW uses SRP6 if I remember correctly) and it would increase the ping lag ... You still need to be able to detect it from Addon on the other hand you should be able to detect packets related to battleground and do not need to OCR/CV the WoW image ...
see these related Q/A's:

*

*list windows handle from outside app

*simple OCR

*How to recognize UI elements in image

*Putting an application in between client and server ... contains example of WoW SRP6 protocol packets in mine post there

*MaNGOS source repository ... can learn much about WoW from this

[Notes]
Each of the bullets is suitable for separate question so start coding and when hit a problem ask specific question about it


text:
Q: Prevent duplicate submission with post in jquery I have a form that submits with a button via jquery post(). Unfortunately it submits two times and as a result it duplicates records in mysql.
I have two files: register.php (that contains html and javascript) and tttt.php that runs sql.
My question is: how to modify my scripts in order to prevent double submission?
Please help me out.
this is link of the page
Part of register.php:
<form id="regForm" method="post" action="tttt.php">

</form>

Part of tttt.php:
   <?php
header("Content-Type: text/plain");
require_once("../private/connection.php");

if(isset($_POST["name"])  && !empty($_POST["name"]) && isset($_POST["lastname"]) && !empty($_POST["lastname"]) && isset($_POST["birthday"]) && !empty($_POST["birthday"])&&  isset($_POST["email"]) && !empty($_POST["email"]) && isset( $_POST["password"]) && !empty($_POST["password"]) && isset($_POST["confirmPassword"]) && !empty($_POST["confirmPassword"]) ){

        $name     =$conn->real_escape_string($_POST["name"]);
        $lastname =$conn->real_escape_string($_POST["lastname"]);
        $birthday =$conn->real_escape_string($conn->real_escape_string($_POST["birthday"]);
        $email    =$conn->real_escape_string($_POST["email"]);
        $password =$conn->real_escape_string($_POST["password"]);
        $hashed_password = password_hash($password, PASSWORD_BCRYPT);

        if ($result=$conn->query("INSERT INTO students (student_name,student_family,student_birthday,student_email,student_password)
VALUES ('$name','$lastname' ,'$birthday' ,'$email','$hashed_password')")) {

            echo "yes";
}
        else {
    echo "Error: " . $sql . "
" . $conn->error;
}

    }else

{  echo "no";}

        $conn->close();
    ?>

A: Before inserting the record, just do a check in the database if the user does not already exist. By what I see your unique columns would be email and the password hash. And do some proper error handling.

A: Change button type as button

<button type="button" id="sub" name="sub" class="btn btn-warning form-control pull-right">ثبت نام </button>


text:
Q: Can I add one permission to many files at the same time? I am using Git bash on a Windows 7 system.
I have a directory with 20 files in it.  They have various permissions, but they are all missing w for the group.
I want them all to have w for the group and would like to change them all at the same time.  That is, I want to just add w for the group to the existing permissions.
Is there a way to do that?

A: You need to use the chmod command.
Something like (untested):
chmod -R +w {dirname}

or
chmod +w *.ext

See the excellent online bash documentation on ss64 which gives you an interactive tool for getting the correct permissions.


text:
Q: Generate an xml file with all dependencies with maven I need to generate module.xml file for JBoss7 for a maven project which has a lot of jar-dependencies. What is the easiest way to do it? The file looks like:
<module xmlns="urn:jboss:module:1.0" name="ats.platform">
  <resources>
    <resource-root path="dom4j-1.6.1.jar"/>
    <resource-root path="jdom-1.0.jar"/>
...
  </resources>
</module>

so that the <resource-root> element should be created for each project jar-dependency.
Or maybe I doing something wrong? What's correct way to create a JBoss7 module from a maven project?

A: I don't really know about JBoss and whether there's another way to do this, but you can do it quite simply with GMaven:
<plugin>
    <groupId>org.codehaus.gmaven</groupId>
    <artifactId>gmaven-plugin</artifactId>
    <version>1.3</version>
    <configuration>
        <source>
            def sw = new StringWriter()
            def xml = new groovy.xml.MarkupBuilder(sw)
            xml.module(xmlns:'urn:jboss:module:1.0', name:'ats.platform') {
              resources {
                project.runtimeClasspathElements.each {
                  def path = it.find(".*?([\\w\\.-]*\\.jar)") { it[1] }
                  !path?:'resource-root'(path:path)
                }
              }
            }
            println sw
        </source>
    </configuration>
</plugin>

A couple of things to note:

*

*That script spits the XML out to stdout, but you can obviously write it to a file or whatever very easily.

*The runtimeClasspathElements contain absolute paths to the jar, which is why I parse it with a regex. You can adjust the regex to include more of the path or just prepend a string if you need more than just the jar file name.

I've posted a working example on github (it's just a POM) where I've bound the above plugin configuration to the initialize build phase. If you have git, you can clone and run it yourself with:
git clone git://github.com/zzantozz/testbed tmp
cd tmp
mvn -q initialize -pl stackoverflow/7755255-gmaven-to-build-xml-from-classpath

In the sample project, I added jdom 1.0 and dom4j 1.6.1 as dependencies, and here's the output it created:
<module xmlns='urn:jboss:module:1.0' name='ats.platform'>
  <resources>
    <resource-root path='jdom-1.0.jar' />
    <resource-root path='dom4j-1.6.1.jar' />
    <resource-root path='xml-apis-1.0.b2.jar' />
    <resource-root path='aspectjrt-1.6.11.jar' />
  </resources>
</module>

Note: I'm not a groovy expert, so there may be a groovier way to do it, but you can see how easy it is even so.

A: You could try smartics-jboss-modules-maven-plugin
It provides quite powerful dependency control:

*

*exclusions and inclusions (also with wildcards) of project deps,

*definition of deps to other JBoss modules,

*transitive dependencies handling

*and lot more

With proper descriptor, generated module is ready to be copied 'as is' to JBoss 7.
Example jboss-modules/foo.bar.foo-module.xml:
<modules xmlns="http://smartics.de/ns/jboss-modules-descriptor/1">
<module name="foo.bar.foo-module">
    <match>
        <includes>
            <include>
                <groupId>foo.*</groupId>
            </include>
            <include>
                <groupId>org.*</groupId>
            </include>
        </includes>
        <excludes>
            <exclude>org.slf4j.slf4j-api</exclude>
        </excludes>
    </match>

    <apply-to-module>
        <dependencies>
            <module name="org.slf4j" />
        </dependencies>
    </apply-to-module>
</module>

Also set excludeDependencyManagementDependenciesInPomProject to true in smartic plugin configuration to avoid including 50 MB of deps :)

A: This can be easily solved in a few steps.

*

*run mvn dependency:list -DoutputFile=dep.list -DoutputAbsoluteArtifactFilename=true in your shell
you will receive a file like this:
The following files have been resolved:
    ch.qos.logback:logback-classic:jar:0.9.30:test:C:\Dokumente und Einstellungen\michael-o.m2\repository\ch\qos\logback\logback-classic\0.9.30\logback-classic-0.9.30.jar
    ch.qos.logback:logback-core:jar:0.9.30:test:C:\Dokumente und Einstellungen\michael-o.m2\repository\ch\qos\logback\logback-core\0.9.30\logback-core-0.9.30.jar
    classworlds:classworlds:jar:1.1-alpha-2:compile:C:\Dokumente und Einstellungen\michael-o.m2\repository\classworlds\classworlds\1.1-alpha-2\classworlds-1.1-alpha-2.jar

The important information is indented by 4 spaces in the file.

*Now grep out the important information and do not forget to limit to compile and runtime scope.

*split columns with cut  -d ':' -f <colNum> and get the last column.

*Get the filename after the last (back)slash.

*Now build an XML file with the information.

Every can be packed in a nice shell script.
See the maven-dependency-plugin for reference.
A quick command looks like this: cat dep.list | grep -E ':(compile|runtime):' | cut -d ':' -f 7 | sed -e 's/\///g' | xargs -I {} basename '{}' | xargs -I {} echo "<resource-root path=\"{}\" />"
The output contains the jar files names:
<resource-root path="classworlds-1.1-alpha-2.jar" />
<resource-root path="jsr305-1.3.9.jar" />
<resource-root path="guava-10.0.1.jar" />
<resource-root path="commons-codec-1.3.jar" />
<resource-root path="commons-io-2.0.1.jar" />
<resource-root path="commons-lang-2.6.jar" />
<resource-root path="junit-4.9.jar" />

Now wrap with XML header and footer, and you are done!

A: Although this question is quite old and already has a valid answer, I'd like to mention another alternative.
As we started with JBoss modules we wrote a small plugin for Maven that generates module folders with module.xmls based on XML descriptors. The plugin is called smartics-jboss-modules-maven-plugin and you'll find additional information about it at the project's blog.
We just started to work with it, but it already makes the process of synchronization between the POM and the module.xml (plus directory structure) for our projects very easy.
The downside of this approach is that you have to learn an additional XML descriptor and have to configure an additional Maven plugin. So for small projects you may be better off following the solutions of the answers above.
If you want to give it a try, the plugin is licensed under Apache License 2.0.


text:
Q: JQuery Uncaught Error: Syntax error, unrecognized expression What's wrong with this:

Uncaught Error: Syntax error, unrecognized expression:
   #CAR_NO>option[value=486]

The main idea is that I have a dropdown and I have search that filters this dropdown and when I click an item after search this item should be selected but I keep getting this error for this case even though the code works well in other pages and forms
EDIT (code from the comments)

HTML code:

<select name="car_no" id="CAR_NO" class="search">
<option value="0" > --------- </option>
<?php
foreach($vars['CARSLIST'] as $row) {
?>
<option value="<?=$row['CAR_NO']?>"><?=$row['CAR_NO']?></option>
<? } ?>
</select>

jQuery code:

var result = $("#"+OptionId+">option:contains("+$("#keyword").val()+")");
for(i=0;i<result.length;i++){
FinalResult +=\'
\'+result[i].text+\'
\'}
$("#result").html(FinalResult);


text:
Q: error in upload image using php code is to store the image nto the database
the database structure is

if(!isset($_POST['upload']))
  {
echo '<form method="post" enctype="multipart/form-data" action="'.$_SERVER['PHP_SELF'].'">';
echo '<input type="file" name="image"/>';
echo '<input type="submit" name="upload" value="upload"/>';
echo '</form>';
   }
 else
   {
$upload='images/';
$name=$_FILES['image']['name'];
$tempname=$_FILES['image']['tmp_name'];
$filesize=$_FILES['image']['size'];
$filetype=$_FILES['image']['type'];
$path=$upload.$name;
$result=move_uploaded_file($tempname, $path);
if(!$result)
{
    echo "error";
}
$sql="INSERT INTO imaget(name,image) VALUES('$name','$path')";
if(($conn->query($sql))==true)
{
    $sql="SELECT * FROM imaget";
    if(($img=$conn->query($sql))==true)
    {
        echo "success";
    }
}
else
{
    echo "error in upload into database";
}
    }

it shows warning like this
Warning: move_uploaded_file(images/20140302_210804.jpg): failed to open stream: No such file or directory in C:\xampp\htdocs\new\image.php on line 18

Warning: move_uploaded_file(): Unable to move 'C:\xampp\tmp\php2923.tmp' to 'images/20140302_210804.jpg' in C:\xampp\htdocs\new\image.php on line 18

errorsuccess

why it shows warning and how to solve the warning anyone help me?

A: Why it shows warning?
Because it could not move the file move 'C:\xampp\tmp\php2923.tmp' to 'images/20140302_210804.jpg
Upload always put your file first to a temporary position, and then you are responsible to move it to the right position.
Maybe you should provide an absolute path in $upload.
If error still there, you can check your filesystem.
If error still there, use php file functions to see if php can read and write the directories.


text:
Q: $A$ closed subset of $\mathbb R^2$ , $r>0$ , is $X(A,r):=\{x\in \mathbb R^2 : \exists a\in A $ such that $d(x,a)=r\}$ closed in $\mathbb R^2$? Let $A$ be a closed subset of $(\mathbb R^2,d)$  , where $d$ is the usual euclidean metric , let $r>0$ , let
$X(A,r):=\{x\in \mathbb R^2 : \exists a\in A$ such that $d(x,a)=r\}$ , then is it true that $X(A,r)$ is closed in $\mathbb R^2$ ? Brian Scott's answer here shows that it need not necessarily be true for generic metric spaces  $A$ closed subset of a metric space $(M,d)$ , let $r>0$ , then is $X(A,r):=\{x\in M : \exists a\in A$ such that $d(x,a)=r\}$ closed in $M$?  , but $\mathbb R^2$ might have a nicer geometry . Please help . Thanks in advance

A: Yes. Specifically, in $(\Bbb R^2,d)$ all bounded closed sets are compact.
Let $p_n\in X(A,r)$ such that $p_n\to p$. By definition, there is $x_n\in A$ such that $d(x_n,p_n)=r$. Since $p_n$ converges, the set $\{p_n\,:\, n\in\Bbb N\}$ is bounded, hence $x_n$ is a bounded sequence. Therefore, there is a convergent subsequence $x_{n_k}\to x$ and, since $A$ is closed, $x\in A$. But, by continuity of $d$, $$d(p,x)=\lim\limits_{k\to\infty}d\left(p_{n_k},x_{n_k}\right)=r$$
Hence, $p\in X(A,r)$.


text:
Q: Content Editable UIWebView scrolls and overlaps over the button/images of uiview in iOS I have a view with few buttons and UIWebView which loaded content editable HTML.
In UIWebView i am inserting images/Canvas using both native and javascript functionality.
Since the WebView is editable whenever webview is clicked keyboard comes up. Now when we are inserting/editing a image/canvas keyboard should hide. So for that i am checking for tap event, getting the id of the element at that position and hiding the keyboard if that is a image/canvas using [webview endEditing:YES];.
Now the problem what i am facing is that if i add 2-3 images and then clicks on the webview, webview starts moving from its position and overlaps the button/images kept at the uiview. So the button are not visible and i am not able to perform the actions related to that.

A: Issue resolved. I was using some kind of animation when the keyboard was show/hidden. Once i removed that uiwebview doesn't moves.


text:
Q: Nginx: hide port for different domains on single server I have 4 domains and 1 server. I install nginx and put 4 landing pages.
Example for one of them:
server {
   listen 2000;
   root /path/to;
   index index.html;
   server_name 1.1.1.1;
   location / {
       allow all;
   }
}

How I can redirect my domains for one of this landing pages? for example, when I open page http://mydomain.com i get landing page from address 1.1.1.1:2000

A: Try this. This will listen on different ports. So you have to access it via example1000.com:1000. Or you could change all listen to 80, and access it via example1000.com, example2000.com, etc,.
server {
  listen 1000;

  # The host name to respond to
  server_name example1000.com;

  # Path for static files
  root /sites/example1000.com/public;

  # Index
  index index.html
}

server {
  listen 2000;

  # The host name to respond to
  server_name example2000.com;

  # Path for static files
  root /sites/example2000.com/public;

  # Index
  index index.html
}


text:
Q: How to add a button to a table cell to make the button as part of the cell? Just like the Properties view of Winderbuilder Here is the UI of Windowbuilder:
http://www.java-forums.org/blogs/eclipse/attachments/2900d1328496793-using-windowbuilder-design-gui-eclipse-properties-pane.png
The  Properties view is at the bottom left of the UI, you can see there is a cell with "dialog15" text and a button at its right hand.
Now I want to create such cell in my table: User can input text to the cell directly, or click the button to select the existing text in a new opened window... But I don't know how to start it. Could anyone give me a hand? Any tutorial?
BTW, I am using SWT. I found some examples using SWING, but haven't found any good tutorial using SWT

A: I think you are looking for CellEditor / Table Editor concepts in Jface table viewer.
jface sample snippets