text:
Q: Vertical Scroll Bar on MDI Parent Does Not Scroll Gradually I have written an MDI application in C# under VS2010.
When I drag the thumb on the vertical scroll bar, the window does not move until the thumb is released.
Research has turned-up some things, but none of the information I have found so far has worked.
Does someone have some guidance on this issue? I want the window to scroll as I drag the thumb.
Chuck

A:
"I want the window to scroll as I drag the thumb, the window does not
  move until the thumb is released"

Set the Scroll Bar Property ScrollTrack = True
Edit:
Check the last example here:
http://www.pcreview.co.uk/forums/determine-scrolling-mdi-form-mdiclient-t1323005.html
its related to detecting scrolls to repaint child forms to avoid flickering
And please have a look what Hans Passant does here: Issue Related to Scrollbar in MDI Form in C#
psuedo code:
  protected override void WndProc(ref Message m)
        {
            try
            {

                switch (m.Msg)
                {
                    //Scolling progress and Completion will be triggered
                    case WM_HSCROLL:

                    case WM_VSCROLL:
                          //this doesn't work
                          //this.VerticalScroll.Value = x;

                          //I haven't tested this but it should definately work:
                          //http://www.pinvoke.net/default.aspx/user32.setscrollpos


text:
Q: How to prevent an object from rotating about or moving relative to particular axis on pybullet? There are several vague descriptions of ways to do this, like "use the createMultiBody method" or "use maximal coordinates", but there  is no other information.
To be more specific, I am loading objects I created with SolidWorks using the loadURDF method, but I want them to only rotate about their z axis, and only move about their x and y axes. How can I achieve this? Is there a way to enable this for the entire environment?
Edit: Here's what I basically want to do:
import pybullet as p

p.connect(p.DIRECT)

OBJECT_1 = p.loadURDF("/location/of/object1.urdf")
OBJECT_2 = p.loadURDF("/location/of/object2.urdf")
OBJECT_3 = p.loadURDF("/location/of/object3.urdf")
OBJECT_4 = p.loadURDF("/location/of/object4.urdf")

# code to prevent the motion of OBJECT_1, OBJECT_2, OBJECT_3, and OBJECT_4
# (or the entire simulation) along the z axis.

# code to prevent the rotation of OBJECT_1, OBJECT_2, OBJECT_3, and OBJECT_4
# (or the entire simulation) along the x and y axes.

while True:
    p.stepSimulation()

p.disconnect()

A: I found a semi-satisfying solution a while ago; if a better one exists, please do share.
Whereas you cannot do this from the python bindings of Bullet, it is possible to introduce these constraints from the URDF (or SDF) file by introducing a 'world' link without a collision shape, then defining constraints between the world and the object. As an example, refer to this example of a biped multibody constrained to moving in the y and z axes.

redpajama_set_name: RedPajamaStackExchange


text:
Q: Devise, twitter - ask for confirmation email I have implemented twitter authentication with devise using something very similar to this: https://github.com/plataformatec/devise/wiki/OmniAuth:-Overview
My question is, since twitter doesn't give you the email of the user, how can you direct the user back to the flow of:

*

*User signs in with twitter

*User is presented with an email form

*User needs to confirm his/her email

*clicking confirmation link sends user to site logged in

Devise pretty much takes care with #3 and #4. How should I structure my code to allow #2 to transit into #3 and #4?
Thanks!

A: Show new user form in twitter callback page. Store twitter token in hidden field. Then you can create new user in your controller and do what you want with the twitter token. User.create also sends confirmation email.
User.create(:email => params[:email], :password => params[:password], :password_confirmation => params[:password_confirmation])

A: Ryan Bates covers most of this in his screencast OmniAuth Part 2, to get the email confirmation all you need to do is add the confirmable option to devise.


text:
Q: How to get the last inserted id to insert it to another table? My problem is how to get the last inserted id, I want to use that id then insert it to another table, since I have foreign key to another table.
Dim insertquery As String = "insert into IndustrialEstablishmentFood_tbl(NameOfEstablishment,Address,EmailAddress,CEO_President,GeneralManager,PollutionControlOfficer,NatureOfBusiness,ContactNumber,NameOfAccreditedWasteHauler,ControlNumber,BrgyClearanceWithCTC,DTI_SEC,ECC,PTO,DP,BFAD,AccreditedWasteHauler,SelfMonitoringReport) values (@NameOfEstablishment,@Address,@EmailAddress,@CEOPresident,@GeneralManager,@PollutionControlOfficer,@NatureOfBusiness,@ContactNumber,@NameOfAccreditedWasteHauler,@ControlNumber,@BrgyClearance,@DTISEC,@ECC,@PTO,@DP,@BFAD,@AccreditedWasteHauler,@SMR)" &
Dim cmd As New SqlCommand(insertquery, connection)
cmd.Parameters.AddWithValue("@NameOfEstablishment", NameOfEstablishment.Text)
cmd.Parameters.AddWithValue("@Address", Address.Text)
cmd.Parameters.AddWithValue("@EmailAddress", EmailAddress.Text)
cmd.Parameters.AddWithValue("@CEOPresident", CEOPresident.Text)
cmd.Parameters.AddWithValue("@GeneralManager", GeneralManager.Text)
cmd.Parameters.AddWithValue("@PollutionControlOfficer", PollutionControlOfficer.Text)
cmd.Parameters.AddWithValue("@NatureOfBusiness", NatureOfBusiness.Text)
cmd.Parameters.AddWithValue("@ContactNumber", ContactNumber.Text)
cmd.Parameters.AddWithValue("@NameOfAccreditedWasteHauler", NameOfAccreditedWasteHauler.Text)
cmd.Parameters.AddWithValue("@ControlNumber", ControlNumber.Text)
cmd.Parameters.AddWithValue("@BrgyClearance", BrgyClearance.Text)
cmd.Parameters.AddWithValue("@DTISEC", DTISEC.Text)
cmd.Parameters.AddWithValue("@ECC", ECC.Text)
cmd.Parameters.AddWithValue("@PTO", PTO.Text)
cmd.Parameters.AddWithValue("@DP", DP.Text)
cmd.Parameters.AddWithValue("@BFAD", BFAD.Text)
cmd.Parameters.AddWithValue("@AccreditedWasteHauler", AccreditedWasteHauler.Text)
cmd.Parameters.AddWithValue("@SMR", SMR.Text)
cmd.ExecuteNonQuery()
MessageBox.Show("Successfully added!", "Confirmation", MessageBoxButtons.OK, MessageBoxIcon.Information)
clear() 'clear all fields after inserted to database

A: Option 1 (for Integer based IDs)
Dim LASTID
Dim selectquery As String = "SELECT MAX(WHATYOUNAMEYOURID) FROM IndustrialEstablishmentFood_tbl GROUP BY WHATYOUNAMEYOURID"

Dim cmd As New SqlCommand(selectquery , connection)
cmd.CommandType = CommandType.Text
LASTID = cmd.ExecuteScalar

MessageBox.Show("ID Found!", LASTID, MessageBoxButtons.OK, MessageBoxIcon.Information)

Option 2 (Optimal & works with GUID) - Create a return in your query to return @@IDENTITY


text:
Q: Appharbor live deployment of builds What is the best strategy to deploy the latest build to the AppHarbor live site without users seeing any error while the deployment is in progress. Worker process will always be restarted when you deploy a fresh build though. What is the recommended strategy here.
How does StackOverflow deploy builds or bug-fixes to the live site.

A: If you're currently getting errors when deploying new versions using AppHarbor, then please get in touch so that we can take a look.
Worker restarts should not cause errors as such, just some initial slowness for the first users accessing the site after a deploy. We're also working on hot-swaps so that we only switch over to the new version once the workers are all warmed up and running.


text:
Q: How to query results from Google Scholar I'm working on a project for which I need to extract some data from Google Scholar. My PHP program takes a string from my local machine, passes it to the Google Scholar and on the search results page it takes out the first result and saves it to the database.
I have to do this for almost 90 thousand strings/queries. The problem is that after a few hundred entries the program stops as the Google Scholar asks for captcha verification. What can I do about that?

A: Because Google Scholar does not have an API, there is no documented way to do what you want. You are not supposed to scrape data like this, which is why you are running into Google's bot-protection features. I think that your only real option is to wait for Google to create an API.

A: You can try to use Google Scholar Organic Results API from SerpApi. It's a paid API with a free plan.
It bypasses blocks from search engines via dedicated proxies, CAPTCHA solving service, can scale to enterprise, no need to create a parser from scratch and maintain it.
Code and example to integrate with PHP in the online IDE:
<?php
ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
error_reporting(E_ALL);

require __DIR__ . '/vendor/autoload.php';

$queries = array(
    "moon",
    "pandas",
    "python",
    "data science",
    "ML",
    "AI",
    "animals",
    "amd",
    "nvidia",
    "intel",
    "asus",
    "robbery pi",
    "latex, tex",
    "amg",
    "blizzard",
    "world of warcraft",
    "cs go",
    "antarctica",
    "fifa",
    "amsterdam",
    "usa",
    "tesla",
    "economy",
    "ecology",
    "biology"
);

foreach ($queries as $query) {
    $params = [
        "engine" => "google_scholar",
        "q" => $query,
        "hl" => "en"
    ];

    $client = new GoogleSearch(getenv("API_KEY"));
    $response = $client->get_json($params);

    print_r("Extracting search query: {$query}\n");

    foreach ($response->organic_results as $result) {
        print_r("{$result->title}\n");
    }
}
?>

Code and example code to integrate with Python in the online IDE:
from serpapi import GoogleScholarSearch
import os

queries = ["moon",
           "pandas",
           "python",
           "data science",
           "ML",
           "AI",
           "animals",
           "amd",
           "nvidia",
           "intel",
           "asus",
           "robbery pi",
           "latex, tex",
           "amg",
           "blizzard",
           "world of warcraft",
           "cs go",
           "antarctica",
           "fifa",
           "amsterdam",
           "usa",
           "tesla",
           "economy",
           "ecology",
           "biology"]

for query in queries:
    params = {
        "api_key": os.getenv("API_KEY"),
        "engine": "google_scholar",
        "q": query,
        "hl": "en"
        }

    search = GoogleScholarSearch(params)
    results = search.get_dict()

    print(f"Extracting search query: {query}")

    for result in results["organic_results"]:
        print(result["title"])

Output:
Extracting search query: moon
Cellulose nanomaterials review: structure, properties and nanocomposites
Reflection in learning and professional development: Theory and practice

...

Extracting search query: biology
A new biology for a new century
The biology of mycorrhiza.

Disclaimer, I work for SerpApi.


text:
Q: Continuidad de funciones Ayuda para la demostración o un contra ejemplo del siguiente enunciado:
Si $(f∘r)(t)$ es continua $∀r$ continua y $r(t_{0})=x_{0}$,entonces $f$ es continua.
Con $r$ y $x_{0}$vectores
Donde $r$ es una trayectoria y $f$ es una función
En caso de un contra ejemplo favor específicar el porque y justificarlo
Se me ha ocurrido proceder por contradicción y llegar a un absurdo por el cuál lleguemos a que $f$ tiene que ser continua


text:
Q: Issues with .TPL file with Smarty I use PHP Melody on my site and I don't know how can I make one thing.
I have this code to print on index 30 post:
Code:
{get_advanced_video_list assignto="new_videos" limit="30"}
{foreach from=$new_videos key=k item=video_data}

I need after 5 post to put a div (div class="thumb-holder")

So there should be:
>div class="thumb-holder" post 1 post 2 post 3 post 4 post 5 /div>

>div class="thumb-holder" post6 post7 post8 post9 post10 /div>

>div class="thumb-holder" post11 post12 post13 post14 post15 /div>

>.........................

>div class="thumb-holder" post26 post27 post28 post29 post30 /div

I tried more things, but nothing has worked. What can I do?
PS: Is a .tpl file so outdated that it no longer works with PHP?

A: {foreach from=$entries key=i item=topic name=foo}
  {if $smarty.foreach.foo.index == 10}
    {break}
  {/if}
  {if $topic.topic_style == question}

      {$topic.title}

  {/if}
{/foreach}

A: Here exactly what you wish:

    {foreach from=$new_videos key=k item=video_data name=foo}
        {if $smarty.foreach.foo.index > 1 and $smarty.foreach.foo.index is div by 5}

        {/if}
        {$video_data}

    {/foreach}

A: To avoid index checking on every loop, use array_chunk to split your array into smaller chunks with exact amount of items you need:
{assign var=video_groups value=$new_videos|array_chunk:5:true}
{foreach from=$video_groups item=video_group}

    {foreach from=$video_group item=video_data key=k}

    {/foreach}

{/foreach}


text:
Q: PyQt - Easily add a QWidget to all Views I have the following
class MyView(QWidget):
    def __init__(self, *args, **kwargs):
        super().__init__(*args, **kwargs)

        layout = QVBoxLayout()
        layout.addWidget(QLabel('Hello World'))
        self.setLayout(layout)

class NavigationMenu(QWidget):
    pass
    # Renders a bar of full width and 15 px height

What is the easiest way to add the NavigationMenu to MyView?
In the future, I would have to also add the NavigationMenu to all other Views, so I am looking for something scalable from a typing and maintainability stand point.
I tried decorators (just @NavigationMenuDecorator on top of the class), but I either cannot bind them or they get initialized at parse time and error QWidget: Must construct a QApplication before a QWidget.
I tried just adding it into MyView, but there is a lot of boilerplate
class MyWidget(Widget.QWidget):
    def __init__(self, *args, **kwargs):
        super().__init__(*args, **kwargs)

        layout = Widget.QVBoxLayout()
        layout.addWidget(QLabel('Hello World'))

        topLayout = Widget.QVBoxLayout()
        topLayout.setContentsMargins(0, 0, 0, 0)
        topLayout.addWidget(NavigationMenu())
        topLayout.addLayout(layout)

        self.setLayout(topLayout)

A: A possible solution is to use metaclass:
from PyQt5 import QtCore, QtWidgets

class NavigationMenu(QtWidgets.QWidget):
    def __init__(self, parent=None):
        super().__init__(parent)
        lay = QtWidgets.QVBoxLayout(self)
        lay.addWidget(QtWidgets.QLabel("NavigationMenu"))

class MetaNavigationMenu(type(QtWidgets.QWidget), type):
    def __call__(cls, *args, **kw):
        obj = super().__call__(*args, **kw)
        lay = obj.layout()
        if lay is not None:
            lay.addWidget(NavigationMenu())
        return obj

class View(QtWidgets.QWidget, metaclass=MetaNavigationMenu):
    def __init__(self, *args, **kwargs):
        super().__init__(*args, **kwargs)
        layout = QtWidgets.QVBoxLayout()
        layout.addWidget(QtWidgets.QLabel('Hello World'))
        self.setLayout(layout)

if __name__=="__main__":
    import sys
    app = QtWidgets.QApplication(sys.argv)
    w = View()
    w.show()
    sys.exit(app.exec_())

Update:
With the following method you can inject the view and the additional arguments that the view requires:
from PyQt5 import QtCore, QtWidgets

class NavigationMenu(QtWidgets.QWidget):
    def __init__(self, value, text="", parent=None):
        super().__init__(parent)
        lay = QtWidgets.QVBoxLayout(self)
        lay.addWidget(QtWidgets.QLabel(text))
        print(value)

class MetaMenu(type(QtWidgets.QWidget), type):
    def __new__(cls, class_name, parents, attrs, **kwargs):
        cls._view = kwargs.pop('view', None)
        cls._args = kwargs.pop('args', tuple())
        cls._kwargs = kwargs.pop('kwargs', dict())
        return type.__new__(cls, class_name, parents, attrs)

    def __call__(cls, *args, **kw):
        obj = super().__call__(*args, **kw)
        layout = getattr(obj, 'layout', None)
        if callable(layout) and View is not None:
            layout().addWidget(cls._view(*cls._args, **cls._kwargs))
        return obj

class View(QtWidgets.QWidget, metaclass=MetaMenu, view=NavigationMenu, args=(10, ), kwargs={"text": "NavigationMenu"}):
    def __init__(self, *args, **kwargs):
        super().__init__(*args, **kwargs)
        layout = QtWidgets.QVBoxLayout()
        layout.addWidget(QtWidgets.QLabel('Hello World'))
        self.setLayout(layout)

if __name__=="__main__":
    import sys
    app = QtWidgets.QApplication(sys.argv)
    w = View()
    w.show()
    sys.exit(app.exec_())

A: The other solution here is amazing and I learned a lot about metaclasses. However, it is quite hard to read and adds unnecessary complexity. I settled for a composition-based approach, where I just extracted the boilerplate to a separate function.
The add_navigation() function wraps the old layout in a widget, creates a QVBoxLayout with the NavigationMenu and the old layout, and finally swaps the layouts.
def add_navigation(widget, title)
    main = QWidget()
    main.setLayout(widget.layout())

    layout = QVBoxLayout()
    layout.setContentsMargins(0, 0, 0, 0)
    layout.setSpacing(0)
    layout.addWidget(NavigationBar(title))
    layout.addWidget(main)

    widget.setLayout(layout)

We then have just a 1-liner of boilerplate and the code then becomes.
class MyView(QWidget):
    def __init__(self, *args, **kwargs):
        super().__init__(*args, **kwargs)

        layout = QVBoxLayout()
        layout.addWidget(QLabel('Hello World'))
        self.setLayout(layout)

        add_navigation(self, 'Navigation Title')

class NavigationMenu(QWidget):
    pass
    # Renders a bar of full width and 15 px height


text:
Q: Order list alphabetically, distinct and uppercase I want to order a list alphabetically from A to Z, without doublon and in uppercase. The list is store in a variable like @trigram.
For example :
I have : Cap, yUM, HuI, aBc
And I want : ABC, CAP, HUI, YUM
With a @trigram.each I think but I don't know how.

A: You could do:
ar = %w( Cap yUM HuI aBc cap )
ar.map(&:upcase).uniq.sort
#=> ["ABC", "CAP", "HUI", "YUM"]

A: I solve my problem with :
@trigram = @trigram.order('trigramme asc').group("trigramme")
Thank you all.


text:
Q: creating groups based on multiple criteria in pandas I have 5 columns based on state-level demographics (gpd, per capita income, dti, unemployment rate and hpi), and a column with states. I would like to create a variable that contains 4 groups based on these demographic variables, so for example:
Group 1 would have values in the first quantile (worse demographics),
group 2 would be in the second quantile,
group 3 would be in the third quantile,
group 4 would be in the fourth quantile.

Here I just put a random number from 1 to 4 to indicate what the outcome should be. In the dataset I of course deal with more states, but this is roughly what it should look like.
So, in the end, every state would belong to a certain group, based on its demographics.
For all the variables it holds that the lower the value, the worse it is, except for unemployment rate of course.
Any help would be greatly appreciated.


text:
Q: 400 Bad Request Error uploading videos to YouTube using C# YouTube API I can't seem to get my ASP.net application to succesfully publish to my YouTube account but not matter what I do I get a 400 Bad Request error
. I used the YouTube documentation to create my code and obtaining a dev key.  Also, I am not receiving and authentication error so I believe that my parameters are correct.  Despite a good deal of searching I cannot not find a definitive answer to my quests so I can only assume that I am using the API incorrectly or omitting something critical.
My using directive are as follows
using System;
using Google.GData.Client;
using Google.GData.YouTube;
using Google.GData.Extensions;
using Google.GData.Extensions.MediaRss;
using Google.YouTube;
My Code for calling the APIs is here
YouTubeRequestSettings settings = new YouTubeRequestSettings("k2ps",
  YOU_TUBE_DEVELOPER_KEY, YOU_TUBE_USER_NAME, YOU_TUBE_PASSWORD);
  YouTubeRequest request = new YouTubeRequest(settings);

  Video video = new Video();
  video.Title = title;
  video.Tags.Add(new MediaCategory(sport, YouTubeNameTable.CategorySchema));
  video.Keywords = keyword;
  video.Description = "K2ps";  //todo replace this with the preview text
  video.YouTubeEntry.Private = false;

  video.YouTubeEntry.MediaSource = new MediaFileSource(videoPath, "video/x-flv");
  Video createdVideo = request.Upload(video);

I am getting a HTTP 400 Bad request exception being thrown.  I used fiddler to
      get the raw response which is below.
Execution of request failed: http://uploads.gdata.youtube.com/feeds/api/users/default/uploads
 at Google.GData.Client
   HTTP/1.1 400 Bad Request
    Server: Upload Server Built on Jun 6 2011 12:48:11 (1307389691)
    X-GData-User-Country: US
    Content-Type: text/xml; charset=UTF-8
    Date: Thu, 09 Jun 2011 02:07:30 GMT
    Pragma: no-cache
    Expires: Fri, 01 Jan 1990 00:00:00 GMT
    Cache-Control: no-cache, no-store, must-revalidate
    Content-Length: 257

        <?xml version='1.0' encoding='UTF-8'?>
           <errors>
              <error>
                <domain>yt:validation</domain>
                invalid_value
         <location type='xpath'>
 media:group/media:category[@scheme='http://gdata.youtube.com/schemas/2007/categories.cat']/text()</location>
              </error>
          </errors>

A: According to the response, your media:category might be incorrect. Try:
video.Tags.Add(new MediaCategory("Sports", YouTubeNameTable.CategorySchema));

A: You need to specify 1 default category from the 'http://gdata.youtube.com/schemas/2007/categories.cat' that they show in that error message.
It has to match the tags exactly that are specified in that document.


text:
Q: Find the largest tree I'm getting too many results. What's the matter? Clipping the result as in the prolog does not exist?
(deffacts mytree
    (below birch poplar)
    (above linden maple)
    (below pine fir)
    (below linden birch)
    (above pine poplar))

(defrule high-low-tree
    (below ?tree1  ?tree2)
    (not (above ?tree1  ?tree2))

    (or (above ?tree2  ?tree1)
(not (above ?tree2  ?tree1)))
    =>
    (printout t "The tallest tree " ?tree2 crlf)
    (printout t "The lowest tree " ?tree1 crlf))

A: Finding the tallest and lowest:
CLIPS>
(deffacts mytree
    (tree birch)
    (tree poplar)
    (tree linden)
    (tree maple)
    (tree pine)
    (tree fir)
    (below birch poplar)
    (above linden maple)
    (below pine fir)
    (below linden birch)
    (above pine poplar))
CLIPS>
(defrule high-low-tree
   (tree ?tallest)
   (tree ?lowest)
   (not (below ?tallest ?))
   (not (above ? ?tallest))
   (not (below ? ?lowest))
   (not (above ?lowest ?))
   =>
   (printout t "The tallest tree " ?tallest crlf)
   (printout t "The lowest tree " ?lowest crlf))
CLIPS> (reset)
CLIPS> (run)
The tallest tree fir
The lowest tree maple
CLIPS>

Ranking them all:
CLIPS> (clear)
CLIPS>
(deffacts mytree
    (tree birch)
    (tree poplar)
    (tree linden)
    (tree maple)
    (tree pine)
    (tree fir)
    (below birch poplar)
    (above linden maple)
    (below pine fir)
    (below linden birch)
    (above pine poplar)
    (tree-list))
CLIPS>
(defrule order-trees
   (tree ?tallest)
   ?t <- (tree-list $?list)
   (test (not (member$ ?tallest ?list)))
   (not (above ?above&:(not (member$ ?above ?list)) ?tallest))
   (not (below ?tallest ?below&:(not (member$ ?below ?list))))
   =>
   (retract ?t)
   (assert (tree-list ?list ?tallest)))
CLIPS>
(defrule print-list
   (declare (salience -10))
   (tree-list $?list)
   =>
   (printout t "Trees (tallest to lowest): " (implode$ ?list) crlf))
CLIPS> (reset)
CLIPS> (run)
Trees (tallest to lowest): fir pine poplar birch linden maple
CLIPS>


text:
Q: Select unary vs. binary std::transform function overload automatically based on callable's signature std::transform provides overloads which take either a unary (one argument) or binary (two argument) callable operation (typically a lambda).
I would like to pass my desired callable as an argument to a parent function, and use a compile-time (e.g. template metaprogramming) approach to automatically select which of the std::transform overloads gets used, based on whether the passed callable has a function signature with one or two arguments.
Here is the desired approach expressed in (not yet working) code:
#include <algorithm>

auto UnaryOp = [](const auto& src) { return src; };                                 // simple copy
auto BinaryOp = [](const auto& src1, const auto& src2) {return src1 + src2; };      // accumulate

auto GenericTransformer = [](auto src, auto dst, auto operation) {  // operation is unary OR binary

    /* unrelated code */

        // need to chose this one:
    std::transform(src.begin(), src.end(), dst.begin(), operation);
        // or this one:
    std::transform(src.begin(), src.end(), dst.begin(), dst.begin(), operation);
        // depending on whether unary or binary operation is passed in 'operation' argument

    /* unrelated code */

};

int main() {
    std::vector<int> source_vec(100);
    std::vector<int> dest_vec(100);
    GenericTransformer(source_vec, dest_vec, UnaryOp);  // i.e. copy source to destination
    GenericTransformer(source_vec, dest_vec, BinaryOp); // i.e. accumulate source into destination
}

Here I have defined two lambda operations - one unary and one binary (UnaryOp and BinaryOp) – which are passed to the GenericTransformer() from main().
Within GenericTransformer(), what compile-time magic can I use to automatically select which of the two std::transform() calls gets made based on the function signature of the operation argument?
NOTE: this is a simplified case for example purposes.  I would prefer not to have to split GenericTransformer() into two separate functions (a unary one and a binary one), as that would result in a lot of duplication of code not shown here.  Sticking to the DRY philosophy!

A: With C++17 you can mix if constexpr and std::is_invocable:
if constexpr (std::is_invocable_v<
    decltype(operation),  decltype(*src.begin())>) {
    std::transform(src.begin(), src.end(), dst.begin(), operation);
}
else {
    std::transform(src.begin(), src.end(), dst.begin(), dst.begin(), operation);
}

You could also check that operation is valid in the second case but that would require an extra else branch to avoid silencing compile-time errors when (neither branch is valid), and this would require some always_false shenanigan.


text:
Q: redirect to another function in a controller in magento I have magento site.
I have a controller ,how can i redirect into another function in this controller?
That means ,there have two functions:
1.test()

i want to redirect from test1() to test2()

how can i do this?
How can i redirect from one function to another function in the same controller?

A: There are three redirecting functions available in frontend controller which are:
_redirect()
_redirectUrl()
_redirectReferer()

_redirect('frontName/controllerName/actionName/param1/param2') is used for internal redirection.
_redirectUrl($fullUrl) is used for external redirection.
_redirectReferer() is used to redirect to the referer url.
Hope this gives more info.

A: You can put something like this in test1 action.
$this->_redirect('*/*/test2', array(if you want to pass something then from here you can pass ));


text:
Q: Normal map from displacement map I would like to create a normal map from a displacement map.
This function is available in 3D applications like Blender, but I would like to do that programatically using VB.NET, however I don't have any knowledge about it.
There was a link to the basic approach here, however it's gone.
Perhaps there is even an imagefilter to do that in .NET.
I'd be glad if anybody with some experience about it could help me here.


text:
Q: Determining if a directed graph is unilateral How would you go about finding out if a directed graph is unilateral (for any pair of verticles u,v, at least one is reachable from the other)?
I'm thinking that you could run DFS or BFS and see if you can reach every vertex.  If not, compute the transpose and do the same search algorithm from the same vertex.  If you have reached every vertex at least one, is the graph unilateral?
Obviously you could do this in large running times by just analyzing an adjacency matrix, but ideally we want to run in O(V+E)

A: Try these algorithms. The one I learned in college was Floyd-Warshall, but its performance is not as good as you desire. Johnsons's algorithm is faster for sparse graphs, but still O(V*E), not O(V+E).

A: Find the strongly connected components with, say, Tarjan's algorithm.  Every node in an SCC is reachable from any other, so they are equivalent in terms of which nodes they can reach and be reached by.  Collapse each SCC into a single vertex, and the resulting DAG will be unilateral iff the original graph was unilateral.
A DAG is unilateral iff if it is a total ordering, i.e, if there is only one topological order.  If there is a path from A to B, then A must come before B.  If there is a path from B to A, then B must come before A.  You can't have both, because the graph is now acyclic.  If there is no path between A and B, then then they are not ordered and there are at least 2 topological orders for the graph -- one with A before B, and one with B before A.
A fast way to check for a total order is to do a topological sort with Kahn's algorithm, and check to ensure that there is only one choice for the next vertex at every iteration.
Tarjan's algorithm for finding SCCs, Collapsing the SCCs, and Kahn's algorithm for topological sort, all run in O(V+E) time.

A: I am not entirely sure whether this is correct, but I think that it should suffice to check if the digraph is "connected" (see description of the algorithm below to find out what I mean by connected). If there are multiple connected components in the digraph, then it is not unilateral.
Proof attempt:
Suppose that the digraph has multiple connected components. For simplicity's sake, let the number of connected components be 2, and let's call the components C1 and C2. Select any vertex v from C1 and any vertex w from C2. Since they are in different connected components, there is no path from v to w or w to v, otherwise C1 and C2 will be in the same component.
For the other case, suppose that a digraph is connected. Then for any 2 distinct vertices x and y in the digraph, there is either a path from x to y or from y to x, otherwise they will not be in the same component. I know it's a bit hand wavy here, but I'm not exactly good at proofs.
EDIT: A simpler algorithm:
I do think a modified Depth First Search / Breadth First Search should be able to do it. Essentially, we can start the search from any vertex. We mark all vertices reachable from that first vertex as visited. Then loop through all vertices. For any unvisited vertex, we conduct a BFS / DFS, and we use a list to keep track of all unvisited vertices that we have traversed. If during the BFS / DFS, we do not visit any previously visited vertex from a prior BFS / DFS, then we can conclude immediately that the digraph has multiple connected components and is not unilateral. Otherwise, we mark all vertices in the list we obtained during the search as visited, and we continue.
Once we have gone through all vertices in the graph all the BFS / DFS hit some previously visited vertex, we can conclude that the graph is unilateral.
Some pseudocode to illustrate this. I shall make use of Depth First Search:
// a boolean array to keep track if a given vertex is visited
// initially this is set to false
boolean[] visited
// boolean array to keep track of visited vertices for 2nd dfs onwards
boolean[] visited_two

// used for first dfs
dfs(vertex) {
  visited[vertex] <- true
  for each edge leading out of vertex {
    dfs(next vertex)
  }
}

// used for subsequent dfs
dfs_two(vertex, list_for_storing_vertices) {
  // we use the visited_two array here, because the
  // visited array is used to store previously visited
  // vertices
  visited_two[vertex] <- true
  list_for_storing_vertices.append(vertex)
  // return value. we return true if we encounter
  // a previously visited vertex. otherwise, return false
  return_value <- false
  for each edge leading out of vertex {
    if visited[next vertex]
      return_value <- true
    else if !visited_two[next_vertex]
      r = dfs_two(next vertex, list_for_storing_vertices)
      return_value = return_value || r
  }
  return return_value
}

// overall algorithm
// Returns true if the graph is unilateral. false otherwise
bool digraph_unilateral(graph) {
  // Just pick any vertex. we will pick vertex 0
  set all entries in `visited` array to false
  dfs(0)
  // then loop through all vertices. if they haven't been visited,
  // we perform a dfs
  for each vertex in the digraph {
    if !visited[vertex] {
      // reset visited_two array
      set all entries in `visited_two` array to false
      visited_list <- []
      encountered_previously_visited <- dfs_two(vertex, visited_list)
      if encountered_previously_visited {
        // mark the vertices we encountered as visited
        for each v in visited_list {
          visited[v] <- true
        }
      } else {
        // we did not encounter any previously visited vertex
        // so all vertices we encounter on this search are in
        // a distinct connected component
        return false
      }
    }
  }
  return true
}

Original, more difficult algorithm:
How do we then compute if a digraph is unilateral? You can first run Tarjan's Strongly Connected Components algorithm and determine the strongly connected components of the digraph. You will need to modify the algorithm slightly to compress the strongly connected components into supervertices. This is not difficult to do, just assign each vertex in the same strongly connected component an integer label. In other words, all the vertices in the same strongly connected component will be replaced by 1 supervertex. Tarjan's SCC (Strongly Connected Components) algorithm runs in O(V+E) time.
After the step above, the digraph is now acyclic (no cycles). This allows us to move on to the next step.
After that, perform a topological sort on the resulting graph from above. This should give us a topological ordering of the directed acyclic graph. This step also runs in O(V+E) time using a depth first search implementation.
Now that we have the topological ordering, perform either Breadth First Search or Depth First Search according to the topological ordering on the directed acyclic graph obtained after the Tarjan's SCC step. If the number of connected components is 1, then the original graph is unilateral (it is also unilateral if the number of connected components is 0, but that is an empty graph and so is trivial). Otherwise, there are multiple components, and the original graph is not unilateral. This step also runs in O(V+E) time.
Therefore, the overall algorithm runs in O(V+E) time.
Conclusion
I think this should be correct, but you might want to verify this approach with someone else. If you have any difficulty in understanding my approach or implementing the algorithms, do leave a comment.
Hope that helps!


text:
Q: DateTime already installed from cpan and cpanm but still cant locate in @INC How is possible to not locate DateTime.pm even though I have installed it from cpan and cpanm? But still get the error it cannot find it in @INC? It is not duplicate because I don ask about who to donwload modul - as I said I tried to install it from 2 sources and i did, but still the error Can't locate DateTime.pm in @INC. I have no idea what I am doing wrong.
the code is simple:
#!/usr/bin/perl
use DateTime;
my $t = localtime;
my $now = DateTime->new(
year => $t->year,
month => $t->mon,
day => $t->mday,
);
print $now

and error:
Can't locate DateTime.pm in @INC (you may need to install the DateTime module) (@INC contains:
    /etc/perl
    /usr/local/lib/x86_64-linux-gnu/perl/5.28.1
    /usr/local/share/perl/5.28.1
    /usr/lib/x86_64-linux-gnu/perl5/5.28
    /usr/share/perl5
    /usr/lib/x86_64-linux-gnu/perl/5.28
    /usr/share/perl/5.28
    /usr/local/lib/site_perl
    /usr/lib/x86_64-linux-gnu/perl-base
) at ./a line 2.

Seems i cant find DateTime.pm but I do have them here:
/home/shepherd/.cpan/build/DateTime-1.51-0/blib/lib/DateTime.pm
/home/shepherd/.cpan/build/DateTime-1.51-0/lib/DateTime.pm
/home/shepherd/.cpan/build/DateTime-TimeZone-2.37-0/t/lib/T/RequireDateTime.pm
/home/shepherd/.cpanm/work/1572257193.20577/DateTime-1.51/lib/DateTime.pm
/home/shepherd/.cpanm/work/1572257193.20577/DateTime-TimeZone-2.37/t/lib/T/RequireDateTime.pm
/home/shepherd/.cpanm/work/1572257544.21848/DateTime-1.51/lib/DateTime.pm
/home/shepherd/.cpanm/work/1572257544.21848/DateTime-TimeZone-2.37/t/lib/T/RequireDateTime.pm

What the hell is going on?

Some information that might be useful:
$ which cpan
/usr/bin/cpan

$ head -n 1 `which cpan`
usr/bin/perl

$ which cpanm
/usr/bin/cpanm

$ head -n 1 `which cpanm`
usr/bin/perl

$ /usr/bin/perl -V:'inst.*lib'
installarchlib='/usr/lib/x86_64-linux-gnu/perl/5.28';
installprivlib='/usr/share/perl/5.28'
installsitelib='/usr/local/share/perl/5.28.1'
installvendorlib='/usr/share/perl5'

@INC (when 'use DateTime;')
/etc/perl
/usr/local/lib/x86_64-linux-gnu/perl/5.28.1
/usr/local/share/perl/5.28.1
/usr/lib/x86_64-linux-gnu/perl5/5.28
/usr/share/perl5
/usr/lib/x86_64-linux-gnu/perl/5.28
/usr/share/perl/5.28
/usr/local/lib/site_perl
/usr/lib/x86_64-linux-gnu/perl-base

the command set | grep ^PERL echoes nothing, i've tried set | grep -i perl but just was mentioned in some if statements, like this: if type perl &> /dev/null; then. And the second command echo 'o conf' | cpan is this: Loading internal logger. Log::Log4perl recommended for better logging There seems to be running another CPAN process (pid 2023). Contacting... Other job not responding. Shall I overwrite the lockfile '/home/shepherd/.cpan/.lock'? (Y/n) [y] Ok, bye

A: The directories where you can see DateTime (under /home/shepherd/.cpan) are working directories that cpan and cpanm use when installing your modules. You wouldn't expect to actually load modules from there once they have been installed - as other copies of the modules should be installed somewhere more permanent.
But where have they been installed? That's the question. By default, they should be installed somewhere on your default @INC path, but they're clearly not there - otherwise you wouldn't get that error message.
So I'm led to suspect that either there was an error when installing the modules or they somehow got installed in a non-standard place on your system. And it's impossible to give much more useful help without seeing exactly what commands you ran to install the modules and what output was produced.

A: I think I've had the same problem. Many times. When you sudo apt-get install libsomething-perl the DateTime.pm file, or one of the directories it resides under, might not be readable to your normal user. (Depending on umask or g+s settings I think)
To check this out, see if it's available as root (sudo) and where it's located by running:
sudo perl -le'use DateTime; print $INC{"DateTime.pm"}'

Then run:
sudo ls -ld $(sudo perl -E'use DateTime;@p=split"/",$INC{"DateTime.pm"};say join"/",@p and pop@p while@p>1')

And you might see something like this:
drwxr-xr-x  root root   4096 Aug 30  2016 /usr
drwxr-xr-x  root root  12288 Oct  9 10:22 /usr/lib
drwxr-xr-x  root root  69632 Oct 23 06:35 /usr/lib/x86_64-linux-gnu
drwxr-xr-x  root root   4096 Aug 30  2016 /usr/lib/x86_64-linux-gnu/perl5
drwxr-xr-x  root root   4096 Oct  9 10:22 /usr/lib/x86_64-linux- gnu/perl5/5.22
-rw-r--r--  root root 123586 Dec 18  2015 /usr/lib/x86_64-linux-gnu/perl5/5.22/DateTime.pm

If your current user don't have the permissions needed to read the DateTime.pm file or a directory it's in, try using either sudo chown $(whoami) /usr/lib/x86_64-linux-gnu/perl5/5.22/ or sudo chmod a+rx /usr/lib/x86_64-linux-gnu/perl5/5.22/DateTime.pm or similar to change that. (The directories in my examples here should of course be changed into what you got from the ls command above)


text:
Q: Java regex - how to chop String into parts I am trying to chop a text into an Array (or List).
For example the String
String str = "so this will be _ITALIC_ and this will be *BOLD* and so on";

shall be split into this:
String[] arr = new String[] {"so this will be ", "_ITALIC_", " and this will be ", "*BOLD*", " and so on"};

i worked out some things with regex like:
the Patterns for finding my matches:
public static final Pattern Italic = Pattern.compile("_(.*?)_");
public static final Pattern Bold = Pattern.compile("\\*(.*?)\\*");
public static final Pattern Strike = Pattern.compile("~(.*?)~");

i also found out how to split the text with my patterns:
// more to be added
Pattern ptn = Pattern.compile(Italic + "|" + Bold + "|" + Strike);
String[] parts = ptn.split(input);

which results in:
"so this will be "
" and this will be "

but i am not able to find a way, without loosing the information of the pattern.
Why i do this?
i need to transform plain text to formatted text using javafx.scene.text.TextFlow therefore i need to find the chunks and create javafx.scene.text.Text and apply the formating.


text:
Q: Is there a way to populate a column based on values associated with another column in Pandas? I have a very large data-set at the moment that I'm trying to work with, but I need the blanks populated before I can effectively do so. A mock-up example of what I'm working with looks something like Ex 1. The "Name" is only populating 1 value in the "Item" column for each "Team".
Is it possible to assign the value in the "Name" column to all rows with the respective "Team" number its associated with to look something like Ex 2? I would be reading in an excel file.
I'm new to pandas, and I'm unsure what to look up specifically to find this answer, so I apologize if this has been asked before.
Ex1

 Team    Item      Name
 1       Credit
 1       Debit     Bob
 1       Etc
 2       Credit
 2       Debit     Steve
 2       Etc

Ex2

 Team    Item      Name
 1       Credit    Bob
 1       Debit     Bob
 1       Etc       Bob
 2       Credit    Steve
 2       Debit     Steve
 2       Etc       Steve

A: You can using groupby with ffill().bfill() chain.
df['Name']=df.groupby('Team').Name.apply(lambda x : x.ffill().bfill())
df
Out[262]:
   Team    Item   Name
0     1  Credit    Bob
1     1   Debit    Bob
2     1     Etc    Bob
3     2  Credit  Steve
4     2   Debit  Steve
5     2     Etc  Steve


text:
Q: Using Drupal.behaviors for certain pages only? I have a module that displays an alert to a user, inside of a block. Here is my GitHub repo, because I can't remember how to get a dev branch going on Drupal CVS right this second:
https://github.com/kevinquillen/User-Alerts
Module page (with longer description):
http://drupal.org/project/user_alert
I recently started addressing some of the issues in the queue. One of the first ones I wanted to get out of the way was making it so this module can still function when Block Cache and/or Boost are enabled. One person reported that when one user closed the message, it closed it for all other visitors, I assume this stems from caching mechanisms.
I added a Drupal.behavior to check for an active alert on page load- but I can't figure out how to only fire this behavior if the block is visible per its visibility settings. For instance, if its only set to the front page, this behavior should only fire on the front page and not all pages (adding overhead).

A: check for the existence of your blocks css class, or add a class specificly for this check, before firing off AJAX call. If your class exists your block exists.


text:
Q: Ajuste fino no Ranking pra um sistema de jogo Estou com um problema muito doido que ja queimou minha capacidade lógica.
Há um tempo atras postei uma pergunta quase igual a essa mas e me auxiliaram bastante (agradeço muito) mas minha necessidade mudou e agora estou com outra tabela e minha consulta mudou bastante, pedi ajuda a um professor e chegamos a isso:
select * from (
(SELECT distinct nome_jogador,pontos,datahora, 1 as ordem
from jogador j inner join pontuacao_fx p
on j.id_jogador = p.id_jogador  WHERE pontos > (SELECT pontos FROM pontuacao_fx WHERE id_jogador=7 )
ORDER BY datahora desc, pontos desc)

union

(select distinct nome_jogador, pontos,datahora, 2 as ordem
from jogador j inner join pontuacao_fx p
on j.id_jogador = p.id_jogador where pontos = (SELECT pontos FROM pontuacao_fx WHERE id_jogador=7 )
)

union

(SELECT distinct nome_jogador,pontos,datahora, 3 as ordem
from jogador j inner join pontuacao_fx p
on j.id_jogador = p.id_jogador WHERE pontos < (SELECT pontos FROM pontuacao_fx WHERE id_jogador=7 )
ORDER BY datahora desc, pontos desc);

) order by ordem asc,datahora desc, pontos desc

Estou de MYSQL gratuito com workbench e o erro é esse:

ERROR CODE:1248: EVERY DERIVED TABLE MUST HAVE ITS OWN ALIAS.

Tenho que fazer esse ranking agora com a classificação por pontuação e caso haja empate, por data e hora em que a pontuação foi inserida (ja fiz no BD os comandos pra guardar data e hora automaticamente no insert e update dos pontos) sendo a pontuação mais recente dada como maior.
Mais uma vez peço encarecidamente socorro.

A: O erro já diz tudo. Você precisa definir um alias para sua tabelas derivadas. Olha o exemplo abaixo:
SELECT SUM(`quant`), MONTH(`date`) AS month, `id`
from (
  ... inner select
)
group by id, month;

O Correto seria:
SELECT SUM(`quant`), MONTH(`date`) AS month, `id`
from (
  ... inner select
) as t -- this is the change
group by id, month;

Fonte


text:
Q: Why is search keyword going across apps on a Mac? I just found out if a keyword is searched inside of Google Chrome on a Mac, then if I go to the Terminal app and search there, the keyword will go across there.
That is different from what I know before: each app's search is independent and they would not go across. How come it is happening and is there a way to make them independent?
(this Mac is still running Mavericks but I am wondering if High Sierra is doing the same thing)


text:
Q: Unable to run WatchKit app when supports running without iOS app installation is unchecked I get the following error when trying to run my WatchKit app:
Please try again later.
This app has the ITSWatchOnlyContainer key set in its Info.plist, which identifies it as a shell app surrounding a Watch-only app; these are not installable.
I checked the Plists, there is no ITSWatchOnlyContainer entry.
Strangely enough the watch app starts if I check off: supports running without iOS app installation.

A: If you added a watch project into your iOS existing app. This might be the cause of the problem.
To fix this one:

*

*Check for WKCompanionAppBundleIdentifier in Info.plist located in WatchKit App Folder. If it does not exist, add it and the value for this should be the bundle identifier of your ios app.

*In Info.plist located in WatchKit Extension folder, replace App is only available as a standalone watchOS app to App can run independently of companion iPhone app. Clean build & run. This should work after. If not, try closing and reopening the Xcode.


text:
Q: setting javascript variable value in JSP:UseBean using Set property I am new to Java and don't know whether it's possible or not:
How to populate the variable of JSP:bean with already existing JavaScript variables present in the JavaScript?

A: You have to post the value of the js variable to server side and then set the value to the desired java bean.

A: First of all JSP is nothing but a servlet running on the Server to generate html pages and Javascript is a client-side scripting language, so as such there is no direct interaction between the two.
But if you want to set some variable from javascript in a JSP, then you would have to send that variable value to the server either by a GET or POST request or using Ajax requests.
I would suggest going through tutorials which explain the concepts of JSPs, we have a good wiki for JSP with some very useful links as well.


text:
Q: How to make a gif clickable to a new page? I would like to make a gif clickable to a new page. I'm not sure what code to include and have tried many options that did not work out. The following is part of the code:
<div class="col-md-7 col-sm-4 col-xs-12" style="background-image: url('xx.gif'); background-size: cover; background-position: 50% 50%;" id="xx" data-image-url="xx.gif">
Thank you in advance!

A: Welcome to SO. HTML link use the <a> tag with the intended URL in the href property. Wrap your GIF in an <a> tag to make it clickable.


text:
Q: Perl Open: No such file or directory I'm trying to read every text file in a directory into a variable then print the first 100 characters, including line breaks. However, Perl says that the files don't exist even though they really do exist.
use strict;
use warnings;

my $dir = "C:\\SomeFiles";
my @flist;

open(my $fh, "dir /a:-d /b $dir |") || die "$!";

while (<$fh>) {
    if ($_ =~ /.*(.txt)$/i) {
        push(@flist, $_);
    }
}

foreach my $f (@flist) {
    print "$dir\\$f";
    my $txt = do {
        local $/ = undef;
        open(my $ff, "<", "$dir\\$f") || die "$!";
        <$ff>;
    };
    print substr($txt, 0, 100);
}

When I run the script, the following is written to the console:
C:\SomeFiles\file1.txt
No such file or directory at script.pl line 19, <$fh> chunk 10.

It's looking at the right file and I'm certain that the file exists. When I try using this method to open a single file rather than getting each file via an array with foreach, it works just fine. Is there something obvious that I've overlooked here?

A: A better solution is to use readdir() instead (or File::Find if you ever want to do it recursively):
my $dir = "C:\\SomeFiles";

opendir(my $dh, $dir) || die "$!";

while (my $file = readdir($dh)) {
    if ($file =~ /\\.txt$/i) {
        print $file . "\n";
        my $txt = do {
            local $/ = undef;
            open(my $ff, "<", "$dir\\$file") || die "$!";
            <$ff>;
        };
        print substr($txt, 0, 100) . "\n";
    }
}

closedir($dh);


text:
Q: ModuleNotFoundError: No module named 'python_jwt' (Raspberry Pi) I can't import correct Firebase package in Raspberry PI.
My code:
from firebase import firebase
db = firebase.FirebaseApplication("https://xyz.firebaseio.com/", None)

Error:
Traceback (most recent call last):
  File "datastorage.py", line 1, in <module>
    from firebase import firebase
firebase/__init__.py", line 14, in <module>
    import python_jwt as jwt
ModuleNotFoundError: No module named 'python_jwt'

I tried to use this commands and it didn't help:
sudo pip install requests
sudo pip install python-firebase
pip install jwt

I use Python 3.7.3 and Raspbian Buster. All works on my PC but not on RPi 3B+.

A: I used advice from @naive.

pip install python_jwt

After that I solved another errors in that order:
pip install gcloud
pip install sseclient
pip install pycrypto
pip install requests-toolbelt

And now I see that It works. Problem was solved.

A: I think you need  python_jwt instead of jwt. You can do:
pip install python_jwt

A: If you're referring to this library:
https://pyjwt.readthedocs.io/en/latest/
Then you need to install like this:
pip install PyJWT
And afterwards this will work:
import jwt


text:
Q: $1+2+3+\cdots+x > \text{Integral of } x$ Why is $\Sigma_{n=1}^xn$, or $\frac{x^2+x}{2}$,
bigger than $\int x\ \text dx$, even though the integral of $x$ adds up more numbers than $\frac{x^2+x}{2}$ ?

A: This result is apparent from looking at a graph. In the following (rough) picutre, you can see that the blue rectangles have areas $1$ and $2$. The total of their areas is thus $1+2$, while the integral $\int_0^2 x \,dx$ is only the area under the black line, which is less than the area of the combined rectangles.
The sum $1+2+\cdots+n$ is actually equal to the integral $\int_0^n \lceil x\rceil \,dx$, where $\lceil x\rceil$ is the ceiling function, which satisfies $\lceil x\rceil \geq x$ for all $x$.
The sum "adds up" $1$ all the way from $0$ to $1$, while the integral "adds up" mostly numbers smaller than $1$ over that same interval.

A: For one thing, it isn't really meaningful to talk about "how many numbers" the integral is adding. We can think of it as the limit of a sum of increasingly many terms, but the terms are getting smaller and smaller.
But to understand why the sum is bigger than the integral, draw a picture of the two. The sum looks like a staircase, while the integral is a straight line that cuts the corners off the staircase.

A: As @Theophile said, the sum $1+2+3+\cdots+x$ are the rectangles like a 'staircase', while the $x$ is like a smooth slope, as shown in this graph from Desmos.
The integral of $x$, which is $\frac{x^2}{2}$ approximates the slope by adding up infinitely many rectangular 'strips' of infinitely small length. As the number of 'strips' increases, the 'strips' better approximate the smooth slope of $y = x$. Therefore, when we add infinitely many 'strips', the area of $x$ will be exactly the same as $1+2+3+\cdots+$.
However, in this case, the rectangles have a width of $1$. Since the width of the 'strips' is not infinitely small, there will be some extra area between the two functions.


text:
Q: Boost.Log Expressions v1.71 will not compile under C++20 Including the <boost/log/expressions.hpp> header under C++20 (only tested under gcc 10.1), causes a compilation failure:
/celibs/boost_1_71_0/boost/log/attributes/named_scope.hpp:128:29: error: 'reference' in 'boost::log::v2s_mt_posix::attributes::named_scope_list::allocator_type' {aka 'class std::allocator<boost::log::v2s_mt_posix::attributes::named_scope_entry>'} does not name a type

  128 |     typedef allocator_type::reference reference;
      |                             ^~~~~~~~~
...

The code sample used is from Boost's own examples.  Switching to C++17 or Boost v1.73 allows compilation to succeed.  Looking at the Boost.Log v1.73 changelog, there's this entry:

Ported various components of the library to std::allocator_traits to
improve compatibility with C++20 allocators.

The 'improve compatibility with' part implies that there's a way of making it work, does anyone know a workaround?  I'd rather not have to upgrade to v1.73.


text:
Q: Android - Disable (or Hide) Minute selection in TimePicker Dialog
In my project, I am using TimePicker dialog to allow users to select time. But I don't want them to select minutes. So, all I want is to disable (or hide) minute selection.
So, How to do that?

A: I solved my problem by using Material TimePickerDialog Library.
My solution:

public class home extends AppCompatActivity implements TimePickerDialog.OnTimeSetListener, ... {
    ...
    private EditText time;
    private TimePickerDialog timePickerDialog;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_home);
        ...

        timePickerDialog = TimePickerDialog.newInstance(home.this, new Date().getHours(), new Date().getMinutes(), false);
        timePickerDialog.enableMinutes(false);

        time = (EditText) findViewById(R.id.time);
        time.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                timePickerDialog.show(getFragmentManager(), "TimePickerDialog");
            }
        });
    }

    @Override
    public void onTimeSet(TimePickerDialog view, int hourOfDay, int minute, int second) {
        String form;
        if (hourOfDay > 12) {
            hourOfDay = hourOfDay - 12;
            form = "PM";
        } else {
            if (hourOfDay == 0) {
                hourOfDay = 12;
            }
            form = "AM";
        }
        time.setText(String.valueOf(hourOfDay) + " " + form);
    }

    ...
}

A: Without library and simple time picker
time_picker.setIs24HourView(true)
time_picker.currentMinute = 0
time_picker.currentHour = 0
time_picker.findViewById<View>(Resources.getSystem()
       .getIdentifier("hour", "id", "android"))
       .visibility = View.GONE

change id identifier with what you need to hide or show

A: Short answer is that you can't. You'll have to create your own custom dialog.
Long answer is that you might be able to, but you shouldn't.  You could find the id of the view and disable or hide it, but each version and manufacture may use different ids for this dialog so you will run into many issues and bugs.
StackOverflow answer about hiding year

A: This fixed my issue with native time picker component
1. disabling minute selection
2. hiding time separator
3. Disabling transition from hour to a minute when the user selects hours
The code is in kotlin.
// Disbale time picker minutes
time_picker.findViewById<View>(Resources.getSystem()
            .getIdentifier("minutes", "id", "android"))
            .visibility = View.GONE
// Disbale time seperator
time_picker.findViewById<View>(Resources.getSystem()
            .getIdentifier("separator", "id", "android"))
            .visibility = View.INVISIBLE

val delegateField = time_picker.javaClass.getDeclaredField("mDelegate")
delegateField.isAccessible = true;
val autoAdvance = delegateField.get(time_picker)
val autoAdvanceField = autoAdvance.javaClass.getDeclaredField("mAllowAutoAdvance")

autoAdvanceField.isAccessible = true
autoAdvanceField.set(autoAdvance, false)

Output :


text:
Q: Convert java to kotlin on paste So I checked "Don't show this dialog next time", but it turns out that it will then never convert the code again.
Where do I remove the checkmark again so I can get back to converting the java code to kotlin when pasted?
Thanks in advance.
https://developer.android.com/kotlin/get-started.html#convert-to-kotlin-code

A: Preferences -> Editor -> General -> Smart Keys -> Convert pasted Java code to Kotlin (at the end of the page)

A: In my case I needed to have the "Do you want to convert ..." dialog again, despite the option to convert checked.

*

*Preferences -> Editor -> General -> Smart Keys -> Scroll to the end -> Convert posted Java code to Kotlin (checked)

*Preferences -> Editor -> General -> Smart Keys -> Scroll to the end -> Don't show Java to Kotlin conversion dialog on paste (unchecked)

*File -> Invalidate Caches / Restart


text:
Q: How can I relate two entities with ManyToOne? In my pages entity, I added icon via "ManyToOne":
/**
 * @ORM\ManyToOne(targetEntity="App\Entity\Icons", inversedBy="pages")
 * @ORM\JoinColumn(nullable=false)
 */
private $icon;

  public function getIcon(): ?Icons
{
    return $this->icon;
}

public function setIcon(?Icons $icon): self
{
    $this->icon = $icon;
    return $this;
}

But I have problem with this, I get an error message:

An exception occurred while executing 'SELECT t0.id AS id_1,
  t0.unique_id AS unique_id_2, t0.name AS name_3, t0.template AS
  template_4, t0.slug AS slug_5, t0.icon_id AS icon_id_6 FROM pages t0
  WHERE t0.slug = ? LIMIT 1' with params ["pages"]:
SQLSTATE[42S22]: Column not found: 1054 Unknown column 't0.icon_id' in
  'field list'

A: Doctrine will search for column named [relationed_one]_id on relation_many table.
If the relationship of Icon and Page is made by another foreign key that icon_id on pages table you can indicate with @JoinColumn(name="another_foreign_id", referencedColumnName="another_primary_id")
https://www.doctrine-project.org/projects/doctrine-orm/en/2.6/reference/association-mapping.html#one-to-many-bidirectional


text:
Q: SQL query to fast data generation I have created a query to generate some data to sql databases, but generation of 1 GB data takes about 45 minutes. How to increase a performance of data generation?
DECLARE @RowCount INT
DECLARE @RowString VARCHAR(10)
DECLARE @Random INT
DECLARE @Upper INT
DECLARE @Lower INT
DECLARE @InsertDate DATETIME

SET @Lower = -730
SET @Upper = -1
SET @RowCount = 0

WHILE @RowCount < 3000000
BEGIN
 SET @RowString = CAST(@RowCount AS VARCHAR(10))
 SELECT @Random = ROUND(((@Upper - @Lower -1) * RAND() + @Lower), 0)
 SET @InsertDate = DATEADD(dd, @Random, GETDATE())

 INSERT INTO Table_1
  (q
  ,w
  ,e
  ,r
  ,t
  ,y)
 VALUES
  (REPLICATE('0', 10 - DATALENGTH(@RowString)) + @RowString
  , @InsertDate
  ,DATEADD(dd, 1, @InsertDate)
  ,DATEADD(dd, 2, @InsertDate)
  ,DATEADD(dd, 3, @InsertDate)
  ,DATEADD(dd, 4, @InsertDate))

 SET @RowCount = @RowCount + 1
END

A: The problem is you are generating and inserting the data one row at a time.  SQL Server is not designed to work that way.  You need to find a set-based solution.  This worked for me in under 30 seconds:
CREATE TABLE #Table_1 (
    Id INT IDENTITY(1,1)
    , RowString AS REPLICATE('0', 10 - LEN(CAST(Id AS VARCHAR))) + CAST(Id AS VARCHAR)
    , Date1 DATETIME
);

DECLARE @Upper INT = -1;
DECLARE @Lower INT = -730;

INSERT  #Table_1 (Date1)
SELECT  TOP 3000000 DATEADD(dd, ROUND(((@Upper - @Lower -1) * RAND(checksum(newid())) + @Lower), 0), GETDATE())
FROM    (   SELECT  number
            FROM    master..spt_values
            WHERE   TYPE = 'P' AND number <= 2000
        ) a (Number)
        ,(  SELECT  number
            FROM    master..spt_values
            WHERE   TYPE = 'P' AND number <= 2000
        ) b (Number);

Once you have the above data in the #Table_1 temp table, it is a simple matter to insert it into Table_1:
INSERT Table_1 (q,w,e,r,t,y)
SELECT RowString, Date1, Date1 + 1, Date1 + 2, Date1 + 3, Date1 + 4
FROM    #Table_1;

A: You may try following also:
;with seq as (
    select top (3000000) N = row_number() over (order by @@spid) - 1 from sys.all_columns c1, sys.all_columns c2
)
INSERT INTO Table_1 (q, w, e, r, t, y)
select
    right('0000000000' + cast(N as varchar(10)), 10)
    ,p.InsertDate
    ,DATEADD(dd, 1, p.InsertDate)
    ,DATEADD(dd, 2, p.InsertDate)
    ,DATEADD(dd, 3, p.InsertDate)
    ,DATEADD(dd, 4, p.InsertDate)
from seq
    cross apply (select DATEADD(dd, ROUND(((@Upper - @Lower -1) * RAND(checksum(newid())) + @Lower), 0), GETDATE())) p(InsertDate)

A: The biggest bottleneck you have in your sql has to do with logging, as each insert statement generates a log in the transaction log.
Although table variables are normally used in small to medium volumes of data, I think you can use them to your benefit, since they don't participate in transactions, logging or locking...
Here's the appropriate sample code:
--First declare the table variable
DECLARE @TempTable TABLE
(
    q VARCHAR(10),
    w DATETIME,
    e DATETIME,
    r DATETIME,
    t DATETIME,
    y DATETIME
)

...

WHILE @RowCount < 3000000
BEGIN
    ...

    -- Insert each row into the table variable, no logging is generated here
    INSERT INTO @TempTable
    (q
    ,w
    ,e
    ,r
    ,t
    ,y)
    VALUES
    (REPLICATE('0', 10 - DATALENGTH(@RowString)) + @RowString
    , @InsertDate
    ,DATEADD(dd, 1, @InsertDate)
    ,DATEADD(dd, 2, @InsertDate)
    ,DATEADD(dd, 3, @InsertDate)
    ,DATEADD(dd, 4, @InsertDate))

    ...
END

-- Bulk Insert the generated data, again no logging should be generated here
INSERT INTO Table_1 WITH(TABLOCK)
SELECT * FROM @TempTable


text:
Q: How do I add an Electron DMG background image? I have an Electron app which is not displaying the background image in the DMG build.  My package.json (top level) contains:
"pack": "build --dir",
"dist": "build"

My "build" directory does have a valid "background.png" as well.  What else needs to be configured?

A:
Update for PKG build in electron-builder

package.json
  "build": {
    "appId": "com.audio.application",
    "productName": "Audio-App",
    "artifactName": "${productName}-Setup-${version}.${ext}",
    "copyright": "Copyright © 2020 Audio Corp",
    "mac": {
      "category": "com.audio.application",
      "target": [
        "pkg"
      ],
      "icon": "dist",
      "identity": "identity",
      "darkModeSupport": true,
      "hardenedRuntime": true,
      "gatekeeperAssess": false,
      "artifactName": "${productName}.${ext}"
    },
    "pkg": {
      "scripts": "../build/pkg-scripts",
      "installLocation": "/Applications",
      "background": {
        "file": "build/icon/background.png",
        "alignment": "bottomleft"
      },
      "allowAnywhere": true,
      "allowCurrentUserHome": true,
      "allowRootDirectory": true,
      "license": "build/license.html",
      "welcome": "build/resources/welcome.txt",
      "conclusion": "build/resources/conclusion.txt",
      "isVersionChecked": true,
      "isRelocatable": false,
      "overwriteAction": "upgrade"
    },
    "directories": {
      "buildResources": "release",
      "output": "release"
    }
    },

folder structure of build directory -

(which at root level of project)

background ( data-type : PkgBackgroundOptions )

PkgBackgroundOptions

*

*file ( data-type : string )

*alignment ( data-type : BackgroundAlignment | null )

*scaling ( data-type : BackgroundScaling  | null )

BackgroundAlignment

*

*"center" | "left" | "right" | "top" | "bottom" | "topleft" | "topright" | "bottomleft" | "bottomright"

BackgroundScaling

*

*"tofit" | "none" | "proportional"

Reference: pkgOptions

A: The configuration above is correct.  There was a bug at one point in electron-builder that caused the background to not appear if a non-default OS X install folder was configured.


text:
Q: chromedriver crash problem with different project on same machine it might look duplicate issue but could not find a proper solution. so raising here for any suggestion.
I have two projects on same machine with different folder, one is BDD framework and other is TestNG framework. I use the same chromedriver (ChromeDriver 81.0.4044.138) on both framework under '/resources' folder and using that to launch like below.
System.setProperty("webdriver.chrome.driver", "src/test/resources/chromedriver.exe");
ChromeOptions options = new ChromeOptions();
options.setExperimentalOption("useAutomationExtension", false);
WebDriver browser = new ChromeDriver(options);
browser.manage().window().maximize();
browser.manage().deleteAllCookies();

When i run my BDD framework it launches chrome and executes my test. But while running the TestNG framework, it gives below error.
Starting ChromeDriver 81.0.4044.138 (8c6c7ba89cc9453625af54f11fd83179e23450fa-refs/branch-heads/4044@{#999}) on port 5661
Only local connections are allowed.
Please protect ports used by ChromeDriver and related test frameworks to prevent access by malicious code.

org.openqa.selenium.WebDriverException: unknown error: Chrome failed to start: crashed.
  (unknown error: DevToolsActivePort file doesn't exist)
  (The process started from chrome location C:\Program Files (x86)\Google\Chrome\Application\chrome.exe is no longer running, so ChromeDriver is assuming that Chrome has crashed.)
Build info: version: '3.141.59', revision: 'e82be7d358', time: '2018-11-14T08:17:03'
System info: host: '<host>', ip: '<ip>', os.name: 'Windows 10', os.arch: 'amd64', os.version: '10.0', java.version: '1.8.0_251'
Driver info: driver.version: ChromeDriver
remote stacktrace: Backtrace:
    Ordinal0 [0x00355E93+2449043]
    Ordinal0 [0x00288281+1606273]
    Ordinal0 [0x0017F889+522377]

i run my BDD as maven project through mvn clean install command and run the TestNG project as normal right click and run as test class file.
what am i missing here, any help on this please.
Updated with chrome versions.......
Version on BDD project
c:\BDD\Test_Project\src\test\resources\Drivers>chromedriver.exe --version
ChromeDriver 81.0.4044.138 (8c6c7ba89cc9453625af54f11fd83179e23450fa-refs/branch-heads/4044@{#999})

Version in TestNG project
c:\Users\user\Downloads\gca_automation\src\test\resources>chromedriver.exe --version
ChromeDriver 81.0.4044.138 (8c6c7ba89cc9453625af54f11fd83179e23450fa-refs/branch-heads/4044@{#999})

my chrome browser version Version 81.0.4044.129 (Official Build) (64-bit)

A: There needs to be a compatibility between chromedriver and the installed version of chrome.
Check your chrome version and make sure you have the appropriate chromedriver version, you should see recommendations in the official website from where you are downloading chrome
(now https://chromedriver.chromium.org/downloads).

Tip: you could use webdrivermanager from bonigarcia. This is a library that manages the chromedriver automatically for you, it will check chrome version and get the version you need and also set the webdriver.chrome.driver

Also do not run as root.
Update: kill all chrome and chromedriver processes, use File.separator when setting path to the driver e.g. like
System.setProperty("webdriver.chrome.driver", System.getProperty("user.dir") + File.separator + "chromedriver.exe");


text:
Q: Is there something like the Linux free command on Android? I'm porting an Linux C++ application to Android NDK and my app invokes free to the shell to see how much memory is available on the machine for logging purposes.  On my android port this fails with the error:

sh: free: not found

On a Centos v4 Linux machine, I get back a result like this:
             total       used       free     shared    buffers     cached
Mem:       8308648    3904076    4404572          0     454956    1593844
-/+ buffers/cache:    1855276    6453372
Swap:      2031608        208    2031400

Is there something else I can do here to approximate this on Android?

A: It seems like it should work:
StatFs stat = new StatFs(Environment.getExternalStorageDirectory().getPath());
long bytesAvailable = (long)stat.getBlockSize() * (long)stat.getAvailableBlocks();
long megAvailable = bytesAvailable / (1024 * 1024);
Log.e("","Available MB : "+megAvailable);

Source: Android-Droid


text:
Q: React - Failing to give the same state to 2 elements with the same id (card and modal) I am rendering some cards and upon clicking a card, I have the corresponding modal. Both the card and its modal have a heart icon and I want to mark both as "favorite" when either of them is clicked. I have a "favoriteBeers" array, where I want to push the favorite beers. I also have another piece of state named "favorite" and this one is boolean. The issue is that this state seems to be reversed (it is false when it's supposed to be true and the other way around). Also, only one item seems to be in the favorites array, no matter how may items I try to set as favorite.
I have lifted the array state on the root component, this is the piece of code that lies there:
  const [favoriteBeers, setFavoriteBeers] = useState([]);

  const handleSetFavorite = id => {
    setFavoriteBeers([...favoriteBeers, beers.find(beer => beer.id === id)]);
  };

  const handleRemoveFavorite = id => {
    setFavoriteBeers(favoriteBeers.filter(beer => beer.id !== id));

  };

I also have one component for the card, and one for its modal. I have an identical function in both components:
const [isFavorite, setIsFavorite] = useState(false);

 if (!isFavorite) {
        setIsFavorite(true);
        handleSetFavorite(id);
      } else {
        setIsFavorite(false);
        handleRemoveFavorite(id);
      }
    };

//the icon that calls the function
<IconButton aria-label='add to favorites'>
     {!isFavorite ? (
       <FavoriteBorderIcon
          onClickCapture={e => handleIconClick(e, beer.id)}
        />
      ) : (
         <FavoriteIcon onClickCapture={e => handleIconClick(e, beer.id)} />
  )}
</IconButton>

I have also prepared a codesandbox codesandbox with the components, thanks in advance

A: One problem is that in <Home> your isFavorite prop is undefined since <App> isn't passing such a thing. Also you're not using this prop value (currently undefined) to initialize the <BeerCard> or <BeerCardExpanded> components.
Second problem - the code below is only updating a components own isFavorite state and calling handleSetFavorite, since each component has it's own local isFavorite state.
 if (!isFavorite) {
    setIsFavorite(true);
    handleSetFavorite(id);
  }

For example when <BeerCard> flips it's isFavorite state, <BeerCardExpanded> doesn't. So I've removed these local states and directly used props.isFavorite instead.

Here is updated sandbox
I've added this method in <Home>:
const isFavorite = (beer, favoriteBeers) => {
   return favoriteBeers.includes(beer);
};

Which is used to pass proper boolean value for  the same for isFavorite prop of both  <BeerCard> (isFavorite={isFavorite(beer, favoriteBeers)})
And <BeerCardExpanded> (isFavorite={isFavorite(isClicked, favoriteBeers)}) components.

I've used rest params syntax ...props just to avoid renaming isFavorite prop and have minimal changes. You can improvise the whole thing.


text:
Q: Matplotlib Color Mapping with low, medium, and high values I am trying to map values to a colormap. I would like the value of 50 to correspond to red, 75 to correspond to white, 80 correspond to blue; and then values in between be the in between shades.
I'm currently using the below, but the problem is that it doesn't assign a value to the middle white color.
norm = mpl.colors.Normalize(vmin = 50, vmax = 80)
cmap = LienarSegmentedColormap.from_list('Custom', [(181/255,47/255,47/255),(1,1,1),(61/255,152/255,209/255)], N = 240)
m = cm.ScalarMappable(norm = norm, cmap = cmap)
...
color = np.array(m.to_rgba(singlevalue, alpha = None))*255

Any suggestions? Thank you!


text:
Q: Unable to merge Unity 5 into our iOS application We have a large and complicated application and we are looking to upgrade our 3d engine to Unity 5.0. But I am having trouble integrating Unity.
I been trying to follow these tutorials but constant errors keep poping up whatever I do.
http://www.the-nerd.be/2014/09/08/sandbox-unity-app-in-existing-ios-app/
http://www.makethegame.net/unity/add-unity3d-to-native-ios-app-with-unity-5-and-vuforia-4-x/
http://www.markuszancolo.at/2014/05/integrating-unity-into-a-native-ios-app/
If I just add the "Libraries" and the "Classes" folders into my project, I get an odd amount errors. It gets confused with other c code in the project(really doesn't like msgpack) and tries to import the wrong files (ILCPP files). If I remove all offending code from the project I still have a list of errors with the native cstring class.

CompileC
  /Users/jess/Library/Developer/Xcode/DerivedData/CricHQ-bsrxghpplcwahnadlgmwxmzwbxff/Build/Intermediates/CricHQ.build/Debug-iphoneos/CricHQ.build/Objects-normal/armv7/main-5D1DD4E92C87F57A.o
  Classes/Other/main.mm normal armv7 objective-c++
  com.apple.compilers.llvm.clang.1_0.compiler
      cd /Users/jess/Projects/GIT/CricHQ-iPhone
      export LANG=en_US.US-ASCII
      export PATH="/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin:/Applications/Xcode.app/Contents/Developer/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin"
      /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang
  -x objective-c++ -arch armv7 -fmessage-length=0 -fdiagnostics-show-note-include-stack -fmacro-backtrace-limit=0 -std=c++11 -stdlib=libc++ -fobjc-arc -fmodules -fmodules-cache-path=/Users/jess/Library/Developer/Xcode/DerivedData/ModuleCache
  -fmodules-prune-interval=86400 -fmodules-prune-after=345600 -fbuild-session-file=/Users/jess/Library/Developer/Xcode/DerivedData/ModuleCache/Session.modulevalidation
  -fmodules-validate-once-per-build-session -Wno-trigraphs -fpascal-strings -O0 -Werror=incompatible-pointer-types -Wmissing-field-initializers -Wmissing-prototypes -Wno-return-type -Wimplicit-atomic-properties -Wno-receiver-is-weak -Warc-repeated-use-of-weak -Wexplicit-ownership-type -Wimplicit-retain-self -Wno-non-virtual-dtor -Wno-overloaded-virtual -Wexit-time-destructors -Wduplicate-method-match -Wno-missing-braces -Wparentheses -Wswitch -Wno-unused-function -Wno-unused-label -Wno-unused-parameter -Wunused-variable -Wunused-value -Wempty-body -Wuninitialized -Wno-unknown-pragmas -Wno-shadow -Wno-four-char-constants -Wno-conversion -Wno-constant-conversion -Wint-conversion -Wno-bool-conversion -Wenum-conversion -Wassign-enum -Wno-shorten-64-to-32 -Wno-newline-eof -Wno-selector -Wstrict-selector-match -Wno-undeclared-selector -Wdeprecated-implementations -Wc++11-extensions -DDEBUG=1 -DOBJC_OLD_DISPATCH_PROTOTYPES=0 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS8.3.sdk
  -fstrict-aliasing -Wprotocol -Wdeprecated-declarations -Winvalid-offsetof -g -fvisibility=hidden -fvisibility-inlines-hidden -Wno-sign-conversion -miphoneos-version-min=7.0 -I/Users/jess/Library/Developer/Xcode/DerivedData/CricHQ-bsrxghpplcwahnadlgmwxmzwbxff/Build/Intermediates/CricHQ.build/Debug-iphoneos/CricHQ.build/CricHQ\
  Next.hmap
  -I/Users/jess/Library/Developer/Xcode/DerivedData/CricHQ-bsrxghpplcwahnadlgmwxmzwbxff/Build/Products/Debug-iphoneos/include
  -I/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include
  -I/Users/jess/Projects/GIT/CricHQ-iPhone/Libraries -I/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS8.3.sdk/usr/include/libxml2
  -I/Users/jess/Projects/GIT/CricHQ-iPhone/../CricHQ-3d/iOS-export/Classes
  -I/Users/jess/Projects/GIT/CricHQ-iPhone/../CricHQ-3d/iOS-export/Libraries/bdwgc/include
  -I/Users/jess/Projects/GIT/CricHQ-iPhone/../CricHQ-3d/iOS-export/Libraries/libil2cpp/include
  -I/Users/jess/Projects/GIT/CricHQ-iPhone/../CricHQ-3d/iOS-export/Classes/Native
  -I/Users/jess/Projects/GIT/CricHQ-iPhone/Libraries/CricEngine/source -I/Users/jess/Library/Developer/Xcode/DerivedData/CricHQ-bsrxghpplcwahnadlgmwxmzwbxff/Build/Intermediates/CricHQ.build/Debug-iphoneos/CricHQ.build/DerivedSources/armv7
  -I/Users/jess/Library/Developer/Xcode/DerivedData/CricHQ-bsrxghpplcwahnadlgmwxmzwbxff/Build/Intermediates/CricHQ.build/Debug-iphoneos/CricHQ.build/DerivedSources
  -F/Users/jess/Library/Developer/Xcode/DerivedData/CricHQ-bsrxghpplcwahnadlgmwxmzwbxff/Build/Products/Debug-iphoneos
  -F/Users/jess/Projects/GIT/CricHQ-iPhone -mno-thumb -DINIT_SCRIPTING_BACKEND=1 -include /Users/jess/Projects/GIT/CricHQ-iPhone/Classes/Other/CricHQ_Prefix.pch
  -MMD -MT dependencies -MF /Users/jess/Library/Developer/Xcode/DerivedData/CricHQ-bsrxghpplcwahnadlgmwxmzwbxff/Build/Intermediates/CricHQ.build/Debug-iphoneos/CricHQ.build/Objects-normal/armv7/main-5D1DD4E92C87F57A.d
  --serialize-diagnostics /Users/jess/Library/Developer/Xcode/DerivedData/CricHQ-bsrxghpplcwahnadlgmwxmzwbxff/Build/Intermediates/CricHQ.build/Debug-iphoneos/CricHQ.build/Objects-normal/armv7/main-5D1DD4E92C87F57A.dia
  -c /Users/jess/Projects/GIT/CricHQ-iPhone/Classes/Other/main.mm -o /Users/jess/Library/Developer/Xcode/DerivedData/CricHQ-bsrxghpplcwahnadlgmwxmzwbxff/Build/Intermediates/CricHQ.build/Debug-iphoneos/CricHQ.build/Objects-normal/armv7/main-5D1DD4E92C87F57A.o
In file included from :353: In file included from :4: In file included from
  /Users/jess/Projects/GIT/CricHQ-iPhone/Classes/Other/CricHQ_Prefix.pch:6:
  In file included from
  /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS8.3.sdk/System/Library/Frameworks/Foundation.framework/Headers/Foundation.h:6:
  In file included from
  /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS8.3.sdk/System/Library/Frameworks/CoreFoundation.framework/Headers/CoreFoundation.h:18:
  In file included from
  /Users/jess/Projects/GIT/CricHQ-iPhone/Libraries/../../CricHQ-3d/iOS-export/Libraries/libil2cpp/include/os/Locale.h:4:
  In file included from
  /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/string:436:
  /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/cstring:70:9:
  error: no member named 'memcpy' in the global namespace; did you mean
  'wmemcpy'? using ::memcpy;
        ~~^ In file included from :353: In file included from :4: In file included from
  /Users/jess/Projects/GIT/CricHQ-iPhone/Classes/Other/CricHQ_Prefix.pch:6:
  In file included from
  /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS8.3.sdk/System/Library/Frameworks/Foundation.framework/Headers/Foundation.h:6:
  In file included from
  /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS8.3.sdk/System/Library/Frameworks/CoreFoundation.framework/Headers/CoreFoundation.h:18:
  In file included from
  /Users/jess/Projects/GIT/CricHQ-iPhone/Libraries/../../CricHQ-3d/iOS-export/Libraries/libil2cpp/include/os/Locale.h:4:
  In file included from
  /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/string:435:
  In file included from
  /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/iosfwd:90:
  /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS8.3.sdk/usr/include/wchar.h:152:10:
  note: 'wmemcpy' declared here wchar_t *wmemcpy(wchar_t * __restrict,
  const wchar_t * __restrict, size_t);
           ^ In file included from :353: In file included from :4: In file included from
  /Users/jess/Projects/GIT/CricHQ-iPhone/Classes/Other/CricHQ_Prefix.pch:6:
  In file included from
  /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS8.3.sdk/System/Library/Frameworks/Foundation.framework/Headers/Foundation.h:6:
  In file included from
  /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS8.3.sdk/System/Library/Frameworks/CoreFoundation.framework/Headers/CoreFoundation.h:18:
  In file included from
  /Users/jess/Projects/GIT/CricHQ-iPhone/Libraries/../../CricHQ-3d/iOS-export/Libraries/libil2cpp/include/os/Locale.h:4:
  In file included from
  /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/string:436:
  /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/cstring:71:9:
  error: no member named 'memmove' in the global namespace; did you mean
  'wmemmove'? using ::memmove;
        ~~^ In file included from :353: In file included from :4: In file included from
  /Users/jess/Projects/GIT/CricHQ-iPhone/Classes/Other/CricHQ_Prefix.pch:6:
  In file included from
  /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS8.3.sdk/System/Library/Frameworks/Foundation.framework/Headers/Foundation.h:6:
  In file included from
  /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS8.3.sdk/System/Library/Frameworks/CoreFoundation.framework/Headers/CoreFoundation.h:18:
  In file included from
  /Users/jess/Projects/GIT/CricHQ-iPhone/Libraries/../../CricHQ-3d/iOS-export/Libraries/libil2cpp/include/os/Locale.h:4:
  In file included from
  /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/string:435:
  In file included from
  /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/iosfwd:90:
  /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS8.3.sdk/usr/include/wchar.h:153:10:
  note: 'wmemmove' declared here wchar_t *wmemmove(wchar_t *, const
  wchar_t *, size_t);
           ^ In file included from :353: In file included from :4: In file included from
  /Users/jess/Projects/GIT/CricHQ-iPhone/Classes/Other/CricHQ_Prefix.pch:6:
  In file included from
  /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS8.3.sdk/System/Library/Frameworks/Foundation.framework/Headers/Foundation.h:6:
  In file included from
  /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS8.3.sdk/System/Library/Frameworks/CoreFoundation.framework/Headers/CoreFoundation.h:18:
  In file included from
  /Users/jess/Projects/GIT/CricHQ-iPhone/Libraries/../../CricHQ-3d/iOS-export/Libraries/libil2cpp/include/os/Locale.h:4:
  In file included from
  /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/string:436:
  /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/cstring:72:9:
  error: no member named 'strcpy' in the global namespace using
  ::strcpy;
        ~~^ /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/cstring:73:9:
  error: no member named 'strncpy' in the global namespace using
  ::strncpy;
        ~~^ /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/cstring:74:9:
  error: no member named 'strcat' in the global namespace using
  ::strcat;
        ~~^ /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/cstring:75:9:
  error: no member named 'strncat' in the global namespace using
  ::strncat;
        ~~^ /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/cstring:76:9:
  error: no member named 'memcmp' in the global namespace; did you mean
  'wmemcmp'? using ::memcmp;
        ~~^ In file included from :353: In file included from :4: In file included from
  /Users/jess/Projects/GIT/CricHQ-iPhone/Classes/Other/CricHQ_Prefix.pch:6:
  In file included from
  /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS8.3.sdk/System/Library/Frameworks/Foundation.framework/Headers/Foundation.h:6:
  In file included from
  /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS8.3.sdk/System/Library/Frameworks/CoreFoundation.framework/Headers/CoreFoundation.h:18:
  In file included from
  /Users/jess/Projects/GIT/CricHQ-iPhone/Libraries/../../CricHQ-3d/iOS-export/Libraries/libil2cpp/include/os/Locale.h:4:
  In file included from
  /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/string:435:
  In file included from
  /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/iosfwd:90:
  /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS8.3.sdk/usr/include/wchar.h:151:5:
  note: 'wmemcmp' declared here int     wmemcmp(const wchar_t *, const
  wchar_t *, size_t);
          ^ In file included from :353: In file included from :4: In file included from
  /Users/jess/Projects/GIT/CricHQ-iPhone/Classes/Other/CricHQ_Prefix.pch:6:
  In file included from
  /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS8.3.sdk/System/Library/Frameworks/Foundation.framework/Headers/Foundation.h:6:
  In file included from
  /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS8.3.sdk/System/Library/Frameworks/CoreFoundation.framework/Headers/CoreFoundation.h:18:
  In file included from
  /Users/jess/Projects/GIT/CricHQ-iPhone/Libraries/../../CricHQ-3d/iOS-export/Libraries/libil2cpp/include/os/Locale.h:4:
  In file included from
  /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/string:436:
  /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/cstring:77:9:
  error: no member named 'strcmp' in the global namespace using
  ::strcmp;
        ~~^ /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/cstring:78:9:
  error: no member named 'strncmp' in the global namespace using
  ::strncmp;
        ~~^ /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/cstring:79:9:
  error: no member named 'strcoll' in the global namespace; did you mean
  'strtoll'? using ::strcoll;
        ~~^ In file included from :353: In file included from :4: In file included from
  /Users/jess/Projects/GIT/CricHQ-iPhone/Classes/Other/CricHQ_Prefix.pch:6:
  In file included from
  /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS8.3.sdk/System/Library/Frameworks/Foundation.framework/Headers/Foundation.h:6:
  In file included from
  /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS8.3.sdk/System/Library/Frameworks/CoreFoundation.framework/Headers/CoreFoundation.h:13:
  In file included from
  /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS8.3.sdk/usr/include/assert.h:44:
  /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS8.3.sdk/usr/include/stdlib.h:169:3:
  note: 'strtoll' declared here
           strtoll(const char *, char **, int);
           ^ In file included from :353: In file included from :4: In file included from
  /Users/jess/Projects/GIT/CricHQ-iPhone/Classes/Other/CricHQ_Prefix.pch:6:
  In file included from
  /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS8.3.sdk/System/Library/Frameworks/Foundation.framework/Headers/Foundation.h:6:
  In file included from
  /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS8.3.sdk/System/Library/Frameworks/CoreFoundation.framework/Headers/CoreFoundation.h:18:
  In file included from
  /Users/jess/Projects/GIT/CricHQ-iPhone/Libraries/../../CricHQ-3d/iOS-export/Libraries/libil2cpp/include/os/Locale.h:4:
  In file included from
  /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/string:436:
  /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/cstring:80:9:
  error: no member named 'strxfrm' in the global namespace using
  ::strxfrm;
        ~~^ /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/cstring:82:9:
  error: no member named 'memchr' in the global namespace; did you mean
  'wmemchr'? using ::memchr;
        ~~^ In file included from :353: In file included from :4: In file included from
  /Users/jess/Projects/GIT/CricHQ-iPhone/Classes/Other/CricHQ_Prefix.pch:6:
  In file included from
  /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS8.3.sdk/System/Library/Frameworks/Foundation.framework/Headers/Foundation.h:6:
  In file included from
  /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS8.3.sdk/System/Library/Frameworks/CoreFoundation.framework/Headers/CoreFoundation.h:18:
  In file included from
  /Users/jess/Projects/GIT/CricHQ-iPhone/Libraries/../../CricHQ-3d/iOS-export/Libraries/libil2cpp/include/os/Locale.h:4:
  In file included from
  /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/string:435:
  In file included from
  /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/iosfwd:90:
  /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS8.3.sdk/usr/include/wchar.h:150:10:
  note: 'wmemchr' declared here wchar_t *wmemchr(const wchar_t ,
  wchar_t, size_t);
           ^ In file included from :353: In file included from :4: In file included from
  /Users/jess/Projects/GIT/CricHQ-iPhone/Classes/Other/CricHQ_Prefix.pch:6:
  In file included from
  /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS8.3.sdk/System/Library/Frameworks/Foundation.framework/Headers/Foundation.h:6:
  In file included from
  /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS8.3.sdk/System/Library/Frameworks/CoreFoundation.framework/Headers/CoreFoundation.h:18:
  In file included from
  /Users/jess/Projects/GIT/CricHQ-iPhone/Libraries/../../CricHQ-3d/iOS-export/Libraries/libil2cpp/include/os/Locale.h:4:
  In file included from
  /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/string:436:
  /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/cstring:84:9:
  error: no member named 'strchr' in the global namespace using
  ::strchr;
        ~~^ /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/cstring:86:9:
  error: no member named 'strcspn' in the global namespace using
  ::strcspn;
        ~~^ /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/cstring:88:9:
  error: no member named 'strpbrk' in the global namespace using
  ::strpbrk;
        ~~^ /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/cstring:90:9:
  error: no member named 'strrchr' in the global namespace using
  ::strrchr;
        ~~^ /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/cstring:92:9:
  error: no member named 'strspn' in the global namespace using
  ::strspn;
        ~~^ /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/cstring:94:9:
  error: no member named 'strstr' in the global namespace using
  ::strstr;
        ~~^ /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/cstring:98:87:
  error: no member named 'strchr' in the global namespace; did you mean
  simply 'strchr'? inline _LIBCPP_INLINE_VISIBILITY       char strchr(
  char* __s, int __c) {return ::strchr(__s, __c);}
                                                                                ^~
  /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/cstring:98:46:
  note: 'strchr' declared here inline _LIBCPP_INLINE_VISIBILITY
  char* strchr(      char* __s, int __c) {return ::strchr(__s, __c);}

Screenshot:

Anyone know of a solution? Any help in this matter would be great as I'm totally stuck on what I should try next.
Edit: A plain project worked, so that is a start. Sounds like one of libraries is interfering maybe. The code base is large so need help narrowing the issue down.
Edit 2: Updated to Unity 5.1, xcode 7 beta, clean, deleted the DerivedData folder and still no change.
Once I added "-ferror-limit=1000" then I saw 999+ errors instead of 30.
Common errors:
"Declaration conflicts with target of using declaration already in scope".
"Call to 'X' is ambiguous" (cos, exp, ceil)
"Could not build module 'X'" (Foundation, Darwin)
"No member named 'X" in namespace" (memset, memcpy, memmove)
"Use of undeclared identifier 'x'" (strdup)
"Expected ';' after top level declarator"
Edit 3:
I solve the errors by setting "Always Search User Paths" to "No" in the XCode project settings.
But I'm having a few other issues.
Unity is still using CPU when I pause it. Is there anyway to solve this? I am calling Unity's "applicationDidBecomeActive" method. I also tried just calling "UnityPause".
Calling Unity's "GetAppController()" in my own code causes this error:

Undefined symbols for architecture armv7:
"_GetAppController", referenced from:
-[Test3d viewDidDisappear:] in Test3d.o
  ld: symbol(s) not found for architecture armv7

A: I dont have enough reputation here to comment, so i write it as an answer:
After 3 Edits i am not sure what problems are still left...
GetAppController is an inline function in UnityAppController.h If it isnt linked to you project, you probably didnt include the file (but instead only declared GetAppController() somewhere yourself).
The other errors looks like you have conflicts with the basic c-libs. Is your other code using the c++ std lib? and if yes, which one? Which one is stated in Your BuildSettings under "C++ Standard Library"? It should be libc++
The "Solution" to switch "Always Search User Paths" to "No" sounds even more like a problem with other included projects.

A: Most of my answers are in the question. The core solution was setting "Always Search User Paths" to "No" in the XCode project settings.
As for the last edit, I believe they are bugs. I don't use GetAppController, instead I have my own method. I have reported the CPU issue, it isn't a major problem as it is only ~3% on phones and ipads.

A: I've this problem too recently trying to integrate my Unity 5 project into an existing iOS project.
How I managed to integrate is
1) Drag Class and Libraries files from your Unity project into your iOS project. Same like the tutorial from the-nerd. Uncheck copy items, and select create group radio box.
2) Update your Header Search Path and Library Search Path under Build Settings. The folders should point to your Unity project folder.
Header Search Path -> Unity's Classes folder
Library Search Path -> Unity's Library folder
This part is really important, it made me solve those errors.
3) Under Build Phases, remember to create a run script and make sure the script points to the correct path in Unity's Data folder.
rm -rf "$TARGET_BUILD_DIR/$PRODUCT_NAME.app/Data"
cp -Rf "$PROJECT_DIR/../CHANGE THIS TO YOU PATH/Data" "$TARGET_BUILD_DIR/$PRODUCT_NAME.app/Data"

4) Compare the Build Settings from the Unity's project and your current iOS project. Make sure you select the correct C++ and C compiler. Your iOS project should match the one of Unity. Also the Linker Flag have to be in the correct order.
-weak_framework
CoreMotion
-weak-lSystem

That is all I did to make my iOS project compile with the Unity project I have. I hope it helps.


text:
Q: Angularfire $add().then() returns oddly formated object I'm using AngularJS and Firebase and AngularFire.
The following code is giving me trouble:
images.$add(imageUpload).then(function(ref) {
            console.log(ref);
        });

I've used similar code elsewhere, which works just fine, but here I get objects that look like this returned:
H {n: be, path: J, Ca: undefined, da: undefined, va: undefined…}
Aa: undefined
Ca: undefined
Ra: undefined
da: undefined
n: be
path: J
va: undefined
__proto__: c

I've tried messing around to discover what I'm doing wrong, but with no luck. I'm assuming I'm doing something relatively simple wrong?
I've fiddled around with it and discovered that they key of the newly created data, which is what I'm looking for, is actually stored under path/m. So it seems like the data returned is simply just being formatted oddly?
By using:
console.log(ref.path.m[1]);

I can get what I would have expected to find calling
console.log(ref.name);

Any help is much appreciated.

A: Name is a function and not a key in the data. So to get the id back you must call:
console.log(ref.name());

rather than:
console.log(ref.name);