text:
Q: mod_rewrite and server environment variables The setup I have is as follows:
I have one Apache server acting as a URL rewriting engine (SERVER1).
I have a second server (Apache too) which runs a web application (SERVER2). First tries to authenticate users. Part of the authentication protocol involves a lot of redirection between that application server and the authentication server.
My problem is that once the authencation is successfull, the authentication server needs to redirect the user back to the application server, which is only visible from SERVER1. Effectively, SERVER2 needs to be able to reconstruct a URL based on SERVER1's parameters.
Most of the environement variable are helpful i.e. I know the host name, script name, page called etcc but I can 't figure out wether the call was made through HTTP or HTTPS: that information is wiped in the rewrite process by SERVER1...
Anybody knows if/how I can get that information through environement variables? I am limited in that I can't use query string parameters...
Thanks all !

A: This may sound strange, but I have found part of the answer to my question.
The rewrite engine (at least in Apache 2, I haven't looked anywhere else) allows for writting extra request header.
The rule should look something like that.

RewriteRule .* -
  [E=INFO_PATH_INFO:%{PATH_INFO},NE]

Put simple, it creates a new header called INFO_PATH_INFO and sets the value to PATH_INFO.
( For more info check out http://www.askapache.com/htaccess/crazy-advanced-mod_rewrite-tutorial.html )
Then it can be retrieved in any languages.
For info I am using Oracle's OWA which adds an extra layer of complication due to the fact that the default environment variables are limited to a few and additional variables need to be specified in thr dads.conf
Hope this will help anyone !


text:
Q: Parsing parts of XML to different classes I am trying to figure out how I can read in a parts of an XML file into a class.
This is the structure of the XML File:
 <Root>
  <Element1>
    <Element2>
      <ElementID></ElementId>
      <Element3a>
        <Element3aId id="">0</Element3aId>
        <Element3aId id="">0</Element3aId>
      </Element3a>
      <Element3b>
        <Element3bId id="">0</Element3bId>
        <Element3bId id="">0</Element3bId>
      </Element3b>
      <Element3c>
        <Element3cId id="">0</Element3cId>
        <Element3cId id="">0</Element3cId>
      </Element3c>
    </Element2>
  </Element1>
</Root>

I have created the following classes (I removed accessors/mutators to try to simplify the code:
public struct Element3a
{
    [XmlAttribute("id")]
    string id;

    [XmlElement("Element3aId")]
    int Element3aId;
}

[XmlRootAttribute("Element2")]
public struct Element1
{
    [XmlElement("ElementID")]
    int id;

    List<Element3a> Element3aId;

    List<Element3a> Element3bId;

    List<Element3a> Element3cId;
}

Here is my parsing code:
XDocument xDoc = XDocument.Load(filePath);

var Element2List = xDoc.Root.Descendants().FirstOrDefault(c => c.Name.LocalName.Equals("Element1"));
XmlSerializer serializer = new XmlSerializer(typeof(Element1));

using (var reader = Element2List.CreateReader())
{
    do
    {
        reader.ReadToDescendant("Element2");
        Element1 tag1 = (Element1)serializer.Deserialize(reader.ReadSubtree());

        // How do I populate the Element3a Lists here?

    } while (reader.ReadToNextSibling("Station"));
    reader.Close();
}

Element3a/Element3b/Element3c all have the same data in them, so I want to be able to serialize them into just the Element3a structs. I am able to get the Element2 information into the Element2 class, but I am unable to populate the Element3a lists in that class.

A: Instead of serialize use Xml Linq
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Xml;
using System.Xml.Linq;

namespace ConsoleApplication1
{
    class Program
    {
        const string FILENAME = @"c:\temp\test.xml";
        static void Main(string[] args)
        {
            XDocument doc = XDocument.Load(FILENAME);

            Element1 elements = doc.Descendants("Element2").Select(x => new Element1() {
                id = (string)x.Element("ElementID") == "" ? null : (int?)x.Element("ElementID"),
                Element3aId = x.Descendants("Element3a").Select(y => new Element3a {
                    id =  (string)y.Attribute("id"),
                    Element3aId = (string)y.Element("Element3aId") == "" ? null : (int?)y.Element("Element3aId")
                }).ToList(),
                Element3bId = x.Descendants("Element3b").Select(y => new Element3a {
                    id =  (string)y.Attribute("id"),
                    Element3aId = (string)y.Element("Element3bId") == "" ? null : (int?)y.Element("Element3bId")
                }).ToList(),
                Element3cId = x.Descendants("Element3c").Select(y => new Element3a
                {
                    id = (string)y.Attribute("id"),
                    Element3aId = (string)y.Element("Element3cId") == "" ? null : (int?)y.Element("Element3cId")
                }).ToList()
            }).FirstOrDefault();
        }
    }
    public struct Element3a
    {
        public string id;
        public int? Element3aId;
    }

    public struct Element1
    {
        public int? id;

        public List<Element3a> Element3aId;

        public List<Element3a> Element3bId;

        public List<Element3a> Element3cId;
    }
}

redpajama_set_name: RedPajamaStackExchange


text:
Q: Question about infinite intersection Is  $\bigcap\limits_{n=1}^\infty (0, 1 + \frac{1}{n})$ equal to $(0, 1)$ or $(0,1]$?  Help is appreciated.

A: Hint: For all $n$ we have $1\in(0,1+\frac1n)$.

A: For all $n$, $1\in\left(0,1+\frac{1}{n}\right)$ and $\displaystyle\bigcap_{n=1}^{\infty}\left(0,1+\frac{1}{n}\right)=\left\{x,\,\forall n,\,x\in\left(0,1+\frac{1}{n}\right)\right\}$.
So $1\in\displaystyle\bigcap_{n=1}^{\infty}\left(0,1+\frac{1}{n}\right)$.
More generally :
The same way, we can show that $\displaystyle(0,1]\subset\bigcap_{n=1}^{\infty}\left(0,1+\frac{1}{n}\right)$.
If $x>1$, it exists $n$ such as $x\notin\left(0,1+\frac{1}{n}\right)$, so $\displaystyle x\notin\bigcap_{n=1}^{\infty}\left(0,1+\frac{1}{n}\right)$.
If $x\le 0$, $x\notin(0,\frac{1}{1})$, so $\displaystyle x\notin\bigcap_{n=1}^{\infty}\left(0,1+\frac{1}{n}\right)$.
Conclusion : $\displaystyle\bigcap_{n=1}^{\infty}\left(0,1+\frac{1}{n}\right)=(0,1]$.

A: Well... is $1$ included in all sets being intersected, or is it missing from at least one? If it is missing from at least one, then it is not in the intersection. If it is included in all sets being intersected, then it is in the intersection.


text:
Q: React Native fetch() error in version 0.44.0 This is a react native test code using version 0.44.0 in android emulator. I am able to fetch data from many sites, but some websites cannot be fetched.One such website is provided below.
When I upgrade react native version to 0.55.0, I am able to fetch the data. But, in my main project, I have been using version 0.44.0 and cannot upgrade it. So, I need a solution without upgrading react native version. I have gone through many stackoverflow pages and found solutions for ios, localhost etc. But, couldn't find any solution for this problem.
import React, { Component } from 'react';

import { Text,View } from 'react-native';

export default class App extends Component {

  checkaccess = () => {
    url = 'https://example.com/wc-api/v3/'
    fetch(url, {
      method: 'GET',
      headers: {
        'Accept': 'application/json',
        'Content-Type': 'application/json',
      }
    })
      .then((response) => {
        console.log('got')
       // console.log(response.json())
        return response.json()
      })
      .catch((error) => {
        console.log('error',error)
      })
      .done()
}

  render() {
    return (
      <View>
        {this.checkaccess()}
        <Text>test</Text>
      </View>
    );
  }
}

And the console log is :
error TypeError: Network request failed
    at XMLHttpRequest.xhr.onerror (index.bundle:12366)
    at XMLHttpRequest.dispatchEvent (index.bundle:13277)
    at XMLHttpRequest.setReadyState (index.bundle:15382)
    at XMLHttpRequest.__didCompleteResponse (index.bundle:15238)
    at index.bundle:15333
    at RCTDeviceEventEmitter.emit (index.bundle:3851)
    at MessageQueue.__callFunction (index.bundle:2090)
    at index.bundle:1948
    at MessageQueue.__guard (index.bundle:2062)
    at MessageQueue.callFunctionReturnFlushedQueue (index.bundle:1947)

A: You should try this
fetch(url, {
    credentials: 'include',
    ...otherOptions,
});

For other option or understanding check this discussion on github react-native issues


text:
Q: Custom token generation using TokenHelper in struts2 java application In struts2, there is a TokenHelper class which generates a random token using the below code.
private static final Random RANDOM = new Random();
public static String generateGUID() {
     return new BigInteger(165, RANDOM).toString(36).toUpperCase();
}

For some reason this token is not secure enough. So we need to use SecureRandom class to generate the token. How can I do this in my application? Localizing the TokenHelper class won't help. Please suggest.

A: Use Struts 2.3.20 or newer where Struts uses SecureRandom.


text:
Q: woocommerce stock price and quantity I am trying to somehow show the total number of products in stock and the total price of all the products (with the stock number).
Basically I need to write a code that will add all the products and their stock numbers and show me the value of all the products (including those with multiple stock numbers) added together.
Basically I need the price of how much I would sell the products that are in stock at this moment.

A: If you're asking how to generally do this: you would have to use a combination of MYSQL, PHP, JQUERY, and AJAX.
You look in your database using jquery + ajax to call mysqli (or other) database. Get the value and append it to your website using jquery.
It is very difficult to suggest any code or a narrow answer without your code.
hope it helps!


text:
Q: XML parsing error while inserting XML to SQL Server I am writing a simple powershell script to insert XML files from a folder into SQL Server 2012. But every time it's failing when trying to insert the XML with below error. In Microsoft documentation, they are inserting UTF-8 encoded xml. I am able to insert XML data when I am changing encoding manually to "UTF-16". What I need to do to inset the XML without changing UTF-8 encoding. Thanks.
Error:

Exception calling "ExecuteScalar" with "0" argument(s): "XML parsing: line 1, character 38, unable to switch the encoding"

Line
$InsertedID = $sqlCommand.ExecuteScalar()

Table Definition:
CREATE TABLE TESTXML
(
     ID INT IDENTITY(1,1) NOT NULL,
     FileName VARCHAR(200),
     InsertedDate DATETIME DEFAULT GETDATE(),
     InsertedBy   VARCHAR(100) DEFAULT 'PS',
     XML XML,
     BLOB VARBINARY(MAX)
)

XML to parse:
<?xml version="1.0" encoding="UTF-8"?>
<order xmlns="http://XXXXX/xml/impex/XXX/2006-10-31" order-no="XXX">
XML Data......
</order>

Powershell Script:
foreach($xmlfile in $xmlfiles){
   [string]$xml = (Get-Content $xmlfile.FullName) -replace "'", "''"
    $sqlCommand.Parameters[0].Value = $xmlfile.FullName
    $sqlCommand.Parameters[1].Value = $xml
    $InsertedID = $sqlCommand.ExecuteScalar()
    "Inserted row ID $InsertedID for file " + $xmlfile.FullName
}

A: SQL Server handles an XML as unicode / UCS-2 (very related to utf-16). Powershell sends the string as 2-byte-encoded string, so the encoding="UTF-8" is not telling the truth. That's why it is complaining...
You have several choices:

*

*Use something like ((Get-Content $xmlfile.FullName) -replace "'", "''") -replace "UTF-8","UTF-16" to change this right in your powershell code.

*Use Powershell to cut off the declaration entirely (just send the XML without the <?xml ...?> thing)

*Create a stored procedure accepting a NVARCHAR(MAX) and use T-SQL either to change the encoding or to remove the declaration.

*Use a staging table in SQL-Server accepting the XML within a NVARCHAR(MAX) column and transfer the imported data to the target tables in a second step. (Staging tables are in many cases a good idea for bigger import scenarios)

Good luck


text:
Q: When I make PDF then error is 'Trying to access array offset on value of type null' in dompdf in Laravel I am new in Laravel. When I try to make a PDF file then some time working properly but some time is giving an exception:

Trying to access array offset on value of type null

I am using "barryvdh/laravel-dompdf": "^0.8.5" package and Laravel 5.8.
I also use summernote editor to save chapters and each one contains table and images.
Here is my code:
    public function pdfcreate(Request $res){
           $data=[];
           $data['notes'] =  Chapter::where('course_id',$res->course_id)->where('module_id',$res->module_id)-
                                     >leftjoin('courses','chapters.course_id','=','courses.id')
                                        ->get();
    $pdf = Course::where('id', $res->course_id)->first();
                                $data['pdfImg']= ($pdf->pdf_image)? $pdf->pdf_image:'';

                 if(count($data['notes'])>0){
                    $pdf = PDF::loadView('FrontPanel.pdf', $data);

                    return $pdf->download('module.pdf');
                  }else{
                    return redirect()->back()->with('status','Somthing is wrong.');
     }

And this is my view:

<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
    <meta name="description" content="">
    <meta name="author" content="">

    <title>Pdf - Haats</title>

<?php if(isset($pdfImg)){?>

<?php }else{?>

<?php }?>

<?php
    foreach($notes as $note){
    echo html_entity_decode($note->chap_content);
    }
?>

enter image description here


text:
Q: tensorflow.python.framework.errors_impl.InvalidArgumentError: Shape mismatch in tuple component 0 When I use tensorflow to build my own neural network and run it, I meet a very strange error. The error is that

tensorflow.python.framework.errors_impl.InvalidArgumentError: Shape
  mismatch in tuple component 0. Expected [400], got [3200].

I have no idea about how [3200] comes, could anyone can help to fix this problem? The input of the neural network is a 400-dimension vector.
Here is one part of my code
Here is one part of my code
Here is one part of my code
Here is one part of my code
Here is the output
output 1
output2
output3


text:
Q: how could i implement log4j-gwt-1.0.jar in gwt example and want to know how to write log4j.properties file? when i am using log4j-gwt-1.0.jar file in build path their respective classes is not finding ie. Logger logger=new Logger.getLogger(modulename.class);
getting error.
I also want to know how to write log4j.properties file to write log in specific file on specific location of linux file structure. please help as soon as possible.
Thanks in advance.

A: Log4j.properties
# Define the root logger with appender file
log = /usr/home/log4j
log4j.rootLogger = DEBUG, FILE

# Define the file appender
log4j.appender.FILE=org.apache.log4j.FileAppender
log4j.appender.FILE.File=${log}/log.out

# Define the layout for file appender
log4j.appender.FILE.layout=org.apache.log4j.PatternLayout
log4j.appender.FILE.layout.conversionPattern=%m%n

log4jExample.java
public class log4jExample{
      /* Get actual class name to be printed on */
      static Logger log = Logger.getLogger(
                          log4jExample.class.getName());

      public static void main(String[] args)
                    throws IOException,SQLException{

         log.debug("Hello this is an debug message");
         log.info("Hello this is an info message");
      }
    }

All the libraries should be available in CLASSPATH and your log4j.properties file should be available in PATH. So do the following:
Create log4j.properties as shown above.
Create log4jExample.java as shown above and compile it.
Execute log4jExample binary to run the program.
You would get following result, inside /usr/home/log4j/log.out file:
Hello this is an debug message
Hello this is an info message

For more details please go through the link

A: You should not be using third party logging like log4j-gwt-1.0.jar anymore in GWT. GWT over the last few releases has been provding a awesome logging library. https://developers.google.com/web-toolkit/doc/latest/DevGuideLogging
You can even log Client exceptions to Server using RemoteHandler.
GWT team has done awesome job with logging. USE IT.
Browse Google GWT Logging Sample code @ https://code.google.com/p/google-web-toolkit/source/browse/#svn/trunk/samples/logexample/
Download Google GWT Logging Sample code @ https://google-web-toolkit.googlecode.com/files/gwt-2.5.1.zip


text:
Q: Is there a way to animate setClipsToBounds on UIView? I would like to clip overflowing content using setClipsToBound:YES but I want the extraneous content to fade out. Is this possible? I tried UIView beginAnimations and it doesn't seem to take effect.

A: There are a limited number of properties that are animatable and I don't think clipsToBounds is one of them. Only thing I can think of is temporarily, at least, make two copies of your view.
When both views are visible, it will look like the view does not clip. To fade to clipping, animate the alpha of the non-clipping view to 0.0. When the animation completes you can discard the non-clipping view if you want. To fade back to non-clipping, add the non-clipping view back and animate its alpha back to 1.0. When the animation is complete, you can discard the clipping view if you want. Might be necessary to set the opaque setting on the non-clipping view to NO.
If the view contains contents that have their own alpha values, it probably will not look undetectable what's happening. But otherwise it should look for all intents and purposes like fading only the out-of-bounds portions.


text:
Q: Use of Account expiry, disable and lockout in Active directory I am learning the concepts of active directory. Recently I learned the difference in Account lockout, expiry and disable. My question is all these types are doing the same thing but the purpose is different.
For example: Account expiry can be set as an automation process and disable can be used for immediate results and the lockout is used when the password is typed incorrectly for the certain frequency. But all these types used to prevent the user from login to the computer. I am clear with that. But my doubt is, all these types are used only for prevent the user from login or is there any other differences in these types?

A: All accounts behave similarly after the change except, the only difference being that of the locked accounts. Where, the account remains locked only for a specified duration and can be 'automatically' unlocked upon completion of the said duration. If duration is set to 0, it will never be 'automatically' unlocked.
More details can be found here.
https://www.windows-active-directory.com/difference-between-disabled-expired-and-locked-account.html


text:
Q: How can I generate a Google Slides document from parts of other Google Slides documents? I'm wanting to, preferably using the Google Slides API, programatically generate a new Google Slides document which pulls in some form submitted variables and various pages from other Google Slides documents.
What I'm aiming to do is create a simple HTML form which asks a series of questions such as:

*

*Client Name (text field)

*Project Title (text field)

*Include case studies? (yes/no)

The person generating the proposal would complete the answers above and then submit the form.
At this point, and this is what I need help with, I want to:

*

*Duplicate an existing Google Slides proposal template (which we already have)

*Add in the Client Name and Project Title into text fields on the first slide

*Import slides from another Google Slides document (a case studies document - which we already have) into this newly generated document (if the user answered Yes on the form)

I don't even know where to begin with this as I'm a newbie to the Google Docs API and JavaScript.
I've tried the following but it's not listing the files:
const path = require("path");

// Require the fastify framework and instantiate it
const fastify = require("fastify")({
  // set this to true for detailed logging:
  logger: false
});

// Setup our static files
fastify.register(require("fastify-static"), {
  root: path.join(__dirname, "public"),
  prefix: "/" // optional: default '/'
});

// fastify-formbody lets us parse incoming forms
fastify.register(require("fastify-formbody"));

// point-of-view is a templating manager for fastify
fastify.register(require("point-of-view"), {
  engine: {
    handlebars: require("handlebars")
  }
});

// Our main GET home page route, pulls from src/pages/index.hbs
fastify.get("/", function(request, reply) {
  // params is an object we'll pass to our handlebars template
  let params = {
    greeting: "Hello Node!"
  };
  // request.query.paramName <-- a querystring example
  reply.view("/src/pages/index.hbs", params);
});

// A POST route to handle form submissions
fastify.post("/", function(request, reply) {
  let params = {
    greeting: "Hello Form!"
  };
  // request.body.paramName <-- a form post example
  reply.view("/src/pages/index.hbs", params);
});

// Run the server and report out to the logs
fastify.listen(process.env.PORT, '0.0.0.0', function(err, address) {
  if (err) {
    fastify.log.error(err);
    process.exit(1);
  }
  console.log(`Your app is listening on ${address}`);
  fastify.log.info(`server listening on ${address}`);
});

const fs = require('fs');
const readline = require('readline');
const {google} = require('googleapis');

// If modifying these scopes, delete token.json.
const SCOPES = ['https://www.googleapis.com/auth/presentations.readonly'];
// The file token.json stores the user's access and refresh tokens, and is
// created automatically when the authorization flow completes for the first
// time.
const TOKEN_PATH = 'token.json';

// Load client secrets from a local file.
fs.readFile('credentials.json', (err, content) => {
  if (err) return console.log('Error loading client secret file:', err);
  // Authorize a client with credentials, then call the Google Slides API.
  authorize(JSON.parse(content), listSlides);
});

/**
 * Create an OAuth2 client with the given credentials, and then execute the
 * given callback function.
 * @param {Object} credentials The authorization client credentials.
 * @param {function} callback The callback to call with the authorized client.
 */
function authorize(credentials, callback) {
  const {client_secret, client_id, redirect_uris} = credentials.web;
  const oAuth2Client = new google.auth.OAuth2(
      client_id, client_secret, redirect_uris[0]);

  // Check if we have previously stored a token.
  fs.readFile(TOKEN_PATH, (err, token) => {
    if (err) return getNewToken(oAuth2Client, callback);
    oAuth2Client.setCredentials(JSON.parse(token));
    callback(oAuth2Client);
  });
}

/**
 * Get and store new token after prompting for user authorization, and then
 * execute the given callback with the authorized OAuth2 client.
 * @param {google.auth.OAuth2} oAuth2Client The OAuth2 client to get token for.
 * @param {getEventsCallback} callback The callback for the authorized client.
 */
function getNewToken(oAuth2Client, callback) {
  const authUrl = oAuth2Client.generateAuthUrl({
    access_type: 'offline',
    scope: SCOPES,
  });
  console.log('Authorize this app by visiting this url:', authUrl);
  const rl = readline.createInterface({
    input: process.stdin,
    output: process.stdout,
  });
  rl.question('Enter the code from that page here: ', (code) => {
    rl.close();
    oAuth2Client.getToken(code, (err, token) => {
      if (err) return console.error('Error retrieving access token', err);
      oAuth2Client.setCredentials(token);
      // Store the token to disk for later program executions
      fs.writeFile(TOKEN_PATH, JSON.stringify(token), (err) => {
        if (err) return console.error(err);
        console.log('Token stored to', TOKEN_PATH);
      });
      callback(oAuth2Client);
    });
  });
}

/**
 * Prints the number of slides and elements in a sample presentation:
 * https://docs.google.com/presentation/d/1EAYk18WDjIG-zp_0vLm3CsfQh_i8eXc67Jo2O9C6Vuc/edit
 * @param {google.auth.OAuth2} auth The authenticated Google OAuth client.
 */
function listSlides(auth) {
  const slides = google.slides({version: 'v1', auth});
  slides.presentations.get({
    presentationId: '1EAYk18WDjIG-zp_0vLm3CsfQh_i8eXc67Jo2O9C6Vuc',
  }, (err, res) => {
    if (err) return console.log('The API returned an error: ' + err);
    const length = res.data.slides.length;
    console.log('The presentation contains %s slides:', length);
    res.data.slides.map((slide, i) => {
      console.log(`- Slide #${i + 1} contains ${slide.pageElements.length} elements.`);
    });
  });
}


text:
Q: Html.BeginForm sends null objects to controller with Html.HiddenFor This is my code
@model MyModel

@using (Html.BeginForm("Action", "Controller", FormMethod.Post, new { @enctype = "multipart/form-data" }))
{
    Html.HiddenFor(x => x.ID);

    <label>Name: </label>@Html.EditorFor(x => x.Name);

    <button>Submit</button>
}

for some reason in my controller i get MyModel with values of Name = new name but ID = null
Why this happens?

A: Reviewing my code one line is problem but doesn't give error:
@model MyModel

@using (Html.BeginForm("Action", "Controller", FormMethod.Post, new { @enctype = "multipart/form-data" }))
{
    Html.HiddenFor(x => x.ID); // This one

    <label>Name: </label>@Html.EditorFor(x => x.Name);

    <button>Submit</button>
}

Solution is simple if you know what may be problem but if you do not you will not solve it since it doesn't drop error.
Solution was adding @ before Html.HiddenFor(x => x.ID);.
@model MyModel

@using (Html.BeginForm("Action", "Controller", FormMethod.Post, new { @enctype = "multipart/form-data" }))
{
    @Html.HiddenFor(x => x.ID); // Changed this one

    <label>Name: </label>@Html.EditorFor(x => x.Name);

    <button>Submit</button>
}

Hope this will help someone save some time and pain.


text:
Q: Register account feature in Python app returns "FileNotFoundError" When you run this python file and then register an account, it keeps giving me:

FileNotFoundError: [WinError 3] The system cannot find the path specified: 'D:\\\\\___\accounts\accounts.txt'

How can I fix this? I'm new to Python. I learnt the files through tutorials.
Here's the code:
import csv
import os
import time
from colorama import Fore

#======================================================================#
clearConsole= lambda: os.system("cls")
#======================================================================#
def register():

    firstname = input(Fore.CYAN + "Enter your first name: " + Fore.WHITE).lower()
    print(Fore.GREEN + "First name set to: " + Fore.LIGHTGREEN_EX + firstname)
    surname = input(Fore.CYAN + "Enter your surname: " + Fore.WHITE).lower()
    print(Fore.GREEN + "Surname set to: " + Fore.LIGHTGREEN_EX + surname)

    age = input(Fore.CYAN + "Enter your age: " + Fore.WHITE)
    if not str.isdecimal(age):
        print(Fore.RED + "Age must be a number. Please try again.")
        age = input(Fore.CYAN + "Enter your age: " + Fore.WHITE)
        print(Fore.GREEN + "Age set to: " + Fore.LIGHTGREEN_EX + age)

    password = input(Fore.CYAN + "Enter a strong password: " + Fore.WHITE)
    if len(password) < 6:
        print(Fore.RED + "Password should be between 6 to 18 characters long.")
        password = input(Fore.CYAN + "Enter a strong password: " + Fore.WHITE)
        print(Fore.GREEN + "Password is: " + Fore.LIGHTGREEN_EX + password)

    username = firstname[:1] + surname + age
    username.lower()

    print(Fore.GREEN + "Your username is: " + Fore.LIGHTGREEN_EX + username + Fore.GREEN + "\nYour password is: " + Fore.LIGHTGREEN_EX + password + Fore.GREEN + "\nYour firstname is: " + Fore.LIGHTGREEN_EX + firstname + Fore.GREEN + "\nYour surname is: " + Fore.LIGHTGREEN_EX + surname + Fore.GREEN + "\nYour age is: " + Fore.LIGHTGREEN_EX + age)

    time.sleep(3)

    global encryptedUsername, encryptedPassword, encryptedFirstname, encryptedSuraname, encryptedAge

    encryptedUsername = "".join(chr(ord(char)+3) for char in username)
    encryptedPassword = "".join(chr(ord(char)+3) for char in password)
    encryptedFirstname = "".join(chr(ord(char)+3) for char in firstname)
    encryptedSuraname = "".join(chr(ord(char)+3) for char in surname)
    encryptedAge = "".join(chr(ord(char)+3) for char in age)

    if not str.isdecimal(age) or len(password) < 6:
        clearConsoleMessageAndTimer(Fore.RED + "Error occured, please try again.", 3)
        loginMenu()
    else:
        cwd = os.getcwd()
        accountsFolder = "accounts"
        accountFile = "accounts.txt"
        fileAccDirect = os.path.join(cwd, accountsFolder, accountFile)

        directoryExists = os.path.exists(fileAccDirect)

        if directoryExists == False:

            os.mkdir(fileAccDirect)

            with open(f"{fileAccDirect}", "a", newline = "") as myFile:
                writer = csv.writer(myFile)
                writer.writerow([encryptedUsername, encryptedPassword, encryptedFirstname, encryptedSuraname, encryptedAge])
                myFile.close()

                clearConsoleMessageAndTimer(Fore.LIGHTGREEN_EX + "Account successfully made. Please login now.", 3)
                clearConsoleMessageAndTimer(Fore.WHITE + "Loading...", 2)
                loginMenu()

        elif directoryExists == True:
            with open(f"{fileAccDirect}", "a", newline = "") as myFile:
                writer = csv.writer(myFile)
                writer.writerow([encryptedUsername, encryptedPassword, encryptedFirstname, encryptedSuraname, encryptedAge])
                myFile.close()

                clearConsoleMessageAndTimer(Fore.LIGHTGREEN_EX + "Account successfully made. Please login now.", 3)
                clearConsoleMessageAndTimer(Fore.WHITE + "Loading...", 2)
                loginMenu()
#======================================================================#
def databaseOptionMenu():

    print(Fore.WHITE + "#========================================#   #==============>>")
    print("|" + Fore.LIGHTBLUE_EX + "   Please select what you want to do.   " + Fore.WHITE + "|   |" + Fore.LIGHTMAGENTA_EX + "   Logged in as:")
    print(Fore.WHITE + "|                                        |   |   " + Fore.MAGENTA + f"{user0}" + Fore.WHITE)
    print("|" + Fore.BLUE + "       Press 1 to create a table        "+ Fore.WHITE + "|   #==============>>")
    print("|" + Fore.BLUE + "         Press 2 to Load table          " + Fore.WHITE + "|")
    print("|" + Fore.BLUE + "         Press 3 to Add Student         " + Fore.WHITE + "|")
    print("|" + Fore.BLUE + "        Press 4 to Remove Student       " + Fore.WHITE + "|")
    print("|" + Fore.BLUE + "        Press 5 to Search Student       " + Fore.WHITE + "|")
    print("|" + Fore.BLUE + "                                        " + Fore.WHITE + "|")
    print("|" + Fore.BLUE + "     Press 6 to see account details     " + Fore.WHITE + "|")
    print("|" + Fore.BLUE + "           Press 7 to Log out           " + Fore.WHITE + "|")
    print("|" + Fore.LIGHTBLACK_EX + "      Press 8 to exit the program       " + Fore.WHITE + "|")
    print("#========================================#")

    selection2 = input(Fore.GREEN + f"[{user0}] >>> " + Fore.WHITE)

    if selection2 == "7":
        clearConsoleMessageAndTimer(Fore.WHITE + "Logging out...", 2)
        loginMenu()
    elif selection2 == "6":
        clearConsoleMessageAndTimer(Fore.WHITE + "Loading...", 2)

        cwd = os.getcwd()
        file = open(f"{cwd}\\accounts\\accounts.txt", "r")

        detailsList = []

        for line in file:
            detailsList.append(line.split(","))

        for details in detailsList:

            encryptedUsername = "".join(chr(ord(char)+3) for char in user0)
            encryptedPassword = "".join(chr(ord(char)+3) for char in pass0)

            if encryptedUsername == details[0] and encryptedPassword == details[1]:
                decryptedUsername = "".join(chr(ord(char)-3) for char in details[0])
                decryptedPassword = "".join(chr(ord(char)-3) for char in details[1])
                decryptedFirstname = "".join(chr(ord(char)-3) for char in details[2])
                decryptedSurname = "".join(chr(ord(char)-3) for char in details[3])
                decryptedAge = "".join(chr(ord(char)-3) for char in details[4])
                print(Fore.WHITE + "#=========================>>")
                print("|" + Fore.BLUE + "Username: " + Fore.LIGHTBLUE_EX + f"{decryptedUsername}")
                print(Fore.WHITE + "#=========================>>")
                print("|" + Fore.BLUE + "Password: " + Fore.LIGHTBLUE_EX + f"{decryptedPassword}")
                print(Fore.WHITE + "#=========================>>")
                print("|" + Fore.BLUE + "Firstname: " + Fore.LIGHTBLUE_EX + f"{decryptedFirstname}")
                print(Fore.WHITE + "#=========================>>")
                print("|" + Fore.BLUE + "Surname: " + Fore.LIGHTBLUE_EX + f"{decryptedSurname}")
                print(Fore.WHITE + "#=========================>>")
                print("|" + Fore.BLUE + "Age: " + Fore.LIGHTBLUE_EX + f"{decryptedAge}")
                print(Fore.WHITE + "#=========================>>")
                print(Fore.LIGHTBLACK_EX + "\nPress enter to go back...")
                selection1 = input(Fore.GREEN + "[Info] >>> " + Fore.WHITE)

                if not selection == "":
                    clearConsoleMessageAndTimer(Fore.WHITE + "Loading...", 2)
                    databaseOptionMenu()
    elif selection2 == "5":
        clearConsoleMessageAndTimer(Fore.YELLOW + "Still coding...", 2)
        databaseOptionMenu()
    elif selection2 == "4":
        clearConsoleMessageAndTimer(Fore.YELLOW + "Still coding...", 2)
        databaseOptionMenu()
    elif selection2 == "3":
        clearConsoleMessageAndTimer(Fore.YELLOW + "Still coding...", 2)
        databaseOptionMenu()
    elif selection2 == "2":
        clearConsoleMessageAndTimer(Fore.YELLOW + "Still coding...", 2)
        databaseOptionMenu()
    elif selection2 == "1":
        clearConsoleMessageAndTimer(Fore.YELLOW + "Still coding...", 2)
        databaseOptionMenu()
    if selection2 == "8":
        clearConsoleMessageAndTimer(Fore.RED + "Exiting program..." + Fore.RESET, 2)
        exit()
    elif not selection == "[1-8]":
        clearConsoleMessageAndTimer(Fore.RED + "Please select from 1 to 8.", 2)
        databaseOptionMenu()
#======================================================================#
def login():

    global user0
    user0 = input(Fore.CYAN + "Username: " + Fore.WHITE).lower()
    global pass0
    pass0 = input(Fore.CYAN + "Password: " + Fore.WHITE)

    encryptedUsername = "".join(chr(ord(char)+3) for char in user0)
    encryptedPassword = "".join(chr(ord(char)+3) for char in pass0)

    try:
        cwd = os.getcwd()
        file = open(f"{cwd}\\accounts\\accounts.txt", "r")
    except:
        clearConsoleMessageAndTimer(Fore.RED + "Account doesn't exist. Please register an account.", 3)
        clearConsoleMessageAndTimer(Fore.WHITE + "Loading...", 2)
        loginMenu()

    detailsList = []
    line = 0
    for line in file:
        detailsList.append(line.split(","))

    loggedIn = False

    for details in detailsList:
        if encryptedUsername == details[0] and encryptedPassword == details[1]:
            loggedIn = True
            break

    if loggedIn:
        clearConsoleMessageAndTimer(Fore.LIGHTGREEN_EX + "Successfully logged in.", 2)
        clearConsoleMessageAndTimer(Fore.WHITE + "Loading...", 1)
        databaseOptionMenu()
    else:
        clearConsoleMessageAndTimer(Fore.RED + "Incorrect password or username. Please try again.", 2)
        clearConsoleMessageAndTimer(Fore.WHITE + "Loading...", 1)
        loginMenu()
#======================================================================#
def loginMenu():

    print(Fore.WHITE + "#===================================#")
    print("|" + Fore.LIGHTBLUE_EX + "    Welcome to Python Database!    " + Fore.WHITE + "|")
    print("|                                   |")
    print("|" + Fore.BLUE + "       Press 1 to Register         " + Fore.WHITE + "|")
    print("|" + Fore.BLUE + "        Press 2 to Login           " + Fore.WHITE + "|")
    print("|                                   |")
    print("|" + Fore.BLUE + "      Press 3 for help menu        " + Fore.WHITE + "|")
    print("|                                   |")
    print("|" + Fore.BLUE + "    Press 4 to exit the program    " + Fore.WHITE + "|")
    print("#===================================#")

    global selection
    selection = input(Fore.GREEN + "[PyDatabase] >>> " + Fore.WHITE)

    if selection == "1":
        register()
    elif selection == "2":
        login()
    elif selection == "3":
        clearConsole()
        print(Fore.WHITE + "#-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=" + Fore.LIGHTBLUE_EX + "Help Menu" + Fore.WHITE + "=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-#")
        print("|                                                                             |")
        print("|" + Fore.BLUE + "            First time using? Start by registering an account.               " + Fore.WHITE + "|")
        print("|" + Fore.BLUE + "          To do that you need to press 1, and enter your details             " + Fore.WHITE + "|")
        print("|" + Fore.BLUE + "             If your already a user then press 2 to login.                   " + Fore.WHITE + "|")
        print("|" + Fore.BLUE + "       To view your account details when your're logged in press 5.          " + Fore.WHITE + "|")
        print("|" + Fore.BLUE + "       To log out from your account press 6, when your're logged in.         " + Fore.WHITE + "|")
        print("|                                                                             |")
        print("|" + Fore.LIGHTBLACK_EX + "                          Press enter to go back                             " + Fore.WHITE + "|")
        print("#-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-#")

        selection1 = input(Fore.GREEN + "[Help] >>> " + Fore.WHITE)

        if not selection == "":
            clearConsoleMessageAndTimer(Fore.WHITE + "Loading...", 2)
            loginMenu()

    elif selection == "4":
        clearConsoleMessageAndTimer(Fore.RED + "Exiting program..." + Fore.RESET, 2)
        exit()
    else:
        clearConsoleMessageAndTimer(Fore.RED + "Please select from 1 to 4.", 3)
        loginMenu()
#======================================================================#
def clearConsoleMessageAndTimer(message, seconds):
    clearConsole()
    print(message)
    time.sleep(seconds)
    clearConsole()
#======================================================================#
clearConsole()
loginMenu()


text:
Q: How to concatenate multiple cells without typing each one and add a space after each value I have a list of hashtags that I would like to use in my Instagram posts.  I would like to make groupings of the hashtags so I can easily copy and paste them to my posts.
The hashtags are sorted by popularity, so ideally, I would like to do something like A1, A10, A20, A30, A40, A50, A60, then the next cell, I would concatenate A2, A11, A21...
Is there a way to achieve this easily?

A: If you have office 2019 or newer, the TEXTJOIN function would be useful, e.g.:
=TEXTJOIN(" ",TRUE,A1:A10)

Or for a non-continuous range:
=TEXTJOIN(" ",TRUE,A1,A10,A20,A30,...)

Or for some arbitrary selection or series (requires Office 365), e.g. every 10th row:
=TEXTJOIN(" ",TRUE,INDEX(A1:A1000,MAKEARRAY(1,10,LAMBDA(r,c,c*10))))

A: The first thing I did was to concatenate a space to the end of my data.
=CONCATENATE(A1," ")

Then I did a formula manually.
=CONCATENATE(A1,A10,A20,A30,A40,A50,A60,A70,A80,A90)

Then all I had to do was fill down and it worked.


text:
Q: why data normalization is important for models when parameters can manage the feature weight/importance When we study about normalization, various facts are given to explain the necessity.
The most important of all is that:

Normalized column if in higher range than others can have more impact
  on output and make our results biased.

Simple example: a model which uses features like person age and salary- Age can have low effect on output as its very small and salary might impact more.
But my question is that model should be smart enough to calculate theta as per the range. Age will have higher theta whereas salary will have small. And thus the model will not be biased towards salary.
Another reason they say that in ML, normalization helps algo in converging faster. Similar thing of varied range theta can also be applicable here and hence our algorithm will converge on the same speed.
I need some help in understanding these concepts of normalizing X or coming up with theta with values as per range of X.

A: One example of the quote you give is the use of standardization in PCA (and thus also PCR): Variables measured on a different scale will by definition have a higher variance, causing PCA to attribute greater importance to such variables. In this case, whether you standardize or not says something about whether variables with greater variance are indeed more 'important', or simply measured on a different scale. A similar argument can be made for normalization in other methods.
Another reason is numerical stability. Very small numbers may be hindered in their precision by the machine precision. Very high numbers may hinder the speed of computation.
As to why algorithms can't take this into consideration by themselves: How else would an algorithm do so other than by normalizing or standardizing?


text:
Q: Java out of memory error on CentOS Hi,
I am running an application that requires java on a CentOS server but it is continuously crashing. When I look at the logs this is what I get:
Server exception monitor uncatched exception: java.lang.OutOfMemoryError: Java heap space

This is my java version:
java version "1.7.0_07"
Java(TM) SE Runtime Environment (build 1.7.0_07-b10)
Java HotSpot(TM) 64-Bit Server VM (build 23.3-b01, mixed mode)

Seems like it is out of memory or something but I have no idea how to fix this. What should I do?
Thank you.

A: You need to give your application more heap memory, using the -Xmx flag at execution time:
$ java -Xmx4096m ...

A: If you run an application via init script, you should take a look at that script to see where you can adjust memory setting for your application.
If you run an application directly by command, use the options like @EEAA said. This memory will be allocated to JVM whenever you execute the command.
and btw, which application are you trying to run?


text:
Q: For loop in r consistently slow on 4 million records I'm a beginner in r
I have to find the range of a number in TIS column and update another column. I'm using below code but its extremely slow. Any thoughts on how to improve it?
table name : data

    for (i in 1:nrow(data)) {
    if (data$TIS[i] > 100)
    data$test[i] <- ">100"
    else if (data$TIS[i] > 60 & data$TIS[i] <=100)
    data$test[i] <- "61-100"
    else if (data$TIS[i] > 48 & data$TIS[i] <=60)
    data$test[i] <- "49-60"
    else if (data$TIS[i] > 36 & data$TIS[i] <=48)
    data$test[i] <- "37-48"
    else if (data$TIS[i] > 24 & data$TIS[i] <=36)
    data$test[i] <- "25-36"
    else if (data$TIS[i] > 12 & data$TIS[i] <=24)
    data$test[i] <- "13-24"
    else if (data$TIS[i] > 3 & data$TIS[i] <=12)
    data$test[i] <- "4-12"
    else if (data$TIS[i] > -1 & data$TIS[i] <=3)
    data$test[i] <- "0-3"
    else
    data$test[i] <- "-1" }

A: use cut:
 data$test <- cut(data$TIS, breaks=c(0,3,12,24,36,48,100,Inf))

(you may need to modify the breaks above to get exactly what you want)


text:
Q: Getting relevant (rather then pseudo-random) results with google maps places API I read all the posts (here and elsewhere) about the Places API and still can't find a solution. I have a form in which the user can input the street and either the number or the building name (like a mall). I want to validate the info via geocode (if it's a number) or places (if it's a name) before submitting and showing the map as I need the exact address, but the Places search gives me pseudo-random results. For example:
var cityCenter = new google.maps.LatLng(1.30563, 103.83751);
var building = 'Forum';
places = new google.maps.places.PlacesService(map);
places.search({ location: cityCenter, radius:'50000', query:building }, function(results, status)
{
    console.log(results);
});

The first result on maps.google.com is perfect. Actually the first several results are relevant or at least contain the 'Forum' word. In my app I get 20 results that are not remotely related (apparently) to my query.
Is there any way I can get the same results as the website?

A: It appears that you are trying to use the places.textSearch service as you are using the query parameter, however you are calling the places.search service.
Try:
places.textSearch({ location: cityCenter, radius:'50000', query:building }, function(results, status)
{
    console.log(results);
});


text: Q: Why do my sprites that have curves appear jagged in SpriteKit? I am using a sprite (SKSpriteNode) that's 400px by 400px. Whether I scale this image or not, it does not have smooth curves. However, when I create an SKLabelNode, the text is very very smooth. Why does this happen and what can I do to correct it? Extra info: I'm using Pixelmator and Gimp for image creation.


text:
Q: find the second occurrence of a char in a string php Imagine i have this string :
$info="portugal,alemanha,belgica,porto 1-0 alemanha, belgica 2-0";

I want to know the position of the 2nd char "-", so i want the result 2-0 and not the result 1-0.
I'm using this function, but it's always returning the first position,
$pos = strpos($info, '-');

Any idea? Thanks

A: Try this
preg_match_all('/-/', $info,$matches, PREG_OFFSET_CAPTURE);
echo $matches[0][1][1];

A: Simplest solution for this specific case is to use the offset parameter:
$pos = strpos($info, '-', strpos($info, '-') + 1);

You might want to look into using regular expressions, though.

A: You have to use offset parameter
$pos = strpos($info, '-', [offset]);

It will work perfectly.


text:
Q: How do I set "CustomAttribute6" for a regular AD user? I'm trying to set AD attribute 6 in Powershell to update a user who has no mailbox, and isn't an exchange contact; and is only an AD user  ObjectClass : user
The command I'm using is:
 get-adobject -filter {mail -eq "danielk@company.com"  }
         | set-adobject -replace @{CustomAttribute6="daniel.k@company.com" }

The error I get is
Set-ADObject : The specified directory service attribute or value does not exis
t
Parameter name: CustomAttribute6
At line:1 char:75
+ get-adobject -filter {mail -eq "danielk@asdf.com" } | set-adobject <<
<<  -replace @{CustomAttribute6="daniel.k@nfp.com" }
    + CategoryInfo          : InvalidArgument: (CN=k\, Dan...e,DC=asdf,DC=
   com:ADObject) [Set-ADObject], ArgumentException
    + FullyQualifiedErrorId : The specified directory service attribute or val
   ue does not exist
    Parameter name: CustomAttribute6,Microsoft.ActiveDirectory.Management.Comm
   ands.SetADObject

Since I've simplified this as far as I can go, I don't know what to try next.  Any assistance is appreciated.

A: I think the correct name for the attribute would be extensionAttribute6, try that?


text:
Q: NGINX Reverse Proxy A Port Between 2 Servers Apologies if this is an obvious question, I've been reading up on NGINX and am hoping this is something I can use with my Icecast server.
Essentially I have the following setup:
ipAddress:8080 - Icecast Server (mount point is /stream)

domain.tld - Server running NGINX & hosting a PHP site.

What I'd like todo is take any requests to, for example, domain.tld:8000/stream and have it return what is actually ipAddress:8080/stream
Is this something NGINX can handle? Forgive me if I am missing something obvious, presently all I can find are guides on redirecting files to ports etc
Thanks!

A: It is generally not advisable to reverse-proxy Icecast. It breaks an array of things and if not configured properly can bring down your web server.
If you want to run Icecast on port 80, then I've explained this for Debian (and derivatives like Ubuntu) here: http://lists.xiph.org/pipermail/icecast/2015-February/013198.html


text:
Q: Detecting whether a script has authorization already I recently changed the email addresses for several distribution groups, and I want to help users remove the OLD addresses from their contact list so they don't accidentally send emails into the ether. The Admin SDK does not provide access to other users' contacts, so I have made a script (EDIT: deployed as a web app) that runs as the user at the keyboard to delete the relevant groups. However, when the page loads, they are automatically prompted for authorization.
To avoid confusion, I would like to show a message of explanation before this occurs. To do this, I need to detect whether the user has already granted authorization for the required actions.
I have seen a similar behavior in an older add on. In that case, the author used ScriptProperties.getProperty('scriptAuthorized'), but this is now deprecated. Anyone know how to accomplish this?

A: I found a workaround, which I believe may be the only way to actually address this issue.
Remember, the web app was set to run as the user at the keyboard rather than as me. This was required so that the app could access the user's contacts. One consequence of this is that even the doGet(e) function REQUIRES AUTHORIZATION. That means that there was no way to display ANYTHING without authorization. This rendered my original intent of detecting the script authorization moot. Even if it didn't, I believe that even the action of checking authorization requires authorization.
My solution to this problem was to create a second web app to use as a portal for the real web app. This portal app runs as ME instead of the user at the keyboard, therefore doesn't require authorization to load. I can't detect whether they need authorization, but I can at least present them with information that they MIGHT encounter the dialog.
I've included the (very simple) html for the portal:
<!DOCTYPE html>

    <base target="_top">

    This tool will erase all of the old, irrelevant contact groups.

    When you click below, you may be prompted to authorize this app. Please do so.

      <input type='button' value='Click here to begin'>

I think I'll be using this strategy for a few other purposes as well, so I'm leveraging the solution found in this discussion to serve multiple html pages from one web app: Linking to another HTML Page in Google Apps Script


text:
Q: Flutter - Keyboard is raising on screen the FloatingActionButton I was using the TextField but the keyboard is raising the FloatingActionButton. I wonder if it is possible for the keyboard not to raise a FloatingActionButton?
In the code below I put two FloatingActionButton in two different ways but in both the keyboard goes up, which hinders the field filling since the FABs are in the same line as the TextField, according to the gif below.
Is there any way to solve this?

import 'package:flutter/material.dart';
import 'dart:ui' as ui;

void main() {
  runApp(new MyApp());
}

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return new MaterialApp(
      home: new MyHomePage(),
    );
  }
}

class MyHomePage extends StatefulWidget {
  @override
  _MyHomePageState createState() => new _MyHomePageState();
}

class _MyHomePageState extends State<MyHomePage> {
  @override
  Widget build(BuildContext context) {
    final ui.Size logicalSize = MediaQuery.of(context).size;
    final double _width = logicalSize.width;
    return new Scaffold(
      appBar: new AppBar(backgroundColor: new Color(0xFF26C6DA)),
      body: new Stack(
        children: <Widget>[
          new ListView(
            children: <Widget>[
              new TextField(
                decoration: const InputDecoration(
                  labelText: "Description",
                ),
                style: Theme.of(context).textTheme.title,
              ),
              new TextField(
                decoration: const InputDecoration(
                  labelText: "Description",
                ),
                style: Theme.of(context).textTheme.title,
              ),
              new TextField(
                decoration: const InputDecoration(
                  labelText: "Description",
                ),
                style: Theme.of(context).textTheme.title,
              ),
            ],
          ),
          new Positioned(
            bottom: 16.0,
            left: (_width / 2) - 28,
            child: new FloatingActionButton(
              backgroundColor: new Color(0xFFE57373),
              child: new Icon(Icons.check),
              onPressed: (){}
            ),
          )
        ],
      ),
      floatingActionButton: new FloatingActionButton(
        backgroundColor: new Color(0xFFE57373),
        child: new Icon(Icons.check),
      ),
    );
  }
}

A: It looks like you're designing a full screen dialog.
A floating action button represents the primary action in an application, like creating a new item. It is not what you'd use to confirm changes and dismiss a full screen dialog that contains a list of text fields.
Rather than using a FloatingActionButton, I would a recommend an AppBar with a FlatButton in the actions slot, like in this Material design example:

You can see an example of how to build a full-screen dialog in Flutter in the Gallery source code.


text:
Q: How Can Set Icon for each node by c# Ajax Response in Jstree? How Can Set Icon for each node by c# Ajax Response in Jstree?
in this line see Ajax jstree :
Webmethod is not fired by jsTree
the ajax jstree successfully run, but how can show Icon for each node ?
in this line :
_GG_JSTree.icons = "";   How Can set icons?
 private static List<GG_JSTree> AddChildNodes(int _ParentID, int NumOfChildren, string ParentName)
{
    List<GG_JSTree> GG_JSTreeArray = new List<GG_JSTree>();
    int n = 10;
    for (int i = 0; i < NumOfChildren; i++)
    {
        int CurrChildId = (_ParentID == 0) ? n : ((_ParentID * 10) + i);
        GG_JSTree _GG_JSTree = new GG_JSTree();
        _GG_JSTree.data = (_ParentID == 0) ? "root" + "-Child" + i.ToString() : ParentName + CurrChildId.ToString() + i.ToString();
        _GG_JSTree.state = "closed";  //For async to work
        _GG_JSTree.icons = "";   How Can set?
        _GG_JSTree.IdServerUse = (int)CurrChildId;
        _GG_JSTree.children = null;
        _GG_JSTree.attr = new GG_JSTreeAttribute { id = CurrChildId.ToString(), selected = false };
        GG_JSTreeArray.Add(_GG_JSTree);
        n = n + 10;
    }

    return GG_JSTreeArray;
}

A: Take a look at the format spec:
https://github.com/vakata/jstree#the-required-json-format

*

*The property name is icon, not icons.
( state should be an object, no a string, etc.

As for the icon property it is explained in the above link:

icon - a string which will be used for the node's icon - this can either be a path to a file, or a className (or list of classNames), which you can style in your CSS (font icons also work).

Basically - just take a deeper look at the docs and you should be fine.

A: try following
_GG_JSTree.icon = "glyphicon glyphicon-heart";

if u use bootstrap to show heart icon
'icon' defined in 'Type' plugin section may override this.


text:
Q: Replace column names with the number from the original label I want to rename multiple columns at once by using the digit(s) from the original column name. With one caveat though. Some questions have the same numbers and are differentiated by the addition of "other." In that case, I want to keep "other" next to the digit(s). Ideally, in front of every column name, I would add "item_". Bonus points if the solution uses the pipe operator (|>).
I have been looking for this answer on StackOverflow, but I could not find this exact situation. Please, feel free to re-direct me to questions already answered if this is a duplicate.
Toy dataset:
df_toy <- data.frame(
  ID = 1:20,
  "variable 1 - language" = sample(1:4, 20, replace = TRUE),
  "variable 1 - other" = sample(1:7, 20, replace = TRUE),
  "variable 2 - math" = sample(1:5, 20, replace = TRUE),
  "question 4 - writing" = sample(1:20, 20, replace = TRUE),
  "question 4 other" = NA, check.names = FALSE
)

   ID variable 1 - language variable 1 - other variable 2 - math question 4 - writing question 4 other
1   1                     2                  2                 1                   14               NA
2   2                     2                  7                 4                   16               NA
3   3                     3                  1                 1                    7               NA
4   4                     2                  2                 1                    1               NA
5   5                     4                  1                 2                   19               NA
6   6                     1                  6                 4                    2               NA
7   7                     2                  7                 2                    3               NA
8   8                     1                  3                 4                   18               NA
9   9                     3                  3                 5                   18               NA

Desidered output:
   ID item_1 item_1 other item_2 item_4 item_4 other
1   1      1            3      2      3           NA
2   2      1            5      2     13           NA
3   3      4            6      1     13           NA
4   4      3            6      3     19           NA
5   5      4            3      5      6           NA
6   6      1            4      4      2           NA
7   7      3            7      3     12           NA
8   8      3            2      3     14           NA
9   9      4            7      1      7           NA
10 10      3            7      1      5           NA

A: Or use rename_with and stringr:
library(dplyr)
library(stringr)

df_toy |>
  rename_with(~ paste0("item_", str_extract(., "\\d+"), if_else(str_detect(., "other"), "_other", "")),
              .cols = -ID)

Output:
# A tibble: 20 × 6
      ID item_1 item_1_other item_2 item_4 item_4_other
   <int>  <int>        <int>  <int>  <int> <lgl>
 1     1      4            1      2      3 NA
 2     2      2            7      2     19 NA
 3     3      3            6      4      8 NA
 4     4      2            6      4     13 NA
 5     5      3            2      4      1 NA
 6     6      1            3      5      2 NA
 7     7      4            1      5     11 NA
 8     8      2            1      4     16 NA
 9     9      3            2      4      5 NA
10    10      1            2      2      4 NA
11    11      4            4      5      3 NA
12    12      2            3      2     15 NA
13    13      3            2      2     10 NA
14    14      2            2      4      7 NA
15    15      1            5      5      7 NA
16    16      3            7      3      2 NA
17    17      3            1      3     18 NA
18    18      4            7      2     18 NA
19    19      4            3      2      3 NA
20    20      3            7      1      8 NA


text:
Q: Spring Boot 1.3 Tomcat 8 deployment error I use IntelliJ Idea 15 and creates a gradle project with spring boot 1.3 to set a spring mvc configuration.This are my files
Gradle Configuration
 buildscript {
    ext {
        springBootVersion = '1.3.0.RELEASE'
    }
    repositories {
        mavenCentral()
    }
    dependencies {
        classpath("org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}")
    }
}
apply plugin: 'java'
apply plugin: 'idea'
apply plugin: 'spring-boot'
apply plugin: 'war'

war {
    baseName = 'Contratation'
    version = '0.0.1-SNAPSHOT'
}
sourceCompatibility = 1.8
targetCompatibility = 1.8

repositories {
  mavenCentral()
}

configurations {
    providedRuntime
}

dependencies {
    compile('org.springframework.boot:spring-boot-starter-data-jpa')
    compile('org.springframework.boot:spring-boot-starter-data-rest')
    compile('org.springframework.boot:spring-boot-starter-security')
    compile('org.springframework.boot:spring-boot-starter-web')
    runtime('org.postgresql:postgresql:9.4-1201-jdbc41')
    providedRuntime('org.springframework.boot:spring-boot-starter-tomcat')
    testCompile('org.springframework.boot:spring-boot-starter-test')
    testCompile('org.springframework.restdocs:spring-restdocs-mockmvc:1.0.0.RELEASE')
}

task wrapper(type: Wrapper) {
    gradleVersion = '2.7'
}

ContratationApplication
package penacholab.contratation;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;

@SpringBootApplication
public class ContratationApplication {

    public static void main(String[] args) {
        SpringApplication.run(ContratationApplication.class, args);
    }
}

ServletInitializer
package penacholab.contratation;

import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.boot.context.web.SpringBootServletInitializer;

public class ServletInitializer extends SpringBootServletInitializer {

    @Override
    protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
        return application.sources(ContratationApplication.class);
    }

}

And when I deploy it in my tomcat 8 throwing this exception
Connected to server
[2015-11-27 02:57:54,117] Artifact Gradle : Contratation : Contratation-0.0.1-SNAPSHOT.war: Artifact is being deployed, please wait...
27-Nov-2015 14:57:56.093 SEVERE [RMI TCP Connection(4)-127.0.0.1] org.apache.catalina.core.ContainerBase.addChildInternal ContainerBase.addChild: start:
 org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[]]
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:154)
    at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:725)
    at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:701)
    at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:717)
    at org.apache.catalina.startup.HostConfig.manageApp(HostConfig.java:1675)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:497)
    at org.apache.tomcat.util.modeler.BaseModelMBean.invoke(BaseModelMBean.java:300)
    at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.invoke(DefaultMBeanServerInterceptor.java:819)
    at com.sun.jmx.mbeanserver.JmxMBeanServer.invoke(JmxMBeanServer.java:801)
    at org.apache.catalina.mbeans.MBeanFactory.createStandardContext(MBeanFactory.java:463)
    at org.apache.catalina.mbeans.MBeanFactory.createStandardContext(MBeanFactory.java:413)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:497)
    at org.apache.tomcat.util.modeler.BaseModelMBean.invoke(BaseModelMBean.java:300)
    at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.invoke(DefaultMBeanServerInterceptor.java:819)
    at com.sun.jmx.mbeanserver.JmxMBeanServer.invoke(JmxMBeanServer.java:801)
    at javax.management.remote.rmi.RMIConnectionImpl.doOperation(RMIConnectionImpl.java:1466)
    at javax.management.remote.rmi.RMIConnectionImpl.access$300(RMIConnectionImpl.java:76)
    at javax.management.remote.rmi.RMIConnectionImpl$PrivilegedOperation.run(RMIConnectionImpl.java:1307)
    at javax.management.remote.rmi.RMIConnectionImpl.doPrivilegedOperation(RMIConnectionImpl.java:1399)
    at javax.management.remote.rmi.RMIConnectionImpl.invoke(RMIConnectionImpl.java:828)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:497)
    at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:323)
    at sun.rmi.transport.Transport$1.run(Transport.java:200)
    at sun.rmi.transport.Transport$1.run(Transport.java:197)
    at java.security.AccessController.doPrivileged(Native Method)
    at sun.rmi.transport.Transport.serviceCall(Transport.java:196)
    at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:568)
    at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(TCPTransport.java:826)
    at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.lambda$run$254(TCPTransport.java:683)
    at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler$$Lambda$1/1344031559.run(Unknown Source)
    at java.security.AccessController.doPrivileged(Native Method)
    at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:682)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    at java.lang.Thread.run(Thread.java:745)
Caused by: org.apache.catalina.LifecycleException: Failed to start component [org.apache.catalina.webresources.StandardRoot@2e5a391c]
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:154)
    at org.apache.catalina.core.StandardContext.resourcesStart(StandardContext.java:4909)
    at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5039)
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
    ... 43 more
Caused by: org.apache.catalina.LifecycleException: Failed to initialize component [org.apache.catalina.webresources.JarResourceSet@30484d13]
    at org.apache.catalina.util.LifecycleBase.init(LifecycleBase.java:106)
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:139)
    at org.apache.catalina.webresources.StandardRoot.startInternal(StandardRoot.java:699)
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
    ... 46 more
Caused by: java.lang.IllegalArgumentException: java.util.zip.ZipException: error in opening zip file
    at org.apache.catalina.webresources.JarResourceSet.initInternal(JarResourceSet.java:96)
    at org.apache.catalina.util.LifecycleBase.init(LifecycleBase.java:102)
    ... 49 more
Caused by: java.util.zip.ZipException: error in opening zip file
    at java.util.zip.ZipFile.open(Native Method)
    at java.util.zip.ZipFile.<init>(ZipFile.java:220)
    at java.util.zip.ZipFile.<init>(ZipFile.java:150)
    at java.util.jar.JarFile.<init>(JarFile.java:166)
    at java.util.jar.JarFile.<init>(JarFile.java:103)
    at org.apache.catalina.webresources.JarResourceSet.initInternal(JarResourceSet.java:88)
    ... 50 more

[2015-11-27 02:57:56,236] Artifact Gradle : Contratation : Contratation-0.0.1-SNAPSHOT.war: Error during artifact deployment. See server log for details.
27-Nov-2015 14:57:56.126 SEVERE [RMI TCP Connection(4)-127.0.0.1] org.apache.tomcat.util.modeler.BaseModelMBean.invoke Exception invoking method manageApp
 java.lang.IllegalStateException: ContainerBase.addChild: start: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[]]
    at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:729)
    at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:701)
    at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:717)
    at org.apache.catalina.startup.HostConfig.manageApp(HostConfig.java:1675)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:497)
    at org.apache.tomcat.util.modeler.BaseModelMBean.invoke(BaseModelMBean.java:300)
    at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.invoke(DefaultMBeanServerInterceptor.java:819)
    at com.sun.jmx.mbeanserver.JmxMBeanServer.invoke(JmxMBeanServer.java:801)
    at org.apache.catalina.mbeans.MBeanFactory.createStandardContext(MBeanFactory.java:463)
    at org.apache.catalina.mbeans.MBeanFactory.createStandardContext(MBeanFactory.java:413)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:497)
    at org.apache.tomcat.util.modeler.BaseModelMBean.invoke(BaseModelMBean.java:300)
    at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.invoke(DefaultMBeanServerInterceptor.java:819)
    at com.sun.jmx.mbeanserver.JmxMBeanServer.invoke(JmxMBeanServer.java:801)
    at javax.management.remote.rmi.RMIConnectionImpl.doOperation(RMIConnectionImpl.java:1466)
    at javax.management.remote.rmi.RMIConnectionImpl.access$300(RMIConnectionImpl.java:76)
    at javax.management.remote.rmi.RMIConnectionImpl$PrivilegedOperation.run(RMIConnectionImpl.java:1307)
    at javax.management.remote.rmi.RMIConnectionImpl.doPrivilegedOperation(RMIConnectionImpl.java:1399)
    at javax.management.remote.rmi.RMIConnectionImpl.invoke(RMIConnectionImpl.java:828)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:497)
    at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:323)
    at sun.rmi.transport.Transport$1.run(Transport.java:200)
    at sun.rmi.transport.Transport$1.run(Transport.java:197)
    at java.security.AccessController.doPrivileged(Native Method)
    at sun.rmi.transport.Transport.serviceCall(Transport.java:196)
    at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:568)
    at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(TCPTransport.java:826)
    at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.lambda$run$254(TCPTransport.java:683)
    at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler$$Lambda$1/1344031559.run(Unknown Source)
    at java.security.AccessController.doPrivileged(Native Method)
    at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:682)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    at java.lang.Thread.run(Thread.java:745)

27-Nov-2015 14:57:56.158 SEVERE [RMI TCP Connection(4)-127.0.0.1] org.apache.tomcat.util.modeler.BaseModelMBean.invoke Exception invoking method createStandardContext
 javax.management.RuntimeOperationsException: Exception invoking method manageApp
    at org.apache.tomcat.util.modeler.BaseModelMBean.invoke(BaseModelMBean.java:308)
    at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.invoke(DefaultMBeanServerInterceptor.java:819)
    at com.sun.jmx.mbeanserver.JmxMBeanServer.invoke(JmxMBeanServer.java:801)
    at org.apache.catalina.mbeans.MBeanFactory.createStandardContext(MBeanFactory.java:463)
    at org.apache.catalina.mbeans.MBeanFactory.createStandardContext(MBeanFactory.java:413)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:497)
    at org.apache.tomcat.util.modeler.BaseModelMBean.invoke(BaseModelMBean.java:300)
    at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.invoke(DefaultMBeanServerInterceptor.java:819)
    at com.sun.jmx.mbeanserver.JmxMBeanServer.invoke(JmxMBeanServer.java:801)
    at javax.management.remote.rmi.RMIConnectionImpl.doOperation(RMIConnectionImpl.java:1466)
    at javax.management.remote.rmi.RMIConnectionImpl.access$300(RMIConnectionImpl.java:76)
    at javax.management.remote.rmi.RMIConnectionImpl$PrivilegedOperation.run(RMIConnectionImpl.java:1307)
    at javax.management.remote.rmi.RMIConnectionImpl.doPrivilegedOperation(RMIConnectionImpl.java:1399)
    at javax.management.remote.rmi.RMIConnectionImpl.invoke(RMIConnectionImpl.java:828)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:497)
    at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:323)
    at sun.rmi.transport.Transport$1.run(Transport.java:200)
    at sun.rmi.transport.Transport$1.run(Transport.java:197)
    at java.security.AccessController.doPrivileged(Native Method)
    at sun.rmi.transport.Transport.serviceCall(Transport.java:196)
    at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:568)
    at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(TCPTransport.java:826)
    at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.lambda$run$254(TCPTransport.java:683)
    at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler$$Lambda$1/1344031559.run(Unknown Source)
    at java.security.AccessController.doPrivileged(Native Method)
    at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:682)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.IllegalStateException: ContainerBase.addChild: start: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[]]
    at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:729)
    at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:701)
    at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:717)
    at org.apache.catalina.startup.HostConfig.manageApp(HostConfig.java:1675)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:497)
    at org.apache.tomcat.util.modeler.BaseModelMBean.invoke(BaseModelMBean.java:300)
    ... 34 more

A: The WAR file can't be extracted:
Caused by: java.lang.IllegalArgumentException: java.util.zip.ZipException: error in opening zip file
    at org.apache.catalina.webresources.JarResourceSet.initInternal(JarResourceSet.java:96)
    at org.apache.catalina.util.LifecycleBase.init(LifecycleBase.java:102)
    ... 49 more
Caused by: java.util.zip.ZipException: error in opening zip file

Please check, if the archive is valid, can you look in the file with a zip-tool? And maybe, post the file-list of the contents within the WAR file
Also, take another look at the Spring boot documentation .
It is sufficient to extend your Application from SpringBootServletInitializer :
@SpringBootApplication
public class Application extends SpringBootServletInitializer {

    @Override
    protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
        return application.sources(Application.class);
    }

    public static void main(String[] args) throws Exception {
        SpringApplication.run(Application.class, args);
    }

}


text:
Q: The other part of a polygon shape is not showing at a specific zoom level,I am using geoserver This is the polygon shape looks like when zoom level at 20m,
the shape is not completely displayed compare to zoom 10 m

This is the polygon shape looks like when zoom level at 10m


text:
Q: Latest row of each user Laravel I have a kind of 'chat' system where users can chat privately with the administrator,
but I have a problem. In the adminpanel I need to list all the users with which I have
(had) a conversation with, and those at who I haven't replied at yet need to be
coloured red.
I was able to do this in standard PHP but I have no clue on how to do it in Laravel.
This is my database:
Chat
+----+-----------------------------------------------------------------------------+--------+-------+------+------+------------+------------+
| id | message                                                                     | sender | admin | file | type | created_at | updated_at |
+----+-----------------------------------------------------------------------------+--------+-------+------+------+------------+------------+
|  1 | Heeey!                                                                      |      1 |     0 |    0 |    1 | NULL       | NULL       |
|  2 | Hey.                                                                        |      1 |     1 |    0 |    1 | NULL       | NULL       |
|  4 | Zou ik iets mogen vragen?                                                   |      1 |     0 |    0 |    1 | NULL       | NULL       |
|  5 | Ja, tuurlijk.                                                               |      1 |     1 |    0 |    1 | NULL       | NULL       |
|  6 | Zou u een foto voor mij willen vectoriseren?                                |      1 |     0 |    0 |    1 | NULL       | NULL       |
|  7 | Het is een vrij grootte                                                     |      1 |     0 |    0 |    1 | NULL       | NULL       |
|  8 | Dat is geen enkel probleem!                                                 |      1 |     1 |    0 |    1 | NULL       | NULL       |
|  9 | Stuur maar door                                                             |      1 |     1 |    0 |    1 | NULL       | NULL       |
| 10 | cat.jpeg |      1 |     0 |    1 |    1 | NULL       | NULL       |
| 11 | Bedankt!                                                                    |      1 |     0 |    0 |    1 | NULL       | NULL       |
| 12 | Geen probleem.                                                              |      1 |     1 |    0 |    1 | NULL       | NULL       |
| 13 | e.                                                                          |      1 |     0 |    0 |    1 | NULL       | NULL       |
| 14 | e.                                                                          |      1 |     1 |    0 |    1 | NULL       | NULL       |
| 15 | e.                                                                          |      1 |     0 |    0 |    1 | NULL       | NULL       |
| 16 | e.                                                                          |      1 |     1 |    0 |    1 | NULL       | NULL       |
| 17 | e.                                                                          |      2 |     0 |    0 |    1 | NULL       | NULL       |
| 18 | e.                                                                          |      3 |     0 |    0 |    1 | NULL       | NULL       |
+----+-----------------------------------------------------------------------------+--------+-------+------+------+------------+------------+

Users
+----+---------+---------------+--------------------------------------------------------------+----------------+---------------------+---------------------+
| id | name    | email         | password                                                     | remember_token | created_at          | updated_at          |
+----+---------+---------------+--------------------------------------------------------------+----------------+---------------------+---------------------+
|  1 | Foobar  | foo@mail.com  | $2y$10$xyovyCx32CpbPaiLnKR1o.ls9ydQhupEdMbPyx0Nn2MwOksRAjd0e | NULL           | 2017-04-07 16:05:53 | 2017-04-07 16:05:53 |
|  3 | Guxguz  | guz@mail.com  | $2y$10$fcxZSH9tTFQ8NYRKK46mTuLos3M/vIdzHintrDWhfx5dpteuL4FEG | NULL           | 2017-04-07 21:17:04 | 2017-04-07 21:17:04 |
|  4 | Sluxsux | slux@mail.com | $2y$10$l1QdRB7vrkYvwaA4OiMkWeWl5h2l41U4d9yp1uLuWdcp8QuV07APm | NULL           | 2017-04-07 21:21:54 | 2017-04-07 21:21:54 |
|  6 | Anbob   | an@mail.com   | $2y$10$SO/NsCXmBxGjtsBQmvXrMuUyUb8wjmTE532UaImFqXDxeuGI95hCa | NULL           | 2017-04-07 21:23:20 | 2017-04-07 21:23:20 |
+----+---------+---------------+--------------------------------------------------------------+----------------+---------------------+---------------------+

My controller:
   $users = DB::table('chat')
        ->select('sender', 'admin', 'name')
        ->orderBy('chat.admin', 'asc')
        ->groupBy('sender')
        ->join('users', 'chat.sender', '=', 'users.id')
        ->get();

What I get back:
[{"sender":"1","admin":"0","name":"Foobar"},{"sender":"3","admin":"0","name":"Guxguz"}]

Like you can see at Foobar it says admin=0, but this ain't correct, but if you look in the
database you'll see that the latest row of Foobar says admin=1.
I basically need to take the last row of each user, so I can fetch the name from there
and the admin-column to see if the admin-column is 0 (I wasn't last) or 1 (I was last).
I tried ordering, distinct, max-id,... but none worked.
Thanks!

A: There are some ways to solve your issue. The probably simplest in laravel is to execute two queries.
First get the highest chat id per user:
$latestChatIds = DB::table('chat')
    ->groupBy('sender')
    ->select(DB::raw('max(id) as id'))
    ->get()
    ->pluck('id');

Then use those ids in whereIn() to get the corresponding rows:
$users = DB::table('chat')
    ->join('users', 'chat.sender', '=', 'users.id')
    ->whereIn('chat.id', $latestChatIds)
    ->select('sender', 'admin', 'name')
    ->get();

You can also use the first query as subquery in the second one:
$latestChatIds = DB::table('chat')
    ->groupBy('sender')
    ->select(DB::raw('max(id)'));

$users = DB::table('chat')
    ->join('users', 'chat.sender', '=', 'users.id')
    ->whereIn('chat.id', $latestChatIds)
    ->select('sender', 'admin', 'name')
    ->get();


text:
Q: How can I rename columns automatically from name of the data.frame? I have 15 data frames, which were automatically imported from csv files, each consists of 3 columns, that's why the column names are the same V1, V2 and V3. I would like to distinguish them when I'll get them joined together, so I ' asking for an idea how to rename each columns automatically like e.g. DataFrameName_V1 or something similar.
I have searched a lot for this code,but haven't find any solution yet.
Btw I have this code for the csv import:
file_list <- list.files(pattern="*.csv")
for (i in 1:length(file_list))
 {
   assign(file_list[i],
   read.csv(paste(file_list[i]), na.strings=c("NA", "NULL", ""), header=FALSE, sep=",", stringsAsFactors = FALSE, encoding = "UTF-8"))
 }


text:
Q: Creating mac software activation I am just about done writing a killer application for the mac, however I would like to charge money for this one, as there isn't a lot of applications out there like this one.  So I was thinking of using some sort of activation or license key.  I've looked around but details on how to do it is relatively scarce. How can I do this in a way that will be both easy to implement in my software, as well as something that doesn't require me to run software on my server, or depend on other companies running it on their servers, but if I have to I will. I don't want anything that will require me to pay money to some company to do it for me, paypal will get a big enough cut, I don't want another company taking a cut.

A: Take a look at Aquatic Prime.

A: There's also CocoaFob:
http://www.turbodad.com/articles/48/cocoafob-released
which works with Potion Store:
http://www.potionfactory.com/potionstore


text:
Q: What is normal symfony 3 load time in development? I have optimized performance by this documentation page:
http://symfony.com/doc/current/performance.html#optimizing-all-the-files-used-by-symfony
except parts "Caching the Autoloader with APC" and Use Bootstrap Files¶
because when calling line
include_once __DIR__.'/../app/bootstrap.php.cache';

I got an error.
But page still loads at best about 2.5 seconds even if application does nothing, just outputs small hardcoded text.
I am running php built in server like this:
php -S 0.0.0.0:8000

and version is 5.6
I know with php 7 it should be faster, but before php 7 people still used to code with php 5.6. Were they really coding and waiting 2.5 seconds for each page reload? And if application does some heavier work it then would take even more.
My machine is running on windows 7, 8 GB ram, Intel B960 processor.
Can I do something to increase load time more? I think its a waste of time to wait 2.5 seconds for each small fix because it adds up over time. I want the app to be lightning fast.

A: "Normal Symfony Loadtime" clearly depends on your machine. I've also noticed some high loading times in dev and localhost, whereas in dev on a server (a mid level one) I'm under 300ms per page (and even quite big ones...)
The only fix for me was to develop on a server and abandon localhost.


text:
Q: SCM: Wiki + Forum + ticket System Is there any open source framework that encapsulates: a Wiki, Forum and a ticket system. Something like a software configuration Manager (SCM).
Looking for something very similar to sourceforge offers to project owners.
I'm looking to give support to a small private web software project. I keep finding separate implementations of these features.
If there are commercial products it would be nice to hear from them too.
Wordpress might be an option.

A: You could use Redmine. It offers a Wiki, Boards (=Forum), Issue tracking.
Another popular alternative would be Trac which offers Wiki and Issue tracking. For forums there exists a plugin (The plugin is not actively developed anymore?).


text:
Q: Proving that g is coercive and strictly convex Hello can someone help me understand this?
Suppose we have $g(a) =a^4+a^3+2a^2+a+1$. Prove that g is coercive and strictly convex on R. Therefore, g has a unique global minimizer a*.


text:
Q: How to iterate over a vector of strings and use switch case in matlab? I am new to matlab (few minutes old!). I have a vector of strings as:
methods = {'adaptiveMixtureDiscriminantAnalysis',
          'gamSpline',
          'genaralizedPartialLeastSquares'
          'penalizedMultinomialRegression',
          'quadraticDiscriminantAnalysis'}

I am using a switch-case construct as follows:
for training_method = methods

    switch training_method
        case 'adaptiveMixtureDiscriminantAnalysis'
            evalR('signal_and_conf <- adaptiveMixtureDiscriminantAnalysis(train_predictors, train_labels, test_predictors)');
        case 'gamSpline'
            evalR('signal_and_conf <- gamSpline(train_predictors, train_labels, test_predictors)');
        case 'genaralizedPartialLeastSquares'
            evalR('signal_and_conf <- genaralizedPartialLeastSquares(train_predictors, train_labels, test_predictors)');
        case 'penalizedMultinomialRegression'
            evalR('signal_and_conf <- penalizedMultinomialRegression(train_predictors, train_labels, test_predictors)');
        case 'quadraticDiscriminantAnalysis'
            evalR('signal_and_conf <- quadraticDiscriminantAnalysis(train_predictors, train_labels, test_predictors)');
        case 'majorityVoting'
            evalR('signal_and_conf <- majorityVoting(train_predictors, train_labels, test_predictors)');
        otherwise
            disp('No such model is available!')
    end

end

But it gives me an error saying SWITCH expression must be a scalar or string constant.
I also tried using cellstr() for training_method and also using [training_method] in switch construct but still no luck.
Update:
All I had to do was changing training_method to char(training_method) in switch statement and it worked. I am still confused with cell and char datatypes though.

A: Each element training_method in your for loop would be a cell array of a single element.  You can only use switch with an actual character array or integer literals, so you need to unpack the cell by either doing training_method{1}, or char(training_method) as you have stated in your update.
As such, do either:
for training_method = methods

    switch training_method{1}

    ....

Or:
for training_method = methods

    switch char(training_method) %// Already done by you

    ....


text:
Q: how do i find all files with the same name in all subdirectories I want to find all the different .gitignore files I have to combine them into one.
I tried something like find */**/.gitignore but that came up with nothing.
All the files are in sub directories of my current dir, as well as the current directory.
I am using Bash on linux

A: find -name .gitignore

That should do
Since you are using bash:
shopt -s globstar
echo **/.gitignore

From man bash:
   globstar
          If set, the pattern ** used in a pathname expansion context will match a
          files and zero or more directories and subdirectories.  If the pattern is
          followed  by  a /, only directories and subdirectories match.

A: Try this
find /home/user1 -name 'result.out' 2>/dev/null

In your case
find /<your DIR> -name '*.gitignore' 2>/dev/null

This results in
/home/user1/result.out
/home/user1/dir1/result.out
/home/user1/dir2/result.out


text:
Q: How can I add an instance method to all Models in sails.js? I'd like to add a default toDisplay function to all models which will use metadata, not unlike attribute/association definitions, to perform manipulations on the instance's attributes/associations making them suitable for display in the UI.
for example:

Foo.findOne(someId)
  .exec(function(err, foo) {
    ...
    res.view({
      foo: foo.toDisplay(),
    });
  });

So, I'd like to add this function too all models.  I can imagine a
Model.prototype.toDisplay = ...

solution, but I'm not sure where to get Model from (some long require('waterline/..../model') path?), and if I had Model, where to put that snip-it.
Please advise.

A: Model configuration is fully documented here on SailsJS.org.  @umassthrower is correct in pointing out that adding an instance method to config/models.js would add it to all of your models; he's also correct in observing that this is not the intended use of the config file.
The reason you're finding this a bit more challenging in Sails than Rails is that Ruby has real  classes and inheritance, and Javascript just has objects.  One fairly clean way to simulate inheritance and extend your model objects from a "base" object would be to use something like Lodash's _.merge function.  For example you could save your base model in lib/BaseModel.js:
// lib/BaseModel.js
module.exports = {

  attributes: {

    someAttribute: 'string',

    someInstanceFunction: function() {
      // do some amazing (synchronous) calculation here
    }

  }

};

Then in your model file, require lodash and use _.extend:
// api/models/MyModel.js
var _ = require('lodash');
var BaseModel = require("../../lib/BaseModel.js");
module.exports = _.merge({}, BaseModel, {

  attributes: {

    someOtherAttribute: 'integer'

  }

};

The attributes from your base model will be merged with MyModel, with MyModel taking precedence.
Setting the first argument to the empty model {} is important here; _.merge is destructive for the first object sent in, so if you just did _.merge(BaseModel, {...} then the base model would be modified.
Also, remember to npm install lodash!

A: In Sails 0.x, when the moduleloader was loaded, you could access to sails.models directly, but now in 1.x this is not ready yet, so, my solution to this was creating a custom hook that wraps the loadModels function of sails.modules, this may not be the best solution but works for me @adam-pietrasiak hope this works for you too :) I am also super lazy when it comes to repeating code.
// provide this code in api/hooks/overrides.js or use another name, who cares

const _ = require('lodash');

module.exports = function (sails) {
    return {
        defaults: {},
        savedModelLoad: null,

        configure: function () {
            this.savedModelLoad = this.savedModelLoad || sails.modules.loadModels;
            sails.modules.loadModels = this.loadModelsAndApplyOverrides;
        },

        loadModelsAndApplyOverrides: function(cb){
            this.savedModelLoad(function (err, models) {
                const newModels = _.map(models, applyModelOverrides);

                cb(err, newModels);
            });
        }
    };
};

function applyModelOverrides(model) {
    return _.merge(model, {
      // do your custom stuff here
        attributes: {

            someAttribute: 'string',

            someInstanceFunction: function() {
                // do some amazing (synchronous) calculation here
            }

        }
    });
}


text:
Q: SSD on Vmware ESXI 4 (TRIM? Good Idea?) I just posted about finding bottle necks and have narrowed it down to having way too many VMs on my machine on one 15K SAS drive. I have plenty of cores and plenty of ram.
So I am planning on putting 6 VMs on one drive (so 5 drives for 30 VMs). I am thinking of using a 60GB Vertex 2 SSD. Each of my VMs will only need about 6GB of HDD space so this isn't a big deal.
My questions are:

*

*does ESXI support Trim and do I really need it if I leave 25% of the drive as free space? If I need it should I get a diff drive that handles garbage collection differently?

*Is there anything I need to consider regarding SSD's in virtualized environments.

Thanks for any and all help!
UPDATE: So the main question if I use a 60GB drive and leave 20GB free how badly will the drive degrade due to a lack of Trim? What about if I get a drive such as the Kingston SSDNow V+100 with hardware os-independent garbage collection??

A: ESXi does not support trim directly as noted in the following post:
Trim on intel x25-m G2 when connected by iscsi
There are examples of people using SSD drives on ESX(i) systems, though. My question for you is if you have the ability to actually run with more traditional SAS drives? You could probably support your VM load on 6 drives in a RAID 1+0 setup with 15k drives and a write-caching controller. Are there some other limitations that you're not sharing here?

A: I don't think ESX supports TRIM but its quite hard to find documentation either way.
Based on my experience of ESX, I'd be more comfortable with spreading the VMs out over several fast but conventional disks. If you have a good RAID controller that's supported by ESX then to be honest I'd probably just use that and split the load between a couple of disk arrays.
At the end of the day, what's more important - to be a pioneer or to have a reliable system?