text:
Q: async wcf service returning null Hi i am creating a async WCF service and consuming it in HTML application, but every time i am getting null from service. I am new in async methods so please guide me,I am sharing my code here:
Service.cs
public static async Task<string> GetTJSON()
{
 string responseData = string.Empty;
        using (var httpClient = new HttpClient())
        {
            using (var response = await httpClient.GetAsync("http://api.xyz.com/json/feeds?system=apios").ConfigureAwait(false))
           {
                responseData = await response.Content.ReadAsStringAsync();
                return responseData;
            }
        }
}

public async Task<string> getJ()
    {
        var json = await GetTJSON();
        return json.ToString();
}

Iservice.cs
[OperationContract]
[WebInvoke(Method = "GET", UriTemplate = "GetJsonNet1", ResponseFormat = WebMessageFormat.Json, RequestFormat = WebMessageFormat.Json, BodyStyle = WebMessageBodyStyle.Wrapped)]
Task<string> getJ();

HTML/Jquery
var GetJsonNet = function () {
        $.ajax({
            type: "GET",
            url: "http://localhost:59835/Service1.svc/GetJsonNet1",
            contentType: "application/json;charset=utf-8",
            dataType: "json",
            success: function (data) {
                var result = data.GetEmployeeJSONResult;
                console.log(result);
                var obj = $.parseJSON(result);
                alert('s:' + obj);
            },
            error: function (xhr) {
                alert('e:'+xhr.responseText);
            }
        });
    }


text:
Q: How do I define a nodejs variable using a function? I have found many variations of this question, but none seem to answer my question.  I read How do I define a nodejs variable using a function? among many other answers.  I tried all of the possible answers using an asynchronous call.  It is possible that the answer is in there, but I implemented it wrong.
I am able to get the console.dir command to work inside the function.  I am having trouble understanding how to get the console.dir function to work outside of the function.
I would like to set the variable "library" using the contents of a file using the nodejs function fs.readFile.  This is what I have, but it does not work.
This seems like such a simple problem, so I am certain I just do not understand callbacks or some universal concept.  I have been searching Stackoverflow and the web all day.
var library = fs.readFile('./library', function read(err, data) {
    if (err) {
        throw err;
    }

    return data
});

console.dir(library);

the return is:
undefined

redpajama_set_name: RedPajamaStackExchange


text:
Q: Julia macro for transforming `f(dim1,dim2,..) = value` into `f(value,dim1,dim2,..)` I am trying to write a Julia macro that transforms this:
[par1!( par2(d1,d2)+par3(d1,d2)   ,d1,d2,dfix3) for d1 in DIM1, d2 in DIM2]

(not very inspiring) into something much more readable, like this:
@meq par1!(d1 in DIM1, d2 in DIM2, dfix3) =  par2(d1,d2)+par3(d1,d2)

where par1!() is a function to set some multi-dimensional data and par2() is a getData()-type of function.
I am trying to implement it using a macro, but as I am on my first experience with julia marcro, I'm not sure how to "assemble" the final expression from the various pieces..
Here is what I done so far:
macro meq(eq)
   # dump(eq)
    lhs_par               = eq.args[1].args[1]
    rhs                   = eq.args[2]
    lhs_dims              = eq.args[1].args[2:end]
    loop_counters         = [d.args[2] for d in lhs_dims if typeof(d) == Expr]
    loop_sets             = [d.args[3] for d in lhs_dims if typeof(d) == Expr]
    loop_wholeElements    = [d for d in lhs_dims if typeof(d) == Expr]
    lhs_dims_placeholders = []
    for d in lhs_dims
        if typeof(d) == Expr
            push!(lhs_dims_placeholders,d.args[2])
        else
            push!(lhs_dims_placeholders,d)
        end
    end
    outExp =  quote
      [$(lhs_par)($(rhs),$(lhs_dims_placeholders ...)) for  $(loop_wholeElements ...) ]
    end
    #show(outExp)
    return outExp
end

However the above macro doesn't compile and returns a syntax error ("invalid iteration specification") due to the for $(loop_wholeElements) part… indeed I don't know how to treat the expressions in lhs_dims_placeholders and loop_wholeElements in order to "assemble" the expanded expression…
EDIT:
The example posted, with d1, d2 and dfix3, is only a specific case, but the macro should be able to handle whichever dimensions are looped for..
I think the macro up there does that, but I don't know how to build the final expression.. :-(

A: Instead of manually doing those hard-coded args matching stuff, we could use MacroTools.jl as a handy tool for template matching:
julia> using MacroTools

julia> macro meq(ex)
           @capture(ex, f_(d1_ in dim1_, d2_ in dim2_, dfix3_) = body__)
           ret = :([$f($(body[]), $d1, $d2, $dfix3) for $d1 in $dim1, $d2 in $dim2])
       end
@meq (macro with 1 method)

julia> prettify(@macroexpand @meq par1!(d1 in DIM1, d2 in DIM2, dfix3) =  par2(d1,d2)+par3(d1,d2))
:([(Main.par1!)((Main.par2)(lobster, redpanda) + (Main.par3)(lobster, redpanda), lobster, redpanda, Main.dfix3) for lobster = Main.DIM1, redpanda = Main.DIM2])

UPDATE:
The desired final expression is a comprehension, it seems that for some reason Julia couldn't figure out for expr(where $expr #=> XXX in XXX) is a comprehension. The workaround is directly using its lowered form:
julia> using MacroTools

julia> par1(a, b, c, d) = a + b + c + d
par1 (generic function with 1 method)

julia> par2(a, b) = a + b
par2 (generic function with 1 method)

julia> macro meq(ex)
           @capture(ex, par_(dims__) = rhs_)
           loopElements = []
           dimsPlaceholders = []
           for d in dims
               @capture(d, di_ in DIMi_) || (push!(dimsPlaceholders, d); continue)
               # push!(loopElements, x)
               push!(loopElements, :($di = $DIMi))
               push!(dimsPlaceholders, di)
           end
           ret = Expr(:comprehension, :($par($(rhs),$(dimsPlaceholders...))), loopElements...)
       end
@meq (macro with 1 method)

julia> prettify(@macroexpand @meq par1!(d1 in DIM1, d2 in DIM2, dfix3) =  par2(d1,d2)+par3(d1,d2))
:($(Expr(:comprehension, :((Main.par1!)(begin
            (Main.par2)(bee, wildebeest) + (Main.par3)(bee, wildebeest)
        end, bee, wildebeest, Main.dfix3)), :(bee = Main.DIM1), :(wildebeest = Main.DIM2))))

julia> @meq par1(m in 1:2, n in 4:5, 3) =  par2(m,n) + par2(m,n)
2×2 Array{Int64,2}:
 18  21
 21  24

Note that, the variable scope of d1,d2 in generated expression will be  wrong if we use push!(loopElements, x) rather than push!(loopElements, :($di = $DIMi)). Let's wait for someone knowledgeable to give a thorough explanation.

A: If you do not want to rely on an external package for this, the solution I provided on the Julia discourse should also work
return :([$(Expr(:generator,:($(Expr(:call,lhs_par,rhs,lhs_dims_placeholders...))),loop_wholeElements...))])

The key is to use the :generator constructor to make the loop expression
Also, rhs can be replaced with rhs.args[n] in order to eliminate the quote block and insert the expression directly.
This then produces the exact expression:
:([(par1!(par2(d1, d2) + par3(d1, d2), d1, d2, dfix3) for d1 in DIM1, d2 in DIM2)])

EDIT:
Alright, so I went ahead and tested this:
return Expr(:comprehension,Expr(:generator,Expr(:call,lhs_par,rhs.args[2],lhs_dims_placeholders...),loop_wholeElements...))

end
Then computing the result like this
meq(:(par1!(d1 = 1:2, d2 = 1:2, 3) =  par2(d1,d2)+par3(d1,d2))) |> eval


text:
Q: Array with words separated by comma with jQuery My array looks like this:
["colors,cars,boks"]

What I need is this:
["colors","cars","books]

This is what i've tried:
$.makeArray(my_arr)

A: Try:

var str = ["colors,cars,boks"];
    var res = str[0].split(",");
    console.log(res);


text: Q: Redirect Facebook notifications to messenger.com instead of facebook.com When I receive a new notification concerning a new message on Facebook, clicking the notification will take me to Facebook site. Is there a way to make these notification go to messenger.com instead? It loads faster, and I generally prefer it to using Facebook's site.


text:
Q: using pom for test scope dependencies Is it possible to create a pom file so it can be used inside another pom to add test scope dependencies?
So in module E's pom.xml I have:
<dependencies>
  <dependency>
    <groupId>com.example</artifactId>
    <artifactId>D</artifactId>
    <type>pom</type>
    <scope>test</scope>
  </dependency>
</dependencies>

So that if D's pom.xml contains dependencies on artifacts A, B, C, then these artifacts are in the compilation and execution classpath of E's tests.
NOTE: the reason I want such a pom, and not rely on regular dependency resolution is that I have created a tests jar using maven-jar-plugin:test-jar and using that jar as a dependency causes maven to not use its transitive dependencies. (see http://jira.codehaus.org/browse/MNG-1378)
UPDATE: this does not work for me (maybe because I'm trying to use it for the test scope): http://www.sonatype.com/books/mvnref-book/reference/pom-relationships-sect-pom-best-practice.html

A: Apparently this is not possible: http://jira.codehaus.org/browse/MNG-2975


text:
Q: how to echo at the end of a loop? Problem :
I have a variable which is defined inside a while loop. I build this variable and at the end I'd like to echo it. Like this :
function removeCarriageReturn()
{
  word=""

  echo "${1}" | while IFS= read -r -n1 char ; do
    if [ "${char}" != $"\r" ] ; then
      word="${word}${char}"
    fi
  done && echo ${word}
}

I don't know how to do it. If I do the echo after, word is empty because the while is like a sub shell.

A: Are you using bash? It looks like you are, based on the function declaration and the $'\r'. If so, there's a quite simple solution:
function removeCarriageReturn()
{
  local word

  while IFS= read -r -n1 char ; do
    if [ "${char}" != $"\r" ] ; then
      word="${word}${char}"
    fi
  done <<<"$1" && echo "$word"
}

Here I'm using a bash here string <<< to pass the value to the loop, rather than using echo with a pipe. It is the use of a pipe that is causing your loop to be run within a subshell.
As an aside, using braces around variables (e.g. ${word}) can be useful in some places but doesn't actually protect you from word splitting or glob expansion. It's best to quote your variables (i.e. use "$word" instead). Even in a seemingly benign case such as echo ${word}, you may be caught out if there's a * within the word, for example.
Better yet, use printf '%s\n' "$word", for the reasons mentioned in Charles' comment above.
As Charles has also mentioned, you should use local or declare so that word is declared in a local scope.


text:
Q: How to not load the same reference twice in doctrine Let say that we have two tables: Post and Category and two posts that have the same category_id, let say 1.
$post1->getCategory()->getName() will load the category that has category_id 1
$post2->getCategory()->getName() will do the same query to load the same category.
Is there any solution do not make the same query twice?

A: I might be wrong but I believe Doctrine will make use of internal cache to optimize this kind of queries. AFAIK it will keep a pool of objects used by your application, so the first time the category is loaded (post1) it will keep an internal reference of that object in its cache so the second time the same category is invoked it will return the previous instance used instead of making a new query to the database.


text:
Q: Is there a convenient way to get class-specific Average Precision scores for a TensorFlow Object Detection model? The TensorFlow Object Detection API has a very convenient way to get performance metrics for trained models (described in their tutorial here). Unfortunately, the Average Precision scores for each class are not provided.
Does anyone know of a convenient way to get class-specific AP scores for TensorFlow Object Detection models without having to write your own script to do it?
The same question was asked in 2019 but was not answered.
Thanks!

A: After some more searching, I found a couple solutions.
1. Use a different evaluation configuration
Simply change the metrics_set value in the *.config file for your model to "pascal_voc_detection_metrics".
The TensorFlow Object Detection API supports a variety of evaluation metrics, detailed in the documentation here. The PASCAL VOC 2010 detection metric gives AP scores for each class.
2. Edit the cocoeval.py file in your pycocotools package
This method involves pasting 8 lines of code into the cocoeval.py file. It is well explained and documented in this post.


text:
Q: Rails Solr Sunspot order by boolean function result I'm using Sunspot (2.0.0) for Solr in a Rails (3.2.13) app, and I'm indexing an ad_type column that I would like to use to order my results such that certain ads get prioritized over others. Ideally, I could do something like:
order_by :ad_type, Proc.new{|ad_type| ad_type.in?(PRIORITY_AD_TYPES)}, :desc

So that listings whose ad_type is in the PRIORITY_AD_TYPES array are listed before those whose ad_type is not.
I could add another boolean field that is calculated in the same way in the above Proc and sort by that field, but that would require reindexing initially and every time I change the PRIORITY_AD_TYPES array. Is there a more dynamic way to do this similar to the non-functional code I have above?


text:
Q: Using a [weak self] for a HTTP Request I have a question regarding the need of using [weak self] in closures and HTTP requests.
As example we have a HTTP request who triggers a closure on completion:
func saveBla() {
    blaManager.saveBla(bla) { error in
        self.pay5euro()
    }
}

My questions is: Do I need to use a weak reference here or not?
First of all I don't want to lose the response from the api call, after moving to an other page.
Beside of that I don't want to create a retain cycle with a memory leak?
func saveBla() {
    blaManager.saveBla(bla) { [weak self] error in
        guard let strongSelf = self else { return }
        strongSelf.pay5euro()
    }
}

Is it really needed to use a [weak self] in this situation?

A: It depends on the relationship of your manager and your controller.
Conslusion: It will cause retain cycle if A owned B and B owned A without a weak reference.
class NetManager {
    func fire(completion: (_ result: Bool) -> Void) {
        completion(true)
    }
}

class controler: UIViewController {
    override func viewDidLoad() {
        let manager = NetManager()
        // In this case the Manager and Controller NOT own each other,
        // And the block will release after request finished, it is ok to not use weak.
        manager.fire { (result) in

        }
    }

    let manager = NetManager()
    func anOtherExample() {
        // In this case the controller own the manager,
        // manager own the controller, but manager will relase the controller after
        // request finished, this will cause a delay to controller's relase, but it is still ok.
        manager.fire { (result) in

        }
    }
}

if your manages behave like this, then manager will own the controller and it will cause retain cycle when the controller owns manager.
class NetManager {

    var completion: ((_ result: Bool) -> Void)?

    func fire(completion: @escaping (_ result: Bool) -> Void) {
        self.completion = completion
    }
}

more details: https://krakendev.io/blog/weak-and-unowned-references-in-swift


text:
Q: Can I pass a FilePicker a custom source using their API Essentially I'm trying to see if I can use file picker to manage user assets.
With they accelerate bundle you can specify a custom s3 source, but only on their dashboard.
I want users to pick and store to their own folders ( which appears to be possible )
but then also be able to re-use those files they have already picked and stored using filepicker.
Is this possible? by reading through the doc it appears not.

A: Such a feature is not available so far.
I think the only solution here would be to create a database with user filepicker filelinks.


text:
Q: Linq to fill nested objects with pivot I have two tables as below
Person{
    int id;
    string name;
}
PersonAddresses{
    int id;
    string AddressType;
    string City;
    string State;
}

Here AddressType specifies "BusinessAddress","HomeAddress" etc.
I want to Get the result as below.
class PersonData{
    int id;
    string Name;
    Address BusinessAddress;
    Address HomeAddress;
    ...
}
class Address{
    string City;
    string State;
}

Can anyone tell me how to do this using LINQ without multiple selects?

A: The simplest query I can come up with is like this
// by doing groupby and select you choose only one address of the type,
// if a person has many.
// If you can be sure that each person has only one address of each type
// then you can simplify these queries a little bit.
IQueryable<PersonAddresses> homeAddresses = from address in addresses
                                            where address.AddressType == "HomeAddress"
                                            group address by address.id into g
                                            select g.First();

IQueryable<PersonAddresses> businessAddresses = from address in addresses
                                                where address.AddressType == "BusinessAddress"
                                                group address by address.id into g
                                                select g.First();
IQueryable<PersonData> data = from person in persons
                              join tmp1 in homeAddresses on person.id equals tmp1.id into ha
                              join tmp2 in businessAddresses on person.id equals tmp2.id into ba
                              from homeAddress in ha.DefaultIfEmpty()
                              from businessAddress in ba.DefaultIfEmpty()
                              select new PersonData {
                                id = person.id,
                                Name = person.name,
                                HomeAddress = homeAddress == null
                                  ? null
                                  : new Address {
                                    City = homeAddress.City,
                                    State = homeAddress.State
                                  },
                                BusinessAddress = businessAddress == null
                                  ? null
                                  : new Address {
                                    City = businessAddress.City,
                                    State = businessAddress.State
                                  },
                              };

You can get the resulting sql query like this:
  string sql = ((System.Data.Entity.Core.Objects.ObjectQuery) data).ToTraceString();

You can simplify here and there, but it will have less sense, because you usually cannot completely expect your data to be correct - some list have duplicates, some values are missing, so my query covers corner cases.

A: What you are looking for is Group join combined with sub-selects to get Home and Business addresses from a group:
var query =
    from person in Persons
    join address in PersonAddresses
    on person.id equals address.id into personData
    select new PersonData()
    {
        id = person.id,
        Name = person.name,
        HomeAddress = (
            from data in personData
            where data.AddressType == "HomeAddress"
            select new Address()
            {
                City = data.City,
                State = data.State
            }).FirstOrDefault(),
        BusinessAddress = (
            from data in personData
            where data.AddressType == "BusinessAddress"
            select new Address()
            {
                City = data.City,
                State = data.State
            }).FirstOrDefault(),
    };

This runs as single SQL query:
SELECT
    [Extent1].[id] AS [id],
    [Extent1].[name] AS [name],
    [Limit1].[id] AS [id1],
    [Limit1].[City] AS [City],
    [Limit1].[State] AS [State],
    [Limit2].[id] AS [id2],
    [Limit2].[City] AS [City1],
    [Limit2].[State] AS [State1]
    FROM   [dbo].[Person] AS [Extent1]
    OUTER APPLY  (SELECT TOP (1)
        [Extent2].[id] AS [id],
        [Extent2].[City] AS [City],
        [Extent2].[State] AS [State]
        FROM [dbo].[PersonAddresses] AS [Extent2]
        WHERE ([Extent1].[id] = [Extent2].[id]) AND (N'HomeAddress' = [Extent2].[AddressType]) ) AS [Limit1]
    OUTER APPLY  (SELECT TOP (1)
        [Extent3].[id] AS [id],
        [Extent3].[City] AS [City],
        [Extent3].[State] AS [State]
        FROM [dbo].[PersonAddresses] AS [Extent3]
        WHERE ([Extent1].[id] = [Extent3].[id]) AND (N'BusinessAddress' = [Extent3].[AddressType]) ) AS [Limit2]


text:
Q: Populate/clear array when checkbox checked/unchecked I'm currently using angular-google-maps to build out a map with several different marker types. Below my map I have a simple set of checkboxes like so:

  <form action="" class="form-inline" style="text-align:center">
    General:
    <input type="checkbox" checked value="Games">
    Games
    <input type="checkbox" checked value="Practices">
    Practices
  </form>

Within my controller I initialize empty arrays then populate them with 'markers' through calls to my API endpoints:
vm.markersGames = [];
vm.markersPractices = [];

What I want to do is clear each respective array when its checkbox is unchecked (ex: User unchecks 'Games', method within my controller sets vm.markersGames = []), and re-populate each array when checkbox clicked (ex: User checks 'Practices', method within my controller calls API endpoint and populates vm.markersPractices).
The issue I've run into is not knowing how to properly add 'check/uncheck handlers' to my inputs.
Attempt to reload markers when checked:
vm.checkToggle = function(isChecked, value) {
  if (!isChecked) {
    vm[value] = [];
  } else {
    getPlayerAddress();
    $scope.$apply();
  }
};

getPlayerAddress() calls API to populate markers array.

A: You can use the ngChange directive in order to listen change on your input.
Here is an example :
Controller
(function(){

function Controller($scope, Service) {

  //Object to know if the input is checked or not
  $scope.form = {};

  $scope.markersGames = [];

  $scope.markersPractices = [];

  //isChecked : input checked or not
  //value : keyname of your array, for example markersGames
  $scope.change = function(isChecked, value){
    !isChecked
    //If input is not checked, set our $scope[value] to empty array
    ? $scope[value] = []
    //If the input is checked, call Service
    : Service.get(value).then(function(data){
      //Retrieve and set data
      $scope[value] = data;
    });
  }

}

angular
.module('app', [])
.controller('ctrl', Controller);

})();

Then you can use a Service with promise to make your requests
Service
(function(){

  function Service($q){

    function get(url){

      var defer = $q.defer();
      var promise = defer.promise;

      if (url === 'markersGames') {
        defer.resolve([1,2,3,4]);
      } else {
        defer.resolve([4,6,8,1,5,2]);
      }
      return promise;

    }

    var factory = {
      get: get
    };

    return factory;

  }

  angular
    .module('app')
    .factory('Service', Service);

})();

Then you can add ngChange directive in your html :
HTML

    <form action="" class="form-inline" style="text-align:center">
     General:
     <input type="checkbox" checked value="Games" ng-model="form.game" ng-change="change(form.game, 'markersGames')">
     Games
     <input type="checkbox" checked value="Practices" ng-model="form.practice" ng-change="change(form.practice, 'markersPractices')">
     Practices
   </form>

   {{markersGames}}
   {{markersPractices}}


text:
Q: How does a kernel module gets attached to a running kernel? I am a learing device drivers. So far I've executed small modules. I was wondering how linux allows insertion of a module even while its running? I did a search for it but not satisfied or may be could not understand. All I got is linux daemon executes modprobe add new module. But my question is how this happen? The kernel is in execution already. How does the new executable file gets attached to the running kernel?
Thanks.

A: A kernel module is really just an object file (or, in other words, a half linked program) with exposed functions.
modprobe uses a special system call to load the module into the kernel. After that, the kernel has a built in linker that finishes linking the object file to the running kernel. The built in linker knows the addresses of all the kernel functions beforehand so it knows how to fill the blanks.
After that, the kernel jumps to the entry point of the kernel module and the module does its work. From then on, the module is basically part of the kernel.

A: modprobe is a great program to add modules to the kernel. You may get a basic idea bout modprobe and its working from the following links.
http://man7.org/linux/man-pages/man2/init_module.2.html
http://en.wikipedia.org/wiki/Modprobe


text:
Q: What happens when RDS exceeds its provisioned IOPS in case of `Provisioned IOPS SSD (io1) volumes`? Q1: What happens when AWS provisioned IOPS volume crosses its limit?
Q2: Do Amazon EBS provisioned IOPS volumes also refill credits like gp2, when it is running below baseline performance?

A: It will hit the threshold and stay there (not go any higher), and no it's not burstable. You pay for the cap.


text:
Q: The parameters dictionary contains a null entry for parameter 'productId' of non-nullable type 'System.Int32' I think I have an error with my routing configuration and a controller but i dont know where specifically the error is coming from cus a new to mvc can somebody please help me the error am getting is..

'The parameters dictionary contains a null entry for parameter
  'productId' of non-nullable type 'System.Int32' for method
  'System.Web.Mvc.RedirectToRouteResult AddToCart(Int32, System.String)'
  in 'OnlineShoppingStore.webUI.Controllers.CartController'. An optional
  parameter must be a reference type, a nullable type, or be declared as
  an optional parameter'

My cart controller (Addtocart) is-
  public RedirectToRouteResult AddToCart(int productId, string returnUrl)
    {
        Product product = repository.products.FirstOrDefault(p =>
         p.ProuductId == productId);
            if (product != null)
            {
                GetCart().AddItem(product, 1);
            }
        return RedirectToAction("Index", new { returnUrl });
     }

My route config is:
  public static void RegisterRoutes(RouteCollection routes)
    {
        routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
        routes.MapRoute(null, "",
            new
            {
                Controller = "Product",
                action = "list",
                category=(string) null,
                page=1
            });
        routes.MapRoute(null, "Page{Page}",
            new
            {
                Controller = "Product",
                action = "list",
                category = (string)null
            },
         new { Page = @"\d+" });
        routes.MapRoute(null,
            "{category}",
            new
            {
                controller = "Product",
                action = "list",
                Page = 1
            });
        routes.MapRoute(null,
            "{category}/Page{Page}",
            new
            {
                controller = "Product",
                action = "list"
            },
            new { Page = @"\d+"});
        routes.MapRoute(null, "{controller}/{action}");
   }


text:
Q: Amazon onebox too large It seems that the Amazon onebox doesn't truncate text. Pasting a product link with a particularly long description results in a rather large onebox:

For comparison, a long question from somewhere on SE will have its content truncated, so that the box doesn't get so big:

(Yes it's a similar question, but I don't believe it's a duplicate. link)
Can it be made so Amazon oneboxes have a limit set for the description shown, so the box isn't quite so large when the seller has a lot to say?


text:
Q: Use ng2-adal to get access token for Microsoft Graph Client I'm trying to create an Angular application that uses the Angular 2 ADAL library to login into Azure Active Directory and afterwards call Microsoft Graph Client to retrieve some informations about the current user.
Unfortunately the Graph client always returns InvalidAuthenticationToken and I don't know how to further investigate to find the root cause.
my.component.ts
import { Component, Inject, OnInit } from '@angular/core';
import { PLATFORM_ID } from '@angular/core';
import { isPlatformBrowser } from '@angular/common';

import * as MicrosoftGraph from '@microsoft/microsoft-graph-types';
import { Client } from '@microsoft/microsoft-graph-client';

import { SecretService } from '../../shared/secret.service';
import { AdalService } from 'ng2-adal/services/adal.service';

@Component({
    selector: 'my',
    templateUrl: './my.component.html'
})
export class MyComponent implements OnInit {
    isBrowser: boolean;
    private graphClient: Client;
    private userProfile: any;

    constructor(
        @Inject(PLATFORM_ID) platformId: Object,
        private adalService: AdalService,
        private secretService: SecretService) {
        this.isBrowser = isPlatformBrowser(platformId);
        adalService.init(secretService.adalConfig);

        // Don't initialize graph client in server-side-rendering
        if (this.isBrowser) {
            this.graphClient = Client.init({
                authProvider: (done) => {
                    done(undefined, this.adalService.getCachedToken(this.secretService.adalConfig.clientId));
                }
            });
        }
    }

    get isLoggedIn(): boolean {
        if (!this.isBrowser)
            return false;

        return this.adalService.userInfo.isAuthenticated;
    }

    ngOnInit() {
        // Fast exit on server-side-rendering
        if (!this.isBrowser)
            return;

        // Initialize ADAL service
        this.adalService.handleWindowCallback();
        this.adalService.getUser();

        // If we are already logged in (cause reply url is called from login)
        // use Graph API to get some data about the current user
        if (this.isLoggedIn) {
            this.graphClient.api('/me').get().then((value) => {
                this.userProfile = value;
            }).catch((error) => {
                // Currently I'm always getting here, but never in the above then() call.
                console.log(error);
            });
        }
    }

    onLogin() {
        this.adalService.login();
    }

    onLogout() {
        this.adalService.logOut();
    }
}

my.component.html
<md-toolbar>
    <md-toolbar-row>
        <button color="primary" md-button *ngIf="!isLoggedIn" (click)="onLogin()">
            Login
        </button>
        <button color="accent" md-button *ngIf="isLoggedIn" (click)="onLogout()">
            Logout
        </button>
    </md-toolbar-row>
</md-toolbar>
<md-card>
    <md-card-content>
        <section>
            {{userProfile}}
        </section>
    </md-card-content>
</md-card>

A: Based on the code, you were calling the Microsoft Graph using the id_token issued from Azure AD. To call the Microsoft Graph, we need to use the access_token and its audience should be https://graph.microsoft.com.
You need to acquire the access_token for the Microsoft Graph using the code like below:
this.adalService.acquireToken("https://graph.microsoft.com").subscribe(function(token){
          this.graphClient = Client.init({
            authProvider: (done) => {
                done(undefined, token);
            }
        });

More detail about authentication of Microsoft Graph, you can refer the link below:
Get access tokens to call Microsoft Graph


text:
Q: How to get Visual Studio to generate the override stub for an event declared in a base type? I'm trying to override an event handler in a subclass - how can i get VS2008 to generate the stub?
For that matter can it generate the code for a method override?
Is there a trick?

A: I don't think so, but did you tried CodeRush  from Devexprees, it may have this facility.


text:
Q: Working with EditText as with the TextView - onClickListener I have EditTexts intstead of TextViews so I can select some text to share.
  android:textIsSelectable="true"
  android:editable="false"
  android:inputType="none"

But I have problem setting onClickListener on it. It barely works, you may tap it 10 times before Log show me result.I can do this :
 android:focusable="false"

and onClickListener works fine with this, but I can't select any text to share

A: this worked for me In this i am able to select text and can show a toast when it is clicked
Just long press your edittext box and you select as much text as it contains
layout.xml
<EditText
  android:id="@+id/justforFun"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:text="Just for Fun"
    android:focusable="true"
    android:editable="false"
    android:textIsSelectable="true" >
</EditText>

Activity code
EditText text = (EditText) findViewById(R.id.justforFun);
    text.setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View v) {
            Toast.makeText(getApplicationContext(), "success", Toast.LENGTH_LONG).show();

        }
    });

A:   yourEditTextHere.setOnTouchListener(new View.OnTouchListener(){
     public boolean onTouch(View view, MotionEvent motionEvent) {
        // your code here....
        //open keyboard all the time
        getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_VISIBLE);
        return false;
     }
   });

A: If you just want the text to be selectable, simply use a TextView. They have the textIsSelectable attribute too and give a nicer UX (because the user thinks he can edit text in EditTexts, but he can't).

A: Use TouchListner instead of clickListner.
Reference: http://www.edureka.in/blog/android-tutorials-event-listeners


text:
Q: Spring Boot application logs with Docker Desktop Environment:

Windows 10
Docker Desktop (2.0)
Running Linux Container of it. on my windows 10 machine.

I would like to store my spring boot app info logs on my C:\log folder.
how to write Volume in Dockerfile for this. So that my spring boot logs gets persisted at C:\log location.
I have created log4j2.json file for this which works perfectly on local ( without container)
Please suggest how to write

A: By default only C:/Users is shared with containers so your dockerfile volume should be something like this /c/Users/youruser/my_volume:/my_mnt


text:
Q: error while installing php in ubuntu I am trying to install php in my ubuntu system, I have already installed apache and mysql, but I am not able to install php using the following command
sudo apt install php libapache2-mod-php

I am receiving the following error:
(Reading database ... 489 files and directories currently installed.)
Preparing to unpack .../libapache2-mod-php_2%3a7.3+69+ubuntu18.10.1+deb.sury.org+2+php7.3_all.deb ...
Unpacking libapache2-mod-php (2:7.3+69+ubuntu18.10.1+deb.sury.org+2+php7.3) ...
Setting up php7.3-common (7.3.3-1+ubuntu18.10.1+deb.sury.org+1) ...
dpkg: error processing package php7.3-common (--configure):
 installed php7.3-common package post-installation script subprocess returned error exit status 10
dpkg: dependency problems prevent configuration of php7.3-opcache:
 php7.3-opcache depends on php7.3-common (= 7.3.3-1+ubuntu18.10.1+deb.sury.org+1); however:
  Package php7.3-common is not configured yet.

dpkg: error processing package php7.3-opcache (--configure):
 dependency problems - leaving unconfigured
dpkg: dependency problems prevent configuration of libapache2-mod-php7.3:
 libapache2-mod-php7.3 depends on php7.3-common (= 7.3.3-1+ubuntu18.10.1+deb.sury.org+1); however:
  Package php7.3-common is not configured yet.
 libapache2-mod-php7.3 depends on php7.3-opcache; however:
  Package php7.3-opcache is not configured yet.

dpkg: error processing package libapache2-mod-php7.3 (--configure):
 dependency problems - leaving unconfigured
No apport report written because the error message indicates its a followup error from a previous failure.
                          No apport report written because the error message indicates its a followup error from a previous failure.
                                                    dpkg: dependency problems prevent configuration of php7.3-cli:
 php7.3-cli depends on php7.3-common (= 7.3.3-1+ubuntu18.10.1+deb.sury.org+1); however:
  Package php7.3-common is not configured yet.
 php7.3-cli depends on php7.3-opcache; however:
  Package php7.3-opcache is not configured yet.

dpkg: error processing package php7.3-cli (--configure):
 dependency problems - leaving unconfigured
No apport report written because MaxReports is reached already
                                                              dpkg: dependency problems prevent configuration of php7.3-readline:
 php7.3-readline depends on php7.3-common (= 7.3.3-1+ubuntu18.10.1+deb.sury.org+1); however:
  Package php7.3-common is not configured yet.

dpkg: error processing package php7.3-readline (--configure):
 dependency problems - leaving unconfigured
No apport report written because MaxReports is reached already
                                                              dpkg: dependency problems prevent configuration of php7.3:
 php7.3 depends on libapache2-mod-php7.3 | php7.3-fpm | php7.3-cgi; however:
  Package libapache2-mod-php7.3 is not configured yet.
  Package php7.3-fpm is not installed.
  Package php7.3-cgi is not installed.
 php7.3 depends on php7.3-common; however:
  Package php7.3-common is not configured yet.

dpkg: error processing package php7.3 (--configure):
 dependency problems - leaving unconfigured
No apport report written because MaxReports is reached already
                                                              dpkg: dependency problems prevent configuration of php7.3-json:
 php7.3-json depends on php7.3-common (= 7.3.3-1+ubuntu18.10.1+deb.sury.org+1); however:
  Package php7.3-common is not configured yet.

dpkg: error processing package php7.3-json (--configure):
 dependency problems - leaving unconfigured
No apport report written because MaxReports is reached already
                                                              dpkg: dependency problems prevent configuration of libapache2-mod-php:
 libapache2-mod-php depends on libapache2-mod-php7.3; however:
  Package libapache2-mod-php7.3 is not configured yet.

dpkg: error processing package libapache2-mod-php (--configure):
 dependency problems - leaving unconfigured
No apport report written because MaxReports is reached already
                                                              dpkg: dependency problems prevent configuration of php:
 php depends on php7.3; however:
  Package php7.3 is not configured yet.

dpkg: error processing package php (--configure):
 dependency problems - leaving unconfigured
No apport report written because MaxReports is reached already
                                                              Errors were encountered while processing:
 php7.3-common
 php7.3-opcache
 libapache2-mod-php7.3
 php7.3-cli
 php7.3-readline
 php7.3
 php7.3-json
 libapache2-mod-php
 php
E: Sub-process /usr/bin/dpkg returned an error code (1)

A: While this answer is two years late, this problem can happen when dpkg has remnants of broken/incomplete installations in its info directory. You can usually solve the issue like this:
sudo rm /var/lib/dpkg/info/php*
sudo dpkg --configure -D 777 php
sudo apt -f install

Then again for libapache2-mod-php:
sudo rm /var/lib/dpkg/info/libapache2-mod-php*
sudo dpkg --configure -D 777 libapache2-mod-php
sudo apt -f install

What this is doing:

*

*remove the .list and .md5sums files for the affected packages from /var/lib/dpkg/info

*set dpkg to debug mode so that, if it fails to build, you'll have more specific data to work with, making it easier to find out why the package couldn't install

*force apt to install the packages (as much as reasonable, anyway)

Hopefully this will help someone in the future who runs into this sort of problem.


text:
Q: Tic Tac Toe Array Check Game over I can't figure out this homework prompt I feel like an idiot.
This is the prompt:
Declare and implement a function called gameOver. gameOver receives a single 3x3 char[][] array as a parameter, representing a tic-tac-toe board, with each cell containing either a X, a O, or a (blank space). gameOver should return X if X has won the game, O if O has won the game, and a blank space (' ') otherwise. Do not check the diagonals!
Can someone give me some advice on this.

A: It is asking you to implement a function that takes a board and returns the winner or a draw.
Here is how you declare a function in java:
public char gameOver(char[][] board) {
   char winner = ' ';
   you implementation goes here.
   return winner;
}

In the function implementation you have to scan the board and figure out who is the winner and assigning it to the winner variable.
Before looking up the solution written in the comment it is best for you if you try it yourself.


text:
Q: C ->Python Import Wrapper Problems I have defined the name of my wrapper object in my c file blargUtils.c like this (I have defined methods and the lot for it in Blargmethods)...
void initBlarg(){
    Py_InitModule("Blarg", Blargmethods);
}

I compiled it like so...
blarglib: blargUtils.c
    gcc -I/usr/include/python2.6 -fPIC -c blargUtils.c -Wall
    gcc -shared blargUtils.o -o blargUtils.so
clean:
    rm *.so

However, when I try to import the wrapper in my python script...
import Blarg

Its says it says: "ImportError: No module named Blarg". I'm a little lost here and I don't understand why it cannot find the class when they are the exact same spelling. Maybe its a logic error?
If more code is needed let me know.

A: First of all, from looking at the comments, I see that renaming it didn't work. This means (1) python can't find the .so file, (2) the .so file isn't usable (i.e. not compiled correctly or not all required symbols are found), or (3) there is a .py/.pyc/.pyo file in the same directory which already has that name. If you have Blarg.py already defined, python will look at this file first. The same goes if you have a directory named Blarg in your search path. So instead of bashing your head against the wall, try this:
1) Rename your .so library to something guaranteed not to collide (i.e. _Blarg)
void initBlarg() {
    Py_InitModule("_Blarg", Blargmethods);
}

2) Compile it with the SAME NAME
gcc -I/usr/include/python2.6 -fPIC -c blargUtils.c -Wall
gcc -shared blargUtils.o -Wl,-soname -Wl,_Blarg.so -o _Blarg.so

3) Create a python wrapper (i.e. Blarg.py)
import sys
sys.path.append('/path/to/your/library')

import _Blarg

def blargFunc1(*args):
    """Wrap blargFunc1"""
    return _Blarg.blargFunc1(*args)

4) Now just use it as normal
import Blarg
Blarg.blargFunc1(1, 2, 3)

Obviously this is a bit of overkill, but it should help you determine where the problem is. Hope this helps.


text:
Q: How do I align these inline bullet points? I have the code
\usepackage[inline]{enumitem}
\makeatletter
% This command ignores the optional argument for itemize and enumerate lists
\newcommand{\inlineitem}[1][]{%
\ifnum\enit@type=\tw@
    {\descriptionlabel{#1}}
  \hspace{\labelsep}%
\else
  \ifnum\enit@type=\z@
       \refstepcounter{\@listctr}\fi
    \quad\@itemlabel\hspace{\labelsep}%
\fi}
\begin{document}
    \begin {itemize}
    \setlength\itemsep{0em}
    \item Substrate (\textbf {S}) \inlineitem Enzyme (\textbf {E})
    \item Complex (\textbf {SE}) \inlineitem Product (\textbf {P})
    \end {itemize}
\end{document}

And I want like them to be in line with each other. I.e., the substrate bullet point is inline with the complex one (which it is), but also the Enzyme bullet point to be inline with the Product bullet point which they're currently not.

A: The [inline]  option of enumitem isn't designed for lists aligned in columns, but for horizontals lists with a constant  horizontal spacing between items, like the  inparaenum and inparaitem environments from paralist.
For lists aligned in columns, you can use the tasks package, but also shortlst, which can be found on CTAN, but isn't part of  TeX Live or MiKTeX, for licensing reasons.
Here I defined a tabitemize package with an optional argument, the number of columns of the alignment (3 by default). Note that when an item content is wider than a single column, it uses the current column and the following one:
\documentclass[11pt, a4paper]{article}

\usepackage{shortlst}

\newenvironment{tabitemize}[1][3]{%
\settowidth{\labelwidth}{\labelitemi}%
\setlength{\leftmargini}{\dimexpr\parindent+\labelwidth+\labelsep\relax}%
\setlength{\shortitemwidth}{\dimexpr\linewidth/#1-\labelwidth-2\labelsep\relax}%
\begin{shortitemize}}%
{\end{shortitemize}}%

\usepackage{lipsum}
\begin{document}

\begin{tabitemize}[2]
    \setlength\itemsep{0em}
    \item Substrate (\textbf {S})
    \item Enzyme (\textbf {E})
    \item Complex (\textbf {SE})
    \item Product (\textbf {P})
\end{tabitemize}

\end{document}

Added: Procedure to install the shortlst package for every user:
First you need to have a texmf-local directory root for local additions. It already exists for TeX Live and MacTeX, but not for MiKTeX.
For MiKTeX, you have to open MiKTeX Settings (Admin), Roots tab and click on the Add… button to add a new TeX directory root. You may give it the name you want. Its content has to be organised according to the TeX Directory Structure (TDS).
Next, download the CTAN  package. It contains only two files: shortlst.dtx and shortlst.pdf (the documentation). Put the .pdf file in texmf-local\doc\latex\shortlst\.
Then you have to create shortlst.sty. For this, you compile shortlst.dtx, which produces a series of files, among which shortlst.pdf (the documentation again) and the most important shortlst.ins. Compile shortlst.ins. Another series of files, among which the precious shortlst.sty, that you put in texmflocal\latex\shortlst\.
Last step: delete all files, except those you've placed in texmf-local and refresh the FNDB, with MiKTeX Settings (Admin) again (General tab).

A: Here are two ways, one with a tabular and a special B type (B like in Bullet) and one with the tasks environment (which is to be preferred)
\documentclass{article}
\usepackage{tasks}

\usepackage{array}

\newcolumntype{B}[1]{@{}>{\textbullet\quad\raggedright}p{#1}@{}}

\begin{document}
\begin{tabular}{*{2}{B{5cm}}}
  Substrate (\textbf {S}) &  Enzyme (\textbf {E}) \tabularnewline
 Complex  (\textbf{SE}) &  Product (\textbf {P})
\end{tabular}

\begin{tasks}[style=itemize](2)
\task Substrate (\textbf {S}) \task Enzyme (\textbf {E})
\task Complex (\textbf {SE}) \task Product (\textbf {P})
\end{tasks}
\end{document}

A version with a tabular only, removing the indent by \noindent
\documentclass{article}

\usepackage{array}
\usepackage{showframe}
\newcolumntype{B}[1]{@{}>{\textbullet\quad\raggedright}p{#1}@{}}

\begin{document}
\noindent
\begin{tabular}{*{2}{B{5cm}}}
  Substrate (\textbf {S}) &  Enzyme (\textbf {E}) \tabularnewline[1ex]
 Complex  (\textbf{SE}) &  Product (\textbf {P})
\end{tabular}

\end{document}


text:
Q: Working with a List of pandas dataFrames I have notice something weird in the behaviour of my code while using pandas dataFrames and lists. I don't know if they are correlated or if the problem is coming from something beyond my understanding. I would appreciate if someone could explain the reason. My code is similar to the following example:
list_of_df=[]
for i in range(0,5):
    df=a_function(data)
    list_of_df.append(df)

a_function is taking a initial dataFrame named "data", modify it and return it. This is a silly example but basically shows the operations I am making:
def a_function(data):
    data[new_column]=1
    data.loc[:,existing_column]=0
    return data

What I am expecting is to end up with list_of_df being a list of different dataFrames however I end up with all the dataFrames being the same and equal to the one that was appended last.
When I used the following workaround, the code is working as expected:
list_of_df=[]
for i in range(0,5):
    df=data.copy()
    df=a_function(df)
    list_of_df.append(df)

But I am not sure why. Thank you for your help!
edit: more information of what a_function is doing on the dataFrame


text:
Q: Mongoose get highest values by key This is my Schema
var schema = new mongoose.Schema({
    key: String,
    value: Number
}, {
    timestamps: true
});

I have entries like this (i'm collecting different stats)
var entry1 = {
    key: "subscribers",
    value: 100
}
var entry2 = {
    key: "online",
    value: 105
}

I'm trying to get the all time high values for each key.
Right now I have this:
var now = new Date();
var startOfToday = new Date(now.getFullYear(), now.getMonth(), now.getDate());
db.getConnection().model("MaxValue").aggregate([{
    "$match": {
        createdAt: {
            $gte: startOfToday
        }
    }
}, {
    "$group": {
        "_id": "$key",
        "value": { "$max": "$value" },
    }
}], function(err,result) {
    resolve(result)
})

But I want to get the created date also for that value because I want to know when that value was recorded.

A: It's not so easy because $max is an accumulator so you can't just take this date directtly to the result. Therefore we have to add few more pipeline stages. Fortunately we have $addToSet operator so we can add custom transformations to each group.
So after grouping, each group should still contain dates paired with values. Then we do the unwinding to process each item separately. Next we can set new field which discriminates if such document contains max value in group. $cmp operator will set this field to 0 if strings are equal. Finally in last stage we can filter out documents without max value.
db.maxValues.aggregate([
    {
        "$group": {
            "_id": "$key",
            "value": { "$max": "$value" },
            "values": { "$addToSet" : { "value": "$value", "createdAt": "$createdAt" }}
        }
    },
    {
        "$unwind": "$values"
    },
    {
        "$project": {
            "_id": 0,
            "key": "$_id",
            "value": 1,
            "createdAt": "$values.createdAt",
            "compared": { "$cmp": ["$value", "$values.value"] }
        }
    },
    {
        "$match": { "compared": 0 }
    }
])


text:
Q: Android Studio - image source issue I have created folder called "activity_informations" in default drawable folder:

Now I want to add attribute android:src to ImageView:
android:src="@drawable/activity_informations/happy_face"

but program signals rendering problem:
Failed to convert @drawable/activity_informations/happy_face into a drawable

How I could solve this?
Thanks for help :)


text:
Q: Xamarin is looking for android sdks in the wrong location & giving build errors I'm having a persistent build issue that I can't resolve, I've tried xamarin support forums.
When I build my project, it can't find any of my Xamarin.Android.Support.* packages.
I have all of my Xamarin.Android.Support.* libraries included as nuget packages. They appear correct in my packages.config and csproj file, and the references folder in my project shows they are recognized.
The issue appears to be that the build is looking for these packages in a completely different folder, which is my local user AppData folder. I have no clue why it is looking there, but I think this is the issue.
I'm lost and can't figure out why it is looking here.
Error details:
Severity    Code    Description Project File    Line    Suppression State
Error       Please install package: 'Xamarin.Android.Support.Animated.Vector.Drawable' available in SDK installer. Java library file C:\Users\jwierzba.ASSOCIATIONVOIC\AppData\Local\Xamarin\Xamarin.Android.Support.Animated.Vector.Drawable\23.3.0.0\embedded\classes.jar doesn't exist.  CiiCommon.Droid
Error       Please install package: 'Xamarin.Android.Support.Animated.Vector.Drawable' available in SDK installer. Android resource directory C:\Users\jwierzba.ASSOCIATIONVOIC\AppData\Local\Xamarin\Xamarin.Android.Support.Animated.Vector.Drawable\23.3.0.0\embedded\./ doesn't exist.  CiiCommon.Droid
Error       Please install package: 'Xamarin.Android.Support.Design' available in SDK installer. Android resource directory C:\Users\jwierzba.ASSOCIATIONVOIC\AppData\Local\Xamarin\Xamarin.Android.Support.Design\23.3.0.0\embedded\./ doesn't exist.  CiiCommon.Droid
Error       Please install package: 'Xamarin.Android.Support.Design' available in SDK installer. Java library file C:\Users\jwierzba.ASSOCIATIONVOIC\AppData\Local\Xamarin\Xamarin.Android.Support.Design\23.3.0.0\embedded\classes.jar doesn't exist.  CiiCommon.Droid
Error       Please install package: 'Xamarin.Android.Support.v4' available in SDK installer. Android resource directory C:\Users\jwierzba.ASSOCIATIONVOIC\AppData\Local\Xamarin\Xamarin.Android.Support.v4\23.3.0.0\embedded\./ doesn't exist.  CiiCommon.Droid
Error       Please install package: 'Xamarin.Android.Support.v4' available in SDK installer. Java library file C:\Users\jwierzba.ASSOCIATIONVOIC\AppData\Local\Xamarin\Xamarin.Android.Support.v4\23.3.0.0\embedded\classes.jar doesn't exist.  CiiCommon.Droid
Error       Please install package: 'Xamarin.Android.Support.v4' available in SDK installer. Java library file C:\Users\jwierzba.ASSOCIATIONVOIC\AppData\Local\Xamarin\Xamarin.Android.Support.v4\23.3.0.0\embedded\libs/internal_impl-23.3.0.jar doesn't exist.    CiiCommon.Droid
Error       Please install package: 'Xamarin.Android.Support.v7.AppCompat' available in SDK installer. Android resource directory C:\Users\jwierzba.ASSOCIATIONVOIC\AppData\Local\Xamarin\Xamarin.Android.Support.v7.AppCompat\23.3.0.0\embedded\./ doesn't exist.  CiiCommon.Droid
Error       Please install package: 'Xamarin.Android.Support.v7.AppCompat' available in SDK installer. Java library file C:\Users\jwierzba.ASSOCIATIONVOIC\AppData\Local\Xamarin\Xamarin.Android.Support.v7.AppCompat\23.3.0.0\embedded\classes.jar doesn't exist.  CiiCommon.Droid
Error       Please install package: 'Xamarin.Android.Support.v7.CardView' available in SDK installer. Android resource directory C:\Users\jwierzba.ASSOCIATIONVOIC\AppData\Local\Xamarin\Xamarin.Android.Support.v7.CardView\23.3.0.0\embedded\./ doesn't exist.    CiiCommon.Droid
Error       Please install package: 'Xamarin.Android.Support.v7.CardView' available in SDK installer. Java library file C:\Users\jwierzba.ASSOCIATIONVOIC\AppData\Local\Xamarin\Xamarin.Android.Support.v7.CardView\23.3.0.0\embedded\classes.jar doesn't exist.    CiiCommon.Droid
Error       Please install package: 'Xamarin.Android.Support.v7.MediaRouter' available in SDK installer. Android resource directory C:\Users\jwierzba.ASSOCIATIONVOIC\AppData\Local\Xamarin\Xamarin.Android.Support.v7.MediaRouter\23.3.0.0\embedded\./ doesn't exist.  CiiCommon.Droid
Error       Please install package: 'Xamarin.Android.Support.v7.MediaRouter' available in SDK installer. Java library file C:\Users\jwierzba.ASSOCIATIONVOIC\AppData\Local\Xamarin\Xamarin.Android.Support.v7.MediaRouter\23.3.0.0\embedded\classes.jar doesn't exist.  CiiCommon.Droid
Error       Please install package: 'Xamarin.Android.Support.v7.MediaRouter' available in SDK installer. Java library file C:\Users\jwierzba.ASSOCIATIONVOIC\AppData\Local\Xamarin\Xamarin.Android.Support.v7.MediaRouter\23.3.0.0\embedded\libs/internal_impl-23.3.0.jar doesn't exist.    CiiCommon.Droid
Error       Please install package: 'Xamarin.Android.Support.v7.RecyclerView' available in SDK installer. Android resource directory C:\Users\jwierzba.ASSOCIATIONVOIC\AppData\Local\Xamarin\Xamarin.Android.Support.v7.RecyclerView\23.3.0.0\embedded\./ doesn't exist.    CiiCommon.Droid
Error       Please install package: 'Xamarin.Android.Support.v7.RecyclerView' available in SDK installer. Java library file C:\Users\jwierzba.ASSOCIATIONVOIC\AppData\Local\Xamarin\Xamarin.Android.Support.v7.RecyclerView\23.3.0.0\embedded\classes.jar doesn't exist.    CiiCommon.Droid
Error       Please install package: 'Xamarin.Android.Support.Vector.Drawable' available in SDK installer. Android resource directory C:\Users\jwierzba.ASSOCIATIONVOIC\AppData\Local\Xamarin\Xamarin.Android.Support.Vector.Drawable\23.3.0.0\embedded\./ doesn't exist.    CiiCommon.Droid
Error       Please install package: 'Xamarin.Android.Support.Vector.Drawable' available in SDK installer. Java library file C:\Users\jwierzba.ASSOCIATIONVOIC\AppData\Local\Xamarin\Xamarin.Android.Support.Vector.Drawable\23.3.0.0\embedded\classes.jar doesn't exist.    CiiCommon.Droid
Error       Reason: C:\Users\jwierzba.ASSOCIATIONVOIC\AppData\Local\Xamarin\zips\2A3A8A6D6826EF6CC653030E7D695C41.zip is not a valid zip file   CiiCommon.Droid
Error       Reason: C:\Users\jwierzba.ASSOCIATIONVOIC\AppData\Local\Xamarin\zips\2A3A8A6D6826EF6CC653030E7D695C41.zip is not a valid zip file   CiiCommon.Droid
Error       Reason: C:\Users\jwierzba.ASSOCIATIONVOIC\AppData\Local\Xamarin\zips\2A3A8A6D6826EF6CC653030E7D695C41.zip is not a valid zip file   CiiCommon.Droid
Error       Reason: C:\Users\jwierzba.ASSOCIATIONVOIC\AppData\Local\Xamarin\zips\2A3A8A6D6826EF6CC653030E7D695C41.zip is not a valid zip file   CiiCommon.Droid
Error       Reason: C:\Users\jwierzba.ASSOCIATIONVOIC\AppData\Local\Xamarin\zips\2A3A8A6D6826EF6CC653030E7D695C41.zip is not a valid zip file   CiiCommon.Droid
Error       Reason: C:\Users\jwierzba.ASSOCIATIONVOIC\AppData\Local\Xamarin\zips\2A3A8A6D6826EF6CC653030E7D695C41.zip is not a valid zip file   CiiCommon.Droid
Error       Reason: C:\Users\jwierzba.ASSOCIATIONVOIC\AppData\Local\Xamarin\zips\2A3A8A6D6826EF6CC653030E7D695C41.zip is not a valid zip file   CiiCommon.Droid
Error       Reason: C:\Users\jwierzba.ASSOCIATIONVOIC\AppData\Local\Xamarin\zips\2A3A8A6D6826EF6CC653030E7D695C41.zip is not a valid zip file   CiiCommon.Droid
Error       Reason: C:\Users\jwierzba.ASSOCIATIONVOIC\AppData\Local\Xamarin\zips\2A3A8A6D6826EF6CC653030E7D695C41.zip is not a valid zip file   CiiCommon.Droid
Error       Reason: C:\Users\jwierzba.ASSOCIATIONVOIC\AppData\Local\Xamarin\zips\2A3A8A6D6826EF6CC653030E7D695C41.zip is not a valid zip file   CiiCommon.Droid
Error       Reason: C:\Users\jwierzba.ASSOCIATIONVOIC\AppData\Local\Xamarin\zips\2A3A8A6D6826EF6CC653030E7D695C41.zip is not a valid zip file   CiiCommon.Droid
Error       Reason: C:\Users\jwierzba.ASSOCIATIONVOIC\AppData\Local\Xamarin\zips\2A3A8A6D6826EF6CC653030E7D695C41.zip is not a valid zip file   CiiCommon.Droid
Error       Reason: C:\Users\jwierzba.ASSOCIATIONVOIC\AppData\Local\Xamarin\zips\2A3A8A6D6826EF6CC653030E7D695C41.zip is not a valid zip file   CiiCommon.Droid
Error       Reason: C:\Users\jwierzba.ASSOCIATIONVOIC\AppData\Local\Xamarin\zips\2A3A8A6D6826EF6CC653030E7D695C41.zip is not a valid zip file   CiiCommon.Droid
Error       Reason: C:\Users\jwierzba.ASSOCIATIONVOIC\AppData\Local\Xamarin\zips\2A3A8A6D6826EF6CC653030E7D695C41.zip is not a valid zip file   CiiCommon.Droid
Error       Reason: C:\Users\jwierzba.ASSOCIATIONVOIC\AppData\Local\Xamarin\zips\2A3A8A6D6826EF6CC653030E7D695C41.zip is not a valid zip file   CiiCommon.Droid
Error       Reason: C:\Users\jwierzba.ASSOCIATIONVOIC\AppData\Local\Xamarin\zips\2A3A8A6D6826EF6CC653030E7D695C41.zip is not a valid zip file   CiiCommon.Droid
Error       Reason: C:\Users\jwierzba.ASSOCIATIONVOIC\AppData\Local\Xamarin\zips\2A3A8A6D6826EF6CC653030E7D695C41.zip is not a valid zip file   CiiCommon.Droid
Error       Unzipping failed. Please download https://dl-ssl.google.com/android/repository/android_m2repository_r29.zip and extract it to the C:\Users\jwierzba.ASSOCIATIONVOIC\AppData\Local\Xamarin\Xamarin.Android.Support.Animated.Vector.Drawable\23.3.0.0\content directory.  CiiCommon.Droid
Error       Unzipping failed. Please download https://dl-ssl.google.com/android/repository/android_m2repository_r29.zip and extract it to the C:\Users\jwierzba.ASSOCIATIONVOIC\AppData\Local\Xamarin\Xamarin.Android.Support.Animated.Vector.Drawable\23.3.0.0\content directory.  CiiCommon.Droid
Error       Unzipping failed. Please download https://dl-ssl.google.com/android/repository/android_m2repository_r29.zip and extract it to the C:\Users\jwierzba.ASSOCIATIONVOIC\AppData\Local\Xamarin\Xamarin.Android.Support.Design\23.3.0.0\content directory.    CiiCommon.Droid
Error       Unzipping failed. Please download https://dl-ssl.google.com/android/repository/android_m2repository_r29.zip and extract it to the C:\Users\jwierzba.ASSOCIATIONVOIC\AppData\Local\Xamarin\Xamarin.Android.Support.Design\23.3.0.0\content directory.    CiiCommon.Droid
Error       Unzipping failed. Please download https://dl-ssl.google.com/android/repository/android_m2repository_r29.zip and extract it to the C:\Users\jwierzba.ASSOCIATIONVOIC\AppData\Local\Xamarin\Xamarin.Android.Support.v4\23.3.0.0\content directory.    CiiCommon.Droid
Error       Unzipping failed. Please download https://dl-ssl.google.com/android/repository/android_m2repository_r29.zip and extract it to the C:\Users\jwierzba.ASSOCIATIONVOIC\AppData\Local\Xamarin\Xamarin.Android.Support.v4\23.3.0.0\content directory.    CiiCommon.Droid
Error       Unzipping failed. Please download https://dl-ssl.google.com/android/repository/android_m2repository_r29.zip and extract it to the C:\Users\jwierzba.ASSOCIATIONVOIC\AppData\Local\Xamarin\Xamarin.Android.Support.v4\23.3.0.0\content directory.    CiiCommon.Droid
Error       Unzipping failed. Please download https://dl-ssl.google.com/android/repository/android_m2repository_r29.zip and extract it to the C:\Users\jwierzba.ASSOCIATIONVOIC\AppData\Local\Xamarin\Xamarin.Android.Support.v7.AppCompat\23.3.0.0\content directory.  CiiCommon.Droid
Error       Unzipping failed. Please download https://dl-ssl.google.com/android/repository/android_m2repository_r29.zip and extract it to the C:\Users\jwierzba.ASSOCIATIONVOIC\AppData\Local\Xamarin\Xamarin.Android.Support.v7.AppCompat\23.3.0.0\content directory.  CiiCommon.Droid
Error       Unzipping failed. Please download https://dl-ssl.google.com/android/repository/android_m2repository_r29.zip and extract it to the C:\Users\jwierzba.ASSOCIATIONVOIC\AppData\Local\Xamarin\Xamarin.Android.Support.v7.CardView\23.3.0.0\content directory.   CiiCommon.Droid
Error       Unzipping failed. Please download https://dl-ssl.google.com/android/repository/android_m2repository_r29.zip and extract it to the C:\Users\jwierzba.ASSOCIATIONVOIC\AppData\Local\Xamarin\Xamarin.Android.Support.v7.CardView\23.3.0.0\content directory.   CiiCommon.Droid
Error       Unzipping failed. Please download https://dl-ssl.google.com/android/repository/android_m2repository_r29.zip and extract it to the C:\Users\jwierzba.ASSOCIATIONVOIC\AppData\Local\Xamarin\Xamarin.Android.Support.v7.MediaRouter\23.3.0.0\content directory.    CiiCommon.Droid
Error       Unzipping failed. Please download https://dl-ssl.google.com/android/repository/android_m2repository_r29.zip and extract it to the C:\Users\jwierzba.ASSOCIATIONVOIC\AppData\Local\Xamarin\Xamarin.Android.Support.v7.MediaRouter\23.3.0.0\content directory.    CiiCommon.Droid
Error       Unzipping failed. Please download https://dl-ssl.google.com/android/repository/android_m2repository_r29.zip and extract it to the C:\Users\jwierzba.ASSOCIATIONVOIC\AppData\Local\Xamarin\Xamarin.Android.Support.v7.MediaRouter\23.3.0.0\content directory.    CiiCommon.Droid
Error       Unzipping failed. Please download https://dl-ssl.google.com/android/repository/android_m2repository_r29.zip and extract it to the C:\Users\jwierzba.ASSOCIATIONVOIC\AppData\Local\Xamarin\Xamarin.Android.Support.v7.RecyclerView\23.3.0.0\content directory.   CiiCommon.Droid
Error       Unzipping failed. Please download https://dl-ssl.google.com/android/repository/android_m2repository_r29.zip and extract it to the C:\Users\jwierzba.ASSOCIATIONVOIC\AppData\Local\Xamarin\Xamarin.Android.Support.v7.RecyclerView\23.3.0.0\content directory.   CiiCommon.Droid
Error       Unzipping failed. Please download https://dl-ssl.google.com/android/repository/android_m2repository_r29.zip and extract it to the C:\Users\jwierzba.ASSOCIATIONVOIC\AppData\Local\Xamarin\Xamarin.Android.Support.Vector.Drawable\23.3.0.0\content directory.   CiiCommon.Droid
Error       Unzipping failed. Please download https://dl-ssl.google.com/android/repository/android_m2repository_r29.zip and extract it to the C:\Users\jwierzba.ASSOCIATIONVOIC\AppData\Local\Xamarin\Xamarin.Android.Support.Vector.Drawable\23.3.0.0\content directory.   CiiCommon.Droid

edit: it is not a duplicate of Build unsuccessful : Error with Android project in Xamarin.Forms as this issue was related to corrupted zip files.

A: Sometimes Visual Studio will timeout while downloading the appropriate libraries it requires, and it'll give build issues because certain packages appear to be installed, but the files have been corrupted.
What I'd suggest doing is closing Visual Studio, deleting all the files from C:\Users\jwierzba.ASSOCIATIONVOIC\AppData\Local\Xamarin\zips, restarting Visual Studio, and rebuilding the project. This will force Visual Studio to download those libraries again from scratch.
You can fix the 260 character limit by right-clicking on your specific project in Solution Explorer, selecting "Properties", navigating to the "Build" tab, and changing the Output path.


text:
Q: repeating a row to fill in missing row values in R I have a dataset that looks like this

left
center
right

One
data
data

data
data

data
data

data
data

Two
data
data

data
data

data
data

data
data

Three
data
data

data
data

data
data

data
data

What I need it to do is to look like this

left
center
right

One
data
data

One
data
data

One
data
data

One
data
data

Two
data
data

Two
data
data

Two
data
data

Two
data
data

Three
data
data

Three
data
data

Three
data
data

Three
data
data

The core issue as you can see is that I have a single value that is only within one row but needs to be in all the associated rows.

A: You can use the fill function from the tidyr library
fill(dataset, left , .direction = "down")


text:
Q: Is Adobe AIR a good choice for building an app usage-monitoring tool? I've been looking for some some answers about Adobe AIR in its current version and I'm wondering if any of you could let me know if I can do all these things with an Adobe AIR app, since I know they have their limitations:

*

*Sit in the system tray in Windows and as a small icon in the top-most bar in OS X while running in the background? Will this require different programming to support both platforms?

*While being in the background, be notified of which app gets the focus and when? Ideally, I would also get the name of the document, URL of the website (if we're on a browser with tabs) that has the focus, etc. I'm trying to build a tool similar to RescueTime, that tells you how much time you spent on each app or website.

*Have a specific system-wide hotkey (like Alt+Space) that when pressed, the app comes up into focus (from being in the background)?

*Show notifications (Growl-style unintrusive popups) for specific events?

*Being notified when the system gets inactive (screensaver pops up, users "sleeps" computer, etc)
Thanks!

A: yes.  all of that can be accomplished with and AIR application using NativeApplication and NativeProcess.
in order to write once and deploy on Windows and Mac, you will need to determine which OS your application is running either by employing the NativeApplication properties:

*

*NativeApplication.supportsDockIcon (Mac OS X)

*NativeApplication.supportsSystemTrayIcon (Windows)

or you can determine the OS more precisely like this:
//Resoslve Operating System
if  (Capabilities.os.toLowerCase().indexOf("win") > -1)
    {
    //Native Processes for Windows
    }
    else if (Capabilities.os.toLowerCase().indexOf("mac") > -1)
    {
    //Native Processes for Mac OS X
    }
    else if (Capabilities.os.toLowerCase().indexOf("linux") > -1)
    {
    //Native Process for Linux
    }
    else
    {
    throw new Error("Unresolved Operating System");
    }

while this approach will only require you to write the application once, AIR applications that use system specific processes (Native Processes) must be published with native installers for each target OS as those native processes are different for each OS.
some native processes (such as reading data from a serial port or printer driver) may require a small, helper application, perhaps written in C++, to be used as a proxy that is controlled by AIR for communication between AIR and the target process.
further reading:  Interacting with a native process

A: *

*Yes, system tray is supported in unified way

*No, AIR has no knowledge of other applications.

*No global hotkey support

*Yes

*No

AIR isn't created with system programming in mind, it has web roots. Items 2, 3 and 5 could be done with native helper, but this require system programming for each target platform.


text:
Q: Linux CLI virtual console spews wifi status messages On MX Linux I switched to a virtual console without a GUI by pressing CTRL+ALT+F1. The console will randomly spew out wifi status messages, shown in this image.
How do I get it to stop?
EDIT: I fixed it by typing sudo telinit 5. In an effort to fix a separare problem, I typed sudo telinit 3 and probably started this.


text:
Q: Is there a way to improve the performance of this code in order to reduce the time needed? I'm working with binary protein interactions, and with the data that I have I use Mathematica to generate a Graph with all the interactions.
Since most of the organisms have thousands of proteins and interactions, I'm dealing with quadratic matrices of order 2000 or higher, and my code takes too long to generate it (a 1993x1993 matrix takes more than an hour to be created, and the higher ones I couldn't measure the time yet, but it may take a day for a 5000x5000 matrix, maybe more. Btw, this is the time it took for me using 2 kernels on my computer).
This is the code that I made:
Clear[matrizadj];
matrizadj[file_]:=
Block[{},
    int = Import[file, "Table"];
    int2 = Union[Flatten[int]];
    t1 = Table[{
        Extract[ Flatten[ Position[ int2, int[[i,1]]] ],{1}],
        Extract[ Flatten[ Position[ int2, int[[i,2]]] ],{1}]
    }, {i, Length[int]}];
    t2 = Join[ t1, Map[Reverse[t1]]];
    matr = ParallelTable[
        If[ MemberQ[ t2,{i,j}], 1, 0],
        {i, Length[int2]}, {j,Length[int2]}]
    ]

This is the code I use to read a .csv file with the interactions.
(I'm uploading three files with the interactions: a 1993x1993 matrix and a 4529x4529 matrix). It will generate an adjacency matrix when I call the code using the following line and specifying the path of the file:
mat = matrizadj[ (* insert file path here *) ]

The only operation inside the code that really takes too long to be executed is the last one (the ParallelTable), where he generates the adjacency matrix.
I'm sorry if I didn't make myself clear in some part of the text, but I would appreciate if someone could help me.
Thanks :)

A: There are errors in your code, so I'm not sure that this is exactly what you are trying to do, but my suggestion would be to use Mathematica's Graph utilities rather than writing your own. The following works quickly for me:
Clear[matrizadj];
matrizadj[file_] := With[
  {int = Import[file, "Table"]},
  With[
   {int2 = Union@Flatten[int]},
   With[
    {t1 = Map[
       First@FirstPosition[int2, #] &,
       int,
       {2}]},
    AdjacencyMatrix@Graph@Join[t1, Reverse /@ t1]]]]

This ran in just a few seconds for me on your larger file. Note that it returns a sparse matrix and not a full matrix; the Normal function can turn this into a normal matrix.
A couple notes:

*

*ParallelTable and related functions are multi-processing and not multi-threading utilities, so they require the creation of an entirely separate Wolfram Kernel instance; this duplicates memory and often takes a lot more time than expected. In general, I don't advise using them unless you have a problem that is suited for multi-processing.

*Mathematica will frequently multi-thread things for you automatically anyway if it can. It can usually be encouraged to do so by using higher-level functions rather than manipulating the data yourself. For example, telling Mathematica to generate a Graph from a list of vertex pairs (edges) then to get its Adjacency Matrix is going to be much faster than you iterating through the list of edges by yourself.

*Your code overwrites the global variables int, int2, etc. These variables are not localized to your function, so if you had defined an int in your notebook, it would change after calling matrizadj. To fix this, notice how my code nests the variable definitions in With[] forms (see also Block and Module). You can protect your local variables by putting their names in the {} list that is the first argument of the Block form in your code.


text:
Q: Update color canvas issue @Override
public void onDraw(Canvas canvas){
    super.onDraw(canvas);
    Paint paint=new Paint();
    paint.setColor(Color.BLACK);
    Paint paint1=new Paint(Color.WHITE);

     for(int i=0;i<31;i++){
         for(int j=0;j<28;j++){
             float x = j * 10;
             float y = i * 10;
             if(mapa[i][j]==0) {

                 canvas.drawRect(0, 0, y, x, paint);
                 invalidate();

             }else if (mapa[i][j]==1) {

                 canvas.drawRect(0, 0, y, x, paint1);
             }
             refreshDrawableState();
         }
    }

}

I want to create a maze, with a matrix. This matrix has values 0-1 (0-Black and 1-White) and I want to draw a maze. In my activity I create this view and use the function setContentView and I can create a black squares. I need some help, maybe exist a function to update the canvas or stuff like that


text:
Q: Unknown error using Swift 3 in xcode 8 - "Editor placeholder in source file" I am creating a helper function to handle what happens when a register button is clicked. I am attempting to connect Firebase database and use the reference that I create to input the information that is inputed. I am getting the following two errors upon finishing the function...
"Editor placeholder in source file"
"Value of optional type 'String?' not unwrapped, did you mean '!' or '?'?"

The first error is the one I am most concerned about, but all pointers would be appreciated.
Here is the function that I have created to handle the RegisterButtonClick action:
func handleRegisterClick(){
        guard let email = emailTextField.text, let password = passwordTextField.text, let name = nameTextField.text else{
            print("Form is not valid...")
            return
        }

        FIRAuth.auth()?.createUser(withEmail: email, password: password, completion: { (user: FIRUser?, error) in
            if error != nil{
                print(error ?? "user was not created... something went wrong")
                return
            }
            // else... succesfully authernticated user

            var ref: FIRDatabaseReference!
            ref = FIRDatabase.database().reference()

            let values = ["name": name, "email": email]

            ref.updateChildValues(values, withCompletionBlock: { (err, ref) in
                if err != nil{
                    print(err ?? "Child values could not be updated... something went wrong")
                    return
                }
                print("Saved user successfully into the Firebase DB")
            })
        })
        print("Register Button was pressed.")
    }

Up above is where the error is being called. The following block of code shows where this function is being called:
lazy var loginRegisterButton: UIButton = {
        let button = UIButton(type: .system)
        button.backgroundColor = UIColor(r: 80, g: 101, b: 161)
        button.setTitle("Register", for: .normal)
        button.setTitleColor(UIColor.white, for: .normal)
        button.titleLabel?.font = UIFont.boldSystemFont(ofSize: 16)

        button.addTarget(self, action: #selector(handleRegisterClick), for: .touchUpInside)

        // this next step is needed or else the constraints set later on will not work
        button.translatesAutoresizingMaskIntoConstraints = false
        return button
    }()

Any help fixing the first error would be extremely helpful. I just don't understand what the error is stating. Very new to iOS development, therefore apologies on any unclarity.

A: Xcode inserts placeholders in your code when using autocomplete. You should replace them with your own values. That first error means you left one of those placeholders in your code. It should look visually different, with a rounded "pill-like" background of a different color. Find it and replace it or remove it.
The second error means you have an optional String (String?) that you have to unwrap using ! or ? to turn it into a non-optional String.

A: This:
(user: FIRUser?, error)

should be
(user, error)

That should correct both errors. If not, please indicate the line the optional error is occurring on and I will update the answer.


text:
Q: Exporting a text file in rails with the data in model I got some 5 field in my model named "Data" in a rails application say - Name, Age, Place, Country, Marks.
I want to get that data in an text file in the below format
Name : Lokesh
Age : "20"
place :xxx
country : yyyyyyy
marks : "90%"

Name : Ramesh
Age : "23"
place : aaa
country : zzzz
marks : "89.2%"

and so on..
How to generate this type of text file in rails.
If thats not possible(or difficult), I know how to export these data into an csv file. Please help me in converting these csv or excel file into a text file of the above format.
Any help will be greatly appreciated.. Thank you

A: One way to do this quickly would be to loop through your table and display this in the view in your browser.  Then just copy and paste it into a text file.
In your controller:
def some_method
    @records = Data.all
end

In the corresponding view:
<%  @records.each do |record| %>

Name: <%=record.name%>

Age : <%=record.agae%>

place: <%=record.place%>

country: <%=record.country%>

marks: <%=record.marks%>

<% end %>


text:
Q: Custom Web Component image not showing I have been working through a yt tutorial on Web Components by Brad Traversy, a great teacher with great content, as I'm sure many of you already know :)
I've gotten up to the 17 minute mark, though the problem I'm having is that the images are not displaying as they are in the tutorial...
They are being added to the document flow... I can tell this because the layout re-adjusts to accommodate the space for an image... it's just that the image is not displayed...
Just for comparison, I added a image of a similar nature directly in the html and it works fine.
Anyway, here is my code...
index.html:
<!DOCTYPE html>

  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Web Components Example</title>

Hello World... where's the images?!?!?

  <user-card name="huik popp" avatar="38.jpg"></user-card>

  <user-card name="som otha"></user-card>

and the Javascript...
UserCard.js:
const template = document.createElement('template');
template.innerHTML = `

`;

class UserCard extends HTMLElement {
  constructor() {
    super();

    this.attachShadow({ mode: 'open'});
    this.shadowRoot.appendChild(template.content.cloneNode(true));
    this.shadowRoot.querySelector('h3').innerText = this.getAttribute('name');
    this.shadowRoot.querySelector('img').innerText = this.getAttribute('avatar');
  }
}

window.customElements.define('user-card', UserCard);

I'd appreciate any help with this very much. I've been enjoying following along with this tutorial so far and well, would like to keep up with how things look in the video.
Many thanks.

A: I'm answering my question here...
In userCard.js, I have:
this.shadowRoot.querySelector('img').innerText = this.getAttribute('avatar');

It should be:
this.shadowRoot.querySelector('img').src = this.getAttribute('avatar');

A: Tell Brad he can shorten the code to:
class UserCard extends HTMLElement {
  constructor() {
    super()
      .attachShadow({ mode: 'open'})
      .innerHTML = `

`;

...

  }
);


text:
Q: PhpStorm PSR-12 Code style adds extra 21 spaces to array After selecting PSR12 code style in PhpStorm I get extra 21 spaces in array column:
$columns->addHeaders([
    'Number',
                         'Number in words',
                         'Number in words length'
                     ]);

Instead of:
$columns->addHeaders([
    'Number',
    'Number in words',
    'Number in words length'
]);

Is there any way to configure PhpStorm to auto-format code like in second example, but leaving all other PSR-12 configs?
P.S. I understand, that using PSR-12 I should start array in next line (example below), but sometimes I still need to use first method of formatting:
$columns->addHeaders(
    [
        'Number',
        'Number in words',
        'Number in words length'
    ]
);


text:
Q: SystemStackError (stack level too deep) on where method I'm getting a SystemStackError (stack level too deep) error on a where call.
Wondering if it's got something to do with associations, but not sure.
> Member.where(skill_primary: 8)
Traceback (most recent call last):
        1: from (irb):8
SystemStackError (stack level too deep)

Here's what a singular Member object looks like:
#<Member
  id: 500,
  name: "Godiva Headache",
  gender: "",
  birthdate: "1958-04-12",
  cost: 0,
  trait_stamina: 0,
  trait_ego: 15,
  trait_looks: 2,
  trait_drive: 0,
  trait_productivity: 0,
  trait_aptitude: 0,
  trait_creativity: 54,
  trait_network: 0,
  trait_fatigue: 0,
  skill_primary: 8,
  skill_primary_level: 53,
  skill_secondary: nil,
  skill_secondary_level: 0,
  skill_tertiary: nil,
  skill_tertiary_level: 0,
  created_at: "2018-04-12 14:36:46",
  updated_at: "2018-04-12 14:36:46"
>

Member model:
class Member < ApplicationRecord
  belongs_to :skill_primary, class_name: 'Skill', foreign_key: :skill_primary
end

Skill model:
class Skill < ApplicationRecord
  has_many :member_skills
  has_many :members, through: :member_skills
end

Running Rails 5.2 on Postgres.


text:
Q: Is it possible to change the predefind Bootstrap classes set in the application layout control in ExtLib I am using the responsive Bootstrap theme together with the application layout control in extlib and cannot really find any documentation about if it is possible to change the Bootstrap predefined classes.
in the following example there is a titlebar with tabs using the predefined Bootstrap class "nav nav-tabs"
In my case I do not want the "nav-tabs" class, instead I want the "nav-pills" class but I find no way to change this using the source editor, I know I can change classes using client side script but I am hoping there is a server side way to control this.

<xe:this.configuration>
        <xe:bootstrapResponsiveConfiguration legal="Copyright " placeBar="true" banner="true" fixedNavbar="fixed-bottom" footer="true" invertedNavbar="true" placeBarName="#{javascript:compositeData.Title}" rightColumnLabel="RightColumnLabel" titleBar="true" defaultNavigationPath="/tab1/link1" productLogo="/logo.gif" pageWidth="full">
            <xe:this.titleBarTabs>
                    <xe:pageTreeNode label="page1" page="/page1.xsp"></xe:pageTreeNode>
                    <xe:pageTreeNode label="page2" page="/page2.xsp"></xe:pageTreeNode>
                    <xe:pageTreeNode label="page3" page="/page3.xsp"></xe:pageTreeNode>
            </xe:this.titleBarTabs>
        </xe:bootstrapResponsiveConfiguration>
</xe:this.configuration>

I have tried to add a class like this but it does nothing to the html
<xe:this.titleBarTabs styleClass="nav nav-pills">

A: That particular bootstrap CSS class is set in the TitleBarTabsRenderer of the com.ibm.xsp.theme.bootstrap plugin. Check the source code here. And that renderer is used by ResponsiveAppLayoutRenderer to render the tabs.
As it is currently setup, your best bet to do what you want would be to use CSJS as you say, or to extend and override the TitleBarTabsRenderer and ResponsiveAppLayoutRenderer classes. Not the simplest approach, so perhaps this could be turned into an SPR/enhancement request and looked at for a future extlib release.

A: I found out that I can easily override the nav-tabs class set by the boostrap theme by creating my own theme, like so:
<theme extends="Bootstrap3.2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="platform:/plugin/com.ibm.designer.domino.stylekits/schema/stylekit.xsd" >
<control>
    <name>TabbedPanel</name>
    <property>
        <name>styleClass</name>
        <value>nav nav-pills</value>
    </property>
</control>


text:
Q: Need guide on HOW TO make development in VirtualBox Ubuntu and debug with an emulator on a Windows Host I have a development Ubuntu OS running on a VirtualBox on Windows 7 host. I tried to start development of Tizen app, but emulator response extremely slow on the Ubuntu Virtual Machine. I have searched online for tutorial on how to make a connection from a host Development environment to an emulator running on a VirtualBox.
This is my setup:
Host OS: Win 7 with emulator
Guest OS in virtualbox: Ubuntu 12.04 with IDE
Is there any tutorial on how to connect them in one development environment?

A: I found how perfom such debugging:

*

*Run IDE on guest OS (in my case, it is Ubuntu) and virtual device on
host OS (in my case, it is Windows).

*Open command line and use
    command  sdb connect 10.0.2.2:26101 (26101 is a default port of emulator)

*That it. In IDE in list of
        devices you shoould see new device with such IP and port. Now just
        use it to run and ddebug application.

If you want to make debug visa versa (run emulator on guest OS and access it from host OS), just use IP 10.0.2.15:26101.


text:
Q: problems with update statement in SQLite I have created a database using SQLite. I want to update the value of a "features" column( type Blob)...but i do not know how to write the "update" statement .
This is what i tried:
    try {
        stat = conn.createStatement();
    } catch (SQLException e) {
    }
    try {
        byte[] b = getFunction();
        stat.executeUpdate("update table set features="+b);
    } catch (SQLException e) {
    }

i get the follwing error :
java.sql.SQLException: unrecognized token: "[B@13a317a"

so i guess that "b" is the problem ?

A: [B@13a317a looks like a array to string result (b.toString() in this case). You should use a prepared statement for the blob like:
update table set features=?

An example is here.
Generally, you should never create a SQL by concatenating strings. This is the recipe for SQL injection problems.

A: Try this one with PreparedStatement:
Connection con = null;
PreparedStatement stmt = null;

try {
    byte[] b = getFunction();
    con = ...;
    stmt = con.prepareStatement("update table set features=?");
    stmt.setBytes(1, b);
    stmt.executeUpdate();

    con.commit();
}
catch (SQLException e) {
    //handle exception (consider con.rollback()) and con maybe null here)
}
finally {
    //close stmt and at least con here (all maybe null here)
}

Personally I am always using PreparedStatements. When you have to write a lot of this code then consider writing some Utility-Classes to reduce Boilerplate-Code.
In particular you should consider writing Utilty-Classes for null-safe calling methods on Connection, Statement and ResultSet methods when you are dealing with plain JDBC.
EDIT
What Thomas Jung wrote about preventing SQL Injections is another big pro for always using PreparedStatements. +1 for him :-)

A:  stat.executeUpdate("update table set features="+b[0].toString());

you have to use +


text:
Q: (react.js) when is it appropriate to call stores from non-container components I believe most people are in agreement that using container components is a good practice - described in this popular post: https://medium.com/@learnreact/container-components-c0e67432e005#.qhw8yfodx
I bought into it, however, I think I was doing so a bit too strictly.
One comment in that article mentions that not using container components hinders reusability of those components:

CommentList can't be reused unless under the exact same circumstances.

While reusability is great, there will always be some components that are not meant to be reused, they have a very specific job that is unique to a certain aspect of your app. So if I don't plan on reusing this component, is there any harm to fetching the data from within the component that renders it?
Use Case:
I've only found myself in this situation because I'm dynamically generating a handful of components that share certain behavior (eg saving user changes to inputs in the component), but otherwise require different store data. So I render my components via a loop with with this shared component as a parent, however I don't want to have to pass the store data into every one of these components when only some need it.
Here's the breakdown:
Container Component -> Shared Component ->  Unique Components

Where container component right now is fetching all store data, each unique component is generated from a loop within the container component wrapped in the shared component as a parent. With this current setup, I need to pass all data to every component, via the Shared Component, in order for it to make it to my Unique Components

A:
So if I don't plan on reusing this component, is there any harm to fetching the data from within the component that renders it?

Software design is about trade-offs. Separating container components from presentational components brings several advantages - separation of concerns, reusability, testability, etc. These advantages are probably too easily overlooked or lost, which is why articles such as the one you linked make such a big deal out of them. But, if pursuing these advantages creates too many disadvantages (of a more complicated or uglier design, more development work, or whatever), it's not "wrong" to compromise on them, as long as you understand the trade-offs you're making.
A couple of additional thoughts on container components in particular:

*

*If you're using Redux, you can [connect](https://github.com/reactjs/react-redux/blob/master/docs/api.md#connectmapstatetoprops-mapdispatchtoprops-mergeprops-options) components to the store at arbitrary points in your hierarchy. The container-versus-presentational dilemma of having to pass state in from higher-level components becomes a moot point if your lower-level unique components can connect up to the store themselves.

*Dan Abramov, the creator of React Hot Loader and Redux, gave this example in the Redux documentation:

Sometimes it's hard to tell if some component should be a presentational component or a container. For example, sometimes form and function are really coupled together, such as in case of this tiny component:
AddTodo is an input field with an "Add" button
Technically we could split it into two components but it might be too early at this stage. It's fine to mix presentation and logic in a component that is very small. As it grows, it will be more obvious how to split it, so we'll leave it mixed.

If even the creator of Redux says that it's not always a hard-and-fast line, that's saying something.

Even if you decide to blur the line, you should consider ideas to keep the concepts separate as much as possible. For example:

*

*Your shared component could be separated so that its shared presentational bits are in one component and the rest of the logic is in a container component (that shows the shared presentational component and wires up the unique children).

*Maybe the shared component could take the unique children as React children, so that it doesn't need any unique state logic. React children can be quite flexible, thanks to techniques such as the various React.Children methods, using cloneElement to inject child properties, and keyed fragments.

*Maybe the shared logic can be in a presentational component and a higher-order component adds the logic to inject state for unique children.


text:
Q: Standard ML static errors I have to write a function that computes this datatype :
datatype Expr = X
| Y
| Avg of Expr * Expr
| Mul of Expr * Expr;

and I cannot find the error in the following funtion;
val rec compute =>  fn X => (fn x => fn y => x)
|  Y => (fn x => fn y => x)
|  Avg (e1, e2) => (fn x => fn y => (compute(e1 x y) + compute(e2 x y) div 2))
|  Mul (e1, e2) => (fn x => fn y => (compute(e1 x y) * compute(e2 x y)));

What's wrong with that?!
Any help please?

A: First, you have a syntax error: the first => should be a = (part of the val declaration).
Second, you are putting the parentheses in the recursive calls to compute wrong: you are calling it with a single argument (which would be the result of applying e.g. e1 to the two arguments x and y).
Here is a form that should work:
val rec compute =
  fn X => fn x => fn y => x
  |  Y => fn x => fn y => x  (* you probably meant y? *)
  |  Avg (e1, e2) => fn x => fn y => compute e1 x y + compute e2 x y div 2
  |  Mul (e1, e2) => fn x => fn y => compute e1 x y * compute e2 x y

It becomes a bit nicer if you use the syntactic abbreviation that is the fun syntax:
fun compute X x y = x
  | compute Y x y = y
  | compute (Avg (e1, e2)) x y = compute e1 x y + compute e2 x y div 2
  | compute (Mul (e1, e2)) x y = compute e1 x y * compute e2 x y

That is a (mostly) equivalent definition.