text:
Q: Use mklink in msys I understand that Windows later-than-or-equal-to Vista provides the mklink shell command. I'd like to make use of this from the Msys terminal. Any idea how?
When I enter mklink on the msys terminal, it outputs sh: mklink: command not found. Msys only provides a fake ln utility which appears to be effectively the same as cp.
I tried writing a shell script to open a Windows shell and run mklink within it, but when my shell script tries to execute cmd /C <instructions>, msys brings the Windows shell to the foreground of the current terminal and leaves it there, without running the instructions.

A: MSYS=winsymlinks:nativestrict requires you to run MSYS2 in elevated mode,
I'm really not comfortable with that.
This script only prompts for UAC elevation when invoked,
of course it won't be useful for scripting then,
but at least it suits my needs:

*

*~/scripts/sh/msys2-ln.sh:
#!/bin/sh
if [ "$#" -eq 2 -a "$1" == "-s" ]; then
    TARGET="$2"
    LINK=$(basename "$TARGET")
elif [ "$#" -eq 3 -a "$1" == "-s" ]; then
    TARGET="$2"
    LINK="$3"
else
    echo "this weak implementation only supports \`ln -s\`"
    exit
fi

if [ -d "$TARGET" ]; then
    MKLINK_OPTS="//d"
fi

TARGET=$(cygpath -w -a "$TARGET")
LINK=$(cygpath -w -a "$LINK")

echo "$TARGET"
echo "$LINK"
cscript //nologo ~/scripts/wsh/run-elevated.js \
    cmd //c mklink $MKLINK_OPTS "$LINK" "$TARGET"

*~/scripts/wsh/run-elevated.js
var args = WScript.Arguments;
if(args.length == 0){
    WScript.Echo("nothing to run");
    WScript.Quit(0);
}

var quoted_args = [];
for(var i = 1; i < args.length; ++i){
    var arg = args(i); // it's a callable, not array like
    if(arg.indexOf(" ") != -1){
        arg = "\"" + arg + "\"";
    }
    quoted_args.push(arg);
}

var SHAPP = WScript.CreateObject("shell.application");
SHAPP.ShellExecute(args(0), quoted_args.join(" "), "", "runas", 1);

*~/.bashrc
# workaround for MSYS2's awkward ln
if [ $- == *i* -a ! -z $MSYSTEM ]; then
    alias ln='~/scripts/sh/msys2-ln.sh'
    alias ecmd='powershell "start-process cmd.exe \"/k cd /d $(pwd -W)\" -verb runas"'
fi

The additional ecmd alias launches an elevated cmd in current directory,
might be useful sometimes,
and it also serves as an example of acquiring UAC elevation through powershell,
if somebody knows how to escape this thing properly,
we can ditch that WSH helper.

A: Using cmd //c mklink directly on the MSYS bash command line should work.
$ cmd //c mklink
Creates a symbolic link.

MKLINK [[/D] | [/H] | [/J]] Link Target

        /D      Creates a directory symbolic link.  Default is a file
                symbolic link.
        /H      Creates a hard link instead of a symbolic link.
        /J      Creates a Directory Junction.
        Link    specifies the new symbolic link name.
        Target  specifies the path (relative or absolute) that the new link
                refers to.

Note:  The mklink command and arguments need to be provided as a single argument to cmd. Quote the entire command like so
cmd //c 'mklink link target'

Note that the command would normally be
cmd  /c 'mklink link target'
which would work in Cygwin and other shell environments,
and even in an existing CMD session.
However, msys seems to mangle command-line arguments (to Windows commands),
and it interprets /c as a pathname to the root of the C disk,
and converts it to c:\.
Typing //c has been found to cause msys to pass the /c option to cmd.
See How to run internal cmd command from the msys shell?

A: Windows 10 now supports symbolic links without needing to run as administrator, so long as you turn on developer mode in the Windows settings.
Once that is done, you can get ln working correctly with a single line in a .bashrc file in your home directory!
export MSYS=winsymlinks:nativestrict

(I was not able to figure out where the equivalent .ini file is in my Git Bash installation. But setting the environment variable there would probably work, too.)
More details in this very helpful article by Josh Kelley:
https://www.joshkel.com/2018/01/18/symlinks-in-windows/

A: You can use Windows native symlinks. To enable it uncomment line with:
MSYS=winsymlinks:nativestrict

in MSYS2 start bat file. And run MSYS2 with admin privileges.


text:
Q: Angular HTTP Param double quotes So I have a request call with method using $http.get angular.
return this.http.get(url+ `/pgb`, { params: {
      page: page.toString(),
      size: perPage.toString(),
      q: `productName=="${productName}"`
    }}

I expected request to be http://url/pgb?page=1&size=10&q=productName=="macbook"
but I got http://url/pgb?page=1&size=10&q=productName==%22macbook%22
I've been trying to use encodeURIComponent and etc but doesn't work.

A: Change
q: `productName=="${productName}"`

to
q: `productName==${productName}`

and try again Hope this helps. you don't need double quotes with URL params.
Thanks,

A: it seems to me like using double equal (==) and quotes in a url is a horrible idea.
If you have control over the server, can you simply add another parameter?
size: perPage.toString(),
productName: productName

otherwise, maybe simply create the string yourself?
var url = 'http://url/pgb?page=1&size=10&q=productName=="macbook"';
return this.http.get(url)

redpajama_set_name: RedPajamaStackExchange


text:
Q: Flutter storing a widget in Provider class and reusing it in multiple widgets Hey Stack overflow community please go easy on me if this question is not a good one :)
Is there any advantage to initialising a widget such as SizedBox with a fixed height within a Provider class that I will use in all my widgets to create a padding within columns.
My thoughts were that because I initialise it once it will be more efficient than to keep creating the same widget over and over again inside all other widgets within my widget tree.
My intuition is that instead of recreating the stateless widget each time, it will reference that same SizedBox that I defined initially in my provider. Also this will make it easier to have the same padding across all of my pages.
For example in C you can either allocate new memory for a new object or store the pointer to that object and just use that pointer to get the object like that. Obviously I might be completely wrong and hence my question.
Thanks in advance :)


text:
Q: Magento 1. Copy all product attribute Labels and Options from storeview 1 to storeview 2 So we have created a new store. Only to see that wee have to manually OPEN and COPY all product attributes Labels and Options 1 by 1. Storeview X already has the correct Labels and Options.
Question: Is there a method to copy ALL product attributes Labels and Options from a certain storeview and store them to the new storeview?

*

*Loop over product attributes

*Get value from root storeview = X

*Copy to storeview = Y

A: Somewhere I have a PHP script for this, but I could not find it actually ... (will update later ...hopefully)
Something we used in the past ...
document.observe('dom:loaded', function(){
    var bodyClass = $('html-body').classNames().toString();
    if (bodyClass == 'adminhtml-catalog-product-attribute-edit') {
        var map = {
            2: 3,       //DE
            1: 17,      //EN
            10: 18,     //FR
            11: 19,     //IT
            12: 20      //ES
        }

        var re = /option\[value\]\[(\d+)\]\[\d+\]/;

        $H(map).each(function(pair){
            var sourceLabel = $$('input[name="frontend_label[' + pair.key + ']"]')[0];
            var targetLabel = $$('input[name="frontend_label[' + pair.value + ']"]')[0];
            if (targetLabel.readAttribute('value') != sourceLabel.readAttribute('value')) {
                targetLabel.setAttribute('value', sourceLabel.readAttribute('value'));
                targetLabel.setStyle({backgroundColor: 'lightgreen'});
            }

            $$('input[name^="option[value]"][name$="[' + pair.key + ']"]').each(function(s){
                var sourceClass = s.readAttribute('name');
                var matches;
                if ((matches = re.exec(sourceClass)) !== null) {
                    if (matches.index === re.lastIndex) {
                        re.lastIndex++;
                    }
                    var sourceOption = s.readAttribute('value');
                    var targetOption = $$('input[name="option[value][' + matches[1] + '][' + pair.value + ']')[0];
                    if (targetOption.readAttribute('value') != sourceOption) {
                        targetOption.setAttribute('value', sourceOption);
                        targetOption.setStyle({backgroundColor: 'lightgreen'});
                    }
                }
            });
        });
    }
});

You have to add this script to attribute edit page and adjust store IDs in var map. Not nice, but it works if you save your attributes manually...

A: You could try this sql query, just change your attribute ID and store id's.
UPDATE eav_attribute_option_value as t1
    INNER JOIN eav_attribute_option_value as t2
        ON t1.option_id = t2.option_id AND t2.store_id = 2
    SET t1.value = t2.value
    WHERE t1.store_id = 4 AND t1.option_id IN (
    SELECT option_id FROM eav_attribute_option WHERE attribute_id = 235
    )


text:
Q: CA lisa can not establish a session with Appium for Mobile automation I am trying to connect CA lisa to run Mobile Tests.
I have attempted to use Appium without CA Lisa and it works but when using CA
Lisa I cannot get passed Establishing connection(should take about 30 seconds) it takes a little over an hour.
CA Lisa loads up my avd and launches the Appium Server but can not establish the session.
I am using a PC and the avd is an Android Nexus 10 but I have attempted this on many Android emulators.
If I could figure out what the Error usually means in Appium I may be able to figure out what is not working.
Every time I attempt to verify it's working I receive the following error:
Message:

Last mobile error in log: debug: Responding to client with error:
  {"status":33,"value":{"message":"A new session could not be created.
  (Original error: Remote install failed: \tpkg:
  /data/local/tmp/74f0c34f850ea7891cb776718411efe5.apk\r\r\nFailure
  [INSTALL_FAILED_MISSING_SHARED_LIBRARY]\r\r\n)","origValue":"Remote
  install failed: \tpkg:
  /data/local/tmp/74f0c34f850ea7891cb776718411efe5.apk\r\r\nFailure
  [INSTALL_FAILED_MISSING_SHARED_LIBRARY]\r\r\n"},"sessionId":null}

StackTrace:

java.lang.Throwable: Unable to open Appium session, quitting after 45
  retries   at
  com.itko.lisa.mobile.appium.process.MobileSessionManager$Callback.doCallback(MobileSessionManager.java:275)
    at
  com.itko.util.swing.panels.ProcessingDialog$2.run(ProcessingDialog.java:194)
    at java.lang.Thread.run(Unknown Source)


text:
Q: ¿Qué diferencia existe entre ToUpper () y ToUpperInvariant ()?, en C# Supongamos esto:
string texto = "Texto a convertir en mayúscula.";

MessageBox.Show("Texto con ToUpper: " + texto.ToUpper() +
                "\nTexto con ToUpperInvariant: " + texto.ToUpperInvariant(),
                "Mensaje en Mayúscula", MessageBoxButtons.OK, MessageBoxIcon.Information);

El resultado es el mismo:

*

*con ToUpper() : "TEXTO A CONVERTIR EN MAYÚSCULA."

*con ToUpperInvariant() : "TEXTO A CONVERTIR EN MAYÚSCULA."

Editado:

Según la descripción del ToUpperInvariant : Aplica las reglas de mayúsculas y minúsculas de la referencia cultural de todos los idiomas.

¿Cuál es la diferencia, algún EJEMPLO donde los resultados pueden ser diferentes?

A: *

*ToUpper(): Toma en cuenta las reglas de la cultura por defecto de tu sistema para determinar como convertir una cadena a mayúsculas.

*ToUpperInvariant(): Usa lo que se podría llamar una cultura neutra para determinar las reglas para convertir una cadena a mayúsculas.

En la práctica, para la gran mayoría de las letras que usamos comúnmente en inglés o español, en realidad no hay diferencia entre los 2 métodos.
Pero en teoría, si trabajaramos en un sistema con una cultura bien peculiar y con caracteres más especiales, entonces podrías notar diferencias.
Por ejemplo, adaptando el ejemplo sacado de esta respuesta de SO, podemos ver que si estuvieramos trabajando en un sitio donde la cultura por defecto es la turca, entonces veríamos una diferencia en cómo se convierte la i a mayúscula:
 string letra = "i";
 var turkeyCulture = new CultureInfo("tr-TR");
 Console.WriteLine(string.Format("{0} ({1})", letra.ToUpperInvariant(), (int)letra.ToUpperInvariant()[0]));
 Console.WriteLine(string.Format("{0} ({1})", letra.ToUpper(turkeyCulture), (int)letra.ToUpper(turkeyCulture)[0]));

Demo
Resultado:
I (73)
İ (304)

De modo que es normalmente preferible usar ToUpperInvariant() para garantizar resultados estables, a menos que tengamos una necesidad especial de tomar en cuenta las reglas de una cierta cultura.

A: Te dejo un link explicando la diferencia, lo único es que está  StackOverFlow en inglés, pero si lo traduces vas a entender de qué se trata:
https://stackoverflow.com/questions/3550213/in-c-sharp-what-is-the-difference-between-toupper-and-toupperinvariant
Espero que te sirva.
Saludos


text:
Q: Images not visible in JList I'm writing a little photo application (asked some questions before) and I have one problem which I cannot resolve. The idea is that there are two sections: the upper one is for an overview (using thumbnails) and the lower one shows the selected image in it's full size. I cannot use ImageIO (required by my lecturer).
I'm using a JList for the overview but most images are not visible. I chose a folder with about 20 images and only 2 show up. And one of them isn't even centered.
For some reason, if I delete those lines:
 thumbnaillist.setFixedCellWidth(thumbW);
 thumbnaillist.setFixedCellHeight(thumbH);

One image shows up that wasn't visible before, but now the other two disappear.
This is my code:
public class PVE extends JFrame {

    private JFileChooser fileChoose;

    //MenuBar
    private JMenuBar menubar;
    private JMenu file;
    private JMenuItem openFolder;
    private JMenuItem exit;

    //Thumbnails
    private JList thumbnaillist;
    private DefaultListModel<ImageIcon> listmodel;
    private JScrollPane tscroll;
    private ImageIcon thumbs;
    private int thumbW = 100;
    private int thumbH = 100;

    //for full size view
    private JPanel imgview;

    public PVE() {
        setLayout(new BorderLayout());

        //MenuBar
        menubar = new JMenuBar();
        file = new JMenu("File");
        openFolder = new JMenuItem("Open folder...");
        exit = new JMenuItem("Quit");
        file.add(openFolder);
        file.addSeparator();
        file.add(exit);
        menubar.add(file);
        setJMenuBar(menubar);

        fileChoose = new JFileChooser();

        openFolder.addActionListener(new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent arg0) {
                fileChoose.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
                fileChoose.showOpenDialog(null);
                File chosenDir = fileChoose.getSelectedFile();
                loadToThumbView(chosenDir);
            }
        });

        //Thumbnail view
        listmodel = new DefaultListModel();
        thumbnaillist = new JList(listmodel);
        thumbnaillist.setLayoutOrientation(JList.HORIZONTAL_WRAP);
        thumbnaillist.setFixedCellWidth(thumbW);
        thumbnaillist.setFixedCellHeight(thumbH);
        thumbnaillist.setVisibleRowCount(1);
        tscroll = new JScrollPane(thumbnaillist, JScrollPane.VERTICAL_SCROLLBAR_NEVER,
            JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
        tscroll.setPreferredSize(new Dimension(0, 100));
        add(tscroll, "North");

        //for full size view
        imgview = new JPanel();
        imgview.setBackground(Color.decode("#f7f7f7"));
        add(imgview, "Center");

        setTitle("Photo Viewer");
        try {
            UIManager.setLookAndFeel("com.sun.java.swing.plaf.windows.WindowsLookAndFeel");
            SwingUtilities.updateComponentTreeUI(this);
        } catch (Exception e) {

        }

        setSize(700, 700);
        setLocation(200, 200);
        setVisible(true);

    }

    public void loadToThumbView(File folder) {
        listmodel.removeAllElements();
        File[] imgpaths = folder.listFiles();
        for (int j = 0; j < imgpaths.length; j++) {
            listmodel.addElement(resizeToThumbnail(new ImageIcon(imgpaths[j].toString())));
        }
    }

    public ImageIcon resizeToThumbnail(ImageIcon icon) {
        Image img = icon.getImage();
        BufferedImage bf = new BufferedImage(img.getWidth(null), img.getHeight(null), BufferedImage.TYPE_INT_ARGB);
        Graphics g = bf.createGraphics();
        g.drawImage(img, 0, 0, thumbW, thumbH, null);
        ImageIcon kB = new ImageIcon(bf);
        return kB;
    }

    public static void main(String argv[]) {
        PVE pv = new PVE();
    }
}

A: Your problem is because of the way you're scaling your images.
I'm not exactly sure why but I guess it has something to do with the BufferedImage#createGraphics() call and that I was able to reproduce the problem with .jpg images while .png files were correctly painted.
However if you scale your images instead of converting them to a BufferedImage and getting a new ImageIcon from it, you get the correct output:
public ImageIcon resizeToThumbnail(ImageIcon icon) {
    Image img = icon.getImage();
    Image scaled = img.getScaledInstance(thumbW, thumbH, Image.SCALE_SMOOTH);
    return new ImageIcon(scaled);
}

This is the folder I used to test:

And the outputs with your code and mine:

Important notes
And as as a recommendation don't make a window that big if all you're using is that little bar above. If you're adding something else below, then it's ok but for now it's not that "user friendly" (IMHO). Instead of JFrame#setSize() you could try using JFrame#pack() method so your frame resizes to it's preferred size.
Some other things I noted in your program:

*

*You're not placing it inside the Event Dispatch Thread (EDT) which is dangerous since your application won't be Thread safe that way. You can change that if you change your main method as follows:
public static void main(String argS[]) {
    SwingUtilities.invokeLater(new Runnable() {
        @Override
        public void run() {
            PVE pv = new PVE();
        }
    });
}

*You're setting the JScrollPane preferred size, instead you should override its getPreferredSize() method, see Should I avoid the use of setPreferred|Maximum|MinimumSize methods in Java Swing? (YES)

*You're extending JFrame, you should instead create an instance of it unless you're overriding one of its methods (and you're not, so don't do it) or you have any good reason to do it. If you need to extend a Container you should extend JPanel instead, as JFrame is a rigid container which cannot be placed inside another one. See this question and this one.
I think I'm not missing anything, and hope this helps

A: Your "scaled" images are actually images which are the same size as the original image, but are blank except for a scaled version drawn in the upper left corner.  That upper left corner is clipped out of view in each rendered cell (at least for the somewhat large images I tested with).
The scaled image needs to be created with the thumbnail size, not the size of the original image.  Meaning, change this:
BufferedImage bf = new BufferedImage(img.getWidth(null), img.getHeight(null), BufferedImage.TYPE_INT_ARGB);

to this:
BufferedImage bf = new BufferedImage(thumbW, thumbH, BufferedImage.TYPE_INT_ARGB);


text:
Q: Designing a Database Schema - Data that is common to all users or custom made Hi I am working on a calendar application using Ruby on Rails. Rails is database agnostic, so in development I'm using SQLite but in production I am looking to use PostgreSQL.The current obstacle that I am facing is with the way I am designing my database schema.
First I have a users table that holds information such as login info and email. Each user has_many plans.
Then I have a plans table that belongs_to users and each plan has an event it references, the date, start time, and end time.
So the plan tables would reference the events table.
Here is my issue:
I would like to have two event tables. One is custom events. The other is default events.
The default events is just a list of common events already defined so the user can already select from a list. The custom events table is a list of events created by a user that references their id.
Here is my solution:
Would it be sufficient to add a new boolean column to the plans table called "custom". And if it is true then the event_id (in plans table) will reference the custom events table, and if it is false then it will reference the default events table. Is this a valid solution and if so, how would I implement it into my Rails application?
Thank you for taking your time to read my question. I am sorry I am an idiot. I am practicing everyday to be better.

A: Try to not think in terms of tables first, but in terms of classes and the behavior of their instances. What would matter most in the end is not how many tables your design has, but whether the responsibilities have been correctly attributed to the different classes in your model.
In this case it looks like you need two different classes, because some events will belong_to a user and other won't. The former will be created, modified and deleted by that user, and the latter will be managed by an admin. The instances of those classes can be stored in the same table using STI (Single Table Inheritance), with a string column named 'type' to enable Rails to store the class for each instance. The UserEvent class will belong_to :user, and the DefaultEvent won't. Both classes can extend Event, which in turn extends ActiveRecord::Base.
Please let me know if you need additional clarification.


text:
Q: SSIS/ETL jobs fail with network related errors, when network is OK We have a SQL Server 2012 instance that is our main ETL/DW server. The daily jobs consist of about 40+ ETL processes querying other data sources, updating the DataMart, standard ETL and BI processes.
For the past several weeks, many jobs have failed with network related errors. Most of these errors consist of:
"Unable to complete login process due to delay in opening server connection"
"Login timeout expired"
"A network-related or instance-specific error has occurred while establishing a connection to SQL Server. Server is not found or not accessible. Check if instance name is correct and if SQL Server is configured to allow remote connections."
All data source accounts, permissions, availability, have been verified as working, and logging in and running the ETL packages manually has worked without issue. The only resource issue we have is high-CPU, between 90-99%, during the daily job processing, which is when these errors come up.
The failures are not consistent, but usually once a week or so we get a large number in any one day, when everything else is running fine.
Where else could I look to find the source of these issues? Is high-CPU utilization causing long waits, which manifest as network errors?

A: It very well could be the high CPU on the SSIS server.  If the CPUs are to busy on the client (in this case the SSIS server) then the client may end up waiting for to long in order to process the response from the SQL Server.  You'll need to reduce the workload on the SSIS box or optimize some stuff so that the CPU load drops so that the connections work without issue.


text:
Q: OTA SMS in Android I know OTA SMS are not supported in every country but in some countries they are still applicable. I wonder to know if the android OS supports OTA SMS  (old black and white photo SMS)?
If yes then how can we send these SMS?

A: You are referring to Nokia's "Smart Messaging"; specifically OTA bitmaps.  They were never very well supported outside of Nokia handsets,  I don't believe any android handsets support them.

A: Over the Air term is consisting different functionalities from recipient perspective. If recipient is Android device itself, OTA messages are used to update the system, application or time zones. Those SMSs are being sent from source system as binary SMS with different data coding scheme. MMS is also one of them.
Android OTA binary SMS packets are not encrypted/signed with SIM OTA keys. OTA messages also can be used for updating SIM files or upload/modify applications on SIM. Recipient of those SMS are SIM card and they have to be sent by entity having OTA SIM Keys or in another words by GSM operator. OTA Secret Keys are very critical and never shared by GSM operators with 3rd parties.
MMS messages are delivered with combination of SMS and WAP technologies. Device receives first WAP Push as binary SMS. This notification contains header information about the MMS message, and a URL pointer that the recipient must fetch in order to retrieve the content of the MMS message.
Android OTA messages can be received by device while its is either connected to Wifi or mobile data. But OTA messages addressing to SIM card can be send only using GSM operators' SMS bearer.


text:
Q: 20:04 Studio: Installed but WiFI fails I got an HP 17-BY2012NA with these specs:
CPU: Intel core 15 quad core
speed/mem/max 600/400/4200 mghz
kernel: 5.4.0-26-low latency x86_64
SSD: 256 GB
OS: Ubuntu Studio 20.04
I got it installed but it's not seeing the WiFi. Any ideas? I'm doing this for a friend btw, so I can't post his system data here.

A: Realtek RTL8821CE is the problem.
From the answer RTL8821CE driver malfunctioning:
git clone https://github.com/shubham151/rtl8821ce.git
cd rtl8821ce
chmod +x dkms-install.sh
chmod +x dkms-remove.sh
sudo ./dkms-install.sh


text:
Q: Accept Microsoft's PsTools T.O.S. in bat/cmd How to accept terms of service in either cmd or bat?
 I've tried
cmd.exe /c echo "Y" | terms.exe

and
cmd.exe /c echo "A" terms.exe

I'm sure I'm just making a rookie error if its possible. My goal is to auto accept the T.O.S. of Microsoft's PsTools.

A: You can use the /accepteula flag to automatically accept the TOS.
Best of luck.

A: you will have to code a flag for this in the application. There is no universal way to do this.
After setting a flag such as Y, you will have to call it with the flag in command line argument.
If you are looking for specific tools, read more about silent install of those tools.
Hope this helps.


text:
Q: Difference between "pardoned" and "forgiven" What is the difference between words "pardoned" and "forgiven"?
For instance:

After ten years in prison, Stephen was {pardoned/forgiven} and set free.

I found the definitions of both:
Pardoned - forgive or excuse (a person, error, or offense).
Forgiven - stop feeling angry or resentful toward (someone) for an offense, flaw, or mistake.
And to conclude from definitions I would say that "forgiven" encompasses "pardoned", but I am not sure about that. So how can one decide where to use pardoned or forgiven?

A: If I am pardoned, I am no longer subject to the consequences of having been found guilty (e.g. of a crime).  If I am forgiven, I am no longer the cause of negative emotions in the one who forgave me.  You can say that pardoning is generally related to a change in punishment or consequences, while forgiving is generally related to a change in feelings or perspective.  There is some overlap between the two words, though.

A: "Forgiven" probably doesn't fit very naturally into this sentence regardless of what you mean. "Forgive" isn't a word that's typically applied to courts, governments, the legal system, etc.
The thing that determines what word fits best here depends on why the prisoner was released.

*

*If the prisoner has received a legal pardon as Andrew explains, then "pardon" is the word you should choose. Native speakers will assume you intend to use the legal definition.

*If the prisoner was originally sentenced to 10 years in prison and that sentence is now complete, then the prisoner just completed their sentence. This isn't typically thought of as any kind of "forgiveness"; the person received a just punishment (assuming they were actually guilty). You can say, "After ten years in prison, Stephen completed his sentence."

*There are some other possibilities for why the prisoner was released. For example, maybe the sentence was reduced to 10 years. Example reasons:

*

*The prisoner won an appeal and the conviction was overturned.

*The sentence was reduced for good behavior or community service or similar reasons.

"Forgiven" doesn't do a good job describing these or other reasons that aren't coming to mind, either. It would be better to find terms specific to those situations.
If your intention is to say that someone personally forgave the prisoner, then that's not a very natural way of organizing the sentence. Consider a separate clause or sentence. For example:

After ten years in prison, Stephen was set free; the victim forgave him.

This is very unspecific about the reason the prisoner was released. Being unspecific is fine if you don't intend to convey any specifics.

A: Others have mentioned legal/emotional aspects, but I think there's some missing points that are important for someone learning the language.

*

*"all is forgiven" is correct but not "all is pardoned"

*"pardon me, I must go to the loo" is correct but not "forgive me, I must go to the loo".

*"forgive me for I have sinned" is correct, but "pardon me but I have sinned" means something entirely different (and sounds funny to an English speaker).

Pardon is the act of expunging (erasing) a transgression - whereas forgiving neither implies erasing nor really transgressions necessarily.
Another saying that is common is "Forgive but don't forget". I would argue that given the above nuance of pardon meaning make as though the transgression didn't happen, one could say that this statement literally means "forgive but don't pardon" (even though you wouldn't really say that in english).
Without getting too theological, "forgive me for I have sinned" is a good one to look at because the idea is that God doesn't pardon you, he just accepts your flaws but forgives you anyways.
The two words are very clearly expressing something different.

A: It depends on the context.  Pardon has multiple meanings, one of which is to "forgive" or "excuse".  This is the definition used in simple expressions like "pardon me", or "I beg your pardon."
Another more formal definition of "pardon" is to be legally forgiven for some kind of crime by an official state agency.   Usually a pardon is only issued after the person has been convicted of the crime.  An official pardon means that the person pardoned is (eventually) cleared of any record of the criminal charge.
A pardon can be issued for various reasons, not always because the person is innocent:

A pardon is a government decision to allow a person who has been convicted of a crime to be free and absolved of that conviction, as if never convicted.  Today, pardons are granted in many countries when individuals have demonstrated that they have fulfilled their debt to society, or are otherwise considered to be deserving.

More info
Forgiveness is more generic.  It's more often used to describe a personal decision to excuse someone for some kind of offense.  As previously mentioned, you can also "pardon" them for that offense, but outside of certain "set" phrases, this use is not common in modern English.

A:
pardoned

has more of a legal meaning

to be pardoned for a crime

whereas

forgiven

has more of a moral meaning

The shooter in North Carolina was forgiven by the families of the victims, but was not legally pardoned and still faces time in jail.


text:
Q: как считывать несколько строк на входе? надо считать входные данные которые подаются рандомным количеством строк и с пробелами колличество которых достигает до 10^9 и засунуть это все в массив.
в версии python 3.6.2 это делается так:
    import sys
    values=[]
    for line in sys.stdin:
        for word in line.split():
            values.append(word)

но в более поздних версиях это перестало так работать.
при вводе
 1427  0

   876652098643267843
5276538

в массив сохраняется только числа из первой строки.
как например на python 3.7 считать данные сразу из несколько строк, некоторые из которых могут быть пустыми?

A: Перепроверьте дебагом, у меня под Python 3.7.1 ваша конструкция работает. Только добавил условие выхода (слово exit) и печать результата.
import sys

values = []
for line in sys.stdin:
    for word in line.split():
        values.append(word)
        if word == 'exit':
            print(values)
            sys.exit(0)

Вывод выглядит так:
1232131 11
   123123123123123

5464564 456456446
      66666
exit
['1232131', '11', '123123123123123', '5464564', '456456446', '66666', 'exit']

Process finished with exit code 0


text:
Q: Failed to load class "org.jboss.as.capedwarf.api.Logger" for handler "CAPEDWARF" I'm getting this error from the JBoss logs when trying to run my GAE app with Openshift/Capedwarf:
Removing existing logging.properties
=========================================================================
  JBoss Bootstrap Environment
  JBOSS_HOME: /var/lib/openshift/12c481204382ec16dc0003b3/jbossas
  JAVA: /etc/alternatives/java_sdk_1.7.0/bin/java
  JAVA_OPTS:  -client -Xmx384m -XX:MaxPermSize=115m -XX:+AggressiveOpts -Dorg.apache.tomcat.util.LOW_MEMORY=true -Dorg.jboss.resolver.warning=true -Djava.net.preferIPv4Stack=true -Dfile.encoding=UTF-8 -Djava.net.preferIPv4Stack=true -Djboss.node.name=app-gwtgae.rhcloud.com -Djgroups.bind_addr=127.13.25.1 -Djboss.server.data.dir=/var/lib/openshift/12c481204382ec16dc0003b3/app-root/data/jboss-as7 -Dcom.google.appengine.runtime.environment=Production -Dorg.apache.tomcat.util.net.MAX_THREADS=20
=========================================================================
java.lang.IllegalArgumentException: Failed to load class "org.jboss.as.capedwarf.api.Logger" for handler "CAPEDWARF"
    at org.jboss.logmanager.config.AbstractPropertyConfiguration.<init>(AbstractPropertyConfiguration.java:75)
    at org.jboss.logmanager.config.HandlerConfigurationImpl.<init>(HandlerConfigurationImpl.java:54)
    at org.jboss.logmanager.config.LogContextConfigurationImpl.addHandlerConfiguration(LogContextConfigurationImpl.java:144)
    at org.jboss.logmanager.PropertyConfigurator.configureHandler(PropertyConfigurator.java:606)
    at org.jboss.logmanager.PropertyConfigurator.configureLogger(PropertyConfigurator.java:541)
    at org.jboss.logmanager.PropertyConfigurator.configure(PropertyConfigurator.java:480)
    at org.jboss.logmanager.PropertyConfigurator.configure(PropertyConfigurator.java:96)
    at org.jboss.as.logging.logmanager.ConfigurationPersistence.configure(ConfigurationPersistence.java:128)
    at org.jboss.logmanager.LogManager.readConfiguration(LogManager.java:300)
    at org.jboss.logmanager.LogManager.readConfiguration(LogManager.java:262)
    at java.util.logging.LogManager$2.run(LogManager.java:312)
    at java.util.logging.LogManager$2.run(LogManager.java:310)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.util.logging.LogManager.readPrimordialConfiguration(LogManager.java:310)
    at java.util.logging.LogManager.getLogManager(LogManager.java:292)
    at java.util.logging.Logger.<init>(Logger.java:265)
    at java.util.logging.LogManager$RootLogger.<init>(LogManager.java:1430)
    at java.util.logging.LogManager$RootLogger.<init>(LogManager.java:1428)
    at java.util.logging.LogManager$1.run(LogManager.java:196)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.util.logging.LogManager.<clinit>(LogManager.java:173)
    at org.jboss.modules.Main.main(Main.java:275)
Caused by: java.lang.ClassNotFoundException: org.jboss.as.capedwarf.api.Logger from [Module "org.jboss.as.capedwarf:main" from local module loader @1bd56d0 (roots: /var/lib/openshift/12c481204382ec16dc0003b3/app-root/runtime/repo/.openshift/config/modules,/var/lib/openshift/12c481204382ec16dc0003b3/app-root/runtime/capedwarf/capedwarf-modules/jboss-as7-modules,/var/lib/openshift/12c481204382ec16dc0003b3/jbossas/modules)]
    at org.jboss.modules.ModuleClassLoader.findClass(ModuleClassLoader.java:190)
    at org.jboss.modules.ConcurrentClassLoader.performLoadClassUnchecked(ConcurrentClassLoader.java:468)
    at org.jboss.modules.ConcurrentClassLoader.performLoadClassChecked(ConcurrentClassLoader.java:456)
    at org.jboss.modules.ConcurrentClassLoader.performLoadClass(ConcurrentClassLoader.java:398)
    at org.jboss.modules.ConcurrentClassLoader.loadClass(ConcurrentClassLoader.java:120)
    at java.lang.Class.forName0(Native Method)
    at java.lang.Class.forName(Class.java:270)
    at org.jboss.logmanager.config.AbstractPropertyConfiguration.<init>(AbstractPropertyConfiguration.java:73)
    ... 21 more
=========================================================================
  JBoss Bootstrap Environment
  JBOSS_HOME: /var/lib/openshift/12c481204382ec16dc0003b3/jbossas
  JAVA: /etc/alternatives/java_sdk_1.6.0/bin/java
  JAVA_OPTS:  -server -XX:+TieredCompilation -XX:+UseSerialGC -Xms40m -Xmx256m -XX:MaxPermSize=102m -XX:+AggressiveOpts -Dorg.apache.tomcat.util.LOW_MEMORY=true -DOPENSHIFT_APP_UUID=12c481204382ec16dc0003b3 -Dorg.jboss.resolver.warning=true -Dfile.encoding=UTF-8 -Djava.net.preferIPv4Stack=true -Djboss.node.name=app-gwtgae.rhcloud.com -Djgroups.bind_addr=127.13.25.1 -Dorg.apache.coyote.http11.Http11Protocol.COMPRESSION=on
=========================================================================
Declared property enabled wasn't found on class org.jboss.logmanager.handlers.PeriodicRotatingFileHandler
=========================================================================
  JBoss Bootstrap Environment
  JBOSS_HOME: /var/lib/openshift/12c481204382ec16dc0003b3/jbossas
  JAVA: /etc/alternatives/java_sdk_1.6.0/bin/java
  JAVA_OPTS:  -server -XX:+TieredCompilation -XX:+UseSerialGC -Xms40m -Xmx256m -XX:MaxPermSize=102m -XX:+AggressiveOpts -Dorg.apache.tomcat.util.LOW_MEMORY=true -DOPENSHIFT_APP_UUID=12c481204382ec16dc0003b3 -Dorg.jboss.resolver.warning=true -Dfile.encoding=UTF-8 -Djava.net.preferIPv4Stack=true -Djboss.node.name=app-gwtgae.rhcloud.com -Djgroups.bind_addr=127.13.25.1 -Dorg.apache.coyote.http11.Http11Protocol.COMPRESSION=on
=========================================================================
Declared property enabled wasn't found on class org.jboss.logmanager.handlers.PeriodicRotatingFileHandler
=========================================================================
  JBoss Bootstrap Environment
  JBOSS_HOME: /var/lib/openshift/12c481204382ec16dc0003b3/jbossas
  JAVA: /etc/alternatives/java_sdk_1.6.0/bin/java
  JAVA_OPTS:  -server -XX:+TieredCompilation -XX:+UseSerialGC -Xms40m -Xmx256m -XX:MaxPermSize=102m -XX:+AggressiveOpts -Dorg.apache.tomcat.util.LOW_MEMORY=true -DOPENSHIFT_APP_UUID=12c481204382ec16dc0003b3 -Dorg.jboss.resolver.warning=true -Dfile.encoding=UTF-8 -Djava.net.preferIPv4Stack=true -Djboss.node.name=app-gwtgae.rhcloud.com -Djgroups.bind_addr=127.13.25.1 -Dorg.apache.coyote.http11.Http11Protocol.COMPRESSION=on
=========================================================================
Declared property enabled wasn't found on class org.jboss.logmanager.handlers.PeriodicRotatingFileHandler
=========================================================================
  JBoss Bootstrap Environment
  JBOSS_HOME: /var/lib/openshift/12c481204382ec16dc0003b3/jbossas
  JAVA: /etc/alternatives/java_sdk_1.6.0/bin/java
  JAVA_OPTS:  -server -XX:+TieredCompilation -XX:+UseSerialGC -Xms40m -Xmx256m -XX:MaxPermSize=102m -XX:+AggressiveOpts -Dorg.apache.tomcat.util.LOW_MEMORY=true -DOPENSHIFT_APP_UUID=12c481204382ec16dc0003b3 -Dorg.jboss.resolver.warning=true -Dfile.encoding=UTF-8 -Djava.net.preferIPv4Stack=true -Djboss.node.name=app-gwtgae.rhcloud.com -Djgroups.bind_addr=127.13.25.1 -Dorg.apache.coyote.http11.Http11Protocol.COMPRESSION=on
=========================================================================
Declared property enabled wasn't found on class org.jboss.logmanager.handlers.PeriodicRotatingFileHandler

Initially, the template capedwarf app worked fine, but when I 'git push' my app its not working. I can assure that the same git repo worked fine as Cloudbees deploys this app with jenkins to GAE cloud (appspot).

A: Can you try this with the latest release, but locally?


text:
Q: O que esta linha significa? --> $.ajaxSetup({ scriptCharset: "utf-8" ,contentType: "application/x-www-form-urlencoded; charset=UTF-8" }) Olá, estou analisando uma programação já feita para aprender, está dando certo, porém cheguei nesta parte e não estou encontrando online o significado dela.
Alguém poderia me ajudar?
Segue a linha de código:
$.ajaxSetup({ scriptCharset: "utf-8" ,contentType: "application/x-www-form-urlencoded; charset=UTF-8" })

Muito obrigado.

A: Essa linha define uma configuração padrão para futuras requisições AJAX que serão realizadas via jQuery.
Ao invés de definir esses assets em todas as chamadas, você os determina previamente e economiza algumas linhas quando necessitar realizar as requisições.
A página do método na documentação do jQuery dá alguns exemplos sobre: https://api.jquery.com/jquery.ajaxsetup/

A: São apenas configurações de conexão ajax contendo especificações sobre o tipo de charset e o conteudo que serão trafegados no HTTP request.
Para compreender melhor sobre os argumentos definidos nessa função, você terá que estudar um pouco sobre a estrutura do protocolo HTTP (Seria interessante pesquisar seu derivado também, que é o TCP), mas em resumo, o código acima só especifica o content Type e o tipo de dado que será passado na requisição.
Links interessantes:

*

*https://en.wikipedia.org/wiki/List_of_HTTP_header_fields

*Qual é a diferença entre x-www-form-urlencoded e form-data?


text:
Q: Controlling animations in an animator via parameters, in sequences So I am animating an avatar, and this avatar has its own animator with states and such.
When interacting with props, the props itself has an animator with states in it. In both case, I transition to some animations through parameters in the animator (bool type).
For example, for a door, the character will have "isOpeningDoor", while the door will have "isOpen".
Now the question: when I change the value on an animator on GO1, and then change the bool on GO2; do the first animation finish and then the second start? Because in my case, it does not happen; they start almost at the same time.
void OnTriggerEnter (collider door)
{
    if (door.gameObject.tag=="door")
    {
         GOAnimator1.SetBool("isOpeningDoor", true);
         GOAnimator2.SetBool("isOpen", true);
    }
}

I believe that I am doing it wrong, since I change the parameter on the animator, but I do not check for the animation to end; is this even possible or am I doing something not kosher?

A: I really think it might be doable!
As you have it in your code now, the animations on GO1 and GO2 start at almost the same time because that's how it's written. The OnTriggerEnter() function will complete the execution in the frame it is called, and return the control to Unity.
What I think that might help you are coroutines and sendMessage between gameobjects:

*

*http://docs.unity3d.com/Manual/Coroutines.html

*http://docs.unity3d.com/ScriptReference/GameObject.SendMessage.html
The idea is to:

*

*Create a coroutine in GO2 that waits an amount of time until it sets the GOAnimator2 variable to activate the door animation.

*Create a function in GO2 that calls the aforementioned coroutine

*From the OnTriggerEnter() send a message to GO2 to execute the newly created function

It reads complicated, but it's fairly simple. The execution would be like this:
1.Code for the coroutine:
    function GO2coroutine(){
      float timeToWait = 0.5f; //Tweak this
      for ( float t = 0f; t < timeToWait; t+=time.deltaTime)
        yield;
      GetComponent<Animator>().SetBool("isOpen",true);
    }

*Code for the function calling it:
function callCoroutine() {
  StartCoroutine("Fade");
}

*And the code modification for your OnTriggerEnter():
void OnTriggerEnter (collider door)
{
    if (door.gameObject.tag=="door")
    {
         GOAnimator1.SetBool("isOpeningDoor", true);
         GO2.SendMessage("callCoroutine");
    }
}

I didn't have a chance to test the code, so please don't copy paste it, there might be slight changes to do.
There is another way, but I don't like it much. That is making the animation longer with an idle status to wait for the first game object animation to end... but it will be a hassle in case you shorten the animation because you have to, or have any other models or events.
Anyway, I think the way to go is with the coroutine! Good Luck!


text:
Q: Custom Django FormWizard Steps with Templates This is my working FormWizard that I made by following this and this
views.py
from django.shortcuts import render
from django.template import RequestContext
from django.http import HttpResponseRedirect
from formtools.wizard.views import SessionWizardView

# Create your views here.
def index(request):
    return render(request, 'wizardApp/index.html')

class ContactWizard(SessionWizardView):
    template_name = "wizardApp/contact_form.html"
    def done(self, form_list, **kwargs):
        process_form_data(form_list)
        return HttpResponseRedirect('../home')

def process_form_data(form_list):
    form_data = [form.cleaned_data for form in form_list]

    print(form_data[0]['subject'])
    print(form_data[0]['info1'])
    print(form_data[0]['info2'])
    print(form_data[1]['sender'])
    print(form_data[1]['info1'])
    print(form_data[1]['info2'])
    print(form_data[2]['message'])
    print(form_data[2]['info1'])
    print(form_data[2]['info2'])

    return form_data

urls.py
from django.conf.urls import url
from wizardApp import views

from wizardApp.forms import ContactForm1, ContactForm2, ContactForm3
from wizardApp.views import ContactWizard

app_name = 'wizardApp'

urlpatterns = [
    url(r'^$', views.index, name='index'),
    url(r'^home/$', views.index, name='index'),
    url(r'^admin/', admin.site.urls),
    url(r'^contact/$', ContactWizard.as_view([ContactForm1, ContactForm2, ContactForm3])),
]

forms.py
from django import forms

class ContactForm1(forms.Form):
    subject = forms.CharField(max_length=100)
    info1 = forms.CharField(max_length=100)
    info2 = forms.CharField(max_length=100)

class ContactForm2(forms.Form):
    sender = forms.EmailField()
    info1 = forms.CharField(max_length=100)
    info2 = forms.CharField(max_length=100)

class ContactForm3(forms.Form):
    info1 = forms.CharField(max_length=100)
    info2 = forms.CharField(max_length=100)
    message = forms.CharField(widget=forms.Textarea)

contact_form.html
<!DOCTYPE html>

        <meta charset="utf-8">
        <title></title>
        {{ wizard.form.media }}

Step {{ wizard.steps.step1 }} of {{ wizard.steps.count }}

<form action="/contact/" method="post">{% csrf_token %}

    {{ wizard.management_form }}
    {% if wizard.form.forms %}
        {{ wizard.form.management_form }}
        {% for form in wizard.form.forms %}
            {{ form }}
        {% endfor %}
        {% else %}
        {{ wizard.form }}
    {% endif %}

    {% if wizard.steps.prev %}
    <button name="wizard_goto_step" type="submit" value="{{ wizard.steps.first }}">first step</button>
    <button name="wizard_goto_step" type="submit" value="{{ wizard.steps.prev }}">prev step</button>
    {% endif %}
    <input type="submit" value="submit"/>
  </form>

I am having a lot of trouble understanding how customizing each step of the form works. There is very little help out there for this unfortunately. I saw this post about creating multiple templates and that kind of helps, but my main disconnect is on how i create those templates and how they are implemented in each step.
In a normal form i can do something like this
<form novalidate="novalidate" autocomplete="on" method="POST">
            {% csrf_token %}

                {{form.first_name}}
                {{form.first_name.errors}}

                {{form.last_name}}
                {{form.last_name.errors}}

              {{form.email}}
              {{form.email.errors}}

              <input type="submit" value="Submit">

        </form>

How do i access each individual field? Where i can add in html and other bits to help with general styling? How should i go about making one of these for each steps? Should i basically be copy and pasting the html and everything into other "templates"? How do i call each template for each step?
Thanks!

A: Hope you figured it out. For the sake of anyone who runs into this, this is how I solved this. I replaced {{ wizard.form }} with a for loop to manually render the inputs:
<form action="/contact/" method="post">{% csrf_token %}

{{ wizard.management_form }}
{% if wizard.form.forms %}
    {{ wizard.form.management_form }}
    {% for form in wizard.form.forms %}
        {{ form }}
    {% endfor %}
    {% else %}
        {% for field in wizard.form %}
            {{ field.label }}
            {{ field }}
            {{ field.errors }}
        {% endfor %}
{% endif %}

{% if wizard.steps.prev %}
<button name="wizard_goto_step" type="submit" value="{{ wizard.steps.first }}">first step</button>
<button name="wizard_goto_step" type="submit" value="{{ wizard.steps.prev }}">prev step</button>
{% endif %}
<input type="submit" value="submit"/>

You can create a template for each of your forms and then associate it to its corresponding form as described in the docs or if you want each form to use the same template, all you need to do is set your template_name attribute in your ContactWizard class:
class ContactWizard(SessionWizardView):
    template_name = "contact_form.html"


text:
Q: Find changed form element I am using jQuery form change event
$('form').change(function(e) {
  alert('hello');
});

I want to know element id for which form changed event is fired.

A: To achieve this you could use a delegated handler on the form element which listens for the change event on child form controls.
You can then use the this keyword within the event handler to reference the element which raised the event, something like this:

$('form').on('change', ':input', function() {
  console.log(this.id);
});
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<form>
  <input type="text" id="foo" />
  <input type="text" id="bar" />
</form>

Alternatively you can keep your current change event handler on the form and rely on the event bubbling up the DOM, and use the target property of the event to determine which element caused the event:

$('form').change(function(e) {
  console.log(e.target.id);
});
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<form>
  <input type="text" id="foo" />
  <input type="text" id="bar" />
</form>

A: $('form').change(function(e) {
  alert($(this).attr('id'));
});

This is if you want to learn which form it is. If you want to learn which input in which form then this must be change. Check out the answers above added by others.

A: You can use $(e.target).attr('id'): DEMO ATTACHED

$('form').on('change', function(e) {

 alert("$(e.target).attr('id'): " +  $(e.target).attr("id"))
 });
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<form>
  <input type="text" id="textBox1" placholder="textBox1"/>
  <input type="text" id="textBox2" placholder="textBox1"/>
</form>


text:
Q: How do I provision push notifications for iOS https://developer.apple.com/library/ios/#documentation/NetworkingInternet/Conceptual/RemoteNotificationsPG/ProvisioningDevelopment/ProvisioningDevelopment.html#//apple_ref/doc/uid/TP40008194-CH104-SW1
Apple's first instruction is "click app ids" but dont see it on the left side... so I think I may be looking in the wrong place/page.
So- does anyone have a clearer explanation on how to provision push notifications for iOS?

A: I don't think so you have admin rights for that account. You just have developer rights for that account.


text:
Q: Sizing of a SharePoint infrastructure I'm working for a customer that need all features of SharePoint 2013 enterprise and I have to estimate a correct sizing of the infrastructure. On this SharePoint, there will be almost 300 users with about 300 pages viewed/day.
The AD is already existing.
Could you help me on this task??
Thanks in advance.

A: Your requirement seems pretty low to me (300 page views / day) but best practices would dictate a small farm to exist of 1 WFE server, 1 APP Server and 1 SQL Server, and a seperate AD which you already have, anyway. Use the Hardware Requirements recommended by Microsoft to have an idea of individual server requirements. You need to read the document carefully, but to give you an idea:

*

*They consider <10.000 users a small deployment

*4 cores minimum on all servers

*8GB to 12GB RAM

Do keep in mind that each component places it's own requirements on the infrastructure, a big one being Search and another one being Office Web Apps (seperate server). This is a good overview, but keep in mind that the values may have been updated since then (I know they have on MSDN since SP 2013's release).
EDIT:
In this slideshare, it is mentioned that 500 concurrent users can bring a 4 server farm (4 cores, 16GB RAm each on average) to a crawl.


text:
Q: Why this set is not a vector space? Let V =R^2 and define addition and scalar multiplication operation as follows :
$u=(u_1, u_2)$
$v=(v_1, v_2)$
$$u+v=(u_1+v_1,u_2+v_2)$$
$$ku=(u_1k,0)$$
The book says : "the addition operation is the standard one from R2, but the scalar multiplication is not".
Why not ? For example :
$K=1$ and $u=(2,4)$ then $Ku=(2,0) \in V$
So what is the problem ??

A: The scalar operation is not the usual one since that one is $k \cdot (a,b) = (ka,kb)$.
The problem with this definition of scalar multiplication is that $1 \cdot u \neq u$. In fact, we have $1 \cdot (u_1, u_2) = (u_1, 0)$.
Do you see why this is a problem?


text:
Q: How do you inner join / merge two time series data arrays in PHP? I want to join/combine two time series arrays into one single array
where there are values for the same time stamp only.
Each time series array looks like this
$ARRAY1 =

        Array
    (
        [1] => Array
            (
                [0] => 1570572000
                [1] => 1570485600
                [2] => 1570399200
                [3] => 1570140000
                [4] => 1570053600
                [5] => 1569967200
                [6] => 1569880800
                [7] => 1569794400
                [8] => 1569535200
                [9] => 1569448800
                [10] => 1569362400
                [11] => 1569276000
                [12] => 1569189600
                [13] => 1568930400
                [14] => 1568844000
                [15] => 1568757600
           )

     [2] => Array
        (
            [0] => 0.7967851
            [1] => -1.5081206
            [2] => -0.4314591
            [3] => 1.3359961
            [4] => 0.8296883
            [5] => -1.7323694
            [6] => -1.1625164
            [7] => 0.4908599
            [8] => -0.5353535
            [9] => -0.2083193
            [10] => 0.5880961

and i have a similar one just with another set of data in the column and possibly different timestamps as well.
In MYSQL i would just do an inner join. But in PHP if i had these two arrays $ARRAY1 and $ARRAY2 how do i merge them in to an array with
three columns (column1 = timestamps, column2 = data1, column3 = data2)
where i only include timestamps where both data1 and data2 are present?
array_merge or array_combine or array_intersect are not doing this job.
and i can only think of a crude method through a for loop and doing If timestamp1 = timestamp2 then update new array with data1 and data2.
but surely there must be a more elegant way to solve this?


text:
Q: How to extract human readable string from a string in ios i have a string which is returned by some library, here is a sample response
rQ
First Gulf Bank fiéj
=5'. fialfips
5; L mu nrslgk-5. §
. s,,,.Ef.<   W3 '
zi' ' im?"%'.' ;
k :LII__1';&g§;J_E1> J

now from the above response how can i extract human readable text, for ex, First Gulf Bank in the above sample, any sdk?


text:
Q: upload image files from my computer to Google Drive accont I am making an Desktop app in c# .net using Google drive Api. I  want to create folder in Google drive and want to upload images from my computer to that folder , please reply me as i am new to Google drive , waiting for the reply.

A: Everything you need to know is at https://developers.google.com/drive/
Specifically you'll be using https://developers.google.com/drive/v2/reference/files/insert


text:
Q: Python's "is" operator behaves unexpectedly I found something strange while debugging some code. Apparently,
num1 = 100
num2 = 200
num3 = 300

print(id(num1))  # 1854405545296
print(id(num2))  # 1854405548496
print(id(num3))  # 1854406580496

print(num1 * 3 is num3) # False
print(num1 * 2 is num2) # True

Why does num1 * 3 is num3 return False but num1 * 2 is num2 return True?


text:
Q: Is it possible to upload a form without filling certain attributes in mysql? i just want to know is it possible to upload a form without filling some attribute into MySQL? I want to upload user form which they can fill in to sent their application, but in admin side, the form they sent will have another column which is remarks, there the admin can reject the application then fill in the remarks why they are rejected to store in database. the admin can edit it. i tried to set the value into null, however, when I want to put remarks on the rejected candidate, it doesnt not save inside database, it still shows null
function for store data
public function update(Request $request, $id)
{
    $request->validate([

        'fullname' => 'required',
        'email' => 'required',
        'contact' => 'required',
        'address' => 'required',
        'attachment' => 'required',
        'remarks' => ['nullable', 'string', 'min:5', 'max:500'],
    ]);

    $candidate = new MainForm();
    $candidate->fullname = $request->fullname;
    $candidate->email = $request->email;
    $candidate->contact = $request->contact;
    $candidate->address  = $request->address ;
    $candidate->attachment = $request->attachment;
    $candidate->remarks  = $request->remarks ;

        if
        ($file = $request->hasFile('attachment')) {
            $file = $request->file('attachment');

            $filename = time() . '.' .$file->getClientOriginalName();
            $destinationPath = public_path('/uploads/documents/');

            $file->move($destinationPath, $filename);
            $candidate->attachment = $filename;
        }

        $candidate->save();

        return back();
}

below is my database code
  $table->id();
        $table->string('fullname');
        $table->string('email');
        $table->longText('contact');
        $table->string('address');
        $table->string('attachment');
        $table->string('remarks')->default(NULL);
        $table->boolean('status')->default(0);

and below is my blade file, which i can display the candidate details and once i open the remarks button, it will give me a modal in which i can put my remarks there.

                         Remarks

                                        Remarks

                                <form method="post" action="{{ route('mainform') }}">
                                @csrf

                                        Name

                                            <input type="text" placeholder="name" name="fullname"
                                                class="input w-full border col-span-4 form-control" value="{{ $candidate->fullname}}" readonly >

                                        Email

                                            <input type="text" placeholder="email" name="email"
                                                class="input w-full border col-span-4 form-control" value="{{ $candidate->email}}" readonly >

                                        Phone Number

                                            <input type="text" placeholder="contact" name="contact"
                                                class="input w-full border col-span-4 form-control" value="{{ $candidate->contact}}" readonly >

                                        Address

                                            <input type="text" placeholder="address" name="address"
                                                class="input w-full border col-span-4 form-control" value="{{ $candidate->address}}" readonly >

                                        Remarks
                                        <input type="text" placeholder="remarks" name="remarks"
                                     class="input w-full border col-span-4 form-control tail-select" value="{{ $candidate->remarks}}">

                                        <button type="button" data-dismiss="modal"
                                            class="button w-24 border dark:border-dark-5 text-gray-700 dark:text-gray-300 mr-1">Cancel</button>
                                        <button type="submit" class="button w-24 bg-theme-1 text-white">Save</button>

                                </form>

A: Edit: Lot's of problems with your code but the main problem is the route in your web form ({{ route('mainform') }}) doesn't point to the route in your route file (Route::post('/edit{id}', 'GeneralRejectedController@update')->name('generalrejected.update');).

In your Laravel migration, the correct way to mark a column as nullable is to use the nullable() method.
Instead of:
 $table->string('remarks')->default(NULL);

You should use:
 $table->string('remarks')->nullable();

Laravel Documentation: Nullable column modifier

In your controller form validation, don't forget to specify the column can be nullable:
$validated = $request->validate([
    ...
    'remark' => 'nullable'|'string'|'min:5'|'max:500',
    ....
]);

Laravel documentation: Validating optional fields.

That's all there's to it. If you still can't save your "remarks" field, you probably have a problem elsewhere. You can inspect the content of your request in your controller with dd($request->all()).

Looking at your controller update() method. There's a lot of problems because you didn't follow Laravel best practices.

*

*It doesn't make sense to call your model MainForm, if I understand your app, it should be called Candidate.

*You should always validate user inputs before saving to the database, don't save the request values, save the validated values.

*Use Laravel Eloquent to create object. Instead of creating object with new Object() (never do this) you should use dependency injection and do something like $candidate->create($validated).

*You should use CRUD named routes. If your Controller method is update your route should be candidates.update. It doesn't make sense to call your route mainform.
Here is how your controller should look like (not tested but it's a starting point):
    public function update(Request $request, Candidate $candidate) // Update your route to pass the Candidate object instead of the ID.
    {
        // dd($request->all()); // Use this to debug your request

        $validated = $request->validate([
            'fullname' => 'required',
            'email' => 'required',
            'contact' => 'required',
            'address' => 'required',
            'attachment' => 'required',
            'remarks' => ['nullable', 'string', 'min:5', 'max:500'],
        ]);

        $candidate->update($validated);

        // You should validate your file before storing to your drive. This could be a vulnerability.
        if ($file = $request->hasFile('attachment')) {
            $file = $request->file('attachment');

            $filename = time() . '.' . $file->getClientOriginalName();
            $destinationPath = public_path('/uploads/documents/');

            $file->move($destinationPath, $filename);
            $candidate->attachment = $filename;
        }

        return back();
    }


text:
Q: TypeError [ERR_INVALID_ARG_TYPE]: The "key" argument must be one of type string, TypedArray, or DataView Trying to index some data in elasticsearch using AWS Lambda.
Stack Trace

TypeError [ERR_INVALID_ARG_TYPE]: The "key" argument must be one of
  type string, TypedArray, or DataView
      at new Hmac (internal/crypto/hash.js:84:11)
      at Object.createHmac (crypto.js:122:10)
      at Object.hmac (/home/projects/serverless-todo-app/.webpack/service/src/indexer/createIndex.js:698:30)
      at Object.getSigningKey (/home/projects/serverless-todo-app/.webpack/service/src/indexer/createIndex.js:7109:8)
      at V4.signature (/home/projects/serverless-app/.webpack/service/src/indexer/createIndex.js:12708:36)
      at V4.authorization (/home/projects/serverless-app/.webpack/service/src/indexer/createIndex.js:12703:36)
      at V4.addAuthorization (/home/projects/serverless-app/.webpack/service/src/indexer/createIndex.js:12645:12)
      at ElasticsearchService.put (/home/projects/serverless-app/.webpack/service/src/indexer/createIndex.js:8150:12)
      at process (/home/projects/serverless-app/.webpack/service/src/indexer/createIndex.js:8115:24)
      at BbPromise (/usr/local/lib/node_modules/serverless/lib/plugins/aws/invokeLocal/index.js:567:30)
      at AwsInvokeLocal.invokeLocalNodeJs (/usr/local/lib/node_modules/serverless/lib/plugins/aws/invokeLocal/index.js:521:12)
      at AwsInvokeLocal.invokeLocal (/usr/local/lib/node_modules/serverless/lib/plugins/aws/invokeLocal/index.js:152:19)
  From previous event:
      at Object.invoke:local:invoke [as hook] (/usr/local/lib/node_modules/serverless/lib/plugins/aws/invokeLocal/index.js:34:10)

const credentials = new AWS.EnvironmentCredentials('AWS');
let signer = new AWS.Signers.V4(this.request, 'es');
signer.addAuthorization(credentials, new Date());

Trying to index some data in elastisearch using AWS Lambda.

A: You should have an endpoint and have initiated your request. You can do it like below and also check the link pasted after the code.
/* == Globals == */
var esDomain = {
    region: 'us-east-1',
    endpoint: 'my-domain-search-endpoint',
    index: 'myindex',
    doctype: 'mytype'
};
var endpoint = new AWS.Endpoint(esDomain.endpoint);
/*
 * The AWS credentials are picked up from the environment.
 * They belong to the IAM role assigned to the Lambda function.
 * Since the ES requests are signed using these credentials,
 * make sure to apply a policy that allows ES domain operations
 * to the role.
 */
var creds = new AWS.EnvironmentCredentials('AWS');

var req = new AWS.HttpRequest(endpoint);

    req.method = 'POST';
    req.path = path.join('/', esDomain.index, esDomain.doctype);
    req.region = esDomain.region;
    req.headers['presigned-expires'] = false;
    req.headers['Host'] = endpoint.host;
    req.body = doc;

    var signer = new AWS.Signers.V4(req , 'es');  // es: service code
    signer.addAuthorization(creds, new Date());

Inamazon-elasticsearch-lambda-samples check lines 45-55
(Sorry I cannot comment because of low reputation)

A: Slightly off topic, but I had a very similar stack trace when trying to access a DynamoDB table and stumbled upon this post. So I thought I'd share the problem/solution with others.
Thanks to D M's comment, I realised that I was trying to access a DynamoDB table via a client with no credentials set on it. I had already constructed an object of type AWS.Credentials, based on credentials I'd got earlier from STS. Something like this:
const credentials = new AWS.Credentials({
        accessKeyId: stsCredentials.AccessKeyId,
        secretAccessKey: stsCredentials.SecretAccessKey,
        sessionToken: stsCredentials.SessionToken,
      });

The bug for me was subtle, because I actually thought I was setting the credentials when constructing the DynamoDB document client:
new AWS.DynamoDB.DocumentClient(credentials)

But actually I had introduced a bug and removed curly braces around the credentials object, which were necessary in the structure expected by the DocumentClient constructor. So I needed to do:
new AWS.DynamoDB.DocumentClient({credentials})

That was what solved the issue for me.
Note: this answer is for the V2 AWS SDK.


text:
Q: Accessing apache Webserver Over local Network I have installed Apache Web Server on an CentOS 6 machine and configured it to run listen on an IP X.X.X.X:8080 in httpd.conf file but it is not working when i tried to access the Web server from browser using http://x.x.x.x:8080

A: By default CentOS has most input ports closed in the firewall so you will almost certainly need to open port 8080 in your firewall
iptables -I INPUT -p tcp -m tcp --dport 8080 -j ACCEPT

If this works then you need to save the state of the firewall
service iptables save


text:
Q: How to calculate using mesh method when there's a current source and a resistor between two meshes I'm trying to get the current in the 3 ohm resistor using mesh analysis. Forget about thevenin's theorem here.
However, what I know is that if there's a current source between two meshes then we do the supermesh analysis. But in this case there is a resistor and a current source in between the two meshes, which means we can't do the supermesh.
Here's the circuit:

So how do I get the current throught the 3 ohm resistor using the mesh method in this case?
I'm not asking for the final answer but how do I move on when a current source and a resistor are between 2 meshes ? Should the 3 ohm resistor take all the value of the current source(which means that the value of the current through the 3 ohm resistor is 5A)? Any help will be much appreciated :)

A: You should treat the circuit as if the current source and the components in series are not there in the first steps.
Then, relate the meshes with the current source like you use to do when the is just a current source without components in series with it.
Note that a current source can have any voltage across is, so the voltage drop across components in series with the current source is not relevant as it will not affect the circuit.
(And the current is of course dictated by the current source.)
That explains why you can leave those series components out together with the current source.

A: Simply consider the potential accross the branch consisting of the current source and the 2 ohm resistor as , say, V. Now proceed with mesh analysis. Eliminate the V to get your required answer.


text:
Q: .NET and Documentum 5.3 Integration I need to implement integration of a custom .NET application with Documentum 5.3. .NET application should provide functionality of managing folders, documents, metadata and search in configured Documentum 5.3.
I've found the following integration options are available in Documentum 5.3:

*

*Documentum ADO.NET Services

*Documentum Foundation Classes (including PIA & Web Services support)

*WDK

I guess for .NET application preferable variant is DFC PIA. But here - http://forums.contology.com/index.php?showtopic=23639 - guys are discussing that DFC PIA is deprecated and will not be supported soon (I understand that it is sufficient for 5.3 - but I guess it'll require to overwrite the integration part if customer upgrades its Documentum).
As for ADO.NET Services and "Web Services Framework for accessing Business Objects" - could you please provide more information to me - will I be able to perform tasks above (manage folders, documents, metadata, search) using these options? Could I access document content using ADO.NET Services or only document metadata?
The final question is are there any other options I missed?
And do you think the best option here is writing custom web service in java using DFC and then integrate .NET application with this web service? (approach similar to "Web Services Framework for accessing Business Objects" - but I'm not sure if this framework could provide all the abilities I need)

A: It doesn't sound like you have a requirement for web services specifically.  I've read the same stuff that you have about DFC getting deprecated "eventually" but it is still alive and kicking.
Documentum Foundation Services (DFS) is the "new" public web services API that everyone is supposed to use, starting with 6.5 (6.0 really, but they made a LOT of changes).  It is SOAP-based with some of the functionality also available via REST.
Basically, DFS is a layer on top of DFC, so really it is DFC running anyway.  The advantages of DFS are that you are not forced to use Java or .Net, session management is simplified, and that there are some operations that are simpler to perform, but if you are stuck with 5.3 then I see no reason not to use DFC.
You can still use DFC against a 6.5 or 6.6 repository.  Who knows what EMC will say when 7.0, 8.0, 9.0 come out, but my guess is it will be difficult for them to completely get rid of the DFC.  Even if they do, the upgrade challenges your client will face if they wait until that happens to move from 5.3 will be bigger than just worrying about moving to DFS.
Just FYI, I converted a 5.3 DFC application to DFS two years ago, and have been happily using DFS ever since.  The conversion was only painful because I did not know anything about the application or DFS itself at the time, but honestly it was more tedious than difficult.

A: The company Wingspan (http://wingspan) has an integration server for Documentum that supports 5.3 (and everything else going all the way back to 4.2.x).  It's called the DocWay Server and it has a Web Service API and separate Content Transfer facility.  It's similar in some ways to DFS, but predates it by many years and has been shipping since 2002.
I work there, and I'm sure pitching products is frowned upon on stack overflow, so I'll just leave it there.  PM me or contact Wingspan directly if you want more information.
Absent that, I would do just what you suggested and "[write a] custom web service in java using DFC and then integrate .NET application with this web service"
If you need to expose a lot of the DFC though, that's a tough hill to climb.  Do you have access to 5.3 SP6 of Content Server?  I believe that includes DFS which is more accessible from .NET.


text:
Q: Improve perceived performance for workflow application We build a workflow-like application.
use case 1: The user visually builds some workflow and then runs it to see results. Then the user fix the WF and runs again, and again, until he is happy.
use case 2: Once the WF is done the user schedules it to run a few times a day (possibly many times)
My friend says: When the user saves his WF let's first save its model to DB (so we can open later) and then generate c# code for the run time from this model.

*

*"This is the only way to get good performance at run time, especially when use case #2 implies many runs a day"

I say: Let's just save to DB. Then we will build a generic runtime that runs over the DB rows and executes the model commands (interperter-like).

*

*This gives much better perceived performance for #1 since waiting for compilation after every fix is frustrating

*this will not have such a big affect on the runtime itself if done correctly

What is your take?

A: You say the db contains flow control elements like loops and conditionals.
That says to me what you are storing in the db is at least a simple procedural scripting language.
When that happens, there will be pressure for enhancements making it more like a "real" language.
Something like subroutines will be wanted, with parameters, and variables and expressions.
You can jump ahead on this process by having an actual language, rather than a set of rows in a database, and save it as a text file.
Then a good way to "interpret" it is to actually generate C# code on the fly, and compile/run it on the fly.
That can actually happen very quickly.
The reason for doing this is a) no need to write the interpreter, and b) leap-frog the future enhancements.

A: I think a combination would be ideal:
case #1:
As long the user doesn't schedule the WF use your approach (#1)...
case #2:
when the user schedules a WF then compile (perhaps even asynchronisely, just needs to be ready for the first scheduled run).

A: My take is that whilst waiting to recompile the workflow every time you modify it will get tedious, I'd rather have the performance benefits when it runs "for real"; so I guess I agree with your friend.
This fits with the current .Net development approach where source-code is complied into byte-code.  Once you "think" you've finished with the source code then you might as well compile it, right?  Plus you'll get all the benefits of a compile time checks before you decide to deploy.
Sure the JIT does the final compile into machine code - but that steps usually not as long as the first part (source code to byte-code).


text:
Q: Creating Temporal table without adding DateTime columns I'm an SQL server DBA and new to Temporal tables. We have the following issue:
As part of implementing temporal tables mechanism , there's a need to add to datetime columns (so DWH will have the ability to investigate only last modified columns).

*

*1st problem is that our R&D are trying to avoid from altering table structure (adding columns) as it is a sensitive and big table.

*2nd problem is that the original table contains MODIF DATE column.
This column is being updated at the datetime value of the update transaction beginning time warriors I need the COMMIT time.(gaps are critical)

My question:
Is there a possibility to turn the original table to Temporal one , without adding columns and only by using the CREATION date and MODIF date built-in columns?
Will appreciate any support here!

A: If you're using System-Versioned Temporal Tables then I believe you need not change your table schema. Rather separate tables are created to automatically manage history on your existing tables.
There's also alternatives in SQL Server that shouldn't require you to change your existing table schema either such as Change Tracking or Change Data Capture (CDC).


text:
Q: How to stop execute full stored procedure in MySQL? I have written a procedure in MySQL. I have set some conditions in my procedure. IF condition will not fill up then procedure will exit or full procedure will not execute. That means i want to stop to execute next lines of my procedure. In oracle i have used   GOTO stop_level;. In MySQL i have seen that my full procedure have been executed. I want to declare a LEAVE label so that it can jump to LEAVE label & return with set message. Here is my MySQL procedure
CREATE PROCEDURE my_spring.`login_auth`(IN  in_email      varchar(100),
                                    IN  in_password   varchar(100),
                                    OUT user_id       INT,
                                    OUT out_code      INT,
                                    OUT out_message   VARCHAR(1024))
BEGIN
  BEGIN
   IF in_email IS NULL OR in_email = ''
    THEN
       SET out_code = 1;
       SET out_message = 'Please Enter Your Email.';
        /* Exit here*/
  END IF;

 IF in_password IS NULL OR in_password = ''
   THEN
     SET out_code = 1;
     SET out_message = 'Please Enter Your password.';
     /* Exit here*/
 END IF;

 END  ;

END;

I have used oracle GOTO function. When condition will not match then i call GOTO stop_label, it will jump to stop label not executing next line code. I want to handle my Procedure like oracle GOTO stop_level Here is stop_level code
  <<stop_level>>
 IF out_code = 0
 THEN
    COMMIT;
    out_message := out_message;
  ELSE
     ROLLBACK;
      out_code := 1;
      out_message := out_message;
  END IF;

How to do it?

A: MySQL doesn't have GOTO similar to Oracle, but they do have option to move control using LEAVE level (which you already mentioned). In your scenario, you could level your BEGIN block
leaveBlock:BEGIN
IF in_email IS NULL OR in_email = ''
    THEN
       SET out_code = 1;
       SET out_message = 'Please Enter Your Email.';
        LEAVE leaveBlock;
  END IF;

 IF in_password IS NULL OR in_password = ''
   THEN
     SET out_code = 1;
     SET out_message = 'Please Enter Your password.';
     LEAVE leaveBlock;
 END IF;

END leaveBlock;


text:
Q: Responsive fixed  not proportioned to background sample I have to put several images and texts on the site and they should be in the same position as the background image but when I minimize the screen size the proportionality is lost, I tried with an image of the text that I needed and it worked for me but I can not do that work with  texts
Thank you very much for your help i've just been stuck for the hole day trying to find the solution
 .title {
   width: 74.5%;
  }
 /*text image png
 .title.s1{
   position: absolute;
   margin-top: 36%;

 }
 /*text in h1*/

 h1.title.s1 {
  color: rgb(60, 255, 0);
  position: absolute;
  margin-top: 34.5%;
  margin-bottom: 0;
  text-align: center;
  display: inline;
}

The premise

In the link there's the output  , the gray text is added as an img and the green text is added as a  and below those elements the background titles are in orange

A: If you want to make your contents propotional, you can use the styles like below.
We can use the padding-top property as a percentage to make the gap between your contents like headers and images.
Here this is an example I tried, You can apply the styles properly for our contents. It is easy to create an outer and inner containers to keep the contents like headers and images.

<!DOCTYPE html>

<meta name="viewport" content="width=device-width, initial-scale=1">

Your content

Your content

You can follow this to get an idea https://wellcaffeinated.net/articles/2012/12/10/very-simple-css-only-proportional-resizing-of-elements#:~:text=For%20proportional%20resizing%20purposes%2C%20it,the%20aspect%20ratio%20you%20need.&text=And%20that's%20it!
Hope this will help you and think this is what you want to do.


text:
Q: How to display error message?   <!DOCTYPE html>

  <?php

if (isset($_POST['txt'])) {

    $veggies = array("Potato", "Cucumber", "Carrot", "Orange", "Green Beans", "onion");
    $fruits  = array("Apple", "Banana", "orange", "Pineapple", "Grapes", "Watermelon");
    $salad   = array_merge ($veggies, $fruits);
    $Object = $_POST['txt'];
    $search = array_filter($salad, function($list) use ($Object) {
        return ( stripos($list, $Object) !== FALSE );
    });

      print_r($search);

         // echo '
' . print_r($search) . '
';
     }

     else {
    echo " Nothing entered into the Search Item field ";
      }

   ?>

   <form method="POST">
     Search item:  <input type="text" name="txt" >

              <input type="submit">
  </form>

I have one small doubt, if i click submit button without entering any value in the text box it should show "Nothing entered into the Search Item field", instead its showing "Array()", how to fix this issue ??

A: From the manual:

A variable is considered empty if it does not exist or if its value
  equals FALSE. empty() does not generate a warning if the variable does
  not exist.

<?php

if($_SERVER['REQUEST_METHOD'] == 'POST')) {
    if(!empty($_POST['txt'])) {
        // Do your thing
    }
    else {
        echo " Nothing entered into the Search Item field ";
    }
}

?>

Whereas with isset:
$foo = '';
var_dump(isset($foo));

Outputs:
bool(true)


text:
Q: how to watch wifi networks in the android studio emulator I would like to know if it is possible to connect the android emulator to the wifi card to detect the available networks and connect to them.
I am trying to use a library for drive drones and first, I need to be connected to the drone's wifi network but in the android emulator the networks do not appear, there is only one by default that is wifiAndroid.


text:
Q: Многопоточность на стороне сервера Клиент подключается к серверу, после подключения клиенту каждые 30 секунд происходит отправка данных. Для примера, подключаются 100 клиентов. Нужно обработать каждого и отправить всем необходимые данные. При этом необходим контроль. При отключении пользователя, для примера, останавливать поток и освобождать память...
И тут передо мной встал выбор, какие технологии использовать ?
TPL, Threads, Await Async.
Просто чем дальше я начинаю читать про многопоточность, про плюсы и минусы тех или иных подходов в реализации, тем больше я запутываюсь во всем.
Посоветуйте, что мне использовать!
A: Если правильное решение не очевидно, пробуйте использовать технологии в порядке уменьшения степени абстракции.
Сначала async/await, если нужен более низкоуровневый контроль, то TPL, если и этот вариант контроля не подходит, переходите к потокам и AutoResetEvent'ам, дальше опускайтесь на уровень операционной системы и примитивов наподобие CRITICAL_SECTION.
Скорее всего, для вашей задачи вполне подойдёт async/await.


text:
Q: Is the function $f\colon \mathbb{R} \to \mathbb{R}$ defined by $f(x)=x+\sin(x)$ uniformly continuous on $\mathbb{R}$ I know how to show not uniformly or how to show it is uniformly continuous but not how to differentiate when to know which one to use

A: $|f'(x)|=|1+cosx|\leq 2$, and thus $f$ is Lipschitz continuous and thus uniformly continuous.

A: $|f(x)-f(y)|\\=|x+\sin x-y-\sin y|\\\le|x-y|+|\sin x-\sin y|\\=|x-y|+2\left|\cos\dfrac{x+y}{2}\sin\dfrac{x-y}{2}\right|\\\le\left|x-y\right|+2\left|\sin\dfrac{x-y}{2}\right|\\\le|x-y|+2\left|\dfrac{x-y}{2}\right|\\=2|x-y|$
Thus $f$ is Lipschitz continuous on $\mathbb R$ and hence uniformly continuous on $\mathbb R.$

A: A sum of uniformly continuous functions is uniformly continuous.
Let $f$ and $g$ be uniformly continuous on the same domain. For $\varepsilon>0$ there exist $\delta_1>0$ and $\delta_2>0$ such that

*

*if $|x-y|<\delta_1$, then $|f(x)-f(y)|<\varepsilon/2$

*if $|x-y|<\delta_2$, then $|g(x)-g(y)|<\varepsilon/2$

Take $\delta=\min\{\delta_1,\delta_2\}$; then, for $|x-y|<\delta$ we have
$$
|f(x)+g(x)-f(y)-g(y)|\le|f(x)-f(y)|+|g(x)-g(y)|<
\frac{\varepsilon}{2}+\frac{\varepsilon}{2}=\varepsilon
$$
I suppose you know that $f(x)=x$ and $g(x)=\sin x$ are uniformly continuous. For $f$ it is obvious; for $g$ it suffices to remember that it is continuous and periodic, so by the Heine-Borel theorem it is uniformly continuous.


text:
Q: php image file upload fails on some images I am using the ImageManipulator.php library from here: https://gist.github.com/philBrown/880506
When uploading some images, I get the following error:
Fatal error: Uncaught exception 'InvalidArgumentException' with message 'Image file C:\inetpub\wwwroot is not readable' in C:\inetpub\wwwroot\libraries\image-library.php:62 Stack trace: #0 C:\inetpub\wwwroot\images\edit-image.php(55): ImageManipulator->setImageFile('C:\inetpub\wwwr...') #1 .{main} thrown in C:\inetpub\wwwroot\libraries\image-library.php on line 62
The function referenced is:
if (!(is_readable($file) && is_file($file))) {
   throw new InvalidArgumentException("Image file $file is not readable");
}

This happens with a random selection of images, but if it happens, it continues to happen with that image, so it's not totally random.  If I open the image in Paint and save it with a different name, it works.  It is unrelated to image size, as I've had this error with an image of only 14 kb.
Does anyone have any idea what is wrong?
For example:

The image above doesn't work, but the one below does.

A: Thanks for your help in pointing me in the correct direction.  It turns out that all of the files that failed had upper case extensions (.JPG) and the ones that worked had lowercase extension (.jpg).  Whenever I edited a file in paint, it saved it with a lowercase extension.  Somewhere in the code I was screening for acceptable extensions using an array and the array contained lower case extensions only.  I added a strtolower to the comparison and it seems to be working.  Solution:
// array of valid extensions
    $validExtensions = array('.jpg', '.jpeg', '.gif', '.png');
    // get extension of the uploaded file
    $fileExtension = strtolower(strrchr($_FILES['fileToUpload']['name'], "."));
                     ^^^^^^^^^


text:
Q: Processing - how to send data (through websockets?) to javascript application I'm playing around with processing and wonder, if i can send data from processing to a javascript app. Is there any possibility to create a (e.g. websocket) server with processing?
Thanks in advance!

A: I've tried Java WebSockets in eclipse for desktop(with or without extending PApplet) and it works on Android as well. If you want to use the library in Processing you need to do this:

*

*create a folder named java_websocket in Documents/Processing/libraries

*Inside the newly created java_websocket folder create another folder named library and drop java_websocket.jar there

*Restart Processing and start using the library (sketch > import library should list java_websocket now)

And here's the project sample code in processing:
The server:
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.net.InetSocketAddress;
import java.net.UnknownHostException;
import java.util.Collection;

import org.java_websocket.WebSocket;
import org.java_websocket.WebSocketImpl;
import org.java_websocket.handshake.ClientHandshake;
import org.java_websocket.server.WebSocketServer;

void setup(){
  new ServerThread().start();
}
//create a separate thread for the server not to freeze/interfere with Processing's default animation thread
public class ServerThread extends Thread{
  @Override
  public void run(){
    try{
          WebSocketImpl.DEBUG = true;
          int port = 8887; // 843 flash policy port
          try {
            port = Integer.parseInt( args[ 0 ] );
          } catch ( Exception ex ) {
          }
          ChatServer s = new ChatServer( port );
          s.start();
          System.out.println( "ChatServer started on port: " + s.getPort() );

          BufferedReader sysin = new BufferedReader( new InputStreamReader( System.in ) );
          while ( true ) {
            String in = sysin.readLine();
            s.sendToAll( in );
          }
        }catch(IOException e){
          e.printStackTrace();
        }
  }
}
public class ChatServer extends WebSocketServer {

  public ChatServer( int port ) throws UnknownHostException {
    super( new InetSocketAddress( port ) );
  }

  public ChatServer( InetSocketAddress address ) {
    super( address );
  }

  @Override
  public void onOpen( WebSocket conn, ClientHandshake handshake ) {
    this.sendToAll( "new connection: " + handshake.getResourceDescriptor() );
    System.out.println( conn.getRemoteSocketAddress().getAddress().getHostAddress() + " entered the room!" );
  }

  @Override
  public void onClose( WebSocket conn, int code, String reason, boolean remote ) {
    this.sendToAll( conn + " has left the room!" );
    System.out.println( conn + " has left the room!" );
  }

  @Override
  public void onMessage( WebSocket conn, String message ) {
    this.sendToAll( message );
    System.out.println( conn + ": " + message );
  }

  @Override
  public void onError( WebSocket conn, Exception ex ) {
    ex.printStackTrace();
    if( conn != null ) {
      // some errors like port binding failed may not be assignable to a specific websocket
    }
  }

  /**
   * Sends <var>text</var> to all currently connected WebSocket clients.
   *
   * @param text
   *            The String to send across the network.
   * @throws InterruptedException
   *             When socket related I/O errors occur.
   */
  public void sendToAll( String text ) {
    Collection<WebSocket> con = connections();
    synchronized ( con ) {
      for( WebSocket c : con ) {
        c.send( text );
      }
    }
  }
}

a test client:
import java.awt.Container;
import java.awt.GridLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.WindowEvent;
import java.net.URI;
import java.net.URISyntaxException;

import javax.swing.JButton;
import javax.swing.JComboBox;
import javax.swing.JFrame;
import javax.swing.JScrollPane;
import javax.swing.JTextArea;
import javax.swing.JTextField;

import org.java_websocket.WebSocketImpl;
import org.java_websocket.client.WebSocketClient;
import org.java_websocket.drafts.Draft;
import org.java_websocket.drafts.Draft_10;
import org.java_websocket.drafts.Draft_17;
import org.java_websocket.drafts.Draft_75;
import org.java_websocket.drafts.Draft_76;
import org.java_websocket.handshake.ServerHandshake;

void setup(){
  WebSocketImpl.DEBUG = true;
  new ChatClient( "ws://localhost:8887" );
}

public class ChatClient extends JFrame implements ActionListener {
  private static final long serialVersionUID = -6056260699202978657L;

  private final JTextField uriField;
  private final JButton connect;
  private final JButton close;
  private final JTextArea ta;
  private final JTextField chatField;
  private final JComboBox draft;
  private WebSocketClient cc;

  public ChatClient( String defaultlocation ) {
    super( "WebSocket Chat Client" );
    Container c = getContentPane();
    GridLayout layout = new GridLayout();
    layout.setColumns( 1 );
    layout.setRows( 6 );
    c.setLayout( layout );

    Draft[] drafts = { new Draft_17(), new Draft_10(), new Draft_76(), new Draft_75() };

    draft = new JComboBox( drafts );
    c.add( draft );

    uriField = new JTextField();
    uriField.setText( defaultlocation );
    c.add( uriField );

    connect = new JButton( "Connect" );
    connect.addActionListener( this );
    c.add( connect );

    close = new JButton( "Close" );
    close.addActionListener( this );
    close.setEnabled( false );
    c.add( close );

    JScrollPane scroll = new JScrollPane();
    ta = new JTextArea();
    scroll.setViewportView( ta );
    c.add( scroll );

    chatField = new JTextField();
    chatField.setText( "" );
    chatField.addActionListener( this );
    c.add( chatField );

    java.awt.Dimension d = new java.awt.Dimension( 300, 400 );
    setPreferredSize( d );
    setSize( d );

    addWindowListener( new java.awt.event.WindowAdapter() {
      @Override
      public void windowClosing( WindowEvent e ) {
        if( cc != null ) {
          cc.close();
        }
        dispose();
      }
    } );

    setLocationRelativeTo( null );
    setVisible( true );
  }

  public void actionPerformed( ActionEvent e ) {

    if( e.getSource() == chatField ) {
      if( cc != null ) {
        cc.send( chatField.getText() );
        chatField.setText( "" );
        chatField.requestFocus();
      }

    } else if( e.getSource() == connect ) {
      try {
        // cc = new ChatClient(new URI(uriField.getText()), area, ( Draft ) draft.getSelectedItem() );
        cc = new WebSocketClient( new URI( uriField.getText() ), (Draft) draft.getSelectedItem() ) {

          @Override
          public void onMessage( String message ) {
            ta.append( "got: " + message + "\n" );
            ta.setCaretPosition( ta.getDocument().getLength() );
          }

          @Override
          public void onOpen( ServerHandshake handshake ) {
            ta.append( "You are connected to ChatServer: " + getURI() + "\n" );
            ta.setCaretPosition( ta.getDocument().getLength() );
          }

          @Override
          public void onClose( int code, String reason, boolean remote ) {
            ta.append( "You have been disconnected from: " + getURI() + "; Code: " + code + " " + reason + "\n" );
            ta.setCaretPosition( ta.getDocument().getLength() );
            connect.setEnabled( true );
            uriField.setEditable( true );
            draft.setEditable( true );
            close.setEnabled( false );
          }

          @Override
          public void onError( Exception ex ) {
            ta.append( "Exception occured ...\n" + ex + "\n" );
            ta.setCaretPosition( ta.getDocument().getLength() );
            ex.printStackTrace();
            connect.setEnabled( true );
            uriField.setEditable( true );
            draft.setEditable( true );
            close.setEnabled( false );
          }
        };

        close.setEnabled( true );
        connect.setEnabled( false );
        uriField.setEditable( false );
        draft.setEditable( false );
        cc.connect();
      } catch ( URISyntaxException ex ) {
        ta.append( uriField.getText() + " is not a valid WebSocket URI\n" );
      }
    } else if( e.getSource() == close ) {
      cc.close();
    }
  }

}

That's pretty much pasted Java code which is verbose. But it should be easy to make some helper/wrapper classes if needed.
Doing a quick search returns these handy results:

*

*Processing forum thread

*PWS

*Simple webcam with websockets and Processing

*Processing over WebSocket
UPDATE
I've recently been introduced to a new Websockets library called spacebrew which is great for your inquiry, especially since they seem to have wrapped the java_websocket nicely behind the scenes.
Now you use this as any other Processing library, usage is greatly simplified(not java library experience needed, just Processing will do) and examples are great!
I got introduced to this through another question which allowed me to find out that it actually it works out of the box on your Android Device as well out of the box(just need to check the INTERNET box). How awesome is that ?
Getting all that sweet websocket action going on like it ain't no thing and bonus, it's android supported.
Quickly prototype on your desktop, then get your project working from your pocket.

Spacebrew ♥ Processing