text:
Q: Vertical/Horizontal Alignment in Div I am currently working on a call center stat page and am really just getting started in the HTML5/CSS world.  I am having a small(huge to me) problem that has been bugging me for the past two days.  At the top-left of my web page, I am needing the "100%" and "100" to be centered horizontally and vertically.  I have tried several things such as display: table-cell, line heights, and several other things but nothing seems to center my text vertically as well as horizontal.
Here is the JSFiddle link:
http://jsfiddle.net/neggly/ndprc/
CSS
/*! normalize.css v1.0.0 | MIT License | git.io/normalize */

/* ==========================================================================
   HTML5 display definitions
   ========================================================================== */

/*
 * Corrects `block` display not defined in IE 6/7/8/9 and Firefox 3.
 */

article,
aside,
details,
figcaption,
figure,
footer,
header,
hgroup,
nav,
section,
summary {
    display: block;
}

/*
 * Corrects `inline-block` display not defined in IE 6/7/8/9 and Firefox 3.
 */

audio,
canvas,
video {
    display: inline-block;
    *display: inline;
    *zoom: 1;
}

/*
 * Prevents modern browsers from displaying `audio` without controls.
 * Remove excess height in iOS 5 devices.
 */

audio:not([controls]) {
    display: none;
    height: 0;
}

/*
 * Addresses styling for `hidden` attribute not present in IE 7/8/9, Firefox 3,
 * and Safari 4.
 * Known issue: no IE 6 support.
 */

[hidden] {
    display: none;
}

/* ==========================================================================
   Base
   ========================================================================== */

/*
 * 1. Corrects text resizing oddly in IE 6/7 when body `font-size` is set using
 *    `em` units.
 * 2. Prevents iOS text size adjust after orientation change, without disabling
 *    user zoom.
 */

html {
    font-size: 100%; /* 1 */
    -webkit-text-size-adjust: 100%; /* 2 */
    -ms-text-size-adjust: 100%; /* 2 */
}

/*
 * Addresses `font-family` inconsistency between `textarea` and other form
 * elements.
 */

html,
button,
input,
select,
textarea {
    font-family: sans-serif;
}

/*
 * Addresses margins handled incorrectly in IE 6/7.
 */

body {
    margin: 0;
}

/* ==========================================================================
   Links
   ========================================================================== */

/*
 * Addresses `outline` inconsistency between Chrome and other browsers.
 */

a:focus {
    outline: thin dotted;
}

/*
 * Improves readability when focused and also mouse hovered in all browsers.
 */

a:active,
a:hover {
    outline: 0;
}

/* ==========================================================================
   Typography
   ========================================================================== */

/*
 * Addresses font sizes and margins set differently in IE 6/7.
 * Addresses font sizes within `section` and `article` in Firefox 4+, Safari 5,
 * and Chrome.
 */

h1 {
    font-size: 2em;
    margin: 0.67em 0;
}

h2 {
    font-size: 1.5em;
    margin: 0.83em 0;
}

h3 {
    font-size: 1.17em;
    margin: 1em 0;
}

h4 {
    font-size: 1em;
    margin: 1.33em 0;
}

h5 {
    font-size: 0.83em;
    margin: 1.67em 0;
}

h6 {
    font-size: 0.75em;
    margin: 2.33em 0;
}

/*
 * Addresses styling not present in IE 7/8/9, Safari 5, and Chrome.
 */

abbr[title] {
    border-bottom: 1px dotted;
}

/*
 * Addresses style set to `bolder` in Firefox 3+, Safari 4/5, and Chrome.
 */

b,
strong {
    font-weight: bold;
}

blockquote {
    margin: 1em 40px;
}

/*
 * Addresses styling not present in Safari 5 and Chrome.
 */

dfn {
    font-style: italic;
}

/*
 * Addresses styling not present in IE 6/7/8/9.
 */

mark {
    background: #ff0;
    color: #000;
}

/*
 * Addresses margins set differently in IE 6/7.
 */

p,
pre {
    margin: 1em 0;
}

/*
 * Corrects font family set oddly in IE 6, Safari 4/5, and Chrome.
 */

code,
kbd,
pre,
samp {
    font-family: monospace, serif;
    _font-family: 'courier new', monospace;
    font-size: 1em;
}

/*
 * Improves readability of pre-formatted text in all browsers.
 */

pre {
    white-space: pre;
    white-space: pre-wrap;
    word-wrap: break-word;
}

/*
 * Addresses CSS quotes not supported in IE 6/7.
 */

q {
    quotes: none;
}

/*
 * Addresses `quotes` property not supported in Safari 4.
 */

q:before,
q:after {
    content: '';
    content: none;
}

small {
    font-size: 75%;
}

/*
 * Prevents `sub` and `sup` affecting `line-height` in all browsers.
 */

sub,
sup {
    font-size: 75%;
    line-height: 0;
    position: relative;
    vertical-align: baseline;
}

sup {
    top: -0.5em;
}

sub {
    bottom: -0.25em;
}

/* ==========================================================================
   Lists
   ========================================================================== */

/*
 * Addresses margins set differently in IE 6/7.
 */

dl,
menu,
ol,
ul {
    margin: 1em 0;
}

dd {
    margin: 0 0 0 40px;
}

/*
 * Addresses paddings set differently in IE 6/7.
 */

menu,
ol,
ul {
    padding: 0 0 0 40px;
}

/*
 * Corrects list images handled incorrectly in IE 7.
 */

nav ul,
nav ol {
    list-style: none;
    list-style-image: none;
}

/* ==========================================================================
   Embedded content
   ========================================================================== */

/*
 * 1. Removes border when inside `a` element in IE 6/7/8/9 and Firefox 3.
 * 2. Improves image quality when scaled in IE 7.
 */

img {
    border: 0; /* 1 */
    -ms-interpolation-mode: bicubic; /* 2 */
}

/*
 * Corrects overflow displayed oddly in IE 9.
 */

svg:not(:root) {
    overflow: hidden;
}

/* ==========================================================================
   Figures
   ========================================================================== */

/*
 * Addresses margin not present in IE 6/7/8/9, Safari 5, and Opera 11.
 */

figure {
    margin: 0;
}

/* ==========================================================================
   Forms
   ========================================================================== */

/*
 * Corrects margin displayed oddly in IE 6/7.
 */

form {
    margin: 0;
}

/*
 * Define consistent border, margin, and padding.
 */

fieldset {
    border: 1px solid #c0c0c0;
    margin: 0 2px;
    padding: 0.35em 0.625em 0.75em;
}

/*
 * 1. Corrects color not being inherited in IE 6/7/8/9.
 * 2. Corrects text not wrapping in Firefox 3.
 * 3. Corrects alignment displayed oddly in IE 6/7.
 */

legend {
    border: 0; /* 1 */
    padding: 0;
    white-space: normal; /* 2 */
    *margin-left: -7px; /* 3 */
}

/*
 * 1. Corrects font size not being inherited in all browsers.
 * 2. Addresses margins set differently in IE 6/7, Firefox 3+, Safari 5,
 *    and Chrome.
 * 3. Improves appearance and consistency in all browsers.
 */

button,
input,
select,
textarea {
    font-size: 100%; /* 1 */
    margin: 0; /* 2 */
    vertical-align: baseline; /* 3 */
    *vertical-align: middle; /* 3 */
}

/*
 * Addresses Firefox 3+ setting `line-height` on `input` using `!important` in
 * the UA stylesheet.
 */

button,
input {
    line-height: normal;
}

/*
 * 1. Avoid the WebKit bug in Android 4.0.* where (2) destroys native `audio`
 *    and `video` controls.
 * 2. Corrects inability to style clickable `input` types in iOS.
 * 3. Improves usability and consistency of cursor style between image-type
 *    `input` and others.
 * 4. Removes inner spacing in IE 7 without affecting normal text inputs.
 *    Known issue: inner spacing remains in IE 6.
 */

button,
html input[type="button"], /* 1 */
input[type="reset"],
input[type="submit"] {
    -webkit-appearance: button; /* 2 */
    cursor: pointer; /* 3 */
    *overflow: visible;  /* 4 */
}

/*
 * Re-set default cursor for disabled elements.
 */

button[disabled],
input[disabled] {
    cursor: default;
}

/*
 * 1. Addresses box sizing set to content-box in IE 8/9.
 * 2. Removes excess padding in IE 8/9.
 * 3. Removes excess padding in IE 7.
 *    Known issue: excess padding remains in IE 6.
 */

input[type="checkbox"],
input[type="radio"] {
    box-sizing: border-box; /* 1 */
    padding: 0; /* 2 */
    *height: 13px; /* 3 */
    *width: 13px; /* 3 */
}

/*
 * 1. Addresses `appearance` set to `searchfield` in Safari 5 and Chrome.
 * 2. Addresses `box-sizing` set to `border-box` in Safari 5 and Chrome
 *    (include `-moz` to future-proof).
 */

input[type="search"] {
    -webkit-appearance: textfield; /* 1 */
    -moz-box-sizing: content-box;
    -webkit-box-sizing: content-box; /* 2 */
    box-sizing: content-box;
}

/*
 * Removes inner padding and search cancel button in Safari 5 and Chrome
 * on OS X.
 */

input[type="search"]::-webkit-search-cancel-button,
input[type="search"]::-webkit-search-decoration {
    -webkit-appearance: none;
}

/*
 * Removes inner padding and border in Firefox 3+.
 */

button::-moz-focus-inner,
input::-moz-focus-inner {
    border: 0;
    padding: 0;
}

/*
 * 1. Removes default vertical scrollbar in IE 6/7/8/9.
 * 2. Improves readability and alignment in all browsers.
 */

textarea {
    overflow: auto; /* 1 */
    vertical-align: top; /* 2 */
}

/* ==========================================================================
   Tables
   ========================================================================== */

/*
 * Remove most spacing between table cells.
 */

table {
    border-collapse: collapse;
    border-spacing: 0;
}

/*
    Created on : Apr 3, 2014, 9:37:25 AM
    Author     : meggleston
*/

#wrap {
    position: absolute;
    height:100%;
    width:100%;
    margin:0 auto;
    background-color: black;
}

#statuscolorwrap
{
    background-color: aqua;
    float: left;
    width: 1%;
    height: 100%;
}

#numberwrap
{
    background-color: #ff0;
    float: left;
    width: 20%;
    height: 100%;
}

#announcementwrap
{
    background-color: coral;
    float: left;
    width: 79%;
    height: 100%;
}

#queuewrapper
{
    height:40%;
    width:100%;
    float: top;
    background-color: darkorchid;
}

#queuecolors
{
    height:40%;
    width:100%;
    float: top;
    background-color: cadetblue;
}

#queuepercentage
{
    height: 50%;
    width: 100%;
    float: top;
    background-color: chartreuse;
}

#queueholding
{
    height: 50%;
    width: 100%;
    float: bottom;
    background-color: crimson;
}

#topcolor
{
    height: 50%;
    width: 100%;
    float: top;
    background-color: darkseagreen;
}

#bottomcolor
{
    height: 50%;
    width: 100%;
    float: bottom;
    background-color: moccasin;
}

#datetimewrapper
{
    width:100%;
    height:4%;
    float: top;
    background-color: deepskyblue;
}

#messages
{
    width: 100%;
    height: 60%;
    float: top;
    background-color: darkorchid;
    overflow-y: auto;
}

.messagewrapper
{
    width: 100%;
    height: 100px;
    float:top;
    background-color: azure;
}

.messageimportance
{
    float:left;
    width: 5%;
    height: 100%;
    background-color: darkslategrey;
}

.messagesubject
{
    float:left;
    width: 95%;
    height: 100%;
    background-color: blanchedalmond;
}

h1
{
    font: Helvetica, sans-serif;
    margin:0;
    padding:0;
    display: tab
}

h2
{
    font: Helvetica, sans-serif;
    margin:0;
    padding:0;
    text-align: left;
}

h3
{
    font: 30px/50px Helvetica, sans-serif;
    font-weight: bold;
    margin:0;
    padding:0;
    text-align: center;
}

#anpicturewrap
{
    float:top;
    width:100%;
    height:46%;
    background-color: darkcyan;
}

#antextwrap
{
    float:top;
    width:100%;
    height:50%;
    background-color: darkkhaki;
    overflow-y: auto;
}

img
{
    max-width: 100%;
    max-height: 100%;
    display:block;
    margin:auto;
}

h4
{
    font: 20px/100px Helvetica, sans-serif;
    margin: 0;
    padding: 0;
    text-align: left;
}

#text
{
    width: auto;
    margin-left: 40px;
    margin-right:40px;
    margin-bottom: 30px;
}

HTML

        <title>Virginia Summary</title>
        <meta charset="UTF-8">
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
        <link rel="stylesheet" href="reset.css"/>
        <link rel="stylesheet" href="base.css"/>

100%

100

Enter Subject here

12/12/2014 18:00

sample text

As stated earlier, I am fairly new to this so any further suggestions are always welcome.

A: Adding the following achieved your desired result:
#queuewrapper { display: table; }
#queuepercentage, #queueholding { display: table-row; }
#queuepercentage h1, #queueholding h1 { display: table-cell; height: 90px; vertical-align: middle; text-align: center; }

Check it out here: http://jsfiddle.net/ndprc/1/


text:
Q: help with understanding a proof again I'm stuck already on the first steps of an inductive proof of
$$ (a+b)^{n+1} = \sum_{k=0}^{n+1} {n+1\choose k}a^kb^{n+1-k} $$
that is, I'm trying to understand the solution to this. It starts with:
$$ (a+b)^{n+1} = (a+b) * (a+b)^n = (a+b) * \sum_{k=0}^{n} {n\choose k}a^kb^{n-k}  $$
This part I understand, but then I get stuck with this next part (continuing the row above)
$$ = \sum_{k=0}^{n} {n\choose k}a^{k+1}b^{n-k}+\sum_{k=0}^{n} {n\choose k}a^kb^{n+1-k}    $$
Don't understand where the first term comes from and why in the second it's now $ b^{n+1-k} $. I'm a bit of a noob I have to say, so don't be so hard on me ;)
the rest of the proof I don't understand either, but one step at a time :).
Thanks!!

A: $$\begin{align}(a+b)\sum_{k=0}^{n} {n\choose k}a^kb^{n-k} &= a\sum_{k=0}^{n} {n\choose k}a^kb^{n-k}+b\sum_{k=0}^{n} {n\choose k}a^kb^{n-k}\\ &= \sum_{k=0}^{n} {n\choose k}a^{k+1}b^{n-k}+\sum_{k=0}^{n} {n\choose k}a^kb^{n+1-k}\end{align}$$
First, the $\Sigma$ sum was distributed over the sum $a+b,$ then $a$ and $b$ were distributed over the $\Sigma$ sums.

redpajama_set_name: RedPajamaStackExchange


text:
Q: Make operating system with Ubuntu? I just had a quick question is it true that you can make your own operating system with Ubuntu and if so where can i go to learn how to make my own operating system with Ubuntu.
Thanks

A: You can have another operating system alongside with Ubuntu or another operating system inside Ubuntu.
If you want to have another operating system with Ubuntu, for example windows, you have to install windows first and then Ubuntu. This is easy way instead of installing Ubuntu first and then Windows.
But if you want to install another operating system, for example Windows in Ubuntu, You have to use of a virtual program like Vitualbox, which is very useful and easy to use. and you can get it through software center, or type the following command in terminal:
sudo apt-get install virtualbox

and then type:
sudo apt-get update

Done!


text:
Q: Proving that dimension of intersection of kernels of $k$ linear functionals on $n$ dimensional vector space is $\ge n-k$ So i'm trying to prove the following:

Let $V$ be a vector space, $\dim(V)=n, f_1,...,f_k:V\to \mathbb{R}$ are linear functionals on $V$.
then $\dim(\ker(f_1) ∩ \ ...\  ∩ \ker(f_k)) ≥ n-k$.

I've tried a few different approaches, but they got me nowhere.
like:
let $B_i=\{u_{i1},...,u_{in-1}\}$ be a basis of $\ker(f_i)$ where $1 \le i \le k$
now $\dim(\ker(f_1) ∩ \ker(f_2)) = \dim([B_1]∩[B_2]) ≤ n-1$ and continue on like this, but that would lead me to $\dim(\ker(f_1) ∩ \ ...\  ∩ \ker(f_k))≤ n-1$.
Another approach that I've tried is:
Define $F:V\to \mathbb{R}\times \cdots \times \mathbb{R}$ ($k$ products of $\mathbb{R}$) as $F(x)=(f_1(x),...,f_k(x))$. Then $\ker(F)= \ker(f_1) ∩ ... ∩ \ker(f_k)$ but i don't see a way how to proceed from that or if it would even lead somewhere

A: Assume that $f_1, \ldots, f_k$ are linearly independent and extend them to a a basis  $\{f_1, \ldots, f_n\}$ for the dual space $V^*$.
Let $\{b_1, \ldots, b_n\}$ be a basis for $V$ such that $\{f_1, \ldots, f_n\}$ is its dual basis.
Note that $\bigcap_{i=1}^k \ker f_i = \operatorname{span}\{b_{k+1}, \ldots, b_n\}$.
Indeed, obviously $b_j \in \ker f_i$ for $i = 1,\ldots, k$ and $j = k+1, \ldots, n$.
Conversely, let $x = \sum_{i=1}^n \alpha_ib_i \in \bigcap_{i=1}^k \ker f_i $. We have
$$0 = f_i(x) = \alpha_i, \quad\forall i = 1, \ldots, k$$
so $x = \sum_{i=k+1}^n \alpha_ib_i \in \operatorname{span}\{b_{k+1}, \ldots, b_n\}$.
Since $b_{k+1}, \ldots, b_n$ are linearly independent, we conclude $\dim \bigcap_{i=1}^k \ker f_i = n-k$.

If $f_1, \ldots, f_k$ are not linearly independent, we can assume that the first $f_1, \ldots, f_l$ are linearly independent, and that $f_{l+1}, \ldots, f_k$ are their linear combinations.
Then notice that
$$\bigcap_{i=1}^l \ker f_i \subseteq \ker f_j , \quad\forall j = k+1,\ldots, k$$
so $\bigcap_{i=1}^l \ker f_i = \bigcap_{i=1}^k \ker f_i$.
From the above proof follows that
$$\dim \bigcap_{i=1}^k \ker f_i =\dim \bigcap_{i=1}^l \ker f_i = n-l \ge n-k$$


text:
Q: How to add/persist any number of plot layers on click in Shiny Following the answer given in this question, I can get a polygon to render on a plot with each click:

However, I can't seem to find an easy way to allow the polygon() to persist. The way I have it now, the both the initial plot and the annotation are replotted each time.
What is the (a) right way to decouple the annotation and plot so that multiple annotations can be created?
I feel like I can use the "Paint Circle" button to add a new polygon(), but I am not sure how to create a new "object" like that in R.
Code:
server.R
library(shiny)
library(maps)
library(mapdata)
library(rworldmap)
library(gridExtra)

circleFun <- function(center = c(0,0),radius = 1, npoints = 100){
    tt <- seq(0,2*pi,length.out = npoints)
    xx <- center[1] + radius * cos(tt)
    yy <- center[2] + radius * sin(tt)
    return(data.frame(x = xx, y = yy))
}

shinyServer(function(input, output) {
  # Reactive dependencies
  buttonClicked <- reactive(input$paintupdate)

  isolate({
  theworld <- function() {
    myplot <- map("world2", wrap=TRUE, plot=TRUE,
        resolution=2)
  }})

  user.circle <- function() {
    if (buttonClicked() > 0) {
      cur.circ <- circleFun(c(input$plotclick$x,input$plotclick$y),
                            radius=input$radius*100, npoints = 30)
      polygon(x=cur.circ$x,y=cur.circ$y,
              col = rainbow(1000,s=0.5,alpha=0.5)[input$circlecolor])
    }
  }

  output$myworld <- renderPlot({
    theworld()
    user.circle()
  })

  output$clickcoord <- renderPrint({
    # get user clicks, report coords
    if ("plotclick" %in% names(input)) {
      print(input$plotclick)
    }
    print(buttonClicked())
  })

})

ui.R
library(shiny)

# Define UI for application
shinyUI(pageWithSidebar(

  # Application title
  headerPanel("App"),

  sidebarPanel(
    sliderInput("radius",
                "Location radius",
                min = 0,
                max = 1,
                value = 0.1,
                round=FALSE,
                step=0.001),
    sliderInput("circlecolor",
                "Circle color (hue)",
                min=0,
                max=1000,
                step=1,
                value=sample(1:1000,1)),
    actionButton("paintupdate", "Paint Circle"),
    textOutput("clickcoord")
  ),

  mainPanel(
    tabsetPanel(
      tabPanel("Map",
               plotOutput("myworld", height="650px",width="750px",
                          clickId="plotclick")
      )
    )
  )
))

A: You can change your example slightly and add a reactiveValue to make this work
library(shiny)
library(maps)
library(mapdata)
library(rworldmap)
library(gridExtra)

circleFun <- function(center = c(0,0),radius = 1, npoints = 100){
  tt <- seq(0,2*pi,length.out = npoints)
  xx <- center[1] + radius * cos(tt)
  yy <- center[2] + radius * sin(tt)
  return(data.frame(x = xx, y = yy))
}

library(shiny)

# Define UI for application
runApp(
  list(ui = pageWithSidebar(

    # Application title
    headerPanel("App"),

    sidebarPanel(
      sliderInput("radius",
                  "Location radius",
                  min = 0,
                  max = 1,
                  value = 0.1,
                  round=FALSE,
                  step=0.001),
      sliderInput("circlecolor",
                  "Circle color (hue)",
                  min=0,
                  max=1000,
                  step=1,
                  value=sample(1:1000,1)),
      actionButton("paintupdate", "Paint Circle"),
      textOutput("clickcoord")
    ),

    mainPanel(
      tabsetPanel(
        tabPanel("Map",
                 plotOutput("myworld", height="650px",width="750px",
                            clickId="plotclick")
        )
      )
    )
  ),
  server = function(input, output, session) {
    # Reactive dependencies
    myReact <- reactiveValues()
    buttonClicked <- reactive(input$paintupdate)

    isolate({
      theworld <- function() {
        myplot <- map("world2", wrap=TRUE, plot=TRUE,
                      resolution=2)
      }})

    user.circle <- function(a,b,c,d) {
      cur.circ <- circleFun(c(a,b),
                            radius=c, npoints = 30)
      polygon(x=cur.circ$x,y=cur.circ$y,
              col = rainbow(1000,s=0.5,alpha=0.5)[d])
    }

    observe({
      if (buttonClicked() > 0) {
        # take a dependence on button clicked
        myReact$poly <- c(isolate(myReact$poly), list(list(a=isolate(input$plotclick$x), b= isolate(input$plotclick$y)
                                             ,c=isolate(input$radius*100), d = isolate(input$circlecolor))))
      }
    }, priority = 100)

    output$myworld <- renderPlot({
      theworld()
        for(i in seq_along(myReact$poly)){
          do.call(user.circle, myReact$poly[[i]])
        }
    })

    output$clickcoord <- renderPrint({
      # get user clicks, report coords
      if ("plotclick" %in% names(input)) {
        print(input$plotclick)
      }
      print(buttonClicked())
    })

  }), display.mode= "showcase"
)


text:
Q: access react route params in server side i came up with this problem with ReactJS and ExpressJS: So basically user uploads some info on /info route with React & axios. then user gets route params from server side to redirect to:
axios.post('/info', SomeData)
.then(res => res.data)
.then(data =>{
  window.location.replace(`/info/${data.id}`)
})

this is piece of cake but when user redirects to that page problem occurs, i need to get data from that page. i can get route params and perform request on client side like this:
componentDidMount(){
    const { match: { params } } = this.props;
    axios.get(`/api/info/${params.id}`)
}

but how can i get request on server side? how can express access that "id" to search it in database and query data with it to send back to client? like:
app.get('/api/info/:id', async (req,res)=>{
   await db.find({id: req.params.id}, (data) =>{
      res.status(200).send({data})
   })
})

Any help? Thanks!

A: From the component itself same as the GET use your param and call your service same thing to POST
postUserInfo = () => {
  const userInfo ={};
  axios.post(`/api/info/${params.id}`,userInfo).then(()=>{
      console.log("user info posted");
  })
}

Example:
 <Form onSubmit={this.postUserInfo}> </form>


text:
Q: deepwater with tensorflow on RHEL6 I am trying to get Python + deepwater + tensorflow to run on RHEL 6.7.  Using conda, I have installed python 3.6.0, tensorflow 1.1.0 and also gcc 4.8.5.  TF is working fine.
I have installed the following libraries using pip install: h2o-3.11.0.3904-py2.py3-none-any.whl and h2o-3.11.0-py2.py3-none-any.whl.
I tried to run the following example from the h2o tutorial
import h2o
from h2o.estimators.deepwater import H2ODeepWaterEstimator

h2o.init()

train = h2o.import_file("https://h2o-public-test-data.s3.amazonaws.com/bigdata/laptop/mnist/train.csv.gz")

features = list(range(0,784))
target = 784

train[target] = train[target].asfactor()

model = H2ODeepWaterEstimator(epochs=100, activation="Rectifier", hidden=[200,200], ignore_const_cols=False,
    mini_batch_size=256, input_dropout_ratio=0.1, hidden_dropout_ratios=[0.5,0.5], stopping_rounds=3,
    stopping_tolerance=0.05, stopping_metric="misclassification", score_interval=2, score_duty_cycle=0.5,
    score_training_samples=1000, score_validation_samples=1000, nfolds=5, gpu=False, seed=1234, backend="tensorflow")

model.train(x=features, y=target, training_frame=train)

The following exception is thrown
Exception: Unable to initialize the native Deep Learning backend: Cannot find TensorFlow native library for OS: linux, architecture: x86_64. See https://github.com/tensorflow/tensorflow/tree/master/java/README.md for possible solutions (such as building the library from source).

Is there anything else that I am missing?  Would I need to build the bits from scratch for this platform?


text:
Q: How to open a root window, close it and then open another window in tkinter after a few seconds? I have made a GUI using Tkinter for my Python script for a Voice Assistant. It is working pretty well. But I want to add an animation window to display an animation that I have created using After Effects as an intro to the app. I want it to open without the default close(x), maximize and minimize buttons. The window should stay till the animation is completed, and then it would disappear. The main window would then open normally to launch the GUI. To disable the close, maximize and minimize buttons I have used the root.overrideredirect(True) method. But I am not being able to simultaneously open the two windows one after the other as mentioned. I would be highly obliged if somebody would help me out with this! I have tested it with a code on a simple GUI. I am providing the code below for help with the problem!
from tkinter import *
import time

root = Tk()
root.geometry('500x300')
root.overrideredirect(True) # To disable the default Window decoration
time.sleep(5) # Assuming that the animation runs for 5 seconds
root.destroy() # This window destroys after being on screen for 5 seconds
root.mainloop()

root2 = Tk() # After the previous window is destroyed, this window opens up. Assume that this is the main window
root2.geometry('500x300')
root.mainloop()

Please help me out!

A: The thing you call "animation window" is actually called "splash". There is a way to do what you want. You need to create a root window for the app (a Tk instance), and then you should hide (root.withdraw()) it. Now create a Toplevel for the splash, wait for 5 seconds, destroy it, and show (root.deiconify()) the Tk window again.
Note: time.sleep(5) should never be used with Tkinter, use root.after(ms, func) instead.
from tkinter import *

def show_splash():
    splash = Toplevel()
    splash.geometry('500x300')
    splash.overrideredirect(True) # To disable the default Window decoration
    splash.after(5000, splash.destroy) # This window destroys after being on screen for 5 seconds
    splash.wait_window()

root = Tk()
root.withdraw()
show_splash()
root.deiconify()
root.mainloop()

PS: Procedural programming is not a good idea for pretty complex Tkinter-based apps. You should consider using OOP instead.
PPS: Take a look at this and this answers.


text:
Q: How to get the value of entire dynamic row in PHP? I have a table that is being populated by a given sql query, that has a radio button at the end.
How can i get the entire row value of a selected radio button passed to a different page?
results=mysqli_query($conn,$sqlitem);
while ($dat=mysqli_fetch_assoc($results)){

 echo "
";

 echo "".$dat['sellername']."	";
 echo "".$dat['itemname']."	";
 echo "".$dat['maker']."	";
 echo "".$dat['details']."	";
 echo "".$dat['condition']."	";
 echo "".$dat['price']."	";
 echo " <input type='radio' name='selc' width ='5px'> 	";

echo "
";
}

I have tried various combinations but for some reason the entire row value doesn't come. The last and closest option that I tried was this SOMETHING CLOSELY SIMILAR
I took the script portion and updated still isn't working. I believe there should be some solution for this.

A: You should probably use the MySQL primary key for each row, pass that info to the next page and have PHP perform a query for that item on the new page rather than explicitly passing content around from page to page.
That said, you can keep track of the order that you are echoing the keys in an array, then use that array to turn the row into an object:
var keys = ['sellername','itemname','maker','details','condition','price'];
$('input[type=radio]').on('change', function(event) {
   if (this.checked) {
      var $tr = $(this).closest('tr');
      var $cells = $tr.find('td');
      var obj = {};
      $.each($cells, function(index, cell) {
         obj[keys[index]] = cell.textContent;
      });
      console.log('row data', obj);
   }
});

Note this is untested, but just demonstrates how you can match up an array of key names to the index their data can be found in a table cell


text:
Q: JScrollPane inside a JScrollPane I am trying to add a JScrollPane inside another JScrollPane.
The inner JScrollPane are only going to scroll HORIZONTAL and the outer are only going to scroll VERTICAL.
In this picture you can see that the horizontal scroller works when adding mainPanel(but have not added horizontal scroller here yet)

Here is how it looks when adding outerVerticalScroller to the JFrame (the horizontal bar is gone):

Any idea how this could be done?
If I skip the mainPanel and instead type:
JScrollPane outerVerticalScroller = new JScrollPane(panelScroller, JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED, JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);

Then it looks perfect with both scrollers:

But I need that extra "mainPanel". Any ideas?
public class ScrollersTest extends JFrame {

    public ScrollersTest() {
        super("A JScrollPane inside a JScrollPane");
        setDefaultCloseOperation(EXIT_ON_CLOSE);
        init();
        setVisible(true);
        pack();
    }

    public void init() {
        ScrollablePanel panelScroller = new ScrollablePanel(new GridBagLayout());
        panelScroller.setScrollableWidth(ScrollablePanel.ScrollableSizeHint.FIT);

        GridBagConstraints c = new GridBagConstraints();

        // INNER SCROLLPANE: ONLY SCROLL HORIZONTAL
        JTextArea innerText = new JTextArea("This text is inside a JScrollPane of its own. But no scroller is shown when the frames size is decreased. Wrong viewPort?....................................");
        JScrollPane innerHorizantalScroller = new JScrollPane(innerText, JScrollPane.VERTICAL_SCROLLBAR_NEVER, JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
        c.fill = GridBagConstraints.HORIZONTAL;
        c.weightx = 1;
        panelScroller.add(innerHorizantalScroller, c);

        // SET SIZE OF SCROLLER HEIGHT
        Dimension d = innerHorizantalScroller.getPreferredSize();
        innerHorizantalScroller.setPreferredSize(new Dimension(d.width, d.height * 2));
        innerHorizantalScroller.setMinimumSize(new Dimension(0, d.height * 2));

        // EXTRA PANEL NEEDED (BUT MAKES HORIZANTAL SCROLLING DISAPEAR)
        JPanel mainPanel = new JPanel(new BorderLayout());
        mainPanel.add(panelScroller, BorderLayout.CENTER);

        // THE FRAME SCROLLPANE: ONLY SCROLL VERTICAL
        JScrollPane outerVerticalScroller = new JScrollPane(mainPanel, JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED, JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
        // WORKS BUT NO MAINPANEL
        // JScrollPane outerVerticalScroller = new JScrollPane(panelScroller, JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED, JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);

        getContentPane().add(outerVerticalScroller, BorderLayout.CENTER);
        // getContentPane().add(mainPanel, BorderLayout.CENTER); // WORKS_BUT_NO_VERTICAL_SCROLL
    }

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

    static class ScrollablePanel extends JPanel implements Scrollable, SwingConstants {
        public enum ScrollableSizeHint {
            NONE, FIT, STRETCH;
        }

        public enum IncrementType {
            PERCENT, PIXELS;
        }

        private ScrollableSizeHint scrollableHeight = ScrollableSizeHint.NONE;
        private ScrollableSizeHint scrollableWidth = ScrollableSizeHint.NONE;

        private IncrementInfo horizontalBlock;
        private IncrementInfo horizontalUnit;
        private IncrementInfo verticalBlock;
        private IncrementInfo verticalUnit;

        /**
         * Default constructor that uses a FlowLayout
         */
        public ScrollablePanel() {
            this(new FlowLayout());
        }

        /**
         * Constuctor for specifying the LayoutManager of the panel.
         *
         * @param layout
         *            the LayountManger for the panel
         */
        public ScrollablePanel(LayoutManager layout) {
            super(layout);

            IncrementInfo block = new IncrementInfo(IncrementType.PERCENT, 100);
            IncrementInfo unit = new IncrementInfo(IncrementType.PERCENT, 10);

            setScrollableBlockIncrement(HORIZONTAL, block);
            setScrollableBlockIncrement(VERTICAL, block);
            setScrollableUnitIncrement(HORIZONTAL, unit);
            setScrollableUnitIncrement(VERTICAL, unit);
        }

        /**
         * Get the height ScrollableSizeHint enum
         *
         * @return the ScrollableSizeHint enum for the height
         */
        public ScrollableSizeHint getScrollableHeight() {
            return scrollableHeight;
        }

        /**
         * Set the ScrollableSizeHint enum for the height. The enum is used to
         * determine the boolean value that is returned by the
         * getScrollableTracksViewportHeight() method. The valid values are:
         *
         * ScrollableSizeHint.NONE - return "false", which causes the height of
         * the panel to be used when laying out the children
         * ScrollableSizeHint.FIT - return "true", which causes the height of
         * the viewport to be used when laying out the children
         * ScrollableSizeHint.STRETCH - return "true" when the viewport height
         * is greater than the height of the panel, "false" otherwise.
         *
         * @param scrollableHeight
         *            as represented by the ScrollableSizeHint enum.
         */
        public void setScrollableHeight(ScrollableSizeHint scrollableHeight) {
            this.scrollableHeight = scrollableHeight;
            revalidate();
        }

        /**
         * Get the width ScrollableSizeHint enum
         *
         * @return the ScrollableSizeHint enum for the width
         */
        public ScrollableSizeHint getScrollableWidth() {
            return scrollableWidth;
        }

        /**
         * Set the ScrollableSizeHint enum for the width. The enum is used to
         * determine the boolean value that is returned by the
         * getScrollableTracksViewportWidth() method. The valid values are:
         *
         * ScrollableSizeHint.NONE - return "false", which causes the width of
         * the panel to be used when laying out the children
         * ScrollableSizeHint.FIT - return "true", which causes the width of the
         * viewport to be used when laying out the children
         * ScrollableSizeHint.STRETCH - return "true" when the viewport width is
         * greater than the width of the panel, "false" otherwise.
         *
         * @param scrollableWidth
         *            as represented by the ScrollableSizeHint enum.
         */
        public void setScrollableWidth(ScrollableSizeHint scrollableWidth) {
            this.scrollableWidth = scrollableWidth;
            revalidate();
        }

        /**
         * Get the block IncrementInfo for the specified orientation
         *
         * @return the block IncrementInfo for the specified orientation
         */
        public IncrementInfo getScrollableBlockIncrement(int orientation) {
            return orientation == SwingConstants.HORIZONTAL ? horizontalBlock : verticalBlock;
        }

        /**
         * Specify the information needed to do block scrolling.
         *
         * @param orientation
         *            specify the scrolling orientation. Must be either:
         *            SwingContants.HORIZONTAL or SwingContants.VERTICAL.
         * @paran type specify how the amount parameter in the calculation of
         *        the scrollable amount. Valid values are: IncrementType.PERCENT
         *        - treat the amount as a % of the viewport size
         *        IncrementType.PIXEL - treat the amount as the scrollable
         *        amount
         * @param amount
         *            a value used with the IncrementType to determine the
         *            scrollable amount
         */
        public void setScrollableBlockIncrement(int orientation, IncrementType type, int amount) {
            IncrementInfo info = new IncrementInfo(type, amount);
            setScrollableBlockIncrement(orientation, info);
        }

        /**
         * Specify the information needed to do block scrolling.
         *
         * @param orientation
         *            specify the scrolling orientation. Must be either:
         *            SwingContants.HORIZONTAL or SwingContants.VERTICAL.
         * @param info
         *            An IncrementInfo object containing information of how to
         *            calculate the scrollable amount.
         */
        public void setScrollableBlockIncrement(int orientation, IncrementInfo info) {
            switch (orientation) {
            case SwingConstants.HORIZONTAL:
                horizontalBlock = info;
                break;
            case SwingConstants.VERTICAL:
                verticalBlock = info;
                break;
            default:
                throw new IllegalArgumentException("Invalid orientation: " + orientation);
            }
        }

        /**
         * Get the unit IncrementInfo for the specified orientation
         *
         * @return the unit IncrementInfo for the specified orientation
         */
        public IncrementInfo getScrollableUnitIncrement(int orientation) {
            return orientation == SwingConstants.HORIZONTAL ? horizontalUnit : verticalUnit;
        }

        /**
         * Specify the information needed to do unit scrolling.
         *
         * @param orientation
         *            specify the scrolling orientation. Must be either:
         *            SwingContants.HORIZONTAL or SwingContants.VERTICAL.
         * @paran type specify how the amount parameter in the calculation of
         *        the scrollable amount. Valid values are: IncrementType.PERCENT
         *        - treat the amount as a % of the viewport size
         *        IncrementType.PIXEL - treat the amount as the scrollable
         *        amount
         * @param amount
         *            a value used with the IncrementType to determine the
         *            scrollable amount
         */
        public void setScrollableUnitIncrement(int orientation, IncrementType type, int amount) {
            IncrementInfo info = new IncrementInfo(type, amount);
            setScrollableUnitIncrement(orientation, info);
        }

        /**
         * Specify the information needed to do unit scrolling.
         *
         * @param orientation
         *            specify the scrolling orientation. Must be either:
         *            SwingContants.HORIZONTAL or SwingContants.VERTICAL.
         * @param info
         *            An IncrementInfo object containing information of how to
         *            calculate the scrollable amount.
         */
        public void setScrollableUnitIncrement(int orientation, IncrementInfo info) {
            switch (orientation) {
            case SwingConstants.HORIZONTAL:
                horizontalUnit = info;
                break;
            case SwingConstants.VERTICAL:
                verticalUnit = info;
                break;
            default:
                throw new IllegalArgumentException("Invalid orientation: " + orientation);
            }
        }

        // Implement Scrollable interface

        public Dimension getPreferredScrollableViewportSize() {
            return getPreferredSize();
        }

        public int getScrollableUnitIncrement(Rectangle visible, int orientation, int direction) {
            switch (orientation) {
            case SwingConstants.HORIZONTAL:
                return getScrollableIncrement(horizontalUnit, visible.width);
            case SwingConstants.VERTICAL:
                return getScrollableIncrement(verticalUnit, visible.height);
            default:
                throw new IllegalArgumentException("Invalid orientation: " + orientation);
            }
        }

        public int getScrollableBlockIncrement(Rectangle visible, int orientation, int direction) {
            switch (orientation) {
            case SwingConstants.HORIZONTAL:
                return getScrollableIncrement(horizontalBlock, visible.width);
            case SwingConstants.VERTICAL:
                return getScrollableIncrement(verticalBlock, visible.height);
            default:
                throw new IllegalArgumentException("Invalid orientation: " + orientation);
            }
        }

        protected int getScrollableIncrement(IncrementInfo info, int distance) {
            if (info.getIncrement() == IncrementType.PIXELS)
                return info.getAmount();
            else
                return distance * info.getAmount() / 100;
        }

        public boolean getScrollableTracksViewportWidth() {
            if (scrollableWidth == ScrollableSizeHint.NONE)
                return false;

            if (scrollableWidth == ScrollableSizeHint.FIT)
                return true;

            // STRETCH sizing, use the greater of the panel or viewport width

            if (getParent() instanceof JViewport) {
                return (((JViewport) getParent()).getWidth() > getPreferredSize().width);
            }

            return false;
        }

        public boolean getScrollableTracksViewportHeight() {
            if (scrollableHeight == ScrollableSizeHint.NONE)
                return false;

            if (scrollableHeight == ScrollableSizeHint.FIT)
                return true;

            // STRETCH sizing, use the greater of the panel or viewport height

            if (getParent() instanceof JViewport) {
                return (((JViewport) getParent()).getHeight() > getPreferredSize().height);
            }

            return false;
        }

        /**
         * Helper class to hold the information required to calculate the scroll
         * amount.
         */
        static class IncrementInfo {
            private IncrementType type;
            private int amount;

            public IncrementInfo(IncrementType type, int amount) {
                this.type = type;
                this.amount = amount;
            }

            public IncrementType getIncrement() {
                return type;
            }

            public int getAmount() {
                return amount;
            }

            public String toString() {
                return "ScrollablePanel[" + type + ", " + amount + "]";
            }
        }
    }
}

A: Based on your answer to ItachiUchiha's comment in the OP, it simply sounds like you want scrollable text, that's on a scrollable JPanel.
Instead of using a JLabel, how about using a JTextArea (decorated like a label) which is better suited for scrolling text?
With very little modifications to your existing code:
import java.awt.*;
import javax.swing.*;

public class ScrollersTest extends JFrame {
  public static void main(String args[]) {
    new ScrollersTest();
  }

  public ScrollersTest() {
    super("A JScrollPane inside a JScrollPane");
    setDefaultCloseOperation(EXIT_ON_CLOSE);
    init();
    pack();
    setVisible(true);
  }

  public void init() {
    JPanel p = new JPanel(new GridBagLayout());
    GridBagConstraints c = new GridBagConstraints();

    String text = "This text is inside a JScrollPane of its own. "
        + "But no scroller is shown when the frames size is decreased. "
        + "Wrong viewPort?....................................";

    // INNER SCROLLPANE:
    JTextArea innerText = new JTextArea(1, 20);
    innerText.setText(text);
    innerText.setEditable(false);
    innerText.setOpaque(false);

    JScrollPane innerScroller = new JScrollPane(innerText,
        JScrollPane.VERTICAL_SCROLLBAR_NEVER, JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS);
    p.add(innerScroller);

    // FRAMES SCROLLPANE: ONLY SCROLL VERTICAL
    JScrollPane frameScrollpane = new JScrollPane(p,
        JScrollPane.VERTICAL_SCROLLBAR_ALWAYS, JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
    getContentPane().add(frameScrollpane, BorderLayout.CENTER);
  }
}

A:
JScrollPane. The inner JScrollPane are only going to scroll HORIZONTAL

Then I think you need to force the components to fit in the viewport. You can do this by implementing the Scrollable interface for your panel. Or, an easier approach is to use the Scrollable Panel which does all the work for you.
import java.awt.*;
import java.awt.GridBagConstraints;
import java.awt.GridBagLayout;

import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JScrollPane;

public class ScrollersTest extends JFrame {

    public ScrollersTest() {
        super("A JScrollPane inside a JScrollPane");
        setDefaultCloseOperation(EXIT_ON_CLOSE);
        init();
        setVisible(true);
        pack();
    }

    public void init() {
//        JPanel p = new JPanel(new GridBagLayout());
        ScrollablePanel p = new ScrollablePanel( new BorderLayout() );
        p.setScrollableWidth( ScrollablePanel.ScrollableSizeHint.FIT );

        GridBagConstraints c = new GridBagConstraints();

        // INNER SCROLLPANE: ONLY SCROLL HORIZONTAL: DOSE NOT WORK...
        JLabel innerText = new JLabel("This text is inside a JScrollPane of its own. But no scroller is shown when the frames size is decreased. Wrong viewPort?....................................");
        JScrollPane innerScroller = new JScrollPane(innerText, JScrollPane.VERTICAL_SCROLLBAR_NEVER, JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
        Dimension d = innerScroller.getPreferredSize();
        innerScroller.setPreferredSize( new Dimension(d.width, d.height * 2) );
//        p.add(innerScroller, c);
        p.add(innerScroller, BorderLayout.NORTH);

        // FRAMES SCROLLPANE: ONLY SCROLL VERTICAL
        JScrollPane frameScrollpane = new JScrollPane(p, JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED, JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
        getContentPane().add(frameScrollpane, BorderLayout.CENTER);
    }

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

I used a BorderLayout in this example because it is simpler to use. If you want to use a GridBagLayout then you need to configure the constraints properly so that the component grows/shrinks in a reasonable manner. When you use the defaults the component will just default to its minimum size which is (0, 0) so you just see a small rectangle on the frame.

A:    import java.awt.BorderLayout;
   import java.awt.GridBagConstraints;
   import java.awt.GridBagLayout;
   import javax.swing.JFrame;
   import javax.swing.JLabel;
   import javax.swing.JPanel;
   import javax.swing.*;
   import java.awt.*;

 class ScrollersTest {
 public static void main(String args[]) {
 JFrame frame = new JFrame("Tabbed Pane Sample");
 frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
 JTextArea innerText = new JTextArea("This text is inside a JScrollPane of its own."
        +" But no scroller is shown when the frames size is decreased. Wrong viewPort?....................................\n"
        +" But no scroller is shown when the frames size is decreased. Wrong viewPort?....................................\n"
        +" But no scroller is shown when the frames size is decreased. Wrong viewPort?....................................\n");
innerText.setBounds(100,100,500,500);
JScrollPane innerScroller = new JScrollPane(innerText);
innerScroller.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
innerScroller.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED);
JPanel p = new JPanel(new GridBagLayout());
p.add(innerScroller);
JScrollPane jScrollPane = new JScrollPane(p);
jScrollPane.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
jScrollPane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED);
frame.add(jScrollPane, BorderLayout.CENTER);
frame.setSize(400, 150);
frame.setVisible(true);
  }
}


text:
Q: How to monitor cron tasks and get emails when they don't run? I realize that when any cron has output it will email that output... what I'm trying to determine is that if I have a script scheduled for 3 AM on Tuesday and for whatever reason it either throws an error or fails to run, I'd like to know...
I'm thinking right now of setting up a database table that stores last run timestamps for each cron command and we get weekly report for the cron commands.  Or possibly storing in the database when it should run and when it last ran, if there's a problem it'd email us.
The "emailing" would be done by our internal systems where our employees are consistently logging in so it wouldn't be based off of cron itself.
Is there a better solution?

A: I think monitoring syslog would be the easiest solution.
Have your syslogs forward to your monitoring system, and then set up alerts within your monitoring system.
I've also set up custom SNMP MIBs in the past, which you could put the timestamp of the last time that particular cronjob has run. Then some external system could monitor that snmp MIB for a timestamp older than 24 hours.

A: Your solution is workable, but it reinvents some wheels that you probably don't need to.
First, you should really have some type of monitoring service.  I tend to use nagios, but there's a ton out there.  Choose one of those systems and have it monitor your cron daemon.
Then write a plugin that will utilize the wrappers that voretaq7 mentioned.  You will have an alert if the cronjob fails and if crond also fails.
The reason I suggest this is that you'll have all your monitoring in one place.  You'll eventually have to have a site wide monitoring system and it makes more sense to put your effort into that rather than having a scattered series of monitoring systems in place.

A: I built a simple tool for this type of monitoring - https://cronitor.io
It allows you to set both intervals (every 24 hours) and durations (greater than 10 minutes, less than 2 minutes, etc), and then receive email/SMS alerts if your cron job (or any other automated task) doesn't run according to the rules you defined.
The tool is free for individual monitors and paid plans are available for those with multiple monitoring needs.

A: Your solution sounds OK based on your environment, but it might be a bit of overkill (unless you need to be able to audit the history of this job over the long term, in which case the database bit might make sense).
Another option to consider is simply wrapping your cron jobs in a check script (if the cron job exits with an error status (!=0) send an email, or generate output and let cron send the email for you).

A: Your solution sounds a little more complicated than I think it needs to be.
Start with reviewing and/or monitoring /var/log/cron.log (or wherever your cron logs are going).  cron does a good job of logging every command that it runs, along with errors.  If you want to know what happened, that's the place to look.  If you're worried about cron dying, you can setup a cron'ed heartbeat that just logs every 5 minutes, and if you don't see the heartbeat, send some sort of alert.  If you really feel like you need a second tool keeping an eye on cron, there's a perl package (Schedule::Cron) that you could use to regularly check your heartbeat.  If you're that worried about the local machine's reliability, you can also send the logs to a second machine for monitoring/processing/alerting/etc.
Alternately, you could just use some sort of system monitoring tool (SNMP, Nagios, Hobbit/BigSister, etc) to externally monitor that the cron process is running.  You do monitor your systems' health, right?
Although, if you're really that worried about cron dying, you might want to look into rebuilding or replacing your machine.  cron should be pretty reliable, and if it's failing, it's probably a symptom of a bigger problem.

A: I have a dealt with a similar requirement:
The script run by cron sends it's output to the logger command. logger sends a syslog message to the Local4 facility,  which is handled by rsyslog.  The local4.* is then sent to a remote Syslog listener - in my case,  a Splunk instance.   Splunk has a saved search which fires email alerts if the events do not happen within the expected time window. In addition to the alerts, Splunk also gives me a nice searchable historical timeline of the events.

A: You can use PushMon and create a URL with a "by 3:30 AM every Tue" schedule. Then "ping" the PushMon URL when your script runs successfully. If the PushMon URL doesn't get called because the machine is off, or cron failed to run (it happens), or your script fails, PushMon will alert you by 3:30 AM. You can get alerted by email, SMS, phone, IM or Twitter, and the service is free.
Disclaimer: I am associated with PushMon.

A: Try healthchecks.io, it is an excellent free and open source solution. You can even host it if you want.


text:
Q: Is there a way to dynamically set a size for a string we get from fgets()? I have a variable char *cmd and I want to store a string in this from fgets(). Is there a way to dynamically allocate memory using malloc or something similar for this variable? Or do I have to predefine its size and null terminate after?
Before, I had the size of cmd predefined to 100 but I was trying to find where I was getting a segmentation fault.
char *cmd;

fgets(cmd, n, stdin);
I am then trying to tokenize the cmd string using strtok() with whitespace as the delimiter.

A: As I said in a comment above, this isn't a built-in feature of standard C, although there is a POSIX function that does what you're looking for.  If you want to roll your own, the way to do it is to dynamically allocate (and reallocate) memory to store the results you get from fgets().  You can tell when fgets() reaches the end of the line because it'll either abruptly reach the end of the file (in which case it will return NULL) or because the last character it returns will be the newline.
Here's an example function.  Note that I use strrchr() to search backwards from the end of the buffer for a newline character.  If we get a hit, we make sure to toss out the newline in our returned string, and make sure to break out of the while() loop so that we don't call fgets() again and start getting the next line.
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

// NOTE:  dygetline() allocates memory!  Do not disregard the return and
// remember to free() it when you're done!

#define BSZ 1024

char *dygetline(FILE * restrict stream) {
  char *ret = NULL;
  char *temp = NULL;
  size_t retalloc = 1;
  char buffer[BSZ];
  size_t buflen = 0;
  char *nlsrch;

  while (NULL != fgets(buffer, BSZ, stream)) {
    nlsrch = strrchr(buffer, '\n');

    if (nlsrch) *nlsrch = '\0';     // Remove newline if exists

    // Get the size of our read buffer and grow our return buffer
    buflen = strlen(buffer);
    temp = realloc(ret, retalloc + buflen);

    if (NULL == temp) {
      fprintf(stderr, "Memory allocation error in dygetline()!\n");
      free(ret);
      return NULL;
    }

    ret = temp;                     // Update return buffer pointer

    strcpy((ret+retalloc-1), buffer);  // Add read buffer to return buffer
    retalloc = retalloc + buflen;      // Housekeeping

    if (nlsrch) break;              // If we got a newline, stop
  }

  // If there was a file read error and fgets() never got anything, then
  // ret will still be NULL, as it was initialized.  If the file ended
  // without a trailing newline, then ret will contain all characters it
  // was able to get from the last line.  Otherwise, it should be well-
  // formed.

  return ret;
}


text:
Q: Can't install gems with rvm as non-root user $ gem install sinatra
Fetching: rack-1.5.2.gem (100%)
ERROR:  While executing gem ... (Gem::FilePermissionError)
    You don't have write permissions for the /usr/local/rvm/gems/ruby-2.0.0-p0 directory.

On my /etc/profile I already inserted:
source /usr/local/rvm/scripts/rvm

Note: I'm using vagrant, and the group:user is admin:vagrant. Also, if this is relevant:
$ echo $GEM_HOME
/usr/local/rvm/gems/ruby-2.0.0-p0

A: try add this line: gem: --user-install in $HOME/.gemrc file.

A: use rvm gem install sinatra. Don't use sudo it can cause problems.


text:
Q: Proving that $3^{n+2}$ does not divide $2^{3^n} +1$ for any positive integer $n$ Proving that $3^{n+2}$ does not divide $2^{3^n} +1$ for any positive integer $n$
I am thinking of applying inductionon $n$ but am not being successful.

A: By induction.  Let $S_n=2^{3^n}+1$ We claim that $v_3(S_n)={n+1}$.  Easily seen for small $n$.
Notation:  here, as is fairly standard, we are writing $v_p(n)$ for prime $p$ and natural number $n$ to indicate the maximal power of $p$ which divides $n$. Thus, with $n=1$ we have  $$S_1=2^3+1=9=3^2\implies v_3(S_1)=2=1+1$$ as claimed.
Similarly,$$S_2=2^9+1=513=3^3\times 19 \implies v_3(S_2)=3=2+1$$ as claimed.
And again,  $$S_3=2^{27}+1=134217729=3^4\times 19\times 87211\implies v_3(S_3)=4=3+1$$ as claimed.
Proof:  Suppose it is true for $n-1$.  That is, assume that $$v_3(S_{n-1})=(n-1)+1=n$$  Then we write $$S_n=(2^{3^{n-1}})^3+1=\left(S_{n-1}-1\right)^3+1=S_{n-1}^3-3S_{n-1}^2+3S_{n-1}$$ It is clear that $3^{n+2}$ divides each of the first two terms but only $3^{n+1}$ divides the third, so we are done.

A: Suppose $\left.3^{n+1}\,\middle|\,2^{3^n}+1\right.$ and $\left.3^{n+2}\not\,\middle|\,\,2^{3^n}+1\right.$; that is $2^{3^n}+1$ has exactly $n+1$ factors of $3$. Then
$$
\begin{align}
\left(2^{3^n}+1\right)^3
&=2^{3^{n+1}}+3\cdot2^{2\cdot3^n}+3\cdot2^{3^n}+1\\
&=2^{3^{n+1}}+3\cdot2^{2\cdot3^n}\left(2^{2\cdot3^n}+1\right)+1
\end{align}
$$
Therefore,
$$
2^{3^{n+1}}+1=\overbrace{\left(2^{3^n}+1\right)^3}^{\substack{\text{exactly }3n+3\\\text{ factors of }3}}-\overbrace{3\cdot2^{2\cdot3^n}\left(2^{2\cdot3^n}+1\right)\vphantom{\left(2^{3^n}\right)^3}}^{\substack{\text{exactly }n+2\\\text{ factors of }3}}
$$
has exactly $n+2$ factors of $3$. Since this holds for $n=0$, for all $n\ge0$,
$$
\left.3^{n+1}\,\middle|\,2^{3^n}+1\right.\quad\text{and}\quad\bbox[5px,border:2px solid #C0A000]{\left.3^{n+2}\not\,\middle|\,\,2^{3^n}+1\right.}
$$

A: Another way of looking at @lulu's proof:
For odd $p$, look at $\Bbb Q_p$, and a nonzero root $\zeta$ of $X^p-X$, that is a $(p-1)$-th root of unity. Let $u$ be a unit of $\Bbb Z_p$, i.e. $v_p(u)=0$, and $n\ge1$. Then $(\zeta+p^nu)^p=\zeta+p^{n+1}u'$ for some unit $u'\in\Bbb Z_p$. For, $(\zeta+p^nu)^p=\zeta+p\zeta^{p-1}p^nu+(\text{middle terms})+p^{\,pn}u^p$, where the "middle terms" all have a factor $p$ from the binomial coefficient, and at least $p^{2n}$ from powers of $p^nu$.
For the application, $p=3$, $\zeta=-1$, and we see that $v_3(2^{3^n}-(-1))=n+1$.

A: For a short analysis let's introduce the notation of curly braces $ \{a,p\} =k $ meaning that $a$ contains the factor $p$ to the $k$'th power, and let's as well introduce the "Iverson brackets" $[a:b]=k$ meaning that $k=1$ if $b$ divides $a$ and $k=0$ if $b$ does not divide $a$.   (See here for a detailed essay on the motivation of this notation and its application)

In general, for some integer $m$ we have the primefactor $3$ in the expression $2^m-1$ according to the following formula:
$$ \{ 2^m -1, 3\} = [m:2](1+\{m,3\}) \tag 1$$
Now we have the well known composition $ 2^m+1 = (2^{2m}-1) / (2^m-1)$ and thus can derive for some integer $m$:
$$\begin{array}{} \{ 2^m +1, 3\} &= [2m:2](1 + \{2m,3\})-[m:2](1 + \{m,3\}) \\
&=1 \cdot (1+\{m,3\})-[m:2] \cdot (1+\{m,3\})\\
&=(1-[m:2])(1+\{m,3\}) \end{array} \tag 2$$
Now we assume $m=3^n$ and get
$$\begin{array}{} \{ 2^{3^n} +1, 3\} &=  (1-[3^n:2])(1+\{3^n,3\})
 \\ &=  (1-0)(1+ n) \\
   &= 1+n \end{array} \tag 3$$
Thus we know, that the primefactor $3$ occurs  to the ($1+n$'th) power (meaning $(2^{3^n}+1)=3^{1+n} \cdot x$ where $ 3 \not | x$)  and not to the ($2+n$'th) power


text:
Q: Linux "screen" does not write results I have an Ubuntu system running on a remote computer that I use for computations. On other machines whenever I want to run some time-consuming program I type:
screen

and execute my program in the resulting screen, say:
./myprogram input.xml

The program in question writes some results to an output file. This works fine on other machines.
When I try the same in the remote computer, everything is the same apart from one thing. If I close the window where the screen is running, my program stop writing results to an output file (it will also stop reading files from disk). As long as I look at the terminal window where the screen is running and the program is executing, there are no problems.
Can anyone offer some insight into why this happens and how it may be fixed?

A: Try
nohup & ./myprogram input.xml

Or rather disown,
disown & ./myprogram input.xml


text:
Q: Zoneminder unmet dependencies Im trying to install zoneminder on ubuntu 16.04 server and I get this unmet dependencies error. How can I correct this?
root@tpadzm:/home/joey# apt-get install zoneminder
Reading package lists... Done
Building dependency tree
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:

The following packages have unmet dependencies:
zoneminder : Depends: libavcodec57 (>= 7:3.4.2) but it is not installable or
                   libavcodec-extra57 (>= 7:3.4.2) but it is not installable
          Depends: libavformat57 (>= 7:3.4.2) but it is not installable
          Depends: libavresample3 (>= 7:3.4.2) but it is not installable
          Depends: libavutil55 (>= 7:3.4.2) but it is not installable
          Depends: libmp4v2-2 but it is not installable
          Depends: libswscale4 (>= 7:3.4.2) but it is not installable
          Depends: libvlc5 (>= 1.1.1) but it is not installable
          Depends: libx264-152 but it is not installable
          Depends: libjs-mootools (>= 1.4.5~debian1) but it is not
          installable
          Depends: ffmpeg but it is not installable or
                   libav-tools but it is not installable
          Depends: libdbd-mysql-perl but it is not installable
          Depends: libphp-serialization-perl but it is not installable
          Depends: libnet-sftp-foreign-perl but it is not installable
          Depends: libdevice-serialport-perl but it is not installable
          Depends: libimage-info-perl but it is not installable
          Depends: libjson-any-perl but it is not installable
          Depends: libsys-mmap-perl but it is not installable
          Depends: liburi-encode-perl but it is not installable
          Depends: libclass-std-fast-perl but it is not installable
          Depends: libsoap-wsdl-perl but it is not installable
          Depends: libio-socket-multicast-perl but it is not installable
          Depends: libsys-cpu-perl but it is not installable
          Depends: libsys-meminfo-perl but it is not installable
          Depends: libdata-uuid-perl but it is not installable
          Depends: libnumber-bytes-human-perl but it is not installable
          Depends: libfile-slurp-perl but it is not installable
          Depends: php5-apcu but it is not installable or
                   php-apcu but it is not installable
          Depends: php-apc but it is not installable or
                   php-apcu-bc but it is not installable
          Recommends: zoneminder-doc (>= 1.31.45~20180731103016-bionic) but
it is not going to be installed
          Recommends: ffmpeg but it is not installable
E: Unable to correct problems, you have held broken packages.
root@tpadzm:/home/joey# apt install libavcodec57
Reading package lists... Done
Building dependency tree
Reading state information... Done
Package libavcodec57 is not available, but is referred to by another
package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source

E: Package 'libavcodec57' has no installation candidate
root@tpadzm:/home/joey# cat /etc/apt/sources.list
deb http://archive.ubuntu.com/ubuntu bionic main
deb http://archive.ubuntu.com/ubuntu bionic-security main
deb http://archive.ubuntu.com/ubuntu bionic-updates main
root@tpadzm:/home/joey#

A: OK, first of all you have wrong sources.list that includes only main channel. So, do sudo gedit /etc/apt/sources.list and make it look like this:
deb http://archive.ubuntu.com/ubuntu bionic main multiverse restricted universe
deb http://archive.ubuntu.com/ubuntu bionic-security main multiverse restricted universe
deb http://archive.ubuntu.com/ubuntu bionic-updates main multiverse restricted universe

Save and exit.
Then update your repository:
sudo apt update


text:
Q: I am getting a module error in my django project I am building a new django application and for some reason I am getting an error while i am trying access the models from the models.py file from the forms.py file.
Here is the error:
  File "/Users/omarjandali/Desktop/MySplit/mysplit/general/forms.py", line 13, in <module>
    from models import *
ModuleNotFoundError: No module named 'models'

Yet I have the general app added to the installed settings. and I have all the models saved. Why is it saying that the module is not there... I am going blank. I know it is a simple answer but for some reason I cant figure it out.
here is the forms.py file:
# all model imports related to this project
from models import *

class LoginForm(forms.Form):
    username = forms.CharField(max_length=20)
    password = forms.CharField(max_length=20, widget=forms.PasswordInput)

here is the models.py file:
from django.db import models
from django.contrib.auth.models import User, UserManager
from localflavor.us.models import USStateField, USZipCodeField

# the following is the users profile model
class Profile(models.Model):
    # users basic info
    user = models.ForeignKey(User, on_delete=models.CASCADE)
    f_name = models.CharField(max_length=25, default='first')
    l_name = models.CharField(max_length=25, default='last')
    bio = models.CharField(max_length=220, default='bio')
    # users location
    street = models.CharField(max_length=200, default='street address')
    city = models.CharField(max_length=100, default='city')
    state = USStateField(default='CA')
    zip_code = USZipCodeField(default=12345)
    # users other profile info
    phone = models.IntegerField(default="000-ooo-oooo")
    dob = models.DateField(default='1950-01-01')
    gender = models.CharField(max_length=5, default='Other')
    # lob = industry/occupation
    lob = models.CharField(max_length=40, default='occupation')
    # dba = Company Name
    dba = models.CharField(max_length=40, default='comapny')
    account_type = models.CharField(max_length=20, default='INDIVIDUAL')
    synapse_id = models.CharField(max_length=200, default='123456789')
    created = models.DateTimeField(auto_now_add=True)

A: from .models import *

you need to provide the . for the path for same directory
also you can give absolute path
from app_name.models import *

A: from <app_name>.models import <class_name>

This will fix the problem. In your case, app_name is "mysplit" most probably
So, you need to import like this :
from mysplit import *

"*" because you are importing everything inside the models.py file
I hope this will resolve your issue


text:
Q: Why are there so few magical protective items in the Wizarding World? There were a bunch of times when some less experienced wizards (read teenagers) were able to temporarily beat much more experienced wizards by an element of surprise. On top of that, wizards were pretty much powerless, if a wand was knocked out of their hands.
This raises a question: Why don't wizards (especially those who have to participate in some battles) wear some magical protective items (to protect from simpler attacks, to get back their wands and so on)?

A: In The Half-Blood Prince, the good guys use the most powerful protection, the only other one that works against Avada Kedavra : Felix Felicis.

"Neville and Professor Flitwick are both hurt, but Madam Pomfrey says they'll be all right. And a Death Eater's dead, he got hit by a Killing Curse that huge blond one was firing off everywhere — Harry, if we hadn't had your Felix potion, I think we'd all have been killed, but everything seemed to just miss us —"

Chapter 29 of The Half-Blood Prince.
You can't resist Avada Kedavra (if your name is not Potter) if you are hit, no matter what magical protection you have. But in order to survive all you have to do is not getting hit.

A: They did. Half Blood Prince, Chapter Six:

"We've just developed this more serious line," said Fred. "Funny how it happened …"
  "You wouldn't believe how many people, even people who work at the Ministry, can't do a decent Shield Charm," said George. " 'Course, they didn't have you teaching them, Harry."
  "That's right. … Well, we thought Shield Hats were a bit of a laugh, you know, challenge your mate to jinx you while wearing it and watch his face when the jinx just bounces off. But the Ministry bought five hundred for all its support staff! And we're still getting massive orders!"
  "So we've expanded into a range of Shield Cloaks, Shield Gloves …"
  "… I mean, they wouldn't help much against the Unforgivable Curses, but for minor to moderate hexes or jinxes …"

It's entirely possible people do use them, and we just don't notice. Harry, as a narrator, doesn't tend to pay attention to this sort of thing.

A: Usually adult wizards, who participate in battles, do use very strong protecting spells can only make well cast spells a little weaker or no weaker at all, like Avada Kedavra. I think that's why, they don't use protective clothes.
  It might be also cheating in battles. Wizards usually do use some kind of rules in their battles.


text:
Q: Making a bookmark using AJAX and PHP So I'm trying to make a bookmark and to pass a number to PHP through javascript and these dont seem to work
function bookmark() {
    var issue = "<?php echo $path; ?>";
    var name = "<?php echo $comicName; ?>";
    var mark = index;
    window.location.href = "UploadedComicViewer.php?issue=" +issue+ "&comic=" +name+ "&page=" + mark;
}

$(".bookmark").on( 'click', function () {
    $.ajax({
        type: 'post',
        url: 'UploadedComicViewer.php',
        data: {
            issue: "some text",
            name: "some text 2",
            page: index
        },
        success: function( data ) {
            console.log( data );
        }
    });
});

The $path and $comicName are variables that hold a value I got using $_GET

A: You use "POST" ajax request, not "GET".
You should retrieve variables via $_POST global variable.


text:
Q: Как организовать работу с проектом под старую ОС? На новой работе дали модернизировать проект на C++ (в том числе Qt 4) под старую ОС (Debian 6).
Дали виртуальную машину, но на такую ОС нет нормальной IDE, нет плюшек в виде современных пакетов с которыми удобнее работать.
Как разработку ведут в таких случаях?
Есть ли такие инструменты, которые бы позволяли работать с кодом из под современной ОС, а запускать и дебажить можно было бы сразу в виртуальной?
Может ещё какие советы дадите. Как делают софт под специфичную ОС?

A: В vscode позволяет работать с кодом, который находится на удалённой машине через специальное расширение.
Однако оно не работает со старой ОС. Поэтому я написал скрипты, которые реализуют тот же функционал.
Скрипты доступны на github.
Скрипты монтируют по SSH директорию с проектом, и отправляют команды сборки  и отладки в удаленную машину.
Сама виртуальная машина работает в тихом режиме. А запуск приложения происходит через технологию SSH forwarding.


text:
Q: How to call a script component from a GameObject that is child to another GameObject, but from other GameObject? In my unity project, I have a GameObject called "Spawn_manager", that has another Child GameObject called "Enemy_Container". The script of Spawn_Manager makes "Enemy" prefabs instantiate inside the "Enemy_Container". I am trying to acess the "Enemy" script(also named Enemy) from another script.
Anyone knows how I can get it?
I tried writing this:
private Enemy _enemy;

private void Start()
{
    _enemy = GameObject.Find("Enemy").GetComponent<Enemy>();
}

But obviously it is not working, but I can't get it to work. Basically, I wanna the script, and the path would be Spawn_Manager>Enemy_Container>Enemy.

A: If you want to make the Enemy easily accessible you can add all spawned Enemy to static list. Like this:
    public class Enemy : MonoBehaviour
    {
        public static List<Enemy> AllEnemy { get; private set; } = new List<Enemy>();

        private void Awake()
        {
            AllEnemy.Add(this);
        }

        private void OnDestroy()
        {
            AllEnemy.Remove(this);
        }
    }

Using Find is demanding and not a reliable operation. If you will have any other GameObjects with name Enemy it will found them instead of desired one.
in this case i think that problem is that after instantiation prefab new GameObject have name in format $"{prefab.name}(Clone)".


text:
Q: PDO php routes not displaying page I have an index page that runs php route but it does't display any page,it just shows me a white blank page. here is my code for the index page
 <?php

ini_set('memory_limit', '-1');

include 'include/connect.php';

     /*
    The following function will strip the script name from URL i.e.  http://www.something.com/search/book/fitzgerald will become /search/book/fitzgerald
    */
    function getCurrentUri()
    {
        $basepath = implode('/', array_slice(explode('/', $_SERVER['SCRIPT_NAME']), 0, -1)) . '/';
        $uri = substr($_SERVER['REQUEST_URI'], strlen($basepath));
        if (strstr($uri, '?')) $uri = substr($uri, 0, strpos($uri, '?'));
        $uri = '/' . trim($uri, '/');
        return $uri;
    }

    $base_url = getCurrentUri();

    $routes = array();
    $routes = explode('/', $base_url);
   /* foreach($routes as $route)
    {
        if(trim($route) != '')
            array_push($routes, $route);
        echo $routes;
    }*/

    /*
    Now, $routes will contain all the routes. $routes[0] will correspond to first route. For e.g. in above example $routes[0] is search, $routes[1] is book and $routes[2] is fitzgerald
    */

    if($routes[1] != ''){

        $pages = array("dashboard", "login", "News", "list-news", "add-users", "list-users","user profile", "category", "signup", "logout", "profile", "change-password", "password", "forgot-password");

            if(in_array($routes[1], $pages)){

                    $page = $routes[1];

            }
            else
            {

            $page = "dashboard";

            }

    }

    else
    {

        $page = "dashboard";

    }

    if ($page == 'login' || $page == 'signup' || $page == 'forgot-password' || $page == 'change-password') {

        if (isset($_SESSION['logged_user'])) {
            //header("location: login");
            require 'include/account_header.php';
            require 'include/topmenu.php';
            require 'include/leftmenu.php';
            require 'pages/'.$page.'.php';

        }

    }
    else
    {

        if (!isset($_SESSION['logged_user'])) {
           // header("location: login");
        }else{

            $name = $_SESSION['xy'];
            $user_id = $_SESSION['xz'];
            $email = $_SESSION['logged_user'];

                $wx=$conn->prepare("SELECT * FROM sysconfig");
                $wx->execute();
                 while($wx->fetch())

                    $_SESSION['dbv'] = $row['varable_name'];
                    $_SESSION['dba'] = $row['varable_value'];
                  //  $_SESSION['logged_user'] = $email;
                    $_SESSION['dbu'] = $row['update_adult'];
                    $_SESSION['dbs'] = $row['IsActive'];
                    $_SESSION['dbc'] = $row['createdon'];
                  //  $_SESSION['xr'] = $row['createdon'];
                  //  $_SESSION['xa'] = $row['isActive'];

            //require 'include/account_header.php';
            require 'include/topmenu.php';
            require 'include/leftmenu.php';
            require 'pages/'.$page.'.php';
            require 'include/setting.php';
            require 'include/footer.php';
            require 'include/modal.php';

        }

    }

    ?>

had tried going through the code, but didn't see any error,also checked my connect.php code to see if am connected to the right database. yet it still shows a white blank page with url http://localhost/login. No error message was shown,please any way how to go about with this would be appreciated


text:
Q: MAMP 1146 "Table Does Not Exist" Errors I am seeing this error in MAMP for every table/database I have setup and can't seem to find a solution.
When I am in PHPMyAdmin I can see the tables of each database listed but in the Structure tab under Information they all show as having Data of 0B.
If I navigate to the relevant folders on my hard drive (Applications/MAMP/db/mysql56/database_name/) I can see that I have .frm and .ibd files, which all have a file size which would suggest they contain data.
How do I get PHPMyAdmin to read the data from these files?
I really can't seem to find a solution to this problem.
Thanks in advance for any tips/suggestions.


text:
Q: When running a shell script with loops, operation just stops NOTICE: Feedback on how the question can be improved would be great as I am still learning, I understand there is no code because I am confident it does not need fixing. I have researched online a great deal and cannot seem to find the answer to my question. My script works as it should when I change the parameters to produce less outputs so I know it works just fine. I have debugged the script and got no errors. When my parameters are changed to produce more outputs and the script runs for hours then it stops. My goal for the question below is to determine if linux will timeout a process running over time (or something related) and, if, how it can be resolved.
I am running a shell script that has several for loops which does the following:
- Goes through existing files and copies data into a newly saved/named file
- Makes changes to the data in each file
- Submits these files (which number in the thousands) to another system

The script is very basic (beginner here) but so long as I don't give it too much to generate, it works as it should. However if I want it to loop through all possible cases which means I will generates 10's of thousands of files, then after a certain amount of time the shell script just stops running.
I have more than enough hard drive storage to support all the files being created. One thing to note however is that during the part where files are being submitted, if the machine they are submitted to is full at that moment in time, the shell script I'm running will have to pause where it is and wait for the other machine to clear. This process works for a certain amount of time but eventually the shell script stops running and won't continue.
Is there a way to make it continue or prevent it from stopping? I typed control + Z to suspend the script and then fg to resume but it still does nothing. I check the status by typing ls -la to see if the file size is increasing and it is not although top/ps says the script is still running.

A: Assuming that you are using 'Bash' for your script - most likely, you are running out of 'system resources' for your shell session.  Also most likely, the manner in which your script works is causing the issue.  Without seeing your script it will be difficult to provide additional guidance, however, you can check several items at the 'system level' that may assist you, i.e.

*

*review system logs for errors about your process or about 'system resources'

*check your docs: man ulimit (or 'man bash' and search for 'ulimit')

*consider removing 'deep nesting' (if present); instead, create work sets where step one builds the 'data' needed for the next step, i.e. if possible, instead of:
step 1 (all files)  ## guessing this is what you are doing
step 2 (all files)
step 3 (all files
Try each step for each file - Something like:
for MY_FILE in ${FILE_LIST}
do
  step_1
  step_2
  step_3
done

:)
Dale


text:
Q: What is the best way to define styling? Class names or relative path? I joined a new project this week and I noticed that the designer (who creates all .css files) uses css in a different way of what I am used to.
I am used to have mainly the elemented referenced by classes and classes names, for instance have a definition
.myClass { display:block; }

and use the class="myClass" attribute in my element.
this designer builds the whole design using this kind of reference:
form#myForm div a { display:block; }

Or similar. This would get the all the anchors inside divs inside the form where id=myForm.
Which one is the best approach? Mainly using classes or mainly using this other approach (I don't know how to call it)?
thanks!

A: There is something that nobody has included in their answers yet, oddly enough and that is it all depends on how specific you want / need to be in your selections.
The basics:
If you want to select multiple elements on a page, simply using a class selector will work:
.non-unique-elements{
    // some style
}

If you want to get somewhat more specific, or want to select a unique element on the page, go with an ID selector:
#unique-element{
    // some style
}

Further Styling
Now, as your coleague has done, you can get even more specific by selecting an element's ID only when it has other attributes; for example, you may want to select all elements that contain a certain class name, but are also of type form
form.some-class{
    // style
}

The most selective CSS will override less selective CSS
Therefore, consider the following example:
.some-class{

}

Gets overridden by:
#some-id{

}

Gets overridden by
div#some-id{

}

A: It really depends on the purpose.
Class should be used to define general style where as ID should be used to select a specific item.

A: it's a question of whether of the css properties you're writing depends on the relationship between the html tag and its parents (and siblings):
to illustrate,
i want to set the color of some text in the page to red -> use Only Classes .redtext
i want to set the color of some text only in specifics div -> .mydiv .redtext
i want to set the width of all inputs only in a specific form -> #myform input
keep in mind that using long css selectors make them very dependent on the Page structure and therefore fragile.


text:
Q: Ngrep on OSX not working? How do I even install ngrep on mac os x?
I tried with brew, no avail...
It gives me errors when I use ngrep
but when I use sngrep it gives me more errors ): (it seems like progress though)
Unable to handle linktype 149
With command
sudo sngrep -d any '.flv' port 80
With ngrep error:
interface: any
exit
0 received, 0 dropped

What can I do to fix this?

A: Not exactly an answer but recently I wanted to use ngrep also, had some issues then brew install'd wireshark. After it installed I got a message like this:

If your list of available capture interfaces is empty (default OS X
  behavior), try installing ChmodBPF from homebrew cask:
brew cask install wireshark-chmodbpf
This creates an 'access_bpf' group and adds a launch daemon that
  changes the permissions of your BPF devices so that all users in that
  group have both read and write access to those devices.

I wonder if this "chmodbpf" thing would be helpful to you, perhaps there is an ngrep version of it?
Btw I'm on OSX Yosemite (whatever's latest I think it's named Yosemite).


text:
Q: How to close application (stanford: it is a folder consists many programs.) in CMD after I open it? java ProcessBuilder Runtime Please know that stanford is not exe. it is a folder consists many programs
I open the cmd.exe by using following statement:
public static void runStanfordCMD() throws IOException{
    List<String> cmds = Arrays.asList("cmd.exe", "/C", "start", "java", "-mx4g", "-cp", "*", "edu.stanford.nlp.pipeline.StanfordCoreNLPServer");
    ProcessBuilder builder = new ProcessBuilder(cmds);
    builder.directory(new File("D:/Desktop/stanford-corenlp-full-2015-12-09"));
    Process proc = builder.start();
}

so how to close the cmd.exe after I finished some process?
by using  ProcessBuilder or Runtime?
If using ProcessBuilder how to write the statement according to my case?
how to write the statement to the Runtime according to my case?
public static void closeStanfordCMD() throws IOException{
    try {
        Runtime.getRuntime().exec("command.exe  /C" + "Your command");  // how to write the statement?

    } catch (Exception e) {
        e.printStackTrace();
    }
}

A:
// how to write the statement?

if you want to close command prompt:
Runtime.getRuntime().exec("taskkill /IM " + "cmd.exe");

if you want to close stanford.exe:
Runtime.getRuntime().exec("taskkill /IM " + "stanford.exe");

A: The method
Runtime.getRuntime().exec
returns an object of Process.
Process has a method destroy() which kills the process you're running.
So what you need is to store the Process object returned by the exec method and call destroy() on it when you want to kill the process.
Also you can call waitFor() method to wait for the process to stop (Causes the current thread to wait, if necessary, until the process represented by this Process object has terminated).
To make it clear, try this code (or modify for your needs):
try {
    Process p = Runtime.getRuntime().exec("java -mx4g -cp * D:/Desktop/stanford-corenlp-full-2015-12-09/edu.stanford.nlp.pipeline.StanfordCoreNLPServer");
    p.waitFor();
}
catch (IOException e) {
    e.printStackTrace();
}
catch (InterruptedException e) {
    e.printStackTrace();
}


text:
Q: How to fix commit to wrong branch I have a question of how to fix a mistake I did when committing and pushing my code to our repo at bitbucket. The situation was that I had finished working on a previous feature branch(Branch1) and it was pulled into the master branch. Then i proceeded to create a new branch(Branch2) for a new feature.
What ended up happening is that I created the Branch2, but did not check it out so my updates ended up being committed to branch1.
How can i transfer these changes from Branch1 to Branch2 ?
Awesome paint picture included:

A: If you haven't pushed branch2 yet, this would be one way to go about it:
git checkout branch1               # make sure to be on the wrongly-modified branch1
git branch -d branch2              # remove the current branch2
git branch branch2                 # create a new branch2 at the current spot
git fetch                          # make sure we're up-to-date on origin's pointers
git reset --hard origin/branch1    # reset branch1 back to what origin thinks it should be
git checkout branch2               # switch to branch2
# continue working on branch2

I know it's a lot to type, but it should be conceptually fairly easy to follow. I find that sometimes, even if I could find a smaller set of commands to accomplish something, following a logical easy to understand approach is better, especially when I'm working with something I don't exactly consider myself expert in yet...

A: Use git rebase --onto:
git branch tmp-branch branch1
git rebase --onto branch2 tmp-branch^ tmp-branch
git branch -f branch2 tmp-branch
git branch -f branch1 branch1^
git checkout branch2
git branch -d tmp-branch

A: This happens to me all the time and I always have to lookup how to fix it.
One of our projects is simple with 2 branches, master and devel. Master is where we build releases from, commit backports, etc. devel is where most of the work happens. I'm usually the guy who builds the production releases, so after a release I often have master checked out when I'm expecting to have devel checked out.
Basically I end up with this:
               o---o---o---o---o  origin/master
               |              / \
               |            /    o'--o'--o'  *master*
                \         /
                 o---o---o---o---o  origin/develop

And what I want is:
               o---o---o---o---o  origin/master master
               |              /
               |            /
                \         /
                 o---o---o---o---o origin/develop
                                  \
                                   o'--o'--o' *develop*

So long as you haven't pushed*, the best way I've found to fix this is as follows:
$ git checkout develop
$ git rebase --onto develop origin/master master

Think of this as git rebase --onto DESTINATION STARTING_FROM ENDING_AT. This gives me almost what I want, but the branch name "master" has been moved and the branch name "develop" hasn't been advanced. "master" is currently checked out.
               o---o---o---o---o  origin/master
               |              /
               |            /
                \         /
                 o---o---o---o---o origin/develop develop
                                  \
                                   o'--o'--o' *master*

So then just move the branch names. Make the current commit develop and reset master to point to origin/master:
$ git branch -f develop
$ git checkout origin/master
$ git branch -f master
$ git checkout develop

* If you've pushed, then the best thing to do is usually use git cherry-pick to clone those commits to the proper branch. Then you can use git revert to undo the commits you pushed on the wrong branch.
Note A lot of times you'll see people tell you to make temporary branch names before doing the rebase. This would let you avoid the git branch -f develop, because you could use merge to fix that and then delete the temporary branch before you push. But you'll still have to git branch -f master cause you already advanced that improperly with commits... Ultimately the temporary branches have just caused me confusion and I already have the origin/FOO refnames which match how I'm already thinking about things, so I prefer to use those directly.


text:
Q: New AbortController() returning empty object I'm currently developing a react native application and I intend to use AbortController to cancel requests when necessary. The way I'm doing this is basically the simplest example available in the MDN docs, which is basically this:
const controller = new window.AbortController()
const signal = controller.signal

fetch(url, {signal})

However, for some reason, the creation of the controller object is not working properly, and if I console.log that object, I can see that it's being created as an empty object ({}).
But it gets weirder. If I use the Debug tool in react native dev tools, the controller object gets created as expected.
Any idea what might be the issue here?

A: AbortController is part of the DOM spec, and not the ECMAScript Spec. This makes it a browser feature, not a JavaScript language feature. As a result, AbortController isn't something available by default with the JavaScript runtime that runs on a device.
When using the Debug tool, all JavaScript code runs within Chrome itself, communicating with native code via WebSockets. Chrome uses V8 as its JavaScript engine, which is a browser-based engine, and so has access to all of the DOM APIs - including AbortController. This is why you will see it working in Debug mode, as your JS code is being interpreted by V8, rather than the runtime on your device (likely JavaScriptCore, if you haven't enabled Hermes).
tl;dr - AbortController isn't part of the JS runtime on the device, so it won't work.


text:
Q: php captcha.org doesn't work I have a form with the phpcaptcha.org. But when I submit the form I see a white screen, the captcha script doesn't work, the other code works.
Can someone help me what is wrong with captcha?
thanks in advance.
my submit code is:
<?php
session_start();

//captcha
include_once $_SERVER['DOCUMENT_ROOT'] . 'securimage/securimage.php';
$securimage = new Securimage();

include 'connect.php';

$sql = "INSERT INTO users (username, password)VALUES (?, ?)";
$stmt = $link->prepare($sql);
$stmt->bind_param("ss", $username, $password);

 $username = $_POST['username'];

 $password = md5($_POST['password']);

$stmt->execute();

//captcha
if ($securimage->check($_POST['captcha_code']) == false) {
  // the code was incorrect
  // you should handle the error so that the form processor doesn't continue

  // or you can use the following code if there is no validation or you do not know how
  echo "The security code entered was incorrect.

";
  echo "Please go back and try again.";
  exit;
}

if (! $sql) {
    echo "Account not created";
}
    echo 'Account created, click here';

$stmt->close();
mysqli_close($link);

?>

A: I think the main problem is hidden in the include_once $_SERVER['DOCUMENT_ROOT'] . 'securimage/securimage.php'; line. Have you tried putting another slash (/) before securimage/securimage.php ? It looks like PHP is trying to include the indicated file, cannot find it due to the lacking slash, continue with the rest of the code, and cannot create a new Securimage variable since the type is undefined. if you change include_once() to require_once(), you will probably get an error.
On the other hand, I would strongly recommend using a stronger hashing algorithm than MD5, which is very weak in terms of security. Please consider using the built in crypt function of PHP with a better algorithm like BLOWFISH or SHA-512. If you have PHP 5.5 over above available, you may also find another built-in PHP function called password_hash very useful. Hope this has been helpful.


text:
Q: How to account for a lack of fit using a quasi-poisson on non-integer, overdispersed data I am trying to run a mixed model on over-dispersed non-integer data. My data are not counts, but are zero-inflated and over dispersed. The variable is distance (how far a gps point is from a central location) and as such looks like: 0.33, 64.73, 5.2 etc. I have been using a quasi-Poisson distribution as I have read that quasi can handle non-integer data (both Poisson and negative binomial cannot). I am using the glmmPQL function in package MASS as this allows quasi distributions with a random term (the identity of the individual that the gps point comes from).The functions glmm and lmer do not work with a quasi-Poisson distribution. Plotting the residuals indicates a lack of fit of this model.log-transforming the data to try and make it normal before hand also fails (the Shapiro-test for normality is significant). I am unsure how to fix this, as I seemingly have to use a quasi-distribution (link="log") because my data is not counts, non-integer and not normal but there is still overdispersion and lack of fit when using this distribution.
My question therefore is: How to model over-dispersed, non-integer data in a mixed model when quasi-Poisson does not seem to work?
My code so far is:
summary(glmmPQL(distance_from_centroid~Chick.Juv.Adult+Summer_winter,
                random=~1|markingnumber, family=quasipoisson(link="log"),
                data=centroid_distances))

Which results in:
Linear mixed-effects model fit by maximum likelihood
 Data: centroid_distances
  AIC BIC logLik
   NA  NA     NA

Random effects:
 `Formula: ~1 | markingnumber
        (Intercept) Residual
StdDev:    1.157381 2.136811

Variance function:
 Structure: fixed weights
 Formula: ~invwt
Fixed effects: distance._from_centroid ~ Chick.Juv.Adult + Summer_winter
                      Value  Std.Error  DF   t-value p-value
(Intercept)       2.0670095 0.09403952 695 21.980221  0.0000
Chick.Juv.AdultC -0.2945360 0.06686399 695 -4.405002  0.0000
Chick.Juv.AdultJ -0.2005831 0.06727181 695 -2.981682  0.0030
Summer_winterW    0.1207721 0.04324588 695  2.792684  0.0054
 Correlation:
                 (Intr) C.J.AC C.J.AJ
Chick.Juv.AdultC -0.565
Chick.Juv.AdultJ -0.512  0.736
Summer_winterW   -0.267  0.134  0.043

Standardized Within-Group Residuals:
        Min          Q1         Med          Q3         Max
-2.53759073 -0.48277169 -0.31041612  0.06314122  7.48672836

Number of Observations: 1009
Number of Groups: 311

Which when plotting the residuals gives me:

A: There is not really such a thing as "over-dispersed data" in abstract. Over-dispersion means that the variability of the data is more than expected, and without a specific context there is no "expected" dispersion. An expected variability exists in just a few specific situations usually involving count data: for example, binomial sampling (number of successes out of n trials) and Poisson sampling (number of events over a period of time with a constant instantaneous event rate). For these settings one can derive the distribution, and it turns out that the variance is a function of the mean. For example, for binomial $E(X)=np$, and $Var(X)=np(1-p)$, while for Poisson $E(X)=Var(X)=\lambda$. So once you know the mean, you know what the variance should be. If you have count data that is generated by a Poisson-like sampling process with some deviations (eg individuals have their own event rate) and you find that $Var(X)>E(X)$, then you can talk of over-dispersion relative to the Poisson distribution.
You give no reason to think that the process generating the data resembles Poisson sampling (it is not even integer counts), so there is no reason why the variance should/could be equal to the mean or any other specific value, thus the concept of "over-dispersion" does not apply. There are lots of two-parameter (or more) distributions that can model mean and variance separately. Since your data seems to be positive and skewed, perhaps the gamma distribution would work (if the log-normal did not). There are lots of other possible approaches for modeling your data, just forget about the straight-jacket of the Poisson distribution when it really does not apply.