text:
Q: Apache Archiva 2.1.1 Upgrade: Proxy does not work we try to upgrade from archvia 1.3.6 to 2.1.1 but suddenly the remote repositories (including proxy connectors) stopped working. The remote repository view shows error marks in the column "Remote check" but no error message is shown.

Is there a possibility to find out what is going on?
We are using a proxy, we tried with proxy activated, deactivated. I even installed archiva locally on my machine with a fresh database, but still no success.
(how does this remote check even work when the proxy is activated/deactivated in the proxy connectors?)
Eclipse (with newest m2e) says Missing artifact junit:junit:jar:3.8.9. It goes so fast, that i don't think archiva is trying to reach the central-Repository.
The logs on archiva-side are empty.
Does anybody have some hints or the same problem? I think i will try it at home tonight, to see if it is a network issue.
Thanks in advance for any tips!
Update
It really seems that the proxy connector does not work since the internal Repository is empty. http://localhost:8080/archiva/repository/internal/ only shows .indexer
Update 2
The proxy configuration seems bugged in Archiva 2.1.1. I can see the same behaviour as here: Mailing List
A JIRA task for this would be nice.
Does anybody know a workaround to set the proxy for a proxy connector? Or is there a possibility to set a global proxy via a settings file?
Update 3
Rellay seems like a bug in archiva. I sent a mail to the mailing lists. Hopefully this is getting fixed soon because this is a blocker for every user with a proxy.
I won't delete this question for documentation if someone has the same problem. The issue can be found in JIRA here

A: I also had this problem and the simple solution was to change the proxy protocol from "http" to "https".

A: I also had the same problem. On first glance the solution given by Christian Quast seemed to work, but it didn't solve the problem. I eventually used a work around by using JVM proxy settings:

*

*-Dhttp.proxyHost=[your_proxy_address]

*-Dhttp.proxyPort=[your_proxy_port]

*-Dhttp.proxyUser=[your_proxy_user_name]

*-Dhttp.proxyPassword=[your_proxy_user_password]

*-Dhttp.nonProxyHosts=localhost|127.0.0.1|::0|[any_other_hosts_not_to_use_proxy]

Update
I know it may sound weird but, using the settings above, the error/warning icon on "Remote Check" may still appear. If you add the "network proxy" (mine is using https protocol) to your remote repository (the error/warning icon is still there) but editing the remote repository again and removing it's "network proxy" will show the OK/sun icon.

A: In my case <networkProxy> under conf\settings.xml gets updated correctly including the port information (probably because my port is not a default 8080) but remote repository connection is still failing.
Also, changing proxy protocol to https did not help.
I know the proxy is right because I use the same for maven .m2\settings.xml
Fortunately I am only evaluating open source repo management tools. Started with Archiva as it is by Apache and we use Maven in our project. Would have moved ahead if this critical issue had a fix or work around. Guess I will have to take a shot at Nexus.

A: Exactly same problem here. I can't vote on your BUG report because I have no jira account.
As far as I figured out there seems to be a problem with the configuration file ~/.m2/archiva.xml. The Proxy is set without port information.
Hopefully this bug will be fixed as soon as possible.

A: Extending João Ferreira's reply, to access repositories with https URLs (such as Maven Central), you will also need:
-Dhttps.proxyHost=[your_proxy_host]
-Dhttps.proxyPort=[your_proxy_port]


text:
Q: Stop Logic App execution within foreach when there's an error I am building a Logic App that contains a foreach loop in a synchronous style (constrained to one execution at a time, concurrency=1). Within each foreach loop, there is a switch statement that calls different child Logic Apps depending on the contents of the item the foreach loop is iterating over.
I've discovered that if one of these child Logic Apps fail, the foreach loop continues on as if nothing happened, executing the subsequent tasks as determined by the contents of the array. I cannot find any way to halt (break) the execution of the foreach or terminate the whole logic app based on the failure of one of the child logic apps within the foreach loop.
If the same child Logic App were to fail without being inside the foreach loop, the execution of the parent Logic App would be halted. This seems a very strange design decision and creates an inconsistency with how Logic App execution behaves inside vs outside a loop.
Additional note: To add insult to injury, when you execute a child Logic App, even if it's an HTTP trigger and response, you don't appear to get access to the HTTP status code it returns in the calling (parent) Logic App. So even if I wanted to manually test every single case I have in my loop, I can't figure out how to do that.

A: I figured out a workaround.
I encapsulated the switch statement (within which my child logic apps are called) inside the foreach with a Scope action. The Scope action "inherits" a failure from anything inside it.
After the Scope, at the end of the foreach, I test the status of the Scope. If it's a failure, I set a "break" variable (initialized at the start of the Logic App to false) to "true".
At the beginning of each foreach iteration, I check the "break" variable. If it's "true", everything inside the foreach is skipped.

A: I don't think there is a good way to do this at the moment. Normally I would use a terminate action that runs on failiure of previous action.. But terminate actions are not allowed within a foreach. Issue on the feedback forum
Maybe you can solve it by using a until action instead of foreach and have condition for when to break. And for the child logic app you can use a response action and set the response code to like 500 or something and check for that in the until.
Edit: Sorry missed you where not able to get the code in the parent.
You should be able to get status code from the child logic app if you invoke it via Http..

A: You can use the until connector instead.
Before using the connector, please create a variable that can use for setting boolean expressions (to convert any expression to boolean use bool() function from the Expressions section).
Then inside the until statement use that variable.

And the loop will be terminated once the condition variable will set to false.
Of course, you can also use the variable approach to check inside for each statement and don't do actions if it is false,
but I think this will not help to stop for each loop from iterating over the array.

redpajama_set_name: RedPajamaStackExchange


text:
Q: Converting mathematical expressions to Matlab scripts I have some equations and want to code them in Matlab. These are parts of equality constraints for an optimization problem. It's GAMS script and mathematical equation is known for me. These terms are as follows:

GAMS:
p1_bal(ib)  ..      (pgn1(ib)-pdn1(ib)) =e= v1(ib)*sum(ib1, ybus1_m(ib,ib1)*v1(ib1)*cos(ybus1_a(ib,ib1)+a1(ib1)-a1(ib)));
q1_bal(ib)  ..      (qgn1(ib)-qdn1(ib)) =e= -v1(ib)*sum(ib1, ybus1_m(ib,ib1)*v1(ib1)*sin(ybus1_a(ib,ib1)+a1(ib1)-a1(ib)));

So I have tried to write it's Matlab scrip based on above, But I am not sure if its true. Please check these Matlab scrip and tell me if they are in accordance with its mathematical or GAMS scripts.
p_bal  =  -(pgn-pdn)+v_mt.*((Ybus_m.*cos(Delta)*v_mt));
q_bal  =   -(qgn-qdn)+v_mt.*((Ybus_m.*sin(Delta))*v_mt);

where pgn,pdn,qgn,qdn,v_mt are (n x 1) vectors Ybus_m and Delta are (n x n) matrices. Delta is also defined as :
Delta =bsxfun(@minus,v_at(:),v_at(:).')-Ybus_a;
%v_at(:)=d{n},v_at(:)'=d{h},Ybus_a=tet{n,h}


text:
Q: Is there a way to make sure target = _blank links open in foreground? For some browsers (and depending on settings), links with target = "_blank" seems to open in the foreground, but for a lot of others it seems to open in the background.
In my case opening in the foreground is what a user intends when she/he clicks on the link, so it would be nice if there is a way to ensure that. Is there a way to do this? Thank you.

A: There is no way to make sure these links open in the foreground. This is something the browsers arrange and there is nothing you can change about it.
You could however open the link in the same window by leaving out the target attribute, that will ensure the people clicking the link get to see the page immediatly. In a way this is also 'nicer' since it leaves the choice of opening the link in a new window to the user itself.

A: You can try using window.focus() to bring the new window to the front. You may do it on the opened document, using jquery, with:
$(function() {
    window.focus();
});

or from the original document:
var newWindow = window.open(url);
window.setTimeout(function() { newWindow.focus(); }, 1000);

The setTimeout is needed to allow time for the window to be actually created by the browser. There may be a cleaner method to achieve this, but the setTimeout should do it.


text:
Q: Python Unable to save file with slash in front of name with open('/tests/testDict.pickle','wb') as fp: print 'to terminal'

What is wrong with the above it's driving me nuts an giving me the following:
---------------------------------------------------------------------------
IOError                                   Traceback (most recent call last)
<ipython-input-17-fe5a4a9f361c> in <module>()
----> 1 with open('/tests/testDict.pickle','wb') as fp: print 'to terminal'

IOError: [Errno 2] No such file or directory: '/tests/testDict.pickle'

If I don't have a slash in front I get:
with open('tests/testDict.pickle','wb') as fp: print 'to terminal'
to terminal

I have the following directory structure in OS X:
$ ls
cp1.py           cp1_pdftest.jpg  random/          tests/

A: That leading slash on "/tests/" forces the path to be absolute, even though you're doing
os.path.join(os.getcwd(), "/tests/")

So you need to do
os.path.join(os.getcwd(), "tests/")

From the os.path.join docs:

os.path.join(path, *paths)
Join one or more path components intelligently. The return value is
  the concatenation of path and any members of *paths with exactly one
  directory separator (os.sep) following each non-empty part except
  the last, meaning that the result will only end in a separator if the
  last part is empty. If a component is an absolute path, all previous
  components are thrown away and joining continues from the absolute
  path component.

A: When you have the leading slash, it indicates an absolute path. That is, unless you have a directory called 'tests' in the root (/) directory of your system, this shouldn't work.

A: / only is the root directory, maybe you should try with ./


text:
Q: Getting Chrome extension error: Cannot find context with specified id and Inspector protocol error I am trying to create a basic extension using chrome's dev-tools API. I have created a panel in the developer-tools window and rendered the UI using pure HTML and ES6. But when I have created the same UI page in React(using create-react-app build) chrome dev tool is not rendering the UI and given following errors.
Cannot find context with specified id _evaluateGlobal @ shell.js:5111

Extension server error: Inspector protocol error:
       Cannot find context with specified id makeStatus @ shell.js:7823

I have tried again by removing all other meta tags & service worker configs from the HTML, still, I am getting the same issue (I am able to render this react page properly in the browser window).

EDIT: I am able to render a basic react page in chrome devtool panel using ReactJS in pure JavaScript way (not JSX, thanks to
  Babel-REPL ). Only the issue is coming when using the create-react-app build.

Please see the code below,
extension.js

    // Create a tab in the devtools area
    chrome.devtools.panels.create("Tool heading", "toast.png", "panel.html", function (panel) {
        console.log(panel);
    });

Panel.html(a basic material-UI react application with using create-react-app)

    <!doctype html>

        <link href="./build/static/css/main.4742e13d.chunk.css" rel="stylesheet">

Full error log:
shell.js:3123 [Deprecation] document.registerElement is deprecated and will be removed in M73, around March 2019. Please use window.customElements.define instead. See https://www.chromestatus.com/features/4642138092470272 for more details.
UI.registerCustomElement @ shell.js:3123
shell.js:3081 [Deprecation] Element.createShadowRoot is deprecated and will be removed in M73, around March 2019. Please use Element.attachShadow instead. See https://www.chromestatus.com/features/4507242028072960 for more details.
UI.createShadowRootWithCoreStyles @ shell.js:3081
shell.js:7924 Main._createAppUI: 24.008056640625ms
shell.js:7924 Main._showAppUI: 72.796875ms
shell.js:7924 Main._initializeTarget: 9.6240234375ms
shell.js:7924 Main._lateInitialization: 18.457275390625ms
devtools.js:4 Object
shell.js:5111 Cannot find context with specified id
_evaluateGlobal @ shell.js:5111
shell.js:7823 Extension server error: Inspector protocol error: Cannot find context with specified id
makeStatus @ shell.js:7823

Please share your thoughts, comments, and links.
Thanks in advance.


text:
Q: What's an easiest way to make sure my key is always first in a javascript object? I have an object that varies in values and order of keys.
var obj = { extension50: {}, extension55: {}, main: {} }

Note I have "main" key placed out of order. It should be placed in the beginning so when someone iterates through keys of this object it would come up first.
What's the best way of achieving it?

A: JavaScript objects are not ordered. If you want a specific order, use arrays.


text:
Q: Javascript code work in Chrome but in IE is executed at the end of all instruction I have a code inside of a click event and the js instruction are not executing until everything finish.
$('#elementID').off('click').on('click', function()
{
  $('#objToChange').css({ 'color': 'red', 'font-size': '150%' });
  someFuction();
  anotherFunction();
});

This work perfect in Firefox and Chrome, but in IE doesn't do it. I mean he made the change of the color at the end of the execution of the hole code and I need that the change take place just in the moment that I made the jquery change.

A: It's just a difference in the way different browsers render things.  If you add a slight delay between the css update and the rest of the code it should be fine...
$('#elementID').off('click').on('click', function() {
    $('#objToChange').css({ 'color': 'red', 'font-size': '150%' });

    // wrap the rest of the code in a setTimeout with a small delay
    setTimeout(function() {
        someFuction();
        anotherFunction();
    }, 10);
});

Note: Some people say setTimeout with a delay of zero is good enough, but I've seen that fail so always use at least 1ms delay.  10ms is more than enough, but still not a visible pause.


text:
Q: Ruby: how to make a Hash from path more robust? Assuming some hashes in the array only have path a.b or {"a"=>{"b"=>"someanswer"}}, how do I make the below code robust enough to display the last element without dieing?
path = ("a.b.c.d")
arrayOfHashes.collect {|hash| path.split(".").inject(hash) { |hash, key| hash[key] }}

A: The specifications are not complete. Something like that?
arrayOfHashes = [{"a" => {"b" => "hello"}}, {"a" => {"b" => {"c" => {"d" => "response"}}}}]
path = "a.b.c.d"
arrayOfHashes.map do |hash|
  path.split(".").inject(hash) do |acc, key|
    acc.is_a?(Hash) ? acc[key] : acc
  end
end
#=> ["hello", "response"]


text:
Q: Statistical test for testing different between groups in terms of efficiency in regression During my thesis work I collected some measurements about chest compressions that reached a good depth (binomial data) during cardiopulmonary rescuscitaion (CPR), I have two groupes of volunteers and each volunteer performed a number unequal of chest compressions with the use or not of a device.
In other word,I have two sessions (with and without the use of a device) and two groups of volunteers that perform different compressions within a minute.
So, what I need is to compare the difference between the two groups in term of efficiency? Which test should I apply to compare binomial data between the two groups?


text:
Q: Configuring ASP.Net Identity for an ASP.Net WebAPI application I have a SPA ASP.NET WebAPI application which previously allowed anonymous access. I have now configured ASP.Net Identity for it but I cannot get the Identity related controllers and my application's other controllers to work at the same time :-(
It's either one or the other!
I have added the startup class to my project:
using Test.MyProject;
using Microsoft.Owin;
using Microsoft.Owin.Security;
using Microsoft.Owin.Security.DataHandler.Encoder;
using Microsoft.Owin.Security.OAuth;
using Newtonsoft.Json.Serialization;
using Owin;
using System;
using System.Configuration;
using System.Linq;
using System.Net.Http.Formatting;
using System.Web.Http;

[assembly: OwinStartup(typeof(Test.Client.Startup))]
namespace Test.Client
{
    public class Startup
    {
        public void Configuration(IAppBuilder app)
        {
            HttpConfiguration httpConfig = new HttpConfiguration();

            ConfigureOAuthTokenGeneration(app);

            ConfigureWebApi(httpConfig);

            app.UseCors(Microsoft.Owin.Cors.CorsOptions.AllowAll);

            //app.UseWebApi(httpConfig);  // If this line is commented out my application's controllers work. But then my Account Controller does't work. It if is included, my application's controllers don't work, whilst the Account Controller work

            GlobalConfiguration.Configure(WebApiConfig.Register);
        }

        private void ConfigureOAuthTokenGeneration(IAppBuilder app)
        {
            // Configure the db context and user manager to use a single instance per request
            app.CreatePerOwinContext(ApplicationDbContext.Create);
            app.CreatePerOwinContext<ApplicationUserManager>(ApplicationUserManager.Create);
        }

        private void ConfigureWebApi(HttpConfiguration config)
        {
            config.MapHttpAttributeRoutes();

            var jsonFormatter = config.Formatters.OfType<JsonMediaTypeFormatter>().First();
            jsonFormatter.SerializerSettings.ContractResolver = new CamelCasePropertyNamesContractResolver();
        }
    }
}

And I have added controllers for managing Users and Roles.
The statement GlobalConfiguration.Configure(WebApiConfig.Register) was previously in the application start event in global.aspx.cs but now moved to the startup class to have everything in the same place.
The WebApiConfig.Register method looks like this:
public static void Register(HttpConfiguration config)
{
    var container = new UnityContainer();
    // Web API configuration and services

    string appStorageProvider = ConfigurationManager.AppSettings["StorageProvider"];
    var provider =(TestComposition.StorageProvider) Enum.Parse(typeof (TestComposition.StorageProvider), appStorageProvider, true);

    TestComposition.Setup(container, provider);
    container.RegisterType<GeneralLogger, GeneralLogger>();

    container.RegisterType<IExceptionLogger, ExceptionLogger>();

    config.EnableCors();

    config.DependencyResolver = new UnityResolver(container);
    config.Services.Add(typeof (IExceptionLogger), container.Resolve<GeneralLogger>());

    // Web API routes
    config.MapHttpAttributeRoutes();
}

In my new AccountController I have code which allows me to retrieve the ApplicationUserManager from the OwinContext set up in the Startup class.
protected ApplicationUserManager AppUserManager
{
    get
    {
        return _AppUserManager ?? Request.GetOwinContext().GetUserManager<ApplicationUserManager>();
    }
}

With app.UseWebApi(httpConfig) commented out as shown above my application works as it used to. But if I invoke any action on my new AccountController I get this:

Request.GetOwinContext()  error CS1061: 'HttpRequestMessage' does not
  contain a definition for 'GetOwinContext' and no extension method
  'GetOwinContext' accepting a first argument of type
  'HttpRequestMessage' could be found (are you missing a using directive
  or an assembly reference?)

If I comment in the app.UseWebApi(httpConfig) statement the AccountController works but then my other controllers don't work. Here I get errors like these:

{
      "message": "An error has occurred.",
      "exceptionMessage": "An error occurred when trying to create a controller of type 'TestController'. Make sure that the controller has
  a parameterless public constructor.",
      "exceptionType": "System.InvalidOperationException",
      "stackTrace": "   at System.Web.Http.Dispatcher.DefaultHttpControllerActivator.Create(HttpRequestMessage
  request, HttpControllerDescriptor controllerDescriptor, Type
  controllerType)\r\n   at
  System.Web.Http.Controllers.HttpControllerDescriptor.CreateController(HttpRequestMessage
  request)\r\n   at
  System.Web.Http.Dispatcher.HttpControllerDispatcher.d__1.MoveNext()",
      "innerException": {
          "message": "An error has occurred.",
          "exceptionMessage": "Type 'MyProject.Api.TestController' does not have a default constructor",
          "exceptionType": "System.ArgumentException",
          "stackTrace": "   at System.Linq.Expressions.Expression.New(Type type)\r\n   at
  System.Web.Http.Internal.TypeActivator.Create[TBase](Type
  instanceType)\r\n   at
  System.Web.Http.Dispatcher.DefaultHttpControllerActivator.GetInstanceOrActivator(HttpRequestMessage
  request, Type controllerType, Func`1& activator)\r\n   at
  System.Web.Http.Dispatcher.DefaultHttpControllerActivator.Create(HttpRequestMessage
  request, HttpControllerDescriptor controllerDescriptor, Type
  controllerType)"
      } }

Any idea what is going on here?

A: The problem is that you are not using the same HttpConfiguration instance during start up for configuring WebApi with OWIN.
This way your OWIN Web API middleware has no knowledge of UnityContainer, and will use its default implementation. Because of this the creation of your controllers failed.
Please use the same HttpConfiguration for both Web Api configuration and UnityContainer registration:
public class Startup {
    public void Configuration(IAppBuilder app) {
        ConfigureOAuthTokenGeneration(app);

        ConfigureWebApi(app);

        app.UseCors(Microsoft.Owin.Cors.CorsOptions.AllowAll);
    }

    private void ConfigureOAuthTokenGeneration(IAppBuilder app) {
        // Configure the db context and user manager to use a single instance per request
        app.CreatePerOwinContext(ApplicationDbContext.Create);
        app.CreatePerOwinContext<ApplicationUserManager>(ApplicationUserManager.Create);
    }

    private void ConfigureWebApi(IAppBuilder app) {
        // configure Web Api
        GlobalConfiguration.Configure(WebApiConfig.Register);
        // Manually assign httpConfig from GlobalConfiguration
        HttpConfiguration httpConfig = GlobalConfiguration.Configuration;
        // Use same config with OWIN app
        app.UseWebApi(httpConfig);
    }
}

You are configuring web api in multiple places. The WebApiConfig.Register method should consolidate everything you want configured for the HttpConfiguration:
public static void Register(HttpConfiguration config) {
    var container = new UnityContainer();
    // Web API configuration and services

    string appStorageProvider = ConfigurationManager.AppSettings["StorageProvider"];
    var provider =(TestComposition.StorageProvider) Enum.Parse(typeof (TestComposition.StorageProvider), appStorageProvider, true);

    TestComposition.Setup(container, provider);
    container.RegisterType<GeneralLogger, GeneralLogger>();

    container.RegisterType<IExceptionLogger, ExceptionLogger>();

    config.EnableCors();

    config.DependencyResolver = new UnityResolver(container);
    config.Services.Add(typeof (IExceptionLogger), container.Resolve<GeneralLogger>());

    // Web API routes
    config.MapHttpAttributeRoutes();

    // configure formatter
    var jsonFormatter = config.Formatters.OfType<JsonMediaTypeFormatter>().First();
    jsonFormatter.SerializerSettings.ContractResolver = new CamelCasePropertyNamesContractResolver();
}


text:
Q: Brackets added to Scanned Codes When my barcode scanner scans a code, it adds ] to the beggining and [ to the end. How can I change this?

A: Unfortunately, it's a barcode scanner setup parameter and varies by the particular barcode reader.  You will need the documentation / SDK for your barcode scanner.  Many barcode scanners can setup the leading/trailing character just by scanning a setup barcode.


text:
Q: Debugging from one solution to another I have always wondered how I should do this. Lets say I have a solution A and a Solution B.
Lets say Solution A is the application I am working on. Lets say solution B is the framework for the application.
I have added the references of all the projects in Solution B in solutuon A. Lets say if I want to debug and someimes you may even want to step through the classes in Solution B, how is this possible.
I hope I have made myself clear.

A: If you build solution B as a library it will build dll's and pdb's for each project for you.
You can add references to these dlls in solution A.  The pdb's provide all the debug information for you, so as long as they're in the same directory as the dlls, when you step into solution B's classes in the Solution A debugger it should automatically find the source code for you.

A: I add the projects (not the dlls) from solution B to solution A when I want to do this kind of debugging


text:
Q: Error on color substraction on build after laravel-mix update to 4.0.12 I noticed that sass build fails on color substraction after update to laravel-mix@4.0.12
My code in app.scss
.footer {
  background-color: #fefefe - #a0a0a0
}

My webpack.mix.js
const mix = require('laravel-mix');

const resourcesAssets = 'resources/assets/';
const dest = 'public/assets/';

mix
  .sass(`${resourcesAssets}scss/app.scss`, `${dest}css`);

On laravel-mix@1.7.2 running npm run prod works properly, but now I got next error
 ERROR  Failed to compile with 2 errors22:16:34

 error  in ./resources/sass/app.scss

Module build failed (from ./node_modules/css-loader/index.js):
ModuleBuildError: Module build failed (from ./node_modules/sass-loader/lib/loader.js):

undefined
                     ^
      Undefined operation "#fefefe - #a0a0a0".
    background-color: #fefefe - #a0a0a0
                      ^^^^^^^^^^^^^^^^^
  stdin 2:23  root stylesheet
      in C:\xampp\htdocs\laravel-test-mix\resources\sass\app.scss (line 2, column 23)
    at runLoaders (C:\xampp\htdocs\laravel-test-mix\node_modules\webpack\lib\NormalModule.js:301:20)
    at C:\xampp\htdocs\laravel-test-mix\node_modules\loader-runner\lib\LoaderRunner.js:364:11
    at C:\xampp\htdocs\laravel-test-mix\node_modules\loader-runner\lib\LoaderRunner.js:230:18
    at context.callback (C:\xampp\htdocs\laravel-test-mix\node_modules\loader-runner\lib\LoaderRunner.js:111:13)
    at render (C:\xampp\htdocs\laravel-test-mix\node_modules\sass-loader\lib\loader.js:52:13)
    at Function.$2 (C:\xampp\htdocs\laravel-test-mix\node_modules\sass\sass.dart.js:25378:48)
    at vB.$2 (C:\xampp\htdocs\laravel-test-mix\node_modules\sass\sass.dart.js:16223:16)
    at tz.ve (C:\xampp\htdocs\laravel-test-mix\node_modules\sass\sass.dart.js:9275:42)
    at tz.vd (C:\xampp\htdocs\laravel-test-mix\node_modules\sass\sass.dart.js:9277:32)
    at ic.uo (C:\xampp\htdocs\laravel-test-mix\node_modules\sass\sass.dart.js:8583:46)
    at t6.$0 (C:\xampp\htdocs\laravel-test-mix\node_modules\sass\sass.dart.js:8728:7)
    at Object.eu (C:\xampp\htdocs\laravel-test-mix\node_modules\sass\sass.dart.js:1569:80)
    at aj.bd (C:\xampp\htdocs\laravel-test-mix\node_modules\sass\sass.dart.js:8646:3)
    at is.bd (C:\xampp\htdocs\laravel-test-mix\node_modules\sass\sass.dart.js:8576:25)
    at is.cF (C:\xampp\htdocs\laravel-test-mix\node_modules\sass\sass.dart.js:8563:6)
    at oy.cF (C:\xampp\htdocs\laravel-test-mix\node_modules\sass\sass.dart.js:8350:35)
    at Object.o (C:\xampp\htdocs\laravel-test-mix\node_modules\sass\sass.dart.js:1442:19)
    at C:\xampp\htdocs\laravel-test-mix\node_modules\sass\sass.dart.js:5284:51
    at w0.a (C:\xampp\htdocs\laravel-test-mix\node_modules\sass\sass.dart.js:1453:71)
    at w0.$2 (C:\xampp\htdocs\laravel-test-mix\node_modules\sass\sass.dart.js:8365:23)
    at uC.$2 (C:\xampp\htdocs\laravel-test-mix\node_modules\sass\sass.dart.js:8360:25)
    at tz.ve (C:\xampp\htdocs\laravel-test-mix\node_modules\sass\sass.dart.js:9275:42)
    at tz.vd (C:\xampp\htdocs\laravel-test-mix\node_modules\sass\sass.dart.js:9277:32)
    at ic.uo (C:\xampp\htdocs\laravel-test-mix\node_modules\sass\sass.dart.js:8583:46)
    at t6.$0 (C:\xampp\htdocs\laravel-test-mix\node_modules\sass\sass.dart.js:8728:7)
    at Object.eu (C:\xampp\htdocs\laravel-test-mix\node_modules\sass\sass.dart.js:1569:80)
    at aj.bd (C:\xampp\htdocs\laravel-test-mix\node_modules\sass\sass.dart.js:8646:3)
    at is.bd (C:\xampp\htdocs\laravel-test-mix\node_modules\sass\sass.dart.js:8576:25)
    at is.cF (C:\xampp\htdocs\laravel-test-mix\node_modules\sass\sass.dart.js:8563:6)
    at oy.cF (C:\xampp\htdocs\laravel-test-mix\node_modules\sass\sass.dart.js:8350:35)
    at Object.o (C:\xampp\htdocs\laravel-test-mix\node_modules\sass\sass.dart.js:1442:19)
    at C:\xampp\htdocs\laravel-test-mix\node_modules\sass\sass.dart.js:5835:52
    at w0.a (C:\xampp\htdocs\laravel-test-mix\node_modules\sass\sass.dart.js:1453:71)
    at w0.$2 (C:\xampp\htdocs\laravel-test-mix\node_modules\sass\sass.dart.js:8365:23)
    at uC.$2 (C:\xampp\htdocs\laravel-test-mix\node_modules\sass\sass.dart.js:8360:25)
    at tz.ve (C:\xampp\htdocs\laravel-test-mix\node_modules\sass\sass.dart.js:9275:42)

How can I fix this problem without setting up previously calculated value?

A: Color arithmetic was deprecated in dart-sass 4.
They recommend you (in a harsh way) to use color functions.
I rather like this color functions visual summary. You are probably looking for darken(color,%) in your code.


text:
Q: Understanding the basics of electromagnetic induction Suppose two rings are kept facing each other and that one ring have some current which increases constantly. Will the other ring be attracted or repelled? Does this also depend on how they are kept?

A: Since the current increases uniformly the flux would increase uniformly. As per Faraday's and Lenz's law the induced currents tend to oppose the change in flux. So currents would be induced in the opposite direction causing the two rings to repel.

A: The result is an application of Lenz's law.


text:
Q: Can a method return an NSRange? I have a method that returns an NSRange. When I call this method from outside the class I get a compile error.
NSRange tmpRange;
tmpRange = [phrase rangeInString:searchString forString:theLetter goingForward:YES];
return tmpRange.location == -1;

in the .h file:
#import <Foundation/Foundation.h>

@interface Phrase : NSObject {

}
- (NSRange) rangeInString:(NSString *) tgt forString:(NSString *) find goingForward:(BOOL) fwd;

@end

This method is called within the Phrase object by other methods without problems. The compiler says 'incompatible types in assignment'.
Can anyone explain this to me? I assume it has to do with returning an NSRange/struct type value generated outside the object, but I don't know why it works in one place and not the other.

A: Of course a method can return NSRange. But returning structures require special attention to the compiler because how the method is invoked is usually different (objc_msgSend_stret vs. objc_msgSend).
Please make sure you declare phrase as
Phrase* phrase = ...;

so that the compiler knows -rangeInString:… is returning an NSRange, instead of
id phrase = ...;

(Also, since you don't show which line the compiler errors, make sure the function using return … == -1; is returning a BOOL not NSRange.)

A:
Can a method return an NSRange?

Yes.

This method is called within the Phrase object by other methods without problems. … When I call this method from outside the class I get a compile error. … The compiler says 'incompatible types in assignment'.

Remember to #import Phrase.h into the implementation file where you're talking to a Phrase object. Otherwise, the compiler doesn't know about your rangeOfString:forString:goingForward: method and assumes that it returns id. It needs the @interface in the header file to know that the method returns NSRange.
Assuming that your phrase object is in an instance variable, you probably declared the Phrase class with @class Phrase; in the header file where you declared the ivar. That's a forward declaration; it tells the compiler that a class named "Phrase" exists (so that a declaration like Phrase *myPhrase will be legal), but it doesn't tell the compiler anything else about it. To do that, you need to import the header.
The general rule, for instances of class A knowing about instances of class B, is for A's header (A.h) to forward-declare class B with @class, and A's implementation (A.m) to import B's header (B.h).
A different case is when A is a subclass of B. You need the @interface to make a subclass, so in this case and this case only, A.h must import B.h. Since it's importing the header for B, it does not need to forward-declare B.

A: I don't think this is the answer, but NSRange.location is declared as NSUInteger.  By comparing it to -1, you are comparing an unsigned value to a signed value.
The only other answer I can think of is that the .m file you are making the call from has not imported the header Phrase.h.  Now, I know you believe it has, but the compiler is saying otherwise.  Try running the preprocessor on the file to see what it is actually importing. (right click in an editor containing the .m file - preprocess is near the bottom of the context menu that pops up).

A: Yes, you can return C structs in methods. That is not the problem. Also, location is an NSUInteger and will never be -1. Use NSNotFound to test for that.
How is the instance of your Phrase object typed? Did you use id instead of Phrase *? Have you properly imported the Phrase header?
You should give us more information about the code that's giving the compile error.

A: In response to some questions that are coming up:
#import <Foundation/Foundation.h>
#import "OverlayView.h"
#import "Phrase.h"
#import "TimerPaneView.h"

Is the header in the MainPane.h, the class header for where the call is being made.
In the header for MainPane.h, phrase is declared:
    Phrase              *phrase;

And in the implementation file, which, yes, imports the MainPane header:
phrase = [[Phrase alloc] init];

Is how the phrase class is being instantiated, in the initWithFrame method. I refer to the phrase object dozens and dozens of times, calling methods, referring to properties in this class, without problems. And no, the phrase object is never released until dealloc.
-- added: I thought I had found the problem: a collapsed section of code that never is called that had a legacy return value that was BOOL. This method originally returned BOOL, but was converted. But I eliminated it, and the problem remains.
I should also say that I've refactored my way around this problem, but it remains a mystery...


text:
Q: p:remoteCommand and p:messages with autoUpdate="true" clears messages <p:messages id="lockMessage"
            for="lockMessage"
            redisplay="false"
            showDetail="true"
            autoUpdate="true"
            closable="true"/>

<h:form id="form">
    <p:remoteCommand name="updateTable" update="dataTable" process="@this"/>

    <p:commandButton oncomplete="if(args &&!args.validationFailed) {updateTable();}"
                     actionListener="#{bean.action}"
                     value="Save"/>

    <p:dataTable id="dataTable"/>
</h:form>

The bean :
@Named
@ViewScoped
public class Bean implements Serializable {

    private static final long serialVersionUID = 1L;

    public Bean() {}

    public void action() {
        FacesContext facesContext = FacesContext.getCurrentInstance();

        // This is needed somewhere.

        Collection<String> renderIds = facesContext.getPartialViewContext().getRenderIds();
        renderIds.clear();
        renderIds.add("lockMessage");

        // Render the message using some conditional check.

        FacesMessage message = new FacesMessage();
        message.setSeverity(FacesMessage.SEVERITY_ERROR);
        message.setSummary("Summary");
        message.setDetail("Message");
        facesContext.addMessage("lockMessage", message);
    }
}

The message appears for a very short while and soon vanishes into thin air, when the given <p:commandButton> is clicked.
The message is displayed as usual, if oncomplete="if(args &&!args.validationFailed) {updateTable();}" is removed from the <p:commandButton>.
Omitting the <p:remoteCommand> or setting the autoUpdate attribute associated with the <p:messages> to false is not possible for other certain reasons.
What is to be done for the message to display normally, when the given <p:commandButton> is pressed?


text:
Q: storing/bringing values from array of pointers I want to create an array in which I can but some variable adresses and then get to their value from the adress,
here's the code :
 SDL_Rect *arraypos[4];

 arraypos[1] = &poskey.x;
 arraypos[2] = &poskey.y;
 arraypos[3] = &posletter.x;
 arraypos[4] = &posletter.y;

posletter and poskey struct type :  SDL_Rect for more informations :
enter link description here
i made a little test to see if it'll work :
printf("%d \n",arraypos[1]);

printf("%d \n",*arraypos[1]);

printf("%d \n",*arraypos[2]);

printf("%d \n",*arraypos[3]);

if I'm getting it right : '*' next to  'pointer' will give you the value of the variable .
but all I got  is this warnings :
key.c: In function 'main':
key.c:49:17: warning: assignment from incompatible pointer type [-Wincompatible-pointer-types]
 arraypos[1] = &poskey.x;
             ^
 key.c:50:17: warning: assignment from incompatible pointer type [-Wincompatible-pointer-types]
 arraypos[2] = &poskey.y;
             ^
key.c:51:17: warning: assignment from incompatible pointer type [-Wincompatible-pointer-types]
 arraypos[3] = &posletter.x;
              ^
key.c:52:17: warning: assignment from incompatible pointer type [-Wincompatible-pointer-types]
 arraypos[4] = &posletter.y;
             ^
key.c:55:12: warning: format '%d' expects argument of type 'int', but argument 2 has type 'int *' [-Wformat=]
 printf("%d \n",arraypos[1]);
        ^

I tried to ignore them but when I excute the program :
rafiq@rafiq-Vostro-3500:~/Desktop/AI$ ./a.out
-1500334368
0
0
0

the adress and the rest is zeros.
I don't know what's the appropriate way to create a table of pointers and store adresses on it, and how to bring values from those adresses and apply some modifications on them.
Thank you.

A: It it difficult to determine exactly what your intent is from the problem statement. Whether you intend to declare an array of pointers to type SDL_Rect or whether you actually intend to declare and array of int. Regarless, the array indexes for an array with (4-elements) are 0-3, all arrays in C being zero indexed. e.g.:
arraypos[0]
arraypos[1]
arraypos[2]
arraypos[3]

Example with Array of Pointers to type
Given your edits to your problem statement, you state you want to "create a table of pointers and store adresses on it". If your intent was to declare an array of pointers (4) of type SDL_Rect, then the following is fine:
SDL_Rect *arraypos[4];

When you do so, each element of arraypos is an unallocated pointer to type SDL_Rect. There is nothing wrong with that, but you must understand, that is no different from declaring 4 separate pointers to type SDL_Rect ( e.g. SDL_Rect *pointer1; then SDL_Rect *pointer2;, etc...) That will simply declare 4-unallocated pointers of type SDL_Rect.
That means attempting to store the address of an integer value alone as an element of arraypos would violate strict-aliasing rules even if the size of SDL_Rect and int are the same. (see: sections 6.5.6 and 6.5.7 of the C standard)
What you can properly store in each element is the address for type SDL_Rect. So, if you have poskey and posletter which are statically declared type SDL_Rect, you can make the following assignments:
arraypos[0] = &poskey;
arraypos[1] = &posletter;

Each arraypos elements now holds a pointer to (e.g. the address of a) type SDL_Rect. You can then access the x, y, w, h values at each address by:
arraypos[0]->x;
arraypos[0]->y;
arraypos[1]->x;
arraypos[1]->y;
...

A short example using a generic structure of this situation would be:
include
typedef struct {
    int x;
    int y;
} SDL_Rect;

int main (void) {

    SDL_Rect poskey = { 5, 9 };
    SDL_Rect posletter = { 3, 7 };

    SDL_Rect *arraypos[4] = {NULL};
    size_t i;

    arraypos[0] = &poskey;
    arraypos[1] = &posletter;
    /* arraypos[2] & arraypos[3] are not used in this case */

    for (i = 0; i < 2; i++) {
        printf (" arraypos[%zu]->x : %d\n", i, arraypos[i]->x);
        printf (" arraypos[%zu]->y : %d\n", i, arraypos[i]->y);
    }

    return 0;
}

Output
$ ./bin/arraypos2
 arraypos[0]->x : 5
 arraypos[0]->y : 9
 arraypos[1]->x : 3
 arraypos[1]->y : 7

Example with Array of Integers
On the other hand, you are assigning int values to each element of arraypos, so it appears you want an array of integers, e.g.:
int arraypos[4] = {0};   /* always initialize your variables */

You have then declared arraypos as an *array of type int 4. You can then assign integer values to each of the index positions 0-3 (remember -- all arrays are zero indexed in C). A short example of this (without SDL_Rect, but using a generic struct) would be:
#include <stdio.h>

typedef struct {
    int x;
    int y;
} SDL_Rect;

int main (void) {

    SDL_Rect poskey = { 5, 9 };
    SDL_Rect posletter = { 3, 7 };
    int arraypos[4] = {0};
    size_t i;

    arraypos[0] = poskey.x;
    arraypos[1] = poskey.y;
    arraypos[2] = posletter.x;
    arraypos[3] = posletter.y;

    for (i = 0; i < sizeof arraypos/sizeof *arraypos; i++)
        printf (" arraypos[%zu] : %d\n", i, arraypos[i]);

    return 0;
}

Output
$ ./bin/arraypos
 arraypos[0] : 5
 arraypos[1] : 9
 arraypos[2] : 3
 arraypos[3] : 7

Think about which situation you are attempting to impliment and then let me know if you have further questions.

A: Several things look wrong.
First, the type of the array of pointers. You declared
 SDL_Rect *arraypos[4]; // wrong type

So you promise that each element of the array is a pointer to SDL_Rect. But apparently you want pointers to int, because the elements would contain pointers to int variables, that is int*. To declare generic pointers, use void*. So you want
 int* arraypos[4];

and later to set some element:
 arraypos[1] = &poskey.y;

Remember that the first element of an array has index 0 in C !
Then, to print some address, use %p  and cast that address to (void*), so
printf("second pointer is %p\n", (void*)arraypos[1]);

You should not use %d, since on Linux/x86_64 int have 4 bytes and pointers have 8 bytes.
void* can be thought as the common supertype of every pointer type. So it is not exactly meaning pointer to void, but pointer to anything or any kind of pointer.
I strongly recommend you to spend several hours reading a good C programming book; the notion of pointer is tricky and essential. In particular, you'll need to understand what pointer aliasing means. Read also about virtual address spaces (since pointers are addresses in such spaces, for most implementations of C on a desktop, laptop, or server operating system).
Of course, to dereference a pointer, use the * unary prefix dereference operator of C, e.g.
printf("second pointer contains %d\n", *arraypos[1]);

If you find that notation confusing, use parenthesis, e.g. *(arraypos[1]) but don't think of the dereference operator as giving the value of some variable (but the value in some memory location). To change the value of the referenced memory location, use the dereference operator on the left side of an assignment, e.g. *(arraypos[1]) = 3;; of course you can also assign pointers, so arraypos[2] = arraypos[1]; is making a pointer alias.
Pointers are memory locations (or memory addresses), which is not the same as a variable (for example, in a recursive function, each call frame of that recursive function has locations for the local variables). A pointer can point to some dynamically allocated heap memory zone. Read about memory management, C dynamic memory allocation, garbage collection (at least for the terminology and concepts of GC).
Be scared of undefined behavior & buffer overflow.
Compile with all warnings & debug info (gcc -Wall -Wextra -g) and improve your code till you get no warnings at all. Then use the debugger (gdb) & valgrind if available. Run your program step by step in the gdb debugger and print the various variables of your program there.

A: to start, this line: SDL_Rect *arraypos[4]; is defining an array of 4 pointers to instances of the struct SDL_Rect,
not 4 instances of an '*int'
Suggest:
int *arraypos[4];

// the rest of the 'setting the pointers' code is unchanged

// the rest of the printf() code is unchanged


text:
Q: Cannot use a Remove ⇒ AddOrUpdate sequence with Entity Framework I have a method that will Remove a set of entities.
I have a method that will AddOrUpdate a set of entities.
These methods are independently useful, but they have issues working together in entity framework.
The problem is that after removing a set of entities, for example (A,B,C,D), subsequent queries that resolve to one or more of those records always return cached garbage copies whose property values were nulled during the removal process.  An intermediate DbContext.SaveChanges solves the issue, but introduces additional overhead and leaves the operation in a half-complete state, so it would also have to be wrapped in another transaction.
What's the best way to handle this.

*

*Should I avoid an API that has Remove and Add/Update operations altogether, instead opting for an up-front hybrid operation that determines which ones are actually being removed and which ones are sticking around to be updated? or

*Should I keep the two useful methods and just wrap the two steps in a transaction scope, so that I can save changes to the context immediately after the remove, allowing subsequent adds/updates to properly reflect their removal, while still have the ability to commit or rollback at the end (e.g. if the new permissions can/cannot be set)?

I don't want use lower-level operations such as turning off tracking or attaching/detaching entities.
Suppose the entities are permissions.  Business logic dictates that I should use a logical two-step process to reset a user's permissions by first deleting any that I have permission to delete, followed immediately by trying to add/update any new permissions that I am allowed to assign.
When approaching this with two separate steps, I run into the problem as follows.  The first problem I encounter is that immediately after removing a set of permission entities like (A,B,C,D), entity framework mangles the object properties, setting many of them to null (presumably to sever foreign key relationships).  The problem is that because the entities still exist in the database, when trying to "add or update" a permission which still has a record in the database but has been removed in the context, EF always returns the cached/garbage copy of it.  So although I've removed the entity... I can't actually determine, within that same context, whether I need to re-attach/update it or add a new entity outright.  In other words, the framework returns an entity as though it exists (because it does still exist in the database) in spite of it being flagged as removed, but that entity object has garbage/null data, so that I can't even tell at that point whether it's safe to add a new one or I should try to "un-remove" the existing one.
It seems to me that such a remove/add-or-update pattern is simply not good for this kind of entity framework (or even ORMs in general).  Instead, I'd have to determine, in a single up-front operation, whether any of the new permissions already exist, so I can selectively delete the ones that are going away, while updating the ones that are just being reassigned (a new access level, for example).


text:
Q: Troubles with using google sign in in my android app if user is already logged in I have problems with using google sign-in in my application if user is already logged in. When I log in the first time it works nice since it asks me for password and other information but if user is already logged in I thin that normally it should open choose account menu like this one:

[Screenshot][https://androidclarified.com/wp-content/uploads/2018/11/Screenshot_2018-11-11-20-53-15-306_com.google.android.gms_-768x1365.png]

But what happens in my case is the following:
[problem-gif][https://gph.is/g/ZYBxy14]

public class LoginActivity extends AppCompatActivity implements
        View.OnClickListener{

    private static final String TAG = "LoginActivity1";
    private static final int RC_SIGN_IN = 9001;
    private GoogleSignInClient mGoogleSignInClient;

    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_login);

        GoogleSignInOptions gso = new GoogleSignInOptions.Builder(GoogleSignInOptions.DEFAULT_SIGN_IN)
                .requestEmail()
                .build();

        mGoogleSignInClient = GoogleSignIn.getClient(this, gso);
        SignInButton signInButton = findViewById(R.id.sign_in_button);
        signInButton.setOnClickListener(this);
    }

    private void signIn() {
        Toast.makeText(this, "button works", Toast.LENGTH_SHORT).show();
        Intent signInIntent = mGoogleSignInClient.getSignInIntent();
        startActivityForResult(signInIntent, RC_SIGN_IN);
    }
    private void signOut() {
        mGoogleSignInClient.signOut()
                .addOnCompleteListener(this, new OnCompleteListener<Void>() {
                    @Override
                    public void onComplete(@NonNull Task<Void> task) {
                        // [START_EXCLUDE]
                        updateUI(null);
                        // [END_EXCLUDE]
                    }
                });
    }

    private void updateUI(@Nullable GoogleSignInAccount account) {
        if (account != null) {
            Log.d(TAG, account.getDisplayName());
        } else {
            Log.d(TAG, "account is null");
        }
    }

    @Override
    public void onStart() {
        super.onStart();

        // [START on_start_sign_in]
        // Check for existing Google Sign In account, if the user is already signed in
        // the GoogleSignInAccount will be non-null.
        GoogleSignInAccount account = GoogleSignIn.getLastSignedInAccount(this);
        updateUI(account);
        // [END on_start_sign_in]
    }

    @Override
    public void onActivityResult(int requestCode, int resultCode, Intent data) {
        super.onActivityResult(requestCode, resultCode, data);

        // Result returned from launching the Intent from GoogleSignInClient.getSignInIntent(...);
        if (requestCode == RC_SIGN_IN) {
            // The Task returned from this call is always completed, no need to attach
            // a listener.
            Task<GoogleSignInAccount> task = GoogleSignIn.getSignedInAccountFromIntent(data);
            handleSignInResult(task);
        }
    }

    private void handleSignInResult(Task<GoogleSignInAccount> completedTask) {
        try {
            GoogleSignInAccount account = completedTask.getResult(ApiException.class);

            // Signed in successfully, show authenticated UI.
            updateUI(account);
        } catch (ApiException e) {
            // The ApiException status code indicates the detailed failure reason.
            // Please refer to the GoogleSignInStatusCodes class reference for more information.
            Log.d(TAG, "signInResult:failed code=" + e.getStatusCode());
            updateUI(null);
        }
    }

    @Override
    public void onClick(View v) {
        switch (v.getId()) {
            case R.id.sign_in_button:
                signIn();
                break;

        }
    }
}

A: You already called getLastSignedInAccount method in onStart() callback method. So, When you successfully log in with your gmail account,after each time you came into this activity, it does not show account choose dialog. So, No worries about this.
You can log out your user by following code. then you will get same log in pattern what you get first time.
    private void signOut() {

    mGoogleSignInClient.signOut()
            .addOnCompleteListener(this, new OnCompleteListener<Void>() {
                @Override
                public void onComplete(@NonNull Task<Void> task) {
                    // ...
                }
            });
}


text:
Q: SharePoint rest API for updating a site pages library item I need to update a filed in the Site pages library using rest API. I tried with axios and spHttpClient & spHttpResponse, but it's not working. Is there any sharepoint rest API for updating an item in a site pages library?

A: If you are "updating a file" (overwriting the existing file in an item), use:
POST https://{site_url}/_api/web/GetFileByServerRelativeUrl('/Folder Name/{file_name})/$value
Authorization: "Bearer " + accessToken
Content-Length: {length of request body as integer}
X-HTTP-Method: "PUT"
X-RequestDigest: "{form_digest_value}"

"Contents of file"

See Working with folders and files with REST
If you are updating the metadata of that doc lib item (and not doing anything to the file of the item), use:
POST https://{site_url}/_api/web/lists/GetByTitle('Test')/items({item_id})
Authorization: "Bearer " + accessToken
Accept: "application/json;odata=verbose"
Content-Type: "application/json"
Content-Length: {length of request body as integer}
If-Match: "{etag or *}"
X-HTTP-Method: "MERGE"
X-RequestDigest: "{form_digest_value}"

{
  "__metadata": {
    "type": "SP.Data.TestListItem"
  },
  "Title": "TestUpdated"
}

See Working with lists and list items with REST
Note that "Contents of file" in the request body should be the file in a form readable by the SP server. Example JavaScript code using the FileReader API is here. For updating list/lib column values (metadata), the example above used the field name "Title" (internal name property) with value set as "TestUpdated". Add more fields as valid JSON and note the headers used in the request as well as ListItemEntityTypeFullName required in the valid JSON request body. I developed a primitive form to test REST requests which is like Postman, but the simplest thing for you to do is use Postman to test your REST requests.


text:
Q: Dynamically changing ListView contents I have a ListView that contains entries from a Database of People. Eg...

*

*Anthony Kiedis

*John Frusciante

*Chad Smith

*Michael Balzary etc etc

What I am trying to implement is a Groups feature where you can create groups and put people into different groups and I want it to be all on one activity. So there are two buttons at the top, All Contacts and Groups. I want the All Contacts button to make the ListView show the people from my database and I want the Groups button to make the listview show all the groups that people are in. eg...

*

*Friends

*Family

*Co-workers

(These groups will be kept in another database)
So my question is: Is this sort of functionality possible? Or am I going to have to start a new activity with it's own listView and adapter when I click on Groups?
Thanks for your time.

A: You don't need to start a new activity , you just need to pass different data(List of groups) to the adapter.

A: *

*It's possible to show to kind of data in one ListView

*I hope u can make to fragment,when u click All Contacts u can show AllContactsFragment.
when u click Groups u can show GroupFragment.
if u use one ListView will make it a little complex when u click the group item to show
the peoples in this group.
if the UED want the group can extend and the Contact not extend.
and if u use one ListView it wont be easy to show.
so I suggest u should use to fragment to show two kind of the content.


text:
Q: Rethinkdb getField() gives an error This is the error:
toJSON` takes 0 argument, 1 provided after:\nr.table(\"users\").get(\"c62b27da-c0c2-4bfd-bd77-aaa95f215ec5\")(\"account\")"
This is my code:
`const userId = hook.params.user.id;
          const r = this.options.r;
          const accountId = r.table('users').get(userId).getField('account');
          if(accountId != null) {
            hook.data = Object.assign({}, hook.data, {
              createdBy: userId,
              account: accountId
            });
          }`

This is part of the code, but I think it is showing what part of code is giving me error!
Please help!

A: You're missing a call to .run(conn).
In your code, the constId constant does not contain an id, it contains an unevaluated ReQL query.
See https://rethinkdb.com/docs/introduction-to-reql/


text:
Q: YouTube API v3 Java authorization I'm using the YouTube Data API (Java) to upload videos to my YouTube channel.
I've tested it on my Windows PC and succeeded.
But the authorization in the sample makes a Credential instance by opening a browser window to signin to Google.
This is fine on my Windows PC, but I'm trying to get this code to work on a remote linux machine that I only have SSH access to.
I've searched stackoverflow for similar questions, and found the exact same question. But as that question doesn't have the specific tags that Google engineers require, I'm posting it as a new question.
Youtube API V3 Java Any possible without invoking browser to upload video
If you have any idea you can help, I'd be really grateful.
Thank you.

A: I looked for ways to accomplish this and found it.
I followed the instructions at https://developers.google.com/identity/protocols/OAuth2ServiceAccount
You need a new OAuth Client ID and set it up as an "Service account" in the Developers Console - APIs & auth - Credentials, and then download the P12 key.
You also need to change the Permissions of the service account to "Is owner" from the Developers Console.
Then change the code
Credential credential = Auth.authorize(scopes, "uploadvideo");

to
GoogleCredential credential = new GoogleCredential.Builder()
.setTransport(httpTransport)
.setJsonFactory(JSON_FACTORY)
.setServiceAccountId(emailAddress)
.setServiceAccountPrivateKeyFromP12File(new File("MyProject.p12"))
.setServiceAccountScopes(Collections.singleton(SQLAdminScopes.SQLSERVICE_ADMIN))
.setServiceAccountUser("user@example.com")
.build();

as specified in the URL above. emailAddress is the email address from the service account, the P12 filename must be changed, Collections.~~~ should be changed to scopes (the premade one in the original example), finally the serviceAccountUser should be your original Gmail ID.
I succeeded with the above method, hope it helps.

A: You could use SSH as a proxy and then use a local browser to use that proxy.
ssh -ND 8080 user@server.example.com
That sets a SOCKS proxy. Just edit your browser's proxy settings to IP: localhost Port: 8080 and your traffic is going out over SSH.
Just remember that all your browser's traffic is going through the proxy until you disable it so don't do anything against network policy while you're logged in. I might suggest using a private instance of Chrome, for example.
Note: This probably won't work for domain lookups so you'll need the local (to the SSH host) IP of the router.


text:
Q: Resizing UISearchBar in UINavigation Bar? I have added UISearchBar to UINavigationBar and this works really well, Except the left padding of UISerachBar here.
On Debug I came to know that here back button frame is too large that's why UINavigation bar title view shifted from left too much.
How to deal with that?
I want to achieve something like twitter app where the spacing between back button and search bar is not much.
Thanks in advance!

A: You can add a custom back button in your navigation bar to override the default back button (in this case the left button):
UIImageView *imageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"my-back-button-image.png"]];
imageView.frame = CGRectMake(0, 0, 43, 30);

UIBarButtonItem *barButtonItem = [[UIBarButtonItem alloc] initWithCustomView:imageView];

self.navigationItem.leftBarButtonItem = barButtonItem;

The space between left button and search controller decreases.

A: As mentioned earlier by Michele Broggi you can try that.
Else
You can also set the search Bar in place of navigation Title view so that it would be centre aligned to the screen (If you want that design)


text:
Q: In Google Docs Always a blank line above & below where I insert a table? In Google Docs, when I insert a table in Header or in Footer, there seem to be always a blank line above & below the table. See the screenshot below.
How do I prevent that?
Header screenshot  :

Footer screenshot :

A: It's by design, there's nothing you can do to completely remove the space.
You can reduce the font size of the space to make it smaller.


text:
Q: SharePoint hide spfieldurl column description(Type of description) I am trying not to have the column description for field type "URL" in SharePoint 2016. I want to use this OOTB column URL, but not get "Type the description". The only work around i saw is using JavaScript. I wanted to know, is there any other way remove it?
Programmatically, or some property in schema.xml?
Any suggestions and help is appreciated.
Thanks,
Menon

A: Sample JSlink script for you.
You could upload jQuery library and the custom jslink library to SharePoint library, I upload to layouts folder just for easy testing.
script:
(function () {

    var JSHyperlinkFieldCtx = {};
    JSHyperlinkFieldCtx.Templates = {};
    JSHyperlinkFieldCtx.Templates.Fields = {
        "JSHyperlink": {
            "NewForm": HideJSHyperlinkTemplate
        }
    };
    SPClientTemplates.TemplateManager.RegisterTemplateOverrides(JSHyperlinkFieldCtx);
})();

function HideJSHyperlinkTemplate(ctx) {

    var result = SPFieldUrl_Edit(ctx);
    var $f = $(result);
    $f.find('span:eq(1)').css('display', 'none');
    $f.find('input:eq(1)').css('display', 'none');
    return $f.html();
}

use the script:
~sitecollection/_layouts/15/jslinks/jquery-1.12.4.js|~sitecollection/_layouts/15/jslinks/HyperlinkField.js


text:
Q: Check if logged in user via SSH did go through Active Direcory I'm trying to check if a user who connects to a linux server via SSH is authentificated using Active Directory (Centrify).
In case he uses a local account (located in /etc/passwd), I need to display a warning asking him to use his Active Directory account and then prompt login again.
My first attempt was using PAM module pam_script inside /etc/pam.d/login to execute a script that checks if the current username exists in /etc/passwd whenever a user log in, display a warning if found and call the login command again.
I added the following line to /etc/pam.d/login
session    required    pam_script.so runas=root

This line execute a script file located in /etc/security/onsessionopen which contain:
#!/bin/sh
username=$1

if [ $(grep -c '^'$username':' /etc/passwd) = 1 ]
then
    echo "Warning, please user your AD credentials"
    login
fi

But the same scenario didn't work in /etc/pam.d/sshd.
When using SSH the script does run but doesn't display text or prompt for login.
Any thoughts ?
Thank you

A: Using id it is relatively easy to know if you are connected from ad or local /etc/passwd. next step would be to have a function in /etc/profile that will issue the warning message.

A: Awesome solution for standard 'login'. Unfortunately, I don't think you'll have much luck getting this same behavior going for 'sshd'. This is due to the fundamental connection procedures which sshd utilizes when establishing a connection. By the time we get so far as the PAM stack (or profile bits, as in the other suggestion), the username is already resolved; as submitted by the SSH client.
Here's a resource that may shed more light on this: https://serverfault.com/questions/330310/force-ssh-to-prompt-for-user
Given this info, I would suggest that an ideal solution may be to stick with your script (or /etc/profile addition), however for the 'sshd' stack; rather than hit 'login', have it sleep for 10s or what-have-you (to ensure the warning is seen), and then have the session closed.

A: Changing the shell for relevant accounts in /etc/passwd would work well
Put this into (say) /usr/local/etc/mustuseadlogin and make it executable:
#!/bin/sh
echo
echo "Please log in with AD authentication" >&2
echo
sleep 10
exit 0

Now edit /etc/passwd (ideally with vipw) and change the last field for all affected accounts to be /usr/local/etc/mustuseadlogin. For example,
roaima:x:1001:1001:I am roaima:/home/roaima:/usr/local/etc/mustuseadlogin

A: The pam_script module uses its exit status to tell the calling stack what to do. Change your code to this, and it'll work:
#!/bin/bash
username="$1"

if [[ root != "$username" ]] && grep -q '^'"$username"':' /etc/passwd
then
    echo "Warning, please user your AD credentials"
    exit 1
fi
exit 0

I've excluded root from the block. You can adjust the [[ ... ]] test for UIDs < 500, etc., to apply to your own scenario.


text:
Q: Visual Studio 2015 Windows Application Form with SQLite I need to create an application which needs to access basic data in a database in a simple way. So I decided to use SQLite as a database manager and Microsoft Visual Studio 2015 in order to achieve my goal.
My first step was to look for some info related to link a database created in SQLite with a Visual Studio Windows Application Form. I found this very simple and easy to follow YouTube playlist named C# & SQLite. Everything was fine until I had to create a new element named ADO.NET Entity Data Model which creates a model from an existing database. EF Designer to be precise. The problem is I can't "see" the existing database.
This is odd because I can work with the database through VS2015 using an extension named SQLite/SQL Server Compact Toolbox. Right now I have this features installed:
SQLite/SQL Server Compact Toolbox:

My NuGet packages:

I'm using .NET Framework 4.6 as you could see below:

The references in my project:

The second video of the previous mentioned playlist indicates to download an executable from the system.data.sqlite web. I have it installed too for .NET Framework 4.6 (the first one because I'm using x64):

This is the problem I'm getting, no database is listed.

Why is this happening? I am even able to modify the database through Visual Studio.

Similar issues if interested:

*

*How to connect to Sqlite in Visual Studio and create database?

*Sqlite not in list of Visual Studio data source options

*Missing ADO.NET data source for sqlite in Visual Studio 2015


text:
Q: pushing public package to azure devops feed In artifacts I have created a feed,and all seems good. It publishes my packages to the feed.Good
If I understood it correctly it can work like a " private Nuget server" if you like and have all the packages that your team should be using.
I need to push several public packages to my feed.
EG How can I push  "Newtonsoft" version 11.2 to my feed on azure devops?
Is this a manual step?
Can be automated?
many thanks

A: You don't need to do anything. Configure your feed to use NuGet.org as an upstream package source and any packages that are available on NuGet will be automatically cached when restored.


text:
Q: How to create a full rainbow background I am creating a custom color picker, and I do not know how to create a rainbow gradient background color. I would like to do the background without javascript if possible. Can someone please guide me on this?

A: you can do this.

.container{
  background:linear-gradient(90deg, Red, Orange, Yellow, Green, Blue, Indigo,violet);
  width:500px;
  height:500px;
}

if it helps you let me know

A: You can use the following html code,

#rainbow{
  height: 300px;
  background-color: red; /* For browsers that do not support gradients */
  background-image: linear-gradient(to right, Red , Orange, Yellow, Green, Blue, Indigo, Violet);
}
<!DOCTYPE html>

You can also change this to make it from top to bottom
#rainbow{
  background-image: linear-gradient(red, yellow);
}


text:
Q: Multiple distros: extremely slow window rendering, with whole display blanking momentarily Symptom
When an application window is rewritten due to any change in content, rendering takes an unusually long time (many seconds for what is normally instantaneous), and the entire display goes blank momentarily before the new content is displayed.
Details
For any activity involving multiple window modifications, like scrolling any window, or a browser loading a complex web page, the problem repeats with each incremental change until final rendering is complete.  This results in the computer freezing, sometimes for minutes. with the display going on and off every few seconds with each incremental screen write, making it unusable.
When I encounter the problem, it is with a new Linux OS doing nothing demanding.  The activity is typically OS setup on a fresh install or live session, with a single, low-demand utility open; or a couple, like a terminal plus a configuration utility.  Occasionally, it will include the bundled barebones browser (no add-ons), with one or two reference tabs open.  Each open application compounds the problem.  Switching from one open application window to another can take several minutes.
Particulars
System:  The computer is an old Gateway desktop; off-the-shelf OEM hardware:

*

*Quad Core AMD Phenom II X4 805 CPU

*ATI Radeon HD 3200 graphics

*8 GB RAM

It has multi-boot original OEM Windows 7 plus a number of Linux distros (Ubuntu and Mint), which all run on it routinely with no problems.  I occasionally boot other Linux distros from a USB drive, with no issues.
There's no evidence of any malfunctioning hardware or symptoms of any problem with those OSes.
History & Scope:

*

*Many months ago, I installed Gecko Linux (a spin of openSUSE) with the Cinnamon desktop.  That distro was installed on several other computers and worked properly.  On this PC, it exhibited the symptoms described above.
Actual openSUSE with some other desktop environments (Cinnamon wasn't offered), had no problem on this PC.  I eventually gave up trying to solve it and just installed a different distro (Mint Cinnamon), which worked fine.

*I later tried MX Linux (Debian stable + Xfce) v18.1.  Again, that worked on other computers (both AMD and Intel hardware), but had the same problem on this computer.  It wasn't the only game in town, so I just used a different distro.

*MX recently came out with v19, which I  installed and successfully use on other computers.  On this computer, it still has the symptom.  I installed Mint Xfce and it works fine, as did several other Xfce-based distros.
I have MX v19 as the default distro on several other computers and like it, so I'm trying to solve whatever is the underlying problem on what I'm using as my main computer.
Resolution attempts

*

*Logically, it seems like it has to be some compatibility issue with the Radeon graphics hardware, because that is the only unique thing about this computer that relates to display output.  The symptoms occur whether the distro is run from a live DVD session or installed on a drive.  The problem distros work without a hitch on other hardware.  Other distros with the same desktop environments work fine on this computer.

*All of the distros (both working and problematic ones) use the open source Radeon driver, so the driver is not the issue.
Certain older Radeon graphics cards can have some difficulties with the open source driver (although I didn't find this specific issue previously mentioned).  There used to be a proprietary driver (fglrx), that was sometimes helpful, but that appears to be deprecated; it is no longer available through the Debian backports (MX 19 is based on Buster).  I tried the proprietary driver from the AMD website, but it hasn't been updated since the dawn of time, and had no effect.

*Cinnamon and Xfce use different window managers.  Different distros use the DE's default window manager for Cinnamon or for Xfce, so the WM doesn't seem to be the issue.

*MX has compositing disabled, so it isn't that.

*The problem appears to be limited to certain distros on this particular hardware.  I couldn't find reports of similar problems in general by other users of the two distros in question.  The hardware is fairly old, so problem reports based on the hardware aren't expected.

*Based on @linux-fan's input in the comments, I tried getting some diagnostic information (some detail has been incorporated above).  This turned out to be generally difficult and slow because collecting diagnostics tends to freeze the system due to screen activity.
I no longer have openSUSE, but still had live-DVDs for Gecko with Cinnamon, Xfce, Mate, and Plasma (only Cinnamon had been previously tested on this PC), and MX v18.1 and 19.  I compared those with some working distros.
All four of the Gecko distros had the symptom, so the issue is with the distro, itself, not the DE.
There was nothing of significance in the Xorg.0.log files, and no system error logs were generated.
A few different versions of the X.org server were represented, but both working and problematic distros shared the same versions, and the newest version was on a problematic distro.
top showed no serious CPU or memory usage.  However, it is a real-time display.  When the screen blanked, that display disappeared and there was no unusual activity when the display resumed.  So it produced no information at the height of the symptom.

*MX v19 is built on Debian Buster Xfce.  I installed the Debian "source" and that did not suffer from this symptom.  I tried comparing the lists of installed packages.  There are nearly 4,000 package differences, many of which are dependencies.  There are also endless differences in settings.  This comparison approach isn't practical for identifying the problem.
Question
Is this symptom diagnostic of a specific known problem or subsystem?  Are there diagnostics I could run that would shed some light?


text:
Q: What does mixed content warnings due to http content instead of https content compromise? I'm aware that, essentially, https encrypts data being sent and received so it seems to me that nothing is compromised except the data being sent to or from http, but this question is more for clarification, so does having content served over http make other data insecure? For example, if I'm requesting public images over http on my server with SSL, am I compromising anything else besides the data of those images and the privacy that a user is viewing this data?

A: Chrome and Firefox (I can't speak to Safari and IE, they might as well) block mixed-content on a HTTPS page.
If the page's URL has https as the scheme, all assets on that page must be loaded via HTTPS. Images, fonts, JavaScript, iframes - if it's not HTTPS, it won't show up.
It's for the user's protection. There are a variety of potential attacks. An image loaded via HTTP on a HTTPS page could be swapped out for a different image, which might be a problem if your neighbor's face shows up on the FBI's Most Wanted list. A JavaScript asset loaded via HTTP could be MITMed to send your credit card to an attacker's server. etc.


text:
Q: File.AppendAllText causes access exception to be thrown when program run for the second time I have a log file that I delete and create every time my application is launched like so:
if (File.Exists(LogPath))
{
   File.Delete(LogPath);
   File.Create(LogPath);
}

And I'm writing in it using File.AppendAllText like so:
File.AppendAllText(LogPath, logMessage);

My issue is that when I run the program for the second time, the above call causes an exception to be thrown saying file can't be accessed

"because it is being used by another process"

What is wrong with this approach?

A: It's caused by File.Create(). Remove it and File.AppendAllText creates a new file if it doesn't exist.
Note:
File.Create() returns a FileStream value, if you do not dispose it, then it will cause an error when you want to access it.

A: This is not because of File.AppendAllText but instead this line of code:
File.Create(LogPath);

As per the documentation of File.Create(string):

Return Value
  Type: System.IO.FileStream
  A FileStream that provides read/write access to the file specified in path.

It returns an open FileStream object. You need to dispose of this object in order to close the stream and release the file. If you don't then this object will keep the file open until GC finalizes the object at some later indeterminate point in time.
Here's how to write this line of code, either one of the following two alternatives will work:
File.Create(LogPath).Dispose();
using (File.Create(LogPath)) { }

What happened is that the second time your program ran the file exists, so you deleted it and then recreated it, but the "recreated it" part kept the file open, so when it a short time later reached the File.AppendAllText method, the file was still open.
Note: If you always call File.AppendAllText you can simply just delete it, as AppendAllText will create the file if it doesn't already exist, as per the documentation of File.AppendAllText:

Opens a file, appends the specified string to the file, and then closes the file. If the file does not exist, this method creates a file, writes the specified string to the file, then closes the file.

(my emphasis)

A: You would need to close the file after you create for further processing.
if (File.Exists(LogPath))
{
   File.Delete(LogPath);
   using(var handler = File.Create(LogPath))
   {

   }
}

Other way could be to use WriteAllText and you won't need to delete it everytime.
File.WriteAllText(LogPath, "contents");

A: You, probably, mean
// clear the file (write an empty text to it) if it exists
if (File.Exists(LogPath))
{
  File.WriteAllText(LogPath, "");
}
...
File.AppendAllText(LogPath, logMessage);

you can try combining clearing and writing in one call:
File.WriteAllText(LogPath, logMessage);

If the file exists, WriteAllText will clear it and write logMessage; if file doesn't exist, WriteAllText will create it and write logMessage.


text:
Q: Use of "adorn" as a verb Interested in hearing some thoughts on the word "adorn." Someone I'm working with recently used it like this:
"They all adorn fancy masks for the party."
They mean it is in: "They all wear fancy masks for the party."
I know you could (excusing the passive voice) say something like, "Each person at the party was adorned by a fancy mask."
Or "Fancy masks adorned each person."
But can you say "They adorn fancy masks."?

A: Your coworker is confusing adorn with don:
They all don fancy masks for the party.

don2 transitive verb [with object]
Put on (an item of clothing) 'in the locker room the players
donned their football jerseys' Source: Lexico —
don

So, they all put on masks for the party. Compare:
They all adorn fancy masks for the party.

adorn transitive verb [with object]
Make more beautiful or attractive.'pictures and prints adorned
his walls' Source: Lexico —
adorn

There, they all—for example—put sequins on masks for the party.
If you need to use adorn and you need the people in the masks, you can try the past participle adjective use:

They are adorned with fancy masks for the party.

Or, less likely, the passive voice:

They are adorned by fancy masks for the party.

Or, unlikely, the active voice:

Fancy masks adorn them for the party.

A: Since adorn is transitive and the object is masks, that sentence would only make sense if it meant that the party-goers were somehow decorating their own masks.


text:
Q: Exception: "could not set a field value by reflection setter" When I try to read written data from hibernate database I get this error:
Exception in thread "AWT-EventQueue-0" javax.persistence.PersistenceException: org.hibernate.PropertyAccessException: could not set a field value by reflection setter of familyTree.data.Data1.bio

This is class for saving my data with constructor, I pasted important part from it:
@Entity
@Table(name="DATA.PERSON")
public class Data1 {

    @Id
    @Column(name = "ID")
    @GeneratedValue
    private int id;

...

    @Column(name = "BIO")
    public final String bio;

...

    public Data1(String names, Integer dayBirth, Integer monthBirth, Integer yearBirth, String bio, String fileID) {
        this.names = names;
        this.dayBirth = dayBirth;
        this.monthBirth = monthBirth;
        this.yearBirth = yearBirth;
        this.bio = bio;
        this.fileID = fileID;
    }

...

    public String getBiog() {
        return bio;
    }

So, when I try to do this:
data = new Data1(names, dayBirth, monthBirth, yearBirth, bio, fileID);
                                fireActionPerformed();

                            DatabaseUtils.spremiRezultatTesta(data);

                            List<?> podaci = DatabaseUtils.dohvatiRezultateTestova();

                            String ffff = podaci.get(0).toString();

                            System.out.print(ffff);

I get mentioned exception. Any help?
Database entity for that is created like this: BIO VARCHAR(80) NOT NULLand I can normally read it with SELECT FROM query in database.
Here is my DatabaseUtils class, used for saving and loading from database, if needed:
public class DatabaseUtils {

    public static void spremiRezultatTesta(Data1 data) {
        EntityManagerFactory emf = Persistence.createEntityManagerFactory("HibernatePersistenceUnit");
        EntityManager em = emf.createEntityManager();
        em.getTransaction().begin();
        em.persist(data);
        em.getTransaction().commit();
        }

        @SuppressWarnings("unchecked")
        public static List<Data1> dohvatiRezultateTestova() {
        EntityManagerFactory emf = Persistence.createEntityManagerFactory("HibernatePersistenceUnit");
        EntityManager em = emf.createEntityManager();
        Query query = em.createQuery("FROM Data1");
        return query.getResultList();
        }

}


text:
Q: Androidx Constraintlayout is unresponsive with Android Studio I am running into issues with Android Studio 3.3.2 and the AndroidX version of constraint layout. Basically when I converted my Constraint layout to
androidx.constraintlayout:constraintlayout:2.0.0-alpha4

The editor is not letting me move views around, connect views with chains/constraints ..etc. When I do that, I find "Error reported" by Android studio about something crashes. And then the editor becomes unresponsive to changes (say if I change margin from 0dp to 8dp). No changes take effect in the editor or xml.
Any ideas what I need to do?
Thanks

A: I too faced the same issue,even after invalidating caches and restarting it was not working. So I just migrated to
androidx.constraintlayout:constraintlayout:2.0.0-alpha3

The motionLayout inside alpha4 was also having some problem


text: Q: Singleton on Jpype I am trying to use a kotlin/java singleton from jpype in python. When I try to do anything I get this TypeError: No matching overloads found for *static* I tried importing with    from package import Singleton and jpype.Jpackage(package).Singleton


text:
Q: What's the origin of 'ditzy'? The Online Etymology Dictionary said it was unknown. However, it also says that one of the meanings of dis, as in disrespect, was originally:

short for disconnected in the telephone sense and used figuratively in slang to mean "weak in the head"

I'm curious if ditzy may have come from dis.

Any thoughts on the matter?

A: From Dr. William Long:

.9. Ditzy (1973). It is hard to believe that this word is of such recent origin. It means "eccentrically silly, giddy, or insane," according to the Collegiate. The OED calls it ditsy and points to dicty, a word first appearing in 1926, as the progenitor of ditsy. But dicty means "conceited, high-class, snobbish." Though the OED says that the origin is unknown, it seems to have emerged in Black English, as reflected in this 1944 quotation: "These (sic) are only a few dozen words and phrases that are uniquely Negro...such as 'dicty' which means trying to put on airs and act upper class without having the basis for doing so."
Thus, I have a hard time seeing how ditzy/ditsy might have been derived from dicty. In any case, once ditzy appeared on the scene in the late 1970s, it meant either "fussy"/"intricate" or, more frequently, "(Esp. of a woman) stupid, scatterbrained; cute." Even though we were in the middle of the feminist revolution at that time, the word ditzy seemed to take on a meaning associating it exclusively with women. From a Time movie review in 1981: "Bob Newhart plays the President of the United States. Madeline Kahn is his ditso wife. Gilda Radner is their ditsy daughter." Perhaps receding images of Goldie Hawn also helped to give it an anit-feminist life of its own. Or, perhaps when men felt threatened by the gradual incursions of feminist thought into the workplace, they retaliated by coining the term ditzy.

Here's the OED's 1976 earliest citation from Texas Monthly:

After a day of shopping for school clothes or a prom dress, mother used to steer us to places like Neiman-Marcus' Zodiac Room (for Pot Luck Specials), Sakowitz's Sky Terrace (shrimp salad and cheese straws), Foley's Azalea Terrace (turkey mornay), or Frost Brothers' Tastesetter (margarita pie). Besides menus of "ditzy ladies' things," these places had loads of cozy charm, an an occasional fashion show, and cheerful service.

Here's an antecedent from 1974's Myra & Gore by John Mitzel:

Here's another from a 1974 New York Theatre Critics' Reviews:

Finally, here's an antecedent for the OED's alternate spelling ditsy, from 1973's They've Shot the President's Daughter! by Edward Stewart:

I just couldn't keep my eyes off him, Fran, and I still can't believe he's interested in ditsy little me! But is he ever— oh boy! I practically had to pry him loose with a crowbar after the third "goodnight"! Anyway, wish me luck!

A: The OED says origin unknown; perhaps corruption of 'dicty'. Dicty means snobbish, pretentious, self-important, 'stuck-up'; having or characterized by aspirations to gentility or elegance; flashy, showy.
First recorded use is in the 'Texas Monthly' in 1976.

A: The OED says for ditsy (the word can be spelled both ways) :

(Esp. of a woman) stupid, scatterbrained; cute.

On the web, we can find a definition of ditzy   in the Merriam Webster, in the Urban Dictionary and plenty of others.
Etymonline says "unknown origin" and Dictionary.com says it could be a combination of dotty an dizzy.

A: It's possible the origin is similar to the recent PWNED term- an initial misspelling of "owned" that took on a life of its own. The 70's- where no spell check was available, this type of misprint wasn't uncommon. Seems the meaning is identical to "dizzy" when used in a sexist sense; "dizzy" is very close I spelling to "ditzy"- Just a theory

A: Perhaps "ditzy" is an adjective stemming from the name "Gerda Ditzen" circa 1929, who was described in the December 2015 issue of "Discover" magazine by James S. Forrester in his article "Crazy Heart" as "so thoroughly smitten that she seemed bereft of all judgement."   Interestingly, Ms. Ditzen's actions were essential for Dr. Werner Forssmann to perform a bold experiment on himself and earn a Nobel Prize in Medicine.

A: I think it came from DIDS.. Damsel in Distress~


text:
Q: Making a winform form owner drawable I have a form that I am attempting to override the WndProc subroutine on. I am using GetDCEx to get a DC handle to my form. According to Microsoft's documentation on using GetDCEx, my form must have the CS_OWNDC or the CS_PARENTDC flag set my window class in order to use GetDCEx. According to Spy++, my window does not have these class attributes. My question is, how can I assign CS_OWNDC or make the form owner-drawable so I can use GetDCEx in my program? I am using C#, by the way.

A: I think you should override CreateParams in your code like this:
/// <summary>
/// Overrides the control's class style parameters.
/// </summary>
protected override CreateParams CreateParams
{
    get
    {
    Int32 CS_VREDRAW = 0x1;
    Int32 CS_HREDRAW = 0x2;
    Int32 CS_OWNDC = 0x20;
    CreateParams cp = base.CreateParams;
    cp.ClassStyle = cp.ClassStyle | CS_VREDRAW | CS_HREDRAW | CS_OWNDC | ...;
    return cp;
    }
}


text:
Q: How to tell whether the ranges of two matrices intersect Assume that we have two matrices over the complex field i.e. $A\in\mathbb{C}^{m\times n_1}$ and $B\in\mathbb{C}^{m\times n_2}$.
Let their range spaces be the sets
$$R(A)=\{A\mathbf{x}|\mathbf{x}\in\mathbb{C}^{n_1}\}$$
and
$$R(B)=\{B\mathbf{x}|\mathbf{x}\in\mathbb{C}^{n_2}\}$$
respectively.
I want to know if there is a systematic way to tell whether the range spaces have common elements. I am trying to check this in Matlab thus I am trying to find an algorithm.
In other words if the columns are s.t. $A=\begin{bmatrix}\mathbf{a}_1&\dots&\mathbf{a}_{n_1}\end{bmatrix}$ and $B=\begin{bmatrix}\mathbf{b}_1&\dots&\mathbf{b}_{n_2}\end{bmatrix}$ how to tell if the following is true
$$\sum_{i=1}^{n_1}x_i\mathbf{a}_i=\sum_{i=1}^{n_2}y_i\mathbf{b}_i\Leftrightarrow x_i=y_i=0 \text{ for all }i$$
The matrices are fixed, so I am not looking for a way to construct them.

A: $\DeclareMathOperator{\range}{range}$
$\DeclareMathOperator{\kernel}{kernel}$
You want to find $Ax = By \ne 0$ in $\range(A) \cap \range(B)$, if possible.  To eliminate the possibility $Ax = B y = 0$ with $x \ne 0$ or $y \ne 0$, replace $A$ with a matrix $A'$ whose columns form a basis of the column space of $A$ (i.e of the range of $A$) and similarly replace $B$ with a matrix $B'$ whose columns form a basis of the column space of $B$.   Do this algorithmically by column reduction.
Now $A'x = B'y \ne 0$ is a non-zero element of $\range(A) \cap \range(B)$ iff $A'x = B'y$ with $\begin{bmatrix} x\\y\end{bmatrix} \ne 0$ iff $\begin{bmatrix} x\\-y\end{bmatrix} $ is a non-zero element of $\kernel \left[A' \vert B'\right]$, where $ \left[A' \vert B'\right]$ is the matrix built by adjoining the columns of $A'$ and those of $B'$.

A: Take the matrix $C\colon=[A|B] \in \mathbb{C}^{m\times (n_1+n_2)}$. Then the dimension of the intersection of the ranges of $A$ and $B$ equals
$$\operatorname{rank}(A)+\operatorname{rank}(B)-\operatorname{rank}(C)$$
You can determine the rank of a matrix in MATLAB.


text:
Q: error C++: cannot convert ' '::Vector' to 'double' in assignment sum_aux=A[f][j]*xk[j]; Buenas! Estoy teniendo problemas con el error expuesto cuando intento multiplicar la matriz A con el vector xk. La matriz A la cojo de un fichero externo de entrada. ¿Alguien sabría decirme cómo arreglarlo?. Muchas gracias por adelantado!
Adjunto las partes del código interesantes:
Matrix <double> A,B,C;

Vector <double> xk[9] = {27.0000, -0.000901816789824, 0, 0, 0, 0,0, -0.000901816789824 , 0};

int f,j,n, m, p,a,b,b2,c,tam;

double sum_aux=0;

a = 9;
A.resize(a, a);

//Para matriz A
{
    getline(myfile, line);
    std::istringstream is(line);

    for (int i = 0; i < a; i++)
        for (int j = 0; j < n; j++)
            is >> A[i][j] >> ch;
}

for(f=1;f<=a;f++){
    sum_aux=0;
    for(j=1;j<=a;j++){
        sum_aux=(double)A[f][j]*xk[j];
        sum_aux=sum_aux + (double)A[f][j+1]*xk[j+1];
    }
    xk_aux[j]=sum_aux;
}

A: Quizás podrías probar con ejemplos sencillos. También puedes probar a hacer los accesos con las funciones de la librería vector en C++, por ejemplo la función "at". Prueba un codigo parecido al siguiente:
#include <iostream>
#include <vector>

using namespace std;

int main()
{
    vector<double> xk(9);
    xk.resize(9);
    xk.at(0)=27;
    xk.at(1)=0;
    xk.at(2)=0;
    xk.at(3)=0;
    xk.at(4)=0;
    xk.at(5)=0;
    xk.at(6)=0;
    xk.at(7)=0;
    xk.at(8)=0;

    /* Ejemplo de multiplicación. */
    double res = 0.0;

    res = 2*xk.at(0);

    cout << res << endl;
    return 0;

}

Saludos!


text:
Q: Why is GSL_SUCCESS and GSL_CONTINUE missing from my cygwin GSL installation? I am creating a simple application involving a basic one dimensional minimisation using GSL. I try to run the following, after including gsl_min.h
do
    {
      iter++;
      status = gsl_min_fminimizer_iterate (s);

      status = gsl_min_test_interval (a, b, 0.001, 0.0);

      if (status == GSL_SUCCESS)
        printf ("Converged:\n");
    }
    while (status == GSL_CONTINUE && iter < max_iter);

However I get an error saying that both GSL_SUCCESS and GSL_CONTINUE are undeclared. Why could this be?
My cygwin installed libraries are:

A: So I just needed to include:
<gsl/gsl_errno.h>

Then it worked with no problems!


text:
Q: Using lastrow variable in filter results in blank sheet I have an issue with this code producing a blank sheet:
With Sheets("Sheet1")
        LastRow = .Range("AG" & .Rows.Count).End(xlUp).Row
    End With

ActiveSheet.Range("$AG$1:$AG$" & LastRow).AutoFilter Field:=1, Criteria1:= _
        "FS Cable OR Bend In/Service Group"

And yes, that last line is accurate, there are values in column AG that have that exact verbiage. Thanks for any help.


text:
Q: Ranking repeating group of values in a Column using R I have a email meta-data table that is sorted in the below order, wherein I know that the data is sorted and each occurrence of "From" means that the next set of entries represent attributes of another email.
The column has repeating patterns as below :
 ==============

      Tag
 ==============

  From
  Recepient
  CC_Recepient
  CC_Recepient
  Subject
  From
  Recepient
  CC_Recepient
  Subject
  From
  Recepient
  Subject
  From
  etc..
 ==============

I need to create a second column which is a unique identifier for each email related group of entries as below. Repeating ocurrence of "From" is the only way I have to identify the start of next group of entries.

Tag 	Identifier

From 	1

Recepient 	1

CC_Recepient 	1

CC_Recepient 	1

Subject	1

From 	2

Recepient	2

CC_Recepient	2

Subject	2

From	3

Recepient	3

Subject	3

From	4

etc..

A: You can check if Tag is equal to From, and then do cumsum on the conditions:
df$Identifier <- cumsum(df$Tag == "From")
df
#            Tag Identifier
#1          From          1
#2     Recepient          1
#3  CC_Recepient          1
#4  CC_Recepient          1
#5       Subject          1
#6          From          2
#7     Recepient          2
#8  CC_Recepient          2
#9       Subject          2
#10         From          3
#11    Recepient          3
#12      Subject          3
#13         From          4
#14        etc..          4


text:
Q: About conditional expectation and R-N derivative: $X \geq 0$ is a r.v. On $(\Omega, \mathcal{F}, \mathbb{P})$. $\mu(E)=\mathbb{E}(X\chi_{E})$ $X \geq 0$ is a random variable on $(\Omega, \mathcal{F}, \mathbb{P})$, $\mathbb{E}(X) = 1$.
$\mathcal{G} \subset \mathcal{F}$ is a sub sigma-algebra. Define $\mu(E)=\mathbb{E}(X1_{E})$.
How to show $\mu$ is absolutely continuous w.r.t. $\mathbb{P}_{|\mathcal{G}}$ and find the Radon-Nikodym derivative?
Edit: Really appreciate @John Dawkins for pointing out that the bar symbol means the restriction, not the "conditioning on"

A: This is more of an extended comment than a full answer:
If $E\in\mathcal G$ with $\mathbb P(E\mid\mathcal G)=0$ then $$\mu(E)=\mathbb E[X\mathsf 1_E\mid\mathcal G]\leqslant \mathbb E[|X|\mathsf 1_E\mid\mathcal G]\leqslant \mathbb E[|X|\mid\mathcal G]\mathbb P(E\mid\mathcal G)=0.$$
It seems that the Radon-Nikodym derivative should be:
$$
\mu(E) = \int_E X\ \mathsf d \mathbb P_{\mid\mathcal G}.
$$

A: Suppose that $E\in\mathcal G$ and $\Bbb P_{|\mathcal G}(E) =0$. This latter condition simply means that $\Bbb P(E)=0$. Therefore $1_E=0$, $\Bbb P$-a.e. Consequently $X1_E=0$, $\Bbb P$-a.e., as well, and
$$
\mu(E) =\Bbb E[X1_E] =0.
$$
This proves the implication $\Bbb P_{|\mathcal G}(E) =0\,\Rightarrow \mu(E)=0$, for each $E\in\mathcal G$. Thus $\mu\ll \Bbb P_{|\mathcal G}$.
[N.B. $\Bbb P_{|\mathcal G}$ is the restriction of $\Bbb P$ to $\mathcal G$; it is  not the conditional probability $\Bbb P[\cdot\mid\mathcal G]$.]


text:
Q: protractor: How to find element by exact text? testing applications encountered another problem. I need to click element by exact text, so i found a solution where I use cssContainingText and each,then if statment to comapre text and select certain element, but I think maybe is a better solution for that purpous?
Second questions: somewhere on stackoverflow I read that
element.click().then(){
dosomething;
});

will cause that 'dosomething;' will perform after click, I try this and it doesn't work, how to make that 'dosomething;' will perform after click;

A: 1) Delian has correct answer, but in many cases the element content has additional whitespaces, so you need to trim them:
getElementsByText: function (text, parentXpathSelector) {
    parentXpathSelector = parentXpathSelector || '//';
    return element(by.xpath(parentXpathSelector + '*[normalize-space(text())="' + text + '"]'));
}

2) https://stackoverflow.com/a/21785088/3147680

A: You can use by.xpath as a selector:
By exact text

element(by.xpath('.//*[.="text"]'))

By css class with exact text

element(by.xpath('.//*[.="text" and class="some-css-class"]'))

You can find a lot of xpath examples online. There's also a tester you can use.

A: Xpath is elegant but not so easy to read if someone else needs look at the code. I often pick an element in a repeater by only using cssContainingText and chained by.css.
example:element(by.css('.dropdown-menu')).element(by.cssContainingText('span', constants.STATUS.PENDING)).click();
sure it might be slower than xpath. I realy don't now. But managable comes first

A:  const allOptions = element.all(by.css('css-class'));
            allOptions.filter( (elem) => {
                return elem.getText().then((text) => {
                    return exact-text === text;
                });
            }).first().click();