text:
Q: css transform specified by class I am looking for a way in vanilla css or css preprocessor such that

When class1 and class2 both have a transform property defined, a single html element of class1 and class2 has both transformations applied.

That is to say, I am looking for a way such that a class is only controlling one set of transformations. Right now it appears the last class defined in the css file has its transformation(s) displayed. I am not familiar with css preprocessors so if one of them has this feature please also link to a post/article/reply that summarizes what the preprocessor could do in general.
I am aware of methods of introducing wrapper html elements, one for each set of transformations, and using += in js. But I'm specifically looking for a css solution. I am open to altering html if it's just going to be a fixed number of elements regardless of the number of transformations.

.scale {
  transform: scale(0.8) rotate(4deg);
}

.translate {
  transform: translate(20px);
}

div {
  border: 2px solid black;
}

text

text

text

text

text

I know that order matters in transformations. But I am not concerned about that at the moment. I just want to know if there there exists a way to modify instead of overwrite a rule.

A: You can do that using CSS custom properties (variables):
* {
    /* space before semicolon is essential
       to make it a valid empty value */
    --scale: ;
    --translate: ;
}

.scale {
    --scale: scale(0.8) rotate(4deg);
}

.translate {
    --translate: translate(20px);
}

.scale,
.translate {
    transform: var(--scale) var(--translate);
}


text:
Q: 400 Bad Request When Send Multipart Request To Spring MVC Controller I am attempting to send form data with Multipart data (Image) to Spring MVC controller, but its not calling Spring controller defined and showing 400 Bad Request error when http post call in chrome console. I have referred all questions related to this in SO but i could not unlock the problem. Please find where i did mistake.
Html Code:
<input ng-model='file1' type="file"/>

AngularjS Code:
$scope.saveData = function (formObj) {
        $http({
            url: CONTEXT_PATH+'saveFile',
            method: "POST",
            headers: { 'Content-Type': undefined },
            transformRequest: function (data) {
                var formData = new FormData();
                formData.append("model", angular.toJson(data.model));
                formData.append("file", data.files);
                return formData;
            },
            data: { model: formObj, files: $scope.file1 }
        }).then(function (response) {
            alert(response);
        });
    };

Spring Controller Code:
@RequestMapping(value = "/saveFile", method = RequestMethod.POST, consumes = MediaType.MULTIPART_FORM_DATA_VALUE)
public @ResponseBody String storeAd(@RequestPart("model") String adString, @RequestPart("file") MultipartFile file) throws IOException {
    System.out.println("adString > "+adString);
    return "OK";
}

Error in browser console:
Failed to load resource: the server responded with a status of 400 (Bad Request)

Data Details in Browser:
Request Header:

Accept: application/json, text/plain, */*
Accept-Encoding: gzip, deflate, br
Accept-Language: en-US,en;q=0.9
Cache-Control: no-cache
Connection: keep-alive
Content-Length: 24635
Content-Type: multipart/form-data; boundary=----WebKitFormBoundaryvpAdhKSccplcX99W

Form Data:

model: {"emailId":"ss@ss.com",..}
file: undefined

Response Header:

Connection: close
Content-Length: 1058
Content-Type: text/html;charset=utf-8

No exception at Server Side.

A: Using below request, I was able to upload file to a controller similar to yours.
Form Data :
------WebKitFormBoundaryDhtDYn8BtyH0NdRW
Content-Disposition: form-data; name="file"; filename="dummy_file.xls"
Content-Type: application/vnd.ms-excel
------WebKitFormBoundaryDhtDYn8BtyH0NdRW--

Request Headers :
POST /demo/upload?data=dummy_data HTTP/1.1
Host: localhost:5005
Connection: keep-alive
Content-Length: 36563
accept: */*
Origin: http://localhost:5005
User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like     Gecko) Chrome/75.0.3770.100 Safari/537.36
Content-Type: multipart/form-data; boundary=----WebKitFormBoundaryDhtDYn8BtyH0NdRW
Referer: http://localhost:5005/swagger-ui.html
Accept-Encoding: gzip, deflate, br
Accept-Language: en-GB,en-US;q=0.9,en;q=0.8

You should try changing Content-Type as above as well as add boundary.
Do check out another solution at https://stackoverflow.com/a/39545774/1776132

A: Its working when i use @RequestParam instead of @RequestPart
@RequestMapping(value = "/saveFile")
public @ResponseBody String storeAd(@RequestParam ("model") String adString, @RequestParam ("file") MultipartFile file) throws IOException {
    System.out.println("adString > "+adString);
    return "OK";
}

A: In my case,I needed spring web(not webflux) for this to work
<dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-web</artifactId>
</dependency>

redpajama_set_name: RedPajamaStackExchange


text:
Q: rake assets:precomplie is slow (over half an hour) I am running Rails 3.2.3 and when I run

rake asset:precompile

It takes round 40 minutes to complete.
The follow is in my assets group
gem 'sass-rails',   '~> 3.2.3'
  gem 'bootstrap-sass', '~> 2.0.1'
  gem 'coffee-rails', '~> 3.2.1'

  # See https://github.com/sstephenson/execjs#readme for more supported runtimes
  gem 'therubyracer'

  gem 'uglifier', '>= 1.0.3'

This is running on my local development box. It takes 2,338 seconds which is about 40 minutes. If don't compile locally Heroku times out at round 500 seconds. I have heard people  have issues with 1 to 3 minute compiles. But this is way more. What could be the problem?
UPDATE: Applcation.js (gist)
            Application.css (gist)

A: The solution was have all of the files the need Bootstrap, from Twitter, to be in application.css.scss so that @import 'bootstrap' is only called once


text:
Q: I get 403/404 trying to connect to APIC's on-premises Developer Portal using ip-address I can log into the Portal using its host name, but not url. Why?
Example:

*

*https://developer.think.ibm/ works

*https://192.168.225.20/ returns a 403 and 'nginx'

My 'on-premises' cloud consists of 4 vms that were provided in a workshop in IBM South Bank in June 2016. I am in the process of refreshing my APIC skills and extending them. Rather than use the Ubuntu vm where the Toolkit is installed, I have been using it in Windows 10, and accessing the APIM and CMC from Firefox and Chrome in Windows, using the ip address of the vm.
I have come to the conclusion that there must be a config value in the CMC or Portal, that forces Portal to only accepts urls containing 'developer.think.ibm'. Using the ip-address, also fails from Firefox in Ubuntu. In Windows, I added 'developer.think.ibm' to my hosts file and now I can access the Portal. Using vmware's NAT port forwarding 'localhost:4443', returns a 404.
It seems to me that inital access to the Portal, by its nature, should be easy, as this is the whole point of having an API manager.
Regards, John

A: Your Portal Server hosts multiple Portal sites (each Catalog has its own Portal site). The IP address of the server doesn't identify a site so you need to use the site's url (which is configured as part of the catalog configuration in API Manager).  URLs for different sites may have different virtual hosts, or differ only in their paths.


text:
Q: How to properly use IRegisteredObject to block app domain shutdown / recycle for web app? I have a .NET MVC web app which requires time to be properly shutdown and so whenever the IIS app domain is recycled (i.e. a new instance is spun up and receives all new requests while the old instance shuts down waiting for outstanding requests to complete) I need to block this app shutdown until my app's current async background work (containing no outstanding requests) has completed. IRegisteredObject (see http://blog.stephencleary.com/2014/06/fire-and-forget-on-asp-net.html) offers this blocking ability, though, my processes always seem to die at times inconsistent with my blockage time and IIS settings.
I saw this post (IRegisteredObject not working as expected) which explained the importance of the IIS Shutdown Time Limit but, while IRegisteredObject seems to block for a period of time, I cannot get the recycle to block for the desired time of 2 hours (nor can I generally get results which make sense based off various settings).
Below is a simple implementation of IRegisteredObject with a background thread that I've been using for tests:
public class MyRegisteredObject : IRegisteredObject
{
    public void Register()
    {
        HostingEnvironment.RegisterObject(this);
        Logger.Log("Object has been registered");
    }

    // the IRegisteredObject.Stop(...) function gets called on app domain recycle.
    // first, it calls with immediate:false, indicating to shutdown work, then it
    // calls 30s later with immediate:true, and this call 'should' block recycling
    public void Stop(bool immediate)
    {
        Logger.Log("App domain stop has been called: "
            + (immediate ? "Immediate" : "Not Immediate")
            + " Reason: " + HostingEnvironment.ShutdownReason);
        if (immediate)
        {
            // block for a super long time
            Thread.Sleep(TimeSpan.FromDays(1));
            Logger.Log("App domain immediate stop finished");
        }
    }

    // async background task to track if our process is still alive
    public async Task RunInBackgroundAsync()
    {
        Logger.Log("Background task started");
        var timeIncrement = TimeSpan.FromSeconds(5);
        var time = TimeSpan.Zero;
        while (time < TimeSpan.FromDays(1))
        {
            await Task.Delay(timeIncrement).ConfigureAwait(false);
            time += timeIncrement;
            Logger.Log("Background task running... ("
                + time.ToString(@"hh\:mm\:ss") + ")");
        }
        Logger.Log("Background task finished");
    }
}

public static class Logger
{
    private static readonly string OutputFilename = @"C:\TestLogs\OutputLog-" + Guid.NewGuid() + ".log";

    public static void Log(string line)
    {
        lock (typeof(Logger))
        {
            using (var writer = new StreamWriter(OutputFilename, append: true))
            {
                writer.WriteLine(DateTime.Now + " - " + line);
                writer.Close();
            }
        }
    }
}

In app start, I start the IRegisteredObject component:
var recycleBlocker = new MyRegisteredObject();
recycleBlocker.Register();
var backgroundTask = recycleBlocker.RunInBackgroundAsync();

Finally, when testing, I have sparked app domain recycles through 3 separate means:
(1) Web.config file change (yields a HostingEnvironment.ShutdownReason value of ConfigurationChange)
(2) Manual recycle through clicking the app's Application Pool and then Recycle in IIS Manager (yields a HostingEnvironment.ShutdownReason value of HostingEnvironment)
(3) Allowing the app to automatically recycle based off of the IIS setting under Process Model - "Idle Time-out (minutes)" (also yields a HostingEnvironment.ShutdownReason value of HostingEnvironment)
I would not have expected this, but the manner in which the recycle is triggered seems to play a drastic role... below are my findings through tests where I modified the means of recycle and IIS settings (Shutdown limit and Idle time-out).
Findings:
---- Web.config change recycle (ShutdownReason: ConfigurationChange) ----
After the IRegisteredObject(immediate: true) call occurs, I see in my logs that the background task lasts almost exactly the time set for IIS Idle Time-out, while Shutdown Time Limit plays no role whatsoever. Further, with this recycle, assuming I set the Idle time-out high enough, the recycle blocking is always respected. I blocked for a full day in one test by setting the Idle time-out to 0 (i.e. off).
---- IIS Manager manual recycle (ShutdownReason: HostingEnvironment) ----
After the IRegisteredObject(immediate: true) call occurs, the logs show the exact opposite behavior compared to Web.config change. No matter what the Idle Time-out is, the blockage seems unaffected. Conversely, the Shutdown Time Limit  dictates how long to block the recycle (up to a point). From 1 second up through 5 minutes, the recycle will be blocked based on this Shutdown Limit. However, if the setting is set higher or turned off, blockage seems to remain at the ceiling of around 5 minutes.
---- Idle time-out automatic recycle (ShutdownReason: HostingEnvironment) ----
Finally something predictable... the automatic recycle does actually get triggered based on the Idle Time-out setting, which then causes a situation similar to the Manual Recycle case: Shutdown Time Limit respected up to about 5 minutes but no longer than that. Presumably this is because the automatic and manual recycles each have the same HostingEnvironment.ShutdownReason: HostingEnvironment.
Ok... I apologize for the length of this! As you can see, the combination of recycle methods and IIS settings simply do not seem to yield expected results. Further, my goal of this all is to be able to block for a max of two hours, which does not seem possible from my tests outside of the web.config recycle case, no matter the settings I choose.... Can someone please shed light onto what exactly is going on under the hood here? What role does ShutdownReason play? What role do these IIS settings play?
Fundamentally, what am I missing here, and how can I use IRegisteredObject to block for longer periods of time caused from automatic recycles??

A: There are two different concepts in play here-

*

*Application domain

*Application pool
Application domains provide an isolation boundary for security, reliability, and versioning, and for unloading assemblies. Application pools define a set of Web applications that share one or more worker processes. Each application pool could be hosting one or more application domains.
Application pool can be recycled in the following ways

*

*Triggering IIS Manager manual recycle

*Invoking IIS reset from command prompt

*Setting idle timeout or shutdown time limit on your Application pool

Application domain is recylced when you touch the Web.config, Global.asax or any dll in the bin folder of an application.
IRegisteredObject is able to intercept the process of application domain unloading, however, it does not have any control over the application pool recycle. When application pool recycle is triggered, it kills and restarts the w3wp.exe process and ends up killing all the application domains associated with the application pool.
This should explain why your IRegisteredObject was working as expected when you touched your Web.config but would not perform the expected actions when you recylced the application pool. If your idle-timeout or shut down timeout are less than the time window that your IRegisteredObject keeps the application domain alive, after a Application domain recycle is triggered, the IRegisteredObject will try to keep the application domain alive but when the idle-timeout or the shut-down timeout is reached, the application pool will recycle and application domain will be killed regardless of the IRegisteredObject.
A solution to your problem will be to turn the idle timeout and shut down time limit settings off for the application pool and rely on some alternate method to recycle your application pool. In that case, your application pool will not be recycled automatically and you can rely on your IRegisteredObject to keep the application domain alive.


text:
Q: What is the download location for Ubuntu 9.10 64bit for Intel i7 processors When I go to the ubuntu website - it says the ISO is for AMD 64. I have intel 64-bit. I tried this page : http://www.ubuntu.com/GetUbuntu/download  - and selected 64-bit - the downloaded ISO had "amd64" in its name.
Additionally I have vmWare workstation 7.0 (latest version) running on Windows 7 64-bit (I7 Dell XPS Studio).
Is 64-bit Ubuntu virtual machine under VMWARE supposed to work well with this setup?

A: Just to elaborate on Ivo's answer:
AMD64 or X86_64 are identical and all 64bit x86 architecture cpus will work with these, which is to say: all the AMD or INTEL cpus EXCEPT the Itanium line from Intel. Those fall into the IA64 architecture.... but they're almost unrepresented in most business hardare and completely absent in consumer grade equipment.
So all the Xeons, Core Duos, Core2s, I5s and i7s are AMD/x86_64.
Why you ask? AMD "created" and added the 64bit extensions to the 32bit X86 architecture. Intel didn't. Intel added them after AMDs cpus proved very popular. Most people now agnostically refer to this as x86_64, but some still call it amd64.

A: I think just selecting the 64 bit version is enough
There shouldn't be a difference between AMD or Intel processors
As for VMware support: New Support for 32-Bit and 64-Bit Operating Systems
This release provides support for the following host and guest operating systems:

*

*Windows 2008 R2

*Windows Vista SP2

*Ubuntu 9.10


text:
Q: Opening a specific folder (windows explorer) from HTML URL I am in the process of building the internal site (ASP) for a website that handles applications for mortgate loans.
For each application, there's a folder on the server that contains unique attatchments linked to the application. A wide spread of formats for the attatchments leads to my boss asking me to simply make a link that opens said attatchment-folder per application.
Using file://servername/foldername/ works, but it takes AGES after clicking it before the actual folder opens. Any more efficient way of doing this?

A: If these folders on your server are within the root of your web-application you could enable directory-browsing on those folders. This will make IIS show you all files within if you navigate to that folder.
http://technet.microsoft.com/nl-nl/library/cc731109(v=ws.10).aspx
If they are outside your web-root, you can still do this- you can add those folders as virtual folders to IIS. But in that case you will have to give the Anonymous Internet user read rights to those folders.
http://technet.microsoft.com/nl-nl/library/cc771004(v=ws.10).aspx
If you need to both read and write to these folders, you could look into the WebDAV protocol, which can be installed on IIS. This allows you to use certain folders as a special kind of networked drive. It allows reading and writing over the http(s) protocol.
http://www.iis.net/learn/install/installing-publishing-technologies/installing-and-configuring-webdav-on-iis
HTH,
Erik

A: @Rico has hit a number of bases.  Directory browsing is an excellent solution if you only need to read the files.
If you also want to allow file editing, WebDav is also a possible solution, but I may be able to recommend something easier:
Please see my response "Launching a Downloadable Link" to a similar question.  Though the user was asking about a file and not a complete directory, this solution will work with either.
The premise is a downloadable *.url file.  This will prevent issues if the user is utilizing a browser that prohibits file system linking, or if the user is operating over a VPN outside of the more permissive "Local Intranet" zone.
All of this is discusses in the linked article.
Good luck!


text:
Q: Action method gets called, but it returns wrong View I have a controller named BearController. In it I have one index action method and another action method.
public ActionResult EditBear(int bearId)
{
    ...
    return View();
}

Here is how I call it from the view of the index method:
$.ajax({ url: "Bear/EditBear", data: { bearId: 2} })

The method gets called, the breakpoint goes through the end of EditBear, and after that in my browser I get the view from the index method. The url in the browser is the url of the index method (which means only localhost and controllerName).
I also tried with:
$.get('@Url.Action("EditBear", "Bear")', { bearId: 2});

and the method doesn't even gets called. What is the problem?

A: I guess you want to get the Bear Object which has an id of 2 ( or whatever you are passing. But it looks like in your action method you are returning the View only without any object passed as the parameter to it. so i guess it will return the blank View to the client.
You may probably want to send the populated object back.
public ActionResult EditBear(int bearId)
{
    BearViewModel objVM=new BearViewModel(bearId); // Load the ViewModel
    return View(objVM);
}

and in your View
@model BearViewModel
Edit Bear
@using (Html.BeginForm())
{
    @Html.TextBoxFor(m => m.BearName)
    @Html.HiddenFor(m=>m.BearId)

        <input type="submit" value="Save" />

}

Since it is an ajax call, You should probably think about returning a partial view.
public ActionResult EditBear(int bearId)
{
    BearViewModel objVM=new BearViewModel(bearId); // Load the ViewModel
    if (Request.IsAjaxRequest())
     {
       return View("Partial/EditBear", objVM);
     }
    return View(objVM);
}

Assuming you have your partial view in a subfolder called "Partials" in your Bear View folder

A: Well, first I wouldn't call the method "EditBear". Since it's in the BearController, I would just call it Edit. That makes the URL /Bear/Edit/1 rather than /Bear/EditBear/1.
Second, you are calling the Edit method through AJAX, so the view is returned as the response to the AJAX call. You can verify this using Fiddler or Firebug.
I think you want just a plain call using @Url.Action, without using any Javascript. Just embed the link in your HTML (table?) using Razor.

@Url.Action("Edit", "Bear", new { id = 2 });

A: As it seems, if you call an action method with Ajax, the  view is somehow not shown. I had to use window.location.href to get the correct view.


text:
Q: Chunk an array of objects and add empty arrays at the end I need to chunk an array of objects so i write:
function conditionalChunk(array, size, rules = {}) {
    let copy = [...array],
        output = [],
        i = 0;

    while (copy.length)
        output.push(copy.splice(0, rules[i++] ?? size))

    return output
}

and it works fine if I have rules like { 0: 2, 1: 2 }
 const input = [[1,2,3],[4,5,6,7]],
                output = conditionalChunk(input.flat(), 3, { 0: 2, 1: 2 });

    // OUTPUT: [[1,2],[3,4],[5,6,7]]

but when I have rules at the end like { 0: 2, 1: 2, 2:0, 5:0 } my function ignore to create empty arrays at the end.
the output I need is:
const input = [[1,2,3],[4,5,6,7]],
                    output = conditionalChunk(input.flat(), 3, { 0: 2, 1: 2, 2:0, 5:0 });

        // OUTPUT: [[1,2],[3,4],[],[5,6,7],[]]

so I just need to not ignore rules for empty arrays at the end of array. How I can do that?

A: Finally, you could check the keys of rules and if greater or equal to the next index of output push an empty array.

function conditionalChunk(array, size, rules = {}) {
    let output = [],
        i = 0;

    while (i < array.length)
        output.push(array.slice(i, i += rules[output.length] ?? size));

    let l = Object.keys(rules).reduce((l, v) => l + (v >= output.length), 0);

    while (l--) output.push([]);

    return output;
}

console.log(conditionalChunk([1, 2, 3, 4, 5, 6, 7], 3, { 0: 2, 1: 2 })); // [[1,2],[3,4],[5,6,7]]
console.log(conditionalChunk([1, 2, 3, 4, 5, 6, 7], 3, { 0: 2, 1: 2, 2: 0, 5: 0 })); // [[1,2],[3,4],[],[5,6,7],[]]
console.log(conditionalChunk([1, 2, 3, 4, 5, 6, 7], 3, { 0: 0, 1: 2, 8: 0, 7: 0, 9:0, 20:0 }));
.as-console-wrapper { max-height: 100% !important; top: 0; }

A: maybe you can try this, I prefer for...each loop in place of a while.
function conditionalChunk(array, size = 1, rules = {}) {
    let copy = [...array],
        output = [],
        i = 0;

        for (const rule of Object.keys(rules)) {
            let val = copy.splice(0, rules[rule] || size);
      if (typeof val === 'undefined') val = [];

      output.push(val);
    }

    return output;
}

var results = conditionalChunk([1, 2, 3, 4, 5], 2, { 0:2, 1: 2, 2:2, 3:0 });

console.log(results, '::results::');

https://jsfiddle.net/5ozbj7na/

A: A solution to your problem would be to add this bit of code after the while loop before the return statement
output.length = Math.max.apply(null, [output.length, ...Object.keys(rules)]) || output.length;

for (r in rules)
{
    output[r] = new Array(rules[r]);
}

It just extends the output array to the desired length then populates required spots with empty arrays (sorry for the complicated first line but JavaScript is complicated so :| ...)

A: Please try this one, this should work for you and is done based on your solution, so it should be easier to understand
  function conditionalChunk(array, size, rules = {}) {
  let copy = [...array],
    output = [],
    i = 0;

  while (copy.length) output.push(copy.splice(0, rules[i++] ?? size));

  const arr = Object.keys(rules).filter((key) => key > i);

  arr.forEach((key) => {
    if (rules[key] === 0) output.push([]);
  });

  return output;
}


text:
Q: Suggestions for running panel data with small sample size Okay,say I have a dataset which contains data on unemployment rates, wages, oil prices faced by a country, incidence of civil conflict for about 30 countries opver a period of 10 years. So this is like a panel data with small number of countries over a small number of time periods. I am say interested in running a regression of voter turnout in national elections in each year on all the variables I outlined above. A very simple regression i can run is
$Y_{it} = \alpha_{i} + \delta_{t} + \beta X_{it} + \varepsilon_{it}$
Where $\alpha_{i}$ is country fixed effect. $\delta_{t}$ is year fixed effect, and $X_{it}$ are the relevant independent variables. Now I am wondering whether this regression is valid for such a samll sample of countries especially using these fixed effects since I may lose a lot of precision there. Are there any suggestions on how I could explore the panel nature of this data without losing too much precision.

A: As described, this panel data model regression is valid theoretically. The single biggest advantage of panel data is that it "pools" information, thereby shrinking the error. Of course, with more information the errors would be even smaller. With 30 cross sections and ten years of annual information, it sounds like a balanced matrix. I wouldn't even call that "small." It's just not enough information to initialize the more traditional, univariate approaches to time series modelling such as Box-Jenkins, ARIMA, ARCH, etc.
Are there any other complications? Missing values requiring imputation? Mixed frequencies where the predictors and dependent variable are in differing units of time, e.g., annual vs quarterly? If the latter, then Ghysel's MIDAS (MIxed DAta Sampling) approach might be helpful. Ghysels has many papers about this.
You probably want to explore lead-lag relationships which are agnostic wrt causal flow, i.e., relaxing the typical, directional causal assumptions. Some useful work has been done on this by Sornette in his papers on TOPS (thermal optimal paths). His papers are technically sophisticated but the core ideas are not. You can readily develop "brute force" workarounds for them.
Another consideration would be to explore Pesaran's CD test for weak cross-sectional dependence. His test realistically assumes at least some level of dependence between cross-sections and is, therefore, less stringent than others.
Multivariate tests for unit roots, autocorrelation, and so on, are in an early stage of development wrt panel models. The only references I'm aware of that explicitly address them are from SAS as related to its PROC PANEL module. Here are some links:
http://go.documentation.sas.com/?docsetId=etsug&docsetVersion=14.2&docsetTarget=etsug_panel_details50.htm&locale=en
http://go.documentation.sas.com/?docsetId=etsug&docsetVersion=14.2&docsetTarget=etsug_panel_details68.htm&locale=en
These are probably implementable in other software but it would be incumbent on you to do that.
Beyond that, I don't have too many more suggestions. The balanced nature of your data actually simplifies the challenges a great deal. Consider yourself lucky as it could be a lot worse.

A: To me, whether or not the regression is "valid" depends on whether the estimator is consistent, not on whether it is efficient.  As long as you don't have any omitted variables, and all the other usual assumptions we usually take for granted, a fixed effects estimator should be consistent.  (I'm interpreting $\alpha_i$ as the panel effect here, and $\delta_t$ as a set of indicators.)
If you need more precision, you can then try a random effects model, with $\alpha_i$ drawn from a normal distribution as usual, and uncorrelated with the error term.  So long as the assumptions of the random effects model are met, the estimator is consistent and efficient.  If the assumptions aren't met, the estimator is inconsistent and therefore the regression is "invalid".  You can and should check the validity using a Hausman test that compares the estimates from the fixed-effects model to the estimates from the random-effects model.
I should note a third option, which is a sort of "randomer" effects model.  You can treat both $\alpha_i$ and $\delta_t$ as distinct, "crossed" random effects, with all the benefits (increased efficiency) and hazards (inconsistency) that go along with that.


text:
Q: Get SP online site content via PowerShell or C# (for BackUp SharePoint Online Site content into local storage) I need to BackUp SharePoint Online Site content into local storage. I know there is no tools for it (for SharePoint Online version). I want to write my own tool that will copy all site content to a local drive (library to some archive, lists to excel file). I have about 15 SP sites which I need to backup. I know that MS stores data every 14 days on it's services, but this is not enough.
I plan to write a powershell script or programm in C#. But I can't get to site content programmatically.
How can I get content from site library or a list by PowerShell or C# in SharePoint Online?

A: For now this is what I get from another forum:
 For working with SPO we need SharePoint Server 2013 Client Components SDK. After that we can start to work with SPO, exsample to get context, and get all properties of site:
siteUrl = "https://yourtenantname-admin.sharepoint.com";
userName = "you@company.com";
password = "password";

using (ClientContext clientContext = new ClientContext(siteUrl))
{
    SecureString passWord = new SecureString();
    foreach (char c in password.ToCharArray()) passWord.AppendChar(c);
    clientContext.Credentials = new SharePointOnlineCredentials(userName, passWord);

    var tenant = new Tenant(clientContext);
    SPOSitePropertiesEnumerable spp = tenant.GetSiteProperties(0, true);

    clientContext.Load(spp);
    clientContext.ExecuteQuery();

    foreach (SiteProperties sp in spp)
    {
        Console.WriteLine(sp.Title);
    }
}

More samples work with SPO context.


text:
Q: parse error in zend module.config.php line 78 I am getting this error, can somebody help..
Parse error: syntax error, unexpected 'class' (T_CLASS), expecting identifier (T_STRING) or variable (T_VARIABLE) or '{' or '$' in /opt/lampp/htdocs/zendd/module/Application/config/module.config.php on line 76
here is my code
'Application\Controller\Index' => Controller\IndexController::class

Error is pointing at this line in module.config.php
<?php
/**
 * Zend Framework (http://framework.zend.com/)
 *
 * @link      http://github.com/zendframework/ZendSkeletonApplication     for the canonical source repository
* @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc.     (http://www.zend.com)
* @license   http://framework.zend.com/license/new-bsd New BSD License
*/
namespace Application;
return array(
'router' => array(
'routes' => array(
'home' => array(
'type' => 'Zend\Mvc\Router\Http\Literal',
'options' => array(
'route'    => '/',
'defaults' => array(
                    'controller' => 'Application\Controller\Index',
                    'action'     => 'index',
                ),
            ),
        ),
        // The following is a route to simplify getting started creating
        // new controllers and actions without needing to create a new
        // module. Simply drop new controllers in, and you can access them
        // using the path /application/:controller/:action
        'application' => array(
            'type'    => 'Literal',
            'options' => array(
                'route'    => '/application',
                'defaults' => array(
                    '__NAMESPACE__' => 'Application\Controller',
                    'controller'    => 'Index',
                    'action'        => 'index',
                ),
            ),
            'may_terminate' => true,
            'child_routes' => array(
                'default' => array(
                    'type'    => 'Segment',
                    'options' => array(
                        'route'    => '/[:controller[/:action]]',
                        'constraints' => array(
                            'controller' => '[a-zA-Z][a-zA-Z0-9_-]*',
                            'action'     => '[a-zA-Z][a-zA-Z0-9_-]*',
                        ),
                        'defaults' => array(
                        ),
                    ),
                ),
            ),
        ),
    ),
),
'service_manager' => array(
    'abstract_factories' => array(
        'Zend\Cache\Service\StorageCacheAbstractServiceFactory',
        'Zend\Log\LoggerAbstractServiceFactory',
    ),
    'factories' => array(
        'translator' => 'Zend\Mvc\Service\TranslatorServiceFactory',
    ),
),
'translator' => array(
    'locale' => 'en_US',
    'translation_file_patterns' => array(
        array(
            'type'     => 'gettext',
            'base_dir' => __DIR__ . '/../language',
            'pattern'  => '%s.mo',
        ),
    ),
),
'controllers' => array(
    'invokables' => array(
        'Application\Controller\Index' => Controller\IndexController::class
    ),
),
'view_manager' => array(
    'display_not_found_reason' => true,
    'display_exceptions'       => true,
    'doctype'                  => 'HTML5',
    'not_found_template'       => 'error/404',
    'exception_template'       => 'error/index',
    'template_map' => array(
        'layout/layout'           => __DIR__ . '/../view/layout/layout.phtml',
        'application/index/index' => __DIR__ . '/../view/application/index/index.phtml',
        'error/404'               => __DIR__ . '/../view/error/404.phtml',
        'error/index'             => __DIR__ . '/../view/error/index.phtml',
    ),
    'template_path_stack' => array(
        __DIR__ . '/../view',
    ),
),
// Placeholder for console routes
'console' => array(
    'router' => array(
        'routes' => array(
        ),
    ),
),

);

A: You need to use PHP 5.5 or greater.  See:
http://php.net/manual/en/language.oop5.basic.php#language.oop5.basic.class.class
You'll note the gist you copied from says "Application config with PHP 5.5 ::class style"


text:
Q: Where do I find the "toggle CallerID" function in the iOS headers? I'm currently developing a mobile substrate tweak for jailbroken iOS Devices but I'm stuck at finding a specific function in the iOS headers!
I'm searching for the function that toggles the "send caller ID" option...
Does anyone know where to find it or does anyone know a method to find keywords in that pile of headers?
-cheers

A: https://github.com/nst/iOS-Runtime-Headers/blob/master/PrivateFrameworks/TelephonyUtilities.framework/TUCallCenter.h
- (void)handleCallerIDChanged:(id)arg1;


text:
Q: paper.js using JS directly - how to use .getDistance function? I am implementing a paper.js script which was written inline using the paperscript type script element. It's been loaded by require.js now and it works fine, and I install it to the window object, making it globally accessible. Everything seems to work, only the functions like .getDistance() cannot be used anymore. How can I use them anyway?

A: It's impossible to say what goes wrong without seeing some actual code. Could you create a simplified test-case that illustrates your issue?


text:
Q: How to keep track changes in Box api without long polling I've a system that keep tracks all files in box account. I want to know how we can keep track of changes or incremental updates in box account without using long polling. I've worked with dropbox and there's a nice feature to delta poll using a cursor with which we can get the incremental updates only. Is there any similar feature in Box to do this ?

A: Yes. Box API's Events endpoint lets you request these incremental changes. The documentation refers to the cursor as the stream position.


text:
Q: Quartz Compositor and other window managers of macOS I've never in my life touched macOS, but I'm writing a work about operating systems, so I need to say something about macOS too.
Wikipedia says that Quartz Compositor is the window manager of macOS. But there are other window managers for macOS, like Magnet and Spectacle.
I watched both Spectacle and Magnet in action on YouTube and they don't seem to me essentialy different than Quartz Compositor.
So I would like to know is the Quartz Compositor integrated in macOS like DWM is integrated in Windows and Magnet and Spectacle are slight extensions/modifications, or is it truly another window manager, like on Linux are xfwm4, i3, dwm, evilwm, openbox, etc.

A:
But there are other window managers for macOS, like Magnet and Spectacle.

Magnet and Spectacle aren't "window managers" in the sense you're thinking of. They're desktop applications which have features to automatically move and resize windows. They do not replace any component of the operating system.

So I would like to know is the Quartz Compositor integrated in macOS like DWM is integrated in Windows

Correct. Quartz Compositor is not a user-replaceable component.


text:
Q: Bessel ellipsoid definition for LV95 (EPSG:2056) I recently wrote some code to transform coordinates between WGS 84 and the new Swiss projected coordinate system (LV95 / EPSG:2056). While doing that, I tried to find an authoritative source for the definition of the Bessel ellipsoid, which is used for LV95.
I checked the EPSG registry, the website of swisstopo (national mapping agency of Switzerland), as well as some other sources (see references below).
It seems that everybody agrees on the first value:

Semi-major axis: a = 6377397.155 m

My understanding is that usually the semi-minor axis b or the inverse flattening 1 / f is usually specified in addition to a, or sometimes both, where one is derived from the other.
[EPSG-Nov2015] defines:

Inverse flattening: 1 / f = 299.1528128

But [swisstopo-Dec2016] defines:

Inverse flattening: 1 / f = 299.15281285
Semi-minor axis: b = 6356078.962822 m

Unfortunately [swisstopo-Dec2016] does not indicate which of the values is derived, but gives [Bolliger-1967] as a reference, which defines:

Semi-minor axis: b = 6356078.96282 m

([Bolliger-1967] does not specify which values are derived either)
Are these differences relevant? If so, is it a "bug" in one of the references? Or am I overthinking this and should I just pick one of the values at random?
References

*

*[EPSG-Nov2015] CH1903+ / LV95 (EPSG::2056)

*[swisstopo-Dec2016] Formulas and constants for the calculation of the Swiss conformal cylindrical projection and for the transformation between coordinate systems, swisstopo, December 2016 (see page 5)

*

*[Bolliger-1967] Die Projektionen der Schweizerischen Plan- und Kartenwerke, J. Bolliger, 1967 (see page 30)

A: I found the authoritative source with the help of @swiss_geoportal and @swisstopo on Twitter.
It's an ordinance called Verordnung des Bundesamtes für Landestopografie über Geoinformation (GeoIV-swisstopo) (not available in English).
The following value for the flattening of the Bessel ellipsoid is provided for both reference systems used in Switzerland (CH1903 and CH1903+):

f = 1/299.15281285


text:
Q: Two colorbars in a single R plotly scatter plot I think I'm basically looking for an R plotly equivalent to this python plotly post:
I have a XY data.frame that I'd like to plot using R's plotly, where each point belongs to either one of two types ("a"/"b"), and nested within each type is a group, and the group assignment is redundant.
My purpose is to color code the points according to the group frequency, where each type uses a different color scale.
Here's the data.frame:
library(dplyr)
set.seed(1)
df <- rbind(data.frame(type = "a", group = paste0("a", sample(1000, 500, replace = T))) %>%
              cbind(as.data.frame(MASS::mvrnorm(n = 1000,mu = c(-5,-5),Sigma = matrix(c(5, 3, 4, 4), ncol=2)))),
            data.frame(type = "b", group = paste0("b", sample(500, 50, replace = T))) %>%
              cbind(as.data.frame(MASS::mvrnorm(n = 500,mu = c(5,5),Sigma = matrix(c(5, 3, 4, 4), ncol=2))))) %>%
  dplyr::rename(x = V1, y = V2)

Here I compute the frequency of each group, for each type, and then add two artificial points per each type, with the global minimum and maximum frequency (f), so that the color scales use a comment numeric scale:
freq.df <- rbind(dplyr::group_by(dplyr::filter(df, type == "a"), type, group) %>%
                   dplyr::tally() %>%
                   dplyr::mutate(f = 100*n/sum(n)) %>%
                   dplyr::select(-n),
                 dplyr::group_by(dplyr::filter(df, type == "b"), type, group) %>%
                   dplyr::tally() %>%
                   dplyr::mutate(f = 100*n/sum(n)) %>%
                   dplyr::select(-n)) %>%
  dplyr::ungroup() %>%
  rbind(data.frame(type = c(rep("a", 2), rep("b", 2)), group = c(rep("a", 2), rep("b", 2)), f = rep(c(min(.$f), max(.$f)), 2), stringsAsFactors = F))

And now joining freq.df to df:
df <- df %>% dplyr::left_join(freq.df)

Here's how I'm trying to plot it:
plotly::plot_ly(marker = list(size = 3), type = 'scatter', mode = "markers", color = dplyr::filter(df, type == "a")$f, colors = viridis::viridis_pal(option = "D")(3), x = dplyr::filter(df, type == "a")$x, y = dplyr::filter(df, type == "a")$y) %>%
  plotly::add_trace(marker = list(size = 3),type = 'scatter', mode = "markers",color = dplyr::filter(df, type == "b")$f,colors = viridis::viridis_pal(option = "A")(3), x = dplyr::filter(df, type == "b")$x,y=dplyr::filter(df,type == "b")$y) %>%
  plotly::layout(xaxis = list(zeroline = F, showticklabels = F, showgrid = F),yaxis = list(zeroline = F,showticklabels = F, showgrid = F))

Which only gives me the colorbar of first color scale (viridis's cividis):

Any idea how to get both colorbars (viridis's cividis and viridis's magma) appear side by side?


text:
Q: What is the correct way to sort List  using C#? I have LIST1 <> and LIST2 <> and like to compare these two lists. Followings are my conditions..
    1-If LIST1 and LIST2 have the same items than add same items to LIST3
    2-If LIST1 doesnt contain LIST2 items than add different items to LIST4
    3-if LIST2 doesnt contain LIST1 items than add different items to LIST5

lets say my result is like below depends on the conditions;
LIST1<string> = A,B,C,D
LIST2<string> = A,K,F,C
LIST3<string> = A,C
LIST4<string> = B,D
LIST5<string> = K,F

here is my code;
     foreach (string src in LIST1)
       {
           foreach (string trg in LIST2)
            {
                if (LIST1.ToString() == LIST2.ToString())
                {
                    LIST3.Add(LIST1.ToString());
                }

               else
                {
                    LIST4.Clear();
                    foreach (string l3 in LIST1)
                    {
                        if (!LIST2.Contains(l3))
                            LIST4.Add(l3);
                    }

                   LIST5.Clear();
                    foreach (string l4 in LIST2)
                    {
                        if (!LIST1.Contains(l4))
                        {
                            LIST5.Add(l4);
                        }
                    }

                }

            }
        }

A: A quick way to do this would be:
var list3 = list1.Intersect(list2).ToList();
var list4 = list1.Except(list2).ToList();
var list5 = list2.Except(list1).ToList();

Update: If you have to do with larger lists (and/or have to write this in multiple places), you can write an extension method like below:
public static Tuple<IEnumerable<T>, IEnumerable<T>, IEnumerable<T>> Diff<T>(
    this IEnumerable<T> first, IEnumerable<T> second)
{
    var intersection = new List<T>();
    var onlyInFirst = new HashSet<T>();
    var onlyInSecond = new HashSet<T>(second);

    foreach (var item in first)
    {
        if (onlyInSecond.Remove(item)) intersection.Add(item);
        else onlyInFirst.Add(item);
    }

    return Tuple.Create<IEnumerable<T>, IEnumerable<T>, IEnumerable<T>>
        (intersection, onlyInFirst, onlyInSecond);
}

This method returns a tuple of three IEnumerable<T>s representing the set of intersection, set of items only in the first collection, and set of items only in the second collection; respectively.
Usage:
var list1 = new[] { "A", "B", "C", "D" };
var list2 = new[] { "A", "K", "F", "C" };

var diff = list1.Diff(list2);
// diff.Item1 = A,C (intersection)
// diff.Item2 = B,D (only in first)
// diff.Item3 = K,F (only in second)

A: Not sure what this has to do with sorting, but here's Linq statements for each condition:
List3 = List1.Intersect(List2).ToList();
List4 = List1.Where(l1 => !List2.Any(l2 => l2 == l1)).ToList();
List5 = List2.Where(l2 => !List1.Any(l1 => l2 == l1)).ToList();

as pointed out in comments Except will work too:
List4 = List1.Except(List2).ToList();
List5 = List2.Except(List1).ToList();


text:
Q: Injecting RoleManager results in error First things first, my issue is similar to this SO link, but not the same
I am going through the Identity sample from microsoft. I started it with only user authentication and it worked. I removed the DB because I want to use Database first. Now I am trying to incorporate Roles.
My setup is like this for user (works without role) and role (didn't work):
My DB entities are setup as such:
public class ApplicationDbContext : IdentityDbContext<ApplicationUser, IdentityRole<int>, int>
{
    public ApplicationDbContext(DbContextOptions<ApplicationDbContext> options)
        : base(options)
    {
    }

    protected override void OnModelCreating(ModelBuilder builder)
    {
        base.OnModelCreating(builder);

        builder.Entity<ApplicationUser>(e =>
        {
            e.ToTable("User").HasKey(x => x.Id);
            e.Property(x => x.Id).HasColumnName("UserId");
        });

        builder.Entity<IdentityRole<int>>(e =>
        {
            e.ToTable("Role").HasKey(x => x.Id);
            e.Property(x => x.Id).HasColumnName("RoleId");
        });

and my context, user setup (I want to keep using the original IdentityRole)
public class ApplicationDbContext : IdentityDbContext<ApplicationUser, IdentityRole<int>, int>
{
}
public class ApplicationUser : IdentityUser<int>
{
}

in ConfigureServices:
services.AddIdentity<ApplicationUser, IdentityRole<int>>()
    .AddEntityFrameworkStores<ApplicationDbContext, int>()
    .AddDefaultTokenProviders();

in AccountController, I tried this:
[Authorize]
public class AccountController : Controller
{
    private readonly UserManager<ApplicationUser> _userManager;
    private readonly RoleManager<IdentityRole> _roleManager;
    private readonly SignInManager<ApplicationUser> _signInManager;
    private readonly IEmailSender _emailSender;
    private readonly ISmsSender _smsSender;
    private readonly ILogger _logger;

    public AccountController(
        UserManager<ApplicationUser> userManager,
        RoleManager<IdentityRole> roleManager,
        SignInManager<ApplicationUser> signInManager,
        IEmailSender emailSender,
        ISmsSender smsSender,
        ILoggerFactory loggerFactory)
    {
        _userManager = userManager;
        _roleManager = roleManager;
        _signInManager = signInManager;
        _emailSender = emailSender;
        _smsSender = smsSender;
        _logger = loggerFactory.CreateLogger<AccountController>();
    }

The app still load on the browser and it remembers that I've logged in before but when I try to logout for example, I get this error:

InvalidOperationException: Unable to resolve service for type
'Microsoft.AspNetCore.Identity.RoleManager`1[MyProj.Web.Models.MyViewModels.ApplicationRole]'
while attempting to activate
'MyProj.Web.Controllers.AccountController'.

A: Replace RoleManager<IdentityRole> by RoleManager<IdentityRole<int>> and it should work.


text:
Q: Mod l local Galois representations (l different from p) My question is referred to the statement and proof of Prop. 2.4 of Diamond's
article "An extension of Wiles' Results", in Modular Forms and Fermat Last
Theorem, page 479.
More precisely: fix $l$ and $p$ two distinct primes, with $l$ odd. Let $\sigma$ be an
irreducible, continuous, degree 2 representation of the absolute Galois group
$G_{p}$ of $Q_{p}$, with coefficients in $k$, an algebraic closure of the finite
field with $l$ elements.
Proposition 2.4 states that if the restriction of $\sigma$ to the inertia
subgroup of $G_{p}$ is irreducible and $p$ is odd, then $\sigma$ is isomorphic to the
representation induced from a character of the Galois group of a quadratic
ramified extension $M$ of $Q_{p}$.
The proof given works if the restriction of $\sigma$ to the wild inertia of $G_{p}$ is
reducible (I think there's a typo in the first line of the proof). What if
$\sigma$ is irreducible on wild inertia (and $p$ is always odd)? It seems to me that this case is not covered in the proof of the Proposition, but maybe I'm not seeing something obvious.. If such a representation exists, it cannot be induced from a quadratic extension $M$ as above, so how does it fit in the description given by the Proposition? Can one say something about such a representation (for example something about its projective image?).
Thanks

A: The image of wild inertia is a finite $p$-group, and if $d$ is the degree of an irreducible representation of a $p$-group over an algebraically closed field of characteristic $\ne p$, then $d$ is a power of $p$. So for $p$ odd the image of wild inertia is always reducible.


text:
Q: Intersection of ray and ellipsoid Yes, I know that it is a popular problem. But I found nowhere the full clear implementing code without using OpenGL classes or a lot of headers files.
Okay, the math solution is to transfer ellipsoid to sphere. Then find intersections dots (if they exist of course) and make inverse transformation. Because affine transformation respect intersection.
But I have difficulties when trying to implement this.
I tried something for sphere but it is completely incorrect.
double CountDelta(Point X, Point Y, Sphere S)
{
    double a = 0.0;
    for(int i = 0; i < 3; i++){
        a += (Y._coordinates[i] - X._coordinates[i]) * (Y._coordinates[i] - X._coordinates[i]);
    }

    double b = 0.0;
    for(int i = 0; i < 3; i++)
        b += (Y._coordinates[i] - X._coordinates[i]) * (X._coordinates[i] - S._coordinates[i]);
    b *= 2;

    double c = - S.r * S.r;
    for(int i = 0; i < 3; i++)
        c += (X._coordinates[i] - S._coordinates[i]) * (X._coordinates[i] - S._coordinates[i]);

    return b * b - 4 * a * c;
}

Let I have start point P = (Px, Py, Pz), direction V = (Vx, Vy, Vz), ellipsoid = (Ex, Ey, Ec) and (a, b, c). How to construct clear code?

A: Let a line from P to P + D intersecting a sphere of center C and radius R.
WLOG, C can be the origin and R unit (otherwise translate by -C and scale by 1/R). Now using the parametric equation of the line and the implicit equation of the sphere,
(Px + t Dx)² + (Py + t Dy)² + (Pz + t Dz)² = 1

or
(Dx² + Dy² + Dz²) t² + 2 (Dx Px + Dy Py + Dz Pz) t + Px² + Py² + Pz² - 1 = 0

(Vectorially, D² t² + 2 D P t + P² - 1 = 0 and t = (- D P ±√((D P)² - D²(P² - 1))) / D².)
Solve this quadratic equation for t and get the two intersections as P + t D. (Don't forget to invert the initial transformations.)

For the ellipsoid, you can either plug the parametric equation of the line directly into the implicit equation of the conic, or reduce the conic (and the points simultaneously) and plug in the reduced equation.


text:
Q: MySQL select rows that end in full stop/period I want to select all rows in a table that end in a full stop.
When I use the following query, I get no results.
SELECT * FROM table WHERE row LIKE '%.'

But I know there is data in the table that ends in a full stop.
I noticed something about the full stop causing issues in MATCH AGAINST, but that should be unrelated.

A: You probably have no values that end in a period.
That seems simple enough.
First, see if there are any periods at all in the data:
SELECT * FROM table WHERE row LIKE '%.%'

If so, then period spaces are the issue:
SELECT * FROM table WHERE trim(row) LIKE '%.'

A: You can probably use RIGHT() string function like below. See a Demo Here
SELECT *
FROM `table`
WHERE RIGHT(`row`,1) = '.';


text:
Q: How to display objects like arrows directly on the screen Is it possible in Python to draw objects (arrows, rectangles etc. of a specific color) directly on the screen (there should be possibility to click underneath this objects)?
EDIT: I meant printing objects DIRECTLY on the screen, not in separate windows, like below (blue arrow on desktop)

A: You probably want to use TkInter, which is the standard GUI library within Python.
A Hello, World! example is provided in the documentation.
import tkinter as tk

class Application(tk.Frame):
    def __init__(self, master=None):
        super().__init__(master)
        self.master = master
        self.pack()
        self.create_widgets()

    def create_widgets(self):
        self.hi_there = tk.Button(self)
        self.hi_there["text"] = "Hello World\n(click me)"
        self.hi_there["command"] = self.say_hi
        self.hi_there.pack(side="top")

        self.quit = tk.Button(self, text="QUIT", fg="red",
                              command=self.master.destroy)
        self.quit.pack(side="bottom")

    def say_hi(self):
        print("hi there, everyone!")

root = tk.Tk()
app = Application(master=root)
app.mainloop()

Of course, there are many other GUI libraries for Python (e.g. https://wiki.python.org/moin/GuiProgramming) for more specific or advanced purposes.

A: You can do this with the print statement.
>>>print("-->")
-->
>>>print(" ___\n|__|")
___
|__|


text:
Q: Filed Value Update With Java Reflection I took the reference from Change private static final field using Java reflection and wrote below code to update an String type static final field value:
I have one class which contains an Constant like below:
public final class Constants {

    public static final String ACCEPTED = "A";
}

I tried to update it's value using Java Reflection, like below:
Field field = Constants.class.getDeclaredField("ACCEPTED");
    field.setAccessible(true);

    Field modifiersField = Field.class.getDeclaredField("modifiers");
    modifiersField.setAccessible(true);
    modifiersField.setInt(field, field.getModifiers() & ~Modifier.FINAL);

    String newValue = "B";
    field.set(null, newValue);

After updating value by using above code I tested it like below:
String myUpdatedValue = Constants.ACCEPTED;

Here when I inspected Constants.ACCEPTED the value was being showed was "B", but when I inspected myUpdatedValue, it is showing as "A". Can't understand reason. Even when I pass this value to some other method as parameter, at the method call it's "B" but inside the called method it's "A".

A: To quote the documentation:

Note: If a primitive type or a string is defined as a constant and the value is known at compile time, the compiler replaces the constant name everywhere in the code with its value. This is called a compile-time constant. If the value of the constant in the outside world changes (for example, if it is legislated that pi actually should be 3.975), you will need to recompile any classes that use this constant to get the current value.

In your situation, Constants.ACCEPTED is such a compile time constant. So when your code is compiled, all the references to Constants.ACCEPTED are in fact replaced with the literal "A". Your code manipulates its value in runtime, but this is already too late.


text:
Q: How to fix Task '$' not found in root project 'myProject' I'm running react-native run-android after i upgraded to RN 0.59.10.
I have upgraded gradle version to 5.4.1.
The last RN version that run smooth was 0.55.
tried clone the project again.
I have tried a lot of solutions e.g.
cd android && gradlew clean
cd .. && react-native run-android

finish with an error.
gradlew.bat

is working, output :
Reading env from: .env
WARNING: Configuration 'compile' is obsolete and has been replaced with 'implementation' and 'api'.
It will be removed at the end of 2018. For more information see: [http://d.android.com/r/tools/update-dependency-configurations.html](http://d.android.com/r/tools/update-dependency-configurations.html)
registerResGeneratingTask is deprecated, use registerGeneratedResFolders(FileCollection)
registerResGeneratingTask is deprecated, use registerGeneratedResFolders(FileCollection)

> Task :help

Welcome to Gradle 5.4.1.

To run a build, run gradlew <task> ...

To see a list of available tasks, run gradlew tasks

To see a list of command-line options, run gradlew --help

To see more detail about a task, run gradlew help --task <task>

For troubleshooting, visit [https://help.gradle.org](https://help.gradle.org/)

BUILD SUCCESSFUL in 3s
1 actionable task: 1 executed

all other gradlew commands failed.
React Native Environment Info:
System:
OS: Windows 10
CPU: (4) x64 Intel(R) Core(TM) i7-7500U CPU @ 2.70GHz
Memory: 839.97 MB / 7.89 GB
Binaries:
npm: 6.8.0 - C:\Program Files\nodejs\npm.CMD
IDEs:
Android Studio: Version 3.4.0.0 AI-183.6156.11.34.5692245

RN
react-native-cli: 2.0.1
react-native: 0.59.10

IN ANDROID STUDIO
Android Gradle Plugin Version
3.4.0
Gradle Version
5.4.1
android\build.gradle
buildscript {

ext {

  buildToolsVersion = "28.0.3"
  minSdkVersion = 18
  compileSdkVersion = 28
  targetSdkVersion = 28
  supportLibVersion = "28.0.0"

}

 repositories {
  google()
  jcenter()
 }

 dependencies {
 classpath 'com.android.tools.build:gradle:3.4.0'
 classpath 'com.google.gms:google-services:4.0.2' `

gradle-wrapper.properties
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-5.4.1-     all.zip
android.enableAapt2=false`

AndroidManifest.xml
when building in an android studio he asked to remove these lines, and after I removed, build completed successfully
    <uses-sdk
            android:minSdkVersion="18"
            android:targetSdkVersion="28" />

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    package="com.myProject"
    android:versionCode="1535480392"
    android:versionName="1.0.49">
    <uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
    <uses-permission android:name="android.permission.INTERNET" />
    <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
    <uses-permission android:name="android.permission.READ_PHONE_STATE" tools:node="remove" />
    <uses-permission android:name="android.permission.CAMERA" tools:node="remove" />
--> lines where here
    <application
      android:usesCleartextTraffic="true"
      android:name=".MainApplication"
      android:allowBackup="false"
      android:label="@string/app_name"
      android:icon="@mipmap/ic_launcher"
      android:roundIcon="@mipmap/ic_launcher_round"
      android:theme="@style/AppTheme">

ERROR react-native run-android
Reading env from: .env
WARNING: Configuration 'compile' is obsolete and has been replaced with 'implementation' and 'api'.
It will be removed at the end of 2018. For more information see: http://d.android.com/r/tools/update-dependency-configurations.html
registerResGeneratingTask is deprecated, use registerGeneratedResFolders(FileCollection)
registerResGeneratingTask is deprecated, use registerGeneratedResFolders(FileCollection)
FAILURE: Build failed with an exception.

- What went wrong:
Task '$' not found in root project 'myProject'.
- Try:
Run gradlew tasks to get a list of available tasks. Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
- Get more help at [https://help.gradle.org](https://help.gradle.org/)

BUILD FAILED in 3s
error Could not install the app on the device, read the error above for details.
Make sure you have an Android emulator running or a device connected and have
set up your Android development environment:
[https://facebook.github.io/react-native/docs/getting-started.html](https://facebook.github.io/react-native/docs/getting-started.html)
error Command failed: gradlew.bat app:installDebug. Run CLI with --verbose flag for more details.


text:
Q: Display User teams in template I have 3 models - Project, Team and a CustomUser model. I'm trying to display a list of teams which a user is part of on the user's detail page, and display a list of users who are part of the project team on the project's detail page but I'm at a stand-still.
# project/users/models.py

class CustomUser(AbstractUser):
    name = models.CharField(max_length=255)

    # Relationship Fields
    team = models.ManyToManyField(
        'users.Team',
        related_name="teams",
    )

class Team(models.Model):
    # Relationship Fields
    project = models.OneToOneField(
        'projects.Project',
        on_delete=models.CASCADE, related_name="projects",
    )

# project/projects/models.py

class Project(models.Model):
    name = models.CharField(max_length=255)

project/projects/templates/projects/project_detail.html
{% for user in project.team.user.all %}
    {{ user.name }}
{% endfor %}

I've tried variations of the above such as
{% for user in users.teams.projects.all %}
    {{ user.name }}
{% endfor %}

but I can't seem to make anything show. I think I'm doing something simple wrong - I've read through the docs for displaying ManyToManyFields but I'm at a loss! Can anybody point me in the right direction?

A: im not sure but i think related_name are missed used in this situation:
class Team(models.Model):
# Relationship Fields
project = models.OneToOneField(
    'projects.Project',
    on_delete=models.CASCADE, related_name="projects",
)

this means that in one object of the class Project will have an attribute with the name projects that will be a reference to the teams. I believe you want:
class Team(models.Model):
# Relationship Fields
project = models.OneToOneField(
    'projects.Project',
    on_delete=models.CASCADE, related_name="team",
)

So you will be able to call project.team.
Changing your code:
# project/users/models.py

class CustomUser(AbstractUser):
    name = models.CharField(max_length=255)

    # Relationship Fields
    team = models.ManyToManyField(
        'users.Team',
        related_name="customers",
    )

class Team(models.Model):
    # Relationship Fields
    project = models.OneToOneField(
        'projects.Project',
        on_delete=models.CASCADE, related_name="team",
    )

class Project(models.Model):
    name = models.CharField(max_length=255)

So in the template now you could:
{% for user in project.team.customers.all %}
    {{ user.name }}
{% endfor %}


text:
Q: Issues with Inheritance C++ Qt Project I have a QT Project where I've been given a UML diagram and some instructions (See below)

I've been so lost as to what I'm doing so I'm just going to show all my code, it's finished but not working...  The main error I get now is the Constructors for all the transaction types (deposit, withdrawal and balance enquiry) give a "no matching function for call to 'Transaction::Transaction()'" error.  I may just be doing this all wrong. Appreciate any help I can get...
Here is all my code:
savingsaccount.h
    #ifndef SAVINGSACCOUNT_H
    #define SAVINGSACCOUNT_H
    #include "transaction.h"
    #include "deposit.h"
    #include "balanceenquiry.h"
    #include "withdrawal.h"

    class SavingsAccount
    {
    private:
        QString m_CustomerName;
        QString m_AccountNumber;
        QList<Transaction*> m_TransactionList;
    public:
        SavingsAccount(QString name, QString num);
        ~SavingsAccount();
        void addTransaction(Transaction* t);
        double totalTransactionCost();
        QString frequentTransactionType();
        QList<Transaction*> transactionsOnAdate(QDate date);
        QString toString() const;
    };

    #endif // SAVINGSACCOUNT_H

savingsaccount.cpp
#include "savingsaccount.h"

SavingsAccount::SavingsAccount(QString name, QString num) {
    m_CustomerName = name;
    m_AccountNumber = num;
}
SavingsAccount::~SavingsAccount() {
    while(!m_TransactionList.isEmpty()) {
        delete m_TransactionList.takeFirst();
    } //Deletes all list items
}
SavingsAccount::addTransaction(Transaction* t) {
    m_TransactionList << t; //Adds transaction to list
}
double SavingsAccount::totalTransactionCost() {
    double totalCost;

    for(int i = 0; i < m_TransactionList.size(); i++) {
        totalCost += m_TransactionList.at(i)->computeCost();
    }

    return totalCost; //Returns total transaction cost
}
QString SavingsAccount::frequentTransactionType() {
    QString frequentType;
    int deposit, withdrawal, balanceEnquiry;

    for(int i = 0; i < m_TransactionList.size(); i++) {
        if(m_TransactionList.at(i)->getType() == "Deposit") {
            deposit++;
        }
        else if(m_TransactionList.at(i)->getType() == "Withdrawal") {
            withdrawal++;
        }
        else if(m_TransactionList.at(i)->getType() == "Balance Enquiry") {
            balanceEnquiry++;
        }
    }

    if(deposit > withdrawal && deposit > balanceEnquiry) {
        frequentType = "Deposit";
    } else if(withdrawal > balanceEnquiry && withdrawal > deposit) {
        frequentType = "Withdrawal";
    } else if(balanceEnquiry > deposit && balanceEnquiry > withdrawal) {
        frequentType = "Balance Enquiry";
    }
    else {
        frequentType = "NA";
    }

    return frequentType;//Returns most frequent transaction type
}
QList<Transactions*> SavingsAccount::transactionsOnDate(QDate date) {
    QList<Transaction*> transactions;

    for(int i = 0; i < m_TransactionList.size(); i++) {
        if(m_TransactionList.at(i)->getDateTime().date() == date) {
            transactions << m_TransactionList;
        }
    }

    return transactions;
}
QString SavingsAccount::toString() {
    return "Savings Account:\n================\n"
           + "Customer Name: " + m_CustomerName + "\n"
           + "Account Number: " + m_AccountNumber + "\n"
           + "================\nTransactions\n================\n"
           + m_TransactionList
           + "================\nTransaction Details\n================\n"
           + "Total Transaction Cost: R" + totalTransactionCost()
           + "Most Frequent Transaction Type: " + frequentTransactionType()
           + "================\nTransactions Today\n================"
           + transactionsOnAdate(QDate::currentDate());
}

transaction.h
#ifndef TRANSACTION_H
#define TRANSACTION_H
#include <QString>
#include <QDateTime>

class Transaction
{
protected:
    QString m_Type;
    QDateTime m_DateTime;
public:
    Transaction(QString type, QDateTime datetime);
    QString getType();
    QString toString();
    QDateTime getDateTime();
    virtual double computeCost();
};

transaction.cpp
#include "transaction.h"

Transaction::Transaction(QString type, QDateTime datetime) {
    m_Type = type;
    m_DateTime = datetime;
}
QString Transaction::getType() {
    return m_Type;
}
QString Transaction::toString() {
    return m_Type + " " + m_DateTime.toString() + "\n";
}
QDateTime Transaction::getDateTime() {
    return m_DateTime;
}
double Transaction::computeCost() {
    return 0;//Virtual Function (meant to be overrided)
}

deposit.h
#ifndef DEPOSIT_H
#define DEPOSIT_H
#include "transaction.h"
#include <QString>

class Deposit: public Transaction
{
private:
    double m_Amount;
    const double m_Fee = 5.0; //reasonable amount R5 deposit
public:
    Deposit(double amount);
    QString toString();
    double computeCost();
};

#endif // DEPOSIT_H

deposit.cpp
#include "deposit.h"

Deposit::Deposit(double amount) {
    m_Amount = amount;
    m_Type = "Deposit";
    m_DateTime = QDateTime::currentDateTime();
}
QString Deposit::toString() {
    return Transaction::toString() + "Amount: R" + m_Amount
            + "\nFee: R" + m_Fee;
}
double Deposit::computeCost() {
    return m_Fee;
}

withdrawal.h
#ifndef WITHDRAWAL_H
#define WITHDRAWAL_H
#include "transaction.h"
#include <QString>

class Withdrawal: public Transaction
{
private:
    double m_Amount;
    double m_Percentage = 3; //3% withdrawal cost
public:
    Withdrawal(double amount);
    QString toString() const;
    double computeCost();
};

#endif // WITHDRAWAL_H

withdrawal.cpp
#include "withdrawal.h"

Withdrawal::Withdrawal(double amount) {
    m_Amount = amount;
    m_Type = "Withdrawal";
    m_DateTime = QDateTime::currentDateTime();
}
QString Withdrawal::toString() {
    return Transaction::toString() + "Amount: R" + m_Amount
            + "\nFee Percentage: " + m_Percentage + "%";
}
double Withdrawal::computeCost() {
    return m_Amount*m_Percentage/100;
}

balanceenquiry.h
#ifndef BALANCEENQUIRY_H
#define BALANCEENQUIRY_H
#include "transaction.h"
#include <QString>
#include <QDate>

class BalanceEnquiry: public Transaction
{
private:
    QDate m_FromDate;
    QDate m_ToDate;
public:
    BalanceEnquiry(QDate fDate, QDate tDate);
    QString toString() const;
    double computeCost();
};

#endif // BALANCEENQUIRY_H

balanceenquiry.cpp
#include "balanceenquiry.h"

BalanceEnquiry::BalanceEnquiry(QDate fDate, QDate tDate) {
    m_FromDate = fDate;
    m_ToDate = tDate;
    m_Type = "Balance Enquiry";
    m_DateTime = QDateTime::currentDateTime();
}
QString BalanceEnquiry::toString() {
    return Transaction::toString() + "From: " + m_FromDate
            + "/nTo: " + m_ToDate;
}
double BalanceEnquiry::computeCost() {
    return 0; //Balance Enquiry costs nothing
}

main.cpp
#include <QCoreApplication>
#include "savingsaccount.h"
#include <QDebug>

QTextStream cout(stdout);

int main(int argc, char *argv[])
{
    QCoreApplication a(argc, argv);

    //Declare variables
    QString customerName = "Barry Doyle";
    QString accountNumber = "1234567890";

    //Implement Savings Account
    SavingsAccount account(customerName, accountNumber);

    //Implement Transactions
    Deposit d1(500.0);
    BalanceEnquiry b1(QDate::currentDate(), QDate::currentDate());
    Withdrawal w1(200.0);
    Withdrawal w2(250.0);
    BalanceEnquiry b2(QDate::currentDate(), QDate::currentDate());
    Deposit d2(400.0);
    Deposit d3(150.0);

    Transaction *t1 = &d1;
    Transaction *t2 = &b1;
    Transaction *t3 = &w1;
    Transaction *t4 = &w2;
    Transaction *t5 = &b2;
    Transaction *t6 = &d2;
    Transaction *t7 = &d3;

    //Add Transactions to Transaction List
    account.addTransaction(t1);
    account.addTransaction(t2);
    account.addTransaction(t3);
    account.addTransaction(t4);
    account.addTransaction(t5);
    account.addTransaction(t6);
    account.addTransaction(t7);

    account.toString();

    return a.exec();
}

A: For example: Deposit is derived from Transaction. Deposit constructor implicitly calls Transaction constructor with no arguments - Transaction(), but it doesn't exist. So to solve your problem you should define Transaction constructor without arguments - Transaction(), or call explicitly constructor with 2 arguments Transaction(QString type, QDateTime datetime) like this:
Deposit::Deposit(double amount)
        : Transaction("Deposit", QDateTime::currentDateTime()) {
m_Amount = amount;
m_Type = "Deposit"; // this no need now
m_DateTime = QDateTime::currentDateTime(); // and this too

}

A: I think for ua addTransaction you should use the append function like
void SavingsAccount::addTransaction(Transaction *t){
    m_TransactionList.append();


text:
Q: set jquery variable name as DIV id name I want to create a flag variable whose name is same as the div id which is clicked...(fiddle)
following is the what i tried to do...
JQuery:
var $(this).attr(id)=12;
alert($(this).attr(id));

HTML:

some text goes here

But it didn't work please help...here is a fiddle.
in fiddle(see the value of var cccis not changing)

A: The correct form would be:
$(this).attr(id, "12")

And assigning a number as ID might be problematic in non html5 context.
However, the only way to somehow use the value of the div as variable name would be in the following way (instead of window, you could create a custom scoped var x={} ):
window[ $(this).attr(id)] = 12;
// or
window[ this.id ] = 12;

Problem: you don't know the name of the value, hence you always had to address the variable in this way. There is probably a better solution for your initial problem...
If you want to store information to that specific html-element, you'd better use the data() method.
$('#ccc').on('click',function(){
    $(this).data("ccc",12);
    alert( $(this).data("ccc") );
});

The value 12 is now stored "directly on the html element". Is that what you perhaps want?

A: It's sort of clear what you're trying to do, but it's not at all clear why you're trying to do it.  Variables should, well, vary... but their names should not.  (This comes up a surprising number of times, actually, so I really wonder where the impetus to do this comes from.)
This is not a variable name:
$(this).attr(id)

It's a call to the $ function, which returns a jQuery object, followed by a call to the attr function on that object, which returns a value.  (Or should, depending on what id is in this context.  If you meant 'id' instead then it should return the string value of the id attribute on the matched element.)
This should work, in that it should alert the string value of the id attribute:
alert($(this).attr(id));

But the question is, what are you trying to do by using a function call's return value as a variable name?  I know JavaScript isn't a static language, but it's not that dynamic.
The variable name has to be static, otherwise how would any other code know how to use it?  There is undoubtedly a better structure to achieve the functionality you're looking to achieve.

A: $('#ccc').on('click',function(){
   window[this.id] = 12;
    alert(window[this.id]);
});

A: You dont have to use a variable
two ways to do it

some text goes here

//mixing jquery and pure javascript
$('#ccc').on('click',function(){
  alert(this.id);
});

//using only Jquery
 $('#ccc').on('click',function(){
  alert($(this).attr('id'));
});


text:
Q: Problem with defined integral when using an exponent I used the following line to overleaf LATEX:
\[
u= u_0 +\frac{1}{m} \int_{t_0}^{t} F_0(\frac {t}{t_0})^α \,dt
\]

however the result was not what I expected  and the "dt" showed as an exponent together with "α". Do you know what might be wrong?
Thank you very much

A: You should not ignore error messages (and also please post full documents that reproduce the problem, not fragments) After any error the pdf is not intended to be usable, just a possible debugging aid.
\documentclass{article}

\begin{document}

\[
u= u_0 +\frac{1}{m} \int_{t_0}^{t} F_0(\frac {t}{t_0})^α \,dt
\]

\end{document}

Produces
! Missing { inserted.
<to be read again>
                   \begingroup
l.6 ...1}{m} \int_{t_0}^{t} F_0(\frac {t}{t_0})^α
                                                   \,dt
?

and if you scroll past that,
! LaTeX Error: Unicode character α (U+03B1)
               not set up for use with LaTeX.

See the LaTeX manual or LaTeX Companion for explanation.
Type  H <return>  for immediate help.
 ...

l.6 ...1}{m} \int_{t_0}^{t} F_0(\frac {t}{t_0})^α
                                                   \,dt
?

Any further errors (and pdf output) if you scroll past these errors are essentially spurious artifacts of tex trying to recover from the initial error.
\documentclass{article}

\begin{document}

\[
u= u_0 +\frac{1}{m} \int_{t_0}^{t} F_0(\frac {t}{t_0})^{\alpha} \,dt
\]

\end{document}

Produces

A: As @barbarabeeton has already noted in a comment, you should probably be using XeLaTeX or LuaLaTeX, along with the unicode-math package, if you want to use a Unicode-encoded character such as α instead of \alpha in math mode.
You should probably also be thinking about enlarging the parentheses around the term  \frac {t}{t_0}, as is done in the second equation below.

% !TEX TS-program = lualatex
\documentclass{article}
\usepackage{unicode-math}
\begin{document}
\[
u= u_0 +\frac{1}{m} \int_{t_0}^{t} F_0(\frac {t}{t_0})^α \,dt
\]
\[
u= u_0 +\frac{1}{m} \int_{t_0}^{t}\! F_0\Bigl( \frac{t}{t_0} \Bigr)^{\!α} \,dt
\]
\end{document}


text:
Q: Switch View on Gingerbread I've coded an app which uses Switch as a toggler.
When I run it on ICS I have no problems, but when I run it on gingerbread it crashes:
05-04 11:00:43.261: E/AndroidRuntime(1455): FATAL EXCEPTION: main
05-04 11:00:43.261: E/AndroidRuntime(1455): java.lang.RuntimeException: Unable to start activity ComponentInfo{it.android.smartscreenon/it.android.smartscreenon.ActivityImpostazioni}: android.view.InflateException: Binary XML file line #58: Error inflating class Switch
05-04 11:00:43.261: E/AndroidRuntime(1455):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1768)
05-04 11:00:43.261: E/AndroidRuntime(1455):     at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1784)
05-04 11:00:43.261: E/AndroidRuntime(1455):     at android.app.ActivityThread.access$1500(ActivityThread.java:123)
05-04 11:00:43.261: E/AndroidRuntime(1455):     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:939)
05-04 11:00:43.261: E/AndroidRuntime(1455):     at android.os.Handler.dispatchMessage(Handler.java:99)
05-04 11:00:43.261: E/AndroidRuntime(1455):     at android.os.Looper.loop(Looper.java:130)
05-04 11:00:43.261: E/AndroidRuntime(1455):     at android.app.ActivityThread.main(ActivityThread.java:3835)
05-04 11:00:43.261: E/AndroidRuntime(1455):     at java.lang.reflect.Method.invokeNative(Native Method)
05-04 11:00:43.261: E/AndroidRuntime(1455):     at java.lang.reflect.Method.invoke(Method.java:507)
05-04 11:00:43.261: E/AndroidRuntime(1455):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:847)
05-04 11:00:43.261: E/AndroidRuntime(1455):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:605)
05-04 11:00:43.261: E/AndroidRuntime(1455):     at dalvik.system.NativeStart.main(Native Method)
05-04 11:00:43.261: E/AndroidRuntime(1455): Caused by: android.view.InflateException: Binary XML file line #58: Error inflating class Switch
05-04 11:00:43.261: E/AndroidRuntime(1455):     at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:581)
05-04 11:00:43.261: E/AndroidRuntime(1455):     at android.view.LayoutInflater.rInflate(LayoutInflater.java:623)
05-04 11:00:43.261: E/AndroidRuntime(1455):     at android.view.LayoutInflater.rInflate(LayoutInflater.java:626)
05-04 11:00:43.261: E/AndroidRuntime(1455):     at android.view.LayoutInflater.rInflate(LayoutInflater.java:626)
05-04 11:00:43.261: E/AndroidRuntime(1455):     at android.view.LayoutInflater.rInflate(LayoutInflater.java:626)
05-04 11:00:43.261: E/AndroidRuntime(1455):     at android.view.LayoutInflater.inflate(LayoutInflater.java:408)
05-04 11:00:43.261: E/AndroidRuntime(1455):     at android.view.LayoutInflater.inflate(LayoutInflater.java:320)
05-04 11:00:43.261: E/AndroidRuntime(1455):     at android.view.LayoutInflater.inflate(LayoutInflater.java:276)
05-04 11:00:43.261: E/AndroidRuntime(1455):     at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:212)
05-04 11:00:43.261: E/AndroidRuntime(1455):     at android.app.Activity.setContentView(Activity.java:1657)
05-04 11:00:43.261: E/AndroidRuntime(1455):     at it.android.smartscreenon.ActivityImpostazioni.onCreate(ActivityImpostazioni.java:43)
05-04 11:00:43.261: E/AndroidRuntime(1455):     at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
05-04 11:00:43.261: E/AndroidRuntime(1455):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1722)
05-04 11:00:43.261: E/AndroidRuntime(1455):     ... 11 more
05-04 11:00:43.261: E/AndroidRuntime(1455): Caused by: java.lang.ClassNotFoundException: android.view.Switch in loader dalvik.system.PathClassLoader[/data/app/it.android.smartscreenon-1.apk]
05-04 11:00:43.261: E/AndroidRuntime(1455):     at dalvik.system.PathClassLoader.findClass(PathClassLoader.java:240)
05-04 11:00:43.261: E/AndroidRuntime(1455):     at java.lang.ClassLoader.loadClass(ClassLoader.java:551)
05-04 11:00:43.261: E/AndroidRuntime(1455):     at java.lang.ClassLoader.loadClass(ClassLoader.java:511)
05-04 11:00:43.261: E/AndroidRuntime(1455):     at android.view.LayoutInflater.createView(LayoutInflater.java:471)
05-04 11:00:43.261: E/AndroidRuntime(1455):     at android.view.LayoutInflater.onCreateView(LayoutInflater.java:549)
05-04 11:00:43.261: E/AndroidRuntime(1455):     at com.android.internal.policy.impl.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:66)
05-04 11:00:43.261: E/AndroidRuntime(1455):     at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:568)
05-04 11:00:43.261: E/AndroidRuntime(1455):     ... 23 more

It looks like Switch doesn't exist on Gingerbread. How can I solve the problem?

A: Use a togglebutton instead. Switches were added in API level 14. Here is the documentation.


text:
Q: Importing data from xml to database using php loop I have problem with importing data from xml to SQL table. The xml look's like this:
<MeasuringPoints>
   <MeasuringPoint ID="BaseStation" LastChange="2013-05-20T12:15:03.837">
   </MeasuringPoint>
   <MeasuringPoint ID="MiddleStation" LastChange="2012-08-01T11:47:33.160">
   </MeasuringPoint>
   <MeasuringPoint ID="MountainStation" LastChange="2013-05-20T12:15:03.840>
   </MeasuringPoint>
</MeasuringPoints>

Using php (foreach loop)
foreach($skiarea->MeasuringPoints->MeasuringPoint as $measuring) {
  $MEASURING_POINTS = $measuring['ID'];
  $MEASURING_LAST_CHANGE = $measuring['LastChange'];
}

I get this data on output:
BaseStation - 1369052103
MiddleStation - 1343821653
MountainStation - 1369052103

I'm trying to insert that value to batabase
mysql_query("
  INSERT INTO database_name SET
  base_station_last_change = '$MEASURING_LAST_CHANGE[0]',
  middle_station_last_change = '$MEASURING_LAST_CHANGE[1]',
  mountain_station_last_change = '$MEASURING_LAST_CHANGE[2]',
") OR die(mysql_error());

But this code didn't work. importing only one value.
How to insert those data to sql database fields?

A:     $MEASURING_LAST_CHANGE = array();

    foreach($skiarea->MeasuringPoints->MeasuringPoint as $measuring) {
      $MEASURING_POINTS = $measuring['ID'];
      $MEASURING_LAST_CHANGE[] = $measuring['LastChange'];
    }

    mysql_query("
INSERT INTO table_name (base_station_last_change,middle_station_last_change,mountain_station_last_change) VALUES (
'$MEASURING_LAST_CHANGE[0]','$MEASURING_LAST_CHANGE[1]','$MEASURING_LAST_CHANGE[2]')
     ") OR die(mysql_error());

A:  foreach($skiarea->MeasuringPoints->MeasuringPoint as $measuring) {
  $MEASURING_POINTS[] = $measuring['ID'];
  $MEASURING_LAST_CHANGE[] = $measuring['LastChange'];
}


text:
Q: React+Express+MongoDB - correct POST request I would like to know what is a good way to make POST request.
I created view with google map and marker with coordinates using react-google-maps. I store markers in react component using array of objects like this:
MapComponent.js
const markers = this.props.markers.map((pos,i) => {
    const marker={
      position:{
        lat:pos.location.lat,
        lng:pos.location.lng
      }
    }
    return <Marker key={i} {...marker}/>
  })

I am getting info about markers from AppComponent which is returning this:
<div className='container' style={{height:600}}>
        <Map center={location} markers={markers}/>
      </div>

where markers are :
const markers=[
    {
      location:{
        lat: 40.7575285,
        lng: -73.9884469
      }
    }
  ]

Now I would like to get markers' coordinates via POST request. Client will send POST with JSON data with his/her current location.Then I would like to store each coordinate in MongoDB refresh page and display marker with current location which I got from JSON. What is the best way to do that? Should I use POST only using Express?


text:
Q: Memory Usage Monitoring in GCP Compute Engine with or without Stack Driver Cloud Platform - GCP Compute Engine
OS - Ubuntu, 16.04 LTS
I want to see memory utilization graph just like CPU utilization (compute.googleapis.com/instance/cpu/utilization).
I could not find any way to monitor my Compute Engine memory utilization even if Stack-driver is enabled.
I checked https://cloud.google.com/monitoring/api/metrics_gcp#gcp-compute and there is no endpoint for memory utilization monitoring.
I tried stackdriver agent monitoring endpoints also but it is not working ( agent.googleapis.com/memory/percent_used)
https://cloud.google.com/monitoring/api/metrics_agent#agent-memory.
Does anyone know how can I see memory utilization graph in GCP compute engine instance monitoring or via Stack Driver Monitoring

A: EDITED

*

*On Stackdriver Monitoring: (You will have to install the agent on your VM Instance)

*

*Install the Stackdriver Monitoring Agent following this guide.

*Open stackdriver monitoring API by clicking Navigation Menu -> Stackdriver -> Monitoring

*Once you are there on the left side you will click on "Resources" -> Metric explorer.

*On resource type: GCE VM Instance / Metrics: "Memory usage" and/or "Memory utilization".

*On filter, select Name, Value: (Name of your instance)
You should see now the graphic metrics of the Memory utilization.

A: You missed something in the installation of the stackdriver agent. I just tested and it works like a charm on ubuntu 16.04 (Standard Google Image)!
Then go to stackdriver

*

*Resources -> Instances: You should see your VM instance

*Click on your instance -> click on Agent -> Scroll down and you see your memory and your swap usage


text:
Q: WSO2 Identity Server 5.10.0 - SCIM2 REST - Get all required attributes? I'm calling SCIM2 REST service to get user information based on ID but it doesn't return all user data.when I call https://localhost:9444/scim2/Users/8f9d1e34-c340-4ebe-af11-fa0c4575f676 passing username and password (BASIC) I get this payload:
{
  "emails": [
    {
      "type": "home",
      "value": "test@test.com"
    }
  ],
  "meta": {
    "created": "2020-10-09T11:29:42.809803400Z",
    "location": "https://localhost:9444/scim2/Users/8f9d1e34-c340-4ebe-af11-fa0c4575f676",
    "lastModified": "2020-10-09T11:29:42.809803400Z",
    "resourceType": "User"
  },
  "schemas": [
    "urn:ietf:params:scim:schemas:core:2.0:User",
    "urn:ietf:params:scim:schemas:extension:enterprise:2.0:User"
  ],
  "roles": [
    {
      "type": "default",
      "value": "Internal/everyone"
    }
  ],
  "id": "8f9d1e34-c340-4ebe-af11-fa0c4575f676",
  "userName": "test"
}

But this user has more attributes as seem below:

How do I return whole user data?
Thanks in advance

A: The SCIM GET request on /Users/{user-id} endpoint will return the SCIM user attributes which defined under urn:ietf:params:scim:schemas:core:2.0:User and urn:ietf:params:scim:schemas:extension:enterprise:2.0:User claim dialects (mgt console -> Main Menu-> Identity tab -> Claims -> List). If the particular attribute (i.e local claim) is not mapped to a SCIM user attribute that value won't be returned in the SCIM user GET response.
In order to map such local attributes to SCIM attributes, you can follow the instructions in https://is.docs.wso2.com/en/latest/develop/extending-scim2-user-schemas/#extending-the-scim-20-api.
Moreover,
You can find SCIM core user attribute definitions here. If an attribute's returned characteristic is

*

*Returned.ALWAYS  -> Always returned in the response

*Returned.DEFAULT -> Return in the response only if that attribute has a value

*Returned.NEVER -> Never return in the response


text:
Q: Conflicto entre PreferenceFragment y onOptionsItemSelected Parece que tengo un conflicto entre PreferenceFragment y onOptionsItemSelected , estoy tratando de enviar varias variables de ListPreference desde UsbSettingActivity al MainActivity usando Intents, el problema esta en solo me llega el primer dato, usando el debug del SDK en este activity observó que solo está disponible el dato:
mconfigbaudrate = 9600

Aqui esta mi codigo
public class UsbSettingActivity extends AppCompatPreferenceActivity {

final String setBaudRate = "" ;
public static String mconfigbaudrate = "";
public static String mconfigdatabit = "";
public static String mconfigbitstop = "";
public static String mconfigparity = "";
public static String mconfigfontsize = "";
public static String mconfigconsolamode = "";
public static String mconfigfindelinea = "";
public static String mconfigenableeco = "";
public static String mconfigfilesave = "";

private static Preference.OnPreferenceChangeListener
        sBindPreferenceSummaryToValueListener = new Preference.OnPreferenceChangeListener() {
    @Override
    public boolean onPreferenceChange(Preference preference, Object value) {
        String stringValue = value.toString();

        if (preference instanceof ListPreference) {
            ListPreference listPreference = (ListPreference) preference;
            int index = listPreference.findIndexOfValue( stringValue );
            preference.setSummary(index >= 0 ? listPreference.getEntries()[index] : null );
        }else {
            preference.setSummary( stringValue );
        }
        return true;
    }
};

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    getFragmentManager().beginTransaction().replace(android.R.id.content, new MyPreferenceFragment()).commit();
    setupActionBar();
}

private void setupActionBar() {
    ActionBar actionBar = getSupportActionBar();
    if (actionBar != null) {
         actionBar.setDisplayHomeAsUpEnabled( true );
    }
}

private static void bindPreferenceSummaryToValue(Preference preference) {

    preference.setOnPreferenceChangeListener( sBindPreferenceSummaryToValueListener );
    sBindPreferenceSummaryToValueListener.onPreferenceChange( preference,PreferenceManager
            .getDefaultSharedPreferences( preference.getContext() )
            .getString( preference.getKey(), "" ) );
}

public static class MyPreferenceFragment extends PreferenceFragment {
    @Override
    public void onCreate(final Bundle savedInstanceState)
    {
        super.onCreate(savedInstanceState);
        addPreferencesFromResource(R.xml.pref_setup_com);

        setHasOptionsMenu( true );

        bindPreferenceSummaryToValue( findPreference( "config_baud_rate" ) );
        bindPreferenceSummaryToValue( findPreference( "config_data_bit" ) );
        bindPreferenceSummaryToValue( findPreference( "config_bit_stop" ) );
        bindPreferenceSummaryToValue( findPreference( "config_parity" ) );
        bindPreferenceSummaryToValue( findPreference( "config_flow_control" ) );
        bindPreferenceSummaryToValue( findPreference( "config_font_size" ) );
        bindPreferenceSummaryToValue( findPreference( "config_consola_mode" ) );
        bindPreferenceSummaryToValue( findPreference( "config_fin_delinea" ) );
        bindPreferenceSummaryToValue( findPreference( "config_filesave" ) );

        ListPreference SPconfigbaudrate2 = (ListPreference) findPreference("config_baud_rate");
        mconfigbaudrate = SPconfigbaudrate2.getValue();

        ListPreference SPconfigdatabit2 = (ListPreference) findPreference("config_data_bit");
        String mconfigdatabit = SPconfigdatabit2.getValue();

        ListPreference SPconfigbitstop2 = (ListPreference) findPreference("config_bit_stop");
        String mconfigbitstop = SPconfigbitstop2.getValue();

        ListPreference SPmconfigparity2 = (ListPreference) findPreference("config_parity");
        String mconfigparity = SPmconfigparity2.getValue();

        ListPreference SPconfigfontsize2 = (ListPreference) findPreference("config_font_size");
        String mconfigfontsize = SPconfigfontsize2.getValue();

        ListPreference SPconfigconsolamode2 = (ListPreference) findPreference("config_consola_mode");
        String mconfigconsolamode = SPconfigconsolamode2.getValue();

        ListPreference SPconfigfindelinea2 = (ListPreference) findPreference("config_fin_delinea");
        String mconfigfindelinea = SPconfigfindelinea2.getValue();

        TwoStatePreference SPconfigenableeco2 = (TwoStatePreference) findPreference("config_enable_eco");
        Boolean mconfigenableecoX = SPconfigenableeco2.isChecked();
        String mconfigenableeco = String.valueOf(mconfigenableecoX);

        ListPreference SPconfigfilesave2 = (ListPreference) findPreference("config_filesave");
        String mconfigfilesave = SPconfigfilesave2.getValue();
    }
}

@Override
public boolean onOptionsItemSelected(MenuItem item) {

    int id = item.getItemId();
    if (id == android.R.id.home) {
        Intent intent2 = new Intent(this, MainActivity.class);
        intent2.putExtra("mconfigbaudratex",mconfigbaudrate);
        intent2.putExtra("mconfigdatabitx",mconfigdatabit);
        intent2.putExtra("mconfigbitstopx", mconfigbitstop);
        intent2.putExtra("mconfigparityx", mconfigparity);
        intent2.putExtra("mconfigfontsizex", mconfigfontsize);
        intent2.putExtra("mconfigconsolamodex", mconfigconsolamode);
        intent2.putExtra("mconfigfindelineax", mconfigfindelinea);
        intent2.putExtra("mconfigenableecox", mconfigenableeco);
        intent2.putExtra("mconfigfilesavex", mconfigfilesave);

        startActivityForResult(intent2, 0);
    }
    return super.onOptionsItemSelected( item );
   }
 }

Alguien me podria decir cual es mi error?, los datos en listPreference están cargados y se muestran correctamente, si reemplazo las demás variables a excepción del primero por cadena de texto todos me llegan correctamente

A: El problema es que estas definiendo los mismos nombres de variables dentro del método onCreate() por lo tanto únicamente tendrán valor dentro de este método.
Usa las variables que defines en la clase:
public class UsbSettingActivity extends AppCompatPreferenceActivity {

final String setBaudRate = "" ;
public static String mconfigbaudrate = "";
public static String mconfigdatabit = "";
public static String mconfigbitstop = "";
public static String mconfigparity = "";
public static String mconfigfontsize = "";
public static String mconfigconsolamode = "";
public static String mconfigfindelinea = "";
public static String mconfigenableeco = "";
public static String mconfigfilesave = "";
...
...

Realiza el cambio para que las variables puedas ser enviadas con su respectivo valor vía intent :
 public void onCreate(final Bundle savedInstanceState)
    {
        super.onCreate(savedInstanceState);
        addPreferencesFromResource(R.xml.pref_setup_com);

        setHasOptionsMenu( true );

        bindPreferenceSummaryToValue( findPreference( "config_baud_rate" ) );
        bindPreferenceSummaryToValue( findPreference( "config_data_bit" ) );
        bindPreferenceSummaryToValue( findPreference( "config_bit_stop" ) );
        bindPreferenceSummaryToValue( findPreference( "config_parity" ) );
        bindPreferenceSummaryToValue( findPreference( "config_flow_control" ) );
        bindPreferenceSummaryToValue( findPreference( "config_font_size" ) );
        bindPreferenceSummaryToValue( findPreference( "config_consola_mode" ) );
        bindPreferenceSummaryToValue( findPreference( "config_fin_delinea" ) );
        bindPreferenceSummaryToValue( findPreference( "config_filesave" ) );

        ListPreference SPconfigbaudrate2 = (ListPreference) findPreference("config_baud_rate");
        mconfigbaudrate = SPconfigbaudrate2.getValue();

        ListPreference SPconfigdatabit2 = (ListPreference) findPreference("config_data_bit");
        //String mconfigdatabit = SPconfigdatabit2.getValue();                      mconfigdatabit = SPconfigdatabit2.getValue();

        ListPreference SPconfigbitstop2 = (ListPreference) findPreference("config_bit_stop");
        //String mconfigbitstop = SPconfigbitstop2.getValue();
        mconfigbitstop = SPconfigbitstop2.getValue();

        ListPreference SPmconfigparity2 = (ListPreference) findPreference("config_parity");
        //String mconfigparity = SPmconfigparity2.getValue();
         mconfigparity = SPmconfigparity2.getValue();

        ListPreference SPconfigfontsize2 = (ListPreference) findPreference("config_font_size");
        //String mconfigfontsize = SPconfigfontsize2.getValue();
         mconfigfontsize = SPconfigfontsize2.getValue();

        ListPreference SPconfigconsolamode2 = (ListPreference) findPreference("config_consola_mode");
        //String mconfigconsolamode = SPconfigconsolamode2.getValue();
        mconfigconsolamode = SPconfigconsolamode2.getValue();

        ListPreference SPconfigfindelinea2 = (ListPreference) findPreference("config_fin_delinea");
        //String mconfigfindelinea = SPconfigfindelinea2.getValue();
        mconfigfindelinea = SPconfigfindelinea2.getValue();

        TwoStatePreference SPconfigenableeco2 = (TwoStatePreference) findPreference("config_enable_eco");
        Boolean mconfigenableecoX = SPconfigenableeco2.isChecked();
        //String mconfigenableeco = String.valueOf(mconfigenableecoX);
        mconfigenableeco = String.valueOf(mconfigenableecoX);

        ListPreference SPconfigfilesave2 = (ListPreference) findPreference("config_filesave");
        //String mconfigfilesave = SPconfigfilesave2.getValue();
        mconfigfilesave = SPconfigfilesave2.getValue();
    }