How can I finish the mission High Noon?

Question: I have problems killing Pulaski in the mission High Noon. I am stuck in the desert and he flees. The only car I get is a Bandito (Buggy).
I tried to shoot and crush my Bandito into his car, but somehow either he escapes or my Buggy gets destroyed.
I even tried to bring a good car, but somehow I cannot find it once the mission starts.
How can I finish this mission?
Answer: Here are some tips from strategywiki.org
Tips

A Sanchez is usually spawned by the Verdant Meadows save. With that, or any bike, drive up to the red marker and park the bike by the building closest to the road. After walking to the red marker and going through the cut-scene, the bike will still be there.
Before you start the initial cutscene, have a powerful gun armed, like the AK47 or M4. As Pulaski runs toward the car, he can't be hurt. You can shoot out the tires, so that he can't get any speed. Drive along him and shoot him up as he mocks your family. When he starts to burn he'll bail out. Get a small distance away and shoot him up with the AK47/M4 to put him down fast.
It is also possible to chase him down with the chainsaw before he gets in the buffalo.
If you have either stolen a Hunter from the Air races, or gotten all gold medals in your Learning to Fly training missions, the Hunter makes this mission relatively easy. If you don't have access to the Hunter, get yourself a Seasparrow before this mission. Fly your copter to the ghost town, and land it by the road, to the south of the town. Make sure you are a good distance away from the graveyard. Then, once he gets in the Buffalo, you can run to your copter, chase him down and blow up the car from the air. You will still have to kill Pulaski himself.
It is possible to block Pulaski with your buggy as he gets inside the car then carjack him. You can then run him over and kill him. The same cutscene is shown, but in that method, you don't hear him mocking your family. This method is very difficult and may require several tries.

Follow these tips and i'm sure you wont have any problems.
Answer: I recommend you use the method in the following video:

As soon as the mission starts, shoot the wheels of the car Pulaski is about to enter

The mission shouldn't prove to be a problem while Pulaski escapes driving around in circles...
Answer: I have two tips if you are using cheat then type all car blast code cpktnwt a cut scene appear and carl ask him for your wish and then kill him but if do not use cheat then just chase him I have do this mission with  both methods. I have completed san andreas 3 times first time intake two or three months second time in 3 days 3 time in 2 days
so if you any problem just ask me but make
sure only pc users

How can I finish the mission High Noon?


Simple Select returning null instead of value

Question: I have a table like this:

and what I need is a sum of amounts in given year for given department.
I tried this:
SELECT SUM(amount) FROM `spendings` WHERE dept_name='fiz' AND YEAR(date)=2012

but it only returns NULL. dept_name is a varchar, amount is a double and date - well, it's a date, what a surprise.
What am I doing wrong?
Comment: According to your data, there are no rows for department "fiz" for the year 2012, so there's no amount to sum up.
Comment: OMG I haven't yet made such a silly mistake! And I'm thinking how to solve it for half an hour already.. damn! But it's 2.15 AM in Poland so.. maybe it's time for some sleep.
Answer: Department fiz doesn't have any records on year 2012 therefore the sum of no queries found is Null
Answer: If that table is actually the data that you are querying, there are no records for the year 2012 (only 2010 and 2011)
Answer: You don't have any records WHERE dept_name='fiz' AND YEAR(date)=2012. The two records for dept 'fiz' are for '2010' and '2011'.
Answer: just to not repeat other anwsers, if you expect a cero, then use:
SELECT COALESCE(SUM(amount),0) FROM `spendings` WHERE dept_name='fiz' AND YEAR(date)=2012

please observe COALESCE function here


how to display array element-by-element in specific format in matlab

Question: I am using matlab sprintf to print numbers stored in 1D array with specific format. For example, I have two array A=[1 2 3], B=[4 5 6], I expect it to print as
1/4; 2/5; 3/6

I try the following command
p=[1 2 3];
q=[4 5 6];
sprintf('%d/%d; ', p, q)

But it gave me
1/2; 3/4; 5/6

Any way to work it around? Thanks
Answer: p=[1 2 3];
q=[4 5 6];
sprintf('%d/%d; ', [p; q])

Answer: You can also change display format rat:
format rat
A = [1 2 3];
B = [4 5 6];

And in the command window
A./B
ans =
       1/4            2/5            1/2

Answer: for i=1:n
sprintf('%d/%d;', p[i], q[i])


How to solve the limit for power tending to infinity

Question: How does one find
$$
\lim_{x \to 0} \left[1 + x\sin(\pi - x) \right]^{1/x}\ ?
$$
Does the limit exist? If yes, how is it found?
Answer: hint
$$f (x)=e^{\frac {1}{x}\ln (1+x\sin (x))}$$
but $$\ln (1+x\sin (x))\sim x^2 \;\;(x\to 0)$$
thus your limit is $e^0=1$.
or
$$f (x)=e^{ \sin (x)\frac {\ln (1+x\sin (x))}{x\sin (x)}}$$
and $$\lim_{X\to 0}\frac { \ln (1+X) }{  X}=1$$
Comment: Thanks a lot stackexchange
Answer: $$
\begin{aligned}
\lim _{x\to 0}\left(1+x\sin \left(\pi-x\right)\right)^{\frac{1}{x}}
& = \lim _{x\to 0}\space\exp\left(\frac{\ln\left(1+x\sin \left(\pi-x\right)\right)}{x}\right)
\\& = \lim _{x\to 0}\space \exp\left(\frac{x^2-\frac{x^4}{6}+o\left(x^4\right)}{x}\right)
\\& = \exp(0) = \color{red}{1}
\end{aligned}
$$
Solved with Taylor expansion
Answer: As Salahamam_Fatima answered, using equivalents makes the problem of the limit quite simple.
You could even go further and see how is approached the limit
$$A=\left[1 + x\sin(\pi - x) \right]^{1/x}=\left[1 + x\sin( x) \right]^{1/x}$$ Take logarithms $$\log(A)=\frac 1x \log\left[1 + x\sin( x) \right]$$ Now, use Taylor expansion $$\sin(x)=x-\frac{x^3}{6}+O\left(x^5\right)$$ $$\log(A)=\frac 1x \log\left[1+x^2-\frac{x^4}{6}+O\left(x^5\right) \right]$$ Now, use the expansion of $\log(1+t)$ and replace $t$ by $x^2-\frac{x^4}{6}+\cdots$ to get $$\log(A)=\frac 1x\left[x^2-\frac{2 x^4}{3}+O\left(x^5\right)\right]=x-\frac{2 x^3}{3}+O\left(x^4\right)$$ Now, Taylor again since $$A=e^{\log(A)}=1+x+\frac{x^2}{2}-\frac{x^3}{2}+O\left(x^4\right)$$ which, for sure, shows the limit and how it is approached.
Just for curiosity, plot on the same graph the original function and the above approximation. You will probably be surprised to see how close they are up to $x=\frac 12$.
For the fun, using your pocket calculator, compute the value of $A$ when $x=\frac \pi 6$. The exact value would be $$A=\left(1+\frac{\pi }{12}\right)^{6/\pi }\approx 1.5591$$ while the approximation would give $$A=1+\frac{\pi }{6}+\frac{\pi ^2}{72}-\frac{\pi ^3}{432}+\cdots \approx 1.5889$$
To end, suppose that you need to solve rigorously for $x$ the equation $$\left[1 + x\sin(\pi - x) \right]^{1/x}=\frac 32$$ and that the numerical method (Newton for example) requires a "reasonable" guess, ignore the cubic term and solve the quadratic $$1+x+\frac{x^2}{2}=\frac 32\implies x=\sqrt 2-1\approx 0.4142$$ while the exact solution would be $\approx 0.4622$. Newton iterates would then be
$$\left(
\begin{array}{cc}
 n & x_n \\
 0 & 0.414214 \\
 1 & 0.461216 \\
 2 & 0.462236 \\
 3 & 0.462236
\end{array}
\right)$$
Answer: The answer to the more general question "How do we find $\lim_{x \to a}\{f(x)\}^{g(x)}$?" is that we take logarithms. Thus if $L$ is the desired limit then
\begin{align}
\log L &= \log\left(\lim_{x \to 0}(1 + x\sin (\pi - x))^{1/x}\right)\notag\\
&= \lim_{x \to 0}\log(1 + x\sin (\pi - x))^{1/x}\text{ (via continuity of log)}\notag\\
&= \lim_{x \to 0}\frac{\log(1 + x\sin x)}{x}\notag\\
&= \lim_{x \to 0}\sin x \cdot\frac{\log(1 + x\sin x)}{x\sin x}\notag\\
&= 0 \cdot 1 = 0\notag
\end{align}
and hence $L = 1$.


How to change instance type without losing data on attached EBS volume

Question: I am using an Amazon EC2 instance and I have attached an EBS volume /dev/xvdf of about 3TB to it.
[centos@myec2ip ~]$ df -h
Filesystem      Size  Used Avail Use% Mounted on
/dev/xvda1      8.0G  3.5G  4.6G  43% /
devtmpfs         16G     0   16G   0% /dev
tmpfs            16G     0   16G   0% /dev/shm
tmpfs            16G  161M   16G   2% /run
tmpfs            16G     0   16G   0% /sys/fs/cgroup
tmpfs           3.2G     0  3.2G   0% /run/user/1000
/dev/xvdf       2.9T  2.0T  825G  71% /mnt/toil_20k

My instance type is currently m4.2xlarge and I want to increase it to m4.4xlarge.
As you can see, I have about 2TB data on my EBS volume which is mounted on /mnt/toil_20k. I saw a couple posts on how to change the instance type but just want to make sure as I cannot risk losing the data. How can I change my instance type without losing any data?
Answer: You would only lose the data if you deleted the EBS volume. Just stop the instance, change the instance type, and restart it. The EBS volume will remain unchanged.
If you care about the data on the EBS volume you should be taking EBS snapshots regularly anyway. Take a snapshot before you make any other changes to ensure that you have a backup.


Target Self Key - how can I make it work?

Question: I recently started playing RIFT again, and this time I prefer playing a healing role. I had a question about the target self key you can set in Settings > Interface > Combat. I disabled Auto-Self Cast as I prefer having a modifier key held in to cast a spell on myself (Like in World of Warcraft - You hold in Alt (by default) and press the skill you need to self-cast)
In RIFT I tried to get a similar setup - In the Settings menu, described above, I set the Self Cast Key to Alt, applied my settings and returned to game. I have a healing spell on [Shift-2], which, I expect having to press [Alt-Shift-2], the spell will be cast upon myself (but it doesn't). I would like to avoid creating macros all over the place just for this function. Are there any other additional methods I could try to get the self-cast to work?
I unbound the 'Mark Target' Keybinds (which by default is [Alt-1] and up). Pressing [Alt-Shift-2] attempts to cast my ability which is keybinded to [2]
Answer: If your healing spell on Shift-2 is a macro, you need to add @self before the name of the spell.
ie. cast @self Healing Breath
If this is not the case, it could be that you have a key combination set somewhere in your controls (you may not have been the one to set it) that by default uses Alt-Shift that is interfering with your ability to cast your spell.
Another thing to add to this, as far as I recall the target self binding would target you. So try pressing alt (then let go of alt) and it should target yourself, then press Shift-2 and see how that works for you.
Comment: `If this is not the case, it could be that you have a key combination set somewhere in your controls (you may not have been the one to set it) that by default uses Alt-Shift that is interfering with your ability to cast your spell.` - I will test that theory . I really do not want to create macros but it's worth a shot. fortunately my level is still low and I am really doing questing content still. But some point I will start dungeons/raids/instant adventures like mad and will need to pull out all stops to heal.
Comment: Sad to say this - there is nothing I can do but make macros as you suggested


Are there any perks to being able to dual-wield the same weapon?

Question: The ability to dual-wield the same one-handed weapon seems like the most useless ability to have out of all weapon upgrades you can earn to me (golden doesn't count).  e.g., If you wanted to dual-wield two SMGs, you'd just buy two different SMGs and equip them each in a hand and you have your "dual-wield." No need to get your weapon to level 5 or 6 just to be able to do so.  Frankly I see no reason to want to use the same weapon.
Two Weapon Dual-Wielding Pros:

You can get it as soon as you can afford it (which will be quick)
You're leveling/grinding both weapons simultaneously (HUGE!)

Two Weapon Dual-Wielding Cons:

Costs more money (is that really a problem?)
Your weapons don't have the same stats (is that really a problem?)

One Weapon Dual-Wielding Pros:

You are guaranteed upgrades for both weapons (not bad... dual high-capacity clips anyone?)
You level/grind the weapon faster? (4-5 more levels might go quicker? I see no difference)
You only had to get/buy one weapon saving money (again, is money really an issue?)

One Weapon Dual-Wielding Cons:

You have to level up the weapon before you can dual-wield (if you single the gun all the way, it will take some time)

If you asked me, the pros far outweigh the cons to dual-wield two weapons.  And remember, this are single-handed weapons so you generally be shooting in close- to mid-range so differences in the weapons' stats will be unnoticeable.  Any weaknesses in one weapon will greatly be made up by the other.
I see no difference in how quickly the weapons level up.  The time it took to get a 2-handed weapon to level 10 is taking about the same time it is taking me to get two SMGs up to level 10.
Are there any real benefits to dual-wielding a single weapon that you can't get with two weapons that I'm not seeing here?
Answer: To my knowledge, there are no particular benefits to dual-wielding the same weapon.  The level 6 unlock serves pretty much the same purpose as any other unlock:  To keep you from doing what you might otherwise do so that you have something to aim for.  Cynical way of looking at "progression," but it works.  Likewise there are no "benefits" to unlocked clothing items that would necessarily justify their not being available initially.
That said, I do tend to dual-wield the same weapon more often than not, because
1) As you said, you level a single weapon up faster instead of spreading it between two, which is nice just because you'll get the good stuff (lightweight, barrel upgrade, etc) faster.  More importantly...
2) Two weapons that behave the same way can be easier to use than two that are slightly different.  The obvious case is differing ammo capacity (try using 1911 and PT92 without extended magazine on the 1911), but even vanilla 1911 + Bull can be frustrating when one weapon's firing rate is different than the other.  In order to maximize both, you'd have to have a very strange clicking pattern.  Or in other cases, the damage dropoff may be worse on one gun versus the other.
So yeah, no strong benefit, just potentially easier to use, and another thing to unlock.
Comment: Yeah, the different ammo capacities can really hurt you at times.  Especially when you come across an enemy after killing one and you shot enough to deplete the ammo of one gun but not the other, you're then stuck with maybe 2 shots or so from one gun til you have to reload.


Terraform Dynamic module from a map

Question: I'm trying to generate a dynamic aws_db_parameter_group from a map in terraform. I was wondering if what I'm trying to do is even possible. Here is a sample code:
provider "aws" {
...
}

variable "key_values" {
  type = map(string)

  default = {
    "audit_trail" = "db,extended"
    "log_buffer" = "100"
  }
}

resource "aws_db_parameter_group" "test" {
  family = "oracle-ee"

  name = "test"

  dynamic "key_value" {
    for_each = var.key_values
    content {
        name = key_value.key
        value = key_value.value
    }
  }
}

The goal is that for each key, value in my variable, I want to generate a dynamic block with two values. One would be the key name and the second value would be value in the map. I've been reading this: https://www.terraform.io/docs/language/expressions/dynamic-blocks.html
And it looks like it is doable what I'm trying but I can't figure it out. Any suggestion?
Regards,
Answer: According to the documentation, the only possible dynamic block you can use is parameter I'll give you an example below.
resource "aws_db_parameter_group" "default" {
  name = "db-paramgroup-${var.project}-${var.env}"
  family = "mysql${var.engine_version}"

  dynamic "parameter" {
    for_each = var.custom_db_parameters
    content {
      name         = lookup(parameter.value, "name", null)
      value        = lookup(parameter.value, "value", null)
      apply_method = lookup(parameter.value, "apply_method", null)
    }
  }
  tags = var.tags
}

If you need to create multiple aws_db_parameter_groupresources in a dynamic way, you should use a count or for_each to make it work, I'll give you a new example below.

resource "aws_db_parameter_group" "default" {
  count = length(var.parameter_group_name) == 0 ? 1 : 0
  name = "db-paramgroup-${var.project}-${var.env}"
  family = "mysql${var.engine_version}"

  dynamic "parameter" {
    for_each = var.custom_db_parameters
    content {
      name         = lookup(parameter.value, "name", null)
      value        = lookup(parameter.value, "value", null)
      apply_method = lookup(parameter.value, "apply_method", null)
    }
  }
  tags = var.tags
}

in case you need more information about how a count works, you can refer to this link.
In addition, make sure you are using custom_db_parameters values like the following:
custom_db_parameters = [
    {
      name        = "database_parameter_name_one"
      value = "database_parameter_value_one"
      apply_method  = "immediate"

    },
    {
      name        = "database_parameter_name_two"
      value = "database_parameter_value_two"
      apply_method  = "pending-reboot"
    },

]

Make sure to have a proper value for the apply_method key, you have two possible values and it's important to understand if you need to apply it immediately or wait for the next reboot/maintenance window.
Comment: Thank you very much Hugo. I'm having a look at the lookup.
Comment: My pleasure, I hope it may help you!
Comment: Did this work? I tried the same approach as mentioned above, but the lookup function always returns the default value "immediate".
Comment: Yes, this code should work, the lookup built-in function is validating the values you pass through the variable called custom_db_parameters  into the for_each parameter, make sure you are passing the right value and then you can get the elements, notice if the value is not there, the lookup function will return a null by default (example above)
Comment: Hi, this code used to work but today, when I try, I got an error like this:

│ Invalid value for "inputMap" parameter: lookup() requires a map as the first argument.

Any idea?
Comment: @HugoLesta could you please share the definition of var.custom_db_parameters ?
Comment: @amir, I added more information to my previous answer, that's including the custom_db_parameters definition format.
Comment: thank you. It's clear now. Basically, you have a list of objects with 3 attributes.
Comment: Exactly, I hope it may help you, in any case, the answer was useful somehow, please mark this answer as the correct one. Cheers!

Terraform Dynamic module from a map


problems with my Python code connecting with google docs api

Question: I'm coding a Python app to automatize invoices via a google docs API but I'm having errors with the code and I don't know how to solve it
    # [START docs_quickstart]
from __future__ import print_function

import os.path
import gspread
from oauth2client.service_account import ServiceAccountCredentials

from google.auth.transport.requests import Request
from google.oauth2.credentials import Credentials
from google_auth_oauthlib.flow import InstalledAppFlow
from googleapiclient.discovery import build
from googleapiclient.errors import HttpError

# If modifying these scopes, delete the file token.json.
SCOPES = ['https://www.googleapis.com/auth/documents.readonly','https://www.googleapis.com/auth/documents','https://www.googleapis.com/auth/drive.file','https://www.googleapis.com/auth/drive','https://www.googleapis.com/auth/drive.readonly']

def main():
    """Shows basic usage of the Docs API.
    Prints the title of a sample document.
    """
    creds = None
    # The file token.json stores the user's access and refresh tokens, and is
    # created automatically when the authorization flow completes for the first
    # time.
    if os.path.exists('token.json'):
        creds = Credentials.from_authorized_user_file('token.json', SCOPES)
    # If there are no (valid) credentials available, let the user log in.
    if not creds or not creds.valid:
        if creds and creds.expired and creds.refresh_token:
            creds.refresh(Request())
        else:
            flow = InstalledAppFlow.from_client_secrets_file(
                'credentials.json', SCOPES)
            creds = flow.run_local_server(port=0)
        # Save the credentials for the next run
        with open('token.json', 'w') as token:
            token.write(creds.to_json())

    try:
        service = build('docs', 'v1', credentials=creds)

        title = 'My Document'
        body = {
        'title': title
                }
        document = service.documents().create(body=body).execute()
        print('Created document with title: {0}'.format(
        document.get('title')))
    except HttpError as err:
        print(err)

if __name__ == '__main__':
    main()
# [END docs_quickstart]

and this is the error code that I'm having
PS D:\Universidad\Proyectos de Programacion Propia\python\googledocsinvoice.restapi> python quickstart.py
<HttpError 403 when requesting https://docs.googleapis.com/v1/documents?alt=json returned "Request had insufficient authentication scopes.". Details: "[{'@type': 'type.googleapis.com/google.rpc.ErrorInfo', 'reason': 'ACCESS_TOKEN_SCOPE_INSUFFICIENT', 'domain': 'googleapis.com', 'metadata': {'service': 'docs.googleapis.com', 'method': 'google.apps.docs.v1.DocumentsService.CreateDocument'}}]">

if you know some guide or complete tutorial to Automate Document Creation with the Google Docs API like invoices and replace encapsulation values like {{productID}} I will be very grateful
I saw the Automate document creation of google channel but it wasn't very helpful https://youtu.be/-dX-fWb3ogE
Best Regards
Answer:
Make sure you also enable the Docs API in your Developers Console.

Delete the credential file ~/.credentials.json and token.json (if you ran the code before

Change the scope variable used for reading docs

var SCOPES = ['https://www.googleapis.com/auth/documents.readonly'];
to
var SCOPES = ['https://www.googleapis.com/auth/documents'];
Check more info on https://developers.google.com/docs/api/reference/rest/v1/documents/create#authorization-scopes and https://developers.google.com/docs/api/how-tos/authorizing

After the execution of code, API will authenticate again and then the issue should be resolved.


How to omit a data range with no filtering

Question: I have the following bar chart in dc.js

Built with
.dimension(dimPreparation).group(grpPreparation).x(d3.scale.ordinal())
.xUnits(dc.units.ordinal)

The dimPreparation is also used by other graphs. I'd like to hide the rightmost part of this graph, as only the first examples are of interest (those with, say, x>10), and with it increase the readability, but I can't filter because it will change the other plots. I thought I could do this changing the xUnits, but I've now spent quite some time with no success. Is it possible?
Comment: You can use .domain([]) to limit the range of an axis e.g .x(d3.time.scale().domain([minDate,maxDate]));  But will it need to be a dynamic range or static?
Comment: In this case, with an ordinal scale, it would be `.domain([0,1,2,4,5,6,7])`, say. Another option, if that doesn't work, would be creating a [fake group](https://github.com/dc-js/dc.js/wiki/FAQ#fake-groups) for this chart, that truncates the results of `group.all()`. This is similar to what the cap mixin does (although the cap mixin is not available for bar charts).
Answer: As @gordon mentioned, from here, it is possible to create a filtered group.
grpFiltered = filterPreparation(grpPreparation);
function(grpPreparation) {
    return {
        all: function() {
            return grp.all().filter(function(d) {
                return d.key <=10;
            })
        }
    }
}

Then use the grpFiltered instead.


Border is 1px less in Firefox than in other browsers

Question: I'm adding border and border radius to a div, however the border shows differently in firfox. In firebug, I can see the border is 5px, but in Layout panel, it became 4px. Could you kindly let me know why and hopefully a fix? Thanks!
Comment: provide html code or css or jsfiddle link
Comment: HI i will try this code but nothing wrong this http://tinkerbin.com/cbdu3MeW
Comment: Please add fiddle so we can have a look at html and css.
Comment: Thanks for all your help, I tested the code in jsfiddle and it shows correctly, also if I open the html as a file it's correct, only when I open the page on localhost, it still shows 4px instead of 5px. Not sure why but I'll leave it alone at first, thank you guys!
Comment: If the actual border is correct but reported incorrectly in Firefug, then it sounds like it might be a bug in firebug rather than Firefox itself? Recent versions of Firefox have a built-in dev tools feature, which can also show this info. Press [key:ctrl]+[key:shift]+[key:s] and look at the box model info there... does it show the same values as firebug?
Answer: I just ran into this problem. Reset the browser's zoom level.


S3 ManagedUpload equivalent in aws javascript sdk v3?

Question: In the older version of javascript I was using managedupload function for uploading big files to s3, which will do the queueing and manage multiparting of files. But in V3 this function is not anywhere in documentation, is that removed? or is there any alternatives? Please help...
Answer: In V3 the high level abstractions are moved to functionality specific lib packages while the client packages offer a one to one mapping of the low level public apis.
For S3 the client is in @aws-sdk/client-s3 and the high level operations are in @aws-sdk/lib-storage packages respectively.
Sample upload code for a managed upload would look like the following
const { S3Client } = require("@aws-sdk/client-s3");
const { Upload } = require("@aws-sdk/lib-storage");

const multipartUpload = new Upload({
    client: new S3Client({}),
    params: {Bucket: 'bucket', Key: 'key', Body: stream},
});

More information here.
Comment: Then see  [this answer](https://stackoverflow.com/a/70159394/1518546) for how to wait on the upload to complete.


Recommendations for staining a deck that lives in the sun all year long?

Question: I live in Colorado and have a new deck. It is hot as hell here in the summer and my deck has direct sunlight all summer.
I've been looking for a type of stain that will work well in desert like conditions. I have been warned to stay away from big box stores; even from the products that reputable companies might offer there.
What type of stain will hold up to harsh sunlight conditions? Should I be looking for another type of product, like a sealer? I just don't want it to end up looking blotchy or start to flake off.
Comment: The "warning" you've received is irrational and unhelpful. The store isn't important. The product is, and even more so are the application technique and conditions.
Comment: Are you attempting to showcase the grain, or do you just want to protect it?
Comment: I am thinking of doing a semi transparent.
Answer: Pretreating the wood with a UV absorber (like bis(Biphenyl)triazine or a benzotriazole) will be helpful. UV Boost or other UV protectants will help with whatever stain or sealant you use. You can also mix light inhibitors with stain or sealant.
Comment: Cool I will check that out. That sounds like a perfect solution if it works. Thanks for sharing
Answer: If the deck is "wood" like cedar or Redwood (suitable to be outdoors and rot resistant,) then a pre-stain is recommended before applying a penetrating stain. (A pre-stain will even-out the grain so the stain with "color" will appear uniform.) We stopped using a semi-transparent because it looks great when it goes on, but fades and is blotchy within a year or two. We now use a "heavy-body" penetrating stain. It looks just as good and lasts 5-6 years. I think most paint manufacturers call them "deck stains". Most stains are now water-based (can be cleaned up with water), but I prefer oil-based...penetrates better and is slightly longer lasting.
Remember: prep, prep, prep...all boards clean and dry.


CSSNEXT: how to use variables with media queries in CSS Next

Question: I am trying to use variables to specify breakpoints using the CSSnext plugin.
Currently my css looks like this:
@media (width <= var(--screen-md-min)) {
    background-color: var(--brand-purple-dark);
}

but when i try to run this I get the following warning in the console:
5: Missing @custom-media definition for '--screen-md-min'. The entire rule has been removed from the output.

This code works fine if I replace var(--screan-md-min) with actual pixels.  I am sure this is just a problem with syntax, but the CSSnext documentation does not make the use of variables very clear.
Answer: cssnext only implements future-proof specifications.
And per specification, it's not possible to use custom properties (that' depends on the dom (:root is html) in a media query (that does not depend on the dom, but instead depends on the device).
However, people working on CSS specifications have thought about a solution for custom media queries. It's @custom-media.
@custom-media --small-viewport (width < 30rem);

@media (--small-viewport) {
   /* styles for small viewport */
}

Some other informations

http://cssnext.io/features/#custom-media-queries
https://github.com/MoOx/postcss-cssnext/issues/253
Comment: will `@media (--small)` be `@media (--small-viewport)`?
Comment: Yes indeed, i just copied some examples too quickly


Subclassing existing custom UITableViewCell + XIB

Question: I have a custom UITableViewCell called StandardTableViewCell. This is made in a XIB with autolayout.
The cell is registered with the method registerNib:forCellReuseIdentifier:
What I am trying to do now is subclass StandardTableViewCell without making a new XIB.
Is it possible to reuse the cell without making a new XIB while keeping the cell's  File Owner?
Comment: Have you thought of creating a category instead of subclassing? Not sure what you're exactly doing, but that might work instead.
Comment: I just tried it, but I am having trouble with the setSelected:animated: method because I'm overriding it.
Comment: Ok, might not work that way then.
Answer: Have you thought of creating a category instead of subclassing? Not sure what you're exactly doing, but that might work instead.
Answer: Unfortunately that's not possible, so you have to use a less than ideal solution, here's some options:
Implement the functionality in the same Standard cell and toggle it.
Duplicate the standard nib and replace the cell class.
Don't have a standard nib and just make one for each subclass (if they are different this is probably the best idea).


What's all the hype over objectsets in Entity Framework 4?

Question: I am an intermediate user of EF in .net 3.5 and have recently moved to working with .net 4.
One thing i keep coming across when reading various tutorials is the use of ObjectSets instead of ObjectQuerys and that they are a great new feature.
What is so great about them?
Please enlighten me.
Kind regards,
Kohan
Answer: Not sure if that's what you mean in your question, but what's really cool about ObjectSet is that it implements an interface IObjectSet which means you can fake it very easily and test the code down until the data access layer.
What's even cooler, is that since the ObjectSet use generic types (IObjectSet< T >), you can have a generic repository and implement the Unit Of Work pattern.
<code>public interface IRepository<T> where T : class
{
     IQueryable<T> GetQuery();
     IEnumerable<T> GetAll();
     IEnumerable<T> Find(Func<T, bool> where);
     T Single(Func<T, bool> where);
     T First(Func<T, bool> where);

     void Delete(T entity);
     void Add(T entity);
     void Attach(T entity);
     void SaveChanges();
}
</code>
complete article here :
http://elegantcode.com/2009/12/15/entity-framework-ef4-generic-repository-and-unit-of-work-prototype/
Comment: Okay that makes sence since i was looking at tutorials on making a generic repository when i saw this "hype". Cheers.
Comment: Just out of interest and i will make a new question if needed but whats the difference between adding a Product through an objectquery, objectset, or on the objectcontext like i have shown above?
Comment: I actually don't know the answer to that question :-/
My first guess is that it has something to do with self-tracking entities vs Persistence agnostic entities when using POCO. But not so sure about that, sorry.
Comment: No probs. Thanks for the help i have added a new question for this and edited the question here for clarity sake. http://stackoverflow.com/questions/2810988/3-methods-for-adding-a-product-through-entity-framework-whats-the-difference


Equivalent parametrizations of the Radon transform

Question: Computed tomography (CT) requires integration of attenuation values along x-ray linear paths within the body at multiple different rotation angles of the x-ray tube, i.e. Radon transform. In this video, the linear paths, $L(\theta, t),$ are simplified as being parallel to each other and parametrized by a point $t$ along a perpendicular line to the path of the x-ray beam, as well as the angle of rotation $\theta:$

The question is the definition of $L(\theta,t)$ given as:
$$L(\theta, t) = \{(x,y) \in \mathbb R \times \mathbb R: x\cos\theta + y \sin\theta=t\}$$
I don't get the geometry behind this.
On the other hand, the parametrization given in this post makes total sense:

$$L(\theta,z)=(x(z),y(z))=\{(x,y) \in \mathbb R \times \mathbb R:  x= r\cos\theta - z \sin \theta \; ; \; y = r \sin \theta + z \cos \theta\}$$
as a change of coordinate basis from $(x,y)$ to $(r,z):$
$$\begin{bmatrix}x\\y
\end{bmatrix}=
\begin{bmatrix}
\cos\theta&-\sin\theta\\
\sin \theta & \cos\theta
\end{bmatrix}
\begin{bmatrix}r\\z
\end{bmatrix}$$
How to reconcile both expressions?
Comment: In particular, the set $L(\theta, t)$ as given is the tangent line to a circumference of radius $t$. Isn't that supposed to be precisely $p_\theta(t)$?
Comment: @NikiDiGiano any rotation angle has a whole set of rays sent out, not just one ray. $t$ parametrizes where along the line rotated of this angle $\theta$ this particular ray of parameter $t$ shoots out. Say for example that every ray is at some distance $\Delta_t$ from the previous.
Comment: If you increase $t$ a little bit, then you get a new line which another sender and receiver pair could shoot and measure and so on.
Comment: $L$ is supposed to represent a generic line which the machine could shoot if we can rotate to any precision of angle $\theta$ and precision of displacement $t$. They could draw more lines with different $t$ but picture would get messy.
Comment: If I understand correctly, in the case that $\theta = 0$ shouldn't $L$ describe the line $x=0$ as seen from the picture, but the mathematical expression actually describes the line $x=t$?
Comment: @mathreadler I should have added that I'm fixing $\theta$ and $t$.
Comment: @NikiDiGiano yes then you get a particular whole line which the machine shoots.
Comment: @mathreadler my point is precisely that after fixing those parameters, the line that you get is not the line that appears on the first drawing. In fact, it never crosses the origin if $t\neq 0$. So I'm confused as to what exactly $L$ is supposed to represent.
Answer: UPDATE:
The initial source describes a parameterization of the receptor line in Hesse normal form, and assuming the x-ray beams are parallel.

Considering the modified diagram from the OP:

$$\begin{align}
t &  \overset{?}= x\, \cos\theta + y\, \sin \theta \\[2ex]
&=x\,\cos\left (\phi +\frac\pi 2\right) + y\,\sin\left (\phi +\frac\pi 2\right)\\[2ex]
&= -x \,\sin \phi + y\, \cos \phi\\[2ex]
& = -x \frac y t + y \frac x t\\[2ex]
&=0
\end{align}$$
On the other hand, parametrizing with $ \varphi $ could work out:
$$\begin{align}
t &= x \cos(\varphi) + y \sin(\varphi)\\[2ex]
&=x \frac x t + y \frac y t\\[2ex]
&=\frac{x^2}{t}+ \frac{y^2}{t}\\[3ex]
\implies & t^2 = x^2 + y^2
\end{align}$$
This seems to be reflected here (page 21 of 167):

And now the second parametrization in the OP matches the first parametrization only for one of the multiple parallel lines in the diagram - specifically, the line going through the origin, which would make $r=0$:

$$\begin{bmatrix}x\\y
\end{bmatrix}=
\begin{bmatrix}
\cos\theta&-\sin\theta\\
\sin \theta & \cos\theta
\end{bmatrix}
\begin{bmatrix}0\\z
\end{bmatrix}=\begin{bmatrix}
-z\sin\theta\\
z\cos\theta
\end{bmatrix}
$$
Now, by PT, and considering the angle from the $x$ axis to the $z$ axis, $\phi = \theta+\frac \pi 2:$
$$\begin{align}z^2 &= x^2 + y^2\\[2ex]
&=x\left( -z \sin\theta \right) + y \left(z\cos \theta \right)\\[2ex]
&=x \left( -z \sin\left(\phi - \frac \pi 2 \right) \right) +
y \left( z \cos\left(\phi - \frac \pi 2 \right) \right)\\[2ex]
&=x \left( z \cos \phi\right) + y\left( z \sin \phi \right)\\[2ex]
&\implies z = x\cos\phi + y \sin \phi
\end{align}$$
And $\phi$ is exactly the equivalent of $\varphi$ in the diagram at the beginning of this answer, and $z$ is the same as $t$.


Deduplication while loading to BigQuery

Question: I have new records to insert to BQ. How do I add only those that are not there? Deduplication while loading.
for example I have in BQ
id | text
-----
1 one
2 two
3 three

I want to add
3 three
4 four

and I want to end up with
1 one
2 two
3 three
4 four

(so to deduplicate 3 three record).
I want to use python script.
Answer: You should always use set-based operations. Just use the MERGE Statement. First put them all into a dataset (I call it source) and merge them into the target dataset (called target).
MERGE dataset.target T
USING dataset.source S
ON T.id = S.id
WHEN NOT MATCHED
INSERT(id, text)
  VALUES(id, text)

Of course you can do more powerful things, you get the idea. Disclaimer: This is not tested.

Deduplication while loading to BigQuery


Expressing $d\pi_1(de_{1}(u)_{p_1})_p$ and $d\pi_1(de_{2}(u)_{p_2})_p$

Question: Working on a problem related to tangent spaces to product manifolds. The setting for the problem is the following

Let $M$ and $N$ be smooth manifolds and $\pi_1 : M \times N \to N$ the projection map and $\pi_2 : M \times N$ the second projection map. Let $p=(p_1,p_2) \in M \times N.$ Define $\alpha:T_{p}(M \times N) \to T_{p_1}M \oplus T_{p_2}N$ as $\alpha(v)=(d\pi_1(v)_p, d\pi_2(v)_p)$. Show that $\alpha$ is an isomorphism.

I've managed to get the proof to the following point. It's quite clear that $\alpha$ is linear as the components are. Also since the tangent spaces are finite dimensional vector spaces their dimensions agree. It's down to proving that $$\beta: T_{p_1}M \oplus {p_2}N \to T_{p}(M \times N) $$ defined by $\beta(u,v)=de_{1}(u)_{p_1} + de_{2}(u)_{p_2}$ where $e_1 : M \to M \times N, e_1(x)=(x,p_2)$ and $e_2 : M \to M \times N, e_2(x)=(p_1,x)$ is the inverse of $\alpha$. So I'm considering $$(\alpha \circ \beta)(u,v)= (d\pi_1(de_{1}(u)_{p_1} + de_{2}(u)_{p_2})_p, d\pi_2(de_{1}(u)_{p_1} + de_{2}(u)_{p_2})_p).$$
As the differentials are linear I have that $$d\pi_1(de_{1}(u)_{p_1} + de_{2}(u)_{p_2})_p= d\pi_1(de_{1}(u)_{p_1})_p + d\pi_1(de_{2}(u)_{p_2})_p.$$
Here I'm stuck I don't know how to express $$d\pi_1(de_{1}(u)_{p_1})_p$$ or $$d\pi_1(de_{2}(u)_{p_2})_p$$ in any way since they're not acting on anything. If I would have them act on say $h \in C^\infty(p)$, then I would have that $$d\pi_1(de_{1}(u)_{p_1})_p(h)= de_{1}(u)_{p_1}(h \circ \pi_1) = u(h \circ \pi_1\circ e_1)$$ but I'm so confused with this already and don't know what to make of this... Is there some form for these two differentials?
Comment: Are you aware that $d(F\circ G)_p = dF_{G(p)}\circ dG_p$?
Answer: Using
$$d\pi_1(de_{1}(u)_{p_1})_p(h)= de_{1}(u)_{p_1}(h \circ \pi_1) = u(h \circ \pi_1\circ e_1), $$
since $\pi_1 \circ e_1 : X\to X$ is the identity,
$$d\pi_1(de_{1}(u)_{p_1})_p(h)= u(h),\ \ \forall h\in C^\infty(p). $$
Thus $d\pi_1(de_{1}(u)_{p_1})_p= u$. Let's try another one:
$$d\pi_1(de_{2}(u)_{p_2})_p (h) =  u(h\circ \pi_1\circ e_2).$$
This time, $\pi_1 \circ e_2 : Y \to X$ is the constant function $y\mapsto p_1$. Thus $h\circ \pi_1\circ e_2$ is constant and so (by property of derivation)
$$u(h\circ \pi_1\circ e_2) = 0.$$
Since this is true for all $h$,
$$d\pi_1(de_{2}(u)_{p_2})_p =0.$$


What is an anti-pattern?

Question:
"Using checkboxes (or custom analogs) to initiate selection is an explicit anti-pattern for mobile."

What does Google mean by anti-pattern?
Source: http://www.google.com/design/spec/patterns/selection.html
Comment: *About making questions on this site:
Search, and research
**Have you thoroughly searched for an answer before asking your question? Sharing your research helps everyone. Tell us what you found and why it didn't meet your needs. This demonstrates that you've taken the time to try to help yourself**, it saves us from reiterating obvious answers, and above all, it helps you get a more specific and relevant answer!.*
**It's clear not a single try of search has been made.**
Comment: @rewobs I did Google it first but I admit I must not have been paying attention, because the answer is right there. However, the top results are typically about social and software (programming) anti-patterns, so I think an answer from the UX community is still valuable.
Answer: An anti-pattern is much like a regular design pattern in that it is a common solution to a general problem. The difference is that an anti-pattern is a bad solution to the problem.

What is an anti-pattern?


ReferenceError: React is not defined wix navigation react-native

Question: When trying to register a screen wrapped with providers in wix react-native-navigation it shows React is not defined in chrome console and the screen dosent load it stays white. I am using RN 0.63.4 and RNN 7.8.3
    Navigation.registerComponent(
    Screens.Login,
    () => (props) => (
        <Provider store={store}>
            <Login {...props} />
        </Provider>
    ),
    () => Login
)

Comment: Insert your code.
Comment: Did you try @Alvaro Roman 's answer?
Answer: Just add import React from 'react' at the top! That did it for me.


What's the actual value of an if-statement executing a command?

Question: I do not quite understand what the following if-statement actually does, in the sense of what the condition outputs could possibly be:
if linux-command-1 | linux-command-2 | linux-command-3 > /dev/null

I understand the execution as the following:

Linux Command 1 gets executed, it's output is PIPED into Linux-Command-2 as input.
Linux Command 2 gets executed with LC1's input, it's output is PIPED into Linux-Command-3.
Linux Command 3 gets executed with LC2's input, it's output is redirected into /dev/null, basically doesn't appear.

But what about the actual if-statement? What's responsible for it becoming true or false?
To further elaborate, here's an example with actual commands:
if ps ax | grep -v grep | grep terminator > /dev/null
then
echo "Success"
else
echo "Fail"
fi

I do know that the functionality behaves in the way that if any output occurs (Process is running) in that execution the condition is True, if nothing occurs (Process not running), the condition is False.
But I don't understand why or how it's coming to that conclusion? Is the shell if statement always expecting a string output as True?
I've also just discovered pgrep but the question would also remain if the statement were
if pgreg -f terminator > /dev/null

Answer: In your case you are testing  the exit status of grep itself, which will return false (1) if there was no match and true (0) if there was one
if ps ax | grep -v grep | grep terminator > /dev/null
then
  echo "Success"
else
  echo "Fail"
fi

you could put a "-q" instead of redirection to /dev/null
if ps ax | grep -v grep | grep -q terminator
then
  echo "Success"
else
  echo "Fail"
fi

I would execute my commad and test the $?
ps ax | grep -v grep | grep terminator
if [ $? -eq 0 ]; then
    echo 'it is ok'
else
    echo 'is is ko'
fi

If you do:
if linux-command-1 | linux-command-2 | linux-command-3 > /dev/null

only the result of the last command matter
if everything is important put "&&" instead
if  ps -ae | grep  'bash' | grep  'pty0' && ls . >/dev/null; then
  echo "bash is in the house"
fi

that will fail because there is no not_exist
if  ps -ae | grep  'bash' | grep  'pty0' && ls not_exist >/dev/null; then
  echo "bash is in the house"
fi

Comment: Which grep, the first or the second?
Comment: The second, the first will be ignored, so far I can tell. So it is actually the exit code I'm testing for?
Comment: Is that independent of the command? So, will `if command` always test for the exit code of the last command?
Comment: Also, I prefer the redirection to `/dev/null` actually, because it's a little more self-explanatory to the eye. With your proposition I would need to know that the `-q` runs `grep` in silent mode, or others would need to look it up if they look at it. I'm a python guy, so readable code is preferred to me.
Comment: for me the condition  with the "-q" is on your last grep. But you are agree that if the first fails the second will too
Comment: The first one can't really fail because you grep for the process grep and invert the output, meaning all processes other than grep. And grab was called in the moment it was also searching for itself, so... can't really wrap my head around how it could fail, or at least it's irrelevant to the question. Could you clarify your answer, that the if-statement actually checks for the exit code of the executed commands, irrelevant of the command?
Comment: Yes HackXit you are right. I was talking for general case. for example if it was not for the grep process. But thank you to point it out.


Difference between ptr and &ptr

Question: I wrote a simple C++ program as written below:
void main()
{

    int *ptr;
    ptr=new int;
    *ptr=10;

    cout<<ptr<<endl;
    cout<<&ptr<<endl;
    cout<<*ptr<<endl;
}

What's the difference between the first two statements. Both give an address. Since the new operator reserves a memory in the heap, which statement gives the address of the dynamically reserved memory in the heap, ptr or &ptr. Now if we do:
delete ptr;

This will free the memory dynamically reserved in the heap earlier but &ptr still points to that memory location. Why ??
I've been looking at this link for help:
https://users.cs.jmu.edu/bernstdh/web/common/lectures/slides_cpp_dynamic-memory.php
Comment: `main()` must always `return` `int` in [tag:c++]!
Comment: @Johnsyweb You put backticks around return to indicate that it's code, but in that case, your claim is wrong. It must return `int`, but it does not need a `return` statement.
Comment: I thought the standard doesnt require a return, but many compilers bitch if you have function returning a type that dont actually do a return. Thought I agree, main need to claim a return type of int. void is an unacceptable weirdness that should be stamped out.
Comment: @hvd: You're right... I should have said `main()` must always *have a return type of* `int`.
Comment: @RichardPlunkett: They do, because in other functions the `return` is required. However, `main` is a special case and it is explicitly allowed by C++ to omit the `return` statement in `main`.
Answer: cout<<ptr<<endl;

This prints out the value held by ptr. That corresponds to an address, in this case the address of a dynamically allocated int.
cout<<&ptr<<endl;

This prints out the address of the pointer itself.

delete ptr; ... This will free the memory dynamically reserved in the heap earlier but &ptr still points to that memory location. Why ??

Because that is what delete does: it de-allocates whatever ptr points to. You can re-use ptr to point to something else, or set it to nullptr, but you have to be explicit about it. Bear in mind that many pointers can point to the same dynamically allocated memory address, so setting one of them to nullptr does not guarantee safety (thanks to @hvd for clarifying this part of the question).
Note*: Pointers are "special" because they hold values which are addresses. But they also have addresses of their own, like any other variable. This may be clearer if expressed with a non-pointer type:
int i = 42;
std::cout << i << std::endl;  // prints value of i, i.e 42.
std::cout << &i << std::endl; // prints address of i.

Comment: I think the last "Why ??" is about why `ptr` isn't reset to a null pointer, or something like that. There can be any number of variables that point to the same address, so that couldn't work reliably enough to be useful, but the OP might not realise that.
Comment: Well the difference between ptr and &ptr is clear. But the issue is that "delete" is not de-allocating what "ptr" points to. For example when I print "ptr" even after doing "delete ptr", it gives the same address "ptr" points to, unless I explicitly do ptr= NULL. so why do have this "delete" at all ? why just we don't rely on NULLING it up ??
Comment: @user3054062 `delete` *is* de-allocating what `ptr` points to. That is its job. But it doesn't make `ptr` a `nullptr`, it leaves it pointing to the same place. Accessing this place would be *undefined behaviour*. So, it `ptr` is to be used after the call to `delete`, you have to either make it point to a valid location, or set it to `nullptr` (or `0` or `NULL` of you don't have C++11).
Answer: So following gets printed :
cout<<ptr<<endl;  // Address pointed by ptr

cout<<&ptr<<endl;// Address of ptr

cout<<*ptr<<endl; // Value conatined in address pointed by ptr

Answer: In the second case(&ptr) you get the address of the pointer. Yes, a pointer is an object and it in turn has a pointer. So you would assign &ptr to a variable of type int **.
Answer: The & operator has at least three possible meanings:

When following a type name, e.g. int & or int&, it promotes the type to a reference. int& p = q; means p is a reference to an integer.
When preceeding a variable name or value it means address of. int* p = &q; means that p is a pointer to an integer, and it's value is the address of variable q (where q is an integer).
Bit-wise and.

So your
cout << &ptr << endl;

hits #2 and means "print the address of ptr".
Comment: Well The "ptr" and "&ptr" problem is clear but the issue which is still unresolved is that "delete" is not de-allocating whatever ptr points to, unless we do ptr = NULL. For instance I wrote the code:

void main()
{

 int *ptr;
 ptr=new int;

 cout<<ptr<<endl;
 cout<<&ptr<<endl;

 delete ptr;
// ptr= NULL;

 cout<<ptr<<endl;
 cout<<&ptr<<endl;
}
 and the output it gives is
0x00431810
Comment: `ptr` is a pointer, when you `delete` what it's pointing to, the pointer is unaffected. `&ptr` continues to be the address of it. See my answer [here](http://stackoverflow.com/questions/19672816/pointer-errors-in-the-method-of-transmissionc/19673143#19673143). In your context, `delete` is equivalent to when they close the gate - it doesn't wipe your piece of paper clear nor take it away, but it does allow the airport to use that gate for another flight.
Answer: ptr is pointer to the new int you allocated on heap.
&ptr is pointer to ptr itself which is created on stack in function call for main.
On delete ptr int you allocated on heap is unallocated. &ptr is valid, it is pointing to ptr pointer variable which exists on stack. You can still use ptr to point to something else of type int.

Difference between ptr and &ptr


Finding Common Wire on Laars JVT boiler

Question: Replacing mercury thermostat with wifi.  I have just a red and white wire connected to current thermostat and boiler.  There is a green present, but it isn't hooked to anything on boiler.  So I can use the green if I can identify the common on the boiler.   I think I've found the blue common, but would like to confirm.  I believe I just need to connect the green wire to the wifi thermostat and to the bottom post of the first picture,  Green would then be my common.  Am I on the right track?
My thermostat wiring is routed through several pumps, but final connection is here on the boiler.

Inside, a blue wire is connected to the bottom terminal of above picture (circled in blue on left), but there is also a red wire connected to that post.  Circled on the right side is the blue wire connecting to post numbered 6.
Answer: Tap the bundle of yellow wires connected to the transformer
If you'll look at the wiring diagram for your system, you'll notice that your R terminal is connected via a red wire to the transformer via an inline fuse, and the other secondary terminal has yellow wires connected to it, as well as a green ground wire.  Furthermore, there is a crimped splice of several yellow wires hanging below the transformer in your photo -- cutting that splice off, stripping the ends, and splicing a jumper to it using a wirenut (I'd use 14AWG yellow stranded THHN for this, it's cheap and easy enough to get) will let you bring that common wire out via a jumper to where it needs to be.
Comment: @Jim -- we thank people around here by upvoting and/or accepting their answers :)
Comment: Thanks,   I get it.   The red coming out of the transformer is the hot and the yellow is the common.   The sure fire way to get a common is to just connect it to the yellow.  Easiest spot is at the wire nut/crimped splice.    Thanks again.

Finding Common Wire on Laars JVT boiler


Julia macros: @__FILE__ @__LINE__ in macro

Question: This code:
macro FL(message)
    return @sprintf("%s:%d | %s", @__FILE__, @__LINE__, message) # line 2
end
println(@FL("m")) # line 4

prints fl.jl:2 | m. How can I make it print fl.jl:4 | m?
Comment: @phg In julia `#` marks start of comment, not`//`.
I suggest that you leave reformatting code to people who know the language -- though I do appreciate you did leave a comment for the asker.
Comment: Hi @Rolf, I formatted you code in markdown. Please review it to ensure the meaning is preserved, given that line numbers are important here.
Comment: @LyndonWhite I do know Julia. I just program in a lot of other languages, too ;) Thanks for the correction!
Comment: @phg ah yes, the good old [code-switching](https://en.wikipedia.org/wiki/Code-switching) problem. I know it well.
Comment: Hi @phg  thank you for your efforts.
Answer: The following will work in the current Julia nightly:
macro FL(message)
    return :(@sprintf("%s:%d | %s", $(string(__source__.file)), $(__source__.line), $(esc(message)))) # line 2
end
println(@FL("m")) # line 4

This was made possible by the following implementation pull request. It is not possible in any officially released version, unfortunately.
Comment: Thank you for the reply. Unfortunately I don't get Julia nighly running. I get : CommandLine Error: Option 'help-list' registered more than once!
LLVM ERROR: inconsistency in registered CommandLine options. I will try to find figure this out.
Comment: That's due to multiple LLVM versions loaded in the same process. IIRC there are open issues in Julia base and OpenCL.jl about it (not sure if any resolution).
Answer: Though there may be more elegant ways to do this, if you don't want this to block your progress on other fronts, why not just pass the line number to the macro...
macro FL(message, line)
    return @sprintf("%s:%d | %s", @__FILE__, line, message)
end
println(@FL("m", @__LINE__))

Comment: Thank you for your reply. Of course this is a solution. But I want to avoid this, especially because I want to add @__FILE__.
Comment: Then you can just add `@__FILE__` as an argument too.


How to send multiple objects to web method through ajax call

Question: i want to send 2 objects in ajax, among the two objects one object contains list of records
Can any one help how to do that, i am using following block of code but not working
var obj = {};
obj.ChangeDetails = "";
obj.ChangeInformation = "";
obj.ChangeVersion = "";
obj.CSProduct = "";
obj.Description = $("#caseDesc").val();
obj.EndDate = $("#newSchEdDt").val();
obj.EndDateSpecified = $("#newSchEdTime").val();
obj.Environment = $('#caseEnv').find(":selected").text();
obj.Operation = "";
obj.RiskAssessment = $("input[name=ccRisk]").val();
obj.SiteEnvironment = "";
obj.SOPDetails = $("#ccSOP").val();
obj.SOPReferenced = "";
obj.SOPVersion = $("#ccSOPVer").val();
obj.StartDate = $("#newSchStDt").val();
obj.StartDateSpecified = $("#newSchStTime").val();
obj.Subject = $("#caseSubj").val();

var Members= {};
Members.cstdetails = newCustList;

var postData = {
    objEmp: obj,
    objMem: Members
};

$.ajax({
    type: "POST",
    url: "c9newcaseModel.aspx/CreateCase",
    contentType: "application/json; charset=utf-8",
    dataType: "json",
    traditional: true,
    data: JSON.stringify(postData),

    success: function (result) {
        alert(result.d)
    },
    error: function (xhr) {
        alert("responseText: " + xhr.responseText);
    }
});

public static string CreateCase(CreateCase objEmp, srcCustlst[] objMem)
{

}

I have created CreateCase and srcCustlst classes with corresponding properties.
Thanks in Advance
Answer: You cant POST two separate objects to a POST API.
Rather what you can do is enclose an the two classes within another wrapper class and then pass it as input to your method and form JSON from your client side appropriately.
Different data can be sent to a POST method via URL or via body. But in your situation since both are complex objects better way is to use a wrapper class which contains the two classes that you have and pass data appropriately from client side.
wrapper class can be as below:
public class RequestWrapper
{
    public CreateCase objEmp { get; set; }
    public srcCustlst[] objMem { get; set; }

}

and may be in your post method change your data to data: postData,


Asbestos in older homes

Question: I suspect the home I am living in has used some asbestos in is walls. Asbestos causes a serious lung condition in the long run. How can I tell if asbestos was used? What if it is not on the surface of the walls? If it is removed, how do I know some traces do not stay in the air?
Thanks.
Comment: I think the question should be ," Why would there be any asbestos in the home ?"
Answer: Depending on where you live abstos abatement can be a DIY project but to answer your question if not disturbed and or encapsulated with paint there is no risk. The risk comes from disturbing it. Things like popcorn ceiling texture many times had asbestos in it. What is the risk to remove asbestos? If done with the proper equipment and decontamination procedures there is not much risk at all. People worked for years in plants without having problems others maybe just a few exposures were enough. Many building materials used to contain asbestos some of the more common ones are pipe insulation not the pink glass more like a cardboard material, flooring many types of square tiles and even rolled flooring. Siding most was like shingles, and popcorn ceilings as mentioned above. I would not be concerned about living in a home that had it but would have materials tested before doing any remodeling. Then find out what your local code is. In my area if double bagged and taken directly to a land fill not a transfer station it is legal to do your own work. Things like respirators, tyvek suits rubber boots &gloves are some items needed to do it safely.
Comment: Thank you for your answer. I am actually planing on painting the walls. How can I check if the walls have asbestos? What about pipes, can I check if they as wrapped in asbestos? What would that look like?
Comment: Was asbestos used in my home to prevent fire it was it used as a building material?
Comment: Yes asbestos was used in many types of floor coverings, popcorn ceilings and exterior siding. I think most people are aware of the insulation but not some of the other things like popcorn ceilings (the thick spray on sponge like texture many brands were loaded with asbestos). These are the ones I remember there are probably others. If the pipe insulation is like a dense cardboard layered it is probably asbestos. I don't remember any wall coverings having asbestos but lead paint was the standard for many years. Both not a hazard if covered with modern paint and you don't chew on the wood work.
Answer: Asbestos abatement (removal) is not a DIY project.
Contact several reliable abatement contractors and get evaluations and estimates for your home.
If done right there will be no trace of it left when they are done.
Good Luck!
Comment: Note that if the asbestos isn't disturbed it is generally not needed to remove it. Asbestos is only a problem when it becomes airborne, so leaving it as is is a valid option. If you're planning on doing some work on the area, then you'd definitely want to have an abatement company come in and deal with it at that point.
Comment: Yes but I need to paint the walls. How can I identify whether asbestos is in my walls?
Comment: Laymen can't normally identify asbestos or whether it is the friable type or not. That is why you leave it to someone trained for this.

Asbestos in older homes


asp.net MapPageRoute loading page twice

Question: Not sure whats going on, but I have a rewrite with two parameters. For some reason the page is loading twice when it's called. I know that it's the rewrite because it works fine when it's just one parameter. Thanks for any help.
This is in my Global.asax
<code> routeCollection.MapPageRoute("RouteForAlbum", "album/{autoID}/{albumName}", "~/SitePages/AlbumView.aspx");
</code>
This is on my page load
<code>if (!Page.IsPostBack)
{
    string id = Page.RouteData.Values["autoID"].ToString();
    string albuname = Page.RouteData.Values["albumName"].ToString();
}
</code>
Answer: Wow, found the answer after more searching. If you have javascript reference with ../ this causes issues with URL rewritting.
asp.net Multiple Page_Load events for a user control when using URL Routing
Answer: UDPATE:
This can also happen when using CSS3PIE together with ASP.net Routing and the two don't play nicely together.
Any CSS3PIE css styles with a URL in the value can cause the target page to execute the code behind multilple times. For me specifically, it was these two lines:

behavior: url(PIE.htc);
-pie-background: url(bg-image.png) no-repeat, linear-gradient(#FFFFFF, #53A9FF);

Changing the above two lines to start with a leading slash "/" fixed it along with specifying the whole path to the files.

behavior: url(/scripts/PIE-1.0.0/PIE.htc);
-pie-background: url(/scripts/PIE-1.0.0/bg-image.png) no-repeat, linear-gradient(#FFFFFF, #53A9FF);
Comment: Also, a side note about using asp.net routing and unnecessary code behind execution, is that the routing also seems to run the code behind for other pages other than the one requested in some scenarios. After some trial and error, I noticed that it will not do this if your routeUrl param (2nd param on MapPageRoute) points to a different routeUrl directory than that of the requested page.

asp.net MapPageRoute loading page twice


Equalities of ideals in Q[x,y]

Question: I'm trying to prove something about polinomyal ideals. So I have to use this proposition:
Let  $I \subset k[x_{1}, \ldots, x_{n}] $ be an ideal, and let $f_{1}, \ldots, f_{s} \in k[x_{1}, \ldots, x_{n}].$ Then these are equivalent:
$(i) f_{1}, \ldots, f_{n} \in I.$
$(ii) \left<f_{1}, \ldots, f_{n}\right> \subseteq I.$
And I have to prove this equality in $\mathbb{Q} [x,y]:$
$\left< x+y, x-y\right> = \left< x,y \right>$.
I tried to do this first $\left<x+y, x-y \right> \subset \left< x,y \right>$ like this:
Let $\left< x,y \right> = I \in \mathbb{Q}[x,y] $ an ideal, and let $x+y, x-y \in \mathbb{Q}[x,y].$ So I want to say that $x+y, x-y \in \left< x,y \right> $ and here is where I don't know if I'm wrong or what:
First, I think, is obvious that $x+y \in \left< x,y \right>$, since $ \left< x,y \right> = h_{1}(x) + h_{2}(y),$ for $  h_{1},h_{2} \in \mathbb{Q}[x,y] $, then I say that $h_{1}=h_{2}=1$ so $x+y \in \left< x,y \right> $ and then I use the same argument for $x-y$ but with $h_{2}=-1.$ And then I use the proposition to say that $\left< x+y, x-y\right> = \left< x,y \right>$.
And I don't know if this is correct, if not, I appreciate if someone could help me proving that equality. Thanks!
Comment: I suspect your notation is off on $ii$, since that's usually the notation for an ideal generated by those polynomials, so it should be a subset, not a membership
Answer: To prove that you could do something like this:
Let $I_1=\left<x+y,x-y\right>$ and $I_2=\left<x,y\right>$
Using the proposition, if you prove that $x,y\in I_1$ you get $I_2\subseteq I_1$. If you prove that $x+y,x-y\in I_2$ then you prove $I_1\subseteq I_2$. If you prove both you get $I_1=I_2$.
For example, to prove $x+y\in I_2$.
As $x,y\in I_2$ and $I_2$ is an additive subgroup $\mathbb{Q}[x,y]$, we get $x+y\in I_2$. The rest of it can be proved the same way.
So, it's exactly as you say, but you should order it a little. It will help you if you think what is it that you want to prove, and what does the proposition you use mean.
In this case, furthermore, it is not needed the complete concept of an ideal to show the result, it's only needed that it's an additive subgroup ("Linear combinations" are not totally needed, just sums and additive inverses)
Comment: So, since I want and I'll be working every time on fields  I can always think of the ideals as additive subgroups?
Comment: Not necessarily. It is only in this particular case.

You can think of the ideals as additive subgroups, but in most cases you need the other property too. For example, if you were working with the ideals:

$I_1=\left$ and
$I_2=\left$ to prove they are the same you'll have to use the second property.

Equalities of ideals in Q[x,y]


Enabling multi-touch on a non-multi-touch touchpad

Question: I have Ubuntu 13.04 on my HP Pavilion G4-1025TX, which I don't think has multi-touch (it didn't have multi-touch when I was on the bundled Windows 7). Is it possible to enable multi-touch for this machine on Ubuntu?
Comment: The HP [Product Specifications](http://bizsupport1.austin.hp.com/bizsupport/TechSupport/Document.jsp?objectID=c02748351⟨=en&cc=us&taskId=101&prodSeriesId=5046252&prodTypeId=321957) says your touchpad supports multi-touch. Go to "System Settings" -> "Mouse & Touchpad" and check "Two finger scroll". Try to scroll a page moving two fingers up and down.
Comment: Thank you very much, I didn't know my touchpad is multi-touch!
Answer: If you download the Synaptics TouchPad driver from the Ubuntu Software Centre (search for synaptiks).
This worked well for me. You have to auto start it by putting it in the Start Up Programmes with synaptikscfg init. Apart from that it's simple and straight forward.


Subtotal for a partition by column value

Question: If I have data such as:
K1   K2  V3
100  A   C
100  A   C
100  A   D
200  B   D
200  B   D
200  B   C

I'm partitioning my data by K1 & K2, so I can get the totals with a count:
count(V3) over (partition by K1, K2)

Which yields:
K1   K2  V3  Total
100  A   C   3
100  A   C   3
100  A   D   3
200  B   D   2
200  B   E   2

How can I get a subtotal for the partition referencing the value in the row?  So result would be:
K1   K2  V3  Total Subtotal
100  A   C   3     2
100  A   C   3     2
100  A   D   3     1
200  B   D   2     1
200  B   E   2     1

Comment: Wow.  This is what happens when I spend too much time staring at the same problem.
Comment: ...you appear to have some errors in your data (where is the `E` coming from, the total doesn't match, you've gained/lost a row)
Answer:  SELECT
      K1,
      K2,
      V3,
      count(V3) over (partition by K1, K2) as Total,
      count(V3) over (partition by K1, K2, V3) as Subtotal
FROM DataTable


Function average and stdDev const int tab[ ]. Average problems

Question: I have to use:
float average(const int tab[], int size);
float stdDev(const int tab[], int size);
to printf average and stdDev in C.
I have problem with average and i think with const int.
When i add const int tab[101] i have error with a1;
So how can i make it work with const int (if i can).
And if it is anything wrong with this code.
Any help will be helpful.
#include<stdio.h>
#include<math.h>

float average(const int tab[], int size);
float stdDev(const int tab[], int size);

int main()
{
float ave, std;
int a1;
int j;
int tab[101];
printf("Podaj liczby: ");
for(j=0; j<=99; j++)
{
    a1 = scanf("%d", &tab[j]);

    if(a1<1)
 {
    printf("Incorrect input");
    return 1;
 }
 if(tab[0]==0)
 {
    printf("not enough data available");
    return 2;
 }
    if(tab[j]==0)
    {
        break;
    }

}

ave = average(tab, j);
printf("%.2f\n", ave);
std = stdDev(tab, j);
printf("%.2f", std);
return 0;
}

float average(const int tab[], int size)
{
int i;
float y=0, x;

if(size<=0)
{
    return -1;
}

for(i=0; i<size; i++)
{

    x = x + tab[i];
}
y = x/size;
return y;
}
float stdDev(const int tab[], int size)
{
int i;
float y, z, z1, z2=0, z3=0;
if(size<=0)
{
    return -1;
}

y = average(tab, size);

for(i=0; i<size; i++)
{

    z = tab[i] - y;
    z1 = pow(z, 2);
    z2 = z2 + z1;
    z=0;
    z1=0;
}
z3 = sqrt(z2/size);
return z3;
}

Comment: Your code compiles just fine, what is the error you want to solve? It will not run fine though, because you are using `x` uninitialized.
Comment: I use in school special program to check my work and it sometimes do error.
np enter 7 0
ave 116671774720.00⏎
std 0.00
I dont know why
Comment: I think a problem is that i have to add const int tab[101] but this doesnt work good
Comment: No, it is completely unrelated, see my answer below.
Answer: You define the variable x in average here:
float y=0, x;

without giving it a value. Then here:
x = x + tab[i];

you are reading its value without setting it anywhere beforehand. Because you never gave x a value, its value will be indeterminate and reading it will cause undefined behavior, which means that your program could e.g. print garbage output.
Always initialize your variables:
float y=0, x=0;


Access warns that there is an operator error in the case clause in the query

Question: Access warns that there is an operator error in the case clause in the query
(line 3)
can't find what is wrong
SELECT x, y, z
FROM (SELECT * FROM (SELECT x,y,
CASE WHEN Forms![g]![d] !=0  THEN z  ELSE Forms![g]![d] END) AS Z
...;

Answer: There are actually 2 separate problems with that line.

Access has no CASE WHEN statements, and uses either the IIF function or SWITCH function instead
!= is not a valid operator in Access. The not equals operator is <>.

Corrected:
IIF(Forms![g]![d] <> 0, z, Forms![g]![d]) AS EXP


two column layout with same proportions of content area as window is larger then content area

Question: Sorry for the awkward working.
The content area lets say is 1000px, I want the left column to be 25% and the right to be 75%, yet as the window is wider then 1000px, I want the columns to keep the same proportions, yet have their backgrnd-color bleed off to teir corresponding sides. Here are a couple of images to  try and help illustrate the point:
https://i.stack.imgur.com/hvWrp.jpg
Here the image is 25% left column and 75% right column
https://i.stack.imgur.com/hvWrp.jpg#1
Here, the content area is the same as above, yet with the left column being 25%% of the left column and 75% of the right, yet there backnd colors, extend to the edge while keeping that internal proportion.
I know there is a way to do this via js, just wandering if there is a way to do it with just css/html
also, the black area would have an image that covers all of the black area.
Thanks for any help!
EDIT: ended up using calc() as it's been supported for a bit
Answer: There are probably several ways to do what you're asking. Here's a codepen.io pen showing one way: http://codepen.io/anon/pen/zxYgRp
And I've copied the code here:
HTML

CSS
body {
  margin: 0;
  padding: 0;
  background: #ff0000; /* Old browsers */
  background: -moz-linear-gradient(left, #ff0000 0%, #ff0000 50%, #cccccc 51%, #cccccc 100%); /* FF3.6+ */
  background: -webkit-gradient(linear, left top, right top, color-stop(0%,#ff0000), color-stop(50%,#ff0000), color-stop(51%,#cccccc), color-stop(100%,#cccccc)); /* Chrome,Safari4+ */
  background: -webkit-linear-gradient(left, #ff0000 0%,#ff0000 50%,#cccccc 51%,#cccccc 100%); /* Chrome10+,Safari5.1+ */
  background: -o-linear-gradient(left, #ff0000 0%,#ff0000 50%,#cccccc 51%,#cccccc 100%); /* Opera 11.10+ */
  background: -ms-linear-gradient(left, #ff0000 0%,#ff0000 50%,#cccccc 51%,#cccccc 100%); /* IE10+ */
  background: linear-gradient(to right, #ff0000 0%,#ff0000 50%,#cccccc 51%,#cccccc 100%); /* W3C */

}

#wrapper {
  max-width: 40em;
  margin: auto;
  position: relative;
}

nav {
  background: #f00;
  width: 25%;
  height: 100%;
  position: absolute;
  top: 0;
  left: 0;
  border: 1px solid black;
}

#main {
  background: #ccc;
  min-height: 500px;
  border: 1px solid black;
}

Basically, we're creating a wrapper with a maximum width, then adding a background gradient that goes from the nav color to the main right column color right in the middle. I used this CSS gradient generator: http://www.colorzilla.com/gradient-editor/
I added borders around the nav (as left sidebar) and main content area so you can see where they end and where the background color begins.
Comment: Thanks, this definitely works, but I guess I'm looking for a "true" way to carry the color to the edges as there will be a background image that extends the width of the black/gray area.
Comment: I know there is a way to do this via js, just wandering if there is a way to do it with just css/html
Answer: I'm adding another answer to show how to do it a different way based on OP's clarification. You'll notice I use background images.
Here is the code pen: http://codepen.io/anon/pen/PwoMxw
HTML

CSS
body { margin: 0; padding: 0;}

#sidebar {
    width: 25%;
   background-image: url(http://i.imgur.com/xDe7IaC.jpg);
    position: fixed;
    min-height: 100%;
}

nav {
   max-width: 100%;
   width: 16em;
  position: absolute;
  top: 0;
  right: 0;
  min-height: 100%;
  border: 1px solid blue;
}

#main {
  width: 75%;
  position: absolute;
  top: 0;
  right: 0;
  height: 100%;
  background: url(http://i.imgur.com/OYjJ4yS.jpg);
}

#main-inner {
  width: 48em;
  max-width: 100%;
  position: absolute;
  left: 0;
  top: 0;
  height: 100%;
  border: 1px solid red;
}

There is liberal use of position: absolute here and the proportions would have to be refined, but this is one way to accomplish the goal.
Comment: ya that's as far as I've gotten, but it's not centered.


passing cards around a table

Question: $71$ people are seated around a circular table. Each of the numbers $1, 2, 3, . . . , 71$ is written on two pieces of yellow paper and, randomly, each person is given two of the pieces of yellow paper. Once a minute each person passes to the person to their right the piece of yellow paper with the smaller of their two numbers. Prove/disprove that there must come a time when someone's two pieces of yellow paper contain the same number.
So I have found a counterexample when $n$ is $70$: give every person one piece of paper containing $1$-$35$ and every person one piece of paper containing $36$-$70$. Then the $1$-$35$ will always be passed and they will never intersect. However with $n=71$ this becomes really strange: I believe that there still exist a counterexample but I cannot find it out. Some suggestion or help will be appreciated.
Answer: Let $n$ be the number of participants, and suppose $n$ is odd (e.g., $n=71$).

If $n=1$, the truth of the claim is obvious.

Thus, assume $n \ge 3$.

Label the participants, in counterclockwise order, as $P_1,...,P_n$, and for convenience, let $P_0$ be an alternate notation for $P_n$.

Let $t$ represent "time", measured as the number of transitions which have transpired.

For each nonnegative integer $t$, let
$$s(t) = \Bigl(\bigl(x_1(t),y_1(t)\bigr),...,\bigl(x_n(t),y_n(t)\bigr)\Bigr)$$
be the state at time $t$, where $x_k(t),y_k(t)$ are the min and max values for $P_k$ at time $t$.

Since the number of possible states is finite, the states must eventually repeat in a cycle of length $m$, say.

In every transition, of the two values of $1$, at least one of them must move so as to replace a value greater than $1$, hence a transition always yields a state different than the previous one.

It follows that $m > 1$.

To prove the claim, it suffices to prove it assuming the cycle starts at time $t=0$.

Thus, we have states
$$s(0),...,s(m)$$
with $s(0),...,s(m-1)$ distinct, and $s(m)=s(0)$.

Let $X(t),Y(t)$ be defined by
\begin{align*}
X(t) &= x_1(t) + \cdots + x_n(t)\\[4pt]
Y(t) &= y_1(t) + \cdots + y_n(t)\\[4pt]
\end{align*}
Note that in any transition from time $t$ to time $t+1$, either $y_k(t+1) = y_k(t)$, or if not, then $x_k(t+1) = y_k(t)$ and $y_k(t+1) > y_k(t)$.

It follows that
$$Y(0) \le Y(1) \le \cdots \le Y(m)$$
but then, since the states cycle at time $t=m$, it follows that
$$Y(0) = Y(1) = \cdots = Y(m)$$
and hence, we also have
$$X(0) = X(1) = \cdots = X(m)$$
Then for each $k\in \{1,...,n\}$, we must have
$$y_k(0) = y_k(1) \cdots = y_k(m)$$
and also, for each positive integer $t$, we have
$$x_k(t) = x_{k-1}(t-1)$$
In other words, in every transition, the high values don't move, and the low values move right by $1$.

It follows that the highest low value $L$ say, is less than or equal to the lowest high value, $H$ say.

Thus, $L \le H$.

Suppose $L < H$.

Then all the low values are less than all the high values.

But each of the low values occurs with multiplicity $2$, contradiction, since the sequence of low values has length $n$, which is odd.

Then we must have $L=H$.

Since $L$ is a low value, it always moves right, and since $H$ is a high value, it always stays put.

It follows that the value $L$ will eventually be the low value for a participant whose high value is $H$.

This completes the proof.

passing cards around a table


One inequality involving Total variation function

Question: If $F$ is of bounded variation in $[a,b]$, then I need to prove that $$ \int_{a}^{b}|F'(x)| dx \leq T_F(a,b)$$
If $F'$ were Riemann integrable then it was easy to prove (in fact we can prove equality). But, how to proceed here ?
Answer: If $F'$ fails to be Riemann integrable you can use the Lebesgue integral instead. Start with the special assumption that $F$ is nondecreasing and bounded. Then, in particular, $T_F = F(b) - F(a)$. Extend the function $F$ to the half-line by defining $F(x) = F(b)$ if $x > b$. Since $F$ is differentiable almost everywhere (with nonnegative derivative) in $(a,b)$, \begin{align*}\int_a^b |F'(x)| \, dx = \int_a^b F'(x) \, dx &= \int_a^b \lim_{n \to \infty} n \left(F (x + 1/n) - F(x) \right) \, dx \\ &\le \liminf_{n \to \infty} \int_a^b n \left(F (x + 1/n) - F(x) \right) \, dx\end{align*}
by an application of Fatou's lemma. Then
\begin{align*}
\int_a^b n \left(F (x + 1/n) - F(x) \right) \, dx &= n \int_a^b F(x+1/n) \, dx - n \int_a^b F(x) \, dx \\ &= n \int_{a+1/n}^{b+1/n} F(x) \, dx - n \int_a^b F(x) \, dx \\ &= n \int_b^{b+1/n} F(x) \, dx - n \int_a^{a+1/n} F(x) \, dx.\end{align*}
Now, if $x \in [b,b+1/n]$ then $F(x) = F(b)$, and if $x \in [a,1+a/n]$ then $F(x) \ge F(a)$. Thus $$n \int_b^{b+1/n} F(x) \, dx - n \int_a^{a+1/n} F(x) \, dx \le F(b) - F(a).$$
(Note: if you are a bit more careful you can do a little better and obtain the upper bound $F(b^-) - F(a^+)$). Anyway, this is independent of $n$, so we end up with $$\int_a^b |F'(x)| \, dx \le T_F.$$
What if $F$ fails to be nondecreasing? Define $V(x) = T_F[a,x]$ to be the total variation of $F$ on $[a,x]$, $a \le x \le b$. Then $V$ is nondecreasing, so
$$ \int_a^b |V'(x)| \, dx \le T_V.$$  Note that for any two points $x,y \in [a,b]$ you have $ |f(x) - f(y)| \le |V(x) - V(y)|$ so that $|F'(x)| \le |V'(x)|$ whenever both derivatives exist. Moreover, since $T_V = V(b) - V(a) = V(b) = T_F$ you havefinally $$\int_a^b |F'(x)| \, dx \le \int_a^b |V'(x)| \, dx = T_V = T_F.$$


correct syntax to compare field with awk

Question: First I aplogize for this idiot question .
I want to print a field if he is equals to a value .
The problem is that I'm using a non default field sperator and I didn't understand how to make it work .
 awk '{FS = "/" ; if($3=="value" print $3 }'

Thanks.
Comment: To assign an awk "special" variable like `FS`, either use a command line option like @Thor demonstrated, or use the `BEGIN` block. The way you've shown in the question means you reassign it for every line of the file. Also, you're missing the close-parentheses for your `if` condition.
Answer: The more awkish way is like this:
awk -F/ '$3 == "value" { print $3 }'

Explanation

-F specifies the field separator
Each block is executed based on the preceding condition, if non is given it is always true, the condition here is $3 == "value".
Regular expressions can be used instead if == is replaced with ~.


I want to get data stored in cache created using Apache ignite without running the console application

Question: <code>   static void Main(string[] args)
        {
            var ignite = Ignition.Start();
            var cache = ignite.GetOrCreateCache<int, string>("my-cache");
            cache.Put(1, "Hello, World");
            Console.WriteLine(cache.Get(1));
        }
</code>
In the above code when the Ignite node is getting started, Cache is created and I am able to get cache also but everytime I need to start the console application to get that cache. Is there any way to get the data from above cache next time without starting the console application once it is created. Please suggest.
Comment: Put the code in a console app rather than a web app.
Comment: Please clarify how `web application` is related to this code? Ignite does not depend on anything web-related, you can use it in any kind of application - console, desktop, web, and so on.
Comment: Does your code work? I don't understand the question.
Comment: `Is that any way that I can use the cache from above console app in another web application in dot net` Copy and paste the code over to the web app?
Comment: I have edited the question. I am new to apache ignite cache. Please suggest me how can I use this console app to get the cache data
Comment: Yes, Code is working but my Question is Is that any way that I can use the cache from above console app in another web application in dot net and Do I need to start the Ignite node everytime to create the same cache again and again @mjwills
Comment: But everytime I need to start the Ignite node which consumes time. For example if I am getting the cache output from a sql query that has complex calculation and to prevent the calls to database I am storing the result in Ignite cache but If I need to start the Ignite node again and again to get the cache then it will take the same time which I do not want and I need replacement for that situation @mjwills
Comment: I am not sure what you want here - you want the ability to use a cache without starting the cache up or connecting to it in some way? Umm, that isn't generally how computers work.
Answer: You could also use thin client to connect to existing cluster:
https://ignite.apache.org/docs/latest/thin-clients/dotnet-thin-client
Comment: Maybe you need to start a stand-alone node then, and use ClientMode (thick client) in your .Net code?
Comment: Check out https://ignite.apache.org/docs/latest/starting-nodes#starting-client-nodes
Comment: You need to start an Ignite node every time when you need to use Ignite caching. If you use native persistence, the caches will already be available.
Comment: When I am trying to use thin client then I get exception "Failed to connect thin client connection" @alamar
Comment: Do you happen to run a stand-alone Ignite node at the time?
Comment: I just want to use ignite cache to create cache and to consume that cache in .net application to increase the performance speed @alamar
Comment: Can you please give me any example to do so @alamar
Comment: Above link is only about starting and stopping nodes @alamar
Comment: What else do you need to do? I don't think you have specified anything else.
Comment: Do I need to call Ignition.start() everytime to create cache or is there any way that I can get the caches next time from memory when I start my application @alamar
Comment: So you mean to say I need to use Ignite Persistance @alamar
Comment: It depends on your use case, which I don't know.


how to stop metal hooks in ends of side rails of wooden bed from squeaking

Question: I have an all wooden bed with two wooden side rails that have metal hooks at the ends for hooking them into the connections inside the headboard/footboard. The bed squeaks badly. I've tried wedging thin cardboard pieces at the end of each side rail/bed frame connection, but they work loose and the bed starts squeaking again. Any ideas for a remedy?
Comment: lubrication, such as candle wax
Comment: An image would help...
Comment: Are the rails made for the head board ?  My bed had to tap with rubber mallet to tighten up and mallet to take apart.  And little wax may help .
Answer: You could try lithium grease, but paraffin wax is less messy ;)


Opacity problem

Question: When hovering an image, users can see some additional information about the image. Before it was transparent, but now I don't want it make it transparent. So I deleted the opacity line in my css. But then the block got a whole new look...
Before

After

CSS
 #uicarousel-news-preview-block-1 .ui-carousel-item .views-field-title,
 #uicarousel-news-preview-block-2 .ui-carousel-item .views-field-title {
        height:35px;
        margin-top:-46px;
        background-color:green;
        padding-left : 30px;
        padding-right : 30px;
        opacity : 0.6;
        /*IE opacity*/
        filter:alpha(opacity=60);
        color: white;
        display: none;
    }

Is there something wrong with the CSS, or what do I have to do to make sure there is no opacity and the divis still in front of the image?
UPDATE
This is the HTML. It's a Drupal website and the green bar is the views-field-title
Comment: It would be helpful to see the relevant HTML.
Answer: This should help:
#uicarousel-news-preview-block-2 .ui-carousel-item .views-field-title
{
  ...
  position:relative;
  /* z-index: ...; - if needed */
}

Comment: Great, did the trick!! Stupid of me not to think about it myself! Thanks

Opacity problem


How do I capture https requests with Postman native app using Windows 10?

Question: I am using the Postman native app on Windows 10 and am struggling with trying to capture https requests. Postman's Documentation for this is for Mac and not Windows.
In particular, I am working on a web application that creates a session cookie upon login that needs to be included in most requests in order to be authorized. When I was using the Chrome App, Postman Interceptor achieved this (see https://stackoverflow.com/a/32436131/3816779).
Here's what I've tried so far:

        Turn on the Proxy in Postman with port 5555.

        Configured windows to send http and https requests through Postman's proxy server (127.0.0.1:5555).

This allows http requests to be captured in Postman

But when trying to connect to https sites, I get an error

Here are my Postman settings if that helps.

Update I ended up switching back to the Chrome App, which uses the "Interceptor" instead of a "Proxy Server" to capture traffic.
Comment: Same issue and now switching back to chrome app. that is really frustrating
Comment: Same issue here. Did you find any useful responses without going back to the chrome plugin?
Comment: gaudi_br Try Lukáš Kmoch's EDIT. It seems to fix the problem, but I'm a couple years away from it so not entirely sure.
Answer: Unfortunately, capture https requests with postman native app is impossible in some case according to the official doc: Capturing HTTP requests

Note: for the Postman native apps, request captures over HTTPS will not work if the website has HSTS enabled. Most websites have this check in place.
Answer: Postman's proxy now supports HTTPS traffic - https://blog.postman.com/postmans-proxy-now-fully-supports-https-endpoints/
Once you install a CA certificate that Postman generates for your installation, capturing HTTPS requests should be seamless.
Disclaimer: I work at Postman
Answer: With Google Chrome i don't know how to fix the issue. But you can use to open the web page for example IE..
EDIT:
Or MAYBE you can start Google Chrome with parameter --ignore-certificate-errors to ignore the error message.
Comment: It is still an issue, I tried it few weeks ago. And i know the question is referring to the native app but with nativ app you still need to use web browser to open the page and the issue is only with Google Chrome
Comment: The question's referring to the native app in Windows, as opposed to the chrome app. Haven't used postman for this in a while, so not sure if this is still an issue with the current version.
Comment: Oops, I misinterpreted your answer. Starting Chrome with --ignore-certificate-errors prevented the error messages from showing up, and the requests appeared in Postman history.

If running chrome with arguments is new to you like it was for me, here's some instructions https://pastebin.com/raw/MDT1RbF2, quoted from here https://www.technipages.com/google-chrome-bypass-your-connection-is-not-private-message.
Answer: Postman Interceptor is available for Postman native apps which supports both features:
1. Capturing requests
2. Syncing cookies
Learn more here.
Comment: I think maybe you should add a disclaimer that you work there. This could add even more credibility.
Comment: @Vinit when using Interceptor I am getting 401 on pages which requires authentication
Answer: Just check HTTPS in setting and will work for you
Comment: That is if you are in a proxy network... no for config the postman as proxy.
Comment: It looks like that tab is a new feature that addresses the problem, awesome. I frankly don't feel like putting in the effort to test out this solution though (I no longer need to use that part of postman), so I'll unnaccept the accepted answer and let the crowd take over from here.
Comment: This setting is for using Postman _behind a proxy_ **not to** configure Postman as Proxy to intercept requests.


how to convert a directed acyclic graph into a tree

Question: I want to convert a directed acyclic graph (DAG) into a tree, by duplicating the nodes that has more than one parent. what is the most efficient way of doing so?
Comment: I don't understand the question. Is this graph not connected? All acyclic graphs are already trees.
Comment: Great language-agnostic answer:  https://stackoverflow.com/questions/624778/how-to-convert-directed-acyclic-graph-dag-to-tree?rq=1
Answer: You can use depth first search or breadth first search for that. Does not matter. The only difference is that you want duplicate the first vertices that you already visited (go into depth 1 of visited, not more).
Here is DFS for java: http://algs4.cs.princeton.edu/41graph/DepthFirstSearch.java.html, but there are many implementations.


Correct way to delete all comments that belong to an image after the image is deleted?

Question: I can think of two ways to do that:
The first one is to add code to the deleteImage() function which finds all comments that belonged to that image and then delete them as well.
And the second one is create a foreign key and use onDelete('cascade'); so that when the image is deleted, all comments that belonged to it would get deleted as well.
At the end, both ways accomplish the same thing, however, there might be pros/cons to each way that I might not be aware of and that is why I'm asking you guys. Any input would be apppreciated.
Answer: This is really up to you, just document it in a good place.
The deleteImage() is obvious but can be easily forgotten. The cascade is less obvious but one might not expect to delete comments from the database if they delete an image file. There is no right or wrong, just make sure to document it somewhere and be consistent.
Comment: Is one of those 2 methods more popular?
Comment: I really wouldn't know. I prefer cascades because I refactor my code a lot and I'm bound to forget a manual function call. But again, it really is up to you.


UI design for mapping configurator

Question: Looking to design an admin page that will allow users to map meta data between external and internal web service
We have internal process xml file that contain order details that may be fulfilled by different vendors
Current process is that all meta data from our internal file is mapped to external vendor web service params and this is stored in an xml file.
The application processing internal files, read the mapping xml files and use that to send in the right param values when invoking vendor web service calls.
I want to build a front end that will allow an internal employee to visually select the internal meta data file and then select the vendor service, which would list the methods and can map the internal meta data to external param input values. The hope is that it will reduce errors when creating the xml config file for processing service.
my set up uses backbone and jquery and would prefer not to use a jquery wizard or step plugin
Forgot to ask my question - I am looking for UI guideline/help as to how I could accomplish this development. I have looked around at system to see if any of those systems had a UI that would do something similar and I could use that as a jump board for my application but have not found much except for  step by step or wizard plug-in's
Answer: I am working on a similar case about data mapping, with predefined data on the one side needed to be mapped one by one with external values which can be altered.
A simple solution could be:

user selects the data file -data are listed
user selects the vector service - values are listed
map data with value

UI design for mapping configurator


How can I overwrite local settings in apt install

Question: I'm trying to avoid the package configuration window in a bash script.
I want my script to install the package, and overwrite the configuration files,  without issuing any prompt requiring a response.
I tried to:
apt install -yq libpam-pwquality

apt -y -o Dpkg::Options::="--force-overwrite" install libpam-pwquality

apt -o Dpkg::Options::="--force-confnew" -o Dpkg::Options::="--force-confmiss" install libpam-pwquality

apt-get -y -o Dpkg::Options::=--force-confdef -o Dpkg::Options::=--force-confnew install libpam-pwquality

But, as shown in the screenshot, a prompt is appearing, so my script is not working properly. =(

Any ideas on how to fix this?
Answer: Found the decision by myself:
DEBIAN_FRONTEND=noninteractive apt -y install libpam-pwquality

This command will install the package without any questions or windows, so bash-script will not be stopped by dpkg, but it will not overwrite local-changed files.
Works for me anyway, because you can overwrite this files later by using this command:
DEBIAN_FRONTEND=noninteractive pam-auth-update --force

Found the decision here: https://bugs.launchpad.net/ubuntu/+source/pam/+bug/682662


Artifactory has artifactory.sh vs artifactorymanage.sh. Can i use artifactory.sh for production?

Question: Initially we will have only 5 projects only for next 6 months.
Starting artifactorymanage.sh is challenging
so initially can i use artifactory.sh and configure things and later move to artifactorymanage.sh?
Comment: This is an off-topic question that doesn't have anything to do with programming.
Comment: @ParkingMaster: All programming artifacts are getting stored here only. All dependencies are picked from here only and also section is there on stackoverflow dedicated to artifactory. So i thought it can be asked.
Answer: Found this answer which is related which means artifactorymanage.sh is for database externally used where internally it uses Derby:
Artifactory does come with a built-in embedded Derby database that is suitable for small-scale installations, testing, or evaluations. This embedded database allows users to quickly set up and run Artifactory without the need for an external database management system.
While the embedded Derby database can be convenient for getting started with Artifactory, it's important to keep in mind that it might not be the best choice for larger or production-scale deployments. Derby's embedded nature and design can lead to limitations in terms of scalability, performance, and reliability compared to dedicated database systems like MySQL, PostgreSQL, or others.
For small projects, evaluation purposes, or temporary setups, the embedded Derby database can serve its purpose well. However, if you plan to use Artifactory in a production environment with significant artifact storage, high user loads, and the need for advanced database management features, it's generally recommended to migrate to an external database system for better performance and scalability.
As always, it's a good practice to consult the official Artifactory documentation and guidelines for the most accurate and up-to-date information on database options and best practices.