text:
Q: Creating box with notches in the middle (without any images) Is it possible to create a box like the one below with notches in the center of the top and bottom line? (including the border inset?)

A: Here's a Working Fiddle Tested On: Ie10, FF, Chrome, Safari
just put your content inside the .Content div. (should support any size of content)
HTML:

        Some Content

        And another line of Content

CSS:
*
{
    margin: 0;
    padding: 0;
}

.SpecialBox
{
    background-color: black;
    -webkit-box-shadow: inset 0 0 0 5px black, inset 0 0 0 6px gray;
    box-shadow: inset 0 0 0 5px black, inset 0 0 0 6px gray;
    display: inline-block;
    color: white;
    overflow: hidden;
    position: relative;
}
.Content
{
    padding: 20px;
}

.Border
{
    width: 0;
    border-left: 35px solid transparent;
    border-right: 35px solid transparent;
    position: absolute;
}

.Gray
{
    position: relative;
    margin: 0 auto;
}
.TopTriangle .Gray
{
    border-top: 25px solid gray;
}
.BottomTriangle .Gray
{
    border-bottom: 25px solid gray;
    top: -1px;
}

.Black
{
    left: -35px;
}
.TopTriangle .Black
{
    border-top: 25px solid black;
    top: -27px;
}
.BottomTriangle .Black
{
    border-bottom: 25px solid black;
    top: 1px;
}

.Black:before
{
    content: '';
    position: absolute;
    left: -35px;
    width: 70px;
    height: 6px;
    background-color: black;
}
.TopTriangle .Black:before
{
    top: -24px;
}
.BottomTriangle .Black:before
{
    top: 19px;
    z-index: 1;
}

.White
{
    left: -35px;
}
.TopTriangle .White
{
    border-top: 25px solid white;
    top: -30px;
}
.BottomTriangle .White
{
    border-bottom: 25px solid white;
    top: 6px;
    z-index: 2;
}

Notice: It can probably done with few elements in the DOM (using more pseudo elements)

A: Trying to do it with minimal markup , and the notches and the inset transparent:
CSS
.test {
    position: absolute;
    width: 200px;
    height: 400px;
    top: 40px;
    left: 40px;
    background-image: linear-gradient(-135deg, transparent 30px, black 30px),
    linear-gradient(135deg, transparent 30px, black 30px),
    linear-gradient(-45deg, transparent 30px, black 30px),
    linear-gradient(45deg, transparent 30px, black 30px),
    radial-gradient(200px 5px ellipse at 50% 50%, transparent 70px,
               black 73px);
    background-size: 50% 20%, 50% 20%, 50% 72%, 50% 72%, 100% 10%;
    background-position: left top, right top, left bottom, right bottom, left 20%;
    background-repeat: no-repeat;
}

And, as promised, a simple HTML

fiddle
NOTE: the example uses the latest gradient syntax. Can be made to work in any browser that supports multiple backgrounds, adapting the gradient syntax

A: This solution is using an image (a very wide one) to cover all the possible width that a box will ever take. and using border-image. (Currently not supported in IE)
HTML:

        Some Content

CSS:
.SpecialBorder
{
    border: 20px solid black; /* fallback for IE*/
    -moz-border-image: url(http://i.stack.imgur.com/ZB9vk.png) 20 20 repeat;
    -o-border-image: url(http://i.stack.imgur.com/ZB9vk.png) 20 20 repeat;
    -webkit-border-image: url(http://i.stack.imgur.com/ZB9vk.png) 20 20 repeat;
    border-image: url(http://i.stack.imgur.com/ZB9vk.png) 20 20 repeat;

}
.Content
{
    background-color: #1d1d1d; /* same BG as the image*/
}

Working Fiddle


text:
Q: Does webpack make projects bigger? I started using webpack with my existing project and the bundle it generates is much bigger in size than before webpack.
I am using all the optimisations I can think of and still it's around 60% bigger than before.
I don't know what I am doing wrong.
my config:
'use strict';

// Modules
var webpack = require('webpack');
var autoprefixer = require('autoprefixer');
var HtmlWebpackPlugin = require('html-webpack-plugin');
//var jQueryPlugin = require('jquery');
var ExtractTextPlugin = require('extract-text-webpack-plugin');
//var Promise = require('es6-promise-polyfill').Promise;

module.exports = function makeWebpackConfig (options) {
    /**
     * BUILD is for generating minified builds
     */
    var BUILD = !!options.BUILD;

    var config = {};

    config.entry = {
        app: './app.js',
        iosCordova: ['./static/wrapper-resources/js/ios/cordova_all.js'],
        androidCordova: ['./static/wrapper-resources/js/android/cordova_all.js']
    };

    /**
     * Output
     */
    config.output = {
        // Absolute output directory
        path: __dirname + '/public',

        // Output path from the view of the page
        // Uses webpack-dev-server in development
        publicPath: 'http://localhost:8080/',

        filename: '[name].bundle.js',

        // non-entry

        chunkFilename: '[name].bundle.js'
    };
    if (BUILD) {
        config.devtool = 'source-map';
    } else {
        config.devtool = 'eval';
    }

    /**
     * Loaders
     */
    config.module = {
        noParse: /node_modules\/html2canvas/,
        preLoaders: [],
        loaders: [
            {
                // JS LOADER
                test: /\.js$/,
                loader: 'babel?optional[]=runtime,cacheDirectory',
                presets: ['es2015'],
                plugins: ['transform-runtime'],
                exclude: [/node_modules/,
                    /cordova_all/
                ]
            },
            {
                test: /\.(png|jpg|jpeg|gif|svg|woff|woff2|ttf|eot)$/,
                loader: 'file?name=[name].[ext]'
                //loader: 'url-loader'
            }, {
                test: /\.html$/,
                loader: 'raw'
            }]
    };

    var cssLoader = {
        test: /\.css$/,
        loader: ExtractTextPlugin.extract('style', 'css?sourceMap!postcss', 'scss', 'sass')
    };
    config.module.loaders.push(cssLoader);

    config.postcss = [
        autoprefixer({
            browsers: ['last 2 version']
        })
    ];

    /**
     * Plugins
     */
    config.plugins = [

        // Extract css files
        new ExtractTextPlugin('[name].css')
        ,
        new webpack.ProvidePlugin({
            $: "jquery",
            jQuery: "jquery",
            "window.jQuery": "jquery"
        })
    ];

    // build specific plugins
    if (BUILD) {
        config.plugins.push(
            new webpack.NoErrorsPlugin(),

            new webpack.optimize.DedupePlugin(),
            // Minify all javascript, switch loaders to minimizing mode
            new webpack.optimize.UglifyJsPlugin()
        )
    }

    /**
     * Dev server configuration
     */
    config.devServer = {
        contentBase: './public',
        stats: {
            modules: false,
            cached: false,
            colors: true,
            chunk: false
        }
    };

    return config;
};

A: I figured it out.  When importing I didn't import the minified version of node modules.  I guess webpack's minification and uglification just doesn't cut it.
Thanks for the helpers.

redpajama_set_name: RedPajamaStackExchange


text:
Q: How can I debug a ipa to find if bluetooth api is used or not? My app was rejected by apple. Apple replied that I am missing Bluetooth Usage Description in my info.plist. But I didn't used bluetooth function in my code, and didn't use any bluetooth api. I guess maybe some third-party framework used it. I have tried the following: I used otool to check all linked system framework, didn't find CoreBluetooth.framework used.
I have searched globally in my code, but found nothing about bluetooth. So how can I further debug the ipa? And how can I find which third-party framework used bluetooth api?


text:
Q: creating form for wp_remote_post i'm using code from the wordpress codex: (this is the generic version, my code is working though)
$response = wp_remote_post( $url, array(
    'method' => 'POST',
    'timeout' => 45,
    'redirection' => 5,
    'httpversion' => '1.0',
    'blocking' => true,
    'headers' => array(),
    'body' => array( 'name' => 'bob', 'email' => 'bob@example.com' ),
    'cookies' => array()
    )
);

if ( is_wp_error( $response ) ) {
   $error_message = $response->get_error_message();
   echo "Something went wrong: $error_message";
} else {
   echo 'Response:<pre>';
   print_r( $response );
   echo '</pre>';
}

I'm trying to figure out how to have a form that users can input their name and email address and then it will submit to us to be added to a newsletter.
So basically i want to have the body entries be dynamic
I was thinking a form like this:
<form name="getUserInfo" action="NOT SURE WHAT GOES HERE" method="post">
  <input type="text" name="name" />
  <input type="email" name="email" />
  <input type="submit" name="submit" value="submit"/>
</form>

but i don't know how to send that to the code
i believe it's along this method where i change this line:
'body' => array( 'name' => 'bob', 'email' => 'bob@example.com' ),

to
'body' => array( 'name' => '$namefromform', 'email' => '$emailfromform' ),

i know i'm missing something but i'm not sure.
Generally speaking i'd like this to run as a widget to make my newsletter signup in the footer of the site.
If anyone is wondering why i need an api for this, it is because the company i'm helping create the website for sends all their contacts to a larger 3rd party contact management system.

A: You could make the form action be the current page's URL. When the user submits the form the page gets reloaded with the POST parameters. Then in your widget's code you check if those parameters exist. If so, you check them and then process them with your wp_remote_post.
Personally I use Gravity Forms for stuff like this. I create the form in Gravity and then add code to the gform_after_submission hook to process the form entry. It's an easy option because it takes care of the rest of the form functionality (if you can afford the license).

A: I figured out what I was missing.  May have been simple to some but it's worth posting in case someone else has a similar question.  I set the post information from the form to variables and then assigned them in wp_remote_post.
I first re-did my form to add specific names to it:
<form name="getUserInfo" action="' . esc_url( $_SERVER['REQUEST_URI'] ) . '" method="post">
  <input type="text" name="name" />
  <input type="email" name="email" />
  <input type="submit" name="submit" value="submit"/>
</form>

then I assigned variables based on the form data.
    $name    = sanitize_text_field( $_POST["rt-name"] );
    $email   = sanitize_email( $_POST["rt-email"] );

They were added in place of the body line in my original question:
'body' => array( 'name' => '$name', 'email' => '$email' ),

Then i added an if/then statement around my wp_remote_post:
 if ( isset( $_POST['rt-submitted'] ) ) {  wp_remote_post here }

so that it only runs if post info from the form is present.
works perfectly.
credit in part goes to this post as well:
shortcode doesn't work


text:
Q: Parameter of 'messaging(_:didReceiveRegistrationToken:)' has different optionality than required by protocol 'MessagingDelegate' This happens to me when I try to compile my app in XCode, in android it runs perfect, but there, it fails with that, this is the function that I use directly from Firebase cloud.
func messaging(_ messaging: Messaging, didReceiveRegistrationToken
fcmToken: String) {
print("Firebase registration token: \(fcmToken)")

let dataDict:[String: String] = ["token": fcmToken]
NotificationCenter.default.post(name: Notification.Name("FCMToken"),
object: nil, userInfo: dataDict)
// TODO: If necessary send token to application server.
// Note: This callback is fired at each app startup and whenever a
new
token is generated.
}

This is where the error mentioned in the title of my question marks me, if someone has happened to him and he can give me a hand, since I have not seen a similar error here.

A: In addition to @Rashid's answer, you will also need to update the dataDict within the messaging function.
Simply add ?? ""
func messaging(_ messaging: Messaging, didReceiveRegistrationToken fcmToken: String?) {
  print("Firebase registration token: \(String(describing: fcmToken))")

  let dataDict:[String: String] = ["token": fcmToken ?? ""]
  NotificationCenter.default.post(name: Notification.Name("FCMToken"), object: nil, userInfo: dataDict)
  // TODO: If necessary send token to application server.
  // Note: This callback is fired at each app startup and whenever a new token is generated.
}

This is straight from the documentation: https://firebase.google.com/docs/cloud-messaging/ios/client

A: With the latest Firebase Messaging (7.0.0), the function has been updated to have optional fcmToken. Updating it to following would help:
func messaging(_ messaging: Messaging, didReceiveRegistrationToken fcmToken: String?)

A: Try this:
optional func messaging(_ messaging: Messaging, didReceiveRegistrationToken fcmToken: String?) {


text:
Q: Superuser Role Specific to certain Databases in PostgreSQL I have created a User Role with superuser privilege. I have around 30 Databases on my server. I want to assign this role to only only DB. The current role lets the user access all the DBs as super user. How can I restrict him from accessing other DBs as super user.
This is the that I have for assigning superuser:
CREATE ROLE fc LOGIN
   SUPERUSER INHERIT NOCREATEDB NOCREATEROLE NOREPLICATION;

Can someone help me with this?

A: As @Craig explained, you can't (and even if you could, it would be fairly pointless).
The usual way of implementing restricted superuser permissions is to connect as an existing superuser role, and create SECURITY DEFINER functions containing a limited set of approved commands. These functions will now be executed with the privileges of the creator rather than the caller.
But you need to be very careful not to open any injection vulnerabilities, because everything within the function will be run as superuser. E.g. the caller could write a custom = operator which grants them superuser rights, and put it in their search path, so you need to be absolutely sure that you're using the = in the pg_catalog schema.
At the very least, you should:

*

*Create all of these functions with the clause SECURITY DEFINER SET search_path TO pg_catalog, pg_temp. The pg_temp schema must always be included at the end of the list (if omitted, it will be implicitly included at the start).

*Schema-qualify any other tables, functions, etc. that your function references (e.g. public.MyTable instead of just MyTable), and make sure that all of these are superuser-owned (so that callers can't put malicious code in triggers, etc.).

*Never put user input in a dynamic query string (EXECUTE 'SELECT ...') without exhaustive validation.

A: There is no facility in PostgreSQL for a database-specific superuser.
It would not make sense anyway, since generally operations that are superuser-only are things that permit relatively easy escalation to greater control over the database system.


text:
Q: How to find senders Bitcoin Address in BitcoinJ after receiving a transaction So in my app I have the following functionality for receiving bitcoins
kit.wallet().addCoinsReceivedEventListener(new WalletCoinsReceivedEventListener() {
            @Override
            public void onCoinsReceived(Wallet wallet, Transaction tx, Coin prevBalance, Coin newBalance) {
                txtLog.append("-----> coins resceived: " + tx.getHashAsString() + "\n");
                txtLog.append("received: " + tx.getValue(wallet) + "\n");

            Futures.addCallback(tx.getConfidence().getDepthFuture(1), new FutureCallback<TransactionConfidence>() {
                @Override
                public void onSuccess(TransactionConfidence result) {
                    txtLog.append("\nSuccess! Recieved: " + tx.getValue(wallet) + "\n");
                    //Find address of sender here
                }

                @Override
                public void onFailure(Throwable t) {
                    throw new RuntimeException(t);
                }
            });
        }
    });

This works great, OnSuccess triggers properly once a transaction is confirmed and added to my wallet. txtLog is just a textArea in my java frame which displays some text output for me. What I need to do now is find the address of the sender at this point, can i do this with the Transaction object tx? Any help would be appreciated.

A: Found the solution! Unfortunately it uses a depreciated method. I just added the following in the appropriate spot.
String address = "";
for (TransactionInput txin : tx.getInputs()){
    address = txin.getFromAddress().toString();
}


text:
Q: Apply currency format on ion input I want to put a currency format on an ion input but angular directives doesn't work as they do on HTML input Ion-Input not working with directives but regular input does.
So I've been trying to do something like they said in here Input currency mask - IONIC  and here Ion-Input currency format but none of them works for me.
One problem is that I have a programmatically generated form, the structure comes from a service like this:
    value: 20000,
    key: varKey,
    label: varLabel,
    required: true,
    order: 0,
    controlType: 'textbox',
    type: 'number',
    formula: 'return other_var + 50',
    dependencies: ['other_var'],
    category: 'varCategory'

So some input changes makes other value to changes, if other_var changes (the user types a new value in the input) varKey needs to be recalculated according to the formula property. This is how I create the input:
<ion-input [id]="key" [formControlName]="key" [type]="type" [ngModel]="value |  currency:'USD':'symbol-narrow'"
 (ngModelChange)="formValueChanges($event,key)" text-right></ion-input>

This gives me this error InvalidPipeArgument: '$20,000.00' for pipe 'CurrencyPipe'. So I imported the CurrencyPipe into my component to do something like this (following the Ion-input currency format post):
<ion-input [id]="key" [formControlName]="key" [type]="type" [ngModel]="getCurrencyFormat(value)"
 (ngModelChange)="formValueChanges($event,key)" text-right></ion-input>

And the getCurrencyFormat function is this:
getCurrencyFormat(value: number): string {
    if (value) {
      console.log('Input value: ', value)
      if (!value.toString().includes('$')) {
        return this.currencyPipe.transform(value, 'USD', true, '1.2-2');
      }
    }
  }

This doesn't give me any errors but none of the values are displayed.
The formValueChanges function binds the typed value with the model and recalculate the values that has been affected.
At this point I don't know how to apply a currency format to an input without creating a cycle, because the function that applies the format triggers the function that recalculated the values.


text:
Q: Background Image causing memory warning and crash during UITesting I have a simple UITest which taps an item on the tool bar 100 times, running the test with no background image consistently passes, however when I add a background image I receive memory warnings followed by the test failing. I've tried numerous solutions for displaying the image, most all of them cause the same result, memory warnings followed by a crash. I have an image set consisting of three png images sized at 3X: 2304 X 3072, 2X: 1536 X 2048, and 1X: 768 X 1024, as per apple docs. How can I add a background image so that it wont cause memory issues.
UITesting Code:
func testJustNumberOfRolls() {
    let app = XCUIApplication()
    for _ in 1...100 {
        app.toolbars.buttons["Tip2"].tap()
    }
}

ViewController:
class TestVC: UIViewController {

    override func viewDidLoad() {
        super.viewDidLoad()
        if let image = UIImage(named: "feltSized") {
            self.view.backgroundColor = UIColor(patternImage: image)
        }
    }
}

Test Logs:
11:10:49.317 XCTRunner[6768:2874277] -[TestingUIActual

testJustNumberOfRolls] started activity <XCActivityRecord: 0x1314a5ab0> 2015-12-11 17:10:49 +0000: Wait for app to idle
11:10:49.528 XCTRunner[6768:2874277] Waiting for app quiescence...
11:10:49.529 XCTRunner[6768:2874357] <XCUIApplicationProcess: 0x12fe466a0 mikepland.crapsBuzzInSwift (6775)> event loop is idle 1 -> 0
11:10:49.529 XCTRunner[6768:2874357] <XCUIApplicationProcess: 0x12fe466a0 mikepland.crapsBuzzInSwift (6775)> hasReceivedAnimationsHaveFinished 1 -> 0
11:10:49.530 XCTRunner[6768:2874357] <XCUIApplicationProcess: 0x12fe466a0 mikepland.crapsBuzzInSwift (6775)> event loop is idle 1 -> 0
11:10:49.531 XCTRunner[6768:2874357] <XCUIApplicationProcess: 0x12fe466a0 mikepland.crapsBuzzInSwift (6775)> hasReceivedAnimationsHaveFinished 1 -> 0
11:10:49.535 XCTRunner[6768:2874320] Got AX notification 4002
11:10:49.536 XCTRunner[6768:2874320] Got animations reply.
11:10:49.536 XCTRunner[6768:2874320] Animations are not active.
11:10:49.537 XCTRunner[6768:2874320] Got AX notification 4002
11:10:49.537 XCTRunner[6768:2874322] <XCUIApplicationProcess: 0x12fe466a0 mikepland.crapsBuzzInSwift (6775)> hasReceivedAnimationsHaveFinished 0 -> 1
11:10:49.538 XCTRunner[6768:2874320] Got event loop idle reply.
11:10:49.539 XCTRunner[6768:2874320] Event loop is idle.
11:10:49.538 XCTRunner[6768:2874322] <XCUIApplicationProcess: 0x12fe466a0 mikepland.crapsBuzzInSwift (6775)> event loop is idle 0 -> 1
11:10:49.540 XCTRunner[6768:2874322] <XCUIApplicationProcess: 0x12fe466a0 mikepland.crapsBuzzInSwift (6775)> hasReceivedAnimationsHaveFinished 0 -> 1
11:10:49.541 XCTRunner[6768:2874322] <XCUIApplicationProcess: 0x12fe466a0 mikepland.crapsBuzzInSwift (6775)> event loop is idle 0 -> 1
11:10:49.542 XCTRunner[6768:2874277] App has quiesced.
11:10:49.542 XCTRunner[6768:2874277] -[TestingUIActual testJustNumberOfRolls] finished activity <XCActivityRecord: 0x1314a5ab0> 2015-12-11 17:10:49 +0000: Wait for app to idle (0.225394s)
11:10:49.550 XCTRunner[6768:2874277] -[TestingUIActual testJustNumberOfRolls] finished activity <XCActivityRecord: 0x1314a2970> 2015-12-11 17:10:49 +0000: Find the "Tip2" Button (0.298589s)
11:10:49.553 XCTRunner[6768:2874277] -[TestingUIActual testJustNumberOfRolls] started activity <XCActivityRecord: 0x1314abf80> 2015-12-11 17:10:49 +0000: Synthesize event
11:10:49.966 XCTRunner[6768:2874320] Got AX notification 4002
11:10:49.967 XCTRunner[6768:2874320] Got event completion.
11:10:49.969 XCTRunner[6768:2874277] -[TestingUIActual testJustNumberOfRolls] finished activity <XCActivityRecord: 0x1314abf80> 2015-12-11 17:10:49 +0000: Synthesize event (0.416638s)
11:10:49.973 XCTRunner[6768:2874320] Got AX notification 4002
11:10:49.988 XCTRunner[6768:2874277] -[TestingUIActual testJustNumberOfRolls] started activity <XCActivityRecord: 0x1315415e0> 2015-12-11 17:10:49 +0000: Wait for app to idle
11:10:50.197 XCTRunner[6768:2874277] Waiting for app quiescence...
11:10:50.198 XCTRunner[6768:2874358] <XCUIApplicationProcess: 0x12fe466a0 mikepland.crapsBuzzInSwift (6775)> event loop is idle 1 -> 0
11:10:50.198 XCTRunner[6768:2874358] <XCUIApplicationProcess: 0x12fe466a0 mikepland.crapsBuzzInSwift (6775)> hasReceivedAnimationsHaveFinished 1 -> 0
11:10:50.199 XCTRunner[6768:2874358] <XCUIApplicationProcess: 0x12fe466a0 mikepland.crapsBuzzInSwift (6775)> event loop is idle 1 -> 0
11:10:50.200 XCTRunner[6768:2874358] <XCUIApplicationProcess: 0x12fe466a0 mikepland.crapsBuzzInSwift (6775)> hasReceivedAnimationsHaveFinished 1 -> 0
11:10:50.204 XCTRunner[6768:2874358] Got AX notification 4002
11:10:50.204 XCTRunner[6768:2874358] Got event loop idle reply.
11:10:50.205 XCTRunner[6768:2874358] Event loop is idle.
11:10:50.205 XCTRunner[6768:2874567] <XCUIApplicationProcess: 0x12fe466a0 mikepland.crapsBuzzInSwift (6775)> hasReceivedAnimationsHaveFinished 0 -> 1
11:10:50.206 XCTRunner[6768:2874567] <XCUIApplicationProcess: 0x12fe466a0 mikepland.crapsBuzzInSwift (6775)> event loop is idle 0 -> 1
11:10:50.437 XCTRunner[6768:2874358] Got AX notification 4002
11:10:50.438 XCTRunner[6768:2874358] Got animations reply.
11:10:50.442 XCTRunner[6768:2874358] Animations are not active.
11:10:50.443 XCTRunner[6768:2874567] <XCUIApplicationProcess: 0x12fe466a0 mikepland.crapsBuzzInSwift (6775)> hasReceivedAnimationsHaveFinished 0 -> 1
11:10:50.444 XCTRunner[6768:2874567] <XCUIApplicationProcess: 0x12fe466a0 mikepland.crapsBuzzInSwift (6775)> event loop is idle 0 -> 1
11:10:50.446 XCTRunner[6768:2874277] App has quiesced.
11:10:50.447 XCTRunner[6768:2874277] -[TestingUIActual testJustNumberOfRolls] finished activity <XCActivityRecord: 0x1315415e0> 2015-12-11 17:10:49 +0000: Wait for app to idle (0.459272s)
11:10:50.460 XCTRunner[6768:2874277] -[TestingUIActual testJustNumberOfRolls] finished activity <XCActivityRecord: 0x13149e5f0> 2015-12-11 17:10:49 +0000: Tap "Tip2" Button (1.4335s)
11:10:50.464 XCTRunner[6768:2874277] -[TestingUIActual testJustNumberOfRolls] started activity <XCActivityRecord: 0x1314af0f0> 2015-12-11 17:10:50 +0000: Tap "Tip2" Button
11:10:50.466 XCTRunner[6768:2874277] -[TestingUIActual testJustNumberOfRolls] started activity <XCActivityRecord: 0x131544810> 2015-12-11 17:10:50 +0000: Wait for app to idle
11:10:50.669 XCTRunner[6768:2874277] Waiting for app quiescence...
11:10:50.669 XCTRunner[6768:2874567] <XCUIApplicationProcess: 0x12fe466a0 mikepland.crapsBuzzInSwift (6775)> event loop is idle 1 -> 0
11:10:50.670 XCTRunner[6768:2874567] <XCUIApplicationProcess: 0x12fe466a0 mikepland.crapsBuzzInSwift (6775)> hasReceivedAnimationsHaveFinished 1 -> 0
11:10:50.670 XCTRunner[6768:2874567] <XCUIApplicationProcess: 0x12fe466a0 mikepland.crapsBuzzInSwift (6775)> event loop is idle 1 -> 0
11:10:50.671 XCTRunner[6768:2874567] <XCUIApplicationProcess: 0x12fe466a0 mikepland.crapsBuzzInSwift (6775)> hasReceivedAnimationsHaveFinished 1 -> 0
11:10:50.676 XCTRunner[6768:2874356] Got AX notification 4002
11:10:50.676 XCTRunner[6768:2874356] Got animations reply.
11:10:50.677 XCTRunner[6768:2874356] Animations are not active.
11:10:50.677 XCTRunner[6768:2874567] <XCUIApplicationProcess: 0x12fe466a0 mikepland.crapsBuzzInSwift (6775)> hasReceivedAnimationsHaveFinished 0 -> 1
11:10:50.677 XCTRunner[6768:2874567] <XCUIApplicationProcess: 0x12fe466a0 mikepland.crapsBuzzInSwift (6775)> event loop is idle 0 -> 1
11:10:50.679 XCTRunner[6768:2874320] Got AX notification 4002
11:10:50.679 XCTRunner[6768:2874320] Got event loop idle reply.
11:10:50.680 XCTRunner[6768:2874320] Event loop is idle.
11:10:50.680 XCTRunner[6768:2874357] <XCUIApplicationProcess: 0x12fe466a0 mikepland.crapsBuzzInSwift (6775)> hasReceivedAnimationsHaveFinished 0 -> 1
11:10:50.681 XCTRunner[6768:2874357] <XCUIApplicationProcess: 0x12fe466a0 mikepland.crapsBuzzInSwift (6775)> event loop is idle 0 -> 1
11:10:50.682 XCTRunner[6768:2874277] App has quiesced.
11:10:50.682 XCTRunner[6768:2874277] -[TestingUIActual testJustNumberOfRolls] finished activity <XCActivityRecord: 0x131544810> 2015-12-11 17:10:50 +0000: Wait for app to idle (0.216641s)
11:10:50.718 Xcode[1265:207640] Test operation failure: Lost connection to test manager service.
11:10:50.719 Xcode[1265:207640] _finishWithError:Error Domain=IDETestOperationsObserverErrorDomain Code=4 "Lost connection to test manager service." UserInfo={NSLocalizedDescription=Lost connection to test manager service.} didCancel: 1

A: UPDATE: I tried not displaying ANY images, this seems to be better. Error shows up at 'lost connection to test manager services'.
At this point I have refactored my app to avoid long animations to avoid needing a timeout on my tests, then recoded app to hide ALL images and background colors. Even then the error still shows up, although tests are able to run for longer.
I was able to replicate on a brand new app with just a background pattern and a button, even that was causing the error if running tests for more than a few minutes, and thats a BRAND NEW APP. So idk what else to do, hopefully this will be fixed soon.


text:
Q: Error when filling a TextInput for a Graph with a 0 or a null Every time I enter "0" for the "Eigenverbrauch in kWh" input field from the code below, I get the following error message: TypeError: data[0].toFixed is not a function. (In 'data[0].toFixed(decimalPlaces)', 'data[0].toFixed' is undefined).
It does not seem like the Calculate function is the problem because when I remove it from the code, the issue persists.
function Graph({navigation}) {
  const [var1, setVar1] = useState(0);
  const [var2, setVar2] = useState(0);
  const [var3, setVar3] = useState(0);
  const [var4, setVar4] = useState(0);

  let Strompreis;
  if (authentication.currentUser.uid === '7wIwGnxXuNUkSXCfFGEcqsYXZK62') {
    if (global.price === undefined) {
      Strompreis = 0.29;
    } else {
      Strompreis = global.price;
    }
  } else {
    Strompreis = 0.25;
  }

  const Calculate = ({var12, Strompreis12}) => {
    let result;
    if (var12 === undefined || Strompreis12 === undefined) {
      return 0 + '.00';
    } else {
      result = var12 * Strompreis12;
    }
    if (isNaN(result)) {
      return 0 + '.00';
    } else {
      result = result.toFixed(2);
      return result;
    }
  };

  const getStyle = () => ({
    position: 'absolute',
    bottom: Platform.OS === 'ios' ? 0 : '-6%',
    width: Dimensions.get('window').width,
  });

  return (
    <View>
      <ImageBackground
        source={require('./images/BackgroundCropped.png')}
        style={styles.img}>
        <Text style={styles.title}>Eigenverbrauch</Text>
        <LineChart
          data={{
            labels: [
              'Jan',
              'Feb',
              'Mar',
              'Apr',
              'May',
              'Jun',
              'Jul',
              'Aug',
              'Sep',
              'Oct',
              'Nov',
              'Dec',
            ],
            datasets: [
              {
                data: [var1, var2, var3, var4],
              },
            ],
          }}
          width={Dimensions.get('window').width} // from react-native
          height={260}
          yAxisSuffix="kwh"
          yAxisInterval={1} // optional, defaults to 1
          chartConfig={{
            backgroundColor: '#009688',
            backgroundGradientFrom: '#009688',
            backgroundGradientTo: '#ffa726',
            decimalPlaces: 1, // optional, defaults to 2dp
            color: (opacity = 1) => `rgba(255, 255, 255, ${opacity})`,
            labelColor: (opacity = 1) => `rgba(255, 255, 255, ${opacity})`,
            style: {
              borderRadius: 16,
            },
            propsForDots: {
              r: '6',
              strokeWidth: '2',
              stroke: '#ffa726',
            },
          }}
          bezier
          style={{
            marginVertical: 8,
            borderRadius: 0,
            top: 90,
          }}
        />
        <Text style={styles.titleEinspeisung}>Zählerstand</Text>
        <TextInput
          style={styles.input}
          placeholder="Energieverbrauch in kWh"
          placeholderTextColor="#009688"
          keyboardType="numeric"
          onChangeText={text => setVar1(text)}
          value={var1}
          returnKeyType="done"
        />
        <Text style={styles.titleEinspeisung}>Aktuellen Kosten!</Text>
        <Text style={styles.titleKosten}>
          Die aktuellen Kosten belaufen sich auf:
        </Text>
        <View style={styles.Kosten}>
          <Text style={styles.textCalc}>
            {Calculate({var12: var1, Strompreis12: Strompreis})}€
          </Text>
        </View>
        <View style={styles.aktuellerStrompreis}>
          <Text style={styles.text}>
            Ihr aktueller Strompreis beträgt {Strompreis} €/kwh
          </Text>
        </View>
        <View style={getStyle()}>
          <NavigationBar navigation={navigation} />
        </View>
      </ImageBackground>
    </View>
  );
}

A: I suspect that the reason why you get the ".toFixed is not a function" error might be related to how .toFixed can only be used on numbers while input fields typically return strings.
I believe that you might be able to work around this issue by casting the input from a String to a Number in the onChangeText prop function of the TextInput component:
        <TextInput
          style={styles.input}
          placeholder="Energieverbrauch in kWh"
          placeholderTextColor="#009688"
          keyboardType="numeric"
          onChangeText={text => setVar1(Number(text))}
          value={var1}
          returnKeyType="done"
        />

However, you will have to deal with the case where users enter input that is not a number, which would result in var1 to be NaN and cause further issues. You can circumvent that problem by making sure that the input field is of type="number". Browsers typically don't let users enter non-numbers for this type of input field.


text:
Q: Prove that there is an n-ball B(a) in which f has the same sign as f(a)
Let $f$ be a scalar field continuous at an interior point $a$ of a set $S$ in $\Bbb R^n$. If $f(a)$ is not equal to $0$, prove that there is an $n$-ball $B(a)$ in which $f$ has the same sign as $f(a)$.

*I think that this is another way of proving the definition of a limit in the context of scalar fields.
My attempt
Proof: Suppose $f(a)>0$, let $B[a]$ be the ball around $a$. Since $f$ is continuous at $a$, for every ball $B[f(a)]$ there exist a ball $B[a]$ such that if $x$ is in $B[a]$ then $f$ is in $B[f(a)]$. Since $f$ is continuous at $a$, $f$ is in $B[f(a)]$. Thus $f$ has the same sign as $f(a)$. QED
I'm doubtful about my proof as it doesn't look rigorous enough. Any suggestions?

A: Not good, you already started picking a ball $B[a]$. And what is the radius of all these balls? I'll do the case $f(a)>0$, you do $f(a)<0$ for practice (it is possible to do it at the same time, though). Since $f$ is continuous at $a$, given $\epsilon = f(a)/2 > 0$. By continuity, there is $\delta > 0$ such that $x \in B(a,\delta) \implies \left|f(x)-f(a)\right| < f(a)/2$. So: $$-\frac{f(a)}{2} < f(x)-f(a) < \frac{f(a)}{2} \implies f(x) > \frac{f(a)}{2} > 0, \quad \forall\,x \in B(a,\delta).$$


text:
Q: Adding animation to element appearing to be swooping from one of the window/document border with fade-in effect I'm trying to add FadeIn Effect upon Viewport Just Like in this codePen :
https://codepen.io/treppin/pen/BWeKRY
So I created a fadeIn-Right css with sort of animation and tried adding the class to Element when it comes in viewport (only once) But it's not working. Where did I get wrong.
I want it to be just like the above example with some changes like appearing to be swooping in from right/left

function checkElementLocation() {
                var $window = $(window);
                var bottom_of_window = $window.scrollTop() + $window.height();

                $('.elem').each(function (i) {
                    var $that = $(this);
                    var bottom_of_object = $that.position().top + $that.outerHeight();

                    if (bottom_of_window > bottom_of_object) {
                        $(this).addClass('fadeIn-Right');
                    }
                });
            }
            checkElementLocation();
            $(window).on('scroll', function () {
                checkElementLocation();
            });
body {
            margin: 0;
        }
        .container {
            display: flex;
            flex-direction: column;
            align-items: center;
            justify-content: center;
            background-color: bisque;
        }
        .content {
            width: 30%;
            margin: 100px 0;
            padding: 50px 100px;
            height: auto;
        }
        .r1 {background-color: #3b599877;}
        .r2 {background-color: red;}
        .r3 {background-color: #3b5998;}
        .r4 {background-color: green;}
        .r5 {background-color: #3b5998da;}

        .fadeIn-Right {
            animation: fadeRight 3s ease-in-out  forwards;
        }
        @keyframes fadeRight {
            0% {
                transform: translateX(-20px);
                opacity: 0;
            }
            100% {
                transform: none;
                opacity: 1;
            }
        }

            Hello World
            "Neque porro quisquam est qui dolorem ipsum quia dolor sit amet, consectetur, adipisci velit..."
            "Neque porro quisquam est qui dolorem ipsum quia dolor sit amet, consectetur, adipisci velit..."
            "Neque porro quisquam est qui dolorem ipsum quia dolor sit amet, consectetur, adipisci velit..."

            "Neque porro quisquam est qui dolorem ipsum quia dolor sit amet, consectetur, adipisci velit..."
            "Neque porro quisquam est qui dolorem ipsum quia dolor sit amet, consectetur, adipisci velit..."
            "Neque porro quisquam est qui dolorem ipsum quia dolor sit amet, consectetur, adipisci velit..."

            "Neque porro quisquam est qui dolorem ipsum quia dolor sit amet, consectetur, adipisci velit..."
            "Neque porro quisquam est qui dolorem ipsum quia dolor sit amet, consectetur, adipisci velit..."
            "Neque porro quisquam est qui dolorem ipsum quia dolor sit amet, consectetur, adipisci velit..."

            "Neque porro quisquam est qui dolorem ipsum quia dolor sit amet, consectetur, adipisci velit..."
            "Neque porro quisquam est qui dolorem ipsum quia dolor sit amet, consectetur, adipisci velit..."
            "Neque porro quisquam est qui dolorem ipsum quia dolor sit amet, consectetur, adipisci velit..."

            "Neque porro quisquam est qui dolorem ipsum quia dolor sit amet, consectetur, adipisci velit..."
            "Neque porro quisquam est qui dolorem ipsum quia dolor sit amet, consectetur, adipisci velit..."
            "Neque porro quisquam est qui dolorem ipsum quia dolor sit amet, consectetur, adipisci velit..."

A: For adding animation where the element appears to be swooping in from right to left, you could simply use transform property(you are already using that) but value has be translateX(100%) so that it appears to be swooping in from window border on the right
@keyframes fadeRight {
   0% {
      transform: translateX(100%);
      opacity: 0;
   }
   100% {
      transform: none;
      opacity: 1;
   }
}


text:
Q: How to handle nullable Postgres JSONB data and parse it as JSON DB Records
---------------------------------------------------------
| id | test_json                                        |
---------------------------------------------------------
| 1  | NULL                                             |
---------------------------------------------------------
| 2  | { "firstName": "Hello", "lastName": "World" }    |
---------------------------------------------------------

I have JSONB column in postgres which can be NULL. I want to read this records DB in golang and send it to the client.
I'm getting below error on SQL scan:
sql: Scan error on column index 2, name "test_json": unsupported Scan, storing driver.Value type []uint8 into type *models.TestJSONNullable
exit status 1

I'm using echo web server.
package models

import (
    "fmt"
    "github.com/lib/pq"
    "encoding/json"
)

type TestJson struct {
    First_name *string `json:"firstName"`
    Last_name *string `json:"lastName"`
}

type TestJSONNullable struct {
  Valid bool
}

func (i *TestJSONNullable) UnmarshalJSON(data []byte) error {
  if string(data) == "null" {
    i.Valid = false
    return nil
  }

  // The key isn't set to null
  var temp *TestJson
  if err := json.Unmarshal(data, &temp); err != nil {
    return err
  }
  i.Valid = true
  return nil
}

type Test01 struct {
    Id string `json:"id"`
    Test_json *TestJSONNullable `json:"testJson"`
}

func (db *DB) TestRecords () ([]*Test01, error)  {
    rows, err := db.Query("SELECT id, test_json FROM table_1 where success = true")

    if err != nil {
        log.Fatal(err)
        return nil, err
    }

    defer rows.Close()

    recs := []*Test01{}

    for rows.Next() {
        r := new(Test01)

        err := rows.Scan(&r.Id, &r.Test_json)

        if err != nil {
            log.Fatal(err)
            return nil, err
        }

        recs = append(recs, r)
    }

    if err = rows.Err(); err != nil {
        log.Fatal(err)
        return nil, err
    }

    return recs, nil
}

A: Here's another solution: You can implement a nullable type for raw JSON data, similar to sql.NullString, and use it as a scan destination. In this scenario, you will first check whether the value is null, and then unmarshal it only if it's not null. For instance, the NullRawMessage type from github.com/soroushj/sqlt is a nullable json.RawMessage which can be used for this purpose.
Here's an example:
package main

import (
    "database/sql"
    "log"

    _ "github.com/lib/pq"
    "github.com/soroushj/sqlt"
)

func main() {
    db, err := sql.Open("postgres", "dbname=dbname user=user password=password sslmode=disable")
    if err != nil {
        log.Fatal(err)
    }
    row := db.QueryRow(`SELECT test_json FROM my_table WHERE id = $1`, 1)
    testJSON := sqlt.NullRawMessage{}
    err = row.Scan(&testJSON)
    if err != nil {
        log.Fatal(err)
    }
    if testJSON.Valid {
        // test_json is not null
        // Unmarshal testJSON.RawMessage
    } else {
        // test_json is null
    }
}

A: After doing some research i found the solution.
type TestJSONMap map[string]interface{}

func (t TestJSONMap) Value() (driver.Value, error) {
    j, err := json.Marshal(t)
    return j, err
}

func (p *TestJSONMap) Scan(val interface{}) error {
    value, ok := val.([]byte)
    if !ok {
        return errors.New("Type assertion .([]byte) failed.")
    }

    var i interface{}
    err := json.Unmarshal(value, &i)
    if err != nil {
        return err
    }

    *p, ok = i.(map[string]interface{})
    if !ok {
        return errors.New("Type assertion .(map[string]interface{}) failed.")
    }

    return nil
}

type Test01 struct {
    Id string `json:"id"`
    Test_json *TestJSONMap `json:"testJson"`
}

Got help from https://coussej.github.io/2016/02/16/Handling-JSONB-in-Go-Structs/

A: Instead of using struct to store values, You can use map.
type TestJson struct {
    First_name *string `json:"firstName"`
    Last_name *string `json:"lastName"`
}

You can use interface as
var TestJson interface{}
err := json.Unmarshal(b, &TestJson)

On the other side you can also use Dynamic creation of structs as well.
Something like
m := map[string]interface{}{
    "key": "value",
}

And rather than having TestJSONNullable it would be better to have Switch case while saving data.
switch v := TestJson.(type) {
case int:

case float64:

case string:

default:
    // i isn't one of the types above
}

Look into this for more details--> https://godoc.org/encoding/json#Unmarshal


text:
Q: Limit in Spark SQL expression complexity on AWS EMR? My ultimate goal is to add a calculated field to a large table in Spark SQL, something along these lines:
sqlContext.sql(" create table spktest2 as select cll.*, [big expression] as tst from spktest cll")

The issue is that when [big expression] has several hundred combinations of case/when expressions, then I get an error:
ERROR CodeGenerator: failed to compile: org.codehaus.janino.JaninoRuntimeException: Code of method "processNext()V" of class "org.apache.spark.sql.catalyst.expressions.GeneratedClass$GeneratedIterator" grows beyond 64 KB

The error log is over 16Mb large so unfortunately I cannot paste it all here. There's a whole dump of code in that log.
I have made a reproducible code snippet, and running in pyspark shell on AWS EMR it generates the error, however it is also too large for me to be able to post it entirely. So I made the expression shorter and in order to be sure to get the error you need to just add terms in the sum by copying some of the ones here already.
from pyspark import SparkConf, SparkContext
from pyspark.sql import HiveContext, SQLContext
from pyspark.sql.types import *
import sys

sqlContext = HiveContext(sc)

df = sqlContext.range(0, 500)
df.registerTempTable('df')
val = sqlContext.sql(" drop table if exists spktest")
val = sqlContext.sql(" create table spktest as SELECT id, id + 1 as x, id + 3 as y from df")
sqlContext.sql('select * from spktest').show()

val = sqlContext.sql(" drop table if exists spktest2")
val = sqlContext.sql(" create table spktest2 as select cll.*, ((case  when x = 1 then y - 2 when x = 1 then y + 2 else 0 end)+(case  when x = 2 then y - 3 when x = 4 then y + 3 else 0 end)+(case  when x = 3 then y - 4 when x = 9 then y + 4 else 0 end)+(case  when x = 4 then y - 5 when x = 16 then y + 5 else 0 end)+(case  when x = 5 then y - 6 when x = 25 then y + 6 else 0 end)+(case  when x = 6 then y - 7 when x = 36 then y + 7 else 0 end)+(case  when x = 7 then y - 8 when x = 49 then y + 8 else 0 end)+(case  when x = 8 then y - 9 when x = 64 then y + 9 else 0 end)+(case  when x = 9 then y - 10 when x = 81 then y + 10 else 0 end)+(case  when x = 10 then y - 11 when x = 100 then y + 11 else 0 end)+(case  when x = 11 then y - 12 when x = 121 then y + 12 else 0 end)+(case  when x = 12 then y - 13 when x = 144 then y + 13 else 0 end)+(case  when x = 13 then y - 14 when x = 169 then y + 14 else 0 end)+(case  when x = 14 then y - 15 when x = 196 then y + 15 else 0 end)+(case  when x = 15 then y - 16 when x = 225 then y + 16 else 0 end)+(case  when x = 16 then y - 17 when x = 256 then y + 17 else 0 end)+(case  when x = 17 then y - 18 when x = 289 then y + 18 else 0 end)+(case  when x = 18 then y - 19 when x = 324 then y + 19 else 0 end)+(case  when x = 19 then y - 20 when x = 361 then y + 20 else 0 end)+(case  when x = 20 then y - 21 when x = 400 then y + 21 else 0 end)+(case  when x = 21 then y - 22 when x = 441 then y + 22 else 0 end)+(case  when x = 22 then y - 23 when x = 484 then y + 23 else 0 end)+(case  when x = 23 then y - 24 when x = 529 then y + 24 else 0 end)+(case  when x = 24 then y - 25 when x = 576 then y + 25 else 0 end)+(case  when x = 25 then y - 26 when x = 625 then y + 26 else 0 end)+(case  when x = 26 then y - 27 when x = 676 then y + 27 else 0 end)+(case  when x = 27 then y - 28 when x = 729 then y + 28 else 0 end)+(case  when x = 28 then y - 29 when x = 784 then y + 29 else 0 end)+(case  when x = 29 then y - 30 when x = 841 then y + 30 else 0 end)+(case  when x = 30 then y - 31 when x = 900 then y + 31 else 0 end)+(case  when x = 31 then y - 32 when x = 961 then y + 32 else 0 end)+(case  when x = 32 then y - 33 when x = 1024 then y + 33 else 0 end)+(case  when x = 33 then y - 34 when x = 1089 then y + 34 else 0 end)+(case  when x = 34 then y - 35 when x = 1156 then y + 35 else 0 end)+(case  when x = 35 then y - 36 when x = 1225 then y + 36 else 0 end)+(case  when x = 36 then y - 37 when x = 1296 then y + 37 else 0 end)+(case  when x = 37 then y - 38 when x = 1369 then y + 38 else 0 end)+(case  when x = 38 then y - 39 when x = 1444 then y + 39 else 0 end)+(case  when x = 39 then y - 40 when x = 1521 then y + 40 else 0 end)+(case  when x = 40 then y - 41 when x = 1600 then y + 41 else 0 end)+(case  when x = 41 then y - 42 when x = 1681 then y + 42 else 0 end)+(case  when x = 42 then y - 43 when x = 1764 then y + 43 else 0 end)+(case  when x = 43 then y - 44 when x = 1849 then y + 44 else 0 end)+(case  when x = 44 then y - 45 when x = 1936 then y + 45 else 0 end)+(case  when x = 45 then y - 46 when x = 2025 then y + 46 else 0 end)+(case  when x = 46 then y - 47 when x = 2116 then y + 47 else 0 end)+(case  when x = 47 then y - 48 when x = 2209 then y + 48 else 0 end)+(case  when x = 48 then y - 49 when x = 2304 then y + 49 else 0 end)+(case  when x = 49 then y - 50 when x = 2401 then y + 50 else 0 end)+(case  when x = 50 then y - 51 when x = 2500 then y + 51 else 0 end)+(case  when x = 51 then y - 52 when x = 2601 then y + 52 else 0 end)+(case  when x = 52 then y - 53 when x = 2704 then y + 53 else 0 end)+(case  when x = 53 then y - 54 when x = 2809 then y + 54 else 0 end)+(case  when x = 54 then y - 55 when x = 2916 then y + 55 else 0 end)+(case  when x = 55 then y - 56 when x = 3025 then y + 56 else 0 end)+(case  when x = 56 then y - 57 when x = 3136 then y + 57 else 0 end)+(case  when x = 57 then y - 58 when x = 3249 then y + 58 else 0 end)+(case  when x = 58 then y - 59 when x = 3364 then y + 59 else 0 end)+(case  when x = 59 then y - 60 when x = 3481 then y + 60 else 0 end)+(case  when x = 60 then y - 61 when x = 3600 then y + 61 else 0 end)+(case  when x = 61 then y - 62 when x = 3721 then y + 62 else 0 end)+(case  when x = 62 then y - 63 when x = 3844 then y + 63 else 0 end)+(case  when x = 63 then y - 64 when x = 3969 then y + 64 else 0 end)+(case  when x = 64 then y - 65 when x = 4096 then y + 65 else 0 end)+(case  when x = 83 then y - 84 when x = 6889 then y + 84 else 0 end)+(case  when x = 84 then y - 85 when x = 7056 then y + 85 else 0 end)+(case  when x = 85 then y - 86 when x = 7225 then y + 86 else 0 end)+(case  when x = 86 then y - 87 when x = 7396 then y + 87 else 0 end)+(case  when x = 87 then y - 88 when x = 7569 then y + 88 else 0 end)+(case  when x = 88 then y - 89 when x = 7744 then y + 89 else 0 end)+(case  when x = 89 then y - 90 when x = 7921 then y + 90 else 0 end)+(case  when x = 90 then y - 91 when x = 8100 then y + 91 else 0 end)+(case  when x = 91 then y - 92 when x = 8281 then y + 92 else 0 end)+(case  when x = 92 then y - 93 when x = 8464 then y + 93 else 0 end)+(case  when x = 93 then y - 94 when x = 8649 then y + 94 else 0 end)+(case  when x = 94 then y - 95 when x = 8836 then y + 95 else 0 end)+(case  when x = 95 then y - 96 when x = 9025 then y + 96 else 0 end)+(case  when x = 96 then y - 97 when x = 9216 then y + 97 else 0 end)+(case  when x = 97 then y - 98 when x = 9409 then y + 98 else 0 end)+(case  when x = 98 then y - 99 when x = 9604 then y + 99 else 0 end)+(case  when x = 99 then y - 100 when x = 9801 then y + 100 else 0 end)+(case  when x = 100 then y - 101 when x = 10000 then y + 101 else 0 end)+(case  when x = 101 then y - 102 when x = 10201 then y + 102 else 0 end)+(case  when x = 102 then y - 103 when x = 10404 then y + 103 else 0 end)+(case  when x = 103 then y - 104 when x = 10609 then y + 104 else 0 end)+(case  when x = 104 then y - 105 when x = 10816 then y + 105 else 0 end)+(case  when x = 105 then y - 106 when x = 11025 then y + 106 else 0 end)+(case  when x = 106 then y - 107 when x = 11236 then y + 107 else 0 end)+(case  when x = 107 then y - 108 when x = 11449 then y + 108 else 0 end)+(case  when x = 108 then y - 109 when x = 11664 then y + 109 else 0 end)+(case  when x = 109 then y - 110 when x = 11881 then y + 110 else 0 end)+(case  when x = 110 then y - 111 when x = 12100 then y + 111 else 0 end)+(case  when x = 111 then y - 112 when x = 12321 then y + 112 else 0 end)+(case  when x = 112 then y - 113 when x = 12544 then y + 113 else 0 end)+(case  when x = 113 then y - 114 when x = 12769 then y + 114 else 0 end)+(case  when x = 114 then y - 115 when x = 12996 then y + 115 else 0 end)+(case  when x = 115 then y - 116 when x = 13225 then y + 116 else 0 end)+(case  when x = 116 then y - 117 when x = 13456 then y + 117 else 0 end)+(case  when x = 117 then y - 118 when x = 13689 then y + 118 else 0 end)+(case  when x = 118 then y - 119 when x = 13924 then y + 119 else 0 end)+(case  when x = 119 then y - 120 when x = 14161 then y + 120 else 0 end)+(case  when x = 120 then y - 121 when x = 14400 then y + 121 else 0 end)+(case  when x = 121 then y - 122 when x = 14641 then y + 122 else 0 end)+(case  when x = 122 then y - 123 when x = 14884 then y + 123 else 0 end)+(case  when x = 123 then y - 124 when x = 15129 then y + 124 else 0 end)+(case  when x = 124 then y - 125 when x = 15376 then y + 125 else 0 end)+(case  when x = 125 then y - 126 when x = 15625 then y + 126 else 0 end)+(case  when x = 126 then y - 127 when x = 15876 then y + 127 else 0 end)+(case  when x = 127 then y - 128 when x = 16129 then y + 128 else 0 end)+(case  when x = 128 then y - 129 when x = 16384 then y + 129 else 0 end)+(case  when x = 129 then y - 130 when x = 16641 then y + 130 else 0 end)+(case  when x = 130 then y - 131 when x = 16900 then y + 131 else 0 end)+(case  when x = 131 then y - 132 when x = 17161 then y + 132 else 0 end)+(case  when x = 132 then y - 133 when x = 17424 then y + 133 else 0 end)+(case  when x = 133 then y - 134 when x = 17689 then y + 134 else 0 end)+(case  when x = 134 then y - 135 when x = 17956 then y + 135 else 0 end)+(case  when x = 135 then y - 136 when x = 18225 then y + 136 else 0 end)+(case  when x = 136 then y - 137 when x = 18496 then y + 137 else 0 end)+(case  when x = 137 then y - 138 when x = 18769 then y + 138 else 0 end)+(case  when x = 138 then y - 139 when x = 19044 then y + 139 else 0 end)+(case  when x = 139 then y - 140 when x = 19321 then y + 140 else 0 end)+(case  when x = 140 then y - 141 when x = 19600 then y + 141 else 0 end)+(case  when x = 141 then y - 142 when x = 19881 then y + 142 else 0 end)+(case  when x = 142 then y - 143 when x = 20164 then y + 143 else 0 end)+(case  when x = 143 then y - 144 when x = 20449 then y + 144 else 0 end)+(case  when x = 144 then y - 145 when x = 20736 then y + 145 else 0 end)+(case  when x = 145 then y - 146 when x = 21025 then y + 146 else 0 end)+(case  when x = 146 then y - 147 when x = 21316 then y + 147 else 0 end)+(case  when x = 147 then y - 148 when x = 21609 then y + 148 else 0 end)+(case  when x = 148 then y - 149 when x = 21904 then y + 149 else 0 end)+(case  when x = 149 then y - 150 when x = 22201 then y + 150 else 0 end)+(case  when x = 150 then y - 151 when x = 22500 then y + 151 else 0 end)+(case  when x = 151 then y - 152 when x = 22801 then y + 152 else 0 end)+(case  when x = 152 then y - 153 when x = 23104 then y + 153 else 0 end)+(case  when x = 153 then y - 154 when x = 23409 then y + 154 else 0 end)+(case  when x = 154 then y - 155 when x = 23716 then y + 155 else 0 end)+(case  when x = 155 then y - 156 when x = 24025 then y + 156 else 0 end)+(case  when x = 156 then y - 157 when x = 24336 then y + 157 else 0 end)+(case  when x = 157 then y - 158 when x = 24649 then y + 158 else 0 end)+(case  when x = 158 then y - 159 when x = 24964 then y + 159 else 0 end)+(case  when x = 159 then y - 160 when x = 25281 then y + 160 else 0 end)+(case  when x = 160 then y - 161 when x = 25600 then y + 161 else 0 end)+(case  when x = 161 then y - 162 when x = 25921 then y + 162 else 0 end)+(case  when x = 162 then y - 163 when x = 26244 then y + 163 else 0 end)+(case  when x = 163 then y - 164 when x = 26569 then y + 164 else 0 end)+(case  when x = 164 then y - 165 when x = 26896 then y + 165 else 0 end)+(case  when x = 165 then y - 166 when x = 27225 then y + 166 else 0 end)+(case  when x = 166 then y - 167 when x = 27556 then y + 167 else 0 end)+(case  when x = 167 then y - 168 when x = 27889 then y + 168 else 0 end)+(case  when x = 168 then y - 169 when x = 28224 then y + 169 else 0 end)+(case  when x = 169 then y - 170 when x = 28561 then y + 170 else 0 end)+(case  when x = 170 then y - 171 when x = 28900 then y + 171 else 0 end)+(case  when x = 171 then y - 172 when x = 29241 then y + 172 else 0 end)+(case  when x = 172 then y - 173 when x = 29584 then y + 173 else 0 end)+(case  when x = 173 then y - 174 when x = 29929 then y + 174 else 0 end)+(case  when x = 174 then y - 175 when x = 30276 then y + 175 else 0 end)+(case  when x = 175 then y - 176 when x = 30625 then y + 176 else 0 end)+(case  when x = 176 then y - 177 when x = 30976 then y + 177 else 0 end)+(case  when x = 177 then y - 178 when x = 31329 then y + 178 else 0 end)+(case  when x = 178 then y - 179 when x = 31684 then y + 179 else 0 end)+(case  when x = 179 then y - 180 when x = 32041 then y + 180 else 0 end)+(case  when x = 180 then y - 181 when x = 32400 then y + 181 else 0 end)+(case  when x = 181 then y - 182 when x = 32761 then y + 182 else 0 end)+(case  when x = 182 then y - 183 when x = 33124 then y + 183 else 0 end)+(case  when x = 183 then y - 184 when x = 33489 then y + 184 else 0 end)+(case  when x = 184 then y - 185 when x = 33856 then y + 185 else 0 end)+(case  when x = 185 then y - 186 when x = 34225 then y + 186 else 0 end)+(case  when x = 186 then y - 187 when x = 34596 then y + 187 else 0 end)+(case  when x = 187 then y - 188 when x = 34969 then y + 188 else 0 end)+(case  when x = 188 then y - 189 when x = 35344 then y + 189 else 0 end)+(case  when x = 189 then y - 190 when x = 35721 then y + 190 else 0 end)+(case  when x = 190 then y - 191 when x = 36100 then y + 191 else 0 end)+(case  when x = 191 then y - 192 when x = 36481 then y + 192 else 0 end)+(case  when x = 192 then y - 193 when x = 36864 then y + 193 else 0 end)+(case  when x = 193 then y - 194 when x = 37249 then y + 194 else 0 end)+(case  when x = 194 then y - 195 when x = 37636 then y + 195 else 0 end)+(case  when x = 195 then y - 196 when x = 38025 then y + 196 else 0 end)+(case  when x = 196 then y - 197 when x = 38416 then y + 197 else 0 end)+(case  when x = 197 then y - 198 when x = 38809 then y + 198 else 0 end)+(case  when x = 198 then y - 199 when x = 39204 then y + 199 else 0 end)+(case  when x = 199 then y - 200 when x = 39601 then y + 200 else 0 end)+(case  when x = 200 then y - 201 when x = 40000 then y + 201 else 0 end)+(case  when x = 201 then y - 202 when x = 40401 then y + 202 else 0 end)+(case  when x = 202 then y - 203 when x = 40804 then y + 203 else 0 end)+(case  when x = 203 then y - 204 when x = 41209 then y + 204 else 0 end)+(case  when x = 204 then y - 205 when x = 41616 then y + 205 else 0 end)+(case  when x = 205 then y - 206 when x = 42025 then y + 206 else 0 end)+(case  when x = 206 then y - 207 when x = 42436 then y + 207 else 0 end)+(case  when x = 207 then y - 208 when x = 42849 then y + 208 else 0 end)+(case  when x = 208 then y - 209 when x = 43264 then y + 209 else 0 end)+(case  when x = 209 then y - 210 when x = 43681 then y + 210 else 0 end)+(case  when x = 210 then y - 211 when x = 44100 then y + 211 else 0 end)+(case  when x = 211 then y - 212 when x = 44521 then y + 212 else 0 end)+(case  when x = 212 then y - 213 when x = 44944 then y + 213 else 0 end)+(case  when x = 213 then y - 214 when x = 45369 then y + 214 else 0 end)+(case  when x = 214 then y - 215 when x = 45796 then y + 215 else 0 end)+(case  when x = 215 then y - 216 when x = 46225 then y + 216 else 0 end)+(case  when x = 216 then y - 217 when x = 46656 then y + 217 else 0 end)+(case  when x = 217 then y - 218 when x = 47089 then y + 218 else 0 end)+(case  when x = 218 then y - 219 when x = 47524 then y + 219 else 0 end)+(case  when x = 219 then y - 220 when x = 47961 then y + 220 else 0 end)+(case  when x = 220 then y - 221 when x = 48400 then y + 221 else 0 end)+(case  when x = 221 then y - 222 when x = 48841 then y + 222 else 0 end)+(case  when x = 222 then y - 223 when x = 49284 then y + 223 else 0 end)+(case  when x = 223 then y - 224 when x = 49729 then y + 224 else 0 end)+(case  when x = 224 then y - 225 when x = 50176 then y + 225 else 0 end)+(case  when x = 225 then y - 226 when x = 50625 then y + 226 else 0 end)+(case  when x = 255 then y - 256 when x = 65025 then y + 256 else 0 end)+(case  when x = 256 then y - 257 when x = 65536 then y + 257 else 0 end)+(case  when x = 257 then y - 258 when x = 66049 then y + 258 else 0 end)+(case  when x = 258 then y - 259 when x = 66564 then y + 259 else 0 end)+(case  when x = 259 then y - 260 when x = 67081 then y + 260 else 0 end)+(case  when x = 260 then y - 261 when x = 67600 then y + 261 else 0 end)+(case  when x = 261 then y - 262 when x = 68121 then y + 262 else 0 end)+(case  when x = 262 then y - 263 when x = 68644 then y + 263 else 0 end)+(case  when x = 263 then y - 264 when x = 69169 then y + 264 else 0 end)+(case  when x = 264 then y - 265 when x = 69696 then y + 265 else 0 end)+(case  when x = 265 then y - 266 when x = 70225 then y + 266 else 0 end)+(case  when x = 266 then y - 267 when x = 70756 then y + 267 else 0 end)+(case  when x = 267 then y - 268 when x = 71289 then y + 268 else 0 end)+(case  when x = 268 then y - 269 when x = 71824 then y + 269 else 0 end)+(case  when x = 269 then y - 270 when x = 72361 then y + 270 else 0 end)+(case  when x = 270 then y - 271 when x = 72900 then y + 271 else 0 end)+(case  when x = 271 then y - 272 when x = 73441 then y + 272 else 0 end)+(case  when x = 272 then y - 273 when x = 73984 then y + 273 else 0 end)+(case  when x = 273 then y - 274 when x = 74529 then y + 274 else 0 end)+(case  when x = 274 then y - 275 when x = 75076 then y + 275 else 0 end)+(case  when x = 275 then y - 276 when x = 75625 then y + 276 else 0 end)+(case  when x = 276 then y - 277 when x = 76176 then y + 277 else 0 end)+(case  when x = 277 then y - 278 when x = 76729 then y + 278 else 0 end)+(case  when x = 278 then y - 279 when x = 77284 then y + 279 else 0 end)+(case  when x = 279 then y - 280 when x = 77841 then y + 280 else 0 end)+(case  when x = 280 then y - 281 when x = 78400 then y + 281 else 0 end)+(case  when x = 281 then y - 282 when x = 78961 then y + 282 else 0 end)+(case  when x = 282 then y - 283 when x = 79524 then y + 283 else 0 end)+(case  when x = 283 then y - 284 when x = 80089 then y + 284 else 0 end)+(case  when x = 284 then y - 285 when x = 80656 then y + 285 else 0 end)+(case  when x = 285 then y - 286 when x = 81225 then y + 286 else 0 end)+(case  when x = 286 then y - 287 when x = 81796 then y + 287 else 0 end)+(case  when x = 287 then y - 288 when x = 82369 then y + 288 else 0 end)+(case  when x = 288 then y - 289 when x = 82944 then y + 289 else 0 end)+(case  when x = 289 then y - 290 when x = 83521 then y + 290 else 0 end)+(case  when x = 290 then y - 291 when x = 84100 then y + 291 else 0 end)+(case  when x = 291 then y - 292 when x = 84681 then y + 292 else 0 end)+(case  when x = 292 then y - 293 when x = 85264 then y + 293 else 0 end)+(case  when x = 293 then y - 294 when x = 85849 then y + 294 else 0 end)+(case  when x = 294 then y - 295 when x = 86436 then y + 295 else 0 end)+(case  when x = 295 then y - 296 when x = 87025 then y + 296 else 0 end)+(case  when x = 296 then y - 297 when x = 87616 then y + 297 else 0 end)+(case  when x = 297 then y - 298 when x = 88209 then y + 298 else 0 end)+(case  when x = 298 then y - 299 when x = 88804 then y + 299 else 0 end)+(case  when x = 299 then y - 300 when x = 89401 then y + 300 else 0 end)+(case  when x = 300 then y - 301 when x = 90000 then y + 301 else 0 end)+(case  when x = 301 then y - 302 when x = 90601 then y + 302 else 0 end)+(case  when x = 302 then y - 303 when x = 91204 then y + 303 else 0 end)+(case  when x = 303 then y - 304 when x = 91809 then y + 304 else 0 end)+(case  when x = 304 then y - 305 when x = 92416 then y + 305 else 0 end)+(case  when x = 305 then y - 306 when x = 93025 then y + 306 else 0 end)+(case  when x = 306 then y - 307 when x = 93636 then y + 307 else 0 end)+(case  when x = 307 then y - 308 when x = 94249 then y + 308 else 0 end)+(case  when x = 308 then y - 309 when x = 94864 then y + 309 else 0 end)+(case  when x = 309 then y - 310 when x = 95481 then y + 310 else 0 end)+(case  when x = 310 then y - 311 when x = 96100 then y + 311 else 0 end)+(case  when x = 311 then y - 312 when x = 96721 then y + 312 else 0 end)+(case  when x = 312 then y - 313 when x = 97344 then y + 313 else 0 end)+(case  when x = 313 then y - 314 when x = 97969 then y + 314 else 0 end)+(case  when x = 314 then y - 315 when x = 98596 then y + 315 else 0 end)+(case  when x = 315 then y - 316 when x = 99225 then y + 316 else 0 end)+(case  when x = 316 then y - 317 when x = 99856 then y + 317 else 0 end)+(case  when x = 317 then y - 318 when x = 100489 then y + 318 else 0 end)+(case  when x = 318 then y - 319 when x = 101124 then y + 319 else 0 end)+(case  when x = 319 then y - 320 when x = 101761 then y + 320 else 0 end)+(case  when x = 320 then y - 321 when x = 102400 then y + 321 else 0 end)+(case  when x = 321 then y - 322 when x = 103041 then y + 322 else 0 end)+(case  when x = 322 then y - 323 when x = 103684 then y + 323 else 0 end)+(case  when x = 323 then y - 324 when x = 104329 then y + 324 else 0 end)+(case  when x = 324 then y - 325 when x = 104976 then y + 325 else 0 end)+(case  when x = 325 then y - 326 when x = 105625 then y + 326 else 0 end)+(case  when x = 326 then y - 327 when x = 106276 then y + 327 else 0 end)+(case  when x = 327 then y - 328 when x = 106929 then y + 328 else 0 end)+(case  when x = 328 then y - 329 when x = 107584 then y + 329 else 0 end)+(case  when x = 329 then y - 330 when x = 108241 then y + 330 else 0 end)+(case  when x = 330 then y - 331 when x = 108900 then y + 331 else 0 end)+(case  when x = 331 then y - 332 when x = 109561 then y + 332 else 0 end)+(case  when x = 332 then y - 333 when x = 110224 then y + 333 else 0 end)+(case  when x = 333 then y - 334 when x = 110889 then y + 334 else 0 end)+(case  when x = 334 then y - 335 when x = 111556 then y + 335 else 0 end)+(case  when x = 335 then y - 336 when x = 112225 then y + 336 else 0 end)+(case  when x = 336 then y - 337 when x = 112896 then y + 337 else 0 end)+(case  when x = 337 then y - 338 when x = 113569 then y + 338 else 0 end)+(case  when x = 338 then y - 339 when x = 114244 then y + 339 else 0 end)+(case  when x = 339 then y - 340 when x = 114921 then y + 340 else 0 end)+(case  when x = 340 then y - 341 when x = 115600 then y + 341 else 0 end)+(case  when x = 341 then y - 342 when x = 116281 then y + 342 else 0 end)+(case  when x = 342 then y - 343 when x = 116964 then y + 343 else 0 end)+(case  when x = 343 then y - 344 when x = 117649 then y + 344 else 0 end)+(case  when x = 344 then y - 345 when x = 118336 then y + 345 else 0 end)+(case  when x = 345 then y - 346 when x = 119025 then y + 346 else 0 end)+(case  when x = 346 then y - 347 when x = 119716 then y + 347 else 0 end)+(case  when x = 347 then y - 348 when x = 120409 then y + 348 else 0 end)+(case  when x = 348 then y - 349 when x = 121104 then y + 349 else 0 end)+(case  when x = 349 then y - 350 when x = 121801 then y + 350 else 0 end)+(case  when x = 350 then y - 351 when x = 122500 then y + 351 else 0 end)+(case  when x = 351 then y - 352 when x = 123201 then y + 352 else 0 end)+(case  when x = 352 then y - 353 when x = 123904 then y + 353 else 0 end)+(case  when x = 353 then y - 354 when x = 124609 then y + 354 else 0 end)+(case  when x = 354 then y - 355 when x = 125316 then y + 355 else 0 end)+(case  when x = 355 then y - 356 when x = 126025 then y + 356 else 0 end)+(case  when x = 356 then y - 357 when x = 126736 then y + 357 else 0 end)+(case  when x = 357 then y - 358 when x = 127449 then y + 358 else 0 end)+(case  when x = 358 then y - 359 when x = 128164 then y + 359 else 0 end)+(case  when x = 359 then y - 360 when x = 128881 then y + 360 else 0 end)+(case  when x = 360 then y - 361 when x = 129600 then y + 361 else 0 end)+(case  when x = 361 then y - 362 when x = 130321 then y + 362 else 0 end)+(case  when x = 362 then y - 363 when x = 131044 then y + 363 else 0 end)+(case  when x = 363 then y - 364 when x = 131769 then y + 364 else 0 end)+(case  when x = 364 then y - 365 when x = 132496 then y + 365 else 0 end)+(case  when x = 365 then y - 366 when x = 133225 then y + 366 else 0 end)+(case  when x = 366 then y - 367 when x = 133956 then y + 367 else 0 end)+(case  when x = 367 then y - 368 when x = 134689 then y + 368 else 0 end)+(case  when x = 368 then y - 369 when x = 135424 then y + 369 else 0 end)+(case  when x = 369 then y - 370 when x = 136161 then y + 370 else 0 end)+(case  when x = 370 then y - 371 when x = 136900 then y + 371 else 0 end)+(case  when x = 371 then y - 372 when x = 137641 then y + 372 else 0 end)+(case  when x = 372 then y - 373 when x = 138384 then y + 373 else 0 end)+(case  when x = 373 then y - 374 when x = 139129 then y + 374 else 0 end)+(case  when x = 374 then y - 375 when x = 139876 then y + 375 else 0 end)+(case  when x = 375 then y - 376 when x = 140625 then y + 376 else 0 end)+(case  when x = 376 then y - 377 when x = 141376 then y + 377 else 0 end)+(case  when x = 377 then y - 378 when x = 142129 then y + 378 else 0 end)+(case  when x = 378 then y - 379 when x = 142884 then y + 379 else 0 end)+(case  when x = 379 then y - 380 when x = 143641 then y + 380 else 0 end)+(case  when x = 396 then y - 397 when x = 156816 then y + 397 else 0 end)+(case  when x = 397 then y - 398 when x = 157609 then y + 398 else 0 end)+(case  when x = 398 then y - 399 when x = 158404 then y + 399 else 0 end)+(case  when x = 399 then y - 400 when x = 159201 then y + 400 else 0 end)+(case  when x = 400 then y - 401 when x = 160000 then y + 401 else 0 end)+(case  when x = 401 then y - 402 when x = 160801 then y + 402 else 0 end)+(case  when x = 402 then y - 403 when x = 161604 then y + 403 else 0 end)+(case  when x = 403 then y - 404 when x = 162409 then y + 404 else 0 end)+(case  when x = 404 then y - 405 when x = 163216 then y + 405 else 0 end)+(case  when x = 405 then y - 406 when x = 164025 then y + 406 else 0 end)+(case  when x = 406 then y - 407 when x = 164836 then y + 407 else 0 end)+(case  when x = 407 then y - 408 when x = 165649 then y + 408 else 0 end)+(case  when x = 408 then y - 409 when x = 166464 then y + 409 else 0 end)+(case  when x = 409 then y - 410 when x = 167281 then y + 410 else 0 end)+(case  when x = 410 then y - 411 when x = 168100 then y + 411 else 0 end)+(case  when x = 411 then y - 412 when x = 168921 then y + 412 else 0 end)+(case  when x = 412 then y - 413 when x = 169744 then y + 413 else 0 end)+(case  when x = 413 then y - 414 when x = 170569 then y + 414 else 0 end)+(case  when x = 414 then y - 415 when x = 171396 then y + 415 else 0 end)+(case  when x = 415 then y - 416 when x = 172225 then y + 416 else 0 end)+(case  when x = 416 then y - 417 when x = 173056 then y + 417 else 0 end)+(case  when x = 417 then y - 418 when x = 173889 then y + 418 else 0 end)+(case  when x = 418 then y - 419 when x = 174724 then y + 419 else 0 end)+(case  when x = 419 then y - 420 when x = 175561 then y + 420 else 0 end)+(case  when x = 420 then y - 421 when x = 176400 then y + 421 else 0 end)+(case  when x = 421 then y - 422 when x = 177241 then y + 422 else 0 end)+(case  when x = 422 then y - 423 when x = 178084 then y + 423 else 0 end)+(case  when x = 423 then y - 424 when x = 178929 then y + 424 else 0 end)+(case  when x = 424 then y - 425 when x = 179776 then y + 425 else 0 end)+(case  when x = 425 then y - 426 when x = 180625 then y + 426 else 0 end)+(case  when x = 426 then y - 427 when x = 181476 then y + 427 else 0 end)+(case  when x = 427 then y - 428 when x = 182329 then y + 428 else 0 end)+(case  when x = 428 then y - 429 when x = 183184 then y + 429 else 0 end)+(case  when x = 429 then y - 430 when x = 184041 then y + 430 else 0 end)+(case  when x = 430 then y - 431 when x = 184900 then y + 431 else 0 end)+(case  when x = 431 then y - 432 when x = 185761 then y + 432 else 0 end)+(case  when x = 432 then y - 433 when x = 186624 then y + 433 else 0 end)+(case  when x = 443 then y - 444 when x = 196249 then y + 444 else 0 end)+(case  when x = 444 then y - 445 when x = 197136 then y + 445 else 0 end)+(case  when x = 445 then y - 446 when x = 198025 then y + 446 else 0 end)+(case  when x = 446 then y - 447 when x = 198916 then y + 447 else 0 end)+(case  when x = 447 then y - 448 when x = 199809 then y + 448 else 0 end)+(case  when x = 448 then y - 449 when x = 200704 then y + 449 else 0 end)+(case  when x = 449 then y - 450 when x = 201601 then y + 450 else 0 end)+(case  when x = 450 then y - 451 when x = 202500 then y + 451 else 0 end)+(case  when x = 451 then y - 452 when x = 203401 then y + 452 else 0 end)+(case  when x = 452 then y - 453 when x = 204304 then y + 453 else 0 end)+(case  when x = 453 then y - 454 when x = 205209 then y + 454 else 0 end)) * ((case  when x + y = 1 then y - 2 when x = 1 then y + 2 else 0 end)+(case  when x + y = 2 then y - 3 when x = 4 then y + 3 else 0 end)) as tst from spktest cll")

So, my questions are:
Is there an actual hard limit in the complexity of expressions that can be run in Spark SQL? If yes, can that limit be set to a higher level than what it is by default? If not, what is the recommended course of action to circumvent the problem?
(The expressions I am dealing with are complex enough that they cannot be easily broken into a series of intermediate steps)
Thanks


text:
Q: Roslyn to ignore subtrees I am trying to use Roslyn and implement my own node visitors by extending CSharpSyntaxWalker and overriding its Visit... methods. But I have a problem.
Consider the following C# class:
class MyClass {
  private void DoSomething() { ... }
  public void DoSomethingElse() { ... }
  public class MyClass2 {
    private int GetSomething() { ... }
  }
}

I need to react only to methods defined in MyClass. I can get a reference to that node. So I can get a reference to a SyntaxNode representing MyClass, so that I can do:
CSharpSyntaxWalker.Visit(node); // node is a SyntaxNode

However the visit will react to GetSomething method, which I want to exclude from the visit. Actually I want to exclude MyClass2. So, in my custom walker, I can override visit methods to react to methods, but when I encounter a class declaration i would like to instruct the visitor to ignore that node.
public class MyWalker : CSharpSyntaxWalker {
  public override void VisitMethodDeclaration { ... }
  public override void VisitClassDeclaration {
    // Do something to exclude this node and its subtree from the visit...
  }
}

How can I do that?

A: Just don't call base.Visit for nodes you don't want to recurse into.


text:
Q: How to run a python script that uses Popen to make a cmd call in windows? I can use the command line solver to manually run the TexasSolver program with no problems. When I try to do the same thing in a python script, the TexasSolver starts and then ends after a few seconds. It doesn't matter if I do a build in sublime or run the script directly in the command prompt. I'm on Windows.
Is there something I am missing to keep the program from terminating early?
The code I am using to open cmd is below and I made a github minimal example repository here if anyone wants to replicate.
# Get the path for console_solver.exe:
base_path = Path(__file__).parent
command = str(base_path / 'TexasSolver-v0.2.0-Windows/TexasSolver-v0.2.0-
Windows/console_solver.exe')

# Run the command asynchronously
p = Popen(command, shell=True, stdout=PIPE, stdin=PIPE)

# Write some input to the process
p.stdin.write(input_str.encode())

# Close the stdin stream to signal the end of the input
p.stdin.close()

# Wait for the command to complete
p.wait()

# Read the output of the command
output = p.stdout.read()

# Print the output
print(output.decode())

Any help would be most appreciated :)


text:
Q: C++ std::function syntax issues I am trying to store a function pointer to be callbacked later like so:
Task->Sync->SetPeriodicTask( &TaskAssigner::ReadAndRelay );

TaskAssigner class declares void ReadAndRelay()
and it holds a SyncManager* Sync object.
(It may be odd, but the child object Sync needs to call back to its parent class' function at certain intervals).
I attempt it like this:
void SyncManager::SetPeriodicTask(std::function<void()> func) {
    CB_func_periodic = func;
    //CB_func_periodic = std::bind(&func, this, std::placeholders::_1);
}

Member variable declaration (SyncManager.h):
private:
    using func = std::function<void()>;
    func CB_func_periodic;

I am not sure what is the correct syntax here, as I get so many errors.
Tried searching the errors, but I couldn't find an answer that suits my case, and I don't want the parameter of SetPeriodicTask(..) to be too complicated for other users to write.
How should I approach this?

A: Here is some sample code based on the details you have posted so far:
#include <functional>

using func = std::function<void()>;

struct S
{
    func CB_func_periodic;
    void SetPeriodicTask( func f ) { CB_func_periodic = f; }
};

struct R
{
    void ReadAndRelay() {}
    S s;
};

int main()
{
    R r;
    r.s.SetPeriodicTask( [&] { r.ReadAndRelay(); } );
}

The argument to SetPeriodicTask should be a Callable,  because that function calls it. The address of member function is not callable.
The code should be structured so that the periodic task cannot be invoked after r is destroyed.


text:
Q: Vivado HLS GPIO switch data for Zybo Board I am building a custom IP core in Vivado HLS to run withing image/video processing system that runs in embedded linux on the Zybo board.  The core takes image/video data in via and AXI stream, performs a processing task (say Sobel), then outputs this to another AXI stream.  This works, however, I'm wishing to use the on board switches for the Zybo to determine which processing task should be ran (default is a passthrough).
I cannot find a resource or simple example that shows (in HLS.. not IP Integrator or the Vivado SDK) how to create a HLS RESOURCE/INTERFACE to read the data from the GPIO switches.  What I have is the code below in my top module:
    #include <hls_video.h>
    #include "ip_types.h"

    void MultiImaging(AXI_STREAM& inputStream, AXI_STREAM& outputStream, int rows, int cols, bool sw0, bool sw1)
    {
    #pragma HLS INTERFACE axis port=inputStream
    #pragma HLS INTERFACE axis port=outputStream

    #pragma HLS RESOURCE variable=rows core=AXI_SLAVE metadata="-bus_bundle CONTROL_BUS"
    #pragma HLS RESOURCE variable=cols core=AXI_SLAVE metadata="-bus_bundle CONTROL_BUS"

    #pragma HLS INTERFACE ap_stable port=rows
    #pragma HLS INTERFACE ap_stable port=cols

    //are these two correct for the switches?
    #pragma HLS INTERFACE axis port=sw0
    #pragma HLS INTERFACE axis port=sw1

    //are these two correct for the switches?
    #pragma HLS RESOURCE variable=sw0 core=AXI_SLAVE //GPIO?
    #pragma HLS RESOURCE variable=sw1 core=AXI_SLAVE //GPIO?

    RGB_IMAGE img(rows, cols);
    RGB_IMAGE oimg(rows, cols);
    RGB_IMAGE sobel_output(rows,cols);

    RGB_IMAGE imgh(rows, cols);
    RGB_IMAGE imgv(rows, cols);

    RGB_IMAGE hsobel(rows, cols);
    RGB_IMAGE vsobel(rows, cols);

    GRAY_IMAGE imgGray(rows, cols);
    GRAY_IMAGE oimgGray(rows, cols);

    #pragma HLS dataflow
    hls::AXIvideo2Mat(inputStream, img);

    //Passthrough
    if(sw1 == 0 && sw0 == 0){
        //..code here
    }
    //Sobel
    else if(sw1 == 0 && sw0 == 1){
    //..code here
    }
    //Threshold
    else if(sw1 == 1 && sw0 == 0){
    //..code here
    }
    //..etc
}

The above works and gives the proper output for 'C Simulation' and 'C Synthesis.'  It errors out in the 'RTL/C Cosimulation' with: "OpenCV Error: Sizes of input arguments do not match."  This makes no sense to me since ALL RGB_IMAGES are set initially with the same rows/cols.

A: Well, the size of the data is NOT done, in this specific case, only by ROWs and COLs.
Try to have a look in your header file, there should be something like:
// typedef video library core structures
typedef hls::stream<ap_axiu<24,1,1,1> >               AXI_STREAM;
typedef hls::Scalar<3, unsigned char>                 RGB_PIXEL;
typedef hls::Mat<MAX_HEIGHT, MAX_WIDTH, HLS_8UC3>     RGB_IMAGE;

This is clear because you are using AXI_STREAM. Here you are defining how many bit there are in a pixel, how many channel color in your pixel and so on. If the size of the images is the same, the sentence "Sizes of input arguments do not match" refers to this mismatching problem with the top main function.


text:
Q: How to prove law of the iterated logarithm The law of the iterated logarithm is stated as below:
Let $X_n$ be i.i.d. random variables with mean zero and unit variance. Define$ S_n = \sum_{i = 1}^n X_i $. Then, almost surely:
$\limsup_{n \rightarrow \infty} \frac{S_n}{\sqrt{2 n \log{\log\ n}}} = 1$.
I can derive the conclusion when $X_n$ have Normal distribution. But my attempt to prove the original one has failed, and I didn't find related articles as well. It will be much appreciated if anyone can provide some related articles or hints.

A: I think the full proof is quite involved (uses SLLN).
Here's a weaker statement. If you consider
$$
E_n = I_{|\frac{S_n}{\sqrt{2 n \log \log n}}| <1}
$$
then
$$
P(E_n) = P( -1 \leq \frac{S_n}{\sqrt{2 n \log \log n}} \leq 1) = P(-\sqrt{2 \log \log n}\leq \frac{S_n}{\sqrt{n}}\leq \sqrt{2 \log \log n}) = \Phi(\sqrt{2 \log \log n}) - \Phi(-\sqrt{2 \log \log n}) \to_n 1-0 = 1
$$
which is convergence in probability.


text:
Q: Date with Hawaii timezone makes invalid JavaScript date For some reason, when I pass a date with a Hawaii time zone to JavaScript's Date() I get "invalid date", but any other time zone I don't. Is there a workaround for this?
var HAST = 'Wed, 31 Jul 2013 07:21:16 HAST';
var hawaiiTime = new Date(HAST);
console.log("Hawaii time: "+hawaiiTime);
// Hawaii time: Invalid Date

var PST = 'Wed, 31 Jul 2013 07:21:16 PST';
var pacificTime = new Date(PST);
console.log("Pacific time: "+pacificTime);
// Pacific time: Wed Jul 31 2013 09:21:16 GMT-0600 (MDT)

jsFiddle

A: RFC 2822 only supports North American UT Offsets (See Page 32).
"EST" / "EDT" /         ; Eastern:  - 5/ - 4
"CST" / "CDT" /         ; Central:  - 6/ - 5
"MST" / "MDT" /         ; Mountain: - 7/ - 6
"PST" / "PDT" /         ; Pacific:  - 8/ - 7

For everything else, you should use the numeric value relative to UTC or GMT.  For HAST, this would be UTC-1000 (10 Hours before UTC):
var HAST = 'Wed, 31 Jul 2013 07:21:16 UTC-1000';

Fiddle


text:
Q: OpenErp facing TypeError: ClientWidget is null I encounter error "TypeError: ClientWidget is null" / "TypeError: this.user_context is undefined" when login to openerp or clicking on app, settings menu.
I have updated the fix on my code i found on this issue https://code.launchpad.net/~openerp-dev/openerp-web/7.0-bug-1095919-psa/+merge/142092 . but still its not resolved...
I have restarted server after updating files. but still facing same error.
kindly suggest me
Thanks

A: Just avoid clicking on "Apps" menu, instead of that click on "Installed Modules" menu. Update your openerp instance, now it's fixed.

A: "TypeError: ClientWidget is null" often occurs after uninstallation of some modules/addons.
A temporary fix is re-installing them.

*

*Login then right-click on any of the top level menus (eg. setting) and open in a new tab.

*Re-install the module

Other good tips can be found at the following link:
http://help.openerp.com/question/8763/removing-social-networks-module-screws-up-system/


text:
Q: XNA Tile Based Collision I have a tile map of 64 x 64 pixel tiles (10 rows, 10 columns)  I want to detect collision between the moving units and any walls or objects.  How can i keep the units centered in the tile map while moving then detect if a unit should change direction without updating his position to soon, and throwing him off the center of the tile?
Example:  If there is an object at TilePositionX = 3, and TilePosition = 0 and that object makes a unit change his direction but always stay centered.  If the unit is heading right towards the object at a XVelocity = 1.0f (this could be any velocity) every update.  Do i have to detect the center position of the unit then add an offset and check if I'm completely inside a tile?  I can't of a good solution for my problem.

A: What I did in a similar situation was work out the target destination of the unit (in pixels) which was the centre of the tile it was moving toward, and then every update move the unit closer to that target. Only once the unit was in the centre of the tile did it check for a new destination.
For example: Unit A is at coordinates (0,0) which in pixels (32,32) (the centre of that tile)
A moves toward tile (0,1), so new destination is (32,96). Every update the unit moves (0,1) pixels down. Once the unit is a (32,96) which is the centre of the tile (0,1), it can then decide where it is going to move next.

A: The way i handled this in a few of my games was i held a Tile and a Pixel offset, the Tile always stays a solid number I.E 1,2 and the pixel offset was moved negative positive based on direction. When it got above the size of a tile we would reset it to zero and add or subtract to the corrosponding Tile type. From there it becomes fairly easy to determine if you are hitting a tile that you cannot move on.


text:
Q: Getting unique items from comma separated lists in Excel I have the following setup (which is shared by a number of users through office 365 and changed frequently):

I need to collect all unique items from a number of comma-separated lists in a range and write out unique values in rows.
Based on the example above, I need something like this:

I have managed to find a solution (I think it was in this forum, or a blog)
=FILTERXML("<x><y>"&SUBSTITUTE(TEXTJOIN(", ",,UNIQUE(FILTERXML("<x><y>"&SUBSTITUTE(TEXTJOIN(",",TRUE,B2:D4),",","</y><y>")&"</y></x>","//y"))),",","</y><y>")&"</y></x>","//y")

but unfortunately, this solution only works on desktop Excel and does not work with Excel 365 (online Excel). Is there anything I can do in Excel 365 to have the same result?

A: =UNIQUE(TRIM(TEXTSPLIT(TEXTJOIN(", ",,B2:D4),,",")))


text:
Q: Redirect request to admin interface After enabling the administrator interface and starting the
development web server on e.g. 128.0.0.1:8000, I am able to
reach the admin interface on
128.0.0.1:8000/admin.

Obviously due the following URL namespace
url(r'^admin/', include(admin.site.urls)).

What do I have to do redirect requests on 128.0.0.1:8000/ automatically to 128.0.0.1:8000/admin?
The URL namespace
url(r'^$/', include(admin.site.urls))

does not seem to be the solution.

A: You say you want a redirect so you would use django's RedirectView
from django.views.generic.base import RedirectView
url(r'^$', RedirectView.as_view(url='/admin'))

A: This works for me. The reverse_lazy did not.
Django 1.8.1 and above
urlpatterns = patterns('',
    url(r'^$', lambda x: HttpResponseRedirect('/admin')),
)

A: Previous solutions either show redirection to a hard-coded URL or use methods that didn't work here. This one works in Django 1.9 and redirects to the admin index view:
from django.shortcuts import redirect

urlpatterns = patterns('',
  url(r'^$', lambda _: redirect('admin:index'), name='index'),
)

A: You can also use path instead of url which has been deprecated and is no longer available in Django 4.
from django.views.generic.base import RedirectView

urlpatterns = [
    path('', RedirectView.as_view(url='/admin')),
    path('admin/', admin.site.urls),
    ...
]

A: Use RedirectView. Instead of hardcoding URLs you can use reverse and the name of an admin view.
from django.core.urlresolvers import reverse
from django.views.generic.base import RedirectView

url(r'^$', RedirectView.as_view(url=reverse('admin:index')))

A: Django 2.0 and above:
from django.contrib import admin
from django.urls import path, reverse_lazy
from django.views.generic.base import RedirectView

urlpatterns = [
    path('', RedirectView.as_view(url=reverse_lazy('admin:index'))),
    path('admin/', admin.site.urls),
]


text:
Q: How important are daily builds? One of the criteria of the Joel Test is daily builds. The idea is that if the build is broken, whoever broke it is around to fix it up. If the build cannot be fixed, everyone will have to check out an old version and work on that. I can understand how this can be pretty bad on centralised version control where it is important to avoid merging and branching as much as possible, but this only sounds like a minor nuisance for distributed version control. Do you agree with this? Are there other reasons why daily builds are important?

A: Need to add a bit to this (and @GoodEnoughs):

but this only sounds like a minor
  nuisance for distributed version
  control.

Emphatically no - what a "server" build does is tell you that your trunk will build and pass its tests more or less from clean (the less is the amount of config you need to do of your environment).
I'm contemplating a switch to DVCS but even having done so you will drag my continuous integration from my cold dead hands.
To take a simple example - you're developing feature "a" he's developing feature "b" distributed or not at some point you need to stitch it all together - if, when you commit, you forget to add a file the app will build on your machine but it won't anywhere else. So when you push the build to your "trunk" the Continuous Integration will trigger and the build will fail and you will know and hopefully before anyone pulls your not quite so complete code you'll be able to take steps.
If you're working on a project with multiple developers you've got to be able to define where release versions come from - the trunk in effect - this is true regardless of how your version control works.
If you've added a feature - especially one on which other people have a dependency - to be able to be confident that when it is pushed to "live" that it builds and passes tests somewhere other than your dev environment is huge. More than that, I deploy from builds from my build server - its kind of how one specifies the "definitive" build. Ultimately I'm going to have user triggered deployment builds. Its no good saying that you can work round it - you can't if you need it (and I have scrambled round dev boxes in an office to find and commit missing files).
Is that all a bit strong? Don't know - but my build server is one of those things that having got I have no wish to give back.

A: Daily builds I believe are very important. If you have a distributed team in different time-zones then it is best to find time which is roughly 'end-of-day' for most of the team. In addition if the daily builds have a automated test component then it is more desirable.
In the days of central source control systems, I would advocate continuous builds running every 5-10 minutes when anything is changed in source code. Since
a compilation error has a potential of slowing most of the team.
For organisations running distributed source control systems, a continuous
build might not be needed as much since developers touch the 'pristine'
code-base directly less often.

A: Daily Builds are okay. You definietly need them if you have nothing else but to be honest I think Joel's test is a little out dated these days.
In my opinion you should be building continuously through out the day, running your unit, system and functional level test cases and ideally packaging and deploying to a stage like environment at the same time while verifying that any DB and environment versioning mechanisms you have in place are working as expected.
If build or deployment times are excessive then consider optomizing away some of these problems with physical or software ram disks, faster internet connections, parallellizing builds, etc. The time you will save by rapidly identifying build breaks is going to amoratize the hardware cost pretty rapidly.

A: Daily builds aren't important.  Daily builds that always are successful are (or ones where it's only broken for an hour).  Having CI when the build is broken 70% of the time isn't very useful, because if the thing is mostly broken it doesn't help you identify an error.

A: I think what's important to note here is that regular builds help catch errors sooner rather than later. It doesn't have to be daily, but often enough. Ideally, it can also run your unit tests.
The goal is to find out when a build breaks before the final testing phase, to find them as soon as possible.
Just set it up to build your main development branch(es).
We use it at work (although we build hourly), and often when we forget to set-it up we find about problems just hours before releasing.

A: Ideally, unless you're building something massive that takes over half a day to build, you would build more than once a day.  Once you've set-up a continuous integration server, such as Hudson or TeamCity, the builds will happen automatically, typically every hour or on every commit, and you'll will be notified if there are any problems.
It's a good way to catch errors early, especially if you are also running automated tests as part of the build.  It's particularly useful for finding configuration errors where the build works on one developer's machine but doesn't work elsewhere because something was omitted from the repository or the environment.
The more advanced continuous integration servers also allow you to track metrics over time (e.g. code coverage percentage, build time, lines of code, etc.)

A: I think it should be daily build, test and deploy to staging server.
The idea behind 'daily build' is to always have something ready which testers and project managers can run so that everyone has an idea of what the real state of the project is.
In the past with desktop apps after the 'daily build' a tester or project manager can immediately run the app so no deploy step had to be mentioned.


text:
Q: Novice question about structuring events in Tcl/Tk If one is attempting to build a desktop program with a semi-complex GUI, especially one in which users can open multiple instances of identical GUI components such as having a "project" GUI and permitting users to open multiple projects concurrently within the main window, is it good practice to push the event listeners further up the widget hierarchy and use the event detail to determine upon which widget the event took place, as opposed to placing event listeners on each individual widget?
For example, in doing something similar in a web browser, there were no event listeners on any individual project GUI elements.  The listeners were on the parent container that held the multiple instances of each project GUI. A project had multiple tabs within its GUI, but only one tab was visible within a project at a time and only one project was visible at any one time; so, it was fairly easy to use classes on the HTML elements and then the e.matches() method on the event.target to act upon the currently visible tab within the currently visible project in a manner that was independent of which project it was that was visible. Without any real performance testing, it was my unqualified impression as an amateur that having as few event listeners as possible was more efficient and I got most of that by reading information that wasn't very exact.
I read recently in John Ousterhout's book that Tk applications can have hundreds of event handlers and wondered whether or not attempting to limit the number of them as described above really makes any difference in Tcl/Tk.
My purpose in asking this question is solely to understand events better in order to start off the coding of my Tcl/Tk program correctly and not have to re-code a bunch of poorly structured event listeners.  I'm not attempting to dispute anything written in the mentioned book and don't know enough to do so if I wanted to.
Thank you for any guidance you may be able to provide.

A: Having hundreds of event handlers is usually just a mark that there's a lot of different events possibly getting sent around. Since you usually (but not always) try to specialize the binding to be as specific as possible, the actual event handler is usually really small, but might call a procedure to do the work. That tends to work out well in practice. Myself, my rule of thumb is that if it is not a simple call then I'll put in a helper procedure; it's easier to debug them that way. (The main exception to my rule is if I want to generate a break.)
There are four levels you can usually bind on (plus more widget-specific ones for canvas and text):

*

*The individual widget. This is the one that you'll use most.

*The widget class. This is mostly used by Tk; you'll usually not want to change it because it may alter the behaviour of code that you just use. (For example, don't alter the behaviour of buttons!)

*The toplevel containing the widget. This is ideal for hotkeys. (Be very careful though; some bindings at this level can be trouble. <Destroy> is the one that usually bites.) Toplevel widgets themselves don't have this, because of rule 1.

*all, which does what it says, and which you almost never need.

You can define others with bindtags… but it's usually not a great plan as it is a lot of work.
The other thing to bear in mind is that Tk supports virtual events, <<FooBarHappened>>. They have all sorts of uses, but the main one in a complex application (that you should take note of) is for defining higher-level events that are triggered by a sequence of low-level events occasionally, and yet which other widgets than the originator may wish to take note of.