text:
Q: I Can't insert my image into sqlite database even thou i already converted it into bytes. Did i do something wrong? My OnActiviy result whenever it is called, its working up until the set background of my image view it always displays "something went wrong" whenever i am gonna put it in my sqlite, i really can't find the reason why its not working T_T
public void onActivityResult(int requestcode,int resultcode,Intent intent)
{
    dbHbeforePIC = new DBHbeforePIC(this);

    super.onActivityResult(requestcode, resultcode, intent);
    if(resultcode==RESULT_OK)
    {
        if(requestcode==1)
        {
            Bitmap photo = (Bitmap)intent.getExtras().get("data");
            Drawable drawable=new BitmapDrawable(photo);
            imgBefore.setBackground(drawable);
            byte[] img = DbBitmapUtility.getBytes(photo);
            boolean insertData = dbHbeforePIC.addBeforeImage("test", img);
            if (insertData == true) {
                Toast.makeText(MyProfile.this, "Data successfully inserted", Toast.LENGTH_LONG).show();
            } else {
                Toast.makeText(MyProfile.this, "Something went wrong", Toast.LENGTH_LONG).show();
            }
        }

Here is my DbBitmapUtility class
public class DbBitmapUtility {
// convert from bitmap to byte array
public static byte[] getBytes(Bitmap bitmap) {
    ByteArrayOutputStream stream = new ByteArrayOutputStream();
    bitmap.compress(Bitmap.CompressFormat.PNG, 0, stream);
    return stream.toByteArray();
}

// convert from byte array to bitmap
public static Bitmap getImage(byte[] image) {
    return BitmapFactory.decodeByteArray(image, 0, image.length);
}
}

And my Database Class
public class DBHbeforePIC extends SQLiteOpenHelper {

public static final String DATABASE_NAME = "beforepic.db";
public static final String TABLE_NAME = "beforepic_data";
public static final String COL1 = "ID";
public static final String COL2 = "ImageName";
public static final String COL3 = "ImageItself";

public DBHbeforePIC(Context context) {
    super(context, DATABASE_NAME, null, 1);
}

@Override
public void onCreate(SQLiteDatabase db) {
    String createTable = "CREATE TABLE " + TABLE_NAME + " (ID INTEGER PRIMARY KEY AUTOINCREMENT, " +
            " ImageName TEXT, ImageItself BLOB )";
    db.execSQL(createTable);
}

@Override
public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
    db.execSQL("DROP TABLE IF EXISTS " + TABLE_NAME);
    onCreate(db);
}

public boolean addBeforeImage( String name, byte[] image) throws SQLiteException {
    SQLiteDatabase db = this.getWritableDatabase();
    ContentValues cv = new  ContentValues();
    cv.put(COL2,    name);
    cv.put(COL3,   image);
    long result = db.insert(DATABASE_NAME, null, cv );
    if (result == -1) {
        return false;
    } else {
        return true;
    }
}

}

A: Your are trying to use Database name in place of table name
change this line
long result = db.insert(DATABASE_NAME, null, cv );

to below
 long result = db.insert(TABLE_NAME, null, cv );


text:
Q: python - Can't upload table with schema to postgres using pandas I am trying to build a collection of tables within a database all owned by a single schema. Here is a simplified example of my problem.
from sqlalchemy.schema import CreateSchema
import sqlalchemy as sqla
import pandas as pd

# I have the database 'db' already created and owned by 'user'
db_url = 'postgresql://user:password@host:5432/db'
# Let's connect to it via sqla
conn = sqla.create_engine(db_url)
# My db is currently empty, let's first create a schema and then populate it
conn.execute(CreateSchema('my_schema'))
# Verify the schema has been added to the db
insp = sqla.inspect(conn)
schema_list = insp.get_schema_names() #checking this variable, it has indeed

# I create a dataframe
df = pd.DataFrame({'foo': [1,2], 'bar':[3,4]})

Now is the confusing part. If I do this:
df.to_sql('my_table', db_url)
Then it works fine, I get:
db=> \dt
          List of relations
 Schema | Name | Type  |    Owner
--------+------+-------+-------------
 public | my_table  | table | user
(1 row)

However, if I add schema as a parameter df.to_sql('my_table', db_url, schema='my_schema'), the table isn't uploaded I get
db=> \dt
No relations found.

Why is pd.df.to_sql not working when I specify a schema?
UPDATE
db=> \dt my_schema.*
          List of relations
 Schema | Name | Type  |    Owner
--------+------+-------+-------------
 my_schema    | my_table  | table | user

This shows that the table is indeed being created and is being attached to the intended schema. However, is it still part of db? Why does it not show up under \dt??

redpajama_set_name: RedPajamaStackExchange


text:
Q: Analytics causes website to crash Okay so the website I webmaster for http://www.detroitdungeon.com has been having some analytic issues as of lately. I have the google analytics plugin installed and it was working fine for quite sometime. All of a sudden the plugin caused IE users to crash after the page had loaded. So instead of using the plug in I decided to use the code given to me by google and I placed it in the footer of the website. Doing this caused the webpage to crash with all browsers.
after the code has been placed in the footer the source code reads
Parse error: syntax error, unexpected T_CONSTANT_ENCAPSED_STRING, expecting ',' or ';' in /home/content/36/5385336/html/detroitdungeon/wp-content/themes/delighted_black2/footer.php on line 5

Here is footer.php
<?php

include('footer_content.php');$delight_mainfont = get_option('delight_mainfont');echo '
Delighted Black designed by Christian Myspace & Designed By: Digital Designz Media GroupIn conjunction with Ping Services   |   French Teacher Jobs   |   Maths Teacher Jobs

';

?>

I tried going with godaddy analytics and the same issue is happening. Any help would be GREATLY appreciated.

A: <?php

include('footer_content.php');$delight_mainfont = get_option('delight_mainfont');echo '
Delighted Black designed by Christian Myspace & Designed By: Digital Designz Media GroupIn conjunction with Ping Services   |   French Teacher Jobs   |   Maths Teacher Jobs

';?>

A: I had the same problem recently with our website, so I did the
    following.

*

*Went to our Control Panel and launched (clicked on hosting)

*Clicked the arrow for the drop down menu on the Files & FTP tab

*Clicked File Manager

*Clicked on the domain name (do not click the file or + beside your domain name) left side of the directory

*Clicked on the name wp-content

*Clicked plugins

*Clicked box beside google-analytics-for-wordpress

*Then I clicked rename at the top to rename folder

*Renamed folder to google-analytics-for-wordpress1 (just added 1 at the end).

*Went back to my site www.henpublishing.com and hit refresh (My site worked)

*Returned to the google-analytics-for-wordpress folder.

*Clicked rename

*Deleted the 1 at the end (google-analytics-for-wordpress without the 1 at the end)

*Went back to my site www.henpublishing.com and it worked with google analytics intact

*It may crash again, not sure, but it is working for now. Perhaps, Google or WordPress will fix the problem soon. Hope this helps.


text:
Q: Autocorrect / insert textblock by hotkey I want to insert a default block of text when hitting a hotkey or when entering a special string  in Visual Studio 2010 (either way would be fine).
Is there a fast and easy way to achieve this?
(Preferably without the use of third party extensions. )
Background / further explanation:
I want to use a special trigger-word to insert a default doxygen-commentblock, like "///" or "'''" for XML-commentblocks.
Other than the XML-functionality my inserted text does not have to be intelligent, it would suffice to just insert a default textblock.
My suggested trigger-string would be "---" as it would not collide with any program language I know. My suggested hotkey would be Alt+V.
Thanks for the help
Janis

A: Just write your own Code Snippet:

Code snippets are small blocks of reusable code that can be inserted in a code file using a context menu command or a combination of hotkeys. They typically contain commonly-used code blocks such as try-finally or if-else blocks, but they can be used to insert entire classes or methods.

Snippets are simply XML files that contain instructions to the Code Editor. For instance, here's the one that VS 2012 supplies for the C# if snippet:
<?xml version="1.0" encoding="utf-8" ?>
<CodeSnippets  xmlns="http://schemas.microsoft.com/VisualStudio/2005/CodeSnippet">
    <CodeSnippet Format="1.0.0">
        <Header>
            <Title>if</Title>
            <Shortcut>if</Shortcut>
            <Description>Code snippet for if statement</Description>
            <Author>Microsoft Corporation</Author>
            <SnippetTypes>
                <SnippetType>Expansion</SnippetType>
                <SnippetType>SurroundsWith</SnippetType>
            </SnippetTypes>
        </Header>
        <Snippet>
            <Declarations>
                <Literal>
                    <ID>expression</ID>
                    <ToolTip>Expression to evaluate</ToolTip>
                    <Default>true</Default>
                </Literal>
            </Declarations>
            <Code Language="csharp"><![CDATA[if ($expression$)
    {
        $selected$ $end$
    }]]>
            </Code>
        </Snippet>
    </CodeSnippet>
</CodeSnippets>

You add new snippets to the IDE using the Code Snippet Manager, available from the Tools menu item from the main menu.


text:
Q: How to render a text field in a radio radio button in shiny? I need to translate the option that in a list, the current code does not run. The function tr() does the translation from one term to another in a .csv dictionary.
radioButtons(
              "enc",
              renderText({tr("Select encoding in case your data presents strange characters:")}),
              choices = c(
                renderText({tr("Automatic")}) = "unknown",
                "UTF-8" = "UTF-8",
                "Windows" = "Latin-1"
              ),
              selected = "unknown",
              inline = TRUE
            )

The current result:
Error in source("server/body.R", local = TRUE) :
server/body.R:86:48: unexpected '='
                 choices = c(
                 renderText({tr("Browse")}) =
                                               ^

A: A reproducible example would be very helpful. For us to get started quick and for you to ensure the answer fits your request.
If you want to use dynamic ui elements, you should use renderUI().
Also you should double check some basics,... renderText() produces and output and should not be used within another render() function.
I simulated the tr() function with:
tr <- function(name) return(paste("TR:", name)).
A full working example is below, from there on you should be able to integrate it in your code. Good luck!:
library(shiny)

tr <- function(name) return(paste("TR:", name))

ui <- fluidPage(
  uiOutput("radio"),
  plotOutput("distPlot")
)

server <- function(input, output) {

  output$radio <- renderUI({
    opt <- c("Normal" = "norm",
             "Uniform" = "unif",
             "Log-normal" = "lnorm",
             "Exponential" = "exp")
    names(opt)[1] <- tr("Normal")
    label <-  tr("Distribution type:")

    radioButtons("dist", label, opt)
  })

  output$distPlot <- renderPlot({
    dist <- switch(input$dist,
                   norm = rnorm,
                   unif = runif,
                   lnorm = rlnorm,
                   exp = rexp,
                   rnorm)

    hist(dist(500))
  })
}

shinyApp(ui, server)


text: Q: Filter icon not visible in Azure Storage Explorer I am on Windows 10 and using the latest version of Azure Storage Explorer(1.27.1) but I don't see the filter panel/button on the right hand side that everyone keeps mentioning. Have gone through settings to see if it has been hidden but cannot find anything.


text:
Q: Aligning elements inside display:cell I have the following code:
Also found here as a jsfiddle.

.font_color_white {
  color: white;
}
.font_20px {
  font-size: 20px;
}
.font_weight_bold {
  font-weight: bold;
}
.bg_color_orange {
  background-color: rgb(255, 97, 56);
}
.section_container {
  display: block;
  position: relative;
  width: 100%;
  height: auto;
  min-width: 960px;
  margin-top: 20px;
}
.section_container_inner {
  margin: 0 auto;
  display: block;
  position: relative;
}
.section_block {
  display: block;
  float: left;
  position: relative;
  height: auto;
}
.section_block_header {
  display: block;
  position: relative;
  text-align: center;
  margin-bottom: 5px;
}
.section_block_table {
  display: table;
  position: relative;
}
.section_block_row {
  display: table-row;
  position: relative;
}
.section_block_cell {
  display: table-cell;
  position: relative;
}
.width_960px {
  width: 960px;
}
.height_50px {
  height: 50px;
  line-height: 50px;
  vertical-align: middle;
}
.margin_top_10px {
  margin-top: 10px;
}
.padding_left_5px {
  padding-left: 5px;
}
.padding_top_minus_5px {
  padding-top: -5px;
}
.display_block {
  display: block;
}
.box_orange {
  -moz-border-radius: 5px;
  -webkit-border-radius: 5px;
  border-radius: 5px;
  border: 2px solid rgb(255, 97, 56);
  width: 20px;
  height: 20px;
}
<link href='http://fonts.googleapis.com/css?family=Raleway' rel='stylesheet' type='text/css'>

    FAQ

          What's the best way to get started with archery at Kelly's?

          Sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore
          eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat.

I am trying to get the question to align exactly with the square on the left. So the question text and the square seem as if they are on the same line. Have tried to apply paddings and margins to the question text block, but no luck at all.
Can someone identify what I have been doing wrong?

A: You need to set the vertical alignment of your table-cell display element.
If you want the square directly in the middle, you can set it to middle:
.section_block_cell {
    ...
    display: table-cell;
    vertical-align: middle;
}

JSFiddle demo.
Alternatively you want it at the top, you can set it to top:
.section_block_cell {
    ...
    display: table-cell;
    vertical-align: top;
}

Alternative JSFiddle demo.

A: Adding the below CSS fixes it:
.section_block_cell:first-of-type {
    float: left;
}

Updated JSFiddle.
This works even with non display: table-cell elements...

A: Not sure about what you try to achieve... If you want your box to be vertical align with the question, see the answers above.
If you want the bow to be vertical align with the first line, i would use absolute positioning for the orange box, with a left padding on the question container :

What's the best way to get started with archery at Kelly's?

                    Sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat.

And the CSS :
.question {
    position: relative;
    padding-left: 34px;
}

.question p{
    margin: 0;
}

.box_orange {
    position: absolute;
    top: -4px;
    left: 0;
    -moz-border-radius: 5px;
    -webkit-border-radius: 5px;
    border-radius: 5px;
    border: 2px solid rgb(255,97,56);
    width: 20px;
    height: 20px;
}

Updated Fiddle


text:
Q: How to send form data to the server using React and Node JS? I'm using the redux toolkit to handle a reactjs login form. I receive a 404 server error when I submit the form.
The Login API i created checks if the user exists before returning a 404 error if it doesn't exists.
When I submit the form I get a 404 error and when I console log the data sent, it appears that the form sent no data at all.
I looked at my form code and believe I made a mistake, but I am at a loss.
Here is what my code looks like:
import React, { useState, useRef } from "react";
import { useForm } from "react-hook-form";
import { useDispatch } from "react-redux";
import { loginFailure, loginStart, loginSuccess } from "../../redux/userSlice";
import axios from 'axios';

const Login = () => {
  const [email, setEmail] = useState("");
  const [password, setPassword] = useState("");
  const [loading, setLoading] = useState(false);
  const dispatch = useDispatch();
  const {
    register,
    handleSubmit,
    reset,
    formState: { errors },
  } = useForm();
  const form = useRef();

  const onSubmit = async (e) => {
    const LoginData = {
      email: email,
      password: password
    }
    setLoading(true);
    dispatch(loginStart());
    console.log(LoginData)
    axios
      .post(
        `auth/login`,
        LoginData
      )
      .then((res) => {
        setLoading(false);
        dispatch(loginSuccess(res.data));
      })
      .catch((error) => {
        setLoading(false);
      dispatch(loginFailure);
      });
      return false;
  };

  return (

              <form
                ref={form}
                onSubmit={handleSubmit(onSubmit)}
                className="form-horizontal"
              >

                  <input
                    type="email"
                    name="email"
                    className="form-control fs-13px h-45px"
                    id="emailAddress"
                    placeholder="Email Address"
                    onChange={(e) => setEmail(e.target.value)}
                    {...register("email", { required: true })}
                  />
                  {errors.email && (

                        Email is required.

                  )}

                    Email Address

                  <input
                    type="password"
                    name="password"
                    className="form-control fs-13px h-45px"
                    id="password"
                    placeholder="Password"
                    onChange={(e) => setPassword(e.target.value)}
                    {...register("password", { required: true })}
                  />
                  {errors.password && (

                        Email is required.

                  )}

                    Password

                  <button
                  type="submit"
                    className="btn h-45px btn-success d-block w-100 btn-lg"

                  >
                  {loading ? "Login in..." : "Log me in"}

                  </button>

              </form>

  );
};

export default Login;

Server API:
exports.login = async (req, res, next) => {
  try {
    const user = await UserModel.findOne({ email: req.body.email });
    if (!user) return next(createError(404, "User not found!"));

    const isCorrect = await bcrypt.compare(req.body.password, user.password);
    if (!isCorrect) return next(createError(400, "Wrong credentials"));

    const token = jwt.sign({ id: user._id }, process.env.JWT);
    const { password, permissions, ...others } = user._doc;
    res
      .cookie("access_token", token, {
        httpOnly: true,
      })
      .status(200)
      .json(others);
  } catch (err) {
    next(err);
  }
};

Router:
const router = require("express").Router();
const authController = require("../controllers/authController")

//SIGN IN
router.post('/login', authController.login)

module.exports = router;


text:
Q: Using templates with Backbone Helllo, probably this is a common question, but I didn't find the appropriate answer.
I have an html file: header.html which contains a header which I want to display
Here is my Backbone.View
el: $(".header"),

initialize: function () {
    this.render();
},

render: function () {
    var template = _.template( $("#header_template").html(), {} );
    this.$el.html( template );
},

When I put the code inside a java script template, it works:
<script type="text/template" id="header_template">
    code of header.html goes here
</script>

But when I use it this way:
<script type="text/template" id="about_template" src="header.html"></script>

it stops working even though, the firebug sees the code inside a template.
Can someone tell me what my mistake is and how to solve it

A: A clean way to organize your templates is to create a subfolder tpl. Here you add all your .html files
Coenraets has a nice tutorial where he uses this approach together with a templateloader function.
You then load the templates in memory before bootstrapping your backbone application.
tpl.loadTemplates(['header', 'wine-details', 'wine-list-item'], function() {
    app = new AppRouter();
    Backbone.history.start();
});


text:
Q: Testing for significant change between answers to two questions in the same survey Apologies if I am missing necessary information here - my stats knowledge is rusty.
I am analysing responses to questions from survey, where there are two questions as follows:
Q1. What were you doing before event?
Q2. What were you doing after event?
with the same N responses to each question, and only one response allowed.
I want to know if event had a statistically significant impact on the numbers for each response;
e.g. if 119 people chose response n for Q1, and 150 people chose response n for Q2, is this a significant change?
One issue I have is that not all participants in the sample (although a relatively small number) responded to both questions, and so I assume I will have to use percentages rather than frequencies.
Any advice on how to proceed would be appreciated.


text:
Q: Is there a workaround for returning Null in c++ when the return type is a vector container? The thing is that I am implementing a recursion, in which I have to use NULL value to specify that the recursion branch being traversed is invalid.
But in C++ we can't return NULL when the return type is a container( vector container in my case).
So is there any workaround for the problem or do I have to use some other logic?
Code:
#include<iostream>
#include<vector>

std::vector<int> howSum(int target,std::vector<int> in){
    if(target < 0 ) return {-1};
    if(target == 0) return {};

    for(int num : in){
        int remainder = target - num ;
        std::vector<int> remResult = howSum(remainder,in);
        if(remResult[0] != -1 || remResult.empty()){
            remResult.push_back(num);
            return remResult;
        }
    }

    return {-1};
}

int main(){

    std::vector<int> v = {2,4,3};
    int targetSum = 8;

    std::vector<int> r = howSum(targetSum,v);

    for(int o : r)
        std::cout<<o<<" ";

    return 0;
}

Edit:
I'm very thankful for all the suggestions and solution but thing I wanted was a primitive solution that didn't use more recent c++ compilations(i.e c++17 and c++20).
Also If possible please check out my primitive solution which I implemented and suggest something if this can be improved.
An alternate solution I found out myself (primitive solution)
I am writing this for people visiting this question for reference.
Solution:
#include<iostream>
#include<vector>
#include<string>

std::string howSum(int target,std::vector<int> v){

    if(target == 0)    return "";
    if(target < 0)     return "null";

    for(int num : v){
        int rem = target - num;
        std::string remRes = howSum(rem,v);
        if(remRes != "null"){
            remRes += std::to_string(num);
            remRes += " ";
            return remRes;
        }

    }
    return "null";
}

int main()
{
    std::vector<int> v = {2,3,4};
    int targetSum = 8;

    std::cout<<howSum(targetSum,v);
    return 0;
}

My Dynamic Problem Solution
#include<iostream>
#include<vector>
#include<string>
#include<unordered_map>

std::unordered_map<int,std::string> mem;

std::string howSum(int target, std::vector<int> v){
    if(mem.find(target) != mem.end())
        return mem[target];
    if(target == 0)    return "";
    if(target < 0)     return "null";

    for(int num : v){
        int rem = target - num;
        std::string remRes = howSum(rem,v);
        if(remRes != "null"){
            remRes += std::to_string(num);
            remRes += " ";
            mem[target] = remRes;
            return mem[target];
        }

    }
    mem[target] = "null";
    return mem[target];
}

int main()
{
    std::vector<int> v = {7,14};
    int targetSum = 300;

    std::cout<<howSum(targetSum,v);
    return 0;
}

A: You have the following options:
Return result + bool
Return std::pair<std::vector<int>, bool>, or even better a struct like this
struct Result {
    std::vector<int> result;
    bool is_valid;
};

Result howSum(int target, const std::vector<int>& in);

where bool would indicate whether or not the result vector is actually usable.
Output parameter
Return a bool indicating whether the operation was successful and use an output parameter (note that a non-const reference is used for the output parameter so that it can be modifier from within the function and later used outside of it):
bool howSum(int target, const std::vector<int>& in, std::vector<int>& result);

optional
Either use std::optional with C++17 or a similar boost::optional from boost library:
std::optional<std::vector<int>> howSum(int target, const std::vector<int>& in);

Casting std::optional to bool or using has_value method checks whether you have an actual result returned.
Note that in each of the cases it's better to pass the input vector by const & to avoid unnecessary copies.

A: with optional (c++17), you could do something like this
#include<iostream>
#include<vector>
#include<optional>

std::optional<std::vector<int>> howSum(int target,std::vector<int> in){
    if(target <= 0 ) return {}; // returns "empty" optional

    auto num = in.back();
    in.pop_back();
    int remainder = target - num ;
    auto maybe_r = howSum(remainder, in);
    if (!maybe_r.has_value())
        return howSum(target, in);
    else {
        auto r = maybe_r.value();
        r.push_back(num);
        return r;
    }
}

int main(){

    std::vector<int> v = {2,4,3,1};
    int targetSum = 8;

    auto maybe_r = howSum(targetSum,v);

    if (!maybe_r.has_value()) {
        std::cout << "no result\n";
    } else {

        auto r = maybe_r.value();
        for(int o : r)
            std::cout<<o<<" ";

    }
    return 0;
}


text:
Q: 502 proxy error on deployment I am now working on a Java web project. It works well in local host using eclipse and Tomcat. But when I deploy the war file to remote server (which is also tomcat), one function at front end return 502 proxy error.
The function requests the server that I deployed and the server will further request another remote server. The whole process will take around 2 minutes. I also check the deployment log. It seems that the server is working well except for returning to front end.
Does anyone have similar problem before?

A: I just solve the problem by myself. Increasing the proxy timeout works.


text:
Q: Custom sound for remote notification I have to set custom sound when I receive APN in my iOS app.
For custom sound I mean a sound that every user can change within his app and not different from the default sound.
I already know that I can set the attribute "sound" on the payload of my notifications, but what I would like to understand if there is a way to play a different sound based on the user's settings (user A can set sound1.aiff, user B can set sound2.aiff).
The only way that I can see is that the notification is already sent with the name of the file to play that the user has set on preferences: this means that I have to store settings on server-side. Now I do not this.
Do you confirm me that's the only way?

A: Not an ideal solution, but this might work for you...
Send a silent notification instead. When your app receives the silent notification, check the user's settings and post a local notification with the desired sound.


text:
Q: ion-content inside ion-content scroll-false doesn't scroll I need to have a fixed element on a page, and then a scrollable list.
I added a ion-content inside the first ion-content. But it doesn't scroll.
<ion-view title="Bayonne" hide-back-button="true" id="page5" style="background-color:#1B463C;">
<ion-content scroll="true" padding="false" class="has-header">

        <button id="bayonne-button1" style="border-radius:0px 0px 0px 0px;" class=" button button-assertive  button-block buttonnomargin">Lieux</button>
        Circuits

   <ion-content id="contentInside">
            <ion-list id="bayonne-list2">
                <ion-item class="item-thumbnail-left  " id="bayonne-list-item12" ui-sref="rempart">

Parc de la Poterne

                </ion-item>
                <ion-item class="item-thumbnail-left  " id="bayonne-list-item11" ui-sref="rempart">

Parc de la Poterne

                </ion-item>
                <ion-item class="item-thumbnail-left item-icon-right  " id="bayonne-list-item7">

Château-Vieux

                </ion-item>
                <ion-item class="item-thumbnail-left  " id="bayonne-list-item13">

Cloître

                </ion-item>
                <ion-item class="item-thumbnail-left  " id="bayonne-list-item5">

Cathédrale

                </ion-item>
                <ion-item class="item-thumbnail-left  " id="bayonne-list-item6">

Place du Réduit

                </ion-item>
                <ion-item class="item-thumbnail-left  " id="bayonne-list-item14">

Escaliers

                </ion-item>
            </ion-list>

    </ion-content>
</ion-content>

A: You cannot have a ion-content inside another ion-content it's not a good practice.
If you want a content to be static you can use ion-header with subheader class.
<ion-header class="bar bar-subheader">

    <button id="bayonne-button1" style="border-radius:0px 0px 0px 0px;" class=" button button-assertive  button-block buttonnomargin">Lieux</button>
    Circuits

Now the image and button will be static in the header.
NOTE:
It is must to include has-subheader class in ion-content.
<ion-content class="has-subheader">
      "Your content goes here"
</ion-content>


text:
Q: Want to label vertices of a graph and manually move them around I would like to plot a graph in such a way that

*

*The vertices are labeled using labels that I've given them, rather than just their number,

*I can manually move the vertices around.
In the code below, A is my 4 x 4 adjacency matrix, and People specifies the labels that I'd like for the 4 vertices.  AG gives me a graph that accomplishes (1) but not (2).  GP gives me a graph that satisfies (2) but not (1) -- it only labels the vertices by their number.  How can I accomplish both (1) and (2) simultaneously?  GraphPLot does not seem to allow for VertexLabels as an option, so I'm at a loss here.
A = {{0, 1, 1, 1}, {1, 0, 0, 0}, {1, 0, 0, 1}, {1, 0, 1, 0}}
People = {Bob, Eric, Lucy, Liz}
AG = AdjacencyGraph[A, VertexLabels -> Table[i -> People[[i]], {i, 1, Length[People]}]]
GP = GraphPlot[AG, VertexLabeling -> True]

A: aA = {{0, 1, 1, 1}, {1, 0, 0, 0}, {1, 0, 0, 1}, {1, 0, 1, 0}};
people = {Bob, Eric, Lucy, Liz};

aG1 = AdjacencyGraph[people, aA, ImageSize -> 300,
  VertexLabels -> "Name", ImagePadding -> 20];
aG2 = AdjacencyGraph[aA, ImageSize -> 300,
   VertexLabels -> Table[i -> people[[i]], {i, 1, Length[people]}],
   ImagePadding -> 20];
gP = GraphPlot[Rule @@@ EdgeList[aG1], ImageSize -> 300,  VertexLabeling -> True];
Row[{aG1, aG2, gP}, Spacer[5]]


text:
Q: How can I document a dynamic field using ReDoc? I have a dynamic field defined on a request object like so:
/// <summary>
/// Some description of this field
/// <example>17.5 or MyString in some cases</example>
/// </summary>
public dynamic MyField { get; set; }

However, in our docs, the fields is showing up as:
myField    object (Object) Nullable

Is there a way to add a more user-friendly description to this field using ReDoc?  I'd at least like ReDoc to honor the example text.  Note - this is in a dotnet core API using Swashbuckle.


text:
Q: Proof on density of rationals and irrationals in $\mathbb{R}$ via dedekind cut Assume $a$ is a dedekind cut. By definition it is nonempty so there exist $b\in a$. Similarly, we can find $p\in a$ such that $p>b$. It has no maximals element so, we can repeat this process to infinity.
Claim: There exist atleast one irrational between two rationals.
Consider $p$ and $b$ that we talked about earlier. W.l.o.g say both are positive and observe that $1>\frac{1}{\sqrt2}>0$ so we can find $n\in \mathbb{N}$ such that $p-b>\frac{1}{\sqrt2 n}>0$, by archimedean property. Now by adding b to the inequality, we get $p>\frac{1}{\sqrt2 n}+b>b$. (It is trivial that $\frac{1}{\sqrt2 n}+b$ is irrational).
As we can find infinitely many rationals that are greater than other rational in our dedekind cut $a$(because dedekind cut has no maximal element) we can find infinitely many irrationals under a cut, in our case $p$,$b$$<a$. As there exist infinitely many irrationals under a cut and they also have rational between them rationals are dense in reals. Similarly as said earlier, we have infinitely many cuts that are greater than other under a cut, irrationals are dense in reals.
So my question is that, is this proof valid? if not, then why?

A: $1 > \sqrt(2) > 0$
is not true, is it a mistype?
Anyway, it could be a lot simpler. Consider this number:
$a + \frac{(b - a)}{\sqrt(2)}$
This gives you an algebraic irrational between a and b.  Use $\pi$ in place of $\sqrt(2)$ if you want a transcendental.


text:
Q: como acceder a un objeto buen dia recibo una consulta en Json e intendo mostrar  el name de seller pero  si coloco consulta.seller.name me dice que no existe
Como puedo acceder seller.name para mostrarlo en una variable?
[
{
    "id": "2",
    "date": "2021-03-18",
    "dueDate": "2021-03-18",
    "datetime": "2021-03-18 14:10:51",
    "observations": "",
    "anotation": "",
    "termsConditions": "",
    "status": "open",
    "client": {
        "id": "2",
        "name": "Luis arturo lopez",
        "identification": "",
        "phonePrimary": "",
        "phoneSecondary": "",
        "fax": "",
        "mobile": "",
        "email": "",
        "address": []
    },
    "seller": {
        "id": 1,
        "name": "Luis ",
        "identification": "Lopez",
        "observations": "es el primer vendedor"
    }

]

A: espero que estes bien, lo primero que debes hacer es acceder a la posicion 0 de el objeto array (que almacena un objeto) luego en el accedes al atributo seller > name.

let info = [
{
    "id": "2",
    "date": "2021-03-18",
    "dueDate": "2021-03-18",
    "datetime": "2021-03-18 14:10:51",
    "observations": "",
    "anotation": "",
    "termsConditions": "",
    "status": "open",
    "client": {
        "id": "2",
        "name": "Luis arturo lopez",
        "identification": "",
        "phonePrimary": "",
        "phoneSecondary": "",
        "fax": "",
        "mobile": "",
        "email": "",
        "address": []
    },
    "seller": {
        "id": 1,
        "name": "Luis ",
        "identification": "Lopez",
        "observations": "es el primer vendedor"
    }
    }
    ]

 console.log(info[0].seller.name);


text:
Q: XMLDocument body is undefined in Firefox but not in Chrome I read the MDN docs for DOMImplementation.createDocument() and used the example listed there to create a new XHTML document.
The new document instance will have a body property in Chrome but not in Firefox.
var newDoc = document.implementation.createDocument ('http://www.w3.org/1999/xhtml', 'html', null);
var newBody = document.createElementNS('http://www.w3.org/1999/xhtml', 'body');

newDoc.documentElement.appendChild(newBody);
console.log(newDoc.body) // false in Chrome - true in Firefox

The prototype of the newDoc is XMLDocument in both FF and Chrome, therefore I understand that it is expected not to have a body property.
However, because the result isn't consistent I figured out I could ask :)
Here is a CodePen with my code: http://codepen.io/janvidar/pen/RKRrRr


text:
Q: Precompile Underscore templates without underscore.js dependency I am using grunt-contrib-jst to precompile my templates and it's all working great. However, I am using this to build a plugin and I want to keep the filesize as small as possible.
I don't use underscore.js in my code, but the precompiled templates seem to have it as a dependency. Here is a sample:
template = function(obj) {
    obj || (obj = {});
    var __t, __p = '', __e = _.escape;
    with (obj) {
    __p += '<div>\n</div>';

    }
    return __p
};

As you can see, the snippet __e = _.escape requires underscore.js, but the template doesn't use __e at all.
Is there any way I can force grunt-contrib-jst to compile templates in a way so they don't require underscore.js?


text:
Q: Regarding count down timer in asp.net C# I don't have any problem regarding the code, its working fine. But, I am looking for an alternate method for this count down.
Here is the code
CurrentPage.aspx
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
</head>
<body>
    <form id="form1" runat="server">
    <div>

    </div>
    <asp:UpdatePanel ID="UpdatePanel1" runat="server">
        <ContentTemplate>
            <asp:Label ID="Label2" runat="server" Text="You will be redirected in..."></asp:Label>
            <asp:Timer ID="Timer1" runat="server">
            </asp:Timer>
            <asp:ScriptManager ID="ScriptManager1" runat="server">
            </asp:ScriptManager>
            <asp:Label ID="Label1" runat="server" Text="10"></asp:Label>
        </ContentTemplate>
    </asp:UpdatePanel>
    </form>
</body>
</html>

Code behind file
using System;

namespace WebApplication1
{
    public partial class _Default : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            Timer1.Enabled = true;
            Timer1.Interval = 1000;
            Timer1.Tick += new EventHandler<EventArgs>(Timer1_Tick);
        }
        void Timer1_Tick(object sender, EventArgs e)
        {
            int i=(Convert.ToInt16(Label1.Text));
            i = i - 1;
            Label1.Text = i.ToString();
            if (i<0)
            {
                Timer1.Enabled = false;
                Response.Redirect("TargetPage.aspx");
            }
        }
    }
}

All  I am looking for is any alternate method.

A: Unless you need to specify redirect location dynamically through c# code, you could implement a purely javascript client side method. It can be a simple javascript function which will cause the window to navigate to desired page.

A: If your timer does not need anything from the server side than you should probably just do a timer on the client side using JQuery or plain Javascript - it will keep the client-server communication low (0).
If you do have something happening on your backed that you have to check I think you should still change it to some JQuery/Javascript + some web service or web method or simple ashx handler. Although what you presented does work I think it is cleaner to keep this outside of the page functionality.
There are a lot of client side timers: http://code.cyntaxtech.com/plugins/jquery-timer/demo  or this jQuery countdown timer


text:
Q: Почему Г.Шилдт пишет, что generator-объекты сразу удаляются? Можете объяснить, почему пишут, что generator-объекты сразу удаляются, разве не должны они дождаться сборщика мусора?
Я представляю себе работу программы примерно так: в forе внутри ob создются
одноимённые 'o'-обекты с разными значениями:
вызывая void generator(i), создаются объекты: о=new FDemo(1)=1,
о=new FDemo(2)=2,o=3,o=4.....
Так как метод void,то каждый созданный(пусть и одноимённый) объект "превращается" просто в отдельную ячейку памяти (к которой нельзя обратиться), содержащую какое-то значение.
class FDemo {
    int х;
    FDemo(int i) {
        х = i;
    }
    // Вызывается при удалении объекта
    protected void finalize() {
        System.out.println("Финaлизaция " + х);
    }

    // Генерирует объект, который тотчас же уничтожается <-----От сборки мусора(но тогда не тотчас уничтожится) или как?
    void generator(int i) {
        FDemo о = new FDemo( i );
    }
}

class Finalize {
    public static void main(String args[]) {
        int count;
        FDemo оb = new FDemo(O);
        /* Генерируется большое количество объектов.
        В какой-то момент должна начаться сборка мусора*/
        for(count=1; count < 100000; count++)
            ob.generator(count);
    }
}

A: Тут уже все зависит от целого ряда параметров (таких как: на какой jre запущена программа, каким javac была скомпилирована, с какими ключами... (спасибо нестандартизированным возможностям оптимизации)). Но, по стандарту, объекты создаются в хипе. Т.к. объект локальный, метод сразу заканчивает выполнение, то, фактически, ссылок на данный объект нет и GC МОЖЕТ (но не обязан) его удалять. Однако, иногда есть ньюансы (о которых я писал выше).


text:
Q: The hessian of max I was trying to understand the Hessian matrix. I asked this question
what is the the hessian of the max and the min of two given functions. My question is the following :
what is the exact expression of this $\operatorname{Hess}(\max(u,v))$?

A: $\max$ does not have partial derivatives everywhere. Where a Hessian may be defined (specifically, on the set $\{(x,y)\in\Bbb R^2\,:\, x\ne y\}$), it's $\begin{pmatrix}0&0\\ 0&0\end{pmatrix}$.


text:
Q: Carrierwave store method selection on-the-fly Is there any existing solution to select store method on the fly in carrierwave?
I wish to select local store or fog (two providers) store on record (user) basis.
Do i have to rewrite my models to inherited models or there is other solution already?
Thanks for your thoughts.

A: You can access your model from uploader using the model method
To specify custom store dir, you can use
 storage :fog

So, you can write your own macro-class-method which will call storage :for or local based on preference, should be possible but I don't know what you want to archieve exactly. Providing more code (The user code and the conditions on which storage depends) would be helpful.


text:
Q: Want to update and insert at the same tame, both of them not only one I have a table where is stored information about countries, and i have to change ISO-code from 3 characters  to 2 characters  ISO-code.
for example i have data like this.

and the question is, first i want to update all of them which  are consisting of 3 digits set valid_until = '31.12.2019' and insert new row that should look like

Yes, I know that there is merge, but I need to update and insert, not only one.

A: Assuming you have another source for the codes, this is simply an insert/update:
update t
    set valid_until = date '2019-12-31'
    where length(iso_code) = 3;

insert into t (iso_code, valid_from, valid_to)
    select cs.iso_code_3, date '1940-01-01', date '3199-12-31'
    from t join
         codesource cs
         on t.iso_code = cs.iso_code_2;

You can wrap this into a single transaction, if you want them to take effect "at the same time".

A: Agree with Alex and Gordon that this can be run as 2 statements wrapped in a single transaction. So, not really clear on why this needs to be a single SQL statement. I've tried using duplicate rows in the using clause in merge to make the update and insert happen together (see snippet below). Please check if this is what you're looking to achieve.
SQLFiddle here
    SQL> create table foo
      2  as
      3     select 'AD' iso_code,
      4            date '2020-01-01' valid_from,
      5            date '3999-12-31' valid_until
      6       from dual;

    SQL> select * from foo;
         |  ISO_CODE    |   VALID_FROM  |   VALID_UNTIL |
         |  AD          |   1/1/2020    |   12/31/3999  |

    SQL> alter table foo modify iso_code varchar2(3);

    SQL> create table iso_code_mapping
      2  as
      3     select 'AD' iso2_code, 'AND' iso3_code from dual;

    SQL> select * from iso_code_mapping;
         |  ISO2_CODE   |   ISO3_CODE   |
         |  AD          |   AND         |

    SQL> merge into foo
      2  using (
      3       select iso_code, iso3_code, valid_from, valid_until from foo f
      4                  join iso_code_mapping i on i.iso2_code = f.iso_code
      5              union all
      6              select iso_code||'_2' iso_code, iso3_code, valid_from, valid_until from foo f
      7                  join iso_code_mapping i on i.iso2_code = f.iso_code
      8                  where not exists ( select 1 from foo f2 where f2.iso_code = i.iso3_code and f2.valid_until = '31 DEC 3999' )
      9         ) x
     10  on ( x.iso_code = foo.iso_code )
     11  when matched then
     12      update set valid_until = '31 DEC 2019'
     13      where valid_until <> '31 DEC 2019'
     14  when not matched then
     15      insert (iso_code, valid_from, valid_until)
     16      values (iso3_code, '1 JAN 1940', '31 DEC 3999')
     17  ;

    SQL> select * from foo;
         |  ISO_CODE    |   VALID_FROM  |   VALID_UNTIL |
         |  AD          |   1/1/2020    |   12/31/2019  |
         |  AND         |   1/1/1940    |   12/31/3999  |


text:
Q: Transition not working when using Javascript to set opacity of a list item I have a list that appears line by line upon a mouse click. I am changing the opacity of each list item from 0 to 1, however I can't seem to get transition to work with it. Whenever I set the transition duration to 1s, it instead takes 1s for each list item to appear instead of fading smoothly from opacity 0 to opacity 1.
Here is my javascript:
let counter = 0;

document.addEventListener('click', () => {
  counter = counter + 1;
  document.querySelector(`#line-${counter}`).style.opacity = 1;
});

Here is my CSS:
  li {
    opacity: 0;
    transition: opacity 0.3s ease;
  }

Here is my HTML:

line 1

line 2

line 3

A: I believe this is what you're looking for...
JavaScript:
let counter = 0;

document.addEventListener('click', () => {
  counter = counter + 1;
  document.querySelector(`#line-${counter}`).classList.add("fadeIn");
});

CSS:
li {
  opacity: 0;
}

.fadeIn {
  opacity: 1;
  transition: opacity 0.3s ease;
}

This fades in each list item over 0.3 seconds for every click.


text:
Q: Missing MEDIA_LIBRARY permissions I making an app using react native expo, onPress I want to download a .vcf or .pdf file on specified folder which is I fetched from server. but when I click onPress I get following errors in console
I able to download Images but when it comes to .vcf or pdf file facing below error.
MediaLibrary.createAlbumAsync("xFolderName", asset);

xFolderName where Im trying to store my .vcf or .pdf file, following path is created while saving an Images same for .vcf file Android-> Pictures -> xFolderName

[Unhandled promise rejection: Error: MediaLibrary.createAlbumAsync
must be called with an asset on Android.]

at node_modules/expo-media-library/build/MediaLibrary.js:302:14 in createAlbumAsync
at node_modules/expo-media-library/build/MediaLibrary.js:295:7 in createAlbumAsync
at components/ngo/ECard.js:98:8 in FileSystem.downloadAsync.then$argument_0

[Unhandled promise rejection: Error: Missing MEDIA_LIBRARY
permissions.]

at node_modules/react-native/Libraries/BatchedBridge/NativeModules.js:106:50 in promiseMethodWrapper
at node_modules/expo-modules-core/build/NativeModulesProxy.native.js:15:23 in moduleName.methodInfo.name
at node_modules/expo-media-library/build/MediaLibrary.js:148:24 in createAssetAsync
at node_modules/expo-media-library/build/MediaLibrary.js:141:7 in createAssetAsync
at components/ngo/ECard.js:97:22 in FileSystem.downloadAsync.then$argument_0
App.js
import { Header } from "react-native/Libraries/NewAppScreen";
import { StatusBar } from "expo-status-bar";
import {
    StyleSheet,
    Text,
    View,
    Button,
    Image,
    TouchableOpacity,
    ScrollView,
    Modal,
    Share,
    ImageBackground,
} from "react-native";
import React, { useState } from "react";
import { API_URL } from "@env";
import { Icon, SocialIcon } from "@rneui/themed";
import * as FileSystem from "expo-file-system";
import * as Permissions from "expo-permissions";
import * as MediaLibrary from "expo-media-library";
import Toast from "react-native-root-toast";

export default function App(props) {
    const [apiData, setApiData] = React.useState({
        xxxname: "",
    });

    const downloadFile = () => {
        FileSystem.downloadAsync(
            `${API_URL}/xpath/xpath?slug=${apiData.slug}`,
            FileSystem.documentDirectory + apiData.xname + ".vcf"
        )
            .then(({ uri }) => {
                const asset = MediaLibrary.createAssetAsync(uri);
                MediaLibrary.createAlbumAsync("xFolderName", asset);
                Toast.show("Download Completed");
            })
            .catch((error) => {
                console.error(error);
            });

    };

    return (
        <View>
            <TouchableOpacity
                style={styles.addButton}
                onPress={() => downloadFile()}
            >
                <Icon
                    color={"white"}
                    name="file-download"
                />
                <Text style={styles.addButtonText}>Download</Text>
            </TouchableOpacity>
        </View>
    );
}

const styles = StyleSheet.create({
    addButton: {
        width: "30%",
        margin: 10,
        height: 55,
        backgroundColor: "#3b82f6",
        borderRadius: 15,
        alignItems: "center",
        justifyContent: "center",
        elevation: 8,
    },
    addButtonText: {
        color: "#fff",
        fontSize: 18,
    },
});


text:
Q: Planet farthest from Coruscant? What is the planet farthest from Coruscant in the Star Wars Galaxy? I understand that this information might not be available. If it isn't, please tell me.

A: Assuming the opening scrawl is correct, I'd say that the single farthest Earth-like planet that we know of (from Coruscant) would be Earth.

A: Within the Galaxy Far, Far Away, it appears - at least from this chart - that the planet furthest from Coruscant is the so-called "planet of the Red Nebula".

To save you from having to search for the relevant planets:

A: If you're talking "in-universe" but aside from The Galaxy itself(but say ones that have actually had civilizations come into contact with The Galaxy still) there are a few options.  Yuuzhan-Tar, the original, as well as some of the planets from the companion Galaxies that have had invading hosts enter The Galaxy at prior times are all possible contenders for "farthest known planet from coruscant" in an absolute sense.


text:
Q: Create and modify ecore files and their instances from code My question has two parts:

1) How can I create and/or modify and then store EMF ecore files (ecore metamodels with .ecore suffixes) from my scala/java code?
2) How can I create and/or modify an instance of an ecore file (i.e. a model conforming to an ecore metamodel) from my scala/java code?

I am looking to see if there are some possible ways of doing these, other that manipulating directly their corresponding XML files using XML API's.
Providing a code spinet or a reference to it is very much appreciated.
ps. As a background thought, I am wondering if I can use a single API for performing both of the above tasks, as we can look to an ecore file as a model/instance of Ecore.ecore.

A: Basic Concepts (Resource, ResourceSet, Resource Factory and Registry):
Before answering this question I will explain some concepts in ecore API. The First two concepts are Resource and ResourceSet. Resource is a program level representation of a persistent resource (like an ecore file), and ResourceSet is simply a  set of these kind of resources. Each ecore metamodel document as well as a model document (which conforms to its metamodel) is a resource. Therefore the first step to work with these files is to provide a program level representation of them as resources in a resourceSet.
Another two concepts are Resource Factory and Registry. Factory classes are used to generate resources, and registries are keeping track of list of these factories in resourceSets. Depending on how our resource are stored, we can use different factories to manipulate them. For example, EcoreResourceFactoryImpl, XMLResourceFactoryImpl, and XMIResourceFactoryImpl are some examples of factory implementations that can be used to handle, respectively, ecore, xml, and xmi files. If we want to use these factories to handle resources in a resourceSet we need to put them in the registry list of resourceSet first. So, for each resourceSet that I mentioned above, there is a registry list.
With all the above being said, let's see how loading and modifying an ecore file (metamodel) and an instance file (model) happens in a java code.
First, We need to  create a resourceSet to represent our persistent resources we would like to work with:
ResourceSet resourceSet = new ResourceSetImpl();

Then in the registry of this resourceSet, we need to register the Factories we want to work with:
resourceSet.getResourceFactoryRegistry().getExtensionToFactoryMap().put("ecore", new EcoreResourceFactoryImpl());
resourceSet.getResourceFactoryRegistry().getExtensionToFactoryMap().put("xmi", new  XMIResourceFactoryImpl());

Above two lines of code simply  register EcoreResourceFactoryImpl and XMIResourceFactoryImpl as, respectively, ecore and xmi file factories (note that ecore and xmi are file extensions there). I assumed that my metamodel file extension is ecore and my model file extension is xmi.
After registering these Factories, we can now ask our ResourceSet to load our metamodel (i.e., ecore) file as below:
Resource myMetaModel= resourceSet.getResource(URI.createFileURI("./univ.ecore"), true);

univ.ecore is the name of my ecore file.
For loading a model file we need to take one further step! We need to first register one more thing in our resourceSet. That is to register the package of our ecore metamodel in the registry list of packages in our resource set. For doing this we need to first get a programming level representation of our ecore package as bellow:
EPackage univEPackage = (EPackage) myMetaModel.getContents().get(0);

And then, register this package in the registry list of packages of our resource set as below:
resourceSet.getPackageRegistry().put("http://gholizadeh.org", univEPackage);

We are now ready to load our model (xmi file). We use the following code for this:
Resource myModel = resourceSet.getResource( URI.createURI( "./univModel.xmi"), true);

Now we have brought both of our metamodel and model files to the programming level, and we can simply manipulate them in code.
Change the Metamodel:
For example, for creating a new Class in an ecore file, we use EcoreFactory API: we first obtain an instance of this class as below:
EcoreFactory theCoreFactory = EcoreFactory.eINSTANCE;

and then create an EClass as the following:
EClass adultEClass= theCoreFactory.createEClass();

Then for keeping this Class, we need to add it to the list of our loaded ecore package classifiers as bellow:
univEPackage.getEClassifiers().add(adultEClass);

For doing aditional changes you need to get more familiar with ecore API.
Change the Model:
for changing a model, we need to create objects of type EObject. Similar to EcoreFactory in the above, we need a factory to do this. But instead of EcoreFactory, we need an object factory. For each ecore package there is an specific object factory of type EFactory that we can get as the following:
EFactory univInstance = univEPackage.getEFactoryInstance();

Note that univEPackage in above code, represents our ecore package (see some paragraphs above). After doing this, we are ready to create objects for our model. For example
EObject adultObject = univInstance.create(adultEClass);

create an object of type adultEClass, in our model. Note that for persisting this newly created object we need to add it to the content of our resource (that represent our model, i.e., myModel). Since our persistent file is in xmi format and it has only one root we need to put all of our objects in a list and add this list to our resource:
EList<EObject> ModelObjects = new BasicEList<EObject>();
ModelObjects.add(adultObject);

myModel.getContents().addAll(ModelObjects);

Storing Model and Metamodel files:
Finally, after we modified our metamodel and model elements we need to store them again in their corresponding files. This is simply done by calling save method of their corresponding Resources:
myModel.save(null);

myMetaModel.save(null);


text:
Q: get css selector string from protractor's ElementFinder I want to create a generic function that notifies on errors
I can't seem to find a way to get the css selector from an ElementFinder member
Here's my function:
static waitForElementToExist(elementFinder: ElementFinder): SeleniumPromise<any> {
    return browser.wait(until.presenceOf(elementFinder),
        jasmine.DEFAULT_TIMEOUT_INTERVAL,
        MyErrors.elementNotFound(<get element selector string>));
};

so I can return a meaningful error like:
could not found the element '.class-selector'

can anyone point me to the right direction please? :-)

A: If you use latest protractor, try:
MyErrors.elementNotFound(elementFinder.locator().toString())

More detail, please look locator() api.


text:
Q: Cakephp redirect after x seconds? I am looking for a simple redirect for cakephp 2.1 with a wait time.
I'd like the view page to redirect after -lets say 5 seconds- to an external url.
Any idea how I could implement this?
Thanks in advance

A: The easiest solutions either involve jquery/javascrpt, meta or php headers in a view. I do not believe cake has a dedicate way to do this but an alternative could be a simple for loop and just do a simple +1 count to like 5000 or whatever value is needed to take 5 seconds and then do the normal cake redirect.
simple view examples.
php header
header('Refresh: 5; URL=http://site.com/controller/action');

meta
<meta http-equiv="refresh" content="5;url=http://site.com/controller/action"/>

A: My answer maybe late. But it is useful for the other who want to use CakePHP View Helper:
    echo $this->Html->meta(
        null,
        null,
        ['http-equiv' => 'refresh', 'content' => '10;url=https://example.com/controller/action']
    );

It works with CakePHP 2.x, 3.x and 4.x


text:
Q: Error in : Only strings can be converted to symbols in Shiny ggplot I tried to create a ggplot using a function I created in shiny, but I'm getting this
Error in : Only strings can be converted to symbols
I had a similar issue and it was fixed by using this in the fre function
var_str1 <- var
var <- rlang::ensym(var)

I tried to do the same with the bar_plot function, but it didn't work.
Code

library(shiny)
library(questionr)
library(dplyr)
library(ggplot2)
library(tidyr)
library(haven)
library(labelled)
library(scales)
library(sjlabelled)

fre <- function(var) {
  var_str1 <- var
  var <- rlang::ensym(var)

  abc <- questionr::na.rm(dat[, var_str1])
  abc <- questionr::freq(abc, total = TRUE, na.last = TRUE, digits = 2)
  abc <- cbind(Label = rownames(abc), abc)
  abc <- questionr::rename.variable(abc, "n", "Frequency")
  abc <- questionr::rename.variable(abc, "%", "Percent")
  abc <- tidyr::separate(abc, Label, into = c("Value", "Label"),
                         sep = "] ")
  row.names(abc) <- NULL
  abc <- abc %>% dplyr::mutate(Value = gsub("[[:punct:]]", '', Value)) %>%
    dplyr::select(Label, Value, Frequency, Percent)
  abc
}

bar_plot <- function(data, var) {

  data <- do.call(as_label, list(data, ensym(var)))

  data %>%
    filter({{ var }} != "Neither") %>%
    ggplot(aes({{ var }})) +
    geom_bar() +
    coord_flip() +
    theme_classic() +
    labs(x = NULL, y = "Count", title = var_label(pull(data, {{ var }})))
}

dat <- read_spss("http://staff.bath.ac.uk/pssiw/stats2/SAQ.sav")

ui <- fluidPage(

    titlePanel(" "),
     sidebarLayout(
        sidebarPanel(
            selectInput("var1", "Frequency Table", choices =  names(dat), selected = NULL)
        ),

        mainPanel(
           tableOutput("fretab"),
           plotOutput("barplot")
        )
    )
)

server <- function(input, output) {

    output$fretab <- renderTable({
        fre(input$var1)
    })

    output$barplot <- renderPlot({
      bar_plot(dat, input$var1)
    })
}

shinyApp(ui = ui, server = server)

A: The variable going into the bar_plot is a string.  We can convert to symbol and use !!
bar_plot <- function(data, var) {
  var1 <- var
  data <- do.call(as_label, list(data, ensym(var)))

  data %>%
    filter((!! rlang::sym(var1)) != "Neither") %>%
    ggplot(aes(!! rlang::sym(var1))) +
    geom_bar() +
    coord_flip() +
    theme_classic() +
    labs(x = NULL, y = "Count", title = var_label(pull(data, !! rlang::sym(var1))))
}

-output

-full code
library(shiny)
library(questionr)
library(dplyr)
library(ggplot2)
library(tidyr)
library(haven)
library(labelled)
library(scales)
library(sjlabelled)

fre <- function(var) {
  var_str1 <- var
  var <- rlang::ensym(var)

  abc <- questionr::na.rm(dat[, var_str1])
  abc <- questionr::freq(abc, total = TRUE, na.last = TRUE, digits = 2)
  abc <- cbind(Label = rownames(abc), abc)
  abc <- questionr::rename.variable(abc, "n", "Frequency")
  abc <- questionr::rename.variable(abc, "%", "Percent")
  abc <- tidyr::separate(abc, Label, into = c("Value", "Label"),
                         sep = "] ")
  row.names(abc) <- NULL
  abc <- abc %>% dplyr::mutate(Value = gsub("[[:punct:]]", '', Value)) %>%
    dplyr::select(Label, Value, Frequency, Percent)
  abc
}

bar_plot <- function(data, var) {
  var1 <- var
  data <- do.call(as_label, list(data, ensym(var)))

  data %>%
    filter((!! rlang::sym(var1)) != "Neither") %>%
    ggplot(aes(!! rlang::sym(var1))) +
    geom_bar() +
    coord_flip() +
    theme_classic() +
    labs(x = NULL, y = "Count", title = var_label(pull(data, !! rlang::sym(var1))))
}

dat <- read_spss("http://staff.bath.ac.uk/pssiw/stats2/SAQ.sav")

ui <- fluidPage(

  titlePanel(" "),
  sidebarLayout(
    sidebarPanel(
      selectInput("var1", "Frequency Table", choices =  names(dat), selected = NULL)
    ),

    mainPanel(
      tableOutput("fretab"),
      plotOutput("barplot")
    )
  )
)

server <- function(input, output) {

  output$fretab <- renderTable({
    fre(input$var1)
  })

  output$barplot <- renderPlot({
    bar_plot(dat, input$var1)
  })
}

shinyApp(ui = ui, server = server)


text:
Q: how to close GTK window with C i was doing a small project where i had a a fullscreen GUI (Glade, GTK and C) and needed to give the user a way to close the screen (obviously the window manager was not available due to the window being fullscreen).
problem rices when i attempt to compile this piece of code
//close sidebar1
 void on_window_sidebar1_back_clicked()
 {
    gtk_window_close (GtkWindow *window);
 }

i receive the following error
    /usr/bin/arm-linux-gnueabihf-gcc -c -g -O0 -Wall -pthread -pipe src/main.c `pkg-config --cflags --libs gtk+-3.0` -o main.o
src/main.c: In function 'on_window_sidebar1_back_clicked':
src/main.c:61:2: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'gtk_window_close'
  gtk_window_close (GtkWindow *window);
  ^
src/main.c:61:20: error: expected expression before 'GtkWindow'
  gtk_window_close (GtkWindow *window);
                    ^
makefile:30: recipe for target 'main.o' failed
make: *** [main.o] Error 1

I tried to follow the documentation here, but seem to have failed badly
Does anyone have any ideas?
PS.
here is the full main.c if someone is intrested. Its my first attempt at C with gtk, so dont be too harsh, Thank you (=
#include <gtk/gtk.h>

GtkWidget *g_lbl_test;
GtkWidget *g_lbl_count;

int main(int argc, char *argv[])
{
    GtkBuilder      *builder;
    GtkWidget       *window;

    gtk_init(&argc, &argv);

    builder = gtk_builder_new();
    gtk_builder_add_from_file (builder, "glade/window_main.glade", NULL);

    window = GTK_WIDGET(gtk_builder_get_object(builder, "window_main"));
    gtk_builder_connect_signals(builder, NULL);

    //pointers for the labels (...used in button press)
    g_lbl_test = GTK_WIDGET(gtk_builder_get_object(builder, "lbl_test"));
    g_lbl_count = GTK_WIDGET(gtk_builder_get_object(builder, "lbl_count"));

    g_object_unref(builder);

    gtk_widget_show(window);
    //gtk_window_fullscreen (GtkWindow *window);  //dont know how to use this, same with gtk_window_close
    gtk_main();

    return 0;
}

//button press (just a test to make sure the window didnt freeze)
void on_btn_count_clicked()
{
        static unsigned int count= 0;
        char str_count[30] = {0};

        gtk_label_set_text(GTK_LABEL(g_lbl_test), "Test success!");
        count++;
        sprintf(str_count, "%d", count);
        gtk_label_set_text(GTK_LABEL(g_lbl_count), str_count);
}

//sidebar1
void on_sidebar_1_clicked()
{
    GtkBuilder      *builder;
    GtkWidget       *window;

    builder = gtk_builder_new();
    gtk_builder_add_from_file (builder, "glade/window_main.glade", NULL);

    window = GTK_WIDGET(gtk_builder_get_object(builder, "window_sidebar1"));

    gtk_widget_show(window);
}
//close sidebar1
 void on_window_sidebar1_back_clicked()
 {
    gtk_window_close (GtkWindow *window);
 }

// called on closing window
void on_window_main_destroy()
{
    gtk_main_quit();
}

A: You probably should call
 gtk_close_window(window);

But that window should come from somewhere.
(you may use a Gtk closure with a connection, or a callback with a client data, etc. or store somehow that window in a global variable, etc...)
Read more about C programming, then read a bit about callbacks and closures, then read more about GTK, and the signal mechanism of Gobject.
(your code shows a lot of confusion; I suggest to read the Getting started with GTK chapter after having read a good C programming book; BTW, I suggest to first write something which is not fullscreen, and only later improve it)
Don't forget to enable all warnings and debug info when compiling, that is compile with  gcc -Wall -Wextra -g (and other arguments, perhaps using $(pkg-config --cflags gtk+-3.0) and also $(pkg-config --libs gtk+-3.0) for linking).

A: Attention! This does not follow any industrial standards and there are multiple flaws in this. I don't make any money or fame out of this so my only requirement is that it works. Take this into consideration when reading this!
I made edits to my code with what I learned and this seems to work:
void on_sidebar_1_clicked(int argc, char *argv[])
{
    GtkBuilder      *builder;

    gtk_init(&argc, &argv);

    builder = gtk_builder_new();
    gtk_builder_add_from_file (builder, "glade/window_sidebar1.glade", NULL);  //a whole own file for the second window

    secondWindow = GTK_WIDGET(gtk_builder_get_object(builder, "window_sidebar1")); //secondWindow is defined at the start of main.c like this: "GtkWidget *secondWindow = NULL;" so that both callbacks can use it.
    gtk_builder_connect_signals(builder, NULL);

    gtk_widget_show(secondWindow);
    gtk_main();

}

void on_sidebar1_back_clicked()
 {
    gtk_widget_destroy(GTK_WIDGET(secondWindow)); //here we call the widget to be closed instead of the window. Seems to work a lot better than the gtk_window_close, dunno why.
 }

This code was written fast (and furious) so it's a little crude. I made some changes to my glade files as well, if someone needs a reference to those, please ask. As far as I care, this was the answer for my question. Also, I would recommend learning C and GTK (like Basile Starynkevitch said) before you start doing this kind of stuff, I didn't have the time nor motivation to do so.


text:
Q: Sacar texto de la foreign key de un modelo django Tengo un formulario con una serie de respuestas que tienen vinculado una pregunta.
Necesito sacar en una etiqueta el nombre de la pregunta para que se vea por bloque por cada respuesta. Utilizo un formset para guardar todas esas respuestas. Y en la plantilla está así:
<form action="." method="post">
            {% csrf_token %}
            {{ seguridad_form.management_form }}
            {% for s in seguridad_form %}
                {{ s.RESP_PRG.PRG_NOM }}
                {% bootstrap_field s.RESP_PRG %}
                {% bootstrap_field s.RESP_RESUL %}
                {% bootstrap_field s.RESP_FORM %}
            {% endfor %}
            <input class="btn btn-success" type="submit" value="Guardar"/>
        </form>

Creía que así {{ s.RESP_PRG.PRG_NOM }} me traía el texto la otra tabla. RESP_PRG es FK a la tabla PRG y PRG_NOM es el nombre de la pregunta.
Gracias


text:
Q: Does it sound idiomatic to say "Regretfully, I won't have the privilege of being with you that day, but I do wish you all good luck." There is a very common expression in Farsi that translates to something along the lines of "It's my bad luck that I wasn't there to enjoy your company" or "I will not have the good fortune to be there with you guys", and it's usually used as an act of being humble. I mean they are not "literally" unlucky not to be there, it's not like something very important is going to happen, they are just being polite. And of course, depending on the context, it can take any tense. Is there any expression in English that can be used in such situations? Do the ones I used seem natural to say?

A: To me (a 27-year-old American), that phrase sounds very, very formal. I could imagine a professor saying that to a student, or an employee of a financial institution saying that to an important client. But it sounds too formal for most business communication, and it's definitely way too formal to say to a friend.
For most business communication, I think I'd say: "Unfortunately, I won't be able to join you that day, but I do wish you all good luck!"
And to a friend, I'd say something like: "Sorry, I can't make it, but good luck!"


text:
Q: passenger nginx rails request failed (2: No such file or directory) nginx rails sometimes gives 404 error and the error log is (works after nginx restart)
2014/05/14 13:29:49 [crit] 32228#0: *3138 connect() to /tmp/passenger.1.0.32203/generation-0/request failed (2: No such file or directory) whil$
$76.186, server: 107.170.10.25, request: "GET /api/v1/search.json?radius=25&longitude=77.62598510831594&latitude=12.934331866450355&per=10&page$
2014/05/14 13:29:51 [crit] 32228#0: *3140 connect() to /tmp/passenger.1.0.32203/generation-0/request failed (2: No such file or directory) whil$
2014/05/14 13:29:51 [error] 32228#0: *3140 open() "/usr/share/nginx/html/50x.html" failed (2: No such file or directory), client: 171.76.76.186$

If i restart nginx everything works fine. i am using rails 4 passenger  4.0.41 with rvm 1.25.24
i have used passenger-nginx ubuntu package. instructions from https://gorails.com/deploy/ubuntu/14.04

A: That problem should go away if you set passenger_temp_dir /somewhere-appropriate


text:
Q: Get message from php file? I have an external php file which i send a parameters to it like the following :
http://www.smsws.com/sendsms.php?user=demo&password=demo&numbers=973390000000&sender=hgicom.com&message=test&lang=en
when i go to that link it will show a message if the login is invalid or the number is incorrect, ..etc
i want to know how to get that message, because based on this message i will do an action in my application. is that possible?

A: $msgurl='http://www.smsws.com/sendsms.php?user=demo&password=demo&numbers=973390000000&sender=hgicom.com&message=test&lang=en;
$result=file_get_contents($msgUrl);
switch($result) {
case 'successful':
   echo ' awesome';
   break;
}

you may use if statements as well depending on the input sent back

A: $url="http://www.smsws.com/sendsms.php?user=demo&password=demo&numbers=973390000000&sender=hgicom.com&message=test&lang=en"
$res=file_get_contents($url);
if($res)
{
     echo "message successfully send";
}

A: You will need to use cURL to fetch page, and some html parser like http://simplehtmldom.sourceforge.net/ to parse response.
There are plenty of resources how to work with cURL, here is basic one
http://www.higherpass.com/php/Tutorials/Using-Curl-To-Query-Remote-Servers/


text:
Q: How to build Multip-hop VPN using OpenVPN and two CentOS Servers? I have two CentOS droplets. I want to create a scenario like this:
User(IP: 185.20.20.1) --> VPN1(Server1: 90.80.1.1) --> VPN2(Server2: 5.80.20.18) --> Google.com(assumes the user IP address is 5.80.20.18)

I know how to create a VPN using OpenVPN and a CentOS droplet. The final user IP address will be "90.80.1.1" on the above example. My question is, how to pass the traffic from Server1 to Server2 so that the final IP address becomes the last server which is Server2 (5.80.20.18)?

Figure1: Multi-hop VPN Illustration


text:
Q: How to access data from a data class in another data class? I've two data class as follows:
data class Resource(
    val location: String,
    val address: String
)

data class Student(
    val id: Int,
    var userName: String,
    var screenName: String,
    var email: String,
    var place: Resource,
    var register: Instant,
    val timezone: TimeZone
)

I want to call the class resource inside the class Student.
Here Student is my in-memory database.
Following code fills the database with dummy data when the application launches.
@Component
class StudentDatabase {

    private val students = mutableListOf<Student>()
    //Following annotation shows a filled database when application launches
    @PostConstruct
    private fun init(){
        val placedata1: Boolean = resource.add(Resource("gf","fhf,67"))
        val placedata2: Boolean = resource.add(Resource("gf","fhf,67"))

        students.add(Student(35446,"James12","qwerty","Jamesd@icloud.com", placedata1, Instant.now(), TimeZone.getTimeZone("Asia/Kolkata")))
        students.add(Student(46666,"Thomas3556","srdg54","thomas12@gmail.com", placedata2, Instant.now(),TimeZone.getTimeZone("Asia/Kolkata")))
    }
}

A: If you want to access Resource properties in Student class. You can do it straight away. They are public by default.
data class Resource(
    val location: String,
    val address: String
)

data class Student(
    val id: Int,
    var userName: String,
    var screenName: String,
    var email: String,
    var place: Resource,
    val location: String = place.location
)

or if you want to access it in method and manipulate,
data class Student(
    val id: Int,
    var userName: String,
    var screenName: String,
    var email: String,
    var place: Resource,
    val location: String = place.location
) {
    fun getLocationLowerCase():String {
        return place.location.toLowerCase()
    }
}


text:
Q: How to use Array.reduce with Typescript properly? Currently i'm using this method like that:
[].reduce<GenericType>(
            (acc, { value, status, time }) => {
                if (time) {
                    return {
                        ...acc,
                        bestValue: value,
                        status: status.toString(),
                        isOld: true,
                        time
                    };
                }
                return {
                    bestValue: null,
                    status: '',
                    isOld: false
                };
            },
            {
                bestValue: null,
                status: '',
                isOld: false
            }
        );

But as for me It's weird. If I go with {} as default value I'll get TS error.
I'll be thankful for any tips.

A: this is how I'm using reduce in TS:
interface Value {
  bestValue: unknown;
  status: string;
  isOld: boolean;
  time: string;
}

const initialValue: Value = {
  bestValue: null,
  status: '',
  isOld: false,
  time: ''
};

interface Item {
  value: number;
  status: string;
  time: string;
}

const array: Item[] = [
  {
    value: 1,
    status: 'active',
    time: '00:00'
  }
];

const result = array.reduce(
  (acc, { value, status, time }) =>
    time
      ? {
        ...acc,
        bestValue: value,
        status: status.toString(),
        isOld: true,
        time
      }
      : {
        bestValue: null,
        status: '',
        isOld: false,
        time: '' // You forgot to define all required properties
      },
  initialValue
);

I think it is good practice to define all properties as required in your reduced object.
So, instead of null it is better to use initial value, in this case every iteration will return same interface


text:
Q: Using charts with gwt I am doing some stuff with gwt, Now i need to draw charts. Actually pie chart and line chart.
Is there any library for chart which works well with gwt?

A: Check out Google API Libraries for Google Web Toolkit. There you will find a link to Google Chart Tools

A: There is also  OFCGWT  chart widget for GWT based on Open Flash Chart 2. Here is its demo
Except this you can check out these:

*

*charts4j

*clientsidegchart

*RaphaelJS GWT wrapper, there is also one called raphaelGWT which is not developed actively.

A: I've already use Google Charts, and I preffer
GWT-HighCharts you can see why checking it showcase.

A: Check out http://code.google.com/p/gwt-rcharts/ and its demo at http://gwt-rcharts.appspot.com/ with code snippets on how to use it, which is quite easy.


text:
Q: javascript ajax callback function not working I have a question regarding the ajax callback function
I have
test = function(){
  this.items=[];
}

//original state.
test.prototype.getListItems = function (){

    this.items.push('test item');
    this.handleItems();

}

//this method will be called if the user clicks a button.
test.prototype.clickBtn = function (){

    this.ajGetOneMoreItem()
    this.handleItems();
}

//a callback function that will add a new item.
test.prototype.ajGetOneMoreItem = function (){
   var that=this;
     ajax.callback = function(dataItem){
         that.items.push(dataItem);
     }
}

//to show the items.
test.prototype.handleItems = function (){

       //only show the test item, but not dataItem after user clicks a button.
      console(this.items)

}

var testObj = new test();

$('#testBtn).click(function(){
   testObj.clickBtn();
})

I want to show the new items that was added through the user.
However, it only appears this.items only show the first 'test item' but did not add the new dataItem. Am I missing something here? Thanks a lot!

A: The invocation of:
this.ajGetOneMoreItem();

completes almost instantly. This means the next step:
this.handleItems();

happens before the AJAX callback has been executed. To solve this problem, move the second step into the callback.
test.prototype.ajGetOneMoreItem = function (){
   var that=this;
     ajax.callback = function(dataItem){
         that.items.push(dataItem);
         that.handleItems();
     }
}


text:
Q: Find Var(Y|X=x). The joint probability density function of X and Y is f(x,y) = 2/3 for 0 < x < 1, 0 < y < 2, x < y, and 0 otherwise. I am trying to use the formula Var(Y|X) = E(Y^2|X)-(E(Y|X))^2. I have already calculated E(Y|X) to be (2+x)/2. But I'm unsure how to get f(Y^2) in order to find E(Y^2|X). Any tips please?

A: $E[Y|X] = \frac {\frac 23\int_x^2 y\ dy}{\frac 23\int_x^2 \ dy} = \frac {\frac 12(4-x^2)}{2-x} = \frac 12(2+x)$
$E[Y^2|X] = \frac {\frac 23 \int_x^2 y^2\ dy}{\frac 23\int_x^2 \ dy} = \frac {\frac 13(2^3-x^3)}{2-x} = \frac 13(4+2x+x)$
$E[Y^2|X] - (E[Y|X])^2 = \frac  13(4 + 2x + x^2) - \frac 14(4 + 4x + x^2) = \frac {1}{12} (4 -4x + x^2)$


text:
Q: how to automatically add a single blank row, after similar date entries in google sheets? I am making an expense tracker. Suppose in this, I have purchased 5 things on 1 Aug 2021, 3 things on 2 Aug 2021, 4 things on 3 Aug 2021, and so forth. I am pushing the data through google forms and I want that upon entering the data for a particular date, google sheets must automatically analyze whether the entry is of the same date or different. If it is of a different date, then a blank row must be added between the two distinctive dates.
Mainly, I want to group the same date entries and all in all, make different date entries blocks just to keep the table neat.
I couldn't think of any way apart from manually entering a blank row. I am new to google sheets. Thanks in advance.

A: Alternatively, if you don't want to modify your source data (which is more advised), you can use a formula for that:
=ArrayFormula(iferror(
split(transpose(split(textjoin(",",true,
   if(len(A2:A),
       {A2:B,if(A2:A<>A3:A,";;",";")
        },
)),";",true,false)),",",true,true)))

A: If you don't need to keep formatting here is the simple solution:
function insert_white_rows_between_days() {
  var sh = SpreadsheetApp.getActiveSheet();
  sh.getRange(2, 1, sh.getLastRow(), sh.getLastColumn()).sort(1); // sort by first column
  SpreadsheetApp.flush(); // wait to update the spreadsheet

  var data = sh.getDataRange().getValues().slice(1);
  var new_data = []

  for (let i = 0; i < data.length; i++) {
    new_data.push(data[i]);

    try {
      // get string 'month + day' for current line and next line
      var d1 = data[i][0].getMonth() + data[i][0].getDate();
      var d2 = data[i + 1][0].getMonth() + data[i + 1][0].getDate();

      // if the strings are not equal add a black row between the lines
      if (d1 != d2) {
        new_data.push(['', '']);
        new_data.push(data[++i]);
      }
    } catch (e) { }

  }

  sh.getRange(2, 1, new_data.length, new_data[0].length).setValues(new_data);
}

It will work fine for a simply text table (with a header).
If you need to preserve the formatting it can be done this way:
function insert_white_rows_between_days_keep_formatting() {
  var sh = SpreadsheetApp.getActiveSheet();
  sh.getRange(2, 1, sh.getLastRow(), sh.getLastColumn()).sort(1); // sort by first column
  SpreadsheetApp.flush(); // wait to update the spreadsheet

  var data = sh.getDataRange().getValues().slice(1);
  var tresholds = [];

  for (let i = 0; i < data.length-1; i++) {
    var d1 = data[i][0].getMonth() + data[i][0].getDate();
    var d2 = data[i + 1][0].getMonth() + data[i + 1][0].getDate();
    if (d1 != d2) tresholds.push(i)
  }

  tresholds.reverse().forEach(r => sh.insertRowAfter(r+2));
}

It's even shorter and simpler as it turned out, but the method insertRowAfter() is not very efficient, it can be slow if you have hundreds rows to insert.
And implementation depends on what do you mean 'automatically'. This script can be fired via 'Run' button in Script editor of course. And you can add Custom menu on your sheet and click on it. If you want to run it really automatically you need to think how exactly it should work. It can be onEdit() or onOpen() events, or probably onFormSubmit() trigger, etc.


text:
Q: Is it possible to tell if a Git hook has been bypassed? Say I push to a remote:
git commit --no-verify -a -m stuff
git push --no-verify origin some-branch

When somebody pulls that branch can they see that this commit bypassed two hooks?

A: No, they cannot see if you bypassed the hook.
For this reason, implement the crucial checking scripts server side, and reject any pushes containing "bad" commits


text:
Q: Returning List from Firestore Listen callback I have a function in firebase that is intended to get all documents in a collection called history and add it to a list intended to be returned.
The problem is, and I think this is because .listen() is async, the list returned is always empty. I know the data is queried correctly because I can print the doc in the forEach function, but adding to a list outside doesn't work.
By the way, myStream is a snapshot of the history collection in FireStore.
Does my function need to be a Future? How can I make this work?
Here is my code:
List getHistory(String id) {
  List history;

  Firestore.instance.collection(id).snapshots().listen((data) {
    data.documents.forEach(
      (doc) => history.add(doc['day']),
    );
  });

  return history;
}

A: Yes, your function will have to return a Future.
As you correctly pointed out, the way Firestore data is retrieved is asynchronous. This means that whereever you want to use this data, you will have to await a Future.
If you want to do this in your UI, you can just make use of Flutter's FutureBuilder.
However, firstly you need to refactor your getHistory function.
You will not be able to use the snapshots function if you just want to get the history once. If you do want to use real-time updates, then you can just translate everything I say to a StreamBuilder, but then you cannot return your List, you could only yield it (I will just include an example implementation at the end).
Having said that, I am going to use the getDocuments method for the FutureBuilder example.
Get data once
Future<List> getHistory(String id) async {
  List history;

  final List<DocumentSnapshot> documents =
      (await Firestore.instance.collection(id).getDocuments()).documents;

  history = documents.map((documentSnapshot) => documentSnapshot['day']).toList();

  return history;
}

Notice that I added the async keyword to be able to await the getDocuments call and wrapped the return type in a Future. I used the List.map method to map the DocumentSnapshot's to your day value (I also changed your myStream to a Firestore call because I cannot know the objects you actually use in your class, thus you will have to exchange that with how you access your Firestore collection).
In the next step, I will include an example implementation of how you would use this function in your UI using FutureBuilder:
FutureBuilder(
  future: getHistory(id),
  builder: (BuildContext context, AsyncSnapshot<List> snapshot) {
    if (snapshot.hasError) return Text('${snapshot.error}');
    if (!snapshot.hasData) return CircularProgressIndicator();

    return ListView(
      children: snapshot.data
          .map((day) => ListTile(
                title: Text('$day'),
              ))
          .toList(),
    );
  },
);

I simply used a ListView to demonstrate how you could use your list of data in your UI.
Real-time updates
Because I mentioned it earlier, here would be an example implementation for having real-time updates using Stream (you would have to exchange your FutureBuilder with a StreamBuilder if you wanted to use it in your UI):
Stream<List> getHistory(String id) {
  final Stream<QuerySnapshot> documents = Firestore.instance.collection(id).snapshots();

  return documents.map((querySnapshot) {
    List history;
    final documents = querySnapshot.documents;

    history = documents.map((documentSnapshot) => documentSnapshot['day']);

    return history;
  });
}

In this case, I am just mapping the Stream, which will apply the mapping operation for every data event. I mentioned yield above, but it is not necessary to use that here. You could use yield in the following manner, which would be closer to your initial implementation:
Stream<List> getHistory(String id) async* {
  await for (QuerySnapshot querySnapshot in Firestore.instance.collection(id).snapshots()) {
    List history;
    final documents = querySnapshot.documents;

    history = documents.map((documentSnapshot) => documentSnapshot['day']);

    yield history;
  }
}

This is probably just confusing and it is completely unnecessary here, so just ignore it :)


text:
Q: Plotting arrows at the edges of a curve Inspired by this question at ask.sagemath, what is the best way of adding arrows to the end of curves produced by Plot, ContourPlot, etc...? These are the types of plots seen in high school, indicating the curve continues off the end of the page.
After some searching, I could not find a built-in way or up-to-date package to do this. (There is ArrowExtended, but it's quite old).
The solution given in the ask.sagemath question relies on the knowledge of the function and its endpoints and (maybe) the ability to take derivatives. Its translation into Mathematica is
f[x_] := Cos[12 x^2]; xmin = -1; xmax = 1; small = .01;
Plot[f[x],{x,xmin,xmax}, PlotLabel -> y==f[x], AxesLabel->{x,y},
  Epilog->{Blue,
    Arrow[{{xmin,f[xmin]},{xmin-small,f[xmin-small]}}],
    Arrow[{{xmax,f[xmax]},{xmax+small,f[xmax+small]}}]
  }]

An alternative method is to simply replace the Line[] objects generate by Plot[] with Arrow[].  For example
Plot[{x^2, Sin[10 x], UnitStep[x]}, {x, -1, 1},
  PlotStyle -> {Red, Green, {Thick, Blue}},
  (*AxesStyle -> Arrowheads[.03],*) PlotRange -> All] /.
 Line[x__] :> Sequence[Arrowheads[{-.04, .04}], Arrow[x]]

But this has the problem that any discontinuities in the lines generate arrow heads where you don't want them (this can often be fixed by the option Exclusions -> None). More importantly, this approach is hopeless with CountourPlots. Eg try
ContourPlot[x^2 + y^3 == 1, {x, -2, 2}, {y, -2, 1}] /.
  Line[x__] :> Sequence[Arrowheads[{-.04, .04}], Arrow[x]]

(the problems in the above case can be fixed by the rule, e.g., {a___, l1_Line, l2_Line, b___} :> {a, Line[Join[l2[[1]], l1[[1]]]], b} or by using appropriate single headed arrows.).
As you can see, neither of the above (quick hacks) are particularly robust or flexible. Does anyone know an approach that is?

A: The following seems to work, by sorting the segments first:
f[x_] := {E^-x^2, Sin[10 x], Sign[x], Tan[x], UnitBox[x],
             IntegerPart[x], Gamma[x],
             Piecewise[{{x^2, x < 0}, {x, x > 0}}], {x, x^2}};

arrowPlot[f_] :=
 Plot[{#}, {x, -2, 2}, Axes -> False, Frame -> True, PlotRangePadding -> .2] /.

 {Hue[qq__], a___, x___Line} :> {Hue[qq], a, SortBy[{x}, #[[1, 1, 1]] &]} /.

 {a___,{Line[x___], d___, Line[z__]}} :>
                           List[Arrowheads[{-.06, 0}], a, Arrow[x], {d},
                                             Arrowheads[{0, .06}], Arrow[z]] /.

 {a___,{Line[x__]}}:> List[Arrowheads[{-.06, 0.06}], a, Arrow[x]] & /@ f[x];

arrowPlot[f]

A: Inspired by both Alexey's comment and belisarius's answers, here's my attempt.
makeArrowPlot[g_Graphics, ah_: 0.06, dx_: 1*^-6, dy_: 1*^-6] :=
 Module[{pr = PlotRange /. Options[g, PlotRange], gg, lhs, rhs},
  gg = g /. GraphicsComplex -> (Normal[GraphicsComplex[##]] &);
  lhs := Or@@Flatten[{Thread[Abs[#[[1, 1, 1]] - pr[[1]]] < dx],
                      Thread[Abs[#[[1, 1, 2]] - pr[[2]]] < dy]}]&;
  rhs := Or@@Flatten[{Thread[Abs[#[[1, -1, 1]] - pr[[1]]] < dx],
                      Thread[Abs[#[[1, -1, 2]] - pr[[2]]] < dy]}]&;
  gg = gg /. x_Line?(lhs[#]&&rhs[#]&) :> {Arrowheads[{-ah, ah}], Arrow@@x};
  gg = gg /. x_Line?lhs :> {Arrowheads[{-ah, 0}], Arrow@@x};
  gg = gg /. x_Line?rhs :> {Arrowheads[{0, ah}], Arrow@@x};
  gg
  ]

We can test this on some functions
Plot[{x^2, IntegerPart[x], Tan[x]}, {x, -3, 3}, PlotStyle -> Thick]//makeArrowPlot

And on some contour plots
ContourPlot[{x^2 + y^2 == 1, x^2 + y^2 == 6, x^3 + y^3 == {1, -1}},
   {x, -2, 2}, {y, -2, 2}] // makeArrowPlot

One place where this fails is where you have horizontal or vertical lines on the edge of the plot;
Plot[IntegerPart[x],{x,-2.5,2.5}]//makeArrowPlot[#,.03]&

This can be fixed by options such as PlotRange->{-2.1,2.1} or Exclusions->None.
Finally, it would be nice to add an option so that each "curve" can arrow heads only on their boundaries. This would give plots like those in Belisarius's answer (it would also avoid the problem mentioned above). But this is a matter of taste.

A: The following construct has the advantage of not messing with the internal structure of the Graphics structure, and is more general than the one suggested in ask.sagemath, as it manage PlotRange and infinities better.
f[x_] = Gamma[x]

{plot, evals} =
  Reap[Plot[f[x], {x, -2, 2}, Axes -> False, Frame -> True,
    PlotRangePadding -> .2, EvaluationMonitor :> Sow[{x, f[x]}]]];

{{minX, maxX}, {minY, maxY}} = Options[plot, PlotRange] /. {_ -> y_} -> y;
ev = Select[evals[[1]], minX <= #[[1]] <= maxX && minY <= #[[2]] <= maxY &];
seq = SortBy[ev, #[[1]] &];
arr = {Arrow[{seq[[2]], seq[[1]]}], Arrow[{seq[[-2]], seq[[-1]]}]};

Show[plot, Graphics[{Red, arr}]]

Edit
As a function:
arrowPlot[f_, interval_] := Module[{plot, evals, within, seq, arr},
   within[p_, r_] :=
    r[[1, 1]] <= p[[1]] <= r[[1, 2]] &&
     r[[2, 1]] <= p[[2]] <= r[[2, 2]];

   {plot, evals} = Reap[
     Plot[f[x], Evaluate@{x, interval /. List -> Sequence},
      Axes -> False,
      Frame -> True,
      PlotRangePadding -> .2,
      EvaluationMonitor :> Sow[{x, f[x]}]]];

   seq = SortBy[Select[evals[[1]],
      within[#,
        Options[plot, PlotRange] /. {_ -> y_} -> y] &], #[[1]] &];

   arr = {Arrow[{seq[[2]], seq[[1]]}], Arrow[{seq[[-2]], seq[[-1]]}]};
   Show[plot, Graphics[{Red, arr}]]
   ];

arrowPlot[Gamma, {-3, 4}]

Still thinking what is better for ListPlot & al.


text:
Q: BibTeX alpha long keys cause indentation of entry I'm using BibTeX with the alpha style to keep track of my references. Whenever there is an entry with 4 or more authors, the entry id composed of their names and publication years causes the first line of the entry to be indented, thereby messing up the alignment of the whole entry.
What's the best way to fix this?

A: Many Bibtex styles support control over indentation using the bibhang dimension, although I haven't found an alphanumeric style that supports it.
The code below shows how support for \bibhang can be added to vanilla Bibtex, so that it can be used with alpha.bst.

\documentclass[12pt]{article}

%% Absurd indent to show off what is happening
\newlength\bibhang
\setlength\bibhang{9em}

\bibliographystyle{alpha}

%%Redefine \bibitem to ensure bibhang is used

%%This could conflict with packages that want %%to change these parameters
\def\setbibindent{
\setlength{\itemindent}{-\bibhang}
    \setlength{\itemsep}{0pt}
    \setlength{\parsep}{0pt}
    \setlength{\leftmargin}{\bibhang}}
\let\urbibitem=\bibitem
\def\bibitem{\setbibindent\urbibitem}

\begin{document}

Some text.

\nocite[*]

\bibliography{examplebib}

\end{document}


text:
Q: I want to change the translation that appears in the description of "Migrated Questions" In https://ja.stackoverflow.com , Notification that appears in a question that has been migrated to another site,
The "description" of the destination site is displayed, which is hard to understand.

Ja: "professional and enthusiast programmers" で回答できるため、この質問は Stack Overflow に移行されました。
En: This question was migrated to Stack Overflow because it can be answered by "professional and enthusiast programmers".

However, questions migrated from other sites and the name of the source site are displayed on other sites, making it easy to understand.

Ja: この質問はスタック・オーバーフローで回答できるため "Japanese Language Stack Exchange" から移行されました。
En: This question was migrated from "Japanese Language Stack Exchange" because it can be answered on スタック・オーバーフロー.

Problem is because that refer to the translation of the string $destinationSiteAudience$, Will be permitted to (With the consent of the community) change this part?
Original String:

This question was migrated to [$toSiteName$]($destinationUrl$ "$postTitle$") because it can be answered by $destinationSiteAudience$.

A: The text for the notices for migrations when the source/destination language is different have been changed to no longer pull anything from the Db, and are now fully translatable. For migration notices between sites with the same language code the notice is the same.