text:
Q: android - modifiied multi-touch FingerPaint draws excess lines if fingers go up in wrong order I modified the FingerPaint demo from Android API to support multitouch. it works fine except form the following problem.In this case:
  Touch order: First Finger--Second Finger__________Lift order: Second Finger---First Finger

everything is ok.But.....In this case:
  Touch order: First Finger--Second Finger__________Lift order: First Finger---SecondFinger

it draws a line from the point the First Finger left the the screen to the point the Second Finger is at the momment.Same happens if i use three or four fingers in the same manner.How can i solve this problem? here is my code. (All the classes this code depends on are in the sample folder of Android API)
public class FingerPaint extends GraphicsActivity {
 int startx0,startx1,starty0,starty1,startx2,starty2,startx3,starty3;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(new MyView(this));

        mPaint = new Paint();
        mPaint.setAntiAlias(true);
        mPaint.setDither(true);
        mPaint.setColor(0xFFFF0000);
        mPaint.setStyle(Paint.Style.STROKE);
        mPaint.setStrokeJoin(Paint.Join.ROUND);
        mPaint.setStrokeCap(Paint.Cap.ROUND);
        mPaint.setStrokeWidth(12);

        mEmboss = new EmbossMaskFilter(new float[] { 1, 1, 1 },
                                       0.4f, 6, 3.5f);

        mBlur = new BlurMaskFilter(8, BlurMaskFilter.Blur.NORMAL);
    }

    private Paint       mPaint;
    private MaskFilter  mEmboss;
    private MaskFilter  mBlur;

    public void colorChanged(int color) {
        mPaint.setColor(color);
    }

    public class MyView extends View {

        private Bitmap  mBitmap;
        private Canvas  mCanvas;
        private Path    mPath;
        private Paint   mBitmapPaint;

        public MyView(Context c) {
            super(c);

            mPath = new Path();
            mBitmapPaint = new Paint(Paint.DITHER_FLAG);
        }

        @Override
        protected void onSizeChanged(int w, int h, int oldw, int oldh) {
            super.onSizeChanged(w, h, oldw, oldh);
            mBitmap = Bitmap.createBitmap(w, h, Bitmap.Config.ARGB_8888);
            mCanvas = new Canvas(mBitmap);
        }

        @Override
        protected void onDraw(Canvas canvas) {
            canvas.drawColor(0xFFAAAAAA);

            canvas.drawBitmap(mBitmap, 0, 0, mBitmapPaint);

            canvas.drawPath(mPath, mPaint);
        }

        @Override
        public boolean onTouchEvent(MotionEvent event) {

            switch (event.getActionMasked()) {
                case MotionEvent.ACTION_DOWN:
                     startx0 = (int) event.getX(0);
                     starty0 = (int) event.getY(0);
                    break;
                case MotionEvent.ACTION_POINTER_DOWN:
                    try{
                        startx1 = (int) event.getX(1);
                        starty1 = (int) event.getY(1);

                    }catch(Exception e){}

                    try{
                        startx2 = (int) event.getX(2);
                        starty2 = (int) event.getY(2);
                    }catch(Exception e){}
                    try{
                        startx3 = (int) event.getX(3);
                        starty3 = (int) event.getY(3);
                    }catch(Exception e){}

                    break;
                case MotionEvent.ACTION_MOVE:
                    try{
                        int x0 = (int) event.getX(0);
                        int y0 = (int) event.getY(0);
                        mCanvas.drawLine(startx0, starty0, x0, y0, mPaint);
                        startx0=x0;
                        starty0=y0;
                        invalidate();
                    }catch(Exception e){}
                    try{
                        int x1 = (int) event.getX(1);
                        int y1 = (int) event.getY(1);

                        mCanvas.drawLine(startx1, starty1, x1, y1, mPaint);
                        startx1=x1;
                        starty1=y1;
                        invalidate();
                    }catch(Exception e){}
                    try{
                        int x2 = (int) event.getX(2);
                        int y2 = (int) event.getY(2);
                        mCanvas.drawLine(startx2, starty2, x2, y2, mPaint);
                        startx2=x2;
                        starty2=y2;
                        invalidate();
                    }catch(Exception e){}
                    try{

                        int x3 = (int) event.getX(3);
                        int y3 = (int) event.getY(3);
                        mCanvas.drawLine(startx3, starty3, x3, y3, mPaint);
                        startx3=x3;
                        starty3=y3;
                        invalidate();
                    }catch(Exception e){}
                    break;
                case MotionEvent.ACTION_POINTER_UP:
                    break;
                case MotionEvent.ACTION_UP:

                    break;
            }
            return true;
        }
    }

    private static final int COLOR_MENU_ID = Menu.FIRST;
    private static final int EMBOSS_MENU_ID = Menu.FIRST + 1;
    private static final int BLUR_MENU_ID = Menu.FIRST + 2;
    private static final int ERASE_MENU_ID = Menu.FIRST + 3;
    private static final int SRCATOP_MENU_ID = Menu.FIRST + 4;

    @Override
    public boolean onCreateOptionsMenu(Menu menu) {
        super.onCreateOptionsMenu(menu);

        menu.add(0, COLOR_MENU_ID, 0, "Color").setShortcut('3', 'c');
        menu.add(0, EMBOSS_MENU_ID, 0, "Emboss").setShortcut('4', 's');
        menu.add(0, BLUR_MENU_ID, 0, "Blur").setShortcut('5', 'z');
        menu.add(0, ERASE_MENU_ID, 0, "Erase").setShortcut('5', 'z');
        menu.add(0, SRCATOP_MENU_ID, 0, "SrcATop").setShortcut('5', 'z');

        /****   Is this the mechanism to extend with filter effects?
        Intent intent = new Intent(null, getIntent().getData());
        intent.addCategory(Intent.CATEGORY_ALTERNATIVE);
        menu.addIntentOptions(
                              Menu.ALTERNATIVE, 0,
                              new ComponentName(this, NotesList.class),
                              null, intent, 0, null);
        *****/
        return true;
    }

    @Override
    public boolean onPrepareOptionsMenu(Menu menu) {
        super.onPrepareOptionsMenu(menu);
        return true;
    }

    @Override
    public boolean onOptionsItemSelected(MenuItem item) {
        mPaint.setXfermode(null);
        mPaint.setAlpha(0xFF);

        switch (item.getItemId()) {
            case EMBOSS_MENU_ID:
                if (mPaint.getMaskFilter() != mEmboss) {
                    mPaint.setMaskFilter(mEmboss);
                } else {
                    mPaint.setMaskFilter(null);
                }
                return true;
            case BLUR_MENU_ID:
                if (mPaint.getMaskFilter() != mBlur) {
                    mPaint.setMaskFilter(mBlur);
                } else {
                    mPaint.setMaskFilter(null);
                }
                return true;
            case ERASE_MENU_ID:
                mPaint.setXfermode(new PorterDuffXfermode(
                                                        PorterDuff.Mode.CLEAR));
                return true;
            case SRCATOP_MENU_ID:
                mPaint.setXfermode(new PorterDuffXfermode(
                                                    PorterDuff.Mode.SRC_ATOP));
                mPaint.setAlpha(0x80);
                return true;
        }
        return super.onOptionsItemSelected(item);
    }

}

A: Once you lift the second finger there is only one finger down.
This means event.getX(0) will contain the data of whatever the remaining finger is -- if you lift the first finger the data from the second finger will be move from being reported in getX(1) to getX(0).
You shouldn't rely on the position in the array of touches to identify the finger, you should use MotionEvent.getPointerId(int) to find out which finger is in which position and use this to map events to lines.


text:
Q: Vue.JS Changing parent tag depending on condition I want to have the same childrens but change the parent tag depending on the condition
currently I am using
draggable(v-if="dragMode" v-model...)
  .dragable1
  .dragable2
  .dragable3

notDraggable(v-else v-model...)
  .dragable1
  .dragable2
  .dragable3

but I would love to have something like this(selecting only 1 arrow as the parent).
draggable(v-if="dragMode"...) <----------
.notDraggable(v-else)         <----------
   .dragable1
   .dragable2
   .dragable3-

My current solution "flickers" when I change the value of dragMode :/
Any ideas?

redpajama_set_name: RedPajamaStackExchange


text:
Q: Netcat reverse shell I am trying to create a reverse shell for two computers on my network, I used netcat a few years ago, I remember I did something like to listen for incoming connections:
netcat -v -l -p <PORT>

But now when I try that it doesn't work, I just get the netcat usage:
$ netcat -v -l -p 12345
usage: nc [-46DdhklnrStUuvzC] [-i interval] [-P proxy_username] [-p source_port]
      [-s source_ip_address] [-T ToS] [-w timeout] [-X proxy_protocol]
      [-x proxy_address[:port]] [hostname] [port[s]]

Did something changed in the latest netcat releases?
I am using ubuntu 10.04

A: There's a bajillion different netcat variants out there.  (Okay, not really; maybe half a dozen major ones.)  Each has different features.
In Ubuntu, you can install netcat-openbsd, netcat-traditional, netcat6.  netcat is simply a symlink managed by update-alternatives [--display/--set] nc.
netcat-openbsd is most likely to be installed and set as default by Ubuntu 10.04 (and is directly depended upon by libvirt-bin), but your option set only works on the other implementations.  You can use nc.traditional or nc6 (after installing the proper packages, of course), or use update-alternatives to set them as the default netcat.

A: If you drop the -p you should be listening on port <PORT>.
nc -vl <PORT>

A:  -p source_port
         Specifies the source port nc should use, subject to privilege
         restrictions and availability.  It is an error to use this option
         in conjunction with the -l option.

nc -v -l 12345


text:
Q: iOS8 Mobile Safari Canvas issue I have the following code:
function resizeBase64Img(base64, coeficient) {
            var sizeGetter = new Image();
            sizeGetter.src = base64;
            var height = sizeGetter.height*coeficient;
            var width = sizeGetter.width*coeficient;

            var canvas = document.createElement("canvas");
            canvas.width = width;
            canvas.height = height;
            var context = canvas.getContext("2d");
            var deferred = $.Deferred();
            $("<img/>").attr("src", base64).load(function() {
                context.scale(width/this.width,  height/this.height);
                context.drawImage(this, 0, 0);
                deferred.resolve($("<img/>").attr("src", canvas.toDataURL()));
            });
            return deferred.promise();
        }

See complete in:
http://jsfiddle.net/mz38qh8x/
Basically what it does is it grabs an image from an input[type=file] and then uses canvas to resize the image before appending it to the body. This works fine on Chrome in OSX.
In Mobile Safari (iOS 8.1) the appended image has an empty src * sometimes *, some images so work, but most fail. I tried also using the desktop safari to troubleshoot, and it simply stops working when it gets to the canvas related instructions. I've looked around for known bugs, but the only thing I could find was this, although I don't seem to breaking the rules stated there.
Is this just simply poor canvas support on iOS8? Have I missed something?
EDIT #1:
Apparently there's also another issue, which I'll be looking at. (Stackoverflow won't let me post the link)
EDIT #2:
The error seems to be this:
var canvas = document.createElement("canvas");
canvas.width = width;
canvas.height = height;

Canvas is not setting its width and height properly. They remain as undefined as per the inspector in Mobile Safari.


text:
Q: "create is not valid input at this position " when using mysql-workbench I have just installed mysql-workbench and type my first a few line of code,
the first line "show databases" runs well,
but when it comes to "create database wenda"
it reports "create is not valid input at this position"
why?

A: you miss the ";" after the first line.
try
show databases;
create databese wenda;

A: Maybe you forget ";" after create table

CREATE TABLE xxx ( content ) ;


text:
Q: Upgrade to 13.04, user picture shows up on lightdm. Can I change it? So, I recently upgraded my Xubuntu to 13.04, and afterwards I noticed that there is now a picture of me on the lightdm login screen. I have no idea where this picture came from, I don't remember it being taken.
I guess it was asked for when I set up the account. Long time ago now.
Anyway, I was wondering whether it was possible to change this picture... I don't really like it.

A: Take a JPEG image of your choice. Move/copy it to Your Home folder. Rename it to ".face". Yes, a dot-file without extension. Log out, and You should see it!
It should be JPEG and also a square. PNG will not be shown (it works for User Manager, but not for LightDM login, unfortunately). Image of irregular dimensions will get streched.
This works for me on Xubuntu 13.04. Good luck!

A: Try System Settings - User Accounts. Click on the grey head (or the thumbnail ) that's shown above 'Account Type'. There you can change it.
But...a default Ubuntu 13.04 installation will not show a picture of you in the lightdm login screen.
There's information on Help Ubuntu and on this ArchWiki page on how to customize lightdm.
You need to edit the
/etc/lightdm/lightdm-gtk-greeter.conf

This is how a fresh installed lightdm-gtk-greeter.conf file looks like:
#
# background = Background file to use, either an image path or a color (e.g.     #772953)
# theme-name = GTK+ theme to use
# font-name = Font to use
# xft-antialias = Whether to antialias Xft fonts (true or false)
# xft-dpi = Resolution for Xft in dots per inch (e.g. 96)
# xft-hintstyle = What degree of hinting to use (hintnone, hintslight, hintmedium, or hintfull)
# xft-rgba = Type of subpixel antialiasing (none, rgb, bgr, vrgb or vbgr)
# show-language-selector (true or false)
#
[greeter]
background=/usr/share/backgrounds/warty-final-ubuntu.png
theme-name=Ambiance
font-name=Ubuntu 11
xft-antialias=true
xft-dpi=96
xft-hintstyle=slight
xft-rgba=rgb
show-language-selector=true

file.


text:
Q: Selecting html elements based on style I have this piece of code which changes the border of a list of html elements provided
xh.highlightNodes = function (nodes) {
    for (var i = 0, l = nodes.length; i < l; i++) {
        nodes[i].style.border = "4px solid blue";
    }
};

Now I want to remove the border on triggering of some event.
How do I do this?
I tried this but it does not seem to work.
$('html').filter(function () {
    return $(this).css('border') == '4px solid blue';
}).css('border', '');

A: Try below one instead,
.css('border', 'none');

A: The problem is in convertation color in js. Because $(this).css('border') actually equals 4px solid rgb(0, 0, 255) but not '4px solid blue'.
return $(this).css('border') === '4px solid rgb(0, 0, 255)';

The working code http://codepen.io/NataliaS29/pen/vOZJQY


text:
Q: Large kernel wait using numpy.fft with multiprocessing I would like to compute a set of ffts in parallel using numpy.fft.fft and multiprocessing. Unfortunately, running the ffts in parallel results in a large kernel load.
Here is a minimal example that reproduces the problem:
# fft_test.py
import numpy as np
import multiprocessing
from argparse import ArgumentParser

def f(i):
    x = np.empty(1000000)
    np.fft.fft(x)
    return i

def __main__():
    ap = ArgumentParser('fft_test')
    ap.add_argument('--single_core', '-s', action='store_true', help='use only a single core')
    args = ap.parse_args()

    # Show the configuration
    print("number of cores: %d" % multiprocessing.cpu_count())
    np.__config__.show()

    # Execute using a single core
    if args.single_core:
        for i in range(multiprocessing.cpu_count()):
            f(i)
            print(i, end=' ')
    # Execute using all cores
    else:
        pool = multiprocessing.Pool()
        for i in pool.map(f, range(multiprocessing.cpu_count())):
            print(i, end=' ')

if __name__ == '__main__':
    __main__()

Running time python fft_test.py gives me the following results:
number of cores: 48
openblas_info:
    library_dirs = ['/home/till/anaconda2/envs/sonalytic/lib']
    define_macros = [('HAVE_CBLAS', None)]
    libraries = ['openblas', 'openblas']
    language = c
openblas_lapack_info:
    library_dirs = ['/home/till/anaconda2/envs/sonalytic/lib']
    define_macros = [('HAVE_CBLAS', None)]
    libraries = ['openblas', 'openblas']
    language = c
blas_opt_info:
    library_dirs = ['/home/till/anaconda2/envs/sonalytic/lib']
    define_macros = [('HAVE_CBLAS', None)]
    libraries = ['openblas', 'openblas']
    language = c
blas_mkl_info:
  NOT AVAILABLE
lapack_opt_info:
    library_dirs = ['/home/till/anaconda2/envs/sonalytic/lib']
    define_macros = [('HAVE_CBLAS', None)]
    libraries = ['openblas', 'openblas']
    language = c

0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47

real    0m7.422s
user    0m9.830s
sys 1m26.603s

Running with a single core, i.e. python fft_test.py -s gives
real    1m0.345s
user    0m56.558s
sys 0m2.959s

Any idea what might cause the large kernel wait?


text:
Q: How to add playback speed button to my html audio player This is my current code in which it takes link from google drive which i use in my wordpress for playing mp3.
This code works fine in compiler and even playbackspeed works fine but when i put this code in wordpress post it does not work
It will not increase playback speed even after clicking on it.
Help!

<!DOCTYPE html>

  <button onclick="getPlaySpeed()" type="button">What is the playback speed?</button>

  <audio id="audio" controls="controls">
  <source src="https://drive.google.com/uc?export=download&id=1bDkkNlMt2TIrwBLtgjFoL5odO7rbGS06">
</audio>

Audiobook Speed

    <button onclick="setPlaySpeed(1.00)" type="button">1.00x</button>
    <button onclick="setPlaySpeed(1.25)" type="button">1.25x</button>
    <button onclick="setPlaySpeed(1.50)" type="button">1.50x</button>
    <button onclick="setPlaySpeed(1.75)" type="button">1.75x</button>
    <button onclick="setPlaySpeed(2.0)" type="button">2.0x</button>

A: Your HTML5 media element has an attribut playbackRate, you could modify that integer to the speed you want.
var vid = document.getElementById("myVideo");
vid.playbackRate = 0.5;

(reference)

A: I think this should do the job!

var audio = document.getElementById("audio");

function getPlaySpeed() {
  alert(audio.playbackRate);
}

function setPlaySpeed(speed) {
  audio.playbackRate = speed;
}
body {
  display: grid;
  justify-items: center;
  grid-row-gap: 10px;
}

#actions {
  background: gray;
}

#actions button {
  outline: none;
  background: transparent;
}
<!DOCTYPE html>

  <button onclick="getPlaySpeed()" type="button">What is the playback speed?</button>
  <audio id="audio" controls="controls">
  <source src="https://drive.google.com/uc?export=download&id=1bDkkNlMt2TIrwBLtgjFoL5odO7rbGS06">
</audio>

audiobook Speed

    <button onclick="setPlaySpeed(0.9)" type="button">0.9x</button>
    <button onclick="setPlaySpeed(1)" type="button">1x</button>
    <button onclick="setPlaySpeed(1.2)" type="button">1.2x</button>
    <button onclick="setPlaySpeed(1.5)" type="button">1.5x</button>
    <button onclick="setPlaySpeed(1.7)" type="button">1.7x</button>

(ref)


text:
Q: Is this possible? Iterating @keyframes with CSS (Stylus) I have this code in Stylus:
for i in (1..3)
  .l:nth-child({i})
     opacity (i / 5)

Which outputs:
.l:nth-child(1) {
opacity: 0.2;
}
.l:nth-child(2) {
opacity: 0.4;
 }
.l:nth-child(3) {
 opacity: 0.6;
}

Which is great, but I want to change this so that the opacity is 0 at the start and to be set after using @keyframes dynamically;
@keyframes o
0%
 opacity 0
100%
  for i in (1..3)
  opacity (i / 5)

Returns, the obviously incorrect:
100% {
opacity: 0.2;
opacity: 0.4;
opacity: 0.6;
}

Not sure how to do this, do I need to use a function? Thanks for your time! The result I want should look like this:
100% {
.l:nth-child(1) {
opacity: 0.2;
}
.l:nth-child(2) {
opacity: 0.4;
 }
.l:nth-child(3) {
 opacity: 0.6;
}
}

A: I did it by creating a keyframe for each iteration:
for i in (1..3)
 $keyframe-name = (o- + i)
 @keyframes {$keyframe-name}
   0%
   100%
    opacity (i/5)

And then animating:
for i in (1..3)
 .l:nth-child({i})
   opacity 0
   animation (o- + i) 0.25s (i/5)s linear forwards

Thanks @DJDavid98 for your comment.


text:
Q: SharePoint 2010 ISAPI WCF Service for Search using KeywordQuery not working Below is my Applied code for Search in ISAPI WCF service, here when I debug DataTable count gives me zero. It works fine in SharePoint 2010 OOTB Search and have also configured Crawl settings. Can you please help me out guys.
try
        {
            SearchServiceApplicationProxy proxy = (SearchServiceApplicationProxy)SearchServiceApplicationProxy.GetProxy(SPServiceContext.GetContext(SPContext.Current.Site));

            KeywordQuery keywordQuery = new KeywordQuery(proxy);
            keywordQuery.ResultsProvider = SearchProvider.Default;
            keywordQuery.ResultTypes = ResultType.RelevantResults;
            keywordQuery.TrimDuplicates = true;
            keywordQuery.RowLimit = 10;
            keywordQuery.QueryText = queryText;
            keywordQuery.SortList.Add("LastModifiedTime", Microsoft.Office.Server.Search.Query.SortDirection.Descending);
            keywordQuery.HiddenConstraints = string.Concat("scope:\"", "All Sites", "\"");

            ResultTableCollection results = keywordQuery.Execute();
            ResultTable result = results[ResultType.RelevantResults];
            DataTable dt = new DataTable();
            dt.Load(result, LoadOption.OverwriteChanges);

            DataTable dtFinal = dt.Copy();
        }
        catch (Exception ex)
        {
        }

Here is the image of DataTable count

A: After some more research I have found out the solution.
You need to write SPSecurity.RunWithElevatedPrivileges(delegate(), as no user would be found while accessing SharePoint site in this ISAPI wcf service, so RunWithEvelatedPrivileges would help to perform access.
     try
        {
            string siteurl = SPContext.Current.Web.Url;
            SPSecurity.RunWithElevatedPrivileges(delegate()
            {
                using (SPSite site = new SPSite(siteurl))
                {
                    KeywordQuery keywordQuery = new KeywordQuery(site);


text:
Q: Prove that $R$ is an equivalence on $\mathscr P(A)$. Is this correct? Suppose $B\subseteq A$, and define a relation R on $\mathscr{P}(A)$ as follows:
$$R=\{(X,Y)\in\mathscr{P}(A) \times \mathscr{P}(A)\mid(X\mathrel{\triangle} Y)\subseteq B\}$$
Prove that $R$ is an equivalence relation on $\mathscr{P}(A)$.
Ok so here's how I did the reflexive part. I want to know if it is correct and whether I have the right idea.
Let X be an arbitrary set on $\mathscr{P}(A)$. Also, let $y\in(X\mathrel{\triangle} X)$. This means $$y\in(X\setminus X)\cup(X\setminus X)\;,$$ so $y\in\emptyset$. Since $\emptyset\in B$ and since $y$ was arbitrary, we can conclude that $(X \mathrel{\triangle} X)\subseteq B$. Since $X$ was arbitrary we have shown that $(X,X)\in R$. So $R$ is reflexive on $\mathscr{P}(A)$, as desired.
Update:
There's another part to this question,
Prove that for every X $\in\mathscr{P}(A)$ there is exactly one Y $\in$ [X]$_R$ such that Y $\cap$ B = $\emptyset$.
I believe I got the existence part of the proof but I don't know how to complete the uniqueness part.
My proof: (Goal: $\forall X \in \mathscr{P}(A) \exists ! Y \in$ [X]$_R$(Y $\cap B = \emptyset$ )
Let X be arbitrary set of $\mathscr{P}(A)$
Existence:
Let Y=$\emptyset$. So, LHS = Y$\cap$B = $\emptyset \cap$B = $\emptyset$ = RHS, as desired.
Uniqueness:
Let W and Z be arbitrary sets in [X]$_R$ such that W$\cap$B=$\emptyset$ and Z$\cap$B=$\emptyset$.
(I know my uniqueness goal is to prove X=Z but I don't know how to go about it)

A: You have the right idea. It's not true, however, that $\varnothing\in B$: you mean that $\varnothing\subseteq B$. You could also make the argument a bit clearer. There's no reason to look at $y\in X\mathrel{\triangle}X$: just observe that
$$X\mathrel{\triangle}X=(X\setminus X)\cup(X\setminus X)=\varnothing\subseteq B\;,$$
so that $(X,X)\in R$, as desired.
I think that you'll find it even more straightforward to verify that $R$ is symmetric. The hardest part will be verifying transitivity of $R$, which amounts to showing that if $X,Y,Z\subseteq A$, $X\mathrel{\triangle}Y\subseteq B$, and $Y\mathrel{\triangle}Z\subseteq B$, then $X\mathrel{\triangle}Z\subseteq B$. HINT: Calculate
$$(X\mathrel{\triangle}Y)\mathrel{\triangle}(Y\mathrel{\triangle}Z)\;.$$


text:
Q: "Correct" as an alternative to "Yes" I'm noticing, whilst watching the George Floyd trial, that a couple of the witnesses are using the word "Correct" in response to yes/no questions, as a substitute for "Yes".
Since they're not getting called out on this, is it actually the case that this is acceptable language in a Minnesota courtroom?
Example:

"Is your co-worker older than you?"
"Correct."

A: There are English dialects that function without always relying on the words yes and no.

Irish has no words that directly translate as "yes" or "no", and
instead repeats the verb used in the question, negated if necessary,
to answer. Hiberno-English uses "yes" and "no" less frequently than
other English dialects as speakers can repeat the verb, positively or
negatively, instead of (or in redundant addition to) using "yes" or
"no".
"Are you coming home soon?" – "I am."
"Is your mobile charged?" – "It isn't."
This is not limited only to the verb to be: it is also used
with to have when used as an auxiliary; and, with other verbs, the
verb to do is used. This is most commonly used for intensification,
especially in Ulster English.
"This is strong stuff, so it is."
"We won the game, so we did."
— Wikipedia

PS. I have no idea about the rules in a Minnesota courtroom.


text:
Q: windchill 10.2: custom action does not appear in product structure explorer I am unable to view an custom action in the pub when I right click on an part. Ptc guide does not provide any step by step procedure to implement this function.
Action name ="psbaction1"
Class name = grid.reject
Is there s specific format within which it has to be specified?
Any help on this will be greatly appreciated.
Thank You.

A: please find the below configurations and help in creating a CustomAction Class. When clicked the newly added custom action the CustomAction class should execute (work should be done in background)
custom-actionModels.xml:
   <model name="psbRelatedPartsTreeContextMenu">
    ..
                <action name="psbaction1" type="psb"/>

   </model>

custom-actions.xml :
  <listofactions>
    <objecttype name="psb" resourceBundle="ext.custom.psb.resource.psbCustomActionsRB">
        <action name="psbaction1">
         <command class="sample.CustomAction"/>
      </action>
    </objecttype>
</listofactions>

psbCustomActionsRB.rbinfo:
psb.psbaction1.description.value=psbaction1
psb.psbaction1.tooltip.value=psbaction1
psb.psbaction1.title.value=psbaction1
psb.psbaction1.icon.value=stop.gif
psb.psbaction1.moreurlinfo.value=height=300,width=500


text:
Q: Problem with PHP object and foreach loop, object not properly storing values I'm trying to get values from a file called input.csv and add it to an object called $myItem. I'm using a foreach method to do so, as you can see. For some reason that is unclear to me, the values of the object are getting mixed up.
When I initially set the value of $item_number using my setter method the value is the correct value - the first entry in the first row of input.csv. However, by the time the foreach loop is completed, the value has changed to the last entry in the first row of input.csv.
This is true for all the instance variables in the object $myItem, they're all changing to the last entry in the first row of input.csv. I'm not sure why.
Here is my code:
<?php
  class Item
  {
    private $item_number;
    private $name;
    private $type;
    private $make;
    private $model;
    private $brand;
    private $description;

    // Item Number
    function SetItemNumber($value)
    {
      $this->item_number = $value;
    }

    function GetItemNumber()
    {
      return $this->item_number;
    }

    // Name
    function SetName($value)
    {
      $this->item_number = $value;
    }

    function GetName()
    {
      return $this->name;
    }

    // Type
    function SetType($value)
    {
      $this->item_number = $value;
    }

    function GetType()
    {
      return $this->type;
    }

    // Make
    function SetMake($value)
    {
      $this->item_number = $value;
    }

    function GetMake()
    {
      return $this->make;
    }

    // Model
    function SetModel($value)
    {
      $this->item_number = $value;
    }

    function GetModel()
    {
      return $this->model;
    }

    // Brand
    function SetDescription($value)
    {
      $this->item_number = $value;
    }

    function GetDescription()
    {
      return $this->description;
    }

    // Brand
    function SetBrand($value)
    {
      $this->item_number = $value;
    }

    function GetBrand()
    {
      return $this->brand;
    }
  }

  $file = fopen("input.csv", "r");

  $myItem = new Item;

  foreach (fgetcsv($file) as $key => $value) {

    switch ($key) {
      case 0:
        $myItem->SetItemNumber($value);
        echo $myItem->GetItemNumber(); // prints first value in first row of input.csv
        break;
      case 1:
        $myItem->SetName($value);
        break;
      case 2:
        $myItem->SetType($value);
        break;
      case 3:
        $myItem->setMake($value);
        break;
      case 4:
        $myItem->setModel($value);
        break;
      case 5:
        $myItem->setBrand($value);
        break;
      case 6:
        $myItem->setDescription($value);
        break;
    }
  }

  echo $myItem->GetItemNumber(); // ??? prints last value of first row of input.csv.
  // This is the value that you should only get from getDescription().

  fclose($file);
  ?>

Thanks in advance for any help!

A: Take a look at your setter methods, all of them are doing:
 $this->item_number = $value;


text:
Q: finding element inside another element using id I had google but did not find solution for my query.
What I want is I have following sample code

$("#mainDiv").find("#sampleSpan").css(\\doing some stuff);

So I want to access sampleSpan by id using it's parent container div mainDiv, I only want to access it by id. But I am not getting this. What is problem in this? and how to do this?
UPDATE:
As I know it can only access using sampleSpan but in my case I have problem is that, I am opening page in dialog box and which page open it also have same span sampleSpan so instead of getting opening sampleSpan it replace the first one.
I can not change the id because it has been used in too many codes, so I have only this option so I need solution for this only.

A: ids are unique.  Why not just reference #sampleSpan just like you referenced #mainDiv?
$("#sampleSpan").css(\\doing some stuff);

A: Sometimes you want to access and id only if its inside another id, so i dont find this problematic at all.
If $("#mainDiv").find("#sampleSpan").css() does not work, either your jquery does not get executed at all (does it?) or the css does get applied but does not show any change, because some css rules dont apply for inline elements as spans. MORE code please.
Make sure you load jQuery before you run your code and you have the document.ready() event function wrapping your code:
$(function() { /* your code */ });

More details, else, please.


text:
Q: angular, select with dynamic disabled Now I am trying to select box with disabled.
When $shop.products.product[i].productId is changed by selectBox, I want that value disabled in select box option.
for example, if i select 3 in select box on second row, then select box option 1,3 are disabled.
so i register $watch witch resync isDisabled field when $shop.products[i].productId is changed.
i don't know why $watch is no calling. help me please.

// Code goes here

angular.module("myApp")
    .controller("myCtrl", function($scope) {

        $scope.shop = {
          "id" : 'shop1',
          "products" : [
            {"productId" : 1,"desc" : 'product1'},
            {"productId" : 2,"desc" : 'product2'}
          ]
        };

        $scope.allSelectBoxItems = [
          {"id" : 1, "isDisabled" : true},
          {"id" : 2, "isDisabled" : true},
          {"id" : 3, "isDisabled" : false},
          {"id" : 4, "isDisabled" : false}
        ];

        $scope.addWatcher = function(index){
            console.log('register watcher to ' + index);
            $scope.$watch('shop.product[' + index + '].productId', function(newValue, oldValue){
              console.log('watcher envoked');
              if (newValue != oldValue) {
                var selected = $scope.shop.products.map(function (product) {
                    return product.productId;
                });

                for (var i = 0; i < $scope.allSelectBoxItems.length; i++) {
                    var isSelected = selected.includes($scope.allSelectBoxItems[i].productId);
                    console.log(isSelected);
                    $scope.allSelectBoxItems.isDisabled = isSelected;
                }
            }
            });
        }

        angular.forEach($scope.shop.products, function(value, index){
          $scope.addWatcher(index);
        });

        $scope.addProduct = function(){
          var nextProductId = $scope.shop.products.length + 1;
          var newProduct = {"productId" : nextProductId ,"desc" : 'product' + nextProductId};

          $scope.shop.products.push(newProduct);
          $scope.addWatcher(nextProductId - 1);
        }

    });
<!DOCTYPE html>

    <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" />

            id
            {{shop.id}}

              products

              <button type="button" class="btn btn-default" ng-click="addProduct()">add product</button>

                    producId
                    desc

                      <select ng-model="product.productId" ng-options="selectBoxItem.id as selectBoxItem.id disable when selectBoxItem.isDisabled for selectBoxItem in allSelectBoxItems"></select>

                      {{product.desc}}


text:
Q: Why Does Eclipse Think a Servlet 3.0 Web App is still a Servlet 2.4 Web App? I'm using Eclipse Kepler SR1 for EE.  I have a web app whose project settings include Server > Tomcat v7.0 Server at localhost.
This web app's web.xml file used specify that it was a version 2.4 servlet, but I've modified it to now specify that it is a version 3.0 servlet.  The web-app element now looks like:
<web-app xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
version="3.0">

And... as far as I can tell, Eclipse is happy with this.  There is nothing in the Problems tab and the web app runs fine.  The problem I'm having is that in the Project Explorer, where it says "Deployment Descriptor: blah blah blah" the icon that appears is a small box with "2.4" inside:
[2.4] Deployment Descriptor: blah blah blah  (StackOverflow won't let me post pictures, but this is pretty close).
So, is this an Eclipse bug, or is there something else I should have done to fully switch the servlet from version 2.4 to 3.0?  I've closed and reopened the project and that didn't fix the problem.

A: You must change the version of the Java Facet project, do it: rigth click Project -> Properties -> Project Facets, and change the version to 3.0 in the Dynamic Web Module Option.


text:
Q: In DB2, how to import data from a .ixf file with updates on primary key I have 2 tables: TABLE_1 and TABLE_2, all have same field: ID (primary key) and NAME. I want to import the data from TABLE_1 to TABLE_2 and I assume TABLE_1 has all the latest data. So I need to insert or update the records in TABLE_2 by primary key, delete is not needed. And I need to use .ixf to complete this task.
As right now, I am just manually export the .ixf file from TABLE_1 as C:\table_1 and using
IMPORT FROM "C:\table_1" OF IXF MODIFIED BY INDEXSCHEMA=DB2ADMIN METHOD P (1, 2) MESSAGES "C:\dblog.txt" INSERT INTO DB2ADMIN.TEST_2 (ID, NAME);
Anything I can add into this sql statement to do inserts and updates on primary key?
Thanks,

A: IMPORT is not an SQL statement, it's a DB2 Command.
Have you tried reading the manual for the IMPORT command to look at what options you have when performing an import?  Perhaps searching for INSERT_UPDATE?


text:
Q: checkbox image replacement,nothing happend <?php
//require 'includes/db.inc.php';
require 'includes/configs.inc.php';
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
    <head>
        <title><?php $site_name ?></title>
        <meta http-equiv="content-type" content="text/html; charset=utf-8">
        <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js">
        <link rel="stylesheet" type="text/css" href="/css/style.css">
        <script type="text/javascript" src="/js/jquery.imageTickBox.js"></script>
        <script type="text/javascript">
        jQuery(document).ready(function(){
            jQuery("input:[type=checkbox]").imageTickBox({
            tickedImage: "/images/checked.png",
            unTickedImage: "/images/unchecked.png",
            imageClass: "tickbox"
            });
            });
            </script>
  </head>
    <body>
      <div id="mirror" class="center">
        <!--some code deleted-->
        <input type="checkbox" id="Music" name="hobbies[]" value="Music">
        <!--some code deleted-->
      </div>
  </body>
</html>

any wrong with the code above????name index.php and put it on root dir.
but not work , i see the jquery checkbox plugin guide at
http://blog.leenix.co.uk/2009/10/jquery-plugin-imagetickbox-change-any.html

A: ALWAYS close your script tags, even if using external resources.
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>

A: You need to close the jquery script tag:
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>


text:
Q: Cheap oscilloscope showing 16 MHz square wave I own a cheap oscilloscope Hantek DSO4102C. It's rated bandwidth is 100 MHz, and sample rate is 1 GSa/s. Some info about the tool can be found here: http://hantek.com/en/ProductDetail_3_4163.html
Now I have an Atmega328P MCU running from an external quartz at 16 MHz, without any code it it (chip erased by usbasp), only CKOUT fuse bit is set. So I supposed to see a square wave at PB0 pin, but my scope shows it quite distorted:

MCU's datasheet doesn't mention a pin rise time, which was a big surprise to me, so I cannot check if measured 9.5 ns is a valid value. But judging by Pk-Pk voltage exceeding 6 volts (and even going below zero for a good 560 mV), I believe there's a problem with the scope. Am I right?
ADDED LATER, AFTER GETTING SOME ADVICE
I've assembled everything on a  breadboard, rather then using Arduino Uno. I've connected ground clip from the scope to the ATMega's ground pin with a wire through breadboard. I'm measuring directly at the output pin (see photo of my layout below). Now I'm getting better results, also with 20 MHz oscillator.

Obviously, Pk-Pk values are now more close to reality, as well as signal shape. So thanks everybody for the help!

A:
I believe there's a problem with the scope. Am I right?

Don't think so. Overshoot is a perfectly normal phenomenon when measuring a fast-edge signal with a high-impedance probe. (Also, these signals look about as sharp as I'd expect them to be.)
There's many tutorials on sensing high-speed signals: this is the perfect time to read one!
Oh, and there's Gibb's phenomenon, which says that any band-limited observation of a theoretical perfect (or far less band-limited) edge will have some 9% of overshoot; to understand that, I'd recommend looking at the cosine series representation of the square wave and consider what you'll cut off when you get rid of anything above 5× 16 MHz (=the fundamental frequency of your square wave).

A: In addition to what was said about probe compensation and probe choice, a 16MHz signal from an IC running at nominal speed will not always be so fast in risetime as to appear as a perfect squarewave. To achieve that, you would have to use output stages that would be perfectly capable of handling signals in the 100MHz range. Designing an IC like a MCU to be as fast-rise as possible would only waste power and create EMC problems.

A: Keep in mind that if you have a 100MHz brick-wall filter (ideal case) with a perfect 16MHz square wave in, the only harmonics you'll see are 1 (16MHz), 3 (48MHz) and 5 (80MHz).  That's an ideal case, but if you do the calculations, you'll see the result isn't too far from what you're seeing.
In the nonideal case, of course, probe loading and compensation will have further distorting effects, and the waveform isn't going to be perfectly square to start with.

A: Marcus Müller mentions Gibbs phenomenon, which produces ringing artifacts in a bandwith-limited signal, and Cristobol Polychronopolis mentions that your 100 MHz bandwith will be reducing the amplitude of harmonics past the third in your 16 MHz signal.
For simplicity and just to get a sense of what's going on with waveforms, we can graph Cristobol's ideal case of just the first three harmonics:

Note that this is what a perfect scope with a perfect 100 MHz brick wall filter would show, if given a square wave. So no, your scope is not broken when you see ringing in the waveforms: it's displaying what it sees after distortion introduced by the probes and analogue front end and imperfect filtering before digitisation.
This is something you need to learn to deal with: any time you examine a circuit with an oscilloscope it changes (hopefully not too much) the waveforms at that point in the circuit and then further distortions occur between the tip of the probe and the oscilloscope's display. Since you can't avoid this, a good understanding of what distoritions are likely to be happening is essential when using a 'scope, particularly on relatively high-frequency circuits.


text:
Q: Leaving swipe to delete button open on uitableview cell then going back causes crash I have swipe to delete on one of my table cells. If I swipe right on the table cell to display the delete button and pop the view by pressing the back button the app crashes with Thread 1: EXC_BAD_ACCESS. I've already singled this out as the reason it crashes. Why does this happen?
This is what it looks like when I tap back https://www.dropbox.com/s/ggn4jqr0ox0tnta/Screenshot%202014-12-04%2023.39.25.png?dl=0

A: Set UITableview end editing to NO in viewWillDisappear
[tableview setEditing:NO];

A: Where you remove your cell from table view. You also have to delete data from you array.

A: When you are swiping right, may be you are popping the controller. Because the view is disappearing, you have to write NANNAV's lines.

A: This caused because delegate and datasource of the table is simple assign pointer, not weak. So after deleting view controller, containing table still can send events to the controller. To avoid this you can manually set tableview delegate and datasouce to nil in dealloc method. BTW, this happens not only with tables.


text:
Q: Resetting the Google Map position after clicking off an Infowindow I have a google map which includes infowindows when clicking on markers in the map. When clicking on a marker, the infowindow for that marker opens up and repositions the map.
The client would like the map location to reset to the original position and close the infowindow when clicking anywhere in the map that is OFF the infowindow.
The code I have so far is below. Thank you!!


text:
Q: Multiple uses of SaveAs freezes Excel I am working with a large file that includes data across multiple (100+) clients.
Needs:

*

*Generate monthly summary of client activity.

*Must be in an Excel manipulatable format.

*Must be client specific. No access to other's information.

My process works, but it hangs and can take anywhere between 10 - 45 minutes.
After troubleshooting I know the issue is with the SaveAs method. Commenting said line out and still allowing files to be generated and closed does not cause the hang ups.
For i = 1 to Number_of_clients

    'Data is sorted and placed in report tab (not shown)

    'Code ensures only report tab is saved with no access to other data
    ActiveSheet.Copy
    Application.DisplayAlerts = False
    ActiveWorkbook.SaveAs Filename:=Filename
    ActiveWorkbook.Close
    Application.DisplayAlerts = True

Next i

My current attempts to alleviate this issue is to pause the application so background processes can do their thing. I included the following code after the SaveAs line.
Application.Wait (Now + Timevalue("0:00:05"))

A:
"...pause the application so background processes can do their thing."

Have you tried DoEvents ?
This surrenders control back to the operating system and allows it to complete any pending events before code execution resumes. If you are in a loop that's locking up you should definitely use this just so that you can manually break code execution.

ActiveWorkbook.SaveAs Filename:=Filename
DoEvents
ActiveWorkbook.Close False

More information: DoEvents in VBA


text:
Q: Question about Notation for Spaces of $n$-ary $k$-ic Forms Define an $n$-ary $k$-ic form to be a polynomial over the integers of homogeneous degree $k$ in $n$ variables. In Section 1 of the paper "Higher Composition Laws I" (linked below), Bhargava writes $(\mathrm{Sym}^k \mathbb{Z}^n)^*$ for the lattice of $n$-ary $k$-ic forms, and explains that the "$*$" is used so that the notation $\mathrm{Sym}^k \mathbb{Z}^n$ can be used to denote the sublattice of forms that arise from a polarization -- recall that an $n$-ary $k$-ic form $f$ is said to arise from a polarization if $f(z) = F(z,\dots, z)$ for some symmetric multilinear function $F \colon (\mathbb{Z}^n )^{\times k} \to \mathbb{Z}$. For example, when $k = 2$, the forms arising from a polarization are precisely those forms whose associated symmetric $n \times n$ matrix has integer entries.
However, if we are to take "$*$" to mean "dual," it seems like the notations $(\mathrm{Sym}^k\mathbb{Z}^n)^*$ and $\mathrm{Sym}^k \mathbb{Z}^n$ introduced above are backwards. The lattice of symmetric multilinear functions $F \colon (\mathbb{Z}^n )^{\times k} \to \mathbb{Z}$ is naturally identified with $(\mathrm{Sym}^k\mathbb{Z}^n)^*$, not with $\mathrm{Sym}^k \mathbb{Z}^n$. There is an injection from this lattice of symmetric multilinear functions into the lattice $\mathrm{Sym}^k ((\mathbb{Z}^n)^*)$ of homogeneous polynomials of degree $k$ in $n$-variables given by sending
$$F \in (\mathrm{Sym}^k\mathbb{Z}^n)^* \mapsto (z \mapsto F(z,\dots, z) \text{ for }z \in \mathbb{Z}^n) \in \mathrm{Sym}^k ((\mathbb{Z}^n)^*).$$
Note that the image of the above map is not all of $\mathrm{Sym}^k ((\mathbb{Z}^n)^*)$. On the other hand, the lattice of all $n$-ary $k$-ic forms is, by definition, $\mathrm{Sym}^k ((\mathbb{Z}^n)^*)$, so by choosing an identification $\mathbb{Z}^n \simeq (\mathbb{Z}^n)^*$ (say, by taking the dual basis of a basis of $\mathbb{Z}^n$), one obtains an identification between the lattice of $n$-ary $k$-ic forms and $\mathrm{Sym}^k \mathbb{Z}^n$, not $(\mathrm{Sym}^k\mathbb{Z}^n)^*$.
Am I correct to say that the notations in the aforementioned paper are backwards, or is there a good reason to use $(\mathrm{Sym}^k\mathbb{Z}^n)^*$ for the lattice of $n$-ary $k$-ic forms and $\mathrm{Sym}^k \mathbb{Z}^n$ for the sublattice of forms arising from a polarization?
Link to paper: http://ieee.scripts.mit.edu/urgewiki/images/2/25/Higher_composition_laws.pdf


text:
Q: How to focus Camera on enemy grid for a specific seconds? I am making a turn based game. I have two different tile grids. When it's player's turn, the Camera is focused on the enemy's grid to select a tile to attack. When it's computer's turn the Camera will focus on player's grid to select a random tile to attack.
Because the player has to give an Input (from mouse) to attack a tile, the Camera will be focused on the enemy's grid. However, when the computer attacks, the Camera moves very fast on the player's grid and back to the enemy's (in less than a second). What i want is to wait a few seconds so that the player can see where the attack happened. The Camera position changes inside the function Update(). Here is part of my code for that:
    private void Update()
    {
        if (playerTurn)
        {
            Camera.main.transform.position = new Vector3(40, 12.5f, -6);
            playerAttack(); //Select tile to attack
        }
        else
        {
            Camera.main.transform.position = new Vector3(-1.7f, 12.5f, -6);
            computerAttack(); //Select one random tile
        }
    }

A: You can use IEnumerator
private void Update()
{
   if (playerTurn)
   {
       Camera.main.transform.position = new Vector3(40, 12.5f, -6);
       StartCoroutine(WaitAndGO(2))
   }
   else
   {
      Camera.main.transform.position = new Vector3(-1.7f, 12.5f, -6);
      computerAttack(); //Select one random tile
   }
}
private IEnumerator WaitAndGO(float waitTime)
{
     yield return new WaitForSeconds(waitTime);
     playerAttack();
}


text:
Q: Touches(Gestures) not getting recognized on part of screen where there is a table I want to be able to handle the gestures that happen on all parts of my screen not just on the part thats not covered by the UITableView.
Is this possible? And if so how can I get it working?
Here is my code that I use to collect the touch data. I though having this line
UITouch *t = [touches anyObject];

would allow me to collect all touches.
-(void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event
{

UITouch *t = [touches anyObject];

CGPoint currentPosition = [t locationInView:self.view];

CGFloat positionDelta = currentPosition.x-_originalTouchPosition.x;

if (positionDelta > 50.0)
{
    NSLog(@"X");
}
else if (positionDelta < -50.0)
{
    NSLog(@"Y");
}
else if (positionDelta > 1)
{
    NSLog(@"Z");
}
else
{
    return;
}
}

-(void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event
{

UITouch *t = [touches anyObject];
_originalTouchPosition = [t locationInView:self.view];
NSLog(@"touches began");
}

-(void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event
{
NSLog(@"tocuhes ended");
}

Many Thanks,
-Code

A: Subclass your UITableViewCell and apply the -(void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event method in that subclass, then you will be able to detect the touch on your UITableView as well as you have the normal functionality of UITableView available.


text:
Q: Setting state parameter to a Stripe query to pass a FireStore uuid I am trying to pass a FirebaseFirestore User Uid to a Stripe / firestore cloud function.
So I would have an https query like following :
https://connect.stripe.com/express/oauth/authorize?response_type=code&client_id={accountid}&scope=read_write to open in a Webview
Here is my function
exports.connectStripeExpressAccount = functions.https.onRequest((req, res) =>{
  console.log('query state is  ----> ' + req.query.state);
  const authCode = req.query.code;
  return stripe.oauth.token({
    grant_type: 'authorization_code',
    code: authCode,
  }).then(async response => {
      var connected_account_id = response.stripe_user_id;
      const uid = req.query.state
      const writeResult = await admin.firestore().collection('Registration').doc(uid)
                           .set({'customer_id': connected_account_id});
      return res.send("Well done, account integration is completed. You can now close the window and go back to the app");
      });
});

A: For new integrations with Express Accounts you should ideally be using the Account Links functionality instead of OAuth.  That said, if you provide the state value, it should carry through, so I'd make sure you're actually providing it when opening the WebView.

A: If the User uid is stored in the query parameter state and the URL looks like this:
https://connect.stripe.com/express/oauth/authorize?response_type=code&client_id=ca_JCV8JW9ZIjBaGkwkhbDDDQegceWGidqh&scope=read_write&state=useruidxxx
Your code would look like this:
exports.connectStripeExpressAccount = functions.https.onRequest((req, res) =>{
  console.log('query state is  ----> ' + req.query.state);
  const authCode = req.query.code;
  return stripe.oauth.token({
    grant_type: 'authorization_code',
    code: authCode,
  }).then(async response => {
      var connected_account_id = response.stripe_user_id;
      const uid = req.query.state
      const writeResult = await admin.firestore().collection('Registration').doc(uid)
                           .set({'customer_id': connected_account_id});
      return res.send("Well done, account integration is completed. You can now close the window and go back to the app");
      });
});


text:
Q: is asp.net and .net framework version are same? or asp.net or clr version are same? this was my previous question
hi i am new to net framework.
can u tell me is .net framework version and asp.net version are different.
is clr version and asp.net version has some relation.
How can i get asp.net version from the registry.
Can any one give me the version list.
but i am confused with this link on SO- see the Varun's answer
he said that asp.net version and clr version is same and the .net framework version is different. i also tried to see the installed version of asp in my machine using aspnet_regiis.exe it gives the same version number as of clr (2.0 and 4.0). i also saw the aspnet_isapi.dll only in version 2.0 and 4.0 folder. does that means clr and asp.net version number are same. there is no asp.net version 3.0 and 3.5??? i was quite relaxed with guffa answer, but after seeing this i am confused can anyone help me in knowing is asp.net version and .netframework version are same? or asp.net version and clr version are same? answer with official link will be quite helpful.
Thanks in advance.

A: Yes, ASP.NET solutions, Console applications, Windows Forms and WPF applications and such-and-so, all use the same CLR (according to their version.)

A: Yes, and no.
Most versions of ASP.NET and the CLR correspond, but there are some versions of ASP.NET that comes without a new version of the CLR:
 ASP.NET     CLR
-----------------
  1.0        1.0
  1.1        1.1
  2.0        2.0
  3.0        2.0
  3.5        2.0
  4.0        4.0

Edit:
ASP.NET versions and .NET framework versions are the same. The usage of the ASP.NET versions does however differ a bit depending on what you do.
When you create a web application in Visual Studio, you can specify the target framework. This determines what libraries you can use, so ASP.NET 2.0 and ASP.NET 3.5 have different capabilities. In that sense all the above versions exist.
When you install the application on a web server, all applications in the same application pool have to run the same version of the framework, but it's actually the version of the CLR that is relevant. An ASP.NET 2.0 application can run in the same application pool as an ASP.NET 3.5 application. When you select ASP.NET/framework version in IIS it's actually only the CLR versions that you choose from, so in that sense the ASP.NET version 3.0 and 3.5 does not exist.


text:
Q: getting error when trying to ingest data from firehose to redshift getting an error 1206 and 1205 when injesting data from fireshose to redshift using a copy command
Below is the raw data on firehose
{
    "Name": "yoyo"
    "a_timestamp": "2021-05-11T15:02:02.426729Z",
    "a_date": "2021-05-11T00:00:00Z"
}

below is the copy command
COPY pqr_table FROM 's3://xyz/<manifest>' CREDENTIALS 'aws_iam_role=arn:aws:iam::<aws-account-id>:role/<role-name>' MANIFEST json 's3://xyz/abc.json' DATEFORMAT 'YYYY-MM-DD' ;

below is the DDL command
create table events (
Name varchar(8),
a_timestamp timestamp,
a_date date)

It would be great if anyone can please help me with this

A: Those are errors for bad timestamp and date formats.  You need to have "timeformat" specified with that string as it is not Redshift's default format.  I'd first try 'auto' for both of these and see if Redshift can work things out.
dateformat as 'auto'
timeformat as 'auto'

Also, having time specified in your date may create some confusion and may need you to manually specify the format or ingest as timestamp and then cast to date.  I'd fist see if 'auto' does the trick.


text:
Q: Expected :Invalid parameter object type Expected'Java.util.List' Now, I want to update my data for batch, but When I run the console when given as follows:

--- The error occurred in ibatis-config/emptyForIbatisParse_sqlmap.xml.
  --- The error occurred while preparing the mapped statement for execution.
  --- Check the VehQuaCer.updateAmtBal.
  --- Cause: java.sql.SQLException: Invalid parameter object type.  Expected 'java.util.List' but found
  'app.creditapp.lam.entity.VehQuaCer'.; nested exception is
  com.ibatis.common.jdbc.exception.NestedSQLException:
  --- The error occurred in ibatis-config/emptyForIbatisParse_sqlmap.xml.
  --- The error occurred while preparing the mapped statement for execution.
  --- Check the VehQuaCer.updateAmtBal.
  --- Cause: java.sql.SQLException: Invalid parameter object type.  Expected 'java.util.List' but found
  'app.creditapp.lam.entity.VehQuaCer'.

My DaoImpl method is as follows:
public void updateRelease(final List<VehQuaCer> list) throws DAOException {
        try{
        if(list!=null){
            this.getSqlMapClientTemplate().execute(new SqlMapClientCallback(){
                public Object doInSqlMapClient(SqlMapExecutor executor)throws SQLException{
                    executor.startBatch();
                    for(int i=0,j=list.size();i<j;i++){
                        executor.update("VehQuaCer.updateAmtBal",(VehQuaCer)list.get(i));
                    }
                    executor.executeBatch();
                    return null;
                }
            });
        }
    }catch(Exception e){
        log.error(e);
        throw new DAOException(e.getMessage());
    }

    }

My ibatis is as follows:
<update id="VehQuaCer.updateAmtBal" parameterClass="java.util.List">
    begin
    <iterate conjunction="">
    UPDATE VEH_QUA_CER SET REPAY_BAL=#[].repayBal#,SEC_BAL=#[].secBal#,ADV_BAL=#[].advBal#,RELEASE_APP_NO=#[].releaseApp# WHERE ID=#[].id#
    </iterate>
    end;
    </update>

A: From the code you have provided it seems that your query is expecting parameter as List but since in your DAOImpl if you have already iterated through the list and passing only 'VehQuaCer' object, so changing the paramterclass to VehQuaCer with full yqualified name should work.


text:
Q: "Firefox webdriver could not be verified for use in Firefox and has been disabled" Since Firefox updated to version 43, I get the following message when trying to run an application using Webdriver: "Firefox webdriver could not be verified for use in Firefox and has been disabled".  I have already toggled xpinstall.signatures.required to false to deal with the problem with unsigned extensions so this may not be the issue.  Any suggestions for making webdriver work with Firefox?

A: I had same problem and it got fixed when updated selenium to 2.48.2 .
You need to use latest selenium to work with Firefox 43.0.3.


text:
Q: Rails erb template list all functions Within a Rails html.erb template I can view all of the available instance variables using:
<%= instance_variables %>

Is there an equivalent feature for listing all of the helper methods available to be called from within this view?

A: Exactly same as instance variables
<%= methods %>

in  your rails html.erb file


text:
Q: Intermittent ProviderException from IIS or MVC: API failed due to error 'The data area passed to a system call is too small. ' Running IIS 7.5.7600.16385 on Windows Server 2008 R2 Enterprise (7601: SP1). One of our websites is set to globally log errors and we are seeing this every day or two. We're using an authorization attribute in our web.config that checks for user roles for access and whatever code IIS or MVC uses is generating this error. This is typically being triggered by a single partial view but we also see it triggered occasionally on fetching css or js resources.
System.Configuration.Provider.ProviderException: API failed due to error 'The data area passed to a system call is too small. '
at System.Web.Security.WindowsTokenRoleProvider.GetRolesForUser(String username)
at System.Web.Security.RolePrincipal.IsInRole(String role)
at System.Web.Configuration.AuthorizationRule.IsTheUserInAnyRole(StringCollection roles, IPrincipal principal)
at System.Web.Configuration.AuthorizationRule.IsUserAllowed(IPrincipal user, String verb)
at System.Web.Configuration.AuthorizationRuleCollection.IsUserAllowed(IPrincipal user, String verb)
at System.Web.Security.UrlAuthorizationModule.OnEnter(Object source, EventArgs eventArgs)
at System.Web.HttpApplication.SyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)

Do we maybe have some IIS setting for our website incorrect? Any idea what is going on? We can see by the username in our logs that the user is being correctly authenticated through IWA.


text:
Q: How to evaluate this indefinite integral $\int\frac{\cos(x)}{1+\mathrm{e}^x}\mathrm{d}x$ One of my student asked me to help her evaluate this indefinite integral $$\int\dfrac{\cos x}{1+e^x}\mathrm{d}x,$$
and I tried several minutes, but at last I had to given up, for I thought that  it is very possible the primitive of $\dfrac{\cos x }{1+e^x}$ can not be expressed in terms of elementary functions. And then, I resorted to Maple and  Mathematica. But these two computer algebra systems can not give me the answer, which shows that it is very certain that that indefinite integral is irreducible. But since I am not very familiar with differential Galois theory, I do hot know how to tell my student?  Can anyone help me?

A: Since:
$$\int e^{-kx}\cos x\,dx = \frac{\sin x - k\cos x}{(1+k^2)\,e^{kx}}$$
we just have:
$$\int\frac{\cos x}{1+e^x}\,dx = \sum_{k\geq 1}(-1)^{k+1}\frac{\sin x - k\cos x}{(1+k^2)\,e^{kx}}.$$


text:
Q: Can diffraction be used like gravitational lensing I was thinking that in both the cases of diffraction and gravitational lensing, light is bend to some extent mimicking the lens effect. My Question is, Can diffraction be used like gravitational lensing in the sense that gravitational lensing is usable for objects which are very very far(in light-years or parsecs), similarly can diffraction be used for short ranges(In meters) like a glass lens

A: If I take you question to be 'can diffraction act as a lens in the same way that a gravitational field can act as a lens' then the answer is yes. Yes with Zone Plates.
Zone plates look like diffraction patterns. for example see the image below

When light passes through the zone plate it will be focussed in a way that is very similar to the way a lens focusses light. I have seen zone plates used with a coherent source of x-rays because there is not really any material that could be used as a traditional glass lens to make an image with x-rays.
It is not straight forward to explain how a zone plate works. The way I think about it is the following. If you imagine monochromatic light from a point source hitting a screen after passing through a single circular apperture you get a pattern like the zone plate. Now if we imagine that we reverse the path of the light and have monochromatic coherent light coming through a zone plate with the same pattern then it should be focussed to a point the same distance from the zone plate as the circular apperture was from the diffraction pattern.


text:
Q: Locking mechanism for shell scripts Hi I have a shell script which calls another script and I have locking mechanism inside main script.
Please check below code.
Does this mean that other script(/home/user/anotherscript.sh) will not be called and executed as long as script is locked by locking mechanism.
function funcexit() {
     echo "Locked"
    exit 1
}
(
    flock -x -w 10 549 || funcexit
       bash /home/user/anotherscript.sh

      do some stuff

)

Please let me know the thougts...

A: The script line flock -x -w 10 549 || funcexit says: "try to get an exlusive lock on fd# 549, with maximum waiting time of 10 seconds, if successfully acquire the lock, continue with the next line, otherwise call function funcexit " thus, if the script can not acquire the lock in 10 seconds, funcexit will be called (thus exit).


text:
Q: why is the markdown geany plugin missing from the repository? The geany plugin web page suggests it thinks 'markdown' should be in the group plugin package but on downloading there is no code for that particular function. The author has shown me where to get the source, but there is no point me compiling it if someone more knowledgeable than me has taken a positive step to omit it. Is this a webkit issue?

A: The answer to your question is contained in package changelog:

geany-plugins (1.32+dfsg-3) unstable; urgency=medium

*

*[67b34ed] Disable webkit-using plugins: markdown, webhelper
webkitgtk-3.0 is not to be used as it is deprecated, but the port to
webkit2gtk-4.0 isn't ready yet.

Then the Markdown plugin was re-enabled starting with version 1.37+dfsg-5 which came with 21.04.
So currently there are two Ubuntu versions with geany-plugin-markdown package - 21.04 and 21.10.

If you need to compile geany-markdown-plugin on 18.04 LTS use the patching and compiling method below:
software-properties-gtk # enable Source Code here, reload the lists

# get
sudo apt-get build-dep geany-plugins
sudo apt-get install libwebkitgtk-3.0-dev fakeroot

cd ~/Downloads
apt-get source geany-plugins
cd geany-plugins-1.32+dfsg

# patch
sed -i "s/--disable-peg-markdown/--enable-peg-markdown/" debian/rules
sed -i "s/--disable-markdown/--enable-markdown/" debian/rules

cat <<\EOF > ~/Downloads/debian-control.patch
55c55
< #        geany-plugin-markdown (>= ${source:Version}),
---
>          geany-plugin-markdown (>= ${source:Version}),
469,478c469,478
< # Package: geany-plugin-markdown
< # Enhances: geany
< # Architecture: any
< # Depends: ${geany:ABI}, geany-plugins-common (= ${binary:Version}),
< #         ${shlibs:Depends}, ${misc:Depends}
< # Description: markdown plugin for Geany
< #  This plugin provides a real-time preview of rendered Markdown in Geany.
< #  .
< #  Geany is a small and lightweight integrated development environment using the
< #  Gtk+ toolkit.
---
> Package: geany-plugin-markdown
> Enhances: geany
> Architecture: any
> Depends: ${geany:ABI}, geany-plugins-common (= ${binary:Version}),
>          ${shlibs:Depends}, ${misc:Depends}
> Description: markdown plugin for Geany
>   This plugin provides a real-time preview of rendered Markdown in Geany.
>   .
>   Geany is a small and lightweight integrated development environment using the
>   Gtk+ toolkit.
EOF
patch debian/control < ~/Downloads/debian-control.patch

# compile, build and install
cd ~/Downloads && apt-get source -b geany-plugins
sudo apt-get install ./geany-plugin-markdown_1.32+dfsg-3_amd64.deb

Then launch Geany and enable the plugin from in it using Tools → Plugin Manager and enjoy.
For Ubuntu 20.04 LTS this method may be adapted as follows:
software-properties-gtk # enable Source Code here, reload the lists

# get
sudo apt-get build-dep geany-plugins
sudo apt-get install libwebkit2gtk-4.0-dev fakeroot

cd ~/Downloads
apt-get source geany-plugins
cd geany-plugins-1.36+dfsg

# patch
sed -i "s/--disable-peg-markdown/--enable-peg-markdown/" debian/rules
sed -i "s/--disable-markdown/--enable-markdown/" debian/rules

cat <<\EOF > ~/Downloads/debian-control.patch
55c55
< #        geany-plugin-markdown (>= ${source:Version}),
---
>          geany-plugin-markdown (>= ${source:Version}),
469,478c469,478
< # Package: geany-plugin-markdown
< # Enhances: geany
< # Architecture: any
< # Depends: ${geany:ABI}, geany-plugins-common (= ${binary:Version}),
< #         ${shlibs:Depends}, ${misc:Depends}
< # Description: markdown plugin for Geany
< #  This plugin provides a real-time preview of rendered Markdown in Geany.
< #  .
< #  Geany is a small and lightweight integrated development environment using the
< #  Gtk+ toolkit.
---
> Package: geany-plugin-markdown
> Enhances: geany
> Architecture: any
> Depends: ${geany:ABI}, geany-plugins-common (= ${binary:Version}),
>          ${shlibs:Depends}, ${misc:Depends}
> Description: markdown plugin for Geany
>   This plugin provides a real-time preview of rendered Markdown in Geany.
>   .
>   Geany is a small and lightweight integrated development environment using the
>   Gtk+ toolkit.
EOF
patch debian/control < ~/Downloads/debian-control.patch

# compile, build and install
cd ~/Downloads && apt-get source -b geany-plugins
sudo apt-get install ./geany-plugin-markdown_1.36+dfsg-1_amd64.deb


text:
Q: Sass list separators and writing a clean @mixin I have a @mixin that allows me to name-space selectors. The code is below:
@mixin pre-assign($value) {
  $pre: $value !global;
}

@include pre-assign('foo');

@function str-replace($string, $search, $replace: '') {
  $index: str-index($string, $search);

  @if $index {
    @return str-slice($string, 1, $index - 1) + $replace +
      str-replace(
        str-slice($string, $index + str-length($search)),
        $search,
        $replace
      );
  }

  @return $string;
}

@mixin pre($value) {
  $result: '';

  $result: str-replace($value, '.', '.#{$pre}-');

  #{$result} {
    @content;
  }
}

I can use the @mixin as follows:
// declaration
@include pre('.bar + .baz') {
  display: none;
}

// output
.foo-bar + .foo-baz {
  display: none;
}

I want to tidy up the way that I pass selectors to the @mixin and omit the quotes, so that I am not passing selectors as string values:
@include pre(.bar + .baz) {
  display: none;
}

However, when I attempt to do so, I am met with the following error:

ERROR in ./lib/all.scss (./node_modules/css-loader!./node_modules/sass-loader/lib/loader.js!./lib/all.scss)
Module build failed (from ./node_modules/sass-loader/lib/loader.js):
@include pre(.bar + .baz) {
              ^
Invalid CSS after "@include pre(": expected expression (e.g. 1px, bold), was ".p--compact) {"

I suspect this is something to do with the $list_separator, but am not sure how to achieve this. Does anyone know how to achieve this?

A: Yeah, the operators need to be strings. But you can pass the selectors without strings. DEMO
Code
$pre: ;

@mixin namespace($args...) {
  $selector: '';

  @each $val in $args {
    $index: index($args, $val);
    $selector: $selector + if($index % 2 == 1, '.#{$pre}-#{$val}', ' #{$val} ');
  }

  #{$selector} {
    @content
  }
}

Usage
@include namespace(cool, '+', stuff) {
  color: green;
}

@include namespace(stuff, '~', things) {
  color: red;
}

@include namespace(stuff, '*:not(.lame)', things) {
  color: red;
}

A: If you really feel the need to not use strings, you could put your operators in a map; DEMO
CODE
$operators: (
  adjacent: '+',
  general: '~',
  universal: '*',
  child: '>',
  descendent: ' '
);

@mixin namespace($list...) {
  $selector: '';

  @each $arg in $list {
    $index: index($list, $arg);
    $val: if($index % 2 == 1, '.#{$pre}-#{$arg}', map-get($operators, $arg));
    $selector: $selector + $val;
  }

  #{$selector} {
    @content
  }
}

USAGE
@include namespace(cool, adjacent, stuff) {
  color: green;
}

@include namespace(cool, general, stuff) {
  color: green;
}


text:
Q: ¿Por qué tengo una columna adicional con TreeView? Estoy creando una interfaz gráfica para una aplicación de chat (que funciona por consola actualmente).
El problema que tengo es que al usar el widget ttk.TreeView y crear 3 columnas me aparecen 4 y una de ellas vacía (la última). Os dejo una captura de pantalla y el código. ¿Cómo podría eliminar esa "Columna vacía" de mi TreeView?

Aquí os dejo el código:
def GUI():
    root = Tk()
    root.title("Chat - RuDaHee")

    frame = Frame(root).grid(row=0, column=0, padx=5, pady=5)

    chat = ttk.Treeview(frame, height=10, columns=("#0","#1", "#2"), selectmode="extended")
    chat.heading('#0', text='Hora', anchor=CENTER)
    chat.heading("#1", text="Usuario", anchor=CENTER)
    chat.heading("#2", text="Mensaje", anchor=W)
    chat.column("#0", stretch=NO, width=80)
    chat.column("#1", stretch=NO, width=80)
    chat.column("#2", stretch=NO, width=380)

    chat.grid(row=0, column=0, columnspan=2, padx=10, pady=10, sticky="nsew")

    escribirMensaje = Entry(frame, width=87).grid(row=1, column=0, sticky="w", padx=10, pady=10)
    enviarMensaje = Button(frame, text="Enviar").grid(row=1, column=1, sticky="e", padx=10, pady=10)
    root.mainloop()

GUI()

A: La primera columna es siempre el índice de la tabla del Tree y por defecto su identificador es siempre '#0'. Al asignar tres columnas mediante el argumento columns creas tres columnas más el índice, por lo que aparentemente ves 4).
Una solución es pasar a columns solo los identificadores de tus dos columnas sin incluir #0:
import tkinter as tk
from tkinter import ttk

def gui():
    root = tk.Tk()
    root.title("Chat - RuDaHee")

    frame = tk.Frame(root).grid(row=0, column=0, padx=5, pady=5)

    chat = ttk.Treeview(
        frame,
        height=10,
        columns=("#1", "#2"),
        selectmode="extended",
        )
    chat.heading('#0', text='Hora', anchor=tk.CENTER)
    chat.heading("#1", text="Usuario", anchor=tk.CENTER)
    chat.heading("#2", text="Mensaje", anchor=tk.W)
    chat.column("#0", stretch=tk.NO, width=80)
    chat.column("#1", stretch=tk.NO, width=80)
    chat.column("#2", stretch=tk.NO, width=380)

    chat.grid(row=0, column=0, columnspan=2, padx=10, pady=10, sticky="nsew")

    escribir_mensaje = tk.Entry(frame, width=87)
    escribir_mensaje.grid(row=1, column=0, sticky="w", padx=10, pady=10)
    enviar_mensaje = tk.Button(frame, text="Enviar")
    enviar_mensaje.grid(row=1, column=1, sticky="e", padx=10, pady=10)

    # Ejemplo de insercion de datos
    chat.insert("", 'end', text="11:15", values=("Fulanito","¡Hola!"))

    root.mainloop()

if __name__ == "__main__":
    gui()

Otra opción es que ignores el propio índice no mostrándolo (show="headings") y crees tres columnas (recuerda que #0 está reservado para el índice, aunque no lo muestres sigue ahí):
import tkinter as tk
from tkinter import ttk

def gui():
    root = tk.Tk()
    root.title("Chat - RuDaHee")

    frame = tk.Frame(root).grid(row=0, column=0, padx=5, pady=5)

    chat = ttk.Treeview(
        frame,
        height=10,
        columns=("#1", "#2", "#3"),
        selectmode="extended",
        show="headings"
        )

    chat.heading('#1', text='Hora', anchor=tk.CENTER)
    chat.heading("#2", text="Usuario", anchor=tk.CENTER)
    chat.heading("#3", text="Mensaje", anchor=tk.W)
    chat.column("#1", stretch=tk.NO, width=80)
    chat.column("#2", stretch=tk.NO, width=80)
    chat.column("#3", stretch=tk.NO, width=380)

    chat.grid(row=0, column=0, columnspan=2, padx=10, pady=10, sticky="nsew")

    escribir_mensaje = tk.Entry(frame, width=87)
    escribir_mensaje.grid(row=1, column=0, sticky="w", padx=10, pady=10)
    enviar_mensaje = tk.Button(frame, text="Enviar")
    enviar_mensaje.grid(row=1, column=1, sticky="e", padx=10, pady=10)

    # Ejemplo de inserción de datos
    chat.insert("", 'end', values=("11:15","Fulanito","¡Hola!"))

    root.mainloop()

if __name__ == "__main__":
    gui()

Ahora bien, la forma rellenar la tabla varía. En el primer caso la hora (columna índice) debes pasarla al argumento text de TreeView.insert, mientra usuario y mensaje los pasas mediante el argumento values. En el segundo caso, los tres datos los pasa mediante la tupla de values, ignorando el índice, ya que los tres son columnas.


text:
Q: Change application page object I want to change text in pop-up which appears, when user clicks facebook 'like' button on my site.
I use 'facebook object debugger' and can see where from this text is pulled:

I know, that I can put facebook metatags in header, like this:
<meta property="og:type" content="article" />
<meta property="og:title" content="Facebook Data Use ..." />
... and so on...

It will change this block.

But I want to change an object parameters, shown in first screenshot.
Please, anyone help me. Thanks a lot.


text:
Q: Service did not respond in a timely fashion - Very large database I have a very large sql database that I was trying to switch over to a different computer. When starting sql on that other computer I got the error of
"service did not respond in a timely fashion".
So I switched the database back to my original computer, got the same error, deleted the ibdata and ib log files and .frm files. Same error.
I assume it's not waiting long enough to read the tables but don't know how to correct this. I read the fixes about VIA protocol but this is not a networked drive, its just connected via usb.
My main concern is that my database will be lost. Please reassure me that if i have the ibd file that my database is still safe.

A: I'm thinking I should reimport my ibd file using this method.
https://dev.mysql.com/doc/refman/5.6/en/innodb-migration.html#copy-tables-cold-backup
Correct?
Edit. I was able to reimport my data using this method. Just had to remake my schema similar enough to the original.


text:
Q: Force Show the latest Chatter Feed Item relating to a record Not really a question but something cool that might belong here, we had a customer that has a round robin process for lead assignment driven by a button. We from there are calling a hidden Visualforce page which runs a class updating the record with the appropriate new OwnerId.
Now they wanted an indication that this roundrobin process was successful without having to scroll down to the OwnerField (which they did not want to relocate) or the field history related list. So I found you can use chatter to achieve this instead.
Adding this URL parameter to our redirect ?fid='ChatterFeedIdvalue' i.e. ?fId=0D5N0000000X22JKAS forces the chatter feed open and shows a cool value called 'This update' right at the top of the page. i.e.
![Chatter Feed]: http://i.imgur.com/hN4ZVEO.png?1


text:
Q: How can i scrape the google search result 2nd page only? I'm having trouble on scraping the second page of the google search result,  After scraping the result it will save the page on the file. It only scrape the first page.
Here is my code:
$url = 'http://www.google.com/search?q='.$in;
$datenbank = "proxy_work.php";
$datei = fopen($datenbank,"w+");
$datenbank = "proxy_work.php";
fwrite($datei, $url);
fwrite ($datei,"\r\n");
fclose($datei);
// echo file_get_contents("proxy_work.php");
$html = file_get_html("proxy_work.php");
foreach($html->find('a') as $e){
    //  $title = $h3->innertext;
    $link  = $e->href;
    //  if(in_array($endomain, $approveurl)){
            //
        }
    // if it is not a direct link but url reference found inside it, then extract
    if (!preg_match('/^https?/', $link) && preg_match('/q=(.+)&sa=/U', $link, $matches) && preg_match('/^https?/', $matches[1])) {
        $link = $matches[1];
    } else if (!preg_match('/^https?/', $link)) { // skip if it is not a valid link
        continue;
    }
}


text:
Q: Ruby on Rails - Delete something from an array I have a question with this code. In this view I iterate over an array but I want to have the option to delete an entry from the array. Here is my code
view

    Ware
    Anzahl
    Einzelpreis
    Gesamtpreis

  <% counter = 0 %>
    <% $itemarray.each do |iarray| %>

      <% @items.each do |item| %>
        <% if iarray.to_i == item.id %>
           <%= item.name %>
           <%= $anzahlarray[counter] %>
           <%= item.price.round(2) %> €
            <% preistemp = preistemp = item.price * $anzahlarray[counter].to_f %>
           <%= preistemp.round(2) %> €

           <%= link_to 'Show', item_path(item) %>
           <%= link_to 'Destroy', :hidden_param => 'counter' , method: :deleteshoppingcartentry(counter), data: {confirm: 'Are you sure?' }%>
        <% end %>
      <% end %>

    <% counter += 1 %>
  <% end %>

controller
def deleteshoppingcartentry
   $itemarray.delete_at($entrynumber)
   $anzahlarray.delete_at($entrynumber)

   redirect_to "/orders/new"
end

maybe you could help me out

A: You can't delete items from a global array variable. Use a database instead. Learn more about Rails' ActiveRecord.


text:
Q: Cartoon about a boy who goes to an underground world and collects monster pets There was this cartoon I watched when I was a kid (watched around 2008–2015), and I cannot remember its name. All I can remember about this cartoon is that the main character followed in his dad's footsteps to go to this underground world accompanied by a (I think) monster pet of some sort (pretty sure it could shoot fire). His dad had made him promise to only go after he became a certain age. After that he ends up finding/saving/raising more of these monster pets. As for the people that live down there, I remember a few scenes where they themselves raise these pets for various reasons (especially combat as they can do things like breathe fire and have other magical abilities) and at one point these people form an expedition to try and get to the surface, which they believe is some fantasy place filled with gold and riches. This leads the mc to go and close the small tunnel he came in. I also vaguely remember him forming some sort of team of other like-minded people and creating a base of sorts.
Unfortunately, this is about all I can remember about the cartoon/possibly anime (although I doubt it is). I was thinking it might have only been an arc of some other cartoon but based on the part about him closing the tunnel for good I find that highly unlikely. Additionally, based on the structure of what I can remember, I think it had episodes. Any help would be appreciated as I cannot find a trace of it.

A: Gosh, after an hour I remembered that it had 'terra' in its title. After some searching, I finally found it: Slugterra.


text:
Q: If the Gateaux derivative is not linear does this mean the Frechet derivative doesn't exist? It seems to be true as if the frechet exists then it is the same as the gateaux which would then be nonlinear (contradiction) but this seems useful yet I can't really find it anywhere and the lecturer hasn't mentioned it. Thanks.

A: I don't when if you are working in Euclidean spaces or normed spaces, but
anyway, Frechet differentiability at a point $x_{0}$ for a function
$f:E\rightarrow Y$, where $E\subseteq X$, means
$$
\lim_{x\rightarrow x_{0}}\frac{\Vert f(x)-f(x_{0})-L(x-x_{0})||_{Y}}{\Vert
x-x_{0}||_{X}}=0
$$
where $L:X\rightarrow Y$ is linear and continuous. Now if $x_{0}$ is an
interior point of $E$, then taking a direction $v\in X$ with norm $\Vert
v||_{X}>0$ and $x=x_{0}+tv$, you get that
\begin{align*}
0  & =\lim_{x\rightarrow x_{0}}\frac{\Vert f(x)-f(x_{0})-L(x-x_{0})||_{Y}%
}{\Vert x-x_{0}||_{X}}=\lim_{t\rightarrow0}\frac{\Vert f(x_{0}+tv)-f(x_{0}%
)-L(x_{0}+tv-x_{0})||_{Y}}{\Vert x_{0}+tv-x_{0}||_{X}}\\
& =\lim_{t\rightarrow0}\frac{\Vert f(x_{0}+tv)-f(x_{0})-tL(v)||_{Y}}{|t|\Vert
v||_{X}}=\frac{1}{\Vert v||_{X}}\lim_{t\rightarrow0}\left\Vert \frac
{f(x_{0}+tv)-f(x_{0})}{t}-L(v)\right\Vert ,
\end{align*}
which implies that there exists the Gateaux derivative in the direction $v$
with$$
\frac{\partial f}{\partial v}(x_{0})=L(v).
$$
Since $L$ is linear, it follows that $v\mapsto\frac{\partial f}{\partial
v}(x_{0})$ has to be linear.


text:
Q: Using LinkedList in java, when needing both List and DeQueue methods If I want to instantiate a LinkedList and require access to the methods in both List and Dequeue interfaces, and do not want to type to the concrete implementation, and do not want to cast between interfaces, is there a way?
i.e.:
LinkedList ll = new LinkedList(); // don't want to do this...

List ll = new LinkedList();
ll.peekFirst(); // can't access peekFirst method
((DeQueue) ll).peekFirst(); // Kinda ugly

A: public interface Foo<T> extends List<T>, Deque<T>{}

public class Bar<T> extends LinkedList<T> implements Foo<T>{}

Foo ll = new Bar();

Don't have eclipse near me, this should compile though.

A: I think in Java you have no choice but to use the concrete type, or store two references to the same object, one typed as List, and the other as Dequeue.
List<T>       list;
Dequeue<T>    queue;

/** Construct a new instance of SomeClass */
private SomeClass() {
    LinkedList<T> tmp=new LinkedList<T>();
    list=tmp;
    queue=tmp;
    }

Not saying I especially like that, though.

A: I don't see how you can do that if you are declaring ll as a java.util.List.  Should be able to create your own class but then you'll be tied to that and not to the stock classes/interfaces...


text:
Q: SerializerMethodField's function get_fieldname is not being called I have this Serializer
    class RemovePermissionsSerializer(serializers.ModelSerializer):
        user_permissions = serializers.SerializerMethodField()

        def get_user_permissions(self, instance):
            print(1)
            **logic**
            return data

        class Meta:
            model = User
            fields = [
                "user_permissions"
            ]

and a generic viewset with this action
@action(
        methods=["patch", "put"],
        detail=True,
        url_name="add-permissions",
        url_path="add-permissions"
    )
    def add_permissions_request(self, request, pk):
        serializer = self.get_serializer(data=request.data)
        serializer.is_valid(raise_exception=True)
        user = self.get_object()
        user_permissions = serializer.validated_data.get("user_permissions")
        response = User.add_permissions(user, user_permissions)
        return Response(response, status=status.HTTP_200_OK)

the function get_user_permissions is not being called whatever I put in it, even print() is not showing anything, any help please?

A: Here you use the serializer in the other way. A SerializerMethodField is read-only: since a function is always input to output. Here you are trying to work with it in the write direction.
This is one of the many reasons why using a SerializerMethodField is often not a good idea.
Usually it makes more sense to work with a sub-serializer, a PrimaryKeyRelatedField [drf-doc], or a SlugRelatedField [drf-doc].
You can for example use:
from django.contrib.auth.models import Permission

class PermissionSerializer(serializers.ModelSerializer):
    class Meta:
        model = Permission
        fields = ['__all__']

class RemovePermissionsSerializer(serializers.ModelSerializer):
    user_permissions = PermissionSerializer(source='permission', many=True)

    class Meta:
        model = User
        fields = ['user_permissions']
then you specify all the details of the permission, or you can work with a PrimaryKeyRelatedField or SlugRelatedField to let the user specify the primary key of the permission, or some other field ("slug"):
from django.contrib.auth.models import Permission

class RemovePermissionsSerializer(serializers.ModelSerializer):
    user_permissions = serializers.PrimaryKeyRelatedField(
        source='permission', many=True, queryset=Permission.objects.all()
    )

    class Meta:
        model = User
        fields = ['user_permissions']


text:
Q: parsequery custom listview I have a login and signup screen (activity) built. The next will be a list view (it is a social app and will be similar to Facebook or Twitter). I can get my data from Parse just fine (in the form of IEnumerable<ParseObject>).
How do I take that data and pass it over to a custom adapter to populate the list view?
About the most success I've has was for the list to populate with ParseObject.object.
That is literally what the list said. Should I be using something other than ParseObject.GetQuery?


text:
Q: Can a fetch request template not be used with NSFetchedResultController? This code is in my Entity+CoreDataProperties.swift file:
@nonobjc public class func mFetchRequest() -> NSFetchRequest<Entity> {
    return (getContext().persistentStoreCoordinator?.managedObjectModel.fetchRequestTemplate(forName: "MEntityRequest"))! as! NSFetchRequest<Entity>
}

In my NSFetchedResultsControllerDelegate extension code I call this function like so:
var fetchedResultsController: NSFetchedResultsController<Entity> {
    if _fetchedResultsController != nil {
        return _fetchedResultsController!
    }

    let fetchRequest: NSFetchRequest<Entity> = Entity.mFetchRequest()

    // Edit the sort key as appropriate.
    let sortDescriptor = NSSortDescriptor(key: "name", ascending: true)

    fetchRequest.sortDescriptors = [sortDescriptor]

    let aFetchedResultsController = NSFetchedResultsController(fetchRequest: fetchRequest, managedObjectContext: self.managedObjectContext!, sectionNameKeyPath: nil, cacheName: "Master")
    aFetchedResultsController.delegate = self
    _fetchedResultsController = aFetchedResultsController

    do {
        try _fetchedResultsController!.performFetch()
    } catch let error as NSError{
        print("Unresolved Fetch Error \(error), \(error.userInfo)")
    }

    return _fetchedResultsController!
}

By setting the sortDescriptors on the fetch request I get the error: 'NSInternalInconsistencyException', reason: 'Can't modify a named fetch request in an immutable model.'
When I do not set the sortDescriptors: 'NSInvalidArgumentException', reason: 'An instance of NSFetchedResultsController requires a fetch request with sort descriptors'
What am I not doing correctly? Can NSFetchResultsController simply not use Fetch Request Templates?


text:
Q: How to get different values from multiple input field (React js) I have a component;
    import React, { useState, useRef } from 'react'
import cal from './image/bgimg.jpg'

function Home() {
    const [state, setState] = useState({
        semester: '',
        credit: '',
        sgpa: ''
    })
    const [noOfSem, setNoOfSem] = useState([])

    const handleChange = (e) => {
        setState({ ...state, [e.target.name]: e.target.value })
    }

    const handleClick = () => {
        let sems = [];
        for (let index = 0; index < state?.semester; index++) {
            sems.push(index + 1);
        }
        console.log(sems)
        setNoOfSem(sems);
    }
    const emptySemester=()=>{
        setState({...state,semester:''})
        setNoOfSem([])
    }
    const handleCgpaSubmit=()=>{
        console.log(state.credit,state.sgpa)
    }

    return (

                                <input type="number" value={state?.semester} name='semester' onChange={handleChange} placeholder='Enter Total Semester' />
                                {noOfSem.length===0?
                                <button type="button" className="btn btn-success btn333" onClick={handleClick}>Submit</button>
                                :
                                <button type="button" className="btn btn-success btn333" onClick={emptySemester}>Reset Semester</button>
                                }

                                {noOfSem?.map((item, index) =>
                                    <>

                                            Semester {index + 1}
                                            <input type="Number" name='credit' value={state.credit} onChange={handleChange} placeholder='Total Credit' />
                                            <input type="Number" name='sgpa' value={state.sgpa} onChange={handleChange} placeholder={`SGPA sem${index + 1}`} />

                                    </>
                                )}
                                {noOfSem.length>0 &&
                                <button type="button" className="btn btn-success btn3334" onClick={handleCgpaSubmit}>Submit</button>
                                }

    )

}

export default Home

On the above component I have some dynamic input fields,Mentioned below:
    {
noOfSem?.map((item, index) =>
                                        <>

                                                Semester {index + 1}
                                                <input type="Number" name='credit' value={state.credit} onChange={handleChange} placeholder='Total Credit' />
                                                <input type="Number" name='sgpa' value={state.sgpa} onChange={handleChange} placeholder={`SGPA sem${index + 1}`} />

                                        </>
                                    )}

My issue is "I want different data from each dynamic input field",How to achive this.
I want different input data in each dynamic field,but don't know what will be the process.I am getting same data in all field as given below screenshot.
Screenshot
Thanks in advance


text:
Q: How to compute power spectrum from 2D FFT I've encounter a problem when doing my lab assignment, not sure how to implement this:
Use fft2 on a gray image and to do Fourier transform and then compute the power spectrum. This is my code so far:
>> Pc = imread('pckint.jpg');
>> whos Pc;
  Name        Size             Bytes  Class    Attributes

  Pc        256x256            65536  uint8

>> imshow(Pc);
>> result = fft2(Pc);

My question is from the result. How to computer power spectrum?

A: Try:
psd=abs(fftshift(fft2(Pc))).^2;

In dB:
psd=immultiply(log10(abs(fftshift(fft2(Pc)))), 20);

A: I guess that you are looking for the logarithmic form of FFT, because this is one of the better ways to express the power spectrum of the Fourier series, because the dynamic range of the spectrum is so large compared to the 8 bits of the display that the bright values in the center dominate the result, this difficulty is handled via a log transformation.
This is the way of doing in MATLAB:
I = imread('cameraman.tif');
imshow(I)
F = fft2(I);
shF = fftshift(F);
Log = log2(1 + abs(shF));
imshow(Log, []);

The empty brackets at the end of the imshow expression is necessary to display the image in the specifying range, for this case that means [min(I(:)) max(I(:))]; that is the minimum value in I is displayed as black, and the maximum value as white.


text:
Q: From Xaml-String to Wpf-Window I keep having problems with creating a Wpf-Window from a Xaml-String.
What works:
I have a Server running which can receive Strings from remote Clients. (That is not complicated and works perfectly)
What doesn't work:
Sometimes the Server receives a String with the content of a Xaml-File. Know I want to create a window dynamically with all the content specified in the Xaml-String.
Is there an easy way to do that?

A: var window = XamlReader.Parse(SomeXamlString) as Window;


text:
Q: Salesforce JSON Nested Self-Related Objects? Looks like I need some help here. Salesforce documentation and multiple google searches not gave me an answer.
Problem description:
I'm trying to insert (POST) nested self-related records using REST with JSON, but every time this error appears:
{
"message": "Cannot deserialize instance of <unknown> from FIELD_NAME value records or request may be missing a required field",
"errorCode": "JSON_PARSER_ERROR"
}

JSON:
{
"records" :[{
     "attributes" : {"type" : "Test_Obj1__c", "referenceId" : "ref1"},
     "name" : "integr parent",
     "Test_Obj1__r" : {
          "records" : [{
                "attributes" : {"type" : "Test_Obj1__c", "referenceId" : "ref2"},
                "name" : "integr child"
            }]
        }
    }]
}

Request:
https://mySandboxInstance.com/services/data/v37.0/composite/tree/Test_Obj1__c/
Authorization: OAuth security_token
Content-Type: application/json
So, as you can see Test_Obj1__c is self-related and Child Relationship Name is "Test_Obj1".
I've tested with different self-related objects - it gives same result.
If I'm changing Test_Obj1__r to relation with different child object - it works fine.
Is there any way to insert nested self-related objects through one REST request?


text:
Q: How to extract specific segments from powerline? Powerline (https://github.com/Lokaltog/powerline) is a generic installation for powerlines for shells, vim, tmux, etc. Once installed including the following the tmux config will generate the right side of the status line in the tmux:
powerline tmux right

However, this is cluttered with a lot of information, so ideally I only want to extract specific segments using powerline to include in tmux status line.
For example, instead of using:
set -g status-right '#(powerline tmux right)'

If I was interested in 'uptime', 'datetime', and 'cpu', I would want use, say:
set -g status-right '#(powerline tmux right uptime,datetime,cpu)'

PS: I am unable to create a new tag 'powerline', and 'vim-powerline' is not the same as this.

A: You will have to modify your config file in order to add or remove segments as explained here: https://powerline.readthedocs.org/en/latest/configuration.html#quick-setup-guide
You don't need to fiddle with tmuy settings only once to tell tmux to use Powerline. Once tmux picks it up for its status bar you only need to adapt the Powerline config file to your needs. You might want to search github for examples. It's a bit of a nuisance to find out how it works for all the different segments or for additional ones.