text:
Q: Creating a website-popup in Node-RED Dashboard I'm creating an Interactive Floor Plan using Node-RED (with Dashboard and "node-red-contrib-ui-svg"
My problem: I want a Website-popup in the Node-RED Dashboard by clicking on an information icon but i don't know how to create the popup. I tryed it with the "http in", "http request", "http response" and function nodes, but it didn't work. Maybe i just don't get the payload right?
By clicking on the SVG, a event is starting and the SVG Node sends a payload to the output.
Later there should be multiple events with different SVGs opening different URL-popups
Does someone know, if it is possible to create a popup in the Node-RED Dashboard and if yes, tell me how i can do it?
Here is a small example flow of what i tried:
[
{
    "id": "213370b.a1a7e9",
    "type": "tab",
    "label": "Floorplan",
    "disabled": false,
    "info": ""
},
{
    "id": "3a8acfc1.2d033",
    "type": "debug",
    "z": "213370b.a1a7e9",
    "name": "",
    "active": true,
    "tosidebar": true,
    "console": false,
    "tostatus": false,
    "complete": "true",
    "targetType": "full",
    "x": 570,
    "y": 100,
    "wires": []
},
{
    "id": "3d085e29.713452",
    "type": "http in",
    "z": "213370b.a1a7e9",
    "name": "googl",
    "url": "svg",
    "method": "get",
    "upload": false,
    "swaggerDoc": "",
    "x": 90,
    "y": 100,
    "wires": [
        [
            "3e9f0610.1b40da"
        ]
    ]
},
{
    "id": "7e8c6b26.c6b194",
    "type": "http response",
    "z": "213370b.a1a7e9",
    "name": "",
    "statusCode": "",
    "headers": {},
    "x": 570,
    "y": 60,
    "wires": []
},
{
    "id": "e6a43abb.2208c8",
    "type": "function",
    "z": "213370b.a1a7e9",
    "name": "",
    "func": "msg.responseUrl=msg.payload;\nmsg.payload=msg.payload\n\n\nreturn msg;",
    "outputs": 1,
    "noerr": 0,
    "x": 450,
    "y": 80,
    "wires": [
        [
            "7e8c6b26.c6b194",
            "3a8acfc1.2d033"
        ]
    ]
},
{
    "id": "3e9f0610.1b40da",
    "type": "http request",
    "z": "213370b.a1a7e9",
    "name": "",
    "method": "GET",
    "ret": "txt",
    "paytoqs": false,
    "url": "nodered.org",
    "tls": "",
    "persist": false,
    "proxy": "",
    "authType": "",
    "x": 270,
    "y": 100,
    "wires": [
        [
            "e6a43abb.2208c8"
        ]
    ]
},
{
    "id": "2360d5fd.e4dc9a",
    "type": "ui_svg_graphics",
    "z": "213370b.a1a7e9",
    "group": "ff128f4a.e252",
    "order": 1,
    "width": 0,
    "height": 0,
    "svgString": "<svg xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\" x=\"0\" y=\"0\" height=\"100\" viewBox=\"0 0 100 100\" width=\"100\"><rect id=\"svgEditorBackground\" x=\"0\" y=\"0\" width=\"100\" height=\"100\" style=\"fill:none; stroke: none;\"/><defs id=\"svgEditorDefs\"><symbol id=\"2139\" viewBox=\"0 0 64 64\" preserveAspectRatio=\"xMidYMid meet\"><rect x=\"0\" y=\"0\" width=\"64\" height=\"64\" style=\"stroke:none;fill:none;\"/><g xmlns=\"http://www.w3.org/2000/svg\"><circle cx=\"32\" cy=\"32\" fill=\"#42ade2\" r=\"30\"/><g fill=\"#fff\"><path d=\"m36.51 25h-6.992c-2.633 0-5.145 1.05-5.584 2.333-.436 1.284.447 2.334 1.965 2.334s2.072 2.02 1.23 4.492l-4.889 14.349c-.844 2.471.619 4.492 3.252 4.492h6.992c2.633 0 5.143-1.051 5.582-2.333.436-1.283-.447-2.335-1.963-2.335-1.518 0-2.072-2.02-1.23-4.491l4.889-14.349c.843-2.47-.619-4.492-3.252-4.492\"/><path d=\"m36.29 11c-2.666 0-5.406 2.238-6.121 5-.717 2.761.869 4.999 3.533 4.999 2.668 0 5.408-2.238 6.123-4.999.717-2.763-.867-5-3.535-5\"/></g></g></symbol><polygon id=\"svgEditorIconDefs\" style=\"fill:rosybrown;\"/></defs><use xlink:href=\"#2139\" x=\"4.410\" y=\"4.552\" width=\"19.061\" height=\"19.061\" id=\"svg_i\" transform=\"matrix(1.87014 0 0 1.87014 -2.59955 -2.72311)\"/></svg>",
    "clickableShapes": [
        {
            "targetId": "#svg_i",
            "action": "click",
            "payload": "http://www.google.com",
            "payloadType": "str",
            "topic": "#svg_i"
        }
    ],
    "smilAnimations": [],
    "bindings": [],
    "showCoordinates": false,
    "autoFormatAfterEdit": false,
    "showBrowserErrors": false,
    "outputField": "payload",
    "editorUrl": "//drawsvg.org/drawsvg.html",
    "directory": "",
    "panning": "disabled",
    "zooming": "disabled",
    "panOnlyWhenZoomed": false,
    "doubleClickZoomEnabled": false,
    "mouseWheelZoomEnabled": false,
    "name": "",
    "x": 120,
    "y": 60,
    "wires": [
        [
            "e6a43abb.2208c8"
        ]
    ]
},
{
    "id": "ff128f4a.e252",
    "type": "ui_group",
    "z": "",
    "name": "SVG",
    "tab": "9f9846f6.57ce98",
    "order": 1,
    "disp": true,
    "width": "23",
    "collapse": false
},
{
    "id": "9f9846f6.57ce98",
    "type": "ui_tab",
    "z": "",
    "name": "Background",
    "icon": "dashboard",
    "disabled": false,
    "hidden": false
}
]

A: If you are still searching a solution, "modal dialog" is what you are looking for. Try this:
https://discourse.nodered.org/t/how-to-show-modal-dialog-in-template-node/611/8


text:
Q: Use of C or C++ APIs in C# Application I have small doubt regarding windows mobile development   ,is it possible to use c or C++ Apis in C# application and Vice versa ??. If it is possible how it has to be done ??

A: When I first started using the P/Invoke mechanism, i found looking at examples really helpfull. Turns out that "P/Invoking" a lot of the Win32 C-API functions is described on pinvoke.net

A: You can use "normal" C-APIs through so called P/Invoke calls ("Platform Invoke"). This includes both the Windows API and other libraries that export normal function calls. I do not know about C++ DLLs that return objects, however. This might be harder...?
On Windows, you can always create your .NET DLL in a way that it can be registered as COM library. Then you can use the exposed .NET classes like any other COM object from any language that supports the use of COM objects (e.g. VB6, Delphi, C++, etc.).
That, however, does not seem to work in Windows Mobile!
So:
Use C-APIs from C# on any platform - yes, no problem, learn how to P/Invoke
Use C# DLLs from C++ on Windows - yes, need to create COM objects
Use C# DLLs from C++ on Windows Mobile - AFAIK that does not work

A: If you have a native DLL with exported C functions, you can easily use them via P/Invoke mechanism.
C++ classes, however, are rather difficult and error prone to use from C++. For this, you would be much better off writing a managed assembly wrapper in C++/CLI. This will produce a .NET assembly which you can use from C#, and you will be able to use C++ libraries just as you would from a regular C++ project.

A: C is very easy, C++ is more complicated due mangling. Read this description.

redpajama_set_name: RedPajamaStackExchange


text:
Q: Prism's Region Manager keeps objects alive I am working on a WPF project. It uses the Prism's IOC container, RegionManager and EventAggregator.
I bind the views and view models with the autowire feature of Prism. So I navigate just with RegionName and view as below
    _regionManager.RequestNavigate(
                RegionName,
                NameOf(ParentContentView))

ParentContentView has 3 different child controls which comminucate with each others by using EventAggregator feature of the Prism.
The program tries to load this ParentContentView from scratch every time.
ParentContentView has been registered to the our IOC as below
           builder.
            RegisterTypeForNavigation(Of ParentContentView)(
                Nameof(ParentContentView))

After leaving this ParentContentView by using regionmanager.RequestNavigate() method the ParentContentView is still alive. I inspected it on dotMemory application of JetBrains.
Every open and leave operation adds an object to the memory. For  example if I open and close ParentContentView 4 times then object counts of ParentContentView will be 4. In a somehow prism keeps it alive.
I implemented IRegionMemberLifetime in View code behind and the code as below
public partial class ParentContentView : IRegionMemberLifetime
{
    public ParentContentView()
    {
        InitializeComponent();
    }

    public bool KeepAlive
        => false;
}

I debugged the code and it really hits KeepAlive property but it did not solve the problem.
I also tried to remove the event references of child objects. I also unsubscribe the eventaggregator events. none of them did not work for me.
Any help would be appreciated.

A: Prism doesn't care forIDisposable on view models and leaves everything to the garbage collector by default.
You can look up which references exactly keep your objects alive (are they really kept alive or is the garbage collector just lazy because there's no pressure?), but it may be easier to make the view model IDisposable and use a region behavior to dispose them when they aren't needed anymore (see this issue).

A: You can try to implement the INavigationAware interface by PRISM and see if that solves your problem. This will provide you with three methods, but the method of interest is the IsNavigationTarget method
IsNavigationTarget(NavigationContext navigationContext)
{
}

If you return false, it will create a new instance of the View when you Navigate to it again.
If you return true, it will reuse the existing View when you Navigate to it. This is useful if you want to retain any information which has been filled in the View.


text:
Q: Divergent products. My question are about divergent products.
I'm a Dutch student so i may lack the skil to write it down in the correct notation and forgive my spelling errors.
A thing i've found on the internet was that $$\frac{\sqrt{2 \pi}}{\Gamma(n)} = \prod_{c=0}^{\infty} (c+n) $$
according to my own numerical foundings should be true but i've been unable to find these results anywhere nor the logic so i'm hoping someone could point out to me where to look. I rewrite the product as sums and calculate them the "normal" way for diveregent sums.
only for positive n
(1)$$n!= (n/e)^n  \sqrt{2n\pi}  \prod_{c=1}^{\infty}(1-c/n)$$
(2)$$n!\prod_{c=1}^{\infty}(n+c)=(n/e)^n  \sqrt{2\pi}  $$
And if i continue with my logic i get:
(3)$$\prod_{c=1}^{\infty}(1-c/n) \prod_{c=1}^{\infty}(1+c/n)=1$$
(4)$$\prod_{c=1}^{\infty}( 1+\frac{-c^2+c-n-1}{(n+1)^2})=\frac{e}{((n+1)/n)^n}$$
Is there someone who can explain of point out if i'm wrong or right and where i make the mistake.
So to sum it up, I simpely split the product into sums and calculate it that way. I've calculate the first/second statement numericaly but I've been unable to calculate the 4th yet i was able to check the points as n tends to infinity and 0. Yet i wonder if this is correct and what is the difference with the form at the beginning.
I'm awere that this first formula can be writing more detailed if you also wish to make it fit on the negative side, but i don't know exactly how, I would be eager to know.
Edit:
Because it raised some questions here i analyse the first product
$$\prod_{c=1}^{\infty}(1-c/n)=$$
$$1+\sum_{c=1}^{\infty}-c/n + $$
$$1/2!((\sum_{c=1}^{\infty}-c/n)^2-\sum_{c=1}^{\infty}(-c/n)^2)+$$
$$1/3!((\sum_{c=1}^{\infty}-c/n)^3-3*(\sum_{c=1}^{\infty}-c/n)*\sum_{c=1}^{\infty}(-c/n)^2+2*\sum_{c=1}^{\infty}(-c/n)^3)+ ...$$
The pattern i've posted before but it's the refined stirling numbers etc. just how one would look to a convergent product and or write a factorial as polynomal.
But in this case =
$$\prod_{c=1}^{\infty}(1-c/n)=1-1/(-12n)+1/(2*(-12n)^2)-1/6*(1/(-12n)^3+2*1/(120*n^3))+...$$
To calculate these negative values of the zeta function i've my own way, but again i'm terrible at the notation and i'm sure there are errors in it, but the idea is the following:
For every d>1, most easy is d=2, I take the constant part of the left handed side, and i try to isolate the sum i'm looking for in the right handed part.
$$\sum_{n=1}^{dp} f(n)\sum_{k=1}^{d-1} (e^{\frac{2i\pi k}{d}})^{n}=\sum^p_{n=1} (d f(nd)-f(n))$$
But please ignore this, cause it's so wrong formulated a whole story on it's own, and not the topic now, cause i can find similair results on the web which conform my results,  it's only for me a way to find the zeta values which are essential here.

A: In the equation $\frac{\sqrt{2 \pi}}{\Gamma(n)} = \prod_{c=0}^{\infty} (c+n)$, the right-hand side may be interpreted as a zeta-regularized product. Then by definition, we have $$\prod_{c=0}^{\infty} (c+n)=\exp(-Z'(0))$$ where $Z(s)$ is the function defined by $$Z(s)=\sum_{c=0}^\infty(c+n)^{-s}$$
for $s$ with large enough real part, and by analytic continuation as necessary. The rest of the computation is given in Example 3 on p.220 of J. R. Quine, S. H. Heydari and R. Y. Song (1993),  Zeta regularized products.


text:
Q: Auto Login after register Can someone help me with auto register after login please, Here is my register script...
if (empty($_POST) === false) {
$required_fields = array ('email', 'username', 'password', 'password_again', 'first_name', 'last_name');
foreach ($_POST as $key=>$value) {
    if (empty($value) && in_array($key, $required_fields) === true) {
        $errors [] = 'ALL fields MUST be filled out correctly';
        break 1;
    }
}

    if (empty($errors) === true) {
    if (user_exists($_POST['email']) === true) {
        $errors [] = 'Sorry, the email \'' . $_POST['email'] . '\' is already in use.';
    }
            if (preg_match("/\\s/", $_POST['email']) == true) {
            $errors[] = 'Your email must not contain any spaces';

    }
            if (user_exists($_POST['username']) === true) {
        $errors [] = 'Sorry, the username \'' . $_POST['username'] . '\' is already in use.';
    }
    if (preg_match("/\\s/", $_POST['username']) == true) {
            $errors[] = 'Your username must not contain any spaces';

    }
    if (strlen($_POST['password']) < 6)  {
    $errors[] = 'Your password must be in between 6-24 characters long';
    }
    if ($_POST['password'] !== $_POST ['password_again']) {
        $errors[] = 'Your passwords did not match';
    }

}
}
?>

This code only registers the user and I want it to login aswell, Can you not rate this badly please

A: End of your registration script
//include your login validation
if(empty($errors)){
   //User->login(); or anything you use for validating logins
}

A: To perform logins you generally will need to create a cookie for the user (using PHP's setcookie function) and initialize the session variables that hold their user data (like their username).
This link will show you how to use setcookie() http://php.net/setcookie
As for session variables, they can be set arbitrarily like this:
$_SESSION['username'] = "Admin";
Creating a secure login script takes some time, so I would suggest working with forms already out there and just adapt them to your needs. For it to be truly secure, you need to do rigorous sanity checks for database input, secure login and form posting using checksums, and a lot of other factors to account for.


text:
Q: why does the optimizer choose the higher cost execution plan? This is a re-occuring Problem for me. I have statements that work well for a while and after a while the optimizer decides to choose another execution plan. This even happens for when I query for exactly one (composite) primary key.
When I look up the execution plan in dba_hist_sql_plan, it shows me costs of 20 for the query using the primary key index and costs of 270 for the query doing a full table scan.
plan_hash_value Operation        Options              Cost  Search_Columns

2550672280  0   SELECT STATEMENT                       20
2550672280  1   PARTITION HASH   SINGLE                20
2550672280  2   TABLE ACCESS     BY LOCAL INDEX ROWID  20
2550672280  3   INDEX            RANGE SCAN            19                1

3908080950  0   SELECT STATEMENT                      270
3908080950  1   PARTITION HASH  SINGLE                270
3908080950  2   TABLE ACCESS    FULL                  270

I already noticed that the optimizer only uses the first column in the Primary key index and then does a range scan. But my real question is: Why does the optimizer choose the higher cost execution plan? It's not that both executions plans are used at the same time, I notice a switch within one snapshot and then it stays like that for several hours/days. So it can't be an issue of bind peeking.
Our current solution is that I call our DBA and he flushes the Statement Cache. But this is not really sustainable.
EDIT:
The SQL looks something like this: select * from X where X.id1 = ? and X.id2 = ? and X.id3 = ?
with (id1,id2,id3) being the composite primary key (with a unique index) on the table.

A: Maybe it's related to one bug on Oracle 11g.
Bug 18377553 : POOR CARDINALITY ESTIMATE WITH HISTOGRAMS AND VALUES > 32 BYTES
When your data is like :
AAAAAAAAAAAAAAAAAAAAmyvalue
AAAAAAAAAAAAAAAAAAAAsomeohtervalue
AAAAAAAAAAAAAAAAAAAAandsoon
B1234

Histograms do not work well.
The solution is disabling histograms on primary key and all will start working smoothly.

A: Most likely clustering factor and blevel of the index could be very high. Check the blevel by querying dba_indexes. If blevel is greater than 3 try rebuilding the index.
Also check whether the index created for primary key is unique or not. As per the plan it is using range scan instead of unique scan. Most likely the index is not unique.

A: Apparently the optimizer doesn't correctly display costs regarding type conversions. The root cause for this Problem was incorrect type mapping for a date value. While the column in the database is of type DATE, the JDBC type was incorrectly java.sql.Timestamp. To compare a DATE column with a Timestamp search parameter, all values in the table need to be transferred to Timestamp first. Which is additional cost and renders an index unusable.


text:
Q: Code not working on JS Fiddle So I'm trying to showcase an issue I have in an application by providing a JS Fiddle, but now I have  an xtra problem, my code won't work on JS Fiddle!
Basically when you click and drag in the Canvas area (the one with the dashed border) you should be able to create rectangles, but none of that happens.
Fiddle here
I've used jsfiddle only a handful of times so I might be getting it wrong, but since I'm including many external libs (underscore, backbone, marionette, jquery-ui) I can't really pinpoint where things are going wrong. I based the fiddle on Derick Bailey's "Marionette Playground"
and searched for common jsfiddle errors (tried the "no wrap body" but still nothing)
maybe is because I only use a script/template tag on my HTML?
<script id="app-tpl" type="text/template">
    <header id="mainmenu">
        this is a header
    </header>
    <section id="workspace">
    </section>
</script>

Any help would be apprectiated.

A: You just need to apply css height 100% to the screen element.
In this case I also recommend disabling selection with user-select. Check this:
http://css-tricks.com/almanac/properties/u/user-select/


text:
Q: Redirect to Action is not working With ASP.NET core I have my login view which wants to redirect to Clients page after successful login.
To do that I am using ,
[HttpPost]
        public async Task<IActionResult> Login(LoginViewModel model)
        {
            if (ModelState.IsValid)
            {
                var result = await _signInManager.PasswordSignInAsync(model.Username, model.Password, model.Rememberme, false);

                if (result.Succeeded)
                {

                    if (Request.Query.Keys.Contains("ReturnUrl"))
                    {
                        Redirect(Request.Query["ReturnUrl"].First());
                    }
                    RedirectToAction("Index", "Clients");
                }
                else
                {
                    ModelState.AddModelError("", "Failed to login");
                    return View();
                }
            }

            return View();

        }

But after successful login , I am staying in current login page and not redirected to Client Page!! If I try to navigate to Client page using browser this works fine without any issue.

A: You need to return method result, just add return to all redirect methods:
return RedirectToAction("Index", "Clients");

Redirect methods are returnig view, to show this view You need to return it.
More info about IActionResult


text:
Q: Can I quickly charge supercapacitors with a power adapter? I am trying to make a super capacitor bank that I can charge is a couple minutes.  It will output a 5V USB charge (aka a power bank.)
My materials: a 15V 8A power adapter, 2 Maxwell 2.7V 3000F supercapacitors, a high power buck converter and small circuit boards to produce the 5V USB.
I was wondering if it was safe to connect 15V to the buck converter, step it down to close to 5.2V and connect the buck converter directly to the capacitor.
I DID do some experiments with the power adapter and it seems that it has a short circuit protection as when I short the leads, it cuts off, then a couple seconds later it comes back on which repeats again and again. What will happen if I connect the capacitors? Any ideas of what I can do with it?

A: You don't want to put caps in series without parallel balancing resistors because otherwise you can never be sure how the voltage between the caps is split up — it would depend on ESR and ESL variance.
For your supercaps, it's worse. You are only 0.2V away from blasting the things, and the currents are so high your balancing resistors had to be very low-ohmic to have any effect. That would be a huge waste of energy.
Do yourself a favour and get a 2.5V converter.

A: Why can't you read the specs?
http://www.maxwell.com/images/documents/K2_3V_DS_3001423_EN_1.pdf

*

*Maximum ESR_DC, initial, rated value 0.27 mΩ

*Leakage Current at 25°C, maximum 12 mA

*Absolute Maximum Voltage 3.25 V

*Absolute Maximum Current 2,200 A

*Maximum Continuous Current (ΔT = 15°C) 130 A_rms

*Maximum Continuous Current (ΔT = 40°C) 210 A_rms
0.27 mΩ is what the Supply will see with a voltage difference.
Therefore you need a SMPS  a  regulated current limit and voltage limit like a battery charger.

*

*Assuming 15V*8A=120W source,

*Pout=V²/ESR = say 100 W * 0.27 mΩ = 0.027  = V² , V=

*thus if V initial = 164 mV I=609A

*

*but that would exceed the spec for > 5 seconds.

*Thus you must have a good charger limited to around 100 Amps max or anything less that is a current source, not a voltage source, but voltage limited.

*You also need a cell Voltage balancer to limit V to 3.25V absolute max./cap.

A: A USB charger output is spec at 5V +-5%; 4.75V to 5.25V.
If you have the supercap charged at 5V and uses it to charge your cell phone, the charging will take place between 5V to 4.75V. Cell phone will stop charging once detect a lower voltage (depending on phone manufacturer), which makes the remaining charged 4.75V supercap useless. It is possible to add a boost converter to overcome this problem, however you'll still face the same issue when voltage drop below the converter minimum required voltage to function.
For a portable high energy storage, a powerbank is a better candidate.
For application where there will be short high current demand, use Super cap. I used 6 supercap parallel to my car battery. These Japanese made cap have a variance of 0.02V when I charge them in series without protection circuit.


text:
Q: Issue in URL: Laravel 5.1 What is it about ?
On Godaddy Shared Hosting, I have space on Linux Server. My Directory Structure is like below in the screenshot

We can see from the above screenshot that the app is inside the Framework folder and Framework folder is in the root.
What's the Problem ?
In the First screenshot, we can find Users Directory inside Framework folder. That has file in the below given path
Framework/Users/Helper/Profile/user.png

I am not able to make the url that can point to above mentioned file.
What I tried so far ?
<img src="{{URL::asset('/Users/Helper/Profile/User.png')}}"}}

Am I missing something ?

A: What I would suggest is that you move all the folders inside the Framework folder and move them into the root folder. Basically, just get rid of the Framework folder. This would allow you to use the helper methods.
Then move the Users folder into the public_html folder, and you should be good to go.
Your directory structure should look like this after you remove the Framework folder and move it's content in the root folder.
- app
- bootstrap
- config
- database
- resources
- storage
- tests
- vendor
- logs
- mail
- public_html
    - Users


text:
Q: iOS/iPhone: in-app purchase sandbox broken while app in "rejected" state? (See MAIN THRUST below to skip to the main thrust of my question.)
My iOS app was rejected in the Apple review process for a minor reason that was easy to fix.
However, I wanted to give the new build a once-over testing, including retesting our in-app purchase (there is only a single purchasable item in the app).
And now the app crashes when doing the initial retrieval of the product information. It never crashed in this way before, and the code hasn't changed since we successfully tested the in-app purchase in sandbox mode many times. (In fact, no code changed at all between the initially submitted version and this version with the minor fix; the fix was just an info.plist setting change.)
To complicate matters, I'm using the Airplay/Marmalade SDK for building the app, and they wrap the Objective C calls and callback mechanism with their own API and callback mechanism. However, this wrapper is very thin, so I hope/believe that this is really a general iOS/in-app purchase question, not something specific to Marmalade.
So, as I say, it's crashing somewhere between the time I make the Marmalade call to retrieve product information and the time my (C++) callback should be called. (I.e., somewhere between the time that Marmalade calls [productsRequest start] on an SKProductsRequest object, and the time productsRequest:didReceiveResponse() is called and Marmalade calls me back in turn.)
MAIN THRUST of my question:
My app is in "rejected" state on iTunesConnect. Furthermore, when I look at the in-app purchase item itself in iTunesConnect, it's also marked as "Rejected". However, I've already discussed my in-app purchase with Apple during the review process, and it is my belief that the in-app purchase itself works fine for them, and the only remaining problem was the minor issue that I've already fixed (this is what their rejection details said: just that one item).
So: I need to understand whether, when my app (and its associated in-app purchase) are in this "rejected" state pending a new binary upload from me, it's tricky (or maybe impossible) to re-test the in-app purchase, and my best course of action is just to resubmit the app with the minor fix and have faith that (since it's the same code that worked during normal testing when things weren't in the rejected state) the state of the in-app purchase will work itself out once Apple resets everything to test the new binary.
Or is there something different I should do at this point that would allow me to re-test the in-app purchase?
I was thinking of asking Apple in the iTunesConnect correspondence, but I didn't want to introduce any complications with them, since the review process has been amazingly fast and efficient so far.

A: I got a reply from Apple tech support on this:

I'm responding to your question below regarding in app purchase and
  the issue where the product preflight process now fails. The answer to
  this issue is documented in Tech Note 2259 - "Adding in app purchase
  to your iOS application".
  http://developer.apple.com/library/ios/#technotes/tn2259/_index.html
In the FAQ section there is the following list of reasons for this
  issue
Why are my product identifiers being returned in the
  invalidProductIdentifiers array? Your product identifiers may be
  returned in the invalidProductIdentifiers array for one or more of the
  following reasons:
You did not complete all the financial requirements (see the
  "Contracts, Tax, and Banking Information" section of this document).
  You did not use an explicit App ID. You did not use the Provisioning
  Profile associated with your explicit App ID. You did not use the
  correct product identifier in your code. See Technical Q&A, QA1329,
  'In App Purchase Product Identifiers' for more information about
  product identifiers. You did not clear your In App Purchase products
  for sale in iTunes Connect. You might have modified your products, but
  these changes are not yet available to all the App Store servers. If
  you or App Review rejected your most recent binary in iTunes Connect.
Note the last reason - which applies in your case. The solution is -
  when you want to test the application, you will need to "temporarily"
  upload a copy of your application to iTunesConnect so that the
  application state is no longer "rejected". Instead it will be in the
  "pending review" state. Go ahead and perform whatever testing you
  need, then assuming the application still needs work, self reject the
  application so that it doesn't reach app review. At some point, you
  will have a finished product and you will finally submit the
  application formally.

That response wasn't totally correct in my case. I got a separate reply from the app review team. Simply uploading a new binary apparently does not reset the "rejected" state of the in-app purchase item. Apparently they have to manually reset that themselves (at which time I believe both they and I can test it). So currently I have my new binary uploaded but they haven't reset the in-app purchase item yet.
I'll add more to this post when the process is complete...


text:
Q: OptaPlanner repeat last move indefinitely I implemented an algorithm similar to CloudBalancing using OptaPlanner 7.56.
Actually i'm using a ChangeMoveSelector that i filtered with some conditions and it work greats. When no move are available it stop and return the best solution.
<localSearch>
    <changeMoveSelector>
        <selectionOrder>ORIGINAL</selectionOrder>
        <filterClass>...</filterClass>
    </changeMoveSelector>

    <acceptor>
        <acceptorType>HILL_CLIMBING</acceptorType>
    </acceptor>
    <forager>
        <pickEarlyType>NEVER</pickEarlyType>
        <acceptedCountLimit>1000</acceptedCountLimit>
    </forager>
</localSearch>

But i tried to add a PillarChangeMove with similar filter and after checking all possible moves, it repeat the last move indefinitely and after some times i get the following warning Bailing out of neverEnding selector.
<unionMoveSelector>
    <changeMoveSelector>
        <selectionOrder>ORIGINAL</selectionOrder>
        <filterClass>...</filterClass>
    </changeMoveSelector>

    <pillarChangeMoveSelector>
        <filterClass>...</filterClass>
        <subPillarType>NONE</subPillarType>
    </pillarChangeMoveSelector>
</unionMoveSelector>

A: I remember that i had the same issue when i implemented ChangeMoveSelector.
I fixed by adding <selectionOrder>ORIGINAL</selectionOrder>
<unionMoveSelector>
    <changeMoveSelector>
        <selectionOrder>ORIGINAL</selectionOrder>
        <filterClass>...</filterClass>
    </changeMoveSelector>

    <pillarChangeMoveSelector>
        <selectionOrder>ORIGINAL</selectionOrder>
        <filterClass>...</filterClass>
        <subPillarType>NONE</subPillarType>
    </pillarChangeMoveSelector>
</unionMoveSelector>


text:
Q: Uncaught Error: WebGL unsupported in this browser Hi I'm trying to use PixiJS to render things in my browser but I keep getting a very annoying error:
Uncaught Error: WebGL unsupported in this browser, use "pixi.js-legacy" for fallback canvas2d support.

WebGL is supported by my browser tho : https://i.gyazo.com/8e55f75c74dd738c55d646bce3cdc294.png
Here's my very simple js:
let app = new PIXI.Application({width: 800, height: 800});
document.body.appendChild(app);

And my html:
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" type="text/css" href="style.css">
</head>
<script src="pixi.min.js"></script>
<script src="chess.js"></script>

<body>

</body>
</html>

A: Update
I think you need to update pixi.js setting as following ref1 ref2:
PIXI.settings.FAIL_IF_MAJOR_PERFORMANCE_CAVEAT = false;

Please note, that browsers are now supporting low performance by default. so it may limit the current page from rendering 3d that may require high performance. you could follow up on failIfMajorPerformanceCaveat which is need to be passed in the context or you could force browser settings as following:
so for
Firefox

*

*Go to about:config, search for webgl.disabled, ensure that its value is false.

*Go to about:config, search for webgl.force-enabled, set it to true.

*Go to about:config, search for layers.acceleration.force-enabled, set it to true.

*restart your firefox.

I am not really sure about chrome configurations.


text:
Q: More efficient way to get all indexes of a character in a string Instead of looping through each character to see if it's the one you want then adding the index your on to a list like so:
     var foundIndexes = new List<int>();
     for (int i = 0; i < myStr.Length; i++)
     {
        if (myStr[i] == 'a')
           foundIndexes.Add(i);
     }

A: The raw iteration is always better & most optimized.
Unless it's a bit complex task, you never really need to seek for a better optimized  solution...
So I would suggest to continue with :
var foundIndexes = new List<int>();

for (int i = 0; i < myStr.Length; i++)

     if (myStr[i] == 'a') foundIndexes.Add(i);

A: If the string is short, it may be more efficient to search the string once and count up the number of times the character appears, then allocate an array of that size and search the string a second time, recording the indexes in the array.  This will skip any list re-allocations.
What it comes down to is how long the string is and how many times the character appears.  If the string is long and the character appears few times, searching it once and appending indicies to a List<int> will be faster.  If the character appears many times, then searching the string twice (once to count, and once to fill an array) may be faster.  Exactly where the tipping point is depends on many factors that can't be deduced from your question.
If you need to search the string for multiple different characters and get a list of indexes for those characters separately, it may be faster to search through the string once and build a Dictionary<char, List<int>> (or a List<List<int>> using character offsets from \0 as the indicies into the outer array).
Ultimately, you should benchmark your application to find bottlenecks.  Often the code that we think will perform slowly is actually very fast, and we spend most of our time blocking on I/O or user input.

A: You can use String.IndexOf, see example below:
    string s = "abcabcabcabcabc";
    var foundIndexes = new List<int>();

    long t1 = DateTime.Now.Ticks;
    for (int i = s.IndexOf('a'); i > -1; i = s.IndexOf('a', i + 1))
        {
         // for loop end when i=-1 ('a' not found)
                foundIndexes.Add(i);
        }
    long t2 = DateTime.Now.Ticks - t1; // read this value to see the run time

A: I use the following extension method to yield all results:
public static IEnumerable<int> AllIndexesOf(this string str, string searchstring)
{
    int minIndex = str.IndexOf(searchstring);
    while (minIndex != -1)
    {
        yield return minIndex;
        minIndex = str.IndexOf(searchstring, minIndex + searchstring.Length);
    }
}

usage:
IEnumerable<int> result = "foobar".AllIndexesOf("o"); // [1,2]

Side note to a edge case: This is a string approach which works for one or more characters. In case of "fooo".AllIndexesOf("oo") the result is just 1 https://dotnetfiddle.net/CPC7D2

A: How about
string xx = "The quick brown fox jumps over the lazy dog";

char search = 'f';

var result = xx.Select((b, i) => b.Equals(search) ? i : -1).Where(i => i != -1);

A:     public static List<int> GetSubstringLocations(string text, string searchsequence)
    {
        try
        {
            List<int> foundIndexes = new List<int> { };

            int i = 0;
            while (i < text.Length)
            {
                int cindex = text.IndexOf(searchsequence, i);

                if (cindex >= 0)
                {
                    foundIndexes.Add(cindex);
                    i = cindex;
                }

                i++;

            }

            return foundIndexes;
        }
        catch (Exception ex) { }
        return new List<int> { };
    }

A: public static String[] Split(this string s,char c = '\t')
    {
        if (s == null) return null;
        var a = new List<int>();
        int i = s.IndexOf(c);
        if (i < 0) return new string[] { s };
        a.Add(i);
        for (i = i+1; i < s.Length; i++) if (s[i] == c) a.Add(i);
        var result = new string[a.Count +1];
        int startIndex = 0;
        result[0] = s.Remove(a[0]);
        for(i=0;i<a.Count-1;i++)
        {
            result[i + 1] = s.Substring(a[i] + 1, a[i + 1] - a[i] - 1);
        }
        result[a.Count] = s.Substring(a[a.Count - 1] + 1);
        return result;
    }


text:
Q: What should be the real error band of a fit function? This is a question concerning data analysis. It could relate to particle/nuclear physics or other field. Please note that this question has nothing to do with technical problems, and is more of a theoretical question.
The question is, what's the precise definition of a error band of a fit function (I will present two approaches later), and what's the right way to draw it? I have already made much of the sense on this topic, so I will brief here.
My previous question was here:
How to calculate the uncertainty of a fit function?

Let's call the method of drawing a statistical fit band and Method A:
A fit usually is defined by
$$\chi^2:=\sum_i(\frac{f(x_i)-y_i}{\sigma_i^{stat}})^2.$$
After a fit on a dataset with statistical uncertainties, we can extract the covariance matrix of the fit parameters (no matter what analysis tool you use, for example, CERN ROOT). Let's call the eigenvectors of the covariance matrix are $\vec{v}_i$ and eigenvalues $\sigma^2_i$, due to semi-definitiveness. Then we can generate Gaussian variables $\epsilon_i$ and make the fit-parameters shift by the combination $\sum_i \epsilon_i \sigma_i \vec{v}_i$. For each random-generation, we have a fit-function curve. Then we can Monte-Carlo curves to get a fit-band. See picture below.

On the other hand, we have Method B (data-shuffling method):
It's usually applied to systematic uncertainties. Before fit, we simply shift our data by $y_i\rightarrow y_i+\epsilon \sigma_i^{sys}$, where $\epsilon$ is a Gaussian random variable. We can do this many many times, then get a bund of curve. See the picture below is the 1-$\sigma$ band of those curves.

If we add them in quadrature (original data also shown), we have:

So far so good.

Method C:
On the other hand, we could use modified-least-$\chi^2$ method to handle systematic uncertainty:
$$(\chi^2)^\prime:=\sum_i(\frac{f(x_i)-y_i-\epsilon \sigma_i^{sys}}{\sigma_i^{stat}})^2+\epsilon^2\ \text{ for one dataset}$$
By minimizing it, we have the best fit parameter and the best $\epsilon$, tell us how datasets should shift. The band will be defined from the error of parameters such that $\Delta \chi^2=1$. Use method A again, we have
See? The "total" error band by method C is even narrower than the pure statistical blue band in Fig 1. Not to mention comparing with Fig 3.
This is sensible, though. Because method C gives the best parameters that globally minimize $(\chi^2)^\prime$, while method A (the usual fit) only minimize the $\chi^2$ in the partial parameter space  (no $\epsilon$).
Now, should fit error band given by method A+B (Fig 3) the true band? Or should it be method C (Fig 4)?
I think they represent two different point of view. Method B is like SMEARING the fit curve due to the shift of data by systematic uncertainties. So, combined with pure statistical band, the total $\Delta\chi^2$ should be 1+something>1. While in method C $\Delta\chi^2=1$ exactly, the narrow band simply says: "OK, here is the fit CURVE (a line) you want. But I'm not 100% sure of it, so I draw a little uncertainty band. This band is not as wide as method A+B because it should be those data points that are uncertain, not my function curve."
So can you tell me which band is the right one? Method A+B or method C?
It took me a while to put together those words. This is really important for my research. Hope someone of relevant field could answer me.


text:
Q: Actualización de div mediante JQUERY y AJAX no funciona en servidor linux, si en XAMPP local tengo una aplicación (panel de carga de unagebes para unaa web) que localmente, utilizando xampp, funciona sin problema, pero al subirlo al servidor (en linux, de Nuthost) me tira error 500. He probado modificando el archivo llamado para que solo devuelva una cadena de texto corta y funciona bien, pero al intentar devolver una tabla con los datos de las imagenes cargadas en la web, tira el mencionado error.
Dejo el codigo del llamado al archivo.
$(document).ready(function () {
var ordenado = '<?= $ordenarpor ?>';
load_orden(1, ordenado);
});

function load_orden(page, orden) {
var q = $("#q").val();
$("#loader").fadeIn('slow');
$.ajax({
    url: '../ajax/buscar_s_principal.php',
    type: "POST",
    data: {action: "ajax", page: page, q: q, orden: orden},
    beforeSend: function (objeto) {
        $('#loader').html('<img src="../img/ajax-loader.gif">');
        alert("before");
    },
    success: function (data) {
        alert("success");
        $(".outer_div").html(data).fadeIn('slow');
        $('#loader').html('');
    }
});
}

Al cargar la pagina se ejecuta el load_orden donde se llama al archivo buscar_s_principal.php donde conecta a la base de datos y devuelve una tabla en html que es lo que se asigna al outer_div.
El alert en el before se ejecuta siempre, el alert en el success solo si modifico el archivo buscar_s_principal.php con algo con algo como testeando.
En la pagina hay un boton de carga que abre un modal y hace el grabado en la base mediante ajax y esa parte funciona correctamente.
Espero haber sido claro, gracias desde ya por la ayuda.
Editado:
Incluí ini_set('display_errors', '1'); ini_set('display_startup_errors', '1'); error_reporting(E_ALL); como me indicaron pero no muestra ningun error. Solamente en la consola aparece Failed to load resource: the server responded with a status of 500 ()
Editado 2:
Gracias por la respuesta, aclaro que en el servidor esta instalada la version 7.2 de php, y esta en este momento funcionando una web en wordpress ademas de una tienda online. De todas formas otros llamados a ajax me funcionaron sin problema (por ejemplo funciona la carga de nuevas imagenes grabando en la base de datos). Solo con este me tira el error 500 y parece ser por el tamaño de la respuesta de ajax, ya que funciona bien si devuelvo una string corta.
Este mismo panel (con minimas diferencias) esta funcionando en otros servidores con esa version de php o con php7.4 si bien la version que tengo instalada local es php8.
No se si hay alguna configuración diferente que pueda solicitar al hosting modificar, no tengo acceso al archivo de configuración de apache en el servidor, ni tampoco al de PHP completo.

A: Finalmente encontré el problema.
Al subir el archivo buscar_s_principal.php, el servidor lo comprimía borrándole los espacios, quedaba todo en una linea y todo junto. Pude subirlo sin que pase esto y no hubo más problema.


text:
Q: Netbeans on Mac won't create new projects I'm new here and I gotta problem, I need Netbeans for school, I already installed and ran it, but when I try to create a new file or project I get no response nor warning messages from Netbeans, if anyone could help me find a solution I'd be grateful, I'll leave a screenshot for you to see how I see Netbeans.
P.D.: My java version is Java 8 Build 191

EDIT: I want to create new files and projects, there's also no error message when I click 'New File' or 'New Project', nothing at all happens


text:
Q: Perforce - How do I know whether a workspace has the latest revision file? I did a p4 have file.c in my workspace and also in another colleague's workspace for the same branch. my revision is shown as #5 and colleague's is #4. His rivision remains #4 even after he doing p4 sync -f file.c. Still I dont get the reason for this mismatch- (p4 sync -f is supposed to bring to latest revision which is #5).
The question is, how somebody can confirm whether their file is the latest version available in the perforce server.

A: You can check for new changes with p4 sync -n or p4 changes "...#>have" in the workspaceroot.
A possible cause for not getting a new change when calling p4 sync or p4 sync -f is to have the file open (you'd have to resolve it then).


text:
Q: Recovering drive via boot to Win7 setup command prompt I am trying to recover data from two old IDE drives. Drive1 has been successful, but something is wrong with Drive2. It does not appear as a drive letter.
Due to limited legacy hardware, the only way i can see these drives is to boot using windows 7 setup and goto the command prompt. Without going further as to why, my question is how i can access the data in this command prompt.
I discovered DISKPART command and while a first time user, it looked like something that can fix my problem. Here are the results of my diskpart commands. At the bottom is a image of the commands taken with a camera.

The Drive2 is present because when using the diskpart command, I can see it.

*

*How can I copy the information using a robocopy script if the drive
letter is not available?

*how can I assign a drive letter?

*Is there
any repair command I need to execute?

When i execute DISKPART, the following is what i see.
DISKPART> LIST DISK

Disk###  Status  Size  Free
Disk 5   Online 37 GB  2048 KB

So then I select disk 5.
DISKPART> SELECT DISK 5

"Disk 5 is now the selected disk"
When I list partition
DISKPART> LIST PARTITION
Partition ### Type    Size
Partition 1   Primary 101 MB
Partition 2   Primary 37 GB

So I select partition 2
"Partition 2 is now the selected partition."
I then try to assign a drive letter
DISKPART> ASSIGN LETTER=G

"There is no volume specified."
"Please select a volume and try again."
When i list volume the drive is not present.
DISKPART> LIST VOLUME

Result of the above commands


text:
Q: How can I make an image appear to flow seamlessly between tableview cells I have a UITableView cell with an image that spans the full height of the cell.
If I do not use a separator the images on each cell join up and appear as a single image, however, when I turn on the separator the image is sliced (see below). Is there a way to make the image appear on top of the table view separator?

A: I would just get rid of the standard separator and manually draw a line beneath the image. This will probably simulate the separator quite nicely without it overlapping the image.
Perhaps just use an UIImageView with a stretched line image?


text:
Q: Installing PySCIPOpt on OS X I am trying to install PySCIPOpt on my mac, following the instructions here. When I try to test it as follows:
from pyscipopt import Model

I get the following error:
ImportError: dlopen(/anaconda3/lib/python3.7/site- packages/pyscipopt/scip.cpython-37m-darwin.so, 2): Symbol not found: _SCIPnlpiComp

I tried following the solution suggested here, but the error still occurs. Any ideas as to how I can fix this?

A: This very much sounds like a version inconsistency. Please make sure that you are always using the latest version of the SCIP Optimization Suite together with the current PySCIPOpt version. You can check which version is linked by inspecting the scip.so library mentioned in the question:
otool -L scip.cpython-37m-darwin.so


text:
Q: Evaluate the integral using the residue theorem $$\int_C \frac{e^{πz}} {{z^{2}}{(z^{2}+2z+2)}}dz,$$ where C is the circle of centre 0 and radius 3, traversed in the anticlockwise direction.
I can see there are singularities at $z=0$, $z=-1+i$ and $z=-1-i.$
I have found the residues at $z=-1+i$ and $z=-1-i$ which are both $ \frac{-e^{-π}} {{4}}$.
I am struggling to find the residue at $z=0$.

A: The pole at $z=0$ is of second order.  The corresponding residue at $z=0$ can be found using this as the limit
$$\text{Res}\left(\frac{e^{\pi z}}{z^2(z^2+2z+2))}\right)=\lim_{z\to 0}\frac{d}{dz}\left(\frac{e^{\pi z}}{z^2+2z+2}\right)$$
Can you finish now?


text:
Q: "Patronize this the _____" when talking about food There is a word in a video that I cannot figure out and have trouble hearing. The phrase as I hear it is (excuse me for inaccuracies):

"Now don't be afraid to go out on into the lobby and patronize this the
  __ and buy some licorice sticks and mass pumpkin pie."

I'm assuming this is either an idiom that I am not aware of or he is talking about the place the film is being shown.
The youtube video is here.

A: What they say is "this theater" (pronounced with a strong Texan accent as "thee-ayter"). They also say "nice pumpkin pie" (pronounced as "na-sce").
The strong accent is being put on for humorous effect, as cues such as the idea of buying a good ol' American pumpkin pie in a theater might suggest — though these cues might not be apparent to everyone who hasn't grown up immersed in American culture.


text:
Q: Making responsive website: Form overlaps I manage to do everything responsive except for my form to overlap, causing to have me scroll horizontally.
(Click here) Form looks normal, until...
when I navigated this page, somehow, it overlaped..
(Click here) My page is screwed
I am using a global .css here to create the site, because somehow I am
forbidden to add/edit/delete html codes.
I cannot change the tr and body of the table because the other page would mess up.
My only problem is this page that unexpectedly scrolls horizontally.
I dunno what's the problem here..help me
my table is inside a form. My code is...

@media screen and (max-width: 768px) {
    form {
  overflow-x: scroll;
  max-height: 500px;
  margin:0 auto;
 }
 table, table td, table th {
  display: block;
  width: inherit;
  text-align: left;
 }
}


text:
Q: Jenkins pipline - how to access github webhook payload Im trying to build a Jenkins pipeline which enforces gitflow.
My requirements are that when there is a merge from the release branch (e.g. release/v1.0.0) to master i will use the same docker image that was created during the last commit on the release branch, before the merge commit (in other words, use latest image that was approved in staging).
I'm trying to figure out how to access the GitHub PullRequestEvent event payload in my groovy jenkins pipeline, so i can see if the source branch is a release branch and tag the container with the release version tag. Then I'll use them in my pipeline.


text:
Q: How to upgrade OpenSSH from 6.6.1p1 to version 7.2p2 on Amazon Linux? How to upgrade OpenSSH from 6.6.1p1 to version 7.2p2 on Amazon Linux?
The upgrade is required to fix "OpenSSH Xauth Command Injection" vulnerability.
Pasting from Scan results from https://pci.qualys.com:
Result: SSH-2.0-OpenSSH_6.6.1 detected on port 22 over TCP.

Proposed Solution: "Users are advised to upgrade to the latest version of the software available. Refer to OpenSSH 7.2p2 Release Notes for further information."
1)Linux version
ec2-user@demotair.arabidopsis.org$ uname -a
Linux ip-172-31-24-127 4.9.38-16.33.amzn1.x86_64 #1 SMP Thu Jul 20 01:31:29 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux

2) Current ssh version on it:
ec2-user@demotair.arabidopsis.org$ ssh -V
OpenSSH_6.6.1p1, OpenSSL 1.0.1k-fips 8 Jan 2015

ec2-user@demotair.arabidopsis.org$ yum list | grep openssh
openssh.x86_64                      6.6.1p1-33.66.amzn1            @amzn-updates
openssh-clients.x86_64              6.6.1p1-33.66.amzn1            @amzn-updates
openssh-server.x86_64               6.6.1p1-33.66.amzn1            @amzn-updates
openssh-keycat.x86_64               6.6.1p1-33.66.amzn1            amzn-main
openssh-ldap.x86_64                 6.6.1p1-33.66.amzn1            amzn-main

3) Attempt to update results in "No packages marked for update"
ec2-user@demotair.arabidopsis.org$ sudo yum update openssh
Loaded plugins: priorities, update-motd, upgrade-helper
amzn-main                                                                                | 2.1 kB  00:00:00
amzn-updates                                                                                | 2.3 kB  00:00:00
No packages marked for update

PS Below links did not help me to upgrade:
https://forums.aws.amazon.com/thread.jspa?messageID=679779#679779 "OpenSSH 7 is not available via yum update"
https://serverfault.com/questions/749199/updating-openssh-on-amazon-linux-amazon-repository-out-of-date
quote: "Until Amazon updates its package, you can stop the bug from affecting you by adding the line UseRoaming no to /etc/ssh/ssh_config on any machine from which you will be using the ssh client."

A: There's no need. As was stated in the question to which you have linked, Amazon backports security fixes, and your scanner is giving a false positive by testing for the version number rather than actually testing for the presence of the vulnerability. CVE-2016-3115 was fixed in Amazon openssh version 6.6.1p1-23.60 on 16 March 2016.


text:
Q: Swift sub-modules in Cocoapods I'm trying to set up the following arrangement of private Cocoapods:
PodA depends on PodB which depends on CommonCrypto.
CommonCrypto is a dylib that ships with iOS but doesn't have a Swift header module. Within PodB I've created a custom module.modulemap with the following contents:
module CommonCrypto [system] {
    header "/usr/include/CommonCrypto/CommonCrypto.h"
}

PodB passes the lint test (pod spec lint PodB.podspec) after adding the following lines:
# Ensure module isn't deleted by CocoaPods
s.preserve_paths = 'path_to/PodB/CommonCrypto'
s.pod_target_xcconfig = { 'HEADER_SEARCH_PATHS' => '$(PODS_ROOT)/path_to/CommonCrypto' }

Within PodA, I depend on PodB with s.dependency = 'PodB'. When linting PodA with pod spec lint --sources=myrepo PodA.podspec I get an error compiling any Swift file with import PodB:
missing required module 'CommonCrypto'

How can I go about fixing this? It doesn't matter to me if CommonCrypto is private or public to PodB.
I tried adding export * to module.modulemap but that made no difference.

A: I solved this issue with a (slightly) ugly workaround; I exported the include path to the parent project.
Since include paths are multi-valued, a list as opposed to a single setting, Cocoapods can merge whatever the parent project (PodA) sets with whatever the subproject (PodB) requires.
I had tried this solution before but it failed since I was using HEADER_SEARCH_PATHS instead of SWIFT_INCLUDE_PATHS. The relevant bit of the fixed podspec looks like this:
# Ensure module isn't deleted by CocoaPods
s.preserve_paths = 'path_to/PodB/CommonCrypto'
s.pod_target_xcconfig = { 'SWIFT_INCLUDE_PATHS' => '$(PODS_ROOT)/path_to/CommonCrypto' }
s.user_target_xcconfig = { 'SWIFT_INCLUDE_PATHS' => '$(PODS_ROOT)/path_to/CommonCrypto' }

user_target_xcconfig is what allows PodB to inject build settings into PodA. This is generally not a great idea and could be used to screw up all kinds of things, so I'd welcome a better solution, but in the particular case of pointing parent pods to a module I think it is acceptable.
That said I think this solution would fail if PodA depended on both PodB and PodC where both B and C required CommonCrypto...

A: So far I've had good luck just copying all of the needed CommonCrypto headers into a single bridging header, and including that into the pod. CommonCrypto changes very rarely, and it is reasonably likely that it will be a modular header before any important changes happen to it. See RNCryptor.h for an example header file. Note that all the #ifdef conditionals are included, and each entire header is included (not just what is required for this project). This should protect against multiple packages importing the same file (as long as the header doesn't change).
The resultant podspec just includes the .h as a source:
s.source_files = 'RNCryptor.swift', 'RNCryptor.h'

A: Did you add the framework to podB's spec file?
s.frameworks = 'CommonCrypto'

A: using $(PODS_TARGET_SRCROOT) instead of $(PODS_ROOT)/podname/ worked for me
s.source_files = 'Classes/**/*.swift', 'modules/**/*.map'
s.preserve_paths = 'modules/**/*.map'

s.pod_target_xcconfig = {
   'SWIFT_INCLUDE_PATHS[sdk=iphoneos*]'         => '$(PODS_TARGET_SRCROOT)/modules/iphoneos/CommonCrypto',
   'SWIFT_INCLUDE_PATHS[sdk=iphonesimulator*]'  => '$(PODS_TARGET_SRCROOT)/modules/iphonesimulator/CommonCrypto',
}

module.map files:
modules/iphoneos/CommonCrypto/module.map:
module CommonCrypto [system] {
    header "/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/usr/include/CommonCrypto/CommonCrypto.h"
    export *
}

modules/iphonesimulator/CommonCrypto/module.map:
module CommonCrypto [system] {
    header "/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk/usr/include/CommonCrypto/CommonCrypto.h"
    export *
}


text:
Q: Some way to send data from one FTP server to another without intermediary? I'm trying to move a large amount of files from one CDN to another. I know that they have a very high-speed connection to each other, so what I'd like to do is connect them directly, but the only protocol I have access to with each is FTP. Is there any way to log into the current CDN and send their files to the other FTP? It seems like it should be possible, I just have no idea how to do it.

A: FXP: see Wikipedia article. Powerful FTP clients are capable of doing this. From protocol point of view it's trivial.
BTW this question is probably offtopic here.


text:
Q: find consecutive operators in a string and replace previous operator with latest operator I am a beginner and Working on a small project.Below is the issue where I am finding difficult to proceed.

*

*One Array of operator is there ['+','-','*','/']

*One string Eg: '42*+3';
I need to find whenever there is consecutive operator in a string it should ignore previous operator and take the latest one.
Eg: 42*+3 should be 42+3
I tried finding index of consecutive operator but how to replace the same in final string.

A: Use a regular expression to match and capture an operator in a captured group, and repeat that capture group 1 or more times, then replace with that captured group. This way, consecutive operators will be replaced with only the last operator captured:

const changeStr = str => str.replace(/([*/+-])+/g, '$1');

console.log(changeStr('5 +-* 6'));
console.log(changeStr('3 /- 4 ** 5'));


text:
Q: what is the difference between semaphore and critical region? the only thing i understood is

*

*semaphore is a primitive way

*critical region has a GUARD variable  (semaphore also does but the name is not GUARD!)

??
so whats the difference?

A: Generally, a critical region is a place where, if two separate threads of execution were to be present, a race condition or some other undesirable effect would occur. Semaphores are one way of preventing two threads from being in the critical region at the same point in time.

A: The GUARD would only allow 1 thread to enter the critical region at a time, whereas the semaphore can allow n threads (you specify n) to concurrently enter the critical region.

A: When a process executes code that manipulates shared data (or resource), we say that the process is in it's critical section (CS) (for that shared data)
and semaphore is Nonnegative integer variable used as a flag and
Signals if and when resource is free

A: There are two interpretations of "critical region":

*

*A region of code that will produce undefined results if executed simultaneously by two threads.

*A region of code that is isolated from all executors except for the current thread.  An example of this would be an interrupt handler.  These regions are more commonly called "critical sections".  On Intel CPUs you can begin/end a critical section with the CLI/STI instructions.


text:
Q: Concatenate pandas dataframes with varying rows per index I have two dataframes df1 and df2 with key as index.
dict_1={'key':[1,1,1,2,2,3], 'col1':['a1','b1','c1','d1','e1','f1']}
df1 = pd.DataFrame(dict_1).set_index('key')
dict_2={'key':[1,1,2], 'col2':['a2','b2','c2']}
df2 = pd.DataFrame(dict_2).set_index('key')

df1:
       col1
key
1       a1
1       b1
1       c1
2       d1
2       e1
3       f1

df2
       col2
key
1      a2
1      b2
2      c2

Note that there are unequal rows for each index. I want to concatenate these two dataframes such that, I have the following dataframe (say df3).
df3
       col1 col2
key
1       a1   a2
1       b1   b2
2       d1   c2

i.e. concatenate the two columns so that the new dataframe as the least (of df1 and df2) rows for each index.
I tried
pd.concat([df1,df2],axis=1)

but I get the following error:
Value Error: Shape of passed values is (2,17), indices imply (2,7)

My question: How can I concatentate df1 and df2 to get df3? Should I use DataFrame.merge instead? If so, how?

A: Merge/join alone will get you a lot of (hard to get rid of) duplicates. But a little trick will help:
df1['count1'] = 1
df1['count1'] = df1['count1'].groupby(df1.index).cumsum()
df1
Out[198]:
    col1  count1
key
1     a1       1
1     b1       2
1     c1       3
2     d1       1
2     e1       2
3     f1       1

The same thing for df2:
df2['count2'] = 1
df2['count2'] = df2['count2'].groupby(df2.index).cumsum()

And finally:
df_aligned = df1.reset_index().merge(df2.reset_index(), left_on = ['key','count1'], right_on = ['key', 'count2'])
df_aligned
Out[199]:
   key col1  count1 col2  count2
0    1   a1       1   a2       1
1    1   b1       2   b2       2
2    2   d1       1   c2       1

Now, you can reset index with set_index('key') and drop no longer needed columns countn.

A: The biggest problem for why you are not going to be able to line up the two in the way that you want is that your keys are duplicative. How are you going to be line up the A1 value in df1 with the A2 value in df2 When A1, A2, B1, B2, and C1 all have the same key?
Using merge is what you'll want if you can resolve the key issues:
df3 = df1.merge(df2, left_index=True, right_index=True, how='inner')

You can use inner, outer, left or right for how.


text:
Q: Installing dependent background apk I have a regular Android application which will be downloaded from a different source than Google Play Store. Assuming that the user will enable the "Install from unknown sources" option, this app can be installed. However, this application is dependent on another module (which has mostly services, no UI). I will prompt the user about this dependency during installation of the regular app.
Is there a way to auto-download this dependent module as an apk or a background task that runs in a different process space than the regular app?
When I go to Apps option in Settings, see a lot of processes running of the format com.<>.<> and others(like CoolEUKor) which were not installed by me. System apps can be preloaded. But, what about others. How are these processes installed without user interaction?

A:
Is there a way to auto-download this dependent module as an apk or a background task that runs in a different process space than the regular app?

Use DownloadManager. Or, have a service that handles the downloading, where you use the android:process attribute to have that service run in a separate process.
Your third paragraph, though, implies that you are interest not merely in downloading the app but also installing it. While you can kick off an ACTION_INSTALL_PACKAGE activity, the user is still involved in the installation.

When I go to Apps option in Settings, see a lot of processes running of the format com.<>.<> and others(like CoolEUKor) which were not installed by me.

Modern versions of stock Android do not have an option to view a process list in Settings. So, you might need to ask your device manufacturer about the specifics of what they are showing there.
A quick Internet search suggests that CoolEUKor is a bit of bloatware pre-installed on some Samsung devices. You would have to ask Samsung why Samsung pre-installs this app.

How are these processes installed without user interaction?

They were pre-loaded, most likely, or are associated with apps that you installed but are not recognizing based on whatever information is showing up in that process list. Or, perhaps your device is infected with malware, and it is exploiting some security flaw on that device to install other apps.


text:
Q: resize image or video in ioslides How do I resize an image or embedded video in ioslides? What works for a simple .html output (adjusting width and height as below) does not seem work when generating slies with ioslides_presentation:
---
title: "test"
author: ""
date: "January 12, 2016"
output: ioslides_presentation
---

## test video


text:
Q: How to find patterns across multiple lines in Linux? i'm trying to get some specific lines of this command:
ifconfig

here is the output of the command:
eth0      Link encap:Ethernet  HWaddr 00:10:E0:3F:6F:BC
          inet addr:10.71.1.30  Bcast:10.71.1.255  Mask:255.255.255.0
          inet6 addr: fe80::210:e0ff:fe3f:6fbc/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:3059275068 errors:0 dropped:1378 overruns:0 frame:0
          TX packets:2094779962 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:6566542892239 (5.9 TiB)  TX bytes:202791652910 (188.8 GiB)

eth1      Link encap:Ethernet  HWaddr 00:10:E0:3F:6F:BD
          UP BROADCAST RUNNING SLAVE MULTICAST  MTU:1500  Metric:1
          RX packets:1417584931 errors:0 dropped:32908 overruns:0 frame:0
          TX packets:1284691038 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:2256566826674 (2.0 TiB)  TX bytes:182643225952 (170.0 GiB)

I just want lines that contains "Link" and "bytes" words, for example:
eth0      Link encap:Ethernet  HWaddr 00:10:E0:3F:6F:BC
RX bytes:6566542892239 (5.9 TiB)  TX bytes:202791652910 (188.8 GiB)
eth1      Link encap:Ethernet  HWaddr 00:10:E0:3F:6F:BD
RX bytes:2256566826674 (2.0 TiB)  TX bytes:182643225952 (170.0 GiB)

A: Te best approach must be to use grep to filter the lines. For example, use:
ifconfig | egrep " Link|bytes"

Note I added a space before Link to avoid matching the line ending with Scope:Link.
You can also use:
ifconfig | awk '/ Link/ || /bytes/'

or
ifconfig | grep " Link\|bytes"

A: Of course grep is the best tool for this. But, there are some other ways are available to do the same. That is,
ifconfig | sed -n '/Link \|bytes/p'

and
ifconfig | awk '/Link |bytes/'

A: ifcofig|perl -lne 'print if(/Link/||/bytes/)'

A: Here's a couple of useful patterns that most people I've met don't seem to know about. The first is particularly relevant to your problem.
grep -e is your best new-found friend
ifconfig | grep -e Link -e bytes

You can do a similar thing with sed, which has an additional bonus of also printing out the first line (which might contain a heading). In this example, I'm printing out the heading line and any lines contain LISTEN or 'bar' (The second expression is just there to reinforce the fact that you're not limited to one.) Here, the 1p is addressing the first line, (origin-1), with the operation to 'p'rint
lsof -Pni | sed -n -e 1p -e '/LISTEN/p' -e '/bar/p'


text:
Q: Создать свойство по строке Доброго времени суток. Прошу прощения, вопрос идиотский и детский, но очень важный для меня на текущем этапе.
Итак:
Есть следующее,
var ksu = {};
var tmp = "ksu.Core.object.Test";

Задача:
Создать в объекте эти же свойства, опираясь на текст: "ksu.Core.object.Test".
Понимаю, нужно прибегнуть к рекурсии, но что-то не получается. Простите, реально, я деградирую в отпуске жесточайше.
Спасибо за помощь.
Как я пытался сие реализовать:
Я пытался создавать свойство объекта и вызывать саму себя (функцию) с аргументом, который и есть новое свойство объекта. Таким образом и хотел выстроить цепочку. А сама строка сплитилась по точке и при очередном вызове из массива удалялся используемый элемент. Не прокатило.
A: Без рекурсии:
var ksu = {};
var tmp = "ksu.Core.object.Test";
var keys = tmp.split('.');
for(var i = keys.length; i--;){
    var tmpObj = {};
    tmpObj[keys[i]] = ksu;
    ksu = tmpObj;
}
console.log(ksu);

A: Короче, еще раз убеждаюсь, что хочешь что-то сделать хорошо, сиди в баре и пей пиво :D
Если кому интересно - то вот и функция :D
function createObj (str) {
    var obj = {};
    var list = str.split('.');
    var fun = function(list, index) {
        if (index > list.length - 1)
            return {};
        var key = list[index];
        var object = {};
        object[key] = fun(list, index + 1);
        return  object;
    }
    return fun(list, 0);
};


text:
Q: How to get custom React Babel pragma to pass string as argument rather than function As a follow up to How to create your own babel processor alternative to `React`, I am getting this error:

react-dom.development.js:506 Warning: The tag  is unrecognized in this browser. If you meant to render a React component, start its name with an uppercase letter.

*

*in foo

*in Unknown

*in Bar

If I make it a capital letter, then this error:

Uncaught ReferenceError: Foo is not defined

I'm guessing this is because it's passing it as a function like this:
React.createElement(Foo)

My question is, how to get it to pass it as a string?
MyThing.create('Foo')

I would like to know how to do it with both capital and lowercase letters.

A: As far as I know, you'll have to modify @babel/plugin-transform-react-jsx to do that. By default, it assumes initially-capped tags are components (functions/classes), and lower-case tags are HTML tag names. It passes components directly to the function identified by the pragma configuration parameter (React.createElement(Foo) by default, for instance) but HTML tag names as strings (React.createElement("div")). The plugin doesn't list any configuration option for altering that behavior, so if you want it, you'll have to fork the plugin and modify it to work the way you want it to work.


text:
Q: Python Flask return redirect with parameters without displaying parameters in url I have a simple python flask app. When one of my users comments on my home page, I want to redirect them right back to the home page. Currently, I have the same route that handles the home page and commenting. It looks like this:
@app.route('/home', methods=['POST', 'GET'])
@login_required
def home():
    form = CommentForm()
    user = User.query.filter_by(username=current_user.username).first()
    house = House.query.filter_by(owner_id = current_user.id).first()
    neighbors = Neighbors.query.filter_by(houseid=house.id).all()
    if user.id == current_user.id:
        if form.validate_on_submit():
            time = strftime("%a, %b %d %Y %X", localtime())
            comment = Commentsection(houseid = house.id, commentbody = form.body.data, times = str(time), commenter=user.username, commenterid=user.id, commenterpic = user.image_file )
            db.session.add(comment)
            db.session.commit()
            link = url_for('add', invite_token=house.linkinv, _external=True)
            comments = Commentsection.query.filter_by(houseid=house.id).order_by(Commentsection.id.desc()).all()
            return redirect(url_for('home', title='Home', house=house, form=form, comments=comments, link=link, neighbors=neighbors))
        else:
            link = url_for('add', invite_token=house.linkinv, _external=True)
            comments = Commentsection.query.filter_by(houseid=house.id).order_by(Commentsection.id.desc()).all()
            return render_template('home.html', tite='Home', house=house, form=form, comments=comments, link=link, neighbors=neighbors)

When the user submits the comment, the code is ran and the form is validated. When the form is validated, it creates the comment model and commits it to the database. After, it redirects the user to that same page, to avoid the annoying "Would you like to submit this form again" popup in chrome. If I did not redirect, the form would continue to submit every time I reload the page. The problem is, when I redirect, the url_for thinks I am passing in url arguments instead of variables, and places them right into the url, resulting in something like this:
http://127.0.0.1:5000/home?`title=Home&house=House%28%27Nicks+Home%27%2C%2732+Ellridge+Place%27%2C%271%27%2C%29&form=%3Cdog_house.forms.CommentForm+object+at+0x04A75C10%3E&comments=Commentsection%28%2710%27%2C%271%27%2C%27Hello+world%27%2C%27nickdeb%27%2C%27default.jpg%27%2C%29&comments=Commentsection%28%279%27%2C%271%27%2C%27Hello+world%27%2C%27nickdeb%27%2C%27default.jpg%27%2C%29&comments=Commentsection%28%277%27%2C%271%27%2C%27Hello+world%27%2C%27nickdeb%27%2C%27default.jpg%27%2C%29&comments=Commentsection%28%276%27%2C%271%27%2C%27Nickkk%27%2C%27nickdeb%27%2C%27default.jpg%27%2C%29&comments=Commentsection%28%275%27%2C%271%27%2C%27Hello+man%27%2C%27nickdeb%27%2C%27default.jpg%27%2C%29&comments=Commentsection%28%274%27%2C%271%27%2C%27Nick%3F%27%2C%27nickdeb%27%2C%27default.jpg%27%2C%29&comments=Commentsection%28%273%27%2C%271%27%2C%27Hey+nick%27%2C%27nick%27%2C%27414f2185a17700081ecfff3c948527405e44c507f029d068.JPG%27%2C%29&comments=Commentsection%28%272%27%2C%271%27%2C%27Hello+world%27%2C%27nick%27%2C%27414f2185a17700081ecfff3c948527405e44c507f029d068.JPG%27%2C%29&comments=Commentsection%28%271%27%2C%271%27%2C%27Hello+world%27%2C%27nick%27%2C%27414f2185a17700081ecfff3c948527405e44c507f029d068.JPG%27%2C%29&link=%2Fhome&neighbors=%3CNeighbors+1%3E`

Instead of:
http://127.0.0.1:5000/home

As you can see, that url is veryyyy ugly compared to the second one and can possibly expose user data.
With the variables still being passed to the html template. Is this possible?
TLDR; Pass arguments and variables to a redirect(url_for) without having the variables passed into the url directly.


text:
Q: Normalize quadratic form (parabolic pillar) I cannot normalize a real quadratic form $F(x,y,z)$
\begin{eqnarray}
F(x,y,z) &=& ax^2 + by^2 + cz^2 + 2fyz + 2gzx + 2hxy + 2lx + 2my + 2nz + d.
\end{eqnarray}
Here, the principal matrix $A$, and matrix of the quadratic form $\tilde{A}$ are
as follows:
\begin{eqnarray}
A &=& \begin{pmatrix}
 a & h & g \\
 h & b & f \\
 g & f & c \\
\end{pmatrix} \\
\tilde{A} &=& \begin{pmatrix}
 a & h & g & l \\
 h & b & f & m\\
 g & f & c & n\\
 l & m & n & d \\
\end{pmatrix}
\end{eqnarray}
If rank($A$) = 1 and rank($\tilde{A}$) =  3, it should be parabolic pillar, and
the quadratic form becomes
\begin{eqnarray}
F(x', y', z') = \lambda x'^2 + r z'
\end{eqnarray}
but I can't show why the coefficient of $y'$ becomes zero.
--
My understanding is below.
Because rank($A$) is 1, there is a non-zero eigen value $\lambda$ and
there is a regular matrix $P$ such that
\begin{eqnarray}
A' = {}^t P A P = \begin{pmatrix}
\lambda & 0 & 0 \\  0 & 0 & 0 \\ 0 & 0 & 0\\
\end{pmatrix}.
\end{eqnarray}
Then by using variable conversion ($x',y',z'$) and constants ($p, q, r$) like
\begin{eqnarray}
\begin{pmatrix}
x' \\ y' \\ z' \\
\end{pmatrix}
= P^{-1}\begin{pmatrix}
x \\ y \\ z \\
\end{pmatrix}, \quad
\begin{pmatrix}
p \\
q \\
r \\
\end{pmatrix}
= {}^t P \begin{pmatrix}
l \\ m \\ n\\
\end{pmatrix},
\end{eqnarray}
the quadratic form becomes
\begin{eqnarray}
F(x',y',z') = \lambda x'^2 + 2 p x' + 2 q y' + 2 r z' + d
\end{eqnarray}
and the matrix of this quadratic form is
\begin{eqnarray}
\tilde{A'} =
\begin{pmatrix}
\lambda & 0 & 0 & p \\
0       & 0 & 0 & q \\
0       & 0 & 0 & r \\
p       & q & r & d \\
\end{pmatrix}.
\end{eqnarray}
If  ${\rm rank}(\tilde{A}) = 3$, ${\rm rank}(\tilde{A'})$ is also 3,
therefore either of the determinant of 3x3 minor matrix
\begin{eqnarray}
\begin{vmatrix}
\lambda & 0 & p \\
0 & 0 & r \\
p & r & d
\end{vmatrix}, \quad
\begin{vmatrix}
\lambda & 0 & p \\
0 & 0 & q \\
p & q & d
\end{vmatrix}
\end{eqnarray}
is not zero. Hence, $r$ or $q$ is not zero at least. However, I cant show either of $r, q$ is zero.


text:
Q: In the situation that i have a countably generated \sigma -algebra, can i assume the generator to have the shape of an algebra? Or, differently formulated: can a countable generator be completed to an algebra by countable set operations, while still generating the same sigma-alegbra?
since the generator not necessarily has a defined structure it's hard to imagine this should be possible. On the other hand i can't seem to find a counterexample. One idea was to find out whether there is a minimal countable generator and then fill it up with countable missing sets. The other is the converse, find a maximal countable generator and proof the algebra properties. In the first case, there are restrictions to when a minimal generator exists. Sadly i cannot afford those boundaries. In the second case, i have absolutely no idea how to find out whether finite intersections/unions or complements are included in the set, whereas if i have a maximal generator (in case of existence, I haven't found anything confirming or denying this) i have automatically the base set in the generator. Are there any ideas out there, that could help?


text:
Q: Reading local files/directories with html5 filesystem api I was wondering if it's possible to read the content of a local directory, for instance C:\temp, using the html5 filesystem api or is it only possible access files/directories in the "sandboxed area"?

A: The HTML5 file system is designed solely for sandboxed file storage, so no, you cannot use it to access files on the user's non-sandboxed file system.

A: There is the drag and drop method example at MDN which works to display the file or folder name. If it's a directory, it lists the files in the directory and subdirectories.
This works on my local web server, at this MDN page, and in this fiddle - but isn't working in the snippet below except to display the file/folder name...

let dropzone = document.getElementById("dropzone");
let listing = document.getElementById("listing");
//handle files dropped in
function scanFiles(item, container) {
  let elem = document.createElement("li");
  elem.innerHTML = item.name;
  container.appendChild(elem);

 if (item.isDirectory) {
    let directoryReader = item.createReader();
    let directoryContainer = document.createElement("ul");
    container.appendChild(directoryContainer);
    directoryReader.readEntries(function(entries) {
        entries.forEach(function(entry) {
          scanFiles(entry, directoryContainer);
      });
    });
  }
}
//prevent default dragover behavior
dropzone.addEventListener("dragover", function(event) {
    event.preventDefault();
}, false);
//handle the drop event
dropzone.addEventListener("drop", function(event) {
  let items = event.dataTransfer.items;

  event.preventDefault();
  listing.innerHTML = "";

  for (let i=0; i<items.length; i++) {
    let item = items[i].webkitGetAsEntry();

    if (item) {
        scanFiles(item, listing);
    }
  }
}, false);
#dropzone {
  text-align: center;
  width: 300px;
  height: 100px;
  margin: 10px;
  padding: 10px;
  border: 4px dashed red;
  border-radius: 10px;
}

#boxtitle {
  display: table-cell;
  vertical-align: middle;
  text-align: center;
  color: black;
  font: bold 2em "Arial", sans-serif;
  width: 300px;
  height: 100px;
}

body {
  font: 14px "Arial", sans-serif;
}

Drag files and/or directories to the box below!

    Drop Files Here

Directory tree:

https://developer.mozilla.org/en-US/docs/Web/API/FileSystemDirectoryReader/readEntries#Example


text:
Q: Why Is String XML causing nullpointerexception? I am trying to pull strings from my strings.xml when users click on an item in a ListView within a viewpager. However, I get a NullPointerException when I try to call a string from the strings.xml. For instance I construct a string "VitaminA_definition" which corresponds to string of the same name in the strings.xml. I've checked to make sure that my string is formatted & spelled correctly.
Why am I getting a NullPointerException?
case 1:
    resId = (R.layout.reference_layout);
    view = inflater.inflate(resId, null);

    vitamins_ListView = (IndexableListView)view.findViewById(R.id.herbList);
    vitaminsListresource = res.getStringArray(R.array.vitaminlist);

    vitaminsItems = new ArrayList<String>();
    Collections.addAll(vitaminsItems, vitaminsListresource);
    Collections.sort(vitaminsItems);

    ArrayAdapter<String> vitamins_adapter = new CustomListAdapter(ReferenceActivity.this, R.layout.list_item_vitamins);
    for (int i=0; i<vitaminsItems.size();i++)
        vitamins_adapter.add(vitaminsItems.get(i));
    vitamins_ListView.setAdapter(vitamins_adapter);
    vitamins_ListView.setFastScrollEnabled(true);
    vitamins_ListView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
        public void onItemClick(AdapterView<?> parent, final View view, int position, long id) {
            View toolbar = view.findViewById(R.id.vitamin_toolbar);

            String vitamin_definition = vitamins_ListView.getItemAtPosition(position).toString() + "_definition";
            String new_vitamin_definition =  vitamin_definition.replaceAll("\\s+", "").replace("'", "").replace(".", "").replace("(", "").replace(")", "");
            Log.e("vitamin_definition result", new_vitamin_definition);

            String vitamin_deficiency = vitamins_ListView.getItemAtPosition(position).toString() + "_deficiency";
            String new_vitamin_deficiency =  vitamin_deficiency.replaceAll("\\s+", "").replace("'", "").replace(".", "").replace("(", "").replace(")", "");
             Log.e("vitamin_defieciency result", new_vitamin_deficiency);

            String vitamin_herbs = vitamins_ListView.getItemAtPosition(position).toString() + "_herbs";
             String new_vitamin_herbs =  vitamin_herbs.replaceAll("\\s+", "").replace("'", "").replace(".", "").replace("(", "").replace(")", "");
            Log.e("vitamin_herbs result", new_vitamin_herbs);

            String vitamin_foods = vitamins_ListView.getItemAtPosition(position).toString() + "_foods";
            String new_vitamin_foods =  vitamin_foods.replaceAll("\\s+", "").replace("'", "").replace(".", "").replace("(", "").replace(")", "");
            Log.e("vitamin_foods result", new_vitamin_foods);

            try{
                ((TextView)view.findViewById(R.id.vitamin_description)).setText("Definition: " +(ReferenceActivity.this.getResources().getIdentifier(new_vitamin_definition, "string", ReferenceActivity.this.getApplicationInfo().packageName)));
                ((TextView)view.findViewById(R.id.vitamin_deficiency)).setText("Deficiency: " +(ReferenceActivity.this.getResources().getIdentifier(new_vitamin_deficiency, "string", ReferenceActivity.this.getApplicationInfo().packageName)));
                ((TextView)view.findViewById(R.id.vitamin_herbs)).setText("Herbs: " +(ReferenceActivity.this.getResources().getIdentifier(new_vitamin_herbs, "string", ReferenceActivity.this.getApplicationInfo().packageName)));
                ((TextView)view.findViewById(R.id.vitamin_foods)).setText("Foods: " +(ReferenceActivity.this.getResources().getIdentifier(new_vitamin_foods, "string", ReferenceActivity.this.getApplicationInfo().packageName)));
            }catch(Exception e){
                Log.e("Vitamin Info Error", "Error loading Vitamin Info >> " + e.getMessage() + " //" + e.toString());
//String Check.  All strings working here
                            Log.e("String Test", getResources().getString(R.string.VitaminA_definition).toString());
                            Log.e("String Test", getResources().getString(R.string.VitaminA_deficiency).toString());
                            Log.e("String Test", getResources().getString(R.string.VitaminA_herbs).toString());
                            Log.e("String Test", getResources().getString(R.string.VitaminA_foods).toString());
            }

            // Creating the expand animation for the item
            ExpandAnimation expandAni = new ExpandAnimation(toolbar, 500);

            // Start the animation on the toolbar
            toolbar.startAnimation(expandAni);
            }
        });

        ((ViewPager) collection).addView(view, 0);
        return view;

STRINGS.XML
 <string-array name="vitaminlist">
    <item>Vitamin A</item>
    <item>Vitmain B1 (Thiamine)</item>
    <item>Vitmain B2 (Riboflavin)</item>
    <item>Vitmain B3 (Niacin)</item>
    <item>Vitmain B4 </item>
    <item>Vitmain B5 (Pantothenic Acid)</item>
    <item>Vitmain B6 (Pyridoxine)</item>
    <item>Vitmain B12 (Cyanocobalamin, Cobalt)</item>
    <item>Vitmain B13 (Orotic Acid)</item>
    <item>Vitmain B13 (Pangamic Acid)</item>
    <item>Vitamin C (Asorbic Acid)</item>
    <item>Vitamin D (Ergosterol)</item>
    <item>Vitmain E</item>
    <item>Vitamin F (Fatty Acid)</item>
    <item>Vitamin G</item>
    <item>Vitamin H (Biotin)</item>
    <item>Vitamin K</item>
    <item>Vitamin L</item>
    <item>Vitamin P (Bioflavonoids)</item>
    <item>Vitamin P (Rutin)</item>
    <item>Vitamin T</item>
    <item>Vitamin U</item>
    <item>Choline</item>
    <item>Folic Acid (Inositol and Vitamin B)</item>
    <item>PABA(Para-Amino-Benzino-Acid)</item>
</string-array>

<string name="VitaminA_definition">Maintains health of tissue, hair; builds resistance, helps eyes, nasal passage, lungs, stress, etc.</string>
<string name="VitaminA_deficiency">Eye inflammation, weak vision, respiratory problems, skin diseases, poor sense of taste and smell, get infections easily, teeth and gum problems.</string>
<string name="VitaminA_herbs">Alfalfa, Burdock, Comfrey, Dandelion, Eyebright, Okra Pods, Paprika, Parsley, Rosehip, Watercress.</string>
<string name="VitaminA_foods">Carrots, Green Leafy Vegetables, Melons, Tomatoes, Yams, Fruits.</string>

Here's the logcat:
 06-17 08:53:02.328: E/vitamin_definition result(13309): VitaminA_definition
 06-17 08:53:02.328: E/vitamin_defieciency result(13309): VitaminA_deficiency
 06-17 08:53:02.336: E/vitamin_herbs result(13309): VitaminA_herbs
 06-17 08:53:02.336: E/vitamin_foods result(13309): VitaminA_foods
 06-17 08:53:02.336: W/System.err(13309): java.lang.NullPointerException
 06-17 08:53:02.344: W/System.err(13309):   at com.bryanjrichardson.VITALITY.ReferenceActivity$MyPagerAdapter$2.onItemClick(ReferenceActivity.java:398)
 06-17 08:53:02.344: W/System.err(13309):   at android.widget.AdapterView.performItemClick(AdapterView.java:292)
 06-17 08:53:02.344: W/System.err(13309):   at android.widget.AbsListView.performItemClick(AbsListView.java:1082)
 06-17 08:53:02.344: W/System.err(13309):   at android.widget.AbsListView$PerformClick.run(AbsListView.java:2635)
 06-17 08:53:02.344: W/System.err(13309):   at android.widget.AbsListView$1.run(AbsListView.java:3306)
 06-17 08:53:02.344: W/System.err(13309):   at android.os.Handler.handleCallback(Handler.java:605)
 06-17 08:53:02.344: W/System.err(13309):   at android.os.Handler.dispatchMessage(Handler.java:92)
 06-17 08:53:02.344: W/System.err(13309):   at android.os.Looper.loop(Looper.java:137)
 06-17 08:53:02.344: W/System.err(13309):   at android.app.ActivityThread.main(ActivityThread.java:4722)
 06-17 08:53:02.344: W/System.err(13309):   at java.lang.reflect.Method.invokeNative(Native Method)
 06-17 08:53:02.344: W/System.err(13309):   at java.lang.reflect.Method.invoke(Method.java:511)
 06-17 08:53:02.352: W/System.err(13309):   at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:787)
 06-17 08:53:02.352: W/System.err(13309):   at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:554)
 06-17 08:53:02.352: W/System.err(13309):   at dalvik.system.NativeStart.main(Native Method)
 06-17 08:53:02.352: E/Vitamin Info Error(13309): Error loading Vitamin Info >> null //java.lang.NullPointerException


text:
Q: Sqoop: Import with --split-by using sql function I am sorry if this has been answered earlier but i am not able to find it here on Stack Overflow.
My source Mysql tables are having PK as Varchar and while import it's brining in duplicates which is not good, I dont want to use -m 1 since the tables are around 50GB each so i am trying to give in the split by option on a column that i know is defined as varchar but its an INT like below
I am on sqoop 1.4.7 on EMR 5.14.0
sqoop import -Dorg.apache.sqoop.splitter.allow_text_splitter=true \
--connect jdbc:mysql://host/jslice \
--username=*** --password *** --table orders --fields-terminated-by '|' \
--lines-terminated-by '\n' --null-non-string "\\\\N" --null-string
"\\\\N" --escaped-by '\' \
--optionally-enclosed-by '\"' --map-column-java dwh_last_modified=String
--hive-drop-import-delims \
--as-parquetfile -m 16 --compress --compression-codec
org.apache.hadoop.io.compress.SnappyCodec --delete-target-dir \
--target-dir hdfs:///hive/warehouse/jslice/orders/text3/ --split-by
'cast(order_number as UNSIGNED)'

Internally sqoop builds the boundary query as
INFO db.DataDrivenDBInputFormat: BoundingValsQuery: SELECT
MIN(`cast(order_number as UNSIGNED)`), MAX(`cast(order_number as
UNSIGNED)`) FROM `archive_orders`

and throws an error
ERROR tool.ImportTool: Encountered IOException running import job:
java.io.IOException: java.sql.SQLSyntaxErrorException: (conn=472029)
Unknown column 'cast(order_number as UNSIGNED)' in 'field list'

I have seen posts that says we can pass in sql functions on the split-by but i want to make sure if it really works
Note I have tried with " " as well and the cast command with back ticks
https://community.hortonworks.com/questions/146261/sql-function-in-split-by.html
https://community.cloudera.com/t5/Data-Ingestion-Integration/Sqoop-split-by-date-wants-to-compare-a-timestamp-with/m-p/69668#M3159


text:
Q: How can I connect My asp.net web app with another asp.net mvc Project I have one asp.net web app solution and one asp.net mvc project what i want is to make some connection b/n this solutions using button or some link i tried this one but it didnt work
protected void Button1_Click(object sender, EventArgs e)
{
    Response.Redirect("http://localhost:36321/Dashboard");
}


text:
Q: R: how to add volumes from date time I have the following data:
 df <-
Session    Volume                    StartTime                 EndTime
1         27,75          2016-01-22 17:00:33.707  2016-01-27 06:02:54.900
2         10,78          2016-01-22 14:31:22.127  2016-01-23 15:01:20.997
3         15,88          2016-01-27 12:46:18.660  2016-01-27 15:01:23.250
4         46,10          2016-01-25 16:01:34.613  2016-01-25 21:46:35.477
5         94,60          2016-01-27 05:38:06.597  2016-01-27 06:08:06.027
6         15,93          2016-01-20 16:15:59.350  2016-01-21 06:06:43.933

I want to add the data for each day ( on Starttime) to receive a dataset with the total volume of all sessions for each day, so that I can plot the volume over time. E.g. on the 22th of januari 2016 a total of 38.53 has charged.
So that
dfnew <-
 Day            TotalVolume
2016-01-22    38.53
2016-01-25    46.10
2016-01-27    110.48
 etc.

What is the most efficient way to do this?

A: With data table
library(data.table)
df[,StartTime := as.POSIXct(StartTime)]
df[,sum(Volume), by = as.Date(df$StartTime)]

      as.Date     V1
1: 2016-01-22  38.53
2: 2016-01-27 110.48
3: 2016-01-25  46.10
4: 2016-01-20  15.93

and with dplyr
library(dplyr)
df %>%
  mutate(StartTime = as.POSIXct(StartTime)) %>%
  group_by(as.Date(StartTime)) %>%
  summarise(sum(Volume))

Here are the data:
df <- as.data.table(read.table(text = "
  Session;    Volume;                    StartTime;                 EndTime
1;         27,75;          2016-01-22 17:00:33.707;  2016-01-27 06:02:54.900
2;         10,78;          2016-01-22 14:31:22.127;  2016-01-23 15:01:20.997
3;         15,88;          2016-01-27 12:46:18.660;  2016-01-27 15:01:23.250
4;         46,10;          2016-01-25 16:01:34.613;  2016-01-25 21:46:35.477
5;         94,60;          2016-01-27 05:38:06.597;  2016-01-27 06:08:06.027
6;         15,93;          2016-01-20 16:15:59.350;  2016-01-21 06:06:43.933",header = T,sep = ";",dec = ","))

A: I prepared a small reproducible example. Is this what you would like?
library(lubridate)
library(dplyr)
df=tibble(Volume=c(27.75,10.78,15.88,46.1,94.60,15.93),
          StartTime=c("2016-01-22 17:00:33.707","2016-01-22 14:31:22.127",
          "2016-01-27 12:46:18.660","2016-01-25 16:01:34.613","2016-01-27 05:38:06.597","2016-01-20 16:15:59.350"))

df <-df%>%
  mutate(StartTime=ymd_hms(StartTime))%>%
  mutate(StartTime=floor_date(StartTime,unit="day"))%>%
  group_by(StartTime)%>%dplyr::summarize(Volume=sum(Volume))

            > df
            # A tibble: 4 x 2
              StartTime           Volume
              <dttm>               <dbl>
            1 2016-01-20 00:00:00   15.9
            2 2016-01-22 00:00:00   38.5
            3 2016-01-25 00:00:00   46.1
            4 2016-01-27 00:00:00  110


text:
Q: Issue with Array subtraction in Powershell I have two CSVs as following:
A
20180809000
20180809555
20180809666
20180809777
20180809888

File2:
A
20180809000
20180809555
20180809666
20180809777

I want to find difference of File1 - File2 which should output 20180809888. I tried the following:
$a1= Import-Csv -Path $file1 | select A

$a2 = Import-Csv -Path $file2 | select A

$a1| where {$a2 -notcontains $_}

But it outputs the entire file 1:
A
--------------
20180809000
20180809555
20180809666
20180809777
20180809888

I tried intersection also, but that outputs null.

A: The simplest solution is to use:
> Compare-Object (Get-Content .\File1.csv) (Get-Content .\File2.csv) -PassThru
20180809888

Or using Import-Csv
> Compare-Object (Import-Csv .\File1.csv).A (Import-Csv .\File2.csv).A -Passthru
20180809888

Or
> (Compare-Object (Import-Csv .\File1.csv) (Import-Csv .\File2.csv) -Passthru).A
20180809888

A: Your last line should be the following:
$a1.A.where{$_ -notin $a2.A}

To preserve the column, you can do the following for the last line:
$a1.where{$_.A -notin $a2.A}

The problem with this situation is that if the second file has more data than the first file. Then you would need to do something like this for your last line:
$a1 | compare $a2 | select -expand inputobject

A: select A will still return an object with a property named A.
# Returns an object list with property A
Import-Csv -Path $file | select A # (shorthand for Select-Object -Property A)
# A
# ---
# value1
# value2
# ...

You can get the array of values of property A using dot notation, e.g.:
# Returns the list of values of the A property
(Import-Csv -Path $file).A
# value1
# value2
# ...

The following should work:
$a1= (Import-Csv -Path $file1).A
$a2 = (Import-Csv -Path $file2).A
$a1 | where {$a2 -notcontains $_}