text:
Q: JSP/GlassFish: how to setup UTF-8 encoding correctly I'm looking for help to get all my layers in the stack to UTF-8 encoding.
I found this nice article:
http://www.javapractices.com/topic/TopicAction.do?Id=206
describing the 3 places I need to worry about encoding. Since my (1) Oracle database is currently set to UTF-8, that leaves the (2) browser and (3) server to worry about.
I also found this detailed article
http://balusc.blogspot.com/2009/05/unicode-how-to-get-characters-right.html#JSPServletRequest
which I'm trying to follow below, but with some newbie questions about implementation.
To address the browser, I've made sure to include the following at the top of each JSP page:
<%@page pageEncoding="UTF-8"%>

(For reference, see here).
To address the server, I made sure to include the following line in the Java servlet and JSP pages before issuing a request.getParameter() or request.getAttribute() statement:
request.setCharacterEncoding("UTF-8");

Since I'm using GlassFish 3.1.2, I understand it does not use UTF-8 by default, so I need to set it manually somehow.
I've seen a lot of websites talking about a file named glassfish-web.xml. Is this part of the normal glassfish install? I don't know where to find it. I've been using the web.xml file in my WEB-INF folder for my web application. Could someone help me figure out whether I need to modify this web.xml file, or do I need to locate or create a new file named glassfish-web.xml, to configure encoding for glassfish?
My web.xml file starts with:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
    "http://java.sun.com/dtd/web-app_2_3.dtd">
<web-app>
...

For the JSP/servlet request, I include the following line in the web.xml file
<parameter-encoding default-charset="UTF-8"/>

Is this OK to put in the web.xml file? Or, does it need to go in some glassfish-web.xml file?
For the JSP/servlet response, I put the following in my web.xml file (see accepted answer here):

<jsp-config>
   <jsp-property-group>
       <url-pattern>*.jsp</url-pattern>
       <page-encoding>UTF-8</page-encoding>
   </jsp-property-group>
</jsp-config>

I'm assuming these lines just insert between <web-app> and </web-app>. But, let me know if they should instead go inside some other descriptor (such as <glassfish-web-app> and </glassfish-web-app>)?
I also put the following in the JSP <head> section:
<meta http-equiv="content-type" content="text/html; charset=utf-8">

Useful references:
How to get rid of WARNING: PWC4011: Unable to set request character encoding to UTF-8
https://stackoverflow.com/tags/servlet-filters/info
https://wikis.oracle.com/display/GlassFish/FaqHttpRequestParameterEncoding

A: The glassfish-web.xml is a file you can create in your WEB-INF folder. For Glassfish 3.x it has to look similar to this:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE glassfish-web-app PUBLIC "-//GlassFish.org//DTD GlassFish Application Server 3.1 Servlet 3.0//EN" "http://glassfish.org/dtds/glassfish-web-app_3_0-1.dtd">
<glassfish-web-app>
    <jsp-config>
    </jsp-config>
    <parameter-encoding default-charset="UTF-8" />
</glassfish-web-app>

And you are right, the parameter-encoding setting has to be in this file and not in the web.xml :)
See also:

*

*glassfish-web.xml vs sun-web.xml vs web.xml

*Glassfish encoding


text: Q: Android users receive DF-DFERH-01 when trying to rate android game published by me Recently, I published game to android market. Problem is that no one from players is able to rate game using play market form. They receive error (DF-DFERH-01 Error receiving data from server) after trying to submit rating. Most advices about this errors are to clear android market cache, reinstall market application, etc, but none of them works, as even new players, no matter what is their location or device is still continue receiving this error. I wrote to google support week ago, but still have no any answer. Really appreciate any suggestions on what to do.

redpajama_set_name: RedPajamaStackExchange


text:
Q: They can take our lives, but they will never take our hats! "They can take our lives, but they'll never take our hats"
What is the meaning of this? Is this an idiom?

A: It's a mis-quote[reference/homage/paraphrase] of a famous movie line.
(presumably intentional for comedic effect... not that it's funny, without context ;)

They can take our lives, but they will never take our freedom.

from the movie Braveheart
[Short video clip of the specific scene at https://www.youtube.com/watch?v=0zFAvzf0Mv0&ab_channel=Citarei ]
The movie is partly famous because of Mel Gibson's atrocious Scottish accent throughout the film.
TV Tropes - Ooh Me Accents [sic] Slipping
Late edit:
Your added comment on the OP gives it the needed context...
"user:42184 called Andrew has it in his profile-it made me a smile... – Nana Goshadze"
Every year Stack Exchange has a light-hearted "Winter Bash" contest in December... the prizes are hats for your SE avatar to wear.


text:
Q: Longest Domino Sequence Edit: New code. Both solutions were working perfectly, but for some reason did not improve my time results and that doesn`t make sense to me just yet.
Seeing my desperation, a friend PMed me his solution, which is working fine with the time given, but somehow fails on this specific input:
9
1 2  2 3  3 4  4 5
3 6  6 7  3 8  8 9  9 10

It gives "9" instead of "5". Any ideas why that could be?
maxNum = int(0)
idxArr = []
def ReadInput():
    global array
    global firstNum
    arr = input().split()
    firstNum = int(arr[0])
    while int(arr[0]) * 2 + 1 > len(arr):
        tempArray = input().split()
        arr = arr + tempArray
    iterator = int(0)
    array = [0] * int(arr[0])
    for i in range(1, int(arr[0]) * 2, 2):
        tempArray = [0] * 3
        tempArray[0] = int(arr[i])
        tempArray[1] = int(arr[i + 1])
        tempArray[2] = None
        array[iterator] = tempArray
        iterator+=1

def SortArray(array):
    array.sort(key=lambda x: x[1])
    array.sort(key=lambda x: x[0])

def MergeDominos(array):
    tempNum = int(0)
    for item in array:
        if (item[2] == None):
            iterator = tempNum
            counter = int(0)
            tempBool = False
            try:
                while item == array[iterator]:
                    if (tempBool):
                        array.pop(iterator)
                        counter += 1
                    else:
                        iterator += 1
                        counter += 1
                        tempBool = True
            except IndexError:
                True == True
            if (counter % 2 == 1):
                item[2] = counter
                tempNum += 1
            else:
                tempItem = item.copy()
                array.insert(tempNum + 1, tempItem)
                array[tempNum + 1][2] = int(1)
                item[2] = counter - 1
                tempNum += 1
        else:
            tempNum += 1

def GetLengthOfArray(array):
    counter = int(0)
    for item in array:
        counter += item[2]
    return counter

def SwitchPlaces(item):
    item[0], item[1] = item[1], item[0]

def GetMaxLength(array, tempArray, left, right):
    global maxNum
    # print("This is temp: ", tempArray)
    for i in range(len(array)):
        # print("Testing: ", array[i], "Iteration: ", i)
        # print("IdxArr: ", idxArr)
        if (len(array) <= len(idxArr)):
            #print("BREAKING HERE BREAKING HERE BREAKING HERE BREAKING HERE BREAKING HERE BREAKING HERE BREAKING HERE BREAKING HERE BREAKING HERE BREAKING HERE BREAKING HERE BREAKING HERE BREAKING HERE BREAKING HERE BREAKING HERE ")
            break
        if (i not in idxArr):
            #print("Condition:")
            if (left == array[i][0]):
                #print("LL")
                if (i in idxArr):
                    break
                else:
                    idxArr.append(i)
                SwitchPlaces(array[i])
                if (len(array) >= len(idxArr)):
                    tempArray.insert(0, array[i])
                if (GetLengthOfArray(tempArray) > maxNum):
                    maxNum = GetLengthOfArray(tempArray)
                if (len(array) >= len(idxArr)):
                    GetMaxLength(array, tempArray, tempArray[0][0], tempArray[len(tempArray) - 1][1])
            if (left == array[i][1]):
                #print("LR")
                if (i in idxArr):
                    break
                else:
                    idxArr.append(i)
                if (len(array) >= len(idxArr)):
                    tempArray.insert(0, array[i])
                if (GetLengthOfArray(tempArray) > maxNum):
                    maxNum = GetLengthOfArray(tempArray)
                if (len(array) >= len(idxArr)):
                    GetMaxLength(array, tempArray, tempArray[0][0], tempArray[len(tempArray) - 1][1])
            if (right == array[i][0]):
                #print("RL")
                if (i in idxArr):
                    break
                else:
                    idxArr.append(i)
                if (len(array) >= len(idxArr)):
                    tempArray.append(array[i])
                if (GetLengthOfArray(tempArray) > maxNum):
                    maxNum = GetLengthOfArray(tempArray)
                if (len(array) >= len(idxArr)):
                    GetMaxLength(array, tempArray, tempArray[0][0], tempArray[len(tempArray) - 1][1])
            if (right == array[i][1]):
                #print("RR")
                if (i in idxArr):
                    break
                else:
                    idxArr.append(i)
                SwitchPlaces(array[i])
                if (len(array) >= len(idxArr)):
                    tempArray.append(array[i])
                if (GetLengthOfArray(tempArray) > maxNum):
                    maxNum = GetLengthOfArray(tempArray)
                if (len(array) >= len(idxArr)):
                    GetMaxLength(array, tempArray, tempArray[0][0], tempArray[len(tempArray) - 1][1])
            #else:
               # print("No condition BIG OOOF")

ReadInput()
SortArray(array)
MergeDominos(array)
for i in range(len(array)):
    #print("iter num: ", i)
    tempArray = []
    idxArr = []
    idxArr.append(i)
    tempArray.append(array[i])
    if (GetLengthOfArray(tempArray) > maxNum):
        maxNum = GetLengthOfArray(tempArray)
    GetMaxLength(array, tempArray, tempArray[0][0], tempArray[len(tempArray) - 1][1])
print(maxNum)

E1: The input is made in this weird way, because the first item of the list gives the number of dominoes, and also, the input can come in multiple rows and then I create list item pairs.
Example input:
5 1 2
1 2
2 3
2
17
2 17

And the dominoes are:
[('1','2'),('1','2'),('2','2'),('2','17'),('2','17')]

Expected result:
5

(3,2)-(2,1)-(1,2)-(2,17)-(17-2)

A: The following is a rewrite of your solution with one significant change:
if maximum == len(listOfDominos) + len(tempList):
    break

This prevents the code from exploring any further once it has a maximum that it knows it can't improve on.  For the example input you provided, it reduced the number of searches by 20x:
def find(listOfDominos, tempList):
    maximum = len(tempList)

    for currentDominoIndex, domino in enumerate(listOfDominos):
        if maximum == len(listOfDominos) + len(tempList):
            break  # we can't do any better, so why try?

        remainingDominos = listOfDominos[:currentDominoIndex] + listOfDominos[currentDominoIndex+1:]

        if tempList:
            backwardDomino = domino[::-1]
            head, tail = tempList[0], tempList[-1]

            if domino[1] == head[0]:
                maximum = max(find(remainingDominos, [domino] + tempList), maximum)
            elif backwardDomino[1] == head[0]:
                maximum = max(find(remainingDominos, [backwardDomino] + tempList), maximum)
            elif domino[0] == tail[1]:
                maximum = max(find(remainingDominos, tempList + [domino]), maximum)
            elif backwardDomino[0] == tail[1]:
                maximum = max(find(remainingDominos, tempList + [backwardDomino]), maximum)
        else:
            maximum = max(find(remainingDominos, [domino]), maximum)

    return maximum

listOfNumbers = input().split()

numberOfDominos = int(listOfNumbers.pop(0))

while numberOfDominos * 2 > len(listOfNumbers):
    listOfNumbers += input().split()

listOfDominos = list(zip(listOfNumbers[0::2], listOfNumbers[1::2]))

print(find(listOfDominos, []))

Give this a try to see if it improves performance without introducing any bugs in the process.

A: Try this solution:
def solution(dominoes):
    if len(dominoes) == 0:
        return 0

    def get_sequence(d, sol=None):
        if sol is None:
            sol = []

        if len(d) == 0:
            return

        for i in range(len(d)):
            rest = d[:i] + d[i+1:]
            d1, d2 = d[i], d[i][::-1]

            if d1 == d2:
                if (not sol) or (sol[-1][1] == d1[0]):
                    yield sol + [d1]
                    yield from get_sequence(rest, sol + [d1])
            else:
                if (not sol) or (sol[-1][1] == d1[0]):
                    yield sol + [d1]
                    yield from get_sequence(rest, sol + [d1])

                if (not sol) or (sol[-1][1] == d2[0]):
                    yield sol + [d2]
                    yield from get_sequence(rest, sol + [d2])

    return(len(max(get_sequence(dominoes), key=len)))

dominoes = [('1','2'),('1','2'),('2','2'),('2','17'),('2','17')]
print(solution(dominoes))

Prints:
5


text:
Q: Create django File object from online url So I want to save some images to my django models through the shell, with the added twist that the said images would come from an online resource, a url.
As per the requests documentation I can get the file to disk thus:
import requests

img = requests.get("image_url", stream=True)
with open("name.jpg", "wb") as fd:
    for chunk in img.iter_content(chunk_size=128):
        fd.write(chunk)

I could write the file to disk, then convert to a django file object like so
from django.core.files import File
img = File(open(choice(IMAGES), "rb"))

But I need a way to bypass the read and write to/from disk while still ending up with the django File object. I've tried io.BytesIO and io.StringIO but each time I end up with an exception.


text:
Q: Exporting Console Output of Jenkins Pipeline I have built a pipeline which runs a set of sql scripts to generate results. I would like to be able to export the console output, ideally into a .txt file or .xlsx file. Is this possible? For info I drive the pipeline via GitHub.
Thanks
Tried searching the web but have been unable to find a solution

A: Do you want to Save the Console output to a file and then Commit it to Github? Check the following sample Pipeline.
pipeline {
    agent any
    stages {
        stage('Sample') {
            steps {
                script {
                    echo "Somehitng 1"
                    echo "Something 2"
                    // Read the console log
                    def consoleLog = Jenkins.getInstance().getItemByFullName(env.JOB_NAME).getBuildByNumber(Integer.parseInt(env.BUILD_NUMBER)).logFile.text
                    //Write the log to a file
                    writeFile(file: "Log_${BUILD_NUMBER}.txt", text: consoleLog, encoding: "UTF-8")
                    sh'''
                        git add *
                        git commit -m "Add console log"
                        git push
                    '''
                }
            }
        }
    }
}


text:
Q: Stop zoom in for the webview in android for titanium I have loaded local html page on webview.
i run for IOS there is not zoom effect.
When i run on android its shows zoom in and zoom out for me.
how to stop zoom effect for android.
"#aboutWebView":{

    url : 'aboutUs.html',
    backgroundColor:'transparent',
    touchEnabled:true,
    willHandleTouches:false,
    enableZoomControls:false
}

A: You can try adding this to your html file in the head tag
<meta name = "viewport" content = "user-scalable = no">

If this doesnt work try this:
<meta name="viewport" content="user-scalable=0">


text:
Q: Could not find gem 'ruby (= 2.0.0) ruby' in the gems available on this machine I'm currently using Ubuntu to run my ruby on rails applications, but I just got this error message:
"Could not find gem 'ruby (= 2.0.0) ruby' in the gems available on this machine."
every time I typed in "rails server". I tried to reinstall everything but it's still there. What does this even mean? The only gem for ruby is 0.1.0, why there is a 2.0.0 ruby gem? Thanks.

A: Do you have a line in your Gemfile like gem 'ruby', '=2.0.0'?
It should be:
ruby "2.0.0"


text:
Q: How to define (sentence) units as lines in quanteda? I wonder if you can change the formation of sentences. Instead of punctuation to form the sentence, I would like a new row/ new line forming the sentence.

A: This is a very minimal question, so I'm going to have to guess here what you intend, but I'm guessing that you want to segment your documents into lines, rather than sentences.  There are two ways to do this: to have a new corpus where each sentence is a document, or a new tokens object where each "token" is a line.
Getting both is a matter of using the *_segment() functions.  Here's two ways, with some sample text I will create where each line is a "sentence".
library("quanteda")
## Package version: 2.0.0

txt <- c(
  d1 = "Sentence one.\nSentence two is on this line.\nLine three",
  d2 = "This is a single sentence."
)
cat(txt)
## Sentence one.
## Sentence two is on this line.
## Line three This is a single sentence.

To make this into tokens, we use char_segment() with a newline being the segmentation pattern, and then coerce this into a list and then into tokens:
# as tokens
char_segment(txt, pattern = "\n", remove_pattern = FALSE) %>%
  as.list() %>%
  as.tokens()
## Tokens consisting of 4 documents.
## d1.1 :
## [1] "Sentence one."
##
## d1.2 :
## [1] "Sentence two is on this line."
##
## d1.3 :
## [1] "Line three"
##
## d2.1 :
## [1] "This is a single sentence."

If you want to make each of the lines into a "document" that can be segmented further, then use corpus_segment() after constructing a corpus from the txt object:
# as documents
corpus(txt) %>%
  corpus_segment(pattern = "\n", extract_pattern = FALSE)
## Corpus consisting of 4 documents.
## d1.1 :
## "Sentence one."
##
## d1.2 :
## "Sentence two is on this line."
##
## d1.3 :
## "Line three"
##
## d2.1 :
## "This is a single sentence."


text:
Q: How does Qt5 redirect qDebug() statements to the Qt Creator 2.6 console After searching around for a reason that qDebug() statements work fine with Qt's standard message handler but fail when I switch to my own, I'm appealing here to see if anyone else has any experience with the problem.
Things I know about / have tried, that do nothing...
1) CONFIG += console
2) DEFINES -= QT_NO_WARNING_OUTPUT QT_NO_DEBUG_OUTPUT
3) ::fprintf(stderr, "ERROR\n");  ::fflush(stderr);
4) ::fprintf(stdout, "OUTPUT\n"); ::fflush(stdout);
5) std::cerr << "CERROR" << std::endl; std::cerr.flush();
However it works correctly when using the built in handler (ie it prints the message to the QtCreator console)
int main(int argc, char *argv[]) {
    // Use my handler
    qInstallMessageHandler(MyCustomLogger);
    qDebug() << "Not Printed";

    // Use standard handler
    qInstallMessageHandler(0);
    qDebug() << "Correctly Printed";

    // Use my handler again
    qInstallMessageHandler(MyCustomLogger);
    qDebug() << "Not Printed Again...";
}

The most recent test was allocating myself a console using WinAPI commands this results in the correct behavior all output to stderr and stdout are visible on the console I created.  However, this is not the behavior I want, I want to be able to view this output in QtCreator.
Any thoughts on how the standard message handler prints to the debugger?
I've not managed to find it in the Qt sources yet.

A: I can't reproduce your issue: this works correctly for me.
#include <QCoreApplication>
#include <QtDebug>
#include <QtGlobal>

#include <stdio.h>
#include <stdlib.h>

void myMessageOutput(QtMsgType type, const QMessageLogContext &context, const QString &msg)
{
    QByteArray localMsg = msg.toLocal8Bit();
    fprintf(stderr, "MESSAGE (%s:%u %s): %s\n", context.file, context.line, context.function, localMsg.constData());
    fflush(stderr);
}

int main(int argc, char **argv)
{
    QCoreApplication app(argc, argv);
    qInstallMessageHandler(myMessageOutput);
    qDebug() << "Printed in the console";
    qInstallMessageHandler(0);
    qDebug() << "Also printed in the console";
    return app.exec();
}

A: As Frank Osterfeld mentioned in his comment:

On windows, qDebug() uses the debug channel, not stderr.

After delving into the QDebug code and QMessageLogger I've found my answer. The handy WinAPI function OutputDebugString.
Usage (Modified from peppe's):
#include <QApplication>
#include <QtDebug>
#include <QtGlobal>

#include <stdio.h>
#include <stdlib.h>
#include <Windows.h>

void MyMessageOutput(QtMsgType Type, const QMessageLogContext& Context, const QString &Message)
{
    OutputDebugString(reinterpret_cast<const wchar_t *>(Message.utf16()));
}

int main(int argc, char **argv)
{
    // A GUI application
    QApplication app(argc, argv);

    // Custom handler
    qInstallMessageHandler(myMessageOutput);
    qDebug() << "Printed in the console using my message handler in a windows GUI application";

    // Default handler
    qInstallMessageHandler(0);
    qDebug() << "Also printed in the console!";

    // Show GUI here
    //MainForm *MF = new MainForm();
    //MF->show();

    return app.exec();
}


text:
Q: Is it worth it to switch from home-grown remote command interface to using JMX Without knowing too much about JMX, I've always assumed that it would be the best approach for building in remote management to our standalone Java server application. Our server application has some minimal remote control capability, using text commands sent via TCP/IP socket to it.
Using the home grown approach, it is fairly to add a new command. (Just create new command text, and the code to handle that in the message receiver).  On the other hand, we have hardly implemented any commands, even though there are many things we would like to be able to execute remotely.
I am trying to weigh the value of moving to incorporating JMX (learning it, and building the interfaces), versus just sticking with the home-grown approach. Does anyone have any experience or advice regarding changing an existing application to use JMX?

A: Good question.
First of all answer is quite simple for me. Move to JMX for several reasons.

*

*There are lots of stable proven JMX implementations  out there that you can simply use to bootstrap your application and you don't really have to maintain your code to be able to support different operations.

*JMX is a very simple model where you have MBeanServer that hosts a bunch of services / MBeans that have properties and methods.

*These services / MBean are exposed by MBeanServer in a protocol agnostic way.

*If there is a need to connect to the MBeanServer using different protocol's its simply a matter of creating adapters.

To answer your other question, is it easy to migrate to JMX, the answer is it all depends. If fairly easy to migrate the implementations / services to MBean and expose only what you want to but the tricky part maybe how you connect to those services. So clients might have to rewrite some of the code.
Hope this help!
Good luck.


text:
Q: Link Excel spreadsheet into PowerPoint presentation I need to create a weekly PowerPoint presentation for various levels of management, to keep them apprised of the status for several categories of action items my department tracks. During normal operations, most of these action items are tracked via several Excel spreadsheets. There's a separate spreadsheet for each action item category.
(Yes, I know we should be using a different application, and storing this sort of stuff in a database, instead of spreadsheets. That's in work, but I still need an interim fix for this while we're stuck with Excel.)
The spreadsheets used to track the action items are very detailed, but the presentation needs to be kept brief, so we usually omit some of the specifics from the presentation. Below are some example fields which are commonly found in the tracking spreadsheets. Items in bold are the only fields we want to show in the presentation.

*

*ID

*Title

*Description

*Status

*Progress Notes

*Current Responsible Party

*Affected Customer

*Start Date

*Due Date

*Project Milestone(s) & Milestone Date(s)

*Document Reference(s)

Currently, the process to create the presentation entails manually going through the Excel spreadsheets and copying/pasting the data into tables created on the PowerPoint slides. However, it would be much more preferable if we could get this process automated to some degree. Also, in addition to keeping these slides up to date for each week's presentation, I need a method to save a static snapshot on a monthly basis for archiving purposes.
What I need is a way to link the spreadsheets into the presentation slides. Ideally, the solution should be able to:

*

*Pull only the columns needed from each sheet.

*Pull only non-completed action items from each sheet.

*Refresh data from the source sheets, either automatically or on-demand, with minimal user action required.

*

*(i.e.: An on-demand refresh should only take a few clicks per sheet - or, more preferably, just a few clicks for the whole presentation - and not require a lot of repetitive copy/paste/etc.)

*Automatically add/remove slides when needed, to accommodate the size of the data sets.

*Permit saving a static copy of the presentation on-demand.

*Be compatible with both Office 2010 and Office 2013.

Is there a way to link my spreadsheets to the presentation, which can serve all these needs?

A: If you are allowed to download and install the standard (and free) Microsoft product "Power Query", you can. More information about the use of Power Query can be found here. It is available from Office 2010 and up. It provides you with a lot of tools to select and merge data from different sources.
In your case, do the following:

*

*Create a new Excel workbook.

*Using Power Query, load the first action list to your Excel sheet .

*Use "Append" to append the other action lists to the resulting table. At the end, you should have a (dynamically linked) combined list of all your action lists.

*Using Power Query you can delete and rearrange the columns, sort the data and set filters on the columns. I recommend that you do the selection, sorting and filtering here in the Power Query, because if you do this in the final table in Excel, you need to re-apply all those filters every time you update the table.

*Save the workbook and close Excel.

*Start Powerpoint and on the Insert tab on the Ribbon choose Object and select "Create from file" and select the newly created Excel workbook with the combined action lists.

If you need to update the data, open the Powerpoint presentation and open the Excel object en click on the Refresh button and your data is updated. That's just a few clicks to update all of the action lists (cool, right?!)
This solution works for Office 2010 and 2013.
Finally there are your requirements about spanning multiple sheets and saving a static copy. There is no out-of-the-box answer to that, but I'd like you to consider to do this:

*

*Keep a "master" version of your Powerpoint with the reference to the Excel file in it (hint: make this file read-only).

*Every week, update the data with a few clicks as described above.

*Copy the Excel table (even if it is too big for one sheet) and paste it as a picture (Paste - Picture or Paste - Paste special... - Microsoft Office Graphic Object).

*Now you can duplicate the entire PowerPoint slide with the picture on it and use the cropping tools (select the picture and choose on the Ribbon tab Picture - Format - Crop) to select the right items on each sheet.

*You can reduce the size of the PowerPoint presentation by selecting a picture and go to the Ribbon: Picture - Compress Pictures and choosing the appropriate settings.

*Finally the sheet with the original Excel data can be deleted from this week's version of the presentation.

It is not really automated, but it keeps a non-editable version of your data in the presentation and it fulfills all of your requirements. The advantage of this approach is that all of the work can be done from the Powerpoint presentation itself.

A: There are several steps to your request and I can't answer all of them in detail but I can help you with a few pieces. It'll still be mostly concept, though. I'm a VBA junky so that what I'm going to suggest. It would be significantly easier if you can get access to PowerPoint 2003 because they removed the macro recorder starting in 2007. If you can't do that, then there will be some trial/error/Googling to get it done. Thankfully, a lot of the structure carries over from Excel but not the unique items.
Background) I do something similar to this in my current job. I have a giant mass o' data and I extract pieces of a record if it meets certain criteria and create a PowerPoint slide that contains those details. For my purpose, each record gets its own slide but it seems that you want a slide with a table showing lots of records.
Concept) VBA loops through each data sheet, checks each record to see if it's needed, pulls out certain information from that record, and adds it to a table object in PowerPoint.
1) Pull only the columns needed from each sheet
Easiest to maintain in the VBA code if your data is in a table but manageable without it. You have to explicitly code which cells to extract so just code the ones you need.
2) Pull only non-completed action items from each sheet
Write checks into the code that pulls the status and, if it doesn't equal "Closed" or whatever term you use, then continue with adding it to the slides. Otherwise, skip it and move to the next record. My needs are so complex that I made several helper columns to figure out if a record should be included or not and the VBA just checks that.
3) Refresh data from the source sheets, either automatically or on-demand, with minimal user action required
VBA in PowerPoint can open Excel and call a macro within that file so you can make a button on the slide to run the update macro in Excel.
4) Automatically add/remove slides when needed, to accommodate the size of the data sets
I would start off by removing the old slides and only adding them as needed. You could do something in the code that checks the size of the table object vs the size of the slide and, once it's gets too big, add a slide and create a new table object to start working on.
5) Be compatible with both Office 2010 and Office 2013
I can't promise anything here but most things in VBA are backwards-compatible. I have seen old macros break because some reference was removed or something, but it's only happened once and it was a messy beast of a project.
6) Saving a static copy of the presentation manually
Since every copy is a static copy, independent from the original Excel sheet, this is as easy as File > Save As
7) Saving a static copy automatically
I can't tell if you want to save the Excel or PowerPoint automatically but this would work for both. I use a standard module I've written to make backups of files I'm developing so I can always refer to a previous version. Mine is written to create a backup whenever the file is opened. It only runs once per day or once per second, depending on how I call it. You could modify it to run a max of once per month by just changing the date format in the file name.
Option Explicit

Function BackupThisFile(Optional AddTimestamp As Boolean = False)

    'Declarations
    Dim fPath As String
    Dim fName As String
    Dim fExt As String
    Dim iExt As Integer
    Const backupFolder As String = "Backups"

    'Get file path
    fPath = ThisWorkbook.path
    If Right(fPath, 1) <> Application.PathSeparator Then fPath = fPath & Application.PathSeparator

    'Add the backup folder name
    fPath = fPath & backupFolder
    If Right(fPath, 1) <> Application.PathSeparator Then fPath = fPath & Application.PathSeparator

    'Create the backup directory if it doesn't already exist
    On Error Resume Next
        MkDir fPath
    On Error GoTo 0

    'Get file name
    fName = ThisWorkbook.Name                   'Get file name with extension
    iExt = InStrRev(fName, ".")                 'Find the . separating name from extension
    fExt = Right(fName, Len(fName) - iExt + 1)  'Saves the extension
    fName = Left(fName, iExt - 1)               'Clips the extension

    'Compile path, file name, date stamp, and extension into one variable
    fPath = fPath & fName & " " & Format(Date, "yyyy-mm-dd")

    'Add timestamp if required
    If AddTimestamp Then fPath = fPath & " " & Format(Now, "hhmmss")

    'Add the file extension
    fPath = fPath & fExt

    'Save a copy if it doesn't already exist
    Dim fso: Set fso = CreateObject("Scripting.FileSystemObject")
    If Not fso.fileExists(fPath) Then ThisWorkbook.SaveCopyAs fPath

End Function


text:
Q: R: remove hidden line break characters from text strings within a data frame I have discovered that some strings within my data frame contain hidden line break characters, though I can't tell exactly which (when loaded into gVim they simply show up as line breaks).  The following code:
gsub("[\r\n]", "", x)
successfully removes the line breaks from within the strings. However, it also removes the line breaks separating the cells, making my data frame atomic instead of recursive. How can I target only the line breaks within the strings while keeping my data frame intact?
Here's a sample of the data:
sample data frame

A: copying the comments above to close the question,
dataframe <- data.frame(ID = 1:2, Name = 'XX',
  string_column = c('Hi \r\nyou\r\n', 'Always \r\nshare\r\n some \r\nsample\r\n data!'))
  dataframe$string_column
#> [1] Hi \r\nyou\r\n
#> [2] Always \r\nshare\r\n some \r\nsample\r\n data!
#> Levels: Always \r\nshare\r\n some \r\nsample\r\n data! Hi \r\nyou\r\n

dataframe$string_column <- sapply(dataframe$string_column,
                                    function(x) { gsub("[\r\n]", "", x) })
dataframe$string_column
#> [1] "Hi you"                         "Always share some sample data!"


text:
Q: Why does a filter gradient on a pseudo element not work in IE8? I want to create buttons like these:

In modern browsers the effect is created using inset box-shadow and filters.
For IE8 - pseudo-elements are chosen.
For IE7 - I use special tags wrapped in conditional comments.
Demo: (http://jsfiddle.net/8M5Tt/68/)

/**
 * Button w/o images
 */
html {
    font-size: 62.5%;
    }
body {
    font: normal 1em/1em Arial, Tahoma, Verdana, sans-serif;
    }

/* layout */
.btn {
    display: inline-block;
    height: 28px;
    border-width: 1px;
    border-style: solid;
    width: 170px;
    box-sizing: content-box;
    overflow: hidden;
    position: relative;
    z-index: 1;
    }
.btn {
    margin: 15px;
    }
.btn.btn_small {
    width: 130px;
    }

/* ie7 */
.lt-ie8 .btn .before,
.lt-ie8 .btn .after {
    position: absolute;
    right: -1px;
    left: -1px;
    display: block;
    height: 3px;
    }
.lt-ie8 .btn .before {
    top: -1px;
    filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#80ffffff', endColorstr='#00ffffff',GradientType=0 );
    }
.lt-ie8 .btn .after {
    bottom: -1px;
    filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#00ffffff', endColorstr='#80000000',GradientType=0 );
    }
/* /ie7 */

/* ie8 */
.ie8 .btn:before,
.ie8 .btn:after {
    content: ' ';
    z-index: 1;
    position: absolute;
    right: -1px;
    left: -1px;
    display: block;
    height: 3px;
    }
.ie8 .btn:before {
    top: -1px;
    filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#80ffffff', endColorstr='#00ffffff',GradientType=0 );
    }
.ie8 .btn:after {
    bottom: -1px;
    filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#00ffffff', endColorstr='#80000000',GradientType=0 );
    }
/* /ie8 */

/* typo */
.btn {
    /* 28 / 14 = 2.57142857 */
    font: bold 14px/2 Arial, Helvetica, Tahoma, sans-serif;
    text-transform: uppercase;
    }
.btn:active {
    line-height: 2.4em;
    }

/* color */
.btn {
    background-color: #00cccc;
    color: #fff;
    border-color: #00a8a8;
    border-radius: 3px;
    cursor: pointer;
    box-shadow:
         1px  1px 4px rgba(255, 255, 255, 0.5) inset,
        -1px -1px 4px rgba(000, 000, 000, 0.5) inset;
    }
.btn:hover {
    background-color: #00ebeb;
    }
.btn:active {
    box-shadow:
        -1px -1px 4px rgba(255, 255, 255, 0.5) inset,
         1px  1px 4px rgba(000, 000, 000, 0.5) inset;
    }

/* green */
.btn_green {
    background-color: #009900;
    border-color: #009600;
    }
.btn_green:hover {
    background-color: #00c200;
    }

/* red */
.btn_red {
    background-color: #e00000;
    border-color: #c13d00;
    }
.btn_red:hover {
    background-color: #f00000;
    }

<button class="btn btn_green btn_small ">
    Send

</button>

<button class="btn">
    Buy

</button>

<button class="btn btn_green">
    Activate

</button>

<button class="btn btn_red">
    Delete

</button>

Main Question: Why don't filters work on pseudo elements in IE8?

Update:
I guess that filters do not work on css-generated content, despite the fact that it is not mentioned on this MSDN page.
I solved my problem in IE8 by applying filters to conditional elements like I do for IE7.
Final demo: (http://jsfiddle.net/matmuchrapna/8M5Tt/73/)

/**
 * Button w/o images
 */
html {
    font-size: 62.5%;
    }
body {
    font: normal 1em/1em Arial, Tahoma, Verdana, sans-serif;
    }

/* layout */
.btn {
    display: inline-block;
    height: 28px;
    border-width: 1px;
    border-style: solid;
    width: 170px;
    box-sizing: content-box;
    overflow: hidden;
    position: relative;
    z-index: 1;
    }
.btn {
    margin: 15px;
    }
.btn.btn_small {
    width: 130px;
    }

/* ie78 */
.lt-ie9 .btn .before,
.lt-ie9 .btn .after {
    position: absolute;
    right: -1px;
    left: -1px;
    display: block;
    height: 3px;
    }
.lt-ie9 .btn .before {
    top: -1px;
    filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#80ffffff', endColorstr='#00ffffff',GradientType=0 );
    }
.lt-ie9 .btn .after {
    bottom: -1px;
    filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#00ffffff', endColorstr='#80000000',GradientType=0 );
    }
/* /ie78 */

/* typo */
.btn {
    /* 28 / 14 = 2.57142857 */
    font: bold 14px/2 Arial, Helvetica, Tahoma, sans-serif;
    text-transform: uppercase;
    }
.btn:active {
    line-height: 2.4em;
    }

/* color */
.btn {
    background-color: #00cccc;
    color: #fff;
    border-color: #00a8a8;
    border-radius: 3px;
    cursor: pointer;
    box-shadow:
         1px  1px 4px rgba(255, 255, 255, 0.5) inset,
        -1px -1px 4px rgba(000, 000, 000, 0.5) inset;
    }
.btn:hover {
    background-color: #00ebeb;
    }
.btn:active {
    box-shadow:
        -1px -1px 4px rgba(255, 255, 255, 0.5) inset,
         1px  1px 4px rgba(000, 000, 000, 0.5) inset;
    }

/* green */
.btn_green {
    background-color: #009900;
    border-color: #009600;
    }
.btn_green:hover {
    background-color: #00c200;
    }

/* red */
.btn_red {
    background-color: #e00000;
    border-color: #c13d00;
    }
.btn_red:hover {
    background-color: #f00000;
    }

<button class="btn btn_green btn_small ">
    Send

</button>

<button class="btn">
    Buy

</button>

<button class="btn btn_green">
    Activate

</button>

<button class="btn btn_red">
    Delete

</button>

Update 2:
I solved my problem, but the main question is still unanswered:

"Why don't filters work on pseudo elements in IE8?"

Started a bounty.
Update 3:
I created testcase only for filters(and also -ms-filter) on ie8:

But the filters still don't want to work on pseudo-elements.
Update 4:
I think Scotts answer is closest to truth.

A: The documentation on -ms-filter -a synonym for filter- states:

An object must have layout for the filter to render.

My first guess was that the :before content doesn't have hasLayout set to true. And while it's probably not set to true, it's probably not set to false either. For starters, when I followed the hasLayout docs to force the content to get hasLayout = true (see jsfiddle) it didn't solve anything.
So I'd say it's neither true nor false. Instead, it's probably undefined. I noted in the same docs it says about the source of this property:

object.currentStyle.hasLayout

If we have a look at the W3 documentation on the content property it says:

Generated content does not alter the document tree. In particular, it is not fed back to the document language processor (e.g., for reparsing).

So, a possible conclusion would be that the generated content is not an object, as such it does not have a currentStyle property, and thus also doesn't have hasLayout set to true. This would be the reason that filters don't work on the generated content, and thus answer the question.

At first sight I thought I had found a hint in the console of the above fiddle:
document.querySelectorAll('div')[0].currentStyle.hasLayout;
// true

document.querySelectorAll('div:before')[0].currentStyle.hasLayout
// Unable to get value of the property 'currentStyle':
// object is null or undefined

But as mentioned in the comments by @BoltClock: querySelectorAll cannot access pseudo-elements.

Another hint (though -again- nothing more than a hint) that filter won't work on pseudo-elements can be found in this msdn introduction on filters, stating (emphasis mine):

Filters are applied to HTML controls through the filter property

Although I'm not sure what is meant by "HTML controls", I wouldn't expect content generated by the :before pseudo-element to be considered a "HTML Control".

A: The question is "Why don't filters work on pseudo elements in IE8?" The following is as close to a definitive answer as I can muster. It comes from the information on this page.
The gradient filter is a "procedural surface" (along with alphaimageloader). A procedural surface is defined so:

Procedural surfaces are colored surfaces that display between the
  content of an object and the object's background.

Read that carefully. It is essentially another "layer" you might say between the content of an object and that object's background. Do you see the answer to the question? What is created by :before and :after... Yes! Content. Specifically as MSDN notes:

The ::before and ::after pseudo-elements specify the location of
  content before and after an element in the document tree. The content
  attribute, in conjunction with these pseudo-elements, specifies what
  is inserted.
The generated content interacts with other boxes as if they were real
  elements inserted just inside their associated element.

Now, if it is content that is generated, then it is not an "object" containing content, but the content itself (which happens to have some behavior similar to an element object that might contain content).
Thus, there is no "object" containing "content" (since it is content) between which the filter can place a procedural surface for content generated by a pseudo-element (i.e. "false element"). A gradient must be applied to the object, and then the procedural surface is placed between it and the content.

A: Rather than using IE's filter style for this, have you considered using CSS3Pie?
This is a script for IE that adds support for standard CSS box-shadow and gradients, so you can write the same code in all browsers rather than having to have all those IE-specific styles.

A: I already gave my preferred solution (use CSS3Pie), but I'll post this as a separate answer.
The likely reason why IE8 fails to work with filter where IE7 works is because IE8 changed the syntax for filter.
filter is an IE-specific proprietary style. When Microsoft released IE8, they made a big point of trying to be "standards compliant". The "standards compliant" way of supporting a non-standard style is to give it a vendor prefix, and that is what Microsoft did.
So therefore in IE8, you need to do the following:
-ms-filter: "progid:DXImageTransform.Microsoft.gradient( startColorstr='#80ffffff', endColorstr='#00ffffff',GradientType=0 )";

IE7 doesn't support this syntax, so you need them both.
IE8 does in fact work with the old syntax in some cases. The cases where it doesn't work tend to be the ones where you use the progid: syntax. The reason for this is that the colon after progid causes it to be invalid CSS syntax, which is why MS added quotes around the whole thin for the IE8 -ms-filter version.
So the short answer is, use both versions in your stylesheets, and you'll be fine.

A: Wow, this is a tough one.
After reviewing this chart, confirming that IE8 only likes single colons on its pseudo-elements, reading this possibly related blog article, and doing a lot of testing in jsFiddle (although, it's little in comparison to your 73?? jsFiddles), I would have to conclude that this is a bug in IE8.
IE9 can do gradients on pseudo-elements (with base64 nonsense) but IE8 is stubbornly broken.


text:
Q: Python tkinter window loses focus when an info alert is displayed I am constructing a basic login system in tkinter (python), When the user enters their details to register, I want to display a tkmessagebox that will tell them if there are any errors in their input.
When the GUI loads initially, they are asked if they would like to login or register (works fine). Say the user clicks Register, they are brought to a second screen to enter their details (also works fine). From here, when they enter their details and click register, if the error alert displays, the register part of the GUI loses focus and disappears behind the first part of the GUI where the user would of chosen to go to the register screen.
Is there any way to prevent my child window from loosing focus when an alert is shown?
def registerCheck(self):

    #print('Username: '+ str(self.UN.get()))
    errorList = ''
    if self.UN.get() == '':
        errorList += 'Username cannot be empty\n'
    if len(self.PW.get()) < 4:
        errorList += 'Password must be more than 4 characters long\n'
    if self.PW.get() != self.PWCF.get():
        errorList += 'Passwords do not match\n'
    if len(self.Email.get()) < 5:
        errorList += 'Email is not valid\n'

    if errorList == '':
        tkMessageBox.showinfo(title="About", message="No Errors Found")
    else:
        tkMessageBox.showerror(title="Errors Found!", message=errorList)

    return

A: Make the messagebox a child of the second window, rather than an implicit child of the root window.  You can do this by setting the parent attribute when creating the messagebox.
For example:
new_window = Toplevel()
...
tkMessageBox.showinfo(parent=new_window, title="About", message="...")


text:
Q: Why are .gif files not supported? This is a question that I have been asking myself for a while and I have not found an answer.
Is it because of licensing issues? Because of the file format? Some other reason?

A: There is an article in TUGboat from 1996 (written by by Keith Reckdahl) that includes a discussion of supporting image formats. The article is from Volume 17 No. 1 and is called Using EPS Graphics in LATEX2ε Documents Part 1. The discussion is centered around dvips, but a similar argument can be made for direct pdf output (see David's comment on this question). Also the historical practise of not implementing direct support in dvips may have influenced choices made for pdflatex and later compilers.
Quote (page 52-53):

10.3  Including Non-EPS Graphic Files
While it is easy to insert EPS graphics into LATEX documents, it is not as straightforward to insert
non-EPS graphics (GIF, TIFF, JPEG, PICT, etc.).
[...]
10.3.1  Direct Support for Non-EPS Graphics
It is often requested that LATEX and dvips support the direct inclusion of non-EPS graphic
formats, making it as easy as inserting EPS files. While this would be
convenient, there unfortunately are some problems which complicate
things.
For example, most non-EPS graphic formats use binary files
which cannot be read by TEX, which prevents LATEX from determining the
size of the non-EPS graphics. Furthermore, supporting non-EPS graphics
would also require dvips to incorporate graphics conversion
capabilities (GIF-to-PS, TIFF-to-PS, etc.). This would not only
require a lot of programming, it would also require more maintenance
in the future.
Rather than directly incorporating graphics conversion
routines, dvips provides a mechanism of calling external conversion
programs. This mechanism can be accessed from LATEX by use [of] the
command argument of \DeclareGraphicsRule. This has the benefit of being
more flexible than direct support, and since it keeps the graphics
conversion uncoupled from the DVI-to-PS conversion, users are free to
choose their own graphics conversion program.

Another interesting historical approach is described in an article from 1991, where photos in GIF format are converted into a font (!) for direct inclusion into LaTeX documents.

A: Just to prove the opposite: Direct embedding GIF is possible, admittedly not in PDF, yet in SVG output.
We just have to add a graphicx rule that treats GIF (static/animated) as another bitmap format (besides PNG and JPEG) with a user-provided <img file base name>.xbb file containing the bounding box information:
\DeclareGraphicsRule{.gif}{bitmap}{.xbb}{}

For a 480px * 360px image, the contents of the xbb file reads
%%BoundingBox: 0 0 480 360

For in-lining GIF data into the SVG output, the GIF file must be base64 encoded. Package media4svg provides a command for this that we make use of to modify the graphicx driver code for bitmaps (\Ginclude@bitmap).

(Requires pkg media4svg, v0.9 2022-08-12.)
Typeset example.tex listed below with
dvilualatex example
dvisvgm --zoom=-1 --bbox=papersize --font-format=woff2 example

or
latex --shell-escape example
dvisvgm --zoom=-1 --bbox=papersize --font-format=woff2 example

or even
xelatex --shell-escape --no-pdf example
dvisvgm --zoom=-1 --bbox=papersize --font-format=woff2 example.xdv

N.B. Firefox fails to play animated GIF embedded in SVG that is itself embedded in a web page (like TeX.SX). It looks like a bug. Use a Blink-based web browser instead, such as Chromium, Chrome, Opera or Edge. Or (right-)click on the image to open the SVG in a browser tab of its own.

Input file example.tex.
(Download GIF from https://upload.wikimedia.org/wikipedia/commons/d/d3/Newtons_cradle_animation_book_2.gif)
\documentclass[dvisvgm]{article}

% download `Newtons_cradle_animation_book_2.gif' before typesetting:
%
% https://upload.wikimedia.org/wikipedia/commons/d/d3/Newtons_cradle_animation_book_2.gif

\usepackage[a6paper]{geometry}
\usepackage{graphicx}
\DeclareGraphicsRule{.gif}{bitmap}{.xbb}{}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% provide BoundingBox information in a separate .xbb file
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{filecontents}[overwrite,noheader]{Newtons_cradle_animation_book_2.xbb}
%%BoundingBox: 0 0 480 360
\end{filecontents}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% patch graphics backend driver `dvisvgm.def' to physically embed
% bitmaps into DVI
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\makeatletter
\let\Ginclude@bitmapOrig\Ginclude@bitmap
\def\Ginclude@bitmap#1{%
  \baseSixtyFour{#1}{72}{{?nl}}\bitmap@stream%
  \Ginclude@bitmapOrig{%
    data:image/\expandafter\remove@dot\Gin@ext;;base64,{?nl}%
    \bitmap@stream}%
}
\def\remove@dot.#1;{#1}
\makeatother

\RequirePackage{media4svg} % provides base64-encode utility
\ExplSyntaxOn
\cs_new:Npn\baseSixtyFour#1#2#3#4{
  \sys_if_engine_luatex:TF{
    \xdef#4{\directlua{media4svg.base64("#1",#2,"#3")}}
  }{
    \msvg_convert_file_to_blob:nnnN{#1}{#2}{#3}#4
  }
}
\ExplSyntaxOff
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\begin{document}

\section{Animated GIF}
\noindent\includegraphics[width=\linewidth]{Newtons_cradle_animation_book_2.gif}

\end{document}


text:
Q: Can import module html tag in modal with a function? My example is the next in the modal html:

    {{ data.title }}

    {{ data.body }}

modal code ts:
constructor( public dialogRef: MatDialogRef<GeneralComponent>,
    @Inject(MAT_DIALOG_DATA) public data: any) {}

code in the component where I call the modal html:

<app-opening></app-opening>

code in the component where I call the modal ts:
showModal( name,body) {
const title = name;
const body = body;
const dialogConfig = new MatDialogConfig();
dialogConfig.disableClose = true;
dialogConfig.autoFocus = true;
dialogConfig.data = {
  id: 1,
  title: nombre_titulo,
  body: body_graphic,
};
this.dialog.open(GeneralComponent, dialogConfig);
opening(){
console.log(true);

this.showModal(
    "opening",
  `<app-opening></app-opening>`

)  }

With this code the modal is shown in text, I want to show the component inside the modal, thanks for your help

A: Use
 tag to encapsulate the inner component in your modal template.


text:
Q: When is a matrix equal to its own inverse? When is a matrix equal to its own inverse?
If you have a $2\times2$ matrix and one if the entries is equal to $x$, for what values of $x$ is this matrix equal to its own matrix? And why?

A: Suppose $\;A=\begin{pmatrix}a&b\\c&d\end{pmatrix}\;$ is invertible, then
$$A^{-1}=\frac1{ad-bc}\begin{pmatrix}d&-b\\-c&a\end{pmatrix}$$
Now calculate stuff.

A: The easiest way is just to write that
$$
A^2=\left(\begin{matrix}a & b \\ c & d\end{matrix}\right)\left(\begin{matrix}a & b \\ c & d\end{matrix}\right)=\left(\begin{matrix}a^2+bc & (a+d)b\\(a+d)c & d^2+bc\end{matrix}\right)=I.
$$
Since $(a+d)b=(a+d)c=0$, either $a+d=0$ or $b=c=0$.  In the latter case, we must have $a^2=d^2=1$.  In the former case, we must have $a^2+bc=1$... either $a^2=1$ and $bc=0$, or else $a^2\neq 1$ and $bc=1-a^2$.  So
$$
A=\left(\begin{matrix}\pm 1 & 0 \\ 0 & \pm 1\end{matrix}\right),
$$
or else
$$
A=\left(\begin{matrix}\pm 1 & b \\ 0 & \mp 1\end{matrix}\right) \text{ or } \left(\begin{matrix}\pm 1 & 0 \\ c & \mp 1\end{matrix}\right),
$$
or
$$
A=\left(\begin{matrix} a & b \\ (1-a^2)/b & -a\end{matrix}\right) \qquad (a^2\neq 1, b\neq 0).
$$

A: By Cayley-Hamilton we have $A^2-tr(A)A+\det(A)I=0$. Now $A=A^{-1}$ implies $A^2=I$. So we obtain $tr(A)A=(\det(A)+1)I$.  Now the rest is easy.


text:
Q: Define a junk hand in poker I was watching my wife play video poker and, when she drew a junk hand, she always kept one card and drew four. I don't play poker any more, but when I did, I threw all of the cards away and drew five. I was wondering which was the better option.
The problem with that question is that I really don't know how to define precisely what a junk hand is. So, I decided to ask a simpler, but related question. Suppose I played a video poker game in which I had two choices,
 1. Pick any face card, deuce through ten, and then draw four more cards.

 2. Draw five cards.

Which choice has the better chance of winning?
But the more I thought about it, the more I got interested in the original question. So that brings me to my question. How would you define a junk hand in a standard game of video poker?
I was thinking along the lines of
 A poker hand is a junk hand if replacing any one card would not
 result in a paying hand.

What do you think of that definition.

A: I finally decided on this definition.
A hand is a junk hand if you cannot get a winning hand by drawing one new card.


text:
Q: Fire hover event on page load - jquery There is a CSS hover event for each letter. On hover it increases its size and on mouseleave, its back to normal.
I would like to show the same effect on page load.
When page loads, 'H' will zoom in & out & then 'E' & then 'L'......one after the other
Here is what I tried but didnt work - http://jsfiddle.net/vrm0bve1/
HTML:
H
E
L
L
0

CSS
     .animate {
    font-size:14px;
    -webkit-transition: font-size 1s;
    -moz-transition: font-size 1s;
    -ms-transition: font-size 1s;
    -o-transition: font-size 1s;
    transition: font-size 1s;
}
.animate:hover {
    font-size: 3.5em;
}

JS
$(".char1").trigger('mouseover').trigger('mouseleave');
$(".char2").trigger('mouseover').trigger('mouseleave');
$(".char3").trigger('mouseover').trigger('mouseleave');
$(".char4").trigger('mouseover').trigger('mouseleave');
$(".char5").trigger('mouseover').trigger('mouseleave');

A: You can use WOW.js for this.
Check this Fiddle
HTML:
H
E
L
L
0

CSS:
.animated {
  -webkit-animation-duration: 1s;
          animation-duration: 1s;
  -webkit-animation-fill-mode: both;
          animation-fill-mode: both;
  -webkit-animation-name: zoomInOut;
          animation-name: zoomInOut;
}
@-webkit-keyframes zoomInOut {
  0% {
    font-size: 14px;
  }
  50% {
    font-size: 3.5em;
  }
  100% {
    font-size: 14px;
  }
}
@keyframes zoomInOut {
  0% {
    font-size: 14px;
  }
  50% {
    font-size: 3.5em;
  }
  100% {
    font-size: 14px;
  }
}

JS:
new WOW().init();

Make sure to include WOW.js plugin.

A: Without using any extra plugin:
You can do it with the concept of closure like below:

$(document).ready(function(){

var span = $("span[class]");
for(var i=0; i<span.length;i++){
animate = function(x){
   //console.log(x);
   setTimeout(function(){
       x.addClass("scale").prev().removeClass("scale");

   }, i*2000);

};

animate(span.eq(i));

};

});
.animate {

    font-size:14px;
    -webkit-transition: font-size 1s;
    -moz-transition: font-size 1s;
    -ms-transition: font-size 1s;
    -o-transition: font-size 1s;
    transition: font-size 1s;
}
.scale {
    font-size: 3.5em;
}

.animate:hover{
    font-size: 3.5em;
}

H
E
L
L
0

A: http://jsbin.com/wafacawumi/edit?html,output
Recursive version. WOW.js is cool, but is that worth pollutting your js with all the features you won't use?


text:
Q: How can we store a hash table in Apache Arrow? I am pretty new to Apache Arrow so this question may be ignorant. Apache Arrow provides the capability to store data structures like primitive types/struct/array in standardised memory format, I wonder if it is possible to store more complex data structures like hash table (or balanced search tree) with Apache Arrow?
Many algorithms relies on these data structures to work, do Apache Arrow users need to convert arrow data into language specific data structure in this case?

A: You can certainly define a static/immutable hash table backed by the Arrow columnar format (e.g. if you want to be able to memory map an on-disk hash table). You have to decide what is the "schema" of the hash table, for example it could be
is_filled: boolean
key: KeyType
value: ValueType

This presumes that the hash and comparison functions are known and constant to the application based on the key type.
If you want the keys and values to be next to each other in memory then you could encode them in a binary type
is_filled: boolean
keyvalue: binary

The actual implementation of the hash table is up to you. You're welcome to contribute such code to the Apache Arrow codebase itself.


text:
Q: On Linux how can I capture the desktop to an OpenGL texture? I'm writing a cross platform open source Oculus Rift desktop viewer. I decided to start with Linux because I prefer developing on it. I've already got the texture warping working but now I need to capture the desktop to an OpenGL texture. There are other issues I'm not entirely sure how to resolve like rendering the warped desktop to my window while capturing every window except mine. Any clue how I would go about this?

A: I think your best course of action would be actually to write a fully fledged compositor.
There is the GLX_texture_from_pixmap extension, that allows you to source any pixmap compatible X11 drawable into a OpenGL texture. For a start it might be enough to simply pull the root window (pixmap) as it is into a OpenGL texture. Later you might want to use the Composite extension to redirect windows to off-screen rendering and composite them in 3D space as a stereoscopic picture in the Occulus Rift.


text:
Q: Django : FOREIGN KEY constraint failed on delete, but I don't have any Foreign Key on my model Here is my model which objects I can't delete :
class Broker(models.Model):
    code =              models.CharField(default="", max_length=100, blank=True)
    name =              models.CharField(default="", max_length=100, blank=True)
    email =             models.CharField(default="", max_length=100, blank=True)
    city =              models.CharField(default="", max_length=100, blank=True)
    address =           models.CharField(default="", max_length=100, blank=True)
    postal_code =       models.CharField(default="", max_length=100, blank=True)
    brokerage =         models.FloatField(default=0.00)

    class Meta:
         verbose_name = 'Broker'
         verbose_name_plural = 'Brokers'
         ordering = ['name']

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

Here is what creates my error (he occurs on the line where I make rem.delete()):
if request.POST.get('action') == 'remove_element_selected':
    element_selected = request.POST.getlist('element_selected[]')
    for element_id in element_selected:
        rem = Broker.objects.get(id=element_id)
        rem.delete()
    return JsonResponse({})

And here is my error :
Internal Server Error: /brokers/
Traceback (most recent call last):
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/django/db/backends/base/base.py", line 239, in _commit
    return self.connection.commit()
sqlite3.IntegrityError: FOREIGN KEY constraint failed

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/django/core/handlers/exception.py", line 34, in inner
    response = get_response(request)
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/django/core/handlers/base.py", line 126, in _get_response
    response = self.process_exception_by_middleware(e, request)
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/django/core/handlers/base.py", line 124, in _get_response
    response = wrapped_callback(request, *callback_args, **callback_kwargs)
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/sentry_sdk/integrations/django/views.py", line 67, in sentry_wrapped_callback
    return callback(request, *args, **kwargs)
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/django/contrib/auth/decorators.py", line 21, in _wrapped_view
    return view_func(request, *args, **kwargs)
  File "/Users/lucas/Desktop/myapp/app/views/views.py", line 636, in brokers
    rem.delete()
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/django/db/models/base.py", line 880, in delete
    return collector.delete()
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/django/db/models/deletion.py", line 306, in delete
    sender=model, instance=obj, using=self.using
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/django/db/transaction.py", line 212, in __exit__
    connection.commit()
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/django/db/backends/base/base.py", line 261, in commit
    self._commit()
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/django/db/backends/base/base.py", line 239, in _commit
    return self.connection.commit()
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/django/db/utils.py", line 89, in __exit__
    raise dj_exc_value.with_traceback(traceback) from exc_value
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/django/db/backends/base/base.py", line 239, in _commit
    return self.connection.commit()
django.db.utils.IntegrityError: FOREIGN KEY constraint failed

Between, I'm using Django 2.1.15 and python 3.7.9
Also, I removed all the objects that was link in foreign key with my broker model.


text:
Q: diameter of Riemannian manifolds Let $M$ be a compact Riemannian manifold of dimension $n$. If $M\subset N$ is an embedding in another Riemannian manifold, we can define the diameter $d(M,N$) of $M$ in $N$ as the longest distance in $N$ of two points in $M$. For example if $S^2$ is a sphere of radius $R$ in ${\mathbb{R}}^3$, we have
$$d(S^2,S^2)=\pi R , \qquad d(S^2,{\mathbb{R}}^3)=2R.$$
If $d>0$ is an integer we can then define
$$e(M,d)=\inf\big(d(M,N);\quad M\subset N \quad \text{and} \quad \dim(N)=\dim(M)+d\big)$$
If there a way (a formula) to compute $e(M,d)$ ? Is it true that
$$\lim_{d\to\infty}e(M,d) \ = \ 0 \ ?$$

A: This is just an expanded version of Einar Rødland's comment. Note that it suffices to show that $e(M,1) = 0$. Let $N = M \times \mathbb R$ and $M\subseteq N$ is identified with $M \times \{0\}$. For each $\epsilon >0$, let $g = g_\epsilon$ be a metric on $N$ given by
$$g_\epsilon = f^2_\epsilon (t) ( g_M + dt^2),$$
where $ f_\epsilon$ is a positive function so that
$$f_\epsilon (t) = \begin{cases} 1 & \text{if } t\in (-\epsilon/8,\epsilon/8), \\ \epsilon/2d(M) &\text{if } t= \epsilon/4\\ \le 1 &\text{otherwise.}\end{cases}$$
Note that $M \subset N$ is an isometric embedding. Let $x,y\in M$ and $\gamma$ be a minimal geodesic in $M$ joining $x, y$. Then the (piecewise smooth) curve
$$ (x,0) \to (x,\epsilon/4) \overset{(\gamma(\cdot), \epsilon/4)}{\to } (y,\epsilon/4) \to (y,0)$$
has length less than $\epsilon/4 + (\epsilon/2d(M)) \times d_M(x,y) + \epsilon /4 \le \epsilon$.
Since $x, y$ are arbitrary, $e(M,1) \le \epsilon$. Thus $e(M,1) = 0$ as $\epsilon $ is arbitrary.


text:
Q: Как добавить существующую запись из базы в форму? Путь будет такая ситуация. Рабочие бригады заходят в свою учетку и заполняют форму о проделанной работе. В конце месяца бригадир входит в свою учетку и видит все эти записи, он должен их подтвердить (чекбокс), возможно исправить, и написать комменты.
Пусть модель выглядит так:
class TaskList(models.Model):
    worker = models.Charfield(max_length=50)
    task = models.CharField(max_length=20)
    date = models.DateField()
    signed = models.BooleanField(default=0)
    comment = models.CharField(max_length=200)

Формы:
class TaskFormWorker(ModelForm):
    class Meta:
        model = TaskList
        fields = ['task', 'date']

class TaskFormManager(ModelForm):
    class Meta:
        model = TaskList
        fields = [f.name for f in TaskList._meta.get_fields()]

То есть Бригадир жмет на задачу в списке задач и попадает в детализацию, доступную для редактирования.
Как сделать так, чтобы данные по выбранной задаче из базы попадали в форму?
Например, я через URL передам ID задачи, получу экземпляр TaskList, но как его передать форме?..

A: Вы можете создать форму из модели. Для этого воспользуйтесь стандартным классом Django ModelForm
Пример из документации
>>> from django.forms import ModelForm
>>> from myapp.models import Article

# Create the form class.
>>> class ArticleForm(ModelForm):
...     class Meta:
...         model = Article
...         fields = ['pub_date', 'headline', 'content', 'reporter']

# Creating a form to add an article.
>>> form = ArticleForm()

# Creating a form to change an existing article.
>>> article = Article.objects.get(pk=1)
>>> form = ArticleForm(instance=article)

При рендере ModelForm с переданным экземпляром модели вы получите форму с заполненными данными.
Документация:

*

*На английском

*На русском


text:
Q: Django allauth allowed urls I just started with a Django project using allauth, I configured the basic settings, without using any 3rd party provider. I've created a basic template for my profile page. Everything is working as expected so far, but if a go to localhost:8000/accounts/profile I can see the page even without log in before. I've tried to look in the documentation how to define which page should require be logged in but I haven't found anything.
Any thoughts?
Thanks!
EDIT
These are my allauth settings:
#Allauth Config
ACCOUNT_AUTHENTICATION_METHOD = 'email'
ACCOUNT_EMAIL_REQUIRED = True
ACCOUNT_UNIQUE_EMAIL = True
ACCOUNT_USERNAME_REQUIRED = False
ACCOUNT_SIGNUP_FORM_CLASS = 'picturesApp.forms.SignupForm'
ACCOUNT_EMAIL_VERIFICATION = 'none'

A: One possible way to do what you want is to decorate the view handling your profile page woth 'login_required' decorator.
Example:
from django.contrib.auth.decorators import login_required
urlpatterns = patterns('',
   # MY PROFILE
   url(r'^$',
       login_required(MyProfileDetailView.as_view()),
       name="my_profile"
   )
)

This decorator verifies the user is logged in, otherwise it returns a redirect http response (to the login url).
Hope this helps you.


text:
Q: xhr html file upload on imgurl gives bad request I want to upload an image to imgur using their API; using javascript (node.js).
I always get this as response:

{"data":{"error":"Image format not supported, or image is corrupt.","request":"/3/upload","method":"POST"},"success":false,"status":400}

Here's the code I wrote:
ImgUrlHelper =
{
InitUploadValidateFile :function(element)
{
     var file = element.value;
     if(file === "")
        return;

     if(file != '')
     {
         var valid_extensions = /(.jpg|.jpeg|.gif|.png)$/i;
          if(valid_extensions.test(file))
          {
                console.log("ok");
                this.Upload(file);
          }
          else
                console.log("notok");
     }
     else
        console.log("notok");
},

Upload: function(file) {

    var fd = new FormData();
    fd.append("image", file);
    var xhr = new XMLHttpRequest();

    xhr.open("POST", "https://api.imgur.com/3/upload", true);
    xhr.onload = this.OnLoad;
    xhr.onerror = this.OnNetworkError;
    xhr.onreadystatechange = this.OnReadyStateChange;
    xhr.onprogress= this.OnProgress;

    xhr.setRequestHeader('Authorization', 'Client-ID xxxxxxxxxxxx');
    xhr.send(fd);
},

OnReadyStateChange:function(xhr){
    if(xhr.readyState == 4 && xhr.status == 200)
    {
        var link = JSON.parse(xhr.responseText).data.link;
        console.log(link);
    }
    if(xhr.status != 200)
    {
        console.log(xhr.status);

        //log error
    }
},

OnNetworkError:function(xhr)
{
    //log error
    console.log("network error while uploading.");
    console.log(xhr);
},

OnProgress : function(e)
{
    if (e.lengthComputable) {
      var percentComplete = (e.loaded / e.total) * 100;
      console.log(percentComplete + '% uploaded');
    }
},

OnLoad :  function(res) {

}
}

I call this by using an onchange event on an input type="file":
onchange="ImgUrlHelper.InitUploadValidateFile(this)"

I assume there is a problem reading the file that i selected with the file upload control, here:
fd.append("image", file);

At that point, file contains the string: "C:\fakepath\img.jpg". Do I maybe need to actually encode the image?

A: You should upload a File object, not a string.
Change var file = element.value; to var file = element.files[0];:
// assuming that element is an <input type=file>
InitUploadValidateFile: function(element) {
    var file = element.files[0];
    if (!file)
        return;

    var valid_extensions = /(\.jpg|\.jpeg|\.gif|\.png)$/i;
    if (valid_extensions.test(file.name)) {
        console.log("ok");
        this.Upload(file);
    } else {
        console.log("notok");
    }
},


text:
Q: pégar imagem e gravar no banco de dados sql no campo image Boa tarde.
Estou com um probleminha no meu código e preciso de uma ajuda. Estou inserindo uma imagem no meu form em um campo imagem, agora preciso pegar esta imagem e gravar em um campo no sql server um campo image. Como posso realizar esta gravação.
segue abaixo meu código onde busco a imagem no pc e jogo no Form.
 private void btn_imagem_Click(object sender, EventArgs e)
    {
        open_imagem.FileName = "";
        open_imagem.Title = "Imagem do Chamdo";
        open_imagem.Filter = "JPEG | *.JPG | PNG | *.PNG";
        open_imagem.ShowDialog();
    }

    private void open_imagem_FileOk(object sender, CancelEventArgs e)
    {
        pcb_imagem.Image = Image.FromFile(open_imagem.FileName);
    }

Agora segue o código de insert.
 public String cadchamado(String usuario, String departamento, String tipo, String comentario, DateTime data)
    {
        if (usuario != "")
        {
            tem = false;
            cmd.CommandText = "insert into tbl_chamados values(@GM_USUARIO, @GM_DEPARTAMENTO, @GM_TIPO, @GM_COMENTARIO, @GM_DTINICIAL)";
            cmd.Parameters.AddWithValue("@GM_USUARIO", usuario);
            cmd.Parameters.AddWithValue("@GM_DEPARTAMENTO", departamento);
            cmd.Parameters.AddWithValue("@GM_TIPO", tipo);
            cmd.Parameters.AddWithValue("@GM_COMENTARIO", comentario);
            cmd.Parameters.AddWithValue("@GM_DTINICIAL", data);
            try
            {
                cmd.Connection = con.conectar();
                cmd.ExecuteNonQuery();
                con.desconectar();
                this.mensagem = "Chamado incluído com sucesso!!";
                tem = true;
            }
            catch (SqlException)
            {
                throw;

                //this.mensagem = "Erro ao inserir chamado verifique!!";
            }
        }
        else
        {
            this.mensagem = "Existem campos em branco por favor preencer, obrigado!!";
        }
        return mensagem;
    }

Desde já agradesço


text:
Q: Sikuli is not working in some machine I have tried Sikuli for ui-automation.  I have created an image and i tried to perform a click operation. It is working in one PC but while trying in another PC it is not working.  I am getting an error "Fail can not find P(c:/users/--/pictures/googles.png".  What might be the cause for the issue.  Should I change any settings in my machine.  Can u please help me.
Thanks,
Ganesh. K

A: That could be due to the directory. For example, try changing the "/" for "\\". The directory should look something like this:
"C:\\users\\my_directory\\file.png"

Another reason could be that your actual user doesn't have the rights to see that folder. Try putting that images in another directory outside the specific folder user.


text:
Q: Is a space compact iff it is closed as a subspace of any other space? I am trying to come up with an alternate definition of a compact topological space that coincides with the usual one. Sorry if my topology is a little rusty.
My proposed alternative definition is this. Let's say you have a space $X$. Then for any space $Y$, such that $X$ is a subspace of $Y$, then $X$ is closed in the topology $Y$.
This seems to work. If you take $\mathbb N$, you can take the topology $\mathbb N^*=\mathbb N \cup {\infty}$, and then $\mathbb N$ is not closed in $\mathbb N^*$. On the other hand, $[0, 1]$ contains all its limit points, and should be closed in any topology (where the interval has its regular topology.)
Is this equivalent to the open-cover definition of compact set? Has a similar definition been considered before (probably better than mine)?

A: Great question!  The answer is yes if you restrict your attention to sufficiently nice spaces.  Specifically, each of the following statements is true (1 and 3 are quite well-known):

*

*Let $Y$ be a Hausdorff space and $X\subseteq Y$ be a compact subspace.  Then $X$ is closed in $Y$.

*Let $X$ be a regular space such that whenever $X$ is a subspace of a Hausdorff space $Y$, $X$ is closed in $Y$.  Then $X$ is compact.

*Let $X$ be a completely regular space such that whenever $X$ is a subspace of a normal space $Y$, $X$ is closed in $Y$.  Then $X$ is compact.

Proof of 1:  Let $y\in Y\setminus X$.  Since $Y$ is Hausdorff, for each $x\in X$ we can find open sets $U_x$ and $V_x$ such that $y\in U_x$, $x\in V_x$, and $U_x\cap V_x=\emptyset$.  By compactness, there are finitely many $x_1,\dots,x_n\in X$ such that $X\subseteq V_{x_1}\cup\dots\cup V_{x_n}$.  The set $U=U_{x_1}\cap\dots \cap U_{x_n}$ is then a neighborhood of $y$ disjoint from $X$.  Since $y\in Y\setminus X$ was arbitrary, this means $X$ is closed.
Proof of 2:  Suppose $X$ is regular and not compact; let $\mathcal{A}$ be a collection of nonempty closed subsets of $X$ which is closed under finite intersections but $\bigcap \mathcal{A}=\emptyset$.  Let $Y=X\cup\{\infty\}$, topologized such that $U\subseteq Y$ is open iff either $U\subseteq X$ and $U$ is open in $X$ or $U=\{\infty\}\cup V$ for some open set $V\subseteq X$ which contains an element of $\mathcal{A}$.  Then $Y$ clearly contains $X$ as a dense open subspace.  For any $x\in X$, there is some $A\in \mathcal{A}$ which does not contain $x$, and by regularity we can find open sets in $X$ separating $x$ and $A$.  It follows that in $Y$ we can find open sets separating $x$ and $\infty$.  Thus $Y$ is Hausdorff.
Proof of 3:  Let $C(X,[0,1])$ be the set of all continuous maps from $X$ to $[0,1]$ and let $Y=[0,1]^{C(X,[0,1])}$ with the product topology.  There is a map $i:X\to Y$ which sends $x$ to the function $f\mapsto f(x)$ for $f\in C(X,[0,1])$.  Complete regularity implies that this map $i$ is an embedding.  Since $Y$ is compact and Hausdorff, $Y$ is normal (this can be proven by an argument similar to the proof of (1)).  Thus if the hypothesis of (3) holds, then the image of $i$ must be closed.  Since $Y$ is a compact, this means $X$ is compact as well.
Finally, let me note that in (2) I do not know whether you can further require $Y$ to be regular.  However, the requirement that $X$ is regular (rather than just Hausdorff) is necessary, as the following counterexample shows.  Let $K$ be any compact Hausdorff space with a dense open subset $D\subset K$ such that $K\setminus D$ is not discrete.  Let $X$ have the same underlying set as $K$ and be equipped with the following topology: a set $U\subseteq X$ is open iff for every $x\in U$, $U\cap (\{x\}\cup D)$ is open in $\{x\}\cup D$ with respect to the topology inherited from $K$.  Since $K\setminus D$ is not discrete, the topology on $X$ is strictly finer than the topology on $K$ ($\{x\}\cup D$ is open in $X$ for all $x\in X$), so $X$ is Hausdorff and not compact.  Furthermore, $D$ is still dense in $X$, and in fact an ultrafilter $F$ on $D$ converges to a point $x\in X$ iff it converges to $x$ in $K$.
Now suppose $Y$ is a Hausdorff space which contains $X$ as a non-closed subspace.  By replacing $Y$ with the closure of $X$ in $Y$, we may assume $X$ is dense in $Y$, and hence $D$ is also dense in $Y$.  If $y\in Y\setminus X$, there must then be an ultrafilter $F$ on $D$ which converges to $y$.  Since $K$ is compact, $F$ must converge to some point $x\in K$, and as observed above, this means $F$ also converges to $x$ in $X$.  Since $x\neq y$, this contradicts the assumption that $Y$ is Hausdorff.

A: No; take the two-point topological space with one open point and one closed point.  The open point is compact, but not closed.
In fact, I don't think that there are any topological spaces which are closed inside every other topological space.


text:
Q: How can I restrict user to make changes to attachement? I am creating attachment record and I want to restrict user to make any changes to it when he downloads that attachment. Is there any method provided by salesforce to restrict him? or how can I set password to it when creating attachment? or can I make it read only so that user will not be able to edit it. Which approach will help me to complete my requirement?

A: You can vote up this idea which is view only permission for chatter attachments.. https://success.salesforce.com/ideaView?id=08730000000iWBFAA2

A: You cannot control permissions to attachments in that way. You have a couple of options:
a) Create a VF page to show the attachments. Include it in the standard VF page and hide the standard attachment related list (I've done this a few times)
b) Transition to Salesforce Content. This may not apply in most situations but it may in yours. With Content you can do a lot of things that attachments can't.... but there are also things that you can't do that you can with Attachments. Do the research and decide. :)


text:
Q: How to deserialise a number from an XML attribute using serde? I want to deserialize a number (for example, u32) from an XML attribute.
#[macro_use]
extern crate serde_derive;
extern crate serde;
extern crate serde_xml_rs as serde_xml;

#[derive(Deserialize, Debug)]
#[serde(rename = "objects")]
pub struct Objects {
    pub foo: u32
}

fn main() {
    let result_string = r#"<?xml version="1.0" encoding="UTF-8"?>
    <objects foo="42"></objects>"#;
    let deserialized: Objects= serde_xml::deserialize(result_string.as_bytes()).expect("Parse error!");
}

But after execution, I get the following error
thread 'main' panicked at 'Parse error!: invalid type: string "42", expected u32'

I know about #[serde(deserialize_with="...")] annotation, but is there an easier way, (for example use serde_xml_rs crate)?

A: Do not use 0.2.1. Add to Cargo.toml:
serde-xml-rs = { git= "https://github.com/RReverser/serde-xml-rs.git"}

Using serde-xml-rs from master fixes this issue.


text:
Q: How to populate a 2d char array with the alphabet My goal is to create a 2d array of the alphabet like this:
abc
bca
cab
Such that each row and column has all 26 letters.  I know I can do this the manual ugly way, but was hoping someone knows a more efficient way to populate the array.
Thank you.

A: Here you go.
class Alphabet {
public static void main(String args[]) {

    // Create an array that will hold the grid
    char alphGrid[][] = genArray();

    // Two for loops to print the grid on the screen
    for(int i=0; i<26; i++) {

        for(int j=0; j<26; j++) {
            System.out.print(alphGrid[i][j]);
        }
        System.out.println();
    }

} // end of main

// Create a function to generate the grid
public static char[][] genArray(){
    char[][] arr = new char[26][26];

    // Two for loops to generate the grid
    for(int i = 0; i < 26; i++) {
        for(int j = 0; j < 26; j++) {

            // Creates an int that will later be cast to a char
            int let = i + j;

            // Keeps the int from getting too big
            if(let >= 26)
                let = let - 26;

            // Add 65 to the int so that the char will return letters and not ASCII symbols
            let = let + 65;

            // Cast the int to a char
            char letter = (char)let;

            // Put the char into its respective place in the array
            arr[i][j] = letter;

        }
    }

    // Returns the grid
    return arr;
}
}

Output:
ABCDEFGHIJKLMNOPQRSTUVWXYZ
BCDEFGHIJKLMNOPQRSTUVWXYZA
CDEFGHIJKLMNOPQRSTUVWXYZAB
DEFGHIJKLMNOPQRSTUVWXYZABC
EFGHIJKLMNOPQRSTUVWXYZABCD
FGHIJKLMNOPQRSTUVWXYZABCDE
GHIJKLMNOPQRSTUVWXYZABCDEF
HIJKLMNOPQRSTUVWXYZABCDEFG
IJKLMNOPQRSTUVWXYZABCDEFGH
JKLMNOPQRSTUVWXYZABCDEFGHI
KLMNOPQRSTUVWXYZABCDEFGHIJ
LMNOPQRSTUVWXYZABCDEFGHIJK
MNOPQRSTUVWXYZABCDEFGHIJKL
NOPQRSTUVWXYZABCDEFGHIJKLM
OPQRSTUVWXYZABCDEFGHIJKLMN
PQRSTUVWXYZABCDEFGHIJKLMNO
QRSTUVWXYZABCDEFGHIJKLMNOP
RSTUVWXYZABCDEFGHIJKLMNOPQ
STUVWXYZABCDEFGHIJKLMNOPQR
TUVWXYZABCDEFGHIJKLMNOPQRS
UVWXYZABCDEFGHIJKLMNOPQRST
VWXYZABCDEFGHIJKLMNOPQRSTU
WXYZABCDEFGHIJKLMNOPQRSTUV
XYZABCDEFGHIJKLMNOPQRSTUVW
YZABCDEFGHIJKLMNOPQRSTUVWX
ZABCDEFGHIJKLMNOPQRSTUVWXY

A: I got something here! Not the best but maybe ull like it.
import java.util.ArrayList;
import java.util.List;

public class Alphabet{

    public static void main(String[] args){
        char[] c = {'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z'};
        List<String> s = new ArrayList<>(9);

        for(int i = 0; i < c.length; i+=3){
            try{
                s.add(""+c[i] + c[i + 1] + c[i + 2]);
            }catch(Exception e){

                try{
                    s.add(""+c[i] + c[i + 1]);
                }catch(Exception e1){

                    try{
                        s.add(""+c[i]);
                    }catch(Exception e2){

                    }
                }
            }
        }

        System.out.println(s);

    }

}

Output: [abc, def, ghi, klm, nop, qrs, tuv, wxy, z]


text:
Q: Retrieving data from MSExcel and storing in database I'm designing a jsp webpage with postgresql database, I need to upload an excel with 8 fields and I have to store that data into the postgresql database. Can anyone give me links or sample program to do that as I'm new to js??

A: You could use Apache POI on the server side (in your JSP or servlet) to read Excel files.
Then store the data in PostgreSql using JDBC (alternatives are Hibernate or JPA).
As for reading Excel files, there are many examples on SO, for example here

A: If you're able to make use of Node.js you can do it from there.  Check out https://npmjs.org/package/excel in addition to Postgres connection from Node.js (to connect to postgre from Node.js).


text:
Q: Can Steven Sanderson's Partial Request technique be used in Razor pages? I like the idea of Steven Sanderson's Partial Requests in http://blog.stevensanderson.com/2008/10/14/partial-requests-in-aspnet-mvc/ and I'm trying to get it to work with Razor pages. Unfortunately it writes it to the top of the page, instead of where I actually want it to be in the document. I'm guessing the problem is similar to the one answered here: ASP.Net MVC 3 Razor Response.Write position but I don't know how to get around it.
Can anyone supply me with a workaround? Failing that, is there simply another good technique for rendering the contents of another action in a view, without that view having to know about the action?

A: Yes, it is possible.
As I'm sure you're now aware the Razor view engine writes to temporary buffers before writing to the response stream, which is why when you invoke another action the markup gets written to the response out of order.
The workaround that I've used in the past is to temporarily redirect any writes to the response to a MemoryStream while you are trying to render another action, and then creating a MvcHtmlString from the contents of the MemoryStream.
So something like:
public class HttpResonseCapture : IDisposable
    {
        private readonly MemoryStream _stream = new MemoryStream();
        private readonly Stream _originalStream;
        private readonly HttpContextBase _httpContext;

        public HttpResponseCapture(HttpContextBase httpContext)
        {
            _httpContext = httpContext;
            _originalStream = httpContext.Response.OutputStream;
            httpContext.Response.OutputStream = _stream;
        }

        public MvcHtmlString ToHtmlString()
        {
            return MvcHtmlString.Create(Encoding.Unicode.GetString(_stream.ToArray()));
        }

        public void Dispose()
        {
            _httpContext.Response.OutputStream = _originalStream;
            _stream.Dispose();
        }
    }

Can be used like so:
using (var responseCapture = new HttpResponseCapture(httpContext))
{
   // Call other action here
   var result = responseCapture.ToHtmlString();
}


text:
Q: Webpack crashes in console: setState takes an object of state variables to update or a function which returns an object of state variables I had application made with create-react-app, but I've migrated it to webpack-express-boilerplate, now I get this error message in console
invariant.js?4599:44 Uncaught (in promise) Error: setState(...): takes an object of state variables to update or a function which returns an object of state variables.
    at invariant (eval at <anonymous> (main.js:717), <anonymous>:44:15)
    at FilesList.ReactComponent.setState (eval at <anonymous> (main.js:2032), <anonymous>:63:111)
    at eval (eval at <anonymous> (main.js:1270), <anonymous>:114:24)
    at <anonymous>

webpack itself gets started successfully:
webpack built 53f1ce842e44dfee6a2e in 11245ms
Version: webpack 2.6.1
Time: 11245ms
                                 Asset       Size  Chunks                    Chunk Names
  674f50d287a8c48dc19ba404d20fe713.eot     166 kB          [emitted]
  b06871f281fee6b241d60582ae9369b9.ttf     166 kB          [emitted]
  8a86dff3aab5e62166242ab2a41a449d.svg    2.72 kB          [emitted]
  332c573a35a28e5ec065d99dbb5ef2dd.svg     450 kB          [emitted]  [big]
af7ae505a9eed503f8b8e6982036873e.woff2    77.2 kB          [emitted]
 fee66e712a8a08eef5805a46892932ad.woff      98 kB          [emitted]
                               main.js    6.18 MB       0  [emitted]  [big]  main
                            index.html  434 bytes          [emitted]

WARNING in webpack: Using NoErrorsPlugin is deprecated.
Use NoEmitOnErrorsPlugin instead.

Child html-webpack-plugin for "index.html":
         Asset     Size  Chunks  Chunk Names
    index.html  1.48 MB       0
webpack: Compiled with warnings.

This is my webpack configuration file:
module.exports = {
    devtool: 'eval-source-map',
    entry: [
        'webpack-hot-middleware/client?reload=true',
        path.join(__dirname, 'app/main.js')
    ],
    output: {
        path: path.join(__dirname, '/dist/'),
        filename: '[name].js',
        publicPath: '/'
    },
    plugins: [
        new HtmlWebpackPlugin({
            template: 'app/index.tpl.html',
            inject: 'body',
            filename: 'index.html'
        }),
        new webpack.optimize.OccurrenceOrderPlugin(),
        new webpack.HotModuleReplacementPlugin(),
        new webpack.NoErrorsPlugin(),
        new webpack.DefinePlugin({
            'process.env.NODE_ENV': JSON.stringify('development')
        })
    ],
    module: {
        loaders: [{
            test: /\.jsx?$/,
            exclude: /node_modules/,
            loader: 'babel-loader',
            query: {
                "presets": ["react", "es2015", "stage-0", "react-hmre"]
            }
        },
            {
                test: /\.woff(2)?(\?v=[0-9]\.[0-9]\.[0-9])?$/,
                loader: "url-loader?limit=10000&mimetype=application/font-woff"
            },
            {
                test: /\.(ttf|eot|svg)(\?v=[0-9]\.[0-9]\.[0-9])?$/,
                loader: "file-loader"
            }
            ,  {
                test: /\.json$/,
                use: 'json-loader'
            },
            {
                test: /\.css$/,
                use: ['style-loader', 'css-loader']
            }
            , {test: /\.svg$/, loader: 'svg-loader?{png:{scale:2}}'}]
    }
};

What might be the reason for the error? Because of request posting also one file from project:
export default class EventsList extends Component {
    constructor(props) {
        super(props);
        this.state = {};
    }
    reloadData() {
        console.log("EvensList mount");
        axios.get('/EventsList')
            .then(res => {
                console.log(res);
                this.setState(res.data);
            });
    }
    // some other stuff
}

A: In case res.data is an object then you can do
reloadData() {
    console.log("EvensList mount");
    axios.get('/EventsList')
        .then(res => {
            console.log(res);
            this.setState({...res.data});
        });
}

However if it is an array then you need to specify a key and then set the state like
reloadData() {
    console.log("EvensList mount");
    axios.get('/EventsList')
        .then(res => {
            console.log(res);
            this.setState({data: res.data});
        });
}


text:
Q: protectedDataAvailable always true From what I understand, UIApplication.sharedApplication().protectedDataAvailable should return false when the phone is locked and protected data is enabled on the iPhone (apparently setting a passcode enables it).
However, despite of the scenario, it always returns true.
Once my app gets reawaken by iOS due to Corebluetooth State Preservation and Restoration, I need to immediately know whether the phone is locked.
I've implemented event listeners to know when the phone gets locked/unlocked, but they are only useful once the lock state changes, I am unable to determine the lock state prior to an event.
Any ideas? Thanks
UPDATE:
this is what I use in applicationDidFinishLaunchingWithOptions:
self.phoneLockDetection.isPhoneLocked = !UIApplication.sharedApplication().protectedDataAvailable

A: Not under View Device Logs -- that's where you're going to see crash dumps.
There's a device console on Xcode > Window > Devices > Your Device.  It might be collapsed -- click the triangle button at the bottom left of the right-hand pane if so.
I see the following in the console log:
Nov 14 12:07:30 Ewan-Mellors-iPad SpringBoard[54] <Warning>: [MPUSystemMediaControls] Disabling lock screen media controls updates for screen turning off.
Nov 14 12:07:30 Ewan-Mellors-iPad UserEventAgent[775] <Error>:  LockStateNotifier aksNotificationCallback posting notification: com.apple.mobile.keybagd.lock_status
Nov 14 12:07:30 Ewan-Mellors-iPad UserEventAgent[775] <Notice>: (Note ) PIH: Lock status changed.
Nov 14 12:07:30 Ewan-Mellors-iPad MobileMail[192] <Warning>: Key bag transitioning from unlocked to locking

And then ten seconds later:
Nov 14 12:07:40 Ewan-Mellors-iPad kernel[0] <Notice>: AppleKeyStore:Sending lock change 1 for handle 0
Nov 14 12:07:40 Ewan-Mellors-iPad UserEventAgent[775] <Error>:  LockStateNotifier aksNotificationCallback posting notification: com.apple.mobile.keybagd.lock_status
Nov 14 12:07:40 Ewan-Mellors-iPad UserEventAgent[775] <Notice>: (Note ) PIH: Lock status changed.
Nov 14 12:07:40 Ewan-Mellors-iPad MobileMail[192] <Warning>: Key bag transitioning from locking to locked


text:
Q: Castle Active Record Multiple Database Connections (Oracle and SQL) Scenario: I have an application that pulls data from a SQL database as well as an Oracle database. I have NHibernate implemented for the SQL side and a co-worker already has a working implementation of the Oracle side (same object different project). I am currently defining a connection string in App.Config and calling this function in Program.cs
 var connectionString = System.Configuration.ConfigurationManager.ConnectionStrings["Foo"].ToString();
 var configuration = InPlaceConfigurationSource.Build(DatabaseType.MsSqlServer2000, connectionString);
 ActiveRecordStarter.Initialize(System.Reflection.Assembly.GetExecutingAssembly(), configuration);

Note the project is in C# .Net 3.5
I have read about using DifferentDatabaseScope but when I try that the queries don't return any results nor can I see anything in the NHib Profiler. No errors pop up just 0 count.
Question: How do I implement multiple connections?

A: For future users who come across this problem.
      This article helps http://www.darkside.co.za/archive/2008/01/21/castle-activerecord-connecting-to-multiple-databases.aspx
To get this to work I had to add these code snippets to my App.config
<activerecord>

<config>
  <add key="connection.driver_class"
      value="NHibernate.Driver.OracleClientDriver" />
  <add key="dialect"
      value="NHibernate.Dialect.Oracle10gDialect" />
  <add key="connection.provider"
      value="NHibernate.Connection.DriverConnectionProvider" />
  <add key="connection.connection_string"
      value="Data Source =
              (DESCRIPTION =
                 (ADDRESS =
                    (PROTOCOL = TCP)
                    (HOST = SERVERNAME)
                    (PORT = 1521)
                 )
                 (ADDRESS =
                    (PROTOCOL = TCP)
                    (HOST = SERVERNAME)
                    (PORT = 1521)
                 )
                 (LOAD_BALANCE = yes)
                 (CONNECT_DATA =
                    (SERVER = DEDICATED)
                    (SERVICE_NAME = NAME)
                 )
              );User Id = ID; Password = PASS;" />
</config>

And this
    <config type="Sens.SensClass`1, Sens">
      <add key="connection.driver_class"
         value="NHibernate.Driver.SqlClientDriver" />
      <add key="dialect"
         value="NHibernate.Dialect.MsSql2000Dialect" />
      <add key="connection.provider"
         value="NHibernate.Connection.DriverConnectionProvider" />
      <add key="connection.connection_string"
         value="Data Source=mntcon016\;Initial Catalog=TEST;Trusted_Connection=True;" />
    </config>
  </activerecord>

  <configSections>

  </configSections>
  <hibernate-configuration xmlns="urn:nhibernate-configuration-2.2">
    <session-factory>
      <property name="proxyfactory.factory_class"> NHibernate.ByteCode.Castle.ProxyFactoryFactory, NHibernate.ByteCode.Castle </property>
    </session-factory>
  </hibernate-configuration>

Then in Program.cs before Application.Run I have
 ActiveRecordStarter.Initialize(
               ActiveRecordSectionHandler.Instance, types.ToArray());

Where types is a list(function requires an array) of type[]. This list needs to contain every class that will be used with Nhibernate. In my case it contains both the SQL and Oracle classes. As well as this class that is inherited by all my SQL classes
public abstract class TestClass<T> : ActiveRecordBase<T>
{

}

To generate my SQL classes I had used a generator and it made them all Serializable which had to be taken off. Also note that you cannot have classes with the same name or you will get an error.