text:
Q: Process to support CONTACTS via REST API I am currently struggling to understand how I can get Microsoft Office 365 Rest API working correctly. I have built an Azure AD, Sharepoint Developer Site, Built a sample APP that can get the access token using the following:
https://login.windows.net/common/oauth2/authorize -> then -> https://login.windows.net/common/oauth2/token
Which works perfectly fine and returns:
 { ["token_type"]=> string(6) "Bearer" ["expires_in"]=> string(4) "3600" ["expires_on"]=> string(10) "1420476937" ["not_before"]=> string(10) "1420473037" ["resource"]=> string(30) "https://outlook.office365.com/" ["access_token"]=> string(1276) "eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiIsIng1dCI6ImtyaU1QZG1Cdng2OHNrVDgtbVBBQjNCc2VlQSJ9.eyJhdWQiOiJodHRwczovL291dGxvb2sub2ZmaWNlMzY1LmNvbS8iLCJpc3MiOiJodHRwczovL3N0cy53aW5kb3dzLm5ldC81YjVkNjRjOC03YTgxLTQ1NzctOWEyYy04OTJjNDc1Y2UxN2EvIiwiaWF0IjoxNDIwNDczMDM3LCJuYmYiOjE0MjA0NzMwMzcsImV4cCI6MTQyMDQ3NjkzNywidmVyIjoiMS4wIiwidGlkIjoiNWI1ZDY0YzgtN2E4MS00NTc3LTlhMmMtODkyYzQ3NWNlMTdhIiwiYW1yIjpbInB3ZCJdLCJlbWFpbCI6IndhcnJlbi5kb3lsZUBzeW5ldHkuY29tIiwiaWRwIjoiaHR0cHM6Ly9zdHMud2luZG93cy5uZXQvZDJjMmY2N2EtOTdjYy00N2Q5LWIxOWItNzAyMjRhNGVjYmUyLyIsImFsdHNlY2lkIjoiNTo6MTAwM0JGRkQ4ODg0OEI3RiIsInN1YiI6Imo3QzhzODJ0aDVlQTl4UjFGS0YxeDhya0FjNjlrd0lFeFFTcm5pSzJJS2MiLCJnaXZlbl9uYW1lIjoiV2FycmVuIiwiZmFtaWx5X25hbWUiOiJEb3lsZSIsIm5hbWUiOiJXYXJyZW4gRG95bGUiLCJ1bmlxdWVfbmFtZSI6IndhcnJlbi5kb3lsZUBzeW5ldHkuY29tIiwiYXBwaWQiOiJhYzNkMWVkMS00MDdkLTQzM2YtOTk4Zi1jMzMxOGI5NmUxOTQiLCJhcHBpZGFjciI6IjEiLCJzY3AiOiJDb250YWN0cy5SZWFkIENvbnRhY3RzLldyaXRlIiwiYWNyIjoiMSJ9.g4bNE7iSjPgazeeHdgQZy-ml_YqhPKAvvM0rHGxifu6k6POeHdcpgZurgJOW3AjmoM4SYLg6R1mhqLYwBolb3CxgqQJGIZ8uyzPMhlCtlowcD6JFWYB7McIQruFwxDthSWma_4YGb6pRW4LrTvfh1pxLMnSXhiI2nPltrJUbAJX_XdcnSGm7OqDNM68G8Eb1bz0xW9vAB0yuE7O9ewEcjwlUw4pzS5lNA0Y4-q-Ps9fn0goqzBh-ktZhAQPNhf91zv3v9Py3NPdsA-OtzdcIiPPAL_unmqcDisjChXVgBmHirTsb0Tt_UC2_YFRfMo3xEnE1Md4X17Jqa95N3E1a7Q" ["refresh_token"]=> string(694) "AAABAAAAvPM1KaPlrEqdFSBzjqfTGFrnaPrXWPrZOlHimbEubuR7_30VHdDxmZ_Dk5en6iiFagl-ySjHykZl5M-33l4qAIzjK1AecNfRWt6ISotbWXE9KoYxx5TO5lCPgkF7yJppUSlNoZ2nduQnWffLNGUZql8cO_YqCcAxXKFTg2fhwNt0GfpjZnME96_4C4JptBTuFFSyIl4UmByghVD83k4H32CD4ga0WOLdZx5v0fVztYWA3QxXX1pxzf7UCrh7Xq7nviWv46KDtr2SMozW1AyPVm9OPDdtL0Qbm3DMhyvUNYyJW7N8qiscmTaBLiVOmIbHVnEY_U5_s1MMdw1NfhUY6qtsbrjeyMKG5JqTx9MDnZ1_edsfIjCj29t-aGLJtmNDLJGsCAR6PSbq2bc2GqGpQatv7RtMLk7qvw2tRcz3JQ2RSrJ2tCtYcih8R8zkgUXsNvyoTSe-PdnI9eihJ-oT3gQwc_xm-6eVV_xcVdZyp3Fvp10weh5OG0LU4Lstfhe0J8MFGS5A28I_moSnF6eYSW5EVWDKjQXe5wOkifXUcW2o7A6EyAtVnombDYYiG3zd2BsovEyMm798GWNTBFZZ5szh2hpMDMtzHJy-vVYyGjVk_g7w9FzflWxfGGshIfT6lKZw8G1C9YKoE37z7z-ywj7-RC4siZr-1sqRAdii37ogAA" ["scope"]=> string(28) "Contacts.Read Contacts.Write" ["id_token"]=> string(820) "eyJ0eXAiOiJKV1QiLCJhbGciOiJub25lIn0.eyJhdWQiOiJhYzNkMWVkMS00MDdkLTQzM2YtOTk4Zi1jMzMxOGI5NmUxOTQiLCJpc3MiOiJodHRwczovL3N0cy53aW5kb3dzLm5ldC81YjVkNjRjOC03YTgxLTQ1NzctOWEyYy04OTJjNDc1Y2UxN2EvIiwiaWF0IjoxNDIwNDczMDM3LCJuYmYiOjE0MjA0NzMwMzcsImV4cCI6MTQyMDQ3NjkzNywidmVyIjoiMS4wIiwidGlkIjoiNWI1ZDY0YzgtN2E4MS00NTc3LTlhMmMtODkyYzQ3NWNlMTdhIiwiYW1yIjpbInB3ZCJdLCJlbWFpbCI6IndhcnJlbi5kb3lsZUBzeW5ldHkuY29tIiwiaWRwIjoiaHR0cHM6Ly9zdHMud2luZG93cy5uZXQvZDJjMmY2N2EtOTdjYy00N2Q5LWIxOWItNzAyMjRhNGVjYmUyLyIsInN1YiI6InZMOGlWOUxGX0U0cVg2Ty1wQUo3ZTkyODd1R1FZbUxhWWZ2cFRiX0FUZlkiLCJnaXZlbl9uYW1lIjoiV2FycmVuIiwiZmFtaWx5X25hbWUiOiJEb3lsZSIsIm5hbWUiOiJXYXJyZW4gRG95bGUiLCJ1bmlxdWVfbmFtZSI6IndhcnJlbi5kb3lsZUBzeW5ldHkuY29tIiwicHdkX2V4cCI6IjcxODQ3MDUiLCJwd2RfdXJsIjoiaHR0cHM6Ly9wb3J0YWwubWljcm9zb2Z0b25saW5lLmNvbS9DaGFuZ2VQYXNzd29yZC5hc3B4In0." ["pwd_exp"]=> string(7) "7184705" ["pwd_url"]=> string(54) "https://portal.microsoftonline.com/ChangePassword.aspx" }

However whenever I attempt to work with the Contacts API (https://outlook.office365.com/api/v1.0/me/contacts?$orderby=displayname%20desc)
Using a valid GUID and the token from previously it returns a 401.
Here is my manifest file:
{
  "allowActAsForAllClients": null,
  "appId": "ac3d1ed1-407d-433f-998f-c3318b96e194",
  "appMetadata": {
    "version": 0,
    "data": []
  },
  "appRoles": [],
  "availableToOtherTenants": true,
  "displayName": "CONTACTS MANAGEMENT APP",
  "errorUrl": null,
  "groupMembershipClaims": null,
  "homepage": "https://chrome.uk.cloudcall.com/oAuth/oauth2.php",
  "identifierUris": [
    "https://synetyplc.onmicrosoft.com"
  ],
  "keyCredentials": [],
  "knownClientApplications": [],
  "logoutUrl": null,
  "oauth2AllowImplicitFlow": false,
  "oauth2AllowUrlPathMatching": false,
  "oauth2Permissions": [
    {
      "adminConsentDescription": "Allow the application to access CONTACTS MANAGEMENT APP on behalf of the signed-in user.",
      "adminConsentDisplayName": "Access CONTACTS MANAGEMENT APP",
      "id": "f85ff53b-b153-456d-8a5d-69d9289ab9ff",
      "isEnabled": true,
      "origin": "Application",
      "type": "User",
      "userConsentDescription": "Allow the application to access CONTACTS MANAGEMENT APP on your behalf.",
      "userConsentDisplayName": "Access CONTACTS MANAGEMENT APP",
      "value": "user_impersonation"
    }
  ],
  "oauth2RequirePostResponse": false,
  "passwordCredentials": [
    {
      "customKeyIdentifier": null,
      "endDate": "2017-01-05T12:20:03.3224279Z",
      "keyId": "f6fe401c-8061-47e8-8d21-fdf48841adeb",
      "startDate": "2015-01-05T12:20:03.3224279Z",
      "value": null
    },
    {
      "customKeyIdentifier": null,
      "endDate": "2016-01-05T11:28:08.8654733Z",
      "keyId": "e8a37973-bb60-40e3-b9da-3318c8cf524d",
      "startDate": "2015-01-05T11:28:08.8654733Z",
      "value": null
    }
  ],
  "publicClient": null,
  "replyUrls": [
    "https://chrome.uk.cloudcall.com/oAuth/oauth2.php"
  ],
  "requiredResourceAccess": [
    {
      "resourceAppId": "00000002-0000-0ff1-ce00-000000000000",
      "resourceAccess": [
        {
          "id": "181aac24-028a-486e-a649-b3742c74ec71",
          "type": "Scope"
        }
      ]
    },
    {
      "resourceAppId": "00000002-0000-0000-c000-000000000000",
      "resourceAccess": [
        {
          "id": "311a71cc-e848-46a1-bdf8-97ff7156d8e6",
          "type": "Scope"
        }
      ]
    }
  ],
  "samlMetadataUrl": null,
  "defaultPolicy": [],
  "extensionProperties": [],
  "objectType": "Application",
  "objectId": "e478cfdb-2590-41f0-8efc-adca13c6f5e4",
  "deletionTimestamp": null,
  "createdOnBehalfOf": null,
  "createdObjects": [],
  "manager": null,
  "directReports": [],
  "members": [],
  "memberOf": [],
  "owners": [],
  "ownedObjects": []
}

And here is my JWT:
{
 aud: "https://outlook.office365.com/",
 iss: "https://sts.windows.net/5b5d64c8-7a81-4577-9a2c-892c475ce17a/",
 iat: 1420469746,
 nbf: 1420469746,
 exp: 1420473646,
 ver: "1.0",
 tid: "5b5d64c8-7a81-4577-9a2c-892c475ce17a",
 amr: [
  "pwd"
 ],
 email: "warren.doyle@synety.com",
 idp: "https://sts.windows.net/d2c2f67a-97cc-47d9-b19b-70224a4ecbe2/",
 altsecid: "5::1003BFFD88848B7F",
 sub: "j7C8s82th5eA9xR1FKF1x8rkAc69kwIExQSrniK2IKc",
 given_name: "Warren",
 family_name: "Doyle",
 name: "Warren Doyle",
 unique_name: "warren.doyle@synety.com",
 appid: "ac3d1ed1-407d-433f-998f-c3318b96e194",
 appidacr: "1",
 scp: "Contacts.Read",
 acr: "1"
}

Just to confirm we are aiming to achieve the following:
User visits our websites and wishes to sync their contacts -> They click Authorize which generates the url which then takes them to login.microsoft to Authenticate our Application to access their contacts -> They then return and we then request the Access Token -> We then processs the contacts request and handle the response...
I hope this helps
Regards
Warren

A: Ok. That's the problem. Azure's OAuth only works with Azure Active Directory accounts.


text:
Q: Micro Apps in Flutter I am looking for Micro app architecture reference for flutter mobile application. Preferably a ready to use github project with explanation would really help.
Found https://pub.dev/packages/flutter_micro_app library but not sure if this is the right approach and the no of downloads also very less.
Our intention is to have all the microapps fit together under one app. Each micro app will contain some feature and it should be loosely coupled.
Each scrum team can work and focus on given microapp and the user facing app / main app will build apk/ipa from all the micro apps together.

redpajama_set_name: RedPajamaStackExchange


text:
Q: never keyword used in type parameter in typescript I am trying to understand the following code:
export const getArraySemigroup = <A = never>(): Semigroup<Array<A>> => {
  return {
    concat: (x, y) => concat(x, y)
  }
}

My understanding of never is that it is something that will never be resolved, is it being used as a default paramter her?
I've never (pun intended) seen a type parameter with an equals sign before.

A: <A = never> is generic type default value. By default, generic type default value is empty object, <{}>.
As stated in documentation,

The never type represents the type of values that never occur. For instance, never is the return type for a function expression or an arrow function expression that always throws an exception or one that never returns; Variables also acquire the type never when narrowed by any type guards that can never be true.

This piece of code basically forces a developer to always use generic function with explicit type argument.


text:
Q: NSKeyedUnarchiver error after renaming Xcode project for OSX I am having issues with (I think) the namespace after changing the project name. Here is the error:

Terminating app due to uncaught exception 'NSInvalidUnarchiveOperationException', reason: '* -[NSKeyedUnarchiver decodeObjectForKey:]: cannot decode object of class (Apple.Document) for key (NS.objects); the class may be defined in source code or a library that is not linked'

There is a similar question addressed here, but this is referring to iOS. For Mac, simply changing the display bundle name will not change the name displayed under the icon in the dock.
After changing the project name from "Apple" to "Pear",
I am having issues when getting Document objects from CoreData:
    // Document
    @objc(Document)
    class Document: NSManagedObject {
        @NSManaged var content: NSAttributedString
    }

The Document's content contains SpecialTextAttachments.
    // SpecialTextAttachment
    class SpecialTextAttachment: NSTextAttachment {
        //
    }

When printing the Document's content, it gives me the error addressed above. How would I go about converting Apple.SpecialTextAttachment to Pear.SpecialTextAttachment? It seems like I need to convert it before I iterate through the array of Documents, because just referring to the Document class causes a crash. I also cannot create another project simply for this class as suggested here.
    // in ViewController
    func getDocuments() {
        let fetchRequest = NSFetchRequest()
        fetchRequest.entity = NSEntityDescription.entityForName("Document", inManagedObjectContext: managedObjectContext!)
        fetchRequest.fetchBatchSize = 20
        let docs = (try? managedObjectContext!.executeFetchRequest(fetchRequest)) as! [Document]

    }

A: I sort of gave up on this and continued to go with my decision to rename the project.
So in init() of my class which contains all the methods for handling data from CoreData, I placed the following code:
class CoreDataHelper {
    init() {
        NSKeyedUnarchiver.setClass(SpecialTextAttachment.self, forClassName: "Apple.SpecialTextAttachment")
    }
}

This will convert any Apple.SpecialTextAttachment to Pear.SpecialTextAttachment in any upcoming operations in which SpecialTextAttachment may come up.

A: You can change the displayed name of the app on OS X without changing the bundle name. The procedure is a little different than on iOS.
First, if you haven't already, you need to create an InfoPlist.strings file for your app. Use the "OS X > Resource > Strings File" template:

Then localize InfoPlist.strings to the Base localization:

In the strings file, assign your new name to the CFBundleName key, like this:
CFBundleName = "Pear";

If you have set the CFBundleDisplayName key in Info.plist, you should assign your new name to CFBundleDisplayName in InfoPlist.strings. If you haven't set the CFBundleDisplayName key in Info.plist, you don't have to set it in InfoPlist.strings.
That is sufficient to make your app show its new name in its menu bar and in the Finder. However, your old name still appears, hardcoded, in several places in your MainMenu.xib or Main.storyboard. You can find them by choosing menu bar > Find > Find… (default shortcut: ⌘F) like this:

You need to change these to "Pear". (Technically you don't have to change the "Apple" menu title, because AppKit will change it at runtime to the localized string in InfoPlist.strings, but it's simpler if you just change all instances of "Apple" to "Pear".)
If you have actual localizations to other languages, and you want the app name to be localized, you'll need to localize InfoPlist.strings to each of your localizations and set the CFBundleName (and maybe CFBundleDisplayName) in each of them.

A: It happens because your *.xcodeproj (project.pbxproj) by default use $(TARGET_NAME) for Product Name and $(PRODUCT_NAME) in another fields. For example, Product Module Name by default setted as $(PRODUCT_NAME:c99extidentifier). All you need is replace all PRODUCT_NAME to TARGET_NAME in Build Settings.


text:
Q: jQuery Cycle Plugin Not Working Inside of Modal Box (Simple Modal Plugin) I'm developing a Wordpress theme that opens new posts in modal boxes instead of separate pages.
The image slideshow plugin I'm using to display images for each post (jQuery Cycle Plugin) works great when the post is on its own page, but when using the Simple Modal plugin, the images are shown in a list instead of a slideshow, completely breaking my layout.
Here's what a post looks like on its own (click images to advance slideshow): http://cl.ly/240c3C0i1m1o
You can click on the first thumbnail on this page see how the modal works (I haven't coded in unique URL's for modals yet): http://cl.ly/3A2J1V2q1T0P
I assume the jQuery Cycle plugin isn't working in the modal box because it applies itself to the page before the modal content is loaded by clicking a link? I really don't know.
Any help would be much appreciated. I used this answer to help me implement the modal box: Using simplemodal with wordpress. I have included some relevant code from my theme below.
This is in my header.php file:
<?php
        wp_enqueue_script('jquery.cycle.all.min.js', '/wp-content/themes/Goaty%20Tapes%20Theme/js/jquery.cycle.all.min.js', array('jquery'));
        wp_enqueue_script('product-slideshow', '/wp-content/themes/Goaty%20Tapes%20Theme/js/product-slideshow.js');
?>

This is what's contained in product-slideshow.js (initiates the settings for cycle plugin):
$(document).ready(function() { $('.product-images').cycle({
    fx:      'none',
    next:   '.slide',
    timeout:  0
}); });

I have this in functions.php to get the modal to work:
function my_print_scripts() {
        if (!is_admin()) {
            $url = get_bloginfo('template_url');
            wp_enqueue_script('jquery-simplemodal', 'http://66.147.244.226/~goatytap/wp-content/themes/Goaty%20Tapes%20Theme/js/jquery.simplemodal.1.4.1.min.js', array('jquery'), '1.4.1', true);
            wp_enqueue_script('my_js', 'http://66.147.244.226/~goatytap/wp-content/themes/Goaty%20Tapes%20Theme/js/site.js', null, '1.0', true);
        }
    }
    add_action('wp_print_scripts', 'my_print_scripts');

This is in my site.js file:
jQuery(function ($) {
    $('a.popup').click(function(){
        id = this.rel;
        $.get('http://66.147.244.226/~goatytap/ajax-handler/?id='+id, function (resp) {
            var data = $('

').append(resp);
            // remove modal options if not needed
            data.modal({
                overlayCss:{backgroundColor:'#FFF'},
                containerCss:{backgroundColor:'#fff'}
            });
        });
        return false;
    });
});

A: You are initializing the cycle on document ready. You need to initialize on modal show.
Check their documentation
onShow [Function:null]
The callback function used after the modal dialog has opened

Something like this
data.modal({
  overlayCss:{backgroundColor:'#FFF'},
  containerCss:{backgroundColor:'#fff'},
  onShow: function (dialog) {
     $('.product-images').cycle({
         fx:      'none',
         next:   '.slide',
         timeout:  0
     });

  }
});


text:
Q: further Linking to libcrypto for Leopard Using XCode 3.2.5, I have recently changed my Base SDK from 10.5 to 10.6 (Deployment SDK is still 10.5) and have run into the same thing as mentioned in this thread:
Linking to libcrypto for Leopard?
So the correct libcrypto image is not found when loading the application under Leopard. (Used by Aquatic Prime).
My question is - is this really still the right solution 17 months later? It seems like there has been several XCode releases and OS updates since then, and previous posters have said they have filed bug reports with Apple, I'm just finding it hard to believe that a bug this big still exists. Also, I haven't found any mention of this problem in the Apple Developer Forums which is hard to believe too. It makes me think that I've set something up wrong or other people would still be running into this problem as well.
I have no problem implementing the solution outlined in the previous thread (haven't tried it yet though), I just want to make sure that I'm solving the right problem.


text:
Q: Display matrix data I want to display matrix values just like a matrix
just like this
0 0 1 0 0
0 1 1 1 1
0 0 0 0 0

When I make this code, it appears vertically
for (int i = 0; i < mat.length; i++)
                for (int j = 0; j < mat[i].length; j++)
                    System.out.println(mat[i][j]);

A: System.out.println prints a line and a break line. You would want to use System.out.print that only prints the data.
for (int i = 0; i < mat.length; i++) {
    for (int j = 0; j < mat[i].length; j++) {
        System.out.print(mat[i][j]);
    }
    System.out.println();
}

But now the problem is that all the data in the same row is printed with no space. You can use System.out.print(mat[i][j] + " "); but that's a little clumsy. The best option would be to use System.printf to allow formatting of the text that will be printed on the console:
for (int i = 0; i < mat.length; i++) {
    for (int j = 0; j < mat[i].length; j++) {
        //assuming mat[i][j] content is int...
        System.out.printf("%3d", mat[i][j]);
    }
    System.out.println();
}

More info about formatting with System.out.printf: Format String syntax

A: Try this: Use print in inner loop which will print one row in a single line. Use println in outer loop which will separate each row.
for (int i = 0; i < mat.length; i++){
    for (int j = 0; j < mat[i].length; j++)
        System.out.print(mat[i][j]);
    System.out.println();
}


text:
Q: iOS - progressbar with value from php I have a progress bar in my app showing a percent value.
progressView = [[DDProgressView alloc] initWithFrame:CGRectMake(20.0f, 140.0f, self.view.bounds.size.width - 40.0f, 0.0f)];
[progressView setOuterColor:[UIColor grayColor]];
[progressView setInnerColor:[UIColor lightGrayColor]];
[self.view addSubview:progressView];
[progressView release];
float randomPercentageFloat = 40;
progressView.progress = randomPercentageFloat / 100;

This shows a progress bar which is 40% full. I want to make the progress bar to show a value from a php. I have a php file that echoes a value. I want to change the randomPercentageFloat = 40; to something like
float randomPercentageFloat = "www.website.com/value.php";

Is this possible? How can it be done?

A: You have to establish connection with your server e retrieve the value, following the sample cose
test.php contains this instruction:
<?php echo 40; ?>

here sample viewController.m with progress view linked via Interface Builder
#import "ViewController.h"

@interface ViewController () {
    IBOutlet UIProgressView *progressView;

    NSMutableData *receivedData;
}

@end

@implementation ViewController

- (void)viewDidLoad
{
    [super viewDidLoad];
    progressView.progressTintColor = [UIColor lightGrayColor];
    progressView.trackTintColor = [UIColor grayColor];
    progressView.progress = 0.0f;

    NSURLRequest *theRequest = [NSURLRequest requestWithURL:[NSURL URLWithString:@"http://192.168.0.29/test.php"]
                     cachePolicy:NSURLRequestReloadIgnoringLocalCacheData
                 timeoutInterval:10.0];
    NSURLConnection *theConnection=[[NSURLConnection alloc] initWithRequest:theRequest delegate:self];
    if (!theConnection) {
        UIAlertView *connectFailMessage = [[UIAlertView alloc] initWithTitle:@"NSURLConnection " message:@"Failed in viewDidLoad"  delegate: self cancelButtonTitle:@"Ok" otherButtonTitles: nil];
        [connectFailMessage show];
    }

}

#pragma mark NSURLConnection Methods
- (void)connection:(NSURLConnection *)connection didReceiveResponse:(NSURLResponse *)response
{
    receivedData = [NSMutableData data];
    [receivedData setLength:0];
}

- (void)connection:(NSURLConnection *)connection didReceiveData:(NSData *)data
{

    [receivedData appendData:data];
}

- (void)connection:(NSURLConnection *)connection didFailWithError:(NSError *)error
{

    // inform the user
    UIAlertView *didFailWithErrorMessage = [[UIAlertView alloc] initWithTitle: @"NSURLConnection " message: @"didFailWithError"  delegate: self cancelButtonTitle: @"Ok" otherButtonTitles: nil];
    [didFailWithErrorMessage show];

}

- (void)connectionDidFinishLoading:(NSURLConnection *)connection
{

    NSString *dataString = [[NSString alloc] initWithData: receivedData  encoding:NSUTF8StringEncoding];
    progressView.progress = [dataString floatValue] / 100;
}

@end


text:
Q: Specialized shouldComponentUpdate on PureComponent I am trying to create a component that shouldn't when a certain property is true, but should perform a shallow compare (the default for PureComponent).
I've tried doing the following behavior:
export default class ContentsListView extends PureComponent<Props> {
  shouldComponentUpdate(props: Props) {
    if (props.selecting) {
      return false;
    }
    return super.shouldComponentUpdate(props);
  }

  render() {
  }
}

However, super.shouldComponentUpdate is not defined. Is there some way to "tap into" the shallow compare of PureComponent without writing my own?

A: You should not implement shouldComponentUpdate when you are extending your component using PureComponent. If however you want to use the shouldComponentUpdate functionality you can simply write a wrapper component around your original component or use HOC to implement your custom shouldComponentUpdate and render the PureComponent
Sample code
class ContentsListView extends PureComponent {
  render() {
    console.log("render list");
    return (
      ...
    );
  }
}

export default class Wrapper extends React.Component {
  shouldComponentUpdate(props) {
    if (props.selecting) {
      return false;
    }
    return true;
  }
  render() {
    return <ContentsListView {...this.props} />;
  }
}

You can see a working demo on codesandbox here

A: There is no super.shouldComponentUpdate in PureComponent because it implements shallow checks by checking isPureReactComponent property, not with shouldComponentUpdate. A warning is issued when both isPureReactComponent and shouldComponentUpdate are in use because shouldComponentUpdate efficiently overrides the behaviour of isPureReactComponent.
React doesn't expose its shallowEqual implementation, third-party implementation should be used.
In case this becomes a common task, own PureComponent implementation can be used for extension:
import shallowequal from 'shallowequal';

class MyPureComponent extends Component {
  shouldComponentUpdate(props, state) {
    if (arguments.length < 2)
      throw new Error('Do not mess super arguments up');

    return !shallowequal(props, this.props) || !shallowequal(state, this.state);
  }
}

class Foo extends MyPureComponent {
  shouldComponentUpdate(props, state) {
    if (props.selecting) {
      return false;
    }
    return super.shouldComponentUpdate(props, state);
  }
}

A: If you can consider writing your component in a function instead of class, try React.memo.

React.memo is a higher order component. It's similar to React.PureComponent but for function components instead of classes.
If your function component renders the same result given the same props, you can wrap it in a call to React.memo for a performance boost in some cases by memoizing the result. This means that React will skip rendering the component, and reuse the last rendered result.
By default it will only shallowly compare complex objects in the props object. If you want control over the comparison, you can also provide a custom comparison function as the second argument.

As a second argument, you can pass a function, where you can use prevProps, nextProps, and return false, if you want it to render, or return true if you don't.
import React, { memo } from "react";

const ContentsListView = ({ selecting }) => {
  return <div />;
};

const shouldComponentUpdate = (prevProps, nextProps) => {
  if (nextProps.selecting) { return true; }
  return JSON.stringify(prevProps) === JSON.stringify(nextProps)
}

const Component = memo(ContentsListView, shouldComponentUpdate);

A: I was looking for the same thing as you can see from my comment in January, I had eventually settled on using the shallow-compare library - https://www.npmjs.com/package/shallow-compare
export default class ContentsListView extends Component<Props> {
  shouldComponentUpdate(nextProps, nextState) {
    if (props.selecting) {
      return false;
    }
    return shallowCompare(this, nextProps, nextState);
  }

  render() {
  }
}

however extend from Component, not PureComponent


text:
Q: Redirect an Old Domain to a New Domain with HTTPS in .htaccess Let's say we have,  Old Domain : http://www.olddomain.com

New Domain : https://www.newdomain.org
Here's my .htaccess file data :
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
RewriteCond %{HTTP_HOST} ^olddomain\.com$ [OR]
RewriteCond %{HTTP_HOST} ^www\.olddomain\.com$
RewriteRule ^/?$ "https\:\/\/www\.newdomain\.org\/" [R=301,L]

Sometimes while redirection, browsers are displaying the Security error such that it is untrusted.
Now,

*

*How to make this successfull ?

*How to redirect this from non-www to www ?

A: Change the order of your rules and clear your browser cache before you test it:
RewriteEngine On

RewriteCond %{HTTP_HOST} ^(www\.)?olddomain\.com$ [NC]
RewriteRule ^ https://www.newdomain.org%{REQUEST_URI} [L,R=301]

RewriteCond %{HTTP_HOST} !^www\. [NC]
RewriteRule ^ https://www.newdomain.org%{REQUEST_URI} [L,R=301]

RewriteCond %{HTTPS} off
RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]


text:
Q: Powershell get-help not returning proper help syntax When typing get-help ls from the file system in Powershell 4.0 or Powershell 5.0 on Windows 7, I get:
SYNTAX
Get-ChildItem [[-Path] <String[]>] [[-Filter] <String>] [-Exclude <String[]>] [-Force] [-Include <String[]>] [-Name] [-Recurse]
[-UseTransaction [<SwitchParameter>]] [<CommonParameters>]

Get-ChildItem [[-Filter] <String>] [-Exclude <String[]>] [-Force] [-Include <String[]>] [-Name] [-Recurse] -LiteralPath <String[]>
[-UseTransaction [<SwitchParameter>]] [<CommonParameters>]

I am expecting to see another entry that includes information on the -Attributes parameter.
Trying to force it, with get-help ls -Path C: gives me the same result.
Trying again to force it, with get-help ls -Parameter Attributes gives the following error
get-help : No parameter matches criteria Attributes.
At line:1 char:1
+ get-help ls -Parameter Attributes
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo          : InvalidArgument: (System.Manageme...CommandHelpInfo:ProviderCommandHelpInfo) [Get-Help], PSArgumentException
+ FullyQualifiedErrorId : NoParmsFound,Microsoft.PowerShell.Commands.GetHelpCommand

However, I can still run queries such as ls -Attributes d that return the appropriate result. In this case, a list of all directories in the current directory.
I have tried reinstalling WMF. I have tried reinstalling the help documentation with Update-Help -force. I am completely stumped here.

A: Success! Here is what I did to get it to work.
Ran Save-Help to save a local copy of the help files on disk.
Then ran Update-Help -SourcePath filePath to use those downloaded files to update help.
It does not make any sense why Update-Help -force was not working. I can only guess that perhaps my company's system is setup to use a local copy of the help files, but manually downloading the files forces it to use Microsoft's.
Interestingly enough, running Get-Help Get-ChildItem -Path $null as discussed in the help files does not give information about the Get-ChildItem cmdlet in all drives. I had to write get-help ls -Path Registry::hklm:\


text:
Q: PusherClient 2.1.0 doesn't decrypt messages I'm used to implementing pusher client with javascript and having messages decrypted automatically, what we need is to just configure an auth point that authorizes connection and provides a master encryption key. With DotNet I'm experiencing issues, what seems to me is that this approach doesn't work with dotnet pusher client(I'm using Xamarin).
Trying to solve this issue, I have searched and found this code at github.com/pusher/pusher-websocket-dotnet/blob/master/PusherClient/ChannelDataDecrypter.cs but I'm still not achieving to decrypt, It fails and I keep getting Decryption failed for channel.
I'm sure the key I'm passing to DecryptData() is the same of the one at auth endpoint, and to be more specific, I will provide it, plus the relevant part of the code that suppostly should decrypt:
This is the json (json_event.data):
{"data":{"nonce":"Cr3K2CDnVXH1s65jtQpjorV8PnSvy+At","ciphertext":"R+Bg+aJ1VciAGPdhqVH7vB/NjBzsVLcBjLU1Q8LSA5Czd34DLyJaaVpsQCexYt/bYtUo78e0VY2U5lfv7vFna2NGOq7T+6yE0uj9xlvQSHzpfavErQ1XMaZ6LXoFqZakv786BLZ9BsW2jGA4U4+iBzDA1/kPfeJ15w1qbLink8AihtgNAo0v65YUJpmomWlAHwucFCP+psYmPzhk9Sci9RvLxjKIhq13B/G9urSU+EF990Ox05oqGt3+aoIM7XYnqSw69uqskXJE0WOLUbZYrZNbFgoVuZ8BzoUm82OpBCZVSxtlplFFpKA9oz3mh/jOQg7i8jVftLkgF9Ci2pNmjGsKoxuexTp8suwXLygD7Qkffj/cwdEYPglJ+EebCm/FItnL+Lt/ZsXJaAaeSbsGzsDU+gXNbgSwbRgXt38AI/evllhz8g51mhz6W056ON3IKPzpEgiEc5WhcsGb2tNSzpk4rxN41ZCQ3c/TnXXCMySfL0rh54zTAKXfSMWaOXRXAcUgNyD2NnPYgbtLQ6+QCtYRZITxdETqQqyFpDF0TbJueK5eG3CJUCHOoT0WyOlMs1Ry8XEDLA6Mk4M+Xed917b14imgM4lfOiU+o/tp0sg/x271EpMciKbZ8TXNhN+yCJgR2vLJZlnJ5CT7kxC7TaNaap0XBp9h4Hdu4FTevlIu0XLxd9o3EMht1o0COcpvcBO6nZmQZHgDJ/0jJSkSK6BnCEU2snIHqMJUSjtKl5AMvUISjLN+l/CS7T6FIObtSmlDLRVkFBY4IaYDrDfnsxM+b9Zq4vSVT5+nhnbLg+NrFgwjzQQbBi5GObIPxjxhm4HZ9A8nwBmNM8DWQe1o/OZP3XFqGpYYzpx8+05OW1zBB2gk+1lhHlZdA+dFJa9dko83j5Q2BEZc00HL"}}

C# code:
string key = "60e4a9540aa77099695ca4aa4e5a746f";  //got it from auth endpoint server logs
string msgDecrypted = channelDataDecrypter.DecryptData(System.Text.Encoding.ASCII.GetBytes(key), json_event.data);

This is how I'm generating the key at server side(PHP):
require_once 'pusher/autoload.php';
require_once('pem_files/chat_privatekey_salt.php');
$master_key=md5(base64_encode(openssl_digest($salt.$_POST['channel_name'],'SHA256', true)));

//using md5 because pusher was complaining about the key length and saying that the key must have 32 chars, but I think this is not the point since decryption works in javascript client using this very same key.

$options = array('cluster' => 'us2','useTLS' => true,'encrypted' => true,'encryption_master_key'=>$master_key);
$pusher = new Pusher\Pusher('xxxxxxxx','yyyyyyyy','0000000',$options);
echo $pusher->socket_auth($_POST['channel_name'],$_POST['socket_id']);

As I said before, this fails with Decryption failed for channel. What can I do to fix this?


text:
Q: Is there a meteor package to get a state if I enter a city or lat long coord? I have searched stackexchange but can't find a module that creates the relationship between city, state and country.
If this doesn't exist then could you point me to a scheme db to recreate this. I also didn't want to fill out the db with this region hierarchy but if it doesn't exist then I'll use the db scheme you can recommend.
Thank you,
V.

A: There isn't an existing package afaik but you can use (for example), the google maps geocoding api directly from Meteor.

A: Not directly in meteor, but you can use https://atmospherejs.com/dburles/google-maps, to inject google maps api in meteor, and then you can use the geoCoder to get the text location from the latitude and longitude.


text:
Q: Get address/port of ServerSocket that a Socket is trying to connect to? (Java) I can't word this well, so let me give you an example.
If my code is:
Socket socket = new Socket("1.2.3.4", 80);

and then I run two methods like:
System.out.println(socket.getAddressOfHost());
System.out.println(socket.getPortOfHost());

I want it to return:
1.2.3.4
80

Is this possible and what are the names of these methods?

A: After the Socket is connected to the server, those values can be retrieved using the Socket.getInetAddress() and Socket.getRemoteSocketAddress() methods:
InetAddress addr = socket.getInetAddress();
// InetAddress does not expose port numbers...
System.out.println(addr.getHostAddress());
System.out.println(addr.getHostName());

InetSocketAddress sockaddr = (InetSocketAddress) socket.getRemoteSocketAddress();
InetAddress addr = sockaddr.getAddress();
System.out.println(addr.getHostAddress());
System.out.println(addr.getHostName());
System.out.println(sockaddr.getPort());

Refer to the Socket documentation for more details.


text:
Q: How do I put linebreaks in tooltips? i am using this tutorial to add tooltips to my svg:
http://flowplayer.org/tools/demos/tooltip/index.html
here is a sample of my svg:
<path
       d="M 747.96137,581.40584 L 749.98034,589.3338 L 753.58521,598.75 L 758.74146,607.8125 L 762.33521,613.90625 L 767.02271,619.21875 L 770.92896,622.8125 L 772.49146,625.625 L 771.39771,626.875 L 770.61646,628.125 L 773.42896,635.3125 L 776.24146,638.125 L 778.74146,643.28125 L 782.17896,648.90625 L 786.55396,656.875 L 787.80396,664.21875 L 788.27271,675.78125 L 788.89771,677.5 L 788.58521,680.78125 L 786.24146,682.03125 L 786.55396,683.90625 L 785.92896,685.78125 L 786.24146,688.125 L 786.71021,690 L 784.05396,693.125 L 781.08521,694.53125 L 777.33521,694.6875 L 775.92896,696.25 L 773.58521,697.1875 L 772.33521,696.71875 L 771.24146,695.78125 L 770.92896,692.96875 L 770.14771,689.6875 L 766.86646,684.6875 L 763.42896,682.5 L 759.67896,682.1875 L 758.89771,683.4375 L 755.92896,679.21875 L 755.30396,675.78125 L 752.80396,671.875 L 751.08521,670.78125 L 749.52271,672.8125 L 747.80396,672.5 L 745.77271,667.65625 L 742.96021,663.90625 L 740.14771,658.75 L 737.64771,655.78125 L 734.21021,652.1875 L 736.24146,649.84375 L 739.36646,644.53125 L 739.21021,642.96875 L 734.83521,642.03125 L 733.27271,642.65625 L 733.58521,643.28125 L 736.08521,644.21875 L 734.67896,648.59375 L 733.89771,649.0625 L 732.17896,645.15625 L 730.92896,640.46875 L 730.61646,637.8125 L 732.02271,633.28125 L 732.02271,624.0625 L 729.05396,620.46875 L 727.80396,617.5 L 722.80396,616.25 L 720.92896,615.625 L 719.36646,613.125 L 716.08521,611.5625 L 714.99146,608.28125 L 712.33521,607.34375 L 709.99146,603.75 L 705.92896,602.34375 L 703.11646,600.9375 L 700.61646,600.9375 L 696.71021,601.71875 L 696.55396,603.59375 L 697.33521,604.53125 L 696.86646,605.625 L 693.89771,605.46875 L 690.30396,608.90625 L 686.86646,610.78125 L 683.11646,610.78125 L 679.99146,612.03125 L 679.67896,609.375 L 678.11646,607.5 L 675.30396,606.40625 L 673.74146,605 L 665.92896,601.25 L 658.58521,599.53125 L 654.36646,600.15625 L 648.58521,600.625 L 642.80396,602.65625 L 639.44116,603.2487 L 639.2112,595.46836 L 636.7112,593.59336 L 634.99245,591.87461 L 635.30495,588.90585 L 645.14871,587.65585 L 669.83625,584.84335 L 676.39876,584.21835 L 682.33627,584.06209 L 684.83627,587.8121 L 686.24252,589.21835 L 693.89879,589.3746 L 704.35642,588.7496 L 725.14883,587.4996 L 730.41229,586.8478 L 734.83635,586.8746 L 734.9926,589.6871 L 737.4926,590.46835 L 737.8051,586.2496 L 736.2426,581.87459 L 737.33635,580.31209 L 742.96136,581.09334 L 747.96137,581.40584 z M 759.91605,710.23387 L 762.25981,709.60887 L 763.50981,709.3745 L 764.91607,707.10886 L 767.1817,705.54636 L 768.43171,706.01511 L 770.07234,706.32761 L 770.46296,707.34324 L 767.10358,708.51512 L 763.04106,709.92137 L 760.77543,711.09325 L 759.91605,710.23387 z M 772.96297,705.39011 L 774.13485,706.40574 L 776.79111,704.37448 L 781.94738,700.31197 L 785.54114,696.56195 L 787.96302,690.15568 L 788.90053,688.51505 L 789.05678,685.23379 L 788.35365,685.70254 L 787.41615,688.43692 L 786.00989,692.89006 L 782.88488,697.96821 L 778.66612,702.03072 L 775.38486,703.90573 L 772.96297,705.39011 z"
       id="FL"
       style="fill:#f2d0ff" />

    <path
       d="M 753.42896,550.78125 L 751.71137,551.7183 L 749.21137,550.46829 L 748.58637,548.43704 L 747.33637,544.99954 L 745.14886,542.96828 L 742.64886,542.34328 L 741.08636,537.65578 L 738.4301,531.87452 L 734.3676,529.99951 L 732.33634,528.12451 L 731.08634,525.62451 L 729.05509,523.7495 L 726.86759,522.4995 L 724.68008,519.687 L 721.71133,517.4995 L 717.33632,515.78074 L 716.86757,514.37449 L 714.52382,511.56199 L 714.05507,510.15573 L 710.77381,505.15573 L 707.49256,505.31198 L 703.5863,502.96822 L 702.3363,501.71822 L 702.0238,499.99947 L 702.80505,498.12447 L 704.99255,497.18696 L 704.68005,495.15571 L 710.61756,492.65571 L 719.36757,488.2807 L 726.39883,487.49945 L 742.33636,487.0307 L 744.52386,488.9057 L 746.08636,492.03071 L 750.30512,491.56196 L 762.49264,490.1557 L 765.30514,490.93696 L 777.49266,498.28072 L 787.26244,506.13059 L 782.02271,511.40625 L 779.52271,517.34375 L 779.05396,523.4375 L 777.49146,524.21875 L 776.39771,526.875 L 774.05396,527.5 L 772.02271,530.9375 L 769.36646,533.59375 L 767.17896,536.875 L 765.61646,537.65625 L 762.17896,540.9375 L 759.36646,541.09375 L 760.30396,544.21875 L 755.46021,549.53125 L 753.42896,550.78125 z"
       id="SC"
       style="fill:#ffd0d0" />
    <path
       d="M 684.21127,497.65572 L 679.52376,498.43697 L 671.39875,499.53072 L 663.11749,500.39009 L 663.11749,502.49947 L 663.27374,504.53073 L 663.89874,507.81198 L 667.18,515.46824 L 669.52375,524.99951 L 670.93,530.93702 L 672.4925,535.62452 L 673.89876,542.34328 L 675.93001,548.43704 L 678.43001,551.7183 L 678.89876,554.99955 L 680.77377,555.7808 L 680.93002,557.81206 L 679.21126,562.49956 L 678.74251,565.62457 L 678.58626,567.49957 L 680.14877,571.71833 L 680.46127,576.87458 L 679.68001,579.21834 L 680.30502,579.99959 L 681.71127,580.78084 L 682.33627,584.06209 L 684.83627,587.8121 L 686.24252,589.21835 L 693.89879,589.3746 L 704.35642,588.7496 L 725.14883,587.4996 L 730.41229,586.8478 L 734.83635,586.8746 L 734.9926,589.6871 L 737.4926,590.46835 L 737.8051,586.2496 L 736.2426,581.87459 L 737.33635,580.31209 L 742.96136,581.09334 L 747.77218,581.40049 L 747.02271,575.3125 L 749.21021,565.625 L 750.61646,561.5625 L 750.14771,559.0625 L 754.05396,552.34375 L 753.47531,550.78102 L 751.71137,551.7183 L 749.21137,550.46829 L 748.58637,548.43704 L 747.33637,544.99954 L 745.14886,542.96828 L 742.64886,542.34328 L 741.08636,537.65578 L 738.4301,531.87452 L 734.3676,529.99951 L 732.33634,528.12451 L 731.08634,525.62451 L 729.05509,523.7495 L 726.86759,522.4995 L 724.68008,519.687 L 721.71133,517.4995 L 717.33632,515.78074 L 716.86757,514.37449 L 714.52382,511.56199 L 714.05507,510.15573 L 710.77381,505.15573 L 707.49256,505.31198 L 703.5863,502.96822 L 702.3363,501.71822 L 702.0238,499.99947 L 702.80505,498.12447 L 704.99255,497.18696 L 704.8363,494.98049 L 703.11755,495.46821 L 697.49254,496.40571 L 690.77378,497.18696 L 684.21127,497.65572 z"
       id="GA"
       style="fill:#d7ffd0" />

here is the index.html that includes everything:
  <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>JavaScript Tooltip Demo</title>
<link rel="stylesheet" type="text/css" href="style.css" />
</head>
<body>
<embed src="usmap.svg" width="3000" height="1000"
type="image/svg+xml"
pluginspage="http://www.adobe.com/svg/viewer/install/" />
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>
<script type="text/javascript">
    $(document).ready(function () {
        $(".addtooltip").tooltip();
    }); // closes document.ready
</script>
</body>
</html>

here is how i edited the SVG:
<path
   d="M 170.46112,590.15502 L 170.14862,672.65541 L 171.71112,673.59291 L 174.67989,673.74916 L 176.08614,672.65541 L 178.58615,672.65541 L 178.74241,675.46792 L 185.46119,682.03045 L 185.92994,684.53046 L 189.2112,682.65545 L 189.83621,682.4992 L 190.14871,679.53044 L 191.55496,677.96793 L 192.64872,677.81168 L 194.52373,676.40542 L 197.49249,678.43668 L 198.1175,681.2492 L 199.9925,682.34295 L 201.08626,684.68671 L 204.83628,686.40547 L 208.11754,692.18675 L 210.7738,695.93676 L 212.96131,698.59303 L 214.36757,702.18679 L 219.21134,703.90555 L 224.21137,705.93681 L 225.14887,710.15558 L 225.61762,713.12434 L 224.68012,716.40561 L 222.96136,718.59312 L 221.39885,717.81187 L 219.9926,714.8431 L 217.33633,713.43685 L 215.61758,712.34309 L 214.83632,713.12434 L 216.24258,715.78061 L 216.39883,719.37437 L 215.30507,719.84312 L 213.43007,717.96812 L 211.39881,716.71811 L 211.86756,718.28062 L 213.11756,719.99938 L 212.33631,720.78063 C 212.33631,720.78063 211.55506,720.46813 211.08631,719.84312 C 210.61755,719.21812 209.05505,716.56186 209.05505,716.56186 L 208.11754,714.37435 C 208.11754,714.37435 207.80504,715.62436 207.18004,715.31185 C 206.55503,714.99935 205.93003,713.9056 205.93003,713.9056 L 207.64879,712.03059 L 206.24253,710.62433 L 206.24253,705.78056 L 205.46128,705.78056 L 204.68003,709.06182 L 203.58627,709.53058 L 202.64877,705.93681 L 202.02376,702.34304 L 201.24251,701.87429 L 201.55501,707.34307 L 201.55501,708.43682 L 200.14875,707.18682 L 196.71124,701.40554 L 194.67998,700.93679 L 194.05498,697.34302 L 192.49247,694.53051 L 190.92996,693.43675 L 190.92996,691.24924 L 192.96122,689.99924 L 192.49247,689.68674 L 189.99246,690.31174 L 186.71119,687.96798 L 184.21118,685.15546 L 179.52366,682.65545 L 175.61739,680.15544 L 176.8674,677.03043 L 176.8674,675.46792 L 175.14864,677.03043 L 172.33613,678.12418 L 168.74236,677.03043 L 163.27358,674.68667 L 157.96106,674.68667 L 157.33606,675.15542 L 151.08603,671.4054 L 149.05477,671.0929 L 146.39851,665.46787 L 142.96099,665.78037 L 139.52347,667.18663 L 139.99223,671.56165 L 141.08598,668.74914 L 142.02349,669.06164 L 140.61723,673.28041 L 143.74224,670.62415 L 144.36725,672.18665 L 140.61723,676.40542 L 139.36722,676.09292 L 138.89847,674.21791 L 137.64847,673.43666 L 136.39846,674.53042 L 133.7422,672.81166 L 130.77343,674.84292 L 129.05468,676.87418 L 125.77341,678.90544 L 121.24214,678.74918 L 120.77339,676.71793 L 124.36715,676.09292 L 124.36715,674.84292 L 122.17964,674.21791 L 123.11715,671.87415 L 125.30466,668.12414 L 125.30466,666.40538 L 125.46091,665.62412 L 129.67968,663.43661 L 130.61718,664.68662 L 133.27345,664.68662 L 132.02344,662.18661 L 128.42967,661.87411 L 123.5859,664.53037 L 121.24214,667.81163 L 119.52338,670.31165 L 118.42963,672.49916 L 114.36711,673.90541 L 111.39834,676.40542 L 111.08584,677.96793 L 113.27335,678.90544 L 114.05461,680.93669 L 111.39834,684.06171 L 105.14832,688.12423 L 97.648277,692.18675 L 95.617017,693.2805 L 90.460745,694.37426 L 85.304465,696.56177 L 87.023225,697.81177 L 85.616965,699.21803 L 85.148215,700.31178 L 82.491955,699.37428 L 79.366945,699.53053 L 78.585685,701.71804 L 77.648185,701.71804 L 77.960685,699.37428 L 74.523165,700.62429 L 71.710655,701.56179 L 68.42939,700.31178 L 65.616877,702.18679 L 62.491863,702.18679 L 60.460603,703.4368 L 58.898096,704.21805 L 56.866837,703.90555 L 54.366825,702.8118 L 52.179315,703.4368 L 51.241811,704.3743 L 49.679303,703.28055 L 49.679303,701.40554 L 52.648067,700.15553 L 58.741845,700.78054 L 62.960615,699.21803 L 64.991874,697.18677 L 67.804387,696.56177 L 69.523145,695.78051 L 72.179408,695.93676 L 73.741915,697.18677 L 74.679415,696.87427 L 76.866925,694.21801 L 79.835695,693.2805 L 83.116955,692.6555 L 84.366965,692.343 L 84.991965,692.81175 L 85.773225,692.81175 L 87.023225,689.21798 L 90.929495,687.81173 L 92.804505,684.21796 L 94.992017,679.84294 L 96.554527,678.43668 L 96.867027,675.93667 L 95.304517,677.18668 L 92.023245,677.81168 L 91.398245,675.46792 L 90.148245,675.15542 L 89.210735,676.09292 L 89.054485,678.90544 L 87.648225,678.74918 L 86.241975,673.12416 L 84.991965,674.37416 L 83.898215,673.90541 L 83.585715,672.0304 L 79.679445,672.18665 L 77.648185,673.28041 L 75.148175,672.96791 L 76.554425,671.56165 L 77.023175,669.06164 L 76.398175,667.18663 L 77.804435,666.24913 L 79.054435,666.09288 L 78.429435,664.37412 L 78.429435,660.15535 L 77.491935,659.21784 L 76.710675,660.6241 L 70.773151,660.6241 L 69.366895,659.37409 L 68.741892,655.62408 L 66.710632,652.18656 L 66.710632,651.24906 L 68.741892,650.4678 L 68.898142,648.43654 L 69.991897,647.34279 L 69.210644,646.87404 L 67.960638,647.34279 L 66.866883,644.68653 L 67.804387,639.84275 L 72.179408,636.71774 L 74.679415,635.15523 L 76.554425,631.56147 L 79.210695,630.31146 L 81.710705,631.40522 L 82.023205,633.74898 L 84.366965,633.43647 L 87.491975,631.09271 L 89.054485,631.71772 L 89.991985,632.34272 L 91.554495,632.34272 L 93.742007,631.09271 L 94.523267,626.87394 C 94.523267,626.87394 94.835767,624.06143 95.460767,623.59268 C 96.085767,623.12393 96.398267,622.65518 96.398267,622.65518 L 95.304517,620.78017 L 92.804505,621.56142 L 89.679485,622.34267 L 87.804475,621.87392 L 84.366965,620.15516 L 79.523195,619.99891 L 76.085675,616.40515 L 76.554425,612.65513 L 77.179435,610.31137 L 75.148175,608.59261 L 73.273163,604.99884 L 73.741915,604.21759 L 80.304445,603.74884 L 82.335705,603.74884 L 83.273205,604.68634 L 83.898215,604.68634 L 83.741965,603.12383 L 87.491975,602.49883 L 89.991985,602.81133 L 91.398245,603.90509 L 89.991985,605.93635 L 89.523235,607.3426 L 92.179505,608.90511 L 97.023277,610.62387 L 98.742037,609.68637 L 96.554527,605.4676 L 95.617017,602.34258 L 96.554527,601.56133 L 93.273257,599.68632 L 92.804505,598.59256 L 93.273257,597.03006 L 92.492005,593.28004 L 89.679485,588.74877 L 87.335725,584.68625 L 90.148245,582.81124 L 93.273257,582.81124 L 94.992017,583.43624 L 99.054537,583.27999 L 102.6483,579.84248 L 103.74206,576.87371 L 107.33583,574.52995 L 108.89833,575.46746 L 111.55459,574.84245 L 115.14836,572.81119 L 116.24212,572.65494 L 117.17962,573.4362 L 121.55464,573.27995 L 124.2109,570.31118 L 125.30466,570.31118 L 128.74217,572.65494 L 130.61718,574.6862 L 130.14843,575.77996 L 130.77343,576.87371 L 132.33594,575.31121 L 136.08596,575.62371 L 136.39846,579.21747 L 138.27347,580.62373 L 145.1485,581.24873 L 151.24228,585.31125 L 152.64853,584.37375 L 157.64856,586.87376 L 159.67982,586.24876 L 161.55483,585.4675 L 166.24235,587.34251 L 170.46112,590.15502 z M 59.210598,618.1239 L 61.241857,623.28018 L 61.085606,624.21768 L 58.273093,623.90518 L 56.554335,619.99891 L 54.835577,618.59266 L 52.491816,618.59266 L 52.335566,616.09264 L 54.054324,613.74888 L 55.148079,616.09264 L 56.554335,617.4989 L 59.210598,618.1239 z M 56.710586,650.4678 L 60.304353,651.24906 L 63.898119,652.18656 L 64.679373,653.12407 L 63.116866,656.71783 L 60.148102,656.56158 L 56.866837,653.12407 L 56.710586,650.4678 z M 36.710493,636.87399 L 37.804249,639.374 L 38.898004,640.93651 L 37.804249,641.71776 L 35.772989,638.749 L 35.772989,636.87399 L 36.710493,636.87399 z M 23.429182,707.49932 L 26.710447,705.31181 L 29.991712,704.3743 L 32.491724,704.6868 L 32.960476,706.24931 L 34.835485,706.71806 L 36.710493,704.84306 L 36.397992,703.28055 L 39.054254,702.65555 L 41.866767,705.15556 L 40.773012,706.87431 L 36.554243,707.96807 L 33.89798,707.49932 L 30.304214,706.40556 L 26.085444,707.81182 L 24.522937,708.12432 L 23.429182,707.49932 z M 70.773151,703.1243 L 72.335658,704.99931 L 74.366915,703.4368 L 72.960661,702.18679 L 70.773151,703.1243 z M 73.585664,706.09306 L 74.679415,703.90555 L 76.710675,704.21805 L 75.929425,706.09306 L 73.585664,706.09306 z M 96.398267,704.21805 L 97.804527,705.93681 L 98.742037,704.84306 L 97.960777,702.96805 L 96.398267,704.21805 z M 104.83581,692.18675 L 105.92957,697.81177 L 108.74208,698.59303 L 113.58585,695.78051 L 117.80462,693.2805 L 116.24212,690.93674 L 116.71087,688.59298 L 114.67961,689.84299 L 111.8671,689.06173 L 113.4296,687.96798 L 115.30461,688.74923 L 119.05463,687.03047 L 119.52338,685.62422 L 117.17962,684.84296 L 117.96087,682.96795 L 115.30461,684.84296 L 110.77334,688.28048 L 106.08582,691.09299 L 104.83581,692.18675 z M 145.7735,672.96791 L 148.11726,671.56165 L 147.17976,669.84289 L 145.461,670.7804 L 145.7735,672.96791 z"
   id="AK"
       class="addtooltip"
       onmousemove="GetTrueCoords(evt);"
   style="fill:#f2d0ff"
       title="this sis akw<br>ith a line break" >
    </path>

it is not working correctly
what am i doing wrong?


text:
Q: Akka Actor pubsub: subscribe using multiple parameters in one EventStream? For reference, this question has roots from Scala method performance (collect or foreach or other) looping through sockets?
I'm storing a reference to a websocket inside an actor, and then subscribing that actor to an Akka EventStream:
val socketActor = system.actorOf(Props(new Actor {
  val socket = WebSocketConnection

  def receive = {
    case d: AppMessage ⇒ socket.send(d)
  }
}))
system.eventStream.subscribe(socketActor, classOf[AppMessage])

What bugs me is that the only classifier I can make with an EventStream is a class type. So if you want to route messages to different actors, say based on userId, do you need to create multiple EventStreams and manually build an EventBus or is there something here that I am missing?
It would be nice if I could do something simply like:
system.eventStream.subscribe(socketActor, Map("userId" -> userId, "teamId" -> teamId) )

This may be simply a conceptual issue, as I'm not quite sure what EventStream represents.

A: This was my solution based on the ActorEventBus based on this Gist: https://gist.github.com/3757237
I found this to be a lot more maintainable than dealing with EventStreams. Perhaps multiple EventStreams will be needed in the future, but at this point it readily supports current infrastructure.
MessageBus
First, the MessageBus that handles the outgoing messages to sockets wrapped in actors, based on PubSub channels:
case class MessageEvent(val channel:String, val message:String)

/**
 * message bus to route messages to their appropriate contexts
 */
class MessageBus extends ActorEventBus with LookupClassification {

    type Event = MessageEvent
  type Classifier = String

  protected def mapSize(): Int = {
    10
  }

  protected def classify(event: Event): Classifier = {
    event.channel
  }

  protected def publish(event: Event, subscriber: Subscriber): Unit = {
    subscriber ! event
  }

}

object MessageBus {

  val actorSystem = ActorSystem("contexts")
  val Bus = new MessageBus

  /**
   * create an actor that stores a browser socket
   */
  def browserSocketContext(s: WebSocketConnection, userId: Long, teamId: Long) = {
    val subscriber = actorSystem.actorOf(Props(new BrowserSocket(s,userId,teamId)))

    Bus.subscribe( subscriber, "/app/socket/%s" format s.toString)
    Bus.subscribe( subscriber, "/app/browser/u/%s" format userId )
    Bus.subscribe( subscriber, "/app/browser/t/%s" format teamId )
    Bus.subscribe( subscriber, "/app/browser" )
  }
}

Socket Access with Actors
Here's the actor that actually contains the socket:
/**
 * actor wrapping access for browser socket
 */
class BrowserSocket(
  val s: WebSocketConnection,
  val userId: Long,
  val teamId: Long

) extends Actor {

  def receive = {
    case payload:MessageEvent =>
      s.send(payload.message)

    case ping:MessagePing =>
      s.ping(ping.data)

  }

}

A: EventStreams and the Event Bus is for logging and monitoring as far as I know. You usually build the required functionality using Actors and passing messages between them.
So you send the AppMessage to a custom router actor who will sort out which backing actor to send to. Maybe the router can spawn backing actors if it sees fit, or the actors can subscribe at the router (via passing appropriate messages). This mainly depends on the logic you need to implement.


text:
Q: JBoss 6 creates instance of web service on startup I'm migrating my ear application from JBoss 5 to 6.0.0.Final. I noticed that JBoss 6.0.0.Final instantiates beans which have @WebService annotation on startup. JBoss 5 didn't do that. Is it possible to disable this behaviour in JBoss 6?
Any help is appreciated.

A: The deploy directly contains all the modules that get started up.
What I usually do, is I first backup that deploy directly, and then start stripping out components and check to see if jboss still properly starts and does what I need it to do.
I then use 'netstat' (command line util, which I believe is also on Windows in the dos prompt), to check for any unexpected ports it might be listening on.
Crude. Not good enough to expose to the internet, but ok for intranet use.
Exposing to the internet is another kettle of fish. I'd use a scalable reverse proxy for that, but that's a whole other story.
Also check out JBoss 7. They're boasting about how "fast" it now is. Perhaps inspired by Glassfish which starts pretty much instantaneously...?


text:
Q: Could someone please provide a solution to part A of a rates of change question Rates of change question from a mathematics textbook about a dissolving pill.
Having a hard time understanding the working and thought process of part (a) of the question. Any insight would be greatly appreciated!
Link: https://i.stack.imgur.com/lxJpK.png

A: You just need to differentiate the volume $V(t)$ wrt. $t$ and compare with the formula for the surface:

*

*$V(t)=\frac{4}{3}\pi r^3(t) \Rightarrow \frac{dV}{dt}= 4\pi r^2(t)\cdot \dot r(t)$

*$S(t) = 4\pi r^2(t) \stackrel{\frac{dV}{dt}=kS(t)}{\Longrightarrow}$
$$k\cdot 4\pi r^2(t) = 4\pi r^2(t)\cdot \dot r(t)\Leftrightarrow \boxed{\dot r(t) =k}$$


text:
Q: How to update Fragments in Tablayout? (Viewpager2, FragmentStateAdapter) I create the initial content with the data from an arraylist(i get it from firebase)
the data changes every 15 minutes, how do i call a recreation or how do i settext from the mainactivity to the fragments / how do i update the textviews in the fragments (any of those would work please)
i've read a looot of people solving this with getItem but remember i have FragmentStateAdapter i don't have those methods viewPager2.getAdapter().notifyDataSetChanged() does nothing
Overridable Methods in FragmentStateAdapter
and then i thougth how about an interface just to change the text in my textviews but it always calls an error about a null pointer because i understand that the fragment is being "paused" while i don't see it because of the cycle and so and so
Calling a recreation of the viewPager2.setAdapter(new PagerAdapter() works but only when the gods want? and i want something to force it or to be relaiable
(Sincerelly i don't know anymore why am i using the newest viewpager2 and PagerAdapter FragmentStateAdapter as Google suggests) should i try my way around viewpager and all those old tools?

A: As per Doc we can update the fragment by calling notifyDatasetChanged() therefore by creating a function(setData) in Adapter and inside which calling notifyDatasetChanged() may be work..like below
 fun addData(data: ArrayList<>) {
    mData = data
    notifyDataSetChanged()
    }

A: I encountered this problem, my solution is: save the fragment instance using WeakReference in adapter, and invoke the method in fragment when needing to update it's data.
The code is like this:
public MyAdapter extends FragmentStateAdapter{
    private Map<Integer, WeakReference<MyFragment>> fragmentMap = new HashMap();

    @Override
    public Fragment createFragment(int position) {
        MyFragment fragment=new MyFragment();
        fragmentMap.put(position, new WeakReference<>(fragment));
        return fragment;
    }

    public void updateData(List<String> dataList){
        for (int position : fragmentMap.keySet()) {
            WeakReference<MyFragment> wr = fragmentMap.get(position);
            if (wr != null && wr.get() != null) {
                MyFragment fragment = wr.get();
                fragment.updateData(dataList.get(position));
            }
        }
    }
}

public MyFragment extends Fragment{
    public void updateData(String data){
        ...
    }
}

Now you can invoke updateData(List dataList) on your adapter to update data, and it is using WeakReference to avoid memory leak in the code.


text:
Q: Creating files using array items as filenames I'm trying to create files given an ID and its respective Date. I want to use array items to set the name of these files. Problem is that the outcome is not what i'm expecting when creating the files. I would appreciate your help.
Desired output:
I want to create files on the following format:
FILE_300002_20170515.txt
FILE_500032_20170426.txt
FILE_400044_20170101.txt

Current output:
FILE_300002_400044.txt
FILE_300002_300002.txt
FILE_300002_500032.txt

File Sample:
This is the content of my input file:
300002,20170515,500032,20170426,400044,20170101

My code:
IFS=',' read -r -a array <<< "$input"

ini=1
ID=0
Da=1
num="${#array[@]}"
let num=num/2

while [ $ini -le $num ];do
touch "/path/FILE_${array[Da]}_${array[ID]}.txt"
let ini=ini+1
let Da=Da+2
let ID=ID+2
done

****I've noticed that using only '/path/FILE_${array[ID]}.txt' on the filename, displays all the correct ID's, but when using both,  '/path/FILE_${array[Da]}_${array[ID]}.txt' is messed up

A: Could do it like this
IFS=',' read -r -a array <<< "$input"

for((i=0;i<${#array[@]}-1;i+=2));do

    touch "/path/FILE_${array[i]}_${array[i+1]}.txt"

done

A: awk alternative approach:
awk -F, '{ for(i=1;i<=NF;i+=2) if($i!="") system("touch FILE_"$i"_"$(i+1)".txt") }' input

Check result:
> ls -1 FILE_*
FILE_300002_20170515.txt
FILE_400044_20170101.txt
FILE_500032_20170426.txt

*

*system(command) - execute the operating system command command


text:
Q: Clear all elements under a certain div I'm working on a news feed and I faced the following:
I want to clear all items under the avatar, so there is no wrapped text or anything below.
This image shows the issue:

I want it to be like this (made it with Photoshop):

The code:
.news .news-item .avatar {
  background-image: url("https://dl.dropboxusercontent.com/u/35853519/zakzek.png");
  width: 55px;
  height: 55px;
  background-size: cover;
  float: right;
  margin-left: 15px;
  display: block;
}

JSFiddle (see full screen for better view):
http://jsfiddle.net/shadeed9/6npjgt7y/8/
Thanks,

A: DEMO
Add margin
.meta{
margin-right: 70px;
}

DEMO
or add padding
.meta{
padding-right: 70px;
}

or use transform

A: Without altering the structure of the HTML, one way to achieve that is to add a margin on the meta content div with CSS. Like so:
div.meta { margin-right: 75px; }

That will move everything to the left. Just make the margin larger than your avatar image width and there won't be any wrapping.

A: You can use a table, put the avatar in one column and your other contents in second column, like this:

اطلاق تطبيق مسنجر بلاك بيري رسميًا إلى أندرويد وiOS7

لندن - "القدس" - كشف مصدر من شركة اتصالات اميركية أن الطلب المسبق على هاتف "أبل" الجديد "آيفون 5 سي" ليس "هائلاً" كما أن حجم المعروض منه ومن النسخة الأعلى سعراً جاء مخيباً للآمال. كشفت "أبل" الأسبوع الماضي النقاب عن أحدث طرازين...

عدد الزقزقات 17

A: If it is about dealing with float, then the overflow:hidden; rule is fine.
It shows element where float elements are standing as much inside than aside and earlier in the flow of the document.
http://jsfiddle.net/6npjgt7y/14/
.meta {
    overflow:hidden;
}

It's about layout :)
So does trigger it as well : display:table/inline-block/flex and so does float.

A: Giving the avatar and the h2 element the property display: inline-block will do the trick, also set an width for the h2 element.
http://jsfiddle.net/6npjgt7y/9/


text:
Q: jQAssistant: Can't reset external Neo4J store - why? I'm running jQAssistant with an external Neo4J database. I want to collect the data of our projects and keep them externally for queries.
To do that, I reset the store just before scanning the projects.
However, since a couple of days, I'm getting this error:
[INFO] --- jqassistant-maven-plugin:1.10.0:reset (reset-store) @ foobar ---
[INFO] Scanning for jQAssistant plugins...
[INFO] [Asciidoc Report, CDI, Common, Core Analysis, Core Report, EJB3, GraphML, GraphQL, JAX-RS, JSON,
JUnit, Java, Java EE 6, Maven 2 Repository, Maven 3, OSGi, RDBMS, Spring, TestNG, Tycho, XML, YAML,
jQAssistant JPA 2 Plugin].
[INFO] Connecting to store at 'bolt://myserver:7687' (username=neo4j)
Aug 29, 2021 5:45:11 PM org.neo4j.driver.internal.logging.JULogger info
INFORMATION: Direct driver instance 1436136891 created for server address myserver:7687
[INFO] Resetting store.
[INFO] Resetting store.
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  54:07 min
[INFO] Finished at: 2021-08-29T18:39:13+02:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal com.buschmais.jqassistant:jqassistant-maven-plugin:1.10.0:reset (reset-store)
on project foobar: Execution reset-store of goal
com.buschmais.jqassistant:jqassistant-maven-plugin:1.10.0:reset failed:
Cannot delete node<11994142>, because it still has relationships.
To delete this node, you must first delete its relationships. -> [Help 1]

Is there anything I can do about that? Or should I just reinstall Neo4J?

A: See the comments which led to a Jenkins pipeline. Otherwise cleaning (in my case) can overlap with scanning.


text:
Q: System with two quadratic equations Respected All.
I am unable to find out what's so wrong in the following. Please help me.
It is given that $t$ is a common root of the following two equations given by
\begin{align}
&x^2-bx+d=0   \tag{1}\\
&ax^2-cx+e=0  \tag{2}
\end{align}
where $a,b,c,d,e$ are real numbers.
Then using cross multiplication technique, we shall get
$$\frac{t^2}{cd-be}=\frac{t}{ad-e}=\frac{1}{ab-c}  \tag{3}$$
which will give us $$t=\begin{cases}
\frac{cd-be}{ad-e},\\
\frac{ad-e}{ab-c},\\
\pm\sqrt{\frac{cd-be}{ab-c}}
\end{cases}   \tag{I}$$
My problems starts from here. If $t$ satisfies both (1) and (2) then any linear combination of (1) and (2) should be satisfied by $t$. So that by $\lambda \times (1)+\mu \times (2)$ we shall have
$$(\lambda+\mu a)t^2-(\lambda b+\mu c)t+(\lambda d+\mu e)=0    \tag{4}$$
where $\lambda, \mu$ are suitable reals for (4) to have real roots.
hence we shall get
$$t=\frac{1}{2(\lambda+\mu a)}[(\lambda b+\mu c)\pm \sqrt{(\lambda b+\mu c)^2-4(\lambda+\mu a)(\lambda d+\mu e)}]    \tag{II}$$
All three results in (I) and the results in (II) are supposed to be same. Aren't they?
So what if we consider $(a,b,c,d,e)=(3,9,38,14,119)$. Then from (I) we shall get $(7,7,7)$. But when we shall apply (II) then the results are becoming "dirty": if we choose $\lambda=-16,\mu=20$ the results are coming as $(7.057474264\cdots, 7.06\cdots)$
Why is it happening ? Am I making any theoratical mistake?

A: We have two polynomial equations $f_1(x)=f_2(x)=0$ with quadratic polynomials
$f_1(x)=x^2-bx+d$ and $f_2(x)=ax^2-cx+e$, where $a,b,c,d,e$ are the coefficients.
Then
$$
t=\frac{ \pm \sqrt{b^2 - 4d} + b}{2}
$$
is a common root, if and only if the coefficients satisfy certain poylnomial conditions.
To see this, just substitute this to the second equation.
We can make a case distinction. Assume that $d=0$. Then $t=b$ is a common root for $b\neq 0$ if $a=\frac{bc - e}{b^2}$, and $c,e$ arbitrary; and for $b=0$ if $e=0$ and $a,b,c$ arbitrary.
If $d\neq 0$, $t=\frac{ \sqrt{b^2 - 4d} + b}{2}$ is a common root if and only if
$$
a=\frac{\sqrt{b^2 - 4d}\cdot be - \sqrt{b^2 - 4d}\cdot cd - b^2e + bcd + 2de}{2d^2}.
$$
A very similar formula holds for the case $t=-\frac{ \sqrt{b^2 - 4d} + b}{2}$.
For your example  $(a,b,c,d,e)=(3,9,38,14,119)$ the formula gives $t=7$. We have $\sqrt{b^2-4d}=5$, so that $t=\frac{ \sqrt{b^2 - 4d} + b}{2}=7$, and the relation between $a,b,c,d,e$ is satisfied.
Edit: For your example $(a,b,c,d,e)=(3,9,38,14,119)$ your equation II gives the solutions $t=7$ and $t=(2\lambda + 17\mu)/(\lambda + 3\mu)$. For $\lambda=-16$ and $\mu=20$ I obtain exactly $t=7$, so no problem. I suppose you have done a computational mistake there.


text:
Q: Lagrange multiplier problem - Why doesn't the method work? Maximize the distance to the origin of a function with four variables given the constraints:
\begin{align}
xyza &= 1 \\
x + y + z + a &= 4
\end{align}
Here's my solution: We maximize $f(x,y,z,a) = x^2+y^2+z^2+a^2$ subject to the given constraint equations. The Lagrange multiplier method yields six equations with six variables.
\begin{align}
2x &= \lambda_1yza+\lambda_2\\
2y &= \lambda_1xza+\lambda_2\\
2z &= \lambda_1xya+\lambda_2\\
2a &= \lambda_1xyz+\lambda_2\\
xyza &= 1\\
x + y + z + a &= 4
\end{align}
Mathematica is unable to solve this system. Is there something wrong in the question (I made it up) itself? Thanks!

A: The question is ill posed.
One of the first things you should do before applying Lagrange is to verify
that there is indeed a solution. There is no solution in this case.
Fix $z=-1$, then look for solutions of $x+y-1-{1 \over xy} = 4$. Multiplying across by $x$ gives
$x^2+x (y-5) -{1 \over y} = 0$, which has a solution
$x= {1 \over 2} (5-y -\sqrt{(y-5)^2+{4 \over y}})$.
Letting $y \to \infty$ there are solutions, hence the distance to the origin is unbounded.

A: If you forget the first constraint, and instead minimize the distance to the origin from the hyperplane $x + y + z + a = 4$, your equations will look like:
\begin{align*}
2x & = \lambda_1 \\
2y & = \lambda_1 \\
2z & = \lambda_1 \\
2a & = \lambda_1 \\
4 & = x + y + z + a
\end{align*}
This gives the unique solution $x = y = z = a = 1$.  (You might have guessed this, since $\langle 1, 1, 1, 1 \rangle$ is the normal vector and also represents a point on the plane.)
In any case, adding a second constraint cannot possibly decrease the minimum distance to the origin, and since $(1,1,1,1)$ also lies on the hypersurface represented by your first constraint, it must be the unique solution.
EDIT: Sorry, just realized you wanted to maximize.  Still, you can solve the system you wrote.  We know from equation 5 that $x,y,z,a$ are nonzero, so we can multiply the first equation by $x$, the second by $y$, etc.  Using the 5th equation to simplify gives:
\begin{align*}
2x^2 & = \lambda_2x \\
2y^2 & = \lambda_2y \\
2z^2 & = \lambda_2z \\
2a^2 & = \lambda_2a \\
\end{align*}
We can divide each by its respective variable (again since they are all nonzero) to get $x=y=z=a=\frac{\lambda_2}{2}$, and again we get the unique solution $(1,1,1,1)$.  This may be the only point at which your constraints intersect.


text:
Q: Getting issue while downloading file from blob storage Hi i have to download a 5 to 6 GB file from blob storage, on downloading  i am getting the below mentioned error each time.
Error-:

Unable to read data from the transport connection: An existing connection was forcibly closed by the remote host.
My code for downloading:

protected void btn_download_Click1(object sender, EventArgs e)
{

 AccountFileTransfer = CloudStorageAccount.Parse("DefaultEndpointsProtocol=http;AccountName=" + ACCOUNTNAME + ";AccountKey=" + ACCOUNTKEY);

 if (AccountFileTransfer != null)
    {
        BlobClientFileTransfer = AccountFileTransfer.CreateCloudBlobClient();
        ContainerFileTransfer = BlobClientFileTransfer.GetContainerReference(CONTAINER);
        ContainerFileTransfer.CreateIfNotExist();
        BlobRequestOptions options = new BlobRequestOptions();
        options.Timeout = new TimeSpan(0, 180, 0);
    }

  var blob = ContainerFileTransfer.GetBlockBlobReference(downloadfile);

    var sasUrl = blob.Uri.AbsoluteUri;

    CloudBlockBlob blockBlob = new CloudBlockBlob(sasUrl);

   //blobSize = Convert.ToInt32(lblfilesize.Text.ToString());
    blockSize = 5 * 1024*1024;
    Response.Clear();
    Response.ContentType = "APPLICATION/OCTET-STREAM";
    System.String disHeader = "Attachment; Filename=\"" + blockBlob.Name + "\"";
    Response.AppendHeader("Content-Disposition", disHeader);
    for ( offset = 0; offset < blobSize; offset += blockSize)
    {
        using (var blobStream = blockBlob.OpenRead())
        {
            if ((offset + blockSize) > blobSize)
            {
                blockSize =(blobSize - offset);
            }

            byte[] buffer = new byte[blockSize];
            blobStream.Read(buffer, 0, buffer.Length);
            Response.BinaryWrite(buffer);
            Response.Flush();
        }
    }
    Response.End();

}


text:
Q: how to download office 365 mail attachment file using laravel/PHP I'm using Microsoft graph API for fetching office 365 mails. I got all the emails from the API call but I don't know how to save an attachment from the message object. How do I save contentBytes to file?
Microsoft\Graph\Model\Message Object
(
  [_propDict:protected] => Array
  (
    [@odata.context] => https://graph.microsoft.com/v1.0/$metada
    [@odata.type] => #microsoft.graph.fileAttachment
    [@odata.mediaContentType] => application/pdf
    [id] => AAMkADM4MDYwMDkxLWRmN2UtNDJmMC04NDEwLTljZmQ2N2I4Zjc5NABGAAAAAAAix7kDZj2fRq
    [lastModifiedDateTime] => 2016-04-18T09:44:53Z
    [name] => 1 ) Muhammad Abdullah New.pdf
    [contentType] => application/pdf
    [size] => 104767
    isInline] =>
    [contentId] => C#$F3@eurprd06.prod.outlook.com
    [contentLocation] =>
    [contentBytes] => JVBERi0xLjUNJeLjz9MNyuFJFtfTffYSTIgCjUwNSAwIG9iag08PC9MaW
  )
)

A: Finally i got a solution.We get base64_encoded contentBytes from the Graph API, we need to convert contentBytes to base64_decode format.so you have to write base64_decoded content to a file.
$content=base64_decode($attachment_data->getcontentBytes(),true);
file_put_contents(public_path(). "/sample/".$attachment_data->getname(),$content);
// download code


text:
Q: how to check if a list in the other one in python I need a code to find if "numbers" list in "allnumbers" list. if yes I want python to print out "yes", if no "no".
"numbers" list is in "allnumbers" list.
Can anyone help me?
numbers=[1,25,31,42,45,52,59,63,66,70]
allnumbers=[1,2,9,25,26,30,31,35,42,49,45,51,52,55,59,60,63,65,66,70]

A: As your variable names already suggested, you may use all(...):
numbers = [1, 25, 31, 42, 45, 52, 59, 63, 66, 70]
allnumbers = [1, 2, 9, 25, 26, 30, 31, 35, 42, 49, 45, 51, 52, 55, 59, 60, 63, 65, 66, 70]

if (all(number in allnumbers for number in numbers)):
    print("Yes")

Another variant would include using sets:
smaller_list = set(numbers)
bigger_list  = set(allnumbers)

if biggerlist.intersection(smaller_list) == smaller_list:
    print("yes")

To see, how many numbers have matched, use:
numbers_matched = len(bigger_list.intersection(smaller_list))

See a demo on ideone.com.

A: Your Answer- A More Simple And Readable One
numbers, allnumbers=[1,25,31,42,45,52,59,63,66,70], [1,2,9,25,26,30,31,35,
                                                 42,49,45,51,52,55,59,
                                                 60,63,65,66,70]

# To Get The 'set' version of the list to later compare them
set_A, set_B  = set(numbers), set(allnumbers)

# Checking The Difference with '.difference'
result = set_B.difference(set_A)

# If There Is Some Result Of difference than the lists are not matching
if result:
    print("No Matching Elements Found!")
# Else All The Numbers Are In That List
else:
    print("Matching Elements Found")

Hope This Helps
Happy Coding!


text:
Q: Best possible way to get the ClientID from Cognito In my Cognito setup where I have created multiple sets of userpools and client ids.
Each userpools will contains certain amounts of users and their scope is limited to their respective clientIds.
Now I have created 3 different lambdas, and link those lambdas to Api gateway.
Those lambda's and API end point path looks like signup, confirm-signup, forgot-password, confirm-password.
I have my python ready working forne client id and one user pool exist, these lambda's work fine. and I hardcoded my clientid.
e.g.
def lambda_handler(event, context):
    for field in ["username", "email", "password", "name"]:
        if not event.get(field):
            return {"error": False, "success": True, 'message': f"{field} is not present", "data": None}
    username = event['username']
    email = event["email"]
    password = event['password']
    name = event["name"]
    client = boto3.client('cognito-idp')

client.sign_up(
            ClientId=CLIENT_ID,
            SecretHash=get_secret_hash(username),
            Username=username,
            Password=password,
            UserAttributes=[
            {
                'Name': "name",
                'Value': name
            },
            {
                'Name': "email",
                'Value': email
            }
            ],
            ValidationData=[
                {
                'Name': "email",
                'Value': email
            },
            {
                'Name': "custom:username",
                'Value': username
            }
])

and this client-id is referring to the user pool where this client-id belongs to.
As a part of boto3 client-id is mandatory to call sign-up.
So, now my problem is I have 2 userpool and 2 client-ids.
userpoolA-clientIdA
userpoolB-clinetIdB

so, now for signup API call I'm passing ["username", "email", "password", "name", "userpoolA"]
Now my question is how to get clientIdA in lambda for userpoolA so that I can call the sign-up mthod and add this username to that userpoolA.
Yes, this is necessary, we need to segregate the user's in such way that poolA users can't and won't eligible to access poolB token or authorization.
I see describe_user_pool but as a input it needs UserPoolId not userpoolName. If anyone can suggest the best approach will be really appreciated.


text:
Q: Joining the tables giving redundant data I have 2 tables in sql-server as below -
emp_detail
 EID    ENAME     BHDT        SEXC  GRPT    MSTA    CITY
 2      Ana       5/10/1955   M     43000   M       Mexico
 5      Christina 4/20/1976   F     34000   S       Luea
 1      Maria     3/21/1952   F     55000   S       Berlin
 3      Antonio   10/15/1986  M     45630   U       Mexico
 7      RSTUV     1/14/1945   M     12672   S       New york
 6      Kristy    2/1/1967    F     23000   U       Texas
 4      Thomas    3/5/1962    M     43280   S       London

job_detail
EID Job_Type_Code   Job Val Code    EFDT
1   Plan            ESI             3/7/1950
1   LOC             20              4/20/1970
1   Plan            ESAL            3/9/1966
2   Plan            GARLND          12/15/1956
2   Union           15              11/6/1961
3   Plan            ESI             11/6/1986
3   LOC             15              11/6/1967
3   LOC             15              11/6/1986

I want the result as -
EID ENAME   BHDT       SEXC GRPT  MSTA CITY   plan_det loc_det Union_det Max_date
1   Maria   3/21/1952  F    55000 S    Berlin ESAL     20      (null)    4/20/1970
2   Ana     5/10/1955  M    43000 M    Mexico GARLND   (null)  15       12/15/1956
3   Antonio 10/15/1986 M    45630 U    Mexico ESI      15      (null)   11/6/1986

I have tried following query but no success -
SELECT e.eid, e.ename, e.bhdt, e.sexc, e.grpt, e.msta, e.city,
   case when j.JT_code = 'Plan' then JV_code end as plan_detail,
   case when j.JT_code = 'LOC' then JV_code end as loc_detail,
   case when j.JT_code = 'Union' then JV_code end as Union_detail,
   max(EFDT) latest_date
FROM emp_detail e inner join job_detail j
on e.eid = j.eid
group by e.eid, e.ename, e.bhdt, e.sexc, e.grpt, e.msta, e.city, JT_code, JV_code

Any help is greatly appreciated.

A: You have an EAV record.  You need to summarize the values.  Using your query as a base, group by is a convenient method:
SELECT e.eid, e.ename, e.bhdt, e.sexc, e.grpt, e.msta, e.city,
       max(case when j.JT_code = 'Plan' then JV_code end) as plan_detail,
       max(case when j.JT_code = 'LOC' then JV_code end) as loc_detail,
       max(case when j.JT_code = 'Union' then JV_code end) as Union_detail,
       max(EFDT) as latest_date
FROM emp_detail e inner join
     job_detail j
     on e.eid = j.eid
GROUP BY e.eid, e.ename, e.bhdt, e.sexc, e.grpt, e.msta, e.city;


text:
Q: How, in intuitive terms, does sheafification work? In many books one can find results about the sheafification functor which constructs the "free" sheaf on a given presheaf.
What, in intuitive terms, does the sheafification functor explicitly do? How does it systematically equip any presheaf with a gluing mechanism?

A: Let $U=\bigcup_i U_i$ be an open cover. Whenever we have sections $f_i \in \mathcal F(U_i)$, that agree on the intersections, for any $x \in U$ the definition $$f_x := \text{ stalk of } f_i \text{ at } x \text{ for some }i \text{ with } x \in U_i$$
is independent of the choice of $i$, hence well-defined.
So we equip a presheaf with a glueing mechanism in the sense, that we just define such a collection $(f_x)_{x \in U}$ to be a section over $U$.
Maybe you can think of this like that: The sheafification defines a global section to be a collection of local data. This adds a glueing mechanism to the whole story.
You can also think about (pre)sheaves of functions. Functions on a (global) set are just collections of local data (the evaluation of the function at each point). This is why sheafification is not necessary for such presheaves (like sheaf of holomorphic functions etc.).


text:
Q: Troubleshooting friendly_id w/ Rails 4: working as expected in rails console, getting RecordNotFound error from controller I've been successfully using friendly_id with multiple models in my Rails 4 app. I previously had two models that I've decided to combine (Terminals and Locations). The Terminals show action was previously working with friendly_id, where I could visit /terminals/albany and get the Terminal with the slug 'albany'.
I've gone through the bulk of the refactor to condense down to just Locations, and am on the last piece (fixing views). Along the way I've been testing things in Rails Console and using rspec, and things seem to work as expected. There are other models that still work as expected as well.
Now that I'm working on the new show page for Locations, I'm getting the following error when attempting to visit /locations/albany:
ActiveRecord::RecordNotFound in LocationsController#show
Couldn't find Location with id=albany

However, when I visit /locations/5, it successfully loads the record. It also works in Rails Console:
Location.find(5)                 # returns the correct location object
Location.find(5).slug            # returns 'albany'
Location.friendly.find('albany') # returns the correct location object

When I look at the generated slugs in Rails dbconsole, they all look like they were generated correctly and there are no duplicates.
Here's my model:
Class Location < ActiveRecord::Base
  extend FriendlyId
  friendly_id :slug_candidates, use: [:slugged, :history]

  def slug_candidates
    [
      :name,
      [:name, :zip],
      [:name, :zip, :location_type],
    ]
  end
end

And here's my show action in my controller:
def show
  @locations = Location.friendly.find(params[:id])
end

I'm stumped! Any hints?

A: have you tried adding :finders?
friendly_id :slug_candidates, use: [:slugged, :history, :finders]


text:
Q: What will pole reversal cause to modern world and civilization? I don't think it's just a matter of reorienting maps and recalibrating compasses.
In any case, how long does a inversion last? hours, days, weeks, years? If it lasts days or more.... would  Sun fry Earth surface?

A: Our knowledge of reversals comes from numerical models and paleomagnetic records in rocks, and the latter provide pretty sketchy information because a reversal is a blink of an eye in geologic time. However, as the Wikipedia article states, most paleomagnetists estimate that reversals take about 1,000 to 10,000 years. The risk from radiation comes from a likely weakening of the magnetic field, but the field will not disappear completely, so the risk is not very large. There's no evidence that any species have ever gone extinct because of a reversal. The reduced field and increased flux of charged particles could "result in increased risks for satellites, aviation and ground-based electrical infrastructure", but we'd have hundreds of years to adapt the technology. And there might be aurorae at lower latitudes, which would be pretty cool!


text:
Q: Replace some text with images Qt I would like to make a custom text entry widget in Qt in which certain groups of characters are automatically replaced by little images.  For example, I might want every instance of "cow" to be automatically replaced by a little icon of a cow.
Any idea how to do that?
I'm working in python but solutions in C++ syntax are more than welcome :)

A: You can use QTextEdit widget for that.
From documentation :
QTextEdit can display images, lists and tables. If the text is too large to view within the text edit's viewport, scroll bars will appear. The text edit can load both plain text and HTML files (a subset of HTML 3.2 and 4).
The appropriate HTML construction to insert an image is <img src="path_to_image">. Just replace the words that should be converted to an image with that construction. To do this automatically, you can connect the textChanged() signal to a slot in which you replace key words with the HTML construction.
Also, you may find this usefull.


text:
Q: On composite solutions of $\operatorname{rad}(n-1)=\operatorname{rad}(\varphi(n))$ After I've read the statement of Lehmer's totient problem, see this Wikipedia, I wondered what about composite solutions $n>4$ of the equation $$\operatorname{rad}(n-1)=\operatorname{rad}(\varphi(n)),$$
where $\varphi(n)$ is Euler's totient function and with $\operatorname{rad}(n)$ we denote the radical of an integer, see in Wikipedia this definition. I don't know if this equation was in the literature.

Question. Is it know from the literature or your calculations if is there a composite number $n>4$ satisfying $$\operatorname{rad}(n-1)=\operatorname{rad}(\varphi(n))?$$ Many thanks.

There aren't examples for $4<n<50$. Additionally I've searched in  The On-Line Encyclopedia of Integer Sequences the string rad(phi(n)).

A: If you write a computer program, you'll find lots of counterexamples. For example, the following values of n
yield counterexamples:
$$1729,2431,6601,9605,10585,12801,15211,30889$$


text:
Q: Query optimization using primary key I have a database with two tables: one that keeps information about each user and one that keeps information about the games each user is currently playing. Each user row and each game row has a unique primary ID so that whenever I want to fetch a particular row, I can obtain it by querying with the unique ID (which to my understanding is faster since the row can be fetched through indexing instead of going through each row in the table)
Now, each entry in the game table contains information about the user, so if I wanted to fetch every game for a particular user I would be able to. However, this is how I am currently fetching each game for a user:
I save every unique ID for each game for each user delimited by ':'. I then split this list and do a separate query for EACH game ID. So my question is, is it more efficient to do a separate query using the primary ID for each individual game, or is it better just to do a "SELECT * FROM games WHERE userID='theUsersID'".
To put it in a more general form, is it better in the long run to do several queries against several unique IDs, or doing one query but having to look through every entry in the database? Just to give an idea of my database load, I typically have 10,000 users, each with about 10 games at once. So the comparison is 100,000 queries using a primary key for each query, or 10,000 queries but having to go through all rows for each query.
Thanks.

A: When you do "SELECT * FROM games WHERE userID='theUsersID'", the database engine shouldn't have to actually lookup ALL of the database entries.
If this is a common query, then the userID column should have an index, so that the restriction on the where can be processed quickly.
In the long run, it'll be much more efficient to do only one query then one for each game.

A: MySQL won't even skip a beat with the low volume you are considering.  Allow future flexibility.  Your "games per user" table should be
UniqueID, UserID, GameID --- plus anything else you might want to track on a per user, per game combination... which is most frequent, last time played for a particular game, etc. I would NEVER suggest concatenation of unique games by any delimiter.  This way, you can easily query...
Who likes a particular game by querying on the game ID, or how many distinct games does the average person like to play... What are the top common games among users.
Simple to have multiple indexes on the table..
One on the Primary ID (required), one by User ID and Game ID (for optimized search for game by user first), another by Game ID and User ID (for searching for particular games)

A: So to the best of my understanding, there is a many to many relation between Users and Games.
Each User play many games
Each Game has many users.
and you are currently storing the games played by each user in the users table
User ID | Games ID's
1 | 45:23:12
2 | 23:66:11

So your tables are not normalized. Not even 1NF. Consider Normalizing your Data.
One table for Games, which you already have.
One table for users, you have this too.
One Glue Table, users_games, with :
ID | userID | GameID
1 | 1 | 45
2 | 1 | 23
3 | 1 | 12
4 | 2 | 23
5 | 2 | 66
6 | 2 | 11

So for retrieving Data about one user, you will use Joins
Select GameID from users u join users_games ug on u.id=ug.userID where u.id='2';

and you can extend columns in the users_games table.
This model will be scalable and more manageable.
Hope that makes sense :)

A: SELECT * FROM games WHERE userID=userID would be the best model;
if you nedd to connect multiple games to one user use LEFT JOIN, so you will be able to do it with one query
in the games table have foloving columns id | userID |
on id put Unique AI and  userID  can be simple index

A: As far as i understand, your tables are built like this:
Table_User:
UserId (PK);
UserInformation;
UserInformation2;
...

Table_Games:
GameId (PK);
UserId (PK);
GameInformation;
...

So, doing a LEFT-Join:
SELECT *
FROM Table_Games G
LEFT JOIN Table_User U on (U.UserId = G.UserId)
WHERE UserId = 'MyUserId'

might help you.
Here, you can also SELECT the User by an unique Name or sth. else based on Table_User!
Regards!

A: Performing one big query instead of many small ones is usually preferable because:

*

*It can be performed in just one database round-trip instead of many. This is especially important when database round-trips need to go over the network.

*Allows database engine to use more advanced query plan than simple NESTED LOOPS that you are emulating in your code ("big" databases such as Oracle are also capable of doing MERGE or HASH JOINs, not sure about MySQL).

Doing a JOIN on your two tables should do the trick.


text:
Q: ¿No se conecta a la base de datos en el host o algo está mal? bueno, miren. El script en modo local me funciona, pero cuando lo subo a cualquier servidor(en este caso uno llamado "awardspace" no me funciona pero tampoco da error, o sea, todo está normal, no hay errores. Cuando le doy a registrar en la página me aparece que sí me registré, pero cuando entro a phpmyadmin no aparece la cuenta y cuando intento iniciar sesión en mi sitio me dice que el usuario no existe. No sé a qué se deba esto, ya he revisado que los datos del connect estén correctos varias veces.
Miren una captura de los datos:
https://prnt.sc/pxyuxv
Gracias.
<?php
$db = mysqli_connect("fdb16.awardspace.net", "3224335_debater", "****************", "3224335_debater");

if(isset($_POST['register'])){
$username = $_POST['username'];
$email = $_POST['email'];
$password = $_POST['password'];
$password2 = $_POST['password2'];
if($password === $password2){
$sql2 = ("SELECT * FROM users WHERE username = '$username'");
 $q = mysqli_query($db, $sql2);
if( mysqli_num_rows($q) == 0){
$password = md5($password);
$sql = ("INSERT INTO users VALUES('','$username','$email','$password', '','','','images/default.png','','','','')");
mysqli_query($db, $sql);
mysqli_close($db);
echo '<script language="javascript">
document.getElementById("1").style.display = "block";
</script>';
}else{
echo '<script language="javascript">
document.getElementById("2").style.display = "block";
</script>'; }
 }else{
 echo '<script language="javascript">document.getElementById("3").style.display = "block";

 </script>';
 }
 }
 ?>

A: Como no has mencionado el error.
Haga una prueba de conexion apartado.
Recuerda que se no esté en un servidor local debes informar el ip del servidor.
Prueba de conexion:
<?php
$dbname ="mi_base_de_datos";
$usuario = "mi_usuario";
$password = "mi_contraseña";

$con=mysqli_connect("localhost:3306","root","","$dbname");
// Check connection
if (mysqli_connect_errno())
  {
  echo "Failed to connect to MySQL: " . mysqli_connect_error();
  }

// Change database to "mi_base_de_datos"
mysqli_select_db($con,"mi_base_de_datos");
echo 'conexion exitosa';
?>

Suludos


text:
Q: jQuery UI Sortable and Table/Cell Size I'm having trouble using jQuery UI's sortable.
I have a table in which the rows follow this structure:

    <input type="hidden" name="MyElement.index" autocomplete="off" value="748d4196-c12d-4c61-94f5-ad1a15eb279b">

        <input type="hidden" id="MyElement_748d4196-c12d-4c61-94f5-ad1a15eb279b__ID" name="MyElement[748d4196-c12d-4c61-94f5-ad1a15eb279b].ID" />
        <input type="hidden" ... />
         ...

         ...

The first hidden input (named 'MyElement.index') comes from the Html.BeginCollectionItem() extension method used to support the editing of a variable length list, an approach I've used several times before and which can be seen here or here. Basically it adds a prefix to the names and ids of inputs of repeating items (i.e. items in a collection) in a model/viewmodel so that model binding knows which input belongs to which nested object.
I'm also setting a custom helper in my jQuery UI sortable:
var myHelper = function (e, tr) {
    var $originals = tr.children();
    var $helper = tr.clone();
    $helper.children().each(function (index) {
        $(this).width($originals.eq(index).width())
    });
    return $helper;
};

so that the td's in the row being dragged keep their widths.
However, I don't get the desired effect and instead, when I drag a row, the table shrinks a bit and I can see that the cells of the row being dragged aren't really keeping their exact widths.
1) This is the table (tr and td's backgrounds have been coloured for better visualization):

2) The last row is being dragged. You can see that the table size decreases and the td's widths change in the dragged row. Pink is the row's background.

If I don't use the BeginCollectionItem - which I need to in order to successfully post my ViewModel - I don't get the same issue.
I have tried several modifications on my myHelper function. including removing the hidden input from the $helper object, with no results.

A: Found my solution here: jquery UI Sortable with table and tr width (@Keith's answer).
// Fix the width of the cells
$('td, th', '#tableId').each(function () {
    var cell = $(this);
    cell.width(cell.width());
});

$('#tableBodyId').sortable({
    items: '> tr',
    forcePlaceholderSize: true,
    start: function (event, ui) {
        // Build a placeholder cell that spans all the cells in the row
        var cellCount = 0;
        $('td, th', ui.helper).each(function () {
            // For each td or th try and get it's colspan attribute, and add that or 1 to the total
            var colspan = 1;
            var colspanAttr = $(this).attr('colspan');
            if (colspanAttr > 1) {
                colspan = colspanAttr;
            }
            cellCount += colspan;
        });

        // Add the placeholder UI - note that this is the item's content, so td rather than tr
        ui.placeholder.html(' 	');
    }
}).disableSelection();

(JS Fiddle here)
Also, whenever I modify the table (e.g. append new rows...) I clear the widths set like so
// Clear the fixed widths:
$('td, th', '#sortFixed').each(function () {
    var cell = $(this);
    cell.css('width','');
});

and then re-fix the widths.
Credit goes to @Keith, for the original answer.


text:
Q: MSFS 2020 autopilot issue so I just installed MSFS 2020 after a long time on my laptop and I also installed FlyByWire to install airbus A320, installation of both Microsoft Flight Simulator 2020 and FlyByWire was successful but when I try to fly A320neo I am facing an autopilot issue; I cannot engage the autopilot whenever I click on autopilot button it makes "beep beep" noise and won't engage. Is there any way to solve this issue?
My FlyByWire current version is Development version v0.8.2


text:
Q: Is there any way to break on the next line of code executed in Visual Studio? I'm trying to track down a bug that occurs when I click a particular element on an aspx page...
In the past I've had to track down the class that handles that particular event and put a break point on the line that I think should be hit. Often it takes me several tries before I finally find the correct class....especially if the class is a user control buried somewhere...
So it's left me wondering if there is any way to get Visual Studio to break at the next line of code executed after I click an element (say a button) on an aspx page. I know there is a way to break on any exception that is thrown so I'm thinking maybe there is something similar that could help me.
If this sort of feature isn't a possibility, perhaps someone could suggest a better way for me to quickly find the class I want to debug...

A: Are you looking for the Step Into (F11) or Step Over (F10) ?
-- Edit
Do you also know about the Call Stack window? It can help you determine your location, and what is happening.

A: Have you tried the Debug > Break All ("pause") button?  (Ctrl+Break)

It'll usually break somewhere pretty low on the stack, like at Show() for your main form in a WinForms app, but if you then Step Into to get past that, it'll often work pretty well for this sort of thing.

A: Conditional Breakpoints may be your answer. You can set them were you think your code is breaking and they will only halt when the condition is satisfied.

A: Debug -> Exceptions
Check thrown for the CLR Exceptions.
EDIT
The odds are you are having a CLR exception. Using this method the debugger will always break when an exception occurs. This is very convenient compared to reading the stack trace.

A: Some ideas:

*

*If you use a consistent naming convention for your event handlers then it should be trivial to do a global search for them all and add breakpoints. You can quickly record a macro on the first hit and then play back the macro to take all the pain out of repeating the operation many times. With a bit of practice you'll be able to breakpoint all the handlers in a few seconds flat.

*Add an extra event handler for the event (create it early - e.g. in the constructor - so it's added before all other event handlers that your app adds, and is therefore hopefully called first) and stick a breakpoint in it. Once you've hit the breakpoint you can then single step through the other event handlers on the event.

*write a custom event handler that handles the click and simply generates a new event. Attach all your other event handlers to this secondary event. Then you can breakpoint the first handler and step through the secondary handlers that it calls.


text:
Q: Three.JS buffer geometry stride length Experimenting again with Three.js and buffer geometry. I thought I had things set up properly when I was drawing 1000 lines. Turns out, something is wrong and I'm only drawing half of them.
http://jsfiddle.net/EVYJv/
I should see 10 lines drawn but I only see 5.
I suspect it's the buffer_geometry.attributes set up - that looks wrong - but any change I make to that which seems sensible (e.g. itemSize: 6) causes a flood of OpenGL errors in the console.
What am I doing wrong?

A: What law of nature is it that means you struggle for hours with an issue then find the answer yourself as soon as you post it here...
Working version: http://jsfiddle.net/EVYJv/1/
The answer was to set up buffer_geometry.attributes with itemSize: 3, array: new Float32Array(lines * 6) and numItems: lines * 6.
That doesn't entirely make sense - I thought an 'item' was a line with start and end positions but maybe that's a vertex.
Edit: WestLangly pointed out that you no longer need to specify numItems - working version with that change here: http://jsfiddle.net/EVYJv/3/