text:
Q: Debug a dynamically loaded C++/CLI DLL from a C++ application I'm new to C++ in Visual Studio.
I developed a VS solution with:

*

*a C++/CLI DLL project (A)

*a C++ console project (B), which dynamically loads A using LoadLibraryW
When I run B I need to debug also inside A. But breakpoints in A's code are not working, they have a warning glyph saying it is not possible to break here.
I have tried many settings but nothing worked. Isn't it an easy task? Thanks!

A: Thanks to @HansPassant, the solution is to set this properties:

*

*Project > Properties > Debugging > Debugger Type = Mixed

*Tools > Options > Debugging > General, tick "Use managed compatibility mode".

LoadLibrary doesn't magically enable managed code, the CLR needs to be loaded and initialized first.


text:
Q: How would I override Laravel 5.3 sql grammar How would I set Laravel 5.3 to use VARCHAR over NVARCHAR for migrations on mssql? Is there even a way to do this?
This question also applies to SMALLDATETIME over DATETIME.

A: I created a package that lets you do custom migrations without all the hassle of extending everything yourself.
https://github.com/shiftonelabs/laravel-nomad
Once you install the package, you just change your migration to use the new passthru method, and you can give it the definition you want for your field.
// pass definition as third parameter
$table->passthru('string', 'username', 'varchar(60)');
$table->passthru('datetime', 'expires_at', 'smalldatetime');

// or use fluent definition method
$table->passthru('string', 'username')->definition('varchar(60)');
$table->passthru('datetime', 'expires_at')->definition('smalldatetime');

// if there is no defintion, it defaults to the first parameter
$table->passthru('smalldatetime', 'expires_at');

A: It's doable, but you'll probably have to create a new database driver yourself, which involves in the creation of
DatabaseManager
Connection
ConnectionFactory
Schema Builder
Schema Grammar
...

The good part is that you probably can extend all those guys from Laravel and only change the grammar class:
 /**
  * Create the column definition for a string type.
  *
  * @param  \Illuminate\Support\Fluent  $column
  * @return string
  */
 protected function typeString(Fluent $column)
 {
   return 'NVARCHAR ('.$column->length.')';
 }

An example of it in this package:
https://github.com/jacquestvanzuydam/laravel-firebird/tree/5.3-support/src/Firebird

redpajama_set_name: RedPajamaStackExchange


text:
Q: How to pass a mixture of strings and arrays to an executable from PowerShell? I'm trying to call vswhere.exe to find various Visual Studio executables for CI purposes. In order to simplify this, I've created a wrapper function:
function Run-VsWhere { &("${env:ProgramFiles(x86)}/Microsoft Visual Studio/Installer/vswhere.exe") $args }

function Find-VSWherePath([string[]] $workloads, [string] $pathGlob) {
    Run-VsWhere -products * -prerelease -latest -requires $workloads -requiresAny -find $pathGlob
}

This works perfectly for single workloads, e.g. for MSBuild:
Find-VSWherePath "Microsoft.Component.MSBuild" "MSBuild/**/Bin/MSBuild.exe"
> C:\Program Files (x86)\Microsoft Visual Studio\2019\Preview\MSBuild\Current\Bin\MSBuild.exe

... but falls apart for multiple ones like VSTest:
Find-VSWherePath "Microsoft.VisualStudio.Workload.ManagedDesktop","Microsoft.VisualStudio.Workload.Web" "**/TestPlatform/vstest.console.exe"
> (nothing)

If I replace the call to vswhere with a call to echoargs, it demonstrates exactly what's going wrong. MSBuild:
> Arg 0 is <-products>
> Arg 1 is <*>
> Arg 2 is <-prerelease>
> Arg 3 is <-latest>
> Arg 4 is <-requires>
> Arg 5 is <Microsoft.Component.MSBuild>
> Arg 6 is <-requiresAny>
> Arg 7 is <-find>
> Arg 8 is <MSBuild/**/Bin/MSBuild.exe>

vs VSTest:
> Arg 0 is <-products>
> Arg 1 is <*>
> Arg 2 is <-prerelease>
> Arg 3 is <-latest>
> Arg 4 is <-requires>
> Arg 5 is <Microsoft.VisualStudio.Workload.ManagedDesktop Microsoft.VisualStudio.Workload.Web>
> Arg 6 is <-requiresAny>
> Arg 7 is <-find>
> Arg 8 is <**/TestPlatform/vstest.console.exe>

The issue is that the $workloads parameter is being passed to Run-VsWhere as a single parameter joined by a space, instead of one parameter per element in the array - how can I force it to pass as I need? I've tried every combination of splatting, splitting, joining, single-quoting, double-quoting... but nothing seems to work.

A: Using the automatic variable $args passes the arguments as they're provided, meaning that an array argument nested in $args is passed as-is (i.e. remains an array). Use splatting (@args) to flatten/unroll nested arrays.
function Run-VsWhere {
    & "${env:ProgramFiles(x86)}/Microsoft Visual Studio/Installer/vswhere.exe" @args
}

A: Is it possible your second call to Find-VSWherePath does not result in anything because the specified workloads are not available? I tried the code below and it does work.
function Find-VSWherePath([string[]] $workloads, [string] $pathGlob) {
    . "${env:ProgramFiles(x86)}/Microsoft Visual Studio/Installer/vswhere.exe" -products * -prerelease -latest -requires $workloads -requiresAny -find $pathGlob
}

clear

"This works"
Find-VSWherePath "Microsoft.Component.MSBuild" "MSBuild/**/Bin/MSBuild.exe"

"No result"
Find-VSWherePath "Microsoft.VisualStudio.Workload.Web" "MSBuild/**/Bin/MSBuild.exe"

"Try two workloads, the first is not available, but the second is. This also works."
Find-VSWherePath "Microsoft.VisualStudio.Workload.Web","Microsoft.VisualStudio.Component.NuGet" "MSBuild/**/Bin/MSBuild.exe"


text:
Q: iOS Bluetooth CBPeripheralManager Dictionary Key Support In the CBPeripheralManager documentation, the startAdvertising method receives a dictionary containing the data you would like to advertise. According to the documentation, CBPeripheralManager.startAdvertising only accepts two possible keys in its dictionary argument: CBAdvertisementDataLocalNameKey and CBAdvertisementDataServiceUUIDsKey.
However, in Apple's documentation for Turning an iOS Device into an iBeacon they suggest that you are able to pass the dictionary that is returned from CLBeaconRegion's peripheralData method. The dictionary returned from this method contains 1 key value pair with the key being named "kCBAdvDataAppleBeaconKey" and the value being the proximityUUID, major, minor, and beacon identifier.
A dump of a dictionary returned from the peripheralData method is displayed here:
Dictionary Dump
My Question is: How does the PeripheralManager.startAdvertisement method receive a dictionary with key "kCBAdvDataAppleBeaconKey" and still broadcast without error if the only keys it supports are CBAdvertisementDataLocalNameKey and CBAdvertisementDataServiceUUIDsKey?

A: The simplest and most likely explanation is that the documentation about CBPeripheralManager.startAdvertising only accepting the two keys is inaccurate.  The docs may simply never have been updated after iBeacon support was released.
On a related note, I suspect (but cannot confirm) that the method supports even more keys as private APIs.  You'd have to decompile the framework binary to figure out what these are.
The reality is that it is very common for documentation to be out of sync with new features added to APIs, and even more common for documentation not to mention secret behavior that isn't publicly supported.


text:
Q: Grunt conditional declarations based on template/option values I have these template settings in my Grunt configuration:
grunt.config.init({
    targetSuffix:   grunt.option("target") || "dev",

    mainTarget:     grunt.option("installTo") || _WEB_ROOT + "client",
    devTarget:      "<%= mainTarget %>-<%= targetSuffix %>",
    coverageTarget: _WEB_ROOT + "client-coverage" + ("<%= targetSuffix %>" ? "-<%= targetSuffix %>" : ""),

    // ...
});

The first two work without error, whether specified on the command line (grunt install --target=user1) or in a "shortcut" task:
grunt.registerTask("user1", "same as 'grunt install --target=user1'", function() {
    grunt.config.set("targetSuffix", "user1");
    // or grunt.option("target", "user1");
    grunt.task.run("install");
});

(It's not clear in the documentation, but I'll assume for now that grunt.config processing happens after grunt.option.)
It's the coverageTarget definition that is giving me problems. If no target is specified, I want _WEB_ROOT + "client-coverage". If there is a target, add a hyphen then the target value. The difference from devTarget is that it has mainTarget for the unspecified state, because the two are used separately throughout my tasks.
I don't need or want to have to right separate tasks/targets to support a coverageMainTarget and coverageDevTarget. However, I can't seem to get any conditionals (ternary operator) to work in the declaration.
Here are the results for four test cases: default behavior, command-line option, grunt.option() and grunt.config.set().
/*
 * "client-coverage-dev" for default and grunt.option().
 * Should be "client-coverage". Implies "<%= targetSuffix %>"
 * isn't "dev", but that's what gets appended.
 * "client-coverage-user1" for CL and grunt.config.set()
 */
coverageTarget: _WEB_ROOT + "client-coverage" + ("<%= targetSuffix %>" != "dev" ? "-<%= targetSuffix %>" : "")

/*
 * Only appends a target for CL option. All others yield
 * "client-coverage".
 */
coverageTarget: _WEB_ROOT + "client-coverage" + (grunt.option("target") ? "-<%= targetSuffix %>" : "")
// or
coverageTarget: _WEB_ROOT + "client-coverage" + (grunt.option("target") ? "-" + grunt.option("target") : "")

/*
 * All output "client-coverage".
 */
coverageTarget: _WEB_ROOT + "client-coverage" + (grunt.config.get("targetSuffix") ? "-<%= targetSuffix %>" : "")
// or
coverageTarget: _WEB_ROOT + "client-coverage" + (grunt.config.get("targetSuffix") ? "-" + grunt.config.get("targetSuffix") : "")

I've also tried processing outside/before grunt.config.init, but in that case grunt.option() only returns the target option if it's specified on the command line, not if set with grunt.option().
How can I tell Grunt to construct a declaration based on the existence or value of another declaration or template string? Is there some Grunt dependency loop going on here?

A: "The Grunt option API is for sharing parameters across multiple tasks and accessing parameters set on the command line." However, to make the values easily accessible in Grunt templates*, I decided to stick with grunt.config instead of grunt.option.
I then realized I can do the processing I need outside of and after the call to grunt.config.init() (a.k.a., grunt.initConfig()).
grunt.config.init({
    // for example...
    clean: {
        options: {
            force: true
        }
        ,build:    ["client-build/", "client/extlibs/", "coverage/"]
        ,prod:     "<%= installTarget %>/**"
        ,dev:      "<%= installTarget %>/**"
        ,coverage: "<%= cvgTarget %>/**"
    }
});

// store the function so you can re-process, if needed
var processOpts = function () {
    var _WEB_ROOT = "/my/webroot/";
    var _CONTEXTS = ["prod", "dev"];
    var dev = grunt.option("dev");

    if (dev === true) { // if given just "--dev"
        grunt.config.set("installTarget", _WEB_ROOT + "client-dev");
        grunt.config.set("cvgTarget",     _WEB_ROOT + "client-coverage-dev");
        grunt.config.set("context",       "dev");
    } else if (dev !== undefined && dev !== "") { // "--dev=name"
        grunt.config.set("installTarget", _WEB_ROOT + "client-" + dev);
        grunt.config.set("cvgTarget",     _WEB_ROOT + "client-coverage-" + dev);
        grunt.config.set("context",       "dev");
    } else {
        var target = grunt.option("installTo");
        if (target === undefined || target === "") {
            grunt.config.set("installTarget", _WEB_ROOT + "client");
            grunt.config.set("cvgTarget",     _WEB_ROOT + "client-coverage");
        } else {
            grunt.config.set("installTarget", target);
        }

        var context = grunt.option("context");
        if (_CONTEXTS.indexOf(context) === -1) {
            // invalid context, default to first value ("prod")
            grunt.config.set("context", _CONTEXTS[0]);
        } else {
            grunt.config.set("context", context);
        }
    }

    grunt.verbose.writeln("installTarget: " + grunt.config.get("installTarget"));
    grunt.verbose.writeln("cvgTarget: "     + grunt.config.get("cvgTarget"));
    grunt.verbose.writeln("context: "       + grunt.config.get("context"));

    // build context-specific targets dynamically
    var i;
    var commonTasks = ["compass", "requirejs", "clean", "template", "copy", "setmymode"];
    for (i=0; i<commonTasks.length; i++) {
        commonTasks[i] += ":" + grunt.config.get("context");
    }

    grunt.registerTask("prod", ["clean:build", "bower:install", "jshint:prod", "karma:unit"].concat(commonTasks));
    grunt.registerTask("dev",  [               "bower:install"                             ].concat(commonTasks));
};
processOpts();

// main tasks for command-line
grunt.registerTask("default",  ["prod", "coverage"]);

// dev task aliases
grunt.registerTask("n13", "same as 'grunt dev --dev=n13'", function() {
    grunt.option("dev", "n13");
    processOpts();
    grunt.task.run("dev");
});


text:
Q: Android - Passing objects between activities I know that if I want to send a custom object O from Activity A to Activity B, I have to make the object O implement Parcelable.
However, currently my object O has a lot of various types of fields.
In this case, can I just use a singleton?
For example,
1. in Activity B, I create a public static Object o;

2. in Activity A, I do
B.o = ObjectToSend;
startActivity(intent for B);

3. in Activity B's onCreate(), I do
O o = B.o;
if o is not null, use o..

Is there a problem with this approach?
Thanks

A: can you just make it serializable? ( if so, look into this question for an example: Pass serializable object throught intent )
if you really want to go with the "static" approach, i'd look into using a subclass of Application, it's more designed to handle application state, which is what your are trying to pass around. if so, google "android custom application class" and you will get some pretty good blogs and posts about using it.
a decent note on Parcelable vs Serializable

A: Assuming no other threads could change those variables it will work that way, but it's usually more common to separate the Singleton out into it's own class (e.g.)
public class ObjectSingleton{
    private static ... someobject;

    //getters and setters

}

So it's easier to wrap thread safe code around it.

A: You can subclass your own Application class and make your object a field of that class. Your Application subclass exists as long as your program is running so your object will be there all the time.


text:
Q: CSS progress bar animation I am having a progess bar which should become filled up by 50% width.
This is my current html and css for the progress bar.
HTML:

CSS:
#ProgressBar {
  width: 100%;
  height: 30px;
  border: 1px solid black;
  border-radius: 7px;
  padding: 4px;
}

#Progress {
  width: 10%;
  background-color: #4A90E2;
  height: 100%;
  border-top-left-radius: 7px;
  border-bottom-left-radius: 7px;
  border-color: #4A90E2;
  -webkit-transition: width 2s; /* For Safari 3.1 to 6.0 */
  transition: width 2s;
}

#Progress:hover {
  width: 50%;
}

As you can see the transition is starting after a hover over the progress. My goal is to have this transaition starting directly after the page loads. I know there are some examples in the internet but they are all having fade-in effects only and I can't figure it out.
I appreciate your help.
Here my fiddle:
https://jsfiddle.net/Anokrize/ssL9fjy9/
(I would like to avoid any javascript or jquery, if that is possible)

A: How about doing it with keyframes, like this:

#ProgressBar {
  width: 100%;
  height: 30px;
  border: 1px solid black;
  border-radius: 7px;
  padding: 4px;
}

#Progress {
  width: 50%;
  background-color: #4A90E2;
  height: 100%;
  border-top-left-radius: 7px;
  border-bottom-left-radius: 7px;
  border-color: #4A90E2;

  animation-name: progressBar;
  animation-iteration-count: 1;
  animation-duration: 2s;
}

@keyframes progressBar {
  0% {
    width: 10%;
  }

  100% {
    width: 50%;
  }
}

A: A straight forward way of getting this done is through jquery:
$(window).load(function() {
    $("#Progress").css("width", "50%");
});

A: Usually you'd want something feeding a progress bar so it's actually showing progress... but if you just want it to start on load, you can use the animation property with keyframes.
#ProgressBar {
  width: 100%;
  height: 30px;
  border: 1px solid black;
  border-radius: 7px;
  padding: 4px;
}

#Progress {
  width: 10%;
  background-color: #4A90E2;
  height: 100%;
  border-top-left-radius: 7px;
  border-bottom-left-radius: 7px;
  border-color: #4A90E2;
  animation: progress 1s ease-out forwards;
}

@keyframes progress {
  from { width: 10%; }
  to { width: 50%; }
}


text:
Q: SIG_ABRT on UITableViewCell delete I'm trying to use the Apple provided "Edit" -> (-) -> "Delete" functionality to remove a row from my UITableView.
I have the button activated here:
- (void)viewDidLoad {
    [super viewDidLoad];

    self.navigationItem.rightBarButtonItem = self.editButtonItem;
}

The UITableViewCell created here:
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {

    static NSString *CellIdentifier = @"Cell";

    PositionCell *cell = (PositionCell *)[tableView dequeueReusableCellWithIdentifier:CellIdentifier];
    if (cell == nil) {
        cell = [[[PositionCell alloc] initWithFrame:CGRectZero reuseIdentifier:CellIdentifier] autorelease];
    }

    FSExAppDelegate *appDelegate = (FSExAppDelegate *)[[UIApplication sharedApplication] delegate];
    Position *pos = [appDelegate.positions objectAtIndex:indexPath.row];

    [cell setPosition:pos];

    // Configure the cell.

    return cell;
}

And then just the Apple provided code:
// Override to support editing the table view.
- (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath {

    if (editingStyle == UITableViewCellEditingStyleDelete) {
        // Delete the row from the data source.
        [tableView deleteRowsAtIndexPaths:[NSArray arrayWithObject:indexPath] withRowAnimation:UITableViewRowAnimationFade];
    }
    else if (editingStyle == UITableViewCellEditingStyleInsert) {
        // Create a new instance of the appropriate class, insert it into the array, and add a new row to the table view.
    }
}

When I perform the delete action, I get stuck at:
    [tableView deleteRowsAtIndexPaths:[NSArray arrayWithObject:indexPath] withRowAnimation:UITableViewRowAnimationFade];

with "Thread 1: Program recieved signal 'SIGABRT'".
I've been trawling the questions here but can't seem to find anything for this issue. Can anyone help?
DJS.

A: I think you're leaving out:
[mutableArrayAsDataSource removeObjectAtIndex:[indexPath row]];

That should probably happen before the deleteRowsAtIndexPaths call.

A: [tableView deleteRowsAtIndexPaths:[NSArray arrayWithObject:indexPath] withRowAnimation:UITableViewRowAnimationFade];

please change this to below
[tableView deleteRowsAtIndexPaths:[urArray arrayWithObject:indexPath] withRowAnimation:UITableViewRowAnimationFade];


text:
Q: [NSURL initFileURLWithPath:]: nil string parameter when trying to load a view When my view is trying to load, the applications crashes and i get this stack:
*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -[NSURL initFileURLWithPath:]: nil string parameter'

This is my code, i don't really know where to look when this crash is occurred:
#import "Itineraire.h"
#import "SBMapView.h"
#import "SBRouteAnnotation.h"
#import "City.h"
#import "UICGRoutes.h"
#import "SBCheckPointViewController.h"
//#import "SBRouteDetailView.h"

@interface Itineraire(Private)
-(void)customInitialization;
@end

@implementation Itineraire(Private)

-(void)customInitialization
{
    // do the initialization of class variables here..

    mDirections          = [UICGDirections sharedDirections];
    mDirections.delegate = self;
}

@end

@implementation Itineraire

@synthesize map             = mMap;
@synthesize startPoint      = mStartPoint;
@synthesize endPoint        = mEndPoint;
@synthesize loadBtn     = mLoadBtn;
@synthesize annotationArray = mAnnotationArray;
@synthesize travelMode      = mTravelMode;
@synthesize destination;
@synthesize routes;
@synthesize mAnnotations;
@synthesize mRouteArray;
@synthesize mRouteDetail;

//Invoked when the class is instantiated in XIB
-(id)initWithCoder:(NSCoder*)aDecoder
{
    self = [super initWithCoder:aDecoder];
    if( self)
    {
        [self customInitialization];
    }
    return self;
}

// The designated initializer.  Override if you create the controller programmatically and want to perform customization that is not appropriate for viewDidLoad.
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil {
    if ((self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil])) {
        [self customInitialization];
    }
    return self;
}

// Implement viewDidLoad to do additional setup after loading the view, typically from a nib.
- (void)viewDidLoad {
    [super viewDidLoad];
    self.title = @"Google Maps";
    self.map = [[SBMapView alloc] initWithFrame:CGRectMake(0, 49, self.view.frame.size.width, self.view.frame.size.height)];
    //self.map = [[SBMapView alloc] initWithFrame:CGRectMake(0, 0, self.view.frame.size.width, 381)];

    [self.view addSubview:mMap];

    self.view.backgroundColor = [UIColor blackColor];
    self.annotationArray = [[NSMutableArray alloc]init];
    self.routes          = [[UICGRoutes alloc]init];

    if (mDirections.isInitialized) {
        [self updateRoute];
    }
}
/*
 // Override to allow orientations other than the default portrait orientation.
 - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
 // Return YES for supported orientations
 return (interfaceOrientation == UIInterfaceOrientationPortrait);
 }
 */

- (void)didReceiveMemoryWarning {
    // Releases the view if it doesn't have a superview.
    [super didReceiveMemoryWarning];

    // Release any cached data, images, etc that aren't in use.
}

- (void)viewDidUnload {
    [super viewDidUnload];

}
- (void)viewDidAppear:(BOOL)animated
{
    [super viewDidAppear:YES];

}
- (void)viewWillDisappear:(BOOL)animated;
{
    [super viewWillDisappear:YES];

}

#pragma mark -
#pragma mark Instance Methods

- (void)updateRoute
{   /*
     [[UIApplication sharedApplication] setNetworkActivityIndicatorVisible:YES];
     UICGDirectionsOptions *options = [[[UICGDirectionsOptions alloc] init] autorelease];
     options.travelMode = mTravelMode;
     City *mFirstCity = [[[City alloc]init] autorelease];
     mFirstCity.mCityName = @"Paris";//mStartPoint;
     //[mDirections loadWithStartPoint:mFirstCity.mCityName endPoint:destination options:options];
     //added
     NSMutableArray * DestinationCityArray = [[NSMutableArray alloc]init];
     [DestinationCityArray addObject:@"Berlin"];
     [mDirections loadWithStartPoint:mFirstCity.mCityName endPoint:destination options:options];
     */
    //
    [[UIApplication sharedApplication] setNetworkActivityIndicatorVisible:YES];
    UICGDirectionsOptions *options = [[UICGDirectionsOptions alloc] init] ;
    options.travelMode = mTravelMode;
    City *mFirstCity = [[City alloc]init];
    mFirstCity.mCityName = @"Amsterdam";//mStartPoint;
    NSMutableArray *dest=[[NSMutableArray alloc]init];
    [dest addObject:@"Berlin"];
    [mDirections loadWithStartPoint:mFirstCity.mCityName endPoint:dest options:options];

}

-(void)loadRouteAnnotations
{
    self.mRouteArray = [mDirections routeArray];
    NSLog(@"mRouteArray %@",mRouteArray);
    self.mAnnotations = [[NSMutableArray alloc]init];
    for (int idx = 0; idx < [mRouteArray count]; idx++) {
        NSArray *_routeWayPoints1 = [[mRouteArray objectAtIndex:idx] wayPoints];
        NSArray *mPlacetitles = [[mRouteArray objectAtIndex:idx] mPlaceTitle];
        self.annotationArray = [NSMutableArray arrayWithCapacity:[_routeWayPoints1 count]-2];

        mLoadBtn.title = @"OFF";
        mLoadBtn.target = self;
        mLoadBtn.action = @selector(removeRouteAnnotations);

        for(int idx = 0; idx < [_routeWayPoints1 count]-1; idx++)
        {

            mBetweenAnnotation = [[SBRouteAnnotation alloc] initWithCoordinate:[[_routeWayPoints1 objectAtIndex:idx]coordinate]
                                                                          title:[mPlacetitles objectAtIndex:idx]
                                                                 annotationType:SBRouteAnnotationTypeWayPoint];
            [self.annotationArray addObject:mBetweenAnnotation];
        }
        [mAnnotations addObject:mAnnotationArray];
        [self.map.mapView addAnnotations:[mAnnotations objectAtIndex:idx]];
        NSLog(@"map %@",mMap);

    }
}

-(void)showCheckpoints
{
    SBCheckPointViewController *_Controller = [[SBCheckPointViewController alloc]initWithNibName:@"SBCheckPoints" bundle:nil];
    [self.navigationController pushViewController:_Controller animated:YES];
    NSMutableArray *arr = [[mDirections checkPoint] mPlaceTitle];
    _Controller.mCheckPoints = arr ;

}

//
-(void)removeRouteAnnotations
{
    NSMutableArray *mTempAnnotation;// = [mAnnotations retain];
    for (int idx = 0; idx < [mTempAnnotation count]; idx++) {
        [mMap.mapView removeAnnotations:[mTempAnnotation objectAtIndex:idx] ];
    }
    mLoadBtn.title = @"ON";
    mLoadBtn.target = self;
    mLoadBtn.action = @selector(loadRouteAnnotations);
}

#pragma mark <UICGDirectionsDelegate> Methods

- (void)directionsDidFinishInitialize:(UICGDirections *)directions {
    [self updateRoute];
}

- (void)directions:(UICGDirections *)directions didFailInitializeWithError:(NSError *)error {
    [[UIApplication sharedApplication] setNetworkActivityIndicatorVisible:NO];

    UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:@"Map Directions" message:[error localizedFailureReason] delegate:nil cancelButtonTitle:nil otherButtonTitles:@"OK", nil];
    [alertView show];
}

- (void)directionsDidUpdateDirections:(UICGDirections *)indirections {
    [[UIApplication sharedApplication] setNetworkActivityIndicatorVisible:NO];

    UICGPolyline *polyline = [indirections polyline];
    NSArray *routePoints = [polyline routePoints];

    [mMap loadRoutes:routePoints]; // Loads route by getting the array of all coordinates in the route.

    UIToolbar *tools = [[UIToolbar alloc]
                        initWithFrame:CGRectMake(0.0f, 0.0f, 103.0f, 44.01f)]; // 44.01 shifts it up 1px for some reason
    tools.clearsContextBeforeDrawing = NO;
    tools.clipsToBounds = NO;
    tools.tintColor = [UIColor colorWithWhite:0.305f alpha:0.0f]; // closest I could get by eye to black, translucent style.
    // anyone know how to get it perfect?
    tools.barStyle = -1; // clear background
    NSMutableArray *buttons = [[NSMutableArray alloc] initWithCapacity:2];

    // Create a standard Load button.

    self.loadBtn = [[UIBarButtonItem alloc]initWithTitle:@"ON"
                                                   style:UIBarButtonItemStyleBordered
                                                  target:self
                                                  action:@selector(loadRouteAnnotations)];

    [buttons addObject:mLoadBtn];

    // Add Go button.
    UIBarButtonItem *mGoBtn = [[UIBarButtonItem alloc] initWithTitle:@"Go"
                                                               style:UIBarButtonItemStyleBordered
                                                              target:self
                                                              action:@selector(showCheckpoints)];
    [buttons addObject:mGoBtn];

    // Add buttons to toolbar and toolbar to nav bar.
    [tools setItems:buttons animated:NO];
    UIBarButtonItem *twoButtons = [[UIBarButtonItem alloc] initWithCustomView:tools];
    self.navigationItem.rightBarButtonItem = twoButtons;

    //Add annotations of different colors based on initial and final places.
    SBRouteAnnotation *startAnnotation = [[SBRouteAnnotation alloc] initWithCoordinate:[[routePoints objectAtIndex:0] coordinate]
                                                                                title:mStartPoint
                                                                         annotationType:SBRouteAnnotationTypeStart];
    SBRouteAnnotation *endAnnotation = [[SBRouteAnnotation alloc] initWithCoordinate:[[routePoints lastObject] coordinate]
                                                                                title:mEndPoint
                                                                       annotationType:SBRouteAnnotationTypeEnd];

    [mMap.mapView addAnnotations:[NSArray arrayWithObjects:startAnnotation, endAnnotation,nil]];
}

- (void)directions:(UICGDirections *)directions didFailWithMessage:(NSString *)message {
    [[UIApplication sharedApplication] setNetworkActivityIndicatorVisible:NO];
    UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:@"Map Directions" message:message delegate:nil cancelButtonTitle:nil otherButtonTitles:@"OK", nil];
    [alertView show];
}

#pragma mark -

@end

I tried to put my code on a new project (empty application) and it worked fine, i didn't understand that error and its possible causes.
EDIT:
I tried to track the problem by elimination,and my code worked fine when i remove this method:
//Invoked when the class is instantiated in XIB

-(id)initWithCoder:(NSCoder*)aDecoder
{
    self = [super initWithCoder:aDecoder];
    if( self)
    {
        [self customInitialization];
    }
    return self;
}

However, when i run, my app doesn't display me the route between the two points (The purpose of the app). So this method seems important for the whole class because without it, i couldn't get the route and in the other side when it's there, the app crashes. How should i deal with this contradiction?

A: @Vince is putting you on the right track. Since the problem is in an NSURL method being called by a framework (Google Maps in this case) you need to debug what you are passing to the framework. You have the source for the framework also right? You can set breakpoints in loadWithStartPoint:endPoint:options:] to see what's going on.
One thing I did notice is you are passing an NSMutableArray as the endPoint param when I believe it expects an NSString.


text:
Q: Why I can't find cookies from websites accessed via IP address on Firefox cookies.sqlite? Regarding this question, I was setting some cookies on a PythonFlask app which is accessed directly via http://127.0.0.1:8000, and I realized that it seems that, after accessing the address above, no such information regarding the SITE was stored in cookies.sqlite.
For example:
OK
$ sqlite3 cookies.sqlite "select * from moz_cookies where baseDomain glob '*stackoverflow*'"

357167|stackoverflow.com||cc|0d41064c61774c12b5d369694f729429|stackoverflow.com|/|1784567753|1469906956225907|1469034954014292|0|0|0|0
366821|stackoverflow.com||_gat|1|.stackoverflow.com|/|1469907557|1469906957098821|1469906957098821|0|0|0|0

NOK
 $ sqlite3 cookies.sqlite "select * from moz_cookies where baseDomain glob '*127.0.0.1*'"
 $

I made a dump of this SQlite database (~/.mozilla/firefox/*.default/cookies.sqlite) and I tried to grep the the IP, but no good.
~/.mozilla/firefox/2r7mbtt8.default $ sqlite3 cookies.sqlite .dump > mozilla-30-07-2016.sql
~/.mozilla/firefox/2r7mbtt8.default $ grep --color "127.0.0.1" mozilla-30-07-2016.sql
~/.mozilla/firefox/2r7mbtt8.default $

I was checking directly on Mozilla Firefox (Privacy > remove individual cookies), that the cookie was indeed stored.

With this, I have the following questions regarding Firefox:

*

*Does it make some distinction when it comes to store cookies from websites that are accessed via IP address or IP+port ?

*Does it store cookies from sites accessed via IP addresses in another SQlite database?

A: it works here.
sqlite> select * from moz_cookies where basedomain='127.0.0.1';
56447|127.0.0.1||mythweb_id|popn9pcsh52ut89d1g1a601us6|127.0.0.1|/|1501456297|1469920297288887|1469920297288887|0|0|0|0

perhaps your cookie is a session cookie, not a persistent cookie. session cookies are not saved.


text:
Q: How can I write into Geode using the Redis adapter and then read / react to events using the Geode client? I'm trying to do the following:

*

*Put some data into geode using the redis connector

*React to some key create / update events using a CacheListener

*Read that data using the Geode client and it's entrySet method on the Region.

I already had trouble accessing the redis data from my Geode client. I had to do the following:
region.get(Coder.stringToByteArrayWrapper("key"));

I also had alot of trouble making region.entrySet() work. First, it doesn't work at all with ClientRegionShortcut.PROXY and it seems that it works only 50% of the time with ClientRegionShortcut.CACHING_PROXY.
Here's the code i'm using to test this (note that i'm using lettuce as a redis client):
@Test
public void test_subscribe() throws InterruptedException, ExecutionException {
    ClientCache cache = new ClientCacheFactory()
        .addPoolLocator(HOST, LOCATOR_PORT)
        .create();

    @SuppressWarnings({ "rawtypes", "unchecked" })
    CacheListener<ByteArrayWrapper, ByteArrayWrapper> cl = new CacheListenerAdapter() {
        @Override
        public void afterCreate(EntryEvent event) {
            System.out.println("Created: " + event.getKey() + " = " + event.getNewValue());
        }

        @Override
        public void afterUpdate(EntryEvent event) {
            System.out.println("Updated: " + event.getKey() + " replacing " + event.getOldValue() + "with" + event.getNewValue());
        }
    };

    Region<ByteArrayWrapper, ByteArrayWrapper> region = cache
        .<ByteArrayWrapper, ByteArrayWrapper> createClientRegionFactory(ClientRegionShortcut.CACHING_PROXY)
        .addCacheListener(cl)
        .setKeyConstraint(ByteArrayWrapper.class)
        .setValueConstraint(ByteArrayWrapper.class)
        .create(GeodeRedisServer.STRING_REGION);

    RedisClient client = RedisClient.create("redis://" + HOST);
    StatefulRedisConnection<String, String> connection = client.connect();
    RedisAsyncCommands<String, String> cmd = connection.async();

    cmd.set("1", "HelloGeodeRedis").get();
    cmd.set("2", "WorldGeodeRedis" + System.currentTimeMillis()).get();

    System.out.println("FromRedis: " + cmd.get("2").get());
    System.out.println("FromGeode: " + region.get(Coder.stringToByteArrayWrapper("2")));

    for (Map.Entry<?, ?> entry : region.entrySet()) {
        System.out.format("key = %s, value = %s\n", entry.getKey(), entry.getValue());
    }

    cache.close();
}

I'm wondering if the 50% thingy has to do with the servers i'm running:
gfsh>describe region --name=ReDiS_StRiNgS
..........................................................
Name            : ReDiS_StRiNgS
Data Policy     : persistent partition
Hosting Members : my-redis

Non-Default Attributes Shared By Hosting Members

 Type  |    Name     | Value
------ | ----------- | --------------------
Region | size        | 2
       | data-policy | PERSISTENT_PARTITION

gfsh>describe region --name my-region
..........................................................
Name            : my-region
Data Policy     : persistent replicate
Hosting Members : my-server
                  my-redis

Non-Default Attributes Shared By Hosting Members

 Type  |    Name     | Value
------ | ----------- | --------------------
Region | data-policy | PERSISTENT_REPLICATE
       | size        | 2
       | scope       | distributed-ack

gfsh>list members
      Name       | Id
---------------- | -----------------------------------------------------------
my-locator | 172.16.202.245(my-locator:21234:locator)<ec><v0>:1024
my-server  | 172.16.202.245(my-server:22154)<v1>:1025
my-redis   | 172.16.202.245(my-redis:24890)<v2>:1026

As you can see the region I created manually is hosted by both servers but the one created by redis is only hosted by the redis server.
The error i'm getting 50% of the time is the following:
org.apache.geode.cache.client.ServerOperationException: remote server on My-Computer(4352:loner):64103:58d54999: While performing a remote get
    at org.apache.geode.cache.client.internal.AbstractOp.processObjResponse(AbstractOp.java:285)
    at org.apache.geode.cache.client.internal.GetOp$GetOpImpl.processResponse(GetOp.java:143)
    at org.apache.geode.cache.client.internal.AbstractOp.attemptReadResponse(AbstractOp.java:171)
    at org.apache.geode.cache.client.internal.AbstractOp.attempt(AbstractOp.java:382)
    at org.apache.geode.cache.client.internal.ConnectionImpl.execute(ConnectionImpl.java:275)
    at org.apache.geode.cache.client.internal.pooling.PooledConnection.execute(PooledConnection.java:332)
    at org.apache.geode.cache.client.internal.OpExecutorImpl.executeWithPossibleReAuthentication(OpExecutorImpl.java:900)
    at org.apache.geode.cache.client.internal.OpExecutorImpl.execute(OpExecutorImpl.java:158)
    at org.apache.geode.cache.client.internal.OpExecutorImpl.execute(OpExecutorImpl.java:115)
    at org.apache.geode.cache.client.internal.PoolImpl.execute(PoolImpl.java:763)
    at org.apache.geode.cache.client.internal.GetOp.execute(GetOp.java:91)
    at org.apache.geode.cache.client.internal.ServerRegionProxy.get(ServerRegionProxy.java:116)
    at org.apache.geode.internal.cache.LocalRegion.findObjectInSystem(LocalRegion.java:2776)
    at org.apache.geode.internal.cache.LocalRegion.nonTxnFindObject(LocalRegion.java:1488)
    at org.apache.geode.internal.cache.LocalRegionDataView.findObject(LocalRegionDataView.java:175)
    at org.apache.geode.internal.cache.LocalRegion.get(LocalRegion.java:1377)
    at org.apache.geode.internal.cache.LocalRegion.get(LocalRegion.java:1310)
    at org.apache.geode.internal.cache.LocalRegion.get(LocalRegion.java:1295)
    at org.apache.geode.internal.cache.AbstractRegion.get(AbstractRegion.java:320)
    at trial.GeodeTest.test_subscribe(GeodeTest.java:112)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
    at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
    at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
    at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
    at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)
    at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78)
    at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57)
    at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
    at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
    at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
    at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
    at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
    at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
    at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:86)
    at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:459)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:678)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:382)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:192)
Caused by: org.apache.geode.cache.RegionDestroyedException: Server connection from [identity(192.168.64.106(4352:loner):64103:58d54999,connection=1; port=64103]: Region named /ReDiS_StRiNgS/ReDiS_StRiNgS was not found during get request
    at org.apache.geode.internal.cache.tier.sockets.BaseCommand.writeRegionDestroyedEx(BaseCommand.java:615)
    at org.apache.geode.internal.cache.tier.sockets.command.Get70.cmdExecute(Get70.java:126)
    at org.apache.geode.internal.cache.tier.sockets.BaseCommand.execute(BaseCommand.java:165)
    at org.apache.geode.internal.cache.tier.sockets.ServerConnection.doNormalMsg(ServerConnection.java:780)
    at org.apache.geode.internal.cache.tier.sockets.ServerConnection.doOneMessage(ServerConnection.java:911)
    at org.apache.geode.internal.cache.tier.sockets.ServerConnection.run(ServerConnection.java:1166)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    at org.apache.geode.internal.cache.tier.sockets.AcceptorImpl$1$1.run(AcceptorImpl.java:523)
    at java.lang.Thread.run(Thread.java:745)

So you have the full disclaimer, the reason i'm testing this is that I want to put data from a kafka topic into geode using kafka-connect-redis to avoid having to code a geode kafka connector myself.
EDIT: The 50% issue has been fixed thanks to @Swapnil but now i'm back to having trouble making entrySet and event notification work. It seems that unless I forcefully get the key I put using the redis client, I'm not getting any EntryEvent notification.

A: The problem I had with not receiving the events was because I didn't register an interest to the keys I was interested in.
Adding region.registerInterestRegex(".*"); allows to mark an interest to every key. It requires to set up the ClientCache with .setPoolSubscriptionEnabled(true).
    ClientCache cache = new ClientCacheFactory()
        .addPoolLocator(HOST, LOCATOR_PORT)
        .setPoolSubscriptionEnabled(true)
        .create();

    // ...

    Region<ByteArrayWrapper, ByteArrayWrapper> region = cache
        .<ByteArrayWrapper, ByteArrayWrapper> createClientRegionFactory(ClientRegionShortcut.CACHING_PROXY)
        .addCacheListener(cl)
        .setKeyConstraint(ByteArrayWrapper.class)
        .setValueConstraint(ByteArrayWrapper.class)
        .create(GeodeRedisServer.STRING_REGION);

    region.registerInterestRegex(".*");

    // ...

A: I suspect it is way you start your Geode servers. I had no problems when I setup my Geode cluster like so:
gfsh>start locator --name=loc1
gfsh>start server --name=serv1 --redis-port=1111 --redis-bind-address=localhost
gfsh>start server --name=serv2 --server-port=40405 --redis-port=2222 --redis-bind-address=localhost

describe regions shows me that RedisStrings was created on both servers:

gfsh>describe region --name=/ReDiS_StRiNgS
..........................................................
Name            : ReDiS_StRiNgS
Data Policy     : partition
Hosting Members : serv2
                  serv1

Non-Default Attributes Shared By Hosting Members

 Type  |    Name     | Value
------ | ----------- | ---------
Region | size        | 0
       | data-policy | PARTITION

Then From my test program, I inserted data using through Redis (Jedis client) and then read back the data successfully from Geode:
public void putRedis() {
  Jedis jedis = new Jedis("localhost", 1111);
  for (int i=0; i<10; i++) {
    jedis.set("foo"+i, "bar"+i);
  }
}

public void readGeode() {
  ClientCacheFactory clientCacheFactory = new ClientCacheFactory();
  clientCacheFactory.addPoolLocator("localhost", 10334);
  ClientCache client = clientCacheFactory.create();
  Region redisStrings = client.createClientRegionFactory(ClientRegionShortcut.PROXY).create("ReDiS_StRiNgS");
  for (int i=0; i<10; i++) {
    System.out.println(redisStrings.get(Coder.stringToByteArrayWrapper("foo"+i)));
  }
}


text:
Q: Asterisk issue with IVR and '1' extension number I have FreePBX 15 installation. I have successfully added multiple extensions.
Numbers include some three digit numbers and '1' extension which is a normal ip-phone like others with exactly the same configuration.
I can call them with no issue. I have also set up an IVR which has no entries, it just allows to direct dial all extensions.
It works for all of them except for '1'.
Example for '213':
app_read.c: User entered '213'
VERBOSE[6729][C-00000003] pbx.c: Executing [s@ivr-1:10] GotoIf("PJSIP/x-00000002", "0?#,1") in new stack
VERBOSE[6729][C-00000003] pbx.c: Executing [s@ivr-1:11] GotoIf("PJSIP/x-00000002", "0?t,1") in new stack
VERBOSE[6729][C-00000003] pbx.c: Executing [s@ivr-1:12] ExecIf("PJSIP/x-00000002", "1?Set(LOCALEXT=1)") in new stack
VERBOSE[6729][C-00000003] pbx.c: Executing [s@ivr-1:13] GotoIf("PJSIP/x-00000002", "0?i,1") in new stack
VERBOSE[6729][C-00000003] pbx.c: Executing [s@ivr-1:14] GotoIf("PJSIP/x-00000002", "1?from-did-direct-ivr,2137,1") in new stack
VERBOSE[6729][C-00000003] pbx_builtins.c: Goto (from-did-direct-ivr,213,1)

And the call is successful. However for '1':
app_read.c: User entered '1'
VERBOSE[10123][C-00000004] pbx.c: Executing [s@ivr-1:10] GotoIf("PJSIP/x-00000003", "0?#,1") in new stack
VERBOSE[10123][C-00000004] pbx.c: Executing [s@ivr-1:11] GotoIf("PJSIP/x-00000003", "0?t,1") in new stack
VERBOSE[10123][C-00000004] pbx.c: Executing [s@ivr-1:12] ExecIf("PJSIP/x-00000003", "1?Set(LOCALEXT=1)") in new stack
VERBOSE[10123][C-00000004] pbx.c: Executing [s@ivr-1:13] GotoIf("PJSIP/x-00000003", "1?i,1") in new stack
VERBOSE[10123][C-00000004] pbx_builtins.c: Goto (ivr-1,i,1)
VERBOSE[10123][C-00000004] pbx.c: Executing [i@ivr-1:1] Set("PJSIP/x-00000003", "INVALID_LOOPCOUNT=1") in new stack

I get error: invalid destination
I have also tried to add IVR entry for '1' to redirect it to '1' extension.
app_read.c: User entered '1'
VERBOSE[6334][C-00000002] pbx.c: Executing [s@ivr-1:10] GotoIf("PJSIP/x-00000001", "0?#,1") in new stack
VERBOSE[6334][C-00000002] pbx.c: Executing [s@ivr-1:11] GotoIf("PJSIP/x-00000001", "0?t,1") in new stack
VERBOSE[6334][C-00000002] pbx.c: Executing [s@ivr-1:12] ExecIf("PJSIP/x-00000001", "1?Set(LOCALEXT=1)") in new stack
VERBOSE[6334][C-00000002] pbx.c: Executing [s@ivr-1:13] GotoIf("PJSIP/x-00000001", "0?i,1") in new stack
VERBOSE[6334][C-00000002] pbx.c: Executing [s@ivr-1:14] GotoIf("PJSIP/x-00000001", "1?from-did-direct-ivr,1,1") in new stack
VERBOSE[6334][C-00000002] pbx_builtins.c: Goto (from-did-direct-ivr,1,1)
WARNING[6334][C-00000002] pbx.c: Channel 'PJSIP/x-00000001' sent to invalid extension but no invalid handler: context,exten,priority=from-did-direct-ivr,1,1

When I add IVR entry for '2' to redirect to '1' it works:
app_read.c: User entered '2'
VERBOSE[30910][C-00000012] pbx.c: Executing [s@ivr-1:10] GotoIf("PJSIP/x-00000011", "0?#,1") in new stack
VERBOSE[30910][C-00000012] pbx.c: Executing [s@ivr-1:11] GotoIf("PJSIP/x-00000011", "0?t,1") in new stack
VERBOSE[30910][C-00000012] pbx.c: Executing [s@ivr-1:12] ExecIf("PJSIP/x-00000011", "0?Set(LOCALEXT=1)") in new stack
VERBOSE[30910][C-00000012] pbx.c: Executing [s@ivr-1:13] GotoIf("PJSIP/x-00000011", "0?i,1") in new stack
VERBOSE[30910][C-00000012] pbx.c: Executing [s@ivr-1:14] GotoIf("PJSIP/x-00000011", "0?from-did-direct-ivr,2,1") in new stack
VERBOSE[30910][C-00000012] pbx.c: Executing [s@ivr-1:15] Goto("PJSIP/x-00000011", "2,1") in new stack
VERBOSE[30910][C-00000012] pbx_builtins.c: Goto (ivr-1,2,1)
VERBOSE[30910][C-00000012] pbx.c: Executing [2@ivr-1:1] Set("PJSIP/x-00000011", "__ivrreturn=0") in new stack
VERBOSE[30910][C-00000012] pbx.c: Executing [2@ivr-1:2] Goto("PJSIP/x-00000011", "from-did-direct,1,1") in new stack
VERBOSE[30910][C-00000012] pbx_builtins.c: Goto (from-did-direct,1,1)

A: As you can see you have no 1 extension
 invalid extension but no invalid handler: context,exten,priority=from-did-direct-ivr,1,1

Why you have no - it is enother question. I can suggest you find from-did-direct-ivr context and see if it is there.
All files are in /etc/asterisk/ folder
Side note: from-did-direct-ivr and from-did-direct are DIFFERENT contexts.


text:
Q: Javascript: use xpath in jQuery I have, for example, the next XPath query:
//div[span="something"]/parent::div/child::div[@class=\"someClass\"]

I want to use this XPath query in JavaScript:
return $("a:contains('Fruits')").mouseover();

I tried this:
return $("div[span=\"something\"]/parent::div/child::div[@class=\"someClass\"]").mouseover();

But it didn't work. Is there another semantic for XPath queries in order to use them in JavaScript?

A: As the co-author of Wicked Good XPath, I certainly recommend it for cross browser XPath support (on HTML documents, you can try using it with XML documents but the support is incomplete).
We welcome any sort of correctness test / performance benchmark on our library. During development, the library has been tested on IE 7 through 10 plus the Android 2.2 browser which doesn't have native XPath support.

A: You could add the results of an existing XPath evaluation to a jQuery selection, I threw together this jquery extension that seems does it all for you.
Example usage:
$(document).xpathEvaluate('//body/div').remove()

Here's the add-in.
$.fn.xpathEvaluate = function (xpathExpression) {
   // NOTE: vars not declared local for debug purposes
   $this = this.first(); // Don't make me deal with multiples before coffee

   // Evaluate xpath and retrieve matching nodes
   xpathResult = this[0].evaluate(xpathExpression, this[0], null, XPathResult.ORDERED_NODE_ITERATOR_TYPE, null);

   result = [];
   while (elem = xpathResult.iterateNext()) {
      result.push(elem);
   }

   $result = jQuery([]).pushStack( result );
   return $result;
}

A: There is no Cross-browser implementation as far as I know. There is a xpath plugin for jQuery which says is still in developement.
Other than that there is a  Google-authored pure JavaScript implementation of the DOM Level 3 XPath specification called wicked-good-xpath which is good.

A: if you want to select an element inside an iframe, from parent window, you should change second parameter of evaulate() function to iframe's document element, like :
var iFrameDocument = $('iframe#myPage').get(0).contentWindow.document;
xpathResult = this[0].evaluate(xpathExpression, iFrameDocument, null, XPathResult.ORDERED_NODE_ITERATOR_TYPE, null);

A: You can re-write your xpath queries as CSS selectors:
$('div:has(> div > span:contains(something)) > div.someClass');

You can achieve the same effect as parent:: using the :has pseduo selector to select an element based on its children: div.foo:has(> div.bar) will select all div elements with class foo that have a child div with class bar. This is equivalent to div[@class="bar"]/parent::div[@class="foo"].
See:

*

*jQuery API: Selectors

*Sizzle documentation
You could probably approach this in several other ways using various combinations jQuery's DOM traversal methods. For example, this would be a very direct translation of your xpath query:
$('div:has(> span:contains(something))')  // //div[span="something"]
    .parent('div')                        // /parent::div
    .children('div.someClass');           // /child::div[@class="someClass"]

It's worth noting that div.someClass in CSS isn't the exact equivalent of div[@class="someClass"] in xpath. The CSS will match <div class='foo someClass bar'>, but the xpath won't. See Brian Suda's article on parsing microformats with XSLT for more detail.

A: I'm not sure about the parent::div clause, but without it it should look like this:
$('div[span="something"] div.someClass');

A: read from here about the evaluate method :
https://developer.mozilla.org/en-US/docs/Introduction_to_using_XPath_in_JavaScript
var xpathResult = document.evaluate( xpathExpression, contextNode, namespaceResolver, resultType, result );

A: jQuery only has limited support for XPath. You can see what it does support here:
http://docs.jquery.com/DOM/Traversing/Selectors#XPath_Selectors
As mentioned by @Ameoo you can use the evaluate method, which is available in most modern browsers - except, predictably, IE:
jquery select element by xpath


text:
Q: Getting started with PopoverView and Display Item on Label in ipad I am making a sample application where I am  using UIPopoverView to display the list of items.
I am following this link for my sample application.
In the above link tutorial, a "movies list" appears. When the button is clicked, a pop over appears,but when I select the movie name it is not getting displayed on label.
can anyone tell what is happening or anything should be added in the code. I am not able to display the selected items on the label.

A: Check the connections of buttons and the respective actions. Debug the code placing the break point. I think u have missed something from the tutorial.

A: print the string whatever you are selecting .And print the label text also.Check whether you are getting the strings correctly or not.So that you came to know where the mistake is.


text:
Q: Optaplanner: Randomly very low "average calcultate count per second" when solving in parallel I am using Optaplanner to solve a comparatively small optimization problem. For my use case, many such optimizations are required though which is why I started to run them in parallel. The parallelity is based upon Java 8' parallel stream. It doesn't allow to control the actual number of threads to be used, but I believe it to be based on the available CPU count.
For most of the solver runs this seems to work fine, but I noticed that I sometimes got invalid solutions from a single run which were not reproducible when only that problem was run alone.
After inspecting the logs, I noticed that the "average calculate count per second" was very low for invalid solution while being fine for other runs. In fact, the invalid solution was actually the (naively built) initial solution:
[rkJoinPool.commonPool-worker-6] (DefaultSolver.java:203)       Solving started: time spent (0), best score (-5hard/-2medium/168soft), environment mode (REPRODUCIBLE), random (JDK with seed 0).
[rkJoinPool.commonPool-worker-6] (DefaultConstructionHeuristicPhase.java:158) Construction Heuristic phase (0) ended: step total (0), time spent (1), best score (-5hard/-2medium/233soft).
[rkJoinPool.commonPool-worker-4] (DefaultSolver.java:203)       Solving started: time spent (1), best score (-5hard/-1medium/579soft), environment mode (REPRODUCIBLE), random (JDK with seed 0).
[rkJoinPool.commonPool-worker-4] (DefaultConstructionHeuristicPhase.java:158) Construction Heuristic phase (0) ended: step total (0), time spent (1), best score (-5hard/-1medium/617soft).
[rkJoinPool.commonPool-worker-5] (DefaultSolver.java:203)       Solving started: time spent (1), best score (-6hard/-3medium/137soft), environment mode (REPRODUCIBLE), random (JDK with seed 0).
[rkJoinPool.commonPool-worker-7] (DefaultLocalSearchPhase.java:152) Local Search phase (1) ended: step total (42), time spent (704), best score (0hard/0medium/808soft).
[rkJoinPool.commonPool-worker-4] (DefaultLocalSearchPhase.java:152) Local Search phase (1) ended: step total (22), time spent (218), best score (0hard/0medium/1033soft).
[rkJoinPool.commonPool-worker-5] (DefaultSolver.java:238)       Solving ended: time spent (210), best score (-6hard/-3medium/137soft), average calculate count per second (4), environment mode (REPRODUCIBLE).
[rkJoinPool.commonPool-worker-7] (DefaultSolver.java:238)       Solving ended: time spent (746), best score (0hard/0medium/808soft), average calculate count per second (25256), environment mode (REPRODUCIBLE).
[rkJoinPool.commonPool-worker-4] (DefaultSolver.java:238)       Solving ended: time spent (219), best score (0hard/0medium/1033soft), average calculate count per second (30461), environment mode (REPRODUCIBLE).

Notice how Threads 4 and 7 produce good results with 25-30k accs, while Thread 5 produced an invalid result and only used 4 accs (given the 200ms termination timeout I assume that really only one step was taken).
The following configuration was used which was determined using the benchmarker (albeit in a single-thread setup):
<termination>
    <millisecondsSpentLimit>2000</millisecondsSpentLimit>
    <unimprovedMillisecondsSpentLimit>200</unimprovedMillisecondsSpentLimit>
</termination>
<constructionHeuristic>
    <constructionHeuristicType>FIRST_FIT</constructionHeuristicType>
</constructionHeuristic>
<localSearch>
    <localSearchType>HILL_CLIMBING</localSearchType>
</localSearch>

I assume that this problem has to do with the fact that several solvers are running in parallel while a time based termination criteria is used. Is the termination time based on "wall time" or on actual CPU time?
Is using a time based termination criteria not such a good idea when running in parallel? This seems to be the best way though to use all available computing power.
What could cause as single solver to seemingly at random only perform so few steps?

A: millisecondsSpentLimit and unimprovedMillisecondsSpentLimit are based on wall time, not on actual CPU time.
AFAIK, parallel streams does not limit the number of threads to the number of CPU's, as those jobs might block under IO (which is not the case for Solver.solve() calls). I prefer to use an ExecutorService with a thread pool size of Math.max(1, Runtime.getRuntime().availableProcessors() - 2).


text:
Q: Avoid "could not find parserDetail.ini" warning When using XML::Simple, I always get the warning
could not find ParserDetails.ini in /usr/lib/perl5/vendor_perl/5.8.8/XML/SAX

I would like do do something like
{
no warning qw(insert_your_magic_here);
my $hash_ref = XMLin('my_file.xml')
}

I red perldoc about warning http://perldoc.perl.org/warnings.html and found a 'Cathegory hiearchy' but I do not know in which category is this warning.
Do you know it?
May you know what are those ParserDetail intented for?

A: Despite its name, XML::Simple is extremely difficult to get working correctly, and you would be much better off using XML::Twig or XML::LibXML instead.
XML::Simple is warning you that there is no useable SAX parser configuration. Since XML::Parser is faster and more reliable than the SAX options, I suggest you tell XML::Simple to use it instead. You can do this by adding
$XML::Simple::PREFERRED_PARSER = 'XML::Parser';

to the top of your program, right after use XML::Simple.
You may also have to install XML::Parser, as it isn't one of the pre-installed core modules.


text:
Q: JavaScript - How to display error handler message if certain radio button is checked? I want to use JS to display an error message as a placeholder in the Notes <textarea> if the Broken radio button is selected and the <textarea> is empty.
I can successfully select my radio buttons via classname and use a for loop to iterate through them. I'm trying to check the associated <textarea> value in the for loop. However, whenever I check the value of the <textarea> it always comes back as undefined.
Even when I add document.querySelector("textarea").value or ...notes.value[i] == "" in the if statement, the text area value still comes back as undefined. What am I doing wrong?
I currently only have the noteError() function added to the first broken radio button.

function noteError(){
  const broken = document.getElementsByClassName('broken');
  var notes = document.querySelector("textarea");

  for(var i = 0; i < broken.length; i++){
    console.log(notes[i]);
    if(broken[i].checked && notes[i] == ""){
      console.log("notes is empty and broken is checked.")
    }
  }
}

Basic Processes

    Process
    Status
    Notes

    Document Retrieval

      <input type="radio" class="working" name="retrieval" value="working">
      Working&nbsp&nbsp
      <input type="radio" class="broken" name="retrieval" value="broken" onclick="noteError()">
      Broken

    <textarea></textarea>

    Viewing Documents

      <input type="radio" class="working" name="view_docs" value="working">
      Working&nbsp&nbsp
      <input type="radio" class="broken" name="view_docs" value="broken">
      Broken

    <textarea></textarea>

    View Keywords

      <input type="radio" class="working" name="keywords" value="working">
      Working&nbsp&nbsp
      <input type="radio" class="broken" name="keywords" value="broken">
      Broken

    <textarea></textarea>

    Print Documents

      <input type="radio" class="working" name="print" value="working">
      Working&nbsp&nbsp
      <input type="radio" class="broken" name="print" value="broken">
      Broken

    <textarea></textarea>

A: As pointed out, there is an error in your second selector that does not return a list (resulting in 'undefined' values when you try to access it as if it was an array)
In addition you only put the change listener on the first input, which is not likely to be what you wanted.
My proposal: remove the 'onclick' event on the first broken input and rather loop on all inputs to trigger your callback :)
function noteError() {
  const broken = document.querySelectorAll('.broken');
  const notes = document.querySelectorAll("textarea");

  broken.forEach((brok, index) => {
    const note = notes[index]
    if (brok.checked) {
      note.value = 'error'
    } else {
      note.value = ''
    }
  })
}

const radios = document.querySelectorAll('input[type="radio"]');
radios.forEach(radio => radio.addEventListener('change', noteError))

you can find a working code pen for this one here: https://codepen.io/aSH-uncover/pen/QWrKNJz


text:
Q: Windows Amazon EC2 cURL (60) error I am using a WIMP stack to host a server on an Amazon EC2 instance. Through a Backpack CRUD panel, users can upload an image or video. This image or video is supposed to be uploaded to an Amazon S3 bucket. The following code should handle this upload:
public function imageUploadPost(Request $request)
{
    ... // Validation of request
    $imageName = time().'.'.$request->image->getClientOriginalExtension();
    $image = $request->file('image');
    $t = Storage::disk('s3')->put($imageName, file_get_contents($image), 'public');
    $imageName = Storage::disk('s3')->url($imageName);
    ... // Return
}

When a file is submitted for upload, I encounter the following error:

Error executing "PutObject" on
  "https://'bucketname'.s3.'region'.amazonaws.com/'filename'";
  AWS HTTP error: cURL error 60: SSL certificate problem: unable to get
  local issuer certificate (see
  http://curl.haxx.se/libcurl/c/libcurl-errors.html)

I have downloaded the most recent cacert.pem, and included the path in my php.ini. The issue persists. Is this issue caused by using a WIMP stack instead of a WAMP stack? If so, would it be more efficient to refactor my server under a WAMP stack rather than force the WIMP stack to work?


text:
Q: copying one string to another without using strcpy using while loop So i recently stumbled on this code somewhere where it is copying one string to another using just one line of code with the help of a while loop , however , I am not able to understand as to how and why it happens-:
int main()
{
    char arr1[100];
    cin.getline(arr1 , 100);
    char arr2[100];

    int i = -1;
    while(arr2[i] = arr1[++i]);
    cout<<arr1<<endl<<arr2<<endl;

    return 0;
}

Can somebody explain me what is happening in the backdrop?
and moreover if the above code works fine then why dont the below ones?
int main()
{
    char arr1[100];
    cin.getline(arr1 , 100);
    char arr2[100];

    int i = 0;
    while(arr2[i++] = arr1[i]);
    cout<<arr1<<endl<<arr2<<endl;

    return 0;
}

another one-:
int main()
{
    char arr1[100];
    cin.getline(arr1 , 100);
    char arr2[100];

    int i = 0;
    while(arr2[++i] = arr1[i]);
    cout<<arr1<<endl<<arr2<<endl;

    return 0;
}

A: The code snippet is relying on an order-of-evaluation guarantee that was added in C++17.
Since C++17 it is guaranteed that the right-hand side of a = operator is evaluated first. As a consequence the loop is equivalent to
int i = -1;
while(true) {
    i++;
    arr2[i] = arr1[i];
    if(!arr2[i])
        break;
};

Except that one would normally start at i = 0; and put i++; at the end of the loop iteration, I think it should be clearer what is happening now. The loop breaks when a null character is encountered, so it expects that arr1 is a null-terminated string and won't copy the whole array.
Before C++17 the order of evaluation was not specified and the code had undefined behavior as a consequence.

If you change the loop to int i=0; while(arr2[++i] = arr1[i]);, then (since C++17) you execute ++i only after indexing arr1[i], but before indexing arr2. As a consequence you are not copying to the beginning of arr2. Again, before C++17 this is undefined behavior.
int i=0; while(arr2[i++] = arr1[i]); should work correctly since C++17 as well. It does the increment only after indexing both arrays. Again, before C++17 it has undefined behavior.

You shouldn't use either of these, since they are hard to reason about and have undefined behavior if the user happens to set the C++ version switch to something before C++17 or tries to use it in C, where it is undefined behavior in all versions.
Also int may be too small to hold all indices of a string. Prefer std::size_t (which however is unsigned and so the first variant won't work).

A: Utilities for things like copying strings should be written in functions, not inline every place they're used. That makes it simpler to avoid the complexities of incrementing the same variable twice:
void copy_string(char* dest, const char *src) {
    while (*dest++ = *src++)
        ;
}

 Yes, I know, some people like to have their compiler ignore the rules and refuse to compile valid, well-defined code like this. If your compiler is set that way, figure out how to rewrite that code to make your compiler happy, and perhaps think about who's the boss: you or your compiler.


text:
Q: using Sortable by Kyslik how to set table header names, and how to integrate sortable into queries in laravel? I am using the Sortable by Kyslik in my Laravel program to sort and paginate tables. I have a problem at the moment.
This is my controller, I have 3 queries for 3 different user roles. The sortable function is straight forward and works well for the admin users, but employees and managers display data through a query. how can I integrate the sortable function  with them?
public function index()
    {
        $user = Auth::user();
        $userId = Auth::id();
        $username = DB::table('users')
            ->select('staffName')
            ->where('id', $userId)
            ->pluck('staffName')
            ->first();

        $documents = Document::sortable()->paginate(8);

        $managers = DB::table('documents')
            ->join('users', 'users.id', '=', 'documents.staff_id')
            ->select('documents.staffName','certName','trainingName','uploadCert')
            ->where('documents.staffName', $username)
            ->orWhere('reportingTo', $username)
            ->get();

        $employees = DB::table('documents')
            ->where('staffName', $username)
            ->get();

        return view('admin.leave.list', compact('documents', 'managers', 'employees', 'user'));
        // return $this->autoIndex(Document::class);
    }

The sortable function is working, But how do I use it with the manager or employee queries? Is there a way to integrate the sortable()->paginate(); functions into them?
The blade

Certificate List

                                            @sortablelink('id')
                                            @sortablelink('staffName')
                                            @sortablelink('trainingName')
                                            @sortablelink('certName')
                                            Certificate

                                        @can('isAdmin')
                                        @foreach($documents as $document)

                                            {{$loop -> index+1 }}
                                            {{$document -> staffName}}
                                            {{$document -> trainingName}}
                                            {{$document -> certName}}
                                             uploadCert}}" target="_blank">View Certificate

                                        @endforeach
                                        @endcan

                                        @if($user -> role == 'manager')
                                        @foreach($managers as $manager)

                                            {{$loop -> index+1 }}
                                            {{$manager -> staffName}}
                                            {{$manager -> trainingName}}
                                            {{$manager -> certName}}
                                             uploadCert}}" target="_blank">View Certificate

                                        @endforeach
                                        @endif

                                        @can('isEmployee')
                                        @foreach($employees as $employee)

                                            {{$loop -> index+1 }}
                                            {{$employee -> staffName}}
                                            {{$employee -> trainingName}}
                                            {{$employee -> certName}}
                                             uploadCert}}" target="_blank">View Certificate

                                        @endforeach
                                        @endcan

                                {!! $documents->appends(\Request::except('page'))->render() !!}

How can I fix this problem? And how can I get the icons to stay after being clicked rather than disappearing for the sorting function? Please advise


text:
Q: Android Phonegap 3 webapp whitelist not working I have a phonegap android application which is attempting to get data from an external server:
The server is a .net WebAPI - and uses the communcation is via JSONP. The same code/server works in iOS with phonegap 2.7. For Android I am using phonegap 3.1. I have double checked the URL to make sure it's correct. I have also got the following line in my config.xml file.
<access origin="*" subdomains="true" />

The request details are here:
Request URL:http://XXXXXXXXXXXX.com/server/api/messagetypeopt/1?callback=jQuery17209047717128414661_1386902222072&_=1386902252817
Request Method:GET
Status Code:404 Not Found (from cache)
Request Headersview source
Accept:*/*
User-Agent:Mozilla/5.0 (Linux; Android 4.4; sdk Build/KRT16L) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/30.0.0.0 Mobile Safari/537.36
Query String Parametersview sourceview URL encoded
callback:jQuery17209047717128414661_1386902222072
_:1386902252817

and the javascript request code is
$.support.cors = true;
        $.mobile.allowCrossDomainPages = true;
        $.mobile.loading('show');

        // enableFrontPageButtons(1)
        enableButtons(0);
        console.log('about to get message types');
        try {
        $.ajax({
            //url: 'http://localhost:8956/api/messagetypeopt/' + SENDER_ID ,
            url: SERVER + '/api/messagetypeopt/' + SENDER_ID ,
            type: 'GET',
            dataType: 'jsonp',
            jsonp: 'callback',
            crossDomain: true,
            async:   false,
            success: function (data) {
                //alert('1');
                localStorage.setItem("rawMessageTypes", JSON.stringify(data.branches));
                Sender.updateBranchesData(data);
                Sender.updateSenderData(data);
                //alert('2');
                setupBranches(data.branches);
                setMessageTypesDB(data.branches); // store in local database.
                updateMessageTypes(data.branches);
                WriteMessageList( getMessageDataForBranch(JSON.parse(localStorage.getItem("rawMessageTypes"))));
                //alert('3');
                // save sender data and branch data
                enableButtons(1);
                //$('#libName').val(ConfigData.SENDER_NAME);
                changeTheBranch(CURRENT_BRANCH);
               // alert('4');
                //alert('Update Complete');
                $('messagetypepopuptext').text('Update Complete');
                $('messagetypepopup').popup();

            },
            statusCode: {
                500: function() {
                    alert("An incorrect request went to the server, check your UserID? ");
                    enableButtons(1);
                    $.mobile.changePage('#pageSetup', {changeHash: false});
                } ,
                400: function() {
                    alert("An incorrect request went to the server, check your UserID? ");
                    enableButtons(1);
                    $.mobile.changePage('#pageSetup', {changeHash: false});
                }
            },
            error: function (x, y, z) {
                //alert('There was an error getting data from the server');
                enableButtons(0);
                $.mobile.changePage('#pageSetup', {changeHash: false});
            },
            complete: function (a, b) {
                //alert('complete:' + a + '\n' + b);
               $.mobile.loading('hide');
            }
        });

I'm really stuck on this - so i'd really like some help. thanks :)

A: I am in the same page as you. It works perfectly on iOS7 and even Android 2.3 virtual machine but it does not work on Android 4.0.3 I am using Phonegap 3.1
--- EDIT ---
I have various sites for whitelisting and I put them all in different ways
<access origin="*://site.com" subdomains="true"/>
<access origin="*://site.com/*" subdomains="true"/>
<access origin="*://site.com/something/*" subdomains="true"/>
<access origin="https://site.com/" subdomains="true"/>

Since I am using AngularJS I do not know how to help you in your code, but once I tested using jquery and I did not have your support CORS code. I also added the
<access origin="..." subdomains="true"/>

on the config.xml located on res/xml/config.xml.


text: Q: 'uable to open read only database' while deploying django cms in cPanel server I already deployed a django cms in my cPanel server using (mod_wsgi), But it showing 500 internal server error. 'unable to open a read only database' (default sqllite). Any one know how to resolve it.


text:
Q: How does the activation of neurons work? I would need to understand better how the activation of the neurons in a neural network works.
Let's suppose to work with Tanh (ranging in [-1,1]).
I know that a neuron must be able to choose whether to accept the input from another neuron or not. But how is this process related to the activation function? If the value of Tanh for a certain neuron is close to -1, is that neuron switched off or is it still actively involved in the training? (And if it is actively involved, then why do we talk of "activation"?)
Also, I'm using h2o for deep learning anomaly detection. How do I choose between Tanh and Rectified Linear? I tried both and the outputs differ a lot...

A: In my opinion, understanding these things by analogy might be helpful in the beginning when you're first starting, but eventually you'll get stuck if you don't begin to understand these models on their own terms.
A neural network is a linear model (or a multinomial logit if classification) fitting the response as a function of derived variables:
$$
\begin{array}{l l}
y_{i} = \gamma_1 + \mathbf{V}^1_{i}\Gamma^1 + \epsilon_{i}\\
\mathbf{V}^1_{i} = a\left([\mathbf{1,V}^2_{i}]\mathbf{\Gamma}^2\right)\\
\mathbf{V}^2_{i} = a\left([\mathbf{1,V}^3_{i}]\mathbf{\Gamma}^3\right)\\
\hspace{1.5cm}\vdots\\
\mathbf{V}^L_{i} = a\left([\mathbf{1,Z}_{i}]\mathbf{\Gamma}^L\right)\\
\end{array}
$$
The derived variables are the $V$ terms, and the $\Gamma$ are parameters. (The 1's are for the "bias" terms, which are analogous to intercepts in linear models.) Down on the bottom layer, your data $Z$ are transformed first by the parameters and then by the activation function into the first set of derived variables.  The process continues upwards until you reach the top layer.
So to your question about activation functions -- the activation function ($a()$) simply transforms the linear combination of derived variables.  It maps the real line to a subset of it.  A hyperbolic tangent maps $V\Gamma$ to the interval $[-1, 1]$, and a RELU makes negative values of $V\Gamma$ go to zero.  Which one makes the most sense is probably dataset-dependent.
And if $a(V\Gamma) = -1$, that simply means that one of your regressors at the top level takes a value of -1.  I suppose that it is only "off" if it takes a value of zero.
And to your question of how to choose between different models -- the standard answer is "cross validation"

A: I think you're talking about perceptrons, not neurons. Perceptrons jump between discrete states, such as 0 and 1 when an input crosses the threshold. Neuron can produce continuous output on continuous inputs. So, your neuron with inverse tanh function accepts inputs between -1 and 1 and produces the output from $-\infty$ to $\infty$. For instance, inverse tanh of 0 is 0.


text:
Q: Jint+JSfuck - 'Index was outside the bounds of the array' I'm trying to run the following code in jint:
Jint.Engine engine = new Jint.Engine();
var result = engine.SetValue("data", data).Execute("(/\\n(.+)/.exec(eval(data.replace(/\\s+/, \"\").slice(0, -2)))[1]);").GetCompletionValue();

Which, when unescaped, is executing the following javascript:
(/\n(.+)/.exec(eval(data.replace(/\s+/, "").slice(0, -2)))[1]);

the data variable corresponds to a JSfuck string, similar to this: https://pastebin.com/vmGAebW5
The problem is that I always get a 'Index was outside the bounds of the array' exception, even though the javascript works fine when run in a browser. Any ideas as to what is causing the issue?

A: windows.location is not available in Jint as the window object is provided by the browser. If you wanted to be able to run this kind of code then you would need to mock all the browser exposed objects, which is a huge task.
Also you are using SetValue('window.location', "") which I assume is not a valid call. The property name should not contain dots.


text:
Q: How to get Navigate Edition of HERE maps?
So I am trying to get the navigation edition, but it says contact your HERE representative. Who exactly is HERE representative?
I did mail them but in vain. No reply yet.

A: After checking with the product management team, the 4.x Navigate edition is still in the closed beta testing phase. It is planned to go commercial during second half of 2020. We do offer the Premium edition of the SDK. Please check if you can waiting till Q3 for the Navigate edition, and during the mean time please feel free to try the Premium edition. The Premium edition is included in our Freemium plan btw.


text:
Q: "GROUP BY" function in Python for array I've tried Pandas and Numpy but haven't seen the result I want.  I have a simple array that consists of several lines of this:
[[customer_number, customer_name, invoice balance],[customer_number, customer_name, invoice balance]]
and so on.  Many have the same customer_number and every customer_number has it's own customer_name associated, so one will always equal the other.  What I'd like to do is basically a group by function, similar to the in SQL.  I want this:
[[customer_number, customer_name, sum(invoice_balance)]]
where the last sums all the invoice balances with the same customer_number, leaving me with an array consisting of all entirely unique customer_numbers and the sum of all invoice balances for that customer.
I'd prefer to do this without pandas or numpy, but will use it if need be.  I've been trying to modify a version of this to work:
[sum(x[2]) for x in array]
but my invoice_balance is straight out of psycopg2 and is formatted as a Decimal object, and for some reason, that wasn't working.
Is there a way to do this without a library in Python, or is there some easy method in pandas/numpy?
edit:  here is an example of the array I am working with that I get directly from psycopg2:
[[Decimal('1111'), 'Customer1', Decimal('31.50')],
[Decimal('1112'), 'Customer2', Decimal('30.88')],
[Decimal('1111'), 'Customer1', Decimal('90.00')],
[Decimal('1113'), 'Customer3', Decimal('30.88')],
[Decimal('1112'), 'Customer2', Decimal('30.88')],
[Decimal('1112'), 'Customer2', Decimal('15.00')],
[Decimal('1111'), 'Customer1', Decimal('37.93')],
[Decimal('1113'), 'Customer3', Decimal('30.88')],
[Decimal('1111'), 'Customer1', Decimal('30.88')],
[Decimal('1111'), 'Customer1', Decimal('30.88')],
[Decimal('1113'), 'Customer3', Decimal('26.60')],
[Decimal('1113'), 'Customer3', Decimal('44.22')],
[Decimal('1112'), 'Customer2', Decimal('32.93')],
[Decimal('1111'), 'Customer1', Decimal('20.00')],
[Decimal('1113'), 'Customer3', Decimal('38.14')],
[Decimal('1111'), 'Customer1', Decimal('16.60')],
[Decimal('1112'), 'Customer2', Decimal('67.46')],
[Decimal('1111'), 'Customer1', Decimal('30.88')],
[Decimal('1113'), 'Customer3', Decimal('30.88')],
[Decimal('1111'), 'Customer1', Decimal('233.42')]]

and the error I receive when I try [sum(x[2]) for x in array]:
TypeError: 'decimal.Decimal' object is not iterable
edit 2:
[Decimal('1112'), Decimal('393217'), datetime.date(2021, 5, 5), Decimal('961.96'), Decimal('46.16'), Decimal('551.05'), Decimal('961.96')],
[Decimal('1111'), Decimal('392865'), datetime.date(2021, 4, 29), Decimal('270.57'), Decimal('221.65'), Decimal('0.00'), Decimal('270.57')],
[Decimal('1113'), Decimal('392716'), datetime.date(2021, 4, 27), Decimal('494.44'), Decimal('123.45'), Decimal('0.00'), Decimal('494.44')],
[Decimal('1112'), Decimal('392654'), datetime.date(2021, 4, 26), Decimal('156.60'), Decimal('69.99'), Decimal('6.50'), Decimal('156.60')],
[Decimal('1113'), Decimal('392654'), datetime.date(2021, 4, 26), Decimal('160.42'), Decimal('72.99'), Decimal('52.80'), Decimal('160.42')]]

per Mark's answer, I am curious how to adjust his code to make this sum each column that is not the customer id or name so I end up with something like this:
[[customer_id, customer_name, sum(total), sum(applied), sum(credit), sum(balance)]]

A: You can make a dict that is keyed to the tuple of account name/number. Then loop through and collect the sums in the dict. Afterward you can convert the dict items() back a list:
accounts = {}

for num, name, balance in l:
    accounts[(num, name)] = accounts.get((num, name), 0) + balance

result = [[num, name, balance] for (num, name), balance in accounts.items()]

result will be:
[[Decimal('1111'), 'Customer1', Decimal('522.09')],
 [Decimal('1112'), 'Customer2', Decimal('177.15')],
 [Decimal('1113'), 'Customer3', Decimal('201.60')]]

A: Just to show you that you can do this with pandas also:
In [1]: import pandas as pd

In [2]: from decimal import Decimal

In [3]: data = [[Decimal('1111'), 'Customer1', Decimal('31.50')],
   ...: [Decimal('1112'), 'Customer2', Decimal('30.88')],
   ...: [Decimal('1111'), 'Customer1', Decimal('90.00')],
   ...: [Decimal('1113'), 'Customer3', Decimal('30.88')],
   ...: [Decimal('1112'), 'Customer2', Decimal('30.88')],
   ...: [Decimal('1112'), 'Customer2', Decimal('15.00')],
   ...: [Decimal('1111'), 'Customer1', Decimal('37.93')],
   ...: [Decimal('1113'), 'Customer3', Decimal('30.88')],
   ...: [Decimal('1111'), 'Customer1', Decimal('30.88')],
   ...: [Decimal('1111'), 'Customer1', Decimal('30.88')],
   ...: [Decimal('1113'), 'Customer3', Decimal('26.60')],
   ...: [Decimal('1113'), 'Customer3', Decimal('44.22')],
   ...: [Decimal('1112'), 'Customer2', Decimal('32.93')],
   ...: [Decimal('1111'), 'Customer1', Decimal('20.00')],
   ...: [Decimal('1113'), 'Customer3', Decimal('38.14')],
   ...: [Decimal('1111'), 'Customer1', Decimal('16.60')],
   ...: [Decimal('1112'), 'Customer2', Decimal('67.46')],
   ...: [Decimal('1111'), 'Customer1', Decimal('30.88')],
   ...: [Decimal('1113'), 'Customer3', Decimal('30.88')],
   ...: [Decimal('1111'), 'Customer1', Decimal('233.42')]]

In [4]: df = pd.DataFrame(data, columns=['customer_id', 'customer_name', 'invoice_balance'])

In [5]: df
Out[5]:
   customer_id customer_name invoice_balance
0         1111     Customer1           31.50
1         1112     Customer2           30.88
2         1111     Customer1           90.00
3         1113     Customer3           30.88
4         1112     Customer2           30.88
5         1112     Customer2           15.00
6         1111     Customer1           37.93
7         1113     Customer3           30.88
8         1111     Customer1           30.88
9         1111     Customer1           30.88
10        1113     Customer3           26.60
11        1113     Customer3           44.22
12        1112     Customer2           32.93
13        1111     Customer1           20.00
14        1113     Customer3           38.14
15        1111     Customer1           16.60
16        1112     Customer2           67.46
17        1111     Customer1           30.88
18        1113     Customer3           30.88
19        1111     Customer1          233.42

Now, you can use a sql-esque declarative approach with pandas:
In [6]: df.groupby(['customer_id', 'customer_name'])['invoice_balance'].sum()
Out[6]:
customer_id  customer_name
1111         Customer1        522.09
1112         Customer2        177.15
1113         Customer3        201.60
Name: invoice_balance, dtype: object

Of course, I probably wouldn't add pandas as a dependency to your project just for this. but it is possible.

A: # always use decimal type for money, not float
from decimal import Decimal

# input data
data = [
    [ 1, 'Bob',   Decimal('1.23') ],
    [ 2, 'Alice', Decimal('2.34') ],
    [ 1, 'Bob',   Decimal('3.45') ],
    [ 2, 'Alice', Decimal('4.56') ],
]

# sum balances into buckets by customer number
buckets = {}
for num, name, balance in data:
    buckets.setdefault(num, [num, name, Decimal('0.00')])[2] += balance

# print the result
for bucket in buckets.values():
    print(bucket)

Output:
[1, 'Bob', Decimal('4.68')]
[2, 'Alice', Decimal('6.90')]


text:
Q: Upgrade from non-server to server? Is it possible to upgrade from a non-server (desktop) edition of OS X to the server edition? I currently have a Mac Mini running standard ML but I'd like to upgrade it to the Server version as I use it for a home fileserver and the connections frequently get maxed out. Preferably I'd like to go straight from ML -> Mavericks Server, but I don't even know if the desktop-to-server path is possible on any edition without a fresh install (I hope it is).

A: OS X Server, from OS X Lion onwards, is just another app you buy from the Mac App Store and install. You do not need to do a fresh install of the OS. There are generally no special hardware requirements for OS X Server compared to the client edition either.
To move from OS X Mountain Lion client to OS X Mavericks server, you would first have to upgrade to OS X Mavericks client, then buy and install the Server App from the Mac App Store.
The General Requirements section on OS X Server Technical Specifications page currently states:

*

*Mac computer running Mountain Lion.

*2GB of memory.

*10GB of available disk space; some features require additional disk space.

*Some features require an Apple ID; terms apply.

*Some features require a compatible Internet service provider; fees may apply.

*Some features are not available in all countries.


text:
Q: is it possible not to have extra subdirectory when using Git - submodule - sparse-checkout? I want to mimic behavior like svn:externals: I have a master project and I have some "common" code in another repository. With SVN I would do:
svn co <url>/src common

and my folder structure would be:
repo/common/*.cpp

Now with git + submodule + sparse checkout this is a lot more complicated and I have an extra subdirectory layer when I add the submodule;
git submodule add <url> common

now my folder structure is:
repo/common/src/*.cpp
repo/common/lib/...

with sparse checkout I can make sure only to checkout the src folder, but than I still have one more layer (src) compared to the svn:externals solution:
repo/common/src/*.cpp

is there a better solution for common code? Or a way to clean this up? I know that everything will be working; it's just not so clean...

A: You cannot avoid the extra folder from the submodule, but you can add a symbolic link (even on Windows) in order to find the content you want.
Add your submodule with its repo name:
git submodule add -b master /url/of/repo

Add a symlink:
ln -s repo/src common

Don't forget to add the '-b master' if you want your repo to follow its master branch.
This is possible since git 1.8.2: see "git submodule tracking latest".

Even the Git 2.25 and its git sparse-checkout command would not avoid the extra folder level "common".


text:
Q: Why is my Wordpress Ajax function not working on mobile? I have a Wordpress website hosted on 20i. I'm almost certain that everything worked fine until I pointed the a records to get the website off its test domain and onto the actual one, this might be unrelated but I figured I'd mention it incase. Anyway for some reason my Ajax function works fine on desktop but not on mobile. When I look at it on mobile none of the posts are visible and if I select a filter nothing happens. Does anyone know what this could be? I've looked around for answers but I can't seem to find the solution.
Here's my code;
jQuery
// submit form function
jQuery('#form').on('submit', function(e){
    e.preventDefault();

    var $ = jQuery;
    var filter = $('#form');
    var form_data = $('#form').serializeArray();
    $('#load_more').data('page', 1);

    $.ajax({
        url: ajax_url,
        type: 'post',
        data: form_data,
        dataType: 'json',
        error : function(response){
            console.log(response);
        },
        success : function(response){
            $('#loop').empty();

            for( var i = 0; i < response.post_cont.length; i++ ){
                var html =''+
                    '
'+
                        ''+
                            '
'+
                                '

'+

                                '
'+
                                    '
'+ response.post_cont[i].title +'
'+
                                '
'+
                            '
'+
                        ''+
                    '
';

                $('#loop').append(html);
            }
        }
    });
});

php AJAX function
<?php
    add_action('wp_ajax_nopriv_filter', 'filter');
    add_action('wp_ajax_filter', 'filter');

    // this function runs after it is called inside our_work_ajax.js
    function filter(){

        if( $_POST['type'] && !empty($_POST['type']) ){
            $category = $_POST['type'];
        }else{
            $category = array( 'Assisted Needs/Residential', 'Commercial/Educational', 'Private Housing', 'Social-Housing' );
        }

        $args = array(
            'post_type'         => 'our_work',
            'posts_per_page'    => 9,
            'orderby'           => 'date',
            'tax_query'         => array(
                array(
                    'taxonomy'      => 'category',
                    'field'         => 'slug',
                    'terms'         => $category
                )
            )
        );

        $query = new WP_Query( $args );

        $no_of_posts = $query->found_posts;

        if( $query->have_posts() ):
            while( $query->have_posts() ): $query->the_post();

                $main_field = get_field('Images');
                $first_row = $main_field[0];
                $img = $first_row['Image'];
                $imgsize = $img['sizes']['large'];

                // creating an array of content needed from array
                $post_cont[] = array(
                    "permalink" => get_the_permalink(),
                    "image" =>  $imgsize,
                    "title" =>  get_the_title(),
                );
            endwhile;
        endif;

        // array getting the total number of posts
        $max_posts[] = array(
            "no_of_posts"   => $no_of_posts
        );
        // converting arrays into json and submitting it to the ajax_url for the .js file
        echo json_encode(array( "post_cont" => $post_cont, "max_posts" => $max_posts));
        wp_reset_postdata();
        die();
    }
?>

HTML
<form action="" method="POST" id="form">

Assisted Needs/Residential

            <input type="checkbox" name="type[]" value="Assisted Needs/Residential">

Commercial/Educational

            <input type="checkbox" name="type[]" value="Commercial/Educational">

Private Housing

            <input type="checkbox" name="type[]" value="Private Housing">

Social Housing

            <input type="checkbox" name="type[]" value="Social Housing">

    <input type="hidden" name="action" value="filter">
</form>

AJAX url inside functions.php
wp_localize_script( 'all_js', 'ajax_url', admin_url('admin-ajax.php') );


text:
Q: Formatting a php variable into a php string with quotes I've tried multiple ways to format this http string, like escaping the " that are present in "user" and the user's name, but the API I'm connecting to will not work with anything but %22, so:
https://url.com/search/search?p=[{"user":"abc123"}]

has to be formatted like this:
curl_setopt($ch, CURLOPT_URL, 'https://url.com/search/search?p=[{%22user%22:%22abc123%22}]');

into this:
I need to replace %22abc123%22 with the actual user from a PHP variable, so the code looks like this:
[{%22user%22:%22 $phpVariable %22}]');
and is still enclosed in the %22, but I cannot figure out how to get the variable into the string without causing the string to give me an error.  How do I do this (very simple) task?

A: I'm not sure why this is, as I generally enclose things in single quotes, but when I enclosed the string in double quotes, it worked as it normally would, so my string is:
curl_setopt($ch, CURLOPT_URL, "https://url.com/search/search?p=[{%22user%22:%22$phpVariable%22}]");


text:
Q: Django looping through 10 items of an array each time a button is pressed I would like a page to start by showing 10 items, once a button is clicked, the next 10 items are shown and so on. Pressing the back button will show the previous 10 items. How would I got about doing this? The items are in an array. Each item is a queryset.
Current code:
{% for item in items %}
 #format item to be shown
{% endfor %}

A: You need to use pagination to get your page as expected.
Have a look here at Pagination from Django Documentation


text:
Q: Limit access to endpoint of WCF service hosted in IIS I'm hosting a WCF service in IIS 7.5. The service has one endpoint with webHttpBinding, and one endpoint with netTcpBinding. How can I limit access to the nettcp endpoint, so that only local clients (clients running on the same machine) has access? Is it enough to just set the base address to localhost-something?

A: Will suggest to use NetNamedPipeBinding which is meant for on-machine communication only.
Regarding limiting access to tcp binding, I guess you can use IDispatchMessageInspector to limit the access. For example, see this code-project article that has use it for IP Address based filtering - configuring it for local IP (127.0.0.1) should get exactly what you wanted.


text:
Q: pause/play multiple embedded youtube players I have 2 thumbnail links, and when they are clicked on they open up videos in a lightbox style. My goal is to get them to play when they open and pause when they are closed (they close when the background area is clicked on).
My HTML code is here:

More To Come

And my Javascript:
$(document).ready(function(){

$('.thumbnail').click(function(){
    var $id = $(this).attr('id');
    $('.backdrop, #vid'+ $id).animate({'opacity':'.50'}, 300, 'linear');
    $('#vid'+ $id).animate({'opacity':'1.00'}, 300, 'linear');
    $('.backdrop, #vid'+ $id).css('display', 'block');
    });

    $('.backdrop').click(function(){
                close_box();
});

});

 function close_box()
{
    $('.backdrop,.Video').animate({'opacity':'0'}, 300, 'linear', function(){
        $('.backdrop,.Video').css('display', 'none');
    });
};

I should probably mention that I am quite new to these languages!

A: You need to use YouTube API.
Here is tutorial

A: You can use YouTube Player API for iframe Embeds. Here is the reference to it. Instead of placing iFRAME tag, you create empty DIV with ID and SCRIPT tag with some JavaScript code. The code then generates an iFRAME and places it on the DOM, removing early created DIV and SCRIPT tags. This allows you to manipulate the player in the SCRIPT tag. Here is the working example in jsFiddle.
P.S. Also please pay attention to the "Requirements" section.


text:
Q: How LLVM/Clang implements RVO I am trying to figure out how LLVM implements RVO. The simplest idea for me was to have pointer in arguments and memcpy to it any value that needs to be returned from a function. Then run memcpyopt pass and get RVO this way if possible.
It seems that's what happening, with -fno-elide-constructors:
define void @_Z3fooic(%struct.X* noalias sret, i32, i8 signext) #0 {
    ..
    call void @llvm.memcpy.p0i8.p0i8.i64(i8* %12, i8* %13, i64 20, i32 4, i1 false)
    ret void

and without it seems that all the operations are directly applied to %0.
Is that correct understanding or am I missing some caveats here?
EDIT
define i8 @make_positive_point_x_I64_y_I64(i64 %x, i64 %y, %Point*) {
entry:
  %1 = or i64 %x, %y
  %2 = icmp slt i64 %1, 0
  br i1 %2, label %exit, label %merge

merge:                                            ; preds = %entry
  %3 = alloca %Point, align 8
  call void @"Point___new_self_&Point_x_I64_y_I64"(%Point* nonnull %3, i64 %x, i64 %y)
  %4 = bitcast %Point* %0 to i8*
  %5 = bitcast %Point* %3 to i8*
  call void @llvm.memcpy.p0i8.p0i8.i64(i8* %4, i8* %5, i64 zext (%Point* inttoptr (i64 16 to %Point*) to i64), i32 1, i1 false)
  br label %exit

exit:                                             ; preds = %entry, %merge
  %.0 = phi i8 [ 0, %merge ], [ 1, %entry ]
  ret i8 %.0
}

It seems memcpyopt is not sufficient, as it doesn't recognize that it can use %0 instead of %3.