text:
Q: remove previous markers and retain only single marker highchart Hi I am trying to learn highchart, and while reading the documentations of it, I am having a hard time exploring how to solve my problem. Can you help me remove the markers of previous points and retain only the current marker of the line chart?
$(document).ready(function () {
Highcharts.setOptions({
    global: {
        useUTC: false
    }
});

Highcharts.chart('container', {
    chart: {
        type: 'spline',
        animation: Highcharts.svg, // don't animate in old IE
        marginRight: 10,
        events: {
            load: function () {

                // set up the updating of the chart each second
                var series = this.series[0];
                setInterval(function () {
                    var x = (new Date()).getTime(), // current time
                        y = Math.random();
                    series.addPoint([x, y], true, true);
                }, 1000);
            }
        }
    },
    title: {
        text: 'Live random data'
    },
    xAxis: {
        type: 'datetime',
        tickPixelInterval: 150
    },
    yAxis: {
        title: {
            text: 'Value'
        },
        plotLines: [{
            value: 0,
            width: 1,
            color: '#808080'
        }]
    },
    tooltip: {
        formatter: function () {
            return '' + this.series.name + '
' +
                Highcharts.dateFormat('%Y-%m-%d %H:%M:%S', this.x) + '
' +
                Highcharts.numberFormat(this.y, 2);
        }
    },
    legend: {
        enabled: false
    },
    exporting: {
        enabled: false
    },
    series: [{
        name: 'Random data',
        data: (function () {
            // generate an array of random data
            var data = [],
                time = (new Date()).getTime(),
                i;

            for (i = -19; i <= 0; i += 1) {
                data.push({
                    x: time + i * 1000,
                    y: Math.random()
                });
            }
            return data;
        }())
    }]
});
});

Here is the image I am trying to do

one marker is being displayed.
I am using the jsfiddle demo of highchart, here is the link

A: You can disable marker for each point except the last one.
On start:
      series: [{
        name: 'Random data',
        data: (function () {
            // generate an array of random data
            var data = [],
                time = (new Date()).getTime(),
                i;

            for (i = -19; i <= 0; i += 1) {
                data.push({
                    x: time + i * 1000,
                    y: Math.random(),
                    marker: {
                      enabled: i === 0
                    }
                });
            }
            return data;
        }())
    }]

And disabling marker in the last point before the new point is added:
          events: {
            load: function () {

                // set up the updating of the chart each second
                var series = this.series[0];
                setInterval(function () {
                    var x = (new Date()).getTime(), // current time
                        y = Math.random();
                    series.data[series.data.length - 1].update({
                      marker: { enabled: false }
                    }, false)
                    series.addPoint([x, y], true, true);
                }, 1000);
            }
        }

example: http://jsfiddle.net/m9ykaaa7/

A: You have to hide the markers for data points by default. You have to update the highcharts object to contain the following options:
plotOptions: {
    series: {
        marker: {
            enabled: false
        }
    }
}

Now every time when you add a point, you have to add it like:
series.addPoint({
  x: x,
  y: y,
  marker: {enable: true}
});

And hide the marker for last point by updating the property:
last_point.update({ marker: { enabled: false } });

Here's a working example: http://jsfiddle.net/10yfarod/
Edit
You can add the marker after adding the point to the series. But this messes up with that smooth line animation. To avoid that you can use the setTimeout to show the marker after 500ms when the animation finishes.
Here's a working example: http://jsfiddle.net/10yfarod/1/


text:
Q: How to run docker-compose on AWS CodeBuild? I'm trying to setup automated Rails tests on AWS CodeBuild using docker-compose, but it errors out.
In buildspec.yml:
phases:
  build:
    commands:
        - docker-compose up -d

[Container] 2018/10/23 11:27:56 Running command docker-compose up -d
Couldn't connect to Docker daemon at http+docker://localhost - is it running?
 If it's at a non-standard location, specify the URL with the DOCKER_HOST environment variable.
 [Container] 2018/10/23 11:27:56 Command did not exit successfully docker-compose up -d exit status 1
[Container] 2018/10/23 11:27:56 Running command echo This always runs even if the install command fails
This always runs even if the install command fails
 [Container] 2018/10/23 11:27:56 Phase complete: BUILD Success: false
[Container] 2018/10/23 11:27:56 Phase context status code: COMMAND_EXECUTION_ERROR Message: Error while executing command: docker-compose up -d. Reason: exit status 1

Presumably I need to install docker and start the service, but that would be running Docker inside Docker and would require the build server to be started with privileged permission. Only examples I can see are for building Docker images, but I'm just trying to use it to setup the environment to run the test in.
ANSWERED: Set up Docker image in CodeBuild's Environment section
Thanks to @mferre for answering this. Docker-compose is indeed completely supported without doing anything special. The key is to choose a Docker image in the "environment" section when setting up inside AWS CodeBuild console (or same via the API):

Or can also be specified for an existing project - from Build / Build Projects, select the project, and Environments from the Edit menu. This lets you specify the image:

You could use any other image and script the Docker setup in buildspec.yml, but the easiest way is to use the official Docker image as above. With this as the container, docker and docker-compose are pre-installed, so docker-compose "just works". If the project has a docker-compose.yml file in its root, the buildspec.yml can be as simple as running it immediately:
version: 0.2
phases:
  build:
    commands:
      - docker-compose up -d

A: Are you using the Docker runtime for your build environment?
I am working with this repo: https://github.com/mreferre/yelb
That dockercompose isn't building anything (it's rather meant to deploy) but I believe you are hitting a problem much before that. Your compose up should work if you use the Docker runtime.
This is what my buildspec looks like:
version: 0.2
phases:
  build:
    commands:
        - cd deployments/platformdeployment/Docker
        - docker-compose up -d

And this is the output:
[Container] 2019/02/20 13:48:02 Waiting for agent ping
[Container] 2019/02/20 13:48:04 Waiting for DOWNLOAD_SOURCE
[Container] 2019/02/20 13:48:07 Phase is DOWNLOAD_SOURCE
[Container] 2019/02/20 13:48:07 CODEBUILD_SRC_DIR=/codebuild/output/src292484508/src/github.com/mreferre/yelb
[Container] 2019/02/20 13:48:07 YAML location is /codebuild/readonly/buildspec.yml
[Container] 2019/02/20 13:48:07 Processing environment variables
[Container] 2019/02/20 13:48:07 Moving to directory /codebuild/output/src292484508/src/github.com/mreferre/yelb
[Container] 2019/02/20 13:48:07 Registering with agent
[Container] 2019/02/20 13:48:07 Phases found in YAML: 1
[Container] 2019/02/20 13:48:07  BUILD: 2 commands
[Container] 2019/02/20 13:48:07 Phase complete: DOWNLOAD_SOURCE Success: true
[Container] 2019/02/20 13:48:07 Phase context status code:  Message:
[Container] 2019/02/20 13:48:07 Entering phase INSTALL
[Container] 2019/02/20 13:48:07 Phase complete: INSTALL Success: true
[Container] 2019/02/20 13:48:07 Phase context status code:  Message:
[Container] 2019/02/20 13:48:08 Entering phase PRE_BUILD
[Container] 2019/02/20 13:48:08 Phase complete: PRE_BUILD Success: true
[Container] 2019/02/20 13:48:08 Phase context status code:  Message:
[Container] 2019/02/20 13:48:08 Entering phase BUILD
[Container] 2019/02/20 13:48:08 Running command cd deployments/platformdeployment/Docker

[Container] 2019/02/20 13:48:08 Running command docker-compose up -d
Creating network "docker_yelb-network" with driver "bridge"
Pulling redis-server (redis:4.0.2)...
4.0.2: Pulling from library/redis
Pulling yelb-db (mreferre/yelb-db:0.3)...
0.3: Pulling from mreferre/yelb-db
Pulling yelb-appserver (mreferre/yelb-appserver:0.3)...
0.3: Pulling from mreferre/yelb-appserver
Pulling yelb-ui (mreferre/yelb-ui:0.3)...
0.3: Pulling from mreferre/yelb-ui
Creating docker_redis-server_1 ...
Creating docker_yelb-db_1      ...
·[2A·[2K
Creating docker_redis-server_1 ... ·[32mdone·[0m
·[2B·[1A·[2K
Creating docker_yelb-db_1      ... ·[32mdone·[0m
·[1BCreating docker_yelb-appserver_1 ...
·[1A·[2K
Creating docker_yelb-appserver_1 ... ·[32mdone·[0m
·[1BCreating docker_yelb-ui_1        ...
·[1A·[2K
Creating docker_yelb-ui_1        ... ·[32mdone·[0m
·[1B
[Container] 2019/02/20 13:49:00 Phase complete: BUILD Success: true
[Container] 2019/02/20 13:49:00 Phase context status code:  Message:
[Container] 2019/02/20 13:49:00 Entering phase POST_BUILD
[Container] 2019/02/20 13:49:00 Phase complete: POST_BUILD Success: true
[Container] 2019/02/20 13:49:00 Phase context status code:  Message:

A: Okay, I figured out the issue!
You need to enable 'Privileged Access' on the CodeBuild container.  This will allow you to interact with the docker cli.
Then add these two lines to the install commands:
- nohup /usr/local/bin/dockerd --host=unix:///var/run/docker.sock --host=tcp://127.0.0.1:2375 --storage-driver=overlay2&
 - timeout 15 sh -c "until docker info; do echo .; sleep 1; done"
`
ex:
version: 0.2

phases:
  install:
    commands:
      - nohup /usr/local/bin/dockerd --host=unix:///var/run/docker.sock --host=tcp://127.0.0.1:2375 --storage-driver=overlay2&
      - timeout 15 sh -c "until docker info; do echo .; sleep 1; done"
  pre_build:
    commands:
      - docker build -t helloworld .
  build:
    commands:
      - docker images
      - docker run helloworld echo "Hello, World!"

redpajama_set_name: RedPajamaStackExchange


text:
Q: SQL Server generating code that Visual Studio claims to be an error? I have dozens of .sql file in a (poorly maintained) VS2012 SqlServer project that I'm syncing up with the database. I can't do a Schema Compare because VS complains that there are build errors. The database will have priority over what the SQL Project has, but I'm confused by the errors in one .sql in particular:
USE [ePostRxIS] /* SQL70001: This statement is not recognized in this context */
GO

/****** Object:  Table [SpyGlass].[Audit]    Script Date: 01/16/2014 11:45:59 ******/
SET ANSI_NULLS ON /* SQL70001: This statement is not recognized in this context */
GO

SET QUOTED_IDENTIFIER ON /* SQL70001: This statement is not recognized in this context */
GO

SET ANSI_PADDING ON /* SQL70001: This statement is not recognized in this context */
GO

CREATE TABLE [SpyGlass].[Audit](
    [AuditUID] [int] IDENTITY(1,1) NOT NULL,
    [AuditTypeUID] [int] NOT NULL,
    [SystemName] [varchar](25) NOT NULL,
    [ApplicationName] [varchar](250) NOT NULL,
    [Module] [varchar](250) NULL,
    [Operation] [varchar](250) NULL,
    [Description] [varchar](500) NOT NULL,
    [AdditionalInfo] [varchar](max) NULL,
    [CreatedDateTimeUTC] [datetime] NOT NULL,
    [Username] [varchar](50) NULL,
    [Synchronized] [bit] NOT NULL,
    [Event] [varchar](250) NULL,
    [EventTypeUID] [int] NULL,
    [EntityTypeUID] [int] NULL,
    [EntityUID] [int] NULL,
 CONSTRAINT [PK_Audit] PRIMARY KEY CLUSTERED
(
    [AuditUID] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]

GO

SET ANSI_PADDING ON /* SQL70001: This statement is not recognized in this context */
GO
/* SQL71508: The model already has an element that has the same name SpyGlass.Audit.AuditUID.MS_Description */
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'Unique identifier and primary key.' , @level0type=N'SCHEMA',@level0name=N'SpyGlass', @level1type=N'TABLE',@level1name=N'Audit', @level2type=N'COLUMN',@level2name=N'AuditUID'
GO

EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'Foreign key into the AuditType table.' , @level0type=N'SCHEMA',@level0name=N'SpyGlass', @level1type=N'TABLE',@level1name=N'Audit', @level2type=N'COLUMN',@level2name=N'AuditTypeUID'
GO

EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'The machine name running the application that generated the entry.' , @level0type=N'SCHEMA',@level0name=N'SpyGlass', @level1type=N'TABLE',@level1name=N'Audit', @level2type=N'COLUMN',@level2name=N'SystemName'
GO

EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'The name of the application making the entry.' , @level0type=N'SCHEMA',@level0name=N'SpyGlass', @level1type=N'TABLE',@level1name=N'Audit', @level2type=N'COLUMN',@level2name=N'ApplicationName'
GO

EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'The class name or "zone" of execution code.' , @level0type=N'SCHEMA',@level0name=N'SpyGlass', @level1type=N'TABLE',@level1name=N'Audit', @level2type=N'COLUMN',@level2name=N'Module'
GO

EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'The web services operation that was invoked.' , @level0type=N'SCHEMA',@level0name=N'SpyGlass', @level1type=N'TABLE',@level1name=N'Audit', @level2type=N'COLUMN',@level2name=N'Operation'
GO

EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'The content describing the reason for the entry.' , @level0type=N'SCHEMA',@level0name=N'SpyGlass', @level1type=N'TABLE',@level1name=N'Audit', @level2type=N'COLUMN',@level2name=N'Description'
GO

EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'Any additional information such as request/response XML, stack traces and so on.' , @level0type=N'SCHEMA',@level0name=N'SpyGlass', @level1type=N'TABLE',@level1name=N'Audit', @level2type=N'COLUMN',@level2name=N'AdditionalInfo'
GO

EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'The UTC date and time the entry was created.' , @level0type=N'SCHEMA',@level0name=N'SpyGlass', @level1type=N'TABLE',@level1name=N'Audit', @level2type=N'COLUMN',@level2name=N'CreatedDateTimeUTC'
GO

ALTER TABLE [SpyGlass].[Audit]  WITH CHECK ADD  CONSTRAINT [FK_Audit_AuditType] FOREIGN KEY([AuditTypeUID])
REFERENCES [SpyGlass].[AuditType] ([AuditTypeUID])
GO

ALTER TABLE [SpyGlass].[Audit] CHECK CONSTRAINT [FK_Audit_AuditType]
GO

ALTER TABLE [SpyGlass].[Audit]  WITH CHECK ADD  CONSTRAINT [FK_Audit_EventType] FOREIGN KEY([EventTypeUID])
REFERENCES [SpyGlass].[EventType] ([EventTypeUID])
GO

ALTER TABLE [SpyGlass].[Audit] CHECK CONSTRAINT [FK_Audit_EventType]
GO

ALTER TABLE [SpyGlass].[Audit] ADD  CONSTRAINT [DF_Audit_CreatedDateTime]  DEFAULT (getutcdate()) FOR [CreatedDateTimeUTC]
GO
/* SQL71508: The model already has an element that has the same name SpyGlass.Audit.AuditUID.MS_Description */
EXECUTE sp_addextendedproperty @name = N'MS_Description', @value = N'Unique identifier and primary key.', @level0type = N'SCHEMA', @level0name = N'SpyGlass', @level1type = N'TABLE', @level1name = N'Audit', @level2type = N'COLUMN', @level2name = N'AuditUID';
GO
create index IDX_Audit_EntityHistory on SpyGlass.Audit (EntityTypeUID, EntityUID, Description, CreatedDateTimeUTC)
include (AuditUID, AuditTypeUID, SystemName, ApplicationName, Module, Operation, AdditionalInfo, Username, Synchronized, Event, EventTypeUID);

GO
CREATE NONCLUSTERED INDEX IDX_SpyGlass_Audit_History
ON [SpyGlass].[Audit] ([AuditTypeUID],[EntityTypeUID],[EntityUID],[CreatedDateTimeUTC])
INCLUDE (Description)

This is the contents of the .sql (with added comments indicating errors) but if I go to SQL Server Management Studio, right click the table in question (Audit), Script Table as > CREATE To, then the created script is exactly what the SQL Project has. The VS Project has the Target Platform set to SQL Server 2012 which is the proper target environment.
What can I do to make the two agree? I'm tempted to recreate the project with exactly what the database contains, get a fresh start, but if VS is complaining about generated code, what can I do? If I do correct the VS Project so it doesn't have build errors, won't the Schema Compare constantly tell me there are differences?

A: SSDT and DB Projects will only recognize the "CREATE" syntax, not the "USE" and "SET" commands. Take those out of your file for the project and you should be good.
If you're trying to put your whole DB in version control initially, consider importing it. You may also consider using the schema compare tool to compare a DB (as source) to your project (as target).


text:
Q: I can't drag and drop a svg element having viewbox which is dynamically appended in svgedit tool's canvas I am working on a SVG project i have to add a svg text by giving manually its size and other parameters. but there is no heght parameter in svg text element so i am using a svg as parent element of text element and viewbox of svg set as BBOx of text element. by doing this i can set all parameters to the text. but after it got appeneded in svg-edit canvas i can't drag and drop it. please help me thanks in advance

function opacityValue() {
    var opValue = document.getElementById("myRange").value;
    document.getElementById("opacityValue").textContent = "(" + opValue / 100 + ")";
}
//
function txtOnFloor() {
    var color = document.getElementById("clr").value;
    var opacity = document.getElementById("myRange").value / 100;
    var fontFamily = document.getElementById("family").value;
    var svgs = document.getElementById("svgcontent");
    var svg = svgs.getElementsByTagName("g")[0];
    var g = document.createElementNS("http://www.w3.org/2000/svg", "g");
    var g2 = document.createElementNS("http://www.w3.org/2000/svg", "g");
    var rectNull = document.createElementNS("http://www.w3.org/2000/svg", "rect");
    var svgText = document.createElementNS("http://www.w3.org/2000/svg", "text");
    var innerSvg = document.createElementNS("http://www.w3.org/2000/svg", "svg");
    var svgTexttemp = document.getElementById("bg_svgtext").value;

    /////
    var width1 = parseInt(document.getElementById("w1").value);
    var width2 = document.getElementById("w2").value;
    if (width2 != null || width2 != 0) {
        width2 = parseInt(width2) / 100;
    }
    else {
        width2 = 0;
    }
    var width = width1 + width2;

    var depth1 = parseInt(document.getElementById("d1").value);
    var depth2 = document.getElementById("d2").value;
    if (depth2 != null || depth2 != 0) {
        depth2 = parseInt(depth2) / 100;
    }
    else {
        depth2 = 0;
    }
    var depth = depth1 + depth2;

    //g decoration
    g.setAttribute("id", "bg_group");
    g2.style.overflow = "visible";

    //text decoration
    svgText.setAttribute("fill", "" + color + "");
    svgText.setAttribute("opacity", "" + opacity + "");
    svgText.setAttribute("x", "0");
    svgText.setAttribute("y", "0");
    svgText.setAttribute("id", "bg_text");
    svgText.textContent = svgTexttemp;
    if (fontFamily == "Fira Bold") {
        svgText.setAttribute("font-family", "Fira");
        svgText.setAttribute("font-weight", "bold");
    }
    else if (fontFamily == "Verdana Bold") {
        svgText.setAttribute("font-family", "Verdana");
        svgText.setAttribute("font-weight", "bold");
    }
    else if (fontFamily == "Arial Bold") {
        svgText.setAttribute("font-family", "Arial");
        svgText.setAttribute("font-weight", "bold");
    }
    else if (fontFamily == "Calibri Bold") {
        svgText.setAttribute("font-family", "Calibri");
        svgText.setAttribute("font-weight", "bold");
    }
    else {
        svgText.setAttribute("font-family", "" + fontFamily + "");
    }

    ////rect decoration
    rectNull.setAttribute("x", "0");
    rectNull.setAttribute("y", -depth);
    rectNull.setAttribute("width", width);
    rectNull.setAttribute("height", depth);
    rectNull.setAttribute("stroke", "black");
    rectNull.setAttribute("fill", "none");

    ////innerSvg decoration
    innerSvg.setAttribute("width", width);
    innerSvg.setAttribute("height", depth);
    innerSvg.setAttribute("x", "0");
    innerSvg.setAttribute("y", "0");
    innerSvg.setAttribute("id", "svg");
    innerSvg.setAttribute("preserveAspectRatio", "xMinYMin meet");
    innerSvg.appendChild(svgText);
    g.appendChild(innerSvg);
    svg.appendChild(g);
    var box = svgText.getBBox();
    var viewBox = [box.x, box.y, box.width, box.height].join(" ");
    innerSvg.setAttribute("viewBox", viewBox);
}

        Text Value:

        <input type="text" id="bg_svgtext" placeholder="Enter your text value" value="Floor Plan" style="font-size:14px;height:16px; width:220px;margin-top:7px;font-family:Helvetica" />

                Width:
                <input id="w1" type="text" name="width" value="100" style="width:30px;height:16px;" />m
                <input id="w2" type="text" name="width" value="0" style="width:30px;height:16px;" />cm

                Depth:
                <input id="d1" type="text" name="Depth" value="100" style="width:30px;height:16px;" />m
                <input id="d2" type="text" name="Depth" value="0" style="width:30px;height:16px;" />cm

        Font Settings

                Font

                    <select id="family" style="color:black; width:100px; height:23px; font-size:11px;padding: 2px 26px 2px 10px !important;background-position: calc(114% - 22px) calc(1em + 0px), calc(114% - 17px) calc(1em + 0px), 120% 0;" class="form-control classic ddldesign">
                        <option style="font-size:12px;" value="Fira">Fira</option>
                        <option style="font-size:12px;" value="Fira Bold">Fira Bold</option>
                        <option style="font-size:12px;" value="Verdana">Verdana</option>
                        <option style="font-size:12px;" value="Verdana Bold">Verdana Bold</option>
                        <option style="font-size:12px;" value="Calibri">Calibri</option>
                        <option style="font-size:12px;" value="Calibri Bold">Calibri Bold</option>
                        <option style="font-size:12px;" value="Arial">Arial</option>
                        <option style="font-size:12px;" value="Arial Bold">Arial Bold</option>
                    </select>

                Color
                <input type="color" style="width:20px;" name="color" value="#046FAA" id="clr" />

                Alpha

                    <input type="range" oninput="opacityValue()" min="0" max="100" value="100" style="width:50px;float:left;" id="myRange">
                    (1)

Click For Add To The Floor

<button class="btn" style="height:26px; padding: 5px 20px" onclick="txtOnFloor()">Add</button>

    <svg id="svgcontent">
        <g></g>
        <g></g>
    </svg>

i can add the content in the canvas but i cant drag and drop further. i used inner svg and set the viewbox of that svg from BBox of text element


text:
Q: Prove through induction that $3^n > n^3$ for $n \geq 4$ I'm new to induction and have not done induction with inequalities before, so I get stuck at proving after the 3rd step.
The question is:

Use induction to show that $3^n > n^3$ for $n \geq 4$.

I have so far:
Step 1:
Prove for $n=4$ (since question states this)
$3^4 > 4^3$
$81 > 64  $
which is true
Step 2:
Assume true for $n=k$

$3^k > k^3$

Step 3:
Prove for $n = k+1$

$3^{k+1} > (k+1)^3$

Here I expand to:

$3^k \cdot 3 > k^3 + 3k^2 + 3k + 1$

However I have no idea how to prove this.
Thanks for any help given

A: $3^{k+1}>3k^3$
We need $3^{k+1}>(k+1)^3 $
So, it sufficient to prove $3k^3>(k+1)^3\iff \left(1+\frac1k\right)^3<3$
For $k=3,\left(1+\frac1k\right)^3=\frac{64}{27}<3$
and $\left(1+\frac1{k+1}\right)^3<\left(1+\frac1k\right)^3$
$\implies \left(1+\frac1k\right)^3<3$ for $k\ge3$

A: HINT: One approach is to compare ratios: on the left you've gone from $3^k$ to $3^{k+1}$, so you've multiplied by $3$, while on the right you've multiplied by
$$\frac{(k+1)^3}{k^3}=\left(\frac{k+1}k\right)^3=\left(1+\frac1k\right)^3=1+\frac3k+\frac3{k^2}+\frac1{k^3}\;.$$
How does this compare with $3$ when $k\ge 4$?
Added: Suppose that $a_n$ and $b_n$ are two quantities that depend on $n$, and you want to show by induction that $a_n>b_n$ for all $n\ge n_0$. You get your induction started by checking that $a_{n_0}>b_{n_0}$. For the induction step there are two very natural things to try.

*

*Compare $a_{k+1}-a_k$ with $b_{k+1}-b_k$: if $a_k>b_k$ and $a_{k+1}-a_k\ge b_{k+1}-b_k$, then clearly $a_{k+1}>b_{k+1}$. You can check this by mechanical algebraic manipulation, but it should also be intuitively clear: you've added at least as much on the lefthand side as on the righthand side, and the lefthand side was already larger than the righthand side, so it remains larger.

*Compare $\dfrac{a_{k+1}}{a_k}$ with $\dfrac{b_{k+1}}{b_k}$ and apply similar reasoning.
In both cases you're comparing the growth rates of the two sides, in the first case additively and in the second case multiplicatively. Which of the two is more likely to succeed depends on the expressions involved; here the exponential suggests looking at the multiplicative version.

A: $3^n > n^3$ for $n\geq 4$
Base case:
If $n=4$, we get
$\text{LHS}=3^4=81$
$\text{RHS}=4^3=64$.
We can see that $\text{LHS} > \text{RHS}$.
Let us assume the above hypothesis holds true for some $n=k$ such that $k\geq 4$.
Therefore,
$$3^k > k^3$$
$$3(3^k) > 3k^3$$
$$3^{k+1} > k^3 + k^3 + k^3 > k^3 + 3k^2 + 3k^2 > k^3 + 3k^2 + k^2 + k^2 + k^2  > k^3 + 3k^2 + 3k + 3k + 3k > k^3 + 3k^2 + 3k + 1 = (k+1)^3.$$


text:
Q: Xamarin.Forms (VS): Properties from XAML shown as missing. Builds successful Just about a few hours ago I got here:

InitializeComponent(); and label_link both are properties that either come from XAML behind or init this.
Intellisense shows them as non existing.
Builds however are successful. This issue just appeared out of the blue.
I tried:
Restarting VS
Restarting MAC
cleared BIN and OBJ folder
Cleaned and rebuilded
Unloaded and reloaded everything
deleted .VS (hidden folder)
Other solutions are working fine, it is only this specific problem.
However, this exists in every class of my project now.
Since this is VS for MAC there is no way to reinstall this.
Can anyone help me out here?

A: So after trying out everything over and over again,
i retraced my steps to what I did prior which was installing
mobile.buildtools and try and set up the sercrets.json file. I removed both cleaned and resetted everything again and finally intellisense was working again and there are no more red lines underneath my code.


text:
Q: Backbone.js save error I am scratching my head over an issue with backbone...
I have a backbone view, with an event which calls a function that saves the current model.
Its a simple form, in the view I do some validation before syncing the model.
this.model.save({
    completed : completed,
    company : company,
    revenue : revenue,
    term : term,
    comments : comments,
    probability : probability
  },
  {
    success: function (model, response) {
    console.log('success', model, response);
    Evision.trackRouter.navigate("tracker/", {trigger: true});
    },
    error: function (model, response) {
      console.log('error', model, response);
    }
  }
;

After success is fired it returns me back to my collection of models, where I can select another model to edit, its at this point when i attempt to save that i receive  in my console and Chrome crashes.
If i expand this error it is indicating a problem with the function running the above, and my model is logged out in the console but when i try to expand it its empty?
Its worth saying that neither success or error is being fired ont he 2nd route round.
Thanks
Edit #1
Here is the error i receive before the crash
    <error>
    w.extend
    w.clone
    e.extend.toJSON
    _.extend.save
    _.extend.update
    LocalStorage.sync
    Backbone.sync
    e.extend.sync
    e.extend.save
    Evision.Views.TrackerDetail.Backbone.View.extend.saveTracker
    (anonymous function)
    j

Edit #2 Here is my model
Evision.Models.Track = Backbone.Model.extend({

  defaults: function() {
    return {
      id : Evision.trackerList.nextOrder(),
      completed : false,
      created : Utils.datestamp(),
      company : "",
      revenue : "",
      term : "",
      comments : "",
      probability : "",
      success : null
    }
  }

});

A: I know exactly the problem. I had this issue not so long back. First thing I looked at was the stack trace and just like in the comments above I was getting an extend problem with underscore. What you need to do is update backbone.js, underscore.js and backbone-localstorage.js(if you have it) to the most recent versions. The problem lies with versioning!

A: Turns out the issue was related to a modified version of Jerome's Backbone.localStorage, which would allow for both remote and local storage within the app. I replaced with the latest localStorage adapter and everything is working fine. Unfortunately I cant find the original source to notify.


text:
Q: Nested boxes around cells in a table I would like to nest two boxes in my table. It looks like this:
 content      content      content      content      content
            +----------------------+
 content    | content      content |    content      content
            |+--------------------+|
 content    ||content      content||    content      content
            |+--------------------+|
 content    | content      content |    content      content
            +----------------------+
 content      content      content      content      content

I looked at Framing cells in a table which provides a good solution, but the main issue is that I can't set the length of the horizontal line in the inner box. \cline{2-3} always produces the same width. It would produce something that looks like this:
 content      content      content      content      content
            +----------------------+
 content    | content      content |    content      content
            ++--------------------++
 content    ||content      content||    content      content
            ++--------------------++
 content    | content      content |    content      content
            +----------------------+
 content      content      content      content      content

But I would like to avoid the inner box from intersecting with / joining the outer box.

A: For exercises and starting point:

\documentclass[border=3mm,
               tikz,
               preview
               ]{standalone}
\usetikzlibrary{fit,
                matrix,
                }

\begin{document}
\begin{tikzpicture}[
every node/.style = {inner sep=0.5mm}
                    ]
\matrix (magic) [matrix of nodes,
                 column sep=1.5mm,
                 row sep=1.5mm]
{
content & content & content & content & content \\
content & content & content & content & content \\
content & content & content & content & content \\
content & content & content & content & content \\
content & content & content & content & content \\
};
\node (a) [draw, fit=(magic-3-2) (magic-3-3)] {};
\node (b) [draw, fit=(magic-2-2) (a) (magic-4-3)] {};
\end{tikzpicture}
    \end{document}

How to do this in your table? First you need to provide complete document with your table, that I can see, what can be done. Above image only replicate your image in question :-)


text:
Q: Google Chart is not rendering in PDF created by wkhtmltopdf The google chart images were perfectly coming in PDF till few months back.
But now images are not coming.
If I try the html, google chart is coming correctly.
If I try to convert that HTML into PDF using wkhtmltopdf, chart not showing.
I am using wkhtmltopdf from command line.

<!DOCTYPE html>

<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>GRAPH</title>

GRAPH


text:
Q: How is this RS485 Module Working? I am planning to use this UART-to-RS485 module :-
http://www.elecrow.com/uart-ttl-to-rs485-twoway-converter-p-1545.html.
This module is bidirectional and uses a single pair of differential signal to transmit/receive data. My question is how is the chip deciding whether it has to transmit data from TXD to A+ B- or from A+ B- to RXD?. Shouldn't there be 2 pair of differential signals, one pair for TX and the other pair for RX? What is happening in this module??

A: I reverse engineered the exact board pictured in the asker's post. The resistor and capacitor values are not what are there on the board - I selected them for my own circuit. However the schematics is almost accurate - "almost" because I have added a 120 ohms impedance matching resistor and capacitors on the A+, B- lines.

A: More than likely it switches into transmit mode when TXD becomes active and a diode and capacitor "latch" that first transmit edge and hold that voltage "active" for longer than at least one byte.
I see a little surface mount diode on the PCB (D1) and quite possibly this is what I'm referring to. I have seen this trick done before and the only disadvantage is that when the TX session ends there might be a few milliseconds to wait before the RX direction is restored (due to the capacitor discharging).
I found this on the web as a partial circuit: -

When receiving, TX0 is active high thus forcing a low on DE (as expected). When TX0 goes low it rapidly discharges C0 and sets up the direction port for transmitting. When transmitting and TX data changes state, C0 remains largely discharged although ultimately R3 will slowly (relatively speaking) re-charge it but not until some time after the last transmit byte has been sent. Values shown i.e. 22k and 1000pF are dependent on baud rate.

A: Working with DineshT's circuit as a starting point, I had an EE friend of mine work from that circuit as well as a sample of one of these boards. Our boards were purchased from Drok, who is a reseller on Amazon. The primary reason for reverse engineering the boards was to ensure they were RoHS compliant. If that is not important, the Drok boards work perfectly fine. The Drok boards had atypical spacing between the pins, which for compatibility, we kept. As noted elsewhere, ground on the right side is not connect to EARTH on the right side. There is an LDO voltage regulator that allows one of these to work with 5V and 3.3V Arduino and other boards. The RS-485 chip we used is nicely speced.


text:
Q: How to get a specific key which stored in redis by flask-caching In my flask app, I used flask-caching to cache the query result as below:
@cache.memoize()
def load_user(user_id):
    return User.query.get(user_id)

But when I access my redis, the key is like flask_cache_L4kZRWHNrZYUZ8uyY7Mh0i.
It's seem very hard to query the redis database to test. Because if I need the value of that key, I must be use the function cache.get(<key>) that in Flask-Caching API
So I want to ask wherether it has a way to find the key of return value of a function under decorator cache.memoize?


text:
Q: Crystal- Reports: Exclude a field value from running total In crystal reports is how can one exclude a field value from running total. This field is not suppressed however we donot want to add its value to the sum total.

A: I would suggest you to create one more column for the calculation purpose and then place after the last column and write below formula:
if column="NonDelivery"
then value
else 0

Now take the sum of this column and then place the sum below your mail value column and supress the newly created column.


text:
Q: Update PHP version 5.3 to 7.2 or first WP 4.7.11 to 4.9.8? I am not sure if I am better of by upgrading WP to 4.9.8 when my PHP version is still on 5.3 or do the other way?

A: You should update both. ASAP.
PHP 5.3 us not supported for over 3 years... So it may have security vulnerabilities...
AFAIR there are no known vulnerabilities in WP 4.7.11, but... It's an old version too...
WP 4.7.11 should work fine on PHP 7.2 and WP 4.9.8 should also work on PHP 5.3 (but at least 5.6 is recommended).
So I would go with updating PHP first and then WP.


text:
Q: How to make subarray inside main array I have one array something like this
Array
(
 [0] => Array
    (
        [employee_id] => 2
        [project_name] => WeeFavR
        [project_planned_hour] => 500
        [module_name] => Design
        [project_module_time] => 150
        [allocated_time] => 50
    )

[1] => Array
    (
        [employee_id] => 2
        [project_name] => WeeFavR
        [project_planned_hour] => 500
        [module_name] => Coding
        [project_module_time] => 250
        [allocated_time] => 200
    )

[2] => Array
    (
        [employee_id] => 2
        [project_name] => WeeFavR
        [project_planned_hour] => 500
        [module_name] => Testing
        [project_module_time] => 100
        [allocated_time] => 50
    )

[3] => Array
    (
        [employee_id] => 2
        [project_name] => Online License
        [project_planned_hour] => 600
        [module_name] => Design
        [project_module_time] => 200
        [allocated_time] => 100
    )

[4] => Array
    (
        [employee_id] => 2
        [project_name] => Online License
        [project_planned_hour] => 600
        [module_name] => Coding
        [project_module_time] => 200
        [allocated_time] => 100
    )

[5] => Array
    (
        [employee_id] => 2
        [project_name] => Online License
        [project_planned_hour] => 600
        [module_name] => Testing
        [project_module_time] => 200
        [allocated_time] => 100
    )
)

And i want result something like this
Array
(
[0] => Array
    (
        [employee_id] => 2
        [project_name] => WeeFavR
        [project_planned_hour] => 500
        Array
        (
            [0] => Array
                (
                    [module_name] => Design
                    [project_module_time] => 150
                    [allocated_time] => 50
                )
             [1] => Array
                (
                    [module_name] => Coding
                    [project_module_time] => 250
                    [allocated_time] => 200
                )
             [2] => Array
                (
                    [module_name] => Testing
                    [project_module_time] => 100
                    [allocated_time] => 50
                )
        )
    )

[1] => Array
    (
        [employee_id] => 2
        [project_name] => Online License
        [project_planned_hour] => 600
        Array
        (
            [0] => Array
                (
                    [module_name] => Design
                    [project_module_time] => 200
                    [allocated_time] => 100
                )
             [1] => Array
                (
                    [module_name] => Coding
                    [project_module_time] => 200
                    [allocated_time] => 100
                )
             [2] => Array
                (
                    [module_name] => Testing
                    [project_module_time] => 200
                    [allocated_time] => 100
                )
        )
    )
)

I don't know how to make this type of array , so please help me to solve this problem.
Your help would be appreciated.

A: Looks like what you want to do is actually run through your array and group it according to project.
This is easy enough if you set up an associated array that lets you lookup your projects.
$grouped_data   = array();
foreach ($data as $item) {
    //we'll used the project name as the key
    $key        = $item['project_name'];
    if (empty($grouped_data[$key])) {
        //this project isn't created yet, create it
        $grouped_data[$key]         = $item;
        $grouped_data[$key]['modules']  = array(); //create the module sub array to store things
    }
    $grouped_data[$key]['modules'][]        = $item; //store your module for this project
}

Of course you'll need to do some work of your own to clean up what you store in the sub array. Currently it stores everything so some keys are duplicated. But this should get you started without a problem.

A: Just like you could save a variable inside an array, you also can save an array inside an array:
$someArray = array(
    'Value 1',
    array(
        array(
            'Some more value,
            'more'
        ),
        array(
            'Some more value,
            'more'
        )
    )
);

A: What you can do is something like this:
    $arr_project = array ();
    $arr_example_tmp =  array ("module_name" => "Design",
                        "project_module_time" => 200,
                        "allocated_time" => 100);

    $arr_project["project_planned_hour"][] = $arr_example_tmp;

    $arr_example_tmp =  array ("module_name" => "Coding",
                        "project_module_time" => 200,
                        "allocated_time" => 100);

   $arr_project["project_planned_hour"][] = $arr_example_tmp;

A: Make sure you will have some index for your modules
$myArray = Array();

$myArray[0] = Array(
    "employee_id" => 2,
    "project_name" => "WeeFavR",
    "project_planned_hour" => 500,
    "modules" => Array(
        Array(
            "module_name" => "Design",
            "project_module_time" => 150,
            "allocated_time" => 50
        ),
    ),
);

A: $out = array();
foreach ($arr as $key => $value){
    $dex = $value['employee_id'].' - '.$value['project_name'];
    if ( ! isset($out[$dex])){
        $out[$dex] = array_slice($value, 0, 3);
    }
    $out[$dex]['details'][] = array_slice($value, 3);
}
$out = array_values($out);
print_r($out);


text:
Q: How to print the random answer from the given answer in python I want to get different result every time(or most of the time) by using or(|) condition in python, however nothing worked for me.
(1). if given_input == 'b':
    print(" You Pressed b " or " B is pressed")

(2). if given_input == 'b':
    print(" You Pressed b ")  or print(" B is pressed")

(3). if given_input == 'b':
    print(" You Pressed b " | " B is pressed")

(4). if given_input == 'b':
    print(" You Pressed b ")  | print(" B is pressed")

A: Neither or nor | (binary or) can't do what you want to do.
You need to import random and then use random.choice(["You pressed b", "B is pressed"])


text:
Q: Error Code: 1054. Unknown Column 'credits' in 'field list' I'm getting this error when I try to run this INSERT INTO query:
INSERT INTO Rush (firstName, lastName, schoolYearID, credits, gpa, age, phone, email, statusID, legacy, password)
    VALUES ('Greg','Johnson', 1, 22, 2.4, 18, '1235368965', 'gjohnson@umd.edu', 1, 'NR', 'gjohns');

I'm don't exactly understand why I'm getting this error because this INSERT INTO query has been run successfully in the past. I've been making some changes to the other tables in my database, however I don't think that should be an issue because the credits column is not an foreign key. This database is on Amazon AWS and is running MySQL 5.6.13. Can anyone spot my error? The schema is as follows:
CREATE TABLE Rush (
    rushID INT AUTO_INCREMENT NOT NULL,
    firstName VARCHAR (25) NOT NULL,
    lastName VARCHAR (25) NOT NULL,
    schoolYearID INT NOT NULL,
    hometown VARCHAR (25),
    homestate VARCHAR (25),
    highschool VARCHAR (50),
    credits INT UNSIGNED NOT NULL,
    gpa DECIMAL (4,3) UNSIGNED NOT NULL,
    major VARCHAR (25),
    biography VARCHAR (500),
    onlinepf VARCHAR (100),
    profilePictureURL VARCHAR (200), -- User uploads profile picture to another site, the url will be used in an img tag
    age INT NOT NULL,
    phone VARCHAR(10) NOT NULL,
    email VARCHAR (50) NOT NULL,
    statusID INT NOT NULL,
    legacy VARCHAR(6) DEFAULT 'NR',
    legacyInfo VARCHAR (50),
    password VARCHAR (50) NOT NULL,
    PRIMARY KEY (rushID),
    CONSTRAINT fk_Rush_schoolYearID
        FOREIGN KEY (schoolYearID)
        REFERENCES School_Year (schoolYearID)
        ON UPDATE CASCADE ON DELETE RESTRICT,
    CONSTRAINT fk_Rush_statusID
        FOREIGN KEY (statusID)
        REFERENCES Rush_Status (statusID)
        ON UPDATE CASCADE ON DELETE RESTRICT
);

DELIMITER $$
  CREATE TRIGGER Rush_Insert BEFORE INSERT ON Rush FOR EACH ROW
    BEGIN
     IF (NEW.firstName = '') THEN SET NEW.firstName = null; END IF;
     IF (NEW.lastName = '') THEN SET NEW.lastName = null; END IF;
     IF (NEW.phone = '') THEN SET NEW.phone = null; END IF;
     IF (CHAR_LENGTH(NEW.phone) != 10 OR NEW.phone NOT REGEXP '[0-9]') THEN SET NEW.phone = null; END IF;
     IF (NEW.email = '') THEN SET NEW.email = null; END IF;
     IF (NEW.gpa = '') THEN SET NEW.gpa = null; END IF;
     IF (NEW.password = '') THEN SET NEW.password = null; END IF;
     IF (NEW.credits = '') THEN SET NEW.credits = null; END IF;
     IF (NEW.gpa < 2.5 AND credits < 12) THEN SET NEW.statusID = 0;
        ELSE SET NEW.statusID = 1; END IF;
    END$$
DELIMITER ;

DELIMITER $$
  CREATE TRIGGER Rush_Update BEFORE UPDATE ON Rush FOR EACH ROW
    BEGIN
     IF (NEW.firstName = '') THEN SET NEW.firstName = null; END IF;
     IF (NEW.lastName = '') THEN SET NEW.lastName = null; END IF;
     IF (NEW.phone = '') THEN SET NEW.phone = null; END IF;
     IF (NEW.email = '') THEN SET NEW.email = null; END IF;
     IF (NEW.gpa = '') THEN SET NEW.gpa = null; END IF;
     IF (NEW.password = '') THEN SET NEW.password = null; END IF;
     IF (NEW.credits = '') THEN SET NEW.credits = null; END IF;
     IF (OLD.statusID = 0 AND NEW.gpa >= 2.5 AND credits >= 12) THEN SET NEW.statusID = 1; END IF;
     IF (NEW.gpa < 2.5 AND NEW.credits < 12 AND statusID < 2) THEN SET NEW.statusID = 0; END IF;
     IF (NEW.gpa > 4) THEN SET NEW.gpa = null; END IF;
    END$$
DELIMITER ;

A: I guess its in the trigger which is throwing the error
IF (NEW.gpa < 2.5 AND credits < 12) THEN SET NEW.statusID = 0;

should be
IF (NEW.gpa < 2.5 AND NEW.credits < 12) THEN SET NEW.statusID = 0;


text:
Q: cannot log in to all account except guest after mounting new partition In order to do my homework from school, since two days ago, I installed Oracle 11g on my computer running Ubuntu.
While I was installing Oracle 11g, after setting the password for oracle and clicking "next", the installer said that there was not enough space for the home/oracle folder,
so to make another space, I mounted another space after checking GParted
and using Software device management, I mounted it.
Since then, I have not been able to log in to my own administrator account or to the oracle account (which I made for Oracle 11g on Ubuntu): when I type the password for it, it seems to work but it then redisplays the first page to log in, without really logging in.
So I logged in to the guest account, but I cannot even try gnome console manipulation to restore or fix it, because it is the guest account.
Firstly, is there any way I can fix things; Secondly, when oracle said it didn't have enough space for its home folder, what should I have done?

A: This may help:
Use Ctrl-Alt-F2
Log in using your admin account.
Use usermod -d NEW_HOME to specify your home directory if it's moved.
I did funny things to my setup and moved my home partition/user, i also needed to chown and chgrp to my home directory to assign it back to my 'new' user
Using the Ctrl-Alt-F2 will hopefully give you enough control over your system to fix it.


text:
Q: Should I set up a protocol for Objective C array objects to avoid a compiler warning? I have a class, let's call it ABC, with an NSArray *objects property, and the objects in the NSArray can be one of two different classes, X and Y.  Both X and Y have a path property, but the compiler doesn't know this.
Therefore, even though ABC will always find the path property on my array objects, I get compiler warnings on my code -- "No 'path' method found".  App runs fine but I'm getting annoyed by the warnings.  How can I fix my code (with protocols?) so that the compiler stops complaining?
Thank you!

A: Do both X and Y derive from the same super class that contains "path"? If "path" is conceptually the same value AND X and Y are related by this value, then it should either be in a super class or protocol.
Additionally you can use NSKeyValueCoding protocol to directly access values by string via - (id)valueForKey:(NSString *)key. You do lose any type safety using this method, however.

A: You need to import some header that declares a path method. When it's compiling your code, the compiler looks at the list of methods this file knows about and it sees that there is no path method. You just need to tell it that the method exists and its signature is whatever and the compiler will be satisfied. No protocol is necessary.

A: valueForKey:@"path"


text:
Q: MySQL Check for 3 or more consecutive (specific) entries I have a following table:
+------------+-----------------------------------------------------------------------------------+
| Field      | Type                                                                              |
+------------+-----------------------------------------------------------------------------------+
| id         | int(10) unsigned                                                                  |
| type       | enum('REGISTER','ACTIVATE','LOGIN_SUCCESS','LOGIN_FAIL','LOGOUT','LOCK','UNLOCK') |
| user_id    | int(10) unsigned                                                                  |
| mod_id     | int(10) unsigned                                                                  |
| date       | timestamp                                                                         |
| ip         | int(10) unsigned                                                                  |
| user_agent | text                                                                              |
+------------+-----------------------------------------------------------------------------------+

I am trying to determine, in the simplest possible way (preferably just using MySQL), if there are 3 or more consecutive records with type = LOGIN_FAIL since the last type = LOGIN_SUCCESS or since start of the table.
For example
+----+---------------+---------+--------+---------------------+----+------------+
| id | type          | user_id | mod_id | date                | ip | user_agent |
+----+---------------+---------+--------+---------------------+----+------------+
|  6 | LOGIN_SUCCESS |       3 |   NULL | 2012-07-21 14:08:32 |  0 | agent      |
|  7 | LOGIN_FAIL    |       3 |   NULL | 2012-07-21 14:08:32 |  0 | agent      |
|  8 | LOGIN_FAIL    |       3 |   NULL | 2012-07-21 14:08:32 |  0 | agent      |
|  9 | LOGIN_FAIL    |       3 |   NULL | 2012-07-21 14:08:32 |  0 | agent      |
+----+---------------+---------+--------+---------------------+----+------------+

would return TRUE while
+----+---------------+---------+--------+---------------------+----+------------+
| id | type          | user_id | mod_id | date                | ip | user_agent |
+----+---------------+---------+--------+---------------------+----+------------+
|  6 | LOGIN_FAIL    |       3 |   NULL | 2012-07-21 14:08:32 |  0 | agent      |
|  7 | LOGIN_FAIL    |       3 |   NULL | 2012-07-21 14:08:32 |  0 | agent      |
|  8 | LOGIN_SUCCESS |       3 |   NULL | 2012-07-21 14:08:32 |  0 | agent      |
|  9 | LOGIN_FAIL    |       3 |   NULL | 2012-07-21 14:08:32 |  0 | agent      |
+----+---------------+---------+--------+---------------------+----+------------+

would return FALSE. Is it possible to do this with a simple query or do I need to implement this check in some script language?
EDIT: I forgot to mention that this query would have to be limited to a certain user_id but I assume this wouldn't be a problem.
Otherwise, or even better, would it be possible to count how much records fit this criteria (i.e. how many consecutive type = LOGIN_FAILED records exist since last type=LOGIN_SUCCESS)

A: SELECT COUNT(*) FROM `table`
WHERE
    id >
        (IFNULL(
            (SELECT id
            FROM `table`
            WHERE `type`='LOGIN_SUCCESS'
            ORDER BY id DESC
            LIMIT 1),0
        )
    AND `type`='LOGIN_FAIL'

Will get the amount of fails since last success.

A: Hope this will help you
SELECT IF(COUNT(a.id)>=3, TRUE, FALSE) AS fresult FROM last_login AS a,
(
        SELECT COUNT( b.id ) AS cnt, MAX( b.id ) AS maxid FROM last_login AS b
        WHERE b.login_type =  'LOGIN_SUCCESS'
) AS c

WHERE a.id>c.maxid OR c.cnt=0
GROUP BY a.login_type


text:
Q: Elasticsearch analyzer config I want to set a global analyzer for any index in Elasticsearch.
These lines are added into elasticsearch.yaml:
index.analysis.analyzer.ik.type: ik
index.analysis.analyzer.default.type: ik
index.analysis.analyzer.standard.type: ik

After restarting Elasticsearch, these lines are shown in http://localhost:9200/_nodes/settings
index: {
  analysis: {
    analyzer: {
      standard: {
        type: "ik"
      },
      default: {
        type: "ik"
      },
      ik: {
        type: "ik"
      }
    }
  }
}

Then I tested with url http://localhost:9200/_analyze?text=时间&analyzer=ik
{
  tokens: [
    {
       token: "时间",
       start_offset: 0,
       end_offset: 2,
       type: "CN_WORD",
       position: 0
    }
  ]
}

It shows the IKAnalyzer is enabled. However, when it comes to http://localhost:9200/_analyze?text=时间&analyzer=standard or http://localhost:9200/_analyze?text=时间, the "standard" analyzer results are returned:
{
  tokens: [
    {
       token: "时",
       start_offset: 0,
       end_offset: 1,
       type: "<IDEOGRAPHIC>",
       position: 0
    },
    {
       token: "间",
       start_offset: 1,
       end_offset: 2,
       type: "<IDEOGRAPHIC>",
       position: 1
    }
  ]
}

So, what should I do?

A: Default analyzer settings affects real indexed documents, not "test" requests you do with http://localhost:9200/_analyze. Try to add few docs to an index and then see if the search works as you expect


text:
Q: Asterisk choose from menu while playing IVR I am trying to make an IVR menu in asterisk. My question is how can I make asterisk to be able to choose from IVR menu while playing the choices. And if I made a choose stop playing the menu and jump to next action?
Right now I have to listen the whole wav file and when it is done than I can make a choice.
My config looks like this:
[egy_mainmenu]
exten => s,1,Wait(1)
exten => s,n,NoOp(${CALLERID(all)})
exten => s,n,Set(CHANNEL(language)=hu)
exten => s,n,Answer
exten => s,n,Set(row="${REALTIME(isopen,name,q-egy)}")
exten => s,n,Set(row=${CUT(row,",",2)});
exten => s,n,Set(row=${CUT(row,"=",2)});
exten => s,n,GotoIf($["${row}" = "1"]?s,openhours)
exten => s,n,Macro(closed,"q-egy")
exten => s,n,Playback(egy-open)
exten => s,n,Wait(2)
exten => s,n,Hangup

exten => s,n(openhours),Wait(1)
exten => s,n(skip),Set(FILENAME=${STRFTIME(${EPOCH},,%Y%m%d)}-${UNIQUEID})
exten => s,n,Set(MONITOR_FILENAME=/var/spool/asterisk/monitor/${FILENAME})
exten => s,n,Set(MONITOR_EXEC=/usr/local/bin/asterisk_wav2ogg ${FILENAME}.wav)
exten => s,n,Set(AUDIOHOOK_INHERIT(MixMonitor)=yes)
exten => s,n,Set(CALLERID(name)=Egy)
exten => s,n,Background(egy_welcome,m)
exten => s,n,WaitExten(5)
exten => _[12345],1,Goto(egy_mainmenu_${EXTEN},s,1)

[egy_mainmenu_1]
exten => s,1,NoOp(${QUEUESTATUS})
exten => s,n,Set(CALLERID(name)=KGFB)
exten => s,n,Queue(q-egy,hRt,,,3600)
exten => s,n,GotoIf($["${QUEUESTATUS}" = "TIMEOUT"]?timeout)
exten => s,n,GotoIf($["${QUEUESTATUS}" = "FULL"]?full)
exten => s,n,GotoIf($["${QUEUESTATUS}" = "JOINEMPTY"]?joinempty)
exten => s,n,GotoIf($["${QUEUESTATUS}" = "LEAVEEMPTY"]?leaveempty)
exten => s,n,Goto(hup)

A: @Chris was right, it works with this method (I had to remove the m parameter in this line: exten => s,n,Background(egy_welcome,m)):
exten => s,1,Background(bizt_welcome2)
exten => s,n,WaitExten(55) ; this is priority 2
; you have hangup here, no next priority=3 for s extension

exten => _[12345],1,Goto(egy_mainmenu_${EXTEN},s,1)

[egy_mainmenu_1]
exten => s,1,NoOp(${QUEUESTATUS})
exten => s,n,Set(CALLERID(name)=KGFB)
exten => s,n,Queue(q-egy,hRt,,,3600)
exten => s,n,GotoIf($["${QUEUESTATUS}" = "TIMEOUT"]?timeout)
exten => s,n,GotoIf($["${QUEUESTATUS}" = "FULL"]?full)
exten => s,n,GotoIf($["${QUEUESTATUS}" = "JOINEMPTY"]?joinempty)
exten => s,n,GotoIf($["${QUEUESTATUS}" = "LEAVEEMPTY"]?leaveempty)
exten => s,n,Goto(hup)


text:
Q: JavaFX ComboBox Dropdown Layout I have a BorderPane that in its CENTER has a a grid pane with 2 combobox. On it's NORTH , it has a header pane. And in its SOUTH has a pane with navigation buttons. The problem here is that when I click the combobox, the dropdown menu covers the SOUTH pane as you see in the picture. Is there a way to bind dropdown with the CENTER pane, so that it cannot go over any of the SOUTH or NORTH panes.
Thanks in advance.

A: You can control the number of visible items in the open dropdown using the visibleRowCount property on the dropdown.

The maximum number of rows to be visible in the ComboBox popup when it
  is showing. By default this value is 10, but this can be changed to
  increase or decrease the height of the popup.

See JavaDoc.


text:
Q: Google Play Services update Yesterday API 19 came out so I upgraded SDK and other (including Google Play Services)
now this method:
private boolean isGooglePlayInstalled(){
    int status = GooglePlayServicesUtil.isGooglePlayServicesAvailable(this);
    if(status == ConnectionResult.SUCCESS){
        return true;
    }else{
        ((Dialog)GooglePlayServicesUtil.getErrorDialog(status, this,10)).show();
    }
    return false;
}

Throws at line int status = GooglePlayServicesUtil.isGooglePlayServicesAvailable(this);
Caused by: java.lang.IllegalStateException: The meta-data tag in your app's
AndroidManifest.xml does not have the right value.  Expected 4030500 but found 0.
You must have the following declaration within the <application> element:
<meta-data android:name="com.google.android.gms.version"
android:value="@integer/google_play_services_version" />

How to fix that? I didnt have element "com.google.android.gms.version" in manifest before and it worked.

This is my manifest:
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.sabatsoft.driveit"
    android:versionCode="1"
    android:versionName="1.0" >

    <uses-sdk
        android:minSdkVersion="16"
        android:targetSdkVersion="19" />

    <uses-permission android:name="android.permission.INTERNET" />
    <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
    <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
    <uses-permission android:name="android.permission.READ_PHONE_STATE" />
    <uses-permission android:name="android.permission.WAKE_LOCK" />
    <uses-permission android:name="android.permission.WRITE_SETTINGS" />
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
    <uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES" />

    <application
        android:allowBackup="true"
        android:icon="@drawable/ic_launcher"
        android:label="@string/app_name" >
        <activity
            android:name="com.sabatsoft.driveit.activity.Start"
            android:label="@string/app_name"
            android:screenOrientation="landscape"
            android:theme="@android:style/Theme.NoTitleBar" >
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>

        <!-- other activities -->

        <meta-data
            android:name="com.google.android.maps.v2.API_KEY"
            android:value="AIza*********************************1MZI" />
    </application>

    <uses-feature
        android:glEsVersion="0x00020000"
        android:required="true" />

</manifest>

A: This worked for me:
<meta-data
    android:name="com.google.android.gms.version"
    android:value="@integer/google_play_services_version" />

Place this at the end of your manifest, after your Map API key meta-data tag. Since you check for GPlayServices availability in your onCreate method, such as:
// Check status of Google Play Services
int status = GooglePlayServicesUtil.isGooglePlayServicesAvailable(this);

// Check Google Play Service Available
try {
    if (status != ConnectionResult.SUCCESS) {
        GooglePlayServicesUtil.getErrorDialog(status, this, RQS_GooglePlayServices).show();
    }
} catch (Exception e) {
    Log.e("Error: GooglePlayServiceUtil: ", "" + e);
}

...then once you click the dialog box to update GPlayServices, you will be brought to the GPlayStore. Usually, I uninstall from the GPlayStore menu, then the option to update will be available. It should work after that.

A: Package contents comparison
The "google_play_services_froyo" lib project contains these com.google.android.gms packages:

*

*appstate

*auth

*common

*dynamic

*games

*gcm

*internal

*location

*maps

*panorama

*plus

On the other hand, the new (rev. 13) "google_play_services" lib project has some additional packages within com.google.android.gms:

*

*ads

*appstate

*auth

*common

*dynamic

*games

*gcm

*internal

*location

*maps

*panorama

*plus

*wallet
Plus, this package is found in the new (rev. 13) "google_play_services": com.google.ads!
AndroidManifext.xml comparison
The old (rev. 12) "google_play_services" had:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.google.android.gms"
    android:versionCode="3265130"
    android:versionName="3.2.65 (834000-30)" >

    <uses-sdk android:minSdkVersion="8"/>

</manifest>

The newly introduced "google_play_services_froyo" lib project has:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.google.android.gms"
    android:versionCode="3225130"
    android:versionName="3.2.25 (761454-30)" >

    <uses-sdk android:minSdkVersion="8"/>

</manifest>

Conclusion
The "google_play_services_froyo" is functionally the same as the old (rev. 12) "google_play_services" lib project, so if you just want to keep your app compatible and don't care about the new APIs, just import the "google_play_services_froyo" in your project and you're good to go.
On the other hand, if you wanted to use the new (rev. 13) "google_play_services" lib project, once you import it, you have to add this to your apps manifest:
<application
...
  <meta-data
    android:name="com.google.android.gms.version"
    android:value="@integer/google_play_services_version" />
</application>

Hope this helped :)

A: That happened to me yesterday. I just needed to add this in the manifest:
<meta-data
    android:name="com.google.android.gms.version"
    android:value="@integer/google_play_services_version" />

A: I solved my issue of the same with
<meta-data
    android:name="com.google.android.gms.version"
    android:value="@integer/google_play_services_version" />

A: you have to add the following line in manifest file.
i hope it will work.
<meta-data
    android:name="com.google.android.gms.version"
    android:value="@integer/google_play_services_version" />

A: I faced this error because I referenced the original copy from SDK directory. Make sure that you first copy the library to android workspace and only reference it. In eclipse you can do it by checking "Copy projects into workspace" while importing the project.


text:
Q: Flex 3: "y" not having any effect on an image In one of my children, I have the following code:
<mx:Canvas id="projWrapper" x="{parentApplication.oneDay * startOffset}" width="{parentApplication.oneDay * numDays}" height="26" backgroundColor="{conflictBG}" borderColor="#000000" borderSides="bottom top left right" borderStyle="solid" borderThickness="1">
    <mx:HBox verticalGap="0">
        <mx:Image id="expandBlockLeft" source="images/addRed.png" y="5" />
        <mx:Text id="sNameShow" text="{sName}" />
    </mx:HBox>
</mx:Canvas>

the image, which is a small plus ("+") sign, is starting at coordinate 0, 0 of the canvas.  I need it to start at 0, 5... however, no matter what I change the y value to, the plus sign doesn't move.
I know this seems simple, and I'm sure it is, but I can't figure it out for the life of me.
If anybody can shed some light onto my little issue here, it'd be greatly appreciated.

A: Try to use:
<mx:Canvas id="projWrapper" x="{parentApplication.oneDay * startOffset}" width="{parentApplication.oneDay * numDays}" height="26" backgroundColor="{conflictBG}" borderColor="#000000" borderSides="bottom top left right" borderStyle="solid" borderThickness="1">
    <mx:HBox verticalGap="0" paddingTop="5">
        <mx:Image id="expandBlockLeft" source="images/addRed.png" />
        <mx:Text id="sNameShow" text="{sName}" />
    </mx:HBox>
</mx:Canvas>

The problem is HBox layout container doesn't support custom precise positioning with x and y and response for the positioning itself (by design). You can use gaps, paddings and align to have some custom adjustments or use container with absolute positioning like Canvas.


text:
Q: ld: 1 duplicate symbol for architecture x86_64 when attempting to compile with gfortran something has changed I presume in my environment such that the command I had been using to compile .f90, using gfortran, no longer works.
I use this command
gfortran -o spectrum -I/usr/local/include spectrum.f90 -L/usr/local/lib -lfftw3 spectrum.f90
where spectrum is my .f90 script.
But using it at the command line now gives me this message:
duplicate symbol _main in:
    /var/folders/j6/x389pn_11pvf4zbwyn3dz6rc4vmd16/T//ccoqQofo.o
    /var/folders/j6/x389pn_11pvf4zbwyn3dz6rc4vmd16/T//ccFaSoMl.o
ld: 1 duplicate symbol for architecture x86_64
collect2: error: ld returned 1 exit status

Where previously a working executable appeared.
What changed? I made some changes to the .f90, which I subsequently reversed. But I don't understand how the error can have arisen due to a change in the program - apart from anything else, when I attempt to use an older, backup version of the same program that was unmodified, I get the same error!
What's more, I am referred to different files containing this 'duplicate', when I delete the two pasted above.
But I cannot even access these files / locations:
/var/tmp//cc78ilM3.o
/var/tmp//ccPP60rG.o

A colleague mentioned using a utility such as omnidisk to clean up spurious files like this?
But, what has even caused these files to appear and result in this conflict as per the ld?


text:
Q: Nonlinear Klein Gordon equation For the Klein Gordon nonlinear equation,
$$ u_{tt}- \Delta u +f(u)=0,$$
how could I use Noether's theorem to prove that there is a conserved quantity? I.e.,
$$ (\Pi _{k} )_{t} - \rm div(j_{k})=0 $$
for  $k=0,1,2,3$, where
$$ \Pi _{k} = \int _{R^{3}}p(x,y,z,t)dv $$
is the density of four-momentum.

A: Define $F(u):= \int_0^u f(s) ds$, so the equations for the field $u(t,\vec{x})$ can be re-written as $$\frac{\partial^2 u}{\partial t^2}-\Delta_{\vec x} u + \frac{dF}{du}=0\::$$ If defining $${\cal L}:= \frac{1}{2}(-\partial_t u\partial_t u + \nabla u \cdot \nabla u) + F(u)\:.$$ this Lagrangian density leads to your field equations.
Moreover, as you can directly see, ${\cal L}$ is invariant under spatial translations, since it does not explicitly depend on $\vec{x}$. It is also invariant under temporal translations, because it does not explicitly depend on $t$. Therefore you can apply Noether's theorem obtaining four conserved quantities. They are the four integrated "charges" associated with the stress-energy tensor, i.e. the components of the total four-momentum.


text:
Q: How can I get the Cell Reference of a Named Range in Excel? I solved the issue, but I'm wondering if there's a better way to do this. What I have is a column of some named ranges ("NAME"), and I want a formula to the right that looks up the named range and gives me the cell reference ("C352").
I eventually solved it with this:
=CHAR(64+COLUMN(INDIRECT(C2, FALSE)))&ROW(INDIRECT(C2, FALSE))

The CHAR part is to translate the column number (3) to the letter (C), and it doesn't work past column Z.
This shouldn't be the best way to do it. I saw some VBA solutions, is that the only possible way to do this better?

A: If you can live with $ in the reference you could use:
=CELL("address",INDIRECT(C1))

or:
=SUBSTITUTE(CELL("address",INDIRECT(C1)),"$",)

to drop the $

A:
=ADDRESS(ROW(INDIRECT(C2, FALSE)), COLUMN(INDIRECT(C2, FALSE)), abs_num)

where abs_num is 1 to return an absolute address (e.g., "$C$352"), 4 to return a relative address (e.g., "C352"), or 2 for "C$352", or 3 for "$C352".  (abs_num defaults to 1 (i.e., absolute) if omitted.)

A: =ADDRESS(ROW(INDIRECT(C2)),COLUMN(INDIRECT(C2)),4,1)

How it works

*

*INDIRECT(C2) returns a reference address specified by C2.  The range refered to by the named range in this case.

*ROW( ... ) returns the row of the cell specified

*COLUMN( ... ) ditto for column

*ADDRESS( r, c, 4, 1) returns the address or row r, column c. 4 means relative (ie no $'s. 1 means A1 style. So  ADDRESS(ROW( ... ),COLUMN( ... ),4,1) will be the address of the named range in A1 notation


text:
Q: Flutter, floating action button margin of Scaffold I'm trying to build a custom implementation for flutter of the FloatingActionButton, something to replace the standard widget on the Scaffold.floatingActionButton attribute.
The problem is that there is a 16 bottom right margin whatever I try to render within that field, and the only workaround I found is to set that margin to zero in the Scaffold class in the flutter library.
Did anyone found a better solution?

A: This is a sample code for checking.

It set 100 margin and you can change as per your requirement.

floatingActionButton: FloatingActionButton(
          onPressed: () {
            // Add your onPressed code here!
          },
          child: const Icon(Icons.add_outlined),
          backgroundColor:Colors.blue,
          tooltip: "Raise Your Concern"),
bottomSheet: Padding(padding: EdgeInsets.only(bottom: 100.0)),

A: Try adding a Padding to the bottomSheet property in Scaffold
bottomSheet: Padding(padding: EdgeInsets.only(bottom: 0.0)),

A: You will provide in builder Material App Global Padding it looks like the code in below.
check this https://github.com/flutter/flutter/issues/14222#issuecomment-384165992
Also, provide code
   double getSmartBannerHeight(MediaQueryData mediaQuery) {
  // https://developers.google.com/admob/android/banner#smart_banners
  if (Platform.isAndroid) {
    if (mediaQuery.size.height > 720) return 90.0;
    if (mediaQuery.size.height > 400) return 50.0;
    return 32.0;
  }
  // https://developers.google.com/admob/ios/banner#smart_banners
  // Smart Banners on iPhones have a height of 50 points in portrait and 32 points in landscape.
  // On iPads, height is 90 points in both portrait and landscape.
  if (Platform.isIOS) {
    // TODO use https://pub.dartlang.org/packages/device_info to detect iPhone/iPad?
    // if (iPad) return 90.0;
    if (mediaQuery.orientation == Orientation.portrait) return 50.0;
    return 32.0;
  }
  // No idea, just return a common value.
  return 50.0;
}

@override
Widget build(BuildContext context) {
  return new MaterialApp(
    // ...
    builder: (BuildContext context, Widget widget) {
      final mediaQuery = MediaQuery.of(context);
      return new Padding(
        child: widget,
        padding: new EdgeInsets.only(bottom: getSmartBannerHeight(mediaQuery)),
      );
    },
  );
}

Thank you.

A: You can set floatingActionButtonLocation inside your Scaffold to
FloatingActionButtonLocation.centerDocked

This will replace margin from each side with 0 and align the FloatingActionButton at the screen center. Then just wrap your Floating widget with Align widget and set the alignment property to
Alignment.bottomRight

so that it renders at the right-bottom part of the screen. The margin will be zero. If you need to add margin, then you'll have to wrap your Floating widget with a Padding widget.
Note that only the FloatingActionButton should be wrapped with Align widget so that it does not create any problems with displaying a snackbar as they are connected in some way. (For example if you use ValueListenableBuilder above your custom FloatingActionButton or AnimatedOpacity/AnimatedSwitcher, etc. then you'll have to place Align widget beneath them, as a direct parent of the button)


text:
Q: SSAS 2012 How to use ParallelPeriod without Date Hierarchy? I found an example of how to use the Parallel Period function in my SSAS OLAP Cube here: https://www.mssqltips.com/sqlservertip/2915/sql-server-analysis-services-period-over-period-variance-analysis/
However it assumes that you have a Date Hierarchy, which I don't. I tried using it without success. My Date Dimension only has a date attribute and a Year Month attribute (ex: 2015/01 for January 2015). It has no hierarchy nor anything else.
(Interested why? Because it just works, and a hierarchy confused my users)
I need to compare values month over month and year over year.
This is what I could infer with the example, but it is not working:
IIF([Fact Date].[Date].CurrentMember.level.ordinal = 0,
    [Measures].[Billed Amount],
    (ParallelPeriod([Fact Date].[Year Month].[Year Month],
                    1,
                    [Fact Date].[Date].CurrentMember),
     [Measures].[Billed Amount]
    )
)

What would be the correct syntax to achieve this?

A: At the end I fixed it adding a Year attribute (ex: 2015), Month attribute (ex: 201501), and made a simple hierarchy (Year, Month, Date). It worked with the following code:
IIF([Fact Date].[Date Hierarchy].CurrentMember.level.ordinal = 0,
    [Measures].[Billed Amount],
    (ParallelPeriod([Fact Date].[Date Hierarchy].[Month],
                    1,
                    [Fact Date].[Date Hierarchy].CurrentMember),
     [Measures].[Billed Amount]
    )
)


text:
Q: Can not be able to redirect to 'password_change_done' views.py:
@login_required
@csrf_protect
def password_change(request,
    template_name='password_change_form.html',
    password_change_form=PasswordChangeForm,):

    if request.method == 'POST':
        form = password_change_form(user=request.user, data=request.POST)
        if form.is_valid():
            form.save()
            update_session_auth_hash(request, form.user)
            return HttpResponseRedirect(reverse('student:password_change_done'))
    else:
        form = password_change_form(user=request.user)
    context = {
        'form': PasswordChangeForm,
        'title': _('Password change'),
        'current_app': 'student',
    }
    return TemplateResponse(request, template_name, context)

@login_required
def password_change_done(request,
    template_name='password_change_done.html',):

    context = {
        'title': _('Password change successful'),
    }
    return TemplateResponse(request, template_name, context)

my urls.py:
from django.conf.urls import url, patterns
from django.contrib.auth import views as auth_views
from . import views

urlpatterns = [
    url(r'^register/$', views.register, name='register'),
    url(r'^login/$', views.user_login, name='login'),
    url(r'^logout/$', views.user_logout, name='logout'),
    url(r'^password_change/$', auth_views.password_change, {'template_name': 'password_change_form.html'}, name="password_change"),
    url(r'^password_change/done/$', auth_views.password_change_done, {'template_name': 'password_change_done.html'}, name="password_change_done"),
    url(r'^restricted/', views.restricted, name='restricted'),
    url(r'^mains/', views.mains, name = 'mains'),
]

My 'password_change' form is working fine but when I'm click submit button it redirects me to the following url:- 'http://127.0.0.1:8000/stu/password_change/None' inspite of 'http://127.0.0.1:8000/stu/password_change/done' as expected according to my views and urls.
Is I'm doing wrong somewhere?
Please help me to get into it?
Thanks! in advance

A: You are using login_required decorator in your password_change_done
That means your user must be authenticated to access that view.
After changing the password you are no longer authenticated. In you password_change view you must authenticate and login your user after changing the password.


text:
Q: microsoft edge new tab window resizing
I'm programming a responsive website and I like the resizing from the Microsoft Edge browser when it's on the "new tab" page. Like, first, the white bars left and right go away, but when the news blocks can't be on the page anymore, they go from 3 news blocks next to each other to 2 news blocks.  The second part I already have, I'm doing it with media queries (@media screen only and (min-width: 768px) { code goes here }
But the first part.... I want to add that to my site!
EDIT
The answer is the following: for the body, set a max-width: ; to whatever you like. If it still doesn't work, set a margin: 0 auto; on the body as well.

A: You set the width of the parent element of e.g. the blocks and margin to:
margin: 0 auto;


text:
Q: Move all content to new subfolder I have a shell script for linux that lives in the base-level folder testing and will go into the original directory, copy everything to the input folder, and then within each subdirectory in input perform three tasks:

*

*Create a new folder called tip

*Put all of the files within into tip

*Create a second new folder called sorted
When I tested it on the command line, the only issue I got was that since I created the tip folder before moving everything into it, it bounces back an error that it can't move a folder within itself--which is fine, whatever. But, when I run it in NiFi it gives me a different error (cannot create directory tip: file exists) and behaves differently.
Script
#!/bin/bash

# copy to input while maintaining file structure
cd /data/testing/original
cp -r * /data/testing/input
cd /data/testing/input

# for each subfolder in input, create tip & sorted, and move all of the original stuff into tip
for dir in /data/testing/input/*
do
  test -d "$dir" || continue
  cd "$dir" && mkdir tip && mv * tip/
  mkdir sorted
done

Expected Output in each subfolder in /data/testing/input/subfolder/
sorted -> empty
tip -> media folder, file1, file2

Actual Output
sorted -> empty
tip -> media folder, file1, file2
media folder
file1
file2

What am I doing wrong?

A: shopt -s extglob

# trailing slash forces the results to be dirs
# ..............................v
for dir in /data/testing/input/*/; do
  (
    cd "$dir" && mkdir tip sorted && mv -t tip/ !(tip|sorted)
    # ..........................................^^^^^^^^^^^^^
    #               anything *not* matching "tip" or "sorted"
  )
  # run above in a subshell so you don't have to cd back to parent dir
done


text:
Q: Pointer to another class as a property Why I receive an error when I try to create a property to another class through a pointer like that:
#ifndef SQUARE_H
#define SQUARE_H

#include <string>
//using namespace std;

    #include "Player.h"

class Square

{
public:

    Square(int);
    void process();

protected:

    int ID;
    Player* PlayerOn;          <---

};

    #endif

and the Player class is :
    #ifndef PLAYER_H
    #define PLAYER_H

    #include <string>
//using namespace std;

    #include "Square.h"

class Player
{
public:

    Player(int,int);
//  ~Player(void);
    int playDice();

private:

        int ID;
        int money;

};
#endif

I receive:
syntax error missing ; before * (on the declaration of  Player* PlayerOn;)

and missing type specifier (on the same line...)

A: Looks like a problem of recursive includes. You should use forward declaration in your square class.
#ifndef SQUARE_H
#define SQUARE_H

#include <string>
//using namespace std;

class Player; //You will have to use the #include "player.h" in your .cpp

class Square

{
public:

    Square(int);
    void process();

protected:

    int ID;
    Player* PlayerOn;          <---

};

A: The issue is that you are inclding Square.h in Player.h and so when you get Player* PlayerOn; Player is not defined
Either do not have the  #include "Square.h" in your Player.h which will work with this code. If the actual code is more complex replace the #include "Square.h" with a forward declaration of Square class Square;


text:
Q: Do not expire bounties which failed to attract any (good) answers As this question did not yield any answer as to why bounties which have failed to attract auto-awardable answers – i.e., answered by somebody who did not start the bounty, answered after the bounty has been started, two upvotes in the week after being posted – should not be spared from expiration under certain conditions, I propose the following:
If a bounty's grace period is about to expire without any answer being awarded that bounty automatically or manually, extend it until n days after an answer has become auto-awardable (e.g., with n = 7). Essentially treat the bounty as expired except that if an auto-awardable answer is posted, it can be automatically or manually awarded the bounty. Some suggestion on how to handle the details:

*

*The bounty can be awarded manually at any time.

*The question will not be listed on the featured questions anymore and thus not receive any additional exposure.

*The bounty does not count towards the per-user bounty limit anymore.

*The question loses the special protection against closure, which bountied questions have.

*Requiring two upvotes in the first week and not just in general avoids the bounty being awarded to answers that are bad but attract an upvote evry now and then.

*Unless the question has received an answer in the last n days, a new bounty can be started on that question, in which case the old bounty expires instantly. Note that without that restriction, one could start a bounty to deny an answerer the old bounty. Adding up bounties in this case has already been discussed here.

*I chose the end of the grace period to depend on the time of the answer becoming auto-awardable in contrast to the time the answer was posted to avoid instant auto-awarding after an upvote. This could be replaced by a more complicated system (in which, e.g., the grace period ends if at least n days have passed after the first auto-awardable answer has been posted and at least one day has passed after the first answer has become auto-awardable).

*I have no suggestion as to whether the bounty should still be indicated next to the question. In my opinion it does not cause much exposure as the question will likely vanish from the front page and thus this indication is only seen if the question turns up in searches and similar.

This way questions, on which an unsuccessful bounty was placed, retain at least some incentive for answers and thus the bounty starter has an at least a slightly increased chance to get something for the invested reputation. Also, somebody who missed the bounty period for whatever reason and can answer that question cat still get an extra award for helping the bounty placer (and answering what is likely a difficult question).

A: The whole point of the bounty system is to provide more exposure for a limited amount of time.  That's what you're paying for.  Getting a good answer is not a guarantee, nor a requirement.  It never has been.
If, after your week, you still don't have a good answer, what good does leaving the bounty on there do you?  Removing it from the bounty notifications to lose the exposure and losing the special close protection means it's just a regular, plain old question, and the bounty has absolutely no function at that point.  The bounty has not helped get an answer in a week when it got the exposure, so it won't help get an answer after that point, and there's no point in allowing it to stick around.


text:
Q: How to update only those who are divisible MySQL update comments
set comment = case
    when id % 7 = 0 then 'The universe is such an amazing thing.'
    when id % 5 = 0 then 'I definitely read the article again.'
    when id % 3 = 0 then 'This is interesting.'
    when id % 2 = 0 then 'Very good article'
end
where id between 1 and 15;

It gives me error: Error Code: 1048. Column 'comment' cannot be null!
I want to update only those witch are divisible.
All others that are not divisible I want to leave unchanged.

A: Your "cases" do not describe every possible case.
13 is not 0 %7, %5, %3 nor %2.
The good practise is to add a default case to capture those scenarios, which is labelled else in SQL language.

A: You could add an else branch to the case expression that leaves the comment untouched when it matches none of the divisors:
update comments
set comment = case
    when id % 7 = 0 then 'The universe is such an amazing thing.'
    when id % 5 = 0 then 'I definitely read the article again.'
    when id % 3 = 0 then 'This is interesting.'
    when id % 2 = 0 then 'Very good article'
    else comment
end
where id between 1 and 15;

Or you could use a where condition:
update comments
set comment = case
    when id % 7 = 0 then 'The universe is such an amazing thing.'
    when id % 5 = 0 then 'I definitely read the article again.'
    when id % 3 = 0 then 'This is interesting.'
    when id % 2 = 0 then 'Very good article'
end
where
    id between 1 and 15
    and (id % 2 = 0 or id % 3 = 0 or id % 5 or id % 7 = 0)

If you are really filtering on values between 1 and 15, then this could be simplified:
 where id between 1 and 15 and id not in (1, 11, 13)


text:
Q: Kubernetes statefulset analog on Google Compute Engine Is this a sane idea to create a service with statefulset-like architecture outside of the kubernetes?
And is there some way to make this with GCE nowadays?
There would be app pairs, like backend app + database with an index for each pair. So VMs would have hostnames based on index + tier, for example, 3-app and 3-db.
Every instance can have metadata like index + tier + IP address, and which can be stored somewhere and should be deleted on pair removal.
And the whole thing can be managed (deployed & provisioned) with Terraform, Ansible, etc or by some Google Cloud service.
What was done: an old semi-automated stateful service that tastes like a meatball made of Nginx, Redis and Java and spaghetti of bash, python, and ruby. And it can't be ported to kubernetes, sigh.


text:
Q: Problems with time travel debugger on elm-live I read the documentation for elm-live and discovered that I have to use -- --debug for it to work. I tried elm-live src/Main.elm -- --debug but it doesn't work even like that. I don't get any error messages or anything, the server just starts up normally but without the time travel debugger on. However, it works with elm make.
I tried both the stable version and the latest version of elm-live and updated node to its latest release but it doesn't work.
If it helps with anything I'm using the latest version of elm (0.19.1)

A: This seems a limitation of Elm, not elm-live: if you execute
elm make src/Main.elm --debug

also you don't get the debugger.
I think that to get the debugger you need to use the compiler to create only the JS file, using the output argument:
--output=<output-file>
    Specify the name of the resulting JS file. For example
    --output=assets/elm.js to generate the JS at assets/elm.js or
    --output=/dev/null to generate no output at all!

For reference, this is the line that works for me:
elm-live src/Main.elm --start-page="index.html" --hot --dir=docs --port=8001 --path-to-elm=node_modules/.bin/elm -- --output="docs/js-compiled/elm.js" --debug


text:
Q: Speedup Java regular expression I have a regular expression in java to extract certain urls from webpages I have crawled. These urls are basically javascript and stylesheets which get included into the pages. I have chosen to use a regular expression to extract these instead of parsing the document because this should be easier and parsing the document won't have any added value for me.
To get the valid urls (absolute or relative) I use the following regex:
([^"',\(]*)/endofurl

It extracts anything between '",( and the end of the url, in this example '/endofurl'.
Example:

The problem is that it isn't that fast (probably because of the ([^"',(]*) part).
Is there a way to speed this up by for example make it look for '/endofurl' part first and then go back until it reaches one of the start characters?

A: There's no need to use regex for this.
Find the /endofurl:
int endOfUrl = s.indexOf("/endofurl");

Then (having checked that endOfUrl != -1) find the first occurrence of ", , or ( before it:
int start = Math.max(  // Fictional version of Math.max which takes 3 inputs.
    s.lastIndexOf('"', endOfUrl),
    s.lastIndexOf(',', endOfUrl),
    s.lastIndexOf('(', endOfUrl));

Then (having checked that start != -1) extract the string:
String substring = s.substring(start + 1, endOfUrl + "/endofurl".length());

Then repeat from endOfUrl + 1 to find the next occurrence, using the String.indexOf(String, int) overload of indexOf.

A:
Is there a way to speed this up by for example make it look for '/endofurl' part first and then go back until it reaches one of the start characters?

There's a truly horrible way that I can think of: search the string in reverse.
Pattern pattern = Pattern.compile("lrufodne/[^"',(]*");
Matcher matcher = pattern.matcher(new StringBuilder(s).reverse().toString());
while (matcher.find()) {
  System.out.println(new StringBuilder(matcher.group()).reverse().toString());
}

I wouldn't recommend this, though. Easier just to use basic string operations.

An alternative would be to split the string on the characters you don't want, and look for strings containing /endofurl:
for (String part : s.split("[^\"',(]")) {
  int endOfUrl = part.indexOf("/endofurl");
  if (endOfUrl != -1) {
    System.out.println(part.substring(0, endOfUrl + "/endofurl".length());
  }
}

But, again, I'd go for more basic string operations: you don't really need to construct all the additional strings and the array here.

A: Or you can change the regex to
"([\w.]*/)*endofurl

and use the complete match. This brings it down from 366 steps to 36 and also gives a (significant?) speedup.
See it here at regex101.


text:
Q: The difference between URI and URL This question has been asked many times before. But before you down-vote this please allow me to ask it in a slightly different way:
Of the following examples, which are URLs, which are URIs and which are both:
1. www.example.com

2. //www.example.com

3. http://www.example.com

4. www.example.com/myfolder/mypage.html

5. //www.example.com/myfolder/mypage.html

6. http://www.example.com/myfolder/mypage.html

7. myfolder/mypage.html

8. /myfolder/mypage.html

9. mypage.html

Any comment on which are URNs would also be welcome.

A: I really think What is the difference between URI, URL and URN? should clarify your question. However, I'll try to answer your question directly..

*

*www.example.com
none

*//www.example.com
none

*http://www.example.com
URL and URI

*www.example.com/myfolder/mypage.html
none

*//www.example.com/myfolder/mypage.html
none

*http://www.example.com/myfolder/mypage.html
URL and URI

*myfolder/mypage.html
none

*/myfolder/mypage.html
none

*mypage.html
none
Hope that helps a little.


text:
Q: Authentication with GitLab to a terminal I have a terminal that served in webbrowser with wetty. I want to authenticate the user from gitlab to let user with interaction with the terminal(It is inside docker container. When user authenticated i ll allow him to see the containers terminal).
I am trying to do OAuth 2.0 but couldn't manage to achieve.
That is what i tried.

*

*I created an application on gitlab.

*Get the code and secret and make a http call with python script.

*Script directed me to login and authentication page.

*I tried to get code but failed(Their is no mistake on code i think)

Now the problem starts in here. I need to get the auth code from redirected url to gain access token but couldn't figure out. I used flask library for get the code.
from flask import Flask, abort, request
from uuid import uuid4
import requests
import requests.auth
import urllib2
import urllib

CLIENT_ID = "clientid"
CLIENT_SECRET = "clientsecret"
REDIRECT_URI = "https://UnrelevantFromGitlabLink.com/console"

def user_agent():

    raise NotImplementedError()

def base_headers():
    return {"User-Agent": user_agent()}

app = Flask(__name__)
@app.route('/')
def homepage():
    text = 'Authenticate with gitlab'
    return text % make_authorization_url()

def make_authorization_url():
    # Generate a random string for the state parameter
    # Save it for use later to prevent xsrf attacks
    state = str(uuid4())
    save_created_state(state)
    params = {"client_id": CLIENT_ID,
              "response_type": "code",
              "state": state,
              "redirect_uri": REDIRECT_URI,
              "scope": "api"}
    url = "https://GitlapDomain/oauth/authorize?" + urllib.urlencode(params)
    print get_redirected_url(url)
    print(url)
    return url

# Left as an exercise to the reader.
# You may want to store valid states in a database or memcache.
def save_created_state(state):
    pass
def is_valid_state(state):
    return True

@app.route('/console')
def reddit_callback():
    print("-----------------")
    error = request.args.get('error', '')
    if error:
        return "Error: " + error
    state = request.args.get('state', '')
    if not is_valid_state(state):
        # Uh-oh, this request wasn't started by us!
        abort(403)
    code = request.args.get('code')
    print(code.json())
    access_token = get_token(code)
    # Note: In most cases, you'll want to store the access token, in, say,
    # a session for use in other parts of your web app.
    return "Your gitlab username is: %s" % get_username(access_token)

def get_token(code):
    client_auth = requests.auth.HTTPBasicAuth(CLIENT_ID, CLIENT_SECRET)
    post_data = {"grant_type": "authorization_code",
                 "code": code,
                 "redirect_uri": REDIRECT_URI}
    headers = base_headers()
    response = requests.post("https://MyGitlabDomain/oauth/token",
                             auth=client_auth,
                             headers=headers,
                             data=post_data)
    token_json = response.json()
    return token_json["access_token"]

if __name__ == '__main__':
    app.run(host="0.0.0.0",debug=True, port=65010)

I think my problem is on my redirect url. Because it is just an irrelevant link from GitLab and there is no API the I can make call.
If I can fire

@app.route('/console')

that line on Python my problem will probably will be solved.
I need to make correction on my Python script or different angle to solve my problem. Please help.

A: I was totally miss understand the concept of auth2. Main aim is to have access_token. When i corrected callback url as localhost it worked like charm.


text:
Q: htaccess performance: denying access to specific files and folders I'm trying to find the most performance friendly way of denying access to specific files and folders via htaccess. (For example a .git folder, an .hg folder, the .htaccess file itself.) Is there some particlaur method, or combination, that is more performance friendly than the others? (FilesMatch vs DirectoryMatch vs RedirectMatch vs whatever.)

A: In an .htaccess file, the performance difference between any of those is negligible.  They all do filesystem stat calls, which is the "expensive" part.
For the best performance, if you can, use LocationMatch directly in the VirtualHost of your Apache httpd configuration.


text:
Q: how do i stop objects from spawning automatic ok whenever i try to reload the scene the objects from the previous scene dont stop spawning
here is my code, I want to delete all the objects from screen before moving to another screen
local objects = {
    "banana",
    "grape",
    "pineapple",
    "bomb",
    "watermelon",

}
local function spawnObject()
     objIdx = mRandom(#objects)
    objName = objects[objIdx]
    object = display.newImage( "images/fruit_" .. objName .. "_100.png" )
    object.x = mRandom(screenLeft+30, screenRight-30)
    object.y = screenTop
    object.rotation = mRandom(-15, 15)
    object.id = mRandom(-15,15)
    if objIdx < 4 then
        object.type = "food"
    else
        object.type = "other"
    end
    end

A: Insert your object (from display.newImage) into the scene view / display group.
Then it will get deleted automatically if you change screen.
Other option is to store all objects in a table, and call removeSelf() on each object in the table when you want to delete them.


text:
Q: How to add empty folders when importing from SVN to Git under Windows? I need to migrate multiple repositories from SVN to Git under Windows. Part of the repositories has empty folders, they are critical for projects and these folders cannot be deleted without breaking the project.
I tried the git svn clone command with the keys --preserve-empty-dirs --placeholder-filename = .gitkeep but this does not work at all.
As a result, the folder is not added to the commit history - this is a big problem because it is impossible to updade to the old version. After full migration the folder is also not added.
I tried to make a crutch to the mechanism, but I do not understand how to make it correctly:
This code creates zero-size files that Git does not process:
for /f "delims=" %d in ('dir /s /b /ad ^| sort /r') do (fsutil file createnew %d/.gitkeep 0 && echo.>%%d/.gitkeep)
This code creates files with a size of 2 bytes:
for /f "delims=" %d in ('dir /s /b /ad ^| sort /r') do (echo.>%d/.gitkeep)
In both cases, there is a problem with the fact that files are created in all folders, and not just empty ones. In addition, I lack an understanding of how to exclude the .git folder from processing.
Please, help.

A: No way, but I wrote a crutch under Ubuntu 18.04, it works successfully in WSL:
echo The crutches for git svn clone --preserve-empty-dirs command, because it is not working properly.

find . -type d -empty -not -path "./.git/*" -exec echo blablabla>.gitkeep \;
git add --all