text:
Q: error LNK2019: unresolved external symbol "void __cdecl DNAtoRNA(char)" (?DNAtoRNA@@YAXD@Z) referenced in function _main So I have been getting this error for a while. I have looked through my code but cannot fine the issue. The full error I get is
1>ConsoleApplication132.obj : error LNK2019: unresolved external symbol "void __cdecl DNAtoRNA(char)" (?DNAtoRNA@@YAXD@Z) referenced in function _main
This is my code:
   // Program uses wave data to calcuulate steepness and average steepness for the year

#include "stdafx.h"
#include <iostream>
#include <fstream>
#include <cctype>
#include <string>

using namespace std;

struct DNAnt{
    int adenine, cytosine, guanine, thymine;
    string strand;
    char allDNA[100][80];
};

void data2DNA(int * , int * , int * , int * , string);
void countDNA(int * , int * , int * , int * , string , bool *);
void DNAtoRNA(char );

int main()
{
    DNAnt DNA;

    data2DNA(&DNA.adenine, &DNA.cytosine, &DNA.guanine, &DNA.thymine, DNA.strand);

    ifstream inputFile;
    inputFile.open("C:\\Users\\mjass_000\\Desktop\\DNA.txt");

    for(int y=0; y<80; y++){                                                    //inputting information into array
        for(int x=0; x<100; x++){                                               //-----
            inputFile >> DNA.allDNA[x][y];                                      //-----
        }                                                                       //-----
    }                                                                           //-----

    DNAtoRNA(DNA.allDNA[100][80]);

    inputFile.close();
    cin.get();
    return 0;
}

void data2DNA(int *adenine, int *cytosine, int *guanine, int *thymine, string strand){

    ifstream inputFile;
    inputFile.open("C:\\Users\\mjass_000\\Desktop\\data.txt");

    ofstream outputFile;
    outputFile.open("C:\\Users\\mjass_000\\Desktop\\DNA.txt");

    int number, numA=0, numC=0, numG=0, numT=0, count=0;
    bool end=false;

    while (inputFile >> number){

        if(number==1){
            strand="A";
            outputFile << strand;                                                       //outputting to file
            countDNA(&numA, &numC, &numG, &numT, strand, &end);
            count++;
        }else if(number==2){
            strand="C";
            outputFile << strand;
            countDNA(&numA, &numC, &numG, &numT, strand, &end);
            count++;
        }else if(number==3){
            strand="G";
            outputFile << strand;
            countDNA(&numA, &numC, &numG, &numT, strand, &end);
            count++;
        }else if(number==4){
            strand="T";
            outputFile << strand;
            countDNA(&numA, &numC, &numG, &numT, strand, &end);
            count++;
        }
        if(count==10000){                                                                   //if it is the last number
            end=true;
            *adenine=numA;
            *cytosine=numC;
            *guanine=numG;
            *thymine=numT;
        }

    }
    outputFile.close();
    inputFile.close();

    return;
}

void countDNA(int *numA, int *numC, int *numG,int *numT, string strand, bool *end){

    if(strand=="A"){
        *numA+=1;
    }else if(strand=="C"){
        *numC+=1;
    }else if(strand=="G"){
        *numG+=1;
    }else if(strand=="T"){
        *numT+=1;
    }

    return;
}

void DNAtoRNA(char allDNA[100][80]){

    ofstream outputFile;
    outputFile.open("C:\\Users\\mjass_000\\Desktop\\RNA.txt");

    int totalT=0;

    for(int y=0; y<80; y++){
        for(int x=0; x<100; x++){
            if(allDNA[x][y]=='T'){
                totalT++;
            }
        }
        if(totalT>25){                                                  //if there are more than 25 T's
            for(int x=0; x<100; x++){                                   //-----
                if(allDNA[x][y]=='T'){                                  //-----
                    outputFile << "U";                                  //-----
                }else{                                                  //-----
                    outputFile << allDNA[x][y];                         //-----
                }                                                       //-----
            }                                                           //-----
        }else{                                                          //-----
            for(int x=0; x<100; x++){
                outputFile << allDNA[x][y];
            }
        }
        totalT=0;
        outputFile << endl;
    }

    outputFile.close();
    return;
}


text:
Q: MySQL UNION with Multiple ORDER BY I have tried to make this work in multiple forms but none have been successful. I need to read an int from my table to order my data as desired. I have previously gotten this to work as multiple queries but Im hoping to do it all in one now.
    SELECT * FROM (
        (SELECT * FROM table_a WHERE int_a <= *myint* ORDER BY int_a DESC)
        UNION
        (SELECT * FROM table_a WHERE int_a >= *myint* ORDER BY int_a DESC)
    ) uniontable

MySQL 5.7

A: I'm not exactly sure what you re trying to achieve, but if you want the rows from the first leg to be ordered first, then you can add an attribute that determines from which leg the row belongs:
select myint from (
    select 1 as origin, myint from table_a where myint < 5
    union
    select 2 as origin, myint from table_a where myint > 5
) as t
order by origin, myint desc;

myint
4
3
2
1
9
8
7
6

Fiddle

A: With subselect and ordr by is a little tricky
so do

create table table_a (myint Integer)

INSERT INTO table_a VALUES(1),(2),(3),(4),(5),(6),(7),(8),(9)

SELECT myint
FROM
((SELECT myint, CONCAT('a',@rn := @rn +1) orderby FROM table_a,(SELECT @rn := 0)a WHERE myint < 5
ORDER BY myint DESC LIMIT 18446744073709551615 )
UNION
(SELECT myint, CONCAT('b',@rn1 := @rn1 +1) orderby FROM table_a,(SELECT @rn1 := 0)a
WHERE myint > 5 ORDER BY myint DESC LIMIT 18446744073709551615 )) mynewtable
ORDER BY orderby ASC

| myint |
| ----: |
|     4 |
|     3 |
|     2 |
|     1 |
|     9 |
|     8 |
|     7 |
|     6 |

db<>fiddle here
The concept is simple create two subwuery that have a clumn which can be ordery and keep the right here it is orderby
TZhe limit is needed, so mysql knpws that it should keep his order.
this works in mysql and maeiadb

redpajama_set_name: RedPajamaStackExchange


text:
Q: How to find out whitePixelValue when person smile? using CvRect i am able to detect faces coordinate
detectFace(IplImage * pImg, CvHaarClassifierCascade * pCascade, CvMemStorage * pStorage)

But my problem is How to find out whitePixelValue when person smile ?
And what Smile offset is appropriate ? 150 value is accurate ?
Smile haarcascade wont work at all. Need to do something with logic only with white pixels
Please help!!!

Update: I think my bounty going to be waste.. didn't get expert response
  on this thread. I was looking for
  algorithm :(

A: As far as I understand you want to detect smile based on color difference between teeth and skin, right? Probably that makes sense since lips pixels intensity differs greatly from teeth pixels. If so I'd suggest two approaches.
First one is to calculate laplacian transform of face region. Coordinates with  maximum values of Laplacian will correspond to largest difference between neighbour pixels intensities. I think smile contains the most contrast pixels. You should again choose the threshold, however in this case it's independent on light conditions of image.
The second idea is similar to the first one with the exception that you need to compare pixels with mean value of all face pixels. Here the pixels whose values are relatively too high with regard to mean are considered as teeth pixels. By the way, something like cvAdaptiveThreshold might help.

A: Hey have you checked this project https://github.com/beetlebugorg/PictureMe
This is really a great project have a look into it. I think you will find what you need.


text:
Q: Buying Legendary Blacksmithing Plans I was lucky enough to find a Legendary Plan the other night (Harvest Moon)... I noticed it had a sell value, which got me to wondering, "Can I buy these in the AH?". When I looked, however, I could only find higher level plans. Does that mean that:
A. You can't sell lower level Legendary Plans
  B. There were just none available at the time
  C. I am a big dummy, and was looking in the wrong place
Which is it? Or is it something else?

A: You can buy or sell any blacksmith plan in the Auction House, except for the account bound Plan of Herding. They are listed in alphabetic order not level (annoyingly, there is no way to change this) but if you already found higher level plans, then you should be on the right screen to search for Harvest Moon as well.
It is possible that there is none available at the time; if this is the case price will show 0gp and the 'Buyout' button will be grayed out.
Option C) is still a possibility, if you searched for Items and entered the name in the legendary box at bottom - this will search on specific crafted stuff, not the plans themselves! So for e.g., if you search for Asheara's Clasp (lvl 51 set gloves) this is different from Plan: Asheara's Bindings that you will find in the right place on Pages & Recipes section.

Harvest Moon plan on AH


text:
Q: Print Bellman Ford path iteratively I currently have a Bellman Ford algorithm set up and I am trying to print the path to that node. My current algorithm is like this:
path = new int[totaledges];
path[source] = source;
distance[source] = 0;
String st = "";
for (int i = 0; i < totaledges; i++)
    for (int j = 0; j < edges.size(); j++) {
        int newDistance = distance[edges.get(j).getSource()] + edges.get(j).getWeight();
        //System.out.println(newDistance + " this is teh distance");
        if (newDistance < distance[edges.get(j).getDestination()]){
            distance[edges.get(j).getDestination()] = newDistance;
            path[edges.get(j).getDestination()] = edges.get(j).getSource();
            //System.out.println(edges.get(j).getSource());
        }
    }

And this is how I am printing it out. It is recursive but how would I set it up so that it is iterative? I am currently getting a stack overflow error.
static void printedges(int source, int i, int[] paths)
{
    // print the array that is get from step 2
    if(source!=i){
        printedges(source, paths[i], paths);
    }
    if(i == currentEdge){
        System.out.print(i);
    } else{
        System.out.print(i+",");
    }
}

A: You have your parent backlinks in path.  So if you just follow those links back inside a while loop until you the source, you'll have visited the path in reverse.  So as you are visiting each node in a path, put it into a simple resizable container (ArrayList works well in Java), and then reverse it and print it out when you are done.


text:
Q: misplaced subplots using Venn diagrams and GridSpec [python / matplotlib] I'm having troubles creating a grid layout plot using two different venn packages, the first one is the matplot-venn and the other is the venn package to intersect more than 3 subsets. The problem with the venn package is that its creating a new figure and axis, therefore I'm creating all plots in a function and then add them to my composite figure. The initial grid is placed properly (img1), also when adding the subplots with the corresponding gridSpec the coordinates are correct, but when plotting the layout is completely off (img2).first of all it seems only half of the figure x axis is used and the 4 small venns should be roughly the same size and rows as the two bigger ones on the left.
img1 correct grid layout

img2 wrong layout

I tried several other things e.g. adjusting parameters such as autoscaling, squeeze, clipping or subplot specs etc. , unfortunately all with the same result.
I'm working on a server and connecting via ssh plus xforwarding, either using a mac (quartz) or windows (xming) and the issue is present on both machines.
I'm new to python plotting so any help or suggestions are highly appreciated
thanks a lot
import os
import re
import copy
import pandas as pd
import venn # for 4 way venns, non proportional
import matplotlib.pyplot as plt
from matplotlib_venn import venn3
from matplotlib.gridspec import GridSpec
from matplotlib.patches import Rectangle

# for ssh connections through windows using a non-interactive backend
# import matplotlib
# matplotlib.use('Agg')

def extractORFName(orfList):
    return set([re.sub("(.*)_[0-9]*aa.*","\\1",x) for x in orfList])

def plotValidatedOverlap(orfList,nameList):
    labels = venn.get_labels(orfList, fill=['number'])
    figX, axVenn = venn.venn5(labels, names=nameList,fontsize=8)
    axVenn.get_legend().remove()
    v_human = plotVenn3(orfList[0:3],nameList[0:3])
    v_mouse = plotVenn3(orfList[1:4],nameList[1:4])
    plt.close(figX)
    return (axVenn, v_human, v_mouse)

def plotVenn3(orfList,nameList):
    fig ,ax = plt.subplots()
    out = venn3(orfList,nameList,normalize_to=0.75)
    for text in out.set_labels:
        text.set_fontsize(8)
    for text in out.subset_labels:
        if text is not None:
            text.set_fontsize(6)
    plt.close(fig)
    return ax

def copyElement(axList,gs,fig):
    for idx in range(0,len(axList)):
        print("\n\n### processing idx: %s" % idx)
        pos = gs[idx].get_position(fig)
        ax = copy.copy(axList[idx])
        ax.figure = fig
        ax.set_position(pos)
        ax.set_subplotspec(gs[idx])
        fig.add_subplot(ax,aspect='equal',autoscale_on=True)
        fig.axes[idx].set_clip_on(False)
        print("axes positions:\t%s" % str(fig.axes[idx].get_position()))
        print("gs position:'t%s" % str(pos))
        #fig1.canvas.draw()
        #input("next axes")

#### data input to create orfList (list of sets as subsets) and nameList (labels of subsets)

fig1, ax = plt.subplots(dpi=100, figsize=(18,8),num="venn")#, squeeze=False, constrained_layout=True)
fig1.axes[0].remove()
gs = GridSpec(nrows=2, ncols=3, width_ratios=[2,1,1], figure=fig1)
figsToPlot = sum([ list(plotValidatedOverlap(orfList[type],nameList)) for type in orfList ],[])
fig1.clear()
fig1.suptitle(cellType + "_" + method + "_overlap")
fig1.canvas.draw()
copyElement(figsToPlot,gs,fig1)
fig1.tight_layout()
fig1.canvas.draw()


text:
Q: Alert box in python using turtle How can I make an alert box appear when I am running a program using turtle graphics? We have textinput() but it asks user to input something but I just want to show some text there. Is that possible with turtle graphics?

A: Try this:
from tkinter import *
from tkinter import messagebox

root = Tk()

messagebox.showinfo("showinfo", "Information") # The alert.

root.mainloop()


text:
Q: Boxes Always Crashing into My navbar unable to fix it
Html -
<!DOCTYPE html>

    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <link rel="stylesheet" href="css/style.css">
    <link rel="stylesheet" href="css/services.css">
    <title>Arson Industries Limited</title>

Home

About

Contact Us

Services

            <form action="/search.html" method="get">
                <input type="text" name="query" id="Search" placeholder="Search">

                <button class="btn btn-sm">Search</button>
            </form>

Our Services

Web Designs

                            Lorem ipsum dolor sit amet, consectetur adipisicing elit. Et eaque ratione rem porro, nihil.

Web Development

                            Lorem ipsum dolor sit amet, consectetur adipisicing elit. Et eaque ratione rem porro, nihil.

Responsive Designs

                            Lorem ipsum dolor sit amet, consectetur adipisicing elit. Et eaque ratione rem porro, nihil.

css-
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

* {
    margin: 0;
    padding: 0;
    font-family: "montserrat", sans-serif;
    box-sizing: border-box;
}

.services-section {
    background: url(bg.jpg);
    background-size: cover;
    padding: 60px 0;
}

.inner-width {
    width: 100%;
    max-width: 1200px;
    margin: auto;
    padding: 0 20px;
    overflow: hidden;
}

.section-title {
    text-align: center;
    color: #ddd;
    text-transform: uppercase;
    font-size: 30px;
}

.border {
    width: 160px;
    height: 2px;
    background: #82ccdd;
    margin: 40px auto;
}

.services-container {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
}

.service-box {
    max-width: 33.33%;
    padding: 10px;
    text-align: center;
    color: #ddd;
    cursor: pointer;
}

.service-icon {
    display: inline-block;
    width: 70px;
    height: 70px;
    border: 3px solid #82ccdd;
    color: #82ccdd;
    transform: rotate(45deg);
    margin-bottom: 30px;
    margin-top: 16px;
    transition: 0.3s linear;
}

.service-icon i {
    line-height: 70px;
    transform: rotate(-45deg);
    font-size: 26px;
}

.service-box:hover .service-icon {
    background: #82ccdd;
    color: #ddd;
}

.service-title {
    font-size: 18px;
    text-transform: uppercase;
    margin-bottom: 10px;
}

.service-desc {
    font-size: 14px;
}

navbar css -
* {
    margin: 0;
    padding: 0;
}

.nav-list {
    width: 50%;
    /* background-color: black; */
    display: flex;
    align-items: center;
}

.nav-list li {
    list-style: none;
    padding: 26px 30px;
}

.nav-list li a {
    text-decoration: none;
    color: white;
}

.rightnav {
    /* background-color: blue; */
    width: 50%;
    text-align: right;

}

.logo {
    width: 20%;
    display: flex;
    justify-content: center;
    align-items: center;
}

.logo img {
    width: 45px;
    border: 3px;
    border-radius: 50%;
    height: 45px;

}

.navbar-background {
    height: 61px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: sticky;
    top: 0;
    cursor: pointer;
    background-color: rgb(38 46 48 / 37%);
    z-index:1;

}

#Search {
    padding: 5px;
    font-size: 17px;
    border: 2px solid grey;
    border-radius: 9px;
}

.background {
    background: rgba(0, 0, 0, 0.7) url("../image/nature.jpg");
    background-size: cover;
    background-blend-mode: screen;

}

.box-main {
    display: flex;
    justify-content: center;
    align-items: center;
    color: white;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    width: 50%;
    margin: auto;

}

.firstsection {
    height: 100vh;
    margin-top: -61px;
}

.firsthalf {
    left: 0;
    line-height: 2;
    /* og 200 hai height */
    /* margin-top: -100px; */
    position: absolute;
    text-align: center;
    top: 50%;
    width: 100%
}

body {
    height: 100vh;
    overflow-y: hidden;

}

.btn {
    padding: 8px 20px;
    margin: 7px 0;
    border: 2px solid white;
    border-radius: 8px;
    background: none;
    color: white;
    cursor: pointer;
    -webkit-transition: all .15s ease-in-out;
    transition: all .15s ease-in-out;

}

.btn:hover {
    box-shadow: 0 0 10px 0 #e3f0ee inset, 0 0 20px 2px #bebd82;
    border: 3px solid #e1ebea;
}

I tried fixing it by doing some changes in margin and padding but my search bar is just stuck on that  place nothing seems to work I copied this template from internet i tried making My own but that box problem was coming that time too so i thought my code has some mistakes so i tried to copy paste it from internet and try doing some changes but idk why its not working
if this question is stupid my apologies i am a beginner

A: Your navbar does not have a closing tag. Change it like this. It worked for me.

Home

About

Contact Us

Services

        <form action="/search.html" method="get">
            <input type="text" name="query" id="Search" placeholder="Search">

            <button class="btn btn-sm">Search</button>
        </form>


text:
Q: InvalidCastException: Unable to cast object of type 'System.Guid' to type 'System.String'. in asp.net core webapi Hi I am creating a webapi in asp.net core when I call the controller it is throwing the error and this is have shows how i create the models and the controller.
 Model :
public class tblProject
{
    [Key]
    public Guid prj_id { get; set; }
    public string prj_name { get; set; }
    public string prj_endcustomer { get; set; }
    public string prj_customer_name { get; set; }
    public string prj_client { get; set; }
    public string prj_scope_of_supply { get; set; }
    public int prj_revision { get; set; }
    public bool isactive { get; set; }
    public DateTime created_date { get; set; }
    public string created_by { get; set; }
}

Controller :
[Route("api/[controller]")]
[ApiController]
public class CDProjectController : ControllerBase
{
    private readonly CDDbcontext _context;

    public CDProjectController(CDDbcontext context)
    {
        _context = context;
    }

    // GET: api/DCandidate
    [HttpGet]
    public async Task<ActionResult<IEnumerable<tblProject>>> GetDCandidates()
    {
        return await _context.tblProject.ToListAsync();
    }

    // GET: api/DCandidate/5
    [HttpGet("{id}")]
    public async Task<ActionResult<tblProject>> GetDCandidate(Guid prj_id)
    {
        var dCandidate = await _context.tblProject.FindAsync(prj_id);

        if (dCandidate == null)
        {
            return NotFound();
        }

        return dCandidate;
    }

A: var dCandidate = await _context.tblProject.where(p => p.prj_id == prj_id).singleOrdefault();

A: First you need to check sql table in column datatype varchar or nvarchar. After in c# method call passing guid parameter to set string type.
Example
string prj_id = System.Guid.NewGuid().ToString();

var dCandidate = await _context.tblProject.Where(p => p.prj_id == prj_id).SingleOrDefault();

A: To check another example
CREATE TABLE MathStudents1
(
    Id UNIQUEIDENTIFIER PRIMARY KEY default NEWID(),
    StudentName VARCHAR (50)
)
GO
INSERT INTO MathStudents1 VALUES (default,'Sally')
INSERT INTO MathStudents1 VALUES (default,'Edward')

A: in my case some rows in database was Null
check or delete Null Rows

A: A scenario where a similar error happened to me without any clear probable cause was when I had run a migration from a relatively new branch then went back to an older branch which was not updated with the new changes. If anyone is in a similar scenario, you could go back to the branch with the new migration and down migrate back to the point of the older branch.

A: Found the error when I use [FromRoute] it is working thank to all for your answers


text:
Q: column height in bootstrap How to make column height shrink when it is displayed on smaller screen? I used bootstrap 3.3.7 . I made 3 columns inside a row and sat them to col-md-2, col-md-9, col-md-1. They are displayed correctly on md screen and bigger. On small screen they are still displayed fine. However, on small and extra small screen, I want to make first and third columns height shrink to the height of their contents.
Here is a part the HTML code and css I used:
HTML:
<!DOCTYPE html>

    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <link rel="stylesheet" type="text/css" href="bootstrap-3.3.7-
    dist/css/bootstrap.min.css">
    <link rel="stylesheet" type="text/css" href="bootstrap-3.3.7-
    dist/css/bootstrap-theme.min.css">
    <link rel="stylesheet" type="text/css" href="second_page.css">

                      content

 another content

                      content

 many contents" nested rows and columns" are here

 many contents

CSS file:
body { padding-top: 70px; }
/* all a tags colors */
a { color: #4285F4; }

/* first left column */

#first_left_column_box{
    background-color: #eee;
  border-left: 1px #ccc solid;
  border-right: 1px #ccc solid;
    height:200vh;
  margin-bottom: 20px;

}
#first_left_column{
    text-align:center;
    line-height:50px;

}

/* middle column */

.breadcrumb {
  background-color: #eee;
  border-top: 1px #ccc solid;
  border-bottom: 1px #ccc solid;
  margin-bottom: 20px;
}

/* last right column */
#last_right_column_box{
  background-color: #eee;
    border-left: 1px #ccc solid;
  border-right: 1px #ccc solid;
    padding: 10px;
    height:200vh;
}
#last_right_column{
    text-align:center;
    line-height:50px;
}

A: Bootstrap currently doesn't support anything for automatic resizing of height of columns , we are bounded to use media queries so just use it !!

A: You will need to use media queries for the separate screens. You can write media queries like so
@media not|only mediatype and (expressions) {
    CSS-Code;
}

but it is better to separate the rules which are applicable for the given rules, by creating separate CSS files for the separate sizes:
 <link rel="stylesheet" media="mediatype and|not|only (expressions)" href="print.css">

An example for your case:
 <link rel="stylesheet" media="screen and (max-width: 699px)" href="small-screen.css">

And put here the rules for small screen. You can create separate CSS files for separate screen size categories.

A: you can use with col- with col-md:
.col- (extra small devices - screen width less than 576px)
.col-sm- (small devices - screen width equal to or greater than 576px)
.col-md- (medium devices - screen width equal to or greater than 768px)
.col-lg- (large devices - screen width equal to or greater than 992px)
.col-xl- (xlarge devices - screen width equal to or greater than 1200px)
try use col-2 and col-md-2 like example:

Read this... can help you. https://www.w3schools.com/bootstrap4/bootstrap_grid_examples.asp


text:
Q: If I have a signal that switches between 5MHz and 4MHz faster than the sample rate of the ADC on a spectrum analyzer Basically, what happens if your signal is switching between frequencies faster than the sample rate of the ADC in the spectrum analyzer? I have been curious as to what would happen in this case, would aliasing from sampling occur?
From what I understand about spectrum analyzers is that they use RF mixer magic and a band pass filter to bring an extremely high frequency signal into a frequency range that can be sampled by a relatively "cheap" and "slow" ADC. From what I understand, I don't think that magic works to also bring down the switching rate of a signal switching between two frequencies.
A follow up question would be if the amplitude of a 5MHz signal is changing from lets say 10dB to 50dB every 10ns, would an ADC on a spectrum analyzer that samples every 25ns be able to capture the event without aliasing?
From what I understand about sampling is that aliasing would occur and you need a faster ADC (probably a time interleaved ADC) in your spectrum analyzer to capture the event where a signal is switching frequencies or amplitudes faster than the sample rate of the ADC.
If it is possible can you explain how it works?

A: If the signal is changing faster than the bandwidth of the bandpass filter, then the following circuitry won't see the effect as the signal changing -- they'll see the effect in the frequency domain.
For instance, if the signal is changing between 5MHz and 4MHz, randomly every 500ns, but staying phase coherent (meaning that there's no time-domain jump discontinuities in the signal), then the signal is MSK modulated, and when you look at it with a spectrum analyzer that's set up correctly, you'll see a classic MSK spectrum like this one from Wikimedia Commons.

In this case "properly set up" would mean that you want an IF bandwidth that is much less than the modulation rate (i.e., less than 200kHz), and a sweep rate that's low enough that the filter bandwidth doesn't distort the signal (although you don't have to worry about that anymore -- a spectrum analyzer with a computer in it won't let you make that mistake).
In the case of your signal at 5MHz that's being "switched between 10dB and 50dB every 20ns", you reformulate that statement to say that the signal is being chopped at 25MHz.  In that case what a properly set up spectrum analyzer would show you peaks at 5MHz, 20MHz, 30MHz, then 70MHz & 80MHz, then 120MHz & 130MHz, repeating every 50MHz. -- basically you'd see peaks at \$(25\mathrm{MHz})(2n - 1) \pm 5\mathrm{MHz}\$ for all \$n \in \mathbb{I}\$.
Google "frequency mixing", "mixer" or "heterodyning" for more details.  The hand-wavy answer is that when you multiply two sine waves together in the time domain, in the frequency domain you get signals at the sum and difference of their frequencies -- so a 5MHz sine wave multiplied by 25MHz gives you tones at 20MHz and 30MHz.  A 25MHz square wave can be decomposed into sine waves at 25MHz, 75MHz, 125MHz, etc. -- so you get this sine wave multiplication effect at all of those frequencies.
A more comprehensive answer has to do with the properties of the Fourier transform (a spectrum analyzer is basically an analog computer dedicated to finding the Fourier transform of its input -- sorta kinda).  I can't really go into that here, but if you're interested in this stuff you probably want to pick up a book on signal processing and start studying.

A: It all starts with an understanding of bandwidth. Technically, the bandwidth of a pure AC carrier is zero. The carrier could be 2 GHz, but if it is not modulated, then the bandwidth is still zero.
A signal starts to have bandwidth when the carrier is modulated. AM signals do not have zero bandwidth even though the frequency of the carrier is constant, because amplitude modulation increases the frequency content (bandwidth) of the signal. A simple rule is this: Any signal which is not a pure sinusoid (or DC) has bandwidth.
Many of the signals you described have much higher bandwidth than you realize because of the modulation.
It is kind of complicated to estimate the bandwidth of a modulated signal, and it depends on many details. So I am not going to go into it. But just kind of generally you should think of the carrier frequency as being much much higher than the modulation frequency. Your examples flaunt that idea.
Anyway if you know the bandwidth of a signal, then you know the minimum sample rate that is required to capture it without aliasing. If you have a 1MHz bandwidth signal which spans from 2 GHz to 2.001 GHz, you can use RF magic (down conversion mixers) to shift the signal down so that it runs from DC to 1 MHz. Then you can sample it with > 2 MHz sample rate.
I would say the main error in your thinking is not understanding the effect of modulation on signal bandwidth.
One last thing. In many cases, modulation may lead to a situation where frequency content extends to infinitely high frequencies with vanishingly small amplitudes. Bandwidth usually is defined to be the frequency range necessary to capture most of the signal energy, but not all of it.


text:
Q: How to do OR masking operation in Image processing in python? I have a code in C# which is giving me a masking result. But I couldn't do it in python. Can anyone help me on how to do it? Is it possible in python? I almost went through the python openCV documentation
public void OROPeration()
       {
           IplImage orImage = Cv.CreateImage(src.Size, BitDepth.U8, 3);
           Cv.Or(src, mask, orImage, null);
           Cv.SaveImage("4.jpg", orImage);
       }

Original image

Masking image

Result need to obtain

A: Theres a function in opencv, bitwise_or, I guess it'd do what you want.
import cv2

fin_image = cv2.bitwise_or(src_image, masking_image)


text:
Q: Sliding up and down Expandanable list view content I am developing a drag and drop expandable list view. where I can drag any child from one group to
another group . Problem that I am facing is when expandable list have more then 50 records(rows)  It show
15 records on the screen visible area and other 35 is off the screen (invisible area).Here is the  problem scenario starts
when I want to drag my 1 group child to 35th group i cant scroll down to 35th group because  35th record exist
in invisible area of the screen. I need a solution some thing like when I start drag the child of first group and want to
move it to  group number 35 list automatically scroll towards up and I can see 35th record on to the mobile
visible area.Keep in mind that I want to drag my child from one group to other gourp . Hope I make my situation some how clear to you

A: Not a solution, but a hint...
Maybe it's worth adding another approach, like you check the item(s) you want to drag, a bar appears at the top of the screen (like in file managers for copy, cut and paste), you click the button in that bar, then scroll to the group you want to paste (copy) into, click the group and that's it?


text:
Q: Convenient shortcut for integrals I just create a shortcut especially for definite integrals. But, the message log said that I had a mistake (an error). Could someone tell me why and help me design a better \newcommand code for me, especially on definite integrals?
Here is the code that I've tried :
\newcommand{\intl}[3][]{\displaystyle{\int_{#1}^{#2} {#3}\,\,dd x}}

Oh ya, this \dd stands for \mathrm{d}. And {#3} means the function that I would like to integrate it.
Edit starts here (Thanks to @Andrew for the advice)            -----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Here is my sample :
\documentclass[11pt]{article}
\usepackage{amsmath}
\usepackage{amsfonts}

\newcommand{\dd}{\mathrm{d}} % <--- Editted here
\newcommand{\intl}[3][]{\displaystyle{\int_{#1}^{#2} {#3}\,\,dd x}}

\begin{document}
$$\intl{1}{5}{x}$$
\\
This is hoped to be like this,
$$\displaystyle\int_{1}^{5}x\dd x$$ % <--- Editted here
\end{document}

A: Try this. ($$..$$ should not be used in a LaTeX document. \displaystyle is default within \[..\] environment)
 \documentclass[11pt]{article}
 \usepackage{amsmath}
 \usepackage{amsfonts}

 \newcommand{\dd}{\mathrm{d}}
 \newcommand{\intl}[3]{\displaystyle\int^{#2}_{#1}{#3}\,\dd x}

 \begin{document}
 \[\intl{1}{5}{x}\]
 \\
 This is hoped to be like this,
 \[\int_{1}^{5}x\dd x\]
 \end{document}


text:
Q: apache if ie send some header I want to set some headers just for MSIE using apache configuartion file. How can i set the condition for that ?
# better website experience for ie users
<IfModule mod_headers.c && MSIE> # && MSIE is just exmple. WRONG
    Header set X-UA-Compatible "IE=Edge,chrome=1"
    # mod_headers can't match by content-type, but we don't want to send this header on *everything*...
    <FilesMatch "\.(js|css|gif|png|jpe?g|pdf|xml|oga|ogg|m4a|ogv|mp4|m4v|webm|svg|svgz|eot|ttf|otf|woff|ico|webp|appcache|manifest|htc|crx|oex|xpi|safariextz|vcf)$" >
        Header unset X-UA-Compatible
    </FilesMatch>
</IfModule>

Apache 2.2

A: You have to check the browser first, and set an environment variable. Then, the environment variable becomes the condition upon which you can act, by setting the header or – should you wish to – do other stuff. Here is an example:
BrowserMatch ".*MSIE.*" IE_browser=yes
Header set X-UA-Compatible "IE=Edge,chrome=1" env=IE_browser
<FilesMatch "\.(js|css|gif|png|jpe?g|pdf|xml|oga|ogg|m4a|ogv|mp4|m4v|webm|svg|svgz|eot|ttf|otf|woff|ico|webp|appcache|manifest|htc|crx|oex|xpi|safariextz|vcf)$" >
    Header unset X-UA-Compatible
</FilesMatch>


text:
Q: Centre of Mass vs. Centre of Gravity I want an explanation for this:

"The centre of mass & centre of gravity of an extended body on the surface of earth is different for objects with sizes greater than 100m"

As a matter of fact I was under the impression that the centre of mass(CM) always coincides with the centre of gravity(CG).

A: The centre of mass is always the same.
The centre of gravity depends on gravity's pull. If it pulls equally everywhere, then this pull as well averages out to be in the centre of mass.
But imagine having a very tall uniform object. A beam standing on the surface and reaching 300 km outwards i.e. The bottom is closer to earth where gravity is stronger, while there is less gravitational pull in the far end. The result is an averaged gravitational pull closer to the Earth surface.
The centre of mass is still in the very middle of the beam, but the centre of gravity is not anymore.
From the comment, let me add the note that the centre of mass regards one object and not necessarily a whole system. When Earth pulls in the beam in my example, then that gravitational force is an external force. The beam is the system in my example, not including Earth.


text:
Q: Grails file downloads using ajax calls outside of views folders I am building a grails app that requires importing a web structure of full html (complete with navigation and its own js/css) to be able to add some functionality from the existing controllers using ajax calls.
So far everything has worked as expected, the imported html is visible at /webapp/ImportedHtml and every ajax url/js/css just needs extra attention depending on what its being pointed at (the grails app urls or the Imported html ulrs).
However my first problem comes in the form of a downloadable file call. Here is my code:
 <form id="uploadForm"  action="asyncGetFiles"  method="post">
   <input id="testbutton" type="submit" value="Submit" />
 </form>

A very simple form with a submit that triggers a javascript call provided by Jquery Form Plugin
     $('#testbutton').click(function(){
        // Takes in a list of files to be downloaded from .downloads
        var downloads_container =new Array();
        $('.downloads').each(function(){
            downloads_container.push($(this).val());
        });
        var __onSuccess = function(data) {
            // Opens the request in a new window to prevent the current from being modified or redirected
            var OpenWindow=window.open('', '_blank');
            OpenWindow.document.write(data);
            OpenWindow.document.close();
            self.name="main";

        };
        var options = {

            success: __onSuccess,
            data : {
                result:''+downloads_container
            }
        //,                url : '../../dataCart/asyncGetFiles'

        };
        $('#uploadForm').ajaxForm(options);
    }

My controller download code is pretty simple, it looks like this:
 response.setContentType("application/zip")
 response.setHeader("Content-Disposition", "attachment; filename=\"" + "pictureName" + "\"");
 response.outputStream << "whatever I dont care";
 return;

In summary my current code is organized like this

*

*/rootApp /webapp /htmlRoot /downloads /downloads.html

*

*to the server it looks like

*/rootApp /htmlRoot /downloads /downloads.html

*the ajax url will look like this

*

*../ ../ controller/ asyncGetFiles

*any calls to the ajax originated from here will result in no download triggering BUT the call being successful and rendering as a plain string

However if I set the same code to the controller's view folder

*

*/rootApp/controller/downloads.gsp

*

*the ajax calls pointing to asyncGetFiles

*the call will successfully trigger the download

The question is: Why is the download not triggering in the first scenario?
I've no idea where to look for information on how to fix this :/


text:
Q: Can't manage to make jquery.transit to work I'm trying to combine Hammer.js and jquery.transit to create a nice drag effect on a side menu, but, I can't manage to make jquery.transit to work (yep, that sounds stupid... ).
Here is what I have
var $mainPage = $('#main-page');
  var drawer = 0;
  if(Modernizr.touch){
    $mainPage.hammer()
              .on('swiperight', function(e){
                if(drawer){
                  return true;
                }
                $mainPage.transition({ x: 260 });
                drawer = 1;
              })
              .on('swipeleft', function(e){
                if(!drawer){
                  return true;
                }
                $mainPage.transition({ x: 0 });
                drawer = 0;
              });

But, I keep getting the Object [object Object] has no method 'transition'... Any idea why ?

A: Please look at the following example and note the prevent_default: true option passed to hammer.js in order to run smoothly on devices. Regarding your error i guess you did not use the jquery plugin of hammer.js , since it working fine in the example below.
http://jsbin.com/ExECiHUS/1/edit
html
<!DOCTYPE html>

  <meta charset=utf-8 />
  <meta name="viewport" content="width=device-width, initial-scale=1">

<title>JS Bin</title>

this is main page

js
var $mainPage = $('#main-page');
  var drawer = 0;
  //if(Modernizr.touch){
    console.log($mainPage);
$mainPage.hammer({prevent_default: true})
              .on('swiperight', function(e){
                console.log('swipe right');
                if(drawer){
                  return true;
                }
                                            console.log('transition');
                $mainPage.transition({ x: 260 });
                drawer = 1;
              })
              .on('swipeleft', function(e){
                console.log('swipe left');
                if(!drawer){
                  return true;
                }
                $mainPage.transition({ x: 0 });
                drawer = 0;
              });
  //}else{
    //console.log('touch events not supported!');
  //}


text:
Q: php, mysql- join three tables in mysql under some special cases tbl_person
id bank_id address
1   100     null
2   100     null
3   100     null

tbl_bank
id address_id balance
100      2      500

tbl_address
id  address_id  address
1    2           texas
2    2            ny
3    2          downtown

I wanted an output like this
   id  bank_id   address
    1   100        texas
    2   100        ny
    3   100       downtown

I tried  this query, but it results 9 rows as expected. can anyone help to get the desired output. No rows will get deleted
SELECT tp.id, tp.bank_id,ta.address
FROM `tbl_person`as tp
    join tbl_bank as tb on tp.`bank_id`=tb.id
    join tbl_address as ta on ta.address_id=tb.address_id
WHERE tp.`bank_id`=100

   id  bank_id   address
    1   100        texas
    2   100        texas
    3   100       texas
    1   100        ny
    2   100        ny
    3   100       ny
    1   100        downtown
    2   100        downtown
    3   100       downtown

Is there a way to get the result(3 rows) using join  or any other method in php?


text:
Q: Cannot view values of local variables in async method of class library from WinUI 3 template I've modified the template WinUI 3 project which includes a .Core project. I'm using this project the same way that the template did except I've converted the method which returns data into an asynchronous one instead so that I can update the UI as data is parsed rather than all at once.
However, this is preventing me from viewing local variable values in the debugger. I instead get

Cannot obtain value of the local variable or argument because it is not available at this instruction pointer, possibly because it has been optimized away.

I'm setting breakpoints on lines where the values couldn't possibly be garbage collected as it is being used on the very next line. Stepping though the method from top to bottom does not help to reveal values.
Essentially code like this:
int i = 1;
int j = 2;
i = j + 1;

where I've put a breakpoint on the second line but am unable to see the value of i.
I've disabled every optimization I can. I've also verified that the .dll produced by the class library is not optimized in the modules window. I've been trying to solve this for days and it's severely affecting my productivity.


text:
Q: Circular dependency caused by importing typescript type I'm modeling data in typescript sent from a server to my Angular app. An Opportunity has a forms property containing an array of Form[] objects. A Form has a parent property which may contain an Opportunity. In order to resolve the types, the file which defines Opportunity imports Form and the file which defines Form imports Opportunity. This creates a circular dependency warning.
I've found several prior SO questions dealing with circular dependencies (here, here), but in each case they were dealing with circular dependencies in the javascript code. In this case, the circular dependency is only with the typescript types, and will not exist after compilation. Is there some way to include a type in a file while avoiding this circular dependency issue? So far I haven't found anything.
I can think of two solutions to this problem:

*

*Define both models in the same file

*Recreate the Form interface in the Opportunity file / the Opportunity interface in the Form file.

Are there any other / better solutions? Thanks!
Update 2
I appear to have found an answer (it was just really far down in the list of questions for some reason). This answer suggestions two possibilities

*

*Create a seperate definition file (which would seem to involve recreating the Opportunity and Form class interfaces, so would be no better then option #2 above).

*Use import, which is what I'm already doing (and which is causing the circular dependency warning).
Is there a way to import just the associated interface of a class?
Update 3
Just to be clear, currently Opportunity and Form look like this:
// opportunity.ts
import { Form } from '....../form'

export class Opportunity {
  public forms: Form[] = [];
}

// form.ts
import { Opportunity } from '....../opportunity'

export class Form {
  public parent: Opportunity;
}

A: You can declare a class declare class Opportunity {} in form.ts file, TypeScript will assume that class is an external class and will be available at runtime. And you can skip import in one of the class.
The only pain here is, you have to declare methods that you will be using for example,
declare class Opportunity {
     method1(): void;
     method2(): number;
}

This class will serve as simple declaration and will not require method body. And VS intellisense will work correctly.

A: from typescript version 3.8
import type would help you.
https://www.typescriptlang.org/docs/handbook/release-notes/typescript-3-8.html

A: You could remove the circular dependency by depending on abstractions, for example your form module could define an interface or abstract class that parent must confirm to.
This would mean your opportunity module would depend on the form module, but not vice versa. You would inject a concrete Opportunity into the Form.parent property and that would be acceptable.
This also allows you to define a FormParent (see below) that is a subset of Opportunity as you probably don't depend on everything in Opportunity.
As TypeScript is structural, it is up to you whether you explicitly implement the interface on the Opportunity class.
// opportunity.ts
import { Form } from '....../form'

export class Opportunity {
  public forms: Form[] = [];
}

// form.ts
interface FormParent {
    forms: Form[];
}

export class Form {
  public parent: FormParent;
}

A: Another approach is to use require instead of import in one class.
Looks something like:
let LoginPage = require("./loginpage").default;
return new LoginPage();

You can find it in the Best Practice #5 from this post.


text:
Q: Remember window layout on multiple monitors on Mint Cinnamon I have been using linux Mint 17.3 with Mate desktop for quite a bit now.  One of the thing I absolutely love is that it remembers layout of windows for multiple monitor configurations.  For example, in my normal desktop setup, I have my laptop on a docking station with 3 monitors attached to it - and my application windows are spread over these three monitors.  When I undock the laptop, all windows move to the laptop display.  When I connect the laptop back to the docking station, all windows are restored to their previous positions on the three monitors.
The other day I tried switching to Cinnamon desktop, per a colleague's recommendation - it does look nicer and works smoother, but it does not remember window position on multiple monitors.  In the scenario above, when I plug the laptop back to the docking station, all windows stay on the primary display.
For me, this feature (or rather lack thereof) alone is enough to abandon Cinnamon and go back to Mate, as I have a lot of application windows open at any given time (15-20 is the norm) and I dock/undock the laptop several times a day in the course of my normal work.  I can't afford to spend time rearranging windows every time I dock the laptop.
So, the question is, how can I make Cinnamon remember the windows position on multiple monitors and then restore it when I dock the laptop again?

A: I haven't automated this, but wmctrl let's you record window positions and also set them. xdotool might also work. Here are commands to restore and place windows:
Record: wmctrl -lG > ${rcfile}
Place:
while read row; do
  IFS=" " read id g x y w h _ <<< ${row}
  wmctrl -ir ${id} -e 0,${x},${y},${w},${h}
done < ${rcfile}

A: This has been an ongoing issue with Cinnamon and to my knowledge this functionality still isn't available out of the box.
This thread mentions a program called gDevilspie that supposedly allows you to configure the default window positions. I don't have any experience with it, though.


text:
Q: How many repetitions to establish difference (Real-world Context:
I often make changes to code, which I suspect will have small impacts on the performance. i.e. improvements that lie within the natural variation of the code's runtime.
How many reps of my perf test code do I need to run of the before/after code, in order to establish whether I have increased (or worse decreased!) the performance of my code?
I think that the following precise mathematical question, is a reasonable proxy for that question, but I have no idea how to calculate the answer.
Suppose I have 2 random variables, $X \sim N(0,\sigma)$ and  $Y \sim N(\delta,\sigma)$
Suppose that I am going to take $N$ samples of $X$ and $Y$.
How many samples ($N$) must I take, in order to be able to assert, with $p = 0.95$ confidence, whether $\delta > 0$ or $\delta < 0$.
How many samples ($N$) must I take, in order to be able to assert, with $p = 0.95$ confidence, that $|\delta| < \epsilon$?.

Does it change things, if my variables are $X' \sim N(\mu,\sigma)$ and  $Y' \sim N(\mu \pm \delta,\sigma)$ ?

If it makes it easier to have the confidence threshold be arbitrary, feel free to leave it as $p$.
I'm assuming that once I've established the correct expression for $N_{enough}$, then my test will be:

*

*Take $N_{enough}$ samples of each.

*Average each sample set.

*Compare the averages.

*Report "yes" is the average satisfies the goal.

i.e. once I take "enough" samples the process is trivial, I just need to work out what is "enough".


text:
Q: R: referencing a character string Is it possible to feed R a character string and for it to know I'm looking for the data frame with that name?
Example:
    TestData <- matrix(1:100,nrow=10, ncol=10)

Then, if I want to reference it later, can I do something similar to this to have R pull dataset?
    paste("TestData$",x[1,],sep="")

When entered this way, it comes up as a character string and obviously returns no data. For context, I'm trying to do it this way because I'm creating a loop that goes through several data sets (and columns within those datasets), but does similar operations, so I would like to be able to dynamically change the referenced dataset.
Any help is appreciated. Thanks!


text:
Q: Access VBA, unescaped single quotes, Replace(), and null Working on a script in Microsoft VBA to take a massive flat database and split it between about 20 different tables. The script consists mainly of opening a table, checking every row in the flat database to make sure it's not a duplicate, then adding the necessary fields. Repeat for every table.
The first time I ran it everything was going well until I tried to process the name O'Malley. I think it's obvious what went wrong. A quick search on Google turned up this related StackOverflow post. I took their advice and added Replace(str, "'", "''") to every field before inputting it into the new tables. Now I've run into a new problem and Google is less helpful.
Replace(null, "'", "''") causes a run-time error, and the flat database is just riddled with null values. I can add an extra line above every Replace() call to check IsNull() and if so put null into the database instead of Replace(str, "'", "''"), although I would prefer a solution that can fit into a single line if possible. Is there any more elegant way to solve this dilemma, or will I need 216 If statements in my code?
EDIT -
Another reason that I'm searching for a more elegant solution is my duplicate checking code. At the moment I have something like the following:
        'Check for duplicates
        'Assume student is duplicate if it shares:
        '   (StudentName and School) or SSN
        Set rstDuplicate = CurrentDb.OpenRecordset("select * from Student where (StudentName = '" & Replace(rstFrom("Student").Value, "'", "''") & "' AND School = '" & Replace(rstFrom("School").Value, "'", "''") & "') OR SSN = '" & Replace(rstFrom("Social").Value, "'", "''") & "'")
        If rstDuplicate.RecordCount = 0 Then
            'Duplicate was not found
            rstTo.AddNew
            ' Add fields to the new table
            rstTo.Update
        End If

Since the Replace() calls are inline with the duplicate checking, if I were to instead use If statements to check for null then I would have to either save the result to a string or update to flat database. A function that returns Replace(str, "'", "''") OR null without the need for extra variables would be ideal.

A: If you want to keep everything inline, you can use an immediate If function (IIf):
IIf(IsNull(rstFrom("Student").Value), " Is Null", "= " & Replace(rstFrom("Student").Value)

That will be a nightmare to read and maintain, though.  You are better off writing your own function to handle the change in comparison operator as well as the apostrophe escaping:
Function CompFld(Val As Variant) As String
    If IsNull(Val) Then
        CompFld = " Is Null "
    Else
        CompFld = "= '" & Replace(Val, "'", "''") & "' "
    End If
End Function

Use it as so:
Dim SQL As String
SQL = "SELECT * FROM Student " & _
      "WHERE (StudentName " & CompFld(rstFrom("Student").Value) & " AND " & _
      "       School " & CompFld(rstFrom("School").Value) & ") " & _
      "   OR (SSN " & CompFld(rstFrom("Social").Value) & ") "
Set rstDuplicate = CurrentDb.OpenRecordset(SQL)
If rstDuplicate.RecordCount = 0 Then
    'Duplicate was not found
    rstTo.AddNew
    ' Add fields to the new table
    rstTo.Update
End If

A: A terse, yet ugly little gem handed down to me from ages ago:
Replace(str & "", "'", "''")

Appending an empty string to a null value returns an empty string in VBA, and won't modify a non-empty string.

A: Access' database engine will accept either single or double quotes as delimiters for string values in queries.  So instead of ...
SELECT * FROM Student WHERE StudentName = 'O''Malley'

... you can do this ...
SELECT * FROM Student WHERE StudentName = "O'Malley"

That would allow you to handle inputs which contain apostrophes.  OTOH, if your string inputs also contain double quotes, this will break.
I suspect you may have more going on than just the apostrophe issue, but I don't understand your big picture.  You seem to be opening a third DAO recordset for each record in rstFrom, to check whether a match exists in the Student table.  I would use DCount() instead.
Dim strCriteria As String
strCriteria = "StudentName = ""O'Malley"" AND School = ""foo"""
If DCount("*", "Student", strCriteria) = 0 Then
    'no match found --> add it '
End If


text:
Q: Why is my Stripe Charge suddenly not working? Has Stripe changed something? I have used this code snippet before and now suddenly there is error (Exception $e)? This error is appearing suddenly have fought with in for an hour now
try {

    //Charge the Card
    $charge = \Stripe\Charge::create(array(
    "customer" => $stripe_account,
    "amount" => 450,
    "currency" => "eur",
    'capture' => true),
    );

    $chargeID = $charge->id;

    } catch (\Stripe\Error\InvalidRequest $e) {

        //Send User to Error Page
        echo json_encode(array("statusCode"=>205));
    exit();

    } catch (\Stripe\Error\Base $e) {

        //Send User to Error Page
         echo json_encode(array("statusCode"=>205));
         exit();

    } catch(\Stripe\Error\Card $e) {
        // Since it's a decline, \Stripe\Error\Card will be caught
        echo json_encode(array("statusCode"=>205));
        //Send User to Error Page

    exit();

    } catch (Exception $e) {
        //Send User to Error Page
        echo json_encode(array("statusCode"=>205));
        //Send User to Error Page

    exit();

    }

A: This issues was fixed by changing the API key. Which makes no sense i've been in contact with Stripe which is now researching this. But it works now.


text:
Q: Draw the Path of a Moving SKSpritenode I am Trying to use the new SKSpritenode , i have managed to create a Spritenode move it around the screen , although i want the Spritenode leaves a trace( color )  where it moves.
the code to create the Sprite node & my attempts to create a shapenode as a child for the spritenode ( which did not work ) .
-(void)movetherayoflight{

    ray1=[[lightray1 alloc]initWithColor:[SKColor redColor] size:CGSizeMake(6,6)];
    [ray1 setPosition:CGPointMake(50, 50)];
    ray1.physicsBody=[SKPhysicsBody bodyWithRectangleOfSize:ray1.size];
    ray1.physicsBody.restitution=1;
    ray1.physicsBody.linearDamping=0;
    ray1.physicsBody.friction=0;
    ray1.physicsBody.allowsRotation=NO;
    ray1.physicsBody.velocity=CGVectorMake(0.0f, 300.0f);
    [self addChild:ray1];

    SKShapeNode *raayyy=[[SKShapeNode alloc]init];
    CGMutablePathRef rayPath = CGPathCreateMutable();

    CGPoint fff=CGPointMake(ray1.position.x, ray1.position.y);
    CGPoint startpoint=CGPointMake(50, 100);
    //CGPathAddLines(rayPath, NULL, &fff, 2);
    CGPathAddLines(rayPath, NULL, &startpoint, 5);
    //CGPathAddLineToPoint(rayPath, NULL, ray1.position.x, ray1.position.y);
    raayyy.path=rayPath;
    raayyy.lineWidth = 1.0;
    //raayyy.fillColor = [SKColor whiteColor];
    raayyy.strokeColor = [SKColor greenColor];
    raayyy.glowWidth = 0.5;
    [ray1 addChild:raayyy];

}

If you have better Solution , Please let me know !

A: Instead of making the SKShapeNode as the child of the SKSpriteNode, declare it as its sibling in the SKScene.
First, declare the SKShapeNode and the CGPath as instance variables.
In your scene's -initWithSize: method,
raayyy=[[SKShapeNode alloc]init];
//Additional initialization here.

rayPath = CGPathCreateMutable();
CGPathMoveToPoint(pathToDraw, NULL, ray1.position.x, ray1.position.y);
rayyy.path = rayPath;
[self addChild:rayyy];

Then in your -update: method,
CGPathAddLineToPoint(rayPath, NULL, yar1.position.x, ray1.position.y);
rayyy.path = rayPath;

This is just a suggestion, I haven't tried anything of the like myself.

A: well , I have managed it with a solution but i really dont like it so far
    -(SKShapeNode*)gravityline{
    SKShapeNode *lolo = [[SKShapeNode alloc] init];
    CGPoint fff=CGPointMake(ray1.position.x, ray1.position.y);
    CGMutablePathRef path = CGPathCreateMutable();
    CGPathMoveToPoint(path, NULL, fff.x, fff.y);
    CGPathAddLineToPoint(path, 0,rayoriginpoint.x,rayoriginpoint.y );
    CGPathCloseSubpath(path);
    lolo.path = path;
    lolo.name=@"gravityline";
    lolo.strokeColor=[SKColor greenColor];
    lolo.glowWidth=.1;
    lolo.physicsBody=[SKPhysicsBody bodyWithPolygonFromPath:path];
    lolo.physicsBody.categoryBitMask=raylightCategory;
    lolo.physicsBody.collisionBitMask=batCategory;
    lolo.physicsBody.contactTestBitMask=batCategory;
    lolo.physicsBody.dynamic=NO;
    CGPathRelease(path);

    return lolo;
}

The rayoriginpointchanges its value once the ray point hits something
if (firstBody.categoryBitMask == rayCategory && secondBody.categoryBitMask==mirrorCategory )
{
    [self addChild:[self gravityline]];
    CGPoint p = contact.contactPoint;
    rayoriginpoint=p;

    NSLog(@"Contact have been made");
}

What i want to do is very basic :
1- Either to change the Color of every CGPOINT that the SKSpritenode Passes by
2- Either to create Sprite node that scales up in certain direction till it hits something then changes direction


text:
Q: Mass of a galaxy via Luminosity Is there a way of calculating the mass of a galaxy, or even a nebula from the luminosity?
EDIT
I'm deleting this, and moving the question to Astronomy Stack Exchange - thanks david

A: There's no way to calculate such a thing from first principles: the luminosity of a galaxy depends on how efficiently it managed to form stars out of the matter available to it. Star formation is far too complicated to admit of a first-principles calculation.
But there are empirical relationships between mass and luminosity, which have been used and refined for many years. When trying to understand the large-scale structure of the Universe, we want to know where the mass is, but what we can measure is where the light is. Hence the great interest in mass-luminosity relations. The link you provide in your edit is an example of this work. To find others, a good buzzword to search for is "mass-to-light ratio." For instance, this article might be a good place to start (although I haven't read it).


text:
Q: Перебор всех элементов вектора пар, c++ У меня есть вектор пар
vector<pair<int, int>> direct = { {2, 1}, {1, 2}, {-2, 1}, {-1, 2}, {-2, -1}, {-1, -2}, {2, -1}, {1, -2} };
как мне пройтись по элементам этого вектора с помощью такой конструкции:
for (int d_x, int d_y : direct) {
    //блок кода
}

т.е. d_x и d_y - это соответственно первый и второй элемент пары.
я знаю, что можно просто использовать .fisrt и .second, но можно сделать так?

A: Вот так (С++17):
for (auto [d_x,d_y] : direct) {
    //блок кода
}


text:
Q: Why do I keep getting this error: SQL command not properly ended for insert into values? INSERT into L5_DIRECTORS (director_id, first_name, last_name)
 Values
            (1010, 'Rob', 'Minkoff'),
            (1020, 'Bill', 'Condon'),
            (1050, 'Josh', 'Cooley'),
            (2010, 'brad', 'bird'),
            (3020, 'lake', 'bell');

EDIT: I figured it out, I had to write each row individually and run it, I do not why it would not work all together but thanks for the help anyway.

A: Oracle does not allow you to insert multiple rows using the VALUES syntax.  I recommend just using insert . . select:
INSERT into L5_DIRECTORS (director_id, first_name, last_name)
    SELECT 1010, 'Rob', 'Minkoff' FROM DUAL UNION ALL
    SELECT 1020, 'Bill', 'Condon' FROM DUAL UNION ALL
    SELECT 1050, 'Josh', 'Cooley' FROM DUAL UNION ALL
    SELECT 2010, 'brad', 'bird' FROM DUAL UNION ALL
    SELECT 3020, 'lake', 'bell' FROM DUAL;


text:
Q: Eigen compilation error with MPI I am trying to do domain decomposition using Zoltan library and want to implement Eigen.
Unfortunately, the moment I include Eigen in the header #include <Eigen/Dense>, I get the following compilation error:
SRC/init_system.cpp:24:23: fatal error: Eigen/Dense: No such file or directory
 #include
                       ^
compilation terminated.
Even, I have included the Eigen path in the makefile, as shown below:
CXX=mpic++

ID_TYPE_FLAG=-DZOLTAN_ID_TYPE_LONG_LONG

BLD=/home/kumar/Software/Zoltan/Zoltan_v3.83/BuildDir/src

SRC=/home/kumar/Software/Zoltan/Zoltan_v3.83/src

ZOLTAN_INCLUDE=-I$(SRC)/include

ZOLTAN_CONFIG_INCLUDE=-I$(BLD)/include

ZOLTAN_UTIL_INCLUDE=-I$(SRC)/zz  \
                    -I$(SRC)/par \
                    -I$(SRC)/order \
                    -I$(SRC)/tpls \
                    -I$(SRC)/lb \
                    -I$(SRC)/params \
                    -I$(SRC)/Utilities/shared

CXXFLAGS  = -Wall -g3 -std=c++11 -I include/eigen3 -$(ID_TYPE_FLAG)

COPT    = -DMKL_ILP64 -m64

LIBS    = -lmkl_intel_ilp64 -lmkl_core -lmkl_intel_thread -liomp5 -lpthread -lm -ldl -lmkl_core -lmkl_intel_thread -lzoltan -lparmetis -lmetis -lptscotch -lscotch -lptscotcherr -lscotcherr

CXXFLAGS =$(ID_TYPE_FLAG)

ODIR    = /OBJ
CFILES  := $(wildcard SRC/*.cpp)
OFILES  := $(addprefix OBJ/,$(notdir $(CFILES:.cpp=.o)))

meshl:  $(OFILES)
    $(CXX) $(CXXFLAGS) -o $@ $(OFILES) $(LIBS)
OBJ/%.o: SRC/%.cpp
    $(CXX) $(CXXFLAGS) -c $(COPT) $< -o $@

clean:
    rm -f OBJ/*.o

The domain decompositoin code using Zoltan is compiling absolutely fine with mpi when the header for Eigen is NOT included in the code.
Any help in this regard for implementing Eigen would be appreciated.
Thank you for your time !!


text:
Q: Remove authentication and permission classes only on one action I have a generic view set custom action and i want to remove only from this action the authentication and permission classes. I tried the following but it does not work.
class ExampleView(GenericViewSet,
    mixins.ListModelMixin,
    mixins.DestroyModelMixin,
    mixins.CreateModelMixin,
):
    authentication_classes = [SessionAuthentication, BasicAuthentication]
    permission_classes = [IsAuthenticated]

    def custom_action(self, request, format=None):
        self.authentication_classes = []
        self.permission_classes  = []

A: When you mark the custom action for routing with the action decorator, you should be able to specify the permission classes and authentication classes.
For example:
class ExampleView(GenericViewSet,
    mixins.ListModelMixin,
    mixins.DestroyModelMixin,
    mixins.CreateModelMixin,
):
    authentication_classes = [SessionAuthentication, BasicAuthentication]
    permission_classes = [IsAuthenticated]

    @action(detail=False, permission_classes=[AllowAny], authentication_classes=[])
    def custom_action(self, request, format=None):
        ...


text:
Q: Why will my opening menu not work in C++? At the moment I am compiling a program to do
1.  Prompt the user to enter a fixed number of MIDI notes for melody and bass
This is what the opening menu is for. However, the program will not proceed to prompt the user for the notes unless option '3' is pressed which as you can see is the EXIT option. I need to implement this piece of code to allow the user to enter a series of notes for 1. Melody and then 2. Bass. Why will it not take me to the validation if I press 1. or 2. but only when I press 3.?
using namespace std;
#include <iostream>
#include <cstdlib>

using namespace std;
//********GET MIDI********//
string GetNote()
{
    string input;
    int loop = 1;
    cout << "Hello, please type in a note: "<< endl;
    cin >> input;
    while (1)
    {

        if (input.length() < 2 || input.length() > 3) //Step 1: If note name length is less than 2 OR more than 3, return false
        {
        cout<<"Note must be either 2 or 3 characters long!\n";
        cin >> input;
        }

        else if (((int)input[0] < 65)|| ((int)input[0] > 71 )) //Step 2: The note must be/(or be) between A and G
        {
        cout<<"The note must be between A to G!\n";
        cin >> input;
        }

        else if (input.length() == 2 && (isdigit(input[1]) == false))
            //(isdigit(note[GetValidNote()-1]) == false) //Step 3: If true, the last character must be a digit
        {
        cout<<"Last character must be a digit!\n";
        cin >> input;
        }
        else if (input.length() == 3 && (isdigit(input[2]) == false))
            //(isdigit(note[GetValidNote()-1]) == false) //Step 3: If true, the last character must be a digit
        {
        cout<<"Last character must be a digit!\n";
        cin >> input;
        }

         else if (input.length() == 3 && input[1] !='#') //Step 4: If note length is 3 note[1] (character 2) must be '#'.
        {
        cout<<"Invalid sharp note\n";
        cin >> input;
        }
        else
        {
            return input;
        }
    }

}

//********START UP MENU*******//

int StartUpMenu()
{
    while (1)
    {
        int choice;

        cout <<"::menu option::\n\n"
            <<"1. Bass\n"
            <<"2. Melody\n"
            <<"3. Exit\n"
            <<"Would you like to work with Bass or Melody first? Please enter 1 for Bass or 2 for Melody or 3 to Exit:";

        cin >> choice;

        if(choice == 3) break;

        else if (choice == 1)
        {
            system ("CLS");
            cout<<"1. Bass \n\n";

            GetNote();

            system ("PAUSE");
            system ("CLS");

        }

        else if (choice == 2)
        {
             system ("CLS");
            cout<<"2. Melody \n\n";

            GetNote();

            system ("PAUSE");
            system ("CLS");
        }

        else if (choice > 3 || choice < 1)
        {
            system ("CLS");
            cout<<"2. Melody \n\n";
            system ("PAUSE");
            system ("CLS");
        }

    }

    return 0;
}

//********VALIDATION FOR NOTE NAME********//

int MidiStorage(string validnote)
{
    int MidiLetter = validnote[0] - 65;

    int Note;
    int Octave = validnote[validnote.length()-1]; //THIS IS A MATHMATICAL EQUATION TO GET THE COMPUTER TO REALISE WHAT AN OCTAVE IS USING THE MIDI NOTE CHART.

    if(validnote[0] == 'A')

    {
        MidiLetter = 9;
    }

    else if (validnote[0] == 'B')

    {
        MidiLetter = 11;
    }

    else if (validnote[0] == 'C')

    {
        MidiLetter = 12;
    }

    else if (validnote[0] == 'D')
    {
        MidiLetter = 14;
    }

    else if (validnote[0] == 'E')
    {
        MidiLetter = 16;
    }

    else if (validnote[0] == 'F')
    {
        MidiLetter = 17;
    }

    else if (validnote[0] == 'G')
    {
        MidiLetter = 19;
    }
    /////////////////////

    int midivalue = MidiLetter + (Octave * 12);
    if(validnote.length() == 3)
    {
        midivalue += 1;
    }

}

//Validation

int main()
{
string note;

int midivalue;

StartUpMenu(); //This function brings you to the start up menu

note = GetNote(); //This function tells the computer what note between A-G and  the user has given

cout << "The note you chose is: " << note << endl;

MidiStorage(note);
GetNote();
return 0;
}

A: Only in option 3, you do a break from the loop, which returns from the loop so your program continues.  Option 1 and 2 (and default) just shows the choice and stays in the loop, so a new choice is asked.  You can break when option 1 and 2 are given, but you probably want to return the option so your program can act on it.
By the way, there is a typo in your code: else if (choice == 1;) shouldn't contain a ';'.

A: You are not calling function GetNote anywhere in your code.


text:
Q: Beautifulsoup scraping specific table in page with multiple tables import requests
from bs4 import BeautifulSoup

results = requests.get("https://en.wikipedia.org/wiki/List_of_multiple_Olympic_gold_medalists")

src = results.content

soup = BeautifulSoup(src, 'lxml')

trs = soup.find_all("tr")
for tr in trs:
    print(tr.text)

This is the code I write for the scraping table from the page "https://en.wikipedia.org/wiki/List_of_multiple_Olympic_gold_medalists"
If I am only targeting the table in the session "List of most Olympic gold medals over career", how can I specify the table I need? There are 2 sortable jquery-tablesorter so I cannot use the class attribute to select the table I needed.
One more question, if I know that the page I am scraping contains a lot of tables and the one I need always have 10 td in 1 row, can I have something like
If len(td) == 10:
print(tr)

to extract the data I wanted
Update on code:
from bs4 import BeautifulSoup

results = requests.get("https://en.wikipedia.org/wiki/List_of_multiple_Olympic_gold_medalists")

src = results.content

soup = BeautifulSoup(src, 'lxml')

tbs = soup.find("tbody")
trs = tbs.find_all("tr")
for tr in trs:
    print(tr.text)

I have one of the solution, not a good one, just to extract the first table from the page which is the one I needed, any suggestion/ improvement are welcomed!
Thank you.

A: To only get the first table you can use a CSS Selector nth-of-type(1):
import requests
from bs4 import BeautifulSoup

URL = "https://en.wikipedia.org/wiki/List_of_multiple_Olympic_gold_medalists"

soup = BeautifulSoup(requests.get(URL).content, "html.parser")

table = soup.select_one("table.wikitable:nth-of-type(1)")
trs = table.find_all("tr")

for tr in trs:
    print(tr.text)


text:
Q: jQuery code removeAttr issue <input id="mnc" type="text"/>
<input type="text" id="selected" />

$('#mnc').val().length ? $('#selected').attr({
    'size': $('#mnc').val()
}) : $('#selected').removeAttr('size');

This gives an error in Firefox 4.

Index or size is negative or greater
  than the allowed amount" code: "1

Other browsers are able to handle removeAttr even if attribute does not exist. What i'm doing is checking if input #mnc is empty then remove attribute size from #selected whether it exists or not.
Check http://jsfiddle.net/zFCtU/1/

A: It's a bug in Firefox, see the jQuery bug report. A workaround should be present for jQuery Version >= 1.6.
Edit: Sadly the fix is to be released with 1.6 (not 1.5.2 as I wrote earlier). Firefox 4.0.1 should fix it on the firefox-side though. You either have to decide to expect that 4.0.1 is installed of have to apply the patch yourself.

A: here is a snippet to look at, it's working
$('#mnc').change(function () {
    if ($(this).val().length > 0) {
        $('#selected').attr({'size': $(this).val().length});
    } else {
        $('#selected').removeAttr('size');
    }
});

A: Why don't you try setting it first then unsetting it, to make sure it always exists?
$('#selected').attr('size','').removeAttr('size');


text:
Q: Getting the second record using EXCEPT I want to get the second record from bottom.
I tried
SELECT TOP 2 meetings_id FROM meetings ORDER BY meetings_date DESC
EXCEPT
SELECT TOP 1 meetings_id FROM meetings ORDER BY meetings_date DESC

But there is syntax error in except.
When I try to delete order by it works but that giving me the second record from the top.

A: Try using OFFSET and FETCH
select meetings_id from meetings ORDER BY meetings_date DESC
OFFSET 1 ROWS
FETCH NEXT 1 ROWS ONLY

OFFSET
FETCH

A: This solution only works while you have > 1 rows in your table.
SELECT TOP 1 meetings_id FROM
(SELECT TOP 2 meetings_id, meetings_date FROM meetings
 ORDER BY meetings_date DESC) x
ORDER BY meetings_date;

Based on answer from this link.
You'll probably get an error or empty result since there is no penultimate row. So your query will be faulty in this case.

A: If you really want to use EXCEPT because of some strange requirement or trivia, then you need to put the TOP queries into table expressions:
SELECT meetings_id FROM
(
  SELECT TOP (2) meetings_id
    FROM dbo.meetings
    ORDER BY meetings_date DESC
) AS bottom2
EXCEPT
SELECT meetings_id FROM
(
  SELECT TOP (1) meetings_id
    FROM dbo.meetings
    ORDER BY meetings_date DESC
) AS bottom1;

But this is neither intuitive nor efficient.

*

*Examples: db<>fiddle

*With showplan comparisons, showing why EXCEPT is the worse solution offered thus far: db<>fiddle


text:
Q: Flutter - Fix Drawer Header Following this link Add a Drawer to a screen I have created a drawer.
Following is my piece of code:
// FUNCTION CONTAINING LEFT SIDE MENU ITEMS
  _drawerList() {
    return Drawer(
      child: ListView(
        padding: EdgeInsets.zero,
        children: <Widget>[
          DrawerHeader(
            child: Column(
              crossAxisAlignment: CrossAxisAlignment.start,
              children: <Widget>[
                Text(
                  'John Doe',
                ),
              ],
            ),
            decoration: BoxDecoration(
              image: DecorationImage(
                image: AssetImage('assets/images/menu_bg.png'),
                fit: BoxFit.cover,
              ),
            ),
          ),
          ListTile(
            // Some Code
          ),
        ],
      ),
    );
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
        // Some Code
        drawer: Drawer(
          child: _drawerList(),
        ),
        // Some Code
  }
}

Is there any way I can fix "DrawerHeader" so that it doesn't move with the drawer and list view.
P.S. I don't want to hold ListView. I just want to hold or fix "DrawerHeader".

A: Yes, move it out of the ListView widget and use Column to hold both DrawerHeader and ListView.
With items scrolling enabled
_drawerList() {
  return Drawer(
    child: Column(
      mainAxisAlignment: MainAxisAlignment.start,
      crossAxisAlignment: CrossAxisAlignment.start,
      children: [
        DrawerHeader(
          child: Column(
            crossAxisAlignment: CrossAxisAlignment.start,
            children: <Widget>[
              Text(
                'John Doe',
              ),
            ],
          ),
          decoration: BoxDecoration(
            image: DecorationImage(
              image: AssetImage('assets/images/menu_bg.png'),
              fit: BoxFit.cover,
            ),
          ),
        ),
        ListView(
          padding: EdgeInsets.zero,
          children: <Widget>[
            ListTile(
              // Some Code
            ),
            ListTile(
              // Some Code
            ),
            ListTile(
              // Some Code
            ),
            ListTile(
              // Some Code
            ),
            ListTile(
              // Some Code
            ),
          ],
        ),
      ],
    ),
  );
}

With items scrolling disabled
_drawerList() {
  return Drawer(
    child: Column(
      mainAxisAlignment: MainAxisAlignment.start,
      crossAxisAlignment: CrossAxisAlignment.start,
      children: [
        DrawerHeader(
          child: Column(
            crossAxisAlignment: CrossAxisAlignment.start,
            children: <Widget>[
              Text(
                'John Doe',
              ),
            ],
          ),
          decoration: BoxDecoration(
            image: DecorationImage(
              image: AssetImage('assets/images/menu_bg.png'),
              fit: BoxFit.cover,
            ),
          ),
        ),
        ListTile(
          // Some Code
        ),
        ListTile(
          // Some Code
        ),
        ListTile(
          // Some Code
        ),
        ListTile(
          // Some Code
        ),
        ListTile(
          // Some Code
        ),
      ],
    ),
  );
}

A: Instead of wrapping inside ListView you can wrap it inside column and then add other widget inside that. Also if you want to divide header and other part in any ratio you can use Expanded widget.
 _drawerList() {
    return Drawer(
      child: Container(
        child: Column(
          children: <Widget>[
            Expanded(
              flex: 1,
              child: DrawerHeader(
                padding: EdgeInsets.all(0),
                child: Column(
                  crossAxisAlignment: CrossAxisAlignment.start,
                  children: <Widget>[
                    Text(
                      'John Doe',
                    ),
                  ],
                ),

              ),
            ),
            Expanded(
              flex: 2,
              child: ListView(

                scrollDirection: Axis.vertical,

                children: <Widget>[
                  ListTile(
                title: Text("Ses"),
                // Some Code
              ),
               ListTile(
                title: Text("Ses"),
                // Some Code
              ),
               ListTile(
                title: Text("Ses"),
                // Some Code
              ),
               ListTile(
                title: Text("Ses"),
                // Some Code
              ),
               ListTile(
                title: Text("Ses"),
                // Some Code
              ),
               ListTile(
                title: Text("Ses"),
                // Some Code
              ),
               ListTile(
                title: Text("Ses"),
                // Some Code
              ),
               ListTile(
                title: Text("Ses"),
                // Some Code
              ),
                ],
              ),
            )
          ],
        ),
      ),
    );
  }

A: I use this code to pin DrawerHeader on top with fixed height and make list to fill rest of space below.
final drawer = Drawer(
    child: Column(
        mainAxisAlignment: MainAxisAlignment.start,
        crossAxisAlignment: CrossAxisAlignment.stretch,
        children: [
      Container(
          height: 200,
          child: DrawerHeader(
              decoration: BoxDecoration(color: Colors.blue),
              child: Text('Right Drawer Header',
                  style: TextStyle(color: Colors.white, fontSize: 24)))),
      Expanded(
          child: ListView(padding: EdgeInsets.zero, children: [
        ListTile(leading: Icon(Icons.message), title: Text('Message')),
        ListTile(
            leading: Icon(Icons.account_circle), title: Text('Profile')),
        ListTile(leading: Icon(Icons.settings), title: Text('Settings')),
      ]))
    ]));


text:
Q: Crash reading list suggestions in image processing I develop classification and optimization algorithms for living, but have no experience in image processing. Tomorrow (in 12 hours from now) I have a technical job interview in a company that does image analysis (abnormality detection in scanned patterns).
What would you suggest me to read before such an interview? (Please spare the obvious tips such as "you can't learn this in 12 hours", "be yourself", etc)

A: Russ' image processing handbook is a good start and can easily be skimmed.

A: Regardless if you have Matlab or not, its documentation is excellent, so you could skim through the imaging toolbox documentation which provide ample demos and examples.
For a book, you could look at Digital Image Processing by Gonzales.


text:
Q: Backbone Collection.fetch() strange behaviour Using backbone JS library to build pages.
I have a collection, view and router.
And the goal is to list all the entries of the collection in the page.
The collection
window.Artifact = Backbone.Model.extend({
    urlRoot:"/rest/artifacts",

    initialize:function(){
      this.artifacts = new ArtifactCollection();
    }
});

window.ArtifactCollection = Backbone.Collection.extend({

     model:Artifact,
     url:"/rest/artifacts"

});

var artifacts = new ArtifactCollection;

The view
window.findView = Backbone.View.extend({

    initialize:function () {
       console.log('Initializing Find View');
       this.template = _.template(tpl.get('find'));
    },

    render:function (eventName) {

    var data = { 'data' : artifacts.models };
            $(this.el).html(this.template( data ));
            return this;
    }
});

The router program
var AppRouter = Backbone.Router.extend({

routes:{
    "":"home",
    "contact":"contact",
    "get":"get",
    "find":"find",
    "requests/:id":"requests"
},

find:function(){

    artifacts.fetch( {
        success:function(){
            this.findView = new findView( );
            this.findView.render();
            $('#content' ).html( this.findView.el );
        }
    });
},

The problem is, it works most of the time, but doesn't work sometimes.
It throws the following exception
Uncaught TypeError: object is not a function
artifacts.fetch.successmain.js:53
_.extend.fetch.options.successbackbone-0.9.2.js:760
jQuery.Callbacks.firejquery.js:1032
jQuery.Callbacks.self.fireWithjquery.js:1150
donejquery.js:7385
jQuery.ajaxTransport.send.callback

Anyone has seen this type of problem before?

A:
I renamed the this.findView to this.find in this snippet of code in the Router. artifacts.fetch( { success:function(){ this.find = new findView( ); this.find.render(); $('#content' ).html( this.find.el ); } }); Now everything works. Can someone explain what is the significance of this change?

I'm not positive, but I'm guessing that in your success function, this is a reference to window, and when you had this.findView = new findView();, you were overwriting window.findView, resulting in the "Uncaught TypeError: object is not a function" when the success function runs again and tries to call new findView().


text:
Q: or operator in mongodb I have some data like this :
db.movies.insert([
    {
        title : "Fight Club",
        writer : "Chuck Palahniuk",
        year : 1999,
        actors : [
          "Brad Pitt",
          "Edward Norton",
        ]
    },
    {
        title : "Pulp Fiction",
        writer : "Quentin Tarantino",
        year : 1994,
        actors : [
          "John Travolta",
          "Uma Thurman",
        ]
    },
    {
        title : "Inglorious Basterds",
        writer : "Quentin Tarantino",
        year : 2009,
        actors : [
          "Brad Pitt",
          "Diane Kruger",
          "Eli Roth",
        ]
    },
    {
        title : "The Hobbit: An Unexpected Journey",
        writer : "J.R.R. Tolkein",
        year : 2012,
        franchise : "The Hobbit",
    },
    {
        title : "The Hobbit: The Desolation of Smaug",
        writer : "J.R.R. Tolkein",
        year : 2013,
        franchise : "The Hobbit",
    },
    {
        title : "The Hobbit: The Battle of the Five Armies",
        writer : "J.R.R. Tolkein",
        year : 2012,
        franchise : "The Hobbit",
        synopsis : "Bilbo and Company are forced to engage in a war against an array of combatants and keep the Lonely Mountain from falling into the hands of a rising darkness.",
    },
    {
        title : "Pee Wee Herman's Big Adventure"
    },
    {
        title : "Avatar"
    }
])

I need to get all movies released before the year 2000 or after 2010, So I'm writing this query:
db.movies.find( {$or: [{"year" : {$gt:2010,$lt:2000}}]})

But I'm not getting any output. Please suggest.

A: To insert multiple data use db.movies.insertMany([]) option.
to achieve this you can try it like this
db.movies.find({ $or: [{ "year": { $gt: 2010 } }, { "year": { $gt: 2000 } }] })

you can check this for proper documentation here
https://docs.mongodb.com/manual/reference/operator/query/or/


text:
Q: How do I reindex just one element with Tire and elasticsearch? I can't seem to figure out how to edit indexed element. Google doesn't give me an answer either. So, I'm not sure if it's possible at all? What I have done before is just to reindex the whole thing, but as the data grows it becomes slower and slower. How do I reindex just one element after it's been edited.
Here's what I'm doing right now.
def add_ele(ele)

    Tire.index ELE_INDEX do
        store :id => ele.ele_id, :title => ele.title, :tags => ele.tags, :itunes_description => ele.itunes_description

        refresh
    end
end

def delete_ele_index
    Tire.index ELE_INDEX do
        delete
    end
end

So I just delete the whole index and loop through all the elements in the database to add them back again. Thanks very much for the help.

A: For future reference, here a complete example of how to use update
require 'tire'
require 'yajl/json_gem'

Tire.index 'articles' do
  delete
  create

  articles = [
    { :id => '1', :type => 'article', :title => 'one',   :tags => ['ruby']           },
    { :id => '2', :type => 'article', :title => 'two',   :tags => ['ruby', 'python'] },
    { :id => '3', :type => 'article', :title => 'three', :tags => ['java']           },
    { :id => '4', :type => 'article', :title => 'four',  :tags => ['ruby', 'php']    }
  ]

  Tire.index 'articles' do
    import articles
  end

  refresh

  Tire.index 'articles' do
    update 'article', 1, :doc => { :title => 'tone' }
  end

  refresh

  s = Tire.search 'articles' do
    query do
      string 'title:T*'
    end

    filter :terms, :tags => ['ruby']

    sort { by :title, 'desc' }
  end

  s.results.each do |document|
    puts "* #{ document.title } [tags: #{document.tags.join(', ')}]"
  end
end

gives

* two [tags: ruby, python]
* tone [tags: ruby]

A: You don't need to delete the index - if you store a document with the same id a second time, it will update the existing one.
There is also the update api, which saves you from having to compute & transfer the whole document if you just want to change a few fields. In its simplest form you just pass a hash containing the attributes to update, for example:
update type, id, :doc => {:title => 'new title'}


text:
Q: how can i Integration all texts from a column in a form to a textBox Microsoft Access VBA ms-access how can i Integration all texts from a column in a form to a textBox ?
this code can add all text from table to textbox in form
Set db = CurrentDb
Set rs = db.OpenRecordset("names")
For i = 1 To rs.RecordCount

text1.SetFocus
text1.Text = text1.Text & " " & rs(1)

rs.MoveNext

Next i

is it any way to add all text from Fields in form in to textbox in same form?

A: Loop through all the controls in the form and put it in a string variable (or a textbox).
Dim cControl As Control
Dim sNames As String
sNames = ""
For Each cControl In Me.Controls
    If TypeName(cControl) = "TextBox" Then
        sNames = sNames + " " + cControl
    End If
Next cControl

A: Replace your sub com1_Click with following block. Hope this helps . . .
Private Sub com1_Click()
    Dim db As DAO.Database
    Dim rs As DAO.Recordset
    Dim strNames As String
    Dim strSQL As String

    ' Following line gets the query of the form
    strSQL = Me.RecordSource
    ' Alternatively, you can replace this line with your own select query
    ' For eg.
    ' strSQL = "Select * from Table1 Where [_ID] In (1,2)"

    Set db = CurrentDb
    Set rs = db.OpenRecordset(strSQL)

    strNames = ""

    'Following loop is for going through all the records
    While Not rs.EOF
        'Following line is for collecting values of Name1 Field of your table
        strNames = strNames & " " & rs("Name1")
        rs.MoveNext
    Wend

    ' Populating the textbox with values collected from your table
    text3 = Trim(strNames)

    ' Final cleanup
    rs.Close
    Set rs = Nothing
    Set db = Nothing
End Sub


text:
Q: Android icon in navigation bar How can I do something like this in android studio:

I would like to have a Navigation bar where you can see the name, the icon and also the oppurtinity to open a navigation drawer :D
(The picture was made in Figma)

A: set gravity to end in your NavigationView inside DrawerLayout.And add custom view to your toolbar.
<DrawerLayout ...>
  <Content>
  <Toolbar>
     <LinearLayout
        android:orientation="horizontal">
        <!-- Here goes the Image -->
        <ImageView .../>
        <!--Here goes the title -->
        <TextView ...
           android:gravity="center"/>
    </LinearLayout>
  </Toolbar>
   <MainContent .../>
  </Content>
  <NavigationView
    android:layout_gravity="end"
    .../>
</DrawerLayout>

This should get you started.


text:
Q: Синхронизация данных между сервисами Пишу на rust сервис на actix-web, который маштабируется до 4 запущенных экземпляров. Сервис находится за балансиром. Есть проблема в синхронизации данных на этих серверах. Данные получаются с БД каждым экземпляром каждые 10 минут и кешируются в памяти, постоянно делать запросы в БД по запросу клиента не представляется возможным, так как данные выбираются долго и общий их размер 30+ МБ.
Пример:

*

*Клиент отправляет запрос и получает данные с первого сервера

*Клиент снова отправляет запрос с данными полученными от первого сервера, но запрос падает на второй сервер, где данные еще не актуализированы, и следовательно он не в курсе, что за данные ему прислал клиент. По итогу запрос либо падает, либо происходит UB.

Вопрос, можно ли как-то наладить синхронизацию данных, чтобы на обоих серверах всегда были одни и те же данные в один момент времени?


text:
Q: Entity Framework 4.1 with Many-To-Many Update Yields Error Of "An entity object cannot be referenced by multiple instances of IEntityChangeTracker" My domain model uses EntityFramework 4.1 (and I'm using code-first) to update my DB with linked entities.  I have a Member table and then a many-to-many MemberPositions table.  The problem is that when I attempt to perform an update on a member with changed permissions, the code throws a run-time error of "An entity object cannot be referenced by multiple instances of IEntityChangeTracker" when I set the following from my repository class:

_context.Entry(entity).State = EntityState.Modified

Now I have read the posts at the following links, but they look outdated and some of the code doesn't work in EF 4.1 / MVC3:

*

*ADO.Net Entity Framework An entity object cannot be referenced by multiple instances of IEntityChangeTracker

*http://samscode.com/index.php/2009/12/making-entity-framework-v1-work-part-1-datacontext-lifetime-management/
So my questions are:

*

*What do I need to do to get this code working for EF 4.1 and MVC 3 (e.g. HttpContext.Current["myDBEntities"] can't be indexed using today's framework)

*More importantly, where would  this code need to reside?  I can't seem to figure out where to put the "datacontext per user per request" method or class as described in the first link.  It doesn't make sense in my domain project, because it does't have access to the the HttpContext, so if it's in my web project, how should I pass it to the domain?

To help you, below is a stripped down version of my domain model:
public class Entity
{
  public int Id { get; set; }
}

public class Member : Entity
{
  public string Name { get; set; }
  public virtual List<MemberPosition> Positions { get; set; }
}

public class MemberPosition : Entity
{
  public string Name { get; set; }
}

public class EfDbContext : DbContext
{
  public DbSet<Member> Members { get; set; }
  public DbSet<MemberPosition> MemberPositions { get; set; }
  protected override void OnModelCreating(DbModelBuilder modelBuilder)
  {
    modelBuilder.Configurations.Add(new MemberMap());
    modelBuilder.Configurations.Add(new MemberPositionMap());
  }
}

public class MemberMap : EntityTypeConfiguration<Member>
{
  public MemberMap()
  {
    ToTable("Members");
    HasMany(m => m.Positions).WithMany().Map(
      m => m.ToTable("Member_MemberPositions").MapLeftKey("MemberId").MapRightKey("PositionId"));
  }
}

public class MemberPositionMap : EntityTypeConfiguration<MemberPosition>
{
  public MemberPositionMap()
  {
    ToTable("MemberPositions");
    Property(x => x.Name).IsRequired().HasMaxLength(100);
  }
}

public interface IRepository<TEntity>
{
  bool Update(TEntity entity);
}

public class Repository<TEntity> : IRepository<TEntity> where TEntity : Entity
{
  private readonly EfDbContext _context;
  private readonly DbSet<TEntity> _dbSet;

  public Repository(EfDbContext context)
  {
    _context = context;
    _dbSet = _context.Set<TEntity>();
  }

  public bool Update(TEntity entity)
  {
    _context.Entry(entity).State = EntityState.Modified;
    _context.SaveChanges();
    return true;
  }
}

And, finally, a stripped down version of the Edit method in my MemberController:
public class MemberController : Controller
{
  [HttpPost]
  public ActionResult Edit(MemberDetailViewModel memberDetailViewModel)
  {
    if (ModelState.IsValid)
    {
      var updatedMember = // Gets the member data from the view model...
      var memberRepository = // Creates a Repository<Member>;
      memberRepository.Update(updatedMember);
      return // blah... blah... blah...
    }
  }
}

Any suggestions are appreciated!
EDIT: THIS IS THE SOLUTION (IT'S EASY!)
In the App_Start.NinjectMVC3 controller, use the following code (make sure that InRequestScope) is present.  In my original code, it wasn't, hence it wasn't working...
private static void RegisterServices(IKernel kernel)
{
  kernel.Bind(typeof(IRepository<>)).To(typeof(Repository<>)).InRequestScope();
}

A: As Slauma stated (and as included in my original post as an edit), here's the solution.
In the App_Start.NinjectMVC3 controller, use the following code (make sure that InRequestScope) is present.  In my original code, it wasn't, hence it wasn't working...
private static void RegisterServices(IKernel kernel)
{
  kernel.Bind(typeof(IRepository<>)).To(typeof(Repository<>)).InRequestScope();
}


text:
Q: What is a quasi-isomorphism of two crossed modules Could you tell me how are two crossed modules quasi-isomorphic.
And I have known a result:
Let $\mu: M \rightarrow G$ and $\mu': M' \rightarrow G'$ are isomorphic, then the integral homology of them are the same.
How to prove this result?
Could you show me related materials?
Thanks,

A: Even if David Roberts is right, I'll give an answer; more details my be found in the book
R. Brown, P.J. Higgins, R. Sivera,  Nonabelian algebraic
topology: filtered spaces, crossed complexes, cubical homotopy
groupoids, EMS Tracts in Mathematics Vol. 15, 703 pages. (August
2011).
of which a pdf may be downloaded from
http://pages.bangor.ac.uk/~mas010/nonab-a-t.html
Any crossed module $\mu: M \to P$ has a classifying space $X=B(\mu)$ whose homotopy groups are 0 above dimension 2 and in dimensions 1 and 2 are respectively Coker $\mu$ and Ker $\mu$. A morphism $f$ of crossed modules is a weak equivalence  iff the induced map of classifying spaces is a weak equivalence. The homology of a crossed module is defined as the homology of its classifying space.  The result asked for is easily obtained by passing to universal covers.
For more information see also
{Ellis, Graham J.},
     TITLE = {Homology of {$2$}-types},
   JOURNAL = {J. London Math. Soc. (2)},
    VOLUME = {46},
      YEAR = {1992},
    NUMBER = {1},
     PAGES = {1--27},
and the subsequent correction.