text:
Q: Could we be a little less eager with the duplicate votes to close?  It was pointed out to me it was unfair to single out folks with dupe-hammers for this. It was a poor choice of words, on my part. The core of the post is still something I feel needs addressing, so I have edited appropriately
I've noticed that quite a few folks tend to be really enthusiastic with their dupe-votes. I'm not the only one, and it's come up in the comments of a few posts. A few folks put a lot of effort into updating the community FAQs (which is excellent), and trying to get stuff closed against those (which is a little less so).
While both voting to close as a duplicate and community FAQs are super useful, as a space acting as a community helpdesk of sorts, It seems useful to have answers specific to a problem,even if it references a community FAQ entirely (that's to say "Oh, it's in Section 3C which says...") as opposed to closing as a duplicate directly.
Practically, duplicate closures ought to be for exact duplicates, and in some cases, it feels like getting an answer in that helps the user might be preferable to the quick closure.
So, should we be closing stuff less quickly as dupes? And is there a workflow that might be a reasonable compromise between handling stuff quickly and being helpful to folks who don't know MSE as well as others?
Yes, it's a well-known pet peeve of mine. Also, not something I really noticed before being a mod.

A:
So, should we be closing stuff less quickly as dupes?

No, I'm trusted with that dupe hammer privilege (and regular close voters with their non-binding vote) and I still go by the vote early and often guidance. It is also unclear what less quickly means: do we wait for 6 to 8 hours?
I'm still having to dedicate my time to find the frigging dupe first and then judge if that question and answer fit my own quality rules. More often then not the dupe I find is closed against an FAQ post. Based on my judgement I pick the best target. If I find that subpar I try to find extra dupes and edit those into the duplicate list.
And it is easy to keep an eye on and/or revisit a couple of times to fix any mishaps, if comments or edits give reason to do so. I also feel that the dupehammers on MSE are receptive to feedback and are happy to respond if they got anything wrong. How that can be perceived as not helpful is hard to grasp for me.

And is there a workflow that might be a reasonable compromise between handling stuff quickly and being helpful to folks who don't know MSE as well as others?

I think the current workflow works for me and without any more concrete issues or examples to work from I see no reason to change my workflow. I've already changed my down voting workflow to help in keeping a post longer on the front-page so other users can get their chance to see a post instead of the usual bunch.
I'm also not sure what other options we have, instead of repeating an answer from a dupe that is, to be more helpful to a specific OP or future visitors that have the same question and came looking here for a canonical answer.
tl;dr
On all SE sites closing a question as a duplicate is a core feature and in my opinion is a good way to bundle knowledge. If anything, new users should be informed upfront that when a duplicate is offered they are probably helped much better then if they waited for someone to write a custom answer to their common issue.

A: Since I'm using my dupehammers quite often (and TL;DR, I'm open to using them less often, if the community desires so), I feel compelled to add my 2 cents. First of all, I like to have some data available, so I spun up a monstrous SEDE query to set the record for most often applying CROSS APPLY and OPENJSON to see in which cases dupehammers have been used this year. Feel free to use to analyze specific cases. There have been 259 closures so far, and only 63 (a quarter of them) towards faq questions. (I expected a higher proportion, what about you?)
Whenever I close something as a duplicate of a long FAQ, I tend (or at least plan to do this more often) leave a comment quoting the relevant part of the FAQ (often just a single sentence). I know that comments are not meant for giving answers and that I'm still duplicating content (the main problem of answering duplicate questions), but at least it helps the author of the question. The disadvantage of posting an answer (and not using the dupehammer) is that I know that other users will complain "hey, this question has already been asked before, you're only posting an answer because you want to earn more reputation". <-- that's the gist of such comments, it's often worded in a way that seems more neutral but is still open to interpretation. It's not an MSE specific problem, it happens on Stack Overflow as well. Is it OK if I'm going to flag those as unfriendly (even if they're directed at another answerer)?
Also, I'm not responsible if in a few years we discover that we have a massive chunk of outdated content on the site. I'm one of the senior developers in our company and I'm often amazed of how much duplicate or near-duplicate code we have in our systems, or to put it differently: how little people can achieve with so much code. Decisions like this (allowing everybody to write their own solutions (read: answers) to common problems (read: questions)) might seem doable at first, but in the long run they only hurt the product (read: Meta Stack Exchange).
Final thought: it seems that some people feel offended if their own question is closed as a (near-)duplicate (or even think it is 'unwelcoming' when another question, not their own, is dupehammered). I ... just don't get that. When one of my first question was closed as duplicates, I felt more like "great, I'm not the only one with this problem". I think the unwelcoming part is more about the downvotes, which may be warranted if the question is poorly researched, but there's no need to go all -7 on it (in my opinion, YMMV).

A: One of the problems here is that some of the FAQs have gotten... Really long. Like this one: The Complete Rate-Limiting Guide
...or, hell, this monstrosity: What are the badges I can earn on each site, and what are the exact criteria for earning each badge?
When you need nine answers to cover a topic, it's not really an FAQ anymore, eh? The original Stack Overflow FAQ started out as a single question with loads of answers, and got split up before the site even made it out of beta because it got too unwieldy. I sympathize with the desire to be thorough, but both of those questions are now terrible duplicate targets because you practically have to use in-page search to find what you're looking for once you get there!
Anyway... Here's my rule of thumb: if the question you're closing isn't represented in the question you're picking as a dup-target - yes, the question itself not a subsection of an answer - then it's probably a bad dup-target. Pick a different one, or write an answer & use your massive reference book of a FAQ as a reference.


text:
Q: How to get rid of an intermediate array in this case? I have this this function (I think the code is self-explanatory):
items: function(input) {
    let arr = [];
    for(let i=0; i<input.length; i++){
         if(input[i].quantity > 0) {
             arr.push({
                 value: false,
                 name: input[i].name,
             });
          }
    }
   return arr;
},

I wonder if there is a shorter way to do it without relying on the intermediate arr?

A: I'd use Array built in methods:
items: (input) => input
        .filter(({ quantity }) => quantity > 0)
        .map(({ name }) => ({ name, value: false }))

A: You'll have to create an array regardless (need something to be returned, after all), but one option is to immediately return a call to reduce:
items: input => input.reduce((a, { name, quantity }) => {
  if (quantity > 0) a.push({ value: false, name });
  return a;
}, []))

This is similar to what could be accomplished with a .filter followed by a .map, but .filter followed by .map will require the unnecessary construction of an intermediate array, and requires iterating over some input elements twice, rather than once.

A: Your code combines filtering and transforming. You only want to keep elements whose quantity is positive, and you want to transform them to {value: false, name: ...} objects.
This can be done by combining filter and map:
items: function(input) {
    return (
        input
            .filter(function (x) { return x.quantity > 0; })
            .map(function(x) { return { value: false, name: x.name }; })
    );
}

You can fuse the two operations by using reduce:
items: function(input) {
    return (
        input
            .reduce(function (z, x) {
                return (
                    x.quantity > 0
                        ? z.concat({value: false, name: x.name})
                        : z
                );
            }, [])
    );
}

This only traverses input once, but constructs many intermediate arrays (via concat).
You can "cheat" by writing an imperative loop that modifies an accumulator array in place (like your arr), but disguise it as a reduce:
items: function(input) {
    return (
        input
            .reduce(function (arr, x) {
                if (x.quantity > 0) {
                    arr.push({value: false, name: x.name});
                }
                return arr;
            }, [])
    );
}

Here we still have an intermediate arr, but its definition is hidden / distributed between function (arr, x), return arr, and [] at the end.
It is functionally equivalent to:
items: function(input) {
    var arr = [];  // used to be function (arr, ...) ..., []
    input.reduce(function (_, x) {
        if (x.quantity > 0) {
            arr.push({value: false, name: x.name});
        }
    }, undefined);
    return arr;  // used to be inside the reduce call
}

which really just uses reduce to iterate over the input elements, so it could be written as
items: function(input) {
    var arr = [];
    input.forEach(function (x) {
        if (x.quantity > 0) {
            arr.push({value: false, name: x.name});
        }
    });
    return arr;
}

which is pretty much your original code.

A: You would need an array to store the returned object. Your code could be rewritten as :
items: input => {
    const a = input.map(i => {
        if (i.quantity > 0) {
          return {name: i.name, value: false};
        }
    })
    return a;
}

redpajama_set_name: RedPajamaStackExchange


text:
Q: Android in-app billing verification If I offload verification to a remote server, I think the process will be something like:
Android Market                  Application     Remote Server
       |--------IN_APP_NOTIFY------->|                |
       |                             |-----nonce----->|
       |                             |<----nonce------|
       |<-GET_PURCHASE_STATE_CHANGED-|                |
       |---PURCHASE_STATE_CHANGED--->|                |
       |                             |--verification->|
       |                             |<-verification--|

If I understand correctly, the nonce is to reduce replay attack vulnerability and the verification is to reduce spoofing vulnerability. Also, the reason the docs recommend offloading security processing is that the verification step requires access to my public Android Market publisher's key and the goal of the remote server is to keep said key from needing to be included/computed in my code.
First question, is there a security reason for the remote server to do the nonce generation/check? Pressuming the verification step is done correctly, we'd find out from the remote server if the message was spoofed. So it seems to me that the nonce is just there to detect someone rebroadcasting the IN_APP_NOTIFY.
Second question, why does it matter if our public key is a literal string? The docs say, "you do not want to make it easy for a hacker or malicious user to replace the public key with another key." I'm not clear how someone could exploit my app even if they could edit the binary to include a malicious public key without having to resign the app.
Third question, won't I have all these same problems trying to verify the verification from my remote server (e.g. storing public key to my remote server in the application)?
Fourth question, is all of this extra security for naught if I want to store the results of this purchase verification on the phone (i.e. I don't want to have to verify the purchase state of the unlocked content whenever a user accesses the content)?

A: First question, is there a security reason for the remote server to do the nonce generation/check?
Yes, the server should generate the nonce, and do the check. As a general rule, everything security-related should almost allways be done in the server.
A nonce is a "number only used once". So, the correct thing for the server is to:

*

*generate and save a nonce.

*receive an answer.

*

*if the answer contains a saved nonce, check the signature and process it. ERASE THE NONCE.

*if the answer contains an unsaved nonce, it is most probably a fabricated/replicated one, so discard.

Second question, why does it matter if our public key is a literal string?
A little if you perform security checks on the aplication, completly irrelevant if you do your work on a server (as you should).
If you perform security in the aplication, then the aplication can be hacked to bypass the security. One technique is to change the public key, wich is easier if it is saved as a single string.
Third question, won't I have all these same problems trying to verify the verification from my remote server (e.g. storing public key to my remote server in the application)?
No you won't. No one can access/change the code of the server. At least as "easy" as the can in the aplication.
Fourth question, is all of this extra security for naught if I want to store the results of this purchase verification on the phone (i.e. I don't want to have to verify the purchase state of the unlocked content whenever a user accesses the content)?
Well, it depends.
The "securest" way to implement in-app purchases having a server implies:

*

*you save your "purchasable" content in the server. If a user buys it, you download it to the aplication, and you save it in some way hard to "copy" to another phone.

*from the server, only send content if the verification process is done correctly IN THE SERVER.

*from the aplication, if you detect no "saved" content, perform a "restore transactions" operation, and then download everything you need from the server.

*google play's in-app purchases are not designed to provide content easily, it is designed to perform purchases from a centralised site and so, easyer for the user. We developers end up with a LOT of work to use it.


text:
Q: Testforblock - Chest with a specific amount of items in it I tried to test for a chest containing 10 coal. When I tried this, it didn't work:
testforblock ~-1 ~ ~ minecraft:chest -1 {Items:[{Slot:0b,id:"minecraft:coal"}],Count:10b,Damage:0s}

It only works when I test for 1 coal, but then, I have to drop the Count and Damage tag. I want to test for 10 coal in a chest, not just for one.

A: Use this command instead:
testforblock ~-1 ~ ~ minecraft:chest -1 {Items:[{Slot:0b,id:"minecraft:coal",Count:10b,Damage:0s}]}

This works because the Count and Damage keys must be between the same brackets (in the same object and the same array)  as the id key.
Note, if you want to test for the items in any of the inventory's slots, remove the Slot key.


text:
Q: Is it good to use Google libphonenumber library for commercial purpose? Is it good idea to use Google libphonenumber library for commercial application? Eg. we are thinking to add validation of a phone number at the time of sign up. Earlier we were using regex for it. As we have OTP based verification system, so regex works good for us. And hence, we do not get any bad phone numbers in our system. Earlier, we were working only for single country numbers, so regex was easy. Now we are thinking to accept international numbers also. So, we found that google libphonenumber library does validate for any international number. https://github.com/googlei18n/libphonenumber
This seems a good option and also seems very accurate. But in this, we think there is 1 problem that when some numbers are open in some country, then we always need to update the version of library in our system also so that it will start accepting those numbers. We found that this open source library is also used by Whatsapp.
https://www.whatsapp.com/opensource/?l=es
But how do they manage this problem of updating version every time? Also, is any other company which is also using it.
Can someone please suggest, what should we do? Should we use regex for international numbers or this library.

A: Yes, you can use googlelibphonenumber for comercial applications since it has an Apache 2.0 license (you can see details here).
And of course, you should be always updating the library.
But you always could lose some very new numbers, right?
Well, if you are very strict with that and never want to deal with a false negative numbers, you could use the isPossibleNumber function like you were using isValidNumber function. But that would open the possibility to have false positive numbers. So at the end is your decision but you can't be 100% accurate and updated. You just have to choose if it's better to have false positive numbers or false negative numbers. but don't worry too much about that, the possibility of both cases is very little.


text:
Q: Importing Python classes I've a folder structure like this :
-PCore
    |-__init__.py
    |-PFnTransform.py
    |-PEuler.py
    |-PPoint3.py
    |-...

In each .py file there is a class with the same name.
And i just want to import by writting:
from Core import PPoint3

but actually I need to write:
from Core.PPoint3 import PPoint3

And when I print the class I got <class 'PCore.PEuler.PEuler'> instead of <class 'PCore.PEuler'> (what i want)
What I need to write in the __init__.py file ?

A: In the __init__.py file, you need to import the PPoint3 class.
from PPoint3 import PPoint3

Then, you'll be able to import the PPoint3 class from the PCore package.


text:
Q: Why would ImageView.setImageURI() work in Android 2.2 but not 2.1? I am displaying images and some text in a list view with an adapter.  The images are pulled from the web, then cached locally and displayed.  The images are already small (60px square), and I know their size, so I'm using the advice from here suggesting I use setImageURI instead of decoding the bitmap.
The class that does the work is a modified version of Fedor's ImageLoader
The code attaches a stub drawable to the ImageView until the desired image is downloaded from the web, then loads the cached file from the sdcard.  In Android 2.2 this works just fine.  It's fast, and I don't get OOM crashes.  On 2.1, though, I get the following error:
09-15 11:04:52.993: INFO/System.out(240): resolveUri failed on bad bitmap uri: file:///sdcard/android/data/com.example.myapp/cache/4164137

The ImageLoader class is as follows:
/*
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements.  See the NOTICE file
distributed with this work for additional information
regarding copyright ownership.  The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License.  You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied.  See the License for the
specific language governing permissions and limitations
under the License.
*/

public class ImageLoader {

    //the simplest in-memory cache implementation. This should be replaced with something like SoftReference or BitmapOptions.inPurgeable(since 1.6)
    private HashMap<String, Uri> cache=new HashMap<String, Uri>();

    private File cacheDir;

    public ImageLoader(Context context){
        //Make the background thead low priority. This way it will not affect the UI performance
        photoLoaderThread.setPriority(Thread.NORM_PRIORITY-1);

        //Find the dir to save cached images
        if (android.os.Environment.getExternalStorageState().equals(android.os.Environment.MEDIA_MOUNTED))
            cacheDir=new File(android.os.Environment.getExternalStorageDirectory(),"Android/data/com.droidicon.launcherproicons/cache/");
        else
            cacheDir=context.getCacheDir();
        if(!cacheDir.exists())
            cacheDir.mkdirs();
    }

    final int stub_id=R.drawable.loading;
    public void DisplayImage(String url, Activity activity, ImageView imageView, int scaleSize)
    {
        if(cache.containsKey(url))
            imageView.setImageURI(cache.get(url));
        else
        {
            queuePhoto(url, activity, imageView, scaleSize);
            imageView.setImageResource(stub_id);
        }
    }

    private void queuePhoto(String url, Activity activity, ImageView imageView, int scaleSize)
    {
        //This ImageView may be used for other images before. So there may be some old tasks in the queue. We need to discard them.
        photosQueue.Clean(imageView);
        PhotoToLoad p=new PhotoToLoad(url, imageView, scaleSize);
        synchronized(photosQueue.photosToLoad){
            photosQueue.photosToLoad.push(p);
            photosQueue.photosToLoad.notifyAll();
        }

        //start thread if it's not started yet
        if(photoLoaderThread.getState()==Thread.State.NEW)
            photoLoaderThread.start();
    }
    private Uri getUri(String url, int scaleSize){
        if(url != ""){
            //I identify images by hashcode. Not a perfect solution, good for the demo.
//          try{
            String filename=String.valueOf(url.hashCode());
            File f=new File(cacheDir, filename);

            //from SD cache

            if(f.exists()){
                Uri b = Uri.fromFile(f);
                System.out.println(f.toString());
                return b;
            }

            //from web
            try {
                Uri bitmap=null;
                InputStream is=new URL(url).openStream();
                OutputStream os = new FileOutputStream(f);
                Utils.CopyStream(is, os);
                os.close();
                bitmap = Uri.fromFile(f);
                System.out.println(f.toString());
                return bitmap;
            } catch (Exception ex){
               ex.printStackTrace();
               return null;
            }
            } else {
                return null;
            }
    }

    //Task for the queue
    private class PhotoToLoad
    {
        public String url;
        public ImageView imageView;
        public int scaleSize;
        public PhotoToLoad(String u, ImageView i, int ss){
            url=u;
            imageView=i;
            scaleSize=ss;
        }
    }

    PhotosQueue photosQueue=new PhotosQueue();

    public void stopThread()
    {
        photoLoaderThread.interrupt();
    }

    //stores list of photos to download
    class PhotosQueue
    {
        private Stack<PhotoToLoad> photosToLoad=new Stack<PhotoToLoad>();

        //removes all instances of this ImageView
        public void Clean(ImageView image)
        {
            for(int j=0 ;j<photosToLoad.size();){
                if(photosToLoad.get(j).imageView==image)
                    photosToLoad.remove(j);
                else
                    ++j;
            }
        }
    }

    class PhotosLoader extends Thread {
        public void run() {
            try {
                while(true)
                {
                    //thread waits until there are any images to load in the queue
                    if(photosQueue.photosToLoad.size()==0)
                        synchronized(photosQueue.photosToLoad){
                            photosQueue.photosToLoad.wait();
                        }
                    if(photosQueue.photosToLoad.size()!=0)
                    {
                        PhotoToLoad photoToLoad;
                        synchronized(photosQueue.photosToLoad){
                            photoToLoad=photosQueue.photosToLoad.pop();
                        }
                        Uri bmp=getUri(photoToLoad.url, photoToLoad.scaleSize);
                        cache.put(photoToLoad.url, bmp);
                        if(((String)photoToLoad.imageView.getTag()).equals(photoToLoad.url)){
                            UriDisplayer bd=new UriDisplayer(bmp, photoToLoad.imageView);
                            Activity a=(Activity)photoToLoad.imageView.getContext();
                            a.runOnUiThread(bd);
                        }
                    }
                    if(Thread.interrupted())
                        break;
                }
            } catch (InterruptedException e) {
                //allow thread to exit
            }
        }
    }

    PhotosLoader photoLoaderThread=new PhotosLoader();
    class UriDisplayer implements Runnable
    {
        Uri uri;
        ImageView imageView;
        public UriDisplayer(Uri u, ImageView i){uri=u;imageView=i;}

        public void run() {
            File f = new File(uri.getPath());
            if(f.exists()){
                imageView.setImageURI(uri);
            } else {
                imageView.setImageResource(stub_id);
            }

        }

    }

    public void clearCache() {
        //clear memory cache
        cache.clear();

        //clear SD cache
        File[] files=cacheDir.listFiles();
        for(File f:files)
            f.delete();
    }

}

Here is one of the adapters that implements this ImageLoader:
public class ColorAdapter extends ArrayAdapter<Color> {
    private Activity activity;
    private int resource;
    private String response;
    private Context context;
    public ImageLoader imageLoader;

    public ColorAdapter(Activity a, Context context, int resource, List<Color> items){
        super(context, resource, items);
        this.resource=resource;
        imageLoader=new ImageLoader(context);
        activity = a;

    }

    @Override
    public View getView(int position, View convertView, ViewGroup parent){
        Color color =  getItem(position);
        String minflater = Context.LAYOUT_INFLATER_SERVICE;
        LayoutInflater inflater;
        inflater = (LayoutInflater)getContext().getSystemService(minflater);
        ViewHolder holder;
        if(convertView==null){
            convertView = inflater.inflate(R.layout.listcolors, parent, false);
            holder=new ViewHolder();
            holder.txtName=(TextView)convertView.findViewById(R.id.txtName);
            //holder.txtUser=(TextView)convertView.findViewById(R.id.txtUser);
            holder.imgColorImg=(ImageView)convertView.findViewById(R.id.imgColorImg);

            convertView.setTag(holder);

        }
        else
            holder=(ViewHolder)convertView.getTag();

        holder.txtName.setText(color.getName());
        //holder.txtUser.setText(dock.getUser());
        holder.imgColorImg.setTag(color.getIconURL());
        imageLoader.DisplayImage(color.getIconURL(), activity, holder.imgColorImg, 84);
        return convertView;

    }

    class ViewHolder{
        TextView txtName;
        //TextView txtUser;
        ImageView imgColorImg;
    }

}

A: I had the same problem and it turned out that 2.1 requires saving Uri to strings as uriVaribale.getPath()... example:
String stringUri = imageUri.getPath(); //works
String stringUri = imageUri.toString(); //does not work

i.setImageURI(Uri.parse(stringUri));

When using getPath() it seem to work on all Android OS.

A: SIMPLE FIX.  HERE IS THE SNIPPET I CHANGED
class UriDisplayer implements Runnable {
        public static final String SPINNER_IMAGELOADER = "SPINNER_IMAGELOADER_UriDisplayer";

    Uri uri;
    ImageView imageView;

    public UriDisplayer(Uri u, ImageView i) {
        uri = u;
        imageView = i;
    }

    public void run() {
        Log.d(SPINNER_IMAGELOADER, "rui displayer using uri path: " + uri.getPath());
        File f = new File(uri.getPath());
        Log.d(SPINNER_IMAGELOADER, "file: " + f);
        if (f.exists()) {
            //imageView.setImageURI(uri);
            //FIX DO IT THIS WAY
            imageView.setImageURI(Uri.parse(f.toString()));
        } else {
            imageView.setImageResource(stub_id);
        }

    }

}


text: Q: importing joomla user details into owncloud Based on the way Joomla! creates passwords within the db, is it possible to export user details from Joomla!, such as username, password, email address, and then import them into owncloud db, would this be possible, or are the encoding algorithms different for joomla and owncloud?


text:
Q: How to prove directly from the definition that the complex norm isn't differentiable at any point?
How to prove directly from the definition that the complex norm isn't differentiable at any point?

I used both ways of the definition:
$$\lim_{z\to z_0}\frac{|z|-|z_0|}{z-z_0} \ \text{ and }\ \lim_{h\to 0}\frac{|z_0+h|-|z_0|}{h}$$
but I don't even know how to begin.

A: If $z_0 = 0$, then since $t \mapsto |t|$ is not differentiable at $t=0$ we see that $z \mapsto |z|$ is not differentiable at $z_0=0$ .
If $z_0 \neq 0$ then  we have
$\lim_{r \to0} {|z_0+rz_0| - |z_0| \over r z_0}= {|z_0| \over z_0}$,
$\lim_{r \to0}{|z_0+riz_0| - |z_0| \over r iz_0}= 0$, hence
${|z_0+h| - |z_0| \over h}$ has no limit as $h \to 0$.
Aside: ${|z_0+riz_0| - |z_0| \over r iz_0} = {(|1+ri| - 1)|z_0| \over r iz_0} = {(|1+ri| - 1) \over r } \cdot {|z_0| \over iz_0} = {(\sqrt{1+r^2} - 1) \over r } \cdot {|z_0| \over iz_0} $. Note that ${(\sqrt{1+r^2} - 1) \over r } \to 0$.

A: Consider, for $z\ne0$ and $h\ne0$,
$$
\frac{|z+h|-|z|}{h}=\frac{|z|}{z}\frac{|1+(h/z)|-1}{h/z}
$$
so it's not restrictive to show that
$$
\lim_{h\to0}\frac{|1+h|-1}{h}
$$
doesn't exist. If it exists, then it's the same along every path. For $h$ real we have
$$
\lim_{h\to0}\frac{|1+h|-1}{h}=1
$$
For $h=it$ with $t$ real,
$$
\lim_{t\to0}\frac{|1+it|-1}{it}=
\lim_{t\to0}\frac{\sqrt{1+t^2}-1}{it}=0
$$
Do similarly at $z=0$.

More generally, if $f$ is defined on a region in $\mathbb{C}$ and only assumes real values, it can only be differentiable at points where
$$
\lim_{h\to0}\frac{f(z+h)-f(z)}{h}=0
$$
because the limit must be both real ($h$ approaching $0$ on the real axis) and purely imaginary ($h$ approaching $0$ on the imaginary axis).


text:
Q: Rails 3.1 asset pipeline is not minifying Im upgrading my app to rails31 .. everything works quite ok but i have a problem with the asset pipeline. im using rails3.1.rc5
My js and my css gets combined but not minified..
Im using:
RAILS_ENV=production rake assets:precompile

to precompile the assets..
I have these settings in my production.rb
config.assets.compress = true
config.assets.js_compressor  = :uglifier
config.assets.css_compressor = :scss

The files are combined and get the md5 in the name but they are not minified.
Any help would be appreciated

A: Use this command:
rake RAILS_ENV=production RAILS_GROUP=assets assets:precompile

A: This solved my problem....
http://groups.google.com/group/rubyonrails-core/browse_thread/thread/4bc7bac8b295b3aa


text:
Q: Products/Items are not being added in the Cart in Django. How do I fix it? I am new to Django and working on an ecommerce app. I have defined the products and users things. But I am stuck at the cart.
I have basically two apps in my project viz. index and cart. I have defined TwoPieceSuit() as a products' model in index.models.py and I have defined Cart() & CartManager() (just to manage cart properly if an anonymous user logs in the web, after adding the products in cart) in cart.models.py.
I have defined two_piece_suits, an attribute in cart.models.Cart as a ManyToManyField referenced to index.models.TwoPieceSuit. Now it basically works all the way, until I want to add up the price(s) of TwoPieceSuit() instances and save the result in total of Cart(), it does not add up the prices. Despite of Cart() instance having many (because of ManyToManyField) instances of TwoPieceSuit() containing the values in price attribute, it does not add up the prices when I call them to be added in my cart.models.py.
My index.models.py is:
import os
from django.db import models
from django.utils.text import slugify

def get_file_ext(filepath):
    base_name = os.path.basename(filepath)
    name, ext = os.path.splitext(base_name)
    return name, ext

def upload_image_path(instance, filepath):
    name, ext = get_file_ext(filepath)
    filename = instance.fabric + '-' + instance.lining + '-' + instance.buttons + '-' + \
            instance.button_hole_thread + '-' + instance.buttoning + '-' + instance.lapel + '-' + \
                instance.pockets + '-' + instance.vent + '-' + instance.contrasts + '-' + \
                    instance.trouser_pockets + '-' + instance.trouser_buttoning + '-' + \
                        instance.trouser_back_pocket + '-' + instance.trouser_turn_up + ext
    return "products/{filename}".format(filename=filename)

# Create your models here.

class Fabric(models.Model):
    title = models.CharField(max_length = 100, verbose_name = "Title")
    img = models.FileField(upload_to = 'fabrics/', null = True, verbose_name = "Picture")

    def __str__(self):
        return f"{self.title}"

class Lining(models.Model):
    title = models.CharField(max_length = 100, verbose_name = "Title")
    img = models.FileField(upload_to = 'linings/', null = True, verbose_name = "Picture")

    def __str__(self):
        return f"{self.title}"

class Button(models.Model):
    title = models.CharField(max_length = 100, verbose_name = "Title")
    img = models.FileField(upload_to = 'buttons/', null = True, verbose_name = "Picture")

    def __str__(self):
        return f"{self.title}"

class ButtonHoleThread(models.Model):
    title = models.CharField(max_length = 100, verbose_name = "Title")
    img = models.FileField(upload_to = 'button-hole-threads/', null = True, verbose_name = "Picture")

    def __str__(self):
        return f"{self.title}"

class Buttoning(models.Model):
    title = models.CharField(max_length = 100, verbose_name = "Title")
    img = models.FileField(upload_to = 'buttonings/', null = True, verbose_name = "Picture")

    def __str__(self):
        return f"{self.title}"

class Lapel(models.Model):
    title = models.CharField(max_length = 100, verbose_name = "Title")
    img = models.FileField(upload_to = 'lapels/', null = True, verbose_name = "Picture")

    def __str__(self):
        return f"{self.title}"

class Pocket(models.Model):
    title = models.CharField(max_length = 100, verbose_name = "Title")
    img = models.FileField(upload_to = 'pockets/', null = True, verbose_name = "Picture")

    def __str__(self):
        return f"{self.title}"

class Vent(models.Model):
    title = models.CharField(max_length = 100, verbose_name = "Title")
    img = models.FileField(upload_to = 'vents/', null = True, verbose_name = "Picture")

    def __str__(self):
        return f"{self.title}"

class Contrast(models.Model):
    title = models.CharField(max_length = 100, verbose_name = "Title")
    img = models.FileField(upload_to = 'contrasts/', null = True, verbose_name = "Picture")

    def __str__(self):
        return f"{self.title}"

class TrouserPocket(models.Model):
    title = models.CharField(max_length = 100, verbose_name = "Title")
    img = models.FileField(upload_to = 'trouser-pockets/', null = True, verbose_name = "Picture")

    def __str__(self):
        return f"{self.title}"

class TrouserButtoning(models.Model):
    title = models.CharField(max_length = 100, verbose_name = "Title")
    img = models.FileField(upload_to = 'trouser-buttonings/', null = True, verbose_name = "Picture")

    def __str__(self):
        return f"{self.title}"

class TrouserBackPocket(models.Model):
    title = models.CharField(max_length = 100, verbose_name = "Title")
    img = models.FileField(upload_to = 'trouser-back-pockets/', null = True, verbose_name = "Picture")

    def __str__(self):
        return f"{self.title}"

class TrouserTurnUp(models.Model):
    title = models.CharField(max_length = 100, verbose_name = "Title")
    img = models.FileField(upload_to = 'trouser-turn-ups/', null = True, verbose_name = "Picture")

    def __str__(self):
        return f"{self.title}"

FABRICS = []
LININGS = []
BUTTONS = []
BUTTON_HOLE_THREADS = []
BUTTONINGS = []
LAPELS = []
POCKETS = []
VENTS = []
CONTRASTS = []
TROUSER_POCKETS = []
TROUSER_BUTTONINGS = []
TROUSER_BACK_POCKETS = []
TROUSER_TURN_UPS = []

for item in Fabric.objects.all():
    FABRICS.append((item.title.lower(), item.title))

FABRICS = tuple(FABRICS)

for item in Lining.objects.all():
    LININGS.append((item.title.lower(), item.title))

LININGS = tuple(LININGS)

for item in Button.objects.all():
    BUTTONS.append((item.title.lower(), item.title))

BUTTONS = tuple(BUTTONS)

for item in ButtonHoleThread.objects.all():
    BUTTON_HOLE_THREADS.append((item.title.lower(), item.title))

BUTTON_HOLE_THREADS = tuple(BUTTON_HOLE_THREADS)

for item in Buttoning.objects.all():
    BUTTONINGS.append((item.title.lower(), item.title))

BUTTONINGS = tuple(BUTTONINGS)

for item in Lapel.objects.all():
    LAPELS.append((item.title.lower(), item.title))

LAPELS = tuple(LAPELS)

for item in Pocket.objects.all():
    POCKETS.append((item.title.lower(), item.title))

POCKETS = tuple(POCKETS)

for item in Vent.objects.all():
    VENTS.append((item.title.lower(), item.title))

VENTS = tuple(VENTS)

for item in Contrast.objects.all():
    CONTRASTS.append((item.title.lower(), item.title))

CONTRASTS = tuple(CONTRASTS)

for item in TrouserPocket.objects.all():
    TROUSER_POCKETS.append((item.title.lower(), item.title))

TROUSER_POCKETS = tuple(TROUSER_POCKETS)

for item in TrouserButtoning.objects.all():
    TROUSER_BUTTONINGS.append((item.title.lower(), item.title))

TROUSER_BUTTONINGS = tuple(TROUSER_BUTTONINGS)

for item in TrouserBackPocket.objects.all():
    TROUSER_BACK_POCKETS.append((item.title.lower(), item.title))

TROUSER_BACK_POCKETS = tuple(TROUSER_BACK_POCKETS)

for item in TrouserTurnUp.objects.all():
    TROUSER_TURN_UPS.append((item.title.lower(), item.title))

TROUSER_TURN_UPS = tuple(TROUSER_TURN_UPS)

class TwoPieceSuit(models.Model):
    title = models.CharField(max_length = 100, verbose_name = "Title")
    img = models.FileField(upload_to = upload_image_path, null = True, \
        verbose_name = "Picture")
    fabric = models.CharField(max_length = 100, choices = FABRICS, \
        null = True)
    lining = models.CharField(max_length = 100, choices = LININGS, \
        null = True)
    buttons = models.CharField(max_length = 100, choices = BUTTONS, \
        null = True)
    button_hole_thread = models.CharField(max_length = 100, \
        choices = BUTTON_HOLE_THREADS, null = True, \
            verbose_name = "Button Hole Threads")
    buttoning = models.CharField(max_length = 100, \
        choices = BUTTONINGS, null = True)
    lapel = models.CharField(max_length = 100, choices = LAPELS, \
        null = True)
    pockets = models.CharField(max_length = 100, choices = POCKETS, \
        null = True)
    vent = models.CharField(max_length = 100, choices = VENTS, \
        null = True)
    contrasts = models.CharField(max_length = 100, choices = CONTRASTS, \
        null = True)
    trouser_pockets = models.CharField(max_length = 100, \
        choices = TROUSER_POCKETS, null = True, \
            verbose_name = "Trouser Pockets")
    trouser_buttoning = models.CharField(max_length = 100, \
        choices = TROUSER_BUTTONINGS, null = True, \
            verbose_name = "Trouser Buttoning")
    trouser_back_pocket = models.CharField(max_length = 100, \
        choices = TROUSER_BACK_POCKETS, null = True, \
            verbose_name = "Trouser Back Pocket")
    trouser_turn_up = models.CharField(max_length = 100, \
        choices = TROUSER_TURN_UPS, null = True, \
            verbose_name = "Trouser Turn Up")
    price = models.DecimalField(decimal_places = 2, max_digits = 20, default = 99.99)
    slug = models.SlugField(null = True, blank = True, db_index = True)

    def save(self, *args, **kwargs):
        self.slug = slugify(self.fabric + self.lining + self.buttons + \
            self.button_hole_thread + self.buttoning + self.lapel + \
                self.pockets + self.vent + self.contrasts + \
                    self.trouser_pockets + self.trouser_buttoning + \
                        self.trouser_back_pocket + self.trouser_turn_up)
        super().save(*args, **kwargs)

    def __str__(self):
        return f"{self.title}"

My cart.models.py is
from django.conf import settings
from django.db import models
from index.models import TwoPieceSuit

User = settings.AUTH_USER_MODEL

# Create your models here.
class CartManager(models.Manager):
    def new_or_get(self, request):
        cart_id = request.session.get("cart_id", None)
        qs = self.get_queryset().filter(id = cart_id)

        if qs.count() == 1:
            new_obj = False
            cart_obj = qs.first()
            if request.user.is_authenticated and cart_obj.user is None:
                cart_obj.user = request.user
                cart_obj.save()
        else:
            cart_obj = Cart.objects.new(user = request.user)
            new_obj = True
            request.session["cart_id"] = cart_obj.id

        return cart_obj, new_obj

    def new(self, user = None):
        user_obj = None
        if user is not None:
            if user.is_authenticated:
                user_obj = user
        return self.model.objects.create(user = user_obj)

class Cart(models.Model):
    user = models.ForeignKey(User, null = True, blank = True, on_delete = models.CASCADE)
    two_piece_suits = models.ManyToManyField(TwoPieceSuit, blank = True)
    total = models.DecimalField(default = 00.00, max_digits = 100, decimal_places = 2)
    updated = models.DateTimeField(auto_now = True)
    timestamp = models.DateTimeField(auto_now_add = True)

    objects = CartManager()

    def __str__(self):
        return str(self.id)

My cart.views.py is:
from django.shortcuts import render
from .models import Cart, CartManager

# Create your views here.
def cart_home(request):
    cart_obj, new_obj = Cart.objects.new_or_get(request)
    print(cart_obj.two_piece_suits)
    two_piece_suits = cart_obj.two_piece_suits.all()
    total = 0

    for item in two_piece_suits:
        print(item)
        print(item.price)
        total = total + item.price

    cart_obj.total = total
    cart_obj.save()

    return render(request, "cart/home.html", {})

Also, the screenshot that explains I have added the TwoPieceSuit() instances in the Cart() instance, using Django Administration Interface, is below:
enter image description here
I will really appreciate if somebody helps, as I am tired of working it around.

A: I figured out to solve my issue by looking at the official documentation, given below:
The Django admin site | Django documentation | Django
Model field reference | Django documentation | Django
Related objects reference | Django documentation | Django
and after doing a little more research I found a way to add the TwoPieceSuit instances in the cart using from django.db.models.signals. I would like to share the code so that whoever read this thread, might find it useful.
I don't know if it is a good way, because I did it indirectly. I actually defined a pre_save_cart_receiver() method and then connected it to m2m_changed signal by passing Cart model as sender. Now whenever I click any TwoPieceSuit instance in the Cart table in Django Administration Interface and click 'Save and Continue Editing', it actually updates the total attribute of the cart.
Below is the code for pre_save_cart_receiver():
from django.db.models.signals import m2m_changed

def pre_save_cart_receiver(sender, instance, action, *args, **kwargs):
    if action == "post_add" or action == "post_remove" or action == "post_clear":
        two_piece_suits = instance.two_piece_suits.all()
        total = 0

        for item in two_piece_suits:
            total = total + item.price

        instance.total = total
        instance.save()

m2m_changed.connect(pre_save_cart_receiver, sender=Cart.two_piece_suits.through)


text:
Q: Vue child component not displaying dynamic data on first page load Given the code below, my child component alerts trigger before any of the code in the Parent mounted function.
As a result it appears the child has already finished initialization before the data is ready and therefor won't display the data until it is reloaded.
The data itself comes back fine from the API as the raw JSON displays inside the v-card in the layout.
My question is how can I make sure the data requested in the Parent is ready BEFORE the child component loads? Anything I have found focuses on static data passed in using props, but it seems this completely fails when the data must be fetched first.
Inside the mounted() of the Parent I have this code which is retrieves the data.
const promisesArray = [this.loadPrivate(),this.loadPublic()]
      await Promise.all(promisesArray).then(() => {
      console.log('DATA ...') // fires after the log in Notes component
      this.checkAttendanceForPreviousTwoWeeks().then(()=>{
        this.getCurrentParticipants().then((results) => {
                  this.currentP = results
                  this.notesArr = this.notes // see getter below
        })

The getter that retrieves the data in the parent
  get notes() {
    const newNotes = eventsModule.getNotes
    return newNotes
  }

My component in the parent template:
<v-card light elevation="">
    {{ notes }} // Raw JSON displays correctly here
   // Passing the dynamic data to the component via prop
   <Notes v-if="notes.length" :notesArr="notes"/>
</v-card>

The Child component:
...
  // Pickingn up prop passed to child
  @Prop({ type: Array, required: true })
      notesArr!: object[]

  constructor()
    {
      super();
      alert(`Notes : ${this.notesArr}`) // nothing here
      this.getNotes(this.notesArr)
    }

 async getNotes(eventNotes){
    // THIS ALERT FIRES BEFORE PROMISES IN PARENT ARE COMPLETED
    alert(`Notes.getNotes CALL.. ${eventNotes}`) // eventNotes = undefined
    this.eventChanges = await eventNotes.map(note => {
      return {
        eventInfo: {
          name: note.name,
          group: note.groupNo || null,
          date: note.displayDate,
        },
        note: note.noteToPresenter
      }
    })
  }
...

I am relatively new to Vue so forgive me if I am overlooking something basic. I have been trying to fix it for a couple of days now and can't figure it out so any help is much appreciated!

A: If you are new to Vue, I really recommend reading the entire documentation of it and the tools you are using - vue-class-component (which is Vue plugin adding API for declaring Vue components as classes)

*

*Caveats of Class Component - Always use lifecycle hooks instead of constructor
So instead of using constructor() you should move your code to created() lifecycle hook
This should be enough to fix your code in this case BUT only because the usage of the Notes component is guarded by v-if="notes.length" in the Parent - the component will get created only after notes is not empty array
This is not enough in many cases!

*created() lifecycle hook (and data() function/hook) is executed only once for each component. The code inside is one time initialization. So when/if parent component changes the content of notesArr prop (sometimes in the future), the eventChanges will not get updated. Even if you know that parent will never update the prop, note that for performance reasons Vue tend to reuse existing component instances when possible when rendering lists with v-for or switching between components of the same type with v-if/v-else - instead of destroying existing and creating new components, Vue just updates the props. App suddenly looks broken for no reason...

This is a mistake many unexperienced users do. You can find many questions here on SO like "my component is not reactive" or "how to force my component re-render" with many answers suggesting using :key hack or using a watcher ....which sometimes work but is almost always much more complicated then the right solution
Right solution is to write your components (if you can - sometimes it is not possible) as pure components (article is for React but the principles still apply). Very important tool for achieving this in Vue are computed propeties
So instead of introducing eventChanges data property (which might or might not be reactive - this is not clear from your code), you should make it computed property which is using notesArr prop directly:
get eventChanges() {
   return this.notesArr.map(note => {
     return {
       eventInfo: {
         name: note.name,
         group: note.groupNo || null,
         date: note.displayDate,
       },
       note: note.noteToPresenter
     }
   })
}

Now whenever notesArr prop is changed by the parent, eventChanges is updated and the component will re-render
Notes:

*

*You are overusing async. Your getNotes function does not execute any asynchronous code so just remove it.

*also do not mix async and then - it is confusing

Either:
const promisesArray = [this.loadPrivate(),this.loadPublic()]
await Promise.all(promisesArray)
await this.checkAttendanceForPreviousTwoWeeks()
const results = await this.getCurrentParticipants()
this.currentP = results
this.notesArr = this.notes

or:
const promisesArray = [this.loadPrivate(),this.loadPublic()]
Promise.all(promisesArray)
  .then(() => this.checkAttendanceForPreviousTwoWeeks())
  .then(() => this.getCurrentParticipants())
  .then((results) => {
    this.currentP = results
    this.notesArr = this.notes
  })

Great learning resource


text:
Q: How to Choose When to Hyphenate, Maybe, Two Nouns
No vehicular stand still ever made him late, for work.

or,

No vehicular stand-still ever made him late, for work.

Which may you choose, as proper, and grammatical English grammar?

A: Standstill is a standalone word; hyphenation is irrelevant.

No vehicular standstill ever made him late, for work.


text:
Q: Refinery CMS + devise_cas_authenticatable I am trying to figure out how to add CAS authentication to Refinery.  The best arrangement I have found so far is to use devise_cas_authenticatable.
I used rake refinery:override model=user and replaced :database_authenticatable:
# /app/models/refinery/user.rb
if self.respond_to?(:devise)
  devise :cas_authenticatable, ...
end

But I can't find where to set the CAS configuration values, e.g.:
Devise.setup do |config|
  ...
  config.cas_base_url = "https://cas.myorganization.com"
  ...
end

Does anyone know if there is an existing initializer where this belongs?  Also, any thoughts on the task of making Refinery work with CAS would be helpful.  Thanks!

A: Set the CAS configuration values in a Rails initializer, e.g.
$ cat config/initializers/devise.rb

Devise.setup do |config|
  config.cas_base_url = "https://cas.myorganization.com"

  # you can override these if you need to, but cas_base_url is usually enough
  # config.cas_login_url = "https://cas.myorganization.com/login"
  # config.cas_logout_url = "https://cas.myorganization.com/logout"
  # config.cas_validate_url = "https://cas.myorganization.com/serviceValidate"

  # The CAS specification allows for the passing of a follow URL to be displayed when
  # a user logs out on the CAS server. RubyCAS-Server also supports redirecting to a
  # URL via the destination param. Set either of these urls and specify either nil,
  # 'destination' or 'follow' as the logout_url_param. If the urls are blank but
  # logout_url_param is set, a default will be detected for the service.
  # config.cas_destination_url = 'https://cas.myorganization.com'
  # config.cas_follow_url = 'https://cas.myorganization.com'
  # config.cas_logout_url_param = nil

  # By default, devise_cas_authenticatable will create users.  If you would rather
  # require user records to already exist locally before they can authenticate via
  # CAS, uncomment the following line.
  # config.cas_create_user = false
end


text:
Q: How to select tags by attribute value with Beautiful Soup I have the following HTML fragment:
>>> a

 my text

I am trying to select header column only if attribute data-name="result-name"
I've tried:
>>> a.select('a["data-name="result-name""]')

This gives:
ValueError: Unsupported or invalid CSS selector:

How can I get this working?

A: html = """

 my text

"""

from bs4 import BeautifulSoup
soup = BeautifulSoup(html)
for d in soup.findAll("div",{"class":"headercolumn"}):
    print d.a.get("data-name")
    print d.select("a.results")

result-name
[]

A: select classes or ids
soup.select('a.gamers') # select an `a` tag with the class gamers
soup.select('a#gamer') # select an `a` tag with the id gamer

select single attr:
soup.select('a[attr="value"]')

select multiple attr:
attr_dict = {
             'attr1': 'val1',
             'attr2': 'val2',
             'attr3': 'val3'
            }

soup.findAll('a', attr_dict)

you can use any CSS selector in soup.select

A: You can simply do this :
soup = BeautifulSoup(html)
results = soup.findAll("a", {"data-name" : "result-name"})

Source : How to find tags with only certain attributes - BeautifulSoup


text:
Q: Getting error by using Queue[] queues = new Queue[10]; This is my code:
import java.util.*;
import unit4.collectionsLib.*;

public class Page255Project_class
{
    static Scanner reader = new Scanner (System.in);

    /**
     * @param args
     */
    public static void radixSort(int[] numbers){
        Queue[] queues = new Queue[10];
        for(int i=0; i<numbers.length; i++){
            if(numbers[i]%10 == i)
            {
                queues[i].insert(numbers[i]);
                System.out.println(queues[i]);
            }
        }
    }

    public static void main(String[] args)
    {
        int[] numbers = new int[10];

        numbers[0] = 170;
        numbers[1] = 45;
        numbers[2] = 75;
        numbers[3] = 90;
        numbers[4] = 2;
        numbers[5] = 24;
        numbers[6] = 802;

        radixSort(numbers);
    }
}

And I'm getting this error:
Exception in thread "main" java.lang.NullPointerException
    at Page255Project_class.radixSort(Page255Project_class.java:15)
    at Page255Project_class.main(Page255Project_class.java:33)

Please help to solve that error

A: In your function radixSort you have defined array of size 10 holds 10 "empty slots", but you forgot to initialize all of the slots.
The change in your code will be like the following:
public static void radixSort(int[] numbers) {
    Queue[] queues = new Queue[10];
    Arrays.fill(queues, new Queue()); // Queue is interface you need to implement it
                                      // or you need to choose specific type of
                                      // queues [PriorityQueue, LinkedBlockingQueue, ...]
    for(int i = 0; i < numbers.length; i++) {
        if(numbers[i] % 10 == i) {
            queues[i].insert(numbers[i]);
            System.out.println(queues[i]);
        }
    }
}


text:
Q: Can't change any text on my xcode project from storyboard I Created an iOS App Before and now I wanted to change All the texts to another language.
I changed everything from Storyboard but when i run the app on Simulation, the previous version of app comes up and there is no change! Even when I changed the location of my project, still there were no changes !
Just PNG and JPG files changed.
My Xcode is 7.3.1
My OSX is 10.11.5


text:
Q: Composite black hole structures Could a system of black holes form a "black" structure that has physical dimensions? For instance, could a series of black holes in the same orbit around an object form a black torus?

A: In 4D General Relativity there are uniqueness theorems that prove the No Hair conjecture for stationary, axially symmetric electrovac Black Holes.
That is, that in vacuum the only solution possible is the Kerr Newman solution, with only mass, angular momentum and charge as parameters (and the spherically symmetric Schwarzschild solution is a special case with no angular momentum nor charge). There are some constraints such as asymptotic flatness. A magnetic charge turns out is also allowed, though not physical. This was arrived at through a lot of work in proving the uniqueness while insuring that some strange conditions (such as multiply connected horizons) don't affect the proofs, mainly for the rotating case (Israel provide it for the spherically symmetric case early, it was harder with rotation)9999
See  http://relativity.livingreviews.org/open?pubNo=lrr-1998-6&page=articlesu6.html.
But also see the review in https://nms.kcl.ac.uk/david.robinson/web_page/blackholes.pdf for other additional treatment for Black Holes in higher dimensions and with various matter fields.
For instance it is known that in 5D the Kerr Newman solutions are not unique as the only Black Holes possible. Also, it is known that for instance a Yang Mills field in General Relativity will also allow other, non Kerr Newman solutions. Work continues on finding different Black Hole solutions, including those from string theory, gauge theories, and with thermodynamics considerations due to the findings that the entropy is found in the horizons. I presume that Fletcher's hyper-toroid is one of those though I've not read the specific paper.
Needless to say most astrophysical work on Black Holes uses the Kerr Newman solution for the stationary or equilibrium Black Hole, and uses a perturbation formalism for the accretion of matter or other fields. That of course doesn't work in the strong gravity case such as for colliding or merging  Black Holes, but of course the entropy theorems of Hawking for Black Hole thermodynamics allows you to treat the equilibrium states after the collisions or mergers. Numerical techniques were also used in analyzing the strong gravity phases of the Black Hole mergers seen by LIGO and announced in 2016.
The construction of gravitational wave interferometers will allow for better measurements on the next set of detections, with more accurate location of the events and also a wider frequency range. But we should be able to see inside neutron stars and tighter in and further out on mergers. It'll still have to wait for the space based interferometer planned for the 2020's (and funding dependent) for the large baselines needed to detect lower frequency, higher wavelength gravitational waves from the early universe, and large structures like galactic center and possible cosmological anomalies, and allow us to see behind the age of recombination 380,000 years after the Big Bang.

A: I have no expertise in this area, but it seems to me that a such collapse into a ring would be highly unstable, similar to Rayleigh-Taylor instability in fluid dynamics. The slightest perturbation would increase the deviation from symmetry exponentially, triggering the ring to break up into individual black holes, which may subsequently merge to form a small number of large black holes.
So while a black torus might be an ideal mathematical solution to the GR equations (or whatever equations are being used), I think it is likely to be virtually impossible in reality. Like balancing a pencil on its sharpened point : perfectly possible in theory, practically impossible in real life.


text:
Q: A table-cell is spanning more rows than available in its parent element I am trying to track down the following error in my fo file [*]. Since there is no context in the error message I do not understand how I am supposed to search for the root issue.
The fo file has been generated from a proper (at least per XSD validation) docbook 5 file, but the generated fo file is not correct:
$ xmllint --nonet --noout --schema /usr/share/xml/docbook/schema/xsd/5.0/docbook.xsd source/docbook/part02/part02.xml
source/docbook/part02/part02.xml validates

How would one search the root issue (docbook level) from an input 3.2M XML-FO file ?
$ du -sh bla.fo
3.2M    bla.fo

[*]
$ fop -d bla.fo bla.pdf
[ERROR] FOP - Exception <org.apache.fop.apps.FOPException: org.apache.fop.fo.ValidationException: A table-cell is spanning more rows than available in its parent element.
javax.xml.transform.TransformerException: org.apache.fop.fo.ValidationException: A table-cell is spanning more rows than available in its parent element.>org.apache.fop.apps.FOPException: org.apache.fop.fo.ValidationException: A table-cell is spanning more rows than available in its parent element.
javax.xml.transform.TransformerException: org.apache.fop.fo.ValidationException: A table-cell is spanning more rows than available in its parent element.
    at org.apache.fop.cli.InputHandler.transformTo(InputHandler.java:288)
    at org.apache.fop.cli.InputHandler.renderTo(InputHandler.java:115)
    at org.apache.fop.cli.Main.startFOP(Main.java:186)
    at org.apache.fop.cli.Main.main(Main.java:217)
Caused by: javax.xml.transform.TransformerException: org.apache.fop.fo.ValidationException: A table-cell is spanning more rows than available in its parent element.
    at org.apache.xalan.transformer.TransformerIdentityImpl.transform(TransformerIdentityImpl.java:502)
    at org.apache.fop.cli.InputHandler.transformTo(InputHandler.java:285)
    ... 3 more
Caused by: org.apache.fop.fo.ValidationException: A table-cell is spanning more rows than available in its parent element.
    at org.apache.fop.fo.flow.table.FixedColRowGroupBuilder.endTablePart(FixedColRowGroupBuilder.java:183)
    at org.apache.fop.fo.flow.table.VariableColRowGroupBuilder$6.play(VariableColRowGroupBuilder.java:107)
    at org.apache.fop.fo.flow.table.VariableColRowGroupBuilder.endTable(VariableColRowGroupBuilder.java:116)
    at org.apache.fop.fo.flow.table.Table.finalizeNode(Table.java:260)
    at org.apache.fop.fo.FONode.endOfNode(FONode.java:330)
    at org.apache.fop.fo.flow.table.Table.endOfNode(Table.java:243)
    at org.apache.fop.fo.FOTreeBuilder$MainFOHandler.endElement(FOTreeBuilder.java:360)
    at org.apache.fop.fo.FOTreeBuilder.endElement(FOTreeBuilder.java:190)
    at org.apache.xalan.transformer.TransformerIdentityImpl.endElement(TransformerIdentityImpl.java:1102)
    at org.apache.xerces.parsers.AbstractSAXParser.endElement(Unknown Source)
    at org.apache.xerces.xinclude.XIncludeHandler.endElement(Unknown Source)
    at org.apache.xerces.impl.XMLNSDocumentScannerImpl.scanEndElement(Unknown Source)
    at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(Unknown Source)
    at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source)
    at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
    at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
    at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
    at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source)
    at org.apache.xerces.jaxp.SAXParserImpl$JAXPSAXParser.parse(Unknown Source)
    at org.apache.xalan.transformer.TransformerIdentityImpl.transform(TransformerIdentityImpl.java:485)
    ... 4 more

---------

javax.xml.transform.TransformerException: org.apache.fop.fo.ValidationException: A table-cell is spanning more rows than available in its parent element.
    at org.apache.xalan.transformer.TransformerIdentityImpl.transform(TransformerIdentityImpl.java:502)
    at org.apache.fop.cli.InputHandler.transformTo(InputHandler.java:285)
    at org.apache.fop.cli.InputHandler.renderTo(InputHandler.java:115)
    at org.apache.fop.cli.Main.startFOP(Main.java:186)
    at org.apache.fop.cli.Main.main(Main.java:217)
Caused by: org.apache.fop.fo.ValidationException: A table-cell is spanning more rows than available in its parent element.
    at org.apache.fop.fo.flow.table.FixedColRowGroupBuilder.endTablePart(FixedColRowGroupBuilder.java:183)
    at org.apache.fop.fo.flow.table.VariableColRowGroupBuilder$6.play(VariableColRowGroupBuilder.java:107)
    at org.apache.fop.fo.flow.table.VariableColRowGroupBuilder.endTable(VariableColRowGroupBuilder.java:116)
    at org.apache.fop.fo.flow.table.Table.finalizeNode(Table.java:260)
    at org.apache.fop.fo.FONode.endOfNode(FONode.java:330)
    at org.apache.fop.fo.flow.table.Table.endOfNode(Table.java:243)
    at org.apache.fop.fo.FOTreeBuilder$MainFOHandler.endElement(FOTreeBuilder.java:360)
    at org.apache.fop.fo.FOTreeBuilder.endElement(FOTreeBuilder.java:190)
    at org.apache.xalan.transformer.TransformerIdentityImpl.endElement(TransformerIdentityImpl.java:1102)
    at org.apache.xerces.parsers.AbstractSAXParser.endElement(Unknown Source)
    at org.apache.xerces.xinclude.XIncludeHandler.endElement(Unknown Source)
    at org.apache.xerces.impl.XMLNSDocumentScannerImpl.scanEndElement(Unknown Source)
    at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(Unknown Source)
    at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source)
    at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
    at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
    at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
    at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source)
    at org.apache.xerces.jaxp.SAXParserImpl$JAXPSAXParser.parse(Unknown Source)
    at org.apache.xalan.transformer.TransformerIdentityImpl.transform(TransformerIdentityImpl.java:485)
    ... 4 more
---------
org.apache.fop.fo.ValidationException: A table-cell is spanning more rows than available in its parent element.
    at org.apache.fop.fo.flow.table.FixedColRowGroupBuilder.endTablePart(FixedColRowGroupBuilder.java:183)
    at org.apache.fop.fo.flow.table.VariableColRowGroupBuilder$6.play(VariableColRowGroupBuilder.java:107)
    at org.apache.fop.fo.flow.table.VariableColRowGroupBuilder.endTable(VariableColRowGroupBuilder.java:116)
    at org.apache.fop.fo.flow.table.Table.finalizeNode(Table.java:260)
    at org.apache.fop.fo.FONode.endOfNode(FONode.java:330)
    at org.apache.fop.fo.flow.table.Table.endOfNode(Table.java:243)
    at org.apache.fop.fo.FOTreeBuilder$MainFOHandler.endElement(FOTreeBuilder.java:360)
    at org.apache.fop.fo.FOTreeBuilder.endElement(FOTreeBuilder.java:190)
    at org.apache.xalan.transformer.TransformerIdentityImpl.endElement(TransformerIdentityImpl.java:1102)
    at org.apache.xerces.parsers.AbstractSAXParser.endElement(Unknown Source)
    at org.apache.xerces.xinclude.XIncludeHandler.endElement(Unknown Source)
    at org.apache.xerces.impl.XMLNSDocumentScannerImpl.scanEndElement(Unknown Source)
    at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(Unknown Source)
    at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source)
    at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
    at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
    at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
    at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source)
    at org.apache.xerces.jaxp.SAXParserImpl$JAXPSAXParser.parse(Unknown Source)
    at org.apache.xalan.transformer.TransformerIdentityImpl.transform(TransformerIdentityImpl.java:485)
    at org.apache.fop.cli.InputHandler.transformTo(InputHandler.java:285)
    at org.apache.fop.cli.InputHandler.renderTo(InputHandler.java:115)
    at org.apache.fop.cli.Main.startFOP(Main.java:186)
    at org.apache.fop.cli.Main.main(Main.java:217)

A: Try validating your DocBook XML using oXygen XML Editor 18.1.  According to the oXygen folks, it has improved DocBook table validation: https://lists.oasis-open.org/archives/docbook-apps/201611/msg00044.html


text:
Q: Ubuntu not showing in the grub boot loader after installation I installed ubuntu 11.04 alongside windows 7 on a partition that previously had ubuntu 10.04. It installed perfectly but on completion, after the reboot, the boot menu shows just 'memtest' and windows 7 as options - no option for loading ubuntu.

A: (I expect this question will be moved to Ask Ubuntu, but I'll throw this answer on while we wait).
First, boot to a live cd to make sure your installed Ubuntu partition is still there (I fully expect it to be).
Second, (assuming the 1st step showed you that you still have an Ubuntu install) look at your partition table and your grub.conf file - make sure it's the grub.conf file of your installed system, not the live cd :)  You may just have to manually write in the line for your Ubuntu partition.  It's odd that the generated grub.conf file would be broken.

A: On the bootloader, type "c". Then type:
title [x]
root (hd[y],[z])
makeactive
chainloader +1

Replace [x] with the visible name (like 'Ubuntu 11.04'), [y] with the hard drive number (probably 0), and [z] with the partition (probably 3).

A: In case you have more than one hard drives, you could have installed the new bootloader on the other (or one of the others, if you have more than two) drive. Changing the boot device priority can grant you access to that bootloader.
If that is not the problem, you should try restoring grub following this tutorial
http://ubuntuguide.net/how-to-restore-grub-2-after-reinstalling-windows-xpvistawin7
(i know that its title says "after installing windows" but , of course, the steps used there are just as good for reinstalling grub after any problem)

A: If you've got a live CD, you can try the following command out in the terminal after choosing Trying Ubuntu:
sudo apt-get install grub  //firstly install grub
sudo grub  //launch it
find /boot/grub/menu.lst
root (hdx,y) //this depends on where you install you ubuntu
setup (hdx) //now install the grub into the mbr
quit
restart
if you load into the grub prompt
root (hdx,y)
kernel /boot/vmlinuz--generic ro root=/dev/sda7 //sda7=(hd0,6), replace it with your own
initrd /boot/initrd.img--generic
boot
no need to remember the kernel version, just use tab to help you
I've just done this to dual boot my win7 (on sda1) and ubuntu 11.04 (on sda5)
It will be helpful if you post your /boot/grub/menu.lst here.
Well, without the Live CD try to search for grub4dos to boot ubuntu with the windows bootloader


text:
Q: ngx-gallery not displaying left-right arrow over image in Angular I am using ngx-gallery to display an image gallery. Although I set the display image arrow property to be true, I can't see the arrows in the image.
I am using Angular 7. This is my gallery.ts file code:
 galleryOptions: NgxGalleryOptions[];
  galleryImages: NgxGalleryImage[];

  ngOnInit(): void {

      this.galleryOptions = [
          {
              'previewCloseOnEsc': true,
              'previewKeyboardNavigation': true,
              'imageBullets': true,
              'imageAutoPlay': true,
              width: '100%',
              height: '400px',
              thumbnailsColumns: 4,
              imageAnimation: NgxGalleryAnimation.Slide
          },
          // max-width 800
          {
              breakpoint: 800,
              width: '100%',
              height: '600px',
              imagePercent: 90,
              thumbnailsPercent: 10,
              thumbnailsMargin: 20,
              thumbnailMargin: 20
          },
          // max-width 400
          {
              breakpoint: 400,
              preview: false
          }
      ];

      this.galleryImages = [
          {
              small: 'assets/1-small.png',
              medium: 'assets/1-medium.png',
              big: 'assets/1-big.png'
          },
          {
              small: 'assets/2-small.png',
              medium: 'assets/2-medium.png',
              big: 'assets/2-big.png'
          },
          {
              small: 'assets/3-small.png',
              medium: 'assets/3-medium.png',
              big: 'assets/3-big.png'
          },
          {
            small: 'assets/4-small.png',
            medium: 'assets/4-medium.png',
            big: 'assets/4-big.png'
        }
      ];
  }

I have also changed the css as described in some forum:
ngx-gallery /deep/ ngx-gallery-image .ngx-gallery-arrow {
  background-color: orangered;
}
ngx-gallery /deep/ ngx-gallery-thumbnails .ngx-gallery-arrow {
  background-color: orangered;
}
ngx-gallery /deep/ ngx-gallery-preview .ngx-gallery-arrow {
  background-color: orangered;
}

This is my gallery.html code
<ngx-gallery [options]="galleryOptions" [images]="galleryImages"></ngx-gallery>

A: ngx-gallery needs font awesome to display left-right arrow icon. Try including them in your angular-cli.json file. according to their documentation you can include them like this
"styles": [
...
"../node_modules/font-awesome/css/font-awesome.css"

]
You can also include font-awesome.css directly in your index.html file.
Also include hammer.js for swipe. import in your module like this
npm install hammerjs --save

import 'hammerjs';

you may also need bootstrap to use ngx-gallery properly.

A: i solved using
@import url(../node_modules/font-awesome/css/font-awesome.css);

in "styles.css"


text:
Q: Does google datastore distinguish Entity from different users of he same application If I have an application where many users try to upload entities of the same Kind with the same Id, will the GAE somehow distinguish and restrict access and uploads based on user ? if so can anyone explain or post a link to the details of how it's implemented

A: App Engine knows nothing about your users - your application code controls the entities and their ids.
You have two approaches to consider:
A. Use Namespaces.
B. Design your data model to have an entity "User" (or "Account", or "Customer" - whatever suits your needs), and then either make other entities child entities of a User entity (this approach has major limitations - read about them first), or simply reference the User entity in all entities that are related.

A: A client is normally never in charge of defining ids for your new entities (there are very specific exceptions but that's most likely not the case).
Note that your database has to be the identifying master, and the only one in charge of assigning identity as you can't assure the process to be atomic out of its bounds. Alternatively you could ask your api to allocate a set of ids that you can safely use on your clients, but then again, it's likely that you don't need to get that far.
Some resources.
If you are using DataStore
A DataStore write
Id allocation on GAE


text:
Q: how it possible.? add runtime dropdown text and value Mr. Los Frijoles plz show my question and answer.
How it possible.?
I have 2 drop down , 1st is static 'drpDisplayAns1' and 2nd is 'drpCorrectAns1' here i select 'drpDisplayAns1' option 2 then i get only 1 and 2 in 'drpCorrectAns1' my 2nd drop down, or i select 3 then i get only 1, 2 and 3 in 'drpCorrectAns1' my 2nd drop down, or i select 4 then i get 1, 2, 3 and 4 in 'drpCorrectAns1' my 2nd drop down.
means add runtime using jquery. or etc.
so how it possible.?
in Mvc Razor.
Plz Help Me.
thnks.
my view code is
         '

         @Html.DropDownListFor(model => model.DisplayAnswer, new SelectList(new[]
                                      {
                                          new { value="2", text="2"},
                                          new { value="3", text="3"},
                                          new { value="4", text="4"},
                                      }, "value", "text", 4), new{ id=

   "drpDisplayAns1"})'
        '@Html.ValidationMessageFor(model => model.DisplayAnswer)

        @Html.LabelFor(model => model.Answer1)

        @Html.EditorFor(model => model.Answer1)
        @Html.ValidationMessageFor(model => model.Answer1)

        @Html.LabelFor(model => model.Answer2)

        @Html.EditorFor(model => model.Answer2)
        @Html.ValidationMessageFor(model => model.Answer2)

        @Html.LabelFor(model => model.Answer3)

        @Html.EditorFor(model => model.Answer3)
        @Html.ValidationMessageFor(model => model.Answer3)

        @Html.LabelFor(model => model.Answer4)

        @Html.EditorFor(model => model.Answer4)
        @Html.ValidationMessageFor(model => model.Answer4)

        @Html.LabelFor(model => model.CorrectAnswer)

        @Html.DropDownListFor(model => model.CorrectAnswer, new SelectList(new[]
                                      {
                                          new {value="0", text=" "},
                                          new {value="1", text="1"},
                                          new {value="2", text="2"},
                                          new {value="3", text="3"},
                                          new {value="4", text="4"},
                                      }, "value", "text", 0), new{id="drpCorrectAns1"})
        @Html.ValidationMessageFor(model => model.CorrectAnswer)

'

and script file
'$(document).ready(function () {
$('#drpDisplayAns1').change(function () {

    if (this.value == '2') {
        $('.editor-label1').show();
        $('.editor-label2').show();
        $('.editor-label3').hide();
        $('.editor-label4').hide();
    }
    else if (this.value == '3') {
        $('.editor-label1').show();
        $('.editor-label2').show();
        $('.editor-label3').show();
        $('.editor-label4').hide();
    }

    else if (this.value == '4') {
        $('.editor-label1').show();
        $('.editor-label2').show();
        $('.editor-label3').show();
        $('.editor-label4').show();
    }
});

});'

A: Mr.Los Frijoles i not ask a fake questions.
and my question's answer is following.
r u understand mr. Los Frijoles..??

     @Html.DropDownListFor(model => model.DisplayAnswer, new SelectList(new[]
                                  {
                                      new { value="2", text="2"},
                                      new { value="3", text="3"},
                                      new { value="4", text="4"},
                                  }, "value", "text", 4), new{ id=

"drpDisplayAns1"})'
    '@Html.ValidationMessageFor(model => model.DisplayAnswer)

    @Html.LabelFor(model => model.Answer1)

    @Html.EditorFor(model => model.Answer1)
    @Html.ValidationMessageFor(model => model.Answer1)

    @Html.LabelFor(model => model.Answer2)

    @Html.EditorFor(model => model.Answer2)
    @Html.ValidationMessageFor(model => model.Answer2)

    @Html.LabelFor(model => model.Answer3)

    @Html.EditorFor(model => model.Answer3)
    @Html.ValidationMessageFor(model => model.Answer3)

    @Html.LabelFor(model => model.Answer4)

    @Html.EditorFor(model => model.Answer4)
    @Html.ValidationMessageFor(model => model.Answer4)

    @Html.LabelFor(model => model.CorrectAnswer)

    @Html.DropDownListFor(model => model.CorrectAnswer, new SelectList(new[]
                                  {
                                      new {value="0", text=" "},
                                      new {value="1", text="1"},
                                      new {value="2", text="2"},
                                      new {value="3", text="3"},
                                      new {value="4", text="4"},
                                  }, "value", "text", 0), new{id="drpCorrectAns1"})
    @Html.ValidationMessageFor(model => model.CorrectAnswer)

and my script code is:
  $(document).ready(function () {
  $('#drpDisplayAns1').change(function () {

    if (this.value == '2') {
        $('.editor-label1').show();
        $('.editor-label2').show();
        $('.editor-label3').hide();
        $('.editor-label4').hide();
        $("#drpCorrectAns1 option[value='3']").attr("disabled", true).hide();
        $("#drpCorrectAns1 option[value='4']").attr("disabled", true).hide();
    }

    if (this.value == '3') {
        $('.editor-label1').show();
        $('.editor-label2').show();
        $('.editor-label3').show();
        $('.editor-label4').hide();
        $("#drpCorrectAns1 option[value='3']").attr("disabled", false).show();
        $("#drpCorrectAns1 option[value='4']").attr("disabled", true).hide();
    }

     if (this.value == '4') {
       $('.editor-label1').show();
       $('.editor-label2').show();
       $('.editor-label3').show();
       $('.editor-label4').show();
       $("#drpCorrectAns1 option[value='3']").attr("disabled", false).show();
       $("#drpCorrectAns1 option[value='4']").attr("disabled", false).show();
   }
});


text:
Q: "Let's see them aliens" grammar I know this was a joke on Facebook, the thing about storming Area 51. But, what catched my eyes is the "them".
Is this playing on word? Or, is this grammaticality sound? Or is this a joke because I, as non native speaker, don't get it.
Isn't it supposed to be:

Let's see them, the aliens
OR
Let's see the aliens

I hope this question isn't off-topic but I really want to know.

A: Them is a colloquial way of saying those, such as here

There's gold in them thar hills.

and usually, what them refers to has already been mentioned. It's not just a synonym though, it might be a way to express mockery or disbelief in something rumoured:

Let's see them aliens.

So in this case it is loaded and says rather more than "those".


text:
Q: Change color receipts label OS X Mail I'm writing a plug-in for Apple OS X Mail in which I want to (based on some conditions) change the color of the label of an email-address in the e-mail compose window.
This (blue) label:

My plug-in is written in Swift (though, I could also work with an Obj-C solution).
I'm open for other suggestions as well, the main purpose is to notify the user of a certain "status" (green, orange, red) for a single email address.
Thanks a bunch in advance.


text:
Q: How to cast element in jqgrid response method? I have an abstract class with some child. I have used the Joined Inheritance strategy.
I need to extract data from a child in a global jqGrid, but I have no idea how it can be done.
Page<AbstractClass> entryPage = abstractService.findEntriesByCriteria(abstractSearchCriteria, pageRequest);

// Construct the grid data that will return as JSON data
JqgridResponse<AbstractClass> entryGrid = new JqgridResponse<AbstractClass>();

Any idea?

A: I'm not sure that I understand your problem correctly. Typically one don't need to define any JqgridResponse type. One can use anonymous types instead. If you really need to use some type you can use the type Object for example.


text:
Q: Why does pandas.to_numeric result in a list of lists? I am trying to import csv data into a pandas dataframe. To do this I am doing the following:
df = pd.read_csv(StringIO(contents), skiprows=4, delim_whitespace=True,index_col=False,header=None)
index = pd.MultiIndex.from_arrays((columns,  units, descr))
df.columns = index
df.columns.names = ['Name','Unit','Description']
df = df.apply(pd.to_numeric)
data['isotherm'] = df

This produces e.g. the following table:
In: data['isotherm']
Out:
Name             Relative_Pressure  Volume_STP
Unit                             -       ccm/g
Description                   p/p0
0                         0.042691     29.3601
1                         0.078319     30.3071
2                         0.129529     31.1643
3                         0.183355     31.8513
4                         0.233435     32.3972
5                         0.280847     32.8724

However if I only want to get the values of the column Relative_Pressure I get this output:
In: data['isotherm']['Relative_Pressure'].values
Out:
array([[0.042691],
       [0.078319],
       [0.129529],
       [0.183355],
       [0.233435],
       [0.280847]])

Of course I could now for every column I want to use flatten
x = [item for sublist in data['isotherm']['Relative_Pressure'].values for item in sublist]

However this would lead to a lot of extra effort and would also reduce the readability. How can I for the whole data frame make sure the data is flat?

A: array([[...]]) is not a list of lists, but a 2D numpy array. (I'm not sure why the values are returned as a single-column 2D array rather than a 1D array here, though. When I create a primitive DataFrame, a single column's values are returned as a 1D array.)
You can concatenate and flatten them using numpy's built-in functions, eg.
x = data['isotherm']['Relative_Pressure'].flatten()

Edit: This might be caused by the MultiIndex.

A: The direct way of indexing into one column belonging to your MultiIndex object is with a tuple as follows:
data[('isotherm', 'Relative_Pressure')]

which will return a Series object whose .values attribute will give you the expected 1D array.  The docs discuss this here
You should be careful using chained indexing like data['isotherm']['Relative_Pressure'] because you won't know if you are dealing with a copy of the data or a view of the data.  Please do a SO search of pandas' SettingWithCopyWarning for more details or read the docs here.


text:
Q: How can I create a Register Page in Xcode? So I'm working on creating a register page. But I'm having trouble figuring out how to take the STRING of username for example and putting it inside of the parameters section. Without hardcoding it.  Right now its hardcoded as username@yahoo.com and password1. I want to be able to take everything entered above and put it in the parameters section so it can be sent to the server.
Any help would be appreciated! Thanks.
My Code is below:
- (IBAction)signUp:(id)sender {

if ([userName.text isEqualToString:@""] || [email.text isEqualToString:@""] || [emailPublic.text isEqualToString:@""] ||[password.text isEqualToString:@""] || [passwordHint.text isEqualToString:@""] || [avatar.text isEqualToString:@""] || [sex.text isEqualToString:@""] || [dob.text isEqualToString:@""]) {
    UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Oops!" message:@"Please fill in all the fields!" delegate:self cancelButtonTitle:@"OK" otherButtonTitles:nil, nil];
    [alert show];
    return;
}

   NSURL *url = [NSURLURLWithString:@"http://WEBSITEHERE/api/users/AuthenticateUser"];
   NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:url];

   NSString *parameters = @" {\"userName\":\"username@yahoo.com\",\"password\":\"password1\"}";

    NSLog(@"PARAMS = %@", parameters);

    NSData *data = [parameters dataUsingEncoding:NSUTF8StringEncoding];

    [request setHTTPMethod:@"POST"];

    [request setValue:@"text/plain" forHTTPHeaderField:@"Accept"];

    [request setValue:@"application/json;charset=utf-8" forHTTPHeaderField:@"Content-Type"];

    [request setHTTPBody:data];

    NSURLResponse *response = nil;

    NSError *error = nil;

    NSData *result = [NSURLConnection sendSynchronousRequest:request returningResponse:&response error:&error];

   NSString *responseString = [[NSString alloc]initWithData:result encoding:NSUTF8StringEncoding];

NSLog(@"RESULT = %@", responseString);
 }

A: Don't try to construct the JSON data "manually". That's error prone because the
strings might contain characters that have to be escaped in the JSON.
Better create a dictionary and use
NSJSONSerialization:
NSDictionary *params = @{@"userName": userName.text, @"password": password.text};
NSError *error;
NSData *data = [NSJSONSerialization dataWithJSONObject:params options:0 error:&error];


text:
Q: Errors compiling MVVMCross project after updating to xamarin.android 4.10.1 I have updated to Xamarin.Android 4.10.1 and now my MvvmCross project does not compile :( its as if it cant find any of the MVX attributes.
I am getting an error like the following for every MvvmCross entry in my code
E:\Software Projects\xxx\xxx\xxx\Resources\layout\xxx.xml(0,0): Error: No resource identifier found for attribute 'MvxBind' in package 'com.xxx' (xxx)
has anyone encountered this too?
Thanks
Amit


text:
Q: swap adjacent element in array using recursion I wrote a program to swap adjacent element of array using recursion:
static arr_len;

void swap(int *a, int len)
{
        int tmp;

        if(len == 0 )
                return;
        else {
                swap(a, len-1);

                if(len == arr_len-1)
                        return;
                else if (len > 1)
                        len++;

                tmp = a[len];
                a[len] = a[len-1];
                a[len-1] = tmp;
        }
}

int main()
{
        int a[] = {1,2,3,4}, i;
        arr_len = sizeof(a)/sizeof(a[0]);

        swap(a, sizeof(a)/sizeof(a[0]));

        for (i = 0; i< 4; i++)
                printf("%d\n", a[i]);
}

This seems to work as I see output:
2
1
4
3
But soon I put more element in array as:
int a[] = {1,2,3,4,5,6}

I see this output:
2
1
4
5
6
3
*** stack smashing detected ***: ./a.out terminated
Aborted (core dumped)

A: For starters using the global variable arr_len is a bad idea.
In any case your function is invalid. Consider a simplified example when the array contains only 1 or 2 elements. When the array contains one element then you are accessing memory beyond the array using an invalid index equal to len in this statement
tmp = a[len];

The function can look much simpler. For example
void swap( int *a, size_t n )
{
    if ( !( n < 2 ) )
    {
        int tmp = a[0];
        a[0] = a[1];
        a[1] = tmp;
        swap( a + 2, n - 2 );
    }
}


text:
Q: How to submit Currency form in Shopify? I am create a currency selector form and submitting it by js . But i am not able to submit . below is the code. Can anyone help?
I donot want to use submit button in this .
Form code:
          {% form 'currency'   %}

    {% for currency in shop.enabled_currencies %}
      {% if forloop.first == true %}   {{currency.iso_code}} {{currency.symbol}}

       {% endif %}

{{currency.iso_code}}

    {% endfor %}

{% endform %}

js:


text:
Q: C# 4.0 object oriented time contraints I have many if statements inside a for loop and I'm looking for an alternative other than a switch statement.  Which is best in term of time constraints?
My code:
anotherlist

foreach(x objx in xlist)
{
if(objx.att1=anotherlist.someatt)
        do something

if(objx.att2=anotherlist.someatt)
        do something

if(objx.att3=anotherlist.someatt)
        do something
...

This continues for around 15 to 20 if statements.
Can anyone recommend an alternative?

A: I have an alternative, though it will not be better in terms of time, but it could be cleaner.
You could have a dictionary, the keys of the dictionary are all the anotherlist.someatt possibilities, and the values are detegates of  'do something' functions.
Then you could simply do DictionaryName[objx.att1].invoke(params) instead of all these if(condition...).


text:
Q: Finding the inverse of $f(x) = x\sqrt{2+x^2}$ For a function $f(x) = x\sqrt{2+x^2}$ find out if it's bijective and if so, find its inverse.
The function is surjective because $x^2 > 0:\forall x\in\mathbb{R}$. I'm having difficulties proving that the function is injective.
I tried the following: $$f(x) = f(y) \iff x\sqrt{2+x^2} = y\sqrt{2+y^2} \\ x^2(2+x^2) = y^2(2+y^2) \\ 2x^2+x^4 = 2y^2 + y^4$$
And well, I think I just made it more difficult for myself. I couldn't find any thread on MSE where one tried tackling such a specific problem.
Solution appreciated, thanks in advance.

A: What do you know about monotonous functions? Is this function (strictly) monotonous, and if yes, does this tell you something about injectivity?

A: Hint Let $a=x^2 \geq 0$ and $b=y^2 \geq 0$. The equation reduces to $$2a+a^2=2b+b^2$$

A: Hint:
To find the inverse let $y= f^{-1}(x)$ then since $f(f^{-1}(x)) = x$ we have
$$f(f^{-1}(x)) = x = y\sqrt{2+y^2}$$
which gives
$$x^2 = y^2(2+y^2)\to y^4 + 2y^2 - x^2 = 0$$
This is a quadratic equation in $y^2$: $(y^2)^2 + 2y^2 - x^2 = 0$ for which you can use the standard formula on. To determine which root to pick notice that $f^{-1}(0)=0$ and $\text{sign}(f^{-1}(x)) = \text{sign}(x)$.

A: The condition $x^2\ge0$, which implies $2+x^2>0$ just tells you that the function is defined on $\mathbb{R}$, but not that it is surjective. For instance, the function
$$
g(x)=\frac{1}{\sqrt{2+x^2}}
$$
is not surjective if considered as $g\colon\mathbb{R}\to\mathbb{R}$, because $0<g(x)\le\frac{1}{\sqrt{2}}$ for all $x$.
If you're allowed to use calculus, surjectivity and injectivity follow from considering these facts:

*

*$\displaystyle\lim_{x\to-\infty}f(x)=-\infty$

*$\displaystyle\lim_{x\to\infty}f(x)=\infty$

*$\displaystyle f'(x)=\sqrt{2+x^2}+\frac{x^2}{\sqrt{2+x^2}}>0$
Therefore $f$ is increasing and assumes every real value.
Without calculus it's a bit more difficult. Let's try solving the equation
$$
y=x\sqrt{2+x^2}
$$
with respect to $x$. First we note that if $x<0$, then also $y<0$ and conversely. Now we can square:
$$
y^2=2x^2+x^4
$$
or
$$
x^4+2x^2-y^2=0
$$
that furnishes
$$
x^2=-1+\sqrt{1+y^2}
$$
(the other solution of the quadratic equation must be discarded, because it's negative). Thus we can write
$$
|x|=\sqrt{\sqrt{1+y^2}-1}
$$
and, remembering the consideration above, we have
$$
x=\begin{cases}
\sqrt{\sqrt{1+y^2}-1} & \text{if $y>0$}\\[2ex]
0 & \text{if $y=0$}\\[2ex]
-\sqrt{\sqrt{1+y^2}-1} & \text{if $y<0$}\\[1ex]
\end{cases}
$$
and this proves both surjectivity and injectivity, because the function has an inverse.


text:
Q: Ruby TNS:could not resolve the connect identifier specified I have C:\ORACLE added to my ORACLE_HOME
I have C:\ORACLE and C:\ORACLE\bin in PATH
I have C:\ORACLE\network\admin in TNS_ADMIN
I am using Ruby OCI8 to connect to remote oracle server (same effect using slqplus):
require 'oci8'

OCI8.new(@user, @password,"#{@host}:#{@port}/#{@sid}")

I get this error:
oci8.c:557:in oci8lib_300.so: ORA-12154: TNS:could not resolve the connect identifier specified (OCIError)

Under C:\ORACLE\network\admin I have tnsnames.ora as:
ORCL =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (HOST = <host>)(PORT = <port>)) )
(CONNECT_DATA =
(SID = <sid>)
)
)

My os is WINDOWS 10 x64.
Please help.
Thanks


text:
Q: Calling a function at datetime in Python What is a good way to call a function at datetime in Python?
There 3 ways that I know of:

*

*"Are we there yet?!" (check at if date has passed at interval (time.sleep(interval)))
This is obviously bad. It can only be precise if interval is low, which becomes inefficient.

*Sleep off the difference (time.sleep(timedelta.seconds))
This is better, but I don't like the idea of putting a thread to sleep for an insanely long time, e.g. 6 months if such is the date.

*Hybrid between the two above; sleep off the difference if difference is bellow interval. If above, sleep for an interval to prevent long sleeps.
I think this is the best out of all three when you think about long sleeps, but interval seems bad anyway.
Are there any more ways you can think of? Is there anything in standard library that can help me call a function at datetime behind the scene?
EDIT:
I'm asking this because I've actually developed my own Cron implementation in Python. The only problem is that I can't decide how my code should wait for next occurrence. One of the differences between my implementation and original Cron is support for seconds. So, simply sleeping for minimum possible interval (1 second in my case) is too inefficient.
I realize now that this question could perhaps be changed to "how does Cron do this?" i.e. "how does Cron check if any date has passed? Does it run constantly or is a process run each minute?". I believe the latter is the case, which, again, is inefficient if interval is 1 second.
Another difference is that my code reads crontab once and calculates the exact date (datetime object) of next occurrence from the pattern. While Cron, I assume, simply checks each minute if any pattern from crontab matches current time.
I'll stick to the "hybrid" way if there's no other way to do this.

A: If this is something that might be six months out like you said, a chron job is probably more suitable than keeping a python program running the whole time.

A: I use the gobject main loop, but any library with an event loop should have this ability.

A: It might be a good idea to use a cron job.
you can edit the cron table with : crontab -e
and add a line like this (called every 20 minutes)
*/20 * * * * /usr/bin/python /home/toto/my_script.py


text:
Q: Where can I change settings/preferences for Files? I need to change how files are displayed. I want to use a list/details view rather than the icon view. For whatever reason there isn't a traditional File|Settings type menu. How do I change the settings? This is Ubuntu 17.04.

A: OK my mistake. For whatever reason you need to click the application title (in this case "Files") and you get a menu. This is not at all consistent with any other application in Ubuntu/Unity. Pretty bad UX decision.


text:
Q: I Can't Run a Java Module on Android Studio So I am very much a newcomer to the android studio, so I might've missed a few settings here and there, but
when I try to run a code with created java module, it doesn't recognize any of my code.
I attached the screenshot of what the ide returned to me.

I tried to reinstall the newest version of the android studio with the newest version of SDK (I attached another image file.) several times, but it doesn't seem to go anywhere.
For the SDK tools, I have the followings:

*

*Android SDK Build-Tools

*Android Emulator

*Android SDK Platform-Tools

Also, I did try Build>Cealn Project.
Does anyone know how to fix this problem?
P.S. Here is my build gradle for the java module.