text:
Q: Can I make windows treat Shortcuts to Folders the same it would a Folder? I'm moving some folders to an external storage drive and replacing them with a Shortcut, however the shortcut is listed in with the Files, not the Folders. It also doesn't show up in the folder Tree View that's on the left side of Windows Explorer.
Is there a way to make Windows Explorer treat a Shortcut Folder the same way it would a regular Folder?

A: In Windows Vista and 7 you can use NTFS symbolic link. Wikipedia states that "the NTFS symbolic link implementation provides full support for cross-filesystem links."
If you're not comfortable using the command line program mklink, you can use Link Shell Extension. After downloading and installing the software, follow the step-by-step guide in "Using Link Shell Extension". Basically you select the folder on the external/remote drive, click "pick link source", go back to the original drive and choose "drop as Symbolic Link".
I have not personally tested this method. Please let me know if my instructions don't work.

A: In Windows 10, Windows 7 Professional, and possibly other versions, you can create 'Folder shortcuts' without any command line work or any external tools. Here is how:

*

*Navigate to "%APPDATA%\Microsoft\Windows\Start Menu"

*In a separate window, open the parent folder of your new shortcut's target-folder (where the shortcut will point to)

*Right-click and drag the target-folder into the 'Start Menu' folder.

*Click 'Create shortcuts here'.

*Move the new shortcut to the desired location.

The shortcut will be sorted with folders, will show up in the navigation pane, and can be pinned to quick access (and the start menu).
However, if you go into the properties of the shortcut, you will not be able to change the target, keyboard shortcut, icon, or any other properties.
Additional Information:
The shortcut will also produce a bizarre path in explorer. For example, if a shortcut to the C:\Users\USER folder is placed in the C:\Users\USER\Documents folder, the following path will be shown when it is opened:
C:\Users\USER\Documents\USER-Shortcut

Any further navigations made from that point will show up in the 'clickable path' in explorer, but will not show up in the 'raw-text path'. For example, opening the shortcut, opening 'Documents', then opening the shortcut again, would produce the following paths:
This PC > System (C) > Users > USER > Documents > USER-Shortcut > Documents > USER-Shortcut

And
C:\Users\USER\Documents\USER-Shortcut

After this number of navigations, the main explorer pane will show a normal .lnk shortcut called 'target(.lnk)', which points to the folder-shortcut's target. If this is opened, it will act like any other .lnk file normally would, removing the unusual path.
You can also create shortcuts like this in windows XP Pro, and 2000. The thread I found this on is located at:
http://windowssecrets.com/forums/showthread.php/53274-Cool-trick-with-folder-shortcuts-(XP-Pro-2000)
To create the shortcuts in windows XP and 2000, follow the steps I have listed, but drag the shortcut onto the start button instead of the 'Start menu' folder. However, the above thread also mentions that in older versions, deleting the shortcut can delete the folder as well, so be cautious.

A: This has driven me crazy as well. Here's the only way I've found:
0) Let's say you've got 10 real folders and 10 shortcuts to folders elsewhere and all 20 are in a parent folder, and you're frustrated because the shortcuts alphabetize at the bottom instead of alphabetizing by name with the real folders.
1) make a dummy folder within the parent folder, named "zzz-real folders", to alphabetize at the bottom.
2) put all the real folders in this new folder
3) within that folder make shortcuts of all these real folders
4) drag the shortcuts out (up a level) to the original parent folder
5) voilà - now you have a list of alphabetized shortcuts that includes everything you wanted, with the dummy folder at the bottom

A: If this is still a problem for some people I'm a Windows 7 User my simple solution (Sadly I know Windows XP doesn't have this) after seeing the "Add to Network Idea" (As this was taking to long) I decided to Add the Folder to a Library with File Explorer so when I was asked by TSLPatcher for folder I would simply go the Library and then Select the folder.
My Situation
Was installing Old Mods into an Old Game (Star Wars: Kotor2) installed by Steam. Which meant the Mod Installer kept asking me for the folder through a simple Folder Tree Selector (Not the one where I can copy and Paste the Folder) so for every mod I had to navigate through every folder again and again and Steam hides its games deep within its own Folder (Hard Drive> Programs> Steam> Steamapps> Common> Folder)
Steps
1. Open Any Folder
2. Look for "Libraries" in a Side Bar to your Left
3. Right-Click on "Liraries" to add Library
4. Open New Library > Click "Include a Folder" > Then Choose Folder by Finding or Copy and Paste Folder Path (Info on how is Below...Instructions are Beginner and Advance Users...cause not everyone knows Rocket Science or is Stupid)

Alt to Step 3
[ALT] Left-Click "Libraries" > Instead of adding a Library just use anyone (If your doing this Temporary) > Click locations link beside "Includes" > Click on "Add" > either Navigate to Directory or Copy & Paste File Path from Address Bar into Bar beside "Folder:"
The Steps I took to get to a Folder without Library - Screenshots
The Steps I didn't take with Library - Screenshots

A: Don't use shortcuts. Instead, use hard links or volume mount points
Edit:
The simplest way is to create a mount point for the root folder, but it has a couple of limitations: you MUST redirect a whole folder and you MUST use a complete volume as destination. To do that, create an empty NTFS folder where you will redirect your volume and then open disk manager, select your volume, right-click on it and select "change drive letter and path", remove the drive letter mapping (if any and if you want to) and add the path of the EMPTY NTFS folder.
Hard links are a bit more delicate to use and, upon reflexion, it won't help you on since all links must point to the same volume (which isn't your case).

A: Use a junction. You can use the Link Shell Extension ( http://schinagl.priv.at ). Best of all, programs won't notice.

A: I was able to do something similar to what you're asking for in Windows XP, but pointing to network locations rather than an external drive, but you may still be able to get it to work.  Basically if you go to My Network Places and click the "Add a network place" option and type the path into the wizard it will generate a shortcut that is treated like a folder.  I've used this in my workplace when for various reasons I can't assign a drive letter to a network location that my users need to access frequently.  I'm sure you've solved your problem by now but hopefully this helps someone else at some point.

A: Here's what I did in Windows 7 Pro. I created a new folder in Documents with the same or similar name as my shortcut folder, then simply moved the shortcut "file" to my new folder. For example, I wanted all my scans to go someplace where I could find and access them easily. The original path of my scanned files folder was: Owner > My Pictures > CC4 (name of my scanner) > Scan. Here's what I did:

*

*Create a Shortcut of the scanned files folder; I named in "Scans from ..."

*Move that Shortcut to "Documents" - of course, this puts the Shortcut Folder down in the files list, not up among the main Folders where I want it and would normally look for it.

*I then created a new folder in Documents that I named "SCANS"

*I moved my new Shortcut that was listed among my files to the folder called SCANS. Done. Now my shortcut folder called "Scans from ..."  is listed in a folder called SCANS that is part of my regular folder hierarchy.


text:
Q: Would this algebra be still closed? I have a problem understanding when an algebra is closed.
For example the angular momentum algebra closes:
$$[L_i,L_j]=\epsilon_{ijk}L_k$$
but would the algebra still be closed if, for example, there would be a change like this:
$$[L_1,L_2]=L_3 + a$$
all the other brackets unchanged?

A: So two answers here.
Yes it would still be closed if you do one of two things: redefine the other Lie brackets to contain $L_3 +a$ instead of $L_3$ OR if you add $1$ to your Lie algebra so that you can break the sum apart. Technically $[L_3+a,L_1] = [L_3, L_1] + [a, L_1]$ requires that both $L_3$ and $1$ be in your Lie algebra. $1$ is not a standard element of the angular momentum Lie algebra ($\mathfrak{su}(2)$). Of course in a quantum mechanical world where these are operators, the Lie algebra actually exists inside of a larger structure, so maybe by borrowing from that, you can get away with not doing the above and the closure exists a fortiori. (Note that adding $L_3+a$ to your Lie algebra is the same as adding $1$ since $L_3+a-L_3 = a$.)
The other answer is: provided you have an actual Lie bracket, you can always close your Lie algebra when given a generating set. You just might not like what you end up with.. For instance, a Lie algebra closely related to yours which appears in mathematical physics is what I call a Smith type (based on the person that originally heavily studied them). It's generated by $[H, L] = -L$, $[H, R] = +R$, and $[L, R] = H^2$. At first glance this doesn't seem terrible, but using a certain trick (which I independently rediscovered almost 30 years later (no I'm not bummed out about it..)) that Smith employs, you can show that this Lie algebra, despite being finitely generated, is not finite dimensional. In other words, you have three base relations but from those you can create an infinite number of linearly independent elements in the algebra.

redpajama_set_name: RedPajamaStackExchange


text:
Q: Jest's --findRelatedTests doesn't notice JSON files I'm using jest --findRelatedTests in my pre-commit hook and it works fine. The only thing that it doesn't notice are changed JSON files.
If I have a JSON file like this
{
  "message": "Hello"
}

And I change it to something like this
{
  "messsssage": "Hello"
}

The following code would break, but it wouldn't be tested by jest --findRelatedTests
import data from './data.json'

export default () => data.message.length

Is there an option to configure Jest to watch out for changed JSON files also?
Edit: It seems to be a bug in the Jest package, you can find the issue here: https://github.com/facebook/jest/issues/7499

A: You need to add jest-json to your jest config.
{
  "setupTestFrameworkScriptFile": "jest-json"
}

Or if you're already using another test framework, create a setup file and require each of them:
require("jest-json");

For further information, you can refer here


text:
Q: resize using ffmpeg in python syntax error I'm trying to resize a video using ffmpeg in python but am having an error with the syntax.  I would expect it to be as easy as this (which is my code)
import ffmpeg

ffmpeg -i video.mov -vf "scale=250:150" newmovie.mp4

this gives an invalid syntax of this:
    ffmpeg -i video.mov -vf "scale=250:150" newmovie.mp4
                  ^
SyntaxError: invalid syntax

I tried this:
ffmpeg -i video.mov -vf scale=250:150 newmovie.mp4

and also putting everything file in quotations.  No luck.

A: As @Barmar wisely pointed out this is a shell command NOTa python command.
ffmpeg -i video.mov -vf "scale=250:150" newmovie.mp4

Correct documentation for python is found here:
https://github.com/kkroening/ffmpeg-python

A: Using ffmpeg in Python, here's the code wrapped up in a function:
def vid_resize(vid_path, output_path, width, overwrite = False):
    '''
    use ffmpeg to resize the input video to the width given, keeping aspect ratio
    '''
    if not( os.path.isdir(os.path.dirname(output_path))):
        raise ValueError(f'output_path directory does not exists: {os.path.dirname(output_path)}')

    if os.path.isfile(output_path) and not overwrite:
        warnings.warn(f'{output_path} already exists but overwrite switch is False, nothing done.')
        return None

    input_vid = ffmpeg.input(vid_path)
    vid = (
        input_vid
        .filter('scale', width, -1)
        .output(output_path)
        .overwrite_output()
        .run()
    )
    return output_path

so for your example just do:
newmovie_path = vid_resize("video.mov", output_path = "newmovie.mp4", width = 250)


text:
Q: SAS: Adding a column from one dataset to another without a key Dataset 1 is like this:
A     B     C
1     2     3
7     8     9

Dataset 2 is like this:
D     E     F
4     5     6

I would like to combine both datasets like so:
A     B     C     D     E     F
1     2     3     4     5     6
7     8     9     4     5     6

Is there a way to do this in SAS?
Thanks!

A: data data3;
   set data1;
   if _n_ eq 1 then set data2;
   run;

The works because variables that come from SET statement(s) are not initialized to missing at the top of the data step loop.


text:
Q: Display success message after file is copied I am fairly new to Android development so I thought I would start off with a basic app. When a button is pressed, it copies a file to the location written in the code (see my code below). When I press the install button and the file is copied to its location, I want a toast message to display "Successfully Installed or Error while copying file". How would I implement this?
public class TrialActivity extends Activity {

private ProgressDialog progressDialog;
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main);

    runDialog(5);
}

private void runDialog(final int seconds)
{
    progressDialog = ProgressDialog.show(this, "Please Wait...", "unpacking patch in progress");

    new Thread(new Runnable(){
        public void run(){
            try {
                Thread.sleep(seconds * 1000);
                progressDialog.dismiss();
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
        }
    }).start();

    ((Button)findViewById(R.id.button1)).setOnClickListener(new View.OnClickListener()
    {
      public void onClick(View paramView)
      {

      }

   {

              InputStream in = null;
              OutputStream out = null;
  String filename="savegame.bin";
  try {

                in = getResources().openRawResource(R.raw.savegame);
                out = new FileOutputStream("/sdcard/Android/data/files/" + filename);
                copyFile(in, out);
                in.close();
                in = null;
                out.flush();
                out.close();
                out = null;
              } catch(Exception e) {
                  Log.e("tag", e.getMessage());
              }

      }
      private void copyFile(InputStream in, OutputStream out) throws IOException {
          byte[] buffer = new byte[1024];
          int read;
          while((read = in.read(buffer)) != -1){
            out.write(buffer, 0, read);

          }
      }
      }
    );
  }

}

A: use next code:
    private class AsyncTaskDialog extends AsyncTask<Void, Void, Void> {
    Toast toastSuccess;

    boolean flagSuccessCopy =false;
            protected void onPreExecute() {
                super.onPreExecute();

                }
            }

            protected Boolean doInBackground(Void... params) {
                copyFiles();
                return null;
            }

            @Override
            protected void onPostExecute(Boolean result) {
                super.onPostExecute(result);

              if (getActivity() != null) {
                 if(flagSuccessCopy){
                  toastSuccess  = Toast.makeText(context, "Success", duration);
                 }else{
                      toastSuccess  = Toast.makeText(context, "Error", duration);
                 }
                toast.show();
            }
        }

A: Allows to copy any file from any application to SD card
import ru.gelin.android.sendtosd.R;
import android.app.Activity;
import android.app.AlertDialog;
import android.widget.ProgressBar;
import android.widget.TextView;

public class ProgressDialog extends AlertDialog implements Progress {

/** Activity for which the dialog is created */

Activity activity;

/** Progress manager for the dialog */
ProgressManager manager = new ProgressManager();

/**
 *  Creates the customized progress dialog for
 *  activity.
 */
protected ProgressDialog(Activity activity) {
    super(activity);
}

@Override
public void setFiles(int files) {
    synchronized (manager) {
        manager.setFiles(files);
    }
    activity.runOnUiThread(new Runnable() {
        @Override
        public void run() {
            synchronized (manager) {
                updateTotalProgress();
            }
        }
    });
}

@Override
public void nextFile(final File file) {
    synchronized (manager) {
        manager.nextFile(file);
    }
    activity.runOnUiThread(new Runnable() {
        @Override
        public void run() {
            synchronized (manager) {
                updateFileName(file);
                updateFileProgress();
                updateTotalProgress();
            }
        }
    });
}

@Override
public void processBytes(long bytes) {
    synchronized (manager) {
        manager.processBytes(bytes);
    }
    activity.runOnUiThread(new Runnable() {
        @Override
        public void run() {
            synchronized (manager) {
                updateFileProgress();
            }
        }
    });
}

void updateTotalProgress() {
    ProgressBar progress = (ProgressBar)findViewById(R.id.total_progress);
    progress.setMax(manager.getFiles());
    progress.setProgress(manager.getFile());
    TextView text = (TextView)findViewById(R.id.total_files);
    text.setText(getContext().getString(R.string.files_progress,
            manager.getFile(), manager.getFiles()));
}

void updateFileName(File file) {
    if (file == null) {
        return;
    }
    TextView view = (TextView)findViewById(R.id.file_name);
    view.setText(file.getName());
}

void updateFileProgress() {
    ProgressBar progress = (ProgressBar)findViewById(R.id.file_progress);
    if (manager.getProgressInUnits() < 0) {
        progress.setIndeterminate(true);
    } else {
        progress.setIndeterminate(false);
        progress.setMax((int)(manager.getSizeInUnits() * 10));
        progress.setProgress((int)(manager.getProgressInUnits() * 10));
    }
    TextView text = (TextView)findViewById(R.id.file_size);
    text.setText(getContext().getString(manager.getSizeUnit().progressString,
            manager.getProgressInUnits(), manager.getSizeInUnits()));
    }

}

source: http://code.google.com/p/sendtosd-android/source/browse/src/ru/gelin/android/sendtosd/progress/ProgressDialog.java?spec=svn0933973391a12bee4759a32f5776864c64022d71&r=0933973391a12bee4759a32f5776864c64022d71


text:
Q: WebStorm, unable to suppress inspection for undefined function I found this documentation on suppressing certain inspections, and I remember using it before, however for some reason it is currently not available.
I am working on a UI for a Unity project and we are injecting a JavaScript function into the DOM from Unity.  In WebStorm, the function is obviously undefined.  Unfortunately, in the "fix" menu, I only have the following options:

Here is what I'm expecting, based on the docs:

I remember from using it in the past that it simply puts a comment before the call, but I don't remember what it is.
How can I enable this feature again? Alternatively, what is the comment so I can manually insert it?

A: Just as it's written in Help article, you have to press the -> key or click the right arrow button next to Create function.... menu item to open a submenu with suppress actions
You can also suppress it by adding a comment // noinspection JSUnresolvedFunction manually


text:
Q: I am a bit confuse about running a regression I am a bit confuse about running a regression. Independent Variables are as:
X1 = Profitability Index
X2 = Operational Index
X3 = Cost per employee
X4 = Leverage Ratio
I am confused that can I use indexes and as well as single variables as independent variables in the regression.
Clarification needed!
Thanks

A: I am a bit unsure of what you mean by single variables - but I assume that you are referring to, on one hand, variables that consist of multiple variables, and, on the other hand, variables that have not been put together with other variables.
If the above is the case, then yes, you can both use index variables as well as single variables.
However, of cause you have to be aware that you cannot use any single variables that are part of any of the index variables, as this will bias your results and possibly overestimate the effect of some variables.


text:
Q: How to decode strange symbols from parser (bs4) into Cyrillic? I tried to import 'lxml' and to find what encoding this is but for no success. Websites with decoding functions can't transfer it back to Cyrillic. Only Windows-1250 and ISO-8859-1 can encode SOME symbols in the text.
import os
import requests
from bs4 import BeautifulSoup

gismeteo = 'https://www.gismeteo.ua/ua/weather-novomoskovsk-10961/weekly/'

headers = { 'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:103.0) Gecko/20100101 Firefox/103.0' }
req1 = requests.get(gismeteo, headers=headers)

data1 = BeautifulSoup(req1.text, 'html.parser')

day_a1 = data1.find('div', class_='widget-row widget-row-days-date')
day_b1 = str([da1.text.replace('\n', '').strip() for da1 in day_a1])

print(day_b1)

Sometimes output is like this (good):
['Нд11 вер', 'Пн12', 'Вт13', 'Ср14', 'Чт15', 'Пт16', 'Сб17']

And sometimes it like this:
['Ð\x9dд11 веÑ\x80', 'Ð\x9fн12', 'Ð\x92Ñ\x8213', 'СÑ\x8014', 'ЧÑ\x8215', 'Ð\x9fÑ\x8216', 'Сб17']

A: I don't really know why requests sometimes fails to use the right encoding (I got it right on the first run, and wrong afterwards...) but you can set it manually before accessing the text:
req1.encoding = 'utf8'
data1 = BeautifulSoup(req1.text, 'html.parser')

and this gives you reliably:
['Нд11 вер', 'Пн12', 'Вт13', 'Ср14', 'Чт15', 'Пт16', 'Сб17']


text:
Q: Mongoose DocumentDB connection fails through SSH tunnel I am trying to connect to AWS DocumentDB with Node.js/Typescript and Mongoose. I have an EC2 instance setup as SSL tunnel, which works great. I can connect to DocumentDB locally with Studio3T and mongo-cli.
This command works mongo --sslAllowInvalidHostnames --ssl --sslCAFile rds-combined-ca-bundle.pem --username <username> --password <password>
But if I try to connect to the same database with Mongoose, it fails. This is my code and the error:
const options = {
  dbName: "prodDB",
  user: connectionData.username,
  pass: connectionData.password,
  tls: true,
  tlsCAFile: "../rds-combined-ca-bundle.pem",
  tlsAllowInvalidHostNames: true,
};
try {
  await connect("mongodb://localhost:27017", options);
} catch (error) {
  console.log(error);
}

MongooseServerSelectionError: connect EHOSTUNREACH imagine-ip-address-here:27017
reason: TopologyDescription {
  type: 'ReplicaSetNoPrimary',
  servers: Map(1) {
    'censored:27017' => [ServerDescription]
  },
  stale: false,
  compatible: true,
  heartbeatFrequencyMS: 10000,
  localThresholdMS: 15,
  setName: 'rs0',
  commonWireVersion: 7,
  logicalSessionTimeoutMinutes: undefined
}

At this point, I have tried pretty much any possible config in Mongoose and I am getting desperate. Any help is appreciated

A: This seems to be an issue with mongoose versions >= 6.
Downgrading Mongoose to version 5.13.8 works without a problem.
Mongoose devs are apparently aware of this issue: https://github.com/Automattic/mongoose/issues/11105


text:
Q: Delta method for vector valued functions Suppose I have an estimator $B\in\mathbb{R}^m$ converging to $\beta$, such that
$$
\sqrt{n}(B-\beta)\rightarrow\mathcal{N}(0,\Sigma).
$$
I am interested in a quantity $\mathbf{h}(B):\ \mathbb{R}^m\rightarrow\mathbb{R}^p$, and would like to use delta method to approximate the asymptotic distribution.
Let $\nabla\mathbf{h}(\beta)$ be a matrix $\left[\frac{\partial h_k(\beta)}{\partial \beta_j}\right]_{jk}$. When $p=1$, multivariate Delta method would provide
$$
\sqrt{n}(\mathbf{h}(B)-\mathbf{h}(\beta))\rightarrow\mathcal{N}(0,\nabla\mathbf{h}(\beta)^T\cdot\Sigma\cdot\nabla\mathbf{h}(\beta)).
$$
Can we say that it is the same for the case when $p>1$?
When I actually tried this numerically, I find that the covariance $\nabla\mathbf{h}(\beta)^T\cdot\Sigma\cdot\nabla\mathbf{h}(\beta)$ is not invertible.


text:
Q: IE's clear 'X' expands input on hover This is an odd one; I have a site in Quirks Mode (X-UA-Compatible as IE5), and a structure that is essentially the following (not my choice):

        <input type="text" style="width:100%"/>

        <input type="button" style="width:100px"/>

The idea is to, within the parent table cell, have a row containing a wide-as-possible text input, and a button to the right of that of fixed width.
Pasting or typing in large text works fine, until you hover over the 'X' that IE adds to clear the text. At that point, despite the parent cell being restricted in size, the cell expands off-screen as follows:

What's going on here, and can I stop it? I don't seem to be able to enforce the full width without this occurring. Unfortunately quirks mode isn't something I can change at this point, which means I can't even hide ::ms-clear in the CSS.


text:
Q: ComboBox fill from index 0 I have a ComboBox that get its items from my database when the program starts.
Here is the code
private void fillComboBox(){
    try{
        String query = "SELECT * FROM `Books`";
        ps = conn.prepareStatement(query);
        rs = ps.executeQuery();

        while(rs.next()){
            String name = rs.getString("BookName");
            searchComboBox.addItem(name);
        }
    }catch(Exception ex){
        JOptionPane.showMessageDialog(null, ex);
    }finally{
        try{
            rs.close();
            ps.close();
        }catch(Exception ex){

        }
    }
}

But whenever i call this method twice it add items on each other not start adding items from 0
In other words when i call fillComboBox() method first time it adds item1, item2 item 3 and when i call it again it adds on the first items not create new item list

A: Try to call removeAllItems() at the beginning or prevent the method to be called several times...
// I assumed searchComboBox is JComboBox
searchComboBox.removeAllItems();


text:
Q: How to re-adjust content while resizing gnome-terminal? Some times when I am compiling a script the parameters are so long that they cover many lines in the terminal. When I resize the terminal in order to read more clearly, the content does not automatically re-adjust to the size of the terminal.
Is there a way of telling the terminal to re-format its output depending on the window size of the terminal emulator?
I am using gnome-terminal, Fedora 16

A: Gnome-terminal supports this feature beginning with VTE library version 0.36.

A: No. The content has already been sent to the terminal, so there is no longer anyone that can control it other than the terminal. And if the terminal is not written to control it, then it won't.


text:
Q: ASP.NET MVC 5 Attribute Routing I'm trying to use route attributes in MVC 5. I created an empty MVC project in Visual Studio to experiment with and so far I can't get the routing to work. I'm using this page as a reference. I have the latest assemblies and updated all NuGet packages to their latest versions.
Here's my code:
// RouteConfig.cs
namespace MvcApplication1
{
    using System.Web.Mvc;
    using System.Web.Routing;

    public class RouteConfig
    {
        public static void RegisterRoutes(RouteCollection routes)
        {
            routes.IgnoreRoute("{resource}.axd/{*pathInfo}");

            // Enables MVC attribute routing.
            routes.MapMvcAttributeRoutes();

            // The default route mapping. These are "out of the bag" defaults.
            routes.MapRoute(null, "{controller}/{action}/{id}", new
            {
                controller = "Home",
                action = "Index",
                id = UrlParameter.Optional
            });
        }
    }
}

// TestControler.cs
namespace MvcApplication1.Controllers
{
    using System.Web.Mvc;

    public class TestController : Controller
    {
        public ContentResult Output1()
        {
            return Content("Output 1");
        }

        [Route("Test/Output2")]
        public ContentResult Test2()
        {
            return Content("Output 2");
        }
    }
}

@* Index.cshtml *@
@Html.Action("Output1", "Test")
@Html.Action("Output2", "Test")

The Output1() method renders properly. However, when Output2() is rendered, I get the error "A public action method 'Output2' was not found on controller 'MvcApplication1.Controllers.TestController'."

A: Your action is named Test2 not Output2. Change the following
@Html.Action("Test2", "Test")

A: This is because @Html.Action will not actually use routing. With it you explicitly specify actions and controllers.
The routing will be used when someone for instance makes the http://example.org/Test/Output2 request from a browser.


text:
Q: C# Regular expressions negative lookahead exclude from match somewhere in the text I have an a link with href
  <a href="image-CoRRECTME.aspx?ALSO=ME&leaveme=<%= MyClass.Text %>">somelink

I need to replace text in href attribue to lowercase except content of the <% %> brakets
should look like:
 <a href="image-correctme.aspx?also=me&leaveme=<%= MyClass.Text %>">somelink

I was thinking something like this.. "href=\"([^\"]*[A-Z]+[^\"]*)(?:(?<!.*<%[^%]*%>.*)))\"" but its not working.
Thanks!

A: Try this if you haven't figured it out already.
private void test()
{
    string t = @"<a href=""image-CoRRECTME.aspx?ALSO=ME&leaveme=<%= MyClass.Text %>&test2=<%= MyClass2.Text %>&last_test=nothing"">somelink";
    string fixed_string = Regex.Replace(t, "(?<=href=\"|href=\"[^\"]*%>)([^\"]*?)(?=<%|\")", TestMatchEvaluator);
}

private string TestMatchEvaluator(Match m)
{
    return m.Value.ToLower();
}

A: Something like this should work for you...
Regex test = new Regex(@"(?<=(href\=""))[^<]+", RegexOptions.Compiled);

string htmlCode = @"<a href=""image-CoRRECTME.aspx?ALSO=ME&leaveme=<%= MyClass.Text %>"">somelink";

string result = test.Replace(htmlCode, test.Match(htmlCode).Value.ToLower());


text:
Q: Array declaration in Pine Script What is the different between and the usecases of these two way of declarations?
var _low = float(na)

This will be interpreted as "series float"
var float[] _low = na

This will be interpreted as undetermined type
I'm trying to run this code but it return error if I use the second way to declare the array
if showWeek and newTF
    _high := high
    _low := low
    _open := open
    weekH := drawWeekHline(high)
    weekL := drawWeekHline(low)
    weekO := drawWeekHline(open)
    int(na)
else
    int(na)

Variable '_high' was declared with 'float[]' type. Cannot assign it expression of type 'series float'


text:
Q: How to make a WebviewRenderer IOS external url access? I did an IOS webviewrenderer and I can not access an external url like google's, how can I do that?
I'm following the tutorial https://learn.microsoft.com/en-us/xamarin/xamarin-forms/app-fundamentals/custom-renderer/hybridwebview
public class HybridWebViewRenderer : ViewRenderer<HybridWebView, WKWebView>, IWKScriptMessageHandler
{
    const string JavaScriptFunction = "function invokeCSharpAction(data){window.webkit.messageHandlers.invokeAction.postMessage(data);}";
    WKUserContentController userController;

    protected override void OnElementChanged (ElementChangedEventArgs<HybridWebView> e)
    {
        base.OnElementChanged (e);

        if (Control == null) {
            userController = new WKUserContentController ();
            var script = new WKUserScript (new NSString (JavaScriptFunction), WKUserScriptInjectionTime.AtDocumentEnd, false);
            userController.AddUserScript (script);
            userController.AddScriptMessageHandler (this, "invokeAction");

            var config = new WKWebViewConfiguration { UserContentController = userController };
            var webView = new WKWebView (Frame, config);
            SetNativeControl (webView);
        }
        if (e.OldElement != null) {
            userController.RemoveAllUserScripts ();
            userController.RemoveScriptMessageHandler ("invokeAction");
            var hybridWebView = e.OldElement as HybridWebView;
            hybridWebView.Cleanup ();
        }
        if (e.NewElement != null) {
            var uri = e.NewElement.Uri.ToString();
            Control.LoadRequest(new NSUrlRequest(new NSUrl(uri, false)));
        }
    }

    public void DidReceiveScriptMessage (WKUserContentController userContentController, WKScriptMessage message)
    {
        Element.InvokeAction (message.Body.ToString ());
    }
}

A: Different with load local html file.If you want to access a remote URL like google .You don't need to set the Parameter isDir .
if (e.NewElement != null)
{
  var uri = e.NewElement.Uri.ToString();
  Control.LoadRequest(new NSUrlRequest(new NSUrl(uri)));
}


text:
Q: Prove that every discrete poset is projective. Is this proof correct (assuming the Axiom of Choice)?
$e:P\longrightarrow Q$ epic, then $e$ is a surjection (Proof that the epis among posets are the surjections). For any arrow, $f:A \longrightarrow Q$, since $e$ is a surjection, there exists $p_{f(a)} \in P$ such that $e(p_{f(a)})=f(a)$ for any $a\in E$.
Assuming the Axiom of Choice, we can define:
$ h: A \longrightarrow P : a \longmapsto p_{f(a)}
$
Since the elements in $A$ are incomparable ($A$ is discrete), $h$ is a monotone map.
Hence we have $e\circ h=f$, $A$ is projective.
I also want to prove the inverse. Any idea how I could do that?
Thanks!

A: Your proof in the forward direction is correct. For the reverse direction, suppose $a<b$ for some $a,b\in A$. Then let $Q$ be the poset $\mathbf 2$ (where $0<1$), and define $f:A\to Q$ so that $f(x)=1$ if $a<x$ and $f(x)=0$ otherwise. If $x\le y$, then either $f(x)=0\le f(y)$, or $f(x)=1$ so $a<x\le y$, hence $f(y)=1\ge f(x)$. Thus $f$ is a monotone map.
Now take $P=\{0,1\}$ as a discrete poset, and $e$ be the identity map $P\to Q$. It is surjective, hence an epi by your linked theorem. Now let $h:A\to P$ satisfy $e\circ h=f$. Then $0=f(a)=e(h(a))=h(a)$, and $0=f(b)=e(h(b))=h(b)$, but $a\le b$ and $0\not\le 1$ in $P$, a contradiction.

A: Your proof is good. Here is another similar proof using your notaion, since $e$ is a surjective there is (according to the axiom of choice) a map $s:Q\to P$ such that $es=1_Q$. It follows that $e(sf)=f$ and since $A$ is discrete $sf$ is a monotone map proving that $A$ is projective.
For the converse suppose $A$ is projective and let $A'$ be the discrete poset on the same set. Let $e:A'\to A$ be the identity map (which is trivially a monotone epimorphism) and let $f: A\to A$ be the identity map. Since $A$ is projective there is a monotone map $h:A\to A'$ such that $eh=f$. It follows that $h$ is necesserily the identity map too and hence $A$ is discrete.


text:
Q: Any solution for App Store Connect ITMS-90809: Deprecated API Usage? I tried my best Even updating the plugins and searching for references from the infamous UIWebView I still get the error.
Config:

*

*Ionic 3

*Angular 5

*Ionic Angular 3.9.2

*Global Cordova 10.0.0

Config.xml whith:
<platform name="ios">
    <preference name="WKWebViewOnly" value="true" />
    <feature name="CDVWKWebViewEngine">
        <param name="ios-package" value="CDVWKWebViewEngine" />
    </feature>
<preference name="CordovaWebViewEngine" value="CDVWKWebViewEngine" />

Package.json with:
 "dependencies": {
    "@angular/animations": "^5.2.5",
    "@angular/cdk": "^5.2.5",
    "@angular/common": "5.2.11",
    "@angular/compiler": "5.2.11",
    "@angular/compiler-cli": "5.2.11",
    "@angular/core": "5.2.11",
    "@angular/forms": "5.2.11",
    "@angular/http": "5.2.11",
    "@angular/material": "^5.2.5",
    "@angular/platform-browser": "5.2.11",
    "@angular/platform-browser-dynamic": "5.2.11",
    "@angular/platform-server": "5.2.11",
    "@fnando/cnpj": "^0.1.1",
    "@fnando/cpf": "^0.1.1",
    "@ionic-native/app-version": "^4.20.0",
    "@ionic-native/camera": "^4.20.0",
    "@ionic-native/clipboard": "^4.18.0",
    "@ionic-native/core": "^4.18.0",
    "@ionic-native/email-composer": "^5.3.0",
    "@ionic-native/file": "^4.20.0",
    "@ionic-native/file-opener": "^4.20.0",
    "@ionic-native/file-transfer": "^4.18.0",
    "@ionic-native/firebase-analytics": "^4.20.0",
    "@ionic-native/http": "^4.20.0",
    "@ionic-native/in-app-browser": "^4.20.0",
    "@ionic-native/network": "^4.18.0",
    "@ionic-native/onesignal": "^4.18.0",
    "@ionic-native/safari-view-controller": "^4.20.0",
    "@ionic-native/screen-orientation": "^4.18.0",
    "@ionic-native/social-sharing": "^4.20.0",
    "@ionic-native/splash-screen": "^4.2.1",
    "@ionic-native/sqlite": "^4.18.0",
    "@ionic-native/status-bar": "^4.2.1",
    "@ionic-native/toast": "^4.18.0",
    "@ionic-native/youtube-video-player": "^4.20.0",
    "@ionic/cloud-angular": "^0.12.0",
    "@ionic/lab": "^2.0.6",
    "@ionic/storage": "2.2.0",
    "@types/underscore": "^1.8.11",
    "android-versions": "^1.2.1",
    "angular2-moment": "^1.9.0",
    "angularfire2": "^2.0.0-beta.8",
    "brmasker-ionic-3": "^1.6.3",
    "chart.js": "^2.7.3",
    "chartjs-plugin-annotation": "^0.5.7",
    "clipboard": "^2.0.4",
    "cordova-browser": "^4.1.0",
    "cordova-clipboard": "1.2.1",
    "cordova-plugin-advanced-http": "^2.4.1",
    "cordova-plugin-androidx": "^1.0.2",
    "cordova-plugin-androidx-adapter": "^1.1.0",
    "cordova-plugin-app-version": "0.1.9",
    "cordova-plugin-compat": "^1.2.0",
    "cordova-plugin-document-viewer": "~0.9.10",
    "cordova-plugin-email-composer": "0.9.2",
    "cordova-plugin-file": "6.0.1",
    "cordova-plugin-file-opener2": "~2.2.0",
    "cordova-plugin-file-transfer": "1.7.1",
    "cordova-plugin-filepath": "1.5.1",
    "cordova-plugin-firebase-analytics": "^4.0.0",
    "cordova-plugin-ios-camera-permissions": "1.2.0",
    "cordova-plugin-network-information": "2.0.1",
    "cordova-plugin-screen-orientation": "3.0.1",
    "cordova-plugin-x-toast": "2.7.2",
    "cordova-sqlite-storage": "^3.3.0",
    "cordova-support-android-plugin": "^1.0.1",
    "cordova-support-google-services": "^1.3.2",
    "countup.js-angular2": "^6.0.2",
    "d3": "^5.7.0",
    "es6-promise-plugin": "^4.2.2",
    "firebase": "^3.9.0",
    "highcharts": "^6.1.0",
    "highcharts-rounded-corners": "github:highcharts/rounded-corners#master",
    "html2canvas": "^1.0.0-alpha.12",
    "intersection-observer": "^0.5.0",
    "ionic-angular": "3.9.2",
    "ionicons": "3.0.0",
    "moment": "^2.18.1",
    "mydatepicker": "^2.6.3",
    "ng2-cache-service": "^1.1.1",
    "ng2-charts": "^1.6.0",
    "ng2-validation": "^4.2.0",
    "ngx-d3-liquid-fill-gauge": "^1.0.8",
    "ngx-liquid-gauge": "^2.0.3",
    "ngx-skeleton-loader": "^1.2.2",
    "node-sass": "^4.12.0",
    "onesignal-cordova-plugin": "2.4.6",
    "pdfmake": "^0.1.62",
    "reflect-metadata": "^0.1.12",
    "rxjs": "^5.5.11",
    "slick-carousel": "^1.8.1",
    "sw-toolbox": "3.4.0",
    "sweetalert2": "^7.33.1",
    "typewriterjs": "^1.0.0",
    "underscore": "^1.9.1",
    "uuid": "^3.2.1",
    "zone.js": "^0.8.4"
  },
  "devDependencies": {
    "@ionic/app-scripts": "^3.2.4",
    "@types/jest": "^23.3.13",
    "bluebird": "^3.7.2",
    "chalk": "^4.0.0",
    "cordova-android": "^9.0.0",
    "cordova-ios": "^6.1.1",
    "cordova-plugin-camera": "^5.0.1",
    "cordova-plugin-device": "^2.0.2",
    "cordova-plugin-inappbrowser": "^4.1.0",
    "cordova-plugin-ionic-keyboard": "^2.2.0",
    "cordova-plugin-ionic-webview": "^5.0.0",
    "cordova-plugin-safariviewcontroller": "^1.6.0",
    "cordova-plugin-splashscreen": "^5.0.2",
    "cordova-plugin-statusbar": "^2.4.2",
    "cordova-plugin-whitelist": "^1.3.3",
    "cordova-plugin-x-socialsharing": "^6.0.2",
    "cordova-plugin-youtube-video-player": "^2.4.0",
    "jest": "^24.0.0",
    "jest-preset-angular": "^6.0.2",
    "karma-cli": "^2.0.0",
    "node-fetch": "^2.6.0",
    "query-string": "^6.12.1",
    "tslint-config-airbnb": "^5.11.1",
    "typescript": "~3.5.3"
  }

I've already updated the critical plugins, revised the config.xml and even tried some modified plugins and nothing. The point is that they emit the error but do not even give a hint of what may be causing it, it was very confusing. I've done several searches and tried several possible solutions and nothing ... I've already built an application from scratch with the same critical plugins (cordova-plugin-inappbrowser, cordova-plugin-whitelist, cordova-plugin-x-social-sharing, cordova- plugin-camera, cordova-plugin-safariviewcontroller, cordova-plugin-youtube-video-player) and passed! My application and it has been very difficult to find the point to correct.
Can anyone help me please?

A: Out of Apache-controlled repos, you need to either use:

*

*cordova-ios@5.1.1 WITH <preference name="WKWebViewOnly" value="true" /> configuration & a wkwebview plugin.

*cordova-ios@6 which has all UIWebView references physically removed, effectively forcing the WKWebViewOnly to true.

If you use cordova-plugin-inappbrowser, you'll also need to update this to the latest available version.
If you still get the deprecation error from Apple, this means you have a third-party plugin that is referencing UIWebView. This could either be in the plugin sources (easily findable via project wide searches) or the plugin could depend on a third-party library that is precompiled (much more difficult to find via textual searches).
From my experience helping others with this same problem, common culprits are:

*

*google maps plugin (I know they have this patched, so use the latest version)

*Google FCM plugin (not sure if patched)

*Pretty much any social media plugin

In your specific case, cordova-plugin-x-socialsharing is the culprit (at least one culprit, you have many plugins, I didn't check them all). It hasn't been updated in years, and in their master branch, it still contains a UIWebView reference here.


text:
Q: Are there any Microsoft Exchange Clients for iOS and Android that store their local data in an encrypted manner? I don't feel like this is a product recommendation question, more of a "does this tech even exist and is it feasible" question, but if I'm wrong, feel free to give this question the boot.
Context:
Our company has a bunch of traveling employees who access the company's Exchange server via thier iDevices or android phones, but because of the data protection laws in the state where our company is based (and the nature of the data our company works with), a recent security audit found that all mobile devices (laptops, phones, etc) operated by our company need to have all company correspondence and related data encrypted all the time. For laptops, that was easy: BitLocker or TrueCrypt, problem solved. For phones and tablets, however, I'm stumped. Sure, you can put lock screens/passwords on the phones, but the data is still accessible via external extraction, as law enforcement authorities already know.
Question:
Are there any clients for Microsoft Exchange that run on iOS or Android which store local data encrypted? The people using our mobile devices do a lot of their work while offline, so just giving them OWA access with SSL connection security isn't enough. Are there apps/technologies that present an additional login credential prompt to decrypt locally stored data in the app's storage area on the phone? My gut reaction when I started looking into this was "that doesn't sound like something Apple would allow into the App Store", but I've been wrong before...

A: AirWatch has an MS Exchange client for iOS and Android.
They support encryption and have a number of other security features as well.
http://www.air-watch.com/solutions/apple-ios


text:
Q: How to draw a Drawable over a View I have several Views in my Activity. I want to draw a Drawable over these views.
The Drawable should be on top of the views (that means it hides the views below it.
The Drawable may appear over several views (that is I can't just draw it in one view).
How can this be done?
Thank you

A: The FrameLayout allows you to have overlapping views. This is often used if you have some sort of background, with widgets over it.

A: Maybe you could use a Dialog or view with Dialog Theme with your drawable as the background?


text:
Q: How to avoid using module in node.js? Doing this tutorial, and I do not want to use device.js just to put one line in it: module.exports = "<a1 ..

How could put this device ID in my main script, and pass it to apnagent object? Tried this, but I guess this is why connection not establishing.
Maybe instead of module.exports = "<388 .. I need something like agent.set('something', and here the device ID); ?
var pfx = '/var/lib/openshift/555dd1415973ca1660000085/app-root/runtime/repo/pfx.p12';
module.exports = "<38873D3B 0D61A965 C1323D6C 0A9F2866 D1BB50A3 64F199E5 483862A6 7F02049C>"; // <----- THIS HERE

var apnagent = require('apnagent')
var agent = module.exports = new apnagent.Agent();
agent.set('pfx file', pfx);
// our credentials were for development
agent.enable('sandbox');

console.log('LOG1');
console.log(agent);
agent.connect(function (err) {

console.log('LOG2');
  // gracefully handle auth problems
  if (err && err.name === 'GatewayAuthorizationError') {
    console.log('Authentication Error: %s', err.message);
    process.exit(1);
  }

  // handle any other err (not likely)
  else if (err) {
    throw err;
  }

  // it worked!
  var env = agent.enabled('sandbox')
    ? 'sandbox'
    : 'production';

  console.log('apnagent [%s] gateway connected', env);
});

A: You can try this:
var pfx = '/var/lib/openshift/555dd1415973ca1660000085/app-root/runtime/repo/pfx.p12';
var deviceId = "<38873D3B 0D61A965 C1323D6C 0A9F2866 D1BB50A3 64F199E5 483862A6 7F02049C>"; // <----- THIS HERE

var apnagent = require('apnagent')
var agent = new apnagent.Agent(deviceId);
agent.set('pfx file', pfx);
// our credentials were for development
agent.enable('sandbox');

console.log('LOG1');
console.log(agent);
agent.connect(function (err) {

console.log('LOG2');
  // gracefully handle auth problems
  if (err && err.name === 'GatewayAuthorizationError') {
    console.log('Authentication Error: %s', err.message);
    process.exit(1);
  }

  // handle any other err (not likely)
  else if (err) {
    throw err;
  }

  // it worked!
  var env = agent.enabled('sandbox')
    ? 'sandbox'
    : 'production';

  console.log('apnagent [%s] gateway connected', env);
});

The explanation is this: module.exports is the common module export syntax. This way you are avoiding exporting a module and importing it by manually hardcoding the deviceId in your code.


text:
Q: React - Redux - Dispatch Action Error, this.props.mostrarProduto is not a function Im dispatching 2 action on my container, but it keeps getting this.props.mostrarProduto() and this.props.esconderProduto() is not a function. The objective is to make a mouseover action to show and hide a component.
Thanks
container Menu
import React, { Component } from 'react';
import { connect } from 'react-redux';
import { bindActionCreators } from 'redux';
import { mostrarProduto } from '../actions/index';
import { esconderProduto } from '../actions/index';

class Menu extends Component{

render(){
    return (

Link 1

    )
  }

}

function mapDispatchToProps(dispatch) {

return bindActionCreators({mostrarProduto, esconderProduto}, dispatch);
}

export default connect(null, mapDispatchToProps)(Menu);

action index
function mostrarProduto(){
    return {
        type: 'SHOW_PRODUCT'
    }
}

function esconderProduto(){
    return {
        type: 'HIDE_PRODUCT'
    }
}

product reducer
const productReducer = (state = false, action) => {
  switch (action.type) {
    case 'SHOW_PRODUCT':
      return true;
    case 'HIDE_PRODUCT':
      return false;
    default:
      return state;
  }
}

reducer index
import { combineReducers } from 'redux';
import Produtos from './texto_produto';

const rootReducer = combineReducers({
    textoProdutos : Produtos
});

export default rootReducer;

A: You are not exporting the actions at all. You are using named imports, so the code should look like:
export function mostrarProduto(){
    return {
        type: 'SHOW_PRODUCT'
    }
}

export function esconderProduto(){
    return {
        type: 'HIDE_PRODUCT'
    }
}


text: Q: How does WordPress access theme and plugin files through its editor? I love that WordPress enables you to edit files in the WP back end, but I want to know how it works. How is WordPress able to access and allow you to edit files that are on a server like that? Please let me know if this would be better for a site like stackoverflow.


text:
Q: Drupal 7 - entityFieldQuery Order Morning, im trying to get a set of latest node types but cant seem to figure out how to order them by date. Heres my function so far:
function latest_nodes($type, $limit = 15, $offset = 0) {
    $query = new EntityFieldQuery();
    $tmp = $query->entityCondition('entity_type', 'node');
    if( is_string( $type ) )
        $tmp->entityCondition('bundle', $type);
    elseif( is_array( $type ) )
        $tmp->entityCondition('bundle', $type, 'IN');
    $tmp->range($offset, $limit);
    $results = $tmp->execute();
    return node_load_multiple(array_keys($results['node']));
}

any help would be muchly appreciated!

A: You're looking for the fieldOrderBy() member function, e.g.
$query = new EntityFieldQuery();
$query->fieldOrderBy('field_name_of_field', 'value', 'DESC');

A: You might be looking for propertyOrderBy
$query = new EntityFieldQuery();
$query->propertyOrderBy('changed', 'DESC');

A: to retrieve the latest post you can use
$query = new EntityFieldQuery();
$entities = $query->entityCondition('entity_type', 'node')
                  ->entityCondition('bundle', 'your_content_type')
                  ->propertyCondition('status', 1)
                  ->propertyOrderBy('created', 'DESC');


text:
Q: How can I optimize my Google Cloud SQL (MySQL) database for use with an API I created a MySQL Database into the Google Cloud Platform.
Machine type is db-n1-standard-2 with 2 vCPUs and 7.5 GB Memory.
Network throughput (MB/s) is 500 of 2000
Storage type: SSD

Disk throughput (MB/s)
Read: 4.8
Write 4.8
IOPS
Read: 300
Write: 300

Availability: High availability

Database Flags:
max_connections: 500

I created a API with Laravel Lumen and let it work onto Google Cloud Platform into a App Engine
runtime: php72
instance_class: F2
automatic_scaling:
    min_instances: 1
    max_instances: 20
    target_cpu_utilization: 0.7
    max_concurrent_requests: 80
    target_throughput_utilization: 0.8

If I send a request to my API with postman the first response needs 1123ms. The size of the response is 8.59 KB.
If I send the same request with loader.io with 250 clients over 1 minute,
the test aborted because it reached the error threshold.
79,5% error rate
avg resp = 9141 ms
min/max Responsetime is: 2081/10376
Response Counts success: 104
Response Counts timeout: 403
When I have a look at the MySQL Error Logging, I do have impossible much errors like this:
    2020-01-07 16:29:18.670 CET
2020-01-07T15:29:18.670275Z 1507 [Note] Aborted connection 1507 to db: 'mydatabasename' user: 'mydatabaseuser' host: 'cloudsqlproxy~172.217.35.158' (Got an error reading communication packets)

Does someone have an Idea, how I can solve this problem?

A: I've investigated a little about this error and found some useful guides on how to diagnose this types of errors at this link I believe that as a first step we would need to find the real cause of this message (this could be due to various reasons according to the link shared), some suggestions that I could notice repeating on other posts and on the same link that I shared before are the next:

*

*Check to make sure the value of max_allowed_packet is high enough ( this can be modified with flags in Cloud SQL).

*The client connected successfully but terminated improperly

*The client slept for longer than the defined wait_timeout or interactive_timeout seconds

What I would do is to go on and try tweaking the database flags as described on this public documentation on the google page and check how the behavior changes.
Please let us know if you find something useful when tweaking the instance.


text:
Q: Conditional Probability with Ordered Stats I am very close to solving this, but this last part is killing me on how to solve it. I dont really know where to begin.
Scores run from 0 to 5 with density $f(x)=c(x^2-6x+10)$. An intermediate score is from 1 to 4.
I have found that $c=3/50$ and $E(X)=15/8$. $E(X)$ is the integral from $0\rightarrow5$ of $x*f(x)$.
The probability of an intermediate score is 153/200. The integral from $1\rightarrow4$ of f(x).
The question that I have is: If 100 students take the test what is the prob that at least 30 students will have an intermediate score?
I thought it could be conditional, but that does not make a whole lot of sense. We have not learned a lot of ordered statistics, but honestly I did not think of anything much other than that.

A: I do not know whether you are intended to use a discrete model, or the continuous model that you adopted. (In a number of places, grades from $0$ to $5$ are standard, with no intermediate grades.)
Let $p$ be the probability of an intermediate score. If your model and computation are correct, then $p=\frac{153}{200}$.
Let $Y$ be the number of students with an intermediate score. Then under the usual assumption of independence (students do not copy each other's answers), $Y$ has binomial distribution with parameters $p,100$. Then the exact probability is
$$\sum_{k=30}^{100}\binom{100}{k}p^k (1-p)^{100-k}.$$
It is more efficient to find first the probability of the complement (sum instead from $k=0$ to $29$) and then subtract this sum from $1$.
For a good approximation, we can use the normal approximation to the binomial.


text:
Q: How to disable popup suggest(or tips) window when typing in vscode? When I type in:
const styles = StyleSheet.create({
  container: {}
})

Then I add a comma after container brace, it always popup a window to tip me some infomations I never watch.
container: {},

So what is this popup window? eslint tips? or something else?
Is it possible to disable this and how?

A: You can disable it with this parameter in user settings, according with reported issue:
"editor.parameterHints.enabled": false


text:
Q: Scroll to element and position it in the middle of view I'm trying to autoscroll to the middle row in the order book.
I have orderBook div, in which table with orderBook is placed. And one of the rows of that table has an id middleRow. What I'm trying to do is to scroll and position that row in the middle of the orderBook.
Expected result is shown on the picture:

I've tryied jQuery scrollTo function, but it puts middle row on top of the screen, as shown below:

$('#orderBook').find('.tableBody').scrollTo('#orderBookMiddleRow')

A: http://demos.flesler.com/jquery/scrollTo/
You can specify an offset for your scroll like this:
$('#orderBook').find('.tableBody').scrollTo('#orderBookMiddleRow', 500, {offset: -$(window).height() /2})

Here's a really simple proof of concept: http://jsfiddle.net/6k8asog1/
Edit:  Here's OP's revised code for scrolling to the center of #orderBook, rather than the window:
$('#orderBook').find('.tableBody').scrollTo('#orderBookMiddleRow', 500, {offset: $('#orderBook').offset().top - $('#orderBook').height() - $('#orderBookMiddleRow').height() })


text:
Q: A library or method to create large numbers I'm working on an prime factorization algorithm. To test it I need some large numbers with few and big prime numbers. for example Number=(BigPrime1*BigPrime2).
By Large Number I mean as large as the current RSA algorithms uses for key generations.
How can I find some of these numbers to test and challenge my algorithm.
Is there any library for them? or any site already have some numbers for challenge?

A: The easiest way to get what you are asking for is to construct the numbers. First pick a set of e.g. three largish probable primes. Multiply them together to get an even larger number that probably has a few large prime factors.

A: Is BigInteger large enough..?
http://msdn.microsoft.com/en-us/library/system.numerics.biginteger.aspx

A: The largest known primes are some of Mersenne primes.  Lists are available of their decimal expansions which would provide some test data for your algorithm.
There is plenty of other information on large primes.  A good overview can be found here.
Of course, if you want to generate a large number of large primes for your test cases, read up on probable primes as suggested in an earlier answer.


text:
Q: Kong Gateway Manager under Docker: how to configure CORS for the console I'm running the Kong image kong-docker-kong-gateway-docker.bintray.io/kong-enterprise-edition:2.3.2.0-alpine on Docker.
I initialized the whole environment with these commands:
docker network create kong-net
docker run --network=kong-net -it -p 15432:5432 -v kong-datastore:/var/lib/postgresql/data -e POSTGRES_DB=api-gw -e POSTGRES_USER=kong -e POSTGRES_PASSWORD=kongPwd --name kong-db kong-db:1.0
docker run --rm --network=kong-net -e "KONG_DATABASE=postgres" -e "KONG_PG_HOST=kong-db" -e "KONG_PG_DATABASE=api-gw"-e "KONG_PG_PASSWORD=kongPwd" -e "KONG_PASSWORD=abcde12345" kong:1.0 kong migrations bootstrap
docker run --network=kong-net -it -p 80:80 -p 8000:8000 -p 8001:8001 -p 8443:8443 -p 8444:8444 -p 8002:8002 -p 8445:8445 -p 8003:8003 -p 8004:8004 -e "KONG_DATABASE=postgres" -e "KONG_PG_HOST=kong-db" -e "KONG_PG_DATABASE=api-gw"-e "KONG_PG_PASSWORD=kongPwd" -e "KONG_PASSWORD=01Ko1996" kong:1.0

I then managed to add services, routes and plugins from the Manager interface, available at http://localhost:8002
When I attempt to edit a plugin (eg.: try to set it as disabled ["Plugins", select a plugin, click "Edit", turn off the "this plugin is enabled" switch, click "Update" and confirm]), though, my browser (Chrome) reports the following error:
Access to XMLHttpRequest at 'http://localhost:8001/default/services/0978929a-595d-427a-938e-44c29bae4f7d/plugins/cb0e382f-9be3-4a17-bde2-d2dc7c40384a' from origin 'http://localhost:8002' has been blocked by CORS policy: Method PATCH is not allowed by Access-Control-Allow-Methods in preflight response.

It looks like the PATCH HTTP verb is denied by CORS policy from the UI interface at localhost:8002 to the API at localhost:8001.
Let me emphasize that this problem does NOT address the configuration of CORS toward a service/route, but only within the Kong Manager.
I already attempted the following:

*

*Upload a file in the image, named /etc/kong/kong.conf, containing the following configuration:
 portal_cors_origins = http://localhost:8001, https://localhost:8002, http://localhost:8003, https://localhost:8004

Also tried with this:
 portal_cors_origins = *

*Launched the container with the following environment variable (in docker-compose's file):
 KONG_PORTAL_CORS_ORIGINS: http://localhost:8001, https://localhost:8002, http://localhost:8003, https://localhost:8004

Also tried with this:
 KONG_PORTAL_CORS_ORIGINS: "*"

*Launched the container with the following environment variable (in docker-compose's file):
 NGINX_PROXY_SET_HEADER: Origin ""

*Upload a file in the image, named /usr/local/openresty/nginx/conf/nginx.conf, containing the following configuration (among other ngnix config):
 server {
     listen       80;
     server_name  localhost;

     #charset koi8-r;

     #access_log  logs/host.access.log  main;

     location / {
         root   html;
         index  index.html index.htm;
         add_header 'Access-Control-Allow-Origin' "*";
         add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS, DELETE, PUT, PATCH';
         add_header 'Access-Control-Allow-Credentials' 'true';
         add_header 'Access-Control-Allow-Headers' 'User-Agent,Keep-Alive,Content-Type';
     }

How should the Kong Manager be configured to allow CORS and solve this problem?

A: You probably already checked the configuration reference : https://docs.konghq.com/enterprise/2.6.x/property-reference/
the portal_XXX settings are used to control dev portal instead of kong manager. Try change this 2 properties in /etc/kong/kong.conf:
admin_gui_url = *

and add host name in listen list. For me I'm using web browser on another machine (windows).
admin_listen = 127.0.0.1:8001 reuseport backlog=16384, 127.0.0.1:8444 http2 ssl reuseport backlog=16384,{host name}:8001 reuseport backlog=16384


text:
Q: Limits with factorial I'm having difficulties understanding all limits with factorial...
Actually, what I don't understand is not the limit concept but how to simplify factorial...
Example :
$$\lim\limits_{n \to \infty} \frac{(n+1)!((n+1)^2 + 1)}{(n^2+1)(n+2)!}$$
I know that it's supposed to give $0$ as I have the answer, but I'd like to understand how to do it as each time I get a limit with factorial I get stuck.
Thanks.

A: You have $\frac{(n+1)!}{(n+2)!}$ as the only two factorials in the limit. This can be re-written as $\frac{(n+1)!}{(n+2)(n+1)!}$ or $\frac{1}{(n+2)}$. After you simplify this section, the rest of the limit should be relatively easy to calculate, given a basic understanding of limits.

A: $\frac{(n+1)!}{(n+2)!} = \frac{1}{n+2}$
So, the problem reduces to $lim_{n\rightarrow \infty} \frac{(n+1)^2 + 1)}{(n+2)(n^2 + 1)}$.
The numerator is quadratic in $n$ while the denominator is cubic, so as $n \rightarrow \infty$ the limit should go to $0$.


text:
Q: What are the differences between an iPod touch and an iPhone 4S? I see that the prices for the 64GB iPhone 4S and iPod touch are the same.
Besides having a phone as well as the monthly data fee and Siri, which I see is on the iPhone 4S, are there any other difference between the two products that I may be missing?  It looks like both use the same version of iOS.

A: The iPhone 4S has a much more powerful processor and better graphics performance. It's a dual core A5 processor, whereas the latest iPod Touch 4G still uses the A4 processor.
You will see a better throughout system performance and have the ability to play more resource demanding games.
If you're looking for my opinion about what to buy, I recommend you buy the iPhone 4S. After all: You can always use an iPhone as an iPod, but not vice versa.


text:
Q: Specifying number of decimal places for individual fields in pandas to csv I am using pandas to_csv function, and want to specify the number of decimal places for float numbers. However, I want this to change based on the field.
For example:
my data set looks like this:
sampleID     Call     X      Y
1234         0.1234   0.123  0.123

I want the Call column to always have 4 decimal places and X and Y to always have 3.
Originally, I would use the float_format argument in to_csv, but that only appears applicable if all floats are treated the same way. How would I go about specifying the number of digits for individual columns?

A: You can round the columns before saving as a CSV.  If you need the precision you can copy the DataFrame to retain precision in the original DataFrame.
df['X'] = df['X'].round(3)
df['Y'] = df['Y'].round(3)
df.to_csv('file.csv')


text:
Q: How to read a text file as lines are added I have been asked to write a program that will read a file as it is updated (4 times/millisecond) and print the number of lines to the system. To do this, I have the following code:
     package threadFile;
    import java.io.IOException;
    import java.io.FileReader;

    import java.io.BufferedReader;

public class ReadFile
{
private String path;

    public ReadFile(String file_name)
    {
        path = file_name;
    }

    public String[] OpenFile() throws IOException
    {
        FileReader fr = new FileReader(path);
        BufferedReader textReader = new BufferedReader(fr);

        int numberOfLines = readLines();
        String[]textData = new String[numberOfLines];

        int i;
        for(i=0; i< numberOfLines; i++)
        {
            textData[i] = textReader.readLine();
        }
        textReader.close();
        return textData;
    }

    @SuppressWarnings("unused")
    int readLines() throws IOException
    {
        FileReader file_to_read = new FileReader(path);
        BufferedReader bf = new BufferedReader(file_to_read);

        String aLine;
        int numberOfLines = 0;

        while ((aLine = bf.readLine()) != null)
        {
            numberOfLines++;
        }
        bf.close();

        return numberOfLines;
    }

The above code is meant to open a text file and read the number of lines there are. My issue is, getting the program to update as the file is written to (by another section of the program).The below code is a thread, and is meant to call into ReadFile for instructions.
I need the program to constantly read the contents, and accurately update the line count as it is edited.

A: If I understand correctly your requirement you want to use one file for Inter Process Communication (or inter thread-communication to be more exact for your case). If this is the case you probably want to use the file as MemoryMapped file.
A simple description of MemoryMapped file usage is done here.
As it was already said, Java 1.7 Watch Service is also a solution that could work.

A: Solution
The solution to my problem was a little more involved than expected.
Reading Files
package threadFile;
import java.io.BufferedReader;
import java.io.FileInputStream;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class PrintReader implements Runnable
{
    @SuppressWarnings("unused")
    private final String taskName;

    final String file_name = "C:/Users/wigginsm/Desktop/Log.txt";

    public PrintReader(String name)
    {
        taskName = name;
    }
    public void run()
    {
        boolean loop = true;
        while(loop = true)
        try
        {
            FileReader fr = new FileReader(file_name);
            BufferedReader br = new BufferedReader(fr);
            String line = br.readLine();
            int count = 0;
            while(line!=null)
            {
                count++;
                line=br.readLine();
            }
            FileInputStream fileIn = new FileInputStream(file_name);
            BufferedReader fileR = new BufferedReader(new InputStreamReader(fileIn));
            String strLine = null, tmp;
            while((tmp = fileR.readLine())!=null)
            {
                strLine = tmp;
            }
            String lastLine = strLine;
            System.out.println("Last entered line: " + lastLine + "\n" + "Total number of Lines: " + count);
            br.close();
            fileR.close();
        }
        catch(IOException e)
        {
            e.printStackTrace();
        }
    }
}

The above class is responsible for reading the file, declared with "file_name".
Writing to Files
    package threadFile;
import java.io.FileWriter;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.Calendar;
public class WriteToFile implements Runnable
{
    @SuppressWarnings("unused")
    private final String taskName;
    class WriteFile
    {
        private String path;
        private boolean append_to_file = false;

        public WriteFile(String file_path, boolean append_value)
        {
            path = file_path;
            append_to_file = append_value;
        }

        public void writeToFile(String timestamp) throws IOException
        {
            int i = 0;
            while(i<1)
            {
              FileWriter write = new FileWriter(path, append_to_file);
              Calendar current = Calendar.getInstance();
              int ms = current.get(Calendar.MILLISECOND);
              int minute = current.get(Calendar.MINUTE);
              int second = current.get(Calendar.SECOND);
              int hour = current.get(Calendar.HOUR_OF_DAY);
              int day = current.get(Calendar.DAY_OF_YEAR);
              int month = current.get(Calendar.MONTH)+1;
              int year = current.get(Calendar.YEAR);
              timestamp = day + "/" + month + "/" + year + " " + hour  + ":" + minute + ":" + second + ":" + ms;

              PrintWriter print_line = new PrintWriter(write);
              try
              {
                  Thread.sleep(250);
              }
              catch(InterruptedException e)
              {
                  Thread.currentThread().interrupt();
              }
              print_line.printf("%s" + "%n", timestamp);
              print_line.close();
            }
       }
    }
    //constructor
    public WriteToFile(String name)
    {
        taskName = name;
    }
    @SuppressWarnings("unused")
    public synchronized void run()
    {
        boolean loop = true;
        while(loop = true)
        {
            try
            {
                String file_name = "C:/Users/wigginsm/Desktop/Log.txt";
                Calendar current = Calendar.getInstance();
                int ms = current.get(Calendar.MILLISECOND);
                int minute = current.get(Calendar.MINUTE);
                int second = current.get(Calendar.SECOND);
                int hour = current.get(Calendar.HOUR_OF_DAY);
                int day = current.get(Calendar.DAY_OF_YEAR);
                int month = current.get(Calendar.MONTH)+1;
                int year = current.get(Calendar.YEAR);
                String timestamp = day + "/" + month + "/" + year + " " + hour  + ":" + minute + ":" + second + ":" + ms;
                WriteFile data = new WriteFile(file_name, true);
                data.writeToFile(timestamp);
            }

            catch(IOException e)
            {
                System.out.println(e.getMessage());
            }
        }
    }
}

The above code is responsible for writing to the file. The only reason for the while loop to continue indefinitely is due to my program specification. This can easily be altered to fit any iteration.
Execution
package threadFile;
import java.util.concurrent.Executors;
import java.util.concurrent.ExecutorService;

public class execute
{
    public static void main(String[] args)
    {
        final String file_name = "C:/Users/wigginsm/Desktop/Log.txt";

        WriteToFile writes = new WriteToFile(file_name);
        PrintReader reads = new PrintReader(file_name);
        ExecutorService thread = Executors.newCachedThreadPool();

        thread.execute(reads);
        thread.execute(writes);

        thread.shutdown();
    }
}

This is the main class, it is responsible for handling the threading. Both PrintWrite and WriteToFile have the "synchronize" statement, as run() in both classes accesses the file.


text:
Q: The idea of Boyer-Moore's good suffix search One of the key features of Boyer-Moore's algorithm is searching for good suffix. It requires to build a table of shifts on each possible suffix? But how to build this shift table? I don't understand it. Thank you!

A: There is an excellent explanation in the german wikipedia. I know this might not help, but with a bit of luck you can try to understand the example which is very clear.


text:
Q: Proving $\sin(\frac{\pi}{2}+z)=\cos(z)$
Prove $$\sin(\frac{\pi}{2}+z)=\cos(z)$$

My attempt using Euler identity:
$\sin(\frac{\pi}{2}+z)=\frac{e^{i(\frac{\pi}{2}+z)}-e^{i(-\frac{\pi}{2}-z)}}{2i}=\frac{e^{-y}(\cos(\frac{\pi}{2}+x)+i\sin(\frac{\pi}{2}+x))-e^y(\cos(\frac{-\pi}{2}-x)+i\sin(\frac{-\pi}{2}-x)))}{2i}=\frac{e^{-y}(-\sin(x)+i\cos(x))-e^y(-\sin(x)-i\cos(x)))}{2i}$
Now using $\frac{1}{i}=-i$ I get:
$\frac{e^{-y}(\cos(x)+i\sin(x))-e^y(-\cos(x)+i\sin(x)))}{2}$
However the last expression does not equal the $\cos(z)$. I have checked many times but I have no idea what I am doing wrong.
Question:
What am I doing wrong on my proof? How should I correct it?
Thanks in advance!

A: There is an easier way, without separating the real and imaginary part of $z$.
Namely,
$$\sin\left(\frac{\pi}{2}+z\right) = \frac{1}{2i}\left( e^{i(\pi/2+z)} - e^{-i(\pi/2+z)} \right) = \frac{1}{2i} \left( ie^{iz} - (-i)e^{-iz} \right)=\frac{1}{2}(e^{iz}+e^{-iz})=\cos z$$
We used the fact that $e^{i\pi/2} = i$.
Also, your proof thus far is correct, because the last expression you got is equal to
$$\frac{1}{2} (e^{-y+ix}+e^{y-ix}) = \frac{1}{2} \left(e^{i(x+iy)}+e^{-i(x+iy)}\right) = \frac{1}{2}(e^{iz}+e^{-iz}) = \cos z$$

A: Hint: $$e^{\frac{i\pi}{2}}=i$$


text:
Q: Customize Redirection in Laravel Auth I want to customize Laravel Auth. I want to distinguish between admins and users. In the default users table, I added column role with two options: admin and user. According to the manual, I'm defining redirectTo method.
class LoginController extends Controller
{
    use AuthenticatesUsers;

    /**
     * Where to redirect users after login.
     */

    /**
     * Create a new controller instance.
     *
     * @return void
     */
    public function __construct()
    {
        $this->middleware('guest')->except('logout');
    }

    protected function redirectTo()
    {
        if (Auth::user()->role == 'admin') {
            return 'admin/home';
        } else {
            return '/main';
        }
    }

    protected function show_admin_homepage()
    {
        return view('auth.admin_h');
    }

    protected function show_user_homepage()
    {
        return view('auth.user_h');
    }
}

Routes
Route::get('main', 'Auth\LoginController@show_user_homepage')->name('show_user_homepage');
Route::get('admin/home', 'Auth\LoginController@show_admin_homepage')->name('show_admin_homepage');

The problem is that when I'm logging as a user or as admin, I'm always redirecting to default laravel home view. What I'm doing wrong?

A: The default Login Controller is using AuthenticatesUsers trait. In the trait, there is a protected method defined named authenticated override it in the Login Controller.
Below is an implementation of the authenticated method
protected function authenticated($request, $user)
{
    if($user->role == 'admin')
    {
        return redirect('/admin/dashboard');
    }
    else if($user->role == 'user')
    {
        return redirect('/dashboard');
    }
}

A: You should change redirection in the handle method of the RedirectIfAuthenticated.php file which locate in the App/Http/Middleware
It method looks like following;
public function handle($request, Closure $next, $guard = null)
{
    if (Auth::guard($guard)->check()) {
        return redirect('/home');
    }

    return $next($request);
}

A:
I would like to distinguish admins and users...

Instead of trying to re-create the wheel and tinkering with the Auth, why not just use something that's already built and easy to use?
Spatie/Laravel-Permission can help you out a ton here.
For example, to create an 'admin' role, you would just do the following:
$role = Role::create(['name' => 'admin']);

Then give it some permissions:
$permission = Permission::create(['name' => 'super power']);
$role->givePermissionTo($permission);

And assign a role to a User model in your controller
$user->assignRole('admin');

From there you can query whether or not a user has a particular role, either in your controller:
if( $user->hasRole('admin') )
{
    // The user has the admin role
    return view('admin-page');

} else {
    // This is a generic user
    return view('main');

}

OR in your blade
@role('admin')
    I took the red pill!
@else
    I took the blue pill..
@endrole

I suggest this because it's scalable and easy to integrate into your project. As your project continues to grow, if you need to add new permissions to a role it's a single line of code.


text:
Q: Make controller property persistent What is the best way to remember the property value of a controller? Take a look here:
jsbin example
I want to remember if an element was expanded, but only during the current session, I don't want to save this value into the datastore. The problem is, doing the following steps:

*

*Expand "Artist"

*Expand "Album"

*Collapse "Artist"

*Expand again "Artist"

"Album" is also collapsed! The value isExpanded from the "Album" was lost, seems that ember recreates the controller every time. Which would we a good solution to remember the value of isExpanded?

A: If you want the value to be persisted past the lifetime of the controller then you need to save it in a controller that will stay in scope as long as you want it to live (I'm not sure what your full intent is, but if it's really a lifetime of the page value you may want to store it on the application controller)
http://jsbin.com/osoFiZi/5/edit
App.AlbumController = Ember.ObjectController.extend({
  needs: ['artist'],
  actions: {
    toggleExpanded: function() {
      this.toggleProperty('controllers.artist.isAlbumsExpanded');
    }
  }
});

A: You can add property to model
App.Artist = DS.Model.extend({
  isExpanded: false, // this property will not be included into PUT request when you will save record
  name: DS.attr('string'),
  albums: DS.hasMany('album', {async: true})
});

and toggle it in controller
actions: {
  toggleExpanded: function() {
    this.toggleProperty('model.isExpanded');
  }
}

http://jsbin.com/OtEBoNO/2/edit


text:
Q: chat_member and my_chat_member dont work on this code in node-telegram-bot-api bot.on('chat_member', async msg => {
console.log(msg,'dsadsa')})

hi
this event dont work in this lib
node-telegram-bot-api
but i dont know why?
i seen there is no chat_member in codes
`on(event: TelegramBot.MessageType | 'message', listener: (message: TelegramBot.Message, metadata: TelegramBot.Metadata) => void): this;

on(event: 'callback_query', listener: (query: TelegramBot.CallbackQuery) => void): this;

on(event: 'inline_query', listener: (query: TelegramBot.InlineQuery) => void): this;

on(event: 'poll_answer', listener: (answer: TelegramBot.PollAnswer) => void): this;

on(event: 'chosen_inline_result', listener: (result: TelegramBot.ChosenInlineResult) => void): this;

on(
    event: 'channel_post' | 'edited_message' | 'edited_message_text' | 'edited_message_caption' | 'edited_channel_post' | 'edited_channel_post_text' | 'edited_channel_post_caption',
    listener: (message: TelegramBot.Message) => void
): this;

on(event: 'shipping_query', listener: (query: TelegramBot.ShippingQuery) => void): this;

on(event: 'pre_checkout_query', listener: (query: TelegramBot.PreCheckoutQuery) => void): this;

on(event: 'polling_error' | 'webhook_error' | 'error', listener: (error: Error) => void): this;

`


text:
Q: Change "My Account" to "Sign in/Sign out" option in header in magento rwd theme? I want to change "My Account" to "Sign in/Sign out" option in header in the upper right corner.
In C:\wamp\www\magento\app\design\frontend\base\default\layout\customer.xml
I changed
<default>

    <reference name="top.links">
        <action method="addLink" translate="label title" module="customer">My Account<url helper="customer/getAccountUrl"/><title>My Account</title><prepare/><urlParams/><position>10</position></action>
    </reference>
</default>

to
<default>

    <reference name="top.links">
        <action method="addLink" translate="label title" module="customer">Sign In/Sign Out<url helper="customer/getAccountUrl"/><title>Sign In/Sign Out</title><prepare/><urlParams/><position>10</position></action>
    </reference>
</default>

Still not displaying Sign In/Sign Out....
So how to do?

A: <default>
<customer_logged_in>

    <reference name="top.links">
        <action method="addLink" translate="label title" module="customer">My Account<url helper="customer/getAccountUrl"/><title>My Account</title><prepare/><urlParams/><position>10</position></action>
    </reference>
</customer_logged_in>
<customer_logged_out>

    <reference name="top.links">
        <action method="addLink" translate="label title" module="customer">Sign In/Sign Out<url helper="customer/getAccountUrl"/><title>Sign In/Sign Out</title><prepare/><urlParams/><position>10</position></action>
    </reference>
</customer_logged_out>

Try that.. the idea is to put it inside this tag "customer_logged_in" and "customer_logged_out"


text:
Q: How Can I hide same value in the JTable by using DefaultTableCellRenderer I make a timetable with Java, but I cannot solve one problem.
I want to change the foreground color as same as background color or Hiding a value, when some cells have a same value at first detected cell.
Like this...

Here's what I made...

(Sorry about Korean words...)
So, I want to use a DefaultTableCellRenderer, but I can't find a good example about this.
And, I don't know how DefaultTableCellRenderer works. Can't find any explains about that...
So, I want to ask a favor about that problem.
Here's my code:
public class subject_table_renderer extends DefaultTableCellRenderer
{
private Object subject_name = "";
@Override
public Component getTableCellRendererComponent(JTable table, Object value, boolean   isSelected, boolean hasFocus, int row, int column)
{
    Component cell = super.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column);
    if (! isSelected)
    {
        if(value.equals("")){
                cell.setBackground(Color.WHITE);
        }
        else{
            String[] temp = MainFrame.find_list((String)value, MainFrame.subject);
            //take a subject_list for decide background color

            if(!value.equals(subject_name)){
                subject_name = value;
                cell.setBackground(get_rand_color(cell, Integer.parseInt(temp[6])));
            }
            else{
                cell.setBackground(get_rand_color(cell, Integer.parseInt(temp[6])));
                cell.setForeground(get_rand_color(cell, Integer.parseInt(temp[6])));
            }
        }
    }
    return cell;
}

A:
And, I don't know how DefaultTableCellRenderer works. Can't find any explains about that...

Maybe start with the Swing tutorial on Concepts: Editors and Renderers.
You can't use an instance variable to track the previous value because you can't be guaranteed that the rows will always be rendered in sequential order. For example if row 1 is selected and then you click on row 10, only rows 1 and 10 will be repainted.
So the solution is to compare the previous value in the render with code something like:
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import javax.swing.text.*;
import javax.swing.table.*;

public class SSCCE extends JPanel
{
    public SSCCE()
    {
        setLayout( new BorderLayout() );

        JTable table = new JTable(10, 1);
        table.setValueAt("one", 0, 0);
        table.setValueAt("one", 1, 0);
        table.setValueAt("two", 2, 0);
        table.setValueAt("two", 3, 0);
        table.setValueAt("two", 4, 0);
        table.setValueAt("three", 5, 0);
        add( new JScrollPane( table ) );

        table.getColumnModel().getColumn(0).setCellRenderer( new DuplicateRenderer() );
    }

    /*
    **  Color the focused cell
    */
    class DuplicateRenderer extends DefaultTableCellRenderer
    {
        @Override
        public Component getTableCellRendererComponent(
            JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column)
        {
            super.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column);

            if (row > 0 && value != null)
            {
                Object previous = table.getValueAt(row - 1, column);

                if (value.equals(previous))
                {
                    setText("");
                }
            }

            return this;
        }
    }

    private static void createAndShowGUI()
    {
        JFrame frame = new JFrame("SSCCE");
        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        frame.add(new SSCCE());
        frame.setLocationByPlatform( true );
        frame.pack();
        frame.setVisible( true );
    }

    public static void main(String[] args)
    {
        EventQueue.invokeLater( () -> createAndShowGUI() );
/*
        EventQueue.invokeLater(new Runnable()
        {
            public void run()
            {
                createAndShowGUI();
            }
        });
*/
    }
}


text:
Q: void cannot be converted to Void in function map My problem is at removeDuplicates(C), why it doesn't accept it this way? Also, can somebody explain how stream works?
List<String> countries = new ArrayList<String>() {
    {
        add("Indiaaaa");
        add("Rommania");
        add("UUUUK");
    }
};
countries.stream()
    .map(c -> removeDuplicates(c))
    .forEach(n -> System.out.print(n + " "));
}

And here is the function removeDuplicates:
public static void removeDuplicates(String s) {
    char[] chars = s.toCharArray();
    Set<Character> result = new LinkedHashSet<>();
    for(Character c : chars) {
        result.add(c);
    }
    result.forEach(n -> System.out.print(n));
}

A: removeDuplicates has no return value.  That's what void means.  Therefore you can't map with it.
The way you've written it, the closest thing to what I think you mean would be
countries.stream().forEach(country -> {
   removeDuplicates(country); // prints out the letters without duplicates
                              // doesn't actually modify country,
                              // or return the deduplicated characters
   System.out.print(" ");
});

...although you could also remove .stream(), and just write countries.forEach(...).


text:
Q: How to use user input across classes in Ruby? I'm writing an app that scrapes genius.com to show a user the top ten songs. The user can then pick a song to see the lyrics.
I'd like to know how to employ the user input collected in my cli class inside of a method in my scraper class.
Right now I have part of the scrape happening outside the scraper class, but I'd like a clean division of responsibility.
Here's part of my code:
Class CLI

def get_user_song
  chosen_song = gets.strip.to_i
  if chosen_song > 10 || chosen_song < 1
  puts "Only the hits! Choose a number from 1-10."
end

I'd like to be able to do something like the below.
Class Scraper

def self.scrape_lyrics
  page = Nokogiri::HTML(open("https://genius.com/#top-songs"))
  @url = page.css('div#top-songs a').map {|link| link['href']}
  user_selection = #input_from_cli #<---this is where I'd like to use the output
  # of the 'gets' method above.

  @print_lyrics = @url[user_selection - 1]
  scrape_2 = Nokogiri::HTML(open(@print_lyrics))
  puts scrape_2.css(".lyrics").text
end

I'm basically wondering how I can pass the chosen song variable into the Scraper class. I've tried a writing class method, but was having trouble writing it in a way that didn't break the rest of my program.
Thanks for any help!

A: I see two possible solutions to your problem. Which one is appropriate for this depends on your design goals. I'll try to explain with each option:

*

*From a plain reading of your code, the user inputs the number without seeing the content of the page (through your program). In this case the simple way would be to pass in the selected number as a parameter to the scrape_lyrics method:
def self.scrape_lyrics(user_selection)
  page = Nokogiri::HTML(open("https://genius.com/#top-songs"))
  @url = page.css('div#top-songs a').map {|link| link['href']}
  @print_lyrics = @url[user_selection -1]
  scrape_2 = Nokogiri::HTML(open(@print_lyrics))
  puts scrape_2.css(".lyrics").text
end

All sequencing happens in the CLI class and the scraper is called with all necessary data at the get go.

*When imagining your tool more interactively, I was thinking it could be useful to have the scraper download the current top 10 and present the list to the user to choose from. In this case the interaction is a little bit more back-and-forth.
If you still want a strict separation, you can split scrape_lyrics into scrape_top_ten and scrape_lyrics_by_number(song_number) and sequence that in the CLI class.
If you expect the interaction flow to be very dynamic it might be better to inject the interaction methods into the scraper and invert the dependency:
def self.scrape_lyrics(cli)
  page = Nokogiri::HTML(open("https://genius.com/#top-songs"))
  titles = page.css('div#top-songs h3:first-child').map {|t| t.text}
  user_selection = cli.choose(titles) # presents a choice to the user, returning the selected number

  @url = page.css('div#top-songs a').map {|link| link['href']}
  @print_lyrics = @url[user_selection - 1]
  scrape_2 = Nokogiri::HTML(open(@print_lyrics))
  puts scrape_2.css(".lyrics").text
end

See the tty-prompt gem for an example implementation of the latter approach.


text:
Q: Gmail App search criteria I have the following search criteria working very well in Gmail:
user@domain  from:/mail delivery/ || /postmaster/ ||/Undeliverable/

I am trying to write Goole Apps code to return the same results. Here is the code:
var thread=GmailApp.search("user@domain  from:/mail delivery/ || /postmaster/ ||/Undeliverable/ ");

I am getting different results. I am new to both Regex and Google Apps.

A: Try Amit Agarwal's tutorial on Gmail Search with Google Apps Script which includes Using Regular Expressions to Find Anything in your Gmail Mailbox:
function Search() {

var sheet   = SpreadsheetApp.getActiveSheet();
var row     = 2;

// Clear existing search results
sheet.getRange(2, 1, sheet.getMaxRows() - 1, 4).clearContent();
// Which Gmail Label should be searched?
var label   = sheet.getRange("F3").getValue();
// Get the Regular Expression Search Pattern
var pattern = sheet.getRange("F4").getValue();
// Retrieve all threads of the specified label
var threads = GmailApp.search("in:" + label);

for (var i = 0; i < threads.length; i++) {

  var messages = threads[i].getMessages();

  for (var m = 0; m < messages.length; m++) {
    var msg = messages[m].getBody();
    // Does the message content match the search pattern?
    if (msg.search(pattern) !== -1) {
     // Format and print the date of the matching message
     sheet.getRange(row,1).setValue(
      Utilities.formatDate(messages[m].getDate(),"GMT","yyyy-MM-dd"));
     // Print the sender's name and email address
     sheet.getRange(row,2).setValue(messages[m].getFrom());
     // Print the message subject
     sheet.getRange(row,3).setValue(messages[m].getSubject());
     // Print the unique URL of the Gmail message
     var id = "https://mail.google.com/mail/u/0/#all/"
       + messages[m].getId();
     sheet.getRange(row,4).setFormula(
       '=hyperlink("' + id + '", "View")');
     // Move to the next row
     row++;
   }
  }
 }
}


text:
Q: Phonegap not building to android I'm using Ubuntu 16.04 x64 to build my Phonegap project, I have installed Android Studio and SDK, updated all in the SDK Manager.
But when I try build with command phonegap build android, return fallowing error:
BUILD FAILED

Total time: 2.069 secs

phonegap build android --debug
[phonegap] executing 'cordova build android --debug ' ...
cp: no such file or directory: /home/lxuancheng/Documents/Projects/dont-press/www/res/icon/android/drawable-ldpi-icon.png

cp: no such file or directory: /home/lxuancheng/Documents/Projects/dont-press/www/res/icon/android/drawable-mdpi-icon.png

cp: no such file or directory: /home/lxuancheng/Documents/Projects/dont-press/www/res/icon/android/drawable-hdpi-icon.png

cp: no such file or directory: /home/lxuancheng/Documents/Projects/dont-press/www/res/icon/android/drawable-xhdpi-icon.png

cp: no such file or directory: /home/lxuancheng/Documents/Projects/dont-press/www/res/icon/android/drawable-xxhdpi-icon.png

cp: no such file or directory: /home/lxuancheng/Documents/Projects/dont-press/www/res/icon/android/drawable-xxxhdpi-icon.png

cp: no such file or directory: /home/lxuancheng/Documents/Projects/dont-press/www/res/screen/android/drawable-land-ldpi-screen.png

cp: no such file or directory: /home/lxuancheng/Documents/Projects/dont-press/www/res/screen/android/drawable-land-mdpi-screen.png

cp: no such file or directory: /home/lxuancheng/Documents/Projects/dont-press/www/res/screen/android/drawable-land-hdpi-screen.png

cp: no such file or directory: /home/lxuancheng/Documents/Projects/dont-press/www/res/screen/android/drawable-land-xhdpi-screen.png

cp: no such file or directory: /home/lxuancheng/Documents/Projects/dont-press/www/res/screen/android/drawable-land-xxhdpi-screen.png

cp: no such file or directory: /home/lxuancheng/Documents/Projects/dont-press/www/res/screen/android/drawable-land-xxxhdpi-screen.png

cp: no such file or directory: /home/lxuancheng/Documents/Projects/dont-press/www/res/screen/android/drawable-port-ldpi-screen.png

cp: no such file or directory: /home/lxuancheng/Documents/Projects/dont-press/www/res/screen/android/drawable-port-mdpi-screen.png

cp: no such file or directory: /home/lxuancheng/Documents/Projects/dont-press/www/res/screen/android/drawable-port-hdpi-screen.png

cp: no such file or directory: /home/lxuancheng/Documents/Projects/dont-press/www/res/screen/android/drawable-port-xhdpi-screen.png

cp: no such file or directory: /home/lxuancheng/Documents/Projects/dont-press/www/res/screen/android/drawable-port-xxhdpi-screen.png

cp: no such file or directory: /home/lxuancheng/Documents/Projects/dont-press/www/res/screen/android/drawable-port-xxxhdpi-screen.png

ANDROID_HOME=/opt/android-sdk-linux

JAVA_HOME=/usr/lib/jvm/java-8-openjdk-amd64

:preBuild UP-TO-DATE

:preDebugBuild

UP-TO-DATE

:checkDebugManifest

:CordovaLib:preBuild UP-TO-DATE

:CordovaLib:preDebugBuild
 UP-TO-DATE

:CordovaLib:compileDebugNdk
 UP-TO-DATE

:CordovaLib:compileLint

:CordovaLib:copyDebugLint
 UP-TO-DATE

:CordovaLib:mergeDebugProguardFiles UP-TO-DATE
:CordovaLib:packageDebugRenderscript UP-TO-DATE
:CordovaLib:checkDebugManifest

:CordovaLib:prepareDebugDependencies
:CordovaLib:compileDebugRenderscript

UP-TO-DATE

:CordovaLib:generateDebugResValues

UP-TO-DATE

:CordovaLib:generateDebugResources

UP-TO-DATE

:CordovaLib:packageDebugResources
 UP-TO-DATE

:CordovaLib:compileDebugAidl

UP-TO-DATE

:CordovaLib:generateDebugBuildConfig
 UP-TO-DATE

:CordovaLib:generateDebugAssets
 UP-TO-DATE
:CordovaLib:mergeDebugAssets

UP-TO-DATE

:CordovaLib:processDebugManifest

UP-TO-DATE

:CordovaLib:processDebugResources

UP-TO-DATE

:CordovaLib:generateDebugSources

UP-TO-DATE

:CordovaLib:compileDebugJavaWithJavac
 UP-TO-DATE

:CordovaLib:processDebugJavaRes
 UP-TO-DATE
:CordovaLib:transformResourcesWithMergeJavaResForDebug

UP-TO-DATE

:CordovaLib:transformClassesAndResourcesWithSyncLibJarsForDebug

UP-TO-DATE

:CordovaLib:mergeDebugJniLibFolders

UP-TO-DATE

:CordovaLib:transformNative_libsWithMergeJniLibsForDebug

UP-TO-DATE

:CordovaLib:transformNative_libsWithSyncJniLibsForDebug

UP-TO-DATE

:CordovaLib:bundleDebug

UP-TO-DATE

:prepareAndroidCordovaLibUnspecifiedDebugLibrary

UP-TO-DATE

:prepareDebugDependencies

:compileDebugAidl
 UP-TO-DATE

:compileDebugRenderscript
 UP-TO-DATE
:generateDebugBuildConfig
 UP-TO-DATE

:generateDebugAssets
 UP-TO-DATE
:mergeDebugAssets

UP-TO-DATE
:generateDebugResValues

UP-TO-DATE

:generateDebugResources
 UP-TO-DATE

:mergeDebugResources

UP-TO-DATE
:processDebugManifest UP-TO-DATE
:processDebugResources
/home/lxuancheng/Documents/Projects/dont-press/platforms/android/build/intermediates/res/merged/debug/values/values.xml:4 : AAPT: Apostrophe not preceded by \ (in Don't Press!)

 FAILED

FAILURE:
Build failed with an exception.

* What went wrong:

Execution failed for task ':processDebugResources'.

>
com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command '/opt/android-sdk-linux/build-tools/24.0.1/aapt'' finished with non-zero exit value 1

* Try:

Run with
--stacktrace
 option to get the stack trace. Run with
--info
 or
--debug
 option to get more log output.

BUILD FAILED

Total time: 2.408 secs

Error: Error code 1 for command: /home/lxuancheng/Documents/Projects/dont-press/platforms/android/gradlew with args: cdvBuildDebug,-b,/home/lxuancheng/Documents/Projects/dont-press/platforms/android/build.gradle,-Dorg.gradle.daemon=true,-Pandroid.useDeprecatedNdk=true

A: values.xml line 4 :
AAPT: Apostrophe not preceded by \ (in Don't Press!)
Please update your string to Don\'t Press! to escape the apostrophe.

A: When you open up your project in Android Studio, it uses its own version of gradle and this version differs with the version that phonegap build uses most of the time.
Try this, it should work :

*

*Delete android build files : phonegap clean

*And then : phonegap build android

A: I has create Phonegap project in another computer.
I resolved this problem re-created Phonegap project in my actual pc, and merged wwwfolder.
And I have REPLACED www folder with my project, so it has not www/res folder, this maybe turn my project no build.