text:
Q: GoldfishAddressSpaceHostMemoryAllocator: ioctl_ping failed After migrating to AndroidX,this code has stopped working.
Before migrating to AndroidX,this code was working.
Error :
2020-02-24 09:41:17.918 17888-17921/edmt.dev.androidgridlayout E/eglCodecCommon: GoldfishAddressSpaceHostMemoryAllocator: ioctl_ping failed for device_type=5, ret=-1
BackgroundTask.java:
package edmt.dev.androidgridlayout;

import android.content.Context;
import android.os.AsyncTask;
import android.view.View;
import android.widget.Toast;

import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.OutputStreamWriter;
import java.net.HttpURLConnection;
import java.net.URL;
import java.net.URLEncoder;

import javax.net.ssl.HttpsURLConnection;

public class BackgroundTask extends AsyncTask<String,String,String> {
    Context ctx;
    BackgroundTask(Context ctx)
    {
        this.ctx=ctx;
    }

    @Override
    protected void onPreExecute() {
        super.onPreExecute();
    }

    @Override
    protected void onProgressUpdate(String... values) {
        super.onProgressUpdate(values);
    }

    @Override
    protected void onPostExecute(String result) {
        Toast.makeText(ctx,result,Toast.LENGTH_LONG).show();
    }

    @Override
    protected String doInBackground(String... params) {

//        String url="http://192.168.42.159/kamakshi/addproduct.php?name="+name+"&quantity="+quantity;
        String url="http://10.0.2.2/kamakshi/addproduct.php";

        String method = params[0];
        if (method.equals("addproduct"))
        {
            String name=params[1];
            String quantity=params[2];
            String cp=params[3];
            String sp=params[4];
            String etseller=params[5];
            String seller=params[6];
            String brand=params[7];
            String colour=params[8];
            String fabric=params[9];
            String size=params[10];
            String type=params[11];
//            String gender=params[12];

            System.out.println(method+"omkar"+name+"......"+quantity+" "+cp+" "+sp+" "+etseller+" "+seller+" "+brand+" "+colour+" "+fabric+" "+size);
            try{
                URL url1 = new URL(url);
                HttpURLConnection httpsURLConnection = (HttpURLConnection)url1.openConnection();
                if(httpsURLConnection!=null)
                {
                    System.out.println("connn established");

                }
                else
                {
                    System.out.println("connn failed");

                }
                System.out.println("connn established");
                httpsURLConnection.setRequestMethod("POST");
                httpsURLConnection.setDoOutput(true);
                OutputStream os=httpsURLConnection.getOutputStream();
                BufferedWriter bufferedWriter=new BufferedWriter(new OutputStreamWriter(os,"UTF-8"));
                String data= URLEncoder.encode("name","UTF-8")+"="+URLEncoder.encode(name,"UTF-8")+"&"+
                        URLEncoder.encode("cp","UTF-8")+"="+URLEncoder.encode(cp,"UTF-8")+"&"+
                        URLEncoder.encode("sp","UTF-8")+"="+URLEncoder.encode(sp,"UTF-8")+"&"+
                        URLEncoder.encode("etseller","UTF-8")+"="+URLEncoder.encode(etseller,"UTF-8")+"&"+
                        URLEncoder.encode("seller","UTF-8")+"="+URLEncoder.encode(seller,"UTF-8")+"&"+
                        URLEncoder.encode("brand","UTF-8")+"="+URLEncoder.encode(brand,"UTF-8")+"&"+
                        URLEncoder.encode("colour","UTF-8")+"="+URLEncoder.encode(colour,"UTF-8")+"&"+
                        URLEncoder.encode("fabric","UTF-8")+"="+URLEncoder.encode(fabric,"UTF-8")+"&"+
                        URLEncoder.encode("size","UTF-8")+"="+URLEncoder.encode(size,"UTF-8")+"&"+
                        URLEncoder.encode("type","UTF-8")+"="+URLEncoder.encode(type,"UTF-8")+"&"+
//                        URLEncoder.encode("gender","UTF-8")+"="+URLEncoder.encode(gender,"UTF-8")+"&"+
                        URLEncoder.encode("quantity","UTF-8")+"="+URLEncoder.encode(quantity,"UTF-8");
                bufferedWriter.write(data);
                bufferedWriter.flush();
                bufferedWriter.close();
                os.close();

                InputStream IS= httpsURLConnection.getInputStream();
                BufferedReader br=new BufferedReader(new InputStreamReader(IS,"iso-8859-1"));
                br.close();
                IS.close();

                httpsURLConnection.disconnect();

            }catch (Exception e)
            {
                e.printStackTrace();
            }
        }
        return url;
    }
}

AndroidManifest.xml file:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="edmt.dev.androidgridlayout">

    <uses-permission android:name="android.permission.INTERNET" />
    <uses-permission android:name="android.permission.CAMERA" />

    <application
        android:allowBackup="true"
        android:icon="@mipmap/ic_launcher"
        android:label="@string/app_name"
        android:roundIcon="@mipmap/ic_launcher_round"
        android:supportsRtl="true"
        android:theme="@style/AppTheme">
        <activity android:name=".scandemo"></activity>
        <activity android:name=".Scanner" />
        <activity android:name=".ProductTable" />
        <activity android:name=".ProductView" />
        <activity android:name=".addproduct" />
        <activity android:name=".MainActivity">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
        <activity android:name=".ActivityOne" />
    </application>

</manifest>

A: Add this line - android:usesCleartextTraffic="true" under the application tag of your manifest file.
I have updated the code of your manifest file with the required statement.
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="edmt.dev.androidgridlayout">

    <uses-permission android:name="android.permission.INTERNET" />
    <uses-permission android:name="android.permission.CAMERA" />

    <application
        android:allowBackup="true"
        android:icon="@mipmap/ic_launcher"
        android:label="@string/app_name"
        android:roundIcon="@mipmap/ic_launcher_round"
        android:supportsRtl="true"
        android:usesCleartextTraffic="true"
        android:theme="@style/AppTheme">
        <activity android:name=".scandemo"></activity>
        <activity android:name=".Scanner" />
        <activity android:name=".ProductTable" />
        <activity android:name=".ProductView" />
        <activity android:name=".addproduct" />
        <activity android:name=".MainActivity">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
        <activity android:name=".ActivityOne" />
    </application>

</manifest>


text:
Q: Check game server ping in a browser? I've been researching around regarding the capabilities of having a client access a website and check their ping in a game (so far there seems to be no possible way using JS, however there may be a way with AJAX?). Without a website, the method to check ping would be using the command-line ping command to the server address through ICMP. Would it be possible to check the ping of a client to the game server with a website middle-man?
EDIT: If I do a php solution as described here: Pinging a server in php without the port?
could I do something like checking the ping of client to my website, then checking from my website to the game server and then predict the ping of the client?

A: You cannot really use ping command from js, but you can use AJAX call to some empty file on your server, to measure the response time:
var start = new Date().getTime();
$.ajax('http://your_server/empty_file')
.always(function( data ) {
    console.log(new Date().getTime()-start);
});

EDIT: you can only 'ping' game server using this method if it has HTTP server running on it (you may need to set up headers to enable cross-domain requests for that). If both servers are on the same fast local network, there is no need to ping to both servers separately, the measurments are going to be the same.

redpajama_set_name: RedPajamaStackExchange


text:
Q: How to access getSharedPreferences from another class? I have build 2 projects my main one and a twitter posting one. I have imported the twitter one into the main and am now trying to hook it up. Below is the import code. The problem is I know I am missing something possibly to do with the context? I have just summarised what is contained in my main project below so you understand better (Hopefully).
import com.tweet.t.TweetToTwitterActivity;

            TweetToTwitterActivity twitter = new TweetToTwitterActivity();
            twitter.buttonLogin(v);

Here is the TweetToTwitterActivity
public class TweetToTwitterActivity extends Activity {

    private SharedPreferences mPrefs;
    /** Twitter4j object */
    private Twitter mTwitter;
    private RequestToken mReqToken;

    public void buttonLogin(View v) {
        mPrefs = getSharedPreferences("twitterPrefs", MODE_PRIVATE);
        // Load the twitter4j helper
        mTwitter = new TwitterFactory().getInstance();

        // Tell twitter4j that we want to use it with our app
        mTwitter.setOAuthConsumer(CONSUMER_KEY, CONSUMER_SECRET);
        if (mPrefs.contains(PREF_ACCESS_TOKEN)) {
            Log.i(TAG, "Repeat User");
            loginAuthorisedUser();
        } else {
            Log.i(TAG, "New User");
            loginNewUser();
        }
    }

The Logcat produces this error
09-23 11:27:40.034: ERROR/AndroidRuntime(229): java.lang.NullPointerException
09-23 11:27:40.034: ERROR/AndroidRuntime(229):     at android.content.ContextWrapper.getSharedPreferences(ContextWrapper.java:146)
09-23 11:27:40.034: ERROR/AndroidRuntime(229):     at com.tweet.t.TweetToTwitterActivity.buttonLogin(TweetToTwitterActivity.java:74)

and point to this line.
    mPrefs = getSharedPreferences("twitterPrefs", MODE_PRIVATE);

A: getSharedPreferences() is a method of the Context class. You are just creating an instance of TweetToTwitterActivity which extends Activity but this activity is not presently started.
One way to solve this will be to pass a Context object also to buttonLogin:
Change public void buttonLogin(View v)
to public void buttonLogin(View v, Context context)
and mPrefs = getSharedPreferences("twitterPrefs", MODE_PRIVATE);
to mPrefs = context.getSharedPreferences("twitterPrefs", MODE_PRIVATE);
and twitter.buttonLogin(v);
to twitter.buttonLogin(v, this);

A: Hemant is right.
mPrefs = getSharedPreferences("twitterPrefs", MODE_PRIVATE);

for doing this you need TweetToTwitterActivity Activity and not just an instance. So an Activity never gets created when you use new keyword. only OS can create an Activity for ya. so
 twitter.buttonLogin(v, YourCurrentActvity.this);

and
public void buttonLogin(View v, Context context) {
    mPrefs = context.getSharedPreferences("twitterPrefs", MODE_PRIVATE);
    // Load the twitter4j helper
    mTwitter = new TwitterFactory().getInstance();

    // Tell twitter4j that we want to use it with our app
    mTwitter.setOAuthConsumer(CONSUMER_KEY, CONSUMER_SECRET);
    if (mPrefs.contains(PREF_ACCESS_TOKEN)) {
        Log.i(TAG, "Repeat User");
        loginAuthorisedUser();
    } else {
        Log.i(TAG, "New User");
        loginNewUser();
    }
}

A: try to pass like this
 twitter.buttonLogin(v,Activityname.this)
then in called function change like this
public void buttonLogin(View v,Context this)
{
   this.getSharedPreferences("twitterPrefs", MODE_PRIVATE);
}


text:
Q: Propositional Logics Any one that can work out the details that are missing from this:
(¬B1 ∧¬¬B2 ∧¬B2)∨(¬¬B1 ∧¬B2 ∧¬B2)∨(¬¬B1 ∧¬¬B2 ∧B2)
to this:
(B1 ∧ ¬B2) ∨ (B1 ∧ B2)
I know that they are of course using Double Negation law - but i don't get it afterwards. Is it the ditributivity?
Anyone that can give me some help? I would appreciate it.

A: Notice the first parenthesized group is a contradiction (B2 and not B2). Also, you can simplify "B2 and B2" to just B2.


text:
Q: Suppose $f:E\to \mathbb{R}$ and $p$ is limit point show be example that this conclusion cannot be made
Question: Suppose $f:E\to \mathbb{R}$ and $p$ is limit point of $E$. If $\lim\limits_{x\to p}f(x)=0$ and $f(x)>0$ for all $x\in E$, then prove that $\lim\limits_{x\to p}\frac{1}{f(x)}=\infty$. Show by example that this conclusion can not be made if the condition $f(x)>0$ is not there.

I made example with $\lim\limits_{x\to 0+}1/x= \infty$ and $\lim\limits_{x\to 0-}1/x= -\infty$
and... don't know how to apply it.

A: You can apply it like this.
Put $E=\mathbb{R}$ and define $f:\mathbb{R}\to \mathbb{R}$ by $f(x)=x$. Choose $p=0$.
Clearly $0$ is a limit point of $E=\mathbb{R}$. Also it is not case that $f(x)>0$ for all $x\in \mathbb{R}$.
Observe that $\lim\limits_{x\to 0}f(x)=\lim\limits_{x\to 0}x=0$, $\lim\limits_{x\to 0+}\frac{1}{f(x)}=\lim\limits_{x\to 0+}\frac{1}{x}= \infty$ and $\lim\limits_{x\to 0-}\frac{1}{f(x)}=\lim\limits_{x\to 0-}\frac{1}{x}= -\infty$. Therefore that conclusion can not be made if the condition $f(x)>0$ is not hold.


text:
Q: No Render target selected error I am a newbie so I will post what I did to get the "No render target selected" error.
Basically I have a working project on my PC in Eclipse. I decided to install Android Studio on my laptop. So I exported the Eclipse project on PC, copied the folder on to laptop
and imported the gradle file in Android Studio.
In Android Studio, when I double click the xml file in the layouts folder I get an Error: "No Render Target Selected".
In Eclipse i right clicked the project>properties and it says Taget Name Android 4.4, Platform 4.4 and API level 19
In Android stuido on my laptop, I have installed within the SDK Manager everything releated to API levels 18,19 and 20.
and I have created devices in AVD manager for platforms 4.4.2 and L.
Restarted Android Studio but still same error.
I have another tutorial project created in Android studio that has no Errors when I open the layout files.
Sub question: How do I check the target platform for the project in Android studio?
Please note I am a newbie to the Android studio/eclipse enviroments so please bare that in mind when answering.
Thanks in advance.

A: Top menu bar on the left side of the AVD Manager button you have a "Sync Project with Gradle Files" button. Click that. Android Studio may become sluggish for like 5 seconds, but you'll also see a loading wheel in the project files tab, and possibly a yellow bar on the top of activity_main.xml tab saying that Gradle is syncing. In about 5 seconds everything will be up to date, and you will see the device as expected. Hope this helps.


text:
Q: I want try compiler Chromium OS but not ensure_bootstrap: command not found
/mnt/host/source/src/scripts/update_chroot: line 91: ensure_bootstrap: command not found

I have already add path to bashrc file
declare -x PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/snap/bin:/home/sdct/depot_tools"

but still have a problem why?

INFO    : Bootstrapping depot_tools
/mnt/host/source/src/scripts/update_chroot: line 91: ensure_bootstrap: command not found
15:32:07 ERROR   : 六  6月 13 15:32:07 CST 2020
  15:32:07 ERROR   :  PGID  PPID   PID     ELAPSED     TIME %CPU COMMAND
  15:32:07 ERROR   :     8     4     8       00:17 00:00:00  0.6 -bash
  15:32:07 ERROR   :   298     8   298       00:06 00:00:00  7.5  _ python3
  /mnt/host/source/chromite/bin/setup_board --board=amd64-generic
  15:32:07 ERR


text:
Q: lock keys and release keys based on a button press using PySimpleGUI and pyhook I have created a program where the user get access to the system keys such as ctrl and alt only with exiting a program with a button press. However when i run the program it does get stuck in the UI and wont allow me to do anything. Where am i wrong in this? Thanks in advance.
import PySimpleGUI as sg
import pyWinhook
import pythoncom

layout=[[sg.Button('Exit')]]

def blockKeys(event):
    if event.Key.lower() in ['lwin', 'tab', 'lmenu']:
        return False    # block these keys
    else:
        # return True to pass the event to other handlers
        return True

def releaseKeys(event):
    return True

window = sg.Window('Window Title', layout, no_titlebar=True, location=(0,0), size=(800,600), keep_on_top=True).Finalize()
window.Maximize()
hm = pyWinhook.HookManager()
hm.MouseAll = releaseKeys
hm.KeyAll = blockKeys
hm.HookMouse()
hm.HookKeyboard()
pythoncom.PumpMessages()

while True:
    event,values = window.read()
    print(event,values)

    if event =='Exit':
        hm = pyWinhook.HookManager()
        hm.MouseAll = releaseKeys
        hm.KeyAll = releaseKeys
        hm.HookMouse()
        hm.HookKeyboard()
        pythoncom.PumpMessages()
        break;

window.close()

A: pythoncom.PumpMessages() just sits idle and waits for Windows events. It means it will keep waiting there and do nothing. You use while loop in PySimpleGUI, so it is not necessary.
code revised as following,
import PySimpleGUI as sg
import pyWinhook
import pythoncom

layout=[[sg.Button('Exit')]]

def blockKeys(event):
    if event.Key.lower() in ['lwin', 'tab', 'lmenu']:
        return False    # block these keys
    else:
        # return True to pass the event to other handlers
        return True

def releaseKeys(event):
    return True

window = sg.Window('Window Title', layout, return_keyboard_events=True , finalize=True)
hm = pyWinhook.HookManager()
hm.MouseAll = releaseKeys
hm.KeyAll = blockKeys
hm.HookMouse()
hm.HookKeyboard()
# pythoncom.PumpMessages()

while True:
    event,values = window.read()
    print(event,values)

    if event =='Exit':
        hm = pyWinhook.HookManager()
        hm.MouseAll = releaseKeys
        hm.KeyAll = releaseKeys
        hm.HookMouse()
        hm.HookKeyboard()
        # pythoncom.PumpMessages()
        break;

window.close()


text:
Q: My Chromium Browser doesn't start / crashes i bought a Intel Compute Stick with Linux Ubuntu 14 on it.
When i try to open Chromium i get a crash/error notification.
I tried to install Chrome via terminal and nothing i have found on the internet could help me.
Maybe one of you knows how to install a browser or fix the Chromium. I don't care what Browser i'm using, i just want internet access.


text:
Q: Building a jekyll site from java I have a java (GWT) web app with products, where users can add products and set their description and price etc.
I am thinking about the following flow:
whenever a product is updated, run a jekyll build and deploy.
this way the eventual site with all the products will be completely static (with some extra javascript to handle shoppingcart etc), and thus very fast indeed.
Is there a way to call 'jekyll build' from java servlet? I don't have much experience with this... Any suggestions?

A: Sure.
Just run the command line from Java as explained here.
jekyll build --source <source> --destination <destination>

Of course you might be calling it from a RPC instead of a plain Java servlet.


text:
Q: How can I get hidden value from facelet? I have a few hiden fields in my .xhtml page.
<h:inputHidden value="1" id="hidePrev"/>
.....
<h:inputHidden value="1" id="hideNext"/>

And I can't catch their values from my JSF bean.
public class FacesUtil {
public static Object getMapValue(String key) {
    return FacesContext.getCurrentInstance().getExternalContext().getApplicationMap().get(key);
}

public static void setMapValue(String key, Object value) {
    FacesContext.getCurrentInstance().getExternalContext().getApplicationMap().put(key, value);
}

}

My bean code:
    nextFlag = (String)FacesUtil.getMapValue("hideNext");
    prevFlag = (String)FacesUtil.getMapValue("hidePrev");

Fields nextFlag and prevFlag are still empty. They have getter and setter methods. I'm using JSF 2.2 ver. Please, help me to resolve this problem.

A: The <h:inputHidden> isn't intented to add custom request parameters to the form submit. It's intented to remember already-definied bean properties across postbacks. For adding custom request parameters, you should be using <f:param> in command components or "plain vanilla" <input type="hidden"> instead.
Thus, so
<h:commandButton ...>
    <f:param name="prev" value="1" />
    <f:param name="next" value="1" />
</h:commandButton>

or so
<input type="hidden" name="prev" value="1" />
<input type="hidden" name="next" value="1" />
<h:commandButton ... />

Either way, the values are in a request scoped bean available as
@ManagedProperty("#{param.prev}")
private String prev;

@ManagedProperty("#{param.next}")
private String next;

Or in a broader scoped bean as
String prev = externalContext.getRequestParameterMap().get("prev");
String next = externalContext.getRequestParameterMap().get("next");

Please note that you confused request parameters with application scoped attributes. This is seriously a pretty major mixup which proves that you have no idea what you're doing. I strongly recommend to take a pause and go through a basic JSF tutorial once again.

A: You sure about the getApplicationMap() part of FaceUtil? When I'm touching the external Context, it's to retrieve values from the request map:
Map<String, String> pMap = FacesContext.getCurrentInstance().getExternalContext().getRequestParameterMap();

In your case, pMap should contain a key hideNext.

A: Try
     (String)context.getExternalContext().getRequestParameterMap().get(parameterName);
In your case
parameterName may be nextFlag or prevFlag


text:
Q: Windows screen bounds with dual monitors I am looking to get the total screen resolution using dual monitors in powershell.
$screen = [System.Windows.Forms.Screen]::PrimaryScreen
$SCREENWIDTH = [int]$screen.bounds.Size.Width
$SCREENHEIGHT = [int]$screen.bounds.Size.Height

With this I get 1920 X 1200 but the resolution is actually 3840 X 1200. I could just double the resolution, however that wont always work depending on the monitors being used.
I am doing this within powershell studio. The reason for knowing this is because sometimes the program opens up off screen, if it does open off screen, I can move it back to the bottom right hand corner.

A: On the primary Screen the Resolution is still 1920x1200. You can check, how much screens are attached ( [System.Windows.Forms.Screen]::AllScreens ) and work with the bounds [System.Windows.Forms.Screen]::AllScreens | select -ExpandProperty bounds.

A: This is what I found works with the help of Martin. But I know it is super sloppy. I may ask another question to try to get this cleaned up.
$screen = [System.Windows.Forms.Screen]::AllScreens | select -ExpandProperty bounds
foreach ($item in $screen)
{
    $item = $item -replace ".*Y=0,","" -replace "{", "" -replace "}", "" -replace "Width=", "" -replace "Height=", "" -replace ",", ";"
    $pos = $item.IndexOf(";")
    $leftPart = $item.Substring(0, $pos)
    $rightPart = $item.Substring($pos + 1)
    [int]$SCREENWIDTH = $SCREENWIDTH + $leftPart
    [int]$SCREENHEIGHT = $rightPart
}
$richtextbox1.Text = ([string]$SCREENWIDTH + " " + [string]$SCREENHEIGHT)


text:
Q: $ARGV[0] is not working in Solaris SPARC I used $var=$ARGV[0] in some Perl code on a Solaris x64 machine and it is receiving the argument correctly.
But the same piece of code is not working in Solaris SPARC.
Any clue?
Also $_[0] is working in Solaris SPARC, but then it is not working in Solaris x64.
Is there any other way?

A: Try this program:
use strict;
use warnings;
print join ": ", @ARGV . "\n";

Run it with a bunch of command line arguments, and tell me what you're getting as an output. It should look something like this:
$ myprog.pl one two three four five
one: two: three: four: five

Next, try the same thing with this program:
use strict;
use warnings;
print join ": ", @ARGV . "\n";
my $value = $ARGV[0];
print qq(My value = "$value"\n);

Now, edit your question to show us the output you're getting. This way, we'll know what you mean. Also, give us at least a code snippet of what is not working, what you expect, and what you're getting.
Writing a quick etest program is always a good way to track down an issue, and can give you something to post on Stackoverflow if you're still stuck.


text:
Q: Why 'have many in common' is incorrect? Always, we use 'have much in common', not 'have many in common'.
However, I can't find the reason why 'have many in common' is wrong. This is because I think 'many' can also be 'pronoun' like 'much' is 'pronoun'. Is this just English usage? I mean there is no exact reason why we do not use 'have many in common'.
Thank you for your cooperation.

A: Actually, it can be correct.
Much means a lot, an undefined large quantity. You don't have to specifcy much of _what _ you have, but when you do, you use an uncountable concept:

I don't have much money.
  He doesn't like it very much.

Many means a lot of items. Whenever you use many, you have to specifiy many what you mean, and it has to be a countable noun:

I have many apples.
  There are many apples, but I don't have many.

In the last example, many means many apples - it was mentioned just before!
So you could say:

There are many different reasons to go on holiday, but we don't have many (reasons) in common.


text:
Q: Hyper V cluster - one VM won't migrate We have a Failover Cluster built up on 6 blades, each running Hyper V.  Each box is running Server 2008 R2.
We've got a number of VMs running that all have the same basic config:
VHD stored on a cluster shared volume. 2 virtual NICs (1 for LAN connection and 1 for SAN connection).
All of our VMs will happily migrate between any other blade apart from one single VM which is running fine on it's current blade but will not migrate to any other location.
What could be the cause of it or where should I look to get a detailed error message as I can't seem to find much information logged in any of the logs.
Edit:
I know the usual culprit is mis-matching resource names.  We've already been there with the NICs named differently on some of the blades. As far as we can tell now everything looks to be identical on each bit of metal.

A: After browsing posts on a few other forums we opted to remove the VM from the cluster.  Destroy the VM and then attach the underlying VHD to a fresh VM before adding it back to the cluster.  After this it all worked fine.
It's possible that this VM was created prior to all the cluster networks getting set up which I've noted can be a problem.  It's early days with my experience of Hyper V and it's migration... I'm missing the VMWare ESX that I used to work on with no problems!  I'll be fair, it's probably the case that we've made a mistake in the set-up but it would be nice if the error logging provided a little more info instead of just saying 'migration failed'.


text:
Q: The fitting curve cannot be found correctly I want to fit this function
$$
\operatorname{PF}\left(\sigma_{f_{0}}\right)=1-\exp \left[-\left(\frac{\sigma_{f_{0}}-\sigma_{\min _{0}}}{\lambda}\right)^{k}\right]
$$
I already have some points
pt = {
   {73.0, 0.17}, {75.0, 0.33}, {77.0, 0.5}, {79.0, 0.67}, {82.0,
    0.83}, {83.0, 1}
   };

so I use FindFit function to do this,this is my code
Clear["Global`*"]
(* 数据点 *)
pt = {
   {73.0, 0.17}, {75.0, 0.33}, {77.0, 0.5}, {79.0, 0.67}, {82.0,
    0.83}, {83.0, 1}
   };

(*点图*)
listPltpt = ListPlot[pt]

(* 基函数 *)
pf[x_] := 1 - Exp[-((x - deltaMin0)/(lambda))^k];
(* 求拟合 *)
ptFit = FindFit[pt, pf@x, {deltaMin0, lambda, k}, x]

(*拟合函数绘图 *)
Show[listPltpt,
 Plot[pf@x /. ptFit, {x, 60, 100}]]

I gave the correct coefficient from the article, and I did the simulation, which is perfect, why can't I figure it out
funC2[del_] := 1 - Exp[-((del - 3.1)/(76.1))^19.8];
pltfunC2 = Plot[funC2@x, {x, 60, 100}];
Show[listPltpt,
 pltfunC2
 ]

=================upgrage========================
=================upgrade========================
by NonlinearModelFit also could not work

The problem was inspired by this excerpt from a paper:

Since we know that it is a Weibull CDF, then we can just perform a distribution fit:
EstimatedDistribution[
  {73.`, 75.`, 77.`, 79.`, 82.`, 83.`},
  WeibullDistribution[α, β, 3.1],
  WeibullDistribution[19., 76., 3.1]
]
CDF[%][x]

A: Clear["Global`*"]

Using NMinimize as shown by cvgmt, you can get good initial estimates for NonlinearModelFit which then provides statistics such as "ANOVATable" or "ParameterTable"
pt = {{73.0, 0.17}, {75.0, 0.33}, {77.0, 0.5}, {79.0, 0.67}, {82.0,
     0.83}, {83.0, 1}} // Rationalize;

pf[x_] := 1 - Exp[-((x - deltaMin0)/(lambda))^k];

(ptFit = NonlinearModelFit[pt, pf@x, {{deltaMin0, 60}, {lambda, 20}, {k, 5}},
      x, WorkingPrecision -> 15])["BestFitParameters"] // N // Quiet

(* {deltaMin0 -> 58.8802, lambda -> 19.6467, k -> 4.84095} *)

ptFit["ANOVATable"] /. x_Real :> N[x]

ptFit["ParameterTable"] /. x_Real :> N[x]

A: One way is directly using NMinimize.
Clear["Global`*"]
pt = {{73.0, 0.17}, {75.0, 0.33}, {77.0, 0.5}, {79.0, 0.67}, {82.0,
    0.83}, {83.0, 1}};
listPltpt = ListPlot[pt];
pf[x_] = 1 - Exp[-((x - deltaMin0)/(lambda))^k];
sol = NMinimize[{Abs[(pf /@ (pt[[;; , 1]]) - pt[[;; , 2]])]^2 //
    Total, k >= .01}, {deltaMin0, lambda, k},
   Method -> "DifferentialEvolution"]
Show[listPltpt, Plot[pf[x] /. sol[[2]], {x, 70, 90}]]

{0.0084052, {deltaMin0 -> 58.88, lambda -> 19.6469, k -> 4.841}}

A: It's not just about the numbers but how the numbers were collected.  It appears that the OP has digitized Figure 4b in the article mentioned.  (I get different values when I digitize that figure but I'll use the numbers obtained by the OP.)
I'm not aware as to how one can directly measure a probability but usually probabilities are estimated with numbers of failures (in this case) out of a fixed number of trials.  I'm going to assume that all of the proportions given are the proportion of failures out of 30 trials.  The data would then look like
pt = {{73, 30, 5}, {75, 30, 10}, {77, 30, 15}, {79, 30, 19}, {82, 30, 25}, {83, 30, 30}}

So I'm assuming there are 30 trials at each of the $\sigma_{f_0}$ values 73, 75, 77, 79, 82, and 83.  The log of the likelihood can be determined as follows.
The probability of failure for a single stress test with $x_i=\sigma_{f_0}(i)$ is
$$p_i=1-\exp \left(-\left(\frac{x_i-\sigma_{Min_0}}{\lambda}\right)^k\right)$$
The log of the likelihood when there are $n_i$ stress tests at $x_i$ with $i=1,2,3,4,5,6$ is
$$\log L=\sum_{i=1}^6 \log\left({{n_i}\choose{y_i}} p_i^{y_i} (1-p_i)^{n_i-y_i}\right)$$
The Mathematica commands are then
pf[x_, deltaMin0_, lambda_, k_] := 1 - Exp[-((x - deltaMin0)/(lambda))^k]

logL = (Log[Binomial[#[[2]], #[[3]]] pf[#[[1]], deltaMin0, lambda, k]^#[[3]]*
  (1 - pf[#[[1]], deltaMin0, lambda, k])^(#[[2]] - #[[3]])] & /@ pt)//Total;

Now the log of the likelihood can be somewhat simplified:
logL = logL //. Log[a_ b_] -> Log[a] + Log[b] //.
  Log[Exp[a_]] -> a //. Log[a_^b_] -> b Log[a]

The maximum likelihood estimates and associated measures of precision are found as follows:
mle = FindMaximum[{logL, 0 < deltaMin0 < Min[pt[[All, 1]]] && k > 0},
  {{deltaMin0, 60}, {lambda, 20}, {k, 5}}]
(* {-11.4408, {deltaMin0 -> 0.00019672, lambda -> 78.7427, k -> 20.8112}} *)

(* Parameter covariance matrix *)
cov = -Inverse[D[logL, {{deltaMin0, lambda, k}, 2}]] /. mle[[2]];
(* Standard errors of estimates *)
se = Sqrt[Diagonal[cov]]
(* {270.198, 270.42, 71.9058} *)
(* Parameter correlation matrix *)
cor = (Table[cov[[i, j]]/Sqrt[cov[[i, i]] cov[[j, j]]], {i, 3}, {j, 3}]) //
  MatrixForm

The standard errors are huge and the correlations among the parameter estimators are essentially either +1 or -1.  If the data is created as I described above, then the results are at best pretty useless if reasonable estimates of all of the parameters are desired. (The resulting estimates are very similar to what is found in the article.)


text:
Q: insert image in dompdf html table I want to create below type of layout in my DOM pdf. I tried to use css, but it's not working properly. Here i upload the expected output screenshot. Any help?

A: Besides the style, your images have a problem. A part of them is transparent and no matter what you do, they don't fill the table cell. Here's your code with minor changes and different photos:


text:
Q: How to deselect the selected item in tree view I am developing a WPF application, where user has the option to navigate between the pages by clicking next / previous button or by selecting a particular page in the tree view.
<TreeView Background="Transparent" Cursor="Hand" ItemsSource="{Binding Path=TreeItems}" local:TreeViewExtensions.SelectedItemChanged="{Binding Path=SelectedItemChangedCommand}" ItemContainerStyle="{StaticResource TreeViewItemStyle}" >
     <TreeView.ItemTemplate>
          <DataTemplate>
               <TextBlock Text="{Binding DisplayName}" />
          </DataTemplate>
     </TreeView.ItemTemplate>
</TreeView>
<Button Content="< Prev" Name="btnPrev" Command="{Binding Path=MovePreviousCommand}"/>
<Button Content="Next >" Name="btnNext" Command="{Binding Path=MoveNextCommand}"/>

Now the problem is, when a user clicks on a particular page name, application will navigate to particular page. If the user clicks next or previous it be navigated to next or previous page. In this scenario if user clicks on the previously selected item of treeview, it will not navigate to that particular page as it is already selected.
Can anyone let me know, how to deselect the selected item of tree view when user clicks on 'Next' or 'Prev' button.

A: Use something like this to deselect selected items
<TreeView MouseLeftButtonDown="TreeView_MouseLeftButtonDown">
    <TreeViewItem Header="Employee1">
        <TreeViewItem Header="Jesper"/>
        <TreeViewItem Header="Aaberg"/>
        <TreeViewItem Header="12345"/>
    </TreeViewItem>
    <TreeViewItem Header="Employee2">
        <TreeViewItem Header="Dominik"/>
        <TreeViewItem Header="Paiha"/>
        <TreeViewItem Header="98765"/>
    </TreeViewItem>
</TreeView>

A: On Click of Prev or Next, you can set the selectedItem value for the treeView node to true
and set focus on this node. The previously selected nodes, unselected event shall get fired.


text:
Q: Dynamically Allocating a 2D Matrix of Structs in C I am writing a program in C which will read in an image in Bitmap format, and adjust some image parameters like colours, making the image greyscale, etc. I have the image loaded in, and have stored the image headers in 2 structs following Microsoft's documentation, here. I'm having trouble dynamically allocating memory for a 2D array which will serve as the new image to be written out. Each index in the matrix will be an RGB struct PX_RGB:
typedef struct RGB {
    BYTE rgbPK_BLUE;
    BYTE rgbPK_GREEN;
    BYTE rgbPK_RED;
} PX_RGB;

I've read a number of threads, most helpfully this one:
Calloc a Two-Dimensional Array, and less helpfully this one:
I have problems making a function to handle a matrix using calloc. (BYTE is just an alias for a uint8_t). If I naively allocate based solely off of the number of bytes in the input image and the size of the structs:
PX_RGB *new_image = calloc(img_information.bi_size_image, sizeof(PX_RGB));

I'm unable to index it as I would like to, like a matrix (i.e. new_image[i][j] = ...
The comments and responses from the first thread seem to indicate placing one of the image dimensions on the left-hand side and allocating this way:
PX_RGB (*new_image)[image_width] = calloc(image_height, image_width * sizeof(PX_RGB));

But the compiler isn't happy about this, as the size of any potential image isn't known at compile time. There's also a different solution, but this just doesn't seem to do anything - neither the check for NULL neither the code trying to index it seems to do anything:
PX_RGB **new_image;
new_image = calloc(image_height, image_width * sizeof(new_image));

if (new_image == NULL) { printf("\nError: Could not allocate image memory.\n"); return -1; }
for (int i = 0; i < image_height; i++)
{
    for (int j = 0; j < image_width; j++)
    {
        new_image[i][j].rgbPK_BLUE = j;
        printf("\nIndex [%d][%d] = %d", i, j, new_image[i][j].rgbPK_BLUE);
    }
}

I had seen this used as an answer in the first thread, but there the number of columns needed was known and hard-coded in ([3]).
I came across this formula for getting the correct row offset here, and with this test code seems to work fine, I think:
PX_RGB *new_image = calloc(image_height, image_width * sizeof(new_image));

int offset = 0;

for (int i = 0; i < image_height; i++)
{
    for (int j = 0; j < image_width; j++)
    {
        offset = (j * image_width) + i;
        new_image[offset].rgbPK_BLUE = j;
        printf("\nIndex [%d][%d] = %d", i, j, new_image[offset].rgbPK_BLUE);
    }
}

So, is there no way to index dynamically allocated memory the way I want to? I would ideally like to pass my new image to the manipulation functions like this:
void grayscale(int image_height, int image_width, PX_RGB new_image[image_height][image_width])
{
    return;
}

because I have seen other code doing this and I'm stumped why I can't get my version working, and what I'm doing wrong. I should say I got the idea for this project from an open lecture series on computer science by Harvard on edX, where they seemed to have implemented this logic in the way that I want to. Help would be hugely appreciated, cheers!

A: You can access it as matrix with little trick as :
new_image[i][j] == *(new_image + (i*num_of_columns) + j);

Because two dimention array is nothing but a linear array with continuous memory allocation.
Or otherwise, you can typecast it as
typedef Px_RGB (*ptype)[no_of_columns];
ptype new_image_indexed = (ptype)new_image;

Now new_image_indexed can be accessed as
new_image_indexed[i][j];


text:
Q: Azure Event Grid Function Trigger - Probation We have a Azure setup with a Azure Event Grid Topic and to that we have a Azure Function Service with about 15 functions that are subscribing to the topic via different prefix filters. The Azure Function Service is set up as a consumption based resource and should be able to scale as it prefers.
Each subscription is set up to try deliveries for 10 times during maximum 4 hours befor dropping the event. So far so good and the setup is working as expected – most of the time.
In certain, for us unknown situations, it seems like the Event Grid Topic cannot deliver events to the different functions. What we can see is that our dead letter storage fill up with events that have not been delivered.
Now to my question
From the logs we can see the reason for various events not being delivered. The reason is most often Outcome: Probation. We can not find any information from Microsoft on what this actually means.
In addition, the Grid fails and adds the event to the dead letter log before both the timeout policy (4 hours) and the delivery attempts policy (10 retries) has exceeded. Some times the Function Service is idling and do not receive any events from the Grid.
Do any of you good people have ideas of how we can proceed with the troubleshooting for this? What has happened between the Grid and Funciton App when the error message Probation occurs? One thing that we have noticed is that the number of connections from the Grid to our function app is quite high in comparison to the number of events delivered.
There are not other incoming connections to the Function App besides the Event Grid.
Example of a dead letter message
[{
   "id":"a40a1f02-5ec8-46c3-a349-aea6aaff646f",
   "eventTime":"2020-06-02T17:45:09.9710145Z",
   "eventType":"mitbalAdded",
   "dataVersion":"1",
   "metadataVersion":"1",
   "topic":"/subscriptions/XXXXXXX/resourceGroups/XXXX_STAGING/providers/Microsoft.EventGrid/topics/XXXXXstaging",
   "subject":"odl/type/mitbal/v1",
   "deadLetterReason":"TimeToLiveExceeded",
   "deliveryAttempts":6,
   "lastDeliveryOutcome":"Probation",
   "publishTime":"2020-06-02T17:45:10.1869491Z",
   "lastDeliveryAttemptTime":"2020-06-02T19:30:10.5756332Z",
   "data":"<?xml version=\"1.0\" encoding=\"utf-8\"?><Stock><Action>ADD</Action><Id>123456</Id><Store>123</Store><Shelf>1</Shelf></Stock>"
}]

Function Service Metrics

*

*Blue = Connections (count)

*Red = Function Executions (count)

*White = Requests (count)

A: I'm not sure if you have figured the issue here, but here are some insights for others in a comparable situation.
Firstly, probation is the outcome when the destination is not healthy, for which Event Grid would still attempt deliveries.
Based on the graph, it looks like functions hit the 100 executions mark and then took a while to scale out for the next 100. You could get better results by tweaking the host.json settings depending on what each function execution does.
Including scale controller logs could shed more light into what is happening internally when scaling out.
Also, another option would be to send events into service bus or event hubs first and then have a function run from there.


text:
Q: Is there a way to use variables within a systemPath for a system-scope dependency? I am currently in the process of creating a mod for a game. I need to include dependencies that are common across all platforms (Win and Mac), as well as parts of Apache Commons in the jar. Due to how this is going to be distributed via the Steam Workshop, I am not allowed to distribute dependency jars alongside the mod, thus everything must be included in a single jar.
I build via mvn package. My pom.xml is:
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <groupId>Flameborn</groupId>
    <artifactId>InSpire</artifactId>
    <version>0.0.1</version>
    <description>Blind Accessibility Interface for Slay the Spire</description>
    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <maven.compiler.source>1.8</maven.compiler.source>
        <maven.compiler.target>1.8</maven.compiler.target>
        <SlayTheSpire.version>01-27-2020</SlayTheSpire.version>
        <ModTheSpire.version>3.8.0</ModTheSpire.version>
    </properties>
    <dependencies>
        <dependency>
            <groupId>com.evacipated.cardcrawl</groupId>
            <artifactId>modthespire</artifactId>
            <version>${ModTheSpire.version}</version>
            <scope>system</scope>
            <systemPath>${SteamPath}/workshop/content/646570/1605060445/ModTheSpire.jar</systemPath>
        </dependency>
        <dependency>
            <groupId>basemod</groupId>
            <artifactId>basemod</artifactId>
            <version>5.0.0</version>
            <scope>system</scope>
            <systemPath>${SteamPath}/workshop/content/646570/1605833019/BaseMod.jar</systemPath>
        </dependency>
        <dependency>
            <groupId>org.apache.commons</groupId>
            <artifactId>commons-lang3</artifactId>
            <version>3.10</version>
        </dependency>
        <dependency>
            <groupId>org.apache.commons</groupId>
            <artifactId>commons-exec</artifactId>
            <version>1.3</version>
        </dependency>
    </dependencies>
    <profiles>
        <profile>
            <id>platform-windows</id>
            <activation>
                <os>
                    <family>windows</family>
                </os>
            </activation>
            <properties>
                <SteamPath>C:/Program Files (x86)/Steam/steamapps</SteamPath>
            </properties>
            <dependencies>
                <dependency>
                    <groupId>com.megacrit.cardcrawl</groupId>
                    <artifactId>slaythespire</artifactId>
                    <version>${SlayTheSpire.version}</version>
                    <scope>system</scope>
                    <systemPath>${SteamPath}/common/SlayTheSpire/desktop-1.0.jar</systemPath>
                </dependency>
            </dependencies>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-antrun-plugin</artifactId>
                        <version>1.8</version>
                        <executions>
                            <execution>
                                <phase>package</phase>
                                <configuration>
                                    <target>
                                        <copy file="target/${project.artifactId}.jar" tofile="${Steam.path}/common/SlayTheSpire/mods/${project.artifactId}.jar"/>
                                    </target>
                                </configuration>
                                <goals>
                                    <goal>run</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>
        <profile>
            <id>platform-mac</id>
            <activation>
                <os>
                    <family>mac</family>
                </os>
            </activation>
            <properties>
                <SteamPath>${user.home}/Library/Application Support/Steam/steamapps</SteamPath>
            </properties>
            <dependencies>
                <dependency>
                    <groupId>com.megacrit.cardcrawl</groupId>
                    <artifactId>slaythespire</artifactId>
                    <version>${SlayTheSpire.version}</version>
                    <scope>system</scope>
                    <systemPath>${SteamPath}/common/SlayTheSpire/SlayTheSpire.app/Contents/Resources/desktop-1.0.jar</systemPath>
                </dependency>
            </dependencies>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-antrun-plugin</artifactId>
                        <version>1.8</version>
                        <executions>
                            <execution>
                                <phase>package</phase>
                                <configuration>
                                    <target>
                                        <copy file="target/${project.artifactId}.jar" tofile="${Steam.path}/common/SlayTheSpire/SlayTheSpire.app/Contents/Resources/mods/${project.artifactId}.jar"/>
                                    </target>
                                </configuration>
                                <goals>
                                    <goal>run</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>
    </profiles>
    <build>
        <finalName>${project.artifactId}</finalName>
        <plugins>
            <plugin>
                <groupId>com.coveo</groupId>
                <artifactId>fmt-maven-plugin</artifactId>
                <version>2.10</version>
                <configuration>
                    <verbose>false</verbose>
                    <filesNamePattern>.*\.java</filesNamePattern>
                    <skip>false</skip>
                    <skipSortingImports>false</skipSortingImports>
                    <style>google</style>
                    <displayFiles>false</displayFiles>
                </configuration>
                <executions>
                    <execution>
                        <goals>
                            <goal>format</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>2.3.1</version>
                <configuration>
                    <source>1.8</source>
                    <target>1.8</target>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-shade-plugin</artifactId>
                <version>3.2.4</version>
                <executions>
                    <execution>
                        <phase>package</phase>
                        <goals>
                            <goal>shade</goal>
                        </goals>
                        <configuration>
                            <minimizeJar>true</minimizeJar>
                            <filters>
                                <filter>
                                    <artifact>org.apache.commons:commons-lang3</artifact>
                                    <includes>
                                        <include>**</include>
                                    </includes>
                                </filter>
                                <filter>
                                    <artifact>org.apache.commons:commons-exec</artifact>
                                    <includes>
                                        <include>**</include>
                                    </includes>
                                </filter>
                            </filters>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
        </plugins>
        <resources>
            <resource>
                <directory>src/main/resources</directory>
            </resource>
            <resource>
                <directory>src/main/resources</directory>
                <filtering>false</filtering>
                <excludes>
                    <exclude>ModTheSpire.json</exclude>
                </excludes>
            </resource>
            <resource>
                <directory>src/main/resources</directory>
                <filtering>true</filtering>
                <includes>
                    <include>ModTheSpire.json</include>
                </includes>
            </resource>
        </resources>
    </build>
</project>

I am getting the following errors:
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-shade-plugin:3.2.4:shade (default) on project InSpire: Error creating shaded jar: Some problems were encountered while processing the POMs:
[ERROR] [WARNING] 'dependencies.dependency.systemPath' for com.megacrit.cardcrawl:slaythespire:jar should use a variable instead of a hard-coded path /Users/User/Library/Application Support/Steam/steamapps/common/SlayTheSpire/SlayTheSpire.app/Contents/Resources/desktop-1.0.jar @ line 168, column 19
[ERROR] [WARNING] 'profiles.profile[platform-mac].dependencies.dependency.systemPath' for com.megacrit.cardcrawl:slaythespire:jar should use a variable instead of a hard-coded path /Users/User/Library/Application Support/Steam/steamapps/common/SlayTheSpire/SlayTheSpire.app/Contents/Resources/desktop-1.0.jar @ line 154, column 23
[ERROR] [ERROR] 'dependencies.dependency.systemPath' for com.evacipated.cardcrawl:modthespire:jar must specify an absolute path but is ${SteamPath}/workshop/content/646570/1605060445/ModTheSpire.jar @ line 175, column 19
[ERROR] [ERROR] 'dependencies.dependency.systemPath' for basemod:basemod:jar must specify an absolute path but is ${SteamPath}/workshop/content/646570/1605833019/BaseMod.jar @ line 182, column 19
[ERROR] : 4 problems were encountered while building the effective model for Flameborn:InSpire:0.0.1
[ERROR] [WARNING] 'dependencies.dependency.systemPath' for com.megacrit.cardcrawl:slaythespire:jar should use a variable instead of a hard-coded path /Users/User/Library/Application Support/Steam/steamapps/common/SlayTheSpire/SlayTheSpire.app/Contents/Resources/desktop-1.0.jar @ line 168, column 19
[ERROR] [WARNING] 'profiles.profile[platform-mac].dependencies.dependency.systemPath' for com.megacrit.cardcrawl:slaythespire:jar should use a variable instead of a hard-coded path /Users/User/Library/Application Support/Steam/steamapps/common/SlayTheSpire/SlayTheSpire.app/Contents/Resources/desktop-1.0.jar @ line 154, column 23
[ERROR] [ERROR] 'dependencies.dependency.systemPath' for com.evacipated.cardcrawl:modthespire:jar must specify an absolute path but is ${SteamPath}/workshop/content/646570/1605060445/ModTheSpire.jar @ line 175, column 19
[ERROR] [ERROR] 'dependencies.dependency.systemPath' for basemod:basemod:jar must specify an absolute path but is ${SteamPath}/workshop/content/646570/1605833019/BaseMod.jar @ line 182, column 19


text:
Q: using buttons in netbeans gui frame Ok, so I'm pretty noob at JAVA, and programming in general really.  I'm trying to make a rock, paper, scissors app that with run with a GUI interface.  What I'm trying is the simplest thing I thought of, press a button for your choice (r, p, or s) and that will make a variable used in the rest of the program to compare to the computer's choice, finding the winner, etc.  I already have the program worked out, the problem is the GUI stuff.  I'm using netbeans and a JFrame, which is completely new to me.  I have a lot of questions, and maybe there is a nice tutorial out there for me someone could link to, but using the official netbeans site hasn't helped much so far.  Anyways:

*

*I'm not sure where to put my main method code that would be in the text program, make a new class, or put it in the main method of the frame I use.

*Because of that, the reason I can't even compile is that the main function is trying to use the variable I want to make in the button. The whole order of operation is unknown to me I guess.  I looked at the netbeans examples and I think I could make this work by doing something a little more complex, but it seems unnecessary?

A: Here's a good place to start learning about Swing.  I would caution you that using NetBeans is great if you are trying to crank out a big GUI quickly, but may cause more problems than it solves if you are not already familiar with how Swing works.
A few tips from what I have learned on my projects:

*

*Think through what the underlying model of the program will be before starting to write the GUI.  For example, perhaps you would use a game class like this pseudocode:

Start a new game
   Get the player's choice
   Randomly generate a choice for the computer
   Compare the choices
      if the player's choice is stronger
         player wins
      else computer wins
   return the winner

*

*Using the Model-View-Controller pattern is a good place to start when you have a GUI to build.  This ensures that there is separation between the components of your program; if you ever need to change the view or the model, you don't break the other components.

*What this generally means in practice for Java is that you wrap the view and controller together, generally extending a JFrame as qpingu pointed out.  The JFrame will need a reference to your model class and the panels that contain the various controls.

A: The place to start putting in code like you are used to is in the source package directory usually named what you called you new project: YourFileName.java
The key is to look for the name you added in the set up in the names of files in the new project.
Once in, there are some methods that start the application for you. And at the bottom is where the main() resides which you and I are most familiar with :) .
    ...

    @Override
    protected void configureWindow(java.awt.Window root) {
    }

    /**
    * A convenient static getter for the application instance.
    * @return the instance of DesktopApplication1
    */

    public static DesktopApplication1 getApplication() {
        return Application.getInstance(DesktopApplication1.class);
    }

    /**
    * Main method launching the application.
    */

    public static void main(String[] args) {
    launch(DesktopApplication1.class, args);

    }
}

Personally, I prefer desktop application because it starts out with a lot of pre-generated code for you.

A: You want to find some articles and tutorials on Swing.
Here's a little bit of code to help you:
// RockPaperScissors is the JFrame as well as the KeyListener.
// You could make another class to handle the key presses instead by doing:
// addKeyListener(new myOtherClass());
// So long as myOtherClass implements KeyListener
class RockPaperScissors extends JFrame implements KeyListener {
  public RockPaperScissors() {
    // Listen for any key presses.
    addKeyListener(this);
  }

  public void keyPressed(KeyEvent e) {
    // Figure out which key was pressed based on it's code.
    // http://java.sun.com/j2se/1.4.2/docs/api/java/awt/event/KeyEvent.html
    switch (e.getKeyCode()) {
      case e.VK_R:
        // Rock
      break;
      case e.VK_P:
        // Paper
      break;
      case e.VK_S:
        // Scissors
      break;
    }
  }

  // You can use these if you want, but we don't care about them.
  public void keyReleased(KeyEvent e) { }
  public void keyTyped(KeyEvent e) { }
}

void main() {
  // Set up the GUI (which is just a JFrame!)
  new RockPaperScissors();
  // The main program can exit because the JFrame runs on it's own thread.
}


text:
Q: How to add more than one RSS Feed Link for wordpress I'm using code to change Rss Feed Link for my wordpress site, it's working but I don't know how to add more than one rss link appear when someone click on browser Rss Icon, I need these links to appear for all pages below each other for categories "products", "blog" and "news".
here is the code which I'm using to change my rss link
add_filter('feed_link','custom_feed_link', 1, 2);

function custom_feed_link($output, $feed) {

    $feed_url = 'http://MYSITE/category/products/feed';

    $feed_array = array('rss' => $feed_url, 'rss2' => $feed_url, 'atom' => $feed_url, 'rdf' => $feed_url, 'comments_rss2' => '');
    $feed_array[$feed] = $feed_url;
    $output = $feed_array[$feed];

    return $output;
}

I tried to return array, but it can't work, what I should do ?

A: Text that is displayed after you click on browser RSS icon depends on the feed reader you are using. I don't think you can modify what it displays directly through WordPress (correct me if I'm wrong).
A simple workaround to achieve something similar to what you want would be placing feed links to different categories. You can place a link for every category somewhere on the page using get_category_feed_link() function.
Edit:
Some feed readers (Chrome's RSS feed Reader) get feeds from sites header. In this case you can get them to display feed by adding link directly to header.php inside the <head>. Link could be formatted something like this:
<link rel="alternate" type="application/rss+xml" title="Category1 feed" href="<?php echo get_category_feed_link( get_cat_ID( 'category1' ) ); ?>" />


text:
Q: How to construct a Bitstring of variable length in C I want to write a function rand_bit_string(int k, int n) in C which generates a random bit string of length n containing exactly k ones.
My question is, how to design a data structure that represents the bit string of length n. The smallest data type in C is char which contains 8 bits. So I think about returning a char pointer which points to the first element of a char array. The array's size have to be the ceiling of n/sizeof(char).

A: sizeof(char) is always 1, so dividing n by it will have no effect.
The size of allocation in chars can be computed as (n+7)/8. Adding 7 to n before performing integer division ensures that there is enough space in cases when n is not divisible by 8.
As far as the return value goes, you could return char*, but then the caller would need to maintain the connection between n that they pass and the char* they got back. Alternatively, you could create a struct to keep the two together:
struct bit_sequence {
    char *bits;
    size_t n;
};

You could also add functions for accessing bits of bit_sequence, e.g.
int get_bit(bit_sequence *seq, size_t index) {
    if (index > seq->n) {
        // Report an error
    }
    size_t pos = index / 8;
    size_t bit = index % 8;
    return 1 & ((seq->bits[pos]) >> bit);
}


text:
Q: PGF for the Type I Negative binomial Distribution (Problem in Series) I was trying to prove the Probability Generating Function for the Type I Negative binomial Distribution.
My attempt,
Let $P(\text{failure})=1-p=q$
$$P(X=x)=\binom{x-1}{k-1}p^kq^{x-k}\space ,x=k,k+1,k+2,...$$
$$G_{x}(t)=\sum_{x=k}^{\infty}\binom{x-1}{k-1}t^xp^kq^{x-k}$$
I was stuck at here. So I tried to look it online and I got the next step which is
$$=(pt)^k\sum_{x=k}^{\infty}\binom{x-1}{k-1}(qt)^{x-k}$$
Can someone explain it to me how my last step to become the step I found online? Thanks in advance.


text:
Q: Eigenvectors, bilinear forms and orthonormal bases
I have calculated (a) to be $(1,-2,2)^t, (-2,1,2)^t, (2,2,1)^t$. For (b) I have made all of these of unit length ie taken 1/3 of each vector. I have verified these are orthonormal by checking $<v1,v2>=<v1,v3>=<v2,v3>=0$. I have then computed $det[v1,v2,v3]$ and found it not equal to zero, so vectors are LI, matrix is of rank 3, so $v1,v2,v3$ form an orthonormal basis. This completes (b).
I am however stuggling with (c). I have said $I=C^t*[v1,v2,v3]C$ but don't know where to go from here. Any help would be great!

A: Assuming that $B$ is defined to be the transformation of $A$ into the new coordinates (this needs to be clarified as the question doesn't say what $B$ is meant to be), if you take $C=\frac13[v1,v2,v3]$ then we have $$C=\frac13\begin{pmatrix}1&-2&2\\-2&1&2\\2&2&1\end{pmatrix}$$
and so $C=C^t$ and $CC=I$.\begin{align}B=C^t AC&=\frac19\begin{pmatrix}1&-2&2\\-2&1&2\\2&2&1\end{pmatrix}\begin{pmatrix}1&-2&2\\-2&1&2\\2&2&1\end{pmatrix}\begin{pmatrix}1&-2&2\\-2&1&2\\2&2&1\end{pmatrix} \\ &=\frac19\begin{pmatrix}1&-2&2\\-2&1&2\\2&2&1\end{pmatrix}\begin{pmatrix}5&-4&-2\\-10&2&-2\\10&4&-1\end{pmatrix} \\&=\frac19\begin{pmatrix}45&0&0\\0&18&0\\0&0&-9\end{pmatrix} \\&=\begin{pmatrix}5&0&0\\0&2&0\\0&0&-1\end{pmatrix}.\end{align}
We can see that this is not an inner product, as the vector $(1,1,\sqrt7)$ in the new basis would then have norm $0$.


text:
Q: Website and clickable items on iPad/iPhone I have been building a website so that it is responsive to tablets such as iPhone and iPad, however I'm having an issue with clickable items.
For instance, I currently have my navigation "position:fixed" so that regardless of how far you scroll down the page it is always there. The problem I am having though is after you click on the dropdown menu and select a section to jump to when I go back to select another section it doesn't work. I have to scroll a little bit to activate the navigation so that I can click on the menu again.
Can anyone help me out please? Thanks!

A: Have you tried using the touchevent?
var ua = navigator.userAgent,
event = (ua.match(/iPad/i)) ? "touchstart" : "click";

$("put your selector here").bind(event, function(e) {

});


text:
Q: Cookie is not persisting across multiple pages PHP I'm going nuts figuring this out. I'm new to PHP
I'm simply trying to put a querystring variable inside a cookie and have it available across all pages on the site. What's happening now is that it only sets the cookie when there is a querystring and the cookie is gone once I go to another page.
All my php pages have this code at the top:
<?php

$expire=time()+60*60*24*30;

if (isset($_GET['v'])) {
$thev = $_GET['v'];

if (!isset($_COOKIE["ckv"])) {
setcookie("ckv", $_GET['v'], $expire);
}
} else if (isset($_COOKIE["ckv"])) {
$thev = $_COOKIE["ckv"];
} else {
$thev = 'nothing';
}
?>

*

*page1 WORKS! (shows cookie)

*page1 no querystring WORKS! (shows cookie)

*page2 BROKEN. (Cookie gone!)

** These were clicked in order. So page 3 should be displaying the cookie
Thank you

A: I agree with the above answer, look into using SESSIONS in stead of $_COOKIE. They are much more flexible and significantly safer than cookies
http://us3.php.net/manual/en/features.sessions.php

A: There can be three answers I can see for this.
The most likely is that page 1 and page 2 are in different directories. By default a cookie is placed in the current directory (as specified in the browser - ignoring any includes/apache redirects etc), and will apply to that directory and below ONLY. You if you have
/dir1/page1
/dir2/page2

then a cookie in page 1 will not, be default, be available in page 2.
You can get around this by specifying the path (see documentation). Here you declare the directory to which the cookie wil apply - most commonly you would set this to '/' (root) which means apply to any page in the application.

Now some gotchas:
As you've already got a cookie in '/dir1/', if you modify your code to include a path of '/' and run, then you'll actually have two cookies - one at '/' and one at '/dir1/'. Your page 1 will still get the '/dir1/' cookie unless you delete it first. Also check you don't have a blank cookie in '/dir2/' as well (i.e. that you get "nothing" in your code, not blank space - which means you have a cookie but with a blank value). Having cookies in sub-directories can cause a lot of frustration.
Other possible causes are to do with caching (make sure you're not caching values) and also different domains (you can't share cookies across domains, and if you want to share across sub-domains then you need to specify the root domain - see documentation).


text:
Q: Editors aren't attributed on answers The new post attribution works similar to the website with OP attributed first and the most recent editor attributed adjacent to that. This works as expected on questions but answers are missing any attribution for editors and simply have the "Edited..." text.
The following question and answer were both edited by me, for example...
Question, with proper editor attribution:

Answer, with no editor attribution:

*

*App Version: 1.6.2.1

*Device: iPhone 6s

*OS Version: Version 10.0.1 (Build 14A403)

A: This will be fixed in 1.6.2.5.
The last editor was never displayed before so we didn't bother fetching it.
Note that for community wikis and edits by the post author, the editor still won't appear.  This matches the web behavior.


text:
Q: Separate elements of an array into separate text fields (PHP) Ok, This has been playing my head for a while now - and I know it's simple....but tiredness is supplying me with a mental block...hope you guys can help!
I have this long string which which i have exploded into an array:
Array
(
[0] => 15896,10
[1] => 15897,10
[2] => 15898,1
 .....(to [95] =>)

Now what I want to do is iterate through each line of the array, and put the 15896 numbers into one text box, and the 10 into a separate text box.
Annoyingly I've done something like this before on a previous application, although I can't seem to apply the same syntax across (Last time i had a 2d array, and iterated through with 2 foreach loops....
Thanks in advance!
Current Code:
$getString = mysql_query("SELECT orderString FROM stock_orders WHERE orderID    ='".$_GET["type"]."'");
while($row = mysql_fetch_array($getString)){
$order = $row["orderString"];
}
$newArray = array();

$newArray = explode(" - ", $order);

A: Use something like:
$newArray = array();
$newArray = explode(" - ", $order);

foreach ($newArray as $arrayItem)
{
  $parts = explode(',', $arrayItem);
  echo "<input type='text' value='$parts[0]'> - <input type='text' value='$parts[1]'><br/>";
}

If you're putting the values in text fields, then you should pull and use stock_order ID's otherwise you won't be able to identify them.

A: Assuming that your seconds dimension is a string.
$array = Array(
    0 => "15896, 10",
    1 => "15897, 10"
    );

foreach ($array as &$v) {
    $result = preg_split("/[\s]*,[\s]*/", $v);

    foreach ($result as &$r) {
        echo "<input type='text' value='".$r."'/>";
    }
//    echo "<\br>";
}


text:
Q: SELECT column WHERE (type = 'S' OR type = 'B') but perform different actions depending on whether type = 'S' or 'B' ))Hi all, currently Im stuck in an issue, hope some good PostgreSQL fellow programmer could give me a hand with it. This is my table...

I only want to select one "time" row, either WHERE "time_type" = 'Start' OR "time_type" = 'Break', but only one, the one that is at the bottom row (descending) (ORDER BY "fn_serial" DESC LIMIT 1).
Im successfully doing it by using this Trigger Function...
CREATE OR REPLACE FUNCTION timediff()
  RETURNS trigger AS
$BODY$
DECLARE
prevtime character varying;

BEGIN
SELECT t.time FROM table_ebscb_spa_log04 t WHERE t.fn_name = NEW.fn_name AND (t.time_type = 'Start' OR time_type = 'Break') ORDER BY t.fn_serial DESC LIMIT 1 INTO prevtime;
  IF NOT FOUND THEN
    RAISE EXCEPTION USING MESSAGE = 'NOT FOUNDED';
  ELSE
    NEW.time_elapse := prevtime
  END IF;
return NEW;
END
$BODY$
  LANGUAGE plpgsql VOLATILE
  COST 100;
ALTER FUNCTION timediff()
  OWNER TO postgres;

But in my script I would like to perform different actions depending on whether "fn_type" = 'Start' OR "fn_type = 'Break', I mean where "prevtime" variable came from, eg:
IF "prevtime" came from "fn_type" = 'Start' THEN
RAISE EXCEPTION USING MESSAGE = 'PREVTIME CAME FROM START';
ELSIF "prevtime" came from "fn_type" = 'BREAK' THEN
RAISE EXCEPTION USING MESSAGE = 'PREVTIME CAME FROM BREAK';

I can hardly imagine a way to do that, so I would like to ask for suggestions.
I guess one way to achieve this could be, create a sub IF, to check which one ('Start' OR 'Break') is at the bottom row (descending). How could I do that? or what could be a better approach?
Thanks Advanced.

A: Use more than one variable.
CREATE OR REPLACE FUNCTION timediff()
RETURNS trigger AS
$BODY$
DECLARE
prevtime character varying;
time_type character varying;

BEGIN
SELECT t.time, t.time_type FROM table_ebscb_spa_log04 t WHERE t.fn_name = NEW.fn_name AND (t.time_type = 'Start' OR time_type = 'Break') ORDER BY t.fn_serial DESC LIMIT 1    INTO prevtime,time_type;
IF NOT FOUND THEN
RAISE EXCEPTION USING MESSAGE = 'NOT FOUND';
ELSE
NEW.time_elapse := prevtime;
RAISE NOTICE "THE TIME CAME FROM %", time_type;
END IF;
return NEW;
END
$BODY$
LANGUAGE plpgsql VOLATILE
COST 100;
ALTER FUNCTION timediff()
OWNER TO postgres;


text:
Q: Content-Disposition Security So here's the setup:
I have a simple Flask app with Flask-WTF.
A user submits a form with one text field - filename.
The form has a CSRF token (from Flask-WTF.)
If a user submits the form and validates, then the browser downloads an autogenerated file (i.e. not a file from the server filesystem) with the filename submitted.
The important code is:
response.headers['Content-Disposition'] = 'attachment; filename={0}.lsc'.format(filename)

How safe is that?
In other words what could a malicious user possibly do if they could insert arbitrary text into the Content-Disposition header?

A: They won't be able to do anything to the server, and it should be safe on the client side if they implement RFC 2616 properly:

The receiving user agent SHOULD NOT respect any directory path
  information present in the filename-parm parameter, which is the only
  parameter believed to apply to HTTP implementations at this time. The
  filename SHOULD be treated as a terminal component only.

However, for a full consideration of this issue, see RFC 2183: Communicating Presentation Information in Internet Messages: The Content-Disposition Header Field, specifically the Security Considerations section. (RFC 2183 applies to mail messages, but is equally applicable to HTTP user agents.)


text:
Q: In Azure DevOps pipelines, how do I login to AZ CLI using the service principle details returned from the addSpnToEnvironment parameter? I essentially have to run a Python script that has AZ CLI commands baked into the script and get spawned as processes from the subprocess module. In order for these commands to run, I need to be logged in to AZ CLI.
I have a AZ CLI task in my pipeline of which setting the addSpnToEnvironment = true  provides me the $env:servicePrincipalId, $env:servicePrincipalKey and $env:tenantId. My question is, how can I use these details to now sign in to AZ CLI so that the context is maintained in the task and the AZ CLI commands in my Python script recognize this and can execute?

A: You can log into az cli using the service principal.  See below:
az login --service-principal --username $env:servicePrincipalId --password $env:servicePrincipalKey --tenant $env:tenantId

See document here for more information.


text:
Q: Integrating the maximum function How can the following expression be calculated:
$$ \int_0^1 \int_0^1 \max(0,u_1+u_2-1) du_1du_2 $$

A: HINT
Integration is over a sqaure. $u_1+u_2 \ge 1$ only for the upper-left triangle of the squre, so the lower triangle has integration of $0$

A: $ \max(0,u_1+u_2-1)$ is nonzero when $u_1+u_2-1>0$, wich you can write $u_1>1-u_2$.
Then
$$\int_0^1\int_{u_1=1-u_2}^1(u_1+u_2-1)\,du_1\,du_2=\int_0^1\left.\left(\frac{u_1^2}2+u_1u_2-u_1\right)\right|_{1-u_2}^1\,du_2.$$
The rest is yours.


text:
Q: Getting a sane terminal going on OS X I am normally a Linux user and my default terminal is urxvt, but because of school (office documents and so) I bought a new laptop - a Macintosh. I think the system itself works nicely, though the bundled terminal is horrible.
I first tried iTerm2, but it doesnt seem to emulate xterm correctly - gnu screen and irssi in combination makes stuff go wrong like character encoding. I guess its because iTerm2 is not able to imitate xterm perfectly. So i went on to find another, sane, terminal that is actually bundled as an cocoa app, so i can get it working with fullscreen, accessibility from spotlight and so on. I was out of luck. Havent been able to find any xterm or urxvt cocoa app package at all.
I have installed urxvt via homebrew package manager, but its cocoa X11 app layer doesnt make fullscreen available, it seems. The window also seems to "weigh" more than e.g. iTerm2 when i moving around and so on. And also, its not available via spotlight because it gets installed to /usr/local/bin (symlinking to /Applications doesnt work) so i either have to open it via another terminal every time, or leave it in the dock. No thank you.
What are my options for getting a sane terminal on Mac OS X?

A: I'm actively working on fixing any remaining rendering issues in iTerm2. Many of them are font-related: fonts on OSX do not always do the "right thing" with regard to character width. The "Menlo" font is well behaved in this instance; try that. If it still fails, please send me details and I'll try to fix it. If there are xterm emulation bugs, those would be very high priority bugs and would get immediate attention. Please generate a session log and file a bug with that if you're able.

A: In 2011 why are you using a text-based IRC client?  If irssi doesn't behave, just use xchat.
Terminal.app doesn't have all of iterm2's bells/whistles but it's hardly "horrible".  It does tabs, has profiles for colors/etc., and can be set for unlimited scrollback.  That's 99.9% of everything I need a terminal emulator to do.  The other .1%?  I'm here because I can't figure out how to change iterm2's character encoding.  Terminal.app lets me choose a "DOS" encoding that renders line drawing characters, used by the console interface to Infortrend disk arrays.


text: Q: Vectorizing multidimensional matrix products with numpy (einsum) I would like to perform a series of rotations with mxm arrays on a series nxm matrices in a vectorized fashion (1000xmxm dot 1000xnxm --> 1000xnxm).  This question seems to have the answer if my nxm matrices were 1xm vectors, but unfortunately they are not.  I was wondering if there is an einsum that I could use, or some other matrix manipulation to not have to loop over 1000 times.


text:
Q: La etiqueta  arruina toda la composición estoy intentando que quede todo seguido pero queda como la imagen el problema es una etiqueta  que no encuentro en el código pero en el buscador si aparece uso semantic funciona poniendo  pero no queda para darle clic tambien intente meter todo en una sola etiqueta y no pude (#relleno |soy algo nuevo en stackoverflow y no me deja publicarlo cuantos caracteres son?)

Safe Content

Publicaciones Recientes

Name

02/12/2020

Name

02/12/2020

Name

02/12/2020

Name

02/12/2020

Name

02/12/2020

Name

02/12/2020

A: la solución fue agregar un  donde se ponia div class="ui grid stackable container" style="margin-top: 20px; y listo solucionado.

Safe Content

Publicaciones Recientes

Name

02/12/2020


text:
Q: JavaFX: Use a URL source for audio I'm able to host my images on imgur for my javafx project like so:
Image circle = new Image("http://imgur.com/7oW7ilC.png");

But when I try to do the same for audio files, it doesn't play the sound (no errors)
Media sound = new Media("http://enkrypton.github.io/filehost2017/hit.mp3");
MediaPlayer mediaPlayer = new MediaPlayer(sound);
mediaPlayer.play();

Is there a way I can use audio files from a URL the same way I use images?
Note that this is not a HTTP Error 403 since I'm able to load other images I have on my filehost.

A: The problem is that the sound URL is an http: URL, which returns an HTTP 301 response that redirects to an https: URL.  This is not considered secure, so Java won't automatically follow it.  For a full discussion of this, see URLConnection Doesn't Follow Redirect.
The easiest solution is to simply change your URL to use https::
Media sound = new Media("https://enkrypton.github.io/filehost2017/hit.mp3");


text:
Q: Keeping SASS Code DRY using Media Queries I have two media queries. One is for phones while the other is for tablets. They both call for the same exact styling. In this case what would be the best approach for keeping this code DRY?
$mobile-portrait: "only screen and (max-width: 680px)";
$tablet-portrait: "only screen and (min-device-width : 768px) and (max-device-width : 1024px) and (orientation : portrait)";

div {
    background: gray; margin: 0 auto; height: 50px; width: 50px;

    @media #{$mobile-portrait} {
        height: 100px; width: 100px;
    }

   @media #{$tablet-portrait} {
       height: 100px; width: 100px;
   }
}

A: I'm not sure that there's any good way to do this, but you could always just create multiple selectors. (I don't know if that's the best practice, but that's what I would do.)

@media #{$mobile-portrait},
@media #{$tablet-portrait} {
   height: 100px;
   width: 100px;
}

EDIT: The following is also valid.
@media #{$mobile-portrait}, @media #{$tablet-portrait} {
   height: 100px; width: 100px;
}

For aesthetic I prefer putting the selectors on multiple lines. When there are longer selectors, the line break helps differentiate between them.
I also prefer the styles on multiple lines. If you have more than about three or four in a selector, it can get confusing.
EDIT 2: The comma actually acts like a logical or when inside of a media query.
Per this MDN article:

comma-separated lists
Comma-separated lists behave like the logical operator or when used in media queries. When using a comma-separated list of media queries, if any of the media queries returns true, the styles or style sheets get applied. Each media query in a comma-separated list is treated as an individual query, and any operator applied to one media query does not affect the others. This means the comma-separated media queries can target different media features, types, and states.

Which means that the second @media is not necessary:
@media #{$mobile-portrait}, #{$tablet-portrait} {
    height: 100px;
    width: 100px;
}


text:
Q: Javascript: Best way to convert associative array to string and back the other way later? I have an associative array as follows:
var AssocArray = { id:0, folder:'Next', text:'Apple' };

Now I need to store this in a database, so I figure I would just convert this into a string, store it in the database and then pull it out of the database and put it back into a javascript array later on.
The catch is that the actual  # of items, and the array variables will be different every time (hence why I wanted to store it as one long string instead).
What's the best way to convert this associative array into a string, and then also vice versa, how to convert a string into an associative array?

A: There is nothing better than JSON for it:
var str = JSON.stringify(obj);
// >> "{"id":0,"folder":"Next","text":"Apple"}"

var obj = JSON.parse(str);
// >> Object({ id: 0, folder: "Next", text: "Apple" })


text:
Q: Can we find the inverse for a vector? Can we invert a vector like we do with matrices, and why?
I didn't see in any linear algebra course the concept of the "vector inverse", and I was wondering if there is any such thing, and if not, why.

A: The inverse of an object $a$ over some operation $\mathbb S\  @\ \mathbb S \Rightarrow \mathbb S$ with identity $e$ is the unique object $a^{-1}$ such that $a\ @\ a^{-1} = a^{-1}\ @\ a= e$.  $e$ itself must be such that given any object $b$, $b\ @\ e=e\ @\ b=b$.
Vector addition has an obvious inverse: since adding vectors is simply the same as adding their components in whatever basis you feel like, the additive inverse of $v$ has the opposite of those components.  But that's simply $-v$.
Scalar multiplication has no sensible vector inverse, because the inputs are necessarily from two different groups.
Dot product doesn't provide inverse elements, because the result of a dot product isn't a vector.  While it is possible to come up with a vector such that $a\cdot b=1$, there are an infinite number of such vectors, one for every $c$ such that $a\cdot c=0$.
Cross product doesn't provide inverse elements either: for any non-zero vector $a$, $a\times b = c$ has many possible values for $b$ that give the same $c$.
Linear transformation doesn't provide inverses for the vector: again, the inputs must necessarily be from two different groups, a vector and a matrix.
Componentwise multiplication $(a,b,c)(d,e,f)=(ad,be,cf)$, while it does provide an inverse for many values (reciprocal of each of the components), has huge hunks of non-invertible values (anywhere one of the components is $0$), and the inverse changes based on your choice of basis.
Wedge product produces a result in a different group: the result is an $m+n$-vector where $u$ is an $m$-vector and $v$ is an $n$-vector.
Outer product results in a matrix, which is in a different group.
Tensor product results in a tensor, which is, you guessed it, a different group.
Clifford product This one's interesting.  It works like the cross and dot product combined, and so it looks like it's not coming up with the same thing, but it's actually better than both: $v\cdot v$ gives just a scalar part (because the dot product will be non-zero and the cross product will be zero), and if you divide by that for $v^{-1} = \frac{v}{v\cdot v}$ you get a vector in the same direction as $v$ but whose magnitude is the reciprocal, so $v^{-1}\cdot v = 1$, and since we're in a land where scalars and vectors combine, this works perfectly.  Also, unlike the infinity that cross and dot products give us, there isn't any freedom because any adjustment to the vector changes the vector part of the product.  I don't know clifford algebra terribly well though so I don't know how well this works on things that are already scalar and vector combined...
Those are the ones I can think of.  I'm sure others know more operations than I do.

A: In some applications (e.g. extrapolation methods), one often considers what is called the Samelson inverse of a vector:
$$\mathbf v^{(-1)}=\frac{\bar{\mathbf v}}{\bar{\mathbf v}\cdot\mathbf v}=\frac{\bar{\mathbf v}}{\|\mathbf v\|^2}$$
(where the bar denotes complex conjugation), which can be easily shown to satisfy $\mathbf v^{(-1)}\cdot\mathbf v=\mathbf v\cdot\mathbf v^{(-1)}=1$ (the Moore-Penrose conditions in vector garb). (As usual, $\mathbf v\neq\mathbf 0$.)
Some references that use this inverse include this, this, and this.

A: It depends on what you mean by "inverse". Inverse in relation to the addition operation is just the negative of the vector $-v$. Because trivially $v + (-v) = 0$.

A: Perhaps this definition of the inverse vector will help you:
An inverse rectilinear vector   ā'  is a vector which is co-directed (in the same direction as) a vector ā and differs from it in magnitude according to:
$$ |\bar{a'}|=\dfrac{1}{|\bar{a}|} $$
Projections on the coordinate axes of inverse rectilinear vectors are equal according to:
$$\quad a'_{x}=\dfrac{a_{x}}{a_{x}^{2}+a_{y}^{2}+a_{z}^{2}};\quad a'_{y}=\dfrac{a_{y}}{a_{x}^{2}+a_{y}^{2}+a_{z}^{2}};\quad a'_{z}=\dfrac{a_{z}}{a_{x}^{2}+a_{y}^{2}+a_{z}^{2}} $$
An example of solving problems with this vector can be found here https://en.wikipedia.org/wiki/Talk:Cross_product#Cross_product_does_not_exist
https://doi.org/10.5539/jmr.v9n5p71
In this new definition, with inverse vectors, you can do the same actions as with conventional vectors (addition, multiplication by number, dot product, cross product). In this case, the dot product and the cross product allow us to obtain vector division (an analog of arithmetic division). We can carry the vector through the sign = as in arithmetic. These actions allow solving problems that previously could not be solved. For example, find the force from the torque in a coordinate-vector form.


text:
Q: Calculation of certain expectation Let $X=(x_1,x_2,x_3,x_4)^t \sim MultiNormal(0,\Sigma)$ where $\Sigma=(\sigma_{i,j})$ is a non-degenerate covariance matrix, then is there any simple way of calculating $Cov(X_1X_2,X_3X_4)$ without doing integration?(or simplified trick of doing this integration)

A: I'm afraid not. The distribution of the product of two normals is not pretty, let alone their covariance


text:
Q: Swagger Codegen not generating API Key example in it's documentation I am new to using Swagger Codegen so I assume I am doing something completely wrong. I have a remote swagger.json that I am using to generate a java client. Everything works and looks good but the example usages in the readme are not referencing any API key.
I don't have access to the remote API that I am using just trying to create a nice Java SDK for interfacing with it.
This is what I am using to generate the code.
java -jar C:/Development/codegen/swagger-codegen-cli.jar generate
  -a "client_id:XXXXXXXXXX,client_secret:YYYYYYYYYYYYY"
  -i https://BLAH/swagger/v1/swagger.json -l java
  -o C:/Development/workspace/JavaClient
  -c C:/Development/workspace/JavaClient/java-genconfig.json

Then the example that get's generated in the read me looks something like this...
public static void main(String[] args) {

    BusinessGroupApi apiInstance = new BusinessGroupApi();
    Integer businessGroupId = 56; // Integer | The ID of the business group to fetch.
    String apiVersion = "1.0"; // String | The requested API version
    try {
        BusinessGroup result = apiInstance.getBusinessGroupAsync(businessGroupId, apiVersion);
        System.out.println(result);
    } catch (ApiException e) {
        System.err.println("Exception when calling BusinessGroupApi#getBusinessGroupAsync");
        e.printStackTrace();
    }
}

Side Note
When I try running the example, I get an error saying
Failed to connect to localhost/0:0:0:0:0:0:0:1:443

Is there some setting that I need to set so it looks for the service at a remote location instead of locally?
EDIT
I realized that I needed to modify their swagger as they might not have everything fleshed out.
Swagger Codegen Version = 2.4.5
swagger.json (Excluded the paths and definitions) I also downloaded thiers locally and added some more info to make it generate more info. I added host, basePath, schemes, consumes, produces, security and securityDefinitions.
{
  "swagger": "2.0",
  "info": {
    "version": "1.0",
    "title": "removed"
  },
  "host": "apitest.removed.com",
  "basePath": "/removed/api",
  "schemes": [
    "https"
  ],
  "consumes": [
    "application/json"
  ],
  "produces": [
    "application/json"
  ],
  "security": [
    {
      "clientId": []
    },
    {
      "clientSecret": []
    }
  ],
  "securityDefinitions": {
    "clientId": {
      "type": "apiKey",
      "in": "header",
      "name": "client_id"
    },
    "clientSecret": {
      "type": "apiKey",
      "in": "header",
      "name": "client_secret"
    }
  }
}

This actually updated the readme to look how I would expect it to look
    ApiClient defaultClient = Configuration.getDefaultApiClient();

    // Configure API key authorization: client_id
    ApiKeyAuth client_id = (ApiKeyAuth) defaultClient.getAuthentication("client_id");
    client_id.setApiKey("YOUR API KEY");
    // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
    //client_id.setApiKeyPrefix("Token");

    // Configure API key authorization: client_secret
    ApiKeyAuth client_secret = (ApiKeyAuth) defaultClient.getAuthentication("client_secret");
    client_secret.setApiKey("YOUR API KEY");
    // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
    //client_secret.setApiKeyPrefix("Token");

    BusinessGroupApi apiInstance = new BusinessGroupApi();
    Integer businessGroupId = 56; // Integer | The ID of the business group to fetch.
    String apiVersion = "1.0"; // String | The requested API version
    try {
        BusinessGroup result = apiInstance.getBusinessGroupAsync(businessGroupId, apiVersion);
        System.out.println(result);
    } catch (ApiException e) {
        System.err.println("Exception when calling BusinessGroupApi#getBusinessGroupAsync");
        e.printStackTrace();
    }

Yet when I plug in my client_id and client_secret and try to run it I get a Exception in thread "main" java.lang.NullPointerException
    at removed.Tester.main(Tester.java:18). I think I might have the security definitions not set up correctly.
It's not OAuth but they require a client_id and client_secret to be passed in the header parameters.
EDIT 2
Exception when calling BusinessGroupApi#getBusinessGroupAsync
package.client.ApiException:
    at package.client.ApiClient.handleResponse(ApiClient.java:927)
    at package.client.ApiClient.execute(ApiClient.java:843)
    at package.client.api.BusinessGroupApi.getBusinessGroupAsyncWithHttpInfo(BusinessGroupApi.java:148)
    at package.client.api.BusinessGroupApi.getBusinessGroupAsync(BusinessGroupApi.java:133)
    at Tester.main(Tester.java:30)

Line 30 -> BusinessGroup result = apiInstance.getBusinessGroupAsync(businessGroupId, apiVersion);
EDIT 3
I enabled debugging with
defaultClient.setDebugging(true);

It looks like it's working but for some reason doesn't like my client_id and client_secret despite them both being the ones I used in postman.
--> GET <removed>/api/api/businessGroups/56?api-version=1.0 HTTP/1.1
Accept: application/json
client_secret: <removed>
client_id: <removed>
User-Agent: Swagger-Codegen/1.0-SNAPSHOT/java
--> END GET
<-- HTTP/1.1 403  (393ms)
Content-Length: 80
Content-Type: application/json
Date: Mon, 10 Jun 2019 20:05:07 GMT
QL-LB-Appliance: <removed>
QL-LB-Pool: <removed>
QL-LB-Server: <removed>
OkHttp-Sent-Millis: <removed>
OkHttp-Received-Millis: <removed>

{ "error": "invalid_client", "description": "wrong client_id or client_secret" }
<-- END HTTP (80-byte body)
Exception when calling BusinessGroupApi#getBusinessGroupAsync
<removed>.client.ApiException:
    at <removed>.client.ApiClient.handleResponse(ApiClient.java:927)
    at <removed>.client.ApiClient.execute(ApiClient.java:843)
    at <removed>.client.api.BusinessGroupApi.getBusinessGroupAsyncWithHttpInfo(BusinessGroupApi.java:148)
    at <removed>.client.api.BusinessGroupApi.getBusinessGroupAsync(BusinessGroupApi.java:133)
    at Tester.main(Tester.java:32)


text:
Q: Allow insertion only if count is less than 10 My database name is registration. In that I need to validate 2 conditions.

*

*where status="checked"

*status count is <10
I can insert data. Otherwise it displays some alert msg
Here is my code:
<?php
class Profile extends CI_Model{
   function add($data){
      $this->load->database();
      $count1="select count(status) from registration where status='checked'";
      $this->db->where($count1<10);
      $this->db->insert('registration',$data);
   }

A: I need some more information to solve your problem.
And you can use log.message('info', print_r($data, true)); to debug the code.
Before that you should set log threshold as 4 and log file path.
You can see the log file to check till where your code is executing and values are passing or not.
class Profile extends CI_Model{

   function add($data){
      $this->load->database();
      $count1="select count(status) from registration where status='checked'";
      if(count1 < 10) {
          $this->db->insert('registration',$data);
      } else {
          return false;

   }

Use that false value to show alert.

A: AFAIK You can´t do this with your aggregation query. Launch the query and, by code, check the count
 if ( data < 10 ){
    ...
 } else {
    ...
 }

Other option is make a SQL function.
Hope it helps

A: There must be no more than 10 "checked" registration records? What you do is okay so far then. You get the count from the db and only insert when the count is less than 10. But this check doesn't have to be done in the db. Simply trigger the insert only when count < 10:
<?php
  class Profile extends CI_Model{function add($data)
  {
    $this->load->database();
    $count1="select count(*) from registration where status = 'checked'";
    if($count1 < 10)
    {
      $this->db->insert('registration', $data);
    }
  }

That's it more or less. I don't use php regularly, so there might still be errors in this. Do you need an explicit commit? I don't know.


text:
Q: How do I determine the path to a binary of a process? Is there a way to find out the directory/disk location a process was started from? I am aware of the /proc mount but not really where to look inside of it.

A: Providing you've a process ID available, you can use:
readlink -f /proc/$pid/exe

(replace $pid by the process ID of a process)
If the process is not owned by you, you'll have to put sudo in front of it.
An example for determining the location of the command firefox:

*

*The output of ps ax -o pid,cmd | grep firefox :
22831 grep --color=auto firefox
28179 /usr/lib/firefox-4.0.1/firefox-bin

*28179 is the process ID, so you've to run:
readlink -f /proc/28179/exe

which outputs:
/usr/bin/firefox

A: The /proc way would be to inspect the exe link in the directory corresponding to the pid.
Let's take an example with update-notifier:
Find the pid, which is 15421 in this example:
egil@gud:~$ ps x | grep update-notifier
 2405 pts/4    S+     0:00 grep update-notifier
15421 ?        Sl     0:00 update-notifier

Look up the symbolic link:
egil@gud:~$ file /proc/15421/exe
/proc/15421/exe: symbolic link to `/usr/bin/update-notifier'

A: Maybe which is what you are looking for. For instance, on my system
which firefox

returns
/usr/bin/firefox

See also Find Path of Application Running on Solaris, Ubuntu, Suse or Redhat Linux .

A: Press Ctrl+Alt+T to go to a terminal and type:
ls -al /proc/{pid}/fd

and then check the output
This will list all the files your process is associated with...

A: All the commands in the other answers are good, but you could do even more - seeing how some process has been actually run before it got to the process list.
Run in terminal:
top

And while it is running, press keyboard C and you will get a command of the processes that was run.


text:
Q: How would I remove / replace a HashMap value based off what the Value is? I have a HashMap that shows a Car Parking space as the Key and a Vehicle Number Plate as the value, I have it so that the user inputs the number plate of the vehicle when they're retreiving their vehicle, I would then like to remove / replace the value for the number plate they just entered.
For example, the output would go from:
Parking Space: 1, Vehicle Registration: ABCD123

to this:
Parking Space: 1, Vehicle Registration: "Empty" / null

the tempVehicle.plate is a String that holds a user entered number plate.
    public int key = 1;
    HashMap<Integer, String> zone_1 = new HashMap<Integer, String>();

    public void addToZone1(Vehicle tempVehicle){
        if (key < 5) {
            zone_1.put(key, tempVehicle.plate);
            key++;
            System.out.println(zone_1.toString());
        }
        else {
            System.out.println("There is no more room in this Zone!");
        }

    }

This is the only thing I have been able to come up with for this, I hope it's possible, I should of looked before hand I guess.
    public void pickingVehicleUp() {
        System.out.println("Please enter number plate: ");
        input = new Scanner(System.in);
        String PLATE = input.nextLine();

        if (zone_1.containsValue(PLATE)) {

        }
    }

I was looking to add onto the if statement or change in completely, whatever I need to do to make this work, thanks in advance

A: You can get the key by value and if it is present remove it.
int key=-zone_1.stream()
      .filter(e -> e.getValue().equals(PLATE))
      .map(Map.Entry::getKey)
      .findFirst()
      .orElse(null);
zone_1.remove(key);

But I would suggest to use PLATE as a key as you are doing operations based on it.
Hope it helps

A: If I have understood your correctly, you would like to remove an entry from the map based on a value. In this case you can use Map.values and Collection.remove methods:
// {1=ABCD123, 2=XYZ8910} contents of the map

zone_1.values().remove("XYZ8910");

System.out.println(zone_1); // {1=ABCD123}

that's the simplest case. However, you might consider using plate as a key and parking space as a value if you are going to perform lookup by number plate. So instead of
  {1=ABCD123, 2=XYZ8910}
use
  {ABCD123=1, XYZ8910=2}

Which actually might be what you are really looking for.


text:
Q: Close duplicates only when the original was answered, and redirect future viewers to that original automatically I suggest that when someone finds an exact duplicate of a question he/she should do the following:
In case that original question was solved (an answer was accepted by the author of the question), this new duplicate should have a field (e.g. "duplicate_of") and the server will redirect automatically to that original answered question.
If the original question was not answered, even though this question is duplicate, it is actually a real world unsolved problem that yet another person has come across.
When someone googles for something and the results says "foo bar baz [closed]", he or she then needs to read through the comments and answers in order to find how to get to the other question. That is a waste of time! Why not let the site take them directly to the answer (and probably indicate redirection on the landing page as well).