text:
Q: Sending JSON string to my backend code to add it to my DB but it's not adding anything I've been stuck on this problem for a good bit
I'm trying to add an object to my database through jQuery/AJAX. Apparently, there are no errors but it's not adding anything to my DB.
This is my JS/JQuery code:
var student = new Object();
student.Name = $("#txtNameAdd").val();
student.Age = $("#txtAgeAdd").val();
student.Email = $("#txtEmailAdd").val();

$.ajax({
    type: "POST",
    url: "Default.aspx/AddStudent",
    data: "{'studentJSONString':'" + JSON.stringify(student) + "'}",
    success: function (response) {
        $("#lblSuccessAdd").text("Success!");
        $("#lblSuccessAdd").css("display", "block");
    },
    error: function (response) {
        alert(response.responseJSON);
    }
});

My JS code points towards this code I have in my Default.aspx page code:
    [WebMethod]
    public static void AddStudent(string studentJSONString)
    {
        JavaScriptSerializer converter = new JavaScriptSerializer();
        Student a = converter.Deserialize<Student>(studentJSONString);
        WebMethods.AddStudent(a);
    }

Which points to this code in my WebMethods.cs class
    [WebMethod]
    public static void AddStudent(Student student)
    {
        MasterStudent master = new MasterStudent();
        master.AddStudent(student);
    }

And finally that goes to my class library and finishes with this method in MasterStudent:
    public void AddStudent(Student student)
    {
        if (string.IsNullOrWhiteSpace(student.Name))
        {
            throw new Exception("There's no name");
        }
        if (string.IsNullOrWhiteSpace(student.Email))
        {
            throw new Exception("There's no email");
        }

        using (studentEntities model = new studentEntities())
        {
            model.student.Add(student);
            model.SaveChanges();
        }
    }

I run the code and the Console doesn't log any problems but it also doesn't do anything.
I have run very similar code on a Forms application with no problems so I'm kind of in a pickle right now. Does anyone know why it keeps failing?

A: Have you tried attaching a debugger to it and verifying that the student object is not null prior to model.SaveChanges() ?
Try debugging and verifying that the student string is being converted to an actual Student object first.
If it is, then try profiling the DB and validate any commands issued.

A: var student = new Object();
student.Name = $("#txtNameAdd").val();
student.Age = $("#txtAgeAdd").val();
student.Email = $("#txtEmailAdd").val();

$.ajax({
    type: "POST",
    url: "Default.aspx/AddStudent",
    data: student,
    success: function (response) {
        $("#lblSuccessAdd").text("Success!");
        $("#lblSuccessAdd").css("display", "block");
    },
    error: function (response) {
        alert(response.responseJSON);
    }
});

Then you can to point to this WebMethod.
[WebMethod]
public static void AddStudent(Student student)
{
    MasterStudent master = new MasterStudent();
    master.AddStudent(student);
}

Try this.

A: So I actually did find a solution shortly after posting my question, I changed my JQuery AJAX call to look like this:
    $.ajax({
    type: "POST",
    url: "Default.aspx/AddStudent",
    data: "{'studentJSONString':'" + JSON.stringify(student) + "'}",
    contentType: "application/json; charset=utf-8",
    dataType: "json",
    success: function (response) {
        $("#lblSuccessAdd").text("Success!");
        $("#lblSuccessAdd").css("display", "block");
    },
    error: function (response) {
        $("#lblErrorAdd").text(response.responseJSON.Message);
        $("#lblErrorAdd").css("display", "block");
    }
});

And it actually works now! so either the dataType or contentType were very important for what I was trying to do
Thanks for your answers everybody


text:
Q: Custom Python Dominate Tag Element To support both a JPEG and WEBP compressed image, I'd like to include the following HTML code in a web page:
<picture>
  <source srcset="img/awesomeWebPImage.webp" type="image/webp">
  <source srcset="img/creakyOldJPEG.jpg" type="image/jpeg">

</picture>

I've been using Python Dominate and it has generally worked well for me.
But the Picture and Source tags I think are not supported by Dominate.
I could add the HTML as a raw() Dominate tag, but was wondering if there was a way to get Dominate to recognize these tags.
p = picture()
with p:
    source(srcset=image.split('.')[0]+'.webp', type="image/webp")
    source(srcset=image, type="image/jpeg")
    img(src=image, alt=imagealt)

I am seeing this kind of error:
p = picture()
NameError: global name 'picture' is not defined

A: You can create a picture class by inheriting from the dominate.tags.html_tag class
from dominate.tags import html_tag

class picture(html_tag):
    pass

This can now be used as any of the predefined tags.

A: Dominate is used to generate HTML(5) documents.
The list of elements are defined in the tags.py file, see the repository in GitHub: https://github.com/Knio/dominate/blob/master/dominate/tags.py.
But, picture is not a standard tag.
You may look at the lxml library which contains a ElementMaker similar to Dominate to build XML tree easily. See the E-Factory.
For instance:
>>> from lxml.builder import E

>>> def CLASS(*args): # class is a reserved word in Python
...     return {"class":' '.join(args)}

>>> html = page = (
...   E.html(       # create an Element called "html"
...     E.head(
...       E.title("This is a sample document")
...     ),
...     E.body(
...       E.h1("Hello!", CLASS("title")),
...       E.p("This is a paragraph with ", E.b("bold"), " text in it!"),
...       E.p("This is another paragraph, with a", "\n      ",
...         E.a("link", href="http://www.python.org"), "."),
...       E.p("Here are some reserved characters: <spam&egg>."),
...       etree.XML("
And finally an embedded XHTML fragment.
"),
...     )
...   )
... )

>>> print(etree.tostring(page, pretty_print=True))

    <title>This is a sample document</title>

Hello!

This is a paragraph with bold text in it!

This is another paragraph, with a
      link.

Here are some reserved characters: <spam&egg>.

And finally an embedded XHTML fragment.

redpajama_set_name: RedPajamaStackExchange


text:
Q: Apply function over nested multiple-variable list with lapply I have function that takes the form
myfun<-function(Year, ID, Species, Abundance, resamps) {do something}
"resamps" means resampling and it takes a single number (e.g. 20)
I had no problem applying the function over a dataframe as it accepts data in the form:
<-myfun(mydata$Year, mydata$Bay, mydata$Species, mydata$Abundance, 20)
I need to apply this function over a list with the following structure
 $ TX_ARAB:Classes 'tbl_df', 'tbl' and 'data.frame':    308670 obs. of  4 variables:
  ..$ Year     : chr [1:308670] "1982" "1982" "1982" "1982" ...
  ..$ Bay      : chr [1:308670] "TX_ARAB" "TX_ARAB" "TX_ARAB" "TX_ARAB" ...
  ..$ Species  : chr [1:308670] "Anchoa mitchilli" "Brevoortia patronus" "Dorosoma cepedianum" "Leiostomus xanthurus" ...
  ..$ Abundance: num [1:308670] 1 243 1 24 3 6 26 6 1 1 ...
 $ TX_COCB:Classes 'tbl_df', 'tbl' and 'data.frame':    344467 obs. of  4 variables:
  ..$ Year     : chr [1:344467] "1982" "1982" "1982" "1982" ...
  ..$ Bay      : chr [1:344467] "TX_COCB" "TX_COCB" "TX_COCB" "TX_COCB" ...
  ..$ Species  : chr [1:344467] "Anchoa mitchilli" "Micropogonias undulatus" "Ariopsis felis" "Archosargus probatocephalus" ...
  ..$ Abundance: num [1:344467] 6 17 10 1 16 3 2 42 1 11 ...

It's no surprise that it didn't work when I did
d = lapply(mylist, myfun, resamps = 20)
I don't know how to get the function to accordingly use relevant object in the list given that I had to pass the data name with the objects when it was applied over a dataframe.


text:
Q: Grouping the top 2 column maximum value in pandas I am trying to group my dataset into years which has the highest overall review. But when I tried using groupby nlargest, it is returning only year and review overall score.
For example:
style | year | review_score
a     | 1990 | 4.0
b     | 1990 | 5.0
c     | 1990 | 4.2

My output should be
style | year | review_score
b     | 1990 | 5.0
c     | 1990 | 4.2

I tried the below approach:
v=style.groupby(by='review_year')['beer_style']['review_overall'].nlargest(3)

Please help me

A: I think need set_index of all columns which need keep first:
v = style.set_index('style').groupby(by='year')['review_score'].nlargest(2).reset_index()
print (v)
   year style  review_score
0  1990     b           5.0
1  1990     c           4.2

And alternative is sorting first by both columns with sort_values and call GroupBy.head:
v = (style.sort_values(['year','review_score'], ascending=(True, False))
          .groupby(by='year').head(2))
print (v)
  style  year  review_score
1     b  1990           5.0
2     c  1990           4.2


text:
Q: Swift error: Cannot call value of non-function type "SKSpriteNode" I tried to translate this github code that was in Swift 1 to Swift 2. That makes a rope like in this video.
My translated Rope.swift finished looking like this:
//
//  Rope.swift
//  SKSwiftRopeDemo
//
//  Created by Jeremy Higgins on 6/10/14.
//  Copyright (c) 2014 Digital Buckeye. All rights reserved.
//

import SpriteKit

class Rope : SKNode {

    var ropeTexture : String
    var node1 : SKNode
    var node2 : SKNode
    var parentScene : SKScene

    init(parentScene scene : SKScene, node node1 : SKNode, node node2 : SKNode, texture tex : String) {

        self.ropeTexture = tex
        self.node1 = node1
        self.node2 = node2
        self.parentScene = scene

        super.init()
        self.name = "rope"

        self.createRope()
    }

    required init(coder aDecoder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }

    func createRope() {
        // Calculate distance & angle

        let deltaX = node2.position.x - node1.position.x
        let deltaY = node2.position.y - (node1.position.y  + (node1.frame.size.height / 2))
        let total = deltaX * deltaX + deltaY * deltaY
        let distance = Float(sqrtf(Float(total)))
        let height = Float(SKSpriteNode(imageNamed: "Rope").size.height - 1.0)
        let p = (distance / height)

        var points = Int(p)
        points -= 1;

        let vX = CGFloat(deltaX) / CGFloat(points)
        let vY = CGFloat(deltaY) / CGFloat(points)

        let vector = CGPoint(x: vX, y: vY)
        var previousNode : SKSpriteNode?
        let angle = atan2f(Float(deltaY), Float(deltaX))

        for i in 0...points {
            var x = self.node1.position.x
            var y = self.node1.position.y + (self.node1.frame.size.height / 2)

            y += vector.y * CGFloat(i)
            x += vector.x * CGFloat(i)

            let ropePiece = SKSpriteNode(imageNamed: self.ropeTexture)
            ropePiece.name = "rope"
            ropePiece.position = CGPoint(x: x, y: y)
            ropePiece.zRotation = CGFloat(angle + 1.57)
            ropePiece.zPosition = -1

            ropePiece.physicsBody = SKPhysicsBody(rectangleOfSize: ropePiece.size)

            ropePiece.physicsBody?.collisionBitMask = 2
            ropePiece.physicsBody?.categoryBitMask = 2
            ropePiece.physicsBody?.contactTestBitMask = 2

            self.parentScene.addChild(ropePiece)

            if let pNode = previousNode {
                let pin = SKPhysicsJointPin.jointWithBodyA(pNode.physicsBody!, bodyB: ropePiece.physicsBody!, anchor: CGPoint(x: CGRectGetMidX(ropePiece.frame), y: CGRectGetMidY(ropePiece.frame)))
                self.parentScene.physicsWorld.addJoint(pin)
            } else {
                if i == 0 {
                    let pin = SKPhysicsJointPin.jointWithBodyA(self.node1.physicsBody!, bodyB: ropePiece.physicsBody!, anchor: CGPoint(x: CGRectGetMidX(self.node1.frame), y: CGRectGetMaxY(self.node1.frame)))
                    self.parentScene.physicsWorld.addJoint(pin)
                }
            }

            previousNode = ropePiece
        }

        if let pNode = previousNode {
            let pin = SKPhysicsJointPin.jointWithBodyA(self.node2.physicsBody!, bodyB: pNode.physicsBody!, anchor: CGPoint(x: CGRectGetMidX(pNode.frame), y: CGRectGetMidY(pNode.frame)))
            self.parentScene.physicsWorld.addJoint(pin)
        }
    }

    func destroyRope() {
        self.parentScene.enumerateChildNodesWithName("rope", usingBlock: { node, stop in
            node.removeFromParent()
        })
    }
}

And the GameScene.swift part became like this:
//
//  GameScene.swift
//  Hop Hope
//
//  Created by Sergio on 5/2/16.
//  Copyright (c) 2016. All rights reserved.
//

import SpriteKit

struct PhysicsCategory {
    static let Player : UInt32 = 0x1 << 1
    static let Ground : UInt32 = 0x1 << 2
    static let Rope : UInt32 = 0x1 << 3
}

class GameScene: SKScene {

    var Ground = SKSpriteNode()

    var Rope = SKSpriteNode()

    var Player = SKSpriteNode()
    let szPlayer = 60

    var anchor = SKSpriteNode()
    var aplayer = SKSpriteNode()

    override func didMoveToView(view: SKView) {
        // Physics border around screen
        self.physicsBody = SKPhysicsBody(edgeLoopFromRect: self.frame)

        // Static Body
        self.anchor = SKSpriteNode(color: UIColor.redColor(), size: CGSize(width: 50, height: 50))
        self.anchor.position = CGPoint(x: self.frame.size.width / 2, y: self.frame.size.height - anchor.size.height)
        self.anchor.physicsBody = SKPhysicsBody(rectangleOfSize: anchor.frame.size)
        self.anchor.physicsBody?.dynamic = false
        self.anchor.physicsBody?.collisionBitMask = 1
        self.anchor.physicsBody?.categoryBitMask = 1
        self.anchor.physicsBody?.contactTestBitMask = 1
        self.addChild(self.anchor)

        // Dynamic Body
        self.aplayer = SKSpriteNode(color: UIColor.greenColor(), size: CGSize(width: 50, height: 50))
        self.aplayer.position = CGPoint(x: aplayer.size.width * 2, y: self.frame.size.height / 2)
        self.aplayer.physicsBody = SKPhysicsBody(rectangleOfSize: aplayer.frame.size)
        self.aplayer.physicsBody?.collisionBitMask = 1
        self.aplayer.physicsBody?.categoryBitMask = 1
        self.aplayer.physicsBody?.contactTestBitMask = 1
        self.addChild(self.aplayer)

        // Create Rope
        var rope = Rope(parentScene: self, node: self.aplayer, node: self.anchor, texture: "Rope")

        var label = SKLabelNode(text: "Tap on screen to move block")
        label.fontColor = UIColor.blackColor()
        label.position = CGPoint(x: self.frame.size.width / 2, y: 200)
        self.addChild(label)

        ////////////////////////////////// rest of the code

The problem is that var rope = Rope(parentScene: self, node: self.aplayer, node: self.anchor, texture: "Rope") is giving the error Cannot call value of non-function type "SKSpriteNode"
And this is the only error that is giving, the rest of the code and files are just fine, and I have no ideia how to fix this. I already tried changing all the SKNodes in Rope.swift to SKSpriteNode, but this just gave more errors.

A: You've declared a variable called Rope as well as having a class called Rope:
var Rope = SKSpriteNode()

So, when you create the rope later:
var rope = Rope(parentScene: self, node: self.aplayer, node: self.anchor, texture: "Rope")

Swift thinks you are trying to use your variable Rope as a function pointer which you can't do with an SKSpriteNode.
Note: You should use names that start with a lowercase letter for variables and names that start with an uppercase letter for classes and structs.  If you had observed this convention, you wouldn't have had this problem.


text:
Q: How to perform property binding with disabled property in angular? I was trying to print the names of only those cities for which the isDisabled value is true and the rest of the cities' values should be in a disabled state. But I am getting errors as shown.
The kind of output i want is:
aaa , true
bbb , false
ccc , false
ddd , false
the first one should be highlighted and rest shoud be disabled.
HTML file:
<tr *ngFor="let x of cities;let i=index">
<td [disabled]="isDisabled[i]">
    <tr>{{x.name}} , {{isDisabled[i]}}</tr>
</td>

.ts file:
cities = [{ name: "aaa" }, { name: "bbb" }, { name: "ccc" }, { name: "ddd" }];
isDisabled=[true, false, false, false]

Template parse errors:
Can't bind to 'disabled' since it isn't a known property of 'td'

A: You need some css code to solve your problem:
td.disabled {
    font-weight: bold;
    cursor: not-allowed;
}

Attaching this style to your code you can do the following:
<tr *ngFor="let x of cities;let i=index">
<td [class.disabled]="isDisabled[i]">
    {{x.name}}, {{isDisabled[i]}}
</td>
</tr>


text:
Q: How to handle TypeScript promises with conditional branches? I am accessing a firebase database and I would like to do the following.  When a user logs in, I need to check the state of a variable in the database.  Depending on the state of this variable, I then want to do one of two things.  My code looks like this, but isn't correct.
firebase.database( ).ref( `sessions/${user.uid}` ).once( 'value' )
  .then( ( data : firebase.database.DataSnapshot ) => {
    if( !data.exists( ) ) {
      console.log( 'No active sessions. Creating a new one' );
      const sessionKey = firebase.database( ).ref( `sessions/${user.uid}` ).push( ).key;
      return firebase.database( ).ref( `sessions/${user.uid}/${sessionKey}` ).update( {
        myStruct: {
          myValue: 123,
        }
      } );
    } else {
      console.log( 'Found an existing session' );
      const obj = data.val( );
      const sessionKey = Object.keys( obj )[0];
      return firebase.database( ).ref( `sessions/${user.uid}/${sessionKey}` ).once( 'value' );
    }
  } )
  .then( ( data : any ) => {
    //what is data here?  Is it coming from the .update call, or from the .once call ??
    //if this is coming from the update call then I want to perform some stuff,
    //however if it is coming from the .once call, then I want to retrieve the myStruct.myValue and perform some other stuff.
  } )
  .catch( ( error : firebase.auth.Error ) => {
    console.log( error );
  } );

A: It's coming from whichever one is returned.  You probably need to move that logic up into the other function, or at least add the context you need to the object that gets passed the final .then:
firebase...once( 'value' )
.then((data : firebase.database.DataSnapshot ) => {
  if(!data.exists()) {
    return firebase...update(/* ... */).then(
        (data: any) => {
            return {
                type: 'update',
                data: data
            }
        }
    );
  } else {
    return firebase...once('value').then(
        (data: any) => {
            return {
                type: 'once',
                data: data
            }
        }
    );
  }
}).then(( data : any ) => {
    if (data.type === 'update') {

    } else if (data.type === 'once') {

    }
});


text:
Q: counter characters from a text file in python I have a text file in python. This text file is like this:
Aragon is an autonomous community in northeastern Spain. The capital of Aragon is Zaragoza, which is also the most populous city in the autonomous community. Covering an area of 47720 km2, the region's terrain ranges from permanent glaciers through verdant valleys, rich pastures and orchards to the arid steppe plains of the central lowlands. Aragon is home to many rivers, most notably the Ebro, Spain's largest river, which flows west to east throughout the region through the province of Zaragoza. It is also home to the highest mountains in the Pyrenees.

Now I would like to create a dict from collections to count how many times each character occur.
I gave the following  code for read the text file
with open("data/aragon.txt",'r') as data_file:
    for line in data_file:
        data = line.lower().strip().split()
        print(data)

Now I would like to now if there is an easier way to count the occurence of each character or is this the only method
from collections import Counter
Counter(['A','r','a','g','o','n','i','s','a','n','a','u','t','o','n','o','m','o','u','s','c','o','m','m','u','n','i','t','y','i','n','n','o','r','t','h','e','a','s','t','e','r','n','S','p','a','i','n','.'])

I did that just for the first phrase. But I would like to know if there is an easier way.

A: you are nearly there, the counter object has a dictionary-like interface, so, you can call update on it with the string to update its internal contents.
from collections import Counter

counter = Counter()
with open("data/aragon.txt",'r') as data_file:
    for line in data_file:
        data = line.lower().strip()  # no split is needed
        counter.update(data)
        print(data)
print(counter)


text:
Q: Accessing contents from a symbolic link created in htdocs We have set up apache server and created a symbolic to logs folder.
Problem:
When we try access the logs using http:/server:port/logs the logs appear properly in browser. However when we are using big ip url that is http:/bigipurl/logs url rewrites as http:/bigipurl:port/logs and the page doesnt get displayed.
Observation:
If we use http:/bigipurl/logs/ logs are getting displayed.

A: Figured this out, Added directoryslash off under the respective directory section in httpd.conf file.


text:
Q: Commented code that is still displayed on the site I'm trying to scrape data from basketball-reference.com and I have noticed that parts of the source file that are commented out actually are displayed on the website.
Here's the link to the site:
https://www.basketball-reference.com/players/j/jamesle01.html
view-source:https://www.basketball-reference.com/players/j/jamesle01.html
There are different categories of statistics displayed in a table, but for some reason only the "Per Game" category is not actually commented out, see part starting from line 864 is where the actual data is contained.
For the other categories the tags containing the data are all commented out, see e.g. line 1191 for the "Total" category or line 1278 for the "Per 36 Minutes" category.
I'm using scrapy and there is no way in xpath to extract any tags from commented code.
Can someone tell me how the code is still being displayed on the site and
whether it's possible to extract tags from comments in XPath?


text:
Q: Getting stuck on Matlab's subplot mechanism for matching images' points for vlfeat I am doing vlfeat in Matlab and I am following this question here.
These below are my simple testing images:
Left Image:

Right Image:

I did a simple test with 2 simple images here (the right image is just rotated version of the left), and I got the result accordingly:

It works, but I have one more requirement, which is to match the SIFT points of the two images and show them, like this:

I do understand that vl_ubcmatch returns 2 arrays of matched indices, and it is not a problem to map them for which point goes to which point on two images. However, I am currently stuck in matlab's procedure. I found this. But that only works if the subplot stays that way. When you add an image into the subplot, the size changes and the normalization failed.
Here is my code: (im and im2 are images. f, d and f2, d2 are frames and descriptors from vl_sift function from 2 images respectively)
    [matches score] = vl_ubcmatch(d,d2,threshold);%threshold originally is 1.5

if (mode >= 2)%verbose 2

    subplot(211);
    imshow(uint8(im));
    hold on;
    plot(f(1,matches(1,:)),f(2,matches(1,:)),'b*');

    subplot(212);
    imshow(uint8(im2));
    hold on;
    plot(f2(1,matches(2,:)),f2(2,matches(2,:)),'g*');

end

if (mode >= 3)%verbose 3

     [xa1 ya1] = ds2nfu(  f(1,matches(1,:)),  f(2,matches(1,:)));
     [xa2 ya2] = ds2nfu( f2(1,matches(2,:)), f2(2,matches(2,:)));

    for k=1:numel(matches(1,:))

        xxa1 = xa1(1, k);
        yya1 = ya1(1, k);
        xxa2 = xa2(1, k);
        yya2 = ya2(1, k);

        annotation('line',[xxa1 xxa2],[yya1 yya2],'color','r');
    end
end

The code above yields this:

I think subplot isn't a good way to go for something like this. Is there a better method for this in Matlab? If possible, I want something like an empty panel that I can draw my image, draw lines freely and zoom freely, just like drawing 2D games in OpenGL style.

A: From zplesivcak's suggestion, yes, it is possible, and not that problematic after all. Here is the code:
%  After we have applied vl_sift with 2 images, we will get frames f,f2,
%  and descriptor d,d2 of the images. After that, we can apply it into
%  vl_ubcmatch to perform feature matching:

[matches score] = vl_ubcmatch(d,d2,threshold); %threshold originally is 1.5

% check for sizes and take longest width and longest height into
% account
if (size(im,1) > size(im2,1))
    longestWidth = size(im,1);
else
    longestWidth = size(im2,1);
end

if (size(im,2) > size(im2,2))
    longestHeight = size(im,2);
else
    longestHeight = size(im2,2);
end

% create new matrices with longest width and longest height
newim = uint8(zeros(longestWidth, longestHeight, 3)); %3 cuz image is RGB
newim2 = uint8(zeros(longestWidth, longestHeight, 3));

% transfer both images to the new matrices respectively.
newim(1:size(im,1), 1:size(im,2), 1:3) = im;
newim2(1:size(im2,1), 1:size(im2,2), 1:3) = im2;

% with the same proportion and dimension, we can now show both
% images. Parts that are not used in the matrices will be black.
imshow([newim newim2]);

hold on;

    X = zeros(2,1);
    Y = zeros(2,1);

    % draw line from the matched point in one image to the respective matched point in another image.
    for k=1:numel(matches(1,:))

        X(1) = f(1, matches(1, k));
        Y(1) = f(2, matches(1, k));
        X(2) = f2(1, matches(2, k)) + longestHeight; % for placing matched point of 2nd image correctly.
        Y(2) = f2(2, matches(2, k));

        line(X,Y);

    end

Here is the test case:

By modifying the canvas width and height of one of the images from the question, we see that the algorithm above will take care of that and display the image accordingly. Unused area will be black. Furthermore, we see that the algorithm can match the features of two images respectively.
EDIT:
Alternatively, suggested by Maurits, for cleaner and better implementation, check out Lowe SIFT matlab wrappers.

A: If you have Matlab Computer Vision Library installed on your disc already, you can simply use
M1 = [f(1, match(1, :)); f(2, match(1, :)); ones(1, length(match))];
M2 = [f2(1, match(2, :)); f2(2, match(2, :)); ones(1, length(match))];

showMatchedFeatures(im,im2,[M1(1:2, :)]',[M2(1:2, :)]','montage','PlotOptions',{'ro','g+','b-'} );


text:
Q: How do I modify the url that generate by submit I am using python 3.6 and django 3.0X
The problem I have is:
I want the flow is that when user select a brand and submit. The url path will generate as http://127.0.0.1:8000/show/car:Ford and link to url.py to pass to show.html
However when submit, the url path generated as http://127.0.0.1:8000/show?car=Ford
How can I get the correct url path that meet url.py.
That is why there are a '?' and '=' in url path?
Or how do I modify the url.py to meet the url path that generated by search.html?
Below are my codes:
search.html
<form name='my form' action='/show' method='GET'>
 Select a brand
<select name='car'>
    {% for m in maker %}
        <option value= '{{ m }}'> {{ m }} </option>
    {% endfor %}
</select>

<input type='submit' value='Go' />

show.html
Model:

{% for m in model %}
{{ m }}
{% endfor %}

url.py
urlpatterns = [
path('admin/', admin.site.urls),
path('', views.index),
path('index/', views.index),
path('welcome/', views.welcome),
path('django_plotly_dash/', include('django_plotly_dash.urls')),
path('search/', views.search),
path('index/buttons.html', views.buttons),
path('show/car:<str:brand>', views.show, name='show-url')

]
Views.py
def search(request):
    car = models.Cars.objects.all()
    df_car = read_frame(car)
    maker = list(df_car['make'].str.capitalize().unique())
    #maker = models.Cars.objects.values('make').distinct()
    return render(request, 'search.html', locals())

def show(request, brand):
    car = models.Cars.objects.filter(make=brand)
    df_car = read_frame(car)
    model = df_car.model.unique()

    return render(request, 'show.html', locals())

A: No, you cannot change the way how URLs work. The question mark separates the regular URL and the query -- which is the additional information being passed to the URL. If you forced changing it, the URL won't load properly and plus, there's not really any point in doing so.
If you're wondering if something like path('whatever/<str:name>, ...) will work in the format with question marks, it will.


text:
Q: SQL Server - Select every second in a day Using: SQL Server 2008 R2
I'd like to write a query that will select (ordered, in a single column) every second in a day in datetime format.
Ex.
2012-02-02 00:00:00
2012-02-02 00:00:01
2012-02-02 00:00:02
2012-02-02 00:00:03
2012-02-02 00:00:04
...
2012-02-02 23:59:58
2012-02-02 23:59:59

Yeah, seriously.
I can make a numbers table if need be, which might be helpful if I can convert integer values to datetime.
Thanks in advance.

A: This assumes a numbers table with values up to 86,400... the number of seconds in a day.
To illustrate, I create a numbers table here... but you should do this ahead of time.
SET NOCOUNT ON

DECLARE @YourDate DATETIME
SET @YourDate = '2/2/2012'

DECLARE @Numbers TABLE (Number INT)
DECLARE @Index INT

SET @Index = 0
WHILE (@Index < 86400)
BEGIN
    INSERT INTO @Numbers VALUES (@Index)
    SET @Index = @Index + 1
END

SELECT DATEADD(SECOND, n.Number, @YourDate)
FROM @Numbers n
WHERE n.Number < 86400

A: If you don't want to rely on another table, using a CTE, while likely more CPU intensive could be another option.
;WITH q (TimeOfDay) AS (
    SELECT  DATEADD(dd, DATEDIFF(dd, 0, GETDATE()), 0)
    UNION ALL
    SELECT  DATEADD(ss, 1, q.TimeOfDay)
    FROM    q
    WHERE   DAY(GETDATE()) = DAY(DATEADD(ss, 1, q.TimeOfDay))
)
SELECT  *
FROM    q
OPTION  (MAXRECURSION 0)

A: If you don't want to rely on a table or a recursive CTEs, use a few cross joins. If you need more numbers for your sequence, just add more cross joins - you can get past a few million pretty quick.
DECLARE @start_date AS DATETIME = '2012-02-02';
WITH L0 AS (SELECT 1 AS C UNION ALL SELECT 1),       --      2
     L1 AS (SELECT L0.C FROM L0 CROSS JOIN L0 AS B), --      4
     L2 AS (SELECT L1.C FROM L1 CROSS JOIN L1 AS B), --     16
     L3 AS (SELECT L2.C FROM L2 CROSS JOIN L2 AS B), --    256
     L4 AS (SELECT L3.C FROM L3 CROSS JOIN L3 AS B), --  65536
     L5 AS (SELECT L4.C FROM L4 CROSS JOIN L4 AS B), --   Alot
      N AS (SELECT ROW_NUMBER() OVER(ORDER BY L5.C) AS n FROM L5),
      D AS (SELECT DATEADD(SECOND, n - 1, @start_date) AS d, n FROM N)
SELECT d from D where n <= (60 * 60 * 24)


text:
Q: How to delete a row from the table Laravel in controller (does not contain id in databas) The database was not created by Laravel, but I want to delete a row from the table, and there is no "id" for this row, because it is an intermediate table, how in this case can I delete this row from the table ?!
$productCustomer->delete();

Tables it contains 3 columns:

*

*customer_id

*product_id

*date_added

A: Make one column primary key in you model ProductCustomer.php
protected $primaryKey = 'customer_id';

ProductCustomer::where('customer_id', $id)->delete();

But here Be sure that which row you need to delete
Because it delete more than one row if it matches. So you should take another where
ProductCustomer::where('customer_id', $customer_id)->where('product_id',$product_id)->delete();

Or you can add a new migration file where you add id column with auto increment

A: You can't delete like without a primary key, you can set one.
Or use classical query (for example) :
ProductCustomer::where('customer_id', $id)->delete();


text: Q: Borrar informacion especifica dentro de un .txt creado Estoy haciendo un programa en python que al abrirse necesita poder ver la informacion guardada en el archivo .txt y tambien poder borrar ciertas lineas. Logre que lo guarde y lo muestre en pantalla, pero no se como borrarlo. Alguna ayuda?


text:
Q: Multiple dispatch for multiple arguments Is there an elegant way to obtain multiple dispatch for methods with 2 parameters (or even more) in OO languages with (single) dynamic dispatch?
Example of a possible problem:
This is a Java-inspired example. (the problem is not language related!)
// Visitable elements
abstract class Operand {
}
class Integer extends Operand {
    int value;
    public int getValue() {
        return value;
    }
}
class Matrix extends Operand {
    int[][] value;
    public int[][] getValue() {
        return value;
    }
}

// Visitors
abstract class Operator {
    // Binary operator
    public Operand eval(Operand a, Operand b) {
        return null; // unknown operation
    }
}
class Addition extends Operator {
    public Operand eval(Integer a, Integer b) {
        return new Integer(a.getValue() + b.getValue());
    }
}
class Multiplication extends Operator {
    public Operand eval(Integer a, Integer b) {
        return new Integer(a.getValue() * b.getValue());
    }
    // you can multiply an integer with a matrix
    public Operand eval(Integer a, Matrix b) {
        return new Matrix();
    }
}

I have many Operator and Operand concrete types but only refer to them through their abstract types:
Operand a = new Integer()
Operand b = new Matrix();
Operand result;
Operator mul = new Multiplication();
result = mul.eval(a, b); // Here I want Multiplication::eval(Integer, Matrix) to be called

A: I decided to add to this since the above two answers are somewhat incomplete. I was myself curious about this issue but couldn't find an answer so had to do my own analysis. In general there are two approaches that can be used to implement multi-methods in languages like C++ or Java that support both single dynamic dispatch and something like typeof or runtime type identification.
For the double dispatch case the visitor pattern is most common (for Arg1->foo(Arg2) ) and I gather in most cases is preferred to using RTTI and switches or if statements. One can also generalize the visitor approach to the n case by i.e. Arg1->foo(Arg2,Arg3..ArgN) by chaining a series of single dispatches that call methods in a treelike structure that differentiate on the type of the arguments up to some k and split the number of ways of the k+1 argument. For example for a simple case of triple dispatch and only two instances of each type:
interface T1 {
    public void f(T2 arg2, T3 arg3);
}

interface T2 {
    public void gA(A a, T3 arg3)
    public void gB(B b, T3 arg3)
}

interface T3 {
    public void hAC(A a,C c);
    public void hAD(A a,D d);
    public void hBC(B b,C c);
    public void hBD(B b,D d);
}

class A implements T1 {
    public void f(T2 arg2, T3 arg3) {
        arg2->gA(this,arg3);
    }
}

class B implements T1 {
    public void f(T2 arg2, T3 arg3) {
        arg2->gB(this,arg3);
    }
}

class C implements T2 {
    public void gA(A a,T arg3) {
        arg3->hAC(a, this);
    }

    public void gB(B b,T arg3) {
        arg3->hBC(b, this);
    }
}

class D implements T2 {
    public void gA(A a,T arg3) {
        arg3->hAD(a, this);
    }

    public void gB(B b,T arg3) {
        arg3->hBD(b, this);
    }
}

class E implements T3 {
    public void  hAC(A a,C c) {
        System.out.println("ACE");
    }
    public void  hAD(A a,D d) {
        System.out.println("ADE");
    }
    public void  hBC(B b,C c) {
        System.out.println("BCE");
    }
    public void  hBD(B b,D d) {
        System.out.println("BDE");
    }

}

class F implements T3 {
    public void  hAC(A a,C c) {
        System.out.println("ACF");
    }
    public void  hAD(A a,D d) {
        System.out.println("ADF");
    }
    public void  hBC(B b,C c) {
        System.out.println("BCF");
    }
    public void  hBD(B b,D d) {
        System.out.println("BDF");
    }

}

public class Test {
    public static void main(String[] args) {
        A a = new A();
        C c = new C();
        E e = new E();

        a.f(c,e);
    }
}

Though the approach generalizes the problem are quite obvious. For each endpoint function in the worse case one has to write n-1 dispatch functions.
One can achieve something similar with runtime type identification via the instanceOf operator:
class Functions
{
    static void f(A a,C c,E e) {
        System.out.println("ACE");
    }
    static void f(A a,C c,F f) {
        System.out.println("ACF");
    }
    static void f(A a,D d,E e) {
        System.out.println("ADE");
    }
    static void f(A a,D d,F f) {
        System.out.println("ADF");
    }
    static void f(B b,C c,E e) {
        System.out.println("BCE");
    }
    static void f(B b,C c,F f) {
        System.out.println("BCF");
    }
    static void f(B b,D d,E e) {
        System.out.println("BDE");
    }
    static void F(B b,D d,F f) {
        System.out.println("BDF");
    }

    static void dispatch(T1 t1, T2 t2, T3 t3) {
        if( t1 instanceOf A)
        {
            if(t2 instance of C) {
                if(t3 instance of E) {
                    Function.F( (A)t1, (C)t2, (E)t3 );
                }
                else if(t3 instanceOf F) {
                    Function.F( (A)t1, (C)t2, (F)t3 );
                }
            }
            else if(t2 instance of D) {
                if(t3 instance of E) {
                    Function.F( (A)t1, (D)t2, (E)t3 );
                }
                else if(t3 instanceOf F) {
                    Function.F( (A)t1, (D)t2, (F)t3 );
                }
            }
        }
        else if(t1 instanceOf B) {
            if(t2 instance of C) {
                if(t3 instance of E) {
                    Function.F( (B)t1, (C)t2, (E)t3 );
                }
                else if(t3 instanceOf F) {
                    Function.F( (B)t1, (C)t2, (F)t3 );
                }
            }
            else if(t2 instance of D) {
                if(t3 instance of E) {
                    Function.F( (B)t1, (D)t2, (E)t3 );
                }
                else if(t3 instanceOf F) {
                    Function.F( (B)t1, (D)t2, (F)t3 );
                }
            }
        }
    }
}

The second solution can probably be further simplified using reflection.

A: I am not sure that I will answer your question, but I hope I can add a bit to the discussion. I will try to come back later with a more general answer, but in this one I will focus only on your example above.
The problem with the example given in the question is that it is based on arithmetical operations and that makes it inherently complex because the implementation of a given operator changes depending on the types of its operands.
I think that the problem obscures the question a little bit, e.g. we could spend time trying to make your example work instead of dealing with multiple dispatch issues.
One way to make your code work would be to think from a different point of view. Instead of defining an abstraction called Operator what we could do is to recognize the inherent nature of the operands, namely that they must provide an implementation of every possible operation that can affect them. In object-oriented terms, every operand packs a bunch of actions that can affect them.
And so, imagine I have an interface Operand like this, that defines every possible operation an operand supports. Notice that I not only defined one method variance per every possible known operand but also one method for a general case of another unknown operand:
interface Operand {
    Operand neg();
    Operand add(Int that);
    Operand add(Decimal that);
    Operand add(Operand that);
    Operand mult(Int that);
    Operand mult(Decimal that);
    Operand mult(Operand that);
    Operand sub(Int that);
    Operand sub(Decimal that);
    Operand sub(Operand that);
}

Then now consider that we had two implementations of this: Int and Decimal (I will use decimal instead of the matrix of your example for simplicity).
class Int implements Operand {
    final int value;
    Int(int value) { this.value = value; }
    public Int neg(){ return new Int(-this.value); }
    public Int add(Int that) { return new Int(this.value + that.value); }
    public Decimal add(Decimal that) { return new Decimal(this.value + that.value); }
    public Operand add(Operand that) { return that.add(this); } //!
    public Int mult(Int that) { return new Int(this.value * that.value); }
    public Decimal mult(Decimal that) { return new Decimal(this.value * that.value); }
    public Operand mult(Operand that) { return that.mult(this); } //!
    public Int sub(Int that) { return new Int(this.value - that.value); }
    public Decimal sub(Decimal that) { return new Decimal(this.value - that.value); }
    public Operand sub(Operand that) { return that.neg().add(this); } //!
    public String toString() { return String.valueOf(this.value); }
}

class Decimal implements Operand {
    final double value;
    Decimal(double value) { this.value = value; }
    public Decimal neg(){ return new Decimal(-this.value); }
    public Decimal add(Int that) { return new Decimal(this.value + that.value); }
    public Decimal add(Decimal that) { return new Decimal(this.value + that.value); }
    public Operand add(Operand that) { return that.add(this); } //!
    public Decimal mult(Int that) { return new Decimal(this.value * that.value); }
    public Decimal mult(Decimal that) { return new Decimal(this.value * that.value); }
    public Operand mult(Operand that) { return that.mult(this); } //!
    public Decimal sub(Int that) { return new Decimal(this.value - that.value); }
    public Decimal sub(Decimal that) { return new Decimal(this.value - that.value); }
    public Operand sub(Operand that) { return that.neg().add(this); } //!
    public String toString() { return String.valueOf(this.value); }
}

Then I can do this:
Operand a = new Int(10);
Operand b = new Int(10);
Operand c = new Decimal(10.0);
Operand d  = new Int(20);

Operand x = a.mult(b).mult(c).mult(d);
Operand y = b.mult(a);

System.out.println(x); //yields 20000.0
System.out.println(y); //yields 100

Operand m = new Int(1);
Operand n = new Int(9);

Operand q = m.sub(n);
Operand t = n.sub(m);

System.out.println(q); //yields -8
System.out.println(t); //yeilds 8

The key points here are:

*

*Every operand implementation works in a similar way to a visitor pattern, in the sense that every operand implementation contains a dispatch function for every possible combination that you can get.

*The tricky part is the method that acts on any Operand. This is the place where we exploit the visitor dispatch power, because we know the exact type of this, but not the exact type of that, so we force the dispatch by doing that.method(this) and problem solved!

*However, since we invert the order of the evaluation, this has a problem with arithmetic operations that are not commutative, like the subtraction. That's why I do subtraction using addition instead (i.e. 1-9 equates to 1 + -9). Since addition is commutative.

And there you have it. Now I kind of found a solution to the specific example, but I have not provided a good solution to the multiple dispatch problem you originally had. That's why I said the example was not good enough.
Perhaps you could provide a better example, like the one in the Wikipedia page for Multiple Dispatch.
However, I think the solution will probably always be, reduce the problem to a series of single dispatches solved with some sort of visitor pattern like the one I did. If I have time, I will try to give it a shot later to a more general answer and not just this specific example.
But hopefully this post helps to foster further discussion and with luck it is step in the direction of the actual answer.

A: uncle bob did this:
 // visitor with triple dispatch. from a post to comp.object by robert martin http://www.oma.com
    /*
    In this case, we are actually using a triple dispatch, because we have two
    types to resolve.  The first dispatch is the virtual Collides function which
    resolves the type of the object upon which Collides is called.  The second
    dispatch is the virtual Accept function which resolves the type of the
    object passed into Collides.  Now that we know the type of both objects, we
    can call the appropriate global function to calculate the collision.  This
    is done by the third and final dispatch to the Visit function.
    */
    interface AbstractShape
        {
        boolean Collides(final AbstractShape shape);
        void Accept(ShapeVisitor visitor);
        }
    interface ShapeVisitor
        {
        abstract public void Visit(Rectangle rectangle);
        abstract public void Visit(Triangle triangle);
        }
    class Rectangle implements AbstractShape
        {
        public boolean Collides(final AbstractShape shape)
            {
            RectangleVisitor visitor=new RectangleVisitor(this);
            shape.Accept(visitor);
            return visitor.result();
            }
        public void Accept(ShapeVisitor visitor)
            { visitor.Visit(this); } // visit Rectangle
        }
    class Triangle implements AbstractShape
        {
        public boolean Collides(final AbstractShape shape)
            {
            TriangleVisitor visitor=new TriangleVisitor(this);
            shape.Accept(visitor);
            return visitor.result();
            }
        public void Accept(ShapeVisitor visitor)
            { visitor.Visit(this); } // visit Triangle
        }

    class collision
        { // first dispatch
        static boolean Collides(final Triangle t,final Triangle t2) { return true; }
        static boolean Collides(final Rectangle r,final Triangle t) { return true; }
        static boolean Collides(final Rectangle r,final Rectangle r2) { return true; }
        }
    // visitors.
    class TriangleVisitor implements ShapeVisitor
        {
        TriangleVisitor(final Triangle triangle)
            { this.triangle=triangle; }
        public void Visit(Rectangle rectangle)
            { result=collision.Collides(rectangle,triangle); }
        public void Visit(Triangle triangle)
            { result=collision.Collides(triangle,this.triangle); }
        boolean result() {return result; }
        private boolean result=false;
        private final Triangle triangle;
        }
    class RectangleVisitor implements ShapeVisitor
        {
        RectangleVisitor(final Rectangle rectangle)
            { this.rectangle=rectangle; }
        public void Visit(Rectangle rectangle)
            { result=collision.Collides(rectangle,this.rectangle); }
        public void Visit(Triangle triangle)
            { result=collision.Collides(rectangle,triangle); }
        boolean result() {return result; }
        private boolean result=false;
        private final Rectangle rectangle;
        }
    public class MartinsVisitor
        {
        public static void main (String[] args)
            {
            Rectangle rectangle=new Rectangle();
            ShapeVisitor visitor=new RectangleVisitor(rectangle);
            AbstractShape shape=new Triangle();
            shape.Accept(visitor);
            }
        }


text:
Q: I want to escalate the conversation to the agent portal i.e. Dynamaics omnichannel customer service. But I didn't get the response from agent portal Actually, I have built a bot and registered it with the azure service and Dynamics 365 omnichannel customer service. I want to escalate the conversation to the human agent from dynamics omnichannel customer service. I have a code snippet from Microsoft but that is in C#. I have written the logic according to the reference code in JavaScript but I didn't get a response from the agent side. Below is the C# code snippet but I want it in JavaScript. can anyone help me to solve this issue?
 if (turnContext.Activity.Text.Contains("agent") | conversation.EscalationDictionary.ContainsKey(turnContext.Activity.Text))
            {
                Dictionary<string, string> endConversationContext = new Dictionary<string, string>();
                if (conversation.EscalationDictionary.ContainsKey(turnContext.Activity.Text)) { endConversationContext = conversation.EscalationDictionary[turnContext.Activity.Text]; }

                await turnContext.SendActivityAsync("Transferring  to an agent, who can help you with this. Please remain online…");

                Dictionary<string, object> handOffContext = new Dictionary<string, object>()
                {
                    { "BotHandoffContext", "Specialist request" },
                    { "skill", "service" }
                };

                var handoffevent = EventFactory.CreateHandoffInitiation(turnContext, new
                {
                    MessageToAgent = "Issue Summary: billing question",
                    Context = handOffContext
                }); // Transcript is persisted by Omnichannel

                await turnContext.SendActivityAsync(handoffevent);
            }

this is a JavaScript code that I have written. But I didn't get a response from agent portal end.
async function handoffMiddleware(context, next) {
    if (context.activity.text == "agent") {
        await context.sendActivity("Transferring conversation to the agent")
        //    let activities = GetRecentActivities()
        let handoffContext = {
            botHandoffContext: "specialist request",
        }
        console.log(handoffContext)
        let handoffEvent = EventFactory.createHandoffInitiation(context, {
            message: "summary:fine",
            context: handoffContext,
        })
        handoffEvent.type = ActivityTypes.Message
        handoffEvent.text = "agent can handle this issue"
        console.log(handoffEvent)
        await context.sendActivity(handoffEvent)
    }
    await next()
}


text:
Q: Upload images to a different static web server I am building an application (PHP/Codeigniter/MySQL) where users can upload images. The main application will be on an Apache web server and all static files (images, videos, etc.) will be served from a Nginx web server.
Application Server : www.website.com
Static Server : static.website.com
Can anyone please whats the proper way to upload images to the Static web server? Links to the images will be stored on the main server, but the actual images are to be uploaded directly to the Nginx server.
Thanks

A:
Can anyone please whats the proper way to upload images to the Static web server?

To upload them to an server side program running on a dynamic server, and have that program move the files to a suitable location for the static server to pick them up.
That might involve transferring them across a local network if the two servers run on different machines.


text:
Q: Parsing JSON into oracle sql I have a table which has CLOB data type. Value of the column is actually JSON data.
{"ClassId":32000,"Attributes":
    [
        {"Name":"ID","Value":"4548"},
        {"Name":"HREF","Value":"-1"},
        {"Name":"HPRECISION","Value":"5"},
        {"Name":"HMETHOD","Value":"96"},
        {"Name":"GEO-METHOD","Value":"96"},
        {"Name":"GEO-PRECISION","Value":"5"},
        {"Name":"GEO-VISIBILITY","Value":"0"}
    ]
}
{"ClassId":30074,"Attributes":
        [
            {"Name":"ID","Value":"265794"},
            {"Name":"HREF","Value":"-1"},
            {"Name":"HPRECISION","Value":"5"},
            {"Name":"HMETHOD","Value":"100"},
            {"Name":"GEO-METHOD","Value":"90"},
            {"Name":"GEO-PRECISION","Value":"5"},
            {"Name":"GEO-VISIBILITY","Value":"0"}
        ]
    }

If I select the table table it will show like this

I need to parse the data so that I can get the output of HMETHODE and HPRECISION.
Classid ID      HREF HPRECISION HMETHOD
30074   265794  -1    5          96
32000   4548    -1    5          100

or may be the output will be like below

I was trying several method but getting either error or no data found. If anyone can fix this sql it would be very helpful.
select ClassId, NAME, VALUE
from importitem D,
JSON_TABLE
(
  D.JSON_DATA, '$' COLUMNS
  (
    ClassId NUMBER path '$.ClassId',
    NESTED path '$.Attributes[*]' COLUMNS
    (
    NAME NUMBER PATH '$.Namne',
    Value NUMBER PATH '$.Value'
    )
  )
) J ;

Or may be like this, i have tried two different way.
SELECT *
FROM   JSON_TABLE(
         '{"ClassId":30074,
           "Attributes":
            [
              {"Name":"ID","Value":"356605"},
              {"Name":"HREF","Value":"-1"},
              {"Name":"HPRECISION","Value":"5"},
              {"Name":"HMETHOD","Value":"96"},
              {"Name":"GEO-METHOD","Value":"96"},
              {"Name":"GEO-PRECISION","Value":"5"},
              {"Name":"GEO-VISIBILITY","Value":"0"}
            ]
        }',
         '$.Attributes'
         COLUMNS
           ID NUMBER PATH '$.Namne.Value',
           HREF NUMBER PATH '$.Namne.Value',
           HPRECISION NUMBER PATH  '$.Namne.Value',
           HMETHOD NUMBER PATH '$.Namne.Value'
);

A: I think that, you JSON data must be in that this format:
{"ClassId":32000,"Attributes":
    [
        {"ID":4548},
        {"HREF":-1},
        {"HPRECISION":5},
        {"HMETHOD":96},
        {"GEO-METHOD":96},
        {"GEO-PRECISION":5},
        {"GEO-VISIBILITY":0}
    ]
}

This is the correct format because in this format JSON has a KEYS (ID, HREF, HPRECISION...) and this KEYS has an integer values as (4548, -1, 5). In this case, then our query will be as:
SELECT CLASSID, ATRB_ID, HREF, HPRECISION, HMETHOD, GEOMETHOD, GEOPRECISION, GEOVISIBILITY
FROM TABLE2 T1
    CROSS JOIN
    JSON_TABLE(T1.JSON_DATA, '$' COLUMNS
        (
            CLASSID INTEGER PATH '$.ClassId',
            ATRB_ID INTEGER PATH '$.Attributes.ID',
            HREF INTEGER PATH '$.Attributes.HREF',
            HPRECISION INTEGER PATH '$.Attributes.HPRECISION',
            HMETHOD INTEGER PATH '$.Attributes.HMETHOD',
            GEOMETHOD INTEGER PATH '$.Attributes."GEO-METHOD"',
            GEOPRECISION INTEGER PATH '$.Attributes."GEO-PRECISION"',
            GEOVISIBILITY INTEGER PATH '$.Attributes."GEO-VISIBILITY"'
        )
    )

But, if you JSON only in this format:
{"ClassId":32000,"Attributes":
    [
        {"Name":"ID","Value":"4548"},
        {"Name":"HREF","Value":"-1"},
        {"Name":"HPRECISION","Value":"5"},
        {"Name":"HMETHOD","Value":"96"},
        {"Name":"GEO-METHOD","Value":"96"},
        {"Name":"GEO-PRECISION","Value":"5"},
        {"Name":"GEO-VISIBILITY","Value":"0"}
    ]
}

So, we can write our query:
SELECT CLASSID, ATRB_ID, HREF, HPRECISION, HMETHOD, GEOMETHOD, GEOPRECISION, GEOVISIBILITY
FROM TABLE1 T1
    CROSS JOIN
    JSON_TABLE(T1.JSON_DATA, '$[*]' COLUMNS
        (
            CLASSID INTEGER PATH '$.ClassId',
            ATRB_ID VARCHAR2(100) PATH '$.Attributes[0]."Value"',
            HREF VARCHAR2(100) PATH '$.Attributes[1]."Value"',
            HPRECISION VARCHAR2(100) PATH '$.Attributes[2]."Value"',
            HMETHOD VARCHAR2(100) PATH '$.Attributes[3]."Value"',
            GEOMETHOD VARCHAR2(100) PATH '$.Attributes[4]."Value"',
            GEOPRECISION VARCHAR2(100) PATH '$.Attributes[5]."Value"',
            GEOVISIBILITY VARCHAR2(100) PATH '$.Attributes[6]."Value"'
        )
    )

Results will be:

CLASSID
ATRB_ID
HREF
HPRECISION
HMETHOD
GEOMETHOD
GEOPRECISION
GEOVISIBILITY

32000
4548
-1
5
96
96
5
0

30074
265794
-1
5
100
90
5
0

A: execute this query, success executed:
SELECT * FROM
JSON_TABLE('{"ClassId":32000,"Attributes":
    [
        {"Name":"ID","Value":"4548"},
        {"Name":"HREF","Value":"-1"},
        {"Name":"HPRECISION","Value":"5"},
        {"Name":"HMETHOD","Value":"96"},
        {"Name":"GEO-METHOD","Value":"96"},
        {"Name":"GEO-PRECISION","Value":"5"},
        {"Name":"GEO-VISIBILITY","Value":"0"}
    ]
}', '$[*]' COLUMNS
        (
            CLASSID INTEGER PATH '$.ClassId',
            ATRB_ID VARCHAR2(100) PATH '$.Attributes[0]."Value"',
            HREF VARCHAR2(100) PATH '$.Attributes[1]."Value"',
            HPRECISION VARCHAR2(100) PATH '$.Attributes[2]."Value"',
            HMETHOD VARCHAR2(100) PATH '$.Attributes[3]."Value"',
            GEOMETHOD VARCHAR2(100) PATH '$.Attributes[4]."Value"',
            GEOPRECISION VARCHAR2(100) PATH '$.Attributes[5]."Value"',
            GEOVISIBILITY VARCHAR2(100) PATH '$.Attributes[6]."Value"'
        )
    )


text:
Q: Embedded MP3 Player on Web Page I want to embed an mp3 album on a web page and wanted to know if there are any good solutions out there for this that other people have used and would recommend.  I'm looking for something that doesn't cost anything and allows users to play the entire album, selected songs and also ideally download the MP3s as well.

A: You can use the video tag to act as a music player:
<video controls><source src="AUDIO FILE" type="audio/mp3">Your browser does not support the video tag.</video>

example:
<video controls><source src="http://mcrocks999.netai.net/m/%5bElectro%5d%20-%20Insan3Like3%20-%20Bad%20Pitched%20(Original%20Mix)%20%5bMonstercat%20VIP%20Release%5d.mp3" type="audio/mp3">Your browser does not support the video tag.</video>

EDIT: I just found this: http://musicplayer.sourceforge.net/ might be helpful.


text:
Q: Batch unzip all zip archives in sub directories; content of each archive extracted to new directory named after the archive I have a folder with a ton of sub folders, within those subfolders are zipped files.
I was wondering how to unzip those files into a folder named after the zip file
So for example:
C:\Archives\Photos\A.zip
C:\Archives\Videos\B.zip
C:\Archives\Documents\C.zip

would turn into
C:\Archives\Photos\A\
C:\Archives\Videos\B\
C:\Archives\Documents\C\

I can do this currently but only if i do it one folder at at time, i was wondering if there was a way to do it all at once, I was thinking a .bat file.

A: @Echo off
For %%F in (Photos,Videos,Documents) Do (
    For /F "delims=" %%Z in ('Dir /B/S/A-D "C:\Archives\%%F\*.zip" 2^>Nul') Do (
        7z x "%%~fZ" -o"%%~dpnZ\" && Rem Del "%%~fZ"
    )
)

If you want to discard the zip file once successfully unzipped, remove the Rem in front of del.
The batch uses for variable ~ modifiers to use only parts of the full file name

A: A PowerShell one-liner to achieve this:
Get-ChildItem -Filter *.zip -Recurse C:\Archives | % { $_.FullName } | Split-Path | Get-Unique | % { cd $_ ; &'C:\Program Files\7-Zip\7z.exe' x *.zip -o* }

Here's an explanation of each section, which is piped into the next section and thus executed by Powershell in order:

*

*Get-ChildItem -Filter *.zip -Recurse C:\Archives: find all zip files under C:\Archives

*% { $_.FullName }: foreach resulting object, show the full path & name

*Split-Path: show only the path (not the filename) of each zip

*Get-Unique: remove duplicates from that list

*% { cd $_ ; &'C:\Program Files\7-Zip\7z.exe' x *.zip -o* }: finally, use the created list to change into each directory found; use 7z.exe to unzip all zip files found in each directory, with the -o* argument to unzip the contents of each zip file into a directory with the name of that zip file

Assumptions:

*

*C:\Archives is the directory under which all your zip files are stored

*Your 7-Zip is installed in the default location

While researching this question, I came to the conclusion that I prefer bash to PowerShell :-)


text:
Q: How to get the range of occupied cells in Excel using C# and Excel Interop This is a follow-up question to an old question:
How to get the range of occupied cells in excel sheet
Quoting from that question:

Excel.Range last = sheet.Cells.SpecialCells(Excel.XlCellType.xlCellTypeLastCell, Type.Missing);
Excel.Range range = sheet.get_Range("A1", last);

"range" will now be the occupied cell range
share|improve this answer answered Aug 18 '09 at 9:03
Zurb

it returns always time blank cells, which i think question author wants to "not to get" that blank cells.–  JavidanApr 23 at 7:30

See the Range.SpecialCells method. For example, to get cells with constant values or formulas use:

_xlWorksheet.UsedRange.SpecialCells(
  Microsoft.Office.Interop.Excel.XlCellType.xlCellTypeConstants |
        Microsoft.Office.Interop.Excel.XlCellType.xlCellTypeFormulas)

share|improve this answer answered Aug 16 '09 at 14:23
Joe Erickson

Back to my question...
I tried to use this method which generates this exception:
System.Runtime.InteropServices.COMException: 'SpecialCells method of Range class failed'
Here is my code:
using Excel = Microsoft.Office.Interop.Excel;
using System.Reflection;

Excel.Application xlapp = new Excel.Application();
Excel.Workbook wbook = xlapp.Workbooks.Open(tbxFilename.Text);
Excel.Worksheet wsheet = wbook.Sheets[1];

Excel.Range range = wsheet.UsedRange;
tbxOutput.AppendText($"UsedRange: Rows = {range.Rows.Count}, Cols `enter code here`= {range.Columns.Count}\r\n");

range = wsheet.UsedRange.SpecialCells(Excel.XlCellType.xlCellTypeConstants |    // generates Exception
   Excel.XlCellType.xlCellTypeFormulas, Missing.Value);
tbxOutput.AppendText($"Rows = {range.Rows.Count}, Cols = {range.Columns.Count}\r\n");

What is wrong with my code?
Thanks!


text:
Q: Specifying baseline in internal coordinates with graphicx package I'm using the graphicx package. By default, included graphics are aligned with the baseline at the bottom of the image. I know how to make images vertically centered (using \vcenter) or top-aligned. But what I really want is to just use the origin of the included figure as the baseline. Is there any way to do this conveniently, using either graphicx or some other similar package?

A: This can't be done when including image files with \includegraphics: graphicx has no interface to whatever the code was that originally produced the figure.
However, it can be done if you integrate your graphics drawing with the TeX code itself. I don't know much MP, but here is an example with another drawing package.
This shows a TikZ/pgf solution, using the baseline key to specify a point in the diagram (named coordinate or arbitrary x-y coordinate pair) for baseline alignment:
\documentclass{article}
\usepackage{tikz}
\def\mytest{\node[draw] (A) {text};}

\begin{document}
Here is base-aligned
\begin{tikzpicture}[baseline=(A.base)]
  \mytest
\end{tikzpicture}
and here is top-aligned
\begin{tikzpicture}[baseline=(A.north)]
  \mytest
\end{tikzpicture}.

And here is a pair of axes with the origin on the baseline:
\begin{tikzpicture}[baseline={(0,0)},x=1em,y=1em,font=\footnotesize]
  \draw[->] (-0.2,0) -- (1,0) node[right] {$x$};
  \draw[->] (0,-0.2) -- (0,1) node[right] {$y$};
\end{tikzpicture}.
\end{document}


text:
Q: How to click the Chrome Mic button from Javascript in Delphi 6 app, or at least find the button and get its Windows screen coordinates? I have a Delphi 6 app that embeds the Chromium web browser.  I want to click the Chrome microphone button (speech input control) from Javascript.  I tried the usual method of calling the button's click() handler, but nothing happened.  Below is the HTML I tried with the first input element being the Chrome speech input control and the second input element being a checkbox that when checked, finds the speech input control and calls its click() handler:
<input name="speechInput1" id="speechInput1" size=64 type="text" x-webkit-speech />
<input type="checkbox" onClick="document.getElementById('speechInput1').click();">Check the box to simulate a button click

Is there a way to click the speech input controls microphone button from Javascript?  I found another post on Stack Overflow similar to my question but there were no solutions:
Automate speech input recording in Chrome
If not, is there a way to determine from my Delphi 6 app the location of the button in Windows screen coordinates so I can move the mouse over it and click it?
I know about AutoIt from this Stack Overflow post:
Send click to google's chrome input html tag
But I want to handle the mouse click myself instead of asking my users to download and set up AutoIt.
I also want to ask if anybody knows if it is possible to call the services made available to Chrome extensions via Javascript.  If that were possible, I could call the startSpeechInput() method the speech input control exposes to extensions.

A: The Chromium Embedded webkit Speech Input support is disabled at this time due to this issue. You can verify the Speech Input support by navigating to this site:
http://blogs.sitepointstatic.com/examples/tech/speech-input/index.html
I got the folowing result with this version of Chromium (the most recent at this time):


text:
Q: Laravel 7: how to redirect to success page with Paypal after transaction? I'm trying some new things in Laravel, how can I redirect the user to a new view ''success page'' after the transaction, instead of having the standard alert of the script?
        paypal.Buttons({
          createOrder: function(data, actions) {
            // This function sets up the details of the transaction, including the amount and line item details.
            return actions.order.create({
              purchase_units: [{
                amount: {
                  value: '0.10' // <---- totale
                }
              }]
            });
          },
          onApprove: function(data, actions) {
            // This function captures the funds from the transaction.
            return actions.order.capture().then(function(details) {
              // This function shows a transaction success message to your buyer.
              alert('Transaction completed by ' + details.payer.name.given_name);
            });
          }
        }).render('#paypal-button-container');
        //This function displays Smart Payment Buttons on your web page.
    </script>  ```

A: In that particular callback function you can use actions.redirect()
The current PayPal demo now has a sample with that commented as an option, vs. a no-redirect option of showing a message within the <div> also: https://developer.paypal.com/demo/checkout/#/pattern/client

The general JS answer is to set window.location.href to the new destination


text:
Q: Cannot post to twitter with an iPhone app with no errors I am using at my iPhone app with this code but I can not see the post on my twitter. I am not getting an error back.
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:
                                    [NSURL URLWithString:@"http://username:password@twitter.com/statuses/update.xml"]
                                                           cachePolicy:NSURLRequestUseProtocolCachePolicy timeoutInterval:15.0];
    // The text to post
    NSString *msg = @"testing";

    // Set the HTTP request method
    [request setHTTPMethod:@"POST"];

    [request setHTTPBody:[[NSString stringWithFormat:@"status=%@", msg]
                          dataUsingEncoding:NSASCIIStringEncoding]];

    NSURLResponse *response;
    NSError *error;

    if ([NSURLConnection sendSynchronousRequest:request
                              returningResponse:&response error:&error] != nil)
        NSLog(@"Your Poem posted to Twitter successfully.");
    else
        NSLog(@"Could not post to Twitter");

Can anyone tell me what is wrong?

A: Basic authentication was removed in August.  You must now use OAuth.  See https://dev.twitter.com/ for details.
Edit: There are several libraries to do this.  I have been using this iPhone ready implementation of oauthconsumer: http://github.com/jdg/oauthconsumer

A: Twitter disabled basic auth recently, you must use OAuth instead.


text:
Q: Why does Sentry log errors caught in except block? I use Sentry for inspecting the errors. In one part of my code, there's a try/except block for a snippet that uses langdetect and throws a LangDetectException. That code looks like
try:
    return detect(text)
except LangDetectException as error:
    logging.error(repr(error))

Well I don't really understand the docs from Sentry about whether they should log errors in except scope or log only unhandled errors? In one place, they say that Sentry shouldn't log caught errors on other it says it should so I'm a little bit confused. The mentioned code, when text was made only from non-alpha chars, threw the LangDetectException('No features in text.') error but also listed it on Sentry as an error. Why does this happen? Obviously, this is a caught error and I want to have it only logged in my logs and not in Sentry. Is this a normal behavior for Sentry or there's something I'm missing?

A: Creating an official answer. I just ran into this also. @zoran404's comment is correct.
The Python Sentry package will create an issue for logging.error() calls by default.

Calling sentry_sdk.init() already integrates with the logging module. It is equivalent to this explicit configuration:

import logging
import sentry_sdk
from sentry_sdk.integrations.logging import LoggingIntegration

# All of this is already happening by default!
sentry_logging = LoggingIntegration(
    level=logging.INFO,        # Capture info and above as breadcrumbs
    event_level=logging.ERROR  # Send errors as events
)

from https://docs.sentry.io/platforms/python/guides/logging/


text:
Q: Can you return a variable out of a listener in dart? I am struggling to find a solution to proceed with my program when a listener completes.
So my main goal is it to return a queryParameter of the DeepLink that leads back to my app. I already found out how to get the params with uni_links :
String function(){
   linkStream.listen((String? link) async {
      if (link!.startsWith(redirectUri)) {
        param = Uri.parse(link).queryParameters['code'].toString();
        print(param);
      }
   });
}

But now I want to return param instead of just printing it into the console. The problem is, because the return type of a listener is Future<void>, I am not able to just return the String without some kind of a workaround.
Is there a way to solve this?


text:
Q: Why does .NET and Visual Studio use different regex syntax?
Possible Duplicate:
Why does Visual Studio use such a strange regex syntax

For example, Visual Studio uses { } for capturing? Isn't that usually for quantifying? And it uses ( ) for quantifiers instead I think.  The escape characters use : instead \ like :d instead of \d for digits.  But tab is still \t.
It uses \1 \2 \3 for backreferences instead of $1 $2 $3 like .NET.  It uses @ instead of * for zero or more and # instead of + for one or more.  It confused the hell out of me when I decided to use the Visual Studio Find and Replace with regex.  Actually it's different from most standard regex syntax.


text:
Q: Replacing part of a matched regular expression I'm trying to parse some very badly delimited files and ultimately change them to a CSV. I'm looking to match on number, whitespace, and then letter, and replace the whitespace with a comma.
For example If I had the line '08:34:45 home' I'd like it to recognize the '5 h' and make it '08:34:45,home'. I understand why what I have below isn't working correctly, but can someone explain how to tell Powershell that I want to keep the \d and the \D?
Get-Content -path C:\file.txt |

ForEach-Object {$_ -replace "(\d\s\D)",','}

A: What you put in parentheses ( ) is captured by the regular expression, and you can access it with $1 for the first set, $2 for the second set, etc.
so you could try two capture groups:
$_ -replace '(\d)\s(\D)', '$1,$2'
See also: http://www.powershelladmin.com/wiki/Powershell_regular_expressions#Example_-_Replace_With_Captures for more details.


text:
Q: how to print string to html I want to make live db updates and display them in html.
I'm using a Jinja template with this code snippet, but it doesn't work.
{{% for msg in dbmsg %}} {{ msg }}

This is the code I'm using to send the message.
class RandomThread(Thread):
    def __init__(self):
        self.delay = 1
        super(RandomThread, self).__init__()

    def randomNumberGenerator(self):
        while not thread_stop_event.isSet():
            mycursor.execute('SELECT * FROM pydb.live')
            dbmsg = mycursor.fetchall()
            mydb.commit()
            socketio.emit('newreuslt', {'result': dbmsg}, namespace='/test')
            sleep(self.delay)

    def run(self):
        self.randomNumberGenerator()

A: You can't directly get flask-socketio messages in a Jinja template.  I suggest you look at the flask-socketio examples to see how to include the proper Javascript dependencies (socketio) to make this work.


text: Q: ASP.NET HTML table to XLSX including styling? I would like to ask If there is an open-source library that would allow me to convert HTML table to .Xlsx format including styling. The project I am working with generates expandable/collapsable tables, however, I'd like to export them to excel in .xlsx format. I came across a few libraries, but none of them is fully open source. I will appreciate any advice.


text:
Q: На лендинге не работает отправка информации на почту Мне достался сайт HTML, CSS, Javascript, без файла PHP, который отвечает за отправку информации на почту из форм обратного звонка. Я пытаюсь написать этот файл сам, но мне не хватает опыта. Письмо приходит на почту, поле "Имя" показано как нужно, но вот поля "Телефон" и "Вопрос" не хотят приходить. Помогите пожалуйста разобраться.

/* Adding blocks, transform blocks, only for correct display */
$(document).ready(function() {
      var prefix = $('.prefix').val();
      var url = prefix + "respond.php";

      $('.button').click(function() {
        $('body').find('form:not(this)').children('label').removeClass('red');
        var request_url = '\n' + $('input[name="ref_url"]').val().toString().replace(/&/g, '\n');
        var utm_source = $('input[name="ref_url"]').val().match(/(?:utm_source=)(.*)(?:&utm_medium)/i);
        var utm_medium = $('input[name="ref_url"]').val().match(/(?:utm_medium=)(.*)(?:&utm_campaign)/i);
        var utm_campaign = $('input[name="ref_url"]').val().match(/(?:utm_campaign=)(.*)(?:&utm_term)/i);
        var utm_term = $('input[name="ref_url"]').val().match(/(?:utm_term=)([0-9a-zA-Zа-яА-Я%]{1,})/i);
        if (utm_source == null || utm_medium == null || utm_campaign == null || utm_term == null)
          var utms = '';
        else
          var utms = '\nutm_source=' + utm_source[1] + '\nutm_medium=' + utm_medium[1] + '\nutm_campaign=' + utm_campaign[1] + '\nutm_term=' + utm_term[1] + '\n';

        var answer = checkForm($(this).parent().get(0));
        if (answer != false) {

          var $form = $(this).parent(),
            name = $('input[name="name"]', $form).val(),
            phone = $('input[name="phone"]', $form).val() + ' ' + $('input[name="phone2"]', $form).val() + ' ' + $('input[name="phone3"]', $form).val(),
            email = $('input[name="email"]', $form).val(),
            usluga = $('input[name="usluga"]', $form).val(),
            referer = $('input[name="referer"]', $form).val(),
            phrase = $('input[name="phrase"]', $form).val(),
            ccall = $('input[name="ccall"]', $form).val(),
            ques = $('textarea[name="ques"]', $form).val(),
            sbt = $('input[type="button"]', $form).attr("name"),
            submit = $('input[name=' + sbt + ']', $form).val();
          var ref = $('input[name="referer"]').val();
          var ref = ref + '\nutm-метки:' + request_url;
          var formname = $('input[name="formname"]').val();
          $.ajax({
            type: "POST",
            url: url,
            dataType: "json",
            data: "name=" + name + "&usluga=" + usluga + "&referer=" + referer + "&phrase=" + phrase + "&ccall=" + ccall + "&phone=" + phone + "&" + sbt + "=" + submit + "&email=" + email + "&ques=" + ques + "&formname=" + formname + "&ref=" + ref
          }).always(function() {
            //метрики
            //ga('send', 'event', ''+sbt, ''+sbt, ''+sbt);
            thx();
          });
        }
      });

Задать вопрос

Оставьте заявку, и наш специалист

ответит на все интересующие вас вопросы

  <form>
    Имя

      <input type="text" name="name" class="input_name" placeholder="Татьяна Иванова">

    Телефон

      <input type="text" name="phone" class="input_ph1" placeholder="8" value="8">

      <input type="text" name="phone2" class="input_ph2" placeholder="029">

      <input type="text" name="phone3" class="input_ph3" placeholder="4445544">

    Ваш вопрос
    <textarea name="ques" rows="4" placeholder="ваш вопрос"></textarea>

    <input id=r3 name="referer" type="hidden" value="">
    <input id=n3 name="phrase" type="hidden" value="">
    <input name="ccall" type="hidden" value="3">

    <input name="question" type="button" class="bttn bttn2 button noselect" value="Задать вопрос">
  </form>

Это файл PHP который я пытаюсь написать:
 /* Здесь проверяется существование переменных */
  if (isset($_POST['name'])) {$name = $_POST['name'];}
  if (isset($_POST['phone'])) {$phone = $_POST['phone'];}
  if (isset($_POST['ques'])) {$phone = $_POST['ques'];}

/* Сюда впишите свою эл. почту */
 $address = "madest4815@gmail.com";

/* А здесь прописывается текст сообщения, \n - перенос строки */
 $mes = "Тема: Заказ обратного звонка!\nТелефон: $phone\nВопрос: $ques\nИмя: $name ";

/* А эта функция как раз занимается отправкой письма на указанный вами email */
$sub='Заказ'; //сабж
$email='Заказ <ОКНА ПВХ>'; // от кого
 $send = mail ($address,$sub,$mes,"Content-type:text/plain; charset = utf-8\r\nFrom:$email");

ini_set('short_open_tag', 'On');
header('Refresh: 3; URL=index.html');
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta http-equiv="refresh" content="3; url=index.htm">
<title>С вами свяжутся</title>
<meta name="generator">


text:
Q: Canvasjs Tooltip with content set is shown but replaced after first mouse move I change tooltip contents of CanvasJS graph. It is done like in docs, and it worked. But recently (not sure when exactly) I've found that no matter what I write into ToolTip.content in graph's options it shows only in the first time I move mouse over the graph, next time tooltip fully replaced with default one. Here's my graph code:
var options_seg = {
            title: {
                text: ""
            },
            culture: "en",
            zoomEnabled: true,
            exportEnabled: true,
            animationEnabled: false,
            axisX: {
                labelFontSize: 11,
                gridColor: "Silver",
                tickColor: "silver"
            },
            axisY: {
                title: "Formula values",
                titleFontSize: 14,
                labelFontSize: 11,
                gridColor: "Silver",
                tickColor: "silver",
                lineColor: "#C24642"
            },
            toolTip: {
                shared: true,
                content: function (e)
                {
                    var ret = "";
                   if (e.entries[ 0 ].dataPoint.label)
                        ret = "" + e.entries[ 0 ].dataPoint.label + "
";
                    else
                    {
                        if (e.entries[ 0 ].dataPoint.x)
                        {
                            if (e.entries[ 0 ].dataSeries.xValueType == "dateTime")
                                ret = "" + $.format.date(e.entries[ 0 ].dataPoint.x, "yyyy-MM-dd HH:mm") + "
";
                            else
                                ret = "" + e.entries[ 0 ].dataPoint.x + "
";
                        }
                    }

                    var show_vals = [];
                    for (var t = 0; t < e.entries.length; t++)
                        if (e.entries[ t ].dataSeries.visible)
                            show_vals[ show_vals.length ] = {col: e.entries[ t ].dataSeries.color, key: e.entries[ t ].dataSeries.name, v: e.entries[ t ].dataPoint.y};

                    customSortObjByIntParameter(show_vals, "v", false);

                    var max = Math.min(50, show_vals.length);
                    for (t = 0; t < max; t++)
                        ret += "
" +
                            show_vals[ t ].key + " : " + show_vals[ t ].v + "
";

                    return ret;
                }
            },
            data: graphs_seg,
            legend: {
                fontSize: 11,
                verticalAlign: "center",
                horizontalAlign: "right",
                cursor: "pointer",
                itemclick: function (e)
                {
                    if (typeof(e.dataSeries.visible) === "undefined" || e.dataSeries.visible)
                    {
                        e.dataSeries.visible = false;
                    }
                    else
                    {
                        e.dataSeries.visible = true;
                    }
                    e.chart.render();
                }
            }
        };

$chart_holder_seg.CanvasJSChart(options_seg);
$chart_holder_seg.CanvasJSChart().render();

A: Started to work when I replaced
       toolTip: {
            shared: true,
            content: function (e) ...

to
       toolTip: {
            shared: true,
            contentFormatter: function (e) ...

No idea, why worked before.


text:
Q: React-Admin with .net .The response to 'getList' must be like { data : [{ id: 123, ...}, ...] }, but the received data items do not have an 'id' key I have an ASP.NET Core Web API and a React client. I'm trying to build admin dashboard with React-Admin. My problem is when I receive the data from server, my object are with property Id (uppercase), then in console I'm getting an error

The response to 'getList' must be like { data : [{ id: 123, ...}, ...] }, but the received data items do not have an 'id' key

I tried making new test class with property id (lowercase) in my server and then the problem is gone.
How can I fix this issue?
This is my test class and its working.
public class CityModel
{
    public string id { get; set; }
    public string Name { get; set; }
}

[HttpGet("Cities")]
public CityModel[] GetCities()
{
    var city1 = new CityModel()
        {
            id = "ahsxge",
            Name = "Berlin"
        };
    var city2 = new CityModel()
        {
            id = "axhdagw",
            Name = "London"
        };

    var list = new List<CityModel>();
    list.Add(city1);
    list.Add(city2);

    Response.Headers.Add("Access-Control-Expose-Headers", "X-Total-Count");
    Response.Headers.Add("X-Total-Count", list.Count.ToString());

    return list.ToArray();
}

This is my component in react :
const AppAdmin = () => {
const jwt = localStorage.getItem("jwt");
const httpClient = (url, options = {}) => {
    options.user = {
        authenticated: true,
        token: 'Bearer ' + jwt
    };
    return fetchUtils.fetchJson(url, options);
};

const dataProvider = jsonServerProvider('https://localhost:44366/api', httpClient);
dataProvider.getList('Cities/Cities', {
   pagination: { page: 1, perPage: 15 },
   sort: { field: 'Name', order: 'ASC' },

})
.then(response => console.log(response));

return (
    <Admin dataProvider={dataProvider}>
        <Resource name='Cities/Cities' list={CitiesList} />
    </Admin>
)
}
export default AppAdmin

A: You can configure the json converter to use camelCase serialization int the ConfigureServices method in the Startup.cs file the following way:
services
    .AddControllers()
    .AddJsonOptions(opts =>
    {
        opts.JsonSerializerOptions.PropertyNamingPolicy = JsonNamingPolicy.CamelCase;
    })

This way you can use PascalCase properties in your c# code (which you should do), but your client will recieve camelCase json properties.


text:
Q: Filtering SQL by correct time spans in vb.net I have a table that has two time columns. One is a login time one is a logout time. I would like to be able to filter between the two, basically greater than the minimum selected and less than the maximum selected. I am using a monthly calendar to get me the spans of time but it is not working correctly. From there I would like to add the 4 columns in the table to a gridview. The date in the DB is the in following format:
 2/23/2010 11:17:01 AM
I know how to get single elements from the table, or a column but not entire rows.
So i guess I have 2 problems, getting the filter for the SQL correct then binding the results to a table.
Here is my code so far:
 Dim cn As OleDbConnection
    Dim cmd As OleDbCommand
    Dim str As String
    Dim dr As OleDbDataReader
    Dim date1 As Date
    Dim date2 As Date

    If (Not SubmitNewToDB(session)) Then
        MsgBox("error")
    End If
    Try
        cn = New OleDbConnection("Provider=microsoft.Jet.OLEDB.4.0;Data Source=G:\Sean\BMSBonder3_0.mdb;")
        cn.Open()
        str = "Select BonderIdentifier, UserName, Login, Logout From [Session] Where (Login < " & MonthCalendar1.SelectionEnd _
            & " AND Logout > " & MonthCalendar1.SelectionStart & ") AND BonderIdentifier = " & session.bonderIdentifier

        cmd = New OleDbCommand(str, cn)
        dr = cmd.ExecuteReader

        While dr.Read()
            If dr.Item(0).ToString <> "" Then
                DataGridView1.Rows.Add(dr.Item(0))
            End If
        End While
        dr.Close()
        cn.Close()
    Catch ex As Exception
        MsgBox(ex.Message)
    End Try

EDIT
SLaks has answered most of my question, one problem remains. I need to figure out how to make it so the monthcalendar can select just one day and return that days values. Seems like the time is an issue since it is in the DB as stated above. Just comparing the dates is not enough.
Not sure how to adjust the date to include the time.

A: You should be using parameters, like this:
str = "Select BonderIdentifier, UserName, Login, Logout From [Session] Where Login >= ? AND Login <= ? AND BonderIdentifier = ?"

cmd = New OleDbCommand(str, cn)
cmd.Parameters.AddWithValue("Start", MonthCalendar1.SelectionStart
cmd.Parameters.AddWithValue("End", MonthCalendar1.SelectionEnd)
cmd.Parameters.AddWithValue("BID", session.bonderIdentifier)

To add values for the four columns, you can write
DataGridView1.Rows.Add(dr.Item(0), dr.Item(1), dr.Item(2), dr.Item(3))


text:
Q: How to find the maximum values and the place of the max value in the list? I have given an example to find the maximum value and its place in the list. Is it possible to find the local maximum in the sub-list of this list means local maximum in the each row of the list and its place.
{{0.798434, 0.836162, 0.866566, 0.891023, 0.910648, 0.926344,
 0.938842, 0.948735, 0.956506, 0.962542, 0.967162, 0.970621,
 0.973129, 0.974854, 0.975934, 0.976483, 0.97659, 0.976331, 0.975766,
 0.974944, 0.973908}, {0.805793, 0.871229, 0.913967, 0.941624,
0.959219, 0.970068, 0.976365, 0.979565, 0.980639, 0.980232, 0.97878,
 0.976576, 0.97382, 0.970649, 0.967158, 0.963416, 0.95947, 0.955357,
0.951105, 0.946734, 0.942261}, {0.806828, 0.895766, 0.943,
0.967386, 0.979126, 0.983757, 0.984299, 0.982413, 0.979023,
0.974652, 0.969603, 0.964063, 0.958146, 0.951933, 0.94548, 0.93883,
0.932018, 0.925073, 0.918018, 0.910877, 0.903666}}

A: This problem can be tackled in many ways with Mathematica. Here is one way to do it.
data =
  {{0.798434, 0.836162, 0.866566, 0.891023, 0.910648, 0.926344,
    0.938842, 0.948735, 0.956506, 0.962542, 0.967162, 0.970621,
    0.973129, 0.974854, 0.975934, 0.976483, 0.97659, 0.976331, 0.975766,
    0.974944, 0.973908},
   {0.805793, 0.871229, 0.913967, 0.941624,
    0.959219, 0.970068, 0.976365, 0.979565, 0.980639, 0.980232, 0.97878,
    0.976576, 0.97382, 0.970649, 0.967158, 0.963416, 0.95947, 0.955357,
    0.951105, 0.946734, 0.942261},
   {0.806828, 0.895766, 0.943,
    0.967386, 0.979126, 0.983757, 0.984299, 0.982413, 0.979023,
    0.974652, 0.969603, 0.964063, 0.958146, 0.951933, 0.94548, 0.93883,
    0.932018, 0.925073, 0.918018, 0.910877, 0.903666}};

rowMaxes[data_] :=
  Module[{vals, indxs},
    vals = Max /@ data;
    indxs = Thread[{
              Range @ Length @ data,
              Flatten[First /@ MapThread[Position, {data, vals}]]
            }];
    Thread[{vals, indxs}]]
rowMaxes[data]

{{0.97659, {1, 17}}, {0.980639, {2, 9}}, {0.984299, {3, 7}}}

This solution is more messy than I would like, but I had to be careful not to get tripped up by repeated values, such as in this example:
intData = {{1, 2, 4, 4}, {4, 5, 7, 4}, {1, 2, 10, 4}};
rowMaxes[intData]

{{4, {1, 3}}, {7, {2, 3}}, {10, {3, 3}}}


text:
Q: Subclass a Django ManyRelatedManager a.k.a. ManyToManyField Is there a way to Subclass a Django ManyRelatedManager a.k.a. ManyToManyField ?
The goal is to pre-filter all related models when calling the ManyRelatedManager by a flag of deleted=None.  If deleted=None then it is a valid Model.
So far, this is the code, but it doesn't seem to work.
class ExcludeDeletedManyToManyField(models.ManyToManyField):

    def get_queryset(self):
        qs = super(ExcludeDeletedManyToManyField, self).get_queryset()
        return qs.filter(deleted__isnull=True)

class SelfRefrencingModel(models.Model):

    children = ExcludeDeletedManyToManyField('self', blank=True,
        symmetrical=False, related_name='parents')

A: You can create proxy model of SelfRefrencingModel and override the default manager. Then use this proxy model in ManyToManyField.
Subclassing ManyToManyField will not help you because for the resulting queryset ManyRelatedManger is responsible.
Proxy model approach:
from django.db import models

class A(models.Model):
    children = models.ManyToManyField('AProxy')
    name = models.TextField()
    deleted = models.NullBooleanField(null=True)

class FilterDeletedManager(models.Manager):
    def get_queryset(self):
        qs = super(FilterDeletedManager, self).get_query_set()
        return qs.filter(deleted__isnull=True)

class AProxy(A):
    objects = FilterDeletedManager()
    class Meta:
        proxy = True

Caveat with this approach is that now django expects AProxy instances for children field.
So maybe better readable and maintainable approach will be to add another attribute in __init__.
from django.db import models

class A(models.Model):
    children = models.ManyToManyField('self')
    name = models.TextField()
    deleted = models.NullBooleanField(null=True)

    def __init__(self, *args, **kwargs):
        super(A, self).__init__(*args, **kwargs)
        self.deleted_null_children = self.children.filter(deleted__isnull=True)

A: Here is my solution.  @beezz, you may be correct to use a Proxy Model to do this, but I haven't used a Proxy Model before for this pattern, so this is how I solved this:
class SelfRefrencingQuerySet(models.query.QuerySet):
    pass

class SelfRefrencingManager(BaseManager):

    def get_queryset(self):
        return SelfRefrencingQuerySet(self.model, self._db).filter(
            deleted__isnull=True)

class SelfRefrencingBaseModel(models.Model):

    children = models.ManyToManyField('self', blank=True, symmetrical=False,
        related_name='parents')

    # Manager
    objects = SelfRefrencingManager()
    objects_all = models.Manager()     # So you still have acccess to the
                                       # default Manager

A: If your intention is to use this with Django Admin or ModelForm; you don't need to subclass the ManyToManyField. See the django documentation
class SelfRefrencingModel(models.Model):

    children = models.ManyToManyField('self', blank=True, symmetrical=False,
        related_name='parents', limit_choices_to={'deleted': False}))

Note: If deleted is a BooleanField it has to be True or False. It can't be None/NULL.
beezz's idea of using a Proxy Model is also a good one.
What I sometimes do is to customise the default manager
class MyModelManager(models.Manager):
    use_for_related_fields = True

    def get_queryset(self):
        qs = super(MyModelManager, self).get_queryset()
        return qs.filter(deleted=False)

class MyModelManager(models.Model):
    objects = MyModelManager()
    _objects = models.Manger()

    deleted = models.BooleanField(default=False)

By default deleted objects will be hidden, but if need them in your queryset, you can use _objects.