text:
Q: Story about old video game console, a yard sale, and giant robotic cockroaches? I read a ebook story once, it was pretty short I think, but it was pretty funny. I think the cover had some sort of 8-bit type art on a white background but I might be wrong. I read it a few years ago but I'm not sure when it was published. Here's what I can remember;

*

*Starts with a kid who wants to go buy a video game, but he's short $20 because somebody took some

*So he starts a yard sale and sells his dads old video game console

*Jump ahead some, as he leaves the video game store his dad runs up to him and says something, then gets pulled into a car with some evil guys who drive away

*I think he meets his friend about this time, who has braces and there was something about rubber bands, I think?

*His friends dad also had an old video game console, which he needs for something

*Somehow ends up inside the game console which is some government computer dealio thing

*Gets some sort of secret information, then gets out somehow

*Needs to be hypnotized for some reason

*Starts seeing words scroll on walls

*President does some kind of secret code speech

*Battle against a robo cockroach, a weird dog thing hybrid and their owners

*Something about magic string?

And that's all I remember right now. Any idea what story this is?

A: Game Over, Pete Watson by Joe Schreiber

When videogame obsessed Pete Watson discovers his dad is not only a super-spy but has been kidnapped and is now trapped inside a video game, he has to use his super gaming skills and enter the game to rescue him.  Will he be able to save his friends and family and the entire world from giant mechanical cockroaches and a massive cyber attack set to take down the world's network?  And if he succeeds, who will save Pete from his massive crush on Callie Midwood?

This review mentions the salient details of the console sale and the president getting involved.

There was a lot to like -- a sort of mystery/adventure when Pete has a yard sale to raise money to buy the newest and greatest video game, which results in selling a special piece of equipment his dad uses that could have worldwide consequences -- even the President of the U.S. is affected! The conversational style made it easy to read. Pete Watson is writing it all down, and even says that the full electronic version will have clips and videos. It is accompanied by black and white hand-drawn kid-style illustrations as well. There's a fun flip book at the bottom as well.

Found with a search for novel father's "video game console" trapped inside


text:
Q: increasing app badge number on iphone app i use Java pns for the push on my app,
this is how i use it:
    public static PushedNotifications Push(String token,String message,String Sound,int badge) throws CommunicationException, KeystoreException{
         String key=PushUtil.class.getResource("cert.p12").getPath();
         PushedNotifications pn= Push.combined(message, badge, Sound, key, "Pass", true, token);
         System.out.println("pn: "+pn);
         return pn;
    }

is there a way to send a notification with the amount to increase the badge instead of
just setting it?

A: Not that I'm aware of. The badge number is just a replacement. If it's meant to reflect some sort of state, you should maintain that state in your server, and always push the absolute value.

redpajama_set_name: RedPajamaStackExchange


text: Q: How can we be sure that T(n) = O(g(n)) means that there is no other solution which are not O(g(n)) My question is simple. Given a recurrence T(n) which give an expression of T(n) from the value of T on smaller value of the input, for instance T(n) = T(n/2)+2n, if we find that a solution to T(n) is, let's say in O(lg2(n)) ( I didn't take the time to verify it on this instance, it is just an example ), how can we be sure that there is no other solution that solves the recurrence equation too but not being in O(lg2(n)) ? In a more general way, if you find f(n) that solves the recurrence T(n) and that you know f(n) = O(g(n)), can you be sure that every solution to T(n) is in O(g(n)) and if yes, why ?


text:
Q: Remove border in ggplot2 I would like to remove the white border in a .png output file, using ggplot2.
I'm using Windows 10 with Rstudio, ggplot2, and geom_raster. After spending time searching on forums, and playing with some parameters, I ended up with this codes (that still does not work):
library(ggplot2)
library(datasets)

png(file = "Out.png")

par(mar=rep(0, 4), plt=c(0.1,0.9,0.1,0.9), xpd=NA)

ggplot(faithfuld, aes(waiting, eruptions)) +
geom_raster(aes(fill = density))+
theme(axis.line        = element_blank(),
      axis.text        = element_blank(),
      axis.ticks       = element_blank(),
      axis.title       = element_blank(),
      panel.background = element_blank(),
      panel.border     = element_blank(),
      panel.margin = unit(0,"null"),
      legend.position = "none",
      panel.grid.major = element_blank(),
      panel.grid.minor = element_blank(),
      plot.background  = element_blank(),
      plot.margin = rep(unit(0,"null"),4))

dev.off()

This code gives this png:

A: Even when it is a little bit hacky you can use the cowplot-Package to achieve that as follows:
library(ggplot2)
library(datasets)
require(cowplot)
base <- ggplot(faithfuld, aes(waiting, eruptions)) +
  geom_raster(aes(fill = density)) +
  theme_nothing() + labs(x = NULL, y = NULL)
plot_grid(base, scale=1.1)

- theme_nothing() + labs(x = NULL, y = NULL) is a short handle for what you did with theme(...)
 - plot_grid(..., scale=1.1) is the important part as it resizes the plot to overlap the white border.
This gives you:


text:
Q: tikz-3dplot: Draw a small circle of a sphere by formula - find the mistake or make it smarter I use the formula for 3D-circles. But there is something wrong.
Does anyone feel like scanning the code or has a better solution?

\documentclass[margin=5mm, tikz]{standalone}
\usepackage{amsmath, amsfonts}
\usepackage{tikz}
\usepackage{tikz-3dplot}
\usetikzlibrary{arrows,calc,backgrounds}
\begin{document}

\pgfmathsetmacro{\R}{3} %
\pgfmathsetmacro{\a}{1.5} %

\pgfmathsetmacro{\r}{sqrt(\R^2-\a^2)} %
%\pgfmathsetmacro{\Alpha}{atan(\r/\a)}
\pgfmathsetmacro{\Alpha}{acos(\a/\R)} %

\pgfkeys{/tikz/savevalue/.code 2 args={\global\edef#1{#2}}}

\tdplotsetmaincoords{60}{110}
\begin{tikzpicture}[
tdplot_main_coords,
>=latex, font=\footnotesize,
]

\coordinate[label=$Z$] (Z) at (0,0,0);

\pgfmathsetmacro{\Teta}{90} %  measured to the z-axis
\pgfmathsetmacro{\Phi}{50} %   measured to the x-axis
% Radius of Small Circle
\pgfmathsetmacro{\xA}{\R*sin(\Teta)*cos(\Phi)} %
\pgfmathsetmacro{\yA}{\R*sin(\Teta)*sin(\Phi)} %
\pgfmathsetmacro{\zA}{\R*cos(\Teta)} %
\coordinate[label=$A$] (A) at (\xA,\yA,\zA);
\draw[thick] (Z) -- (A);

% Middlepoint of Small Circle
\pgfmathsetmacro{\xM}{\a*sin(\Teta)*cos(\Phi)} %
\pgfmathsetmacro{\yM}{\a*sin(\Teta)*sin(\Phi)} %
\pgfmathsetmacro{\zM}{\a*cos(\Teta)} %
\coordinate[label=$M$] (M) at (\xM,\yM,\zM);
\draw[red, thick] (Z) -- (M);

% Point P of direction vector p
\pgfmathsetmacro{\xP}{\R*sin(\Teta-\Alpha)*cos(\Phi)} %
\pgfmathsetmacro{\yP}{\R*sin(\Teta-\Alpha)*sin(\Phi)} %
\pgfmathsetmacro{\zP}{\R*cos(\Teta-\Alpha)} %
\coordinate[label=$P$] (P) at (\xP,\yP,\zP);
\draw[thick] (Z) -- (P);
\draw[->] (M) -- (P);

\path let
\p0 = (M), % Center
\p1 = (P),
\n1 = {veclen(\y1-\y0,\x1-\x0)},    \n2={atan2(\y1-\y0,\x1-\x0)}
in    [savevalue={\Radius}{\n1}, savevalue={\angle}{\n2}];
\pgfmathsetmacro{\RadiusP}{\Radius/28.4528} % wipe of 'pt'

% Point Q of direction vector q
\pgfmathsetmacro{\xQ}{\R*sin(\Teta)*cos(\Phi-\Alpha)} %
\pgfmathsetmacro{\yQ}{\R*sin(\Teta)*sin(\Phi-\Alpha)} %
\pgfmathsetmacro{\zQ}{\R*cos(\Teta)} %
\coordinate[label=$Q$] (Q) at (\xQ,\yQ,\zQ);
\draw[thick] (Z) -- (Q);
\draw[->] (M) -- (Q);

\path let
\p0 = (M), % Center
\p1 = (Q),
\n1 = {veclen(\y1-\y0,\x1-\x0)},    \n2={atan2(\y1-\y0,\x1-\x0)}
in    [savevalue={\Radius}{\n1}, savevalue={\angle}{\n2}];
\pgfmathsetmacro{\RadiusQ}{\Radius/28.4528} % wipe of 'pt'

%OLD
% 3D Small Circle
%\foreach \t in {0,...,360}{
%\pgfmathsetmacro{\rp}{cos(\t)*\r/\RadiusP} %
%\pgfmathsetmacro{\rq}{sin(\t)*\r/\RadiusQ} %
%\coordinate[label=$$] (X) at ($(M)+\rp*(P)-\rp*(M)+\rq*(Q)-\rq*(M)$);
%\draw[red] (X) circle (1pt);
%}

% NEW:
% 3D Small Circle
% Set Range of angles for drawing points
\def\Range{0,...,360}
\pgfmathsetmacro{\rp}{\r/\RadiusP} %
\pgfmathsetmacro{\rq}{\r/\RadiusQ} %

% Create List of Coordinates
\newcommand{\List}{}% reserve name
\let\List=\empty% create list
\makeatletter
\foreach \t  in \Range
{
\coordinate[label=$$] (X-\t) at ($(M)+cos(\t)*\rp*(P)-cos(\t)*\rp*(M)+sin(\t)*\rq*(Q)-sin(\t)*\rq*(M)$);
\pgfmathsetmacro\temp{"(X-\t)"}%
  \ifx\empty\List{} \protected@xdef\List{\temp}%
  \else \protected@xdef\List{\List \temp}%
  \fi
}
\makeatother

\draw[red, thick] plot[] coordinates{\List};

% Sphere
\begin{scope}[tdplot_screen_coords, on background layer]
\fill[ball color= gray!20, opacity = 0.3] (Z) circle (\R);
\end{scope}

\begin{scope}[-latex, shift={(Z)}, xshift=0*2.1*\R cm, yshift=0*0.1*\R cm]
\foreach \P/\s/\Pos in {(5,0,0)/x/right, (0,5,0)/y/below, (0,0,5)/z/right}
\draw[] (0,0,0) -- \P node (\s) [\Pos, pos=0.9,inner sep=2pt]{$\s$};

\node[above=1cm, align=left, font=\normalsize] at (z){Equation of a 3D-circle: \\
$\vec{x}  = \vec{m} + r \cos(t) \cdot \vec{p} + r \sin(t) \cdot \vec{q}
~~\text{(with $t = 0\dots 2\pi$)}$
};
\end{scope}

\node[anchor=north west, align=left] at (0,-3,-5){
Radius of Sphere: $R = \R$ \\
Distance Small Circle Middlepoint from Sphere Middlepoint: $|ZM| = a = \a$ \\
Angle beetween $\vec{ZM}$ and $\vec{ZP}$: $\alpha=\Alpha^\circ$ \\
Radius of Small Circle: $r = \r$ \\
$|MP|=\RadiusP,~  |MQ|=\RadiusQ$ \\
$r_p = \dfrac{r}{|MP|} = \rp,~    r_q = \dfrac{r}{|MQ|} = \rq$
};
\end{tikzpicture}
\end{document}

A: This is so much easier using rotated coordinates.  Just play with the angles until (0,0,\R) aligns with (A).
\documentclass[margin=5mm, tikz]{standalone}
\usepackage{mathtools}
\usepackage{tikz}
\usepackage{tikz-3dplot}
\usetikzlibrary{arrows,calc,backgrounds}
\begin{document}

\pgfmathsetmacro{\R}{3} %
\pgfmathsetmacro{\a}{1.5} %

\pgfmathsetmacro{\r}{sqrt(\R*\R-\a*\a} %
%\pgfmathsetmacro{\Alpha}{atan(\r/\a)}
\pgfmathsetmacro{\Alpha}{acos(\a/\R)} %

\pgfkeys{/tikz/savevalue/.code 2 args={\global\edef#1{#2}}}

\tdplotsetmaincoords{60}{110}
\begin{tikzpicture}[
tdplot_main_coords,
>=latex, font=\footnotesize,
]

\coordinate[label=$Z$] (Z) at (0,0,0);

\pgfmathsetmacro{\Teta}{90} %  measured to the z-axis
\pgfmathsetmacro{\Phi}{50} %   measured to the x-axis

\tdplotsetrotatedcoords{50}{90}{0}
\begin{scope}[tdplot_rotated_coords]
  \coordinate[label=$A$] (A) at (0,0,\R);
  \coordinate[label=$M$] (M) at (0,0,\a);
  \draw[red, thick] (M) circle[radius=\r];
\end{scope}

\draw[thick] (Z) -- (A);
\draw[red, thick] (Z) -- (M);

% Point P of direction vector p
\pgfmathsetmacro{\xP}{\R*sin(\Teta-\Alpha)*cos(\Phi)} %
\pgfmathsetmacro{\yP}{\R*sin(\Teta-\Alpha)*sin(\Phi)} %
\pgfmathsetmacro{\zP}{\R*cos(\Teta-\Alpha)} %
\coordinate[label=$P$] (P) at (\xP,\yP,\zP);
\draw[thick] (Z) -- (P);
\draw[->] (M) -- (P);

\path let
\p0 = (M), % Center
\p1 = (P),
\n1 = {veclen(\y1-\y0,\x1-\x0)},    \n2={atan2(\y1-\y0,\x1-\x0)}
in    [savevalue={\Radius}{\n1}, savevalue={\angle}{\n2}];
\pgfmathsetmacro{\RadiusP}{\Radius/28.4528} % wipe of 'pt'

% Point Q of direction vector q
\pgfmathsetmacro{\xQ}{\R*sin(\Teta)*cos(\Phi-\Alpha)} %
\pgfmathsetmacro{\yQ}{\R*sin(\Teta)*sin(\Phi-\Alpha)} %
\pgfmathsetmacro{\zQ}{\R*cos(\Teta)} %
\coordinate[label=$Q$] (Q) at (\xQ,\yQ,\zQ);
\draw[thick] (Z) -- (Q);
\draw[->] (M) -- (Q);

\path let
\p0 = (M), % Center
\p1 = (Q),
\n1 = {veclen(\y1-\y0,\x1-\x0)},    \n2={atan2(\y1-\y0,\x1-\x0)}
in    [savevalue={\Radius}{\n1}, savevalue={\angle}{\n2}];
\pgfmathsetmacro{\RadiusQ}{\Radius/28.4528} % wipe of 'pt'

%OLD
% 3D Small Circle
%\foreach \t in {0,...,360}{
%\pgfmathsetmacro{\rp}{cos(\t)*\r/\RadiusP} %
%\pgfmathsetmacro{\rq}{sin(\t)*\r/\RadiusQ} %
%\coordinate[label=$$] (X) at ($(M)+\rp*(P)-\rp*(M)+\rq*(Q)-\rq*(M)$);
%\draw[red] (X) circle (1pt);
%}

% Sphere
\begin{scope}[tdplot_screen_coords, on background layer]
\fill[ball color= gray!20, opacity = 0.3] (Z) circle (\R);
\end{scope}

\begin{scope}[-latex, shift={(Z)}, xshift=0*2.1*\R cm, yshift=0*0.1*\R cm]
\foreach \P/\s/\Pos in {(5,0,0)/x/right, (0,5,0)/y/below, (0,0,5)/z/right}
\draw[] (0,0,0) -- \P node (\s) [\Pos, pos=0.9,inner sep=2pt]{$\s$};

\node[above=1cm, align=left, font=\normalsize] at (z){Equation of a 3D-circle: \\
$\vec{x}  = \vec{m} + r \cos(t) \cdot \vec{p} + r \sin(t) \cdot \vec{q}
~~\text{(with $t = 0\dots 2\pi$)}$
};
\end{scope}

\pgfmathsetmacro{\rp}{\r/\RadiusP} %
\pgfmathsetmacro{\rq}{\r/\RadiusQ} %

\node[anchor=north west, align=left] at (0,-3,-5){
Radius of Sphere: $R = \R$ \\
Distance Small Circle Middlepoint from Sphere Middlepoint: $|ZM| = a = \a$ \\
Angle beetween $\vec{ZM}$ and $\vec{ZP}$: $\alpha=\Alpha^\circ$ \\
Radius of Small Circle: $r = \r$ \\
$|MP|=\RadiusP,~  |MQ|=\RadiusQ$ \\
$r_p = \dfrac{r}{|MP|} = \rp,~    r_q = \dfrac{r}{|MQ|} = \rq$
};
\end{tikzpicture}
\end{document}

There is a basic graphics function which can be used to draw the circle using M, P and Q.
\pgfscope
\color{blue}%
\pgfpathellipse{\pgfpointanchor{M}{center}}%
  {\pgfpointdiff{\pgfpointanchor{M}{center}}{\pgfpointanchor{P}{center}}}%
  {\pgfpointdiff{\pgfpointanchor{M}{center}}{\pgfpointanchor{Q}{center}}}%
\pgfusepath{draw}%
\endpgfscope


text:
Q: What steps do i need to take to start developing iPhone apps?
Possible Duplicate:
How to Start learning to create iphone apps

I only know basic Python as far as programing languages go.
What do I need to learn to start developing iPhone apps?
I learned part python with almost only learnpythonthehardway.org
and that wasn't too difficult. I am confident I can learn how to make apps but need to know where to continue. i asked around where to start and people said to learn python so i did but now what to do after that.
I have the newest MBP to work on.
I don't have much interest in the app store i just want to have some fun and stuff like this is what i enjoy doing
I realize people say this is a duplicate someone changed my title and didn't read what i had to say here I want to know where i would continue mostly all other things about this have been closed as well so its hard to get answers

A: Welcome to the wonderful world of programming. Seriously, as you've probably seen it can be a lot of fun.  Starting young is the way to go!
iPhone development is going to be harder than learning the basics of Python, but not unachievable.
One of the problems that you are going to have, is that the tools are not as widely available or as free as Python.  You will need:

*

*A mac of some sort (must have an intel processor too, so not an old mac)

*An iPhone developer account ($99 a year)

*A copy of XCode (comes free with the account)

Then you need a good book, i used 'Beginning iPhone 4 Development" which has an introduction to objective-c in it.
If that sounds a bit too expensive for something you're not sure you'd enjoy - you could try downloading a free objective-c compiler and learning the language first before committing to  that stuff.

A: Start at http://developer.apple.com. From there, download the iOS SDK. iOS apps are mostly written in another language called Objective-C and a framework called Cocoa Touch.


text:
Q: How to get id of invisible element in fragment? I have a Dialog in fragment:
<core:FragmentDefinition
    xmlns="sap.m"
    xmlns:f="sap.ui.layout.form"
    xmlns:core="sap.ui.core">
    <Dialog title="{i18n>AddNewItem}" resizable="true" draggable="true">
        <content>
            <MessageStrip
                id="failMsg"
                visible="false"
                text="{i18n>SensorTypesCreateFail}"
                type="Error"
                showIcon="true"/>
    </Dialog>
</core:FragmentDefinition>

As in UI5 doc:

Retrieving a control instance when the fragment is not part of a view:

*

*When no fragment ID was given: myControl = sap.ui.getCore().byId("myControl")

*When a fragment ID myFrag was given:  myControl = sap.ui.core.Fragment.byId("myFrag", "myControl")

If there is no visible="false", I can get this MessageStrip by sap.ui.getCore().byId("failMsg").
But I found that with visible="false", id of MessageStrip is sap-ui-invisible-failMsg, I failed to found proper API to get it.
Of course I can use sap.ui.getCore().byId("sap-ui-invisible-failMsg"), but I am not sure whether this ID will change after I deploy it to FLP, and as @schnoedel said in another question:

Beware that the prefixes like -- and --- used by the framework may change in the future. Thats why it's recommended to use the public api functions the framework supplies like byId() and createId().

So, is there any better way to get it?

Update:
Change my code from:
this[dialogName] = sap.ui.xmlfragment("namespace." + dialogName, this);
this.getView().addDependent(this[dialogName]);

To
this[dialogName] = sap.ui.xmlfragment(dialogName, "namespace." + dialogName, this);
this.getView().addDependent(this[dialogName]);

And now my id is sap-ui-invisible-dialogName--failMsg...

A: It depends on what you want to achieve after getting the ID. If you just want to change a property you could do it without any ID via a Model.
For that you can assign a Model field (i.e. baseModel>/visable) to the visable property and once it should be changed you change the model and via two way binding it updates the control.
code to change a model:
this.getView().getModel("nameOfUrModel").setProperty("property", "value")
for more information about this just check the walkthrough tutorial on
https://sapui5.hana.ondemand.com/
And if you for whatever reason really need the ID:
https://sapui5.hana.ondemand.com/#docs/api/symbols/sap.ui.core.Fragment.html
here you find the command:
sap.ui.core.Fragment.byId(sFragmentId, sId)
It should be able to return the Control your using
Hope that helps
Eric

A: You were very close to the solution. After adding dialogName for the fragment ID in its creation, you just have to call the API ...:
sap.ui.require(["sap/ui/core/Fragment"], Fragment => Fragment.byId(dialogName, "failMsg"));

... to get the control instance as mentioned here.
However, regardless whether you provided a fragment ID or not, you can easily ignore the render prefix "sap-ui-invisible-" at any time - Meaning that you could've also been able to get the control instance via sap.ui.getCore().byId("failMsg") instead of sap.ui.getCore().byId("sap-ui-invisible-failMsg") even if the control is invisible.


text:
Q: Overcoming Downgrade Issue Detected While Moving from .NET 5 to 6 I got hit with a weird issue when moving from Visual Studio 2019 to Visual Studio 2022 and then from .NET 5 to .NET 6.  While all of the third-party apps updated, it turns out that any MS libraries referenced by those apps will not necessarily update.  While everything compiles and runs without issue, attempting to publish this solution constantly failed with a slew of "downgrade detected" errors.

A: The answer to this problem is to capture the libraries causing the error and then going into the NuGet Manager, Browsing for each of those libraries and then installing the latest version.
Hope this helps anybody else that gets stuck!


text:
Q: mv: the source should consist of directories I wrote a program that implements the mv command in linux. How can I further implement the functionality through which the source is made up of directories?
code:
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <sys/stat.h>
#include <string.h>

// show file errors
void fileerror(int nr, const char* filename) {
    if(nr == 1)
        printf("%s doesn't exist!\n", filename);
    else if(nr == 2)
        printf("%s isn't writeable!\n", filename);
}

int writeable(const char* filename) {
    if(access(filename, F_OK)) {
        return 1;
    }
    if(access(filename, W_OK)) {
        return 2;
    }
    return 0;
}

// verify if the source exists
int sourceexists(int argc, char** argv) {
    int i;
    int ret;
    for(i = 1; i < argc - 1; i++) {
        ret = writeable(argv[i]);
        if(ret == 1) {
            fileerror(ret, argv[i]);
            return ret;
        }
    }
    return 0;
}

// verify if destination is writeable or exists
int destinationwriteable(const char *filename) {
    return writeable(filename);
}

// return permissions of a file
char* permissions(const char* filename) {
    struct stat fileStat;
    char* perm = malloc(4 * sizeof(char));
    int nr = 0;

    perm[0] = '0';
    stat(filename, &fileStat);

    if(fileStat.st_mode & S_IRUSR)
        nr += 4;
    if(fileStat.st_mode & S_IWUSR)
        nr += 2;
    if(fileStat.st_mode & S_IXUSR)
        nr += 1;

    perm[1] = '0' + nr;
    nr = 0;

    if(fileStat.st_mode & S_IRGRP)
        nr += 4;
    if(fileStat.st_mode & S_IWGRP)
        nr += 2;
    if(fileStat.st_mode & S_IXGRP)
        nr += 1;

    perm[2] = '0' + nr;
    nr = 0;

    if(fileStat.st_mode & S_IROTH)
        nr += 4;
    if(fileStat.st_mode & S_IWOTH)
        nr += 2;
    if(fileStat.st_mode & S_IXOTH)
        nr += 1;

    perm[3] = '0' + nr;
    nr = 0;

    return perm;
}

// verify if a file is regular
int regularfile(const char* filename) {
    struct stat fileStat;
    stat(filename, &fileStat);
    return S_ISREG(fileStat.st_mode);
}

//verify if a name is a directory
int isdirectory(const char* filename) {
    struct stat fileStat;
    stat(filename, &fileStat);
    return S_ISDIR(fileStat.st_mode);
}

char* removepath(char* filename) {
    int i;
    char* p = filename;
    for(i = 0; i < strlen(filename); i += 1) {
        if(filename[i] == '/')
            p = (filename + i + 1);
    }
    return p;
}

int movefile(char* file1, char* file2) {
    if(link(file1, file2)) {
        printf("Cannot create hard link: %s -> %s\n", file1, file2);
        return 1;
    }
    if(remove(file1)) {
        printf("Cannot remove file after creating hard link: %s\n", file1);
        return 1;
    }
    return 0;
}

// add the filename to dir path
char* changefilenameindir(char* filename, const char* dir) {
    char* fullname = malloc((strlen(filename) + strlen(dir)) * sizeof(char));
    strcpy(fullname, dir);
    if(dir[strlen(dir) - 1] != '/');
    strcat(fullname, "/");
    strcat(fullname, removepath(filename));
    return fullname;
}

int main(int argc, char** argv) {

    if(argc < 3) {
        printf("Usage: ./mv.o <source> <destination>\n");
        return 1;
    }

    else {
        if(sourceexists(argc, argv)) { // verify if source exists
            return 1;
        }

        int ret;
        if(argc == 3) {
            if((ret = destinationwriteable(argv[2])) == 2) {
                // verify if destination is writeable
                if(regularfile(argv[2])) {
                    char* perm = permissions(argv[2]);
                    printf("Replace and override mode (%s) y/n?: ", perm);
                    free(perm);

                    char x;

                    do {
                        x = getchar();
                    } while(x != 'y' && x != 'n');

                    if(x == 'n')
                        return 1;
                    remove(argv[2]);
                    return movefile(argv[1], argv[2]);
                }
                // show msg if directory is not writeable
                printf("Cannot move <source> to %s: Permission denied\n", argv[2]);
                return 1;
            }
            else if(ret == 1) {
                return movefile(argv[1], argv[2]); // rename file
            }
            else {
                if(regularfile(argv[2])) {
                    // move source file instead of destination file
                    struct stat infof1, infof2;
                    stat(argv[1], &infof1);
                    stat(argv[2], &infof2);
                    if(infof1.st_ino != infof2.st_ino)
                        remove(argv[2]);
                    return movefile(argv[1], argv[2]);
                }
                // move file to a specified directory
                char* fullname = changefilenameindir(argv[1], argv[2]);
                ret = movefile(argv[1], fullname);
                free(fullname);
                return ret;
            }
        }

        else {
            if(regularfile(argv[argc - 1])) { //show msg if <destination> is a regular file
                printf("<destination>: %s - cannot be a regular file!\n", argv[argc - 1]);
                return 1;
            }
            if((ret = destinationwriteable(argv[argc - 1])) == 2) {
                // show msg if directory is not writeable
                printf("Cannot move <source> to %s: Permission denied\n", argv[argc - 1]);
                return 1;
            }
            else if(ret == 1) { // show msg if <destination> doesn't exist
                printf("<destination>: %s - must be an existent directory!\n", argv[argc - 1]);
                return 1;
            }

            int i;
            for(i = 1; i < argc - 1; i += 1) {
                if(isdirectory(argv[i])) {
                    printf("Moving directories is unsupported: %s\n", argv[i]);
                    return 1;
                }
            }
            // move files to a directory
            for(i = 1; i < argc - 1; i += 1) {
                char* fullname = changefilenameindir(argv[i], argv[argc - 1]);
                ret = movefile(argv[i], fullname);
                free(fullname);
                if(ret)
                    return ret;
            }
        }
    }

    return 0;
}


text:
Q: JavaFx graphics window scaling issue I have a problem: when the program is running, the scaling of the chart window is not active. When the window is resized, the chart and other window elements are not scaled
Tell me what to add to fix the problem?
source:
Main.java
public class Main extends Application {

    @Override
    public void start(Stage primaryStage) {

        Button button = new Button();   //Создание кнопки
        button.setText("Начать");  //Создание надписи на кнопке
        button.setPrefSize(150,30);  // Размер кнопки
        button.setAlignment(Pos.CENTER);  // Положение кнопки на экране
        button.setTranslateY(75);  //Перемещение кнопки по оси Y
        button.setFont(Font.font("Arial", 20)); //Параметры шрифта и размер шрифта

        Label label1 = new Label("Верзьера Аньези"); // Создание текста
        label1.setPrefSize(580, 225); // Размер текста
        label1.setLayoutX(100); // Положение текста в рамках Label по оси Х
        label1.setLayoutY(100); // Положение текста в рамках Label по оси Y
        label1.setAlignment(Pos.TOP_CENTER); // Положение текста на экране
        label1.setFont(Font.font("Arial", 20)); // Параметры шрифта и размер шрифта

        Label label2 = new Label("Введите диаметр а (Рек. 2):"); // Создание текста
        label2.setPrefSize(580, 100); // Размер текста
        label2.setLayoutX(100); // Положение текста в рамках Label по оси Х
        label2.setLayoutY(100); // Положение текста в рамках Label по оси Y
        label2.setTranslateY(-25); // Положение текста по оси Х на экране
        label2.setTranslateX(40); // Положение текста по оси Y на экране
        label2.setAlignment(Pos.TOP_LEFT); // Положение текста на экране
        label2.setFont(Font.font("Arial", 12)); // Параметры шрифта и размер шрифта

        Label label3 = new Label("Интервал осей (X/Y):"); // Создание текста
        label3.setPrefSize(580, 100); // Размер текста
        label3.setLayoutX(100); // Положение текста в рамках Label по оси Х
        label3.setLayoutY(100); // Положение текста в рамках Label по оси Y
        label3.setTranslateY(6); // Положение текста по оси Х на экране
        label3.setTranslateX(30); // Положение текста по оси Y на экране
        label3.setAlignment(Pos.TOP_LEFT); // Положение текста на экране
        label3.setFont(Font.font("Arial", 12)); // Параметры шрифта и размер шрифта

        TextField txtf = new TextField(); // Создание поля ввода
        txtf.setAlignment(Pos.TOP_LEFT); // Положение поля ввода на экране
        txtf.setTranslateY(-65); // Положение поля ввода по оси Х на экране
        txtf.setTranslateX(60); // Положение поля ввода по оси Y на экране
        txtf.setMaxWidth(75); // Максимальное количество значений
        txtf.setFont(Font.font("Arial", 15)); // Параметры шрифта и размер шрифта

        TextField txtxLow = new TextField(); // Создание поля ввода
        txtxLow.setAlignment(Pos.TOP_LEFT); // Положение поля ввода на экране
        txtxLow.setTranslateY(-35); // Положение поля ввода по оси Х на экране
        txtxLow.setTranslateX(20); // Положение поля ввода по оси Y на экране
        txtxLow.setMaxWidth(75); // Максимальное количество значений
        txtxLow.setFont(Font.font("Arial", 15)); // Параметры шрифта и размер шрифта

        TextField txtxHi = new TextField(); // Создание поля ввода
        txtxHi.setAlignment(Pos.TOP_LEFT); // Положение поля ввода на экране
        txtxHi.setTranslateY(-35); // Положение поля ввода по оси Х на экране
        txtxHi.setTranslateX(100); // Положение поля ввода по оси Y на экране
        txtxHi.setMaxWidth(75); // Максимальное количество значений
        txtxHi.setFont(Font.font("Arial", 15)); // Параметры шрифта и размер шрифта

        txtf.textProperty().addListener(new ChangeListener<String>() {
            @Override
            public void changed(ObservableValue<? extends String> observable, String oldValue,
                                String newValue) {                                       // Ограничение ввода значений, разрешены только цифры и знак -
                if (!newValue.matches("|[-+]?|[-+]?\\d+\\.?|[-+]?\\d+\\.?\\d+")){
                    txtf.setText(oldValue);
                }
            }
        });

        txtxLow.textProperty().addListener(new ChangeListener<String>() {
            @Override
            public void changed(ObservableValue<? extends String> observable, String oldValue,
                                String newValue) {
                if (!newValue.matches("|[-+]?|[-+]?\\d+\\.?|[-+]?\\d+\\.?\\d+")){
                    txtxLow.setText(oldValue);
                }
            }
        });

        txtxHi.textProperty().addListener(new ChangeListener<String>() {
            @Override
            public void changed(ObservableValue<? extends String> observable, String oldValue,
                                String newValue) {
                if (!newValue.matches("|[-+]?|[-+]?\\d+\\.?|[-+]?\\d+\\.?\\d+")){
                    txtxHi.setText(oldValue);
                }
            }
        });

        button.setOnAction(new EventHandler<ActionEvent>() {    // Проверка нажатия на кнопку
            @Override
            public void handle(ActionEvent event) {   // Запуск второго экрана
                if (txtf.getText().isEmpty()) {
                    JOptionPane.showMessageDialog(null, "Пожалуйста заполните поля для ввода!");  // Проверка на заполения поля ввода txtf
                    return;
                }
                if (txtxHi.getText().isEmpty()) {
                    JOptionPane.showMessageDialog(null, "Пожалуйста заполните поля для ввода!");
                    return;
                }
                if (txtxLow.getText().isEmpty()) {
                    JOptionPane.showMessageDialog(null, "Пожалуйста заполните поля для ввода!");
                    return;
                }

                int a = Integer.parseInt(txtf.getText());
                double xLow = Double.parseDouble(txtxLow.getText());
                double xHi = Double.parseDouble(txtxHi.getText());
                double yLow = Double.parseDouble(txtxLow.getText());     // Считывание данных с полей ввода
                double yHi = Double.parseDouble(txtxHi.getText());
                double xMinGraph = Double.parseDouble(txtxLow.getText());
                double xMaxGraph = Double.parseDouble(txtxHi.getText());

                Axes axes = new Axes(  // Запуск класса Axes
                        900, 900,   // Размер второго экрана с графиком
                        xLow, xHi, 1,  // Параметры осей Х
                        yLow, yHi, 1  // Парамтеры осей Y

                );

                Plot plot = new Plot(  // Запуск класса Plot

                        x -> ( a * a * a) / (x * x +  a * a),  // Формула для расчета кривой

                        xMinGraph, xMaxGraph, 0.01, // Параметр начала и конца графика
                        axes // Вызов axes
                );

                StackPane layout = new StackPane( // Запуск экрана

                        plot // Вызов plot

                );

                layout.setPadding(new Insets(20));
                layout.setStyle("-fx-background-color: rgb(255, 255, 255);");
                Stage stage = new Stage();          // Параметры второго экрана : название, цвет фона и т.д
                stage.setTitle("Верзьера Аньези");
                stage.setScene(new Scene(layout, Color.rgb(255, 255, 255)));
                stage.show();  // Вывод экрана
            }
        });

        StackPane root = new StackPane();
        root.getChildren().add(label1);
        root.getChildren().add(label2);
        root.getChildren().add(label3);

        root.getChildren().add(button);            // Вывод элементов на экран
        root.getChildren().add(txtf);

        root.getChildren().add(txtxLow);
        root.getChildren().add(txtxHi);

        Scene scene = new Scene(root, 350, 300);   // Установка размера первого экрана

        primaryStage.setTitle("Параметры");
        primaryStage.setScene(scene);
        primaryStage.show();
    }

    public static void main(String[] args) {
        launch(args);
    }
}

Axes.java
public class Axes extends Pane {
    private NumberAxis xAxis;  // Создание насечек на оси х
    private NumberAxis yAxis;  // Создание насечек на оси у

    public Axes(
            int width, int height,
            double xLow, double xHi, double xTickUnit,    // Объявление переменных для отрисовки осей
            double yLow, double yHi, double yTickUnit
    ) {
        setMinSize(Pane.USE_COMPUTED_SIZE, Pane.USE_COMPUTED_SIZE);
        setPrefSize(width, height);
        setMaxSize(Pane.USE_COMPUTED_SIZE, Pane.USE_COMPUTED_SIZE);    // Размер осей

        xAxis = new NumberAxis(xLow, xHi, xTickUnit);
        xAxis.setSide(Side.BOTTOM);
        xAxis.setMinorTickVisible(false);     // Расчет оси х
        xAxis.setPrefWidth(width);
        xAxis.setLayoutY(height / 2.0);

        yAxis = new NumberAxis(yLow, yHi, yTickUnit);
        yAxis.setSide(Side.LEFT);
        yAxis.setMinorTickVisible(false);     // Расчет оси у
        yAxis.setPrefHeight(height);
        yAxis.layoutXProperty().bind(
                Bindings.subtract(
                        (width / 2) + 1,
                        yAxis.widthProperty()
                )

        );

///////////////////////////////////////////////Создание полярной сетки//////////////////////////////////////////////////

        Circle circ1 = new Circle();
        circ1.setFill(Color.rgb(255,255,255,0));
        circ1.setStroke(Color.BLACK);
        circ1.setCenterX(450);
        circ1.setCenterY(450);
        circ1.setRadius(65);
        circ1.setOpacity(0.3);

        Circle circ2 = new Circle();
        circ2.setFill(Color.rgb(255,255,255,0));
        circ2.setStroke(Color.BLACK);
        circ2.setCenterX(450);
        circ2.setCenterY(450);
        circ2.setRadius(130);
        circ2.setOpacity(0.3);

        Circle circ3 = new Circle();
        circ3.setFill(Color.rgb(255,255,255,0));
        circ3.setStroke(Color.BLACK);
        circ3.setCenterX(450);
        circ3.setCenterY(450);
        circ3.setRadius(195);
        circ3.setOpacity(0.3);

        Circle circ4 = new Circle();
        circ4.setFill(Color.rgb(255,255,255,0));
        circ4.setStroke(Color.BLACK);
        circ4.setCenterX(450);
        circ4.setCenterY(450);
        circ4.setRadius(260);
        circ4.setOpacity(0.3);

        Line lin30 = new Line();
        Text angle30 = new Text();
        Text angle210 = new Text();
        lin30.setStartX(800);
        lin30.setStartY(300);
        lin30.setEndX(100);
        lin30.setEndY(600);
        lin30.setOpacity(0.3);
        angle30.setX(800);
        angle30.setY(290);
        angle30.setText("30°");
        angle210.setX(100);
        angle210.setY(590);
        angle210.setText("210°");
        angle30.setOpacity(0.3);
        angle210.setOpacity(0.3);

        Line lin30Z = new Line();
        Text angle30Z = new Text();
        Text angle330 = new Text();
        lin30Z.setStartX(100);
        lin30Z.setStartY(300);
        lin30Z.setEndX(800);
        lin30Z.setEndY(600);
        lin30Z.setOpacity(0.3);
        angle30Z.setX(100);
        angle30Z.setY(290);
        angle30Z.setText("150°");
        angle330.setX(800);
        angle330.setY(590);
        angle330.setText("330°");
        angle30Z.setOpacity(0.3);
        angle330.setOpacity(0.3);

        Line lin45 = new Line();
        Text angle45 = new Text();
        Text angle225 = new Text();
        lin45.setStartX(150);
        lin45.setStartY(150);
        lin45.setEndX(750);
        lin45.setEndY(750);
        lin45.setOpacity(0.3);
        angle45.setX(150);
        angle45.setY(140);
        angle45.setText("135°");
        angle225.setX(750);
        angle225.setY(740);
        angle225.setText("315°");
        angle45.setOpacity(0.3);
        angle225.setOpacity(0.3);

        Line lin45Z = new Line();
        Text angle45Z = new Text();
        Text angle315 = new Text();
        lin45Z.setStartX(150);
        lin45Z.setStartY(750);
        lin45Z.setEndX(750);
        lin45Z.setEndY(150);
        lin45Z.setOpacity(0.3);
        angle45Z.setX(150);
        angle45Z.setY(730);
        angle45Z.setText("225°");
        angle315.setX(750);
        angle315.setY(140);
        angle315.setText("45°");
        angle45Z.setOpacity(0.3);
        angle315.setOpacity(0.3);

        Line lin60 = new Line();
        Text angle60 = new Text();
        Text angle240 = new Text();
        lin60.setStartX(570);
        lin60.setStartY(150);
        lin60.setEndX(320);
        lin60.setEndY(780);
        lin60.setOpacity(0.3);
        angle60.setX(570);
        angle60.setY(140);
        angle60.setText("60°");
        angle240.setX(300);
        angle240.setY(770);
        angle240.setText("240°");
        angle60.setOpacity(0.3);
        angle240.setOpacity(0.3);

        Line lin60Z = new Line();
        Text angle60Z = new Text();
        Text angle300 = new Text();
        lin60Z.setStartX(330);
        lin60Z.setStartY(150);
        lin60Z.setEndX(580);
        lin60Z.setEndY(780);
        lin60Z.setOpacity(0.3);
        angle60Z.setX(330);
        angle60Z.setY(140);
        angle60Z.setText("120°");
        angle300.setX(580);
        angle300.setY(770);
        angle300.setText("300°");
        angle60Z.setOpacity(0.3);
        angle300.setOpacity(0.3);

        CheckBox check = new CheckBox("Отобразить полярную сетку");  //CheckBox для отображение сетки

        check.selectedProperty().addListener(new ChangeListener<Boolean>() {

            @Override
            public void changed(ObservableValue<? extends Boolean> observable, Boolean oldValue, Boolean newValue) {
                // TODO Auto-generated method stub
                if(newValue){
                    getChildren().addAll(circ1,circ2,circ3,circ4,lin30,lin30Z,lin45,lin45Z,lin60,lin60Z,angle30,
                            angle30Z,angle45,angle45Z,angle60,angle60Z,angle210,angle225,angle240,angle300,angle315,angle330);
                }else{
                    getChildren().removeAll(circ1,circ2,circ3,circ4,lin30,lin30Z,lin45,lin45Z,lin60,lin60Z,angle30,
                            angle30Z, angle45,angle45Z,angle60,angle60Z,angle210,angle225,angle240,angle300,angle315,angle330);
                }
            }
        });

/////////////////////////////////////////////////Конец отображения//////////////////////////////////////////////////////

        // Подпись осей
        Text txtY = new Text();
        txtY.setX(450);
        txtY.setY(yLow);
        txtY.setText("Y");

        Text txtX = new Text();
        txtX.setX(905);
        txtX.setY(450);
        txtX.setText("X");

        getChildren().setAll(xAxis, yAxis, txtY, txtX,check); // Отображение элементов на экране
    }

    public NumberAxis getXAxis() {
        return xAxis;
    }

    public NumberAxis getYAxis() {
        return yAxis;
    }
}

Plot.java
public class Plot extends Pane {

    public Rectangle rect = new Rectangle(100,450,10,10);  // Создание прямоугольника
    public PathTransition pathTransition = new PathTransition(); // Параметр анимации
    Polyline pol = new Polyline(); // Создание пути анимации
    public Plot(
            Function<Double, Double> f,
            double xMin, double xMax, double xInc,  //Объявление переменных для постройки кривой
            Axes axes
    ) {
        Path path = new Path();
        path.setStroke(Color.RED.deriveColor(0, 1, 1, 0.6));  // Создание кривой
        path.setStrokeWidth(2); //Толщина кривой

        double x = xMin;
        double y = f.apply(x);   // Создание переменных для отрисовки кривой
        pol.getPoints().clear();  // Отчистка анимации
        path.getElements().add(
                new MoveTo(
                        mapX(x, axes), mapY(y, axes)  // Построение трактории кривой
                )
        );

        x += xInc;

        while (x < xMax) {
            y = f.apply(x);

            path.getElements().add(
                    new LineTo(
                            mapX(x, axes), mapY(y, axes)  // Отрисовка кривой
                    )
            );


text:
Q: по нажатию на input сформировать маску телефона Через jquery сформировать маску вида +7(  )

A: maskedinput.js

$('.js-phone').mask("+7(999)999-9999");
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.0/jquery.min.js"></script>

<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery.maskedinput/1.4.1/jquery.maskedinput.min.js"></script>

<input type="text" name="phone" id="phone" class="js-phone" placeholder="Телефон" >

A: Используйте плагин jquery inputmask
https://plugins.jquery.com/jquery.inputmask/


text:
Q: Go to definition not working in VS Code Editing a PHP file with VS Code. Go to definition not working for the JavaScript code in the file.
How to get Go to definition to work?
(VS Code does complain when I open the PHP file. "Cannot validate since no PHP executable is set".)

A: If the JavaScript is defined inline in the .php file then Visual Studio Code will not be able to Go to the defintion of the JavaScript function.
It can only Go to definition when the editor can resolve/figure out a path for a function/class/variable/module.


text:
Q: Asp.net core, одностраничное приложение + связь many to one Есть следующая модель данных:

мне нужно создать анкету для переводчика, чтобы он мог вводить свои основные данные(имя, фамилия и т.д.)(рис. 2). А потом так же выбрать языки, которыми он владеет. То есть, по нажатию кнопки добавляется блок где он вводит данные о языке(название, уровень владения, родной), которым он владеет. И так он может по сути добавлять бесконечное количество языков.
Вопрос в том, что я понятия не имею как реализовать такой механизм на одной странице, чтобы еще в конце, по нажатию одной клавиши все эти данные(Основная информация о переводчике + n-ое количество языков, которые имеют свои данные) попадали в базу. В идеале, он еще может редактировать языки(добавлять, удалять, изменять). С серверной частью все более менее понятно, с помощью ajax делаю запрос к контроллеру и jsonом отправляю данные на базу. Трудность скорее возникает в клиентском приложении: привязка javascript объекта к объекту DOM и прочее. Это мои догадки, возможно я вовсе не в том направлении мыслью. Поэтому хотелось бы узнать, ваше мнение, какие есть инструменты, чтобы реализовать подобный механизм или увидеть наглядный живой пример подобной реализации.


text:
Q: magento downloadable products not able to download downloadable products only worked once when i set the link to be downloaded able only once after that i couldnt download it with a different account
does the download limit apply to only one account or all accounts
so i set the product download limit to one then i was able to download it with the first account
i tried again with a second account and i received an error says "The link is not available."
that comes up after i click the product in the my downloadable products section of the account

A: Make sure the order is completed, at least invoiced. In other word for the link to work properly, the status have to be available, not pending.
May be too late but It will help someone in the future.

A: I don't know if you are still looking for an answer to this, but you set the Max. Downloads in the Catalog > Product Information > Downloadable Information tab in the admin tool. That field determines how many times each purchase can be downloaded. That selection is per account/purchase. You control how many downloads you can sell in total in the Product Information > Inventory tab under the Qty field. You can only download an item from the account that purchased it. If you are logged in to that account on different computers, then you could download it on multiple machines, IF the Max. Downloads is higher than 1.
Hope that helps you out.

A: You can set:

Catalog>Manage Products>Set Manage Invetory Stock to No


text:
Q: Parse xml and write a csv with header columns I am trying to parse an xml file containing meteo data and to write some value in a csv file.
I'm not sure that this code is elegant but it works.
from qgis.PyQt.QtCore import *
import requests
import xml.etree.ElementTree as ET
# url of xml to parse
baseUrl = ('http://www.arpa.veneto.it/bollettini/meteo/h24/img08/0144.xml')
resp = requests.get(baseUrl)
msg = resp.content
tree = ET.fromstring(msg)
for stazione in tree.iter('STAZIONE'):
    idstaz= stazione.find('IDSTAZ').text
    for sensore in stazione.iter('SENSORE'):
      id= sensore.find('ID').text
      for dati in sensore.iter('DATI'):
        ist = dati.get('ISTANTE')
        vm = dati.find('VM').text
        f = open('D:/GIS/_Temp/result.csv', 'a')
        print >> f, idstaz, id, ist, vm
        f.close()

I'm not sure that this code is elegant but it works.
144 300000864 201701080100 -4.2
144 300000864 201701080200 -4.5
144 300000864 201701080300 -4.8
144 300000864 201701080400 -5.5
...

but I don't know how to add the headers to the columns.

A: Open the file before the for loop and add header to file
from qgis.PyQt.QtCore import *
import requests
import xml.etree.ElementTree as ET
# url of xml to parse
baseUrl = ('http://www.arpa.veneto.it/bollettini/meteo/h24/img08/0144.xml')
resp = requests.get(baseUrl)
msg = resp.content
tree = ET.fromstring(msg)
f = open('D:/GIS/_Temp/result.cvs', 'a')
f.write('STAZIONE,IDSTAZ,SENSORE,ISTANTE')
for stazione in tree.iter('STAZIONE'):
    idstaz= stazione.find('IDSTAZ').text
    for sensore in stazione.iter('SENSORE'):
      id= sensore.find('ID').text
      for dati in sensore.iter('DATI'):
        ist = dati.get('ISTANTE')
        vm = dati.find('VM').text

        print >> f, idstaz, id, ist, vm

f.close()


text:
Q: How to get rid of margin property in media query I've been trying to get rid of the top & right margin from this title. I have tried margin:0 & margin: none
and it hasn't worked. Any suggestions would be appreciated.
 p.title {
  font-family: 'Germania One';
  font-style: normal;
  color: #FFF;
  font-size: 150px;
  Position:absolute;
  width:100%;
  z-index:1000;
  text-align:left;
  margin-top: 300px;
  margin-bottom: 0px;
  margin-left:200px;
}

@media (min-width:320px) and (max-width:425px) {

p .title{
  position:none; margin: 0 ;
}

A: The selector in your media query cannot override the selector preceding the media query because they are not the same. Change the selector inside your media query from p .title to p.title and it will work.

The  (space combinator) in a CSS selector means the second part of the selector is a descendant of the first part, while chaining selectors without space it means the selector applies to the same element.
Therefore p.title selects any <p> tag with the class title, while p .title selects any element with the class title that is a descendant of a <p> element.
Here's the list of CSS combinators.

A: You wrote p .title (with a space) instead of p.title inside the media query.

A: You made a typo:
@media (min-width:320px) and (max-width:425px) {

    p.title{ /* No Space */
      position:none; margin: 0 ;
    }
}

A: //Remove the space from p .title{} and put the media query like that-
@media (min-width:320px) and (max-width:425px) {
p.title{
  position:none;
margin-top: 0;
margin-right: 0;
}

}


text:
Q: Should I rollback a minor edit that a >2k rep user has made? If a user with sufficient privileges to edit without approval edits a post, but the edit only changes word choice, how should I feel about rolling back?
The only reason I hesitate is because such an edit hasn't caused harm to the post, but if the edit was in the review queue, I'd reject it as too minor.

A: If the edit does not make any difference whatsoever (in your opinion), so will rolling it back. Rolling back will thus be as bad an edit as the original edit was. It will needlessly bump the post, send an alert to the author, etc.

A: I'd say no.  Rollbacks should only be done if the edit was harmful.
I say this because once an edit has been saved, it's saved. There's no point adding another revision just to change a word (you're basically doing the same thing again!). Anyway, this is one of the 'benefits' of having >2k -- to edit even small posts! :P
But if you see a specific user continually editing minor things in old posts (unnecessarily bumping them), then I'd flag one of these edits and detail this undesirable behavior. Or talk to them in chat.


text:
Q: What are all these *.cm[a-z] files and when we need them OCaml have various extensions for compiled files: *.a, *.cma, *.cmi, *.cmx, *.cmxa, *.cmxs (and, perhaps, this is not exhaustive list). What are they and in which cases do I need them?
If I have a library, which files do I need to ship with it. I noticed some people blindly install all *.cm[a-z] files into the archive, but is it really required?

A: First I suggest you read the overview section of the byte code and native code compilers as this will greatly improve you understanding of what these files are.
Now more specifically if your library is a set of modules caracterized by a set of .mli/.ml files:

*

*A cmi file hold the compiled interfaces of your module (result of compiling a .mli file). For each module of your library that you want other people to be able to use you need to install them (i.e. the cmi define your public interface). It's also a good practice to install the mli files so that people can have a peek at them. These days you should also install the cmti files (generated using -bin-annot option) which are annotated compiled interfaces and that can be used by tools like ocp-index, odoc and odig.

*cma files hold an archive of the result of byte code comipilation (cmo files) of your library. You should install them if you want people to be able to compile with your library to byte code.

*cmxa and .a files hold an archive of the result of native code compilation (cmx/o files) of your library. They are the pendent of cma files but for native code. You need to install them if you want people to be able to compile with your library to native code.

*cmxs are the pendant of cmxa for native dynlinking. You need to install them if you want users of your library to be able to dynamically load your library in their programs as a plugin using the Dynlink module.

*cmx files are in the cmxa however there is one reason why you may want to also install them. If they can be seen at seperate compilation time along with the cmi files they allow the compiler to perform cross-module inlining. The files separately compiled that way do however become dependent on that implementation which means that they will need a recompile if the cmx changes (i.e. the implementation) even if the cmi (i.e. the interface) did not.
Note that in general it's good if you are able to compile and install all of these files (though sometimes for some reasons you may want to not install the cmx files so that you can separately compile against a cmi and be able to switch implementation without a recompile) (see the -opaque compilation flag if you need this).
On final thing to note is that in OCaml there is no proper name spacing: every toplevel module is defined in a global namespace. This means that you need to be very careful in the toplevel module names you put in library, even if you don't export their cmi. Especially avoid generic terms that could be used by other libraries, use a short prefix for your library e.g. MyLib_file rather File (and again even if File turns out to be an internal module that you have in the cma but whose cmi you don't export it could clash with other private or public File modules defined in other libraries)

A: https://realworldocaml.org/v1/en/html/the-compiler-backend-byte-code-and-native-code.html is a good resource you can read for your question.
for a summary:


text:
Q: Is it possible to create a grid-like background in CSS without images or tables? I'd like to create a background that looks something like an excel spreadsheet. White table cells, thin borders around each cell. I know how to do this easily with a single image, and I know how to do this with tables...but I would like to do this without either, if possible.
The size of each cell will be fixed at 20x20, so I don't have to worry about resizing. Any thoughts? I sort of had a way cooked up that involved a ton of inner markup, but I figured that was almost as bad as using a table.
The purpose of this background will be allowing users to arrange blocks on a grid. Using jQuery UI's drag and drop functionality, I want the user to be able to move blocks around within a confined grid. The gridlines would simply show them where in the grid their blocks are bound to. An example of this grid snapping (without the gridlines) is available at http://jqueryui.com/demos/draggable/#snap-to

A: I have searched also for this problem and i found a very good solution:
background-size: 40px 40px;
background-size: 40px 40px;
background-image: repeating-linear-gradient(0deg, #fff, #fff 1px, transparent 1px, transparent 40px),repeating-linear-gradient(-90deg, #fff, #fff 1px, transparent 1px, transparent 40px);

body {
    background:#000;
    z-index:-5;
}

#lines {
    background-size: 40px 40px;
    background-image:repeating-linear-gradient(0deg, #fff, #fff 1px, transparent 1px, transparent 40px),repeating-linear-gradient(-90deg, #fff, #fff 1px, transparent 1px, transparent 40px);
    height:100%;
    width:100%;
    opacity:0.14;
    position:absolute;
    top:0;
    left:0;
    z-index:-4;
}

To change the grid size, change the background-size and the last px option within the gradient.
To change the grid width change the first px option within the gradient.
First gradient is horizontal, second is for the vertical lines.
for this demo I recognized that the css option:
position: absolute

was required. I will build up my grid now and if I get more information I will add them within a comment.
Hope this helps :)

A: Use a background image; don't waste your time fiddling with markup.  You're not going to get any more efficient than this:
background:url(data:image/gif;base64,R0lGODlhFAAUAIAAAMDAwP///yH5BAEAAAEALAAAAAAUABQAAAImhI+pwe3vAJxQ0hssnnq/7jVgmJGfGaGiyoyh68GbjNGXTeEcGxQAOw==);

Example.


text:
Q: Rendering XML with bigger content The CF application returns an XML response to a desktop application. XML response is alright within .5 to 3 seconds. XML contain attachments which are zipped and then base64 encoded. As soon as we have attachment slightly bigger, say 5MB it starts to take more than a minute for response. Not the real code, but that is what I am doing (CF2016 & IIS):
<cfxml variable="myXML">
<sample Status="NewJob" Type="response">
<NewJob>
   <jobNumber>3894743</jobNumber>
   <Rate>0</Rate>
   <doc><![CDATA[UEsDBBQACAAIAMl BASE_64_CONTENT]]></doc>
 </NewJob>
</sample>
</cfxml>
<cfset tempVar = xmlParse(trim(myXML))>
<cfcontent type="text/xml">
<cfoutput>#TempVar#</cfoutput>

Though files are zipped but sometimes compression is not big and 8MB file is about 7MB after compression. Total page weight become around 9MB+
Can increasing Maximum output buffer from 1024kb to 4096KB or even 2048kb help? Any consequences for doing that? Any other setting on CF or IIS which can be tweaked?

A: Why are you using xmlParse()? The <cfxml> tag already produces a XML document. Right now, your code stringifies the XML document (argument of xmlParse), then parses it as XML document (return of xmlParse) and then stringifies it again (outputting TempVar). Simplify your code:
<cfxml variable="myXML">
    <sample Status="NewJob" Type="response">
        <NewJob>
            <jobNumber>3894743</jobNumber>
            <Rate>0</Rate>
            <doc><![CDATA[UEsDBBQACAAIAMl BASE_64_CONTENT]]></doc>
        </NewJob>
    </sample>
</cfxml>

<cfcontent type="text/xml">
<cfoutput>#myXML#</cfoutput>

Now your XML document is only stringified once and without any parsing. This should speed up the processing noticeably.


text:
Q: ASP.NET SOAP Request I am successfully sending a soap request to a payment gateway as follows. But cannot obtain the response from the gateway in a meaningful manner (just string of values using the last line of code shown below). What is the best approach? Thanks.
    Dim manualWebClient As New System.Net.WebClient()

    manualWebClient.Headers.Add("Content-Type", "text/xml;  charset=utf-8")

    Dim bytArguments As Byte() = System.Text.Encoding.ASCII.GetBytes( _
        "<soap:Envelope xmlns:xsi=""http://www.w3.org/2001/XMLSchema-instance"" xmlns:xsd=""http://www.w3.org/2001/XMLSchema"" xmlns:soap=""http://schemas.xmlsoap.org/soap/envelope/"">" & System.Environment.NewLine & _
        "   <soap:Body>" & System.Environment.NewLine & _
        "       <CrossReferenceTransaction xmlns=""https://www.blahblah.net/"">" & System.Environment.NewLine & _
        "           <PaymentMessage>" & System.Environment.NewLine & _
        "               <MerchantAuthentication MerchantID=""blahblah"" Password=""blahblah"" />" & System.Environment.NewLine & _
        "               <TransactionDetails Amount=""5000"" CurrencyCode=""826"">" & System.Environment.NewLine & _
        "                   <MessageDetails TransactionType=""COLLECTION"" NewTransaction=""TRUE"" CrossReference=""140519132324310202778936"" />" & System.Environment.NewLine & _
        "                   <OrderID>order12345</OrderID>" & System.Environment.NewLine & _
        "                   <OrderDescription>Monthly Subscription</OrderDescription>" & System.Environment.NewLine & _
        "                   <TransactionControl>" & System.Environment.NewLine & _
        "                       <EchoCardType>TRUE</EchoCardType>" & System.Environment.NewLine & _
        "                       <EchoAVSCheckResult>TRUE</EchoAVSCheckResult>" & System.Environment.NewLine & _
        "                       <EchoCV2CheckResult>TRUE</EchoCV2CheckResult>" & System.Environment.NewLine & _
        "                       <EchoAmountReceived>TRUE</EchoAmountReceived>" & System.Environment.NewLine & _
        "                       <DuplicateDelay>60</DuplicateDelay>" & System.Environment.NewLine & _
        "                   </TransactionControl>" & System.Environment.NewLine & _
        "               </TransactionDetails>" & System.Environment.NewLine & _
        "           </PaymentMessage>" & System.Environment.NewLine & _
        "       </CrossReferenceTransaction>" & System.Environment.NewLine & _
        "   </soap:Body>" & System.Environment.NewLine & _
        "</soap:Envelope>")

    Dim bytRetData As Byte() = manualWebClient.UploadData("https://blahblahblah.com:4430", "POST", bytArguments)

    Response.Write(System.Text.Encoding.ASCII.GetString(bytRetData))


text:
Q: customizing minor ticks with pgfplots I am plotting some simple data using pgfplots on a log-log scale. My code is:
\documentclass{standalone}
\usepackage{pgfplots, amsmath}

\pgfplotsset{width=7cm,compat=newest}

\pgfkeys{/pgf/number format/set thousands separator = }

\begin{document}
    \begin{tikzpicture}
        \begin{loglogaxis}[
            xlabel =                            {A},
            ylabel =                            {B},
            ]
            \addplot[
            color =                             red,
            mark =                              x,
            ]
            coordinates
            {
                (20,2.8559703)
                (300,30.5301677)
                (4000,400.3050655)
                (50000,5000.1413136)
                (600000,60000.0322865)
                (7000000,600000.9675052)
                (80000000,7000000.9377747)
            };
        \end{loglogaxis}
    \end{tikzpicture}
\end{document}

There are two things I would like to change in the output:
I do not want the y axis labels to be two orders of 10 apart (this is the label spacing generated by default by the code), but would rather have them differ by one order of magnitude. I find that I can change this by including the line extra y ticks={1e1, 1e3, 1e5}, in the options of begin{loglogaxis} [options].
However, the logarithmically spaced minor tick marks on the y-axis do not appear as they do in the x-axis. Only the major tick marks appear at 10^0, 10^1, …, 10^6.

How do I make these minor tick marks appear? I tried looking through the manual; I know the answer to my question is in there somewhere, but I am new to pgfplots and the huge number of options to customize ticks and labels is overwhelming!

A: From the pgfplots manual, section 4.14 "Tick Options", p. 241:

/pgfplots/ytickten={<exponent base 10 list>}
These options allow to
  place ticks at selected positions 10k; k ∈
  {<exponent base 10 list>}. They are only used for logplots. The
  syntax for {<exponent base 10 list>} is the same as above for
  xtick={<list>} or ytick={<list>}.
Using xtickten={1,2,3,4} is
  equivalent to xtick={1e1,1e2,1e3,1e4}, but it requires fewer
  computational time and it allows to use the short syntax
  xtickten={1,...,4}.

… and it adds back the minor "log-ticks" marks.
Code
\documentclass[tikz]{standalone}
\usepackage{pgfplots, amsmath}

\pgfplotsset{width=7cm,compat=newest}

\pgfkeys{/pgf/number format/set thousands separator = }

\begin{document}
    \begin{tikzpicture}
        \begin{loglogaxis}[
            xlabel   = {A},
            ylabel   = {B},
            ytickten = {0,...,6},
            ]
            \addplot[
            color = red,
            mark  = x,
            ]
            coordinates
            {
                (20,2.8559703)
                (300,30.5301677)
                (4000,400.3050655)
                (50000,5000.1413136)
                (600000,60000.0322865)
                (7000000,600000.9675052)
                (80000000,7000000.9377747)
            };
        \end{loglogaxis}
    \end{tikzpicture}
\end{document}

Output


text:
Q: AutoBahn Websoket Login I am trying to use AutoBahn to test a websocket server. The server has a username/password.
  What is the correct way of sending the username/password for authentication? is it within the json file as shown below (ws://username:password@localhost:8787). This does not seem to work for me.
  Thank you.
{
   "options": {"failByDrop": false},
   "outdir": "./reports/servers",

   "servers": [
                {"agent": "TestWebSocket",
                 "url": "ws://username:password@localhost:8787",
                 "options": {"version": 13}}
              ],

   "cases": ["*"],
   "exclude-cases": [],
   "exclude-agent-cases": {}
}

A: Autobahn does not (yet) support HTTP authentication (when run standalone, that is not as a Twisted Web resource).


text:
Q: How do I make embed google sheets full width and height in Wordpress? I would like to embed a google excel sheet that adapts to the screen size or at least displays full content on the desktop version. Here is the current code straight from Google. Is there even a way to do this is Wordpress?
<iframe src="https://docs.google.com/spreadsheets/d/e/2PACX-1vRD8fj_8C79-j9yTl8ei5WhwcE8r1ZA7Lc3ikhGLbh_fRyyCUy4IQWT51sgfR16r8OrgXIiKXodJ5qK/pubhtml?widget=true&headers=false"></iframe>

A: <iframe src="*link to sheets* width=100% height=100%>

try this. Width and height 100% will surely occupy your screen.
And if you are asking for wordpress. Maybe you know first time you have to install iframe plugin from wordpress plugins. then only you can use iframes.

A: Use embed tag:
<embed src="https://docs.google.com/document/d/17OkIgtNdV1flno_783tJm2xWU0NBh7uEmZ5wEXP2E9g/pub?embedded=true" width="100%" style="height: -webkit-fill-available">


text:
Q: Calculating Conditional Values for Exponential Distribution For 2 numbers which are exponentially distributed with rate 3, I need to calculate:
the expected value of the lowest number given that both numbers are above 1/3

A: Because of the memorylessness of this distribution, you can just find the expected value of the minimum without the condition that they are greater than $1/3$, and then add $1/3$ to it.  (If you don't know about this, then (1) Google the word memorylessness, and (2) if you're taking a course on this material, look for it in your notes.)
$\min\{X_1,X_2\} > x$ if and only if both $X_1>x$ and $X_2>x$.  If the two random variables $X_1$ and $X_2$ are independent, then the probability that both of these events occur is just the product of their two probabilities: $\Pr(X_1>x\  \&\  X_2>x)= \Pr(X_1>x)\Pr(X_2>x) = e^{-3x}e^{-3x} = e^{-6x}$.  So the CDF of the minimum is $F(x) = 1-e^{-6x}$.  Differentiate that to get the density function $f(x)$, then find $\mathbb{E}(\min) = \displaystyle\int_0^\infty x f(x) \; dx$.


text:
Q: Is it possible for a wireless mouse to be malicious? Is it possible for a wireless mouse to be malicious? (Or, said better, how likely is it that a wireless mouse is malicious?)
I bought online a cheap wireless mouse (which works well btw), however, when I connected it to my laptop (not sure if right away or a little bit later, however certainly after I connected it), my antivirus started to alert that Google Chrome wants to access my camera (and that, as far as I know, for no reason…I wasn't browsing anything related to being recorded or something like that. I would simply open Chrome and in a little bit, my antivirus would alert! The only thing (as far as I remember) I did differently was logging into my bank account around that time (however I'm not sure if i
that was before or after connecting the mouse) and I suspected that that Chrome behavior was somehow related to this and my mouse has nothing to do with it).
I did scan my laptop twice and nothing suspicious was found, but..!
Any Idea?!
ps. I am not a developer and I don't really know if I am exaggerating it too much (I know that it takes a lot of effort and money for certain attacks), however I try to be careful as I understand a lot of things with regard to security, and I do know that by physically plugging in something, everything can happen including bypassing or tweaking the antivirus itself!

A: Any USB device can potentially be malicious. It doesn't matter in what shape it comes.
In this case though it doesn't sound like the mouse would be at fault. For Chrome to request webcam access, some website must request webcam access. Theoretically a malicious USB device could try to open a malicious website that uses webcams for something, but then you'd notice a tab opening in Chrome all by itself, which you didn't. So it doesn't sound like the mouse did something suspicious. One of the legitimately opened tabs must have done it.


text:
Q: RuntimeWarning: coroutine was never awaited in tests i'm trying to mock an async function that is being called inside of a fastapi endpoint but i'm getting the runtime warning that the coroutine _ was never awaited.
src.api.endpoint.py

from ..create_utils import helper_function

Router = APIRouter()

@api_route(
   Router.post,
   '/endpoint',
)
async def endpoint(
   inputs: InputModel,
   db,
   caller,
):
   return await helper_function(inputs, db, caller)

tests.api.endpoint.py

import asyncio
import pytest
import json
import unittest

from unittest.mock import AsyncMock, Mock

@pytest.fixture(scope="function")
async def mock_helper_function(mocker):
    async_mock = AsyncMock()
    sup = mocker.patch('src.api.endpoint.helper_function',
                 side_effect=async_mock) #where func is being imported not defined
    return async_mock

@pytest.fixture(scope="module")
def event_loop():
    return asyncio.get_event_loop()

@pytest.mark.parametrize(
    'attributes',
    [('CHECKING_ASSET_ATTRIBUTES')]
)
@pytest.mark.asyncio
async def test_endpoint_helper_func(api, attributes, borrower_ids, mock_helper_function):
    caller = 'unauthenticated-user'
    owners = [borrower_ids[caller]]
    response =  await api.response(owners, [attributes], caller) #call to endpoint

    assert response.status_code == 200
    await mock_assets_create.assert_called()

running this test causes the following error
RuntimeWarning: coroutine 'AsyncMockMixin._execute_mock_call' was never awaited

specs
python: 3.9
it appears this answer should solve my issue but doesn't https://stackoverflow.com/a/60094385
i have ran asyncio.iscoroutinefunction() on the patch mock and have confirmed it returns true. both in the fixture and in the test.
i also followed this post for guidance https://stackoverflow.com/a/74012507


text:
Q: Parameters for using sigmoidal fit in python I used
y = c / (1 + np.exp(-k*(x-x0))) + y0

in python to fit a sigmoid into a curve with points. Can any one tell me what the parmeter "c" means in sigmoidal fit?

A: The general formula for sigmoid is 1 / {1 + e**(-x)} and has the following curve:

In general, this curve is squashed between the range [0, 1].

Now, c is a scaling factor. Multiplying the curve by c results in the upper bound of the curve increasing.

As you can see, this curve has the range [0, 10] on the y-axis.

Finally, we'll consider y0, which is the offset factor, with respect to the x-axis. Putting it all together, the curve c / (1 + e ** -x) + y0 looks something like

Try it out yourself.


text:
Q: Is there a way to import prewritten JSON data into MongoDB when a new user is created but also have it tied to the new user? I'm building a studying tool that essentially consists of multiple flashcards (in the thousands). I would like to know if there is a unique way or method where the prewritten flashcards can be duplicated and tied to every user who signs up? Or perhaps having the data prewritten inside a JSON file and then upon user creation having it imported into MongoDB with a userID field that the data becomes unique to every individual user. The reason for this is because the flashcards will be using a spaced repetition algorithm and as a result I can't have one users results be carried over globally for every user. It would need to be unique to that user.
Thanks in advance for any help!
So far I've built the flashcard model and tied it to the algorithm however it updates globally across all users. Im havign a bit of trouble with breaking down some of the logic to make it unique to each user.


text:
Q: Why can't a class with a type parameter used exclusively as an argument type be covariant on it? The most common example I have found to explain why contravariantly-valid type parameters cannot be used covariantly has involved constructing some read-write wrapper of a derived type, casting it to a wrapper of the base type, injecting a different derived type, then later reading that wrapped value; something along the lines of the following:
class Base { public int base_property; }
class Derived : Base { public int derived_property; }
class OtherDerived : Base { public string other_derived_property; }
interface Wrapper<out T> {
  void put(T v);
  T pull();
}
Wrapper<Derived> derived_wrapper = new WrapperImpl<Derived>();
Wrapper<Base> cast_wrapper = (Wrapper<Base>)derived_wrapper;
cast_wrapper.put(new OtherDerived());
Derived wrapped = derived_wrapper.pull(); // Surprise! This is an OtherDerived.

I can understand why this is invalid. But what if Wrapper didn't have pull, and the property it wraps has a private getter? The problem with the (Wrapper<Base>)derived_wrapper cast seems to disappear, and I can't find a problem to replace it.
More specifically, I'm not aware of any way for functionality to be conditional on the eventual concrete type of a generic. Unsurprisingly, asserting the type like the following is no use:
class WrapperImpl<T> : Wrapper<T> where T : Base {
  public void put(T v) {
    if(typeof(T).Equals(Derived)) {
      Console.WriteLine(v.derived_property); // Type `T' does not contain a
                                             // definition for `derived_property'...
    }
  }
}

This leads me to believe that functionality in these methods can only make use of properties of the type T is constrained to. Even if the wrapped property is an OtherDerived where the original WrapperImpl expected a Derived (before being cast), no method could expect that wrapped property to have derived_property because Base is the most specific T is guaranteed to be.
Am I missing something here, or perhaps is this a limitation of the compiler to not be able to concretize T on the fly?
(I'm guessing that a class like Wrapper finds few uses, but the rules of variance appear quite broad and sweeping, and I'm curious if there are finer rules in play.)

A: The T in WrapperImpl<T> can be constrained on any subtype of Base, not just Base itself. Functionality in put should be able to safely access v.derived_property if T : Base is simply changed to a T : Derived.
This is the source of trouble when an OtherDerived is passed to put after the (Wrapper<Base>)derived_wrapper cast, in trying to access the nonexistent derived_property.


text:
Q: Trouble with php form handling I am attempting to create a shared grocery list webapp as a way to learn HTML and PHP. I am attempting to follow these directions to create my item addition form.
I am trying to get my page to show the submitted data under the form as a proof of concept, but nothing will display. This is my code, saved in \XAMPP\htdocs\ :

    <title>Grocery List</title>

<?php
$category = $item = "";
?>

    <form id='additem' method='post'>
    <fieldset>
        <legend>Add Item</legend>

            Category:
            <input type='text' name='Category' list='categories' value='<?php echo $category;?>' />
                <datalist id='categories'>
                    <option value='Protein'>
                    <option value='Produce'>
                    <option value='Baked Goods'>
                    <option value='Dry/Canned'>
                    <option value='Household'>
                </datalist>

            Name:
            <input type='text' name='item' value='<?php echo $item;?>' />

            	<input type='Submit' value='Submit' />

    </fieldset>
    </form>

    <?php
    echo "Your Input:";
    echo $category;
    echo $item;
    ?>

but when I open that page in my browser and input some information all I get is "Your Input:" followed by empty space where my info should be output.
Can anybody see where I am going wrong?

A: It's because you aren't actually processing the $_POST variable that is submitted.
Change your code as follows:
<?php
    // Load the posted values into their respective variables
    $category = $_POST['Category'];
    $item = $_POST['item'];
    echo "Your Input:";
    echo $category;
    echo $item;
?>

EDIT
Since you've updated your question, I'm updating where you should make these changes.
Now you have your variables being declared at the top of the page (which is good).  But you should now get them from the post variable there as well, and include some sort of check to see if it was posted or not (to avoid warnings / notices):
At the top of your file:
<?php
    $category = '';
    $item = '';
    // Check if the form is posted...
    if (isset($_POST['item'])) {
        // Load the posted values into the variables
        $category = $_POST['Category'];
        $item = $_POST['item'];
        // .. do the same for any other form values
    }
?>

You may find code samples or suggestions to use extract($_POST), but I strongly recommend against using extract().

A: Your Option tags are not formatted correctly.
<option value='Protein'>Protein</option>
<option value='Produce'>Produce</option>
<option value='Baked Goods'>Baked Goods</option>
<option value='Dry/Canned'>Dry/Canned</option>
<option value='Household'>Household</option>

In this case, what's between the <option> and </option> tags will appear on screen and the value=stuff is what will be saved as the value for "Categories"


text:
Q: If a line integral is 0, does the function have to be conservative? If a line integral is 0, does the function have to be conservative?
Take the line integral $\oint_{C}^{}y^4dx+2xy^3dy$, which is equal to 0 over the bounded region C: $x^2+2y^2=2$. However, I was under the impression that if a line integral equaled 0, $\frac{\partial P}{\partial y}=\frac{\partial Q}{\partial x}$ would be true based on Clairaut's theorem. However, P and Q in this line integral, $\frac{\partial P}{\partial y}=4y^3$ and $\frac{\partial Q}{\partial x}=2y^3$, which aren't equal but are instead scalar multiples of each other.
Is this function $\vec F(x,y)=P\hat{\imath}+Q\hat{\jmath}$ conservative, or am I missing something?

A: To be conservative the integral over EVERY piecewise $C^1$ closed loop must vanish. It is possible that for some particular loop the line integral is zero, but not for all of them. Recall that conservative implies that $\frac{\partial P}{\partial y}=\frac{\partial Q}{\partial x}$.
But you just showed that $\frac{\partial P}{\partial y}\neq\frac{\partial Q}{\partial x}$, hence the vector field is not conservative (this is just a rephrasing of my previous sentence in the contrapositive form).

A: If a vector field is conservative in a given domain then its line integral over every closed curve in that domain is zero. Just because the line integral is zero for the given curve does not necessarily mean that it is zero for every closed curve. For example, is it zero over a unit square with vertices at $(0, 0), (1, 0), (1, 1)$ and $(0, 1)$?
In general note that the integral of an odd function is zero if the region has symmetry about $x$ or $y$ axis. In this specific case, assuming $C$ is $x^2 + 2y^2 = 1$ then parametrizing as $r(t) = (\cos t, \frac{1}{\sqrt2} \sin t), 0 \leq t \leq 2\pi$ and $r'(t) = (- \sin t, \frac{1}{\sqrt2} \cos t)$.
So, $ \vec F \cdot r'(t) = -\dfrac{\sin^5t}{4} + \dfrac{\cos^2 t \sin^3 t}{2}  = \dfrac{\sin^3 t}{2} - \dfrac{3 \sin^5 t}{4}$.
Integral of odd power of $\sin$ function over $(0, 2\pi)$ is always zero.


text:
Q: Can I restore an iPhone from iPod Touch Backup? If I buy an iPhone, can I restore it (along with app data) from an iPod Touch backup?

A: Seems feasible. The last post on this site says someone got it to work. Do an actual backup (not just sync) though.

A: As I recall, when you first sync your iphone, you will be prompted to do so, so yes!
I'd recommend you to do a sync on your ipod before syncing the iphone.

A: This does not work, just tried with new iPhone 5 and the settings were that of the iPod i.e. no app for messages, calls or any other iPhone standards :s

A: Yes. This is possible using iCloud. As long as you have your iPod backed up to iCloud, then, it will appear under the list of iCloud backup(s) available to restore from.
When you start your iPhone, and are prompted with the option of where to restore from, choose iCloud. The backup of your iPod touch will appear.  Select that to restore.

A: You should be able to restore the iPhone from your iPod Touch's backup. Backup the iPod touch, then restore from that backup in iTunes. You should be able to select the backup from the list that pops up. Although the iPhone will be restored from the iPod Touch's backup, iTunes should recognize it as a separate device.

A: When I got my first iPhone three years ago (iPhone 4), this worked partially. Obviously, it worked fine. But every now and then the iPhone was not able to receive phone calls any more. The caller did not recognize it because he got the dialing tone, not the busy tone.
I could only solve that problem by resetting the iPhone and not restoring the old iPod backup.


text:
Q: How to auto insert a string in filename by bash? I have the output file day by day:
linux-202105200900-foo.direct.tar.gz

The date and time string, ex: 202105200900 will change every day.
I need to manually rename these files to
linux-202105200900x86-foo.direct.tar.gz

( insert a short string x86 after date/time )
any bash script can help to do this?

A: If you're always inserting the string "x86" at character #18 in the string, you may use that command:
var="linux-202105200900-foo.direct.tar.gz"
var2=${var:0:18}"x86"${var:18}
echo $var2

The 2nd line means: "assign to variable var2 the first 18 characters of var, followed by x86 followed by the rest of the variable var"
If you want to insert "x86" just before the last hyphen in the string, you may write it like this:
var="linux-202105200900-foo.direct.tar.gz"
var2=${var%-*}"x86-"${var##*-}
echo $var2

The 2nd line means: "assign to variable var2:

*

*the content of the variable var after removing the shortest matching pattern "-*" at the end

*the string "x86-"

*the content of the variable var after removing the longest matching pattern "*-" at the beginning

A: In addition to the very good answer by @Jean-Loup Sabatier another, perhaps more general way would simply be to replace the second occurrence of '-' with x86- which you can do with sed. Let's say you have:
fname=linux-202105200900-foo.direct.tar.gz

You can update that with:
fname="$(sed 's/-/x86-/2' <<< "$fname")"

Which simply uses a command substitution with sed and a herestring to modify fname assigning the modified result back to fname.
Example Use/Output
$ fname=linux-202105200900-foo.direct.tar.gz
fname="$(sed 's/-/x86-/2' <<< "$fname")"
echo $fname
linux-202105200900x86-foo.direct.tar.gz

A: I wanted to go as simple as possible, considering only the timestamp is going to change, this script should do it. Just run it inside the folder where files are located and you'll get all of them renamed with x86.
#!/bin/bash

for file in $(ls); do
  replaced=$(echo $file | sed 's|-foo|x86-foo|g')
  mv $file $replaced
done

This is my output
filip@filip-ThinkPad-T14-Gen-1:~/test$ ls
linux-202105200900-foo.direct.tar.gz  linux-202105201000-foo.direct.tar.gz  linux-202105201100-foo.direct.tar.gz
filip@filip-ThinkPad-T14-Gen-1:~/test$ ./../development/bash-utils/bulk-rename.sh
filip@filip-ThinkPad-T14-Gen-1:~/test$ ls
linux-202105200900x86-foo.direct.tar.gz  linux-202105201000x86-foo.direct.tar.gz  linux-202105201100x86-foo.direct.tar.gz

Simply iterate through all the files in current folder and pipeline result to sed to replace regex -foo with x86-foo, then rename file with mv command.
As David mentioned in comment, if you're worried that there could be multiple occurrences of -foo then you can just replace g as global to 1 as first occurrence and that's it!

A: Do you need this?
❯ dat=$(date '+%Y%m%d%H%M%S'); echo ${dat}
20210520170336
❯ filename="linux-${dat}x86-foo.direct.tar.gz"; echo ${filename}
linux-20210520170336x86-foo.direct.tar.gz

A: There is also the rename utility (https://man7.org/linux/man-pages/man1/rename.1.html), you could use:
rename -v 0-foo.direct.tar.gz 0x86-foo.direct.tar.gz *

which results in
`linux-202105200900-foo.direct.tar.gz' -> `linux-202105200900x86-foo.direct.tar.gz'
`linux-202205200900-foo.direct.tar.gz' -> `linux-202205200900x86-foo.direct.tar.gz'
`linux-202305200900-foo.direct.tar.gz' -> `linux-202305200900x86-foo.direct.tar.gz'

A: In addition to the very good answer by @David C. Rankin, just adding it in a loop and renaming the files
# !/usr/bin/bash
for file in `ls linux* 2>/dev/null` # Extract all  files starting with linux
do
echo $file
fname="$(sed 's/-/x86-/2' <<< "$file")"
mv "$file" "$fname"                 # Rename file
done

Output recieved :
linux-202105200900x86-foo.direct.tar.gz


text:
Q: Limit of product and ratio of two sequences Assume $\lim_{n\to\infty} u_n=L$ and $\lim_{n\to\infty} v_n=M$. Can we conclude that $\lim_{n\to\infty}u_nv_n=LM$ and $\lim_{n\to\infty}u_n/v_n=L/M$?

A: We can prove by the definition of limit that the first one always holds for $L$ and $M$ finite.
The second one requires $M\neq 0$.
Refer to the related

*

*The limit of the product of two convergent sequences

A: Yes $\lim\limits_{n\rightarrow +\infty}{u_n\cdot v_n}=L\cdot M$ but no, $\lim\limits_{n\rightarrow +\infty}{\frac{u_n}{v_n}}=\frac{L}{M}$ is not always true. It only works if $M\neq 0$, you can find counter examples if $M=0$, take $u_n=\frac{(-1)^n}{n}$ and $v_n=\frac{1}{n}$, you have $\lim\limits_{n\rightarrow +\infty}{u_n}=\lim\limits_{n\rightarrow +\infty}{v_n}=0$ but $\frac{u_n}{v_n}=(-1)^n$ has no limit.


text:
Q: How re-adjust SKNodes base on user location I'm currently using ARKit and CoreLocation together to place elements on screen. Those elements (for example a building, house etc) are place base on their own coordinates (longitude/latitude) and the user coordinates. As you know, even by setting the best accuracy, CoreLocation are not always precise and the user location and heading direction are being corrected often.
When the heading direction or user location has been corrected, how can I re-adjust everything without having to remove and re-add all the Node? Seems like you cannot change the camera translation property. I also tried setWorldOrigin(relativeTransform: simd_float4x4) but it didn't change anything.
The best solution I found so far it's to use SKAction but if you have a lot nodes, it tends to be very expensive and slow down the app.
Can you tell me if I'm doing anything wrong or there is simpler way to do it?

A: Let's consider that the physical location of only the user changes, everything else is placed relatively to the other objects. For this reason I would suggest you set the parent to all of your nodes to be a common node, that can be added as a child of the default root.
so your structure would be
rootNode -> myRootNode -> (all other 3D)
this way you can update the translation of myRootNode and it will shift all of its children into place.


text:
Q: Why Does Induction Prove Multiplication is Commutative? Andrew Boucher's General Arithmetic (GA2) is a weak sub-theory of second order Peano Axioms (PA2).
GA has second order induction and a single successor axiom:
$$\forall x \forall y \forall z\bigr((Sx=y \land Sx=z)\to(y=z)\bigl)$$
Boucher proves multiplication is commutative in GA2. Why does induction prove multiplication is commutative? GA2 has many finite models. The rings $\mathbb Z/n\mathbb Z$ are models. If we remove induction from GA2 it is easy to see GA-Ind is sub-theory of Ring Theory (RT). RT has finite non-commutative models. Why aren't these finite non-commutative rings models of GA? Would a first order version of GA also prove multiplication is commutative?


text:
Q: Laravel 5.2 cannot get name of current route I have followed instructions from Taylor here but I cannot get this code working. I am trying to capture the name of the current route.
I have a class where I try and access the route. I have added a use statement at the top for the Route class:
use Illuminate\Routing\Route;

Inside the class I have the following method:
public function getTitle()
{
    $route = Route::current();
    $slug = $route->getName();

    return UserMenu::where('slug', '=', $slug)
        ->select()
        ->first()
        ->page_title;
}

But when my code hits the $route = line above it fails with:
Call to undefined method Illuminate\Routing\Route::current()

Of course the method is not in the Route.php file. What have I missed?

A: Ops! I needed to add:

use Route;


text:
Q: C#: Thread Completion (Best Practices)? So after some heavy research into multi-threading and how to handle thread completion I have come across several solutions. Some solutions seem a lot more useful and informative than others. I would like to take some time to explain what I already know, and then in return, I would like to better understand why these solutions are implemented so variously. The original topic of this post was to discover the difference between Thread.Sleep(x) and do {} while (b);. From my understanding these two solutions are only different in the sense that Thread.Sleep(x) will use less CPU than the latter. Spin waiting (empty while loop) will essentially run continiously from the CPU spiking percentages upwards of 85% which is a bad thing even on the fastest computers, I could only imagine what this would do to the average home computer.
Thread.Sleep
MSDN clearly states that when using Thread.Sleep(x) the thread does not execute during the time specified.

The thread will not be scheduled for execution by the operating system for the amount of time specified.

There are other options recommended within the remarks section of Thread.Sleep(x) such as using Timeout.Infinite or Mutex, Monitor, Semaphore, etc to synchronize threads and manage resources in a better manner. What is your opinion on this? Wouldn't this be just as bad as freezing the GUI with spin waiting?
MSDN also states that the since the system clock ticks at a specific rate called the clock resolution, the actual timing may not be the exact value specified since it is adjusted to coincide with clock ticks.
Spin Waiting
From my understanding this is an entirely bad practice. Once you initiate an empty loop it essentially blocks the thread it is executing it. This can result in freezing, crashing, and unresponsive GUIs, not to mention this can slow the user's computer down signifigantly since neither the compiler nor the operating system understand that the loop can be optimized to save uneccesary hits on performance. From my reading, the average computer can have between one and two cores of it's CPU running at 100% simply due to an empty while loop being executed continuously. The only effective usage of Spin Waiting that I've read about is thread synchronization. Have you used this to synchronize threads? I would imagine that there are better solutions and that using an empty loop would be problematic for debugging as well.
Background Worker
The BackgroundWorker object has an event called RunWorkerCompleted that is raised when the DoWork event handler returns. In my experience with threading (which is minimal) I have always used this event to execute code once the threaded operation has completed. The biggest thing to take into account with this event is that if the background thread was canceled then you have no true way of knowing since the Canceled flag will not be set to true if the CancellationPending flag has been set to true and missed by the polling loop. MSDN states it more thoroughly:

Be aware that your code in the DoWork event handler may finish its work as a cancellation request is being made, and your polling loop may miss CancellationPending being set to true. In this case, the Cancelled flag of System.ComponentModel.RunWorkerCompletedEventArgs in your RunWorkerCompleted event handler will not be set to true, even though a cancellation request was made. This situation is called a race condition and is a common concern in multithreaded programming. For more information about multithreading design issues, see Managed Threading Best Practices.

Final Thoughts
Since there are many ways to accomplish multiple tasks at the same time, which is generally considered best practice, why is it best practice, and what are the biggest differences between them all? I've put a lot of thought into this, and am highly curious about the advice of developers with more experience.
NOTES
I have dove deep into Google, MSDN, StackOverflow, and Daniweb, to put a good research effort into this question. The final thoughts area is the primary question set I would like to have answered. I believe the original post here was too broad and needed further information and clarity before I could recieve the answer I was truly looking for, and I apologize for taking so long to clarify my question.
Thank you all for your input!
-Jamie
DUPLICATE DIFFERENCE
In this post marked as duplicate to this one, the OP is requesting information on how to solve a problem with their BackgroundWorker object not actually raising the RunWorkerCompleted event, I am not having this issue, nor is my posting requesting information about this issue. My post is requesting detailed information on the difference between the three most common methods of waiting on a thread to complete before executing final operations. My main concern is the advantage and disadvantage to each solution as well as any further solutions that are considered common or best practice with multi-threading.


text:
Q: NewMailEx not firing in Outlook2007 I am trying to code a script that catches the Emails Outlook receives to then process them. But it isn't working so far.
I tried to use a premade code snippet(Sorry French) to start from, but it's not working.. What do I need to do to make it fire when an Email is received?
Private Sub Application_NewMailEx(ByVal EntryIDCollection As String)
'---------------------------------------------------------------------------------------
' Procédure : Application_NewMailEx
' Auteur    : Dolphy35
' Site      : http://dolphy35.developpez.com
'---------------------------------------------------------------------------------------
'
Dim MyApp As Outlook.Application
Dim MyMail As Object
Dim MyNameSpace As Outlook.NameSpace
Dim MyFolder As Outlook.Folder

Set MyApp = Outlook.Application
Set MyNameSpace = MyApp.GetNamespace("MAPI")
Set MyDossier = MyNameSpace.GetDefaultFolder(olFolderInbox)
Set MyMail = Application.Session.GetItemFromID(EntryIDCollection)

    If MyMail.SenderEmailAddress = "myAdress@adress.com" Then
        MyMail.Move MyFolder.Folders("Temp")
    End If

End Sub

I am using OutLook 2007 and I placed this code in Module1.

A: The NewMailEx event handler should go in the code module for ThisOutlookSession, for example:


text:
Q: find exponential of 4x4 matrix Hi i am trying to understand  ,  consider the matrix :
$M = \begin{pmatrix}
0 &-2  & 4 &-2 \\
1 &1  &-2  &-1 \\
0 &0  &0  &0 \\
1 &-1  &2  &-3
\end{pmatrix}  $
$M^2 = \begin{pmatrix}
-4 &0  & 0 &8 \\
0 &0  &0  &0 \\
0 &0  &0  &0 \\
-4 &0  &0  &8
\end{pmatrix} ,\qquad
$
$
M^3 = \begin{pmatrix}
8 &0  & 0 &-16 \\
0 &0  &0  &0 \\
0 &0  &0  &0 \\
8 &0  &0  &-16
\end{pmatrix}  $ then $M^n = 2^{n-2}M^2$
how to determine $e^M$ ? i known just that $e^M = \sum_{n=0}^{+\infty}\frac{1}{n!}M^n $ but i don't know determine

A: We have :
$$e^M = I + M + M^2 \cdot\sum_{i=2}^{\infty} \frac{2^{i-2}}{i!}$$
Using the fact that : $e^x = \sum_{i=0}^{\infty} \frac{x^i}{i!}$
We get :
$$ \sum_{i=2}^{\infty} \frac{2^{i-2}}{i!} = \frac{1}{4} \cdot \sum_{i=2}^{\infty} \frac{2^i}{i!} = \frac{1}{4} \cdot ( e^2-3)$$
So we have :
$$e^M = I + M + \frac{e^2-3}{4} \cdot M^2$$


text:
Q: What does the MATLAB *. operator do? I see this in a MATLAB m-script, don't know what the *. operator is:
6*.5 = 3
10*.1 = 1
10*.30 = 3

So, what is the *. operator doing?

A: Usually, the . means element by element operation.
In this case (from syntax highlighting) it looks like a regular decimal point though!


text:
Q: how can the awk command in Shell scripting be used to subtract integers in columns that also contain characters? I have a txt file that looks something like this
col 1    col 2    col 3    col 4
A        12.6e12  058      12ED08
B        10.2e09  070      40ED01
C        13.5e08  046      73ED02

If I want to subtract the first 2 digits of col 4 from col 3, i.e. ignoring "ED" and the last 2 digits from col 4. how can I do this using awk command? and also if I want to add col 2 and col 3 using awk, how would I take the digits after 'e' to be the exponent? A simple output would be
col 1   col 4-col 3
A       -46           (12-058)
B       -30           (40-070)
C        27           (73-046)

A: Easy in Perl, should be similarly easy in awk:
perl -lane 'print $F[1] + $F[2], "\t", $F[3] - $F[2]' input-file

*

*-n pocesses the input line by line

*-a splits the input into the @F array

*-l appends a newline to print
Perl undestands the "scientific notation", so no work's needed to interpret the 12.6e12. When using arithmetic operators on strings, Perl tries to convert them into numbers by taking as many characters from the left as possible, so it ignores the ED... in col4.

A: using awk(1):
$ awk '{print $1 "\t" $4-$3 "\t(" int($4) "-" $3 ")"}' << EOF
> A        12.6e12  058      12ED08
> B        10.2e09  070      40ED01
> C        13.5e08  046      73ED02
> EOF
A       -46     (12-058)
B       -30     (40-070)
C       27      (73-046)

A: Awk is your friend here:
awk -F '[[:blank:]e]+|ED' 'FNR==1{print "col 1   col 4-col 3";next}{print $1 "\t" ($5-$4) "\t(" $5 "-" $4 ")"}' YourFile


text:
Q: Do refresh token for same account user is always same? Copied from the old forum:
Every time I register same user to jawbone  for allowing me to retrieve data, it is returning same refresh token. If that is always true Can I use refresh token to update user details in my application. As there is not EncodedUserId come in response by which I can identify user.

A: The refresh token is not guaranteed to be the same forever, so you should not make that assumption.
Additionally, the refresh token can only be used to get new access tokens and not to retrieve any other data.
If you are looking for a unique ID to represent an UP user, you should use the xid retrieved from the User endpoint.
The user's xid is also returned as the user_xid in the meta section of any UP API response.