text:
Q: How to remove multiple results from admin grid in ui-component Magento 2 How to Remove the multiple results in the grid from the same date in admin grid UI component Magento 2
- I have got multiple results for 1 day.
- I need a single result for a single date.
<column name="creation_time" class="Magento\Ui\Component\Listing\Columns\Date">
            <argument name="data" xsi:type="array">
                <item name="config" xsi:type="array">
                    <item name="filter" xsi:type="string">dateRange</item>
                    <item name="component" xsi:type="string">Magento_Ui/js/grid/columns/date</item>
                    <item name="dataType" xsi:type="string">date</item>
                    <item name="label" xsi:type="string" translate="true">Created At</item>
                    <item name="sortOrder" xsi:type="number">140</item>
                </item>
            </argument>
        </column>


text:
Q: Trying to implement SSO with Azure active directory and API authentication using Azure/MSAL I am trying to implement SSO with Azure Active Directory and  API authentication using Azure AD/MSAL but I am  facing the issues described below.

*

*After authentication, idToken is generated and this is saved in the local storage and attached automatically to API calls which is treated as unauthorized with error "Invalid token" "Audience is invalid", because ID token cannot be used for API authentication.

*After authentication I am calling acquireTokenSilent method to get an access token. I am able to get the token and set it but at the time of API call, the token attached to th Authorization header is the ID token, not the access token. How do you configure Msalinterceptor to attach the access token to the Authorization header instead of the ID token?

*To test the access token, I used Postman and hit the API. Again, authorization failed (Unauthorized 401) with error message saying "Invalid token", "Signature is invalid." In jwt.io also it shows invalid signature. What is wrong with the signature?
This is the snapshot of my code:
this.subscriptionLoginSuccess = this.broadcastService.subscribe("msal:loginSuccess", (payload) => {

      const accessTokenRequest = ["user.read", "api://[scope]"];

        this.msalAuthService.acquireTokenSilent(accessTokenRequest);
}

Thanks!
Edit:Configuration in app.module.ts
MsalModule.forRoot({
      clientID: 'clientID',
      authority: 'https://login.microsoftonline.com/tanentId',
      validateAuthority: true,
      redirectUri: 'https://localhost:5001/',
      cacheLocation: 'localStorage',
      storeAuthStateInCookie: isIE,
      postLogoutRedirectUri: 'https://localhost:5001/auth/login',
      navigateToLoginRequestUrl: true,
      popUp: false,
      consentScopes: ["api://WebApiClientId/api-access"],
      unprotectedResources: ['https://www.microsoft.com/en-us/'],
      protectedResourceMap: protectedResourceMap,
      piiLoggingEnabled: true,
    }),

 providers: [
    {
      provide: HTTP_INTERCEPTORS,
      useClass: MsalInterceptor,
      multi: true
    },

redpajama_set_name: RedPajamaStackExchange


text:
Q: exchange parameters between apache cxf interceptor and jaxrs client I'm creating an Apache CXF JAX-RS client and adding an inInterceptor
MyProxy proxy = JAXRSClientFactory.create("http://path.to.url", MyProxy.class);
ClientConfiguration config = WebClient.getConfig(service);

config.getInInterceptors().add(new RemoveAlertsInterceptor());

How can I set a parameter inside the RemoveAlertsInterceptor, which I can read from the proxy?


text:
Q: OLS estimator through matrix operations The OLS estimator is
$$\hat\beta = (X'X)^{-1}X'Y$$
And I don't know why we have to even think about minimizing squares of residuals and partial derivatives (e.g.,: https://web.stanford.edu/~mrosenfe/soc_meth_proj3/matrix_OLS_NYU_notes.pdf) if we could just do
$$  X\hat\beta = Y $$
$$  X'X\hat\beta = X'Y $$
$$  \hat\beta = (X'X)^{-1}X'Y$$
what am I missing?

A: Your derivation is misleading. Initially, either $X\beta = E[Y]$ or $X\hat \beta = \hat Y$. The orthogonal decomposition that allows $Y = \hat Y + e $ stems from minimizing the square residuals.
$$
X \hat \beta = X( Y + e) = XY + Xe = XY,
$$
it stems from the fact that the residuals $e$ are orthogonal to the space spanned by $X$. Although now you can proceed with your derivation, but it is based on the decomposition that is obtained from the residual minimization in the first place.


text:
Q: How to play soundcloud music in ios app? I'm trying to play music from my profile in soundcloud, I downloaded sounCloud API project, but it looks very difficult, maybe exist easiest way? Help me please. Thank you.

A: You should be able to make a GET request for the track you're trying to play:
[api performMethod:@"GET"
        onResource:@"tracks"
    withParameters:[NSDictionary dictionaryWithObject:@"12821506"  forKey:@"ids"]
           context:context userInfo:nil];

You can then register a SCSoundCloudAPIDelegate and implement:
- (void)soundCloudAPI:(SCSoundCloudAPI *)soundCloudAPI
    didFinishWithData:(NSData *)data
              context:(id)context
             userInfo:(id)userInfo;

If the context is equal to the context you passed in when making the GET request, you know your request is complete. You can build an NSDictionary modeling the response, and then grab the stream URL for streaming:
NSDictionary *trackInfo = [data objectFromJSONData];
NSString *steamURL = [trackInfo objectForKey:@"stream_url];

The full list of parameters you can specify when making the GET request is available here.


text:
Q: PHP if child of display this HTML, else display that HTML First question on here. I am doing a custom Wordpress site and I need to divide the post page (single.php) so that if it is a child of my WORK page it displays a certain HTML, else it displays another chunk of HTML.
At the moment I have the following inside the single.php file:

WORK SECTION GOES HERE

NEWS SECTION GOES HERE

i am trying to tell it to display one if it's a child of WORK page, or else the other div... how would I go about doing this?
Many thanks

A: Try this.
if($(this).parent().hasClass('work_section')){
  // your code
} else {
  // your code
}

A: You can simply hide/show div elements, for example, on a button click. If you have two buttons with a data attribute, you can easily switch between these two pages. Buttons HTML:

Work

News

And the jQuery:
$(".button").click(function() {
    $(".work_section").hide();
    $(".news_section").hide();
    var section=$(this).data("section");
    $("."+section+"_section").show();
});

But it can be more precise and readable if you use a section element insted of a div, with shorter class names like "news" and "work". Then your jQuery code will be shorter:
$(".button").click(function() {
    $("section").hide();
    $("."+$(this).data("section")).show();
});

A: There are several ways of doing this in wordpress.
if ( is_page(2) ) {
 // stuff
}

or:
if ( $post->post_parent == 'WORK' ) {
  // stuff
 }

But I am not quiet sure if thats the best way to go about it. Maybe you should rethink how you are are modelling the site.
I would suggest to create 2 different custom post types, work & news. This way you can create instances or posts for each type e.g. single-work.php or single-news.php.
Codex: Custom Post Types
Another way would be to make WORK a category and do custom loop/query and/or conditional statements.


text:
Q: How to have some space left and right from a Bootstrap container I am looking to get some space left and right from a Boostrap container.
At the moment I am doing it by having a 'fluid' container/section and setting some margin on both sides. That way we have some space left and right.
The problem with doing that is that on larger screens it will look horrible and it gets stretched out.

What I'm trying to achieve is to have a more consistent left and right spacing outside the container when on a normal screen:

So that the spacing outside the container is always like 10% and not being stretched out on larger screens.
Here's a Codepen with what I have so far:
https://codepen.io/monsmado/pen/ZEorope
'codewise' it is not the most optimal, because I quickly copied it from my React/Next.js project

A: If I'm interpreting your question correctly, you could set a max-width: 1400px; (or whatever you want) and margin: 0 auto on the .hero. You would need to override the other !important rules that are getting applied there.


text:
Q: Rails 4 Unknown Format error Im trying to create a user but when I submit it I get the error. I set json as the default format in the users controller and in my routes, however I still get this error. Im running Rails 4.2.2 and ruby 2.2.1
ActionController::UnknownFormat (ActionController::UnknownFormat):

Users Controller

class Api::V1::UsersController < ApplicationController
  respond_to :json

  def show
    respond_with User.find(params[:id])
  end
  def create
    user = User.new(user_params)
    if user.save
      render json: user, status: 201, location: [:api, user]
    else
      render json: { errors: user.errors }, status: 422
    end
  end
  def update
    user = User.find(params[:id])

    if user.update(user_params)
        render json: user, status: 200, location: [:api, user]
    else
        render json: { errors: user.errors }, status: 422
    end
  end
  def destroy
    user = User.find(params[:id])
    user.destroy
    head 204
  end

  private

    def user_params
      params.require(:user).permit(:email, :password, :password_confirmation)
    end
end

Routes
require 'api_constraints'

Rails.application.routes.draw do
  devise_for :users
  namespace :api, defaults: { format: :json },
                              constraints: { subdomain: 'api' }, path: '/'  do
    scope module: :v1,
              constraints: ApiConstraints.new(version: 1, default: true) do
      resources :users, :only => [:show, :create, :update, :destroy]
    end
  end
end

Log
Processing by Devise::RegistrationsController#create as JSON
  Parameters: {"user"=>{"password"=>"[FILTERED]", "password_confirmation"=>"[FILTERED]", "email"=>"example@gmail.com"}, "registration"=>{"user"=>{"password"=>"[FILTERED]", "password_confirmation"=>"[FILTERED]", "email"=>"pilon24@icloud.com"}}}
Can't verify CSRF token authenticity
MONGODB | Adding localhost:27017 to the cluster.
MONGODB | localhost:27017 | quickalertapi_development.find | STARTED | {"find"=>"users", "filter"=>{"email"=>"example@gmail.com"}, "projection"=>{"_id"=>1}, "limit"=>1}
MONGODB | localhost:27017 | quickalertapi_development.find | SUCCEEDED | 0.044546s
MONGODB | localhost:27017 | quickalertapi_development.insert | STARTED | {"insert"=>"users", "documents"=>[{"_id"=>BSON::ObjectId('57570c29dd4736cc49ddcdfc'), "email"=>"example@gmail.com", "encrypted_password"=>"$2a$11$1NFccmBD10pUW59b2TQ.9ezJPQkmdnrBoEzaq/Sdl9T5K7miH62/a", "sign_in_count"=>0, "updated_at"=>2016-06-07 18:...
MONGODB | localhost:27017 | quickalertapi_development.insert | SUCCEEDED | 0.009481999999999999s
MONGODB | localhost:27017 | quickalertapi_development.update | STARTED | {"update"=>"users", "updates"=>[{"q"=>{"_id"=>BSON::ObjectId('57570c29dd4736cc49ddcdfc')}, "u"=>{"$set"=>{"last_sign_in_at"=>2016-06-07 18:02:17 UTC, "current_sign_in_at"=>2016-06-07 18:02:17 UTC, "last_sign_in_ip"=>"127.0.0.1", "current_sign_in_ip"=>...
MONGODB | localhost:27017 | quickalertapi_development.update | SUCCEEDED | 0.012626s
Completed 406 Not Acceptable in 371ms

ActionController::UnknownFormat (ActionController::UnknownFormat):
  responders (2.2.0) lib/action_controller/respond_with.rb:207:in `respond_with'
  devise (4.1.1) app/controllers/devise/registrations_controller.rb:23:in `create'
  actionpack (4.2.3) lib/action_controller/metal/implicit_render.rb:4:in `send_action'
  actionpack (4.2.3) lib/abstract_controller/base.rb:198:in `process_action'
  actionpack (4.2.3) lib/action_controller/metal/rendering.rb:10:in `process_action'
  actionpack (4.2.3) lib/abstract_controller/callbacks.rb:20:in `block in process_action'
  activesupport (4.2.3) lib/active_support/callbacks.rb:115:in `call'
  activesupport (4.2.3) lib/active_support/callbacks.rb:115:in `call'
  activesupport (4.2.3) lib/active_support/callbacks.rb:553:in `block (2 levels) in compile'
  activesupport (4.2.3) lib/active_support/callbacks.rb:503:in `call'
  activesupport (4.2.3) lib/active_support/callbacks.rb:503:in `call'
  activesupport (4.2.3) lib/active_support/callbacks.rb:88:in `run_callbacks'
  actionpack (4.2.3) lib/abstract_controller/callbacks.rb:19:in `process_action'
  actionpack (4.2.3) lib/action_controller/metal/rescue.rb:29:in `process_action'
  actionpack (4.2.3) lib/action_controller/metal/instrumentation.rb:32:in `block in process_action'
  activesupport (4.2.3) lib/active_support/notifications.rb:164:in `block in instrument'
  activesupport (4.2.3) lib/active_support/notifications/instrumenter.rb:20:in `instrument'
  activesupport (4.2.3) lib/active_support/notifications.rb:164:in `instrument'
  actionpack (4.2.3) lib/action_controller/metal/instrumentation.rb:30:in `process_action'
  actionpack (4.2.3) lib/action_controller/metal/params_wrapper.rb:250:in `process_action'
  actionpack (4.2.3) lib/abstract_controller/base.rb:137:in `process'
  actionview (4.2.3) lib/action_view/rendering.rb:30:in `process'
  actionpack (4.2.3) lib/action_controller/metal.rb:196:in `dispatch'
  actionpack (4.2.3) lib/action_controller/metal/rack_delegation.rb:13:in `dispatch'
  actionpack (4.2.3) lib/action_controller/metal.rb:237:in `block in action'
  actionpack (4.2.3) lib/action_dispatch/routing/route_set.rb:76:in `call'
  actionpack (4.2.3) lib/action_dispatch/routing/route_set.rb:76:in `dispatch'
  actionpack (4.2.3) lib/action_dispatch/routing/route_set.rb:45:in `serve'
  actionpack (4.2.3) lib/action_dispatch/routing/mapper.rb:49:in `serve'
  actionpack (4.2.3) lib/action_dispatch/journey/router.rb:43:in `block in serve'
  actionpack (4.2.3) lib/action_dispatch/journey/router.rb:30:in `each'
  actionpack (4.2.3) lib/action_dispatch/journey/router.rb:30:in `serve'
  actionpack (4.2.3) lib/action_dispatch/routing/route_set.rb:821:in `call'
  warden (1.2.6) lib/warden/manager.rb:35:in `block in call'
  warden (1.2.6) lib/warden/manager.rb:34:in `catch'
  warden (1.2.6) lib/warden/manager.rb:34:in `call'
  rack (1.6.4) lib/rack/etag.rb:24:in `call'
  rack (1.6.4) lib/rack/conditionalget.rb:38:in `call'
  rack (1.6.4) lib/rack/head.rb:13:in `call'
  actionpack (4.2.3) lib/action_dispatch/middleware/params_parser.rb:27:in `call'
  actionpack (4.2.3) lib/action_dispatch/middleware/flash.rb:260:in `call'
  rack (1.6.4) lib/rack/session/abstract/id.rb:225:in `context'
  rack (1.6.4) lib/rack/session/abstract/id.rb:220:in `call'
  actionpack (4.2.3) lib/action_dispatch/middleware/cookies.rb:560:in `call'
  actionpack (4.2.3) lib/action_dispatch/middleware/callbacks.rb:29:in `block in call'
  activesupport (4.2.3) lib/active_support/callbacks.rb:84:in `run_callbacks'
  actionpack (4.2.3) lib/action_dispatch/middleware/callbacks.rb:27:in `call'
  actionpack (4.2.3) lib/action_dispatch/middleware/reloader.rb:73:in `call'
  actionpack (4.2.3) lib/action_dispatch/middleware/remote_ip.rb:78:in `call'
  actionpack (4.2.3) lib/action_dispatch/middleware/debug_exceptions.rb:17:in `call'
  actionpack (4.2.3) lib/action_dispatch/middleware/show_exceptions.rb:30:in `call'
  railties (4.2.3) lib/rails/rack/logger.rb:38:in `call_app'
  railties (4.2.3) lib/rails/rack/logger.rb:20:in `block in call'
  activesupport (4.2.3) lib/active_support/tagged_logging.rb:68:in `block in tagged'
  activesupport (4.2.3) lib/active_support/tagged_logging.rb:26:in `tagged'
  activesupport (4.2.3) lib/active_support/tagged_logging.rb:68:in `tagged'
  railties (4.2.3) lib/rails/rack/logger.rb:20:in `call'
  actionpack (4.2.3) lib/action_dispatch/middleware/request_id.rb:21:in `call'
  rack (1.6.4) lib/rack/methodoverride.rb:22:in `call'
  rack (1.6.4) lib/rack/runtime.rb:18:in `call'
  activesupport (4.2.3) lib/active_support/cache/strategy/local_cache_middleware.rb:28:in `call'
  rack (1.6.4) lib/rack/lock.rb:17:in `call'
  actionpack (4.2.3) lib/action_dispatch/middleware/static.rb:116:in `call'
  rack (1.6.4) lib/rack/sendfile.rb:113:in `call'
  railties (4.2.3) lib/rails/engine.rb:518:in `call'
  railties (4.2.3) lib/rails/application.rb:165:in `call'
  /Users/Phil/Library/Application Support/Pow/Versions/0.5.0/node_modules/nack/lib/nack/server.rb:155:in `handle'
  /Users/Phil/Library/Application Support/Pow/Versions/0.5.0/node_modules/nack/lib/nack/server.rb:109:in `rescue in block (2 levels) in start'
  /Users/Phil/Library/Application Support/Pow/Versions/0.5.0/node_modules/nack/lib/nack/server.rb:106:in `block (2 levels) in start'
  /Users/Phil/Library/Application Support/Pow/Versions/0.5.0/node_modules/nack/lib/nack/server.rb:96:in `each'
  /Users/Phil/Library/Application Support/Pow/Versions/0.5.0/node_modules/nack/lib/nack/server.rb:96:in `block in start'
  /Users/Phil/Library/Application Support/Pow/Versions/0.5.0/node_modules/nack/lib/nack/server.rb:76:in `loop'
  /Users/Phil/Library/Application Support/Pow/Versions/0.5.0/node_modules/nack/lib/nack/server.rb:76:in `start'
  /Users/Phil/Library/Application Support/Pow/Versions/0.5.0/node_modules/nack/lib/nack/server.rb:12:in `run'
  /Users/Phil/Library/Application Support/Pow/Versions/0.5.0/node_modules/nack/bin/nack_worker:4:in `<main>'

  Rendered /Users/Phil/.rvm/gems/ruby-2.2.1/gems/actionpack-4.2.3/lib/action_dispatch/middleware/templates/rescues/_source.erb (5.4ms)
  Rendered /Users/Phil/.rvm/gems/ruby-2.2.1/gems/actionpack-4.2.3/lib/action_dispatch/middleware/templates/rescues/_trace.html.erb (4.1ms)
  Rendered /Users/Phil/.rvm/gems/ruby-2.2.1/gems/actionpack-4.2.3/lib/action_dispatch/middleware/templates/rescues/_request_and_response.html.erb (1.4ms)
  Rendered /Users/Phil/.rvm/gems/ruby-2.2.1/gems/actionpack-4.2.3/lib/action_dispatch/middleware/templates/rescues/diagnostics.html.erb within rescues/layout (115.4ms)


text:
Q: PL/SQL how to return whole record I want to do a function that assumes a certain value. Then this value is searched in three columns, if it is found then it is returned, if not then the function will be terminated.
I am asking for tips on how I can solve it, I want to return the whole record.
create or replace FUNCTION BUS_PROV_GET_TEST(valueGet IN VARCHAR2)
    RETURN
         BUS_PROV_CONF%ROWTYPE
         IS
         V_ROW BUS_PROV_CONF%ROWTYPE ;
    BEGIN
    DECLARE
        V_BUS_PROV  BUS_PRO_CONF.bus_provider%TYPE;
        V_TRA_NAME   bus_prov_conf.tr_name%TYPE;
        V_CU_ID bus_prov_conf.cu_id%TYPE;
    BEGIN
         SELECT *
          INTO V_ROW
          FROM BUS_PROV_CONF
         WHERE bus_prov = valueGet
           AND Upper(BUS_PROV) = Upper (valueGet)
          ;
    EXCEPTION
        WHEN no_data_found THEN
            BEGIN
                SELECT *
                  INTO V_ROW
                  FROM BUS_PROV_CONF
                 WHERE tra_na = valueGet
                   AND Upper(TRA_NA) = Upper (valueGet)
                   ;
            EXCEPTION
            WHEN no_data_found THEN
                BEGIN
                    SELECT *
                      INTO V_ROW
                      FROM BUS_PROV_CONF
                     WHERE cu_id = valueGet
                       AND Upper(CU_ID) = Upper (valueGet)
                       ;
                EXCEPTION
                    WHEN no_data_found
                    then
                     raise_application_error(-20000, 'Not found');
                END;
            END;
           END;
    END BUS_PROV_GET_TEST;

Table looks at follows :
create TABLE "BUS_PROV_CONF"
(
BUS_PROV varchar2(256),
T_NAME varchar2(256),
C_ID varchar2(256),
NOT_TYPE varchar2(256),
PRO_TYPE varchar2(256),
BILL_AC_ID varchar2(256),
MAIL_ADD varchar2(256)
);

The star at the SELECT is underlined and I am getting PLS-00382 .

A: I think the best approach here is to use cursors. I tried to rewrite the code and here what I have. Try this out.
Not sure it'd work though, I did not have the possibility to run this.
create or replace FUNCTION BUS_PROV_GET_TEST(valueGet IN VARCHAR2) RETURN bus_prov_conf%ROWTYPE
IS
  V_ROW bus_prov_conf%ROWTYPE;
  V_BUS_PROV  bus_provi_conf.bus_prov%TYPE;
  V_TRAD_NAME   bus_prov_conf.trad_name%TYPE;
  V_CUS_ID bus_prov_conf.cus_id%TYPE;

  cursor c1 is
    SELECT *
      INTO V_ROW
      FROM BUS_PROV_CONF
     WHERE bus_prov = valueGet
       AND Upper(BUS_PROV) = Upper(valueGet);

  cursor c2 is
    SELECT *
      INTO V_ROW
      FROM BUS_PROV_CONF
     WHERE trad_name = valueGet
       AND Upper(TRAD_NAME) = Upper(valueGet);

  cursor c3 is
    SELECT *
      INTO V_ROW
      FROM BUS_PROV_CONF
     WHERE cus_id = valueGet
       AND Upper(CUS_ID) = Upper(valueGet);

  c1_r c1%rowtype;
  c2_r c2%rowtype;
  c3_r c3%rowtype;

BEGIN
  open c1;
  fetch c1 into c1_r;
  if c1%notfound then
    open c2;
    fetch c2 into c2_r;
    if c2%notfound then
      open c3;
      fetch c3 into c3_r;
      if c3%notfound then
        raise_application_error(-20000, 'Not found');
      else
        V_ROW := c3_r;
      end if;
      close c3%rowtype;
    else
      V_ROW := c2_r;
    end if;
    close c2;
  else
    V_ROW := c1_r;
  end if;
  close c1

  return v_row;
EXCEPTION
  when others then
    if c1%isopen then
      close c1;
    end if;

    if c2%isopen then
      close c2;
    end if;

    if c3%isopen then
      close c3;
    end if;
    raise;
END BUS_PROV_GET_TEST;

A: You have an extra BEGIN and DECLARE in your code. The IS keyword is all you need before your declarations.
Additionally, maybe it would make more sense to use one query that either uses UNION or OR statements for the different columns instead of relying on exception catching? Just a thought.
create or replace FUNCTION BUSINESS_PROVIDER_GET_TEST(valueGet IN VARCHAR2)
  RETURN  business_provider_configuration%ROWTYPE IS
    V_ROW business_provider_configuration%ROWTYPE ;
    V_BUSINESS_PROVIDER  business_provider_configuration.business_provider%TYPE;
    V_TRADING_NAME   business_provider_configuration.trading_name%TYPE;
    V_CUSTOMER_ID business_provider_configuration.customer_id%TYPE;
  BEGIN
    SELECT *
      INTO V_ROW
      FROM BUSINESS_PROVIDER_CONFIGURATION
     WHERE business_provider = valueGet
       AND Upper(BUSINESS_PROVIDER) = Upper (valueGet)
    union
    SELECT *
      FROM BUSINESS_PROVIDER_CONFIGURATION
     WHERE trading_name = valueGet
       AND Upper(TRADING_NAME) = Upper (valueGet)
    union
    SELECT *
      FROM BUSINESS_PROVIDER_CONFIGURATION
     WHERE customer_id = valueGet
       AND Upper(CUSTOMER_ID) = Upper (valueGet);
  EXCEPTION
    WHEN no_data_found THEN
    raise_application_error(-20000, 'Not found');
 END BUSINESS_PROVIDER_GET_TEST;


text:
Q: cannot reach my inner breakpoint I'm running the following code:
 hashedUrlDataList.Select(mDalHashedUrlData.Save);

I have put a breakpoint  in the called delegate,
public HashedUrlData Save(HashedUrlData item)
    {
//breakpoint here
           }

but it doesn't stop there.
How can I fix this?

A: Your method will be called when you'll enumerate the result of Select() not when declared.

A: Enumerable.Select is Lazy.
Try this and tell me if your break point is caught
hashedUrlDataList.Select(mDalHashedUrlData.Save).ToList();

Or the basic:
hashedUrlDataList.Select(mDalHashedUrlData.Save).GetEnumerator().MoveNext()

It just works if you have at least one element.
You can do it too:
    hashedUrlDataList.Select(mDalHashedUrlData.Save).Any();

Any() do the same that GetEnumerator().MoveNext()
I think that what you want is:
List<HashedUrlData> hashedUrlDataList = new List<HashedUrlData>();
hashedUrlDataList.ForEach(Save);

A: LINQ is for querying data; it's not intended to cause side-effects.
If you're more interested in the side efects of your Savemethod than the HashedUrlData instance it returns, you should really be calling
foreach (HashedUrlData h in hashedUrlDataList)
{
    h.Save();
}

If you will eventually be using the returned values and this is just an intermediate/debugging stage, then by all means use LINQ. Just be aware that Save will only be called as you access each returned value, or call something else that enumerates the whole enumerator as the other answers have shown.


text:
Q: Is it possible to install Steam Os on an APU A4-6300? I've read about Steam OS here:
http://store.steampowered.com/steamos/buildyourown
The problem is I don't know if it will run on my future small htpc with this APU from AMD:
http://www.tiburcc.it/it-it/prodotti/AMD_X2_A4_6300_FM2_+_HD8370D;9721
I don't expect great performances because I'd just like to use little indie games.
The question is:
Will it install and run Steam even if my computer doesn't match the specs?


text:
Q: Django applying custom user permissions I am currently using this method to feed a user the page relevant to them.
def get_user_url(request):
    un = request.user.username
    t = get_template(un + '.htm')
    html = t.render()
    return HttpResponse(http)

I was only expecting a small number of users, each representing a company, so this was not a problem as I could simply have five or six html files with different content.
Now I have been asked to account for multiple users per company, assuming differing permissions for users under the same company.
So I looked at the docs for custom permissions: https://docs.djangoproject.com/en/dev/topics/auth/customizing/#custom-permissions which could work but I might end up with a permissions class with 30 lines looking like below and that strikes me as a bad way to do it.
permissions = (
        ("company1_permission1", "Company 1 Permission 1"),
        ("company1_permission2", "Company 1 Permission 2"),
        ("company2_permission1", "Company 1 Permission 1"),
        ("company2_permission2", "Company 1 Permission 2"),
        ("company3_permission1", "Company 1 Permission 1"),
    )

Is there a way I could add a 'company' field to users and use both the above methods? So the user does not even get to a page unless they are from the right company. Then in that page I apply my custom permissions to the content on that page.
Alternatively is there a better method of achieving this sort of functionality.
I am new to django and python.

A: A good solution is to use the @user_passes_test() decorator.
The docs give a good example for making sure a user's email is from a specific company, which you can easily adapt for your use case:
from django.contrib.auth.decorators import user_passes_test

def email_check(user):
    return user.email.endswith('@example.com')

@user_passes_test(email_check)
def my_view(request):
    ...

The main problem with this approach is that you can't access the request object in your code. A solution would be to use Class Based Views where the UserPassesTestMixin gets access to self.request.


text:
Q: Preparing a csv file splitting data in one cell into multiple lines for hundreds of records I have a .csv data extract from a system that is setup in the following format, the extract cannot be changed but I am wanting to transform the data before loading it into either a Google Sheet, MS Access DB or into a SQL Server DB. It is likely Google Sheets will be used as a proof of concept with the production element being in an SQL Server DB.

id
07/02/2022
08/02/2022
09/02/2022
10/02/2022
11/02/2022

1
/ \
/ \
M \
/ \
/ \

2
/ \
/ \
M \
/ \
/ \

3
I02 I02
/ \
I02 I02
U \
U \

4
I01 M
M M
/ \
/ \
/ \

5
/ \
/ \
/ \
/ \
/ \

The first mark in each column is the morning mark and the last mark is the PM mark. i.e. for record 3 on the 04/02/2022 the AM mark is U and the PM mark is \
The file will have in excess of 300 lines each week so should produce a final file with around 1500 lines (300 lines x 5 days a week)
Each results cell will always have two values recorded in each cell seperated by a space i.e. /[space]\ or M[space]\ The data will be extracted on a weekly basis with the column headers having dates that link to a day of the week, Monday through Friday.
For data analysis further down the pipeline I need to split the data so I end up with something like the below (replicated for the first two rows of my master data only):

Primary ID
id
Date
Period
Mark

1
1
07/02/2022
AM
/

2
1
07/02/2022
PM
|

3
1
08/02/2022
AM
/

4
1
08/02/2022
PM
|

5
1
09/02/2022
AM
M

6
1
09/02/2022
PM
|

7
1
10/02/2022
AM
/

8
1
10/02/2022
PM
|

9
1
11/02/2022
AM
/

10
1
11/02/2022
PM
|

11
2
07/02/2022
AM
/

12
2
07/02/2022
PM
|

13
2
08/02/2022
AM
/

14
2
08/02/2022
PM
|

15
2
09/02/2022
AM
M

16
2
09/02/2022
PM
|

17
2
10/02/2022
AM
/

18
2
10/02/2022
PM
|

19
2
11/02/2022
AM
/

20
2
11/02/2022
PM
|

I've used an array formula using query, split and flatten as explained in this topic to produce the following output  Google Sheets - Transpose & Query
using this formula:
=ARRAYFORMULA(QUERY({"Student", "Date","Mark"; IFERROR(SPLIT(FLATTEN(IF(Master!A2:T="",,Master!A2:A&"♦"&Master!I1:M1&"♦"&Master!I2:M)), "♦"))}, "where Col1 > 0", 1))

id
Date
Mark

1
07/02/2022
/|

1
08/02/2022
/|

1
09/02/2022
M|

The problem I am having is trying to create the duplicate line for the AM/PM element. It dosetn exist as an element on its own, and can oly be attributed by the location of the text element in a cell (first element AM, second element PM)

A: Here is a shared sheet with a possible solution to your problem.
It uses the SPLIT()/FLATTEN() technique but you need a nested version to make it work with your layout.
Here is the formula in it's entirety, but this sample is an easier place from which to understand it and will stay up indefinitely.  It should not be important to do it all with one formula (including headers) since this is a proof of concept.
=ARRAYFORMULA(QUERY(IFERROR(SPLIT(FLATTEN(FLATTEN(OP.Data!A2:A100&"|"&OP.Data!B1:1&"|")&{"AM|","PM|"}&SPLIT(FLATTEN(OP.Data!B2:100)," ")),"|",0,0)),"where Col1 is not null and Col2 is not null"))


text:
Q: Can't update date in aspx to a MS-ACCESS table Hello I'm having problem with updating datatypes
I insert the date in the C# part like this
string strSQL = "INSERT into Frettir (CreatedBy,CreatedOn,Title,Description,Starts,Ends,CatId,SectionId,ArticleExt,Myndatexti,MyndUrAlbumi,NrMyndar) values(?,?,?,?,?,?,?,?,?,?,?,?)";

  cmd.Parameters.Add("@Starts",OleDbType.Date).Value = dstartdate;

but I update in the aspx part like this
UpdateCommand="UPDATE [Frettir] SET [Title]=@Title,[Description]=@Description,[CreatedBy]=@notandaID,[ArticleExt]=@ArticleExt, [Myndatexti]=@Myndatexti,[Starts]=@Starts WHERE [ArticleID]=@id2 "

 <UpdateParameters>
    <asp:Parameter Name="Title" Type="String" />
    <asp:Parameter Name="Description" Type="String" />
    <asp:Parameter Name="notandaID"  Type="int16" />
    <asp:Parameter Name="ArticleExt" Type="String" />
    <asp:Parameter Name="Myndatexti" Type="String" />
    <asp:Parameter Name="Starts" Type="DateTime" />
    <asp:QueryStringParameter Name="id2" QueryStringField="ArticleID" Type="Int32" />
</UpdateParameters>

I get an error Data type mismatch in criteria expression
It seems that there are some type differences between the type that is input in the c# part and the aspx-part
Can anyone help me with this?

A: I just did it once... I assigned the valued using the following code..
com.Parameters.AddWithValue("EmpDoj", EmpDoj.ToShortDateString());

It worked for me.. Thought it could help you as well...
Further, I'm eager to know the answer, why yours was not working...


text:
Q: Shading outside an ellipse This is related to another questions I posted (Shading around circles and ellipses). As I have only gotten a partial answer, I wanted to post a more narrow question to see if I can get the rest figured out.
I have a system of nonlinear equations that yield a circle inside an ellipse. The region of feasibility is inside the circle and outside the ellipse. I found a satisfactory answer for shading inside the circle in my previous question, which will be shown in the answer below.
I am wanting to extend the result to shading outside the ellipse as well. I want to be clear, using filldraw for the surrounding rectangle (the entire axis) does not work (as I have been able to implement it) as it leaves a "haziness" to the axis numbers.
I would prefer to work inside the axis environment as well and keep my functions defined as they are. This would give an approach that would be more flexible for future examples.
In essence the workaround for systems of linear equations is to make a path at the top or bottom of the axis and use them in fillbetween. I am hoping for a similar result here.
The below image shows my current picture. You can see the "haziness" mentioned. I want that region to not be shaded instead.
\documentclass[border=10pt]{standalone}
\usepackage{amsmath,amsthm}
\usepackage{tikz,pgfplots}     %for graphics
\pgfplotsset{compat = newest}     %to run newest version
\usepgfplotslibrary{fillbetween}
\usepackage{xcolor}

\begin{document}
\pagestyle{empty}

\pagecolor{green}

\begin{tikzpicture}
\begin{axis}[
  xmin=-6, xmax=6, ymin=-6, ymax=6,
  axis lines=middle,
  ticklabel style={font=\tiny},
   xtick = {-5,-4,...,5},
  ytick = {-5,-4,...,5},
  xlabel = \(x\),
  ylabel = \(y\),
    legend style={legend pos=north east,font=\tiny}
]

\addplot[name path = A,
   domain=-pi:pi,
   samples=200]({5*sin(deg(x))}, {3*cos(deg(x))});
\addlegendentry{\(\frac{x^{2}}{25} + \frac{y^{2}}{9} = 1\)}

\addplot[name path = B,
   domain=-pi:pi,
   samples=200]({3*sin(deg(x))}, {3*cos(deg(x))});
\addlegendentry{\(x^{2} + y^{2} = 9\)}

\path[name path = C] (0,0) -- (0,0);

    \addplot[only marks,black] coordinates {(0,3) (0,-3)};

      \filldraw[blue!70,opacity=0.4] (-6,-6) rectangle (6,6);

        \filldraw[green,opacity=0.4] (0,0) ellipse (5 and 3);

    \addplot[blue!70,opacity=0.4] fill between [of=B and C];
\end{axis}
\end{tikzpicture}

\end{document}

A: If you do not want your fill to cover your axis, then use the option axis on top. No need to use layers(explicit), opacity or fillbetween.
\documentclass[tikz, border=1cm]{standalone}
\usepackage{pgfplots}
\pgfplotsset{compat=1.18}
\begin{document}
\begin{tikzpicture}
\begin{axis}[
xmin=-6, xmax=6,
ymin=-6, ymax=6,
axis lines=middle,
ticklabel style={font=\tiny},
xtick={-5,-4,...,5},
ytick={-5,-4,...,5},
xlabel=\(x\), ylabel=\(y\),
legend style={legend pos=north east, font=\tiny},
axis on top,
]
\fill[green!40, even odd rule]
   (current axis.south west) rectangle (current axis.north east)
   plot[domain=-pi:pi, samples=50, smooth] ({5*sin(deg(\x))}, {3*cos(deg(\x))}) -- cycle
   plot[domain=-pi:pi, samples=50, smooth] ({3*sin(deg(\x))}, {3*cos(deg(\x))}) -- cycle;
\addplot[domain=-pi:pi, samples=50, smooth]({5*sin(deg(x))}, {3*cos(deg(x))});
\addlegendentry{\(\frac{x^{2}}{25} + \frac{y^{2}}{9}=1\)};
\addplot[domain=-pi:pi, samples=50, smooth]({3*sin(deg(x))}, {3*cos(deg(x))});
\addlegendentry{\(x^{2} + y^{2}=9\)}
\addplot[only marks] coordinates {(0,3) (0,-3)};
\end{axis}
\end{tikzpicture}
\end{document}

A: Perhaps use of layers and clipping would suit you:
\documentclass[border=10pt]{standalone}
\usepackage{amsmath,amsthm}
\usepackage[dvipsnames]{xcolor}
\usepackage{pgfplots}
\usepgfplotslibrary{fillbetween}
\pgfplotsset{compat=newest}
\pagecolor{Dandelion!20}
\begin{document}
\begin{tikzpicture}
  \begin{axis}[
        xmin=-6, xmax=6, ymin=-6, ymax=6,
        axis lines=middle,
        ticklabel style={font=\tiny},
        xtick = {-5,-4,...,5},
        ytick = {-5,-4,...,5},
        xlabel = \(x\),
        ylabel = \(y\),
        legend style={legend pos=north east,font=\tiny},
        layers/my layer set/.define layer set={
          pre main,
          main}{},
        set layers=my layer set,
      ]
    \addplot[
        name path=A,
        domain=-pi:pi,
        samples=200
      ]({5*sin(deg(x))}, {3*cos(deg(x))});
    \addlegendentry{\(\frac{x^{2}}{25} + \frac{y^{2}}{9} = 1\)}
    \addplot[
        name path=B,
        domain=-pi:pi,
        samples=200
      ]({3*sin(deg(x))}, {3*cos(deg(x))});
    \addlegendentry{\(x^{2} + y^{2} = 9\)}
    \path[name path = C] (0,0) -- (0,0);
    \addplot[only marks,black] coordinates {(0,3) (0,-3)};
    \addplot[blue!30] fill between [of=B and C];
    \begin{pgfonlayer}{pre main}
      \clip (-6,-6) rectangle (6,6) (0,0) ellipse (5 and 3);
      \fill[blue!30] (-6,-6) rectangle (6,6);
    \end{pgfonlayer}
  \end{axis}
\end{tikzpicture}
\end{document}


text:
Q: Slow Javascript Remoting on First Call I have a VF page that calls a search method from my class using Javascript Remoting.  I found that the very first call for the day takes a very long time, and often goes over the timeout (I currently have it set to the max 2 mins).;
After that very first call, all others take a second or less.
It seems maybe something is being cached, and rebuilding that cache in the morning takes a long time?  Any of you guys run into this issue before and any thoughts on how to fix?
This is an ongoing project, and so far when I need to demo, I would make sure I run through the page first before showing it to others.  But here have been some times when a user loaded the page in the morning before I got to it, and they ran into the slow first call.
Thanks


text:
Q: Allwinner A13 hang on boot and return "SPL:Unsupported Boot Device!" error I am new in here and I am sorry my bad English.
I have OLinuXino A13 board. I endeavor kernel and boot events. So I try boot OLinuxino-A13 via spiflash(in FEL mode). I connected board to my PC(USB OTG). I Sending commands from my computer for writing to spiflash. And differently I build second connect with usb-ttl. So I can see opening writing of board with CuteCom program from my PC. And I use sunxi-tools for write to spiflash of my board.
And I did this:
I compiled kernel and I created u-boot-sunxi-with-spl.bin file. After I entered FEL mode and I wrote this file to on my board with ./sunxi-fel spiflash-write 0 /path/u-boot-sunxi-with-spl.bin. When I use boot my board from PC with ./sunxi-fel uboot /path/u-boot-sunxi-with-spl.bin, my board start and it work for find to sd card. Result this:
U-Boot SPL 2019.04-rc1-00141-g63f7e3fca3 (Feb 19 2019 - 17:23:48 +0300)
DRAM: 512 MiB
CPU: 1008000000Hz, AXI/AHB/APB: 3/2/2
Trying to boot from FEL

U-Boot 2019.04-rc1-00141-g63f7e3fca3 (Feb 19 2019 - 17:23:48 +0300) Allwinner Technology

CPU:   Allwinner A13 (SUN5I)
Model: Olimex A13-Olinuxino
I2C:   ready
DRAM:  512 MiB
MMC:   mmc@1c0f000: 0
Loading Environment from FAT... MMC: no card present
Setting up a 1024x768 vga console (overscan 0x0)
In:    serial
Out:   vga
Err:   vga
Allwinner mUSB OTG (Peripheral)
Net:
Warning: usb_ether using MAC address from ROM
eth0: usb_ether
starting USB...
USB0:   USB EHCI 1.00
USB1:   USB OHCI 1.0
scanning bus 0 for devices... 1 USB Device(s) found
scanning bus 1 for devices... 1 USB Device(s) found
   scanning usb for storage devices... 0 Storage Device(s) found
Hit any key to stop autoboot:  2 <0x08><0x08><0x08> 1 <0x08><0x08><0x08> 0
MMC: no card present

Device 0: unknown device

But differently if I restart my board after(card is out of fel mode) ./sunxi-fel spiflash-write 0 /path/u-boot-sunxi-with-spl.bin command. Result this:
U-Boot SPL 2019.04-rc1-00141-g63f7e3fca3 (Feb 19 2019 - 17:23:48 +0300)
DRAM: 512 MiB
CPU: 1008000000Hz, AXI/AHB/APB: 3/2/2
SPL: Unsupported Boot Device!
SPL: failed to boot from all boot devices
### ERROR ### Please RESET the board ###

A13-OLinuxino_defconfig file:
CONFIG_ARM=y
CONFIG_ARCH_SUNXI=y
CONFIG_SPL=y
CONFIG_MACH_SUN5I=y
CONFIG_DRAM_CLK=408
CONFIG_DRAM_EMR1=0
CONFIG_MMC0_CD_PIN="PG0"
CONFIG_USB0_VBUS_DET="PG1"
CONFIG_USB1_VBUS_PIN="PG11"
CONFIG_AXP_GPIO=y
# CONFIG_VIDEO_HDMI is not set
CONFIG_VIDEO_VGA_VIA_LCD=y
CONFIG_VIDEO_VGA_VIA_LCD_FORCE_SYNC_ACTIVE_HIGH=y
CONFIG_VIDEO_LCD_POWER="AXP0-0"
CONFIG_VIDEO_LCD_BL_PWM="PB2"
CONFIG_NR_DRAM_BANKS=1
# CONFIG_SYS_MALLOC_CLEAR_ON_INIT is not set
CONFIG_SPL_I2C_SUPPORT=y
CONFIG_CMD_DFU=y
# CONFIG_CMD_FLASH is not set
CONFIG_CMD_USB_MASS_STORAGE=y
# CONFIG_SPL_DOS_PARTITION is not set
# CONFIG_SPL_PARTITION_UUIDS is not set
CONFIG_DEFAULT_DEVICE_TREE="sun5i-a13-olinuxino"
CONFIG_DFU_RAM=y
CONFIG_FASTBOOT_CMD_OEM_FORMAT=y
CONFIG_AXP_ALDO3_VOLT=3300
CONFIG_CONS_INDEX=2
CONFIG_USB_EHCI_HCD=y
CONFIG_USB_OHCI_HCD=y
CONFIG_USB_MUSB_GADGET=y
CONFIG_SYS_USB_EVENT_POLL_VIA_INT_QUEUE=yONFIG_AXP_ALDO3_VOLT=3300
CONFIG_CONS_INDEX=2
CONFIG_USB_EHCI_HCD=y
CONFIG_USB_OHCI_HCD=y
CONFIG_USB_MUSB_GADGET=y
CONFIG_SYS_USB_EVENT_POLL_VIA_INT_QUEUE=y

I struggle for exceed this error and want to see result like on above. How can I fix this error?


text:
Q: Wrap every new type child into one row Every same child type should wrap in div. The problem is I am getting single array which contains all the children. So I am running loop over it and tried to create new div and close it when children type changed but it is not well written.
fiddle

var items = [{
  "type": "child1",
  "name": "1 "
}, {
  "type": "child1",
  "name": "1 "
}, {
  "type": "child1",
  "name": "1 "
}, {
  "type": "child2",
  "name": "2 "
}, {
  "type": "child2",
  "name": "2"
}, {
  "type": "child3",
  "name": "3 "
}, {
  "type": "child3",
  "name": "3 "
}, {
  "type": "child3",
  "name": "3"
}]
var child = "";
var html = ''

items.forEach(function(item) {
  if (child !== item.type) {
    html += '
'
  }
  html += '
' + item.name + '
';
  if (child !== item.type && child) {
    html += '
'
  }
  child = item.type;

})

document.getElementById('html').innerHTML = html;
div { border:1px solid black }

A: what you should do, is when you check whether child is not the same with item.type, you should add a closing
 and a new open

items.forEach(function(item) {
 if(child != item.type){
    html += '
';
    html += '
';
 }
 html += '
' + item.name + '
';
 child = item.type;
})

demo : https://jsfiddle.net/0sz9xpxq/2/

A: You can try this,
https://jsfiddle.net/trupti11/0sz9xpxq/4/
var html = '
';
items.forEach(function(item) {
      if (child != item.type && child) {
        html += '

'+ item.name;
      }
      else
      {
      html += item.name;
      }
      child = item.type;

    })
    html += '
';

A: Instead of messy text manipulation, you can use document.createElement to do it a lot cleaner. There's a great answer to this SO question that talks about the benefits of using createElement vs adding a string to innerHTML
var child = "";
var html = document.getElementById('html');
var node;

items.forEach(function(item) {
  if (child !== item.type) {
    if (node) {
        html.appendChild(node);
    }
    node = document.createElement('div');
  }
    var newElem = document.createElement('div');
    newElem.innerHTML = item.name;
    node.appendChild(newElem);

  child = item.type;

});

html.appendChild(node);

Fiddle


text:
Q: Iniciando segunda atividade com resultado no Android Tenho dois editText que entro com um in e um botão de calcular. Gostaria de apresentar o resultado em uma segunda atividade assim que pressionasse o botão calcula. Alguém poderia me ajudar nisto?

A: O modelo básico para passar informações entre Acitivities é esse, segundo a documentação do android:
  Intent intent = new Intent(this, OutraActivity.class);
  EditText editText = (EditText) findViewById(R.id.meuEditText);
  String message = editText.getText().toString();
  intent.putExtra("mensagem", message);
  startActivity(intent);

E para pegar na OutraActivity.class:
Intent intent = getIntent();
String message = intent.getStringExtra("mensagem");

Há mais exemplos na documentação, aproveite e dê uma conferida, está em inglês mas é bem ditático.
Referências para estudo:
http://www.ideiasprogramadas.com.br/android-passando-dados-telas/
http://developer.android.com/intl/pt-br/training/basics/firstapp/starting-activity.html
Como eu faço para passar parâmetros do último Fragment para o Fragment anterior?
Passagem de parâmetros de uma Activity para outra


text:
Q: Shared memory - access violation Please tell me, I want to write json to shared memory. StrPCopy if the text is more than 2047 character error "Access violation at 0x004074ba: address entry 0x00381000". I did not find information about the restrictions. Maybe there is another way to write json?
var
    SecurityAttr: TSecurityAttributes;
    SecurityDescr: TSecurityDescriptor;
begin
    InitializeSecurityDescriptor(@SecurityDescr,SECURITY_DESCRIPTOR_REVISION);
    SetSecurityDescriptorDacl(@SecurityDescr,True,nil,False);
    SecurityAttr.nLength:=SizeOf(TSecurityAttributes);
    SecurityAttr.lpSecurityDescriptor:=@SecurityDescr;
    SecurityAttr.bInheritHandle:=True;

    SendMMF := CreateFileMapping($FFFFFFFF, @SecurityAttr, PAGE_READWRITE, 0, 32,PChar('Global\Test'));

    if (SendMMF = 0) then
     Exit;

    SendData := MapViewOfFile(SendMMF, FILE_MAP_WRITE, 0, 0, 0);

    if SendData = nil then
        Exit;

    StrPCopy(SendData, GetJson);

    if Assigned(SendData) then
        Exit;

    if SendMMF.Size > 0 then
        Exit;

    UnmapViewOfFile(SendData);
    SendData := nil;
    CloseHandle(SendMMF);
end;

Test case


text:
Q: How to setup screen splitup using kendo framework? I am a newbie in JS development.I have a class defined in html file.

Pane A

Pane B

I want to use kendo splitter to split the screen in 20:80 ratio.Here is the code of JS file:
            var currViewCtx = viewEvt.view.viewCtx;
            var contentView = currViewCtx.getViewContent().find(".content");
            var Widget = CrudUtils.createFilter();
            if (FilterWidget.Id != null) {
                $(contentView).find("#splitter").kendoSplitter({/////Line x
                    orientation: "horizontal",
                    panes: [{ resizable: false, size: "20%", collapsible: false },
                    { resizable: false, collapsible: false }]
                });
            }

The code doesn't run from Line x .Can anyone help me out with the code?

A: Not sure why you have those contentView stuff. You can just go straight to $("#splitter"). Here is an example of splitting the screen 20:80. You can run this in the Kendo Dojo.

<!DOCTYPE html>

    <meta charset="utf-8"/>
    <title>Kendo UI Snippet</title>

    <link rel="stylesheet" href="https://kendo.cdn.telerik.com/2021.1.119/styles/kendo.default-v2.min.css"/>

Pane A

Pane B


text:
Q: CakePHP 3 form template set to default I have 2 forms in a page.
For the 1sz one I do not want to use templates, for the 2nd I want. So for the 2nd form I use this.
echo $this->Form->create();
$this->Form->templates([
    'inputContainer' => '
{{content}}
'
     ]);

It seems this template is applied to the 1st form also. How to prevent this?

A: By passing the templates you want to use for that specific form to the corresponding create() call.
echo $this->Form->create(null, [
    'templates' => [
        'inputContainer' => '
{{content}}
'
    ]
]);

http://api.cakephp.org/3.0/class-Cake.View.Helper.FormHelper.html#_create


text:
Q: Find highest Value among duplicates in a table (Oracle) I have a table with duplicate values as shown below.

I would like to find the latest start time among the events. Expected output is

I used the below query but it seems to get the latest start time in the entire table.
SELECT ID,
EVENT,
START_TIME,
LAST_VALUE(START_TIME) OVER (ORDER BY ID,EVENT RANGE BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS latest_start_time
FROM
(Select * from EVENTS)
order by ID,EVENT;

I know I am missing something, probably a group by. Can you please help me out. I am using ORACLE.

A: You just need the MAX analytic function and partition on id and event.
SELECT ID,
       EVENT,
       START_TIME,
       MAX(START_TIME) OVER (PARTITION BY id, event) AS latest_start_time
FROM   EVENTS
order by ID,EVENT;

A: Try
SELECT DISTINCT
   ID,
   EVENT,
   START_TIME,
   MAX(START_TIME) OVER (PARTITION BY ID, EVENT) AS latest_start_time
FROM EVENTS
order by ID,EVENT;


text:
Q: Meaning of `x_List` What does x_List mean? I've seen many people use it but can't seem to find it in any of the Mathematica documentation.
An example:
DeleteCases[expVars, Null] //. {x_List} :> x

What is happening in that RuleDelayed expression?

A: The pattern _List matches any expression with head List.
Recommended reading:

*

*http://reference.wolfram.com/language/tutorial/Patterns.html

*Blank  (_h or Blank[h] can stand for any expression with head h.)


text:
Q: Call a static method from a .NET atribute In .NET can I call a static method from an attribute.  Something like this
<PrincipalPermission(SecurityAction.Demand, Role:="<call static method>")>

The reason I want to do this is because I want the method to do some logic based on the environment I am in and allow the user access or not
Is this possible?

A: Attribute parameters are hard-coded in the assembly at compile time.
That is completely impossible.

A: You can do this by using custom attributes, take a look to this: https://msdn.microsoft.com/en-us/library/84c42s56(v=vs.110).aspx


text:
Q: android java add edit contacts google accounts I want to access (add, edit) contacts of Google accounts on an android device. I'm using Android Studio.
I've found couple posts on  http://stackoverflow.com:
Android - sync contact add programatically to google account
Xml model for adding contact to google contacts
However, first mentions problem and have no answer, second has only some parts of code and both do not show how to choose account if there are sereral on a device.
I foresee it could be considered broad question, however, if OK, please advice how to do my task with less code and setup (e.g. Maven or jar libraries or else) and with specific code samples - via Google API or some other way?

A: I think you'll be better off delegating this kind of work to the system, using Intents. You can have a look at how Google recommends to do it here
I hope this helps!


text:
Q: Laravel datatables draw parameter always 0 In my Laravel application, I'm using Yarja datatables. Local it works perfectly. On the test server, it works also perfect. But on the customer server, paginate, sort and search doesn't work. I found out that the request contains a draw var and also the response.
This var is counted from 1 up. On the test server the draw-var in request is always the same like in the response. But on the customer server, the draw-var int the request is counted correctly, but in the response the draw-var is always 0.
Request:

Response:

What can be the error? I have no idea where I have to search.


text:
Q: Is it possible to launch Firefox with a specific about:config setting from the terminal? I'm dealing with a site which does not play well with my operating system unless I override my user agent string. (Then it performs perfectly, so I'm chalking this up to an inexperienced person being given objectively the wrong job...)
However, I do not want to leave that user agent string consistently changed. Unfortunately, Firefox does not allow for simply disabling a setting, and this is a fairly long string to remember. I'm wondering, because of that, if it is possible for me to simply launch it from terminal with a parameter that adds this specific about:config setting?
If not, is there a proxy that might allow me to mask it? I'm just looking for a quick and effective solution here, which requires less work than re-entering a lengthy about:config string and potentially restarting my browser.
Thanks to anyone who thinks they may have a solution for me.

A: What you can do is to create second Firefox profile, change this setting in this second profile and run firefox:
firefox -p name_of_profile

The good point is both profiles will be independent and you can run two instances of Firefox simultaneously with different profile.


text:
Q: implementing a spinner type object in a class as a subprocess I'm a total beginner and only started doing classes today, and im trying to make a sort of 'spinner' object i can call something like this: One of the things im confused about is whether to use 'thread', 'threading' or 'processes'. I just read somewhere that an instance of a thread costs 8meg, as this is a simple text spinner thing, it doesnt warrant using a huge amount of memory. My first question is which module should I use, and my second is how do implement this in a class so i can call it like this:
spin.start() - starts it

spin.stop() -  stops it

spin.cursor_invisible() - turns the cursor invisible

spin.cursor_visible() - cursor visible!

I copied some code and read some books but Im a bit confused, what I have so far is this: i put some comments in to show how ignorant I am. I have been reading a lot though, honest! Its kind of a large thing to get your head around.
spinner="▏▎▍▌▋▊▉█▉▊▌▍▎" #utf8

#convert the utf8 spinner string to a list
chars=[c.encode("utf-8") for c in unicode(spinner,"utf-8")]

class spin():   # not sure what to put in the brackets was (threading.Thread, but now im not sure whether to use processes or not)

    def __init__(self):
            super(spin, self).__init__() # dont understand what this does
            self._stop = threading.Event()

    def run (self):
            threading.Thread(target = self).run()
            pos=0
            while not self._stop:
                    sys.stdout.write("\r"+chars[pos])
                    sys.stdout.flush()
                    time.sleep(.15)
                    pos+=1
                    pos%=len(chars)

    def cursor_visible(self):
            os.system("tput cvvis")
    def cursor_invisible(self):
            os.system("tput civis")
    def stop(self):
            self._stop.set() #the underscore makes this a private variable ?
    def stopped(self):
            return self._stop.isSet()

A: I have altered your code slightly. Now it runs! First a commented version:
The first line tells python that this source file contains utf-8 characters
# -*- coding: utf-8 -*-

Then you need to import all the stuff that you will eventually use. You dont have to do it at the top of the file like this, but I'm a C guy and this is how I like it...
import threading
import sys
import time
import os

spinner="▏▎▍▌▋▊▉█▉▊▌▍▎" #utf8

#convert the utf8 spinner string to a list
chars=[c.encode("utf-8") for c in unicode(spinner,"utf-8")]

class spin(threading.Thread):   # not sure what to put in the brackets was (threading.Thread, but now im not sure whether to use processes or not)

Threading is fine for this
    def __init__(self):
        super(spin,self).__init__() # dont understand what this does

Since you are overriding the init method of threading.Thread with your own init you need to call the parent class's init to make sure the object is properly initiated.
        self._stop = False

I changed this to a boolean. The threading.Event is overkill for this.
    def run (self):
        pos=0
        while not self._stop:
            sys.stdout.write("\r"+chars[pos])
            sys.stdout.flush()
            time.sleep(.15)
            pos+=1
            pos%=len(chars)

    def cursor_visible(self):
        os.system("tput cvvis")
    def cursor_invisible(self):
        os.system("tput civis")
    def stop(self):
        self._stop = True  #the underscore makes this a private variable ?

Sort of. It's not actually private, the underscore just tells everyone that it's bad form to acces it.
    def stopped(self):
        return self._stop == True

And finally a small test of the code:
if __name__ == "__main__":
    s = spin()
    s.cursor_invisible()
    s.start()
    a = raw_input("")
    s.stop()
    s.cursor_visible()

And here is the uncommented version...
# -*- coding: utf-8 -*-

import threading
import sys
import time
import os

spinner="▏▎▍▌▋▊▉█▉▊▌▍▎" #utf8

#convert the utf8 spinner string to a list
chars=[c.encode("utf-8") for c in unicode(spinner,"utf-8")]

class spin(threading.Thread):   # not sure what to put in the brackets was (threading.Thread, but now im not sure whether to use processes or not)

    def __init__(self):
        super(spin,self).__init__() # dont understand what this does
        self._stop = False

    def run (self):
        pos=0
        while not self._stop:
            sys.stdout.write("\r"+chars[pos])
            sys.stdout.flush()
            time.sleep(.15)
            pos+=1
            pos%=len(chars)

    def cursor_visible(self):
        os.system("tput cvvis")
    def cursor_invisible(self):
        os.system("tput civis")
    def stop(self):
        self._stop = True  #the underscore makes this a private variable ?
    def stopped(self):
        return self._stop == True

if __name__ == "__main__":
    s = spin()
    s.cursor_invisible()
    s.start()
    a = raw_input("")
    s.stop()
    s.cursor_visible()


text:
Q: Historical question about modularity of CM curves I'm looking for the answer of who first proved modularity of CM curves?  That is if $E$ is an elliptic curve over $\mathbb{Q}$ which has complex multiplication then there's a non-constant morphism from $X_0(N)$ to $E$ for some $N$ (not necessarily the conductor).  The possible names that I've thought of are Hecke, Deuring, Weil or Shimura.  Does anybody know something more definite?

A: Dear Victor,
I believe it was Shimura in the paper On elliptic curves with complex multiplication as factors of the Jacobians of modular function fields, Nagoya Math. J. 43 (1971), 199–208.
Regards,
Matthew


text:
Q: Windows 7 VPC Beta mouse release I am running Windows 7 RC and just downloaded the VPC Beta.  I've created a new VM and every time I click in it I can't get it to release my mouse.
What is the keystroke to get it to release?  I tried Left Alt, Right Alt and Both keys.  It seems to be different then in the previous version.

A: Turns out that Windows 7 version of VPC (the VPC Beta) uses [Alt]+[CTRL]+[Left Arrow].
On previous versions of VPC the keys are [Right Alt] + [Enter] for full screen, and [Right Alt] + [Del] for [Ctrl]+[Alt]+[Del].

A: Try right control, or control-alt


text:
Q: Constructivist defininition of linear subspaces of $\mathbb{Q}^n$? Let me preface this by saying I'm not someone who has every studied mathematical logic or philosophy of math, so I may be mangling terminology here (and the title is a little tongue in cheek).
I (and probably most of us) would define a linear subspace, $W$ of $\mathbb{Q}^n$ to be a non-empty set of vectors that is closed under vector addition and scalar multiplication.  This definition has the ``drawback" of not having a constructive (as far as I can tell) way to choose a basis of $W$.
Alternatively, one could define a subspace $W$, of $\mathbb{Q}^n$ to just be a set which is the span of some finite collection of vectors, i.e. $W=\mathrm{span}\{ w_1, \ldots, w_N\}$.  This is a much clunkier definition (in my opinion) but does have the advantage of allowing one to construct a basis by using Gaussian elimination.  It has the ``drawback" that showing that the kernel of a matrix is a subspace is slightly non-trivial (though still constructive).
Naively, the second definition defines a smaller set of objects than the first, but it seems that in most philosophies of math they actually define the same set of objects.
My questions:
1) Is the second definition actually how a constructivist would define subspace?
2) Are there any system of axioms where the two definitions are really different?
3) Are there any reasons to prefer the first definition to the second definition besides taste?
This question comes out of something that always bothers me when I teach the service course in Linear Algebra.  Namely, I usually define (as does the textbook) a subspace using the first definition, but in practice only ever have students consider subspaces that are defined by the second one (or equally concretely as kernels of matrices).  Pedagogically, I sometimes wonder how much is being gained by using this first definition (as it doesn't fit in with the extremely explicit nature of the rest of the course).
Edit: Following @darijgrinberg remarks I've changed $\mathbb{R}^n$ to $\mathbb{Q}^n$.

A: To answer question 2 (although perhaps not under a "system of axioms"), here is a simpleminded example showing that if the definitions are equivalent (even just for $n=1$), then $p\lor\neg p$ is $\top$ for any truth value $p$, i.e. the Law of Excluded Middle holds.  Given a truth value $p$ consider the subspace $\mathscr{V} = \{r\in\mathbb{Q} : (r=0) \lor p \} = \{0\} \cup \{r\in\mathbb{Q} : p\}$. Clearly this contains zero and is closed under addition and multiplication by $\mathbb{Q}$. But if $\mathscr{V}$ is the span of of a finite family $r_1,\ldots,r_m$ of elements, using the fact that each element of $\mathbb{Q}$ satisfies $(r=0) \lor\neg (r=0)$ (and proceeding by induction on $m$), either every element of the family is zero (in which case $\neg p$) or there is one which is nonzero (in which case it is invertible so $\mathscr{V}$ contains $1$, so $p$ is true).  So we have $p\lor\neg p$.
To make this perhaps more transparent, here is a sheaf model of this situation: let $X$ be a topological space, $U \subseteq X$ be an open set such that the union of $U$ and of the largest open set $\neg U$ disjoint with $U$ is not $X$.  And consider the subsheaf $\mathscr{V}$ of the constant sheaf $\mathbb{Q}_X$ (sheaf of locally constant $\mathbb{Q}$-valued functions) consisting of those locally constant $r\colon W\to\mathbb{Q}$ (for varying open $W\subseteq X$) which are identically zero outside of $U$.  This is a $\mathbb{Q}_X$-module subsheaf of $\mathbb{Q}_X$ which cannot be spanned by global sections.
Note that while my example is not spanned by a finite set $r_1,\ldots,r_m$, there is a "subfinite"(?) set $\{1 : p\}$ (meaning $\{r\in\mathbb{Q} : (r=1) \land p\}$) which spans $\mathscr{V}$ (because each element of $\mathscr{V}$, either is zero in which case it is the linear combination of the empty set, or is not zero, in which case $p$, in which case the element is the linear combination of $1$ with itself as coefficient).  I guess this set is even a basis of $\mathscr{V}$, though I'm not sure there aren't many subtly inequivalent definitions.

A: Your question almost answers itself, but this may not be so obvious. So I will try to give a short and clear answer.
Regarding 1) of your question:
As a mathematician well-schooled in intuitionistic and constructive mathematics, I would always consider more than one constructive notion of 'linear subspace'.
Your first definition is definitely my favourite for the purest definition. So I would say: $(A,+,\cdot, k)$ is a linear subspace of $(V, +,\cdot, k)$ iff $A\subseteq V$ is closed under addition and scalar multiplication.
Important extra features would be to say that $(A,+,\cdot, k)$ is a finitely generated linear subspace iff there are $a_1,\ldots,a_n$ in $A$ such that $A=\mathrm{span}\{a_1,\ldots,a_m\}$, and a finite-dimensional linear subspace iff there is a basis $(a_1,\ldots,a_m)$ of $A$.
For $\mathbb{Q}^n$, any finitely generated linear subspace is a finite-dimensional linear subspace, since the equality of elements is decidable on $\mathbb{Q}^n$. But this does not hold for $\mathbb{R}^n$, and so for $\mathbb{R}^n$ we can have a finitely generated subspace which is not provably finite-dimensional. Brouwer gave many examples of such situations.
Regarding 2) of your question:
In intuitionistic mathematics one can easily prove that not all linear subspaces of $\mathbb{Q}^n$ are finitely generated.
Regarding 3) of your question:
Yes, there is a reason to favour your first definition over the second, because in many constructive situations we do not explicitly have a finite set of generators, and still we can do a lot of worthwhile stuff with an $A$ which is closed under addition and scalar multiplication.

[update to reflect the comments below:]
As an indication of constructive situations where linear subspaces of $\mathbb{Q}^2$ which are 'not' finitely generated occur, let me give the following example (a bit contrived to keep it simple, but in higher math these situations are commonplace).
For $\alpha$ in $\{0,1\}^{\mathbb{N}}$  define $V_{\alpha}=\{(0,0)\}\cup\{r\cdot (0,1)\mid r \in\mathbb{Q}\mid \exists n\in\mathbb{N}[\alpha(n)=1]\}$.
Now for an arbitrary $\alpha$ the assertion that $V_{\alpha}$ is finitely generated implies that $\alpha=\underline{0}$ or $\alpha\neq\underline{0}$. We cannot constructively assert the latter for all $\alpha$ in $\{0,1\}^{\mathbb{N}}$, so if we want to prove something for all $V_{\alpha}$ we are stuck with 'non-finitely generated' linear subspaces of $\mathbb{Q}^2$. And in many situations like this often only the closedness of $V_{\alpha}$ under addition and scalar multiplication is necessary to produce a nice general theorem.


text:
Q: jquery Current Nav item selector I can't figure out how to use jQuery to style the current nav item. I've tried several tutorials and such to no avail. Any help would be appreciated.
Thanks in advance.

Contact

Gallery

Pool Liners

Services

About

Home

   /** nav styling **/

   //<![CDATA[
    jQuery(function() {
     jQuery('#nav li').each(function() {
      var href = jQuery(this).find('a').attr('href');
      if (href === window.location.pathname) {
      jQuery(this).addClass('current');
       }
      });
    });
  //]]>

A: You can use the Attribute Equals Selector [name="value"] to find out the nav item with the current path.
$(document).ready(function () {
    var str = location.href.toLowerCase();
    var item  = $('#nav li a[href="' + str  + '"]');
    if(item.length){
        $("li.current").removeClass("current");
        item.parent().addClass("current");
    }
})

Demo: Fiddle

A: I figured it out!! Thanks for your help Will.i.am and Arun.p.
THe lines of code below is all I needed after giving body id's to each page.
     /** nav selector **/
     var bodyid = $('body').attr('id');
     $('#main_nav ul li a.'+ bodyid).addClass('current');


text:
Q: Jumping to an excel cell after reading a barcode to see if there is a match I have an excel sheet with barcodes and details of products. I would like to use a barcode scanner to find items associated with those barcodes in my excel sheet (for inventory purposes) and mark them. I would like excel to jump into the corresponding cell. I have tried creating a macro by reading similar posts and this is as far as I have got:
Private Sub CommandButton1_Click()

 Dim code As Variant
 Dim matchedCell As Range

    code = InputBox("Please scan a barcode and hit enter if you need to")
    Set matchedCell = Range("C2:C100").Find(what:=code, LookIn:=xlValues, lookat:=xlWhole, MatchCase:=True)
    If Not matchedCell Is Nothing Then
    Range(matchedCell.Address).Interior.ColorIndex = 6
    Else: MsgBox "Barcode Not Found"
    End If

End Sub

This only highlights the cell. Ideally, I would like to highlight the whole row. I would also like to jump to the corresponding cell. I have no experience in this and I just pulled a couple of different examples that I found online until I got this to work without error message. How can I modify this to add additional functions?
I also have a problem with entering the barcode into the inputbox. All I can do is get it entered into a cell by scanning it or manually enter the number into the input box - how could I make it enter the scanned code into this inputbox? The cursor is in the right place, but that is ignored.
Thank you

A: Private Sub CommandButton1_Click()

    Dim code As Variant Dim matchedCell As Range

    code = InputBox("Please scan a barcode and hit enter if you need to")

    Set matchedCell = Range("C2:C100").Find(what:=code, LookIn:=xlValues, _
                      lookat:=xlWhole, MatchCase:=True)

    If Not matchedCell Is Nothing Then
        With matchedCell
            Application.Goto .Cells(1)
            .Resize(1, 10).Interior.ColorIndex = 6
        End With
    Else
        MsgBox "Barcode Not Found"
    End If

End Sub


text:
Q: How to insert and get .NET web-service data Object to My Android App I have a web-service in .NET it's inserting and retrieving data's from database as object's..
I'll copy some part of web-service here..
   [WebMethod(Description = "This is used to insert details into sql server")]

    public string InsertDetails(DataTable myDetails, string STR1)
    {
        try
        {
            foreach (DataRow row in myDetails.Rows)
            {
                SqlCommand cmd = new SqlCommand();
                cmd.CommandType = CommandType.StoredProcedure;
                cmd.CommandText = "dbo.InsertQry";
                cmd.Parameters.Add(new SqlParameter("@P_no", row["POD_Number"].ToString()));
                cmd.Parameters.Add(new SqlParameter("@P_id", STR1));
                cmd.Parameters.Add(new SqlParameter("@P_author", Convert.ToInt64(row["P_author"])));

                //opening the connection
                cmd.Connection = sqlCon;
                sqlCon.Open();
                int retValue = cmd.ExecuteNonQuery();
                sqlCon.Close();
                if (retValue == 0)
                    return "false";
            }
            return "true";
        }

        catch (Exception ex)
        {
            ErrorLogger(ex);
            return "false";
        }
    }

//-----------------------------------------------------------------------------------
       [WebMethod(Description = "This is used to get details from sql server")]
    public DataSet GetDetails(string STR1)
    {
        DataSet ds = new DataSet();
        try
        {
            SqlCommand cmd = new SqlCommand();
            cmd.CommandType = CommandType.StoredProcedure;
            cmd.CommandText = "dbo.SelectQryFromDB";
            //opening the connection
            cmd.Connection = sqlCon;
            sqlCon.Open();
            ds.DataSetName = "myTbl";
            SqlDataAdapter da = new SqlDataAdapter(cmd);
            da.Fill(ds,"myTbl");
            sqlCon.Close();
            return ds;
        }

        catch (Exception ex)
        {
            ErrorLogger(ex);
            ds.DataSetName = "Error";
            return ds;
        }
    }

//----------------------------
Any-one Help me by providing me the details how can i send those data's and retrieve data's in Android..This is my first application so i don't know much??
Please Provide me details so that i can insert and get data's using web-service??
I heard of kSOAP2 and i'm trying to accomplish this by using kSOAP2..

A: Working in Ksoap can be challenging sometimes. You first need to make sure your webservice is working fine and is giving you the proper result.
If that's done then you can consume the same from Android using ksoap library.
Here are few links that will help solve your problem:
1) How to call a local web service from Android mobile application will help you understand how you need to make a Ksoap call.
2) Inserting data into remote database from Android via ksoap
3) Returning data from server to Android


text:
Q: Appium Error: Cannot read property 'match' of undefined I focused on working on a testautomation for a little flutter app i made all in the favor for my university papers.
The Problem:
When i start an appium server, an android emulator, and my script in python, i get this error message: "UnknownError: An unknown server-side error occurred while processing the command. Original error: Cannot read property 'match' of undefined"
This is the whole error message from the VS Code Terminal:
Traceback (most recent call last): File "c:\Users\XRAYAdmin\Documents\TestAutomation.py", line 9, in <module> driver = webdriver.Remote('http://localhost:4723/wd/hub', dict( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\XRAYAdmin\AppData\Local\Programs\Python\Python311\Lib\site-packages\appium\webdriver\webdriver.py", line 230, in __init__ super().__init__( File "C:\Users\XRAYAdmin\AppData\Local\Programs\Python\Python311\Lib\site-packages\selenium\webdriver\remote\webdriver.py", line 286, in __init__ self.start_session(capabilities, browser_profile) File "C:\Users\XRAYAdmin\AppData\Local\Programs\Python\Python311\Lib\site-packages\appium\webdriver\webdriver.py", line 320, in start_session response = self.execute(RemoteCommand.NEW_SESSION, w3c_caps) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\XRAYAdmin\AppData\Local\Programs\Python\Python311\Lib\site-packages\selenium\webdriver\remote\webdriver.py", line 440, in execute self.error_handler.check_response(response) File "C:\Users\XRAYAdmin\AppData\Local\Programs\Python\Python311\Lib\site-packages\selenium\webdriver\remote\errorhandler.py", line 245, in check_response raise exception_class(message, screen, stacktrace) selenium.common.exceptions.WebDriverException: Message: An unknown server-side error occurred while processing the command. Original error: Cannot read property 'match' of undefined Stacktrace: UnknownError: An unknown server-side error occurred while processing the command. Original error: Cannot read property 'match' of undefined at getResponseForW3CError (C:\Users\XRAYAdmin\AppData\Local\Programs\Appium Server GUI\resources\app\node_modules\appium\node_modules\appium-base-driver\lib\protocol\errors.js:804:9) at asyncHandler (C:\Users\XRAYAdmin\AppData\Local\Programs\Appium Server GUI\resources\app\node_modules\appium\node_modules\appium-base-driver\lib\protocol\protocol.js:380:37)
Here you have the Link to the Appium Server Log


text:
Q: Python Tkinter - How to set the default value of a radiobutton? I've been searching for this a while, but no answers seemed to help me. So. I have this one RadioButton (actually three but don't worry about it) and I want to set the default value of it (the value which represents the unchecked box).
I've tried the "value" option but python doesn't recognize it. Here's what I have:
RadioButton1 = ttk.Checkbutton(frame2radio, text="Bold", width=20, cursor="hand2", underline=True, value=0)

A: ttk.Checkbutton documentation from NMT
"To change the state of a checkbutton through program control, use the .set() method of the associated control variable."
When you create your checkButton, add variable=myVar to the arguments. Then, when you want to select it, you can call myVar.set(1).
Example:
RadioButton1 = ttk.Checkbutton(frame2radio, text="Bold", width=20, cursor="hand2", underline=True, value=0, variable=myVar)
myVar.set(1)

The button will represent this change on the next main window loop or when re-drawn.

If you wanted to do this in a Combobox, as mentioned in your comment, you can select a value from the combobox using the combobox's .set(value) function. Note that value has to be one of the options available in your Combobox.
Example:
myComboBox.set("Option 1")


text:
Q: Why am I getting java.lang.ArithmeticException: divide by zero
E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.marsad.wallpaperapp, PID: 20425
java.lang.ArithmeticException: divide by zero

Hi, When I click on gif image to apply as live wallpaper mostly everything works good but sometime app crash with the error
Logcat

E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.marsad.wallpaperapp, PID: 20425
java.lang.ArithmeticException: divide by zero
at com.marsad.wallpaperapp.GIFWallpaperService$GIFWallpaperEngine.draw(GIFWallpaperService.java:139)
at com.marsad.wallpaperapp.GIFWallpaperService$GIFWallpaperEngine.access$000(GIFWallpaperService.java:82)
at com.marsad.wallpaperapp.GIFWallpaperService$GIFWallpaperEngine$1.run(GIFWallpaperService.java:111)
at android.os.Handler.handleCallback(Handler.java:873)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:224)
at android.app.ActivityThread.main(ActivityThread.java:7139)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:536)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:876)

Here is the full code

public class GIFWallpaperService extends WallpaperService {
    Context context;

    @Override
    public WallpaperService.Engine onCreateEngine() {

        Singleton b = Singleton.getInstance();
        String path = b.getPath();

        try {
            InputStream is = new FileInputStream(path);
            Movie movie = Movie.decodeStream(is);

            return new GIFWallpaperEngine(movie);

        } catch (FileNotFoundException e) {
            e.printStackTrace();
            Toast.makeText(context, "Error: " + e.getMessage(), Toast.LENGTH_SHORT).show();
            return null;
        }

    }

    private class GIFWallpaperEngine extends WallpaperService.Engine {

        private final int frameDuration = 20;
        private SurfaceHolder holder;
        private Movie movie;
        private boolean visible;
        private Handler handler;

        int width;
        int height;

        public GIFWallpaperEngine(Movie movie) {

            this.movie = movie;
            handler = new Handler();

        }

        @Override
        public void onCreate(SurfaceHolder surfaceHolder) {
            super.onCreate(surfaceHolder);

            this.holder = surfaceHolder;

        }

        private Runnable drawGIF = new Runnable() {
            @Override
            public void run() {
                draw();
            }
        };

        private void draw() {

            WindowManager wm = (WindowManager) getApplicationContext().getSystemService(Context.WINDOW_SERVICE);
            Display display = wm.getDefaultDisplay();
            float screenWidth = display.getWidth();
            float screenHeight = display.getHeight();

            width = (int) screenWidth;
            height = (int) screenHeight;

            if (visible) {
                Canvas canvas = holder.lockCanvas();
                canvas.save();

                canvas.scale((float) display.getWidth() / (float) movie.width(),
                        (float) display.getHeight() / (float) movie.height());
                movie.draw(canvas, 0, 0);

                canvas.restore();

                holder.unlockCanvasAndPost(canvas);
                movie.setTime((int) (System.currentTimeMillis() % movie.duration()));

                handler.removeCallbacks(drawGIF);
                handler.postDelayed(drawGIF, frameDuration);

            }

        }

        @Override
        public void onVisibilityChanged(boolean visible) {
            //super.onVisibilityChanged(visible);

            this.visible = visible;

            if (visible) {
                handler.post(drawGIF);
            } else {
                handler.removeCallbacks(drawGIF);
            }

        }

        @Override
        public void onSurfaceDestroyed(SurfaceHolder holder) {
            super.onSurfaceDestroyed(holder);
            this.visible = false;
            handler.removeCallbacks(drawGIF);
        }

        @Override
        public void onSurfaceChanged(SurfaceHolder holder, int format,
                                     int width, int height) {
            this.width = width;
            this.height = height;
            super.onSurfaceChanged(holder, format, width, height);
        }

        @Override
        public void onDestroy() {
            super.onDestroy();
            handler.removeCallbacks(drawGIF);

        }

    }

}

A: You may check before draw like this
if(movie.width() > 0 && movie.height() > 0){
        canvas.scale((float) display.getWidth() / (float) movie.width(),
                (float) display.getHeight() / (float) movie.height());
        movie.draw(canvas, 0, 0);
}else{
        //do something default which suit your application
}

A: Your exception is coming from these lines:
            canvas.scale((float) display.getWidth() / (float) movie.width(),
                    (float) display.getHeight() / (float) movie.height());
            movie.draw(canvas, 0, 0);

And not the ones you mentioned.
Since these lines are the ones where division by zero might happen.
I would make sure that the movie object has a width/height before doing the calculation.


text:
Q: After joining arrays of integer getting different result javascript I have an arrays of integer. When I join that integer it becomes string and then I want to convert that to integer format again to perform arthemetic operation. So, I use parseInt. Now when used parseInt the number is changed to different number. Any idea how?

let nums = [6,1,4,5,3,9,0,1,9,5,1,8,6,7,0,5,5,4,3]

console.log(parseInt(nums.join('')))
6145390195186705000. //output

let nums = [6,1,4,5,3,9,0,1,9,5,1,8,6,7,0,5,5,4,3]
console.log(parseInt(nums.join('')))

digits.join('')


text:
Q: Pandas - Add value to a Column on a For Im trying a script and i want to add value to each row on my Column login:
If the result on For is 200 i want add "yes" to the login Column on the correct row.
thank u!
import pandas as pd
from requests import get
lista = pd.read_csv('sites.csv', sep=',')
df = pd.DataFrame(lista, columns=['Site', 'Login'])
newdf = df.assign(Site=df['Site'].map(str) + 'login')

for i in newdf['Site']:
    result = get(i)
    if result.status_code == 200:
        print(i + '' ' login page')
    elif result.status_code == 404:
        print(i + '' ' not a login page')
    else :
        print(i + '' ' Not a login page')enter code here

the csv data:
Site, Login
https://www.site1.com.br/,
https://www.site2.com.br/,
https://www.site3.com.br/,

A: One way you could do it is to just iterate over the rows and add it in that way:
for i in range(newdf.shape[0]):
   result = get(newdf.iloc[i,0])
   if result == 200:
      newdf.iloc[i,1] = "yes"

etc.

A: You might do it in one single line using apply:
newdf['login'] = newdf['Site'].apply(lambda x : "yes" if get(x).status_code == 200 else "no")


text:
Q: Access translated property of collection in form I have a form with a collection. My form "PageType" with a collection look like this.
$builder->add('sections', 'collection', array(
                        'type'         => new SectionType($this->securityContext, $this->entityManager) ,
                        'allow_add'    => true,
                        'allow_delete' => true,
                        'label'        => false,
                        'prototype' => true,
                        'prototype_name' => '__sectionPrototype__',
                        'options'      => array(
                            'label' => false,
                        )

And my second form which represents the collection "SectionType" look like this.
 ->add('translations', 'a2lix_translations', array(
                    'fields' => array(
                        'title' => array(
                            'field_type' => 'text',
                            'label' => 'title',
                            'attr' => array('class' => 'rte sectionTitle')
                        ),
                        'text' => array(
                            'field_type' => 'textarea',
                            'label' => 'hintText',
                            'attr' => array('class' => 'rte sectionDescription')
                        )
                    )
                ))

How can i access from twig the translations fields?

A: I think that is not possible. Maybe somebody could correct me if I'm wrong.
fields is an option item for a2lix_translations. If you would have Form object you might be able to do that, but in fact, you have FormView which represents built form.
Alternatively, you could pass that array via standard return from controller and into your twig. Does that sound good?


text:
Q: string value empty for each checkbox checked in a gridview i have this code where on the click of a button i want to get the Empid of all those checkboxes that are checked in each row. but the string variable str is always empty and doesnt take any value.why is this so? kindly help
   protected void btn_3id_Click(object sender, EventArgs e)
    {
        string str = "";
        string srr = "";

        for (int i = 0; i < GridView1.Rows.Count; i++)
        {
            CheckBox chk = (CheckBox)GridView1.Rows[i].FindControl("CheckBox1");
            if (chk.Checked)
            {
                if (str == "")
                {
                    str = GridView1.Rows[i].Cells[0].Text.ToString();
                }
                else
                {
                    srr = str + "," + GridView1.Rows[i].Cells[1].Text.ToString();
                }
            }
        }
        Session["card_id"] = str;
        Response.Redirect("ID.aspx");
    }
}

A: if your control name is Label then use
str = ((Label)GridView1.Rows[i].FindControl("yourlabelid")).Text;

in place of
str = GridView1.Rows[i].Cells[0].Text.ToString();


text:
Q: python dynamic execution with threadpoolexecutor I am dynamically loading modules and trying to execute the class they contain:
class Test(Services):
    def __init__(self):
        Services.__init__(self)

    def start(self):
        print('start')

services_path = 'services'
s = 'test'
instance = getattr(importlib.import_module(services_path + '.' + s), s.title())

with ThreadPoolExecutor(max_workers=2) as executor:
    tmp = executor.submit(instance.start)
    print(tmp.result())

But when executing i receive the error:
TypeError: start() missing 1 required positional argument: 'self'

A: I would take a look at the instance object, I think it might be only a type/class object not a Test object ... thous you are trying to invoke the method without having instantiated the object
So you you should either instantiate the "instance"
instance = getattr(importlib.import_module(services_path + '.' + s), s.title())()

or try something like
# keep "instance" as is
instance = getattr(importlib.import_module(services_path + '.' + s), s.title())
# and
def _instance_start(instance_class):
    return instance_class().start
executor.submit(_instance_start(instance))


text:
Q: Error in Rscript: "Error in system("tail -n1010 EpisodeIV_dialogues.txt | cut -f2", intern = TRUE) : 'tail' not found" I'm trying to run the following script on R, but I get an error that I do not understand. The script is supposed to parse a movie script which is in txt format.
setwd("C:/Users/name/Desktop/star wars")

# read episode IV script in R (this is a character vector)
sw = readLines("StarWars_EpisodeIV_script.txt")

# inspect first 70 lines
# you'll see that the first dialogue is from THREEPIO in line 52
sw[1:70]

# command to extract character name (just for demo purposes)
substr(sw[52], 21, nchar(sw[52]))
# command to extract dialogue text (just for demo purposes)
substr(sw[53], 11, nchar(sw[53]))

# we need these auxiliary strings to help us
# extract character names and their dialogues
b10 = "          "
b20 = "                    "

# how many lines in input file
nlines = length(sw)

# let's parse the entire script while extracting only the names of the
# characters and their dialogues. The output file is EpisodeIV_dialogues.txt

# write first line in output file
writeLines("STAR WARS - EPISODE 4: STAR WARS", "EpisodeIV_dialogues.txt")

# the first 50 lines don't contain dialogues
# start reading at line 50
i = 50

# while loop to extract character and dialogues
# you may get some errors, just ignore them and re-run
# the while loop as many times as needed
while (i <= nlines)
{
  # if empty line
  if (sw[i] == "") i = i + 1  # next line
  # if text line
  if (sw[i] != "")
  {
    # if script description
    if (substr(sw[i], 1, 1) != " ") i = i + 1   # next line
    if (nchar(sw[i]) < 10) i = i + 1  # next line
    # if character name
    if (substr(sw[i], 1, 20) == b20)
    {
      if (substr(sw[i], 21, 21) != " ")
      {
        tmp_name = substr(sw[i], 21, nchar(sw[i], "bytes"))
        cat("\n", file="EpisodeIV_dialogues.txt", append=TRUE)
        cat(tmp_name, "", file="EpisodeIV_dialogues.txt", sep="\t", append=TRUE)
        i = i + 1
      } else {
        i = i + 1
      }
    }
    # if dialogue
    if (substr(sw[i], 1, 10) == b10)
    {
      if (substr(sw[i], 11, 11) != " ")
      {
        tmp_diag = substr(sw[i], 11, nchar(sw[i], "bytes"))
        cat(tmp_diag, file="EpisodeIV_dialogues.txt", append=TRUE)
        i = i + 1
      } else {
        i = i + 1
      }
    }
  }
}

# =====================================================================
# Creating data table "SW_EpisodeIV.txt"
# =====================================================================

# how many lines in output file
system("wc -l EpisodeIV_dialogues.txt")

# get vector of character names
SW4_chars = system("tail -n1010 EpisodeIV_dialogues.txt | cut -f1", intern=TRUE)
# get vector of dialogue lines
SW4_diags = system("tail -n1010 EpisodeIV_dialogues.txt | cut -f2", intern=TRUE)

# check character names
table(SW4_chars)
# remove voices
SW4_chars = gsub("'S VOICE", "", SW4_chars)

# join characters and dialogues in one table
SW4 = cbind(character=SW4_chars, dialogue=SW4_diags)

# save SW4 in file 'SW_EpisodeIV.txt'
write.table(SW4, file="SW_EpisodeIV.txt")

# if you want to check the data table
A = read.table("SW_EpisodeIV.txt")
head(A)
tail(A)

The error comes up when I run the following lines
SW4_chars = system("tail -n1010 EpisodeIV_dialogues.txt | cut -f1", intern=TRUE)
# get vector of dialogue lines
SW4_diags = system("tail -n1010 EpisodeIV_dialogues.txt | cut -f2", intern=TRUE)

The error says
Error in system("tail -n1010 EpisodeIV_dialogues.txt | cut -f2", intern = TRUE) :
'tail' not found
I'm not sure what the error means.


text:
Q: Namespace issue while adding new component to Mule flow I'm new to Mule, Whenever i'm adding 'Poll' with fixed-frequency scheduler to mule flow, getting namespace error.Shouldn't mule keep adding the namespace whenever we add new component to flow through editor ? Do i have explicitly add the namespace related with 'poll'? I was expecting namespace for poll to be available in Mule core. I'm using Mule studio-3.5.0.

Invalid content was found starting with element
  'fixed-frequency-scheduler'

Here is the mule configuration -
<?xml version="1.0" encoding="UTF-8"?>
<mule xmlns:file="http://www.mulesoft.org/schema/mule/file" xmlns:tracking="http://www.mulesoft.org/schema/mule/ee/tracking" xmlns:jms="http://www.mulesoft.org/schema/mule/jms" xmlns="http://www.mulesoft.org/schema/mule/core"
  xmlns:doc="http://www.mulesoft.org/schema/mule/documentation"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xmlns:http="http://www.mulesoft.org/schema/mule/http"
  xmlns:vm="http://www.mulesoft.org/schema/mule/vm"
  xmlns:spring="http://www.springframework.org/schema/beans"
  xmlns:jersey="http://www.mulesoft.org/schema/mule/jersey"
  version="EE-3.4.1"
  xsi:schemaLocation="http://www.mulesoft.org/schema/mule/core http://www.mulesoft.org/schema/mule/core/current/mule.xsd
  http://www.mulesoft.org/schema/mule/http http://www.mulesoft.org/schema/mule/http/current/mule-http.xsd
  http://www.mulesoft.org/schema/mule/vm http://www.mulesoft.org/schema/mule/vm/current/mule-vm.xsd
  http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-current.xsd
  http://www.mulesoft.org/schema/mule/jersey http://www.mulesoft.org/schema/mule/jersey/3.4/mule-jersey.xsd
  http://jersey.apache.org/core http://jersey.apache.org/schemas/core.xsd
  http://www.mulesoft.org/schema/mule/file    http://www.mulesoft.org/schema/mule/file/current/mule-file.xsd
  http://www.mulesoft.org/schema/mule/ee/tracking http://www.mulesoft.org/schema/mule/ee/tracking/current/mule-tracking-ee.xsd
  http://www.mulesoft.org/schema/mule/jms http://www.mulesoft.org/schema/mule/jms/current/mule-jms.xsd">

<jms:activemq-connector name="Active_MQ" brokerURL="tcp://localhost:61616" validateConnections="true" doc:name="Active MQ"/>
<flow name="mule-configFlow" doc:name="mule-configFlow">
    <poll doc:name="Poll">
        <fixed-frequency-scheduler frequency="10" timeUnit="SECONDS"/>
        <http:outbound-endpoint exchange-pattern="request-response" host="localhost" port="8095" path="myapp/v1/ping" method="GET" doc:name="HTTP"/>
    </poll>
    <object-to-string-transformer doc:name="Object to String"/>
    <jms:outbound-endpoint queue="mytest" connector-ref="Active_MQ" doc:name="JMS"/>
</flow>

Edit:
As suggested by David, i'm trying to add, Mule 3.5.0 Runtime by following Mule documentations but i'm not finding either 3.5.0 Cascade or BigHorn.

A: fixed-frequency-scheduler is in Mule core but of Mule 3.5.0 Cascade or BigHorn, not 3.4.1 EE as you're using currently.
Switch to one of these 2 runtimes and it will work.


text:
Q: Calculate Month Difference in Google BigQuery BigQuery does not allow you to select the daypart MONTH in DATEDIFF.
Is there any other way to do this in BigQuery.
I can get days difference using the following but not months.
SELECT
  OrderID,
  OrderDate,
  STRING( YEAR ( OrderDate )) + '-' + STRING(MONTH ( OrderDate )) as order_month,
  UserID,
  FirstOrderDate
DATEDIFF( OrderDate, FirstOrderDate) as date_diff,
FROM [orders.orders]
WHERE FirstOrderDate > DATE_ADD(CURRENT_TIMESTAMP(), -1, 'YEAR')

A: With Standard SQL you can use date_diff:
#StandardSQL
select date_diff(current_date, date '2018-03-06', month)

A: With standard SQL date_diff could work, but if you get an error saying "DATE_DIFF does not support the MONTH date part at [n:m]code", that's because your it's timestamp rather than date. To solve this issue, first cast the timestamp to date, then use date_diff function.
For example:
DATE_DIFF(CAST(OrderDate AS DATE), CAST(FirstOrderDate AS DATE), month) AS DATE_DIF

A: How about this?
(12 * YEAR(t2) + MONTH(t2)) - (12 * YEAR(t1) + MONTH(t1))
    + IF (DAY(t2) >= DAY(t1), 0, -1)

Running it over a couple of examples, it looks like what you'd want:
SELECT
(12 * YEAR(t2) + MONTH(t2)) - (12 * YEAR(t1) + MONTH(t1))
    + IF (DAY(t2) >= DAY(t1), 0, -1)
FROM
    (SELECT TIMESTAMP("2010-12-01") as t1, TIMESTAMP("2011-01-01") as t2), // 1
    (SELECT TIMESTAMP("2010-12-02") as t1, TIMESTAMP("2011-01-01") as t2), // 0
    (SELECT TIMESTAMP("2010-12-01") as t1, TIMESTAMP("2011-12-01") as t2), // 12
    (SELECT TIMESTAMP("2010-10-21") as t1, TIMESTAMP("2015-01-10") as t2)  // 50


text:
Q: MongoDB Merge two arrays into one I am writing an aggregation and have arrays of the form:
array1: [
{item:value},
{item:value},
...
]
array2: [
{price:value},
{price:value},
...
]

How can I merge them into this format:
array3: [
{item:value, price:value},
{item:value, price:value},
...
]

They are already in the proper order, so the object at index 0 for both arrays are matched up.
This seems like it should be easy to me, but the $concatArrays operator only works along the first dimension.
I have a method that works using the group stage, but it is quite slow, so I am trying to find another method.
Thanks a lot.

A: You can combine the two arrays and then cycle the result using map, try something as follows:
db.collection.aggregate([
  {
    "$project": {
      array3: {
        $map: {
          input: {
            $zip: {
              inputs: [
                "$array1",
                "$array2"
              ]
            }
          },
          as: "tuple",
          in: {
            item: {
              "$arrayElemAt": [
                "$$tuple.item",
                0
              ]
            },
            price: {
              "$arrayElemAt": [
                "$$tuple.price",
                0
              ]
            }
          }
        }
      }
    }
  },

])

You can test it here.


text:
Q: Get bash sub shell output immediately from named pipe I have a few commands i run between brackets which i then redirect to a named pipe and tail the pipe however it looks like the redirection happens only after the block has finished executing as i don't see any output from the tail command for a while and it only shows the last command ouput when i do. Any ideas how view the output of the block in realtime?
Example Script
#!/usr/bin/env bash

mkfifo /tmp/why_you_no_out;
trap "rm /tmp/why_you_no_out" 0;

{
    for ((i=1;i<=100;i++)); do
        printf "$i";
    done
    sleep 10s;
    printf "\n12356";
} >> /tmp/why_you_no_out &

printf "here";

tail -n 1 -f /tmp/why_you_no_out

A: Sounds like the issue is buffering.  Most shells don't want to write data a byte at a time because it's wasteful.  Instead, they wait until they have a sizable chunk of data before committing it unless the output is connected to your terminal.
If you're looking to unbuffer the output of an arbitrary command, you may find the "unbuffer" utility helpful or any of the solutions mentioned in this question: How to make output of any shell command unbuffered?
If you're dealing with specific applications, they may have options to reduce buffering.  For example, GNU's grep includes the --line-buffered option.


text:
Q: electronic signature with php In my app, clients agree to contracts.
I need some way of ensuring that their approval of a contract cannot be interfered with even if one has access to the mysql database.
In other words, their approval can be linked to the terms they have approved.
It has to be legally binding so if the data in the db is tampered with, the signature would no longer be valid.
Has anyone accomplished this?

A: If you're asking questions about cryptography on Stack Overflow, you're in over your head and will undoubtedly make a minor but important mistake that renders your work completely invalid. Cryptography is very hard to get completely correct, and even then you will have to keep your application up-to-date as various new techniques to circumvent things are discovered.
Use an off-the-shelf solution that's proven to work like GnuPG to handle your signing. Even then you'll need to ensure it's installed correctly, that you're handling the data correctly and calling the correct functions to validate the signatures.
Long story short: Find someone qualified and/or certified to do this and follow their advice to the letter. Get their solution vetted by a third party that can be trusted.
What you want to do here in general terms is get both parties to cryptographically sign the contents of the original message. That way in order to change the contents, both parties would have to "collude", something that's not likely if one party is trying to sabotage the other.
This requires both parties to have a secured, unknown private key that's used for these operations. Managing these is considerable overhead for your application unless you have a way of installing client software that does it for them. Even then, generating and protecting keys is anything but fun.
If you want to learn more about the nuances of cryptography, you will need to read The Book.


text:
Q: Wrapper method for ConfigureAwait(false)? Does it make sense to declare a async method as private and then create a public method to act as a wrapper that calls the private method with ConfigureAwait(false)?
The intended purpose is design an intuitive API that hides complexities and doesn't require the user of the API to have to think about ConfigureAwait.
Is this called anything? Is it a design pattern?
Is this common?
public class Example
{
    public void Foo()
    {
        FooAsync().ConfigureAwait(false);
    }

    private async Task FooAsync()
    {
        // var x = await ...
        // Something(x);
    }
}