text:
Q: Compare the result of a date function with a date literal in a WHERE clause The below query is not working:
SELECT Id
FROM OrderItem
WHERE CALENDAR_MONTH(Order.EffectiveDate) = THIS_MONTH
AND CALENDAR_YEAR(Order.EffectiveDate) = THIS_YEAR

I am getting the following error message:

INVALID_FIELD: WHERE CALENDAR_MONTH(Order.EffectiveDate) = THIS_MONTH
  ^ ERROR at Row:3:Column:22 value of filter criterion for expression
  CALENDAR_MONTH(EffectiveDate) must be of type integer and should not
  be enclosed in quotes

What am I doing wrong?

A: You can do either:
CALENDAR_MONTH(Field__c) = 7

or:
Field__c = THIS_MONTH

You want the latter.

A: To add to Adrian's answer, the documentation explains that:

You can't compare the result of a date function with a date literal in
  a WHERE clause. The following query doesn't work:

SELECT CreatedDate, Amount
FROM Opportunity
WHERE CALENDAR_YEAR(CreatedDate) = THIS_YEAR

hence the need for a workaround where you have to add a field containing the month.

A: Please explore Date Functions for SOQL. CALENDAR_MONTH() returns a value of the Integer type, whereas THIS_MONTH (see Date Formats and Date Literals) is a String literal.
So basically what you get in the runtime for CALENDAR_MONTH(Order.EffectiveDate) = THIS_MONTH is (don't mind the actual values, they are for the example's sake only):
7 = '2005-10-08T01:02:03Z'

So you need to follow Adrian's advice.

A: CALENDAR_MONTH/CALENDA_YEAR returns a number. Here, you are trying to compare a number to a date, that is why, it throws an error.


text:
Q: Node.js/Express - Ajax calls from local/external- network I have a express instance listening on 3000.
A Http-server listening on 8080 and cors-proxy running on 1337 relaying info between them.
(npm http-server and npm cors-proxy, both installed globaly)
I can access the website from both local- and external-networks, but none of the ajax calls goes through. There are no POST/GET requests on the http-server when I launch the AJAX calls either.
Error from local network:
net::ERR_CONNECTION_REFUSED

Error from external network:
No 'Access-Control-Allow-Origin' header ....

My AJAX post request:
$.ajax({
            method: "POST",
            //url: "http://localhost:1337/localhost:3000/name/"+inputText,
            url: "http://192.168.10.50:1337/192.168.10.50:3000/name/"+inputText,
            data: {"data": "Hello world"},
            success: (data) => {
                console.log("Success" + data);
            };
});

I've tried to add code in my node file to allow this:
app.use(function(req, res, next){
    res.header('Access-Control-Allow-Origin', "*");
    res.header('Access-Control-Allow-Methods', 'GET, POST');
    red.header('Access-Control-Allow-Headers', 'Content-Type');
    next();
})

But nothing changes.
How can I tell the http-server to let requests pass though from local and external networks?

redpajama_set_name: RedPajamaStackExchange


text:
Q: python virtualenv activation in bashrc causes environment variables to be overwritten I have a virtual environment which I usually activate by default in my bashrc via source ~/.venv/env/bin/activate. This has been working fine on an old MacBook Air and Linux Desktops and servers (I use the same bashrc with some different conditional blocks for each  machine)
I just got a new MacBook and I was setting everything up and I found that when calling the activate command above, my $PATH environment variable gets overwritten which messes up everything that was added to it before. The only line I can see in activate which modifies the path is below, but I cannot see why it would be overwriting it. Any ideas?
_OLD_VIRTUAL_PATH="$PATH"
PATH="$VIRTUAL_ENV/bin:$PATH"
export PATH


text:
Q: Joomla article use template override Hello! I've many joomla templates which use component overrides.
For some articles, I use the default template, and for others I use other template with "?template=zzz". How can I use other override from template "zzz" than the default from "zzz" override.
Example: I have an article: "Lorem Ipsum", and I want to assign him, the template named "zzz" (!!! "ZZZ" IS NOT THE DEFAULT TEMPLATE of website, and is not assigned to menu !!!), then I put on article url "?template=zzz". Now "Lorem Ipsum" uses the template named "zzz". In "zzz" template folder, I've more overrides for com_content->article (default.php, myskinarticle.php, otherskin.php etc) and I want to use for "Lorem Ipsum" article, the override from ZZZ (which is not the default template, and it isn't assigned to menu), named "otherskin". I think that is like "?template=zzz&override=otherskin".
How can I do this?

A: I think you need to use the 'layout' parameter:
http://docs.joomla.org/Component_Views_and_Templates
So, your example might be ?template=zzz&layout=otherskin
EDIT:
Another approch would be to create a plugin that switched the content (depending on a parameter in your url) to show the desired template.
Have a look at:
http://docs.joomla.org/Plugin/Events/Content#onBeforeDisplay
This would allow you to hook into the content before display.
You would then be able to access the JFactory::getDocument() method to set the template programatically, using something like:
$doc=&JFactory::getDocument();
$doc->setTemplate("my_template_name");

Good luck!


text:
Q: Avoid repeated binding of Events for dynamically added DOM elements? In ready function I have a click function binding
$(function(){
   $(".classClick").click(function(){
     alert("Clicked");
   });
   $(selector).append("
Hello
");//Added after binding

});

The dynamic click event won't trigger because there was no such element while binding the div. I want't to trigger the event for all elements with classClick class (dynamic or not). How can I do this?
Update : Also,
I found it difficult to identify the function that executed the click event (from a large set of code). How can I adopt a better architecture, so that I can find out which function will be executed?

A: Try this:
$(function(){
    $('body').on('click', ".classClick", function() {
        alert("Clicked");
    });
    $(selector).append('
Hello
');//Added after binding

});

Update
If I understand your second statement, you are having trouble with code organization due to the bloaty/spaghetti nature of jQuery.
I suppose a way which would improve readability would be to dynamically create the object with the event reference in it to allow for easier readability, for example:
$(function() {

    var functionToCall = function() {
        alert('clicked');
    };

    $('
')
        .prop('id', 'dynamic')
        .text('Hello')
        .click(function() {
            functionToCall(); // This gives a little more visibility to what's happening on-click
        })
        .appendTo(selector);
});


text:
Q: convert a callback function to RxJS I want to convert a piece of code from NodeJS Callback to RxJS but I am not sure I did it in the right way or not. I am keeping getting error.
Original code:
function signup(poolData, body) {
const { username, password, attributes } = body;
  userPool.signUp(username, password, attributes, null, (err, res) => {
    if (err) return cb(err);

    const cognitoUser = res.user;
    const data = {
      username: cognitoUser.getUsername(),
    };
    cb(null, data);
  });
}

Converted to RxJS:
function signup(poolData, body) {
    const { username, password, attributes } = body;
     return Observable.create( observer =>{
        let output = (err, res)=>{
          if(err) throw err;

          const cognitoUser = res.user;
          const data = {
            username: cognitoUser.getUsername(),
          };
          observer.next(data);
        }
        userPool.signUp(username, password, attributesList, null, output);
    });
}

I am calling my signup RxJS like this:
let observable = signup(poolData, params);
        observable
        .catch(err => print(`Error caught: ${err}`))
        .subscribe(val => print(val));

Can you advise me that did I convert the code correctly?
at the moment I receive the error that "TypeError: observable.catch is not a function".

A: let observable = signup(poolData, params);
observable.subscribe(val => print(val), err => print(`Error caught: ${err}`));

Subscribe method either takes a partial observer object ( Object with next, error, complete methods [ Observer interface ]) or three optional params as callbacks being next, error and complete functions in order.
next: Handler for each delivered value
error: Handler for an error notification
complete: Handler for completion of observable execution


text:
Q: Create multiple fields on input I am trying to create multiple fields when I enter a number to tell it how many to create... I have utilised some code that I have written previously but now it's no longer working.
HTML:
<input type="text" name="rows">

jQuery:
$(document).ready(function() {
    $('#rows').change(function() {
    var rows = $(this).val();

    for(i=0;i<=rows;i++) {
            $('#form').append('
<input type="text" name="N' + i + '">
');
        $('#form').append('
<select name="S'+ i +'"><option value="Text">Text</option><option value="editor">Editor</option></select>
');
        $('#form').append('
<input type="text" name="V' + i + '">
');
    }
  }
}

Fiddle: https://jsfiddle.net/dc5665xk/1/

A: *

*ID attribute is missing for rows element.

*There is no form element having form as ID

*Syntax error as closing braces were missing.
Note: var keyword was missing in for-loop

$(document).ready(function() {
  $('#rows').change(function() {
    var rows = $(this).val();
    for (var i = 0; i <= rows; i++) {
      $('#form').append('
<input type="text" name="N' + i + '">
');
      $('#form').append('
<select name="S' + i + '"><option value="Text">Text</option><option value="editor">Editor</option></select>
');
      $('#form').append('
<input type="text" name="V' + i + '">
');
    }
  });
});

<form id="form">
  <input type="text" name="rows" id="rows">
</form>


text:
Q: Uniqueness of tensor product The uniqueness property of tensor product $M ⊗ N$ of two $A-$modules $M$ and $N$ specifies the following:
for sake of simplicity we will write $M⊗N$ as $T$.
A tensor product of $M$ and $N$ is pair $(T,g)$ where $T$ is an $A-$module and $g:M × N → T$ is a bilinear map such that any bilinear map $f:M × N → P$ factors through an $A-$module homomorphism $h$ such that $f = h \circ g$.
uniqueness says that if you have another pair $( T',g' )$  then $∃  \  j: T \to T' $ an isomorphism s.t $g' = j \circ g$.
While proving this,
we use the factoring property of tensor product for both $(T,g)$ and $(T' , g')$ to get maps $j$ and $j'$ s.t   $g' = j \circ g$ and $g = j' \circ g'$.
Now to show $j$ is an $A-$module isomorphism,  since $g' = j \circ g ⇒ g' = j \circ (j' \circ g') ⇒ g' = (j \circ j') \circ g'$ ,hence  $j \circ j' =Id_{T'}$ and similarly,  $j' \circ j = Id_{T}$, hence $j$ is an isomorphism.
my problem is with this statement  $g' =  j \circ (j' \circ g') ⇒ g' = (j \circ j') \circ g'$
how can we change the order of brackets when $g'$ is a bilinear map , $j  ∈ End_A(T,T')$ , $j' ∈ End_A(T' , T)$ and we do not know if associativity is valid for whatever algebraic object(if any) these together live in.

A: The composition of three functions is always an associative operation. It doesn't have anything to do with additional algebraic structure.
You can prove it independently of any algebraic structure:
Given $W\xrightarrow{h}X \xrightarrow{g}Y\xrightarrow{f}Z$, then $(f\circ g)\circ h=f\circ( g\circ h)$
In our case it's just
$M\times N\xrightarrow{g'}T' \xrightarrow{j'}T\xrightarrow{j}T'$


text:
Q: How I set the WSL-Ubuntu 20.04 to support my text in Farsi(Persian)? I have WSL2 - Ubuntu 20.04 installed on my computer. Currently, I need it to show the characters in Persian (Farsi), but it does not and displays question marks instead. I have  "fonts-farsiweb/focal,now 0.4.dfsg-12 all [installed]", and "fonts-freefarsi/focal,now 1.0.0~beta1-7 all [installed]" installed on my Ubuntu.
I have tried some of the related suggestions on the internet like installing the fonts, but it didn't work. However, I might be mistaken in figuring out the problem...


text:
Q: showing user detail who has login I am writing a attendance page for internal use. now I encounter a problem which is only shows user detail who has login. could anyone improve the following script?
<?php

$query_RecBoards ="SELECT * FROM `attend` WHERE
`m_username`='".$_SESSION["loginMember"]."' ORDER BY `m_time` DESC";
$RecBoards = mysql_query($query_RecBoards);
$row_RecBoards = mysql_fetch_assoc($RecBoards);

$qry= "SELECT m_name, m_day, time_in, time_out, SEC_TO_TIME(
     CASE WHEN total_sec - 32400 > 0
          THEN total_sec - 32400
          ELSE 0 END) overtime,
   SEC_TO_TIME(
     CASE WHEN total_sec - 32400 < 0
          THEN 32400 - total_sec
          ELSE 0 END) shorttime
  FROM
(
  SELECT m_name, m_day, time_in, time_out,
         TIME_TO_SEC(TIMEDIFF(COALESCE(time_out, '17:30:00'),
                          COALESCE(time_in, '08:30:00'))) total_sec
    FROM
  (
   SELECT m_name, m_day,
       MIN(CASE WHEN m_duty = 'Punchin' THEN m_time END) time_in,
       MIN(CASE WHEN m_duty = 'Punchout' THEN m_time END) time_out
      FROM attend
     GROUP BY m_name, m_day
  ) a
) b";
$result=mysql_query($qry);
?>

Henrik

A: Thanks for your advice, because I am using old version of PHP, that's why I am using old extension.
Finally, I figured out how to display the users who have logged in, but another question is how to display the data every month? any advice?
The improved part of code as following,
 SELECT m_name, m_day,
         MIN(CASE WHEN m_duty = 'punchin' THEN m_time END) time_in,
         MIN(CASE WHEN m_duty = 'punchout' THEN m_time END) time_out
    FROM attend WHERE m_username='".$_SESSION["loginMember"]."'
   GROUP BY m_name, m_day
    )a  LIMIT 0,7

Thanks
Henrik


text:
Q: Different OS Server transferring files is not working on AWS S3 Bucket, It works only if windows to windows I have problem setting up my AWS S3 bucket, the server already running on both two server Linux and Windows. The first the that I do to test if the transferring files is correct. I used the Windows to Windows transfer. the function of my codes is working, then second test Linux to Windows. Right now the transferring is not working. I don't know why its not working, if there is configuration need to do in Linux.
I will share to youthe sample code that I made on laravel.
exec('aws s3 cp s3://compexp/11-11-2019/'01150exp.zip'  \\\\'xxx.xxx.xx'/c/kitpos/update');

When I tried to my Linux AWS terminal it shows look like this:

A: You can Copy files only to local storage, so you need to mount external Windows storage, as a folder to your Linux-filesystem. And only after that copy file.
You can read how to mount Windows folder to Linux here - https://www.poftut.com/how-to-mount-nfs-share-in-linux-and-windows/
But I think this is a bad practice. Why can't you pull files directly from Windows?


text:
Q: Summing by Categorical Variable I have a data set of comic book unit sales by volume (ex. Naruto v10) that I need to reduce to sales by series (so all Naruto volume unit sales would be added together into a single observation).  I have a variable "series" that identifies the series of each observation.  The equivalent code in Stata would be:
by series, sort:replace unitssales=sum(unitssales);
by series, sort:keep if _n==_N

But I'm trying to figure out how to do this in R.  Any help would be much appreciated!  Thanks in advance!

A: Without knowing what format your data is in, I can only suggest you look at the tapply function.  From the help:
> n <- 17; fac <- factor(rep(1:3, length = n), levels = 1:5)
> tapply(1:n, fac, sum)
 1  2  3  4  5
51 57 45 NA NA


text:
Q: Extract GIF frames retaining base canvas size + offsets I am trying to extract GIF frames using ImageMagik convert command. The GIF images are optimized to only overlay animated changes (I believe they call it mipmap) and this is ideal for my extraction due to performance limitations. If I use -coalesce I lose the optimization since I'm using the GIF frames in a spritesheet so I need to extract it as is but when I do extract it with the standard convert xxx.gif xxx.png the animation frames are extracted without offsets and the canvas sizes are different to the base image (0).

I need all the images extracted to match the first frame with retained offsets from the GIF meta-data. I have no idea how to accomplish this in ImageMagik and want to know if this is possible?
Then if I get them matching sizes with offsets applied I can add them to the sprite sheet easily.
Would appreciate all the help I can get! Thanks.

Pro challenge! Do you accept?! :)

A: If you extract to GIF, rather than PNG, it seems fine:
convert animated.gif frame%d.gif

identify frame*
frame0.gif GIF 307x465 307x465+0+0 8-bit sRGB 256c 61.8KB 0.000u 0:00.000
frame1.gif[1] GIF 278x372 307x465+16+61 8-bit sRGB 256c 19.9KB 0.000u 0:00.000
frame10.gif[2] GIF 278x371 307x465+17+62 8-bit sRGB 256c 17.9KB 0.000u 0:00.000
frame11.gif[3] GIF 278x370 307x465+17+63 8-bit sRGB 256c 17.4KB 0.000u 0:00.000
frame12.gif[4] GIF 275x371 307x465+20+62 8-bit sRGB 256c 17.2KB 0.000u 0:00.000
frame13.gif[5] GIF 276x370 307x465+19+63 8-bit sRGB 256c 17.9KB 0.000u 0:00.000
frame14.gif[6] GIF 275x369 307x465+19+64 8-bit sRGB 256c 16.8KB 0.000u 0:00.000

If you want to overlay these onto a blank canvas, you can do it something like this. I haven't thought about it too much and there may be an easier way, but for now...
#!/bin/bash
# Extract individual frames
convert animated.gif frame%d.gif

# Make a blank canvas same size as original
convert -size 307x465 xc:none canvas.gif
i=0
for f in frame*; do
   geom=$(identify -format "%X%Y" $f)
   convert canvas.gif $f -geometry $geom -composite +repage g_$i.gif
   ((i++))
done

Or maybe you mean you want all the frames in their correct relative positions but one after the other in a long sequence in a single file?
#!/bin/bash

# Extract individual frames
convert animated.gif frame%d.gif

# Make a blank canvas same size as original
convert -size 307x465 xc:none canvas.gif

# Paste individual frames onto blank canvas and append frames into long sequence
for f in frame*; do
   geom=$(identify -format "%X%Y" $f)
   convert canvas.gif $f -geometry $geom -composite +repage miff:-
done | convert - +append sequence.gif


text:
Q: How can i solve this problem about 215:Assertion failed? When I finished the coding, 215:Assertion failed happened, and I think there is no wrong code, but I couln't solve it. How could I solve this problem?
import urllib.request as req
url = "http://uta.pw/shodou/img/28/214.png"
req.urlretrieve(url, "test.png")

import cv2
img = cv2.imread("test.png")
print(img)

%matplotlib inline

import matplotlib.pyplot as plt
import cv2
img = cv2.imread("test.jpg")
plt.imshow(cv2.cvtColor(img, cv2.COLOR_BGR2RGB))
plt.show()

Error:
---------------------------------------------------------------------------
error                                     Traceback (most recent call last)
<ipython-input-11-0f580eb5ee11> in <module>
      6 import cv2
      7 img = cv2.imread("test.jpg")
----> 8 plt.imshow(cv2.cvtColor(img, cv2.COLOR_BGR2RGB))
      9 plt.show()

error: OpenCV(4.1.0) C:\projects\opencv-python\opencv\modules\imgproc\src\color.cpp:182: error: (-215:Assertion failed) !_src.empty() in function 'cv::cvtColor'

A: You are getting above error because of below line:
img = cv2.imread("test.jpg")

Your image is actually a PNG file, not JPG file. So, replace above line to img = cv2.imread("test.png").


text:
Q: How to upload a file from WP directory automatically? I would like to upload a CSV file from local ftp to WP directory and import this CSV file from WP directory to mysql database automatically? It is possible?

A: There are a number of plugins used for this like CSV Import for WordPress
and WP CSV to Database - Insert CSV file content into WordPress database


text:
Q: How do you add the top image in the Apple Store? I recently noticed that some apps in the apple store have large image with the logo on their download page. I was just curious on how to do this and would like to implement it with my own apps.
Ex: Tinder & Bumble

A: You cannot add it.
This is possible only if your app is selected by the Apple editorial team to be featured


text:
Q: How to copy the values from the same column into the next columns? Excel VBA I am trying to copy the values from the same range (G8:G1000), and then paste those values to the next column (H8:H1000). However, I then want to copy that same range (G8:G1000) again, but then paste the values into I8:I1000, and do that at least 100 times. Essentially, there is a formula in column G that is producing randomized values, and I want to copy those unique values into all of the columns following column G. I believe I will need some sort of For Next loop, where it keeps selecting the values from G column, and then pasting them to the next column after the previously pasted into column, but I have very little VBA knowledge to figure this out. Does anyone have a potential solution for this? Any help is appreciated.
Thanks.

A: Generate Columns
Option Explicit

Sub generateColumns()

    Const rgAddress As String = "G8:G1000"
    Const cCount As Long = 100

    Dim rg As Range: Set rg = Range(rgAddress)
    'rg.Formula = "=RANDBETWEEN(1,100)"

    Application.ScreenUpdating = False

    Dim c As Long
    For c = 1 To cCount
        rg.Offset(, c).Value = rg.Value
    Next c

    Application.ScreenUpdating = True

End Sub


text:
Q: How to know what this impedance is? So I'm doing experimental work on an unknown impedance.
I used a RLC meter for frequencies of 100, 200, 500, 1k, 2k, 5k, 10k, 20k, 50k and 100k Hz.
Now, I think the values I got for each frequency are not that relevant (tell me if they are and I can post them). What seems important is how they vary:

*

*the absolute value always increases (varies between 404 ohm and 2.57k ohm). The increase rate is greater at mid-frequencies.

*the angle starts positive and close to zero (7 degrees), increases until reaching a maximum of 47 degrees at 2k Hz and then it starts decreasing again until like 1 degree at 100k.

Now my attempt. What elements make my impedance and how are they placed?
The way the phase varies tells me that as frequency tends to zero and infinity, the impedance behaves as resistor.
The magnitude always increases.
The magnitude of the impedance of a resistor is constant
The magnitude of the impedance of a capacitor decreases with frequency. Therefore it's theoretically infinity at zero frequency and zero at infinite frequency.
The magnitude of the impedance of an inductor increases with frequency. Therefore it's theoretically zero at zero frequency and infinity at infinite frequency.
Because the impedance is low (but not that low) at low frequencies, the circuit must be equivalent to a resistor. Same for high frequencies.
I came up with an hypothesis of:
(resistor A in parallel with a capacitor C) in series with (resistor B in parallel with an inductance L). This seems to be the minimum that guarantees the absolute value scheme.
But does it verify with the angle?
Writing the transfer function of this circuit I get.
$$ \frac{R_AR_B + L(R_A+R_B)s + R_AR_BLC s^2}{(1+sCR_A)(1+s\frac{L}{R_2})} $$
Therefore I have 2 real poles and one pair of complex conjugate zeros. Of course without numerical values it is hard to guess if this is correct or not. But I know that the pair of complex conjugate zeros will guarantee me an increase of 180 degrees around the natural frequency and each real pole will guarantee me a -90 degrees fall. I know that the maximum I reach is 47 degrees (so around 45 degrees). Therefore I think my hypothesis can never be correct...
To increase the angle the first frequency to appear needs to be the zeros'one. However since the frequency only increases until 45 degrees and then decreases I need to have components that will get me at least -235 degrees of fall... My 2 poles only guarantee me -180 so it would only work if frequency never dropped. Therefore I'm stuck. Do I need more poles in my system? What components can I had to guarantee me that? Thanks in advance!

A: Your hypothetical model is more complex than the data calls for. It sounds kind of like an RIAA equalization filter, which is just two resistors in series, with a capacitor in parallel with one of them. At very low frequencies, you see just the two resistors in series. At very high frequencies, you see only the resistor that isn't shunted by the capacitor. In between, you see an "S" curve whose exact shape depends on the relative values of the resistors and the capacitor.
Since your circuit has an impedance that rises with frequency, change the capacitor to an inductor.


text:
Q: How do I remove duplicate files in a folder in windows? Suppose I have two files with same name but different file sizes. Each file has two copies. One with size x. and its copy with size y. where x>y
There are two copies of each file. One with x MB. And other with y MB, where x > y.
File a.extension 2 MB (Same name same file type)
File a.extension 1 MB (Same name same file type)

I want to keep the file with larger file size. Since there are more than 100 files, I cannot do it manually.
I would like to accomplish this with a batch script.


text:
Q: Home tab setting in salesforce for a profile How to enable home tab setting to default on for a particular profile? I am not able to edit from object setting in profile.

A: Home tab settings are 'Default On' (read-only) under 'Tab Settings' on profile.
Follow the below steps to restore the Home tab to your profile
In Lightning Experience UI:

*

*Click on Setup | Users | User Management Settings |
a) Disable Enhanced Profile User Interface.
b) Click on Save.
In Classic UI:

*

*Click on Setup | Manage Users | User Management Settings |
a) Disable Enhanced Profile User Interface.
b) Click on Save.

*Enable Overwrite users personal tab customization
a) Go to Setup | Manage Users | Profiles
b) Click on Edit on affected Profile
c) Go to Tab Settings
d) Check the box for Overwrite Users Personal tab Customization
c) Click on Save.
Check more details here
Thanks


text:
Q: promise resolution with a mocked service within the tested service My question: In Karma, I am mocking an injected service while testing the actual service.  The mocked service gets some data, and sends back a promise.  I can't figure out what I am doing wrong.
I know there are a number of issues with the actual "Login" mechanism, but I am using it to illustrate this Karma question.  I do not plan to use it as production code.  (However, any suggestions for a better illustration of the problem are welcome!)
First, I wrote this in a generic .js file, and said "node testcode.js"
testcode.js:
function Login(name,password,callback){
    setTimeout(function(){
        var response;
        var promise = getByUserName();
        promise.then(successCb);

        function successCb(userObj){
            if ( userObj != null && userObj.password === password ) {
                response = { success : true };
            } else {
                response = { success: false, message: 'Username or password is incorrect' };
            }
            callback(response);
        };
    },200);
}

function getByUserName(){
    return Promise.resolve(user);
}

var user = {
    username : 'test',
    id : 'testId',
    password : 'test'
};

var test = undefined;
Login(user.username,user.password,testCb);

function testCb(response){
    test = response;
    console.log("Final: " + JSON.stringify(test));
}

This gives me my expected result:
Final: {"success":true}

Now, I try to repeat this in Karma...
TestService:
(function(){
    "use strict";

    angular.module('TestModule').service('TestService',TestService);
    TestService.$inject = ['$http','$cookieStore','$rootScope','$timeout','RealService'];
})();

    function TestService($http,$cookieStore,$rootScope,$timeout,RealService){
        var service = {};
        service.Login = Login;
        /* more stuff */
        return service;

        function Login(username,password,callback){
            $timeout(function () {
                var response;
                var promise = UserService.GetByUsername(username);
                promise.then(successCb);

                function successCb(user){
                    if (user !== null && user.password === password) {
                        response = { success: true };
                    } else {
                        response = { success: false, message: 'Username or password is incorrect' };
                    }
                    callback(response);
                };
            }, 1000);
        }
    }

My Karma-Jasmine Test:
describe('TestModule',function(){
    beforeEach(module('TestModule'));

    describe('TestService',function(){

        var service,$rootScope,
        user = {
            username : 'test',
            id : 'testId',
            password : 'test'
        };

        function MockService() {
            return {
                GetByUsername : function() {
                    return Promise.resolve(user);
                }
            };
        };

        beforeEach(function(){
            module(function($provide){
                $provide.service('RealService',MockService);
            });

            inject(['$rootScope','TestService',
                function($rs,ts){
                    $rootScope = $rs;
                    service = ts;
                }]);
        });

        /**
         * ERROR: To the best of my knowledge, this should not pass
         */
        it('should Login',function(){
            expect(service).toBeDefined();

            var answer = {"success":true};
            service.Login(user.username,user.password,testCb);

            //$rootScope.$apply(); <-- DID NOTHING -->
            //$rootScope.$digest(); <-- DID NOTHING -->

            function testCb(response){
                console.log("I'm never called");
                expect(response.success).toBe(false);
                expect(true).toBe(false);
            };
        });
    });

});

Why is the promise not being resolved?  I have tried messing with $rootScope.$digest() based on similar questions I have read on SO, but nothing seems to get testCb to be called.

A: Somebody let me know if I can give 'estus' the credit for this answer.
The magic is in the $timeout angular mock service:
https://docs.angularjs.org/api/ngMock/service/$timeout
and the $q service:
https://docs.angularjs.org/api/ng/service/$q
I updated two things.  First, my MockUserService is using $q.defer instead of native promise.  As 'estus' stated, $q promises are synchronous, which matters in a karma-jasmine test.
    function MockUserService(){
        return {
            GetByUsername : function(unusedVariable){
                //The infamous Deferred antipattern:
                //var defer = $q.defer();
                //defer.resolve(user);
                //return defer.promise;
                return $q.resolve(user);
            }
        };
    };

The next update I made is with the $timeout service:
    it('should Login',function(){
        expect(service).toBeDefined();

        service.Login(user.username,user.password,testCb);
        $timeout.flush(); <-- NEW, forces the $timeout in TestService to execute -->
        $timeout.verifyNoPendingTasks(); <-- NEW -->

        function testCb(response) {
            expect(response.success).toBe(true);
        };
    });

Finally, because I'm using $q and $timeout in my test, I had to update my inject method in my beforeEach:
    inject([
        '$q','$rootScope','$timeout','TestService',
        function(_$q_,$rs,$to,ts) {
            $q = _$q_;
            $rootScope = $rs;
            $timeout = $to;
            service = ts;
        }
    ]);


text:
Q: If I need to use a piece of memory throughout the lifespan of my program, is it really necessary to free it right before program termination? In many books and tutorials, I've heard the practice of memory management stressed and felt that some mysterious and terrible things would happen if I didn't free memory after I'm done using it.
I can't speak for other systems (although to me it's reasonable to assume that they adopt a similar practice), but at least on Windows, the Kernel is basically guaranteed to cleanup most resources (with the exception of an odd few) used by a program after program termination. Which includes heap memory, among various other things.
I understand why you would want to close a file after you're done using it in order to make it available to the user or why you would want to disconnect a socket connected to a server in order to save bandwidth, but it seems silly to have to micromanage ALL your memory used by your program.
Now, I agree that this question is broad since how you should handle your memory is based on how much memory you need and when you need it, so I will narrow the scope of this question to this: If I need to use a piece of memory throughout the lifespan of my program, is it really necessary to free it right before program termination?
Edit:
The question suggested as a duplicate was specific to the Unix family of operating systems. Its top answer even specified a tool specific to Linux (e.g. Valgrind). This question is meant to cover most "normal" non-embedded operating systems and why it is or isn't a good practice to free memory that is needed throughout the lifespan of a program.

A: You could use a language with garbage collection (such as Scheme, Ocaml, Haskell, Common Lisp, and even Java, Scala, Clojure).
(In most GC-ed languages, there is no way to explicitly and manually free memory! Sometimes, some values might be finalized, e.g. the GC and the runtime system would close a file handle value when that value is unreachable; but this is not sure, unreliable, and you should instead close explicitly your file handles, since finalization is never guaranteed)
You could also, for your program coded in C (or even C++) use Boehm's conservative garbage collector. You would then replace all your malloc with GC_malloc  and not bother about free-ing any pointer. Of course you need to understand the pros and conses of using Boehm's GC. Read also the GC handbook.
Memory management is a global property of a program. In some way it (and the liveness of some given data) is non-compositional and non-modular, since a whole program property.
At last, as others pointed out, explicitly free-ing your heap allocated C memory zone is good practice. For a toy program not allocating a lot of memory, you could even decide to not free memory at all (since when the process has ended, its resources, including its virtual address space, would be freed by the operating system).

If I need to use a piece of memory throughout the lifespan of my program, is it really necessary to free it right before program termination?

No, you don't need to do that. And many real world programs don't bother freeing some memory which is needed on the entire lifespan (in particular the GCC compiler is not freeing some of its memory). However, when you do that (e.g. you don't bother free-ing some particular piece of C dynamically allocated data), you'll better comment that fact to ease the work of future programmers on the same project. I tend to recommend that the amount of unfreed memory stays bounded, and usually relatively small w.r.t. to total used heap memory.
Notice that the system free often does not release memory to the OS (e.g. by calling munmap(2) on POSIX systems) but usually mark a memory zone as reusable by future malloc. In particular, the virtual address space (e.g. as seen thru /proc/self/maps on Linux, see proc(5)....) might not shrink after free (hence utilities like ps or top are reporting the same amount of used memory for your process).

A: It is not necessary, as in you will not fail to execute your program properly if you fail to.  However, there are reasons you may choose to, if given a chance.
One of the most powerful cases I run into (over and over) is that someone writes a small piece of simulation code that runs in their executable.  They say "we'd like this code to be integrated into the simulation."  I then ask them how they plan to re-initialize between monte-carlo runs, and they look at me blankly.  "What do you mean re-initialize?  You just run the program with new settings?"
Sometimes a clean cleanup makes it much easier for your software to be used.  In the case of many examples, you presume you never need to clean something up, and you make assumptions about how you can handle the data and its lifespan around those presumptions.  When you move to a new environment where those presumptions are not valid, entire algorithms may no longer work.
For an example of just how strange things can get, look at how the managed languages deal with finalization at the end of processes, or how C# deals with the programmatic halting of Application Domains.  They tie themselves in knots because there's assumptions that fall through the cracks in these extreme cases.

A:
If I need to use a piece of memory throughout the lifespan of my program, is it really necessary to free it right before program termination?

It is not mandatory, but it can have benefits (as well as some drawbacks).
If the program allocates memory once during its execution time, and would otherwise never release it until the process ends, it may be a sensible approach not to release the memory manually and rely on the OS. On every modern OS I know, this is safe, at the end of the process all allocated memory is reliably returned to the system.
In some cases, not cleaning up the allocated memory explicitly may even be notably quicker than doing the clean-up.
However, by releasing all the memory at end of execution explicitly,

*

*during debugging / testing, mem leak detection tools won't show you "false positives"

*it might be much easier to move the code which uses the memory together with allocation and deallocation into a separate component and use it later in a different context where the usage time for the memory need to be controlled by the user of the component

The lifespan of programs can change. Maybe your program is a small command line utility today, with a typical lifetime of less than 10 minutes, and it allocates memory in portions of some kb every 10 seconds - so no need to free  any allocated memory at all before the program ends. Later on the program is changed and gets an extended usage as part of a server process with a lifetime of several weeks - so not freeing unused memory in between is not an option any more, otherwise your program starts eating up all available server memory over time. This means you will have to review the whole program and add deallocating code afterwards. If you are lucky, this is an easy task, if not, it may be so hard that chances are high you miss a place. And when you are in that situation, you will wish you had added the "free" code to your program beforehand, at the time when you added the "malloc" code.
More generally, writing allocating and related deallocating code always pairwise counts as a "good habit" among many programmers: by doing this always, you decrease the probability of forgetting the deallocation code in situations where the memory must be freed.

A: Freeing memory at the end of a programs run is just a waste of CPU time. It's like tidying a house before nuking it from orbit.
However sometimes what was a short running program can turn into part of a much longer running one. Then freeing stuff becomes necessary. If this wasn't thought about to at least some extent then it can involve substantial reworking.
One clever solution to this is "talloc" which lets you make a load of memory allocations and then throw them all away with one call.

A: Ignoring languages where you don't free memory manually anyway...
What you think of as "a program" right now might at some point become just a function or method that is part of a larger program. And then that function might get called multiple times. And then memory that you should have "freed manually" will be a memory leak. That is of course a judgment call.

A: No, it is not necessary, but it's a Good Idea.
You say you feel that "mysterious and terrible things would happen if I didn't free memory after I'm done using it."
In technical terms, the only consequence of this is that your program will keep eating more memory till either a hard limit is reached (e.g. your virtual address space is exhausted) or performance becomes unacceptable. If the program is about to exit, none of this matters because the process effectively ceases to exist. The "mysterious and terrible things" are purely about the developer's mental state. Finding the source of a memory leak can be an absolute nightmare (this is an understatement) and it takes a lot of skill and discipline to write code that is leak-free. The recommended approach to developing this skill and discipline is to always free memory once it is no longer needed, even if the program is about to end.
Of course this has the added advantage that your code can be re-used and adapted more easily, as others have said.
However, there is at least one case where it is better not to free memory just before program termination.
Consider the case where you have made millions of small allocations, and they have mostly been swapped to disk. When you start freeing everything, most of your memory needs to get swapped back in to RAM so that the bookkeeping information can be accessed, only to immediately discard the data. This can make the program take a few minutes just to exit! Not to mention put a lot of pressure on the disk and physical memory during that time. If physical memory is in short supply to begin with (perhaps the program is being closed because another program is chewing up a lot of memory) then individual pages may need to be swapped in and out several times when several objects need to be freed from the same page, but are not freed consecutively.
If instead the program just aborts, the OS will simply discard all the memory that has been swapped to disk, which is nearly instantaneous because it doesn't require any disk access at all.
It's important to note that in an OO language, calling an object's destructor will also force the memory to be swapped in; if you have to do this you might as well free the memory.

A: Because it's very probable that in some time you'll want to alter your program, maybe integrate it with something else, run several instances in sequence or parallel. Then it'll become necessary to manually free this memory - but you won't be remembering the circumstances anymore and it'll cost you much more time to re-understand your program.
Do things while your understanding about them is still fresh.
It's a small investment that may yield big returns in the future.

A: The main reasons to clean up manually are: you're less likely to mistake a genuine memory leak for a memory block that will just be cleaned up on exit, you will sometimes catch bugs in the allocator only when you walk the entire data structure to deallocate it, and you'll have a much smaller headache if you ever refactor so that some object does need to get deallocated before the program exits.
The main reasons not to clean up manually are: performance, performance, performance, and the possibility of some kind of free-twice or use-after-free bug in your unnecessary clean-up code, which can turn into a crash bug or security exploit.
If you care about performance, you always want to profile to find out where you're wasting all your time, instead of guessing.  A possible compromise is to wrap your optional clean-up code in a conditional block, leave it in when debugging so you get the benefits of writing and debugging the code, and then, if and only if you've determined empirically that it's too much overhead, tell the compiler to skip it in your final executable.  And a delay in closing the program is, almost by definition, hardly ever in the critical path.


text:
Q: "free(): invalid pointer" error occurs when returning an eigen matrix I am doing some iterative calculation on tensor. I have to map the tensor to a matrix in the calculation. The library I use for matrix operation is "Eigen".
Description of the class Tensor:

*

*the * operator is overloaded to perform tensor multiplication. (Common indices are summed over)

Description of the class SVD:

*

*It is used to perform singular value decomposition (SVD).

*The decomposition is done by Eigen::JacobiSVD.

*It serves to output ltensor and rtensor (both rank 3) in the program.

*Example: if the input matrix is D^2xD^2, the ltensor is DxDxD^2, the rtensor is D^2xDxD.

*Multiplication of ltensor and rtensor will give the original tensor.

Description of the program:

*

*The initial tensor is rank 4 with the dimension of each index to be 2 (2x2x2x2). It is then mapped to a 4x4 matrix by the function "transform_to_matrix()".

*After some calculations, the dimension of each index of tensor T is enlarged to 4 (4x4x4x4).

*In the next iteration, I expect the new tensor is mapped to a 16x16 matrix.

Error:
The error "free(): invalid pointer" occurs at the line labelled with (*) in the second iteration.
void SOLVE::solve(){
  Tensor S=this->tensor_; // initial tensor with index {"u","d","l","r"}
  std::vector<std::string> row1{"u","l"};
  std::vector<std::string> col1{"d","r"};
  std::vector<std::string> row2{"u","r"};
  std::vector<std::string> col2{"d","l"};
  Tensor S1;
  Tensor S2;
  Tensor S3;
  Tensor S4;
  SVD svd;
  for(int i=0;i<2;i++){
    std::cout << i<< "check" << std::endl;
    Eigen::Matrix<double,Eigen::Dynamic,Eigen::Dynamic> matrix1=
    transform_to_matrix(S,row1,col1); // (*) map to matrix by the sets of
                                      // indices
    std::cout << i<< "check" << std::endl;
    svd.set_matrix(matrix1); // input matrix to do SVD
    svd.solve(); // solve the SVD
    S1=svd.get_ltensor("u","l","e"); // "u", "l", "e" are for index
                                     // labeling
    S3=svd.get_rtensor("f","r","d"); // "f", "r", "d" are for index
                                     // labeling
    Eigen::Matrix<double,Eigen::Dynamic,Eigen::Dynamic>matrix2=
    transform_to_matrix(S,row2,col2); // map to matrix by another sets of
                                      // indices
    svd.set_matrix(matrix2); // update to new matrix
    svd.solve(); // solve the SVD problem again
    S4=svd.get_ltensor("u","r","g");
    S2=svd.get_rtensor("h","d","l");
    S1.set_index("u","a"); // rename the index "u" to "a"
    S1.set_index("l","n");
    S1.set_index("e","r");
    S2.set_index("l","b");
    S2.set_index("d","a");
    S2.set_index("h","u");
    S3.set_index("r","b");
    S3.set_index("d","m");
    S3.set_index("f","l");
    S4.set_index("u","m");
    S4.set_index("r","n");
    S4.set_index("g","d");
    // Indice of
    // S1: {"a","n","r"}
    // S2: {"b","a","u"}
    // S3: {"b","m","l"}
    // S4: {"m","n","d"}
    S=S1*S2*S3*S4; // indices of S: {"u","d","l","r"}
  }
}

Eigen::Matrix<double,Eigen::Dynamic,Eigen::Dynamic>
transform_to_matrix
(const Tensor &S,
std::vector<std::string> row,
std::vector<std::string> col)
{
  // This function will map a DxDxDxD tensor to a D^2xD^2 matrix,
  // according to the row indices and col indices required.
  // Example:
  // row={"u","d"}, col={"l","r"}
  // The indices "u" and "d" are grouped into the row
  // The indices "l" and "r" are grouped into the col
  Eigen::Matrix<double,Eigen::Dynamic,Eigen::Dynamic> matrix;
  ... // some mapping procedures.
  std::cout << matrix << std::endl;
  return matrix;
}

Program output:
0check
... (a 4*4 matrix is printed here)
0check
1check
... (a 16*16 matrix is printed here)
Error message is printed here: "free(): invalid pointer:"

The 16x16 matrix is printed out, so everything is fine until the end in the function transform_to_matrix(). So the problem is the "matrix" in the second iteration cannot accept the return from transform_to_matrix().
Why does it happen? How can I fix it?
Update:
The error is sometimes "free(): invalid next size (fast):" and sometimes "free(): invalid pointer".
Use gdb to debug
Output:
0check
... (a 4*4 matrix is printed here)
0check
1check
... (a 16*16 matrix is printed here)
Error message is printed here: "free(): invalid next size (fast): 0x00000000006c5570"
...
Program received signal SIGABRT, Aborted.
0x00007ffff71a1428 in __GI_raise (sig=sig@entry=6) at
../sysdeps/unix/sysv/linux/raise.c:54
54  ../sysdeps/unix/sysv/linux/raise.c: No such file or directory.

Type bt:
#0  0x00007ffff71a1428 in __GI_raise (sig=sig@entry=6) at../sysdeps/unix/sysv/linux/raise.c:54
#1  0x00007ffff71a302a in __GI_abort () at abort.c:89
#2  0x00007ffff71e37ea in __libc_message (do_abort=do_abort@entry=2,
fmt=fmt@entry=0x7ffff72fce98 "*** Error in `%s': %s: 0x%s ***\n") at
../sysdeps/posix/libc_fatal.c:175
#3  0x00007ffff71ec37a in malloc_printerr (ar_ptr=<optimized out>,
ptr=<optimized out>, str=0x7ffff72fcf10 "free(): invalid next size
(fast)", action=3) at malloc.c:5006
#4  _int_free (av=<optimized out>, p=<optimized out>, have_lock=0) at
malloc.c:3867
#5  0x00007ffff71f053c in __GI___libc_free (mem=<optimized out>) at
malloc.c:2968
#6  0x0000000000404cbe in __gnu_cxx::new_allocator<int>::deallocate
(this=0x7fffffffcc90, __p=0x6c5570) at
/usr/include/c++/5/ext/new_allocator.h:110
#7  0x00000000004048b0 in std::allocator_traits<std::allocator<int>
>::deallocate (__a=..., __p=0x6c5570, __n=2) at
/usr/include/c++/5/bits/alloc_traits.h:517
#8  0x0000000000404268 in std::_Vector_base<int, std::allocator<int>
>::_M_deallocate (this=0x7fffffffcc90, __p=0x6c5570, __n=2) at
/usr/include/c++/5/bits/stl_vector.h:178
#9  0x0000000000403813 in std::_Vector_base<int, std::allocator<int>
>::~_Vector_base (this=0x7fffffffcc90, __in_chrg=<optimized out>) at
/usr/include/c++/5/bits/stl_vector.h:160
#10 0x0000000000407fdd in std::vector<int, std::allocator<int>
>::~vector (this=0x7fffffffcc90, __in_chrg=<optimized out>) at
/usr/include/c++/5/bits/stl_vector.h:425
#11 0x0000000000467795 in transform_to_matrix (t=..., row=std::vector
of length 2, capacity 2 = {...},
col=std::vector of length 2, capacity 2 = {...}) at helper.cpp:189
#12 0x000000000040bcc2 in SOLVE::solve (this=0x7fffffffe1e0) at
solve.cpp:22
#13 0x0000000000402279 in main () at main.cpp:43

#13:
t.solve(); // call solve(); main.cpp:43

#12:
Eigen::Matrix<double,Eigen::Dynamic,Eigen::Dynamic> matrix1=transform_to_matrix(S,row1,col1); // give error in the second iteration; solve.cpp:22

#11:
std::vector<int> col_arr(col_size,0); // col_size=2 ; helper.cpp:189


text:
Q: Cannot receive incoming audio/video call in conversation control In my application, I'm using the skype web sdk with the conversation control.
I can start and receive chats, but when I try to add audio/video modality, by pressing the corresponding button, the other user wont see the incoming call.
But when I stop the call the user is getting a "missing call" notification.
The other user's audio/video modality gets changed to "Notified", but even a manual accept wont start the call.
Thought, that the CC handles everything itself.
The Plugin is installed.


text:
Q: Android/OpenGLES2 - Create "shader' program in different thread I'm new to OpenGLES and I've got a problem with shader programs.
My scenario is:
Thread A(works as loop) manages everything but it does not draw on screen
Thread B only draws on screen
Thread A decides if Thread B will draw in current cycle

My problem is when Thread A creates shader program for Thread B, B cannot access attribs and uniform locations
This is how A creates shader program:
int vertexShader = loadShader(GLES20.GL_VERTEX_SHADER, vertexShaderCode);
int pixelShader = loadShader(GLES20.GL_FRAGMENT_SHADER, fragmentShaderCode);

mProgram = GLES20.glCreateProgram();
GLES20.glAttachShader(mProgram, vertexShader);
GLES20.glAttachShader(mProgram, pixelShader);
GLES20.glLinkProgram(mProgram);

This is how Thread B uses program:
GLES20.glUseProgram(mProgram);
int positionHandle = GLES20.glGetAttribLocation(mProgram, "vPosition");
GLES20.glEnableVertexAttribArray(positionHandle);

GLES20.glVertexAttribPointer(positionHandle, COORDS_PER_VERTEX, GLES20.GL_FLOAT, false, vertexStride, vertexBuffer);

glGetAttribLocation returns -1 if mProgram was created by Thread A
glGetAttribLocation returns valid location when mProgram was created by Thread B
If Thread A created mProgram and positionHandle is hardcoded to valid location shader program does not work eather.
My question: Is it possible to create shader program in Thread A to be usable by Thread B?

A: I didn't read your whole question; I've only read "your scenario". And since you say you are new to OpenGL/GameDev, I'll simply say that your "scenario" is wrong. A long time ago, my first game I wrote also used a similar approach, so I don't blame you :).
You should be using a single thread that works like this:
load everything (textures, shaders, buffers, ...)
while (running)
{
    start timer
    update game (step by one frame, handle user input)
    render game
    show to openglbuffer to the screen (swap buffers)
    stop timer
    manage fps limiting (ie: sleep, using the difference of the timers)
}
clean up

The reason for all the problems with OpenGL you have, is that only one thread can have the OpenGL context.


text:
Q: Lazard's theorem and Hopf structures on the polynomial algebra Let $k$ be an algebraically closed field of characteristic $0$. A well-known result of Lazard's states that an algebraic group which is isomorphic as a variety to an affine space is unipotent  (M. Lazard, Sur nilpotence de certains groupes algebriques, C.R.A.S. Paris 241 (1955), 1687-1689.).
In the language of Hopf algebras, this says that any Hopf algebra isomorphic as an algebra to $k[x_{1}, \ldots, x_{n}]$, for some $n$, is necessarily connected as a Hopf algebra (i.e. the sum of its simple subcoalgebras is just the base field, $k$).
Lazard's original proof of this result is completely in the language of algebraic groups, and involved passing to finite fields (see 'How to use finite fields for problems concerning infinite fields', Serre, https://arxiv.org/pdf/0903.0517.pdf Theorem 4.1, for a brief description). My question is as follows:

(a) Is there a known proof of Lazard's result purely in the language of Hopf algebras?
(b) Is there perhaps a simpler proof which does not involve passing to finite fields if one considers this Hopf-theoretic approach?

Edit: Here's one possible idea, but I'm not sure if it helps.
Let $H$ be a Hopf algebra, isomorphic as an algebra to $k[x_{1},\ldots, x_{n}]$ for some $n>0$. Let $C$ be a simple subcoalgebra of $H$. We aim to show that $C$ is one-dimensional.
We have a coalgebra morphism $C\rightarrow H$. Dualising, this corresponds to a surjective algebra morphism
$$H^{\circ}\rightarrow C^{*}$$
where is the finite dual of $H$, and $C^{*}$ is a finite-dimensional simple algebra. Since $H$ is commutative, $H^{\circ}$ is cocommutative, so $H^{\circ}\cong kG(H^{\circ})\#U(P(H^{\circ}))$ by the Cartier-Gabriel-Konstant theorem. We know that elements of $G(H^{\circ})$ are precisely algebra homomorphisms $H\rightarrow k$, hence $G(H^{\circ})$ is the underlying algebraic group of $H$. This is about as far as I got.


text:
Q: NextjS Image issue with src and default external image URL I am using the latest version of NextJS 10.0.9. I've got an Image that I'm trying to display, however I'm receiving the error:
Error: Image with src "https://picsum.photos/480/270" must use "width" and "height" properties or "layout='fill'" property.

As you can see here though, I do have all of those properties set:
<div className="card-img">
  <Image
    alt={media?.title}
    title={media?.title}
    src={media?.previewImage || 'https://picsum.photos/480/270'}
    width={480}
    height={270}
    layout="fill"
  />
</div>

For some reason, it appears that having a default external image doesn't want to play nicely with the Image component. Does anyone know a workaround or reason why this might be the case?
A little side note too: I've got a Typescript error on the layout property that says "Type '"fill"' is not assignable to type '"fixed" | "intrinsic" | "responsive" | undefined'.". I'm not sure if that's related?

A: If you use layout='fill', you do not need a width and height attribute. The error message isn't completely clear, but that "or" is an exclusive or. You can define the width/height or layout='fill', but not both.
This is a byproduct of how next/image works: the width/height props are used to determine aspect ratio, not necessarily display size.
Since layout='fill' means "stretch to fill the parent element", the width and height are meaningless. So to fix the error, either remove layout='fill', or remove the dimensions.

You've probably already seen this, but here are the docs just in case: https://nextjs.org/docs/api-reference/next/image

A: For others who may have come across this page but not quite found the answer that they are looking for I would also like to highlight that the width and height props of the Next 'Image' component do not accept decimals. This is quite easy to overlook as the error message does not make any reference to prop format.


text:
Q: Make multiple select menus jump to the first option I've got 2 select menus. Example below.
How do I make both select menus jump to the first option when a button is clicked?
  <select class="personlist">
     <option value="One">One</option>
     <option value="Two">Two</option>
  </select>

  <select class="personlist">
     <option value="Ten">Ten</option>
     <option value="Eleven">Eleven</option>
  </select>

I came across similar posts while googling. But was not able to get it right.
document.getElementsByClassName('personlist').value=[0];

A: getElementsByClassName returns an HTMLCollection object which is an array like object so you need to iterate over it and set the value

function reset() {
  var els = document.getElementsByClassName('personlist');
  for (var i = 0; i < els.length; i++) {
    els[i].options[0].selected = true;
  }
}
<select class="personlist">
  <option value="One">One</option>
  <option value="Two">Two</option>
</select>
<select class="personlist">
  <option value="Ten">Ten</option>
  <option value="Eleven">Eleven</option>
</select>
<button onclick="reset()">d</button>

A: If you JQuery, you can use :
$('#select-a').click(function() {
  $('select.personlist').each(function() {
    $(this).find('option').first().prop('selected', true)
  });
});


text:
Q: Showing an inequality of a complex exponential function If $T>2$ and exist $p$ such that $2(p-1)\leq T<2p$ show that  $\int_{0}^{T}|e^{i n\pi t}|^2dx\leq p\int_{0}^{2}|e^{i n \pi t}|^2dt.$
Hint: Use 2-periodicity of $e^{i n\pi t}$
I have this: $\int_{0}^{T}|e^{i n \pi t}|^2dt\leq \int_{0}^{2p} |e^{i n \pi t}|^2dt=p\int_{0}^{2}|e^{i n\pi sp}|^2ds$  with the change $s=t/p$

A: I have it!
$\int_{0}^{2p} |e^{i n\pi it}|^2dt=\int_{0}^{2} |e^{i n\pi it}|^2dt+\cdots+ \int_{2(p-1)}^{2p} |e^{i n\pi it}|^2dt=p\int_{0}^{2p} |e^{i n\pi it}|^2dt$


text:
Q: Is cross validation for validating a model or for selecting best model in different kinds of models? I am confused about the concept of cross validation and its usage.
As I read about cross validation before, it is a way of validating a model. I did cross validation in my project (developing different regression models on a dataset, model validation and finally choosing best model). Cross validation just give me a model but no statistical criteria that shows ability of the model. By the way each time that I run cross validation (in R program) the result is different because train dataset is changed. For selecting the best model, I calculate AIC for the model obtained by cross validation but now I think it is wrong. Because first, train data used for each model is different, and second, even for a certain model, AIC will change by repeating cross validation.
Lately I read that cross validation is used for selecting the best model! All these confused me about utility of cross validation and the way of interpreting the result.
Could you please help me on figuring out all these?

A: Cross-validation is essentially a method to estimate generalization performance.
I'm going to assume you are considering k-fold cross-validation, which is the most common type (I guess). It can be employed during both model selection and what some might call validation:

*

*model selection procedures can use cross-validation to estimate performance of a model built using certain hyperparameters/structure and then select the model with the best estimated performance. Cross-validation itself does not select a model, but it can be used to estimate the generalization performance of a model.

*in nested cross-validation two layers of cross-validation are used:

*

*the outer layer estimates generalization performance of a full modeling approach, including model selection

*the inner cross-validation procedure is used for model selection, as explained previously

A: I think the "model validation" part of cross-validation is that it allows you get a good approximation of the performance of the model (expressed in a measure of goodness-of-fit like mean squared prediction error or AIC) outside of the training set.
Of course these performance values by themselves do not tell you if your model is correct, usually they can only tell you if your model is better than some other given model. However, getting a very small cross-validated mean squared prediction error is at least a good sign that your model is good predictor.


text:
Q: Unable to authorize using OAuth (Google API) I'm trying to use Curl in order to authorize using Oauth, but I'm getting a "Required parameter is missing: grant_type" response from Google. Can anyone tell me what's wrong with my code?
$curl = curl_init();
curl_setopt($curl, CURLOPT_HTTPHEADER, array('Host: www.googleapis.com', 'Content-Type: application/x-www-form-urlencoded; charset=utf-8'));
curl_setopt($curl, CURLOPT_URL, 'https://www.googleapis.com/oauth2/v3/token');
curl_setopt($curl, CURLOPT_POST, 1);
curl_setopt($curl, CURLOPT_POSTFIELDS, array('client_id' => 'xxxxxxxxxxx.apps.googleusercontent.com', 'client_secret' => 'xxxxxxxxxx', 'refresh_token' => $auth->refresh_token, 'grant_type' => 'refresh_token'));
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);

A: You're passing an array to CURLOPT_POSTFIELDS which results in the content type being set to multipart/form-data because it is applied after the CURLOPT_HTTPHEADER option. You need to apply http_build_query to the array first which will result in a content type of application/x-www-form-urlencoded. So use:
curl_setopt($curl, CURLOPT_POSTFIELDS, http_build_query(array('client_id' => 'xxxxxxxxxxx.apps.googleusercontent.com', 'client_secret' => 'xxxxxxxxxx', 'refresh_token' => $auth->refresh_token, 'grant_type' => 'refresh_token')));


text:
Q: Constexpr function returning std::array not treated as constexpr by compiler So in my C++11 project, I'm trying to alias a specific traits template specialisation based on a class template parameter.
This is intended so that I can inherit from the template, using CRTP, and access the members of the traits template without needing to refer to the type used to specialise it.
improved minimal example:
main.cpp
#include "Matrix.h"
#include "MatrixImplementation.h"

int main()
{
    HAL_Matrix<NXP_HAL_Matrix>().Scan();
    return 0;
}

Matrix.h
#pragma once
#include <array>

template <uint8_t ... Pins>
static constexpr std::array<uint8_t, sizeof...(Pins)> MakePinArray()
{
    return (std::array<uint8_t, sizeof...(Pins)> { { Pins... } });
};

template <class HAL_Matrix_Implementation>
struct MatrixTraits
{

};

template <>
struct MatrixTraits<class HAL_Matrix_Implementation>
{};

template <class HAL_Matrix_Implementation>
class HAL_Matrix
{
public:
    using MatrixParameters = ::template MatrixTraits<HAL_Matrix_Implementation>;
    void Scan()
    {
        auto test = MatrixParameters::RowPins;
        auto test2 = MatrixParameters::ColumnPins;
    };
};

MatrixImplementation.h
#pragma once

#include "Matrix.h"
#include <array>
#include <stdint-gcc.h>

class NXP_HAL_Matrix : public HAL_Matrix<NXP_HAL_Matrix>
{
public:

    void Scan() {};
    void Initialize() {};
};

template <>
struct MatrixTraits<NXP_HAL_Matrix>
{
public:
    static constexpr auto RowPins = MakePinArray<1,2,3>();
    static constexpr auto ColumnPins = 3;
};

At compile-time I get the following error:
Debug/main.o: In function `HAL_Matrix<NXP_HAL_Matrix>::Scan()':
<path>\Matrix.h(31): error VGDB1000: undefined reference to `MatrixTraits<NXP_HAL_Matrix>::RowPins'

While preparing this minimal example it became apparent to me that my attempt to access RowPins gives an undefined reference, but storing just an int in ColumnPins means I can access it without error.
As a result I'm presuming that there's something wrong with my MakePinArray template function so that the compiler is ignoring the constexpr specifier, and allowing it to be called at runtime hence the undefined reference error.
However, I've looked at other answers such as the second suggestion in this answer: Create N-element constexpr array in C++11 and can't detect a functional difference between his build_array function and mine.
Can anybody a) confirm that my understanding is correct (ie that constexpr specifier is being discarded, causing there to be a declaration for RowPins but no definition) and b) suggest how I rectify this?
Just for further information if it is helpful, I'm using VisualGDB/arm-gcc 4.9.2 and compiling with -std=c++11 .


text:
Q: What is the difference between Timer and Runnable? I would like to know what exactly the difference is between these two classes, and when should I use each.
I am asking this because I am wondering about this sample code:
mStatusChecker = new Runnable() {
        @Override
        public void run() {
            invalidate();
            mHandler.postDelayed(mStatuschecker, (long) increment * 1000);
        }
    };

If I put the mHandler.postDelayed line of code before invalidate(), the Runnable is executed at almost double the speed. I am wondering if a Timer could be used instead to fix this problem.

A: Timer is a facility for threads to schedule tasks for future execution in a background thread. Tasks may be scheduled for one-time execution, or for repeated execution at regular intervals.

A: It's better to user Timer functionality if you need timer functionality like task needing to be run at regular intervals.

Java java.util.Timer is a utility class that can be used to schedule a
  thread to be executed at certain time in future. Java Timer class can
  be used to schedule a task to be run one-time or to be run at regular
  intervals. Java Timer class is thread safe and multiple threads can
  share a single Timer object without need for external synchronization.

https://www.journaldev.com/1050/java-timer-timertask-example

A: Timer is not an Android class, it's a Java SDK class included in the Android SDK for compatibility with legacy code. It does not play well with the Android component lifecycle and requires extra code to interact with the UI. In short, do not use Timer on Android.


text:
Q: How can I flatten part of this Sql Query? Does this need a PIVOT? I'm struggling to flatten part of my sql query. I'm not sure if I require a PIVOT or this should be attempted with a sub query using OVER.
Now, I can't use my real table names, so I've created a very contrite example that represents our real system. It looks like homework, but it's not.
This is the reproduction (*note: I tried to make this a SqlFiddle but it just wasn't working) :
-- Some fake courses/subjects.
DECLARE @Courses TABLE (
    CourseId INTEGER IDENTITY NOT NULL,
    Name VARCHAR(100) NOT NULL)

INSERT INTO @Courses VALUES ('CS100')
INSERT INTO @Courses VALUES ('PY300')
INSERT INTO @Courses VALUES ('AG201')

-- Some teachers that teach the subject/course.
-- Notice there is no ORDER column, so the first teacher is considered
-- The main teacher. the 2nd result is the backup teacher.
-- First teacher = ORDER BY TeacherId ASC (per course)
DECLARE @Teachers TABLE (
    TeacherId INTEGER IDENTITY NOT NULL,
    CourseId INTEGER NOT NULL,
    Name VARCHAR(100)
)

INSERT INTO @Teachers VALUES (1, 'Jane')
INSERT INTO @Teachers VALUES (1, 'John')
INSERT INTO @Teachers VALUES (2, 'Bill')
INSERT INTO @Teachers VALUES (2, 'Anne')
INSERT INTO @Teachers VALUES (3, 'R2D2')

/*
-- Expected output:

CourseId | Cource Name | Primary Teacher | Backup Teacher
----------------------------------------------------------
1        | CS100       | Jane            | John
2        | PY300       | Bill            | Anne
3        | AG201       | R2D2            | <NULL>
*/

Can anyone provide some suggestions please?
Finally, please don't make schema suggestions, like the teachers could be in there own table and then have a join/link table for Courses and Teachers (because the same teacher can teach more than one class, right?).

A: You can try this query:
;with cte as(
select *, row_number() over(partition by CourseId order by TeacherId ASC) as rn
  from @Teachers)

select c.CourseId
     , c.Name as [Cource Name]
     , t1.Name as [Primary Teacher]
     , t2.Name as [Backup Teacher]
  from @Courses c
      left outer join cte t1 on c.CourseId = t1.CourseId and t1.rn = 1
      left outer join cte t2 on c.CourseId = t2.CourseId and t2.rn = 2


text:
Q: Dont know how to call paint method Hi i want to know how to call the paint method...
I am a novice programmer and am really just experimenting with things like paint.
The program i am trying to make is the game where there are 3 rungs and the aim of the game is to move different sized disks from the left/right rung to the right/left rung.
here is my code(no where near finished give me a break):
public static void main(String[] args) {
    Scanner scan = new Scanner(System.in);
    int amount = 0;

    // get the amount of rectangles to draw to represent disks
    while (amount <= 1 && amount >= 5) {
        System.out.print("Please enter amount of discs to use(less than 7 more than one).");
        amount = scan.nextInt();
    }
}

public void paint(Graphics g) {
    // draw a certain amount of rectangles in ascending order
    if (amount <= 1 && amount >= 5) {
        for (int i = 0; i < amount; i++) {
            g.fillRect(220 - (20 * i), 200 + (10 * i), 100 - (20 * i), 20);
        }
    }
}

A: The paint method will be called for the first time upon creation of the object.
To force the paint() method to be called again you can either call update(Graphics g) if you want to pass in a new Graphics object, but normally I would suggest using repaint() method, since this way it will be scheduled to be called asap.

A: You don't need to call it. Instead, you should use the main loop which Java creates for you.
The usual approach is to extend JPanel (see this question: How to make canvas with Swing?) and override the paint() method.
Now create a JFrame, add the new UI component to it and open the frame. Java will then make sure it gets rendered.

A: I am not expert or something else to teach others but you need to put your code to be painted to paintComponent(Graphics g) method instead of paint and then call repaint method.


text:
Q: How to inject dependency into NServiceBus pipeline behavior? I've been following the NServiceBus samples, specifically for how to use an entity framework (core) DbContext integrated with Sql Persistence so that I can save dbcontext state changes along with the outbox messages.  This is the sample: https://docs.particular.net/samples/entity-framework-core/
I've modified the unit of work code a little to support creation of an aspnet core DI scoped DbContext.  The relevant code follows:
    public class UnitOfWork<TDbContext>
        where TDbContext : DbContext
    {
        private Func<SynchronizedStorageSession, IServiceProvider, TDbContext> _contextFactory;
        private TDbContext _context;
        private IServiceProvider _serviceProvider;

        public UnitOfWork(Func<SynchronizedStorageSession, IServiceProvider, TDbContext> contextFactory, IServiceProvider serviceProvider)
        {
            _contextFactory = contextFactory;
            _serviceProvider = serviceProvider;
        }

        public TDbContext GetDataContext(SynchronizedStorageSession storageSession)
        {
            if (_context == null)
            {
                _context = _contextFactory(storageSession, _serviceProvider);
            }
            return _context;
        }
    }

    public class UnitOfWorkSetupBehavior<TDbContext> : Behavior<IIncomingLogicalMessageContext>
        where TDbContext : DbContext
    {
        private readonly Func<SynchronizedStorageSession, IServiceProvider, TDbContext> _contextFactory;
        private readonly IServiceScopeFactory _serviceScopeFactory;

        public UnitOfWorkSetupBehavior(Func<SynchronizedStorageSession, IServiceProvider, TDbContext> contextFactory, IServiceScopeFactory serviceScopeFactory)
        {
            _contextFactory = contextFactory;
            _serviceScopeFactory = serviceScopeFactory;
        }

        public override async Task Invoke(IIncomingLogicalMessageContext context, Func<Task> next)
        {
            using (var scope = _serviceScopeFactory.CreateScope())
            {
                var uow = new UnitOfWork<TDbContext>(_contextFactory, scope.ServiceProvider);
                context.Extensions.Set(uow);

                await next().ConfigureAwait(false);

                context.Extensions.Remove<UnitOfWork<TDbContext>>();
            }
        }
    }

    public static class EndpointConfigurationExtensions
    {
        public static void RegisterUnitOfWork<TDbContext>(this EndpointConfiguration endpointConfiguration, IServiceScopeFactory serviceScopeFactory)
            where TDbContext : DbContext
        {
            var pipeline = endpointConfiguration.Pipeline;
            pipeline.Register(new UnitOfWorkSetupBehavior<TDbContext>((storageSession, serviceProvider) =>
            {
                var dbConnection = storageSession.SqlPersistenceSession().Connection;
                var dbContextFactory = serviceProvider.GetService<IDbContextConnectionFactory<TDbContext>>();
                var dbContext = dbContextFactory.GetDbContext(dbConnection);

                //Use the same underlying ADO.NET transaction
                dbContext.Database.UseTransaction(storageSession.SqlPersistenceSession().Transaction);

                //Call SaveChanges before completing storage session
                storageSession.SqlPersistenceSession().OnSaveChanges(x => dbContext.SaveChangesAsync());

                return dbContext;
            }, serviceScopeFactory), "Sets up unit of work for the message");
        }
    }

    public static class UnitOfWorkContextExtensions
    {
        public static TDbContext DataContext<TDbContext>(this IMessageHandlerContext context)
            where TDbContext : DbContext
        {
            var uow = context.Extensions.Get<UnitOfWork<TDbContext>>();
            return uow.GetDataContext(context.SynchronizedStorageSession);
        }
    }

For this to work the behavior needs an injected IServiceScopeFactory.
Now all examples I've been able to find of behavior registration only show the type manually instantiated and passed in to the endpointconfiguration's pipeline.
Is there a way to either gain access to an IServiceScopeFactory via the behavior's Invoke method (maybe by the context via some extension perhaps?), or is it possible to register the behavior itself such that I can construct it with services created by the DI container?
FYI I took a look at this Q&A which gave me the idea of injecting the IServiceScopeFactory.  Unfortunately, the answer doesn't show how to actually get an instance of the interface.

A: You would use context.builder.Build<T>(); within the Invoke method to resolve any objects like IServiceScopeFactory.

*

*https://docs.particular.net/samples/multi-tenant/di/
Make sure that the IServiceScopeFactory is registered in the DI container. For example, during your endpoint initialization:
endpointConfiguration.RegisterComponents(registration: x =>
    {
        x.ConfigureComponent<IServiceScopeFactory>(yourServiceScopeFactory);
    });

*

*https://docs.particular.net/nservicebus/dependency-injection/
You can also do this by creating a Feature

*

*https://docs.particular.net/nservicebus/pipeline/features


text:
Q: Silenced sniper rifle I have a tranquilzer round sniper rifle but it is not silenced thus once I fire it, whoever I hit goes to sleep (ZZZ) but the rest of troops go into alert mode.
Where/how can I find a suppressor for it?

A: There are a few steps involved to get a suppressor for the non-lethal sniper rifle.
First, you need to develop a sniper rifle with a suppressor. It does not matter which one, as long as it has a suppressor.
The next step is to unlock the legendary gunsmith. To do that, you need to finish 3 side-ops: 107, 108 and 109. This allows you to customize weapons in your ACC.
With a developed sniper suppressor and the legendary gunsmith, you can then customize your sniper rifle and attach the suppressor.
It is worth noting that only one side op appear per region of the map.  So, you might be able to do 107 but 108 will not appear till you have completed the other side op(s) in the appropriate regions.

A: Once you rescue the legendaty gunsmith (Side Op 109), you will unlock the ability to customise weapons from the ACC menu. Suppressors can then be attached to guns from there.


text:
Q: TaskCanceledException causes Hangfire job to be in Processing state indefinitely As I understand it, Hangfire does not support async methods yet. As a workaround, I wrapped my async method calls with AsyncContext.Run() from AsyncEx to make it appear to be synchronous from Hangfire point of view. Exception seems to be bubbled up correctly as expected (unwrapped from AggregateException).
    public void Task()
    {
        AsyncContext.Run(() => TaskAsync());
    }

    private async Task TaskAsync()
    {
        //...
    }

However, when TaskAsync throws TaskCanceledException, Hangfire does not correctly mark it as "Failed". Instead it will try to process the job again. If TaskAsync keeps on throwing TaskCanceledException, it will be stuck in that state indefinitely instead of stop retrying after 10 times as usual.

It seems to be because Hangfire treats OperationCanceledException as its own control flow, instead of treating it as an exception originating from the job.  e.g. here, and here.
Is there any way to get around it, other than wrapping all my Hangfire jobs with catch TaskCanceledException ?

A: For those who face the same problem as myself, this bug has been fixed in Hangfire 1.4.7.
As per the changeset, Hangfire now checks that the InnerException is not a TaskCanceledException.


text:
Q: Comment form on custom page template I have created a custom page template, but I don't know how to add the WordPress comment form to my  tag.
I tried to include the following in my template.php file in the body tag, but the form won't show up:
<?php $comments_args = array('label_submit' => __( 'Send', 'textdomain' ), 'title_reply' => __( 'Write a Reply or Comment', 'textdomain' ), 'comment_notes_after' => '',
        'comment_field' => '
' . _x( 'Comment', 'noun' ) . '
<textarea id="comment" name="comment" aria-required="true"></textarea>
',
);

comment_form( $comments_args ); ?>

I am using the child theme of twenty seventeen themes.

A: If you want to display default Wordpress comment form then you need to call comments_template() in your template. Make sure that comment_status should be open for the particular post that you want to display the comment form.
<?php
comments_template();
?>

Read more here https://developer.wordpress.org/reference/functions/comments_template/


text:
Q: Get the data between two months in ibatis If I want to get the data between March 2013 to November( for each month, all daily data
are to be summed up to make a monthly data), I thought what I did was correct.
But it gives me 186 rows(all dates from March to November) of result instead of giving
just 9 ( 9 months between the two).
And for some reason, I get only 1 data for November.
Could anyone fix this?
 SELECT
     TO_CHAR (TO_DATE ('201305','YYYYMM')+LEVEL- 1, 'YYYYMM') AS MONTH
        FROM DUAL
        CONNECT BY TO_DATE('201305', 'YYYYMM') + LEVEL - 1  <=  TO_DATE('201311', 'YYYYMM')

A: Is this what you want?
 SELECT TO_CHAR(ADD_MONTHS(TO_DATE('201303','YYYYMM'),LEVEL-1), 'YYYYMM') AS Month
   FROM DUAL
CONNECT BY ADD_MONTHS(TO_DATE('201303','YYYYMM'),LEVEL-1 ) <= TO_DATE('201311', 'YYYYMM');

Output:
Month
-------
201303
201304
201305
201306
201307
201308
201309
201310
201311


text:
Q: SSL redirect behaviour Scenario:
A.COM, B.COM, C.COM. A & B.COM are registered with SSL. All three sites host entries are in single server in /etc/hosts with respective domain name.
Question:
When I type https://C.COM (non-ssl site). It automatically redirects to A.COM (ssl site).
There is no entries made in DNS (Godaddy) and server host entry for such behaviour.
Can somebody help me understand why is this happening ?

A: It's not clear what you mean by "registered with SSL". You don't "register" with SSL. I presume you mean you've configured a certificate for HTTPS on the server(s) listening at the address(es) for a.com and b.com.
Since all 3 domains have entries in /etc/hosts, from that machine's point of view, DNS resolution is irrelevant: the hosts file will be used to give the client the IP address for each domain.
You're not saying whether a.com, b.com and/or c.com share IP addresses.
When you type https://c.com in your browser, it gets the IP address for c.com (which presumably is the same as that of a.com) and makes an SSL/TLS connection to it (on port 443). It gets the certificate presented by the server (it should show a warning message if you get a certificate that's not valid for c.com). The reason you get a.com is probably because a.com is the default host served on that IP address (and you haven't configured c.com).


text:
Q: SQL: I want to calculate a value in a new column using two columns with the same name from separate tables What I want to do is this:
January Table
Cusip Number: 1 , 2, 3
Current Factor: .123, .140, .045
February Table
Cusip Number: 1, 2, 3
Current Factor: .184, .163, .033
Then a new column in the FEB table that finds the value of the Feb factor/jan factor for each CUSIP number:
=.123/.184
=.140/.163
etc..
This is what I have so far which pulls the factor from the previous month and displays it below the Feb Table
SELECT [CURRENT FACTOR]
FROM DBO.mbs012013, DBO.mbs022013
WHERE DBO.mbs012013.[CUSIP NUMBER] = DBO.mbs022013.[CUSIP NUMBER]

A: Update February
  Set factor= (1.0 * January.factor/February.factor )
  from February
  Join Janaury on .... whatever links Febuary to January which had better be a 1-1 join

A:   SELECT February.CUSIP, February.factor, (1.0 * January.factor/February.factor ) as Ratio
  from February
  INNER JOIN Janaury on January.CUSIP = February.CUSIP


text:
Q: Is it true that the mass of air in normal atmospheric pressure over 1$m^2$ is 10326 $kg$? Is it true that the mass of air in normal atmospheric pressure over 1$m^2$ is 10326 $kg$?
I calculated it from pressure formula
$p=\frac{F}{A}$.
Let $m=?, A=1 m^2 and p=101300 Pa$.
$p=\frac{F}{A} \Leftrightarrow ...\Leftrightarrow
m= \frac{pA}{g}=\frac{101300 \cdot 1 }{9,81} = 10326 kg $.
So why we don't feel that weight, because if $A=160 cm^2 = 160 \cdot 10^{-4} m^2$( the area of normal man
s feet), then
$m=\frac{pA}{g}=\frac{101300 \cdot 160 \cdot 10^{-4}  }{9,81} =165 kg$.
Am I missing something? Why we don't feel that weight?

A: Your calculations are correct. The reason we don't feel it is because the 1 atmosphere of pressure will be applied to all surfaces of our body, including the soles of our feet.  In fact the interior of our body is also pushing out against our skin with 1 atmosphere of pressure so there is no net force being applied in either direction at the skin's surface.  The only way you could feel this pressure would be if part of your body was in contact with a vacuum while the rest of your body remained in air at 1 atmosphere of pressure.  Imagine that you were standing on an opening to a vacuum chamber that was almost, but slightly less than the size of the soles of your feet. If there was a perfectly air tight fit between the vacuum opening and your feet, you would indeed feel that pressure as that much force on your feet just as you calculated.  As a simpler experiment, just put your hand over the hose of a vacuum cleaner - that is only a very partial vacuum but the force you need to exert to remove your hand is due to the 1 atmosphere of pressure around us all pushing your hand onto the partial vacuum. In fact if you measured that force needed to pull your hand off of the vacuum cleaner hose, you could compute what the air pressure in the vacuum hose was.

A: You cannot simply recalculate the air pressure to mass (or weight) because the molecules in the air move in all possible directions, so they are not all acting simply down. But you can make the analogy that it is like having a 165 kg object on top of each of us.
And that is really true. There really is this pressure pressing on us from above, but we are just used to it. If you went somewhere with much lower pressure, you would feel the difference.