text:
Q: Ember.js findRecord() called with id null for model with alternative primary key I have an issue with my Ember.js application. It uses the JSONAPI{Adapter,Serializer} and the following model:
models/node.js
App.Node = DS.Model.extend(
{
  // (node 'name' field used as primary key for serialization)

  info: DS.attr('string'),
  children: DS.hasMany('node', { inverse: null })
}

Which represents a tree of named nodes.
The JSONAPIAdapter (adapters/application.js) implements the functions queryRecord(), query(), findRecord(), findAll() to translate the Ember.js queries from the server. This all works fine.
The JSONAPISerializer implements the function normalizeResponse() to translate the server response JSON data to json:api format. In the serializer, the primary key is defined to be the 'name' field of the node:
serializers/application.js
App.ApplicationSerializer = DS.JSONAPISerializer.extend(
{
  primaryKey: 'name',

  normalizeResponse(store, primaryModelClass, payload, id, requestType)
  {
    // ...
  }
});

A sample of the json:api data generated by the serializer is:
{
  "data": [
    {
      "type": "node",
      "attributes": {
        "info": "Root node"
      },
      "relationships": {
        "children": {
          "data": [
            {
              "type": "node",
              "name": "Root/SubNode1"
            }
          ]
        }
      },
      "name": "Root"
    }
  ],
  "included": [
    {
      "type": "node",
      "attributes": {
        "info": "Subnode 1"
      },
      "relationships": {
        "children": {
          "data": [
          ]
        }
      },
      "name": "Root/SubNode1"
    }
  ]
}

I use Ember.js version 2.7.0 and Ember inspector.
Once the application is running, and data is loaded in the model, I can see the data in Ember inspector being visible in the model. However, when investigating the model data in the 'Data' view (and selecting an item), I find that Ember is invoking adapter:findRecord() with id = null, resulting in an erroneous query. Somehow it seems the model data is incorrect.
When I remove the primary key definition in the JSONAPISerializer and duplicate the name field of a node in the id field as the Ember default primary key, all is fine. What am I missing with my primary key definition? The Ember guide only states information about the primaryKey in the serializer (https://guides.emberjs.com/v2.7.0/models/customizing-serializers/#toc_ids).
Many thanks in advance!

A: You need to define name field to have a place to save the id.
App.Node = DS.Model.extend(
{
  // (node 'name' field used as primary key for serialization)
  name: DS.attr('string'),
  info: DS.attr('string'),
  children: DS.hasMany('node', { inverse: null })
}


text:
Q: jquery focus to table I want to bring focus to first row in a table when a page loads.I am using this for navigation
in a table using key board.How do i bring focus and some times this keyboard navigation is also not working
http://jsfiddle.net/hKZqS/8/ When using key board this is removing zebra stripes

A: Try the following jQuery code:
$(document).ready(function(){
    $("#myTable tbody tr").first().addClass("ui-selected");
});

// Do the clever keypress stuff
$(document).keyup( function(e)
{
    switch(e.which)
    {
        // user presses the "a" key
        case 38:
            if(!e.ctrlKey) {
                var selected = $("tr.ui-selected").first();
                if (selected.prev().html() != null) {
                    selected.prev().addClass("ui-selected");
                    selected.removeClass("ui-selected");
                }
            }
            break;
        // user presses the "s" key
        case 40:
            if(!e.ctrlKey) {
                var selected = $("tr.ui-selected").first();
                if (selected.next().html() != null) {
                    selected.next().addClass("ui-selected");
                    selected.removeClass("ui-selected");
                }
            }
            break;
    }
});

I tested it out and it seems to be working on a modified version of your jsFiddle: See Sample

redpajama_set_name: RedPajamaStackExchange


text:
Q: How to get text between different tags in Jsoup? I have to parse html code like this:
  Dont need itI need this!!
Dont need it too: I need
  this too!!
 Text: I need this

I tried something like this:
td.select("
)") but It had trown an exception.
I am able to get the text in b tag, but how can I get text between  b and br tag.

A: You want to get all the text nodes under the  but none of the named nodes. JSoup has a method called textNodes() that returns these:
Element td = ...;
StringBuilder sb = new StringBuilder();
for (TextNode textNode : td.textNodes()) {
    sb.append(textNode.text());
}
return sb.toString();


text:
Q: Powershell folder creation from variables Here's what I have working so far:
$extensions = '*.xls*', '*.doc*', '*.txt', '*.pdf', '*.jpg', '*.lnk', '*.pub', '*.pst', '*.pps', '*.ppt'

Get-Content C:\computers.txt | % {
  $ComputerName = $_

  $dst = "\\Server\share\$ComputerName"
  $src = "\\$ComputerName\c$\Documents and Settings\**\Desktop",
         "\\$ComputerName\c$\Documents and Settings\**\My Documents"

  New-Item -ItemType Directory $dst

  Get-Childitem $src -Include $extensions -Recurse -Force |
    Copy-Item -Destination $dst\
}

My goal is to back up specific file types from a list of machines. These machines have approx 10-20 profiles on them. Would it be possible to arrange these files in a directory under the computer name directory from the profile they came from? Such as creating a profile name directory under the created computer name directory then dump the targeted files in their appropriate folder.
Example:
\\server\share\computername1\profile1\document.doc
\\server\share\computername2\Profile2\document.doc

A: You can't use wildcards in your source paths if you want to use part of the path (well, technically you can, but it'd be a pain in the rear). Use an inner loop instead:
$extensions = '*.xls*', '*.doc*', ...

Get-Content C:\computers.txt | % {
  $ComputerName = $_

  Get-ChildItem "\\$ComputerName\c$\Documents and Settings" | ? {
    $_.PSIsContainer
  } | % {
    $dst = Join-Path "\\Server\share\$ComputerName" $_.Name

    New-Item -ItemType Directory $dst
    # no need to create $dst first, b/c New-Item will auto-create missing
    # parent folders

    $src = (Join-Path $_.FullName 'Desktop'),
           (Join-Path $_.FullName 'My Documents')

    Get-Childitem $src -Include $extensions -Recurse -Force |
      Copy-Item -Destination $dst\
  }
}


text:
Q: Can you use the AppDelegate to store App data using NSUserDefaults? I am trying to store a couple of arrays using NSUserDefaults. I am trying to do everything inside the appDelegate when the application either is terminated or launches. However, I am having a hard time getting it to work.... I am able to access my arrays (projects, tasks, and teamMembers) from any other class in the app including being able to add and remove data to them. SO I know that that they are working, but I can't save data and get it again. Though I have some objective c experience I have never tried to save any app data. Anyone have any suggestions? Here is the code from my AppDelegate
#import "AppDelegate.h"

@implementation AppDelegate

@synthesize window = _window;
@synthesize tasks;
@synthesize teamMembers;
@synthesize projects;

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:     (NSDictionary *)launchOptions
{
NSUserDefaults *prefs = [NSUserDefaults standardUserDefaults];
tasks = [[NSMutableArray alloc]init];
tasks = [prefs objectForKey:@"tasks"];
NSLog(@"There are this many tasks in TASKS after the app loads %@", [tasks count]);
teamMembers = [prefs objectForKey:@"teamMembers"];
projects = [prefs objectForKey:@"projects"];

// Override point for customization after application launch.
return YES;

}

- (void)applicationWillResignActive:(UIApplication *)application
{
/*
 Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state.
 Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game.
 */

NSUserDefaults *prefs = [NSUserDefaults standardUserDefaults];

NSString *theTasks = [[NSString alloc]initWithString:@"tasks"];
NSString *theTeamMembers = [[NSString alloc]initWithString:@"teamMembers"];
NSString *theProjects = [[NSString alloc]initWithString:@"projects"];

[prefs setObject:tasks forKey:theTasks];
[prefs setValue:teamMembers forKey:theTeamMembers];
[prefs setValue:projects forKey:theProjects];
[prefs synchronize];

}

- (void)applicationDidEnterBackground:(UIApplication *)application
{
/*
 Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later.
 If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits.
 */

NSUserDefaults *prefs = [NSUserDefaults standardUserDefaults];

NSString *theTasks = [[NSString alloc]initWithString:@"tasks"];
NSString *theTeamMembers = [[NSString alloc]initWithString:@"teamMembers"];
NSString *theProjects = [[NSString alloc]initWithString:@"projects"];

[prefs setObject:tasks forKey:theTasks];
[prefs setValue:teamMembers forKey:theTeamMembers];
[prefs setValue:projects forKey:theProjects];
[prefs synchronize];

}

- (void)applicationWillEnterForeground:(UIApplication *)application
{
/*
 Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background.
 */

NSUserDefaults *prefs = [NSUserDefaults standardUserDefaults];
tasks = [prefs objectForKey:@"tasks"];
teamMembers = [prefs objectForKey:@"teamMembers"];
projects = [prefs objectForKey:@"projects"];

}

- (void)applicationDidBecomeActive:(UIApplication *)application
{
/*
 Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface.
 */

NSUserDefaults *prefs = [NSUserDefaults standardUserDefaults];
tasks = [prefs objectForKey:@"tasks"];
teamMembers = [prefs objectForKey:@"teamMembers"];
projects = [prefs objectForKey:@"projects"];
}

- (void)applicationWillTerminate:(UIApplication *)application
{
/*
 Called when the application is about to terminate.
 Save data if appropriate.
 See also applicationDidEnterBackground:.
 */

NSUserDefaults *prefs = [NSUserDefaults standardUserDefaults];

NSString *theTasks = [[NSString alloc]initWithString:@"tasks"];
NSString *theTeamMembers = [[NSString alloc]initWithString:@"teamMembers"];
NSString *theProjects = [[NSString alloc]initWithString:@"projects"];

[prefs setObject:tasks forKey:theTasks];
[prefs setValue:teamMembers forKey:theTeamMembers];
[prefs setValue:projects forKey:theProjects];
[prefs synchronize];

}

@end


text:
Q: Serve clients with geospatial news I am developing an app where the user will receive geo based information depending on his position. The server should be able to handle huge number of connected clients >100k.
Now i came up with 4 Approaches on how to handle the users position.

*

*Approach - Without geospatial index:
The app server does just hold a list of connected clients and they're location.
Whenever there is a information available the server does loop over the whole list and checks whether the client is within a given radius.
Doubts: Very expensive

*Approach - Handle geospatial index in the app server:
The app server does maintain a R Tree with all connected clients and they're location.
Therefore i was looking at JSI Java Spatial Index
Doubts: It is very expensive to update the geospatial index with JSI

*Approach - Let the database "mongoDb" do the geospatial index / calculation:
The app server does only hold a reference to the connected client (connection) and saves the key to that reference together with its location into mondoDb.
When a new information is available the server can query the database to get the keys off all clients nearby.
Pro: I guess mongoDb does have a much better implementation of geospatial indexes than i could ever do in the app server.
Doubts: Clients are traveling around which forces me to update the geospatial index frequently. Can i do that or am i running into a performance problem?

*Approach - Own "index" using 2 dimensional array
Today i was thinking about creating a very simple index by using a two dimensional array. While the outer array is for the longitude the inner would be for the latitude.
Lets say 3 longitude / altitude degree would be enough precision.
I could receive a list of users in a given area by
ArrayList userList = data[91][35] //91.2548980712891, 35.60869979858;
// i would also need to get the users in the surrounding arrays 90;35, 92;35 ...
// if i need more precision i could use one more decimal data[912][356]
Pro: I would have fast read and write access without a query to the database
Doubts: Radius is shorter at poles. Ugly hack?
I would be very grateful if someone could point me into "the" right direction.

A: The index used by MongoDB for geospatial indexing is based on a geohash, which essentially converts a 2 dimensional space into a one-dimensional key, suitable for B-tree indexing. While this is somewhat less efficient than an R-tree index it will be vastly more efficient than your scenario 1.  I would also argue that filtering the data at the db level with a spatial query will be more efficient and easier to maintain than creating you own spatial indexing strategy on top.
The main thing to be aware of with MongoDB is that you cannot use a geometry column as a shard key, though you can shard a collection containing a geometry field, using another key. Also, if you wish to do any aggregation queries, (which isn't clear from your question) the geometry field must be the first through the pipeline.
There is also a geohaystack index, which is based on small buckets and optimized for search based on small areas, see, http://docs.mongodb.org/manual/core/geohaystack/, which might be useful in your case.
As far as speed is concerned, insertion and search on a B-Tree index are essentially O(log n), see Wikipedia B-Tree while without an index your search will be O(n), so it will not take very long before the difference in perfomance is enormous between having and not having an index.
If you are concerned about heavy writes slowing things down, you can tune the write concern in MongoDB so that you don't have to wait for a majority of replicas to respond to every write (the default), but at the cost of potentially inconsistent data, if you should lose your master.


text:
Q: How to cite an epub or ebook with biblatex-dw? Background
Reading so-called electronic books is becoming increasingly common, not only as a leisure activity, but also as a serious means to do research. However, there is some reluctance to embrace this format, and one key issue remains the proper citation. Many style manuals simply tend to treat ebooks as books. The problem I've found when they are treated the same (without an indication) is that citations seem inconsistent: paper books are cited by page but ebooks (which nobody else will know they are such) will be referred to by chapter/section. In addition, this can be sometimes misleading. For instance, while paraphrasing, the reader can come to believe that I'm alluding a whole chapter/section when I'm not.
Anyway, I haven't found any advise in the BibLaTeX documentation (ver. 3.4): section 3.11.7 refers to Electronic Publishing but it has to do with online archives.
As far as I can tell, there is so far no proper BibLaTeX «field» to indicate the format, a field which could be independently used by any style.
In the meantime, I'd like to find a way to specify that a citation was an ebook. For instance:
\documentclass{article}

\usepackage[style=authortitle-dw,
    firstfull=true,
    backend=biber]{biblatex}

\usepackage{filecontents}

\begin{filecontents}{\jobname.bib}
    @book{Mouffe,
        author = {Mouffe, Chantal},
        title = {Agonistics},
        subtitle = {Thinking the world politically},
        publisher = {Verso},
        year = {2013},
    }
    @book{Knu86,
    author = {Knuth, Donald E.},
    year = {1986},
    title = {The \TeX book},
    }
\end{filecontents}

\addbibresource{\jobname.bib}

\begin{document}

\cite{Mouffe}

\cite{Knu86}

\cite{Mouffe}

\end{document}

Output

Expected output
Chantal Mouffe: Agonistics. Thinking the world politically, 2013, epub version
Donald E. Knuth: The TEXbook, 1986
Mouffe: Agonistics
Question
What entry and field should be used to print an explicit ebook reference under biblatex-dw?

A: I don't know of a universal (style-independent) field to indicate whether a book is an ebook or not.
Most styles support the note and addendum fields, which you can fill with any text you want. So you could just write epub version there. If you see fit, you could also use the edition field.
All the ebooks I wanted to cite so far were pretty much digital versions of a print edition and so had normal pages that coincided with the print pages. In that case one would of course give the ebook ISBN.

A: I stumbled upon a similar problem, only requiring a bracketed note like [ebook] directly after the title as in APA-like styles. If you need the note there, the appropriate field to use is titleaddon.


text:
Q: If you run an app made with Flutter and go to the home screen for a while, the following message appears continuously I am very afraid. is this an error? If you run it and go to the home screen, this message keeps appearing.
The same goes for returning to the app.
Below is part of my code.
This page supports both YouTube video and camera functions.
List<CameraDescription> cameras = List.empty(growable: true);

class Home extends StatefulWidget {
  @override
  const Home({Key? key}) : super(key: key);
  _Home createState() => _Home();
}

class _Home extends State<Home>{
  CameraController controller =
  CameraController(cameras[1], ResolutionPreset.max);
  //final VideoHomeController controller= Get.put(VideoHomeController());
  late final YoutubePlayerController _controller;

  @override
  void initState() {
    super.initState();
    controller.initialize().then((_) {
      if (!mounted) {
        return;
      }
      setState(() {});
    });
    _controller = YoutubePlayerController(
      initialVideoId: '',
      flags: YoutubePlayerFlags(
        autoPlay: false,
        loop: false,
        hideThumbnail: false,
        //isLive: true,

        controlsVisibleAtStart: false,

        useHybridComposition: false,
      ),
    );

  }

  @override

  @override
  void dispose() {
    _controller.pause();
    controller.dispose();
    super.dispose();
  }

  @override
  Widget build(BuildContext context){

    //Get.find<YoutubeDetailController>();
    var height2 = AppBar().preferredSize.height;
    if (!controller.value.isInitialized) {
      return Container();
    }

    return SafeArea(

...

  body: Stack(

            children: [
              CameraPreview(controller),
              //상단 슬라이드
          Column(
...

This is logs in console
W/MessageQueue(20594):  at android.os.Handler.sendMessageDelayed(Handler.java:697)
W/MessageQueue(20594):  at android.os.Handler.post(Handler.java:427)
W/MessageQueue(20594):  at android.hardware.camera2.impl.CameraDeviceImpl$CameraHandlerExecutor.execute(CameraDeviceImpl.java:2163)
W/MessageQueue(20594):  at android.hardware.camera2.impl.CameraDeviceImpl$CameraDeviceCallbacks.onResultReceived(CameraDeviceImpl.java:2071)
W/MessageQueue(20594):  at android.hardware.camera2.ICameraDeviceCallbacks$Stub.onTransact(ICameraDeviceCallbacks.java:182)
W/MessageQueue(20594):  at android.os.Binder.execTransactInternal(Binder.java:1195)
W/MessageQueue(20594):  at android.os.Binder.execTransact(Binder.java:1159)
W/MessageQueue(20594): Handler (android.os.Handler) {277b89c} sending message to a Handler on a dead thread
W/MessageQueue(20594): java.lang.IllegalStateException: Handler (android.os.Handler) {277b89c} sending message to a Handler on a dead thread

A: Firstly, dispose your camera when the app is not in foreground, and re-create camera things when it goes foreground again. (You can use this to detect) Since the error seems to be caused by an active camera-related thing when app in background.
Secondly, if you are curious about the warning, it may be caused by:

the main reason is you have put a message on a queue which has not looper to loop. ref

do not worry if you have no android background and do no understand what is a looper ;) Anyway, that sounds like not a huge problem, i.e. the app will not crash. But I suspect whether there will be some memory leak or CPU wasting etc. Anyway, follow the "firstly" part above, and you should not see warning anymore.

A: What version of the camera package are you using?
This specific issue has cropped up several times in the past year and there have been several patches for it based on the GitHub issues and PRs. So, with that in mind, I would start by updating the camera dependency to the latest and then retest.
The latest issue I could find was from 18 Nov, 2021 and once the original reporter upgraded the camera dependency the issue was resolved: https://github.com/flutter/flutter/issues/93888
The reason I would suggest you to test this prior to following @ch271828n suggestion is because technically speaking this should be handled by the package itself and if they've patched this issue then you can avoid writing boilerplate code.
As an aside, looking at the recent changelog for the plugin, they've patched this error twice:
Flutter Camera Package Changelog: v0.9.4+5
Flutter Camera Package Changelog: 0.9.4+1

A:  @override
  void dispose() {
    _controller.pause();
    controller.dispose();
    super.dispose();
  }

Change this to ->
  @override
  void dispose() {
    _controller.dispose();
    controller.dispose();
    super.dispose();
  }

Your Problem Will be solved

A: replace _controller.pause() with _controller.dispose


text:
Q: Upgrade package without upgrading dependencies using pip? I'm using pip and virtualenv for my python application. I would like to upgrade to a new version of the application without touching the dependencies. When I use pip install -U, it tries to upgrade all the packages, and even uninstalls and re-installs the same version of a dependency package when there isn't a new version available.
I also tried pip install -U --no-deps but that seems equivalent to a regular install instead of an upgrade. Is there a combination of flags that will do what I want?

A: Overview:

*

*Install new packages without upgrading installed ones: pip install (without -U)

*Upgrade only packages that are outdated according to requirements: pip install --upgrade --upgrade-strategy only-if-needed (default in new versions)

*Upgrade package and all dependencies to latest version: pip install --upgrade --upgrade-strategy eager (default in old versions)

*Install or upgrade listed packages without touching dependencies: --no-deps

UPDATE (thanks to @Jether's comment): If you're using the latest version of pip, then updating dependencies only when necessary is now the default behavior, and you don't need to do anything special! The answer below outlines the steps for older versions of pip (which also works for newer versions if you want to be portable).
If you really want to not touch dependencies, then indeed the way to go is
pip install -U --no-deps mypackage

But I think what you'll usually want is to not upgrade dependencies unless it's required. In that case you can use:
pip install --upgrade --upgrade-strategy only-if-needed mypackage

This only updates requirements if the package requires a newer version than is installed.

A: I just tried on my virtualenv project and pip install -U --no-deps mypackage seems to work just fine. It just download mypackage and nothing else. What's your set up like?

A: You're right. I thought that when I added --no-deps it had neglected to uninstall the existing version. But I tried it again and see there's no issue:
$ pip install -U --no-deps myproj
Downloading/unpacking myproj
  Downloading myproj-1.0-trunk.31072.tar.gz (43Kb): 43Kb downloaded
  Running setup.py egg_info for package myproj
Installing collected packages: myproj
  Found existing installation: myproj 1.0-trunk.31053
    Uninstalling myproj:
      Successfully uninstalled myproj
  Running setup.py install for myproj
Successfully installed myproj
Cleaning up...


text:
Q: How to remove the tags using Meta in angular 4 I am able to set the tags dynamically in index.html with Meta concept in angular 4.but when I try to remove tags.its not
removing ,How can I remove the tags whatever I have added before?
here is what I tried:
setting the tags:
import {Meta ,MetaDefinition } from '@angular/platform-browser';
@Component({
  selector: 'app-share-video',
  templateUrl: './share-video.component.html',
  })
export class ShareVideoComponent implements OnInit {
constructor(public metaServic:Meta){}
ngOnInit(){
    const ogtitle: MetaDefinition   =  { name: 'og:title', content: 'Grace' };
    const ogSitename: MetaDefinition = { name: 'og:site_name', content: 'My Favourite Albums'};
    const ogUrl: MetaDefinition = { name: 'og:url', content: 'https://angular.io/docs/ts/latest/api/platform-browser/index/Meta-class.html'};
    const ogdesc: MetaDefinition = { name: 'og:description', content: 'angular 4 share video description'};
    this.metaService.addTag(ogtitle);
    this.metaService.addTag(ogSitename);
    this.metaService.addTag(ogUrl);
    this.metaService.addTag(ogdesc);
  }
ngOnDestroy() {
   this.metaService.removeTag("property='og:title'");
   this.metaService.removeTag("property='og:site_name'");
   this.metaService.removeTag("property='og:url'");
   this.metaService.removeTag("property='og:description'");
    }
}

In the destroy method I am removing the tags, but these tags are not removing,how can I remove the tags?
followed this:meta tags blog

A: The attribute selector that you are trying to use is name, not property.
You have to use
this.metaService.removeTag("name='og:title'");
this.metaService.removeTag("name='og:site_name'");
this.metaService.removeTag("name='og:url'");
this.metaService.removeTag("name='og:description'");

instead of
this.metaService.removeTag("property='og:title'");
this.metaService.removeTag("property='og:site_name'");
this.metaService.removeTag("property='og:url'");
this.metaService.removeTag("property='og:description'");

plnkr

A: Angular 6+ you need to use for this.metaService.removeTag("property='og:description'") etc... Because of with this.metaService.removeTag("name='og:title'"); doesn't work.

A: All of the OpenGraph tags should be using "property", and not "name", for both adding and removing the tags. You were adding with "name" and trying to remove with "property".
Fixed code:
  ngOnInit() {
    const ogtitle: MetaDefinition =  { property: 'og:title', content: 'Grace' };
    const ogSitename: MetaDefinition = { property: 'og:site_name', content: 'My Favourite Albums'};
    const ogUrl: MetaDefinition = { property: 'og:url', content: 'https://angular.io/docs/ts/latest/api/platform-browser/index/Meta-class.html'};
    const ogdesc: MetaDefinition = { property: 'og:description', content: 'angular 4 share video description'};
    this.metaService.addTag(ogtitle);
    this.metaService.addTag(ogSitename);
    this.metaService.addTag(ogUrl);
    this.metaService.addTag(ogdesc);
  }

  ngOnDestroy() {
   this.metaService.removeTag("property='og:title'");
   this.metaService.removeTag("property='og:site_name'");
   this.metaService.removeTag("property='og:url'");
   this.metaService.removeTag("property='og:description'");
  }

For other page metadata like Twitter Cards or normal metadata like description, author, keywords, etc you use "name".

*

*"name='description'"

*"name='author'"

*"name='twitter:description'"

*"name='twitter:image'"

*"name='twitter:image:alt'"

*"name='keywords'"


text: Q: call a rest service in google chrome extension I was wondering if there is a way to make a call to a rest service in google chrome extension. because the domain that I was trying to request is from different domain and it is giving me an cross domain origin policy error from google chrome.


text:
Q: creating a max-heap using java I am trying to create a Max-Heap in java using the following code:
public class Heapify {
// 16 14 10 8 7 9 3 2 4 1

    public static int[] Arr = {4, 1, 3, 2, 16, 9, 10, 14, 8, 7};
    public static int counter = 0;

    public static void main(String[] args) {
        int kk;
        for (kk = 0; kk <= Arr.length - 1; kk++) {
            heapM(Arr, kk);
        }

        for (int krk = 0; krk < Arr.length; krk++) {
            System.out.println(Arr[krk]);
        }

    }

    public static void heapM(int[] Arr, int i) {

        int largest;
        int left = i * 2;
        int right = i * 2 + 1;
        if (((left < Arr.length) && (Arr[left] > Arr[i]))) {
            largest = left;
        } else {
            largest = i;
        }

        if (((right < Arr.length) && (Arr[right] > Arr[largest]))) {
            largest = right;
        }
        if (largest != i) {
            swap(i, largest);

            heapM(Arr, largest);
        }
    }

    private static void swap(int i, int largest) {
        int t = Arr[i];
        Arr[i] = Arr[largest];
        Arr[largest] = t;

    }
}

The desired output should be :
16 14 10 8 7 9 3 2 4 1

Whereas I am getting
4 3 16 14 8 9 10 2 1 7

Can someone please help as to why the heap is not being built properly ?
Thanks

A: I ran your code, and in addition to what Jodaka said, I found one more error
for (kk = 0; kk <= Arr.length - 1; kk++) {
        heapM(Arr, kk);
}

should be
for (kk = Arr.length -1; kk >= 0; kk--) {
        heapM(Arr, kk);
}

because when doing MaxHepify, you start from the end, and go backwards.
and
 int left = i * 2;
 int right = i * 2 + 1;

should be, as Jodaka said
int left = 2*i+1;
int right = 2*i + 2;

I ran it here and the output is now correct

A: I think your problem is here:
int left = i * 2;
int right = i * 2 + 1;

Since java arrays are zero-based, you are saying that the left child of 0 is 0 * 2 = 0!  Fix your logic and see if that fixes your problem.

A: for (kk = Arr.length -1; kk >= 0; kk--) {
    heapM(Arr, kk);
}

should be
for (kk = (Arr.length -1)/2; kk >= 0; kk--) {
    heapM(Arr, kk);
}

More efficient.
Edit This lets you build a heap in O(n) time instead of O(n*lg(n)) time and is explained here: http://en.wikipedia.org/wiki/Binary_heap#Building%5Fa%5Fheap

A: As you want to make a max-heap, you should start from n/2 down to 0 instead of 0 to n. Due to 0 to n what happens is that say in an array like 2 0 1 12 13. The output array after you perform max heap will be 2 13 1 12 0 where as if you call from n/2 down to 0 it will be  13 12 1 2 0.

A: Is this a homework?
If not you can use PriorityQueue of JAVA


text:
Q: Create an associative array where the keys match the values What is the best way to create:
[
    'foo' => 'foo',
    'bar' => 'bar',
]

from this array:
[
    1 => 'foo',
    2 => 'bar',
]

I've looked at array_map, array_walk, and array_column, but I cannot figure out if any of these functions will do this?

A: Use array_combine. Try the following:
$input_array = array(
                      [1] => 'foo',
                      [2] => 'bar'
                    );

// use array_combine such that keys and values are same source
$expected_output = array_combine($input_array, $input_array);

A: You can do it simply using foreach:
$array = array(
     'foo',
     'bar'
);
$newArray = array();

foreach($array as $val)
{
    $newArray[$val] = $val;
}


text:
Q: Entity Framework - Update complex entities I'm using EF5.0 (database first) and trying to Update "Company" entity which is a complex type, it contains "Address" entity as navigation property.
I receive a Company DTO object from UI and I map it, using AutoMapper, to Entity object and call objectContext.Save() for saving.
Problem am facing is, "Company" entity values are getting saved but not the "Address" entity. Below are the each object details-
 public class CompanyDto
{
    public int Id { get; set; }
    public string Name { get; set; }
    public AddressDto Address { get; set; }
}

with AddressDto as -
public class AddressDto : IDto
{
    public int Id { get; set; }
    public string Street { get; set; }
    public string City { get; set; }
    public string PostCode { get; set; }
}

Company Entity (generated by EF - database first)
 public partial class tblCompany
{
    public tblCompany()
    {
        this.tblAddresses = new HashSet<tblAddress>();
    }

    public int ID { get; set; }
    public string CompanyName { get; set; }

    public virtual ICollection<tblAddress> tblAddresses { get; set; } //navigation property
}

with Address entity is as follows -
  public partial class tblAddress
{
    public int ID { get; set; }
    public int CaseID { get; set; }
    public string AddressLine1 { get; set; }
    public string AddressLine2 { get; set; }
    public string City { get; set; }
    public string County { get; set; }
    public string PostCode { get; set; }

    public virtual tblCase tblCase { get; set; }
}

AutoMapper mapping configuration for converting from DTO to entity
  Mapper.CreateMap<CompanyDto, tblCase>()
            .ForMember(x => x.ID, opt => opt.MapFrom(cd => cd.Id))
            .ForMember(x => x.CompanyName, opt => opt.MapFrom(cd => cd.Name))
            .AfterMap((s, d) => d.tblAddresses.Add(new tblAddress
            {
                AddressLine1 = s.Address.Street,
                CaseID = s.Id,
                City = s.Address.City,
                PostCode = s.Address.PostCode
            }));

 public void Update(CompanyDto company)
    {
        //TO DO: check if AutoMapper could map address as well.

        var companyDao = Mapper.Map<CompanyDto, tblCase>(company);
        _companyRepository.Update(companyDao);
        _unitOfWork.Save();
    }

Thanks in advance
Sai


text:
Q: Limit of $f: \mathbb{R}^3 \rightarrow \mathbb{R}$ Given a function
$$ f\left(x{,}\ y{,}\ z\right)=\frac{\alpha_1x+\alpha_2y+\alpha_3z}{\beta_1x+\beta_2y+\beta_3z},$$
does the limit $$ \lim_{\left(x{,}\ y{,}\ z\right)\rightarrow\left(0{,}\ 0{,}\ 0\right)}f\left(x{,}\ y{,}\ z\right) $$ exist?
So far I have solved for one case, that if all the coefficients $$ \alpha_1, \alpha_2, \alpha_3,  \beta_1, \beta_2, \beta_3 $$are non-zero, then the limit exists, if vectors $$\left(\alpha_1{,}\ \alpha_2{,}\ \alpha_3\right)\ \mathrm{and}\ \left(\beta_1{,}\ \beta_2{,}\ \beta_3\right) $$  are linearly dependent.
What about other cases, if I can't assume that all coefficients are non-zero? I may however assume, that there exists at least one non-zero coefficient β (for the the divisor not to be equal to zero) , and in this particular case which I am interested in, that there exists at least one non-zero coefficient α.

A: Suppose $f(x,y,z)$ converges to some number $\lambda$ as $(x,y,z)\to(0,0,0)$.
Then taking $y=0=z$ and $x\to0$, we get $$\lambda=\lim_{x\to0}\frac{\alpha_1x}{\beta_1x}=\frac{\alpha_1}{\beta_1}$$
Similarly, taking $y\to0$ and $z\to0$ keeping the other coordinates zero, we get $$\lambda=\frac{\alpha_2}{\beta_2}=\frac{\alpha_3}{\beta_3}$$
Hence $\alpha_i=\lambda\beta_i$.
Conversely, if $(\alpha_1,\alpha_2,\alpha_3)=\lambda(\beta_1,\beta_2,\beta_3)$ then $f(x,y,z)=\lambda$ is constant, so it obviously converges as $(x,y,z)\to0$.


text:
Q: Objective C casting Class structure pointer to a concrete class In Objective C, there's a Class structure which acts as a pointer to any class implementations you have. In Objective C, it's defined as:
typedef struct objc_class *Class;

I'm trying to have a array of Classes and I'm trying to iterate through the Class array and perform static functions. Some sample code below:
//Each class is subclassed from the same abstract class with a function specialStaticFunction
NSArray *array = [[NSArray alloc] initWithObjects:Class1, Class2, Class3];

for(Class tempClass in array)
    [tempClass specialStaticFunction];
}

When running that code, I get warning because not every Class has a function called specialStaticFunction. So I want to know how to cast a Class or how else someone might circumvent this warning.

A: Use id instead of Class here
for(id tempClass in array)

This should remove the warnings from the compiler, but you still need to ensure each object implements that method otherwise your app will crash.


text:
Q: InputMismatchException in my Java code The code below tries to read membershipid and a choice of membership from user. user enter -1 to indicate end of program. system will now display sum and exit. I keept getting the error below which is very strange:
package task2;

import java.util.HashMap;
import java.util.Scanner;

public class Task2 {
    // i will make scanner class object accessible to current class

    static Scanner read = new Scanner(System.in);
    static HashMap<String, Double> storeMembers = new HashMap<>();
    static int choice;
    static String membershipID;
    static double amount;
    static double total;

    public static void displaySum() {
        for (Double sum : storeMembers.values()) {
            amount += sum;
        }
    }

    public static void main(String[] args) {
        System.out.println("Enter  MembershipID eg: JPU123D");
        System.out.println("For Standard Membership, Enter:  1");
        System.out.println("For Concession Membership,Enter: 2");

        while (read.hasNext()) {
            choice = read.nextInt();
            membershipID = read.nextLine();
            if (choice == 1) {

                if (storeMembers.containsKey(membershipID)) {
                    amount = Membership.standardMemberAnnualfee();
                    storeMembers.put(membershipID, amount);
                }
            } else {
                amount = Membership.standardMemberAnnualfee() + Membership.standardMemberjoinfee();
                storeMembers.put(membershipID, amount);
            }
            if (choice == -1) {
                System.out.println("Now closing the application!");
                System.out.println("Total fees:");
                displaySum();
                System.exit(1);
            }
        }// end while
    }
}

error says:
Exception in thread "main" java.util.InputMismatchException
    at java.util.Scanner.throwFor(Scanner.java:864)
    at java.util.Scanner.next(Scanner.java:1485)
    at java.util.Scanner.nextInt(Scanner.java:2117)
    at java.util.Scanner.nextInt(Scanner.java:2076)
    at task2.Task2.main(Task2.java:28)
Java Result: 1
BUILD SUCCESSFUL (total time: 8 seconds)

can any one tell me what am i doing wrong because my scanner object i believe is reading the correct input type.


text:
Q: SQL select remaining inventory rows I need help for my inventory table, this query should select the remaining rows from inventory table:
timestamp          Prod_id  Loc_ID  Price   Buy Sell
2017/2/21 12:24:00  50          A   10      1     0
2017/2/22 13:15:00  50          A   10      2     0
2017/2/23 14:00:00  50          A   12      0     2
2017/2/24 12:20:00  55          B   2       1     0
2017/2/25 10:04:00  55          B   2       1     0
2017/2/26 11:44:00  55          B   5       0     3
2017/2/27 15:22:00  60          C   3       5     0
2017/2/28 16:24:00  60          C   4       0     5

Select result should be this:
timestamp          Prod_id  Loc_ID  Price   Buy Sell
2017/2/22 13:15:00  50          A   10      1     0
2017/2/26 11:44:00  55          B   5       0     1

Here is the code for this table:
CREATE TABLE dbo.inventory
    (
      timestamp  DATETIME2 DEFAULT (getdate()) NOT NULL
    , Prod_id    INT NOT NULL
    , Loc_ID     nvarchar(3)
    , Price      INT NOT NULL
    , Buy      INT NOT NULL
    , Sell      INT NOT NULL
    )

INSERT INTO dbo.inventory
VALUES  ('2017-02-21 12:24:00',50,'A',10,1,0)

INSERT INTO dbo.inventory
VALUES  ('2017-02-22 13:15:00',50,'A',10,2,0)

INSERT INTO dbo.inventory
VALUES  ('2017-02-23 14:00:00',50,'A',12,0,2)

INSERT INTO dbo.inventory
VALUES  ('2017-02-24 12:20:00',55,'B',2,1,0)

INSERT INTO dbo.inventory
VALUES  ('2017-02-25 10:04:00',55,'B',2,1,0)

INSERT INTO dbo.inventory
VALUES  ('2017-02-26 11:44:00',55,'B',5,0,3)

INSERT INTO dbo.inventory
VALUES  ('2017-02-27 15:22:00',60,'C',3,5,0)

INSERT INTO dbo.inventory
VALUES  ('2017-02-28 16:24:00',60,'C',4,0,5)

Inventory2
this query should select the remaining rows from inventory table:
timestamp           ord_label   prod_id Loc_ID  price   buy sell
2017/2/22 12:24:00  30411           54  72      52      2   0
2017/2/23 12:24:00  30412           54  72      53      2   0
2017/2/24 12:24:00  30413           54  72      55      0   3
2017/2/25 12:25:00  30414           56  70      42      2   0
2017/2/25 12:34:00  30415           56  70      32      2   0
2017/2/26 12:24:00  30416           56  70      62      0   4
2017/2/27 13:34:00  30417           56  77      2       2   0
2017/2/27 14:24:00  30418           56  77      4       0   1
2017/2/27 14:25:00  30419           60  80      4       0   1

Result should be:
timestamp               ord_label   prod_id Loc_ID  price   buy sell
2017/2/23 12:24:00      30412       54      72      53      1   0
2017/2/27 13:34:00      30417       56      77      2       1   0
2017/2/27 14:25:00      30419       60      80      4       0   1

These are the most recent rows.
(SQL code)
CREATE TABLE dbo.inventory2
    (
      timestamp DATETIME2 DEFAULT (getdate()) NOT NULL
    , Ord_label INT NOT NULL
    , Prod_id   INT NOT NULL
    , Loc_ID    NVARCHAR (3)
    , Price     INT NOT NULL
    , Buy       INT NOT NULL
    , Sell      INT NOT NULL)

INSERT INTO dbo.inventory2
VALUES  ('2017-02-22 12:24:00',30411,54,'72',52,2,0)

INSERT INTO dbo.inventory2
VALUES  ('2017-02-23 12:24:00',30412,54,'72',53,2,0)

INSERT INTO dbo.inventory2
VALUES  ('2017-02-24 12:24:00',30413,54,'72',55,0,3)

INSERT INTO dbo.inventory2
VALUES  ('2017-02-25 12:25:00',30414,56,'70',42,2,0)

INSERT INTO dbo.inventory2
VALUES  ('2017-02-25 12:34:00',30415,56,'70',32,2,0)

INSERT INTO dbo.inventory2
VALUES  ('2017-02-26 12:24:00',30416,56,'70',62,0,4)

INSERT INTO dbo.inventory2
VALUES  ('2017-02-27 13:34:00',30417,56,'77',2,2,0)

INSERT INTO dbo.inventory2
VALUES  ('2017-02-27 14:24:00',30418,56,'77',4,0,1)

INSERT INTO dbo.inventory2
VALUES  ('2017-02-27 14:25:00',30419,60,'80',4,0,1)

A: Try this using conditional aggregations:
select case when sum(buy) > sum(sell) then max(case when buy > 0 then timestamp end) else max(case when sell > 0 then timestamp end) end as timestamp,
    prod_id,
    Loc_ID,
    case when sum(buy) > sum(sell) then max(case when buy > 0 then price end) else max(case when sell > 0 then price end) end as price,
    case when sum(buy) > sum(sell) then sum(buy) - sum(sell) else 0 end as buy,
    case when sum(sell) > sum(buy) then sum(sell) - sum(buy) else 0 end as sell
from dbo.inventory
group by prod_id,
    Loc_ID
having sum(buy) - sum(sell) <> 0;

Produces:

Demo
EDIT:
For the latest edit in the question, you can add another case statement in the select:
select case when sum(buy) > sum(sell) then max(case when buy > 0 then timestamp end) else max(case when sell > 0 then timestamp end) end as timestamp,
    case when sum(buy) > sum(sell) then max(case when buy > 0 then ord_label end) else max(case when sell > 0 then ord_label end) end as ord_label,
    prod_id,
    Loc_ID,
    case when sum(buy) > sum(sell) then max(case when buy > 0 then price end) else max(case when sell > 0 then price end) end as price,
    case when sum(buy) > sum(sell) then sum(buy) - sum(sell) else 0 end as buy,
    case when sum(sell) > sum(buy) then sum(sell) - sum(buy) else 0 end as sell
from dbo.inventory2
group by prod_id,
    Loc_ID
having sum(buy) - sum(sell) <> 0;

Produces:

Demo
How it works:
It takes the value from those row when has the sum greater out of sell or buy. If buy total is more than sell total, then , for e.g., we'll take max of ord_label from rows with non zero buy.


text:
Q: Using UpdateCursor for joined field in ArcPy? I have a huge point vector data (around 3 million point; in a gdb) with attributes and I have table (created with Near analysis.). I want to copy one of the field values to data. So I joined the table and tried the field calculator to do the trick, but after 16 hours I realized it just froze (it worked with similar data).
So the next that could work I think is the UpdateCursor. Unfortunately I got an Error: "TypeError: cannot update join table"
tried this:
field1 = '!temp_Features.leftd!'
field2 = '!leftt:NEAR_DIST!'

with this:
cursor = arcpy.da.UpdateCursor("layer2",(field1,field2))

this:
fields = ['temp_Features:leftd', 'leftt:NEAR_DIST']

with this:
cursor = arcpy.da.UpdateCursor("layer2",fields)

Same error every time.
(I have ArcGIS with advanced license)

A: Instead of messing with joins, which is a bit confusing and on the slow side, use a python dictionary and an update cursor. Iterate the table you would join, and store the join field values in your dictionary as your key, and the update value as your dictionary value. Then iterate your update table with an update cursor and use the dictionary to update the appropriate field. This will be faster than joining and using a field calculator.
Example code (untested):
#feature class to update
pointFc = r"C:\Some\data.gdb\featureclass"
#update field
updateFld = "UPDATE"
#update fc key field
IdFld = "KEYFIELD"

#join feature class
joinFc = r"C:\Some\data.gdb\joinfeatureclass"
#join value field to be transferred
joinValFld = "VALUE"
#join key field
joinIdFld = "KEYFIELD2"

import arcpy

#create dictionary
#Key: join field
#Value: field with value to be transferred
valueDi = dict ([(key, val) for key, val in
                 arcpy.da.SearchCursor
                 (joinFc, [joinIdFld, joinValFld])])

#update feature class
with arcpy.da.UpdateCursor (pointFc, [updateFld, IdFld]) as cursor:
    for update, key in cursor:
        #skip if key value is not in dictionary
        if not key in valueDi:
            continue
        #create row tuple
        row = (valueDi [key], key)

        #update row
        cursor.updateRow (row)

del cursor

A: Some time ago I've made this replacement of field calculator. Saved me awful amount of time:
import arcpy, traceback, os, sys
from arcpy import env
env.overwriteOutput = True
layoutFC=arcpy.GetParameterAsText(0)
joinFieldS=arcpy.GetParameterAsText(1)
sourseField=arcpy.GetParameterAsText(2)

destFC=arcpy.GetParameterAsText(3)
joinFieldD=arcpy.GetParameterAsText(4)
destField=arcpy.GetParameterAsText(5)

result=arcpy.GetCount_management(destFC)
nF=int(result.getOutput(0))
arcpy.SetProgressor("step", "", 0, nF,1)

try:
    def showPyMessage():
        arcpy.AddMessage(str(time.ctime()) + " - " + message)
    destFields=arcpy.ListFields(destFC)
    sTable=arcpy.da.TableToNumPyArray(layoutFC,(joinFieldS,sourseField))
    dictFeatures = {}
    for j,s in sTable:dictFeatures[j]=s
    with arcpy.da.UpdateCursor(destFC, (joinFieldD,destField)) as cursor:
        for j,s in cursor:
            arcpy.SetProgressorPosition()
            try:
                v=dictFeatures[j]
                cursor.updateRow((j,v))
            except: pass
except:
    message = "\n*** PYTHON ERRORS *** "; showPyMessage()
    message = "Python Traceback Info: " + traceback.format_tb(sys.exc_info()[2])[0]; showPyMessage()
    message = "Python Error Info: " +  str(sys.exc_type)+ ": " + str(sys.exc_value) + "\n"; showPyMessage()

Interface:

Please note if no join found for some record, value in calculated field kept unchanged.


text:
Q: Bilinear functional to be elementary Let $V$ be a $n$ dimensional vector space over $\Bbb C$. We say a functional $f:V\times V\to \Bbb C$ is bilinear if $f$ is linear in each variable if the other variable is fixed.
And $$f$$ is called elementary if there exists some $x,y\in V$ such that
$$f(u,v)=<x,u>\cdot <y,v>.$$
Here $<x,u>=x^*u$, $x^*$ is the conjugate transpose of $x$.
Now my problem is as follows. Let $x,y,z$ be three linearly independent vectors in $V$. What conditions on $w$ should satisfy to ensure the following functional
$$f(u,v)=<x,u>\cdot <y,v>+<z,u>\cdot <w,v>$$
to be elementary.
My first idea is as follows. If the above $f$ is elementary, then there exists some $a,b\in V$ such that
$$f(u,v)=<a,u>\cdot <b,v>.$$
And thus
$$<x,u>\cdot <y,v>+<z,u>\cdot <w,v>=f(u,v)=<a,u>\cdot <b,v>$$
Since $f$ is bilinear, we need only to find conditions on $w$ such that there exists some $a,b\in\Bbb C^n$ such that
$$\bar x_iy_j+\bar z_iw_j=\bar a_ib_j,\forall\ 1\leq i,j\leq n.$$
These are $n^2$ equations, but only with $2n$ variables, but I could not derive further..
I suspect that $w$ is a multiplier of $y$...
This is exercise I.4.1 of Bhatia: Matrix Analysis.

A: A necessary and sufficient condition is $w=\lambda y$.
If your functional is identically zero then it is elementary, thus let us assume that $f(u,v)$ is not identically zero.
Suppose $\langle a,u\rangle\langle b,v\rangle=\langle x,u\rangle\langle y,v\rangle+\langle z,u\rangle\langle w,v\rangle$.
Thus, $\langle a,u\rangle\langle b,v\rangle=\langle \langle v,y\rangle x,u\rangle+\langle \langle v,w\rangle z,u\rangle=\langle \langle v,y\rangle x+\langle v,w\rangle z,u\rangle$.
If $v\in\text{span}\{y,w\}^{\perp}$ then $\langle a,a\rangle\langle b,v\rangle=0$. But $\langle a,a\rangle\neq 0$ (otherwise $a=0$ and $f\equiv 0$) then $\langle b,v\rangle=0$ for every $v\in\text{span}\{y,w\}^{\perp}$. Thus, $b\in (\text{span}\{y,w\}^{\perp})^{\perp}=\text{span}\{y,w\}$.
If $y$ and $w$ are linear independent then exists
$0 \neq v'\in\text{span}\{y,w\}$ such that $b\perp v'$.
Now let $u=\langle v',y\rangle x+\langle v',w\rangle z$ and $v=v'$. Thus, $0=\langle a,u\rangle\langle b,v\rangle=\langle \langle v',y\rangle x+\langle v',w\rangle z,\langle v',y\rangle x+\langle v',w\rangle z\rangle$.
Therefore, $\langle v',y\rangle x+\langle v',w\rangle z=0$. Since $x,z$ are l.i. then $\langle v',y\rangle=\langle v',w\rangle=0$. This is a contradiction with $0 \neq v'\in\text{span}\{y,w\}$. Thus, $y,w$ are linear dependent.
Of course if $w=\lambda y$ then $\langle x,u\rangle\langle y,v\rangle+\langle z,u\rangle\langle w,v\rangle=\langle x+\lambda z,u\rangle\langle y,v\rangle$.


text:
Q: Ajax call never gets called in phonegap for android I searched similar questions but never found a proper answer. I am making app for multiple platforms using phonegap and JQM. I made index.html, which is "login page", with similar call. Index's call works, but the one below never gets called on my android device, even though it works both on chrome and safari.
I checked sever logs and there are no problems with "login", but as I said, there is no request from my android device when function below should be called.
    //document.addEventListener("deviceready", onDeviceReady, true);

$( document ).bind( "mobileinit", function(){
        $.support.cors = true;
        $.mobile.allowCrossDomainPages = true;
        $.mobile.loadingMessageTextVisible = true;
        $.mobile.showPageLoadingMsg();
        console.log('Page Started');
})

//var onDeviceReady = function(){

$( document ).ready(function (){
        console.log('Start');
        //$.support.cors = true;
        //$.mobile.allowCrossDomainPages = true;
        $.ajax({
        crossDomain: true,
        type: 'GET',
        url: 'http://ip/services/rest/contact/list',
        callback: 'jsonpCallback',
        jsonpCallback: 'jsonpCallback',
        jsonp: '_jsonp',
        contentType:  'application/json',
        dataType: 'jsonp json',
        timeout : 10000,

        success: function(data){

            var html ='';
            console.log('Success');
            $.each(data.response, function(key, value) {
            html += '

' + data.response[key].label + '

'+ data.response[key].customerName + '

' + data.response[key].phone + ', ' + data.response[key].email + '

';
            $('#ul_id').append($(html));
            html='';
            console.log('conatct');
            });
            $('#ul_id').trigger('create');
            $('#ul_id').listview('refresh');

        },
        error: function (xhr, ajaxOptions, thrownError){
            alert("Status: " + xhr.status + ", Ajax option: " + ajaxOptions + ", Thrown error: " + thrownError);
            //location.reload();
            console.log('Blad');
        },
    });
});

A: What is the access origin value in your Android project config.xml file ?
your value should be as below :
<access origin=".*"/>

A: There was a problem with placing script and specific way that jqm work.


text:
Q: Data Extension Lookup returns nothing I have a DE called content with the following 2 columns - language | text
I need it to return the text from the text column when the language is en
This is what I have, It validates and runs but does not return anything.
Can someone please tell me what I am missing?
%%[

var @DEColumn1, @lookupValue
set @lookupValue = "en"
set @DEColumn1 = Lookup("content", "text", "Language", @en)

]%%
DEColumn1 is %%=v(@DEColumn1)=%%

A: A Lookup allows you to pull over a single value from a data extension, since you'll need both values you will want to do a LookupRows and then pull the values out of the row.
Set @rows = LookupRows("content","Language",@lookupValue)
Set @row = Row(@rows,1)
Set @language = field(@row,"language")
Set @text = field(@row,"text")

A: You had it looking up @EN but that variable wasn't set.
Try this:
%%[
     var @DEColumn1, @lookupValue
     set @lookupValue = "en"
     set @DEColumn1 = Lookup("content", "text", "Language", @lookupValue)
]%%

DEColumn1 is %%=v(@DEColumn1)=%%


text:
Q: Matplotlib basemap toolkit install issue I'm having a really hard time installing Matplotlib Basemap toolkit can anyone help me with this...
I've followed these instructions:
basemap-1.x.x $cd geos-3.3.3
basemap-1.x.x/geos-3.3.3$ export GEOS_DIR=~/
basemap-1.x.x/geos-3.3.3 $./configure --prefix=$GEOS_DIR
basemap-1.x.x/geos-3.3.3 $make
basemap-1.x.x/geos-3.3.3$ make install

Now you need to change back to the basemap parent directory, and install basemap:

basemap-1.x.x/geos-3.3.3 $cd ..
basemap-1.x.x$ sudo python setup.py install

Everything has worked except the last line... to which I get the error message
ceciljames101@cecilLaptop:~/basemap-1.0.7$ sudo python setup.py install
python: can't open file 'setup.py': [Errno 2] No such file or directory

is setup.py a file that should be in the directory? or is this an install on my system that is wrong? any suggestions would be appreciated
these are the only files in the basemap directory:
API_CHANGES  Changelog  doc  examples  FAQ  geos-3.3.3  KNOWN_BUGS  lib

A: Visit the Matplotlib Basemap Toolkit User's Guide webpage. In the Matplotlib Basemap Toolkit User's Guide under the Installation heading, the first paragraph says: Download either Windows binary installers or source tarballs here. Follow the download link and download the basemap-1.0.7 file that is compatible with your operating system.
Open the basemap-1.0.7 archive and you will find the setup.py Python script for basemap-1.0.7 in the basemap-1.0.7 directory as it is marked by the mouse cursor in the screenshot:

A: If you are a Linux user then use following commands-
# Assuming that numpy, python3 and matplotlib is already installed.
sudo apt-get install proj-bin
sudo apt-get install libgeos-dev
sudo pip3 install --user https://github.com/matplotlib/basemap/archive/master.zip


text:
Q: How can I create a file as well as missing dirs along the path in linux system programatically? I want to create a file on linux system in my program, say /a/b/c/test, currently I only have dir /a exist and I want to do it in my program, is there any function that can create file as well as missing dirs (that is, create b/c/test) in one deal? open, fopen, mkdir all seem can't work if there are missing dirs along the path. Thank you.

A: From strace mkdir -p a/b/c:
mkdir("a", 0751)                        = 0
open("a", O_RDONLY|O_NOCTTY|O_NONBLOCK|O_LARGEFILE|O_DIRECTORY|O_NOFOLLOW) = 3
fchdir(3)                               = 0
close(3)                                = 0
mkdir("b", 0751)                        = 0
open("b", O_RDONLY|O_NOCTTY|O_NONBLOCK|O_LARGEFILE|O_DIRECTORY|O_NOFOLLOW) = 3
fchdir(3)                               = 0
close(3)                                = 0
mkdir("c", 0751)                        = 0

In other words, you have to call mkdir() yourself, in a loop per directory, then create the file. This is how the mkdir exe does it (in C). Why not run the mkdir -p /a/b/c command with execve? With C stuff set up for the call properly, of course.

A: I think you need two commands:
$ mkdir -p /a/b/c/ && touch /a/b/c/test

A: Sorry, you will have to be satisfied with a two-step process:
mkdir -p /a/b/c
touch /a/b/c/test

A: If you are using Glib (the lowest level library of Gtk, which can be used independently) you could just call g_mkdir_with_parents to make all the directories (like the mkdir -p command does)


text:
Q: Can't adjust USB-C audio master volume I've recently switched to using this USB-C cable for my Audio Technica headphones. I'm able to adjust the master fine when I use it on my Android phone, but in KDE and PAVUcontrol any reduction in volume causes it to mute.

My headphones are the one labelled 'UACDemoV1.0 Analogue Stereo'. Audio only plays when it is at 99% or 100%, although I am able to individually reduce the audio for each application using the playback tab. Strangely enough I'm able to change the master volume in ALSAMixer without this issue.


text:
Q: How to force portrait orientation? How to force portrait orientation in iOS 7 if my application is initially supported for both orientations?

A: For the entire app, open the project file, go to the General tab, change the settings:

Or directly on the Info.plist file:

If you only want it on a specific view controller, override supportedInterfaceOrientations:
- (NSUInteger)supportedInterfaceOrientations
{
    return UIInterfaceOrientationMaskPortrait;
}

You can read more about the second method at the official UIViewController documentation. Maybe, you'll find a more suitable way for your specific problem.

A: UIViewController *c = [[UIViewController alloc]init];
[self presentViewController:c animated:NO completion:nil];
[self dismissViewControllerAnimated:NO completion:nil];

A: Use Following approach :
In your app delegate .h
@interface PlayWithWSWithLibAppDelegate : NSObject <UIApplicationDelegate, UITabBarControllerDelegate> {

       BOOL flagOrientationAll;
}

@property (assign) BOOL flagOrientationAll;

Add following method in your app delegate .m file
- (NSUInteger)application:(UIApplication *)application supportedInterfaceOrientationsForWindow:(UIWindow *)window{
    //NSLog(@"PlayWithWSWithLibAppDelegate -- supportedInterfaceOrientationsForWindow");
    if(flagOrientationAll == YES){
        return UIInterfaceOrientationMaskPortrait;
    } else {
        return UIInterfaceOrientationMaskAll;
    }
}

Implement following way in your view which you want to rotate in both portrait and landscape both for iPhone device
-(void)viewWillAppear:(BOOL)animated
{
    self.tabBarController.delegate = self;

    PlayWithWSWithLibAppDelegate *delegate = (PlayWithWSWithLibAppDelegate *) [[UIApplication sharedApplication] delegate];
    delegate.flagOrientationAll = YES;
 }
}

-(void)viewWillDisappear:(BOOL)animated
{
    //NSLog(@"viewWillDisappear -- Start");
     PlayWithWSWithLibAppDelegate *delegate = (PlayWithWSWithLibAppDelegate *)[[UIApplication sharedApplication] delegate];
        delegate.flagOrientationAll = NO;
}

Here is my thread some what similar to your problem : iOS 7 Interface Orientation

A: #import <objc/message.h>

objc_msgSend([UIDevice currentDevice], @selector(setOrientation:), UIInterfaceOrientationLandscapeRight);//here you may change your desired Orientation


text:
Q: Getting absolute pathname of a file in c I'll describe the problem- I have a configuration file which has in its first line a path to a DIR-
char students_Dest[LINE_LENGTH];
FILE *f_Conf = fdopen(fd_Conf, "r");
fgets(students_Dest, DIR_LENGTH, f_Conf); //Getting the dest of the students DIR
So I wrote the line to the buffer
Now, I opened the DIR with
DIR *students_Dir = opendir(students_Dest);
And in this directory there are more directories that each one of them has a main.out executable.
So i Wrote this code
struct dirent *dir_Entry;
char real_Student_Path[128];
while((dir_Entry = readdir(students_Dir)) != NULL){
                if((strcmp(dir_Entry -> d_name , ".") == 0) || (strcmp(dir_Entry -> d_name, "..") == 0))
                        continue;
                printf("%s\n", dir_Entry->d_name);
                realpath(dir_Entry->d_name, real_Student_Path);
                printf("%s\n", real_Student_Path);

But when I print real_Student_Path I get the relative path + cwd of this prog, not students_Dest + dir_Entry String. I think that I didnt understand realpath, But I cant understand what exactly.
Could anyone help me? Thank You!


text:
Q: Why does FillingTransform not fill the enclosed areas on the edges in image FillingTransform
And this is what the result becomes:
I want to fill the squares in the edges as well, how can I do that?

A: It can take some experimentation to find which of the many image transforms to use. In this case, you could try WatershedComponents.
For an example with smaller images, I start with a portion of your image, converted to a binary image via Binarize.

WatershedComponents[image]//Colorize

which gives a color image of the components

If you prefer black and white, you can use the ColorRules option. In this case, component 2 is the one with the most pixels, corresponding to the background. So
Colorize[WatershedComponents[img],ColorRules->{2->Black, _->White}]

gives

A: img = Import["https://i.stack.imgur.com/dLeMW.jpg%5D"];
regs = ConnectedMeshComponents@ImageMesh@ColorNegate@img;
{regs // First, regs // Rest // RegionUnion}

A: On the full image, for the functions I tried MorphologicalComponents seems to resemble the original image the most. However there are thin black lines on the sides. These may be removed with ImageCrop :
Colorize[MorphologicalComponents[ColorNegate@Binarize@img],
ColorRules -> {2 -> Black, _ -> White}] // ImageCrop


text:
Q: How to start chrome driver using selenium-maven-plugin to start Selenium server I apologize first of all if this subject is being treated in another post but i have been looking for the solution like two days and I was not able to get it.
I have added a new profile to my POM in whick I use the selenium-maven-plugin:
<plugin>
    <groupId>org.codehaus.mojo</groupId>
    <artifactId>selenium-maven-plugin</artifactId>
    <version>2.3</version>
    <executions>
        <execution>
            <id>start</id>
            <phase>pre-integration-test</phase>
            <goals>
                <goal>start-server</goal>
            </goals>
            <configuration>
                <background>true</background>
                <debug>true</debug>
                <systemProperties>
                    <webdriver.chrome.driver>${webdriver.chrome}</webdriver.chrome.driver>
                </systemProperties>
            </configuration>
        </execution>
    </executions>
</plugin>

Them in properties I have added the path where chromedriver is placed.
When I execute mvn clean install, I get the following error:
org.openqa.selenium.WebDriverException: org.openqa.selenium.net.UrlChecker.waitUntilAvailable(Ljava/net/URL;JLjava/util/concurrent/TimeUnit;)V
Command duration or timeout: 434 milliseconds
Build info: version: '2.31.0', revision: '1bd294d185a80fa4206dfeab80ba773c04ac33c0', time: '2013-02-27 13:51:26'
System info: os.name: 'Mac OS X', os.arch: 'x86_64', os.version: '10.8.5', java.version: '1.6.0_51'
Driver info: org.openqa.selenium.remote.RemoteWebDriver
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
    at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
    at org.openqa.selenium.remote.ErrorHandler.createThrowable(ErrorHandler.java:187)
    at org.openqa.selenium.remote.ErrorHandler.throwIfResponseFailed(ErrorHandler.java:145)
    at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:554)
    at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:216)
    at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:111)
    at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:115)
    at com.qa.framework.drivers.multidevice.webdriver.MultiDeviceWebDriver.setWebDriver(MultiDeviceWebDriver.java:191)
    at com.qa.framework.drivers.web.WebDriver.launchBrowser(WebDriver.java:249)
    at com.qa.games.tests.BaseTest.beforeTestCase(BaseTest.java:38)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:80)
    at org.testng.internal.Invoker.invokeConfigurationMethod(Invoker.java:551)
    at org.testng.internal.Invoker.invokeConfigurations(Invoker.java:213)
    at org.testng.internal.Invoker.invokeMethod(Invoker.java:640)
    at org.testng.internal.Invoker.invokeTestMethod(Invoker.java:894)
    at org.testng.internal.Invoker.invokeTestMethods(Invoker.java:1219)
    at org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:127)
    at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:111)
    at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:895)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:918)
    at java.lang.Thread.run(Thread.java:680)
Caused by: java.lang.NoSuchMethodError: org.openqa.selenium.net.UrlChecker.waitUntilAvailable(Ljava/net/URL;JLjava/util/concurrent/TimeUnit;)V
    at org.openqa.selenium.chrome.ChromeDriverService.start(ChromeDriverService.java:150)
    at org.openqa.selenium.chrome.ChromeCommandExecutor.execute(ChromeCommandExecutor.java:48)
    at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:432)
    at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:140)
    at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:95)
    at org.openqa.selenium.chrome.ChromeDriver.<init>(ChromeDriver.java:107)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
    at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
    at org.openqa.selenium.remote.server.DefaultDriverFactory.callConstructor(DefaultDriverFactory.java:58)
    at org.openqa.selenium.remote.server.DefaultDriverFactory.newInstance(DefaultDriverFactory.java:52)
    at org.openqa.selenium.remote.server.DefaultSession$BrowserCreator.call(DefaultSession.java:197)
    at org.openqa.selenium.remote.server.DefaultSession$BrowserCreator.call(DefaultSession.java:184)
    at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
    at java.util.concurrent.FutureTask.run(FutureTask.java:138)
    at org.openqa.selenium.remote.server.DefaultSession$1.run(DefaultSession.java:151)
    ... 3 more

If instead of indicate the place of the webdriver there I add in the code: System.setProperty("webdriver.chrome.driver",  "/Users/support/Desktop/Google Chrome.app/Contents/MacOS/chromedriver.exe" );, then is returning that webdriver.chrome.driver property is not defined.
I have tried as well execute mvn clean install -Dwebdriver.chrome.driver="path/chromedriver" as as well is returning the same error.
I have tried setting the chromedriver in different paths, without .exe and with .exe.
I don't know what I'm missing, even I'm starting to think that this doesn't have any solution because if I execute my tests having selenium started by means of the following command line: java -jar /path/selenium-server-standalone-2.37.0.jar -Dwebdriver.chrome.driver=/path/chromedriver", my tests are working. I just would like not be pending on if selenium is running or not to execute my tests, but it seems it is not possible.
I would appreciate a lot if someone of you can help me on that.

A: The selenium maven plugin has been dead for over two years.
http://mvnrepository.com/artifact/org.codehaus.mojo/selenium-maven-plugin/2.3
Try running with a much older version of selenium (e.g., downgrade from 2.37.0 to 2.21.0).


text:
Q: Server controls in an asp.net repeater Seems like I've ran into a wall here. I want some datasource to be bound to an asp.net repeater (well, doesn't have to be a repeater, but it seems like that's what I want). Now, here's the catch: I also need some server-controls inside that repeater for updating the data (TextBox'es and buttons).
To my understanding, this aint really possible to do in an orderly manner? I can't just add a textbox to the itemtemplate, and then fetch it later on in the code-behind it seems. At least not easily. Are there any known techniques for this kind of problem?
I can't use a gridview, since the data needs to be formatted in a certain way.

A: If you don't want to use an ItemCommand and want to just loop through the Repeater's items collection, so you have one "save" button at the bottom of the page, you can do it like this:
foreach(RepeaterItem itm in MyRepeater.Items)
{
     TextBox t = (TextBox)(itm.FindControl("TextBox1"));
     // do something with it.

}

Of course, you'll need to make sure that the TextBox1 in the ASPX has the Runat="Server" attribute.

A: You can use the Repeater.ItemDataBound Event to locate controls nested in a Repeater.
<asp:Repeater ID="Repeater1" Runat="server" OnItemDataBound="Repeater1_ItemDataBound">
   <ItemTemplate>

<asp:TextBox ID="TextBox1" runat="server" />

   </ItemTemplate>
</asp:Repeater>

Then in code behind:
protected void Repeater1_ItemDataBound(object source, RepeaterCommandEventArgs e)
{
   if (e.Item.ItemType != ListItemType.Item && e.Item.ItemType !=
      ListItemType.AlternatingItem)
      return;

   TextBox textBox1 = e.Item.FindControl("TextBox1") as TextBox;
   if (textBox1 != null)
   {
   // do something with it
   }
}

A: Seems like my problem was in the way I was thinking :)
My solution:
I just added controls as I normally would do, but inside the ItemTemplate. On callback events of the controls, I'd go for:
(Button example)
protected void btnUpdate_OnClick(object sender, EventArgs e)
    {
        Button b = sender as Button;
        if (b != null)
        {
            RepeaterItem ri = b.Parent as RepeaterItem;
            if (ri != null)
            {
                string name = null;

                //Fetch data
                TextBox txtName = ri.FindControl("txtName") as TextBox;

.. etc..
So, after finding the RepeaterItem i just treat it as I would with any ControlGroup. Doesn't matter that I actually got 5 different textbosses, coded with ID="txtName", since asp.net automagically gives the controls "obfuscated" names in the client markup, and translates this back to my ID's on postback.
Hope this helps someone, and sorry for bothering :)


text:
Q: Store Custom Class in DataGridView Column How do I store an object (class) with a DataGridView row?  I cannot set the DataGridView.DataSource to the List(Of Class) because the class has properties that are classes.
Perhaps I am wrong, but something like:
    Dim objObject As New Person
    objObject = DataGridView.SelectedRows(0).Cells(5).Value

Seems cleaner (and more desirable) than:
    Dim intId As Integer
    intId = DataGridView.SelectedRows(0).Cells(5).Value
    For Each obj As Object In lstObject
        If obj.ID = intId Then
            objObject = obj
        End If
    Next

I have searched around, and it seems as though I may have to create a custom DataGridViewColumn for this.  Is that the case, or is there some easier/built-in way?
Although perhaps I am over-thinking it, and should just go with the second method.

A: I would suggest three possible options:

*

*Create a Dictionary with the rows as the keys and the source items as the values.

*Assign the source items to the Tag properties of the corresponding rows.

*Create a wrapper class that exposes the appropriate properties regardless of how deep they are and then bind a list of those.


text:
Q: Send checkbox value from child popup to parent I'm trying to send the value of a checkbox back on a child popup back to its parent. I can do this with text boxes but not with the check box. This is what I have
var chkSiteVisitRequired = opener.document.getElementById('chkSiteVisit')

if (document.getElementById('<%= chkSiteVisit.ClientID %>').checked)
            chkSiteVisitRequired.checked = true;

A: Please have a look at the example below.You can just copy and paste it inside a new .aspx page and it will work.Step through the javascript code and understand how it works then apply to your problem:
<head runat="server">
    <title></title>
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.3/jquery.min.js"></script>
    <script type="text/javascript">
        $(function () {
            $("#checkState").click(function () {
                var chkSiteVisitRequired = document.getElementById('<%= chkSiteVisit.ClientID %>');

                if (chkSiteVisitRequired.checked)
                    alert('checked');
                else
                    alert('not checked');
            });
        });
    </script>
</head>
<body>
    <form id="form1" runat="server">
        <asp:CheckBox ID="chkSiteVisit" runat="server" />
        <input id="checkState" type="button" value="Check State" />
    </form>
</body>


text:
Q: Wordpress/htaccess - allow access to subdirectory I have a subdirectory (app) I want to access that is in the root folder of my wordpress site. I have looked here:
https://wordpress.stackexchange.com/questions/20152/cannot-access-non-wordpress-subdirectories-as-wordpress-overrides-them-with-a-40
I have tried the solutions and nothing worked.
I also tried adding a separate .htaccess file to the app subdirectory that looks like this:
DirectoryIndex index.php index.html index.htm
Options +Indexes

But it didn't seem to help:
The main .htaccess I am trying with now looks like this:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_URI} ^/app/(.*)$ [OR]
RewriteRule ^.*$ - [L]
</IfModule>

# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]

</IfModule>

# END WordPress

I get a 404 error.
What am I doing wrong? If I am viewing the site on an iPhone, is clearing the safari history on the phone enough to refresh the data so it recognizes the new .htaccess? Thanks.
UPDATE
I added:
<Directory "/home/eamondev/public_html/subconscious/">
    Options All
    AllowOverride All
    Require all granted
</Directory>

to a .conf file that gets Includeed in httpd.conf, restarted apache, but didn't help.
I also tried:
<Directory "/home/eamondev/public_html/subconscious/">
    AllowOverride All
</Directory>

and it didn't work, I'm not sure if I only need AllowOverride All - either way this doesn't seem to help.
UPDATE
In a .conf file that is Included in httpd.conf, I tried:
<VirtualHost 162.241.180.99:80>
    ServerName eamondev.com
    DocumentRoot /home/eamondev/public_html

    <Directory "/home/eamondev/public_html/">
      AllowOverride All
    </Directory>
</VirtualHost>

but it didn't help.
Is there any reason I shouldn't just make another subdomain on my server and host the files out of there so reaching them doesn't conflict with my wordpress site?

A: Use below code i think it will work.
<IfModule mod_rewrite.c>
RewriteEngine On

# Map http://www.example.com to /app.
RewriteRule ^$ /app/ [L]

# Map http://www.example.com/x to /app/x unless there is a x in the web root.
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !^/app/
RewriteRule ^(.*)$ /app/$1

# Add trailing slash to directories within app
# This does not expose the internal URL.
RewriteCond %{SCRIPT_FILENAME} -d
RewriteRule ^app/(.*[^/])$ http://www.example.com/$1/ [R=301]
</IfModule>

A: Turns out, my domain hadn't propagated yet, so it wasn't possible to see/test any of the changes I was making. Before I realized that it was still propagating, I also thought to just create another subdomain and host the files I needed to from there.


text: Q: Is there a way to add a one-time-run window in a Qt Project? I'm new to Qt, and I want to design a GUI for an embedded system. My idea is to have a "initial settings" window, when the application runs for the first time. Is there a way I can do that?


text:
Q: How to map properly a many-to-one relationship with @IdClass? I wanted to create a table in Hibernate with a composed Primary key. One part of the Primary key is an auto-generated value and the other part references the Primary key of another table in a many-to-one relationship.
I didn't use @EmbeddedId because I didn't manage to make work the auto-generation inside the @Embeddable class. So finally I decided to use the @IdClass.
After some Research I came up with the next code:
@Entity
@IdClass(PartidaId.class)
@Table(name = "partida", schema="trueskill")
public class Partida implements Serializable {

    private static final long serialVersionUID = 659832134987666699L;

    @Id
    @GeneratedValue
    @Column(name ="partida_id")
    private Integer partida_id;

    @Id
    @Column(name = "jugador_id", insertable = false, updatable = false)
    private Integer jugador_id;

    @ManyToOne(fetch = FetchType.LAZY)
    @JoinColumn(name = "jugador_id", referencedColumnName = "id")
    private Jugador jugador;

    @Column(name = "PUNTOS")
    private int puntos;

    ....
}

public class PartidaId implements Serializable {

    private static final long serialVersionUID = 997366452999076354L;

    private Integer jugador_id;
    private Integer partida_id;
    ...
}

It compiles correctly but when I try to persist one Entity:
Jugador p1 = new Jugador("Player1");
Partida part1 = new Partida(7, p1);
em.persist(p1);
em.persist(part1);

I receive the following error:
17:54:31,369 DEBUG [org.hibernate.SQL] - insert into trueskill.partida (jugador_id, PUNTOS, partida_id) values (?, ?, ?)
17:54:31,374 TRACE [org.hibernate.type.descriptor.sql.BasicBinder] - binding parameter [1] as [INTEGER] - [1]
17:54:31,374 TRACE [org.hibernate.type.descriptor.sql.BasicBinder] - binding parameter [2] as [INTEGER] - [7]
17:54:31,374 TRACE [org.hibernate.type.descriptor.sql.BasicBinder] - binding parameter [3] as [INTEGER] - [null]
17:54:31,374 TRACE [org.hibernate.type.descriptor.sql.BasicBinder] - binding parameter [4] as [INTEGER] - [4]
17:54:31,390 WARN  [org.hibernate.engine.jdbc.spi.SqlExceptionHelper] - SQL Error: 20000, SQLState: XCL14
17:54:31,390 ERROR [org.hibernate.engine.jdbc.spi.SqlExceptionHelper] - Die Spaltenposition '4' befindet sich außerhalb des Bereichs. Die Anzahl der Spalten für dieses ResultSet liegt bei '3'.
17:54:31,392 ERROR [org.hibernate.internal.ExceptionMapperStandardImpl] - HHH000346: Error during managed flush [org.hibernate.exception.GenericJDBCException: could not insert: [model.Partida]]

The problem is that it tries to insert one extra "null" parameter, when there should be only 3. Could someone tell me why is this happening?
Thank you in advance!

A: You dont need the integer jugador_id in the partida entity. You probably have an @Id in the jugador entity maped in a @oneToMany relation with the partida class.
Delete from Partida:
@Id
@Column(name = "jugador_id", insertable = false, updatable = false)
private Integer jugador_id;

Use this in Partida entity:
@Id
@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "jugador_id", referencedColumnName = "id")
private Jugador jugador;

Make sure you have something like in your Jugador class.
@OneToMany(fetch = FetchType.LAZY)
@JoinColumn(name = "partida", referencedColumnName = "partida_id")
private Partida partida;

As I said in the answer, you must have this code in the entity Jugador :
@Id
@Column(name = "jugador_id", insertable = false, updatable = false)
private Integer jugador_id;


text:
Q: In Salesforce Lightning client side is stateful and server side is stateless, what does this actually means? I know a bit about stateful and stateless web services but how does it work in salesforce lightning?

A: From Salesforce documentation (https://www.salesforce.com/blog/2016/05/inside-lightning-components-the-fastest-way-to-build-apps.html):

The Lightning Component framework uses a stateful client and stateless server architecture that relies on JavaScript on the client side to manage UI component metadata and application data. The client calls the server only when necessary, and the server only sends data that is needed by the user to maximize efficiency. Using JSON to exchange data between the server and the client, the framework intelligently utilizes your server, browser, devices, and network so you can focus on the logic and interactions of your apps.

Stateless server - that's why @AuraEnabled actions should be defined as static method (not instance methods). They receive a request, process it, and return a response.


text:
Q: Haskell-Stack error: "The same package name is used in multiple local packages" I have two different Haskell projects on my machine, and each uses the WordNet package. When installing WordNet from Hackage the build failed, however the package did build successfully when cloned and installed locally from github.
In each of my two projects, I point to the local installation in the stack.yaml file as described in the "packages and extra-deps" section of stack's documentation. The first project builds successfully. However, when I attempt to build the second project using this local dependency, I get the following error.
$ stack build
The same package name is used in multiple local packages

WordNet used in:
- PLIndex "WordNet-1.1.0"
- PLOther (PLFilePath "../WordNet-ghc74")

Why can I not depend on the same local package in two different projects?
Is there some way around this?

I have tried both cloning the package locally and pointing there in stack.yaml,
packages:
- .
- ../WordNet-ghc74

and also pointing to the repository directly on github in my stack.yaml.
packages:
- .
- location:
    git: http://github.com/mherzl/WordNet-ghc74.git
    commit: 35478c4ee8ce3fcb7b134901255818408fb934a1
  extra-dep: true

A: You can use the same local package in multiple projects. This looks like you have both WordNet-1.1.0 and the local file path listed in your packages / extra-deps.  If this is not the case, then please open an issue on the stack issue tracker with a reproduction of the problem.  Also, please ensure that you are on the latest stable version of stack (1.6.3)


text: Q: Можно ли как нибудь отключить «notify if debug session was finished without being paused» сразу для всех проектов, а не для одного? Эта функция выдает уведомления, если скрипт сайта отработал без остановки на точках останова. Мне не нравятся эти уведомления. В каждом проекте приходится отключать эту функцию. Можно ли как-нибудь отключить сразу для всех? В том числе и для тех, которые еще не существуют. То есть, они (проекты) будут создаваться с уже выключенной функцией.


text:
Q: How to use field name of one class in a method of another class, such that get compiler error if name changes I want to refer a field name in one class of java to another, such that I would get at least compiler error when someone changes the field name in base class.
Ex:
@Entity
class Employee {

    public String userId;
    public String timestampCreate;

}

class EmployeeReport {

    public Page<Employee> getEmployees() {

        return page = employeeJpaRepository.findAll(pageNumber, pageSize,
                Sort.by(Sort.Direction.DESC, "timestampCreate"));

    }

}

Here timestampCreate is the field name of Employee class.
I do not want to hardcode the column name; as it is bad practice and want it to be future proof, in case the field name changes.
i.e. for example if someone changes the column name 'timestampCreate' to 'timestamp', then at lease I would like to see some compiler error in the EmployeeReport class.
Please suggest an idea.
Thanks!
Note: My question is nowhere answered by the question they mapped and marked duplicate! I don't know why it was marked as duplicate and how to remove that!


text:
Q: Transaction Data I've got a dataset that contains purchase data and I'm stuck trying to figure something out. Before jumping into it, here is what my data looks like:
> df.f[df.f$CUST_ID == badIDs[1], c(1, 20, 4, 11, 13)]

CUST_ID CI2_TRANS_DT HR_SID NDS_AMT PROD_NUM
   1    2013-12-14     10    0.00    a5g4324
   1    2013-12-14     10    0.00    k4jn42k
   1    2013-12-14     10    0.00  f3ft52f3
   1    2013-12-14     10    0.00    f454fn
   1    2013-12-14     10    0.00    l2k41m
   1    2013-12-14     10    2.25  nb24b2x3
   1    2013-12-14     10    0.00    k1s4m6
   1    2013-12-14     10    0.00    1z34fl
   1    2013-12-14     10    0.95  f3ft52f3
   1    2013-12-17      6    4.45    v0d45j
   1    2013-12-17      6    0.00    a5g4324
   1    2013-12-17      6    4.75  g6b673va
   1    2013-12-17      6    0.00    f454fn
   1    2013-12-19      7   -4.75  bh431d11
   1    2013-12-20      6    4.75  bh431d11
   2    2013-12-14      6    4.75  g6b673va
   2    2013-12-15      6    3.75  nb24b2x3
   2    2013-12-15      6   -3.75  nb24b2x3
   2    2013-12-16      6    5.90  bh431d11

The above variables are the Customer ID Number, the Date of the Transaction, the Hour of the Day, the Sale Amount, and the Product Number, in that order. The problem I'm having is with the negative values of NDS_AMT. If the value is negative, I need to check to see if there is a corresponding purchase and if there is, then the negative value can stay in. If there is no corresponding purchase, then I need to remove that record from my data. As an example, the second to last record would need to be removed since it's negative and there is no corresponding purchase for that same day. The same product is purchased the next day, but since they're on two different visits they can't be counted as corresponding purchases.
I've tried thinking about how to do this and have considered embedded apply functions, intersect functions or duplicate functions, but regardless of the function I can't grasp how to write the code. Any help would be greatly appreciated.
EDIT: Per Henrik's request, I have added four new rows to the data for a new customer that has a negative NDS_AMT where the record should stay in the data. The conditions for a "corresponding purchase" are that the CUST_ID, CI2_TRANS_DT, HR_SID and PROD_NUM values must all match those of the records where the NDS_AMT is less than 0.

A: So here is the solution I've come up with. Obviously feel free to suggest tweaks as you see fit.
refundRecords <- df.f[df.f$NDS_AMT < 0, ]
refundRecords$NDS_AMT <- refundRecords$NDS_AMT * -1
dups <- apply(refundRecords, 1, function(x) apply(df.f[df.f$CUST_ID == x[1], ], 1, function(y) sum(x %in% y)))
id2check <- sapply(dups, function(x) any(x == 5))
badIDs <- unique(df.f$CUST_ID[rownames(df.f) %in% names(id2check[!id2check])])
df.f <- df.f[df.f$NDS_AMT >= 0 | !(df.f$CUST_ID %in% badIDs), ]


text:
Q: c++ Array setters and getters I need help with making setters and getters in c++ for these variables.
char name[20];
    double homeworkGrades[6];
    double quizGrades[6];
    double examGrades[4];

A: Requesting setters and getters imply that you have a class with data members you want to encapsulate. Here's an example:
class Student
{
public:
    explicit Student( std::string name )
        : _name{ std::move( name ) }
    {}

    std::string GetName() const { return _name; } // Getter only; set at construction time

    double GetHomework( int index ) const
    {
        return _homework.at( index ); // Throws if out of range
    }

    void SetHomework( int index, double grade )
    {
        _homework.at( index ) = grade;
    }

    // ...

private:
    const std::string     _name;
    std::array<double, 6> _homework;
    // ... etc.
};

The Student class has getters and setters for its properties. The advantage is that you can do error checking (here done with the std::array::at() function for range checking), thread protection, file/network I/O, caching, etc.


text:
Q: soft keyboard doesn't appear on ListView element (EditBox) I know this question have one million answers but nothing works for my case. I have a custom dialog that contains ListView, and custom elements TextView and EditText.
    public static void createDialog(Context context, Activity activity) {
    AlertDialog.Builder alertDialog = new AlertDialog.Builder(context);
    LayoutInflater inflater = activity.getLayoutInflater();
    View convertView = inflater.inflate(R.layout.custom_simple_dialog_layout, null);
    alertDialog.setView(convertView);

    final ListView listView = (ListView) convertView.findViewById(R.id.dialog_listView);

    //myCustomObjList - contains strings for TextView and strings for EditTet hint
    ListAdapter adapter = new DialogListAdapter(context, myCustomObjList);
    listView.setAdapter(adapter);

    AlertDialog myAlert = alertDialog.create();
    myAlert.setCancelable(false);
    myAlert.show();
}

I use BaseAdapter:
public class DialogListAdapter extends BaseAdapter {

    private Context context;
    private static List<MyObj> myCustomObjList = null;
    private static LayoutInflater inflater = null;

    public DialogListAdapter(Context context, List<MyObj> myCustomObjList) {
        this.context = context;
        this.myCustomObjList = myCustomObjList;
        inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
    }

    @Override
    public int getCount() {
        return myCustomObjList.size();
    }

    @Override
    public Object getItem(int position) {
        return myCustomObjList.get(position);
    }

    @Override
    public long getItemId(int position) {
        return position;
    }

    @Override
    public View getView(int position, View view, ViewGroup parent) {
        if (view == null)
            view = inflater.inflate(R.layout.custom_dialog_element, null);

        TextView titleTxt = (TextView) view.findViewById(R.id.dialog_element_title);
        titleTxt.setText(myCustomObjList.getTxtx());

        EditText elementEditTxt = (EditText) view.findViewById(R.id.dialog_edit);
        elementEditTxt.setHint(myCustomObjList.getTxtHint());

        return view;
    }}

I was trying:
set in xml:
    <EditText>
    <requestFocus />
</EditText>

programaticaly:
  edittext.requestFocus();

force SoftKeyboard to appear:
 InputMethodManager mImm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
 mImm.showSoftInput(SearchEdit, InputMethodManager.SHOW_IMPLICIT);

even
    edittext.setFocusable(true);
edittext.setOnFocusChangeListener(new View.OnFocusChangeListener() {
   @Override
   public void onFocusChange(View v, boolean hasFocus) {
       if (hasFocus)
           mImm.showSoftInput(SearchEdit, InputMethodManager.SHOW_IMPLICIT);
       else
           mImm.hideSoftInputFromWindow(edittext.getWindowToken(), 0);
   }
});

I suppose that problem is somewhere else...
ps original solutions src

A: Dunno whether it works or not anyway try this
in you code change like this and give a try
 AlertDialog myAlert = alertDialog.create();
myAlert.getWindow().setSoftInputMode (WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_VISIBLE);


text:
Q: Is Asynchronous NSURLconnection in anyway helpful for real time update or sending constant request to the server in an iOS app? I'm very much new to objective C. I have a case where I need to send request to the server URL at regular intervals. I made a asynchronous URL connection and used a NSTimer function to call the viewWillAppear function.
 - (void)viewWillAppear:(BOOL)animated
  {
       [super viewWillAppear:animated];
       NSURLRequest *request = [NSURLRequest requestWithURL:[NSURL    URLWithString:@"myurl/test.csv"] cachePolicy:NSURLRequestUseProtocolCachePolicy timeoutInterval:15.0];

       NSURLConnection *connection= [[NSURLConnection alloc] initWithRequest:request delegate:self];

       if(connection){
          label.text = @"connecting...";
        }else{
         //
        }

    }

 -(void)connection :(NSURLConnection *) connection didReceiveData:(NSData *)data{
     [self viewWillAppear:TRUE];
      response = [[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding];
      NSLog(response);
      }

I used the following NSTimer method to call the viewWillAppear method.
- (void)checkURLRequest
    {
     [self setProgressTimer:[NSTimer
                        scheduledTimerWithTimeInterval:(1.0f / 30.0f)
                        target:self
                        selector:@selector(viewWillAppear:)
                        userInfo:self
                        repeats:TRUE]];
    }

   - (void)setProgressTimer:(NSTimer *)theTimer
    {
    [_progressTimer invalidate];
     _progressTimer = theTimer;
    }

Is my approach even correct? Because when i updated the file 'test.csv' on the server, it can't do a live update as and when the file changes its still logging the old values in the file.

A: You should not call viewWillAppear: on your own, especially since it needs to call [super viewWillAppear:] which does things you don't know about. I can tell you from experience that calling these view controller methods yourself can lead to strange bugs that are very hard to debug.
So move your URL connection handling code into a separate method that you call with your timer and that you can also call in your viewWillAppear:, if you need to.

A: This is not the right approach, in fact you should never call those viewcontroller callback methods such as viewWillAppear. I am not exactly sure on what code is being executed on the viewWillAppear, but the correct way to do this, would be to move that code to another method and call that method instead.

A: I would move all the URL connection stuff outside the VC and into a custom class that does this using blocks.  This would allow you to use this in other classes and is better OO programming.  I can send you an example I use with image loading if you need it.


text:
Q: how to convert this curl command to PowerShell I am using PowerShell and want to convert this curl command in PowerShell. It works well in bash
curl -s -H 'X-AUTH-TOKEN:'09f4a92e8fbfc9f9f530771ac32d37a1'' -H "Content-Type: application/json" -X GET 'http://127.0.0.1/centreon/api/beta/monitoring/services?search=\{"service.state":"2","service.is_acknowledged":"0"\}'

Thanks for your help

A: Additional headers can be added to the -Headers property as hash table entries:
$result = curl -Uri $uri -ContentType application/json -Method Get -Headers @{'X-AUTH-TOKEN'='09f4a92e8fbfc9f9f530771ac32d37a1'}

You may want to try converting your uri string to type [System.URI]. This handles standard character replacement like ' ' to %20. I think curl does this already, but it may help you see if something is invalid:
$uri = [System.Uri]::new('http://127.0.0.1/centreon/api/beta/monitoring/services?search=\{"service.state":"2","service.is_acknowledged":"0"\}')

# check the output:
$uri.AbsoluteUri

http://127.0.0.1/centreon/api/beta/monitoring/services?search=%5C%7B%22service.state%22:%222%22,%22service.is_acknowledged%22:%220%22%5C%7D

A: Here is the solution which worked for me.
i have Changed {"service.state":"2","service.is_acknowledged":"0"\}to
==> {"service.state":"2","service.is_acknowledged":"0"}"
Thank you


text:
Q: Some basic questions regarding proportion terminology A question posed in a review assignment:

*

*Find the fourth proportional to $4,6$ and $8$
The answer is 12. Thus I guess we were supposed to solve $\frac{4}{8}=\frac{6}{12}$. So when the numbers are listed like this, is it common to assume that this means we are solving the proportion $4:8 \iff 6:12$? Or is this a poorly worded question? Perhaps it's standard terminology I'm not aware of


text:
Q: Group by on month from date in Oracle 11g I wanted to calculate the subtotals of ProductTypes by month, with a monthly total amount for all the products sold in the month, on Oracle 11g.
Schema:
PurchaseItem (PurchaseID:integer, Supplier:varchar(50),PurchaseType:varchar(20), PurchaseAmt:number, PurchaseDate:date)
So, I tried a query:

SELECT month(PurchaseDate) PurchaseMonth,
     CASE WHEN month(PurchaseDate) is null then 'Grand Total'
               ELSE coalesce (PurchaseType,'Monthly Total')
     end AS PurchaseType,
     Sum(PurchaseAmt) as SummorizedPurchaseAmt
FROM PurchaseItem
GROUP BY ROLLUP(month(PurchaseDate), PurchaseType);

But I am getting the error message:
ORA-00904: "MONTH": invalid identifier

I am expecting Month-wise sales for each productType

A: There's no month function in Oracle; extract it in some other way, e.g. using the to_char function (as in my example).
With some sample data:
SQL> with purchaseitem(purchasedate, purchasetype, purchaseamt) as
  2    (select date '2022-01-13', 'A', 10 from dual union all
  3     select date '2022-01-25', 'B', 20 from dual union all
  4     select date '2022-04-08', 'C', 30 from dual union all
  5     select date '2022-05-01', 'A', 10 from dual union all
  6     select date '2022-05-22', 'C', 50 from dual
  7    )

Query begins here:
  8  select
  9    to_char(purchasedate, 'mm') purchasemonth,
 10    case when to_char(purchasedate, 'mm') is null then 'Grand total'
 11         else coalesce(purchasetype, 'Monthly total')
 12    end purchasetype,
 13    sum(purchaseamt) summarized
 14  from purchaseitem
 15  group by rollup(to_char(purchasedate, 'mm'), purchasetype);

PU PURCHASETYPE  SUMMARIZED
-- ------------- ----------
01 A                     10
01 B                     20
01 Monthly total         30
04 C                     30
04 Monthly total         30
05 A                     10
05 C                     50
05 Monthly total         60
   Grand total          120

9 rows selected.

SQL>